Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Ogre::Octree Class Reference

Octree datastructure for managing scene nodes. More...

#include <OgreOctree.h>

Collaboration diagram for Ogre::Octree:

Collaboration graph
[legend]
List of all members.

Public Methods

 Octree (Octree *p)
 ~Octree ()
void _addNode (OctreeNode *)
 Adds an Octree scene node to this octree level.

void _removeNode (OctreeNode *)
 Removes an Octree scene node to this octree level.

int numNodes ()
 Returns the number of scene nodes attached to this octree.

WireBoundingBoxgetWireBoundingBox ()
 Creats the wire frame bounding box for this octant.

bool _isTwiceSize (AxisAlignedBox &box)
 Returns true is the box will fit in a child.

void _getChildIndexes (AxisAlignedBox &, int *x, int *y, int *z)
 It's assumed the the given box has already been proven to fit into a child.

void _getCullBounds (AxisAlignedBox *)
 Creates the AxisAlignedBox used for culling this octree.


Public Attributes

AxisAlignedBox mBox
 The bounding box of the octree.

WireBoundingBoxmWireBoundingBox
Vector3 mHalfSize
 Vector containing the dimensions of this octree / 2.

Octree * mChildren [2][2][2]
 3D array of children of this octree.

NodeList mNodes
 Public list of SceneNodes attached to this particular octree.


Protected Methods

void _ref ()
 Increments the overall node count of this octree and all it's parents.

void _unref ()
 Decrements the overall node count of this octree and all it's parents.


Protected Attributes

int mNumNodes
 number of SceneNodes in this octree and all it's children.

Octree * mParent
 parent octree


Detailed Description

Octree datastructure for managing scene nodes.

Remarks:
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.

Definition at line 42 of file OgreOctree.h.


Constructor & Destructor Documentation

Ogre::Octree::Octree Octree *    p
 

Definition at line 67 of file OgreOctree.cpp.

References mChildren, mNumNodes, and mParent.

Ogre::Octree::~Octree  
 

Definition at line 87 of file OgreOctree.cpp.

References mChildren, mParent, and mWireBoundingBox.


Member Function Documentation

void Ogre::Octree::_addNode OctreeNode  
 

Adds an Octree scene node to this octree level.

Remarks:
This is called by the OctreeSceneManager after it has determined the correct Octree to insert the node into.

Definition at line 108 of file OgreOctree.cpp.

References _ref(), and mNodes.

Referenced by Ogre::OctreeSceneManager::_updateOctreeNode().

void Ogre::Octree::_getChildIndexes AxisAlignedBox  ,
int *    x,
int *    y,
int *    z
 

It's assumed the the given box has already been proven to fit into a child.

Remarks:
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.

Definition at line 41 of file OgreOctree.cpp.

References Ogre::AxisAlignedBox::getMaximum(), Ogre::AxisAlignedBox::getMinimum(), mBox, Ogre::Vector3::midPoint(), Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.

void Ogre::Octree::_getCullBounds AxisAlignedBox  
 

Creates the AxisAlignedBox used for culling this octree.

Remarks:
Since it's a loose octree, the culling bounds can be different than the actual bounds of the octree.

Definition at line 127 of file OgreOctree.cpp.

References Ogre::AxisAlignedBox::getAllCorners(), mBox, and mHalfSize.

bool Ogre::Octree::_isTwiceSize AxisAlignedBox   box
 

Returns true is the box will fit in a child.

Remarks:
This method is used by the OctreeSceneManager to determine if the given box will fit into a child of this octree.

Definition at line 26 of file OgreOctree.cpp.

References Ogre::AxisAlignedBox::getAllCorners(), mBox, Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.

void Ogre::Octree::_ref   [protected]
 

Increments the overall node count of this octree and all it's parents.

Definition at line 118 of file OgreOctree.h.

References mNumNodes, and mParent.

Referenced by _addNode().

void Ogre::Octree::_removeNode OctreeNode  
 

Removes an Octree scene node to this octree level.

Definition at line 118 of file OgreOctree.cpp.

References _unref(), and mNodes.

void Ogre::Octree::_unref   [protected]
 

Decrements the overall node count of this octree and all it's parents.

Definition at line 127 of file OgreOctree.h.

References mNumNodes, and mParent.

Referenced by _removeNode().

WireBoundingBox * Ogre::Octree::getWireBoundingBox  
 

Creats the wire frame bounding box for this octant.

Definition at line 133 of file OgreOctree.cpp.

References mBox, mWireBoundingBox, and Ogre::WireBoundingBox::setupBoundingBox().

Referenced by Ogre::OctreeSceneManager::walkOctree().

int Ogre::Octree::numNodes  
 

Returns the number of scene nodes attached to this octree.

Definition at line 61 of file OgreOctree.h.

References mNumNodes.


Member Data Documentation

AxisAlignedBox Ogre::Octree::mBox
 

The bounding box of the octree.

Remarks:
This is used for octant index determination and rendering, but not culling

Definition at line 70 of file OgreOctree.h.

Referenced by _getChildIndexes(), _getCullBounds(), _isTwiceSize(), Ogre::OctreeSceneManager::getOption(), getWireBoundingBox(), Ogre::OctreeSceneManager::resize(), and Ogre::OctreeSceneManager::setOption().

Octree* Ogre::Octree::mChildren[ 2 ][ 2 ][ 2 ]
 

3D array of children of this octree.

Remarks:
Children are dynamically created as needed when nodes are inserted in the Octree. If, later, the all the nodes are removed from the child, it is still kept arround.

Definition at line 86 of file OgreOctree.h.

Referenced by Octree(), and ~Octree().

Vector3 Ogre::Octree::mHalfSize
 

Vector containing the dimensions of this octree / 2.

Definition at line 79 of file OgreOctree.h.

Referenced by _getCullBounds().

NodeList Ogre::Octree::mNodes
 

Public list of SceneNodes attached to this particular octree.

Definition at line 112 of file OgreOctree.h.

Referenced by _addNode(), and _removeNode().

int Ogre::Octree::mNumNodes [protected]
 

number of SceneNodes in this octree and all it's children.

Definition at line 135 of file OgreOctree.h.

Referenced by _ref(), _unref(), numNodes(), and Octree().

Octree* Ogre::Octree::mParent [protected]
 

parent octree

Definition at line 138 of file OgreOctree.h.

Referenced by _ref(), _unref(), Octree(), and ~Octree().

WireBoundingBox* Ogre::Octree::mWireBoundingBox
 

Definition at line 71 of file OgreOctree.h.

Referenced by getWireBoundingBox(), and ~Octree().


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

Copyright © 2002-2003 by The OGRE Team
Last modified Wed Jan 21 00:13:15 2004