- Timestamp:
- Jun 30, 2005, 1:29:59 AM (19 years ago)
- Location:
- orxonox/trunk/src/lib/graphics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/light.cc
r4737 r4738 31 31 CREATE_FACTORY(Light); 32 32 33 //! Definition of the Lights 33 //! Definition of the Lights and their Names 34 34 int lightsV[] = 35 35 { … … 46 46 /** 47 47 * \param root The XML-element to load the Light from 48 49 \todo what to do, if no Light-Slots are open anymore ??? 48 50 */ 49 51 Light::Light(const TiXmlElement* root) 50 52 { 53 PRINTF(4)("initializing Light number %d.\n", this->lightNumber); 54 51 55 this->lightNumber = LightManager::getInstance()->registerLight(this); 52 56 … … 56 60 this->setName(tmpName); 57 61 58 PRINTF(4)("initializing Light number %d.\n", this->lightNumber);59 62 // enable The light 60 63 glEnable(lightsV[this->lightNumber]); // postSpawn … … 65 68 66 69 this->loadParams(root); 67 68 70 } 69 71 … … 90 92 LoadParam<Light>(root, "specular-color", this, &Light::setSpecularColor) 91 93 .describe("sets the specular color of the Light (red [0-1], green [0-1], blue [0-1])"); 94 95 LoadParam<Light>(root, "attenuation", this, &Light::setAttenuation) 96 .describe("sets the Attenuation of the LightSource (constant Factor, linear Factor, quadratic Factor)."); 92 97 93 98 LoadParam<Light>(root, "spot-direction", this, &Light::setSpotDirection) … … 176 181 \brief draws this Light. Being a World-entity the possibility to do this lies at hand. 177 182 */ 178 void Light::draw( ) const183 void Light::draw(void) const 179 184 { 180 185 float pos[4] = {this->getAbsCoor().x, this->getAbsCoor().y, this->getAbsCoor().z, 1.0}; … … 290 295 } 291 296 297 /** 298 \param light the Light to register to the LightManager 299 300 This is done explicitely by the constructor of a Light 301 */ 292 302 int LightManager::registerLight(Light* light) 293 303 { … … 302 312 } 303 313 314 /** 315 \param light The light to unregister from the LightManager 316 317 This is done every time a Light is destroyed explicitely by the Light-destructor 318 */ 304 319 void LightManager::unregisterLight(Light* light) 305 320 { … … 347 362 this->lights[i]->debug(); 348 363 } 349 PRINT(0)("----------------------------- ---\n");350 } 364 PRINT(0)("-----------------------------LM-\n"); 365 } -
orxonox/trunk/src/lib/graphics/light.h
r4737 r4738 69 69 \li new Light(); 70 70 71 if you want to operate on this Light just apply the following functions onto it. 72 (You can also optain the Light-pointer with LightManager::getInstance()->getLight(lightNumber)) 73 71 74 now you can operate on the light as follows: 72 75 \li void setDiffuseColor(GLfloat r, GLfloat g, GLfloat b); … … 78 81 79 82 To redraw the light use 80 \li void draw() const; 81 82 and to delete one just use 83 \li void deleteLight(void); 83 \li void draw() const; (this is automatically done by the LightManager) 84 84 85 85 for some nice output just use: 86 \li void debug(void) const; 87 88 You can also operate on the single Lights themselves, by first retreaving them with 89 \li Light* getLight(int LightNumber) const; 90 \n 91 and then using the same functions on this to change settings. 86 \li void debug(void) const; (either on LightManager for a resume or on any Light for single information.) 92 87 */ 93 88 class LightManager : public BaseObject
Note: See TracChangeset
for help on using the changeset viewer.