summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/game.cpp b/src/game.cpp
index d95e43b..071a2b3 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -1,6 +1,7 @@
#include "game.hpp"
-#include "memory.hpp"
+
+#include "vendor/glm_include.hpp"
#include <cstring>
@@ -213,6 +214,10 @@ void Game_Tick(double delta) {
EntityHandle newEntity = ECS_CreateEntity();
ECS_CreateInstance(newEntity, createInfo.entityTypeEntityHandle);
}
+ static double accDelta = 0.0;
+ accDelta += delta;
+ UBO.model = glm::rotate(glm::mat4(1.0f), (float)accDelta * glm::radians(90.0f), glm::vec3(0.0f, 0.0f, 1.0f));
+ UBO.view = glm::lookAt(glm::vec3(4.0f, 4.0f, 4.0f), glm::vec3(0), glm::vec3(0.0f, 0.0f, 1.0f));
ECS_Tick_Late(delta);
}
@@ -439,8 +444,7 @@ void RecordImGui_CompGrBinds(bool readonly, CompGrBinds *component) {
ImGui::InputScalar("InstanceBindingCount", ImGuiDataType_U32, &component->instanceBindingCount, nullptr, nullptr, nullptr, inputTextFlags);
ImGui::InputScalar("InstanceOffsets", ImGuiDataType_U64, &component->instanceOffsets, nullptr, nullptr, nullptr, inputTextFlags);
- int64_t count = component->instances.Count();
- ImGui::InputScalar("Instance Count", ImGuiDataType_S64, &count, nullptr, nullptr, nullptr, ImGuiInputTextFlags_ReadOnly);
+ ImGui::InputScalar("Instance Count", ImGuiDataType_S64, &component->instanceCounter, nullptr, nullptr, nullptr, ImGuiInputTextFlags_ReadOnly);
ImGui::Spacing();
}
@@ -454,11 +458,15 @@ void RecordImGui_CompInstPos(bool readonly, CompInstance *component) {
ImGui::Text("CompInststance + InstPos");
ImGui::Separator();
- ImGui::InputScalar("Instance Index", ImGuiDataType_U64, &component->index, nullptr, nullptr, nullptr, ImGuiInputTextFlags_ReadOnly);
- if (component->ptr) {
- ImGui::InputScalarN("pos", ImGuiDataType_Float, &component->ptr->pos, 3, nullptr, nullptr, nullptr, inputTextFlags);
- ImGui::InputScalarN("rot", ImGuiDataType_Float, &component->ptr->rot, 3, nullptr, nullptr, nullptr, inputTextFlags);
- ImGui::InputScalarN("scale", ImGuiDataType_Float, &component->ptr->scale, 3, nullptr, nullptr, nullptr, inputTextFlags);
+ bool changed = false;
+
+ changed = ImGui::InputScalar("Instance Index", ImGuiDataType_U64, &component->index, nullptr, nullptr, nullptr, ImGuiInputTextFlags_ReadOnly) || changed;
+ changed = ImGui::InputScalarN("pos", ImGuiDataType_Float, &component->instPos.pos, 3, nullptr, nullptr, nullptr, inputTextFlags) || changed;
+ changed = ImGui::InputScalarN("rot", ImGuiDataType_Float, &component->instPos.rot, 4, nullptr, nullptr, nullptr, inputTextFlags) || changed;
+ changed = ImGui::InputScalarN("scale", ImGuiDataType_Float, &component->instPos.scale, 3, nullptr, nullptr, nullptr, inputTextFlags) || changed;
+
+ if (changed) {
+ ECS_UpdateInstance(component->entHandle, component->instPos);
}
ImGui::Spacing();