Create a light object and add it to the engine object list
pos Vector2World space position
radius numberTotal extent of the light in world units
color Color optionalColor of the light; alpha modulates intensity
fadeRange number optionalWidth of the soft edge in world units (defaults to radius)
new Light(vec2(5, 5), 4, rgb(1, 0.5, 0)); // orange light, full soft blob
new Light(vec2(0, 0), 8, rgb(1, 1, 1), 2); // white core with 2-unit soft halo
const flashlight = new Light(vec2(), 10); // a flashlight looking right, its beam 60 degrees across
flashlight.coneAngle = PI/6;
flashlight.angle = PI/2;
Makes it a cone, like a flashlight or headlight: the angle in radians from its up out
to the edge of the cone, so the beam is twice this across; it looks along getUp(), turned by its angle and
by what it is attached to; 0 for a light that shines every way
How much of the cone is its fading edge: 0 a hard edge, .2 by default, the outer
fifth, 1 fading all the way from the middle of the beam
Width of the soft edge in world units
A gel, a picture the light shines through, called a cookie in
some engines: stretched across the light's square, twice its radius, its top the way the light looks,
turned with it, and multiplied into its color, so one light can be a car's headlights and tail lights;
a TileInfo's own tile, or a whole TextureInfo; shadows still fall through it
Size across of a soft hazy glow drawn over the light, like a lamp at night, 0 for
none; it is added over the lit scene, in front of everything there
How fast the glow fades from its middle: 1 by default, .5 a wide haze, 2 a tight
bright core
Total extent of the light in world units
Radius around the light where casters are left out of its shadow, so the lamp
or torch that holds it, or the player carrying it, does not block it; it has to reach past that object's
corners, about half its diagonal and a little more, or dark rays run out from them
Lights are invisible in the main render pass — they only contribute
to the lightmap via renderLight().
Draw this light's glow, soft and round, its glow size across and in its color, added over the lit scene;
called by LightSystemPlugin after the lightmap is applied
Draw this light's falloff blob into the lightmap.
Called by LightSystemPlugin during its render pass. No-op when the
plugin or WebGL is unavailable.