# Visualization Library A lightweight C++ OpenGL middleware for 2D/3D graphics | [Home] [Tutorials] [All Classes] [Grouped Classes]

# vl::Actor Class Reference

Associates a Renderable object to an Effect and Transform. More...

`#include <Actor.hpp>`

Inheritance diagram for vl::Actor:

List of all members.

## Public Member Functions
virtual const char * | className ()
| Returns the name of the class.
| Actor (Renderable *renderable=NULL, Effect *effect=NULL, Transform *transform=NULL, int block=0, int rank=0)
| Constructor.
virtual | ~Actor ()
| Destructor.
ref< Renderable > & | lod (int lod_index)
| Returns the Renderable object representing the LOD level specifed by `index`.
const ref< Renderable > & | lod (int lod_index) const
| Returns the Renderable object representing the LOD level specifed by `index`.
void | setLODs (Renderable *lod0, Renderable *lod1=NULL, Renderable *lod2=NULL, Renderable *lod3=NULL, Renderable *lod4=NULL, Renderable *lod5=NULL)
| Utility function to assign one or more Renderable[s] to one or more LOD levels.
void | setTransform (Transform *transform)
| Binds a Transform to an Actor.
Transform * | transform ()
| Returns the Transform bound tho an Actor.
const Transform * | transform () const
| Returns the Transform bound tho an Actor.
void | setEffect (Effect *effect)
| Binds an Effect to an Actor.
Effect * | effect ()
| Returns the Effect bound to an Actor.
const Effect * | effect () const
| Returns the Effect bound to an Actor.
const Sphere & | boundingSphere () const
| Returns the bounding sphere that contains this Actor taking into consideration also its Transform.
const AABB & | boundingBox () const
| Returns the bounding box that contains this Actor taking into consideration also its Transform.
void | computeBounds ()
| Computes the bounding box and bounding sphere of an Actor taking into consideration also its Transform.
void | setRenderRank (int rank)
| Modifies the rendering rank of an Actor.
void | setRenderBlock (int block)
| Modifies the rendering block of an Actor.
int | renderRank () const
| Returns the rendering rank of an Actor.
int | renderBlock () const
| Returns the rendering block of an Actor.
void | setLODEvaluator (LODEvaluator *lod_evaluator)
| Installs the LODEvaluator used to compute the current LOD at rendering time.
LODEvaluator * | lodEvaluator ()
| Returns the installed LODEvaluator (if any) or NULL.
const LODEvaluator * | lodEvaluator () const
| Returns the installed LODEvaluator (if any) or NULL.
int | evaluateLOD (Camera *camera)
virtual void | update (int, Camera *, Real)
| Virtual function used to update or animate an Actor during the rendering.
void | setLastUpdateTime (Real time)
| For internal use only.
Real | lastUpdateTime () const
| For internal use only.
void | setEnableMask (unsigned int mask)
| The enable mask of an Actor defines whether the actor should be rendered or not depending on the Rendering::enableMask().
unsigned int | enableMask () const
| The enable mask of an Actor defines whether the actor should be rendered or not depending on the Rendering::enableMask().
void | setUniform (Uniform *uniform)
| Equivalent to uniformSet()->setUniform(uniform).
const std::vector< ref < Uniform > > & | uniforms () const
| Equivalent to uniformSet()->uniforms().
void | eraseUniform (const std::string &name)
| Equivalent to uniformSet()->eraseUniform(name).
void | eraseUniform (const Uniform *uniform)
| Equivalent to uniformSet()->eraseUniform(uniform).
void | eraseAllUniforms ()
| Equivalent to uniformSet()->eraseAllUniforms().
Uniform * | gocUniform (const std::string &name)
| Equivalent to uniformSet()->getUniform(name, get_mode).
Uniform * | getUniform (const std::string &name)
| Equivalent to uniformSet()->getUniform(name, get_mode).
const Uniform * | getUniform (const std::string &name) const
| Equivalent to uniformSet()->getUniform(name, get_mode).
void | setUniformSet (UniformSet *uniforms)
| Installs a new UniformSet.
UniformSet * | uniformSet () const
| Returns the UniformSet installed.
const Collection < ActorRenderingCallback > * | renderingCallbacks () const
| Returns the list of ActorRenderingCallback bound to an Actor.
Collection < ActorRenderingCallback > * | renderingCallbacks ()
| Returns the list of ActorRenderingCallback bound to an Actor.
void | executeRenderingCallbacks (const Camera *camera, Renderable *renderable, const Shader *shader, int pass)
| Calls all the ActorRenderingCallback installed on this Actor.
void | setScissor (Scissor *scissor)
| Sets the Scissor to be used when rendering an Actor.
const Scissor * | scissor () const
| Returns the Scissor used when rendering an Actor.
Scissor * | scissor ()
| Returns the Scissor used when rendering an Actor.
void | setOccludee (bool is_occludee)
| If `is_occludee` equals true an occlusion test will be performed before the rendering of the Actor (if occlusion culling is enabled) otherwise the Actor will always be rendered with no occlusion test even when occlusion culling is enabled.
bool | isOccludee () const
| If `is_occludee` equals true an occlusion test will be performed before the rendering of the Actor (if occlusion culling is enabled) otherwise the Actor will always be rendered with no occlusion test even when occlusion culling is enabled.
void | createOcclusionQuery ()
| For internal use only.
void | deleteOcclusionQuery ()
| For internal use only.
GLuint | occlusionQuery () const
| For internal use only.
void | setOcclusionQueryTick (unsigned tick)
| For internal use only.
unsigned | occlusionQueryTick () const
| For internal use only.
## Protected Attributes
AABB | mAABB
Sphere | mSphere
Real | mLastUpdateTime
ref< Effect > | mEffect
ref< Renderable > | mRenderables [VL_MAX_ACTOR_LOD]
ref< Transform > | mTransform
ref< LODEvaluator > | mLODEvaluator
ref< UniformSet > | mUniformSet
ref< Scissor > | mScissor
Collection < ActorRenderingCallback > | mRenderingCallbacks
int | mRenderBlock
int | mRenderRank
long long | mTransformUpdateTick
long long | mBoundsUpdateTick
unsigned int | mEnableMask
GLuint | mOcclusionQuery
bool | mIsOccludee
unsigned | mOcclusionQueryTick

## Detailed Description

Associates a Renderable object to an Effect and Transform.

An Actor can associate one Renderable for each LOD (level of detail) using the lods() function. The rendering order of an Actor is defined by its rendering rank, and block, see setRenderRank() and setRenderBlock() for the details.

Note:

- The same Renderable can be bound to more than one Actor at the same time
- The same Effect can be bound to more than one Actor at the same time
- The same Transform can be bound to more than one Actor at the same time

Remarks:

An Actor must always have a Renderable and Effect bound. If no Transform is specified the Renderable will be rendered as if it had an identity matrix transformation.

Uniforms

The Uniforms defined in the Actor and the ones defined in the Shader must not overlap, that is, an Actor must not define Uniforms that are also present in the Shader's Uniform and vice versa.

See also:
  Transform, Effect, Renderable, Geometry

## Constructor & Destructor Documentation

vl::Actor::Actor | ( | Renderable * | renderable = `NULL`,
|  | Effect * | effect = `NULL`,
|  | Transform * | transform = `NULL`,
|  | int | block = `0`,
|  | int | rank = `0` |
| ) |  |  | `[inline]`

Constructor.

Parameters:

  | renderable | A Renderable defining the Actor's LOD level #0
  | effect | The Effect to be used by the Actor
  | transform | The Transform to be used by the Actor
  | block | The rendering block to which the Actor belongs
  | rank | The rendering rank to which the Actor belongs

Actor::~Actor | ( |  | ) | `[virtual]`

Destructor.

## Member Function Documentation

virtual const char* vl::Actor::className | ( |  | ) | `[inline, virtual]`

Returns the name of the class.

Reimplemented from vl::Object.

Reimplemented in vl::MorphingActor.

ref<Renderable>& vl::Actor::lod | ( | int | lod_index | ) | `[inline]`

Returns the Renderable object representing the LOD level specifed by `index`.

const ref<Renderable>& vl::Actor::lod | ( | int | lod_index | ) | const`[inline]`

Returns the Renderable object representing the LOD level specifed by `index`.

void vl::Actor::setLODs | ( | Renderable * | lod0,
|  | Renderable * | lod1 = `NULL`,
|  | Renderable * | lod2 = `NULL`,
|  | Renderable * | lod3 = `NULL`,
|  | Renderable * | lod4 = `NULL`,
|  | Renderable * | lod5 = `NULL` |
| ) |  |  | `[inline]`

Utility function to assign one or more Renderable[s] to one or more LOD levels.

void vl::Actor::setTransform | ( | Transform * | transform | ) | `[inline]`

Binds a Transform to an Actor.

Transform* vl::Actor::transform | ( |  | ) | `[inline]`

Returns the Transform bound tho an Actor.

const Transform* vl::Actor::transform | ( |  | ) | const`[inline]`

Returns the Transform bound tho an Actor.

void vl::Actor::setEffect | ( | Effect * | effect | ) | `[inline]`

Binds an Effect to an Actor.

Effect* vl::Actor::effect | ( |  | ) | `[inline]`

Returns the Effect bound to an Actor.

Reimplemented in vlVolume::SlicedVolume.

const Effect* vl::Actor::effect | ( |  | ) | const`[inline]`

Returns the Effect bound to an Actor.

Reimplemented in vlVolume::SlicedVolume.

const Sphere& vl::Actor::boundingSphere | ( |  | ) | const`[inline]`

Returns the bounding sphere that contains this Actor taking into consideration also its Transform.

const AABB& vl::Actor::boundingBox | ( |  | ) | const`[inline]`

Returns the bounding box that contains this Actor taking into consideration also its Transform.

void Actor::computeBounds | ( |  | ) |

Computes the bounding box and bounding sphere of an Actor taking into consideration also its Transform.

void vl::Actor::setRenderRank | ( | int | rank | ) | `[inline]`

Modifies the rendering rank of an Actor.

The rendering rank affects the order in which an Actor is rendered, the greater the rank the later the Actor is rendered. The default render rank is zero.

To know more about rendering order please see Rendering Order.

See also:
  setRenderBlock(), Effect::setRenderRank()

void vl::Actor::setRenderBlock | ( | int | block | ) | `[inline]`

Modifies the rendering block of an Actor.

The rendering block affects the order in which an Actor is rendered, the greater the block the later the Actor is rendered. The default render block is zero.

To know more about rendering order please see Rendering Order.

See also:
  setRenderRank(), Effect::setRenderRank()

int vl::Actor::renderRank | ( |  | ) | const`[inline]`

Returns the rendering rank of an Actor.

int vl::Actor::renderBlock | ( |  | ) | const`[inline]`

Returns the rendering block of an Actor.

void vl::Actor::setLODEvaluator | ( | LODEvaluator * | lod_evaluator | ) | `[inline]`

Installs the LODEvaluator used to compute the current LOD at rendering time.

LODEvaluator* vl::Actor::lodEvaluator | ( |  | ) | `[inline]`

Returns the installed LODEvaluator (if any) or NULL.

const LODEvaluator* vl::Actor::lodEvaluator | ( |  | ) | const`[inline]`

Returns the installed LODEvaluator (if any) or NULL.

int Actor::evaluateLOD | ( | Camera * | camera | ) |

virtual void vl::Actor::update | ( | int | ,
|  | Camera * | ,
|  | Real |  |
| ) |  |  | `[inline, virtual]`

Virtual function used to update or animate an Actor during the rendering.

Parameters:

  | lod | the LOD (level of detail) currently selected for the rendering.
  | camera | the camera used for the current rendering.
  | cur_t | the current animation time.

Note:
  - is called after the actor resulted to be visible
  - is called only once per frame
  - is called before setting up the rendering states

See also:
  - ActorRenderingCallback
  - renderingCallbacks()

Reimplemented in vl::MorphingActor, and vlVolume::SlicedVolume.

void vl::Actor::setLastUpdateTime | ( | Real | time | ) | `[inline]`

For internal use only.

Real vl::Actor::lastUpdateTime | ( |  | ) | const`[inline]`

For internal use only.

void vl::Actor::setEnableMask | ( | unsigned int | mask | ) | `[inline]`

The enable mask of an Actor defines whether the actor should be rendered or not depending on the Rendering::enableMask().

unsigned int vl::Actor::enableMask | ( |  | ) | const`[inline]`

The enable mask of an Actor defines whether the actor should be rendered or not depending on the Rendering::enableMask().

void vl::Actor::setUniform | ( | Uniform * | uniform | ) | `[inline]`

Equivalent to uniformSet()->setUniform(uniform).

Remarks:
  This function performs a 'setUniformSet(new UniformSet)' if uniformSet() is NULL.

const std::vector< ref<Uniform> >& vl::Actor::uniforms | ( |  | ) | const`[inline]`

Equivalent to uniformSet()->uniforms().

Remarks:
  You must install a UniformSet with setUniformSet() before calling this function.

void vl::Actor::eraseUniform | ( | const std::string & | name | ) | `[inline]`

Equivalent to uniformSet()->eraseUniform(name).

Remarks:
  You must install a UniformSet with setUniformSet() before calling this function.

void vl::Actor::eraseUniform | ( | const Uniform * | uniform | ) | `[inline]`

Equivalent to uniformSet()->eraseUniform(uniform).

Remarks:
  You must install a UniformSet with setUniformSet() before calling this function.

void vl::Actor::eraseAllUniforms | ( |  | ) | `[inline]`

Equivalent to uniformSet()->eraseAllUniforms().

Remarks:
  You must install a UniformSet with setUniformSet() before calling this function.

Uniform* vl::Actor::gocUniform | ( | const std::string & | name | ) | `[inline]`

Equivalent to uniformSet()->getUniform(name, get_mode).

Remarks:
  You must install a UniformSet with setUniformSet() before calling this function.

Uniform* vl::Actor::getUniform | ( | const std::string & | name | ) | `[inline]`

Equivalent to uniformSet()->getUniform(name, get_mode).

Remarks:
  You must install a UniformSet with setUniformSet() before calling this function.

const Uniform* vl::Actor::getUniform | ( | const std::string & | name | ) | const`[inline]`

Equivalent to uniformSet()->getUniform(name, get_mode).

Remarks:
  You must install a UniformSet with setUniformSet() before calling this function.

void vl::Actor::setUniformSet | ( | UniformSet * | uniforms | ) | `[inline]`

Installs a new UniformSet.

See also:
  - setUniform()
  - uniforms()
  - eraseUniform(const std::string& name)
  - eraseUniform(const Uniform* uniform)
  - eraseAllUniforms()
  - getUniform()

UniformSet* vl::Actor::uniformSet | ( |  | ) | const`[inline]`

Returns the UniformSet installed.

See also:
  - setUniform()
  - uniforms()
  - eraseUniform(const std::string& name)
  - eraseUniform(const Uniform* uniform)
  - eraseAllUniforms()
  - getUniform()

const Collection<ActorRenderingCallback>* vl::Actor::renderingCallbacks | ( |  | ) | const`[inline]`

Returns the list of ActorRenderingCallback bound to an Actor.

Collection<ActorRenderingCallback>* vl::Actor::renderingCallbacks | ( |  | ) | `[inline]`

Returns the list of ActorRenderingCallback bound to an Actor.

void vl::Actor::executeRenderingCallbacks | ( | const Camera * | camera,
|  | Renderable * | renderable,
|  | const Shader * | shader,
|  | int | pass |
| ) |  |  | `[inline]`

Calls all the ActorRenderingCallback installed on this Actor.

void vl::Actor::setScissor | ( | Scissor * | scissor | ) | `[inline]`

Sets the Scissor to be used when rendering an Actor.

Note:
  You can also define a Scissor on a per-Shader basis using the function Shader::setScissor(). In case both the Shader's and the Actor's Scissor are defined the Actor's Scissor is used.

See also:
  - Scissor
  - Shader::setScissor()

const Scissor* vl::Actor::scissor | ( |  | ) | const`[inline]`

Returns the Scissor used when rendering an Actor.

See also:
  - Scissor
  - Actor::setScissor()
  - Shader::setScissor()

Scissor* vl::Actor::scissor | ( |  | ) | `[inline]`

Returns the Scissor used when rendering an Actor.

See also:
  - Scissor
  - Actor::setScissor()
  - Shader::setScissor()

void vl::Actor::setOccludee | ( | bool | is_occludee | ) | `[inline]`

If `is_occludee` equals true an occlusion test will be performed before the rendering of the Actor (if occlusion culling is enabled) otherwise the Actor will always be rendered with no occlusion test even when occlusion culling is enabled.

bool vl::Actor::isOccludee | ( |  | ) | const`[inline]`

If `is_occludee` equals true an occlusion test will be performed before the rendering of the Actor (if occlusion culling is enabled) otherwise the Actor will always be rendered with no occlusion test even when occlusion culling is enabled.

void Actor::createOcclusionQuery | ( |  | ) |

For internal use only.

Creates the occlusion query object name bound this Actor using the OpenGL function glGenQueries().

void Actor::deleteOcclusionQuery | ( |  | ) |

For internal use only.

Deletes the occlusion query object name using the OpenGL function glDeleteQueries().

GLuint vl::Actor::occlusionQuery | ( |  | ) | const`[inline]`

For internal use only.

Returns the occlusion query object name bound this Actor as by the OpenGL function glGenQueries(). Returns 0 if no query object name has been created yet.

void vl::Actor::setOcclusionQueryTick | ( | unsigned | tick | ) | `[inline]`

For internal use only.

unsigned vl::Actor::occlusionQueryTick | ( |  | ) | const`[inline]`

For internal use only.

## Member Data Documentation

AABB vl::Actor::mAABB`[protected]`

Sphere vl::Actor::mSphere`[protected]`

Real vl::Actor::mLastUpdateTime`[protected]`

ref<Effect> vl::Actor::mEffect`[protected]`

Reimplemented in vlVolume::SlicedVolume.

ref<Renderable> vl::Actor::mRenderables[VL_MAX_ACTOR_LOD]`[protected]`

ref<Transform> vl::Actor::mTransform`[protected]`

ref<LODEvaluator> vl::Actor::mLODEvaluator`[protected]`

ref<UniformSet> vl::Actor::mUniformSet`[protected]`

ref<Scissor> vl::Actor::mScissor`[protected]`

Collection<ActorRenderingCallback> vl::Actor::mRenderingCallbacks`[protected]`

int vl::Actor::mRenderBlock`[protected]`

int vl::Actor::mRenderRank`[protected]`

long long vl::Actor::mTransformUpdateTick`[protected]`

long long vl::Actor::mBoundsUpdateTick`[protected]`

unsigned int vl::Actor::mEnableMask`[protected]`

GLuint vl::Actor::mOcclusionQuery`[protected]`

bool vl::Actor::mIsOccludee`[protected]`

unsigned vl::Actor::mOcclusionQueryTick`[protected]`

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

- E:/VisualizationLibrary/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vl/Actor.hpp
- E:/VisualizationLibrary/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vl/Actor.cpp

Visualization Library v2009.08 Reference Documentation
Copyright 2005-2009 Michele Bosi. All rights reserved.
Updated on Sun Nov 8 14:28:55 2009.
Permission is granted to use this page to write and publish articles regarding Visualization Library.