Tucano  0.1
A library for rapid prototyping with modern OpenGL and GLSL
Tucano::Effects::ShadowMap Class Reference

#include <shadowmap.hpp>

Inheritance diagram for Tucano::Effects::ShadowMap:
Tucano::Effect

Public Member Functions

 ShadowMap (void)
 Default constructor. More...
 
virtual void initialize (void)
 Initializes the ShadowMap effects,. More...
 
void clearShadowBuffer (void)
 
Tucano::FramebuffergetShadowMap (void)
 Returns a pointer to the shadow map with single sampling Note that if multisapling is used (num samples > 1) a blit operation is performed, and the single sampled map is returned. More...
 
Tucano::FramebuffergetShadowMapMultisample (void)
 Returns a pointer to the multisampled shadow map. More...
 
void setNumSamples (int n)
 Set the number of samples for multisampling. More...
 
void setBufferSize (const Eigen::Vector2i &size)
 Set the shadow buffer size. More...
 
void createBuffers (void)
 Creates FBOs, or recreates when size changes. More...
 
void renderBuffer (const Tucano::Camera &camera)
 
void render (Tucano::Mesh &mesh, const Tucano::Camera &camera, const Tucano::Camera &light)
 Composes the shadow depth buffer. More...
 
- Public Member Functions inherited from Tucano::Effect
 Effect (string shadersDir="shaders/")
 Default constructor. More...
 
virtual ShaderloadShader (string shader_name)
 Loads a shader by filename, initializes it, and inserts in shaders list. More...
 
virtual void loadShader (Shader &shader, string shader_name)
 
virtual ShaderloadShader (string shader_name, string vertex_name, string frag_name, string geom_name)
 Loads a shader by complete filenames (with extensions), initializes it, and inserts in shaders list. More...
 
void setShadersDir (string dir)
 
virtual void reloadShaders (void)
 Reloads all shaders needed for effect usage. More...
 

Protected Attributes

Tucano::Framebuffer fbo
 Framebuffer to store the shadow depth map, this is using multisampling. More...
 
Tucano::Framebuffer aa_fbo
 A auxiliary fbo to blit multisampled fbo. More...
 
Tucano::Shader shadowbuffer_shader
 Creates the shadowmap depth buffer by rendering from light pos. More...
 
Tucano::Shader drawbuffer_shader
 Shader to render shadow map. More...
 
Tucano::Mesh quad
 Quad for rendering shadow map, mostly for debug. More...
 
Eigen::Vector2i viewport = Eigen::Vector2i(1024, 1024)
 Shadowbuffer size. More...
 
int depth_tex_id = 0
 
int num_samples = 4
 
bool recreate_fbo = true
 Flag to recreate buffer during next render. More...
 
- Protected Attributes inherited from Tucano::Effect
std::vector< Shader * > shaders_list
 Vector of pointers to shaders used in this effect, in case the user needs multiple pass rendering. More...
 
string shaders_dir
 Directory in which the shader files are stored. More...
 

Detailed Description

Simple Shadow Mapping Renders depth buffer from light position to compute the shadow map

Constructor & Destructor Documentation

Tucano::Effects::ShadowMap::ShadowMap ( void  )
inline

Default constructor.

Member Function Documentation

void Tucano::Effects::ShadowMap::clearShadowBuffer ( void  )
inline
void Tucano::Effects::ShadowMap::createBuffers ( void  )
inline

Creates FBOs, or recreates when size changes.

Tucano::Framebuffer* Tucano::Effects::ShadowMap::getShadowMap ( void  )
inline

Returns a pointer to the shadow map with single sampling Note that if multisapling is used (num samples > 1) a blit operation is performed, and the single sampled map is returned.

Returns
Pointer to the shadow map with single sampling
Tucano::Framebuffer* Tucano::Effects::ShadowMap::getShadowMapMultisample ( void  )
inline

Returns a pointer to the multisampled shadow map.

Returns
Pointer to multisample shadowmap
virtual void Tucano::Effects::ShadowMap::initialize ( void  )
inlinevirtual

Initializes the ShadowMap effects,.

Implements Tucano::Effect.

void Tucano::Effects::ShadowMap::render ( Tucano::Mesh mesh,
const Tucano::Camera camera,
const Tucano::Camera light 
)
inline

Composes the shadow depth buffer.

Parameters
meshMesh to be rendered.
cameraA pointer to the camera trackball object.
lightA pointer to the light trackball object.
void Tucano::Effects::ShadowMap::renderBuffer ( const Tucano::Camera camera)
inline
void Tucano::Effects::ShadowMap::setBufferSize ( const Eigen::Vector2i &  size)
inline

Set the shadow buffer size.

Parameters
nGiven size as vector 2i
void Tucano::Effects::ShadowMap::setNumSamples ( int  n)
inline

Set the number of samples for multisampling.

Parameters
nGiven number of samples

Member Data Documentation

Tucano::Framebuffer Tucano::Effects::ShadowMap::aa_fbo
protected

A auxiliary fbo to blit multisampled fbo.

int Tucano::Effects::ShadowMap::depth_tex_id = 0
protected
Tucano::Shader Tucano::Effects::ShadowMap::drawbuffer_shader
protected

Shader to render shadow map.

Tucano::Framebuffer Tucano::Effects::ShadowMap::fbo
protected

Framebuffer to store the shadow depth map, this is using multisampling.

int Tucano::Effects::ShadowMap::num_samples = 4
protected
Tucano::Mesh Tucano::Effects::ShadowMap::quad
protected

Quad for rendering shadow map, mostly for debug.

bool Tucano::Effects::ShadowMap::recreate_fbo = true
protected

Flag to recreate buffer during next render.

Tucano::Shader Tucano::Effects::ShadowMap::shadowbuffer_shader
protected

Creates the shadowmap depth buffer by rendering from light pos.

Eigen::Vector2i Tucano::Effects::ShadowMap::viewport = Eigen::Vector2i(1024, 1024)
protected

Shadowbuffer size.


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