Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3453 in orxonox.OLD for orxonox/trunk/src


Ignore:
Timestamp:
Mar 3, 2005, 5:56:20 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: light: added ability to generate a spot light

Location:
orxonox/trunk/src
Files:
2 edited

Legend:

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

    r3446 r3453  
    303303  glLightfv (GL_LIGHT0, GL_AMBIENT, this->ambientColor);
    304304}
     305
     306/**
     307   \brief stets the direction of the Spot Light.
     308   \param direction The direction of the Spot Light.
     309*/
     310void Light::setSpotDirection(Vector direction)
     311{
     312  this->currentLight->spotDirection[0] = direction.x;
     313  this->currentLight->spotDirection[1] = direction.y;
     314  this->currentLight->spotDirection[2] = direction.z;
     315
     316  glLightfv(lightsV[this->currentLight->lightNumber], GL_SPOT_DIRECTION, this->currentLight->spotDirection);
     317}
     318
     319
     320/**
     321   \brief sets the cutoff angle of the Light.
     322   \param cutoff The cutoff angle.
     323*/
     324void Light::setSpotCutoff(GLfloat cutoff)
     325{
     326  this->currentLight->spotCutoff = cutoff;
     327  glLightf(lightsV[this->currentLight->lightNumber], GL_SPOT_CUTOFF, cutoff);
     328}
     329
    305330
    306331// get Attributes
  • orxonox/trunk/src/light.h

    r3446 r3453  
    4343    GLfloat specularColor[4];   //!< The specular Color of this Light.
    4444    AttenuationType attenuationType;//!< The AttenuationType of this Light.
    45     float attenuationFactor;    //!< the Factor the attenuation should have.
     45    float attenuationFactor;    //!< The Factor the attenuation should have.
     46    GLfloat spotDirection[4];   //!< The direction of the Spot Light.
     47    GLfloat spotCutoff;         //!< The cutoff Angle of the Light Source
    4648  };
    4749
     
    7375  void setAttenuation(AttenuationType type, float factor);
    7476  void setAmbientColor(GLfloat r, GLfloat g, GLfloat b);
     77  void setSpotDirection(Vector direction);
     78  void setSpotCutoff(GLfloat cutoff);
     79
    7580  // get Attributes
    7681  Vector getPosition(void);
Note: See TracChangeset for help on using the changeset viewer.