4 x 4 float matrix, column major
#include <matrix.hpp>
Public Member Functions | |
matrix () | |
matrix (matrix const &other) | |
matrix (quaternion const &q) | |
matrix & | operator= (matrix const &other) |
matrix (float m00, float m10, float m20, float m30, float m01, float m11, float m21, float m31, float m02, float m12, float m22, float m32, float m03, float m13, float m23, float m33) | |
matrix (vec4 const &row0, vec4 const &row1, vec4 const &row2, vec4 const &row3) | |
vec3 | transform_vector (vec3 const &v) const |
vec4 | transform_vector (vec4 const &v) const |
vec3 | uniform_transform_direction (vec3 const &v) const |
matrix | operator* (matrix const &other) const |
matrix & | operator*= (matrix const &other) |
vec3 | column3 (int column) const |
vec4 | column (int column) const |
vec4 | row (int row) const |
void | set_row (int row, vec4 const &v) |
void | set_column (int col, vec4 const &v) |
Static Public Member Functions | |
static matrix | identity () |
Data Fields | |
float | m [4][4] |
Definition at line 44 of file matrix.hpp.
renderstack::matrix::matrix | ( | ) | [inline] |
Definition at line 47 of file matrix.hpp.
renderstack::matrix::matrix | ( | matrix const & | other | ) | [inline] |
Definition at line 48 of file matrix.hpp.
00049 { 00050 m[0][0] = other.m[0][0]; m[1][0] = other.m[1][0]; m[2][0] = other.m[2][0]; m[3][0] = other.m[3][0]; 00051 m[0][1] = other.m[0][1]; m[1][1] = other.m[1][1]; m[2][1] = other.m[2][1]; m[3][1] = other.m[3][1]; 00052 m[0][2] = other.m[0][2]; m[1][2] = other.m[1][2]; m[2][2] = other.m[2][2]; m[3][2] = other.m[3][2]; 00053 m[0][3] = other.m[0][3]; m[1][3] = other.m[1][3]; m[2][3] = other.m[2][3]; m[3][3] = other.m[3][3]; 00054 }
renderstack::matrix::matrix | ( | quaternion const & | q | ) | [explicit] |
Definition at line 109 of file matrix.cpp.
00110 { 00111 float x2 = 2.0f * q.x; 00112 float y2 = 2.0f * q.y; 00113 float z2 = 2.0f * q.z; 00114 float xx = q.x * x2; 00115 float xy = q.x * y2; 00116 float xz = q.x * z2; 00117 float yy = q.y * y2; 00118 float yz = q.y * z2; 00119 float zz = q.z * z2; 00120 float wx = q.w * x2; 00121 float wy = q.w * y2; 00122 float wz = q.w * z2; 00123 00124 m[0][0] = 1.0f - yy - zz; m[1][0] = xy - wz; m[2][0] = xz + wy; m[3][0] = 0.0f; 00125 m[0][1] = xy + wz; m[1][1] = 1.0f - xx - zz; m[2][1] = yz - wx; m[3][1] = 0.0f; 00126 m[0][2] = xz - wy; m[1][2] = yz + wx; m[2][2] = 1.0f - xx - yy; m[3][2] = 0.0f; 00127 m[0][3] = 0.0f; m[1][3] = 0.0f; m[2][3] = 0.0f; m[3][3] = 1.0f; 00128 00129 }
renderstack::matrix::matrix | ( | float | m00, | |
float | m10, | |||
float | m20, | |||
float | m30, | |||
float | m01, | |||
float | m11, | |||
float | m21, | |||
float | m31, | |||
float | m02, | |||
float | m12, | |||
float | m22, | |||
float | m32, | |||
float | m03, | |||
float | m13, | |||
float | m23, | |||
float | m33 | |||
) | [inline] |
Definition at line 67 of file matrix.hpp.
renderstack::matrix::matrix | ( | vec4 const & | row0, | |
vec4 const & | row1, | |||
vec4 const & | row2, | |||
vec4 const & | row3 | |||
) | [inline] |
Definition at line 79 of file matrix.hpp.
00085 { 00086 m[0][0] = row0.x; m[1][0] = row0.y; m[2][0] = row0.z; m[3][0] = row0.w; 00087 m[0][1] = row1.x; m[1][1] = row1.y; m[2][1] = row1.z; m[3][1] = row1.w; 00088 m[0][2] = row2.x; m[1][2] = row2.y; m[2][2] = row2.z; m[3][2] = row2.w; 00089 m[0][3] = row3.x; m[1][3] = row3.y; m[2][3] = row3.z; m[3][3] = row3.w; 00090 }
Definition at line 57 of file matrix.hpp.
00058 { 00059 m[0][0] = other.m[0][0]; m[1][0] = other.m[1][0]; m[2][0] = other.m[2][0]; m[3][0] = other.m[3][0]; 00060 m[0][1] = other.m[0][1]; m[1][1] = other.m[1][1]; m[2][1] = other.m[2][1]; m[3][1] = other.m[3][1]; 00061 m[0][2] = other.m[0][2]; m[1][2] = other.m[1][2]; m[2][2] = other.m[2][2]; m[3][2] = other.m[3][2]; 00062 m[0][3] = other.m[0][3]; m[1][3] = other.m[1][3]; m[2][3] = other.m[2][3]; m[3][3] = other.m[3][3]; 00063 00064 return *this; 00065 }
Definition at line 89 of file matrix.cpp.
00090 { 00091 return vec4( 00092 m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z + m[3][0] * v.w, 00093 m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z + m[3][1] * v.w, 00094 m[0][2] * v.x + m[1][2] * v.y + m[2][2] * v.z + m[3][2] * v.w, 00095 m[0][3] * v.x + m[1][3] * v.y + m[2][3] * v.z + m[3][3] * v.w 00096 ); 00097 }
Definition at line 131 of file matrix.cpp.
00132 { 00133 return matrix( 00134 m[0][0] * other.m[0][0] + m[1][0] * other.m[0][1] + m[2][0] * other.m[0][2] + m[3][0] * other.m[0][3], 00135 m[0][0] * other.m[1][0] + m[1][0] * other.m[1][1] + m[2][0] * other.m[1][2] + m[3][0] * other.m[1][3], 00136 m[0][0] * other.m[2][0] + m[1][0] * other.m[2][1] + m[2][0] * other.m[2][2] + m[3][0] * other.m[2][3], 00137 m[0][0] * other.m[3][0] + m[1][0] * other.m[3][1] + m[2][0] * other.m[3][2] + m[3][0] * other.m[3][3], 00138 00139 m[0][1] * other.m[0][0] + m[1][1] * other.m[0][1] + m[2][1] * other.m[0][2] + m[3][1] * other.m[0][3], 00140 m[0][1] * other.m[1][0] + m[1][1] * other.m[1][1] + m[2][1] * other.m[1][2] + m[3][1] * other.m[1][3], 00141 m[0][1] * other.m[2][0] + m[1][1] * other.m[2][1] + m[2][1] * other.m[2][2] + m[3][1] * other.m[2][3], 00142 m[0][1] * other.m[3][0] + m[1][1] * other.m[3][1] + m[2][1] * other.m[3][2] + m[3][1] * other.m[3][3], 00143 00144 m[0][2] * other.m[0][0] + m[1][2] * other.m[0][1] + m[2][2] * other.m[0][2] + m[3][2] * other.m[0][3], 00145 m[0][2] * other.m[1][0] + m[1][2] * other.m[1][1] + m[2][2] * other.m[1][2] + m[3][2] * other.m[1][3], 00146 m[0][2] * other.m[2][0] + m[1][2] * other.m[2][1] + m[2][2] * other.m[2][2] + m[3][2] * other.m[2][3], 00147 m[0][2] * other.m[3][0] + m[1][2] * other.m[3][1] + m[2][2] * other.m[3][2] + m[3][2] * other.m[3][3], 00148 00149 m[0][3] * other.m[0][0] + m[1][3] * other.m[0][1] + m[2][3] * other.m[0][2] + m[3][3] * other.m[0][3], 00150 m[0][3] * other.m[1][0] + m[1][3] * other.m[1][1] + m[2][3] * other.m[1][2] + m[3][3] * other.m[1][3], 00151 m[0][3] * other.m[2][0] + m[1][3] * other.m[2][1] + m[2][3] * other.m[2][2] + m[3][3] * other.m[2][3], 00152 m[0][3] * other.m[3][0] + m[1][3] * other.m[3][1] + m[2][3] * other.m[3][2] + m[3][3] * other.m[3][3] 00153 ); 00154 }
Definition at line 97 of file matrix.hpp.
vec3 renderstack::matrix::column3 | ( | int | column | ) | const |
Definition at line 53 of file matrix.cpp.
vec4 renderstack::matrix::column | ( | int | column | ) | const |
vec4 renderstack::matrix::row | ( | int | row | ) | const |
void renderstack::matrix::set_row | ( | int | row, | |
vec4 const & | v | |||
) |
void renderstack::matrix::set_column | ( | int | col, | |
vec4 const & | v | |||
) |
static matrix renderstack::matrix::identity | ( | ) | [inline, static] |
Definition at line 111 of file matrix.hpp.
00112 { 00113 return matrix( 00114 1.0f, 0.0f, 0.0f, 0.0f, 00115 0.0f, 1.0f, 0.0f, 0.0f, 00116 0.0f, 0.0f, 1.0f, 0.0f, 00117 0.0f, 0.0f, 0.0f, 1.0f 00118 ); 00119 };
float renderstack::matrix::m[4][4] |
Definition at line 108 of file matrix.hpp.