Drag[en]gine Game Engine  1.0
deRig Class Reference

Rig file resource. More...

#include <deRig.h>

Inheritance diagram for deRig:
deFileResource deResource deObject

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
deBasePhysicsRigGetPhysicsRig () const
 Physics system peer or NULL if not set. More...
 
void SetPhysicsRig (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...
 
bool GetAsynchron () const
 Resource is asynchron. More...
 
void SetAsynchron (bool asynchron)
 Set if resource is asynchron. More...
 
 deFileResource (deResourceManager *resourceManager, deVirtualFileSystem *vfs, const char *filename)
 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)
 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.
Author
Pl├╝ss Roland
Version
1.0
Date
2016

Constructor & Destructor Documentation

◆ deRig()

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

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.

Referenced by GetBoneCount().

◆ GetBoneAt()

deRigBone& deRig::GetBoneAt ( int  index) const

Bone at index.

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

Referenced by GetBoneCount().

◆ GetBoneCount()

int deRig::GetBoneCount ( ) const
inline

◆ GetCentralMassPoint()

const decVector& deRig::GetCentralMassPoint ( ) const
inline

Central mass point position.

References SetCentralMassPoint().

◆ GetModelCollision()

bool deRig::GetModelCollision ( ) const
inline

Use component model for collision instead of shapes if present.

References Prepare(), SetModelCollision(), and Verify().

◆ GetPhysicsRig()

deBasePhysicsRig* deRig::GetPhysicsRig ( ) const
inline

Physics system peer or NULL if not set.

References SetPhysicsRig().

◆ GetRootBone()

int deRig::GetRootBone ( ) const
inline

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

References SetRootBone().

◆ GetShapeProperties()

const decStringList& deRig::GetShapeProperties ( ) const
inline

Shape properties.

References SetShapeProperties().

◆ GetShapes()

const decShapeList& deRig::GetShapes ( ) const
inline

Shapes.

References SetShapes().

◆ HasBoneNamed()

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

Named bone is present.

Referenced by GetBoneCount().

◆ IndexOfBoneNamed()

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

Index of named bone or -1 if absent.

Referenced by GetBoneCount().

◆ Prepare()

void deRig::Prepare ( )

Prepare rig after loading.

Referenced by GetModelCollision().

◆ RemoveAllBones()

void deRig::RemoveAllBones ( )

Remove all bones.

Referenced by GetBoneCount().

◆ SetCentralMassPoint()

void deRig::SetCentralMassPoint ( const decVector cmp)

Set central mass point position.

Referenced by GetCentralMassPoint().

◆ SetModelCollision()

void deRig::SetModelCollision ( bool  modelCollision)

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

Referenced by GetModelCollision().

◆ SetPhysicsRig()

void deRig::SetPhysicsRig ( deBasePhysicsRig peer)

Set physics system peer or NULL if not set.

Referenced by GetPhysicsRig().

◆ 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().

Referenced by GetRootBone().

◆ SetShapeProperties()

void deRig::SetShapeProperties ( const decStringList properties)

Set shape properties.

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

Referenced by GetShapeProperties().

◆ SetShapes()

void deRig::SetShapes ( const decShapeList shapes)

Set shapes.

Resets shape properties to empty strings for all shapes.

Referenced by GetShapes().

◆ Verify()

bool deRig::Verify ( ) const

Verify rig is valid.

Referenced by GetModelCollision().


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