Trans.h
上传用户:lhwx1029
上传日期:2013-03-07
资源大小:1173k
文件大小:3k
源码类别:

3D图形编程

开发平台:

Visual C++

  1. #if ((!defined(_FLOAT_)) && (!defined(_FIXED_)))
  2.  #error Either _FLOAT_ or _FIXED_ must be declared.
  3. #endif
  4. #if ((!defined(_Z_BUFFER_)) && (!defined(_PAINTER_)))
  5.  #error Either _Z_BUFFER_ or _PAINTER_ must be declared.
  6. #endif
  7. #if !defined(_TRANS_H_)
  8. #define _TRANS_H_
  9. /** 3DGPL *************************************************
  10.  * ()                                                     *
  11.  * Header for basic 3-d math.                             *
  12.  *                                                        *
  13.  * Ifdefs:                                                *
  14.  *  _FLOAT_                 Use float implementation;     *
  15.  *  _FIXED_                 Use fixed implementation;     *
  16.  *  _Z_BUFFER_              Hidden surface removal;       *
  17.  *  _PAINTER_               Back to front rendering;      *
  18.  *                                                        *
  19.  * Files:                                                 *
  20.  *  trans-bs.c              3-D transformations;          *
  21.  *  trans-ln.c              Linear algebra stuff.         *
  22.  *                                                        *
  23.  * (c) 1995-98 Sergei Savchenko, (savs@cs.mcgill.ca)      *
  24. **********************************************************/
  25. #define T_LNG_VECTOR              4         /* 3 rounded up to power of 2 */
  26. #define T_MAX_MATRIX_SIZE         8         /* for Gaussian elimination */
  27. #define T_LOG_NORMAL_SIZE         7         /* fixed precision for normals */
  28. #define T_ONE_OVER_Z_CONST -0x7ffff         /* for Z_BUFFER ordering */
  29. #define T_P                      15         /* fixed point precision */
  30. void T_init_math(void);
  31. int *T_vector(int *from1,int *from2,int *to,int dimension);
  32. long T_norm(int *vector);
  33. void T_normal_vectors(int *from1,int *from2,int *to);
  34. void T_normal_plane(int *from1,int *from2,int *from3,int *to);
  35. void T_unit_vector(int *from1,int *from2,int *to);
  36. int T_scalar_product(int *from1,int *from2);
  37. int T_normal_z_negative(int *from1,int *from2,int *from3);
  38. void T_plane(int *from1,int *from2,int *from3,int *to);
  39. int T_vertex_on_plane(int *vertex,int *plane);
  40. void T_translation(int *from,int *to,int length,
  41.                    int addx,int addy,int addz
  42.                   );
  43. void T_scaling(int *from,int *to,int length,
  44.                int mulx,int muly,int mulz
  45.               );
  46. void T_set_self_rotation(unsigned char alp,unsigned char bet,
  47.                          unsigned char gam
  48.                         );
  49. void T_self_rotation(int *from,int *to,int length);
  50. void T_set_world_rotation(unsigned char alp,unsigned char bet,
  51.                           unsigned char gam
  52.                          );
  53. void T_world_rotation(int *from,int *to,int length);
  54. void T_cancatinate_self_world(int addx,int addy,int addz);
  55. void T_cancatinated_rotation(int *from,int *to,int length);
  56. void T_perspective(int *from,int *to,
  57.                    int dimension,int length,int log_focus
  58.                   );
  59. void T_linear_solve(int ia[T_MAX_MATRIX_SIZE][T_MAX_MATRIX_SIZE],
  60.                     int ib[T_MAX_MATRIX_SIZE][T_MAX_MATRIX_SIZE],
  61.                     int ix[T_MAX_MATRIX_SIZE][T_MAX_MATRIX_SIZE],
  62.                     int n,int m,
  63.                     int log_source_multiplyer,
  64.                     int log_result_multiplyer
  65.                    );
  66. /**********************************************************/
  67. #endif