From 123c0a36c4283e39629880239d89091824635c26 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 22 Oct 2010 16:35:28 +0000 Subject: [PATCH] Added support for enable VBO's and doing simplification. --- examples/osganalysis/osganalysis.cpp | 69 +++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 2 deletions(-) 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;