feat(editor): river tool now fills water along the carved path

The river path tool used to carve the channel and texture the banks
but never added a water layer — users had to manually run
"Fill Water" afterward, which floods the entire tile. The fix is a
new TerrainEditor::fillWaterAlongPath() method that adds water
layers only to chunks the river segment passes through (within
width + chunk-half-diagonal of the line).

Per-chunk water height is set to the chunk's post-carve minimum
terrain height + 0.5y offset so the water sits visibly in the
channel without overflowing onto banks.

The river apply path now invokes carveRiver → paintAlongPath →
fillWaterAlongPath in sequence. Toast updated to mention all three.

Multi-point rivers are still next on the list — the underlying
math takes a single segment today, so a polyline river needs a UI
revamp to capture N points + a per-segment loop. Ack'd, not done
this commit.
This commit is contained in:
Kelsi 2026-05-07 10:17:36 -07:00
parent ecba93d4a4
commit 158ab192f0
3 changed files with 84 additions and 1 deletions

View file

@ -127,6 +127,14 @@ public:
// Fill entire tile with water at a height
void fillWater(float height, uint16_t liquidType);
// Add a water layer only to chunks the line segment passes through
// (within `width`). Used by the river tool so rivers actually fill
// with water without flooding the rest of the tile. Per-chunk water
// height is computed from the post-carve terrain so the water sits
// in the carved channel.
void fillWaterAlongPath(const glm::vec3& start, const glm::vec3& end,
float width, uint16_t liquidType);
// Smooth terrain near water level to create natural beaches
void smoothBeaches(float waterHeight, float beachWidth);