HatchitMath
ht_matrix4.h
1 
29 #pragma once
30 
31 #define _USE_MATH_DEFINES
32 
33 #include <ht_platform.h>
34 #include <ht_vector3.h>
35 #include <ht_vector4.h>
36 #include <cmath>
37 
38 namespace Hatchit
39 {
40  namespace Math
41  {
42  class Matrix3;
43 
44  class HT_API Matrix4
45  {
46  friend class Quaternion;
47 
48  public:
49  //Statics
58  static Matrix4 GetOrthographicProjection(float left, float right, float bottom, float top, float _near, float _far);
66  static Matrix4 GetPerspectiveProjection(float fov, float aspect, float _near, float _far);
73  static Matrix4 GetLookAtView(Vector3 lookAt, Vector3 center, Vector3 up);
74 
75  //Constructors
77  Matrix4();
79  Matrix4(float rawArray[]);
81  Matrix4(float xx, float xy, float xz, float xw,
82  float yx, float yy, float yz, float yw,
83  float zx, float zy, float zz, float zw,
84  float wx, float wy, float wz, float ww);
102  Matrix4(Vector4 a, Vector4 b, Vector4 c, Vector4 d);
103 
108  static Matrix4 Transpose(const Matrix4& mat);
109 
110 
115  static Matrix4 Inverse(const Matrix4& mat);
116 
117 
118 
119  //Accessors
125  const float* const getAsArray() const;
126 
127  //Operators
133  Matrix4 operator* (Matrix4 mat);
139  Vector3 operator* (Vector3 vec);
145  Vector4 operator* (Vector4 vec);
153  operator Matrix3();
154 
155  public:
156  union
157  {
158  __m128 m_rows[4];
159  struct
160  {
161  float xx, xy, xz, xw,
162  yx, yy, yz, yw,
163  zx, zy, zz, zw,
164  wx, wy, wz, ww;
165  };
166  float data[16];
167  };
168  };
169 
170 
175  HT_API std::ostream& operator<< (std::ostream& output, Matrix4& h);
180  HT_API std::istream& operator>> (std::istream& input, Matrix4& h);
181  }
182 }
Hatchit Engine Copyright(c) 2015 Third-Degree.
Hatchit Engine Copyright(c) 2015 Third-Degree.
Hatchit Engine Copyright(c) 2015-2016 Third-Degree.
Definition: ht_intrin.h:33
Hatchit Engine Copyright(c) 2015 Third-Degree.
Hatchit Engine Copyright(c) 2015 Third-Degree.
Hatchit Engine Copyright(c) 2015 Third-Degree.