u-space 0.0.30 → 0.0.32
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/getTransferables-C97JPUVf.cjs +1 -0
- package/dist/getTransferables-DrzSmiCR.js +43 -0
- package/dist/index.cjs +3 -3
- package/dist/index.js +1549 -1026
- package/dist/modelDecodeProtocol-D1Apm9iG.cjs +1 -0
- package/dist/modelDecodeProtocol-wDB7ksYw.js +56 -0
- package/dist/plugins/u-manager/index.cjs +1 -1
- package/dist/plugins/u-manager/index.js +73 -53
- package/dist/src/loaders/ModelDecodeWorkerClient.d.ts +31 -0
- package/dist/src/loaders/ModelLoaderManager.d.ts +15 -2
- package/dist/src/loaders/buildDecodedGltfModel.d.ts +4 -0
- package/dist/src/loaders/index.d.ts +1 -0
- package/dist/src/objects/Model.d.ts +1 -0
- package/dist/src/worker/decodeGltfModel.d.ts +10 -0
- package/dist/src/worker/getTransferables.d.ts +1 -0
- package/dist/src/worker/index.d.ts +1 -0
- package/dist/src/worker/installWorkerImageLoader.d.ts +3 -0
- package/dist/src/worker/model-decoder.d.ts +13 -0
- package/dist/src/worker/modelDecodeProtocol.d.ts +205 -0
- package/dist/src/worker/workerImageUtils.d.ts +8 -0
- package/dist/worker/index.cjs +1 -1
- package/dist/worker/index.js +8 -6
- package/dist/worker/model-decoder.cjs +1 -0
- package/dist/worker/model-decoder.js +339 -0
- package/dist/worker/runtime.cjs +1 -1
- package/dist/worker/runtime.js +202 -208
- package/dist/workerImageUtils-lmOMyTQN.cjs +1 -0
- package/dist/workerImageUtils-mQD3TQ1N.js +105 -0
- package/docs/api-effects.md +66 -2
- package/docs/api-viewer.md +45 -1
- package/docs/changelog.md +26 -0
- package/docs/examples-guide.md +31 -11
- package/docs/getting-started.md +97 -93
- package/docs/index.md +2 -2
- package/docs/mcp.md +16 -3
- package/docs/release.md +5 -3
- package/package.json +9 -1
|
@@ -20670,7 +20670,7 @@ class Watermarker extends Scene {
|
|
|
20670
20670
|
return this.mesh.material.map ? Promise.resolve(this.mesh.material.map) : (this.#r ??= TextureLoaderManager.loadAsyncTexture(logo).then((e) => (e.colorSpace = SRGBColorSpace, e)), this.#r);
|
|
20671
20671
|
}
|
|
20672
20672
|
}
|
|
20673
|
-
const _m4 = new Matrix4(), SEMANTIC_ID_KEYS = [
|
|
20673
|
+
const _m4 = new Matrix4(), MAX_CONCURRENT_MODEL_LOADS = 1, SEMANTIC_ID_KEYS = [
|
|
20674
20674
|
"Buildings",
|
|
20675
20675
|
"Stories",
|
|
20676
20676
|
"Walls",
|
|
@@ -20743,7 +20743,7 @@ class SceneParser {
|
|
|
20743
20743
|
}
|
|
20744
20744
|
await Promise.all(t.children.map((o) => l(o, u ?? h)));
|
|
20745
20745
|
};
|
|
20746
|
-
return await Promise.all(e.map((t) => l(t, a))), await this.#
|
|
20746
|
+
return await Promise.all(e.map((t) => l(t, a))), await this.#n(a), a;
|
|
20747
20747
|
}
|
|
20748
20748
|
#r(e) {
|
|
20749
20749
|
const n = new BaseGroup();
|
|
@@ -20790,7 +20790,7 @@ class SceneParser {
|
|
|
20790
20790
|
instances: []
|
|
20791
20791
|
}, this.#e.set(e, n)), n;
|
|
20792
20792
|
}
|
|
20793
|
-
async #
|
|
20793
|
+
async #n(e) {
|
|
20794
20794
|
if (this.#e.size === 0) return;
|
|
20795
20795
|
if (this.editableBatchOptions) {
|
|
20796
20796
|
const a = new SceneEditableBatchLayer(this.editableBatchOptions);
|
|
@@ -20852,9 +20852,11 @@ class SceneLoader extends Loader {
|
|
|
20852
20852
|
editableBatchOptions = null;
|
|
20853
20853
|
_resourceData = null;
|
|
20854
20854
|
_treeData = [];
|
|
20855
|
-
#e;
|
|
20855
|
+
#e = 0;
|
|
20856
|
+
#r = [];
|
|
20857
|
+
#t;
|
|
20856
20858
|
constructor(e) {
|
|
20857
|
-
super(), this.viewer = e, this.#
|
|
20859
|
+
super(), this.viewer = e, this.#t = new Watermarker(e), this.manager = new LoadingManager();
|
|
20858
20860
|
}
|
|
20859
20861
|
setKey(e) {
|
|
20860
20862
|
return this.key = e, this;
|
|
@@ -20867,19 +20869,37 @@ class SceneLoader extends Loader {
|
|
|
20867
20869
|
setEditableBatching(e = !0) {
|
|
20868
20870
|
return this.editableBatchOptions = e === !1 ? null : e === !0 ? {} : e, this;
|
|
20869
20871
|
}
|
|
20872
|
+
async #n() {
|
|
20873
|
+
if (this.#e < MAX_CONCURRENT_MODEL_LOADS) {
|
|
20874
|
+
this.#e++;
|
|
20875
|
+
return;
|
|
20876
|
+
}
|
|
20877
|
+
await new Promise((e) => {
|
|
20878
|
+
this.#r.push(e);
|
|
20879
|
+
});
|
|
20880
|
+
}
|
|
20881
|
+
#i() {
|
|
20882
|
+
const e = this.#r.shift();
|
|
20883
|
+
e ? e() : this.#e--;
|
|
20884
|
+
}
|
|
20870
20885
|
async loadModel(e) {
|
|
20871
|
-
|
|
20872
|
-
this.manager.itemStart(e);
|
|
20886
|
+
await this.#n();
|
|
20873
20887
|
try {
|
|
20874
|
-
|
|
20875
|
-
|
|
20876
|
-
|
|
20877
|
-
|
|
20878
|
-
|
|
20888
|
+
const n = new Model();
|
|
20889
|
+
this.manager.itemStart(e);
|
|
20890
|
+
try {
|
|
20891
|
+
await n.loadAsync({
|
|
20892
|
+
url: e
|
|
20893
|
+
});
|
|
20894
|
+
} catch (a) {
|
|
20895
|
+
throw this.manager.itemError(e), a;
|
|
20896
|
+
} finally {
|
|
20897
|
+
this.manager.itemEnd(e);
|
|
20898
|
+
}
|
|
20899
|
+
return n;
|
|
20879
20900
|
} finally {
|
|
20880
|
-
this
|
|
20901
|
+
this.#i();
|
|
20881
20902
|
}
|
|
20882
|
-
return n;
|
|
20883
20903
|
}
|
|
20884
20904
|
async _preareTreeData() {
|
|
20885
20905
|
if (!this.path)
|
|
@@ -20894,7 +20914,7 @@ class SceneLoader extends Loader {
|
|
|
20894
20914
|
if (this._resourceData = a, l)
|
|
20895
20915
|
if (n.encryptWith === "DEBUG")
|
|
20896
20916
|
try {
|
|
20897
|
-
this._treeData = decryptWithDebugKey(a), this.#
|
|
20917
|
+
this._treeData = decryptWithDebugKey(a), this.#t.enable();
|
|
20898
20918
|
} catch {
|
|
20899
20919
|
throw new Error("u-space SceneLoader: decrypt with debug key failed");
|
|
20900
20920
|
}
|
|
@@ -20948,7 +20968,7 @@ class SceneLoader extends Loader {
|
|
|
20948
20968
|
}), this.cachedIds.clear();
|
|
20949
20969
|
}
|
|
20950
20970
|
dispose() {
|
|
20951
|
-
this.clearCache(), this.#
|
|
20971
|
+
this.clearCache(), this.#t.dispose();
|
|
20952
20972
|
}
|
|
20953
20973
|
}
|
|
20954
20974
|
class VerticalShaftMeshError extends Error {
|
|
@@ -21183,12 +21203,12 @@ class FloorSemanticInstanceObject extends InstanceObject {
|
|
|
21183
21203
|
return this.#t = !0, super.setInstanceHighlight(e, l, a), this.floorMesh.setColorAt(this.semanticIndex, new Color(e)), this.floorMesh.setOpacityAt(this.semanticIndex, l), this;
|
|
21184
21204
|
}
|
|
21185
21205
|
clearInstanceHighlight() {
|
|
21186
|
-
return this.#t ? (this.#t = !1, super.clearInstanceHighlight(), this.#
|
|
21206
|
+
return this.#t ? (this.#t = !1, super.clearInstanceHighlight(), this.#n(), this) : this;
|
|
21187
21207
|
}
|
|
21188
21208
|
getInstanceBoundingBox(e = new Box3(), n = !1) {
|
|
21189
21209
|
return this.floorMesh.getBoundingBoxAt(this.semanticIndex, e, n) ?? e.makeEmpty();
|
|
21190
21210
|
}
|
|
21191
|
-
#
|
|
21211
|
+
#n() {
|
|
21192
21212
|
this.#e ? this.floorMesh.setColorAt(this.semanticIndex, this.#e) : this.floorMesh.resetColorAt(this.semanticIndex), this.floorMesh.setOpacityAt(this.semanticIndex, this.#r);
|
|
21193
21213
|
}
|
|
21194
21214
|
}
|
|
@@ -21215,7 +21235,7 @@ class FloorMesh extends BaseMesh {
|
|
|
21215
21235
|
#e;
|
|
21216
21236
|
#r;
|
|
21217
21237
|
#t = [];
|
|
21218
|
-
#
|
|
21238
|
+
#n;
|
|
21219
21239
|
#i;
|
|
21220
21240
|
#o;
|
|
21221
21241
|
#s;
|
|
@@ -21232,7 +21252,7 @@ class FloorMesh extends BaseMesh {
|
|
|
21232
21252
|
Doors: this.doorsInstances,
|
|
21233
21253
|
Windows: this.windowsInstances,
|
|
21234
21254
|
Staircases: this.staircasesInstances
|
|
21235
|
-
}, this.#
|
|
21255
|
+
}, this.#n = h, this.#i = u, this.#o = o, this.#s = s, this.#u = new Mesh(), this.#u.matrixAutoUpdate = !1, this.frustumCulled = !1, this.#r.forEach((c) => {
|
|
21236
21256
|
const d = new FloorSemanticInstanceObject(this, c.index);
|
|
21237
21257
|
d.name = c.name || c.id, d.visible = c.visible, d.setInstanceIdentity({
|
|
21238
21258
|
id: c.id,
|
|
@@ -21276,13 +21296,13 @@ class FloorMesh extends BaseMesh {
|
|
|
21276
21296
|
return this.getSemantics().filter((n) => n.kind === e);
|
|
21277
21297
|
}
|
|
21278
21298
|
getSemanticIdAt(e) {
|
|
21279
|
-
return this.#
|
|
21299
|
+
return this.#a(e).id;
|
|
21280
21300
|
}
|
|
21281
21301
|
getSemanticKindAt(e) {
|
|
21282
|
-
return this.#
|
|
21302
|
+
return this.#a(e).kind;
|
|
21283
21303
|
}
|
|
21284
21304
|
getSemanticNameAt(e) {
|
|
21285
|
-
return this.#
|
|
21305
|
+
return this.#a(e).name;
|
|
21286
21306
|
}
|
|
21287
21307
|
getSemanticObjectAt(e) {
|
|
21288
21308
|
return this.#t[e];
|
|
@@ -21337,33 +21357,33 @@ class FloorMesh extends BaseMesh {
|
|
|
21337
21357
|
return typeof e == "string" ? this.getFacilityById(e) : e;
|
|
21338
21358
|
}
|
|
21339
21359
|
setColorAt(e, n) {
|
|
21340
|
-
const a = this.#
|
|
21360
|
+
const a = this.#a(e);
|
|
21341
21361
|
return copySemanticColor(n, a.color), this.#d(e), this.#l(), this;
|
|
21342
21362
|
}
|
|
21343
21363
|
resetColorAt(e) {
|
|
21344
|
-
const n = this.#
|
|
21364
|
+
const n = this.#a(e), a = n.color.w;
|
|
21345
21365
|
return n.color.copy(n.initialColor), n.color.w = a, this.#d(e), this.#l(), this;
|
|
21346
21366
|
}
|
|
21347
21367
|
getColorAt(e, n = new Vector4()) {
|
|
21348
|
-
const a = this.#
|
|
21368
|
+
const a = this.#a(e).color;
|
|
21349
21369
|
return n.copy(a), n;
|
|
21350
21370
|
}
|
|
21351
21371
|
setOpacityAt(e, n) {
|
|
21352
|
-
const a = this.#
|
|
21372
|
+
const a = this.#a(e);
|
|
21353
21373
|
return a.color.w = Math.max(0, Math.min(1, n)), this.#d(e), this.#l(), this;
|
|
21354
21374
|
}
|
|
21355
21375
|
getOpacityAt(e) {
|
|
21356
|
-
return this.#
|
|
21376
|
+
return this.#a(e).color.w;
|
|
21357
21377
|
}
|
|
21358
21378
|
setVisibleAt(e, n) {
|
|
21359
|
-
const a = this.#
|
|
21379
|
+
const a = this.#a(e);
|
|
21360
21380
|
return a.visible = n, this.#g(e), this;
|
|
21361
21381
|
}
|
|
21362
21382
|
getVisibleAt(e) {
|
|
21363
|
-
return this.#
|
|
21383
|
+
return this.#a(e).visible;
|
|
21364
21384
|
}
|
|
21365
21385
|
setMatrixAt(e, n) {
|
|
21366
|
-
const a = this.#
|
|
21386
|
+
const a = this.#a(e);
|
|
21367
21387
|
return a.matrix.copy(n), a.finalMatrix.multiplyMatrices(a.baseMatrix, a.matrix), this.#y(e), this.#p(e), this;
|
|
21368
21388
|
}
|
|
21369
21389
|
setScaleAt(e, n, a, l) {
|
|
@@ -21377,10 +21397,10 @@ class FloorMesh extends BaseMesh {
|
|
|
21377
21397
|
});
|
|
21378
21398
|
}
|
|
21379
21399
|
getMatrixAt(e, n = new Matrix4()) {
|
|
21380
|
-
return n.copy(this.#
|
|
21400
|
+
return n.copy(this.#a(e).matrix), n;
|
|
21381
21401
|
}
|
|
21382
21402
|
getFinalMatrixAt(e, n = new Matrix4()) {
|
|
21383
|
-
return n.copy(this.#
|
|
21403
|
+
return n.copy(this.#a(e).finalMatrix), n;
|
|
21384
21404
|
}
|
|
21385
21405
|
computeBoundingBox() {
|
|
21386
21406
|
this.boundingBox === null && (this.boundingBox = new Box3()), this.boundingBox.makeEmpty();
|
|
@@ -21393,11 +21413,11 @@ class FloorMesh extends BaseMesh {
|
|
|
21393
21413
|
this.getBoundingSphereAt(e.index, _boundsSphere, !1) && this.boundingSphere.union(_boundsSphere);
|
|
21394
21414
|
}
|
|
21395
21415
|
getBoundingBoxAt(e, n = new Box3(), a = !0) {
|
|
21396
|
-
const l = this.#
|
|
21416
|
+
const l = this.#a(e);
|
|
21397
21417
|
return l.geometry.boundingBox || l.geometry.computeBoundingBox(), l.geometry.boundingBox ? (n.copy(l.geometry.boundingBox).applyMatrix4(l.finalMatrix), a && (this.updateWorldMatrix(!0, !1), n.applyMatrix4(this.matrixWorld)), n) : null;
|
|
21398
21418
|
}
|
|
21399
21419
|
getBoundingSphereAt(e, n = new Sphere(), a = !0) {
|
|
21400
|
-
const l = this.#
|
|
21420
|
+
const l = this.#a(e);
|
|
21401
21421
|
return l.geometry.boundingSphere || l.geometry.computeBoundingSphere(), l.geometry.boundingSphere ? (n.copy(l.geometry.boundingSphere), a ? (this.updateWorldMatrix(!0, !1), _boundsMatrix.multiplyMatrices(this.matrixWorld, l.finalMatrix), n.applyMatrix4(_boundsMatrix)) : n.applyMatrix4(l.finalMatrix), n) : null;
|
|
21402
21422
|
}
|
|
21403
21423
|
raycast(e, n) {
|
|
@@ -21414,7 +21434,7 @@ class FloorMesh extends BaseMesh {
|
|
|
21414
21434
|
}
|
|
21415
21435
|
}
|
|
21416
21436
|
dispose() {
|
|
21417
|
-
this.geometry.dispose(), Array.isArray(this.material) ? this.material.forEach((e) => e.dispose()) : this.material.dispose(), this.#
|
|
21437
|
+
this.geometry.dispose(), Array.isArray(this.material) ? this.material.forEach((e) => e.dispose()) : this.material.dispose(), this.#n.dispose(), this.#i.dispose(), this.#o.dispose(), this.#s.dispose(), this.#r.forEach((e) => e.geometry.dispose());
|
|
21418
21438
|
}
|
|
21419
21439
|
#v(e) {
|
|
21420
21440
|
for (const [n, a] of this.facilityObjectsById)
|
|
@@ -21440,7 +21460,7 @@ class FloorMesh extends BaseMesh {
|
|
|
21440
21460
|
const { facility: n } = e.userData;
|
|
21441
21461
|
return e.instanceName ? e.instanceName : n && typeof n.Name == "string" && n.Name ? n.Name : e.name || void 0;
|
|
21442
21462
|
}
|
|
21443
|
-
#
|
|
21463
|
+
#a(e) {
|
|
21444
21464
|
const n = this.#r[e];
|
|
21445
21465
|
if (!n)
|
|
21446
21466
|
throw new Error(`u-space FloorMesh: invalid semantic index ${e}.`);
|
|
@@ -21483,7 +21503,7 @@ class FloorMesh extends BaseMesh {
|
|
|
21483
21503
|
n(a);
|
|
21484
21504
|
}
|
|
21485
21505
|
#B(e) {
|
|
21486
|
-
const n = this.#
|
|
21506
|
+
const n = this.#a(e), a = this.#f.get(e) ?? n.matrix;
|
|
21487
21507
|
this.#f.has(e) || this.#f.set(e, n.matrix.clone()), a.decompose(_dummyPosition, _dummyQuaternion, _dummyScale), _dummyScale.y *= PLANISH_SCALE_Y, n.matrix.compose(_dummyPosition, _dummyQuaternion, _dummyScale), n.finalMatrix.multiplyMatrices(n.baseMatrix, n.matrix), n.geometry.boundingBox || n.geometry.computeBoundingBox(), n.geometry.boundingBox && (_box.copy(n.geometry.boundingBox).applyMatrix4(n.finalMatrix), _dummyPosition.y += this.pivot.y + getSemanticPlanishOffset(n) - _box.min.y, n.matrix.compose(_dummyPosition, _dummyQuaternion, _dummyScale), n.finalMatrix.multiplyMatrices(n.baseMatrix, n.matrix)), this.#y(e), this.#p(e);
|
|
21488
21508
|
}
|
|
21489
21509
|
#A(e) {
|
|
@@ -21516,21 +21536,21 @@ class FloorMesh extends BaseMesh {
|
|
|
21516
21536
|
}), n.isEmpty() ? null : n;
|
|
21517
21537
|
}
|
|
21518
21538
|
#m(e, n) {
|
|
21519
|
-
const a = this.#
|
|
21539
|
+
const a = this.#a(e);
|
|
21520
21540
|
return a.matrix.decompose(_dummyPosition, _dummyQuaternion, _dummyScale), n(_dummyScale), a.matrix.compose(_dummyPosition, _dummyQuaternion, _dummyScale), a.finalMatrix.multiplyMatrices(a.baseMatrix, a.matrix), this.#y(e), this.#p(e), this;
|
|
21521
21541
|
}
|
|
21522
21542
|
#d(e) {
|
|
21523
|
-
this.#
|
|
21543
|
+
this.#a(e).color.toArray(this.#n.image.data, e * 4), this.#n.needsUpdate = !0;
|
|
21524
21544
|
}
|
|
21525
21545
|
#g(e) {
|
|
21526
|
-
const n = this.#
|
|
21546
|
+
const n = this.#a(e), a = this.#i.image.data;
|
|
21527
21547
|
a[e * 4] = n.visible ? 1 : 0, a[e * 4 + 1] = 0, a[e * 4 + 2] = 0, a[e * 4 + 3] = 1, this.#i.needsUpdate = !0;
|
|
21528
21548
|
}
|
|
21529
21549
|
#p(e) {
|
|
21530
|
-
this.#
|
|
21550
|
+
this.#a(e).finalMatrix.toArray(this.#o.image.data, e * 16), this.#o.needsUpdate = !0;
|
|
21531
21551
|
}
|
|
21532
21552
|
#I(e) {
|
|
21533
|
-
const n = this.#
|
|
21553
|
+
const n = this.#a(e), a = this.#s.image.data;
|
|
21534
21554
|
a[e * 4] = getSemanticRenderOffset(n), a[e * 4 + 1] = 0, a[e * 4 + 2] = 0, a[e * 4 + 3] = 1, this.#s.needsUpdate = !0;
|
|
21535
21555
|
}
|
|
21536
21556
|
}
|
|
@@ -21582,7 +21602,7 @@ class BuildingGroup extends BaseGroup {
|
|
|
21582
21602
|
#e = /* @__PURE__ */ new Set();
|
|
21583
21603
|
#r = /* @__PURE__ */ new Map();
|
|
21584
21604
|
#t = /* @__PURE__ */ new Map();
|
|
21585
|
-
#
|
|
21605
|
+
#n = /* @__PURE__ */ new Map();
|
|
21586
21606
|
#i = /* @__PURE__ */ new Map();
|
|
21587
21607
|
#o = /* @__PURE__ */ new Map();
|
|
21588
21608
|
#s = /* @__PURE__ */ new Map();
|
|
@@ -21624,17 +21644,17 @@ class BuildingGroup extends BaseGroup {
|
|
|
21624
21644
|
return n !== -1 && this.elevatorMeshes.splice(n, 1), rebuildObjectIndex(this.#t, this.elevatorMeshes), this.remove(e), this;
|
|
21625
21645
|
}
|
|
21626
21646
|
addVent(e) {
|
|
21627
|
-
return this.ventMeshes.includes(e) || (this.add(e), this.ventMeshes.push(e), indexObject(this.#
|
|
21647
|
+
return this.ventMeshes.includes(e) || (this.add(e), this.ventMeshes.push(e), indexObject(this.#n, e)), this;
|
|
21628
21648
|
}
|
|
21629
21649
|
getVentAt(e) {
|
|
21630
21650
|
return this.ventMeshes[e];
|
|
21631
21651
|
}
|
|
21632
21652
|
getVentById(e) {
|
|
21633
|
-
return this.#
|
|
21653
|
+
return this.#n.get(e);
|
|
21634
21654
|
}
|
|
21635
21655
|
removeVent(e) {
|
|
21636
21656
|
const n = this.ventMeshes.indexOf(e);
|
|
21637
|
-
return n !== -1 && this.ventMeshes.splice(n, 1), rebuildObjectIndex(this.#
|
|
21657
|
+
return n !== -1 && this.ventMeshes.splice(n, 1), rebuildObjectIndex(this.#n, this.ventMeshes), this.remove(e), this;
|
|
21638
21658
|
}
|
|
21639
21659
|
isolateFloor(e) {
|
|
21640
21660
|
return this.isolateFloors(getFloorReferences(e));
|
|
@@ -21703,7 +21723,7 @@ class SemanticGroup extends BaseGroup {
|
|
|
21703
21723
|
#e = /* @__PURE__ */ new Set();
|
|
21704
21724
|
#r = /* @__PURE__ */ new Map();
|
|
21705
21725
|
#t = /* @__PURE__ */ new Map();
|
|
21706
|
-
#
|
|
21726
|
+
#n = /* @__PURE__ */ new Map();
|
|
21707
21727
|
#i = /* @__PURE__ */ new Map();
|
|
21708
21728
|
#o = !0;
|
|
21709
21729
|
constructor() {
|
|
@@ -21766,12 +21786,12 @@ class SemanticGroup extends BaseGroup {
|
|
|
21766
21786
|
let e = this.#o || this.#i.size !== this.buildings.length;
|
|
21767
21787
|
for (const n of this.buildings)
|
|
21768
21788
|
n.syncFacilityIndexes(), this.#i.get(n) !== n.facilityIndexVersion && (e = !0);
|
|
21769
|
-
e && (this.#t.clear(), this.#
|
|
21789
|
+
e && (this.#t.clear(), this.#n.clear(), this.#i.clear(), this.buildings.forEach((n) => {
|
|
21770
21790
|
n.syncFacilityIndexes(), this.#i.set(n, n.facilityIndexVersion);
|
|
21771
21791
|
for (const a of n.getFacilityIndexIds())
|
|
21772
21792
|
this.#t.has(a) || this.#t.set(a, n);
|
|
21773
21793
|
for (const a of n.getFacilityIndexObjects())
|
|
21774
|
-
this.#
|
|
21794
|
+
this.#n.has(a) || this.#n.set(a, n);
|
|
21775
21795
|
}), this.#o = !1);
|
|
21776
21796
|
}
|
|
21777
21797
|
}
|
|
@@ -22247,7 +22267,7 @@ class SemanticParser {
|
|
|
22247
22267
|
h.push(...o);
|
|
22248
22268
|
continue;
|
|
22249
22269
|
}
|
|
22250
|
-
const r = o.map((d) => this.#
|
|
22270
|
+
const r = o.map((d) => this.#n(d));
|
|
22251
22271
|
l.addInstances(u, s, r) ? r.forEach((d, p) => {
|
|
22252
22272
|
const v = o[p];
|
|
22253
22273
|
this.#o(d, v.facility, a);
|
|
@@ -22257,7 +22277,7 @@ class SemanticParser {
|
|
|
22257
22277
|
}
|
|
22258
22278
|
l.children.length > 0 && n.setFacilityLayer(l), await Promise.all(h.map((u) => this.#i(u, a)));
|
|
22259
22279
|
}
|
|
22260
|
-
#
|
|
22280
|
+
#n(e) {
|
|
22261
22281
|
const { facility: n, story: a, floorMesh: l, treeNode: t, worldMatrix: h } = e, u = new FacilityInstanceObject();
|
|
22262
22282
|
return u.name = n.Name || t.name || "", u.visible = t.visible, u.setInstanceIdentity({
|
|
22263
22283
|
id: n.ID,
|
|
@@ -22277,7 +22297,7 @@ class SemanticParser {
|
|
|
22277
22297
|
async #i(e, n) {
|
|
22278
22298
|
const { facility: a, story: l, treeNode: t } = e, h = await createFacilityModel(a, t, n);
|
|
22279
22299
|
if (!h) return;
|
|
22280
|
-
const u = this.#
|
|
22300
|
+
const u = this.#n(e);
|
|
22281
22301
|
u.userData.instanced = !1, Object.assign(h.userData, {
|
|
22282
22302
|
storyId: l.ID,
|
|
22283
22303
|
floorIndex: l.FloorIndex,
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { LoadingManager, Object3D } from 'three/webgpu';
|
|
2
|
+
import { type DecodedGltfModelPacket, type ModelDecodeRequestOptions } from '../worker/modelDecodeProtocol';
|
|
3
|
+
type DecodeLoadingManager = Pick<LoadingManager, 'resolveURL' | 'itemStart' | 'itemEnd' | 'itemError'>;
|
|
4
|
+
export interface ModelDecodeWorkerClientOptions {
|
|
5
|
+
onFatal?(error: ModelDecodeWorkerUnavailableError): void;
|
|
6
|
+
}
|
|
7
|
+
export interface ModelDecodeWorkerLoadOptions extends ModelDecodeRequestOptions {
|
|
8
|
+
signal?: AbortSignal;
|
|
9
|
+
loadingManager?: DecodeLoadingManager;
|
|
10
|
+
}
|
|
11
|
+
export declare class ModelDecodeWorkerUnavailableError extends Error {
|
|
12
|
+
name: string;
|
|
13
|
+
constructor(message: string, options?: ErrorOptions);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Reuses transferred bitmap identities so equal textures keep one batch key.
|
|
17
|
+
* The lookup is an LRU: evicting an entry drops only this client's strong
|
|
18
|
+
* reference; existing Three.js textures continue to own and use the bitmap.
|
|
19
|
+
*/
|
|
20
|
+
export declare function reuseDecodedImageContent(packet: DecodedGltfModelPacket, imagesByContent: Map<string, ImageBitmap>, maxEntries?: number): string[];
|
|
21
|
+
/** Render-Worker side client for the acknowledged model decoder Worker. */
|
|
22
|
+
export declare class ModelDecodeWorkerClient {
|
|
23
|
+
#private;
|
|
24
|
+
readonly worker: Worker;
|
|
25
|
+
constructor(worker: Worker, options?: ModelDecodeWorkerClientOptions);
|
|
26
|
+
get disposed(): boolean;
|
|
27
|
+
supports(url: string): boolean;
|
|
28
|
+
loadAsync(url: string, options?: ModelDecodeWorkerLoadOptions): Promise<Object3D>;
|
|
29
|
+
dispose(): void;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FileLoader, type Object3D, type WebGPURenderer
|
|
1
|
+
import { FileLoader, LoadingManager, type Object3D, type WebGPURenderer } from 'three/webgpu';
|
|
2
2
|
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
|
|
3
3
|
import { FBXLoader } from 'three/addons/loaders/FBXLoader.js';
|
|
4
4
|
import { OBJLoader } from 'three/addons/loaders/OBJLoader.js';
|
|
@@ -10,6 +10,7 @@ import { SBMLoader } from './SBMLoader';
|
|
|
10
10
|
import type { InteractionEventMap } from '../interactions';
|
|
11
11
|
export interface LoadParameters {
|
|
12
12
|
persistent?: boolean;
|
|
13
|
+
signal?: AbortSignal;
|
|
13
14
|
}
|
|
14
15
|
export declare class ModelLoaderManager {
|
|
15
16
|
private static CACHE_NAME;
|
|
@@ -22,6 +23,15 @@ export declare class ModelLoaderManager {
|
|
|
22
23
|
static fbxLoader: FBXLoader;
|
|
23
24
|
static objLoader: OBJLoader;
|
|
24
25
|
static stlLoader: STLLoader;
|
|
26
|
+
private static decodeWorkerClient;
|
|
27
|
+
/**
|
|
28
|
+
* Routes supported static glTF/GLB/SBMX models through a dedicated decoder
|
|
29
|
+
* Worker. ModelLoaderManager owns the supplied Worker and terminates it when
|
|
30
|
+
* replaced or cleared. The returned disposer only clears this specific
|
|
31
|
+
* Worker, so a late owner cleanup cannot terminate a newer replacement.
|
|
32
|
+
*/
|
|
33
|
+
static setDecodeWorker(worker: Worker | null): () => void;
|
|
34
|
+
static get decodeWorkerEnabled(): boolean;
|
|
25
35
|
static setLoadingManager(loadingManager: LoadingManager): void;
|
|
26
36
|
/**
|
|
27
37
|
* Set the renderer to enable KTX2 support and other renderer-dependent features.
|
|
@@ -36,5 +46,8 @@ export declare class ModelLoaderManager {
|
|
|
36
46
|
*/
|
|
37
47
|
static setKTX2Path(path: string): void;
|
|
38
48
|
static loadAsync(url: string, parameters?: LoadParameters): Promise<Object3D<InteractionEventMap>>;
|
|
39
|
-
private static
|
|
49
|
+
private static configureGltfLoader;
|
|
50
|
+
private static createParseLoadingManager;
|
|
51
|
+
private static loadSourceBuffer;
|
|
52
|
+
private static throwIfAborted;
|
|
40
53
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type Object3D } from 'three/webgpu';
|
|
2
|
+
import { type DecodedGltfModelPacket } from '../worker/modelDecodeProtocol';
|
|
3
|
+
/** Rebuilds a supported static glTF packet in the Worker that owns Three.js. */
|
|
4
|
+
export declare function buildDecodedGltfModel(packet: DecodedGltfModelPacket): Object3D;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type DecodedGltfModelPacket, type ModelDecodeRequestOptions } from './modelDecodeProtocol';
|
|
2
|
+
export interface ModelDecodeResourceHandle {
|
|
3
|
+
url: string;
|
|
4
|
+
complete(error?: unknown): void;
|
|
5
|
+
}
|
|
6
|
+
export interface ModelDecodeResourceResolver {
|
|
7
|
+
resolve(url: string, signal: AbortSignal): Promise<ModelDecodeResourceHandle>;
|
|
8
|
+
}
|
|
9
|
+
export declare function decodeGltfModelPacket(url: string, source: ArrayBuffer, options?: ModelDecodeRequestOptions, signal?: AbortSignal, resourceResolver?: ModelDecodeResourceResolver): Promise<DecodedGltfModelPacket>;
|
|
10
|
+
export declare function loadGltfModelPacket(url: string, options?: ModelDecodeRequestOptions, signal?: AbortSignal, resourceResolver?: ModelDecodeResourceResolver): Promise<DecodedGltfModelPacket>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getTransferables(value: unknown): Transferable[];
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
export { clampWorkerImageDimensions, createWorkerImageBitmap } from './workerImageUtils';
|
|
1
2
|
/**
|
|
2
3
|
* Makes Three.js TextureLoader/CubeTextureLoader usable in a Worker by loading
|
|
3
4
|
* images with fetch() and createImageBitmap() instead of document.createElement('img').
|
|
5
|
+
* Images larger than WebGPU's portable 8192px limit are downscaled before
|
|
6
|
+
* decoding so they cannot invalidate the device's texture bindings.
|
|
4
7
|
*/
|
|
5
8
|
export declare function installWorkerImageLoader(): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ModelDecodeWorkerRequest, type ModelDecodeWorkerResponse } from './modelDecodeProtocol';
|
|
2
|
+
export * from './modelDecodeProtocol';
|
|
3
|
+
interface DecodeWorkerScope {
|
|
4
|
+
addEventListener(type: 'message', listener: (event: MessageEvent<ModelDecodeWorkerRequest>) => void): void;
|
|
5
|
+
postMessage(message: ModelDecodeWorkerResponse, transfer?: Transferable[]): void;
|
|
6
|
+
close(): void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Installs a serial, acknowledged static glTF/SBMX decoder in the current
|
|
10
|
+
* dedicated Worker. Only one decoded packet may be in flight at a time so a
|
|
11
|
+
* large scene cannot fill the render Worker's message queue with model data.
|
|
12
|
+
*/
|
|
13
|
+
export declare function installModelDecodeWorker(scope?: DecodeWorkerScope): void;
|