| 1 | = Lightmanager = |
| 2 | A class that handles Lights. |
| 3 | |
| 4 | A Light is a source that emits light rays (photons) |
| 5 | |
| 6 | == Usage == |
| 7 | First you have to get the Light Manager up and running by using LightManager::getInstance. This automatically initiates the GL_LIGHTING, and sets some default stuff about the light. |
| 8 | Then you will create a new light using: |
| 9 | * int addLight(void); |
| 10 | * int addLight(int lightNumber); |
| 11 | |
| 12 | now you can operate on the light as follows: |
| 13 | * void setPosition(Vector position); |
| 14 | * void setPosition(GLfloat x, GLfloat y, GLfloat z); |
| 15 | * void setDiffuseColor(GLfloat r, GLfloat g, GLfloat b); |
| 16 | * void setSpecularColor(GLfloat r, GLfloat g, GLfloat b); |
| 17 | * void setAttenuation(float constantAttenuation, float linearAttenuation, float quadraticAttenuation); |
| 18 | * void setSpotDirection(Vector direction); |
| 19 | * void setSpotCutoff(GLfloat cutoff); |
| 20 | |
| 21 | These functions are preatty selv-explaining, but you can read about them below. |
| 22 | If you want to fetch info, or the a Light use: |
| 23 | * Vector getPosition(void) const; |
| 24 | * Vector getPosition(int lightNumber) const; |
| 25 | * Light* getLight(int lightNumber) const; |
| 26 | |
| 27 | To redraw the light use |
| 28 | * void draw(); |
| 29 | |
| 30 | and to delete one just use |
| 31 | * void deleteLight(void); |
| 32 | |
| 33 | for some nice output just use: |
| 34 | * void debug(void) const; |
| 35 | |
| 36 | You can also operate on the single Lights themselves, by first retreaving them with |
| 37 | * Light* getLight(int lightNumber); |
| 38 | and then using the same functions to change settings. |