|
openscenegraph
|
#include <StateSet>
Classes | |
| struct | Callback |
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 () |
| static void | setDeleteHandler (DeleteHandler *handler) |
| static DeleteHandler * | getDeleteHandler () |
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.
| typedef std::map<StateAttribute::TypeMemberPair,RefAttributePair> osg::StateSet::AttributeList |
a container to map <StateAttribyte::Types,Member> to their respective RefAttributePair.
| typedef std::map<std::string, DefinePair> osg::StateSet::DefineList |
| typedef std::pair<std::string, StateAttribute::OverrideValue> osg::StateSet::DefinePair |
| typedef std::map<StateAttribute::GLMode,StateAttribute::GLModeValue> osg::StateSet::ModeList |
a container to map GLModes to their respective GLModeValues.
| 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.
| typedef std::pair<ref_ptr<StateAttribute>,StateAttribute::OverrideValue> osg::StateSet::RefAttributePair |
Simple pairing between an attribute and its override flag.
| typedef std::pair<ref_ptr<Uniform>,StateAttribute::OverrideValue> osg::StateSet::RefUniformPair |
Simple pairing between a Uniform and its override flag.
| typedef std::vector<AttributeList> osg::StateSet::TextureAttributeList |
| typedef std::vector<ModeList> osg::StateSet::TextureModeList |
| typedef std::map<std::string,RefUniformPair> osg::StateSet::UniformList |
a container to map Uniform name to its respective RefUniformPair.
| osg::StateSet::StateSet | ( | ) |
Referenced by asStateSet(), asStateSet(), clone(), cloneType(), compare(), isSameKindAs(), merge(), operator!=(), osg::StateSet::Callback::operator()(), operator<(), operator=(), operator==(), and StateSet().
| osg::StateSet::StateSet | ( | const StateSet & | , |
| const CopyOp & | copyop = CopyOp::SHALLOW_COPY ) |
References osg::CopyOp::SHALLOW_COPY, and StateSet().
|
protectedvirtual |
|
protected |
|
inline |
References addUniform(), osg::ref_ptr< T >::get(), and osg::StateAttribute::ON.
Referenced by addUniform().
| 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.
|
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().
|
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().
| 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.
|
inlinevirtual |
return the name of the object's class type. Must be defined by derived classes.
Implements osg::Object.
| void osg::StateSet::clear | ( | ) |
Clear the StateSet of all modes and attributes.
Clone an object, with Object* return type. Must be defined by derived classes.
Implements osg::Object.
References osg::Object::Object(), and StateSet().
|
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().
| 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==().
|
protected |
Referenced by compare().
|
protected |
| void osg::StateSet::compileGLObjects | ( | State & | state | ) | const |
call compile on all StateAttributes contained within this StateSet.
|
virtual |
Compute the DataVariance based on an assessment of callback etc.
Reimplemented from osg::Object.
|
protected |
References osg::StateAttribute.
|
protected |
References osg::StateAttribute.
| 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.
| 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.
|
inline |
return the list of all StateAttributes contained in this StateSet.
References _attributeList.
|
inline |
return the const list of all StateAttributes contained in this const StateSet.
References _attributeList.
|
protected |
|
protected |
| 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.
| 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.
|
inline |
Get the render bin name.
References _binName.
Referenced by osgUtil::CullVisitor::popStateSet(), and osgUtil::CullVisitor::pushStateSet().
|
inline |
|
inline |
Get the list of defines to pass on to shaders.
References _defineList.
|
inline |
Get the const list of defines to pass on to shaders.
References _defineList.
|
inline |
References _defineList.
|
inline |
References _defineList.
|
inline |
Get the non const Event Callback.
References _eventCallback.
|
inline |
Get the const Event Callback.
References _eventCallback.
|
protected |
| StateAttribute::GLModeValue osg::StateSet::getMode | ( | StateAttribute::GLMode | mode | ) | const |
Get the value for a given GLMode.
| mode | The GLMode whose value is desired. |
mode is contained within this StateSet, returns the value associated with it. Otherwise, returns StateAttribute::INHERIT. removeTextureMode(), that accepts an extra parameter specifying which texture unit shall be affected by the call.
|
inline |
|
inline |
|
inline |
Get whether associated RenderBin should be nested within parents RenderBin.
References _nestRenderBins.
Referenced by osgUtil::CullVisitor::pushStateSet().
|
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().
|
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().
|
inline |
|
inline |
Return the number of texture units active in the TextureAttributeList.
References _textureAttributeList.
|
inline |
Return the number texture units active in the TextureModeList.
References _textureModeList.
|
inlineprotected |
References _textureAttributeList.
|
inlineprotected |
References _textureModeList.
| 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.
|
inline |
|
inline |
Get the a copy of parent list of node. A copy is returned to prevent modification of the parent list.
References _parents.
|
inline |
|
inline |
Get the render bin mode.
References _binMode.
Referenced by osgUtil::CullVisitor::popStateSet(), and osgUtil::CullVisitor::pushStateSet().
|
inline |
Get the RenderingHint of this StateSet.
References _renderingHint.
| 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().
| 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.
|
inline |
Return the list of all Texture related StateAttributes contained in this StateSet.
References _textureAttributeList.
|
inline |
Return the const list of all Texture related StateAttributes contained in this const StateSet.
References _textureAttributeList.
| 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.
| 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.
| 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.
|
inline |
return the list of all Texture related GLModes contained in this StateSet.
References _textureModeList.
|
inline |
return the const list of all Texture related GLModes contained in this const StateSet.
References _textureModeList.
| 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.
| 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.
|
inline |
return the list of all Uniforms contained in this StateSet.
References _uniformList.
|
inline |
return the const list of all Uniforms contained in this const StateSet.
References _uniformList.
| 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.
|
inline |
Get the non const Update Callback.
References _updateCallback.
|
inline |
Get the const Update Callback.
References _updateCallback.
|
inlinevirtual |
Reimplemented from osg::Object.
References NULL, osg::Object::Object(), and StateSet().
|
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.
| 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().
|
inline |
References compare(), and StateSet().
|
inline |
References compare(), and StateSet().
References StateSet().
|
inline |
References compare(), and StateSet().
|
virtual |
call release on all StateAttributes contained within this StateSet.
Reimplemented from osg::Object.
| void osg::StateSet::removeAssociatedModes | ( | const StateAttribute * | attribute | ) |
References osg::StateAttribute.
| void osg::StateSet::removeAssociatedTextureModes | ( | unsigned int | unit, |
| const StateAttribute * | attribute ) |
References osg::StateAttribute.
|
inline |
References osg::ref_ptr< T >::get(), and removeAttribute().
Referenced by removeAttribute().
| void osg::StateSet::removeAttribute | ( | StateAttribute * | attribute | ) |
remove attribute from StateSet.
References osg::StateAttribute.
| void osg::StateSet::removeAttribute | ( | StateAttribute::Type | type, |
| unsigned int | member = 0 ) |
remove attribute of specified type from StateSet.
| void osg::StateSet::removeDefine | ( | const std::string & | defineName | ) |
Remove define
| void osg::StateSet::removeMode | ( | StateAttribute::GLMode | mode | ) |
Remove mode from this StateSet.
removeTextureMode(), that accepts an extra parameter specifying which texture unit shall be affected by the call.
|
protected |
|
inline |
References osg::ref_ptr< T >::get(), and removeTextureAttribute().
Referenced by removeTextureAttribute().
| void osg::StateSet::removeTextureAttribute | ( | unsigned int | unit, |
| StateAttribute * | attribute ) |
remove texture attribute from StateSet.
References osg::StateAttribute.
| void osg::StateSet::removeTextureAttribute | ( | unsigned int | unit, |
| StateAttribute::Type | type ) |
remove texture attribute of specified type from StateSet.
| void osg::StateSet::removeTextureMode | ( | unsigned int | unit, |
| StateAttribute::GLMode | mode ) |
Remove texture mode from StateSet.
|
inline |
References osg::ref_ptr< T >::get(), and removeUniform().
Referenced by removeUniform().
| void osg::StateSet::removeUniform | ( | const std::string & | name | ) |
remove uniform of specified name from StateSet.
| void osg::StateSet::removeUniform | ( | Uniform * | uniform | ) |
References osg::Uniform.
|
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().
|
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().
|
virtual |
Resize any per context GLObject buffers to specified size.
Reimplemented from osg::Object.
| 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().
| 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().
| void osg::StateSet::setAssociatedModes | ( | const StateAttribute * | attribute, |
| StateAttribute::GLModeValue | value ) |
References osg::StateAttribute.
| void osg::StateSet::setAssociatedTextureModes | ( | unsigned int | unit, |
| const StateAttribute * | attribute, | ||
| StateAttribute::GLModeValue | value ) |
References osg::StateAttribute.
|
protected |
References osg::StateAttribute::OFF, and osg::StateAttribute.
|
inline |
References osg::ref_ptr< T >::get(), osg::StateAttribute::OFF, and setAttribute().
Referenced by setAttribute().
| 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.
|
inline |
References osg::ref_ptr< T >::get(), osg::StateAttribute::ON, and setAttributeAndModes().
Referenced by setAttributeAndModes().
| 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.
|
inline |
set the list of all StateAttributes contained in this StateSet.
References _attributeList.
|
inline |
Set the render bin name.
References _binName.
|
inline |
Set the render bin number.
References _binNum.
| 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.
| 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.
|
inline |
Set the list of defines to pass on to shaders.
References _defineList.
| 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.
|
inline |
References osg::ref_ptr< T >::get(), and setEventCallback().
Referenced by setEventCallback().
| 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.
|
protected |
| void osg::StateSet::setMode | ( | StateAttribute::GLMode | mode, |
| StateAttribute::GLModeValue | value ) |
Set this StateSet to contain the specified GLMode with a given value.
setTextureMode(), that accepts an extra parameter specifying which texture unit shall be affected by the call. Referenced by osgPresentation::SlideShowConstructor::createTransformStateSet().
|
inline |
|
protected |
|
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.
|
protected |
|
protected |
| void osg::StateSet::setRenderBinDetails | ( | int | binNum, |
| const std::string & | binName, | ||
| RenderBinMode | mode = USE_RENDERBIN_DETAILS ) |
Set the render bin details.
References USE_RENDERBIN_DETAILS.
|
inline |
Set the render bin mode.
References _binMode.
| void osg::StateSet::setRenderBinToInherit | ( | ) |
Set the render bin details to inherit.
| 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).
|
inline |
References osg::ref_ptr< T >::get(), osg::StateAttribute::OFF, and setTextureAttribute().
Referenced by setTextureAttribute().
| 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.
|
inline |
References osg::ref_ptr< T >::get(), osg::StateAttribute::ON, and setTextureAttributeAndModes().
Referenced by setTextureAttributeAndModes().
| 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.
|
inline |
Set the list of all Texture related StateAttributes contained in this StateSet.
References _textureAttributeList.
| void osg::StateSet::setTextureMode | ( | unsigned int | unit, |
| StateAttribute::GLMode | mode, | ||
| StateAttribute::GLModeValue | value ) |
|
inline |
set the list of all Texture related GLModes contained in this StateSet.
References _textureModeList.
|
virtual |
Set whether to use a mutex to ensure ref() and unref() are thread safe.
Reimplemented from osg::Object.
|
inline |
set the list of all Uniforms contained in this StateSet.
References _uniformList.
| 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.
|
inline |
References osg::ref_ptr< T >::get(), and setUpdateCallback().
Referenced by setUpdateCallback().
|
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().
|
friend |
|
friend |
Referenced by getParent(), and getParent().
|
friend |
Referenced by getAttribute(), getAttribute(), getAttribute(), getAttribute(), getTextureAttribute(), getTextureAttribute(), removeAssociatedModes(), removeAssociatedTextureModes(), removeAttribute(), removeTextureAttribute(), setAssociatedModes(), setAssociatedTextureModes(), setAttribute(), setAttribute(), setAttributeAndModes(), setTextureAttribute(), and setTextureAttributeAndModes().
|
friend |
Referenced by addUniform(), getOrCreateUniform(), getUniform(), getUniform(), and removeUniform().
|
protected |
Referenced by getAttributeList(), getAttributeList(), and setAttributeList().
|
protected |
Referenced by getRenderBinMode(), setRenderBinMode(), and useRenderBinDetails().
|
protected |
Referenced by getBinName(), and setBinName().
|
protected |
Referenced by getBinNumber(), and setBinNumber().
|
protected |
Referenced by getDefineList(), getDefineList(), getDefinePair(), getDefinePair(), and setDefineList().
Referenced by getEventCallback(), getEventCallback(), and requiresEventTraversal().
|
protected |
Referenced by getModeList(), getModeList(), and setModeList().
|
protected |
Referenced by getNestRenderBins(), and setNestRenderBins().
|
protected |
Referenced by getNumChildrenRequiringEventTraversal().
|
protected |
Referenced by getNumChildrenRequiringUpdateTraversal().
|
protected |
Referenced by getNumParents(), getParent(), getParent(), getParents(), and getParents().
|
protected |
Referenced by getRenderingHint().
|
protected |
|
protected |
|
protected |
Referenced by getUniformList(), getUniformList(), and setUniformList().
Referenced by getUpdateCallback(), getUpdateCallback(), and requiresUpdateTraversal().