Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
esengine::LightConstants Struct Reference

CPU mirror of the GLSL LightConstants block (std140). More...

#include <LightConstants.hpp>

Public Attributes

glm::vec4 ambient {0.0f}
GpuLight lights [MAX_LIGHTS]
glm::vec4 mask2DRect {0.0f}
glm::mat4 shadowMatrix [MAX_SHADOW_TILES]
glm::vec4 shadowTile [MAX_SHADOW_TILES]
glm::vec4 shadowParams {0.0f}
glm::vec4 envIrradiance [9] {}
glm::vec4 envParams {0.0f}
glm::vec4 envTint {0.0f}
glm::vec4 reflParams {1.0f, 1.0f, 1.0f, 0.0f}
glm::vec4 reflBox [2 *MAX_REFLECTION_PROBES] {}
glm::vec4 bakedTint {1.0f}
GpuLight tiledLights [MAX_TILED_LIGHTS]
 The lights past the loop's sixteen (point and spot, no shadow map), read through the tile masks below; see TiledLights.hpp.
glm::uvec4 tileMask [TILE_COLUMNS *TILE_ROWS] {}
glm::vec4 tileInfo {0.0f}
glm::vec4 ambientGround {0.0f}
glm::mat4 tileView {1.0f}
glm::vec4 waterRect {}
glm::vec4 waterDepth {}
glm::vec4 waterSun {}

Detailed Description

CPU mirror of the GLSL LightConstants block (std140).

ambient: rgb = summed ambient color, a = active light count (informational). std140 array-of-struct stride is 96 (each GpuLight is six 16-aligned vec4s), so lights start at offset 16 and the lights array spans 96*MAX_LIGHTS bytes.

Definition at line 141 of file LightConstants.hpp.

Member Data Documentation

◆ ambient

glm::vec4 esengine::LightConstants::ambient {0.0f}

Definition at line 142 of file LightConstants.hpp.

◆ ambientGround

glm::vec4 esengine::LightConstants::ambientGround {0.0f}

rgb = what the ambient term moves by between a surface facing up and one facing down: ground minus sky, so zero (no hemisphere light) leaves ambient as the flat term, pixel for pixel. Last, because a block that does not read it is free not to declare it.

Definition at line 194 of file LightConstants.hpp.

◆ bakedTint

glm::vec4 esengine::LightConstants::bakedTint {1.0f}

rgb = what the BAKED indirect light (a lightmap, a probe volume) is multiplied by: a bake holds one moment's light, so a scene that passes through a day or a weather scales and tints it here (1 = as baked).

Definition at line 181 of file LightConstants.hpp.

◆ envIrradiance

glm::vec4 esengine::LightConstants::envIrradiance[9] {}

The frame environment's nine irradiance coefficients, rgb in xyz. Zero when no light carries one, which makes the flat ambient term the order-zero case of one expression rather than a second path. vec4: std140 pads vec3 anyway.

Definition at line 162 of file LightConstants.hpp.

◆ envParams

glm::vec4 esengine::LightConstants::envParams {0.0f}

x = 1 when a prefiltered reflection is bound; y = its RGBM decode range; z = the highest mip index; w = mip 0's octahedral face size, in texels.

Definition at line 165 of file LightConstants.hpp.

◆ envTint

glm::vec4 esengine::LightConstants::envTint {0.0f}

rgb = the ambient light's colour times its intensity, which scales BOTH halves of the environment. Kept out of the coefficients so the reflection — sampled from a texture the light does not own — is tinted by the same number.

Definition at line 169 of file LightConstants.hpp.

◆ lights

GpuLight esengine::LightConstants::lights[MAX_LIGHTS]

Definition at line 143 of file LightConstants.hpp.

Referenced by esengine::SpritePlugin::collect().

◆ mask2DRect

glm::vec4 esengine::LightConstants::mask2DRect {0.0f}

Where the CAMERA NOW DRAWING lands in a screen-space light mask: xy = its low corner, zw = its size, as fractions of one; zero width = no mask this frame. One rect for BOTH masks — same size, same viewport, so two would be two answers.

Definition at line 147 of file LightConstants.hpp.

◆ reflBox

glm::vec4 esengine::LightConstants::reflBox[2 *MAX_REFLECTION_PROBES] {}

The world box column i answers inside: [2i] = min, [2i+1] = max. Column 0 is the environment and has none — a sky is not somewhere. The shader PROJECTS onto a box, which is what slides a reflection across a wall.

Definition at line 178 of file LightConstants.hpp.

◆ reflParams

glm::vec4 esengine::LightConstants::reflParams {1.0f, 1.0f, 1.0f, 0.0f}

x = how many COLUMNS the bound atlas holds, the environment's included, so one texture serves the sky and every baked room; y = how bright a baked column shows and z how much colour it keeps (1 = as baked); w unused. One column is the environment alone, which is what a scene with no bake has always been.

Definition at line 174 of file LightConstants.hpp.

◆ shadowMatrix

glm::mat4 esengine::LightConstants::shadowMatrix[MAX_SHADOW_TILES]

World -> tile i's clip space. Identity where a tile is unclaimed; which tiles a light may read are the ones its own shadowMap names.

Definition at line 150 of file LightConstants.hpp.

◆ shadowParams

glm::vec4 esengine::LightConstants::shadowParams {0.0f}

x = 1 when the atlas holds a map this frame — the master switch, so a zeroed tile record cannot darken anything before one exists; y = one texel of the atlas.

Definition at line 158 of file LightConstants.hpp.

◆ shadowTile

glm::vec4 esengine::LightConstants::shadowTile[MAX_SHADOW_TILES]

Where tile i sits: xy = its low corner as a fraction of the atlas, z = its side as one; w unused. DATA and not an expression the shader recomputes, so tiles need not all be one size — and how big one is is what a receiver derives its own bias from, which is why no bias is stored here.

Definition at line 155 of file LightConstants.hpp.

◆ tiledLights

GpuLight esengine::LightConstants::tiledLights[MAX_TILED_LIGHTS]

The lights past the loop's sixteen (point and spot, no shadow map), read through the tile masks below; see TiledLights.hpp.

Definition at line 183 of file LightConstants.hpp.

◆ tileInfo

glm::vec4 esengine::LightConstants::tileInfo {0.0f}

x = how many tiled lights there are (0 = the loop does not run), y = tile columns, z = tile rows, w = 1 when the fourth word is marked.

Definition at line 190 of file LightConstants.hpp.

◆ tileMask

glm::uvec4 esengine::LightConstants::tileMask[TILE_COLUMNS *TILE_ROWS] {}

Per screen tile, which of those lights can reach it: bit i of word i / 32. The fourth word is the loop's sixteen (LightStore::markLoopLights): bits 0-15 for a flat lit surface, measured in the plane; bits 16-31 for a 3D one, measured in space through tileView.

Definition at line 187 of file LightConstants.hpp.

◆ tileView

glm::mat4 esengine::LightConstants::tileView {1.0f}

The view the tile masks were marked through (LightStore::markLoopLights). A lit 3D surface finds its tile through THIS, not through the camera drawing it: a point a light reaches lands inside that light's tiles under the view that marked them, whichever camera draws it, so a reflection or a probe face skips only lights that cannot reach. A point outside that view finds no tile and skips nothing. Last, after a member a block may leave off, so a block that does not read it need not declare it.

Definition at line 200 of file LightConstants.hpp.

◆ waterDepth

glm::vec4 esengine::LightConstants::waterDepth {}

Definition at line 203 of file LightConstants.hpp.

◆ waterRect

glm::vec4 esengine::LightConstants::waterRect {}

Definition at line 202 of file LightConstants.hpp.

◆ waterSun

glm::vec4 esengine::LightConstants::waterSun {}

Definition at line 204 of file LightConstants.hpp.


The documentation for this struct was generated from the following file: