Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8312 in orxonox.OLD for trunk/src/story_entities


Ignore:
Timestamp:
Jun 11, 2006, 12:49:25 PM (19 years ago)
Author:
bensch
Message:

trunk: merged the water-branche back here
removed the HACK in GameWorld in the Process (hope it is not needed anymore…

merged with command:
svn merge https://svn.orxonox.net/orxonoanches/water/src/lib/gui/gl_gui src/lib/gui/gl/ -r8063:HEAD

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/story_entities/game_world.cc

    r8271 r8312  
    407407    if( likely(this->dataTank->gameRule != NULL))
    408408      this->dataTank->gameRule->tick(this->dtS);
     409     
    409410  }
    410411}
     
    514515      mw =  dynamic_cast<MappedWater*>(*it);
    515516
    516       // prepare for reflection rendering
    517       mw->activateReflection();
    518 
    519517      //camera and light
    520518      this->dataTank->localCamera->apply ();
    521519      this->dataTank->localCamera->project ();
     520
     521      LightManager::getInstance()->draw();
     522
     523
     524      // prepare for reflection rendering
     525      mw->activateReflection();
     526
     527      // draw everything to be included in the reflection
     528      this->drawEntityList(State::getObjectManager()->getReflectionList());
     529//       for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)
     530//         this->drawEntityList(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i]));
     531
     532      // clean up from reflection rendering
     533      mw->deactivateReflection();
     534    }
     535  }
     536
     537}
     538
     539
     540/**
     541 *  refraction rendering for water surfaces
     542 */
     543void GameWorld::renderPassRefraction()
     544{
     545    // clear buffer
     546  glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
     547  glLoadIdentity();
     548
     549  const std::list<BaseObject*>* reflectedWaters;
     550  MappedWater* mw;
     551
     552  if( (reflectedWaters = ClassList::getList(CL_MAPPED_WATER)) != NULL)
     553  {
     554    std::list<BaseObject*>::const_iterator it;
     555    for (it = reflectedWaters->begin(); it != reflectedWaters->end(); it++)
     556    {
     557      mw =  dynamic_cast<MappedWater*>(*it);
     558
     559      //camera and light
     560      this->dataTank->localCamera->apply ();
     561      this->dataTank->localCamera->project ();
     562      // prepare for reflection rendering
     563      mw->activateRefraction();
     564
     565
    522566      LightManager::getInstance()->draw();
    523567      // draw everything to be included in the reflection
     
    527571
    528572      // clean up from reflection rendering
    529       mw->deactivateReflection();
    530     }
    531   }
    532 
    533 }
    534 
    535 
    536 /**
    537  *  refraction rendering for water surfaces
    538  */
    539 void GameWorld::renderPassRefraction()
    540 {
    541 
    542     // clear buffer
    543   glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    544   glLoadIdentity();
    545 
    546   const std::list<BaseObject*>* reflectedWaters;
    547   MappedWater* mw;
    548 
    549   if( (reflectedWaters = ClassList::getList(CL_MAPPED_WATER)) != NULL)
    550   {
    551     std::list<BaseObject*>::const_iterator it;
    552     for (it = reflectedWaters->begin(); it != reflectedWaters->end(); it++)
    553     {
    554       mw =  dynamic_cast<MappedWater*>(*it);
    555 
    556       // prepare for reflection rendering
    557       mw->activateRefraction();
    558 
    559       //camera and light
    560       this->dataTank->localCamera->apply ();
    561       this->dataTank->localCamera->project ();
    562       LightManager::getInstance()->draw();
    563       // draw everything to be included in the reflection
    564       this->drawEntityList(State::getObjectManager()->getReflectionList());
    565 //       for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)
    566 //         this->drawEntityList(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i]));
    567 
    568       // clean up from reflection rendering
    569573      mw->deactivateRefraction();
    570574    }
     
    583587
    584588
    585   //glEnable(GL_DEPTH_TEST);
    586   //glEnable(GL_LIGHTING);
     589  glEnable(GL_DEPTH_TEST);
     590  glEnable(GL_LIGHTING);
    587591
    588592  // set camera
Note: See TracChangeset for help on using the changeset viewer.