Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3441 in orxonox.OLD for orxonox/trunk/src/light.cc


Ignore:
Timestamp:
Mar 1, 2005, 9:24:44 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: implemented attenuation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/light.cc

    r3440 r3441  
    250250
    251251/**
     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*/
     258void 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/**
    252283   \brief sets the ambient Color of the Scene
    253284   \param r red
     
    263294
    264295  glLightfv (GL_LIGHT0, GL_AMBIENT, this->ambientColor);
    265 
    266296}
    267297
Note: See TracChangeset for help on using the changeset viewer.