Skip to content

UWAL / DirectionalLight

Classes

DirectionalLight

A light used to radiate in a specific direction. It is positioned infinitely far away, and its rays are parallel.

See

Primitives / Lights for reference.

Extends

Constructors

Constructor
ts
new DirectionalLight(
   direction?, 
   color?, 
   label?): DirectionalLight;
Parameters
ParameterTypeDefault valueDescription
direction?Float32Array<ArrayBufferLike>undefinedLight direction. Defaults to [0, -1, 0].
color?ColorParamundefinedLight color. Defaults to white.
label?string"DirectionalLight"Light label.
Returns

DirectionalLight

Overrides

Light.constructor

Methods

SetRenderPipeline()
ts
SetRenderPipeline(Pipeline, uniformName?): GPUBuffer;

Create and update an internal uniform buffer of this light's color and intensity values.

Parameters
ParameterTypeDefault valueDescription
PipelineRenderPipelineInstanceundefinedPipeline using this light.
uniformName?string"DirectionalLight"Uniform buffer name.
Returns

GPUBuffer

Overrides

Light.SetRenderPipeline

SetDirectionFrom()
ts
SetDirectionFrom(pitch, yaw): void;

Compute the light direction from angles in radians.

Parameters
ParameterTypeDescription
pitchnumberLight elevation.
yawnumberCompass direction.
Returns

void

LookAt()
ts
LookAt(target, position): void;

Set the light direction to point at the specified point in 3D space.

Parameters
ParameterTypeDescription
targetFloat32Array<ArrayBufferLike>Point in 3D space to look at.
positionFloat32Array<ArrayBufferLike>Approximate light position.
Returns

void

Accessors

Direction
Get Signature
ts
get Direction(): Float32Array<ArrayBufferLike>;
Returns

Float32Array<ArrayBufferLike>

The direction of the light.

Set Signature
ts
set Direction(direction): void;
Parameters
ParameterTypeDescription
directionFloat32Array<ArrayBufferLike>Light direction.
Returns

void

Released under the MIT License.