Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 1, 2008, 3:54:20 PM (16 years ago)
Author:
rgrieder
Message:
  • @everyone: Do not create a branch until I've added the svn:eol-style property correctly. Otherwise this would cost me another 4 hours or so when we want to merge back.
  • merged network branch back to trunk
  • I had to omit the changes from last evening concerning the line endings
  • might not work yet because of the line endings
  • @beni: script branch is the only branch still open. you probably will have to apply a patch because of inconsistent new lines
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/GraphicsEngine.cc

    r1349 r1502  
    4545#include "core/Debug.h"
    4646#include "core/CommandExecutor.h"
    47 
     47#include "core/TclBind.h"
     48#include "console/InGameConsole.h"
     49
     50#include "core/ConsoleCommand.h"
     51#include <OgreSceneManager.h>
     52#include <OgreCompositorManager.h>
     53#include <OgreViewport.h>
    4854
    4955namespace orxonox {
    50 
    5156  /**
    5257    @brief Returns the singleton instance and creates it the first time.
     
    8388    SetConfigValue(ogreLogLevelNormal_  , 4).description("Corresponding orxonox debug level for ogre Normal");
    8489    SetConfigValue(ogreLogLevelCritical_, 2).description("Corresponding orxonox debug level for ogre Critical");
     90
     91    TclBind::getInstance().setDataPath(this->dataPath_);
    8592  }
    8693
     
    137144#endif
    138145
    139 /*    // create a logManager
     146// TODO: LogManager doesn't work on specific systems. The why is unknown yet.
     147#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
     148    // create a logManager
    140149    // note: If there's already a logManager, Ogre will complain by a failed assertation.
    141150    // but that shouldn't happen, since this is the first time to create a logManager..
     
    148157      myLog = logger->createLog("ogre.log", true, false, true);
    149158    else
    150           myLog = logger->createLog(this->ogreLogfile_, true, false, false);
     159      myLog = logger->createLog(this->ogreLogfile_, true, false, false);
    151160    CCOUT(4) << "Ogre Log created" << std::endl;
    152161
    153162    myLog->setLogDetail(Ogre::LL_BOREME);
    154     myLog->addListener(this);*/
     163    myLog->addListener(this);
     164#endif
    155165
    156166    // Root will detect that we've already created a Log
    157167    CCOUT(4) << "Creating Ogre Root..." << std::endl;
    158     root_ = new Ogre::Root(plugin_filename);
     168
     169    root_ = new Ogre::Root(plugin_filename, "ogre.cfg", this->ogreLogfile_);
     170
     171#if ORXONOX_PLATFORM != ORXONOX_PLATFORM_WIN32
     172    // tame the ogre ouput so we don't get all the mess in the console
     173    Ogre::Log* defaultLog = Ogre::LogManager::getSingleton().getDefaultLog();
     174    defaultLog->setDebugOutputEnabled(false);
     175    defaultLog->setLogDetail(Ogre::LL_BOREME);
     176    defaultLog->addListener(this);
     177#endif
     178
    159179    CCOUT(4) << "Creating Ogre Root done" << std::endl;
    160180
     
    241261  bool GraphicsEngine::createNewScene()
    242262  {
    243     CCOUT(4) << "Creating new SceneManager" << std::endl;
     263    CCOUT(4) << "Creating new SceneManager..." << std::endl;
    244264    if (scene_)
    245265    {
     
    291311    else
    292312      return 0;
     313  }
     314
     315  /**
     316    @brief Returns the window aspect ratio height/width.
     317    @return The ratio
     318  */
     319  float GraphicsEngine::getWindowAspectRatio() const
     320  {
     321    if (this->renderWindow_)
     322        return (float)this->renderWindow_->getHeight() / (float)this->renderWindow_->getWidth();
     323    else
     324        return 1.0f;
    293325  }
    294326
     
    345377    int h = rw->getHeight();
    346378    InputManager::setWindowExtents(w, h);
     379    InGameConsole::getInstance().resize();
    347380  }
    348381
     
    365398    CommandExecutor::execute("exit", false);
    366399  }
     400
     401  //HACK!!
     402  /*SetConsoleCommandShortcut(GraphicsEngine, CompositorBloomOn).setAccessLevel(AccessLevel::User);
     403  SetConsoleCommandShortcut(GraphicsEngine, CompositorMotionBlurOn).setAccessLevel(AccessLevel::User);
     404  SetConsoleCommandShortcut(GraphicsEngine, CompositorBloomOff).setAccessLevel(AccessLevel::User);
     405  SetConsoleCommandShortcut(GraphicsEngine, CompositorMotionBlurOff).setAccessLevel(AccessLevel::User);
     406  void GraphicsEngine::CompositorBloomOn()
     407  {
     408    Ogre::SceneManager* mSceneMgr = GraphicsEngine::getSingleton().getSceneManager();
     409    Ogre::Viewport* mViewport = mSceneMgr->getCurrentViewport();
     410    Ogre::CompositorManager::getSingleton().addCompositor(mViewport, "Bloom");
     411    Ogre::CompositorManager::getSingleton().setCompositorEnabled(mViewport, "Bloom", true);
     412  }
     413  void GraphicsEngine::CompositorBloomOff()
     414  {
     415    Ogre::SceneManager* mSceneMgr = GraphicsEngine::getSingleton().getSceneManager();
     416    Ogre::Viewport* mViewport = mSceneMgr->getCurrentViewport();
     417    Ogre::CompositorManager::getSingleton().setCompositorEnabled(mViewport, "Bloom", false);
     418  }
     419
     420  void GraphicsEngine::CompositorMotionBlurOn()
     421  {
     422    Ogre::SceneManager* mSceneMgr = GraphicsEngine::getSingleton().getSceneManager();
     423    Ogre::Viewport* mViewport = mSceneMgr->getCurrentViewport();
     424    Ogre::CompositorManager::getSingleton().addCompositor(mViewport, "MotionBlur");
     425    Ogre::CompositorManager::getSingleton().setCompositorEnabled(mViewport, "MotionBlur", true);
     426  }
     427  void GraphicsEngine::CompositorMotionBlurOff()
     428  {
     429    Ogre::SceneManager* mSceneMgr = GraphicsEngine::getSingleton().getSceneManager();
     430    Ogre::Viewport* mViewport = mSceneMgr->getCurrentViewport();
     431    Ogre::CompositorManager::getSingleton().setCompositorEnabled(mViewport, "MotionBlur", false);
     432  }*/
    367433}
Note: See TracChangeset for help on using the changeset viewer.