From 94fe9b5fd582ea9f7cc840c5d22361b648f32f8d Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 21 May 2013 17:41:07 +0000 Subject: [PATCH] From Farshid Lashkari, "I'm working on a custom ShaderComposer and I need access to the full StateSetStack of the State object within the getOrCreateProgram() method. The problem is that "State::apply(const StateSet* dstate)" does not add the specified stateset to the stack. I'm not sure if this was intentional, but I've updated the function to push/pop the stateset. I hope the change seems reasonable. I searched the entire code base for code that accesses the StateSetStack, and noticed RenderBin and RenderStage use it. However, I don't think that code would ever be called from within the State::apply() function, so I'm fairly confident the change should be safe." --- src/osg/State.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/osg/State.cpp b/src/osg/State.cpp index 7e2fa5f0c..35dfebe79 100644 --- a/src/osg/State.cpp +++ b/src/osg/State.cpp @@ -500,6 +500,9 @@ void State::apply(const StateSet* dstate) if (dstate) { + // push the stateset on the stack so it can be querried from within StateAttribute + _stateStateStack.push_back(dstate); + _currentShaderCompositionUniformList.clear(); applyModeList(_modeMap,dstate->getModeList()); @@ -546,7 +549,9 @@ void State::apply(const StateSet* dstate) { applyUniformList(_uniformMap,dstate->getUniformList()); } - + + // pop the stateset from the stack + _stateStateStack.pop_back(); } else {