auto-git:

[add] src/rendering/terrain-layer-material.ts
 [add] tests/domain/terrains.test.ts
 [change] src/app/App.tsx
 [change] src/core/terrain-brush.ts
 [change] src/document/migrate-scene-document.ts
 [change] src/document/scene-document-validation.ts
 [change] src/document/scene-document.ts
 [change] src/document/terrains.ts
 [change] src/geometry/terrain-brush.ts
 [change] src/geometry/terrain-mesh.ts
 [change] src/runtime-three/rapier-collision-world.ts
 [change] src/runtime-three/runtime-host.ts
 [change] src/runtime-three/runtime-scene-build.ts
 [change] src/viewport-three/ViewportCanvas.tsx
 [change] src/viewport-three/ViewportPanel.tsx
 [change] src/viewport-three/viewport-host.ts
 [change] tests/domain/build-runtime-scene.test.ts
 [change] tests/domain/rapier-collision-world.test.ts
 [change] tests/domain/terrain.command.test.ts
 [change] tests/domain/water-material.test.ts
 [change] tests/geometry/terrain-brush.test.ts
 [change] tests/geometry/terrain-mesh.test.ts
 [change] tests/serialization/scene-document-json.test.ts
 [change] tests/unit/terrain-foundation.integration.test.tsx
 [change] tests/unit/viewport-canvas.test.tsx
This commit is contained in:
2026-04-20 02:36:38 +02:00
parent 02f6d058a0
commit 94dec56eb4
25 changed files with 2199 additions and 70 deletions

View File

@@ -428,4 +428,58 @@ describe("ViewportCanvas", () => {
screen.getByTestId("viewport-terrain-brush-preview-topLeft")
).toHaveTextContent("terrain · smooth");
});
it("shows the active terrain paint layer in the viewport overlay", () => {
const sceneDocument = createEmptySceneDocument();
const terrainBrushState: ArmedTerrainBrushState = {
terrainId: "terrain-selected",
tool: "paint",
layerIndex: 2,
radius: 2.5,
strength: 0.4,
falloff: 0.7
};
render(
<ViewportCanvas
panelId="topLeft"
world={sceneDocument.world}
sceneDocument={sceneDocument}
editorSimulationScene={null}
editorSimulationClock={null}
projectAssets={sceneDocument.assets}
loadedModelAssets={{}}
loadedImageAssets={{}}
whiteboxSelectionMode="object"
whiteboxSnapEnabled
whiteboxSnapStep={1}
viewportGridVisible={true}
selection={{ kind: "terrains", ids: [terrainBrushState.terrainId] }}
activeSelectionId={terrainBrushState.terrainId}
terrainBrushState={terrainBrushState}
toolMode="select"
toolPreview={{ kind: "none" }}
transformSession={createInactiveTransformSession()}
cameraState={createDefaultViewportPanelCameraState()}
viewMode="perspective"
displayMode="normal"
layoutMode="single"
isActivePanel
focusRequestId={0}
focusSelection={{ kind: "none" }}
onSelectionChange={vi.fn()}
onTerrainBrushCommit={vi.fn(() => true)}
onCommitCreation={vi.fn(() => true)}
onCameraStateChange={vi.fn()}
onToolPreviewChange={vi.fn()}
onTransformSessionChange={vi.fn()}
onTransformCommit={vi.fn()}
onTransformCancel={vi.fn()}
/>
);
expect(
screen.getByTestId("viewport-terrain-brush-preview-topLeft")
).toHaveTextContent("terrain · paint · layer 3");
});
});