openscenegraph
Classes | Public Types | Public Member Functions | Protected Attributes | List of all members
osgUtil::Simplifier Class Reference
Inheritance diagram for osgUtil::Simplifier:
osg::NodeVisitor osg::Referenced

Classes

class  ContinueSimplificationCallback

Public Types

typedef std::vector< unsigned int > IndexList
- Public Types inherited from osg::NodeVisitor
enum  TraversalMode { TRAVERSE_NONE, TRAVERSE_PARENTS, TRAVERSE_ALL_CHILDREN, TRAVERSE_ACTIVE_CHILDREN }
enum  VisitorType {
  NODE_VISITOR = 0, UPDATE_VISITOR, EVENT_VISITOR, COLLECT_OCCLUDER_VISITOR,
  CULL_VISITOR
}

Public Member Functions

 Simplifier (double sampleRatio=1.0, double maximumError=FLT_MAX, double maximumLength=0.0)
 META_NodeVisitor ("osgUtil","Simplifier") void setSampleRatio(float sampleRatio)
float getSampleRatio () const
void setMaximumError (float error)
float getMaximumError () const
void setMaximumLength (float length)
float getMaximumLength () const
void setDoTriStrip (bool on)
bool getDoTriStrip () const
void setSmoothing (bool on)
bool getSmoothing () const
void setContinueSimplificationCallback (ContinueSimplificationCallback *cb)
ContinueSimplificationCallbackgetContinueSimplificationCallback ()
const
ContinueSimplificationCallback
getContinueSimplificationCallback () const
bool continueSimplification (float nextError, unsigned int numOriginalPrimitives, unsigned int numRemainingPrimitives) const
virtual bool continueSimplificationImplementation (float nextError, unsigned int numOriginalPrimitives, unsigned int numRemainingPrimitives) const
virtual void apply (osg::Geode &geode)
void simplify (osg::Geometry &geometry)
void simplify (osg::Geometry &geometry, const IndexList &protectedPoints)
 a list of point indices
- Public Member Functions inherited from osg::NodeVisitor
 NodeVisitor (TraversalMode tm=TRAVERSE_NONE)
 NodeVisitor (VisitorType type, TraversalMode tm=TRAVERSE_NONE)
virtual ~NodeVisitor ()
virtual const char * libraryName () const
virtual const char * className () const
virtual void reset ()
void setVisitorType (VisitorType type)
VisitorType getVisitorType () const
void setTraversalNumber (unsigned int fn)
unsigned int getTraversalNumber () const
void setFrameStamp (FrameStamp *fs)
const FrameStampgetFrameStamp () const
void setTraversalMask (Node::NodeMask mask)
Node::NodeMask getTraversalMask () const
void setNodeMaskOverride (Node::NodeMask mask)
Node::NodeMask getNodeMaskOverride () const
bool validNodeMask (const osg::Node &node) const
void setTraversalMode (TraversalMode mode)
TraversalMode getTraversalMode () const
void setUserData (Referenced *obj)
ReferencedgetUserData ()
const ReferencedgetUserData () const
void traverse (Node &node)
void pushOntoNodePath (Node *node)
void popFromNodePath ()
NodePathgetNodePath ()
const NodePathgetNodePath () const
virtual osg::Vec3 getEyePoint () const
virtual osg::Vec3 getViewPoint () const
virtual float getDistanceToEyePoint (const Vec3 &, bool) const
virtual float getDistanceFromEyePoint (const Vec3 &, bool) const
virtual float getDistanceToViewPoint (const Vec3 &, bool) const
virtual void apply (Node &node)
virtual void apply (Billboard &node)
virtual void apply (Group &node)
virtual void apply (ProxyNode &node)
virtual void apply (Projection &node)
virtual void apply (CoordinateSystemNode &node)
virtual void apply (ClipNode &node)
virtual void apply (TexGenNode &node)
virtual void apply (LightSource &node)
virtual void apply (Transform &node)
virtual void apply (Camera &node)
virtual void apply (CameraView &node)
virtual void apply (MatrixTransform &node)
virtual void apply (PositionAttitudeTransform &node)
virtual void apply (Switch &node)
virtual void apply (Sequence &node)
virtual void apply (LOD &node)
virtual void apply (PagedLOD &node)
virtual void apply (ClearNode &node)
virtual void apply (OccluderNode &node)
virtual void apply (OcclusionQueryNode &node)
void setDatabaseRequestHandler (DatabaseRequestHandler *handler)
DatabaseRequestHandlergetDatabaseRequestHandler ()
const DatabaseRequestHandlergetDatabaseRequestHandler () const
void setImageRequestHandler (ImageRequestHandler *handler)
ImageRequestHandlergetImageRequestHandler ()
const ImageRequestHandlergetImageRequestHandler () const
- Public Member Functions inherited from osg::Referenced
 Referenced ()
 Referenced (bool threadSafeRefUnref)
 Referenced (const Referenced &)
Referencedoperator= (const Referenced &)
virtual void setThreadSafeRefUnref (bool threadSafe)
bool getThreadSafeRefUnref () const
OpenThreads::MutexgetRefMutex () const
int ref () const
int unref () const
int unref_nodelete () const
int referenceCount () const
ObserverSetgetObserverSet () const
ObserverSetgetOrCreateObserverSet () const
void addObserver (Observer *observer) const
void removeObserver (Observer *observer) const

Protected Attributes

double _sampleRatio
double _maximumError
double _maximumLength
bool _triStrip
bool _smoothing
osg::ref_ptr
< ContinueSimplificationCallback
_continueSimplificationCallback
- Protected Attributes inherited from osg::NodeVisitor
VisitorType _visitorType
unsigned int _traversalNumber
ref_ptr< FrameStamp_frameStamp
TraversalMode _traversalMode
Node::NodeMask _traversalMask
Node::NodeMask _nodeMaskOverride
NodePath _nodePath
ref_ptr< Referenced_userData
ref_ptr< DatabaseRequestHandler_databaseRequestHandler
ref_ptr< ImageRequestHandler_imageRequestHandler
- Protected Attributes inherited from osg::Referenced
OpenThreads::AtomicPtr _observerSet
OpenThreads::Atomic _refCount

Additional Inherited Members

- Static Public Member Functions inherited from osg::Referenced
static OpenThreads::MutexgetGlobalReferencedMutex ()
static void setThreadSafeReferenceCounting (bool enableThreadSafeReferenceCounting)
static bool getThreadSafeReferenceCounting ()
static void setDeleteHandler (DeleteHandler *handler)
static DeleteHandlergetDeleteHandler ()
- Protected Member Functions inherited from osg::Referenced
virtual ~Referenced ()
void signalObserversAndDelete (bool signalDelete, bool doDelete) const
void deleteUsingDeleteHandler () const

Detailed Description

A simplifier for reducing the number of traingles in osg::Geometry.

Member Typedef Documentation

typedef std::vector<unsigned int> osgUtil::Simplifier::IndexList

Constructor & Destructor Documentation

osgUtil::Simplifier::Simplifier ( double  sampleRatio = 1.0,
double  maximumError = FLT_MAX,
double  maximumLength = 0.0 
)

Member Function Documentation

virtual void osgUtil::Simplifier::apply ( osg::Geode geode)
inlinevirtual
bool osgUtil::Simplifier::continueSimplification ( float  nextError,
unsigned int  numOriginalPrimitives,
unsigned int  numRemainingPrimitives 
) const
inline
virtual bool osgUtil::Simplifier::continueSimplificationImplementation ( float  nextError,
unsigned int  numOriginalPrimitives,
unsigned int  numRemainingPrimitives 
) const
inlinevirtual
ContinueSimplificationCallback* osgUtil::Simplifier::getContinueSimplificationCallback ( )
inline
const ContinueSimplificationCallback* osgUtil::Simplifier::getContinueSimplificationCallback ( ) const
inline
bool osgUtil::Simplifier::getDoTriStrip ( ) const
inline
float osgUtil::Simplifier::getMaximumError ( ) const
inline
float osgUtil::Simplifier::getMaximumLength ( ) const
inline
float osgUtil::Simplifier::getSampleRatio ( ) const
inline
bool osgUtil::Simplifier::getSmoothing ( ) const
inline
osgUtil::Simplifier::META_NodeVisitor ( "osgUtil"  ,
"Simplifier"   
)
inline
void osgUtil::Simplifier::setContinueSimplificationCallback ( ContinueSimplificationCallback cb)
inline
void osgUtil::Simplifier::setDoTriStrip ( bool  on)
inline
void osgUtil::Simplifier::setMaximumError ( float  error)
inline

Set the maximum point error that all point removals must be less than to permit removal of a point. Note, Only used when down sampling. i.e. sampleRatio < 1.0

void osgUtil::Simplifier::setMaximumLength ( float  length)
inline

Set the maximum length target that all edges must be shorted than. Note, Only used when up sampling i.e. sampleRatio > 1.0.

void osgUtil::Simplifier::setSmoothing ( bool  on)
inline
void osgUtil::Simplifier::simplify ( osg::Geometry geometry)

simply the geometry.

void osgUtil::Simplifier::simplify ( osg::Geometry geometry,
const IndexList protectedPoints 
)

a list of point indices

simply the geometry, whilst protecting key points from being modified.

Member Data Documentation

osg::ref_ptr<ContinueSimplificationCallback> osgUtil::Simplifier::_continueSimplificationCallback
protected
double osgUtil::Simplifier::_maximumError
protected
double osgUtil::Simplifier::_maximumLength
protected
double osgUtil::Simplifier::_sampleRatio
protected
bool osgUtil::Simplifier::_smoothing
protected
bool osgUtil::Simplifier::_triStrip
protected

The documentation for this class was generated from the following file: