docs.unity3d.com
    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:

    #include "Packages/com.unity.splines/Shader/Spline.cginc"
    Inherited Members
    ValueType.Equals(Object)
    ValueType.GetHashCode()
    ValueType.ToString()
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    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}.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if any of the expected properties are invalid.

    Dispose()

    Free resources allocated by this object.

    Declaration
    public void Dispose()
    Implements
    IDisposable.Dispose()

    Upload()

    Copy Spline curve, info, and length caches to their GPU buffers.

    Declaration
    public void Upload()
    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023