Changeset 3597 in orxonox.OLD for orxonox/trunk/src/light.h
- Timestamp:
- Mar 17, 2005, 11:04:59 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/light.h
r3588 r3597 17 17 #define NUMBEROFLIGHTS GL_MAX_LIGHTS 18 18 19 //! Enumerator for the attenuation-Type.20 /**21 CONSTANT means GL_CONSTANT_ATTENUATION22 LINEAR means GL_LINEAR_ATTENUATION23 QUADRATIC means GL_QUADRATIC_ATTENUATION24 */25 enum AttenuationType {CONSTANT, LINEAR, QUADRATIC};26 27 19 // FORWARD DEFINITIONS // 28 20 class Vector; 21 22 //! A struct that holds information about a Light 23 class Light : public WorldEntity 24 { 25 public: 26 Light(int lightNumber); 27 ~Light(void); 28 29 void setPosition(Vector position); 30 void setPosition(GLfloat x, GLfloat y, GLfloat z); 31 void setDiffuseColor(GLfloat r, GLfloat g, GLfloat b); 32 void setSpecularColor(GLfloat r, GLfloat g, GLfloat b); 33 void setAttenuation(float constantAttenuation, float linearAttenuation, float quadraticAttenuation); 34 void setSpotDirection(Vector direction); 35 void setSpotCutoff(GLfloat cutoff); 36 37 virtual void draw(); 38 39 // attributes 40 41 int lightNumber; //!< The number of this Light. 42 GLfloat lightPosition[4]; //!< The Position of this Light. 43 GLfloat diffuseColor[4]; //!< The Diffuse Color this Light emmits. 44 GLfloat specularColor[4]; //!< The specular Color of this Light. 45 float constantAttenuation; //!< The Factor of the the Constant Attenuation. 46 float linearAttenuation; //!< The Factor of the the Linear Attenuation. 47 float quadraticAttenuation; //!< The Factor of the the Quadratic Attenuation. 48 GLfloat spotDirection[4]; //!< The direction of the Spot Light. 49 GLfloat spotCutoff; //!< The cutoff Angle of the Light Source 50 51 void debug(void); 52 }; 29 53 30 54 //! A class that handles Lights … … 32 56 A Light is a source that emits light rays (photons) 33 57 */ 34 class Light : public BaseObject58 class LightManager : public BaseObject 35 59 { 36 60 private: 37 //! A struct that holds information about a Light 38 struct LightValue 39 { 40 int lightNumber; //!< The number of this Light. 41 GLfloat lightPosition[4]; //!< The Position of this Light. 42 GLfloat diffuseColor[4]; //!< The Diffuse Color this Light emmits. 43 GLfloat specularColor[4]; //!< The specular Color of this Light. 44 AttenuationType attenuationType;//!< The AttenuationType of this Light. 45 float attenuationFactor; //!< The Factor the attenuation should have. 46 GLfloat spotDirection[4]; //!< The direction of the Spot Light. 47 GLfloat spotCutoff; //!< The cutoff Angle of the Light Source 48 }; 49 50 static Light* singletonRef; //!< This is the LightHandlers Reference. 61 LightManager(void); 62 void initLight(int LightNumber); 63 64 static LightManager* singletonRef; //!< This is the LightHandlers Reference. 51 65 GLfloat ambientColor[4]; //!< The ambient Color of the scene. 52 66 53 54 Light(void); 55 56 void init(int LightNumber); 57 LightValue** lights; //!< An array of Lenght NUMBEROFLIGHTS, that holds pointers to all LightValues. 58 LightValue* currentLight; //!< The current Light, we are working with. 67 Light** lights; //!< An array of Lenght NUMBEROFLIGHTS, that holds pointers to all LightValues. 68 Light* currentLight; //!< The current Light, we are working with. 59 69 60 70 public: 61 static Light * getInstance();62 virtual ~Light (void);71 static LightManager* getInstance(); 72 virtual ~LightManager(void); 63 73 64 74 // set Attributes … … 69 79 void deleteLight(int lightNumber); 70 80 81 void setAmbientColor(GLfloat r, GLfloat g, GLfloat b); 82 83 //set Attributes 71 84 void setPosition(Vector position); 72 85 void setPosition(GLfloat x, GLfloat y, GLfloat z); 73 86 void setDiffuseColor(GLfloat r, GLfloat g, GLfloat b); 74 87 void setSpecularColor(GLfloat r, GLfloat g, GLfloat b); 75 void setAttenuation(AttenuationType type, float factor); 76 void setAmbientColor(GLfloat r, GLfloat g, GLfloat b); 88 void setAttenuation(float constantAttenuation, float linearAttenuation, float quadraticAttenuation); 77 89 void setSpotDirection(Vector direction); 78 90 void setSpotCutoff(GLfloat cutoff);
Note: See TracChangeset
for help on using the changeset viewer.