2002-07-17 04:07:32 +08:00
|
|
|
//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
|
2001-10-04 23:12:57 +08:00
|
|
|
//Distributed under the terms of the GNU Library General Public License (LGPL)
|
|
|
|
//as published by the Free Software Foundation.
|
|
|
|
|
2001-09-20 05:19:47 +08:00
|
|
|
#ifndef OSGUTIL_SMOOTHINGVISITOR
|
|
|
|
#define OSGUTIL_SMOOTHINGVISITOR 1
|
|
|
|
|
|
|
|
#include <osg/NodeVisitor>
|
|
|
|
#include <osg/Geode>
|
2002-06-26 18:28:17 +08:00
|
|
|
#include <osg/Geometry>
|
2001-09-20 05:19:47 +08:00
|
|
|
|
|
|
|
#include <osgUtil/Export>
|
|
|
|
|
|
|
|
namespace osgUtil {
|
|
|
|
|
|
|
|
/** A smoothing visitor for calculating smoothed normals for
|
|
|
|
* osg::GeoSet's which contains surface primitives.
|
|
|
|
*/
|
|
|
|
class OSGUTIL_EXPORT SmoothingVisitor : public osg::NodeVisitor
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
/// default to traversing all children.
|
|
|
|
SmoothingVisitor()
|
|
|
|
{
|
|
|
|
setTraversalMode(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// smooth geoset by creating per vertex normals.
|
2002-06-26 18:28:17 +08:00
|
|
|
static void smooth(osg::Geometry& geoset);
|
2001-09-20 05:19:47 +08:00
|
|
|
|
|
|
|
/// apply smoothing method to all geode geosets.
|
|
|
|
virtual void apply(osg::Geode& geode);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2002-02-03 20:33:41 +08:00
|
|
|
}
|
2001-09-20 05:19:47 +08:00
|
|
|
|
|
|
|
#endif
|