diff --git a/examples/osganalysis/osganalysis.cpp b/examples/osganalysis/osganalysis.cpp index cb21641bd..6e1bb3abc 100644 --- a/examples/osganalysis/osganalysis.cpp +++ b/examples/osganalysis/osganalysis.cpp @@ -19,9 +19,55 @@ #include #include + #include + #include + #include +#include + +class StripStateVisitor : public osg::NodeVisitor +{ +public: + StripStateVisitor(bool useStateSets, bool useDisplayLists, bool useVBO): + osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN), + _useStateSets(useStateSets), + _useDisplayLists(useDisplayLists), + _useVBO(useVBO) {} + + bool _useStateSets; + bool _useDisplayLists; + bool _useVBO; + + void apply(osg::Node& node) + { + if (!_useStateSets && node.getStateSet()) node.setStateSet(0); + traverse(node); + } + + void apply(osg::Geode& node) + { + if (!_useStateSets && node.getStateSet()) node.setStateSet(0); + for(unsigned int i = 0; igetName()<accept(ssv); + } + + return node; } @@ -75,7 +140,7 @@ protected: bool modifyDrawableSettings; bool useVBO; bool useDisplayLists; - bool simplificatioRatio; + float simplificatioRatio; bool modifyTextureSettings; bool buildImageMipmaps;