Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7785 in orxonox.OLD for trunk/src/story_entities/game_world.cc


Ignore:
Timestamp:
May 24, 2006, 3:17:19 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the Changes from the water branche back to the trunk.

File:
1 edited

Legend:

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

    r7739 r7785  
    3333#include "terrain.h"
    3434#include "playable.h"
     35#include "environments/mapped_water.h"
    3536
    3637#include "light.h"
     
    443444void GameWorld::display ()
    444445{
    445   // clear buffer
    446   glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    447   // draw world
    448   this->draw();
     446  // render the reflection texture
     447  this->renderPassReflection();
     448  // redner the refraction texture
     449  this->renderPassRefraction();
     450  // render all
     451  this->renderPassAll();
     452
    449453  // flip buffers
    450454  GraphicsEngine::swapBuffers();
     
    464468}
    465469
    466 /**
    467  * @brief runs through all entities calling their draw() methods
    468  */
    469 void GameWorld::draw ()
    470 {
     470
     471
     472/**
     473 * reflection rendering for water surfaces
     474 */
     475void GameWorld::renderPassReflection()
     476{
     477    // clear buffer
     478  glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
     479  glLoadIdentity();
     480
     481  const std::list<BaseObject*>* reflectedWaters;
     482  MappedWater* mw;
     483
     484  if( (reflectedWaters = ClassList::getList(CL_MAPPED_WATER)) != NULL)
     485  {
     486    std::list<BaseObject*>::const_iterator it;
     487    for (it = reflectedWaters->begin(); it != reflectedWaters->end(); it++)
     488    {
     489      mw =  dynamic_cast<MappedWater*>(*it);
     490
     491      // prepare for reflection rendering
     492      mw->activateReflection();
     493
     494      //camera and light
     495      this->dataTank->localCamera->apply ();
     496      this->dataTank->localCamera->project ();
     497      LightManager::getInstance()->draw();
     498      // draw everything to be included in the reflection
     499      for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)
     500        this->drawEntityList(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i]));
     501
     502      // clean up from reflection rendering
     503      mw->deactivateReflection();
     504    }
     505  }
     506
     507}
     508
     509
     510/**
     511 *  refraction rendering for water surfaces
     512 */
     513void GameWorld::renderPassRefraction()
     514{}
     515
     516
     517/**
     518 *  this render pass renders the whole wolrd
     519 */
     520void GameWorld::renderPassAll()
     521{
     522  // clear buffer
     523  glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    471524  GraphicsEngine* engine = GraphicsEngine::getInstance();
    472525
     
    498551}
    499552
     553
    500554/**
    501555 *  shows the loading screen
Note: See TracChangeset for help on using the changeset viewer.