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:
Kelsi 2026-05-05 06:55:04 -07:00
parent 1502c2ed85
commit 88416bbb1d
4 changed files with 64 additions and 15 deletions

View file

@ -442,21 +442,7 @@ void EditorViewport::render(VkCommandBuffer cmd) {
waterRenderer_.render(cmd, perFrameSet);
// NPC position markers (always visible)
if (npcMarkerVB_ && npcMarkerVertCount_ > 0) {
auto* wp = waterRenderer_.getPipeline();
auto* wl = waterRenderer_.getPipelineLayout();
static bool loggedOnce = false;
if (!loggedOnce) { loggedOnce = true; LOG_INFO("NPC render: vb=", (wp?"ok":"null"), " layout=", (wl?"ok":"null"), " verts=", npcMarkerVertCount_); }
if (wp && wl) {
vkCmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, wp);
vkCmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, wl,
0, 1, &perFrameSet, 0, nullptr);
VkDeviceSize off = 0;
vkCmdBindVertexBuffers(cmd, 0, 1, &npcMarkerVB_, &off);
vkCmdDraw(cmd, npcMarkerVertCount_, 1, 0, 0);
}
}
// NPC position markers — render AFTER gizmo (no depth test = always on top)
// Brush indicator circle
if (brushVisible_ && brushVB_ && brushVertCount_ > 0) {
@ -480,6 +466,18 @@ void EditorViewport::render(VkCommandBuffer cmd) {
}
gizmo_.render(cmd, perFrameSet);
// NPC markers rendered last with no depth test (always on top via gizmo pipeline)
if (npcMarkerVB_ && npcMarkerVertCount_ > 0) {
// Gizmo pipeline has depthTestEnable=VK_FALSE — markers always visible
auto& gizmoPL = gizmo_;
// Re-bind gizmo pipeline (same vertex format, no depth test)
// gizmo_.render already set it up, just draw our buffer
VkDeviceSize off = 0;
vkCmdBindVertexBuffers(cmd, 0, 1, &npcMarkerVB_, &off);
vkCmdDraw(cmd, npcMarkerVertCount_, 1, 0, 0);
(void)gizmoPL;
}
}
void EditorViewport::setWireframe(bool enabled) {