Torque3D Documentation / _generateds / shadowMapPass.h

shadowMapPass.h

Engine/source/lighting/shadowMap/shadowMapPass.h

More...

Classes:

class

ShadowMapPass, this is plugged into the SceneManager to generate ShadowMaps for the scene.

Detailed Description

  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 _SHADOWMAPPASS_H_
 25#define _SHADOWMAPPASS_H_
 26
 27#ifndef _RENDERPASSMANAGER_H_
 28#include "renderInstance/renderPassManager.h"
 29#endif
 30#ifndef _RENDERMESHMGR_H_
 31#include "renderInstance/renderMeshMgr.h"
 32#endif
 33#ifndef _LIGHTINFO_H_
 34#include "lighting/lightInfo.h"
 35#endif
 36#ifndef _SHADOW_COMMON_H_
 37#include "lighting/shadowMap/shadowCommon.h"
 38#endif
 39
 40class RenderMeshMgr;
 41class LightShadowMap;
 42class LightManager;
 43class ShadowMapManager;
 44class BaseMatInstance;
 45class RenderObjectMgr;
 46class RenderTerrainMgr;
 47class PlatformTimer;
 48class ShadowRenderPassManager;
 49class DynamicShadowRenderPassManager;
 50
 51/// ShadowMapPass, this is plugged into the SceneManager to generate 
 52/// ShadowMaps for the scene.
 53class ShadowMapPass
 54{
 55public:
 56
 57   ShadowMapPass() {}   // Only called by ConsoleSystem
 58   ShadowMapPass(LightManager* LightManager, ShadowMapManager* ShadowManager);
 59   virtual ~ShadowMapPass();
 60
 61   //
 62   // SceneRenderPass interface
 63   //
 64
 65   /// Called to render a scene.
 66   void render(   SceneManager *sceneGraph, 
 67                  const SceneRenderState *diffuseState, 
 68                  U32 objectMask );
 69
 70   /// Return the type of pass this is
 71   virtual const String& getPassType() const { return PassTypeName; };
 72
 73   /// Return our sort value. (Go first in order to have shadow maps available for RIT_Objects)
 74   virtual F32 getSortValue() const { return 0.0f; }
 75
 76   virtual bool geometryOnly() const { return true; }
 77
 78   static const String PassTypeName;
 79
 80
 81   /// Used to for debugging performance by disabling
 82   /// shadow updates and rendering.
 83   static bool smDisableShadows;
 84
 85   static bool smDisableShadowsEditor;
 86   static bool smDisableShadowsPref;
 87
 88   /// distance moved per frame before forcing a shadow update
 89   static F32 smShadowsTeleportDist;
 90   /// angle turned per frame before forcing a shadow update
 91   static F32 smShadowsTurnRate;
 92
 93private:
 94
 95   static U32 smActiveShadowMaps;
 96   static U32 smUpdatedShadowMaps;
 97   static U32 smNearShadowMaps;
 98   static U32 smShadowMapsDrawCalls;
 99   static U32 smShadowMapPolyCount;
100   static U32 smRenderTargetChanges;
101   static U32 smShadowPoolTexturesCount;
102   static F32 smShadowPoolMemory;
103
104   /// The milliseconds alotted for shadow map updates
105   /// on a per frame basis.
106   static U32 smRenderBudgetMs;
107
108   PlatformTimer *mTimer;
109
110   LightInfoList mLights;
111   U32 mActiveLights;
112   SimObjectPtr<ShadowRenderPassManager> mShadowRPM;
113   SimObjectPtr<DynamicShadowRenderPassManager> mDynamicShadowRPM;
114   LightManager* mLightManager;
115   ShadowMapManager* mShadowManager;
116   Point3F mPrevCamPos;
117   Point3F mPrevCamRot;
118   F32 mPrevCamFov;
119};
120
121class ShadowRenderPassManager : public RenderPassManager
122{
123   typedef RenderPassManager Parent;
124public:
125   ShadowRenderPassManager() : Parent() {}
126
127   /// Add a RenderInstance to the list
128   virtual void addInst( RenderInst *inst );
129};
130
131class DynamicShadowRenderPassManager : public RenderPassManager
132{
133   typedef RenderPassManager Parent;
134public:
135   DynamicShadowRenderPassManager() : Parent() {}
136
137   /// Add a RenderInstance to the list
138   virtual void addInst(RenderInst *inst);
139};
140
141#endif // _SHADOWMAPPASS_H_
142