diff --git a/include/omath/mat.hpp b/include/omath/mat.hpp index 0ad81f1..1f1f086 100644 --- a/include/omath/mat.hpp +++ b/include/omath/mat.hpp @@ -479,6 +479,35 @@ namespace omath {0.f, 0.f, -(far + near) / (far - near), -(2.f * near * far) / (far - near)}, {0.f, 0.f, -1.f, 0.f}}; } + template + [[nodiscard]] + Mat<4, 4, Type, St> mat_ortho_left_handed(const Type left, const Type right, + const Type bottom, const Type top, + const Type near, const Type far) noexcept + { + return + { + { static_cast(2) / (right - left), 0.f, 0.f, -(right + left) / (right - left)}, + { 0.f, static_cast(2) / (top - bottom), 0.f, -(top + bottom) / (top - bottom)}, + { 0.f, 0.f, static_cast(2) / (far - near), -(far + near) / (far - near) }, + { 0.f, 0.f, 0.f, 1.f } + }; + } + template + [[nodiscard]] + Mat<4, 4, Type, St> mat_ortho_right_handed(const Type left, const Type right, + const Type bottom, const Type top, + const Type near, const Type far) noexcept + { + return + { + { static_cast(2) / (right - left), 0.f, 0.f, -(right + left) / (right - left)}, + { 0.f, static_cast(2) / (top - bottom), 0.f, -(top + bottom) / (top - bottom)}, + { 0.f, 0.f, -static_cast(2) / (far - near), -(far + near) / (far - near) }, + { 0.f, 0.f, 0.f, 1.f } + }; + } + } // namespace omath template