Project

General

Profile

SO3Engine
SO3HdrHandler.h
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OpenSpace3D
4For the latest info, see http://www.openspace3d.com
5
6Copyright (c) 2012 I-maginer
7
8This program is free software; you can redistribute it and/or modify it under
9the terms of the GNU Lesser General Public License as published by the Free Software
10Foundation; either version 2 of the License, or (at your option) any later
11version.
12
13This program is distributed in the hope that it will be useful, but WITHOUT
14ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16
17You should have received a copy of the GNU Lesser General Public License along with
18this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20http://www.gnu.org/copyleft/lesser.txt
21
22-----------------------------------------------------------------------------
23*/
24
28#ifndef __SO3_HDR_HANDLER_H__
29#define __SO3_HDR_HANDLER_H__
30
33
34namespace SO3
35{
36
41{
42public:
43 static float mBlurAmount;
44 static float mEffectAmount;
45 static float mGamma;
46protected:
47private:
48 static bool compositorCreated;
49
50 bool isEnable;
51 bool isSupported;
52 SViewPort* targetViewport;
53 Ogre::String targetViewportScheme;
54 Ogre::CompositorManager* ogreCompositorManager;
55 Ogre::CompositorInstance* inputCompositorInstance;
56
57public:
58 static void Reset();
59
63 SHdrHandler(SViewPort* targetViewportInstance);
64
69
72 bool GetEnable();
73
76 void SetEnable(bool enable);
77
80 void SetBlurAmount(float amount);
81
84 const float GetBlurAmount();
85
88 void SetEffectAmount(float amount);
89
92 const float GetEffectAmount();
93
96 void SetGamma(float gamma);
97
100 const float GetGamma();
101
102private:
106 SHdrHandler();
107
111 void GenerateRenderQuadVertexShader();
112
116 void CreateCompositors();
117
121 void GenerateHdrCompositor();
122
123};
124
125//The compositor logic for the hdr compositor
127{
128protected:
130 virtual Ogre::CompositorInstance::Listener* createListener(Ogre::CompositorInstance* instance);
131};
132
133class SHdrListener : public Ogre::CompositorInstance::Listener
134{
135public:
136 SHdrListener();
137 virtual ~SHdrListener();
138 void notifyCompositor(Ogre::CompositorInstance* instance);
139 virtual void notifyMaterialSetup(Ogre::uint32 pass_id, Ogre::MaterialPtr &mat);
140 virtual void notifyMaterialRender(Ogre::uint32 pass_id, Ogre::MaterialPtr &mat);
141protected:
142private:
143public:
144protected:
146 // Array params - have to pack in groups of 4 since this is how Cg generates them
147 // also prevents dependent texture read problems if ops don't require swizzle
148 float mBloomTexWeights[15][4];
151private:
152};
153
154}
155
156#endif
librairies include
const float GetBlurAmount()
void SetEnable(bool enable)
void SetEffectAmount(float amount)
void SetBlurAmount(float amount)
static float mEffectAmount
static void Reset()
static float mGamma
const float GetEffectAmount()
void SetGamma(float gamma)
static float mBlurAmount
const float GetGamma()
void notifyCompositor(Ogre::CompositorInstance *instance)
virtual void notifyMaterialSetup(Ogre::uint32 pass_id, Ogre::MaterialPtr &mat)
float mBloomTexOffsetsVert[15][4]
virtual void notifyMaterialRender(Ogre::uint32 pass_id, Ogre::MaterialPtr &mat)
float mBloomTexOffsetsHorz[15][4]
float mBloomTexWeights[15][4]
virtual Ogre::CompositorInstance::Listener * createListener(Ogre::CompositorInstance *instance)