r_draw.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /* Emacs style mode select -*- C++ -*-
  2. *-----------------------------------------------------------------------------
  3. *
  4. *
  5. * PrBoom: a Doom port merged with LxDoom and LSDLDoom
  6. * based on BOOM, a modified and improved DOOM engine
  7. * Copyright (C) 1999 by
  8. * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
  9. * Copyright (C) 1999-2000 by
  10. * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
  11. * Copyright 2005, 2006 by
  12. * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
  13. *
  14. * This program is free software; you can redistribute it and/or
  15. * modify it under the terms of the GNU General Public License
  16. * as published by the Free Software Foundation; either version 2
  17. * of the License, or (at your option) any later version.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License
  25. * along with this program; if not, write to the Free Software
  26. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  27. * 02111-1307, USA.
  28. *
  29. * DESCRIPTION:
  30. * System specific interface stuff.
  31. *
  32. *-----------------------------------------------------------------------------*/
  33. #ifndef __R_DRAW__
  34. #define __R_DRAW__
  35. #include "r_defs.h"
  36. enum column_pipeline_e {
  37. RDC_PIPELINE_STANDARD,
  38. RDC_PIPELINE_TRANSLUCENT,
  39. RDC_PIPELINE_TRANSLATED,
  40. RDC_PIPELINE_FUZZ,
  41. RDC_PIPELINE_MAXPIPELINES,
  42. };
  43. // Used to specify what kind of filering you want
  44. enum draw_filter_type_e {
  45. RDRAW_FILTER_NONE,
  46. RDRAW_FILTER_POINT,
  47. RDRAW_FILTER_LINEAR,
  48. RDRAW_FILTER_ROUNDED,
  49. RDRAW_FILTER_MAXFILTERS
  50. };
  51. // Used to specify what kind of column edge rendering to use on masked
  52. // columns. SQUARE = standard, SLOPED = slope the column edge up or down
  53. // based on neighboring columns
  54. enum sloped_edge_type_e {
  55. RDRAW_MASKEDCOLUMNEDGE_SQUARE,
  56. RDRAW_MASKEDCOLUMNEDGE_SLOPED
  57. };
  58. // Packaged into a struct - POPE
  59. typedef struct {
  60. int x;
  61. int yl;
  62. int yh;
  63. fixed_t z; // the current column z coord
  64. fixed_t iscale;
  65. fixed_t texturemid;
  66. int texheight; // killough
  67. fixed_t texu; // the current column u coord
  68. const byte *source; // first pixel in a column
  69. const byte *prevsource; // first pixel in previous column
  70. const byte *nextsource; // first pixel in next column
  71. const lighttable_t *colormap;
  72. const lighttable_t *nextcolormap;
  73. const byte *translation;
  74. int edgeslope; // OR'ed RDRAW_EDGESLOPE_*
  75. // 1 if R_DrawColumn* is currently drawing a masked column, otherwise 0
  76. int drawingmasked;
  77. enum sloped_edge_type_e edgetype;
  78. } draw_column_vars_t;
  79. void R_SetDefaultDrawColumnVars(draw_column_vars_t *dcvars);
  80. void R_VideoErase(int x, int y, int count);
  81. typedef struct {
  82. int y;
  83. int x1;
  84. int x2;
  85. fixed_t z; // the current span z coord
  86. fixed_t xfrac;
  87. fixed_t yfrac;
  88. fixed_t xstep;
  89. fixed_t ystep;
  90. const byte *source; // start of a 64*64 tile image
  91. const lighttable_t *colormap;
  92. const lighttable_t *nextcolormap;
  93. } draw_span_vars_t;
  94. typedef struct {
  95. byte *byte_topleft;
  96. unsigned short *short_topleft;
  97. unsigned int *int_topleft;
  98. int byte_pitch;
  99. int short_pitch;
  100. int int_pitch;
  101. enum draw_filter_type_e filterwall;
  102. enum draw_filter_type_e filterfloor;
  103. enum draw_filter_type_e filtersprite;
  104. enum draw_filter_type_e filterz;
  105. enum draw_filter_type_e filterpatch;
  106. enum sloped_edge_type_e sprite_edges;
  107. enum sloped_edge_type_e patch_edges;
  108. // Used to specify an early-out magnification threshold for filtering.
  109. // If a texture is being minified (dcvars.iscale > rdraw_magThresh), then it
  110. // drops back to point filtering.
  111. fixed_t mag_threshold;
  112. } draw_vars_t;
  113. extern draw_vars_t drawvars;
  114. extern byte playernumtotrans[MAXPLAYERS]; // CPhipps - what translation table for what player
  115. extern byte *translationtables;
  116. typedef void (*R_DrawColumn_f)(draw_column_vars_t *dcvars);
  117. R_DrawColumn_f R_GetDrawColumnFunc(enum column_pipeline_e type,
  118. enum draw_filter_type_e filter,
  119. enum draw_filter_type_e filterz);
  120. // Span blitting for rows, floor/ceiling. No Spectre effect needed.
  121. typedef void (*R_DrawSpan_f)(draw_span_vars_t *dsvars);
  122. R_DrawSpan_f R_GetDrawSpanFunc(enum draw_filter_type_e filter,
  123. enum draw_filter_type_e filterz);
  124. void R_DrawSpan(draw_span_vars_t *dsvars);
  125. void R_InitBuffer(int width, int height);
  126. // Initialize color translation tables, for player rendering etc.
  127. void R_InitTranslationTables(void);
  128. // Rendering function.
  129. void R_FillBackScreen(void);
  130. // If the view size is not full screen, draws a border around it.
  131. void R_DrawViewBorder(void);
  132. // haleyjd 09/13/04: new function to call from main rendering loop
  133. // which gets rid of the unnecessary reset of various variables during
  134. // column drawing.
  135. void R_ResetColumnBuffer(void);
  136. #endif