VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes
makVrv::DtOctree< T > Class Template Reference

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.
DtOctreemyChildren [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.
DtOctreemyParent
 parent octree
DtOctreemyOctree
 tree root
size_t myMaxDepth

Detailed Description

template<class T>
class makVrv::DtOctree< T >

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.

Member Typedef Documentation

template<class T>
typedef std::vector< DtOctreeNode<T> * > makVrv::DtOctree< T >::NodeList

Constructor & Destructor Documentation

template<class T>
makVrv::DtOctree< T >::DtOctree ( DtOctree< T > *  parent,
DtOctree< T > *  treeRoot,
size_t  maxDepth 
)

CTOR.

template<class T>
makVrv::DtOctree< T >::~DtOctree ( )

DTOR.

Member Function Documentation

template<class T>
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.

template<class T>
void makVrv::DtOctree< T >::removeNode ( DtOctreeNode< T > *  )

Removes an Octree scene node to this octree level.

template<class T>
int makVrv::DtOctree< T >::numNodes ( )
inline

Returns the number of scene nodes attached to this octree.

References makVrv::DtOctree< T >::myNumNodes.

template<class T>
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.

template<class T>
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.

template<class T>
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.

template<class T>
void makVrv::DtOctree< T >::updateOctreeNode ( DtOctreeNode< T > *  pOctreeNode)
template<class T>
void makVrv::DtOctree< T >::addOctreeNode ( DtOctreeNode< T > *  pOctreeNode,
DtOctree< T > *  pOctree,
size_t  depth = 0 
)
template<class T>
void makVrv::DtOctree< T >::removeOctreeNode ( DtOctreeNode< T > *  pOctreeNode)
template<class T>
void makVrv::DtOctree< T >::findVisibleObjects ( NodeList visibleNodes,
DtOctree< T > *  pOctree,
const DtCamera< T > *  pCamera,
bool  foundVisible 
)
template<class T>
void makVrv::DtOctree< T >::findVisibleObjects ( NodeList visibleNodes,
DtOctree< T > *  pOctree,
const Frustum< T > *  pFrustum,
bool  foundVisible 
)
template<class T>
void makVrv::DtOctree< T >::ref ( )
inlineprotected

Increments the overall node count of this octree and all its parents.

References makVrv::DtOctree< T >::myNumNodes, and makVrv::DtOctree< T >::myParent.

template<class T>
void makVrv::DtOctree< T >::unref ( )
inlineprotected

Decrements the overall node count of this octree and all its parents.

References makVrv::DtOctree< T >::myNumNodes, and makVrv::DtOctree< T >::myParent.

Member Data Documentation

template<class T>
DtAxisAlignedBoundingBox<T> makVrv::DtOctree< T >::myBox

The bounding box of the octree This is used for octant index determination and rendering, but not culling.

template<class T>
DtVector3<T> makVrv::DtOctree< T >::myHalfSize

Vector containing the dimensions of this octree / 2.

template<class T>
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.

template<class T>
NodeList makVrv::DtOctree< T >::myNodes

Public list of SceneNodes attached to this particular octree.

template<class T>
int makVrv::DtOctree< T >::myNumNodes
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().

template<class T>
DtOctree* makVrv::DtOctree< T >::myParent
protected
template<class T>
DtOctree* makVrv::DtOctree< T >::myOctree
protected

tree root

template<class T>
size_t makVrv::DtOctree< T >::myMaxDepth
protected

The documentation for this class was generated from the following file:

Document ID: Generated on Tue Mar 8 22:13:38 EST 2016 from SVN revision 162938
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)