-
-
Notifications
You must be signed in to change notification settings - Fork 911
/
AnimationCurveEvaluatorOptimizedVector4Group.cs
40 lines (39 loc) · 1.66 KB
/
AnimationCurveEvaluatorOptimizedVector4Group.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (c) Stride contributors (https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.
using System;
using Stride.Core.Mathematics;
namespace Stride.Animations
{
public class AnimationCurveEvaluatorOptimizedVector4Group : AnimationCurveEvaluatorOptimizedBlittableGroupBase<Vector4>
{
protected unsafe override void ProcessChannel(ref Channel channel, CompressedTimeSpan currentTime, IntPtr location, float factor)
{
if (channel.InterpolationType == AnimationCurveInterpolationType.Cubic)
{
Interpolator.Vector4.Cubic(
ref channel.ValuePrev.Value,
ref channel.ValueStart.Value,
ref channel.ValueEnd.Value,
ref channel.ValueNext.Value,
factor,
out *(Vector4*)(location + channel.Offset));
}
else if (channel.InterpolationType == AnimationCurveInterpolationType.Linear)
{
Interpolator.Vector4.Linear(
ref channel.ValueStart.Value,
ref channel.ValueEnd.Value,
factor,
out *(Vector4*)(location + channel.Offset));
}
else if (channel.InterpolationType == AnimationCurveInterpolationType.Constant)
{
*(Vector4*)(location + channel.Offset) = channel.ValueStart.Value;
}
else
{
throw new NotImplementedException();
}
}
}
}