diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2025-01-13 11:20:26 -0500 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2025-01-13 11:20:26 -0500 |
| commit | 28f25f4c82ef7e712bc0c22f9ccb054efa584275 (patch) | |
| tree | ba228083b5ce8fac780c92378b40418635bc1e3c | |
| parent | cd08d8490bde91c36a6c7a60a27bed0bd0e2e033 (diff) | |
pke: save full handle, editor: rotate camera
| -rw-r--r-- | editor/editor.cpp | 3 | ||||
| -rw-r--r-- | src/game.cpp | 12 |
2 files changed, 9 insertions, 6 deletions
diff --git a/editor/editor.cpp b/editor/editor.cpp index af45fda..024e855 100644 --- a/editor/editor.cpp +++ b/editor/editor.cpp @@ -418,8 +418,11 @@ void PkeEditor_Tick(double delta) { double axis4 = -(rotCCCount * delta) + (rotCCount * delta); if (axis4 != 0.0) { glm::quat gRot; + btQuaternion bRot; BulletToGlm(trfm.getRotation(), gRot); gRot = glm::quat(glm::vec3(0.f, 0.f, axis4)) * gRot; + GlmToBullet(gRot, bRot); + trfm.setRotation(bRot); NullCamera.stale = NullCamera.stale | PKE_CAMERA_STALE_ROT; } diff --git a/src/game.cpp b/src/game.cpp index 1a95a79..220aebd 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -74,7 +74,7 @@ const char *PKE_FILE_CAMERA_TARGET_INSTANCE_HANDLE = "Cam::TargetInstanceHandle: const char *PKE_FILE_CAMERA_IS_PRIMARY = "Cam::IsPrimary: "; void SerializeCamera(std::ostringstream &stream, const PkeCamera &cam) { - NULL_CHAR_ARR(handleStr, 22); + NULL_CHAR_ARR(handleStr, 23); PkeCamera c{}; if (cam.type != c.type) { stream << PKE_FILE_CAMERA_TYPE << int(static_cast<PkeCameraType_T>(cam.type)) << std::endl; @@ -83,11 +83,11 @@ void SerializeCamera(std::ostringstream &stream, const PkeCamera &cam) { stream << PKE_FILE_CAMERA_ORIENTATION << int(static_cast<PkeCameraView_T>(cam.view)) << std::endl; } if (cam.phys.inst != c.phys.inst && cam.phys.inst != CAFE_BABE(CompInstance)) { - snprintf(handleStr, 21, "0x%08X 0x%08X", cam.phys.inst->instanceHandle.bucketIndex, cam.phys.inst->instanceHandle.itemIndex); + snprintf(handleStr, 22, "0x%08X 0x%08X", cam.phys.inst->instanceHandle.bucketIndex, cam.phys.inst->instanceHandle.itemIndex); stream << PKE_FILE_CAMERA_INSTANCE_HANDLE << handleStr << std::endl; } if (cam.phys.targetInst != c.phys.targetInst && cam.phys.targetInst != CAFE_BABE(CompInstance)) { - snprintf(handleStr, 21, "0x%08X 0x%08X", cam.phys.targetInst->instanceHandle.bucketIndex, cam.phys.targetInst->instanceHandle.itemIndex); + snprintf(handleStr, 22, "0x%08X 0x%08X", cam.phys.targetInst->instanceHandle.bucketIndex, cam.phys.targetInst->instanceHandle.itemIndex); stream << PKE_FILE_CAMERA_TARGET_INSTANCE_HANDLE << handleStr << std::endl; } if (cam.isPrimary != c.isPrimary) { @@ -96,7 +96,7 @@ void SerializeCamera(std::ostringstream &stream, const PkeCamera &cam) { } void SerializeInstance(std::ostringstream &stream, const CompInstance &comp) { - NULL_CHAR_ARR(handleStr, 22); + NULL_CHAR_ARR(handleStr, 23); EntityType *et = nullptr; if (comp.grBindsHandle != GrBindsHandle_MAX) { et = EntityType_FindByEntityHandle(ECS_GetGrBinds(comp.grBindsHandle)->entHandle); @@ -108,11 +108,11 @@ void SerializeInstance(std::ostringstream &stream, const CompInstance &comp) { baseInst.scale = btVector3(1, 1, 1); baseInst.mass = 1; if (comp.entHandle != c.entHandle) { - snprintf(handleStr, 21, "0x%08X 0x%08X", comp.entHandle.bucketIndex, comp.entHandle.itemIndex); + snprintf(handleStr, 22, "0x%08X 0x%08X", comp.entHandle.bucketIndex, comp.entHandle.itemIndex); stream << PKE_FILE_INSTANCE_ENTITY_HANDLE << handleStr << std::endl; } if (comp.entHandle != c.entHandle) { - snprintf(handleStr, 21, "0x%08X 0x%08X", comp.instanceHandle.bucketIndex, comp.instanceHandle.itemIndex); + snprintf(handleStr, 22, "0x%08X 0x%08X", comp.instanceHandle.bucketIndex, comp.instanceHandle.itemIndex); stream << PKE_FILE_INSTANCE_HANDLE << handleStr << std::endl; } if (et != nullptr) { |
