deComponent Class Reference

Component Resource. More...

#include <deComponent.h>

Inheritance diagram for deComponent:
deResource deObject

List of all members.

Public Member Functions

Constructors and Destructors
 deComponent (deComponentManager *manager, deModel *model, deSkin *skin)
 Creates a new component.
virtual ~deComponent ()
 Frees the component.
Management
const decDVectorGetPosition () const
 Retrieves the position.
void SetPosition (const decDVector &pos)
 Sets the position.
const decQuaternionGetOrientation () const
 Retrieves the orientation.
void SetOrientation (const decQuaternion &orientation)
 Sets the orientation.
const decVectorGetScaling () const
 Retrieves the scaling.
void SetScaling (const decVector &scale)
 Sets the scaling.
deModelGetModel () const
 Retrieves the model or NULL if not assigned.
void SetModel (deModel *model)
 Sets the model or NULL if not assigned.
deSkinGetSkin () const
 Retrieves the skin or NULL if not assigned.
void SetSkin (deSkin *skin)
 Sets the skin or NULL if not assigned.
deRigGetRig () const
 Retrieves the rig or NULL if not assigned.
void SetRig (deRig *rig)
 Sets the rig or NULL if not assigned.
void SetModelAndSkin (deModel *model, deSkin *skin)
 Sets the model and skin at the same time.
deModelGetOccluder () const
 Retrieves the occluder model or NULL if not assigned.
void SetOccluder (deModel *model)
 Sets the occluder model or NULL if not assigned.
bool GetVisible () const
 Determines if the component is visible.
void SetVisible (bool visible)
 Sets if the component is visible.
bool GetCastShadows () const
 Determines if the component casts shadows.
void SetCastShadows (bool castShadows)
 Sets if the component casts shadows.
bool GetStatic () const
 Determines if the component is static.
void SetStatic (bool bStatic)
 Sets if the component is static.
int GetImportance () const
void SetImportance (int importance)
const decVectorGetMinimumExtend ()
const decVectorGetMaximumExtend ()
const decMatrixGetMatrix ()
const decMatrixGetInverseMatrix ()
void SetClosestExtends ()
int GetWeightsCount () const
int GetBoneCount () const
int GetVertexCount () const
int GetNormalCount () const
int GetFaceCount () const
deComponentBoneGetBone (int index) const
void UpdateBoneAt (int index)
 Updates the given bone.
const decMatrixGetWeights (int index) const
const decVectorGetVertex (int index) const
const decVectorGetNormal (int index) const
const decVectorGetFaceNormal (int index) const
decVector GetFaceCenter (int index) const
void InvalidateBones ()
 Marks bones dirty.
void ValidateBones ()
 Marks bones no more dirty.
void InvalidateMesh ()
 Marks the mesh dirty.
void InvalidateExtends ()
 Marks the extends dirty.
deDynamicSkinGetDynamicSkin () const
 Retrieves the dynamic skin or null if not used.
void SetDynamicSkin (deDynamicSkin *dynamicSkin)
 Sets the dynamic skin or null if not used.
int GetModifierCount () const
deComponentModifierGetModifierAt (int index) const
deComponentModifierGetModifierFor (int renderModifierIndex) const
int IndexOfModifier (deComponentModifier *modifier) const
int IndexOfModifierFor (int renderModifierIndex) const
bool HasModifier (deComponentModifier *modifier) const
bool HasModifierFor (int renderModifierIndex) const
void AddModifier (deComponentModifier *modifier)
void RemoveModifier (deComponentModifier *modifier)
void RemoveAllModifiers ()
void NotifyModifierChanged (deComponentModifier *modifier)
bool MatchesModelSkin () const
int GetModelRigMappingCount () const
int GetModelRigMapping (int boneIndex) const
bool MatchesModelRig () const
void UpdateSkin (float time)
void PrepareExtends ()
void PrepareMatrix ()
void PrepareBones ()
void PrepareWeights ()
void PrepareMesh ()
Textures
int GetTextureCount () const
 Retrieves the number of textures.
deComponentTextureGetTextureAt (int index) const
 Retrieves the texture with the given index.
void NotifyTextureChanged (int index) const
 Notifies the peers that a texture changed.
Decals Management
int GetDecalCount () const
 Retrieves the count of decals.
deDecalGetDecalAt (int index) const
 Retrieves the decal at the given index.
int IndexOfDecal (deDecal *decal) const
 Retrieves the index of the given decal of -1 if not found.
void AddDecal (deDecal *decal)
 Adds a decal to the world.
void RemoveDecal (deDecal *decal)
 Removes the given decal from the world.
void RemoveAllDecals ()
 Removes all decals from the world.
Collision Detection
void FindDecalsAt (const decVector &point, deDecalList *list)
 Stores all decals in contact with the given surface point into the provided list.
void FindDecalsTouching (decShape *shape, deDecalList *list)
 Stores all decals in contact with the given shape into the provided list.
System Peers
deBaseGraphicComponentGetGraphicComponent () const
void SetGraphicComponent (deBaseGraphicComponent *comp)
deBasePhysicsComponentGetPhysicsComponent () const
void SetPhysicsComponent (deBasePhysicsComponent *comp)
deBaseAudioComponentGetAudioComponent () const
void SetAudioComponent (deBaseAudioComponent *audComp)
deBaseScriptingComponentGetScriptingComponent () const
void SetScriptingComponent (deBaseScriptingComponent *comp)

Detailed Description

Component Resource.

A component resource is the most important element after the world itself. This object ties together various other objects to form a renderable object. A world component requires at least a model object and a skin object to be set. The textures in the model are then mapped to the skin textures used for rendering. In addition a rig and an animation object can be set. If the rig is set the bones of the rig are considere the component bones. The bones of the model are mapped to the rig bones for vertex weighting. If an animation object is set too the bones of the animation object are mapped to the rig bones too for retrieving the correct bone states. The following mapping table shows those relations.

The rig bones are the component bones. All bone indices are range checked against rig bones.

Peering
The world component has the most peers of all resource objects due to its importance. The graphic, physics and scripting system do have all their peer objects attached to the world component. It is mandatory for modules of those system to provide such a peer for the system to work.
Optimizations
As the world component is a rather large object and links together a lot of data care has to be taken to not slow down the engine. For this purpose most calculations are of a lazy nature. Those calculations are only carried out if a state changed that invalidates the state in question. This way states should be only calcuated once per frame update in the worst case. Care has to be taken not to cause multiple updates per frame update due to interleaving retrieve functions with state changing functions. The state stored in this component is geared towards easy usability not fast speed. It is hence encouraged for the modules of the peering systems to do the calculations needed on their own to gain the best speed. Notifications are provided to informa peering systems about important state changes.
Render Modifiers
Components can use the render modifiers set in the hosting world object to adjust their skin and effects on the fly. You can specify an alternate skin to use if a given render modifier is enabled.
Important Notice
This class is currently in a heavy change which is why documenting it is posponed until the changes are done.
Hints
Various hints help the modules in the engine to handle this component in the best way. The static property defines if a component does not alter geometry (position, orientation, scaling, model, rig or bones) after it has been put into the correct place before the containing world is rendered the next time. Typically components representing geological formations or architectural structures supposed to be static throughout the game. The static hint can be changed while during the game for example if a wall that has been once static is supposed to crumble down. The static hint should though not be changed often if required. By default all components are not static.
Todo:
  • Remove weighting system as it goes into graphic module
  • Remove face normals as the graphic module already calculates them separatly and physics uses anyways their collision models
  • Do doxy-documentation
Author:
Plüss Roland
Version:
1.0
Date:
2008

Constructor & Destructor Documentation

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

Creates a new component.

virtual deComponent::~deComponent (  ) [virtual]

Frees the component.


Member Function Documentation

void deComponent::AddDecal ( deDecal decal )

Adds a decal to the world.

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

Stores all decals in contact with the given surface point into the provided list.

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:
pointPoint on the surface to test.
listList of decals to fill in. Not emptied before filling.
void deComponent::FindDecalsTouching ( decShape shape,
deDecalList list 
)

Stores all decals in contact with the given shape into the provided list.

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

Parameters:
shapeShape to test.
listList of decals to fill in. Not emptied before filling.
deBaseAudioComponent* deComponent::GetAudioComponent (  ) const [inline]
deComponentBone* deComponent::GetBone ( int  index ) const
int deComponent::GetBoneCount (  ) const [inline]
bool deComponent::GetCastShadows (  ) const [inline]

Determines if the component casts shadows.

deDecal* deComponent::GetDecalAt ( int  index ) const

Retrieves the decal at the given index.

int deComponent::GetDecalCount (  ) const [inline]

Retrieves the count of decals.

deDynamicSkin* deComponent::GetDynamicSkin (  ) const [inline]

Retrieves the dynamic skin or null if not used.

decVector deComponent::GetFaceCenter ( int  index ) const
int deComponent::GetFaceCount (  ) const [inline]
const decVector& deComponent::GetFaceNormal ( int  index ) const
deBaseGraphicComponent* deComponent::GetGraphicComponent (  ) const [inline]
int deComponent::GetImportance (  ) const [inline]
const decMatrix& deComponent::GetInverseMatrix (  )
const decMatrix& deComponent::GetMatrix (  )
const decVector& deComponent::GetMaximumExtend (  )
const decVector& deComponent::GetMinimumExtend (  )
deModel* deComponent::GetModel (  ) const [inline]

Retrieves the model or NULL if not assigned.

int deComponent::GetModelRigMapping ( int  boneIndex ) const
int deComponent::GetModelRigMappingCount (  ) const [inline]
deComponentModifier* deComponent::GetModifierAt ( int  index ) const
int deComponent::GetModifierCount (  ) const [inline]
deComponentModifier* deComponent::GetModifierFor ( int  renderModifierIndex ) const
const decVector& deComponent::GetNormal ( int  index ) const
int deComponent::GetNormalCount (  ) const [inline]
deModel* deComponent::GetOccluder (  ) const [inline]

Retrieves the occluder model or NULL if not assigned.

const decQuaternion& deComponent::GetOrientation (  ) const [inline]

Retrieves the orientation.

deBasePhysicsComponent* deComponent::GetPhysicsComponent (  ) const [inline]
const decDVector& deComponent::GetPosition (  ) const [inline]

Retrieves the position.

deRig* deComponent::GetRig (  ) const [inline]

Retrieves the rig or NULL if not assigned.

const decVector& deComponent::GetScaling (  ) const [inline]

Retrieves the scaling.

deBaseScriptingComponent* deComponent::GetScriptingComponent (  ) const [inline]
deSkin* deComponent::GetSkin (  ) const [inline]

Retrieves the skin or NULL if not assigned.

bool deComponent::GetStatic (  ) const [inline]

Determines if the component is static.

deComponentTexture& deComponent::GetTextureAt ( int  index ) const

Retrieves the texture with the given index.

int deComponent::GetTextureCount (  ) const [inline]

Retrieves the number of textures.

const decVector& deComponent::GetVertex ( int  index ) const
int deComponent::GetVertexCount (  ) const [inline]
bool deComponent::GetVisible (  ) const [inline]

Determines if the component is visible.

const decMatrix& deComponent::GetWeights ( int  index ) const
int deComponent::GetWeightsCount (  ) const [inline]
bool deComponent::HasModifier ( deComponentModifier modifier ) const
bool deComponent::HasModifierFor ( int  renderModifierIndex ) const
int deComponent::IndexOfDecal ( deDecal decal ) const

Retrieves the index of the given decal of -1 if not found.

int deComponent::IndexOfModifier ( deComponentModifier modifier ) const
int deComponent::IndexOfModifierFor ( int  renderModifierIndex ) const
void deComponent::InvalidateBones (  )

Marks bones dirty.

Mesh, weights and extends are set dirty too and the appropriate notifiers are called if required.

void deComponent::InvalidateExtends (  )

Marks the extends dirty.

void deComponent::InvalidateMesh (  )

Marks the mesh dirty.

bool deComponent::MatchesModelRig (  ) const
bool deComponent::MatchesModelSkin (  ) const
void deComponent::NotifyModifierChanged ( deComponentModifier modifier )
void deComponent::NotifyTextureChanged ( int  index ) const

Notifies the peers that a texture changed.

void deComponent::PrepareBones (  )
void deComponent::PrepareExtends (  )
void deComponent::PrepareMatrix (  )
void deComponent::PrepareMesh (  )
void deComponent::PrepareWeights (  )
void deComponent::RemoveAllDecals (  )

Removes all decals from the world.

void deComponent::RemoveAllModifiers (  )
void deComponent::RemoveDecal ( deDecal decal )

Removes the given decal from the world.

void deComponent::RemoveModifier ( deComponentModifier modifier )
void deComponent::SetAudioComponent ( deBaseAudioComponent audComp )
void deComponent::SetCastShadows ( bool  castShadows )

Sets if the component casts shadows.

void deComponent::SetClosestExtends (  )
void deComponent::SetDynamicSkin ( deDynamicSkin dynamicSkin )

Sets the dynamic skin or null if not used.

void deComponent::SetGraphicComponent ( deBaseGraphicComponent comp )
void deComponent::SetImportance ( int  importance )
void deComponent::SetModel ( deModel model )

Sets the model or NULL if not assigned.

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

Sets the model and skin at the same time.

Either one can be NULL.

void deComponent::SetOccluder ( deModel model )

Sets the occluder model or NULL if not assigned.

void deComponent::SetOrientation ( const decQuaternion orientation )

Sets the orientation.

void deComponent::SetPhysicsComponent ( deBasePhysicsComponent comp )
void deComponent::SetPosition ( const decDVector pos )

Sets the position.

void deComponent::SetRig ( deRig rig )

Sets the rig or NULL if not assigned.

void deComponent::SetScaling ( const decVector scale )

Sets the scaling.

void deComponent::SetScriptingComponent ( deBaseScriptingComponent comp )
void deComponent::SetSkin ( deSkin skin )

Sets the skin or NULL if not assigned.

void deComponent::SetStatic ( bool  bStatic )

Sets if the component is static.

void deComponent::SetVisible ( bool  visible )

Sets if the component is visible.

void deComponent::UpdateBoneAt ( int  index )

Updates the given bone.

void deComponent::UpdateSkin ( float  time )
void deComponent::ValidateBones (  )

Marks 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, weight and extends dirty flag keep their values. You have to call the InvalidateMesh function after validating bones to ensure they are updated correctly during the next update step.


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