Visualization Library 2.1.0

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 | List of all members
vl::Effect Class Reference

Defines the sequence of Shader objects used to render an Actor. More...

#include <Effect.hpp>

+ Inheritance diagram for vl::Effect:

Public Member Functions

 Effect ()
 Constructor. More...
 
ref< EffectshallowCopy (EShaderCopyMode shader_copy) const
 
EffectshallowCopyFrom (const Effect &other, EShaderCopyMode shader_copy)
 
ref< EffectdeepCopy () const
 
EffectdeepCopyFrom (const Effect &other)
 
void setRenderRank (int rank)
 Modifies the rendering rank of an Actor. More...
 
int renderRank () const
 Returns the rendering rank of an Effect. More...
 
const ref< ShaderPasses > & lod (int lod_level) const
 Returns the ShaderPasses representing the specified LOD level. More...
 
ref< ShaderPasses > & lod (int lod_level)
 Returns the ShaderPasses representing the specified LOD level. More...
 
Shadershader (int lodi=0, int pass=0)
 Utility function, same as 'lod(lodi)->at(pass);'. More...
 
const Shadershader (int lodi=0, int pass=0) const
 Utility function, same as 'lod(lodi)->at(pass);'. More...
 
void setLOD (int lodi, Shader *shader1, Shader *shader2=NULL, Shader *shader3=NULL, Shader *shader4=NULL)
 Utility function, same as 'lod(lodi) = new ShaderPasses(shader1,shader2,shader3,shader4);'. More...
 
void setLODEvaluator (LODEvaluator *lod_evaluator)
 Installs the LODEvaluator used to compute the current LOD at rendering time. More...
 
LODEvaluatorlodEvaluator ()
 Returns the installed LODEvaluator (if any) or NULL. More...
 
const LODEvaluatorlodEvaluator () const
 Returns the installed LODEvaluator (if any) or NULL. More...
 
void setEnableMask (unsigned int mask)
 The enable mask of an Actor's Effect defines whether the actor should be rendered or not depending on the Rendering::enableMask(). More...
 
unsigned int enableMask () const
 The enable mask of an Actor's Effect defines whether the actor should be rendered or not depending on the Rendering::enableMask(). More...
 
int evaluateLOD (Actor *actor, Camera *camera)
 If a LODEvaluator is installed computes the effect LOD to be used otherwise returns 0. More...
 
void setActiveLod (int lod)
 Sets the lod to be used for rendering. More...
 
int activeLod () const
 Returns the lod to be used for rendering. 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...
 
Objectoperator= (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...
 
IMutexrefCountMutex ()
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
const IMutexrefCountMutex () 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...
 

Protected Attributes

ref< ShaderPassesmLODShaders [VL_MAX_EFFECT_LOD]
 
ref< LODEvaluatormLODEvaluator
 
int mActiveLod
 
int mRenderRank
 
unsigned int mEnableMask
 
- Protected Attributes inherited from vl::Object
std::string mObjectName
 
IMutexmRefCountMutex
 
int mReferenceCount
 
bool mAutomaticDelete
 

Additional Inherited Members

- Protected Member Functions inherited from vl::Object
virtual ~Object ()
 

Detailed Description

Defines the sequence of Shader objects used to render an Actor.

Typically an Effect will have only one LOD (level of detail) with 1 pass (i.e. 1 Shader) but you can specify multiple LODs each of which defines its own set of Shader[s].

When a LOD has more than one Shader the Actor is rendered several times, once for each Shader. This technique is called multipass rendering.

The LOD to be used during the rendering is defined at rendering time if a LODEvaluator has been installed using the method setLODEvaluator(), otherwise the LOD #0 is selected.

See also
Shader, Actor, LODEvaluator, ShaderPasses

Definition at line 91 of file Effect.hpp.

Constructor & Destructor Documentation

◆ Effect()

vl::Effect::Effect ( )
inline

Constructor.

Definition at line 101 of file Effect.hpp.

References vl::ShaderPasses::ShaderPasses().

Member Function Documentation

◆ activeLod()

int vl::Effect::activeLod ( ) const
inline

Returns the lod to be used for rendering.

Definition at line 217 of file Effect.hpp.

Referenced by vlX::VLXClassWrapper_Effect::exportEffect().

◆ deepCopy()

ref<Effect> vl::Effect::deepCopy ( ) const
inline

Definition at line 139 of file Effect.hpp.

◆ deepCopyFrom()

Effect& vl::Effect::deepCopyFrom ( const Effect other)
inline

Definition at line 146 of file Effect.hpp.

References vl::SCM_ShareShaders.

◆ enableMask()

unsigned int vl::Effect::enableMask ( ) const
inline

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

Definition at line 203 of file Effect.hpp.

Referenced by vlX::VLXClassWrapper_Effect::exportEffect(), and vl::Rendering::fillRenderQueue().

◆ evaluateLOD()

int Effect::evaluateLOD ( Actor actor,
Camera camera 
)

If a LODEvaluator is installed computes the effect LOD to be used otherwise returns 0.

Definition at line 44 of file Effect.cpp.

References mActiveLod, mLODEvaluator, and VL_CHECK.

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

◆ lod() [1/2]

const ref<ShaderPasses>& vl::Effect::lod ( int  lod_level) const
inline

Returns the ShaderPasses representing the specified LOD level.

Note
It must be: 0 <= lod_level < VL_MAX_EFFECT_LOD.

Definition at line 171 of file Effect.hpp.

Referenced by vlX::VLXClassWrapper_Effect::exportEffect(), vl::Rendering::fillRenderQueue(), and vlX::VLXClassWrapper_Effect::importEffect().

◆ lod() [2/2]

ref<ShaderPasses>& vl::Effect::lod ( int  lod_level)
inline

Returns the ShaderPasses representing the specified LOD level.

Note
It must be: 0 <= lod_level < VL_MAX_EFFECT_LOD.

Definition at line 175 of file Effect.hpp.

◆ lodEvaluator() [1/2]

LODEvaluator* vl::Effect::lodEvaluator ( )
inline

Returns the installed LODEvaluator (if any) or NULL.

Definition at line 194 of file Effect.hpp.

Referenced by vlX::VLXClassWrapper_Effect::exportEffect().

◆ lodEvaluator() [2/2]

const LODEvaluator* vl::Effect::lodEvaluator ( ) const
inline

Returns the installed LODEvaluator (if any) or NULL.

Definition at line 197 of file Effect.hpp.

◆ renderRank()

int vl::Effect::renderRank ( ) const
inline

Returns the rendering rank of an Effect.

Definition at line 167 of file Effect.hpp.

Referenced by vlX::VLXClassWrapper_Effect::exportEffect(), and vl::Rendering::fillRenderQueue().

◆ setActiveLod()

void vl::Effect::setActiveLod ( int  lod)
inline

Sets the lod to be used for rendering.

It must be: 0 <= lod < VL_MAX_EFFECT_LOD.

Definition at line 209 of file Effect.hpp.

References VL_CHECK.

Referenced by vlX::VLXClassWrapper_Effect::importEffect().

◆ setEnableMask()

void vl::Effect::setEnableMask ( unsigned int  mask)
inline

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

Definition at line 200 of file Effect.hpp.

Referenced by vlX::VLXClassWrapper_Effect::importEffect().

◆ setLOD()

void vl::Effect::setLOD ( int  lodi,
Shader shader1,
Shader shader2 = NULL,
Shader shader3 = NULL,
Shader shader4 = NULL 
)
inline

Utility function, same as 'lod(lodi) = new ShaderPasses(shader1,shader2,shader3,shader4);'.

Definition at line 184 of file Effect.hpp.

References vl::ShaderPasses::ShaderPasses(), and VL_CHECK.

◆ setLODEvaluator()

void vl::Effect::setLODEvaluator ( LODEvaluator lod_evaluator)
inline

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

Definition at line 191 of file Effect.hpp.

Referenced by vlX::VLXClassWrapper_Effect::importEffect().

◆ setRenderRank()

void vl::Effect::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
Actor::setRenderRank(), Actor::setRenderBlock()

Definition at line 164 of file Effect.hpp.

Referenced by vlX::VLXClassWrapper_Effect::importEffect().

◆ shader() [1/2]

Shader* vl::Effect::shader ( int  lodi = 0,
int  pass = 0 
)
inline

◆ shader() [2/2]

const Shader* vl::Effect::shader ( int  lodi = 0,
int  pass = 0 
) const
inline

Utility function, same as 'lod(lodi)->at(pass);'.

Definition at line 181 of file Effect.hpp.

◆ shallowCopy()

ref<Effect> vl::Effect::shallowCopy ( EShaderCopyMode  shader_copy) const
inline

Definition at line 110 of file Effect.hpp.

◆ shallowCopyFrom()

Effect& vl::Effect::shallowCopyFrom ( const Effect other,
EShaderCopyMode  shader_copy 
)
inline

Definition at line 117 of file Effect.hpp.

References mActiveLod, mEnableMask, mLODEvaluator, mLODShaders, mRenderRank, and vl::SCM_OwnShaders.

Member Data Documentation

◆ mActiveLod

int vl::Effect::mActiveLod
protected

Definition at line 222 of file Effect.hpp.

Referenced by evaluateLOD(), and shallowCopyFrom().

◆ mEnableMask

unsigned int vl::Effect::mEnableMask
protected

Definition at line 224 of file Effect.hpp.

Referenced by shallowCopyFrom().

◆ mLODEvaluator

ref<LODEvaluator> vl::Effect::mLODEvaluator
protected

Definition at line 221 of file Effect.hpp.

Referenced by evaluateLOD(), and shallowCopyFrom().

◆ mLODShaders

ref<ShaderPasses> vl::Effect::mLODShaders[VL_MAX_EFFECT_LOD]
protected

Definition at line 220 of file Effect.hpp.

Referenced by shallowCopyFrom().

◆ mRenderRank

int vl::Effect::mRenderRank
protected

Definition at line 223 of file Effect.hpp.

Referenced by shallowCopyFrom().


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