Unravel Engine C++ Reference
Loading...
Searching...
No Matches
reflection_probe_component.h
Go to the documentation of this file.
1#pragma once
2#include <base/basetypes.hpp>
5
8
9#include <array>
10
11namespace unravel
12{
13
18class reflection_probe_component : public component_crtp<reflection_probe_component>
19{
20public:
25 auto get_probe() const -> const reflection_probe&;
26
31 void set_probe(const reflection_probe& probe);
32
36 auto get_bounds() const -> math::bbox;
37
48 const math::vec3& position,
49 const math::vec3& scale,
50 const math::vec3& view_origin,
51 const math::transform& view,
52 const math::transform& proj) const -> int;
53
59 auto get_render_view(size_t idx) -> gfx::render_view&;
60
66 auto get_cubemap() -> const gfx::texture::ptr&;
67
72 auto get_cubemap_fbo(size_t face) -> const gfx::frame_buffer::ptr&;
73
77 void update();
78
83 auto already_generated() const -> bool;
84
89 auto already_generated(size_t face) const -> bool;
90
94 void set_generation_frame(size_t face, uint64_t frame);
95
96
101 auto get_faces_per_frame() const -> size_t { return faces_per_frame_; }
102
107 void set_faces_per_frame(size_t faces) { faces_per_frame_ = faces; }
108
113 auto get_apply_prefilter() const -> bool { return apply_prefilter_; }
114
119 void set_apply_prefilter(bool apply) { apply_prefilter_ = apply; }
120
121private:
125 reflection_probe probe_;
126
130 std::array<gfx::render_view, 6> rview_;
131
132 std::array<uint64_t, 6> generated_frame_{uint64_t(-1),
133 uint64_t(-1),
134 uint64_t(-1),
135 uint64_t(-1),
136 uint64_t(-1),
137 uint64_t(-1)};
138
139 bool apply_prefilter_{false};
140 size_t faces_per_frame_ = 1; // Number of faces to generate per frame
141 size_t generated_faces_count_ = 0; // Number of faces generated in the current cycle
142 bool first_generation_{true};
143
144};
145
146} // namespace unravel
General purpose transformation class designed to maintain each component of the transformation separa...
Definition transform.hpp:27
Class that contains core reflection probe data, used for rendering and other purposes.
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.
void set_apply_prefilter(bool apply)
Sets whether to apply prefiltering.
void set_faces_per_frame(size_t faces)
Sets the number of faces generated per frame.
auto get_cubemap_fbo(size_t face) -> const gfx::frame_buffer::ptr &
Gets the cubemap frame buffer object (FBO).
auto get_bounds() const -> math::bbox
Gets the bounding box of the probe object.
auto get_apply_prefilter() const -> bool
Gets whether prefiltering is applied.
auto get_probe() const -> const reflection_probe &
Gets the reflection probe object.
void update()
Updates the reflection probe component.
auto get_cubemap_prefiltered() -> const gfx::texture::ptr &
Gets the cubemap texture.
void set_generation_frame(size_t face, uint64_t frame)
marks the genrerated face this frame
auto get_render_view(size_t idx) -> gfx::render_view &
Gets the render view.
auto get_faces_per_frame() const -> size_t
Gets the number of faces generated per frame.
auto already_generated() const -> bool
Check if the cubemap was generated this frame.
auto get_cubemap() -> const gfx::texture::ptr &
void set_probe(const reflection_probe &probe)
Sets the reflection probe object.
uint32_t frame
Definition graphics.cpp:21
float scale
Definition hub.cpp:25
Storage for box vector values and wraps up common functionality.
Definition bbox.h:21
CRTP (Curiously Recurring Template Pattern) base structure for components.
Structure representing a reflection probe.