Visualization Library v1.0.3

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [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

 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 Renderablelod (int lod_index) const
 Returns the Renderable object representing the LOD level specifed by lod_index.
Renderablelod (int lod_index)
 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 (set to 0xFFFFFFFF by default).
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 (set to 0xFFFFFFFF by default).
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 char *name)
 Equivalent to getUniformSet()->eraseUniform(name)
void eraseUniform (const Uniform *uniform)
 Equivalent to getUniformSet()->eraseUniform(uniform)
void eraseAllUniforms ()
 Equivalent to getUniformSet()->eraseAllUniforms()
UniformgocUniform (const char *name)
 Equivalent to getUniformSet()->getUniform(name, get_mode)
UniformgetUniform (const char *name)
 Equivalent to getUniformSet()->getUniform(name, get_mode)
const UniformgetUniform (const char *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
unsigned mOcclusionQueryTick
bool mIsOccludee

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 131 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 143 of file Actor.hpp.

References NULL, and VL_DEBUG_SET_OBJECT_NAME.

Actor::~Actor (  ) [virtual]

Destructor.

Definition at line 39 of file Actor.cpp.

References deleteOcclusionQuery(), and dispatchOnActorDelete().


Member Function Documentation

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 160 of file Actor.hpp.

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

const Renderable* vl::Actor::lod ( int  lod_index ) const [inline]
Renderable* vl::Actor::lod ( int  lod_index ) [inline]

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

Definition at line 177 of file Actor.hpp.

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 183 of file Actor.hpp.

Referenced by vl::VectorGraphics::drawActor(), and vl::VLXClassWrapper_Actor::importActor().

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

Returns the Transform bound tho an Actor.

Definition at line 194 of file Actor.hpp.

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

Returns the Effect bound to an Actor.

Definition at line 203 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 209 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 212 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 215 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 vl::Renderable::boundsDirty(), vl::Renderable::boundsUpdateTick(), 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 232 of file Actor.hpp.

Referenced by vl::SceneManagerVectorGraphics::extractActors(), and vl::VLXClassWrapper_Actor::importActor().

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 244 of file Actor.hpp.

Referenced by vl::VLXClassWrapper_Actor::importActor().

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 253 of file Actor.hpp.

Referenced by vl::VLXClassWrapper_Actor::importActor().

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

Returns the installed LODEvaluator (if any) or NULL.

Definition at line 256 of file Actor.hpp.

Referenced by vl::VLXClassWrapper_Actor::exportActor().

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

Returns the installed LODEvaluator (if any) or NULL.

Definition at line 259 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 (set to 0xFFFFFFFF by default).

See also vl::Rendering::effectOverrideMask() and vl::Renderer::shaderOverrideMask().

Definition at line 266 of file Actor.hpp.

Referenced by vl::VLXClassWrapper_Actor::importActor().

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 (set to 0xFFFFFFFF by default).

See also vl::Rendering::effectOverrideMask() and vl::Renderer::shaderOverrideMask().

Definition at line 271 of file Actor.hpp.

Referenced by vl::VLXClassWrapper_Actor::exportActor(), 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().

Referenced by vl::VLXClassWrapper_Actor::importActor().

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

Referenced by vl::VLXClassWrapper_Actor::exportActor().

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 char *  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 char *  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 char *  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(), getUniformSet(), and NULL.

const Uniform * Actor::getUniform ( const char *  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(), getUniformSet(), and NULL.

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]
Collection<ActorEventCallback>* vl::Actor::actorEventCallbacks (  ) [inline]

Returns the list of ActorEventCallback bound to an Actor.

Definition at line 367 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 370 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 381 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 398 of file Actor.hpp.

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

Returns the Scissor used when rendering an Actor.

See also:

Definition at line 405 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 413 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 417 of file Actor.hpp.

Referenced by vl::VLXClassWrapper_Actor::importActor().

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 421 of file Actor.hpp.

Referenced by vl::VLXClassWrapper_Actor::exportActor(), and 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 vl::Has_Occlusion_Query, 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 vl::Has_Occlusion_Query, and 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 433 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 436 of file Actor.hpp.

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

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

For internal use only.

Definition at line 439 of file Actor.hpp.

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


Member Data Documentation

AABB vl::Actor::mAABB [protected]

Definition at line 452 of file Actor.hpp.

Referenced by computeBounds().

Definition at line 453 of file Actor.hpp.

Referenced by computeBounds().

Definition at line 454 of file Actor.hpp.

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

Definition at line 455 of file Actor.hpp.

Definition at line 456 of file Actor.hpp.

Definition at line 457 of file Actor.hpp.

Referenced by evaluateLOD().

Definition at line 458 of file Actor.hpp.

Definition at line 459 of file Actor.hpp.

Definition at line 460 of file Actor.hpp.

int vl::Actor::mRenderBlock [protected]

Definition at line 461 of file Actor.hpp.

int vl::Actor::mRenderRank [protected]

Definition at line 462 of file Actor.hpp.

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

Definition at line 463 of file Actor.hpp.

Referenced by boundsDirty(), and computeBounds().

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

Definition at line 464 of file Actor.hpp.

Referenced by boundsDirty(), and computeBounds().

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

Definition at line 465 of file Actor.hpp.

GLuint vl::Actor::mOcclusionQuery [protected]

Definition at line 466 of file Actor.hpp.

Referenced by createOcclusionQuery(), and deleteOcclusionQuery().

unsigned vl::Actor::mOcclusionQueryTick [protected]

Definition at line 467 of file Actor.hpp.

bool vl::Actor::mIsOccludee [protected]

Definition at line 468 of file Actor.hpp.


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

Visualization Library v1.0.3 Reference Documentation
Copyright Michele Bosi. All rights reserved.
Updated on Tue Feb 7 2017 00:55:08.
Permission is granted to use this page to write and publish articles regarding Visualization Library.