26#ifndef GL_RESCALE_NORMAL
28#define GL_RESCALE_NORMAL 0x803A
57 virtual const char*
className()
const {
return "StateSet"; }
119 typedef std::map<StateAttribute::GLMode,StateAttribute::GLModeValue>
ModeList;
166 typedef std::map<StateAttribute::TypeMemberPair,RefAttributePair>
AttributeList;
345 typedef std::pair<std::string, StateAttribute::OverrideValue>
DefinePair;
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
OSG_EXPORT bool isTextureMode(StateAttribute::GLMode mode)
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
Pure virtual base class for drawable geometry.
Definition Drawable:89
Base class for all internal nodes in the scene graph.
Definition Node:72
Visitor for type safe operations on osg::Nodes.
Definition NodeVisitor:82
Base class/standard interface for objects which require IO support, cloning and reference counting.
Definition Object:61
Object()
Construct an object.
Definition Object:69
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
T * get() const
Definition ref_ptr:117
Encapsulates the current applied OpenGL modes, attributes and vertex arrays settings,...
Definition State:80
Base class for state attributes.
Definition StateAttribute:77
GLenum GLMode
GLMode is the value used in glEnable/glDisable(mode)
Definition StateAttribute:81
@ OFF
means that associated GLMode and Override is disabled.
Definition StateAttribute:101
@ ON
means that associated GLMode is enabled and Override is disabled.
Definition StateAttribute:103
unsigned int GLModeValue
GLModeValue is used to specify whether a mode is enabled (ON) or disabled (OFF).
Definition StateAttribute:85
Type
Type identifier to differentiate between different state types.
Definition StateAttribute:124
unsigned int OverrideValue
Override is used to specify the override behavior of StateAttributes from parent to children.
Definition StateAttribute:89
TextureAttributeList & getTextureAttributeList()
Return the list of all Texture related StateAttributes contained in this StateSet.
Definition StateSet:283
virtual bool isSameKindAs(const Object *obj) const
Definition StateSet:55
int compareAttributePtrs(const AttributeList &lhs, const AttributeList &rhs)
UniformList _uniformList
Definition StateSet:544
void setTextureMode(unsigned int unit, StateAttribute::GLMode mode, StateAttribute::GLModeValue value)
Set this StateSet to contain specified GLMode with a given value.
bool getNestRenderBins() const
Get whether associated RenderBin should be nested within parents RenderBin.
Definition StateSet:442
void setTextureAttributeAndModes(unsigned int unit, const ref_ptr< T > &attribute, StateAttribute::OverrideValue value=StateAttribute::ON)
Definition StateSet:253
virtual const char * className() const
return the name of the object's class type.
Definition StateSet:57
RefAttributePair * getTextureAttributePair(unsigned int unit, StateAttribute::Type type)
Get specified Texture related RefAttributePair for specified type.
void setMode(ModeList &modeList, StateAttribute::GLMode mode, StateAttribute::GLModeValue value)
friend class osg::StateAttribute
Definition StateSet:536
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...
StateAttribute * getTextureAttribute(unsigned int unit, StateAttribute::Type type)
Get specified Texture related StateAttribute for specified type.
int _binNum
Definition StateSet:578
bool _nestRenderBins
Definition StateSet:580
const StateAttribute * getTextureAttribute(unsigned int unit, StateAttribute::Type type) const
Get specified Texture related const StateAttribute for specified type.
void removeUniform(const ref_ptr< T > &uniform)
Definition StateSet:318
StateAttribute * getAttribute(AttributeList &attributeList, StateAttribute::Type type, unsigned int member)
std::vector< ModeList > TextureModeList
Definition StateSet:213
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.
const std::string & getBinName() const
Get the render bin name.
Definition StateSet:430
bool requiresUpdateTraversal() const
Return whether this StateSet has update callbacks associated with it, and therefore must be traversed...
Definition StateSet:474
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 ...
UniformList & getUniformList()
return the list of all Uniforms contained in this StateSet.
Definition StateSet:339
void setNumChildrenRequiringUpdateTraversal(unsigned int num)
void setEventCallback(const ref_ptr< T > &ec)
Definition StateSet:487
const ParentList & getParents() const
Get the parent list of this StateSet.
Definition StateSet:79
void setAssociatedTextureModes(unsigned int unit, const StateAttribute *attribute, StateAttribute::GLModeValue value)
const StateAttribute * getAttribute(const AttributeList &attributeList, StateAttribute::Type type, unsigned int member) const
void setTextureAttributeList(TextureAttributeList &tal)
Set the list of all Texture related StateAttributes contained in this StateSet.
Definition StateSet:280
void removeDefine(const std::string &defineName)
Remove define.
void removeAttribute(const ref_ptr< T > &attribute)
Definition StateSet:184
const DefinePair * getDefinePair(const std::string &defineName) const
Definition StateSet:355
virtual void releaseGLObjects(State *state=0) const
call release on all StateAttributes contained within this StateSet.
const StateAttribute * getAttribute(StateAttribute::Type type, unsigned int member=0) const
Get specified const StateAttribute for specified type.
Callback * getUpdateCallback()
Get the non const Update Callback.
Definition StateSet:468
ModeList _modeList
Definition StateSet:538
std::vector< AttributeList > TextureAttributeList
Definition StateSet:243
void setUpdateCallback(const ref_ptr< T > &ac)
Definition StateSet:465
RenderBinMode
Definition StateSet:397
@ PROTECTED_RENDERBIN_DETAILS
Definition StateSet:401
@ INHERIT_RENDERBIN_DETAILS
Definition StateSet:398
@ USE_RENDERBIN_DETAILS
Definition StateSet:399
@ OVERRIDE_PROTECTED_RENDERBIN_DETAILS
Definition StateSet:402
@ OVERRIDE_RENDERBIN_DETAILS
Definition StateSet:400
void setAttributeAndModes(const ref_ptr< T > &attribute, StateAttribute::GLModeValue value=StateAttribute::ON)
Definition StateSet:176
bool useRenderBinDetails() const
Get whether the render bin details are set and should be used.
Definition StateSet:412
void setAttribute(AttributeList &attributeList, StateAttribute *attribute, StateAttribute::OverrideValue value=StateAttribute::OFF)
void setRenderBinDetails(int binNum, const std::string &binName, RenderBinMode mode=USE_RENDERBIN_DETAILS)
Set the render bin details.
void removeAssociatedModes(const StateAttribute *attribute)
void setModeList(ModeList &ml)
Set the list of all GLModes contained in this StateSet.
Definition StateSet:150
int getBinNumber() const
Get the render bin number.
Definition StateSet:424
StateSet(const StateSet &, const CopyOp ©op=CopyOp::SHALLOW_COPY)
void setAttributeList(AttributeList &al)
set the list of all StateAttributes contained in this StateSet.
Definition StateSet:203
AttributeList _attributeList
Definition StateSet:539
DefineList _defineList
Definition StateSet:545
const RefUniformPair * getUniformPair(const std::string &name) const
Get specified RefUniformPair for specified Uniform name.
const UniformList & getUniformList() const
return the const list of all Uniforms contained in this const StateSet.
Definition StateSet:342
void clear()
Clear the StateSet of all modes and attributes.
virtual const StateSet * asStateSet() const
convert 'const this' into a const StateSet pointer if Object is a StateSet, otherwise return 0.
Definition StateSet:72
const TextureAttributeList & getTextureAttributeList() const
Return the const list of all Texture related StateAttributes contained in this const StateSet.
Definition StateSet:286
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.
const RefAttributePair * getAttributePair(const AttributeList &attributeList, StateAttribute::Type type, unsigned int member) const
unsigned int getNumTextureModeLists() const
Return the number texture units active in the TextureModeList.
Definition StateSet:241
DefineList & getDefineList()
Get the list of defines to pass on to shaders.
Definition StateSet:366
std::pair< ref_ptr< Uniform >, StateAttribute::OverrideValue > RefUniformPair
Simple pairing between a Uniform and its override flag.
Definition StateSet:302
StateAttribute::GLModeValue getTextureMode(unsigned int unit, StateAttribute::GLMode mode) const
Get specified GLModeValue for specified GLMode.
void setAssociatedModes(const StateAttribute *attribute, StateAttribute::GLModeValue value)
std::map< std::string, RefUniformPair > UniformList
a container to map Uniform name to its respective RefUniformPair.
Definition StateSet:305
ParentList getParents()
Get the a copy of parent list of node.
Definition StateSet:83
const RefAttributePair * getAttributePair(StateAttribute::Type type, unsigned int member=0) const
Get specified RefAttributePair for specified type.
void removeAttribute(StateAttribute::Type type, unsigned int member=0)
remove attribute of specified type from StateSet.
ref_ptr< Callback > _eventCallback
Definition StateSet:586
void setNestRenderBins(bool val)
By default render bins will be nested within each other dependent upon where they are set in the scen...
Definition StateSet:439
void runEventCallbacks(osg::NodeVisitor *nv)
Run the event callbacks attached directly to this StateSet or to its children.
const AttributeList & getAttributeList() const
return the const list of all StateAttributes contained in this const StateSet.
Definition StateSet:209
const Callback * getUpdateCallback() const
Get the const Update Callback.
Definition StateSet:471
virtual Object * cloneType() const
Clone the type of an object, with Object* return type.
Definition StateSet:53
StateAttribute::GLModeValue getMode(const ModeList &modeList, StateAttribute::GLMode mode) const
bool requiresEventTraversal() const
Return whether this StateSet has event callbacks associated with it, and therefore must be traversed.
Definition StateSet:496
void setUpdateCallback(Callback *ac)
Set the Update Callback which allows users to attach customize the updating of an object during the u...
void removeTextureAttribute(unsigned int unit, StateAttribute::Type type)
remove texture attribute of specified type from StateSet.
void setTextureModeList(TextureModeList &tml)
set the list of all Texture related GLModes contained in this StateSet.
Definition StateSet:232
virtual void setThreadSafeRefUnref(bool threadSafe)
Set whether to use a mutex to ensure ref() and unref() are thread safe.
void removeAttribute(StateAttribute *attribute)
remove attribute from StateSet.
Uniform * getUniform(const std::string &name)
Get Uniform for specified name.
TextureModeList & getTextureModeList()
return the list of all Texture related GLModes contained in this StateSet.
Definition StateSet:235
void setAttribute(StateAttribute *attribute, StateAttribute::OverrideValue value=StateAttribute::OFF)
Set this StateSet to contain specified attribute and override flag.
virtual const char * libraryName() const
return the name of the object's library.
Definition StateSet:56
void runUpdateCallbacks(osg::NodeVisitor *nv)
Run the update callbacks attached directly to this StateSet or to its children.
int compare(const StateSet &rhs, bool compareAttributeContents=false) const
return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.
const TextureModeList & getTextureModeList() const
return the const list of all Texture related GLModes contained in this const StateSet.
Definition StateSet:238
std::map< StateAttribute::TypeMemberPair, RefAttributePair > AttributeList
a container to map <StateAttribyte::Types,Member> to their respective RefAttributePair.
Definition StateSet:166
RenderingHint
Definition StateSet:374
@ TRANSPARENT_BIN
Definition StateSet:377
@ OPAQUE_BIN
Definition StateSet:376
@ DEFAULT_BIN
Definition StateSet:375
void setTextureAttribute(unsigned int unit, const ref_ptr< T > &attribute, StateAttribute::OverrideValue value=StateAttribute::OFF)
Definition StateSet:248
void addUniform(Uniform *uniform, StateAttribute::OverrideValue value=StateAttribute::ON)
Set this StateSet to contain specified uniform and override flag.
friend class osg::Uniform
Definition StateSet:535
void setDefineList(const DefineList &dl)
Set the list of defines to pass on to shaders.
Definition StateSet:363
DefinePair * getDefinePair(const std::string &defineName)
Definition StateSet:354
void removeTextureMode(unsigned int unit, StateAttribute::GLMode mode)
Remove texture mode from StateSet.
const DefineList & getDefineList() const
Get the const list of defines to pass on to shaders.
Definition StateSet:369
ModeList & getOrCreateTextureModeList(unsigned int unit)
Definition StateSet:547
RenderBinMode _binMode
Definition StateSet:577
void setBinName(const std::string &name)
Set the render bin name.
Definition StateSet:427
Node * getParent(unsigned int i)
Definition StateSet:85
void setUniformList(UniformList &al)
set the list of all Uniforms contained in this StateSet.
Definition StateSet:336
StateAttribute * getAttribute(StateAttribute::Type type, unsigned int member=0)
Get specified StateAttribute for specified type.
void removeTextureAttribute(unsigned int unit, const ref_ptr< T > &attribute)
Definition StateSet:261
friend class osg::Node
Definition StateSet:533
virtual void computeDataVariance()
Compute the DataVariance based on an assessment of callback etc.
virtual Object * clone(const CopyOp ©op) const
Clone an object, with Object* return type.
Definition StateSet:54
void setNumChildrenRequiringEventTraversal(unsigned int num)
void setEventCallback(Callback *ac)
Set the Event Callback which allows users to attach customize the updating of an object during the ev...
const Node * getParent(unsigned int i) const
Get a single const parent of this StateSet.
Definition StateSet:91
int compareAttributeContents(const AttributeList &lhs, const AttributeList &rhs)
Uniform * 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...
void setModeToInherit(ModeList &modeList, StateAttribute::GLMode mode)
void setRenderBinMode(RenderBinMode mode)
Set the render bin mode.
Definition StateSet:415
virtual StateSet * asStateSet()
Convert 'this' into a StateSet pointer if Object is a StateSet, otherwise return 0.
Definition StateSet:68
int compareModes(const ModeList &lhs, const ModeList &rhs)
void merge(const StateSet &rhs)
Merge this StateSet with the StateSet passed as parameter.
const ModeList & getModeList() const
Return the const list of all GLModes contained in this const StateSet.
Definition StateSet:158
StateAttribute::GLModeValue getMode(StateAttribute::GLMode mode) const
Get the value for a given GLMode.
TextureAttributeList _textureAttributeList
Definition StateSet:542
unsigned int _numChildrenRequiringUpdateTraversal
Definition StateSet:583
RenderBinMode getRenderBinMode() const
Get the render bin mode.
Definition StateSet:418
void removeTextureAttribute(unsigned int unit, StateAttribute *attribute)
remove texture attribute from StateSet.
void removeUniform(const std::string &name)
remove uniform of specified name from StateSet.
unsigned int getNumChildrenRequiringEventTraversal() const
Get the number of Objects of this StateSet which require Event traversal, since they have an Eevnt Ca...
Definition StateSet:500
std::vector< Node * > ParentList
A vector of osg::Object pointers which is used to store the parent(s) of this Stateset,...
Definition StateSet:76
ref_ptr< Callback > _updateCallback
Definition StateSet:582
Callback * getEventCallback()
Get the non const Event Callback.
Definition StateSet:490
int _renderingHint
Definition StateSet:575
void removeAssociatedTextureModes(unsigned int unit, const StateAttribute *attribute)
AttributeList & getOrCreateTextureAttributeList(unsigned int unit)
Definition StateSet:553
void removeMode(StateAttribute::GLMode mode)
Remove mode from this StateSet.
virtual void resizeGLObjectBuffers(unsigned int maxSize)
Resize any per context GLObject buffers to specified size.
AttributeList & getAttributeList()
return the list of all StateAttributes contained in this StateSet.
Definition StateSet:206
unsigned int getNumChildrenRequiringUpdateTraversal() const
Get the number of Objects of this StateSet which require Update traversal, since they have an Update ...
Definition StateSet:478
void addUniform(const ref_ptr< T > &uniform, StateAttribute::OverrideValue value=StateAttribute::ON)
Definition StateSet:310
std::pair< std::string, StateAttribute::OverrideValue > DefinePair
Definition StateSet:345
void setRenderingHint(int hint)
Set the RenderingHint of this StateSet.
bool checkValidityOfAssociatedModes(State &state) const
Check the modes associated with this StateSet are supported by current OpenGL drivers,...
std::map< StateAttribute::GLMode, StateAttribute::GLModeValue > ModeList
a container to map GLModes to their respective GLModeValues.
Definition StateSet:119
RefAttributePair * getAttributePair(StateAttribute::Type type, unsigned int member=0)
Get specified RefAttributePair for specified type.
ModeList & getModeList()
Return the list of all GLModes contained in this StateSet.
Definition StateSet:153
std::string _binName
Definition StateSet:579
void setBinNumber(int num)
Set the render bin number.
Definition StateSet:421
void setMode(StateAttribute::GLMode mode, StateAttribute::GLModeValue value)
Set this StateSet to contain the specified GLMode with a given value.
unsigned int getNumParents() const
Get the number of parents of this StateSet.
Definition StateSet:97
unsigned int getNumTextureAttributeLists() const
Return the number of texture units active in the TextureAttributeList.
Definition StateSet:289
void removeUniform(Uniform *uniform)
remove Uniform from StateSet.
const Callback * getEventCallback() const
Get the const Event Callback.
Definition StateSet:493
void setGlobalDefaults()
Set all the modes to on or off so that it defines a complete state, typically used for a default glob...
std::pair< ref_ptr< StateAttribute >, StateAttribute::OverrideValue > RefAttributePair
Simple pairing between an attribute and its override flag.
Definition StateSet:163
void setRenderBinToInherit()
Set the render bin details to inherit.
ParentList _parents
Definition StateSet:532
void addParent(osg::Node *object)
int getRenderingHint() const
Get the RenderingHint of this StateSet.
Definition StateSet:394
void removeParent(osg::Node *object)
std::map< std::string, DefinePair > DefineList
Definition StateSet:346
const RefAttributePair * getTextureAttributePair(unsigned int unit, StateAttribute::Type type) const
Get specified Texture related RefAttributePair for specified type.
TextureModeList _textureModeList
Definition StateSet:541
unsigned int _numChildrenRequiringEventTraversal
Definition StateSet:587
void compileGLObjects(State &state) const
call compile on all StateAttributes contained within this StateSet.
RefAttributePair * getAttributePair(AttributeList &attributeList, StateAttribute::Type type, unsigned int member)
const Uniform * getUniform(const std::string &name) const
Get const Uniform for specified name.
void setAttribute(const ref_ptr< T > &attribute, StateAttribute::OverrideValue value=StateAttribute::OFF)
Definition StateSet:171
void setTextureAttribute(unsigned int unit, StateAttribute *attribute, StateAttribute::OverrideValue value=StateAttribute::OFF)
Set this StateSet to contain specified attribute and override flag.
Callback()
Definition StateSet:447
Callback(const Callback &org, const CopyOp ©op)
Definition StateSet:449
META_Object(osg, Callback)
virtual bool run(osg::Object *object, osg::Object *data)
override Callback::run() entry point to adapt to StateAttributeCallback::run(..) method.
Uniform encapsulates glUniform values.
Definition Uniform:414
Type
Definition Uniform:416
#define NULL
Definition Export:55
#define OSG_EXPORT
Definition Export:39