Easy3D 2.5.3
Shadow Class Reference

Shadow implements the standard shadow map (hard shadow) algorithm. More...

#include <easy3d/renderer/shadow.h>

Inheritance diagram for Shadow:
SoftShadow

Public Member Functions

 Shadow (Camera *cam)
 Constructor. More...
 
bool virtual_background () const
 
void set_virtual_background (bool b)
 Enable/Disable the virtual background. More...
 
const vec4virtual_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 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.
 

Detailed Description

Shadow implements the standard shadow map (hard shadow) algorithm.

Examples
Tutorial_502_HardShadow, and Tutorial_503_SoftShadow.

Constructor & Destructor Documentation

◆ Shadow()

Shadow ( Camera cam)
explicit

Constructor.

Parameters
camThe camera used in the view

Member Function Documentation

◆ darkness()

float darkness ( ) const
inline

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 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

Enable/Disable the virtual background.

See also
virtual_background()

◆ 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: