Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes

sp::video::ShadowMapper Class Reference

#include <spShadowMapper.hpp>

List of all members.

Classes

struct  SShadowMap

Public Member Functions

 ShadowMapper ()
virtual ~ShadowMapper ()
virtual bool createShadowMaps (s32 TexSize, u32 MaxPointLightCount, u32 MaxSpotLightCount, bool UseVSM=true, bool UseRSM=false)
virtual void deleteShadowMaps ()
 Deletes the shadow maps.
virtual bool renderShadowMap (scene::SceneGraph *Graph, scene::Camera *Cam, scene::Light *LightObj, u32 Index)
virtual void bind (const s32 ShadowMapLayerBase)
virtual void unbind (const s32 ShadowMapLayerBase)
TexturegetSpotLightTexArray ()
 Returns the spot light texture array for shadow mapping.
TexturegetPointLightTexArray ()
 Returns the point light cube texture array for shadow mapping.

Static Public Member Functions

static bool renderCubeMap (scene::SceneGraph *Graph, scene::Camera *Cam, Texture *Tex, const dim::vector3df &Position)
static bool renderCubeMapDirection (scene::SceneGraph *Graph, scene::Camera *Cam, Texture *Tex, dim::matrix4f CamDir, const ECubeMapDirections Direction)
static bool renderCubeMap (scene::SceneGraph *Graph, Texture *Tex, const dim::vector3df &Position)

Protected Member Functions

bool renderPointLightShadowMap (scene::SceneGraph *Graph, scene::Camera *Cam, scene::Light *LightObj, u32 Index)
bool renderSpotLightShadowMap (scene::SceneGraph *Graph, scene::Camera *Cam, scene::Light *LightObj, u32 Index)
bool checkLightFrustumCulling (scene::Camera *Cam, scene::Light *LightObj) const
void renderSceneIntoDepthTexture (scene::SceneGraph *Graph, SShadowMap &ShadowMap, u32 Index)
void renderSceneIntoGBuffer (scene::SceneGraph *Graph, SShadowMap &ShadowMap, u32 Index)

Static Protected Member Functions

static void renderCubeMapDirection (scene::SceneGraph *Graph, Texture *Tex, const ECubeMapDirections Direction)

Protected Attributes

SShadowMap ShadowMapArray_
SShadowMap ShadowCubeMapArray_
scene::Camera DepthCam_
s32 TexSize_
u32 MaxPointLightCount_
u32 MaxSpotLightCount_
bool UseVSM_
 Specifies whether VSMs (variance shadow maps) are used or not.
bool UseRSM_
 Specifies whether RSMs (reflective shadow maps) are used or not.

Static Protected Attributes

static const dim::matrix4f CUBEMAP_ROTATIONS [6]
static scene::Camera ViewCam_

Detailed Description

The shadow mapper class is used to render the textures for real-time shadow mapping effects. Supported are shadow maps for PCF (percentage closer filtering), VSMs (variance shadow maps) and RSMs (reflective shadow maps). This class also provides a couple of functions for generating color cube maps. You can use this class to make your own shadow map rendering or to use it with the integrated deferred renderer.

Since:
Version 3.2

Constructor & Destructor Documentation

sp::video::ShadowMapper::ShadowMapper (  ) 
sp::video::ShadowMapper::~ShadowMapper (  )  [virtual]

Member Function Documentation

void sp::video::ShadowMapper::bind ( const s32  ShadowMapLayerBase  )  [virtual]
bool sp::video::ShadowMapper::checkLightFrustumCulling ( scene::Camera Cam,
scene::Light LightObj 
) const [protected]
Warning:
Does not check for null pointers!
bool sp::video::ShadowMapper::createShadowMaps ( s32  TexSize,
u32  MaxPointLightCount,
u32  MaxSpotLightCount,
bool  UseVSM = true,
bool  UseRSM = false 
) [virtual]

Creates the shadow map texture arrays.

Parameters:
[in] TexSize Specifies the size for each shadow map. Use values like 128, 256, 512 etc.
[in] MaxPointLightCount Specifies the count of point-lights.
[in] MaxSpotLightCount Specifies the count of spot-lights.
[in] UseVSM Specifies whether VSM (variance shadow maps) are used or not. If true the shadow maps provide two components for each texel (PIXELFORMAT_GRAYALPHA). Otherwise only one (PIXELFORMAT_GRAY). By default true.
[in] UseRSM Specifies whether RSM (reflective shadow maps) are used or not. If true additional textures are used, which store color- and normal information like a g-buffer. RSMs are used for real-time global illumination and can be combined with VSMs. This is a very time consuming effect and should only be used for a small count of light sources! By default false.
Returns:
True if the shadow map textures were created successful.
void sp::video::ShadowMapper::deleteShadowMaps (  )  [virtual]

Deletes the shadow maps.

Texture* sp::video::ShadowMapper::getPointLightTexArray (  )  [inline]

Returns the point light cube texture array for shadow mapping.

Texture* sp::video::ShadowMapper::getSpotLightTexArray (  )  [inline]

Returns the spot light texture array for shadow mapping.

bool sp::video::ShadowMapper::renderCubeMap ( scene::SceneGraph Graph,
Texture Tex,
const dim::vector3df Position 
) [static]

Renders a complete cube map for the specified texture object without any view orientation.

Parameters:
Graph,: Specifies the scene graph which is to be rendered.
Tex,: Specifies the texture which is to be used. This texture needs to be a valid cube map. To achieve that call the "Texture::setDimension(DIMENSION_CUBEMAP)" function.
Position,: Specifies the position where the 'screenshot-like' cube map is to be generated.
Returns:
True of success otherwise false.
bool sp::video::ShadowMapper::renderCubeMap ( scene::SceneGraph Graph,
scene::Camera Cam,
Texture Tex,
const dim::vector3df Position 
) [static]

Renders a complete cube map for the specified texture object.

Parameters:
Graph,: Specifies the scene graph which is to be rendered.
Cam,: Specifies the camera object which from which point of view the scene is to be rendered. Don't use your standard camera object. Create a separate camera for rendering into cube maps, set its field-of-view to 90 degrees (scene::Camera::setFOV) and dont set its parent.
Tex,: Specifies the texture which is to be used. This texture needs to be a valid cube map. To achieve that call the "Texture::setDimension(DIMENSION_CUBEMAP)" function.
Position,: Specifies the position where the 'screenshot-like' cube map is to be generated.
Returns:
True of success otherwise false.
void sp::video::ShadowMapper::renderCubeMapDirection ( scene::SceneGraph Graph,
Texture Tex,
const ECubeMapDirections  Direction 
) [static, protected]
bool sp::video::ShadowMapper::renderCubeMapDirection ( scene::SceneGraph Graph,
scene::Camera Cam,
Texture Tex,
dim::matrix4f  CamDir,
const ECubeMapDirections  Direction 
) [static]

Renders the specified cube map side. This is used inside the renderCubeMap function.

Parameters:
Graph,: Specifies the scene graph which is to be rendered.
Cam,: Specifies the camera object which from which point of view the scene is to be rendered.
Tex,: Specifies the cube map Texture object. This texture needs to be a valid cube map.
CamDir,: Specifies the camera direction matrix. This function should be called six times (for all compass points). With each call the camera direction has to be a different orientation.
Direction,: Specifies the type of cube map direction.
Returns:
True of success otherwise false.
See also:
renderCubeMap
bool sp::video::ShadowMapper::renderPointLightShadowMap ( scene::SceneGraph Graph,
scene::Camera Cam,
scene::Light LightObj,
u32  Index 
) [protected]
Warning:
Does not check for null pointers!
void sp::video::ShadowMapper::renderSceneIntoDepthTexture ( scene::SceneGraph Graph,
SShadowMap ShadowMap,
u32  Index 
) [protected]
void sp::video::ShadowMapper::renderSceneIntoGBuffer ( scene::SceneGraph Graph,
SShadowMap ShadowMap,
u32  Index 
) [protected]
bool sp::video::ShadowMapper::renderShadowMap ( scene::SceneGraph Graph,
scene::Camera Cam,
scene::Light LightObj,
u32  Index 
) [virtual]

Renders the shadow map for the specified light object with the given scene graph and its camera.

Parameters:
Graph,: Specifies the scene graph which is to be rendered into the shadow map.
Cam,: Specifies the view camera. The light's view frustum will be tested against the view frustum of this camera object. If a light's view frustum is not inside the shadow map will not be rendered. If you don't want this test, just set this pointer to null.
LightObj,: Specifies the light object from which point of view the scene is to be renderd.
Index,: Specifies the shadow map array index. This value begins with 0 for each light type i.e. there is an array for each light type (point, spot and directional lights).
Returns:
True if a shadow map has been rendered. Otherwise the parameters are invalid or the shadow map has not been rendered because of performance optimization.
bool sp::video::ShadowMapper::renderSpotLightShadowMap ( scene::SceneGraph Graph,
scene::Camera Cam,
scene::Light LightObj,
u32  Index 
) [protected]
Warning:
Does not check for null pointers!
void sp::video::ShadowMapper::unbind ( const s32  ShadowMapLayerBase  )  [virtual]

Member Data Documentation

Initial value:
{
    DefineCubeMapRotation( 0, 0, -1,   0, 1,  0,    1,  0,  0), 
    DefineCubeMapRotation( 0, 0,  1,   0, 1,  0,   -1,  0,  0), 
    DefineCubeMapRotation( 1, 0,  0,   0, 0, -1,    0,  1,  0), 
    DefineCubeMapRotation( 1, 0,  0,   0, 0,  1,    0, -1,  0), 
    DefineCubeMapRotation( 1, 0,  0,   0, 1,  0,    0,  0,  1), 
    DefineCubeMapRotation(-1, 0,  0,   0, 1,  0,    0,  0, -1)  
}

Specifies whether RSMs (reflective shadow maps) are used or not.

Specifies whether VSMs (variance shadow maps) are used or not.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines