Skip to content

Commit

Permalink
feat(MorphMesh): add morph animation flags
Browse files Browse the repository at this point in the history
  • Loading branch information
lmichaelis committed May 7, 2024
1 parent 5f87de3 commit f27fbf0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ZenKit.Test/TestMorphMesh.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void TestLoad()
Assert.That(ani.BlendOut, Is.EqualTo(-0.0100000007f));
Assert.That(ani.Duration.TotalSeconds, Is.EqualTo(0.4));
Assert.That(ani.Speed, Is.EqualTo(0.0250000004f));
Assert.That(ani.Flags, Is.EqualTo(0));
Assert.That(ani.Flags, Is.EqualTo(MorphAnimationFlags.None));
Assert.That(ani.FrameCount, Is.EqualTo(10));

var vertices = ani.Vertices;
Expand Down
16 changes: 13 additions & 3 deletions ZenKit/MorphMesh.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@

namespace ZenKit
{
[Flags]
public enum MorphAnimationFlags
{
None = 0,
Random = 1 << 0,
Loop = 1 << 1,
Shape = 1 << 2,
ShapeReference = 1 << 3,
}

public interface IMorphAnimation : ICacheable<IMorphAnimation>
{
string Name { get; }
Expand All @@ -13,7 +23,7 @@ public interface IMorphAnimation : ICacheable<IMorphAnimation>
float BlendOut { get; }
TimeSpan Duration { get; }
float Speed { get; }
byte Flags { get; }
MorphAnimationFlags Flags { get; }
int FrameCount { get; }
List<int> Vertices { get; }
public int SampleCount { get; }
Expand All @@ -31,7 +41,7 @@ public class CachedMorphAnimation : IMorphAnimation
public float BlendOut { get; set; }
public TimeSpan Duration { get; set; }
public float Speed { get; set; }
public byte Flags { get; set; }
public MorphAnimationFlags Flags { get; set; }
public int FrameCount { get; set; }
public List<int> Vertices { get; set; }

Expand Down Expand Up @@ -72,7 +82,7 @@ internal MorphAnimation(UIntPtr handle)
public float BlendOut => Native.ZkMorphAnimation_getBlendOut(_handle);
public TimeSpan Duration => TimeSpan.FromMilliseconds(Native.ZkMorphAnimation_getDuration(_handle));
public float Speed => Native.ZkMorphAnimation_getSpeed(_handle);
public byte Flags => Native.ZkMorphAnimation_getFlags(_handle);
public MorphAnimationFlags Flags => (MorphAnimationFlags) Native.ZkMorphAnimation_getFlags(_handle);
public int FrameCount => (int)Native.ZkMorphAnimation_getFrameCount(_handle);

public List<int> Vertices =>
Expand Down

0 comments on commit f27fbf0

Please sign in to comment.