Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3442 in orxonox.OLD


Ignore:
Timestamp:
Mar 1, 2005, 10:04:01 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: light: added debug-method.
There is something strange about adding multiple lights. I have to read about this some more.

Location:
orxonox/trunk/src
Files:
5 edited

Legend:

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

    r3365 r3442  
    4040}
    4141
     42char* BaseObject::getClassName(void) const
     43{
     44  return className;
     45}
    4246
    4347bool BaseObject::isA (char* className)
  • orxonox/trunk/src/base_object.h

    r3365 r3442  
    1818
    1919  void setClassName (char* className);
     20  char* getClassName(void) const;
    2021  bool isA (char* className);
    2122
  • orxonox/trunk/src/light.cc

    r3441 r3442  
    311311    return Vector(this->currentLight->lightPosition[0], this->currentLight->lightPosition[1], this->currentLight->lightPosition[2]);
    312312}
     313
     314
     315/**
     316   \brief outputs debug information about the Class and its lights
     317*/
     318void Light::debug(void)
     319{
     320  PRINT(0)("=================================\n");
     321  PRINT(0)("= DEBUG INFORMATION CLASS LIGHT =\n");
     322  PRINT(0)("=================================\n");
     323  PRINT(0)("Reference: %p\n", Light::singletonRef);
     324  if (this->currentLight)
     325    PRINT(0)("current Light Nr: %d\n", this->currentLight->lightNumber);
     326  PRINT(0)("Ambient Color: %f:%f:%f\n", this->ambientColor[0], this->ambientColor[0], this->ambientColor[0]);
     327  PRINT(0)("=== Lights ===\n");
     328  for (int i = 0; i < NUMBEROFLIGHTS; i++)
     329    if (this->lights[i])
     330      {
     331        PRINT(0)(":: %d ::  -- reference %p\n", i, lights[i]);
     332        if (i != lights[i]->lightNumber)
     333          PRINTF(1)(" Lights are out of sync, this really should not happen,\n   %d % should be equal.\n", i, lights[i]->lightNumber);
     334        PRINT(0)(" Position:      %f/%f/%f\n", lights[i]->lightPosition[0], lights[i]->lightPosition[1], lights[i]->lightPosition[2]);
     335        PRINT(0)(" DiffuseColor:  %f/%f/%f\n", lights[i]->diffuseColor[0], lights[i]->diffuseColor[1], lights[i]->diffuseColor[2]);
     336        PRINT(0)(" SpecularColor: %f/%f/%f\n", lights[i]->specularColor[0], lights[i]->specularColor[1], lights[i]->specularColor[2]);
     337        PRINT(0)(" Attenuation:   ");
     338        switch (lights[i]->attenuationType)
     339          {
     340          case CONSTANT:
     341            PRINT(0)("constant");
     342          case LINEAR:
     343            PRINT(0)("linear");
     344            break;
     345          case QUADRATIC:
     346            PRINT(0)("quadratic");
     347            break;
     348          }
     349        PRINT(0)(" with Factor %f\n", lights[i]->attenuationFactor);
     350      }
     351  PRINT(0)("--------------------------------\n");
     352}
  • orxonox/trunk/src/light.h

    r3441 r3442  
    3838    AttenuationType attenuationType;//!< The AttenuationType of this Light.
    3939    float attenuationFactor;    //!< the Factor the attenuation should have.
    40 
    41     LightValue* next;
    4240  };
    4341
     
    7169  // get Attributes
    7270  Vector getPosition(void);
     71
     72  void debug(void);
    7373};
    7474
  • orxonox/trunk/src/world.cc

    r3441 r3442  
    172172void World::load()
    173173{
     174  // LIGHT initialisation
    174175  light = Light::getInstance();
    175176  light->addLight(0);
    176177  light->setAttenuation(QUADRATIC, 1.0);
    177   light->setPosition(10.0, 100.0, 19.0);
     178  light->setPosition(20.0, 10.0, 20.0);
     179  light->setDiffuseColor(1,1,1);
     180  //  light->addLight(1);
     181  //  light->setPosition(20, 10, -20);
     182  //  light->setDiffuseColor(0,0,0);
     183  light->debug();
    178184
    179185  //  BezierCurve* tmpCurve = new BezierCurve();
Note: See TracChangeset for help on using the changeset viewer.