6#if !defined(AFX_3DExtObject_H__BB3D80E9_003C_11D2_A0E3_000000000000__INCLUDED_)
7#define AFX_3DExtObject_H__BB3D80E9_003C_11D2_A0E3_000000000000__INCLUDED_
18#include "CustomHeap.h"
20BEGIN_MOOTOOLS_NAMESPACE
22#define FACE_HAS_AT_LEAST_ONE_POINT_TO_BE_OPTIMIZED FACE_USER_PROPERTIES1
23#define FACE_HAS_ALL_POINTS_TO_BE_OPTIMIZED FACE_USER_PROPERTIES2
25#define POINT_OPTIMIZE_FLAG POINT_USER_PROPERTIES1
26#define POINT_OPTIMIZE_PROTECTED POINT_USER_PROPERTIES2
27#define POINT_OPTIMIZE_PRESERVED POINT_USER_PROPERTIES3
29typedef enum _MOVE_FACTOR
32 MOVE_CONSTRAINT_LEVEL1 = 2,
33 MOVE_CONSTRAINT_LEVEL2 = 3,
34 MOVE_CONSTRAINT_LEVEL3 = 4,
35 MOVE_CONSTRAINT_LEVEL4 = 5,
36 MOVE_CONSTRAINT_LEVEL5 = 6,
37 MOVE_CONSTRAINT_LEVEL6 = 7,
38 MOVE_CONSTRAINT_HIGHEST_LEVEL = 8,
41#define MULTIRES_DATA_FILE MAKE_CUSTOM_ID('M', 'R', 'F', 'L')
42#define MULTIRES_DATA_POINTS_ORDER MAKE_CUSTOM_ID('P', 'O', 'R', 'D')
43#define MULTIRES_DATA_FACES_ORDER MAKE_CUSTOM_ID('F', 'O', 'R', 'D')
44#define MULTIRES_DATA_TRIANGULATION MAKE_CUSTOM_ID('T', 'R', 'D', 'A')
72 CExtPointList *optimizedPoints;
86 CTrackContractions *trackInfo;
96 double prevRatio, sceneRatio, progressiveThreshold;
97 int initialRemovablePointNbr, initialRemovableFaceNbr;
98 int removedPointNbr, removedFaceNbr;
99 longuint optimizationMode, optimizationExtMode;
105 typedef enum ExtObjectFlags
110 EO_INTERNAL_FLAGS = 0x0000FF00,
111 EO_ALREADY_TRIANGULAR = 0x00000100,
112 EO_ALREADY_PERVERTEX = 0x00000200,
114 EO_INVALIDATION_FLAGS = 0xFFFF0000,
115 EO_INIT_OPTIMIZATION_DATA_DONE = 0x00010000,
116 EO_INIT_SELECTION_DONE = 0x00020000,
117 EO_OBJECT_CLEANUP_DONE = 0x00040000,
118 EO_UVTOLERANCE_DONE = 0x00080000,
119 EO_VCTOLERANCE_DONE = 0x00100000,
120 EO_NORMALTHRESHOLD_DONE = 0x00200000,
121 EO_SYMETRY_DONE = 0x00400000,
122 EO_WEIGHT_DONE = 0x00800000,
123 EO_PERVERTEX_DONE = 0x01000000,
124 EO_INIT_COST_DONE = 0x02000000,
125 EO_OPTIMIZATION_STARTED = 0x04000000,
126 EO_OPTIMIZATION_DONE = 0x08000000,
129 unsigned int extflags;
131 bool hasSeveralMaterials, hasSelectedPoints;
132 int workOnInitialObjectLock;
136 float symetryTolerance;
137 double normalThreshold;
138 float constraintRatio;
141 CSymMatrix tmpSymMatrix;
142 C3DPoint resultingPt, bboxPt1, bboxPt2, inflateBBox1, inflateBBox2;
146#ifdef MOOTOOLS_PRIVATE_DEBUG
150 static bool CheckMultiresolutionData(
C3DObject *
object, CTrackContractions *&trackInfo);
156 bool ContainSelection()
const;
157 bool ContainMaterialFrontier()
const;
158 bool ContainUVWInfo()
const;
159 bool ContainVCInfo()
const;
160 bool ContainNormalInfo()
const;
163 float GetConstraintRatio();
166 float GetUVWTolerance();
169 int GetVCTolerance();
172 double GetNormalThreshold();
174 bool SetSymetryTolerance(
float tolerance);
175 float GetSymetryTolerance();
176 int GetSymetricPairsNumber();
187 CTrackContractions *GetTrackInfo() {
return trackInfo; }
194 void BeginModifyInitialObject();
196 void ResetOptimization();
204 bool GetMultiresolutionData(
void *&data,
unsigned long& size);
210 static void *AllocMultiresolutionData(
unsigned long size);
211 static void FreeMultiresolutionData(
void *data);
213 void SetExtFlags(
unsigned int flags,
bool set);
214 void SetExtFlag(ExtObjectFlags
flag,
bool set);
215 bool IsExtFlagSet(ExtObjectFlags
flag)
const;
223 void UnlockInitialization();
238 bool SelectMaterial(MaterialID
id,
bool optimised);
239 bool SelectAllMaterials();
248 void SetProgressiveThreshold(
double threshold);
249 double GetProgressiveThreshold()
const;
253 int GetInitialRemovablePointsNumber()
const;
254 int GetInitialRemovableFacesNumber()
const;
255 int GetRemovedFacesNumber()
const;
256 int GetRemovedPointsNumber()
const;
261 void InvalidateOptimization();
264#ifdef MOOTOOLS_PRIVATE_DEBUG
280 bool CleanAndPrepareObject();
283 bool InitOptimizedFacesAndPoints();
288 bool InitNormalFlags();
289 bool InitSymetryMap();
291 void InitOrderedCostList();
292 void InsertCost(CContractionCost *cost,
unsigned char order);
295#ifdef PLY_ALPHA_FEATURE
321 unsigned int FlipEdges(
unsigned int index);
325#ifdef PLY_COMPARE_METHOD
338 double ComputePointCost(CSymMatrix& matrix,
const C3DPoint&
point);
341 bool FindBestPosOnLine(
const CSymMatrix& matrix,
const C3DExtPoint&
pt1,
const C3DExtPoint&
pt2, CInitialCost *
factor);
343 void ComputePairCost(CExtPointList& points,
C3DFaceList& faces, CInitialCost *cost);
344 unsigned int ReplacePointInFaceList(
unsigned int replacedindex,
unsigned int newindex, CContractionCost *
const cost);
347#ifndef MOOTOOLS_NO_INLINE
348inline CExtPointList *C3DExtObject::GetPointList()
const
350 return (CExtPointList*)points;
354END_MOOTOOLS_NAMESPACE
C3DExtPoint class is used internally by C3DExtObject during optimization computation.
The file contains C3DObject class definition which handles N-Gons polygonal object.
OPTIMIZE_MODE
Definition PolygonCruncherType.h:53
C3DEdge is a class containing 2 point indexes that represent the edge of a face.
Definition FaceList.h:72
This class handles static optimization of an object.
Definition 3DExtObject.h:66
int Optimize(double ratio, bool &userCancel, unsigned int ratioMode=OPTIMIZE_TO_RATIO|OPTIMIZE_TO_FACE)
Optimize the object at the given ratio using MRRATIO_MODE.
longuint GetOptimizeExtMode()
Returns the optimization mode which is a combination of OPTIMIZE_EXTMODE flags.
bool SetOptimizeExtMode(longuint extmode, bool cleanNotNeedParameters)
Set optimization mode has a combination of OPTIMIZE_EXTMODE flags.
virtual void SetPointList(C3DPointList *, bool deletePrevious=true)
Set the object point list and delete existing one, unless deletePrevious = false.
longuint GetOptimizeMode()
Returns the optimization mode which is a combination of OPTIMIZE_MODE flags.
virtual void SetFaceList(C3DFaceList *, bool deletePrevious=true)
Set the object face list and delete existing one, unless deletePrevious = false.
virtual void SetChannels(CDependentChannels *, bool deletePrevious=true)
Set the object channellist and delete existing one, unless deletePrevious = false.
void LockInitialization()
A good pratice is to lock and unlock initialization before changing one or several OPTIMIZE_MODE....
bool SetOptimizeMode(OPTIMIZE_MODE newflag, bool set)
Set one OPTIMIZE_MODE flag.
bool SetOptimizeMode(longuint mode, bool cleanNotNeedParameters)
Set optimization mode has a combination of OPTIMIZE_MODE flags.
C3DFaceList class which implement a list of C3DFace. Each face contains indexes to 3D points stored i...
Definition 3DFaceList.h:249
C3DPointList * GetPointList()
Get the object point list.
C3DObject handles polygonal mesh.
Definition 3DObject.h:24
Definition 3DPointList.h:267
Definition 3DPointList.h:227
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
This class contains an array of CChannel information which are associated to the object.
Definition DependentChannels.h:56
This class allows to increase performance on repetitive calls to specific CFaceList methods.
Definition FaceList.h:94
CGeomInfo is an helper class oftenly required by different methods.
Definition GeomInfo.h:71
CMultiresolutionObject1 is a the multiresolution object class computed from C3DSceneOptimizer::GetSce...
Definition MultiresolutionObject.h:102
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