Table of Contents

Class TriangleMesh

Namespace
Jitter2.Collision.Shapes
Assembly
Jitter2.dll

Represents a triangle mesh defined by a collection of vertices and triangle indices.

public class TriangleMesh
Inheritance
TriangleMesh
Inherited Members

Constructors

TriangleMesh(IEnumerable<JTriangle>, bool)

Creates a mesh from a "soup" of triangles. Vertices are automatically identified and deduplicated.

public TriangleMesh(IEnumerable<JTriangle> soup, bool ignoreDegenerated = false)

Parameters

soup IEnumerable<JTriangle>
ignoreDegenerated bool

TriangleMesh(ReadOnlySpan<JTriangle>, bool)

Creates a mesh from a "soup" of triangles. Vertices are automatically identified and deduplicated.

public TriangleMesh(ReadOnlySpan<JTriangle> soup, bool ignoreDegenerated = false)

Parameters

soup ReadOnlySpan<JTriangle>
ignoreDegenerated bool

TriangleMesh(ReadOnlySpan<JVector>, ReadOnlySpan<int>, bool)

Creates a mesh from existing vertices and indices.

public TriangleMesh(ReadOnlySpan<JVector> vertices, ReadOnlySpan<int> indices, bool ignoreDegenerated = false)

Parameters

vertices ReadOnlySpan<JVector>

The vertex buffer.

indices ReadOnlySpan<int>

The index buffer (must be a multiple of 3).

ignoreDegenerated bool

Remarks

Vertices with exactly identical positions are canonicalized so adjacency detection also works across duplicated seam vertices in indexed meshes.

TriangleMesh(ReadOnlySpan<JVector>, ReadOnlySpan<ushort>, bool)

Creates a mesh from existing vertices and indices.

public TriangleMesh(ReadOnlySpan<JVector> vertices, ReadOnlySpan<ushort> indices, bool ignoreDegenerated = false)

Parameters

vertices ReadOnlySpan<JVector>

The vertex buffer.

indices ReadOnlySpan<ushort>

The index buffer (must be a multiple of 3).

ignoreDegenerated bool

Remarks

Vertices with exactly identical positions are canonicalized so adjacency detection also works across duplicated seam vertices in indexed meshes.

TriangleMesh(ReadOnlySpan<JVector>, ReadOnlySpan<uint>, bool)

Creates a mesh from existing vertices and indices.

public TriangleMesh(ReadOnlySpan<JVector> vertices, ReadOnlySpan<uint> indices, bool ignoreDegenerated = false)

Parameters

vertices ReadOnlySpan<JVector>

The vertex buffer.

indices ReadOnlySpan<uint>

The index buffer (must be a multiple of 3).

ignoreDegenerated bool

Remarks

Vertices with exactly identical positions are canonicalized so adjacency detection also works across duplicated seam vertices in indexed meshes.

Properties

Indices

Gets the triangle indices of the mesh.

public ReadOnlySpan<TriangleMesh.Triangle> Indices { get; }

Property Value

ReadOnlySpan<TriangleMesh.Triangle>

Vertices

Gets the vertices of the mesh.

public ReadOnlySpan<JVector> Vertices { get; }

Property Value

ReadOnlySpan<JVector>

Methods

Create<TVertex>(ReadOnlySpan<TVertex>, ReadOnlySpan<int>, bool)

Creates a mesh from custom vertices (e.g. System.Numerics.Vector3) and indices.

public static TriangleMesh Create<TVertex>(ReadOnlySpan<TVertex> vertices, ReadOnlySpan<int> indices, bool ignoreDegenerated = false) where TVertex : unmanaged

Parameters

vertices ReadOnlySpan<TVertex>
indices ReadOnlySpan<int>
ignoreDegenerated bool

Returns

TriangleMesh

Type Parameters

TVertex

Create<TVertex>(ReadOnlySpan<TVertex>, ReadOnlySpan<ushort>, bool)

Creates a mesh from custom vertices (e.g. System.Numerics.Vector3) and indices.

public static TriangleMesh Create<TVertex>(ReadOnlySpan<TVertex> vertices, ReadOnlySpan<ushort> indices, bool ignoreDegenerated = false) where TVertex : unmanaged

Parameters

vertices ReadOnlySpan<TVertex>
indices ReadOnlySpan<ushort>
ignoreDegenerated bool

Returns

TriangleMesh

Type Parameters

TVertex

Create<TVertex>(ReadOnlySpan<TVertex>, ReadOnlySpan<uint>, bool)

Creates a mesh from custom vertices (e.g. System.Numerics.Vector3) and indices.

public static TriangleMesh Create<TVertex>(ReadOnlySpan<TVertex> vertices, ReadOnlySpan<uint> indices, bool ignoreDegenerated = false) where TVertex : unmanaged

Parameters

vertices ReadOnlySpan<TVertex>
indices ReadOnlySpan<uint>
ignoreDegenerated bool

Returns

TriangleMesh

Type Parameters

TVertex