@zephyr3d/editor 0.3.4 → 0.3.5
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/assets/{index-DzQzWsCG.js → index-DlnbO59X.js} +2 -2
- package/dist/assistant/zephyr-types-index.json +9 -10
- package/dist/index.html +1 -1
- package/dist/modules/zephyr3d_backend-webgpu.js +13 -12
- package/dist/modules/zephyr3d_backend-webgpu.js.map +1 -1
- package/dist/modules/zephyr3d_base.js +152 -152
- package/dist/modules/zephyr3d_base.js.map +1 -1
- package/dist/modules/zephyr3d_device.js +15 -15
- package/dist/modules/zephyr3d_device.js.map +1 -1
- package/dist/modules/zephyr3d_loaders.js +6 -6
- package/dist/modules/zephyr3d_loaders.js.map +1 -1
- package/dist/modules/zephyr3d_scene.js +1382 -1385
- package/dist/modules/zephyr3d_scene.js.map +1 -1
- package/dist/vendor/zephyr3d/backend-webgpu/dist/capabilities_webgpu.js +7 -6
- package/dist/vendor/zephyr3d/backend-webgpu/dist/capabilities_webgpu.js.map +1 -1
- package/dist/vendor/zephyr3d/backend-webgpu/dist/renderpass_webgpu.js +6 -6
- package/dist/vendor/zephyr3d/backend-webgpu/dist/renderpass_webgpu.js.map +1 -1
- package/dist/vendor/zephyr3d/base/dist/vfs/common.js +152 -152
- package/dist/vendor/zephyr3d/base/dist/vfs/common.js.map +1 -1
- package/dist/vendor/zephyr3d/device/dist/device.js +15 -15
- package/dist/vendor/zephyr3d/device/dist/device.js.map +1 -1
- package/dist/vendor/zephyr3d/loaders/dist/gltf/gltf_importer.js +6 -6
- package/dist/vendor/zephyr3d/loaders/dist/gltf/gltf_importer.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/animation/animationset.js +191 -194
- package/dist/vendor/zephyr3d/scene/dist/animation/animationset.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/animation/joint_dynamics_modifier.js +19 -19
- package/dist/vendor/zephyr3d/scene/dist/animation/joint_dynamics_modifier.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/app/engine.js +131 -131
- package/dist/vendor/zephyr3d/scene/dist/app/engine.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/app/scriptregistry.js +119 -119
- package/dist/vendor/zephyr3d/scene/dist/app/scriptregistry.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/asset/model.js +62 -62
- package/dist/vendor/zephyr3d/scene/dist/asset/model.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/avatar/wardrobe.js +13 -13
- package/dist/vendor/zephyr3d/scene/dist/avatar/wardrobe.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/camera/camera.js +201 -201
- package/dist/vendor/zephyr3d/scene/dist/camera/camera.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/index.d.ts +1 -1
- package/dist/vendor/zephyr3d/scene/dist/material/mixins/lightmodel/pbrmetallicroughness.js +5 -5
- package/dist/vendor/zephyr3d/scene/dist/material/mixins/lightmodel/pbrmetallicroughness.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/material/mtoon.js +4 -4
- package/dist/vendor/zephyr3d/scene/dist/material/mtoon.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/material/pbrblueprint.js +11 -11
- package/dist/vendor/zephyr3d/scene/dist/material/pbrblueprint.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/material/shader/helper.js +284 -284
- package/dist/vendor/zephyr3d/scene/dist/material/shader/helper.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/posteffect/ssr.js +9 -9
- package/dist/vendor/zephyr3d/scene/dist/posteffect/ssr.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/render/lightpass.js +5 -5
- package/dist/vendor/zephyr3d/scene/dist/render/lightpass.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/render/renderer.js +7 -7
- package/dist/vendor/zephyr3d/scene/dist/render/renderer.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/shadow/esm.js +1 -1
- package/dist/vendor/zephyr3d/scene/dist/shadow/esm.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/shadow/shadow_region.js +45 -45
- package/dist/vendor/zephyr3d/scene/dist/shadow/shadow_region.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/utility/serialization/manager.js +275 -275
- package/dist/vendor/zephyr3d/scene/dist/utility/serialization/manager.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/mesh.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/sprite.js.map +1 -1
- package/package.json +3 -3
- package/dist/vendor/zephyr3d/scene/dist/animation/joint_dynamics/convex_collider.js +0 -320
- package/dist/vendor/zephyr3d/scene/dist/animation/joint_dynamics/convex_collider.js.map +0 -1
|
@@ -6137,25 +6137,25 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
6137
6137
|
dstClip.addTrack(remap.dstNode, track);
|
|
6138
6138
|
}
|
|
6139
6139
|
}
|
|
6140
|
-
/**
|
|
6141
|
-
* Animation set
|
|
6142
|
-
*
|
|
6143
|
-
* Manages a collection of named animation clips for a model and orchestrates:
|
|
6144
|
-
* - Playback state (time, loops, speed, weights, fade-in/out).
|
|
6145
|
-
* - Blending across multiple tracks targeting the same property via weighted averages.
|
|
6146
|
-
* - Skeleton usage and application for clips that drive skeletal animation.
|
|
6147
|
-
* - Active track registration and cleanup as clips start/stop.
|
|
6148
|
-
*
|
|
6149
|
-
* Usage:
|
|
6150
|
-
* - Create or retrieve `AnimationClip`s by name.
|
|
6151
|
-
* - Start playback with `playAnimation(name, options)`.
|
|
6152
|
-
* - Advance animation with `update(deltaSeconds)`.
|
|
6153
|
-
* - Optionally adjust weight while playing with `setAnimationWeight(name, weight)`.
|
|
6154
|
-
*
|
|
6155
|
-
* Lifetime:
|
|
6156
|
-
* - Disposing the set releases references to the model, clips, and clears active state.
|
|
6157
|
-
*
|
|
6158
|
-
* @public
|
|
6140
|
+
/**
|
|
6141
|
+
* Animation set
|
|
6142
|
+
*
|
|
6143
|
+
* Manages a collection of named animation clips for a model and orchestrates:
|
|
6144
|
+
* - Playback state (time, loops, speed, weights, fade-in/out).
|
|
6145
|
+
* - Blending across multiple tracks targeting the same property via weighted averages.
|
|
6146
|
+
* - Skeleton usage and application for clips that drive skeletal animation.
|
|
6147
|
+
* - Active track registration and cleanup as clips start/stop.
|
|
6148
|
+
*
|
|
6149
|
+
* Usage:
|
|
6150
|
+
* - Create or retrieve `AnimationClip`s by name.
|
|
6151
|
+
* - Start playback with `playAnimation(name, options)`.
|
|
6152
|
+
* - Advance animation with `update(deltaSeconds)`.
|
|
6153
|
+
* - Optionally adjust weight while playing with `setAnimationWeight(name, weight)`.
|
|
6154
|
+
*
|
|
6155
|
+
* Lifetime:
|
|
6156
|
+
* - Disposing the set releases references to the model, clips, and clears active state.
|
|
6157
|
+
*
|
|
6158
|
+
* @public
|
|
6159
6159
|
*/ class AnimationSet extends Disposable {
|
|
6160
6160
|
/** @internal */ _model;
|
|
6161
6161
|
/** @internal */ _animations;
|
|
@@ -6165,10 +6165,10 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
6165
6165
|
/** @internal */ _activeSkinBindings;
|
|
6166
6166
|
/** @internal */ _activeRigs;
|
|
6167
6167
|
/** @internal */ _activeAnimations;
|
|
6168
|
-
/**
|
|
6169
|
-
* Create an AnimationSet controlling the provided model.
|
|
6170
|
-
*
|
|
6171
|
-
* @param model - The SceneNode (model root) controlled by this animation set.
|
|
6168
|
+
/**
|
|
6169
|
+
* Create an AnimationSet controlling the provided model.
|
|
6170
|
+
*
|
|
6171
|
+
* @param model - The SceneNode (model root) controlled by this animation set.
|
|
6172
6172
|
*/ constructor(model){
|
|
6173
6173
|
super();
|
|
6174
6174
|
this._model = model;
|
|
@@ -6180,28 +6180,28 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
6180
6180
|
this._skeletons = [];
|
|
6181
6181
|
this._rigs = [];
|
|
6182
6182
|
}
|
|
6183
|
-
/**
|
|
6184
|
-
* The model (SceneNode) controlled by this animation set.
|
|
6183
|
+
/**
|
|
6184
|
+
* The model (SceneNode) controlled by this animation set.
|
|
6185
6185
|
*/ get model() {
|
|
6186
6186
|
return this._model;
|
|
6187
6187
|
}
|
|
6188
|
-
/**
|
|
6189
|
-
* Number of animation clips registered in this set.
|
|
6188
|
+
/**
|
|
6189
|
+
* Number of animation clips registered in this set.
|
|
6190
6190
|
*/ get numAnimations() {
|
|
6191
6191
|
return Object.getOwnPropertyNames(this._animations).length;
|
|
6192
6192
|
}
|
|
6193
|
-
/**
|
|
6194
|
-
* The skeletons used by animations in this set.
|
|
6193
|
+
/**
|
|
6194
|
+
* The skeletons used by animations in this set.
|
|
6195
6195
|
*/ get skeletons() {
|
|
6196
6196
|
return this._skeletons;
|
|
6197
6197
|
}
|
|
6198
|
-
/**
|
|
6199
|
-
* The shared rigs used by animations in this set.
|
|
6198
|
+
/**
|
|
6199
|
+
* The shared rigs used by animations in this set.
|
|
6200
6200
|
*/ get rigs() {
|
|
6201
6201
|
return this._rigs;
|
|
6202
6202
|
}
|
|
6203
|
-
/**
|
|
6204
|
-
* Per-skin bindings used by skinned meshes in this set.
|
|
6203
|
+
/**
|
|
6204
|
+
* Per-skin bindings used by skinned meshes in this set.
|
|
6205
6205
|
*/ get skinBindings() {
|
|
6206
6206
|
return this._skeletons;
|
|
6207
6207
|
}
|
|
@@ -6223,20 +6223,20 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
6223
6223
|
}
|
|
6224
6224
|
return rig;
|
|
6225
6225
|
}
|
|
6226
|
-
/**
|
|
6227
|
-
* Retrieve an animation clip by name.
|
|
6228
|
-
*
|
|
6229
|
-
* @param name - Name of the animation.
|
|
6230
|
-
* @returns The clip if present; otherwise null.
|
|
6226
|
+
/**
|
|
6227
|
+
* Retrieve an animation clip by name.
|
|
6228
|
+
*
|
|
6229
|
+
* @param name - Name of the animation.
|
|
6230
|
+
* @returns The clip if present; otherwise null.
|
|
6231
6231
|
*/ get(name) {
|
|
6232
6232
|
return this._animations[name] ?? null;
|
|
6233
6233
|
}
|
|
6234
|
-
/**
|
|
6235
|
-
* Create and register a new animation clip.
|
|
6236
|
-
*
|
|
6237
|
-
* @param name - Unique name for the animation clip.
|
|
6238
|
-
* @param embedded - Whether the clip is embedded/owned (implementation-specific). Default false.
|
|
6239
|
-
* @returns The created clip, or null if the name is empty or not unique.
|
|
6234
|
+
/**
|
|
6235
|
+
* Create and register a new animation clip.
|
|
6236
|
+
*
|
|
6237
|
+
* @param name - Unique name for the animation clip.
|
|
6238
|
+
* @param embedded - Whether the clip is embedded/owned (implementation-specific). Default false.
|
|
6239
|
+
* @returns The created clip, or null if the name is empty or not unique.
|
|
6240
6240
|
*/ createAnimation(name, embedded = false) {
|
|
6241
6241
|
if (!name || this._animations[name]) {
|
|
6242
6242
|
console.error('Animation must have unique name');
|
|
@@ -6248,12 +6248,12 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
6248
6248
|
return animation;
|
|
6249
6249
|
}
|
|
6250
6250
|
}
|
|
6251
|
-
/**
|
|
6252
|
-
* Delete and dispose an animation clip by name.
|
|
6253
|
-
*
|
|
6254
|
-
* - If the animation is currently playing, it is first stopped (immediately).
|
|
6255
|
-
*
|
|
6256
|
-
* @param name - Name of the animation to remove.
|
|
6251
|
+
/**
|
|
6252
|
+
* Delete and dispose an animation clip by name.
|
|
6253
|
+
*
|
|
6254
|
+
* - If the animation is currently playing, it is first stopped (immediately).
|
|
6255
|
+
*
|
|
6256
|
+
* @param name - Name of the animation to remove.
|
|
6257
6257
|
*/ deleteAnimation(name) {
|
|
6258
6258
|
const animation = this._animations[name];
|
|
6259
6259
|
if (animation) {
|
|
@@ -6262,24 +6262,24 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
6262
6262
|
animation.dispose();
|
|
6263
6263
|
}
|
|
6264
6264
|
}
|
|
6265
|
-
/**
|
|
6266
|
-
* Get the list of all registered animation names.
|
|
6267
|
-
*
|
|
6268
|
-
* @returns An array of clip names.
|
|
6265
|
+
/**
|
|
6266
|
+
* Get the list of all registered animation names.
|
|
6267
|
+
*
|
|
6268
|
+
* @returns An array of clip names.
|
|
6269
6269
|
*/ getAnimationNames() {
|
|
6270
6270
|
return Object.keys(this._animations);
|
|
6271
6271
|
}
|
|
6272
|
-
/**
|
|
6273
|
-
* Advance and apply active animations.
|
|
6274
|
-
*
|
|
6275
|
-
* Responsibilities per call:
|
|
6276
|
-
* - Update time cursor for each active clip (respecting speedRatio and looping).
|
|
6277
|
-
* - Enforce repeat limits and apply fade-out termination if configured.
|
|
6278
|
-
* - For each animated target, blend active tracks (weighted by clip weight × fade-in × fade-out)
|
|
6279
|
-
* and apply the resulting state to the target.
|
|
6280
|
-
* - Apply shared rig modifiers once, then update skin binding palettes.
|
|
6281
|
-
*
|
|
6282
|
-
* @param deltaInSeconds - Time step in seconds since last update.
|
|
6272
|
+
/**
|
|
6273
|
+
* Advance and apply active animations.
|
|
6274
|
+
*
|
|
6275
|
+
* Responsibilities per call:
|
|
6276
|
+
* - Update time cursor for each active clip (respecting speedRatio and looping).
|
|
6277
|
+
* - Enforce repeat limits and apply fade-out termination if configured.
|
|
6278
|
+
* - For each animated target, blend active tracks (weighted by clip weight × fade-in × fade-out)
|
|
6279
|
+
* and apply the resulting state to the target.
|
|
6280
|
+
* - Apply shared rig modifiers once, then update skin binding palettes.
|
|
6281
|
+
*
|
|
6282
|
+
* @param deltaInSeconds - Time step in seconds since last update.
|
|
6283
6283
|
*/ update(deltaInSeconds) {
|
|
6284
6284
|
this._activeAnimations.forEach((v, k)=>{
|
|
6285
6285
|
if (v.fadeOut > 0 && v.fadeOutStart < 0) {
|
|
@@ -6346,11 +6346,11 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
6346
6346
|
v.get()?.apply();
|
|
6347
6347
|
});
|
|
6348
6348
|
}
|
|
6349
|
-
/**
|
|
6350
|
-
* Check whether an animation is currently playing.
|
|
6351
|
-
*
|
|
6352
|
-
* @param name - Optional animation name. If omitted, returns true if any animation is playing.
|
|
6353
|
-
* @returns True if playing; otherwise false.
|
|
6349
|
+
/**
|
|
6350
|
+
* Check whether an animation is currently playing.
|
|
6351
|
+
*
|
|
6352
|
+
* @param name - Optional animation name. If omitted, returns true if any animation is playing.
|
|
6353
|
+
* @returns True if playing; otherwise false.
|
|
6354
6354
|
*/ isPlayingAnimation(name) {
|
|
6355
6355
|
if (name) {
|
|
6356
6356
|
const animation = this._animations[name];
|
|
@@ -6358,23 +6358,23 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
6358
6358
|
}
|
|
6359
6359
|
return this._activeAnimations.size > 0;
|
|
6360
6360
|
}
|
|
6361
|
-
/**
|
|
6362
|
-
* Get an animation clip by name.
|
|
6363
|
-
*
|
|
6364
|
-
* Alias of `get(name)` returning a nullable type.
|
|
6365
|
-
*
|
|
6366
|
-
* @param name - Name of the animation.
|
|
6367
|
-
* @returns The clip if present; otherwise null.
|
|
6361
|
+
/**
|
|
6362
|
+
* Get an animation clip by name.
|
|
6363
|
+
*
|
|
6364
|
+
* Alias of `get(name)` returning a nullable type.
|
|
6365
|
+
*
|
|
6366
|
+
* @param name - Name of the animation.
|
|
6367
|
+
* @returns The clip if present; otherwise null.
|
|
6368
6368
|
*/ getAnimationClip(name) {
|
|
6369
6369
|
return this._animations[name] ?? null;
|
|
6370
6370
|
}
|
|
6371
|
-
/**
|
|
6372
|
-
* Set the runtime blend weight for a currently playing animation.
|
|
6373
|
-
*
|
|
6374
|
-
* Has no effect if the clip is not active.
|
|
6375
|
-
*
|
|
6376
|
-
* @param name - Name of the playing animation.
|
|
6377
|
-
* @param weight - New weight value used during blending.
|
|
6371
|
+
/**
|
|
6372
|
+
* Set the runtime blend weight for a currently playing animation.
|
|
6373
|
+
*
|
|
6374
|
+
* Has no effect if the clip is not active.
|
|
6375
|
+
*
|
|
6376
|
+
* @param name - Name of the playing animation.
|
|
6377
|
+
* @param weight - New weight value used during blending.
|
|
6378
6378
|
*/ setAnimationWeight(name, weight) {
|
|
6379
6379
|
const ani = this._animations[name];
|
|
6380
6380
|
if (!ani) {
|
|
@@ -6386,91 +6386,88 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
6386
6386
|
info.weight = weight;
|
|
6387
6387
|
}
|
|
6388
6388
|
}
|
|
6389
|
-
/**
|
|
6390
|
-
* Start (or update) playback of an animation clip.
|
|
6391
|
-
*
|
|
6392
|
-
* Behavior:
|
|
6393
|
-
* - If the clip is already playing,
|
|
6394
|
-
* - Otherwise initializes playback state (repeat counter, speed, weight, initial time).
|
|
6395
|
-
* - Registers clip tracks and skeletons into the active sets for blending and application.
|
|
6396
|
-
*
|
|
6397
|
-
* @param name - Name of the animation to play.
|
|
6398
|
-
* @param options - Playback options (repeat, speedRatio, fadeIn).
|
|
6389
|
+
/**
|
|
6390
|
+
* Start (or update) playback of an animation clip.
|
|
6391
|
+
*
|
|
6392
|
+
* Behavior:
|
|
6393
|
+
* - If the clip is already playing, stops it first.
|
|
6394
|
+
* - Otherwise initializes playback state (repeat counter, speed, weight, initial time).
|
|
6395
|
+
* - Registers clip tracks and skeletons into the active sets for blending and application.
|
|
6396
|
+
*
|
|
6397
|
+
* @param name - Name of the animation to play.
|
|
6398
|
+
* @param options - Playback options (repeat, speedRatio, fadeIn).
|
|
6399
6399
|
*/ playAnimation(name, options) {
|
|
6400
6400
|
const ani = this._animations[name];
|
|
6401
6401
|
if (!ani) {
|
|
6402
6402
|
console.error(`Animation ${name} not exists`);
|
|
6403
6403
|
return;
|
|
6404
6404
|
}
|
|
6405
|
+
if (this.isPlayingAnimation(name)) {
|
|
6406
|
+
this.stopAnimation(name);
|
|
6407
|
+
}
|
|
6405
6408
|
const fadeIn = Math.max(options?.fadeIn ?? 0, 0);
|
|
6406
|
-
const
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
const blendId = track.getBlendId();
|
|
6434
|
-
let blendedTracks = nodeTracks.get(blendId);
|
|
6435
|
-
if (!blendedTracks) {
|
|
6436
|
-
blendedTracks = [];
|
|
6437
|
-
nodeTracks.set(blendId, blendedTracks);
|
|
6438
|
-
}
|
|
6439
|
-
blendedTracks.push(track);
|
|
6440
|
-
}
|
|
6441
|
-
});
|
|
6442
|
-
ani.skeletons?.forEach((v, k)=>{
|
|
6443
|
-
const rig = this.model.findSkeletonRigById(k);
|
|
6444
|
-
if (rig) {
|
|
6445
|
-
const refcount = this._activeRigs.get(rig);
|
|
6446
|
-
this._activeRigs.set(rig, refcount ? refcount + 1 : 1);
|
|
6447
|
-
rig.playing = true;
|
|
6448
|
-
return;
|
|
6449
|
-
}
|
|
6450
|
-
const binding = this.model.findSkinBindingById(k);
|
|
6451
|
-
if (binding) {
|
|
6452
|
-
const refcount = this._activeSkinBindings.get(binding);
|
|
6453
|
-
this._activeSkinBindings.set(binding, refcount ? refcount + 1 : 1);
|
|
6454
|
-
binding.playing = true;
|
|
6455
|
-
const rigRefcount = this._activeRigs.get(binding.rig);
|
|
6456
|
-
this._activeRigs.set(binding.rig, rigRefcount ? rigRefcount + 1 : 1);
|
|
6457
|
-
binding.rig.playing = true;
|
|
6409
|
+
const repeat = options?.repeat ?? 0;
|
|
6410
|
+
const speedRatio = options?.speedRatio ?? 1;
|
|
6411
|
+
const weight = options?.weight ?? ani.weight ?? 1;
|
|
6412
|
+
this._activeAnimations.set(ani, {
|
|
6413
|
+
repeat,
|
|
6414
|
+
weight,
|
|
6415
|
+
speedRatio,
|
|
6416
|
+
fadeIn,
|
|
6417
|
+
fadeOut: 0,
|
|
6418
|
+
repeatCounter: 0,
|
|
6419
|
+
currentTime: speedRatio < 0 ? ani.timeDuration : 0,
|
|
6420
|
+
animateTime: 0,
|
|
6421
|
+
fadeOutStart: 0,
|
|
6422
|
+
firstFrame: true
|
|
6423
|
+
});
|
|
6424
|
+
ani.tracks?.forEach((v, k)=>{
|
|
6425
|
+
let nodeTracks = this._activeTracks.get(k);
|
|
6426
|
+
if (!nodeTracks) {
|
|
6427
|
+
nodeTracks = new Map();
|
|
6428
|
+
this._activeTracks.set(k, nodeTracks);
|
|
6429
|
+
}
|
|
6430
|
+
for (const track of v){
|
|
6431
|
+
const blendId = track.getBlendId();
|
|
6432
|
+
let blendedTracks = nodeTracks.get(blendId);
|
|
6433
|
+
if (!blendedTracks) {
|
|
6434
|
+
blendedTracks = [];
|
|
6435
|
+
nodeTracks.set(blendId, blendedTracks);
|
|
6458
6436
|
}
|
|
6459
|
-
|
|
6460
|
-
|
|
6437
|
+
blendedTracks.push(track);
|
|
6438
|
+
}
|
|
6439
|
+
});
|
|
6440
|
+
ani.skeletons?.forEach((v, k)=>{
|
|
6441
|
+
const rig = this.model.findSkeletonRigById(k);
|
|
6442
|
+
if (rig) {
|
|
6443
|
+
const refcount = this._activeRigs.get(rig);
|
|
6444
|
+
this._activeRigs.set(rig, refcount ? refcount + 1 : 1);
|
|
6445
|
+
rig.playing = true;
|
|
6446
|
+
return;
|
|
6447
|
+
}
|
|
6448
|
+
const binding = this.model.findSkinBindingById(k);
|
|
6449
|
+
if (binding) {
|
|
6450
|
+
const refcount = this._activeSkinBindings.get(binding);
|
|
6451
|
+
this._activeSkinBindings.set(binding, refcount ? refcount + 1 : 1);
|
|
6452
|
+
binding.playing = true;
|
|
6453
|
+
const rigRefcount = this._activeRigs.get(binding.rig);
|
|
6454
|
+
this._activeRigs.set(binding.rig, rigRefcount ? rigRefcount + 1 : 1);
|
|
6455
|
+
binding.rig.playing = true;
|
|
6456
|
+
}
|
|
6457
|
+
});
|
|
6461
6458
|
}
|
|
6462
|
-
/**
|
|
6463
|
-
* Stop playback of an animation clip.
|
|
6464
|
-
*
|
|
6465
|
-
* Behavior:
|
|
6466
|
-
* - If `options.fadeOut > 0`, marks the clip for fade-out; actual removal occurs after fade completes.
|
|
6467
|
-
* - If `fadeOut` is 0 or omitted, immediately:
|
|
6468
|
-
* - Removes the clip from active animations.
|
|
6469
|
-
* - Unregisters its tracks from active track maps.
|
|
6470
|
-
* - Decrements skeleton reference counts; resets and removes skeletons when refcount reaches 0.
|
|
6471
|
-
*
|
|
6472
|
-
* @param name - Name of the animation to stop.
|
|
6473
|
-
* @param options - Optional fade-out configuration.
|
|
6459
|
+
/**
|
|
6460
|
+
* Stop playback of an animation clip.
|
|
6461
|
+
*
|
|
6462
|
+
* Behavior:
|
|
6463
|
+
* - If `options.fadeOut > 0`, marks the clip for fade-out; actual removal occurs after fade completes.
|
|
6464
|
+
* - If `fadeOut` is 0 or omitted, immediately:
|
|
6465
|
+
* - Removes the clip from active animations.
|
|
6466
|
+
* - Unregisters its tracks from active track maps.
|
|
6467
|
+
* - Decrements skeleton reference counts; resets and removes skeletons when refcount reaches 0.
|
|
6468
|
+
*
|
|
6469
|
+
* @param name - Name of the animation to stop.
|
|
6470
|
+
* @param options - Optional fade-out configuration.
|
|
6474
6471
|
*/ stopAnimation(name, options) {
|
|
6475
6472
|
const ani = this._animations[name];
|
|
6476
6473
|
if (!ani) {
|
|
@@ -6523,17 +6520,17 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
6523
6520
|
}
|
|
6524
6521
|
}
|
|
6525
6522
|
}
|
|
6526
|
-
/**
|
|
6527
|
-
* Create a skeletal-only masked clip from an existing clip in this set.
|
|
6528
|
-
*
|
|
6529
|
-
* The generated clip is a regular `AnimationClip`: it contains cloned node transform tracks
|
|
6530
|
-
* for the selected rig joints and can be played/blended through the normal animation system.
|
|
6531
|
-
* Non-skeletal tracks are skipped by default.
|
|
6532
|
-
*
|
|
6533
|
-
* @param sourceName - Name of the source clip.
|
|
6534
|
-
* @param targetName - Name of the generated clip.
|
|
6535
|
-
* @param options - Humanoid semantic or joint-name based mask options.
|
|
6536
|
-
* @returns The generated clip, or null on failure.
|
|
6523
|
+
/**
|
|
6524
|
+
* Create a skeletal-only masked clip from an existing clip in this set.
|
|
6525
|
+
*
|
|
6526
|
+
* The generated clip is a regular `AnimationClip`: it contains cloned node transform tracks
|
|
6527
|
+
* for the selected rig joints and can be played/blended through the normal animation system.
|
|
6528
|
+
* Non-skeletal tracks are skipped by default.
|
|
6529
|
+
*
|
|
6530
|
+
* @param sourceName - Name of the source clip.
|
|
6531
|
+
* @param targetName - Name of the generated clip.
|
|
6532
|
+
* @param options - Humanoid semantic or joint-name based mask options.
|
|
6533
|
+
* @returns The generated clip, or null on failure.
|
|
6537
6534
|
*/ createSkeletalMaskedAnimation(sourceName, targetName, options) {
|
|
6538
6535
|
const sourceClip = this.get(sourceName);
|
|
6539
6536
|
if (!sourceClip) {
|
|
@@ -6740,21 +6737,21 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
6740
6737
|
}
|
|
6741
6738
|
return dstClip;
|
|
6742
6739
|
}
|
|
6743
|
-
/**
|
|
6744
|
-
* Copy an animation clip from another AnimationSet into this one.
|
|
6745
|
-
*
|
|
6746
|
-
* Prerequisites:
|
|
6747
|
-
* - Both sets must reference skeletons with identical joint names and counts.
|
|
6748
|
-
* - The source clip must exist in `sourceSet`.
|
|
6749
|
-
*
|
|
6750
|
-
* @param sourceSet - The AnimationSet to copy from.
|
|
6751
|
-
* @param animationName - Name of the clip to copy.
|
|
6752
|
-
* @param targetName - Name for the new clip in this set. Defaults to `animationName`.
|
|
6753
|
-
* @param excludeJoint - Optional predicate; joints whose name returns true are excluded from
|
|
6754
|
-
* skeleton structure matching.
|
|
6755
|
-
* @returns The newly created AnimationClip, or null on failure.
|
|
6756
|
-
*
|
|
6757
|
-
* @deprecated Use AnimationSet.copyHumanoidAnimationFrom instead.
|
|
6740
|
+
/**
|
|
6741
|
+
* Copy an animation clip from another AnimationSet into this one.
|
|
6742
|
+
*
|
|
6743
|
+
* Prerequisites:
|
|
6744
|
+
* - Both sets must reference skeletons with identical joint names and counts.
|
|
6745
|
+
* - The source clip must exist in `sourceSet`.
|
|
6746
|
+
*
|
|
6747
|
+
* @param sourceSet - The AnimationSet to copy from.
|
|
6748
|
+
* @param animationName - Name of the clip to copy.
|
|
6749
|
+
* @param targetName - Name for the new clip in this set. Defaults to `animationName`.
|
|
6750
|
+
* @param excludeJoint - Optional predicate; joints whose name returns true are excluded from
|
|
6751
|
+
* skeleton structure matching.
|
|
6752
|
+
* @returns The newly created AnimationClip, or null on failure.
|
|
6753
|
+
*
|
|
6754
|
+
* @deprecated Use AnimationSet.copyHumanoidAnimationFrom instead.
|
|
6758
6755
|
*/ copyAnimationFrom(sourceSet, animationName, targetName, excludeJoint) {
|
|
6759
6756
|
const destName = targetName ?? animationName;
|
|
6760
6757
|
const sourceClip = sourceSet.get(animationName);
|
|
@@ -6900,8 +6897,8 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
6900
6897
|
return ordered;
|
|
6901
6898
|
}
|
|
6902
6899
|
}
|
|
6903
|
-
/**
|
|
6904
|
-
* Reset all skeleton modifiers
|
|
6900
|
+
/**
|
|
6901
|
+
* Reset all skeleton modifiers
|
|
6905
6902
|
*/ resetSkeletonModifiers() {
|
|
6906
6903
|
for (const sk of this._skeletons){
|
|
6907
6904
|
for (const modifier of sk.get().modifiers){
|
|
@@ -6909,12 +6906,12 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
6909
6906
|
}
|
|
6910
6907
|
}
|
|
6911
6908
|
}
|
|
6912
|
-
/**
|
|
6913
|
-
* Dispose the animation set and release owned resources.
|
|
6914
|
-
*
|
|
6915
|
-
* - Disposes the weak reference to the model.
|
|
6916
|
-
* - Disposes all registered animation clips.
|
|
6917
|
-
* - Clears active animations, tracks, and skeleton references.
|
|
6909
|
+
/**
|
|
6910
|
+
* Dispose the animation set and release owned resources.
|
|
6911
|
+
*
|
|
6912
|
+
* - Disposes the weak reference to the model.
|
|
6913
|
+
* - Disposes all registered animation clips.
|
|
6914
|
+
* - Clears active animations, tracks, and skeleton references.
|
|
6918
6915
|
*/ onDispose() {
|
|
6919
6916
|
super.onDispose();
|
|
6920
6917
|
for(const k in this._animations){
|
|
@@ -10328,9 +10325,9 @@ const UNIFORM_NAME_BONE_TEXTURE_SIZE = 'Z_UniformBoneTexSize';
|
|
|
10328
10325
|
const UNIFORM_NAME_BONE_INV_BIND_MATRIX = 'Z_UniformBoneInvBindMatrix';
|
|
10329
10326
|
const UNIFORM_NAME_MORPH_DATA = 'Z_UniformMorphData';
|
|
10330
10327
|
const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
10331
|
-
/**
|
|
10332
|
-
* Helper shader functions for the builtin material system
|
|
10333
|
-
* @public
|
|
10328
|
+
/**
|
|
10329
|
+
* Helper shader functions for the builtin material system
|
|
10330
|
+
* @public
|
|
10334
10331
|
*/ class ShaderHelper {
|
|
10335
10332
|
static BILLBOARD_SPHERICAL = 1;
|
|
10336
10333
|
static BILLBOARD_SYLINDRAL = 2;
|
|
@@ -10421,25 +10418,25 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
10421
10418
|
}
|
|
10422
10419
|
return bindGroupLayout;
|
|
10423
10420
|
}
|
|
10424
|
-
/**
|
|
10425
|
-
* Prepares the fragment shader which is going to be used in our material system
|
|
10426
|
-
*
|
|
10427
|
-
* @remarks
|
|
10428
|
-
* This function will setup all nessesary uniforms acoording to the drawing context
|
|
10429
|
-
*
|
|
10430
|
-
* @param pb - The program builder
|
|
10431
|
-
* @param ctx - The drawing context
|
|
10421
|
+
/**
|
|
10422
|
+
* Prepares the fragment shader which is going to be used in our material system
|
|
10423
|
+
*
|
|
10424
|
+
* @remarks
|
|
10425
|
+
* This function will setup all nessesary uniforms acoording to the drawing context
|
|
10426
|
+
*
|
|
10427
|
+
* @param pb - The program builder
|
|
10428
|
+
* @param ctx - The drawing context
|
|
10432
10429
|
*/ static prepareFragmentShader(pb, ctx) {
|
|
10433
10430
|
this.setupGlobalUniforms(pb, ctx);
|
|
10434
10431
|
}
|
|
10435
|
-
/**
|
|
10436
|
-
* Prepares the vertex shader which is going to be used in our material system
|
|
10437
|
-
*
|
|
10438
|
-
* @remarks
|
|
10439
|
-
* This function will setup all nessesary uniforms according to the drawing context
|
|
10440
|
-
*
|
|
10441
|
-
* @param pb - The program builder
|
|
10442
|
-
* @param ctx - The drawing context
|
|
10432
|
+
/**
|
|
10433
|
+
* Prepares the vertex shader which is going to be used in our material system
|
|
10434
|
+
*
|
|
10435
|
+
* @remarks
|
|
10436
|
+
* This function will setup all nessesary uniforms according to the drawing context
|
|
10437
|
+
*
|
|
10438
|
+
* @param pb - The program builder
|
|
10439
|
+
* @param ctx - The drawing context
|
|
10443
10440
|
*/ static prepareVertexShader(pb, ctx) {
|
|
10444
10441
|
this.setupGlobalUniforms(pb, ctx);
|
|
10445
10442
|
this.prepareVertexShaderCommon(pb, ctx);
|
|
@@ -10551,30 +10548,30 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
10551
10548
|
}
|
|
10552
10549
|
}
|
|
10553
10550
|
}
|
|
10554
|
-
/**
|
|
10555
|
-
* This function checks if the shader needs to process skeletal animation.
|
|
10556
|
-
*
|
|
10557
|
-
* @param scope - Current shader scope
|
|
10558
|
-
*
|
|
10559
|
-
* @returns true if the shader needs to process skeletal animation, otherwise false.
|
|
10551
|
+
/**
|
|
10552
|
+
* This function checks if the shader needs to process skeletal animation.
|
|
10553
|
+
*
|
|
10554
|
+
* @param scope - Current shader scope
|
|
10555
|
+
*
|
|
10556
|
+
* @returns true if the shader needs to process skeletal animation, otherwise false.
|
|
10560
10557
|
*/ static hasSkinning(scope) {
|
|
10561
10558
|
return !!scope[UNIFORM_NAME_BONE_MATRICES];
|
|
10562
10559
|
}
|
|
10563
|
-
/**
|
|
10564
|
-
* This function checks if the shader needs to process morph target animation.
|
|
10565
|
-
*
|
|
10566
|
-
* @param scope - Current shader scope
|
|
10567
|
-
*
|
|
10568
|
-
* @returns true if the shader needs to process morph target animation, otherwise false.
|
|
10560
|
+
/**
|
|
10561
|
+
* This function checks if the shader needs to process morph target animation.
|
|
10562
|
+
*
|
|
10563
|
+
* @param scope - Current shader scope
|
|
10564
|
+
*
|
|
10565
|
+
* @returns true if the shader needs to process morph target animation, otherwise false.
|
|
10569
10566
|
*/ static hasMorphing(scope) {
|
|
10570
10567
|
return !!scope[UNIFORM_NAME_MORPH_DATA];
|
|
10571
10568
|
}
|
|
10572
|
-
/**
|
|
10573
|
-
* Calculate skinning matrix for current vertex
|
|
10574
|
-
*
|
|
10575
|
-
* @param scope - Current shader scope
|
|
10576
|
-
*
|
|
10577
|
-
* @returns Skinning matrix for current vertex, or null if there is not skeletal animation
|
|
10569
|
+
/**
|
|
10570
|
+
* Calculate skinning matrix for current vertex
|
|
10571
|
+
*
|
|
10572
|
+
* @param scope - Current shader scope
|
|
10573
|
+
*
|
|
10574
|
+
* @returns Skinning matrix for current vertex, or null if there is not skeletal animation
|
|
10578
10575
|
*/ static calculateSkinMatrix(scope) {
|
|
10579
10576
|
if (!this.hasSkinning(scope)) {
|
|
10580
10577
|
return null;
|
|
@@ -10729,12 +10726,12 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
10729
10726
|
scope.$l[that.SKIN_PREV_MATRIX_NAME] = scope[funcNameGetSkinningMatrix](scope[that.SKIN_BONE_OFFSET].y);
|
|
10730
10727
|
}
|
|
10731
10728
|
}
|
|
10732
|
-
/**
|
|
10733
|
-
* Calculates the vertex position of type vec3 in object space
|
|
10734
|
-
*
|
|
10735
|
-
* @param scope - Current shader scope
|
|
10736
|
-
* @param skinMatrix - The skinning matrix if there is skeletal animation, otherwise null
|
|
10737
|
-
* @returns The calculated vertex position in object space, or null if pos is null
|
|
10729
|
+
/**
|
|
10730
|
+
* Calculates the vertex position of type vec3 in object space
|
|
10731
|
+
*
|
|
10732
|
+
* @param scope - Current shader scope
|
|
10733
|
+
* @param skinMatrix - The skinning matrix if there is skeletal animation, otherwise null
|
|
10734
|
+
* @returns The calculated vertex position in object space, or null if pos is null
|
|
10738
10735
|
*/ static resolveVertexPosition(scope) {
|
|
10739
10736
|
const pb = scope.$builder;
|
|
10740
10737
|
if (pb.shaderKind !== 'vertex') {
|
|
@@ -10776,12 +10773,12 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
10776
10773
|
});
|
|
10777
10774
|
return scope[that.SKIN_MATRIX_NAME] && scope[that.SKIN_PREV_MATRIX_NAME] ? scope.Z_resolveVertexPosition(scope[that.SKIN_MATRIX_NAME], scope[that.SKIN_PREV_MATRIX_NAME]) : scope[that.SKIN_MATRIX_NAME] ? scope.Z_resolveVertexPosition(scope[that.SKIN_MATRIX_NAME]) : scope.Z_resolveVertexPosition();
|
|
10778
10775
|
}
|
|
10779
|
-
/**
|
|
10780
|
-
* Resolve motion vector
|
|
10781
|
-
*
|
|
10782
|
-
* @param scope - Current shader scope
|
|
10783
|
-
* @param worldPos - Current object position in world space
|
|
10784
|
-
* @param prevWorldPos - Previous object position in world space
|
|
10776
|
+
/**
|
|
10777
|
+
* Resolve motion vector
|
|
10778
|
+
*
|
|
10779
|
+
* @param scope - Current shader scope
|
|
10780
|
+
* @param worldPos - Current object position in world space
|
|
10781
|
+
* @param prevWorldPos - Previous object position in world space
|
|
10785
10782
|
*/ static resolveMotionVector(scope, worldPos, prevWorldPos) {
|
|
10786
10783
|
const that = this;
|
|
10787
10784
|
const pb = scope.$builder;
|
|
@@ -10792,13 +10789,13 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
10792
10789
|
scope.$outputs.zMotionVectorPosPrev = pb.mul(prevUnjitteredVPMatrix, pb.vec4(prevWorldPos.xyz, 1));
|
|
10793
10790
|
}
|
|
10794
10791
|
}
|
|
10795
|
-
/**
|
|
10796
|
-
* Calculates the normal vector of type vec3 in object space
|
|
10797
|
-
*
|
|
10798
|
-
* @param scope - Current shader scope
|
|
10799
|
-
* @param normal - Vertex normal input, must be type of vec3, null if no vertex normal input
|
|
10800
|
-
* @param skinMatrix - The skinning matrix if there is skeletal animation, otherwise null
|
|
10801
|
-
* @returns The calculated normal vector in object space, or null if normal is null
|
|
10792
|
+
/**
|
|
10793
|
+
* Calculates the normal vector of type vec3 in object space
|
|
10794
|
+
*
|
|
10795
|
+
* @param scope - Current shader scope
|
|
10796
|
+
* @param normal - Vertex normal input, must be type of vec3, null if no vertex normal input
|
|
10797
|
+
* @param skinMatrix - The skinning matrix if there is skeletal animation, otherwise null
|
|
10798
|
+
* @returns The calculated normal vector in object space, or null if normal is null
|
|
10802
10799
|
*/ static resolveVertexNormal(scope, normal) {
|
|
10803
10800
|
const pb = scope.$builder;
|
|
10804
10801
|
if (pb.shaderKind !== 'vertex') {
|
|
@@ -10823,13 +10820,13 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
10823
10820
|
return normal;
|
|
10824
10821
|
}
|
|
10825
10822
|
}
|
|
10826
|
-
/**
|
|
10827
|
-
* Calculates the tangent vector of type vec3 in object space
|
|
10828
|
-
*
|
|
10829
|
-
* @param scope - Current shader scope
|
|
10830
|
-
* @param tangent - Vertex tangent input, must be type of vec4, null if no vertex tangent input
|
|
10831
|
-
* @param skinMatrix - The skinning matrix if there is skeletal animation, otherwise null
|
|
10832
|
-
* @returns The calculated tangent vector of type vec4 in object space, or null if tangent is null
|
|
10823
|
+
/**
|
|
10824
|
+
* Calculates the tangent vector of type vec3 in object space
|
|
10825
|
+
*
|
|
10826
|
+
* @param scope - Current shader scope
|
|
10827
|
+
* @param tangent - Vertex tangent input, must be type of vec4, null if no vertex tangent input
|
|
10828
|
+
* @param skinMatrix - The skinning matrix if there is skeletal animation, otherwise null
|
|
10829
|
+
* @returns The calculated tangent vector of type vec4 in object space, or null if tangent is null
|
|
10833
10830
|
*/ static resolveVertexTangent(scope, tangent) {
|
|
10834
10831
|
const pb = scope.$builder;
|
|
10835
10832
|
if (pb.shaderKind !== 'vertex') {
|
|
@@ -10854,18 +10851,18 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
10854
10851
|
return tangent;
|
|
10855
10852
|
}
|
|
10856
10853
|
}
|
|
10857
|
-
/**
|
|
10858
|
-
* Gets the uniform variable of type mat4 which holds the world matrix of current object to be drawn
|
|
10859
|
-
* @param scope - Current shader scope
|
|
10860
|
-
* @returns The world matrix of current object to be drawn
|
|
10854
|
+
/**
|
|
10855
|
+
* Gets the uniform variable of type mat4 which holds the world matrix of current object to be drawn
|
|
10856
|
+
* @param scope - Current shader scope
|
|
10857
|
+
* @returns The world matrix of current object to be drawn
|
|
10861
10858
|
*/ static getWorldMatrix(scope) {
|
|
10862
10859
|
const pb = scope.$builder;
|
|
10863
10860
|
return scope[UNIFORM_NAME_WORLD_MATRIX] ?? pb.mat4(this.getInstancedUniform(scope, 0), this.getInstancedUniform(scope, 1), this.getInstancedUniform(scope, 2), this.getInstancedUniform(scope, 3));
|
|
10864
10861
|
}
|
|
10865
|
-
/**
|
|
10866
|
-
* Gets the uniform variable of type mat4 which holds the world matrix at previous frame of current object to be drawn
|
|
10867
|
-
* @param scope - Current shader scope
|
|
10868
|
-
* @returns The world matrix at previous frame of current object to be drawn
|
|
10862
|
+
/**
|
|
10863
|
+
* Gets the uniform variable of type mat4 which holds the world matrix at previous frame of current object to be drawn
|
|
10864
|
+
* @param scope - Current shader scope
|
|
10865
|
+
* @returns The world matrix at previous frame of current object to be drawn
|
|
10869
10866
|
*/ static getPrevWorldMatrix(scope) {
|
|
10870
10867
|
const pb = scope.$builder;
|
|
10871
10868
|
const that = this;
|
|
@@ -10896,28 +10893,28 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
10896
10893
|
return scope.Z_getPrevWorldMatrix(framestamp);
|
|
10897
10894
|
}
|
|
10898
10895
|
}
|
|
10899
|
-
/**
|
|
10900
|
-
* Gets the instance uniform value of type vec4 by uniform index
|
|
10901
|
-
* @param scope - Current shader scope
|
|
10902
|
-
* @returns instance uniform value
|
|
10896
|
+
/**
|
|
10897
|
+
* Gets the instance uniform value of type vec4 by uniform index
|
|
10898
|
+
* @param scope - Current shader scope
|
|
10899
|
+
* @returns instance uniform value
|
|
10903
10900
|
*/ static getInstancedUniform(scope, uniformIndex) {
|
|
10904
10901
|
const pb = scope.$builder;
|
|
10905
10902
|
return scope[UNIFORM_NAME_INSTANCE_DATA].at(pb.add(pb.mul(scope[UNIFORM_NAME_INSTANCE_DATA_STRIDE], pb.uint(scope.$builtins.instanceIndex)), scope[UNIFORM_NAME_INSTANCE_DATA_OFFSET], pb.uint(uniformIndex)));
|
|
10906
10903
|
}
|
|
10907
|
-
/**
|
|
10908
|
-
* Gets the uniform variable of type mat4 which holds the normal matrix of current object to be drawn
|
|
10909
|
-
*
|
|
10910
|
-
* @param scope - Current shader scope
|
|
10911
|
-
* @returns The normal matrix of current object to be drawn
|
|
10904
|
+
/**
|
|
10905
|
+
* Gets the uniform variable of type mat4 which holds the normal matrix of current object to be drawn
|
|
10906
|
+
*
|
|
10907
|
+
* @param scope - Current shader scope
|
|
10908
|
+
* @returns The normal matrix of current object to be drawn
|
|
10912
10909
|
*/ static getNormalMatrix(scope) {
|
|
10913
10910
|
return this.getWorldMatrix(scope);
|
|
10914
10911
|
}
|
|
10915
|
-
/**
|
|
10916
|
-
* Vertex shader drawable stuff
|
|
10917
|
-
*
|
|
10918
|
-
* @param scope - Current shader scope
|
|
10919
|
-
* @param skinning - true if skinning is used, otherwise false.
|
|
10920
|
-
* @param instanced - true if instancing is used, otherwise false.
|
|
10912
|
+
/**
|
|
10913
|
+
* Vertex shader drawable stuff
|
|
10914
|
+
*
|
|
10915
|
+
* @param scope - Current shader scope
|
|
10916
|
+
* @param skinning - true if skinning is used, otherwise false.
|
|
10917
|
+
* @param instanced - true if instancing is used, otherwise false.
|
|
10921
10918
|
*/ static vertexShaderDrawableStuff(scope, skinning, morphing, instanced) {
|
|
10922
10919
|
const pb = scope.$builder;
|
|
10923
10920
|
if (instanced) {
|
|
@@ -11048,144 +11045,144 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
11048
11045
|
ctx.env.light.envLight.updateBindGroup(bindGroup);
|
|
11049
11046
|
}
|
|
11050
11047
|
}
|
|
11051
|
-
/**
|
|
11052
|
-
* Gets the uniform variable of type float which holds the strength of the environment light
|
|
11053
|
-
*
|
|
11054
|
-
* @remarks
|
|
11055
|
-
* This function can only be used in the fragment shader
|
|
11056
|
-
*
|
|
11057
|
-
* @param scope - Current shader scope
|
|
11058
|
-
* @returns The uniform variable of which presents the strength of the environment light
|
|
11048
|
+
/**
|
|
11049
|
+
* Gets the uniform variable of type float which holds the strength of the environment light
|
|
11050
|
+
*
|
|
11051
|
+
* @remarks
|
|
11052
|
+
* This function can only be used in the fragment shader
|
|
11053
|
+
*
|
|
11054
|
+
* @param scope - Current shader scope
|
|
11055
|
+
* @returns The uniform variable of which presents the strength of the environment light
|
|
11059
11056
|
*/ static getEnvLightStrength(scope) {
|
|
11060
11057
|
return scope.light.envLightStrength;
|
|
11061
11058
|
}
|
|
11062
|
-
/**
|
|
11063
|
-
* Gets the uniform variable of type float which holds the specular strength of the environment light
|
|
11064
|
-
*
|
|
11065
|
-
* @remarks
|
|
11066
|
-
* This function can only be used in the fragment shader
|
|
11067
|
-
*
|
|
11068
|
-
* @param scope - Current shader scope
|
|
11069
|
-
* @returns The uniform variable which presents the specular strength of the environment light
|
|
11059
|
+
/**
|
|
11060
|
+
* Gets the uniform variable of type float which holds the specular strength of the environment light
|
|
11061
|
+
*
|
|
11062
|
+
* @remarks
|
|
11063
|
+
* This function can only be used in the fragment shader
|
|
11064
|
+
*
|
|
11065
|
+
* @param scope - Current shader scope
|
|
11066
|
+
* @returns The uniform variable which presents the specular strength of the environment light
|
|
11070
11067
|
*/ static getEnvLightSpecularStrength(scope) {
|
|
11071
11068
|
return scope.light.envLightSpecularStrength ?? scope.$builder.float(1);
|
|
11072
11069
|
}
|
|
11073
|
-
/**
|
|
11074
|
-
* Gets current scene color texture
|
|
11075
|
-
* @param scope - Current shader scope
|
|
11076
|
-
* @returns current scene color texture
|
|
11070
|
+
/**
|
|
11071
|
+
* Gets current scene color texture
|
|
11072
|
+
* @param scope - Current shader scope
|
|
11073
|
+
* @returns current scene color texture
|
|
11077
11074
|
*/ static getSceneColorTexture(scope) {
|
|
11078
11075
|
return scope[UNIFORM_NAME_SCENE_COLOR_MAP];
|
|
11079
11076
|
}
|
|
11080
|
-
/**
|
|
11081
|
-
* Gets the size of current scene color texture
|
|
11082
|
-
* @param scope - Current shader scope
|
|
11083
|
-
* @returns The size of current scene color texture
|
|
11077
|
+
/**
|
|
11078
|
+
* Gets the size of current scene color texture
|
|
11079
|
+
* @param scope - Current shader scope
|
|
11080
|
+
* @returns The size of current scene color texture
|
|
11084
11081
|
*/ static getSceneColorTextureSize(scope) {
|
|
11085
11082
|
return scope[UNIFORM_NAME_SCENE_COLOR_MAP_SIZE];
|
|
11086
11083
|
}
|
|
11087
|
-
/**
|
|
11088
|
-
* Gets current linear depth texture
|
|
11089
|
-
* @param scope - Current shader scope
|
|
11090
|
-
* @returns current linear depth texture
|
|
11084
|
+
/**
|
|
11085
|
+
* Gets current linear depth texture
|
|
11086
|
+
* @param scope - Current shader scope
|
|
11087
|
+
* @returns current linear depth texture
|
|
11091
11088
|
*/ static getLinearDepthTexture(scope) {
|
|
11092
11089
|
return scope[UNIFORM_NAME_LINEAR_DEPTH_MAP];
|
|
11093
11090
|
}
|
|
11094
|
-
/**
|
|
11095
|
-
* Gets the size of current linear depth texture
|
|
11096
|
-
* @param scope - Current shader scope
|
|
11097
|
-
* @returns The size of current linear depth texture
|
|
11091
|
+
/**
|
|
11092
|
+
* Gets the size of current linear depth texture
|
|
11093
|
+
* @param scope - Current shader scope
|
|
11094
|
+
* @returns The size of current linear depth texture
|
|
11098
11095
|
*/ static getLinearDepthTextureSize(scope) {
|
|
11099
11096
|
return scope[UNIFORM_NAME_LINEAR_DEPTH_MAP_SIZE];
|
|
11100
11097
|
}
|
|
11101
|
-
/**
|
|
11102
|
-
* Gets current HiZ depth texture
|
|
11103
|
-
* @param scope - Current shader scope
|
|
11104
|
-
* @returns current HiZ depth texture
|
|
11098
|
+
/**
|
|
11099
|
+
* Gets current HiZ depth texture
|
|
11100
|
+
* @param scope - Current shader scope
|
|
11101
|
+
* @returns current HiZ depth texture
|
|
11105
11102
|
*/ static getHiZDepthTexture(scope) {
|
|
11106
11103
|
return scope[UNIFORM_NAME_HIZ_DEPTH_MAP];
|
|
11107
11104
|
}
|
|
11108
|
-
/**
|
|
11109
|
-
* Gets the size of current HiZ depth texture
|
|
11110
|
-
* @param scope - Current shader scope
|
|
11111
|
-
* @returns The size of current HiZ depth texture
|
|
11105
|
+
/**
|
|
11106
|
+
* Gets the size of current HiZ depth texture
|
|
11107
|
+
* @param scope - Current shader scope
|
|
11108
|
+
* @returns The size of current HiZ depth texture
|
|
11112
11109
|
*/ static getHiZDepthTextureSize(scope) {
|
|
11113
11110
|
return scope[UNIFORM_NAME_HIZ_DEPTH_MAP_INFO].xy;
|
|
11114
11111
|
}
|
|
11115
|
-
/**
|
|
11116
|
-
* Gets the mipmap levels count of current HiZ depth texture
|
|
11117
|
-
* @param scope - Current shader scope
|
|
11118
|
-
* @returns The mipmap levels count of current HiZ depth texture
|
|
11112
|
+
/**
|
|
11113
|
+
* Gets the mipmap levels count of current HiZ depth texture
|
|
11114
|
+
* @param scope - Current shader scope
|
|
11115
|
+
* @returns The mipmap levels count of current HiZ depth texture
|
|
11119
11116
|
*/ static getHiZDepthTextureMipLevelCount(scope) {
|
|
11120
11117
|
return scope[UNIFORM_NAME_HIZ_DEPTH_MAP_INFO].z;
|
|
11121
11118
|
}
|
|
11122
|
-
/**
|
|
11123
|
-
* Gets current baked skybox texture
|
|
11124
|
-
* @param scope - Current shader scope
|
|
11125
|
-
* @returns current baked skybox texture
|
|
11119
|
+
/**
|
|
11120
|
+
* Gets current baked skybox texture
|
|
11121
|
+
* @param scope - Current shader scope
|
|
11122
|
+
* @returns current baked skybox texture
|
|
11126
11123
|
*/ static getBakedSkyTexture(scope) {
|
|
11127
11124
|
return scope[UNIFORM_NAME_BAKED_SKY_MAP];
|
|
11128
11125
|
}
|
|
11129
|
-
/**
|
|
11130
|
-
* Gets the elapsed time in seconds
|
|
11131
|
-
* @param scope - Current shader scope
|
|
11132
|
-
* @returns The elapsed time in seconds
|
|
11126
|
+
/**
|
|
11127
|
+
* Gets the elapsed time in seconds
|
|
11128
|
+
* @param scope - Current shader scope
|
|
11129
|
+
* @returns The elapsed time in seconds
|
|
11133
11130
|
*/ static getElapsedTime(scope) {
|
|
11134
11131
|
return scope.camera.elapsedTime;
|
|
11135
11132
|
}
|
|
11136
|
-
/**
|
|
11137
|
-
* Gets the elapsed time since last frame in seconds
|
|
11138
|
-
* @param scope - Current shader scope
|
|
11139
|
-
* @returns The elapsed time since last frame in seconds
|
|
11133
|
+
/**
|
|
11134
|
+
* Gets the elapsed time since last frame in seconds
|
|
11135
|
+
* @param scope - Current shader scope
|
|
11136
|
+
* @returns The elapsed time since last frame in seconds
|
|
11140
11137
|
*/ static getElapsedTimeFrame(scope) {
|
|
11141
11138
|
return scope.camera.frameDeltaTime;
|
|
11142
11139
|
}
|
|
11143
|
-
/**
|
|
11144
|
-
* Gets the uniform variable of type vec3 which holds the camera position
|
|
11145
|
-
* @param scope - Current shader scope
|
|
11146
|
-
* @returns The camera position
|
|
11140
|
+
/**
|
|
11141
|
+
* Gets the uniform variable of type vec3 which holds the camera position
|
|
11142
|
+
* @param scope - Current shader scope
|
|
11143
|
+
* @returns The camera position
|
|
11147
11144
|
*/ static getCameraPosition(scope) {
|
|
11148
11145
|
return scope.camera.position.xyz;
|
|
11149
11146
|
}
|
|
11150
|
-
/**
|
|
11151
|
-
* Gets the uniform variable of type float which holds the roughness factor
|
|
11152
|
-
* @param scope - Current shader scope
|
|
11153
|
-
* @returns The roughness factor
|
|
11147
|
+
/**
|
|
11148
|
+
* Gets the uniform variable of type float which holds the roughness factor
|
|
11149
|
+
* @param scope - Current shader scope
|
|
11150
|
+
* @returns The roughness factor
|
|
11154
11151
|
*/ static getCameraRoughnessFactor(scope) {
|
|
11155
11152
|
return scope.camera.roughnessFactor;
|
|
11156
11153
|
}
|
|
11157
|
-
/**
|
|
11158
|
-
* Gets framebuffer size for rendering
|
|
11159
|
-
* @param scope - Current shader scope
|
|
11160
|
-
* @returns The roughness factor
|
|
11154
|
+
/**
|
|
11155
|
+
* Gets framebuffer size for rendering
|
|
11156
|
+
* @param scope - Current shader scope
|
|
11157
|
+
* @returns The roughness factor
|
|
11161
11158
|
*/ static getRenderSize(scope) {
|
|
11162
11159
|
return scope.camera.renderSize;
|
|
11163
11160
|
}
|
|
11164
|
-
/**
|
|
11165
|
-
* Gets the uniform variable of type uint which holds the framestamp
|
|
11166
|
-
* @param scope - Current shader scope
|
|
11167
|
-
* @returns The framestamp
|
|
11161
|
+
/**
|
|
11162
|
+
* Gets the uniform variable of type uint which holds the framestamp
|
|
11163
|
+
* @param scope - Current shader scope
|
|
11164
|
+
* @returns The framestamp
|
|
11168
11165
|
*/ static getFramestamp(scope) {
|
|
11169
11166
|
return scope.camera.framestamp;
|
|
11170
11167
|
}
|
|
11171
|
-
/**
|
|
11172
|
-
* Gets the clip plane flag
|
|
11173
|
-
* @param scope - Current shader scope
|
|
11174
|
-
* @returns A float value of 1 indices the clip plane presents, otherwise 0
|
|
11168
|
+
/**
|
|
11169
|
+
* Gets the clip plane flag
|
|
11170
|
+
* @param scope - Current shader scope
|
|
11171
|
+
* @returns A float value of 1 indices the clip plane presents, otherwise 0
|
|
11175
11172
|
*/ static getCameraClipPlaneFlag(scope) {
|
|
11176
11173
|
return scope.camera.position.w;
|
|
11177
11174
|
}
|
|
11178
|
-
/**
|
|
11179
|
-
* Gets the clip plane
|
|
11180
|
-
* @param scope - Current shader scope
|
|
11181
|
-
* @returns A vec4 presents the clip plane
|
|
11175
|
+
/**
|
|
11176
|
+
* Gets the clip plane
|
|
11177
|
+
* @param scope - Current shader scope
|
|
11178
|
+
* @returns A vec4 presents the clip plane
|
|
11182
11179
|
*/ static getCameraClipPlane(scope) {
|
|
11183
11180
|
return scope.camera.clipPlane;
|
|
11184
11181
|
}
|
|
11185
|
-
/**
|
|
11186
|
-
* Gets the uniform variable of type vec4 which holds the camera parameters
|
|
11187
|
-
* @param scope - Current shader scope
|
|
11188
|
-
* @returns The camera parameters
|
|
11182
|
+
/**
|
|
11183
|
+
* Gets the uniform variable of type vec4 which holds the camera parameters
|
|
11184
|
+
* @param scope - Current shader scope
|
|
11185
|
+
* @returns The camera parameters
|
|
11189
11186
|
*/ static getCameraParams(scope) {
|
|
11190
11187
|
return scope.camera.params;
|
|
11191
11188
|
}
|
|
@@ -11198,87 +11195,87 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
11198
11195
|
/** @internal */ static getClusteredLightIndexTexture(scope) {
|
|
11199
11196
|
return scope[UNIFORM_NAME_LIGHT_INDEX_TEXTURE];
|
|
11200
11197
|
}
|
|
11201
|
-
/**
|
|
11202
|
-
* Gets the uniform variable that contains atmosphere parameters
|
|
11203
|
-
* @param scope - Current shader scope
|
|
11204
|
-
* @returns The atmosphere parameters
|
|
11198
|
+
/**
|
|
11199
|
+
* Gets the uniform variable that contains atmosphere parameters
|
|
11200
|
+
* @param scope - Current shader scope
|
|
11201
|
+
* @returns The atmosphere parameters
|
|
11205
11202
|
*/ static getAtmosphereParams(scope) {
|
|
11206
11203
|
return scope.fog.atmosphereParams;
|
|
11207
11204
|
}
|
|
11208
|
-
/**
|
|
11209
|
-
* Gets the aerial perspective LUT
|
|
11210
|
-
* @param scope - Current shader scope
|
|
11211
|
-
* @returns The aerial perspective LUT texture
|
|
11205
|
+
/**
|
|
11206
|
+
* Gets the aerial perspective LUT
|
|
11207
|
+
* @param scope - Current shader scope
|
|
11208
|
+
* @returns The aerial perspective LUT texture
|
|
11212
11209
|
*/ static getAerialPerspectiveLUT(scope) {
|
|
11213
11210
|
return scope[UNIFORM_NAME_AERIALPERSPECTIVE_LUT];
|
|
11214
11211
|
}
|
|
11215
|
-
/**
|
|
11216
|
-
* Gets the uniform variable of type mat4 which holds the view projection matrix of current camera
|
|
11217
|
-
* @param scope - Current shader scope
|
|
11218
|
-
* @returns The view projection matrix of current camera
|
|
11212
|
+
/**
|
|
11213
|
+
* Gets the uniform variable of type mat4 which holds the view projection matrix of current camera
|
|
11214
|
+
* @param scope - Current shader scope
|
|
11215
|
+
* @returns The view projection matrix of current camera
|
|
11219
11216
|
*/ static getViewProjectionMatrix(scope) {
|
|
11220
11217
|
return scope.camera.viewProjectionMatrix;
|
|
11221
11218
|
}
|
|
11222
|
-
/**
|
|
11223
|
-
* Gets the uniform variable of type mat4 which holds the inversed view projection matrix of current camera
|
|
11224
|
-
* @param scope - Current shader scope
|
|
11225
|
-
* @returns The inversed view projection matrix of current camera
|
|
11219
|
+
/**
|
|
11220
|
+
* Gets the uniform variable of type mat4 which holds the inversed view projection matrix of current camera
|
|
11221
|
+
* @param scope - Current shader scope
|
|
11222
|
+
* @returns The inversed view projection matrix of current camera
|
|
11226
11223
|
*/ static getInvViewProjectionMatrix(scope) {
|
|
11227
11224
|
return scope.camera.invViewProjectionMatrix;
|
|
11228
11225
|
}
|
|
11229
|
-
/**
|
|
11230
|
-
* Gets the uniform variable of type mat4 which holds the projection matrix of current camera
|
|
11231
|
-
* @param scope - Current shader scope
|
|
11232
|
-
* @returns The projection matrix of current camera
|
|
11226
|
+
/**
|
|
11227
|
+
* Gets the uniform variable of type mat4 which holds the projection matrix of current camera
|
|
11228
|
+
* @param scope - Current shader scope
|
|
11229
|
+
* @returns The projection matrix of current camera
|
|
11233
11230
|
*/ static getProjectionMatrix(scope) {
|
|
11234
11231
|
return scope.camera.projectionMatrix;
|
|
11235
11232
|
}
|
|
11236
|
-
/**
|
|
11237
|
-
* Gets the uniform variable of type mat4 which holds the inversed projection matrix of current camera
|
|
11238
|
-
* @param scope - Current shader scope
|
|
11239
|
-
* @returns The inversed projection matrix of current camera
|
|
11233
|
+
/**
|
|
11234
|
+
* Gets the uniform variable of type mat4 which holds the inversed projection matrix of current camera
|
|
11235
|
+
* @param scope - Current shader scope
|
|
11236
|
+
* @returns The inversed projection matrix of current camera
|
|
11240
11237
|
*/ static getInvProjectionMatrix(scope) {
|
|
11241
11238
|
return scope.camera.invProjectionMatrix;
|
|
11242
11239
|
}
|
|
11243
|
-
/**
|
|
11244
|
-
* Gets the uniform variable of type mat4 which holds the unjittered view projection matrix of current camera
|
|
11245
|
-
* @param scope - Current shader scope
|
|
11246
|
-
* @returns The unjittered view projection matrix of current camera
|
|
11240
|
+
/**
|
|
11241
|
+
* Gets the uniform variable of type mat4 which holds the unjittered view projection matrix of current camera
|
|
11242
|
+
* @param scope - Current shader scope
|
|
11243
|
+
* @returns The unjittered view projection matrix of current camera
|
|
11247
11244
|
*/ static getUnjitteredViewProjectionMatrix(scope) {
|
|
11248
11245
|
return scope.camera.unjitteredVPMatrix;
|
|
11249
11246
|
}
|
|
11250
|
-
/**
|
|
11251
|
-
* Gets the uniform variable of type vec2 which holds the jitter value of the projection matrix of current camera
|
|
11252
|
-
* @param scope - Current shader scope
|
|
11253
|
-
* @returns The jitter value of projection matrix of current camera
|
|
11247
|
+
/**
|
|
11248
|
+
* Gets the uniform variable of type vec2 which holds the jitter value of the projection matrix of current camera
|
|
11249
|
+
* @param scope - Current shader scope
|
|
11250
|
+
* @returns The jitter value of projection matrix of current camera
|
|
11254
11251
|
*/ static getProjectionMatrixJitterValue(scope) {
|
|
11255
11252
|
return scope.camera.jitterValue;
|
|
11256
11253
|
}
|
|
11257
|
-
/**
|
|
11258
|
-
* Gets the uniform variable of type mat4 which holds the jittered inversed view-projection matrix
|
|
11259
|
-
* @param scope - Current shader scope
|
|
11260
|
-
* @returns The jittered inversed view-projection matrix
|
|
11254
|
+
/**
|
|
11255
|
+
* Gets the uniform variable of type mat4 which holds the jittered inversed view-projection matrix
|
|
11256
|
+
* @param scope - Current shader scope
|
|
11257
|
+
* @returns The jittered inversed view-projection matrix
|
|
11261
11258
|
*/ static getJitteredInvVPMatrix(scope) {
|
|
11262
11259
|
return scope.camera.jitteredInvVPMatrix;
|
|
11263
11260
|
}
|
|
11264
|
-
/**
|
|
11265
|
-
* Gets the uniform variable of type mat4 which holds the unjittered view projection at previous frame matrix of current camera
|
|
11266
|
-
* @param scope - Current shader scope
|
|
11267
|
-
* @returns The unjittered view projection matrix at previous frame of current camera
|
|
11261
|
+
/**
|
|
11262
|
+
* Gets the uniform variable of type mat4 which holds the unjittered view projection at previous frame matrix of current camera
|
|
11263
|
+
* @param scope - Current shader scope
|
|
11264
|
+
* @returns The unjittered view projection matrix at previous frame of current camera
|
|
11268
11265
|
*/ static getPrevUnjitteredViewProjectionMatrix(scope) {
|
|
11269
11266
|
return scope.camera.prevUnjitteredVPMatrix;
|
|
11270
11267
|
}
|
|
11271
|
-
/**
|
|
11272
|
-
* Gets the uniform variable of type mat4 which holds the view matrix of current camera (world space to camera space)
|
|
11273
|
-
* @param scope - Current shader scope
|
|
11274
|
-
* @returns The view matrix of current camera
|
|
11268
|
+
/**
|
|
11269
|
+
* Gets the uniform variable of type mat4 which holds the view matrix of current camera (world space to camera space)
|
|
11270
|
+
* @param scope - Current shader scope
|
|
11271
|
+
* @returns The view matrix of current camera
|
|
11275
11272
|
*/ static getViewMatrix(scope) {
|
|
11276
11273
|
return scope.camera.viewMatrix;
|
|
11277
11274
|
}
|
|
11278
|
-
/**
|
|
11279
|
-
* Gets the uniform variable of type mat4 which holds the inv-view matrix of current camera (camera space to world space)
|
|
11280
|
-
* @param scope - Current shader scope
|
|
11281
|
-
* @returns The inv-view matrix of current camera
|
|
11275
|
+
/**
|
|
11276
|
+
* Gets the uniform variable of type mat4 which holds the inv-view matrix of current camera (camera space to world space)
|
|
11277
|
+
* @param scope - Current shader scope
|
|
11278
|
+
* @returns The inv-view matrix of current camera
|
|
11282
11279
|
*/ static getInvViewMatrix(scope) {
|
|
11283
11280
|
return scope.camera.worldMatrix;
|
|
11284
11281
|
}
|
|
@@ -11329,20 +11326,20 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
11329
11326
|
/** @internal */ static getLightExtra(scope, lightIndex) {
|
|
11330
11327
|
return scope[UNIFORM_NAME_LIGHT_BUFFER].at(scope.$builder.add(scope.$builder.mul(lightIndex, 4), 3));
|
|
11331
11328
|
}
|
|
11332
|
-
/**
|
|
11333
|
-
* Sets the clip space position in vertex shader
|
|
11334
|
-
*
|
|
11335
|
-
* @remarks
|
|
11336
|
-
* Use this function instead of using
|
|
11337
|
-
* <pre>
|
|
11338
|
-
* // Do not use this
|
|
11339
|
-
* this.$builtins.position = some_value;
|
|
11340
|
-
* // Use this
|
|
11341
|
-
* ShaderFramework.setClipSpacePosition(some_value);
|
|
11342
|
-
* </pre>,
|
|
11343
|
-
*
|
|
11344
|
-
* @param scope - Current shader scope
|
|
11345
|
-
* @param pos - The clip space position to be set
|
|
11329
|
+
/**
|
|
11330
|
+
* Sets the clip space position in vertex shader
|
|
11331
|
+
*
|
|
11332
|
+
* @remarks
|
|
11333
|
+
* Use this function instead of using
|
|
11334
|
+
* <pre>
|
|
11335
|
+
* // Do not use this
|
|
11336
|
+
* this.$builtins.position = some_value;
|
|
11337
|
+
* // Use this
|
|
11338
|
+
* ShaderFramework.setClipSpacePosition(some_value);
|
|
11339
|
+
* </pre>,
|
|
11340
|
+
*
|
|
11341
|
+
* @param scope - Current shader scope
|
|
11342
|
+
* @param pos - The clip space position to be set
|
|
11346
11343
|
*/ static setClipSpacePosition(scope, pos) {
|
|
11347
11344
|
const pb = scope.$builder;
|
|
11348
11345
|
const cameraParams = this.getCameraParams(scope);
|
|
@@ -11352,20 +11349,20 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
11352
11349
|
scope.$builtins.position = pos;
|
|
11353
11350
|
}
|
|
11354
11351
|
}
|
|
11355
|
-
/**
|
|
11356
|
-
* Get shadow map uniform value
|
|
11357
|
-
*
|
|
11358
|
-
* @param scope - Shader scope
|
|
11359
|
-
* @returns The shadow map texture uniform
|
|
11352
|
+
/**
|
|
11353
|
+
* Get shadow map uniform value
|
|
11354
|
+
*
|
|
11355
|
+
* @param scope - Shader scope
|
|
11356
|
+
* @returns The shadow map texture uniform
|
|
11360
11357
|
*/ static getShadowMap(scope) {
|
|
11361
11358
|
return scope[UNIFORM_NAME_SHADOW_MAP];
|
|
11362
11359
|
}
|
|
11363
|
-
/**
|
|
11364
|
-
* Calculates shadow of current fragment
|
|
11365
|
-
*
|
|
11366
|
-
* @param scope - Shader scope
|
|
11367
|
-
* @param NoL - NdotL vector
|
|
11368
|
-
* @returns Shadow of current fragment, 1 means no shadow and 0 means full shadowed.
|
|
11360
|
+
/**
|
|
11361
|
+
* Calculates shadow of current fragment
|
|
11362
|
+
*
|
|
11363
|
+
* @param scope - Shader scope
|
|
11364
|
+
* @param NoL - NdotL vector
|
|
11365
|
+
* @returns Shadow of current fragment, 1 means no shadow and 0 means full shadowed.
|
|
11369
11366
|
*/ static calculateShadow(scope, worldPos, NoL, ctx) {
|
|
11370
11367
|
const pb = scope.$builder;
|
|
11371
11368
|
const that = this;
|
|
@@ -11441,49 +11438,49 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
11441
11438
|
scope[funcName](worldPos, color);
|
|
11442
11439
|
}
|
|
11443
11440
|
}
|
|
11444
|
-
/**
|
|
11445
|
-
* Calculates the non-linear depth from linear depth
|
|
11446
|
-
*
|
|
11447
|
-
* @param scope - Current shader scope
|
|
11448
|
-
* @param depth - The linear depth
|
|
11449
|
-
* @param nearFar - A vector that contains the near clip plane in x component and the far clip plane in y component
|
|
11450
|
-
* @returns The calculated non-linear depth
|
|
11441
|
+
/**
|
|
11442
|
+
* Calculates the non-linear depth from linear depth
|
|
11443
|
+
*
|
|
11444
|
+
* @param scope - Current shader scope
|
|
11445
|
+
* @param depth - The linear depth
|
|
11446
|
+
* @param nearFar - A vector that contains the near clip plane in x component and the far clip plane in y component
|
|
11447
|
+
* @returns The calculated non-linear depth
|
|
11451
11448
|
*/ static linearDepthToNonLinear(scope, depth, nearFar) {
|
|
11452
11449
|
const pb = scope.$builder;
|
|
11453
11450
|
nearFar = nearFar ?? this.getCameraParams(scope);
|
|
11454
11451
|
return pb.div(pb.sub(nearFar.y, pb.div(pb.mul(nearFar.x, nearFar.y), depth)), pb.sub(nearFar.y, nearFar.x));
|
|
11455
11452
|
}
|
|
11456
|
-
/**
|
|
11457
|
-
* Calculates the linear depth from non-linear depth
|
|
11458
|
-
*
|
|
11459
|
-
* @param scope - Current shader scope
|
|
11460
|
-
* @param depth - The non-linear depth
|
|
11461
|
-
* @param nearFar - A vector that contains the near clip plane in x component and the far clip plane in y component
|
|
11462
|
-
* @returns The calculated linear depth
|
|
11453
|
+
/**
|
|
11454
|
+
* Calculates the linear depth from non-linear depth
|
|
11455
|
+
*
|
|
11456
|
+
* @param scope - Current shader scope
|
|
11457
|
+
* @param depth - The non-linear depth
|
|
11458
|
+
* @param nearFar - A vector that contains the near clip plane in x component and the far clip plane in y component
|
|
11459
|
+
* @returns The calculated linear depth
|
|
11463
11460
|
*/ static nonLinearDepthToLinear(scope, depth, nearFar) {
|
|
11464
11461
|
const pb = scope.$builder;
|
|
11465
11462
|
nearFar = nearFar ?? this.getCameraParams(scope);
|
|
11466
11463
|
return pb.div(pb.mul(nearFar.x, nearFar.y), pb.mix(nearFar.y, nearFar.x, depth));
|
|
11467
11464
|
}
|
|
11468
|
-
/**
|
|
11469
|
-
* Calculates the normalized linear depth from non-linear depth
|
|
11470
|
-
*
|
|
11471
|
-
* @param scope - Current shader scope
|
|
11472
|
-
* @param depth - The non-linear depth
|
|
11473
|
-
* @param nearFar - A vector that contains the near clip plane in x component and the far clip plane in y component
|
|
11474
|
-
* @returns The calculated normalized linear depth
|
|
11465
|
+
/**
|
|
11466
|
+
* Calculates the normalized linear depth from non-linear depth
|
|
11467
|
+
*
|
|
11468
|
+
* @param scope - Current shader scope
|
|
11469
|
+
* @param depth - The non-linear depth
|
|
11470
|
+
* @param nearFar - A vector that contains the near clip plane in x component and the far clip plane in y component
|
|
11471
|
+
* @returns The calculated normalized linear depth
|
|
11475
11472
|
*/ static nonLinearDepthToLinearNormalized(scope, depth, nearFar) {
|
|
11476
11473
|
const pb = scope.$builder;
|
|
11477
11474
|
nearFar = nearFar ?? this.getCameraParams(scope);
|
|
11478
11475
|
return pb.div(nearFar.x, pb.mix(nearFar.y, nearFar.x, depth));
|
|
11479
11476
|
}
|
|
11480
|
-
/**
|
|
11481
|
-
* Sample linear depth from linear depth texture
|
|
11482
|
-
* @param scope - Current shader scope
|
|
11483
|
-
* @param tex - The linear depth texture
|
|
11484
|
-
* @param uv - The uv coordinates
|
|
11485
|
-
* @param level - The mipmap level to sample
|
|
11486
|
-
* @returns Linear depth value
|
|
11477
|
+
/**
|
|
11478
|
+
* Sample linear depth from linear depth texture
|
|
11479
|
+
* @param scope - Current shader scope
|
|
11480
|
+
* @param tex - The linear depth texture
|
|
11481
|
+
* @param uv - The uv coordinates
|
|
11482
|
+
* @param level - The mipmap level to sample
|
|
11483
|
+
* @returns Linear depth value
|
|
11487
11484
|
*/ static sampleLinearDepth(scope, tex, uv, level) {
|
|
11488
11485
|
const pb = scope.$builder;
|
|
11489
11486
|
const depth = pb.textureSampleLevel(tex, uv, level);
|
|
@@ -11505,23 +11502,23 @@ const UNIFORM_NAME_MORPH_INFO = 'Z_UniformMorphInfo';
|
|
|
11505
11502
|
});
|
|
11506
11503
|
return scope.zSamplePositionFromDepth(uv, cameraNearFar, mat);
|
|
11507
11504
|
}
|
|
11508
|
-
/**
|
|
11509
|
-
* Sample linear depth from linear depth texture with backface
|
|
11510
|
-
* @param scope - Current shader scope
|
|
11511
|
-
* @param tex - The linear depth texture
|
|
11512
|
-
* @param uv - The uv coordinates
|
|
11513
|
-
* @param level - The mipmap level to sample
|
|
11514
|
-
* @returns Linear depth value
|
|
11505
|
+
/**
|
|
11506
|
+
* Sample linear depth from linear depth texture with backface
|
|
11507
|
+
* @param scope - Current shader scope
|
|
11508
|
+
* @param tex - The linear depth texture
|
|
11509
|
+
* @param uv - The uv coordinates
|
|
11510
|
+
* @param level - The mipmap level to sample
|
|
11511
|
+
* @returns Linear depth value
|
|
11515
11512
|
*/ static sampleLinearDepthWithBackface(scope, tex, uv, level) {
|
|
11516
11513
|
const pb = scope.$builder;
|
|
11517
11514
|
return pb.textureSampleLevel(tex, uv, level).rg;
|
|
11518
11515
|
}
|
|
11519
|
-
/**
|
|
11520
|
-
* Transform color to sRGB color space if nessesary
|
|
11521
|
-
*
|
|
11522
|
-
* @param scope - Current shader scope
|
|
11523
|
-
* @param outputColor - The color to be transformed
|
|
11524
|
-
* @returns The transformed color
|
|
11516
|
+
/**
|
|
11517
|
+
* Transform color to sRGB color space if nessesary
|
|
11518
|
+
*
|
|
11519
|
+
* @param scope - Current shader scope
|
|
11520
|
+
* @param outputColor - The color to be transformed
|
|
11521
|
+
* @returns The transformed color
|
|
11525
11522
|
*/ static encodeColorOutput(scope, outputColor) {
|
|
11526
11523
|
const pb = scope.$builder;
|
|
11527
11524
|
const that = this;
|
|
@@ -17085,11 +17082,11 @@ const PBR_REFLECTION_MODE$1 = {
|
|
|
17085
17082
|
anisotropic: 2,
|
|
17086
17083
|
glint: 3
|
|
17087
17084
|
};
|
|
17088
|
-
/**
|
|
17089
|
-
* PBRMetallicRoughness lighting model mixin
|
|
17090
|
-
* @param BaseCls - Class to mix in
|
|
17091
|
-
* @returns Mixed class
|
|
17092
|
-
* @public
|
|
17085
|
+
/**
|
|
17086
|
+
* PBRMetallicRoughness lighting model mixin
|
|
17087
|
+
* @param BaseCls - Class to mix in
|
|
17088
|
+
* @returns Mixed class
|
|
17089
|
+
* @public
|
|
17093
17090
|
*/ function mixinPBRMetallicRoughness(BaseCls) {
|
|
17094
17091
|
if (BaseCls.pbrMetallicRoughnessMixed) {
|
|
17095
17092
|
return BaseCls;
|
|
@@ -18776,10 +18773,10 @@ const MAX_DETAIL_MAPS = 8;
|
|
|
18776
18773
|
}
|
|
18777
18774
|
|
|
18778
18775
|
const ToonMaterialBase = applyMaterialMixins(MeshMaterial, mixinAlbedoColor, mixinLambert, mixinTextureProps('shadeMultiply'), mixinTextureProps('shadingShift'), mixinTextureProps('matcap'), mixinTextureProps('rimMultiply'), mixinTextureProps('outlineWidthMultiply'), mixinTextureProps('uvAnimationMask'), mixinTextureProps('emissive'));
|
|
18779
|
-
/**
|
|
18780
|
-
* MToonMaterial is a material that implements the MToon shader, which is a stylized shader commonly used for rendering anime-style characters. It supports features such as rim lighting, matcap, and outline rendering.
|
|
18781
|
-
*
|
|
18782
|
-
* @public
|
|
18776
|
+
/**
|
|
18777
|
+
* MToonMaterial is a material that implements the MToon shader, which is a stylized shader commonly used for rendering anime-style characters. It supports features such as rim lighting, matcap, and outline rendering.
|
|
18778
|
+
*
|
|
18779
|
+
* @public
|
|
18783
18780
|
*/ class MToonMaterial extends ToonMaterialBase {
|
|
18784
18781
|
static FEATURE_OUTLINE_WIDTH_MODE = this.defineFeature();
|
|
18785
18782
|
static FEATURE_OUTLINE_TANGENT_NORMALS = this.defineFeature();
|
|
@@ -30045,17 +30042,17 @@ const DEFAULT_OUTPUT_NAMES = [
|
|
|
30045
30042
|
'SpecularWeight',
|
|
30046
30043
|
'AO'
|
|
30047
30044
|
];
|
|
30048
|
-
/**
|
|
30049
|
-
* Physically-based rendering material driven by blueprint graphs, but shaded by the
|
|
30050
|
-
* same PBR metallic/roughness backend used by {@link PBRMetallicRoughnessMaterial}.
|
|
30051
|
-
*
|
|
30052
|
-
* @remarks
|
|
30053
|
-
* The blueprint graph only produces surface inputs. Final direct/indirect lighting,
|
|
30054
|
-
* transmission, clearcoat, sheen, iridescence and anisotropic reflection still run
|
|
30055
|
-
* through the standard PBRM backend so imported GLTF materials and blueprint materials
|
|
30056
|
-
* stay on the same shading path.
|
|
30057
|
-
*
|
|
30058
|
-
* @public
|
|
30045
|
+
/**
|
|
30046
|
+
* Physically-based rendering material driven by blueprint graphs, but shaded by the
|
|
30047
|
+
* same PBR metallic/roughness backend used by {@link PBRMetallicRoughnessMaterial}.
|
|
30048
|
+
*
|
|
30049
|
+
* @remarks
|
|
30050
|
+
* The blueprint graph only produces surface inputs. Final direct/indirect lighting,
|
|
30051
|
+
* transmission, clearcoat, sheen, iridescence and anisotropic reflection still run
|
|
30052
|
+
* through the standard PBRM backend so imported GLTF materials and blueprint materials
|
|
30053
|
+
* stay on the same shading path.
|
|
30054
|
+
*
|
|
30055
|
+
* @public
|
|
30059
30056
|
*/ class PBRBluePrintMaterial extends PBRMetallicRoughnessMaterial {
|
|
30060
30057
|
/** @internal */ static FEATURE_BLUEPRINT_VERTEX_COLOR = this.defineFeature();
|
|
30061
30058
|
/** @internal */ static FEATURE_BLUEPRINT_VERTEX_UV = this.defineFeature();
|
|
@@ -32091,16 +32088,16 @@ const tmpDrawablePos = new Vector3();
|
|
|
32091
32088
|
|
|
32092
32089
|
const SURFACE_MRT_FLAGS$1 = MaterialVaryingFlags.SSR_STORE_ROUGHNESS | MaterialVaryingFlags.SSS_STORE_PROFILE | MaterialVaryingFlags.SSS_STORE_DIFFUSE | MaterialVaryingFlags.SSS_STORE_NORMAL | MaterialVaryingFlags.SSS_STORE_TRANSMISSION;
|
|
32093
32090
|
const ADDITIVE_LIGHT_PASS_OMIT_MRT_FLAGS = MaterialVaryingFlags.SSR_STORE_ROUGHNESS | MaterialVaryingFlags.SSS_STORE_PROFILE | MaterialVaryingFlags.SSS_STORE_NORMAL;
|
|
32094
|
-
/**
|
|
32095
|
-
* Forward render pass
|
|
32096
|
-
* @internal
|
|
32091
|
+
/**
|
|
32092
|
+
* Forward render pass
|
|
32093
|
+
* @internal
|
|
32097
32094
|
*/ class LightPass extends RenderPass {
|
|
32098
32095
|
/** @internal */ _shadowMapHash;
|
|
32099
32096
|
/** @internal */ _transmission;
|
|
32100
32097
|
/** @internal */ _renderOpaque;
|
|
32101
32098
|
/** @internal */ _renderTransparent;
|
|
32102
|
-
/**
|
|
32103
|
-
* Creates an instance of ForwardRenderPass
|
|
32099
|
+
/**
|
|
32100
|
+
* Creates an instance of ForwardRenderPass
|
|
32104
32101
|
*/ constructor(){
|
|
32105
32102
|
super(RENDER_PASS_TYPE_LIGHT);
|
|
32106
32103
|
this._shadowMapHash = null;
|
|
@@ -37850,13 +37847,13 @@ float3 hi_z_trace(float3 p, float3 v, in uint camera, out uint iterations) {
|
|
|
37850
37847
|
}
|
|
37851
37848
|
}
|
|
37852
37849
|
|
|
37853
|
-
/**
|
|
37854
|
-
* SSR post effect
|
|
37855
|
-
*
|
|
37856
|
-
* @remarks
|
|
37857
|
-
* Internal used in light pass
|
|
37858
|
-
*
|
|
37859
|
-
* @internal
|
|
37850
|
+
/**
|
|
37851
|
+
* SSR post effect
|
|
37852
|
+
*
|
|
37853
|
+
* @remarks
|
|
37854
|
+
* Internal used in light pass
|
|
37855
|
+
*
|
|
37856
|
+
* @internal
|
|
37860
37857
|
*/ class SSR extends AbstractPostEffect {
|
|
37861
37858
|
static _programs = {};
|
|
37862
37859
|
static _resolveProgram = {};
|
|
@@ -37868,8 +37865,8 @@ float3 hi_z_trace(float3 p, float3 v, in uint camera, out uint iterations) {
|
|
|
37868
37865
|
_resolveBindGroup;
|
|
37869
37866
|
_combineBindGroup;
|
|
37870
37867
|
_temporalBindGroup;
|
|
37871
|
-
/**
|
|
37872
|
-
* Creates an instance of SSR post effect
|
|
37868
|
+
/**
|
|
37869
|
+
* Creates an instance of SSR post effect
|
|
37873
37870
|
*/ constructor(){
|
|
37874
37871
|
super();
|
|
37875
37872
|
this._layer = PostEffectLayer.opaque;
|
|
@@ -41862,24 +41859,24 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
41862
41859
|
normalCutoff: 0.72
|
|
41863
41860
|
}
|
|
41864
41861
|
};
|
|
41865
|
-
/**
|
|
41866
|
-
* A renderable camera node that manages view/projection math, frusta,
|
|
41867
|
-
* input control, picking, and a post-processing chain via a compositor.
|
|
41868
|
-
*
|
|
41869
|
-
* Key features:
|
|
41870
|
-
* - Maintains projection, view, VP, and inverse VP matrices and lazily recomputes them when invalidated.
|
|
41871
|
-
* - Provides world- and view-space frusta for culling and clipping.
|
|
41872
|
-
* - Supports perspective and orthographic projections.
|
|
41873
|
-
* - Integrates with post effects (Tonemap, FXAA, TAA, Bloom, SSR, SSS, SSAO, Motion Blur) through an internal `Compositor`.
|
|
41874
|
-
* - Handles temporal jitter and history state when TAA or motion blur are enabled.
|
|
41875
|
-
* - Emits picking rays from screen coordinates and supports async GPU picking.
|
|
41876
|
-
* - Optional controller integration for user input handling.
|
|
41877
|
-
*
|
|
41878
|
-
* Performance notes:
|
|
41879
|
-
* - Matrices/frusta are computed on demand and cached until invalidation.
|
|
41880
|
-
* - Temporal jitter and history are set up only when required by enabled features and device support.
|
|
41881
|
-
*
|
|
41882
|
-
* @public
|
|
41862
|
+
/**
|
|
41863
|
+
* A renderable camera node that manages view/projection math, frusta,
|
|
41864
|
+
* input control, picking, and a post-processing chain via a compositor.
|
|
41865
|
+
*
|
|
41866
|
+
* Key features:
|
|
41867
|
+
* - Maintains projection, view, VP, and inverse VP matrices and lazily recomputes them when invalidated.
|
|
41868
|
+
* - Provides world- and view-space frusta for culling and clipping.
|
|
41869
|
+
* - Supports perspective and orthographic projections.
|
|
41870
|
+
* - Integrates with post effects (Tonemap, FXAA, TAA, Bloom, SSR, SSS, SSAO, Motion Blur) through an internal `Compositor`.
|
|
41871
|
+
* - Handles temporal jitter and history state when TAA or motion blur are enabled.
|
|
41872
|
+
* - Emits picking rays from screen coordinates and supports async GPU picking.
|
|
41873
|
+
* - Optional controller integration for user input handling.
|
|
41874
|
+
*
|
|
41875
|
+
* Performance notes:
|
|
41876
|
+
* - Matrices/frusta are computed on demand and cached until invalidation.
|
|
41877
|
+
* - Temporal jitter and history are set up only when required by enabled features and device support.
|
|
41878
|
+
*
|
|
41879
|
+
* @public
|
|
41883
41880
|
*/ class Camera extends SceneNode {
|
|
41884
41881
|
/** @internal Halton 2-3 sequence used for TAA jittering. */ static _halton23 = halton23(16);
|
|
41885
41882
|
/** @internal Per-camera history resources. */ static _historyData = new WeakMap();
|
|
@@ -41983,14 +41980,14 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
41983
41980
|
/** @internal Post-processing compositor attached to this camera. */ _compositor;
|
|
41984
41981
|
/** @internal Pointer interaction rectangle in css pixels (relative to canvas) */ _interactionRect;
|
|
41985
41982
|
/** @internal captured by which mouse button (-1 if not captured) */ _capturedButton;
|
|
41986
|
-
/**
|
|
41987
|
-
* Creates a new camera node.
|
|
41988
|
-
*
|
|
41989
|
-
* Initializes projection/view matrices, temporal fields, controller linkage, and
|
|
41990
|
-
* builds the default post-processing pipeline on the internal compositor.
|
|
41991
|
-
*
|
|
41992
|
-
* @param scene - The scene that owns this camera.
|
|
41993
|
-
* @param projectionMatrix - Optional projection matrix to initialize with.
|
|
41983
|
+
/**
|
|
41984
|
+
* Creates a new camera node.
|
|
41985
|
+
*
|
|
41986
|
+
* Initializes projection/view matrices, temporal fields, controller linkage, and
|
|
41987
|
+
* builds the default post-processing pipeline on the internal compositor.
|
|
41988
|
+
*
|
|
41989
|
+
* @param scene - The scene that owns this camera.
|
|
41990
|
+
* @param projectionMatrix - Optional projection matrix to initialize with.
|
|
41994
41991
|
*/ constructor(scene, projectionMatrix){
|
|
41995
41992
|
super(scene);
|
|
41996
41993
|
this._projMatrix = projectionMatrix || Matrix4x4.identity();
|
|
@@ -42105,81 +42102,81 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
42105
42102
|
scene.mainCamera = this;
|
|
42106
42103
|
}
|
|
42107
42104
|
}
|
|
42108
|
-
/**
|
|
42109
|
-
* The compositor that owns and runs the camera's post-processing chain.
|
|
42105
|
+
/**
|
|
42106
|
+
* The compositor that owns and runs the camera's post-processing chain.
|
|
42110
42107
|
*/ get compositor() {
|
|
42111
42108
|
return this._compositor;
|
|
42112
42109
|
}
|
|
42113
|
-
/**
|
|
42114
|
-
* Pointer interaction rectangle in css pixels (relative to canvas)
|
|
42110
|
+
/**
|
|
42111
|
+
* Pointer interaction rectangle in css pixels (relative to canvas)
|
|
42115
42112
|
*/ get interactionRect() {
|
|
42116
42113
|
return this._interactionRect;
|
|
42117
42114
|
}
|
|
42118
42115
|
set interactionRect(rect) {
|
|
42119
42116
|
this._interactionRect = rect;
|
|
42120
42117
|
}
|
|
42121
|
-
/**
|
|
42122
|
-
* Framebuffer clear color, or `null` to disable.
|
|
42118
|
+
/**
|
|
42119
|
+
* Framebuffer clear color, or `null` to disable.
|
|
42123
42120
|
*/ get clearColor() {
|
|
42124
42121
|
return this._clearColor;
|
|
42125
42122
|
}
|
|
42126
42123
|
set clearColor(v) {
|
|
42127
42124
|
this._clearColor = v?.clone() ?? null;
|
|
42128
42125
|
}
|
|
42129
|
-
/**
|
|
42130
|
-
* Framebuffer stencil clear value, disabled when null. Default is 0.
|
|
42126
|
+
/**
|
|
42127
|
+
* Framebuffer stencil clear value, disabled when null. Default is 0.
|
|
42131
42128
|
*/ get clearDepth() {
|
|
42132
42129
|
return this._clearDepth;
|
|
42133
42130
|
}
|
|
42134
42131
|
set clearDepth(v) {
|
|
42135
42132
|
this._clearDepth = v;
|
|
42136
42133
|
}
|
|
42137
|
-
/**
|
|
42138
|
-
* Framebuffer stencil clear value, disabled when null. Default is 0.
|
|
42134
|
+
/**
|
|
42135
|
+
* Framebuffer stencil clear value, disabled when null. Default is 0.
|
|
42139
42136
|
*/ get clearStencil() {
|
|
42140
42137
|
return this._clearStencil;
|
|
42141
42138
|
}
|
|
42142
42139
|
set clearStencil(v) {
|
|
42143
42140
|
this._clearStencil = v;
|
|
42144
42141
|
}
|
|
42145
|
-
/**
|
|
42146
|
-
* Whether Hi-Z acceleration is enabled.
|
|
42147
|
-
*
|
|
42148
|
-
* Often improves SSR performance with little quality impact when supported.
|
|
42142
|
+
/**
|
|
42143
|
+
* Whether Hi-Z acceleration is enabled.
|
|
42144
|
+
*
|
|
42145
|
+
* Often improves SSR performance with little quality impact when supported.
|
|
42149
42146
|
*/ get HiZ() {
|
|
42150
42147
|
return this._HiZ;
|
|
42151
42148
|
}
|
|
42152
42149
|
set HiZ(val) {
|
|
42153
42150
|
this._HiZ = !!val;
|
|
42154
42151
|
}
|
|
42155
|
-
/**
|
|
42156
|
-
* Render path used by the scene renderer.
|
|
42152
|
+
/**
|
|
42153
|
+
* Render path used by the scene renderer.
|
|
42157
42154
|
*/ get renderPath() {
|
|
42158
42155
|
return this._renderPath;
|
|
42159
42156
|
}
|
|
42160
42157
|
set renderPath(_val) {
|
|
42161
42158
|
this._renderPath = 'forward';
|
|
42162
42159
|
}
|
|
42163
|
-
/**
|
|
42164
|
-
* Whether HDR backbuffer is enabled.
|
|
42165
|
-
*
|
|
42166
|
-
* Tonemap should be disabled when not using HDR backbuffer.
|
|
42160
|
+
/**
|
|
42161
|
+
* Whether HDR backbuffer is enabled.
|
|
42162
|
+
*
|
|
42163
|
+
* Tonemap should be disabled when not using HDR backbuffer.
|
|
42167
42164
|
*/ get HDR() {
|
|
42168
42165
|
return this._HDR;
|
|
42169
42166
|
}
|
|
42170
42167
|
set HDR(val) {
|
|
42171
42168
|
this._HDR = !!val;
|
|
42172
42169
|
}
|
|
42173
|
-
/**
|
|
42174
|
-
* Whether tonemapping is enabled via the post effect.
|
|
42170
|
+
/**
|
|
42171
|
+
* Whether tonemapping is enabled via the post effect.
|
|
42175
42172
|
*/ get toneMap() {
|
|
42176
42173
|
return this._postEffectTonemap.get().enabled;
|
|
42177
42174
|
}
|
|
42178
42175
|
set toneMap(val) {
|
|
42179
42176
|
this._postEffectTonemap.get().enabled = !!val;
|
|
42180
42177
|
}
|
|
42181
|
-
/**
|
|
42182
|
-
* Whether motion blur is enabled via the post effect.
|
|
42178
|
+
/**
|
|
42179
|
+
* Whether motion blur is enabled via the post effect.
|
|
42183
42180
|
*/ get motionBlur() {
|
|
42184
42181
|
return this._postEffectMotionBlur.get().enabled;
|
|
42185
42182
|
}
|
|
@@ -42195,16 +42192,16 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
42195
42192
|
this._postEffectMotionBlur.get().strength = this._motionBlurStrength;
|
|
42196
42193
|
}
|
|
42197
42194
|
}
|
|
42198
|
-
/**
|
|
42199
|
-
* Gets whether Bloom is enabled.
|
|
42195
|
+
/**
|
|
42196
|
+
* Gets whether Bloom is enabled.
|
|
42200
42197
|
*/ get bloom() {
|
|
42201
42198
|
return this._postEffectBloom.get().enabled;
|
|
42202
42199
|
}
|
|
42203
42200
|
set bloom(val) {
|
|
42204
42201
|
this._postEffectBloom.get().enabled = !!val;
|
|
42205
42202
|
}
|
|
42206
|
-
/**
|
|
42207
|
-
* Maximum bloom downsample levels
|
|
42203
|
+
/**
|
|
42204
|
+
* Maximum bloom downsample levels
|
|
42208
42205
|
*/ get bloomMaxDownsampleLevels() {
|
|
42209
42206
|
return this._bloomMaxDownsampleLevels;
|
|
42210
42207
|
}
|
|
@@ -42214,8 +42211,8 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
42214
42211
|
this._postEffectBloom.get().maxDownsampleLevel = val;
|
|
42215
42212
|
}
|
|
42216
42213
|
}
|
|
42217
|
-
/**
|
|
42218
|
-
* Bloom downsample limit
|
|
42214
|
+
/**
|
|
42215
|
+
* Bloom downsample limit
|
|
42219
42216
|
*/ get bloomDownsampleLimit() {
|
|
42220
42217
|
return this._bloomDownsampleLimit;
|
|
42221
42218
|
}
|
|
@@ -42225,8 +42222,8 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
42225
42222
|
this._postEffectBloom.get().downsampleLimit = val;
|
|
42226
42223
|
}
|
|
42227
42224
|
}
|
|
42228
|
-
/**
|
|
42229
|
-
* Bloom threshold
|
|
42225
|
+
/**
|
|
42226
|
+
* Bloom threshold
|
|
42230
42227
|
*/ get bloomThreshold() {
|
|
42231
42228
|
return this._bloomThreshold;
|
|
42232
42229
|
}
|
|
@@ -42236,8 +42233,8 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
42236
42233
|
this._postEffectBloom.get().threshold = val;
|
|
42237
42234
|
}
|
|
42238
42235
|
}
|
|
42239
|
-
/**
|
|
42240
|
-
* Bloom threshold knee
|
|
42236
|
+
/**
|
|
42237
|
+
* Bloom threshold knee
|
|
42241
42238
|
*/ get bloomThresholdKnee() {
|
|
42242
42239
|
return this._bloomThresholdKnee;
|
|
42243
42240
|
}
|
|
@@ -42247,8 +42244,8 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
42247
42244
|
this._postEffectBloom.get().thresholdKnee = val;
|
|
42248
42245
|
}
|
|
42249
42246
|
}
|
|
42250
|
-
/**
|
|
42251
|
-
* Bloom intensity
|
|
42247
|
+
/**
|
|
42248
|
+
* Bloom intensity
|
|
42252
42249
|
*/ get bloomIntensity() {
|
|
42253
42250
|
return this._bloomIntensity;
|
|
42254
42251
|
}
|
|
@@ -42300,16 +42297,16 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
42300
42297
|
this._postEffectColorAdjust.get().sharpen = val;
|
|
42301
42298
|
}
|
|
42302
42299
|
}
|
|
42303
|
-
/**
|
|
42304
|
-
* Gets whether FXAA is enabled.
|
|
42300
|
+
/**
|
|
42301
|
+
* Gets whether FXAA is enabled.
|
|
42305
42302
|
*/ get FXAA() {
|
|
42306
42303
|
return this._postEffectFXAA.get().enabled;
|
|
42307
42304
|
}
|
|
42308
42305
|
set FXAA(val) {
|
|
42309
42306
|
this._postEffectFXAA.get().enabled = !!val;
|
|
42310
42307
|
}
|
|
42311
|
-
/**
|
|
42312
|
-
* Tonemap exposure
|
|
42308
|
+
/**
|
|
42309
|
+
* Tonemap exposure
|
|
42313
42310
|
*/ get toneMapExposure() {
|
|
42314
42311
|
return this._tonemapExposure;
|
|
42315
42312
|
}
|
|
@@ -42319,156 +42316,156 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
42319
42316
|
this._postEffectTonemap.get().exposure = val;
|
|
42320
42317
|
}
|
|
42321
42318
|
}
|
|
42322
|
-
/**
|
|
42323
|
-
* Gets whether TAA is enabled.
|
|
42319
|
+
/**
|
|
42320
|
+
* Gets whether TAA is enabled.
|
|
42324
42321
|
*/ get TAA() {
|
|
42325
42322
|
return this._postEffectTAA.get().enabled;
|
|
42326
42323
|
}
|
|
42327
42324
|
set TAA(val) {
|
|
42328
42325
|
this._postEffectTAA.get().enabled = !!val;
|
|
42329
42326
|
}
|
|
42330
|
-
/**
|
|
42331
|
-
* Gets the debug flag for TAA
|
|
42327
|
+
/**
|
|
42328
|
+
* Gets the debug flag for TAA
|
|
42332
42329
|
*/ get TAADebug() {
|
|
42333
42330
|
return this._TAADebug;
|
|
42334
42331
|
}
|
|
42335
42332
|
set TAADebug(val) {
|
|
42336
42333
|
this._TAADebug = val;
|
|
42337
42334
|
}
|
|
42338
|
-
/**
|
|
42339
|
-
* Enables cascade debug visualization for directional shadows.
|
|
42335
|
+
/**
|
|
42336
|
+
* Enables cascade debug visualization for directional shadows.
|
|
42340
42337
|
*/ get shadowDebugCascades() {
|
|
42341
42338
|
return this._shadowDebugCascades;
|
|
42342
42339
|
}
|
|
42343
42340
|
set shadowDebugCascades(val) {
|
|
42344
42341
|
this._shadowDebugCascades = !!val;
|
|
42345
42342
|
}
|
|
42346
|
-
/**
|
|
42347
|
-
* Gets whether Screen Space Reflections (SSR) is enabled.
|
|
42343
|
+
/**
|
|
42344
|
+
* Gets whether Screen Space Reflections (SSR) is enabled.
|
|
42348
42345
|
*/ get SSR() {
|
|
42349
42346
|
return this._postEffectSSR.get().enabled;
|
|
42350
42347
|
}
|
|
42351
42348
|
set SSR(val) {
|
|
42352
42349
|
this._postEffectSSR.get().enabled = !!val;
|
|
42353
42350
|
}
|
|
42354
|
-
/**
|
|
42355
|
-
* Gets the maximum roughness value for screen space reflections.
|
|
42356
|
-
* Controls the cutoff point where surfaces are considered too rough for SSR.
|
|
42351
|
+
/**
|
|
42352
|
+
* Gets the maximum roughness value for screen space reflections.
|
|
42353
|
+
* Controls the cutoff point where surfaces are considered too rough for SSR.
|
|
42357
42354
|
*/ get ssrMaxRoughness() {
|
|
42358
42355
|
return this._ssrMaxRoughness;
|
|
42359
42356
|
}
|
|
42360
42357
|
set ssrMaxRoughness(val) {
|
|
42361
42358
|
this._ssrMaxRoughness = val;
|
|
42362
42359
|
}
|
|
42363
|
-
/**
|
|
42364
|
-
* Gets the roughness factor for SSR calculations.
|
|
42365
|
-
* Affects how surface roughness influences reflection clarity.
|
|
42360
|
+
/**
|
|
42361
|
+
* Gets the roughness factor for SSR calculations.
|
|
42362
|
+
* Affects how surface roughness influences reflection clarity.
|
|
42366
42363
|
*/ get ssrRoughnessFactor() {
|
|
42367
42364
|
return this._ssrRoughnessFactor;
|
|
42368
42365
|
}
|
|
42369
42366
|
set ssrRoughnessFactor(val) {
|
|
42370
42367
|
this._ssrRoughnessFactor = val;
|
|
42371
42368
|
}
|
|
42372
|
-
/**
|
|
42373
|
-
* Gets the stride value for SSR ray marching.
|
|
42374
|
-
* Controls the step size during ray marching. Larger values improve performance but may miss details.
|
|
42369
|
+
/**
|
|
42370
|
+
* Gets the stride value for SSR ray marching.
|
|
42371
|
+
* Controls the step size during ray marching. Larger values improve performance but may miss details.
|
|
42375
42372
|
*/ get ssrStride() {
|
|
42376
42373
|
return this._ssrStride;
|
|
42377
42374
|
}
|
|
42378
42375
|
set ssrStride(val) {
|
|
42379
42376
|
this._ssrStride = val;
|
|
42380
42377
|
}
|
|
42381
|
-
/**
|
|
42382
|
-
* Gets the maximum distance for SSR ray marching.
|
|
42383
|
-
* Defines how far rays will travel when searching for reflection intersections.
|
|
42378
|
+
/**
|
|
42379
|
+
* Gets the maximum distance for SSR ray marching.
|
|
42380
|
+
* Defines how far rays will travel when searching for reflection intersections.
|
|
42384
42381
|
*/ get ssrMaxDistance() {
|
|
42385
42382
|
return this._ssrParams.x;
|
|
42386
42383
|
}
|
|
42387
42384
|
set ssrMaxDistance(val) {
|
|
42388
42385
|
this._ssrParams.x = val;
|
|
42389
42386
|
}
|
|
42390
|
-
/**
|
|
42391
|
-
* Gets the number of iterations for SSR ray marching.
|
|
42392
|
-
* Higher values provide more accurate reflections but impact performance.
|
|
42387
|
+
/**
|
|
42388
|
+
* Gets the number of iterations for SSR ray marching.
|
|
42389
|
+
* Higher values provide more accurate reflections but impact performance.
|
|
42393
42390
|
*/ get ssrIterations() {
|
|
42394
42391
|
return this._ssrParams.y;
|
|
42395
42392
|
}
|
|
42396
42393
|
set ssrIterations(val) {
|
|
42397
42394
|
this._ssrParams.y = val;
|
|
42398
42395
|
}
|
|
42399
|
-
/**
|
|
42400
|
-
* Gets the thickness value for SSR calculations.
|
|
42401
|
-
* Determines the thickness threshold for surfaces when calculating reflections.
|
|
42396
|
+
/**
|
|
42397
|
+
* Gets the thickness value for SSR calculations.
|
|
42398
|
+
* Determines the thickness threshold for surfaces when calculating reflections.
|
|
42402
42399
|
*/ get ssrThickness() {
|
|
42403
42400
|
return this._ssrParams.z;
|
|
42404
42401
|
}
|
|
42405
42402
|
set ssrThickness(val) {
|
|
42406
42403
|
this._ssrParams.z = val;
|
|
42407
42404
|
}
|
|
42408
|
-
/**
|
|
42409
|
-
* Gets whether SSR should calculate thickness automatically.
|
|
42410
|
-
* When enabled, the system will dynamically compute surface thickness for reflections.
|
|
42405
|
+
/**
|
|
42406
|
+
* Gets whether SSR should calculate thickness automatically.
|
|
42407
|
+
* When enabled, the system will dynamically compute surface thickness for reflections.
|
|
42411
42408
|
*/ get ssrCalcThickness() {
|
|
42412
42409
|
return this._ssrCalcThickness;
|
|
42413
42410
|
}
|
|
42414
42411
|
set ssrCalcThickness(val) {
|
|
42415
42412
|
this._ssrCalcThickness = !!val;
|
|
42416
42413
|
}
|
|
42417
|
-
/**
|
|
42418
|
-
* Gets the blur scale factor for SSR.
|
|
42419
|
-
* Controls the overall intensity of the blur effect applied to reflections.
|
|
42414
|
+
/**
|
|
42415
|
+
* Gets the blur scale factor for SSR.
|
|
42416
|
+
* Controls the overall intensity of the blur effect applied to reflections.
|
|
42420
42417
|
*/ get ssrBlurScale() {
|
|
42421
42418
|
return this._ssrBlurriness;
|
|
42422
42419
|
}
|
|
42423
42420
|
set ssrBlurScale(val) {
|
|
42424
42421
|
this._ssrBlurriness = val;
|
|
42425
42422
|
}
|
|
42426
|
-
/**
|
|
42427
|
-
* Gets the depth cutoff value for SSR blur.
|
|
42428
|
-
* Determines at what depth difference the blur effect should be reduced or eliminated.
|
|
42423
|
+
/**
|
|
42424
|
+
* Gets the depth cutoff value for SSR blur.
|
|
42425
|
+
* Determines at what depth difference the blur effect should be reduced or eliminated.
|
|
42429
42426
|
*/ get ssrBlurDepthCutoff() {
|
|
42430
42427
|
return this._ssrBlurDepthCutoff;
|
|
42431
42428
|
}
|
|
42432
42429
|
set ssrBlurDepthCutoff(val) {
|
|
42433
42430
|
this._ssrBlurDepthCutoff = val;
|
|
42434
42431
|
}
|
|
42435
|
-
/**
|
|
42436
|
-
* Gets the kernel size for the SSR blur effect.
|
|
42437
|
-
* Defines the size of the blur kernel. Larger values create softer, more spread-out blur.
|
|
42432
|
+
/**
|
|
42433
|
+
* Gets the kernel size for the SSR blur effect.
|
|
42434
|
+
* Defines the size of the blur kernel. Larger values create softer, more spread-out blur.
|
|
42438
42435
|
*/ get ssrBlurKernelSize() {
|
|
42439
42436
|
return this._ssrBlurKernelSize;
|
|
42440
42437
|
}
|
|
42441
42438
|
set ssrBlurKernelSize(val) {
|
|
42442
42439
|
this._ssrBlurKernelSize = val;
|
|
42443
42440
|
}
|
|
42444
|
-
/**
|
|
42445
|
-
* Gets the standard deviation for the SSR Gaussian blur.
|
|
42446
|
-
* Controls the distribution of the blur effect. Higher values create more pronounced blur.
|
|
42441
|
+
/**
|
|
42442
|
+
* Gets the standard deviation for the SSR Gaussian blur.
|
|
42443
|
+
* Controls the distribution of the blur effect. Higher values create more pronounced blur.
|
|
42447
42444
|
*/ get ssrBlurStdDev() {
|
|
42448
42445
|
return this._ssrBlurStdDev;
|
|
42449
42446
|
}
|
|
42450
42447
|
set ssrBlurStdDev(val) {
|
|
42451
42448
|
this._ssrBlurStdDev = val;
|
|
42452
42449
|
}
|
|
42453
|
-
/**
|
|
42454
|
-
* Gets whether SSR temporal accumulation is enabled.
|
|
42450
|
+
/**
|
|
42451
|
+
* Gets whether SSR temporal accumulation is enabled.
|
|
42455
42452
|
*/ get ssrTemporal() {
|
|
42456
42453
|
return this._ssrTemporal;
|
|
42457
42454
|
}
|
|
42458
42455
|
set ssrTemporal(val) {
|
|
42459
42456
|
this._ssrTemporal = !!val;
|
|
42460
42457
|
}
|
|
42461
|
-
/**
|
|
42462
|
-
* Gets SSR temporal blending weight in [0, 1].
|
|
42463
|
-
* Higher values rely more on reprojected history.
|
|
42458
|
+
/**
|
|
42459
|
+
* Gets SSR temporal blending weight in [0, 1].
|
|
42460
|
+
* Higher values rely more on reprojected history.
|
|
42464
42461
|
*/ get ssrTemporalWeight() {
|
|
42465
42462
|
return this._ssrTemporalWeight;
|
|
42466
42463
|
}
|
|
42467
42464
|
set ssrTemporalWeight(val) {
|
|
42468
42465
|
this._ssrTemporalWeight = Math.max(0, Math.min(1, val ?? 0));
|
|
42469
42466
|
}
|
|
42470
|
-
/**
|
|
42471
|
-
* Gets whether Screen Space Subsurface Scattering (SSS) is enabled.
|
|
42467
|
+
/**
|
|
42468
|
+
* Gets whether Screen Space Subsurface Scattering (SSS) is enabled.
|
|
42472
42469
|
*/ get SSS() {
|
|
42473
42470
|
return this._postEffectSSS.get().enabled;
|
|
42474
42471
|
}
|
|
@@ -42481,11 +42478,11 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
42481
42478
|
set sssBlurScale(val) {
|
|
42482
42479
|
this._sssBlurScale = Math.max(0, val ?? 0);
|
|
42483
42480
|
}
|
|
42484
|
-
/**
|
|
42485
|
-
* High-level quality preset for SSS blur controls.
|
|
42486
|
-
*
|
|
42487
|
-
* This is the primary user-facing SSS quality control and only affects
|
|
42488
|
-
* the blur sampling quality/performance tradeoff, not the authored look.
|
|
42481
|
+
/**
|
|
42482
|
+
* High-level quality preset for SSS blur controls.
|
|
42483
|
+
*
|
|
42484
|
+
* This is the primary user-facing SSS quality control and only affects
|
|
42485
|
+
* the blur sampling quality/performance tradeoff, not the authored look.
|
|
42489
42486
|
*/ get sssQualityPreset() {
|
|
42490
42487
|
return this._sssQualityPreset;
|
|
42491
42488
|
}
|
|
@@ -42532,8 +42529,8 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
42532
42529
|
/** @internal */ get ssrParams() {
|
|
42533
42530
|
return this._ssrParams;
|
|
42534
42531
|
}
|
|
42535
|
-
/**
|
|
42536
|
-
* Gets whether SSAO is enabled.
|
|
42532
|
+
/**
|
|
42533
|
+
* Gets whether SSAO is enabled.
|
|
42537
42534
|
*/ get SSAO() {
|
|
42538
42535
|
return this._postEffectSSAO.get().enabled;
|
|
42539
42536
|
}
|
|
@@ -42673,27 +42670,27 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
42673
42670
|
}
|
|
42674
42671
|
return this._viewport;
|
|
42675
42672
|
}
|
|
42676
|
-
/**
|
|
42677
|
-
* Screen configuration used for adapting the camera viewport
|
|
42673
|
+
/**
|
|
42674
|
+
* Screen configuration used for adapting the camera viewport
|
|
42678
42675
|
*/ get screenConfig() {
|
|
42679
42676
|
return this._screenAdapter.config;
|
|
42680
42677
|
}
|
|
42681
42678
|
set screenConfig(config) {
|
|
42682
42679
|
this._screenAdapter.config = config;
|
|
42683
42680
|
}
|
|
42684
|
-
/**
|
|
42685
|
-
* Screen viewport used for adapting the camera viewport
|
|
42681
|
+
/**
|
|
42682
|
+
* Screen viewport used for adapting the camera viewport
|
|
42686
42683
|
*/ get screenViewport() {
|
|
42687
42684
|
return this._screenAdapter.viewport;
|
|
42688
42685
|
}
|
|
42689
42686
|
set screenViewport(viewport) {
|
|
42690
42687
|
this._screenAdapter.viewport = viewport;
|
|
42691
42688
|
}
|
|
42692
|
-
/**
|
|
42693
|
-
* Handle input events
|
|
42694
|
-
* @param ev - input event object
|
|
42695
|
-
* @param type - event type, default to ev.type
|
|
42696
|
-
* @returns Boolean value indicates whether the event was handled.
|
|
42689
|
+
/**
|
|
42690
|
+
* Handle input events
|
|
42691
|
+
* @param ev - input event object
|
|
42692
|
+
* @param type - event type, default to ev.type
|
|
42693
|
+
* @returns Boolean value indicates whether the event was handled.
|
|
42697
42694
|
*/ handleEvent(ev, type) {
|
|
42698
42695
|
let handled = false;
|
|
42699
42696
|
if (this._controller) {
|
|
@@ -42726,12 +42723,12 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
42726
42723
|
}
|
|
42727
42724
|
return handled;
|
|
42728
42725
|
}
|
|
42729
|
-
/**
|
|
42730
|
-
* Constructs a ray based on the given screen coordinates.
|
|
42731
|
-
*
|
|
42732
|
-
* @param x - The x-component of the screen coordinates, relative to the top-left corner of the viewport.
|
|
42733
|
-
* @param y - The y-component of the screen coordinates, relative to the top-left corner of the viewport.
|
|
42734
|
-
* @returns The ray originating from the camera position and passing through the given screen coordinates.
|
|
42726
|
+
/**
|
|
42727
|
+
* Constructs a ray based on the given screen coordinates.
|
|
42728
|
+
*
|
|
42729
|
+
* @param x - The x-component of the screen coordinates, relative to the top-left corner of the viewport.
|
|
42730
|
+
* @param y - The y-component of the screen coordinates, relative to the top-left corner of the viewport.
|
|
42731
|
+
* @returns The ray originating from the camera position and passing through the given screen coordinates.
|
|
42735
42732
|
*/ constructRay(x, y) {
|
|
42736
42733
|
const width = this.viewport ? this.viewport[2] : getDevice().getViewport().width;
|
|
42737
42734
|
const height = this.viewport ? this.viewport[3] : getDevice().getViewport().height;
|
|
@@ -42749,54 +42746,54 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
42749
42746
|
const vDir = Vector3.sub(farWorld.xyz(), vEye).inplaceNormalize();
|
|
42750
42747
|
return new Ray(vEye, vDir);
|
|
42751
42748
|
}
|
|
42752
|
-
/**
|
|
42753
|
-
* Place the camera by specifying the camera position and the target point
|
|
42754
|
-
* @param eye - The camera position
|
|
42755
|
-
* @param target - The target point to look at
|
|
42756
|
-
* @param up - The up vector
|
|
42757
|
-
* @returns self
|
|
42749
|
+
/**
|
|
42750
|
+
* Place the camera by specifying the camera position and the target point
|
|
42751
|
+
* @param eye - The camera position
|
|
42752
|
+
* @param target - The target point to look at
|
|
42753
|
+
* @param up - The up vector
|
|
42754
|
+
* @returns self
|
|
42758
42755
|
*/ lookAt(eye, target, up) {
|
|
42759
42756
|
return this.setLocalTransform(Matrix4x4.lookAt(eye, target, up));
|
|
42760
42757
|
}
|
|
42761
|
-
/**
|
|
42762
|
-
* Place the camera to look at a given cube face at a given camera position
|
|
42763
|
-
* @param face - The cube face to look at
|
|
42764
|
-
* @param position - The camera position
|
|
42765
|
-
* @returns self
|
|
42758
|
+
/**
|
|
42759
|
+
* Place the camera to look at a given cube face at a given camera position
|
|
42760
|
+
* @param face - The cube face to look at
|
|
42761
|
+
* @param position - The camera position
|
|
42762
|
+
* @returns self
|
|
42766
42763
|
*/ lookAtCubeFace(face, position) {
|
|
42767
42764
|
return this.setLocalTransform(Matrix4x4.lookAtCubeFace(face, position ?? this.position));
|
|
42768
42765
|
}
|
|
42769
|
-
/**
|
|
42770
|
-
* Setup a perspective projection matrix for the camera
|
|
42771
|
-
* @param fovY - The vertical field of view in radians.
|
|
42772
|
-
* @param aspect - The aspect ratio
|
|
42773
|
-
* @param zNear - The near clip plane
|
|
42774
|
-
* @param zFar - The far clip plane
|
|
42775
|
-
* @returns self
|
|
42766
|
+
/**
|
|
42767
|
+
* Setup a perspective projection matrix for the camera
|
|
42768
|
+
* @param fovY - The vertical field of view in radians.
|
|
42769
|
+
* @param aspect - The aspect ratio
|
|
42770
|
+
* @param zNear - The near clip plane
|
|
42771
|
+
* @param zFar - The far clip plane
|
|
42772
|
+
* @returns self
|
|
42776
42773
|
*/ setPerspective(fovY, aspect, zNear, zFar) {
|
|
42777
42774
|
this._projMatrix.perspective(fovY, aspect, zNear, zFar);
|
|
42778
42775
|
Matrix4x4.invert(this._projMatrix, this._invProjMatrix);
|
|
42779
42776
|
this._invalidate(true);
|
|
42780
42777
|
return this;
|
|
42781
42778
|
}
|
|
42782
|
-
/**
|
|
42783
|
-
* Setup a orthogonal projection matrix for the camera
|
|
42784
|
-
* @param left - Left bound of the frustum
|
|
42785
|
-
* @param right - Right bound of the frustum
|
|
42786
|
-
* @param bottom - Bottom bound of the frustum
|
|
42787
|
-
* @param top - Top bound of the frustum
|
|
42788
|
-
* @param near - Near bound of the frustum.
|
|
42789
|
-
* @param far - Far bound of the frustum.
|
|
42790
|
-
* @returns self
|
|
42779
|
+
/**
|
|
42780
|
+
* Setup a orthogonal projection matrix for the camera
|
|
42781
|
+
* @param left - Left bound of the frustum
|
|
42782
|
+
* @param right - Right bound of the frustum
|
|
42783
|
+
* @param bottom - Bottom bound of the frustum
|
|
42784
|
+
* @param top - Top bound of the frustum
|
|
42785
|
+
* @param near - Near bound of the frustum.
|
|
42786
|
+
* @param far - Far bound of the frustum.
|
|
42787
|
+
* @returns self
|
|
42791
42788
|
*/ setOrtho(left, right, bottom, top, near, far) {
|
|
42792
42789
|
this._projMatrix.ortho(left, right, bottom, top, near, far);
|
|
42793
42790
|
Matrix4x4.invert(this._projMatrix, this._invProjMatrix);
|
|
42794
42791
|
this._invalidate(true);
|
|
42795
42792
|
return this;
|
|
42796
42793
|
}
|
|
42797
|
-
/**
|
|
42798
|
-
* Setup a projection matrix for the camera
|
|
42799
|
-
* @param matrix - The projection matrix
|
|
42794
|
+
/**
|
|
42795
|
+
* Setup a projection matrix for the camera
|
|
42796
|
+
* @param matrix - The projection matrix
|
|
42800
42797
|
*/ setProjectionMatrix(matrix) {
|
|
42801
42798
|
if (matrix && matrix !== this._projMatrix) {
|
|
42802
42799
|
this._projMatrix = matrix;
|
|
@@ -42804,18 +42801,18 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
42804
42801
|
this._invalidate(true);
|
|
42805
42802
|
}
|
|
42806
42803
|
}
|
|
42807
|
-
/**
|
|
42808
|
-
* Gets the projection matrix of the camera
|
|
42809
|
-
* @returns The projection matrix
|
|
42804
|
+
/**
|
|
42805
|
+
* Gets the projection matrix of the camera
|
|
42806
|
+
* @returns The projection matrix
|
|
42810
42807
|
*/ getProjectionMatrix() {
|
|
42811
42808
|
if (this.dirtyCheck()) {
|
|
42812
42809
|
this._compute();
|
|
42813
42810
|
}
|
|
42814
42811
|
return this._projMatrix;
|
|
42815
42812
|
}
|
|
42816
|
-
/**
|
|
42817
|
-
* Gets the inverse projection matrix of the camera
|
|
42818
|
-
* @returns The projection matrix
|
|
42813
|
+
/**
|
|
42814
|
+
* Gets the inverse projection matrix of the camera
|
|
42815
|
+
* @returns The projection matrix
|
|
42819
42816
|
*/ getInvProjectionMatrix() {
|
|
42820
42817
|
if (this.dirtyCheck()) {
|
|
42821
42818
|
this._compute();
|
|
@@ -42833,11 +42830,11 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
42833
42830
|
rotationMatrix.setRow(2, new Vector4(zAxis.x, zAxis.y, zAxis.z, 0));
|
|
42834
42831
|
return rotationMatrix;
|
|
42835
42832
|
}
|
|
42836
|
-
/**
|
|
42837
|
-
* View matrix of the camera
|
|
42838
|
-
*
|
|
42839
|
-
* @remarks
|
|
42840
|
-
* Camera's view matrix will transform a point from the world space to the camera space
|
|
42833
|
+
/**
|
|
42834
|
+
* View matrix of the camera
|
|
42835
|
+
*
|
|
42836
|
+
* @remarks
|
|
42837
|
+
* Camera's view matrix will transform a point from the world space to the camera space
|
|
42841
42838
|
*/ get viewMatrix() {
|
|
42842
42839
|
if (this.dirtyCheck()) {
|
|
42843
42840
|
this._compute();
|
|
@@ -42850,11 +42847,11 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
42850
42847
|
}
|
|
42851
42848
|
return this._viewProjMatrix;
|
|
42852
42849
|
}
|
|
42853
|
-
/**
|
|
42854
|
-
* The inverse-view-projection matrix of the camera
|
|
42855
|
-
*
|
|
42856
|
-
* @remarks
|
|
42857
|
-
* The inverse-view-projection matrix transforms a point from the clip space to the camera space
|
|
42850
|
+
/**
|
|
42851
|
+
* The inverse-view-projection matrix of the camera
|
|
42852
|
+
*
|
|
42853
|
+
* @remarks
|
|
42854
|
+
* The inverse-view-projection matrix transforms a point from the clip space to the camera space
|
|
42858
42855
|
*/ get invViewProjectionMatrix() {
|
|
42859
42856
|
if (this.dirtyCheck()) {
|
|
42860
42857
|
this._compute();
|
|
@@ -42906,9 +42903,9 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
42906
42903
|
/** Returns true if the camera is orthographic */ isOrtho() {
|
|
42907
42904
|
return this.getProjectionMatrix().isOrtho();
|
|
42908
42905
|
}
|
|
42909
|
-
/**
|
|
42910
|
-
* Gets the camera history data which is used in temporal reprojection
|
|
42911
|
-
* @returns Camera history data
|
|
42906
|
+
/**
|
|
42907
|
+
* Gets the camera history data which is used in temporal reprojection
|
|
42908
|
+
* @returns Camera history data
|
|
42912
42909
|
*/ getHistoryData() {
|
|
42913
42910
|
let data = Camera._historyData.get(this);
|
|
42914
42911
|
if (!data) {
|
|
@@ -42922,8 +42919,8 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
42922
42919
|
}
|
|
42923
42920
|
return data;
|
|
42924
42921
|
}
|
|
42925
|
-
/**
|
|
42926
|
-
* Clears the camera history data which is used in temporal reprojection
|
|
42922
|
+
/**
|
|
42923
|
+
* Clears the camera history data which is used in temporal reprojection
|
|
42927
42924
|
*/ clearHistoryData() {
|
|
42928
42925
|
const data = Camera._historyData.get(this);
|
|
42929
42926
|
if (data) {
|
|
@@ -43037,10 +43034,10 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
43037
43034
|
this._sssResolvedSettings.blurDepthCutoff = source.blurDepthCutoff;
|
|
43038
43035
|
this._sssResolvedSettings.normalCutoff = source.normalCutoff;
|
|
43039
43036
|
}
|
|
43040
|
-
/**
|
|
43041
|
-
* Renders a scene
|
|
43042
|
-
* @param scene - The scene to be rendered
|
|
43043
|
-
* @param compositor - Compositor instance that will be used to apply postprocess effects
|
|
43037
|
+
/**
|
|
43038
|
+
* Renders a scene
|
|
43039
|
+
* @param scene - The scene to be rendered
|
|
43040
|
+
* @param compositor - Compositor instance that will be used to apply postprocess effects
|
|
43044
43041
|
*/ render(scene) {
|
|
43045
43042
|
const device = getDevice();
|
|
43046
43043
|
//this.updatePostProcessing(device);
|
|
@@ -43114,13 +43111,13 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
43114
43111
|
/** @internal */ getPickPosY() {
|
|
43115
43112
|
return this._pickPosY;
|
|
43116
43113
|
}
|
|
43117
|
-
/**
|
|
43118
|
-
* Updates the controller state
|
|
43114
|
+
/**
|
|
43115
|
+
* Updates the controller state
|
|
43119
43116
|
*/ updateController() {
|
|
43120
43117
|
this._controller?.update();
|
|
43121
43118
|
}
|
|
43122
|
-
/**
|
|
43123
|
-
* Reset the controller
|
|
43119
|
+
/**
|
|
43120
|
+
* Reset the controller
|
|
43124
43121
|
*/ resetController() {
|
|
43125
43122
|
this._controller?.reset();
|
|
43126
43123
|
}
|
|
@@ -43145,15 +43142,15 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
43145
43142
|
/** @internal */ get prevPosition() {
|
|
43146
43143
|
return this._prevPosition;
|
|
43147
43144
|
}
|
|
43148
|
-
/**
|
|
43149
|
-
* Gets the camera history resource manager for temporal effects.
|
|
43145
|
+
/**
|
|
43146
|
+
* Gets the camera history resource manager for temporal effects.
|
|
43150
43147
|
*/ getHistoryResourceManager() {
|
|
43151
43148
|
return Camera._historyResourceManager.get(this) ?? null;
|
|
43152
43149
|
}
|
|
43153
|
-
/**
|
|
43154
|
-
* Sets the camera history resource manager for temporal effects.
|
|
43155
|
-
*
|
|
43156
|
-
* @internal
|
|
43150
|
+
/**
|
|
43151
|
+
* Sets the camera history resource manager for temporal effects.
|
|
43152
|
+
*
|
|
43153
|
+
* @internal
|
|
43157
43154
|
*/ setHistoryResourceManager(manager) {
|
|
43158
43155
|
Camera._historyResourceManager.set(this, manager);
|
|
43159
43156
|
}
|
|
@@ -47323,14 +47320,14 @@ class GlobalBindGroupAllocator {
|
|
|
47323
47320
|
}
|
|
47324
47321
|
}
|
|
47325
47322
|
|
|
47326
|
-
/**
|
|
47327
|
-
* Forward render scheme
|
|
47328
|
-
* @internal
|
|
47323
|
+
/**
|
|
47324
|
+
* Forward render scheme
|
|
47325
|
+
* @internal
|
|
47329
47326
|
*/ class SceneRenderer {
|
|
47330
|
-
/**
|
|
47331
|
-
* Renders a scene by given camera
|
|
47332
|
-
* @param scene - The scene to render
|
|
47333
|
-
* @param camera - The camera that will be used to render the scene
|
|
47327
|
+
/**
|
|
47328
|
+
* Renders a scene by given camera
|
|
47329
|
+
* @param scene - The scene to render
|
|
47330
|
+
* @param camera - The camera that will be used to render the scene
|
|
47334
47331
|
*/ static renderScene(scene, camera) {
|
|
47335
47332
|
const device = getDevice();
|
|
47336
47333
|
const halfFloatColorBuffer = device.getDeviceCaps().textureCaps.supportHalfFloatColorBuffer;
|
|
@@ -48912,7 +48909,7 @@ class BlurBlitter extends GaussianBlurBlitter {
|
|
|
48912
48909
|
}
|
|
48913
48910
|
getShadowMapColorFormat(_shadowMapParams) {
|
|
48914
48911
|
const device = getDevice();
|
|
48915
|
-
return device.getDeviceCaps().textureCaps.supportFloatColorBuffer ? device.type === 'webgl' ? 'rgba32f' : 'rg32f' : device.getDeviceCaps().textureCaps.supportHalfFloatColorBuffer ? device.type === 'webgl' ? 'rgba16f' : 'rg16f' : 'rgba8unorm';
|
|
48912
|
+
return device.getDeviceCaps().textureCaps.supportFloatColorBuffer && device.getDeviceCaps().textureCaps.supportLinearFloatTexture ? device.type === 'webgl' ? 'rgba32f' : 'rg32f' : device.getDeviceCaps().textureCaps.supportHalfFloatColorBuffer && device.getDeviceCaps().textureCaps.supportLinearHalfFloatTexture ? device.type === 'webgl' ? 'rgba16f' : 'rg16f' : 'rgba8unorm';
|
|
48916
48913
|
}
|
|
48917
48914
|
getShadowMapDepthFormat(_shadowMapParams) {
|
|
48918
48915
|
return 'd24s8';
|
|
@@ -49656,10 +49653,10 @@ class VSMBlitter extends Blitter {
|
|
|
49656
49653
|
/** @internal */ _region;
|
|
49657
49654
|
/** @internal */ _staticCasters;
|
|
49658
49655
|
/** @internal */ _dynamicCasters;
|
|
49659
|
-
/**
|
|
49660
|
-
* Creates a shadow region.
|
|
49661
|
-
*
|
|
49662
|
-
* @param region - Optional manual world-space AABB used to initialize the region.
|
|
49656
|
+
/**
|
|
49657
|
+
* Creates a shadow region.
|
|
49658
|
+
*
|
|
49659
|
+
* @param region - Optional manual world-space AABB used to initialize the region.
|
|
49663
49660
|
*/ constructor(region){
|
|
49664
49661
|
super();
|
|
49665
49662
|
this._manualRegion = region ? new AABB(region) : null;
|
|
@@ -49670,47 +49667,47 @@ class VSMBlitter extends Blitter {
|
|
|
49670
49667
|
this._dynamicCasters = [];
|
|
49671
49668
|
this.updateRegion();
|
|
49672
49669
|
}
|
|
49673
|
-
/**
|
|
49674
|
-
* Final world-space shadow region.
|
|
49675
|
-
*
|
|
49676
|
-
* @returns The union of the manual, static caster, and dynamic caster regions, or `null` if no valid region exists.
|
|
49670
|
+
/**
|
|
49671
|
+
* Final world-space shadow region.
|
|
49672
|
+
*
|
|
49673
|
+
* @returns The union of the manual, static caster, and dynamic caster regions, or `null` if no valid region exists.
|
|
49677
49674
|
*/ get region() {
|
|
49678
49675
|
return this._region.isValid() ? this._region : null;
|
|
49679
49676
|
}
|
|
49680
|
-
/**
|
|
49681
|
-
* Region contributed by manually assigned AABB.
|
|
49682
|
-
*
|
|
49683
|
-
* @returns The manually assigned region, or `null` if no manual region is set.
|
|
49677
|
+
/**
|
|
49678
|
+
* Region contributed by manually assigned AABB.
|
|
49679
|
+
*
|
|
49680
|
+
* @returns The manually assigned region, or `null` if no manual region is set.
|
|
49684
49681
|
*/ get manualRegion() {
|
|
49685
49682
|
return this._manualRegion;
|
|
49686
49683
|
}
|
|
49687
|
-
/**
|
|
49688
|
-
* Region contributed by static shadow casters.
|
|
49689
|
-
*
|
|
49690
|
-
* @returns The combined static caster region, or `null` if no valid static caster region exists.
|
|
49684
|
+
/**
|
|
49685
|
+
* Region contributed by static shadow casters.
|
|
49686
|
+
*
|
|
49687
|
+
* @returns The combined static caster region, or `null` if no valid static caster region exists.
|
|
49691
49688
|
*/ get staticRegion() {
|
|
49692
49689
|
return this._staticRegion.isValid() ? this._staticRegion : null;
|
|
49693
49690
|
}
|
|
49694
|
-
/**
|
|
49695
|
-
* Region contributed by dynamic shadow casters.
|
|
49696
|
-
*
|
|
49697
|
-
* @returns The combined dynamic caster region, or `null` if no valid dynamic caster region exists.
|
|
49691
|
+
/**
|
|
49692
|
+
* Region contributed by dynamic shadow casters.
|
|
49693
|
+
*
|
|
49694
|
+
* @returns The combined dynamic caster region, or `null` if no valid dynamic caster region exists.
|
|
49698
49695
|
*/ get dynamicRegion() {
|
|
49699
49696
|
return this._dynamicRegion.isValid() ? this._dynamicRegion : null;
|
|
49700
49697
|
}
|
|
49701
|
-
/**
|
|
49702
|
-
* Assigns a manual world-space AABB to the region.
|
|
49703
|
-
*
|
|
49704
|
-
* @param region - The manual world-space AABB to use, or `null` to clear the manual region.
|
|
49698
|
+
/**
|
|
49699
|
+
* Assigns a manual world-space AABB to the region.
|
|
49700
|
+
*
|
|
49701
|
+
* @param region - The manual world-space AABB to use, or `null` to clear the manual region.
|
|
49705
49702
|
*/ setRegion(region) {
|
|
49706
49703
|
this._manualRegion = region ? new AABB(region) : null;
|
|
49707
49704
|
this.updateRegion();
|
|
49708
49705
|
}
|
|
49709
|
-
/**
|
|
49710
|
-
* Adds a static shadow caster using a snapshot of its current world-space AABB.
|
|
49711
|
-
*
|
|
49712
|
-
* @param caster - The mesh or clipmap terrain node to include as a static caster.
|
|
49713
|
-
* @returns `this` for chaining.
|
|
49706
|
+
/**
|
|
49707
|
+
* Adds a static shadow caster using a snapshot of its current world-space AABB.
|
|
49708
|
+
*
|
|
49709
|
+
* @param caster - The mesh or clipmap terrain node to include as a static caster.
|
|
49710
|
+
* @returns `this` for chaining.
|
|
49714
49711
|
*/ addStaticCaster(caster) {
|
|
49715
49712
|
if (!this.isShadowCaster(caster) || this.hasCaster(caster)) {
|
|
49716
49713
|
return this;
|
|
@@ -49727,11 +49724,11 @@ class VSMBlitter extends Blitter {
|
|
|
49727
49724
|
this.updateRegion();
|
|
49728
49725
|
return this;
|
|
49729
49726
|
}
|
|
49730
|
-
/**
|
|
49731
|
-
* Adds a dynamic shadow caster and tracks its bounding volume changes.
|
|
49732
|
-
*
|
|
49733
|
-
* @param caster - The mesh or clipmap terrain node to include as a dynamic caster.
|
|
49734
|
-
* @returns `this` for chaining.
|
|
49727
|
+
/**
|
|
49728
|
+
* Adds a dynamic shadow caster and tracks its bounding volume changes.
|
|
49729
|
+
*
|
|
49730
|
+
* @param caster - The mesh or clipmap terrain node to include as a dynamic caster.
|
|
49731
|
+
* @returns `this` for chaining.
|
|
49735
49732
|
*/ addDynamicCaster(caster) {
|
|
49736
49733
|
if (!this.isShadowCaster(caster) || this.hasCaster(caster)) {
|
|
49737
49734
|
return this;
|
|
@@ -49751,11 +49748,11 @@ class VSMBlitter extends Blitter {
|
|
|
49751
49748
|
}
|
|
49752
49749
|
return this;
|
|
49753
49750
|
}
|
|
49754
|
-
/**
|
|
49755
|
-
* Removes a previously added shadow caster.
|
|
49756
|
-
*
|
|
49757
|
-
* @param caster - The caster node to remove from the static or dynamic caster list.
|
|
49758
|
-
* @returns `this` for chaining.
|
|
49751
|
+
/**
|
|
49752
|
+
* Removes a previously added shadow caster.
|
|
49753
|
+
*
|
|
49754
|
+
* @param caster - The caster node to remove from the static or dynamic caster list.
|
|
49755
|
+
* @returns `this` for chaining.
|
|
49759
49756
|
*/ removeCaster(caster) {
|
|
49760
49757
|
let changed = false;
|
|
49761
49758
|
for(let i = this._staticCasters.length - 1; i >= 0; i--){
|
|
@@ -49783,8 +49780,8 @@ class VSMBlitter extends Blitter {
|
|
|
49783
49780
|
}
|
|
49784
49781
|
return this;
|
|
49785
49782
|
}
|
|
49786
|
-
/**
|
|
49787
|
-
* Removes all shadow casters while keeping the manual region.
|
|
49783
|
+
/**
|
|
49784
|
+
* Removes all shadow casters while keeping the manual region.
|
|
49788
49785
|
*/ clearCasters() {
|
|
49789
49786
|
for (const entry of this._dynamicCasters){
|
|
49790
49787
|
entry.ref.get()?.off('bvchanged', entry.callback);
|
|
@@ -49799,10 +49796,10 @@ class VSMBlitter extends Blitter {
|
|
|
49799
49796
|
this._dynamicRegion.beginExtend();
|
|
49800
49797
|
this.updateRegion();
|
|
49801
49798
|
}
|
|
49802
|
-
/**
|
|
49803
|
-
* Clears the manual region and all shadow casters.
|
|
49804
|
-
*
|
|
49805
|
-
* @returns `this` for chaining.
|
|
49799
|
+
/**
|
|
49800
|
+
* Clears the manual region and all shadow casters.
|
|
49801
|
+
*
|
|
49802
|
+
* @returns `this` for chaining.
|
|
49806
49803
|
*/ clear() {
|
|
49807
49804
|
this._manualRegion = null;
|
|
49808
49805
|
this.clearCasters();
|
|
@@ -62532,30 +62529,30 @@ const _defaultTA = createTransformAccess(new SceneNode(null), false);
|
|
|
62532
62529
|
}
|
|
62533
62530
|
}
|
|
62534
62531
|
|
|
62535
|
-
/**
|
|
62536
|
-
* Post-processor wrapper for joint dynamics systems.
|
|
62537
|
-
*
|
|
62538
|
-
* Integrates joint-based physics simulation into the skeleton post-processing pipeline.
|
|
62539
|
-
* The joint dynamics system is updated each frame and results are blended with the base animation.
|
|
62540
|
-
*
|
|
62541
|
-
* @public
|
|
62532
|
+
/**
|
|
62533
|
+
* Post-processor wrapper for joint dynamics systems.
|
|
62534
|
+
*
|
|
62535
|
+
* Integrates joint-based physics simulation into the skeleton post-processing pipeline.
|
|
62536
|
+
* The joint dynamics system is updated each frame and results are blended with the base animation.
|
|
62537
|
+
*
|
|
62538
|
+
* @public
|
|
62542
62539
|
*/ class JointDynamicsModifier extends SkeletonModifier {
|
|
62543
62540
|
_jointDynamicsSystem;
|
|
62544
|
-
/**
|
|
62545
|
-
* Create a joint dynamics post-processor.
|
|
62546
|
-
*
|
|
62547
|
-
* @param jointDynamicsSystem - The joint dynamics system to integrate
|
|
62541
|
+
/**
|
|
62542
|
+
* Create a joint dynamics post-processor.
|
|
62543
|
+
*
|
|
62544
|
+
* @param jointDynamicsSystem - The joint dynamics system to integrate
|
|
62548
62545
|
*/ constructor(jointDynamicsSystem){
|
|
62549
62546
|
super();
|
|
62550
62547
|
this._jointDynamicsSystem = jointDynamicsSystem;
|
|
62551
62548
|
}
|
|
62552
|
-
/**
|
|
62553
|
-
* Get the joint dynamics system.
|
|
62549
|
+
/**
|
|
62550
|
+
* Get the joint dynamics system.
|
|
62554
62551
|
*/ get jointDynamicsSystem() {
|
|
62555
62552
|
return this._jointDynamicsSystem;
|
|
62556
62553
|
}
|
|
62557
|
-
/**
|
|
62558
|
-
* Apply spring physics to skeleton joints.
|
|
62554
|
+
/**
|
|
62555
|
+
* Apply spring physics to skeleton joints.
|
|
62559
62556
|
*/ apply(_skeleton, deltaTime) {
|
|
62560
62557
|
if (!this._enabled || this.weight <= 0) {
|
|
62561
62558
|
return;
|
|
@@ -62563,14 +62560,14 @@ const _defaultTA = createTransformAccess(new SceneNode(null), false);
|
|
|
62563
62560
|
// Update spring physics simulation
|
|
62564
62561
|
this._jointDynamicsSystem.update(deltaTime);
|
|
62565
62562
|
}
|
|
62566
|
-
/**
|
|
62567
|
-
* Reset the spring system to initial state.
|
|
62563
|
+
/**
|
|
62564
|
+
* Reset the spring system to initial state.
|
|
62568
62565
|
*/ reset() {
|
|
62569
62566
|
this._jointDynamicsSystem.resetChains();
|
|
62570
62567
|
this._jointDynamicsSystem.controller.reset();
|
|
62571
62568
|
}
|
|
62572
|
-
/**
|
|
62573
|
-
* @deprecated Use {@link JointDynamicsModifier.reset}. Kept as a compatibility alias for teleport handling.
|
|
62569
|
+
/**
|
|
62570
|
+
* @deprecated Use {@link JointDynamicsModifier.reset}. Kept as a compatibility alias for teleport handling.
|
|
62574
62571
|
*/ warp() {
|
|
62575
62572
|
this._jointDynamicsSystem.controller.reset();
|
|
62576
62573
|
}
|
|
@@ -78994,29 +78991,29 @@ const defaultValues = {
|
|
|
78994
78991
|
],
|
|
78995
78992
|
command: null
|
|
78996
78993
|
};
|
|
78997
|
-
/**
|
|
78998
|
-
* Manages serialization and deserialization of engine objects to/from JSON,
|
|
78999
|
-
* including asset resolution via a virtual file system (VFS) and asset manager.
|
|
79000
|
-
*
|
|
79001
|
-
* @remarks
|
|
79002
|
-
* - Keeps a registry of serializable classes and their properties.
|
|
79003
|
-
* - Converts object graphs to JSON using per-class metadata and property accessors.
|
|
79004
|
-
* - Supports async asset embedding/export and lazy deserialization via phases.
|
|
79005
|
-
* - Maps loaded assets/objects back to their source IDs for caching and deduplication.
|
|
79006
|
-
*
|
|
79007
|
-
* Typical workflow:
|
|
79008
|
-
* 1. Construct with a `VFS`.
|
|
79009
|
-
* 2. Optionally `registerClass` for custom types.
|
|
79010
|
-
* 3. Use `serializeObject` and `deserializeObject` to convert between runtime objects and JSON.
|
|
79011
|
-
* 4. Use `saveScene` / `loadScene` for scene I/O.
|
|
79012
|
-
*
|
|
79013
|
-
* Caching:
|
|
79014
|
-
* - `getAssetId` returns the known source ID for an allocated asset when available.
|
|
79015
|
-
*
|
|
79016
|
-
* Threading:
|
|
79017
|
-
* - Methods returning Promises perform async I/O using the provided `VFS`/AssetManager.
|
|
79018
|
-
*
|
|
79019
|
-
* @public
|
|
78994
|
+
/**
|
|
78995
|
+
* Manages serialization and deserialization of engine objects to/from JSON,
|
|
78996
|
+
* including asset resolution via a virtual file system (VFS) and asset manager.
|
|
78997
|
+
*
|
|
78998
|
+
* @remarks
|
|
78999
|
+
* - Keeps a registry of serializable classes and their properties.
|
|
79000
|
+
* - Converts object graphs to JSON using per-class metadata and property accessors.
|
|
79001
|
+
* - Supports async asset embedding/export and lazy deserialization via phases.
|
|
79002
|
+
* - Maps loaded assets/objects back to their source IDs for caching and deduplication.
|
|
79003
|
+
*
|
|
79004
|
+
* Typical workflow:
|
|
79005
|
+
* 1. Construct with a `VFS`.
|
|
79006
|
+
* 2. Optionally `registerClass` for custom types.
|
|
79007
|
+
* 3. Use `serializeObject` and `deserializeObject` to convert between runtime objects and JSON.
|
|
79008
|
+
* 4. Use `saveScene` / `loadScene` for scene I/O.
|
|
79009
|
+
*
|
|
79010
|
+
* Caching:
|
|
79011
|
+
* - `getAssetId` returns the known source ID for an allocated asset when available.
|
|
79012
|
+
*
|
|
79013
|
+
* Threading:
|
|
79014
|
+
* - Methods returning Promises perform async I/O using the provided `VFS`/AssetManager.
|
|
79015
|
+
*
|
|
79016
|
+
* @public
|
|
79020
79017
|
*/ class ResourceManager {
|
|
79021
79018
|
_classMap;
|
|
79022
79019
|
_vfs;
|
|
@@ -79026,10 +79023,10 @@ const defaultValues = {
|
|
|
79026
79023
|
_assetManager;
|
|
79027
79024
|
_editorMode;
|
|
79028
79025
|
_allocated;
|
|
79029
|
-
/**
|
|
79030
|
-
* Create a ResourceManager bound to a virtual file system.
|
|
79031
|
-
*
|
|
79032
|
-
* @param vfs - Virtual file system used for reading/writing assets and scenes.
|
|
79026
|
+
/**
|
|
79027
|
+
* Create a ResourceManager bound to a virtual file system.
|
|
79028
|
+
*
|
|
79029
|
+
* @param vfs - Virtual file system used for reading/writing assets and scenes.
|
|
79033
79030
|
*/ constructor(vfs, editorMode = false){
|
|
79034
79031
|
this._vfs = vfs;
|
|
79035
79032
|
this._editorMode = editorMode;
|
|
@@ -79224,67 +79221,67 @@ const defaultValues = {
|
|
|
79224
79221
|
this.registerProps(k[1]);
|
|
79225
79222
|
}
|
|
79226
79223
|
}
|
|
79227
|
-
/**
|
|
79228
|
-
* The virtual file system used by this manager.
|
|
79229
|
-
*
|
|
79230
|
-
* @remarks
|
|
79231
|
-
* Used by asset fetchers and scene save/load operations.
|
|
79224
|
+
/**
|
|
79225
|
+
* The virtual file system used by this manager.
|
|
79226
|
+
*
|
|
79227
|
+
* @remarks
|
|
79228
|
+
* Used by asset fetchers and scene save/load operations.
|
|
79232
79229
|
*/ get VFS() {
|
|
79233
79230
|
return this._vfs;
|
|
79234
79231
|
}
|
|
79235
79232
|
set VFS(vfs) {
|
|
79236
79233
|
this._vfs = vfs;
|
|
79237
79234
|
}
|
|
79238
|
-
/**
|
|
79239
|
-
* Wethether editor mode is enabled
|
|
79240
|
-
*
|
|
79241
|
-
* @remarks
|
|
79242
|
-
* In editor mode, some properties will be disabled
|
|
79235
|
+
/**
|
|
79236
|
+
* Wethether editor mode is enabled
|
|
79237
|
+
*
|
|
79238
|
+
* @remarks
|
|
79239
|
+
* In editor mode, some properties will be disabled
|
|
79243
79240
|
*/ get editorMode() {
|
|
79244
79241
|
return this._editorMode;
|
|
79245
79242
|
}
|
|
79246
|
-
/**
|
|
79247
|
-
* AssetManager
|
|
79243
|
+
/**
|
|
79244
|
+
* AssetManager
|
|
79248
79245
|
*/ get assetManager() {
|
|
79249
79246
|
return this._assetManager;
|
|
79250
79247
|
}
|
|
79251
|
-
/**
|
|
79252
|
-
* Get the list of all registered serializable classes.
|
|
79253
|
-
*
|
|
79254
|
-
* @remarks
|
|
79255
|
-
* Includes built-in classes registered during construction and any custom classes
|
|
79256
|
-
* registered via `registerClass`.
|
|
79257
|
-
*
|
|
79258
|
-
* @returns An array of `SerializableClass` metadata.
|
|
79248
|
+
/**
|
|
79249
|
+
* Get the list of all registered serializable classes.
|
|
79250
|
+
*
|
|
79251
|
+
* @remarks
|
|
79252
|
+
* Includes built-in classes registered during construction and any custom classes
|
|
79253
|
+
* registered via `registerClass`.
|
|
79254
|
+
*
|
|
79255
|
+
* @returns An array of `SerializableClass` metadata.
|
|
79259
79256
|
*/ getClasses() {
|
|
79260
79257
|
return [
|
|
79261
79258
|
...this._classMap.values()
|
|
79262
79259
|
];
|
|
79263
79260
|
}
|
|
79264
|
-
/**
|
|
79265
|
-
* Get serialization metadata by a constructor function.
|
|
79266
|
-
*
|
|
79267
|
-
* @param ctor - The class constructor to look up.
|
|
79268
|
-
*
|
|
79269
|
-
* @returns The `SerializableClass` metadata, or `null` if not found.
|
|
79261
|
+
/**
|
|
79262
|
+
* Get serialization metadata by a constructor function.
|
|
79263
|
+
*
|
|
79264
|
+
* @param ctor - The class constructor to look up.
|
|
79265
|
+
*
|
|
79266
|
+
* @returns The `SerializableClass` metadata, or `null` if not found.
|
|
79270
79267
|
*/ getClassByConstructor(ctor) {
|
|
79271
79268
|
return this._classMap.get(ctor) ?? null;
|
|
79272
79269
|
}
|
|
79273
|
-
/**
|
|
79274
|
-
* Get serialization metadata by an object instance.
|
|
79275
|
-
*
|
|
79276
|
-
* @param obj - The object whose constructor will be used for the lookup.
|
|
79277
|
-
*
|
|
79278
|
-
* @returns The `SerializableClass` metadata, or `null` if not found.
|
|
79270
|
+
/**
|
|
79271
|
+
* Get serialization metadata by an object instance.
|
|
79272
|
+
*
|
|
79273
|
+
* @param obj - The object whose constructor will be used for the lookup.
|
|
79274
|
+
*
|
|
79275
|
+
* @returns The `SerializableClass` metadata, or `null` if not found.
|
|
79279
79276
|
*/ getClassByObject(obj) {
|
|
79280
79277
|
return this.getClassByConstructor(obj.constructor);
|
|
79281
79278
|
}
|
|
79282
|
-
/**
|
|
79283
|
-
* Get serialization metadata by class name.
|
|
79284
|
-
*
|
|
79285
|
-
* @param className - Fully qualified class name as stored in JSON.
|
|
79286
|
-
*
|
|
79287
|
-
* @returns The `SerializableClass` metadata, or `null` if not found.
|
|
79279
|
+
/**
|
|
79280
|
+
* Get serialization metadata by class name.
|
|
79281
|
+
*
|
|
79282
|
+
* @param className - Fully qualified class name as stored in JSON.
|
|
79283
|
+
*
|
|
79284
|
+
* @returns The `SerializableClass` metadata, or `null` if not found.
|
|
79288
79285
|
*/ getClassByName(className) {
|
|
79289
79286
|
for (const val of this._classMap){
|
|
79290
79287
|
if (val[0].name === className) {
|
|
@@ -79293,12 +79290,12 @@ const defaultValues = {
|
|
|
79293
79290
|
}
|
|
79294
79291
|
return null;
|
|
79295
79292
|
}
|
|
79296
|
-
/**
|
|
79297
|
-
* Find the class that owns a given property accessor.
|
|
79298
|
-
*
|
|
79299
|
-
* @param prop - Property accessor to search for.
|
|
79300
|
-
*
|
|
79301
|
-
* @returns The `SerializableClass` that declares the property, or `null` if unknown.
|
|
79293
|
+
/**
|
|
79294
|
+
* Find the class that owns a given property accessor.
|
|
79295
|
+
*
|
|
79296
|
+
* @param prop - Property accessor to search for.
|
|
79297
|
+
*
|
|
79298
|
+
* @returns The `SerializableClass` that declares the property, or `null` if unknown.
|
|
79302
79299
|
*/ getClassByProperty(prop) {
|
|
79303
79300
|
for (const k of this._clsPropMap){
|
|
79304
79301
|
if (k[1].indexOf(prop) >= 0) {
|
|
@@ -79307,17 +79304,17 @@ const defaultValues = {
|
|
|
79307
79304
|
}
|
|
79308
79305
|
return null;
|
|
79309
79306
|
}
|
|
79310
|
-
/**
|
|
79311
|
-
* Get the properties declared on a given class.
|
|
79312
|
-
*
|
|
79313
|
-
* @param cls - Serializable class metadata.
|
|
79314
|
-
*
|
|
79315
|
-
* @returns An array of `PropertyAccessor` entries, or `null` if none.
|
|
79307
|
+
/**
|
|
79308
|
+
* Get the properties declared on a given class.
|
|
79309
|
+
*
|
|
79310
|
+
* @param cls - Serializable class metadata.
|
|
79311
|
+
*
|
|
79312
|
+
* @returns An array of `PropertyAccessor` entries, or `null` if none.
|
|
79316
79313
|
*/ getPropertiesByClass(cls) {
|
|
79317
79314
|
return this._clsPropMap.get(cls) ?? null;
|
|
79318
79315
|
}
|
|
79319
|
-
/**
|
|
79320
|
-
* Get all properties declared on a class, including inherited serializable properties.
|
|
79316
|
+
/**
|
|
79317
|
+
* Get all properties declared on a class, including inherited serializable properties.
|
|
79321
79318
|
*/ getAllPropertiesByClass(cls) {
|
|
79322
79319
|
const props = [];
|
|
79323
79320
|
let current = cls;
|
|
@@ -79327,72 +79324,72 @@ const defaultValues = {
|
|
|
79327
79324
|
}
|
|
79328
79325
|
return props;
|
|
79329
79326
|
}
|
|
79330
|
-
/**
|
|
79331
|
-
* Get a property accessor by class and property name.
|
|
79332
|
-
*
|
|
79333
|
-
* @param cls - Serializable class metadata.
|
|
79334
|
-
* @param name - Property name to search for.
|
|
79335
|
-
*
|
|
79336
|
-
* @returns The `PropertyAccessor`, or `null` if not found.
|
|
79327
|
+
/**
|
|
79328
|
+
* Get a property accessor by class and property name.
|
|
79329
|
+
*
|
|
79330
|
+
* @param cls - Serializable class metadata.
|
|
79331
|
+
* @param name - Property name to search for.
|
|
79332
|
+
*
|
|
79333
|
+
* @returns The `PropertyAccessor`, or `null` if not found.
|
|
79337
79334
|
*/ getPropertyByClass(cls, name) {
|
|
79338
79335
|
return this.getPropertiesByClass(cls)?.find((value)=>value.name === name) ?? null;
|
|
79339
79336
|
}
|
|
79340
|
-
/**
|
|
79341
|
-
* Get a property accessor by its canonical path.
|
|
79342
|
-
*
|
|
79343
|
-
* @remarks
|
|
79344
|
-
* The canonical path format is `/ClassName/propName`.
|
|
79345
|
-
*
|
|
79346
|
-
* @param name - Canonical property path.
|
|
79347
|
-
*
|
|
79348
|
-
* @returns The `PropertyAccessor`, or `null` if not found.
|
|
79337
|
+
/**
|
|
79338
|
+
* Get a property accessor by its canonical path.
|
|
79339
|
+
*
|
|
79340
|
+
* @remarks
|
|
79341
|
+
* The canonical path format is `/ClassName/propName`.
|
|
79342
|
+
*
|
|
79343
|
+
* @param name - Canonical property path.
|
|
79344
|
+
*
|
|
79345
|
+
* @returns The `PropertyAccessor`, or `null` if not found.
|
|
79349
79346
|
*/ getPropertyByName(name) {
|
|
79350
79347
|
return this._propMap[name] ?? null;
|
|
79351
79348
|
}
|
|
79352
|
-
/**
|
|
79353
|
-
* Get the canonical path for a property accessor.
|
|
79354
|
-
*
|
|
79355
|
-
* @remarks
|
|
79356
|
-
* Returns a string like `/ClassName/propName` if the property is registered.
|
|
79357
|
-
*
|
|
79358
|
-
* @param prop - Property accessor.
|
|
79359
|
-
*
|
|
79360
|
-
* @returns The canonical path, or `null` if unknown.
|
|
79349
|
+
/**
|
|
79350
|
+
* Get the canonical path for a property accessor.
|
|
79351
|
+
*
|
|
79352
|
+
* @remarks
|
|
79353
|
+
* Returns a string like `/ClassName/propName` if the property is registered.
|
|
79354
|
+
*
|
|
79355
|
+
* @param prop - Property accessor.
|
|
79356
|
+
*
|
|
79357
|
+
* @returns The canonical path, or `null` if unknown.
|
|
79361
79358
|
*/ getPropertyName(prop) {
|
|
79362
79359
|
return this._propNameMap.get(prop) ?? null;
|
|
79363
79360
|
}
|
|
79364
|
-
/**
|
|
79365
|
-
* Register a serializable class and its properties.
|
|
79366
|
-
*
|
|
79367
|
-
* @remarks
|
|
79368
|
-
* - No effect if the class is already registered.
|
|
79369
|
-
* - Also registers the class's properties with canonical paths.
|
|
79370
|
-
*
|
|
79371
|
-
* @param cls - Serializable class metadata to register.
|
|
79361
|
+
/**
|
|
79362
|
+
* Register a serializable class and its properties.
|
|
79363
|
+
*
|
|
79364
|
+
* @remarks
|
|
79365
|
+
* - No effect if the class is already registered.
|
|
79366
|
+
* - Also registers the class's properties with canonical paths.
|
|
79367
|
+
*
|
|
79368
|
+
* @param cls - Serializable class metadata to register.
|
|
79372
79369
|
*/ registerClass(cls) {
|
|
79373
79370
|
if (!this._classMap.has(cls.ctor)) {
|
|
79374
79371
|
this._classMap.set(cls.ctor, cls);
|
|
79375
79372
|
this.registerProps(cls);
|
|
79376
79373
|
}
|
|
79377
79374
|
}
|
|
79378
|
-
/**
|
|
79379
|
-
* Get the known asset ID previously associated with a loaded/allocated asset.
|
|
79380
|
-
*
|
|
79381
|
-
* @remarks
|
|
79382
|
-
* Returns `null` if the asset was not loaded or tracked by this manager.
|
|
79383
|
-
*
|
|
79384
|
-
* @param asset - Asset instance (e.g., texture, model group) to look up.
|
|
79385
|
-
*
|
|
79386
|
-
* @returns The asset ID string, or `null` if unknown.
|
|
79375
|
+
/**
|
|
79376
|
+
* Get the known asset ID previously associated with a loaded/allocated asset.
|
|
79377
|
+
*
|
|
79378
|
+
* @remarks
|
|
79379
|
+
* Returns `null` if the asset was not loaded or tracked by this manager.
|
|
79380
|
+
*
|
|
79381
|
+
* @param asset - Asset instance (e.g., texture, model group) to look up.
|
|
79382
|
+
*
|
|
79383
|
+
* @returns The asset ID string, or `null` if unknown.
|
|
79387
79384
|
*/ getAssetId(asset) {
|
|
79388
79385
|
return this._allocated.get(asset) ?? null;
|
|
79389
79386
|
}
|
|
79390
|
-
/**
|
|
79391
|
-
* Associate an asset ID to a loaded/allocated asset.
|
|
79392
|
-
*
|
|
79393
|
-
* @param asset - Asset instance (e.g., texture, model group) to set Id.
|
|
79394
|
-
* @param id - Asset ID to associated to this asset.
|
|
79395
|
-
*
|
|
79387
|
+
/**
|
|
79388
|
+
* Associate an asset ID to a loaded/allocated asset.
|
|
79389
|
+
*
|
|
79390
|
+
* @param asset - Asset instance (e.g., texture, model group) to set Id.
|
|
79391
|
+
* @param id - Asset ID to associated to this asset.
|
|
79392
|
+
*
|
|
79396
79393
|
*/ setAssetId(asset, id) {
|
|
79397
79394
|
if (asset) {
|
|
79398
79395
|
if (id) {
|
|
@@ -79402,16 +79399,16 @@ const defaultValues = {
|
|
|
79402
79399
|
}
|
|
79403
79400
|
}
|
|
79404
79401
|
}
|
|
79405
|
-
/**
|
|
79406
|
-
* Fetch a binary asset by ID via the asset manager.
|
|
79407
|
-
*
|
|
79408
|
-
* @remarks
|
|
79409
|
-
* - Associates the returned data with the given ID for future reverse lookup.
|
|
79410
|
-
* - The ID is typically a VFS path or locator.
|
|
79411
|
-
*
|
|
79412
|
-
* @param id - Asset identifier or path.
|
|
79413
|
-
*
|
|
79414
|
-
* @returns A Promise that resolves to the binary content, or `null` if not found.
|
|
79402
|
+
/**
|
|
79403
|
+
* Fetch a binary asset by ID via the asset manager.
|
|
79404
|
+
*
|
|
79405
|
+
* @remarks
|
|
79406
|
+
* - Associates the returned data with the given ID for future reverse lookup.
|
|
79407
|
+
* - The ID is typically a VFS path or locator.
|
|
79408
|
+
*
|
|
79409
|
+
* @param id - Asset identifier or path.
|
|
79410
|
+
*
|
|
79411
|
+
* @returns A Promise that resolves to the binary content, or `null` if not found.
|
|
79415
79412
|
*/ async fetchBinary(id) {
|
|
79416
79413
|
const data = await this._assetManager.fetchBinaryData(id);
|
|
79417
79414
|
if (data) {
|
|
@@ -79419,18 +79416,18 @@ const defaultValues = {
|
|
|
79419
79416
|
}
|
|
79420
79417
|
return data;
|
|
79421
79418
|
}
|
|
79422
|
-
/**
|
|
79423
|
-
* Serialize an object to a JSON structure using registered class metadata.
|
|
79424
|
-
*
|
|
79425
|
-
* @remarks
|
|
79426
|
-
* - Throws if the object's class is not registered.
|
|
79427
|
-
* - Populates `asyncTasks` with pending I/O tasks for embedded resources.
|
|
79428
|
-
*
|
|
79429
|
-
* @param obj - The object to serialize.
|
|
79430
|
-
* @param json - Optional existing JSON object to fill.
|
|
79431
|
-
* @param asyncTasks - Optional list to collect async tasks for embedded asset export.
|
|
79432
|
-
*
|
|
79433
|
-
* @returns The serialized JSON structure.
|
|
79419
|
+
/**
|
|
79420
|
+
* Serialize an object to a JSON structure using registered class metadata.
|
|
79421
|
+
*
|
|
79422
|
+
* @remarks
|
|
79423
|
+
* - Throws if the object's class is not registered.
|
|
79424
|
+
* - Populates `asyncTasks` with pending I/O tasks for embedded resources.
|
|
79425
|
+
*
|
|
79426
|
+
* @param obj - The object to serialize.
|
|
79427
|
+
* @param json - Optional existing JSON object to fill.
|
|
79428
|
+
* @param asyncTasks - Optional list to collect async tasks for embedded asset export.
|
|
79429
|
+
*
|
|
79430
|
+
* @returns The serialized JSON structure.
|
|
79434
79431
|
*/ async serializeObject(obj, json, asyncTasks) {
|
|
79435
79432
|
if (obj === null || obj === undefined) {
|
|
79436
79433
|
return obj;
|
|
@@ -79456,14 +79453,14 @@ const defaultValues = {
|
|
|
79456
79453
|
}
|
|
79457
79454
|
return json;
|
|
79458
79455
|
}
|
|
79459
|
-
/**
|
|
79460
|
-
* Serialize object properties into a JSON structure.
|
|
79461
|
-
*
|
|
79462
|
-
* @param obj - The target object to serialize.
|
|
79463
|
-
* @param json - The JSON structure to populate.
|
|
79464
|
-
* @param asyncTasks - Optional list to collect async tasks for embedded asset export.
|
|
79465
|
-
* @param info - Optional serialization metadata for the object's class.
|
|
79466
|
-
* @returns A Promise that resolves when serialization is complete.
|
|
79456
|
+
/**
|
|
79457
|
+
* Serialize object properties into a JSON structure.
|
|
79458
|
+
*
|
|
79459
|
+
* @param obj - The target object to serialize.
|
|
79460
|
+
* @param json - The JSON structure to populate.
|
|
79461
|
+
* @param asyncTasks - Optional list to collect async tasks for embedded asset export.
|
|
79462
|
+
* @param info - Optional serialization metadata for the object's class.
|
|
79463
|
+
* @returns A Promise that resolves when serialization is complete.
|
|
79467
79464
|
*/ async serializeObjectProps(obj, json, asyncTasks, info) {
|
|
79468
79465
|
if (!info) {
|
|
79469
79466
|
const cls = this.getClasses();
|
|
@@ -79480,17 +79477,17 @@ const defaultValues = {
|
|
|
79480
79477
|
}
|
|
79481
79478
|
return json;
|
|
79482
79479
|
}
|
|
79483
|
-
/**
|
|
79484
|
-
* Deserialize a JSON structure into an object instance.
|
|
79485
|
-
*
|
|
79486
|
-
* @remarks
|
|
79487
|
-
* - Uses the `ClassName` field to locate the registered class.
|
|
79488
|
-
* - Supports custom `createFunc` and phased property loading.
|
|
79489
|
-
*
|
|
79490
|
-
* @param ctx - Context object passed to custom constructors/resolvers.
|
|
79491
|
-
* @param json - The serialized JSON structure.
|
|
79492
|
-
*
|
|
79493
|
-
* @returns A Promise resolving to the reconstructed object instance, or `null` on failure.
|
|
79480
|
+
/**
|
|
79481
|
+
* Deserialize a JSON structure into an object instance.
|
|
79482
|
+
*
|
|
79483
|
+
* @remarks
|
|
79484
|
+
* - Uses the `ClassName` field to locate the registered class.
|
|
79485
|
+
* - Supports custom `createFunc` and phased property loading.
|
|
79486
|
+
*
|
|
79487
|
+
* @param ctx - Context object passed to custom constructors/resolvers.
|
|
79488
|
+
* @param json - The serialized JSON structure.
|
|
79489
|
+
*
|
|
79490
|
+
* @returns A Promise resolving to the reconstructed object instance, or `null` on failure.
|
|
79494
79491
|
*/ async deserializeObject(ctx, json) {
|
|
79495
79492
|
const cls = this.getClasses();
|
|
79496
79493
|
const className = json['ClassName'];
|
|
@@ -79523,12 +79520,12 @@ const defaultValues = {
|
|
|
79523
79520
|
}
|
|
79524
79521
|
return obj;
|
|
79525
79522
|
}
|
|
79526
|
-
/**
|
|
79527
|
-
* Deserialize object properties from JSON into an existing object instance.
|
|
79528
|
-
*
|
|
79529
|
-
* @param obj - The target object to populate.
|
|
79530
|
-
* @param json - The JSON structure containing serialized properties.
|
|
79531
|
-
* @param info - Optional serialization metadata for the object's class.
|
|
79523
|
+
/**
|
|
79524
|
+
* Deserialize object properties from JSON into an existing object instance.
|
|
79525
|
+
*
|
|
79526
|
+
* @param obj - The target object to populate.
|
|
79527
|
+
* @param json - The JSON structure containing serialized properties.
|
|
79528
|
+
* @param info - Optional serialization metadata for the object's class.
|
|
79532
79529
|
*/ async deserializeObjectProps(obj, json, info) {
|
|
79533
79530
|
if (!info) {
|
|
79534
79531
|
const cls = this.getClasses();
|
|
@@ -79543,14 +79540,14 @@ const defaultValues = {
|
|
|
79543
79540
|
info = this.getClassByConstructor(info.parent);
|
|
79544
79541
|
}
|
|
79545
79542
|
}
|
|
79546
|
-
/**
|
|
79547
|
-
* Load a model by ID and track the allocation for reverse lookup.
|
|
79548
|
-
*
|
|
79549
|
-
* @param id - Model identifier or path.
|
|
79550
|
-
* @param scene - Scene into which the model is loaded.
|
|
79551
|
-
* @param options - Optional model fetch options.
|
|
79552
|
-
*
|
|
79553
|
-
* @returns A Promise resolving to the loaded model object, or `null` if failed.
|
|
79543
|
+
/**
|
|
79544
|
+
* Load a model by ID and track the allocation for reverse lookup.
|
|
79545
|
+
*
|
|
79546
|
+
* @param id - Model identifier or path.
|
|
79547
|
+
* @param scene - Scene into which the model is loaded.
|
|
79548
|
+
* @param options - Optional model fetch options.
|
|
79549
|
+
*
|
|
79550
|
+
* @returns A Promise resolving to the loaded model object, or `null` if failed.
|
|
79554
79551
|
*/ async fetchModel(path, scene, options) {
|
|
79555
79552
|
const id = this.VFS.normalizePath(path);
|
|
79556
79553
|
const model = await this._assetManager.fetchModel(scene, id, options);
|
|
@@ -79560,29 +79557,29 @@ const defaultValues = {
|
|
|
79560
79557
|
}
|
|
79561
79558
|
return model;
|
|
79562
79559
|
}
|
|
79563
|
-
/**
|
|
79564
|
-
* Load a texture directly from an ArrayBuffer or typed array.
|
|
79565
|
-
*
|
|
79566
|
-
* - Chooses an appropriate loader based on the provided MIME type.
|
|
79567
|
-
* - Can upload into an existing texture if `texture` is specified.
|
|
79568
|
-
*
|
|
79569
|
-
* @typeParam T - Expected concrete texture type.
|
|
79570
|
-
* @param arrayBuffer - Raw texture data buffer.
|
|
79571
|
-
* @param mimeType - MIME type of the texture (must be supported by a registered loader).
|
|
79572
|
-
* @param srgb - If true, treat image as sRGB; otherwise linear.
|
|
79573
|
-
* @param samplerOptions - Optional sampler options passed to the loader path.
|
|
79574
|
-
* @param texture - Optional destination texture to populate.
|
|
79575
|
-
* @returns A promise that resolves to the created or populated texture.
|
|
79560
|
+
/**
|
|
79561
|
+
* Load a texture directly from an ArrayBuffer or typed array.
|
|
79562
|
+
*
|
|
79563
|
+
* - Chooses an appropriate loader based on the provided MIME type.
|
|
79564
|
+
* - Can upload into an existing texture if `texture` is specified.
|
|
79565
|
+
*
|
|
79566
|
+
* @typeParam T - Expected concrete texture type.
|
|
79567
|
+
* @param arrayBuffer - Raw texture data buffer.
|
|
79568
|
+
* @param mimeType - MIME type of the texture (must be supported by a registered loader).
|
|
79569
|
+
* @param srgb - If true, treat image as sRGB; otherwise linear.
|
|
79570
|
+
* @param samplerOptions - Optional sampler options passed to the loader path.
|
|
79571
|
+
* @param texture - Optional destination texture to populate.
|
|
79572
|
+
* @returns A promise that resolves to the created or populated texture.
|
|
79576
79573
|
*/ async loadTextureFromBuffer(arrayBuffer, mimeType, srgb, samplerOptions, texture) {
|
|
79577
79574
|
return this._assetManager.loadTextureFromBuffer(arrayBuffer, mimeType, srgb, samplerOptions, texture);
|
|
79578
79575
|
}
|
|
79579
|
-
/**
|
|
79580
|
-
* Load a texture by ID and track the allocation for reverse lookup.
|
|
79581
|
-
*
|
|
79582
|
-
* @param id - Texture identifier or path.
|
|
79583
|
-
* @param options - Optional texture fetch options.
|
|
79584
|
-
*
|
|
79585
|
-
* @returns A Promise resolving to the loaded texture, or `null` if failed.
|
|
79576
|
+
/**
|
|
79577
|
+
* Load a texture by ID and track the allocation for reverse lookup.
|
|
79578
|
+
*
|
|
79579
|
+
* @param id - Texture identifier or path.
|
|
79580
|
+
* @param options - Optional texture fetch options.
|
|
79581
|
+
*
|
|
79582
|
+
* @returns A Promise resolving to the loaded texture, or `null` if failed.
|
|
79586
79583
|
*/ async fetchTexture(id, options) {
|
|
79587
79584
|
const texture = await this._assetManager.fetchTexture(id, options);
|
|
79588
79585
|
if (texture) {
|
|
@@ -79590,12 +79587,12 @@ const defaultValues = {
|
|
|
79590
79587
|
}
|
|
79591
79588
|
return texture;
|
|
79592
79589
|
}
|
|
79593
|
-
/**
|
|
79594
|
-
* Load a material by ID and track the allocation for reverse lookup.
|
|
79595
|
-
*
|
|
79596
|
-
* @param id - Material identifier or path.
|
|
79597
|
-
*
|
|
79598
|
-
* @returns A Promise resolving to the loaded material, or `null` if failed.
|
|
79590
|
+
/**
|
|
79591
|
+
* Load a material by ID and track the allocation for reverse lookup.
|
|
79592
|
+
*
|
|
79593
|
+
* @param id - Material identifier or path.
|
|
79594
|
+
*
|
|
79595
|
+
* @returns A Promise resolving to the loaded material, or `null` if failed.
|
|
79599
79596
|
*/ async fetchMaterial(id, options) {
|
|
79600
79597
|
const material = await this._assetManager.fetchMaterial(id, options);
|
|
79601
79598
|
if (material) {
|
|
@@ -79603,31 +79600,31 @@ const defaultValues = {
|
|
|
79603
79600
|
}
|
|
79604
79601
|
return material;
|
|
79605
79602
|
}
|
|
79606
|
-
/**
|
|
79607
|
-
* Reload specific blue print materials
|
|
79608
|
-
*
|
|
79609
|
-
* @param filter - Determine whether a blue print material should reload.
|
|
79610
|
-
*
|
|
79603
|
+
/**
|
|
79604
|
+
* Reload specific blue print materials
|
|
79605
|
+
*
|
|
79606
|
+
* @param filter - Determine whether a blue print material should reload.
|
|
79607
|
+
*
|
|
79611
79608
|
*/ async reloadBluePrintMaterials(filter) {
|
|
79612
79609
|
await this._assetManager.reloadBluePrintMaterials(filter);
|
|
79613
79610
|
}
|
|
79614
|
-
/**
|
|
79615
|
-
* Mark specific blue print as changed
|
|
79616
|
-
* @param path - BluePrint file path
|
|
79611
|
+
/**
|
|
79612
|
+
* Mark specific blue print as changed
|
|
79613
|
+
* @param path - BluePrint file path
|
|
79617
79614
|
*/ invalidateBluePrint(path) {
|
|
79618
79615
|
this._assetManager.invalidateBluePrint(path);
|
|
79619
79616
|
}
|
|
79620
|
-
/**
|
|
79621
|
-
* Register a model loader by MIME type.
|
|
79617
|
+
/**
|
|
79618
|
+
* Register a model loader by MIME type.
|
|
79622
79619
|
*/ setModelLoader(mimeType, loader) {
|
|
79623
79620
|
this._assetManager.setModelLoader(mimeType, loader);
|
|
79624
79621
|
}
|
|
79625
|
-
/**
|
|
79626
|
-
* Load a primitive by ID and track the allocation for reverse lookup.
|
|
79627
|
-
*
|
|
79628
|
-
* @param id - Primitive identifier or path.
|
|
79629
|
-
*
|
|
79630
|
-
* @returns A Promise resolving to the loaded primitive, or `null` if failed.
|
|
79622
|
+
/**
|
|
79623
|
+
* Load a primitive by ID and track the allocation for reverse lookup.
|
|
79624
|
+
*
|
|
79625
|
+
* @param id - Primitive identifier or path.
|
|
79626
|
+
*
|
|
79627
|
+
* @returns A Promise resolving to the loaded primitive, or `null` if failed.
|
|
79631
79628
|
*/ async fetchPrimitive(id, options) {
|
|
79632
79629
|
const primitive = await this._assetManager.fetchPrimitive(id, options);
|
|
79633
79630
|
if (primitive) {
|
|
@@ -79635,8 +79632,8 @@ const defaultValues = {
|
|
|
79635
79632
|
}
|
|
79636
79633
|
return primitive;
|
|
79637
79634
|
}
|
|
79638
|
-
/**
|
|
79639
|
-
* Load a font asset by path and track the allocation for reverse lookup.
|
|
79635
|
+
/**
|
|
79636
|
+
* Load a font asset by path and track the allocation for reverse lookup.
|
|
79640
79637
|
*/ async fetchFontAsset(path, options) {
|
|
79641
79638
|
const id = this.VFS.normalizePath(path);
|
|
79642
79639
|
const fontAsset = await this._assetManager.fetchFontAsset(id, options);
|
|
@@ -79645,21 +79642,21 @@ const defaultValues = {
|
|
|
79645
79642
|
}
|
|
79646
79643
|
return fontAsset;
|
|
79647
79644
|
}
|
|
79648
|
-
/**
|
|
79649
|
-
* Returns the cached font asset if it is already loaded.
|
|
79645
|
+
/**
|
|
79646
|
+
* Returns the cached font asset if it is already loaded.
|
|
79650
79647
|
*/ getFontAsset(path) {
|
|
79651
79648
|
return this._assetManager.getFontAsset(this.VFS.normalizePath(path));
|
|
79652
79649
|
}
|
|
79653
|
-
/**
|
|
79654
|
-
* Releases a cached font asset.
|
|
79650
|
+
/**
|
|
79651
|
+
* Releases a cached font asset.
|
|
79655
79652
|
*/ releaseFontAsset(asset) {
|
|
79656
79653
|
const path = typeof asset === 'string' ? asset : this.getAssetId(asset);
|
|
79657
79654
|
return path ? this._assetManager.releaseFontAsset(this.VFS.normalizePath(path)) : false;
|
|
79658
79655
|
}
|
|
79659
|
-
/**
|
|
79660
|
-
* Load a prefab content.
|
|
79661
|
-
* @param path - Path to the prefab JSON file in VFS.
|
|
79662
|
-
* @returns A Promise resolving to the prefab json object, or `null` on failure.
|
|
79656
|
+
/**
|
|
79657
|
+
* Load a prefab content.
|
|
79658
|
+
* @param path - Path to the prefab JSON file in VFS.
|
|
79659
|
+
* @returns A Promise resolving to the prefab json object, or `null` on failure.
|
|
79663
79660
|
*/ async loadPrefabContent(path) {
|
|
79664
79661
|
try {
|
|
79665
79662
|
const content = await this._vfs.readFile(path, {
|
|
@@ -79672,11 +79669,11 @@ const defaultValues = {
|
|
|
79672
79669
|
return null;
|
|
79673
79670
|
}
|
|
79674
79671
|
}
|
|
79675
|
-
/**
|
|
79676
|
-
* Instantiate a prefab from a JSON file via VFS.
|
|
79677
|
-
* @param parent - Parent node to attach the instantiated prefab to.
|
|
79678
|
-
* @param path - Path to the prefab JSON file in VFS.
|
|
79679
|
-
* @returns A Promise resolving to the instantiated `SceneNode`, or `null` on failure.
|
|
79672
|
+
/**
|
|
79673
|
+
* Instantiate a prefab from a JSON file via VFS.
|
|
79674
|
+
* @param parent - Parent node to attach the instantiated prefab to.
|
|
79675
|
+
* @param path - Path to the prefab JSON file in VFS.
|
|
79676
|
+
* @returns A Promise resolving to the instantiated `SceneNode`, or `null` on failure.
|
|
79680
79677
|
*/ async instantiatePrefab(parent, path) {
|
|
79681
79678
|
try {
|
|
79682
79679
|
const json = await this.loadPrefabContent(path);
|
|
@@ -79695,16 +79692,16 @@ const defaultValues = {
|
|
|
79695
79692
|
return null;
|
|
79696
79693
|
}
|
|
79697
79694
|
}
|
|
79698
|
-
/**
|
|
79699
|
-
* Load a scene from a JSON file via VFS.
|
|
79700
|
-
*
|
|
79701
|
-
* @remarks
|
|
79702
|
-
* - Deserializes the scene graph.
|
|
79703
|
-
* - Attaches scripts referenced by nodes after load (asynchronous).
|
|
79704
|
-
*
|
|
79705
|
-
* @param filename - Path to the scene JSON file in VFS.
|
|
79706
|
-
*
|
|
79707
|
-
* @returns A Promise resolving to the loaded `Scene`.
|
|
79695
|
+
/**
|
|
79696
|
+
* Load a scene from a JSON file via VFS.
|
|
79697
|
+
*
|
|
79698
|
+
* @remarks
|
|
79699
|
+
* - Deserializes the scene graph.
|
|
79700
|
+
* - Attaches scripts referenced by nodes after load (asynchronous).
|
|
79701
|
+
*
|
|
79702
|
+
* @param filename - Path to the scene JSON file in VFS.
|
|
79703
|
+
*
|
|
79704
|
+
* @returns A Promise resolving to the loaded `Scene`.
|
|
79708
79705
|
*/ async loadScene(filename) {
|
|
79709
79706
|
const content = await this._vfs.readFile(filename, {
|
|
79710
79707
|
encoding: 'utf8'
|
|
@@ -79712,15 +79709,15 @@ const defaultValues = {
|
|
|
79712
79709
|
const json = JSON.parse(content);
|
|
79713
79710
|
return await this.deserializeObject(null, json);
|
|
79714
79711
|
}
|
|
79715
|
-
/**
|
|
79716
|
-
* Save a scene to a JSON file via VFS.
|
|
79717
|
-
*
|
|
79718
|
-
* @remarks
|
|
79719
|
-
* - Collects async export tasks for embedded resources and awaits them.
|
|
79720
|
-
* - Writes a UTF-8 JSON representation to VFS.
|
|
79721
|
-
*
|
|
79722
|
-
* @param scene - Scene to serialize and save.
|
|
79723
|
-
* @param filename - Destination path in VFS.
|
|
79712
|
+
/**
|
|
79713
|
+
* Save a scene to a JSON file via VFS.
|
|
79714
|
+
*
|
|
79715
|
+
* @remarks
|
|
79716
|
+
* - Collects async export tasks for embedded resources and awaits them.
|
|
79717
|
+
* - Writes a UTF-8 JSON representation to VFS.
|
|
79718
|
+
*
|
|
79719
|
+
* @param scene - Scene to serialize and save.
|
|
79720
|
+
* @param filename - Destination path in VFS.
|
|
79724
79721
|
*/ async saveScene(scene, filename) {
|
|
79725
79722
|
const asyncTasks = [];
|
|
79726
79723
|
const content = await this.serializeObject(scene, null, asyncTasks);
|
|
@@ -79852,11 +79849,11 @@ const defaultValues = {
|
|
|
79852
79849
|
async loadBluePrint(path) {
|
|
79853
79850
|
return this._assetManager.loadBluePrint(path);
|
|
79854
79851
|
}
|
|
79855
|
-
/**
|
|
79856
|
-
* Clear cached allocations and asset-manager caches.
|
|
79857
|
-
*
|
|
79858
|
-
* @remarks
|
|
79859
|
-
* Useful when reloading content or changing VFS mounts.
|
|
79852
|
+
/**
|
|
79853
|
+
* Clear cached allocations and asset-manager caches.
|
|
79854
|
+
*
|
|
79855
|
+
* @remarks
|
|
79856
|
+
* Useful when reloading content or changing VFS mounts.
|
|
79860
79857
|
*/ clearCache() {
|
|
79861
79858
|
this._allocated = new WeakMap();
|
|
79862
79859
|
this._assetManager.clearCache();
|
|
@@ -79875,18 +79872,18 @@ const defaultValues = {
|
|
|
79875
79872
|
}
|
|
79876
79873
|
return null;
|
|
79877
79874
|
}
|
|
79878
|
-
/**
|
|
79879
|
-
* Find the object targeted by an animation track starting from a node.
|
|
79880
|
-
*
|
|
79881
|
-
* @remarks
|
|
79882
|
-
* - Parses a target path like `prop/subprop[0]/child` where indexed entries
|
|
79883
|
-
* require `object_array` type and non-indexed entries require `object` type.
|
|
79884
|
-
* - Returns `null` if any segment cannot be resolved through registered metadata.
|
|
79885
|
-
*
|
|
79886
|
-
* @param node - Root node used as the starting point.
|
|
79887
|
-
* @param track - Property track containing a target path.
|
|
79888
|
-
*
|
|
79889
|
-
* @returns The resolved target object, or `null` if not found.
|
|
79875
|
+
/**
|
|
79876
|
+
* Find the object targeted by an animation track starting from a node.
|
|
79877
|
+
*
|
|
79878
|
+
* @remarks
|
|
79879
|
+
* - Parses a target path like `prop/subprop[0]/child` where indexed entries
|
|
79880
|
+
* require `object_array` type and non-indexed entries require `object` type.
|
|
79881
|
+
* - Returns `null` if any segment cannot be resolved through registered metadata.
|
|
79882
|
+
*
|
|
79883
|
+
* @param node - Root node used as the starting point.
|
|
79884
|
+
* @param track - Property track containing a target path.
|
|
79885
|
+
*
|
|
79886
|
+
* @returns The resolved target object, or `null` if not found.
|
|
79890
79887
|
*/ findAnimationTarget(node, track) {
|
|
79891
79888
|
const target = track.target ?? '';
|
|
79892
79889
|
const value = {
|
|
@@ -88376,21 +88373,21 @@ class GPUClothWrapBinding {
|
|
|
88376
88373
|
}
|
|
88377
88374
|
}
|
|
88378
88375
|
|
|
88379
|
-
/**
|
|
88380
|
-
* Named object interface for model loading
|
|
88381
|
-
* @public
|
|
88376
|
+
/**
|
|
88377
|
+
* Named object interface for model loading
|
|
88378
|
+
* @public
|
|
88382
88379
|
*/ class NamedObject {
|
|
88383
88380
|
name;
|
|
88384
|
-
/**
|
|
88385
|
-
* Creates an instance of NamedObject
|
|
88386
|
-
* @param name - Name of the object
|
|
88381
|
+
/**
|
|
88382
|
+
* Creates an instance of NamedObject
|
|
88383
|
+
* @param name - Name of the object
|
|
88387
88384
|
*/ constructor(name){
|
|
88388
88385
|
this.name = name;
|
|
88389
88386
|
}
|
|
88390
88387
|
}
|
|
88391
|
-
/**
|
|
88392
|
-
* Heirarchical node interface for model loading
|
|
88393
|
-
* @public
|
|
88388
|
+
/**
|
|
88389
|
+
* Heirarchical node interface for model loading
|
|
88390
|
+
* @public
|
|
88394
88391
|
*/ class AssetHierarchyNode extends NamedObject {
|
|
88395
88392
|
_parent;
|
|
88396
88393
|
_position;
|
|
@@ -88404,10 +88401,10 @@ class GPUClothWrapBinding {
|
|
|
88404
88401
|
_weights;
|
|
88405
88402
|
_children;
|
|
88406
88403
|
_instances;
|
|
88407
|
-
/**
|
|
88408
|
-
* Creates an instance of AssetHierarchyNode
|
|
88409
|
-
* @param name - Name of the node
|
|
88410
|
-
* @param parent - Parent of the node
|
|
88404
|
+
/**
|
|
88405
|
+
* Creates an instance of AssetHierarchyNode
|
|
88406
|
+
* @param name - Name of the node
|
|
88407
|
+
* @param parent - Parent of the node
|
|
88411
88408
|
*/ constructor(name, model, parent){
|
|
88412
88409
|
super(name);
|
|
88413
88410
|
model.nodes.push(this);
|
|
@@ -88495,9 +88492,9 @@ class GPUClothWrapBinding {
|
|
|
88495
88492
|
child.computeTransforms(this._worldMatrix);
|
|
88496
88493
|
}
|
|
88497
88494
|
}
|
|
88498
|
-
/**
|
|
88499
|
-
* Adds a child to this node
|
|
88500
|
-
* @param child - The child node to be added
|
|
88495
|
+
/**
|
|
88496
|
+
* Adds a child to this node
|
|
88497
|
+
* @param child - The child node to be added
|
|
88501
88498
|
*/ addChild(child) {
|
|
88502
88499
|
if (!child || child.parent) {
|
|
88503
88500
|
throw new Error('AssetHierarchyNode.addChild(): invalid child node');
|
|
@@ -88505,9 +88502,9 @@ class GPUClothWrapBinding {
|
|
|
88505
88502
|
this._children.push(child);
|
|
88506
88503
|
child._parent = this;
|
|
88507
88504
|
}
|
|
88508
|
-
/**
|
|
88509
|
-
* Removes a child of this node
|
|
88510
|
-
* @param child - The child node to be removed
|
|
88505
|
+
/**
|
|
88506
|
+
* Removes a child of this node
|
|
88507
|
+
* @param child - The child node to be removed
|
|
88511
88508
|
*/ removeChild(child) {
|
|
88512
88509
|
const index = this._children.indexOf(child);
|
|
88513
88510
|
if (index < 0) {
|
|
@@ -88516,10 +88513,10 @@ class GPUClothWrapBinding {
|
|
|
88516
88513
|
this._children[index]._parent = null;
|
|
88517
88514
|
this._children.splice(index, 1);
|
|
88518
88515
|
}
|
|
88519
|
-
/**
|
|
88520
|
-
* Attach this node to a skeleton
|
|
88521
|
-
* @param skeleton - The skeleton to which to node will attach
|
|
88522
|
-
* @param index - The joint index
|
|
88516
|
+
/**
|
|
88517
|
+
* Attach this node to a skeleton
|
|
88518
|
+
* @param skeleton - The skeleton to which to node will attach
|
|
88519
|
+
* @param index - The joint index
|
|
88523
88520
|
*/ attachToSkeleton(skeleton) {
|
|
88524
88521
|
if (!this._attachToSkeleton) {
|
|
88525
88522
|
this._attachToSkeleton = new Set();
|
|
@@ -88527,18 +88524,18 @@ class GPUClothWrapBinding {
|
|
|
88527
88524
|
this._attachToSkeleton.add(skeleton);
|
|
88528
88525
|
}
|
|
88529
88526
|
}
|
|
88530
|
-
/**
|
|
88531
|
-
* Skeleton information for model loading
|
|
88532
|
-
* @public
|
|
88527
|
+
/**
|
|
88528
|
+
* Skeleton information for model loading
|
|
88529
|
+
* @public
|
|
88533
88530
|
*/ class AssetSkeleton extends NamedObject {
|
|
88534
88531
|
/** The pivot node */ pivot;
|
|
88535
88532
|
/** Joints of the skeleton */ joints;
|
|
88536
88533
|
/** Inverse of the binding matrices of the joints */ inverseBindMatrices;
|
|
88537
88534
|
/** Binding pose matrices of the joints */ bindPose;
|
|
88538
88535
|
/** Explicit humanoid joint mapping, when supplied by the source asset. */ humanoidJointMapping;
|
|
88539
|
-
/**
|
|
88540
|
-
* Creates an instance of AssetSkeleton
|
|
88541
|
-
* @param name - Name of the skeleton
|
|
88536
|
+
/**
|
|
88537
|
+
* Creates an instance of AssetSkeleton
|
|
88538
|
+
* @param name - Name of the skeleton
|
|
88542
88539
|
*/ constructor(name){
|
|
88543
88540
|
super(name);
|
|
88544
88541
|
this.name = name;
|
|
@@ -88548,10 +88545,10 @@ class GPUClothWrapBinding {
|
|
|
88548
88545
|
this.bindPose = [];
|
|
88549
88546
|
this.humanoidJointMapping = null;
|
|
88550
88547
|
}
|
|
88551
|
-
/**
|
|
88552
|
-
* Adds a joint to the skeleton
|
|
88553
|
-
* @param joint - The joint node
|
|
88554
|
-
* @param inverseBindMatrix - Inverse binding matrix of the joint
|
|
88548
|
+
/**
|
|
88549
|
+
* Adds a joint to the skeleton
|
|
88550
|
+
* @param joint - The joint node
|
|
88551
|
+
* @param inverseBindMatrix - Inverse binding matrix of the joint
|
|
88555
88552
|
*/ addJoint(joint, inverseBindMatrix) {
|
|
88556
88553
|
joint.attachToSkeleton(this);
|
|
88557
88554
|
this.joints.push(joint);
|
|
@@ -88575,22 +88572,22 @@ class GPUClothWrapBinding {
|
|
|
88575
88572
|
return root;
|
|
88576
88573
|
}
|
|
88577
88574
|
}
|
|
88578
|
-
/**
|
|
88579
|
-
* Scene for model loading
|
|
88580
|
-
* @public
|
|
88575
|
+
/**
|
|
88576
|
+
* Scene for model loading
|
|
88577
|
+
* @public
|
|
88581
88578
|
*/ class AssetScene extends NamedObject {
|
|
88582
88579
|
/** Root nodes of the scene */ rootNodes;
|
|
88583
|
-
/**
|
|
88584
|
-
* Creates an instance of AssetScene
|
|
88585
|
-
* @param name - Name of the scene
|
|
88580
|
+
/**
|
|
88581
|
+
* Creates an instance of AssetScene
|
|
88582
|
+
* @param name - Name of the scene
|
|
88586
88583
|
*/ constructor(name){
|
|
88587
88584
|
super(name);
|
|
88588
88585
|
this.rootNodes = [];
|
|
88589
88586
|
}
|
|
88590
88587
|
}
|
|
88591
|
-
/**
|
|
88592
|
-
* Model information that can be shared by multiple model nodes
|
|
88593
|
-
* @public
|
|
88588
|
+
/**
|
|
88589
|
+
* Model information that can be shared by multiple model nodes
|
|
88590
|
+
* @public
|
|
88594
88591
|
*/ class SharedModel extends Disposable {
|
|
88595
88592
|
/** @internal */ _nodes;
|
|
88596
88593
|
/** @internal */ _skeletons;
|
|
@@ -88608,8 +88605,8 @@ class GPUClothWrapBinding {
|
|
|
88608
88605
|
/** @internal */ _morphTargetGroups;
|
|
88609
88606
|
/** @internal */ _textureMap;
|
|
88610
88607
|
/** @internal */ _primitiveMap;
|
|
88611
|
-
/**
|
|
88612
|
-
* Creates an instance of SharedModel
|
|
88608
|
+
/**
|
|
88609
|
+
* Creates an instance of SharedModel
|
|
88613
88610
|
*/ constructor(){
|
|
88614
88611
|
super();
|
|
88615
88612
|
this._nodes = [];
|
|
@@ -88879,29 +88876,29 @@ class GPUClothWrapBinding {
|
|
|
88879
88876
|
getPrimitiveBaseName(info, index, fallback) {
|
|
88880
88877
|
return info?.name?.trim() || `${fallback}_mesh_${index}`;
|
|
88881
88878
|
}
|
|
88882
|
-
/**
|
|
88883
|
-
* Adds a model-level morph target group.
|
|
88884
|
-
* @param group - Morph target group to add
|
|
88879
|
+
/**
|
|
88880
|
+
* Adds a model-level morph target group.
|
|
88881
|
+
* @param group - Morph target group to add
|
|
88885
88882
|
*/ addMorphTargetGroup(group) {
|
|
88886
88883
|
if (group?.name && group.bindings?.length > 0) {
|
|
88887
88884
|
this._morphTargetGroups.push(group);
|
|
88888
88885
|
}
|
|
88889
88886
|
}
|
|
88890
|
-
/**
|
|
88891
|
-
* Removes all model-level morph target groups.
|
|
88887
|
+
/**
|
|
88888
|
+
* Removes all model-level morph target groups.
|
|
88892
88889
|
*/ clearMorphTargetGroups() {
|
|
88893
88890
|
this._morphTargetGroups = [];
|
|
88894
88891
|
}
|
|
88895
|
-
/**
|
|
88896
|
-
* Finds a model-level morph target group by name.
|
|
88897
|
-
* @param name - Group name
|
|
88898
|
-
* @returns The matching group, or null if not found
|
|
88892
|
+
/**
|
|
88893
|
+
* Finds a model-level morph target group by name.
|
|
88894
|
+
* @param name - Group name
|
|
88895
|
+
* @returns The matching group, or null if not found
|
|
88899
88896
|
*/ getMorphTargetGroup(name) {
|
|
88900
88897
|
return this._morphTargetGroups.find((group)=>group.name === name) ?? null;
|
|
88901
88898
|
}
|
|
88902
|
-
/**
|
|
88903
|
-
* Builds morph target groups by collecting morph target names from every mesh.
|
|
88904
|
-
* @returns Generated morph target groups
|
|
88899
|
+
/**
|
|
88900
|
+
* Builds morph target groups by collecting morph target names from every mesh.
|
|
88901
|
+
* @returns Generated morph target groups
|
|
88905
88902
|
*/ buildMorphTargetGroupsByName() {
|
|
88906
88903
|
this.clearMorphTargetGroups();
|
|
88907
88904
|
const groups = new Map();
|
|
@@ -88934,15 +88931,15 @@ class GPUClothWrapBinding {
|
|
|
88934
88931
|
this._morphTargetGroups = Array.from(groups.values());
|
|
88935
88932
|
return this._morphTargetGroups;
|
|
88936
88933
|
}
|
|
88937
|
-
/**
|
|
88938
|
-
* Adds a skeleton to the scene
|
|
88939
|
-
* @param skeleton - The skeleton to be added
|
|
88934
|
+
/**
|
|
88935
|
+
* Adds a skeleton to the scene
|
|
88936
|
+
* @param skeleton - The skeleton to be added
|
|
88940
88937
|
*/ addSkeleton(skeleton) {
|
|
88941
88938
|
this._skeletons.push(skeleton);
|
|
88942
88939
|
}
|
|
88943
|
-
/**
|
|
88944
|
-
* Adds an animation to the scene
|
|
88945
|
-
* @param animation - The animation to be added
|
|
88940
|
+
/**
|
|
88941
|
+
* Adds an animation to the scene
|
|
88942
|
+
* @param animation - The animation to be added
|
|
88946
88943
|
*/ addAnimation(animation) {
|
|
88947
88944
|
this._animations.push(animation);
|
|
88948
88945
|
}
|
|
@@ -90179,12 +90176,12 @@ class GPUClothWrapBinding {
|
|
|
90179
90176
|
}
|
|
90180
90177
|
|
|
90181
90178
|
let outfitInstanceId = 0;
|
|
90182
|
-
/**
|
|
90183
|
-
* A concrete equipped outfit item.
|
|
90184
|
-
*
|
|
90185
|
-
* Disposing the instance unequips it from the owning wardrobe.
|
|
90186
|
-
*
|
|
90187
|
-
* @public
|
|
90179
|
+
/**
|
|
90180
|
+
* A concrete equipped outfit item.
|
|
90181
|
+
*
|
|
90182
|
+
* Disposing the instance unequips it from the owning wardrobe.
|
|
90183
|
+
*
|
|
90184
|
+
* @public
|
|
90188
90185
|
*/ class AvatarOutfitInstance extends Disposable {
|
|
90189
90186
|
id;
|
|
90190
90187
|
slot;
|
|
@@ -90212,13 +90209,13 @@ let outfitInstanceId = 0;
|
|
|
90212
90209
|
this.meshes.length = 0;
|
|
90213
90210
|
}
|
|
90214
90211
|
}
|
|
90215
|
-
/**
|
|
90216
|
-
* High level avatar outfit controller.
|
|
90217
|
-
*
|
|
90218
|
-
* The wardrobe keeps one avatar {@link SkeletonRig} as the animation source and
|
|
90219
|
-
* binds equipped clothing meshes to that rig with new {@link SkinBinding}s.
|
|
90220
|
-
*
|
|
90221
|
-
* @public
|
|
90212
|
+
/**
|
|
90213
|
+
* High level avatar outfit controller.
|
|
90214
|
+
*
|
|
90215
|
+
* The wardrobe keeps one avatar {@link SkeletonRig} as the animation source and
|
|
90216
|
+
* binds equipped clothing meshes to that rig with new {@link SkinBinding}s.
|
|
90217
|
+
*
|
|
90218
|
+
* @public
|
|
90222
90219
|
*/ class AvatarWardrobe extends Disposable {
|
|
90223
90220
|
_root;
|
|
90224
90221
|
_rig;
|
|
@@ -91177,32 +91174,32 @@ let outfitInstanceId = 0;
|
|
|
91177
91174
|
/* es-module-lexer 1.7.0 */
|
|
91178
91175
|
var ImportType;!function(A){A[A.Static=1]="Static",A[A.Dynamic=2]="Dynamic",A[A.ImportMeta=3]="ImportMeta",A[A.StaticSourcePhase=4]="StaticSourcePhase",A[A.DynamicSourcePhase=5]="DynamicSourcePhase",A[A.StaticDeferPhase=6]="StaticDeferPhase",A[A.DynamicDeferPhase=7]="DynamicDeferPhase";}(ImportType||(ImportType={}));const A=1===new Uint8Array(new Uint16Array([1]).buffer)[0];function parse(E,g="@"){if(!C)return init.then((()=>parse(E)));const I=E.length+1,w=(C.__heap_base.value||C.__heap_base)+4*I-C.memory.buffer.byteLength;w>0&&C.memory.grow(Math.ceil(w/65536));const K=C.sa(I-1);if((A?B:Q)(E,new Uint16Array(C.memory.buffer,K,I)),!C.parse())throw Object.assign(new Error(`Parse error ${g}:${E.slice(0,C.e()).split("\n").length}:${C.e()-E.lastIndexOf("\n",C.e()-1)}`),{idx:C.e()});const o=[],D=[];for(;C.ri();){const A=C.is(),Q=C.ie(),B=C.it(),g=C.ai(),I=C.id(),w=C.ss(),K=C.se();let D;C.ip()&&(D=k(E.slice(-1===I?A-1:A,-1===I?Q+1:Q))),o.push({n:D,t:B,s:A,e:Q,ss:w,se:K,d:I,a:g});}for(;C.re();){const A=C.es(),Q=C.ee(),B=C.els(),g=C.ele(),I=E.slice(A,Q),w=I[0],K=B<0?undefined:E.slice(B,g),o=K?K[0]:"";D.push({s:A,e:Q,ls:B,le:g,n:'"'===w||"'"===w?k(I):I,ln:'"'===o||"'"===o?k(K):K});}function k(A){try{return (0,eval)(A)}catch(A){}}return [o,D,!!C.f(),!!C.ms()]}function Q(A,Q){const B=A.length;let C=0;for(;C<B;){const B=A.charCodeAt(C);Q[C++]=(255&B)<<8|B>>>8;}}function B(A,Q){const B=A.length;let C=0;for(;C<B;)Q[C]=A.charCodeAt(C++);}let C;const E=()=>{return A="AGFzbQEAAAABKwhgAX8Bf2AEf39/fwBgAAF/YAAAYAF/AGADf39/AX9gAn9/AX9gA39/fwADMTAAAQECAgICAgICAgICAgICAgICAgIAAwMDBAQAAAUAAAAAAAMDAwAGAAAABwAGAgUEBQFwAQEBBQMBAAEGDwJ/AUHA8gALfwBBwPIACwd6FQZtZW1vcnkCAAJzYQAAAWUAAwJpcwAEAmllAAUCc3MABgJzZQAHAml0AAgCYWkACQJpZAAKAmlwAAsCZXMADAJlZQANA2VscwAOA2VsZQAPAnJpABACcmUAEQFmABICbXMAEwVwYXJzZQAUC19faGVhcF9iYXNlAwEKzkQwaAEBf0EAIAA2AoAKQQAoAtwJIgEgAEEBdGoiAEEAOwEAQQAgAEECaiIANgKECkEAIAA2AogKQQBBADYC4AlBAEEANgLwCUEAQQA2AugJQQBBADYC5AlBAEEANgL4CUEAQQA2AuwJIAEL0wEBA39BACgC8AkhBEEAQQAoAogKIgU2AvAJQQAgBDYC9AlBACAFQSRqNgKICiAEQSBqQeAJIAQbIAU2AgBBACgC1AkhBEEAKALQCSEGIAUgATYCACAFIAA2AgggBSACIAJBAmpBACAGIANGIgAbIAQgA0YiBBs2AgwgBSADNgIUIAVBADYCECAFIAI2AgQgBUEANgIgIAVBA0EBQQIgABsgBBs2AhwgBUEAKALQCSADRiICOgAYAkACQCACDQBBACgC1AkgA0cNAQtBAEEBOgCMCgsLXgEBf0EAKAL4CSIEQRBqQeQJIAQbQQAoAogKIgQ2AgBBACAENgL4CUEAIARBFGo2AogKQQBBAToAjAogBEEANgIQIAQgAzYCDCAEIAI2AgggBCABNgIEIAQgADYCAAsIAEEAKAKQCgsVAEEAKALoCSgCAEEAKALcCWtBAXULHgEBf0EAKALoCSgCBCIAQQAoAtwJa0EBdUF/IAAbCxUAQQAoAugJKAIIQQAoAtwJa0EBdQseAQF/QQAoAugJKAIMIgBBACgC3AlrQQF1QX8gABsLCwBBACgC6AkoAhwLHgEBf0EAKALoCSgCECIAQQAoAtwJa0EBdUF/IAAbCzsBAX8CQEEAKALoCSgCFCIAQQAoAtAJRw0AQX8PCwJAIABBACgC1AlHDQBBfg8LIABBACgC3AlrQQF1CwsAQQAoAugJLQAYCxUAQQAoAuwJKAIAQQAoAtwJa0EBdQsVAEEAKALsCSgCBEEAKALcCWtBAXULHgEBf0EAKALsCSgCCCIAQQAoAtwJa0EBdUF/IAAbCx4BAX9BACgC7AkoAgwiAEEAKALcCWtBAXVBfyAAGwslAQF/QQBBACgC6AkiAEEgakHgCSAAGygCACIANgLoCSAAQQBHCyUBAX9BAEEAKALsCSIAQRBqQeQJIAAbKAIAIgA2AuwJIABBAEcLCABBAC0AlAoLCABBAC0AjAoL3Q0BBX8jAEGA0ABrIgAkAEEAQQE6AJQKQQBBACgC2Ak2ApwKQQBBACgC3AlBfmoiATYCsApBACABQQAoAoAKQQF0aiICNgK0CkEAQQA6AIwKQQBBADsBlgpBAEEAOwGYCkEAQQA6AKAKQQBBADYCkApBAEEAOgD8CUEAIABBgBBqNgKkCkEAIAA2AqgKQQBBADoArAoCQAJAAkACQANAQQAgAUECaiIDNgKwCiABIAJPDQECQCADLwEAIgJBd2pBBUkNAAJAAkACQAJAAkAgAkGbf2oOBQEICAgCAAsgAkEgRg0EIAJBL0YNAyACQTtGDQIMBwtBAC8BmAoNASADEBVFDQEgAUEEakGCCEEKEC8NARAWQQAtAJQKDQFBAEEAKAKwCiIBNgKcCgwHCyADEBVFDQAgAUEEakGMCEEKEC8NABAXC0EAQQAoArAKNgKcCgwBCwJAIAEvAQQiA0EqRg0AIANBL0cNBBAYDAELQQEQGQtBACgCtAohAkEAKAKwCiEBDAALC0EAIQIgAyEBQQAtAPwJDQIMAQtBACABNgKwCkEAQQA6AJQKCwNAQQAgAUECaiIDNgKwCgJAAkACQAJAAkACQAJAIAFBACgCtApPDQAgAy8BACICQXdqQQVJDQYCQAJAAkACQAJAAkACQAJAAkACQCACQWBqDgoQDwYPDw8PBQECAAsCQAJAAkACQCACQaB/ag4KCxISAxIBEhISAgALIAJBhX9qDgMFEQYJC0EALwGYCg0QIAMQFUUNECABQQRqQYIIQQoQLw0QEBYMEAsgAxAVRQ0PIAFBBGpBjAhBChAvDQ8QFwwPCyADEBVFDQ4gASkABELsgISDsI7AOVINDiABLwEMIgNBd2oiAUEXSw0MQQEgAXRBn4CABHFFDQwMDQtBAEEALwGYCiIBQQFqOwGYCkEAKAKkCiABQQN0aiIBQQE2AgAgAUEAKAKcCjYCBAwNC0EALwGYCiIDRQ0JQQAgA0F/aiIDOwGYCkEALwGWCiICRQ0MQQAoAqQKIANB//8DcUEDdGooAgBBBUcNDAJAIAJBAnRBACgCqApqQXxqKAIAIgMoAgQNACADQQAoApwKQQJqNgIEC0EAIAJBf2o7AZYKIAMgAUEEajYCDAwMCwJAQQAoApwKIgEvAQBBKUcNAEEAKALwCSIDRQ0AIAMoAgQgAUcNAEEAQQAoAvQJIgM2AvAJAkAgA0UNACADQQA2AiAMAQtBAEEANgLgCQtBAEEALwGYCiIDQQFqOwGYCkEAKAKkCiADQQN0aiIDQQZBAkEALQCsChs2AgAgAyABNgIEQQBBADoArAoMCwtBAC8BmAoiAUUNB0EAIAFBf2oiATsBmApBACgCpAogAUH//wNxQQN0aigCAEEERg0EDAoLQScQGgwJC0EiEBoMCAsgAkEvRw0HAkACQCABLwEEIgFBKkYNACABQS9HDQEQGAwKC0EBEBkMCQsCQAJAAkACQEEAKAKcCiIBLwEAIgMQG0UNAAJAAkAgA0FVag4EAAkBAwkLIAFBfmovAQBBK0YNAwwICyABQX5qLwEAQS1GDQIMBwsgA0EpRw0BQQAoAqQKQQAvAZgKIgJBA3RqKAIEEBxFDQIMBgsgAUF+ai8BAEFQakH//wNxQQpPDQULQQAvAZgKIQILAkACQCACQf//A3EiAkUNACADQeYARw0AQQAoAqQKIAJBf2pBA3RqIgQoAgBBAUcNACABQX5qLwEAQe8ARw0BIAQoAgRBlghBAxAdRQ0BDAULIANB/QBHDQBBACgCpAogAkEDdGoiAigCBBAeDQQgAigCAEEGRg0ECyABEB8NAyADRQ0DIANBL0ZBAC0AoApBAEdxDQMCQEEAKAL4CSICRQ0AIAEgAigCAEkNACABIAIoAgRNDQQLIAFBfmohAUEAKALcCSECAkADQCABQQJqIgQgAk0NAUEAIAE2ApwKIAEvAQAhAyABQX5qIgQhASADECBFDQALIARBAmohBAsCQCADQf//A3EQIUUNACAEQX5qIQECQANAIAFBAmoiAyACTQ0BQQAgATYCnAogAS8BACEDIAFBfmoiBCEBIAMQIQ0ACyAEQQJqIQMLIAMQIg0EC0EAQQE6AKAKDAcLQQAoAqQKQQAvAZgKIgFBA3QiA2pBACgCnAo2AgRBACABQQFqOwGYCkEAKAKkCiADakEDNgIACxAjDAULQQAtAPwJQQAvAZYKQQAvAZgKcnJFIQIMBwsQJEEAQQA6AKAKDAMLECVBACECDAULIANBoAFHDQELQQBBAToArAoLQQBBACgCsAo2ApwKC0EAKAKwCiEBDAALCyAAQYDQAGokACACCxoAAkBBACgC3AkgAEcNAEEBDwsgAEF+ahAmC/4KAQZ/QQBBACgCsAoiAEEMaiIBNgKwCkEAKAL4CSECQQEQKSEDAkACQAJAAkACQAJAAkACQAJAQQAoArAKIgQgAUcNACADEChFDQELAkACQAJAAkACQAJAAkAgA0EqRg0AIANB+wBHDQFBACAEQQJqNgKwCkEBECkhA0EAKAKwCiEEA0ACQAJAIANB//8DcSIDQSJGDQAgA0EnRg0AIAMQLBpBACgCsAohAwwBCyADEBpBAEEAKAKwCkECaiIDNgKwCgtBARApGgJAIAQgAxAtIgNBLEcNAEEAQQAoArAKQQJqNgKwCkEBECkhAwsgA0H9AEYNA0EAKAKwCiIFIARGDQ8gBSEEIAVBACgCtApNDQAMDwsLQQAgBEECajYCsApBARApGkEAKAKwCiIDIAMQLRoMAgtBAEEAOgCUCgJAAkACQAJAAkACQCADQZ9/ag4MAgsEAQsDCwsLCwsFAAsgA0H2AEYNBAwKC0EAIARBDmoiAzYCsAoCQAJAAkBBARApQZ9/ag4GABICEhIBEgtBACgCsAoiBSkAAkLzgOSD4I3AMVINESAFLwEKECFFDRFBACAFQQpqNgKwCkEAECkaC0EAKAKwCiIFQQJqQbIIQQ4QLw0QIAUvARAiAkF3aiIBQRdLDQ1BASABdEGfgIAEcUUNDQwOC0EAKAKwCiIFKQACQuyAhIOwjsA5Ug0PIAUvAQoiAkF3aiIBQRdNDQYMCgtBACAEQQpqNgKwCkEAECkaQQAoArAKIQQLQQAgBEEQajYCsAoCQEEBECkiBEEqRw0AQQBBACgCsApBAmo2ArAKQQEQKSEEC0EAKAKwCiEDIAQQLBogA0EAKAKwCiIEIAMgBBACQQBBACgCsApBfmo2ArAKDwsCQCAEKQACQuyAhIOwjsA5Ug0AIAQvAQoQIEUNAEEAIARBCmo2ArAKQQEQKSEEQQAoArAKIQMgBBAsGiADQQAoArAKIgQgAyAEEAJBAEEAKAKwCkF+ajYCsAoPC0EAIARBBGoiBDYCsAoLQQAgBEEGajYCsApBAEEAOgCUCkEBECkhBEEAKAKwCiEDIAQQLCEEQQAoArAKIQIgBEHf/wNxIgFB2wBHDQNBACACQQJqNgKwCkEBECkhBUEAKAKwCiEDQQAhBAwEC0EAQQE6AIwKQQBBACgCsApBAmo2ArAKC0EBECkhBEEAKAKwCiEDAkAgBEHmAEcNACADQQJqQawIQQYQLw0AQQAgA0EIajYCsAogAEEBEClBABArIAJBEGpB5AkgAhshAwNAIAMoAgAiA0UNBSADQgA3AgggA0EQaiEDDAALC0EAIANBfmo2ArAKDAMLQQEgAXRBn4CABHFFDQMMBAtBASEECwNAAkACQCAEDgIAAQELIAVB//8DcRAsGkEBIQQMAQsCQAJAQQAoArAKIgQgA0YNACADIAQgAyAEEAJBARApIQQCQCABQdsARw0AIARBIHJB/QBGDQQLQQAoArAKIQMCQCAEQSxHDQBBACADQQJqNgKwCkEBECkhBUEAKAKwCiEDIAVBIHJB+wBHDQILQQAgA0F+ajYCsAoLIAFB2wBHDQJBACACQX5qNgKwCg8LQQAhBAwACwsPCyACQaABRg0AIAJB+wBHDQQLQQAgBUEKajYCsApBARApIgVB+wBGDQMMAgsCQCACQVhqDgMBAwEACyACQaABRw0CC0EAIAVBEGo2ArAKAkBBARApIgVBKkcNAEEAQQAoArAKQQJqNgKwCkEBECkhBQsgBUEoRg0BC0EAKAKwCiEBIAUQLBpBACgCsAoiBSABTQ0AIAQgAyABIAUQAkEAQQAoArAKQX5qNgKwCg8LIAQgA0EAQQAQAkEAIARBDGo2ArAKDwsQJQuFDAEKf0EAQQAoArAKIgBBDGoiATYCsApBARApIQJBACgCsAohAwJAAkACQAJAAkACQAJAAkAgAkEuRw0AQQAgA0ECajYCsAoCQEEBECkiAkHkAEYNAAJAIAJB8wBGDQAgAkHtAEcNB0EAKAKwCiICQQJqQZwIQQYQLw0HAkBBACgCnAoiAxAqDQAgAy8BAEEuRg0ICyAAIAAgAkEIakEAKALUCRABDwtBACgCsAoiAkECakGiCEEKEC8NBgJAQQAoApwKIgMQKg0AIAMvAQBBLkYNBwtBACEEQQAgAkEMajYCsApBASEFQQUhBkEBECkhAkEAIQdBASEIDAILQQAoArAKIgIpAAJC5YCYg9CMgDlSDQUCQEEAKAKcCiIDECoNACADLwEAQS5GDQYLQQAhBEEAIAJBCmo2ArAKQQIhCEEHIQZBASEHQQEQKSECQQEhBQwBCwJAAkACQAJAIAJB8wBHDQAgAyABTQ0AIANBAmpBoghBChAvDQACQCADLwEMIgRBd2oiB0EXSw0AQQEgB3RBn4CABHENAgsgBEGgAUYNAQtBACEHQQchBkEBIQQgAkHkAEYNAQwCC0EAIQRBACADQQxqIgI2ArAKQQEhBUEBECkhCQJAQQAoArAKIgYgAkYNAEHmACECAkAgCUHmAEYNAEEFIQZBACEHQQEhCCAJIQIMBAtBACEHQQEhCCAGQQJqQawIQQYQLw0EIAYvAQgQIEUNBAtBACEHQQAgAzYCsApBByEGQQEhBEEAIQVBACEIIAkhAgwCCyADIABBCmpNDQBBACEIQeQAIQICQCADKQACQuWAmIPQjIA5Ug0AAkACQCADLwEKIgRBd2oiB0EXSw0AQQEgB3RBn4CABHENAQtBACEIIARBoAFHDQELQQAhBUEAIANBCmo2ArAKQSohAkEBIQdBAiEIQQEQKSIJQSpGDQRBACADNgKwCkEBIQRBACEHQQAhCCAJIQIMAgsgAyEGQQAhBwwCC0EAIQVBACEICwJAIAJBKEcNAEEAKAKkCkEALwGYCiICQQN0aiIDQQAoArAKNgIEQQAgAkEBajsBmAogA0EFNgIAQQAoApwKLwEAQS5GDQRBAEEAKAKwCiIDQQJqNgKwCkEBECkhAiAAQQAoArAKQQAgAxABAkACQCAFDQBBACgC8AkhAQwBC0EAKALwCSIBIAY2AhwLQQBBAC8BlgoiA0EBajsBlgpBACgCqAogA0ECdGogATYCAAJAIAJBIkYNACACQSdGDQBBAEEAKAKwCkF+ajYCsAoPCyACEBpBAEEAKAKwCkECaiICNgKwCgJAAkACQEEBEClBV2oOBAECAgACC0EAQQAoArAKQQJqNgKwCkEBECkaQQAoAvAJIgMgAjYCBCADQQE6ABggA0EAKAKwCiICNgIQQQAgAkF+ajYCsAoPC0EAKALwCSIDIAI2AgQgA0EBOgAYQQBBAC8BmApBf2o7AZgKIANBACgCsApBAmo2AgxBAEEALwGWCkF/ajsBlgoPC0EAQQAoArAKQX5qNgKwCg8LAkAgBEEBcyACQfsAR3INAEEAKAKwCiECQQAvAZgKDQUDQAJAAkACQCACQQAoArQKTw0AQQEQKSICQSJGDQEgAkEnRg0BIAJB/QBHDQJBAEEAKAKwCkECajYCsAoLQQEQKSEDQQAoArAKIQICQCADQeYARw0AIAJBAmpBrAhBBhAvDQcLQQAgAkEIajYCsAoCQEEBECkiAkEiRg0AIAJBJ0cNBwsgACACQQAQKw8LIAIQGgtBAEEAKAKwCkECaiICNgKwCgwACwsCQAJAIAJBWWoOBAMBAQMACyACQSJGDQILQQAoArAKIQYLIAYgAUcNAEEAIABBCmo2ArAKDwsgAkEqRyAHcQ0DQQAvAZgKQf//A3ENA0EAKAKwCiECQQAoArQKIQEDQCACIAFPDQECQAJAIAIvAQAiA0EnRg0AIANBIkcNAQsgACADIAgQKw8LQQAgAkECaiICNgKwCgwACwsQJQsPC0EAIAJBfmo2ArAKDwtBAEEAKAKwCkF+ajYCsAoLRwEDf0EAKAKwCkECaiEAQQAoArQKIQECQANAIAAiAkF+aiABTw0BIAJBAmohACACLwEAQXZqDgQBAAABAAsLQQAgAjYCsAoLmAEBA39BAEEAKAKwCiIBQQJqNgKwCiABQQZqIQFBACgCtAohAgNAAkACQAJAIAFBfGogAk8NACABQX5qLwEAIQMCQAJAIAANACADQSpGDQEgA0F2ag4EAgQEAgQLIANBKkcNAwsgAS8BAEEvRw0CQQAgAUF+ajYCsAoMAQsgAUF+aiEBC0EAIAE2ArAKDwsgAUECaiEBDAALC4gBAQR/QQAoArAKIQFBACgCtAohAgJAAkADQCABIgNBAmohASADIAJPDQEgAS8BACIEIABGDQICQCAEQdwARg0AIARBdmoOBAIBAQIBCyADQQRqIQEgAy8BBEENRw0AIANBBmogASADLwEGQQpGGyEBDAALC0EAIAE2ArAKECUPC0EAIAE2ArAKC2wBAX8CQAJAIABBX2oiAUEFSw0AQQEgAXRBMXENAQsgAEFGakH//wNxQQZJDQAgAEEpRyAAQVhqQf//A3FBB0lxDQACQCAAQaV/ag4EAQAAAQALIABB/QBHIABBhX9qQf//A3FBBElxDwtBAQsuAQF/QQEhAQJAIABBpglBBRAdDQAgAEGWCEEDEB0NACAAQbAJQQIQHSEBCyABC0YBA39BACEDAkAgACACQQF0IgJrIgRBAmoiAEEAKALcCSIFSQ0AIAAgASACEC8NAAJAIAAgBUcNAEEBDwsgBBAmIQMLIAMLgwEBAn9BASEBAkACQAJAAkACQAJAIAAvAQAiAkFFag4EBQQEAQALAkAgAkGbf2oOBAMEBAIACyACQSlGDQQgAkH5AEcNAyAAQX5qQbwJQQYQHQ8LIABBfmovAQBBPUYPCyAAQX5qQbQJQQQQHQ8LIABBfmpByAlBAxAdDwtBACEBCyABC7QDAQJ/QQAhAQJAAkACQAJAAkACQAJAAkACQAJAIAAvAQBBnH9qDhQAAQIJCQkJAwkJBAUJCQYJBwkJCAkLAkACQCAAQX5qLwEAQZd/ag4EAAoKAQoLIABBfGpByghBAhAdDwsgAEF8akHOCEEDEB0PCwJAAkACQCAAQX5qLwEAQY1/ag4DAAECCgsCQCAAQXxqLwEAIgJB4QBGDQAgAkHsAEcNCiAAQXpqQeUAECcPCyAAQXpqQeMAECcPCyAAQXxqQdQIQQQQHQ8LIABBfGpB3AhBBhAdDwsgAEF+ai8BAEHvAEcNBiAAQXxqLwEAQeUARw0GAkAgAEF6ai8BACICQfAARg0AIAJB4wBHDQcgAEF4akHoCEEGEB0PCyAAQXhqQfQIQQIQHQ8LIABBfmpB+AhBBBAdDwtBASEBIABBfmoiAEHpABAnDQQgAEGACUEFEB0PCyAAQX5qQeQAECcPCyAAQX5qQYoJQQcQHQ8LIABBfmpBmAlBBBAdDwsCQCAAQX5qLwEAIgJB7wBGDQAgAkHlAEcNASAAQXxqQe4AECcPCyAAQXxqQaAJQQMQHSEBCyABCzQBAX9BASEBAkAgAEF3akH//wNxQQVJDQAgAEGAAXJBoAFGDQAgAEEuRyAAEChxIQELIAELMAEBfwJAAkAgAEF3aiIBQRdLDQBBASABdEGNgIAEcQ0BCyAAQaABRg0AQQAPC0EBC04BAn9BACEBAkACQCAALwEAIgJB5QBGDQAgAkHrAEcNASAAQX5qQfgIQQQQHQ8LIABBfmovAQBB9QBHDQAgAEF8akHcCEEGEB0hAQsgAQveAQEEf0EAKAKwCiEAQQAoArQKIQECQAJAAkADQCAAIgJBAmohACACIAFPDQECQAJAAkAgAC8BACIDQaR/ag4FAgMDAwEACyADQSRHDQIgAi8BBEH7AEcNAkEAIAJBBGoiADYCsApBAEEALwGYCiICQQFqOwGYCkEAKAKkCiACQQN0aiICQQQ2AgAgAiAANgIEDwtBACAANgKwCkEAQQAvAZgKQX9qIgA7AZgKQQAoAqQKIABB//8DcUEDdGooAgBBA0cNAwwECyACQQRqIQAMAAsLQQAgADYCsAoLECULC3ABAn8CQAJAA0BBAEEAKAKwCiIAQQJqIgE2ArAKIABBACgCtApPDQECQAJAAkAgAS8BACIBQaV/ag4CAQIACwJAIAFBdmoOBAQDAwQACyABQS9HDQIMBAsQLhoMAQtBACAAQQRqNgKwCgwACwsQJQsLNQEBf0EAQQE6APwJQQAoArAKIQBBAEEAKAK0CkECajYCsApBACAAQQAoAtwJa0EBdTYCkAoLQwECf0EBIQECQCAALwEAIgJBd2pB//8DcUEFSQ0AIAJBgAFyQaABRg0AQQAhASACEChFDQAgAkEuRyAAECpyDwsgAQs9AQJ/QQAhAgJAQQAoAtwJIgMgAEsNACAALwEAIAFHDQACQCADIABHDQBBAQ8LIABBfmovAQAQICECCyACC2gBAn9BASEBAkACQCAAQV9qIgJBBUsNAEEBIAJ0QTFxDQELIABB+P8DcUEoRg0AIABBRmpB//8DcUEGSQ0AAkAgAEGlf2oiAkEDSw0AIAJBAUcNAQsgAEGFf2pB//8DcUEESSEBCyABC5wBAQN/QQAoArAKIQECQANAAkACQCABLwEAIgJBL0cNAAJAIAEvAQIiAUEqRg0AIAFBL0cNBBAYDAILIAAQGQwBCwJAAkAgAEUNACACQXdqIgFBF0sNAUEBIAF0QZ+AgARxRQ0BDAILIAIQIUUNAwwBCyACQaABRw0CC0EAQQAoArAKIgNBAmoiATYCsAogA0EAKAK0CkkNAAsLIAILMQEBf0EAIQECQCAALwEAQS5HDQAgAEF+ai8BAEEuRw0AIABBfGovAQBBLkYhAQsgAQumBAEBfwJAIAFBIkYNACABQSdGDQAQJQ8LQQAoArAKIQMgARAaIAAgA0ECakEAKAKwCkEAKALQCRABAkAgAkEBSA0AQQAoAvAJQQRBBiACQQFGGzYCHAtBAEEAKAKwCkECajYCsAoCQAJAAkACQEEAECkiAUHhAEYNACABQfcARg0BQQAoArAKIQEMAgtBACgCsAoiAUECakHACEEKEC8NAUEGIQIMAgtBACgCsAoiAS8BAkHpAEcNACABLwEEQfQARw0AQQQhAiABLwEGQegARg0BC0EAIAFBfmo2ArAKDwtBACABIAJBAXRqNgKwCgJAQQEQKUH7AEYNAEEAIAE2ArAKDwtBACgCsAoiACECA0BBACACQQJqNgKwCgJAAkACQEEBECkiAkEiRg0AIAJBJ0cNAUEnEBpBAEEAKAKwCkECajYCsApBARApIQIMAgtBIhAaQQBBACgCsApBAmo2ArAKQQEQKSECDAELIAIQLCECCwJAIAJBOkYNAEEAIAE2ArAKDwtBAEEAKAKwCkECajYCsAoCQEEBECkiAkEiRg0AIAJBJ0YNAEEAIAE2ArAKDwsgAhAaQQBBACgCsApBAmo2ArAKAkACQEEBECkiAkEsRg0AIAJB/QBGDQFBACABNgKwCg8LQQBBACgCsApBAmo2ArAKQQEQKUH9AEYNAEEAKAKwCiECDAELC0EAKALwCSIBIAA2AhAgAUEAKAKwCkECajYCDAttAQJ/AkACQANAAkAgAEH//wNxIgFBd2oiAkEXSw0AQQEgAnRBn4CABHENAgsgAUGgAUYNASAAIQIgARAoDQJBACECQQBBACgCsAoiAEECajYCsAogAC8BAiIADQAMAgsLIAAhAgsgAkH//wNxC6sBAQR/AkACQEEAKAKwCiICLwEAIgNB4QBGDQAgASEEIAAhBQwBC0EAIAJBBGo2ArAKQQEQKSECQQAoArAKIQUCQAJAIAJBIkYNACACQSdGDQAgAhAsGkEAKAKwCiEEDAELIAIQGkEAQQAoArAKQQJqIgQ2ArAKC0EBECkhA0EAKAKwCiECCwJAIAIgBUYNACAFIARBACAAIAAgAUYiAhtBACABIAIbEAILIAMLcgEEf0EAKAKwCiEAQQAoArQKIQECQAJAA0AgAEECaiECIAAgAU8NAQJAAkAgAi8BACIDQaR/ag4CAQQACyACIQAgA0F2ag4EAgEBAgELIABBBGohAAwACwtBACACNgKwChAlQQAPC0EAIAI2ArAKQd0AC0kBA39BACEDAkAgAkUNAAJAA0AgAC0AACIEIAEtAAAiBUcNASABQQFqIQEgAEEBaiEAIAJBf2oiAg0ADAILCyAEIAVrIQMLIAMLC+wBAgBBgAgLzgEAAHgAcABvAHIAdABtAHAAbwByAHQAZgBvAHIAZQB0AGEAbwB1AHIAYwBlAHIAbwBtAHUAbgBjAHQAaQBvAG4AcwBzAGUAcgB0AHYAbwB5AGkAZQBkAGUAbABlAGMAbwBuAHQAaQBuAGkAbgBzAHQAYQBuAHQAeQBiAHIAZQBhAHIAZQB0AHUAcgBkAGUAYgB1AGcAZwBlAGEAdwBhAGkAdABoAHIAdwBoAGkAbABlAGkAZgBjAGEAdABjAGYAaQBuAGEAbABsAGUAbABzAABB0AkLEAEAAAACAAAAAAQAAEA5AAA=","undefined"!=typeof Buffer?Buffer.from(A,"base64"):Uint8Array.from(atob(A),(A=>A.charCodeAt(0)));var A;};const init=WebAssembly.compile(E()).then(WebAssembly.instantiate).then((({exports:A})=>{C=A;}));
|
|
91179
91176
|
|
|
91180
|
-
/**
|
|
91181
|
-
* Converts JavaScript source to a data URL tied to a logical module id.
|
|
91182
|
-
*
|
|
91183
|
-
* @param js - The JavaScript source code to embed.
|
|
91184
|
-
* @param id - Logical module identifier (used only for sourceURL tagging).
|
|
91185
|
-
* @returns A `data:text/javascript;base64,...` URL with an encoded `#id` suffix.
|
|
91186
|
-
* @internal
|
|
91177
|
+
/**
|
|
91178
|
+
* Converts JavaScript source to a data URL tied to a logical module id.
|
|
91179
|
+
*
|
|
91180
|
+
* @param js - The JavaScript source code to embed.
|
|
91181
|
+
* @param id - Logical module identifier (used only for sourceURL tagging).
|
|
91182
|
+
* @returns A `data:text/javascript;base64,...` URL with an encoded `#id` suffix.
|
|
91183
|
+
* @internal
|
|
91187
91184
|
*/ function toDataUrl(js, id) {
|
|
91188
91185
|
const b64 = textToBase64(js);
|
|
91189
91186
|
return `data:text/javascript;base64,${b64}#${encodeURIComponent(String(id))}`;
|
|
91190
91187
|
}
|
|
91191
|
-
/**
|
|
91192
|
-
* Checks whether a specifier is an absolute HTTP(S) URL.
|
|
91193
|
-
* @internal
|
|
91188
|
+
/**
|
|
91189
|
+
* Checks whether a specifier is an absolute HTTP(S) URL.
|
|
91190
|
+
* @internal
|
|
91194
91191
|
*/ function isAbsoluteUrl(spec) {
|
|
91195
91192
|
return /^https?:\/\//i.test(spec);
|
|
91196
91193
|
}
|
|
91197
|
-
/**
|
|
91198
|
-
* Checks whether a specifier is a special URL (data: or blob:).
|
|
91199
|
-
* @internal
|
|
91194
|
+
/**
|
|
91195
|
+
* Checks whether a specifier is a special URL (data: or blob:).
|
|
91196
|
+
* @internal
|
|
91200
91197
|
*/ function isSpecialUrl(spec) {
|
|
91201
91198
|
return /^(data|blob):/i.test(spec);
|
|
91202
91199
|
}
|
|
91203
|
-
/**
|
|
91204
|
-
* Checks whether a specifier is a bare module (not starting with ./, ../, /, or #/).
|
|
91205
|
-
* @internal
|
|
91200
|
+
/**
|
|
91201
|
+
* Checks whether a specifier is a bare module (not starting with ./, ../, /, or #/).
|
|
91202
|
+
* @internal
|
|
91206
91203
|
*/ function isBareModule(spec) {
|
|
91207
91204
|
return !spec.startsWith('./') && !spec.startsWith('../') && !spec.startsWith('/') && !spec.startsWith('#/');
|
|
91208
91205
|
}
|
|
@@ -91233,32 +91230,32 @@ function hasRawQuery(spec) {
|
|
|
91233
91230
|
}
|
|
91234
91231
|
return query.split('&').some((part)=>part.trim() === 'raw');
|
|
91235
91232
|
}
|
|
91236
|
-
/**
|
|
91237
|
-
* Resolves, builds, and serves runtime modules using a VFS.
|
|
91238
|
-
*
|
|
91239
|
-
* Responsibilities:
|
|
91240
|
-
* - Resolve logical module IDs to physical paths or URLs.
|
|
91241
|
-
* - In editor mode, bundle local script modules into a single data URL after transpile.
|
|
91242
|
-
* - Transpile TypeScript to JavaScript on the fly (requires `window.ts` TypeScript runtime).
|
|
91243
|
-
* - Gather static and dynamic import dependencies for tooling.
|
|
91244
|
-
*
|
|
91245
|
-
* Modes:
|
|
91246
|
-
* - Editor mode (`editorMode === true`): local script graphs are bundled to data URLs.
|
|
91247
|
-
* - Runtime mode (`editorMode === false`): returns .js URLs directly (with .ts -\> .js mapping).
|
|
91248
|
-
*
|
|
91249
|
-
* Caching:
|
|
91250
|
-
* - Built bundles are memoized in `_built` map keyed by canonical source path.
|
|
91251
|
-
*
|
|
91252
|
-
* @public
|
|
91233
|
+
/**
|
|
91234
|
+
* Resolves, builds, and serves runtime modules using a VFS.
|
|
91235
|
+
*
|
|
91236
|
+
* Responsibilities:
|
|
91237
|
+
* - Resolve logical module IDs to physical paths or URLs.
|
|
91238
|
+
* - In editor mode, bundle local script modules into a single data URL after transpile.
|
|
91239
|
+
* - Transpile TypeScript to JavaScript on the fly (requires `window.ts` TypeScript runtime).
|
|
91240
|
+
* - Gather static and dynamic import dependencies for tooling.
|
|
91241
|
+
*
|
|
91242
|
+
* Modes:
|
|
91243
|
+
* - Editor mode (`editorMode === true`): local script graphs are bundled to data URLs.
|
|
91244
|
+
* - Runtime mode (`editorMode === false`): returns .js URLs directly (with .ts -\> .js mapping).
|
|
91245
|
+
*
|
|
91246
|
+
* Caching:
|
|
91247
|
+
* - Built bundles are memoized in `_built` map keyed by canonical source path.
|
|
91248
|
+
*
|
|
91249
|
+
* @public
|
|
91253
91250
|
*/ class ScriptRegistry {
|
|
91254
91251
|
_vfs;
|
|
91255
91252
|
_scriptsRoot;
|
|
91256
91253
|
_built;
|
|
91257
91254
|
_building;
|
|
91258
91255
|
_builtDeps;
|
|
91259
|
-
/**
|
|
91260
|
-
* @param vfs - The virtual file system for existence checks, reads, and path ops.
|
|
91261
|
-
* @param scriptsRoot - Root directory for script resolution (used with `#/` specifiers).
|
|
91256
|
+
/**
|
|
91257
|
+
* @param vfs - The virtual file system for existence checks, reads, and path ops.
|
|
91258
|
+
* @param scriptsRoot - Root directory for script resolution (used with `#/` specifiers).
|
|
91262
91259
|
*/ constructor(vfs, scriptsRoot){
|
|
91263
91260
|
this._vfs = vfs;
|
|
91264
91261
|
this._scriptsRoot = scriptsRoot;
|
|
@@ -91266,10 +91263,10 @@ function hasRawQuery(spec) {
|
|
|
91266
91263
|
this._building = new Map();
|
|
91267
91264
|
this._builtDeps = new Map();
|
|
91268
91265
|
}
|
|
91269
|
-
/**
|
|
91270
|
-
* The active virtual file system.
|
|
91271
|
-
*
|
|
91272
|
-
* Assigning a new VFS clears the build cache.
|
|
91266
|
+
/**
|
|
91267
|
+
* The active virtual file system.
|
|
91268
|
+
*
|
|
91269
|
+
* Assigning a new VFS clears the build cache.
|
|
91273
91270
|
*/ get VFS() {
|
|
91274
91271
|
return this._vfs;
|
|
91275
91272
|
}
|
|
@@ -91281,21 +91278,21 @@ function hasRawQuery(spec) {
|
|
|
91281
91278
|
this._builtDeps.clear();
|
|
91282
91279
|
}
|
|
91283
91280
|
}
|
|
91284
|
-
/**
|
|
91285
|
-
* The root path used by `#/` specifiers.
|
|
91281
|
+
/**
|
|
91282
|
+
* The root path used by `#/` specifiers.
|
|
91286
91283
|
*/ get scriptsRoot() {
|
|
91287
91284
|
return this._scriptsRoot;
|
|
91288
91285
|
}
|
|
91289
91286
|
set scriptsRoot(path) {
|
|
91290
91287
|
this._scriptsRoot = path;
|
|
91291
91288
|
}
|
|
91292
|
-
/**
|
|
91293
|
-
* Invalidates cached built module output for one logical module id, or clears the full cache.
|
|
91294
|
-
*
|
|
91295
|
-
* Pass the same logical id shape that callers use with {@link ScriptRegistry.resolveRuntimeUrl},
|
|
91296
|
-
* for example `/assets/scripts/foo.ts`, `/assets/scripts/foo.js`, or `/assets/scripts/foo`.
|
|
91297
|
-
*
|
|
91298
|
-
* @param moduleId - Optional logical module id to invalidate. Omit to clear the entire build cache.
|
|
91289
|
+
/**
|
|
91290
|
+
* Invalidates cached built module output for one logical module id, or clears the full cache.
|
|
91291
|
+
*
|
|
91292
|
+
* Pass the same logical id shape that callers use with {@link ScriptRegistry.resolveRuntimeUrl},
|
|
91293
|
+
* for example `/assets/scripts/foo.ts`, `/assets/scripts/foo.js`, or `/assets/scripts/foo`.
|
|
91294
|
+
*
|
|
91295
|
+
* @param moduleId - Optional logical module id to invalidate. Omit to clear the entire build cache.
|
|
91299
91296
|
*/ invalidate(moduleId) {
|
|
91300
91297
|
if (!moduleId) {
|
|
91301
91298
|
this._built.clear();
|
|
@@ -91334,15 +91331,15 @@ function hasRawQuery(spec) {
|
|
|
91334
91331
|
}
|
|
91335
91332
|
}
|
|
91336
91333
|
}
|
|
91337
|
-
/**
|
|
91338
|
-
* Fetches raw source for a logical module id by probing known extensions.
|
|
91339
|
-
*
|
|
91340
|
-
* Search order:
|
|
91341
|
-
* - If `id` already ends with `.ts` or `.js` and is a file -\> return it.
|
|
91342
|
-
* - Else try `.id.ts`, then `.id.js`.
|
|
91343
|
-
*
|
|
91344
|
-
* @param id - Logical module identifier (absolute or logical path-like).
|
|
91345
|
-
* @returns Source code, resolved path, and type (`'js' | 'ts'`), or `undefined` if not found.
|
|
91334
|
+
/**
|
|
91335
|
+
* Fetches raw source for a logical module id by probing known extensions.
|
|
91336
|
+
*
|
|
91337
|
+
* Search order:
|
|
91338
|
+
* - If `id` already ends with `.ts` or `.js` and is a file -\> return it.
|
|
91339
|
+
* - Else try `.id.ts`, then `.id.js`.
|
|
91340
|
+
*
|
|
91341
|
+
* @param id - Logical module identifier (absolute or logical path-like).
|
|
91342
|
+
* @returns Source code, resolved path, and type (`'js' | 'ts'`), or `undefined` if not found.
|
|
91346
91343
|
*/ async fetchSource(id) {
|
|
91347
91344
|
let type = null;
|
|
91348
91345
|
let pathWithExt = '';
|
|
@@ -91391,18 +91388,18 @@ function hasRawQuery(spec) {
|
|
|
91391
91388
|
};
|
|
91392
91389
|
}
|
|
91393
91390
|
}
|
|
91394
|
-
/**
|
|
91395
|
-
* Resolves a module entry to a URL suitable for dynamic import.
|
|
91396
|
-
*
|
|
91397
|
-
* Behavior:
|
|
91398
|
-
* - In editor mode, builds the module to a data URL.
|
|
91399
|
-
* - Otherwise, returns `.js` URL directly:
|
|
91400
|
-
* - If `id` ends with `.js`: return as-is.
|
|
91401
|
-
* - If `id` ends with `.ts`: map to `.js` (assumes pre-built file exists).
|
|
91402
|
-
* - Else: append `.js`.
|
|
91403
|
-
*
|
|
91404
|
-
* @param entryId - Entry module identifier (logical or path-like).
|
|
91405
|
-
* @returns A URL string that can be used in `import(...)`.
|
|
91391
|
+
/**
|
|
91392
|
+
* Resolves a module entry to a URL suitable for dynamic import.
|
|
91393
|
+
*
|
|
91394
|
+
* Behavior:
|
|
91395
|
+
* - In editor mode, builds the module to a data URL.
|
|
91396
|
+
* - Otherwise, returns `.js` URL directly:
|
|
91397
|
+
* - If `id` ends with `.js`: return as-is.
|
|
91398
|
+
* - If `id` ends with `.ts`: map to `.js` (assumes pre-built file exists).
|
|
91399
|
+
* - Else: append `.js`.
|
|
91400
|
+
*
|
|
91401
|
+
* @param entryId - Entry module identifier (logical or path-like).
|
|
91402
|
+
* @returns A URL string that can be used in `import(...)`.
|
|
91406
91403
|
*/ async resolveRuntimeUrl(entryId) {
|
|
91407
91404
|
const id = await this.resolveLogicalId(entryId);
|
|
91408
91405
|
if (id.startsWith('/assets/@builtins/')) {
|
|
@@ -91410,15 +91407,15 @@ function hasRawQuery(spec) {
|
|
|
91410
91407
|
}
|
|
91411
91408
|
return getApp().editorMode !== 'none' ? await this.build(String(id)) : id.endsWith('.js') ? id : id.endsWith('.ts') ? `${id.slice(0, -3)}.js` : `${id}.js`;
|
|
91412
91409
|
}
|
|
91413
|
-
/**
|
|
91414
|
-
* Recursively gathers direct static and dynamic import dependencies for a module.
|
|
91415
|
-
*
|
|
91416
|
-
* Only relative specifiers (`./` or `../`) are followed. Absolute, special, and bare
|
|
91417
|
-
* module specifiers are ignored here.
|
|
91418
|
-
*
|
|
91419
|
-
* @param entryId - The starting (possibly relative) specifier from `fromId`.
|
|
91420
|
-
* @param fromId - The logical id of the module containing `entryId`.
|
|
91421
|
-
* @param dependencies - Output map of `resolvedSourcePath -\> file contents`.
|
|
91410
|
+
/**
|
|
91411
|
+
* Recursively gathers direct static and dynamic import dependencies for a module.
|
|
91412
|
+
*
|
|
91413
|
+
* Only relative specifiers (`./` or `../`) are followed. Absolute, special, and bare
|
|
91414
|
+
* module specifiers are ignored here.
|
|
91415
|
+
*
|
|
91416
|
+
* @param entryId - The starting (possibly relative) specifier from `fromId`.
|
|
91417
|
+
* @param fromId - The logical id of the module containing `entryId`.
|
|
91418
|
+
* @param dependencies - Output map of `resolvedSourcePath -\> file contents`.
|
|
91422
91419
|
*/ async getDependencies(entryId, fromId, dependencies) {
|
|
91423
91420
|
const reStatic = /\b(?:import|export)\s+[^"']*?from\s+(['"])([^'"]+)\1/g;
|
|
91424
91421
|
const reDynamic = /\bimport\s*\(\s*(['"])([^'"]+)\1\s*\)/g;
|
|
@@ -91446,17 +91443,17 @@ function hasRawQuery(spec) {
|
|
|
91446
91443
|
await gather(code, reStatic);
|
|
91447
91444
|
await gather(code, reDynamic);
|
|
91448
91445
|
}
|
|
91449
|
-
/**
|
|
91450
|
-
* Builds a logical module id into a bundled data URL (editor mode pipeline).
|
|
91451
|
-
*
|
|
91452
|
-
* Steps:
|
|
91453
|
-
* - Resolve source path (.ts/.js) via {@link ScriptRegistry.resolveSourcePath}.
|
|
91454
|
-
* - Collect reachable local imports without recursively building data URLs.
|
|
91455
|
-
* - Transpile local modules to `System.register`.
|
|
91456
|
-
* - Emit a single `data:` URL with a small module loader and memoize it in `_built`.
|
|
91457
|
-
*
|
|
91458
|
-
* @param id - Logical module id to build.
|
|
91459
|
-
* @returns Data URL string for dynamic import, or empty string if not found.
|
|
91446
|
+
/**
|
|
91447
|
+
* Builds a logical module id into a bundled data URL (editor mode pipeline).
|
|
91448
|
+
*
|
|
91449
|
+
* Steps:
|
|
91450
|
+
* - Resolve source path (.ts/.js) via {@link ScriptRegistry.resolveSourcePath}.
|
|
91451
|
+
* - Collect reachable local imports without recursively building data URLs.
|
|
91452
|
+
* - Transpile local modules to `System.register`.
|
|
91453
|
+
* - Emit a single `data:` URL with a small module loader and memoize it in `_built`.
|
|
91454
|
+
*
|
|
91455
|
+
* @param id - Logical module id to build.
|
|
91456
|
+
* @returns Data URL string for dynamic import, or empty string if not found.
|
|
91460
91457
|
*/ async build(id) {
|
|
91461
91458
|
const entry = await this.resolveModuleInfo(String(id));
|
|
91462
91459
|
if (!entry) {
|
|
@@ -91576,9 +91573,9 @@ function hasRawQuery(spec) {
|
|
|
91576
91573
|
});
|
|
91577
91574
|
return res.outputText || '';
|
|
91578
91575
|
}
|
|
91579
|
-
/**
|
|
91580
|
-
* Rewrites local ESM specifiers to canonical source paths and records local deps.
|
|
91581
|
-
* External URLs and package imports are left for the native dynamic import path.
|
|
91576
|
+
/**
|
|
91577
|
+
* Rewrites local ESM specifiers to canonical source paths and records local deps.
|
|
91578
|
+
* External URLs and package imports are left for the native dynamic import path.
|
|
91582
91579
|
*/ async rewriteImportsToLogicalIds(code, fromId) {
|
|
91583
91580
|
await init;
|
|
91584
91581
|
const [imports] = parse(code);
|
|
@@ -91726,21 +91723,21 @@ async function __z3dLoad(spec, parentId = '') {
|
|
|
91726
91723
|
}
|
|
91727
91724
|
`;
|
|
91728
91725
|
}
|
|
91729
|
-
/**
|
|
91730
|
-
* Resolves a specifier to a logical id suitable for further processing.
|
|
91731
|
-
*
|
|
91732
|
-
* Resolution rules:
|
|
91733
|
-
* - `#/path`: resolved against `scriptsRoot` via VFS join/normalize.
|
|
91734
|
-
* - `./` or `../`: resolved relative to `fromId` directory (requires `fromId`).
|
|
91735
|
-
* - `/absolute`: treated as absolute from root (normalized).
|
|
91736
|
-
* - Bare module in editor mode: if `/deps.lock.json` exists and contains an entry,
|
|
91737
|
-
* map to the dependency's `entry` path; otherwise return as-is.
|
|
91738
|
-
* - Else (non-editor bare module): return `spec` unchanged (external).
|
|
91739
|
-
*
|
|
91740
|
-
* @param spec - Import specifier string.
|
|
91741
|
-
* @param fromId - Optional base logical id used for relative resolution.
|
|
91742
|
-
* @returns A normalized logical id or an external specifier string.
|
|
91743
|
-
* @throws If a relative import is provided without `fromId`.
|
|
91726
|
+
/**
|
|
91727
|
+
* Resolves a specifier to a logical id suitable for further processing.
|
|
91728
|
+
*
|
|
91729
|
+
* Resolution rules:
|
|
91730
|
+
* - `#/path`: resolved against `scriptsRoot` via VFS join/normalize.
|
|
91731
|
+
* - `./` or `../`: resolved relative to `fromId` directory (requires `fromId`).
|
|
91732
|
+
* - `/absolute`: treated as absolute from root (normalized).
|
|
91733
|
+
* - Bare module in editor mode: if `/deps.lock.json` exists and contains an entry,
|
|
91734
|
+
* map to the dependency's `entry` path; otherwise return as-is.
|
|
91735
|
+
* - Else (non-editor bare module): return `spec` unchanged (external).
|
|
91736
|
+
*
|
|
91737
|
+
* @param spec - Import specifier string.
|
|
91738
|
+
* @param fromId - Optional base logical id used for relative resolution.
|
|
91739
|
+
* @returns A normalized logical id or an external specifier string.
|
|
91740
|
+
* @throws If a relative import is provided without `fromId`.
|
|
91744
91741
|
*/ async resolveLogicalId(spec, fromId) {
|
|
91745
91742
|
const { path: baseSpec, suffix } = splitSpecifierQuery(spec);
|
|
91746
91743
|
if (baseSpec.startsWith('#/')) {
|
|
@@ -91754,7 +91751,7 @@ async function __z3dLoad(spec, parentId = '') {
|
|
|
91754
91751
|
} else if (baseSpec.startsWith('/')) {
|
|
91755
91752
|
return `${baseSpec.replace(/^\/+/, '/')}${suffix}`;
|
|
91756
91753
|
} else if (getApp().editorMode !== 'none') {
|
|
91757
|
-
const libRoot = this._vfs.normalizePath(this._scriptsRoot || '/');
|
|
91754
|
+
const libRoot = '/'; //this._vfs.normalizePath(this._scriptsRoot || '/');
|
|
91758
91755
|
// naked module, checking if it is a installed module in editor mode
|
|
91759
91756
|
let depsLockPath = this._vfs.normalizePath(this._vfs.join(libRoot, 'libs/deps.lock.json'));
|
|
91760
91757
|
let depsExists = await this._vfs.exists(depsLockPath);
|
|
@@ -91770,16 +91767,16 @@ async function __z3dLoad(spec, parentId = '') {
|
|
|
91770
91767
|
}
|
|
91771
91768
|
return spec;
|
|
91772
91769
|
}
|
|
91773
|
-
/**
|
|
91774
|
-
* Resolves a logical id to a concrete source path and type by probing extensions.
|
|
91775
|
-
*
|
|
91776
|
-
* Rules:
|
|
91777
|
-
* - If `logicalId` ends with `.ts` or `.js`/`.mjs` and is a file, return it.
|
|
91778
|
-
* - Else probe `logicalId.ts`, `logicalId.js`, `logicalId.mjs` in that order.
|
|
91779
|
-
* - Maps `.mjs` to type `'js'`.
|
|
91780
|
-
*
|
|
91781
|
-
* @param logicalId - The normalized logical module id (path-like).
|
|
91782
|
-
* @returns `{ type, path }` or `null` if not found.
|
|
91770
|
+
/**
|
|
91771
|
+
* Resolves a logical id to a concrete source path and type by probing extensions.
|
|
91772
|
+
*
|
|
91773
|
+
* Rules:
|
|
91774
|
+
* - If `logicalId` ends with `.ts` or `.js`/`.mjs` and is a file, return it.
|
|
91775
|
+
* - Else probe `logicalId.ts`, `logicalId.js`, `logicalId.mjs` in that order.
|
|
91776
|
+
* - Maps `.mjs` to type `'js'`.
|
|
91777
|
+
*
|
|
91778
|
+
* @param logicalId - The normalized logical module id (path-like).
|
|
91779
|
+
* @returns `{ type, path }` or `null` if not found.
|
|
91783
91780
|
*/ async resolveSourcePath(logicalId) {
|
|
91784
91781
|
const { path: normalizedLogicalId } = splitSpecifierQuery(logicalId);
|
|
91785
91782
|
let type = null;
|
|
@@ -92476,22 +92473,22 @@ const DEFAULT_PADDING = 6;
|
|
|
92476
92473
|
}
|
|
92477
92474
|
}
|
|
92478
92475
|
|
|
92479
|
-
/**
|
|
92480
|
-
* Core engine class managing scripting, serialization, and rendering.
|
|
92481
|
-
*
|
|
92482
|
-
* Responsibilities:
|
|
92483
|
-
* - Manages a {@link ScriptingSystem} for dynamic script attachment and lifecycle.
|
|
92484
|
-
* - Manages a {@link ResourceManager} for loading scenes and assets.
|
|
92485
|
-
* - Maintains a list of active renderable objects to be rendered each frame.
|
|
92486
|
-
* - Provides methods to attach/detach scripts, update scripts, load scenes, and read files.
|
|
92487
|
-
* - Supports enabling/disabling of runtime operations.
|
|
92488
|
-
*
|
|
92489
|
-
* @remarks
|
|
92490
|
-
* The engine can be configured with a virtual file system (VFS) and script root path.
|
|
92491
|
-
* It exposes methods to manage scripts on host objects, update scripts each frame,
|
|
92492
|
-
* load scenes from files, and render active objects.
|
|
92493
|
-
*
|
|
92494
|
-
* @public
|
|
92476
|
+
/**
|
|
92477
|
+
* Core engine class managing scripting, serialization, and rendering.
|
|
92478
|
+
*
|
|
92479
|
+
* Responsibilities:
|
|
92480
|
+
* - Manages a {@link ScriptingSystem} for dynamic script attachment and lifecycle.
|
|
92481
|
+
* - Manages a {@link ResourceManager} for loading scenes and assets.
|
|
92482
|
+
* - Maintains a list of active renderable objects to be rendered each frame.
|
|
92483
|
+
* - Provides methods to attach/detach scripts, update scripts, load scenes, and read files.
|
|
92484
|
+
* - Supports enabling/disabling of runtime operations.
|
|
92485
|
+
*
|
|
92486
|
+
* @remarks
|
|
92487
|
+
* The engine can be configured with a virtual file system (VFS) and script root path.
|
|
92488
|
+
* It exposes methods to manage scripts on host objects, update scripts each frame,
|
|
92489
|
+
* load scenes from files, and render active objects.
|
|
92490
|
+
*
|
|
92491
|
+
* @public
|
|
92495
92492
|
*/ class Engine {
|
|
92496
92493
|
_builtinsVFS;
|
|
92497
92494
|
_scriptingSystem;
|
|
@@ -92501,12 +92498,12 @@ const DEFAULT_PADDING = 6;
|
|
|
92501
92498
|
_screen;
|
|
92502
92499
|
_activeRenderables;
|
|
92503
92500
|
_loadingScenes;
|
|
92504
|
-
/**
|
|
92505
|
-
* Creates a new runtime manager.
|
|
92506
|
-
*
|
|
92507
|
-
* @param VFS - Optional virtual file system passed to the internal {@link ScriptingSystem}.
|
|
92508
|
-
* @param scriptsRoot - Optional scripts root path within the VFS. Defaults as in `ScriptingSystem`.
|
|
92509
|
-
* @param enabled - Whether runtime operations are active. Defaults to `true`.
|
|
92501
|
+
/**
|
|
92502
|
+
* Creates a new runtime manager.
|
|
92503
|
+
*
|
|
92504
|
+
* @param VFS - Optional virtual file system passed to the internal {@link ScriptingSystem}.
|
|
92505
|
+
* @param scriptsRoot - Optional scripts root path within the VFS. Defaults as in `ScriptingSystem`.
|
|
92506
|
+
* @param enabled - Whether runtime operations are active. Defaults to `true`.
|
|
92510
92507
|
*/ constructor(VFS, scriptsRoot, enabled){
|
|
92511
92508
|
VFS = VFS ?? new HttpFS('./');
|
|
92512
92509
|
this._builtinsVFS = null;
|
|
@@ -92521,13 +92518,13 @@ const DEFAULT_PADDING = 6;
|
|
|
92521
92518
|
this._loadingScenes = {};
|
|
92522
92519
|
this._screen = new ScreenAdapter();
|
|
92523
92520
|
}
|
|
92524
|
-
/**
|
|
92525
|
-
* Exposes the instance of {@link ScriptingSystem}.
|
|
92521
|
+
/**
|
|
92522
|
+
* Exposes the instance of {@link ScriptingSystem}.
|
|
92526
92523
|
*/ get scriptingSystem() {
|
|
92527
92524
|
return this._scriptingSystem;
|
|
92528
92525
|
}
|
|
92529
|
-
/**
|
|
92530
|
-
* Exposes the virtual file system used by the underlying {@link ScriptingSystem}'s registry.
|
|
92526
|
+
/**
|
|
92527
|
+
* Exposes the virtual file system used by the underlying {@link ScriptingSystem}'s registry.
|
|
92531
92528
|
*/ get VFS() {
|
|
92532
92529
|
return this._scriptingSystem.registry.VFS;
|
|
92533
92530
|
}
|
|
@@ -92539,24 +92536,24 @@ const DEFAULT_PADDING = 6;
|
|
|
92539
92536
|
this.ensureBuiltinVFS();
|
|
92540
92537
|
}
|
|
92541
92538
|
}
|
|
92542
|
-
/**
|
|
92543
|
-
* Exposes the instance of {@link ResourceManager}.
|
|
92539
|
+
/**
|
|
92540
|
+
* Exposes the instance of {@link ResourceManager}.
|
|
92544
92541
|
*/ get resourceManager() {
|
|
92545
92542
|
return this._resourceManager;
|
|
92546
92543
|
}
|
|
92547
|
-
/**
|
|
92548
|
-
* Exposes the shared runtime MSDF text atlas manager.
|
|
92544
|
+
/**
|
|
92545
|
+
* Exposes the shared runtime MSDF text atlas manager.
|
|
92549
92546
|
*/ get msdfTextAtlasManager() {
|
|
92550
92547
|
return this._msdfTextAtlasManager;
|
|
92551
92548
|
}
|
|
92552
|
-
/**
|
|
92553
|
-
* Releases a loaded font asset from the resource cache and disposes its shared MSDF atlas textures.
|
|
92554
|
-
*
|
|
92555
|
-
* Existing scene nodes that still reference this font asset are not updated automatically.
|
|
92556
|
-
* Call this only after you have stopped using the font, or when you intentionally want it to rebuild later.
|
|
92557
|
-
*
|
|
92558
|
-
* @param font - The loaded font asset path to release.
|
|
92559
|
-
* @returns `true` if either the atlas cache or the font cache had an entry to remove.
|
|
92549
|
+
/**
|
|
92550
|
+
* Releases a loaded font asset from the resource cache and disposes its shared MSDF atlas textures.
|
|
92551
|
+
*
|
|
92552
|
+
* Existing scene nodes that still reference this font asset are not updated automatically.
|
|
92553
|
+
* Call this only after you have stopped using the font, or when you intentionally want it to rebuild later.
|
|
92554
|
+
*
|
|
92555
|
+
* @param font - The loaded font asset path to release.
|
|
92556
|
+
* @returns `true` if either the atlas cache or the font cache had an entry to remove.
|
|
92560
92557
|
*/ releaseFontAsset(font) {
|
|
92561
92558
|
const fontAsset = this._resourceManager.getFontAsset(font);
|
|
92562
92559
|
if (!fontAsset) {
|
|
@@ -92566,21 +92563,21 @@ const DEFAULT_PADDING = 6;
|
|
|
92566
92563
|
const fontReleased = this._resourceManager.releaseFontAsset(fontAsset);
|
|
92567
92564
|
return atlasReleased || fontReleased;
|
|
92568
92565
|
}
|
|
92569
|
-
/**
|
|
92570
|
-
* Configures the MSDF atlas for a given font asset, creating or replacing the atlas as needed.
|
|
92571
|
-
*
|
|
92572
|
-
* This is useful to customize the glyph size, atlas page size, distance range, and padding for MSDF text rendering.
|
|
92573
|
-
* Existing scene nodes that reference this font asset will use the updated atlas automatically.
|
|
92574
|
-
*
|
|
92575
|
-
* @param font - The font asset path to configure the MSDF atlas for.
|
|
92576
|
-
* @param pageSize - The size of each atlas page in pixels (e.g., 512, 1024).
|
|
92577
|
-
* @param glyphSize - The size of each glyph in pixels (e.g., 32, 64).
|
|
92578
|
-
* @param distanceRange - The distance range for MSDF generation. Defaults to 4.
|
|
92579
|
-
* @param padding - The padding between glyphs in the atlas in pixels. Defaults to 2.
|
|
92580
|
-
* @returns `true` if the atlas was successfully configured, or `false` if the font asset was not found.
|
|
92581
|
-
*
|
|
92582
|
-
* @remarks
|
|
92583
|
-
* The font asset must be loaded and available in the resource manager for the atlas to be configured.
|
|
92566
|
+
/**
|
|
92567
|
+
* Configures the MSDF atlas for a given font asset, creating or replacing the atlas as needed.
|
|
92568
|
+
*
|
|
92569
|
+
* This is useful to customize the glyph size, atlas page size, distance range, and padding for MSDF text rendering.
|
|
92570
|
+
* Existing scene nodes that reference this font asset will use the updated atlas automatically.
|
|
92571
|
+
*
|
|
92572
|
+
* @param font - The font asset path to configure the MSDF atlas for.
|
|
92573
|
+
* @param pageSize - The size of each atlas page in pixels (e.g., 512, 1024).
|
|
92574
|
+
* @param glyphSize - The size of each glyph in pixels (e.g., 32, 64).
|
|
92575
|
+
* @param distanceRange - The distance range for MSDF generation. Defaults to 4.
|
|
92576
|
+
* @param padding - The padding between glyphs in the atlas in pixels. Defaults to 2.
|
|
92577
|
+
* @returns `true` if the atlas was successfully configured, or `false` if the font asset was not found.
|
|
92578
|
+
*
|
|
92579
|
+
* @remarks
|
|
92580
|
+
* The font asset must be loaded and available in the resource manager for the atlas to be configured.
|
|
92584
92581
|
*/ configureMSDFAtlas(font, pageSize, glyphSize, distanceRange, padding) {
|
|
92585
92582
|
const fontAsset = this._resourceManager.getFontAsset(font);
|
|
92586
92583
|
if (!fontAsset) {
|
|
@@ -92590,85 +92587,85 @@ const DEFAULT_PADDING = 6;
|
|
|
92590
92587
|
this._msdfTextAtlasManager.configureAtlas(fontAsset, pageSize, glyphSize, distanceRange, padding);
|
|
92591
92588
|
return true;
|
|
92592
92589
|
}
|
|
92593
|
-
/**
|
|
92594
|
-
* Exposes the active {@link ScreenAdapter}.
|
|
92590
|
+
/**
|
|
92591
|
+
* Exposes the active {@link ScreenAdapter}.
|
|
92595
92592
|
*/ get screen() {
|
|
92596
92593
|
return this._screen;
|
|
92597
92594
|
}
|
|
92598
92595
|
/** @internal */ async init() {
|
|
92599
92596
|
await this.ensureBuiltinVFS();
|
|
92600
92597
|
}
|
|
92601
|
-
/**
|
|
92602
|
-
* Detaches all scripts from all hosts, if enabled.
|
|
92603
|
-
*
|
|
92604
|
-
* No-op when `enabled === false`.
|
|
92598
|
+
/**
|
|
92599
|
+
* Detaches all scripts from all hosts, if enabled.
|
|
92600
|
+
*
|
|
92601
|
+
* No-op when `enabled === false`.
|
|
92605
92602
|
*/ detachAllScripts() {
|
|
92606
92603
|
if (this._enabled) {
|
|
92607
92604
|
this._scriptingSystem.detachAllScripts();
|
|
92608
92605
|
}
|
|
92609
92606
|
}
|
|
92610
|
-
/**
|
|
92611
|
-
* Loads a runtime script class from file
|
|
92612
|
-
* @param module - file path
|
|
92613
|
-
* @returns The runtime script class or null
|
|
92607
|
+
/**
|
|
92608
|
+
* Loads a runtime script class from file
|
|
92609
|
+
* @param module - file path
|
|
92610
|
+
* @returns The runtime script class or null
|
|
92614
92611
|
*/ async loadRuntimeScriptClass(module) {
|
|
92615
92612
|
return await this._scriptingSystem.loadRuntimeScriptClass(module);
|
|
92616
92613
|
}
|
|
92617
|
-
/**
|
|
92618
|
-
* Attaches a script module to the given host, if enabled.
|
|
92619
|
-
*
|
|
92620
|
-
* When disabled, this method resolves to `null` without side effects.
|
|
92621
|
-
*
|
|
92622
|
-
* @typeParam T - Host type.
|
|
92623
|
-
* @param host - Host object to attach the script to.
|
|
92624
|
-
* @param module - Module identifier to resolve and load.
|
|
92625
|
-
* @param config - Optional configuration passed to the script instance.
|
|
92626
|
-
* @returns The `RuntimeScript<T>` instance, or `null` if disabled or on failure.
|
|
92614
|
+
/**
|
|
92615
|
+
* Attaches a script module to the given host, if enabled.
|
|
92616
|
+
*
|
|
92617
|
+
* When disabled, this method resolves to `null` without side effects.
|
|
92618
|
+
*
|
|
92619
|
+
* @typeParam T - Host type.
|
|
92620
|
+
* @param host - Host object to attach the script to.
|
|
92621
|
+
* @param module - Module identifier to resolve and load.
|
|
92622
|
+
* @param config - Optional configuration passed to the script instance.
|
|
92623
|
+
* @returns The `RuntimeScript<T>` instance, or `null` if disabled or on failure.
|
|
92627
92624
|
*/ async attachScript(host, module, config) {
|
|
92628
92625
|
return this._enabled ? await this._scriptingSystem.attachScript(host, module, config) : null;
|
|
92629
92626
|
}
|
|
92630
|
-
/**
|
|
92631
|
-
* Detaches a script from a host, by module ID or instance, if enabled.
|
|
92632
|
-
*
|
|
92633
|
-
* No-op when disabled.
|
|
92634
|
-
*
|
|
92635
|
-
* @typeParam T - Host type.
|
|
92636
|
-
* @param host - Host to detach from.
|
|
92637
|
-
* @param idOrInstance - Target script by module ID or instance reference.
|
|
92627
|
+
/**
|
|
92628
|
+
* Detaches a script from a host, by module ID or instance, if enabled.
|
|
92629
|
+
*
|
|
92630
|
+
* No-op when disabled.
|
|
92631
|
+
*
|
|
92632
|
+
* @typeParam T - Host type.
|
|
92633
|
+
* @param host - Host to detach from.
|
|
92634
|
+
* @param idOrInstance - Target script by module ID or instance reference.
|
|
92638
92635
|
*/ detachScript(host, idOrInstance) {
|
|
92639
92636
|
if (this._enabled) {
|
|
92640
92637
|
this._scriptingSystem.detachScript(host, idOrInstance);
|
|
92641
92638
|
}
|
|
92642
92639
|
}
|
|
92643
|
-
/**
|
|
92644
|
-
* Gets all scripts attached to a host.
|
|
92645
|
-
*
|
|
92646
|
-
* Delegates to {@link ScriptingSystem.getScriptObjects}.
|
|
92647
|
-
*
|
|
92648
|
-
* @typeParam T - Expected script type.
|
|
92649
|
-
* @param host - Host object to query.
|
|
92650
|
-
* @returns Script instances attached to the host, or an empty array.
|
|
92640
|
+
/**
|
|
92641
|
+
* Gets all scripts attached to a host.
|
|
92642
|
+
*
|
|
92643
|
+
* Delegates to {@link ScriptingSystem.getScriptObjects}.
|
|
92644
|
+
*
|
|
92645
|
+
* @typeParam T - Expected script type.
|
|
92646
|
+
* @param host - Host object to query.
|
|
92647
|
+
* @returns Script instances attached to the host, or an empty array.
|
|
92651
92648
|
*/ getScriptObjects(host) {
|
|
92652
92649
|
return this._scriptingSystem.getScriptObjects(host);
|
|
92653
92650
|
}
|
|
92654
|
-
/**
|
|
92655
|
-
* Ticks all attached scripts by calling their `onUpdate` hooks, if enabled.
|
|
92656
|
-
*
|
|
92657
|
-
* @param deltaTime - Time since last update in Seconds.
|
|
92658
|
-
* @param elapsedTime - Total elapsed time in Seconds.
|
|
92651
|
+
/**
|
|
92652
|
+
* Ticks all attached scripts by calling their `onUpdate` hooks, if enabled.
|
|
92653
|
+
*
|
|
92654
|
+
* @param deltaTime - Time since last update in Seconds.
|
|
92655
|
+
* @param elapsedTime - Total elapsed time in Seconds.
|
|
92659
92656
|
*/ update(deltaTime, elapsedTime) {
|
|
92660
92657
|
if (this._enabled) {
|
|
92661
92658
|
this._scriptingSystem.update(deltaTime, elapsedTime);
|
|
92662
92659
|
}
|
|
92663
92660
|
}
|
|
92664
|
-
/**
|
|
92665
|
-
* Loads a scene from a file path.
|
|
92666
|
-
*
|
|
92667
|
-
* Concurrent requests for the same normalized path share the same loading promise.
|
|
92668
|
-
* Scripts declared on the scene and its nodes are attached after the scene is loaded.
|
|
92669
|
-
*
|
|
92670
|
-
* @param path - Scene file path in the current VFS.
|
|
92671
|
-
* @returns The loaded scene, or `null` when loading fails.
|
|
92661
|
+
/**
|
|
92662
|
+
* Loads a scene from a file path.
|
|
92663
|
+
*
|
|
92664
|
+
* Concurrent requests for the same normalized path share the same loading promise.
|
|
92665
|
+
* Scripts declared on the scene and its nodes are attached after the scene is loaded.
|
|
92666
|
+
*
|
|
92667
|
+
* @param path - Scene file path in the current VFS.
|
|
92668
|
+
* @returns The loaded scene, or `null` when loading fails.
|
|
92672
92669
|
*/ async loadSceneFromFile(path) {
|
|
92673
92670
|
path = this.VFS.normalizePath(path);
|
|
92674
92671
|
if (!this._loadingScenes[path]) {
|
|
@@ -92676,15 +92673,15 @@ const DEFAULT_PADDING = 6;
|
|
|
92676
92673
|
}
|
|
92677
92674
|
return this._loadingScenes[path];
|
|
92678
92675
|
}
|
|
92679
|
-
/**
|
|
92680
|
-
* Sets or clears the renderable for a render layer.
|
|
92681
|
-
*
|
|
92682
|
-
* Passing `null` clears the layer. Object renderables are held through a strong reference wrapper,
|
|
92683
|
-
* while render functions are stored directly.
|
|
92684
|
-
*
|
|
92685
|
-
* @param renderable - Renderable object or render function to assign, or `null` to clear.
|
|
92686
|
-
* @param layer - Render layer index. Defaults to `0`.
|
|
92687
|
-
* @param hook - Optional render hook invoked before and after this layer renders.
|
|
92676
|
+
/**
|
|
92677
|
+
* Sets or clears the renderable for a render layer.
|
|
92678
|
+
*
|
|
92679
|
+
* Passing `null` clears the layer. Object renderables are held through a strong reference wrapper,
|
|
92680
|
+
* while render functions are stored directly.
|
|
92681
|
+
*
|
|
92682
|
+
* @param renderable - Renderable object or render function to assign, or `null` to clear.
|
|
92683
|
+
* @param layer - Render layer index. Defaults to `0`.
|
|
92684
|
+
* @param hook - Optional render hook invoked before and after this layer renders.
|
|
92688
92685
|
*/ setRenderable(renderable, layer = 0, hook) {
|
|
92689
92686
|
const entry = this._activeRenderables[layer];
|
|
92690
92687
|
if (!entry) {
|
|
@@ -92707,13 +92704,13 @@ const DEFAULT_PADDING = 6;
|
|
|
92707
92704
|
entry.hook = hook ?? null;
|
|
92708
92705
|
}
|
|
92709
92706
|
}
|
|
92710
|
-
/**
|
|
92711
|
-
* Reads a file from the current VFS.
|
|
92712
|
-
*
|
|
92713
|
-
* @typeParam T - Requested read encoding.
|
|
92714
|
-
* @param path - File path to read.
|
|
92715
|
-
* @param encoding - Optional read encoding. Defaults to `binary`.
|
|
92716
|
-
* @returns The file content, or `null` when the read fails.
|
|
92707
|
+
/**
|
|
92708
|
+
* Reads a file from the current VFS.
|
|
92709
|
+
*
|
|
92710
|
+
* @typeParam T - Requested read encoding.
|
|
92711
|
+
* @param path - File path to read.
|
|
92712
|
+
* @param encoding - Optional read encoding. Defaults to `binary`.
|
|
92713
|
+
* @returns The file content, or `null` when the read fails.
|
|
92717
92714
|
*/ async readFile(path, encoding) {
|
|
92718
92715
|
try {
|
|
92719
92716
|
const content = await this.VFS.readFile(path, {
|
|
@@ -92725,14 +92722,14 @@ const DEFAULT_PADDING = 6;
|
|
|
92725
92722
|
return null;
|
|
92726
92723
|
}
|
|
92727
92724
|
}
|
|
92728
|
-
/**
|
|
92729
|
-
* Starts the runtime by optionally showing a splash screen, running a startup script,
|
|
92730
|
-
* and loading the startup scene.
|
|
92731
|
-
*
|
|
92732
|
-
* @param startupScene - Optional scene path rendered on layer `0` after startup completes.
|
|
92733
|
-
* @param splashScreen - Optional scene path rendered on a temporary splash layer during startup.
|
|
92734
|
-
* @param startupScript - Optional startup script module path. A trailing `.ts` or `.js`
|
|
92735
|
-
* extension is removed before loading.
|
|
92725
|
+
/**
|
|
92726
|
+
* Starts the runtime by optionally showing a splash screen, running a startup script,
|
|
92727
|
+
* and loading the startup scene.
|
|
92728
|
+
*
|
|
92729
|
+
* @param startupScene - Optional scene path rendered on layer `0` after startup completes.
|
|
92730
|
+
* @param splashScreen - Optional scene path rendered on a temporary splash layer during startup.
|
|
92731
|
+
* @param startupScript - Optional startup script module path. A trailing `.ts` or `.js`
|
|
92732
|
+
* extension is removed before loading.
|
|
92736
92733
|
*/ async startup(startupScene, splashScreen, startupScript) {
|
|
92737
92734
|
const splashScreenLayer = 9999;
|
|
92738
92735
|
if (splashScreen) {
|
|
@@ -92751,11 +92748,11 @@ const DEFAULT_PADDING = 6;
|
|
|
92751
92748
|
}
|
|
92752
92749
|
this.setRenderable(null, splashScreenLayer);
|
|
92753
92750
|
}
|
|
92754
|
-
/**
|
|
92755
|
-
* Renders all active render layers.
|
|
92756
|
-
*
|
|
92757
|
-
* Each layer's `beforeRender` hook can return `false` to skip rendering that layer.
|
|
92758
|
-
* The `afterRender` hook is invoked after the render attempt.
|
|
92751
|
+
/**
|
|
92752
|
+
* Renders all active render layers.
|
|
92753
|
+
*
|
|
92754
|
+
* Each layer's `beforeRender` hook can return `false` to skip rendering that layer.
|
|
92755
|
+
* The `afterRender` hook is invoked after the render attempt.
|
|
92759
92756
|
*/ render() {
|
|
92760
92757
|
this._activeRenderables.forEach((info)=>{
|
|
92761
92758
|
if (!info.renderable) {
|