home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume38 / tessel / part02 / triangle.h < prev   
Text File  |  1993-06-21  |  3KB  |  68 lines

  1. /*
  2.  *+-------------------------------------------------------------------------+
  3.  *| "triangle.h" - Header file for data structure and constants.            |
  4.  *|                                                                         |
  5.  *| Author: Michael S. A. Robb         Version: 1.4          Date: 30/05/93 |
  6.  *+-------------------------------------------------------------------------+
  7.  */
  8.  
  9. #define FIXED_POINT  16  /* Number of bits in the fraction */
  10.  
  11. /*
  12.  *+-------------------------------------------------------------------------+
  13.  *| The following data structure is used to represent the coordinate of a   |
  14.  *| polygon vertex.                                                         |
  15.  *+-------------------------------------------------------------------------+
  16.  */
  17.  
  18. typedef struct coord_st
  19.   {
  20.   long c_xpos;    /* X coordinate.       */
  21.   long c_ypos;    /* Y coordinate.       */
  22.   long c_zpos;    /* Z coordinate.       */
  23.   long c_red;     /* Amount of red.      */
  24.   long c_green;   /* Amount of green.    */
  25.   long c_blue;    /* Amount of blue.     */
  26.   long c_blend;   /* Amount of blending. */
  27.   } COORD;
  28.  
  29. /*
  30.  *+-------------------------------------------------------------------------+
  31.  *| The following data structure is used to represent a single edge of the  |
  32.  *| triangle.                                                               |
  33.  *+-------------------------------------------------------------------------+
  34.  */
  35.  
  36. typedef struct edge_st
  37.   {
  38.   long e_xpos;    /* Current X     coordinate */
  39.   long e_ypos;    /* Current Y     coordinate */
  40.   long e_zpos;    /* Current Z     coordinate */
  41.   long e_red;     /* Current RED   component  */
  42.   long e_green;   /* Current GREEN component  */
  43.   long e_blue;    /* Current BLUE  component  */
  44.   long e_blend;   /* Current BLEND component  */
  45.  
  46.   long e_dxpos;   /* Incremental X coordinate */
  47.   long e_deltay;  /* Incremental Y coordinate */
  48.   long e_dzpos;   /* Incremental Z coordinate */
  49.   long e_dred;    /* Incremental RED   value  */
  50.   long e_dgreen;  /* Incremental GREEN value  */
  51.   long e_dblue;   /* Incremental BLUE  value  */
  52.   long e_dblend;  /* Incremental BLEND value  */
  53.   } EDGE;
  54.  
  55. /*
  56.  *+-----------------------------------------------------------------------+
  57.  *| Function prototypes.                                                  |
  58.  *+-----------------------------------------------------------------------+
  59.  */
  60.  
  61. void render_horizontal_line( void );
  62.  
  63. void edge_update( EDGE *edge );
  64. void edge_init(   EDGE *edge, COORD  *v1, COORD *v2 );
  65. void render_half( EDGE *e1,   EDGE *e2, long deltay, long ypos );
  66.  
  67. void render_triangle( COORD *tlist );
  68.