|
Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
|
Which channel of the 2D shadow mask each casting light draws into, so lights that never meet can share one. More...


Go to the source code of this file.
Classes | |
| struct | esengine::ShadowMaskLight |
| One light as the channel assignment sees it: where its shadows are read and where they can land. More... | |
Namespaces | |
| namespace | esengine |
Functions | |
| bool | esengine::shadowMasksCollide (const ShadowMaskLight &a, const ShadowMaskLight &b) |
| Whether two lights cannot share a channel: one reads where the other writes. | |
| u32 | esengine::assignShadowChannels (const ShadowMaskLight *lights, u32 count, u32 channels, i32 *out) |
| Gives each light the first channel none of its collisions hold, in the order the lights are given. | |
Which channel of the 2D shadow mask each casting light draws into, so lights that never meet can share one.
The mask is one screen-sized RGBA8 target, four channels, and a Lit fragment reads the channel of each light that reaches it. A channel is only wrong where two lights could both be there: a fragment that a light reaches reads that light's channel, and what ELSE was drawn into it, by a light whose shadow lands on the same fragment, would be read as this light's. So two lights may share a channel when neither's reach (where it is read) touches the other's shadow (where it is written). A scene of torches spread round a camp is then as many casting lights as it has torches, and only lights that overlap pay a channel each. Header-only and device-free, so the answer is pinned by a test and not by a frame.
Definition in file ShadowChannels2D.hpp.