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 65 /// Looks up the shadow map for the light then sets it. 66 void setLightShadowMapForLight( LightInfo *light ); 67 68 /// Return the current shadow map 69 LightShadowMap* getCurrentShadowMap() const { return mCurrentShadowMap; } 70 71 ShadowMapPass* getShadowMapPass() const { return mShadowMapPass; } 72 73 // Shadow manager 74 virtual void activate(); 75 virtual void deactivate(); 76 77 GFXTextureObject* getTapRotationTex(); 78 79 /// The shadow map deactivation signal. 80 static Signal<void(void)> smShadowDeactivateSignal; 81 82 static void updateShadowDisable(); 83 84protected: 85 86 void _onTextureEvent( GFXTexCallbackCode code ); 87 88 void _onPreRender( SceneManager *sg, const SceneRenderState* state ); 89 90 ShadowMapPass *mShadowMapPass; 91 LightShadowMap *mCurrentShadowMap; 92 93 /// 94 GFXTexHandle mTapRotationTex; 95 96 bool mIsActive; 97 98public: 99 // For ManagedSingleton. 100 static const char* getSingletonName() { return "ShadowMapManager"; } 101}; 102 103 104/// Returns the ShadowMapManager singleton. 105#define SHADOWMGR ManagedSingleton<ShadowMapManager>::instance() 106 107GFX_DeclareTextureProfile( ShadowMapTexProfile ); 108 109#endif // _SHADOWMAPMANAGER_H_ 110