// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#ifdef HAVE_CONFIG_H
+# include <simgear_config.h>
+#endif
+
+#include <osg/StateSet>
+
#include "EffectCullVisitor.hxx"
#include "EffectGeode.hxx"
CullVisitor::apply(node);
return;
}
- Technique* technique = eg->getEffect()->chooseTechnique(&getRenderInfo());
- if (!technique) {
+ Effect* effect = eg->getEffect();
+ Technique* technique = 0;
+ if (!effect) {
CullVisitor::apply(node);
return;
+ } else if (!(technique = effect->chooseTechnique(&getRenderInfo()))) {
+ return;
}
+ // push the node's state.
+ osg::StateSet* node_state = node.getStateSet();
+ if (node_state)
+ pushStateSet(node_state);
for (EffectGeode::DrawablesIterator beginItr = eg->drawablesBegin(),
e = eg->drawablesEnd();
beginItr != e;
beginItr = technique->processDrawables(beginItr, e, this,
eg->isCullingActive()))
;
+ // pop the node's state off the geostate stack.
+ if (node_state)
+ popStateSet();
+
}
}