Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. #ifndef __ZMATH__
  2. #define __ZMATH__
  3.  
  4. /*for menuetlibc*/
  5. #define pow powf
  6.  
  7. /* Matrix & Vertex */
  8.  
  9. typedef struct {
  10.         float m[4][4];
  11. } M4;
  12.  
  13. typedef struct {
  14.         float m[3][3];
  15. } M3;
  16.  
  17. typedef struct {
  18.          float m[3][4];
  19. } M34;
  20.  
  21.  
  22. #define X v[0]
  23. #define Y v[1]
  24. #define Z v[2]
  25. #define W v[3]
  26.  
  27. typedef struct {
  28.          float v[3];
  29. } V3;
  30.  
  31. typedef struct {
  32.          float v[4];
  33. } V4;
  34.        
  35. void gl_M4_Id(M4 *a);
  36. int gl_M4_IsId(M4 *a);
  37. void gl_M4_Move(M4 *a,M4 *b);
  38. void gl_MoveV3(V3 *a,V3 *b);
  39. void gl_MulM4V3(V3 *a,M4 *b,V3 *c);
  40. void gl_MulM3V3(V3 *a,M4 *b,V3 *c);
  41.  
  42. void gl_M4_MulV4(V4 * a,M4 *b,V4 * c);
  43. void gl_M4_InvOrtho(M4 *a,M4 b);
  44. void gl_M4_Inv(M4 *a,M4 *b);
  45. void gl_M4_Mul(M4 *c,M4 *a,M4 *b);
  46. void gl_M4_MulLeft(M4 *c,M4 *a);
  47. void gl_M4_Transpose(M4 *a,M4 *b);
  48. void gl_M4_Rotate(M4 *c,float t,int u);
  49. int  gl_V3_Norm(V3 *a);
  50.  
  51. V3 gl_V3_New(float x,float y,float z);
  52. V4 gl_V4_New(float x,float y,float z,float w);
  53.  
  54. int gl_Matrix_Inv(float *r,float *m,int n);
  55.  
  56. #endif  /*__ZMATH__*/
  57.