Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/mount_points/src/story_entities/game_world.cc @ 10248

Last change on this file since 10248 was 10248, checked in by patrick, 17 years ago

mount point loading is working

File size: 18.4 KB
RevLine 
[6352]1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   ### File Specific:
12   main-programmer: Patrick Boenzli
[10216]13   main-programmer: Benjamin Grauer
[6352]14   co-programmer: Christian Meyer
[10216]15
[6352]16*/
17
18#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD
19
[6358]20#include "game_world.h"
[6402]21#include "game_world_data.h"
[6352]22
23#include "state.h"
24
[7193]25#include "util/loading/game_loader.h"
[7919]26#include "util/timer.h"
[6404]27
[6352]28#include "player.h"
29#include "camera.h"
30#include "environment.h"
31#include "terrain.h"
[7287]32#include "test_entity.h"
33#include "terrain.h"
[6404]34#include "playable.h"
[7785]35#include "environments/mapped_water.h"
[6404]36
[6352]37#include "light.h"
[6404]38
[7193]39#include "util/loading/factory.h"
[9869]40#include "util/loading/load_param_xml.h"
41#include "loading/fast_factory.h"
[6404]42#include "shell_command.h"
[6352]43
44#include "graphics_engine.h"
[9869]45#include "weather_effects/atmospheric_engine.h"
[6404]46#include "event_handler.h"
47#include "sound_engine.h"
48#include "cd_engine.h"
49#include "network_manager.h"
[6352]50#include "physics_engine.h"
51
52#include "glmenu_imagescreen.h"
[6404]53#include "shell.h"
[6352]54
55#include "ogg_player.h"
[6404]56#include "shader.h"
[6352]57
[7369]58#include "animation_player.h"
59
[7035]60#include "game_rules.h"
[6352]61
[9110]62#include "script_class.h"
[9869]63ObjectListDefinition(GameWorld);
64CREATE_SCRIPTABLE_CLASS(GameWorld,
65                        addMethod("setPlaymode", Executor1<GameWorld, lua_State*,const std::string&>(&GameWorld::setPlaymode))
66                        ->addMethod("setSoundtrack", Executor1<GameWorld, lua_State*, const std::string&>(&GameWorld::setSoundtrack))
[9110]67                       );
[6352]68
[7412]69SHELL_COMMAND(speed, GameWorld, setSpeed) ->describe("set the Speed of the Level");
70SHELL_COMMAND(playmode, GameWorld, setPlaymode)
[7723]71->describe("Set the Playmode of the current Level")
72->completionPlugin(0, OrxShell::CompletorStringArray(Playable::playmodeNames, Playable::PlaymodeCount));
[7412]73
[7739]74SHELL_COMMAND(togglePNodeVisibility, GameWorld, togglePNodeVisibility);
75SHELL_COMMAND(showBVLevel, GameWorld, toggleBVVisibility);
[10216]76SHELL_COMMAND(showMountPoints, GameWorld, toggleMPVisibility);
[6352]77
78
[6989]79GameWorld::GameWorld()
[6402]80    : StoryEntity()
[6352]81{
[9869]82  this->registerObject(this, GameWorld::_objectList);
[6368]83  this->setName("Preloaded World - no name yet");
84
85  this->gameTime = 0.0f;
[6370]86  this->setSpeed(1.0f);
[6368]87  this->shell = NULL;
88
89  this->showPNodes = false;
90  this->showBV = false;
[7739]91  this->showBVLevel = 3;
[10248]92  this->showMPV = false;
[6368]93
[6845]94  this->dataXML = NULL;
[7391]95  this->gameRules = NULL;
[6352]96}
97
98/**
[6358]99 *  remove the GameWorld from memory
[6352]100 *
101 *  delete everything explicitly, that isn't contained in the parenting tree!
102 *  things contained in the tree are deleted automaticaly
103 */
[6358]104GameWorld::~GameWorld ()
[6352]105{
[6408]106  PRINTF(4)("Deleted GameWorld\n");
[7283]107
[6352]108}
109
110
111
112/**
[6358]113 * loads the parameters of a GameWorld from an XML-element
[6352]114 * @param root the XML-element to load from
115 */
[6358]116void GameWorld::loadParams(const TiXmlElement* root)
[6352]117{
[6512]118  StoryEntity::loadParams(root);
[6352]119
[6376]120  PRINTF(4)("Loaded GameWorld specific stuff\n");
[6352]121}
122
[6368]123
[6352]124/**
125 * this is executed just before load
126 *
127 * since the load function sometimes needs data, that has been initialized
128 * before the load and after the proceeding storyentity has finished
129*/
[6370]130ErrorMessage GameWorld::init()
[6352]131{
132  /* init the world interface */
[7374]133  this->shell = new OrxShell::Shell();
[6352]134
[6498]135  State::setCurrentStoryEntity(dynamic_cast<StoryEntity*>(this));
[6407]136  this->dataTank->init();
[7369]137
138  /* initialize some engines and graphical elements */
139  AnimationPlayer::getInstance();
140  PhysicsEngine::getInstance();
[10013]141  CoRe::CREngine::getInstance();
[8408]142
143  State::setScriptManager(&this->scriptManager);
144
[8717]145  return ErrorMessage();
[6352]146}
147
148/**
[6358]149 *  loads the GameWorld by initializing all resources, and set their default values.
[6352]150 */
[6372]151ErrorMessage GameWorld::loadData()
[6352]152{
[8408]153  this->displayLoadScreen();  State::setScriptManager(&this->scriptManager);
[6370]154
[8408]155
[9869]156  PRINTF(4)("Loading the GameWorld\n");
[6407]157
[7677]158  PRINTF(3)("> Loading world: '%s'\n", getLoadFile().c_str());
[9235]159  //  TiXmlElement* element;
160  //  GameLoader* loader = GameLoader::getInstance();
[6352]161
[7221]162  if( getLoadFile().empty())
[6402]163  {
[6634]164    PRINTF(1)("GameWorld has no path specified for loading\n");
[8717]165    return (ErrorMessage(213,"Path not specified","GameWorld::load()"));
[6402]166  }
[6352]167
[7287]168  TiXmlDocument* XMLDoc = new TiXmlDocument( getLoadFile());
[6402]169  // load the xml world file for further loading
[7287]170  if( !XMLDoc->LoadFile())
[6352]171  {
[7287]172    PRINTF(1)("loading XML File: %s @ %s:l%d:c%d\n", XMLDoc->ErrorDesc(), this->getLoadFile().c_str(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
173    delete XMLDoc;
[8717]174    return ErrorMessage(213,"XML File parsing error","GameWorld::load()");
[6352]175  }
176  // check basic validity
[7287]177  TiXmlElement* root = XMLDoc->RootElement();
[6352]178  assert( root != NULL);
179  if( root == NULL || root->Value() == NULL || strcmp( root->Value(), "WorldDataFile"))
180  {
[6402]181    // report an error
182    PRINTF(1)("Specified XML File is not an orxonox world data file (WorldDataFile element missing)\n");
[7287]183    delete XMLDoc;
[8717]184    return ErrorMessage(213,"Path not a WorldDataFile","GameWorld::load()");
[6352]185  }
[6402]186  /* the whole loading process for the GameWorld */
[6407]187  this->dataTank->loadData(root);
[6845]188  this->dataXML = (TiXmlElement*)root->Clone();
[6352]189
[8408]190  //remove this after finished testing !!!!
[8711]191  //Object* obj= new Object();
192  //obj->setName("Obj");
193  //Account* a = new Account();
194  //a->setName("a");
195  //Account *b = new Account(30);
196  //b->setName("b");
[8717]197
[8740]198
[8271]199  LoadParamXML(root, "ScriptManager", &this->scriptManager, ScriptManager, loadParams);
200
[7287]201  delete XMLDoc;
[6386]202  this->releaseLoadScreen();
[8717]203
204  return ErrorMessage();
[6352]205}
206
207
208/**
[6387]209 *  unload the data of this GameWorld
210 */
211ErrorMessage GameWorld::unloadData()
212{
[8271]213
[7287]214  PRINTF(3)("GameWorld::~GameWorld() - unloading the current GameWorld\n");
[8271]215  this->scriptManager.flush();
216
[7370]217  delete this->shell;
[6387]218
[6981]219  this->dataTank->unloadData();
220
[7369]221  this->shell = NULL;
222  delete AnimationPlayer::getInstance();
223  delete PhysicsEngine::getInstance();
[10013]224  delete CoRe::CREngine::getInstance();
[7369]225
[6988]226  State::setCurrentStoryEntity(NULL);
[6845]227  if (this->dataXML)
228    delete this->dataXML;
[8717]229
230  return ErrorMessage();
[6387]231}
232
233
[9235]234void GameWorld::setSoundtrack(const std::string& soundTrack)
235{
236  if (this->dataTank != NULL)
237  {
238    this->dataTank->setSoundTrack(soundTrack);
239    this->dataTank->music->play();
240  }
241}
242
243
[6387]244/**
[6358]245 *  starts the GameWorld
[6352]246 */
[6387]247bool GameWorld::start()
[6352]248{
[7283]249  this->bPaused = false;
250  this->bRunning = true;
[8408]251  State::setScriptManager(&this->scriptManager); //make sure we have the right script manager
[6387]252  this->run();
[8717]253
254  return true;
[6352]255}
256
[6402]257
[6352]258/**
259 *  stops the world.
[6402]260 */
[6387]261bool GameWorld::stop()
[6352]262{
[6358]263  PRINTF(3)("GameWorld::stop() - got stop signal\n");
[8408]264  State::setScriptManager(NULL);
[8717]265  return (this->bRunning = false);
[6352]266}
267
[6402]268
[6352]269/**
[6402]270 *  pauses the game
271 */
[6387]272bool GameWorld::pause()
[6352]273{
[8717]274  return (this->bPaused = true);
[6352]275}
276
[6402]277
[6352]278/**
279 *  ends the pause Phase
[6409]280 */
[6387]281bool GameWorld::resume()
[6352]282{
[8717]283  return(this->bPaused = false);
[6352]284}
285
286
287/**
[6402]288 *  main loop of the world: executing all world relevant function
289 *
290 * in this loop we synchronize (if networked), handle input events, give the heart-beat to
291 * all other member-entities of the world (tick to player, enemies etc.), checking for
292 * collisions drawing everything to the screen.
293 */
294void GameWorld::run()
[6352]295{
[6402]296  PRINTF(3)("GameWorld::mainLoop() - Entering main loop\n");
[6352]297
[7131]298  // initialize Timing
299  this->cycle = 0;
300  for (unsigned int i = 0; i < TICK_SMOOTH_VALUE; i++)
[7919]301    this->frameTimes[i] = 0.01f;
[7131]302  this->dtS = 0.0f;
[7919]303  this->lastFrame = Timer::getNow();
[7131]304
[7304]305  if (this->dataTank->music != NULL)
306    this->dataTank->music->play();
307
[7283]308  while( this->bRunning) /* @todo implement pause */
[6402]309  {
310    /* process intput */
311    this->handleInput ();
[7322]312    if( !this->bRunning)
313      break;
[6386]314
[6402]315    /* network synchronisation */
316    this->synchronize ();
317    /* process time */
318    this->tick ();
[8490]319
[8740]320
[8724]321    /* update the state */
[8740]322    //this->update (); /// LESS REDUNDANCY.
[9235]323    //      PNode::getNullParent()->updateNode(this->dtS);
[9061]324    PNode::getNullParent()->updateNode(this->dtS);
[8724]325
[8190]326    /* collision detection */
327    this->collisionDetection ();
328    /* collision reaction */
329    this->collisionReaction ();
[8490]330
[8724]331    /* check the game rules */
332    this->checkGameRules();
[8740]333
[6402]334    /* update the state */
335    this->update ();
336    /* draw everything */
337    this->display ();
[7306]338
[6402]339  }
340
[9869]341  PRINTF(4)("GameWorld::mainLoop() - Exiting the main loop\n");
[6352]342}
343
344
[7338]345void GameWorld::setPlaymode(Playable::Playmode playmode)
346{
347  if (this->dataTank->localPlayer &&
348      this->dataTank->localPlayer->getPlayable() &&
[7339]349      this->dataTank->localPlayer->getPlayable()->setPlaymode(playmode))
[7338]350  {
[9110]351    PRINTF(4)("Set Playmode to %d:%s\n", playmode, Playable::playmodeToString(playmode).c_str());
[7338]352  }
[7339]353  else
354  {
[9110]355    PRINTF(2)("Unable to set Playmode %d:'%s'\n", playmode, Playable::playmodeToString(playmode).c_str());
[7339]356  }
[7338]357}
358
[7339]359void GameWorld::setPlaymode(const std::string& playmode)
360{
361  this->setPlaymode(Playable::stringToPlaymode(playmode));
362}
[7338]363
[6352]364/**
365 *  synchronize local data with remote data
366*/
[6358]367void GameWorld::synchronize ()
[6402]368{}
[6352]369
370
371/**
372 *  run all input processing
373
374   the command node is the central input event dispatcher. the node uses the even-queue from
375   sdl and has its own event-passing-queue.
376*/
[6358]377void GameWorld::handleInput ()
[6352]378{
379  EventHandler::getInstance()->process();
380}
381
[6402]382
383/**
[7370]384 * @brief ticks a WorldEntity list
[6402]385 * @param entityList list of the WorldEntities
386 * @param dt time passed since last frame
387 */
[7370]388void GameWorld::tick(ObjectManager::EntityList entityList, float dt)
[6352]389{
[7370]390  ObjectManager::EntityList::iterator entity, next;
[6710]391  next = entityList.begin();
392  while (next != entityList.end())
393  {
394    entity = next++;
[6352]395    (*entity)->tick(dt);
[6710]396  }
[6352]397}
398
[7131]399
[6352]400/**
401 *  advance the timeline
[6402]402 *
403 * this calculates the time used to process one frame (with all input handling, drawing, etc)
404 * the time is mesured in ms and passed to all world-entities and other classes that need
405 * a heart-beat.
406 */
[6358]407void GameWorld::tick ()
[6352]408{
[7283]409  if( !this->bPaused)
[6402]410  {
[7131]411    // CALCULATE FRAMERATE
412    Uint32 frameTimesIndex;
413    Uint32 i;
[7919]414    double currentFrame = Timer::getNow();
[6402]415
[9494]416    if (currentFrame - this->lastFrame < .01)
417    {
[9869]418      SDL_Delay((int)(1000.0 * (0.01 - (currentFrame - lastFrame))));
[9494]419      currentFrame = Timer::getNow();
420    }
421
422
[7131]423    frameTimesIndex = this->cycle % TICK_SMOOTH_VALUE;
[7919]424    this->frameTimes[frameTimesIndex] = currentFrame - this->lastFrame;
425    this->lastFrame = currentFrame;
[7132]426    ++this->cycle;
[7919]427    this->dtS = 0.0;
[7132]428    for (i = 0; i < TICK_SMOOTH_VALUE; i++)
[7131]429      this->dtS += this->frameTimes[i];
[7919]430    this->dtS = this->dtS / TICK_SMOOTH_VALUE * speed;
[6352]431
[7131]432    // TICK everything
[7370]433    for (i = 0; i < this->dataTank->tickLists.size(); ++i)
[9869]434      this->tick(this->dataTank->objectManager->getEntityList(this->dataTank->tickLists[i]), this->dtS);
[6352]435
[6402]436    /* update tick the rest */
[6407]437    this->dataTank->localCamera->tick(this->dtS);
[6402]438    AnimationPlayer::getInstance()->tick(this->dtS);
439    PhysicsEngine::getInstance()->tick(this->dtS);
[6352]440
[6402]441    GraphicsEngine::getInstance()->tick(this->dtS);
[7810]442    AtmosphericEngine::getInstance()->tick(this->dtS);
[7035]443
444    if( likely(this->dataTank->gameRule != NULL))
445      this->dataTank->gameRule->tick(this->dtS);
[8717]446
[6402]447  }
[6352]448}
449
450
451/**
452 *  this function gives the world a consistant state
[6402]453 *
454 * after ticking (updating the world state) this will give a constistant
455 * state to the whole system.
456 */
[6358]457void GameWorld::update()
[6352]458{
459  PNode::getNullParent()->updateNode (this->dtS);
[7460]460  OrxSound::SoundEngine::getInstance()->update();
[8740]461
462  this->applyCameraSettings();
[7871]463  GraphicsEngine::getInstance()->update(this->dtS);
[6352]464}
465
466
[6402]467/**
468 * kicks the CDEngine to detect the collisions between the object groups in the world
469 */
[8190]470void GameWorld::collisionDetection()
[6352]471{
[8490]472  // object-object collision detection
[9869]473  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_GROUP_00),
474      this->dataTank->objectManager->getEntityList(OM_GROUP_01_PROJ));
475  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_GROUP_01),
476      this->dataTank->objectManager->getEntityList(OM_GROUP_00_PROJ));
477  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_GROUP_01),
478      this->dataTank->objectManager->getEntityList(OM_GROUP_00));
[6433]479
[9869]480  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_GROUP_01),
481      this->dataTank->objectManager->getEntityList(OM_GROUP_02));
482  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_GROUP_02),
483      this->dataTank->objectManager->getEntityList(OM_GROUP_01_PROJ));
[9235]484
485
[9869]486  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_GROUP_00),
487      this->dataTank->objectManager->getEntityList(OM_COMMON));
488  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_GROUP_01),
489      this->dataTank->objectManager->getEntityList(OM_COMMON));
[7083]490
[8490]491  // ground collision detection: BSP Model
[9869]492  CDEngine::getInstance()->checkCollisionGround(this->dataTank->objectManager->getEntityList(OM_GROUP_00));
493  CDEngine::getInstance()->checkCollisionGround(this->dataTank->objectManager->getEntityList(OM_GROUP_01));
[6352]494}
495
[7391]496
[8190]497void GameWorld::collisionReaction()
498{
[10013]499  CoRe::CREngine::getInstance()->handleCollisions();
[8190]500}
501
502
[6352]503/**
[7391]504 *  check the game rules: winning conditions, etc.
505 *
506 */
507void GameWorld::checkGameRules()
508{
509  if( this->gameRules)
510    this->gameRules->tick(this->dtS);
511}
512
513
514/**
[6352]515 *  render the current frame
[6402]516 *
517 * clear all buffers and draw the world
518 */
[6358]519void GameWorld::display ()
[6352]520{
[9406]521
[9494]522  // if this server is a dedicated server the game workd does not need to be drawn
[9406]523  if( !GraphicsEngine::getInstance()->isDedicated())
524  {
[9494]525    // render the reflection texture
526    this->renderPassReflection();
527    // redner the refraction texture
528    this->renderPassRefraction();
[9406]529  }
[7785]530  // render all
531  this->renderPassAll();
532
[6352]533  // flip buffers
534  GraphicsEngine::swapBuffers();
535}
536
537
538/**
[7370]539 * @brief draws all entities in the list drawList
540 * @param drawList the List of entities to draw.
[6352]541 */
[7370]542void GameWorld::drawEntityList(const ObjectManager::EntityList& drawList) const
543{
544  ObjectManager::EntityList::const_iterator entity;
545  for (entity = drawList.begin(); entity != drawList.end(); entity++)
[10228]546  {
[7370]547    if ((*entity)->isVisible())
548      (*entity)->draw();
[10228]549
550    if( unlikely( this->showMPV))
551      (*entity)->debugDrawMountPoints();
552  }
[7370]553}
554
[7785]555
[8740]556void GameWorld::applyCameraSettings()
557{
558  this->dataTank->localCamera->apply ();
559  this->dataTank->localCamera->project ();
560  GraphicsEngine::storeMatrices();
561}
[7785]562
[8740]563
564
[7370]565/**
[7785]566 * reflection rendering for water surfaces
[7370]567 */
[7785]568void GameWorld::renderPassReflection()
[6352]569{
[9235]570  // clear buffer
[7785]571  glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
[9235]572  //  glLoadIdentity();
[7785]573
574  MappedWater* mw;
575
[9869]576  for (ObjectList<MappedWater>::const_iterator it = MappedWater::objectList().begin();
577       it != MappedWater::objectList().end();
578       ++it)
[7785]579  {
[9869]580    mw =  (*it);
[7785]581
[9869]582    //camera and light
583    //this->dataTank->localCamera->apply ();
584    //this->dataTank->localCamera->project ();
[8312]585
[9869]586    LightManager::getInstance()->draw();
[8312]587
588
[9869]589    // prepare for reflection rendering
590    mw->activateReflection();
[8312]591
[9869]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()->getEntityList(this->dataTank->drawLists[i]));
[7785]596
[9869]597    // clean up from reflection rendering
598    mw->deactivateReflection();
[7785]599  }
600
601}
602
603
604/**
605 *  refraction rendering for water surfaces
606 */
607void GameWorld::renderPassRefraction()
[8037]608{
[9235]609  // clear buffer
[8037]610  glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
[8740]611  //glLoadIdentity();
[7785]612
[8037]613  MappedWater* mw;
614
[9869]615  for (ObjectList<MappedWater>::const_iterator it = MappedWater::objectList().begin();
616       it != MappedWater::objectList().end();
617       ++it)
[8037]618  {
[9869]619    mw =  dynamic_cast<MappedWater*>(*it);
[8037]620
[9869]621    //camera and light
622    //this->dataTank->localCamera->apply ();
623    //this->dataTank->localCamera->project ();
624    // prepare for reflection rendering
625    mw->activateRefraction();
[8037]626
[8312]627
[9869]628    LightManager::getInstance()->draw();
629    // draw everything to be included in the reflection
630    this->drawEntityList(State::getObjectManager()->getReflectionList());
631    //       for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)
632    //         this->drawEntityList(State::getObjectManager()->getEntityList(this->dataTank->drawLists[i]));
[8037]633
[9869]634    // clean up from reflection rendering
635    mw->deactivateRefraction();
[8037]636  }
637}
638
639
[7785]640/**
641 *  this render pass renders the whole wolrd
642 */
643void GameWorld::renderPassAll()
644{
645  // clear buffer
646  glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
[6352]647  GraphicsEngine* engine = GraphicsEngine::getInstance();
[6402]648
[7919]649
[8740]650  // glEnable(GL_DEPTH_TEST);
651  // glEnable(GL_LIGHTING);
[7919]652
[8740]653  // set Lighting
[7108]654  LightManager::getInstance()->draw();
[6416]655
[9406]656  // only render the world if its not dedicated mode
657  if( !GraphicsEngine::getInstance()->isDedicated())
658  {
659    /* Draw the BackGround */
[9869]660    this->drawEntityList(State::getObjectManager()->getEntityList(OM_BACKGROUND));
[9406]661    engine->drawBackgroundElements();
[7840]662
[9406]663    /* draw all WorldEntiy groups */
664    for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)
[9869]665      this->drawEntityList(State::getObjectManager()->getEntityList(this->dataTank->drawLists[i]));
[6416]666
[9406]667    AtmosphericEngine::getInstance()->draw();
[8408]668
[9406]669    if( unlikely( this->showBV))
670    {
671      CDEngine* engine = CDEngine::getInstance();
672      for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)
[9869]673        engine->drawBV(State::getObjectManager()->getEntityList(this->dataTank->drawLists[i]), this->showBVLevel);
[9406]674    }
675
[10228]676
[9406]677    if( unlikely(this->showPNodes))
678      PNode::getNullParent()->debugDraw(0);
679
680    // draw the game ruls
681    if( likely(this->dataTank->gameRule != NULL))
682      this->dataTank->gameRule->draw();
[6402]683  }
[6416]684
[6780]685  engine->draw();
[6352]686}
687
[7785]688
[6352]689/**
[6402]690 *  shows the loading screen
691 */
692void GameWorld::displayLoadScreen ()
[6387]693{
[6402]694  PRINTF(3)("GameWorld::displayLoadScreen - start\n");
[6407]695  this->dataTank->glmis = new GLMenuImageScreen();
696  this->dataTank->glmis->setMaximum(8);
[6402]697  PRINTF(3)("GameWorld::displayLoadScreen - end\n");
[6387]698}
699
700
[6402]701/**
702 *  removes the loadscreen, and changes over to the game
703 */
[9869]704void GameWorld::releaseLoadScreen()
[6387]705{
[6402]706  PRINTF(3)("GameWorld::releaseLoadScreen - start\n");
[6407]707  this->dataTank->glmis->setValue(this->dataTank->glmis->getMaximum());
[6402]708  PRINTF(3)("GameWorld::releaseLoadScreen - end\n");
[6387]709}
710
[7004]711
712
713/**
714 * @brief toggles the PNode visibility in the world (drawn as boxes)
715 */
716void GameWorld::togglePNodeVisibility()
717{
[7723]718  this->showPNodes = !this->showPNodes;
[7004]719};
720
721
722/**
723 * @brief toggles the bounding volume (BV) visibility
724*/
[7739]725void GameWorld::toggleBVVisibility(int level)
[7004]726{
[7739]727  if( level < 1)
728    this->showBV = false;
729  else
730  {
731    this->showBV = true;
732    this->showBVLevel = level;
733  }
734
[7004]735};
736
Note: See TracBrowser for help on using the repository browser.