home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / winui / controls / spincube / paint.h < prev    next >
Text File  |  1993-02-26  |  3KB  |  72 lines

  1. /******************************************************************************\
  2. *
  3. *                               MODULE: PAINT.H
  4. *
  5. \******************************************************************************/
  6.  
  7.  
  8.  
  9. /******************************************************************************\
  10. *                             SYMBOLIC CONSTANTS
  11. \******************************************************************************/
  12.  
  13. #define  NUMVERTICES  8 /* number of polyhedron vertices */
  14. #define  NUMFACETS    6 /* number of polyhedron facets   */
  15.  
  16. #define  MAX_POINTS_PER_FACET 4
  17.  
  18.  
  19.  
  20. /******************************************************************************\
  21. *                                  TYPEDEFs
  22. \******************************************************************************/
  23.  
  24. typedef struct
  25. {
  26.   LONG x, y, z;
  27.  
  28. } POINT3D;
  29.  
  30.  
  31.  
  32. /******************************************************************************\
  33. *                          GLOBAL VARIABLES
  34. \******************************************************************************/
  35.  
  36. //
  37. //  This particular set of vertices "gNormalizedVertices" and corresponding
  38. //    facets "gaiFacets" describe a normalized cube centered about the
  39. //    origin ([0,0,0] in 3-space). The gaiFacet array is made up of a series
  40. //    of indices into the array of vertices, each describing an individual
  41. //    facet (eg. a polygon), and are separated by -1. Note that the facets
  42. //    are decribed in COUNTERCLOCKWISE (relative to the viewer) order so we
  43. //    can consistently find the normal to any given facet. (The normal
  44. //    is used to determine facet visibilty.)
  45. //
  46.  
  47. static POINT3D gNormalizedVertices[NUMVERTICES] = {{ 1, 1, 1}, { 1,-1, 1},
  48.                                                    {-1,-1, 1}, {-1, 1, 1},
  49.                                                    { 1, 1,-1}, { 1,-1,-1},
  50.                                                    {-1,-1,-1}, {-1, 1,-1}  };
  51.  
  52.  
  53. static int gaiFacets[30] = { 3, 2, 1, 0, -1,
  54.                              4, 5, 6, 7, -1,
  55.                              0, 1, 5, 4, -1,
  56.                              6, 2, 3, 7, -1,
  57.                              7, 3, 0, 4, -1,
  58.                              5, 1, 2, 6, -1  };
  59.  
  60. POINT3D gXformedVertices[NUMVERTICES];
  61.  
  62. float   gM[2][3]; /* the transformation matrix */
  63.  
  64.  
  65.  
  66. /******************************************************************************\
  67. *                         FUNCTION PROTOTYPES
  68. \******************************************************************************/
  69.  
  70. void TransformVertices (HWND, RECT *, PSPINCUBEINFO, LONG);
  71. void ComputeRotationTransformation (float, float, float);
  72.