00001 #ifndef LIGHT_H_INCLUDED 00002 #define LIGHT_H_INCLUDED 00003 00004 #include "Component.h" 00005 #include "CGLA/Vec4f.h" 00006 #include "includeGL.h" 00007 00008 class LightManager; 00009 class Transform; 00010 00011 using namespace CGLA; 00012 enum LightTypEnum { 00013 AMBIANT, 00014 POINTSOURCE, 00015 SPOTLIGHT, 00016 DISTANTSOURCE 00017 }; 00018 00019 class Light: public Component{ 00020 public : 00021 static const RTTI TYPE; 00022 virtual const RTTI& getType() const{ return TYPE; } 00023 00024 protected: 00025 Vec4f diffuse; 00026 Vec4f ambient; 00027 Vec4f specular; 00028 float coneAngle; 00029 float coneExponent; 00030 00031 00032 LightTypEnum lightType; 00033 00034 GLenum glLightId; 00035 Transform* transform; 00036 00037 GLenum intToGlLightId(int id); 00038 00039 public: 00040 Light(const Vec4f& amb, const Vec4f& diff, const Vec4f& spec, LightManager* manager); 00041 static Light ambientLight(const Vec4f& amb, LightManager* manager); 00042 00043 void setLightType(LightTypEnum type); 00044 00045 Transform* getTransform()const; 00046 void setTransform(Transform* trans); 00047 00048 void applyLightState(); 00049 }; 00050 00051 #endif // LIGHT_H_INCLUDED