unsafe public static KeyframeCurveAccessor CreateReadOnly(KeyframeCurve curve) { return(new KeyframeCurveAccessor() { m_KeyframeData = new OffsetPtr <Keyframe>((Keyframe *)curve.m_Keyframes.GetUnsafeReadOnlyPtr(), curve.Length) }); }
public static BlobAssetReference <KeyframeCurveBlob> ToBlobAssetRef(this KeyframeCurve curve) { if (curve.Length == 0) { return(BlobAssetReference <KeyframeCurveBlob> .Null); } var blobBuilder = new BlobBuilder(Allocator.Temp); ref var curveBlob = ref blobBuilder.ConstructRoot <KeyframeCurveBlob>();
public KeyframeCurve GetCurve(int curveIndex, Allocator allocator) { var start = CurveOffsets[curveIndex]; var end = curveIndex + 1 < CurveOffsets.Length ? CurveOffsets[curveIndex + 1] : Keyframes.Length; var curve = new KeyframeCurve(end - start, allocator); for (int i = start; i < end; ++i) { curve[i - start] = Keyframes[i]; } return(curve); }
public static KeyframeCurve ToKeyframeCurve(this AnimationCurve curve) { // Allocate the keys var keyframeCurve = new KeyframeCurve(curve.length, Allocator.Persistent); var len = curve.length; for (int i = 0; i < len; i++) { keyframeCurve[i] = KeyframeConversion(curve.keys[i]); } return(keyframeCurve); }
protected override void OnCreate() { m_Curve = new KeyframeCurve(3, Allocator.Persistent); m_Curve[0] = new Unity.Animation.Keyframe { InTangent = 1.996254f, OutTangent = 1.996254f, Time = 0, Value = 0 }; m_Curve[1] = new Unity.Animation.Keyframe { InTangent = 1.996254f, OutTangent = -2.042508f, Time = 0.5042475f, Value = 1.006606f }; m_Curve[2] = new Unity.Animation.Keyframe { InTangent = -2.042508f, OutTangent = -2.042508f, Time = 0.99823f, Value = -0.002357483f }; m_Group = GetEntityQuery(typeof(Translation), ComponentType.ReadOnly <CurveTag>()); }
public static float Evaluate(float time, ref KeyframeCurve curve) { return(Evaluate(time, KeyframeCurveProvider.Create(curve))); }