Toast Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
irradiance_volume.hpp
Go to the documentation of this file.
1
8
9
#pragma once
10
#include "
node_3d.hpp
"
11
12
#include <algorithm>
13
#include <
toast/export.hpp
>
14
15
namespace
toast {
16
35
class
[[ToastNode]] TOAST_API IrradianceVolume :
public
Node3D
{
36
public
:
37
IrradianceVolume() =
default
;
38
~IrradianceVolume()
override
=
default
;
39
41
[[nodiscard]]
42
auto
extents
() const noexcept -> const glm::vec3& {
43
return
m_extents;
44
}
45
47
[[nodiscard]]
48
auto
spacing
() const noexcept ->
float
{
49
return
std::max(m_spacing, 0.1f);
50
}
51
52
[[nodiscard]]
53
auto
intensity() const noexcept ->
float
{
54
return
m_intensity;
55
}
56
58
[[nodiscard]]
59
auto
probeCounts
() const noexcept -> glm::uvec3 {
60
const
glm::vec3 size = m_extents * 2.0f;
61
const
float
step =
spacing
();
62
return
{
63
static_cast<
uint32_t
>
(std::clamp(
static_cast<
int
>
(size.x / step) + 1, 2, 32)),
64
static_cast<
uint32_t
>
(std::clamp(
static_cast<
int
>
(size.y / step) + 1, 2, 32)),
65
static_cast<
uint32_t
>
(std::clamp(
static_cast<
int
>
(size.z / step) + 1, 2, 32))
66
};
67
}
68
70
[[nodiscard]]
71
auto
probeCount
() const noexcept -> uint32_t {
72
const
glm::uvec3 counts =
probeCounts
();
73
return
counts.x * counts.y * counts.z;
74
}
75
76
private
:
77
void
init();
78
void
end();
79
void
destroy();
80
83
[[
Reflect
, Name(
"Extents"
), Unit(
"m"
)]]
alignas
(16) glm::vec3 m_extents = glm::vec3(10.0f);
84
88
[[
Reflect
, Name(
"Probe Spacing"
), Unit(
"m"
), Range(0.1, 50.0)]]
89
float
m_spacing = 4.0f;
90
91
[[
Reflect
, Name(
"Intensity"
), Range(0.0, 4.0)]]
92
float
m_intensity = 1.0f;
93
94
bool
m_registered_proxy =
false
;
95
};
96
97
}
toast::IrradianceVolume::extents
auto extents() const noexcept -> const glm::vec3 &
Definition
irradiance_volume.hpp:42
toast::IrradianceVolume::probeCount
auto probeCount() const noexcept -> uint32_t
Definition
irradiance_volume.hpp:71
toast::IrradianceVolume::spacing
auto spacing() const noexcept -> float
Definition
irradiance_volume.hpp:48
toast::IrradianceVolume::probeCounts
auto probeCounts() const noexcept -> glm::uvec3
Definition
irradiance_volume.hpp:59
toast::Node3D
Definition
node_3d.hpp:25
toast::Reflect
Definition
reflect.hpp:244
export.hpp
node_3d.hpp
Node with 3D spatial transforms.
engine
src
toast
world
irradiance_volume.hpp
Generated by
1.17.0