d_local.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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_local.h: private rasterization driver defs
  16. #include "r_shared.h"
  17. //
  18. // TODO: fine-tune this; it's based on providing some overage even if there
  19. // is a 2k-wide scan, with subdivision every 8, for 256 spans of 12 bytes each
  20. //
  21. #define SCANBUFFERPAD 0x1000
  22. #define R_SKY_SMASK 0x007F0000
  23. #define R_SKY_TMASK 0x007F0000
  24. #define DS_SPAN_LIST_END -128
  25. #define SURFCACHE_SIZE_AT_320X200 600*1024
  26. typedef struct surfcache_s
  27. {
  28. struct surfcache_s *next;
  29. struct surfcache_s **owner; // NULL is an empty chunk of memory
  30. int lightadj[MAXLIGHTMAPS]; // checked for strobe flush
  31. int dlight;
  32. int size; // including header
  33. unsigned width;
  34. unsigned height; // DEBUG only needed for debug
  35. float mipscale;
  36. struct texture_s *texture; // checked for animating textures
  37. byte data[4]; // width*height elements
  38. } surfcache_t;
  39. // !!! if this is changed, it must be changed in asm_draw.h too !!!
  40. typedef struct sspan_s
  41. {
  42. int u, v, count;
  43. } sspan_t;
  44. extern cvar_t d_subdiv16;
  45. extern float scale_for_mip;
  46. extern qboolean d_roverwrapped;
  47. extern surfcache_t *sc_rover;
  48. extern surfcache_t *d_initial_rover;
  49. extern float d_sdivzstepu, d_tdivzstepu, d_zistepu;
  50. extern float d_sdivzstepv, d_tdivzstepv, d_zistepv;
  51. extern float d_sdivzorigin, d_tdivzorigin, d_ziorigin;
  52. fixed16_t sadjust, tadjust;
  53. fixed16_t bbextents, bbextentt;
  54. void D_DrawSpans8 (espan_t *pspans);
  55. void D_DrawSpans16 (espan_t *pspans);
  56. void D_DrawZSpans (espan_t *pspans);
  57. void Turbulent8 (espan_t *pspan);
  58. void D_SpriteDrawSpans (sspan_t *pspan);
  59. void D_DrawSkyScans8 (espan_t *pspan);
  60. void D_DrawSkyScans16 (espan_t *pspan);
  61. void R_ShowSubDiv (void);
  62. void (*prealspandrawer)(void);
  63. surfcache_t *D_CacheSurface (msurface_t *surface, int miplevel);
  64. extern int D_MipLevelForScale (float scale);
  65. #if id386
  66. extern void D_PolysetAff8Start (void);
  67. extern void D_PolysetAff8End (void);
  68. #endif
  69. extern short *d_pzbuffer;
  70. extern unsigned int d_zrowbytes, d_zwidth;
  71. extern int *d_pscantable;
  72. extern int d_scantable[MAXHEIGHT];
  73. extern int d_vrectx, d_vrecty, d_vrectright_particle, d_vrectbottom_particle;
  74. extern int d_y_aspect_shift, d_pix_min, d_pix_max, d_pix_shift;
  75. extern pixel_t *d_viewbuffer;
  76. extern short *zspantable[MAXHEIGHT];
  77. extern int d_minmip;
  78. extern float d_scalemip[3];
  79. extern void (*d_drawspans) (espan_t *pspan);