Skip to main content

WoodcutTreeBakingHandler

A class in Root.Township, Alta.Woodcutting.

Static helpers that merge tree node meshes into combined LOD meshes and patch vertex colours in a baked mesh. Used by WoodcutTreeBaker.

Constructors​

MemberWhat it is
WoodcutTreeBakingHandler()Creates a WoodcutTreeBakingHandler with default values.

Fields​

10 private and internal fields
MemberWhat it is
private static List<Color> colorsShared colour list used while baking.
private static List<int>[] indicesShared index lists per LOD.
private static List<Vector3>[] normalsShared normal lists per LOD.
private static List<Color> sourceColorsShared colour list used while patching colours.
private static List<int> sourceIndicesScratch index list for one source mesh.
private static List<Vector3> sourceNormalsScratch normal list for one source mesh.
private static List<Vector2> sourceUvsScratch UV list for one source mesh.
private static List<Vector3> sourceVerticesScratch vertex list for one source mesh.
private static List<Vector2>[] uvsShared UV lists per LOD.
private static List<Vector3>[] verticesShared vertex lists per LOD.

Methods​

MemberWhat it is
static void Bake(Matrix4x4 originInverse, IEnumerable<WoodcutTree.MapNode> entries, WoodcutTreeBakerAccess<WoodcutTree.MapNode> access, MeshRenderer[] renderers, Mesh[] meshes)Merges each entry's LOD meshes into one mesh per LOD in the origin's local space, optionally copying adjusted vertex colours, and sets materials.
static void CreateMeshes(ref Mesh[] meshes, MeshFilter[] filters, int limit = -1)Creates the mesh array once, up to limit or one per filter, and assigns each mesh to its filter.
static void FinishModifyColors(Mesh damagedLod)Writes the edited colour list back to the mesh.
static void ModifyColors(Mesh damagedLod, ColorModelCore<NullColorModelPoint, NullColorModelPoint, NullColorModelPoint, WoodcutPointData> core, int offset)Writes one node's colours into the colour list starting at its vertex offset.
static void StartModifyColors(Mesh damagedLod)Loads the mesh's colours into the shared list, padded to the vertex count.