Log inGet started
Package

ecs.module

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

ecs.Light

Component spec for ecs.Light, which maps to the native Light. One component backs point, directional, ambient, and spot lights, selected by lightType. The constructor ecs.Light{...} builds a value the generic ecs verbs (ecs.insert / ecs.set / ecs.get) apply. color, direction, and face are vec3 composites; the cone angles apply to spot lights.

Fields

  • lightType: string? — "Point" | "Directional" | "Ambient" | "Spot".
  • color: { number }? — {r, g, b}.
  • intensity: number?
  • radius: number?
  • direction: { number }? — {x, y, z}: the direction a directional or distant light travels along. A spot or an area light aims by face.
  • coneInnerDeg: number? — spot cone inner angle (degrees), held to 0..coneOuterDeg: at or past the outer angle the cone is full out to it with a hard edge there.
  • coneOuterDeg: number? — spot cone outer angle (degrees), held to 0..180; nothing past it is lit.
  • face: { number }? — {x, y, z}: the entity-local axis a spot's cone or an area light's rect points along, turned by the entity's world rotation. A row written without one takes {0, 0, -1}, the entity's forward that transform.forward reports.
  • castsShadows: boolean?

Usage

ecs.insert(id, ecs.Light{ lightType = "Point", color = { 1, 1, 1 }, intensity = 5, radius = 10 })