Changeset 651
- Timestamp:
- Feb 16, 2011, 7:04:05 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/matrix.h
r648 r651 179 179 { 180 180 inline Mat4() { } 181 inline Mat4(T val) { for (int i = 0; i < 4; i++) v[i] = val; } 181 inline Mat4(T val) 182 { 183 for (int j = 0; j < 4; j++) 184 for (int i = 0; i < 4; i++) 185 v[i][j] = (i == j) ? val : 0; 186 } 182 187 inline Mat4(Vec4<T> v0, Vec4<T> v1, Vec4<T> v2, Vec4<T> v3) 183 { v[0] = v0; v[1] = v1; v[2] = v2; v[3] = v3; } 188 { 189 v[0] = v0; v[1] = v1; v[2] = v2; v[3] = v3; 190 } 184 191 185 192 inline Vec4<T>& operator[](int n) { return v[n]; } 186 193 inline Vec4<T> const& operator[](int n) const { return v[n]; } 187 188 static inline Mat4<T> identity()189 {190 Mat4<T> ret;191 for (int j = 0; j < 4; j++)192 for (int i = 0; i < 4; i++)193 ret[i][j] = i == j;194 return ret;195 }196 194 197 195 T det() const; -
trunk/test/matrix.cpp
r648 r651 33 33 void setUp() 34 34 { 35 identity = float4x4 ::identity();35 identity = float4x4(1.0f); 36 36 triangular = float4x4(float4(1.0f, 0.0f, 0.0f, 0.0f), 37 37 float4(7.0f, 2.0f, 0.0f, 0.0f),
Note: See TracChangeset
for help on using the changeset viewer.