1 // light.hxx -- lighting routines
3 // Written by Curtis Olson, started April 1998.
5 // Copyright (C) 1998 Curtis L. Olson - curt@me.umn.edu
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 # error This library requires C++
44 #include <Include/fg_types.h>
45 #include <Math/interpolater.hxx>
48 // Define a structure containing the global lighting parameters
51 // Lighting look up tables (based on sun angle with local horizon)
52 fgINTERPTABLE *ambient_tbl;
53 fgINTERPTABLE *diffuse_tbl;
54 fgINTERPTABLE *sky_tbl;
58 ///////////////////////////////////////////////////////////
59 // position of the sun in various forms
61 // in geocentric coordinates
62 double sun_lon, sun_gc_lat;
64 // in cartesian coordiantes
65 fgCartesianPoint3d fg_sunpos;
67 // (in view coordinates)
70 // inverse (in view coordinates)
71 GLfloat sun_vec_inv[4];
73 // the angle between the sun and the local horizontal
76 ///////////////////////////////////////////////////////////
77 // Derived lighting values
80 GLfloat scene_ambient[3];
83 GLfloat scene_diffuse[3];
94 // initialize lighting tables
97 // update lighting parameters based on current sun position
105 // Global shared light parameter structure
106 extern fgLIGHT cur_light_params;
109 // wrapper function for updating light parameters via the event scheduler
110 void fgLightUpdate ( void );
117 // Revision 1.4 1998/05/20 20:54:17 curt
118 // Converted fgLIGHT to a C++ class.
120 // Revision 1.3 1998/05/02 01:53:18 curt
121 // Fine tuning mktime() support because of varying behavior on different
124 // Revision 1.2 1998/04/24 00:52:31 curt
125 // Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
127 // Separated out lighting calcs into their own file.
129 // Revision 1.1 1998/04/22 13:24:06 curt
130 // C++ - ifiing the code a bit.
131 // Starting to reorginize some of the lighting calcs to use a table lookup.