OSG
3.4.0
|
#include <StateSet.h>
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 |
![]() | |
std::string | _name |
DataVariance | _dataVariance |
osg::UserDataContainer * | _userDataContainer |
![]() | |
OpenThreads::AtomicPtr | _observerSet |
OpenThreads::Atomic | _refCount |
Friends | |
class | osg::Node |
class | osg::Drawable |
class | osg::Uniform |
class | osg::StateAttribute |
Additional Inherited Members | |
![]() | |
static OpenThreads::Mutex * | getGlobalReferencedMutex () |
static void | setThreadSafeReferenceCounting (bool enableThreadSafeReferenceCounting) |
static bool | getThreadSafeReferenceCounting () |
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 StateSet
s can be shared between different Drawable
s and Node
s (that is, several Drawable
s and Node
s can reference the same StateSet
). Indeed, this practice is recommended whenever possible, as this minimizes expensive state changes in the graphics pipeline.
Definition at line 45 of file StateSet.h.
typedef std::map<StateAttribute::TypeMemberPair,RefAttributePair> osg::StateSet::AttributeList |
a container to map <StateAttribyte::Types,Member> to their respective RefAttributePair.
Definition at line 158 of file StateSet.h.
typedef std::map<std::string, DefinePair> osg::StateSet::DefineList |
Definition at line 313 of file StateSet.h.
typedef std::pair<std::string, StateAttribute::OverrideValue> osg::StateSet::DefinePair |
Definition at line 312 of file StateSet.h.
typedef std::map<StateAttribute::GLMode,StateAttribute::GLModeValue> osg::StateSet::ModeList |
a container to map GLModes to their respective GLModeValues.
Definition at line 111 of file StateSet.h.
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.
Definition at line 68 of file StateSet.h.
typedef std::pair<ref_ptr<StateAttribute>,StateAttribute::OverrideValue> osg::StateSet::RefAttributePair |
Simple pairing between an attribute and its override flag.
Definition at line 155 of file StateSet.h.
typedef std::pair<ref_ptr<Uniform>,StateAttribute::OverrideValue> osg::StateSet::RefUniformPair |
Simple pairing between a Uniform and its override flag.
Definition at line 273 of file StateSet.h.
typedef std::vector<AttributeList> osg::StateSet::TextureAttributeList |
Definition at line 225 of file StateSet.h.
typedef std::vector<ModeList> osg::StateSet::TextureModeList |
Definition at line 195 of file StateSet.h.
typedef std::map<std::string,RefUniformPair> osg::StateSet::UniformList |
a container to map Uniform name to its respective RefUniformPair.
Definition at line 276 of file StateSet.h.
Enumerator | |
---|---|
INHERIT_RENDERBIN_DETAILS | |
USE_RENDERBIN_DETAILS | |
OVERRIDE_RENDERBIN_DETAILS | |
PROTECTED_RENDERBIN_DETAILS | |
OVERRIDE_PROTECTED_RENDERBIN_DETAILS |
Definition at line 363 of file StateSet.h.
Enumerator | |
---|---|
DEFAULT_BIN | |
OPAQUE_BIN | |
TRANSPARENT_BIN |
Definition at line 340 of file StateSet.h.
osg::StateSet::StateSet | ( | ) |
osg::StateSet::StateSet | ( | const StateSet & | , |
const CopyOp & | copyop = CopyOp::SHALLOW_COPY |
||
) |
|
protectedvirtual |
void osg::StateSet::addUniform | ( | Uniform * | uniform, |
StateAttribute::OverrideValue | value = StateAttribute::ON |
||
) |
Set this StateSet to contain specified uniform and override flag.
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.
Definition at line 57 of file StateSet.h.
Clone an object, with Object* return type. Must be defined by derived classes.
Implements osg::Object.
Definition at line 54 of file StateSet.h.
|
inlinevirtual |
Clone the type of an object, with Object* return type. Must be defined by derived classes.
Implements osg::Object.
Definition at line 53 of file StateSet.h.
int osg::StateSet::compare | ( | const StateSet & | rhs, |
bool | compareAttributeContents = false |
||
) | const |
return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.
|
protected |
|
protected |
call compile on all StateAttributes contained within this StateSet.
|
virtual |
Compute the DataVariance based on an assessment of callback etc.
Reimplemented from osg::Object.
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.
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.
|
protected |
|
protected |
|
inline |
return the list of all StateAttributes contained in this StateSet.
Definition at line 188 of file StateSet.h.
|
inline |
return the const list of all StateAttributes contained in this const StateSet.
Definition at line 191 of file StateSet.h.
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.
|
protected |
|
inline |
Get the render bin name.
Definition at line 397 of file StateSet.h.
|
inline |
Get the render bin number.
Definition at line 391 of file StateSet.h.
|
inline |
Get the list of defines to pass on to shaders.
Definition at line 333 of file StateSet.h.
|
inline |
Get the const list of defines to pass on to shaders.
Definition at line 336 of file StateSet.h.
|
inline |
Definition at line 321 of file StateSet.h.
|
inline |
Definition at line 322 of file StateSet.h.
|
inline |
Get the non const Event Callback.
Definition at line 451 of file StateSet.h.
|
inline |
Get the const Event Callback.
Definition at line 454 of file StateSet.h.
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.
|
protected |
|
inline |
Return the list of all GLMode
s contained in this StateSet
.
Definition at line 145 of file StateSet.h.
|
inline |
Return the const
list of all GLMode
s contained in this const StateSet
.
Definition at line 150 of file StateSet.h.
|
inline |
Get whether associated RenderBin should be nested within parents RenderBin.
Definition at line 409 of file StateSet.h.
|
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.
Definition at line 461 of file StateSet.h.
|
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.
Definition at line 441 of file StateSet.h.
|
inline |
Get the number of parents of this StateSet.
Definition at line 89 of file StateSet.h.
|
inline |
Return the number of texture units active in the TextureAttributeList.
Definition at line 260 of file StateSet.h.
|
inline |
Return the number texture units active in the TextureModeList.
Definition at line 223 of file StateSet.h.
|
inlineprotected |
Definition at line 514 of file StateSet.h.
|
inlineprotected |
Definition at line 508 of file StateSet.h.
Uniform* osg::StateSet::getOrCreateUniform | ( | const std::string & | name, |
Uniform::Type | type, | ||
unsigned int | numElements = 1 |
||
) |
|
inline |
Definition at line 77 of file StateSet.h.
|
inline |
Get a single const parent of this StateSet.
i | index of the parent to get. |
Definition at line 83 of file StateSet.h.
|
inline |
Get the parent list of this StateSet.
Definition at line 71 of file StateSet.h.
|
inline |
Get the a copy of parent list of node. A copy is returned to prevent modification of the parent list.
Definition at line 75 of file StateSet.h.
|
inline |
Get the render bin mode.
Definition at line 385 of file StateSet.h.
|
inline |
Get the RenderingHint
of this StateSet
.
Definition at line 361 of file StateSet.h.
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.
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.
|
inline |
Return the list of all Texture related StateAttributes contained in this StateSet.
Definition at line 254 of file StateSet.h.
|
inline |
Return the const list of all Texture related StateAttributes contained in this const StateSet.
Definition at line 257 of file StateSet.h.
const RefAttributePair* osg::StateSet::getTextureAttributePair | ( | unsigned int | unit, |
StateAttribute::Type | type | ||
) | const |
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.
Definition at line 217 of file StateSet.h.
|
inline |
return the const list of all Texture related GLModes contained in this const StateSet.
Definition at line 220 of file StateSet.h.
Uniform* osg::StateSet::getUniform | ( | const std::string & | name | ) |
const Uniform* osg::StateSet::getUniform | ( | const std::string & | name | ) | const |
|
inline |
return the list of all Uniforms contained in this StateSet.
Definition at line 306 of file StateSet.h.
|
inline |
return the const list of all Uniforms contained in this const StateSet.
Definition at line 309 of file StateSet.h.
const RefUniformPair* osg::StateSet::getUniformPair | ( | const std::string & | name | ) | const |
|
inline |
Get the non const Update Callback.
Definition at line 431 of file StateSet.h.
|
inline |
Get the const Update Callback.
Definition at line 434 of file StateSet.h.
|
inlinevirtual |
Reimplemented from osg::Object.
Definition at line 55 of file StateSet.h.
|
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.
Definition at line 56 of file StateSet.h.
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
.
|
inline |
Definition at line 64 of file StateSet.h.
|
inline |
Definition at line 62 of file StateSet.h.
Definition at line 488 of file StateSet.h.
|
inline |
Definition at line 63 of file StateSet.h.
call release on all StateAttributes contained within this StateSet.
Reimplemented from osg::Object.
void osg::StateSet::removeAssociatedModes | ( | const StateAttribute * | attribute | ) |
void osg::StateSet::removeAssociatedTextureModes | ( | unsigned int | unit, |
const StateAttribute * | attribute | ||
) |
void osg::StateSet::removeAttribute | ( | StateAttribute::Type | type, |
unsigned int | member = 0 |
||
) |
remove attribute of specified type from StateSet.
void osg::StateSet::removeAttribute | ( | StateAttribute * | attribute | ) |
remove attribute 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. void osg::StateSet::removeTextureAttribute | ( | unsigned int | unit, |
StateAttribute::Type | type | ||
) |
remove texture attribute of specified type from StateSet.
void osg::StateSet::removeTextureAttribute | ( | unsigned int | unit, |
StateAttribute * | attribute | ||
) |
remove texture attribute from StateSet.
void osg::StateSet::removeTextureMode | ( | unsigned int | unit, |
StateAttribute::GLMode | mode | ||
) |
Remove texture mode from StateSet.
void osg::StateSet::removeUniform | ( | const std::string & | name | ) |
remove uniform of specified name from StateSet.
|
inline |
Return whether this StateSet has event callbacks associated with it, and therefore must be traversed.
Definition at line 457 of file StateSet.h.
|
inline |
Return whether this StateSet has update callbacks associated with it, and therefore must be traversed.
Definition at line 437 of file StateSet.h.
|
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.
void osg::StateSet::runUpdateCallbacks | ( | osg::NodeVisitor * | nv | ) |
Run the update callbacks attached directly to this StateSet or to its children.
void osg::StateSet::setAssociatedModes | ( | const StateAttribute * | attribute, |
StateAttribute::GLModeValue | value | ||
) |
void osg::StateSet::setAssociatedTextureModes | ( | unsigned int | unit, |
const StateAttribute * | attribute, | ||
StateAttribute::GLModeValue | value | ||
) |
void osg::StateSet::setAttribute | ( | StateAttribute * | attribute, |
StateAttribute::OverrideValue | value = StateAttribute::OFF |
||
) |
Set this StateSet to contain specified attribute and override flag.
|
protected |
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.
|
inline |
set the list of all StateAttributes contained in this StateSet.
Definition at line 185 of file StateSet.h.
|
inline |
Set the render bin name.
Definition at line 394 of file StateSet.h.
|
inline |
Set the render bin number.
Definition at line 388 of file StateSet.h.
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(..).
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(..).
|
inline |
Set the list of defines to pass on to shaders.
Definition at line 330 of file StateSet.h.
Set the Event Callback which allows users to attach customize the updating of an object during the event traversal.
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.
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.
|
protected |
Set the list of all GLMode
s contained in this StateSet
.
Definition at line 142 of file StateSet.h.
|
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).
Definition at line 406 of file StateSet.h.
|
protected |
|
protected |
void osg::StateSet::setRenderBinDetails | ( | int | binNum, |
const std::string & | binName, | ||
RenderBinMode | mode = USE_RENDERBIN_DETAILS |
||
) |
Set the render bin details.
|
inline |
Set the render bin mode.
Definition at line 382 of file StateSet.h.
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::Drawable
s in. Typically, users will set this to either StateSet::OPAQUE_BIN
or StateSet::TRANSPARENT_BIN
. Drawable
s in the opaque bin are sorted by their StateSet
, so that the number of expensive changes in the OpenGL state is minimized. Drawable
s 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).
void osg::StateSet::setTextureAttribute | ( | unsigned int | unit, |
StateAttribute * | attribute, | ||
StateAttribute::OverrideValue | value = StateAttribute::OFF |
||
) |
Set this StateSet to contain specified attribute and override flag.
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.
|
inline |
Set the list of all Texture related StateAttributes contained in this StateSet.
Definition at line 251 of file StateSet.h.
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.
Definition at line 214 of file StateSet.h.
|
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.
Definition at line 303 of file StateSet.h.
Set the Update Callback which allows users to attach customize the updating of an object during the update traversal.
|
inline |
Get whether the render bin details are set and should be used.
Definition at line 379 of file StateSet.h.
|
friend |
Definition at line 495 of file StateSet.h.
|
friend |
Definition at line 494 of file StateSet.h.
|
friend |
Definition at line 497 of file StateSet.h.
|
friend |
Definition at line 496 of file StateSet.h.
|
protected |
Definition at line 500 of file StateSet.h.
|
protected |
Definition at line 536 of file StateSet.h.
|
protected |
Definition at line 538 of file StateSet.h.
|
protected |
Definition at line 537 of file StateSet.h.
|
protected |
Definition at line 506 of file StateSet.h.
Definition at line 545 of file StateSet.h.
|
protected |
Definition at line 499 of file StateSet.h.
|
protected |
Definition at line 539 of file StateSet.h.
|
protected |
Definition at line 546 of file StateSet.h.
|
protected |
Definition at line 542 of file StateSet.h.
|
protected |
Definition at line 493 of file StateSet.h.
|
protected |
Definition at line 534 of file StateSet.h.
|
protected |
Definition at line 503 of file StateSet.h.
|
protected |
Definition at line 502 of file StateSet.h.
|
protected |
Definition at line 505 of file StateSet.h.
Definition at line 541 of file StateSet.h.