Changeset 3441 in orxonox.OLD for orxonox/trunk
- Timestamp:
- Mar 1, 2005, 9:24:44 PM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/light.cc
r3440 r3441 250 250 251 251 /** 252 \brief Sets the AttenuationType of this Light Source 253 \param type the AttenuationType to set 254 \param factor the Factor to multipy the attenuation with 255 256 this actually just sets the following: glLightf(currentLight, type, factor) 257 */ 258 void Light::setAttenuation(AttenuationType type, float factor) 259 { 260 if (!this->currentLight) 261 { 262 PRINTF(1)("no Light defined yet\n"); 263 return; 264 } 265 this->currentLight->attenuationFactor = factor; 266 this->currentLight->attenuationType = type; 267 switch (type) 268 { 269 case CONSTANT: 270 glLightf(lightsV[this->currentLight->lightNumber], GL_CONSTANT_ATTENUATION, factor); 271 break; 272 case LINEAR: 273 glLightf(lightsV[this->currentLight->lightNumber], GL_LINEAR_ATTENUATION, factor); 274 break; 275 case QUADRATIC: 276 glLightf(lightsV[this->currentLight->lightNumber], GL_QUADRATIC_ATTENUATION, factor); 277 break; 278 } 279 } 280 281 282 /** 252 283 \brief sets the ambient Color of the Scene 253 284 \param r red … … 263 294 264 295 glLightfv (GL_LIGHT0, GL_AMBIENT, this->ambientColor); 265 266 296 } 267 297 -
orxonox/trunk/src/light.h
r3440 r3441 15 15 16 16 #define NUMBEROFLIGHTS GL_MAX_LIGHTS 17 18 enum AttenuationType {CONSTANT, LINEAR, QUADRATIC}; 17 19 18 20 // FORWARD DEFINITIONS // … … 34 36 GLfloat diffuseColor[4]; //!< The Diffuse Color this Light emmits. 35 37 GLfloat specularColor[4]; //!< The specular Color of this Light. 36 GLint attenuationType; //!< The AttenuationType of this Light. \todo implements this; 38 AttenuationType attenuationType;//!< The AttenuationType of this Light. 39 float attenuationFactor; //!< the Factor the attenuation should have. 37 40 38 41 LightValue* next; … … 64 67 void setDiffuseColor(GLfloat r, GLfloat g, GLfloat b); 65 68 void setSpecularColor(GLfloat r, GLfloat g, GLfloat b); 69 void setAttenuation(AttenuationType type, float factor); 66 70 void setAmbientColor(GLfloat r, GLfloat g, GLfloat b); 67 71 // get Attributes -
orxonox/trunk/src/world.cc
r3440 r3441 174 174 light = Light::getInstance(); 175 175 light->addLight(0); 176 light->setPosition(10.0, 10.0, 19.0); 176 light->setAttenuation(QUADRATIC, 1.0); 177 light->setPosition(10.0, 100.0, 19.0); 177 178 178 179 // BezierCurve* tmpCurve = new BezierCurve();
Note: See TracChangeset
for help on using the changeset viewer.