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