Drag[en]gine Game Engine
1.21
|
Component Resource. More...
#include <deComponent.h>
Public Types | |
enum | eMovementHints { emhStationary , emhJittering , emhDynamic } |
Movement hints. More... | |
typedef deTObjectReference< deComponent > | Ref |
Type holding strong reference. More... | |
Public Types inherited from deResource | |
typedef deTObjectReference< deResource > | Ref |
Type holding strong reference. More... | |
Public Types inherited from deObject | |
typedef deTObjectReference< deObject > | Ref |
Type holding strong reference. More... | |
Public Member Functions | |
Management | |
const decDVector & | GetPosition () const |
Position. More... | |
void | SetPosition (const decDVector &pos) |
Set position. More... | |
const decQuaternion & | GetOrientation () const |
Orientation. More... | |
void | SetOrientation (const decQuaternion &orientation) |
Set orientation. More... | |
const decVector & | GetScaling () const |
Scaling. More... | |
void | SetScaling (const decVector &scale) |
Set scaling. More... | |
deModel * | GetModel () 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... | |
deSkin * | GetSkin () const |
Skin or NULL if not assigned. More... | |
void | SetSkin (deSkin *skin) |
Set skin or NULL if not assigned. More... | |
deRig * | GetRig () 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... | |
deOcclusionMesh * | GetOcclusionMesh () const |
Occlusion mesh or NULL if not assigned. More... | |
void | SetOcclusionMesh (deOcclusionMesh *occmesh) |
Set occlusion mesh or NULL if not assigned. More... | |
deModel * | GetAudioModel () 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 decDMatrix & | GetMatrix () |
Component matrix. More... | |
const decDMatrix & | GetInverseMatrix () |
Inverse component matrix. More... | |
int | GetBoneCount () const |
Count of bones. More... | |
deComponentBone & | GetBoneAt (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... | |
deDynamicSkin * | GetDynamicSkin () const |
Dynamic skin or null if not used. More... | |
void | SetDynamicSkin (deDynamicSkin *dynamicSkin) |
Set dynamic skin or null if not used. More... | |
deAnimator * | GetAnimator () 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 decLayerMask & | GetLayerMask () 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 | |
deParallelTask * | GetAnimatorTask () 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... | |
deComponentTexture & | GetTextureAt (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... | |
deDecal * | GetRootDecal () 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 | |
deBaseGraphicComponent * | GetPeerGraphic () const |
Graphic System Peer. More... | |
void | SetPeerGraphic (deBaseGraphicComponent *peer) |
Set graphic System Peer. More... | |
deBasePhysicsComponent * | GetPeerPhysics () const |
Physics System Peer. More... | |
void | SetPeerPhysics (deBasePhysicsComponent *peer) |
Set physics System Peer. More... | |
deBaseAudioComponent * | GetPeerAudio () const |
Audio System Peer. More... | |
void | SetPeerAudio (deBaseAudioComponent *peer) |
Set audio System Peer. More... | |
deBaseAnimatorComponent * | GetPeerAnimator () 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 | |
deResourceManager * | GetResourceManager () const |
Resource manager or NULL if resource is leaking. More... | |
deEngine * | GetEngine () const |
Game engine object from resource manager. More... | |
deResource * | GetLLManagerPrev () const |
Previous resource in the resource manager linked list. More... | |
void | SetLLManagerPrev (deResource *resource) |
Set next resource in the resource manager linked list. More... | |
deResource * | GetLLManagerNext () 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 | |
deWorld * | GetParentWorld () const |
Parent world or NULL. More... | |
void | SetParentWorld (deWorld *world) |
Set parent world or NULL. More... | |
deComponent * | GetLLWorldPrev () const |
Previous component in the parent world linked list. More... | |
void | SetLLWorldPrev (deComponent *component) |
Set next component in the parent world linked list. More... | |
deComponent * | GetLLWorldNext () 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... | |
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.
Type holding strong reference.
deComponent::deComponent | ( | deComponentManager * | manager, |
deModel * | model, | ||
deSkin * | skin | ||
) |
Create new component.
|
protectedvirtual |
Clean up component.
void deComponent::AddDecal | ( | deDecal * | decal | ) |
Add decal.
deeInvalidParam | decal is NULL. |
deeInvalidParam | decal has a parent world. |
void deComponent::CopyBonesToComponent | ( | deComponent & | component | ) |
Copy bone states to matching bones states of another component.
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.
[in] | point | Point on the surface to test. |
[out] | list | List of decals to fill in. Not emptied before filling. |
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.
[in] | shape | Shape to test. |
[out] | list | List of decals to fill in. Not emptied before filling. |
|
inline |
Render only animator or NULL to use none.
|
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.
|
inline |
Audio model or NULL if not used.
deComponentBone& deComponent::GetBoneAt | ( | int | index | ) | const |
Bone at index.
|
inline |
Count of bones.
|
inline |
Number of decals.
|
inline |
Dynamic skin or null if not used.
|
inline |
Enable GI in graphic module if supported.
|
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.
|
inline |
Movement hint.
const decDMatrix& deComponent::GetInverseMatrix | ( | ) |
Inverse component matrix.
|
inline |
Layer mask.
|
inline |
Next component in the parent world linked list.
|
inline |
Previous component in the parent world linked list.
const decDMatrix& deComponent::GetMatrix | ( | ) |
Component matrix.
|
inline |
Model or NULL if not assigned.
|
inline |
Occlusion mesh or NULL if not assigned.
|
inline |
Orientation.
|
inline |
Parent world or NULL.
|
inline |
Animator peer or NULL if not set.
|
inline |
Audio System Peer.
|
inline |
Graphic System Peer.
|
inline |
Physics System Peer.
|
inline |
Position.
|
inline |
Rig or NULL if not assigned.
|
inline |
Root decal or NULL if there are none.
|
inline |
Scaling.
|
inline |
Skin or NULL if not assigned.
deComponentTexture& deComponent::GetTextureAt | ( | int | index | ) | const |
Texture with the given index.
|
inline |
Number of textures.
|
inline |
Vertex position set count.
float deComponent::GetVertexPositionSetWeightAt | ( | int | index | ) | const |
Vertex position set weight.
|
inline |
Component is visible.
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.
void deComponent::InvalidateBones | ( | ) |
Mark bones dirty.
Mesh and extends are marked dirty too notifying peers if required.
void deComponent::InvalidateExtends | ( | ) |
Mark extends dirty.
void deComponent::InvalidateMesh | ( | ) |
Mark mesh dirty.
void deComponent::NotifyTextureChanged | ( | int | index | ) | const |
Notifies the peers that a texture changed.
void deComponent::PrepareBones | ( | ) |
Prepare bone matrices.
void deComponent::PrepareMatrix | ( | ) |
Prepare matrices.
void deComponent::RemoveAllDecals | ( | ) |
Remove all decals.
void deComponent::RemoveDecal | ( | deDecal * | decal | ) |
Remove decal.
deeInvalidParam | decal is NULL. |
deeInvalidParam | Parent world of decal is not this world. |
void deComponent::SetAnimator | ( | deAnimator * | animator | ) |
Set render only animator or NULL to use none.
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.
void deComponent::SetAudioModel | ( | deModel * | model | ) |
Set audio model or NULL if not set.
Shares textures with assigned model.
void deComponent::SetDynamicSkin | ( | deDynamicSkin * | dynamicSkin | ) |
Set dynamic skin or null if not used.
void deComponent::SetEnableGI | ( | bool | enable | ) |
Set if enabled for GI in graphic module if supported.
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.
void deComponent::SetHintMovement | ( | eMovementHints | hint | ) |
Set movement hint.
void deComponent::SetLayerMask | ( | const decLayerMask & | layerMask | ) |
Set layer mask.
void deComponent::SetLLWorldNext | ( | deComponent * | component | ) |
Set next component in the parent world linked list.
void deComponent::SetLLWorldPrev | ( | deComponent * | component | ) |
Set next component in the parent world linked list.
void deComponent::SetModel | ( | deModel * | model | ) |
Set model or NULL if not set.
Textures are reset. To keep textures use setModelKeepTextures.
Set model and skin at the same time. Either one can be NULL.
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.
void deComponent::SetOcclusionMesh | ( | deOcclusionMesh * | occmesh | ) |
Set occlusion mesh or NULL if not assigned.
void deComponent::SetOrientation | ( | const decQuaternion & | orientation | ) |
Set orientation.
void deComponent::SetParentWorld | ( | deWorld * | world | ) |
Set parent world or NULL.
void deComponent::SetPeerAnimator | ( | deBaseAnimatorComponent * | peer | ) |
Set animator peer or NULL if not set.
void deComponent::SetPeerAudio | ( | deBaseAudioComponent * | peer | ) |
Set audio System Peer.
void deComponent::SetPeerGraphic | ( | deBaseGraphicComponent * | peer | ) |
Set graphic System Peer.
void deComponent::SetPeerPhysics | ( | deBasePhysicsComponent * | peer | ) |
Set physics System Peer.
void deComponent::SetPosition | ( | const decDVector & | pos | ) |
Set position.
void deComponent::SetRig | ( | deRig * | rig | ) |
Set rig or NULL if not assigned.
void deComponent::SetScaling | ( | const decVector & | scale | ) |
Set scaling.
void deComponent::SetSkin | ( | deSkin * | skin | ) |
Set skin or NULL if not assigned.
void deComponent::SetVertexPositionSetWeightAt | ( | int | index, |
float | weight | ||
) |
Set vertex position set weight.
void deComponent::SetVisible | ( | bool | visible | ) |
Set if component is visible.
void deComponent::UpdateBoneAt | ( | int | index | ) |
Updates the given bone.
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.
void deComponent::WaitAnimatorTaskFinished | ( | ) |
Ensure animator task has finished if present.
For use by modules requiring to access data outside using Prepare*() calls.