|
@@ -66,7 +66,10 @@ namespace SharpGLTF.Schema2
|
|
|
/// </remarks>
|
|
/// </remarks>
|
|
|
sealed partial class AnimationSampler :
|
|
sealed partial class AnimationSampler :
|
|
|
IChildOfList<Animation>,
|
|
IChildOfList<Animation>,
|
|
|
|
|
+ IAnimationSampler<Single>,
|
|
|
|
|
+ IAnimationSampler<Vector2>,
|
|
|
IAnimationSampler<Vector3>,
|
|
IAnimationSampler<Vector3>,
|
|
|
|
|
+ IAnimationSampler<Vector4>,
|
|
|
IAnimationSampler<Quaternion>,
|
|
IAnimationSampler<Quaternion>,
|
|
|
IAnimationSampler<SPARSE8>,
|
|
IAnimationSampler<SPARSE8>,
|
|
|
IAnimationSampler<SEGMENT>,
|
|
IAnimationSampler<SEGMENT>,
|
|
@@ -144,6 +147,50 @@ namespace SharpGLTF.Schema2
|
|
|
return accessor;
|
|
return accessor;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private Accessor _CreateOutputAccessor(IReadOnlyList<Single> output)
|
|
|
|
|
+ {
|
|
|
|
|
+ Guard.NotNull(output, nameof(output));
|
|
|
|
|
+ Guard.MustBeGreaterThan(output.Count, 0, nameof(output.Count));
|
|
|
|
|
+
|
|
|
|
|
+ var root = LogicalParent.LogicalParent;
|
|
|
|
|
+
|
|
|
|
|
+ var buffer = root.CreateBufferView(output.Count * 4 * 1);
|
|
|
|
|
+
|
|
|
|
|
+ System.Diagnostics.Debug.Assert(buffer.ByteStride == 0);
|
|
|
|
|
+
|
|
|
|
|
+ var accessor = root.CreateAccessor("Animation.Output");
|
|
|
|
|
+
|
|
|
|
|
+ accessor.SetData(buffer, 0, output.Count, DimensionType.SCALAR, EncodingType.FLOAT, false);
|
|
|
|
|
+
|
|
|
|
|
+ Memory.EncodedArrayUtils._CopyTo(output, accessor.AsScalarArray());
|
|
|
|
|
+
|
|
|
|
|
+ accessor.UpdateBounds();
|
|
|
|
|
+
|
|
|
|
|
+ return accessor;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private Accessor _CreateOutputAccessor(IReadOnlyList<Vector2> output)
|
|
|
|
|
+ {
|
|
|
|
|
+ Guard.NotNull(output, nameof(output));
|
|
|
|
|
+ Guard.MustBeGreaterThan(output.Count, 0, nameof(output.Count));
|
|
|
|
|
+
|
|
|
|
|
+ var root = LogicalParent.LogicalParent;
|
|
|
|
|
+
|
|
|
|
|
+ var buffer = root.CreateBufferView(output.Count * 4 * 2);
|
|
|
|
|
+
|
|
|
|
|
+ System.Diagnostics.Debug.Assert(buffer.ByteStride == 0);
|
|
|
|
|
+
|
|
|
|
|
+ var accessor = root.CreateAccessor("Animation.Output");
|
|
|
|
|
+
|
|
|
|
|
+ accessor.SetData(buffer, 0, output.Count, DimensionType.VEC2, EncodingType.FLOAT, false);
|
|
|
|
|
+
|
|
|
|
|
+ Memory.EncodedArrayUtils._CopyTo(output, accessor.AsVector2Array());
|
|
|
|
|
+
|
|
|
|
|
+ accessor.UpdateBounds();
|
|
|
|
|
+
|
|
|
|
|
+ return accessor;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private Accessor _CreateOutputAccessor(IReadOnlyList<Vector3> output)
|
|
private Accessor _CreateOutputAccessor(IReadOnlyList<Vector3> output)
|
|
|
{
|
|
{
|
|
|
Guard.NotNull(output, nameof(output));
|
|
Guard.NotNull(output, nameof(output));
|
|
@@ -166,6 +213,28 @@ namespace SharpGLTF.Schema2
|
|
|
return accessor;
|
|
return accessor;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private Accessor _CreateOutputAccessor(IReadOnlyList<Vector4> output)
|
|
|
|
|
+ {
|
|
|
|
|
+ Guard.NotNull(output, nameof(output));
|
|
|
|
|
+ Guard.MustBeGreaterThan(output.Count, 0, nameof(output.Count));
|
|
|
|
|
+
|
|
|
|
|
+ var root = LogicalParent.LogicalParent;
|
|
|
|
|
+
|
|
|
|
|
+ var buffer = root.CreateBufferView(output.Count * 4 * 4);
|
|
|
|
|
+
|
|
|
|
|
+ System.Diagnostics.Debug.Assert(buffer.ByteStride == 0);
|
|
|
|
|
+
|
|
|
|
|
+ var accessor = root.CreateAccessor("Animation.Output");
|
|
|
|
|
+
|
|
|
|
|
+ accessor.SetData(buffer, 0, output.Count, DimensionType.VEC4, EncodingType.FLOAT, false);
|
|
|
|
|
+
|
|
|
|
|
+ Memory.EncodedArrayUtils._CopyTo(output, accessor.AsVector4Array());
|
|
|
|
|
+
|
|
|
|
|
+ accessor.UpdateBounds();
|
|
|
|
|
+
|
|
|
|
|
+ return accessor;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private Accessor _CreateOutputAccessor(IReadOnlyList<Quaternion> output)
|
|
private Accessor _CreateOutputAccessor(IReadOnlyList<Quaternion> output)
|
|
|
{
|
|
{
|
|
|
Guard.NotNull(output, nameof(output));
|
|
Guard.NotNull(output, nameof(output));
|
|
@@ -274,6 +343,24 @@ namespace SharpGLTF.Schema2
|
|
|
return (keys, vals);
|
|
return (keys, vals);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ internal void SetKeys(IReadOnlyDictionary<Single, Single> keyframes)
|
|
|
|
|
+ {
|
|
|
|
|
+ Guard.NotNullOrEmpty(keyframes, nameof(keyframes));
|
|
|
|
|
+
|
|
|
|
|
+ var (keys, values) = _Split(keyframes);
|
|
|
|
|
+ _input = this._CreateInputAccessor(keys).LogicalIndex;
|
|
|
|
|
+ _output = this._CreateOutputAccessor(values).LogicalIndex;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ internal void SetKeys(IReadOnlyDictionary<Single, Vector2> keyframes)
|
|
|
|
|
+ {
|
|
|
|
|
+ Guard.NotNullOrEmpty(keyframes, nameof(keyframes));
|
|
|
|
|
+
|
|
|
|
|
+ var (keys, values) = _Split(keyframes);
|
|
|
|
|
+ _input = this._CreateInputAccessor(keys).LogicalIndex;
|
|
|
|
|
+ _output = this._CreateOutputAccessor(values).LogicalIndex;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
internal void SetKeys(IReadOnlyDictionary<Single, Vector3> keyframes)
|
|
internal void SetKeys(IReadOnlyDictionary<Single, Vector3> keyframes)
|
|
|
{
|
|
{
|
|
|
Guard.NotNullOrEmpty(keyframes, nameof(keyframes));
|
|
Guard.NotNullOrEmpty(keyframes, nameof(keyframes));
|
|
@@ -283,6 +370,15 @@ namespace SharpGLTF.Schema2
|
|
|
_output = this._CreateOutputAccessor(values).LogicalIndex;
|
|
_output = this._CreateOutputAccessor(values).LogicalIndex;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ internal void SetKeys(IReadOnlyDictionary<Single, Vector4> keyframes)
|
|
|
|
|
+ {
|
|
|
|
|
+ Guard.NotNullOrEmpty(keyframes, nameof(keyframes));
|
|
|
|
|
+
|
|
|
|
|
+ var (keys, values) = _Split(keyframes);
|
|
|
|
|
+ _input = this._CreateInputAccessor(keys).LogicalIndex;
|
|
|
|
|
+ _output = this._CreateOutputAccessor(values).LogicalIndex;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
internal void SetKeys(IReadOnlyDictionary<Single, Quaternion> keyframes)
|
|
internal void SetKeys(IReadOnlyDictionary<Single, Quaternion> keyframes)
|
|
|
{
|
|
{
|
|
|
Guard.NotNullOrEmpty(keyframes, nameof(keyframes));
|
|
Guard.NotNullOrEmpty(keyframes, nameof(keyframes));
|
|
@@ -312,6 +408,42 @@ namespace SharpGLTF.Schema2
|
|
|
_output = this._CreateOutputAccessor(values, itemsStride).LogicalIndex;
|
|
_output = this._CreateOutputAccessor(values, itemsStride).LogicalIndex;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ internal void SetCubicKeys(IReadOnlyDictionary<Single, (Single TangentIn, Single Value, Single TangentOut)> keyframes)
|
|
|
|
|
+ {
|
|
|
|
|
+ Guard.NotNull(keyframes, nameof(keyframes));
|
|
|
|
|
+ Guard.MustBeGreaterThan(keyframes.Count, 0, nameof(keyframes.Count));
|
|
|
|
|
+
|
|
|
|
|
+ // splits the dictionary into separated input/output collections, also, the output will be flattened to plain Vector3 values.
|
|
|
|
|
+ var (keys, values) = _Split(keyframes);
|
|
|
|
|
+ System.Diagnostics.Debug.Assert(keys.Length * 3 == values.Length, "keys and values must have 1 to 3 ratio");
|
|
|
|
|
+
|
|
|
|
|
+ // fix for first incoming tangent and last outgoing tangent
|
|
|
|
|
+ // this might not be true for a looped animation, where first and last might be the same
|
|
|
|
|
+ values[0] = 0f;
|
|
|
|
|
+ values[values.Length - 1] = 0f;
|
|
|
|
|
+
|
|
|
|
|
+ _input = this._CreateInputAccessor(keys).LogicalIndex;
|
|
|
|
|
+ _output = this._CreateOutputAccessor(values).LogicalIndex;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ internal void SetCubicKeys(IReadOnlyDictionary<Single, (Vector2 TangentIn, Vector2 Value, Vector2 TangentOut)> keyframes)
|
|
|
|
|
+ {
|
|
|
|
|
+ Guard.NotNull(keyframes, nameof(keyframes));
|
|
|
|
|
+ Guard.MustBeGreaterThan(keyframes.Count, 0, nameof(keyframes.Count));
|
|
|
|
|
+
|
|
|
|
|
+ // splits the dictionary into separated input/output collections, also, the output will be flattened to plain Vector3 values.
|
|
|
|
|
+ var (keys, values) = _Split(keyframes);
|
|
|
|
|
+ System.Diagnostics.Debug.Assert(keys.Length * 3 == values.Length, "keys and values must have 1 to 3 ratio");
|
|
|
|
|
+
|
|
|
|
|
+ // fix for first incoming tangent and last outgoing tangent
|
|
|
|
|
+ // this might not be true for a looped animation, where first and last might be the same
|
|
|
|
|
+ values[0] = Vector2.Zero;
|
|
|
|
|
+ values[values.Length - 1] = Vector2.Zero;
|
|
|
|
|
+
|
|
|
|
|
+ _input = this._CreateInputAccessor(keys).LogicalIndex;
|
|
|
|
|
+ _output = this._CreateOutputAccessor(values).LogicalIndex;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
internal void SetCubicKeys(IReadOnlyDictionary<Single, (Vector3 TangentIn, Vector3 Value, Vector3 TangentOut)> keyframes)
|
|
internal void SetCubicKeys(IReadOnlyDictionary<Single, (Vector3 TangentIn, Vector3 Value, Vector3 TangentOut)> keyframes)
|
|
|
{
|
|
{
|
|
|
Guard.NotNull(keyframes, nameof(keyframes));
|
|
Guard.NotNull(keyframes, nameof(keyframes));
|
|
@@ -330,6 +462,24 @@ namespace SharpGLTF.Schema2
|
|
|
_output = this._CreateOutputAccessor(values).LogicalIndex;
|
|
_output = this._CreateOutputAccessor(values).LogicalIndex;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ internal void SetCubicKeys(IReadOnlyDictionary<Single, (Vector4 TangentIn, Vector4 Value, Vector4 TangentOut)> keyframes)
|
|
|
|
|
+ {
|
|
|
|
|
+ Guard.NotNull(keyframes, nameof(keyframes));
|
|
|
|
|
+ Guard.MustBeGreaterThan(keyframes.Count, 0, nameof(keyframes.Count));
|
|
|
|
|
+
|
|
|
|
|
+ // splits the dictionary into separated input/output collections, also, the output will be flattened to plain Vector3 values.
|
|
|
|
|
+ var (keys, values) = _Split(keyframes);
|
|
|
|
|
+ System.Diagnostics.Debug.Assert(keys.Length * 3 == values.Length, "keys and values must have 1 to 3 ratio");
|
|
|
|
|
+
|
|
|
|
|
+ // fix for first incoming tangent and last outgoing tangent
|
|
|
|
|
+ // this might not be true for a looped animation, where first and last might be the same
|
|
|
|
|
+ values[0] = Vector4.Zero;
|
|
|
|
|
+ values[values.Length - 1] = Vector4.Zero;
|
|
|
|
|
+
|
|
|
|
|
+ _input = this._CreateInputAccessor(keys).LogicalIndex;
|
|
|
|
|
+ _output = this._CreateOutputAccessor(values).LogicalIndex;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
internal void SetCubicKeys(IReadOnlyDictionary<Single, (Quaternion TangentIn, Quaternion Value, Quaternion TangentOut)> keyframes)
|
|
internal void SetCubicKeys(IReadOnlyDictionary<Single, (Quaternion TangentIn, Quaternion Value, Quaternion TangentOut)> keyframes)
|
|
|
{
|
|
{
|
|
|
Guard.NotNullOrEmpty(keyframes, nameof(keyframes));
|
|
Guard.NotNullOrEmpty(keyframes, nameof(keyframes));
|
|
@@ -382,6 +532,28 @@ namespace SharpGLTF.Schema2
|
|
|
_output = this._CreateOutputAccessor(values, expandedCount).LogicalIndex;
|
|
_output = this._CreateOutputAccessor(values, expandedCount).LogicalIndex;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /// <inheritdoc/>
|
|
|
|
|
+ IEnumerable<(Single, Single)> IAnimationSampler<Single>.GetLinearKeys()
|
|
|
|
|
+ {
|
|
|
|
|
+ Guard.IsFalse(this.InterpolationMode == AnimationInterpolationMode.CUBICSPLINE, nameof(InterpolationMode));
|
|
|
|
|
+
|
|
|
|
|
+ var keys = this.Input.AsScalarArray();
|
|
|
|
|
+ var frames = this.Output.AsScalarArray();
|
|
|
|
|
+
|
|
|
|
|
+ return keys.Zip(frames, (key, val) => (key, val));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /// <inheritdoc/>
|
|
|
|
|
+ IEnumerable<(Single, Vector2)> IAnimationSampler<Vector2>.GetLinearKeys()
|
|
|
|
|
+ {
|
|
|
|
|
+ Guard.IsFalse(this.InterpolationMode == AnimationInterpolationMode.CUBICSPLINE, nameof(InterpolationMode));
|
|
|
|
|
+
|
|
|
|
|
+ var keys = this.Input.AsScalarArray();
|
|
|
|
|
+ var frames = this.Output.AsVector2Array();
|
|
|
|
|
+
|
|
|
|
|
+ return keys.Zip(frames, (key, val) => (key, val));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/// <inheritdoc/>
|
|
/// <inheritdoc/>
|
|
|
IEnumerable<(Single, Vector3)> IAnimationSampler<Vector3>.GetLinearKeys()
|
|
IEnumerable<(Single, Vector3)> IAnimationSampler<Vector3>.GetLinearKeys()
|
|
|
{
|
|
{
|
|
@@ -393,6 +565,17 @@ namespace SharpGLTF.Schema2
|
|
|
return keys.Zip(frames, (key, val) => (key, val));
|
|
return keys.Zip(frames, (key, val) => (key, val));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /// <inheritdoc/>
|
|
|
|
|
+ IEnumerable<(Single, Vector4)> IAnimationSampler<Vector4>.GetLinearKeys()
|
|
|
|
|
+ {
|
|
|
|
|
+ Guard.IsFalse(this.InterpolationMode == AnimationInterpolationMode.CUBICSPLINE, nameof(InterpolationMode));
|
|
|
|
|
+
|
|
|
|
|
+ var keys = this.Input.AsScalarArray();
|
|
|
|
|
+ var frames = this.Output.AsVector4Array();
|
|
|
|
|
+
|
|
|
|
|
+ return keys.Zip(frames, (key, val) => (key, val));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/// <inheritdoc/>
|
|
/// <inheritdoc/>
|
|
|
IEnumerable<(Single, Quaternion)> IAnimationSampler<Quaternion>.GetLinearKeys()
|
|
IEnumerable<(Single, Quaternion)> IAnimationSampler<Quaternion>.GetLinearKeys()
|
|
|
{
|
|
{
|
|
@@ -443,6 +626,28 @@ namespace SharpGLTF.Schema2
|
|
|
return keys.Zip(frames, (key, val) => (key, val));
|
|
return keys.Zip(frames, (key, val) => (key, val));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /// <inheritdoc/>
|
|
|
|
|
+ IEnumerable<(Single, (Single, Single, Single))> IAnimationSampler<Single>.GetCubicKeys()
|
|
|
|
|
+ {
|
|
|
|
|
+ Guard.IsFalse(this.InterpolationMode != AnimationInterpolationMode.CUBICSPLINE, nameof(InterpolationMode));
|
|
|
|
|
+
|
|
|
|
|
+ var keys = this.Input.AsScalarArray();
|
|
|
|
|
+ var frames = _GroupByTangentValueTangent(this.Output.AsScalarArray());
|
|
|
|
|
+
|
|
|
|
|
+ return keys.Zip(frames, (key, val) => (key, val));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /// <inheritdoc/>
|
|
|
|
|
+ IEnumerable<(Single, (Vector2, Vector2, Vector2))> IAnimationSampler<Vector2>.GetCubicKeys()
|
|
|
|
|
+ {
|
|
|
|
|
+ Guard.IsFalse(this.InterpolationMode != AnimationInterpolationMode.CUBICSPLINE, nameof(InterpolationMode));
|
|
|
|
|
+
|
|
|
|
|
+ var keys = this.Input.AsScalarArray();
|
|
|
|
|
+ var frames = _GroupByTangentValueTangent(this.Output.AsVector2Array());
|
|
|
|
|
+
|
|
|
|
|
+ return keys.Zip(frames, (key, val) => (key, val));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/// <inheritdoc/>
|
|
/// <inheritdoc/>
|
|
|
IEnumerable<(Single, (Vector3, Vector3, Vector3))> IAnimationSampler<Vector3>.GetCubicKeys()
|
|
IEnumerable<(Single, (Vector3, Vector3, Vector3))> IAnimationSampler<Vector3>.GetCubicKeys()
|
|
|
{
|
|
{
|
|
@@ -454,6 +659,17 @@ namespace SharpGLTF.Schema2
|
|
|
return keys.Zip(frames, (key, val) => (key, val));
|
|
return keys.Zip(frames, (key, val) => (key, val));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /// <inheritdoc/>
|
|
|
|
|
+ IEnumerable<(Single, (Vector4, Vector4, Vector4))> IAnimationSampler<Vector4>.GetCubicKeys()
|
|
|
|
|
+ {
|
|
|
|
|
+ Guard.IsFalse(this.InterpolationMode != AnimationInterpolationMode.CUBICSPLINE, nameof(InterpolationMode));
|
|
|
|
|
+
|
|
|
|
|
+ var keys = this.Input.AsScalarArray();
|
|
|
|
|
+ var frames = _GroupByTangentValueTangent(this.Output.AsVector4Array());
|
|
|
|
|
+
|
|
|
|
|
+ return keys.Zip(frames, (key, val) => (key, val));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/// <inheritdoc/>
|
|
/// <inheritdoc/>
|
|
|
IEnumerable<(Single, (Quaternion, Quaternion, Quaternion))> IAnimationSampler<Quaternion>.GetCubicKeys()
|
|
IEnumerable<(Single, (Quaternion, Quaternion, Quaternion))> IAnimationSampler<Quaternion>.GetCubicKeys()
|
|
|
{
|
|
{
|
|
@@ -503,6 +719,36 @@ namespace SharpGLTF.Schema2
|
|
|
return keys.Zip(frames, (key, val) => (key, SPARSE8.AsTuple(val.TangentIn, val.Value, val.TangentOut)) );
|
|
return keys.Zip(frames, (key, val) => (key, SPARSE8.AsTuple(val.TangentIn, val.Value, val.TangentOut)) );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /// <inheritdoc/>
|
|
|
|
|
+ ICurveSampler<Single> IAnimationSampler<Single>.CreateCurveSampler(bool isolateMemory)
|
|
|
|
|
+ {
|
|
|
|
|
+ var xsampler = this as IAnimationSampler<Single>;
|
|
|
|
|
+
|
|
|
|
|
+ switch (this.InterpolationMode)
|
|
|
|
|
+ {
|
|
|
|
|
+ case AnimationInterpolationMode.STEP: return xsampler.GetLinearKeys().CreateSampler(false, isolateMemory);
|
|
|
|
|
+ case AnimationInterpolationMode.LINEAR: return xsampler.GetLinearKeys().CreateSampler(true, isolateMemory);
|
|
|
|
|
+ case AnimationInterpolationMode.CUBICSPLINE: return xsampler.GetCubicKeys().CreateSampler(isolateMemory);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ throw new NotImplementedException();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /// <inheritdoc/>
|
|
|
|
|
+ ICurveSampler<Vector2> IAnimationSampler<Vector2>.CreateCurveSampler(bool isolateMemory)
|
|
|
|
|
+ {
|
|
|
|
|
+ var xsampler = this as IAnimationSampler<Vector2>;
|
|
|
|
|
+
|
|
|
|
|
+ switch (this.InterpolationMode)
|
|
|
|
|
+ {
|
|
|
|
|
+ case AnimationInterpolationMode.STEP: return xsampler.GetLinearKeys().CreateSampler(false, isolateMemory);
|
|
|
|
|
+ case AnimationInterpolationMode.LINEAR: return xsampler.GetLinearKeys().CreateSampler(true, isolateMemory);
|
|
|
|
|
+ case AnimationInterpolationMode.CUBICSPLINE: return xsampler.GetCubicKeys().CreateSampler(isolateMemory);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ throw new NotImplementedException();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/// <inheritdoc/>
|
|
/// <inheritdoc/>
|
|
|
ICurveSampler<Vector3> IAnimationSampler<Vector3>.CreateCurveSampler(bool isolateMemory)
|
|
ICurveSampler<Vector3> IAnimationSampler<Vector3>.CreateCurveSampler(bool isolateMemory)
|
|
|
{
|
|
{
|
|
@@ -518,6 +764,21 @@ namespace SharpGLTF.Schema2
|
|
|
throw new NotImplementedException();
|
|
throw new NotImplementedException();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /// <inheritdoc/>
|
|
|
|
|
+ ICurveSampler<Vector4> IAnimationSampler<Vector4>.CreateCurveSampler(bool isolateMemory)
|
|
|
|
|
+ {
|
|
|
|
|
+ var xsampler = this as IAnimationSampler<Vector4>;
|
|
|
|
|
+
|
|
|
|
|
+ switch (this.InterpolationMode)
|
|
|
|
|
+ {
|
|
|
|
|
+ case AnimationInterpolationMode.STEP: return xsampler.GetLinearKeys().CreateSampler(false, isolateMemory);
|
|
|
|
|
+ case AnimationInterpolationMode.LINEAR: return xsampler.GetLinearKeys().CreateSampler(true, isolateMemory);
|
|
|
|
|
+ case AnimationInterpolationMode.CUBICSPLINE: return xsampler.GetCubicKeys().CreateSampler(isolateMemory);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ throw new NotImplementedException();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/// <inheritdoc/>
|
|
/// <inheritdoc/>
|
|
|
ICurveSampler<Quaternion> IAnimationSampler<Quaternion>.CreateCurveSampler(bool isolateMemory)
|
|
ICurveSampler<Quaternion> IAnimationSampler<Quaternion>.CreateCurveSampler(bool isolateMemory)
|
|
|
{
|
|
{
|