Skip to main content

MeshUtility

A internal static class in Root.Township, the global namespace. Reach it through att-stubs' publicized assemblies or Harmony's AccessTools.

Internal static helpers that bake many transformed copies of a mesh into one mesh. StorageOrganizer uses it for stacked items in storage.

Fields​

13 private and internal fields
MemberWhat it is
private static List<Color> colorsShared buffer for output colours.
private static Logger loggerNLog logger for this class.
private static List<Vector3> normalsShared buffer for output normals.
private static List<int> trianglesShared buffer for output triangles.
private static List<Vector4> uv2sShared buffer for output UV channel 3.
private static List<Vector4> uvsShared buffer for output UV channel 0.
private static List<Vector3> verticesShared buffer for output vertices.
private static List<Color> workingColorsScratch buffer for the input mesh's colours.
private static List<Vector3> workingNormalsScratch buffer for the input mesh's normals.
private static List<int> workingTrianglesScratch buffer for the input mesh's triangles.
private static List<Vector4> workingUV2sScratch buffer for the input mesh's UV channel 3.
private static List<Vector4> workingUVsScratch buffer for the input mesh's UV channel 0.
private static List<Vector3> workingVerticesScratch buffer for the input mesh's vertices.

Methods​

MemberWhat it is
static Mesh BakeCollisionMesh(Mesh mesh, Matrix4x4[] transforms, int copies)Returns a new mesh of copies transformed copies with positions and triangles only.
static Mesh BakeMesh(Mesh mesh, Matrix4x4[] transforms, int copies)Returns a new read-only mesh of copies transformed copies, with normals, colours and UVs.
static void BakeStaticMeshCount(ref Mesh output, Mesh input, Matrix4x4[] transforms, int copies)Grows or shrinks output in place so it holds copies copies of input, adding or trimming only the difference.
1 private and internal method
MemberWhat it is
private static void UpdateData(Mesh mesh)Loads a mesh's data into the working buffers. Nothing calls it.