Advertisement
WeltEnSTurm

All that because you can't overload between [4*4] and [3*3]

Sep 8th, 2011
385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. // File: matrix.hpp, created on Sep 8, 2011 by WeltEnSTurm
  2.  
  3.  
  4. #ifndef MATRIX_HPP_
  5. #define MATRIX_HPP_
  6.  
  7. template<typename T>
  8. struct matrix3 {
  9.     T
  10.         x1, y1, z1,
  11.         x2, y2, z2,
  12.         x3, y3, z3;
  13.  
  14.     matrix3(const T* f){
  15.         x1 = f[0], x2 = f[1], x3 = f[2];
  16.         y1 = f[4], y2 = f[5], y3 = f[6];
  17.         z1 = f[7], z2 = f[8], z3 = f[9];
  18.     }
  19. };
  20.  
  21. template<typename T>
  22. struct matrix4 {
  23.     T
  24.         x1, y1, z1, w1,
  25.         x2, y2, z2, w2,
  26.         x3, y3, z3, w3,
  27.         x4, y4, z4, w4;
  28.  
  29.     matrix4(const T* f){
  30.         x1 = f[0],  y1 = f[1],  z1 = f[2],  w1 = f[3];
  31.         x2 = f[4],  y2 = f[5],  z2 = f[6],  w2 = f[7];
  32.         x3 = f[8],  y3 = f[9],  z3 = f[10], w3 = f[11];
  33.         x4 = f[12], y4 = f[13], z4 = f[14], w4 = f[15];
  34.     }
  35. };
  36.  
  37. #endif /* MATRIX_HPP_ */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement