Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Mar 1, 2005, 8:24:04 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: light: comments, errormessages, light up again

Location:
orxonox/trunk/src
Files:
2 edited

Legend:

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

    r3437 r3438  
    3838  for (int i = 0; i < NUMBEROFLIGHTS; i++)
    3939    lights[i] = NULL;
    40   this->currentLight = new LightValue;
     40  this->currentLight = NULL;
    4141}
    4242
     
    5656}
    5757
     58/**
     59   \brief singleton-Reference to the Light-class
     60*/
    5861Light* Light::singletonRef = NULL;
    5962
     
    125128void Light::editLightNumber(int lightNumber)
    126129{
     130  if (!this->currentLight)
     131    {
     132      PRINTF(1)("no Light defined yet\n");
     133      return;
     134    }
     135
    127136  this->currentLight = lights[lightNumber];
    128137}
     
    133142void Light::deleteLight(void)
    134143{
     144  if (!this->currentLight)
     145    {
     146      PRINTF(1)("no Light defined yet\n");
     147      return;
     148    }
     149
    135150  this->deleteLight(this->currentLight->lightNumber);
    136151}
     
    151166}
    152167
    153 
    154 
    155168// set Attributes
    156169/**
     
    161174void Light::setPosition(Vector position)
    162175{
     176  if (!this->currentLight)
     177    {
     178      PRINTF(1)("no Light defined yet\n");
     179      return;
     180    }
    163181  this->currentLight->lightPosition[0] = position.x;
    164182  this->currentLight->lightPosition[1] = position.y;
     
    171189void Light::setPosition(GLfloat x, GLfloat y, GLfloat z)
    172190{
     191  if (!this->currentLight)
     192    {
     193      PRINTF(1)("no Light defined yet\n");
     194      return;
     195    }
     196
    173197  this->currentLight->lightPosition[0] = x;
    174198  this->currentLight->lightPosition[1] = y;
     
    187211void Light::setDiffuseColor(GLfloat r, GLfloat g, GLfloat b)
    188212{
     213  if (!this->currentLight)
     214    {
     215      PRINTF(1)("no Light defined yet\n");
     216      return;
     217    }
     218
    189219  this->currentLight->diffuseColor[0] = r;
    190220  this->currentLight->diffuseColor[1] = g;
     
    204234void Light::setSpecularColor(GLfloat r, GLfloat g, GLfloat b)
    205235{
     236  if (!this->currentLight)
     237    {
     238      PRINTF(1)("no Light defined yet\n");
     239      return;
     240    }
     241
    206242  this->currentLight->specularColor[0] = r;
    207243  this->currentLight->specularColor[1] = g;
     
    219255Vector Light::getPosition(void)
    220256{
    221   Vector tmpPosition(this->currentLight->lightPosition[0], this->currentLight->lightPosition[1], this->currentLight->lightPosition[2]);
    222   return tmpPosition;
    223 }
     257  if (!this->currentLight)
     258    {
     259      PRINTF(1)("no Light defined yet\n");
     260      return Vector(.0, .0, .0);
     261    }
     262  else
     263    return Vector(this->currentLight->lightPosition[0], this->currentLight->lightPosition[1], this->currentLight->lightPosition[2]);
     264}
  • orxonox/trunk/src/world.cc

    r3437 r3438  
    173173{
    174174  light = Light::getInstance();
    175   light->addLight(1);
     175  light->addLight(0);
    176176  light->setPosition(10.0, 10.0, 19.0);
    177177
Note: See TracChangeset for help on using the changeset viewer.