From b25f7fa4bf92e37710f0d18c2fd92ff27f1ddd5b Mon Sep 17 00:00:00 2001 From: Kelsi Date: Tue, 5 May 2026 05:56:49 -0700 Subject: [PATCH] fix(editor): add M2 render diagnostics to Info panel for NPC debugging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Info panel now shows M2 renderer stats: model count, instance count, draw call count — visible in real-time to diagnose NPC rendering issues - When placing NPCs: if models=0/instances=0, the model failed to load If models>0 but draws=0, it's a culling/frame-sync issue If draws>0, the model IS rendering but may be too small to see --- tools/editor/editor_app.hpp | 1 + tools/editor/editor_ui.cpp | 7 +++++++ tools/editor/editor_viewport.hpp | 1 + 3 files changed, 9 insertions(+) diff --git a/tools/editor/editor_app.hpp b/tools/editor/editor_app.hpp index 9cf06874..bb98e40d 100644 --- a/tools/editor/editor_app.hpp +++ b/tools/editor/editor_app.hpp @@ -49,6 +49,7 @@ public: NpcPresets& getNpcPresets() { return npcPresets_; } AssetBrowser& getAssetBrowser() { return assetBrowser_; } rendering::TerrainRenderer* getTerrainRenderer(); + rendering::M2Renderer* getM2Renderer() { return viewport_.getM2Renderer(); } pipeline::AssetManager* getAssetManager() { return assetManager_.get(); } const std::string& getLoadedMap() const { return loadedMap_; } diff --git a/tools/editor/editor_ui.cpp b/tools/editor/editor_ui.cpp index 49b18823..c5e8daa9 100644 --- a/tools/editor/editor_ui.cpp +++ b/tools/editor/editor_ui.cpp @@ -1221,6 +1221,13 @@ void EditorUI::renderPropertiesPanel(EditorApp& app) { if (holeChunks > 0) ImGui::Text("Hole chunks: %d", holeChunks); } + // M2 render diagnostics + if (auto* m2r = app.getM2Renderer()) { + ImGui::Text("M2: %u models, %u instances, %u draws", + m2r->getModelCount(), m2r->getInstanceCount(), + m2r->getDrawCallCount()); + } + ImGui::Separator(); auto pos = app.getEditorCamera().getCamera().getPosition(); ImGui::Text("Camera: %.0f, %.0f, %.0f", pos.x, pos.y, pos.z); diff --git a/tools/editor/editor_viewport.hpp b/tools/editor/editor_viewport.hpp index b1e1546f..0c649334 100644 --- a/tools/editor/editor_viewport.hpp +++ b/tools/editor/editor_viewport.hpp @@ -61,6 +61,7 @@ public: glm::vec3 getLightDir() const { return lightDir_; } rendering::TerrainRenderer* getTerrainRenderer() { return terrainRenderer_.get(); } + rendering::M2Renderer* getM2Renderer() { return m2Renderer_.get(); } private: bool createPerFrameResources();