Skip to content

UWAL / SpotLight

Classes ​

SpotLight ​

A light used to radiate from one point in one direction, along a cone increasing in size further away from the light.

See ​

Primitives / Lights for reference.

Extends ​

Constructors ​

Constructor ​
ts
new SpotLight(
   position?, 
   color?, 
   label?
): SpotLight;
Parameters ​
ParameterTypeDefault valueDescription
position?Float32Array<ArrayBufferLike>undefinedLight position.
color?ColorParamundefinedLight color. Defaults to white.
label?string"SpotLight"Light label.
Returns ​

SpotLight

Overrides ​

PointLight.constructor

Methods ​

LookAt() ​
ts
LookAt(target): Float32Array<ArrayBufferLike>;

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

Parameters ​
ParameterTypeDescription
targetFloat32Array<ArrayBufferLike>Point in 3D space to look at.
Returns ​

Float32Array<ArrayBufferLike>

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

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

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

GPUBuffer

Overrides ​

PointLight.SetRenderPipeline

Accessors ​

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

Float32Array<ArrayBufferLike>

Inner and outer limit of the light. Everything inside the inner limit is fully illuminated, while objects outside the outer limit receive no light. Light intensity between these limits is lerped using a smoothstep function.

Set Signature ​
ts
set Limit(limit): void;
Parameters ​
ParameterTypeDescription
limitFloat32Array<ArrayBufferLike>Light limits.
Returns ​

void

Released under the MIT License.