Taos API Reference
    Preparing search index...

    Class RenderSpotLight

    Spot light parameters uploaded as one element of the spot-light storage buffer.

    innerAngle/outerAngle describe the cosine-falloff cone; the view-projection matrix (lightViewProj) and a slice of the shared 2D shadow array are consumed when castShadows is true.

    The view-projection matrix is lazily computed from position, direction, outerAngle, and range via computeLightViewProj. A dirty flag avoids redundant recomputation: after mutating those fields in-place, call markDirty before the next access.

    Index

    Constructors

    • Parameters

      • init: {
            position: Vec3;
            range: number;
            direction: Vec3;
            innerAngle: number;
            color: Vec3;
            outerAngle: number;
            intensity: number;
            castShadows?: boolean;
            shadowMap?: GPUTextureView;
        }

      Returns RenderSpotLight

    Properties

    position: Vec3
    range: number
    direction: Vec3
    innerAngle: number
    color: Vec3
    outerAngle: number
    intensity: number
    castShadows?: boolean
    shadowMap?: GPUTextureView

    Accessors

    • get lightViewProj(): Mat4

      The perspective view-projection derived from the light's position, direction, outerAngle, and range. Lazily recomputed on first access after construction or after markDirty is called.

      Returns Mat4

    Methods

    • Marks the cached view-projection as stale. Call after mutating position, direction, outerAngle, or range in-place.

      Returns void

    • Returns the cached view-projection matrix, recomputing it lazily only when marked dirty. Safe to call every frame — the matrix is recalculated at most once between markDirty calls.

      Parameters

      • near: number = 0.1

        Near plane for the perspective frustum (default 0.1).

      Returns Mat4