From 4ea4bbfcb03091cb987dc151d41980ec16f3d18d Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 8 Apr 2019 22:31:12 +0800 Subject: *misc --- source/modules/asura-utils/math/matrix44.cpp | 7 +++++++ source/modules/asura-utils/math/matrix44.h | 2 ++ source/modules/asura-utils/math/rect.hpp | 2 ++ source/modules/asura-utils/math/rect.inl | 9 +++++++++ source/modules/asura-utils/math/vector2.hpp | 2 ++ 5 files changed, 22 insertions(+) (limited to 'source/modules/asura-utils/math') diff --git a/source/modules/asura-utils/math/matrix44.cpp b/source/modules/asura-utils/math/matrix44.cpp index a1dc933..4472cd8 100644 --- a/source/modules/asura-utils/math/matrix44.cpp +++ b/source/modules/asura-utils/math/matrix44.cpp @@ -185,6 +185,13 @@ namespace AsuraEngine this->operator *=(t); } + void Matrix44::Ortho(float left, float right, float bottom, float top, float near, float far) + { + Matrix44 t; + t.SetOrtho(left, right, bottom, top, near, far); + this->operator *=(t); + } + // | x | // | y | // | 0 | diff --git a/source/modules/asura-utils/math/matrix44.h b/source/modules/asura-utils/math/matrix44.h index 9ff0288..addee98 100644 --- a/source/modules/asura-utils/math/matrix44.h +++ b/source/modules/asura-utils/math/matrix44.h @@ -61,6 +61,8 @@ namespace AsuraEngine /// void Shear(float kx, float ky); + void Ortho(float left, float right, float bottom, float top, float near, float far); + ///// ///// Transforms an array of vertices by this Matrix44. The sources and ///// destination arrays may be the same. diff --git a/source/modules/asura-utils/math/rect.hpp b/source/modules/asura-utils/math/rect.hpp index 15981c2..010a5db 100644 --- a/source/modules/asura-utils/math/rect.hpp +++ b/source/modules/asura-utils/math/rect.hpp @@ -29,6 +29,8 @@ namespace AsuraEngine /// static bool Intersect(const Rect& src1, const Rect& src2, Rect& intersection); + void Set(T x, T y, T w, T h); + T x, y, w, h; }; diff --git a/source/modules/asura-utils/math/rect.inl b/source/modules/asura-utils/math/rect.inl index 891a3f8..efafbf9 100644 --- a/source/modules/asura-utils/math/rect.inl +++ b/source/modules/asura-utils/math/rect.inl @@ -17,3 +17,12 @@ inline Rect::Rect(T X, T Y, T W, T H) { } + +template +void Rect::Set(T X, T Y, T W, T H) +{ + x = X; + y = Y; + w = W; + h = H; +} \ No newline at end of file diff --git a/source/modules/asura-utils/math/vector2.hpp b/source/modules/asura-utils/math/vector2.hpp index 4baf132..e18bbdf 100644 --- a/source/modules/asura-utils/math/vector2.hpp +++ b/source/modules/asura-utils/math/vector2.hpp @@ -67,4 +67,6 @@ namespace AsuraEngine } } +namespace AEMath = AsuraEngine::Math; + #endif \ No newline at end of file -- cgit v1.1-26-g67d0