mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 07:03:25 +00:00
fixed unity view matrix building
This commit is contained in:
@@ -27,7 +27,7 @@ namespace omath::unity_engine
|
|||||||
}
|
}
|
||||||
Mat4x4 CalcViewMatrix(const ViewAngles& angles, const Vector3<float>& cam_origin)
|
Mat4x4 CalcViewMatrix(const ViewAngles& angles, const Vector3<float>& cam_origin)
|
||||||
{
|
{
|
||||||
return MatCameraView<float, MatStoreType::ROW_MAJOR>(ForwardVector(angles), RightVector(angles),
|
return MatCameraView<float, MatStoreType::ROW_MAJOR>(ForwardVector(angles), -RightVector(angles),
|
||||||
UpVector(angles), cam_origin);
|
UpVector(angles), cam_origin);
|
||||||
}
|
}
|
||||||
Mat4x4 CalcPerspectiveProjectionMatrix(const float fieldOfView, const float aspectRatio, const float near,
|
Mat4x4 CalcPerspectiveProjectionMatrix(const float fieldOfView, const float aspectRatio, const float near,
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ TEST(UnitTestUnityEngine, Project)
|
|||||||
constexpr auto fov = omath::projection::FieldOfView::FromDegrees(60.f);
|
constexpr auto fov = omath::projection::FieldOfView::FromDegrees(60.f);
|
||||||
|
|
||||||
const auto cam = omath::unity_engine::Camera({0, 0, 0}, {}, {1280.f, 720.f}, fov, 0.03f, 1000.f);
|
const auto cam = omath::unity_engine::Camera({0, 0, 0}, {}, {1280.f, 720.f}, fov, 0.03f, 1000.f);
|
||||||
const auto proj = cam.WorldToScreen({0.f, 2.f, 10.f});
|
const auto proj = cam.WorldToScreen({5.f, 3, 10.f});
|
||||||
|
std::println("{} {}", proj->x, proj->y);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(UnitTestUnityEngine, CameraSetAndGetFov)
|
TEST(UnitTestUnityEngine, CameraSetAndGetFov)
|
||||||
|
|||||||
Reference in New Issue
Block a user