6#if !defined(AFX_PAIRPOINT_H__D524AB81_02DE_11D2_A0E7_000000000000__INCLUDED_)
7#define AFX_PAIRPOINT_H__D524AB81_02DE_11D2_A0E7_000000000000__INCLUDED_
13#ifndef MOOTOOLS_CRUNCHERSDK
14# include "ProgressBar.h"
26BEGIN_MOOTOOLS_NAMESPACE
28#define MIN_PAIR_VALUE ((real)-3.402823466E+38)
31#define CURRENT_POLYGON_CRUNCHER_SETTINGS_VERSION 2
32#define OPTIMIZE_NO_CONSTRAINT -1.0f
33#define OPTIMIZE_UNDEFINED_TOLERANCE (-1.0f)
59 SCENEOPTIMIZER_OPTIMIZATION_FLAGS = 0x0000FFFF,
66 SCENEOPTIMIZER_NONE = 0x00,
80 SCENEOPTIMIZER_INITIALIZATION_FLAGS = 0x00FF0000,
90 SCENEOPTIMIZER_INTERNAL_FLAGS = 0xFF000000,
105#ifdef MOOTOOLS_CRUNCHERSDK
106#define COptimizerWnd CWnd
109#ifdef PLY_MAGICCRUNCHER_COMP
160 APPLY_TO_SCENE = 0x0,
161 APPLY_TO_SELECTED_NODES = 0x01,
162 EXCLUDE_LOCKED_NODES = 0x02,
169 BEGIN_SCENE_MODIFICATION = 0x01,
170 CANCEL_SCENE_MODIFICATION = 0x02,
171 APPLY_SCENE_MODIFICATION = 0x04,
172 VALIDATE_SCENE_MODIFICATION = 0x08,
179 MAGICCRUNCHER_DEFAULT = 0x00,
180 MAGICCRUNCHER_INCLUDE_LOCKED_RATIO = 0x01,
181 MAGICCRUNCHER_INCLUDE_HIDDEN_NODE = 0x02,
182 MAGICCRUNCHER_INCLUDE_SELNODES_ONLY = 0x04,
183 MAGICCRUNCHER_INCLUDE_ALL_NODES = MAGICCRUNCHER_INCLUDE_LOCKED_RATIO|MAGICCRUNCHER_INCLUDE_HIDDEN_NODE,
184 MAGICCRUNCHER_WHOLE_SCENE = 0x10,
185 MAGICCRUNCHER_ULTRA_MODE = 0x20,
194 MAGICCRUNCHER_DRAFT_DICHO = 0x100,
195 MAGICCRUNCHER_MEDIUM_DICHO = 0x200,
196 MAGICCRUNCHER_ACCURATE_DICHO = 0x400,
197 MAGICCRUNCHER_DICHO_LEVEL = MAGICCRUNCHER_DRAFT_DICHO | MAGICCRUNCHER_MEDIUM_DICHO | MAGICCRUNCHER_ACCURATE_DICHO,
206 MAGICCRUNCHER_VALID = 0x00,
207 MAGICCRUNCHER_ERROR = 0x01,
208 MAGICCRUNCHER_CANCEL = 0x02,
209 MAGICCRUNCHER_TIMEOUT = 0x04,
210 } MagicCruncherResult;
223 unsigned int resultCode;
230 useExternalApplication =
false;
232 resultCode = MAGICCRUNCHER_VALID;
234 } MagicCruncherParams;
238 MAGICCRUNCHER_SIMILARITY_COUNT = 4,
239 MAGICCRUNCHER_DEFAULT_SIMILARITY_INDEX = 1,
240 } MagicCruncherSimilarityCount;
246 MULTIRES_MIN_FACES = 0,
252 } MultiresolutionInfo;
267 PredictiveCallback predictiveCallback;
268 void *progressCallbackData;
274 bool lockOptimizeReentrance, lockMagicReetrance;
283#ifndef MOOTOOLS_CRUNCHERSDK
296 C3DScene *ComputeMultiresolutionScene();
307 static double DefaultPredictiveRatio(
C3DObject *
object);
325#ifndef MOOTOOLS_NO_MR
326#ifndef MOOTOOLS_CRUNCHERSDK
359 double GetMaxThresholdFromSelection(ApplyTo mode)
const;
380 unsigned int SaveFlags()
const
382 return (flags & SCENEOPTIMIZER_OPTIMIZATION_FLAGS);
385 void LoadFlags(
unsigned int flags)
387 SetFlags(flags & SCENEOPTIMIZER_OPTIMIZATION_FLAGS,
true);
410#ifdef MOOTOOLS_PRODUCT_BUILD
445 bool HasLockedNodes()
const;
474 bool CheckCancelButton();
475 void SetMeshPos(
unsigned int curmesh);
477 void AddProgressPos(
unsigned int value);
478 void SetProgressPos(
unsigned int pos);
480 void SetProgressMeshRange(
unsigned int meshnbr);
481 void SetProgressRange(
unsigned int min,
unsigned int max);
482 void AddProgressRange(
unsigned int value);
485 void ShowInformation(
bool show,
int textid = -1);
498#ifdef PLY_ALPHA_FEATURE
511#ifndef MOOTOOLS_CRUNCHERSDK
522 static bool DefaultProgressCallback(
unsigned int flags,
const CruncherProgressInfo& info,
void *data);
524#ifdef PLY_MAGICCRUNCHER_COMP
536#elif defined(PLY_MAGICCRUNCHER_COMP)
537 #pragma error("PLY_MAGICCRUNCHER_COMP should not be defined")
541END_MOOTOOLS_NAMESPACE
C3DFaceList class definition which is a list of C3DFace.
Defines some class for batch optimization and scene conversion for CSceneOptimizer.
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
OPTIMIZE_MODE
Definition PolygonCruncherType.h:53
SCENEOPTIMIZER_FLAGS
Definition SceneOptimizer.h:58
@ SCENEOPTIMIZER_HIDE_FROZEN_FACES
The optimizer only displays the face to be optimized, hides the frozen faces.
Definition SceneOptimizer.h:68
@ SCENEOPTIMIZER_PROGRESSIVE_RATIO
When optimizing several meshes with great differences in the number of faces, that flag makes the rat...
Definition SceneOptimizer.h:69
@ SCENEOPTIMIZER_EXCLUDE_HIDDEN_NODES
The optimizer excludes hidden nodes.
Definition SceneOptimizer.h:67
@ SCENEOPTIMIZER_TRACK_CHANGES
Dynamic mode which allows to produce a multiresolution scene, by keeping trace of each optimization s...
Definition SceneOptimizer.h:82
@ SCENEOPTIMIZER_DELETE_SCENE
Set by CSceneOptimizer::SetScene. The optimizer will delete automatically the provided scene to be op...
Definition SceneOptimizer.h:91
@ SCENEOPTIMIZER_NEW_SCENE_LOADED
Private. A new scene has been set (using the load menu for example)
Definition SceneOptimizer.h:92
@ SCENEOPTIMIZER_INTERACTIVE_MODE
Interactive mode is to be used with SCENEOPTIMIZER_TRACK_CHANGES when you need to get a multiresoluti...
Definition SceneOptimizer.h:81
OptimizerResult
Definition SceneOptimizer.h:38
@ OPTIMIZED_OBJECT_CLEANED
Get a cleaned scene which can be used outside Polygon Cruncher. Use for converting or saving the opti...
Definition SceneOptimizer.h:41
@ OPTIMIZED_CURRENT_SCENE
Internal purpose: returns the original scene (if no Optimize not already called) or potentialy optimi...
Definition SceneOptimizer.h:42
@ OPTIMIZED_COPY_SCENE
Return a copy of the scene. To be use in special case only with OPTIMIZED_CLEANED_MULTIRESOLUTION_SCE...
Definition SceneOptimizer.h:46
@ OPTIMIZED_COPY_SELECTION
Internal purpose: returns a copy of the selected node in the scene, or the whole scene if no selectio...
Definition SceneOptimizer.h:48
@ OPTIMIZED_MULTIRESOLUTION_SCENE
Return a scene containing multiresolution object (compute this scene if needed). Free returned scene ...
Definition SceneOptimizer.h:43
@ OPTIMIZED_CLEANED_MULTIRESOLUTION_SCENE
Returns a cleaned scene from the current multiresolution scene ratio. The multiresolution scene is fr...
Definition SceneOptimizer.h:44
@ OPTIMIZED_OBJECT_FOR_DISPLAY
Internal purpose: get a scene which has invalid face. For OpenGL display purpose only....
Definition SceneOptimizer.h:40
@ ORIGINAL_OBJECT
Internal purpose: get the original scene (not optimized), if possible. When it's possible,...
Definition SceneOptimizer.h:39
@ OPTIMIZED_DELETE_ORIGINAL_SCENE
Delete the original scene which is the scene provided to CSceneOptimizer::SetScene....
Definition SceneOptimizer.h:47
@ OPTIMIZED_APPLY_TO_SCENE
Internal purpose: returns the scene or the multiresolution scene. Don't free the returned scene....
Definition SceneOptimizer.h:45
CXTString< TCHAR > CXString
CXString depend on the target OS. Could be CXStringW (Windows) or CXStringA (Linux / Macos)
Definition XString.h:118
This class handles static optimization of an object.
Definition 3DExtObject.h:66
This is the base class for any object containing geometry (curve, polygonal object,...
Definition 3DGeomObject.h:49
C3DObject handles polygonal mesh.
Definition 3DObject.h:24
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
CMultiresolutionObject is the base class for multiresolution object. There is two kind of multiresolu...
Definition MultiresolutionObject.h:33
CSceneOptimizer is the main entry to optimize a scene. There are various optimization modes and which...
Definition SceneOptimizer.h:147
bool HasSameRatio(ApplyTo applyTo) const
Return true if all the nodes concerned by applyTo has same optimization ratio. return true,...
void SetMaxThreadCount(unsigned int count)
Set the maximum parallel threads for task that are computed in parallel (ie MagicCruncher features)
unsigned int GetOptimizableObjects(CXArray< OptimizableObjectInfo > &objects, unsigned int applyToMode, bool onlyOptimizable=true) const
Get ExtObject or CMultiresolutionObject from the scene (optimizable scene or multiresolution scene).
C3DScene * DetachScene()
The scene provided using SetScene, does not belong any more to the optimizer.
bool SetOptimizeMode(longuint optimizeModeFlags, bool cleanNotNeedParameters)
Set one or more OPTIMIZE_MODE flags of each scene optimizer objects.
double ComputePredictiveRatio(C3DObject *object) const
return an heuristic ratio to be used to optimized the mesh. Comparatively to MagicCruncher the ratio ...
double MagicCruncherOptimization(unsigned int magicMode, double similarityThreshold, ApplyTo applyTo=APPLY_TO_SCENE, MagicCruncherParams *params=NULL)
Find optimal optimization with an optimal ratio for each objects, return the global ratio (1....
longuint GetOptimizeExtMode() const
Return combination of OPTIMIZE_EXTMODE. Same remark than above.
unsigned int GetMaxThreadCount() const
Get the maximum parallel threads.
bool SetConstraintRatio(float constraint)
This can be use to limit the optimization to a given constraint ratio. This is mainly for internal pu...
int GetRemovedFacesNumber() const
Returns the number of faces that have been removed.
static double GetObjectRatioFromGlobalRatio(bool progressive, double globalRatio, double objectProgressiveThreshold, unsigned int ratioMode, bool &leftUnoptimized)
Return the progressive ratio value from the global ratio value for a given object.
void CleanMultiresolutionScene()
Delete an already computed multiresolution scene. This is automatically called on destroy but might b...
bool HasMultiresolutionScene() const
void SetProgressCallback(CruncherProgressCallback callback, void *data)
Set a progress callback if you want to give some feedback to an user.
static double ComputeProgressiveThreshold(int objectPtNbr, int maxSceneObjectPtNbr)
Return the progressive threshold to be used. objectPtNbr is the object point nbr, and maxSceneObjectP...
static int GetClosestSimilarityIndex(double similarity)
Return the closest index in the GetDefaultSimilarityValues array based on the provide similarity valu...
bool SetOptimizeMode(C3DExtObject *object, OPTIMIZE_MODE newflag, bool set)
Modify one OPTIMIZE_MODE flag one of each scene optimizer objects.
int GetInitialRemovableElementNumber(bool faceNbr) const
Return number of removable faces (or points if !faceNbr)
bool IsProgressiveRatioEnabled() const
Return true if SCENEOPTIMIZER_PROGRESSIVE_RATIO is set and if there is more than one node to optimize...
LockRatioStatus GetLockedRatioStatus(ApplyTo mode=APPLY_TO_SCENE) const
Node locking status.
float GetConstraintRatio() const
Retrieved the ratio set using.
void SetScene(C3DScene &scene, bool optimizerHandleDeletion)
Sets the scene to optimize. If optimizerHandleDeletion = true, the optimizer will delete the scene at...
static double MagicCruncherOptimization(const CXArray< CMultiresolutionObject * > *objects, unsigned int magicCruncherMode, double hausdorffThreshold, MagicCruncherParams *params=NULL)
This method can be called when we only have CMultiresolutionObject* objets without the CSceneOptimize...
bool SetVCTolerance(int tolerance)
Set the UVW tolerance for all scene optimizer objects.
void LockInitialization()
As changing the object's optimisation mode can lead to a reset, LockInitialization and UnlockInitiali...
bool ContainUVWInfo(C3DScene *scene=NULL)
Returns true if at least one of the object have UVW (UVW_CHANNEL). Check on the provided scene,...
int GetInitialRemovableFacesNumber() const
Returns the number of faces that can be removed.
void SetPredictiveCallback(PredictiveCallback callback)
This method allows to provide you own predictive callback method when you use OPTIMIZE_USE_PREDICTIVE...
void DeleteScene()
The scene provided to the optimizer is deleted (only if it has been allowed using SetScene)
double GetObjectRatioFromGlobalRatio(double globalRatio, double objectProgressiveThreshold, unsigned int ratioMode, bool &leftUnoptimized) const
Returns the progressive ratio value from the global ratio value for a given object....
bool SetOptimizeExtMode(longuint optimizeExtModeFlags, bool cleanNotNeedParameters)
Set one or more OPTIMIZE_EXTMODE flags of each scene optimizer objects.
void ModifyScene(ModifySceneMode mode)
Advanced usage only. Provide a way to modify the internal scene for performing some changes on it (po...
MagicCruncherMode
Definition SceneOptimizer.h:178
int GetVCTolerance() const
Set the UVW tolerance for all scene optimizer objects.
int GetMultiresolutionInfo(MultiresolutionInfo info, ApplyTo applyMode=APPLY_TO_SCENE) const
Get information on the number of optimized / optimizable / total points or faces number for the whole...
ApplyTo GetApplyToMode() const
return APPLY_TO_SCENE if none or all optimizable meshes are selected, APPLY_TO_SELECTION otherwise.
int GetRemovedElementNumber(bool faceNbr) const
Return number of removed faces (or points if !faceNbr)
float GetSymetryTolerance() const
Set the UVW tolerance for all scene optimizer objects.
int GetRemovedPointsNumber() const
Returns the number of points that have been removed.
MultiresolutionInfo
Definition SceneOptimizer.h:245
@ MULTIRES_CUR_FACES
Get the current number of face of the multiresolution mesh, corresponding to the ratio used in the la...
Definition SceneOptimizer.h:250
@ MULTIRES_CUR_POINTS
same for points number
Definition SceneOptimizer.h:251
@ MULTIRES_MIN_POINTS
same for points number
Definition SceneOptimizer.h:247
@ MULTIRES_MAX_FACES
Get the maximal number of face of the multiresolution mesh, when SetObjectRatio = 1....
Definition SceneOptimizer.h:248
@ MULTIRES_MAX_POINTS
same for points number
Definition SceneOptimizer.h:249
int LockOptimizeRatio(bool lock, ApplyTo mode=APPLY_TO_SCENE)
Prevent multiresolution object ratio to be changed, by calling appropriate CMultiresolutionObject::Lo...
longuint GetOptimizeMode() const
Return combination of OPTIMIZE_MODE used by the optimizer. As each object might have a different mode...
bool SetNormalThreshold(double radianThreshold)
Set the UVW tolerance for all scene optimizer objects.
bool SetUVWTolerance(float tolerance)
Set the UVW tolerance for all scene optimizer objects.
int GetSymetricPairsNumber() const
Return the number of symetric points found, which is the sum of symetrical points of each optimizer o...
bool SetSymetryTolerance(float tolerance)
Set the UVW tolerance for all scene optimizer objects.
LockRatioStatus
Definition SceneOptimizer.h:257
float GetUVWTolerance() const
Set the UVW tolerance for all scene optimizer objects.
bool ContainVCInfo(C3DScene *scene=NULL)
Returns true if at least one of the object have verter colors (VC_CHANNEL). The check is performed on...
ModifySceneMode
Definition SceneOptimizer.h:168
int Optimize(double ratio, bool &userCancel, unsigned int ratioMode=OPTIMIZE_TO_RATIO|OPTIMIZE_TO_FACE)
double GetNormalThreshold() const
Set the UVW tolerance for all scene optimizer objects.
void UnlockInitialization()
Unlock a previously locked initalization.
bool ContainMaterialFrontier()
Returns true if at least one object has a material frontier. A material frontier means that one point...
MagicCruncherResult
Definition SceneOptimizer.h:205
bool SetMultiresolutionRatio(double ratio, int requiredElement, unsigned int mode, ApplyTo applyTo=APPLY_TO_SCENE)
Modify the ratio of the multiresolution scene (CMultiresolutionScene) by calling each CMultiresolutio...
static double GetDefaultSimilarity()
Return a default similarity value that can be used as default for MagicCruncher.
C3DScene * GetScene(unsigned int optimizerResultFlags)
Get the optimization result.
void CancelProgress()
Force progress to cancel.
void Clean()
Delete input scene and multiresolution scene.
int GetInitialRemovablePointsNumber() const
Returns the number of points that can be removed.
bool ContainNormalInfo(C3DScene *scene=NULL)
Returns true if at least one of the object have specified normals (SPEC_NORMAL_CHANNEL)....
static const double * GetDefaultSimilarityValues(int &size)
Return #size default values to be use with MagicCruncherOptimization. These default are ordered from ...
This class provides information about computation progress to the different progress callback.
Definition PolygonCruncherInterface.h:41
Definition SceneOptimizer.h:215
unsigned int timeOut
timeOut value in ms
Definition SceneOptimizer.h:219
void * callbackData
Your own data provided when the progress callback is called.
Definition SceneOptimizer.h:218
bool useExternalApplication
Internal only.
Definition SceneOptimizer.h:220
CruncherProgressCallback callback
Define a progress callback.
Definition SceneOptimizer.h:217
Definition SceneOptimizer.h:152