Pyrogenesis
13997
|
Class ShadowMap: Maintain the shadow map texture and perform necessary OpenGL setup, including matrix calculations. More...
#include <ShadowMap.h>
Public Member Functions | |
ShadowMap () | |
~ShadowMap () | |
void | RecreateTexture () |
RecreateTexture: Destroy the current shadow texture and force creation of a new one. More... | |
int | GetDepthTextureBits () const |
GetDepthTextureBits: Return the number of bits to use for depth textures when enabled. More... | |
void | SetDepthTextureBits (int bits) |
SetDepthTextureBits: Sets the number of bits to use for depth textures when enabled. More... | |
int | GetWidth () const |
GetWidth: Return the width of the depth texture. More... | |
int | GetHeight () const |
GetHeight: Return the height of the depth texture. More... | |
void | SetupFrame (const CCamera &camera, const CVector3D &lightdir) |
SetupFrame: Configure light space for the given camera and light direction, create the shadow texture if necessary, etc. More... | |
void | AddShadowedBound (const CBoundingBoxAligned &bounds) |
AddShadowedBound: Add the bounding box of an object that has to be shadowed. More... | |
void | BeginRender () |
BeginRender: Set OpenGL state for rendering into the shadow map texture. More... | |
void | EndRender () |
EndRender: Finish rendering into the shadow map. More... | |
GLuint | GetTexture () const |
GetTexture: Retrieve the OpenGL texture object name that contains the shadow map. More... | |
const CMatrix3D & | GetTextureMatrix () const |
GetTextureMatrix: Retrieve the world-space to shadow map texture coordinates transformation matrix. More... | |
void | RenderDebugBounds () |
Visualize shadow mapping calculations to help in debugging and optimal shadow map usage. More... | |
void | RenderDebugTexture () |
Visualize shadow map texture to help in debugging. More... | |
Private Attributes | |
ShadowMapInternals * | m |
Class ShadowMap: Maintain the shadow map texture and perform necessary OpenGL setup, including matrix calculations.
The class will automatically generate a texture the first time the shadow map is rendered into. The texture will not be resized afterwards.
Definition at line 39 of file ShadowMap.h.
ShadowMap::ShadowMap | ( | ) |
Definition at line 98 of file ShadowMap.cpp.
ShadowMap::~ShadowMap | ( | ) |
Definition at line 120 of file ShadowMap.cpp.
void ShadowMap::AddShadowedBound | ( | const CBoundingBoxAligned & | bounds | ) |
AddShadowedBound: Add the bounding box of an object that has to be shadowed.
This is used to calculate the bounds for the shadow map.
bounds | world space bounding box |
Definition at line 213 of file ShadowMap.cpp.
void ShadowMap::BeginRender | ( | ) |
BeginRender: Set OpenGL state for rendering into the shadow map texture.
Definition at line 455 of file ShadowMap.cpp.
void ShadowMap::EndRender | ( | ) |
EndRender: Finish rendering into the shadow map.
Definition at line 505 of file ShadowMap.cpp.
int ShadowMap::GetDepthTextureBits | ( | ) | const |
GetDepthTextureBits: Return the number of bits to use for depth textures when enabled.
Definition at line 537 of file ShadowMap.cpp.
int ShadowMap::GetHeight | ( | ) | const |
GetHeight: Return the height of the depth texture.
Definition at line 564 of file ShadowMap.cpp.
GLuint ShadowMap::GetTexture | ( | ) | const |
GetTexture: Retrieve the OpenGL texture object name that contains the shadow map.
Definition at line 524 of file ShadowMap.cpp.
const CMatrix3D & ShadowMap::GetTextureMatrix | ( | ) | const |
GetTextureMatrix: Retrieve the world-space to shadow map texture coordinates transformation matrix.
Definition at line 529 of file ShadowMap.cpp.
int ShadowMap::GetWidth | ( | ) | const |
GetWidth: Return the width of the depth texture.
Definition at line 559 of file ShadowMap.cpp.
void ShadowMap::RecreateTexture | ( | ) |
RecreateTexture: Destroy the current shadow texture and force creation of a new one.
Useful when the renderer's size has changed and the texture should be resized too.
Definition at line 135 of file ShadowMap.cpp.
void ShadowMap::RenderDebugBounds | ( | ) |
Visualize shadow mapping calculations to help in debugging and optimal shadow map usage.
Definition at line 571 of file ShadowMap.cpp.
void ShadowMap::RenderDebugTexture | ( | ) |
Visualize shadow map texture to help in debugging.
Definition at line 648 of file ShadowMap.cpp.
void ShadowMap::SetDepthTextureBits | ( | int | bits | ) |
SetDepthTextureBits: Sets the number of bits to use for depth textures when enabled.
Possible values are 16, 24, 32 and 0 (= use default)
bits | number of bits |
Definition at line 542 of file ShadowMap.cpp.
SetupFrame: Configure light space for the given camera and light direction, create the shadow texture if necessary, etc.
camera | the camera that will be used for world rendering |
lightdir | the direction of the (directional) sunlight |
Definition at line 153 of file ShadowMap.cpp.
|
private |
Definition at line 141 of file ShadowMap.h.