Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

LightMgr.H

Go to the documentation of this file.
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 #define SPOT_LIGHT_TYPE 2
00052 #define POINT_LIGHT_TYPE 1
00053 #define DIRECTIONAL_LIGHT_TYPE 0
00054 
00055 class LIGHTMGR
00056 {
00057  public:
00058   static void parseGlueconfig();
00059 
00060   //method to update the position of head-tracked lights
00061   static void setHeadPos(Wpt hp);
00062   static void setHeadDir(Wvec dir);
00063 
00064   static bool exists(int light);
00065   
00066   //pt/direction of light
00067   static Wpt getPos(int light);
00068   static Wvec getDir(int light);
00069   static int getType(int light);
00070   
00071   //colors for lights
00072   static Color getAmbient(int light);
00073   static Color getSpecular(int light);
00074   static Color getDiffuse(int light);
00075   
00076   //spotlight characteristics
00077   static double getExponent(int light);
00078   static double getCutoff(int light);
00079   static double getConstantAtten(int light);
00080   static double getLinearAtten(int light);
00081   static double getQuadraticAtten(int light);
00082 
00083   static int numLights() { return _type.num(); }
00084 
00085  protected:
00086   static ARRAY<Wpt> _pos;
00087   static ARRAY<Wvec> _dir;
00088 
00089   //point or directional or spot
00090   static ARRAY<int> _type;
00091   
00092   //if true, then position is ignored
00093   static ARRAY<bool> _headTracked;
00094 
00095   //color values for light
00096   static ARRAY<Color> _ambient;
00097   static ARRAY<Color> _specular;
00098   static ARRAY<Color> _diffuse;
00099   
00100   //spotlight settings
00101   static ARRAY<double> _exponent;
00102   static ARRAY<double> _cutoff;
00103   static ARRAY<double> _cAtten;
00104   static ARRAY<double> _lAtten;
00105   static ARRAY<double> _qAtten;
00106 };
00107 
00108 #endif

Generated on Mon Sep 15 16:27:56 2003 for inspace by doxygen1.2.18