Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 473


Ignore:
Timestamp:
Dec 12, 2007, 6:11:30 PM (16 years ago)
Author:
bknecht
Message:

should work again, sorry

Location:
code/branches/FICN/src/orxonox
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/orxonox/graphicsEngine.cc

    r462 r473  
    4646    this->configPath_ = "";
    4747    this->dataPath_ = "";
     48    scene_ = NULL;
    4849  }
    4950
     
    5657  {
    5758    //TODO: Check if file exists (maybe not here)
    58 #ifndef OGRE_STATIC_LIB
     59/*#ifndef OGRE_STATIC_LIB
    5960    root_ = new Root(configPath_ + "plugins.cfg", configPath_ + "ogre.cfg",
    6061                     configPath_ + "Ogre.log");
    61 #endif
     62#else
    6263    root_ = new Root(NULL, configPath_ + "ogre.cfg", configPath_ + "Ogre.log");
     64#endif*/
     65    root_ = new Root();
    6366  }
    6467
    6568  /**
    66    * returns scene manager
     69   * @return scene manager
    6770   */
    6871  SceneManager* GraphicsEngine::getSceneManager()
    6972  {
    7073    if(!scene_)
     74    {
    7175      scene_ = root_->createSceneManager(ST_GENERIC, "Default SceneManager");
     76      std::cout << "created SceneMan: " << scene_ << std::endl;
     77    }
    7278    return scene_;
    7379  }
     
    94100    // Load resource paths from data file using configfile ressource type
    95101    ConfigFile cf;
    96     cf.load(dataPath_ + "resources.cfg");
     102    cf.load(dataPath + "resources.cfg");
    97103
    98104    // Go through all sections & settings in the file
  • code/branches/FICN/src/orxonox/main.cc

    r462 r473  
    8181#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
    8282    orx->init(argc, argv, macBundlePath());
    83     orx->start();
     83    //orx->start();
    8484#else
    8585    orx->init(argc, argv, "");
    86     orx->start();
     86    //orx->start();
    8787#endif
    8888
  • code/branches/FICN/src/orxonox/orxonox.cc

    r469 r473  
    6363#include "../network/Server.h"
    6464#include "../network/Client.h"
    65 //#include "../network/NetworkFrameListener.h"
     65#include "../network/NetworkFrameListener.h"
    6666
    6767// some tests to see if enet works without includsion
     
    222222    // load this file from config
    223223    string levelFile = "sample.oxw";
    224     loader_ = new loader::LevelLoader(levelFile);
     224    //loader_ = new loader::LevelLoader(levelFile);
    225225    //TODO: run engine
    226226  }
     
    248248    ogre_->setConfigPath(path);
    249249    ogre_->setup();
    250     if(!ogre_->load()) die(/* unable to load */);
    251   }
    252 
    253   void Orxonox::serverInit(std::string path)
    254   {
    255     ogre_->setConfigPath(path);
    256     ogre_->setup();
    257     //server_g = new network::Server(); // add some settings if wanted
    258     if(!ogre_->load()) die(/* unable to load */);
    259     //ogre_->getRoot()->addFrameListener(new network::ServerFrameListener());
    260     ogre_->startRender();
    261 
    262     createScene();
    263     setupScene();
    264   }
    265 
    266   void Orxonox::clientInit(std::string path)
    267   {
    268     ogre_->setConfigPath(path);
    269     ogre_->setup();
    270     //client_g = new network::Client(); // address here
    271     if(!ogre_->load()) die(/* unable to load */);
    272     //ogre_->getRoot()->addFrameListener(new network::ClientFrameListener());
    273     ogre_->startRender();
    274 
     250    root_ = ogre_->getRoot();
     251    //if(!ogre_->load()) die(/* unable to load */);
     252
     253    defineResources();
     254    setupRenderSystem();
     255    createRenderWindow();
     256    initializeResourceGroups();
    275257    createScene();
    276258    setupScene();
     
    278260    createFrameListener();
    279261    startRenderLoop();
     262  }
     263
     264  void Orxonox::serverInit(std::string path)
     265  {
     266    ogre_->setConfigPath(path);
     267    ogre_->setup();
     268    server_g = new network::Server(); // add some settings if wanted
     269    if(!ogre_->load()) die(/* unable to load */);
     270    //ogre_->getRoot()->addFrameListener(new network::ServerFrameListener());
     271    ogre_->startRender();
     272
     273    createScene();
     274    setupScene();
     275  }
     276
     277  void Orxonox::clientInit(std::string path)
     278  {
     279    ogre_->setConfigPath(path);
     280    ogre_->setup();
     281    client_g = new network::Client(); // address here
     282    if(!ogre_->load()) die(/* unable to load */);
     283    //ogre_->getRoot()->addFrameListener(new network::ClientFrameListener());
     284    ogre_->startRender();
     285
     286    createScene();
     287    setupScene();
     288    setupInputSystem();
     289    createFrameListener();
     290    startRenderLoop();
     291  }
     292
     293  void Orxonox::defineResources()
     294  {
     295    Ogre::String secName, typeName, archName;
     296    Ogre::ConfigFile cf;
     297#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
     298    cf.load(macBundlePath() + "/Contents/Resources/resources.cfg");
     299#else
     300    cf.load("resources.cfg");
     301#endif
     302
     303    Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
     304    while (seci.hasMoreElements())
     305    {
     306      secName = seci.peekNextKey();
     307      Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();
     308      Ogre::ConfigFile::SettingsMultiMap::iterator i;
     309      for (i = settings->begin(); i != settings->end(); ++i)
     310      {
     311        typeName = i->first;
     312        archName = i->second;
     313#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
     314        Ogre::ResourceGroupManager::getSingleton().addResourceLocation( String(macBundlePath() + "/" + archName), typeName, secName);
     315#else
     316        Ogre::ResourceGroupManager::getSingleton().addResourceLocation( archName, typeName, secName);
     317#endif
     318      }
     319    }
     320  }
     321
     322  void Orxonox::setupRenderSystem()
     323  {
     324    if (!root_->restoreConfig() && !root_->showConfigDialog())
     325      throw Exception(52, "User canceled the config dialog!", "OrxApplication::setupRenderSystem()");
     326  }
     327
     328  void Orxonox::createRenderWindow()
     329  {
     330    root_->initialise(true, "OrxonoxV2");
     331  }
     332
     333  void Orxonox::initializeResourceGroups()
     334  {
     335    TextureManager::getSingleton().setDefaultNumMipmaps(5);
     336    ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
    280337  }
    281338
  • code/branches/FICN/src/orxonox/orxonox.h

    r462 r473  
    3939      void clientInit(std::string path);
    4040      void standalone(std::string path);
     41      void defineResources();
     42      void setupRenderSystem();
     43      void createRenderWindow();
     44      void initializeResourceGroups();
    4145      void createScene(void);
    4246      void setupScene();
     
    4650    private:
    4751
    48       //static Orxonox*       singletonRef_;
    4952      GraphicsEngine*       ogre_;      //!< our dearest graphics engine <3
    5053      std::string           dataPath_;  //!< path to data
     
    5659      OIS::InputManager*    inputManager_;
    5760      OrxListener*          frameListener_;
     61      Ogre::Root*           root_;
    5862  };
    5963}
Note: See TracChangeset for help on using the changeset viewer.