Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3440 in orxonox.OLD


Ignore:
Timestamp:
Mar 1, 2005, 8:55:53 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: Light: added ambientColor, removed fancy effects :)

Location:
orxonox/trunk/src
Files:
3 edited

Legend:

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

    r3438 r3440  
    3535
    3636  glEnable (GL_LIGHTING);
     37  this->setAmbientColor(.3, .3, .3);
    3738  this->lights = new LightValue*[NUMBEROFLIGHTS];
    3839  for (int i = 0; i < NUMBEROFLIGHTS; i++)
     
    248249}
    249250
     251/**
     252   \brief sets the ambient Color of the Scene
     253   \param r red
     254   \param g green
     255   \param b blue
     256*/
     257void Light::setAmbientColor(GLfloat r, GLfloat g, GLfloat b)
     258{
     259  this->ambientColor[0] = r;
     260  this->ambientColor[1] = g;
     261  this->ambientColor[2] = b;
     262  this->ambientColor[3] = 1.0;
     263
     264  glLightfv (GL_LIGHT0, GL_AMBIENT, this->ambientColor);
     265
     266}
     267
    250268// get Attributes
    251269
  • orxonox/trunk/src/light.h

    r3437 r3440  
    3434    GLfloat diffuseColor[4];    //!< The Diffuse Color this Light emmits.
    3535    GLfloat specularColor[4];   //!< The specular Color of this Light.
     36    GLint attenuationType;      //!< The AttenuationType of this Light. \todo implements this;
    3637
    3738    LightValue* next;
     
    3940
    4041  static Light* singletonRef;    //!< This is the LightHandlers Reference.
     42  GLfloat ambientColor[4];       //!< The ambient Color of the scene.
     43
     44
    4145  Light(void);
    4246
     
    6064  void setDiffuseColor(GLfloat r, GLfloat g, GLfloat b);
    6165  void setSpecularColor(GLfloat r, GLfloat g, GLfloat b);
     66  void setAmbientColor(GLfloat r, GLfloat g, GLfloat b);
    6267  // get Attributes
    6368  Vector getPosition(void);
  • orxonox/trunk/src/world.cc

    r3439 r3440  
    878878      this->localCamera->timeSlice(dt);
    879879      this->trackManager->tick(dt);
    880       this->light->setPosition(10*cos((double)currentFrame/1000),10, 10*sin((double)currentFrame/1000));
    881       this->light->setDiffuseColor(.5-.5*cos((double)currentFrame/1000), .5+sin((double)currentFrame/1000), .5+sin((double)currentFrame/1000));
    882       this->light->setSpecularColor(.5-.5*sin((double)currentFrame/1000), .5+sin((double)currentFrame/1000), .5+cos((double)currentFrame/1000));
    883880    }
    884881  this->lastFrame = currentFrame;
Note: See TracChangeset for help on using the changeset viewer.