mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-06 00:53:52 +00:00
feat(editor): height offset tool for shifting entire terrain up/down
- Offset Heights: shifts all terrain heights by a constant amount (-100 to +100 range with Apply button) - Useful for raising terrain above water level or sinking below - Slider + Apply button in the Noise Generator section
This commit is contained in:
parent
d50e4b3f78
commit
5f9bf5c924
3 changed files with 22 additions and 0 deletions
|
|
@ -546,6 +546,13 @@ void EditorUI::renderBrushPanel(EditorApp& app) {
|
|||
app.getTerrainEditor().invertHeights();
|
||||
app.showToast("Heights inverted");
|
||||
}
|
||||
static float offsetAmt = 10.0f;
|
||||
ImGui::SliderFloat("Offset##ht", &offsetAmt, -100.0f, 100.0f, "%.0f");
|
||||
ImGui::SameLine();
|
||||
if (ImGui::SmallButton("Apply##off")) {
|
||||
app.getTerrainEditor().offsetHeights(offsetAmt);
|
||||
app.showToast("Heights offset");
|
||||
}
|
||||
ImGui::TextColored(ImVec4(0.6f, 0.6f, 0.6f, 1),
|
||||
"Scale: exaggerate (>1) or flatten (<1) relief");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -860,6 +860,18 @@ void TerrainEditor::createHill(const glm::vec3& center, float radius, float heig
|
|||
dirty_ = true;
|
||||
}
|
||||
|
||||
void TerrainEditor::offsetHeights(float amount) {
|
||||
if (!terrain_) return;
|
||||
for (int ci = 0; ci < 256; ci++) {
|
||||
auto& chunk = terrain_->chunks[ci];
|
||||
if (!chunk.hasHeightMap()) continue;
|
||||
for (int v = 0; v < 145; v++)
|
||||
chunk.heightMap.heights[v] += amount;
|
||||
dirtyChunks_.push_back(ci);
|
||||
}
|
||||
dirty_ = true;
|
||||
}
|
||||
|
||||
void TerrainEditor::invertHeights() {
|
||||
if (!terrain_) return;
|
||||
// Find midpoint
|
||||
|
|
|
|||
|
|
@ -108,6 +108,9 @@ public:
|
|||
// Invert terrain (flip heights around midpoint)
|
||||
void invertHeights();
|
||||
|
||||
// Offset all heights by a constant
|
||||
void offsetHeights(float amount);
|
||||
|
||||
// Fill entire tile with water at a height
|
||||
void fillWater(float height, uint16_t liquidType);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue