|
Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
|
Irradiance at a grid of points — an Environment sampled, not held. More...
#include <ProbeVolume.hpp>
Public Member Functions | |
| bool | sparse () const |
| glm::ivec3 | cells () const |
| bool | hasSkyVisibility () const |
| u32 | probeCount () const |
| The probes the coefficients hold: the grid's for a dense one, kBrickProbes a brick for a sparse one. | |
| bool | isValid () const |
| bool | setBricks (std::vector< glm::ivec4 > list) |
| Makes the grid sparse with these bricks. False, and the grid left dense, unless they tile it: every span a power of two, every brick starting on a multiple of its span inside the grid, and every finest-brick cell covered by exactly one brick. | |
Static Public Member Functions | |
| static u64 | nextRevision () |
| static glm::ivec3 | cellsFor (const glm::ivec3 &res) |
| Finest-brick cells along each axis: enough for every probe interval, one on a flat axis. | |
Public Attributes | |
| glm::ivec3 | resolution {0} |
| Probes along each axis of the finest grid. One on an axis is a constant along it — which is what an Environment already is — so a flat volume is the same case and not a second one. | |
| std::vector< glm::vec3 > | irradiance |
| Nine RGB coefficients per probe: in grid order when dense, brick after brick (each brick's probes x fastest) when sparse. | |
| std::vector< f32 > | skyVisibility |
| How much of the sky each probe sees: nine coefficients per probe, cosine-convolved like the irradiance (1 everywhere is open sky), laid out as the irradiance is. Empty for a grid baked without sky occlusion, whose irradiance then holds the sky as it was at the bake; with it, the irradiance holds the lights and bounces alone and the frame's sky is added through this. | |
| std::vector< glm::ivec4 > | bricks |
| Sparse only: each brick's first finest-brick cell (xyz) and its span in those cells (w). Empty for a dense grid. Set through setBricks, which checks they tile the grid. | |
| std::vector< i32 > | cellBrick |
| Sparse only: which brick covers each finest-brick cell, x fastest. Built by setBricks. | |
| u64 | revision = 0 |
| Changes whenever the coefficients do (a new grid, its sky visibility set): what the frame's probe atlas keys on, so it uploads a grid once and again only when the grid itself changed. Unique across grids, so a released grid whose memory a new one reuses is never mistaken for it. | |
Static Public Attributes | |
| static constexpr i32 | kBrickCells = 4 |
| Cells a brick spans along each axis at its own spacing, and the probes it carries (its far faces too). | |
| static constexpr i32 | kBrickSide = kBrickCells + 1 |
| static constexpr i32 | kBrickProbes = kBrickSide * kBrickSide * kBrickSide |
Irradiance at a grid of points — an Environment sampled, not held.
Two shapes. DENSE: nine coefficients per probe of the grid, running x fastest then y then z, the order a bake writes and a trilinear read assumes. SPARSE: the grid cut into bricks of kBrickCells finest cells a side, each brick at a span of 1, 2, 4... finest-brick cells and carrying kBrickProbes probes (its far faces included) at its own spacing — fine where light changes against geometry, coarse in the air. Either way resolution is the FINEST grid's probe count, which is what places a point in it. Where the grid STANDS is the component's, so moving a volume moves the light it holds and one bake can be read at a second placement.
Definition at line 30 of file ProbeVolume.hpp.
|
inline |
Definition at line 74 of file ProbeVolume.hpp.
References cellsFor(), and resolution.
Referenced by isValid(), and setBricks().
|
inlinestatic |
Finest-brick cells along each axis: enough for every probe interval, one on a flat axis.
Definition at line 69 of file ProbeVolume.hpp.
References kBrickCells.
Referenced by cells().
|
inline |
Definition at line 76 of file ProbeVolume.hpp.
References probeCount(), and skyVisibility.
Referenced by esengine::ProbeStore::fillAtlas(), and esengine::ProbeStore::sample().
|
inline |
Definition at line 88 of file ProbeVolume.hpp.
References cellBrick, cells(), irradiance, probeCount(), and sparse().
Referenced by esengine::ProbeStore::add(), and esengine::probe_volume_setSkyVisibility().
|
inlinestatic |
Definition at line 64 of file ProbeVolume.hpp.
References esengine::nextRevision().
Referenced by esengine::resource::ResourceManager::createProbeVolume(), esengine::resource::ResourceManager::createProbeVolumeBricks(), and esengine::probe_volume_setSkyVisibility().
|
inline |
The probes the coefficients hold: the grid's for a dense one, kBrickProbes a brick for a sparse one.
Definition at line 81 of file ProbeVolume.hpp.
References bricks, kBrickProbes, resolution, and sparse().
Referenced by hasSkyVisibility(), isValid(), and esengine::probe_volume_setSkyVisibility().
|
inline |
Makes the grid sparse with these bricks. False, and the grid left dense, unless they tile it: every span a power of two, every brick starting on a multiple of its span inside the grid, and every finest-brick cell covered by exactly one brick.
Definition at line 101 of file ProbeVolume.hpp.
References bricks, cellBrick, cells(), and resolution.
|
inline |
Definition at line 66 of file ProbeVolume.hpp.
References bricks.
Referenced by esengine::ProbeStore::fillAtlas(), isValid(), esengine::ProbeStore::layoutAtlas(), probeCount(), and esengine::ProbeStore::sample().
| std::vector<glm::ivec4> esengine::ProbeVolume::bricks |
Sparse only: each brick's first finest-brick cell (xyz) and its span in those cells (w). Empty for a dense grid. Set through setBricks, which checks they tile the grid.
Definition at line 54 of file ProbeVolume.hpp.
Referenced by esengine::ProbeStore::fillAtlas(), esengine::ProbeStore::layoutAtlas(), probeCount(), setBricks(), and sparse().
| std::vector<i32> esengine::ProbeVolume::cellBrick |
Sparse only: which brick covers each finest-brick cell, x fastest. Built by setBricks.
Definition at line 57 of file ProbeVolume.hpp.
Referenced by isValid(), and setBricks().
| std::vector<glm::vec3> esengine::ProbeVolume::irradiance |
Nine RGB coefficients per probe: in grid order when dense, brick after brick (each brick's probes x fastest) when sparse.
Definition at line 44 of file ProbeVolume.hpp.
Referenced by esengine::ProbeStore::fillAtlas(), isValid(), and esengine::ProbeStore::sample().
|
staticconstexpr |
Cells a brick spans along each axis at its own spacing, and the probes it carries (its far faces too).
Definition at line 33 of file ProbeVolume.hpp.
Referenced by cellsFor().
|
staticconstexpr |
Definition at line 35 of file ProbeVolume.hpp.
Referenced by esengine::ProbeStore::fillAtlas(), esengine::probe_volume_createBricks(), and probeCount().
|
staticconstexpr |
Definition at line 34 of file ProbeVolume.hpp.
| glm::ivec3 esengine::ProbeVolume::resolution {0} |
Probes along each axis of the finest grid. One on an axis is a constant along it — which is what an Environment already is — so a flat volume is the same case and not a second one.
Definition at line 40 of file ProbeVolume.hpp.
Referenced by cells(), esengine::ProbeStore::fillAtlas(), esengine::ProbeStore::layoutAtlas(), probeCount(), esengine::ProbeStore::sample(), and setBricks().
| u64 esengine::ProbeVolume::revision = 0 |
Changes whenever the coefficients do (a new grid, its sky visibility set): what the frame's probe atlas keys on, so it uploads a grid once and again only when the grid itself changed. Unique across grids, so a released grid whose memory a new one reuses is never mistaken for it.
Definition at line 62 of file ProbeVolume.hpp.
Referenced by esengine::ProbeStore::layoutAtlas(), and esengine::probe_volume_setSkyVisibility().
| std::vector<f32> esengine::ProbeVolume::skyVisibility |
How much of the sky each probe sees: nine coefficients per probe, cosine-convolved like the irradiance (1 everywhere is open sky), laid out as the irradiance is. Empty for a grid baked without sky occlusion, whose irradiance then holds the sky as it was at the bake; with it, the irradiance holds the lights and bounces alone and the frame's sky is added through this.
Definition at line 50 of file ProbeVolume.hpp.
Referenced by esengine::ProbeStore::fillAtlas(), hasSkyVisibility(), esengine::probe_volume_setSkyVisibility(), and esengine::ProbeStore::sample().