Shadow implements the standard shadow map (hard shadow) algorithm.
More...
#include <easy3d/renderer/shadow.h>
|
| | Shadow (Camera *cam) |
| | Constructor.
|
| |
| bool | virtual_background () const |
| |
| void | set_virtual_background (bool b) |
| | Enable/Disable the virtual background.
|
| |
|
const vec4 & | virtual_background_color (const vec4 &c) |
| | Query the virtual background color.
|
| |
|
void | set_virtual_background_color (const vec4 &c) |
| | Set the virtual background color.
|
| |
|
int | shadow_map_size () const |
| | Query the size of the shadow map. The shadow is assumed to be square.
|
| |
|
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.
|
| |
|
float | light_distance () const |
| | The distance of the light source to the scene (w.r.t. the scene radius).
|
| |
| void | set_light_distance (float dist) |
| |
| float | darkness () const |
| |
| void | set_darkness (float darkness) |
| |
|
void | draw (const std::vector< TrianglesDrawable * > &surfaces) |
| | Rendering the surfaces.
|
| |
Shadow implements the standard shadow map (hard shadow) algorithm.
- Examples
- Tutorial_502_HardShadow/main.cpp, and Tutorial_503_SoftShadow/main.cpp.
◆ Shadow()
Constructor.
- Parameters
-
| cam | The camera used in the view |
◆ darkness()
Query the darkness of the shadow region. The values is in [0, 1.0] (0: no shadow at all; 1: completely dark/black).
- See also
- set_darkness(float darkness).
◆ set_darkness()
| void set_darkness |
( |
float | darkness | ) |
|
Set the darkness of the shadow region. Values must be in [0, 1.0] (0: no shadow at all; 1: completely dark/black). The default value is 0.6.
◆ set_light_distance()
| void set_light_distance |
( |
float | dist | ) |
|
Set/Change the distance of the light source to the scene (w.r.t. the scene radius). Default value is 50 (large enough to mimic the directional light used in the default viewer).
- Note
- Value must be > 1.0.
◆ set_virtual_background()
| void set_virtual_background |
( |
bool | b | ) |
|
|
inline |
◆ virtual_background()
| bool virtual_background |
( |
| ) |
const |
|
inline |
Shadow allows to have a virtual background as the shadow receiver. The virtual background plane is perpendicular to the light direction and is placed at the far plane of the light frustum.
- Note
- This only works for directional lights.
The documentation for this class was generated from the following files:
- G:/3_code/Easy3D/easy3d/renderer/shadow.h
- G:/3_code/Easy3D/easy3d/renderer/shadow.cpp