@zephyr3d/editor 0.3.0 → 0.3.1
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/README.md +143 -0
- package/dist/assets/{index-BaUzUcND.js → index-IISR7uQv.js} +1 -1
- package/dist/assistant/zephyr-types-index.json +1 -1
- package/dist/index.html +2 -2
- package/dist/modules/zephyr3d_backend-webgpu.js.map +1 -1
- package/dist/modules/zephyr3d_imgui.js +3 -3
- package/dist/modules/zephyr3d_imgui.js.map +1 -1
- package/dist/modules/zephyr3d_scene.js +1439 -1439
- package/dist/modules/zephyr3d_scene.js.map +1 -1
- package/dist/vendor/zephyr3d/backend-webgpu/dist/bindgroup_webgpu.js.map +1 -1
- package/dist/vendor/zephyr3d/backend-webgpu/dist/buffer_webgpu.js.map +1 -1
- package/dist/vendor/zephyr3d/backend-webgpu/dist/commandqueue.js.map +1 -1
- package/dist/vendor/zephyr3d/backend-webgpu/dist/uploadringbuffer.js.map +1 -1
- package/dist/vendor/zephyr3d/imgui/dist/imgui_impl.js.map +1 -1
- package/dist/vendor/zephyr3d/imgui/dist/renderer.js +3 -3
- package/dist/vendor/zephyr3d/imgui/dist/renderer.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/animation/animationset.js +135 -135
- package/dist/vendor/zephyr3d/scene/dist/animation/animationset.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/animation/joint_dynamics/controller.js +146 -146
- package/dist/vendor/zephyr3d/scene/dist/animation/joint_dynamics/controller.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/animation/spring/spring_system.js +75 -75
- package/dist/vendor/zephyr3d/scene/dist/animation/spring/spring_system.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/camera/camera.js +184 -184
- package/dist/vendor/zephyr3d/scene/dist/camera/camera.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/material/material.js +288 -288
- package/dist/vendor/zephyr3d/scene/dist/material/material.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/render/rendergraph/history_resource_manager.js +93 -93
- package/dist/vendor/zephyr3d/scene/dist/render/rendergraph/history_resource_manager.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/render/rendergraph/history_resources.js +3 -3
- package/dist/vendor/zephyr3d/scene/dist/render/rendergraph/history_resources.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/render/rendergraph/types.js +22 -22
- package/dist/vendor/zephyr3d/scene/dist/render/rendergraph/types.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/utility/blueprint/material/ir.js +489 -489
- package/dist/vendor/zephyr3d/scene/dist/utility/blueprint/material/ir.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/animation.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/camera.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/common.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/light.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/material.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/mesh.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/node.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/particle.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/primitive.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/scene.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/terrain.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/utility/serialization/types.js +4 -4
- package/dist/vendor/zephyr3d/scene/dist/utility/serialization/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -14,24 +14,24 @@ import { ScreenAdapter } from '../app/screen.js';
|
|
|
14
14
|
import { ABufferOIT } from '../render/abuffer_oit.js';
|
|
15
15
|
import { WeightedBlendedOIT } from '../render/weightedblended_oit.js';
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
* A renderable camera node that manages view/projection math, frusta,
|
|
19
|
-
* input control, picking, and a post-processing chain via a compositor.
|
|
20
|
-
*
|
|
21
|
-
* Key features:
|
|
22
|
-
* - Maintains projection, view, VP, and inverse VP matrices and lazily recomputes them when invalidated.
|
|
23
|
-
* - Provides world- and view-space frusta for culling and clipping.
|
|
24
|
-
* - Supports perspective and orthographic projections.
|
|
25
|
-
* - Integrates with post effects (Tonemap, FXAA, TAA, Bloom, SSR, SSAO, Motion Blur) through an internal `Compositor`.
|
|
26
|
-
* - Handles temporal jitter and history state when TAA or motion blur are enabled.
|
|
27
|
-
* - Emits picking rays from screen coordinates and supports async GPU picking.
|
|
28
|
-
* - Optional controller integration for user input handling.
|
|
29
|
-
*
|
|
30
|
-
* Performance notes:
|
|
31
|
-
* - Matrices/frusta are computed on demand and cached until invalidation.
|
|
32
|
-
* - Temporal jitter and history are set up only when required by enabled features and device support.
|
|
33
|
-
*
|
|
34
|
-
* @public
|
|
17
|
+
/**
|
|
18
|
+
* A renderable camera node that manages view/projection math, frusta,
|
|
19
|
+
* input control, picking, and a post-processing chain via a compositor.
|
|
20
|
+
*
|
|
21
|
+
* Key features:
|
|
22
|
+
* - Maintains projection, view, VP, and inverse VP matrices and lazily recomputes them when invalidated.
|
|
23
|
+
* - Provides world- and view-space frusta for culling and clipping.
|
|
24
|
+
* - Supports perspective and orthographic projections.
|
|
25
|
+
* - Integrates with post effects (Tonemap, FXAA, TAA, Bloom, SSR, SSAO, Motion Blur) through an internal `Compositor`.
|
|
26
|
+
* - Handles temporal jitter and history state when TAA or motion blur are enabled.
|
|
27
|
+
* - Emits picking rays from screen coordinates and supports async GPU picking.
|
|
28
|
+
* - Optional controller integration for user input handling.
|
|
29
|
+
*
|
|
30
|
+
* Performance notes:
|
|
31
|
+
* - Matrices/frusta are computed on demand and cached until invalidation.
|
|
32
|
+
* - Temporal jitter and history are set up only when required by enabled features and device support.
|
|
33
|
+
*
|
|
34
|
+
* @public
|
|
35
35
|
*/ class Camera extends SceneNode {
|
|
36
36
|
/** @internal Halton 2-3 sequence used for TAA jittering. */ static _halton23 = halton23(16);
|
|
37
37
|
/** @internal Per-camera history resource manager. */ static _historyResourceManager = new WeakMap();
|
|
@@ -120,14 +120,14 @@ import { WeightedBlendedOIT } from '../render/weightedblended_oit.js';
|
|
|
120
120
|
/** @internal Post-processing compositor attached to this camera. */ _compositor;
|
|
121
121
|
/** @internal Pointer interaction rectangle in css pixels (relative to canvas) */ _interactionRect;
|
|
122
122
|
/** @internal captured by which mouse button (-1 if not captured) */ _capturedButton;
|
|
123
|
-
/**
|
|
124
|
-
* Creates a new camera node.
|
|
125
|
-
*
|
|
126
|
-
* Initializes projection/view matrices, temporal fields, controller linkage, and
|
|
127
|
-
* builds the default post-processing pipeline on the internal compositor.
|
|
128
|
-
*
|
|
129
|
-
* @param scene - The scene that owns this camera.
|
|
130
|
-
* @param projectionMatrix - Optional projection matrix to initialize with.
|
|
123
|
+
/**
|
|
124
|
+
* Creates a new camera node.
|
|
125
|
+
*
|
|
126
|
+
* Initializes projection/view matrices, temporal fields, controller linkage, and
|
|
127
|
+
* builds the default post-processing pipeline on the internal compositor.
|
|
128
|
+
*
|
|
129
|
+
* @param scene - The scene that owns this camera.
|
|
130
|
+
* @param projectionMatrix - Optional projection matrix to initialize with.
|
|
131
131
|
*/ constructor(scene, projectionMatrix){
|
|
132
132
|
super(scene);
|
|
133
133
|
this._projMatrix = projectionMatrix || Matrix4x4.identity();
|
|
@@ -220,73 +220,73 @@ import { WeightedBlendedOIT } from '../render/weightedblended_oit.js';
|
|
|
220
220
|
scene.mainCamera = this;
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
|
-
/**
|
|
224
|
-
* The compositor that owns and runs the camera's post-processing chain.
|
|
223
|
+
/**
|
|
224
|
+
* The compositor that owns and runs the camera's post-processing chain.
|
|
225
225
|
*/ get compositor() {
|
|
226
226
|
return this._compositor;
|
|
227
227
|
}
|
|
228
|
-
/**
|
|
229
|
-
* Pointer interaction rectangle in css pixels (relative to canvas)
|
|
228
|
+
/**
|
|
229
|
+
* Pointer interaction rectangle in css pixels (relative to canvas)
|
|
230
230
|
*/ get interactionRect() {
|
|
231
231
|
return this._interactionRect;
|
|
232
232
|
}
|
|
233
233
|
set interactionRect(rect) {
|
|
234
234
|
this._interactionRect = rect;
|
|
235
235
|
}
|
|
236
|
-
/**
|
|
237
|
-
* Framebuffer clear color, or `null` to disable.
|
|
236
|
+
/**
|
|
237
|
+
* Framebuffer clear color, or `null` to disable.
|
|
238
238
|
*/ get clearColor() {
|
|
239
239
|
return this._clearColor;
|
|
240
240
|
}
|
|
241
241
|
set clearColor(v) {
|
|
242
242
|
this._clearColor = v?.clone() ?? null;
|
|
243
243
|
}
|
|
244
|
-
/**
|
|
245
|
-
* Framebuffer stencil clear value, disabled when null. Default is 0.
|
|
244
|
+
/**
|
|
245
|
+
* Framebuffer stencil clear value, disabled when null. Default is 0.
|
|
246
246
|
*/ get clearDepth() {
|
|
247
247
|
return this._clearDepth;
|
|
248
248
|
}
|
|
249
249
|
set clearDepth(v) {
|
|
250
250
|
this._clearDepth = v;
|
|
251
251
|
}
|
|
252
|
-
/**
|
|
253
|
-
* Framebuffer stencil clear value, disabled when null. Default is 0.
|
|
252
|
+
/**
|
|
253
|
+
* Framebuffer stencil clear value, disabled when null. Default is 0.
|
|
254
254
|
*/ get clearStencil() {
|
|
255
255
|
return this._clearStencil;
|
|
256
256
|
}
|
|
257
257
|
set clearStencil(v) {
|
|
258
258
|
this._clearStencil = v;
|
|
259
259
|
}
|
|
260
|
-
/**
|
|
261
|
-
* Whether Hi-Z acceleration is enabled.
|
|
262
|
-
*
|
|
263
|
-
* Often improves SSR performance with little quality impact when supported.
|
|
260
|
+
/**
|
|
261
|
+
* Whether Hi-Z acceleration is enabled.
|
|
262
|
+
*
|
|
263
|
+
* Often improves SSR performance with little quality impact when supported.
|
|
264
264
|
*/ get HiZ() {
|
|
265
265
|
return this._HiZ;
|
|
266
266
|
}
|
|
267
267
|
set HiZ(val) {
|
|
268
268
|
this._HiZ = !!val;
|
|
269
269
|
}
|
|
270
|
-
/**
|
|
271
|
-
* Whether HDR backbuffer is enabled.
|
|
272
|
-
*
|
|
273
|
-
* Tonemap should be disabled when not using HDR backbuffer.
|
|
270
|
+
/**
|
|
271
|
+
* Whether HDR backbuffer is enabled.
|
|
272
|
+
*
|
|
273
|
+
* Tonemap should be disabled when not using HDR backbuffer.
|
|
274
274
|
*/ get HDR() {
|
|
275
275
|
return this._HDR;
|
|
276
276
|
}
|
|
277
277
|
set HDR(val) {
|
|
278
278
|
this._HDR = !!val;
|
|
279
279
|
}
|
|
280
|
-
/**
|
|
281
|
-
* Whether tonemapping is enabled via the post effect.
|
|
280
|
+
/**
|
|
281
|
+
* Whether tonemapping is enabled via the post effect.
|
|
282
282
|
*/ get toneMap() {
|
|
283
283
|
return this._postEffectTonemap.get().enabled;
|
|
284
284
|
}
|
|
285
285
|
set toneMap(val) {
|
|
286
286
|
this._postEffectTonemap.get().enabled = !!val;
|
|
287
287
|
}
|
|
288
|
-
/**
|
|
289
|
-
* Whether motion blur is enabled via the post effect.
|
|
288
|
+
/**
|
|
289
|
+
* Whether motion blur is enabled via the post effect.
|
|
290
290
|
*/ get motionBlur() {
|
|
291
291
|
return this._postEffectMotionBlur.get().enabled;
|
|
292
292
|
}
|
|
@@ -302,16 +302,16 @@ import { WeightedBlendedOIT } from '../render/weightedblended_oit.js';
|
|
|
302
302
|
this._postEffectMotionBlur.get().strength = this._motionBlurStrength;
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
|
-
/**
|
|
306
|
-
* Gets whether Bloom is enabled.
|
|
305
|
+
/**
|
|
306
|
+
* Gets whether Bloom is enabled.
|
|
307
307
|
*/ get bloom() {
|
|
308
308
|
return this._postEffectBloom.get().enabled;
|
|
309
309
|
}
|
|
310
310
|
set bloom(val) {
|
|
311
311
|
this._postEffectBloom.get().enabled = !!val;
|
|
312
312
|
}
|
|
313
|
-
/**
|
|
314
|
-
* Maximum bloom downsample levels
|
|
313
|
+
/**
|
|
314
|
+
* Maximum bloom downsample levels
|
|
315
315
|
*/ get bloomMaxDownsampleLevels() {
|
|
316
316
|
return this._bloomMaxDownsampleLevels;
|
|
317
317
|
}
|
|
@@ -321,8 +321,8 @@ import { WeightedBlendedOIT } from '../render/weightedblended_oit.js';
|
|
|
321
321
|
this._postEffectBloom.get().maxDownsampleLevel = val;
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
|
-
/**
|
|
325
|
-
* Bloom downsample limit
|
|
324
|
+
/**
|
|
325
|
+
* Bloom downsample limit
|
|
326
326
|
*/ get bloomDownsampleLimit() {
|
|
327
327
|
return this._bloomDownsampleLimit;
|
|
328
328
|
}
|
|
@@ -332,8 +332,8 @@ import { WeightedBlendedOIT } from '../render/weightedblended_oit.js';
|
|
|
332
332
|
this._postEffectBloom.get().downsampleLimit = val;
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
|
-
/**
|
|
336
|
-
* Bloom threshold
|
|
335
|
+
/**
|
|
336
|
+
* Bloom threshold
|
|
337
337
|
*/ get bloomThreshold() {
|
|
338
338
|
return this._bloomThreshold;
|
|
339
339
|
}
|
|
@@ -343,8 +343,8 @@ import { WeightedBlendedOIT } from '../render/weightedblended_oit.js';
|
|
|
343
343
|
this._postEffectBloom.get().threshold = val;
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
|
-
/**
|
|
347
|
-
* Bloom threshold knee
|
|
346
|
+
/**
|
|
347
|
+
* Bloom threshold knee
|
|
348
348
|
*/ get bloomThresholdKnee() {
|
|
349
349
|
return this._bloomThresholdKnee;
|
|
350
350
|
}
|
|
@@ -354,8 +354,8 @@ import { WeightedBlendedOIT } from '../render/weightedblended_oit.js';
|
|
|
354
354
|
this._postEffectBloom.get().thresholdKnee = val;
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
|
-
/**
|
|
358
|
-
* Bloom intensity
|
|
357
|
+
/**
|
|
358
|
+
* Bloom intensity
|
|
359
359
|
*/ get bloomIntensity() {
|
|
360
360
|
return this._bloomIntensity;
|
|
361
361
|
}
|
|
@@ -407,16 +407,16 @@ import { WeightedBlendedOIT } from '../render/weightedblended_oit.js';
|
|
|
407
407
|
this._postEffectColorAdjust.get().sharpen = val;
|
|
408
408
|
}
|
|
409
409
|
}
|
|
410
|
-
/**
|
|
411
|
-
* Gets whether FXAA is enabled.
|
|
410
|
+
/**
|
|
411
|
+
* Gets whether FXAA is enabled.
|
|
412
412
|
*/ get FXAA() {
|
|
413
413
|
return this._postEffectFXAA.get().enabled;
|
|
414
414
|
}
|
|
415
415
|
set FXAA(val) {
|
|
416
416
|
this._postEffectFXAA.get().enabled = !!val;
|
|
417
417
|
}
|
|
418
|
-
/**
|
|
419
|
-
* Tonemap exposure
|
|
418
|
+
/**
|
|
419
|
+
* Tonemap exposure
|
|
420
420
|
*/ get toneMapExposure() {
|
|
421
421
|
return this._tonemapExposure;
|
|
422
422
|
}
|
|
@@ -426,123 +426,123 @@ import { WeightedBlendedOIT } from '../render/weightedblended_oit.js';
|
|
|
426
426
|
this._postEffectTonemap.get().exposure = val;
|
|
427
427
|
}
|
|
428
428
|
}
|
|
429
|
-
/**
|
|
430
|
-
* Gets whether TAA is enabled.
|
|
429
|
+
/**
|
|
430
|
+
* Gets whether TAA is enabled.
|
|
431
431
|
*/ get TAA() {
|
|
432
432
|
return this._postEffectTAA.get().enabled;
|
|
433
433
|
}
|
|
434
434
|
set TAA(val) {
|
|
435
435
|
this._postEffectTAA.get().enabled = !!val;
|
|
436
436
|
}
|
|
437
|
-
/**
|
|
438
|
-
* Gets the debug flag for TAA
|
|
437
|
+
/**
|
|
438
|
+
* Gets the debug flag for TAA
|
|
439
439
|
*/ get TAADebug() {
|
|
440
440
|
return this._TAADebug;
|
|
441
441
|
}
|
|
442
442
|
set TAADebug(val) {
|
|
443
443
|
this._TAADebug = val;
|
|
444
444
|
}
|
|
445
|
-
/**
|
|
446
|
-
* Gets whether Screen Space Reflections (SSR) is enabled.
|
|
445
|
+
/**
|
|
446
|
+
* Gets whether Screen Space Reflections (SSR) is enabled.
|
|
447
447
|
*/ get SSR() {
|
|
448
448
|
return this._postEffectSSR.get().enabled;
|
|
449
449
|
}
|
|
450
450
|
set SSR(val) {
|
|
451
451
|
this._postEffectSSR.get().enabled = !!val;
|
|
452
452
|
}
|
|
453
|
-
/**
|
|
454
|
-
* Gets the maximum roughness value for screen space reflections.
|
|
455
|
-
* Controls the cutoff point where surfaces are considered too rough for SSR.
|
|
453
|
+
/**
|
|
454
|
+
* Gets the maximum roughness value for screen space reflections.
|
|
455
|
+
* Controls the cutoff point where surfaces are considered too rough for SSR.
|
|
456
456
|
*/ get ssrMaxRoughness() {
|
|
457
457
|
return this._ssrMaxRoughness;
|
|
458
458
|
}
|
|
459
459
|
set ssrMaxRoughness(val) {
|
|
460
460
|
this._ssrMaxRoughness = val;
|
|
461
461
|
}
|
|
462
|
-
/**
|
|
463
|
-
* Gets the roughness factor for SSR calculations.
|
|
464
|
-
* Affects how surface roughness influences reflection clarity.
|
|
462
|
+
/**
|
|
463
|
+
* Gets the roughness factor for SSR calculations.
|
|
464
|
+
* Affects how surface roughness influences reflection clarity.
|
|
465
465
|
*/ get ssrRoughnessFactor() {
|
|
466
466
|
return this._ssrRoughnessFactor;
|
|
467
467
|
}
|
|
468
468
|
set ssrRoughnessFactor(val) {
|
|
469
469
|
this._ssrRoughnessFactor = val;
|
|
470
470
|
}
|
|
471
|
-
/**
|
|
472
|
-
* Gets the stride value for SSR ray marching.
|
|
473
|
-
* Controls the step size during ray marching. Larger values improve performance but may miss details.
|
|
471
|
+
/**
|
|
472
|
+
* Gets the stride value for SSR ray marching.
|
|
473
|
+
* Controls the step size during ray marching. Larger values improve performance but may miss details.
|
|
474
474
|
*/ get ssrStride() {
|
|
475
475
|
return this._ssrStride;
|
|
476
476
|
}
|
|
477
477
|
set ssrStride(val) {
|
|
478
478
|
this._ssrStride = val;
|
|
479
479
|
}
|
|
480
|
-
/**
|
|
481
|
-
* Gets the maximum distance for SSR ray marching.
|
|
482
|
-
* Defines how far rays will travel when searching for reflection intersections.
|
|
480
|
+
/**
|
|
481
|
+
* Gets the maximum distance for SSR ray marching.
|
|
482
|
+
* Defines how far rays will travel when searching for reflection intersections.
|
|
483
483
|
*/ get ssrMaxDistance() {
|
|
484
484
|
return this._ssrParams.x;
|
|
485
485
|
}
|
|
486
486
|
set ssrMaxDistance(val) {
|
|
487
487
|
this._ssrParams.x = val;
|
|
488
488
|
}
|
|
489
|
-
/**
|
|
490
|
-
* Gets the number of iterations for SSR ray marching.
|
|
491
|
-
* Higher values provide more accurate reflections but impact performance.
|
|
489
|
+
/**
|
|
490
|
+
* Gets the number of iterations for SSR ray marching.
|
|
491
|
+
* Higher values provide more accurate reflections but impact performance.
|
|
492
492
|
*/ get ssrIterations() {
|
|
493
493
|
return this._ssrParams.y;
|
|
494
494
|
}
|
|
495
495
|
set ssrIterations(val) {
|
|
496
496
|
this._ssrParams.y = val;
|
|
497
497
|
}
|
|
498
|
-
/**
|
|
499
|
-
* Gets the thickness value for SSR calculations.
|
|
500
|
-
* Determines the thickness threshold for surfaces when calculating reflections.
|
|
498
|
+
/**
|
|
499
|
+
* Gets the thickness value for SSR calculations.
|
|
500
|
+
* Determines the thickness threshold for surfaces when calculating reflections.
|
|
501
501
|
*/ get ssrThickness() {
|
|
502
502
|
return this._ssrParams.z;
|
|
503
503
|
}
|
|
504
504
|
set ssrThickness(val) {
|
|
505
505
|
this._ssrParams.z = val;
|
|
506
506
|
}
|
|
507
|
-
/**
|
|
508
|
-
* Gets whether SSR should calculate thickness automatically.
|
|
509
|
-
* When enabled, the system will dynamically compute surface thickness for reflections.
|
|
507
|
+
/**
|
|
508
|
+
* Gets whether SSR should calculate thickness automatically.
|
|
509
|
+
* When enabled, the system will dynamically compute surface thickness for reflections.
|
|
510
510
|
*/ get ssrCalcThickness() {
|
|
511
511
|
return this._ssrCalcThickness;
|
|
512
512
|
}
|
|
513
513
|
set ssrCalcThickness(val) {
|
|
514
514
|
this._ssrCalcThickness = !!val;
|
|
515
515
|
}
|
|
516
|
-
/**
|
|
517
|
-
* Gets the blur scale factor for SSR.
|
|
518
|
-
* Controls the overall intensity of the blur effect applied to reflections.
|
|
516
|
+
/**
|
|
517
|
+
* Gets the blur scale factor for SSR.
|
|
518
|
+
* Controls the overall intensity of the blur effect applied to reflections.
|
|
519
519
|
*/ get ssrBlurScale() {
|
|
520
520
|
return this._ssrBlurriness;
|
|
521
521
|
}
|
|
522
522
|
set ssrBlurScale(val) {
|
|
523
523
|
this._ssrBlurriness = val;
|
|
524
524
|
}
|
|
525
|
-
/**
|
|
526
|
-
* Gets the depth cutoff value for SSR blur.
|
|
527
|
-
* Determines at what depth difference the blur effect should be reduced or eliminated.
|
|
525
|
+
/**
|
|
526
|
+
* Gets the depth cutoff value for SSR blur.
|
|
527
|
+
* Determines at what depth difference the blur effect should be reduced or eliminated.
|
|
528
528
|
*/ get ssrBlurDepthCutoff() {
|
|
529
529
|
return this._ssrBlurDepthCutoff;
|
|
530
530
|
}
|
|
531
531
|
set ssrBlurDepthCutoff(val) {
|
|
532
532
|
this._ssrBlurDepthCutoff = val;
|
|
533
533
|
}
|
|
534
|
-
/**
|
|
535
|
-
* Gets the kernel size for the SSR blur effect.
|
|
536
|
-
* Defines the size of the blur kernel. Larger values create softer, more spread-out blur.
|
|
534
|
+
/**
|
|
535
|
+
* Gets the kernel size for the SSR blur effect.
|
|
536
|
+
* Defines the size of the blur kernel. Larger values create softer, more spread-out blur.
|
|
537
537
|
*/ get ssrBlurKernelSize() {
|
|
538
538
|
return this._ssrBlurKernelSize;
|
|
539
539
|
}
|
|
540
540
|
set ssrBlurKernelSize(val) {
|
|
541
541
|
this._ssrBlurKernelSize = val;
|
|
542
542
|
}
|
|
543
|
-
/**
|
|
544
|
-
* Gets the standard deviation for the SSR Gaussian blur.
|
|
545
|
-
* Controls the distribution of the blur effect. Higher values create more pronounced blur.
|
|
543
|
+
/**
|
|
544
|
+
* Gets the standard deviation for the SSR Gaussian blur.
|
|
545
|
+
* Controls the distribution of the blur effect. Higher values create more pronounced blur.
|
|
546
546
|
*/ get ssrBlurStdDev() {
|
|
547
547
|
return this._ssrBlurStdDev;
|
|
548
548
|
}
|
|
@@ -552,8 +552,8 @@ import { WeightedBlendedOIT } from '../render/weightedblended_oit.js';
|
|
|
552
552
|
/** @internal */ get ssrParams() {
|
|
553
553
|
return this._ssrParams;
|
|
554
554
|
}
|
|
555
|
-
/**
|
|
556
|
-
* Gets whether SSAO is enabled.
|
|
555
|
+
/**
|
|
556
|
+
* Gets whether SSAO is enabled.
|
|
557
557
|
*/ get SSAO() {
|
|
558
558
|
return this._postEffectSSAO.get().enabled;
|
|
559
559
|
}
|
|
@@ -693,27 +693,27 @@ import { WeightedBlendedOIT } from '../render/weightedblended_oit.js';
|
|
|
693
693
|
}
|
|
694
694
|
return this._viewport;
|
|
695
695
|
}
|
|
696
|
-
/**
|
|
697
|
-
* Screen configuration used for adapting the camera viewport
|
|
696
|
+
/**
|
|
697
|
+
* Screen configuration used for adapting the camera viewport
|
|
698
698
|
*/ get screenConfig() {
|
|
699
699
|
return this._screenAdapter.config;
|
|
700
700
|
}
|
|
701
701
|
set screenConfig(config) {
|
|
702
702
|
this._screenAdapter.config = config;
|
|
703
703
|
}
|
|
704
|
-
/**
|
|
705
|
-
* Screen viewport used for adapting the camera viewport
|
|
704
|
+
/**
|
|
705
|
+
* Screen viewport used for adapting the camera viewport
|
|
706
706
|
*/ get screenViewport() {
|
|
707
707
|
return this._screenAdapter.viewport;
|
|
708
708
|
}
|
|
709
709
|
set screenViewport(viewport) {
|
|
710
710
|
this._screenAdapter.viewport = viewport;
|
|
711
711
|
}
|
|
712
|
-
/**
|
|
713
|
-
* Handle input events
|
|
714
|
-
* @param ev - input event object
|
|
715
|
-
* @param type - event type, default to ev.type
|
|
716
|
-
* @returns Boolean value indicates whether the event was handled.
|
|
712
|
+
/**
|
|
713
|
+
* Handle input events
|
|
714
|
+
* @param ev - input event object
|
|
715
|
+
* @param type - event type, default to ev.type
|
|
716
|
+
* @returns Boolean value indicates whether the event was handled.
|
|
717
717
|
*/ handleEvent(ev, type) {
|
|
718
718
|
let handled = false;
|
|
719
719
|
if (this._controller) {
|
|
@@ -746,14 +746,14 @@ import { WeightedBlendedOIT } from '../render/weightedblended_oit.js';
|
|
|
746
746
|
}
|
|
747
747
|
return handled;
|
|
748
748
|
}
|
|
749
|
-
/**
|
|
750
|
-
* Constructs a ray based on the given screen coordinates.
|
|
751
|
-
*
|
|
752
|
-
* @param x - The x-component of the screen coordinates, relative to the top-left corner of the viewport.
|
|
753
|
-
* @param y - The y-component of the screen coordinates, relative to the top-left corner of the viewport.
|
|
754
|
-
* @param viewportWidth - Optional width of the viewport for normalizing screen coordinates. If not provided, it will be derived from the camera's viewport or the device's viewport.
|
|
755
|
-
* @param viewportHeight - Optional height of the viewport for normalizing screen coordinates. If not provided, it will be derived from the camera's viewport or the device's viewport.
|
|
756
|
-
* @returns The ray originating from the camera position and passing through the given screen coordinates.
|
|
749
|
+
/**
|
|
750
|
+
* Constructs a ray based on the given screen coordinates.
|
|
751
|
+
*
|
|
752
|
+
* @param x - The x-component of the screen coordinates, relative to the top-left corner of the viewport.
|
|
753
|
+
* @param y - The y-component of the screen coordinates, relative to the top-left corner of the viewport.
|
|
754
|
+
* @param viewportWidth - Optional width of the viewport for normalizing screen coordinates. If not provided, it will be derived from the camera's viewport or the device's viewport.
|
|
755
|
+
* @param viewportHeight - Optional height of the viewport for normalizing screen coordinates. If not provided, it will be derived from the camera's viewport or the device's viewport.
|
|
756
|
+
* @returns The ray originating from the camera position and passing through the given screen coordinates.
|
|
757
757
|
*/ constructRay(x, y, viewportWidth, viewportHeight) {
|
|
758
758
|
const width = viewportWidth ?? (this.viewport ? this.viewport[2] : getDevice().getViewport().width);
|
|
759
759
|
const height = viewportHeight ?? (this.viewport ? this.viewport[3] : getDevice().getViewport().height);
|
|
@@ -771,54 +771,54 @@ import { WeightedBlendedOIT } from '../render/weightedblended_oit.js';
|
|
|
771
771
|
const vDir = Vector3.sub(farWorld.xyz(), vEye).inplaceNormalize();
|
|
772
772
|
return new Ray(vEye, vDir);
|
|
773
773
|
}
|
|
774
|
-
/**
|
|
775
|
-
* Place the camera by specifying the camera position and the target point
|
|
776
|
-
* @param eye - The camera position
|
|
777
|
-
* @param target - The target point to look at
|
|
778
|
-
* @param up - The up vector
|
|
779
|
-
* @returns self
|
|
774
|
+
/**
|
|
775
|
+
* Place the camera by specifying the camera position and the target point
|
|
776
|
+
* @param eye - The camera position
|
|
777
|
+
* @param target - The target point to look at
|
|
778
|
+
* @param up - The up vector
|
|
779
|
+
* @returns self
|
|
780
780
|
*/ lookAt(eye, target, up) {
|
|
781
781
|
return this.setLocalTransform(Matrix4x4.lookAt(eye, target, up));
|
|
782
782
|
}
|
|
783
|
-
/**
|
|
784
|
-
* Place the camera to look at a given cube face at a given camera position
|
|
785
|
-
* @param face - The cube face to look at
|
|
786
|
-
* @param position - The camera position
|
|
787
|
-
* @returns self
|
|
783
|
+
/**
|
|
784
|
+
* Place the camera to look at a given cube face at a given camera position
|
|
785
|
+
* @param face - The cube face to look at
|
|
786
|
+
* @param position - The camera position
|
|
787
|
+
* @returns self
|
|
788
788
|
*/ lookAtCubeFace(face, position) {
|
|
789
789
|
return this.setLocalTransform(Matrix4x4.lookAtCubeFace(face, position ?? this.position));
|
|
790
790
|
}
|
|
791
|
-
/**
|
|
792
|
-
* Setup a perspective projection matrix for the camera
|
|
793
|
-
* @param fovY - The vertical field of view in radians.
|
|
794
|
-
* @param aspect - The aspect ratio
|
|
795
|
-
* @param zNear - The near clip plane
|
|
796
|
-
* @param zFar - The far clip plane
|
|
797
|
-
* @returns self
|
|
791
|
+
/**
|
|
792
|
+
* Setup a perspective projection matrix for the camera
|
|
793
|
+
* @param fovY - The vertical field of view in radians.
|
|
794
|
+
* @param aspect - The aspect ratio
|
|
795
|
+
* @param zNear - The near clip plane
|
|
796
|
+
* @param zFar - The far clip plane
|
|
797
|
+
* @returns self
|
|
798
798
|
*/ setPerspective(fovY, aspect, zNear, zFar) {
|
|
799
799
|
this._projMatrix.perspective(fovY, aspect, zNear, zFar);
|
|
800
800
|
Matrix4x4.invert(this._projMatrix, this._invProjMatrix);
|
|
801
801
|
this._invalidate(true);
|
|
802
802
|
return this;
|
|
803
803
|
}
|
|
804
|
-
/**
|
|
805
|
-
* Setup a orthogonal projection matrix for the camera
|
|
806
|
-
* @param left - Left bound of the frustum
|
|
807
|
-
* @param right - Right bound of the frustum
|
|
808
|
-
* @param bottom - Bottom bound of the frustum
|
|
809
|
-
* @param top - Top bound of the frustum
|
|
810
|
-
* @param near - Near bound of the frustum.
|
|
811
|
-
* @param far - Far bound of the frustum.
|
|
812
|
-
* @returns self
|
|
804
|
+
/**
|
|
805
|
+
* Setup a orthogonal projection matrix for the camera
|
|
806
|
+
* @param left - Left bound of the frustum
|
|
807
|
+
* @param right - Right bound of the frustum
|
|
808
|
+
* @param bottom - Bottom bound of the frustum
|
|
809
|
+
* @param top - Top bound of the frustum
|
|
810
|
+
* @param near - Near bound of the frustum.
|
|
811
|
+
* @param far - Far bound of the frustum.
|
|
812
|
+
* @returns self
|
|
813
813
|
*/ setOrtho(left, right, bottom, top, near, far) {
|
|
814
814
|
this._projMatrix.ortho(left, right, bottom, top, near, far);
|
|
815
815
|
Matrix4x4.invert(this._projMatrix, this._invProjMatrix);
|
|
816
816
|
this._invalidate(true);
|
|
817
817
|
return this;
|
|
818
818
|
}
|
|
819
|
-
/**
|
|
820
|
-
* Setup a projection matrix for the camera
|
|
821
|
-
* @param matrix - The projection matrix
|
|
819
|
+
/**
|
|
820
|
+
* Setup a projection matrix for the camera
|
|
821
|
+
* @param matrix - The projection matrix
|
|
822
822
|
*/ setProjectionMatrix(matrix) {
|
|
823
823
|
if (matrix && matrix !== this._projMatrix) {
|
|
824
824
|
this._projMatrix = matrix;
|
|
@@ -826,18 +826,18 @@ import { WeightedBlendedOIT } from '../render/weightedblended_oit.js';
|
|
|
826
826
|
this._invalidate(true);
|
|
827
827
|
}
|
|
828
828
|
}
|
|
829
|
-
/**
|
|
830
|
-
* Gets the projection matrix of the camera
|
|
831
|
-
* @returns The projection matrix
|
|
829
|
+
/**
|
|
830
|
+
* Gets the projection matrix of the camera
|
|
831
|
+
* @returns The projection matrix
|
|
832
832
|
*/ getProjectionMatrix() {
|
|
833
833
|
if (this.dirtyCheck()) {
|
|
834
834
|
this._compute();
|
|
835
835
|
}
|
|
836
836
|
return this._projMatrix;
|
|
837
837
|
}
|
|
838
|
-
/**
|
|
839
|
-
* Gets the inverse projection matrix of the camera
|
|
840
|
-
* @returns The projection matrix
|
|
838
|
+
/**
|
|
839
|
+
* Gets the inverse projection matrix of the camera
|
|
840
|
+
* @returns The projection matrix
|
|
841
841
|
*/ getInvProjectionMatrix() {
|
|
842
842
|
if (this.dirtyCheck()) {
|
|
843
843
|
this._compute();
|
|
@@ -855,11 +855,11 @@ import { WeightedBlendedOIT } from '../render/weightedblended_oit.js';
|
|
|
855
855
|
rotationMatrix.setRow(2, new Vector4(zAxis.x, zAxis.y, zAxis.z, 0));
|
|
856
856
|
return rotationMatrix;
|
|
857
857
|
}
|
|
858
|
-
/**
|
|
859
|
-
* View matrix of the camera
|
|
860
|
-
*
|
|
861
|
-
* @remarks
|
|
862
|
-
* Camera's view matrix will transform a point from the world space to the camera space
|
|
858
|
+
/**
|
|
859
|
+
* View matrix of the camera
|
|
860
|
+
*
|
|
861
|
+
* @remarks
|
|
862
|
+
* Camera's view matrix will transform a point from the world space to the camera space
|
|
863
863
|
*/ get viewMatrix() {
|
|
864
864
|
if (this.dirtyCheck()) {
|
|
865
865
|
this._compute();
|
|
@@ -872,11 +872,11 @@ import { WeightedBlendedOIT } from '../render/weightedblended_oit.js';
|
|
|
872
872
|
}
|
|
873
873
|
return this._viewProjMatrix;
|
|
874
874
|
}
|
|
875
|
-
/**
|
|
876
|
-
* The inverse-view-projection matrix of the camera
|
|
877
|
-
*
|
|
878
|
-
* @remarks
|
|
879
|
-
* The inverse-view-projection matrix transforms a point from the clip space to the camera space
|
|
875
|
+
/**
|
|
876
|
+
* The inverse-view-projection matrix of the camera
|
|
877
|
+
*
|
|
878
|
+
* @remarks
|
|
879
|
+
* The inverse-view-projection matrix transforms a point from the clip space to the camera space
|
|
880
880
|
*/ get invViewProjectionMatrix() {
|
|
881
881
|
if (this.dirtyCheck()) {
|
|
882
882
|
this._compute();
|
|
@@ -928,9 +928,9 @@ import { WeightedBlendedOIT } from '../render/weightedblended_oit.js';
|
|
|
928
928
|
/** Returns true if the camera is orthographic */ isOrtho() {
|
|
929
929
|
return this.getProjectionMatrix().isOrtho();
|
|
930
930
|
}
|
|
931
|
-
/**
|
|
932
|
-
* Gets the camera history resource manager for temporal effects
|
|
933
|
-
* @returns History resource manager
|
|
931
|
+
/**
|
|
932
|
+
* Gets the camera history resource manager for temporal effects
|
|
933
|
+
* @returns History resource manager
|
|
934
934
|
*/ getHistoryResourceManager() {
|
|
935
935
|
let manager = Camera._historyResourceManager.get(this);
|
|
936
936
|
if (!manager) {
|
|
@@ -940,14 +940,14 @@ import { WeightedBlendedOIT } from '../render/weightedblended_oit.js';
|
|
|
940
940
|
}
|
|
941
941
|
return manager;
|
|
942
942
|
}
|
|
943
|
-
/**
|
|
944
|
-
* Sets the camera history resource manager for temporal effects
|
|
945
|
-
* @internal
|
|
943
|
+
/**
|
|
944
|
+
* Sets the camera history resource manager for temporal effects
|
|
945
|
+
* @internal
|
|
946
946
|
*/ setHistoryResourceManager(manager) {
|
|
947
947
|
Camera._historyResourceManager.set(this, manager);
|
|
948
948
|
}
|
|
949
|
-
/**
|
|
950
|
-
* Clears the camera history data which is used in temporal reprojection
|
|
949
|
+
/**
|
|
950
|
+
* Clears the camera history data which is used in temporal reprojection
|
|
951
951
|
*/ clearHistoryData() {
|
|
952
952
|
// Clear history resource manager
|
|
953
953
|
const manager = Camera._historyResourceManager.get(this);
|
|
@@ -1027,10 +1027,10 @@ import { WeightedBlendedOIT } from '../render/weightedblended_oit.js';
|
|
|
1027
1027
|
this._compositor.appendPostEffect(bloom);
|
|
1028
1028
|
}
|
|
1029
1029
|
}
|
|
1030
|
-
/**
|
|
1031
|
-
* Renders a scene
|
|
1032
|
-
* @param scene - The scene to be rendered
|
|
1033
|
-
* @param compositor - Compositor instance that will be used to apply postprocess effects
|
|
1030
|
+
/**
|
|
1031
|
+
* Renders a scene
|
|
1032
|
+
* @param scene - The scene to be rendered
|
|
1033
|
+
* @param compositor - Compositor instance that will be used to apply postprocess effects
|
|
1034
1034
|
*/ render(scene) {
|
|
1035
1035
|
const device = getDevice();
|
|
1036
1036
|
//this.updatePostProcessing(device);
|
|
@@ -1104,13 +1104,13 @@ import { WeightedBlendedOIT } from '../render/weightedblended_oit.js';
|
|
|
1104
1104
|
/** @internal */ getPickPosY() {
|
|
1105
1105
|
return this._pickPosY;
|
|
1106
1106
|
}
|
|
1107
|
-
/**
|
|
1108
|
-
* Updates the controller state
|
|
1107
|
+
/**
|
|
1108
|
+
* Updates the controller state
|
|
1109
1109
|
*/ updateController() {
|
|
1110
1110
|
this._controller?.update();
|
|
1111
1111
|
}
|
|
1112
|
-
/**
|
|
1113
|
-
* Reset the controller
|
|
1112
|
+
/**
|
|
1113
|
+
* Reset the controller
|
|
1114
1114
|
*/ resetController() {
|
|
1115
1115
|
this._controller?.reset();
|
|
1116
1116
|
}
|