Unravel Engine C++ Reference
Loading...
Searching...
No Matches
light_component.h
Go to the documentation of this file.
1#pragma once
2#include <base/basetypes.hpp>
6
7namespace unravel
8{
9
14class light_component : public component_crtp<light_component>
15{
16public:
21 auto get_light() const -> const light&;
22
27 void set_light(const light& l);
28
32 auto get_bounds() const -> math::bbox;
33 auto get_bounds_sphere() const -> math::bsphere;
34
38 auto get_bounds_precise(const math::vec3& light_direction) const -> math::bbox;
39 auto get_bounds_sphere_precise(const math::vec3& light_direction) const -> math::bsphere;
40
52 const math::vec3& light_position,
53 const math::vec3& light_direction,
54 const math::vec3& view_origin,
55 const math::transform& view,
56 const math::transform& proj) -> int;
57
63
64private:
65 auto get_bounds_sphere_impl(const math::vec3* light_direction) const -> math::bsphere;
66
70 light light_;
71
75 std::shared_ptr<shadow::shadowmap_generator> shadowmap_generator_ = std::make_shared<shadow::shadowmap_generator>();
76};
77
82class skylight_component : public component_crtp<skylight_component>
83{
84public:
89 enum class sky_mode
90 {
94 perez,
96 skybox,
97 };
98
103 auto get_mode() const noexcept -> const sky_mode&;
104
109 void set_mode(const sky_mode& mode);
110
115 auto get_turbidity() const noexcept -> float;
116
121 void set_turbidity(float turbidity);
122
123 auto get_cubemap() const noexcept -> const asset_handle<gfx::texture>&
124 {
125 return cubemap_;
126 }
128 {
129 cubemap_ = cubemap;
130 }
131
132private:
137
141 float turbidity_{1.9};
142
143 //
145};
146
147} // namespace unravel
Provides storage for common representation of spherical bounding volume, and wraps up common function...
Definition bsphere.h:18
General purpose transformation class designed to maintain each component of the transformation separa...
Definition transform.hpp:27
Class that contains core light data, used for rendering and other purposes.
auto get_bounds() const -> math::bbox
Gets the bounding box of the light object.
void set_light(const light &l)
Sets the light object.
auto get_bounds_sphere() const -> math::bsphere
auto get_light() const -> const light &
Gets the light object.
auto compute_projected_sphere_rect(irect32_t &rect, const math::vec3 &light_position, const math::vec3 &light_direction, const math::vec3 &view_origin, const math::transform &view, const math::transform &proj) -> int
Computes the projected sphere rectangle.
auto get_shadowmap_generator() -> shadow::shadowmap_generator &
Gets the shadow map generator.
auto get_bounds_precise(const math::vec3 &light_direction) const -> math::bbox
Gets the bounding box of the light object.
auto get_bounds_sphere_precise(const math::vec3 &light_direction) const -> math::bsphere
Shadow mapping generator with improved algorithms for high-altitude cameras.
Definition shadow.h:597
Class that contains sky light data.
void set_mode(const sky_mode &mode)
Sets the sky mode.
void set_cubemap(const asset_handle< gfx::texture > &cubemap)
auto get_cubemap() const noexcept -> const asset_handle< gfx::texture > &
auto get_turbidity() const noexcept -> float
Gets the current turbidity value.
auto get_mode() const noexcept -> const sky_mode &
Gets the current sky mode.
void set_turbidity(float turbidity)
Sets the turbidity value.
sky_mode
Enumeration for sky modes.
Represents a handle to an asset, providing access and management functions.
Storage for box vector values and wraps up common functionality.
Definition bbox.h:21
CRTP (Curiously Recurring Template Pattern) base structure for components.
Struct representing a light.
Definition light.h:87