mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-06 00:53:52 +00:00
fix(editor): NPC markers always on top, mesa generator, terrain tools
- NPC markers now render with NO depth test (via gizmo pipeline) so they're always visible even on sloped/rough terrain - Mesa/Plateau generator: creates raised flat areas with steep cliff edges — configurable radius, height, and edge steepness - NPC markers drawn after gizmo in the render pipeline to guarantee they appear on top of everything - Fixes NPC visibility on non-flat terrain
This commit is contained in:
parent
1502c2ed85
commit
88416bbb1d
4 changed files with 64 additions and 15 deletions
|
|
@ -805,6 +805,41 @@ void TerrainEditor::createCrater(const glm::vec3& center, float radius, float de
|
|||
dirty_ = true;
|
||||
}
|
||||
|
||||
void TerrainEditor::createMesa(const glm::vec3& center, float radius, float height, float edgeSteepness) {
|
||||
if (!terrain_) return;
|
||||
|
||||
for (int ci = 0; ci < 256; ci++) {
|
||||
auto& chunk = terrain_->chunks[ci];
|
||||
if (!chunk.hasHeightMap()) continue;
|
||||
bool modified = false;
|
||||
|
||||
for (int v = 0; v < 145; v++) {
|
||||
glm::vec3 pos = chunkVertexWorldPos(ci, v);
|
||||
float dist = glm::length(glm::vec2(pos.x - center.x, pos.y - center.y));
|
||||
if (dist > radius * 1.5f) continue;
|
||||
|
||||
float t = dist / radius;
|
||||
float blend;
|
||||
if (t < 0.7f) {
|
||||
blend = 1.0f; // flat top
|
||||
} else if (t < 1.0f) {
|
||||
float edgeT = (t - 0.7f) / 0.3f;
|
||||
blend = 1.0f - std::pow(edgeT, 1.0f / std::max(0.1f, edgeSteepness));
|
||||
} else {
|
||||
blend = 0.0f;
|
||||
}
|
||||
|
||||
chunk.heightMap.heights[v] += height * blend;
|
||||
modified = true;
|
||||
}
|
||||
if (modified) {
|
||||
stitchEdges(ci);
|
||||
dirtyChunks_.push_back(ci);
|
||||
}
|
||||
}
|
||||
dirty_ = true;
|
||||
}
|
||||
|
||||
void TerrainEditor::flattenRoad(const glm::vec3& start, const glm::vec3& end, float width) {
|
||||
if (!terrain_) return;
|
||||
glm::vec2 lineStart(start.x, start.y);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue