# Visualization Library

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

[Home] [Tutorials] [All Classes] [Grouped Classes]

# vl::Effect Class Reference

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

`#include <Effect.hpp>`

Inheritance diagram for vl::Effect:

List of all members.

## Public Member Functions

virtual const char * | className ()
| Returns the name of the class.
| Effect ()
| Constructor.
| ~Effect ()
| Destructor.
void | setRenderRank (int rank)
| Modifies the rendering rank of an Actor.
int | renderRank () const
| Returns the rendering rank of an Effect.
const ref< ShaderSequence > & | lod (int lod_level) const
| Returns the ShaderSequence representing the specified LOD level.
ref< ShaderSequence > & | lod (int lod_level)
| Returns the ShaderSequence representing the specified LOD level.
Shader * | shader (int lodi=0, int pass=0)
| Utility function, same as `'lod`(lodi)->at(pass);'.
const Shader * | shader (int lodi=0, int pass=0) const
| Utility function, same as `'lod`(lodi)->at(pass);'.
void | setLOD (int lodi, Shader *shader1, Shader *shader2=NULL, Shader *shader3=NULL, Shader *shader4=NULL)
| Utility function, same as `'lod`(lodi) = new ShaderSequence(shader1,shader2,shader3,shader4);'.
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.
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().
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().
int | evaluateLOD (Actor *actor, Camera *camera)
| If a LODEvaluator is installed computes the effect LOD to be used otherwise returns 0.

## Protected Attributes

ref< ShaderSequence > | mLODShaders [VL_MAX_EFFECT_LOD]
ref< LODEvaluator > | mLODEvaluator
int | mRenderRank
unsigned int | mEnableMask

## 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, ShaderSequence

## Constructor & Destructor Documentation

vl::Effect::Effect | ( |  | ) | `[inline]`

Constructor.

vl::Effect::~Effect | ( |  | ) | `[inline]`

Destructor.

## Member Function Documentation

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

Returns the name of the class.

Reimplemented from vl::Object.

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

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

Returns the rendering rank of an Effect.

const ref<ShaderSequence>& vl::Effect::lod | ( | int | lod_level | ) | const`[inline]`

Returns the ShaderSequence representing the specified LOD level.

Note:
  lod_index must be < VL_MAX_EFFECT_LOD

ref<ShaderSequence>& vl::Effect::lod | ( | int | lod_level | ) | `[inline]`

Returns the ShaderSequence representing the specified LOD level.

Note:
  lod_index must be < VL_MAX_EFFECT_LOD

Shader* vl::Effect::shader | ( | int | lodi = `0`,
|  | int | pass = `0` |
| ) |  |  | `[inline]`

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

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

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

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 ShaderSequence(shader1,shader2,shader3,shader4);'.

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

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

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

Returns the installed LODEvaluator (if any) or NULL.

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

Returns the installed LODEvaluator (if any) or NULL.

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

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

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

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

## Member Data Documentation

ref<ShaderSequence> vl::Effect::mLODShaders[VL_MAX_EFFECT_LOD]`[protected]`

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

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

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

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

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

Visualization Library v2009.07 Reference Documentation
Copyright 2005-2009 Michele Bosi. All rights reserved.
Updated on Mon Aug 10 21:41:34 2009.
Permission is granted to use this page to write and publish articles regarding Visualization Library.