projectedShadow.h
Engine/source/lighting/common/projectedShadow.h
Classes:
class
Public Functions
GFX_DeclareTextureProfile(BLProjectedShadowProfile )
GFX_DeclareTextureProfile(BLProjectedShadowZProfile )
Detailed Description
Public Functions
GFX_DeclareTextureProfile(BLProjectedShadowProfile )
GFX_DeclareTextureProfile(BLProjectedShadowZProfile )
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 _PROJECTEDSHADOW_H_ 25#define _PROJECTEDSHADOW_H_ 26 27#ifndef _DEPTHSORTLIST_H_ 28#include "collision/depthSortList.h" 29#endif 30#ifndef _SCENEOBJECT_H_ 31#include "scene/sceneObject.h" 32#endif 33#ifndef _TSSHAPEINSTANCE_H_ 34#include "ts/tsShapeInstance.h" 35#endif 36#ifndef _LIGHTINGSYSTEM_SHADOWBASE_H_ 37#include "lighting/common/shadowBase.h" 38#endif 39 40class ShapeBase; 41class LightInfo; 42class DecalData; 43class DecalInstance; 44class RenderPassManager; 45class PostEffect; 46class RenderMeshMgr; 47class CustomMaterial; 48class BaseMatInstance; 49class MaterialParameterHandle; 50 51 52GFX_DeclareTextureProfile( BLProjectedShadowProfile ); 53GFX_DeclareTextureProfile( BLProjectedShadowZProfile ); 54 55class ProjectedShadow : public ShadowBase 56{ 57 58protected: 59 60 61 /// This parameter is used to 62 /// adjust the far plane out for our 63 /// orthographic render in order to 64 /// force our object towards one end of the 65 /// the eye space depth range. 66 static F32 smDepthAdjust; 67 68 F32 mRadius; 69 MatrixF mWorldToLight; 70 U32 mLastRenderTime; 71 72 F32 mShadowLength; 73 74 F32 mScore; 75 bool mUpdateTexture; 76 77 Point3F mLastObjectScale; 78 Point3F mLastObjectPosition; 79 VectorF mLastLightDir; 80 81 DecalData *mDecalData; 82 DecalInstance *mDecalInstance; 83 84 SceneObject *mParentObject; 85 ShapeBase *mShapeBase; 86 87 MaterialParameterHandle *mCasterPositionSC; 88 MaterialParameterHandle *mShadowLengthSC; 89 90 static SimObjectPtr<RenderPassManager> smRenderPass; 91 92 static SimObjectPtr<PostEffect> smShadowFilter; 93 94 static RenderPassManager* _getRenderPass(); 95 96 GFXTexHandle mShadowTexture; 97 GFXTextureTargetRef mRenderTarget; 98 99 GFXTextureObject* _getDepthTarget( U32 width, U32 height ); 100 void _renderToTexture( F32 camDist, const TSRenderState &rdata ); 101 102 bool _updateDecal( const SceneRenderState *sceneState ); 103 104 void _calcScore( const SceneRenderState *state ); 105 106 /// Returns a spotlight shadow material for use when 107 /// rendering meshes into the projected shadow. 108 static BaseMatInstance* _getShadowMaterial( BaseMatInstance *inMat ); 109 110public: 111 112 /// @see DecalData 113 static F32 smFadeStartPixelSize; 114 static F32 smFadeEndPixelSize; 115 116 ProjectedShadow( SceneObject *object ); 117 virtual ~ProjectedShadow(); 118 119 bool shouldRender( const SceneRenderState *state ); 120 121 void update( const SceneRenderState *state ); 122 void render( F32 camDist, const TSRenderState &rdata ); 123 U32 getLastRenderTime() const { return mLastRenderTime; } 124 const F32 getScore() const { return mScore; } 125 126}; 127 128#endif // _PROJECTEDSHADOW_H_ 129