A directional light source within a View.

  • Illuminates all objects equally from a given direction.
  • Has an emission direction vector in DirLight.dir, but no position.
  • Defined in either World or View coordinate space. When in World-space, DirLight.dir is relative to the World coordinate system, and will appear to move as the Camera moves. When in View-space, DirLight.dir is relative to the View coordinate system, and will behave as if fixed to the viewer's head.
  • AmbientLights, DirLights and PointLights are registered by their Component.id on View.lights.

Constructors

Properties

Accessors

Methods

Constructors

  • Parameters

    • view: View

      View that owns this DirLight. When destroyed, the View will destroy this DirLight as well.

    • options: DirLightParams = {}

      The DirLight configuration

      Parameters for a DirLight.

      • Optionalcolor?: Vec3

        RGB color of the DirLight.

        Range is [0..1, 0..1, 0..1].

        Default value is [1.0, 1.0, 1.0].

      • Optionaldir?: Vec3

        3D direction of the DirLight.

        Range is [-1..1, -1..1, -1..1].

        Default value is [1.0, 1.0, 1.0].

      • Optionalid?: string

        Optional ID, generated automatically when omitted.

      • Optionalintensity?: number

        Intensity of the DirLight.

        Value is in range [0..1].

        Default value is 1.0.

      • Optionalspace?: string

        3D coordinate space in which the DirLight is oriented.

        Accepted value is "world" or "view".

        Default is "world".

    Returns DirLight

Properties

id: string

ID of this DirLight, unique within the View.

view: View

The View to which this DirLight belongs.

Accessors

  • get dir(): Vec3

    Gets the direction in which the DirLight is shining.

    Default value is [1.0, 1.0, 1.0].

    Returns Vec3

    The direction vector.

  • set dir(value: Vec3): void

    Sets the direction in which the DirLight is shining.

    Default value is [1.0, 1.0, 1.0].

    Parameters

    • value: Vec3

      The direction vector.

    Returns void

  • get intensity(): number

    Gets the intensity of this DirLight.

    Default value is 1.0 for maximum intensity.

    Returns number

    The DirLight's intensity.

  • set intensity(intensity: number): void

    Sets the intensity of this DirLight.

    Default intensity is 1.0 for maximum intensity.

    Parameters

    • intensity: number

      The DirLight's intensity

    Returns void

Methods