TriStripVisitor
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGUTIL_TRISTRIPVISITOR
#define OSGUTIL_TRISTRIPVISITOR 1
#include <osg/NodeVisitor>
#include <osg/Geode>
#include <osg/Geometry>
#include <osgUtil/Optimizer>
#include <set>
namespace osgUtil {
class OSGUTIL_EXPORT TriStripVisitor : public BaseOptimizerVisitor
{
public:
TriStripVisitor(Optimizer* optimizer=0) :
BaseOptimizerVisitor( optimizer, Optimizer::TRISTRIP_GEOMETRY),
_cacheSize( 16 ),
_minStripSize( 2 ),
_generateFourPointPrimitivesQuads ( false ),
_mergeTriangleStrips( false ),
_indexMesh( true )
{}
void stripify(osg::Geometry& drawable);
void mergeTriangleStrips(osg::Geometry::PrimitiveSetList& primitives);
void stripify();
virtual void apply(osg::Geometry& geom);
inline void setCacheSize( unsigned int size )
{
_cacheSize = size;
}
inline unsigned int getCacheSize() const
{
return _cacheSize;
}
inline void setMinStripSize( unsigned int size )
{
_minStripSize = size;
}
inline unsigned int getMinStripSize() const
{
return _minStripSize;
}
inline void setIndexMesh( bool allow )
{
_indexMesh = allow;
}
inline bool getIndexMesh() const
{
return _indexMesh;
}
void setGenerateFourPointPrimitivesQuads(bool flag) { _generateFourPointPrimitivesQuads = flag; }
bool getGenerateFourPointPrimitivesQuads() const { return _generateFourPointPrimitivesQuads; }
void setMergeTriangleStrips(bool flag) { _mergeTriangleStrips = flag; }
bool getMergeTriangleStrips() const { return _mergeTriangleStrips; }
private:
typedef std::set<osg::Geometry*> GeometryList;
unsigned int _cacheSize;
unsigned int _minStripSize;
GeometryList _geometryList;
bool _generateFourPointPrimitivesQuads;
bool _mergeTriangleStrips;
bool _indexMesh;
};
}
#endif
Geode
Geometry
NodeVisitor
Optimizer
osgUtil::BaseOptimizerVisitor::BaseOptimizerVisitor
BaseOptimizerVisitor(Optimizer *optimizer, unsigned int operation)
Definition Optimizer:37
osgUtil::Optimizer
Definition Optimizer:61
osgUtil::TriStripVisitor::getCacheSize
unsigned int getCacheSize() const
Definition TriStripVisitor:63
osgUtil::TriStripVisitor::stripify
void stripify(osg::Geometry &drawable)
osgUtil::TriStripVisitor::apply
virtual void apply(osg::Geometry &geom)
Accumulate the Geometry drawables to make into strips.
osgUtil::TriStripVisitor::setGenerateFourPointPrimitivesQuads
void setGenerateFourPointPrimitivesQuads(bool flag)
Definition TriStripVisitor:88
osgUtil::TriStripVisitor::setMinStripSize
void setMinStripSize(unsigned int size)
Definition TriStripVisitor:68
osgUtil::TriStripVisitor::getMinStripSize
unsigned int getMinStripSize() const
Definition TriStripVisitor:73
osgUtil::TriStripVisitor::setCacheSize
void setCacheSize(unsigned int size)
Definition TriStripVisitor:58
osgUtil::TriStripVisitor::getIndexMesh
bool getIndexMesh() const
Definition TriStripVisitor:83
osgUtil::TriStripVisitor::getGenerateFourPointPrimitivesQuads
bool getGenerateFourPointPrimitivesQuads() const
Definition TriStripVisitor:89
osgUtil::TriStripVisitor::setIndexMesh
void setIndexMesh(bool allow)
Definition TriStripVisitor:78
osgUtil::TriStripVisitor::getMergeTriangleStrips
bool getMergeTriangleStrips() const
Definition TriStripVisitor:92
osgUtil::TriStripVisitor::TriStripVisitor
TriStripVisitor(Optimizer *optimizer=0)
default to traversing all children.
Definition TriStripVisitor:35
osgUtil::TriStripVisitor::setMergeTriangleStrips
void setMergeTriangleStrips(bool flag)
Definition TriStripVisitor:91
osgUtil::TriStripVisitor::mergeTriangleStrips
void mergeTriangleStrips(osg::Geometry::PrimitiveSetList &primitives)
osgUtil::TriStripVisitor::stripify
void stripify()
osg::Geometry
Definition Geometry:31
osg::Geometry::PrimitiveSetList
std::vector< ref_ptr< PrimitiveSet > > PrimitiveSetList
Definition Geometry:102
osgUtil
Definition NodeVisitor:25
OSGUTIL_EXPORT
#define OSGUTIL_EXPORT
Definition osgUtil/Export:40