|
Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
|
The depths this view is blocked at, and the test a bound asks it. More...
#include <OcclusionView.hpp>
Public Member Functions | |
| void | setSize (u32 size) |
| u32 | size () const |
| void | begin (const glm::mat4 &viewProjection) |
Opens a view looking through viewProjection. Nothing is blocked until a box is taken, which is what a scene declaring no occluder (every 2D one) pays: one comparison per renderable. | |
| bool | addBox (const glm::vec3 ¢re, const glm::quat &rotation, const glm::vec3 &half) |
Takes one solid box — half world half-extents about centre, turned by rotation — as something sight does not pass through. | |
| void | finish () |
| Closes the view: reduces the grid by MAXIMUM into a pyramid, so a bound of any size on screen costs four reads rather than its area. A coarse texel answers for a whole region, and taking the farthest of them is what keeps a region that is only partly blocked drawn. | |
| bool | hidden (const glm::vec3 ¢re, const glm::vec3 &half) const |
Whether nothing of a box bounded by centre / half can be seen, because every texel it covers is blocked nearer than its nearest point. | |
| bool | empty () const |
| Whether this view blocks nothing, so every bound is visible to it. | |
| u32 | boxes () const |
| How many declared boxes this view took. | |
Static Public Attributes | |
| static constexpr u32 | kSize = 64 |
| Grid resolution of the coarsest useful answer. A texel is ~1.5% of the screen, which is what an occluder must exceed to hide anything; finer costs the rasterisation, which is the only cost here. | |
| static constexpr u32 | kLevels = 7 |
| 64, 32, 16, 8, 4, 2, 1 — down to one texel, so an object covering the whole screen still takes a bounded number of reads. | |
| static constexpr u32 | kTestSpan = 4 |
| Texels a side a bound is tested over: sixteen reads, whatever its size on screen. | |
| static constexpr f32 | kOpen = std::numeric_limits<f32>::infinity() |
| Depth of a texel nothing covers: no bound is ever farther. | |
| static constexpr f32 | kMinW = 1e-4f |
| Smallest clip w a corner may have. Anything at or behind the eye plane makes the projection meaningless, and the cases that reach it — the eye inside the box, the box across the near plane — are exactly the ones a conservative answer must refuse. | |
The depths this view is blocked at, and the test a bound asks it.
begin, an addBox per declared occluder, finish, then hidden until the next begin. The stored view-projection serves both halves: a tester holding its own copy is how a raster and a test come to disagree about where something is.
Definition at line 48 of file OcclusionView.hpp.
|
inline |
Takes one solid box — half world half-extents about centre, turned by rotation — as something sight does not pass through.
Definition at line 100 of file OcclusionView.hpp.
References kOpen.
|
inline |
Opens a view looking through viewProjection. Nothing is blocked until a box is taken, which is what a scene declaring no occluder (every 2D one) pays: one comparison per renderable.
Definition at line 86 of file OcclusionView.hpp.
|
inline |
How many declared boxes this view took.
Definition at line 234 of file OcclusionView.hpp.
|
inline |
Whether this view blocks nothing, so every bound is visible to it.
Definition at line 231 of file OcclusionView.hpp.
|
inline |
Closes the view: reduces the grid by MAXIMUM into a pyramid, so a bound of any size on screen costs four reads rather than its area. A coarse texel answers for a whole region, and taking the farthest of them is what keeps a region that is only partly blocked drawn.
Definition at line 163 of file OcclusionView.hpp.
References size().
|
inline |
Whether nothing of a box bounded by centre / half can be seen, because every texel it covers is blocked nearer than its nearest point.
Definition at line 184 of file OcclusionView.hpp.
|
inline |
Definition at line 71 of file OcclusionView.hpp.
|
inline |
Definition at line 81 of file OcclusionView.hpp.
|
staticconstexpr |
64, 32, 16, 8, 4, 2, 1 — down to one texel, so an object covering the whole screen still takes a bounded number of reads.
Definition at line 56 of file OcclusionView.hpp.
|
staticconstexpr |
Smallest clip w a corner may have. Anything at or behind the eye plane makes the projection meaningless, and the cases that reach it — the eye inside the box, the box across the near plane — are exactly the ones a conservative answer must refuse.
Definition at line 69 of file OcclusionView.hpp.
Depth of a texel nothing covers: no bound is ever farther.
Definition at line 63 of file OcclusionView.hpp.
|
staticconstexpr |
Grid resolution of the coarsest useful answer. A texel is ~1.5% of the screen, which is what an occluder must exceed to hide anything; finer costs the rasterisation, which is the only cost here.
Definition at line 53 of file OcclusionView.hpp.
Referenced by setSize().
|
staticconstexpr |
Texels a side a bound is tested over: sixteen reads, whatever its size on screen.
Definition at line 60 of file OcclusionView.hpp.
Referenced by hidden().