Class DeleteElements
Functions for removing vertices and triangles from a mesh.
Inheritance
Namespace: UnityEngine.ProBuilder.MeshOperations
Syntax
public static class DeleteElements
Methods
DeleteFace(ProBuilderMesh, Face)
Removes a face from a mesh.
Declaration
public static int[] DeleteFace(this ProBuilderMesh mesh, Face face)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The source mesh. |
Face | face | The face to remove. |
Returns
Type | Description |
---|---|
System.Int32[] | An array of vertex indexes that were deleted as a result of face deletion. |
DeleteFaces(ProBuilderMesh, IEnumerable<Face>)
Delete a collection of faces from a mesh.
Declaration
public static int[] DeleteFaces(this ProBuilderMesh mesh, IEnumerable<Face> faces)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The source mesh. |
System.Collections.Generic.IEnumerable<Face> | faces | The faces to remove. |
Returns
Type | Description |
---|---|
System.Int32[] | An array of vertex indexes that were deleted as a result of deletion. |
DeleteFaces(ProBuilderMesh, IList<Int32>)
Delete a collection of faces from a mesh.
Declaration
public static int[] DeleteFaces(this ProBuilderMesh mesh, IList<int> faceIndexes)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The source mesh. |
System.Collections.Generic.IList<System.Int32> | faceIndexes | The indexes of faces to remove (corresponding to the @"UnityEngine.ProBuilder.ProBuilderMesh.faces" collection. |
Returns
Type | Description |
---|---|
System.Int32[] | An array of vertex indexes that were deleted as a result of deletion. |
DeleteVertices(ProBuilderMesh, IEnumerable<Int32>)
Deletes the vertices from the passed index array, and handles rebuilding the sharedIndexes array.
Declaration
public static void DeleteVertices(this ProBuilderMesh mesh, IEnumerable<int> distinctIndexes)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The source mesh. |
System.Collections.Generic.IEnumerable<System.Int32> | distinctIndexes | A list of vertices to delete. Note that this must not contain duplicates. |
Remarks
This function does not retriangulate the mesh. Ie, you are responsible for ensuring that indexes deleted by this function are not referenced by any triangles.
RemoveDegenerateTriangles(ProBuilderMesh)
Iterates through all faces in a mesh and removes triangles with an area less than float.Epsilon, or with indexes that point to the same vertex. This function also enforces the rule that a face must contain no coincident vertices.
Declaration
public static int[] RemoveDegenerateTriangles(this ProBuilderMesh mesh)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The source mesh. |
Returns
Type | Description |
---|---|
System.Int32[] | The number of vertices deleted as a result of the degenerate triangle cleanup. |
RemoveUnusedVertices(ProBuilderMesh)
Removes vertices that no face references.
Declaration
public static int[] RemoveUnusedVertices(this ProBuilderMesh mesh)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The source mesh. |
Returns
Type | Description |
---|---|
System.Int32[] | A list of deleted vertex indexes. |