From 5015ec4b5dd9a7ab5f5fb5912b5b3494da0b7673 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 1 Oct 2013 17:01:21 +0000 Subject: [PATCH] From Aurelien Albert, "I'm working with OSG and a customer low-level OpenGL library. To make easier "lazy apply" on the customer OpenGL shaders, the easiest way was to add an accessor to current OSG state's UniformMap. I've also added accessors for modes and texture, since it could be usefull in the same way. All methods are const, so I think there is no side-effects." --- include/osg/State | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/include/osg/State b/include/osg/State index 5d4b93929..f80968425 100644 --- a/include/osg/State +++ b/include/osg/State @@ -1555,7 +1555,7 @@ class OSG_EXPORT State : public Referenced, public Observer void setUpVertexAttribAlias(VertexAttribAlias& alias, GLuint location, const std::string glName, const std::string osgName, const std::string& declaration); - + public: struct ModeStack { typedef std::vector ValueVec; @@ -1612,6 +1612,7 @@ class OSG_EXPORT State : public Referenced, public Observer }; + protected: /** Apply an OpenGL mode if required, passing in mode, enable flag and * appropriate mode stack. This is a wrapper around \c glEnable() and * \c glDisable(), that just actually calls these functions if the @@ -1765,7 +1766,7 @@ class OSG_EXPORT State : public Referenced, public Observer return false; } - + public: typedef std::map ModeMap; typedef std::vector TextureModeMapList; @@ -1778,6 +1779,13 @@ class OSG_EXPORT State : public Referenced, public Observer typedef std::set AppliedProgramObjectSet; + inline const ModeMap& getModeMap() const {return _modeMap;}; + inline const AttributeMap& getAttributeMap() const {return _attributeMap;}; + inline const UniformMap& getUniformMap() const {return _uniformMap;}; + inline const TextureModeMapList& getTextureModeMapList() const {return _textureModeMapList;}; + inline const TextureAttributeMapList& getTextureAttributeMapList() const {return _textureAttributeMapList;}; + + protected: ModeMap _modeMap; AttributeMap _attributeMap; UniformMap _uniformMap;