Class MeshValidation
Methods for validating and fixing mesh topology.
Inherited Members
Namespace: UnityEngine.ProBuilder.MeshOperations
Syntax
public static class MeshValidation
Methods
ContainsDegenerateTriangles(ProBuilderMesh)
Returns whether any face on a mesh contains degenerate triangles.
Declaration
public static bool ContainsDegenerateTriangles(this ProBuilderMesh mesh)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The mesh to test for degenerate triangles. |
Returns
Type | Description |
---|---|
Boolean | True if any face contains a degenerate triangle, false if no degenerate triangles are found. |
See Also
ContainsDegenerateTriangles(ProBuilderMesh, IList<Face>)
Returns whether any of the specified faces contains degenerate triangles.
Declaration
public static bool ContainsDegenerateTriangles(this ProBuilderMesh mesh, IList<Face> faces)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The mesh to test for degenerate triangles. |
IList<Face> | faces | The faces to test for degenerate triangles. |
Returns
Type | Description |
---|---|
Boolean | True if any face contains a degenerate triangle, false if no degenerate triangles are found. |
See Also
ContainsDegenerateTriangles(ProBuilderMesh, Face)
Returns whether the specified face contains degenerate triangles.
Declaration
public static bool ContainsDegenerateTriangles(this ProBuilderMesh mesh, Face face)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The mesh to test for degenerate triangles. |
Face | face | The face to test for degenerate triangles. |
Returns
Type | Description |
---|---|
Boolean | True if any triangle within the face contains a degenerate triangle, false if no degenerate triangles are found. |
See Also
ContainsNonContiguousTriangles(ProBuilderMesh, Face)
Checks whether any triangles in a face are disconnected (non-contiguous).
Declaration
public static bool ContainsNonContiguousTriangles(this ProBuilderMesh mesh, Face face)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The mesh that owns the face to test. |
Face | face | The face to test. |
Returns
Type | Description |
---|---|
Boolean | True if the face contains split triangles; false if the face is contiguous. |
EnsureFacesAreComposedOfContiguousTriangles(ProBuilderMesh, IEnumerable<Face>)
Ensures that each face in the specified set is composed of contiguous triangle sets. If a face contains any non-contiguous triangles, this method splits them into as many faces as necessary to ensure that each group of adjacent triangles compose a single face.
Declaration
public static List<Face> EnsureFacesAreComposedOfContiguousTriangles(this ProBuilderMesh mesh, IEnumerable<Face> faces)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The mesh that contains the faces to test. |
System.Collections.Generic.IEnumerable<Face> | faces | The faces to test for non-contiguous triangles. |
Returns
Type | Description |
---|---|
List<Face> | A list of any newly created faces as a result of splitting non-contiguous triangles. Returns an empty list if no faces required fixing. |
RemoveDegenerateTriangles(ProBuilderMesh, List<Int32>)
Iterates through all faces in a mesh and removes any triangles with an area less than float.Epsilon
, or with
indices that point to the same vertex. This function also enforces the rule that a face must contain no
coincident vertices.
Declaration
public static bool RemoveDegenerateTriangles(ProBuilderMesh mesh, List<int> removed = null)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The source mesh. |
List<Int32> | removed | An optional list to be populated with the removed indices. If no degenerate triangles are found, this list contains no elements. |
Returns
Type | Description |
---|---|
Boolean | True if degenerate triangles were found and removed; false if no degenerate triangles were found. |
RemoveUnusedVertices(ProBuilderMesh, List<Int32>)
Removes vertices that no face references.
Declaration
public static bool RemoveUnusedVertices(ProBuilderMesh mesh, List<int> removed = null)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The source mesh. |
List<Int32> | removed | An optional list to be populated with the removed indices. If no vertices are removed, this list contains no elements. |
Returns
Type | Description |
---|---|
Boolean | A list of deleted vertex indices. |