00001 00011 /*** 00012 For each light in the glueconfig, specify: 00013 TYPE { POINT, DIRECTIONAL, SPOT } 00014 HEADTRACKED { YES, NO } 00015 AMBIENT <color> 00016 SPECULAR <color> 00017 DIFFUSE <color> 00018 00019 if not headtracked, specify: 00020 (note: pos for a directional light indicates direction. 00021 a value of <0,0,1> is a light shining in the -Z direction!) 00022 POS_X <x> 00023 POS_Y <y> 00024 POS_Z <z> 00025 00026 if type is a POINT or SPOT: 00027 CONSTANTATTEN <0.0 to inf> 00028 LINEARATTEN <0.0 to inf> 00029 QUADRATICATTEN <0.0 to inf> 00030 00031 if type is a SPOT: 00032 DIR_X <x> 00033 DIR_Y <y> 00034 DIR_Z <z> 00035 CUTOFF <0.0 to 90.0, or 180.0 to turn effect off> 00036 EXPONENT <0.0 to 128.0, 0.0 = uniform light distribution within the cone> 00037 00038 ***/ 00039 00040 00041 #ifndef LIGHTMGR_H 00042 #define LIGHTMGR_H 00043 00044 // Gluebase includes 00045 #define OUTSIDE_GLUE_CORE 00046 #include <std/hash.H> 00047 #include <std/strings.H> 00048 #include <mlib/points.H> 00049 #include "Color.H" 00050 00051 namespace InSpace { 00052 00053 #define SPOT_LIGHT_TYPE 2 00054 #define POINT_LIGHT_TYPE 1 00055 #define DIRECTIONAL_LIGHT_TYPE 0 00056 00057 class LIGHTMGR 00058 { 00059 public: 00060 static void parseGlueconfig(); 00061 00062 //method to update the position of head-tracked lights 00063 static void setHeadPos(Wpt hp); 00064 static void setHeadDir(Wvec dir); 00065 00066 static bool exists(int light); 00067 00068 //pt/direction of light 00069 static Wpt getPos(int light); 00070 static Wvec getDir(int light); 00071 static int getType(int light); 00072 00073 //colors for lights 00074 static Color getAmbient(int light); 00075 static Color getSpecular(int light); 00076 static Color getDiffuse(int light); 00077 00078 //spotlight characteristics 00079 static double getExponent(int light); 00080 static double getCutoff(int light); 00081 static double getConstantAtten(int light); 00082 static double getLinearAtten(int light); 00083 static double getQuadraticAtten(int light); 00084 00085 static int numLights() { return _type.num(); } 00086 00087 protected: 00088 static ARRAY<Wpt> _pos; 00089 static ARRAY<Wvec> _dir; 00090 00091 //point or directional or spot 00092 static ARRAY<int> _type; 00093 00094 //if true, then position is ignored 00095 static ARRAY<bool> _headTracked; 00096 00097 //color values for light 00098 static ARRAY<Color> _ambient; 00099 static ARRAY<Color> _specular; 00100 static ARRAY<Color> _diffuse; 00101 00102 //spotlight settings 00103 static ARRAY<double> _exponent; 00104 static ARRAY<double> _cutoff; 00105 static ARRAY<double> _cAtten; 00106 static ARRAY<double> _lAtten; 00107 static ARRAY<double> _qAtten; 00108 }; 00109 00110 } 00111 #endif