Worldmaker Implementations

Overview

Two concrete implementations of UCAbstractWorldmaker are provided. Both follow the same pipeline but differ in the mesh component type used for rendering.

UCWorldmaker_ProceduralMesh

Uses UProceduralMeshComponent for tile rendering. Vertices, triangles, normals, UVs and vertex colors are computed manually and passed to CreateMeshSection_LinearColor.

Name Description
isFirstStart Returns true if proceduralMeshComponentMap is empty
cleanPmc Clears mesh sections, unregisters and destroys the component
calculatePoint Computes LOD, vertex count, vertex positions, triangles, normals, UVs and vertex colors for a tile
createPMC_sync Creates UProceduralMeshComponent instances, calls CreateMeshSection_LinearColor, applies material and collision
debug Swaps material to debug material on all components
// UCWorldmaker_ProceduralMesh builds mesh data arrays manually:
// - Vertices with Z from innerZCalculate
// - Triangles as quad indices
// - Normals via cross product (if calculateNormal is true)
// - UVs mapped to tile local space
// - Vertex colors from innerZCalculate

// Set worldMakerClass to UCWorldmaker_ProceduralMesh in FCWorldMakerStruct.

UCWorldmaker_DynamicMesh

Uses UDynamicMeshComponent (Geometry Script) for tile rendering. Leverages UGeometryScriptLibrary to append a rectangle primitive, then edits vertices in-place via EditMesh with ParallelFor.

Name Description
isFirstStart Returns true if dynamicMeshComponentMap is empty
cleanPmc Resets the dynamic mesh, unregisters and destroys the component
calculatePoint Computes LOD, vertex count, cell size and transform for a tile
createPMC_sync Creates UCdryxDynamicMeshComponent instances, appends rectangle, edits vertices in parallel, recomputes normals
debug Swaps material to debug material on all components
// UCWorldmaker_DynamicMesh uses Geometry Script functions:
// 1. AppendRectangleXY to create the base grid
// 2. EditMesh with ParallelFor to set Z and vertex colors per vertex
// 3. RecomputeNormals for correct lighting
// 4. FNavigationSystem::UpdateComponentData for navmesh support

// Set worldMakerClass to UCWorldmaker_DynamicMesh in FCWorldMakerStruct.

Comparison

Aspect ProceduralMesh DynamicMesh
Component type UProceduralMeshComponent UDynamicMeshComponent
Mesh construction Manual arrays (vertices, triangles, normals, UVs) Geometry Script primitives + in-place edit
Normal computation Manual cross product per quad RecomputeNormals (Geometry Script)
Navigation update Automatic Requires explicit FNavigationSystem::UpdateComponentData
Dependencies ProceduralMeshComponent module GeometryFramework, GeometryCore, GeometryScriptingCore modules