![]() |
VR-Forces Development_Version Class Documentation
|
Octree datastructure for managing scene nodes. More...
Public Types | |
| typedef std::vector < DtOctreeNode< T > * > | NodeList |
Public Member Functions | |
| DtOctree (DtOctree *parent, DtOctree *treeRoot, size_t maxDepth) | |
| CTOR. | |
| ~DtOctree () | |
| DTOR. | |
| void | addNode (DtOctreeNode< T > *) |
| Adds an Octree scene node to this octree level. | |
| void | removeNode (DtOctreeNode< T > *) |
| Removes an Octree scene node to this octree level. | |
| int | numNodes () |
| Returns the number of scene nodes attached to this octree. | |
| bool | isTwiceSize (const DtAxisAlignedBoundingBox< T > &box) const |
| Determines if this octree is twice as big as the given box. | |
| void | getChildIndexes (const DtAxisAlignedBoundingBox< T > &, int *x, int *y, int *z) const |
| Returns the appropriate indexes for the child of this octree into which the box will fit. | |
| void | getCullBounds (DtAxisAlignedBoundingBox< T > *) const |
| Creates the AxisAlignedBoundingBox<T> used for culling this octree. | |
| void | updateOctreeNode (DtOctreeNode< T > *pOctreeNode) |
| void | addOctreeNode (DtOctreeNode< T > *pOctreeNode, DtOctree< T > *pOctree, size_t depth=0) |
| void | removeOctreeNode (DtOctreeNode< T > *pOctreeNode) |
| void | findVisibleObjects (NodeList &visibleNodes, DtOctree *pOctree, const DtCamera< T > *pCamera, bool foundVisible) |
| void | findVisibleObjects (NodeList &visibleNodes, DtOctree *pOctree, const Frustum< T > *pFrustum, bool foundVisible) |
Public Attributes | |
| DtAxisAlignedBoundingBox< T > | myBox |
| The bounding box of the octree This is used for octant index determination and rendering, but not culling. | |
| DtVector3< T > | myHalfSize |
| Vector containing the dimensions of this octree / 2. | |
| DtOctree * | myChildren [2][2][2] |
| 3D array of children of this octree. | |
| NodeList | myNodes |
| Public list of SceneNodes attached to this particular octree. | |
Protected Member Functions | |
| void | ref () |
| Increments the overall node count of this octree and all its parents. | |
| void | unref () |
| Decrements the overall node count of this octree and all its parents. | |
Protected Attributes | |
| int | myNumNodes |
| number of SceneNodes in this octree and all its children. | |
| DtOctree * | myParent |
| parent octree | |
| DtOctree * | myOctree |
| tree root | |
| size_t | myMaxDepth |
Octree datastructure for managing scene nodes.
This is a loose octree implementation, meaning that each octant child of the octree actually overlaps it's siblings by a factor of .5. This guarantees that any thing that is half the size of the parent will fit completely into a child, with no splitting necessary.
| typedef std::vector< DtOctreeNode<T> * > makVrv::DtOctree< T >::NodeList |
| makVrv::DtOctree< T >::DtOctree | ( | DtOctree< T > * | parent, |
| DtOctree< T > * | treeRoot, | ||
| size_t | maxDepth | ||
| ) |
CTOR.
| makVrv::DtOctree< T >::~DtOctree | ( | ) |
DTOR.
| void makVrv::DtOctree< T >::addNode | ( | DtOctreeNode< T > * | ) |
Adds an Octree scene node to this octree level.
This is called by the OctreeSceneManager after it has determined the correct Octree to insert the node into.
| void makVrv::DtOctree< T >::removeNode | ( | DtOctreeNode< T > * | ) |
Removes an Octree scene node to this octree level.
|
inline |
Returns the number of scene nodes attached to this octree.
References makVrv::DtOctree< T >::myNumNodes.
| bool makVrv::DtOctree< T >::isTwiceSize | ( | const DtAxisAlignedBoundingBox< T > & | box | ) | const |
Determines if this octree is twice as big as the given box.
This method is used by the OctreeSceneManager to determine if the given box will fit into a child of this octree.
| void makVrv::DtOctree< T >::getChildIndexes | ( | const DtAxisAlignedBoundingBox< T > & | , |
| int * | x, | ||
| int * | y, | ||
| int * | z | ||
| ) | const |
Returns the appropriate indexes for the child of this octree into which the box will fit.
This is used by the OctreeSceneManager to determine which child to traverse next when finding the appropriate octree to insert the box. Since it is a loose octree, only the center of the box is checked to determine the octant.
| void makVrv::DtOctree< T >::getCullBounds | ( | DtAxisAlignedBoundingBox< T > * | ) | const |
Creates the AxisAlignedBoundingBox<T> used for culling this octree.
Since it's a loose octree, the culling bounds can be different than the actual bounds of the octree.
| void makVrv::DtOctree< T >::updateOctreeNode | ( | DtOctreeNode< T > * | pOctreeNode | ) |
| void makVrv::DtOctree< T >::addOctreeNode | ( | DtOctreeNode< T > * | pOctreeNode, |
| DtOctree< T > * | pOctree, | ||
| size_t | depth = 0 |
||
| ) |
| void makVrv::DtOctree< T >::removeOctreeNode | ( | DtOctreeNode< T > * | pOctreeNode | ) |
| void makVrv::DtOctree< T >::findVisibleObjects | ( | NodeList & | visibleNodes, |
| DtOctree< T > * | pOctree, | ||
| const DtCamera< T > * | pCamera, | ||
| bool | foundVisible | ||
| ) |
| void makVrv::DtOctree< T >::findVisibleObjects | ( | NodeList & | visibleNodes, |
| DtOctree< T > * | pOctree, | ||
| const Frustum< T > * | pFrustum, | ||
| bool | foundVisible | ||
| ) |
|
inlineprotected |
Increments the overall node count of this octree and all its parents.
References makVrv::DtOctree< T >::myNumNodes, and makVrv::DtOctree< T >::myParent.
|
inlineprotected |
Decrements the overall node count of this octree and all its parents.
References makVrv::DtOctree< T >::myNumNodes, and makVrv::DtOctree< T >::myParent.
| DtAxisAlignedBoundingBox<T> makVrv::DtOctree< T >::myBox |
The bounding box of the octree This is used for octant index determination and rendering, but not culling.
| DtVector3<T> makVrv::DtOctree< T >::myHalfSize |
Vector containing the dimensions of this octree / 2.
| DtOctree* makVrv::DtOctree< T >::myChildren[2][2][2] |
3D array of children of this octree.
Children are dynamically created as needed when nodes are inserted in the Octree. If, later, all the nodes are removed from the child, it is still kept around.
| NodeList makVrv::DtOctree< T >::myNodes |
Public list of SceneNodes attached to this particular octree.
|
protected |
number of SceneNodes in this octree and all its children.
Referenced by makVrv::DtOctree< T >::numNodes(), makVrv::DtOctree< T >::ref(), and makVrv::DtOctree< T >::unref().
|
protected |
parent octree
Referenced by makVrv::DtOctree< T >::ref(), and makVrv::DtOctree< T >::unref().
|
protected |
tree root
|
protected |