]> icculus.org git repositories - taylor/freespace2.git/blob - include/tmapscanline.h
Initial revision
[taylor/freespace2.git] / include / tmapscanline.h
1 /*
2  * $Logfile: /Freespace2/code/Graphics/TmapScanline.h $
3  * $Revision$
4  * $Date$
5  * $Author$
6  *
7  * Header file for tmapscanline.cpp.
8  *
9  * $Log$
10  * Revision 1.1  2002/05/03 03:28:12  root
11  * Initial revision
12  *
13  * 
14  * 2     10/07/98 10:53a Dave
15  * Initial checkin.
16  * 
17  * 1     10/07/98 10:49a Dave
18  * 
19  * 25    5/13/98 2:53p John
20  * Made subspace effect work under software.  Had to add new inner loop to
21  * tmapper.  Added glows to end of subspace effect.  Made subspace effect
22  * levels use gamepalette-subspace palette.
23  * 
24  * 24    4/10/98 5:20p John
25  * Changed RGB in lighting structure to be ubytes.  Removed old
26  * not-necessary 24 bpp software stuff.
27  * 
28  * 23    3/22/98 2:33p John
29  * Took out fx_v/v_right.  Made fx_u etc get calculated in tmapper.
30  * 
31  * 22    3/10/98 4:19p John
32  * Cleaned up graphics lib.  Took out most unused gr functions.   Made D3D
33  * & Glide have popups and print screen.  Took out all >8bpp software
34  * support.  Made Fred zbuffer.  Made zbuffer allocate dynamically to
35  * support Fred.  Made zbuffering key off of functions rather than one
36  * global variable.
37  * 
38  * 21    12/15/97 11:32a John
39  * New Laser Code
40  * 
41  * 20    12/02/97 4:00p John
42  * Added first rev of thruster glow, along with variable levels of
43  * translucency, which retquired some restructing of palman.
44  * 
45  * 19    11/30/97 3:57p John
46  * Made fixed 32-bpp translucency.  Made BmpMan always map translucent
47  * color into 255 even if you aren't supposed to remap and make it's
48  * palette black.
49  * 
50  * 18    11/21/97 11:32a John
51  * Added nebulas.   Fixed some warpout bugs.
52  * 
53  * 17    10/16/97 10:55a John
54  * added tmapper to draw a monochrome alpha blended bitmap.
55  * 
56  * 16    3/14/97 3:55p John
57  * Made tiled tmapper not always be zbuffered.
58  * 
59  * 15    3/13/97 10:32a John
60  * Added code for tiled 256x256 textures in certain models.
61  * 
62  * 14    3/05/97 7:15p John
63  * took out the old z stop tmapper used for briefing. 
64  * 
65  * 13    1/20/97 4:17p John
66  * 
67  * 12    1/06/97 2:44p John
68  * Added in slow (but correct) zbuffering
69  * 
70  * 11    12/10/96 10:37a John
71  * Restructured texture mapper to remove some overhead from each scanline
72  * setup.  This gave about a 30% improvement drawing trans01.pof, which is
73  * a really complex model.  In the process, I cleaned up the scanline
74  * functions and separated them into different modules for each pixel
75  * depth.   
76  * 
77  * 10    11/26/96 6:50p John
78  * Added some more hicolor primitives.  Made windowed mode run as current
79  * bpp, if bpp is 8,16,or 32.
80  * 
81  * 9     11/07/96 6:19p John
82  * Added a bunch of 16bpp primitives so the game sort of runs in 16bpp
83  * mode.
84  * 
85  * 8     11/05/96 4:05p John
86  * Added roller.  Added code to draw a distant planet.  Made bm_load
87  * return -1 if invalid bitmap.
88  * 
89  * 7     10/31/96 7:20p John
90  * Added per,tiled tmapper.  Made models tile if they use 64x64 textures.
91  * 
92  * 6     10/26/96 1:40p John
93  * Added some now primitives to the 2d library and
94  * cleaned up some old ones.
95  *
96  * $NoKeywords: $
97  */
98
99
100 #ifndef _TMAPSCANLINE_H
101 #define _TMAPSCANLINE_H
102
103
104 typedef struct tmapper_vertex {
105         float sx, sy, sw, u, v, b;
106 } tmapper_vertex;
107
108 typedef struct tmapper_data {
109         // These are filled once for each texture map being drawn.
110         // The inner loop cannot change any of these!!
111         int             nv;                                             // number of vertices
112         ubyte           *pixptr;
113         bitmap  *bp;
114         int             src_offset;
115         uint            flags;
116         float           FixedScale;                             // constant for asm inner loop
117         float           FixedScale8;                    // constant for asm inner loop
118         float           One;                                            // constant for asm inner loop
119
120         // This are filled in by the outer loop before each scan line.
121         int             loop_count;
122         tmapper_vertex  l, r, dl, dr, deltas;
123         int             lx, rx, y;
124         float           clipped_left;                   // how many pixels were clipped off the left in 2d.
125
126         // These are used internally by the assembly texture mapper.
127         fix             fx_l, fx_l_right, fx_dl_dx;
128         fix             fx_u, fx_v, fx_du_dx, fx_dv_dx;
129         float           fl_dudx_wide;
130         float           fl_dvdx_wide;
131         float           fl_dwdx_wide;
132         uint            dest_row_data;
133         int             num_big_steps;
134         uint            uv_delta[2];
135         float           FloatTemp;
136         uint            Subdivisions;
137         uint            WidthModLength;
138         uint            BlendLookup;
139         uint            FadeLookup;
140         uint            DeltaU;
141         uint            DeltaV;
142         uint            DeltaUFrac, DeltaVFrac;
143    uint         UFixed;
144         uint            VFixed;
145    ushort       FPUCW;
146         ushort  OldFPUCW;
147         int             InnerLooper;
148         uint            pScreenBits;
149         int             fx_w;
150         int             fx_dwdx;
151
152         uint            saved_esp;
153         uint            lookup;
154
155 } tmapper_data;
156
157 extern tmapper_data Tmap;
158
159 extern void tmapscan_generic();
160 extern void tmapscan_generic8();
161 //extern void tmapscan_pnn();
162 extern void tmapscan_pln();
163 extern void tmapscan_lln();
164 extern void tmapscan_flat();
165 extern void tmapscan_nebula8();
166 extern void tmapscan_flat_z();
167
168 extern void tmapscan_flat8();
169 extern void tmapscan_lln8();
170 extern void tmapscan_lnt8();
171 extern void tmapscan_lnn8();
172 extern void tmapscan_lnt8();
173 extern void tmapscan_lln8_tiled();
174 extern void tmapscan_llt8_tiled();
175 extern void tmapscan_pln8();
176 extern void tmapscan_plt8();
177
178 extern void tmapscan_lnaa8();
179
180 extern void tmapscan_pln8_tiled();
181
182 extern void tmapscan_lnn8_tiled_256x256();
183 extern void tmapscan_pnn8_tiled_256x256_subspace();
184
185 extern void tmapscan_flat_gouraud();
186
187 extern void tmapscan_nebula8();
188
189 #endif
190