home *** CD-ROM | disk | FTP | other *** search
/ Cutting-Edge 3D Game Programming with C++ / CE3DC++.ISO / BOOK / CHAP12 / 3DCLASS.CPP < prev    next >
C/C++ Source or Header  |  1996-01-24  |  2KB  |  52 lines

  1. //
  2. // File name: 3Dclass.CPP
  3. //
  4. // Description: The support file for the 3DClass header
  5. //
  6. // Author: John De Goes
  7. //
  8. // Project: Cutting Edge 3D Game Programming
  9. //
  10.  
  11. // ------------------------------------------------------------
  12. // | Global headers:                                          |
  13. // ------------------------------------------------------------
  14.  
  15. #include <Math.h>
  16.  
  17. // ------------------------------------------------------------
  18. // | Local headers:                                           |
  19. // ------------------------------------------------------------
  20.  
  21. #include "3DClass.HPP"
  22.  
  23. // ------------------------------------------------------------
  24. // | Global variables/constants:                              |
  25. // ------------------------------------------------------------
  26.  
  27. float CosTable [ DEGREECOUNT ];
  28. float SinTable [ DEGREECOUNT ];
  29.  
  30. long *ZBuffer;
  31. long ZTrans;
  32.  
  33. // ------------------------------------------------------------
  34. // | Function section:                                        |
  35. // ------------------------------------------------------------
  36.  
  37. // Initiate math function - calculates trig tables:
  38. void InitMath ()
  39.    {
  40.    long double Unit = ( long double ) ( PI * 2.0F ) /
  41.                       ( long double ) DEGREECOUNT;
  42.    // Loop through all DEGREECOUNT degrees:
  43.    for ( unsigned short N = 0; N < DEGREECOUNT; N++ )
  44.        {
  45.        long double Degree = ( long double ) N;
  46.          CosTable [ N ] = float ( cos ( Unit * Degree ) );
  47.          SinTable [ N ] = float ( sin ( Unit * Degree ) );
  48.        }
  49.    }
  50.  
  51.  
  52.