0.2.0-dev Download ZIP
26 lines ·967 B Raw
| 1 | namespace EvilEngine.GenerativeMotion; |
| 2 | |
| 3 | public sealed class SomaGeneration |
| 4 | { |
| 5 | public int Tokens { get; internal set; } |
| 6 | |
| 7 | public int FrameCount { get; internal set; } |
| 8 | |
| 9 | public Rigid[] Poses { get; } = new Rigid[SomaContract.MaxFrames * SomaSkeleton.JointCount]; |
| 10 | |
| 11 | public float[] Contacts { get; } = new float[SomaContract.MaxFrames * SomaContract.FootContacts]; |
| 12 | |
| 13 | public ReadOnlySpan<Rigid> Pose(int frame) |
| 14 | { |
| 15 | ArgumentOutOfRangeException.ThrowIfNegative(frame); |
| 16 | ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(frame, FrameCount); |
| 17 | return Poses.AsSpan(frame * SomaSkeleton.JointCount, SomaSkeleton.JointCount); |
| 18 | } |
| 19 | |
| 20 | public ReadOnlySpan<float> FootContacts(int frame) |
| 21 | { |
| 22 | ArgumentOutOfRangeException.ThrowIfNegative(frame); |
| 23 | ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(frame, FrameCount); |
| 24 | return Contacts.AsSpan(frame * SomaContract.FootContacts, SomaContract.FootContacts); |
| 25 | } |
| 26 | } |