diff --git a/include/osg/State b/include/osg/State index ef6b41dd1..15d200933 100644 --- a/include/osg/State +++ b/include/osg/State @@ -223,6 +223,12 @@ class SG_EXPORT State : public Referenced const StateAttribute* getLastAppliedTextureAttribute(unsigned int unit, StateAttribute::Type type) const; + /** Dirty the modes previously applied in osg::State.*/ + void dirtyAllModes(); + + /** Dirty the modes attributes previously applied in osg::State.*/ + void dirtyAllAttributes(); + /** disable the vertex, normal, color, tex coords, secenday color, fog coord and index arrays.*/ void disableAllVertexArrays(); diff --git a/src/osg/State.cpp b/src/osg/State.cpp index 6a90e5bf8..9bf617c0c 100644 --- a/src/osg/State.cpp +++ b/src/osg/State.cpp @@ -397,6 +397,64 @@ const StateAttribute* State::getLastAppliedAttribute(const AttributeMap& attribu } } +void State::dirtyAllModes() +{ + for(ModeMap::iterator mitr=_modeMap.begin(); + mitr!=_modeMap.end(); + ++mitr) + { + ModeStack& ms = mitr->second; + ms.last_applied_value = !ms.last_applied_value; + ms.changed = true; + + } + + for(TextureModeMapList::iterator tmmItr=_textureModeMapList.begin(); + tmmItr!=_textureModeMapList.end(); + ++tmmItr) + { + for(ModeMap::iterator mitr=tmmItr->begin(); + mitr!=tmmItr->end(); + ++mitr) + { + ModeStack& ms = mitr->second; + ms.last_applied_value = !ms.last_applied_value; + ms.changed = true; + + } + } +} + +void State::dirtyAllAttributes() +{ + for(AttributeMap::iterator aitr=_attributeMap.begin(); + aitr!=_attributeMap.end(); + ++aitr) + { + AttributeStack& as = aitr->second; + as.last_applied_attribute = 0; + as.changed = true; + } + + + for(TextureAttributeMapList::iterator tamItr=_textureAttributeMapList.begin(); + tamItr!=_textureAttributeMapList.end(); + ++tamItr) + { + AttributeMap& attributeMap = *tamItr; + for(AttributeMap::iterator aitr=attributeMap.begin(); + aitr!=attributeMap.end(); + ++aitr) + { + AttributeStack& as = aitr->second; + as.last_applied_attribute = 0; + as.changed = true; + } + } + +} + + Polytope State::getViewFrustum() const { Polytope cv; @@ -405,6 +463,8 @@ Polytope State::getViewFrustum() const return cv; } + + void State::disableAllVertexArrays() { disableVertexPointer();