22 #include <ht_intrin.h> 23 #include <ht_malloc.h> 32 #pragma warning(disable : 4251) 36 #define _MM_CALLCONV __vectorcall 38 #else //Linux and MAC OSX 42 #define HT_API __attribute__((__visibility__("default"))) 47 #define __forceinline __attribute__((always_inline)) 60 constexpr
float Pi = 3.1415926535897932384626433832795f;
61 constexpr
float HalfPi = Pi * .5f;
62 constexpr
float QuarterPi = Pi * .25f;
63 constexpr
float TwoPi = Pi * 2.0f;
83 Float2(
float _x,
float _y) : x(_x), y(_y) {}
84 explicit Float2(
const float *pArray) : x(pArray[0]), y(pArray[1]) {}
102 Float3(
float _x,
float _y,
float _z) : x(_x), y(_y), z(_z) {}
103 explicit Float3(
const float *pArray) : x(pArray[0]), y(pArray[1]), z(pArray[2]) {}
121 Float4(
float _x,
float _y,
float _z,
float _w) : x(_x), y(_y), z(_z), w(_w){}
122 explicit Float4(
const float *pArray) : x(pArray[0]), y(pArray[1]), z(pArray[2]), w(pArray[3]) {}
131 float xx, xy, xz, xw;
132 float yx, yy, yz, yw;
133 float zx, zy, zz, zw;
134 float wx, wy, wz, ww;
140 Float16(
float _xx,
float _xy,
float _xz,
float _xw,
141 float _yx,
float _yy,
float _yz,
float _yw,
142 float _zx,
float _zy,
float _zz,
float _zw,
143 float _wx,
float _wy,
float _wz,
float _ww)
144 : xx(_xx), xy(_xy), xz(_xz), xw(_xw),
145 yx(_yx), yy(_yy), yz(_yz), yw(_yw),
146 zx(_zx), zy(_zy), zz(_zz), zw(_zw),
147 wx(_wx), wy(_wy), wz(_wz), ww(_ww) {}
149 explicit Float16(
const float* _array)
151 memcpy(m_data, _array,
sizeof(
float) * 16);
163 Matrix4(
const float rawArray[]);
164 Matrix4(
float xx,
float xy,
float xz,
float xw,
165 float yx,
float yy,
float yz,
float yw,
166 float zx,
float zy,
float zz,
float zw,
167 float wx,
float wy,
float wz,
float ww);
179 float* operator[] (
int row);
189 float xx, xy, xz, xw,
197 std::ostream& operator<< (std::ostream& output,
Matrix4& h);
210 Vector2(
const float rawArray[]);
214 explicit Vector2(
const __m128& vector);
215 explicit Vector2(__m128&& vector);
220 void*
operator new(
size_t _size);
221 void operator delete(
void* p);
222 void*
operator new[](
size_t size);
223 void operator delete[](
void* p);
229 explicit operator __m128(
void)
const;
230 Vector2 operator+ (
float s)
const;
231 Vector2 operator- (
float s)
const;
232 Vector2 operator* (
float s)
const;
233 Vector2 operator/ (
float s)
const;
247 bool operator== (
const Vector2& u)
const;
248 bool operator!= (
const Vector2& u)
const;
249 const float& operator[] (
size_t i)
const;
250 float& operator[] (
size_t i);
255 float MagnitudeSquared()
const;
256 float Magnitude()
const;
274 std::ostream& operator<< (std::ostream& output,
const Vector2& v);
289 Vector3(
const float rawArray[]);
292 Vector3(
float x,
float y,
float z);
298 void*
operator new(
size_t _size);
299 void operator delete(
void* p);
305 explicit operator const __m128(
void)
const;
306 Vector3 operator+ (
float s)
const;
307 Vector3 operator- (
float s)
const;
308 Vector3 operator* (
float s)
const;
309 Vector3 operator/ (
float s)
const;
323 bool operator== (
const Vector3& u)
const;
324 bool operator!= (
const Vector3& u)
const;
325 const float& operator[] (
int i)
const;
326 float& operator[] (
int i);
333 float MagnitudeSquared()
const;
334 float Magnitude()
const;
352 std::ostream& operator<< (std::ostream& output,
Vector3& h);
367 Vector4(
const float rawArray[]);
369 Vector4(
float x,
float y,
float z,
float w);
378 void*
operator new(
size_t _size);
379 void operator delete(
void* p);
385 explicit operator __m128(
void)
const;
386 Vector4 operator+ (
float s)
const;
387 Vector4 operator- (
float s)
const;
388 Vector4 operator* (
float s)
const;
389 Vector4 operator/ (
float s)
const;
396 bool operator== (
const Vector4& u)
const;
397 bool operator!= (
const Vector4& u)
const;
409 float& operator[] (
size_t i);
410 const float& operator[] (
size_t i)
const;
420 float Magnitude()
const;
421 float MagnitudeSqr()
const;
436 std::ostream& operator<< (std::ostream& output,
Vector4& h);
453 Quaternion(
float x,
float y,
float z,
float w);
454 Quaternion(
float roll,
float pitch,
float yaw);
461 void*
operator new(
size_t _size);
462 void operator delete(
void* p);
463 void*
operator new[](
size_t size);
464 void operator delete[](
void* p);
470 bool operator== (
const Quaternion& p_rhs)
const;
471 bool operator!= (
const Quaternion& p_rhs)
const;
481 explicit operator __m128()
const;
502 __m128 _MM_CALLCONV MMVectorZero();
503 __m128 _MM_CALLCONV MMVectorSet(
float x,
float y,
float z,
float w);
504 __m128 _MM_CALLCONV MMVectorSetInt(uint32_t x, uint32_t y, uint32_t z, uint32_t w);
506 float _MM_CALLCONV MMVectorGetX(__m128 v);
507 float _MM_CALLCONV MMVectorGetY(__m128 v);
508 float _MM_CALLCONV MMVectorGetZ(__m128 v);
509 float _MM_CALLCONV MMVectorGetW(__m128 v);
511 void _MM_CALLCONV MMVectorGetXRaw(
float* x, __m128 v);
512 void _MM_CALLCONV MMVectorGetYRaw(
float* y, __m128 v);
513 void _MM_CALLCONV MMVectorGetZRaw(
float* z, __m128 v);
514 void _MM_CALLCONV MMVectorGetWRaw(
float* w, __m128 v);
516 __m128 _MM_CALLCONV MMVectorSetX(__m128 v,
float x);
517 __m128 _MM_CALLCONV MMVectorSetY(__m128 v,
float y);
518 __m128 _MM_CALLCONV MMVectorSetZ(__m128 v,
float z);
519 __m128 _MM_CALLCONV MMVectorSetW(__m128 v,
float w);
521 bool _MM_CALLCONV MMVectorEqual(__m128 v, __m128 u);
528 Matrix4 _MM_CALLCONV MMMatrixRotationX(
float r);
529 Matrix4 _MM_CALLCONV MMMatrixRotationY(
float r);
530 Matrix4 _MM_CALLCONV MMMatrixRotationZ(
float r);
534 Matrix4 _MM_CALLCONV MMMatrixOrthoProj(
float left,
float right,
float bottom,
float top,
float znear,
float zfar);
535 Matrix4 _MM_CALLCONV MMMatrixPerspProj(
float fov,
float width,
float height,
float znear,
float zfar);
539 Matrix4 _MM_CALLCONV MMMatrixInverseTranslation(
const Vector3& v);
540 Matrix4 _MM_CALLCONV MMMatrixInverseTranslation(
const Matrix4& m);
550 float _MM_CALLCONV MMVector2Dot(
const Vector2& v,
const Vector2& u);
551 float _MM_CALLCONV MMVector2Angle(
const Vector2& v,
const Vector2& u);
552 float _MM_CALLCONV MMVector2Distance(
const Vector2& v,
const Vector2& u);
553 float _MM_CALLCONV MMVector2MagnitudeSqr(
const Vector2& v);
554 float _MM_CALLCONV MMVector2Magnitude(
const Vector2& v);
562 float _MM_CALLCONV MMVector3Dot(
const Vector3& v,
const Vector3& u);
563 float _MM_CALLCONV MMVector3Angle(
const Vector3& v,
const Vector3& u);
564 float _MM_CALLCONV MMVector3Distance(
const Vector3& v,
const Vector3& u);
565 float _MM_CALLCONV MMVector3MagnitudeSqr(
const Vector3& v);
566 float _MM_CALLCONV MMVector3Magnitude(
const Vector3& v);
573 float _MM_CALLCONV MMVector4Dot(
const Vector4& v,
const Vector4& u);
576 float _MM_CALLCONV MMVector4Magnitude(
const Vector4& v);
577 float _MM_CALLCONV MMVector4MagnitudeSqr(
const Vector4& v);
586 float _MM_CALLCONV MMQuaternionMagnitude(
const Quaternion& q);
587 float _MM_CALLCONV MMQuaternionMagnitudeSqr(
const Quaternion& q);
593 #include <ht_math.inl> 594 #include <ht_mathmm.inl> 595 #include <ht_mathconvert.inl> 596 #include <ht_mathvector2.inl> 597 #include <ht_mathvector3.inl> 598 #include <ht_mathvector4.inl> 599 #include <ht_mathmatrix.inl> 600 #include <ht_mathquaternion.inl> Definition: ht_math.h:125
Definition: ht_math.h:106
Definition: ht_math.h:442
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.
Definition: ht_math.h:358
Definition: ht_math.h:203
Hatchit Engine Copyright(c) 2015 Third-Degree.
Definition: ht_math.h:280
Hatchit Engine Copyright(c) 2015 Third-Degree.
Definition: ht_math.h:155