Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
AnimationCurveEvaluatorOptimizedFloatGroup.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System;
4 using SiliconStudio.Core.Mathematics;
5 
6 namespace SiliconStudio.Paradox.DataModel
7 {
8  public class AnimationCurveEvaluatorOptimizedFloatGroup : AnimationCurveEvaluatorOptimizedGroup<float>
9  {
10  protected unsafe override void ProcessChannel(ref Channel channel, CompressedTimeSpan currentTime, IntPtr location, float factor)
11  {
12  if (channel.InterpolationType == AnimationCurveInterpolationType.Cubic)
13  {
14  *(float*)(location + channel.Offset) = Interpolator.Cubic(
15  channel.ValuePrev.Value,
16  channel.ValueStart.Value,
17  channel.ValueEnd.Value,
18  channel.ValueNext.Value,
19  factor);
20  }
21  else if (channel.InterpolationType == AnimationCurveInterpolationType.Linear)
22  {
23  *(float*)(location + channel.Offset) = Interpolator.Linear(
24  channel.ValueStart.Value,
25  channel.ValueEnd.Value,
26  factor);
27  }
28  else
29  {
30  throw new NotImplementedException();
31  }
32  }
33  }
34 }
AnimationCurveInterpolationType
Describes how a curve should be interpolated.
unsafe override void ProcessChannel(ref Channel channel, CompressedTimeSpan currentTime, IntPtr location, float factor)