home *** CD-ROM | disk | FTP | other *** search
/ Launch & Play / spustahrej2.iso / Egoboo / code / mathstuff.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-12-03  |  1.8 KB  |  45 lines

  1. #ifndef _MATHSTUFF_H_
  2. #define _MATHSTUFF_H_
  3.  
  4.  
  5. /**> HEADER FILES <**/
  6. //#include "egoboo.h"
  7. #include <math.h>
  8. #include "egobootypedef.h"
  9.  
  10. /**> MACROS <**/
  11. #define _CNV(i,j) .v[4*i+j]
  12. #define CopyMatrix( pMatrixSource, pMatrixDest ) memcpy( (pMatrixDest), (pMatrixSource), sizeof( GLMATRIX ) )
  13.  
  14.  
  15. /**> DATA STRUCTURES <**/
  16. typedef struct glmatrix { float v[16]; } GLMATRIX;
  17. typedef struct glvector { float x,y,z,w; } GLVECTOR;
  18.  
  19.  
  20. /**> GLOBAL VARIABLES <**/
  21. extern float                   turntosin[16384];           // Convert chrturn>>2...  to sine
  22.  
  23.  
  24. /**> FUNCTION PROTOTYPES <**/
  25. GLVECTOR vsub(GLVECTOR A, GLVECTOR B);
  26. GLVECTOR Normalize(GLVECTOR vec);
  27. GLVECTOR CrossProduct(GLVECTOR A, GLVECTOR B);
  28. float DotProduct(GLVECTOR A, GLVECTOR B);
  29. GLMATRIX IdentityMatrix(void);
  30. GLMATRIX ZeroMatrix(void);
  31. GLMATRIX MatrixMult(const GLMATRIX a, const GLMATRIX b);
  32. GLMATRIX Translate(const float dx, const float dy, const float dz);
  33. GLMATRIX RotateX(const float rads);
  34. GLMATRIX RotateY(const float rads);
  35. GLMATRIX RotateZ(const float rads);
  36. GLMATRIX ScaleXYZ(const float sizex, const float sizey, const float sizez);
  37. GLMATRIX ScaleXYZRotateXYZTranslate(const float sizex, const float sizey, const float sizez, unsigned short turnz, unsigned short turnx, unsigned short turny, float tx, float ty, float tz);
  38. GLMATRIX FourPoints(float orix, float oriy, float oriz, float widx, float widy, float widz, float forx, float fory, float forz, float upx,  float upy,  float upz, float scale);
  39. GLMATRIX ViewMatrix(const GLVECTOR from, const GLVECTOR at, const GLVECTOR world_up, const float roll);
  40. GLMATRIX ProjectionMatrix(const float near_plane, const float far_plane, const float fov);
  41. void    TransformVertices( GLMATRIX *pMatrix, GLVECTOR *pSourceV, GLVECTOR *pDestV, Uint32 pNumVertor );
  42.  
  43. #endif
  44.  
  45.