summaryrefslogtreecommitdiff
path: root/Source/modules/asura-base/Math/Matrix44.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-08-07 21:08:47 +0800
committerchai <chaifix@163.com>2019-08-07 21:08:47 +0800
commit0c391fdbce5a079cf03e483eb6174dd47806163d (patch)
treeb06cd7a9d0ae0d9bb9e82f3dcb786dfce11f8628 /Source/modules/asura-base/Math/Matrix44.h
parent9686368e58e25cbd6dc37d686bdd2be3f80486d6 (diff)
*misc
Diffstat (limited to 'Source/modules/asura-base/Math/Matrix44.h')
-rw-r--r--Source/modules/asura-base/Math/Matrix44.h96
1 files changed, 96 insertions, 0 deletions
diff --git a/Source/modules/asura-base/Math/Matrix44.h b/Source/modules/asura-base/Math/Matrix44.h
new file mode 100644
index 0000000..e987dd4
--- /dev/null
+++ b/Source/modules/asura-base/Math/Matrix44.h
@@ -0,0 +1,96 @@
+#ifndef _ASURA_MATRIX_H_
+#define _ASURA_MATRIX_H_
+
+#include <asura-base/Classes.h>
+
+#include "../Scripting/Scripting.h"
+
+namespace_begin(AsuraEngine)
+namespace_begin(Math)
+
+/// ҪתõOpenGLglm::mat4
+/// https://blog.csdn.net/candycat1992/article/details/8830894
+class Matrix44
+{
+public:
+
+ static const Matrix44 Identity;
+
+ Matrix44();
+
+ Matrix44(const Matrix44& m);
+
+ ~Matrix44();
+
+ void operator = (const Matrix44& m);
+
+ void SetOrtho(float _left, float _right, float _bottom, float _top, float _near, float _far);
+
+ Matrix44 operator * (const Matrix44 & m) const;
+
+ void operator *= (const Matrix44 & m);
+
+ const float* GetElements() const;
+
+ void SetIdentity();
+
+ void SetTranslation(float x, float y);
+
+ void SetRotation(float r);
+
+ void SetScale(float sx, float sy);
+
+ void SetShear(float kx, float ky);
+
+ void SetTransformation(float x, float y, float angle, float sx, float sy, float ox, float oy);
+
+ void Translate(float x, float y);
+
+ void Rotate(float r);
+
+ void Scale(float sx, float sy);
+
+ void Transform(float x, float y, float angle, float sx, float sy, float ox, float oy);
+
+ ///
+ /// Multiplies this Matrix44 with a shear transformation.
+ /// @param kx Shear along the x-axis.
+ /// @param ky Shear along the y-axis.
+ ///
+ 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.
+ /////
+ ///// @param dst Storage for the transformed vertices.
+ ///// @param src The source vertices.
+ ///// @param size The number of vertices.
+ /////
+ //void transform(Graphics::Vertex* dst, const Graphics::Vertex * src, int size) const;
+
+ ///
+ /// ʽ
+ ///
+ float Calculate();
+
+private:
+
+ ///
+ /// | e0 e4 e8 e12 |
+ /// | e1 e5 e9 e13 |
+ /// | e2 e6 e10 e14 |
+ /// | e3 e7 e11 e15 |
+ ///
+ float e[16];
+
+};
+
+namespace_end
+namespace_end
+
+namespace AEMath = AsuraEngine::Math;
+
+#endif \ No newline at end of file