shadowMapManager.h
Engine/source/lighting/shadowMap/shadowMapManager.h
Classes:
class
Public Defines
define
SHADOWMGR() <>::instance()
Returns the ShadowMapManager singleton.
Public Functions
GFX_DeclareTextureProfile(ShadowMapTexProfile )
Detailed Description
Public Defines
SHADOWMGR() <>::instance()
Returns the ShadowMapManager singleton.
Public Functions
GFX_DeclareTextureProfile(ShadowMapTexProfile )
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#ifndef _SHADOWMAPMANAGER_H_ 25#define _SHADOWMAPMANAGER_H_ 26 27#ifndef _TSINGLETON_H_ 28#include "core/util/tSingleton.h" 29#endif 30#ifndef _SHADOWMANAGER_H_ 31#include "lighting/shadowManager.h" 32#endif 33#ifndef _GFXENUMS_H_ 34#include "gfx/gfxEnums.h" 35#endif 36#ifndef _GFXTEXTUREHANDLE_H_ 37#include "gfx/gfxTextureHandle.h" 38#endif 39#ifndef _MPOINT4_H_ 40#include "math/mPoint4.h" 41#endif 42 43class LightShadowMap; 44class ShadowMapPass; 45class LightInfo; 46 47class SceneManager; 48class SceneRenderState; 49 50 51class ShadowMapManager : public ShadowManager 52{ 53 typedef ShadowManager Parent; 54 55 friend class ShadowMapPass; 56 57public: 58 59 ShadowMapManager(); 60 virtual ~ShadowMapManager(); 61 62 /// Sets the current shadowmap (used in setLightInfo/setTextureStage calls) 63 void setLightShadowMap( LightShadowMap *lm ) { mCurrentShadowMap = lm; } 64 void setLightDynamicShadowMap( LightShadowMap *lm ) { mCurrentDynamicShadowMap = lm; } 65 66 /// Looks up the shadow map for the light then sets it. 67 void setLightShadowMapForLight( LightInfo *light ); 68 69 /// Return the current shadow map 70 LightShadowMap* getCurrentShadowMap() const { return mCurrentShadowMap; } 71 LightShadowMap* getCurrentDynamicShadowMap() const { return mCurrentDynamicShadowMap; } 72 73 ShadowMapPass* getShadowMapPass() const { return mShadowMapPass; } 74 75 // Shadow manager 76 virtual void activate(); 77 virtual void deactivate(); 78 79 GFXTextureObject* getTapRotationTex(); 80 81 /// The shadow map deactivation signal. 82 static Signal<void(void)> smShadowDeactivateSignal; 83 84 static void updateShadowDisable(); 85 86protected: 87 88 void _onTextureEvent( GFXTexCallbackCode code ); 89 90 void _onPreRender( SceneManager *sg, const SceneRenderState* state ); 91 92 ShadowMapPass *mShadowMapPass; 93 LightShadowMap *mCurrentShadowMap; 94 LightShadowMap *mCurrentDynamicShadowMap; 95 96 /// 97 GFXTexHandle mTapRotationTex; 98 99 bool mIsActive; 100 101public: 102 // For ManagedSingleton. 103 static const char* getSingletonName() { return "ShadowMapManager"; } 104}; 105 106 107/// Returns the ShadowMapManager singleton. 108#define SHADOWMGR ManagedSingleton<ShadowMapManager>::instance() 109 110GFX_DeclareTextureProfile( ShadowMapTexProfile ); 111 112#endif // _SHADOWMAPMANAGER_H_ 113
