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

One 2D light, std140-packed (six vec4s, 96 bytes, 16-aligned). More...

#include <LightConstants.hpp>

Public Attributes

glm::vec4 posDir {0.0f}
glm::vec4 color {0.0f}
 rgb = colour, a = intensity.
glm::vec4 spot {0.0f}
glm::vec4 shadow {0.0f}
glm::vec4 shadowMap {0.0f, 0.0f, 0.0f, -1.0f}
glm::vec4 falloff {0.0f, 1.0f, 1.0f, -1.0f}

Detailed Description

One 2D light, std140-packed (six vec4s, 96 bytes, 16-aligned).

Every lane is spoken for; each field says which. An Ambient light occupies no slot at all — it folds into LightConstants::ambient.

Definition at line 111 of file LightConstants.hpp.

Member Data Documentation

◆ color

glm::vec4 esengine::GpuLight::color {0.0f}

rgb = colour, a = intensity.

Definition at line 117 of file LightConstants.hpp.

Referenced by esengine::lightReachMask2D(), and esengine::LightStore::markLoopLights().

◆ falloff

glm::vec4 esengine::GpuLight::falloff {0.0f, 1.0f, 1.0f, -1.0f}

How the light ENDS, as opposed to where: x = the radius it holds full strength out to, y = the power its ramp is raised to (1 = linear), z = how much a shadow removes (1 = all), w = its shape-mask channel (-1 = unshaped). Defaults = linear.

Definition at line 132 of file LightConstants.hpp.

◆ posDir

glm::vec4 esengine::GpuLight::posDir {0.0f}

xy = world position (point/spot) or aim direction (directional); z = the type (0 point, 1 directional, 2 spot); w = the falloff radius, or a directional aim's third component — never both, which is what lets a sun aim out of the plane.

Definition at line 115 of file LightConstants.hpp.

Referenced by esengine::lightReachMask2D(), and esengine::LightStore::markLoopLights().

◆ shadow

glm::vec4 esengine::GpuLight::shadow {0.0f}

x = penumbra softness (the source's half-extent in world units; 0 = hard); y = a directional light's shadow march distance (0 = it casts none); z = a positional light's world height, measured against only by real geometry; w = a spot axis' z.

Definition at line 125 of file LightConstants.hpp.

Referenced by esengine::LightStore::markLoopLights().

◆ shadowMap

glm::vec4 esengine::GpuLight::shadowMap {0.0f, 0.0f, 0.0f, -1.0f}

x = first atlas tile, y = tiles owned (0 = no map) in its low bits and the sprite-layer range above (packLightLayerRange); z = the tangent of the angle its source subtends (0 for a light that stands somewhere); w = its 2D mask channel, -1 for none.

Definition at line 128 of file LightConstants.hpp.

◆ spot

glm::vec4 esengine::GpuLight::spot {0.0f}

Spot: xy = the cone axis in the plane, z = cos(inner half angle), w = cos(outer half angle). Directional: x = the atlas tile its cloud shadow is read from, plus one (0 = none; see RenderFrame's cloud shadow tile); the rest zero. Zero for a point light.

Definition at line 121 of file LightConstants.hpp.


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