Renamed OctTree to Octree

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3062 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2009-12-20 22:10:53 +00:00
parent 1a876af375
commit 28a04fbd42
35 changed files with 318 additions and 316 deletions

View File

@ -1,5 +1,7 @@
Changes in 1.7
- Renamed OctTree to Octree
- Allow getting a ConstIterator from a non-const core:list
- Add swap functions to irrMath and to the core classes.

View File

@ -1648,7 +1648,7 @@ Even less visible changes have been made in this version. Only the automatic Sol
Changes for Version 1.6.0
-------------------------
This releases has many changes in method signatures. The most obvious ones are signedness changes from s32 to u32. Since many templates won't accept both types, you need to change the ypes manually in your code. The other major change is from many different types of strings to the new class io::path. These changes should be transparent to the app, unless you need proper overrides in derived classes.
This releases has many changes in method signatures. The most obvious ones are signedness changes from s32 to u32. Since many templates won't accept both types, you need to change the types manually in your code. The other major change is from many different types of strings to the new class io::path. These changes should be transparent to the app, unless you need proper overrides in derived classes.
Finally, some deprecated methods have been removed, and some were simply renamed. Just check the API if some methods is not found anymore.
IMeshSceneNode.h

View File

@ -6,7 +6,7 @@ controlled camera.
Please note that you should know the basics of the engine before starting this
tutorial. Just take a short look at the first tutorial, if you haven't done
this yet: http://irrlicht.sourceforge.net/tut001.html
this yet: http://irrlicht.sourceforge.net/tut001.html
Lets start like the HelloWorld example: We include the irrlicht header files
and an additional file to be able to ask the user for a driver type using the
@ -70,7 +70,7 @@ int main()
case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
case 'f': driverType = video::EDT_NULL; break;
default: return 1;
}
}
// create device and exit if creation failed
@ -104,24 +104,24 @@ int main()
really animated, they are only a huge chunk of static geometry with
some materials attached. Hence the IAnimatedMesh consists of only one
frame, so we get the "first frame" of the "animation", which is our
quake level and create an OctTree scene node with it, using
irr::scene::ISceneManager::addOctTreeSceneNode().
The OctTree optimizes the scene a little bit, trying to draw only geometry
which is currently visible. An alternative to the OctTree would be a
quake level and create an Octree scene node with it, using
irr::scene::ISceneManager::addOctreeSceneNode().
The Octree optimizes the scene a little bit, trying to draw only geometry
which is currently visible. An alternative to the Octree would be a
irr::scene::IMeshSceneNode, which would always draw the complete
geometry of the mesh, without optimization. Try it: Use
irr::scene::ISceneManager::addMeshSceneNode() instead of
addOctTreeSceneNode() and compare the primitives drawn by the video
addOctreeSceneNode() and compare the primitives drawn by the video
driver. (There is a irr::video::IVideoDriver::getPrimitiveCountDrawn()
method in the irr::video::IVideoDriver class). Note that this
optimization with the OctTree is only useful when drawing huge meshes
optimization with the Octree is only useful when drawing huge meshes
consisting of lots of geometry.
*/
scene::IAnimatedMesh* mesh = smgr->getMesh("20kdm2.bsp");
scene::ISceneNode* node = 0;
if (mesh)
node = smgr->addOctTreeSceneNode(mesh->getMesh(0), 0, -1, 1024);
node = smgr->addOctreeSceneNode(mesh->getMesh(0), 0, -1, 1024);
// node = smgr->addMeshSceneNode(mesh->getMesh(0));
/*

View File

@ -78,7 +78,7 @@ int main()
// The Quake mesh is pickable, but doesn't get highlighted.
if (q3levelmesh)
q3node = smgr->addOctTreeSceneNode(q3levelmesh->getMesh(0), 0, IDFlag_IsPickable);
q3node = smgr->addOctreeSceneNode(q3levelmesh->getMesh(0), 0, IDFlag_IsPickable);
/*
So far so good, we've loaded the quake 3 level like in tutorial 2. Now,
@ -87,7 +87,7 @@ int main()
nodes for doing different things with them, for example collision
detection. There are different triangle selectors, and all can be
created with the ISceneManager. In this example, we create an
OctTreeTriangleSelector, which optimizes the triangle output a little
OctreeTriangleSelector, which optimizes the triangle output a little
bit by reducing it like an octree. This is very useful for huge meshes
like quake 3 levels. After we created the triangle selector, we attach
it to the q3node. This is not necessary, but in this way, we do not
@ -101,7 +101,7 @@ int main()
{
q3node->setPosition(core::vector3df(-1350,-130,-1400));
selector = smgr->createOctTreeTriangleSelector(
selector = smgr->createOctreeTriangleSelector(
q3node->getMesh(), q3node, 128);
q3node->setTriangleSelector(selector);
// We're not done with this selector yet, so don't drop it.

View File

@ -229,7 +229,7 @@ void loadModel(const c8* fn)
// set default material properties
if (Octree)
Model = Device->getSceneManager()->addOctTreeSceneNode(m->getMesh(0));
Model = Device->getSceneManager()->addOctreeSceneNode(m->getMesh(0));
else
{
scene::IAnimatedMeshSceneNode* animModel = Device->getSceneManager()->addAnimatedMeshSceneNode(m);

View File

@ -115,8 +115,8 @@ int main(int argc, char** argv)
selector = smgr->createTerrainTriangleSelector((scene::ITerrainSceneNode*)node);
break;
case scene::ESNT_OCT_TREE:
selector = smgr->createOctTreeTriangleSelector(((scene::IMeshSceneNode*)node)->getMesh(), node);
case scene::ESNT_OCTREE:
selector = smgr->createOctreeTriangleSelector(((scene::IMeshSceneNode*)node)->getMesh(), node);
break;
default:

View File

@ -146,7 +146,7 @@ int IRRCALLCONV main(int argc, char* argv[])
case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
case 'f': driverType = video::EDT_NULL; break;
default: return 1;
}
}
// create device and exit if creation failed
const core::dimension2du videoDim ( 800,600 );
@ -200,12 +200,12 @@ int IRRCALLCONV main(int argc, char* argv[])
they are only a huge chunk of static geometry with some materials
attached. Hence the IAnimated mesh consists of only one frame,
so we get the "first frame" of the "animation", which is our quake level
and create an OctTree scene node with it, using addOctTreeSceneNode().
The OctTree optimizes the scene a little bit, trying to draw only geometry
which is currently visible. An alternative to the OctTree would be a
and create an Octree scene node with it, using addOctreeSceneNode().
The Octree optimizes the scene a little bit, trying to draw only geometry
which is currently visible. An alternative to the Octree would be a
AnimatedMeshSceneNode, which would draw always the complete geometry of
the mesh, without optimization. Try it out: Write addAnimatedMeshSceneNode
instead of addOctTreeSceneNode and compare the primitives drawed by the
instead of addOctreeSceneNode and compare the primitives drawed by the
video driver. (There is a getPrimitiveCountDrawed() method in the
IVideoDriver class). Note that this optimization with the Octree is only
useful when drawing huge meshes consisting of lots of geometry.
@ -222,7 +222,7 @@ int IRRCALLCONV main(int argc, char* argv[])
{
scene::IMesh *geometry = mesh->getMesh(quake3::E_Q3_MESH_GEOMETRY);
// node = smgr->addMeshSceneNode ( geometry );
node = smgr->addOctTreeSceneNode(geometry, 0, -1, 1024);
node = smgr->addOctreeSceneNode(geometry, 0, -1, 1024);
}
// create an event receiver for making screenshots
@ -305,7 +305,7 @@ int IRRCALLCONV main(int argc, char* argv[])
we can ask the Quake3 Loader for all entities with class_name
"info_player_deathmatch"
we choose a random launch
*/
if ( mesh )
{
@ -427,7 +427,7 @@ int IRRCALLCONV main(int argc, char* argv[])
In the end, delete the Irrlicht device.
*/
device->drop();
return 0;
}

View File

@ -129,7 +129,7 @@ int main()
IAnimatedMesh *map = smgr->getMesh("20kdm2.bsp");
if (map)
{
ISceneNode *map_node = smgr->addOctTreeSceneNode(map->getMesh(0));
ISceneNode *map_node = smgr->addOctreeSceneNode(map->getMesh(0));
//Set position
map_node->setPosition(vector3df(-850,-220,-850));
}

View File

@ -1073,11 +1073,11 @@ void CQuake3EventHandler::LoadMap ( const stringw &mapName, s32 collision )
s32 minimalNodes = 2048;
MapParent = smgr->addMeshSceneNode( geometry );
//MapParent = smgr->addOctTreeSceneNode(geometry, 0, -1, minimalNodes);
//MapParent = smgr->addOctreeSceneNode(geometry, 0, -1, minimalNodes);
MapParent->setName ( mapName );
if ( Meta )
{
selector = smgr->createOctTreeTriangleSelector( geometry,MapParent, minimalNodes);
selector = smgr->createOctreeTriangleSelector( geometry,MapParent, minimalNodes);
//selector = smgr->createTriangleSelector ( geometry, MapParent );
Meta->addTriangleSelector( selector);
selector->drop ();
@ -1142,7 +1142,7 @@ void CQuake3EventHandler::addSceneTreeItem( ISceneNode * parent, IGUITreeViewNod
case ESNT_CAMERA: imageIndex = 1; break;
case ESNT_EMPTY: imageIndex = 2; break;
case ESNT_MESH: imageIndex = 3; break;
case ESNT_OCT_TREE: imageIndex = 3; break;
case ESNT_OCTREE: imageIndex = 3; break;
case ESNT_ANIMATED_MESH: imageIndex = 4; break;
case ESNT_SKY_BOX: imageIndex = 5; break;
case ESNT_BILLBOARD: imageIndex = 6; break;

View File

@ -1,6 +1,6 @@
/*!
Model Factory.
create the additional scenenodes for ( bullets, health... )
create the additional scenenodes for ( bullets, health... )
Defines the Entities for Quake3
*/
@ -29,8 +29,8 @@ static const SItemElement Quake3ItemElement [] = {
SPECIAL_SFX_BOUNCE | SPECIAL_SFX_ROTATE_1
},
{ "item_health_large",
"models/powerups/health/large_cross.md3",
"models/powerups/health/large_sphere.md3",
"models/powerups/health/large_cross.md3",
"models/powerups/health/large_sphere.md3",
"sound/items/l_health.wav",
"icons/iconh_red",
"50 Health",
@ -41,8 +41,8 @@ static const SItemElement Quake3ItemElement [] = {
},
{
"item_health_mega",
"models/powerups/health/mega_cross.md3",
"models/powerups/health/mega_sphere.md3",
"models/powerups/health/mega_cross.md3",
"models/powerups/health/mega_sphere.md3",
"sound/items/m_health.wav",
"icons/iconh_mega",
"Mega Health",
@ -53,8 +53,8 @@ static const SItemElement Quake3ItemElement [] = {
},
{
"item_health_small",
"models/powerups/health/small_cross.md3",
"models/powerups/health/small_sphere.md3",
"models/powerups/health/small_cross.md3",
"models/powerups/health/small_sphere.md3",
"sound/items/s_health.wav",
"icons/iconh_green",
"5 Health",
@ -64,7 +64,7 @@ static const SItemElement Quake3ItemElement [] = {
SPECIAL_SFX_BOUNCE | SPECIAL_SFX_ROTATE_1
},
{ "ammo_bullets",
"models/powerups/ammo/machinegunam.md3",
"models/powerups/ammo/machinegunam.md3",
"",
"sound/misc/am_pkup.wav",
"icons/icona_machinegun",
@ -99,7 +99,7 @@ static const SItemElement Quake3ItemElement [] = {
},
{
"ammo_shells",
"models/powerups/ammo/shotgunam.md3",
"models/powerups/ammo/shotgunam.md3",
"",
"sound/misc/am_pkup.wav",
"icons/icona_shotgun",
@ -111,7 +111,7 @@ static const SItemElement Quake3ItemElement [] = {
},
{
"ammo_slugs",
"models/powerups/ammo/railgunam.md3",
"models/powerups/ammo/railgunam.md3",
"",
"sound/misc/am_pkup.wav",
"icons/icona_railgun",
@ -122,7 +122,7 @@ static const SItemElement Quake3ItemElement [] = {
SPECIAL_SFX_ROTATE
},
{
"item_armor_body",
"item_armor_body",
"models/powerups/armor/armor_red.md3",
"",
"sound/misc/ar2_pkup.wav",
@ -134,7 +134,7 @@ static const SItemElement Quake3ItemElement [] = {
SPECIAL_SFX_ROTATE
},
{
"item_armor_combat",
"item_armor_combat",
"models/powerups/armor/armor_yel.md3",
"",
"sound/misc/ar2_pkup.wav",
@ -146,7 +146,7 @@ static const SItemElement Quake3ItemElement [] = {
SPECIAL_SFX_ROTATE
},
{
"item_armor_shard",
"item_armor_shard",
"models/powerups/armor/shard.md3",
"",
"sound/misc/ar1_pkup.wav",
@ -158,7 +158,7 @@ static const SItemElement Quake3ItemElement [] = {
SPECIAL_SFX_ROTATE
},
{
"weapon_gauntlet",
"weapon_gauntlet",
"models/weapons2/gauntlet/gauntlet.md3",
"",
"sound/misc/w_pkup.wav",
@ -170,7 +170,7 @@ static const SItemElement Quake3ItemElement [] = {
SPECIAL_SFX_ROTATE
},
{
"weapon_shotgun",
"weapon_shotgun",
"models/weapons2/shotgun/shotgun.md3",
"",
"sound/misc/w_pkup.wav",
@ -182,8 +182,8 @@ static const SItemElement Quake3ItemElement [] = {
SPECIAL_SFX_ROTATE
},
{
"weapon_machinegun",
"models/weapons2/machinegun/machinegun.md3",
"weapon_machinegun",
"models/weapons2/machinegun/machinegun.md3",
"",
"sound/misc/w_pkup.wav",
"icons/iconw_machinegun",
@ -195,7 +195,7 @@ static const SItemElement Quake3ItemElement [] = {
},
{
"weapon_grenadelauncher",
"models/weapons2/grenadel/grenadel.md3",
"models/weapons2/grenadel/grenadel.md3",
"",
"sound/misc/w_pkup.wav",
"icons/iconw_grenade",
@ -207,7 +207,7 @@ static const SItemElement Quake3ItemElement [] = {
},
{
"weapon_rocketlauncher",
"models/weapons2/rocketl/rocketl.md3",
"models/weapons2/rocketl/rocketl.md3",
"",
"sound/misc/w_pkup.wav",
"icons/iconw_rocket",
@ -218,8 +218,8 @@ static const SItemElement Quake3ItemElement [] = {
SPECIAL_SFX_ROTATE
},
{
"weapon_lightning",
"models/weapons2/lightning/lightning.md3",
"weapon_lightning",
"models/weapons2/lightning/lightning.md3",
"",
"sound/misc/w_pkup.wav",
"icons/iconw_lightning",
@ -230,8 +230,8 @@ static const SItemElement Quake3ItemElement [] = {
SPECIAL_SFX_ROTATE
},
{
"weapon_railgun",
"models/weapons2/railgun/railgun.md3",
"weapon_railgun",
"models/weapons2/railgun/railgun.md3",
"",
"sound/misc/w_pkup.wav",
"icons/iconw_railgun",
@ -242,8 +242,8 @@ static const SItemElement Quake3ItemElement [] = {
SPECIAL_SFX_ROTATE
},
{
"weapon_plasmagun",
"models/weapons2/plasma/plasma.md3",
"weapon_plasmagun",
"models/weapons2/plasma/plasma.md3",
"",
"sound/misc/w_pkup.wav",
"icons/iconw_plasma",
@ -255,7 +255,7 @@ static const SItemElement Quake3ItemElement [] = {
},
{
"weapon_bfg",
"models/weapons2/bfg/bfg.md3",
"models/weapons2/bfg/bfg.md3",
"",
"sound/misc/w_pkup.wav",
"icons/iconw_bfg",
@ -267,7 +267,7 @@ static const SItemElement Quake3ItemElement [] = {
},
{
"weapon_grapplinghook",
"models/weapons2/grapple/grapple.md3",
"models/weapons2/grapple/grapple.md3",
"",
"sound/misc/w_pkup.wav",
"icons/iconw_grapple",
@ -304,8 +304,8 @@ const SItemElement * getItemElement ( const stringc& key )
Takes the mesh buffers and creates scenenodes for their associated shaders
*/
void Q3ShaderFactory ( Q3LevelLoadParameter &loadParam,
IrrlichtDevice *device,
IQ3LevelMesh* mesh,
IrrlichtDevice *device,
IQ3LevelMesh* mesh,
eQ3MeshIndex meshIndex,
ISceneNode *parent,
IMetaTriangleSelector *meta,
@ -463,7 +463,7 @@ void Q3ShaderFactory ( Q3LevelLoadParameter &loadParam,
m = node->getMesh();
}
//selector = smgr->createOctTreeTriangleSelector ( m, 0, 128 );
//selector = smgr->createOctreeTriangleSelector ( m, 0, 128 );
selector = smgr->createTriangleSelector ( m, 0 );
meta->addTriangleSelector ( selector );
selector->drop ();
@ -479,7 +479,7 @@ void Q3ShaderFactory ( Q3LevelLoadParameter &loadParam,
#if 0
if ( meta )
{
selector = smgr->createOctTreeTriangleSelector ( additional_mesh, 0 );
selector = smgr->createOctreeTriangleSelector ( additional_mesh, 0 );
meta->addTriangleSelector ( selector );
selector->drop ();
}
@ -488,8 +488,8 @@ void Q3ShaderFactory ( Q3LevelLoadParameter &loadParam,
if ( loadParam.verbose > 0 )
{
loadParam.endTime = device->getTimer()->getRealTime ();
snprintf(buf, 128, "q3shaderfactory needed %04d ms to create %d shader nodes",
loadParam.endTime - loadParam.startTime,
snprintf(buf, 128, "q3shaderfactory needed %04d ms to create %d shader nodes",
loadParam.endTime - loadParam.startTime,
sceneNodeID
);
device->getLogger()->log(buf, ELL_INFORMATION);
@ -502,8 +502,8 @@ void Q3ShaderFactory ( Q3LevelLoadParameter &loadParam,
create Items from Entity
*/
void Q3ModelFactory ( Q3LevelLoadParameter &loadParam,
IrrlichtDevice *device,
IQ3LevelMesh* masterMesh,
IrrlichtDevice *device,
IQ3LevelMesh* masterMesh,
ISceneNode *parent,
bool showShaderName
)
@ -620,7 +620,7 @@ void Q3ModelFactory ( Q3LevelLoadParameter &loadParam,
if ( itemElement->special & SPECIAL_SFX_BOUNCE )
{
//anim = smgr->createFlyStraightAnimator (
//anim = smgr->createFlyStraightAnimator (
// p, p + vector3df ( 0.f, 60.f, 0.f ), 1000, true, true );
anim = smgr->createFlyCircleAnimator (
p + vector3df( 0.f, 20.f, 0.f ),
@ -745,7 +745,7 @@ vector3df getGravity ( const c8 * surface )
if ( 0 == strcmp ( surface, "moon" ) ) return vector3df ( 0.f, -6.f / 100.f, 0.f );
if ( 0 == strcmp ( surface, "water" ) ) return vector3df ( 0.1f / 100.f, -2.f / 100.f, 0.f );
if ( 0 == strcmp ( surface, "ice" ) ) return vector3df ( 0.2f / 100.f, -9.f / 100.f, 0.3f / 100.f );
return vector3df ( 0.f, 0.f, 0.f );
}

View File

@ -369,7 +369,7 @@ void CDemo::loadSceneData()
sm->getMeshManipulator()->transformMesh ( quakeLevelMesh->getMesh(i), m );
}
quakeLevelNode = sm->addOctTreeSceneNode(
quakeLevelNode = sm->addOctreeSceneNode(
quakeLevelMesh->getMesh( scene::quake3::E_Q3_MESH_GEOMETRY)
);
if (quakeLevelNode)
@ -378,7 +378,7 @@ void CDemo::loadSceneData()
quakeLevelNode->setVisible(true);
// create map triangle selector
mapSelector = sm->createOctTreeTriangleSelector(quakeLevelMesh->getMesh(0),
mapSelector = sm->createOctreeTriangleSelector(quakeLevelMesh->getMesh(0),
quakeLevelNode, 128);
// if not using shader and no gamma it's better to use more lighting, because

View File

@ -47,22 +47,22 @@ int main()
IrrlichtDevice *device =
createDevice(driverType, core::dimension2d<s32>(640, 480), 16, false);
if (device == 0)
return 1; // could not create selected driver.
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
device->getFileSystem()->addZipFileArchive("../../media/map-20kdm2.pk3");
scene::IAnimatedMesh* q3levelmesh = smgr->getMesh("20kdm2.bsp");
scene::ISceneNode* q3node = 0;
if (q3levelmesh)
q3node = smgr->addOctTreeSceneNode(q3levelmesh->getMesh(0));
q3node = smgr->addOctreeSceneNode(q3levelmesh->getMesh(0));
/*
So far so good, we've loaded the quake 3 level like in tutorial 2. Now, here
@ -70,7 +70,7 @@ int main()
is a class which can fetch the triangles from scene nodes for doing different
things with them, for example collision detection. There are different triangle
selectors, and all can be created with the ISceneManager. In this example,
we create an OctTreeTriangleSelector, which optimizes the triangle output a l
we create an OctreeTriangleSelector, which optimizes the triangle output a l
little bit by reducing it like an octree. This is very useful for huge meshes
like quake 3 levels.
Afte we created the triangle selector, we attach it to the q3node. This is not
@ -79,12 +79,12 @@ int main()
*/
scene::ITriangleSelector* selector = 0;
if (q3node)
{
{
q3node->setPosition(core::vector3df(-1350,-130,-1400));
selector = smgr->createOctTreeTriangleSelector(
selector = smgr->createOctreeTriangleSelector(
q3levelmesh->getMesh(0), q3node, 128);
q3node->setTriangleSelector(selector);
selector->drop();
@ -122,16 +122,16 @@ int main()
are used to have our eyes on top of the body, with which we collide
with our world, not in the middle of it. So we place the scene node 50
units over the center of the ellipsoid with this parameter. And that's
it, collision detection works now.
it, collision detection works now.
*/
scene::ICameraSceneNode* camera =
scene::ICameraSceneNode* camera =
smgr->addCameraSceneNodeFPS(0, 100.0f, 300.0f, -1, 0, 0, true);
camera->setPosition(core::vector3df(-100,50,-150));
scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(
selector, camera, core::vector3df(30,50,30),
core::vector3df(0,-3,0),
core::vector3df(0,-3,0),
core::vector3df(0,50,0));
camera->addAnimator(anim);
anim->drop();
@ -139,7 +139,7 @@ int main()
/*
Because collision detection is no big deal in irrlicht, I'll describe how to
do two different types of picking in the next section. But before this,
I'll prepare the scene a little. I need three animated characters which we
I'll prepare the scene a little. I need three animated characters which we
could pick later, a dynamic light for lighting them,
a billboard for drawing where we found an intersection, and, yes, I need to
get rid of this mouse cursor. :)
@ -197,7 +197,7 @@ int main()
/*
For not making it to complicated, I'm doing picking inside the drawing loop.
We take two pointers for storing the current and the last selected scene node and
We take two pointers for storing the current and the last selected scene node and
start the loop.
*/
@ -205,7 +205,7 @@ int main()
scene::ISceneNode* selectedSceneNode = 0;
scene::ISceneNode* lastSelectedSceneNode = 0;
int lastFPS = -1;
while(device->run())
@ -239,7 +239,7 @@ int main()
line, selector, intersection, tri))
{
bill->setPosition(intersection);
driver->setTransform(video::ETS_WORLD, core::matrix4());
driver->setMaterial(material);
driver->draw3DTriangle(tri, video::SColor(0,255,0,0));
@ -251,7 +251,7 @@ int main()
based on bouding boxes. Every scene node has got a bounding box, and because of
that, it's very fast for example to get the scene node which the camera looks
at. Again, we ask the collision manager for this, and if we've got a scene node,
we highlight it by disabling Lighting in its material, if it is not the
we highlight it by disabling Lighting in its material, if it is not the
billboard or the quake 3 level.
*/
@ -292,7 +292,7 @@ int main()
}
device->drop();
return 0;
}

View File

@ -42,8 +42,8 @@ namespace scene
//! Shadow Volume Scene Node
ESNT_SHADOW_VOLUME = MAKE_IRR_ID('s','h','d','w'),
//! OctTree Scene Node
ESNT_OCT_TREE = MAKE_IRR_ID('o','c','t','t'),
//! Octree Scene Node
ESNT_OCTREE = MAKE_IRR_ID('o','c','t','r'),
//! Mesh Scene Node
ESNT_MESH = MAKE_IRR_ID('m','e','s','h'),

View File

@ -30,7 +30,7 @@ namespace scene
\param selector: TriangleSelector containing the triangles. It
can be created for example using
ISceneManager::createTriangleSelector() or
ISceneManager::createTriangleOctTreeSelector().
ISceneManager::createTriangleOctreeSelector().
\param outCollisionPoint: If a collision is detected, this will
contain the position of the nearest collision to the line-start.
\param outTriangle: If a collision is detected, this will
@ -51,7 +51,7 @@ namespace scene
\param selector: TriangleSelector containing the triangles of
the world. It can be created for example using
ISceneManager::createTriangleSelector() or
ISceneManager::createTriangleOctTreeSelector().
ISceneManager::createTriangleOctreeSelector().
\param ellipsoidPosition: Position of the ellipsoid.
\param ellipsoidRadius: Radius of the ellipsoid.
\param ellipsoidDirectionAndSpeed: Direction and speed of the

View File

@ -132,7 +132,7 @@ namespace scene
//! The Scene Manager manages scene nodes, mesh recources, cameras and all the other stuff.
/** All Scene nodes can be created only here. There is a always growing
list of scene nodes for lots of purposes: Indoor rendering scene nodes
like the Octree (addOctTreeSceneNode()) or the terrain renderer
like the Octree (addOctreeSceneNode()) or the terrain renderer
(addTerrainSceneNode()), different Camera scene nodes
(addCameraSceneNode(), addCameraSceneNodeMaya()), scene nodes for Light
(addLightSceneNode()), Billboards (addBillboardSceneNode()) and so on.
@ -493,36 +493,36 @@ namespace scene
const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0;
//! Adds a scene node for rendering using a octtree to the scene graph.
//! Adds a scene node for rendering using a octree to the scene graph.
/** This a good method for rendering
scenes with lots of geometry. The Octree is built on the fly from the mesh.
\param mesh: The mesh containing all geometry from which the octtree will be build.
\param mesh: The mesh containing all geometry from which the octree will be build.
If this animated mesh has more than one frames in it, the first frame is taken.
\param parent: Parent node of the octtree node.
\param parent: Parent node of the octree node.
\param id: id of the node. This id can be used to identify the node.
\param minimalPolysPerNode: Specifies the minimal polygons contained a octree node.
If a node gets less polys than this value it will not be split into
smaller nodes.
\param alsoAddIfMeshPointerZero: Add the scene node even if a 0 pointer is passed.
\return Pointer to the OctTree if successful, otherwise 0.
\return Pointer to the Octree if successful, otherwise 0.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual IMeshSceneNode* addOctTreeSceneNode(IAnimatedMesh* mesh, ISceneNode* parent=0,
virtual IMeshSceneNode* addOctreeSceneNode(IAnimatedMesh* mesh, ISceneNode* parent=0,
s32 id=-1, s32 minimalPolysPerNode=512, bool alsoAddIfMeshPointerZero=false) = 0;
//! Adds a scene node for rendering using a octtree to the scene graph.
//! Adds a scene node for rendering using a octree to the scene graph.
/** This a good method for rendering scenes with lots of
geometry. The Octree is built on the fly from the mesh, much
faster then a bsp tree.
\param mesh: The mesh containing all geometry from which the octtree will be build.
\param parent: Parent node of the octtree node.
\param mesh: The mesh containing all geometry from which the octree will be build.
\param parent: Parent node of the octree node.
\param id: id of the node. This id can be used to identify the node.
\param minimalPolysPerNode: Specifies the minimal polygons contained a octree node.
If a node gets less polys than this value it will not be split into
smaller nodes.
\param alsoAddIfMeshPointerZero: Add the scene node even if a 0 pointer is passed.
\return Pointer to the octtree if successful, otherwise 0.
\return Pointer to the octree if successful, otherwise 0.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual IMeshSceneNode* addOctTreeSceneNode(IMesh* mesh, ISceneNode* parent=0,
virtual IMeshSceneNode* addOctreeSceneNode(IMesh* mesh, ISceneNode* parent=0,
s32 id=-1, s32 minimalPolysPerNode=256, bool alsoAddIfMeshPointerZero=false) = 0;
//! Adds a camera scene node to the scene graph and sets it as active camera.
@ -1194,7 +1194,7 @@ namespace scene
/** Triangle selectors
can be used for doing collision detection. Don't use this selector
for a huge amount of triangles like in Quake3 maps.
Instead, use for example ISceneManager::createOctTreeTriangleSelector().
Instead, use for example ISceneManager::createOctreeTriangleSelector().
Please note that the created triangle selector is not automaticly attached
to the scene node. You will have to call ISceneNode::setTriangleSelector()
for this. To create and attach a triangle selector is done like this:
@ -1231,15 +1231,15 @@ namespace scene
See IReferenceCounted::drop() for more information. */
virtual ITriangleSelector* createTriangleSelectorFromBoundingBox(ISceneNode* node) = 0;
//! Creates a Triangle Selector, optimized by an octtree.
//! Creates a Triangle Selector, optimized by an octree.
/** Triangle selectors
can be used for doing collision detection. This triangle selector is
optimized for huge amounts of triangle, it organizes them in an octtree.
optimized for huge amounts of triangle, it organizes them in an octree.
Please note that the created triangle selector is not automaticly attached
to the scene node. You will have to call ISceneNode::setTriangleSelector()
for this. To create and attach a triangle selector is done like this:
\code
ITriangleSelector* s = sceneManager->createOctTreeTriangleSelector(yourMesh,
ITriangleSelector* s = sceneManager->createOctreeTriangleSelector(yourMesh,
yourSceneNode);
yourSceneNode->setTriangleSelector(s);
s->drop();
@ -1254,7 +1254,7 @@ namespace scene
\return The selector, or null if not successful.
If you no longer need the selector, you should call ITriangleSelector::drop().
See IReferenceCounted::drop() for more information. */
virtual ITriangleSelector* createOctTreeTriangleSelector(IMesh* mesh,
virtual ITriangleSelector* createOctreeTriangleSelector(IMesh* mesh,
ISceneNode* node, s32 minimalPolysPerNode=32) = 0;
//! Creates a meta triangle selector.

View File

@ -120,7 +120,7 @@ namespace scene
ISceneNodeAnimator* anim = *ait;
++ait;
anim->animateNode(this, timeMs);
}
}
// update absolute position
updateAbsolutePosition();
@ -448,8 +448,8 @@ namespace scene
//! Gets the scale of the scene node relative to its parent.
/** This is the scale of this node relative to its parent.
If you want the absolute scale, use
/** This is the scale of this node relative to its parent.
If you want the absolute scale, use
getAbsoluteTransformation().getScale()
\return The scale of the scene node. */
virtual const core::vector3df& getScale() const
@ -537,7 +537,7 @@ namespace scene
//! Sets if debug data like bounding boxes should be drawn.
/** A bitwise OR of the types from @ref irr::scene::E_DEBUG_SCENE_TYPE.
/** A bitwise OR of the types from @ref irr::scene::E_DEBUG_SCENE_TYPE.
Please note that not all scene nodes support all debug data types.
\param state The debug data visibility state to be used. */
virtual void setDebugDataVisible(s32 state)
@ -546,7 +546,7 @@ namespace scene
}
//! Returns if debug data like bounding boxes are drawn.
/** \return A bitwise OR of the debug data values from
/** \return A bitwise OR of the debug data values from
@ref irr::scene::E_DEBUG_SCENE_TYPE that are currently visible. */
s32 isDebugDataVisible() const
{
@ -602,7 +602,7 @@ namespace scene
/** The Selector can be used by the engine for doing collision
detection. You can create a TriangleSelector with
ISceneManager::createTriangleSelector() or
ISceneManager::createOctTreeTriangleSelector and set it with
ISceneManager::createOctreeTriangleSelector and set it with
ISceneNode::setTriangleSelector(). If a scene node got no triangle
selector, but collision tests should be done with it, a triangle
selector is created using the bounding box of the scene node.
@ -618,7 +618,7 @@ namespace scene
/** The Selector can be used by the engine for doing collision
detection. You can create a TriangleSelector with
ISceneManager::createTriangleSelector() or
ISceneManager::createOctTreeTriangleSelector(). Some nodes may
ISceneManager::createOctreeTriangleSelector(). Some nodes may
create their own selector by default, so it would be good to
check if there is already a selector in this node by calling
ISceneNode::getTriangleSelector().
@ -638,7 +638,7 @@ namespace scene
//! Updates the absolute position based on the relative and the parents position
/** Note: This does not recursively update the parents absolute positions, so if you have a deeper
/** Note: This does not recursively update the parents absolute positions, so if you have a deeper
hierarchy you might want to update the parents first.*/
virtual void updateAbsolutePosition()
{

View File

@ -263,15 +263,15 @@
*
* Irrlicht can load a lot of file formats automaticly, see irr::scene::ISceneManager::getMesh()
* for a detailed list. So if you would like to replace the simple blue screen background by
* a cool Quake 3 Map, optimized by an octtree, just insert this code
* a cool Quake 3 Map, optimized by an octree, just insert this code
* somewhere before the while loop:
*
* \code
* // add .pk3 archive to the file system
* device->getFileSystem()->addZipFileArchive("quake3map.pk3");
*
* // load .bsp file and show it using an octtree
* scenemgr->addOctTreeSceneNode(
* // load .bsp file and show it using an octree
* scenemgr->addOctreeSceneNode(
* scenemgr->getMesh("quake3map.bsp"));
* \endcode
*

View File

@ -30,7 +30,7 @@
// The IrrCSM library features the following capabilities
//
// * Loads the .csm 4.0 and 4.1 files transparently
// * Presents the loaded file as irr::scene::IAnimatedMesh for easy creation of IOctTreeSceneNode
// * Presents the loaded file as irr::scene::IAnimatedMesh for easy creation of IOctreeSceneNode
// * Loads the textures given the correct texture root. hence map and textures can be in separate directories
//
// For more informations go to http://www.geocities.com/standard_template/irrcsm/downloads.html

View File

@ -38,7 +38,7 @@ CDefaultSceneNodeFactory::CDefaultSceneNodeFactory(ISceneManager* mgr)
SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_SKY_BOX, "skyBox"));
SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_SKY_DOME, "skyDome"));
SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_SHADOW_VOLUME, "shadowVolume"));
SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_OCT_TREE, "octTree"));
SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_OCTREE, "octree"));
SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_MESH, "mesh"));
SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_LIGHT, "light"));
SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_EMPTY, "empty"));
@ -82,8 +82,8 @@ ISceneNode* CDefaultSceneNodeFactory::addSceneNode(ESCENE_NODE_TYPE type, IScene
return Manager->addSkyDomeSceneNode(0, 16, 8, 0.9f, 2.0f, 1000.0f, parent);
case ESNT_SHADOW_VOLUME:
return 0;
case ESNT_OCT_TREE:
return Manager->addOctTreeSceneNode((IMesh*)0, parent, -1, 128, true);
case ESNT_OCTREE:
return Manager->addOctreeSceneNode((IMesh*)0, parent, -1, 128, true);
case ESNT_MESH:
return Manager->addMeshSceneNode(0, parent, -1, core::vector3df(),
core::vector3df(), core::vector3df(1,1,1), true);

View File

@ -2,8 +2,8 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#include "COctTreeSceneNode.h"
#include "OctTree.h"
#include "COctreeSceneNode.h"
#include "Octree.h"
#include "ISceneManager.h"
#include "IVideoDriver.h"
#include "ICameraSceneNode.h"
@ -20,13 +20,13 @@ namespace scene
//! constructor
COctTreeSceneNode::COctTreeSceneNode(ISceneNode* parent, ISceneManager* mgr,
COctreeSceneNode::COctreeSceneNode(ISceneNode* parent, ISceneManager* mgr,
s32 id, s32 minimalPolysPerNode)
: IMeshSceneNode(parent, mgr, id), StdOctTree(0), LightMapOctTree(0), TangentsOctTree(0),
: IMeshSceneNode(parent, mgr, id), StdOctree(0), LightMapOctree(0), TangentsOctree(0),
MinimalPolysPerNode(minimalPolysPerNode), Mesh(0)
{
#ifdef _DEBUG
setDebugName("COctTreeSceneNode");
setDebugName("COctreeSceneNode");
#endif
vertexType = (video::E_VERTEX_TYPE)-1;
@ -34,13 +34,13 @@ COctTreeSceneNode::COctTreeSceneNode(ISceneNode* parent, ISceneManager* mgr,
//! destructor
COctTreeSceneNode::~COctTreeSceneNode()
COctreeSceneNode::~COctreeSceneNode()
{
deleteTree();
}
void COctTreeSceneNode::OnRegisterSceneNode()
void COctreeSceneNode::OnRegisterSceneNode()
{
if (IsVisible)
{
@ -84,7 +84,7 @@ void COctTreeSceneNode::OnRegisterSceneNode()
//! renders the node.
void COctTreeSceneNode::render()
void COctreeSceneNode::render()
{
video::IVideoDriver* driver = SceneManager->getVideoDriver();
@ -110,7 +110,7 @@ void COctTreeSceneNode::render()
frust.transform(invTrans);
}
#if defined ( OCTTREE_BOX_BASED )
#if defined ( OCTREE_BOX_BASED )
const core::aabbox3d<float> &box = frust.getBoundingBox();
#endif
@ -118,13 +118,13 @@ void COctTreeSceneNode::render()
{
case video::EVT_STANDARD:
{
#if defined ( OCTTREE_BOX_BASED )
StdOctTree->calculatePolys(box);
#if defined ( OCTREE_BOX_BASED )
StdOctree->calculatePolys(box);
#else
StdOctTree->calculatePolys(frust);
StdOctree->calculatePolys(frust);
#endif
const OctTree<video::S3DVertex>::SIndexData* d = StdOctTree->getIndexData();
const Octree<video::S3DVertex>::SIndexData* d = StdOctree->getIndexData();
for (u32 i=0; i<Materials.size(); ++i)
{
@ -155,7 +155,7 @@ void COctTreeSceneNode::render()
driver->setMaterial(m);
if ( DebugDataVisible & scene::EDS_BBOX_BUFFERS )
{
StdOctTree->getBoundingBoxes(box, boxes);
StdOctree->getBoundingBoxes(box, boxes);
for (u32 b=0; b!=boxes.size(); ++b)
driver->draw3DBox(*boxes[b]);
}
@ -167,12 +167,12 @@ void COctTreeSceneNode::render()
break;
case video::EVT_2TCOORDS:
{
#if defined ( OCTTREE_BOX_BASED )
LightMapOctTree->calculatePolys(box);
#if defined ( OCTREE_BOX_BASED )
LightMapOctree->calculatePolys(box);
#else
LightMapOctTree->calculatePolys(frust);
LightMapOctree->calculatePolys(frust);
#endif
const OctTree<video::S3DVertex2TCoords>::SIndexData* d = LightMapOctTree->getIndexData();
const Octree<video::S3DVertex2TCoords>::SIndexData* d = LightMapOctree->getIndexData();
for (u32 i=0; i<Materials.size(); ++i)
{
@ -187,7 +187,7 @@ void COctTreeSceneNode::render()
if (transparent == isTransparentPass)
{
driver->setMaterial(Materials[i]);
#if defined (OCTTREE_USE_HARDWARE)
#if defined (OCTREE_USE_HARDWARE)
driver->drawMeshBuffer ( &LightMapMeshes[i] );
#else
@ -208,7 +208,7 @@ void COctTreeSceneNode::render()
driver->setMaterial(m);
if ( DebugDataVisible & scene::EDS_BBOX_BUFFERS )
{
LightMapOctTree->getBoundingBoxes(box, boxes);
LightMapOctree->getBoundingBoxes(box, boxes);
for (u32 b=0; b<boxes.size(); ++b)
driver->draw3DBox(*boxes[b]);
}
@ -220,13 +220,13 @@ void COctTreeSceneNode::render()
break;
case video::EVT_TANGENTS:
{
#if defined ( OCTTREE_BOX_BASED )
TangentsOctTree->calculatePolys(box);
#if defined ( OCTREE_BOX_BASED )
TangentsOctree->calculatePolys(box);
#else
TangentsOctTree->calculatePolys(frust);
TangentsOctree->calculatePolys(frust);
#endif
const OctTree<video::S3DVertexTangents>::SIndexData* d = TangentsOctTree->getIndexData();
const Octree<video::S3DVertexTangents>::SIndexData* d = TangentsOctree->getIndexData();
for (u32 i=0; i<Materials.size(); ++i)
{
@ -257,7 +257,7 @@ void COctTreeSceneNode::render()
driver->setMaterial(m);
if ( DebugDataVisible & scene::EDS_BBOX_BUFFERS )
{
TangentsOctTree->getBoundingBoxes(box, boxes);
TangentsOctree->getBoundingBoxes(box, boxes);
for (u32 b=0; b<boxes.size(); ++b)
driver->draw3DBox(*boxes[b]);
}
@ -272,14 +272,14 @@ void COctTreeSceneNode::render()
//! returns the axis aligned bounding box of this node
const core::aabbox3d<f32>& COctTreeSceneNode::getBoundingBox() const
const core::aabbox3d<f32>& COctreeSceneNode::getBoundingBox() const
{
return Box;
}
//! creates the tree
bool COctTreeSceneNode::createTree(IMesh* mesh)
bool COctreeSceneNode::createTree(IMesh* mesh)
{
if (!mesh)
return false;
@ -315,8 +315,8 @@ bool COctTreeSceneNode::createTree(IMesh* mesh)
{
Materials.push_back(b->getMaterial());
StdMeshes.push_back(OctTree<video::S3DVertex>::SMeshChunk());
OctTree<video::S3DVertex>::SMeshChunk &nchunk = StdMeshes.getLast();
StdMeshes.push_back(Octree<video::S3DVertex>::SMeshChunk());
Octree<video::S3DVertex>::SMeshChunk &nchunk = StdMeshes.getLast();
nchunk.MaterialId = Materials.size() - 1;
u32 v;
@ -332,8 +332,8 @@ bool COctTreeSceneNode::createTree(IMesh* mesh)
}
}
StdOctTree = new OctTree<video::S3DVertex>(StdMeshes, MinimalPolysPerNode);
nodeCount = StdOctTree->getNodeCount();
StdOctree = new Octree<video::S3DVertex>(StdMeshes, MinimalPolysPerNode);
nodeCount = StdOctree->getNodeCount();
}
break;
case video::EVT_2TCOORDS:
@ -358,11 +358,11 @@ bool COctTreeSceneNode::createTree(IMesh* mesh)
if (b->getVertexCount() && b->getIndexCount())
{
Materials.push_back(b->getMaterial());
LightMapMeshes.push_back(OctTree<video::S3DVertex2TCoords>::SMeshChunk());
OctTree<video::S3DVertex2TCoords>::SMeshChunk& nchunk = LightMapMeshes.getLast();
LightMapMeshes.push_back(Octree<video::S3DVertex2TCoords>::SMeshChunk());
Octree<video::S3DVertex2TCoords>::SMeshChunk& nchunk = LightMapMeshes.getLast();
nchunk.MaterialId = Materials.size() - 1;
#if defined (OCTTREE_USE_HARDWARE)
#if defined (OCTREE_USE_HARDWARE)
nchunk.setHardwareMappingHint ( b->getHardwareMappingHint_Vertex() );
#endif
@ -378,8 +378,8 @@ bool COctTreeSceneNode::createTree(IMesh* mesh)
}
}
LightMapOctTree = new OctTree<video::S3DVertex2TCoords>(LightMapMeshes, MinimalPolysPerNode);
nodeCount = LightMapOctTree->getNodeCount();
LightMapOctree = new Octree<video::S3DVertex2TCoords>(LightMapMeshes, MinimalPolysPerNode);
nodeCount = LightMapOctree->getNodeCount();
}
break;
case video::EVT_TANGENTS:
@ -391,8 +391,8 @@ bool COctTreeSceneNode::createTree(IMesh* mesh)
if (b->getVertexCount() && b->getIndexCount())
{
Materials.push_back(b->getMaterial());
TangentsMeshes.push_back(OctTree<video::S3DVertexTangents>::SMeshChunk());
OctTree<video::S3DVertexTangents>::SMeshChunk& nchunk = TangentsMeshes.getLast();
TangentsMeshes.push_back(Octree<video::S3DVertexTangents>::SMeshChunk());
Octree<video::S3DVertexTangents>::SMeshChunk& nchunk = TangentsMeshes.getLast();
nchunk.MaterialId = Materials.size() - 1;
u32 v;
@ -407,8 +407,8 @@ bool COctTreeSceneNode::createTree(IMesh* mesh)
}
}
TangentsOctTree = new OctTree<video::S3DVertexTangents>(TangentsMeshes, MinimalPolysPerNode);
nodeCount = TangentsOctTree->getNodeCount();
TangentsOctree = new Octree<video::S3DVertexTangents>(TangentsMeshes, MinimalPolysPerNode);
nodeCount = TangentsOctree->getNodeCount();
}
break;
}
@ -416,7 +416,7 @@ bool COctTreeSceneNode::createTree(IMesh* mesh)
u32 endTime = os::Timer::getRealTime();
c8 tmp[255];
sprintf(tmp, "Needed %ums to create OctTree SceneNode.(%u nodes, %u polys)",
sprintf(tmp, "Needed %ums to create Octree SceneNode.(%u nodes, %u polys)",
endTime - beginTime, nodeCount, polyCount/3);
os::Printer::log(tmp, ELL_INFORMATION);
@ -429,7 +429,7 @@ bool COctTreeSceneNode::createTree(IMesh* mesh)
//! This function is needed for inserting the node into the scene hirachy on a
//! optimal position for minimizing renderstate changes, but can also be used
//! to directly modify the material of a scene node.
video::SMaterial& COctTreeSceneNode::getMaterial(u32 i)
video::SMaterial& COctreeSceneNode::getMaterial(u32 i)
{
if ( i >= Materials.size() )
return ISceneNode::getMaterial(i);
@ -439,14 +439,14 @@ video::SMaterial& COctTreeSceneNode::getMaterial(u32 i)
//! returns amount of materials used by this scene node.
u32 COctTreeSceneNode::getMaterialCount() const
u32 COctreeSceneNode::getMaterialCount() const
{
return Materials.size();
}
//! Writes attributes of the scene node.
void COctTreeSceneNode::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
void COctreeSceneNode::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
{
ISceneNode::serializeAttributes(out, options);
@ -456,7 +456,7 @@ void COctTreeSceneNode::serializeAttributes(io::IAttributes* out, io::SAttribute
//! Reads attributes of the scene node.
void COctTreeSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
void COctreeSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
const s32 oldMinimal = MinimalPolysPerNode;
@ -483,18 +483,18 @@ void COctTreeSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttribut
}
void COctTreeSceneNode::deleteTree()
void COctreeSceneNode::deleteTree()
{
delete StdOctTree;
StdOctTree = 0;
delete StdOctree;
StdOctree = 0;
StdMeshes.clear();
delete LightMapOctTree;
LightMapOctTree = 0;
delete LightMapOctree;
LightMapOctree = 0;
LightMapMeshes.clear();
delete TangentsOctTree;
TangentsOctTree = 0;
delete TangentsOctree;
TangentsOctree = 0;
TangentsMeshes.clear();
Materials.clear();
@ -503,22 +503,22 @@ void COctTreeSceneNode::deleteTree()
Mesh->drop();
}
void COctTreeSceneNode::setMesh(IMesh* mesh)
void COctreeSceneNode::setMesh(IMesh* mesh)
{
createTree(mesh);
}
IMesh* COctTreeSceneNode::getMesh(void)
IMesh* COctreeSceneNode::getMesh(void)
{
return Mesh;
}
void COctTreeSceneNode::setReadOnlyMaterials(bool readonly)
void COctreeSceneNode::setReadOnlyMaterials(bool readonly)
{
// Do nothing
}
bool COctTreeSceneNode::isReadOnlyMaterials() const
bool COctreeSceneNode::isReadOnlyMaterials() const
{
return false;
}

View File

@ -2,27 +2,27 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_OCT_TREE_SCENE_NODE_H_INCLUDED__
#define __C_OCT_TREE_SCENE_NODE_H_INCLUDED__
#ifndef __C_OCTREE_SCENE_NODE_H_INCLUDED__
#define __C_OCTREE_SCENE_NODE_H_INCLUDED__
#include "IMeshSceneNode.h"
#include "OctTree.h"
#include "Octree.h"
namespace irr
{
namespace scene
{
//! implementation of the IBspTreeSceneNode
class COctTreeSceneNode : public IMeshSceneNode
class COctreeSceneNode : public IMeshSceneNode
{
public:
//! constructor
COctTreeSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
COctreeSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
s32 minimalPolysPerNode=512);
//! destructor
virtual ~COctTreeSceneNode();
virtual ~COctreeSceneNode();
virtual void OnRegisterSceneNode();
@ -41,7 +41,7 @@ namespace scene
//! optimal position for minimizing renderstate changes, but can also be used
//! to directly modify the material of a scene node.
virtual video::SMaterial& getMaterial(u32 i);
//! returns amount of materials used by this scene node.
virtual u32 getMaterialCount() const;
@ -52,7 +52,7 @@ namespace scene
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0);
//! Returns type of the scene node
virtual ESCENE_NODE_TYPE getType() const { return ESNT_OCT_TREE; }
virtual ESCENE_NODE_TYPE getType() const { return ESNT_OCTREE; }
//! Sets a new mesh to display
virtual void setMesh(IMesh* mesh);
@ -72,14 +72,14 @@ namespace scene
core::aabbox3d<f32> Box;
OctTree<video::S3DVertex>* StdOctTree;
core::array< OctTree<video::S3DVertex>::SMeshChunk > StdMeshes;
Octree<video::S3DVertex>* StdOctree;
core::array< Octree<video::S3DVertex>::SMeshChunk > StdMeshes;
OctTree<video::S3DVertex2TCoords>* LightMapOctTree;
core::array< OctTree<video::S3DVertex2TCoords>::SMeshChunk > LightMapMeshes;
Octree<video::S3DVertex2TCoords>* LightMapOctree;
core::array< Octree<video::S3DVertex2TCoords>::SMeshChunk > LightMapMeshes;
OctTree<video::S3DVertexTangents>* TangentsOctTree;
core::array< OctTree<video::S3DVertexTangents>::SMeshChunk > TangentsMeshes;
Octree<video::S3DVertexTangents>* TangentsOctree;
core::array< Octree<video::S3DVertexTangents>::SMeshChunk > TangentsMeshes;
video::E_VERTEX_TYPE vertexType;
core::array< video::SMaterial > Materials;

View File

@ -2,7 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#include "COctTreeTriangleSelector.h"
#include "COctreeTriangleSelector.h"
#include "ISceneNode.h"
#include "os.h"
@ -13,26 +13,26 @@ namespace scene
{
//! constructor
COctTreeTriangleSelector::COctTreeTriangleSelector(const IMesh* mesh,
COctreeTriangleSelector::COctreeTriangleSelector(const IMesh* mesh,
const ISceneNode* node, s32 minimalPolysPerNode)
: CTriangleSelector(mesh, node), Root(0), NodeCount(0),
MinimalPolysPerNode(minimalPolysPerNode)
{
#ifdef _DEBUG
setDebugName("COctTreeTriangleSelector");
setDebugName("COctreeTriangleSelector");
#endif
if (!Triangles.empty())
{
const u32 start = os::Timer::getRealTime();
// create the triangle octtree
Root = new SOctTreeNode();
// create the triangle octree
Root = new SOctreeNode();
Root->Triangles = Triangles;
constructOctTree(Root);
constructOctree(Root);
c8 tmp[256];
sprintf(tmp, "Needed %ums to create OctTreeTriangleSelector.(%d nodes, %u polys)",
sprintf(tmp, "Needed %ums to create OctreeTriangleSelector.(%d nodes, %u polys)",
os::Timer::getRealTime() - start, NodeCount, Triangles.size());
os::Printer::log(tmp, ELL_INFORMATION);
}
@ -40,13 +40,13 @@ COctTreeTriangleSelector::COctTreeTriangleSelector(const IMesh* mesh,
//! destructor
COctTreeTriangleSelector::~COctTreeTriangleSelector()
COctreeTriangleSelector::~COctreeTriangleSelector()
{
delete Root;
}
void COctTreeTriangleSelector::constructOctTree(SOctTreeNode* node)
void COctreeTriangleSelector::constructOctree(SOctreeNode* node)
{
++NodeCount;
@ -75,7 +75,7 @@ void COctTreeTriangleSelector::constructOctTree(SOctTreeNode* node)
{
box.reset(middle);
box.addInternalPoint(edges[ch]);
node->Child[ch] = new SOctTreeNode();
node->Child[ch] = new SOctreeNode();
for (s32 i=0; i<(s32)node->Triangles.size(); ++i)
{
@ -102,13 +102,13 @@ void COctTreeTriangleSelector::constructOctTree(SOctTreeNode* node)
node->Child[ch] = 0;
}
else
constructOctTree(node->Child[ch]);
constructOctree(node->Child[ch]);
}
}
//! Gets all triangles which lie within a specific bounding box.
void COctTreeTriangleSelector::getTriangles(core::triangle3df* triangles,
void COctreeTriangleSelector::getTriangles(core::triangle3df* triangles,
s32 arraySize, s32& outTriangleCount,
const core::aabbox3d<f32>& box,
const core::matrix4* transform) const
@ -138,15 +138,15 @@ void COctTreeTriangleSelector::getTriangles(core::triangle3df* triangles,
s32 trianglesWritten = 0;
if (Root)
getTrianglesFromOctTree(Root, trianglesWritten,
getTrianglesFromOctree(Root, trianglesWritten,
arraySize, invbox, &mat, triangles);
outTriangleCount = trianglesWritten;
}
void COctTreeTriangleSelector::getTrianglesFromOctTree(
SOctTreeNode* node, s32& trianglesWritten,
void COctreeTriangleSelector::getTrianglesFromOctree(
SOctreeNode* node, s32& trianglesWritten,
s32 maximumSize, const core::aabbox3d<f32>& box,
const core::matrix4* mat, core::triangle3df* triangles) const
{
@ -158,7 +158,7 @@ void COctTreeTriangleSelector::getTrianglesFromOctTree(
cnt -= cnt + trianglesWritten - maximumSize;
s32 i;
for (i=0; i<cnt; ++i)
{
mat->transformVect(triangles[trianglesWritten].pointA, node->Triangles[i].pointA );
@ -169,14 +169,14 @@ void COctTreeTriangleSelector::getTrianglesFromOctTree(
for (i=0; i<8; ++i)
if (node->Child[i])
getTrianglesFromOctTree(node->Child[i], trianglesWritten,
getTrianglesFromOctree(node->Child[i], trianglesWritten,
maximumSize, box, mat, triangles);
}
//! Gets all triangles which have or may have contact with a 3d line.
// new version: from user Piraaate
void COctTreeTriangleSelector::getTriangles(core::triangle3df* triangles, s32 arraySize,
void COctreeTriangleSelector::getTriangles(core::triangle3df* triangles, s32 arraySize,
s32& outTriangleCount, const core::line3d<f32>& line,
const core::matrix4* transform) const
{
@ -185,7 +185,7 @@ void COctTreeTriangleSelector::getTriangles(core::triangle3df* triangles, s32 ar
box.addInternalPoint(line.end);
// TODO: Could be optimized for line a little bit more.
COctTreeTriangleSelector::getTriangles(triangles, arraySize, outTriangleCount,
COctreeTriangleSelector::getTriangles(triangles, arraySize, outTriangleCount,
box, transform);
#else
@ -212,13 +212,13 @@ void COctTreeTriangleSelector::getTriangles(core::triangle3df* triangles, s32 ar
s32 trianglesWritten = 0;
if (Root)
getTrianglesFromOctTree(Root, trianglesWritten, arraySize, invline, &mat, triangles);
getTrianglesFromOctree(Root, trianglesWritten, arraySize, invline, &mat, triangles);
outTriangleCount = trianglesWritten;
#endif
}
void COctTreeTriangleSelector::getTrianglesFromOctTree(SOctTreeNode* node,
void COctreeTriangleSelector::getTrianglesFromOctree(SOctreeNode* node,
s32& trianglesWritten, s32 maximumSize, const core::line3d<f32>& line,
const core::matrix4* transform, core::triangle3df* triangles) const
{
@ -253,7 +253,7 @@ void COctTreeTriangleSelector::getTrianglesFromOctTree(SOctTreeNode* node,
for (i=0; i<8; ++i)
if (node->Child[i])
getTrianglesFromOctTree(node->Child[i], trianglesWritten,
getTrianglesFromOctree(node->Child[i], trianglesWritten,
maximumSize, line, transform, triangles);
}

View File

@ -2,8 +2,8 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_OCT_TREE_TRIANGLE_SELECTOR_H_INCLUDED__
#define __C_OCT_TREE_TRIANGLE_SELECTOR_H_INCLUDED__
#ifndef __C_OCTREE_TRIANGLE_SELECTOR_H_INCLUDED__
#define __C_OCTREE_TRIANGLE_SELECTOR_H_INCLUDED__
#include "CTriangleSelector.h"
@ -15,59 +15,59 @@ namespace scene
class ISceneNode;
//! Stupid triangle selector without optimization
class COctTreeTriangleSelector : public CTriangleSelector
class COctreeTriangleSelector : public CTriangleSelector
{
public:
//! Constructs a selector based on a mesh
COctTreeTriangleSelector(const IMesh* mesh, const ISceneNode* node, s32 minimalPolysPerNode);
COctreeTriangleSelector(const IMesh* mesh, const ISceneNode* node, s32 minimalPolysPerNode);
virtual ~COctTreeTriangleSelector();
virtual ~COctreeTriangleSelector();
//! Gets all triangles which lie within a specific bounding box.
virtual void getTriangles(core::triangle3df* triangles, s32 arraySize, s32& outTriangleCount,
virtual void getTriangles(core::triangle3df* triangles, s32 arraySize, s32& outTriangleCount,
const core::aabbox3d<f32>& box, const core::matrix4* transform=0) const;
//! Gets all triangles which have or may have contact with a 3d line.
virtual void getTriangles(core::triangle3df* triangles, s32 arraySize,
s32& outTriangleCount, const core::line3d<f32>& line,
s32& outTriangleCount, const core::line3d<f32>& line,
const core::matrix4* transform=0) const;
private:
struct SOctTreeNode
struct SOctreeNode
{
SOctTreeNode()
SOctreeNode()
{
for (u32 i=0; i!=8; ++i)
Child[i] = 0;
}
~SOctTreeNode()
~SOctreeNode()
{
for (u32 i=0; i!=8; ++i)
delete Child[i];
}
core::array<core::triangle3df> Triangles;
SOctTreeNode* Child[8];
SOctreeNode* Child[8];
core::aabbox3d<f32> Box;
};
void constructOctTree(SOctTreeNode* node);
void deleteEmptyNodes(SOctTreeNode* node);
void getTrianglesFromOctTree(SOctTreeNode* node, s32& trianglesWritten,
void constructOctree(SOctreeNode* node);
void deleteEmptyNodes(SOctreeNode* node);
void getTrianglesFromOctree(SOctreeNode* node, s32& trianglesWritten,
s32 maximumSize, const core::aabbox3d<f32>& box,
const core::matrix4* transform,
core::triangle3df* triangles) const;
void getTrianglesFromOctTree(SOctTreeNode* node, s32& trianglesWritten,
void getTrianglesFromOctree(SOctreeNode* node, s32& trianglesWritten,
s32 maximumSize, const core::line3d<f32>& line,
const core::matrix4* transform,
core::triangle3df* triangles) const;
SOctTreeNode* Root;
SOctreeNode* Root;
s32 NodeCount;
s32 MinimalPolysPerNode;
};

View File

@ -116,7 +116,7 @@
#include "CCubeSceneNode.h"
#include "CSphereSceneNode.h"
#include "CAnimatedMeshSceneNode.h"
#include "COctTreeSceneNode.h"
#include "COctreeSceneNode.h"
#include "CCameraSceneNode.h"
#include "CLightSceneNode.h"
@ -134,7 +134,7 @@
#include "CSceneCollisionManager.h"
#include "CTriangleSelector.h"
#include "COctTreeTriangleSelector.h"
#include "COctreeTriangleSelector.h"
#include "CTriangleBBSelector.h"
#include "CMetaTriangleSelector.h"
#include "CTerrainTriangleSelector.h"
@ -615,25 +615,25 @@ IAnimatedMeshSceneNode* CSceneManager::addAnimatedMeshSceneNode(IAnimatedMesh* m
}
//! Adds a scene node for rendering using a octtree to the scene graph. This a good method for rendering
//! Adds a scene node for rendering using a octree to the scene graph. This a good method for rendering
//! scenes with lots of geometry. The Octree is built on the fly from the mesh, much
//! faster then a bsp tree.
IMeshSceneNode* CSceneManager::addOctTreeSceneNode(IAnimatedMesh* mesh, ISceneNode* parent,
IMeshSceneNode* CSceneManager::addOctreeSceneNode(IAnimatedMesh* mesh, ISceneNode* parent,
s32 id, s32 minimalPolysPerNode, bool alsoAddIfMeshPointerZero)
{
if (!alsoAddIfMeshPointerZero && (!mesh || !mesh->getFrameCount()))
return 0;
return addOctTreeSceneNode(mesh ? mesh->getMesh(0) : 0,
return addOctreeSceneNode(mesh ? mesh->getMesh(0) : 0,
parent, id, minimalPolysPerNode,
alsoAddIfMeshPointerZero);
}
//! Adds a scene node for rendering using a octtree. This a good method for rendering
//! Adds a scene node for rendering using a octree. This a good method for rendering
//! scenes with lots of geometry. The Octree is built on the fly from the mesh, much
//! faster then a bsp tree.
IMeshSceneNode* CSceneManager::addOctTreeSceneNode(IMesh* mesh, ISceneNode* parent,
IMeshSceneNode* CSceneManager::addOctreeSceneNode(IMesh* mesh, ISceneNode* parent,
s32 id, s32 minimalPolysPerNode, bool alsoAddIfMeshPointerZero)
{
if (!alsoAddIfMeshPointerZero && !mesh)
@ -642,7 +642,7 @@ IMeshSceneNode* CSceneManager::addOctTreeSceneNode(IMesh* mesh, ISceneNode* pare
if (!parent)
parent = this;
COctTreeSceneNode* node = new COctTreeSceneNode(parent, this, id, minimalPolysPerNode);
COctreeSceneNode* node = new COctreeSceneNode(parent, this, id, minimalPolysPerNode);
if (node)
{
@ -1749,14 +1749,14 @@ ITriangleSelector* CSceneManager::createTriangleSelectorFromBoundingBox(ISceneNo
//! Creates a simple ITriangleSelector, based on a mesh.
ITriangleSelector* CSceneManager::createOctTreeTriangleSelector(IMesh* mesh,
ITriangleSelector* CSceneManager::createOctreeTriangleSelector(IMesh* mesh,
ISceneNode* node,
s32 minimalPolysPerNode)
{
if (!mesh)
return 0;
return new COctTreeTriangleSelector(mesh, node, minimalPolysPerNode);
return new COctreeTriangleSelector(mesh, node, minimalPolysPerNode);
}

View File

@ -113,16 +113,16 @@ namespace scene
//! draws all scene nodes
virtual void drawAll();
//! Adds a scene node for rendering using a octtree to the scene graph. This a good method for rendering
//! Adds a scene node for rendering using a octree to the scene graph. This a good method for rendering
//! scenes with lots of geometry. The Octree is built on the fly from the mesh, much
//! faster then a bsp tree.
virtual IMeshSceneNode* addOctTreeSceneNode(IAnimatedMesh* mesh, ISceneNode* parent=0,
virtual IMeshSceneNode* addOctreeSceneNode(IAnimatedMesh* mesh, ISceneNode* parent=0,
s32 id=-1, s32 minimalPolysPerNode=512, bool alsoAddIfMeshPointerZero=false);
//! Adss a scene node for rendering using a octtree. This a good method for rendering
//! Adss a scene node for rendering using a octree. This a good method for rendering
//! scenes with lots of geometry. The Octree is built on the fly from the mesh, much
//! faster then a bsp tree.
virtual IMeshSceneNode* addOctTreeSceneNode(IMesh* mesh, ISceneNode* parent=0,
virtual IMeshSceneNode* addOctreeSceneNode(IMesh* mesh, ISceneNode* parent=0,
s32 id=-1, s32 minimalPolysPerNode=128, bool alsoAddIfMeshPointerZero=false);
//! Adds a camera scene node to the tree and sets it as active camera.
@ -351,7 +351,7 @@ namespace scene
virtual ITriangleSelector* createTriangleSelector(IAnimatedMeshSceneNode* node);
//! Creates a simple ITriangleSelector, based on a mesh.
virtual ITriangleSelector* createOctTreeTriangleSelector(IMesh* mesh,
virtual ITriangleSelector* createOctreeTriangleSelector(IMesh* mesh,
ISceneNode* node, s32 minimalPolysPerNode);
//! Creates a simple dynamic ITriangleSelector, based on a axis aligned bounding box.

View File

@ -783,10 +783,10 @@
<Unit filename="COCTLoader.h" />
<Unit filename="COSOperator.cpp" />
<Unit filename="COSOperator.h" />
<Unit filename="COctTreeSceneNode.cpp" />
<Unit filename="COctTreeSceneNode.h" />
<Unit filename="COctTreeTriangleSelector.cpp" />
<Unit filename="COctTreeTriangleSelector.h" />
<Unit filename="COctreeSceneNode.cpp" />
<Unit filename="COctreeSceneNode.h" />
<Unit filename="COctreeTriangleSelector.cpp" />
<Unit filename="COctreeTriangleSelector.h" />
<Unit filename="COgreMeshFileLoader.cpp" />
<Unit filename="COgreMeshFileLoader.h" />
<Unit filename="COpenGLDriver.cpp" />
@ -951,7 +951,7 @@
<Unit filename="Irrlicht.cpp" />
<Unit filename="MacOSX/CIrrDeviceMacOSX.h" />
<Unit filename="MacOSX/CIrrDeviceMacOSX.mm" />
<Unit filename="OctTree.h" />
<Unit filename="Octree.h" />
<Unit filename="S2DVertex.h" />
<Unit filename="S4DVertex.h" />
<Unit filename="SoftwareDriver2_compile_config.h" />

View File

@ -1477,7 +1477,7 @@
RelativePath="CSceneManager.h">
</File>
<File
RelativePath="OctTree.h">
RelativePath="Octree.h">
</File>
<Filter
Name="loaders">
@ -1683,10 +1683,10 @@
RelativePath=".\CMeshSceneNode.h">
</File>
<File
RelativePath=".\COctTreeSceneNode.cpp">
RelativePath=".\COctreeSceneNode.cpp">
</File>
<File
RelativePath=".\COctTreeSceneNode.h">
RelativePath=".\COctreeSceneNode.h">
</File>
<File
RelativePath=".\CQuake3ShaderSceneNode.cpp">
@ -1812,10 +1812,10 @@
RelativePath="CMetaTriangleSelector.h">
</File>
<File
RelativePath="COctTreeTriangleSelector.cpp">
RelativePath="COctreeTriangleSelector.cpp">
</File>
<File
RelativePath="COctTreeTriangleSelector.h">
RelativePath="COctreeTriangleSelector.h">
</File>
<File
RelativePath="CSceneCollisionManager.cpp">

View File

@ -2354,11 +2354,11 @@
>
</File>
<File
RelativePath=".\COctTreeSceneNode.cpp"
RelativePath=".\COctreeSceneNode.cpp"
>
</File>
<File
RelativePath=".\COctTreeSceneNode.h"
RelativePath=".\COctreeSceneNode.h"
>
</File>
<File
@ -2534,11 +2534,11 @@
>
</File>
<File
RelativePath="COctTreeTriangleSelector.cpp"
RelativePath="COctreeTriangleSelector.cpp"
>
</File>
<File
RelativePath="COctTreeTriangleSelector.h"
RelativePath="COctreeTriangleSelector.h"
>
</File>
<File
@ -2574,7 +2574,7 @@
>
</File>
<File
RelativePath=".\OctTree.h"
RelativePath=".\Octree.h"
>
</File>
</Filter>

View File

@ -1372,7 +1372,7 @@
>
</File>
<File
RelativePath="OctTree.h"
RelativePath="Octree.h"
>
</File>
<Filter
@ -1647,11 +1647,11 @@
>
</File>
<File
RelativePath="COctTreeSceneNode.cpp"
RelativePath="COctreeSceneNode.cpp"
>
</File>
<File
RelativePath="COctTreeSceneNode.h"
RelativePath="COctreeSceneNode.h"
>
</File>
<File
@ -1847,11 +1847,11 @@
>
</File>
<File
RelativePath="COctTreeTriangleSelector.cpp"
RelativePath="COctreeTriangleSelector.cpp"
>
</File>
<File
RelativePath="COctTreeTriangleSelector.h"
RelativePath="COctreeTriangleSelector.h"
>
</File>
<File

View File

@ -1726,7 +1726,7 @@
>
</File>
<File
RelativePath="OctTree.h"
RelativePath="Octree.h"
>
</File>
<Filter
@ -2001,11 +2001,11 @@
>
</File>
<File
RelativePath="COctTreeSceneNode.cpp"
RelativePath="COctreeSceneNode.cpp"
>
</File>
<File
RelativePath="COctTreeSceneNode.h"
RelativePath="COctreeSceneNode.h"
>
</File>
<File
@ -2173,11 +2173,11 @@
>
</File>
<File
RelativePath="COctTreeTriangleSelector.cpp"
RelativePath="COctreeTriangleSelector.cpp"
>
</File>
<File
RelativePath="COctTreeTriangleSelector.h"
RelativePath="COctreeTriangleSelector.h"
>
</File>
<File

View File

@ -749,10 +749,10 @@
RelativePath=".\CLightSceneNode.h">
</File>
<File
RelativePath=".\COctTreeSceneNode.cpp">
RelativePath=".\COctreeSceneNode.cpp">
</File>
<File
RelativePath=".\COctTreeSceneNode.h">
RelativePath=".\COctreeSceneNode.h">
</File>
<File
RelativePath=".\CShadowVolumeSceneNode.cpp">
@ -1105,10 +1105,10 @@
RelativePath=".\COCTLoader.h">
</File>
<File
RelativePath=".\COctTreeTriangleSelector.cpp">
RelativePath=".\COctreeTriangleSelector.cpp">
</File>
<File
RelativePath=".\COctTreeTriangleSelector.h">
RelativePath=".\COctreeTriangleSelector.h">
</File>
<File
RelativePath=".\COgreMeshFileLoader.cpp">
@ -1408,7 +1408,7 @@
RelativePath=".\IZBuffer.h">
</File>
<File
RelativePath=".\OctTree.h">
RelativePath=".\Octree.h">
</File>
<File
RelativePath=".\os.cpp">

View File

@ -28,7 +28,7 @@ IRRMESHOBJ = $(IRRMESHLOADER) $(IRRMESHWRITER) \
CSkinnedMesh.o CBoneSceneNode.o CMeshSceneNode.o \
CAnimatedMeshSceneNode.o CAnimatedMeshMD2.o CAnimatedMeshMD3.o \
CQ3LevelMesh.o CQuake3ShaderSceneNode.o
IRROBJ = CBillboardSceneNode.o CCameraSceneNode.o CDummyTransformationSceneNode.o CEmptySceneNode.o CGeometryCreator.o CLightSceneNode.o CMeshManipulator.o CMetaTriangleSelector.o COctTreeSceneNode.o COctTreeTriangleSelector.o CSceneCollisionManager.o CSceneManager.o CShadowVolumeSceneNode.o CSkyBoxSceneNode.o CSkyDomeSceneNode.o CTerrainSceneNode.o CTerrainTriangleSelector.o CVolumeLightSceneNode.o CCubeSceneNode.o CSphereSceneNode.o CTextSceneNode.o CTriangleBBSelector.o CTriangleSelector.o CWaterSurfaceSceneNode.o CMeshCache.o CDefaultSceneNodeAnimatorFactory.o CDefaultSceneNodeFactory.o
IRROBJ = CBillboardSceneNode.o CCameraSceneNode.o CDummyTransformationSceneNode.o CEmptySceneNode.o CGeometryCreator.o CLightSceneNode.o CMeshManipulator.o CMetaTriangleSelector.o COctreeSceneNode.o COctreeTriangleSelector.o CSceneCollisionManager.o CSceneManager.o CShadowVolumeSceneNode.o CSkyBoxSceneNode.o CSkyDomeSceneNode.o CTerrainSceneNode.o CTerrainTriangleSelector.o CVolumeLightSceneNode.o CCubeSceneNode.o CSphereSceneNode.o CTextSceneNode.o CTriangleBBSelector.o CTriangleSelector.o CWaterSurfaceSceneNode.o CMeshCache.o CDefaultSceneNodeAnimatorFactory.o CDefaultSceneNodeFactory.o
IRRPARTICLEOBJ = CParticleAnimatedMeshSceneNodeEmitter.o CParticleBoxEmitter.o CParticleCylinderEmitter.o CParticleMeshEmitter.o CParticlePointEmitter.o CParticleRingEmitter.o CParticleSphereEmitter.o CParticleAttractionAffector.o CParticleFadeOutAffector.o CParticleGravityAffector.o CParticleRotationAffector.o CParticleSystemSceneNode.o CParticleScaleAffector.o
IRRANIMOBJ = CSceneNodeAnimatorCameraFPS.o CSceneNodeAnimatorCameraMaya.o CSceneNodeAnimatorCollisionResponse.o CSceneNodeAnimatorDelete.o CSceneNodeAnimatorFlyCircle.o CSceneNodeAnimatorFlyStraight.o CSceneNodeAnimatorFollowSpline.o CSceneNodeAnimatorRotation.o CSceneNodeAnimatorTexture.o
IRRDRVROBJ = CNullDriver.o COpenGLDriver.o COpenGLNormalMapRenderer.o COpenGLParallaxMapRenderer.o COpenGLShaderMaterialRenderer.o COpenGLTexture.o COpenGLSLMaterialRenderer.o COpenGLExtensionHandler.o CD3D8Driver.o CD3D8NormalMapRenderer.o CD3D8ParallaxMapRenderer.o CD3D8ShaderMaterialRenderer.o CD3D8Texture.o CD3D9Driver.o CD3D9HLSLMaterialRenderer.o CD3D9NormalMapRenderer.o CD3D9ParallaxMapRenderer.o CD3D9ShaderMaterialRenderer.o CD3D9Texture.o

View File

@ -2,8 +2,8 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_OCT_TREE_H_INCLUDED__
#define __C_OCT_TREE_H_INCLUDED__
#ifndef __C_OCTREE_H_INCLUDED__
#define __C_OCTREE_H_INCLUDED__
#include "SViewFrustum.h"
#include "S3DVertex.h"
@ -12,24 +12,24 @@
#include "CMeshBuffer.h"
/*!
Flags for Octtree
Flags for Octree
*/
#define OCTTREE_USE_HARDWARE // use meshbuffer for drawing, enables hardware acceleration
#define OCTTREE_PARENTTEST // bypass full invisible/visible test
#define OCTTREE_BOX_BASED // use bounding box or frustum for calculate polys
#define OCTREE_USE_HARDWARE // use meshbuffer for drawing, enables hardware acceleration
#define OCTREE_PARENTTEST // bypass full invisible/visible test
#define OCTREE_BOX_BASED // use bounding box or frustum for calculate polys
namespace irr
{
//! template octtree.
//! template octree.
/** T must be a vertex type which has a member
called .Pos, which is a core::vertex3df position. */
template <class T>
class OctTree
class Octree
{
public:
#if defined (OCTTREE_USE_HARDWARE)
#if defined (OCTREE_USE_HARDWARE)
struct SMeshChunk : public scene::CMeshBuffer<T>
{
SMeshChunk ()
@ -69,7 +69,7 @@ public:
//! Constructor
OctTree(const core::array<SMeshChunk>& meshes, s32 minimalPolysPerNode=128) :
Octree(const core::array<SMeshChunk>& meshes, s32 minimalPolysPerNode=128) :
IndexData(0), IndexDataCount(meshes.size()), NodeCount(0)
{
IndexData = new SIndexData[IndexDataCount];
@ -92,10 +92,10 @@ public:
}
// create tree
Root = new OctTreeNode(NodeCount, 0, meshes, indexChunks, minimalPolysPerNode);
Root = new OctreeNode(NodeCount, 0, meshes, indexChunks, minimalPolysPerNode);
}
//! returns all ids of polygons partially or fully enclosed
//! returns all ids of polygons partially or fully enclosed
//! by this bounding box.
void calculatePolys(const core::aabbox3d<f32>& box)
{
@ -105,7 +105,7 @@ public:
Root->getPolys(box, IndexData, 0);
}
//! returns all ids of polygons partially or fully enclosed
//! returns all ids of polygons partially or fully enclosed
//! by a view frustum.
void calculatePolys(const scene::SViewFrustum& frustum)
{
@ -131,14 +131,14 @@ public:
}
//! for debug purposes only, collects the bounding boxes of the tree
void getBoundingBoxes(const core::aabbox3d<f32>& box,
void getBoundingBoxes(const core::aabbox3d<f32>& box,
core::array< const core::aabbox3d<f32>* >&outBoxes) const
{
Root->getBoundingBoxes(box, outBoxes);
}
//! destructor
~OctTree()
~Octree()
{
for (u32 i=0; i<IndexDataCount; ++i)
delete [] IndexData[i].Indices;
@ -149,19 +149,19 @@ public:
private:
// private inner class
class OctTreeNode
class OctreeNode
{
public:
// constructor
OctTreeNode(u32& nodeCount, u32 currentdepth,
OctreeNode(u32& nodeCount, u32 currentdepth,
const core::array<SMeshChunk>& allmeshdata,
core::array<SIndexChunk>* indices,
s32 minimalPolysPerNode) : IndexData(0),
Depth(currentdepth+1)
{
++nodeCount;
u32 i; // new ISO for scoping problem with different compilers
for (i=0; i!=8; ++i)
@ -206,7 +206,7 @@ private:
core::vector3df middle = Box.getCenter();
core::vector3df edges[8];
Box.getEdges(edges);
// calculate all children
core::aabbox3d<f32> box;
core::array<u16> keepIndices;
@ -246,14 +246,14 @@ private:
keepIndices.push_back((*indices)[i].Indices[t+2]);
}
}
memcpy( (*indices)[i].Indices.pointer(), keepIndices.pointer(), keepIndices.size()*sizeof(u16));
(*indices)[i].Indices.set_used(keepIndices.size());
keepIndices.set_used(0);
}
if (added)
Children[ch] = new OctTreeNode(nodeCount, Depth,
Children[ch] = new OctreeNode(nodeCount, Depth,
allmeshdata, cindexChunks, minimalPolysPerNode);
else
delete cindexChunks;
@ -264,7 +264,7 @@ private:
}
// destructor
~OctTreeNode()
~OctreeNode()
{
delete IndexData;
@ -272,11 +272,11 @@ private:
delete Children[i];
}
// returns all ids of polygons partially or full enclosed
// returns all ids of polygons partially or full enclosed
// by this bounding box.
void getPolys(const core::aabbox3d<f32>& box, SIndexData* idxdata, u32 parentTest ) const
{
#if defined (OCTTREE_PARENTTEST )
#if defined (OCTREE_PARENTTEST )
// if not full inside
if ( parentTest != 2 )
{
@ -293,14 +293,14 @@ private:
{
const u32 cnt = IndexData->size();
u32 i; // new ISO for scoping problem in some compilers
for (i=0; i<cnt; ++i)
{
const s32 idxcnt = (*IndexData)[i].Indices.size();
if (idxcnt)
{
memcpy(&idxdata[i].Indices[idxdata[i].CurrentSize],
memcpy(&idxdata[i].Indices[idxdata[i].CurrentSize],
&(*IndexData)[i].Indices[0], idxcnt * sizeof(s16));
idxdata[i].CurrentSize += idxcnt;
}
@ -312,14 +312,14 @@ private:
}
}
// returns all ids of polygons partially or full enclosed
// returns all ids of polygons partially or full enclosed
// by the view frustum.
void getPolys(const scene::SViewFrustum& frustum, SIndexData* idxdata,u32 parentTest) const
{
u32 i; // new ISO for scoping problem in some compilers
// if parent is fully inside, no further check for the children is needed
#if defined (OCTTREE_PARENTTEST )
#if defined (OCTREE_PARENTTEST )
if ( parentTest != 2 )
#endif
{
@ -335,7 +335,7 @@ private:
if (frustum.planes[i].classifyPointRelation(edges[j]) != core::ISREL3D_FRONT)
{
boxInFrustum += 1;
#if !defined (OCTTREE_PARENTTEST )
#if !defined (OCTREE_PARENTTEST )
break;
#endif
}
@ -344,7 +344,7 @@ private:
if ( 0 == boxInFrustum) // all edges outside
return;
#if defined (OCTTREE_PARENTTEST )
#if defined (OCTREE_PARENTTEST )
if ( 8 == boxInFrustum) // all edges in, all children in
parentTest = 2;
#endif
@ -352,14 +352,14 @@ private:
}
const u32 cnt = IndexData->size();
for (i=0; i!=cnt; ++i)
{
s32 idxcnt = (*IndexData)[i].Indices.size();
if (idxcnt)
{
memcpy(&idxdata[i].Indices[idxdata[i].CurrentSize],
memcpy(&idxdata[i].Indices[idxdata[i].CurrentSize],
&(*IndexData)[i].Indices[0], idxcnt * sizeof(s16));
idxdata[i].CurrentSize += idxcnt;
}
@ -377,7 +377,7 @@ private:
if (Box.intersectsWithBox(box))
{
outBoxes.push_back(&Box);
for (u32 i=0; i!=8; ++i)
if (Children[i])
Children[i]->getBoundingBoxes(box, outBoxes);
@ -388,11 +388,11 @@ private:
core::aabbox3df Box;
core::array<SIndexChunk>* IndexData;
OctTreeNode* Children[8];
OctreeNode* Children[8];
u32 Depth;
};
OctTreeNode* Root;
OctreeNode* Root;
SIndexData* IndexData;
u32 IndexDataCount;
u32 NodeCount;

View File

@ -26,7 +26,7 @@ static bool runTestWithDriver(E_DRIVER_TYPE driverType)
if(added)
{
ISceneNode * node = smgr->addOctTreeSceneNode(smgr->getMesh("20kdm2.bsp")->getMesh(0), 0, -1, 1024);
ISceneNode * node = smgr->addOctreeSceneNode(smgr->getMesh("20kdm2.bsp")->getMesh(0), 0, -1, 1024);
assert(node);
if (node)

View File

@ -46,7 +46,7 @@ static bool transformPlane(const vector3df & point, const vector3df & normal,
}
static bool drawScaledOctTree(void)
static bool drawScaledOctree(void)
{
bool result = false;
IrrlichtDevice *device = createDevice(video::EDT_BURNINGSVIDEO, dimension2d<u32>(160, 120), 32);
@ -61,7 +61,7 @@ static bool drawScaledOctTree(void)
if(added)
{
ISceneNode * node = smgr->addOctTreeSceneNode(smgr->getMesh("20kdm2.bsp")->getMesh(0), 0, -1, 1024);
ISceneNode * node = smgr->addOctreeSceneNode(smgr->getMesh("20kdm2.bsp")->getMesh(0), 0, -1, 1024);
assert(node);
if (node)
@ -228,7 +228,7 @@ bool planeMatrix(void)
success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.707f,-0.000f,0.354f), -1.768f));
success &= transformPlane(vector3df(0, 1, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.707f,0.000f,-0.354f), 1.768f));
success &= drawScaledOctTree();
success &= drawScaledOctree();
return success;
}