Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 3443 was 3442, checked in by bensch, 20 years ago

orxonox/trunk: light: added debug-method.
There is something strange about adding multiple lights. I have to read about this some more.

File size: 2.0 KB
RevLine 
[3245]1/*!
[3436]2    \file light.h
3    \brief Handles Lights.
[3329]4
[3436]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.
[3245]8*/
[1853]9
[3436]10#ifndef _LIGHT_H
11#define _LIGHT_H
[1853]12
[3436]13#include "world_entity.h"
14#include "glincl.h"
[1853]15
[3437]16#define NUMBEROFLIGHTS GL_MAX_LIGHTS
17
[3441]18enum AttenuationType {CONSTANT, LINEAR, QUADRATIC};
19
[3436]20// FORWARD DEFINITIONS //
21class Vector;
[2036]22
[3436]23//! A class that handles Lights
[3329]24/**
[3436]25   A Light is a source that emits light rays (photons)
[3329]26*/
[3437]27class Light : public WorldEntity
[3436]28{
[3437]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.
[3441]38    AttenuationType attenuationType;//!< The AttenuationType of this Light.
39    float attenuationFactor;    //!< the Factor the attenuation should have.
[3437]40  };
41
42  static Light* singletonRef;    //!< This is the LightHandlers Reference.
[3440]43  GLfloat ambientColor[4];       //!< The ambient Color of the scene.
44
45
[3437]46  Light(void);
47
48  void init(int LightNumber); 
49  LightValue** lights;
50  LightValue* currentLight;
[3436]51 
[1904]52 public:
[3437]53  static Light* getInstance();
[3436]54  ~Light(void);
[1853]55
[3436]56  // set Attributes
[3437]57  int addLight(void);
58  int addLight(int lightNumber);
59  void editLightNumber(int lightNumber);
60  void deleteLight(void);
61  void deleteLight(int lightNumber);
62
[3436]63  void setPosition(Vector position);
[3437]64  void setPosition(GLfloat x, GLfloat y, GLfloat z);
[3436]65  void setDiffuseColor(GLfloat r, GLfloat g, GLfloat b);
66  void setSpecularColor(GLfloat r, GLfloat g, GLfloat b);
[3441]67  void setAttenuation(AttenuationType type, float factor);
[3440]68  void setAmbientColor(GLfloat r, GLfloat g, GLfloat b);
[3436]69  // get Attributes
70  Vector getPosition(void);
[3442]71
72  void debug(void);
[1853]73};
74
[3436]75#endif /* _LIGHT_H */
Note: See TracBrowser for help on using the repository browser.