Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 8, 2006, 4:03:25 PM (18 years ago)
Author:
stefalie
Message:

water: …

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/water/src/story_entities/game_world.cc

    r8249 r8260  
    135135  }
    136136  imageSelector->showAll();
    137   imageSelector->setAbsCoor2D(200, 30);
     137  imageSelector->setAbsCoor2D(200, 200);
    138138    OrxGui::GLGuiHandler::getInstance()->activateCursor();
    139139
     
    580580      mw =  dynamic_cast<MappedWater*>(*it);
    581581
    582       // prepare for reflection rendering
    583       mw->activateReflection();
    584 
    585582      //camera and light
    586583      this->dataTank->localCamera->apply ();
    587584      this->dataTank->localCamera->project ();
     585
     586      LightManager::getInstance()->draw();
     587
     588
     589      // prepare for reflection rendering
     590      mw->activateReflection();
     591
     592      // draw everything to be included in the reflection
     593      this->drawEntityList(State::getObjectManager()->getReflectionList());
     594//       for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)
     595//         this->drawEntityList(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i]));
     596
     597      // clean up from reflection rendering
     598      mw->deactivateReflection();
     599    }
     600  }
     601
     602}
     603
     604
     605/**
     606 *  refraction rendering for water surfaces
     607 */
     608void GameWorld::renderPassRefraction()
     609{
     610    // clear buffer
     611  glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
     612  glLoadIdentity();
     613
     614  const std::list<BaseObject*>* reflectedWaters;
     615  MappedWater* mw;
     616
     617  if( (reflectedWaters = ClassList::getList(CL_MAPPED_WATER)) != NULL)
     618  {
     619    std::list<BaseObject*>::const_iterator it;
     620    for (it = reflectedWaters->begin(); it != reflectedWaters->end(); it++)
     621    {
     622      mw =  dynamic_cast<MappedWater*>(*it);
     623
     624      //camera and light
     625      this->dataTank->localCamera->apply ();
     626      this->dataTank->localCamera->project ();
     627      // prepare for reflection rendering
     628      mw->activateRefraction();
     629
     630
    588631      LightManager::getInstance()->draw();
    589632      // draw everything to be included in the reflection
     
    593636
    594637      // clean up from reflection rendering
    595       mw->deactivateReflection();
    596     }
    597   }
    598 
    599 }
    600 
    601 
    602 /**
    603  *  refraction rendering for water surfaces
    604  */
    605 void GameWorld::renderPassRefraction()
    606 {
    607     // clear buffer
    608   glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    609   glLoadIdentity();
    610 
    611   const std::list<BaseObject*>* reflectedWaters;
    612   MappedWater* mw;
    613 
    614   if( (reflectedWaters = ClassList::getList(CL_MAPPED_WATER)) != NULL)
    615   {
    616     std::list<BaseObject*>::const_iterator it;
    617     for (it = reflectedWaters->begin(); it != reflectedWaters->end(); it++)
    618     {
    619       mw =  dynamic_cast<MappedWater*>(*it);
    620 
    621       // prepare for reflection rendering
    622       mw->activateRefraction();
    623 
    624       //camera and light
    625       this->dataTank->localCamera->apply ();
    626       this->dataTank->localCamera->project ();
    627       LightManager::getInstance()->draw();
    628       // draw everything to be included in the reflection
    629       this->drawEntityList(State::getObjectManager()->getReflectionList());
    630 //       for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)
    631 //         this->drawEntityList(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i]));
    632 
    633       // clean up from reflection rendering
    634638      mw->deactivateRefraction();
    635639    }
Note: See TracChangeset for help on using the changeset viewer.