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:

vl::Object vl::MorphingActor vlVolume::SlicedVolume

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.
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 SphereboundingSphere () const
 Returns the bounding sphere that contains this Actor taking into consideration also its Transform.
const AABBboundingBox () 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.
LODEvaluatorlodEvaluator ()
 Returns the installed LODEvaluator (if any) or NULL.
const LODEvaluatorlodEvaluator () 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().
UniformgocUniform (const std::string &name)
 Equivalent to uniformSet()->getUniform(name, get_mode).
UniformgetUniform (const std::string &name)
 Equivalent to uniformSet()->getUniform(name, get_mode).
const UniformgetUniform (const std::string &name) const
 Equivalent to uniformSet()->getUniform(name, get_mode).
void setUniformSet (UniformSet *uniforms)
 Installs a new UniformSet.
UniformSetuniformSet () 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 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
Real mLastUpdateTime
ref< EffectmEffect
ref< RenderablemRenderables [VL_MAX_ACTOR_LOD]
ref< TransformmTransform
ref< LODEvaluatormLODEvaluator
ref< UniformSetmUniformSet
ref< ScissormScissor
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:

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 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.

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:

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]

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

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:

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

Returns the Scissor used when rendering an Actor.

See also:

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

Returns the Scissor used when rendering an Actor.

See also:

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]

Reimplemented in vlVolume::SlicedVolume.

ref<Renderable> vl::Actor::mRenderables[VL_MAX_ACTOR_LOD] [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:

Visualization Library v2010.06 Reference Documentation
Copyright 2005-2009 Michele Bosi. All rights reserved.
Updated on Tue Jun 1 00:57:12 2010.
Permission is granted to use this page to write and publish articles regarding Visualization Library.