Method Retriangulate
Retriangulate(Mesh, TriangulationSettings, Axis, Axis, UVMap, int, int, bool, bool, bool, bool, bool, bool)
Retriangulates mesh
in place using the provided settings
.
Declaration
public static void Retriangulate(this Mesh mesh, TriangulationSettings settings = null, Axis axisInput = Axis.XY, Axis axisOutput = Axis.XY, UVMap uvMap = UVMap.None, int uvChannelIndex = 0, int subMeshIndex = 0, bool generateInitialUVPlanarMap = false, bool recalculateBounds = true, bool recalculateNormals = true, bool recalculateTangents = true, bool insertTriangleMidPoints = false, bool insertEdgeMidPoints = false)
Parameters
Type | Name | Description |
---|---|---|
Mesh | mesh | The mesh to be retriangulated. |
TriangulationSettings | settings | The settings used during retriangulation. If null is provided,
the default settings with AutoHolesAndBoundaryenabled will be used.
Note: It is recommended to enable AutoHolesAndBoundary in |
Axis | axisInput | The axis from UnityEngine.Mesh.vertices to use for retriangulation, by default XY. |
Axis | axisOutput | The axis used to write the retriangulation result, by default XY. |
UVMap | uvMap | The UV mapping method for UV interpolation, by default None. |
int | uvChannelIndex | The UV channel index, in the range [0..7]. |
int | subMeshIndex | The sub-mesh to modify. |
bool | generateInitialUVPlanarMap | If true, an initial UV map is generated using Planar interpolation. |
bool | recalculateBounds | If true, recalculates the bounding volume of the Mesh and all of its sub-meshes with the vertex data. |
bool | recalculateNormals | If true, recalculates the normals of the Mesh from the triangles and vertices. |
bool | recalculateTangents | If true, recalculates the tangents of the Mesh from the normals and texture coordinates. |
bool | insertTriangleMidPoints | If true, additional points are inserted at the center of mass of the initial triangles before retriangulation. |
bool | insertEdgeMidPoints | If true, additional points are inserted at the center of the initial edges before retriangulation. |
Remarks
This method supports non-uniform meshes, including those with windmill-like connections between triangles.
It also provides limited UV interpolation (see uvMap
),
however, in complex cases, manual handling of UVs may be required after retriangulation.
Refer to the documentation for more details. Advanced customization is available through Utilities.RetriangulateMeshJob.
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown when the provided mesh does not have a Position vertex component. |
ArgumentException | Thrown when |
Exception | Thrown when retriangulation fails during the process. The exception should contain Status. |