Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8260 in orxonox.OLD for branches/water


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

water: …

Location:
branches/water/src
Files:
2 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    }
  • branches/water/src/world_entities/environments/mapped_water.cc

    r8249 r8260  
    242242  //glEnable(GL_CLIP_PLANE0);
    243243  Vector pos = State::getCameraNode()->getAbsCoor();
     244  //pos.debug();
     245  //PRINTF(0)("waterheight: %f\n", waterHeight);
    244246  if(pos.y > waterHeight)
    245247  {
     
    260262    // but just render it clipped so only the top is drawn.
    261263    double plane[4] = {0.0, 1.0, 0.0, waterHeight};
    262     //glClipPlane(GL_CLIP_PLANE0, plane);
     264    glClipPlane(GL_CLIP_PLANE0, plane);
    263265  }
    264266}
     
    268270{
    269271  //glDisable(GL_CLIP_PLANE0);
    270   //glCullFace(GL_BACK);
     272  glCullFace(GL_BACK);
    271273
    272274  //mat.select();
     
    299301  //glEnable(GL_CLIP_PLANE0);
    300302  Vector pos = State::getCameraNode()->getAbsCoor();
     303  //pos.debug();
     304  //PRINTF(0)("waterheight: %f\n", waterHeight);
    301305  if(pos.y > waterHeight)
    302306  {
     
    306310
    307311    // Since the world is updside down we need to change the culling to FRONT
    308     //glCullFace(GL_FRONT);
     312    glCullFace(GL_FRONT);
    309313
    310314    // Set our plane equation and turn clipping on
     
    360364{
    361365  //glDisable(GL_CLIP_PLANE0);
    362   //glCullFace(GL_BACK);
     366  glCullFace(GL_BACK);
    363367
    364368
Note: See TracChangeset for help on using the changeset viewer.