SO3Engine
SO3Shadow.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
31#ifndef __SO3SHADOW_H__
32#define __SO3SHADOW_H__
33
36#include "SO3ShadowManager.h"
37#include "OgreCompositorInstance.h"
38#include "OgreCustomCompositionPass.h"
39
40namespace SO3
41{
42
46{
47public:
48protected:
49 Ogre::Viewport* targetViewport;
50private:
51public:
55 SShadowViewport(Ogre::Viewport* viewport);
56
60 virtual ~SShadowViewport();
61
62 virtual void UpdateCamera(Ogre::Camera* cam);
63protected:
64private:
65};
66
69class SShadow : public SData
70{
71public:
72protected:
74 Ogre::SceneManager* ogreScene;
76 Ogre::ShadowCameraSetupPtr cameraSetup;
77 Ogre::PixelFormat mRttFormat;
78 typedef std::map<SViewPort*, SShadowViewport*> SHADOWViewportMap;
80 Ogre::Real mFadeStart;
81 Ogre::Real mFadeEnd;
82private:
83 SShadowManager::ShadowLightingType shadowLightingTechnique;
85
86public:
90 SShadow(SShadowManager* sManager, const std::string& shadowTechniqueName, const SShadowManager::ShadowType& shadowType);
91
95 virtual ~SShadow();
96
100
104
107 virtual void UpdateShadowTechnique()=0;
108
111 virtual void UpdateShadowMaterial(Ogre::Technique* tech);
112
115 virtual void RemoveMaterialPass(Ogre::Technique* tech);
116
119 virtual bool IsShadowMaterialPass(Ogre::Pass* pass);
120
121 Ogre::ShadowCameraSetupPtr GetCameraSetup();
122protected:
126 void SetCameraSetup(Ogre::ShadowCameraSetupPtr shadowCameraSetup);
127private:
131 SShadow();
132};
133
137class ShadowCompositorRenderOperation : public Ogre::CompositorInstance::RenderSystemOperation
138{
139public:
140protected:
141private:
142 Ogre::CompositorInstance* mCompInstance;
143
144public:
147 ShadowCompositorRenderOperation(Ogre::CompositorInstance* instance, const Ogre::CompositionPass* pass);
148
152
156 virtual void execute(Ogre::SceneManager* sm, Ogre::RenderSystem* rs);
157protected:
158private:
159};
160
164class ShadowCompositorPass : public Ogre::CustomCompositionPass
165{
166public:
167protected:
168private:
169
170public:
174 virtual Ogre::CompositorInstance::RenderSystemOperation* createOperation(Ogre::CompositorInstance* instance, const Ogre::CompositionPass* pass);
175protected:
176private:
177};
178
179}
180
181#endif
librairies include
virtual void UpdateShadowTechnique()=0
Definition SO3Shadow.cpp:79
Ogre::ShadowCameraSetupPtr GetCameraSetup()
Definition SO3Shadow.cpp:64
Ogre::Real mFadeStart
Definition SO3Shadow.h:80
std::map< SViewPort *, SShadowViewport * > SHADOWViewportMap
Definition SO3Shadow.h:78
Ogre::Real mFadeEnd
Definition SO3Shadow.h:81
SShadowManager * shadowManager
Definition SO3Shadow.h:75
Ogre::ShadowCameraSetupPtr cameraSetup
Definition SO3Shadow.h:76
Ogre::SceneManager * ogreScene
Definition SO3Shadow.h:74
virtual void UpdateShadowMaterial(Ogre::Technique *tech)
Definition SO3Shadow.cpp:83
virtual void RemoveMaterialPass(Ogre::Technique *tech)
Definition SO3Shadow.cpp:87
virtual ~SShadow()
Definition SO3Shadow.cpp:46
SHADOWViewportMap viewportMap
Definition SO3Shadow.h:79
void SetCameraSetup(Ogre::ShadowCameraSetupPtr shadowCameraSetup)
Definition SO3Shadow.cpp:57
SShadowManager * GetShadowManager()
Definition SO3Shadow.cpp:74
SShadowManager::ShadowType GetShadowType()
Definition SO3Shadow.cpp:69
virtual bool IsShadowMaterialPass(Ogre::Pass *pass)
Definition SO3Shadow.cpp:91
Ogre::PixelFormat mRttFormat
Definition SO3Shadow.h:77
SScene * currentScene
Definition SO3Shadow.h:73
virtual ~SShadowViewport()
virtual void UpdateCamera(Ogre::Camera *cam)
Ogre::Viewport * targetViewport
Definition SO3Shadow.h:49
virtual Ogre::CompositorInstance::RenderSystemOperation * createOperation(Ogre::CompositorInstance *instance, const Ogre::CompositionPass *pass)
virtual void execute(Ogre::SceneManager *sm, Ogre::RenderSystem *rs)