From 04a5535ade2af9920040da6cf97c70c8ef258a5c Mon Sep 17 00:00:00 2001 From: Orange Date: Sun, 1 Dec 2024 22:02:16 +0300 Subject: [PATCH] added multiply factor for source engine matrix --- include/omath/engines/source.hpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/include/omath/engines/source.hpp b/include/omath/engines/source.hpp index 669a531..0aa6e7b 100644 --- a/include/omath/engines/source.hpp +++ b/include/omath/engines/source.hpp @@ -49,15 +49,17 @@ namespace omath::source } template - requires std::is_floating_point_v || std::is_integral_v + requires std::is_arithmetic_v && std::is_signed_v [[nodiscard]] Mat<4, 4, Type, MatStoreType::ROW_MAJOR> PerspectiveProjectionMatrix(const Type& fieldOfView, const Type& aspectRatio, const Type& near, const Type& far) { - const float fovHalfTan = std::tan(angles::DegreesToRadians(fieldOfView) / 2); + constexpr auto kMultiplyFactor = Type(0.75); + + const float fovHalfTan = std::tan(angles::DegreesToRadians(fieldOfView) / 2) * kMultiplyFactor; return { - {static_cast(1) / (aspectRatio * fovHalfTan), 0, 0, 0}, - {0, static_cast(1) / (fovHalfTan), 0, 0}, + {-static_cast(1) / (aspectRatio * fovHalfTan), 0, 0, 0}, + {0, -static_cast(1) / (fovHalfTan), 0, 0}, {0, 0, (far + near) / (far - near), -(static_cast(2) * far * near) / (far - near)}, {0, 0, 1, 0}, };