Class Spline
A wrapper on top of
Inheritance
Inherited Members
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 |
System.Single | zeroValue | The value to return when the curve has no keyframe |
System.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 |
---|---|
System.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 |
---|---|
System.Int32 |
k_Step
The inverse of the precision of the curve.
Declaration
public const float k_Step = 0.0078125F
Field Value
Type | Description |
---|---|
System.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 |
---|---|---|
System.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 |
---|---|---|
System.Single | t | The time to evaluate |
Returns
Type | Description |
---|---|
System.Single | The value of the curve at time t |
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 |
---|---|---|
System.Single | t | The time to evaluate |
System.Int32 | length | The number of keyframes in the curve |
Returns
Type | Description |
---|---|
System.Single | The value of the curve at time t |
GetHashCode()
Returns the computed hash code for this parameter.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | A computed hash code |