Drag[en]gine Game Engine  1.21
deRig Class Reference

Rig file resource. More...

#include <deRig.h>

Inheritance diagram for deRig:
deFileResource deResource deObject

Public Types

typedef deTObjectReference< deRigRef
 Type holding strong reference. More...
 
- Public Types inherited from deResource
typedef deTObjectReference< deResourceRef
 Type holding strong reference. More...
 
- Public Types inherited from deObject
typedef deTObjectReference< deObjectRef
 Type holding strong reference. More...
 

Public Member Functions

Management
const decVectorGetCentralMassPoint () const
 Central mass point position. More...
 
void SetCentralMassPoint (const decVector &cmp)
 Set central mass point position. More...
 
bool GetModelCollision () const
 Use component model for collision instead of shapes if present. More...
 
void SetModelCollision (bool modelCollision)
 Set if component model is used for collision instead of shapes if present. More...
 
bool Verify () const
 Verify rig is valid. More...
 
void Prepare ()
 Prepare rig after loading. More...
 
Bones
int GetBoneCount () const
 Number of bones. More...
 
deRigBoneGetBoneAt (int index) const
 Bone at index. More...
 
int IndexOfBoneNamed (const char *name) const
 Index of named bone or -1 if absent. More...
 
bool HasBoneNamed (const char *name) const
 Named bone is present. More...
 
void AddBone (deRigBone *bone)
 Add bone. More...
 
void RemoveAllBones ()
 Remove all bones. More...
 
int GetRootBone () const
 Index of physics root bone or -1 if not set. More...
 
void SetRootBone (int rootBone)
 Set physics root bone or -1 if not set. More...
 
Shapes
const decShapeListGetShapes () const
 Shapes. More...
 
void SetShapes (const decShapeList &shapes)
 Set shapes. More...
 
const decStringListGetShapeProperties () const
 Shape properties. More...
 
void SetShapeProperties (const decStringList &properties)
 Set shape properties. More...
 
System Peers
deBasePhysicsRigGetPeerPhysics () const
 Physics system peer or NULL if not set. More...
 
void SetPeerPhysics (deBasePhysicsRig *peer)
 Set physics system peer or NULL if not set. More...
 
- Public Member Functions inherited from deFileResource
deVirtualFileSystemGetVirtualFileSystem () const
 Virtual file system or NULL if build from memory. More...
 
const decStringGetFilename () const
 Filename or empty string if build from memory. More...
 
TIME_SYSTEM GetModificationTime () const
 Modification time used to detect resources changing on disk while loaded. More...
 
void SetModificationTime (TIME_SYSTEM modificationTime)
 Set modification time used to detect resources changing on disk while loaded. More...
 
bool GetAsynchron () const
 Resource is asynchron. More...
 
void SetAsynchron (bool asynchron)
 Set if resource is asynchron. More...
 
bool GetOutdated () const
 
void MarkOutdated ()
 
 deFileResource (deFileResourceManager *resourceManager, deVirtualFileSystem *vfs, const char *filename, TIME_SYSTEM modificationTime)
 Create file resource. More...
 
- Public Member Functions inherited from deResource
deResourceManagerGetResourceManager () const
 Resource manager or NULL if resource is leaking. More...
 
deEngineGetEngine () const
 Game engine object from resource manager. More...
 
deResourceGetLLManagerPrev () const
 Previous resource in the resource manager linked list. More...
 
void SetLLManagerPrev (deResource *resource)
 Set next resource in the resource manager linked list. More...
 
deResourceGetLLManagerNext () const
 Next resource in the resource manager linked list. More...
 
void SetLLManagerNext (deResource *resource)
 Set next resource in the resource manager linked list. More...
 
void MarkLeaking ()
 Marks the resource leaking. More...
 
 deResource (deResourceManager *resourceManager)
 Create resource. More...
 
- Public Member Functions inherited from deObject
int GetRefCount () const
 Reference count. More...
 
void AddReference ()
 Add reference increasing reference count by 1. More...
 
void FreeReference ()
 Decrease reference count by one and delete object if count reaches 0. More...
 
 deObject ()
 Create object with reference count of 1. More...
 

Constructors and Destructors

 deRig (deRigManager *resourceManager, deVirtualFileSystem *vfs, const char *filename, TIME_SYSTEM modificationTime)
 Create rig. More...
 
virtual ~deRig ()
 Clean up rig. More...
 

Additional Inherited Members

- Protected Member Functions inherited from deFileResource
virtual ~deFileResource ()
 Clean up file resource. More...
 
- Protected Member Functions inherited from deResource
virtual ~deResource ()
 Clean up resource. More...
 
- Protected Member Functions inherited from deObject
virtual ~deObject ()
 Clean up object. More...
 

Detailed Description

Rig file resource.

Rigs define the sceleton of a static or articulated physics bodies. Animations and components are mapped to a rig for animation. Rigs are also used by the physics system to provide collision detection and physical simulations. For the physics system the root bone is mapped to the component collider. If this bone is missing the simulation produces incorrect behavior.

Shapes
Shapes define the physical shape of resource and are only used by the physics system. See decShapeList for information about the available shape types. Shapes can be defined for bones as well as the rig as a whole. For static rigs shapes are only placed on the rig itself. For articulated rigs shapes are only placed on bines. Shapes on the entire rig are ignored for articulated rigs.

Shapes can be assigned a single shape property string. This allows to transport some additional game specific information with individual shapes of a rig. A typical use case is modifying the material sound for certain shapes. The user can choose the content and format of the string. By default all shapes have an empty string assigned.

Model Collision
By default rig and bones use shapes to define the collision volumes. It is possible to use the model of the component (if a deColliderComponent) if present. If model collision is used all shapes for rigs and bones are ignored and the model hull is used as collision volume. This allows for a fine grained and dynamic collision volume but is slower than shape collision and can lead to strange results if model faces intersect due to animation. Non-deformable models provide safer results and and faster than deformable models. If you can always use shapes since they provide the fastest and most stable behavior.

Member Typedef Documentation

◆ Ref

Type holding strong reference.

Constructor & Destructor Documentation

◆ deRig()

deRig::deRig ( deRigManager resourceManager,
deVirtualFileSystem vfs,
const char *  filename,
TIME_SYSTEM  modificationTime 
)

Create rig.

◆ ~deRig()

virtual deRig::~deRig ( )
protectedvirtual

Clean up rig.

Note
Subclasses should set their destructor protected too to avoid users accidently deleting a reference counted object through the object pointer. Only FreeReference() is allowed to delete the object.

Member Function Documentation

◆ AddBone()

void deRig::AddBone ( deRigBone bone)

Add bone.

Exceptions
deeInvalidParamNamed bone is present.

◆ GetBoneAt()

deRigBone& deRig::GetBoneAt ( int  index) const

Bone at index.

Exceptions
deeOutOfBoundaryindex is less than 0 or greater than or equal to GetBoneCount().

◆ GetBoneCount()

int deRig::GetBoneCount ( ) const
inline

Number of bones.

◆ GetCentralMassPoint()

const decVector& deRig::GetCentralMassPoint ( ) const
inline

Central mass point position.

◆ GetModelCollision()

bool deRig::GetModelCollision ( ) const
inline

Use component model for collision instead of shapes if present.

◆ GetPeerPhysics()

deBasePhysicsRig* deRig::GetPeerPhysics ( ) const
inline

Physics system peer or NULL if not set.

◆ GetRootBone()

int deRig::GetRootBone ( ) const
inline

Index of physics root bone or -1 if not set.

◆ GetShapeProperties()

const decStringList& deRig::GetShapeProperties ( ) const
inline

Shape properties.

◆ GetShapes()

const decShapeList& deRig::GetShapes ( ) const
inline

Shapes.

◆ HasBoneNamed()

bool deRig::HasBoneNamed ( const char *  name) const

Named bone is present.

◆ IndexOfBoneNamed()

int deRig::IndexOfBoneNamed ( const char *  name) const

Index of named bone or -1 if absent.

◆ Prepare()

void deRig::Prepare ( )

Prepare rig after loading.

◆ RemoveAllBones()

void deRig::RemoveAllBones ( )

Remove all bones.

◆ SetCentralMassPoint()

void deRig::SetCentralMassPoint ( const decVector cmp)

Set central mass point position.

◆ SetModelCollision()

void deRig::SetModelCollision ( bool  modelCollision)

Set if component model is used for collision instead of shapes if present.

◆ SetPeerPhysics()

void deRig::SetPeerPhysics ( deBasePhysicsRig peer)

Set physics system peer or NULL if not set.

◆ SetRootBone()

void deRig::SetRootBone ( int  rootBone)

Set physics root bone or -1 if not set.

Exceptions
deeOutOfBoundaryindex is less than -1 or greater than or equal to GetBoneCount().

◆ SetShapeProperties()

void deRig::SetShapeProperties ( const decStringList properties)

Set shape properties.

Exceptions
deeInvalidParamNumber of strings in properties does not match GetShapes().GetCount().

◆ SetShapes()

void deRig::SetShapes ( const decShapeList shapes)

Set shapes.

Resets shape properties to empty strings for all shapes.

◆ Verify()

bool deRig::Verify ( ) const

Verify rig is valid.


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