Visualization Library v1.0.3A lightweight C++ OpenGL middleware for 2D/3D graphics |
[Download] [Tutorials] [All Classes] [Grouped Classes] |
The ActorTreeAbstract class implements the interface of a generic tree containing Actor[s] in its nodes. More...
#include <ActorTreeAbstract.hpp>
Public Member Functions | |
ActorTreeAbstract () | |
virtual int | childrenCount () const =0 |
Returns the number of child nodes of an ActorTreeAbstract node. | |
virtual ActorTreeAbstract * | child (int i)=0 |
Returns the i-th child node of an ActorTreeAbstract node. | |
virtual const ActorTreeAbstract * | child (int i) const =0 |
Returns the i-th child node of an ActorTreeAbstract node. | |
const ActorTreeAbstract * | parent () const |
Returns the parent of a node. | |
ActorTreeAbstract * | parent () |
Returns the parent of a node. | |
const ActorCollection * | actors () const |
Returns the actors contained in a ActorTree node. | |
ActorCollection * | actors () |
Returns the actors contained in a ActorTree node. | |
const AABB & | aabb () const |
Returns the bounding box of a node. Such bounding box contains both the bounding boxes of the node's Actor[s] and of the child nodes. | |
void | computeAABB () |
Recursively computes the bounding box of a node so that it includes the bounding boxes of the node's Actor[s] and of the child nodes. | |
void | extractActors (ActorCollection &list) |
Extracts all the Actor[s] contained in th ActorTree hierarchy and appends them to the given ActorCollection. | |
void | extractVisibleActors (ActorCollection &list, const Camera *camera, unsigned enable_mask=0xFFFFFFFF) |
Extracts the enabled and visible Actor[s] contained in th ActorTree hierarchy and appends them to the given ActorCollection. | |
ActorTreeAbstract * | eraseActor (Actor *actor) |
Removes the given Actor from the ActorTreeAbstract. | |
Actor * | addActor (Renderable *renderable, Effect *eff, Transform *tr=NULL) |
Utility function that adds an Actor and binds it to the given Renderable, Effect and Transform. | |
Actor * | addActor (Actor *actor) |
Utility function equivalent to 'actors()->push_back(actor)'. | |
void | setParent (ActorTreeAbstract *p) |
For internal use only. | |
Static Public Member Functions | |
static void | prepareActors (ActorCollection &actors) |
Updates the Transform and the bounds of the given Actor[s]. | |
Protected Attributes | |
ActorTreeAbstract * | mParent |
ActorCollection | mActors |
AABB | mAABB |
The ActorTreeAbstract class implements the interface of a generic tree containing Actor[s] in its nodes.
The interface of ActorTreeAbstract allows you to:
Does not allow you to:
Definition at line 55 of file ActorTreeAbstract.hpp.
ActorTreeAbstract::ActorTreeAbstract | ( | ) |
Definition at line 38 of file ActorTreeAbstract.cpp.
References mActors, mParent, NULL, vl::Object::setAutomaticDelete(), and VL_DEBUG_SET_OBJECT_NAME.
virtual int vl::ActorTreeAbstract::childrenCount | ( | ) | const [pure virtual] |
Returns the number of child nodes of an ActorTreeAbstract node.
Implemented in vl::ActorKdTree, and vl::ActorTree.
Referenced by computeAABB(), eraseActor(), extractActors(), and extractVisibleActors().
virtual ActorTreeAbstract* vl::ActorTreeAbstract::child | ( | int | i ) | [pure virtual] |
Returns the i-th child node of an ActorTreeAbstract node.
Implemented in vl::ActorKdTree, and vl::ActorTree.
Referenced by computeAABB(), eraseActor(), extractActors(), and extractVisibleActors().
virtual const ActorTreeAbstract* vl::ActorTreeAbstract::child | ( | int | i ) | const [pure virtual] |
Returns the i-th child node of an ActorTreeAbstract node.
Implemented in vl::ActorKdTree, and vl::ActorTree.
const ActorTreeAbstract* vl::ActorTreeAbstract::parent | ( | ) | const [inline] |
Returns the parent of a node.
Definition at line 70 of file ActorTreeAbstract.hpp.
Referenced by vl::ActorTree::addChild(), and vl::ActorTree::setChild().
ActorTreeAbstract* vl::ActorTreeAbstract::parent | ( | ) | [inline] |
Returns the parent of a node.
Definition at line 72 of file ActorTreeAbstract.hpp.
const ActorCollection* vl::ActorTreeAbstract::actors | ( | ) | const [inline] |
Returns the actors contained in a ActorTree node.
Definition at line 75 of file ActorTreeAbstract.hpp.
Referenced by addActor(), vl::VolumePlot::compute(), computeAABB(), eraseActor(), extractActors(), extractVisibleActors(), vl::ActorKdTree::harvestNonLeafActors(), and vl::ActorKdTree::insertActor().
ActorCollection* vl::ActorTreeAbstract::actors | ( | ) | [inline] |
Returns the actors contained in a ActorTree node.
Definition at line 77 of file ActorTreeAbstract.hpp.
const AABB& vl::ActorTreeAbstract::aabb | ( | ) | const [inline] |
Returns the bounding box of a node. Such bounding box contains both the bounding boxes of the node's Actor[s] and of the child nodes.
Definition at line 80 of file ActorTreeAbstract.hpp.
Referenced by computeAABB(), and extractVisibleActors().
void ActorTreeAbstract::computeAABB | ( | ) |
Recursively computes the bounding box of a node so that it includes the bounding boxes of the node's Actor[s] and of the child nodes.
Definition at line 45 of file ActorTreeAbstract.cpp.
References aabb(), actors(), vl::Collection< T >::at(), vl::Actor::boundingBox(), child(), childrenCount(), computeAABB(), vl::Actor::computeBounds(), mAABB, and vl::Collection< T >::size().
Referenced by computeAABB().
void ActorTreeAbstract::extractActors | ( | ActorCollection & | list ) |
Extracts all the Actor[s] contained in th ActorTree hierarchy and appends them to the given ActorCollection.
Definition at line 64 of file ActorTreeAbstract.cpp.
References actors(), child(), childrenCount(), extractActors(), vl::Collection< T >::push_back(), and vl::Collection< T >::size().
Referenced by extractActors(), and vl::ActorKdTree::rebuildKdTree().
void ActorTreeAbstract::extractVisibleActors | ( | ActorCollection & | list, |
const Camera * | camera, | ||
unsigned | enable_mask = 0xFFFFFFFF |
||
) |
Extracts the enabled and visible Actor[s] contained in th ActorTree hierarchy and appends them to the given ActorCollection.
This function implements a hierarchycal frustum culling algorithm that culls the nodes of the bounding box tree first and then the single Actor[s] contained in the nodes that could not be culled. See also Actor::enableMask()
Definition at line 73 of file ActorTreeAbstract.cpp.
References aabb(), actors(), vl::Collection< T >::at(), child(), childrenCount(), vl::Actor::computeBounds(), vl::Frustum::cull(), vl::Actor::enableMask(), extractVisibleActors(), vl::Camera::frustum(), vl::Collection< T >::push_back(), vl::Collection< T >::size(), and VL_CHECK.
Referenced by vl::SceneManagerBVH< ActorTree >::extractVisibleActors(), and extractVisibleActors().
ActorTreeAbstract * ActorTreeAbstract::eraseActor | ( | Actor * | actor ) |
Removes the given Actor from the ActorTreeAbstract.
Definition at line 95 of file ActorTreeAbstract.cpp.
References actors(), child(), childrenCount(), eraseActor(), vl::Collection< T >::eraseAt(), vl::Collection< T >::find(), and NULL.
Referenced by eraseActor().
Actor * ActorTreeAbstract::addActor | ( | Renderable * | renderable, |
Effect * | eff, | ||
Transform * | tr = NULL |
||
) |
Utility function that adds an Actor and binds it to the given Renderable, Effect and Transform.
Definition at line 113 of file ActorTreeAbstract.cpp.
References actors(), vl::ref< T >::get(), and vl::Collection< T >::push_back().
Utility function equivalent to 'actors()->push_back(actor)'.
Definition at line 120 of file ActorTreeAbstract.cpp.
References actors(), and vl::Collection< T >::push_back().
void ActorTreeAbstract::prepareActors | ( | ActorCollection & | actors ) | [static] |
Updates the Transform and the bounds of the given Actor[s].
Before you create a bounding box tree or a kd-tree of Actor[s] you have to make sure that their Transform and bounding volumes are up-to-date. This is an utility function that lets you do that in a simple an quick way.
Definition at line 126 of file ActorTreeAbstract.cpp.
References vl::Collection< T >::size().
Referenced by vl::ActorKdTree::buildKdTree().
void vl::ActorTreeAbstract::setParent | ( | ActorTreeAbstract * | p ) | [inline] |
For internal use only.
Definition at line 118 of file ActorTreeAbstract.hpp.
Referenced by vl::ActorTree::addChild(), vl::ActorTree::eraseAllChildren(), and vl::ActorTree::eraseChild().
ActorTreeAbstract* vl::ActorTreeAbstract::mParent [protected] |
Definition at line 121 of file ActorTreeAbstract.hpp.
Referenced by ActorTreeAbstract().
ActorCollection vl::ActorTreeAbstract::mActors [protected] |
Definition at line 122 of file ActorTreeAbstract.hpp.
Referenced by ActorTreeAbstract().
AABB vl::ActorTreeAbstract::mAABB [protected] |
Definition at line 123 of file ActorTreeAbstract.hpp.
Referenced by computeAABB().