docs.unity.cn
    Show / Hide Table of Contents

    Class SplineMesh

    Utility methods for creating and working with meshes.

    Inheritance
    Object
    SplineMesh
    Namespace: UnityEngine.Splines
    Syntax
    public static class SplineMesh : object

    Methods

    Extrude<T>(T, Mesh, Single, Int32, Int32, Boolean)

    Extrude a mesh along a spline in a tube-like shape.

    Declaration
    public static void Extrude<T>(T spline, Mesh mesh, float radius, int sides, int segments, bool capped = true)
        where T : ISpline
    Parameters
    Type Name Description
    T spline

    The spline to extrude.

    Mesh mesh

    A mesh that will be cleared and filled with vertex data for the shape.

    Single radius

    The radius of the extruded mesh.

    Int32 sides

    How many sides make up the radius of the mesh.

    Int32 segments

    How many sections compose the length of the mesh.

    Boolean capped

    Whether the start and end of the mesh is filled. This setting is ignored when spline is closed.

    Type Parameters
    Name Description
    T

    A type implementing ISpline.

    Extrude<T>(T, Mesh, Single, Int32, Int32, Boolean, float2)

    Extrude a mesh along a spline in a tube-like shape.

    Declaration
    public static void Extrude<T>(T spline, Mesh mesh, float radius, int sides, int segments, bool capped, float2 range)
        where T : ISpline
    Parameters
    Type Name Description
    T spline

    The spline to extrude.

    Mesh mesh

    A mesh that will be cleared and filled with vertex data for the shape.

    Single radius

    The radius of the extruded mesh.

    Int32 sides

    How many sides make up the radius of the mesh.

    Int32 segments

    How many sections compose the length of the mesh.

    Boolean capped

    Whether the start and end of the mesh is filled. This setting is ignored when spline is closed.

    float2 range

    The section of the Spline to extrude. This value expects a normalized interpolation start and end. I.e., [0,1] is the entire Spline, whereas [.5, 1] is the last half of the Spline.

    Type Parameters
    Name Description
    T

    A type implementing ISpline.

    Extrude<TSplineType, TVertexType, TIndexType>(TSplineType, NativeArray<TVertexType>, NativeArray<TIndexType>, Single, Int32, Int32, Boolean, float2)

    Extrude a mesh along a spline in a tube-like shape.

    Declaration
    public static void Extrude<TSplineType, TVertexType, TIndexType>(TSplineType spline, NativeArray<TVertexType> vertices, NativeArray<TIndexType> indices, float radius, int sides, int segments, bool capped, float2 range)
        where TSplineType : ISpline where TVertexType : struct, SplineMesh.ISplineVertexData where TIndexType : struct
    Parameters
    Type Name Description
    TSplineType spline

    The spline to extrude.

    NativeArray<TVertexType> vertices

    A pre-allocated buffer of vertex data.

    NativeArray<TIndexType> indices

    A pre-allocated index buffer. Must be of type UInt16 or UInt32.

    Single radius

    The radius of the extruded mesh.

    Int32 sides

    How many sides make up the radius of the mesh.

    Int32 segments

    How many sections compose the length of the mesh.

    Boolean capped

    Whether the start and end of the mesh is filled. This setting is ignored when spline is closed.

    float2 range

    The section of the Spline to extrude. This value expects a normalized interpolation start and end. I.e., [0,1] is the entire Spline, whereas [.5, 1] is the last half of the Spline.

    Type Parameters
    Name Description
    TSplineType

    A type implementing ISpline.

    TVertexType

    A type implementing ISplineVertexData.

    TIndexType

    The mesh index format. Must be UInt16 or UInt32.

    GetVertexAndIndexCount(Int32, Int32, Boolean, Boolean, Vector2, out Int32, out Int32)

    Calculate the vertex and index count required for an extruded mesh. Use this method to allocate attribute and index buffers for use with Extrude.

    Declaration
    public static void GetVertexAndIndexCount(int sides, int segments, bool capped, bool closed, Vector2 range, out int vertexCount, out int indexCount)
    Parameters
    Type Name Description
    Int32 sides

    How many sides make up the radius of the mesh.

    Int32 segments

    How many sections compose the length of the mesh.

    Boolean capped

    Whether the start and end of the mesh is filled. This setting is ignored when spline is closed.

    Boolean closed

    Whether the extruded mesh is closed or open. This can be separate from the Spline.Closed value.

    Vector2 range

    The section of the Spline to extrude. This value expects a normalized interpolation start and end. I.e., [0,1] is the entire Spline, whereas [.5, 1] is the last half of the Spline.

    Int32 vertexCount

    The number of vertices required for an extruded mesh using the provided settings.

    Int32 indexCount

    The number of indices required for an extruded mesh using the provided settings.

    Back to top Copyright © 2022 Unity Technologies
    Generated by DocFX
    on Monday, April 4, 2022
    Terms of use