OpenSceneGraph 3.6.5
osgFX::Technique Class Referenceabstract

This is the base class for effect techniques. More...

#include <Technique>

Inheritance diagram for osgFX::Technique:

Public Member Functions

 Technique ()
virtual const char * techniqueName ()
 get the name of this Technique
virtual const char * techniqueDescription ()
 get a brief description of this Technique
virtual void getRequiredExtensions (std::vector< std::string > &) const
 collect the GL extension strings which are required for this technique to work properly.
virtual bool validate (osg::State &) const
 tests whether this technique is valid for the current rendering context.
int getNumPasses () const
 get the number of rendering passes defined in this Technique
osg::StateSetgetPassStateSet (int i)
 get the StateSet object associated to the i-th pass
const osg::StateSetgetPassStateSet (int i) const
 get the const StateSet object associated to the i-th pass
virtual void traverse (osg::NodeVisitor &nv, Effect *fx)
 traverse children with multipass if necessary.
Public Member Functions inherited from osg::Referenced
 Referenced ()
 Referenced (bool threadSafeRefUnref)
 Deprecated, Referenced is now always uses thread safe ref/unref, use default Referenced() constructor instead.
 Referenced (const Referenced &)
Referencedoperator= (const Referenced &)
virtual void setThreadSafeRefUnref (bool)
 Deprecated, Referenced is always theadsafe so there method now has no effect and does not need to be called.
bool getThreadSafeRefUnref () const
 Get whether a mutex is used to ensure ref() and unref() are thread safe.
OpenThreads::Mutex * getRefMutex () const
 Get the mutex used to ensure thread safety of ref()/unref().
int ref () const
 Increment the reference count by one, indicating that this object has another pointer which is referencing it.
int unref () const
 Decrement the reference count by one, indicating that a pointer to this object is no longer referencing it.
int unref_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is no longer referencing it.
int referenceCount () const
 Return the number of pointers currently referencing this object.
ObserverSetgetObserverSet () const
 Get the ObserverSet if one is attached, otherwise return NULL.
ObserverSetgetOrCreateObserverSet () const
 Get the ObserverSet if one is attached, otherwise create an ObserverSet, attach it, then return this newly created ObserverSet.
void addObserver (Observer *observer) const
 Add a Observer that is observing this object, notify the Observer when this object gets deleted.
void removeObserver (Observer *observer) const
 Remove Observer that is observing this object.

Protected Member Functions

 Technique (const Technique &)
virtual ~Technique ()
Techniqueoperator= (const Technique &)
void dirtyPasses ()
 force rebuilding of pass nodes on next traversal
void addPass (osg::StateSet *ss=0)
 create a new pass node, add it to the technique and associate a StateSet
virtual osg::NodegetOverrideChild (int)
 optional: return a node that overrides the child node on a specified pass
virtual void define_passes ()=0
 define the rendering passes that make up this technique.
void traverse_implementation (osg::NodeVisitor &nv, Effect *fx)
 traverse children with multipass if necessary.
Protected Member Functions inherited from osg::Referenced
virtual ~Referenced ()
void signalObserversAndDelete (bool signalDelete, bool doDelete) const
void deleteUsingDeleteHandler () const

Additional Inherited Members

Static Public Member Functions inherited from osg::Referenced
static OpenThreads::Mutex * getGlobalReferencedMutex ()
 Get the optional global Referenced mutex, this can be shared between all osg::Referenced.
static void setDeleteHandler (DeleteHandler *handler)
 Set a DeleteHandler to which deletion of all referenced counted objects will be delegated.
static DeleteHandlergetDeleteHandler ()
 Get a DeleteHandler.
Protected Attributes inherited from osg::Referenced
OpenThreads::AtomicPtr _observerSet
OpenThreads::Atomic _refCount

Detailed Description

This is the base class for effect techniques.

A technique represents one of the possible ways to implement a special effect. This base class is abstract, you will have to subclass your own techniques for your custom effects. Derived classes will have to implement the define_passes() method to configure the rendering pass(es) that make up the technique. Usually you will create one StateSet object for each rendering pass and then you'll call addPass(stateset). The validate() method should return true if the technique is valid within the current rendering context, false otherwise. The default implementation of validate() calls getRequiredExtensions() and tests whether all required extensions are supported or not, returning false if at least one extension is not supported.

Constructor & Destructor Documentation

◆ Technique() [1/2]

osgFX::Technique::Technique ( )

Referenced by operator=(), and Technique().

◆ Technique() [2/2]

osgFX::Technique::Technique ( const Technique & )
inlineprotected

◆ ~Technique()

virtual osgFX::Technique::~Technique ( )
inlineprotectedvirtual

Member Function Documentation

◆ addPass()

void osgFX::Technique::addPass ( osg::StateSet * ss = 0)
protected

create a new pass node, add it to the technique and associate a StateSet

◆ define_passes()

virtual void osgFX::Technique::define_passes ( )
protectedpure virtual

define the rendering passes that make up this technique.

You must implement this method in derived classes to add the required passes.

◆ dirtyPasses()

void osgFX::Technique::dirtyPasses ( )
inlineprotected

force rebuilding of pass nodes on next traversal

◆ getNumPasses()

int osgFX::Technique::getNumPasses ( ) const
inline

get the number of rendering passes defined in this Technique

Referenced by validate().

◆ getOverrideChild()

virtual osg::Node * osgFX::Technique::getOverrideChild ( int )
inlineprotectedvirtual

optional: return a node that overrides the child node on a specified pass

◆ getPassStateSet() [1/2]

osg::StateSet * osgFX::Technique::getPassStateSet ( int i)
inline

get the StateSet object associated to the i-th pass

Referenced by validate().

◆ getPassStateSet() [2/2]

const osg::StateSet * osgFX::Technique::getPassStateSet ( int i) const
inline

get the const StateSet object associated to the i-th pass

◆ getRequiredExtensions()

virtual void osgFX::Technique::getRequiredExtensions ( std::vector< std::string > & ) const
inlinevirtual

collect the GL extension strings which are required for this technique to work properly.

This method is called from the default implementation of validate().

◆ operator=()

Technique & osgFX::Technique::operator= ( const Technique & )
inlineprotected

References Technique().

◆ techniqueDescription()

virtual const char * osgFX::Technique::techniqueDescription ( )
inlinevirtual

get a brief description of this Technique

◆ techniqueName()

virtual const char * osgFX::Technique::techniqueName ( )
inlinevirtual

get the name of this Technique

◆ traverse()

void osgFX::Technique::traverse ( osg::NodeVisitor & nv,
Effect * fx )
inlinevirtual

traverse children with multipass if necessary.

By default this method simply calls the protected method traverse_implementation(); you can override it to change the default behavior. Don't call this method directly as it is called by osgFX::Effect

References traverse_implementation().

Referenced by validate().

◆ traverse_implementation()

void osgFX::Technique::traverse_implementation ( osg::NodeVisitor & nv,
Effect * fx )
protected

traverse children with multipass if necessary.

Don't call this method directly unless you are in a customized version of traverse().

Referenced by traverse().

◆ validate()

virtual bool osgFX::Technique::validate ( osg::State & ) const
virtual

tests whether this technique is valid for the current rendering context.

The default behavior is to call getRequiredExtensions() and check for extension availability.

References getNumPasses(), getPassStateSet(), and traverse().


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

osg logo
Generated at Sun Jul 27 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.