]> icculus.org git repositories - taylor/freespace2.git/blob - include/tmapper.h
Initial revision
[taylor/freespace2.git] / include / tmapper.h
1 /*
2  * $Logfile: /Freespace2/code/Graphics/TMAPPER.H $
3  * $Revision$
4  * $Date$
5  * $Author$
6  *
7  * Header file for Tmapper.h
8  *
9  * $Log$
10  * Revision 1.1  2002/05/03 03:28:12  root
11  * Initial revision
12  *
13  * 
14  * 4     6/29/99 10:35a Dave
15  * Interface polygon bitmaps! Whee!
16  * 
17  * 3     12/06/98 2:36p Dave
18  * Drastically improved nebula fogging.
19  * 
20  * 2     10/07/98 10:53a Dave
21  * Initial checkin.
22  * 
23  * 1     10/07/98 10:49a Dave
24  * 
25  * 17    4/10/98 5:20p John
26  * Changed RGB in lighting structure to be ubytes.  Removed old
27  * not-necessary 24 bpp software stuff.
28  * 
29  * 16    4/09/98 7:58p John
30  * Cleaned up tmapper code a bit.   Put NDEBUG around some ndebug stuff.
31  * Took out XPARENT flag settings in all the alpha-blended texture stuff.
32  * 
33  * 15    4/09/98 4:38p John
34  * Made non-darkening and transparent textures work under Glide.  Fixed
35  * bug with Jim's computer not drawing any bitmaps.
36  * 
37  * 14    3/23/98 5:00p John
38  * Improved missile trails.  Made smooth alpha under hardware.  Made end
39  * taper.  Made trail touch weapon.
40  * 
41  * 13    11/21/97 11:32a John
42  * Added nebulas.   Fixed some warpout bugs.
43  * 
44  * 12    10/15/97 5:08p John
45  * added flag for alpha tmap
46  * 
47  * 11    3/10/97 5:20p John
48  * Differentiated between Gouraud and Flat shading.  Since we only do flat
49  * shading as of now, we don't need to interpolate L in the outer loop.
50  * This should save a few percent.
51  * 
52  * 10    3/05/97 7:15p John
53  * took out the old z stop tmapper used for briefing. 
54  * 
55  * 9     12/10/96 10:37a John
56  * Restructured texture mapper to remove some overhead from each scanline
57  * setup.  This gave about a 30% improvement drawing trans01.pof, which is
58  * a really complex model.  In the process, I cleaned up the scanline
59  * functions and separated them into different modules for each pixel
60  * depth.   
61  * 
62  * 8     11/07/96 2:17p John
63  * Took out the OldTmapper stuff.
64  * 
65  * 7     11/05/96 4:05p John
66  * Added roller.  Added code to draw a distant planet.  Made bm_load
67  * return -1 if invalid bitmap.
68  * 
69  * 6     10/26/96 1:40p John
70  * Added some now primitives to the 2d library and
71  * cleaned up some old ones.
72  *
73  * $NoKeywords: $
74  */
75
76 #ifndef _TMAPPER_H
77 #define _TMAPPER_H
78
79 // call this to reinit the scanline function pointers.
80 extern void tmapper_setup();
81
82 // Used to tell the tmapper what the current lighting values are
83 // if the TMAP_FLAG_RAMP or TMAP_FLAG_RGB are set and the TMAP_FLAG_GOURAUD 
84 // isn't set.   
85 void tmapper_set_light(vertex *v, uint flags);
86
87 // DO NOT CALL grx_tmapper DIRECTLY!!!! Only use the 
88 // gr_tmapper equivalent!!!!
89 extern void grx_tmapper( int nv, vertex * verts[], uint flags );
90
91 #define TMAP_MAX_VERTS  25              // Max number of vertices per polygon
92
93 // Flags to pass to g3_draw_??? routines
94 #define TMAP_FLAG_TEXTURED                      (1<<0)  // Uses texturing (Interpolate uv's)
95 #define TMAP_FLAG_CORRECT                       (1<<1)  // Perspective correct (Interpolate sw)
96 #define TMAP_FLAG_RAMP                          (1<<2)  // Use RAMP lighting (interpolate L)
97 #define TMAP_FLAG_RGB                           (1<<3)  // Use RGB lighting (interpolate RGB)
98 #define TMAP_FLAG_GOURAUD                       (1<<4)  // Lighting values differ on each vertex. 
99                                                                                                                 // If this is not set, then the texture mapper will use
100                                                                                                                 // the lighting parameters in each vertex, otherwise it
101                                                                                                                 // will use the ones specified in tmapper_set_??
102 #define TMAP_FLAG_XPARENT                       (1<<5)  // texture could have transparency
103 #define TMAP_FLAG_TILED                         (1<<6)  // This means uv's can be > 1.0
104 #define TMAP_FLAG_NEBULA                        (1<<7)  // Must be used with RAMP and GOURAUD.  Means l 0-1 is 0-31 palette entries
105
106
107 #define TMAP_HIGHEST_FLAG_BIT           7                       // The highest bit used in the TMAP_FLAGS
108 #define TMAP_MAX_SCANLINES                      (1<<(TMAP_HIGHEST_FLAG_BIT+1))
109
110 // Add any entries that don't work for software under here:
111 // Make sure to disable them at top of grx_tmapper
112 #define TMAP_FLAG_ALPHA                         (1<<8)  // Has an alpha component
113 #define TMAP_FLAG_NONDARKENING  (1<<9)  // RGB=255,255,255 doesn't darken
114
115 // flags for full nebula effect
116 #define TMAP_FLAG_PIXEL_FOG             (1<<10) // fog the polygon based upon the average pixel colors of the backbuffer behind it
117
118 // bitmap section
119 #define TMAP_FLAG_BITMAP_SECTION        (1<<11)
120
121 #endif
122