DirectionalLight

Home

A DirectionalLight is an Urbject that implements the Light interface and shines in a specified direction in 3D space, taking into account Trigon normal vector orientation when calculating intensity.

A DirectionalLight is similar to the way sunlight works on Earth and shines with the same intensity and direction across the entire Scene. However, since there is no light reflection in Urchin, a DirectionalLight will not light any Trigons that face greater than 90 degrees away from the light. To compensate this, consider adding multiple DirectionalLights that face in different directions, or one AmbientLight to the scene to obtain more "natural" lighting.

See also: Urbject, AmbientLight, Light

Constructors

DirectionalLight( ): DirectionalLight Initializes with default attribute values.
DirectionalLight( { direction?: Vector, brightness?: number, color?: Color, state?: number, group?: number, superCopy?: Urbject } ): DirectionalLight Initializes with the given values or default values if not provided. The default values are:

direction new Vector(1, 1, -4) The direction that the light shines everywhere in the Scene. This value is converted into a default Urbject orientation during construction. To modify the direction of an existing DirectionalLight, simply rotate the Urbject's orientation.

See also: Vector, Urbject, Scene
brightness 1.1 The brightness of the light. Any value over 1 is considered "overexposed".
color new Color("WHITE") The color of the light. See also: Color
state Default from Urbject constructor See also: Urbject
group Default from Urbject constructor See also: Urbject
superCopy Default from Urbject constructor See also: Urbject

Variables

Public Variables

brightness: number The brightness of the light. Any value over 1 is considered "overexposed".
color: Color The color of the light. See also: Color

Functions

Public Functions

copy(options?: { shallow: boolean } ): DirectionalLight Returns a copy of the DirectionalLight. If shallow is true, the children of this Urbject will not be included in the copy.
getInstance(camera: Camera): FrameInstance Returns the FrameInstance of the Urbject with this light added. See also: Urbject, FrameInstance
intensityOn(t: Trigon): number Returns the intensity of the light on the given Trigon, taking into account the normal orientation of the Trigon. Any Trigons with a normal vector that faces more than 90 degrees away from the light will not be lit. See also: Trigon

Static Functions

DirectionalLight.copy(l: DirectionalLight, options?: { shallow: boolean } ): DirectionalLight Returns a copy of the DirectionalLight or a new DirectionalLight from an Object with all of the necessary DirectionalLight and Urbject public attributes. If shallow is true, the children of the Urbject will not be included in the copy.
DirectionalLight.getInstance(l: DirectionalLight, camera: Camera): FrameInstance Returns the FrameInstance of the given DirectionalLight with its light added. See also: Urbject, FrameInstance
DirectionalLight.intensityOn(l: DirectionalLight, t: Trigon): number Returns the intensity of the light on the given Trigon, taking into account the normal orientation of the Trigon. Any Trigons with a normal vector that faces more than 90 degrees away from the light will not be lit. See also: Trigon

Home

Copyright © 2020 Trevor Richard