Class Animation
Represents an animation associated with a 3D model.
Inherited Members
Namespace: Genesis.Graphics.Animation3D
Assembly: Genesis.dll
Syntax
public class Animation
Constructors
Animation(Scene, Model, int)
Initializes a new instance of the Animation class.
Declaration
public Animation(Scene scene, Model model, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| Scene | scene | |
| Model | model | |
| int | index |
Properties
BoneInfoMap
Mapping of bone names to bone information.
Declaration
public Dictionary<string, boneinfo> BoneInfoMap { get; set; }
Property Value
| Type | Description |
|---|---|
| Dictionary<string, boneinfo> |
Bones
List of bones affected by the animation.
Declaration
public List<Bone> Bones { get; set; }
Property Value
| Type | Description |
|---|---|
| List<Bone> |
Duration
Duration of the animation in ticks.
Declaration
public float Duration { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Name
Name of the animation.
Declaration
public string Name { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
RootNode
Root node of the animation's scene hierarchy.
Declaration
public AssimpNodeData RootNode { get; set; }
Property Value
| Type | Description |
|---|---|
| AssimpNodeData |
TicksPerSecond
Number of ticks per second for the animation.
Declaration
public float TicksPerSecond { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Methods
AnimationLength()
Calculates the keyframe length of the animation based on the maximum number of position, rotation, and scaling keyframes among all bones.
Declaration
public int AnimationLength()
Returns
| Type | Description |
|---|---|
| int | The maximum number of keyframes (positions, rotations, or scalings) among all bones; if no bones are present, returns -1. |
Remarks
This method iterates through all bones to determine the maximum keyframe length.
FindBone(string)
Finds a bone with the specified name.
Declaration
public Bone FindBone(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name |
Returns
| Type | Description |
|---|---|
| Bone |
GetKeyFrameIndex(float)
Gets the keyframe index at a specific animation time based on the first bone.
Declaration
public int GetKeyFrameIndex(float animationTime)
Parameters
| Type | Name | Description |
|---|---|---|
| float | animationTime | The time within the animation to find the keyframe index for. |
Returns
| Type | Description |
|---|---|
| int | The highest keyframe index (position, rotation, or scale) at the specified animation time. |
Remarks
This method assumes that all keyframe lists (positions, rotations, scales) are synchronized and have the same number of keyframes. It calculates the keyframe index for the first bone in the list.