Polygon Crucher SDK - Documentation
Documentation
Loading...
Searching...
No Matches
CBatchOptimizer Class Reference

CBatchOptimizer allows to perform batch optimization providing BatchCruncherOptions settings and calling CBatchOptimizer::Batch. More...

Detailed Description

CBatchOptimizer allows to perform batch optimization providing BatchCruncherOptions settings and calling CBatchOptimizer::Batch.

It is possible to provide different kind of callback for handling an user progress bar or provide a customized load / save 3d file mechanism.

#include <PolygonCruncherInterface.h>

Public Types

enum  BatchState {
  BATCH_INACTIVE = 0 , BATCH_INIT_BEFORE_BATCH , BATCH_BEFORE_OPEN_LOG_FILE , BATCH_AFTER_OPEN_LOG_FILE ,
  BATCH_START_BATCH , BATCH_PRELOAD_FILE , BATCH_POSTLOAD_FILE , BATCH_PREPROCESS ,
  BATCH_POSTPROCESS , BATCH_PREOPTIMIZE , BATCH_POSTOPTIMIZE , BATCH_PREMAGICCRUNCHER ,
  BATCH_POSTMAGICCRUNCHER , BATCH_PRESAVE_SCENE , BATCH_POSTSAVE_SCENE , BATCH_FREE_SCENE ,
  BATCH_END_BATCH
}
 
typedef enum CBatchOptimizer::BatchState BatchState
 

Public Member Functions

 CBatchOptimizer (const BatchCruncherOptions &settings, xWndHandle parentWindow=NULL)
 Initialize an optimization batch providing specific settings through BatchCruncherOptions.
 
const CCustomDataGetSettingsData () const
 
void SetSettingsData (const CCustomData &settingsData)
 
unsigned int GetFlags () const
 Return BatchCruncherOptionsFlags flags.
 
xWndHandle GetParentWindow () const
 optional parent window for overidden classes
 
CStdioFileExGetLogFile () const
 return the log file
 

Batch callbacks

Can be used by dialog to get folder from settings. If initFromSettings set, the batchinfo is initialized from BatchCruncherOptions

void SetCallbackData (void *data)
 Sets an opaque pointer which is provided in the different callbacks.
 
void SetProgressCallback (CruncherProgressCallback callback)
 Provides a progress callback to provide feedback to user.
 
void SetLoadCallback (LoadCruncherBatchCallback callback)
 Provides a callback for loading files which can be used instead of the default callback.
 
void SetSaveCallback (SaveCruncherBatchCallback callback)
 Provides a callback for saving files which can be used instead of the default callback. The callback is repeatedly called for the same loaded scene, depending on the requested optimization ratio for the batch operation.
 
CXString GetCurrentOptimizedFilePath () const
 Returns the currently processed file.
 
BatchState GetBatchState () const
 Returns the current batch state.
 
virtual bool CheckCancel ()
 Override to handle cancel on the process. Returning true will cancel the operation cancel.
 
virtual void OnBatchStateChanged (BatchState state, void *info)
 
virtual void Log (const CXString &loginfo, bool replacePrevLine=false)
 Override this method to catch some different step in the batch.
 
virtual bool Batch ()
 Start the batch using the provided BatchCruncherOptions settings.
 

Member Enumeration Documentation

◆ BatchState

The batch running state which is provided to CBatchOptimizer::OnBatchStateChanged

Enumerator
BATCH_INIT_BEFORE_BATCH 

A place to set a first initialization. info is a bool set to true by default. If set to false GetBatchInfoHelper is not initialized with the providing settings (useful for specific purpose if overidding settings by dialog user choices for example)

BATCH_BEFORE_OPEN_LOG_FILE 

info is a const pointer to the log filename

BATCH_START_BATCH 

The batch will start to load file and process them. The following event sequence will occurs each time a file is processed.

BATCH_POSTLOAD_FILE 

info is a bool that allow to know if load succeed or fails

BATCH_END_BATCH 

The batch is over, all file have been processed.

Member Function Documentation

◆ Log()

virtual void CBatchOptimizer::Log ( const CXString loginfo,
bool  replacePrevLine = false 
)
virtual

Override this method to catch some different step in the batch.

Override this method to catch different log information


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