Class SurfaceTopology
Utilities for working with triangle and quad primitives.
Namespace: UnityEngine.ProBuilder.MeshOperations
Syntax
public static class SurfaceTopology
Methods
ConformNormals(ProBuilderMesh, IEnumerable<Face>)
Ensure that all adjacent face normals are pointing in a uniform direction. This function supports multiple islands of connected faces, but it may not unify each island the same way.
Declaration
public static ActionResult ConformNormals(this ProBuilderMesh mesh, IEnumerable<Face> faces)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The mesh that the faces belong to. |
IEnumerable<Face> | faces | The faces to make uniform. |
Returns
Type | Description |
---|---|
ActionResult | The state of the action. |
FlipEdge(ProBuilderMesh, Face)
Reverses the orientation of the middle edge in a quad.
. _____ _____
. |\ | | /|
. | \ | => | / |
. |____\| |/____|
Declaration
public static bool FlipEdge(this ProBuilderMesh mesh, Face face)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The mesh that face belongs to. |
Face | face | The target face. |
Returns
Type | Description |
---|---|
Boolean | True if successful, false if not. Operation will fail if face does not contain two triangles with exactly 2 shared vertices. |
GetWindingOrder(IList<Vector2>)
Return the winding order of a set of ordered points.
Declaration
public static WindingOrder GetWindingOrder(IList<Vector2> points)
Parameters
Type | Name | Description |
---|---|---|
IList<Vector2> | points | A path of points in 2d space. |
Returns
Type | Description |
---|---|
WindingOrder | The winding order if found, WindingOrder.Unknown if not. |
Remarks
GetWindingOrder(ProBuilderMesh, Face)
Attempt to extract the winding order for a face.
Declaration
public static WindingOrder GetWindingOrder(this ProBuilderMesh mesh, Face face)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The source mesh. |
Face | face | The face to test. |
Returns
Type | Description |
---|---|
WindingOrder | The winding order if successfull, unknown if not. |
ToTriangles(ProBuilderMesh, IList<Face>)
Convert a selection of faces from n-gons to triangles.
If a face is successfully converted to triangles, each new triangle is created as a separate face and the original face is deleted.
Declaration
public static Face[] ToTriangles(this ProBuilderMesh mesh, IList<Face> faces)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The target mesh. |
IList<Face> | faces | The faces to convert from quads to triangles. |
Returns
Type | Description |
---|---|
Face[] | Any new triangle faces created by breaking faces into individual triangles. |