14auto light_component::get_bounds_sphere_impl(
const math::vec3* light_direction)
const ->
math::bsphere
20 result =
math::bsphere(math::vec3(0.0f, 0.0f, 0.0f), light_.point_data.range);
24 float range = light_.spot_data.get_range();
28 float clamped_inner_cone_angle =
29 math::radians(math::clamp(light_.spot_data.get_inner_angle(), 0.0f, 89.0f));
30 float clamped_outer_cone_angle = math::clamp(math::radians(light_.spot_data.get_outer_angle()),
31 clamped_inner_cone_angle + 0.001f,
32 math::radians(89.0f) + 0.001f);
33 float cos_outer_cone = math::cos(clamped_outer_cone_angle);
38 math::vec3
center = math::vec3(0.0f, 0.0f, 0.0f) + 0.5f * (*light_direction) *
range;
49 result =
math::bsphere(math::vec3(0.0f, 0.0f, 0.0f), 999999999.0f);
57 return get_bounds_sphere_impl(
nullptr);
62 return get_bounds_sphere_impl(&light_direction);
75 auto sphere = get_bounds_sphere_precise(light_direction);
82 const math::vec3& light_position,
83 const math::vec3& light_direction,
84 const math::vec3& view_origin,
105 clamped_inner_cone_angle + 0.001f,
106 math::radians(89.0f) + 0.001f);
107 float cos_outer_cone = math::cos(clamped_outer_cone_angle);
112 math::vec3
center = light_position + 0.5f * light_direction *
range;
132 return *shadowmap_generator_;
151 turbidity_ = math::clamp(turbidity, 1.9f, 10.0f);
Provides storage for common representation of spherical bounding volume, and wraps up common function...
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.
void set_mode(const sky_mode &mode)
Sets the sky mode.
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.
std::uint32_t compute_projected_sphere_rect(std::int32_t &left, std::int32_t &right, std::int32_t &top, std::int32_t &bottom, const glm::vec3 &sphere_center, float radius, const glm::vec3 &view_origin, const glm::mat4 &view, const glm::mat4 &proj)
@ sphere
Sphere type reflection probe.
Storage for box vector values and wraps up common functionality.
bbox & from_sphere(const vec3 ¢er, float radius)
Calculates the bounding box based on the sphere specified.
float range
The range of the point light.
float get_range() const
Gets the range of the spot light.
float get_outer_angle() const
Gets the outer angle of the spot light.
float get_inner_angle() const
Gets the inner angle of the spot light.
Struct representing a light.
light_type type
The type of the light.
point point_data
Data specific to point lights.
spot spot_data
Data specific to spot lights.