#include <spShadowMapper.hpp>
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) |
| Texture * | getSpotLightTexArray () |
| Returns the spot light texture array for shadow mapping. | |
| Texture * | getPointLightTexArray () |
| 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_ |
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.
| sp::video::ShadowMapper::ShadowMapper | ( | ) |
| sp::video::ShadowMapper::~ShadowMapper | ( | ) | [virtual] |
| void sp::video::ShadowMapper::bind | ( | const s32 | ShadowMapLayerBase | ) | [virtual] |
| bool sp::video::ShadowMapper::checkLightFrustumCulling | ( | scene::Camera * | Cam, | |
| scene::Light * | LightObj | |||
| ) | const [protected] |
| bool sp::video::ShadowMapper::createShadowMaps | ( | s32 | TexSize, | |
| u32 | MaxPointLightCount, | |||
| u32 | MaxSpotLightCount, | |||
| bool | UseVSM = true, |
|||
| bool | UseRSM = false | |||
| ) | [virtual] |
Creates the shadow map texture arrays.
| [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. |
| 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.
| 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. |
| 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.
| 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. |
| 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.
| 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. |
| bool sp::video::ShadowMapper::renderPointLightShadowMap | ( | scene::SceneGraph * | Graph, | |
| scene::Camera * | Cam, | |||
| scene::Light * | LightObj, | |||
| u32 | Index | |||
| ) | [protected] |
| 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.
| 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). |
| bool sp::video::ShadowMapper::renderSpotLightShadowMap | ( | scene::SceneGraph * | Graph, | |
| scene::Camera * | Cam, | |||
| scene::Light * | LightObj, | |||
| u32 | Index | |||
| ) | [protected] |
| void sp::video::ShadowMapper::unbind | ( | const s32 | ShadowMapLayerBase | ) | [virtual] |
const dim::matrix4f sp::video::ShadowMapper::CUBEMAP_ROTATIONS [static, protected] |
{
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)
}
scene::Camera sp::video::ShadowMapper::DepthCam_ [protected] |
u32 sp::video::ShadowMapper::MaxPointLightCount_ [protected] |
u32 sp::video::ShadowMapper::MaxSpotLightCount_ [protected] |
SShadowMap sp::video::ShadowMapper::ShadowMapArray_ [protected] |
s32 sp::video::ShadowMapper::TexSize_ [protected] |
bool sp::video::ShadowMapper::UseRSM_ [protected] |
Specifies whether RSMs (reflective shadow maps) are used or not.
bool sp::video::ShadowMapper::UseVSM_ [protected] |
Specifies whether VSMs (variance shadow maps) are used or not.
scene::Camera sp::video::ShadowMapper::ViewCam_ [static, protected] |
1.7.1