# DXGfxLib.ArticulatedModel Class Reference

Each time you want to add an animated model to your scene you should use this class or a class that derives from this. The model and associated animations are going to be loaded from a X file. By default all animations will be played as soon as the instance of this class is added to the scene. More...

Inherits DXGfxLib::MeshObject, and DXGfxLib::MeshObject.

Collaboration diagram for DXGfxLib.ArticulatedModel:

[legend]

List of all members.

## Public Member Functions
| ArticulatedModel ()
| Default constructor, this one doesn't do anything at all except creating an instance of the class. If you don't call LoadFromFile afterward you won't have anything in this class and if you had that one to the scene before loading anything you are going to create havoc!! Of course I could more time in my code checking for nulls but at some point I can see with the profiler that I am spending a lot of time checking for nulls and this is not necessary if you follow an expected order in the operations (loading before adding to scene!).
override void | LoadFromFile (Device d3ddevice, string fileName)
| This will load all information from an x file. First it will populate basic information needed by SceneObject, then it will move on and load the FrameHierarchy. This method might look sub efficient as we load two time the mesh information, a first time to populate what is needed by SceneObject and another time in the FrameHierarchy. This might change in the future.
override void | Update (Frustrum frustrum, double appTime, float elapsedTime)
| This method is the method through which the animation is progressed. By default as soon as your instance of ArticulatedModel will be added to the scene this method will be called and thus the animation will be progressed by default.
override void | Draw (Device device)
| Draw call for the whole ArticulatedModel. This will render the whole associated Frame hierarchy in its current state.
List< String > | GetAnimationList ()
| This method generate a List of string with all the name of the animations associated with the ArticulatedModel.
void | StartAnimation (string animationName)
| This method will do everything that is needed to get one specific animation smoothly started. Subsequent calls to the update method will then progress this specific animation. The way things are implement here means any other running animation for the the ArticulatedModel will be stop. This might change in the future if the functionnality is needed.
void | StopAll ()
| This method will smoothly stop all animations. The effect is immediate but the animations won't be still just after the call to this method. Instead keys are generated to stop them progressively (this concept is all relative to the animationTransitionTime so if you put a very small value there you can stop the animation nearly instantenously).
| ArticulatedModel ()
| Default constructor, this one doesn't do anything at all except creating an instance of the class. If you don't call LoadFromFile afterward you won't have anything in this class and if you had that one to the scene before loading anything you are going to create havoc!! Of course I could more time in my code checking for nulls but at some point I can see with the profiler that I am spending a lot of time checking for nulls and this is not necessary if you follow an expected order in the operations (loading before adding to scene!).
override void | LoadFromFile (Device d3ddevice, string fileName)
| This will load all information from an x file. First it will populate basic information needed by SceneObject, then it will move on and load the FrameHierarchy. This method might look sub efficient as we load two time the mesh information, a first time to populate what is needed by SceneObject and another time in the FrameHierarchy. This might change in the future.
override void | Update (Frustrum frustrum, double appTime, float elapsedTime)
| This method is the method through which the animation is progressed. By default as soon as your instance of ArticulatedModel will be added to the scene this method will be called and thus the animation will be progressed by default.
override void | Draw (Device device)
| Draw call for the whole ArticulatedModel. This will render the whole associated Frame hierarchy in its current state.
List< String > | GetAnimationList ()
| This method generate a List of string with all the name of the animations associated with the ArticulatedModel.
void | StartAnimation (string animationName)
| This method will do everything that is needed to get one specific animation smoothly started. Subsequent calls to the update method will then progress this specific animation. The way things are implement here means any other running animation for the the ArticulatedModel will be stop. This might change in the future if the functionnality is needed.
void | StopAll ()
| This method will smoothly stop all animations. The effect is immediate but the animations won't be still just after the call to this method. Instead keys are generated to stop them progressively (this concept is all relative to the animationTransitionTime so if you put a very small value there you can stop the animation nearly instantenously).
## Public Attributes
bool | HasSkin = false
| We want to know if our ArticulatedModel has any associated skin information. This boolean is setted when loading the x file and can be checked whenever it is needed afterwards.
float | animationTransitionTime = 0.5f
| Each time you start or stop an animation that value is used to generate keys to perform the transition from current state to desired state. Animations will be smoothly started or stoped over a period of time matching with this value.
double | currentTime
| We also want to keep track of the current time. This is needed by method in charge of stoping or starting animation progressively. They use that value to generate keys at time value calculated from this one. This value is updated in the Update method as might be expect. This member variable is public in case you might need for the same kind of operation in your own code controlling an instance of this class.
## Static Public Attributes
static Device | currentDevice = null
| EnhancedMeshContainer need to know the current D3DDevice to be alble to load textures associated with the x file. So for convenience I have added that information as a static fielf of this class.
## Protected Member Functions
void | SetupBonePointersOnMesh (Frame frame)
| This method is used to setup bone information from X file. This function calls itself passing sibling and child frame as parameter to subsequent calls.
void | UpdateFrameMatrices (Frame frame, Matrix parentMat)
| We update each frame world matrice from the ArticulatedModel world mat and current advancement of the animation controller. The animation controller used is the one associated with the rootframe.
void | RenderFrame (Device d3ddevice, Frame frame)
| This is where actual DX draw calls are performed. This method calls itself on sibling and child frame of the frame passed as argument and thus will render the whole frame hierarchy below the frame passed as argument.
void | SetupBonePointersOnMesh (Frame frame)
| This method is used to setup bone information from X file. This function calls itself passing sibling and child frame as parameter to subsequent calls.
void | UpdateFrameMatrices (Frame frame, Matrix parentMat)
| We update each frame world matrice from the ArticulatedModel world mat and current advancement of the animation controller. The animation controller used is the one associated with the rootframe.
void | RenderFrame (Device d3ddevice, Frame frame)
| This is where actual DX draw calls are performed. This method calls itself on sibling and child frame of the frame passed as argument and thus will render the whole frame hierarchy below the frame passed as argument.
## Protected Attributes
AnimationRootFrame | rootFrame
| There is no articulated model without a frame hierarchy and thus without an AnimationRootFrame. The rootFrame member is just that. Updates and draw calls start from it and are propagated to children and sibling frames.

## Detailed Description

Each time you want to add an animated model to your scene you should use this class or a class that derives from this. The model and associated animations are going to be loaded from a X file. By default all animations will be played as soon as the instance of this class is added to the scene.

Definition at line 220 of file ArticulatedModel.cs.

## Constructor & Destructor Documentation

DXGfxLib.ArticulatedModel.ArticulatedModel | ( |  | ) |

Default constructor, this one doesn't do anything at all except creating an instance of the class. If you don't call LoadFromFile afterward you won't have anything in this class and if you had that one to the scene before loading anything you are going to create havoc!! Of course I could more time in my code checking for nulls but at some point I can see with the profiler that I am spending a lot of time checking for nulls and this is not necessary if you follow an expected order in the operations (loading before adding to scene!).

Definition at line 266 of file ArticulatedModel.cs.

DXGfxLib.ArticulatedModel.ArticulatedModel | ( |  | ) |

Default constructor, this one doesn't do anything at all except creating an instance of the class. If you don't call LoadFromFile afterward you won't have anything in this class and if you had that one to the scene before loading anything you are going to create havoc!! Of course I could more time in my code checking for nulls but at some point I can see with the profiler that I am spending a lot of time checking for nulls and this is not necessary if you follow an expected order in the operations (loading before adding to scene!).

Definition at line 266 of file ArticulatedModel.cs.

## Member Function Documentation

override void DXGfxLib.ArticulatedModel.Draw | ( | Device | device | ) | `[virtual]`

Draw call for the whole ArticulatedModel. This will render the whole associated Frame hierarchy in its current state.

Parameters:

  | device | The device on which the rendering will be performed.

Reimplemented from DXGfxLib.MeshObject.

Definition at line 504 of file ArticulatedModel.cs.

Here is the call graph for this function:

override void DXGfxLib.ArticulatedModel.Draw | ( | Device | device | ) | `[virtual]`

Draw call for the whole ArticulatedModel. This will render the whole associated Frame hierarchy in its current state.

Parameters:

  | device | The device on which the rendering will be performed.

Reimplemented from DXGfxLib.MeshObject.

Definition at line 504 of file ArticulatedModel.cs.

Here is the call graph for this function:

List<String> DXGfxLib.ArticulatedModel.GetAnimationList | ( |  | ) |

This method generate a List of string with all the name of the animations associated with the ArticulatedModel.

Returns:
  List of strings with all the animations' name.

Definition at line 514 of file ArticulatedModel.cs.

List<String> DXGfxLib.ArticulatedModel.GetAnimationList | ( |  | ) |

This method generate a List of string with all the name of the animations associated with the ArticulatedModel.

Returns:
  List of strings with all the animations' name.

Definition at line 514 of file ArticulatedModel.cs.

override void DXGfxLib.ArticulatedModel.LoadFromFile | ( | Device | d3ddevice,
|  | string | fileName |
| ) |  |  | `[virtual]`

This will load all information from an x file. First it will populate basic information needed by SceneObject, then it will move on and load the FrameHierarchy. This method might look sub efficient as we load two time the mesh information, a first time to populate what is needed by SceneObject and another time in the FrameHierarchy. This might change in the future.

Parameters:

  | d3ddevice | Self explicit I hope.
  | fileName | Idem

Returns:
  If everything goes right it should return true.

Reimplemented from DXGfxLib.MeshObject.

Definition at line 279 of file ArticulatedModel.cs.

Here is the call graph for this function:

override void DXGfxLib.ArticulatedModel.LoadFromFile | ( | Device | d3ddevice,
|  | string | fileName |
| ) |  |  | `[virtual]`

This will load all information from an x file. First it will populate basic information needed by SceneObject, then it will move on and load the FrameHierarchy. This method might look sub efficient as we load two time the mesh information, a first time to populate what is needed by SceneObject and another time in the FrameHierarchy. This might change in the future.

Parameters:

  | d3ddevice | Self explicit I hope.
  | fileName | Idem

Returns:
  If everything goes right it should return true.

Reimplemented from DXGfxLib.MeshObject.

Definition at line 279 of file ArticulatedModel.cs.

Here is the call graph for this function:

void DXGfxLib.ArticulatedModel.RenderFrame | ( | Device | d3ddevice,
|  | Frame | frame |
| ) |  |  | `[protected]`

This is where actual DX draw calls are performed. This method calls itself on sibling and child frame of the frame passed as argument and thus will render the whole frame hierarchy below the frame passed as argument.

Parameters:

  | d3ddevice | The current device on which the rendering will be performed.
  | frame | The frame on which rendering should be started. As stated in the description rendering for the whole frame hierarchy below or at the same level as this frame will also be performed from here.

Definition at line 418 of file ArticulatedModel.cs.

Here is the call graph for this function:

void DXGfxLib.ArticulatedModel.RenderFrame | ( | Device | d3ddevice,
|  | Frame | frame |
| ) |  |  | `[protected]`

This is where actual DX draw calls are performed. This method calls itself on sibling and child frame of the frame passed as argument and thus will render the whole frame hierarchy below the frame passed as argument.

Parameters:

  | d3ddevice | The current device on which the rendering will be performed.
  | frame | The frame on which rendering should be started. As stated in the description rendering for the whole frame hierarchy below or at the same level as this frame will also be performed from here.

Definition at line 418 of file ArticulatedModel.cs.

Here is the caller graph for this function:

void DXGfxLib.ArticulatedModel.SetupBonePointersOnMesh | ( | Frame | frame | ) | `[protected]`

This method is used to setup bone information from X file. This function calls itself passing sibling and child frame as parameter to subsequent calls.

Parameters:

  | frame | frame on which to perform the operation. Will automatically be performed on child frame and sibling frames of the frame hierarchy.

Definition at line 297 of file ArticulatedModel.cs.

Here is the call graph for this function:

void DXGfxLib.ArticulatedModel.SetupBonePointersOnMesh | ( | Frame | frame | ) | `[protected]`

This method is used to setup bone information from X file. This function calls itself passing sibling and child frame as parameter to subsequent calls.

Parameters:

  | frame | frame on which to perform the operation. Will automatically be performed on child frame and sibling frames of the frame hierarchy.

Definition at line 297 of file ArticulatedModel.cs.

Here is the caller graph for this function:

void DXGfxLib.ArticulatedModel.StartAnimation | ( | string | animationName | ) |

This method will do everything that is needed to get one specific animation smoothly started. Subsequent calls to the update method will then progress this specific animation. The way things are implement here means any other running animation for the the ArticulatedModel will be stop. This might change in the future if the functionnality is needed.

Parameters:

  | animationName | The name of the animation to be started.

Definition at line 531 of file ArticulatedModel.cs.

void DXGfxLib.ArticulatedModel.StartAnimation | ( | string | animationName | ) |

This method will do everything that is needed to get one specific animation smoothly started. Subsequent calls to the update method will then progress this specific animation. The way things are implement here means any other running animation for the the ArticulatedModel will be stop. This might change in the future if the functionnality is needed.

Parameters:

  | animationName | The name of the animation to be started.

Definition at line 531 of file ArticulatedModel.cs.

void DXGfxLib.ArticulatedModel.StopAll | ( |  | ) |

This method will smoothly stop all animations. The effect is immediate but the animations won't be still just after the call to this method. Instead keys are generated to stop them progressively (this concept is all relative to the animationTransitionTime so if you put a very small value there you can stop the animation nearly instantenously).

Definition at line 564 of file ArticulatedModel.cs.

void DXGfxLib.ArticulatedModel.StopAll | ( |  | ) |

This method will smoothly stop all animations. The effect is immediate but the animations won't be still just after the call to this method. Instead keys are generated to stop them progressively (this concept is all relative to the animationTransitionTime so if you put a very small value there you can stop the animation nearly instantenously).

Definition at line 564 of file ArticulatedModel.cs.

override void DXGfxLib.ArticulatedModel.Update | ( | Frustrum | frustrum,
|  | double | appTime,
|  | float | elapsedTime |
| ) |  |  | `[virtual]`

This method is the method through which the animation is progressed. By default as soon as your instance of ArticulatedModel will be added to the scene this method will be called and thus the animation will be progressed by default.

Parameters:

  | frustrum | Viewing frustrum at the time of the update. Check description of that specific class for further details.
  | appTime | Absolute time when Update is called.
  | elapsedTime | Elapsed time since last update. This value is used in a lot of places so we pass it as a parameter.

Reimplemented from DXGfxLib.SceneObject.

Definition at line 335 of file ArticulatedModel.cs.

Here is the call graph for this function:

override void DXGfxLib.ArticulatedModel.Update | ( | Frustrum | frustrum,
|  | double | appTime,
|  | float | elapsedTime |
| ) |  |  | `[virtual]`

This method is the method through which the animation is progressed. By default as soon as your instance of ArticulatedModel will be added to the scene this method will be called and thus the animation will be progressed by default.

Parameters:

  | frustrum | Viewing frustrum at the time of the update. Check description of that specific class for further details.
  | appTime | Absolute time when Update is called.
  | elapsedTime | Elapsed time since last update. This value is used in a lot of places so we pass it as a parameter.

Reimplemented from DXGfxLib.SceneObject.

Definition at line 335 of file ArticulatedModel.cs.

Here is the call graph for this function:

void DXGfxLib.ArticulatedModel.UpdateFrameMatrices | ( | Frame | frame,
|  | Matrix | parentMat |
| ) |  |  | `[protected]`

We update each frame world matrice from the ArticulatedModel world mat and current advancement of the animation controller. The animation controller used is the one associated with the rootframe.

Parameters:

  | frame | Frame on which to perform the operation. In fact an EnhancedFramed is expected here.
  | parentMat | world mat of the parent Frame or of the ArticulatedModel for the root frame.

Definition at line 349 of file ArticulatedModel.cs.

Here is the call graph for this function:

void DXGfxLib.ArticulatedModel.UpdateFrameMatrices | ( | Frame | frame,
|  | Matrix | parentMat |
| ) |  |  | `[protected]`

We update each frame world matrice from the ArticulatedModel world mat and current advancement of the animation controller. The animation controller used is the one associated with the rootframe.

Parameters:

  | frame | Frame on which to perform the operation. In fact an EnhancedFramed is expected here.
  | parentMat | world mat of the parent Frame or of the ArticulatedModel for the root frame.

Definition at line 349 of file ArticulatedModel.cs.

Here is the call graph for this function:

Here is the caller graph for this function:

## Member Data Documentation

float DXGfxLib.ArticulatedModel::animationTransitionTime = 0.5f

Each time you start or stop an animation that value is used to generate keys to perform the transition from current state to desired state. Animations will be smoothly started or stoped over a period of time matching with this value.

Definition at line 249 of file ArticulatedModel.cs.

static Device DXGfxLib.ArticulatedModel::currentDevice = null`[static]`

EnhancedMeshContainer need to know the current D3DDevice to be alble to load textures associated with the x file. So for convenience I have added that information as a static fielf of this class.

Definition at line 226 of file ArticulatedModel.cs.

double DXGfxLib.ArticulatedModel::currentTime

We also want to keep track of the current time. This is needed by method in charge of stoping or starting animation progressively. They use that value to generate keys at time value calculated from this one. This value is updated in the Update method as might be expect. This member variable is public in case you might need for the same kind of operation in your own code controlling an instance of this class.

Definition at line 257 of file ArticulatedModel.cs.

bool DXGfxLib.ArticulatedModel::HasSkin = false

We want to know if our ArticulatedModel has any associated skin information. This boolean is setted when loading the x file and can be checked whenever it is needed afterwards.

Definition at line 238 of file ArticulatedModel.cs.

AnimationRootFrame DXGfxLib.ArticulatedModel::rootFrame`[protected]`

There is no articulated model without a frame hierarchy and thus without an AnimationRootFrame. The rootFrame member is just that. Updates and draw calls start from it and are propagated to children and sibling frames.

Definition at line 232 of file ArticulatedModel.cs.

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

- D:/guillaume/guillara/3D/DXGfx/Backup/DXGfxLib/ArticulatedModel.cs
- D:/guillaume/guillara/3D/DXGfx/DXGfxLib/ArticulatedModel.cs