2 * $Logfile: /Freespace2/code/Lighting/Lighting.h $
7 * Include file for lighting functions
10 * Revision 1.1 2002/05/03 03:28:12 root
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.
18 * 3 5/09/99 6:00p Dave
19 * Lots of cool new effects. E3 build tweaks.
21 * 2 10/07/98 10:53a Dave
24 * 1 10/07/98 10:49a Dave
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.
30 * 12 2/13/98 5:00p John
31 * Made lighting push functions return number of releveent lights.
33 * 11 1/29/98 8:14a John
34 * Added support for RGB lighting
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.
43 * 9 12/12/97 3:02p John
44 * First Rev of Ship Shadows
46 * 8 11/07/97 7:24p John
47 * changed lighting to take two ranges.
48 * In textest, added test code to draw nebulas
50 * 7 11/04/97 9:19p John
51 * Optimized dynamic lighting more.
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
58 * 5 4/08/97 5:18p John
59 * First rev of decent (dynamic, correct) lighting in FreeSpace.
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
65 * 3 1/30/97 9:35a Hoffoss
66 * Added header for files.
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.
85 void light_set_ambient(float ambient_light);
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();
95 // Reset the list of lights to point to all lights.
96 void light_filter_reset();
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();
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 );
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 );
114 // return the # of global light sources
115 int light_get_global_count();
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);
121 // Set to non-zero if we're in a shadow.
122 void light_set_shadow( int state );