Visualization Library v1.0.3A lightweight C++ OpenGL middleware for 2D/3D graphics |
[Download] [Tutorials] [All Classes] [Grouped Classes] |
The ActorTree class implements a generic tree whose nodes contain Actor[s]. More...
#include <ActorTree.hpp>
Public Member Functions | |
ActorTree () | |
virtual int | childrenCount () const |
Returns the number of child nodes of an ActorTreeAbstract node. | |
virtual ActorTreeAbstract * | child (int i) |
Returns the i-th child node of an ActorTreeAbstract node. | |
virtual const ActorTreeAbstract * | child (int i) const |
Returns the i-th child node of an ActorTreeAbstract node. | |
void | addChild (ActorTreeAbstract *node) |
void | setChild (int i, ActorTreeAbstract *node) |
void | eraseChild (int i, int count=1) |
void | eraseAllChildren () |
Public Attributes | |
std::vector< ref < ActorTreeAbstract > > | mChildren |
The ActorTree class implements a generic tree whose nodes contain Actor[s].
Each node of the tree can have any number of children.
Use this class when you want to have direct control over how the Actor[s] are grouped together or to implement specific space partitioning schemes like BSP trees, Quadtrees, Octrees etc. For example you can use the ActorTree class to build a quadtree by assigning 4 children per node and filling them appropriately. Of course you can also use an ActorTree to group a set of Actor[s] based on any other principle. For example animated Actor[s] are usually kept in separate "flat" trees (for example all in a single node) as the computational cost of rebuilding every frame the BSP tree, Quadtree, Octree etc. might be to high.
Note that for performance reasons the ActorKdTree class derives from the ActorTreeAbstract and implements a space partitioning scheme (based on a binary tree) where the splitting planes are in turn choosen so that they are aligned to the world space x, y and z axes.
Definition at line 62 of file ActorTree.hpp.
vl::ActorTree::ActorTree | ( | ) | [inline] |
Definition at line 67 of file ActorTree.hpp.
References VL_DEBUG_SET_OBJECT_NAME.
virtual int vl::ActorTree::childrenCount | ( | ) | const [inline, virtual] |
Returns the number of child nodes of an ActorTreeAbstract node.
Implements vl::ActorTreeAbstract.
Definition at line 72 of file ActorTree.hpp.
virtual ActorTreeAbstract* vl::ActorTree::child | ( | int | i ) | [inline, virtual] |
Returns the i-th child node of an ActorTreeAbstract node.
Implements vl::ActorTreeAbstract.
Definition at line 73 of file ActorTree.hpp.
virtual const ActorTreeAbstract* vl::ActorTree::child | ( | int | i ) | const [inline, virtual] |
Returns the i-th child node of an ActorTreeAbstract node.
Implements vl::ActorTreeAbstract.
Definition at line 74 of file ActorTree.hpp.
void ActorTree::addChild | ( | ActorTreeAbstract * | node ) |
Definition at line 45 of file ActorTree.cpp.
References vl::Log::error(), mChildren, vl::ActorTreeAbstract::parent(), and vl::ActorTreeAbstract::setParent().
void ActorTree::setChild | ( | int | i, |
ActorTreeAbstract * | node | ||
) |
Definition at line 56 of file ActorTree.cpp.
References vl::Log::error(), mChildren, NULL, and vl::ActorTreeAbstract::parent().
void ActorTree::eraseChild | ( | int | i, |
int | count = 1 |
||
) |
Definition at line 68 of file ActorTree.cpp.
References mChildren, NULL, and vl::ActorTreeAbstract::setParent().
void ActorTree::eraseAllChildren | ( | ) |
Definition at line 38 of file ActorTree.cpp.
References mChildren, NULL, and vl::ActorTreeAbstract::setParent().
std::vector< ref<ActorTreeAbstract> > vl::ActorTree::mChildren |
Definition at line 82 of file ActorTree.hpp.
Referenced by addChild(), eraseAllChildren(), eraseChild(), and setChild().