Class LightDirectional

A directional light source, typically global with the context having only a single instance Having multiple directional lights is not supported

Constructors

Properties

_direction: XYZ
_shadowMapFB?: FramebufferInfo
_shadowMapProgram?: ProgramInfo
_shadowMapTex?: WebGLTexture
_shadowOptions?: ShadowOptions
ambient: RGB

Ambient colour of the light. Default: [0, 0, 0]

colour: RGB

Colour of the light, used for both diffuse and specular. Default: [0, 0, 0]

enabled: boolean

Is this light enabled. Default: true

Accessors

  • get direction(): XYZ
  • Get the direction of the light

    Returns XYZ

  • set direction(direction): void
  • Set the direction of the light ensuring it is normalized

    Parameters

    • direction: XYZ

      Direction vector

    Returns void

  • get shadowMapFrameBufffer(): undefined | FramebufferInfo
  • Get the shadow map framebuffer, will be undefined if shadows are not enabled

    Returns undefined | FramebufferInfo

  • get shadowMapProgram(): undefined | ProgramInfo
  • Get the shadow map program, will be undefined if shadows are not enabled

    Returns undefined | ProgramInfo

  • get shadowMapTexture(): undefined | WebGLTexture
  • Get the shadow map texture, will be undefined if shadows are not enabled

    Returns undefined | WebGLTexture

  • get shadowsEnabled(): boolean
  • Are shadows enabled for this light?

    Returns boolean

Methods

  • Enable shadows for this light, this will create a shadow map texture and framebuffer There is no way to disabled shadows once enabled

    Parameters

    • Optional options: ShadowOptions

      A set of ShadowOptions to configure how shadows are calculated

    Returns void

  • Get a virtual camera that can be used to render a shadow map for this light

    Parameters

    • viewCam: Camera

      The main camera used to view the scene, needed to get a good shadow view

    Returns undefined | Camera

  • Get the forward view matrix for the virtual camera used to render the shadow map. Returns undefined if shadows are not enabled

    Parameters

    • viewCam: Camera

      The main camera used to view the scene, needed to get a good shadow view

    Returns undefined | mat4

  • Convenience method allows setting the direction as a point relative to the world origin Values are always converted to a normalized unit direction vector

    Parameters

    • x: number

      X position

    • y: number

      Y position

    • z: number

      Z position

    Returns void

Generated using TypeDoc