OpenSceneGraph 3.6.5
osg::StateSet Class Reference

Stores a set of modes and attributes which represent a set of OpenGL state. More...

#include <StateSet>

Inheritance diagram for osg::StateSet:

Classes

struct  Callback

Public Types

enum  RenderingHint { DEFAULT_BIN = 0 , OPAQUE_BIN = 1 , TRANSPARENT_BIN = 2 }
enum  RenderBinMode {
  INHERIT_RENDERBIN_DETAILS =0 , USE_RENDERBIN_DETAILS =1 , OVERRIDE_RENDERBIN_DETAILS =2 , PROTECTED_RENDERBIN_DETAILS =4 ,
  OVERRIDE_PROTECTED_RENDERBIN_DETAILS = OVERRIDE_RENDERBIN_DETAILS|PROTECTED_RENDERBIN_DETAILS
}
typedef std::vector< Node * > ParentList
 A vector of osg::Object pointers which is used to store the parent(s) of this Stateset, the parents could be osg::Node or osg::Drawable.
typedef std::map< StateAttribute::GLMode, StateAttribute::GLModeValueModeList
 a container to map GLModes to their respective GLModeValues.
typedef std::pair< ref_ptr< StateAttribute >, StateAttribute::OverrideValueRefAttributePair
 Simple pairing between an attribute and its override flag.
typedef std::map< StateAttribute::TypeMemberPair, RefAttributePairAttributeList
 a container to map <StateAttribyte::Types,Member> to their respective RefAttributePair.
typedef std::vector< ModeListTextureModeList
typedef std::vector< AttributeListTextureAttributeList
typedef std::pair< ref_ptr< Uniform >, StateAttribute::OverrideValueRefUniformPair
 Simple pairing between a Uniform and its override flag.
typedef std::map< std::string, RefUniformPairUniformList
 a container to map Uniform name to its respective RefUniformPair.
typedef std::pair< std::string, StateAttribute::OverrideValueDefinePair
typedef std::map< std::string, DefinePairDefineList
Public Types inherited from osg::Object
enum  DataVariance { DYNAMIC , STATIC , UNSPECIFIED }

Public Member Functions

 StateSet ()
 StateSet (const StateSet &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
virtual ObjectcloneType () const
 Clone the type of an object, with Object* return type.
virtual Objectclone (const CopyOp &copyop) const
 Clone an object, with Object* return type.
virtual bool isSameKindAs (const Object *obj) const
virtual const char * libraryName () const
 return the name of the object's library.
virtual const char * className () const
 return the name of the object's class type.
int compare (const StateSet &rhs, bool compareAttributeContents=false) const
 return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.
bool operator< (const StateSet &rhs) const
bool operator== (const StateSet &rhs) const
bool operator!= (const StateSet &rhs) const
virtual StateSetasStateSet ()
 Convert 'this' into a StateSet pointer if Object is a StateSet, otherwise return 0.
virtual const StateSetasStateSet () const
 convert 'const this' into a const StateSet pointer if Object is a StateSet, otherwise return 0.
const ParentListgetParents () const
 Get the parent list of this StateSet.
ParentList getParents ()
 Get the a copy of parent list of node.
NodegetParent (unsigned int i)
const NodegetParent (unsigned int i) const
 Get a single const parent of this StateSet.
unsigned int getNumParents () const
 Get the number of parents of this StateSet.
virtual void computeDataVariance ()
 Compute the DataVariance based on an assessment of callback etc.
void setGlobalDefaults ()
 Set all the modes to on or off so that it defines a complete state, typically used for a default global state.
void clear ()
 Clear the StateSet of all modes and attributes.
void merge (const StateSet &rhs)
 Merge this StateSet with the StateSet passed as parameter.
void setMode (StateAttribute::GLMode mode, StateAttribute::GLModeValue value)
 Set this StateSet to contain the specified GLMode with a given value.
void removeMode (StateAttribute::GLMode mode)
 Remove mode from this StateSet.
StateAttribute::GLModeValue getMode (StateAttribute::GLMode mode) const
 Get the value for a given GLMode.
void setModeList (ModeList &ml)
 Set the list of all GLModes contained in this StateSet.
ModeListgetModeList ()
 Return the list of all GLModes contained in this StateSet.
const ModeListgetModeList () const
 Return the const list of all GLModes contained in this const StateSet.
void setAttribute (StateAttribute *attribute, StateAttribute::OverrideValue value=StateAttribute::OFF)
 Set this StateSet to contain specified attribute and override flag.
template<class T>
void setAttribute (const ref_ptr< T > &attribute, StateAttribute::OverrideValue value=StateAttribute::OFF)
void setAttributeAndModes (StateAttribute *attribute, StateAttribute::GLModeValue value=StateAttribute::ON)
 Set this StateSet to contain specified attribute and set the associated GLMode's to specified value.
template<class T>
void setAttributeAndModes (const ref_ptr< T > &attribute, StateAttribute::GLModeValue value=StateAttribute::ON)
void removeAttribute (StateAttribute::Type type, unsigned int member=0)
 remove attribute of specified type from StateSet.
void removeAttribute (StateAttribute *attribute)
 remove attribute from StateSet.
template<class T>
void removeAttribute (const ref_ptr< T > &attribute)
StateAttributegetAttribute (StateAttribute::Type type, unsigned int member=0)
 Get specified StateAttribute for specified type.
const StateAttributegetAttribute (StateAttribute::Type type, unsigned int member=0) const
 Get specified const StateAttribute for specified type.
RefAttributePairgetAttributePair (StateAttribute::Type type, unsigned int member=0)
 Get specified RefAttributePair for specified type.
const RefAttributePairgetAttributePair (StateAttribute::Type type, unsigned int member=0) const
 Get specified RefAttributePair for specified type.
void setAttributeList (AttributeList &al)
 set the list of all StateAttributes contained in this StateSet.
AttributeListgetAttributeList ()
 return the list of all StateAttributes contained in this StateSet.
const AttributeListgetAttributeList () const
 return the const list of all StateAttributes contained in this const StateSet.
void setTextureMode (unsigned int unit, StateAttribute::GLMode mode, StateAttribute::GLModeValue value)
 Set this StateSet to contain specified GLMode with a given value.
void removeTextureMode (unsigned int unit, StateAttribute::GLMode mode)
 Remove texture mode from StateSet.
StateAttribute::GLModeValue getTextureMode (unsigned int unit, StateAttribute::GLMode mode) const
 Get specified GLModeValue for specified GLMode.
void setTextureModeList (TextureModeList &tml)
 set the list of all Texture related GLModes contained in this StateSet.
TextureModeListgetTextureModeList ()
 return the list of all Texture related GLModes contained in this StateSet.
const TextureModeListgetTextureModeList () const
 return the const list of all Texture related GLModes contained in this const StateSet.
unsigned int getNumTextureModeLists () const
 Return the number texture units active in the TextureModeList.
void setTextureAttribute (unsigned int unit, StateAttribute *attribute, StateAttribute::OverrideValue value=StateAttribute::OFF)
 Set this StateSet to contain specified attribute and override flag.
template<class T>
void setTextureAttribute (unsigned int unit, const ref_ptr< T > &attribute, StateAttribute::OverrideValue value=StateAttribute::OFF)
void setTextureAttributeAndModes (unsigned int unit, StateAttribute *attribute, StateAttribute::GLModeValue value=StateAttribute::ON)
 Set this StateSet to contain specified attribute and set the associated GLMode's to specified value.
template<class T>
void setTextureAttributeAndModes (unsigned int unit, const ref_ptr< T > &attribute, StateAttribute::OverrideValue value=StateAttribute::ON)
void removeTextureAttribute (unsigned int unit, StateAttribute::Type type)
 remove texture attribute of specified type from StateSet.
void removeTextureAttribute (unsigned int unit, StateAttribute *attribute)
 remove texture attribute from StateSet.
template<class T>
void removeTextureAttribute (unsigned int unit, const ref_ptr< T > &attribute)
StateAttributegetTextureAttribute (unsigned int unit, StateAttribute::Type type)
 Get specified Texture related StateAttribute for specified type.
const StateAttributegetTextureAttribute (unsigned int unit, StateAttribute::Type type) const
 Get specified Texture related const StateAttribute for specified type.
RefAttributePairgetTextureAttributePair (unsigned int unit, StateAttribute::Type type)
 Get specified Texture related RefAttributePair for specified type.
const RefAttributePairgetTextureAttributePair (unsigned int unit, StateAttribute::Type type) const
 Get specified Texture related RefAttributePair for specified type.
void setTextureAttributeList (TextureAttributeList &tal)
 Set the list of all Texture related StateAttributes contained in this StateSet.
TextureAttributeListgetTextureAttributeList ()
 Return the list of all Texture related StateAttributes contained in this StateSet.
const TextureAttributeListgetTextureAttributeList () const
 Return the const list of all Texture related StateAttributes contained in this const StateSet.
unsigned int getNumTextureAttributeLists () const
 Return the number of texture units active in the TextureAttributeList.
void setAssociatedModes (const StateAttribute *attribute, StateAttribute::GLModeValue value)
void removeAssociatedModes (const StateAttribute *attribute)
void setAssociatedTextureModes (unsigned int unit, const StateAttribute *attribute, StateAttribute::GLModeValue value)
void removeAssociatedTextureModes (unsigned int unit, const StateAttribute *attribute)
void addUniform (Uniform *uniform, StateAttribute::OverrideValue value=StateAttribute::ON)
 Set this StateSet to contain specified uniform and override flag.
template<class T>
void addUniform (const ref_ptr< T > &uniform, StateAttribute::OverrideValue value=StateAttribute::ON)
void removeUniform (const std::string &name)
 remove uniform of specified name from StateSet.
void removeUniform (Uniform *uniform)
 remove Uniform from StateSet.
template<class T>
void removeUniform (const ref_ptr< T > &uniform)
UniformgetUniform (const std::string &name)
 Get Uniform for specified name.
UniformgetOrCreateUniform (const std::string &name, Uniform::Type type, unsigned int numElements=1)
 Get Uniform for specified name, if one is not available create it, add it to this StateSet and return a pointer to it.
const UniformgetUniform (const std::string &name) const
 Get const Uniform for specified name.
const RefUniformPairgetUniformPair (const std::string &name) const
 Get specified RefUniformPair for specified Uniform name.
void setUniformList (UniformList &al)
 set the list of all Uniforms contained in this StateSet.
UniformListgetUniformList ()
 return the list of all Uniforms contained in this StateSet.
const UniformListgetUniformList () const
 return the const list of all Uniforms contained in this const StateSet.
void setDefine (const std::string &defineName, StateAttribute::OverrideValue value=StateAttribute::ON)
 Added define pass on to shaders that use utilize that define, as specified by the GLSL #pragma import_defines(..) and #pragma requires(..).
void setDefine (const std::string &defineName, const std::string &defineValue, StateAttribute::OverrideValue value=StateAttribute::ON)
 Added define with value to pass on to shaders that use utilize that define, as specified by the GLSL #pragma import_defines(..) and #pragma requires(..).
DefinePairgetDefinePair (const std::string &defineName)
const DefinePairgetDefinePair (const std::string &defineName) const
void removeDefine (const std::string &defineName)
 Remove define.
void setDefineList (const DefineList &dl)
 Set the list of defines to pass on to shaders.
DefineListgetDefineList ()
 Get the list of defines to pass on to shaders.
const DefineListgetDefineList () const
 Get the const list of defines to pass on to shaders.
void setRenderingHint (int hint)
 Set the RenderingHint of this StateSet.
int getRenderingHint () const
 Get the RenderingHint of this StateSet.
void setRenderBinDetails (int binNum, const std::string &binName, RenderBinMode mode=USE_RENDERBIN_DETAILS)
 Set the render bin details.
void setRenderBinToInherit ()
 Set the render bin details to inherit.
bool useRenderBinDetails () const
 Get whether the render bin details are set and should be used.
void setRenderBinMode (RenderBinMode mode)
 Set the render bin mode.
RenderBinMode getRenderBinMode () const
 Get the render bin mode.
void setBinNumber (int num)
 Set the render bin number.
int getBinNumber () const
 Get the render bin number.
void setBinName (const std::string &name)
 Set the render bin name.
const std::string & getBinName () const
 Get the render bin name.
void setNestRenderBins (bool val)
 By default render bins will be nested within each other dependent upon where they are set in the scene graph.
bool getNestRenderBins () const
 Get whether associated RenderBin should be nested within parents RenderBin.
void setUpdateCallback (Callback *ac)
 Set the Update Callback which allows users to attach customize the updating of an object during the update traversal.
template<class T>
void setUpdateCallback (const ref_ptr< T > &ac)
CallbackgetUpdateCallback ()
 Get the non const Update Callback.
const CallbackgetUpdateCallback () const
 Get the const Update Callback.
bool requiresUpdateTraversal () const
 Return whether this StateSet has update callbacks associated with it, and therefore must be traversed.
unsigned int getNumChildrenRequiringUpdateTraversal () const
 Get the number of Objects of this StateSet which require Update traversal, since they have an Update Callback attached to them or their children.
void runUpdateCallbacks (osg::NodeVisitor *nv)
 Run the update callbacks attached directly to this StateSet or to its children.
void setEventCallback (Callback *ac)
 Set the Event Callback which allows users to attach customize the updating of an object during the event traversal.
template<class T>
void setEventCallback (const ref_ptr< T > &ec)
CallbackgetEventCallback ()
 Get the non const Event Callback.
const CallbackgetEventCallback () const
 Get the const Event Callback.
bool requiresEventTraversal () const
 Return whether this StateSet has event callbacks associated with it, and therefore must be traversed.
unsigned int getNumChildrenRequiringEventTraversal () const
 Get the number of Objects of this StateSet which require Event traversal, since they have an Eevnt Callback attached to them or their children.
void runEventCallbacks (osg::NodeVisitor *nv)
 Run the event callbacks attached directly to this StateSet or to its children.
bool checkValidityOfAssociatedModes (State &state) const
 Check the modes associated with this StateSet are supported by current OpenGL drivers, and if not set the associated mode in osg::State to be black listed/invalid.
virtual void setThreadSafeRefUnref (bool threadSafe)
 Set whether to use a mutex to ensure ref() and unref() are thread safe.
void compileGLObjects (State &state) const
 call compile on all StateAttributes contained within this StateSet.
virtual void resizeGLObjectBuffers (unsigned int maxSize)
 Resize any per context GLObject buffers to specified size.
virtual void releaseGLObjects (State *state=0) const
 call release on all StateAttributes contained within this StateSet.
Public Member Functions inherited from osg::Object
 Object ()
 Construct an object.
 Object (bool threadSafeRefUnref)
 Object (const Object &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
 Copy constructor, optional CopyOp object can be used to control shallow vs deep copying of dynamic data.
std::string getCompoundClassName () const
 return the compound class name that combines the library name and class name.
virtual NodeasNode ()
 Convert 'this' into a Node pointer if Object is a Node, otherwise return 0.
virtual const NodeasNode () const
 convert 'const this' into a const Node pointer if Object is a Node, otherwise return 0.
virtual NodeVisitorasNodeVisitor ()
 Convert 'this' into a NodeVisitor pointer if Object is a NodeVisitor, otherwise return 0.
virtual const NodeVisitorasNodeVisitor () const
 convert 'const this' into a const NodeVisitor pointer if Object is a NodeVisitor, otherwise return 0.
virtual StateAttributeasStateAttribute ()
 Convert 'this' into a StateAttribute pointer if Object is a StateAttribute, otherwise return 0.
virtual const StateAttributeasStateAttribute () const
 convert 'const this' into a const StateAttribute pointer if Object is a StateAttribute, otherwise return 0.
virtual UniformasUniform ()
 Convert 'this' into a Uniform pointer if Object is a Uniform, otherwise return 0.
virtual const UniformasUniform () const
 convert 'const this' into a const Uniform pointer if Object is a Uniform, otherwise return 0.
virtual CameraasCamera ()
 Convert 'this' into a Camera pointer if Node is a Camera, otherwise return 0.
virtual const CameraasCamera () const
 convert 'const this' into a const Camera pointer if Node is a Camera, otherwise return 0.
virtual DrawableasDrawable ()
 Convert 'this' into a Drawable pointer if Object is a Drawable, otherwise return 0.
virtual const DrawableasDrawable () const
 convert 'const this' into a const Drawable pointer if Object is a Drawable, otherwise return 0.
virtual CallbackasCallback ()
 Convert 'this' into a Callback pointer if Object is a Callback, otherwise return 0.
virtual const CallbackasCallback () const
 convert 'const this' into a const Callback pointer if Object is a Callback, otherwise return 0.
virtual CallbackObjectasCallbackObject ()
 Convert 'this' into a CallbackObject pointer if Object is a CallbackObject, otherwise return 0.
virtual const CallbackObjectasCallbackObject () const
 convert 'const this' into a const CallbackObject pointer if Object is a CallbackObject, otherwise return 0.
virtual UserDataContainerasUserDataContainer ()
 Convert 'this' into a UserDataContainer pointer if Object is a UserDataContainer, otherwise return 0.
virtual const UserDataContainerasUserDataContainer () const
 convert 'const this' into a const UserDataContainer pointer if Object is a UserDataContainer, otherwise return 0.
virtual ValueObjectasValueObject ()
 Convert 'this' into a ValueObject pointer if Object is a ValueObject, otherwise return 0.
virtual const ValueObjectasValueObject () const
 Convert 'this' into a ValueObject pointer if Object is a ValueObject, otherwise return 0.
virtual ImageasImage ()
 Convert 'this' into a Image pointer if Object is a Image, otherwise return 0.
virtual const ImageasImage () const
 Convert 'this' into a Image pointer if Object is a Image, otherwise return 0.
virtual void setName (const std::string &name)
 Set the name of object using C++ style string.
void setName (const char *name)
 Set the name of object using a C style string.
const std::string & getName () const
 Get the name of object.
void setDataVariance (DataVariance dv)
 Set the data variance of this object.
DataVariance getDataVariance () const
 Get the data variance of this object.
void setUserDataContainer (osg::UserDataContainer *udc)
 set the UserDataContainer object.
template<class T>
void setUserDataContainer (const ref_ptr< T > &udc)
osg::UserDataContainergetUserDataContainer ()
 get the UserDataContainer attached to this object.
const osg::UserDataContainergetUserDataContainer () const
 get the const UserDataContainer attached to this object.
osg::UserDataContainergetOrCreateUserDataContainer ()
 Convenience method that returns the UserDataContainer, and if one doesn't already exist creates and assigns a DefaultUserDataContainer to the Object and then return this new UserDataContainer.
virtual void setUserData (Referenced *obj)
 Set user data, data must be subclassed from Referenced to allow automatic memory handling.
template<class T>
void setUserData (const ref_ptr< T > &ud)
virtual ReferencedgetUserData ()
 Get user data.
virtual const ReferencedgetUserData () const
 Get const user data.
template<typename T>
bool getUserValue (const std::string &name, T &value) const
 Convenience method that casts the named UserObject to osg::TemplateValueObject<T> and gets the value.
template<typename T>
void setUserValue (const std::string &name, const T &value)
 Convenience method that creates the osg::TemplateValueObject<T> to store the specified value and adds it as a named UserObject.
template<typename T>
BoolValueObject UCharValueObject UShortValueObject UIntValueObject DoubleValueObject Vec3fValueObject Vec2dValueObject Vec4dValueObject PlaneValueObject MatrixdValueObject BoundingBoxdValueObject BoundingSpheredValueObject bool getUserValue (const std::string &name, T &value) const
 provide implementation of osg::Object::getUserValue(..) template
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 &)
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

virtual ~StateSet ()
StateSetoperator= (const StateSet &)
void addParent (osg::Node *object)
void removeParent (osg::Node *object)
ModeListgetOrCreateTextureModeList (unsigned int unit)
AttributeListgetOrCreateTextureAttributeList (unsigned int unit)
int compareModes (const ModeList &lhs, const ModeList &rhs)
int compareAttributePtrs (const AttributeList &lhs, const AttributeList &rhs)
int compareAttributeContents (const AttributeList &lhs, const AttributeList &rhs)
void setMode (ModeList &modeList, StateAttribute::GLMode mode, StateAttribute::GLModeValue value)
void setModeToInherit (ModeList &modeList, StateAttribute::GLMode mode)
StateAttribute::GLModeValue getMode (const ModeList &modeList, StateAttribute::GLMode mode) const
void setAttribute (AttributeList &attributeList, StateAttribute *attribute, StateAttribute::OverrideValue value=StateAttribute::OFF)
StateAttributegetAttribute (AttributeList &attributeList, StateAttribute::Type type, unsigned int member)
const StateAttributegetAttribute (const AttributeList &attributeList, StateAttribute::Type type, unsigned int member) const
RefAttributePairgetAttributePair (AttributeList &attributeList, StateAttribute::Type type, unsigned int member)
const RefAttributePairgetAttributePair (const AttributeList &attributeList, StateAttribute::Type type, unsigned int member) const
void setNumChildrenRequiringUpdateTraversal (unsigned int num)
void setNumChildrenRequiringEventTraversal (unsigned int num)
Protected Member Functions inherited from osg::Object
virtual ~Object ()
 Object destructor.
Protected Member Functions inherited from osg::Referenced
virtual ~Referenced ()
void signalObserversAndDelete (bool signalDelete, bool doDelete) const
void deleteUsingDeleteHandler () const

Protected Attributes

ParentList _parents
ModeList _modeList
AttributeList _attributeList
TextureModeList _textureModeList
TextureAttributeList _textureAttributeList
UniformList _uniformList
DefineList _defineList
int _renderingHint
RenderBinMode _binMode
int _binNum
std::string _binName
bool _nestRenderBins
ref_ptr< Callback_updateCallback
unsigned int _numChildrenRequiringUpdateTraversal
ref_ptr< Callback_eventCallback
unsigned int _numChildrenRequiringEventTraversal
Protected Attributes inherited from osg::Object
std::string _name
DataVariance _dataVariance
osg::UserDataContainer_userDataContainer
Protected Attributes inherited from osg::Referenced
OpenThreads::AtomicPtr _observerSet
OpenThreads::Atomic _refCount

Friends

class osg::Node
class osg::Drawable
class osg::Uniform
class osg::StateAttribute

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.

Detailed Description

Stores a set of modes and attributes which represent a set of OpenGL state.

Notice that a StateSet contains just a subset of the whole OpenGL state.

In OSG, each Drawable and each Node has a reference to a StateSet. These StateSets can be shared between different Drawables and Nodes (that is, several Drawables and Nodes can reference the same StateSet). Indeed, this practice is recommended whenever possible, as this minimizes expensive state changes in the graphics pipeline.

Member Typedef Documentation

◆ AttributeList

a container to map <StateAttribyte::Types,Member> to their respective RefAttributePair.

◆ DefineList

typedef std::map<std::string, DefinePair> osg::StateSet::DefineList

◆ DefinePair

◆ ModeList

a container to map GLModes to their respective GLModeValues.

◆ ParentList

typedef std::vector<Node*> osg::StateSet::ParentList

A vector of osg::Object pointers which is used to store the parent(s) of this Stateset, the parents could be osg::Node or osg::Drawable.

◆ RefAttributePair

Simple pairing between an attribute and its override flag.

◆ RefUniformPair

Simple pairing between a Uniform and its override flag.

◆ TextureAttributeList

◆ TextureModeList

◆ UniformList

typedef std::map<std::string,RefUniformPair> osg::StateSet::UniformList

a container to map Uniform name to its respective RefUniformPair.

Member Enumeration Documentation

◆ RenderBinMode

Enumerator
INHERIT_RENDERBIN_DETAILS 
USE_RENDERBIN_DETAILS 
OVERRIDE_RENDERBIN_DETAILS 
PROTECTED_RENDERBIN_DETAILS 
OVERRIDE_PROTECTED_RENDERBIN_DETAILS 

◆ RenderingHint

Enumerator
DEFAULT_BIN 
OPAQUE_BIN 
TRANSPARENT_BIN 

Constructor & Destructor Documentation

◆ StateSet() [1/2]

◆ StateSet() [2/2]

osg::StateSet::StateSet ( const StateSet & ,
const CopyOp & copyop = CopyOp::SHALLOW_COPY )

◆ ~StateSet()

virtual osg::StateSet::~StateSet ( )
protectedvirtual

Member Function Documentation

◆ addParent()

void osg::StateSet::addParent ( osg::Node * object)
protected

◆ addUniform() [1/2]

template<class T>
void osg::StateSet::addUniform ( const ref_ptr< T > & uniform,
StateAttribute::OverrideValue value = StateAttribute::ON )
inline

◆ addUniform() [2/2]

void osg::StateSet::addUniform ( Uniform * uniform,
StateAttribute::OverrideValue value = StateAttribute::ON )

Set this StateSet to contain specified uniform and override flag.

References osg::StateAttribute::ON, and osg::Uniform.

◆ asStateSet() [1/2]

virtual StateSet * osg::StateSet::asStateSet ( )
inlinevirtual

Convert 'this' into a StateSet pointer if Object is a StateSet, otherwise return 0.

Equivalent to dynamic_cast<StateSet*>(this).

Reimplemented from osg::Object.

References StateSet().

◆ asStateSet() [2/2]

virtual const StateSet * osg::StateSet::asStateSet ( ) const
inlinevirtual

convert 'const this' into a const StateSet pointer if Object is a StateSet, otherwise return 0.

Equivalent to dynamic_cast<const StateSet*>(this).

Reimplemented from osg::Object.

References StateSet().

◆ checkValidityOfAssociatedModes()

bool osg::StateSet::checkValidityOfAssociatedModes ( State & state) const

Check the modes associated with this StateSet are supported by current OpenGL drivers, and if not set the associated mode in osg::State to be black listed/invalid.

Return true if all associated modes are valid.

◆ className()

virtual const char * osg::StateSet::className ( ) const
inlinevirtual

return the name of the object's class type.

Must be defined by derived classes.

Implements osg::Object.

◆ clear()

void osg::StateSet::clear ( )

Clear the StateSet of all modes and attributes.

◆ clone()

virtual Object * osg::StateSet::clone ( const CopyOp & ) const
inlinevirtual

Clone an object, with Object* return type.

Must be defined by derived classes.

Implements osg::Object.

References osg::Object::Object(), and StateSet().

◆ cloneType()

virtual Object * osg::StateSet::cloneType ( ) const
inlinevirtual

Clone the type of an object, with Object* return type.

Must be defined by derived classes.

Implements osg::Object.

References osg::Object::Object(), and StateSet().

◆ compare()

int osg::StateSet::compare ( const StateSet & rhs,
bool compareAttributeContents = false ) const

return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.

References compareAttributeContents(), and StateSet().

Referenced by operator!=(), operator<(), and operator==().

◆ compareAttributeContents()

int osg::StateSet::compareAttributeContents ( const AttributeList & lhs,
const AttributeList & rhs )
protected

Referenced by compare().

◆ compareAttributePtrs()

int osg::StateSet::compareAttributePtrs ( const AttributeList & lhs,
const AttributeList & rhs )
protected

◆ compareModes()

int osg::StateSet::compareModes ( const ModeList & lhs,
const ModeList & rhs )
protected

◆ compileGLObjects()

void osg::StateSet::compileGLObjects ( State & state) const

call compile on all StateAttributes contained within this StateSet.

◆ computeDataVariance()

virtual void osg::StateSet::computeDataVariance ( )
virtual

Compute the DataVariance based on an assessment of callback etc.

Reimplemented from osg::Object.

◆ getAttribute() [1/4]

StateAttribute * osg::StateSet::getAttribute ( AttributeList & attributeList,
StateAttribute::Type type,
unsigned int member )
protected

References osg::StateAttribute.

◆ getAttribute() [2/4]

const StateAttribute * osg::StateSet::getAttribute ( const AttributeList & attributeList,
StateAttribute::Type type,
unsigned int member ) const
protected

References osg::StateAttribute.

◆ getAttribute() [3/4]

StateAttribute * osg::StateSet::getAttribute ( StateAttribute::Type type,
unsigned int member = 0 )

Get specified StateAttribute for specified type.

Returns NULL if no type is contained within StateSet.

References osg::StateAttribute.

◆ getAttribute() [4/4]

const StateAttribute * osg::StateSet::getAttribute ( StateAttribute::Type type,
unsigned int member = 0 ) const

Get specified const StateAttribute for specified type.

Returns NULL if no type is contained within const StateSet.

References osg::StateAttribute.

◆ getAttributeList() [1/2]

AttributeList & osg::StateSet::getAttributeList ( )
inline

return the list of all StateAttributes contained in this StateSet.

References _attributeList.

◆ getAttributeList() [2/2]

const AttributeList & osg::StateSet::getAttributeList ( ) const
inline

return the const list of all StateAttributes contained in this const StateSet.

References _attributeList.

◆ getAttributePair() [1/4]

RefAttributePair * osg::StateSet::getAttributePair ( AttributeList & attributeList,
StateAttribute::Type type,
unsigned int member )
protected

◆ getAttributePair() [2/4]

const RefAttributePair * osg::StateSet::getAttributePair ( const AttributeList & attributeList,
StateAttribute::Type type,
unsigned int member ) const
protected

◆ getAttributePair() [3/4]

RefAttributePair * osg::StateSet::getAttributePair ( StateAttribute::Type type,
unsigned int member = 0 )

Get specified RefAttributePair for specified type.

Returns NULL if no type is contained within StateSet.

◆ getAttributePair() [4/4]

const RefAttributePair * osg::StateSet::getAttributePair ( StateAttribute::Type type,
unsigned int member = 0 ) const

Get specified RefAttributePair for specified type.

Returns NULL if no type is contained within StateSet.

◆ getBinName()

const std::string & osg::StateSet::getBinName ( ) const
inline

Get the render bin name.

References _binName.

Referenced by osgUtil::CullVisitor::popStateSet(), and osgUtil::CullVisitor::pushStateSet().

◆ getBinNumber()

int osg::StateSet::getBinNumber ( ) const
inline

Get the render bin number.

References _binNum.

Referenced by osgUtil::CullVisitor::pushStateSet().

◆ getDefineList() [1/2]

DefineList & osg::StateSet::getDefineList ( )
inline

Get the list of defines to pass on to shaders.

References _defineList.

◆ getDefineList() [2/2]

const DefineList & osg::StateSet::getDefineList ( ) const
inline

Get the const list of defines to pass on to shaders.

References _defineList.

◆ getDefinePair() [1/2]

DefinePair * osg::StateSet::getDefinePair ( const std::string & defineName)
inline

References _defineList.

◆ getDefinePair() [2/2]

const DefinePair * osg::StateSet::getDefinePair ( const std::string & defineName) const
inline

References _defineList.

◆ getEventCallback() [1/2]

Callback * osg::StateSet::getEventCallback ( )
inline

Get the non const Event Callback.

References _eventCallback.

◆ getEventCallback() [2/2]

const Callback * osg::StateSet::getEventCallback ( ) const
inline

Get the const Event Callback.

References _eventCallback.

◆ getMode() [1/2]

StateAttribute::GLModeValue osg::StateSet::getMode ( const ModeList & modeList,
StateAttribute::GLMode mode ) const
protected

◆ getMode() [2/2]

StateAttribute::GLModeValue osg::StateSet::getMode ( StateAttribute::GLMode mode) const

Get the value for a given GLMode.

Parameters
modeThe GLMode whose value is desired.
Returns
If mode is contained within this StateSet, returns the value associated with it. Otherwise, returns StateAttribute::INHERIT.
Note
Don't use this method to get the value of modes related to textures. For this purpose, use removeTextureMode(), that accepts an extra parameter specifying which texture unit shall be affected by the call.

◆ getModeList() [1/2]

ModeList & osg::StateSet::getModeList ( )
inline

Return the list of all GLModes contained in this StateSet.

References _modeList.

◆ getModeList() [2/2]

const ModeList & osg::StateSet::getModeList ( ) const
inline

Return the const list of all GLModes contained in this const StateSet.

References _modeList.

◆ getNestRenderBins()

bool osg::StateSet::getNestRenderBins ( ) const
inline

Get whether associated RenderBin should be nested within parents RenderBin.

References _nestRenderBins.

Referenced by osgUtil::CullVisitor::pushStateSet().

◆ getNumChildrenRequiringEventTraversal()

unsigned int osg::StateSet::getNumChildrenRequiringEventTraversal ( ) const
inline

Get the number of Objects of this StateSet which require Event traversal, since they have an Eevnt Callback attached to them or their children.

References _numChildrenRequiringEventTraversal.

Referenced by requiresEventTraversal().

◆ getNumChildrenRequiringUpdateTraversal()

unsigned int osg::StateSet::getNumChildrenRequiringUpdateTraversal ( ) const
inline

Get the number of Objects of this StateSet which require Update traversal, since they have an Update Callback attached to them or their children.

References _numChildrenRequiringUpdateTraversal.

Referenced by requiresUpdateTraversal().

◆ getNumParents()

unsigned int osg::StateSet::getNumParents ( ) const
inline

Get the number of parents of this StateSet.

Returns
the number of parents of this StateSet.

References _parents.

◆ getNumTextureAttributeLists()

unsigned int osg::StateSet::getNumTextureAttributeLists ( ) const
inline

Return the number of texture units active in the TextureAttributeList.

References _textureAttributeList.

◆ getNumTextureModeLists()

unsigned int osg::StateSet::getNumTextureModeLists ( ) const
inline

Return the number texture units active in the TextureModeList.

References _textureModeList.

◆ getOrCreateTextureAttributeList()

AttributeList & osg::StateSet::getOrCreateTextureAttributeList ( unsigned int unit)
inlineprotected

References _textureAttributeList.

◆ getOrCreateTextureModeList()

ModeList & osg::StateSet::getOrCreateTextureModeList ( unsigned int unit)
inlineprotected

References _textureModeList.

◆ getOrCreateUniform()

Uniform * osg::StateSet::getOrCreateUniform ( const std::string & name,
Uniform::Type type,
unsigned int numElements = 1 )

Get Uniform for specified name, if one is not available create it, add it to this StateSet and return a pointer to it.

References osg::Uniform.

◆ getParent() [1/2]

Node * osg::StateSet::getParent ( unsigned int i)
inline

References _parents, and osg::Node.

◆ getParent() [2/2]

const Node * osg::StateSet::getParent ( unsigned int i) const
inline

Get a single const parent of this StateSet.

Parameters
iindex of the parent to get.
Returns
the parent i.

References _parents, and osg::Node.

◆ getParents() [1/2]

ParentList osg::StateSet::getParents ( )
inline

Get the a copy of parent list of node.

A copy is returned to prevent modification of the parent list.

References _parents.

◆ getParents() [2/2]

const ParentList & osg::StateSet::getParents ( ) const
inline

Get the parent list of this StateSet.

References _parents.

◆ getRenderBinMode()

RenderBinMode osg::StateSet::getRenderBinMode ( ) const
inline

Get the render bin mode.

References _binMode.

Referenced by osgUtil::CullVisitor::popStateSet(), and osgUtil::CullVisitor::pushStateSet().

◆ getRenderingHint()

int osg::StateSet::getRenderingHint ( ) const
inline

Get the RenderingHint of this StateSet.

References _renderingHint.

◆ getTextureAttribute() [1/2]

StateAttribute * osg::StateSet::getTextureAttribute ( unsigned int unit,
StateAttribute::Type type )

Get specified Texture related StateAttribute for specified type.

Returns NULL if no type is contained within StateSet.

References osg::StateAttribute.

Referenced by osgWidget::Widget::_texture(), and osgWidget::Widget::_texture().

◆ getTextureAttribute() [2/2]

const StateAttribute * osg::StateSet::getTextureAttribute ( unsigned int unit,
StateAttribute::Type type ) const

Get specified Texture related const StateAttribute for specified type.

Returns NULL if no type is contained within const StateSet.

References osg::StateAttribute.

◆ getTextureAttributeList() [1/2]

TextureAttributeList & osg::StateSet::getTextureAttributeList ( )
inline

Return the list of all Texture related StateAttributes contained in this StateSet.

References _textureAttributeList.

◆ getTextureAttributeList() [2/2]

const TextureAttributeList & osg::StateSet::getTextureAttributeList ( ) const
inline

Return the const list of all Texture related StateAttributes contained in this const StateSet.

References _textureAttributeList.

◆ getTextureAttributePair() [1/2]

RefAttributePair * osg::StateSet::getTextureAttributePair ( unsigned int unit,
StateAttribute::Type type )

Get specified Texture related RefAttributePair for specified type.

Returns NULL if no type is contained within StateSet.

◆ getTextureAttributePair() [2/2]

const RefAttributePair * osg::StateSet::getTextureAttributePair ( unsigned int unit,
StateAttribute::Type type ) const

Get specified Texture related RefAttributePair for specified type.

Returns NULL if no type is contained within StateSet.

◆ getTextureMode()

StateAttribute::GLModeValue osg::StateSet::getTextureMode ( unsigned int unit,
StateAttribute::GLMode mode ) const

Get specified GLModeValue for specified GLMode.

returns INHERIT if no GLModeValue is contained within StateSet.

◆ getTextureModeList() [1/2]

TextureModeList & osg::StateSet::getTextureModeList ( )
inline

return the list of all Texture related GLModes contained in this StateSet.

References _textureModeList.

◆ getTextureModeList() [2/2]

const TextureModeList & osg::StateSet::getTextureModeList ( ) const
inline

return the const list of all Texture related GLModes contained in this const StateSet.

References _textureModeList.

◆ getUniform() [1/2]

Uniform * osg::StateSet::getUniform ( const std::string & name)

Get Uniform for specified name.

Returns NULL if no matching Uniform is contained within StateSet.

References osg::Uniform.

◆ getUniform() [2/2]

const Uniform * osg::StateSet::getUniform ( const std::string & name) const

Get const Uniform for specified name.

Returns NULL if no matching Uniform is contained within StateSet.

References osg::Uniform.

◆ getUniformList() [1/2]

UniformList & osg::StateSet::getUniformList ( )
inline

return the list of all Uniforms contained in this StateSet.

References _uniformList.

◆ getUniformList() [2/2]

const UniformList & osg::StateSet::getUniformList ( ) const
inline

return the const list of all Uniforms contained in this const StateSet.

References _uniformList.

◆ getUniformPair()

const RefUniformPair * osg::StateSet::getUniformPair ( const std::string & name) const

Get specified RefUniformPair for specified Uniform name.

Returns NULL if no Uniform is contained within StateSet.

◆ getUpdateCallback() [1/2]

Callback * osg::StateSet::getUpdateCallback ( )
inline

Get the non const Update Callback.

References _updateCallback.

◆ getUpdateCallback() [2/2]

const Callback * osg::StateSet::getUpdateCallback ( ) const
inline

Get the const Update Callback.

References _updateCallback.

◆ isSameKindAs()

virtual bool osg::StateSet::isSameKindAs ( const Object * obj) const
inlinevirtual

Reimplemented from osg::Object.

References NULL, osg::Object::Object(), and StateSet().

◆ libraryName()

virtual const char * osg::StateSet::libraryName ( ) const
inlinevirtual

return the name of the object's library.

Must be defined by derived classes. The OpenSceneGraph convention is that the namespace of a library is the same as the library name.

Implements osg::Object.

◆ merge()

void osg::StateSet::merge ( const StateSet & rhs)

Merge this StateSet with the StateSet passed as parameter.

Every mode and attribute in this StateSet that is marked with StateAttribute::OVERRIDE is replaced with the equivalent mode or attribute from rhs.

References StateSet().

◆ operator!=()

bool osg::StateSet::operator!= ( const StateSet & rhs) const
inline

References compare(), and StateSet().

◆ operator<()

bool osg::StateSet::operator< ( const StateSet & rhs) const
inline

References compare(), and StateSet().

◆ operator=()

StateSet & osg::StateSet::operator= ( const StateSet & )
inlineprotected

References StateSet().

◆ operator==()

bool osg::StateSet::operator== ( const StateSet & rhs) const
inline

References compare(), and StateSet().

◆ releaseGLObjects()

virtual void osg::StateSet::releaseGLObjects ( State * state = 0) const
virtual

call release on all StateAttributes contained within this StateSet.

Reimplemented from osg::Object.

◆ removeAssociatedModes()

void osg::StateSet::removeAssociatedModes ( const StateAttribute * attribute)

References osg::StateAttribute.

◆ removeAssociatedTextureModes()

void osg::StateSet::removeAssociatedTextureModes ( unsigned int unit,
const StateAttribute * attribute )

References osg::StateAttribute.

◆ removeAttribute() [1/3]

template<class T>
void osg::StateSet::removeAttribute ( const ref_ptr< T > & attribute)
inline

◆ removeAttribute() [2/3]

void osg::StateSet::removeAttribute ( StateAttribute * attribute)

remove attribute from StateSet.

References osg::StateAttribute.

◆ removeAttribute() [3/3]

void osg::StateSet::removeAttribute ( StateAttribute::Type type,
unsigned int member = 0 )

remove attribute of specified type from StateSet.

◆ removeDefine()

void osg::StateSet::removeDefine ( const std::string & defineName)

Remove define.

◆ removeMode()

void osg::StateSet::removeMode ( StateAttribute::GLMode mode)

Remove mode from this StateSet.

Note
Don't use this method to remove modes related to textures. For this purpose, use removeTextureMode(), that accepts an extra parameter specifying which texture unit shall be affected by the call.

◆ removeParent()

void osg::StateSet::removeParent ( osg::Node * object)
protected

◆ removeTextureAttribute() [1/3]

template<class T>
void osg::StateSet::removeTextureAttribute ( unsigned int unit,
const ref_ptr< T > & attribute )
inline

◆ removeTextureAttribute() [2/3]

void osg::StateSet::removeTextureAttribute ( unsigned int unit,
StateAttribute * attribute )

remove texture attribute from StateSet.

References osg::StateAttribute.

◆ removeTextureAttribute() [3/3]

void osg::StateSet::removeTextureAttribute ( unsigned int unit,
StateAttribute::Type type )

remove texture attribute of specified type from StateSet.

◆ removeTextureMode()

void osg::StateSet::removeTextureMode ( unsigned int unit,
StateAttribute::GLMode mode )

Remove texture mode from StateSet.

◆ removeUniform() [1/3]

template<class T>
void osg::StateSet::removeUniform ( const ref_ptr< T > & uniform)
inline

References osg::ref_ptr< T >::get(), and removeUniform().

Referenced by removeUniform().

◆ removeUniform() [2/3]

void osg::StateSet::removeUniform ( const std::string & name)

remove uniform of specified name from StateSet.

◆ removeUniform() [3/3]

void osg::StateSet::removeUniform ( Uniform * uniform)

remove Uniform from StateSet.

References osg::Uniform.

◆ requiresEventTraversal()

bool osg::StateSet::requiresEventTraversal ( ) const
inline

Return whether this StateSet has event callbacks associated with it, and therefore must be traversed.

References _eventCallback, and getNumChildrenRequiringEventTraversal().

Referenced by osgGA::EventVisitor::handle_callbacks().

◆ requiresUpdateTraversal()

bool osg::StateSet::requiresUpdateTraversal ( ) const
inline

Return whether this StateSet has update callbacks associated with it, and therefore must be traversed.

References _updateCallback, and getNumChildrenRequiringUpdateTraversal().

Referenced by osgUtil::UpdateVisitor::handle_callbacks().

◆ resizeGLObjectBuffers()

virtual void osg::StateSet::resizeGLObjectBuffers ( unsigned int maxSize)
virtual

Resize any per context GLObject buffers to specified size.

Reimplemented from osg::Object.

◆ runEventCallbacks()

void osg::StateSet::runEventCallbacks ( osg::NodeVisitor * nv)

Run the event callbacks attached directly to this StateSet or to its children.

Referenced by osgGA::EventVisitor::handle_callbacks().

◆ runUpdateCallbacks()

void osg::StateSet::runUpdateCallbacks ( osg::NodeVisitor * nv)

Run the update callbacks attached directly to this StateSet or to its children.

Referenced by osgUtil::UpdateVisitor::handle_callbacks().

◆ setAssociatedModes()

void osg::StateSet::setAssociatedModes ( const StateAttribute * attribute,
StateAttribute::GLModeValue value )

References osg::StateAttribute.

◆ setAssociatedTextureModes()

void osg::StateSet::setAssociatedTextureModes ( unsigned int unit,
const StateAttribute * attribute,
StateAttribute::GLModeValue value )

References osg::StateAttribute.

◆ setAttribute() [1/3]

void osg::StateSet::setAttribute ( AttributeList & attributeList,
StateAttribute * attribute,
StateAttribute::OverrideValue value = StateAttribute::OFF )
protected

◆ setAttribute() [2/3]

template<class T>
void osg::StateSet::setAttribute ( const ref_ptr< T > & attribute,
StateAttribute::OverrideValue value = StateAttribute::OFF )
inline

◆ setAttribute() [3/3]

void osg::StateSet::setAttribute ( StateAttribute * attribute,
StateAttribute::OverrideValue value = StateAttribute::OFF )

Set this StateSet to contain specified attribute and override flag.

References osg::StateAttribute::OFF, and osg::StateAttribute.

◆ setAttributeAndModes() [1/2]

template<class T>
void osg::StateSet::setAttributeAndModes ( const ref_ptr< T > & attribute,
StateAttribute::GLModeValue value = StateAttribute::ON )
inline

◆ setAttributeAndModes() [2/2]

void osg::StateSet::setAttributeAndModes ( StateAttribute * attribute,
StateAttribute::GLModeValue value = StateAttribute::ON )

Set this StateSet to contain specified attribute and set the associated GLMode's to specified value.

References osg::StateAttribute::ON, and osg::StateAttribute.

◆ setAttributeList()

void osg::StateSet::setAttributeList ( AttributeList & al)
inline

set the list of all StateAttributes contained in this StateSet.

References _attributeList.

◆ setBinName()

void osg::StateSet::setBinName ( const std::string & name)
inline

Set the render bin name.

References _binName.

◆ setBinNumber()

void osg::StateSet::setBinNumber ( int num)
inline

Set the render bin number.

References _binNum.

◆ setDefine() [1/2]

void osg::StateSet::setDefine ( const std::string & defineName,
const std::string & defineValue,
StateAttribute::OverrideValue value = StateAttribute::ON )

Added define with value to pass on to shaders that use utilize that define, as specified by the GLSL #pragma import_defines(..) and #pragma requires(..).

References osg::StateAttribute::ON.

◆ setDefine() [2/2]

void osg::StateSet::setDefine ( const std::string & defineName,
StateAttribute::OverrideValue value = StateAttribute::ON )

Added define pass on to shaders that use utilize that define, as specified by the GLSL #pragma import_defines(..) and #pragma requires(..).

References osg::StateAttribute::ON.

◆ setDefineList()

void osg::StateSet::setDefineList ( const DefineList & dl)
inline

Set the list of defines to pass on to shaders.

References _defineList.

◆ setEventCallback() [1/2]

void osg::StateSet::setEventCallback ( Callback * ac)

Set the Event Callback which allows users to attach customize the updating of an object during the event traversal.

◆ setEventCallback() [2/2]

template<class T>
void osg::StateSet::setEventCallback ( const ref_ptr< T > & ec)
inline

◆ setGlobalDefaults()

void osg::StateSet::setGlobalDefaults ( )

Set all the modes to on or off so that it defines a complete state, typically used for a default global state.

◆ setMode() [1/2]

void osg::StateSet::setMode ( ModeList & modeList,
StateAttribute::GLMode mode,
StateAttribute::GLModeValue value )
protected

◆ setMode() [2/2]

void osg::StateSet::setMode ( StateAttribute::GLMode mode,
StateAttribute::GLModeValue value )

Set this StateSet to contain the specified GLMode with a given value.

Note
Don't use this method to set modes related to textures. For this purpose, use setTextureMode(), that accepts an extra parameter specifying which texture unit shall be affected by the call.

Referenced by osgPresentation::SlideShowConstructor::createTransformStateSet().

◆ setModeList()

void osg::StateSet::setModeList ( ModeList & ml)
inline

Set the list of all GLModes contained in this StateSet.

References _modeList.

◆ setModeToInherit()

void osg::StateSet::setModeToInherit ( ModeList & modeList,
StateAttribute::GLMode mode )
protected

◆ setNestRenderBins()

void osg::StateSet::setNestRenderBins ( bool val)
inline

By default render bins will be nested within each other dependent upon where they are set in the scene graph.

This can be problematic if a transparent render bin is attached to an opaque render bin which is attached to another transparent render bin as these render bins will be sorted separately, giving the wrong draw ordering for back-to-front transparency. Therefore, to prevent render bins being nested, call setNestRenderBins(false).

References _nestRenderBins.

◆ setNumChildrenRequiringEventTraversal()

void osg::StateSet::setNumChildrenRequiringEventTraversal ( unsigned int num)
protected

◆ setNumChildrenRequiringUpdateTraversal()

void osg::StateSet::setNumChildrenRequiringUpdateTraversal ( unsigned int num)
protected

◆ setRenderBinDetails()

void osg::StateSet::setRenderBinDetails ( int binNum,
const std::string & binName,
RenderBinMode mode = USE_RENDERBIN_DETAILS )

Set the render bin details.

References USE_RENDERBIN_DETAILS.

◆ setRenderBinMode()

void osg::StateSet::setRenderBinMode ( RenderBinMode mode)
inline

Set the render bin mode.

References _binMode.

◆ setRenderBinToInherit()

void osg::StateSet::setRenderBinToInherit ( )

Set the render bin details to inherit.

◆ setRenderingHint()

void osg::StateSet::setRenderingHint ( int hint)

Set the RenderingHint of this StateSet.

RenderingHint is used by the renderer to determine which draw bin to drop associated osg::Drawables in. Typically, users will set this to either StateSet::OPAQUE_BIN or StateSet::TRANSPARENT_BIN. Drawables in the opaque bin are sorted by their StateSet, so that the number of expensive changes in the OpenGL state is minimized. Drawables in the transparent bin are sorted by depth, so that objects farther from the viewer are rendered first (and hence alpha blending works nicely for translucent objects).

◆ setTextureAttribute() [1/2]

template<class T>
void osg::StateSet::setTextureAttribute ( unsigned int unit,
const ref_ptr< T > & attribute,
StateAttribute::OverrideValue value = StateAttribute::OFF )
inline

◆ setTextureAttribute() [2/2]

void osg::StateSet::setTextureAttribute ( unsigned int unit,
StateAttribute * attribute,
StateAttribute::OverrideValue value = StateAttribute::OFF )

Set this StateSet to contain specified attribute and override flag.

References osg::StateAttribute::OFF, and osg::StateAttribute.

◆ setTextureAttributeAndModes() [1/2]

template<class T>
void osg::StateSet::setTextureAttributeAndModes ( unsigned int unit,
const ref_ptr< T > & attribute,
StateAttribute::OverrideValue value = StateAttribute::ON )
inline

◆ setTextureAttributeAndModes() [2/2]

void osg::StateSet::setTextureAttributeAndModes ( unsigned int unit,
StateAttribute * attribute,
StateAttribute::GLModeValue value = StateAttribute::ON )

Set this StateSet to contain specified attribute and set the associated GLMode's to specified value.

References osg::StateAttribute::ON, and osg::StateAttribute.

◆ setTextureAttributeList()

void osg::StateSet::setTextureAttributeList ( TextureAttributeList & tal)
inline

Set the list of all Texture related StateAttributes contained in this StateSet.

References _textureAttributeList.

◆ setTextureMode()

void osg::StateSet::setTextureMode ( unsigned int unit,
StateAttribute::GLMode mode,
StateAttribute::GLModeValue value )

Set this StateSet to contain specified GLMode with a given value.

Parameters
unitThe texture unit to be affected (used with multi-texturing).
modeThe OpenGL mode to be added to the StateSet.
valueThe value to be assigned to mode.

◆ setTextureModeList()

void osg::StateSet::setTextureModeList ( TextureModeList & tml)
inline

set the list of all Texture related GLModes contained in this StateSet.

References _textureModeList.

◆ setThreadSafeRefUnref()

virtual void osg::StateSet::setThreadSafeRefUnref ( bool threadSafe)
virtual

Set whether to use a mutex to ensure ref() and unref() are thread safe.

Reimplemented from osg::Object.

◆ setUniformList()

void osg::StateSet::setUniformList ( UniformList & al)
inline

set the list of all Uniforms contained in this StateSet.

References _uniformList.

◆ setUpdateCallback() [1/2]

void osg::StateSet::setUpdateCallback ( Callback * ac)

Set the Update Callback which allows users to attach customize the updating of an object during the update traversal.

◆ setUpdateCallback() [2/2]

template<class T>
void osg::StateSet::setUpdateCallback ( const ref_ptr< T > & ac)
inline

◆ useRenderBinDetails()

bool osg::StateSet::useRenderBinDetails ( ) const
inline

Get whether the render bin details are set and should be used.

References _binMode, and INHERIT_RENDERBIN_DETAILS.

Referenced by osgUtil::CullVisitor::popStateSet(), and osgUtil::CullVisitor::pushStateSet().

◆ osg::Drawable

friend class osg::Drawable
friend

◆ osg::Node

friend class osg::Node
friend

Referenced by getParent(), and getParent().

◆ osg::StateAttribute

◆ osg::Uniform

Member Data Documentation

◆ _attributeList

AttributeList osg::StateSet::_attributeList
protected

◆ _binMode

RenderBinMode osg::StateSet::_binMode
protected

◆ _binName

std::string osg::StateSet::_binName
protected

Referenced by getBinName(), and setBinName().

◆ _binNum

int osg::StateSet::_binNum
protected

Referenced by getBinNumber(), and setBinNumber().

◆ _defineList

DefineList osg::StateSet::_defineList
protected

◆ _eventCallback

ref_ptr<Callback> osg::StateSet::_eventCallback
protected

◆ _modeList

ModeList osg::StateSet::_modeList
protected

◆ _nestRenderBins

bool osg::StateSet::_nestRenderBins
protected

◆ _numChildrenRequiringEventTraversal

unsigned int osg::StateSet::_numChildrenRequiringEventTraversal
protected

◆ _numChildrenRequiringUpdateTraversal

unsigned int osg::StateSet::_numChildrenRequiringUpdateTraversal
protected

◆ _parents

ParentList osg::StateSet::_parents
protected

◆ _renderingHint

int osg::StateSet::_renderingHint
protected

Referenced by getRenderingHint().

◆ _textureAttributeList

◆ _textureModeList

◆ _uniformList

UniformList osg::StateSet::_uniformList
protected

◆ _updateCallback

ref_ptr<Callback> osg::StateSet::_updateCallback
protected

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

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