r_draw.h.svn-base 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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. #ifdef __GNUG__
  37. #pragma interface
  38. #endif
  39. enum column_pipeline_e {
  40. RDC_PIPELINE_STANDARD,
  41. RDC_PIPELINE_TRANSLUCENT,
  42. RDC_PIPELINE_TRANSLATED,
  43. RDC_PIPELINE_FUZZ,
  44. RDC_PIPELINE_MAXPIPELINES,
  45. };
  46. // Used to specify what kind of filering you want
  47. enum draw_filter_type_e {
  48. RDRAW_FILTER_NONE,
  49. RDRAW_FILTER_POINT,
  50. RDRAW_FILTER_LINEAR,
  51. RDRAW_FILTER_ROUNDED,
  52. RDRAW_FILTER_MAXFILTERS
  53. };
  54. // Used to specify what kind of column edge rendering to use on masked
  55. // columns. SQUARE = standard, SLOPED = slope the column edge up or down
  56. // based on neighboring columns
  57. enum sloped_edge_type_e {
  58. RDRAW_MASKEDCOLUMNEDGE_SQUARE,
  59. RDRAW_MASKEDCOLUMNEDGE_SLOPED
  60. };
  61. // Packaged into a struct - POPE
  62. typedef struct {
  63. int x;
  64. int yl;
  65. int yh;
  66. fixed_t z; // the current column z coord
  67. fixed_t iscale;
  68. fixed_t texturemid;
  69. int texheight; // killough
  70. fixed_t texu; // the current column u coord
  71. const byte *source; // first pixel in a column
  72. const byte *prevsource; // first pixel in previous column
  73. const byte *nextsource; // first pixel in next column
  74. const lighttable_t *colormap;
  75. const lighttable_t *nextcolormap;
  76. const byte *translation;
  77. int edgeslope; // OR'ed RDRAW_EDGESLOPE_*
  78. // 1 if R_DrawColumn* is currently drawing a masked column, otherwise 0
  79. int drawingmasked;
  80. enum sloped_edge_type_e edgetype;
  81. } draw_column_vars_t;
  82. void R_SetDefaultDrawColumnVars(draw_column_vars_t *dcvars);
  83. void R_VideoErase(int x, int y, int count);
  84. typedef struct {
  85. int y;
  86. int x1;
  87. int x2;
  88. fixed_t z; // the current span z coord
  89. fixed_t xfrac;
  90. fixed_t yfrac;
  91. fixed_t xstep;
  92. fixed_t ystep;
  93. const byte *source; // start of a 64*64 tile image
  94. const lighttable_t *colormap;
  95. const lighttable_t *nextcolormap;
  96. } draw_span_vars_t;
  97. typedef struct {
  98. byte *byte_topleft;
  99. unsigned short *short_topleft;
  100. unsigned int *int_topleft;
  101. int byte_pitch;
  102. int short_pitch;
  103. int int_pitch;
  104. enum draw_filter_type_e filterwall;
  105. enum draw_filter_type_e filterfloor;
  106. enum draw_filter_type_e filtersprite;
  107. enum draw_filter_type_e filterz;
  108. enum draw_filter_type_e filterpatch;
  109. enum sloped_edge_type_e sprite_edges;
  110. enum sloped_edge_type_e patch_edges;
  111. // Used to specify an early-out magnification threshold for filtering.
  112. // If a texture is being minified (dcvars.iscale > rdraw_magThresh), then it
  113. // drops back to point filtering.
  114. fixed_t mag_threshold;
  115. } draw_vars_t;
  116. extern draw_vars_t drawvars;
  117. extern byte playernumtotrans[MAXPLAYERS]; // CPhipps - what translation table for what player
  118. extern byte *translationtables;
  119. typedef void (*R_DrawColumn_f)(draw_column_vars_t *dcvars);
  120. R_DrawColumn_f R_GetDrawColumnFunc(enum column_pipeline_e type,
  121. enum draw_filter_type_e filter,
  122. enum draw_filter_type_e filterz);
  123. // Span blitting for rows, floor/ceiling. No Spectre effect needed.
  124. typedef void (*R_DrawSpan_f)(draw_span_vars_t *dsvars);
  125. R_DrawSpan_f R_GetDrawSpanFunc(enum draw_filter_type_e filter,
  126. enum draw_filter_type_e filterz);
  127. void R_DrawSpan(draw_span_vars_t *dsvars);
  128. void R_InitBuffer(int width, int height);
  129. // Initialize color translation tables, for player rendering etc.
  130. void R_InitTranslationTables(void);
  131. // Rendering function.
  132. void R_FillBackScreen(void);
  133. // If the view size is not full screen, draws a border around it.
  134. void R_DrawViewBorder(void);
  135. // haleyjd 09/13/04: new function to call from main rendering loop
  136. // which gets rid of the unnecessary reset of various variables during
  137. // column drawing.
  138. void R_ResetColumnBuffer(void);
  139. #endif