NativeAnimationCurve
UnityのAnimationCurveからキーとWrapModeをコピーし、ネイティブ領域で評価します。利用後はDisposeします。
public unsafe struct NativeAnimationCurve : IDisposableNativeAnimationCurve.cs · L8Unityのカーブをコピーして評価する
using MeatMotion.Collections;、using Unity.Collections;、using UnityEngine; を追加します。線形カーブの中点は0.5です。
var source = AnimationCurve.Linear(0f, 0f, 1f, 1f);
using var curve = new NativeAnimationCurve(source, Allocator.Temp);
float middle = curve.Evaluate(0.5f);
メンバー
IsCreated
カーブのネイティブ領域が割り当てられているかを返します。
public readonly bool IsCreated { get; }NativeAnimationCurve
指定したAllocatorでカーブを作ります。AnimationCurveを渡す形式では、そのキーとWrapModeをコピーします。
public NativeAnimationCurve(AllocatorManager.AllocatorHandle allocator)引数
allocatorAllocatorManager.AllocatorHandleネイティブ領域に使用するアロケーター。
public NativeAnimationCurve(AnimationCurve animationCurve, AllocatorManager.AllocatorHandle allocator)引数
animationCurveAnimationCurveカーブのキーと前後のWrapModeを含むUnityのAnimationCurve。allocatorAllocatorManager.AllocatorHandleネイティブ領域に使用するアロケーター。
CopyFrom
既存のカーブデータを渡したAnimationCurveのキーとWrapModeで更新します。
public void CopyFrom(AnimationCurve animationCurve)引数
animationCurveAnimationCurveカーブのキーと前後のWrapModeを含むUnityのAnimationCurve。
public void CopyFrom(in NativeAnimationCurve animationCurve)引数
animationCurvein NativeAnimationCurveカーブのキーと前後のWrapModeを含むUnityのAnimationCurve。
Evaluate
指定した時刻でキーとWrapModeを評価してfloatを返します。
public float Evaluate(float time)引数と戻り値
timefloatカーブを評価する時刻。- 戻り値
float
Dispose
カーブ用に確保したネイティブ領域を解放します。
public void Dispose()
MeatMotion