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

This class allows to perform batch optimization, which means process a set of files. More...

Detailed Description

This class allows to perform batch optimization, which means process a set of files.

BatchCruncherOptions is construct using a CCustomData filled with the BatchCruncherOptions::Parameters properly initialized. Some methods allows to define the batch folder or the file to be process during optimization.
The options are then provided to CBatchOptimizer object and a call to CBatchOptimizer::Batch starts the batch.

#include <PolygonCruncherInterface.h>

Public Types

enum  Parameters {
  CRUNCHER_SRCMODE_PARAM = MAKE_CUSTOM_ID('S', 'R', 'M', 'D') , CRUNCHER_SRCFILES_PARAM = MAKE_CUSTOM_ID('S', 'R', 'F', 'I') , CRUNCHER_SRCDIR_PARAM = MAKE_CUSTOM_ID('S', 'R', 'D', 'I') , CRUNCHER_SRCSUBDIR_PARAM = MAKE_CUSTOM_ID('S', 'R', 'S', 'D') ,
  CRUNCHER_SRCKINDOF_PARAM = MAKE_CUSTOM_ID('K', 'I', 'N', 'D') , CRUNCHER_SRCEXT_PARAM = MAKE_CUSTOM_ID('E', 'X', 'T', 'E') , CRUNCHER_OPTIMIZE_PREDEFINED_LEVEL_NBR = 5 , CRUNCHER_OPTIMIZE_LEVEL1 = MAKE_CUSTOM_ID('L', 'E', 'V', '1') ,
  CRUNCHER_OPTIMIZE_LEVEL2 = MAKE_CUSTOM_ID('L', 'E', 'V', '2') , CRUNCHER_OPTIMIZE_LEVEL3 = MAKE_CUSTOM_ID('L', 'E', 'V', '3') , CRUNCHER_OPTIMIZE_LEVEL4 = MAKE_CUSTOM_ID('L', 'E', 'V', '4') , CRUNCHER_OPTIMIZE_LEVEL5 = MAKE_CUSTOM_ID('L', 'E', 'V', '5') ,
  CRUNCHER_OPTIMIZE_LEVEL_NBR = MAKE_CUSTOM_ID('L', 'E', 'V', 'N') , CRUNCHER_OPTIMIZE_START_LEVEL = MAKE_CUSTOM_ID('L', 'E', 'V', 'S') , CRUNCHER_OPTIMIZE_LEVEL_MODE = MAKE_CUSTOM_ID('L', 'E', 'V', 'M') , CRUNCHER_OPTIMIZE_MAGICCRUNCHER_SIMILARITY = MAKE_CUSTOM_ID('M', 'C', 'S', 'M') ,
  CRUNCHER_OPTIMIZE_MAGICCRUNCHER_FAST = MAKE_CUSTOM_ID('M', 'C', 'F', 'S') , CRUNCHER_OPTIMIZE_MODE = MAKE_CUSTOM_ID('M', 'O', 'D', 'E') , CRUNCHER_OPTIMIZE_PROGRESSIVE_RATIO = MAKE_CUSTOM_ID('P', 'G', 'R', 'T') , CRUNCHER_OPTIMIZE_CORNER_MODE = MAKE_CUSTOM_ID('C', 'R', 'M', 'D') ,
  CRUNCHER_OPTIMIZE_HIDDEN_NODE = MAKE_CUSTOM_ID('H', 'D', 'N', 'D') , CRUNCHER_OPTIMIZE_MERGE_POINTS = MAKE_CUSTOM_ID('M', 'R', 'G', 'P') , CRUNCHER_OPTIMIZE_MERGE_POINTS_THRESHOLD = MAKE_CUSTOM_ID('M', 'R', 'P', 'T') , CRUNCHER_OPTIMIZE_MERGE_FACES = MAKE_CUSTOM_ID('M', 'R', 'G', 'F') ,
  CRUNCHER_OPTIMIZE_MERGE_FACES_THRESHOLD = MAKE_CUSTOM_ID('M', 'R', 'F', 'T') , CRUNCHER_OPTIMIZE_MATERIAL_FRONTIER = MAKE_CUSTOM_ID('K', 'P', 'M', 'A') , CRUNCHER_OPTIMIZE_MATERIAL_FRONTIER_MODE = MAKE_CUSTOM_ID('M', 'A', 'M', 'D') , CRUNCHER_OPTIMIZE_FAVORITE_COMPACITY = MAKE_CUSTOM_ID('C', 'O', 'M', 'P') ,
  CRUNCHER_OPTIMIZE_LIMIT_RATIO = MAKE_CUSTOM_ID('L', 'M', 'R', 'T') , CRUNCHER_OPTIMIZE_LOCK_POINT = MAKE_CUSTOM_ID('L', 'K', 'P', 'T') , CRUNCHER_OPTIMIZE_PREVENT_FLIP = MAKE_CUSTOM_ID('F', 'L', 'I', 'P') , CRUNCHER_OPTIMIZE_KEEP_VC = MAKE_CUSTOM_ID('K', 'P', 'V', 'C') ,
  CRUNCHER_OPTIMIZE_VC_MODE = MAKE_CUSTOM_ID('V', 'C', 'M', 'D') , CRUNCHER_OPTIMIZE_TOLERANCE_VC = MAKE_CUSTOM_ID('T', 'L', 'V', 'C') , CRUNCHER_OPTIMIZE_KEEP_UV = MAKE_CUSTOM_ID('K', 'P', 'U', 'V') , CRUNCHER_OPTIMIZE_UV_MODE = MAKE_CUSTOM_ID('U', 'V', 'M', 'D') ,
  CRUNCHER_OPTIMIZE_TOLERANCE_UV = MAKE_CUSTOM_ID('T', 'L', 'U', 'V') , CRUNCHER_OPTIMIZE_KEEP_NORMALS = MAKE_CUSTOM_ID('K', 'P', 'N', 'R') , CRUNCHER_OPTIMIZE_NORMAL_MODE = MAKE_CUSTOM_ID('N', 'R', 'M', 'D') , CRUNCHER_OPTIMIZE_NORMAL_THRESHOLD = MAKE_CUSTOM_ID('N', 'R', 'T', 'H') ,
  CRUNCHER_OPTIMIZE_SYMETRY_MODE = MAKE_CUSTOM_ID('S', 'Y', 'M', 'E') , CRUNCHER_OPTIMIZE_SYMETRY_TOLERANCE = MAKE_CUSTOM_ID('S', 'Y', 'T', 'L') , CRUNCHER_OPTIMIZE_CONVERT_ONLY = MAKE_CUSTOM_ID('C', 'V', 'O', 'L') , CRUNCHER_DSTNAME_MODE = MAKE_CUSTOM_ID('N', 'A', 'M', 'E') ,
  CRUNCHER_DSTPREFIX_PARAM = MAKE_CUSTOM_ID('D', 'S', 'P', 'X') , CRUNCHER_DSTSUFFIX_PARAM = MAKE_CUSTOM_ID('D', 'S', 'S', 'X') , CRUNCHER_DSTMODE_PARAM = MAKE_CUSTOM_ID('D', 'S', 'M', 'D') , CRUNCHER_DSTSUBDIR_PARAM = MAKE_CUSTOM_ID('D', 'S', 'S', 'D') ,
  CRUNCHER_DSTNEWDIR_PARAM = MAKE_CUSTOM_ID('D', 'S', 'N', 'D') , CRUNCHER_DSTRECREATEDIR_PARAM = MAKE_CUSTOM_ID('D', 'S', 'R', 'D') , CRUNCHER_DSTRENAME_PARAM = MAKE_CUSTOM_ID('D', 'S', 'R', 'E') , CRUNCHER_DSTUPDATE_MODE = MAKE_CUSTOM_ID('U', 'P', 'D', 'M') ,
  CRUNCHER_DSTLOG_NAME = MAKE_CUSTOM_ID('D', 'S', 'L', 'G') , CRUNCHER_DSTLOG_AUTORENAME = MAKE_CUSTOM_ID('L', 'G', 'R', 'N') , CRUNCHER_ALBUMFILES_PARAM = MAKE_CUSTOM_ID('A', 'L', 'F', 'I') , CRUNCHER_SELDIR_PARAM = MAKE_CUSTOM_ID('S', 'E', 'D', 'I')
}
 
enum  DefaultValues {
  DEFAULT_NORMAL_ANGLE = 10 , DEFAULT_VC_TOLERANCE = 128 , DEFAULT_UV_TOLERANCE = 0 , DEFAULT_SYMETRY_TOLERANCE = 1 ,
  DEFAULT_MERGEPOINTS_TOLERANCE = 0 , DEFAULT_MERGEFACES_TOLERANCE = 0
}
 
enum  BatchCruncherOptionsFlags {
  BATCH_CRUNCHER_DEFAULT = 0x00 , BATCH_HANDLE_SCENE_DELETION = 0x01 , BATCH_NO_SPLASH = 0x02 , BATCH_NO_LOGWINDOW = 0x04 ,
  BATCH_NO_DIALOG = 0x08 , BATCH_LOG_AUTOCLOSE = 0x10 , BATCH_NO_CANCEL_BY_ESCAPTE = 0x100 , BATCH_NO_MODE_CHOICE = 0x100 ,
  BATCH_NO_CURRENT_DIRECTORY_CHOICE = 0x200 , BATCH_ENABLE_FILE_SELECTION = 0x400 , BATCH_ALBUM_MODE = 0x800
}
 
enum  BatchEnum { CRUNCHER_BATCH_PREFS1 = MAKE_CUSTOM_ID('C', 'R', 'N', 'C') , CRUNCHER_BATCH_PREFS2 = MAKE_CUSTOM_ID('B', 'A', 'T', 'C') }
 
typedef enum BatchCruncherOptions::Parameters Parameters
 
typedef enum BatchCruncherOptions::DefaultValues DefaultValues
 
typedef enum BatchCruncherOptions::BatchCruncherOptionsFlags BatchCruncherOptionsFlags
 
These options give control on the way the batch module is used
These options give control on the Polygon Cruncher batch dialog

Public Member Functions

 BatchCruncherOptions (CCustomData &batchSettingsData, unsigned int flags=BATCH_CRUNCHER_DEFAULT)
 
bool InitFromCommandLine (int argc, char *argv[])
 
void SetCurrentFolder (const CXString &folder)
 
CXString GetCurrentFolder () const
 
void SetFileToOptimize (const CXString &file)
 
void SetFilesToOptimize (const CXStringArray &files, bool albumSet=false)
 
void SetPreferencesFilePath (const CXString &preffile)
 
CXString GetPreferencesFilePath () const
 
void PrefsLoadBatchOptions ()
 
void PrefsSaveBatchOptions () const
 
const CCustomDataGetSettingsData () const
 
unsigned int GetFlags ()
 

Member Enumeration Documentation

◆ BatchCruncherOptionsFlags

Specific options for the batch optimization

Enumerator
BATCH_HANDLE_SCENE_DELETION 

The batch handles the scene deletion internally.

BATCH_NO_SPLASH 

No splash screen is displayed when opening the batch module.

BATCH_NO_LOGWINDOW 

No log window.

BATCH_NO_DIALOG 

No dialog, predefined settings must be provided in data field.

BATCH_LOG_AUTOCLOSE 

The log window closes itself at the end of the process...

BATCH_NO_CANCEL_BY_ESCAPTE 

By default the base class cancel the batch by pressing escape.

BATCH_NO_MODE_CHOICE 

Don't show any mode choice.

BATCH_NO_CURRENT_DIRECTORY_CHOICE 

Don't show current directory mode.

BATCH_ENABLE_FILE_SELECTION 

Allow to select files.

BATCH_ALBUM_MODE 

Replace current directory by current album.

◆ DefaultValues

A set of default values for some parameters of the optimization

Enumerator
DEFAULT_NORMAL_ANGLE 

10 degree

DEFAULT_VC_TOLERANCE 

128 (intermediate between 0..255)

DEFAULT_UV_TOLERANCE 

no tolerance

DEFAULT_SYMETRY_TOLERANCE 

nearly exact symetry

DEFAULT_MERGEPOINTS_TOLERANCE 

Points should be confused.

DEFAULT_MERGEFACES_TOLERANCE 

faces must be coplanar

◆ Parameters

The following information fill a CCustomData in order to call the batch module remotely. The CCustomData is provided through BatchCruncherOptions::data and provided through DoBatchOptimization

Enumerator
CRUNCHER_SRCMODE_PARAM 

UInt, 0: a set of files, 1: the current directory, 2: a selected dir, default: 1. Cf. BatchSrcMode.

CRUNCHER_SRCFILES_PARAM 

String Array, define the set of file to optimize.

CRUNCHER_SRCDIR_PARAM 

String, a full path to the current directory (CRUNCHER_SRCMODE_PARAM=1)

CRUNCHER_SRCSUBDIR_PARAM 

Bool, used if CRUNCHER_SRCMODE_PARAM != 0, false: the files contained in CRUNCHER_SRCDIR_PARAM are optimized, true: the files contained in CRUNCHER_SRCDIR_PARAM and subfolders are optimized, default: true.

CRUNCHER_SRCKINDOF_PARAM 

UInt, 0: All 3d files are optimized, 1: only provided extensions are optimized, 2: only not provided extensions are optimized, default: 0.

CRUNCHER_SRCEXT_PARAM 

String, only if CRUNCHER_SRCKINDOF_PARAM != 0, a set of extension separated by ; (ie: .3ds; .dxf)

CRUNCHER_OPTIMIZE_PREDEFINED_LEVEL_NBR 

The number of predefined level.

CRUNCHER_OPTIMIZE_LEVEL1 

UInt, only if CRUNCHER_OPTIMIZE_LEVEL_MODE=0, value from 0 to 100, default: 25 (remove 25% of the vertices)

CRUNCHER_OPTIMIZE_LEVEL2 

UInt, only if CRUNCHER_OPTIMIZE_LEVEL_MODE=0, value from 0 to 100, default: 50.

CRUNCHER_OPTIMIZE_LEVEL3 

UInt, only if CRUNCHER_OPTIMIZE_LEVEL_MODE=0, value from 0 to 100, default: 65.

CRUNCHER_OPTIMIZE_LEVEL4 

UInt, only if CRUNCHER_OPTIMIZE_LEVEL_MODE=0, value from 0 to 100, default: 75.

CRUNCHER_OPTIMIZE_LEVEL5 

UInt, only if CRUNCHER_OPTIMIZE_LEVEL_MODE=0, value from 0 to 100, default: 90.

CRUNCHER_OPTIMIZE_LEVEL_NBR 

UInt, only if CRUNCHER_OPTIMIZE_LEVEL_MODE=1, the number of LOD to generate.

CRUNCHER_OPTIMIZE_START_LEVEL 

UInt, only if CRUNCHER_OPTIMIZE_LEVEL_MODE=1, the ratio of the first LOD to generate, default: 50.

CRUNCHER_OPTIMIZE_LEVEL_MODE 

UInt, 0: predefined ratio (CRUNCHER_OPTIMIZE_LEVEL1 to CRUNCHER_OPTIMIZE_LEVEL5) 1: Automatic % (starting at CRUNCHER_OPTIMIZE_START_LEVEL) 2:MagicCruncher (combined with CRUNCHER_OPTIMIZE_MAGICCRUNCHER_SIMILARITY and CRUNCHER_OPTIMIZE_MAGICCRUNCHER_FAST), default: 1.

CRUNCHER_OPTIMIZE_MAGICCRUNCHER_SIMILARITY 

UInt: value from 0 to 2, 0: roughly similar, 1: similar, 2: very similar.

CRUNCHER_OPTIMIZE_MAGICCRUNCHER_FAST 

UInt, 0: faster magicCruncher, 1: normal (default) process, 1 : accurate process that try to reach the number of points closer to the similarity threshold condition.

CRUNCHER_OPTIMIZE_MODE 

UInt, 0: Crunch borders, 1: Protect borders, 2: Exclude Borders, Default: 1.

CRUNCHER_OPTIMIZE_PROGRESSIVE_RATIO 

Bool, use progressive ratio when the scene has several objects, default: true.

CRUNCHER_OPTIMIZE_CORNER_MODE 

UInt, 0: Don't care corners, 1: preserve corners, 2: protect corners, 3: exclude corners, default: 0.

CRUNCHER_OPTIMIZE_HIDDEN_NODE 

Bool, import and optimize hidden node, default: true.

CRUNCHER_OPTIMIZE_MERGE_POINTS 

Bool, enable merge of confused points, default: false.

CRUNCHER_OPTIMIZE_MERGE_POINTS_THRESHOLD 

Float, confused points distance threshold, default: 0.0f.

CRUNCHER_OPTIMIZE_MERGE_FACES 

Bool, merge coplanar faces, default: false.

CRUNCHER_OPTIMIZE_MERGE_FACES_THRESHOLD 

Float, coplanar faces threshold angle, default: 0.0f.

CRUNCHER_OPTIMIZE_MATERIAL_FRONTIER 

Bool, protect material boundaries if any, default: true.

CRUNCHER_OPTIMIZE_MATERIAL_FRONTIER_MODE 

UInt, only if CRUNCHER_OPTIMIZE_MATERIAL_FRONTIER=true, otherwise 0: preserve frontier boundaries, 1: protect frontier boundaries, 2: exclude frontier boundaries.

CRUNCHER_OPTIMIZE_FAVORITE_COMPACITY 

Bool, preserve face compacity, default: true.

CRUNCHER_OPTIMIZE_LIMIT_RATIO 

Bool, limit ratio and avoid to generate an invalid mesh, default: true.

CRUNCHER_OPTIMIZE_LOCK_POINT 

Bool, lock point position, default: false.

CRUNCHER_OPTIMIZE_PREVENT_FLIP 

Bool, prevent face flipping, default: true.

CRUNCHER_OPTIMIZE_KEEP_VC 

Bool, keep vertex colors if any, default: false.

CRUNCHER_OPTIMIZE_VC_MODE 

UInt, only if CRUNCHER_OPTIMIZE_KEEP_VC=true, otherwise 0: preserve VC boundaries, 1: protect VC boundaries, 2: exclude VC boundaries.

CRUNCHER_OPTIMIZE_TOLERANCE_VC 

UInt, a threshold value from 0 to 255 corresponding to the difference allowed for RGB values on an edge, default: 128.

CRUNCHER_OPTIMIZE_KEEP_UV 

Bool, keep UVs if any, default: true.

CRUNCHER_OPTIMIZE_UV_MODE 

UInt, only if CRUNCHER_OPTIMIZE_KEEP_UV=true, otherwise 0: preserve UV boundaries, 1: protect UV boundaries, 2: exclude UV boundaries.

CRUNCHER_OPTIMIZE_TOLERANCE_UV 

Float, a threshold value from 0 to 1.0 corresponding to the difference allowed for UVs values on an edge, default: 128.

CRUNCHER_OPTIMIZE_KEEP_NORMALS 

Bool, keep normals if any, default: false.

CRUNCHER_OPTIMIZE_NORMAL_MODE 

UInt, only if CRUNCHER_OPTIMIZE_NORMAL_MODE=true, otherwise 0: preserve normal breaks, 1: protect normal breaks, 2: exclude normal breaks.

CRUNCHER_OPTIMIZE_NORMAL_THRESHOLD 

Float, a threshold value from 0 to 90.0 corresponding to the normal angle in degree for normals values between faces under which no break is detected, default: 10.0f.

CRUNCHER_OPTIMIZE_SYMETRY_MODE 

UInt, 0: no symmetry taken into account, 1: XY symmetry mode, 2: YZ symmetry mode, 3: XZ symmetry mode.

CRUNCHER_OPTIMIZE_SYMETRY_TOLERANCE 

UInt, a tolerance value from 0 to 100 related to point position for considering that two points are symmetric.

CRUNCHER_OPTIMIZE_CONVERT_ONLY 

Bool, if true no optimization if performed. The file is read and simply converted without any processing. default: false.

CRUNCHER_DSTNAME_MODE 

UInt, 0: ouput files are numbered from 1, 1: output files are numbered using the % ratio value, default: 0.

CRUNCHER_DSTPREFIX_PARAM 

String: a prefix to add to the source filename (ie.: optimized_)

CRUNCHER_DSTSUFFIX_PARAM 

String: a suffix to add to the source filename (ie.: _optimized)

CRUNCHER_DSTMODE_PARAM 

UInt: 0: output file are created in the same folder than the source, 1: output files are created in a sub folder of the source file folder, 2: output files are created in a selected directory. Cf. BatchDstMode.

CRUNCHER_DSTSUBDIR_PARAM 

String, used internally when CRUNCHER_DSTMODE_PARAM = 1, contains a subdir folder name in a relative form (ie: .

Returns
)
CRUNCHER_DSTNEWDIR_PARAM 

String, contains the sub folder name when CRUNCHER_DSTMODE_PARAM = 1 in a relative form, or contains the destination folder name when CRUNCHER_DSTMODE_PARAM = 2 in a relative form (relative to source folder) or in an absolute form.

CRUNCHER_DSTRECREATEDIR_PARAM 

Bool, used when CRUNCHER_DSTMODE_PARAM = 2 and if CRUNCHER_SRCSUBDIR_PARAM=true, recreates the source folders tree in the destination folder.

CRUNCHER_DSTRENAME_PARAM 

Bool, rename the destination file in order to newer overwrite a file, default = true.

CRUNCHER_DSTUPDATE_MODE 

Bool, the output file use update mode, which try to kept a maximum information, default = false.

CRUNCHER_DSTLOG_NAME 

String, log file name path in a relative form (dependent of the destination folder), or in an absolute short, default: empty, meaning no log file is generated.

CRUNCHER_DSTLOG_AUTORENAME 

Bool, auto rename the log file name, default: false.

CRUNCHER_ALBUMFILES_PARAM 

String Array, private, define a second set of files used when album mode is defined.

CRUNCHER_SELDIR_PARAM 

String, a full path to a selected directory (CRUNCHER_SRCMODE_PARAM=2), mainly use in an interactive context to store two different paths (one dependent of the application path, the other dependent of a user defined path)


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