Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/light.h @ 3598

Last change on this file since 3598 was 3598, checked in by bensch, 19 years ago

orxonox/trunk: doxygen-tags

File size: 3.2 KB
Line 
1/*!
2    \file light.h
3    \brief Handles Lights.
4
5    A Light is one of the more important things in a 3D-environment,
6    without it one sees nothing :)
7    It is here for diffuse-, specular- and Bump-Mappings.
8*/
9
10#ifndef _LIGHT_H
11#define _LIGHT_H
12
13#include "world_entity.h"
14#include "glincl.h"
15
16//! The maximum number of Lights this OpenGL-implementation supports.
17#define NUMBEROFLIGHTS GL_MAX_LIGHTS
18
19// FORWARD DEFINITIONS //
20class Vector;
21
22//! A class that handles Lights. The LightManager operates on this.
23class Light : public WorldEntity
24{
25 public:
26  Light(int lightNumber);
27  virtual ~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  Vector getPosition();
38  /** \returns the lightNumber*/
39  int getLightNumber(void) {return this->lightNumber;}
40 
41  virtual void draw();
42
43  void debug(void);
44
45  // attributes
46 private:
47  int lightNumber;            //!< The number of this Light.
48  GLfloat lightPosition[4];   //!< The Position of this Light.
49  GLfloat diffuseColor[4];    //!< The Diffuse Color this Light emmits.
50  GLfloat specularColor[4];   //!< The specular Color of this Light.
51  float constantAttenuation;  //!< The Factor of the the Constant Attenuation.
52  float linearAttenuation;    //!< The Factor of the the Linear Attenuation.
53  float quadraticAttenuation; //!< The Factor of the the Quadratic Attenuation.
54  GLfloat spotDirection[4];   //!< The direction of the Spot Light.
55  GLfloat spotCutoff;         //!< The cutoff Angle of the Light Source
56};
57
58//! A class that handles Lights
59/**
60   A Light is a source that emits light rays (photons)
61*/
62class LightManager : public BaseObject
63{
64 private:
65  LightManager(void);
66  void initLight(int LightNumber);
67 
68  static LightManager* singletonRef;    //!< This is the LightHandlers Reference.
69  GLfloat ambientColor[4];       //!< The ambient Color of the scene.
70
71  Light** lights;                //!< An array of Lenght NUMBEROFLIGHTS, that holds pointers to all LightValues.
72  Light* currentLight;           //!< The current Light, we are working with.
73 
74 public:
75  static LightManager* getInstance();
76  virtual ~LightManager(void);
77
78  // set Attributes
79  int addLight(void);
80  int addLight(int lightNumber);
81  void editLightNumber(int lightNumber);
82  void deleteLight(void);
83  void deleteLight(int lightNumber);
84
85  void setAmbientColor(GLfloat r, GLfloat g, GLfloat b);
86
87  void draw();
88
89  //set Attributes
90  void setPosition(Vector position);
91  void setPosition(GLfloat x, GLfloat y, GLfloat z);
92  void setDiffuseColor(GLfloat r, GLfloat g, GLfloat b);
93  void setSpecularColor(GLfloat r, GLfloat g, GLfloat b);
94  void setAttenuation(float constantAttenuation, float linearAttenuation, float quadraticAttenuation);
95  void setSpotDirection(Vector direction);
96  void setSpotCutoff(GLfloat cutoff);
97
98  // get Attributes
99  Vector getPosition(void);
100  Vector getPosition(int lightNumber);
101 
102  void debug(void);
103};
104
105#endif /* _LIGHT_H */
Note: See TracBrowser for help on using the repository browser.