# Ogre::Octree Class Reference

Octree datastructure for managing scene nodes. More...

`#include <OgreOctree.h>`

List of all members.

## Public Member Functions

| 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.
WireBoundingBox * | getWireBoundingBox ()
| Creats the wire frame bounding box for this octant.
bool | _isTwiceSize (AxisAlignedBox &box)
| Determines if this octree is twice as big as the given box.
void | _getChildIndexes (AxisAlignedBox &, int *x, int *y, int *z)
| Returns the appropriate indexes for the child of this octree into which the box will fit.
void | _getCullBounds (AxisAlignedBox *)
| Creates the AxisAlignedBox used for culling this octree.

## Public Attributes

AxisAlignedBox | mBox
| The bounding box of the octree.
WireBoundingBox * | mWireBoundingBox
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 Member Functions

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 59 of file OgreOctree.h.

## Constructor & Destructor Documentation

Ogre::Octree::Octree | ( | Octree * | p | ) |

Ogre::Octree::~Octree | ( |  | ) |

## 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.

void Ogre::Octree::_getChildIndexes | ( | AxisAlignedBox & | ,
|  | int * | x,
|  | int * | y,
|  | int * | z
| ) |

Returns the appropriate indexes for the child of this octree into which the box will fit.

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.

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.

bool Ogre::Octree::_isTwiceSize | ( | AxisAlignedBox & | box | ) |

Determines if this octree is twice as big as the given box.

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

void Ogre::Octree::_ref | ( |  | ) | `[protected]`

| Increments the overall node count of this octree and all it's parents. Definition at line 135 of file OgreOctree.h.

void Ogre::Octree::_removeNode | ( | OctreeNode * |  | ) |

| Removes an Octree scene node to this octree level.

void Ogre::Octree::_unref | ( |  | ) | `[protected]`

| Decrements the overall node count of this octree and all it's parents. Definition at line 144 of file OgreOctree.h.

WireBoundingBox* Ogre::Octree::getWireBoundingBox | ( |  | ) |

| Creats the wire frame bounding box for this octant.

int Ogre::Octree::numNodes | ( |  | ) |

| Returns the number of scene nodes attached to this octree. Definition at line 78 of file OgreOctree.h.

## 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 87 of file OgreOctree.h.

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 103 of file OgreOctree.h.

Vector3 Ogre::Octree::mHalfSize

| Vector containing the dimensions of this octree / 2. Definition at line 96 of file OgreOctree.h.

NodeList Ogre::Octree::mNodes

| Public list of SceneNodes attached to this particular octree. Definition at line 129 of file OgreOctree.h.

int Ogre::Octree::mNumNodes `[protected]`

| number of SceneNodes in this octree and all it's children. Definition at line 152 of file OgreOctree.h.

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

| parent octree Definition at line 155 of file OgreOctree.h.

WireBoundingBox* Ogre::Octree::mWireBoundingBox

| Definition at line 88 of file OgreOctree.h.

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

- OgreOctree.h

Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Feb 12 13:05:47 2006