1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
18#include <osg/StateAttribute>
26#ifndef GL_RESCALE_NORMAL
27// allow compilation against GL1.1 headers.
28#define GL_RESCALE_NORMAL 0x803A
33// forward declare for the purposes of the UpdateCallback.
36/** Stores a set of modes and attributes which represent a set of OpenGL state.
37 * Notice that a \c StateSet contains just a subset of the whole OpenGL state.
38 * <p>In OSG, each \c Drawable and each \c Node has a reference to a
39 * \c StateSet. These <tt>StateSet</tt>s can be shared between
40 * different <tt>Drawable</tt>s and <tt>Node</tt>s (that is, several
41 * <tt>Drawable</tt>s and <tt>Node</tt>s can reference the same \c StateSet).
42 * Indeed, this practice is recommended whenever possible,
43 * as this minimizes expensive state changes in the graphics pipeline.
45class OSG_EXPORT StateSet : public Object
51 StateSet(const StateSet&,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
53 virtual Object* cloneType() const { return new StateSet(); }
54 virtual Object* clone(const CopyOp& copyop) const { return new StateSet(*this,copyop); }
55 virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const StateSet*>(obj)!=NULL; }
56 virtual const char* libraryName() const { return "osg"; }
57 virtual const char* className() const { return "StateSet"; }
59 /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/
60 int compare(const StateSet& rhs,bool compareAttributeContents=false) const;
62 bool operator < (const StateSet& rhs) const { return compare(rhs)<0; }
63 bool operator == (const StateSet& rhs) const { return compare(rhs)==0; }
64 bool operator != (const StateSet& rhs) const { return compare(rhs)!=0; }
66 /** Convert 'this' into a StateSet pointer if Object is a StateSet, otherwise return 0.
67 * Equivalent to dynamic_cast<StateSet*>(this).*/
68 virtual StateSet* asStateSet() { return this; }
70 /** convert 'const this' into a const StateSet pointer if Object is a StateSet, otherwise return 0.
71 * Equivalent to dynamic_cast<const StateSet*>(this).*/
72 virtual const StateSet* asStateSet() const { return this; }
75 /** 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.*/
76 typedef std::vector<Node*> ParentList;
78 /** Get the parent list of this StateSet. */
79 inline const ParentList& getParents() const { return _parents; }
81 /** Get the a copy of parent list of node. A copy is returned to
82 * prevent modification of the parent list.*/
83 inline ParentList getParents() { return _parents; }
85 inline Node* getParent(unsigned int i) { return _parents[i]; }
87 * Get a single const parent of this StateSet.
88 * @param i index of the parent to get.
89 * @return the parent i.
91 inline const Node* getParent(unsigned int i) const { return _parents[i]; }
94 * Get the number of parents of this StateSet.
95 * @return the number of parents of this StateSet.
97 inline unsigned int getNumParents() const { return static_cast<unsigned int>(_parents.size()); }
100 /** Compute the DataVariance based on an assessment of callback etc.*/
101 virtual void computeDataVariance();
104 /** Set all the modes to on or off so that it defines a
105 complete state, typically used for a default global state.*/
106 void setGlobalDefaults();
108 /** Clear the StateSet of all modes and attributes.*/
111 /** Merge this \c StateSet with the \c StateSet passed as parameter.
112 * Every mode and attribute in this \c StateSet that is marked with
113 * \c StateAttribute::OVERRIDE is replaced with the
114 * equivalent mode or attribute from \c rhs.
116 void merge(const StateSet& rhs);
118 /** a container to map GLModes to their respective GLModeValues.*/
119 typedef std::map<StateAttribute::GLMode,StateAttribute::GLModeValue> ModeList;
121 /** Set this \c StateSet to contain the specified \c GLMode with a given
123 * @note Don't use this method to set modes related to textures. For this
124 * purpose, use \c setTextureMode(), that accepts an extra parameter
125 * specifying which texture unit shall be affected by the call.
127 void setMode(StateAttribute::GLMode mode, StateAttribute::GLModeValue value);
129 /** Remove \c mode from this \c StateSet.
130 * @note Don't use this method to remove modes related to textures. For
131 * this purpose, use \c removeTextureMode(), that accepts an extra
132 * parameter specifying which texture unit shall be affected by
135 void removeMode(StateAttribute::GLMode mode);
137 /** Get the value for a given \c GLMode.
138 * @param mode The \c GLMode whose value is desired.
139 * @return If \c mode is contained within this \c StateSet, returns the
140 * value associated with it. Otherwise, returns
141 * \c StateAttribute::INHERIT.
142 * @note Don't use this method to get the value of modes related to
143 * textures. For this purpose, use \c removeTextureMode(), that
144 * accepts an extra parameter specifying which texture unit shall
145 * be affected by the call.
147 StateAttribute::GLModeValue getMode(StateAttribute::GLMode mode) const;
149 /** Set the list of all <tt>GLMode</tt>s contained in this \c StateSet.*/
150 inline void setModeList(ModeList& ml) { _modeList=ml; }
152 /** Return the list of all <tt>GLMode</tt>s contained in this \c StateSet.*/
153 inline ModeList& getModeList() { return _modeList; }
155 /** Return the \c const list of all <tt>GLMode</tt>s contained in this
156 * <tt>const StateSet</tt>.
158 inline const ModeList& getModeList() const { return _modeList; }
162 /** Simple pairing between an attribute and its override flag.*/
163 typedef std::pair<ref_ptr<StateAttribute>,StateAttribute::OverrideValue> RefAttributePair;
165 /** a container to map <StateAttribyte::Types,Member> to their respective RefAttributePair.*/
166 typedef std::map<StateAttribute::TypeMemberPair,RefAttributePair> AttributeList;
168 /** Set this StateSet to contain specified attribute and override flag.*/
169 void setAttribute(StateAttribute *attribute, StateAttribute::OverrideValue value=StateAttribute::OFF);
171 template<class T> void setAttribute(const ref_ptr<T>& attribute, StateAttribute::OverrideValue value=StateAttribute::OFF) { setAttribute(attribute.get(), value); }
173 /** Set this StateSet to contain specified attribute and set the associated GLMode's to specified value.*/
174 void setAttributeAndModes(StateAttribute *attribute, StateAttribute::GLModeValue value=StateAttribute::ON);
176 template<class T> void setAttributeAndModes(const ref_ptr<T>& attribute, StateAttribute::GLModeValue value=StateAttribute::ON) { setAttributeAndModes(attribute.get(), value); }
178 /** remove attribute of specified type from StateSet.*/
179 void removeAttribute(StateAttribute::Type type, unsigned int member=0);
181 /** remove attribute from StateSet.*/
182 void removeAttribute(StateAttribute *attribute);
184 template<class T> void removeAttribute(const ref_ptr<T>& attribute) { removeAttribute(attribute.get()); }
186 /** Get specified StateAttribute for specified type.
187 * Returns NULL if no type is contained within StateSet.*/
188 StateAttribute* getAttribute(StateAttribute::Type type, unsigned int member = 0);
190 /** Get specified const StateAttribute for specified type.
191 * Returns NULL if no type is contained within const StateSet.*/
192 const StateAttribute* getAttribute(StateAttribute::Type type, unsigned int member = 0) const;
194 /** Get specified RefAttributePair for specified type.
195 * Returns NULL if no type is contained within StateSet.*/
196 RefAttributePair* getAttributePair(StateAttribute::Type type, unsigned int member = 0);
198 /** Get specified RefAttributePair for specified type.
199 * Returns NULL if no type is contained within StateSet.*/
200 const RefAttributePair* getAttributePair(StateAttribute::Type type, unsigned int member = 0) const;
202 /** set the list of all StateAttributes contained in this StateSet.*/
203 inline void setAttributeList(AttributeList& al) { _attributeList=al; }
205 /** return the list of all StateAttributes contained in this StateSet.*/
206 inline AttributeList& getAttributeList() { return _attributeList; }
208 /** return the const list of all StateAttributes contained in this const StateSet.*/
209 inline const AttributeList& getAttributeList() const { return _attributeList; }
213 typedef std::vector<ModeList> TextureModeList;
215 /** Set this \c StateSet to contain specified \c GLMode with a given
217 * @param unit The texture unit to be affected (used with
219 * @param mode The OpenGL mode to be added to the \c StateSet.
220 * @param value The value to be assigned to \c mode.
222 void setTextureMode(unsigned int unit,StateAttribute::GLMode mode, StateAttribute::GLModeValue value);
224 /** Remove texture mode from StateSet.*/
225 void removeTextureMode(unsigned int unit,StateAttribute::GLMode mode);
227 /** Get specified GLModeValue for specified GLMode.
228 * returns INHERIT if no GLModeValue is contained within StateSet.*/
229 StateAttribute::GLModeValue getTextureMode(unsigned int unit,StateAttribute::GLMode mode) const;
231 /** set the list of all Texture related GLModes contained in this StateSet.*/
232 inline void setTextureModeList(TextureModeList& tml) { _textureModeList=tml; }
234 /** return the list of all Texture related GLModes contained in this StateSet.*/
235 inline TextureModeList& getTextureModeList() { return _textureModeList; }
237 /** return the const list of all Texture related GLModes contained in this const StateSet.*/
238 inline const TextureModeList& getTextureModeList() const { return _textureModeList; }
240 /** Return the number texture units active in the TextureModeList.*/
241 inline unsigned int getNumTextureModeLists() const { return static_cast<unsigned int>(_textureModeList.size()); }
243 typedef std::vector<AttributeList> TextureAttributeList;
245 /** Set this StateSet to contain specified attribute and override flag.*/
246 void setTextureAttribute(unsigned int unit,StateAttribute *attribute, StateAttribute::OverrideValue value=StateAttribute::OFF);
248 template<class T> void setTextureAttribute(unsigned int unit, const ref_ptr<T>& attribute, StateAttribute::OverrideValue value=StateAttribute::OFF) { setTextureAttribute( unit, attribute.get(), value); }
250 /** Set this StateSet to contain specified attribute and set the associated GLMode's to specified value.*/
251 void setTextureAttributeAndModes(unsigned int unit,StateAttribute *attribute, StateAttribute::GLModeValue value=StateAttribute::ON);
253 template<class T> void setTextureAttributeAndModes(unsigned int unit, const ref_ptr<T>& attribute, StateAttribute::OverrideValue value=StateAttribute::ON) { setTextureAttributeAndModes( unit, attribute.get(), value); }
255 /** remove texture attribute of specified type from StateSet.*/
256 void removeTextureAttribute(unsigned int unit, StateAttribute::Type type);
258 /** remove texture attribute from StateSet.*/
259 void removeTextureAttribute(unsigned int unit, StateAttribute *attribute);
261 template<class T> void removeTextureAttribute(unsigned int unit, const ref_ptr<T>& attribute) { removeTextureAttribute(unit, attribute.get()); }
263 /** Get specified Texture related StateAttribute for specified type.
264 * Returns NULL if no type is contained within StateSet.*/
265 StateAttribute* getTextureAttribute(unsigned int unit, StateAttribute::Type type);
267 /** Get specified Texture related const StateAttribute for specified type.
268 * Returns NULL if no type is contained within const StateSet.*/
269 const StateAttribute* getTextureAttribute(unsigned int unit, StateAttribute::Type type) const;
271 /** Get specified Texture related RefAttributePair for specified type.
272 * Returns NULL if no type is contained within StateSet.*/
273 RefAttributePair* getTextureAttributePair(unsigned int unit, StateAttribute::Type type);
275 /** Get specified Texture related RefAttributePair for specified type.
276 * Returns NULL if no type is contained within StateSet.*/
277 const RefAttributePair* getTextureAttributePair(unsigned int unit, StateAttribute::Type type) const;
279 /** Set the list of all Texture related StateAttributes contained in this StateSet.*/
280 inline void setTextureAttributeList(TextureAttributeList& tal) { _textureAttributeList=tal; }
282 /** Return the list of all Texture related StateAttributes contained in this StateSet.*/
283 inline TextureAttributeList& getTextureAttributeList() { return _textureAttributeList; }
285 /** Return the const list of all Texture related StateAttributes contained in this const StateSet.*/
286 inline const TextureAttributeList& getTextureAttributeList() const { return _textureAttributeList; }
288 /** Return the number of texture units active in the TextureAttributeList.*/
289 inline unsigned int getNumTextureAttributeLists() const { return static_cast<unsigned int>(_textureAttributeList.size()); }
292 void setAssociatedModes(const StateAttribute* attribute, StateAttribute::GLModeValue value);
293 void removeAssociatedModes(const StateAttribute* attribute);
295 void setAssociatedTextureModes(unsigned int unit, const StateAttribute* attribute, StateAttribute::GLModeValue value);
296 void removeAssociatedTextureModes(unsigned int unit, const StateAttribute* attribute);
301 /** Simple pairing between a Uniform and its override flag.*/
302 typedef std::pair<ref_ptr<Uniform>,StateAttribute::OverrideValue> RefUniformPair;
304 /** a container to map Uniform name to its respective RefUniformPair.*/
305 typedef std::map<std::string,RefUniformPair> UniformList;
307 /** Set this StateSet to contain specified uniform and override flag.*/
308 void addUniform(Uniform* uniform, StateAttribute::OverrideValue value=StateAttribute::ON);
310 template<class T> void addUniform(const ref_ptr<T>& uniform, StateAttribute::OverrideValue value=StateAttribute::ON) { addUniform( uniform.get(), value); }
312 /** remove uniform of specified name from StateSet.*/
313 void removeUniform(const std::string& name);
315 /** remove Uniform from StateSet.*/
316 void removeUniform(Uniform* uniform);
318 template<class T> void removeUniform(const ref_ptr<T>& uniform) { removeUniform(uniform.get()); }
320 /** Get Uniform for specified name.
321 * Returns NULL if no matching Uniform is contained within StateSet.*/
322 Uniform* getUniform(const std::string& name);
324 /** Get Uniform for specified name, if one is not available create it, add it to this StateSet and return a pointer to it.*/
325 Uniform* getOrCreateUniform(const std::string& name, Uniform::Type type, unsigned int numElements=1);
327 /** Get const Uniform for specified name.
328 * Returns NULL if no matching Uniform is contained within StateSet.*/
329 const Uniform* getUniform(const std::string& name) const;
331 /** Get specified RefUniformPair for specified Uniform name.
332 * Returns NULL if no Uniform is contained within StateSet.*/
333 const RefUniformPair* getUniformPair(const std::string& name) const;
335 /** set the list of all Uniforms contained in this StateSet.*/
336 inline void setUniformList(UniformList& al) { _uniformList=al; }
338 /** return the list of all Uniforms contained in this StateSet.*/
339 inline UniformList& getUniformList() { return _uniformList; }
341 /** return the const list of all Uniforms contained in this const StateSet.*/
342 inline const UniformList& getUniformList() const { return _uniformList; }
345 typedef std::pair<std::string, StateAttribute::OverrideValue> DefinePair;
346 typedef std::map<std::string, DefinePair> DefineList;
348 /** Added define pass on to shaders that use utilize that define, as specified by the GLSL \#pragma import_defines(..) and \#pragma requires(..). */
349 void setDefine(const std::string& defineName, StateAttribute::OverrideValue value=StateAttribute::ON);
351 /** 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(..). */
352 void setDefine(const std::string& defineName, const std::string& defineValue, StateAttribute::OverrideValue value=StateAttribute::ON);
354 DefinePair* getDefinePair(const std::string& defineName) { DefineList::iterator itr = _defineList.find(defineName); return (itr!=_defineList.end()) ? &(itr->second) : 0; }
355 const DefinePair* getDefinePair(const std::string& defineName) const { DefineList::const_iterator itr = _defineList.find(defineName); return (itr!=_defineList.end()) ? &(itr->second) : 0; }
359 void removeDefine(const std::string& defineName);
362 /** Set the list of defines to pass on to shaders.*/
363 void setDefineList(const DefineList& dl) { _defineList = dl; }
365 /** Get the list of defines to pass on to shaders.*/
366 DefineList& getDefineList() { return _defineList; }
368 /** Get the const list of defines to pass on to shaders.*/
369 const DefineList& getDefineList() const { return _defineList; }
380 /** Set the \c RenderingHint of this \c StateSet. \c RenderingHint is
381 * used by the renderer to determine which draw bin to drop associated
382 * <tt>osg::Drawable</tt>s in. Typically, users will set this to either
383 * \c StateSet::OPAQUE_BIN or \c StateSet::TRANSPARENT_BIN.
384 * <tt>Drawable</tt>s in the opaque bin are sorted by their
385 * \c StateSet, so that the number of expensive changes in the OpenGL
386 * state is minimized. <tt>Drawable</tt>s in the transparent bin are
387 * sorted by depth, so that objects farther from the viewer are
388 * rendered first (and hence alpha blending works nicely for
389 * translucent objects).
391 void setRenderingHint(int hint);
393 /** Get the \c RenderingHint of this \c StateSet.*/
394 inline int getRenderingHint() const { return _renderingHint; }
398 INHERIT_RENDERBIN_DETAILS =0,
399 USE_RENDERBIN_DETAILS =1,
400 OVERRIDE_RENDERBIN_DETAILS =2,
401 PROTECTED_RENDERBIN_DETAILS =4,
402 OVERRIDE_PROTECTED_RENDERBIN_DETAILS = OVERRIDE_RENDERBIN_DETAILS|PROTECTED_RENDERBIN_DETAILS
405 /** Set the render bin details.*/
406 void setRenderBinDetails(int binNum,const std::string& binName,RenderBinMode mode=USE_RENDERBIN_DETAILS);
408 /** Set the render bin details to inherit.*/
409 void setRenderBinToInherit();
411 /** Get whether the render bin details are set and should be used.*/
412 inline bool useRenderBinDetails() const { return _binMode!=INHERIT_RENDERBIN_DETAILS; }
414 /** Set the render bin mode.*/
415 inline void setRenderBinMode(RenderBinMode mode) { _binMode=mode; }
417 /** Get the render bin mode.*/
418 inline RenderBinMode getRenderBinMode() const { return _binMode; }
420 /** Set the render bin number.*/
421 inline void setBinNumber(int num) { _binNum=num; }
423 /** Get the render bin number.*/
424 inline int getBinNumber() const { return _binNum; }
426 /** Set the render bin name.*/
427 inline void setBinName(const std::string& name) { _binName=name; }
429 /** Get the render bin name.*/
430 inline const std::string& getBinName() const { return _binName; }
432 /** By default render bins will be nested within each other dependent
433 * upon where they are set in the scene graph. This can be problematic
434 * if a transparent render bin is attached to an opaque render bin
435 * which is attached to another transparent render bin as these render
436 * bins will be sorted separately, giving the wrong draw ordering for
437 * back-to-front transparency. Therefore, to prevent render bins being
438 * nested, call setNestRenderBins(false). */
439 inline void setNestRenderBins(bool val) { _nestRenderBins = val; }
441 /** Get whether associated RenderBin should be nested within parents RenderBin.*/
442 inline bool getNestRenderBins() const { return _nestRenderBins; }
445 struct OSG_EXPORT Callback : public virtual osg::Callback
449 Callback(const Callback& org,const CopyOp& copyop):
450 osg::Object(org, copyop),
451 osg::Callback(org, copyop) {}
453 META_Object(osg,Callback);
455 /** override Callback::run() entry point to adapt to StateAttributeCallback::run(..) method.*/
456 virtual bool run(osg::Object* object, osg::Object* data);
458 /** do customized callback code.*/
459 virtual void operator() (StateSet*, NodeVisitor*) {}
462 /** Set the Update Callback which allows users to attach customize the updating of an object during the update traversal.*/
463 void setUpdateCallback(Callback* ac);
465 template<class T> void setUpdateCallback(const ref_ptr<T>& ac) { setUpdateCallback(ac.get()); }
467 /** Get the non const Update Callback.*/
468 Callback* getUpdateCallback() { return _updateCallback.get(); }
470 /** Get the const Update Callback.*/
471 const Callback* getUpdateCallback() const { return _updateCallback.get(); }
473 /** Return whether this StateSet has update callbacks associated with it, and therefore must be traversed.*/
474 bool requiresUpdateTraversal() const { return _updateCallback.valid() || getNumChildrenRequiringUpdateTraversal()!=0; }
476 /** Get the number of Objects of this StateSet which require Update traversal,
477 * since they have an Update Callback attached to them or their children.*/
478 inline unsigned int getNumChildrenRequiringUpdateTraversal() const { return _numChildrenRequiringUpdateTraversal; }
480 /** Run the update callbacks attached directly to this StateSet or to its children.*/
481 void runUpdateCallbacks(osg::NodeVisitor* nv);
484 /** Set the Event Callback which allows users to attach customize the updating of an object during the event traversal.*/
485 void setEventCallback(Callback* ac);
487 template<class T> void setEventCallback(const ref_ptr<T>& ec) { setEventCallback(ec.get()); }
489 /** Get the non const Event Callback.*/
490 Callback* getEventCallback() { return _eventCallback.get(); }
492 /** Get the const Event Callback.*/
493 const Callback* getEventCallback() const { return _eventCallback.get(); }
495 /** Return whether this StateSet has event callbacks associated with it, and therefore must be traversed.*/
496 bool requiresEventTraversal() const { return _eventCallback.valid() || getNumChildrenRequiringEventTraversal()!=0; }
498 /** Get the number of Objects of this StateSet which require Event traversal,
499 * since they have an Eevnt Callback attached to them or their children.*/
500 inline unsigned int getNumChildrenRequiringEventTraversal() const { return _numChildrenRequiringEventTraversal; }
502 /** Run the event callbacks attached directly to this StateSet or to its children.*/
503 void runEventCallbacks(osg::NodeVisitor* nv);
505 /** Check the modes associated with this StateSet are supported by current OpenGL drivers,
506 * and if not set the associated mode in osg::State to be black listed/invalid.
507 * Return true if all associated modes are valid.*/
508 bool checkValidityOfAssociatedModes(State& state) const;
510 /** Set whether to use a mutex to ensure ref() and unref() are thread safe.*/
511 virtual void setThreadSafeRefUnref(bool threadSafe);
513 /** call compile on all StateAttributes contained within this StateSet.*/
514 void compileGLObjects(State& state) const;
516 /** Resize any per context GLObject buffers to specified size. */
517 virtual void resizeGLObjectBuffers(unsigned int maxSize);
519 /** call release on all StateAttributes contained within this StateSet.*/
520 virtual void releaseGLObjects(State* state=0) const;
527 StateSet& operator = (const StateSet&) { return *this; }
529 void addParent(osg::Node* object);
530 void removeParent(osg::Node* object);
533 friend class osg::Node;
534 friend class osg::Drawable;
535 friend class osg::Uniform;
536 friend class osg::StateAttribute;
539 AttributeList _attributeList;
541 TextureModeList _textureModeList;
542 TextureAttributeList _textureAttributeList;
544 UniformList _uniformList;
545 DefineList _defineList;
547 inline ModeList& getOrCreateTextureModeList(unsigned int unit)
549 if (unit>=_textureModeList.size()) _textureModeList.resize(unit+1);
550 return _textureModeList[unit];
553 inline AttributeList& getOrCreateTextureAttributeList(unsigned int unit)
555 if (unit>=_textureAttributeList.size()) _textureAttributeList.resize(unit+1);
556 return _textureAttributeList[unit];
559 int compareModes(const ModeList& lhs, const ModeList& rhs);
560 int compareAttributePtrs(const AttributeList& lhs, const AttributeList& rhs);
561 int compareAttributeContents(const AttributeList& lhs, const AttributeList& rhs);
563 void setMode(ModeList& modeList,StateAttribute::GLMode mode, StateAttribute::GLModeValue value);
564 void setModeToInherit(ModeList& modeList, StateAttribute::GLMode mode);
565 StateAttribute::GLModeValue getMode(const ModeList& modeList, StateAttribute::GLMode mode) const;
567 void setAttribute(AttributeList& attributeList,StateAttribute *attribute, StateAttribute::OverrideValue value=StateAttribute::OFF);
569 StateAttribute* getAttribute(AttributeList& attributeList, StateAttribute::Type type, unsigned int member);
570 const StateAttribute* getAttribute(const AttributeList& attributeList, StateAttribute::Type type, unsigned int member) const;
572 RefAttributePair* getAttributePair(AttributeList& attributeList, StateAttribute::Type type, unsigned int member);
573 const RefAttributePair* getAttributePair(const AttributeList& attributeList, StateAttribute::Type type, unsigned int member) const;
577 RenderBinMode _binMode;
579 std::string _binName;
580 bool _nestRenderBins;
582 ref_ptr<Callback> _updateCallback;
583 unsigned int _numChildrenRequiringUpdateTraversal;
584 void setNumChildrenRequiringUpdateTraversal(unsigned int num);
586 ref_ptr<Callback> _eventCallback;
587 unsigned int _numChildrenRequiringEventTraversal;
588 void setNumChildrenRequiringEventTraversal(unsigned int num);
592extern OSG_EXPORT bool isTextureMode(StateAttribute::GLMode mode);