Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7686 in orxonox.OLD for branches/water/src


Ignore:
Timestamp:
May 18, 2006, 3:15:46 PM (19 years ago)
Author:
patrick
Message:

water: introduced new render passes

Location:
branches/water/src
Files:
3 edited

Legend:

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

    r7460 r7686  
    3333#include "terrain.h"
    3434#include "playable.h"
     35#include "mapped_water.h"
    3536
    3637#include "light.h"
     
    445446  glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    446447  // draw world
    447   this->draw();
     448  //   this->draw();
     449
     450  // render the reflection texture
     451  this->renderPassReflection();
     452  // redner the refraction texture
     453  this->renderPassRefraction();
     454  // render all
     455  this->renderPassAll();
     456
    448457  // flip buffers
    449458  GraphicsEngine::swapBuffers();
     
    463472}
    464473
    465 /**
    466  * @brief runs through all entities calling their draw() methods
    467  */
    468 void GameWorld::draw ()
     474
     475void GameWorld::renderPassReflection()
     476{
     477
     478  const std::list<BaseObject*>* reflectedWaters;
     479  MappedWater* mw;
     480
     481  if( reflectedWaters = ClassList::getList(CL_MAPPED_WATER) != NULL)
     482  {
     483    std::list<BaseObject*>::const_iterator it;
     484    for (it = reflectedWaters->begin(); it != reflectedWaters->end(); it++)
     485    {
     486      mw =  dynamic_cast<MappedWater*>(*it);
     487
     488      // prepare for reflection rendering
     489      mw->activateReflection();
     490
     491      // draw everything to be included in the reflection
     492      for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)
     493        this->drawEntityList(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i]));
     494
     495      // clean up from reflection rendering
     496      mw->deactivateReflection();
     497    }
     498  }
     499
     500}
     501
     502void GameWorld::renderPassRefraction()
     503{}
     504
     505void GameWorld::renderPassAll()
    469506{
    470507  GraphicsEngine* engine = GraphicsEngine::getInstance();
     
    477514  /* draw all WorldEntiy groups */
    478515  for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)
    479    this->drawEntityList(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i]));
     516    this->drawEntityList(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i]));
    480517
    481518
     
    495532  if( likely(this->dataTank->gameRule != NULL))
    496533    this->dataTank->gameRule->draw();
     534}
     535
     536
     537/**
     538 * @brief runs through all entities calling their draw() methods
     539 */
     540void GameWorld::draw ()
     541{
     542
    497543}
    498544
  • branches/water/src/story_entities/game_world.h

    r7391 r7686  
    7171
    7272    void drawEntityList(const ObjectManager::EntityList& drawList ) const;
     73    virtual void renderPassReflection();
     74    virtual void renderPassRefraction();
     75    virtual void renderPassAll();
    7376    virtual void draw();
     77
    7478    virtual void display();
    7579
  • branches/water/src/util/object_manager.h

    r7368 r7686  
    1919  OM_ENVIRON,
    2020  OM_COMMON,
     21
     22  OM_REFLECTION,                            //!< list of all object that need to be drawn in the reflection image
    2123
    2224  OM_GROUP_00,
Note: See TracChangeset for help on using the changeset viewer.