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

This is the base class for any kind of object. More...

Detailed Description

This is the base class for any kind of object.

The kind of C3DBaseObject can be retrieved using GetKindOf, which returns OBJECT_KINDOF. This is a way to cast the C3DBaseObject pointer into to one of its subclasses. Objects can be instantiated, which means referenced several time through the scene. This is why the destructor is protected and you must use Delete instead.
Cf. Working with objects to get more details on objects and particularly C3DGeomObject.

#include <3DBaseObject.h>

Inheritance diagram for C3DBaseObject:
CInstanciatedObject C3DCamera C3DDummy C3DGeomObject C3DGroup C3DLight C3DCurve C3DObject C3DPatch C3DExtObject CMultiresolutionObject CMultiresolutionObject1

Public Member Functions

virtual bool DeleteFromNode ()
 
virtual void PostSerialize (CXArchive &ar, bool lastCall)
 
virtual void Serialize (CXArchive &ar)
 
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.
 
Object instanciation

objectGUID allows to get a single ID for a given object. This ID changed each time the object is copied, make any object having a single particular ID, except when object is instanciated. All the objects instanciation share the same objectGUID. Important: Instance of an object must be attached to a node, using C3DSceneNode::SetObject. Use AddRef otherwise. Note: When object are copied between different scene, object instance are kept but a copy of the source is made and it has a different objectGUID

Instanciation does not support material or UV bindings Use C3DScene::CreateObjectInstance allow to create a new instance of the given object, or use Copy(OBJECT_COPY_CREATE_INSTANCE), then C3DSceneNode::SetObject

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
 
Checksum

These methods can be used to know if an object changed between two states. If the checksum changed then the object too.

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 unsigned int GetChecksum (unsigned int checksumFlags=CHECKSUM_ALL) const
 When not overriden, the checksum is only made on the kind of object. When overidden, only the geometric data is taken into account. CustomData content is ignored, but if it is important a call to GetChecksum(unsigned int, ...) could be done.
 
Object invalidation
virtual bool NeedUpdate () const
 
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 objectInvalidationFlags, 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.
 
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.
 
Final object

Some kind of object might computes a final object, that depends of different internal parameters. This is the case for C3DPatch for example where the final object depend on the subdivision level. Most of the time the object and the final object are the same

Returns true if this object is the object to be display (GetFinalObject == this) or false if the object to display should be computed from using this internal information (C3DPatch for example)

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.
 
Object operations
virtual bool MatrixTransform (const C4x4Matrix &matrix)
 Transform the 3D information with the given matrix. The object should not be instanciated or all instance are modified.
 
C3DBaseObjectCopy (int copyflags=OBJECT_COPY_DEFAULT, C3DObjectCreator *objectCreator=NULL) const
 
Kind of object, flags and custom data
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
 
virtual void InheritFlags (const C3DBaseObject &srcObject, int copyflags=OBJECT_COPY_DEFAULT)
 This methods only inherits srcObject flags and custom data and optionaly objectGUID / instanceID if srcObject is to be replaced by the object. It does not modify the data structure.
 
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
 

Static Public Member Functions

static C3DBaseObjectCreate (OBJECT_KINDOF kindOf)
 Allocates and creates a new empty object of the given type OBJECT_KINDOF. Uses xNew internally.
 

Member Function Documentation

◆ GetChecksum()

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

When not overriden, the checksum is only made on the kind of object. When overidden, only the geometric data is taken into account. CustomData content is ignored, but if it is important a call to GetChecksum(unsigned int, ...) could be done.

Reimplemented in C3DCamera, C3DDummy, and C3DGeomObject.

◆ GetFinalObject()

virtual C3DBaseObject * C3DBaseObject::GetFinalObject ( bool  detach = false,
bool  computeIfNeeded = true 
)
inlinevirtual

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.

Reimplemented in C3DCamera, C3DLight, and C3DPatch.

◆ InheritFlags()

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

This methods only inherits srcObject flags and custom data and optionaly objectGUID / instanceID if srcObject is to be replaced by the object. It does not modify the data structure.

Reimplemented in C3DGeomObject.

◆ Invalidate()

virtual void C3DBaseObject::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 in C3DGeomObject, and C3DPatch.

◆ InvalidateChannels()

virtual bool C3DBaseObject::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 in C3DGeomObject, and C3DPatch.

◆ MatrixTransform()

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

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

Reimplemented in C3DGeomObject.

◆ operator C3DGeomObject *()

C3DBaseObject::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.

◆ SetScene()

virtual void C3DBaseObject::SetScene ( C3DScene scene)
virtual

Associate the object to a scene. a GUID for that object in the scene is assigned.

Reimplemented in C3DCamera, and C3DPatch.

◆ Update()

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

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

Reimplemented in C3DGeomObject, and C3DPatch.


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