Struct SplineComputeBufferScope<T>
SplineComputeBufferScope is a convenient way to extract from a spline the information necessary to evaluate spline values in a ComputeShader. To access Spline evaluation methods in a shader, include the "Splines.cginc" file:
#include "Packages/com.unity.splines/Shader/Spline.cginc"
Namespace: UnityEngine.Splines
Syntax
public struct SplineComputeBufferScope<T> : IDisposable where T : ISpline
Type Parameters
Name | Description |
---|---|
T | The type of spline. |
Constructors
SplineComputeBufferScope(T)
Create a new SplineComputeBufferScope.
Declaration
public SplineComputeBufferScope(T spline)
Parameters
Type | Name | Description |
---|---|---|
T | spline | The spline to create GPU data for. |
Properties
CurveLengths
A ComputeBuffer containing the cached length of all spline curves.
Declaration
public readonly ComputeBuffer CurveLengths { get; }
Property Value
Type | Description |
---|---|
ComputeBuffer |
Curves
A ComputeBuffer containing BezierCurve.
Declaration
public readonly ComputeBuffer Curves { get; }
Property Value
Type | Description |
---|---|
ComputeBuffer |
Info
Returns a SplineInfo Vector4.
Declaration
public readonly Vector4 Info { get; }
Property Value
Type | Description |
---|---|
Vector4 |
Methods
Bind(ComputeShader, Int32, String, String, String)
Set up a shader with all of the necessary ComputeBuffer and Spline metadata for working with functions found in Spline.cginc.
Declaration
public void Bind(ComputeShader shader, int kernel, string info, string curves, string lengths)
Parameters
Type | Name | Description |
---|---|---|
ComputeShader | shader | The compute shader to bind. |
Int32 | kernel | The kernel to target. |
String | info | The float4 (typedef to SplineData in Spline.cginc) Spline info. |
String | curves | A StructuredBuffer{BezierCurve} or RWStructuredBuffer{BezierCurve}. |
String | lengths | A StructuredBuffer{float} or RWStructuredBuffer{float}. |
Dispose()
Free resources allocated by this object.
Declaration
public void Dispose()
Upload()
Copy Spline curve, info, and length caches to their GPU buffers.
Declaration
public void Upload()