Advertisement
WeltEnSTurm

Untitled

Sep 9th, 2011
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1.  
  2. template<typename T>
  3. struct matrix4 {
  4.     T
  5.         x1, y1, z1, w1,
  6.         x2, y2, z2, w2,
  7.         x3, y3, z3, w3,
  8.         x4, y4, z4, w4;
  9.  
  10.     matrix4(const T* f){
  11.         x1 = f[0],  y1 = f[1],  z1 = f[2],  w1 = f[3];
  12.         x2 = f[4],  y2 = f[5],  z2 = f[6],  w2 = f[7];
  13.         x3 = f[8],  y3 = f[9],  z3 = f[10], w3 = f[11];
  14.         x4 = f[12], y4 = f[13], z4 = f[14], w4 = f[15];
  15.     }
  16.  
  17.     static const matrix4<T> identity(){
  18.         static T tmp[4*4] = {
  19.             1, 0, 0, 0,
  20.             0, 1, 0, 0,
  21.             0, 0, 1, 0,
  22.             0, 0, 0, 1
  23.         };
  24.         static matrix4<T> id = matrix4<T>(tmp);
  25.         return id;
  26.     };
  27. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement