Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3602 in orxonox.OLD


Ignore:
Timestamp:
Mar 18, 2005, 10:07:40 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: A Presentation, that the light-class can be handled as PNode, see the second level (push x) to see the effect

Location:
orxonox/trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/defs/debug.h

    r3601 r3602  
    5959#define DEBUG_MODULE_ORXONOX            0
    6060#define DEBUG_MODULE_WORLD              0
    61 #define DEBUG_MODULE_PNODE              0
     61#define DEBUG_MODULE_PNODE              2
    6262#define DEBUG_MODULE_WORLD_ENTITY       0
    6363#define DEBUG_MODULE_COMMAND_NODE       0
    6464
    6565#define DEBUG_MODULE_IMPORTER           0
    66 #define DEBUG_MODULE_TRACK_MANAGER      3
    67 #define DEBUG_MODULE_LIGHT              0
     66#define DEBUG_MODULE_TRACK_MANAGER      0
     67#define DEBUG_MODULE_LIGHT              3
    6868#define DEBUG_MODULE_PLAYER             0
    6969#define DEBUG_MODULE_MATH               0
  • orxonox/trunk/src/light.cc

    r3600 r3602  
    3333Light::Light(int lightNumber)
    3434{
     35  this->setClassName("Light");
     36  char tmpName[7];
     37  sprintf(tmpName, "Light%d", lightNumber);
     38  this->setName(tmpName);
     39
    3540  PRINTF(4)("initializing Light number %d.\n", lightNumber);
    3641  // enable The light
     
    165170void Light::draw()
    166171{
    167   float pos[3] = {this->getAbsCoor ().x, this->getAbsCoor().y, this->getAbsCoor().z};
     172  float pos[4] = {this->getAbsCoor().x, this->getAbsCoor().y, this->getAbsCoor().z, 1.0};
     173  PRINTF(4)("Drawing The Lights new Position at %f %f %f\n", pos[0], pos[1], pos[2]);
    168174  glLightfv(lightsV[this->lightNumber], GL_POSITION, pos);
    169175}
     
    331337  glMatrixMode(GL_MODELVIEW);
    332338  glLoadIdentity();
    333   for (int i; i < NUMBEROFLIGHTS; i++)
     339  PRINTF(4)("Drawing the Lights\n");
     340  for (int i = 0; i < NUMBEROFLIGHTS; i++)
    334341    if (this->lights[i])
    335         lights[i]->draw();
     342      lights[i]->draw();
    336343}
    337344
  • orxonox/trunk/src/story_entities/world.cc

    r3598 r3602  
    167167      this->glmis->step();
    168168
     169      // LIGHT initialisation
     170      lightMan = LightManager::getInstance();
     171      lightMan->setAmbientColor(.1,.1,.1);
     172      lightMan->addLight();
     173      //      lightMan->setAttenuation(1.0, 2, 5);
     174      //      lightMan->setDiffuseColor(1,1,1);
     175      //  lightMan->addLight(1);
     176      //  lightMan->setPosition(20, 10, -20);
     177      //  lightMan->setDiffuseColor(0,0,0);
     178      lightMan->debug();
     179
    169180      switch(this->debugWorldNr)
    170181        {
     
    177188        case DEBUG_WORLD_0:
    178189          {
     190            lightMan->setPosition(-5.0, 10.0, -40.0);
    179191            this->nullParent = NullParent::getInstance ();
    180192            this->nullParent->setName ("NullParent");
     
    245257        case DEBUG_WORLD_1:
    246258          {
     259            lightMan->setPosition(.0, .0, .0);
    247260            this->nullParent = NullParent::getInstance ();
    248261            this->nullParent->setName ("NullParent");
     
    274287            this->spawn(pr, this->localPlayer, es, qs, PNODE_ROTATE_AND_MOVE);
    275288
     289            lightMan->getLight(0)->setParent(trackManager->getTrackNode());
    276290            break;
    277291          }
     
    296310  terrain->setRelCoor(new Vector(0,-10,0));
    297311  this->spawn(terrain);
    298   // LIGHT initialisation
    299   lightMan = LightManager::getInstance();
    300   lightMan->setAmbientColor(.1,.1,.1);
    301   lightMan->addLight();
    302   lightMan->setPosition(-5.0, 10.0, -40.0);
    303   lightMan->setAttenuation(1.0, 2, 5);
    304   lightMan->setDiffuseColor(1,1,1);
    305   //  lightMan->addLight(1);
    306   //  lightMan->setPosition(20, 10, -20);
    307   //  lightMan->setDiffuseColor(0,0,0);
    308   lightMan->debug();
    309 
    310312
    311313}
     
    465467  testFont->printText(0, 0, 1, "orxonox_" PACKAGE_VERSION);
    466468
    467   lightMan->draw();
     469  lightMan->draw(); // must be at the end of the drawing procedure, otherwise Light cannot be handled as PNodes //
    468470}
    469471
Note: See TracChangeset for help on using the changeset viewer.