Camera navigation in local and global space

CameraRotationDecomposition decomposeCameraRotationSurface made public in order to acces global and local camera rotations.

Co-Authored-By: Emil Wallberg <49481622+EmilWallberg@users.noreply.github.com>
This commit is contained in:
Wilhelm Björkström
2025-03-13 13:31:54 +01:00
parent 21d63150fc
commit e59f39e502
4 changed files with 34 additions and 26 deletions
+12 -12
View File
@@ -157,12 +157,23 @@ public:
*/
static scripting::LuaLibrary luaLibrary();
private:
struct CameraRotationDecomposition {
glm::dquat localRotation = glm::dquat(1.0, 0.0, 0.0, 0.0);
glm::dquat globalRotation = glm::dquat(1.0, 0.0, 0.0, 0.0);
};
/**
* Decomposes the camera's rotation in to a global and a local rotation defined by
* CameraRotationDecomposition. The global rotation defines the rotation so that the
* camera points towards the reference node in the direction opposite to the direction
* out from the surface of the object. The local rotation defines the differential
* from the global to the current total rotation so that
* `cameraRotation = globalRotation * localRotation`.
*/
CameraRotationDecomposition decomposeCameraRotationSurface(
const CameraPose& cameraPose, const SceneGraphNode& reference);
private:
using Displacement = std::pair<glm::dvec3, glm::dvec3>;
struct Friction : public properties::PropertyOwner {
@@ -270,17 +281,6 @@ private:
float _movementTimer = 0.f;
/**
* Decomposes the camera's rotation in to a global and a local rotation defined by
* CameraRotationDecomposition. The global rotation defines the rotation so that the
* camera points towards the reference node in the direction opposite to the direction
* out from the surface of the object. The local rotation defines the differential
* from the global to the current total rotation so that
* `cameraRotation = globalRotation * localRotation`.
*/
CameraRotationDecomposition decomposeCameraRotationSurface(
const CameraPose& cameraPose, const SceneGraphNode& reference);
/**
* Decomposes the camera's rotation in to a global and a local rotation defined by
* CameraRotationDecomposition. The global rotation defines the rotation so that the