Assimp  v4.1. (December 2018)
Assimp::OptimizeMeshesProcess Class Reference

Postprocessing step to optimize mesh usage. More...

Inherits Assimp::BaseProcess.

Classes

struct  MeshInfo
 Internal utility to store additional mesh info. More...
 

Public Member Functions

void EnablePrimitiveTypeSorting (bool enable)
 Specify whether you want meshes with different primitive types to be merged as well. More...
 
void Execute (aiScene *pScene)
 Executes the post processing step on the given imported data. More...
 
bool IsActive (unsigned int pFlags) const
 Returns whether the processing step is present in the given flag. More...
 
bool IsPrimitiveTypeSortingEnabled () const
 
 OptimizeMeshesProcess ()
 
void SetPreferredMeshSizeLimit (unsigned int verts, unsigned int faces)
 Specify a maximum size of a single output mesh. More...
 
void SetupProperties (const Importer *pImp)
 Called prior to ExecuteOnScene(). More...
 
 ~OptimizeMeshesProcess ()
 
- Public Member Functions inherited from Assimp::BaseProcess
 BaseProcess ()
 Constructor to be privately used by Importer. More...
 
void ExecuteOnScene (Importer *pImp)
 Executes the post processing step on the given imported data. More...
 
SharedPostProcessInfoGetSharedData ()
 Get the shared data that is assigned to the step. More...
 
virtual bool RequireVerboseFormat () const
 Check whether this step expects its input vertex data to be in verbose format. More...
 
void SetSharedData (SharedPostProcessInfo *sh)
 Assign a new SharedPostProcessInfo to the step. More...
 
virtual ~BaseProcess ()
 Destructor, private as well. More...
 

Protected Member Functions

bool CanJoin (unsigned int a, unsigned int b, unsigned int verts, unsigned int faces)
 Returns true if b can be joined with a. More...
 
void FindInstancedMeshes (aiNode *pNode)
 Find instanced meshes, for the moment we're excluding them from all optimizations. More...
 
void ProcessNode (aiNode *pNode)
 Do the actual optimization on all meshes of this node. More...
 

Additional Inherited Members

- Protected Attributes inherited from Assimp::BaseProcess
ProgressHandlerprogress
 Currently active progress handler. More...
 
SharedPostProcessInfoshared
 See the doc of #SharedPostProcessInfo for more details. More...
 

Detailed Description

Postprocessing step to optimize mesh usage.

The implementation looks for meshes that could be joined and joins them. Usually this will reduce the number of drawcalls.

Note
Instanced meshes are currently not processed.

Constructor & Destructor Documentation

◆ OptimizeMeshesProcess()

OptimizeMeshesProcess::OptimizeMeshesProcess ( )

◆ ~OptimizeMeshesProcess()

OptimizeMeshesProcess::~OptimizeMeshesProcess ( )

Member Function Documentation

◆ CanJoin()

bool OptimizeMeshesProcess::CanJoin ( unsigned int  a,
unsigned int  b,
unsigned int  verts,
unsigned int  faces 
)
protected

Returns true if b can be joined with a.

Parameters
vertsNumber of output verts up to now
facesNumber of output faces up to now

◆ EnablePrimitiveTypeSorting()

void Assimp::OptimizeMeshesProcess::EnablePrimitiveTypeSorting ( bool  enable)
inline

Specify whether you want meshes with different primitive types to be merged as well.

IsActive() sets this property automatically to true if the aiProcess_SortByPType flag is found.

◆ Execute()

void OptimizeMeshesProcess::Execute ( aiScene pScene)
virtual

Executes the post processing step on the given imported data.

A process should throw an ImportErrorException* if it fails. This method must be implemented by deriving classes.

Parameters
pSceneThe imported data to work at.

Implements Assimp::BaseProcess.

◆ FindInstancedMeshes()

void OptimizeMeshesProcess::FindInstancedMeshes ( aiNode pNode)
protected

Find instanced meshes, for the moment we're excluding them from all optimizations.

◆ IsActive()

bool OptimizeMeshesProcess::IsActive ( unsigned int  pFlags) const
virtual

Returns whether the processing step is present in the given flag.

Parameters
pFlagsThe processing flags the importer was called with. A bitwise combination of aiPostProcessSteps.
Returns
true if the process is present in this flag fields, false if not.

Implements Assimp::BaseProcess.

◆ IsPrimitiveTypeSortingEnabled()

bool Assimp::OptimizeMeshesProcess::IsPrimitiveTypeSortingEnabled ( ) const
inline

◆ ProcessNode()

void OptimizeMeshesProcess::ProcessNode ( aiNode pNode)
protected

Do the actual optimization on all meshes of this node.

Parameters
pNodeNode we're working with

◆ SetPreferredMeshSizeLimit()

void Assimp::OptimizeMeshesProcess::SetPreferredMeshSizeLimit ( unsigned int  verts,
unsigned int  faces 
)
inline

Specify a maximum size of a single output mesh.

If a single input mesh already exceeds this limit, it won't be split.

Parameters
vertsMaximum number of vertices per mesh
facesMaximum number of faces per mesh

◆ SetupProperties()

void OptimizeMeshesProcess::SetupProperties ( const Importer pImp)
virtual

Called prior to ExecuteOnScene().

The function is a request to the process to update its configuration basing on the Importer's configuration property list.

Reimplemented from Assimp::BaseProcess.


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