Class Animation
- Namespace
- Vintagestory.API.Common
- Assembly
- VintagestoryAPI.dll
Represents a shape animation and can calculate the transformation matrices for each frame to be sent to the shader Process
For each frame, for each root element, calculate the transformation matrix. Curent model matrix is identy mat. 1.1. Get previous and next key frame. Apply translation, rotation and scale to model matrix. 1.2. Store this matrix as animationmatrix in list 1.3. For each child element 1.3.1. Multiply local transformation matrix with the animation matrix. This matrix is now the curent model matrix. Go to 1 with child elements as root elems
For each frame, for each joint 2.1. Calculate the inverse model matrix 2.2. Multiply stored animationmatrix with the inverse model matrix
done
[JsonObject(MemberSerialization.OptIn)]
public class Animation
- Inheritance
-
Animation
- Inherited Members
- Extension Methods
Fields
Code
[JsonProperty]
public string Code
Field Value
CodeCrc32
public uint CodeCrc32
Field Value
EaseAnimationSpeed
[JsonProperty]
public bool EaseAnimationSpeed
Field Value
KeyFrames
[JsonProperty]
public AnimationKeyFrame[] KeyFrames
Field Value
Name
[JsonProperty]
public string Name
Field Value
OnActivityStopped
[JsonProperty]
public EnumEntityActivityStoppedHandling OnActivityStopped
Field Value
OnAnimationEnd
[JsonProperty]
public EnumEntityAnimationEndHandling OnAnimationEnd
Field Value
PrevNextKeyFrameByFrame
public AnimationFrame[][] PrevNextKeyFrameByFrame
Field Value
- AnimationFrame[][]
QuantityFrames
[JsonProperty]
public int QuantityFrames
Field Value
Version
[JsonProperty]
public int Version
Field Value
jointsDone
protected HashSet<int> jointsDone
Field Value
Methods
Clone()
public Animation Clone()
Returns
GenerateAllFrames(ShapeElement[], Dictionary<int, AnimationJoint>, bool)
Compiles the animation into a bunch of matrices, 31 matrices per frame.
public void GenerateAllFrames(ShapeElement[] rootElements, Dictionary<int, AnimationJoint> jointsById, bool recursive = true)
Parameters
rootElements
ShapeElement[]jointsById
Dictionary<int, AnimationJoint>recursive
boolWhen false, will only do root elements
GenerateFrame(int, AnimationFrame[], ShapeElement[], Dictionary<int, AnimationJoint>, float[], List<ElementPose>, bool)
protected void GenerateFrame(int indexNumber, AnimationFrame[] resKeyFrames, ShapeElement[] elements, Dictionary<int, AnimationJoint> jointsById, float[] modelMatrix, List<ElementPose> transforms, bool recursive = true)
Parameters
indexNumber
intresKeyFrames
AnimationFrame[]elements
ShapeElement[]jointsById
Dictionary<int, AnimationJoint>modelMatrix
float[]transforms
List<ElementPose>recursive
bool
GenerateFrameForElement(int, ShapeElement, ref ElementPose)
protected void GenerateFrameForElement(int frameNumber, ShapeElement element, ref ElementPose transform)
Parameters
frameNumber
intelement
ShapeElementtransform
ElementPose
getLeftRightResolvedFrame(int, AnimationFrame[], out AnimationFrame, out AnimationFrame)
protected void getLeftRightResolvedFrame(int frameNumber, AnimationFrame[] frames, out AnimationFrame left, out AnimationFrame right)
Parameters
frameNumber
intframes
AnimationFrame[]left
AnimationFrameright
AnimationFrame
getTwoKeyFramesElementForFlag(int, ShapeElement, int, out AnimationKeyFrameElement, out AnimationKeyFrameElement)
protected void getTwoKeyFramesElementForFlag(int frameNumber, ShapeElement forElement, int forFlag, out AnimationKeyFrameElement left, out AnimationKeyFrameElement right)
Parameters
frameNumber
intforElement
ShapeElementforFlag
intleft
AnimationKeyFrameElementright
AnimationKeyFrameElement
lerpKeyFrameElement(AnimationKeyFrameElement, AnimationKeyFrameElement, int, float, ref ElementPose)
protected void lerpKeyFrameElement(AnimationKeyFrameElement prev, AnimationKeyFrameElement next, int forFlag, float t, ref ElementPose transform)
Parameters
prev
AnimationKeyFrameElementnext
AnimationKeyFrameElementforFlag
intt
floattransform
ElementPose