Refactor terrain data handling and add comprehensive unit tests for brush, mesh, and serialization.

This commit is contained in:
2026-04-30 02:57:29 +02:00
parent ee7fcce1b3
commit 2b2cd81054
5 changed files with 92 additions and 3 deletions

View File

@@ -891,12 +891,12 @@ function buildRuntimeTerrain(
sampleCountX: terrain.sampleCountX,
sampleCountZ: terrain.sampleCountZ,
cellSize: terrain.cellSize,
heights: [...terrain.heights],
heights: terrain.heights,
layers: terrain.layers.map((layer) => ({
materialId: layer.materialId,
material: resolveRuntimeMaterial(document, layer.materialId)
})),
paintWeights: [...terrain.paintWeights]
paintWeights: terrain.paintWeights
};
}

View File

@@ -9701,7 +9701,7 @@ export class ViewportHost {
const committed =
this.terrainBrushCommitHandler?.({
terrain: cloneTerrain(finalPreviewTerrain),
terrain: finalPreviewTerrain,
commandLabel: getTerrainBrushCommandLabel(toolState.tool),
tool: toolState.tool
}) === true;