home *** CD-ROM | disk | FTP | other *** search
/ Cutting-Edge 3D Game Programming with C++ / CE3DC++.ISO / BOOK / CHAP09 / 3DCLASS.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-17  |  1.6 KB  |  58 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. #include <CType.h>
  17. #include <Conio.h>
  18. #include <Stdio.h>
  19. #include <Assert.h>
  20. #include <Stdlib.h>
  21. #include <Iostream.h>
  22.  
  23. // ------------------------------------------------------------
  24. // | Local headers:                                           |
  25. // ------------------------------------------------------------
  26.  
  27. #include "3DClass.HPP"
  28.  
  29. // ------------------------------------------------------------
  30. // | Global variables/constants:                              |
  31. // ------------------------------------------------------------
  32.  
  33. float CosTable [ DEGREECOUNT ];
  34. float SinTable [ DEGREECOUNT ];
  35.  
  36. long *ZBuffer;
  37. long ZTrans;
  38.  
  39. // ------------------------------------------------------------
  40. // | Function section:                                        |
  41. // ------------------------------------------------------------
  42.  
  43. // Initiate math function - calculates trig tables:
  44. void InitMath ()
  45.    {
  46.    long double Unit = ( long double ) ( PI * 2.0F ) / 
  47.                       ( long double ) DEGREECOUNT;
  48.    // Loop through all DEGREECOUNT degrees:
  49.    for ( unsigned short N = 0; N < DEGREECOUNT; N++ )
  50.        {
  51.        long double Degree = ( long double ) N;
  52.          CosTable [ N ] = cos ( Unit * Degree );
  53.          SinTable [ N ] = sin ( Unit * Degree );
  54.        }
  55.    }
  56.  
  57.  
  58.