27#ifndef EASY3D_RENDERER_SHADOW_H
28#define EASY3D_RENDERER_SHADOW_H
31#include <easy3d/core/types.h>
38 class TrianglesDrawable;
39 class FramebufferObject;
89 void draw(
const std::vector<TrianglesDrawable*>& surfaces);
92 virtual void ensure_fbo();
93 virtual void shadow_map_pass(
const std::vector<TrianglesDrawable*>& surfaces);
94 virtual void render_pass(
const std::vector<TrianglesDrawable*>& surfaces);
100 void draw_light_frustum();
102 void compute_camera_frustum();
103 void compute_light_frustum();
109 virtual void update_virtual_background();
121 int shadow_map_size_;
124 bool virtual_background_;
125 vec4 virtual_background_color_;
128 float light_distance_;
132 mat4 light_view_matrix_;
133 mat4 light_projection_matrix_;
A perspective or orthographic camera.
Definition: camera.h:116
An implementation of framebuffer object (FBO).
Definition: framebuffer_object.h:122
A Frustum description for perspective projection.
Definition: frustum.h:43
Shadow implements the standard shadow map (hard shadow) algorithm.
Definition: shadow.h:50
const vec4 & virtual_background_color(const vec4 &c)
Query the virtual background color.
Definition: shadow.h:65
void draw(const std::vector< TrianglesDrawable * > &surfaces)
Rendering the surfaces.
Definition: shadow.cpp:143
float light_distance() const
The distance of the light source to the scene scene (w.r.t the scene radius).
Definition: shadow.h:75
void set_light_distance(float dist)
Definition: shadow.cpp:86
void set_virtual_background(bool b)
Enable/Disable the virtual background.
Definition: shadow.h:62
Shadow(Camera *cam)
Constructor.
Definition: shadow.cpp:50
void set_shadow_map_size(int size)
Set/Change the size of the shadow map. The shadow is assumed to be square. Default: 1024 by 1024.
Definition: shadow.h:72
float darkness() const
Definition: shadow.h:83
bool virtual_background() const
Definition: shadow.h:60
int shadow_map_size() const
Query the size of the shadow map. The shadow is assumed to be square.
Definition: shadow.h:70
void set_virtual_background_color(const vec4 &c)
Set the virtual background color.
Definition: shadow.h:67
void set_darkness(float darkness)
Definition: shadow.cpp:92
The drawable for rendering a set of triangles, e.g., the surface of a triangular mesh.
Definition: drawable_triangles.h:46
Definition: collider.cpp:182