SLProjType
Enumeration for different camera projections.
Uses an OpenGL framebuffer object as a depth-buffer.
std::vector< SLGLDepthBuffer * > SLGLVDepthBuffer
deque< SLNode * > SLVNode
SLVNode typedef for a vector of SLNodes.
vector< SLVec2f > SLVVec2f
SLVec2< SLfloat > SLVec2f
Active or visible camera node class.
SLGLVertexArray adds Helper Functions for quick Line & Point Drawing.
SLLightDirect class for a directional light source.
Abstract Light class for OpenGL light sources.
SLLightSpot class for a spot light source.
Defines a standard CG material with textures and a shader program.
SLNode represents a node in a hierarchical scene graph.
Defines a plane in 3D space with the equation ax + by + cy + d = 0.
SceneView class represents a dynamic real time 3D view onto the scene.
Class for standard and cascaded shadow mapping.
void numCascades(int numCascades)
SLGLVDepthBuffer _depthBuffers
Vector of framebuffers with texture.
SLShadowMap(SLLight *light, const SLfloat lightClipNear=0.1f, const SLfloat lightClipFar=20.0f, const SLVec2f &size=SLVec2f(8, 8), const SLVec2i &texSize=SLVec2i(1024, 1024))
Ctor for standard fixed sized shadow mapping without cascades.
SLProjType _projection
Projection to use to create shadow map.
SLbool useCascaded() const
SLbool _useCascaded
Flag if cascaded shadow maps should be used.
void renderDirectionalLightCascaded(SLSceneView *sv, SLNode *root)
SLMat4f _lightView[6]
Light view matrices.
SLGLVDepthBuffer depthBuffers()
SLGLDepthBuffer * depthBuffer()
SLint _numCascades
Number of cascades for directional light shadow mapping.
SLVec2i _rayCount
Amount of rays drawn by drawRays()
SLCamera * _camera
Camera to witch the light frustums are adapted.
void drawNodesIntoDepthBufferRec(SLNode *node, SLSceneView *sv, SLMat4f &lightView)
SLMaterial * _material
Material used to render the shadow map.
void updateLightSpaces()
SLShadowMap::updateLightSpaces updates a light view projection matrix.
SLint _maxCascades
Max. number of cascades for for which the shader gets generated.
void rayCount(const SLVec2i &rayCount)
static SLuint drawCalls
NO. of draw calls for shadow mapping.
void useCubemap(SLbool useCubemap)
SLMat4f _lightProj[6]
Light projection matrices.
SLbool useCubemap() const
SLGLVertexArrayExt * _frustumVAO
Visualization of light-space-frustum.
void drawFrustum()
SLShadowMap::drawFrustum draws the volume affected by the shadow map.
SLfloat _lightClipNear
Light frustum near clipping plane.
SLVec2f _halfSize
_size divided by two (only for SLLightDirect non cascaded)
SLVec2i _textureSize
Size of the shadow map texture.
void clipNear(SLfloat clipNear)
SLMat4f _lightSpace[6]
Light space matrices (= _lightProj * _lightView)
SLfloat _cascadesFactor
Factor that determines the cascades distribution.
void size(const SLVec2f &size)
void textureSize(const SLVec2i &textureSize)
void clipFar(SLfloat clipFar)
SLVec2f _size
Height and width of the frustum (only for SLLightDirect non cascaded)
void cascadesFactor(float factor)
void lightCullingAdaptiveRec(SLNode *node, SLMat4f &lightProj, SLMat4f &lightView, SLPlane *lightFrustumPlanes, SLVNode &visibleNodes)
void renderShadows(SLSceneView *sv, SLNode *root)
SLLight * _light
The light which uses this shadow map.
SLfloat _lightClipFar
Light frustum far clipping plane.
SLVVec2f getShadowMapCascades(int numCascades, float camClipNear, float camClipFar)
void drawNodesDirectionalCulling(SLVNode visibleNodes, SLSceneView *sv, SLMat4f &lightView)
SLbool _useCubemap
Flag if cubemap should be used for perspective projections.
void set(const T X, const T Y)