42 #ifdef CU_MATH_VECTOR_APPLE
45 #include <Accelerate/Accelerate.h>
47 #ifdef CU_MATH_VECTOR_SSE
48 #include <xmmintrin.h>
51 #if defined (__WINDOWS__)
56 #include "CUMathBase.h"
95 #if defined CU_MATH_VECTOR_APPLE
100 #elif defined CU_MATH_VECTOR_SSE
101 __declspec(align(32))
union {
118 #pragma mark Constructors
150 Mat4(
float m11,
float m12,
float m13,
float m14,
151 float m21,
float m22,
float m23,
float m24,
152 float m31,
float m32,
float m33,
float m34,
153 float m41,
float m42,
float m43,
float m44);
168 Mat4(
const float* mat);
193 #pragma mark Static Constructors
237 float targetX,
float targetY,
float targetZ,
238 float upX,
float upY,
float upZ) {
241 targetX, targetY, targetZ,
242 upX, upY, upZ, &result));
262 float targetX,
float targetY,
float targetZ,
263 float upX,
float upY,
float upZ,
Mat4* dst);
284 float zNearPlane,
float zFarPlane) {
286 return *(
createPerspective(fieldOfView, aspectRatio, zNearPlane, zFarPlane, &result));
308 float zNearPlane,
float zFarPlane,
Mat4* dst);
336 float zNearPlane,
float zFarPlane) {
369 float zNearPlane,
float zFarPlane,
Mat4* dst) {
370 float halfWidth = width / 2.0f;
371 float halfHeight = height / 2.0f;
373 zNearPlane, zFarPlane, dst);
404 float zNearPlane,
float zFarPlane) {
439 float zNearPlane,
float zFarPlane,
Mat4* dst);
761 Mat4&
set(
float m11,
float m12,
float m13,
float m14,
float m21,
float m22,
float m23,
float m24,
762 float m31,
float m32,
float m33,
float m34,
float m41,
float m42,
float m43,
float m44);
815 #pragma mark Static Arithmetic
924 #pragma mark Arithmetic
933 return *(
add(*
this,scalar,
this));
944 return *(
add(*
this,mat,
this));
955 return *(
subtract(*
this,scalar,
this));
977 return *(
multiply(*
this,scalar,
this));
1000 return *(
negate(*
this,
this));
1025 return *(
invert(*
this,
this));
1075 #pragma mark Operators
1134 return result.
add(mat);
1195 #pragma mark Comparisons
1219 bool equals(
const Mat4& mat,
float variance=CU_MATH_EPSILON)
const;
1252 #pragma mark Matrix Attributes
1288 bool isOrthogonal(
float variance=CU_MATH_EPSILON)
const;
1377 #pragma mark Static Vector Operations
1464 #pragma mark Vector Operations
1556 #pragma mark Static Matrix Transforms
1787 #pragma mark Matrix Transforms
1799 return *(
rotate(*
this,q,
this));
1816 return *(
rotate(*
this,axis,angle,
this));
1832 return *(
rotateX(*
this,angle,
this));
1848 return *(
rotateY(*
this,angle,
this));
1864 return *(
rotateZ(*
this,angle,
this));
1878 return *(
scale(*
this,value,
this));
1892 return *(
scale(*
this,s,
this));
1908 return *(
scale(*
this,sx,sy,sz,
this));
1938 return *(
translate(*
this,tx,ty,tz,
this));
1943 #pragma mark Conversion Methods
1954 std::string
toString(
bool verbose =
false)
const;
2002 #pragma mark Vector Operations
static Mat4 createRotationX(float angle)
Definition: CUMat4.h:573
Mat4 & set(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44)
bool isOrthogonal(float variance=CU_MATH_EPSILON) const
Mat4 & operator=(const Mat4 &mat)
Definition: CUMat4.h:705
Vec3 getTranslation() const
Vec3 getForwardVector() const
static Vec2 * transform(const Mat4 &mat, const Vec2 &point, Vec2 *dst)
static Mat4 * multiply(const Mat4 &mat, float scalar, Mat4 *dst)
Vec3 getBackVector() const
static Mat4 createRotation(const Vec3 &axis, float angle)
Definition: CUMat4.h:544
Vec2 & operator*=(Vec2 &v, const Affine2 &m)
Definition: CUAffine2.h:1145
Mat4(const Quaternion &rotation)
Definition: CUMat4.h:182
Definition: CUAffine2.h:63
float getDeterminant() const
static Mat4 createScale(float sx, float sy, float sz)
Definition: CUMat4.h:472
static Mat4 createOrthographicOffCenter(float left, float right, float bottom, float top, float zNearPlane, float zFarPlane)
Definition: CUMat4.h:403
Mat4 & scale(const Vec3 &s)
Definition: CUMat4.h:1891
Mat4 & scale(float value)
Definition: CUMat4.h:1877
~Mat4()
Definition: CUMat4.h:189
Mat4 & add(float scalar)
Definition: CUMat4.h:932
static Vec2 * transformVector(const Mat4 &mat, const Vec2 &vec, Vec2 *dst)
static Mat4 createScale(const Vec3 &scale)
Definition: CUMat4.h:496
Mat4 & operator+=(const Mat4 &mat)
Definition: CUMat4.h:1083
Mat4 & rotateZ(float angle)
Definition: CUMat4.h:1863
static const Mat4 ONE
Definition: CUMat4.h:112
static Mat4 createRotationY(float angle)
Definition: CUMat4.h:601
bool isExactly(const Mat4 &mat) const
Mat4 & translate(float tx, float ty, float tz)
Definition: CUMat4.h:1937
static Mat4 * subtract(const Mat4 &mat, float scalar, Mat4 *dst)
static Mat4 * rotateX(const Mat4 &mat, float angle, Mat4 *dst)
Definition: CUMat4.h:1612
Mat4 & rotateY(float angle)
Definition: CUMat4.h:1847
Mat4 & operator-=(const Mat4 &mat)
Definition: CUMat4.h:1094
static Mat4 createScale(float scale)
Definition: CUMat4.h:448
Mat4 & rotateX(float angle)
Definition: CUMat4.h:1831
Mat4 & negate()
Definition: CUMat4.h:999
Mat4 & operator*=(float scalar)
Definition: CUMat4.h:1119
Mat4 & multiply(float scalar)
Definition: CUMat4.h:976
static Mat4 * rotate(const Mat4 &mat, const Quaternion &quat, Mat4 *dst)
Definition: CUMat4.h:1569
static Mat4 * scale(const Mat4 &mat, float value, Mat4 *dst)
Definition: CUMat4.h:1673
Vec3 getRightVector() const
bool isIdentity(float variance=0.0f) const
Mat4 & transpose()
Definition: CUMat4.h:1052
static Mat4 * translate(const Mat4 &mat, float tx, float ty, float tz, Mat4 *dst)
Definition: CUMat4.h:1753
Mat4 & rotate(const Vec3 &axis, float angle)
Definition: CUMat4.h:1815
static Mat4 * scale(const Mat4 &mat, float sx, float sy, float sz, Mat4 *dst)
Definition: CUMat4.h:1713
Mat4 getInverse() const
Definition: CUMat4.h:1037
const Mat4 operator*(const Mat4 &mat) const
Definition: CUMat4.h:1174
static Mat4 createOrthographic(float width, float height, float zNearPlane, float zFarPlane)
Definition: CUMat4.h:335
static Mat4 createTranslation(float tx, float ty, float tz)
Definition: CUMat4.h:678
static Mat4 * rotateZ(const Mat4 &mat, float angle, Mat4 *dst)
Definition: CUMat4.h:1654
Mat4 & subtract(const Mat4 &mat)
Definition: CUMat4.h:965
static bool decompose(const Mat4 &mat, Vec3 *scale, Quaternion *rot, Vec3 *trans)
Mat4 & multiply(const Mat4 &mat)
Definition: CUMat4.h:990
const Mat4 operator-(const Mat4 &mat) const
Definition: CUMat4.h:1146
bool isInvertible(float variance=CU_MATH_EPSILON) const
Definition: CUMat4.h:1275
static Mat4 createPerspective(float fieldOfView, float aspectRatio, float zNearPlane, float zFarPlane)
Definition: CUMat4.h:283
const Mat4 operator+(const Mat4 &mat) const
Definition: CUMat4.h:1132
std::string toString(bool verbose=false) const
Mat4 & operator=(const float *array)
Definition: CUMat4.h:724
Mat4 & operator=(const Quaternion &quat)
Definition: CUMat4.h:735
Mat4 & add(const Mat4 &mat)
Definition: CUMat4.h:943
static Mat4 * rotateY(const Mat4 &mat, float angle, Mat4 *dst)
Definition: CUMat4.h:1633
bool equals(const Mat4 &mat, float variance=CU_MATH_EPSILON) const
static const Mat4 IDENTITY
Definition: CUMat4.h:114
static Mat4 * scale(const Mat4 &mat, const Vec3 &s, Mat4 *dst)
Definition: CUMat4.h:1692
static Mat4 * createOrthographic(float width, float height, float zNearPlane, float zFarPlane, Mat4 *dst)
Definition: CUMat4.h:368
const Mat4 operator*(float scalar) const
Definition: CUMat4.h:1188
static Mat4 createLookAt(float eyeX, float eyeY, float eyeZ, float targetX, float targetY, float targetZ, float upX, float upY, float upZ)
Definition: CUMat4.h:236
Mat4 & subtract(float scalar)
Definition: CUMat4.h:954
int operator*(Font::Style value)
Definition: CUFont.h:1503
Mat4 getTranspose() const
Definition: CUMat4.h:1067
Mat4 getNegation() const
Definition: CUMat4.h:1010
Mat4 & scale(float sx, float sy, float sz)
Definition: CUMat4.h:1907
static Mat4 createRotation(const Quaternion &quat)
Definition: CUMat4.h:518
Mat4 & translate(const Vec3 &t)
Definition: CUMat4.h:1921
static Mat4 * add(const Mat4 &mat, float scalar, Mat4 *dst)
const Mat4 operator-() const
Definition: CUMat4.h:1158
Mat4 & rotate(const Quaternion &q)
Definition: CUMat4.h:1798
Definition: CUAnimationNode.h:52
Vec3 getDownVector() const
Definition: CUQuaternion.h:97
static Mat4 createTranslation(const Vec3 &trans)
Definition: CUMat4.h:654
static Mat4 * translate(const Mat4 &mat, const Vec3 &t, Mat4 *dst)
Definition: CUMat4.h:1732
static Mat4 createRotationZ(float angle)
Definition: CUMat4.h:629
static const Mat4 ZERO
Definition: CUMat4.h:110
static Mat4 createLookAt(const Vec3 &eye, const Vec3 &target, const Vec3 &up)
Definition: CUMat4.h:203
Quaternion getRotation() const
Vec3 getLeftVector() const
static Mat4 * rotate(const Mat4 &mat, const Vec3 &axis, float angle, Mat4 *dst)
Definition: CUMat4.h:1591
bool operator==(const Mat4 &mat) const
Definition: CUMat4.h:1232
Mat4 & operator*=(const Mat4 &mat)
Definition: CUMat4.h:1108
Mat4 & invert()
Definition: CUMat4.h:1024
bool operator!=(const Mat4 &mat) const
Definition: CUMat4.h:1246