fix: double crater carve on aliased maps when the curve is off (terrain-water task 10)
The pass-2c restructure carved sequentially through both map references; with TerrainCurve off the classify map aliases the height map, so the second Lerp re-carved already-carved cells — a deeper bowl and shifted crater-adjacent water/biomes on curve-off runs only. Caught by the task-10 continuity oracle (md5 vs the batch-08 curve-off baseline); curve-on runs were unaffected (separate arrays, oracle 24/24). Both values are now read before either write. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
822c1530c3
commit
1b98fb5a17
1 changed files with 7 additions and 2 deletions
|
|
@ -540,8 +540,13 @@ public partial class MapGenerator : TextureRect
|
||||||
float craterDepth = 1.0f - (distToCrater / physicalCraterRadius);
|
float craterDepth = 1.0f - (distToCrater / physicalCraterRadius);
|
||||||
// Dialed back to -0.15f as per your excellent instinct!
|
// Dialed back to -0.15f as per your excellent instinct!
|
||||||
float carveTarget = GetSeaLevel(_tempMap[x, y]) - 0.15f;
|
float carveTarget = GetSeaLevel(_tempMap[x, y]) - 0.15f;
|
||||||
_heightMapClassify[x, y] = Mathf.Lerp(_heightMapClassify[x, y], carveTarget, craterDepth * 0.9f);
|
// Read BOTH before writing EITHER: with the curve off the two maps
|
||||||
_heightMap[x, y] = Mathf.Lerp(_heightMap[x, y], carveTarget, craterDepth * 0.9f);
|
// alias the same array, and a sequential read-modify-write carved
|
||||||
|
// the crater twice (caught by the task-10 continuity oracle).
|
||||||
|
float preClassify = _heightMapClassify[x, y];
|
||||||
|
float preCurved = _heightMap[x, y];
|
||||||
|
_heightMapClassify[x, y] = Mathf.Lerp(preClassify, carveTarget, craterDepth * 0.9f);
|
||||||
|
_heightMap[x, y] = Mathf.Lerp(preCurved, carveTarget, craterDepth * 0.9f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue