SO3Engine
SO3LightShaft.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 __SO3LIGHTSHAFT_H__
32#define __SO3LIGHTSHAFT_H__
33
36
37namespace SO3
38{
39
42class SLightShaft : public Ogre::RenderTargetListener, public Ogre::MaterialManager::Listener
43{
44public:
45protected:
47 Ogre::SceneManager* mSceneMgr;
48
49private:
50 std::queue<std::string> mMaterials;
51 Ogre::Camera* mLightCamera;
52 SNode* mParent;
53 float mMinStep;
54 Ogre::BillboardSet* mBillboardSet;
55 Ogre::MaterialPtr mShaftMaterial;
56 Ogre::MaterialPtr mDepthMaterial;
57 Ogre::TexturePtr mDepthTexture;
58 bool mNeedUpdate;
59public:
63 SLightShaft(SNode* parent, float minStep = 0.2f, float nearClip = 1.0f, float farClip = 50.0f, Ogre::Radian fov = Ogre::Degree(17.5f));
64
69
70 void SetMinStep(const float minStep);
71 void SetCookieTexture(std::string path);
72 void SetLightClipping(float nearClip, float farClip);
73 void SetAttenuation(Ogre::Vector4 attenuation);
74 void SetLightFov(Ogre::Radian fov);
75 void SetColor(Ogre::ColourValue col);
76 void Update();
77
81 virtual Ogre::Technique* handleSchemeNotFound(unsigned short schemeIndex, const Ogre::String& schemeName, Ogre::Material* originalMaterial, unsigned short lodIndex, const Ogre::Renderable* rend);
82
83protected:
84private:
89
90 void preRenderTargetUpdate(const Ogre::RenderTargetEvent& evt);
91 void postRenderTargetUpdate(const Ogre::RenderTargetEvent& evt);
92
93 void UpdatePosition();
94 void UpdateTextureProjectionMatrix();
95 void CreateLightShafts();
96 void CreateLightCameraRTT();
97};
98
99}
100
101#endif
librairies include
virtual Ogre::Technique * handleSchemeNotFound(unsigned short schemeIndex, const Ogre::String &schemeName, Ogre::Material *originalMaterial, unsigned short lodIndex, const Ogre::Renderable *rend)
SScene * currentScene
void SetMinStep(const float minStep)
void SetLightClipping(float nearClip, float farClip)
void SetCookieTexture(std::string path)
void SetColor(Ogre::ColourValue col)
Ogre::SceneManager * mSceneMgr
void SetAttenuation(Ogre::Vector4 attenuation)
void SetLightFov(Ogre::Radian fov)