home *** CD-ROM | disk | FTP | other *** search
/ Graphics Programming Black Book (Special Edition) / BlackBook.bin / disk1 / source / chapter52 / l52-5.c < prev    next >
C/C++ Source or Header  |  1997-06-18  |  956b  |  31 lines

  1. /* Set up basic data that needs to be in fixed point, to avoid data
  2.    definition hassles.
  3. Tested with Borland C++ 4.02 in small model by Jim Mischel 12/16/94.
  4. */
  5.  
  6. #include "polygon.h"
  7.  
  8. /* All vertices in the basic cube */
  9. static IntPoint3 IntCubeVerts[NUM_CUBE_VERTS] = {
  10.    {15,15,15},{15,15,-15},{15,-15,15},{15,-15,-15},
  11.    {-15,15,15},{-15,15,-15},{-15,-15,15},{-15,-15,-15} };
  12. /* Transformation from world space into view space (no transformation,
  13.    currently) */
  14. static int IntWorldViewXform[3][4] = {
  15.    {1,0,0,0}, {0,1,0,0}, {0,0,1,0}};
  16.  
  17. void InitializeFixedPoint()
  18. {
  19.    int i, j;
  20.  
  21.    for (i=0; i<3; i++)
  22.       for (j=0; j<4; j++)
  23.          WorldViewXform[i][j] = INT_TO_FIXED(IntWorldViewXform[i][j]);
  24.    for (i=0; i<NUM_CUBE_VERTS; i++) {
  25.       CubeVerts[i].X = INT_TO_FIXED(IntCubeVerts[i].X);
  26.       CubeVerts[i].Y = INT_TO_FIXED(IntCubeVerts[i].Y);
  27.       CubeVerts[i].Z = INT_TO_FIXED(IntCubeVerts[i].Z);
  28.    }
  29. }
  30.  
  31.