Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 3438 was 3437, checked in by bensch, 20 years ago

orxonox/trunk: light is now more like a lightManager. It is a Class, that handles many lights, and as such also glEnable(GL_LIGHTING)…
Until now It is not possible to initialize more than the first Light, but this will be fixed soon :)

File size: 1.6 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
[3436]18// FORWARD DEFINITIONS //
19class Vector;
[2036]20
[3436]21//! A class that handles Lights
[3329]22/**
[3436]23   A Light is a source that emits light rays (photons)
[3329]24*/
[3437]25class Light : public WorldEntity
[3436]26{
[3437]27 private:
28  //! A struct that holds information about a Light
29  struct LightValue
30  {
31    int lightNumber;            //!< The number of this Light.
32    GLfloat lightPosition[4];   //!< The Position of this Light.
33    GLfloat lmodelAmbient[4];   //!< The general Ambient Color.
34    GLfloat diffuseColor[4];    //!< The Diffuse Color this Light emmits.
35    GLfloat specularColor[4];   //!< The specular Color of this Light.
36
37    LightValue* next;
38  };
39
40  static Light* singletonRef;    //!< This is the LightHandlers Reference.
41  Light(void);
42
43  void init(int LightNumber); 
44  LightValue** lights;
45  LightValue* currentLight;
[3436]46 
[1904]47 public:
[3437]48  static Light* getInstance();
[3436]49  ~Light(void);
[1853]50
[3436]51  // set Attributes
[3437]52  int addLight(void);
53  int addLight(int lightNumber);
54  void editLightNumber(int lightNumber);
55  void deleteLight(void);
56  void deleteLight(int lightNumber);
57
[3436]58  void setPosition(Vector position);
[3437]59  void setPosition(GLfloat x, GLfloat y, GLfloat z);
[3436]60  void setDiffuseColor(GLfloat r, GLfloat g, GLfloat b);
61  void setSpecularColor(GLfloat r, GLfloat g, GLfloat b);
62  // get Attributes
63  Vector getPosition(void);
[1853]64};
65
[3436]66#endif /* _LIGHT_H */
Note: See TracBrowser for help on using the repository browser.