//C++ header - Open Scene Graph - Copyright (C) 1998-2001 Robert Osfield //Distributed under the terms of the GNU Library General Public License (LGPL) //as published by the Free Software Foundation. #ifndef OSGUTIL_OPTIMIZESTATEVISITOR #define OSGUTIL_OPTIMIZESTATEVISITOR #include #include namespace osgUtil { /** Insert impostor nodes into scene graph. * For example of usage see src/Demos/osgimpostor. */ class OSGUTIL_EXPORT OptimizeStateVisitor : public osg::NodeVisitor { public: /// default to traversing all children. OptimizeStateVisitor() : osg::NodeVisitor(TRAVERSE_ALL_CHILDREN) {} /** empty visitor, make it ready for next traversal.*/ virtual void reset(); virtual void apply(osg::Node& node); virtual void apply(osg::Geode& geode); void optimize(); protected: void addStateSet(osg::StateSet* stateset,osg::Object* obj); typedef std::set ObjectSet; typedef std::map StateSetMap; StateSetMap _statesets; }; }; #endif