HatchitMath
Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
Hatchit::Math::Matrix4 Class Reference

Public Member Functions

 Matrix4 (const float rawArray[])
 
 Matrix4 (float xx, float xy, float xz, float xw, float yx, float yy, float yz, float yw, float zx, float zy, float zz, float zw, float wx, float wy, float wz, float ww)
 
 Matrix4 (const Vector3 &a, const Vector3 &b, const Vector3 &c, const Vector3 &d)
 Creates a 4x4 matrix from 4 given Vector3s The resulting matrix fills in a few values so that it will match this layout: a1, a2, a3, 0 b1, b2, b3, 0 c1, c2, c3, 0 d1, d2, d3, 1.
 
 Matrix4 (const Vector4 &a, const Vector4 &b, const Vector4 &c, const Vector4 &d)
 Creates a 4x4 matrix from 4 given Vector4s The resulting matrix fills in a few values so that it will match this layout: a1, a2, a3, a4 b1, b2, b3, b4 c1, c2, c3, c4 d1, d2, d3, d4.
 
Matrix4 operator* (const Matrix4 &mat) const
 Multiplies this Matrix4 by another given Matrix4 and returns the resulting matrix. More...
 
Vector4 operator* (const Vector4 &vec) const
 Multiplies this Matrix4 by a given Vector3 and returns the resulting Vector3. More...
 
float * operator[] (int row)
 
Float16 ToFloat16 () const
 A conversion operator to extract Float16 from SIMD registers. More...
 
 Matrix4 ()
 Creates a 4x4 identity matrix.
 
 Matrix4 (float rawArray[])
 Creates a 4x4 matrix from an array of 16 values.
 
 Matrix4 (float xx, float xy, float xz, float xw, float yx, float yy, float yz, float yw, float zx, float zy, float zz, float zw, float wx, float wy, float wz, float ww)
 Creates a 4x4 matrix from 16 given values.
 
 Matrix4 (Vector3 a, Vector3 b, Vector3 c, Vector3 d)
 Creates a 4x4 matrix from 4 given Vector3s The resulting matrix fills in a few values so that it will match this layout: a1, a2, a3, 0 b1, b2, b3, 0 c1, c2, c3, 0 d1, d2, d3, 1.
 
 Matrix4 (Vector4 a, Vector4 b, Vector4 c, Vector4 d)
 Creates a 4x4 matrix from 4 given Vector4s The resulting matrix fills in a few values so that it will match this layout: a1, a2, a3, a4 b1, b2, b3, b4 c1, c2, c3, c4 d1, d2, d3, d4.
 
const float *const getAsArray () const
 Get this matrix as an array of values rather than a matrix This pointer is to an array on the stack which will be deleted when this matrix is disposed of. More...
 
Matrix4 operator* (Matrix4 mat)
 Multiplies this Matrix4 by another given Matrix4 and returns the resulting matrix. More...
 
Vector3 operator* (Vector3 vec)
 Multiplies this Matrix4 by a given Vector3 and returns the resulting Vector3. More...
 
Vector4 operator* (Vector4 vec)
 Multiplies this Matrix4 by a given Vector4 and returns the resulting Vector4. More...
 
 operator Matrix3 ()
 Operator to convert this Matrix4 to a Matrix3 The resulting matrix will be trimmed The new Matrix will be laid out: x1, y1, z1, x2, y2, z2, x3, y3, z3.
 

Static Public Member Functions

static Matrix4 GetOrthographicProjection (float left, float right, float bottom, float top, float _near, float _far)
 Generates an orthographic projection from the given values. More...
 
static Matrix4 GetPerspectiveProjection (float fov, float aspect, float _near, float _far)
 Generates a perspective projection from the given values. More...
 
static Matrix4 GetLookAtView (Vector3 lookAt, Vector3 center, Vector3 up)
 Generates a view matrix from the given values. More...
 
static Matrix4 Transpose (const Matrix4 &mat)
 Returns the transpose of a matrix as a Matrix4. More...
 
static Matrix4 Inverse (const Matrix4 &mat)
 Returns the inverse of this matrix as a Matrix4. More...
 

Public Attributes

union {
   __m128   m_rows [4]
 
   struct {
      float   xx
 
      float   xy
 
      float   xz
 
      float   xw
 
      float   yx
 
      float   yy
 
      float   yz
 
      float   yw
 
      float   zx
 
      float   zy
 
      float   zz
 
      float   zw
 
      float   wx
 
      float   wy
 
      float   wz
 
      float   ww
 
   } 
 
   float   m_data [16]
 
}; 
 
union {
   __m128   m_rows [4]
 
   struct {
      float   xx
 
      float   xy
 
      float   xz
 
      float   xw
 
      float   yx
 
      float   yy
 
      float   yz
 
      float   yw
 
      float   zx
 
      float   zy
 
      float   zz
 
      float   zw
 
      float   wx
 
      float   wy
 
      float   wz
 
      float   ww
 
   } 
 
   float   data [16]
 
}; 
 

Friends

class Quaternion
 

Member Function Documentation

const float *const Matrix4::getAsArray ( ) const

Get this matrix as an array of values rather than a matrix This pointer is to an array on the stack which will be deleted when this matrix is disposed of.

Returns
A float array containing all the values in this matrix
Matrix4 Matrix4::GetLookAtView ( Vector3  lookAt,
Vector3  center,
Vector3  up 
)
static

Generates a view matrix from the given values.

Parameters
lookAtThe point for the camera to look at
centerThe point that the camera is located
upThe vector representing which way is up for this camera
Returns
The resulting view matrix in a Matrix4
Matrix4 Matrix4::GetOrthographicProjection ( float  left,
float  right,
float  bottom,
float  top,
float  _near,
float  _far 
)
static

Generates an orthographic projection from the given values.

Parameters
leftThe lefthand bound
rightThe righthand bound
topThe topmost bound
_nearThe near plane
_farThe far plane
Returns
The resulting orthographic projection in a Matrix4
Matrix4 Matrix4::GetPerspectiveProjection ( float  fov,
float  aspect,
float  _near,
float  _far 
)
static

Generates a perspective projection from the given values.

Parameters
fovThe field of view
aspectThe aspect ratio
nearThe _near plane
farThe _far plane
Returns
The resulting perspective projection in a Matrix4
Matrix4 Matrix4::Inverse ( const Matrix4 mat)
static

Returns the inverse of this matrix as a Matrix4.

Parameters
matmatrix to invert
Returns
A Matrix4 that is the inverse of this matrix
Matrix4 Matrix4::operator* ( Matrix4  mat)

Multiplies this Matrix4 by another given Matrix4 and returns the resulting matrix.

Parameters
matThe other Matrix4 to multiply into this one
Returns
The product of this matrix * mat as a Matrix4
Vector3 Matrix4::operator* ( Vector3  vec)

Multiplies this Matrix4 by a given Vector3 and returns the resulting Vector3.

Parameters
vecThe Vector3 to multiply into this matrix
Returns
The product of this matrix * vec as a Vector3
Vector4 Matrix4::operator* ( Vector4  vec)

Multiplies this Matrix4 by a given Vector4 and returns the resulting Vector4.

Parameters
vecThe Vector4 to multiply into this matrix
Returns
The product of this matrix * vec as a Vector4
Matrix4 Matrix4::operator* ( const Matrix4 m) const
inline

Multiplies this Matrix4 by another given Matrix4 and returns the resulting matrix.

Parameters
matThe other Matrix4 to multiply into this one
Returns
The product of this matrix * mat as a Matrix4
Vector4 Matrix4::operator* ( const Vector4 vec) const
inline

Multiplies this Matrix4 by a given Vector3 and returns the resulting Vector3.

Parameters
vecThe Vector3 to multiply into this matrix
Returns
The product of this matrix * vec as a Vector3 Multiplies this Matrix4 by a given Vector4 and returns the resulting Vector4
Parameters
vecThe Vector4 to multiply into this matrix
Returns
The product of this matrix * vec as a Vector4
Float16 Matrix4::ToFloat16 ( ) const
inline

A conversion operator to extract Float16 from SIMD registers.

Returns
Float16 populated with Matrix data
Matrix4 Matrix4::Transpose ( const Matrix4 mat)
static

Returns the transpose of a matrix as a Matrix4.

Parameters
matmatrix to transpose
Returns
A Matrix4 that is the transpoe of this matrix

The documentation for this class was generated from the following files: