OpenSceneGraph
Classes | Public Types | Public Member Functions | Protected Types | Protected Attributes | List of all members
osgUtil::Optimizer Class Reference

Traverses scene graph to improve efficiency. More...

Classes

class  BufferObjectVisitor
 For all geometry apply settings. More...
 
class  CombineLODsVisitor
 Optimize the LOD groups, by combining adjacent LOD's which have complementary ranges. More...
 
class  CombineStaticTransformsVisitor
 Combine Static Transform nodes that sit above one another. More...
 
class  CopySharedSubgraphsVisitor
 Copy any shared subgraphs, enabling flattening of static transforms. More...
 
class  FlattenBillboardVisitor
 Flatten MatrixTransform/Billboard pairs. More...
 
class  FlattenStaticTransformsDuplicatingSharedSubgraphsVisitor
 FlattenStaticTransformsDuplicatingSharedSubgraphsVisitor is similar to FlattenStaticTransformsVisitor in that it is designed to remove static transforms from the scene graph, pushing down the transforms to the geometry leaves of the scene graph, but with the difference that any subgraphs that are shared between different transforms are duplicated and flattened individually. More...
 
class  FlattenStaticTransformsVisitor
 Flatten Static Transform nodes by applying their transform to the geometry on the leaves of the scene graph, then removing the now redundant transforms. More...
 
struct  IsOperationPermissibleForObjectCallback
 Callback for customizing what operations are permitted on objects in the scene graph. More...
 
class  MakeFastGeometryVisitor
 
class  MergeGeodesVisitor
 Combine geodes. More...
 
class  MergeGeometryVisitor
 
class  RemoveEmptyNodesVisitor
 Remove rendundant nodes, such as groups with one single child. More...
 
class  RemoveLoadedProxyNodesVisitor
 Remove loaded proxy nodes. More...
 
class  RemoveRedundantNodesVisitor
 Remove redundant nodes, such as groups with one single child. More...
 
class  SpatializeGroupsVisitor
 Spatialize scene into a balanced quad/oct tree. More...
 
class  StateVisitor
 Optimize State in the scene graph by removing duplicate state, replacing it with shared instances, both for StateAttributes, and whole StateSets. More...
 
class  StaticObjectDetectionVisitor
 Optimize the setting of StateSet and Geometry objects in scene so that they have a STATIC DataVariance when they don't have any callbacks associated with them. More...
 
class  TessellateVisitor
 Tessellate all Geometries, to remove POLYGONS. More...
 
class  TextureAtlasBuilder
 Texture Atlas Builder creates a set of textures/images which each contain multiple images. More...
 
class  TextureAtlasVisitor
 Optimize texture usage in the scene graph by combining textures into texture atlas Use of texture atlas cuts down on the number of separate states in the scene, reducing state changes and improving the chances of using larger batches of geometry. More...
 
class  TextureVisitor
 For all textures apply settings. More...
 

Public Types

enum  OptimizationOptions {
  FLATTEN_STATIC_TRANSFORMS = (1 << 0), REMOVE_REDUNDANT_NODES = (1 << 1), REMOVE_LOADED_PROXY_NODES = (1 << 2), COMBINE_ADJACENT_LODS = (1 << 3),
  SHARE_DUPLICATE_STATE = (1 << 4), MERGE_GEOMETRY = (1 << 5), CHECK_GEOMETRY = (1 << 6), MAKE_FAST_GEOMETRY = (1 << 7),
  SPATIALIZE_GROUPS = (1 << 8), COPY_SHARED_NODES = (1 << 9), TRISTRIP_GEOMETRY = (1 << 10), TESSELLATE_GEOMETRY = (1 << 11),
  OPTIMIZE_TEXTURE_SETTINGS = (1 << 12), MERGE_GEODES = (1 << 13), FLATTEN_BILLBOARDS = (1 << 14), TEXTURE_ATLAS_BUILDER = (1 << 15),
  STATIC_OBJECT_DETECTION = (1 << 16), FLATTEN_STATIC_TRANSFORMS_DUPLICATING_SHARED_SUBGRAPHS = (1 << 17), INDEX_MESH = (1 << 18), VERTEX_POSTTRANSFORM = (1 << 19),
  VERTEX_PRETRANSFORM = (1 << 20), BUFFER_OBJECT_SETTINGS = (1 << 21), DEFAULT_OPTIMIZATIONS, ALL_OPTIMIZATIONS
}
 

Public Member Functions

 Optimizer ()
 
virtual ~Optimizer ()
 
void reset ()
 Reset internal data to initial state - the getPermissibleOptionsMap is cleared. More...
 
void optimize (osg::Node *node)
 Traverse the node and its subgraph with a series of optimization visitors, specified by the OptimizationOptions. More...
 
template<class T >
void optimize (const osg::ref_ptr< T > &node)
 
virtual void optimize (osg::Node *node, unsigned int options)
 Traverse the node and its subgraph with a series of optimization visitors, specified by the OptimizationOptions. More...
 
template<class T >
void optimize (const osg::ref_ptr< T > &node, unsigned int options)
 
void setIsOperationPermissibleForObjectCallback (IsOperationPermissibleForObjectCallback *callback)
 Set the callback for customizing what operations are permitted on objects in the scene graph. More...
 
IsOperationPermissibleForObjectCallbackgetIsOperationPermissibleForObjectCallback ()
 Get the callback for customizing what operations are permitted on objects in the scene graph. More...
 
const IsOperationPermissibleForObjectCallbackgetIsOperationPermissibleForObjectCallback () const
 Get the callback for customizing what operations are permitted on objects in the scene graph. More...
 
void setPermissibleOptimizationsForObject (const osg::Object *object, unsigned int options)
 
unsigned int getPermissibleOptimizationsForObject (const osg::Object *object) const
 
bool isOperationPermissibleForObject (const osg::StateSet *object, unsigned int option) const
 
bool isOperationPermissibleForObject (const osg::StateAttribute *object, unsigned int option) const
 
bool isOperationPermissibleForObject (const osg::Drawable *object, unsigned int option) const
 
bool isOperationPermissibleForObject (const osg::Node *object, unsigned int option) const
 
bool isOperationPermissibleForObjectImplementation (const osg::StateSet *stateset, unsigned int option) const
 
bool isOperationPermissibleForObjectImplementation (const osg::StateAttribute *attribute, unsigned int option) const
 
bool isOperationPermissibleForObjectImplementation (const osg::Drawable *drawable, unsigned int option) const
 
bool isOperationPermissibleForObjectImplementation (const osg::Node *node, unsigned int option) const
 

Protected Types

typedef std::map< const osg::Object *, unsigned int > PermissibleOptimizationsMap
 

Protected Attributes

osg::ref_ptr< IsOperationPermissibleForObjectCallback_isOperationPermissibleForObjectCallback
 
PermissibleOptimizationsMap _permissibleOptimizationsMap
 

Detailed Description

Traverses scene graph to improve efficiency.

See OptimizationOptions. For example of usage see examples/osgimpostor or osgviewer.

Member Typedef Documentation

◆ PermissibleOptimizationsMap

typedef std::map<const osg::Object*,unsigned int> osgUtil::Optimizer::PermissibleOptimizationsMap
protected

Member Enumeration Documentation

◆ OptimizationOptions

Enumerator
FLATTEN_STATIC_TRANSFORMS 
REMOVE_REDUNDANT_NODES 
REMOVE_LOADED_PROXY_NODES 
COMBINE_ADJACENT_LODS 
SHARE_DUPLICATE_STATE 
MERGE_GEOMETRY 
CHECK_GEOMETRY 
MAKE_FAST_GEOMETRY 
SPATIALIZE_GROUPS 
COPY_SHARED_NODES 
TRISTRIP_GEOMETRY 
TESSELLATE_GEOMETRY 
OPTIMIZE_TEXTURE_SETTINGS 
MERGE_GEODES 
FLATTEN_BILLBOARDS 
TEXTURE_ATLAS_BUILDER 
STATIC_OBJECT_DETECTION 
FLATTEN_STATIC_TRANSFORMS_DUPLICATING_SHARED_SUBGRAPHS 
INDEX_MESH 
VERTEX_POSTTRANSFORM 
VERTEX_PRETRANSFORM 
BUFFER_OBJECT_SETTINGS 
DEFAULT_OPTIMIZATIONS 
ALL_OPTIMIZATIONS 

Constructor & Destructor Documentation

◆ Optimizer()

osgUtil::Optimizer::Optimizer ( )
inline

◆ ~Optimizer()

virtual osgUtil::Optimizer::~Optimizer ( )
inlinevirtual

Member Function Documentation

◆ getIsOperationPermissibleForObjectCallback() [1/2]

IsOperationPermissibleForObjectCallback* osgUtil::Optimizer::getIsOperationPermissibleForObjectCallback ( )
inline

Get the callback for customizing what operations are permitted on objects in the scene graph.

◆ getIsOperationPermissibleForObjectCallback() [2/2]

const IsOperationPermissibleForObjectCallback* osgUtil::Optimizer::getIsOperationPermissibleForObjectCallback ( ) const
inline

Get the callback for customizing what operations are permitted on objects in the scene graph.

◆ getPermissibleOptimizationsForObject()

unsigned int osgUtil::Optimizer::getPermissibleOptimizationsForObject ( const osg::Object object) const
inline

◆ isOperationPermissibleForObject() [1/4]

bool osgUtil::Optimizer::isOperationPermissibleForObject ( const osg::StateSet object,
unsigned int  option 
) const
inline

◆ isOperationPermissibleForObject() [2/4]

bool osgUtil::Optimizer::isOperationPermissibleForObject ( const osg::StateAttribute object,
unsigned int  option 
) const
inline

◆ isOperationPermissibleForObject() [3/4]

bool osgUtil::Optimizer::isOperationPermissibleForObject ( const osg::Drawable object,
unsigned int  option 
) const
inline

◆ isOperationPermissibleForObject() [4/4]

bool osgUtil::Optimizer::isOperationPermissibleForObject ( const osg::Node object,
unsigned int  option 
) const
inline

◆ isOperationPermissibleForObjectImplementation() [1/4]

bool osgUtil::Optimizer::isOperationPermissibleForObjectImplementation ( const osg::StateSet stateset,
unsigned int  option 
) const
inline

◆ isOperationPermissibleForObjectImplementation() [2/4]

bool osgUtil::Optimizer::isOperationPermissibleForObjectImplementation ( const osg::StateAttribute attribute,
unsigned int  option 
) const
inline

◆ isOperationPermissibleForObjectImplementation() [3/4]

bool osgUtil::Optimizer::isOperationPermissibleForObjectImplementation ( const osg::Drawable drawable,
unsigned int  option 
) const
inline

◆ isOperationPermissibleForObjectImplementation() [4/4]

bool osgUtil::Optimizer::isOperationPermissibleForObjectImplementation ( const osg::Node node,
unsigned int  option 
) const
inline

◆ optimize() [1/4]

void osgUtil::Optimizer::optimize ( osg::Node node)

Traverse the node and its subgraph with a series of optimization visitors, specified by the OptimizationOptions.

◆ optimize() [2/4]

template<class T >
void osgUtil::Optimizer::optimize ( const osg::ref_ptr< T > &  node)
inline

References osg::ref_ptr< T >::get(), and optimize().

Referenced by optimize().

◆ optimize() [3/4]

virtual void osgUtil::Optimizer::optimize ( osg::Node node,
unsigned int  options 
)
virtual

Traverse the node and its subgraph with a series of optimization visitors, specified by the OptimizationOptions.

◆ optimize() [4/4]

template<class T >
void osgUtil::Optimizer::optimize ( const osg::ref_ptr< T > &  node,
unsigned int  options 
)
inline

References osg::ref_ptr< T >::get(), and optimize().

Referenced by optimize().

◆ reset()

void osgUtil::Optimizer::reset ( )

Reset internal data to initial state - the getPermissibleOptionsMap is cleared.

◆ setIsOperationPermissibleForObjectCallback()

void osgUtil::Optimizer::setIsOperationPermissibleForObjectCallback ( IsOperationPermissibleForObjectCallback callback)
inline

Set the callback for customizing what operations are permitted on objects in the scene graph.

◆ setPermissibleOptimizationsForObject()

void osgUtil::Optimizer::setPermissibleOptimizationsForObject ( const osg::Object object,
unsigned int  options 
)
inline

Member Data Documentation

◆ _isOperationPermissibleForObjectCallback

osg::ref_ptr<IsOperationPermissibleForObjectCallback> osgUtil::Optimizer::_isOperationPermissibleForObjectCallback
protected

◆ _permissibleOptimizationsMap

PermissibleOptimizationsMap osgUtil::Optimizer::_permissibleOptimizationsMap
protected

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