@zephyr3d/scene 0.9.17 → 0.9.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animation/joint_dynamics/collision.js +8 -6
- package/dist/animation/joint_dynamics/collision.js.map +1 -1
- package/dist/animation/morphtargetgrouptrack.js +11 -3
- package/dist/animation/morphtargetgrouptrack.js.map +1 -1
- package/dist/app/scriptregistry.js +124 -6
- package/dist/app/scriptregistry.js.map +1 -1
- package/dist/index.d.ts +270 -7
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/material/mixins/lightmodel/pbrblueprintmixin.js +11 -5
- package/dist/material/mixins/lightmodel/pbrblueprintmixin.js.map +1 -1
- package/dist/material/mtoon.js +20 -2
- package/dist/material/mtoon.js.map +1 -1
- package/dist/material/shader/helper.js +21 -8
- package/dist/material/shader/helper.js.map +1 -1
- package/dist/material/skin.js +4 -6
- package/dist/material/skin.js.map +1 -1
- package/dist/material/water.js +1 -1
- package/dist/material/water.js.map +1 -1
- package/dist/posteffect/bloom.js +177 -29
- package/dist/posteffect/bloom.js.map +1 -1
- package/dist/posteffect/compositor.js +111 -204
- package/dist/posteffect/compositor.js.map +1 -1
- package/dist/posteffect/motionblur.js +3 -0
- package/dist/posteffect/motionblur.js.map +1 -1
- package/dist/posteffect/posteffect.js +79 -0
- package/dist/posteffect/posteffect.js.map +1 -1
- package/dist/posteffect/skinsss.js +10 -10
- package/dist/posteffect/skinsss.js.map +1 -1
- package/dist/posteffect/ssr.js +247 -16
- package/dist/posteffect/ssr.js.map +1 -1
- package/dist/posteffect/taa.js +121 -19
- package/dist/posteffect/taa.js.map +1 -1
- package/dist/posteffect/tonemap.js +6 -6
- package/dist/posteffect/tonemap.js.map +1 -1
- package/dist/render/abuffer_oit.js +2 -1
- package/dist/render/abuffer_oit.js.map +1 -1
- package/dist/render/envlight.js +6 -3
- package/dist/render/envlight.js.map +1 -1
- package/dist/render/hzb.js +11 -4
- package/dist/render/hzb.js.map +1 -1
- package/dist/render/lightpass.js +7 -15
- package/dist/render/lightpass.js.map +1 -1
- package/dist/render/renderer.js +4 -3
- package/dist/render/renderer.js.map +1 -1
- package/dist/render/rendergraph/blackboard.js +78 -0
- package/dist/render/rendergraph/blackboard.js.map +1 -0
- package/dist/render/rendergraph/executor.js +41 -11
- package/dist/render/rendergraph/executor.js.map +1 -1
- package/dist/render/rendergraph/forward_plus_builder.js +495 -201
- package/dist/render/rendergraph/forward_plus_builder.js.map +1 -1
- package/dist/render/rendergraph/rendergraph.js +29 -0
- package/dist/render/rendergraph/rendergraph.js.map +1 -1
- package/dist/render/rendergraph/types.js.map +1 -1
- package/dist/scene/light.js +146 -146
- package/dist/scene/light.js.map +1 -1
- package/dist/shaders/ssr.js +52 -21
- package/dist/shaders/ssr.js.map +1 -1
- package/dist/shadow/shadowmapper.js +95 -95
- package/dist/shadow/shadowmapper.js.map +1 -1
- package/dist/utility/misc.js +10 -1
- package/dist/utility/misc.js.map +1 -1
- package/dist/utility/serialization/manager.js +2 -1
- package/dist/utility/serialization/manager.js.map +1 -1
- package/dist/utility/serialization/scene/animation.js +36 -2
- package/dist/utility/serialization/scene/animation.js.map +1 -1
- package/dist/utility/serialization/scene/light.js.map +1 -1
- package/package.json +2 -2
package/dist/scene/light.js
CHANGED
|
@@ -4,9 +4,9 @@ import { BoundingBox } from '../utility/bounding_volume.js';
|
|
|
4
4
|
import { ShadowMapper } from '../shadow/shadowmapper.js';
|
|
5
5
|
import { LIGHT_TYPE_DIRECTIONAL, LIGHT_TYPE_POINT, LIGHT_TYPE_SPOT, LIGHT_TYPE_RECT } from '../values.js';
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* Base class for any kind of light node
|
|
9
|
-
* @public
|
|
7
|
+
/**
|
|
8
|
+
* Base class for any kind of light node
|
|
9
|
+
* @public
|
|
10
10
|
*/ class BaseLight extends GraphNode {
|
|
11
11
|
/** @internal */ _type;
|
|
12
12
|
/** @internal */ _intensity;
|
|
@@ -14,10 +14,10 @@ import { LIGHT_TYPE_DIRECTIONAL, LIGHT_TYPE_POINT, LIGHT_TYPE_SPOT, LIGHT_TYPE_R
|
|
|
14
14
|
/** @internal */ _directionCutoff;
|
|
15
15
|
/** @internal */ _diffuseIntensity;
|
|
16
16
|
/** @internal */ _extraParams;
|
|
17
|
-
/**
|
|
18
|
-
* Creates a light node
|
|
19
|
-
* @param scene - The scene to which the light node belongs
|
|
20
|
-
* @param type - Type of the light node
|
|
17
|
+
/**
|
|
18
|
+
* Creates a light node
|
|
19
|
+
* @param scene - The scene to which the light node belongs
|
|
20
|
+
* @param type - Type of the light node
|
|
21
21
|
*/ constructor(scene, type){
|
|
22
22
|
super(scene);
|
|
23
23
|
this._intensity = 1;
|
|
@@ -36,66 +36,66 @@ import { LIGHT_TYPE_DIRECTIONAL, LIGHT_TYPE_POINT, LIGHT_TYPE_SPOT, LIGHT_TYPE_R
|
|
|
36
36
|
set intensity(val) {
|
|
37
37
|
this.setIntensity(val);
|
|
38
38
|
}
|
|
39
|
-
/**
|
|
40
|
-
* Position and range of the light
|
|
41
|
-
*
|
|
42
|
-
* @remarks
|
|
43
|
-
* Gets the position in world space of the light.
|
|
44
|
-
* Light range is encoded into the W component.
|
|
39
|
+
/**
|
|
40
|
+
* Position and range of the light
|
|
41
|
+
*
|
|
42
|
+
* @remarks
|
|
43
|
+
* Gets the position in world space of the light.
|
|
44
|
+
* Light range is encoded into the W component.
|
|
45
45
|
*/ get positionAndRange() {
|
|
46
46
|
if (!this._positionRange) {
|
|
47
47
|
this.computeUniforms();
|
|
48
48
|
}
|
|
49
49
|
return this._positionRange;
|
|
50
50
|
}
|
|
51
|
-
/**
|
|
52
|
-
* Direction and cutoff of the light
|
|
53
|
-
*
|
|
54
|
-
* @remarks
|
|
55
|
-
* Gets the direction in world space of the light
|
|
56
|
-
* Light cutoff (for spot light only) is encoded into the W component.
|
|
51
|
+
/**
|
|
52
|
+
* Direction and cutoff of the light
|
|
53
|
+
*
|
|
54
|
+
* @remarks
|
|
55
|
+
* Gets the direction in world space of the light
|
|
56
|
+
* Light cutoff (for spot light only) is encoded into the W component.
|
|
57
57
|
*/ get directionAndCutoff() {
|
|
58
58
|
if (!this._directionCutoff) {
|
|
59
59
|
this.computeUniforms();
|
|
60
60
|
}
|
|
61
61
|
return this._directionCutoff;
|
|
62
62
|
}
|
|
63
|
-
/**
|
|
64
|
-
* Color and intensity of the light
|
|
65
|
-
*
|
|
66
|
-
* @remarks
|
|
67
|
-
* Gets the color of the light.
|
|
68
|
-
* Light intensity is encoded into the W component.
|
|
63
|
+
/**
|
|
64
|
+
* Color and intensity of the light
|
|
65
|
+
*
|
|
66
|
+
* @remarks
|
|
67
|
+
* Gets the color of the light.
|
|
68
|
+
* Light intensity is encoded into the W component.
|
|
69
69
|
*/ get diffuseAndIntensity() {
|
|
70
70
|
if (!this._diffuseIntensity) {
|
|
71
71
|
this.computeUniforms();
|
|
72
72
|
}
|
|
73
73
|
return this._diffuseIntensity;
|
|
74
74
|
}
|
|
75
|
-
/**
|
|
76
|
-
* Extra parameters of the light
|
|
77
|
-
*
|
|
78
|
-
* @remarks
|
|
79
|
-
* Custom data for advanced light types.
|
|
75
|
+
/**
|
|
76
|
+
* Extra parameters of the light
|
|
77
|
+
*
|
|
78
|
+
* @remarks
|
|
79
|
+
* Custom data for advanced light types.
|
|
80
80
|
*/ get extraParams() {
|
|
81
81
|
if (!this._extraParams) {
|
|
82
82
|
this.computeUniforms();
|
|
83
83
|
}
|
|
84
84
|
return this._extraParams;
|
|
85
85
|
}
|
|
86
|
-
/**
|
|
87
|
-
* View matrix of the light
|
|
88
|
-
*
|
|
89
|
-
* @remarks
|
|
90
|
-
* The view matrix of the light is used to transform a point
|
|
91
|
-
* from the world space to the light space.
|
|
86
|
+
/**
|
|
87
|
+
* View matrix of the light
|
|
88
|
+
*
|
|
89
|
+
* @remarks
|
|
90
|
+
* The view matrix of the light is used to transform a point
|
|
91
|
+
* from the world space to the light space.
|
|
92
92
|
*/ get viewMatrix() {
|
|
93
93
|
return this.invWorldMatrix;
|
|
94
94
|
}
|
|
95
|
-
/**
|
|
96
|
-
* Sets the intensity of the light
|
|
97
|
-
* @param val - Intensity of the light
|
|
98
|
-
* @returns self
|
|
95
|
+
/**
|
|
96
|
+
* Sets the intensity of the light
|
|
97
|
+
* @param val - Intensity of the light
|
|
98
|
+
* @returns self
|
|
99
99
|
*/ setIntensity(val) {
|
|
100
100
|
if (this._intensity !== val) {
|
|
101
101
|
this._intensity = val;
|
|
@@ -128,26 +128,26 @@ import { LIGHT_TYPE_DIRECTIONAL, LIGHT_TYPE_POINT, LIGHT_TYPE_SPOT, LIGHT_TYPE_R
|
|
|
128
128
|
return false;
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
/*
|
|
132
|
-
export abstract class AmbientLight extends BaseLight {
|
|
133
|
-
constructor(scene: Scene, type: number) {
|
|
134
|
-
super(scene, type);
|
|
135
|
-
}
|
|
136
|
-
isAmbientLight(): this is AmbientLight {
|
|
137
|
-
return true;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
*/ /**
|
|
141
|
-
* Base class for any kind of puncual light
|
|
142
|
-
* @public
|
|
131
|
+
/*
|
|
132
|
+
export abstract class AmbientLight extends BaseLight {
|
|
133
|
+
constructor(scene: Scene, type: number) {
|
|
134
|
+
super(scene, type);
|
|
135
|
+
}
|
|
136
|
+
isAmbientLight(): this is AmbientLight {
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
*/ /**
|
|
141
|
+
* Base class for any kind of puncual light
|
|
142
|
+
* @public
|
|
143
143
|
*/ class PunctualLight extends BaseLight {
|
|
144
144
|
/** @internal */ _color;
|
|
145
145
|
/** @internal */ _castShadow;
|
|
146
146
|
/** @internal */ _shadowMapper;
|
|
147
|
-
/**
|
|
148
|
-
* Creates an instance of punctual light
|
|
149
|
-
* @param scene - The scene to which the punctual light belongs
|
|
150
|
-
* @param type - The light type
|
|
147
|
+
/**
|
|
148
|
+
* Creates an instance of punctual light
|
|
149
|
+
* @param scene - The scene to which the punctual light belongs
|
|
150
|
+
* @param type - The light type
|
|
151
151
|
*/ constructor(scene, type){
|
|
152
152
|
super(scene, type);
|
|
153
153
|
this.ensurePunctualState();
|
|
@@ -170,10 +170,10 @@ export abstract class AmbientLight extends BaseLight {
|
|
|
170
170
|
set color(color) {
|
|
171
171
|
this.setColor(color);
|
|
172
172
|
}
|
|
173
|
-
/**
|
|
174
|
-
* Sets color of the light
|
|
175
|
-
* @param color - The color to set
|
|
176
|
-
* @returns self
|
|
173
|
+
/**
|
|
174
|
+
* Sets color of the light
|
|
175
|
+
* @param color - The color to set
|
|
176
|
+
* @returns self
|
|
177
177
|
*/ setColor(color) {
|
|
178
178
|
this.ensurePunctualState();
|
|
179
179
|
this._color.set(color);
|
|
@@ -187,10 +187,10 @@ export abstract class AmbientLight extends BaseLight {
|
|
|
187
187
|
set castShadow(b) {
|
|
188
188
|
this.setCastShadow(b);
|
|
189
189
|
}
|
|
190
|
-
/**
|
|
191
|
-
* Sets whether this light casts shadows
|
|
192
|
-
* @param b - true if the light casts shadows
|
|
193
|
-
* @returns self
|
|
190
|
+
/**
|
|
191
|
+
* Sets whether this light casts shadows
|
|
192
|
+
* @param b - true if the light casts shadows
|
|
193
|
+
* @returns self
|
|
194
194
|
*/ setCastShadow(b) {
|
|
195
195
|
this.ensurePunctualState();
|
|
196
196
|
if (this._castShadow !== !!b) {
|
|
@@ -205,9 +205,9 @@ export abstract class AmbientLight extends BaseLight {
|
|
|
205
205
|
this.ensurePunctualState();
|
|
206
206
|
return this._shadowMapper;
|
|
207
207
|
}
|
|
208
|
-
/**
|
|
209
|
-
* {@inheritDoc BaseLight.isPunctualLight}
|
|
210
|
-
* @override
|
|
208
|
+
/**
|
|
209
|
+
* {@inheritDoc BaseLight.isPunctualLight}
|
|
210
|
+
* @override
|
|
211
211
|
*/ isPunctualLight() {
|
|
212
212
|
return true;
|
|
213
213
|
}
|
|
@@ -222,14 +222,14 @@ export abstract class AmbientLight extends BaseLight {
|
|
|
222
222
|
}
|
|
223
223
|
/** @internal */ computeUniforms() {}
|
|
224
224
|
}
|
|
225
|
-
/**
|
|
226
|
-
* Directional light
|
|
227
|
-
* @public
|
|
225
|
+
/**
|
|
226
|
+
* Directional light
|
|
227
|
+
* @public
|
|
228
228
|
*/ class DirectionalLight extends PunctualLight {
|
|
229
229
|
static _currentSunLight = new WeakMap();
|
|
230
|
-
/**
|
|
231
|
-
* Creates an instance of directional light
|
|
232
|
-
* @param scene - The scene to which the light belongs
|
|
230
|
+
/**
|
|
231
|
+
* Creates an instance of directional light
|
|
232
|
+
* @param scene - The scene to which the light belongs
|
|
233
233
|
*/ constructor(scene){
|
|
234
234
|
super(scene, LIGHT_TYPE_DIRECTIONAL);
|
|
235
235
|
this.intensity = 10;
|
|
@@ -251,11 +251,11 @@ export abstract class AmbientLight extends BaseLight {
|
|
|
251
251
|
ref.set(light);
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
|
-
/**
|
|
255
|
-
* true if the light was defined as sun light
|
|
256
|
-
*
|
|
257
|
-
* @remarks
|
|
258
|
-
* Only one directional light will be marked as sun light.
|
|
254
|
+
/**
|
|
255
|
+
* true if the light was defined as sun light
|
|
256
|
+
*
|
|
257
|
+
* @remarks
|
|
258
|
+
* Only one directional light will be marked as sun light.
|
|
259
259
|
**/ get sunLight() {
|
|
260
260
|
return DirectionalLight.getSunLight(this.scene) === this;
|
|
261
261
|
}
|
|
@@ -266,9 +266,9 @@ export abstract class AmbientLight extends BaseLight {
|
|
|
266
266
|
DirectionalLight.setSunLight(this.scene, null);
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
|
-
/**
|
|
270
|
-
* {@inheritDoc BaseLight.isDirectionLight}
|
|
271
|
-
* @override
|
|
269
|
+
/**
|
|
270
|
+
* {@inheritDoc BaseLight.isDirectionLight}
|
|
271
|
+
* @override
|
|
272
272
|
*/ isDirectionLight() {
|
|
273
273
|
return true;
|
|
274
274
|
}
|
|
@@ -284,17 +284,17 @@ export abstract class AmbientLight extends BaseLight {
|
|
|
284
284
|
this._extraParams = new Vector4(0, 0, 0, this.lightType);
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
|
-
/**
|
|
288
|
-
* Point light
|
|
289
|
-
* @public
|
|
287
|
+
/**
|
|
288
|
+
* Point light
|
|
289
|
+
* @public
|
|
290
290
|
*/ class PointLight extends PunctualLight {
|
|
291
291
|
/** @internal */ _range;
|
|
292
292
|
/** @internal */ _diffuseScale;
|
|
293
293
|
/** @internal */ _specularScale;
|
|
294
294
|
/** @internal */ _sourceRadius;
|
|
295
|
-
/**
|
|
296
|
-
* Creates an instance of point light
|
|
297
|
-
* @param scene - The scene to which the light belongs
|
|
295
|
+
/**
|
|
296
|
+
* Creates an instance of point light
|
|
297
|
+
* @param scene - The scene to which the light belongs
|
|
298
298
|
*/ constructor(scene){
|
|
299
299
|
super(scene, LIGHT_TYPE_POINT);
|
|
300
300
|
this._range = 0;
|
|
@@ -327,10 +327,10 @@ export abstract class AmbientLight extends BaseLight {
|
|
|
327
327
|
set sourceRadius(val) {
|
|
328
328
|
this.setSourceRadius(val);
|
|
329
329
|
}
|
|
330
|
-
/**
|
|
331
|
-
* Sets the range of the light
|
|
332
|
-
* @param val - The value to set
|
|
333
|
-
* @returns self
|
|
330
|
+
/**
|
|
331
|
+
* Sets the range of the light
|
|
332
|
+
* @param val - The value to set
|
|
333
|
+
* @returns self
|
|
334
334
|
*/ setRange(val) {
|
|
335
335
|
val = val < 0 ? 0 : val;
|
|
336
336
|
if (this._range !== val) {
|
|
@@ -340,10 +340,10 @@ export abstract class AmbientLight extends BaseLight {
|
|
|
340
340
|
}
|
|
341
341
|
return this;
|
|
342
342
|
}
|
|
343
|
-
/**
|
|
344
|
-
* Sets the diffuse scale of the light
|
|
345
|
-
* @param val - The value to set
|
|
346
|
-
* @returns self
|
|
343
|
+
/**
|
|
344
|
+
* Sets the diffuse scale of the light
|
|
345
|
+
* @param val - The value to set
|
|
346
|
+
* @returns self
|
|
347
347
|
*/ setDiffuseScale(val) {
|
|
348
348
|
val = val < 0 ? 0 : val;
|
|
349
349
|
if (this._diffuseScale !== val) {
|
|
@@ -352,10 +352,10 @@ export abstract class AmbientLight extends BaseLight {
|
|
|
352
352
|
}
|
|
353
353
|
return this;
|
|
354
354
|
}
|
|
355
|
-
/**
|
|
356
|
-
* Sets the specular scale of the light
|
|
357
|
-
* @param val - The value to set
|
|
358
|
-
* @returns self
|
|
355
|
+
/**
|
|
356
|
+
* Sets the specular scale of the light
|
|
357
|
+
* @param val - The value to set
|
|
358
|
+
* @returns self
|
|
359
359
|
*/ setSpecularScale(val) {
|
|
360
360
|
val = val < 0 ? 0 : val;
|
|
361
361
|
if (this._specularScale !== val) {
|
|
@@ -364,10 +364,10 @@ export abstract class AmbientLight extends BaseLight {
|
|
|
364
364
|
}
|
|
365
365
|
return this;
|
|
366
366
|
}
|
|
367
|
-
/**
|
|
368
|
-
* Sets the source radius of the light
|
|
369
|
-
* @param val - The value to set
|
|
370
|
-
* @returns self
|
|
367
|
+
/**
|
|
368
|
+
* Sets the source radius of the light
|
|
369
|
+
* @param val - The value to set
|
|
370
|
+
* @returns self
|
|
371
371
|
*/ setSourceRadius(val) {
|
|
372
372
|
val = val < 0 ? 0 : val;
|
|
373
373
|
if (this._sourceRadius !== val) {
|
|
@@ -376,9 +376,9 @@ export abstract class AmbientLight extends BaseLight {
|
|
|
376
376
|
}
|
|
377
377
|
return this;
|
|
378
378
|
}
|
|
379
|
-
/**
|
|
380
|
-
* {@inheritDoc BaseLight.isPointLight}
|
|
381
|
-
* @override
|
|
379
|
+
/**
|
|
380
|
+
* {@inheritDoc BaseLight.isPointLight}
|
|
381
|
+
* @override
|
|
382
382
|
*/ isPointLight() {
|
|
383
383
|
return true;
|
|
384
384
|
}
|
|
@@ -399,15 +399,15 @@ export abstract class AmbientLight extends BaseLight {
|
|
|
399
399
|
this._extraParams = new Vector4(this._diffuseScale, this._specularScale, this._sourceRadius, this.lightType);
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
|
-
/**
|
|
403
|
-
* Spot light
|
|
404
|
-
* @public
|
|
402
|
+
/**
|
|
403
|
+
* Spot light
|
|
404
|
+
* @public
|
|
405
405
|
*/ class SpotLight extends PunctualLight {
|
|
406
406
|
/** @internal */ _range;
|
|
407
407
|
/** @internal */ _cutoff;
|
|
408
|
-
/**
|
|
409
|
-
* Creates an instance of spot light
|
|
410
|
-
* @param scene - The scene to which the light belongs
|
|
408
|
+
/**
|
|
409
|
+
* Creates an instance of spot light
|
|
410
|
+
* @param scene - The scene to which the light belongs
|
|
411
411
|
*/ constructor(scene){
|
|
412
412
|
super(scene, LIGHT_TYPE_SPOT);
|
|
413
413
|
this._range = 0;
|
|
@@ -420,10 +420,10 @@ export abstract class AmbientLight extends BaseLight {
|
|
|
420
420
|
set range(val) {
|
|
421
421
|
this.setRange(val);
|
|
422
422
|
}
|
|
423
|
-
/**
|
|
424
|
-
* Sets the range of the light
|
|
425
|
-
* @param val - The value to set
|
|
426
|
-
* @returns self
|
|
423
|
+
/**
|
|
424
|
+
* Sets the range of the light
|
|
425
|
+
* @param val - The value to set
|
|
426
|
+
* @returns self
|
|
427
427
|
*/ setRange(val) {
|
|
428
428
|
val = val < 0 ? 0 : val;
|
|
429
429
|
if (this._range !== val) {
|
|
@@ -439,10 +439,10 @@ export abstract class AmbientLight extends BaseLight {
|
|
|
439
439
|
set cutoff(val) {
|
|
440
440
|
this.setCutoff(val);
|
|
441
441
|
}
|
|
442
|
-
/**
|
|
443
|
-
* Sets the cutoff of the light
|
|
444
|
-
* @param val - The value to set
|
|
445
|
-
* @returns self
|
|
442
|
+
/**
|
|
443
|
+
* Sets the cutoff of the light
|
|
444
|
+
* @param val - The value to set
|
|
445
|
+
* @returns self
|
|
446
446
|
*/ setCutoff(val) {
|
|
447
447
|
val = val < 0 ? 0 : val;
|
|
448
448
|
if (this._cutoff !== val) {
|
|
@@ -452,9 +452,9 @@ export abstract class AmbientLight extends BaseLight {
|
|
|
452
452
|
}
|
|
453
453
|
return this;
|
|
454
454
|
}
|
|
455
|
-
/**
|
|
456
|
-
* {@inheritDoc BaseLight.isSpotLight}
|
|
457
|
-
* @override
|
|
455
|
+
/**
|
|
456
|
+
* {@inheritDoc BaseLight.isSpotLight}
|
|
457
|
+
* @override
|
|
458
458
|
*/ isSpotLight() {
|
|
459
459
|
return true;
|
|
460
460
|
}
|
|
@@ -477,16 +477,16 @@ export abstract class AmbientLight extends BaseLight {
|
|
|
477
477
|
this._extraParams = new Vector4(0, 0, 0, this.lightType);
|
|
478
478
|
}
|
|
479
479
|
}
|
|
480
|
-
/**
|
|
481
|
-
* Rectangular area light
|
|
482
|
-
* @public
|
|
480
|
+
/**
|
|
481
|
+
* Rectangular area light
|
|
482
|
+
* @public
|
|
483
483
|
*/ class RectLight extends PunctualLight {
|
|
484
484
|
/** @internal */ _range;
|
|
485
485
|
/** @internal */ _width;
|
|
486
486
|
/** @internal */ _height;
|
|
487
|
-
/**
|
|
488
|
-
* Creates an instance of rect light
|
|
489
|
-
* @param scene - The scene to which the light belongs
|
|
487
|
+
/**
|
|
488
|
+
* Creates an instance of rect light
|
|
489
|
+
* @param scene - The scene to which the light belongs
|
|
490
490
|
*/ constructor(scene){
|
|
491
491
|
super(scene, LIGHT_TYPE_RECT);
|
|
492
492
|
this._range = 10;
|
|
@@ -500,10 +500,10 @@ export abstract class AmbientLight extends BaseLight {
|
|
|
500
500
|
set range(val) {
|
|
501
501
|
this.setRange(val);
|
|
502
502
|
}
|
|
503
|
-
/**
|
|
504
|
-
* Sets the range of the light
|
|
505
|
-
* @param val - The value to set
|
|
506
|
-
* @returns self
|
|
503
|
+
/**
|
|
504
|
+
* Sets the range of the light
|
|
505
|
+
* @param val - The value to set
|
|
506
|
+
* @returns self
|
|
507
507
|
*/ setRange(val) {
|
|
508
508
|
val = val < 0 ? 0 : val;
|
|
509
509
|
if (this._range !== val) {
|
|
@@ -519,10 +519,10 @@ export abstract class AmbientLight extends BaseLight {
|
|
|
519
519
|
set width(val) {
|
|
520
520
|
this.setWidth(val);
|
|
521
521
|
}
|
|
522
|
-
/**
|
|
523
|
-
* Sets the width of the light
|
|
524
|
-
* @param val - The value to set
|
|
525
|
-
* @returns self
|
|
522
|
+
/**
|
|
523
|
+
* Sets the width of the light
|
|
524
|
+
* @param val - The value to set
|
|
525
|
+
* @returns self
|
|
526
526
|
*/ setWidth(val) {
|
|
527
527
|
val = val < 0 ? 0 : val;
|
|
528
528
|
if (this._width !== val) {
|
|
@@ -538,10 +538,10 @@ export abstract class AmbientLight extends BaseLight {
|
|
|
538
538
|
set height(val) {
|
|
539
539
|
this.setHeight(val);
|
|
540
540
|
}
|
|
541
|
-
/**
|
|
542
|
-
* Sets the height of the light
|
|
543
|
-
* @param val - The value to set
|
|
544
|
-
* @returns self
|
|
541
|
+
/**
|
|
542
|
+
* Sets the height of the light
|
|
543
|
+
* @param val - The value to set
|
|
544
|
+
* @returns self
|
|
545
545
|
*/ setHeight(val) {
|
|
546
546
|
val = val < 0 ? 0 : val;
|
|
547
547
|
if (this._height !== val) {
|
|
@@ -551,14 +551,14 @@ export abstract class AmbientLight extends BaseLight {
|
|
|
551
551
|
}
|
|
552
552
|
return this;
|
|
553
553
|
}
|
|
554
|
-
/**
|
|
555
|
-
* {@inheritDoc BaseLight.isRectLight}
|
|
556
|
-
* @override
|
|
554
|
+
/**
|
|
555
|
+
* {@inheritDoc BaseLight.isRectLight}
|
|
556
|
+
* @override
|
|
557
557
|
*/ isRectLight() {
|
|
558
558
|
return true;
|
|
559
559
|
}
|
|
560
|
-
/**
|
|
561
|
-
* Rect light supports shadow in current pipeline
|
|
560
|
+
/**
|
|
561
|
+
* Rect light supports shadow in current pipeline
|
|
562
562
|
*/ /** @internal */ computeBoundingVolume() {
|
|
563
563
|
const bbox = new BoundingBox();
|
|
564
564
|
const r = this._range;
|