Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1466


Ignore:
Timestamp:
May 28, 2008, 11:40:06 PM (16 years ago)
Author:
janise
Message:

compositors and shader work with hacks. added a directional light

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

Legend:

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

    r1454 r1466  
    4848#include "console/InGameConsole.h"
    4949
     50#include "core/ConsoleCommand.h"
     51#include <OgreSceneManager.h>
     52#include <OgreCompositorManager.h>
     53#include <OgreViewport.h>
     54
    5055namespace orxonox {
    51 
     56 
     57  SetConsoleCommandShortcut(GraphicsEngine, CompositorBloomOn).setAccessLevel(AccessLevel::User);
     58  SetConsoleCommandShortcut(GraphicsEngine, CompositorMotionBlurOn).setAccessLevel(AccessLevel::User);
     59  SetConsoleCommandShortcut(GraphicsEngine, CompositorBloomOff).setAccessLevel(AccessLevel::User);
     60  SetConsoleCommandShortcut(GraphicsEngine, CompositorMotionBlurOff).setAccessLevel(AccessLevel::User);
    5261  /**
    5362    @brief Returns the singleton instance and creates it the first time.
     
    369378    CommandExecutor::execute("exit", false);
    370379  }
     380
     381  //HACK!!
     382  void GraphicsEngine::CompositorBloomOn()
     383  {
     384    Ogre::SceneManager* mSceneMgr = GraphicsEngine::getSingleton().getSceneManager();
     385    Ogre::Viewport* mViewport = mSceneMgr->getCurrentViewport();
     386    Ogre::CompositorManager::getSingleton().addCompositor(mViewport, "Bloom");
     387    Ogre::CompositorManager::getSingleton().setCompositorEnabled(mViewport, "Bloom", true);
     388  }
     389  void GraphicsEngine::CompositorBloomOff()
     390  {
     391    Ogre::SceneManager* mSceneMgr = GraphicsEngine::getSingleton().getSceneManager();
     392    Ogre::Viewport* mViewport = mSceneMgr->getCurrentViewport();
     393    Ogre::CompositorManager::getSingleton().setCompositorEnabled(mViewport, "Bloom", false);
     394  }
     395
     396  void GraphicsEngine::CompositorMotionBlurOn()
     397  {
     398    Ogre::SceneManager* mSceneMgr = GraphicsEngine::getSingleton().getSceneManager();
     399    Ogre::Viewport* mViewport = mSceneMgr->getCurrentViewport();
     400    Ogre::CompositorManager::getSingleton().addCompositor(mViewport, "MotionBlur");
     401    Ogre::CompositorManager::getSingleton().setCompositorEnabled(mViewport, "MotionBlur", true);
     402  }
     403  void GraphicsEngine::CompositorMotionBlurOff()
     404  {
     405    Ogre::SceneManager* mSceneMgr = GraphicsEngine::getSingleton().getSceneManager();
     406    Ogre::Viewport* mViewport = mSceneMgr->getCurrentViewport();
     407    Ogre::CompositorManager::getSingleton().setCompositorEnabled(mViewport, "MotionBlur", false);
     408  }
    371409}
  • code/branches/network/src/orxonox/GraphicsEngine.h

    r1414 r1466  
    8383            static GraphicsEngine* getSingletonPtr() { return &getSingleton(); }
    8484
     85            //HACK!!!
     86            void static CompositorBloomOn();
     87            void static CompositorBloomOff();
     88            void static CompositorMotionBlurOn();
     89            void static CompositorMotionBlurOff();
     90
     91
    8592        private:
    8693            // don't mess with singletons
  • code/branches/network/src/orxonox/Orxonox.cc

    r1454 r1466  
    7070// objects and tools
    7171#include "hud/HUD.h"
     72#include <Ogre.h>
     73
     74#include "GraphicsEngine.h"
    7275
    7376// FIXME: is this really file scope?
     
    340343    Level* startlevel = new Level("levels/sample.oxw");
    341344    Loader::open(startlevel);
    342 
     345   
     346
     347    Ogre::SceneManager* mSceneMgr = GraphicsEngine::getSingleton().getSceneManager();
     348    mSceneMgr->setAmbientLight(ColourValue(0.4,0.4,0.4));
     349    Ogre::Light* dirlight = mSceneMgr->createLight("Light1");
     350
     351       dirlight->setType(Ogre::Light::LT_DIRECTIONAL);
     352       dirlight->setDirection(Vector3( 0, 1, 5 ));
     353       dirlight->setDiffuseColour(ColourValue(0.6, 0.6, 0.4));
     354       dirlight->setSpecularColour(ColourValue(1.0, 1.0, 1.0));
     355   
    343356    return true;
    344357  }
     
    380393    clock_t time = 0;
    381394
     395    //Ogre::SceneManager* mSceneMgr = GraphicsEngine::getSingleton().getSceneManager();
     396    //Ogre::Viewport* mViewport = mSceneMgr->getCurrentViewport();
     397   
     398    //Ogre::CompositorManager::getSingleton().addCompositor(mViewport, "Bloom");
     399    //Ogre::CompositorManager::getSingleton().addCompositor(mViewport, "MotionBlur");
     400
    382401    COUT(3) << "Orxonox: Starting the main loop." << std::endl;
    383402          while (!bAbort_)
  • code/branches/network/src/orxonox/objects/Model.cc

    r1293 r1466  
    3434#include "GraphicsEngine.h"
    3535#include "core/XMLPort.h"
     36
     37#include <OgreEntity.h>
     38#include <OgreMesh.h>
     39#include <OgreHardwareVertexBuffer.h>
     40#include <OgreMeshManager.h>
     41
    3642
    3743namespace orxonox
     
    7783        this->mesh_.setMesh(meshSrc_);
    7884        this->attachObject(this->mesh_.getEntity());
     85
     86        //HACK!!
     87        if ((this->meshSrc_ == "assff.mesh") || (this->meshSrc_ == "ast1.mesh") || (this->meshSrc_ == "ast2.mesh") || (this->meshSrc_ == "ast3.mesh") || (this->meshSrc_ == "ast4.mesh") ||(this->meshSrc_ == "ast5.mesh") || (this->meshSrc_ == "ast6.mesh"))
     88        {
     89          Ogre::MeshPtr pMesh = this->mesh_.getEntity()->getMesh();
     90          //set Mesh to tangentspace
     91          unsigned short src, dest;
     92          if (!pMesh->suggestTangentVectorBuildParams(Ogre::VES_TANGENT, src, dest))
     93          {
     94            pMesh->buildTangentVectors(Ogre::VES_TANGENT, src, dest);
     95          }
     96          if ((this->meshSrc_ == "assff.mesh"))
     97          {
     98            (this->mesh_.getEntity())->setMaterialName("Assff/BumpMap");
     99          }
     100          else
     101          {
     102            (this->mesh_.getEntity())->setMaterialName("Asteroid/BumpMap");
     103          }
     104
     105
     106        }
    79107        COUT(4) << "Loader (Model.cc): Created model" << std::endl;
    80108      }
Note: See TracChangeset for help on using the changeset viewer.