]> icculus.org git repositories - taylor/freespace2.git/blob - include/lighting.h
Initial revision
[taylor/freespace2.git] / include / lighting.h
1 /*
2  * $Logfile: /Freespace2/code/Lighting/Lighting.h $
3  * $Revision$
4  * $Date$
5  * $Author$
6  *
7  * Include file for lighting functions
8  *
9  * $Log$
10  * Revision 1.1  2002/05/03 03:28:12  root
11  * Initial revision
12  *
13  * 
14  * 4     6/18/99 5:16p Dave
15  * Added real beam weapon lighting. Fixed beam weapon sounds. Added MOTD
16  * dialog to PXO screen.
17  * 
18  * 3     5/09/99 6:00p Dave
19  * Lots of cool new effects. E3 build tweaks.
20  * 
21  * 2     10/07/98 10:53a Dave
22  * Initial checkin.
23  * 
24  * 1     10/07/98 10:49a Dave
25  * 
26  * 13    4/10/98 5:20p John
27  * Changed RGB in lighting structure to be ubytes.  Removed old
28  * not-necessary 24 bpp software stuff.
29  * 
30  * 12    2/13/98 5:00p John
31  * Made lighting push functions return number of releveent lights.
32  * 
33  * 11    1/29/98 8:14a John
34  * Added support for RGB lighting
35  * 
36  * 10    1/23/98 5:08p John
37  * Took L out of vertex structure used B (blue) instead.   Took all small
38  * fireballs out of fireball types and used particles instead.  Fixed some
39  * debris explosion things.  Restructured fireball code.   Restructured
40  * some lighting code.   Made dynamic lighting on by default. Made groups
41  * of lasers only cast one light.  Made fireballs not cast light.
42  * 
43  * 9     12/12/97 3:02p John
44  * First Rev of Ship Shadows
45  * 
46  * 8     11/07/97 7:24p John
47  * changed lighting to take two ranges.
48  * In textest, added test code to draw nebulas
49  * 
50  * 7     11/04/97 9:19p John
51  * Optimized dynamic lighting more.
52  * 
53  * 6     10/29/97 5:05p John
54  * Changed dynamic lighting to only rotate and calculate lighting for
55  * point lights that are close to an object.  Changed lower framerate cap
56  * from 4 to .5.
57  * 
58  * 5     4/08/97 5:18p John
59  * First rev of decent (dynamic, correct) lighting in FreeSpace.
60  * 
61  * 4     2/17/97 5:18p John
62  * Added a bunch of RCS headers to a bunch of old files that don't have
63  * them.
64  * 
65  * 3     1/30/97 9:35a Hoffoss
66  * Added header for files.
67  *
68  * $NoKeywords: $
69  */
70
71 #ifndef _LIGHTING_H
72 #define _LIGHTING_H
73
74 // Light stuff works like this:
75 // At the start of the frame, call light_reset.
76 // For each light source, call light_add_??? functions.
77 // To calculate lighting, do:
78 // call light_filter_reset or light_filter.
79 // set up matrices with g3 functions
80 // call light_rotatate_all to rotate all valid
81 // lights into current coordinates.
82 // call light_apply to fill in lighting for a point.
83
84 void light_reset();
85 void light_set_ambient(float ambient_light);
86
87 // Intensity - how strong the light is.  1.0 will cast light around 5meters or so.
88 // r,g,b - only used for colored lighting. Ignored currently.
89 void light_add_directional( vector *dir, float intensity, float r, float g, float b );
90 void light_add_point( vector * pos, float r1, float r2, float intensity, float r, float g, float b, int ignore_objnum );
91 void light_add_point_unique( vector * pos, float r1, float r2, float intensity, float r, float g, float b, int affected_objnum);
92 void light_add_tube(vector *p0, vector *p1, float r1, float r2, float intensity, float r, float g, float b, int affected_objnum);
93 void light_rotate_all();
94
95 // Reset the list of lights to point to all lights.
96 void light_filter_reset();
97
98 // Makes a list of only the lights that will affect
99 // the sphere specified by 'pos' and 'rad' and 'objnum'.
100 // Returns number of lights active.
101 int light_filter_push( int objnum, vector *pos, float rad );
102 int light_filter_push_box( vector *min, vector *max );
103 void light_filter_pop();
104
105 // Applies light to a vertex.   In order for this to work, 
106 // it assumes that one of light_filter or light_filter_reset
107 // have been called.  It only uses 'vert' to fill in it's light
108 // fields.  'pos' is position of point, 'norm' is the norm.
109 ubyte light_apply( vector *pos, vector * norm, float static_light_val );
110
111 // Same as above only does RGB.
112 void light_apply_rgb( ubyte *param_r, ubyte *param_g, ubyte *param_b, vector *pos, vector * norm, float static_light_val );
113
114 // return the # of global light sources
115 int light_get_global_count();
116
117 // Fills direction of global light source N in pos.
118 // Returns 0 if there is no global light.
119 int light_get_global_dir(vector *pos, int n);
120
121 // Set to non-zero if we're in a shadow.
122 void light_set_shadow( int state );
123
124
125 #endif
126