Visualization Library 2.1.0
A 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 Actors 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. More... | |
virtual ActorTreeAbstract * | child (int i)=0 |
Returns the i-th child node of an ActorTreeAbstract node. More... | |
virtual const ActorTreeAbstract * | child (int i) const =0 |
Returns the i-th child node of an ActorTreeAbstract node. More... | |
const ActorTreeAbstract * | parent () const |
Returns the parent of a node. More... | |
ActorTreeAbstract * | parent () |
Returns the parent of a node. More... | |
const ActorCollection * | actors () const |
Returns the actors contained in a ActorTree node. More... | |
ActorCollection * | actors () |
Returns the actors contained in a ActorTree node. More... | |
const AABB & | aabb () const |
Returns the bounding box of a node. Such bounding box contains both the bounding boxes of the node's Actors and of the child nodes. More... | |
void | computeAABB () |
Recursively computes the bounding box of a node so that it includes the bounding boxes of the node's Actors and of the child nodes. More... | |
void | extractActors (ActorCollection &list) |
Extracts all the Actors contained in th ActorTree hierarchy and appends them to the given ActorCollection. More... | |
void | extractVisibleActors (ActorCollection &list, const Camera *camera, unsigned enable_mask=0xFFFFFFFF) |
Extracts the enabled and visible Actors contained in th ActorTree hierarchy and appends them to the given ActorCollection. More... | |
ActorTreeAbstract * | eraseActor (Actor *actor) |
Removes the given Actor from the ActorTreeAbstract. More... | |
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. More... | |
Actor * | addActor (Actor *actor) |
Utility function equivalent to 'actors()->push_back(actor)'. More... | |
void | setParent (ActorTreeAbstract *p) |
For internal use only. More... | |
void | setEnabled (bool enabled) |
If false then extractVisibleActors() will ignore this node and all its children. More... | |
bool | isEnabled () const |
If false then extractVisibleActors() will ignore this node and all its children. More... | |
Public Member Functions inherited from vl::Object | |
Object () | |
Constructor. More... | |
Object (const Object &other) | |
Copy constructor: copies the name, ref count mutex and user data. More... | |
Object & | operator= (const Object &other) |
Copy operator: copies the object's name, ref count mutex and user data. More... | |
const std::string & | objectName () const |
The name of the object, by default set to the object's class name. More... | |
void | setObjectName (const char *name) |
The name of the object, by default set to the object's class name in debug builds. More... | |
void | setObjectName (const std::string &name) |
The name of the object, by default set to the object's class name in debug builds. More... | |
void | setRefCountMutex (IMutex *mutex) |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
IMutex * | refCountMutex () |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
const IMutex * | refCountMutex () const |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
int | referenceCount () const |
Returns the number of references of an object. More... | |
void | incReference () const |
Increments the reference count of an object. More... | |
void | decReference () |
Decrements the reference count of an object and deletes it if both automaticDelete() is true the count reaches 0. More... | |
void | setAutomaticDelete (bool autodel_on) |
If set to true the Object is deleted when its reference count reaches 0. More... | |
bool | automaticDelete () const |
If set to true the Object is deleted when its reference count reaches 0. More... | |
template<class T > | |
T * | as () |
Casts an Object to the specified class. More... | |
template<class T > | |
const T * | as () const |
Casts an Object to the specified class. More... | |
Static Public Member Functions | |
static void | prepareActors (ActorCollection &actors) |
Updates the Transform and the bounds of the given Actors. More... | |
Protected Attributes | |
ActorTreeAbstract * | mParent |
ActorCollection | mActors |
AABB | mAABB |
bool | mEnabled |
Protected Attributes inherited from vl::Object | |
std::string | mObjectName |
IMutex * | mRefCountMutex |
int | mReferenceCount |
bool | mAutomaticDelete |
Additional Inherited Members | |
Protected Member Functions inherited from vl::Object | |
virtual | ~Object () |
The ActorTreeAbstract class implements the interface of a generic tree containing Actors 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, mEnabled, mParent, NULL, and vl::Object::setAutomaticDelete().
|
inline |
Returns the bounding box of a node. Such bounding box contains both the bounding boxes of the node's Actors and of the child nodes.
Definition at line 80 of file ActorTreeAbstract.hpp.
References NULL.
Referenced by computeAABB(), and extractVisibleActors().
|
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(), vl::ActorKdTree::insertActor(), vl::ActorKdTree::rebuildKdTree(), and vl::Molecule::reset().
|
inline |
Returns the actors contained in a ActorTree node.
Definition at line 77 of file ActorTreeAbstract.hpp.
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 125 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 132 of file ActorTreeAbstract.cpp.
References actors(), and vl::Collection< T >::push_back().
|
pure virtual |
Returns the i-th child node of an ActorTreeAbstract node.
Implemented in vl::ActorTree, and vl::ActorKdTree.
Referenced by computeAABB(), eraseActor(), extractActors(), and extractVisibleActors().
|
pure virtual |
Returns the i-th child node of an ActorTreeAbstract node.
Implemented in vl::ActorTree, and vl::ActorKdTree.
|
pure virtual |
Returns the number of child nodes of an ActorTreeAbstract node.
Implemented in vl::ActorTree, and vl::ActorKdTree.
Referenced by computeAABB(), eraseActor(), extractActors(), and extractVisibleActors().
void ActorTreeAbstract::computeAABB | ( | ) |
Recursively computes the bounding box of a node so that it includes the bounding boxes of the node's Actors and of the child nodes.
Definition at line 46 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().
ActorTreeAbstract * ActorTreeAbstract::eraseActor | ( | Actor * | actor | ) |
Removes the given Actor from the ActorTreeAbstract.
Definition at line 107 of file ActorTreeAbstract.cpp.
References actors(), child(), childrenCount(), eraseActor(), vl::Collection< T >::eraseAt(), vl::Collection< T >::find(), and NULL.
Referenced by eraseActor().
void ActorTreeAbstract::extractActors | ( | ActorCollection & | list | ) |
Extracts all the Actors contained in th ActorTree hierarchy and appends them to the given ActorCollection.
This ignores the Actors isEnabled() and enableMask() and the ActorTreeAbstract::isEnabled() flag as well.
Definition at line 65 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 Actors 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 Actors contained in the nodes that could not be culled. If camera
is NULL no frustum culling is performed. This function alwasy take into consideration the Actors isEnabled() and enableMask() and the ActorTreeAbstract::isEnabled() flag as well.
Definition at line 78 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(), isEnabled(), vl::Actor::isEnabled(), vl::Collection< T >::push_back(), and vl::Collection< T >::size().
Referenced by extractVisibleActors().
|
inline |
If false
then extractVisibleActors() will ignore this node and all its children.
Definition at line 129 of file ActorTreeAbstract.hpp.
Referenced by extractVisibleActors().
|
inline |
Returns the parent of a node.
Definition at line 70 of file ActorTreeAbstract.hpp.
Referenced by vl::ActorTree::addChild(), and vl::ActorTree::setChild().
|
inline |
Returns the parent of a node.
Definition at line 72 of file ActorTreeAbstract.hpp.
|
static |
Updates the Transform and the bounds of the given Actors.
Before you create a bounding box tree or a kd-tree of Actors 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 138 of file ActorTreeAbstract.cpp.
References vl::Collection< T >::size().
Referenced by vl::ActorKdTree::buildKdTree().
|
inline |
If false
then extractVisibleActors() will ignore this node and all its children.
Definition at line 125 of file ActorTreeAbstract.hpp.
|
inline |
For internal use only.
Definition at line 121 of file ActorTreeAbstract.hpp.
Referenced by vl::ActorTree::addChild(), and vl::ActorTree::setChild().
|
protected |
Definition at line 134 of file ActorTreeAbstract.hpp.
Referenced by computeAABB(), vl::ActorKdTree::harvestNonLeafActors(), and vl::ActorKdTree::rebuildKdTree().
|
protected |
Definition at line 133 of file ActorTreeAbstract.hpp.
Referenced by ActorTreeAbstract(), and vl::ActorKdTree::rebuildKdTree().
|
protected |
Definition at line 135 of file ActorTreeAbstract.hpp.
Referenced by ActorTreeAbstract().
|
protected |
Definition at line 132 of file ActorTreeAbstract.hpp.
Referenced by ActorTreeAbstract(), and vl::ActorKdTree::childP().
Visualization Library 2.1.0 Reference Documentation
Updated on Wed Mar 10 2021 16:02:46.
© Copyright Michele Bosi. All rights reserved.