feat(editor): voronoi cell noise for organic terrain patterns

- Voronoi noise generator: creates cell-like terrain patterns with
  ridge features at cell boundaries (F2-F1 distance field)
- Configurable cell count (5-100) and amplitude
- Toggle between Value noise and Voronoi in the noise generator section
- Creates interesting mesa/plateau formations and organic shapes
- Random cell centers with per-cell height variation
This commit is contained in:
Kelsi 2026-05-05 07:59:10 -07:00
parent e65fc7caa2
commit b113c218bd
3 changed files with 59 additions and 1 deletions

View file

@ -505,7 +505,22 @@ void EditorUI::renderBrushPanel(EditorApp& app) {
ImGui::InputInt("Seed", &noiseSeed);
ImGui::SameLine();
if (ImGui::SmallButton("Random##seed")) noiseSeed = static_cast<int>(std::rand());
if (ImGui::Button("Apply Noise", ImVec2(140, 0))) {
static int noiseType = 0;
ImGui::RadioButton("Value##nt", &noiseType, 0);
ImGui::SameLine();
ImGui::RadioButton("Voronoi##nt", &noiseType, 1);
if (noiseType == 1) {
static int voronoiCells = 20;
ImGui::SliderInt("Cells##vor", &voronoiCells, 5, 100);
if (ImGui::Button("Apply Voronoi", ImVec2(-1, 0))) {
app.getTerrainEditor().applyVoronoiNoise(voronoiCells, noiseAmp,
static_cast<uint32_t>(noiseSeed));
app.showToast("Voronoi noise applied");
}
}
if (noiseType == 0 && ImGui::Button("Apply Noise", ImVec2(140, 0))) {
app.getTerrainEditor().applyNoise(noiseFreq, noiseAmp, noiseOctaves,
static_cast<uint32_t>(noiseSeed));
app.showToast("Noise applied");