fix: remove scene view orbit roll
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include <XCEngine/Components/TransformComponent.h>
|
#include <XCEngine/Components/TransformComponent.h>
|
||||||
#include <XCEngine/Core/Math/Math.h>
|
#include <XCEngine/Core/Math/Math.h>
|
||||||
|
#include <XCEngine/Core/Math/Quaternion.h>
|
||||||
#include <XCEngine/Core/Math/Vector3.h>
|
#include <XCEngine/Core/Math/Vector3.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@@ -94,7 +95,10 @@ public:
|
|||||||
|
|
||||||
void ApplyTo(Components::TransformComponent& transform) const {
|
void ApplyTo(Components::TransformComponent& transform) const {
|
||||||
transform.SetPosition(GetPosition());
|
transform.SetPosition(GetPosition());
|
||||||
transform.LookAt(m_focalPoint);
|
transform.SetRotation(Math::Quaternion::FromEulerAngles(
|
||||||
|
-m_pitchDegrees * Math::DEG_TO_RAD,
|
||||||
|
m_yawDegrees * Math::DEG_TO_RAD,
|
||||||
|
0.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -34,8 +34,11 @@ TEST(SceneViewportCameraController_Test, ApplyToMatchesComputedPositionAndForwar
|
|||||||
controller.ApplyTo(*cameraObject.GetTransform());
|
controller.ApplyTo(*cameraObject.GetTransform());
|
||||||
|
|
||||||
EXPECT_TRUE(NearlyEqual(cameraObject.GetTransform()->GetPosition(), controller.GetPosition()));
|
EXPECT_TRUE(NearlyEqual(cameraObject.GetTransform()->GetPosition(), controller.GetPosition()));
|
||||||
const Vector3 localFocus = cameraObject.GetTransform()->InverseTransformPoint(controller.GetFocalPoint());
|
EXPECT_TRUE(NearlyEqual(
|
||||||
EXPECT_GT(localFocus.z, 0.0f);
|
cameraObject.GetTransform()->GetForward().Normalized(),
|
||||||
|
controller.GetForward(),
|
||||||
|
1e-3f));
|
||||||
|
EXPECT_GT(Vector3::Dot(cameraObject.GetTransform()->GetUp().Normalized(), Vector3::Up()), 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(SceneViewportCameraController_Test, ApplyInputUpdatesOrbitPanAndZoomState) {
|
TEST(SceneViewportCameraController_Test, ApplyInputUpdatesOrbitPanAndZoomState) {
|
||||||
|
|||||||
Reference in New Issue
Block a user