summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Bradley <jcb@pikum.xyz>2023-09-29 07:45:21 -0400
committerJonathan Bradley <jcb@pikum.xyz>2023-09-29 07:45:21 -0400
commit43d2c5580767b1ee74cb23d64353799d03c72b49 (patch)
treec3af5ebaf0a1d8f222c4b533f7a5742a93734d14
parent43f3dc16cc9e43c459814249089c79f22eefa7dc (diff)
UBO imgui window
-rw-r--r--src/game.cpp25
-rw-r--r--src/game.hpp1
2 files changed, 26 insertions, 0 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 5885e64..98e9336 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -216,6 +216,16 @@ void Game_Tick(double delta) {
ECS_Tick_Late(delta);
}
+void RecordImGui_GLM(glm::mat4 &mat) {
+ float min = -1;
+ float max = 1;
+ for (long i = 0; i < 4; ++i) {
+ ImGui::PushID(i);
+ ImGui::SliderFloat4("##mat4", &mat[i][0], min, max, "%.3f", ImGuiSliderFlags_NoRoundToFormat);
+ ImGui::PopID();
+ }
+}
+
void RecordImGuiEditorWrapper() {
ImGui::DockSpaceOverViewport(nullptr, ImGuiDockNodeFlags_PassthruCentralNode);
ImGui::BeginMainMenuBar();
@@ -311,6 +321,20 @@ void RecordImGuiEntityList() {
ImGui::End();
}
+void RecordImGuiUBO() {
+ if (!ImGui::Begin("UBO", &pkeSettings.editorSettings.isShowingUBO)) {
+ ImGui::End();
+ return;
+ }
+ ImGui::Text("Model");
+ RecordImGui_GLM(UBO.model);
+ ImGui::Text("View");
+ RecordImGui_GLM(UBO.view);
+ ImGui::Text("Proj");
+ RecordImGui_GLM(UBO.proj);
+ ImGui::End();
+}
+
void RecordImGuiModalCreateEntityType() {
if (ImGui::BeginPopupModal("CreateEntityType", nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
static bool needsReset = true;
@@ -478,6 +502,7 @@ void RecordImGuiEditor() {
RecordImGuiConsole();
RecordImGuiEntityList();
RecordImGuiSceneEditor();
+ RecordImGuiUBO();
}
}
diff --git a/src/game.hpp b/src/game.hpp
index 8e2cfaf..f66ad69 100644
--- a/src/game.hpp
+++ b/src/game.hpp
@@ -32,6 +32,7 @@ struct GameSettings {
bool isShowingConsole = true;
bool isShowingEntityList = true;
bool isShowingSceneEditor = true;
+ bool isShowingUBO = true;
} editorSettings;
};