summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorJonathan Bradley <jcb@pikum.xyz>2024-01-15 18:20:58 -0500
committerJonathan Bradley <jcb@pikum.xyz>2024-01-15 18:20:58 -0500
commitc30b1f9b2f5d231e98194db526560eb4e010edff (patch)
tree328825d5187f5f0b3ffd6754f8795f6a5947b8f7 /editor
parent05a6ca44e40da855a1ddc32cfe799edef74f7bdf (diff)
major refactor so cameras are entities and have a rigid body instance
Diffstat (limited to 'editor')
-rw-r--r--editor/editor.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/editor/editor.cpp b/editor/editor.cpp
index a081fb0..6ce8f76 100644
--- a/editor/editor.cpp
+++ b/editor/editor.cpp
@@ -681,9 +681,15 @@ void RecordImGuiCameras() {
return;
}
if (ImGui::Button("Create")) {
- auto &cam = PkeCamera_Register();
- cam.pos = ActiveCamera->pos;
- cam.rot = ActiveCamera->rot;
+ InstPos instPos{};
+ btVector3 pos;
+ btQuaternion quat;
+ GlmToBullet(ActiveCamera->pos, pos);
+ GlmToBullet(ActiveCamera->rot, quat);
+ instPos.mass = 1.f;
+ instPos.posRot.setOrigin(pos);
+ instPos.posRot.setRotation(quat);
+ auto &cam = PkeCamera_Register(instPos);
cam.target = ActiveCamera->target;
cam.type = ActiveCamera->type;
cam.orientation = ActiveCamera->orientation;
@@ -719,11 +725,15 @@ void RecordImGuiCameras() {
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
ImGui::BeginDisabled(selectedCamera == cam.handle);
- if (ImGui::Button("Select")) {
- selectedCamera = cam.handle;
+ if (ImGui::Button("Show")) {
+ selectedCamera = cam.camHandle;
ActiveCamera = const_cast<PkeCamera *>(&cam);
ActiveCamera->stale = PKE_CAMERA_STALE_ALL;
}
+ ImGui::SameLine();
+ if (ImGui::Button("Select")) {
+ selectedEntity = cam.phys.inst;
+ }
ImGui::EndDisabled();
ImGui::TableSetColumnIndex(1);
ImGui::Text("0x%016lX", cam.handle.hash);