Drag[en]gine Game Engine  1.21
deComponent Class Reference

Component Resource. More...

#include <deComponent.h>

Inheritance diagram for deComponent:
deResource deObject

Public Types

enum  eMovementHints { emhStationary , emhJittering , emhDynamic }
 Movement hints. More...
 
typedef deTObjectReference< deComponentRef
 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 decDVectorGetPosition () const
 Position. More...
 
void SetPosition (const decDVector &pos)
 Set position. More...
 
const decQuaternionGetOrientation () const
 Orientation. More...
 
void SetOrientation (const decQuaternion &orientation)
 Set orientation. More...
 
const decVectorGetScaling () const
 Scaling. More...
 
void SetScaling (const decVector &scale)
 Set scaling. More...
 
deModelGetModel () const
 Model or NULL if not assigned. More...
 
void SetModel (deModel *model)
 Set model or NULL if not set. More...
 
void SetModelKeepTextures (deModel *model)
 Set model or NULL if not set while keeping textures. More...
 
deSkinGetSkin () const
 Skin or NULL if not assigned. More...
 
void SetSkin (deSkin *skin)
 Set skin or NULL if not assigned. More...
 
deRigGetRig () const
 Rig or NULL if not assigned. More...
 
void SetRig (deRig *rig)
 Set rig or NULL if not assigned. More...
 
void SetModelAndSkin (deModel *model, deSkin *skin)
 Set model and skin at the same time. Either one can be NULL. More...
 
deOcclusionMeshGetOcclusionMesh () const
 Occlusion mesh or NULL if not assigned. More...
 
void SetOcclusionMesh (deOcclusionMesh *occmesh)
 Set occlusion mesh or NULL if not assigned. More...
 
deModelGetAudioModel () const
 Audio model or NULL if not used. More...
 
void SetAudioModel (deModel *model)
 Set audio model or NULL if not set. More...
 
bool GetVisible () const
 Component is visible. More...
 
void SetVisible (bool visible)
 Set if component is visible. More...
 
eMovementHints GetHintMovement () const
 Movement hint. More...
 
void SetHintMovement (eMovementHints hint)
 Set movement hint. More...
 
bool GetEnableGI () const
 Enable GI in graphic module if supported. More...
 
void SetEnableGI (bool enable)
 Set if enabled for GI in graphic module if supported. More...
 
int GetHintGIImportance () const
 GI important hint. More...
 
void SetHintGIImportance (int importance)
 Set GI important hint. More...
 
const decDMatrixGetMatrix ()
 Component matrix. More...
 
const decDMatrixGetInverseMatrix ()
 Inverse component matrix. More...
 
int GetBoneCount () const
 Count of bones. More...
 
deComponentBoneGetBoneAt (int index) const
 Bone at index. More...
 
void UpdateBoneAt (int index)
 Updates the given bone. More...
 
void InvalidateBones ()
 Mark bones dirty. More...
 
void ValidateBones ()
 Mark bones no more dirty. More...
 
int GetVertexPositionSetCount () const
 Vertex position set count. More...
 
float GetVertexPositionSetWeightAt (int index) const
 Vertex position set weight. More...
 
void SetVertexPositionSetWeightAt (int index, float weight)
 Set vertex position set weight. More...
 
void InvalidateMesh ()
 Mark mesh dirty. More...
 
void InvalidateExtends ()
 Mark extends dirty. More...
 
void CopyBonesToComponent (deComponent &component)
 Copy bone states to matching bones states of another component. More...
 
deDynamicSkinGetDynamicSkin () const
 Dynamic skin or null if not used. More...
 
void SetDynamicSkin (deDynamicSkin *dynamicSkin)
 Set dynamic skin or null if not used. More...
 
deAnimatorGetAnimator () const
 Render only animator or NULL to use none. More...
 
void SetAnimator (deAnimator *animator)
 Set render only animator or NULL to use none. More...
 
const decLayerMaskGetLayerMask () const
 Layer mask. More...
 
void SetLayerMask (const decLayerMask &layerMask)
 Set layer mask. More...
 
void PrepareMatrix ()
 Prepare matrices. More...
 
void PrepareBones ()
 Prepare bone matrices. More...
 
Animator Tasks
deParallelTaskGetAnimatorTask () const
 Animator task or NULL if none is pending affecting this component. More...
 
void SetAnimatorTask (deParallelTask *task)
 Set animator task or NULL if none is pending affecting this component. More...
 
void WaitAnimatorTaskFinished ()
 Ensure animator task has finished if present. More...
 
Textures
int GetTextureCount () const
 Number of textures. More...
 
deComponentTextureGetTextureAt (int index) const
 Texture with the given index. More...
 
int IndexOfTextureClosestTo (const decVector &position, float radius) const
 Retrieve index of the texture of the face closest to a position or -1 if not found. More...
 
void NotifyTextureChanged (int index) const
 Notifies the peers that a texture changed. More...
 
Decals Management
int GetDecalCount () const
 Number of decals. More...
 
deDecalGetRootDecal () const
 Root decal or NULL if there are none. More...
 
void AddDecal (deDecal *decal)
 Add decal. More...
 
void RemoveDecal (deDecal *decal)
 Remove decal. More...
 
void RemoveAllDecals ()
 Remove all decals. More...
 
Collision Detection
void FindDecalsAt (const decVector &point, deDecalList &list) const
 Collect decals in contact with point. More...
 
void FindDecalsTouching (decShape *shape, deDecalList &list) const
 Collect decals in contact with shape. More...
 
System Peers
deBaseGraphicComponentGetPeerGraphic () const
 Graphic System Peer. More...
 
void SetPeerGraphic (deBaseGraphicComponent *peer)
 Set graphic System Peer. More...
 
deBasePhysicsComponentGetPeerPhysics () const
 Physics System Peer. More...
 
void SetPeerPhysics (deBasePhysicsComponent *peer)
 Set physics System Peer. More...
 
deBaseAudioComponentGetPeerAudio () const
 Audio System Peer. More...
 
void SetPeerAudio (deBaseAudioComponent *peer)
 Set audio System Peer. More...
 
deBaseAnimatorComponentGetPeerAnimator () const
 Animator peer or NULL if not set. More...
 
void SetPeerAnimator (deBaseAnimatorComponent *peer)
 Set animator peer or NULL if not set. 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

 deComponent (deComponentManager *manager, deModel *model, deSkin *skin)
 Create new component. More...
 
virtual ~deComponent ()
 Clean up component. More...
 

Linked List

deWorldGetParentWorld () const
 Parent world or NULL. More...
 
void SetParentWorld (deWorld *world)
 Set parent world or NULL. More...
 
deComponentGetLLWorldPrev () const
 Previous component in the parent world linked list. More...
 
void SetLLWorldPrev (deComponent *component)
 Set next component in the parent world linked list. More...
 
deComponentGetLLWorldNext () const
 Next component in the parent world linked list. More...
 
void SetLLWorldNext (deComponent *component)
 Set next component in the parent world linked list. More...
 

Additional Inherited Members

- 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

Component Resource.

Combines various resources to represent an element visually, physically and audio wise in the game world. Model textures are mapped to skin textures. Rig bones define the available component bones. Model bones are mapped to Rig bones.

Member Typedef Documentation

◆ Ref

Type holding strong reference.

Member Enumeration Documentation

◆ eMovementHints

Movement hints.

Enumerator
emhStationary 

Component remains static for the entire lifetime.

emhJittering 

Component remains mostly static jittering in a small area.

emhDynamic 

Component moves around freely.

Constructor & Destructor Documentation

◆ deComponent()

deComponent::deComponent ( deComponentManager manager,
deModel model,
deSkin skin 
)

Create new component.

◆ ~deComponent()

virtual deComponent::~deComponent ( )
protectedvirtual

Clean up component.

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

◆ AddDecal()

void deComponent::AddDecal ( deDecal decal)

Add decal.

Exceptions
deeInvalidParamdecal is NULL.
deeInvalidParamdecal has a parent world.

◆ CopyBonesToComponent()

void deComponent::CopyBonesToComponent ( deComponent component)

Copy bone states to matching bones states of another component.

◆ FindDecalsAt()

void deComponent::FindDecalsAt ( const decVector point,
deDecalList list 
) const

Collect decals in contact with point.

The point is best taken from an earlier collision test and is in world coordinates. The point is considered to be in the same sector as the component.

Parameters
[in]pointPoint on the surface to test.
[out]listList of decals to fill in. Not emptied before filling.

◆ FindDecalsTouching()

void deComponent::FindDecalsTouching ( decShape shape,
deDecalList list 
) const

Collect decals in contact with shape.

The shape is considered to be in the same sector as the component.

Parameters
[in]shapeShape to test.
[out]listList of decals to fill in. Not emptied before filling.

◆ GetAnimator()

deAnimator* deComponent::GetAnimator ( ) const
inline

Render only animator or NULL to use none.

◆ GetAnimatorTask()

deParallelTask* deComponent::GetAnimatorTask ( ) const
inline

Animator task or NULL if none is pending affecting this component.

Animator tasks can be created by Animator Modules to calculate bone states in parallel. Multiple animator tasks can affect a component but only the last one is stored in the component itself. If a task exists and PrepareBones() is called (or a function using it) the animator task is waited on to finish before continueing. Only Animator Modules use this function.

◆ GetAudioModel()

deModel* deComponent::GetAudioModel ( ) const
inline

Audio model or NULL if not used.

◆ GetBoneAt()

deComponentBone& deComponent::GetBoneAt ( int  index) const

Bone at index.

◆ GetBoneCount()

int deComponent::GetBoneCount ( ) const
inline

Count of bones.

◆ GetDecalCount()

int deComponent::GetDecalCount ( ) const
inline

Number of decals.

◆ GetDynamicSkin()

deDynamicSkin* deComponent::GetDynamicSkin ( ) const
inline

Dynamic skin or null if not used.

◆ GetEnableGI()

bool deComponent::GetEnableGI ( ) const
inline

Enable GI in graphic module if supported.

◆ GetHintGIImportance()

int deComponent::GetHintGIImportance ( ) const
inline

GI important hint.

Value is in the range from 0 (very unimportant) to 4 (very important). This hint can be used by the graphic module to improve performance by excluding components with a GI important below a user chosen threashold. The default important is 4.

◆ GetHintMovement()

eMovementHints deComponent::GetHintMovement ( ) const
inline

Movement hint.

◆ GetInverseMatrix()

const decDMatrix& deComponent::GetInverseMatrix ( )

Inverse component matrix.

◆ GetLayerMask()

const decLayerMask& deComponent::GetLayerMask ( ) const
inline

Layer mask.

◆ GetLLWorldNext()

deComponent* deComponent::GetLLWorldNext ( ) const
inline

Next component in the parent world linked list.

◆ GetLLWorldPrev()

deComponent* deComponent::GetLLWorldPrev ( ) const
inline

Previous component in the parent world linked list.

◆ GetMatrix()

const decDMatrix& deComponent::GetMatrix ( )

Component matrix.

◆ GetModel()

deModel* deComponent::GetModel ( ) const
inline

Model or NULL if not assigned.

◆ GetOcclusionMesh()

deOcclusionMesh* deComponent::GetOcclusionMesh ( ) const
inline

Occlusion mesh or NULL if not assigned.

◆ GetOrientation()

const decQuaternion& deComponent::GetOrientation ( ) const
inline

Orientation.

◆ GetParentWorld()

deWorld* deComponent::GetParentWorld ( ) const
inline

Parent world or NULL.

◆ GetPeerAnimator()

deBaseAnimatorComponent* deComponent::GetPeerAnimator ( ) const
inline

Animator peer or NULL if not set.

◆ GetPeerAudio()

deBaseAudioComponent* deComponent::GetPeerAudio ( ) const
inline

Audio System Peer.

◆ GetPeerGraphic()

deBaseGraphicComponent* deComponent::GetPeerGraphic ( ) const
inline

Graphic System Peer.

◆ GetPeerPhysics()

deBasePhysicsComponent* deComponent::GetPeerPhysics ( ) const
inline

Physics System Peer.

◆ GetPosition()

const decDVector& deComponent::GetPosition ( ) const
inline

Position.

◆ GetRig()

deRig* deComponent::GetRig ( ) const
inline

Rig or NULL if not assigned.

◆ GetRootDecal()

deDecal* deComponent::GetRootDecal ( ) const
inline

Root decal or NULL if there are none.

◆ GetScaling()

const decVector& deComponent::GetScaling ( ) const
inline

Scaling.

◆ GetSkin()

deSkin* deComponent::GetSkin ( ) const
inline

Skin or NULL if not assigned.

◆ GetTextureAt()

deComponentTexture& deComponent::GetTextureAt ( int  index) const

Texture with the given index.

◆ GetTextureCount()

int deComponent::GetTextureCount ( ) const
inline

Number of textures.

◆ GetVertexPositionSetCount()

int deComponent::GetVertexPositionSetCount ( ) const
inline

Vertex position set count.

◆ GetVertexPositionSetWeightAt()

float deComponent::GetVertexPositionSetWeightAt ( int  index) const

Vertex position set weight.

◆ GetVisible()

bool deComponent::GetVisible ( ) const
inline

Component is visible.

◆ IndexOfTextureClosestTo()

int deComponent::IndexOfTextureClosestTo ( const decVector position,
float  radius 
) const

Retrieve index of the texture of the face closest to a position or -1 if not found.

◆ InvalidateBones()

void deComponent::InvalidateBones ( )

Mark bones dirty.

Mesh and extends are marked dirty too notifying peers if required.

◆ InvalidateExtends()

void deComponent::InvalidateExtends ( )

Mark extends dirty.

◆ InvalidateMesh()

void deComponent::InvalidateMesh ( )

Mark mesh dirty.

◆ NotifyTextureChanged()

void deComponent::NotifyTextureChanged ( int  index) const

Notifies the peers that a texture changed.

◆ PrepareBones()

void deComponent::PrepareBones ( )

Prepare bone matrices.

◆ PrepareMatrix()

void deComponent::PrepareMatrix ( )

Prepare matrices.

◆ RemoveAllDecals()

void deComponent::RemoveAllDecals ( )

Remove all decals.

◆ RemoveDecal()

void deComponent::RemoveDecal ( deDecal decal)

Remove decal.

Exceptions
deeInvalidParamdecal is NULL.
deeInvalidParamParent world of decal is not this world.

◆ SetAnimator()

void deComponent::SetAnimator ( deAnimator animator)

Set render only animator or NULL to use none.

◆ SetAnimatorTask()

void deComponent::SetAnimatorTask ( deParallelTask task)

Set animator task or NULL if none is pending affecting this component.

Animator tasks can be created by Animator Modules to calculate bone states in parallel. Multiple animator tasks can affect a component but only the last one is stored in the component itself. If a task exists and PrepareBones() is called (or a function using it) the animator task is waited on to finish before continueing. Only Animator Modules use this function.

◆ SetAudioModel()

void deComponent::SetAudioModel ( deModel model)

Set audio model or NULL if not set.

Shares textures with assigned model.

◆ SetDynamicSkin()

void deComponent::SetDynamicSkin ( deDynamicSkin dynamicSkin)

Set dynamic skin or null if not used.

◆ SetEnableGI()

void deComponent::SetEnableGI ( bool  enable)

Set if enabled for GI in graphic module if supported.

◆ SetHintGIImportance()

void deComponent::SetHintGIImportance ( int  importance)

Set GI important hint.

Value is in the range from 0 (very unimportant) to 4 (very important). This hint can be used by the graphic module to improve performance by excluding components with a GI important below a user chosen threshold.

◆ SetHintMovement()

void deComponent::SetHintMovement ( eMovementHints  hint)

Set movement hint.

◆ SetLayerMask()

void deComponent::SetLayerMask ( const decLayerMask layerMask)

Set layer mask.

◆ SetLLWorldNext()

void deComponent::SetLLWorldNext ( deComponent component)

Set next component in the parent world linked list.

◆ SetLLWorldPrev()

void deComponent::SetLLWorldPrev ( deComponent component)

Set next component in the parent world linked list.

◆ SetModel()

void deComponent::SetModel ( deModel model)

Set model or NULL if not set.

Textures are reset. To keep textures use setModelKeepTextures.

◆ SetModelAndSkin()

void deComponent::SetModelAndSkin ( deModel model,
deSkin skin 
)

Set model and skin at the same time. Either one can be NULL.

◆ SetModelKeepTextures()

void deComponent::SetModelKeepTextures ( deModel model)

Set model or NULL if not set while keeping textures.

Restores current state of textures after switching model if possible. Use this method instead of setModel if you set textures on the component and the new model is similar enough to match. Textures not existing anymore are not restored.

◆ SetOcclusionMesh()

void deComponent::SetOcclusionMesh ( deOcclusionMesh occmesh)

Set occlusion mesh or NULL if not assigned.

◆ SetOrientation()

void deComponent::SetOrientation ( const decQuaternion orientation)

Set orientation.

◆ SetParentWorld()

void deComponent::SetParentWorld ( deWorld world)

Set parent world or NULL.

◆ SetPeerAnimator()

void deComponent::SetPeerAnimator ( deBaseAnimatorComponent peer)

Set animator peer or NULL if not set.

◆ SetPeerAudio()

void deComponent::SetPeerAudio ( deBaseAudioComponent peer)

Set audio System Peer.

◆ SetPeerGraphic()

void deComponent::SetPeerGraphic ( deBaseGraphicComponent peer)

Set graphic System Peer.

◆ SetPeerPhysics()

void deComponent::SetPeerPhysics ( deBasePhysicsComponent peer)

Set physics System Peer.

◆ SetPosition()

void deComponent::SetPosition ( const decDVector pos)

Set position.

◆ SetRig()

void deComponent::SetRig ( deRig rig)

Set rig or NULL if not assigned.

◆ SetScaling()

void deComponent::SetScaling ( const decVector scale)

Set scaling.

◆ SetSkin()

void deComponent::SetSkin ( deSkin skin)

Set skin or NULL if not assigned.

◆ SetVertexPositionSetWeightAt()

void deComponent::SetVertexPositionSetWeightAt ( int  index,
float  weight 
)

Set vertex position set weight.

◆ SetVisible()

void deComponent::SetVisible ( bool  visible)

Set if component is visible.

◆ UpdateBoneAt()

void deComponent::UpdateBoneAt ( int  index)

Updates the given bone.

◆ ValidateBones()

void deComponent::ValidateBones ( )

Mark bones no more dirty.

No other action is carried out except setting the dirty flag for bones. Use this function if you updated all bones on your own (typically physics modules during simulation). The mesh and extends dirty flag keep their values. You have to call InvalidateMesh function after validating bones to ensure they are updated correctly during the next update step.

◆ WaitAnimatorTaskFinished()

void deComponent::WaitAnimatorTaskFinished ( )

Ensure animator task has finished if present.

For use by modules requiring to access data outside using Prepare*() calls.


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