Unravel Engine C++ Reference
Loading...
Searching...
No Matches
unravel::skylight_component Class Reference

Class that contains sky light data. More...

#include <light_component.h>

Inheritance diagram for unravel::skylight_component:
unravel::component_crtp< skylight_component > unravel::basic_component

Public Types

enum class  sky_mode { reserved_0 = 0 , perez = 1 , skybox = 2 }
 Enumeration for sky modes. More...
 
enum class  irradiance_quality { flat , directional }
 Directional variation of the indirect diffuse ambient. More...
 
enum class  cloud_mode { none = 0 , flat = 1 , volumetric = 2 }
 
- Public Types inherited from unravel::component_crtp< skylight_component >
using base
 

Public Member Functions

auto get_mode () const noexcept -> const sky_mode &
 Gets the current sky mode.
 
void set_mode (const sky_mode &mode)
 Sets the sky mode.
 
auto get_turbidity () const noexcept -> float
 Gets the current turbidity value.
 
void set_turbidity (float turbidity)
 Sets the turbidity value.
 
auto get_cloud_mode () const noexcept -> cloud_mode
 Gets the cloud rendering mode.
 
void set_cloud_mode (cloud_mode mode)
 Sets the cloud rendering mode.
 
auto get_cloud_coverage () const noexcept -> float
 Gets the cloud coverage value.
 
void set_cloud_coverage (float coverage)
 Sets the cloud coverage value.
 
auto get_cloud_base_altitude () const noexcept -> float
 Gets the cloud base altitude in world units.
 
void set_cloud_base_altitude (float altitude)
 Sets the cloud base altitude.
 
auto get_cloud_top_altitude () const noexcept -> float
 Gets the cloud top altitude in world units (volumetric slab top).
 
void set_cloud_top_altitude (float altitude)
 Sets the cloud top altitude. Must be greater than base altitude.
 
auto get_cloud_speed () const noexcept -> float
 Gets the cloud speed multiplier.
 
void set_cloud_speed (float speed)
 Sets the cloud speed multiplier.
 
auto get_cloud_density () const noexcept -> float
 Gets the cloud density multiplier.
 
void set_cloud_density (float density)
 Sets the cloud density multiplier.
 
auto get_cloud_absorption () const noexcept -> float
 Gets the cloud absorption coefficient (Beer-Lambert extinction).
 
void set_cloud_absorption (float absorption)
 Sets the cloud absorption coefficient.
 
auto get_cloud_light_absorption () const noexcept -> float
 Gets the cloud light absorption (self-shadow strength).
 
void set_cloud_light_absorption (float absorption)
 Sets the cloud light absorption (self-shadow strength).
 
auto get_cloud_vol_uv_scale () const noexcept -> float
 Volumetric cloud shape: world-to-noise UV scale (smaller = larger features).
 
void set_cloud_vol_uv_scale (float scale)
 
auto get_cloud_vol_edge_width () const noexcept -> float
 Volumetric cloud shape: smoothstep edge width for the density mask.
 
void set_cloud_vol_edge_width (float width)
 
auto get_cloud_vol_shape_power () const noexcept -> float
 Volumetric cloud shape: contrast on the density mask (pow exponent).
 
void set_cloud_vol_shape_power (float power)
 
auto get_cloud_vol_detail_erode () const noexcept -> float
 Volumetric cloud shape: Worley detail erosion strength.
 
void set_cloud_vol_detail_erode (float erode)
 
auto get_cloud_vol_macro_strength () const noexcept -> float
 Volumetric cloud shape: macro Worley threshold jitter (clearings vs sheet).
 
void set_cloud_vol_macro_strength (float strength)
 
auto get_cloud_vol_coarse_scale () const noexcept -> float
 Volumetric cloud shape: coarse noise sample scale (larger masses).
 
void set_cloud_vol_coarse_scale (float scale)
 
auto get_cloud_vol_base_mix () const noexcept -> float
 Volumetric cloud shape: blend between coarse and fine base noise.
 
void set_cloud_vol_base_mix (float mix)
 
auto get_cloud_vol_sun_intensity () const noexcept -> float
 Volumetric cloud lighting: sun contribution multiplier in the cloud integrator.
 
void set_cloud_vol_sun_intensity (float intensity)
 
auto get_irradiance_intensity () const noexcept -> float
 Gets the irradiance intensity (strength of indirect diffuse).
 
void set_irradiance_intensity (float intensity)
 Sets the irradiance intensity.
 
auto get_irradiance_tint () const noexcept -> const math::color &
 Gets the optional irradiance tint override (default from sky when white).
 
void set_irradiance_tint (const math::color &color)
 Sets the irradiance tint override.
 
auto get_irradiance_quality () const noexcept -> irradiance_quality
 Gets the irradiance quality for indirect diffuse.
 
void set_irradiance_quality (irradiance_quality quality)
 Sets the irradiance quality.
 
auto get_irradiance_use_sky () const noexcept -> bool
 Gets whether the sky color contributes to the ambient irradiance.
 
void set_irradiance_use_sky (bool use_sky)
 Sets whether the sky color contributes to the ambient irradiance.
 
auto get_sky_brightness () const noexcept -> float
 Gets the sky brightness multiplier (affects atmospheric pass and irradiance).
 
void set_sky_brightness (float brightness)
 Sets the sky brightness multiplier.
 
auto get_cubemap () const noexcept -> const asset_handle< gfx::texture > &
 
void set_cubemap (const asset_handle< gfx::texture > &cubemap)
 
auto get_cloud_time () const noexcept -> float
 Gets the accumulated time for cloud animation.
 
void update (delta_t dt)
 
- Public Member Functions inherited from unravel::basic_component
void touch ()
 Marks the component as 'touched'.
 

Additional Inherited Members

- Public Attributes inherited from unravel::basic_component
bool eto {}
 Disable empty type optimizations.
 
- Static Public Attributes inherited from unravel::component_crtp< skylight_component >
static constexpr bool in_place_delete
 Indicates if the component can be deleted in place.
 

Detailed Description

Class that contains sky light data.

Definition at line 82 of file light_component.h.

Member Enumeration Documentation

◆ cloud_mode

Enumerator
none 

No clouds rendered.

flat 

Flat projected clouds (cheap, single-sample scattering)

volumetric 

Volumetric raymarched clouds (full scattering, half-res with temporal)

Definition at line 113 of file light_component.h.

◆ irradiance_quality

Directional variation of the indirect diffuse ambient.

Note
Orthogonal to sky contribution (see get_irradiance_use_sky). This axis only controls whether the ambient varies with the surface normal.
Enumerator
flat 

Flat ambient: only the constant SH band (L0) is written, same color for every normal.

directional 

Directional ambient: full L0-L2 spherical harmonics, varies with the surface normal.

Definition at line 105 of file light_component.h.

◆ sky_mode

Enumeration for sky modes.

Enumerator
reserved_0 

Reserved sky mode.

perez 

Perez sky mode.

skybox 

Skybox.

Definition at line 89 of file light_component.h.

Member Function Documentation

◆ get_cloud_absorption()

auto unravel::skylight_component::get_cloud_absorption ( ) const -> float
noexcept

Gets the cloud absorption coefficient (Beer-Lambert extinction).

Returns
The current absorption value. Higher = more opaque clouds.

Definition at line 214 of file light_component.cpp.

◆ get_cloud_base_altitude()

auto unravel::skylight_component::get_cloud_base_altitude ( ) const -> float
noexcept

Gets the cloud base altitude in world units.

Returns
The current cloud base altitude. Volumetric: slab bottom. Flat: projection height.

Definition at line 174 of file light_component.cpp.

◆ get_cloud_coverage()

auto unravel::skylight_component::get_cloud_coverage ( ) const -> float
noexcept

Gets the cloud coverage value.

Returns
The current cloud coverage value [0.0 = clear sky, 1.0 = overcast].

Definition at line 164 of file light_component.cpp.

◆ get_cloud_density()

auto unravel::skylight_component::get_cloud_density ( ) const -> float
noexcept

Gets the cloud density multiplier.

Returns
The current cloud density multiplier.

Definition at line 204 of file light_component.cpp.

◆ get_cloud_light_absorption()

auto unravel::skylight_component::get_cloud_light_absorption ( ) const -> float
noexcept

Gets the cloud light absorption (self-shadow strength).

Returns
The current light absorption value. Higher = darker shadowed sides.

Definition at line 224 of file light_component.cpp.

◆ get_cloud_mode()

auto unravel::skylight_component::get_cloud_mode ( ) const -> cloud_mode
noexcept

Gets the cloud rendering mode.

Returns
The current cloud mode (none, flat, volumetric).

Definition at line 154 of file light_component.cpp.

◆ get_cloud_speed()

auto unravel::skylight_component::get_cloud_speed ( ) const -> float
noexcept

Gets the cloud speed multiplier.

Returns
The current cloud speed multiplier.

Definition at line 194 of file light_component.cpp.

◆ get_cloud_time()

auto unravel::skylight_component::get_cloud_time ( ) const -> float
inlinenoexcept

Gets the accumulated time for cloud animation.

Returns
The accumulated time for cloud animation.

Definition at line 365 of file light_component.h.

◆ get_cloud_top_altitude()

auto unravel::skylight_component::get_cloud_top_altitude ( ) const -> float
noexcept

Gets the cloud top altitude in world units (volumetric slab top).

Returns
The current cloud top altitude. Flat clouds ignore this.

Definition at line 184 of file light_component.cpp.

◆ get_cloud_vol_base_mix()

auto unravel::skylight_component::get_cloud_vol_base_mix ( ) const -> float
noexcept

Volumetric cloud shape: blend between coarse and fine base noise.

Definition at line 294 of file light_component.cpp.

◆ get_cloud_vol_coarse_scale()

auto unravel::skylight_component::get_cloud_vol_coarse_scale ( ) const -> float
noexcept

Volumetric cloud shape: coarse noise sample scale (larger masses).

Definition at line 284 of file light_component.cpp.

◆ get_cloud_vol_detail_erode()

auto unravel::skylight_component::get_cloud_vol_detail_erode ( ) const -> float
noexcept

Volumetric cloud shape: Worley detail erosion strength.

Definition at line 264 of file light_component.cpp.

◆ get_cloud_vol_edge_width()

auto unravel::skylight_component::get_cloud_vol_edge_width ( ) const -> float
noexcept

Volumetric cloud shape: smoothstep edge width for the density mask.

Definition at line 244 of file light_component.cpp.

◆ get_cloud_vol_macro_strength()

auto unravel::skylight_component::get_cloud_vol_macro_strength ( ) const -> float
noexcept

Volumetric cloud shape: macro Worley threshold jitter (clearings vs sheet).

Definition at line 274 of file light_component.cpp.

◆ get_cloud_vol_shape_power()

auto unravel::skylight_component::get_cloud_vol_shape_power ( ) const -> float
noexcept

Volumetric cloud shape: contrast on the density mask (pow exponent).

Definition at line 254 of file light_component.cpp.

◆ get_cloud_vol_sun_intensity()

auto unravel::skylight_component::get_cloud_vol_sun_intensity ( ) const -> float
noexcept

Volumetric cloud lighting: sun contribution multiplier in the cloud integrator.

Definition at line 304 of file light_component.cpp.

◆ get_cloud_vol_uv_scale()

auto unravel::skylight_component::get_cloud_vol_uv_scale ( ) const -> float
noexcept

Volumetric cloud shape: world-to-noise UV scale (smaller = larger features).

Definition at line 234 of file light_component.cpp.

◆ get_cubemap()

auto unravel::skylight_component::get_cubemap ( ) const -> const asset_handle<gfx::texture>&
inlinenoexcept

Definition at line 352 of file light_component.h.

◆ get_irradiance_intensity()

auto unravel::skylight_component::get_irradiance_intensity ( ) const -> float
noexcept

Gets the irradiance intensity (strength of indirect diffuse).

Returns
The irradiance intensity value.

Definition at line 314 of file light_component.cpp.

◆ get_irradiance_quality()

auto unravel::skylight_component::get_irradiance_quality ( ) const -> irradiance_quality
noexcept

Gets the irradiance quality for indirect diffuse.

Returns
The irradiance quality.

Definition at line 334 of file light_component.cpp.

◆ get_irradiance_tint()

auto unravel::skylight_component::get_irradiance_tint ( ) const -> const math::color&
noexcept

Gets the optional irradiance tint override (default from sky when white).

Returns
The irradiance tint.

Definition at line 324 of file light_component.cpp.

◆ get_irradiance_use_sky()

auto unravel::skylight_component::get_irradiance_use_sky ( ) const -> bool
noexcept

Gets whether the sky color contributes to the ambient irradiance.

Returns
true if the sky/environment color is used; false for a flat tint-only ambient.

Definition at line 344 of file light_component.cpp.

◆ get_mode()

auto unravel::skylight_component::get_mode ( ) const -> const sky_mode&
noexcept

Gets the current sky mode.

Returns
A constant reference to the current sky mode.

Definition at line 135 of file light_component.cpp.

◆ get_sky_brightness()

auto unravel::skylight_component::get_sky_brightness ( ) const -> float
noexcept

Gets the sky brightness multiplier (affects atmospheric pass and irradiance).

Returns
The sky brightness value (1.0 = neutral).

Definition at line 354 of file light_component.cpp.

◆ get_turbidity()

auto unravel::skylight_component::get_turbidity ( ) const -> float
noexcept

Gets the current turbidity value.

Returns
The current turbidity value.

Definition at line 144 of file light_component.cpp.

◆ set_cloud_absorption()

void unravel::skylight_component::set_cloud_absorption ( float absorption)

Sets the cloud absorption coefficient.

Parameters
[in]absorptionThe absorption to set, in the range [0.01, 0.5].

Definition at line 219 of file light_component.cpp.

◆ set_cloud_base_altitude()

void unravel::skylight_component::set_cloud_base_altitude ( float altitude)

Sets the cloud base altitude.

Parameters
[in]altitudeThe cloud base altitude to set, in world units.

Definition at line 179 of file light_component.cpp.

◆ set_cloud_coverage()

void unravel::skylight_component::set_cloud_coverage ( float coverage)

Sets the cloud coverage value.

Parameters
[in]coverageThe cloud coverage value to set, in the range 0.0f-1.0f.

Definition at line 169 of file light_component.cpp.

◆ set_cloud_density()

void unravel::skylight_component::set_cloud_density ( float density)

Sets the cloud density multiplier.

Parameters
[in]densityThe cloud density multiplier to set.

Definition at line 209 of file light_component.cpp.

◆ set_cloud_light_absorption()

void unravel::skylight_component::set_cloud_light_absorption ( float absorption)

Sets the cloud light absorption (self-shadow strength).

Parameters
[in]absorptionThe light absorption to set, in the range [0.01, 0.5].

Definition at line 229 of file light_component.cpp.

◆ set_cloud_mode()

void unravel::skylight_component::set_cloud_mode ( cloud_mode mode)

Sets the cloud rendering mode.

Parameters
[in]modeThe cloud mode to set.

Definition at line 159 of file light_component.cpp.

◆ set_cloud_speed()

void unravel::skylight_component::set_cloud_speed ( float speed)

Sets the cloud speed multiplier.

Parameters
[in]speedThe cloud speed multiplier to set.

Definition at line 199 of file light_component.cpp.

◆ set_cloud_top_altitude()

void unravel::skylight_component::set_cloud_top_altitude ( float altitude)

Sets the cloud top altitude. Must be greater than base altitude.

Parameters
[in]altitudeThe cloud top altitude to set, in world units.

Definition at line 189 of file light_component.cpp.

◆ set_cloud_vol_base_mix()

void unravel::skylight_component::set_cloud_vol_base_mix ( float mix)

Definition at line 299 of file light_component.cpp.

◆ set_cloud_vol_coarse_scale()

void unravel::skylight_component::set_cloud_vol_coarse_scale ( float scale)

Definition at line 289 of file light_component.cpp.

◆ set_cloud_vol_detail_erode()

void unravel::skylight_component::set_cloud_vol_detail_erode ( float erode)

Definition at line 269 of file light_component.cpp.

◆ set_cloud_vol_edge_width()

void unravel::skylight_component::set_cloud_vol_edge_width ( float width)

Definition at line 249 of file light_component.cpp.

◆ set_cloud_vol_macro_strength()

void unravel::skylight_component::set_cloud_vol_macro_strength ( float strength)

Definition at line 279 of file light_component.cpp.

◆ set_cloud_vol_shape_power()

void unravel::skylight_component::set_cloud_vol_shape_power ( float power)

Definition at line 259 of file light_component.cpp.

◆ set_cloud_vol_sun_intensity()

void unravel::skylight_component::set_cloud_vol_sun_intensity ( float intensity)

Definition at line 309 of file light_component.cpp.

◆ set_cloud_vol_uv_scale()

void unravel::skylight_component::set_cloud_vol_uv_scale ( float scale)

Definition at line 239 of file light_component.cpp.

◆ set_cubemap()

void unravel::skylight_component::set_cubemap ( const asset_handle< gfx::texture > & cubemap)
inline

Definition at line 356 of file light_component.h.

◆ set_irradiance_intensity()

void unravel::skylight_component::set_irradiance_intensity ( float intensity)

Sets the irradiance intensity.

Parameters
[in]intensityThe irradiance intensity to set.

Definition at line 319 of file light_component.cpp.

◆ set_irradiance_quality()

void unravel::skylight_component::set_irradiance_quality ( irradiance_quality quality)

Sets the irradiance quality.

Parameters
[in]qualityThe irradiance quality to set.

Definition at line 339 of file light_component.cpp.

◆ set_irradiance_tint()

void unravel::skylight_component::set_irradiance_tint ( const math::color & color)

Sets the irradiance tint override.

Parameters
[in]colorThe irradiance tint to set (white = use sky-derived color).

Definition at line 329 of file light_component.cpp.

◆ set_irradiance_use_sky()

void unravel::skylight_component::set_irradiance_use_sky ( bool use_sky)

Sets whether the sky color contributes to the ambient irradiance.

Parameters
[in]use_skytrue to tint the ambient by the sky/environment color, false to use only the irradiance tint as a flat artist-defined ambient (sky ignored).

Definition at line 349 of file light_component.cpp.

◆ set_mode()

void unravel::skylight_component::set_mode ( const sky_mode & mode)

Sets the sky mode.

Parameters
[in]modeThe sky mode to set.

Definition at line 139 of file light_component.cpp.

◆ set_sky_brightness()

void unravel::skylight_component::set_sky_brightness ( float brightness)

Sets the sky brightness multiplier.

Parameters
[in]brightnessThe sky brightness to set (1.0 = neutral, >1 brighter, <1 darker).

Definition at line 359 of file light_component.cpp.

◆ set_turbidity()

void unravel::skylight_component::set_turbidity ( float turbidity)

Sets the turbidity value.

Parameters
[in]turbidityThe turbidity value to set, in the range 1.9f-10.0f.

Definition at line 149 of file light_component.cpp.

◆ update()

void unravel::skylight_component::update ( delta_t dt)
inline

Definition at line 370 of file light_component.h.


The documentation for this class was generated from the following files: