Skip to main content

QuadTriangulationToolLogic

A static class in Root.Township, the global namespace.

Static mesh tool that turns a quad submesh into triangles, flipping quad splits that would face the wrong way. Probably editor or import tooling.

Methods​

MemberWhat it is
static bool CalculateChanges(Mesh meshToTriangulate, out int targetSubMesh, out int[] triangles)Finds the first quad submesh and fixes each quad's two triangles where they fold inward. Returns true if anything changed.
static void CheckFixTriangulation(Mesh mesh)Fixes and merges the quad submesh if needed, or just switches submesh 0 from quads to triangles.
static void MergeTriangulatedMesh(Mesh meshToTriangulate, int targetSubMesh, int[] triangles)Appends the new triangles to another submesh and removes the old quad submesh, or replaces it if there is no other.
1 private and internal method
MemberWhat it is
private static bool GetSafeBaseSubMesh(Mesh mesh, int targetSubMesh, out int baseSubMeshIndex)Picks another submesh to merge the triangles into. Returns false if there is only one.