Antkeeper
0.0.1
|
Light source with parallel rays and constant intensity. More...
#include <directional-light.hpp>
Public Member Functions | |
directional_light () | |
Creates a directional light. More... | |
light_type | get_light_type () const noexcept override |
Returns light_type::directional. More... | |
constexpr std::span< const math::fmat4 > | get_shadow_scale_bias_matrices () const noexcept |
Returns the array of shadow cascade scale-bias matrices. More... | |
Light | |
void | set_direction (const math::fvec3 &direction) |
Sets the direction of the directional light. More... | |
void | set_color (const math::fvec3 &color) noexcept |
Sets the color of the light. More... | |
void | set_illuminance (float illuminance) noexcept |
Sets the illuminance of the light on a surface perpendicular to the light direction. More... | |
constexpr const math::fvec3 & | get_direction () const noexcept |
Returns a unit vector pointing in the light direction. More... | |
constexpr const math::fvec3 & | get_color () const noexcept |
Returns the color of the light. More... | |
constexpr float | get_illuminance () const noexcept |
Returns the illuminance of the light on a surface perpendicular to the light direction. More... | |
constexpr const math::fvec3 & | get_colored_illuminance () const noexcept |
Returns the color-modulated illuminance of the light on a surface perpendicular to the light direction. More... | |
Shadow | |
void | set_shadow_caster (bool caster) noexcept |
Enables or disables shadow casting. More... | |
void | set_shadow_framebuffer (std::shared_ptr< gl::framebuffer > framebuffer) noexcept |
Sets the shadow map framebuffer. More... | |
void | set_shadow_bias (float bias) noexcept |
Sets the shadow bias factor for reducing self-shadowing. More... | |
void | set_shadow_cascade_count (unsigned int count) noexcept |
Sets the number of shadow cascades. More... | |
void | set_shadow_max_distance (float distance) noexcept |
Sets the maximum distance from a camera's near clipping plane up to which shadows are visible. More... | |
void | set_shadow_fade_range (float range) noexcept |
Sets the distance from the maximum shadow distance at which shadows will begin to fade out. More... | |
void | set_shadow_cascade_distribution (float weight) noexcept |
Sets the shadow cascade distribution. More... | |
constexpr bool | is_shadow_caster () const noexcept |
Returns true if the light casts shadows, false otherwise. More... | |
constexpr const std::shared_ptr< gl::framebuffer > & | get_shadow_framebuffer () const noexcept |
Returns the shadow map framebuffer, of nullptr if no shadow map framebuffer is set. More... | |
constexpr const std::shared_ptr< gl::texture_2d > & | get_shadow_texture () const noexcept |
Returns the shadow map texture. More... | |
constexpr float | get_shadow_bias () const noexcept |
Returns the shadow bias factor. More... | |
constexpr unsigned int | get_shadow_cascade_count () const noexcept |
Returns the number of shadow cascades. More... | |
constexpr float | get_shadow_max_distance () const noexcept |
Returns the maximum distance from a camera's near clipping plane up to which shadows are visible. More... | |
constexpr float | get_shadow_fade_range () const noexcept |
Returns the distance from the maximum shadow distance at which shadows will begin to fade out. More... | |
constexpr float | get_shadow_cascade_distribution () const noexcept |
Returns the shadow cascade distribution weight. More... | |
constexpr const math::fvec4 & | get_shadow_cascade_distances () const noexcept |
Returns the array of shadow cascade far clipping plane distances. More... | |
constexpr math::fvec4 & | get_shadow_cascade_distances () noexcept |
Enables or disables shadow casting. More... | |
constexpr std::span< const math::fmat4 > | get_shadow_cascade_matrices () const noexcept |
Returns the array of world-space to cascade texture-space transformation matrices. More... | |
constexpr std::span< math::fmat4 > | get_shadow_cascade_matrices () noexcept |
Returns the array of world-space to cascade texture-space transformation matrices. More... | |
![]() | |
const aabb_type & | get_bounds () const noexcept override |
Returns the bounds of the object. More... | |
void | set_color (const math::fvec3 &color) |
Sets the color of the light. More... | |
void | set_color_temperature (float temperature) |
Sets the color of the light from a color temperature. More... | |
constexpr const math::fvec3 & | get_color () const noexcept |
Returns the scene-linear RGB color of the light. More... | |
![]() | |
const std::size_t | get_object_type_id () const noexcept final |
Returns the type ID for this scene object type. More... | |
![]() | |
virtual void | render (render::context &ctx) const |
Adds render operations to a render context. More... | |
void | look_at (const vector_type &position, const vector_type &target, const vector_type &up) |
constexpr void | set_layer_mask (std::uint32_t mask) noexcept |
Sets the layer mask of the object. More... | |
void | set_transform (const transform_type &transform) |
Sets the transform of the object. More... | |
void | set_translation (const vector_type &translation) |
Sets the translation of the object. More... | |
void | set_rotation (const quaternion_type &rotation) |
Sets the rotation of the object. More... | |
constexpr std::uint32_t | get_layer_mask () const noexcept |
Returns the layer mask of the object. More... | |
constexpr const transform_type & | get_transform () const noexcept |
Returns the transform of the object. More... | |
constexpr const vector_type & | get_translation () const noexcept |
Returns the translation of the object. More... | |
constexpr const quaternion_type & | get_rotation () const noexcept |
Returns the rotation of the object. More... | |
constexpr const vector_type & | get_scale () const noexcept |
Returns the scale of the object. More... | |
void | set_scale (const vector_type &scale) |
Sets the scale of the object. More... | |
void | set_scale (float scale) |
Sets the scale of the object. More... | |
Additional Inherited Members | |
![]() | |
using | vector_type = math::fvec3 |
using | quaternion_type = math::fquat |
using | transform_type = math::transform< float > |
using | aabb_type = geom::box< float > |
![]() | |
static const std::atomic< std::size_t > | object_type_id |
Unique type ID for this scene object type. More... | |
![]() | |
static std::size_t | next_object_type_id () |
![]() | |
std::uint32_t | m_layer_mask {1} |
transform_type | m_transform {transform_type::identity()} |
Light source with parallel rays and constant intensity.
Definition at line 34 of file directional-light.hpp.
scene::directional_light::directional_light | ( | ) |
Creates a directional light.
Definition at line 26 of file directional-light.cpp.
|
inlineconstexprnoexcept |
Returns the color of the light.
Definition at line 85 of file directional-light.hpp.
|
inlineconstexprnoexcept |
Returns the color-modulated illuminance of the light on a surface perpendicular to the light direction.
Definition at line 97 of file directional-light.hpp.
|
inlineconstexprnoexcept |
Returns a unit vector pointing in the light direction.
Definition at line 79 of file directional-light.hpp.
|
inlineconstexprnoexcept |
Returns the illuminance of the light on a surface perpendicular to the light direction.
Definition at line 91 of file directional-light.hpp.
|
inlineoverridevirtualnoexcept |
Returns light_type::directional.
Implements scene::light.
Definition at line 41 of file directional-light.hpp.
|
inlineconstexprnoexcept |
Returns the shadow bias factor.
Definition at line 177 of file directional-light.hpp.
|
inlineconstexprnoexcept |
Returns the number of shadow cascades.
Definition at line 183 of file directional-light.hpp.
|
inlineconstexprnoexcept |
Returns the array of shadow cascade far clipping plane distances.
Definition at line 208 of file directional-light.hpp.
|
inlineconstexprnoexcept |
Enables or disables shadow casting.
caster | true if the light should cast shadows, false otherwise. |
Definition at line 212 of file directional-light.hpp.
|
inlineconstexprnoexcept |
Returns the shadow cascade distribution weight.
Definition at line 201 of file directional-light.hpp.
|
inlineconstexprnoexcept |
Returns the array of world-space to cascade texture-space transformation matrices.
Definition at line 226 of file directional-light.hpp.
|
inlineconstexprnoexcept |
Returns the array of world-space to cascade texture-space transformation matrices.
Definition at line 230 of file directional-light.hpp.
|
inlineconstexprnoexcept |
Returns the distance from the maximum shadow distance at which shadows will begin to fade out.
Definition at line 195 of file directional-light.hpp.
|
inlineconstexprnoexcept |
Returns the shadow map framebuffer, of nullptr
if no shadow map framebuffer is set.
Definition at line 165 of file directional-light.hpp.
|
inlineconstexprnoexcept |
Returns the maximum distance from a camera's near clipping plane up to which shadows are visible.
Definition at line 189 of file directional-light.hpp.
|
inlineconstexprnoexcept |
Returns the array of shadow cascade scale-bias matrices.
Definition at line 219 of file directional-light.hpp.
|
inlineconstexprnoexcept |
Returns the shadow map texture.
Definition at line 171 of file directional-light.hpp.
|
inlineconstexprnoexcept |
Returns true
if the light casts shadows, false
otherwise.
Definition at line 159 of file directional-light.hpp.
|
inlinenoexcept |
Sets the color of the light.
color | Light color. |
Definition at line 61 of file directional-light.hpp.
void scene::directional_light::set_direction | ( | const math::fvec3 & | direction | ) |
Sets the direction of the directional light.
direction | Unit-length light direction vector. |
Definition at line 32 of file directional-light.cpp.
|
inlinenoexcept |
Sets the illuminance of the light on a surface perpendicular to the light direction.
illuminance | Illuminance on a surface perpendicular to the light direction. |
Definition at line 72 of file directional-light.hpp.
|
noexcept |
Sets the shadow bias factor for reducing self-shadowing.
bias | Shadow bias factor. |
Definition at line 78 of file directional-light.cpp.
|
noexcept |
Sets the number of shadow cascades.
count | Number of shadow cascades, on [1, 4] . |
[1, 4]
. Definition at line 84 of file directional-light.cpp.
|
noexcept |
Sets the shadow cascade distribution.
weight | Linear interpolation weight between uniform and logarithmic cascade distributions. A weight of 0.0 results in a uniform cascade distribution, while 1.0 results in a logarithmic distribution. |
Definition at line 102 of file directional-light.cpp.
|
noexcept |
Enables or disables shadow casting.
caster | true if the light should cast shadows, false otherwise. |
Definition at line 37 of file directional-light.cpp.
|
noexcept |
Sets the distance from the maximum shadow distance at which shadows will begin to fade out.
range | Shadow fade range. |
Definition at line 97 of file directional-light.cpp.
|
noexcept |
Sets the shadow map framebuffer.
framebuffer | Pointer to a shadow map framebuffer. |
Definition at line 42 of file directional-light.cpp.
|
noexcept |
Sets the maximum distance from a camera's near clipping plane up to which shadows are visible.
distance | Maximum shadow distance. |
Definition at line 91 of file directional-light.cpp.