-
Notifications
You must be signed in to change notification settings - Fork 12
/
RectAreaLight2.ts
83 lines (70 loc) · 2.6 KB
/
RectAreaLight2.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import {Color, ColorRepresentation, RectAreaLight} from 'three'
import {ILight, ILightEvent} from './ILight'
import {iLightCommons} from '../object/iLightCommons'
import {IObject3D} from '../IObject'
import {uiColor, uiNumber, UiObjectConfig, uiPanelContainer, uiSlider, uiToggle} from 'uiconfig.js'
import {onChange3} from 'ts-browser-helpers'
@uiPanelContainer('RectArea Light')
export class RectAreaLight2 extends RectAreaLight implements ILight<undefined> {
assetType = 'light' as const
setDirty = iLightCommons.setDirty
refreshUi = iLightCommons.refreshUi
uiConfig: UiObjectConfig
readonly isRectAreaLight2 = true
@uiToggle('Enabled')
@onChange3('setDirty')
visible: boolean
@uiColor('Color', (that: RectAreaLight2)=>({onChange: ()=>that.setDirty()}))
color: Color
@uiSlider('Intensity', [0, 30], 0.01)
@onChange3('setDirty')
intensity: number
@uiNumber('Width')
@onChange3('setDirty')
width: number
@uiNumber('Height')
@onChange3('setDirty')
height: number
@uiNumber('Power')
@onChange3('setDirty')
power: number
constructor(color?: ColorRepresentation, intensity?: number, width?: number, height?: number) {
super(color, intensity, width, height)
iLightCommons.upgradeLight.call(this)
}
autoScale() {
console.warn('AutoScale not supported on Lights')
return this
}
autoCenter() {
console.warn('AutoCenter not supported on Lights')
return this
}
/**
* @deprecated use `this` instead
*/
get lightObject(): this {
return this
}
/**
* @deprecated use `this` instead
*/
get modelObject(): this {
return this
}
// region inherited type fixes
// re-declaring from IObject3D because: https://github.com/microsoft/TypeScript/issues/16936
traverse: (callback: (object: IObject3D) => void) => void
traverseVisible: (callback: (object: IObject3D) => void) => void
traverseAncestors: (callback: (object: IObject3D) => void) => void
getObjectById: <T extends IObject3D = IObject3D>(id: number) => T | undefined
getObjectByName: <T extends IObject3D = IObject3D>(name: string) => T | undefined
getObjectByProperty: <T extends IObject3D = IObject3D>(name: string, value: string) => T | undefined
copy: (source: RectAreaLight|IObject3D, recursive?: boolean, ...args: any[]) => this
clone: (recursive?: boolean) => this
remove: (...object: IObject3D[]) => this
dispatchEvent: (event: ILightEvent) => void
parent: null
children: IObject3D[]
// endregion
}