Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: implemented attenuation

File size: 2.0 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#define NUMBEROFLIGHTS GL_MAX_LIGHTS
17
18enum AttenuationType {CONSTANT, LINEAR, QUADRATIC};
19
20// FORWARD DEFINITIONS //
21class Vector;
22
23//! A class that handles Lights
24/**
25   A Light is a source that emits light rays (photons)
26*/
27class Light : public WorldEntity
28{
29 private:
30  //! A struct that holds information about a Light
31  struct LightValue
32  {
33    int lightNumber;            //!< The number of this Light.
34    GLfloat lightPosition[4];   //!< The Position of this Light.
35    GLfloat lmodelAmbient[4];   //!< The general Ambient Color.
36    GLfloat diffuseColor[4];    //!< The Diffuse Color this Light emmits.
37    GLfloat specularColor[4];   //!< The specular Color of this Light.
38    AttenuationType attenuationType;//!< The AttenuationType of this Light.
39    float attenuationFactor;    //!< the Factor the attenuation should have.
40
41    LightValue* next;
42  };
43
44  static Light* singletonRef;    //!< This is the LightHandlers Reference.
45  GLfloat ambientColor[4];       //!< The ambient Color of the scene.
46
47
48  Light(void);
49
50  void init(int LightNumber); 
51  LightValue** lights;
52  LightValue* currentLight;
53 
54 public:
55  static Light* getInstance();
56  ~Light(void);
57
58  // set Attributes
59  int addLight(void);
60  int addLight(int lightNumber);
61  void editLightNumber(int lightNumber);
62  void deleteLight(void);
63  void deleteLight(int lightNumber);
64
65  void setPosition(Vector position);
66  void setPosition(GLfloat x, GLfloat y, GLfloat z);
67  void setDiffuseColor(GLfloat r, GLfloat g, GLfloat b);
68  void setSpecularColor(GLfloat r, GLfloat g, GLfloat b);
69  void setAttenuation(AttenuationType type, float factor);
70  void setAmbientColor(GLfloat r, GLfloat g, GLfloat b);
71  // get Attributes
72  Vector getPosition(void);
73};
74
75#endif /* _LIGHT_H */
Note: See TracBrowser for help on using the repository browser.