Class Spline
A wrapper on top of
Namespace: UnityEngine.Rendering.PostProcessing
Syntax
[Serializable]
public sealed class Spline
Constructors
Spline(AnimationCurve, Single, Boolean, Vector2)
Creates a new spline.
Declaration
public Spline(AnimationCurve curve, float zeroValue, bool loop, Vector2 bounds)
Parameters
Type | Name | Description |
---|---|---|
AnimationCurve | curve | The animation curve to base this spline off |
Single | zeroValue | The value to return when the curve has no keyframe |
Boolean | loop | Should this curve loop? |
Vector2 | bounds | The curve bounds |
Fields
cachedData
An array holding pre-computed curve values.
Declaration
public float[] cachedData
Field Value
Type | Description |
---|---|
Single[] |
curve
The underlying animation curve instance.
Declaration
public AnimationCurve curve
Field Value
Type | Description |
---|---|
AnimationCurve |
k_Precision
Precision of the curve.
Declaration
public const int k_Precision = 128
Field Value
Type | Description |
---|---|
Int32 |
k_Step
The inverse of the precision of the curve.
Declaration
public const float k_Step = 0.0078125F
Field Value
Type | Description |
---|---|
Single |
Methods
Cache(Int32)
Caches the curve data at a given frame. The curve data will only be cached once per frame.
Declaration
public void Cache(int frame)
Parameters
Type | Name | Description |
---|---|---|
Int32 | frame | A frame number |
Evaluate(Single)
Evaluates the curve at a point in time.
Declaration
public float Evaluate(float t)
Parameters
Type | Name | Description |
---|---|---|
Single | t | The time to evaluate |
Returns
Type | Description |
---|---|
Single | The value of the curve at time |
Remarks
Calling the length getter on a curve is expensive to it's better to cache its length and call Evaluate(Single, Int32) instead of getting the length for every call.
Evaluate(Single, Int32)
Evaluates the curve at a point in time.
Declaration
public float Evaluate(float t, int length)
Parameters
Type | Name | Description |
---|---|---|
Single | t | The time to evaluate |
Int32 | length | The number of keyframes in the curve |
Returns
Type | Description |
---|---|
Single | The value of the curve at time |
GetHashCode()
Returns the computed hash code for this parameter.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | A computed hash code |