22 HRESULT InvalidateDeviceObjects();
23 HRESULT RestoreDeviceObjects();
34 const Matrix4* GetTexViewProjMatrix();
35 const Matrix4* GetViewProjMatrix();
100 static int g_nShadowMapTexelSizeLevel;
101 #ifdef USE_DIRECTX_RENDERER 102 LPDIRECT3DSURFACE9 m_pBackBuffer, m_pZBuffer;
103 LPDIRECT3DSURFACE9 m_pSMColorSurface, m_pSMColorSurfaceBlurredHorizontal, m_pSMColorSurfaceBlurredVertical, m_pSMZSurface;
105 GLuint mOldFrameBufferObject;
106 GLuint mSMFrameBufferObject,mSMDepthStencilBufferObject;
108 asset_ptr<TextureEntity> m_pSMColorTexture, m_pSMColorTextureBlurredHorizontal, m_pSMColorTextureBlurredVertical, m_pSMZTexture;
109 int m_shadowTexWidth, m_shadowTexHeight;
114 std::vector<CShapeAABB> m_ShadowCasterPoints;
116 std::vector<CShapeAABB> m_ShadowReceiverPoints;
125 bool m_bSupportsHWShadowMaps;
127 bool m_bBlurSMColorTexture;
130 bool m_bUnitCubeClip;
132 bool m_bDisplayShadowMap;
133 bool m_bShadowTestInverted;
134 float m_fAspect, m_zNear, m_zFar, m_ppNear, m_ppFar, m_fSlideBack, m_fLSPSM_Nopt, m_fCosGamma;
139 float m_fMinInfinityZ;
140 float m_fLSPSM_NoptWeight;
148 bool ComputeVirtualCameraParameters();
149 bool BuildTSMProjectionMatrix();
150 bool BuildPSMProjectionMatrix();
151 bool BuildLSPSMProjectionMatrix();
152 bool BuildOrthoShadowProjectionMatrix();
153 #ifdef USE_DIRECTX_RENDERER 154 HRESULT CheckResourceFormatSupport(D3DFORMAT fmt, D3DRESOURCETYPE resType, DWORD dwUsage);
void SetShadowMapTexelSize(int nWidth, int nHeight)
Set the size of the shadow map.
static void SetDefaultShadowMapTexelSizeLevel(int nLevel)
set the size level of the shadow map when it is created.
Definition: ShadowMap.h:92
HRESULT EndShadowPass()
end the shadow map
void SetShadowTechnique(SHADOW_TECHNIQUE technique)
I will support two shadow mapping method.
Definition: ShadowMap.h:79
different physics engine has different winding order.
Definition: EventBinding.h:32
HRESULT SetShadowTexture(CEffectFile &pEffect, int nTextureIndex, int nUseBlur=0)
apply the current shadow map to the selected effect file at the specified texture index ...
bool SaveShadowMapToFile(string filePath)
save shadow map to file
HRESULT BeginShadowPass()
The function is responsible for building the perspective shadow map projection matrix and set the ren...
void AddShadowCasterPoint(const CShapeAABB &aabb)
add a shadow caster point.
Standard 3-dimensional vector.
Definition: ParaVector3.h:16
bool PrepareAllSurfaces()
prepare all device objects.
AABB-related code.
Definition: ShapeAABB.h:11
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: ParaMatrix4.h:23
bool UsingBlurredShadowMap()
whether to use blurred shadow map for the global terrain.
Definition: ShadowMap.h:82
Definition: effect_file.h:323
int GetShadowMapTexelSize()
get the size of the shadow map.
void SetShadowMapTexelSizeLevel(int nLevel)
change the size level of the shadow map.
some functions about shadow map
Definition: ShadowMap.h:8
SHADOW_TECHNIQUE GetShadowTechnique()
I will support two shadow mapping method.
Definition: ShadowMap.h:63
bool SupportsHWShadowMaps()
return true if device support hardware shadow map.
Definition: ShadowMap.h:49
void UnsetShadowTexture(int nTextureIndex)
unset projective texture