auto-git:

[change] tests/geometry/terrain-brush.test.ts
This commit is contained in:
2026-05-01 17:57:28 +02:00
parent f9041c531a
commit 8cf4b561a2

View File

@@ -144,12 +144,14 @@ describe("terrain brush geometry", () => {
minSampleZ: 2, minSampleZ: 2,
maxSampleZ: 2 maxSampleZ: 2
}); });
expect(result.heightSampleIndices).toEqual([12]);
expect(result.paintWeightIndices).toEqual([]);
expect(terrain.heights).toBe(originalHeights); expect(terrain.heights).toBe(originalHeights);
expect(terrain.paintWeights).toBe(originalPaintWeights); expect(terrain.paintWeights).toBe(originalPaintWeights);
expect(terrain.heights[2 + 2 * 5]).toBeCloseTo(0.5); expect(terrain.heights[2 + 2 * 5]).toBeCloseTo(0.5);
}); });
it("creates sparse terrain brush patches from dirty sample bounds", () => { it("creates sparse terrain brush patches from exact changed indices", () => {
const before = createTerrain({ const before = createTerrain({
id: "terrain-sparse-patch", id: "terrain-sparse-patch",
position: { x: 0, y: 0, z: 0 }, position: { x: 0, y: 0, z: 0 },
@@ -167,12 +169,8 @@ describe("terrain brush geometry", () => {
const patch = createTerrainBrushPatchFromTerrains({ const patch = createTerrainBrushPatchFromTerrains({
before, before,
after, after,
dirtyBounds: { heightSampleIndices: [5, 15, 5],
minSampleX: 1, paintWeightIndices: [45]
maxSampleX: 1,
minSampleZ: 1,
maxSampleZ: 1
}
}); });
expect(patch.heightSamples).toEqual([ expect(patch.heightSamples).toEqual([
@@ -180,9 +178,20 @@ describe("terrain brush geometry", () => {
index: 5, index: 5,
before: 0, before: 0,
after: 2 after: 2
},
{
index: 15,
before: 0,
after: 9
}
]);
expect(patch.paintWeights).toEqual([
{
index: 45,
before: 0,
after: 0.4
} }
]); ]);
expect(patch.paintWeights).toEqual([]);
}); });
it("paints terrain layer weights toward the active layer while preserving a normalized blend", () => { it("paints terrain layer weights toward the active layer while preserving a normalized blend", () => {