3#ifndef POLYGONCRUNCHER_INTERFACE_H
4#define POLYGONCRUNCHER_INTERFACE_H
6#include "common_cpp_type.h"
13#if defined(MOOTOOLS_PRODUCT_BUILD)
14#include "PolygonCruncherPrivate.h"
15#ifdef MOOTOOLS_MFC_PRODUCT_BUILD
16#include "DeiCommand.h"
17#include "CruncherCommands.h"
24BEGIN_MOOTOOLS_NAMESPACE
55 INIT_OPTIMIZATION = 1,
67 MACRO_RESULT_UNDEFINED = 0,
69 MACRO_RESULT_WARNING = 2,
70 MACRO_RESULT_ERROR = 3,
76 int GetPos()
const {
return pos; }
77 int GetMin()
const {
return min; }
78 int GetMax()
const {
return max; }
79 const CXString& GetText()
const {
return txt; }
80 ProgressState GetState()
const {
return progressState; }
81 LogLevel GetLogLevel()
const {
return logLevel; }
82 bool ReplaceLastLogLine()
const {
return replaceLastLogLine; }
83 bool GetCancelState()
const {
return userCancel; }
84 xThreadID GetMainOptimizerThreadID()
const {
return mainThreadID; }
87 mutable bool userCancel;
94 ProgressState progressState;
98 bool replaceLastLogLine;
110 DEFAULT_OPTIMIZATION_OBJECT = 1,
111 INTERACTIVE_OPTIMIZATION_OBJECT,
112 MULTIRESOLUTION_DATA_OBJECT,
159 CRUNCHER_SRCMODE_PARAM = MAKE_CUSTOM_ID(
'S',
'R',
'M',
'D'),
160 CRUNCHER_SRCFILES_PARAM = MAKE_CUSTOM_ID(
'S',
'R',
'F',
'I'),
161 CRUNCHER_SRCDIR_PARAM = MAKE_CUSTOM_ID(
'S',
'R',
'D',
'I'),
162 CRUNCHER_SRCSUBDIR_PARAM = MAKE_CUSTOM_ID(
'S',
'R',
'S',
'D'),
163 CRUNCHER_SRCKINDOF_PARAM = MAKE_CUSTOM_ID(
'K',
'I',
'N',
'D'),
164 CRUNCHER_SRCEXT_PARAM = MAKE_CUSTOM_ID(
'E',
'X',
'T',
'E'),
165 CRUNCHER_OPTIMIZE_PREDEFINED_LEVEL_NBR = 5,
166 CRUNCHER_OPTIMIZE_LEVEL1 = MAKE_CUSTOM_ID(
'L',
'E',
'V',
'1'),
167 CRUNCHER_OPTIMIZE_LEVEL2 = MAKE_CUSTOM_ID(
'L',
'E',
'V',
'2'),
168 CRUNCHER_OPTIMIZE_LEVEL3 = MAKE_CUSTOM_ID(
'L',
'E',
'V',
'3'),
169 CRUNCHER_OPTIMIZE_LEVEL4 = MAKE_CUSTOM_ID(
'L',
'E',
'V',
'4'),
170 CRUNCHER_OPTIMIZE_LEVEL5 = MAKE_CUSTOM_ID(
'L',
'E',
'V',
'5'),
171 CRUNCHER_OPTIMIZE_LEVEL_NBR = MAKE_CUSTOM_ID(
'L',
'E',
'V',
'N'),
172 CRUNCHER_OPTIMIZE_START_LEVEL = MAKE_CUSTOM_ID(
'L',
'E',
'V',
'S'),
173 CRUNCHER_OPTIMIZE_LEVEL_MODE = MAKE_CUSTOM_ID(
'L',
'E',
'V',
'M'),
174 CRUNCHER_OPTIMIZE_MAGICCRUNCHER_SIMILARITY = MAKE_CUSTOM_ID(
'M',
'C',
'S',
'M'),
175 CRUNCHER_OPTIMIZE_MAGICCRUNCHER_FAST = MAKE_CUSTOM_ID(
'M',
'C',
'F',
'S'),
176 CRUNCHER_OPTIMIZE_MODE = MAKE_CUSTOM_ID(
'M',
'O',
'D',
'E'),
177 CRUNCHER_OPTIMIZE_PROGRESSIVE_RATIO = MAKE_CUSTOM_ID(
'P',
'G',
'R',
'T'),
178 CRUNCHER_OPTIMIZE_CORNER_MODE = MAKE_CUSTOM_ID(
'C',
'R',
'M',
'D'),
179 CRUNCHER_OPTIMIZE_HIDDEN_NODE = MAKE_CUSTOM_ID(
'H',
'D',
'N',
'D'),
180 CRUNCHER_OPTIMIZE_MERGE_POINTS = MAKE_CUSTOM_ID(
'M',
'R',
'G',
'P'),
181 CRUNCHER_OPTIMIZE_MERGE_POINTS_THRESHOLD = MAKE_CUSTOM_ID(
'M',
'R',
'P',
'T'),
182 CRUNCHER_OPTIMIZE_MERGE_FACES = MAKE_CUSTOM_ID(
'M',
'R',
'G',
'F'),
183 CRUNCHER_OPTIMIZE_MERGE_FACES_THRESHOLD = MAKE_CUSTOM_ID(
'M',
'R',
'F',
'T'),
184 CRUNCHER_OPTIMIZE_MATERIAL_FRONTIER = MAKE_CUSTOM_ID(
'K',
'P',
'M',
'A'),
185 CRUNCHER_OPTIMIZE_MATERIAL_FRONTIER_MODE = MAKE_CUSTOM_ID(
'M',
'A',
'M',
'D'),
186 CRUNCHER_OPTIMIZE_FAVORITE_COMPACITY = MAKE_CUSTOM_ID(
'C',
'O',
'M',
'P'),
187 CRUNCHER_OPTIMIZE_LIMIT_RATIO = MAKE_CUSTOM_ID(
'L',
'M',
'R',
'T'),
188 CRUNCHER_OPTIMIZE_LOCK_POINT = MAKE_CUSTOM_ID(
'L',
'K',
'P',
'T'),
189 CRUNCHER_OPTIMIZE_PREVENT_FLIP = MAKE_CUSTOM_ID(
'F',
'L',
'I',
'P'),
190 CRUNCHER_OPTIMIZE_KEEP_VC = MAKE_CUSTOM_ID(
'K',
'P',
'V',
'C'),
191 CRUNCHER_OPTIMIZE_VC_MODE = MAKE_CUSTOM_ID(
'V',
'C',
'M',
'D'),
192 CRUNCHER_OPTIMIZE_TOLERANCE_VC = MAKE_CUSTOM_ID(
'T',
'L',
'V',
'C'),
193 CRUNCHER_OPTIMIZE_KEEP_UV = MAKE_CUSTOM_ID(
'K',
'P',
'U',
'V'),
194 CRUNCHER_OPTIMIZE_UV_MODE = MAKE_CUSTOM_ID(
'U',
'V',
'M',
'D'),
195 CRUNCHER_OPTIMIZE_TOLERANCE_UV = MAKE_CUSTOM_ID(
'T',
'L',
'U',
'V'),
196 CRUNCHER_OPTIMIZE_KEEP_NORMALS = MAKE_CUSTOM_ID(
'K',
'P',
'N',
'R'),
197 CRUNCHER_OPTIMIZE_NORMAL_MODE = MAKE_CUSTOM_ID(
'N',
'R',
'M',
'D'),
198 CRUNCHER_OPTIMIZE_NORMAL_THRESHOLD = MAKE_CUSTOM_ID(
'N',
'R',
'T',
'H'),
199 CRUNCHER_OPTIMIZE_SYMETRY_MODE = MAKE_CUSTOM_ID(
'S',
'Y',
'M',
'E'),
200 CRUNCHER_OPTIMIZE_SYMETRY_TOLERANCE = MAKE_CUSTOM_ID(
'S',
'Y',
'T',
'L'),
201 CRUNCHER_OPTIMIZE_CONVERT_ONLY = MAKE_CUSTOM_ID(
'C',
'V',
'O',
'L'),
202 CRUNCHER_DSTNAME_MODE = MAKE_CUSTOM_ID(
'N',
'A',
'M',
'E'),
203 CRUNCHER_DSTPREFIX_PARAM = MAKE_CUSTOM_ID(
'D',
'S',
'P',
'X'),
204 CRUNCHER_DSTSUFFIX_PARAM = MAKE_CUSTOM_ID(
'D',
'S',
'S',
'X'),
205 CRUNCHER_DSTMODE_PARAM = MAKE_CUSTOM_ID(
'D',
'S',
'M',
'D'),
206 CRUNCHER_DSTSUBDIR_PARAM = MAKE_CUSTOM_ID(
'D',
'S',
'S',
'D'),
207 CRUNCHER_DSTNEWDIR_PARAM = MAKE_CUSTOM_ID(
'D',
'S',
'N',
'D'),
208 CRUNCHER_DSTRECREATEDIR_PARAM = MAKE_CUSTOM_ID(
'D',
'S',
'R',
'D'),
209 CRUNCHER_DSTRENAME_PARAM = MAKE_CUSTOM_ID(
'D',
'S',
'R',
'E'),
210 CRUNCHER_DSTUPDATE_MODE = MAKE_CUSTOM_ID(
'U',
'P',
'D',
'M'),
211 CRUNCHER_DSTLOG_NAME = MAKE_CUSTOM_ID(
'D',
'S',
'L',
'G'),
212 CRUNCHER_DSTLOG_AUTORENAME = MAKE_CUSTOM_ID(
'L',
'G',
'R',
'N'),
221 CRUNCHER_ALBUMFILES_PARAM = MAKE_CUSTOM_ID(
'A',
'L',
'F',
'I'),
222 CRUNCHER_SELDIR_PARAM = MAKE_CUSTOM_ID(
'S',
'E',
'D',
'I'),
224#ifdef PLY_ALPHA_FEATURE
238 DEFAULT_NORMAL_ANGLE = 10,
239 DEFAULT_VC_TOLERANCE = 128,
240 DEFAULT_UV_TOLERANCE = 0,
241 DEFAULT_SYMETRY_TOLERANCE = 1,
242 DEFAULT_MERGEPOINTS_TOLERANCE = 0,
243 DEFAULT_MERGEFACES_TOLERANCE = 0,
250 BATCH_CRUNCHER_DEFAULT = 0x00,
254 BATCH_HANDLE_SCENE_DELETION = 0x01,
255 BATCH_NO_SPLASH = 0x02,
256 BATCH_NO_LOGWINDOW = 0x04,
257 BATCH_NO_DIALOG = 0x08,
258 BATCH_LOG_AUTOCLOSE = 0x10,
259 BATCH_NO_CANCEL_BY_ESCAPTE = 0x100,
265 BATCH_NO_MODE_CHOICE = 0x100,
266 BATCH_NO_CURRENT_DIRECTORY_CHOICE = 0x200,
267 BATCH_ENABLE_FILE_SELECTION = 0x400,
268 BATCH_ALBUM_MODE = 0x800,
271 } BatchCruncherOptionsFlags;
275 CRUNCHER_BATCH_PREFS1 = MAKE_CUSTOM_ID(
'C',
'R',
'N',
'C'),
276 CRUNCHER_BATCH_PREFS2 = MAKE_CUSTOM_ID(
'B',
'A',
'T',
'C'),
282 bool InitFromCommandLine(
int argc,
wchar_t*
argv[]);
284 bool InitFromCommandLine(
int argc,
char*
argv[]);
290 void SetFileToOptimize(
const CXString& file);
295 CXString GetPreferencesFilePath()
const;
296 void PrefsLoadBatchOptions();
297 void PrefsSaveBatchOptions()
const;
299 const CCustomData& GetSettingsData()
const {
return *(cmddata); }
300 unsigned int GetFlags() {
return flags; }
325 BATCH_AFTER_OPEN_LOG_FILE,
333 BATCH_PREMAGICCRUNCHER,
334 BATCH_POSTMAGICCRUNCHER,
336 BATCH_POSTSAVE_SCENE,
356 void* logCallbackData;
360 BatchInfo batchInfoHelper;
361 unsigned int outputFormatMode, outputFormat, inputFormat;
371 const CCustomData& GetSettingsData()
const {
return *(settings->cmddata); }
373 unsigned int GetFlags()
const {
return settings->flags; }
389 virtual void OnBatchStateChanged(
BatchState state,
void* info) {};
395 virtual bool DoBatch();
399 void InitBeforeBatch();
401 bool FileMatch(
const CXString& name);
403 bool LoadFiles(
const CXString& dir);
412#define CRUNCHER_CRASH_FILE_KEY _T("CurrentOptimizedFile")
414#ifdef MOOTOOLS_AUTODESK
419#if defined(MOOTOOLS_PRODUCT_BUILD)
420#if defined(MOOTOOLS_MFC_PRODUCT_BUILD)
447#ifndef MOOTOOLS_NO_DEBUG_HANDLER
451#define SetCurrentOptimizedFile(...) __noop
454END_MOOTOOLS_NAMESPACE
C3DScene class definition.
The file contains enum and type declarations used by the SDK.
bool(* SaveCruncherBatchCallback)(bool freeSceneOnly, const CFileNameSpec &filename, CSceneExportOptions &options, C3DScene *optimizedResult, CXString &resultTxt, void *data)
A callback for saving a to file using some options and the provided scene. If freeSceneOnly,...
Definition PolygonCruncherInterface.h:309
PolygonCruncherObjectCreatorFlags
Definition PolygonCruncherInterface.h:109
C3DScene *(* LoadCruncherBatchCallback)(const CXString &filename, CSceneImportOptions &options, CXString &resultTxt, void *data)
A callback for loading a 3D file specified by its filename and giving some options....
Definition PolygonCruncherInterface.h:308
bool(* CruncherProgressCallback)(unsigned int cruncherProgressFlags, const CruncherProgressInfo &info, void *data)
Progress callback. cruncherProgressFlags is a combination of CruncherProgress flags which inform abou...
Definition PolygonCruncherInterface.h:310
CXTString< TCHAR > CXString
CXString depend on the target OS. Could be CXStringW (Windows) or CXStringA (Linux / Macos)
Definition XString.h:118
This class allows to perform batch optimization, which means process a set of files.
Definition PolygonCruncherInterface.h:151
BatchCruncherOptionsFlags
Definition PolygonCruncherInterface.h:249
Parameters
Definition PolygonCruncherInterface.h:158
DefaultValues
Definition PolygonCruncherInterface.h:237
This is the base class for any kind of object.
Definition 3DBaseObject.h:106
This class handles static optimization of an object.
Definition 3DExtObject.h:66
C3DFaceList class which implement a list of C3DFace. Each face contains indexes to 3D points stored i...
Definition 3DFaceList.h:249
This class can be provided in C3DScene::Copy operations and allows to modify the created kind of clas...
Definition 3DScene.h:47
C3DObject handles polygonal mesh.
Definition 3DObject.h:24
C3DPatch handles handles patch object smoothed using a subdivision algorithm.
Definition 3DPatch.h:34
Definition 3DPointList.h:267
This class converts an usual C3DScene to a C3DScene containing object that can be used by CSceneOptim...
Definition PolygonCruncherInterface.h:123
C3DObject * GetNewPolygonalObject()
Creates a C3DObject with the appropriate required face list and point list classes.
The class allows to get access to the scene graph, node hierarchy, material.
Definition 3DScene.h:306
A node matches one element that is part of the C3DScene graph. It references a C3DBaseObject and has ...
Definition 3DSceneNode.h:64
The class defines an x, y, z 3D point which can use int, float or double.
Definition 3DPoint.h:27
CBatchOptimizer allows to perform batch optimization providing BatchCruncherOptions settings and call...
Definition PolygonCruncherInterface.h:316
BatchState
Definition PolygonCruncherInterface.h:321
@ BATCH_INIT_BEFORE_BATCH
A place to set a first initialization. info is a bool set to true by default. If set to false GetBatc...
Definition PolygonCruncherInterface.h:323
@ BATCH_END_BATCH
The batch is over, all file have been processed.
Definition PolygonCruncherInterface.h:338
@ BATCH_START_BATCH
The batch will start to load file and process them. The following event sequence will occurs each tim...
Definition PolygonCruncherInterface.h:326
@ BATCH_POSTLOAD_FILE
info is a bool that allow to know if load succeed or fails
Definition PolygonCruncherInterface.h:328
@ BATCH_BEFORE_OPEN_LOG_FILE
info is a const pointer to the log filename
Definition PolygonCruncherInterface.h:324
xWndHandle GetParentWindow() const
optional parent window for overidden classes
Definition PolygonCruncherInterface.h:374
CStdioFileEx * GetLogFile() const
return the log file
Definition PolygonCruncherInterface.h:375
virtual bool CheckCancel()
Override to handle cancel on the process. Returning true will cancel the operation cancel.
virtual bool Batch()
Start the batch using the provided BatchCruncherOptions settings.
CBatchOptimizer(const BatchCruncherOptions &settings, xWndHandle parentWindow=NULL)
Initialize an optimization batch providing specific settings through BatchCruncherOptions.
unsigned int GetFlags() const
Return BatchCruncherOptionsFlags flags.
Definition PolygonCruncherInterface.h:373
BatchState GetBatchState() const
Returns the current batch state.
Definition PolygonCruncherInterface.h:386
virtual void Log(const CXString &loginfo, bool replacePrevLine=false)
Override this method to catch some different step in the batch.
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 SetCallbackData(void *data)
Sets an opaque pointer which is provided in the different callbacks.
void SetSaveCallback(SaveCruncherBatchCallback callback)
Provides a callback for saving files which can be used instead of the default callback....
CXString GetCurrentOptimizedFilePath() const
Returns the currently processed file.
Definition PolygonCruncherInterface.h:385
CCustomData is a handly class for storing any kind of data.
Definition CustomData.h:106
A given extension may match several formats. In case of conflict CFileNameSpec is a way to indicate t...
Definition FileInfo.h:156
CMultiresolutionObject is the base class for multiresolution object. There is two kind of multiresolu...
Definition MultiresolutionObject.h:33
This class is used to provide some specific options when exporting a 3D scene.
Definition Io3dmgr.h:157
This class is used to provide some specific options when loading scene file.
Definition Io3dmgr.h:133
CSceneOptimizer is the main entry to optimize a scene. There are various optimization modes and which...
Definition SceneOptimizer.h:147
CStdioFileEx reads or write unicode or ansi / utf8 string and convert them to CXString using string c...
Definition StdioFileEx.h:41
CXStringArray implement an array of CXString.
Definition XStringArray.h:25
This class provides information about computation progress to the different progress callback.
Definition PolygonCruncherInterface.h:41
ProgressState
Definition PolygonCruncherInterface.h:53