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, 20 years ago

orxonox/trunk: doxygen-tags

File size: 3.2 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
[3598]16//! The maximum number of Lights this OpenGL-implementation supports.
[3437]17#define NUMBEROFLIGHTS GL_MAX_LIGHTS
18
[3436]19// FORWARD DEFINITIONS //
20class Vector;
[2036]21
[3598]22//! A class that handles Lights. The LightManager operates on this.
[3597]23class Light : public WorldEntity
24{
25 public:
26  Light(int lightNumber);
[3598]27  virtual ~Light(void);
[3597]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
[3598]37  Vector getPosition();
38  /** \returns the lightNumber*/
39  int getLightNumber(void) {return this->lightNumber;}
40 
[3597]41  virtual void draw();
42
[3598]43  void debug(void);
44
[3597]45  // attributes
[3598]46 private:
[3597]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
[3436]58//! A class that handles Lights
[3329]59/**
[3436]60   A Light is a source that emits light rays (photons)
[3329]61*/
[3597]62class LightManager : public BaseObject
[3436]63{
[3437]64 private:
[3597]65  LightManager(void);
66  void initLight(int LightNumber);
67 
68  static LightManager* singletonRef;    //!< This is the LightHandlers Reference.
[3440]69  GLfloat ambientColor[4];       //!< The ambient Color of the scene.
70
[3597]71  Light** lights;                //!< An array of Lenght NUMBEROFLIGHTS, that holds pointers to all LightValues.
72  Light* currentLight;           //!< The current Light, we are working with.
[3436]73 
[1904]74 public:
[3597]75  static LightManager* getInstance();
76  virtual ~LightManager(void);
[1853]77
[3436]78  // set Attributes
[3437]79  int addLight(void);
80  int addLight(int lightNumber);
81  void editLightNumber(int lightNumber);
82  void deleteLight(void);
83  void deleteLight(int lightNumber);
84
[3597]85  void setAmbientColor(GLfloat r, GLfloat g, GLfloat b);
86
[3598]87  void draw();
88
[3597]89  //set Attributes
[3436]90  void setPosition(Vector position);
[3437]91  void setPosition(GLfloat x, GLfloat y, GLfloat z);
[3436]92  void setDiffuseColor(GLfloat r, GLfloat g, GLfloat b);
93  void setSpecularColor(GLfloat r, GLfloat g, GLfloat b);
[3597]94  void setAttenuation(float constantAttenuation, float linearAttenuation, float quadraticAttenuation);
[3453]95  void setSpotDirection(Vector direction);
96  void setSpotCutoff(GLfloat cutoff);
97
[3436]98  // get Attributes
99  Vector getPosition(void);
[3598]100  Vector getPosition(int lightNumber);
101 
[3442]102  void debug(void);
[1853]103};
104
[3436]105#endif /* _LIGHT_H */
Note: See TracBrowser for help on using the repository browser.