From f2008d08da92142ce43265e0297e7092d611b369 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Sat, 2 May 2026 04:55:55 +0200 Subject: [PATCH] Test: Verify inclusion of foliage layers and masks in runtime scene --- tests/domain/build-runtime-scene.test.ts | 37 ++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/domain/build-runtime-scene.test.ts b/tests/domain/build-runtime-scene.test.ts index 7d4118d8..5f531995 100644 --- a/tests/domain/build-runtime-scene.test.ts +++ b/tests/domain/build-runtime-scene.test.ts @@ -1823,6 +1823,43 @@ describe("buildRuntimeSceneFromDocument", () => { expect(runtimeScene.sceneBounds?.max.y).toBe(2); }); + it("includes authored foliage layers, prototypes, and terrain masks for derived rendering", () => { + const bundledPrototype = BUNDLED_FOLIAGE_PROTOTYPES[0]!; + const layer = createFoliageLayer({ + id: "foliage-layer-runtime-build", + name: "Runtime Build Grass", + prototypeIds: [bundledPrototype.id] + }); + const terrain = createTerrain({ + id: "terrain-runtime-foliage", + sampleCountX: 2, + sampleCountZ: 2, + foliageMasks: { + [layer.id]: createTerrainFoliageMask({ + layerId: layer.id, + resolutionX: 2, + resolutionZ: 2, + values: [0, 1, 0.5, 0.25] + }) + } + }); + const runtimeScene = buildRuntimeSceneFromDocument({ + ...createEmptySceneDocument({ name: "Runtime Foliage Scene" }), + terrains: { + [terrain.id]: terrain + }, + foliageLayers: { + [layer.id]: layer + } + }); + + expect(runtimeScene.foliage.layers[layer.id]).toEqual(layer); + expect(runtimeScene.foliage.prototypes).toEqual({}); + expect(runtimeScene.foliage.terrains[0]?.foliageMasks[layer.id]).toEqual( + terrain.foliageMasks[layer.id] + ); + }); + it("adds static-simple imported-model colliders as compound box pieces", () => { const wallGeometry = new PlaneGeometry(4, 4, 4, 4); wallGeometry.rotateY(Math.PI * 0.5);