Changeset 4736 in orxonox.OLD for orxonox/trunk/src/lib/graphics/light.h
- Timestamp:
- Jun 30, 2005, 1:06:53 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/light.h
r4735 r4736 26 26 { 27 27 public: 28 Light(int lightNumber); 29 Light(const TiXmlElement* root); 28 Light(const TiXmlElement* root = NULL); 30 29 virtual ~Light(void); 31 30 32 void init( int lightNumber);31 void init(); 33 32 void loadParams(const TiXmlElement* root); 34 33 … … 43 42 int getLightNumber(void) const {return this->lightNumber;} 44 43 45 virtual void draw() ;44 virtual void draw() const; 46 45 47 46 void debug(void) const; … … 66 65 67 66 <b>Usage:</b>\n 68 First you have to get the Light Manager up and running by using LightManager::getInstance .67 First you have to get the Light Manager up and running by using LightManager::getInstance(). 69 68 This automatically initiates the GL_LIGHTING, and sets some default stuff about the light.\n 70 69 Then you will create a new light using: 71 \li int addLight(void); 72 \li int addLight(int lightNumber); 70 \li new Light(); 73 71 74 72 now you can operate on the light as follows: 75 \li void setPosition(Vector position);76 \li void setPosition(GLfloat x, GLfloat y, GLfloat z);77 73 \li void setDiffuseColor(GLfloat r, GLfloat g, GLfloat b); 78 74 \li void setSpecularColor(GLfloat r, GLfloat g, GLfloat b); … … 80 76 \li void setSpotDirection(Vector direction); 81 77 \li void setSpotCutoff(GLfloat cutoff); 82 83 These functions are preatty selv-explaining, but you can read about them below.\n 84 If you want to fetch info, or the a Light use: 85 \li Vector getPosition(void) const; 86 \li Vector getPosition(int lightNumber) const; 87 \li Light* getLight(int LightNumber) const; 78 \li all PNode stuff also works 88 79 89 80 To redraw the light use 90 \li void draw() ;81 \li void draw() const; 91 82 92 83 and to delete one just use … … 97 88 98 89 You can also operate on the single Lights themselves, by first retreaving them with 99 \li Light* getLight(int LightNumber) ;90 \li Light* getLight(int LightNumber) const; 100 91 \n 101 92 and then using the same functions on this to change settings. … … 103 94 class LightManager : public BaseObject 104 95 { 96 friend class Light; 105 97 106 98 public: … … 112 104 void loadLights(const TiXmlElement* root); 113 105 114 // set Attributes115 int addLight(void);116 int addLight(int lightNumber);117 void editLightNumber(int lightNumber);118 void deleteLight(void);119 void deleteLight(int lightNumber);120 121 106 void setAmbientColor(GLfloat r, GLfloat g, GLfloat b); 122 107 123 void draw(); 108 Light* getLight(int lightNumber) const; 109 inline Light* getLight() const { return this->currentLight; }; 124 110 125 //set Attributes 126 void setDiffuseColor(GLfloat r, GLfloat g, GLfloat b); 127 void setSpecularColor(GLfloat r, GLfloat g, GLfloat b); 128 void setAttenuation(float constantAttenuation, float linearAttenuation, float quadraticAttenuation); 129 void setSpotDirection(Vector direction); 130 void setSpotCutoff(GLfloat cutoff); 131 132 // get Attributes 133 Vector getPosition(void) const; 134 Vector getPosition(int lightNumber) const; 135 136 Light* getLight(int lightNumber) const; 137 Light* getLight() const { return this->currentLight; }; 111 void draw() const; 138 112 139 113 void debug(void) const; 140 114 141 142 115 private: 143 116 LightManager(void); 144 void initLight(int LightNumber);145 117 118 int registerLight(Light* light); 119 void unregisterLight(Light* light); 146 120 147 121 private:
Note: See TracChangeset
for help on using the changeset viewer.