# osgFX::Effect Class Reference

The base class for special effects. More...

Inheritance diagram for osgFX::Effect:

[legend]
List of all members.

## Public Types

enum | TechniqueSelection { AUTO_DETECT = -1 }

## Public Member Functions

| Effect ()
| Effect (const Effect &copy, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
virtual bool | isSameKindAs (const osg::Object *obj) const
virtual const char * | libraryName () const
| return the name of the node's library.
virtual const char * | className () const
| return the name of the node's class type.
virtual const char * | effectName () const =0
| get the name of this effect
virtual const char * | effectDescription () const =0
| get a brief description of this effect
virtual const char * | effectAuthor () const =0
| get the effect author's name
bool | getEnabled () const
| get whether the effect is enabled or not
void | setEnabled (bool v)
| set whether the effect is enabled or not
virtual void | setUpDemo ()
| optional: set effect parameters to produce a visually significant result to be used in demo applications like osgfxbrowser.
int | getNumTechniques () const
| get the number of techniques defined for this effect
Technique * | getTechnique (int i)
| get the i-th technique
const Technique * | getTechnique (int i) const
| get the i-th const technique
int | getSelectedTechnique () const
| get the index of the currently selected technique
void | selectTechnique (int i=AUTO_DETECT)
| select a technique or enable automatic detection
virtual void | traverse (osg::NodeVisitor &nv)
| custom traversal
void | inherited_traverse (osg::NodeVisitor &nv)
| default traversal

## Protected Member Functions

virtual | ~Effect ()
Effect & | operator= (const Effect &)
void | dirtyTechniques ()
| force rebuilding of techniques on next traversal
void | addTechnique (Technique *tech)
| add a technique to the effect
virtual bool | define_techniques ()=0
| abstract method to be implemented in derived classes; its purpose if to create the techniques that can be used for obtaining the desired effect.

## Friends

class | Validator

## Detailed Description

The base class for special effects.

An effect is basically a collection of state attributes and an interface for configuring them in a predefined fashion. The Effect class does more however, as it handles multipass rendering transparently and it allows more than one "technique" to be defined. Each technique tries to implement the effect in a different way, often using different OpenGL extensions. The active technique can be selected either manually, with selectTechnique(), or automatically, in which case the first technique that is supported by all active rendering contexts is chosen. If you are an Effect user, then simply use it as a node group. Create an instance of your desired effect, add it to your scene graph and call its addChild() method to add a child node as you would do with a Group. If you are an Effect developer, you will have to implement the method define_techniques() to define the different techniques that can be used for obtaining the desired effect. In define_techniques() you will usually create one or more instances of custom classes derived from Technique and you will add them to the effect with addTechnique(). The order is important: techniques added first will have higher priority and will be used first as soon as all rendering contexts support it.

## Member Enumeration Documentation

enum osgFX::Effect::TechniqueSelection

Enumeration values:

  AUTO_DETECT |

## Constructor & Destructor Documentation

Effect::Effect | ( |  | ) |

Effect::Effect | ( | const Effect & | copy,
|  | const osg::CopyOp & | copyop = `osg::CopyOp::SHALLOW_COPY`
| ) |

Effect::~Effect | ( |  | ) | `[protected, virtual]`

## Member Function Documentation

void osgFX::Effect::addTechnique | ( | Technique * | tech | ) | `[inline, protected]`

| add a technique to the effect

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

| return the name of the node's class type. Reimplemented from osg::Node.

virtual bool osgFX::Effect::define_techniques | ( |  | ) | `[protected, pure virtual]`

| abstract method to be implemented in derived classes; its purpose if to create the techniques that can be used for obtaining the desired effect. You will usually call addTechnique() inside this method. Implemented in osgFX::AnisotropicLighting, osgFX::BumpMapping, osgFX::Cartoon, osgFX::Scribe, and osgFX::SpecularHighlights.

void osgFX::Effect::dirtyTechniques | ( |  | ) | `[inline, protected]`

| force rebuilding of techniques on next traversal

virtual const char* osgFX::Effect::effectAuthor | ( |  | ) | const`[pure virtual]`

| get the effect author's name

virtual const char* osgFX::Effect::effectDescription | ( |  | ) | const`[pure virtual]`

| get a brief description of this effect

virtual const char* osgFX::Effect::effectName | ( |  | ) | const`[pure virtual]`

| get the name of this effect

bool osgFX::Effect::getEnabled | ( |  | ) | const`[inline]`

| get whether the effect is enabled or not

int osgFX::Effect::getNumTechniques | ( |  | ) | const`[inline]`

| get the number of techniques defined for this effect

int osgFX::Effect::getSelectedTechnique | ( |  | ) | const`[inline]`

| get the index of the currently selected technique

const Technique * osgFX::Effect::getTechnique | ( | int | i | ) | const`[inline]`

| get the i-th const technique

Technique * osgFX::Effect::getTechnique | ( | int | i | ) | `[inline]`

| get the i-th technique

void osgFX::Effect::inherited_traverse | ( | osg::NodeVisitor & | nv | ) | `[inline]`

| default traversal

virtual bool osgFX::Effect::isSameKindAs | ( | const osg::Object * | obj | ) | const`[inline, virtual]`

virtual const char* osgFX::Effect::libraryName | ( |  | ) | const`[inline, virtual]`

| return the name of the node's library. Reimplemented from osg::Node.

Effect& osgFX::Effect::operator= | ( | const Effect & |  | ) | `[inline, protected]`

void osgFX::Effect::selectTechnique | ( | int | i = `AUTO_DETECT` | ) | `[inline]`

| select a technique or enable automatic detection

void osgFX::Effect::setEnabled | ( | bool | v | ) | `[inline]`

| set whether the effect is enabled or not

virtual void osgFX::Effect::setUpDemo | ( |  | ) | `[inline, virtual]`

| optional: set effect parameters to produce a visually significant result to be used in demo applications like osgfxbrowser. Default is to do nothing. Reimplemented in osgFX::BumpMapping.

void Effect::traverse | ( | osg::NodeVisitor & | nv | ) | `[virtual]`

| custom traversal

## Friends And Related Function Documentation

friend class Validator `[friend]`

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

- Effect
- Effect.cpp