AI_TMatrix44SSE Class Reference
[Mathematics]

#include <AI_TMatrix44_sse.h>

List of all members.


Detailed Description

SSE based AI_Matrix44 class.

(C) 2002 RadonLabs GmbH

Public Member Functions

 AI_TMatrix44SSE ()
 constructor 1
 AI_TMatrix44SSE (const AI_TVector4SSE &v1, const AI_TVector4SSE &v2, const AI_TVector4SSE &v3, const AI_TVector4SSE &v4)
 constructor 2
 AI_TMatrix44SSE (const AI_TMatrix44SSE &m1)
 constructor 3
 AI_TMatrix44SSE (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)
 constructor 4
 AI_TMatrix44SSE (const AI_Quaternion &q)
 construct from AI_Quaternion
 AI_TMatrix44SSE (const __m128 &_m1, const __m128 &_m2, const __m128 &_m3, const __m128 &_m4)
 construct from sse variables
AI_Quaternion get_quaternion () const
 convert to AI_Quaternion
void set (const AI_TVector4SSE &v1, const AI_TVector4SSE &v2, const AI_TVector4SSE &v3, const AI_TVector4SSE &v4)
 set 1
void set (const AI_TMatrix44SSE &m1)
 set 2
void 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)
 set 3
void set (const AI_Quaternion &q)
 set from AI_Quaternion
void ident ()
 set to identity
void transpose ()
 transpose
float det ()
 determinant
void invert (void)
 full invert
void invert_simple (void)
 quick invert (if 3x3 rotation and translation)
void mult_simple (const AI_TMatrix44SSE &m1)
 quick multiplication, assumes that m[0][3]==m[1][3]==m[2][3]==0 and m[3][3]==1
AI_TVector3SSE transform_coord (const AI_TVector3SSE &v) const
 transform AI_Vector3, projecting back into w=1
AI_TVector3SSE x_component () const
 return x component
AI_TVector3SSE y_component () const
 return y component
AI_TVector3SSE z_component () const
 return z component
AI_TVector3SSE pos_component () const
 return translate component
void rotate_x (const float a)
 rotate around global x
void rotate_y (const float a)
 rotate around global y
void rotate_z (const float a)
 rotate around global z
void rotate (const AI_TVector3SSE &vec, float a)
 rotate about any axis
void translate (const AI_TVector3SSE &t)
 translate
void set_translation (const AI_TVector3SSE &t)
 set absolute translation
void scale (const AI_TVector3SSE &s)
 scale
void lookat (const AI_TVector3SSE &to, const AI_TVector3SSE &up)
 unrestricted lookat
void billboard (const AI_TVector3SSE &to, const AI_TVector3SSE &up)
 restricted lookat
void operator *= (const AI_TMatrix44SSE &m1)
 inplace matrix mulitply
void mult (const AI_TVector4SSE &src, AI_TVector4SSE &dst) const
 multiply source vector into target vector, eliminates tmp vector
void mult (const AI_TVector3SSE &src, AI_TVector3SSE &dst) const
 multiply source vector into target vector, eliminates tmp vector

Public Attributes

union {
   struct {
      __m128   m1
      __m128   m2
      __m128   m3
      __m128   m4
   } 
   struct {
      float   m [4][4]
   } 
}; 


Constructor & Destructor Documentation

AI_TMatrix44SSE::AI_TMatrix44SSE (  )  [inline]

constructor 1

AI_TMatrix44SSE::AI_TMatrix44SSE ( const AI_TVector4SSE v1,
const AI_TVector4SSE v2,
const AI_TVector4SSE v3,
const AI_TVector4SSE v4 
) [inline]

constructor 2

AI_TMatrix44SSE::AI_TMatrix44SSE ( const AI_TMatrix44SSE m1  )  [inline]

constructor 3

AI_TMatrix44SSE::AI_TMatrix44SSE ( 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 
) [inline]

constructor 4

AI_TMatrix44SSE::AI_TMatrix44SSE ( const AI_Quaternion q  )  [inline]

construct from AI_Quaternion

FIXME: SSE OPTIMIZATION MISSING!

AI_TMatrix44SSE::AI_TMatrix44SSE ( const __m128 &  _m1,
const __m128 &  _m2,
const __m128 &  _m3,
const __m128 &  _m4 
) [inline]

construct from sse variables


Member Function Documentation

AI_Quaternion AI_TMatrix44SSE::get_quaternion (  )  const [inline]

convert to AI_Quaternion

convert orientation of 4x4 matrix into quaterion, 4x4 matrix must not be scaled!

FIXME: SSE OPTIMIZATION MISSING!

void AI_TMatrix44SSE::set ( const AI_TVector4SSE v1,
const AI_TVector4SSE v2,
const AI_TVector4SSE v3,
const AI_TVector4SSE v4 
) [inline]

set 1

void AI_TMatrix44SSE::set ( const AI_TMatrix44SSE m1  )  [inline]

set 2

void AI_TMatrix44SSE::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 
) [inline]

set 3

void AI_TMatrix44SSE::set ( const AI_Quaternion q  )  [inline]

set from AI_Quaternion

FIXME: SSE OPTIMIZATION MISSING!

void AI_TMatrix44SSE::ident ( void   )  [inline]

set to identity

void AI_TMatrix44SSE::transpose (  )  [inline]

transpose

float AI_TMatrix44SSE::det (  )  [inline]

determinant

FIXME: OPTIMIZE FOR SSE!

void AI_TMatrix44SSE::invert ( void   )  [inline]

full invert

Code taken from Intel pdf "Streaming SIMD Extension - Inverse of 4x4 Matrix"

void AI_TMatrix44SSE::invert_simple ( void   )  [inline]

quick invert (if 3x3 rotation and translation)

inverts a 4x4 matrix consisting of a 3x3 rotation matrix and a translation (eg. everything that has [0,0,0,1] as the rightmost column) MUCH cheaper then a real 4x4 inversion

FIXME: SSE OPTIMIZATION!

void AI_TMatrix44SSE::mult_simple ( const AI_TMatrix44SSE mx  )  [inline]

quick multiplication, assumes that m[0][3]==m[1][3]==m[2][3]==0 and m[3][3]==1

optimized multiplication, assumes that m[0][3]==m[1][3]==m[2][3]==0 AND m[3][3]==1

NOTE: On SSE, this is a normal matrix multiplication

Takes 16 muls, 12 adds and 16 shuffles.

AI_TVector3SSE AI_TMatrix44SSE::transform_coord ( const AI_TVector3SSE v  )  const [inline]

transform AI_Vector3, projecting back into w=1

Transforms a vector by the matrix, projecting the result back into w=1.

FIXME: SSE OPTIMIZATION!

AI_TVector3SSE AI_TMatrix44SSE::x_component ( void   )  const [inline]

return x component

AI_TVector3SSE AI_TMatrix44SSE::y_component ( void   )  const [inline]

return y component

AI_TVector3SSE AI_TMatrix44SSE::z_component ( void   )  const [inline]

return z component

AI_TVector3SSE AI_TMatrix44SSE::pos_component (  )  const [inline]

return translate component

void AI_TMatrix44SSE::rotate_x ( const float  a  )  [inline]

rotate around global x

FIXME: SSE OPTIMIERUNG!

void AI_TMatrix44SSE::rotate_y ( const float  a  )  [inline]

rotate around global y

FIXME: SSE OPTIMIERUNG!

void AI_TMatrix44SSE::rotate_z ( const float  a  )  [inline]

rotate around global z

FIXME: SSE OPTIMIERUNG!

void AI_TMatrix44SSE::rotate ( const AI_TVector3SSE vec,
float  a 
) [inline]

rotate about any axis

FIXME: SSE OPTIMIZATION!

void AI_TMatrix44SSE::translate ( const AI_TVector3SSE t  )  [inline]

translate

void AI_TMatrix44SSE::set_translation ( const AI_TVector3SSE t  )  [inline]

set absolute translation

FIXME: RAFAEL HAS NO CLUE ABOUT SSE!

void AI_TMatrix44SSE::scale ( const AI_TVector3SSE s  )  [inline]

scale

void AI_TMatrix44SSE::lookat ( const AI_TVector3SSE to,
const AI_TVector3SSE up 
) [inline]

unrestricted lookat

void AI_TMatrix44SSE::billboard ( const AI_TVector3SSE to,
const AI_TVector3SSE up 
) [inline]

restricted lookat

void AI_TMatrix44SSE::operator *= ( const AI_TMatrix44SSE mx  )  [inline]

inplace matrix mulitply

This one uses no temp variables, this gives a 10% boost over the same code using temp variables even with optimizations turned on. Unfortunately it's not very readable though...

void AI_TMatrix44SSE::mult ( const AI_TVector4SSE src,
AI_TVector4SSE dst 
) const [inline]

multiply source vector into target vector, eliminates tmp vector

Multiply source directly into target vector (without creating a temporary AI_Vector4 object).

void AI_TMatrix44SSE::mult ( const AI_TVector3SSE src,
AI_TVector3SSE dst 
) const [inline]

multiply source vector into target vector, eliminates tmp vector

Multiply source directly into target vector (without creating a temporary AI_Vector4 object).


Member Data Documentation

float AI_TMatrix44SSE::m[4][4]

union { ... }


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