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

This is the base class for any object containing geometry (curve, polygonal object, patch...) More...

Detailed Description

This is the base class for any object containing geometry (curve, polygonal object, patch...)

Such kind of objects have a C3DPointList and/or C3DFaceList and some additional channel information. Cf. Working with objects to get more details on objects and particularly C3DGeomObject.

#include <3DGeomObject.h>

Inheritance diagram for C3DGeomObject:
C3DBaseObject CInstanciatedObject C3DCurve C3DObject C3DPatch C3DExtObject CMultiresolutionObject CMultiresolutionObject1

Public Types

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
 

Public Member Functions

 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)
 
C3DFaceListGetFaceList ()
 Get the object face list.
 
C3DPointListGetPointList ()
 Get the object point list.
 
CDependentChannelsGetChannels ()
 Get the object channels.
 
const CDependentChannelsGetChannels () const
 Get const object channels.
 
virtual void SetFaceList (C3DFaceList *faceslist, bool deletePrevious=true)
 Set the object face list and delete existing one, unless deletePrevious = false.
 
virtual void SetPointList (C3DPointList *pointslist, bool deletePrevious=true)
 Set the object point list and delete existing one, unless deletePrevious = false.
 
virtual void SetChannels (CDependentChannels *channels, bool deletePrevious=true)
 Set the object channellist and delete existing one, unless deletePrevious = false.
 
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.
 
Face smoothing

these methods does not generates normals, they only predefined the smooth angle to be used when point normals are generated. To generates point normals, use CPointNormalChannel *GetPointNormalChannel() or GenerateNormals

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.
 
Face culling
void SetFaceMode (faceModeEnum mode)
 
faceModeEnum GetFaceMode (void) const
 
Channel information
CChannelGetChannelByID (ChannelID id, Channel3DType type)
 
CChannelGetChannelByIndex (int index, Channel3DType type=CHANNEL_TYPE_UNDEFINED, bool onlyValid=true)
 
CPointNormalChannelGetPointNormalChannel ()
 
CFaceNormalChannelGetFaceNormalChannel ()
 
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.
 
Mesh operation
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.
 
C3DObjectSubObject (int count, SUBOBJECT_MODE mode)
 Return a sub object from this object based on the faces facecount index number and SUBOBJECT_MODE parameter.
 
C3DObjectSubObject (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)
 
Materials used by the object
bool HasDifferentFrontAndBackUVChannel (const CGeomInfo *info, MapType maptype) const
 
bool HasBackFaceMaterials () const
 Return true if the object has different front and back face materials.
 
const CFBMaterialHashMapGetFBMaterialsHashMap ()
 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.
 
- Public Member Functions inherited from C3DBaseObject
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.
 
C3DSceneGetScene () 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 C3DBaseObjectGetFinalObject (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.
 
C3DBaseObjectCopy (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
 
CCustomDataGetCustomData ()
 
const CCustomDataGetCustomData () 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"...)
 
- Public Member Functions inherited from CInstanciatedObject
virtual bool Delete ()
 
int GetRefCount () const
 
int AddRef () const
 

Additional Inherited Members

- Static Public Member Functions inherited from C3DBaseObject
static C3DBaseObjectCreate (OBJECT_KINDOF kindOf)
 Allocates and creates a new empty object of the given type OBJECT_KINDOF. Uses xNew internally.
 

Member Enumeration Documentation

◆ weldMode

Enumerator
WELD_NONE 

Any points could be welded.

WELD_SRC_CANT_HAVE_FLAGS 

A point will not move if it has the specified flags.

WELD_SRC_MUST_HAVE_FLAGS 

A point will move only if it has the specified flags.

WELD_TARGET_CANT_HAVE_FLAGS 

A point can't be a target if it has the specified flags (a target is a point that can be welded to)

WELD_TARGET_MUST_HAVE_FLAGS 

A point can be a target only if it has the specified flags.

Member Function Documentation

◆ GetBoundingBox() [1/2]

bool C3DGeomObject::GetBoundingBox ( C3DBBox bbox,
unsigned int  bboxflags,
unsigned int  elmtflags = 0,
bool  set = false,
const C3DSceneNode node = NULL 
)
See also
C3DGeomObject::GetBoundingBox
Returns
If successful, it returns true with bbox containing the required bounding box.

◆ GetBoundingBox() [2/2]

bool C3DGeomObject::GetBoundingBox ( C3DPoint point1,
C3DPoint point2,
unsigned int  bboxflags,
unsigned int  elmtflags = 0,
bool  set = false,
const C3DSceneNode node = NULL 
)

Computes the bounding box, on different way. BBOX_FACES or BBOX_POINTS must be at least set, depending on wether you want a bounding box on points, or on faces. elmtflags can be optionnaly used to ignore points or faces based on their attributes (hidden face...)

Parameters
bboxflagsis combination of BBOX_MODE flags. BBOX_FACES or BBOX_POINTS must be at least set, depending on wether you want a bounding box on points, or on faces.
elmtflagsis one or more POINT_PROPERTIES or FACE_PROPERTIES flags. elmtflags can be optionnaly used to ignore some points or some faces based on their attributes (hidden face...)
nodeThe reference node must be provided if BBOX_EXACT is set.
Returns
If successful, it returns true with point1 and point2 containing the required bounding box limits.

◆ GetChecksum()

virtual unsigned int C3DGeomObject::GetChecksum ( unsigned int  checksumFlags = CHECKSUM_ALL) const
virtual

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.

Reimplemented from C3DBaseObject.

◆ InheritFlags()

virtual void C3DGeomObject::InheritFlags ( const C3DBaseObject srcObject,
int  copyFlags = OBJECT_COPY_DEFAULT 
)
virtual

This methods only inherits srcObject flags and custom data. It does not modify the data structure.

Reimplemented from C3DBaseObject.

◆ Invalidate()

virtual void C3DGeomObject::Invalidate ( unsigned int  objectInvalidationFlags,
bool  set = true 
)
virtual

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.

Reimplemented from C3DBaseObject.

Reimplemented in C3DPatch.

◆ InvalidateChannels()

virtual bool C3DGeomObject::InvalidateChannels ( unsigned int  channelType)
virtual

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.

Reimplemented from C3DBaseObject.

Reimplemented in C3DPatch.

◆ MatrixTransform()

virtual bool C3DGeomObject::MatrixTransform ( const C4x4Matrix matrix)
virtual

Transform the 3D information with the given matrix. The object should not be instanciated or all instances are modified.

Reimplemented from C3DBaseObject.

◆ Serialize()

virtual void C3DGeomObject::Serialize ( CXArchive ar)
virtual

Reimplemented from C3DBaseObject.

◆ SetChannels()

virtual void C3DGeomObject::SetChannels ( CDependentChannels channels,
bool  deletePrevious = true 
)
virtual

Set the object channellist and delete existing one, unless deletePrevious = false.

Reimplemented in C3DExtObject.

◆ SetFaceList()

virtual void C3DGeomObject::SetFaceList ( C3DFaceList faceslist,
bool  deletePrevious = true 
)
virtual

Set the object face list and delete existing one, unless deletePrevious = false.

Reimplemented in C3DExtObject.

◆ SetPointList()

virtual void C3DGeomObject::SetPointList ( C3DPointList pointslist,
bool  deletePrevious = true 
)
virtual

Set the object point list and delete existing one, unless deletePrevious = false.

Reimplemented in C3DExtObject.

◆ Update()

virtual bool C3DGeomObject::Update ( C3DScene scene,
unsigned int  updateMode 
)
virtual

Information that have been invalidated are recomputed when calling this method.IsInstanciated.

Reimplemented from C3DBaseObject.

Reimplemented in C3DPatch.

◆ Weld3DPoints()

bool C3DGeomObject::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.

Parameters
distancethe value can be relative or absolute.
  • absolute: points which distance is lower than the specified value are welded.
  • relative: value is between 0.0 and 1.0 (but can be more) and is a percentage of the lowest object bounding box dimension.
absolutethe distance specified is absolute. Otherwise di
handleChannelsallows to weld duplicated value in the corresponding channels. This make a clean operation on the confused value of the corresponding channels. This call CDependentChannels::Weld internally with tolerance = 0.0
  • When distance is 0.0, following parameters does not apply
  • If distance != 0.0, there is a way to control which points can move and which shouldn't move
coupleFlagsNbr0 if no variadic parameters are specified, the number of variadic parameters otherwise.
variadic parameterscouple of values that defines the flags the points must have to be welded or welded to. Ie: POINT_IS_SELECTED|POINT_BELONG_TO_BORDER, WELD_SRC_MUST_HAVE_FLAGS|WELD_TARGET_MUST_HAVE_FLAGS, POINT_USER_PROPERTIES1|POINT_USER_PROPERTIES2, WELD_TARGET_MUST_HAVE_FLAGS, POINT_USER_PROPERTIES3, WELD_TARGET_CAN_HAVE_FLAGS, 0
Returns
true is something was welded, false if nothing changed

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