Skip to content

Class: SpotLight

Spotlight source. Light shines from a point in one direction, and as the light shines further away, the size of the light cone gradually increases. Similar to a desk lamp, chandelier, or flashlight, this light source can produce shadows.

Hierarchy

  • LightBase

    SpotLight

Constructors

Properties

Accessors

Methods

Constructors

constructor

new SpotLight(): SpotLight

Returns

SpotLight

Overrides

LightBase.constructor

Defined in

src/components/lights/SpotLight.ts:18

Properties

object3D

object3D: Object3D = null

owner object3D

Inherited from

LightBase.object3D

Defined in

src/components/ComponentBase.ts:17


isDestroyed

Optional isDestroyed: boolean

Inherited from

LightBase.isDestroyed

Defined in

src/components/ComponentBase.ts:38


name

name: string

light name

Inherited from

LightBase.name

Defined in

src/components/lights/LightBase.ts:22


size

size: number = 1

light size

Inherited from

LightBase.size

Defined in

src/components/lights/LightBase.ts:26


lightData

lightData: LightData

light source data

Inherited from

LightBase.lightData

Defined in

src/components/lights/LightBase.ts:31


dirFix

dirFix: number = 1

fix light direction

Inherited from

LightBase.dirFix

Defined in

src/components/lights/LightBase.ts:36


bindOnChange

bindOnChange: () => void

Callback function when binding changes

Type declaration

▸ (): void

Callback function when binding changes

Returns

void

Inherited from

LightBase.bindOnChange

Defined in

src/components/lights/LightBase.ts:41


needUpdateShadow

needUpdateShadow: boolean = true

Inherited from

LightBase.needUpdateShadow

Defined in

src/components/lights/LightBase.ts:43


realTimeShadow

realTimeShadow: boolean = true

Whether to enable real-time rendering of shadows

Inherited from

LightBase.realTimeShadow

Defined in

src/components/lights/LightBase.ts:48

Accessors

eventDispatcher

get eventDispatcher(): CEventDispatcher

Returns

CEventDispatcher

Inherited from

LightBase.eventDispatcher

Defined in

src/components/ComponentBase.ts:23

set eventDispatcher(value): void

Parameters

NameType
valueCEventDispatcher

Returns

void

Inherited from

LightBase.eventDispatcher

Defined in

src/components/ComponentBase.ts:28


isStart

get isStart(): boolean

Returns

boolean

Inherited from

LightBase.isStart

Defined in

src/components/ComponentBase.ts:40


transform

get transform(): Transform

Return the Transform component attached to the Object3D.

Returns

Transform

Inherited from

LightBase.transform

Defined in

src/components/ComponentBase.ts:47


enable

get enable(): boolean

Enable/disable components. The enabled components can be updated, while the disabled components cannot be updated.

Returns

boolean

Inherited from

LightBase.enable

Defined in

src/components/ComponentBase.ts:68

set enable(value): void

Enable/disable components. The enabled components can be updated, while the disabled components cannot be updated.

Parameters

NameType
valueboolean

Returns

void

Inherited from

LightBase.enable

Defined in

src/components/ComponentBase.ts:54


iesProfiles

set iesProfiles(iesProfiles): void

Parameters

NameType
iesProfilesIESProfiles

Returns

void

Inherited from

LightBase.iesProfiles

Defined in

src/components/lights/LightBase.ts:125


iesProfile

get iesProfile(): IESProfiles

Returns

IESProfiles

Inherited from

LightBase.iesProfile

Defined in

src/components/lights/LightBase.ts:132


r

get r(): number

Get the red component of the lighting color

Returns

number

Inherited from

LightBase.r

Defined in

src/components/lights/LightBase.ts:139

set r(value): void

Set the red component of the lighting color

Parameters

NameType
valuenumber

Returns

void

Inherited from

LightBase.r

Defined in

src/components/lights/LightBase.ts:146


g

get g(): number

Get the green component of the lighting color

Returns

number

Inherited from

LightBase.g

Defined in

src/components/lights/LightBase.ts:154

set g(value): void

Set the green component of the lighting color

Parameters

NameType
valuenumber

Returns

void

Inherited from

LightBase.g

Defined in

src/components/lights/LightBase.ts:161


b

get b(): number

Get the blue component of the lighting color

Returns

number

Inherited from

LightBase.b

Defined in

src/components/lights/LightBase.ts:169

set b(value): void

Set the blue component of the lighting color

Parameters

NameType
valuenumber

Returns

void

Inherited from

LightBase.b

Defined in

src/components/lights/LightBase.ts:175


lightColor

get lightColor(): Color

Get light source color

Returns

Color

Color

Inherited from

LightBase.lightColor

Defined in

src/components/lights/LightBase.ts:183

set lightColor(value): void

Set light source color

Parameters

NameType
valueColor

Returns

void

Inherited from

LightBase.lightColor

Defined in

src/components/lights/LightBase.ts:190


color

get color(): Color

Get light source color

Returns

Color

Color

Inherited from

LightBase.color

Defined in

src/components/lights/LightBase.ts:199

set color(value): void

Set light source color

Parameters

NameType
valueColor

Returns

void

Inherited from

LightBase.color

Defined in

src/components/lights/LightBase.ts:207


intensity

get intensity(): number

Get Illumination intensity of light source

Returns

number

number

Inherited from

LightBase.intensity

Defined in

src/components/lights/LightBase.ts:216

set intensity(value): void

Set Illumination intensity of light source

Parameters

NameType
valuenumber

Returns

void

Inherited from

LightBase.intensity

Defined in

src/components/lights/LightBase.ts:224


castShadow

get castShadow(): boolean

Returns

boolean

Inherited from

LightBase.castShadow

Defined in

src/components/lights/LightBase.ts:240

set castShadow(value): void

Cast Light Shadow

Parameters

NameType
valueboolean

Returns

void

Inherited from

LightBase.castShadow

Defined in

src/components/lights/LightBase.ts:233


shadowIndex

get shadowIndex(): number

get shadow index at shadow map list

Returns

number

Inherited from

LightBase.shadowIndex

Defined in

src/components/lights/LightBase.ts:247


castGI

get castGI(): boolean

get gi is enable

Returns

boolean

boolean

Inherited from

LightBase.castGI

Defined in

src/components/lights/LightBase.ts:256

set castGI(value): void

set gi is enable

Parameters

NameType
valueboolean

Returns

void

Inherited from

LightBase.castGI

Defined in

src/components/lights/LightBase.ts:263


direction

get direction(): Vector3

light source direction

Returns

Vector3

Vector3

Inherited from

LightBase.direction

Defined in

src/components/lights/LightBase.ts:277


innerAngle

get innerAngle(): number

Get the inner cone angle of the light source (as a percentage relative to the outer cone angle)

Returns

number

Defined in

src/components/lights/SpotLight.ts:35

set innerAngle(value): void

Set the inner cone angle of the light source (as a percentage relative to the outer cone angle)

Parameters

NameType
valuenumber

Returns

void

Defined in

src/components/lights/SpotLight.ts:44


outerAngle

get outerAngle(): number

Get the outer cone angle of the light source

Returns

number

number

Defined in

src/components/lights/SpotLight.ts:53

set outerAngle(value): void

Set the outer cone angle of the light source

Parameters

NameType
valuenumber

Returns

void

Defined in

src/components/lights/SpotLight.ts:61


radius

get radius(): number

Get the radius of the light source

Returns

number

number

Defined in

src/components/lights/SpotLight.ts:71

set radius(value): void

Set the radius of the light source

Parameters

NameType
valuenumber

Returns

void

Defined in

src/components/lights/SpotLight.ts:80


range

get range(): number

Get the range of the light source

Returns

number

Defined in

src/components/lights/SpotLight.ts:88

set range(value): void

Set the range of the light source

Parameters

NameType
valuenumber

Returns

void

Defined in

src/components/lights/SpotLight.ts:97


at

get at(): number

Get the illumination distance of the light source

Returns

number

Defined in

src/components/lights/SpotLight.ts:105

set at(value): void

Set the illumination distance of the light source

Parameters

NameType
valuenumber

Returns

void

Defined in

src/components/lights/SpotLight.ts:112

Methods

stop

stop(): void

Returns

void

Inherited from

LightBase.stop

Defined in

src/components/ComponentBase.ts:114


onLateUpdate

onLateUpdate(view?): any

Parameters

NameType
view?View3D

Returns

any

Inherited from

LightBase.onLateUpdate

Defined in

src/components/ComponentBase.ts:118


onBeforeUpdate

onBeforeUpdate(view?): any

Parameters

NameType
view?View3D

Returns

any

Inherited from

LightBase.onBeforeUpdate

Defined in

src/components/ComponentBase.ts:119


onCompute

onCompute(view?, command?): any

Parameters

NameType
view?View3D
command?GPUCommandEncoder

Returns

any

Inherited from

LightBase.onCompute

Defined in

src/components/ComponentBase.ts:120


onParentChange

onParentChange(lastParent?, currentParent?): any

Parameters

NameType
lastParent?Object3D
currentParent?Object3D

Returns

any

Inherited from

LightBase.onParentChange

Defined in

src/components/ComponentBase.ts:122


onAddChild

onAddChild(child): any

Parameters

NameType
childObject3D

Returns

any

Inherited from

LightBase.onAddChild

Defined in

src/components/ComponentBase.ts:123


onRemoveChild

onRemoveChild(child): any

Parameters

NameType
childObject3D

Returns

any

Inherited from

LightBase.onRemoveChild

Defined in

src/components/ComponentBase.ts:124


cloneTo

cloneTo(obj): void

clone component data to target object3D

Parameters

NameTypeDescription
objObject3Dtarget object3D

Returns

void

Inherited from

LightBase.cloneTo

Defined in

src/components/ComponentBase.ts:131


copyComponent

copyComponent(from): this

Parameters

NameType
fromthis

Returns

this

Inherited from

LightBase.copyComponent

Defined in

src/components/ComponentBase.ts:133


beforeDestroy

beforeDestroy(force?): void

before release this component, object refrences are not be set null now.

Parameters

NameType
force?boolean

Returns

void

Inherited from

LightBase.beforeDestroy

Defined in

src/components/ComponentBase.ts:200


onEnable

onEnable(): void

Returns

void

Inherited from

LightBase.onEnable

Defined in

src/components/lights/LightBase.ts:114


onDisable

onDisable(): void

Returns

void

Inherited from

LightBase.onDisable

Defined in

src/components/lights/LightBase.ts:119


destroy

destroy(force?): void

Parameters

NameType
force?boolean

Returns

void

Inherited from

LightBase.destroy

Defined in

src/components/lights/LightBase.ts:281


init

init(): void

Returns

void

Overrides

LightBase.init

Defined in

src/components/lights/SpotLight.ts:22


start

start(): void

Returns

void

Overrides

LightBase.start

Defined in

src/components/lights/SpotLight.ts:117


onUpdate

onUpdate(): void

Returns

void

Overrides

LightBase.onUpdate

Defined in

src/components/lights/SpotLight.ts:122


onGraphic

onGraphic(view): void

Parameters

NameType
viewView3D

Returns

void

Overrides

LightBase.onGraphic

Defined in

src/components/lights/SpotLight.ts:126


debug

debug(): void

enable GUI debug

Returns

void

Defined in

src/components/lights/SpotLight.ts:158


debugDraw

debugDraw(show): void

Parameters

NameType
showboolean

Returns

void

Defined in

src/components/lights/SpotLight.ts:161

Released under the MIT License