feat(editor): visualize patrol path of selected NPC as ribbon with waypoints

Adds setPatrolPath() that draws a multi-segment orange ribbon between the
NPC's spawn position and each waypoint, plus diamond markers at each point
(green for start = NPC home, white for waypoints). Renders only while the
NPC is selected and has a patrol path defined.
This commit is contained in:
Kelsi 2026-05-06 00:58:30 -07:00
parent 191ff9ec16
commit eb8f5a09b1
3 changed files with 109 additions and 0 deletions

View file

@ -133,6 +133,18 @@ void EditorApp::run() {
gizmo.setMode(TransformMode::None);
}
// Patrol path visualization for the selected NPC
if (auto* selNpc = npcSpawner_.getSelected();
selNpc && !selNpc->patrolPath.empty()) {
std::vector<glm::vec3> pts;
pts.reserve(selNpc->patrolPath.size() + 1);
pts.push_back(selNpc->position);
for (const auto& wp : selNpc->patrolPath) pts.push_back(wp.position);
viewport_.setPatrolPath(pts);
} else {
viewport_.clearPatrolPath();
}
uint32_t imageIndex = 0;
VkCommandBuffer cmd = vkCtx->beginFrame(imageIndex);
if (cmd == VK_NULL_HANDLE) continue;