Documentation
    Preparing search index...

    Interface DirectionalLightSource

    What the light collector reads from a directional light node — the structural contract @fourjs/scene's DirectionalLight satisfies (§68).

    interface DirectionalLightSource {
        castShadow?: boolean;
        color: readonly [number, number, number];
        intensity: number;
        isDirectionalLight: true;
        shadow?: DirectionalShadowSource;
        computeShadowMatrix?(out: Matrix4): Matrix4;
        getWorldDirection(out: Vector3): Vector3;
    }
    Index
    castShadow?: boolean

    Whether this light casts shadows (§69; R-18, 2026-08-09). Absent — like every member below — reads as false.

    Optional, and that is the compatibility contract, not laziness: this interface is satisfied structurally, and the doubles @fourjs/render-webgl's unit tests build were written before §69 existed. A required member here would have broken every one of them at compile time, and a host's own minimal light object at run time — while an optional one reads undefined, which collectSceneLights resolves to "does not cast", i.e. exactly the behaviour every scene had before this field.

    color: readonly [number, number, number]

    Straight RGB in 0…1, in §60a's linear-light working space — uploaded to the shader as it stands (the "no colour space attached" deferral this line carried is resolved by R-15, 2026-08-08; an author with a CSS string decodes it with @fourjs/math's srgbToLinearRGB(parseColorRGB(css), out)).

    intensity: number

    Scalar multiplier on the color (§68); dimensionless in this tier.

    isDirectionalLight: true

    The brand collectSceneLights recognises. A literal true, not a method, so the check is one property load per node per frame — exactly ParticleDrawable.isParticleDrawable's design.

    Resolution and bias of this light's shadow map (§69) — the half SceneLights carries through to a backend. @fourjs/scene's DirectionalLightShadow satisfies it; the volume controls it also carries (extent, near, far) are consumed by DirectionalLightSource.computeShadowMatrix and never reach a backend, which is why they are not declared here.

    • Writes the light's world-space shadow view-projection into out and returns it (§69) — see @fourjs/scene's DirectionalLight for the derivation. A light that offers no such method never casts, whatever DirectionalLightSource.castShadow says: the matrix is the shadow.

      Parameters

      Returns Matrix4

    • Writes the world-space unit vector the light travels along into out and returns it. @fourjs/scene's implementation derives it from the node's world −Z axis; a double supplies whatever the test needs.

      Parameters

      Returns Vector3