My Project
Public Types | Public Member Functions | Static Public Member Functions | List of all members
ParaEngine::CShadowMap Class Reference

some functions about shadow map More...

#include <ShadowMap.h>

Public Types

enum  SHADOW_TECHNIQUE { SHADOWTYPE_PSM =0, SHADOWTYPE_LSPSM =1, SHADOWTYPE_TSM =2, SHADOWTYPE_ORTHO =3 }
 

Public Member Functions

HRESULT InvalidateDeviceObjects ()
 
HRESULT RestoreDeviceObjects ()
 
HRESULT BeginShadowPass ()
 The function is responsible for building the perspective shadow map projection matrix and set the render and effect states for rendering the actual shadow map. More...
 
HRESULT EndShadowPass ()
 end the shadow map
 
bool SaveShadowMapToFile (string filePath)
 save shadow map to file
 
const Matrix4GetTexViewProjMatrix ()
 
const Matrix4GetViewProjMatrix ()
 
HRESULT SetShadowTexture (CEffectFile &pEffect, int nTextureIndex, int nUseBlur=0)
 apply the current shadow map to the selected effect file at the specified texture index More...
 
void UnsetShadowTexture (int nTextureIndex)
 unset projective texture
 
bool SupportsHWShadowMaps ()
 return true if device support hardware shadow map. More...
 
int GetShadowMapTexelSize ()
 get the size of the shadow map. More...
 
SHADOW_TECHNIQUE GetShadowTechnique ()
 I will support two shadow mapping method. More...
 
void SetShadowTechnique (SHADOW_TECHNIQUE technique)
 I will support two shadow mapping method. More...
 
bool UsingBlurredShadowMap ()
 whether to use blurred shadow map for the global terrain. More...
 
void SetShadowMapTexelSizeLevel (int nLevel)
 change the size level of the shadow map. More...
 
void SetShadowMapTexelSize (int nWidth, int nHeight)
 Set the size of the shadow map. More...
 
bool PrepareAllSurfaces ()
 prepare all device objects. More...
 
void AddShadowCasterPoint (const CShapeAABB &aabb)
 add a shadow caster point. More...
 

Static Public Member Functions

static void SetDefaultShadowMapTexelSizeLevel (int nLevel)
 set the size level of the shadow map when it is created. More...
 

Detailed Description

some functions about shadow map

Member Function Documentation

§ AddShadowCasterPoint()

void ParaEngine::CShadowMap::AddShadowCasterPoint ( const CShapeAABB aabb)

add a shadow caster point.

§ BeginShadowPass()

HRESULT ParaEngine::CShadowMap::BeginShadowPass ( )

The function is responsible for building the perspective shadow map projection matrix and set the render and effect states for rendering the actual shadow map.

Returns
: return S_OK if succeeded.

§ GetShadowMapTexelSize()

int ParaEngine::CShadowMap::GetShadowMapTexelSize ( )

get the size of the shadow map.

assuming width == height.

§ GetShadowTechnique()

SHADOW_TECHNIQUE ParaEngine::CShadowMap::GetShadowTechnique ( )
inline

I will support two shadow mapping method.

LiPSM and Orthogonal SM, basically:

  • Use LiPSM (with multiple bounding boxes for the terrain receiver): I think it is the best One pass general Shadow Mapping technique.
  • Use Orthogonal SM (with only one bounding box for the terrain receiver): It is fast and looks almost the same as TSM. But only a small region of the terrain(shadow receiver) can has shadow.
  • TODO: Cascaded Shadow Maps with Orthogonal SM is the final solution for more general cases, which I have not implemented yet.
    Returns

§ PrepareAllSurfaces()

bool ParaEngine::CShadowMap::PrepareAllSurfaces ( )

prepare all device objects.

§ SetDefaultShadowMapTexelSizeLevel()

static void ParaEngine::CShadowMap::SetDefaultShadowMapTexelSizeLevel ( int  nLevel)
inlinestatic

set the size level of the shadow map when it is created.

This function is usually called before a shadow map is constructed.

Parameters
nLevel0 means 1024 texels; 1 means 1536 texels. default is level 0.

§ SetShadowMapTexelSize()

void ParaEngine::CShadowMap::SetShadowMapTexelSize ( int  nWidth,
int  nHeight 
)

Set the size of the shadow map.

§ SetShadowMapTexelSizeLevel()

void ParaEngine::CShadowMap::SetShadowMapTexelSizeLevel ( int  nLevel)

change the size level of the shadow map.

Parameters
nLevel0 means 1024 texels; 1 means 1536 texels. default is level 0.

§ SetShadowTechnique()

void ParaEngine::CShadowMap::SetShadowTechnique ( SHADOW_TECHNIQUE  technique)
inline

I will support two shadow mapping method.

LiPSM and Orthogonal SM, basically:

  • Use LiPSM (with multiple bounding boxes for the terrain receiver): I think it is the best One pass general Shadow Mapping technique.
  • Use Orthogonal SM (with only one bounding box for the terrain receiver): It is fast and looks almost the same as TSM. But only a small region of the terrain(shadow receiver) can has shadow.
  • TODO: Cascaded Shadow Maps with Orthogonal SM is the final solution for more general cases, which I have not implemented yet.
    Parameters
    techniqueenum SHADOW_TECHNIQUE { SHADOWTYPE_PSM=0, SHADOWTYPE_LSPSM=1, SHADOWTYPE_TSM=2, SHADOWTYPE_ORTHO=3, };

§ SetShadowTexture()

HRESULT ParaEngine::CShadowMap::SetShadowTexture ( CEffectFile pEffect,
int  nTextureIndex,
int  nUseBlur = 0 
)

apply the current shadow map to the selected effect file at the specified texture index

Parameters
pEffect
nTextureIndex
nUseBlurif 0, the depth shadow map is set, if 1, the blurred image texture is set. blurred image is used for terrain ground or other larger shadow receivers.
Returns

§ SupportsHWShadowMaps()

bool ParaEngine::CShadowMap::SupportsHWShadowMaps ( )
inline

return true if device support hardware shadow map.

§ UsingBlurredShadowMap()

bool ParaEngine::CShadowMap::UsingBlurredShadowMap ( )
inline

whether to use blurred shadow map for the global terrain.


The documentation for this class was generated from the following file: