home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga 14 / MA_Cover_14.iso / source / c / q1source_amy / qw / client / r_shared.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-12-21  |  4.7 KB  |  155 lines

  1. /*
  2. Copyright (C) 1996-1997 Id Software, Inc.
  3.  
  4. This program is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU General Public License
  6. as published by the Free Software Foundation; either version 2
  7. of the License, or (at your option) any later version.
  8.  
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
  12.  
  13. See the GNU General Public License for more details.
  14.  
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software
  17. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  18.  
  19. */
  20. #ifndef GLQUAKE
  21. // r_shared.h: general refresh-related stuff shared between the refresh and the
  22. // driver
  23.  
  24. // FIXME: clean up and move into d_iface.h
  25.  
  26. #ifndef _R_SHARED_H_
  27. #define _R_SHARED_H_
  28.  
  29. #define    MAXVERTS    16                    // max points in a surface polygon
  30. #define MAXWORKINGVERTS    (MAXVERTS+4)    // max points in an intermediate
  31.                                         //  polygon (while processing)
  32. // !!! if this is changed, it must be changed in d_ifacea.h too !!!
  33. #define    MAXHEIGHT    1024
  34. #define    MAXWIDTH    1280
  35.  
  36. #define INFINITE_DISTANCE    0x10000        // distance that's always guaranteed to
  37.                                         //  be farther away than anything in
  38.                                         //  the scene
  39.  
  40. //===================================================================
  41.  
  42. extern void    R_DrawLine (polyvert_t *polyvert0, polyvert_t *polyvert1);
  43.  
  44. extern int        cachewidth;
  45. extern pixel_t    *cacheblock;
  46. extern int        screenwidth;
  47.  
  48. extern    float    pixelAspect;
  49.  
  50. extern int        r_drawnpolycount;
  51.  
  52. extern cvar_t    r_clearcolor;
  53.  
  54. extern int    sintable[1280];
  55. extern int    intsintable[1280];
  56.  
  57. extern    vec3_t    vup, base_vup;
  58. extern    vec3_t    vpn, base_vpn;
  59. extern    vec3_t    vright, base_vright;
  60. extern    entity_t        *currententity;
  61.  
  62. #define NUMSTACKEDGES        2000
  63. #define    MINEDGES            NUMSTACKEDGES
  64. #define NUMSTACKSURFACES    1000
  65. #define MINSURFACES            NUMSTACKSURFACES
  66. #define    MAXSPANS            3000
  67.  
  68. // !!! if this is changed, it must be changed in asm_draw.h too !!!
  69. typedef struct espan_s
  70. {
  71.     int                u, v, count;
  72.     struct espan_s    *pnext;
  73. } espan_t;
  74.  
  75. // FIXME: compress, make a union if that will help
  76. // insubmodel is only 1, flags is fewer than 32, spanstate could be a byte
  77. typedef struct surf_s
  78. {
  79.     struct surf_s    *next;            // active surface stack in r_edge.c
  80.     struct surf_s    *prev;            // used in r_edge.c for active surf stack
  81.     struct espan_s    *spans;            // pointer to linked list of spans to draw
  82.     int            key;                // sorting key (BSP order)
  83.     int            last_u;                // set during tracing
  84.     int            spanstate;            // 0 = not in span
  85.                                     // 1 = in span
  86.                                     // -1 = in inverted span (end before
  87.                                     //  start)
  88.     int            flags;                // currentface flags
  89.     void        *data;                // associated data like msurface_t
  90.     entity_t    *entity;
  91.     float        nearzi;                // nearest 1/z on surface, for mipmapping
  92.     qboolean    insubmodel;
  93.     float        d_ziorigin, d_zistepu, d_zistepv;
  94.  
  95.     int            pad[2];                // to 64 bytes
  96. } surf_t;
  97.  
  98. extern    surf_t    *surfaces, *surface_p, *surf_max;
  99.  
  100. // surfaces are generated in back to front order by the bsp, so if a surf
  101. // pointer is greater than another one, it should be drawn in front
  102. // surfaces[1] is the background, and is used as the active surface stack.
  103. // surfaces[0] is a dummy, because index 0 is used to indicate no surface
  104. //  attached to an edge_t
  105.  
  106. //===================================================================
  107.  
  108. extern vec3_t    sxformaxis[4];    // s axis transformed into viewspace
  109. extern vec3_t    txformaxis[4];    // t axis transformed into viewspac
  110.  
  111. extern vec3_t    modelorg, base_modelorg;
  112.  
  113. extern    float    xcenter, ycenter;
  114. extern    float    xscale, yscale;
  115. extern    float    xscaleinv, yscaleinv;
  116. extern    float    xscaleshrink, yscaleshrink;
  117.  
  118. extern    int d_lightstylevalue[256]; // 8.8 frac of base light value
  119.  
  120. extern void TransformVector (vec3_t in, vec3_t out);
  121. extern void SetUpForLineScan(fixed8_t startvertu, fixed8_t startvertv,
  122.     fixed8_t endvertu, fixed8_t endvertv);
  123.  
  124. extern int    r_skymade;
  125. extern void R_MakeSky (void);
  126.  
  127. extern int    ubasestep, errorterm, erroradjustup, erroradjustdown;
  128.  
  129. // flags in finalvert_t.flags
  130. #define ALIAS_LEFT_CLIP                0x0001
  131. #define ALIAS_TOP_CLIP                0x0002
  132. #define ALIAS_RIGHT_CLIP            0x0004
  133. #define ALIAS_BOTTOM_CLIP            0x0008
  134. #define ALIAS_Z_CLIP                0x0010
  135. // !!! if this is changed, it must be changed in d_ifacea.h too !!!
  136. #define ALIAS_ONSEAM                0x0020    // also defined in modelgen.h;
  137.                                             //  must be kept in sync
  138. #define ALIAS_XY_CLIP_MASK            0x000F
  139.  
  140. // !!! if this is changed, it must be changed in asm_draw.h too !!!
  141. typedef struct edge_s
  142. {
  143.     fixed16_t        u;
  144.     fixed16_t        u_step;
  145.     struct edge_s    *prev, *next;
  146.     unsigned short    surfs[2];
  147.     struct edge_s    *nextremove;
  148.     float            nearzi;
  149.     medge_t            *owner;
  150. } edge_t;
  151.  
  152. #endif    // _R_SHARED_H_
  153.  
  154. #endif    // GLQUAKE
  155.