Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

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