Skip to main content

LODBaker.MeshBase

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

Mesh builder used by LODBaker.Bake. Collects the meshes that share one material into one combined mesh with its own renderer.

Constructors​

MemberWhat it is
MeshBase()Creates a LODBaker.MeshBase with default values.

Fields​

16 private and internal fields
MemberWhat it is
private List<Color> colorsCombined vertex colours.
private bool needsColorSet when any added mesh had vertex colours.
private bool needsUVSet when any added mesh had UV channel 0.
private bool needsUV2Set when any added mesh had UV channel 1.
private bool needsUV4Set when any added mesh had UV channel 3.
private List<Vector3> normalsCombined normals.
private List<int> trianglesCombined triangle indices, offset for each added mesh.
private List<Vector4> uv2sCombined UV channel 1.
private List<Vector4> uv4sCombined UV channel 3.
private List<Vector4> uvsCombined UV channel 0.
private List<Vector3> verticesCombined vertices.
private static List<Color> workingColorsShared scratch list for reading colours.
private static List<int> workingIntShared scratch list for reading triangles.
private static List<Vector3> workingNormalsShared scratch list for reading normals.
private static List<Vector4> workingUVShared scratch list for reading UVs.
private static List<Vector3> workingVerticesShared scratch list for reading vertices.

Methods​

MemberWhat it is
void AddMesh(Mesh mesh, Matrix4x4 convertion)Appends a mesh transformed by a matrix: vertices, normals, UV channels 0, 1 and 3, colours and triangles.
Renderer GetRenderer(Material material)Builds the combined mesh and returns a MeshRenderer for it on a new GameObject with the given material.
1 private and internal method
MemberWhat it is
private void AddRange<T>(List<T> source, List<T> destination, int count, ref bool need)Copies a channel's data, or pads it with defaults when the mesh lacks it, and flags the channel as used if present.