Antkeeper  0.0.1
Public Member Functions | List of all members
scene::light_probe Class Reference

#include <light-probe.hpp>

Inheritance diagram for scene::light_probe:
scene::object< light_probe > scene::object_base

Public Member Functions

 light_probe ()
 Constructs a light probe. More...
 
void update_illuminance_matrices ()
 Updates the light probe's illuminance matrices from its illuminance texture. More...
 
void set_luminance_texture (std::shared_ptr< gl::texture_cube > texture)
 Sets the light probe's luminance texture. More...
 
void set_luminance_outdated (bool outdated)
 Marks the light probe's luminance as either outdated or current. More...
 
void set_illuminance_outdated (bool outdated)
 Marks the light probe's illuminance as either outdated or current. More...
 
const std::shared_ptr< gl::texture_cube > & get_luminance_texture () const noexcept
 Returns the light probe's luminance texture. More...
 
const std::vector< std::shared_ptr< gl::framebuffer > > & get_luminance_framebuffers () const noexcept
 Returns the light probe's luminance framebuffers. More...
 
const std::shared_ptr< gl::texture_1d > & get_illuminance_texture () const noexcept
 Returns the light probe's illuminance texture. More...
 
const std::shared_ptr< gl::framebuffer > & get_illuminance_framebuffer () const noexcept
 Returns the light probe's illuminance framebuffer. More...
 
std::span< const math::fmat4, 3 > get_illuminance_matrices () const noexcept
 Returns the light probe's illuminance matrices. More...
 
bool is_luminance_outdated () const noexcept
 Returns true if the light probe's luminance is outdated. More...
 
bool is_illuminance_outdated () const noexcept
 Returns true if the light probe's illuminance is outdated. More...
 
const aabb_typeget_bounds () const noexcept override
 Returns the bounds of the object. More...
 
- Public Member Functions inherited from scene::object< light_probe >
const std::size_t get_object_type_id () const noexcept final
 Returns the type ID for this scene object type. More...
 
- Public Member Functions inherited from scene::object_base
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_typeget_transform () const noexcept
 Returns the transform of the object. More...
 
constexpr const vector_typeget_translation () const noexcept
 Returns the translation of the object. More...
 
constexpr const quaternion_typeget_rotation () const noexcept
 Returns the rotation of the object. More...
 
constexpr const vector_typeget_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

- Public Types inherited from scene::object_base
using vector_type = math::fvec3
 
using quaternion_type = math::fquat
 
using transform_type = math::transform< float >
 
using aabb_type = geom::box< float >
 
- Static Public Attributes inherited from scene::object< light_probe >
static const std::atomic< std::size_t > object_type_id
 Unique type ID for this scene object type. More...
 
- Static Protected Member Functions inherited from scene::object_base
static std::size_t next_object_type_id ()
 
- Protected Attributes inherited from scene::object_base
std::uint32_t m_layer_mask {1}
 
transform_type m_transform {transform_type::identity()}
 

Detailed Description

Definition at line 36 of file light-probe.hpp.

Constructor & Destructor Documentation

◆ light_probe()

scene::light_probe::light_probe ( )

Constructs a light probe.

Definition at line 24 of file light-probe.cpp.

Member Function Documentation

◆ get_bounds()

const aabb_type& scene::light_probe::get_bounds ( ) const
inlineoverridevirtualnoexcept

Returns the bounds of the object.

Implements scene::object_base.

Definition at line 127 of file light-probe.hpp.

◆ get_illuminance_framebuffer()

const std::shared_ptr<gl::framebuffer>& scene::light_probe::get_illuminance_framebuffer ( ) const
inlinenoexcept

Returns the light probe's illuminance framebuffer.

Definition at line 96 of file light-probe.hpp.

◆ get_illuminance_matrices()

std::span<const math::fmat4, 3> scene::light_probe::get_illuminance_matrices ( ) const
inlinenoexcept

Returns the light probe's illuminance matrices.

Returns
Red, green, and blue illuminance matrices.
Warning
The light probe's illuminance matrices must first be updated.
See also
light_probe::update_illuminance_matrices()

Definition at line 110 of file light-probe.hpp.

◆ get_illuminance_texture()

const std::shared_ptr<gl::texture_1d>& scene::light_probe::get_illuminance_texture ( ) const
inlinenoexcept

Returns the light probe's illuminance texture.

The illuminance texture is a 12x1 RGBA floating-point LUT which encodes the column vectors of three spherical harmonics illuminance matrices in the layout R0,R1,R2,R3,G0,G1,G2,G3,B0,B1,B2,B3. The matrices R, G, and B can be used to recover illuminance of the red, green, and blue color channels, respectively, for a given surface normal, n, as follows: (dot(n, R * n), dot(n, G * n), dot(n, B * n)), where n = (x, y, z, 1).

Definition at line 90 of file light-probe.hpp.

◆ get_luminance_framebuffers()

const std::vector<std::shared_ptr<gl::framebuffer> >& scene::light_probe::get_luminance_framebuffers ( ) const
inlinenoexcept

Returns the light probe's luminance framebuffers.

Definition at line 80 of file light-probe.hpp.

◆ get_luminance_texture()

const std::shared_ptr<gl::texture_cube>& scene::light_probe::get_luminance_texture ( ) const
inlinenoexcept

Returns the light probe's luminance texture.

Definition at line 74 of file light-probe.hpp.

◆ is_illuminance_outdated()

bool scene::light_probe::is_illuminance_outdated ( ) const
inlinenoexcept

Returns true if the light probe's illuminance is outdated.

Definition at line 122 of file light-probe.hpp.

◆ is_luminance_outdated()

bool scene::light_probe::is_luminance_outdated ( ) const
inlinenoexcept

Returns true if the light probe's luminance is outdated.

Definition at line 116 of file light-probe.hpp.

◆ set_illuminance_outdated()

void scene::light_probe::set_illuminance_outdated ( bool  outdated)

Marks the light probe's illuminance as either outdated or current.

Parameters
outdatedtrue if the light probe's illuminance is outdated, false otherwise.

Definition at line 121 of file light-probe.cpp.

◆ set_luminance_outdated()

void scene::light_probe::set_luminance_outdated ( bool  outdated)

Marks the light probe's luminance as either outdated or current.

Parameters
outdatedtrue if the light probe's luminance is outdated, false otherwise.

Definition at line 116 of file light-probe.cpp.

◆ set_luminance_texture()

void scene::light_probe::set_luminance_texture ( std::shared_ptr< gl::texture_cube texture)

Sets the light probe's luminance texture.

Parameters
textureLuminance cubemap texture.
Note
Marks the light probe's luminance as outdated if the luminance texture has changed.
Marks the light probe's illuminance as outdated if the luminance texture has changed.

Definition at line 79 of file light-probe.cpp.

◆ update_illuminance_matrices()

void scene::light_probe::update_illuminance_matrices ( )

Updates the light probe's illuminance matrices from its illuminance texture.

Warning
Reads texture data from the GPU.

Definition at line 63 of file light-probe.cpp.


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