feat(editor): height clamp tool for controlled terrain range

- Clamp Heights: sets min/max height bounds across entire tile
  (DragFloatRange2 slider for min/max, -500 to 2000 range)
- Useful workflow: Generate noise → Smooth → Clamp to desired range
- Prevents terrain from going underground or too high
- All affected chunks marked dirty for mesh regeneration
This commit is contained in:
Kelsi 2026-05-05 05:51:03 -07:00
parent c93a997424
commit d59d69b0c5
3 changed files with 32 additions and 1 deletions

View file

@ -392,8 +392,15 @@ void EditorUI::renderBrushPanel(EditorApp& app) {
app.getTerrainEditor().smoothEntireTile(smoothPasses);
app.showToast("Tile smoothed");
}
ImGui::Separator();
static float clampMin = 0.0f, clampMax = 500.0f;
ImGui::DragFloatRange2("Clamp Range", &clampMin, &clampMax, 1.0f, -500.0f, 2000.0f);
if (ImGui::Button("Clamp Heights", ImVec2(-1, 0))) {
app.getTerrainEditor().clampHeights(clampMin, clampMax);
app.showToast("Heights clamped");
}
ImGui::TextColored(ImVec4(0.6f, 0.6f, 0.6f, 1),
"Generate terrain, then smooth for natural look");
"Generate, smooth, then clamp for controlled range");
}
ImGui::Separator();