2001-10-04 23:12:57 +08:00
|
|
|
//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.
|
|
|
|
|
2001-09-20 05:19:47 +08:00
|
|
|
#ifndef OSGUTIL_TRISTRIPVISITOR
|
|
|
|
#define OSGUTIL_TRISTRIPVISITOR 1
|
|
|
|
|
|
|
|
#include <osg/NodeVisitor>
|
|
|
|
#include <osg/Geode>
|
2002-06-26 04:27:51 +08:00
|
|
|
#include <osg/Geometry>
|
2001-09-20 05:19:47 +08:00
|
|
|
|
|
|
|
#include <osgUtil/Export>
|
|
|
|
|
|
|
|
namespace osgUtil {
|
|
|
|
|
2002-06-26 18:28:17 +08:00
|
|
|
/** A tri stripping visitor for converting Geometry surface primitives into tri strips.
|
2001-09-20 05:19:47 +08:00
|
|
|
* The current implemention is based up NVidia's NvTriStrip.
|
|
|
|
*/
|
|
|
|
class OSGUTIL_EXPORT TriStripVisitor : public osg::NodeVisitor
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
/// default to traversing all children.
|
|
|
|
TriStripVisitor()
|
|
|
|
{
|
|
|
|
setTraversalMode(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN);
|
|
|
|
}
|
|
|
|
|
2002-06-26 18:28:17 +08:00
|
|
|
/** convert mesh primitives in Geometry into Tri Strips using
|
2001-09-28 20:36:40 +08:00
|
|
|
* NvTriStrip. Converts all primitive types except points
|
2001-09-20 05:19:47 +08:00
|
|
|
* and lines, linestrips which it leaves unchanged.
|
|
|
|
*/
|
2002-06-26 04:27:51 +08:00
|
|
|
static void stripify(osg::Geometry& drawable);
|
2001-09-20 05:19:47 +08:00
|
|
|
|
2002-06-26 18:28:17 +08:00
|
|
|
/// apply stripify method to all geode geometry.
|
2001-09-20 05:19:47 +08:00
|
|
|
virtual void apply(osg::Geode& geode);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2002-02-03 20:33:41 +08:00
|
|
|
}
|
2001-09-20 05:19:47 +08:00
|
|
|
|
|
|
|
#endif
|