Generalize terrain weight handling using stored paint weight count

This commit is contained in:
2026-05-13 00:44:35 +02:00
parent bbdef545fb
commit 27f76b4e69
2 changed files with 15 additions and 16 deletions

View File

@@ -6,9 +6,9 @@ import type {
} from "../core/terrain-brush";
import {
getOrCreateTerrainFoliageMask,
getTerrainStoredPaintWeightCount,
isTerrainFoliageMaskEmpty,
markTerrainRenderSamplesDirty,
TERRAIN_LAYER_COUNT,
updateTerrainBoundsCacheAfterHeightPatch,
type Terrain,
type TerrainSampleBounds
@@ -124,7 +124,9 @@ export function applyTerrainBrushPatchToDocument(
renderDirtyBounds = mergeTerrainSampleIndexIntoBounds(
renderDirtyBounds,
terrain,
Math.floor(entry.index / (TERRAIN_LAYER_COUNT - 1))
Math.floor(
entry.index / getTerrainStoredPaintWeightCount(terrain.layers.length)
)
);
}