![]() |
Polygon Crucher SDK - Documentation
Documentation
|
This class handles static optimization of an object. More...
This class handles static optimization of an object.
CSceneOptimizer handles optimization for a set of C3DExtObject objects. CSceneOptimizer::Optimize calls the C3DExtObject::Optimize for each objects it contains.
When optimizing an object there is two phases:
Calling C3DExtObject directly give you some additional possibilities compared to accessing them only through CSceneOptimizer.
#include <3DExtObject.h>
Public Member Functions | |
bool | ContainSelection () const |
bool | ContainMaterialFrontier () const |
bool | ContainUVWInfo () const |
bool | ContainVCInfo () const |
bool | ContainNormalInfo () const |
bool | SetConstraintRatio (float constraint) |
float | GetConstraintRatio () |
bool | SetUVWTolerance (float tolerance) |
float | GetUVWTolerance () |
bool | SetVCTolerance (int tolerance) |
int | GetVCTolerance () |
bool | SetNormalThreshold (double radianThreshold) |
double | GetNormalThreshold () |
bool | SetSymetryTolerance (float tolerance) |
float | GetSymetryTolerance () |
int | GetSymetricPairsNumber () |
C3DExtObject (C3DPointList *refpoints, C3DFaceList *reffaces, CDependentChannels *refchannels=NULL) | |
virtual void | SetPointList (C3DPointList *, bool deletePrevious=true) |
Set the object point list and delete existing one, unless deletePrevious = false. | |
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. | |
CTrackContractions * | GetTrackInfo () |
C3DSceneNode * | GetNode () |
CExtPointList * | GetPointList () const |
CMultiresolutionObject1 * | GetMultiresolutionObject (bool &userCancel) |
void | SetOptimizer (CSceneOptimizer &optimizer, C3DSceneNode *node) |
void | BeginModifyInitialObject () |
void | EndModifyInitialObject (bool objectChanged) |
void | ResetOptimization () |
bool | GetMultiresolutionData (void *&data, unsigned long &size) |
void | SetExtFlags (unsigned int flags, bool set) |
void | SetExtFlag (ExtObjectFlags flag, bool set) |
bool | IsExtFlagSet (ExtObjectFlags flag) const |
longuint | GetOptimizeMode () |
Returns the optimization mode which is a combination of OPTIMIZE_MODE flags. | |
longuint | GetOptimizeExtMode () |
Returns the optimization mode which is a combination of OPTIMIZE_EXTMODE flags. | |
bool | SetOptimizeMode (longuint mode, bool cleanNotNeedParameters) |
Set optimization mode has a combination of OPTIMIZE_MODE flags. | |
bool | SetOptimizeMode (OPTIMIZE_MODE newflag, bool set) |
Set one OPTIMIZE_MODE flag. | |
bool | SetOptimizeExtMode (longuint extmode, bool cleanNotNeedParameters) |
Set optimization mode has a combination of OPTIMIZE_EXTMODE flags. | |
void | LockInitialization () |
A good pratice is to lock and unlock initialization before changing one or several OPTIMIZE_MODE. Doing that initialization occurs a single time. | |
void | UnlockInitialization () |
bool | PrepareDisplayedObject (bool getOptimizedObject) |
void | SetProgressiveThreshold (double threshold) |
double | GetProgressiveThreshold () const |
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. | |
void | InvalidateOptimization () |
Select Materials to optimize | |
It is possible to exclude some materials of the optimization, inserting some MaterialID in the has map provided GetExcludedMaterials. SetExtFlag(EO_INIT_SELECTION_DONE, false);
InvalidateOptimization();
You can also use SelectMaterial to exclude a particular material. | |
CMaterialHashMap * | GetExcludedMaterials () |
bool | SelectMaterial (MaterialID id, bool optimised) |
bool | SelectAllMaterials () |
Get information about the object (original and optimised) | |
int | GetInitialRemovablePointsNumber () const |
int | GetInitialRemovableFacesNumber () const |
int | GetRemovedFacesNumber () const |
int | GetRemovedPointsNumber () const |
![]() | |
C3DObject (C3DPointList *points, C3DFaceList *faces, CDependentChannels *channels=NULL) | |
bool | Init (int points, int faces, int defaultFaceSize, BOOL createUVChannel=FALSE, int uvpts=0, ChannelID chnid=0) |
![]() | |
C3DGeomObject (C3DPointList *points, C3DFaceList *faces=NULL, CDependentChannels *channels=NULL) | |
Creates a new C3DGeomObject which uses provided points, faces and channels. These data will be released by the object when it is destroyed. | |
virtual void | Serialize (CXArchive &ar) |
int | GetPointNbr () const |
Return the object point number. | |
int | GetFaceNbr () const |
Return the object face number. | |
bool | GetBoundingBox (C3DPoint &point1, C3DPoint &point2, unsigned int bboxflags, unsigned int elmtflags=0, bool set=false, const C3DSceneNode *node=NULL) |
bool | GetBoundingBox (C3DBBox &bbox, unsigned int bboxflags, unsigned int elmtflags=0, bool set=false, const C3DSceneNode *node=NULL) |
bool | GetCG (C3DPoint &point) |
C3DFaceList * | GetFaceList () |
Get the object face list. | |
C3DPointList * | GetPointList () |
Get the object point list. | |
CDependentChannels * | GetChannels () |
Get the object channels. | |
const CDependentChannels * | GetChannels () const |
Get const object channels. | |
void | FreeExtra () |
Release any extra memory attached to the object. | |
void | ChangeChannelID (C3DScene *scene, CHashMap< CChannelInfo, const CChannelInfo &, CChannelInfo > &channelMap) |
void | Inherit (const C3DGeomObject &srcObject, unsigned int channeltype, unsigned int channelflags) |
This methods inherits srcObject points / faces / channel data structure. The object data information is not modified (left empty). It also call InheritFlags. | |
virtual void | InheritFlags (const C3DBaseObject &srcObject, int copyFlags=OBJECT_COPY_DEFAULT) |
This methods only inherits srcObject flags and custom data. It does not modify the data structure. | |
virtual bool | Update (C3DScene *scene, unsigned int updateMode) |
Information that have been invalidated are recomputed when calling this method.IsInstanciated. | |
virtual void | Invalidate (unsigned int flags, bool set=true) |
Notify that some information changed (combination of OBJECT_UPDATE_PROPERTIES invalidation flags) and invalidate related information, which will be updated in the Update call. The invalidated information is not destroyed until the next Update call. | |
virtual bool | InvalidateChannels (unsigned int channelType) |
Notify that channels that have cache should be recomputed (ie, UVW channel or normal channel for example). This give better control than Invalidate(OBJECT_INV_CHANNELS) which invalidate any channel information. We can specify with this method what need to be invalidated depending on the performed operation. Return true, if a cache has been invalidated. | |
virtual void | Clean () |
Clean the object by faces and points which flag have been set to invalid. Update channels accordingly. | |
void | CleanChannels (ChannelID channelType=CHANNELID_UNDEFINED, bool mustHave=true) |
virtual unsigned int | GetChecksum (unsigned int checksumFlags=CHECKSUM_ALL) const |
Return a value that is a simple way to check if the geometry changed between two calls to the method. Checksum is base on geometry only, not customdata because customdata might have temporary values that does not reflect a content change. | |
void | SetSmoothAngle (float radianAngle) |
Set the smooth angle for the specific object. It is used, for example, when calling GetPointNormalChannel() to generate normal breaks. | |
float | GetSmoothAngle (bool *globalRadianAngle=NULL) const |
Get the smooth angle in radian. If object has no specific angle, it will return the C3DScene::GetSmoothAngle. globalRadianAngle, if provided, is set to true, if the object used the global scene smooth angle. | |
void | SetSmoothMode (NormalSmoothMode mode) |
Set way normals are generated. Cf. NormalSmoothMode to learn more about the differences. | |
NormalSmoothMode | GetSmoothMode (bool *globalMode=NULL) const |
Get the smooth method used for the object. If object has no specific method, it will return the C3DScene::GetSmoothMode. globalMode, if provided, is set to true, if the object used the global normal mode. | |
void | SetFaceMode (faceModeEnum mode) |
faceModeEnum | GetFaceMode (void) const |
CChannel * | GetChannelByID (ChannelID id, Channel3DType type) |
CChannel * | GetChannelByIndex (int index, Channel3DType type=CHANNEL_TYPE_UNDEFINED, bool onlyValid=true) |
CPointNormalChannel * | GetPointNormalChannel () |
CFaceNormalChannel * | GetFaceNormalChannel () |
ChannelID | AddChannel (CChannel *channel, ChannelID id=CHANNELID_UNDEFINED) |
If id = CHANNELID_UNDEFINED, the id is automatically assigned when adding the channel to object channels. If id != CHANNELID_UNDEFINED, the id might be modified if it already exists in object channels. | |
ChannelID | GetGlobalVCChannel (float &modulate) const |
The global VC channel is a VC channel ID shared by all faces whatever their materials. The method can return CHANNELID_UNDEFINED, because it is usually defined in C3DMaterial::GetVertexColor. | |
void | SetGlobalVCChannel (ChannelID id, float modulate=1.0f) |
Set a global VC channel which will superseed, the particular channel defined in the face materials. | |
ChannelID | GetGlobalUVWChannel () const |
The global UV channel is a UV channel ID shared by all faces whatever their materials and maps. The method can return CHANNELID_UNDEFINED, because it is usually defined in CMaterialMap::GetChannelID. | |
void | SetGlobalUVWChannel (ChannelID id) |
Set a global UVW channel which will superseed, the particular channel defined in the face material maps. | |
bool | GenerateUVW (C3DScene *scene, CHANNEL_PROPERTIES tagChannelFlag=CHANNEL_NONE, bool setTagChannelFlag=true) |
Generate UV when the object contains materials with planar / cylindrical / cubic projection (...) | |
ChannelID | GlobalizeChannels (C3DScene *scene, bool removeOthers) |
Gather UVW to a single channel from the different face material maps. If GetGlobalUVWChannel is defined, then the function return the already defined channel. Otherwise, a new channel is created from the different channel referenced by diffuse map and SetGlobalUVWChannel is called with that new channel ID. | |
bool | UnifyNormals () |
bool | FlipNormals (FACE_PROPERTIES properties=FACE_NONE, bool musthave=true) |
bool | GenerateNormals (unsigned int mode=GENNORMAL_PER_VERTEX, NormalSmoothMode smooth=NORMAL_GLOBAL_MODE) |
Generate normal. Mode is one or a combination of GENNORMAL_MODE (if GENNORMAL_SPEC_CHANNEL is used). Return true if at least one normal has been computed, false if nothing need to be computed. | |
virtual bool | MatrixTransform (const C4x4Matrix &matrix) |
Transform the 3D information with the given matrix. The object should not be instanciated or all instances are modified. | |
bool | Weld3DPoints (double distance, bool absolute, unsigned int handleChannels=ALL_CHANNELS_TYPE, unsigned int coupleFlagsNbr=0,...) |
Weld points which distance is lower than distance specified value. | |
C3DObject * | SubObject (int count, SUBOBJECT_MODE mode) |
Return a sub object from this object based on the faces facecount index number and SUBOBJECT_MODE parameter. | |
C3DObject * | SubObject (const int *faceIndexes, unsigned int faceCount) |
Return a sub object from this object using the provided faceIndexes array which has faceCount index. | |
int | ExplodeIntoIsolatedParts (C3DGeomObjectArray &newobjects) |
bool | Concatenate (C3DScene *scene, const C3DGeomObjectArray &object, C3DConcatenateFilter *filter=NULL) |
Concatenate a set object object with the possibility to exclude some particular faces. Note: If object belong to a node, the coordinates are not transformed in any way. You need to transform them before the call if this is required or use the Concatenate variant with node array. | |
bool | Concatenate (C3DScene *scene, const C3DNodeArray &object, C3DConcatenateFilter *filter=NULL) |
Concatenate a set of node containing geom object with the possibility to exclude some particular faces. Note: coordinates are transformed taken into account the node transformation. | |
bool | MergeCoplanarFaces (double radianMaxAngle, unsigned int channels=ALL_CHANNELS_TYPE) |
bool | IsTriangular (FACE_PROPERTIES properties=FACE_NONE, bool musthave=true) const |
bool | Triangulate (unsigned int channelType=ALL_CHANNELS_TYPE, FACE_PROPERTIES properties=FACE_NONE, bool musthave=true) |
bool | DisconnectBorderFaces (unsigned int channelType=ALL_CHANNELS_TYPE, unsigned int tagPointsFlags=POINT_BELONG_TO_BORDER|POINT_IS_CONFUSED, unsigned int tagFaceFlags=FACE_IS_BORDER|FACE_HAS_CONFUSED_POINTS, CPointGroupGraph *confusedGraph=NULL, bool simulate=false, C3DFaceList *originalChangedFaces=NULL) |
pointFlags are set for the points that belongs to a seams. This flags cumulates with others | |
bool | SortFaces (FACE_SORT_MODE sort) |
bool | HasDifferentFrontAndBackUVChannel (const CGeomInfo *info, MapType maptype) const |
bool | HasBackFaceMaterials () const |
Return true if the object has different front and back face materials. | |
const CFBMaterialHashMap * | GetFBMaterialsHashMap () |
Get material hash (binded if necessary), trigger display. | |
unsigned int | GetMaterialsHashMap (CMaterialHashMap &hashMaterialMap, bool includeBackFace=true, bool reset=true) |
Return reference material by the object as an association map that contains the materialID and the number of face that are concerned by the material. Some object (ie. curve) without faces can reference a material. In this case, the hash will associate a number of face of 0. Cf. usage sample. | |
bool | ReplaceMaterials (const CHashMap< MaterialID, MaterialID, MaterialID > &materialMap) |
Replace front / back face's material which have material key with the corresponding material value, trigger display. Return true if something changed. | |
bool | ReplaceMaterial (MaterialID matid, MaterialID newmatid) |
Replace face material which have matid with newmatid. | |
![]() | |
virtual bool | DeleteFromNode () |
virtual void | PostSerialize (CXArchive &ar, bool lastCall) |
virtual void | SetScene (C3DScene *scene) |
Associate the object to a scene. a GUID for that object in the scene is assigned. | |
C3DScene * | GetScene () const |
Get the associated object scene. | |
BaseObjectID | GetObjectID () const |
Return the node GUID depending on the scene. If no scene defined, CGuidMgr::UNDEFINED_GUID is returned. | |
int | GetInstanceCount () const |
Return the instance count. If the count then this is a single object that is referenced only one time in the scene. | |
bool | IsInstanciated () const |
return true if several instance of the object exists. The C3DSceneNode that reference these instances can be retrieved using C3DScene::GetInstancesByID | |
unsigned int | GetCustomDataChecksum (unsigned int ignoreCustomID,...) const |
For object which are not geometric object, the checksum could be made on CustomData, and you can ignore some ID might be ignored if they content runtime value that does not reflect a change of the content. The list must be terminated by 0. | |
virtual bool | NeedUpdate () const |
unsigned int | GetInvalidateFlags () const |
Return the flags that have been invalidated. | |
bool | IsInvalidate (OBJECT_UPDATE_PROPERTIES flag) const |
Allow to know if an invalidate flag has been set. Invalidate flag is reset when Update is called. | |
longint | GetUpdateStamp (OBJECT_UPDATE_PROPERTIES flags) const |
Allow to know if the given flag changed between two call. | |
virtual bool | IsFinalObject () const |
virtual C3DBaseObject * | GetFinalObject (bool detach=false, bool computeIfNeeded=true) |
Returns the object itself or any kind of object. For example for a patch it can returns a C3DObject or a C3DPatch if the patch is not subdivided. | |
C3DBaseObject * | Copy (int copyflags=OBJECT_COPY_DEFAULT, C3DObjectCreator *objectCreator=NULL) const |
void | SetFlag (OBJECT_PROPERTIES flag, bool set) |
void | SetFlags (unsigned int flags, bool set) |
bool | IsFlagSet (OBJECT_PROPERTIES flag) const |
bool | IsOneFlagSet (unsigned int flags) const |
bool | CheckFlags (unsigned int checkflags, bool allSetOrNoneSet) const |
CCustomData & | GetCustomData () |
const CCustomData & | GetCustomData () const |
operator C3DGeomObject * () const | |
Operators (cast operators, return NULL if object is this or if the type is incorrect It does not perform any geometric or topologic conversions. | |
operator C3DGroup * () const | |
Cf. C3DGeomObject*(). | |
operator C3DObject * () const | |
Cf. C3DGeomObject*(). | |
operator C3DCurve * () const | |
Cf. C3DGeomObject*(). | |
operator C3DPatch * () const | |
Cf. C3DGeomObject*(). | |
operator C3DDummy * () const | |
Cf. C3DGeomObject*(). | |
operator C3DLight * () const | |
Cf. C3DGeomObject*(). | |
operator C3DCamera * () const | |
Cf. C3DGeomObject*(). | |
bool | IsGeomObject () const |
return true if the object is an OBJECT_GEOM. Cf. OBJECT_KINDOF | |
OBJECT_KINDOF | GetKindOf () const |
return OBJECT_KINDOF, which defines the kind of object. | |
CXString | GetTypeString () const |
return a string containing the kind of the object ("curve", "camera"...) | |
![]() | |
virtual bool | Delete () |
int | GetRefCount () const |
int | AddRef () const |
Static Public Member Functions | |
static CMultiresolutionObject1 * | SetMultiresolutionData (C3DObject *object, void *data, unsigned long size, unsigned optimizationMode=OPTIMIZE_NONE) |
static void * | AllocMultiresolutionData (unsigned long size) |
static void | FreeMultiresolutionData (void *data) |
![]() | |
static C3DBaseObject * | Create (OBJECT_KINDOF kindOf) |
Allocates and creates a new empty object of the given type OBJECT_KINDOF. Uses xNew internally. | |
Additional Inherited Members | |
![]() | |
enum | faceModeEnum { FACE_DEFAULT_MODE = 0 , SINGLE_SIDE , DOUBLE_SIDE } |
enum | weldMode { WELD_NONE = 0 , WELD_SRC_CANT_HAVE_FLAGS = 0x01 , WELD_SRC_MUST_HAVE_FLAGS = 0x02 , WELD_TARGET_CANT_HAVE_FLAGS = 0x04 , WELD_TARGET_MUST_HAVE_FLAGS = 0x08 } |
typedef enum C3DGeomObject::faceModeEnum | faceModeEnum |
typedef enum C3DGeomObject::weldMode | WeldMode |
|
virtual |
Set the object channellist and delete existing one, unless deletePrevious = false.
Reimplemented from C3DGeomObject.
|
virtual |
Set the object face list and delete existing one, unless deletePrevious = false.
Reimplemented from C3DGeomObject.
|
virtual |
Set the object point list and delete existing one, unless deletePrevious = false.
Reimplemented from C3DGeomObject.