1 /* 2 3 Copyright (C) 2015-2018 Night Dive Studios, LLC. 4 5 This program is free software: you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation, either version 3 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 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, see <http://www.gnu.org/licenses/>. 17 18 */ 19 /* 20 * $Source: r:/prj/lib/src/2d/RCS/flat8.h $ 21 * $Revision: 1.50 $ 22 * $Author: kevin $ 23 * $Date: 1994/08/16 15:31:34 $ 24 * 25 * Prototypes for routines for drawing into flat8 bitmaps. 26 * 27 * This file is part of the 2d library. 28 * 29 * $Log: flat8.h $ 30 * Revision 1.50 1994/08/16 15:31:34 kevin 31 * removed obsolete scaler function declarations. 32 * 33 * Revision 1.49 1994/07/18 17:05:21 kevin 34 * Moved temp_ functions to general.h. 35 * 36 * Revision 1.48 1994/04/09 07:19:32 lmfeeney 37 * added routines for scaled mono bitmaps 38 * 39 * Revision 1.47 1994/03/29 17:31:21 kevin 40 * Added doofy floor and wall mapper chaining primitives. 41 * 42 * Revision 1.46 1994/03/15 13:07:34 kevin 43 * Added clut_bitmap procedures. 44 * 45 * Revision 1.45 1994/03/14 17:58:22 kevin 46 * Added declarations for bitmap doubling routines. 47 * 48 * Revision 1.44 1994/02/26 22:50:39 kevin 49 * Fixed declarations for texture mapping functions. 50 * 51 * Revision 1.43 1994/02/24 22:22:33 baf 52 * Added tluc8 clut scaler. 53 * 54 * Revision 1.42 1994/02/14 20:38:35 baf 55 * Added dummy parameter to cpoly and spoly routines, for uniformity needed by 56 * 3D. 57 * 58 * Revision 1.41 1994/01/17 22:13:16 baf 59 * Redid tluc8 spolys (again). 60 * 61 * Revision 1.40 1994/01/13 12:18:47 kevin 62 * Added new scaling primitives. 63 * 64 * Revision 1.39 1994/01/05 04:30:45 kevin 65 * new lit linear mapper. 66 * 67 * Revision 1.38 1994/01/03 23:32:03 kevin 68 * Added prototypes for new temorary chaining primitives. 69 * 70 * Revision 1.37 1993/12/30 11:04:28 baf 71 * non/span solid filled polygons 72 * 73 * Revision 1.36 1993/12/28 22:04:29 baf 74 * Added solid RSD stuff 75 * 76 * Revision 1.35 1993/12/04 17:29:57 kevin 77 * Added clut_per_umap declaration. 78 * 79 * Revision 1.34 1993/12/04 12:14:19 kevin 80 * Added declarations for clut wall and floor mappers. 81 * .. 82 * 83 * Revision 1.33 1993/12/01 21:18:56 baf 84 * Added some tluc8 stuff. 85 * 86 * Revision 1.32 1993/11/24 01:49:05 kevin 87 * Added declarations for wall and floor texture mapping primitives. 88 * 89 * Revision 1.31 1993/11/18 23:31:25 kevin 90 * Changed flat8 perspective mapper names in honor of installing 91 * working versions of eric's spiffy algorithm. 92 * 93 * Revision 1.30 1993/11/10 22:46:55 kevin 94 * Added declaration for flat8 clut scaler. 95 * 96 * Revision 1.29 1993/10/26 02:09:10 kevin 97 * Added prototypes for rsd bitmap scaling and clut-scaling primitives. 98 * 99 * Revision 1.28 1993/10/20 15:20:29 kaboom 100 * Updated prototypes for spoly routines. 101 * 102 * Revision 1.27 1993/10/19 09:56:04 kaboom 103 * Updated names of polygon routines. 104 * 105 * Revision 1.26 1993/10/08 00:37:46 kevin 106 * Added declaration for clut linear mapper optimized for flat8 canvasses. 107 * 108 * Revision 1.25 1993/10/06 13:28:30 kevin 109 * Added clut version of hflip routine. 110 * 111 * Revision 1.24 1993/10/02 01:58:13 kaboom 112 * Put accidentally deleted prototype for flat8_lin_lit_utmap() back in. 113 * 114 * Revision 1.23 1993/10/01 16:02:12 kaboom 115 * Updated names for linear and perspective mappers. 116 * 117 * Revision 1.22 1993/09/08 21:48:34 kaboom 118 * Added prototype for flat8_lin_lit_utmap(). 119 * 120 * Revision 1.21 1993/09/07 17:45:18 kaboom 121 * Renamed flat8_lin_umap to flat8_flat8_lin_umap(). 122 * 123 * Revision 1.20 1993/09/02 20:04:44 kaboom 124 * Added prototypes for 24-bit pixel routines. 125 * 126 * Revision 1.19 1993/08/10 19:06:30 kaboom 127 * Added prototype for flat8_lit_utmap. 128 * 129 * Revision 1.18 1993/08/05 20:07:09 jaemz 130 * Added fl8ntrp2 and fl8fltr2 131 * 132 * Revision 1.17 1993/07/01 22:11:05 spaz 133 * Added prototypes for fl8clin, fl8slin 134 * 135 * Revision 1.16 1993/06/14 14:09:38 kaboom 136 * Added prototypes for new lin_{u}map and lin_lit_lin_{u}map routines. 137 * 138 * Revision 1.15 1993/06/06 15:10:56 kaboom 139 * Added prototype for flat8_hflip_flat8_ubitmap(). 140 * 141 * Revision 1.14 1993/05/03 13:50:16 kaboom 142 * Moved declarations for span rendering routines to different file. 143 * 144 * Revision 1.13 1993/03/29 18:29:54 kaboom 145 * Removed convex_ from polygon scanner names. 146 * 147 * Revision 1.12 1993/03/02 19:44:55 kaboom 148 * Took out prototype for flat8_int_uline(). 149 * 150 * Revision 1.11 1993/02/26 17:51:53 kaboom 151 * Added prototype for flat8_fix_convex_upoly. 152 * 153 * Revision 1.10 1993/02/25 12:58:54 kaboom 154 * Added prototypes for flat 8 Gouraud shaders. 155 * 156 * Revision 1.9 1993/02/24 11:02:47 kaboom 157 * Added prototypes for more span functions. 158 * 159 * Revision 1.8 1993/02/22 20:31:28 kaboom 160 * Added prototypes for flat 8 span routines. 161 * 162 * Revision 1.7 1993/02/16 14:30:33 kaboom 163 * Added prototype for flat8_urect(). 164 * 165 * Revision 1.6 1993/01/07 21:04:21 kaboom 166 * Moved declaration for flat8_func here. 167 * 168 * Revision 1.5 1992/12/30 15:11:51 kaboom 169 * Added prototypes for flat8_calc_vram() and flat8_calc_row(). 170 * 171 * Revision 1.4 1992/12/14 18:12:45 kaboom 172 * Added prototype for flat8_sub_bm(). 173 * 174 * Revision 1.3 1992/12/11 13:19:29 kaboom 175 * Added prototype for flat8_get_flat8_ubitmap. 176 * 177 * Revision 1.2 1992/11/19 09:15:16 kaboom 178 * Corrected typo---flat8_upoint occurred twice. 179 * 180 * Revision 1.1 1992/11/19 02:34:30 kaboom 181 * Initial revision 182 */ 183 184 #ifndef __FLAT8_H 185 #define __FLAT8_H 186 #include "grs.h" 187 #include "plytyp.h" 188 #include "tmapint.h" 189 190 /* 8-bit pixel prototypes. */ 191 extern void flat8_set_upixel(long color, short x, short y); 192 extern int flat8_set_pixel(long color, short x, short y); 193 extern long flat8_get_upixel(short x, short y); 194 extern long flat8_get_pixel(short x, short y); 195 196 /* 24-bit pixel prototypes. */ 197 extern void flat8_set_upixel24(long color, short x, short y); 198 extern int flat8_set_pixel24(long color, short x, short y); 199 extern long flat8_get_upixel24(short x, short y); 200 extern long flat8_get_pixel24(short x, short y); 201 202 /* straight, rectangular-type primitives. */ 203 extern void flat8_clear(long color); 204 extern void flat8_upoint(short x, short y); 205 extern int flat8_point(short x, short y); 206 extern void flat8_uhline(short x0, short y0, short x1); 207 extern void flat8_uvline(short x0, short y0, short y1); 208 extern void flat8_urect(short left, short top, short right, short bot); 209 210 /* fixed-point rendering-type primitives. */ 211 extern void flat8_fix_uline(fix x0, fix y0, fix x1, fix y1); 212 extern void flat8_fix_usline(fix x0, fix y0, fix i0, fix x1, fix y1, fix i1); 213 extern void flat8_fix_ucline(fix x0, fix y0, grs_rgb c0, fix x1, fix y1, grs_rgb c1); 214 extern void flat8_upoly(long c, int n, grs_vertex **vpl); 215 extern void flat8_uspoly(long c, int n, grs_vertex **vpl); 216 extern void flat8_ucpoly(long c, int n, grs_vertex **vpl); 217 extern void flat8_interp2_ubitmap(grs_bitmap *bm); 218 extern void flat8_filter2_ubitmap(grs_bitmap *bm); 219 extern void flat8_tluc8_upoly(long c, int n, grs_vertex **vpl); 220 extern void flat8_tluc8_uspoly(long c, int n, grs_vertex **vpl); 221 222 extern void flat8_flat8_lin_umap(grs_bitmap *bm, int n, grs_vertex **vpl); 223 extern void flat8_lit_lin_umap(grs_bitmap *bm, int n, grs_vertex **vpl); 224 extern void flat8_clut_lin_umap(grs_bitmap *bm, int n, grs_vertex **vpl, uchar *cl); 225 extern void flat8_flat8_solid_lin_umap(grs_bitmap *bm, int n, grs_vertex **vpl, int c); 226 227 extern void flat8_flat8_wall_umap(grs_bitmap *bm, int n, grs_vertex **vpl); 228 extern void flat8_flat8_lit_wall_umap(grs_bitmap *bm, int n, grs_vertex **vpl); 229 extern void flat8_flat8_clut_wall_umap(grs_bitmap *bm, int n, grs_vertex **vpl, uchar *cl); 230 231 extern void flat8_flat8_floor_umap(grs_bitmap *bm, int n, grs_vertex **vpl); 232 extern void flat8_flat8_lit_floor_umap(grs_bitmap *bm, int n, grs_vertex **vpl); 233 extern void flat8_flat8_clut_floor_umap(grs_bitmap *bm, int n, grs_vertex **vpl, uchar *cl); 234 235 extern int flat8_flat8_per_umap(grs_bitmap *bm, int n, grs_vertex **vpl); 236 extern int flat8_flat8_lit_per_umap(grs_bitmap *bm, int n, grs_vertex **vpl); 237 extern int flat8_flat8_clut_per_umap(grs_bitmap *bm, int n, grs_vertex **vpl, uchar *cl); 238 extern int flat8_flat8_solid_per_umap(grs_bitmap *bm, int n, grs_vertex **vpl, int c); 239 240 extern void flat8_lin_lit_utmap(int n, fix *vlist, grs_bitmap *bm, fix *m, fix *l); 241 242 extern void flat8_scale_ubitmap(grs_bitmap *bm, short x, short y, short w, short h); 243 extern int flat8_scale_bitmap(grs_bitmap *bm, short x, short y, short w, short h); 244 245 extern void flat8_mono_scale_ubitmap(grs_bitmap *bm, short x, short y, short w, short h); 246 extern int flat8_mono_scale_bitmap(grs_bitmap *bm, short x, short y, short w, short h); 247 248 extern void flat8_rsd8_scale_ubitmap(grs_bitmap *bm, short x, short y, short w, short h); 249 extern int flat8_rsd8_scale_bitmap(grs_bitmap *bm, short x, short y, short w, short h); 250 251 extern void flat8_flat8_clut_scale_ubitmap(grs_bitmap *bm, short x, short y, short w, short h, uchar *cl); 252 253 extern void flat8_rsd8_clut_scale_ubitmap(grs_bitmap *bm, short x, short y, short w, short h, uchar *cl); 254 extern int flat8_rsd8_clut_scale_bitmap(grs_bitmap *bm, short x, short y, short w, short h, uchar *cl); 255 256 extern void flat8_rsd8_scale_solid_ubitmap(grs_bitmap *bm, short x, short y, short w, short h, int c); 257 extern int flat8_rsd8_scale_solid_bitmap(grs_bitmap *bm, short x, short y, short w, short h, int c); 258 259 extern void flat8_tluc8_scale_ubitmap(grs_bitmap *bm, short x, short y, short w, short h); 260 extern int flat8_tluc8_scale_bitmap(grs_bitmap *bm, short x, short y, short w, short h); 261 262 extern void flat8_tluc8_clut_scale_ubitmap(grs_bitmap *bm, short x, short y, short w, short h, uchar *cl); 263 extern int flat8_tluc8_clut_scale_bitmap(grs_bitmap *bm, short x, short y, short w, short h, uchar *cl); 264 265 // internal scaler/mapper prototypes 266 int gri_opaque_solid_scale_umap_init(grs_tmap_loop_info *info, grs_vertex **vert); 267 int gri_trans_scale_umap_init(grs_tmap_loop_info *, grs_vertex **); 268 int gri_trans_solid_scale_umap_init(grs_tmap_loop_info *info, grs_vertex **vert); 269 int gri_opaque_scale_umap_init(grs_tmap_loop_info *tli); 270 int gri_trans_clut_scale_umap_init(grs_tmap_loop_info *tli); 271 int gri_opaque_clut_scale_umap_init(grs_tmap_loop_info *tli); 272 273 /* bitmap drawing functions. */ 274 extern void flat8_mono_ubitmap(grs_bitmap *bm, short x, short y); 275 extern void flat8_flat8_ubitmap(grs_bitmap *bm, short x, short y); 276 extern void flat8_rsd8_ubitmap(grs_bitmap *bm, short x, short y); 277 extern void flat8_tluc8_ubitmap(grs_bitmap *bm, short x, short y); 278 extern int flat8_rsd8_bitmap(grs_bitmap *bm, short x, short y); 279 280 extern void flat8_flat8_clut_ubitmap(grs_bitmap *bm, short x, short y, uchar *cl); 281 282 extern void flat8_rsd8_solid_ubitmap(grs_bitmap *bm, short x, short y, int c); 283 extern int flat8_rsd8_solid_bitmap(grs_bitmap *bm, short x, short y, int c); 284 285 /* bitmap get routines. */ 286 extern void flat8_get_flat8_ubitmap(grs_bitmap *bm, short x, short y); 287 288 /* bitmap horizontal flip routines. */ 289 extern void flat8_hflip_flat8_ubitmap(grs_bitmap *bm, short x, short y); 290 291 /* bitmap color lookup table horizontal flip routines. */ 292 extern void flat8_clut_hflip_flat8_ubitmap(grs_bitmap *bm, short x, short y, uchar *cl); 293 294 /* device-specific routines. */ 295 extern short flat8_calc_row(short w); 296 extern grs_bitmap *flat8_sub_bitmap(grs_bitmap *bm, short x, short y, short w, short h); 297 298 /* bitmap doubling routines. */ 299 extern void flat8_flat8_h_double_ubitmap(grs_bitmap *bm); 300 extern void flat8_flat8_smooth_h_double_ubitmap(grs_bitmap *srcb, grs_bitmap *dst); 301 extern void flat8_flat8_smooth_hv_double_ubitmap(grs_bitmap *src, grs_bitmap *dst); 302 303 extern void flat8_flat8_v_double_ubitmap(grs_bitmap *bm); 304 extern void flat8_flat8_hv_double_ubitmap(grs_bitmap *bm); 305 extern void flat8_flat8_smooth_v_double_ubitmap(grs_bitmap *bm); 306 #endif /* !__FLAT8_H */ 307