Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics
[Home] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions | Protected Attributes

vl::Actor Class Reference

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

#include <Actor.hpp>

Inheritance diagram for vl::Actor:
vl::Object

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.
void setLod (int lod_index, Renderable *renderable)
 Sets the Renderable object representing the LOD level specifed by lod_index.
const ref< Renderable > & lod (int lod_index) const
 Returns the Renderable object representing the LOD level specifed by lod_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.
Transformtransform ()
 Returns the Transform bound tho an Actor.
const Transformtransform () const
 Returns the Transform bound tho an Actor.
void setEffect (Effect *effect)
 Binds an Effect to an Actor.
Effecteffect ()
 Returns the Effect bound to an Actor.
const Effecteffect () const
 Returns the Effect bound to an Actor.
const AABBboundingBox () const
 Returns the bounding box (not guaranteed to be up to date) that contains this Actor.
const SphereboundingSphere () const
 Returns the bounding sphere (not guaranteed to be up to date) that contains this Actor.
const AABBboundingBoxSafe ()
 Returns the bounding box (guaranteed to be up to date) that contains this Actor.
const SphereboundingSphereSafe ()
 Returns the bounding sphere (guaranteed to be up to date) that contains this Actor.
void computeBounds ()
 Computes the bounding box and bounding sphere of an Actor.
bool boundsDirty () const
 Returns whether the Actor's bounding box and sphere are up to date.
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.
LODEvaluatorlodEvaluator ()
 Returns the installed LODEvaluator (if any) or NULL.
const LODEvaluatorlodEvaluator () const
 Returns the installed LODEvaluator (if any) or NULL.
int evaluateLOD (Camera *camera)
void setEnableMask (unsigned int mask)
 The enable mask of an Actor is usually used to defines whether the actor should be rendered or not depending on the Rendering::enableMask() but it can also be used for user-specific tasks.
unsigned int enableMask () const
 The enable mask of an Actor is usually used to defines whether the actor should be rendered or not depending on the Rendering::enableMask() but it can also be used for user-specific tasks.
void setUniform (Uniform *uniform)
 Equivalent to getUniformSet()->setUniform(uniform)
const std::vector< ref
< Uniform > > & 
uniforms () const
 Equivalent to getUniformSet()->uniforms()
std::vector< ref< Uniform > > & uniforms ()
 Equivalent to gocUniformSet()->uniforms()
void eraseUniform (const std::string &name)
 Equivalent to getUniformSet()->eraseUniform(name)
void eraseUniform (const Uniform *uniform)
 Equivalent to getUniformSet()->eraseUniform(uniform)
void eraseAllUniforms ()
 Equivalent to getUniformSet()->eraseAllUniforms()
UniformgocUniform (const std::string &name)
 Equivalent to getUniformSet()->getUniform(name, get_mode)
UniformgetUniform (const std::string &name)
 Equivalent to getUniformSet()->getUniform(name, get_mode)
const UniformgetUniform (const std::string &name) const
 Equivalent to getUniformSet()->getUniform(name, get_mode)
void setUniformSet (UniformSet *uniforms)
 Installs a new UniformSet.
const UniformSetgetUniformSet () const
 Returns the installed UniformSet.
UniformSetgetUniformSet ()
 Returns the installed UniformSet.
UniformSetgocUniformSet ()
 Creates and/or returns the installed UniformSet.
const Collection
< ActorEventCallback > * 
actorEventCallbacks () const
 Returns the list of ActorEventCallback bound to an Actor.
Collection< ActorEventCallback > * actorEventCallbacks ()
 Returns the list of ActorEventCallback bound to an Actor.
void dispatchOnActorRenderStarted (Real frame_clock, const Camera *camera, Renderable *renderable, const Shader *shader, int pass)
 Calls all the onActorRenderStarted() of all the ActorEventCallback installed on this Actor.
void dispatchOnActorDelete ()
 Calls all the onActorDelete() of all the ActorEventCallback installed on this Actor.
void setScissor (Scissor *scissor)
 Sets the Scissor to be used when rendering an Actor.
const Scissorscissor () const
 Returns the Scissor used when rendering an Actor.
Scissorscissor ()
 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
ref< EffectmEffect
ref< RenderablemRenderables [VL_MAX_ACTOR_LOD]
ref< TransformmTransform
ref< LODEvaluatormLODEvaluator
ref< UniformSetmUniformSet
ref< ScissormScissor
Collection< ActorEventCallbackmActorEventCallbacks
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:
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

Definition at line 129 of file Actor.hpp.


Constructor & Destructor Documentation

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

Constructor.

Parameters:
renderableA Renderable defining the Actor's LOD level #0
effectThe Effect to be used by the Actor
transformThe Transform to be used by the Actor
blockThe rendering block to which the Actor belongs
rankThe rendering rank to which the Actor belongs

Definition at line 141 of file Actor.hpp.

References VL_DEBUG_SET_OBJECT_NAME.

Actor::~Actor (  ) [virtual]

Destructor.

Definition at line 39 of file Actor.cpp.

References deleteOcclusionQuery(), and dispatchOnActorDelete().


Member Function Documentation

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

Returns the name of the class.

Reimplemented from vl::Object.

Definition at line 132 of file Actor.hpp.

void vl::Actor::setLod ( int  lod_index,
Renderable renderable 
) [inline]

Sets the Renderable object representing the LOD level specifed by lod_index.

Definition at line 158 of file Actor.hpp.

Referenced by vl::SlicedVolume::bindActor(), vl::RaycastVolume::bindActor(), vl::MorphingCallback::bindActor(), and setLODs().

const ref<Renderable>& vl::Actor::lod ( int  lod_index ) const [inline]
void Actor::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.

Definition at line 45 of file Actor.cpp.

References setLod(), VL_CHECK, and VL_MAX_ACTOR_LOD.

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

Binds a Transform to an Actor.

Definition at line 178 of file Actor.hpp.

Referenced by vl::VectorGraphics::drawActor().

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

Returns the Transform bound tho an Actor.

Definition at line 189 of file Actor.hpp.

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

Binds an Effect to an Actor.

Definition at line 192 of file Actor.hpp.

Referenced by vl::VectorGraphics::drawActor().

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

Returns the Effect bound to an Actor.

Definition at line 195 of file Actor.hpp.

Referenced by vl::VectorGraphics::drawActor(), and vl::Rendering::fillRenderQueue().

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

Returns the Effect bound to an Actor.

Definition at line 198 of file Actor.hpp.

const AABB& vl::Actor::boundingBox (  ) const [inline]
const Sphere& vl::Actor::boundingSphere (  ) const [inline]

Returns the bounding sphere (not guaranteed to be up to date) that contains this Actor.

See also:
boundingSphereSafe()

Definition at line 204 of file Actor.hpp.

Referenced by vl::SceneManager::computeBounds(), and vl::Rendering::render().

const AABB& vl::Actor::boundingBoxSafe (  ) [inline]

Returns the bounding box (guaranteed to be up to date) that contains this Actor.

See also:
boundingBox()

Definition at line 207 of file Actor.hpp.

const Sphere& vl::Actor::boundingSphereSafe (  ) [inline]

Returns the bounding sphere (guaranteed to be up to date) that contains this Actor.

See also:
boundingSphere()

Definition at line 210 of file Actor.hpp.

void Actor::computeBounds (  )
bool Actor::boundsDirty (  ) const

Returns whether the Actor's bounding box and sphere are up to date.

Definition at line 84 of file Actor.cpp.

References lod(), mBoundsUpdateTick, mTransformUpdateTick, transform(), and vl::Transform::worldMatrixUpdateTick().

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()

Definition at line 227 of file Actor.hpp.

Referenced by vl::SceneManagerVectorGraphics::extractActors().

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()

Definition at line 239 of file Actor.hpp.

int vl::Actor::renderRank (  ) const [inline]
int vl::Actor::renderBlock (  ) const [inline]
void vl::Actor::setLODEvaluator ( LODEvaluator lod_evaluator ) [inline]

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

Definition at line 248 of file Actor.hpp.

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

Returns the installed LODEvaluator (if any) or NULL.

Definition at line 251 of file Actor.hpp.

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

Returns the installed LODEvaluator (if any) or NULL.

Definition at line 254 of file Actor.hpp.

int Actor::evaluateLOD ( Camera camera )

Definition at line 55 of file Actor.cpp.

References mLODEvaluator.

Referenced by vl::Rendering::fillRenderQueue().

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

The enable mask of an Actor is usually used to defines whether the actor should be rendered or not depending on the Rendering::enableMask() but it can also be used for user-specific tasks.

Definition at line 260 of file Actor.hpp.

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

The enable mask of an Actor is usually used to defines whether the actor should be rendered or not depending on the Rendering::enableMask() but it can also be used for user-specific tasks.

Definition at line 264 of file Actor.hpp.

Referenced by vl::ActorTreeAbstract::extractVisibleActors(), vl::Rendering::fillRenderQueue(), vl::SceneManager::isEnabled(), vl::Renderer::render(), vl::EdgeRenderer::render(), vl::OcclusionCullRenderer::render_pass1(), and vl::OcclusionCullRenderer::render_pass2().

void Actor::setUniform ( Uniform uniform )

Equivalent to getUniformSet()->setUniform(uniform)

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

Definition at line 118 of file Actor.cpp.

References gocUniformSet(), and vl::UniformSet::setUniform().

const std::vector< ref< Uniform > > & Actor::uniforms (  ) const

Equivalent to getUniformSet()->uniforms()

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

Definition at line 120 of file Actor.cpp.

References getUniformSet(), and vl::UniformSet::uniforms().

std::vector< ref< Uniform > > & Actor::uniforms (  )

Equivalent to gocUniformSet()->uniforms()

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

Definition at line 122 of file Actor.cpp.

References gocUniformSet(), and vl::UniformSet::uniforms().

void Actor::eraseUniform ( const std::string &  name )

Equivalent to getUniformSet()->eraseUniform(name)

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

Definition at line 124 of file Actor.cpp.

References vl::UniformSet::eraseUniform(), and getUniformSet().

void Actor::eraseUniform ( const Uniform uniform )

Equivalent to getUniformSet()->eraseUniform(uniform)

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

Definition at line 126 of file Actor.cpp.

References vl::UniformSet::eraseUniform(), and getUniformSet().

void Actor::eraseAllUniforms (  )

Equivalent to getUniformSet()->eraseAllUniforms()

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

Definition at line 128 of file Actor.cpp.

References vl::UniformSet::eraseAllUniforms(), and getUniformSet().

Uniform * Actor::gocUniform ( const std::string &  name )

Equivalent to getUniformSet()->getUniform(name, get_mode)

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

Definition at line 130 of file Actor.cpp.

References vl::UniformSet::gocUniform(), and gocUniformSet().

Referenced by vl::SlicedVolume::updateUniforms(), and vl::RaycastVolume::updateUniforms().

Uniform * Actor::getUniform ( const std::string &  name )

Equivalent to getUniformSet()->getUniform(name, get_mode)

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

Definition at line 132 of file Actor.cpp.

References vl::UniformSet::getUniform(), and getUniformSet().

const Uniform * Actor::getUniform ( const std::string &  name ) const

Equivalent to getUniformSet()->getUniform(name, get_mode)

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

Definition at line 134 of file Actor.cpp.

References vl::UniformSet::getUniform(), and getUniformSet().

void vl::Actor::setUniformSet ( UniformSet uniforms ) [inline]
const UniformSet* vl::Actor::getUniformSet (  ) const [inline]
UniformSet* vl::Actor::getUniformSet (  ) [inline]
UniformSet* vl::Actor::gocUniformSet (  ) [inline]
const Collection<ActorEventCallback>* vl::Actor::actorEventCallbacks (  ) const [inline]

Returns the list of ActorEventCallback bound to an Actor.

Definition at line 357 of file Actor.hpp.

Referenced by vl::SlicedVolume::bindActor(), vl::RaycastVolume::bindActor(), and vl::MorphingCallback::bindActor().

Collection<ActorEventCallback>* vl::Actor::actorEventCallbacks (  ) [inline]

Returns the list of ActorEventCallback bound to an Actor.

Definition at line 360 of file Actor.hpp.

void vl::Actor::dispatchOnActorRenderStarted ( Real  frame_clock,
const Camera camera,
Renderable renderable,
const Shader shader,
int  pass 
) [inline]

Calls all the onActorRenderStarted() of all the ActorEventCallback installed on this Actor.

Definition at line 363 of file Actor.hpp.

References vl::ActorEventCallback::isEnabled(), and vl::ActorEventCallback::onActorRenderStarted().

Referenced by vl::Renderer::render().

void vl::Actor::dispatchOnActorDelete (  ) [inline]

Calls all the onActorDelete() of all the ActorEventCallback installed on this Actor.

Definition at line 374 of file Actor.hpp.

References vl::ActorEventCallback::onActorDelete().

Referenced by ~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:

Definition at line 391 of file Actor.hpp.

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

Returns the Scissor used when rendering an Actor.

See also:

Definition at line 398 of file Actor.hpp.

Referenced by vl::Renderer::render(), and vl::OcclusionCullRenderer::render_pass2().

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

Returns the Scissor used when rendering an Actor.

See also:

Definition at line 406 of file Actor.hpp.

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.

Definition at line 410 of file Actor.hpp.

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.

Definition at line 414 of file Actor.hpp.

Referenced by vl::OcclusionCullRenderer::render_pass2().

void Actor::createOcclusionQuery (  )

For internal use only.

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

Definition at line 63 of file Actor.cpp.

References mOcclusionQuery, VL_CHECK, and VL_CHECK_OGL.

Referenced by vl::OcclusionCullRenderer::render_pass2().

void Actor::deleteOcclusionQuery (  )

For internal use only.

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

Definition at line 72 of file Actor.cpp.

References mOcclusionQuery.

Referenced by ~Actor().

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.

Definition at line 426 of file Actor.hpp.

Referenced by vl::OcclusionCullRenderer::render_pass1(), and vl::OcclusionCullRenderer::render_pass2().

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

For internal use only.

Definition at line 429 of file Actor.hpp.

Referenced by vl::OcclusionCullRenderer::render_pass2().

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

For internal use only.

Definition at line 432 of file Actor.hpp.

Referenced by vl::OcclusionCullRenderer::render_pass1().


Member Data Documentation

AABB vl::Actor::mAABB [protected]

Definition at line 445 of file Actor.hpp.

Referenced by computeBounds().

Definition at line 446 of file Actor.hpp.

Referenced by computeBounds().

Definition at line 447 of file Actor.hpp.

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

Definition at line 448 of file Actor.hpp.

Definition at line 449 of file Actor.hpp.

Definition at line 450 of file Actor.hpp.

Referenced by evaluateLOD().

Definition at line 451 of file Actor.hpp.

Definition at line 452 of file Actor.hpp.

Definition at line 453 of file Actor.hpp.

int vl::Actor::mRenderBlock [protected]

Definition at line 454 of file Actor.hpp.

int vl::Actor::mRenderRank [protected]

Definition at line 455 of file Actor.hpp.

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

Definition at line 456 of file Actor.hpp.

Referenced by boundsDirty(), and computeBounds().

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

Definition at line 457 of file Actor.hpp.

Referenced by boundsDirty(), and computeBounds().

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

Definition at line 458 of file Actor.hpp.

GLuint vl::Actor::mOcclusionQuery [protected]

Definition at line 459 of file Actor.hpp.

Referenced by createOcclusionQuery(), and deleteOcclusionQuery().

bool vl::Actor::mIsOccludee [protected]

Definition at line 460 of file Actor.hpp.

unsigned vl::Actor::mOcclusionQueryTick [protected]

Definition at line 461 of file Actor.hpp.


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

Visualization Library v2011.05.1144 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Tue Sep 13 2011 21:59:10.
Permission is granted to use this page to write and publish articles regarding Visualization Library.