OpenSceneGraph/include/osgUtil/OptimizeStateVisitor
Robert Osfield 9917b6500d Added a copyright notice to all core headers, which all begin with
//C++ header to help scripts and editors pick up the fact that the
file is a header file.
2001-10-04 15:12:57 +00:00

48 lines
1.1 KiB
Plaintext

//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 <osg/NodeVisitor>
#include <osgUtil/Export>
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<osg::Object*> ObjectSet;
typedef std::map<osg::StateSet*,ObjectSet> StateSetMap;
StateSetMap _statesets;
};
};
#endif