diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2023-10-10 15:15:12 -0400 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2023-10-10 15:15:12 -0400 |
| commit | 41fd38a7d7300f33319b36db2df917d0cc4e9000 (patch) | |
| tree | e3934ad4cd227e80bba34ae500ab7689a16f27d7 /src | |
| parent | f872f6b0f27401804e51e7ddbccf680aba8d535e (diff) | |
Add imgui debug menu with option to toggle debug wireframes
Diffstat (limited to 'src')
| -rw-r--r-- | src/game.cpp | 5 | ||||
| -rw-r--r-- | src/game.hpp | 1 | ||||
| -rw-r--r-- | src/static/cube.cpp | 12 | ||||
| -rw-r--r-- | src/window.cpp | 9 |
4 files changed, 20 insertions, 7 deletions
diff --git a/src/game.cpp b/src/game.cpp index 0738984..8e9aad5 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1,6 +1,7 @@ #include "game.hpp" +#include "imgui.h" #include "vendor/glm_include.hpp" #include "game-settings.hpp" @@ -380,6 +381,10 @@ void RecordImGuiEditorWrapper() { } ImGui::EndMenu(); } + if (ImGui::BeginMenu("Debug")) { + ImGui::Checkbox("Show Debug Hitboxes", &pkeSettings.isRenderingDebug); + ImGui::EndMenu(); + } ImGui::EndMainMenuBar(); } diff --git a/src/game.hpp b/src/game.hpp index 69b916c..17662e8 100644 --- a/src/game.hpp +++ b/src/game.hpp @@ -10,7 +10,6 @@ #include "entities.hpp" #include "event.hpp" #include "helpers.hpp" -#include "imgui.h" #include "memory.hpp" #include "window.hpp" diff --git a/src/static/cube.cpp b/src/static/cube.cpp index 92c6274..2d9e6d7 100644 --- a/src/static/cube.cpp +++ b/src/static/cube.cpp @@ -24,13 +24,13 @@ IntrinsicShapeCube pkeIntrinsicsCube { }, .uv = { {0, 0}, + {0, 1}, + {1, 0}, + {1, 1}, {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, + {0, 1}, + {1, 0}, + {1, 1}, }, .index = { 0, 1, 2, diff --git a/src/window.cpp b/src/window.cpp index d124c21..49d0b05 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -2190,6 +2190,15 @@ void RecordCommandBuffer(VkCommandBuffer commandBuffer, uint32_t imageIndex) { vkCmdDrawIndexed(commandBuffer, binder->indexCount, binder->instanceCounter, 0, 0, 0); if (pkeSettings.isRenderingDebug) { + vkCmdBindPipeline(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pkePipelines.pipelines.TextureWireframe); + vkCmdBindDescriptorSets(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pkePipelines.vkPipelineLayout_Texture, 0, 1, &pkeDebugHitbox.vkDescriptorSets[imageIndex], 0, {}); + vkCmdBindIndexBuffer(commandBuffer, pkeDebugHitbox.indexBuffer, 0, VK_INDEX_TYPE_UINT16); + + vkCmdBindVertexBuffers(commandBuffer, 0, 1, &pkeDebugHitbox.vertexBuffer, offsets); + vkCmdBindVertexBuffers(commandBuffer, 1, 1, &pkeDebugHitbox.normalsBuffer, offsets); + vkCmdBindVertexBuffers(commandBuffer, 2, 1, &pkeDebugHitbox.uvBuffer, offsets); + + vkCmdDrawIndexed(commandBuffer, 36, binder->instanceCounter, 0, 0, 0); } } } |
