Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11085


Ignore:
Timestamp:
Jan 23, 2016, 9:34:29 PM (9 years ago)
Author:
landauf
Message:

enable glow shader in all scenes

Location:
code/trunk/src
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/libraries/core/CorePrereqs.h

    r11071 r11085  
    184184    struct GameStateInfo;
    185185    struct GameStateTreeNode;
     186    class GlowMaterialListener;
    186187    class GraphicsManager;
    187188    class GUIManager;
  • code/trunk/src/libraries/core/GraphicsManager.cc

    r11071 r11085  
    3838#include <OgreRoot.h>
    3939#include <OgreLogManager.h>
     40#include <OgreMaterialManager.h>
    4041#include <OgreRenderWindow.h>
    4142#include <OgreRenderSystem.h>
     
    5657#include "Game.h"
    5758#include "GameMode.h"
     59#include "GlowMaterialListener.h"
    5860#include "GUIManager.h"
    5961#include "Loader.h"
     
    100102        , renderWindow_(nullptr)
    101103        , viewport_(nullptr)
     104        , glowMaterialListener_(nullptr)
    102105        , lastFrameStartTime_(0.0f)
    103106        , lastFrameEndTime_(0.0f)
     
    140143        orxout(internal_status) << "destroying GraphicsManager..." << endl;
    141144
     145        Ogre::MaterialManager::getSingleton().removeListener(this->glowMaterialListener_);
    142146        Ogre::WindowEventUtilities::removeWindowEventListener(renderWindow_, ogreWindowEventListener_);
     147
    143148        ModifyConsoleCommand(__CC_printScreen_name).resetFunction();
    144149        ModifyConsoleCommand(__CC_GraphicsManager_group, __CC_setScreenResolution_name).resetFunction();
     
    153158        safeObjectDelete(&ogreLogger_);
    154159        safeObjectDelete(&ogreWindowEventListener_);
     160        safeObjectDelete(&glowMaterialListener_);
    155161
    156162        orxout(internal_status) << "finished destroying GraphicsManager" << endl;
     
    306312
    307313        Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(Ogre::MIP_UNLIMITED);
     314
     315        this->glowMaterialListener_ = new GlowMaterialListener();
     316        Ogre::MaterialManager::getSingleton().addListener(this->glowMaterialListener_);
    308317
    309318        //Add program icon
  • code/trunk/src/libraries/core/GraphicsManager.h

    r11071 r11085  
    127127        Ogre::LogManager*        ogreLogger_;
    128128        Ogre::Root*              ogreRoot_;                //!< Ogre's root
    129         Ogre::RenderWindow* renderWindow_;             //!< the one and only render window
    130         Ogre::Viewport*     viewport_;                 //!< default full size viewport
    131         float               lastFrameStartTime_;       //!< Time stamp of the beginning of the last frame
    132         float               lastFrameEndTime_;         //!< Time stamp of the end of the last frame
     129        Ogre::RenderWindow*      renderWindow_;            //!< the one and only render window
     130        Ogre::Viewport*          viewport_;                //!< default full size viewport
     131        GlowMaterialListener*    glowMaterialListener_;    //!< Material Listener for the 'Glow' compositor
     132        float                    lastFrameStartTime_;      //!< Time stamp of the beginning of the last frame
     133        float                    lastFrameEndTime_;        //!< Time stamp of the end of the last frame
    133134
    134135        // XML files for the resources and the debug overlay
  • code/trunk/src/orxonox/Scene.cc

    r11080 r11085  
    5858#include "Level.h"
    5959#include "RenderQueueListener.h"
     60#include "graphics/GlobalShader.h"
    6061
    6162namespace orxonox
     
    9192
    9293            this->radar_ = new Radar();
     94            this->glowShader_ = new GlobalShader(this);
     95            this->glowShader_->setScene(WeakPtr<Scene>(this), this->getObjectID()); // avoid circular reference
     96            this->glowShader_->getShader().setCompositorName("Glow");
    9397        }
    9498        else
     
    100104            this->renderQueueListener_ = nullptr;
    101105            this->radar_ = nullptr;
     106            this->glowShader_ = nullptr;
    102107        }
    103108
     
    124129            if (this->radar_)
    125130                this->radar_->destroy();
     131            if (this->glowShader_)
     132                this->glowShader_->destroy();
    126133
    127134            if (GameMode::showsGraphics())
  • code/trunk/src/orxonox/Scene.h

    r11080 r11085  
    118118            float                    soundReferenceDistance_; //!< This holds a reference distance, which represents the distance between our scene and the listener
    119119            Radar*                   radar_; //!< This is a pointer to a Radar object assigned with this scene
     120            WeakPtr<GlobalShader>    glowShader_;
    120121
    121122
  • code/trunk/src/orxonox/graphics/GlobalShader.h

    r11071 r11085  
    4848            virtual void changedVisibility() override;
    4949
    50             inline const Shader& getShader() const
     50            inline Shader& getShader()
    5151                { return this->shader_; }
    5252
Note: See TracChangeset for help on using the changeset viewer.