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/pertyp.h $ 21 * $Revision: 1.3 $ 22 * $Author: kevin $ 23 * $Date: 1994/07/20 23:07:19 $ 24 * 25 * Perspective mapper public data structures. 26 * 27 * This file is part of the 2d library. 28 * 29 * $Log: pertyp.h $ 30 * Revision 1.3 1994/07/20 23:07:19 kevin 31 * Added fill_parm as synonym for clut in grs_per_info and grs_per_setup structures. 32 * 33 * Revision 1.2 1994/07/04 01:37:24 kevin 34 * added new structure. 35 * 36 * Revision 1.1 1993/12/14 22:35:12 kevin 37 * Initial revision 38 * 39 */ 40 41 /* Perspective mapper context structure. */ 42 43 #ifndef __PERTYP_H 44 #define __PERTYP_H 45 46 #include "grs.h" 47 48 typedef struct { 49 grs_point3d normal; 50 grs_point3d u_grad; 51 grs_point3d v_grad; 52 } grs_per_context; 53 54 /*********************************************************/ 55 /* these are variables such that for screen coords x,y: */ 56 /* u=u0+(alpha_u*x+beta_u*y+gamma_u)/(a*x+b*y+c) */ 57 /* v=v0+(alpha_v*x+beta_v*y+gamma_v)/(a*x+b*y+c) */ 58 /* and lines of constant z are given by a*x+b*y=k */ 59 /* so scan_slope= -a/b for hscan, -b/a for vscan, */ 60 /* and its magnitude is always <= 1. */ 61 /*********************************************************/ 62 typedef struct { 63 void (*scanline_func)(); /* function to do scanline. */ 64 void (*shell_func)(); /* perspective mapping shell. */ 65 union {uchar *clut; intptr_t fill_parm;}; 66 fix scan_slope; 67 int dp; 68 fix alpha_u; 69 fix beta_u; 70 fix gamma_u; 71 fix alpha_v; 72 fix beta_v; 73 fix gamma_v; 74 fix a; 75 fix b; 76 fix c; 77 } grs_per_setup; 78 79 typedef struct { 80 uchar *p_dst_final; 81 int p_dst_off; 82 union {fix y_fix,x_fix;}; 83 fix u,du,v,dv,i,di; 84 fix u0,v0; 85 union {uchar *clut; intptr_t fill_parm;}; 86 fix unum,vnum,dunum,dvnum,denom; 87 fix dxl,dyl,dtl,dxr,dyr,dtr; 88 fix cl,cr; 89 fix scan_slope; 90 int dp; 91 union {int yp,xp;}; 92 union {int x,y;}; 93 union {int xl,yl;}; 94 union {int xr,yr;}; 95 union {int xr0,yr0;}; 96 int u_mask,v_mask,v_shift; 97 int scale; 98 } grs_per_info; 99 100 #endif /* !__PERTYP_H */ 101 102 103