Changeset 7785 in orxonox.OLD for trunk/src/story_entities
- Timestamp:
- May 24, 2006, 3:17:19 AM (19 years ago)
- Location:
- trunk/src/story_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/story_entities/game_world.cc
r7739 r7785 33 33 #include "terrain.h" 34 34 #include "playable.h" 35 #include "environments/mapped_water.h" 35 36 36 37 #include "light.h" … … 443 444 void GameWorld::display () 444 445 { 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 449 453 // flip buffers 450 454 GraphicsEngine::swapBuffers(); … … 464 468 } 465 469 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 */ 475 void 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 */ 513 void GameWorld::renderPassRefraction() 514 {} 515 516 517 /** 518 * this render pass renders the whole wolrd 519 */ 520 void GameWorld::renderPassAll() 521 { 522 // clear buffer 523 glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); 471 524 GraphicsEngine* engine = GraphicsEngine::getInstance(); 472 525 … … 498 551 } 499 552 553 500 554 /** 501 555 * shows the loading screen -
trunk/src/story_entities/game_world.h
r7762 r7785 71 71 72 72 void drawEntityList(const ObjectManager::EntityList& drawList ) const; 73 virtual void draw(); 73 virtual void renderPassReflection(); 74 virtual void renderPassRefraction(); 75 virtual void renderPassAll(); 76 77 74 78 virtual void display(); 75 79
Note: See TracChangeset
for help on using the changeset viewer.