feat(editor): terrain stamp/clone tool for replicating terrain features

- Copy Stamp: captures all vertex heights within brush radius at cursor
  position, storing relative offsets from center
- Paste Stamp: applies the copied height pattern at a new location,
  finding nearest vertices and setting their heights
- Stamp status shown in panel ("Stamp ready" / "No stamp copied")
- Auto-stitches chunk edges after paste for seamless results
- Useful for replicating hills, craters, or other terrain features
This commit is contained in:
Kelsi 2026-05-05 06:15:33 -07:00
parent 9a547f66d2
commit 1ba1a50112
3 changed files with 81 additions and 0 deletions

View file

@ -452,6 +452,21 @@ void EditorUI::renderBrushPanel(EditorApp& app) {
"Exaggerate (>1) or flatten (<1) terrain relief");
}
ImGui::Separator();
if (ImGui::CollapsingHeader("Stamp / Clone")) {
auto& brush2 = app.getTerrainEditor().brush();
if (ImGui::Button("Copy Stamp", ImVec2(120, 0)) && brush2.isActive())
app.getTerrainEditor().copyStamp(brush2.getPosition(), s.radius);
ImGui::SameLine();
if (ImGui::Button("Paste Stamp", ImVec2(120, 0)) && brush2.isActive() &&
app.getTerrainEditor().hasStamp())
app.getTerrainEditor().pasteStamp(brush2.getPosition());
if (app.getTerrainEditor().hasStamp())
ImGui::TextColored(ImVec4(0.5f, 0.9f, 0.5f, 1), "Stamp ready");
else
ImGui::TextColored(ImVec4(0.6f, 0.6f, 0.6f, 1), "No stamp copied");
}
ImGui::Separator();
ImGui::Text("Terrain Holes (cave entrances):");
auto& brush = app.getTerrainEditor().brush();