VR-Forces 5.0.1 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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

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.

Inheritance diagram for makVrv::DtOctree< T >:
Inheritance graph
[legend]

Public Types

typedef std::list
< DtOctreeNode< T > * > 
NodeList
 
typedef std::vector
< DtOctreeNode< T > * > 
NodeVector
 

Public Member Functions

 DtOctree (DtOctree *parent, DtOctree *treeRoot, size_t maxDepth)
 
 ~DtOctree ()
 
void addNode (DtOctreeNode< T > *)
 
void removeNode (DtOctreeNode< T > *)
 
int numNodes ()
 
bool isTwiceSize (const DtAxisAlignedBoundingBox< T > &box) const
 
void getChildIndexes (const DtAxisAlignedBoundingBox< T > &, int *x, int *y, int *z) const
 
void getCullBounds (DtAxisAlignedBoundingBox< T > *) const
 
void updateOctreeNode (DtOctreeNode< T > *pOctreeNode)
 
void addOctreeNode (DtOctreeNode< T > *pOctreeNode, DtOctree< T > *pOctree, size_t depth=0)
 
void removeOctreeNode (DtOctreeNode< T > *pOctreeNode)
 
void findVisibleObjects (NodeVector &visibleNodes, DtOctree *pOctree, const DtCamera< T > *pCamera, bool foundVisible)
 
void findVisibleObjects (NodeVector &visibleNodes, DtOctree *pOctree, const Frustum< T > *pFrustum, bool foundVisible)
 

Public Attributes

DtAxisAlignedBoundingBox< T > myBox
 
DtVector3< T > myHalfSize
 
DtOctreemyChildren [2][2][2]
 
NodeList myNodes
 

Protected Member Functions

void ref ()
 
void unref ()
 

Protected Attributes

int myNumNodes
 
DtOctreemyParent
 
DtOctreemyOctreeRoot
 
size_t myMaxDepth
 

Member Typedef Documentation

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

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.

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 ( NodeVector visibleNodes,
DtOctree< T > *  pOctree,
const DtCamera< T > *  pCamera,
bool  foundVisible 
)
template<class T>
void makVrv::DtOctree< T >::findVisibleObjects ( NodeVector 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.

Referenced by makVrv::DtOctree< double >::ref().

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

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

Referenced by makVrv::DtOctree< double >::unref().

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< double >::numNodes(), makVrv::DtOctree< double >::ref(), and makVrv::DtOctree< double >::unref().

template<class T>
DtOctree* makVrv::DtOctree< T >::myParent
protected
template<class T>
DtOctree* makVrv::DtOctree< T >::myOctreeRoot
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 Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)