d_iface.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. /*
  2. Copyright (C) 1996-1997 Id Software, Inc.
  3. This program is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU General Public License
  5. as published by the Free Software Foundation; either version 2
  6. of the License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. See the GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. */
  15. // d_iface.h: interface header file for rasterization driver modules
  16. #define WARP_WIDTH 320
  17. #define WARP_HEIGHT 200
  18. #define MAX_LBM_HEIGHT 200
  19. typedef struct
  20. {
  21. float u, v;
  22. float s, t;
  23. float zi;
  24. } emitpoint_t;
  25. typedef enum {
  26. pt_static, pt_grav, pt_slowgrav, pt_fire, pt_explode, pt_explode2, pt_blob, pt_blob2
  27. } ptype_t;
  28. // !!! if this is changed, it must be changed in d_ifacea.h too !!!
  29. typedef struct particle_s
  30. {
  31. // driver-usable fields
  32. vec3_t org;
  33. float color;
  34. // drivers never touch the following fields
  35. struct particle_s *next;
  36. vec3_t vel;
  37. float ramp;
  38. float die;
  39. ptype_t type;
  40. } particle_t;
  41. #define PARTICLE_Z_CLIP 8.0
  42. typedef struct polyvert_s {
  43. float u, v, zi, s, t;
  44. } polyvert_t;
  45. typedef struct polydesc_s {
  46. int numverts;
  47. float nearzi;
  48. msurface_t *pcurrentface;
  49. polyvert_t *pverts;
  50. } polydesc_t;
  51. // !!! if this is changed, it must be changed in d_ifacea.h too !!!
  52. typedef struct finalvert_s {
  53. int v[6]; // u, v, s, t, l, 1/z
  54. int flags;
  55. float reserved;
  56. } finalvert_t;
  57. // !!! if this is changed, it must be changed in d_ifacea.h too !!!
  58. typedef struct
  59. {
  60. void *pskin;
  61. maliasskindesc_t *pskindesc;
  62. int skinwidth;
  63. int skinheight;
  64. mtriangle_t *ptriangles;
  65. finalvert_t *pfinalverts;
  66. int numtriangles;
  67. int drawtype;
  68. int seamfixupX16;
  69. } affinetridesc_t;
  70. // !!! if this is changed, it must be changed in d_ifacea.h too !!!
  71. typedef struct {
  72. float u, v, zi, color;
  73. } screenpart_t;
  74. typedef struct
  75. {
  76. int nump;
  77. emitpoint_t *pverts; // there's room for an extra element at [nump],
  78. // if the driver wants to duplicate element [0] at
  79. // element [nump] to avoid dealing with wrapping
  80. mspriteframe_t *pspriteframe;
  81. vec3_t vup, vright, vpn; // in worldspace
  82. float nearzi;
  83. } spritedesc_t;
  84. typedef struct
  85. {
  86. int u, v;
  87. float zi;
  88. int color;
  89. } zpointdesc_t;
  90. extern cvar_t r_drawflat;
  91. extern int d_spanpixcount;
  92. extern int r_framecount; // sequence # of current frame since Quake
  93. // started
  94. extern qboolean r_drawpolys; // 1 if driver wants clipped polygons
  95. // rather than a span list
  96. extern qboolean r_drawculledpolys; // 1 if driver wants clipped polygons that
  97. // have been culled by the edge list
  98. extern qboolean r_worldpolysbacktofront; // 1 if driver wants polygons
  99. // delivered back to front rather
  100. // than front to back
  101. extern qboolean r_recursiveaffinetriangles; // true if a driver wants to use
  102. // recursive triangular subdivison
  103. // and vertex drawing via
  104. // D_PolysetDrawFinalVerts() past
  105. // a certain distance (normally
  106. // only used by the software
  107. // driver)
  108. extern float r_aliasuvscale; // scale-up factor for screen u and v
  109. // on Alias vertices passed to driver
  110. extern int r_pixbytes;
  111. extern qboolean r_dowarp;
  112. extern affinetridesc_t r_affinetridesc;
  113. extern spritedesc_t r_spritedesc;
  114. extern zpointdesc_t r_zpointdesc;
  115. extern polydesc_t r_polydesc;
  116. extern int d_con_indirect; // if 0, Quake will draw console directly
  117. // to vid.buffer; if 1, Quake will
  118. // draw console via D_DrawRect. Must be
  119. // defined by driver
  120. extern vec3_t r_pright, r_pup, r_ppn;
  121. void D_Aff8Patch (void *pcolormap);
  122. void D_BeginDirectRect (int x, int y, byte *pbitmap, int width, int height);
  123. void D_DisableBackBufferAccess (void);
  124. void D_EndDirectRect (int x, int y, int width, int height);
  125. void D_PolysetDraw (void);
  126. void D_PolysetDrawFinalVerts (finalvert_t *fv, int numverts);
  127. void D_DrawParticle (particle_t *pparticle);
  128. void D_DrawPoly (void);
  129. void D_DrawSprite (void);
  130. void D_DrawSurfaces (void);
  131. void D_DrawZPoint (void);
  132. void D_EnableBackBufferAccess (void);
  133. void D_EndParticles (void);
  134. void D_Init (void);
  135. void D_ViewChanged (void);
  136. void D_SetupFrame (void);
  137. void D_StartParticles (void);
  138. void D_TurnZOn (void);
  139. void D_WarpScreen (void);
  140. void D_FillRect (vrect_t *vrect, int color);
  141. void D_DrawRect (void);
  142. void D_UpdateRects (vrect_t *prect);
  143. // currently for internal use only, and should be a do-nothing function in
  144. // hardware drivers
  145. // FIXME: this should go away
  146. void D_PolysetUpdateTables (void);
  147. // these are currently for internal use only, and should not be used by drivers
  148. extern int r_skydirect;
  149. extern byte *r_skysource;
  150. // transparency types for D_DrawRect ()
  151. #define DR_SOLID 0
  152. #define DR_TRANSPARENT 1
  153. // !!! must be kept the same as in quakeasm.h !!!
  154. #define TRANSPARENT_COLOR 0xFF
  155. extern void *acolormap; // FIXME: should go away
  156. //=======================================================================//
  157. // callbacks to Quake
  158. typedef struct
  159. {
  160. pixel_t *surfdat; // destination for generated surface
  161. int rowbytes; // destination logical width in bytes
  162. msurface_t *surf; // description for surface to generate
  163. fixed8_t lightadj[MAXLIGHTMAPS];
  164. // adjust for lightmap levels for dynamic lighting
  165. texture_t *texture; // corrected for animating textures
  166. int surfmip; // mipmapped ratio of surface texels / world pixels
  167. int surfwidth; // in mipmapped texels
  168. int surfheight; // in mipmapped texels
  169. } drawsurf_t;
  170. extern drawsurf_t r_drawsurf;
  171. void R_DrawSurface (void);
  172. void R_GenTile (msurface_t *psurf, void *pdest);
  173. // !!! if this is changed, it must be changed in d_ifacea.h too !!!
  174. #define TURB_TEX_SIZE 64 // base turbulent texture size
  175. // !!! if this is changed, it must be changed in d_ifacea.h too !!!
  176. #define CYCLE 128 // turbulent cycle size
  177. #define TILE_SIZE 128 // size of textures generated by R_GenTiledSurf
  178. #define SKYSHIFT 7
  179. #define SKYSIZE (1 << SKYSHIFT)
  180. #define SKYMASK (SKYSIZE - 1)
  181. extern float skyspeed, skyspeed2;
  182. extern float skytime;
  183. extern int c_surf;
  184. extern vrect_t scr_vrect;
  185. extern byte *r_warpbuffer;