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

Class that contains core reflection probe data, used for rendering and other purposes. More...

#include <reflection_probe_component.h>

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

Public Member Functions

auto get_probe () const -> const reflection_probe &
 Gets the reflection probe object.
 
void set_probe (const reflection_probe &probe)
 Sets the reflection probe object.
 
auto get_bounds () const -> math::bbox
 Gets the bounding box of the probe object.
 
auto compute_projected_sphere_rect (irect32_t &rect, const math::vec3 &position, const math::vec3 &scale, const math::vec3 &view_origin, const math::transform &view, const math::transform &proj) const -> int
 Computes the projected sphere rectangle.
 
auto get_render_view (size_t idx) -> gfx::render_view &
 Gets the render view.
 
auto get_cubemap_prefiltered () -> const gfx::texture::ptr &
 Gets the cubemap texture.
 
auto get_cubemap () -> const gfx::texture::ptr &
 
auto get_cubemap_fbo (size_t face) -> const gfx::frame_buffer::ptr &
 Gets the cubemap frame buffer object (FBO).
 
void update (float dt)
 Advances the probe's update bookkeeping. Called once per frame by reflection_probe_system.
 
void release_resources ()
 
auto already_generated () const -> bool
 Check if the cubemap was generated this frame.
 
auto already_generated (size_t face) const -> bool
 Check if the cubemap's face was generated this frame.
 
void set_generation_frame (size_t face, uint64_t frame)
 marks the genrerated face this frame
 
void mark_dirty (bool force_full_first_frame=false)
 Requests the probe to rebuild its cubemap.
 
auto is_dirty () const -> bool
 Returns true if the probe has pending or in-flight cubemap generation work.
 
auto is_bake_cycle_unstarted () const -> bool
 Returns true when a bake has been requested but no cubemap face has been emitted yet.
 
auto is_bake_complete () const -> bool
 Returns true when all six cubemap faces have been rendered in the current bake cycle.
 
auto get_faces_per_frame () const -> size_t
 Gets the number of faces generated per frame.
 
void set_faces_per_frame (size_t faces)
 Sets the number of faces generated per frame.
 
auto get_apply_prefilter () const -> bool
 Gets whether prefiltering is applied.
 
void set_apply_prefilter (bool apply)
 Sets whether to apply prefiltering.
 
auto get_update_mode () const -> probe_update_mode
 Gets the probe's update policy.
 
void set_update_mode (probe_update_mode mode)
 Sets the probe's update policy. Switching INTO on_demand leaves the current bake state as-is; switching OUT of on_demand schedules a rebuild so the probe reflects its new behavior immediately.
 
auto get_update_interval () const -> float
 Gets the realtime refresh interval in seconds. Only consulted for realtime probes.
 
void set_update_interval (float seconds)
 Sets the realtime refresh interval in seconds.
 
auto get_resolution () const -> probe_resolution
 Gets the cubemap face resolution.
 
void set_resolution (probe_resolution resolution)
 Sets the cubemap face resolution. Triggers a rebuild when changed.
 
auto get_capture_sky () const -> bool
 Returns true when the atmospheric sky pass is included during cubemap capture.
 
void set_capture_sky (bool capture)
 Sets whether the atmospheric sky pass runs during cubemap capture. Disable for interior/local probes that should only reflect nearby geometry.
 
auto get_capture_shadows () const -> bool
 Returns true when shadow maps are rendered during cubemap capture.
 
void set_capture_shadows (bool capture)
 Sets whether shadow maps are built and sampled during cubemap capture.
 
- Public Member Functions inherited from unravel::basic_component
void touch ()
 Marks the component as 'touched'.
 

Additional Inherited Members

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

Detailed Description

Class that contains core reflection probe data, used for rendering and other purposes.

Definition at line 18 of file reflection_probe_component.h.

Member Function Documentation

◆ already_generated() [1/2]

auto unravel::reflection_probe_component::already_generated ( ) const -> bool

Check if the cubemap was generated this frame.

Returns
A bool indicating whether the faces was already generated

Definition at line 237 of file reflection_probe_component.cpp.

◆ already_generated() [2/2]

auto unravel::reflection_probe_component::already_generated ( size_t face) const -> bool

Check if the cubemap's face was generated this frame.

Returns
A bool indicating whether the face was already generated.

Definition at line 254 of file reflection_probe_component.cpp.

◆ compute_projected_sphere_rect()

auto unravel::reflection_probe_component::compute_projected_sphere_rect ( irect32_t & rect,
const math::vec3 & position,
const math::vec3 & scale,
const math::vec3 & view_origin,
const math::transform & view,
const math::transform & proj ) const -> int

Computes the projected sphere rectangle.

Parameters
[out]rectReference to the rectangle to be computed.
[in]positionThe position of the reflection probe.
[in]view_originThe origin of the view.
[in]viewThe view transform.
[in]projThe projection transform.
Returns
An integer indicating the result of the computation.

Definition at line 27 of file reflection_probe_component.cpp.

◆ get_apply_prefilter()

auto unravel::reflection_probe_component::get_apply_prefilter ( ) const -> bool
inline

Gets whether prefiltering is applied.

Returns
True if prefiltering is applied, false otherwise.

Definition at line 139 of file reflection_probe_component.h.

◆ get_bounds()

auto unravel::reflection_probe_component::get_bounds ( ) const -> math::bbox

Gets the bounding box of the probe object.

Definition at line 7 of file reflection_probe_component.cpp.

◆ get_capture_shadows()

auto unravel::reflection_probe_component::get_capture_shadows ( ) const -> bool
inline

Returns true when shadow maps are rendered during cubemap capture.

Definition at line 194 of file reflection_probe_component.h.

◆ get_capture_sky()

auto unravel::reflection_probe_component::get_capture_sky ( ) const -> bool
inline

Returns true when the atmospheric sky pass is included during cubemap capture.

Definition at line 183 of file reflection_probe_component.h.

◆ get_cubemap()

auto unravel::reflection_probe_component::get_cubemap ( ) -> const gfx::texture::ptr&

Definition at line 75 of file reflection_probe_component.cpp.

◆ get_cubemap_fbo()

auto unravel::reflection_probe_component::get_cubemap_fbo ( size_t face) -> const gfx::frame_buffer::ptr&

Gets the cubemap frame buffer object (FBO).

Returns
A shared pointer to the cubemap frame buffer object.

Definition at line 111 of file reflection_probe_component.cpp.

◆ get_cubemap_prefiltered()

auto unravel::reflection_probe_component::get_cubemap_prefiltered ( ) -> const gfx::texture::ptr&

Gets the cubemap texture.

Returns
A shared pointer to the cubemap texture.

Definition at line 93 of file reflection_probe_component.cpp.

◆ get_faces_per_frame()

auto unravel::reflection_probe_component::get_faces_per_frame ( ) const -> size_t
inline

Gets the number of faces generated per frame.

Returns
The number of faces generated per frame.

Definition at line 127 of file reflection_probe_component.h.

◆ get_probe()

auto unravel::reflection_probe_component::get_probe ( ) const -> const reflection_probe&

Gets the reflection probe object.

Returns
A constant reference to the reflection probe object.

Definition at line 190 of file reflection_probe_component.cpp.

◆ get_render_view()

auto unravel::reflection_probe_component::get_render_view ( size_t idx) -> gfx::render_view&

Gets the render view.

Parameters
[in]idxThe index of the render view to get.
Returns
A reference to the render view.

Definition at line 70 of file reflection_probe_component.cpp.

◆ get_resolution()

auto unravel::reflection_probe_component::get_resolution ( ) const -> probe_resolution
inline

Gets the cubemap face resolution.

Definition at line 173 of file reflection_probe_component.h.

◆ get_update_interval()

auto unravel::reflection_probe_component::get_update_interval ( ) const -> float
inline

Gets the realtime refresh interval in seconds. Only consulted for realtime probes.

Definition at line 162 of file reflection_probe_component.h.

◆ get_update_mode()

auto unravel::reflection_probe_component::get_update_mode ( ) const -> probe_update_mode
inline

Gets the probe's update policy.

Definition at line 150 of file reflection_probe_component.h.

◆ is_bake_complete()

auto unravel::reflection_probe_component::is_bake_complete ( ) const -> bool

Returns true when all six cubemap faces have been rendered in the current bake cycle.

Definition at line 321 of file reflection_probe_component.cpp.

◆ is_bake_cycle_unstarted()

auto unravel::reflection_probe_component::is_bake_cycle_unstarted ( ) const -> bool

Returns true when a bake has been requested but no cubemap face has been emitted yet.

Definition at line 303 of file reflection_probe_component.cpp.

◆ is_dirty()

auto unravel::reflection_probe_component::is_dirty ( ) const -> bool

Returns true if the probe has pending or in-flight cubemap generation work.

Definition at line 298 of file reflection_probe_component.cpp.

◆ mark_dirty()

void unravel::reflection_probe_component::mark_dirty ( bool force_full_first_frame = false)

Requests the probe to rebuild its cubemap.

The next reflection-generation pass will begin emitting new faces. When force_full_first_frame is true, all six faces are baked in a single frame (matching the first-ever-generation behavior) instead of being time-sliced by faces_per_frame. Use this for manual "Bake now" actions where the user wants an instant result.

Definition at line 279 of file reflection_probe_component.cpp.

◆ release_resources()

void unravel::reflection_probe_component::release_resources ( )

Definition at line 184 of file reflection_probe_component.cpp.

◆ set_apply_prefilter()

void unravel::reflection_probe_component::set_apply_prefilter ( bool apply)
inline

Sets whether to apply prefiltering.

Parameters
applyTrue to apply prefiltering, false otherwise.

Definition at line 145 of file reflection_probe_component.h.

◆ set_capture_shadows()

void unravel::reflection_probe_component::set_capture_shadows ( bool capture)

Sets whether shadow maps are built and sampled during cubemap capture.

Definition at line 372 of file reflection_probe_component.cpp.

◆ set_capture_sky()

void unravel::reflection_probe_component::set_capture_sky ( bool capture)

Sets whether the atmospheric sky pass runs during cubemap capture. Disable for interior/local probes that should only reflect nearby geometry.

Definition at line 356 of file reflection_probe_component.cpp.

◆ set_faces_per_frame()

void unravel::reflection_probe_component::set_faces_per_frame ( size_t faces)
inline

Sets the number of faces generated per frame.

Parameters
facesThe number of faces to generate per frame (1-6). Only used while a bake is in progress.

Definition at line 133 of file reflection_probe_component.h.

◆ set_generation_frame()

void unravel::reflection_probe_component::set_generation_frame ( size_t face,
uint64_t frame )

marks the genrerated face this frame

Definition at line 273 of file reflection_probe_component.cpp.

◆ set_probe()

void unravel::reflection_probe_component::set_probe ( const reflection_probe & probe)

Sets the reflection probe object.

Parameters
[in]probeThe reflection probe object to set.

Definition at line 195 of file reflection_probe_component.cpp.

◆ set_resolution()

void unravel::reflection_probe_component::set_resolution ( probe_resolution resolution)

Sets the cubemap face resolution. Triggers a rebuild when changed.

Definition at line 339 of file reflection_probe_component.cpp.

◆ set_update_interval()

void unravel::reflection_probe_component::set_update_interval ( float seconds)
inline

Sets the realtime refresh interval in seconds.

Parameters
seconds0 means "every available frame" (still time-sliced by faces_per_frame).

Definition at line 168 of file reflection_probe_component.h.

◆ set_update_mode()

void unravel::reflection_probe_component::set_update_mode ( probe_update_mode mode)

Sets the probe's update policy. Switching INTO on_demand leaves the current bake state as-is; switching OUT of on_demand schedules a rebuild so the probe reflects its new behavior immediately.

Definition at line 215 of file reflection_probe_component.cpp.

◆ update()

void unravel::reflection_probe_component::update ( float dt)

Advances the probe's update bookkeeping. Called once per frame by reflection_probe_system.

Parameters
[in]dtFrame delta time in seconds. Used to drive the realtime update interval.

Definition at line 142 of file reflection_probe_component.cpp.


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