Class AppendElements
Functions for appending elements to meshes.
Inheritance
Namespace: UnityEngine.ProBuilder.MeshOperations
Syntax
public static class AppendElements
Methods
AppendFaces(ProBuilderMesh, Vector3[][], Color[][], Vector2[][], Face[], Int32[][])
Append a group of new faces to the mesh. Significantly faster than calling AppendFace multiple times.
Declaration
public static Face[] AppendFaces(this ProBuilderMesh mesh, Vector3[][] positions, Color[][] colors, Vector2[][] uvs, Face[] faces, int[][] shared)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The source mesh to append new faces to. |
Vector3[][] | positions | An array of position arrays, where indexes correspond to the appendedFaces parameter. |
Color[][] | colors | An array of colors arrays, where indexes correspond to the appendedFaces parameter. |
Vector2[][] | uvs | An array of uvs arrays, where indexes correspond to the appendedFaces parameter. |
Face[] | faces | An array of faces arrays, which contain the triangle winding information for each new face. Face index values are 0 indexed. |
System.Int32[][] | shared | An optional mapping of each new vertex's common index. Common index refers to a triangle's index in the @"UnityEngine.ProBuilder.ProBuilderMesh.sharedIndexes" array. If this value is provided, it must contain entries for each vertex position. Ex, if there are 4 vertices in this face, there must be shared index entries for { 0, 1, 2, 3 }. |
Returns
Type | Description |
---|---|
Face[] | An array of the new faces that where successfully appended to the mesh. |
AppendVerticesToEdge(ProBuilderMesh, IList<Edge>, Int32)
Insert a number of new points to each edge. Points are evenly spaced out along the edge.
Declaration
public static List<Edge> AppendVerticesToEdge(this ProBuilderMesh mesh, IList<Edge> edges, int count)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The source mesh. |
System.Collections.Generic.IList<Edge> | edges | The edges to split with points. |
System.Int32 | count | The number of new points to insert. Must be greater than 0. |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<Edge> | The new edges created by inserting points. |
AppendVerticesToEdge(ProBuilderMesh, Edge, Int32)
Insert a number of new points to an edge. Points are evenly spaced out along the edge.
Declaration
public static List<Edge> AppendVerticesToEdge(this ProBuilderMesh mesh, Edge edge, int count)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The source mesh. |
Edge | edge | The edge to split with points. |
System.Int32 | count | The number of new points to insert. Must be greater than 0. |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<Edge> | The new edges created by inserting points. |
AppendVerticesToFace(ProBuilderMesh, Face, Vector3[])
Add a set of points to a face and retriangulate. Points are added to the nearest edge.
Declaration
public static Face AppendVerticesToFace(this ProBuilderMesh mesh, Face face, Vector3[] points)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The source mesh. |
Face | face | The face to append points to. |
Vector3[] | points | Points to added to the face. |
Returns
Type | Description |
---|---|
Face | The face created by appending the points. |
Bridge(ProBuilderMesh, Edge, Edge, Boolean)
Insert a face between two edges.
Declaration
public static Face Bridge(this ProBuilderMesh mesh, Edge a, Edge b, bool allowNonManifoldGeometry = false)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The source mesh. |
Edge | a | First edge. |
Edge | b | Second edge |
System.Boolean | allowNonManifoldGeometry | If true, this function will allow edges to be bridged that create overlapping (non-manifold) faces. |
Returns
Type | Description |
---|---|
Face | The new face, or null of the action failed. |
CreatePolygon(ProBuilderMesh, IList<Int32>, Boolean)
Create a new face connecting existing vertices.
Declaration
public static Face CreatePolygon(this ProBuilderMesh mesh, IList<int> indexes, bool unordered)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The source mesh. |
System.Collections.Generic.IList<System.Int32> | indexes | The indexes of the vertices to join with the new polygon. |
System.Boolean | unordered | Are the indexes in an ordered path (false), or not (true)? If indexes are not ordered this function will treat the polygon as a convex shape. Ordered paths will be triangulated allowing concave shapes. |
Returns
Type | Description |
---|---|
Face | The new face created if the action was successfull, null if action failed. |
CreateShapeFromPolygon(ProBuilderMesh, IList<Vector3>, Single, Boolean)
Rebuild a mesh from an ordered set of points.
Declaration
public static ActionResult CreateShapeFromPolygon(this ProBuilderMesh mesh, IList<Vector3> points, float extrude, bool flipNormals)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The target mesh. The mesh values will be cleared and repopulated with the shape extruded from points. |
System.Collections.Generic.IList<Vector3> | points | A path of points to triangulate and extrude. |
System.Single | extrude | The distance to extrude. |
System.Boolean | flipNormals | If true the faces will be inverted at creation. |
Returns
Type | Description |
---|---|
ActionResult | An ActionResult with the status of the operation. |
DuplicateAndFlip(ProBuilderMesh, Face[])
Duplicate and reverse the winding direction for each face.
Declaration
public static void DuplicateAndFlip(this ProBuilderMesh mesh, Face[] faces)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The target mesh. |
Face[] | faces | The faces to duplicate, reverse triangle winding order, and append to mesh. |