Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 14, 2009, 10:53:45 PM (15 years ago)
Author:
rgrieder
Message:

Merged buildsystem2 to buildsystem3.

Note: Bare merge, just resolved conflicts. To testing, no nothing.

Location:
code/branches/buildsystem3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/buildsystem3

  • code/branches/buildsystem3/src/orxonox/gamestates/GSGraphics.cc

    r2662 r2664  
    3131
    3232#include <fstream>
     33#include <boost/filesystem.hpp>
     34
    3335#include <OgreCompositorManager.h>
    3436#include <OgreConfigFile.h>
     
    4547#include "util/Debug.h"
    4648#include "util/Exception.h"
     49#include "util/String.h"
     50#include "util/SubString.h"
    4751#include "core/ConsoleCommand.h"
    4852#include "core/ConfigValueIncludes.h"
     
    9296        SetConfigValue(ogreConfigFile_,  "ogre.cfg")
    9397            .description("Location of the Ogre config file");
    94         SetConfigValue(ogrePluginsFile_, "plugins.cfg")
    95             .description("Location of the Ogre plugins file");
     98        SetConfigValue(ogrePluginsFolder_, ORXONOX_OGRE_PLUGINS_FOLDER)
     99            .description("Folder where the Ogre plugins are located.");
     100        SetConfigValue(ogrePlugins_, ORXONOX_OGRE_PLUGINS)
     101            .description("Comma separated list of all plugins to load.");
    96102        SetConfigValue(ogreLogFile_,     "ogre.log")
    97103            .description("Logfile for messages from Ogre. Use \"\" to suppress log file creation.");
     
    115121        // Ogre setup procedure
    116122        setupOgre();
     123        // load all the required plugins for Ogre
     124        loadOgrePlugins();
     125        // read resource declaration file
    117126        this->declareResources();
    118         this->loadRenderer();    // creates the render window
     127        // Reads ogre config and creates the render window
     128        this->loadRenderer();
     129
    119130        // TODO: Spread this so that this call only initialises things needed for the Console and GUI
    120131        this->initialiseResources();
     
    200211        delete this->ogreRoot_;
    201212
    202 //#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
     213//#ifdef ORXONOX_PLATFORM_WINDOWS
    203214        // delete the ogre log and the logManager (since we have created it).
    204215        this->ogreLogger_->getDefaultLog()->removeListener(this);
     
    277288
    278289        // TODO: LogManager doesn't work on oli platform. The why is yet unknown.
    279 //#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
     290//#ifdef ORXONOX_PLATFORM_WINDOWS
    280291        // create a new logManager
    281292        ogreLogger_ = new Ogre::LogManager();
     
    297308        COUT(4) << "Creating Ogre Root..." << std::endl;
    298309
    299         if (ogrePluginsFile_ == "")
    300         {
    301             COUT(2) << "Warning: Ogre plugins file set to \"\". Defaulting to plugins.cfg" << std::endl;
    302             ModifyConfigValue(ogrePluginsFile_, tset, "plugins.cfg");
    303         }
    304310        if (ogreConfigFile_ == "")
    305311        {
     
    326332            probe.close();
    327333
    328         ogreRoot_ = new Ogre::Root(ogrePluginsFile_, ogreConfigFile_, ogreLogFile_);
     334        // Leave plugins file empty. We're going to do that part manually later
     335        ogreRoot_ = new Ogre::Root("", ogreConfigFile_, ogreLogFile_);
    329336
    330337#if 0 // Ogre 1.4.3 doesn't yet support setDebugOutputEnabled(.)
    331 #if ORXONOX_PLATFORM != ORXONOX_PLATFORM_WIN32
     338#ifndef ORXONOX_PLATFORM_WINDOWS
    332339        // tame the ogre ouput so we don't get all the mess in the console
    333340        Ogre::Log* defaultLog = Ogre::LogManager::getSingleton().getDefaultLog();
     
    339346
    340347        COUT(3) << "Ogre set up done." << std::endl;
     348    }
     349
     350    void GSGraphics::loadOgrePlugins()
     351    {
     352        // just to make sure the next statement doesn't segfault
     353        if (ogrePluginsFolder_ == "")
     354            ogrePluginsFolder_ = ".";
     355
     356        boost::filesystem::path folder(ogrePluginsFolder_);
     357        // Do some SubString magic to get the comma separated list of plugins
     358        SubString plugins(ogrePlugins_, ",", " ", false, 92, false, 34, false, 40, 41, false, '\0');
     359        for (unsigned int i = 0; i < plugins.size(); ++i)
     360            ogreRoot_->loadPlugin((folder / plugins[i]).native_file_string());
    341361    }
    342362
Note: See TracChangeset for help on using the changeset viewer.