Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1244


Ignore:
Timestamp:
May 7, 2008, 9:20:42 AM (17 years ago)
Author:
rgrieder
Message:
  • added some comments and COUTs
Location:
code/branches/ogre/src/orxonox
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/ogre/src/orxonox/GraphicsEngine.cc

    r1243 r1244  
    7070    this->renderWindow_ = 0;
    7171    this->setConfigValues();
    72     COUT(4) << "*** GraphicsEngine: Constructed" << std::endl;
     72    CCOUT(4) << "Constructed" << std::endl;
    7373  }
    7474
     
    8787  void GraphicsEngine::destroy()
    8888  {
    89     COUT(4) << "*** GraphicsEngine: Destroying objects..." << std::endl;
     89    COUT(4) << "Destroying objects..." << std::endl;
    9090    Ogre::WindowEventUtilities::removeWindowEventListener(this->renderWindow_, this);
    9191    if (this->root_)
     
    101101      delete Ogre::LogManager::getSingletonPtr();
    102102    }
    103     COUT(4) << "*** GraphicsEngine: Destroying objects done" << std::endl;
     103    COUT(4) << "Destroying objects done" << std::endl;
    104104  }
    105105
     
    118118  bool GraphicsEngine::setup(std::string& dataPath)
    119119  {
     120    CCOUT(3) << "Setting up..." << std::endl;
    120121    // temporary overwrite of dataPath, change ini file for permanent change
    121122    if (dataPath != "")
     
    139140    else
    140141      logger = Ogre::LogManager::getSingletonPtr();
    141     COUT(4) << "*** GraphicsEngine: Ogre LogManager created/assigned" << std::endl;
     142    CCOUT(4) << "Ogre LogManager created/assigned" << std::endl;
    142143
    143144    // create our own log that we can listen to
     
    153154
    154155    // Root will detect that we've already created a Log
    155     COUT(4) << "*** GraphicsEngine: Creating Ogre Root..." << std::endl;
     156    CCOUT(4) << "Creating Ogre Root..." << std::endl;
    156157    root_ = new Ogre::Root(plugin_filename);
    157     COUT(4) << "*** GraphicsEngine: Creating Ogre Root done" << std::endl;
     158    CCOUT(4) << "Creating Ogre Root done" << std::endl;
    158159
    159160    // specify where Ogre has to look for resources. This call doesn't parse anything yet!
    160161    declareRessourceLocations();
    161162
     163    CCOUT(3) << "Set up done." << std::endl;
    162164    return true;
    163165  }
     
    165167  void GraphicsEngine::declareRessourceLocations()
    166168  {
     169    CCOUT(4) << "Declaring Resources" << std::endl;
    167170    //TODO: Specify layout of data file and maybe use xml-loader
    168171    //TODO: Work with ressource groups (should be generated by a special loader)
     
    194197  bool GraphicsEngine::loadRenderer()
    195198  {
     199    CCOUT(4) << "Configuring Renderer" << std::endl;
    196200    if (!root_->restoreConfig() && !root_->showConfigDialog())
    197201      return false;
    198202
     203    CCOUT(4) << "Creating render window" << std::endl;
    199204    this->renderWindow_ = root_->initialise(true, "OrxonoxV2");
    200205    if (!root_->isInitialised())
    201       return false;
     206    {
     207      CCOUT(2) << "Error: Creating Ogre root object failed" << std::endl;
     208      return false;
     209    }
    202210    Ogre::WindowEventUtilities::addWindowEventListener(this->renderWindow_, this);
    203211    Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);
     
    205213  }
    206214
    207   void GraphicsEngine::initialiseResources()
    208   {
     215  bool GraphicsEngine::initialiseResources()
     216  {
     217    CCOUT(4) << "Initialising resources" << std::endl;
    209218    //TODO: Do NOT load all the groups, why are we doing that? And do we really do that? initialise != load...
    210     Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
     219    try
     220    {
     221      Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
     222    }
     223    catch (Ogre::Exception e)
     224    {
     225      CCOUT(2) << "Error: There was an Error when initialising the resources." << std::endl;
     226      CCOUT(2) << "ErrorMessage: " << e.getFullDescription() << std::endl;
     227      return false;
     228    }
     229    return true;
    211230  }
    212231
     
    216235  bool GraphicsEngine::createNewScene()
    217236  {
     237    CCOUT(4) << "Creating new SceneManager" << std::endl;
    218238    if (scene_)
    219       return false;
     239    {
     240      CCOUT(2) << "SceneManager already exists! Skipping." << std::endl;
     241      return false;
     242    }
    220243    scene_ = root_->createSceneManager(Ogre::ST_GENERIC, "Default SceneManager");
    221     COUT(3) << "Info: Created SceneManager: " << scene_ << std::endl;
     244    CCOUT(3) << "Created SceneManager: " << scene_ << std::endl;
    222245    return true;
    223246  }
  • code/branches/ogre/src/orxonox/GraphicsEngine.h

    r1243 r1244  
    5959            void declareRessourceLocations();
    6060            bool loadRenderer();
    61             void initialiseResources();
     61            bool initialiseResources();
    6262            bool createNewScene();
    6363
  • code/branches/ogre/src/orxonox/Orxonox.cc

    r1243 r1244  
    3737
    3838//****** STD *******
    39 //#include <iostream>
    40 //#include <exception>
    4139#include <deque>
    4240
    4341//****** OGRE ******
    44 //#include <OgreException.h>
    4542#include <OgreFrameListener.h>
    4643#include <OgreOverlay.h>
     
    159156
    160157  /**
    161    * create a new instance of Orxonox
     158   * Create a new instance of Orxonox. Avoid doing any actual work here.
    162159   */
    163160  Orxonox::Orxonox()
     
    177174
    178175  /**
    179    * destruct Orxonox
     176   * Destruct Orxonox.
    180177   */
    181178  Orxonox::~Orxonox()
     
    208205
    209206  /**
    210    * @return singleton object
     207   * @return singleton reference
    211208   */
    212209  Orxonox* Orxonox::getSingleton()
     
    248245      return false;
    249246
     247    COUT(3) << "*** Orxonox: Mode is " << mode << "." << std::endl;
    250248    if (mode == "client")
    251249      mode_ = CLIENT;
     
    260258
    261259    // for playable server, client and standalone, the startup
    262     // procedure until the GUI is the identical
     260    // procedure until the GUI is identical
    263261
    264262    TclBind::getInstance().setDataPath(dataPath);
     
    284282      return false;
    285283
    286     // Calls the InputHandler which sets up the input devices.
     284    // Calls the InputManager which sets up the input devices.
    287285    // The render window width and height are used to set up the mouse movement.
    288286    if (!InputManager::initialise(ogre_->getWindowHandle(),
     
    290288      return false;
    291289
    292     // TODO: Spread this so that this call onyl initialises things needed for the GUI
    293     ogre_->initialiseResources();
     290    // TODO: Spread this so that this call only initialises things needed for the GUI
     291    if (!ogre_->initialiseResources())
     292      return false;
    294293
    295294    // TOOD: load the GUI here
     
    298297    // TODO: run GUI here
    299298
    300     // The following lines depend very much on the GUI, so they're probably misplaced here..
     299    // The following lines depend very much on the GUI output, so they're probably misplaced here..
    301300
    302301    InputManager::setInputState(InputManager::IS_NONE);
     
    325324  }
    326325
     326  /**
     327   * Loads everything in the scene except for the actual objects.
     328   * This includes HUD, Console..
     329   */
    327330  bool Orxonox::loadPlayground()
    328331  {
     
    338341
    339342    // Load the HUD
     343    COUT(3) << "*** Orxonox: Loading HUD..." << std::endl;
    340344    Ogre::Overlay* hudOverlay = Ogre::OverlayManager::getSingleton().getByName("Orxonox/HUD1.2");
    341345    orxonoxHUD_ = new HUD();
     
    344348    hudOverlay->show();
    345349
     350    COUT(3) << "*** Orxonox: Loading Console..." << std::endl;
    346351    InputBuffer* ib = dynamic_cast<InputBuffer*>(InputManager::getKeyHandler("buffer"));
    347352    /*
     
    365370  }
    366371
     372  /**
     373   * Level loading method for server mode.
     374   */
    367375  bool Orxonox::serverLoad()
    368376  {
    369     COUT(2) << "initialising server" << std::endl;
     377    COUT(2) << "Loading level in server mode" << std::endl;
    370378
    371379    server_g = new network::Server();
     
    379387  }
    380388
     389  /**
     390   * Level loading method for client mode.
     391   */
    381392  bool Orxonox::clientLoad()
    382393  {
    383     COUT(2) << "initialising client" << std::endl;\
     394    COUT(2) << "Loading level in client mode" << std::endl;\
    384395
    385396    if (serverIp_.compare("") == 0)
     
    394405  }
    395406
     407  /**
     408   * Level loading method for standalone mode.
     409   */
    396410  bool Orxonox::standaloneLoad()
    397411  {
    398     COUT(2) << "initialising standalone mode" << std::endl;
     412    COUT(2) << "Loading level in standalone mode" << std::endl;
    399413
    400414    if (!loadScene())
     
    404418  }
    405419
     420  /**
     421   * Helper method to load a level.
     422   */
    406423  bool Orxonox::loadScene()
    407424  {
     
    447464    timer_->reset();
    448465
     466    COUT(3) << "*** Orxonox: Starting the main loop." << std::endl;
    449467          while (!bAbort_)
    450468          {
     
    534552  }
    535553
     554  /**
     555   * Static function that shows the console in game mode.
     556   */
    536557  void Orxonox::activateConsole()
    537558  {
     559    // currently, the console shows itself when feeded with input.
    538560    InputManager::setInputState(InputManager::IS_CONSOLE);
    539561  }
Note: See TracChangeset for help on using the changeset viewer.