Animations now component based

This commit is contained in:
Simon Lübeß
2021-09-13 20:52:41 +02:00
parent 44374a84a7
commit b0b5f76423
3 changed files with 98 additions and 55 deletions
@@ -29,6 +29,9 @@ namespace GlitchyEngine.Renderer.Animation
private Skeleton _skeleton ~ _.ReleaseRef();
public JointPose[] LocalPose ~ delete _;
public Matrix[] GlobalPose ~ delete _;
public Matrix[] SkinningMatricies ~ delete _;
public Matrix3x3[] InvTransSkinningMatricies ~ delete _;
public Skeleton Skeleton => _skeleton;
@@ -40,6 +43,9 @@ namespace GlitchyEngine.Renderer.Animation
LocalPose = new JointPose[jointCount];
GlobalPose = new Matrix[jointCount];
SkinningMatricies = new Matrix[jointCount];
InvTransSkinningMatricies = new Matrix3x3[jointCount];
}
}
}
@@ -6,6 +6,8 @@ namespace GlitchyEngine.World
{
private AnimationClip _animationClip;
private SkeletonPose _pose;
public AnimationClip AnimationClip
{
get => _animationClip;
@@ -20,11 +22,20 @@ namespace GlitchyEngine.World
}
}
public float TimeIndex;
public float TimeScale;
public bool IsPlaying;
public SkeletonPose Pose => _pose;
public static void DisposeComponent(void* component)
{
Self* animationComponent = (Self*)component;
animationComponent._animationClip?.ReleaseRef();
delete animationComponent._pose;
}
}
}