docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    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:

    Implements
    IDisposable
    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: UnityEngine.Splines
    Assembly: Unity.Splines.dll
    Syntax
    public struct SplineComputeBufferScope<T> : IDisposable where T : ISpline
    Type Parameters
    Name Description
    T

    The type of spline.

    Examples
    #include "Packages/com.unity.splines/Shader/Spline.cginc"

    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 ComputeBuffer CurveLengths { get; }
    Property Value
    Type Description
    ComputeBuffer

    Curves

    A ComputeBuffer containing BezierCurve.

    Declaration
    public ComputeBuffer Curves { get; }
    Property Value
    Type Description
    ComputeBuffer

    Info

    Returns a SplineInfo Vector4.

    Declaration
    public Vector4 Info { get; }
    Property Value
    Type Description
    Vector4

    Methods

    Bind(ComputeShader, int, 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.

    int 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}.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if any of the expected properties are invalid.

    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()

    Implements

    IDisposable
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)