@miris-inc/three 0.0.7-5eecc45 → 0.0.7-d7b324c

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/three.mjs +32 -24
package/package.json CHANGED
@@ -15,5 +15,5 @@
15
15
  "@types/three": "^0.182.0",
16
16
  "three": "^0.182.0"
17
17
  },
18
- "version": "0.0.7-5eecc45"
18
+ "version": "0.0.7-d7b324c"
19
19
  }
package/three.mjs CHANGED
@@ -1367,6 +1367,7 @@ let ds = class Kg {
1367
1367
  return this._keyMap.get(A);
1368
1368
  }
1369
1369
  #A;
1370
+ #g = !1;
1370
1371
  get key() {
1371
1372
  return this.#A ?? null;
1372
1373
  }
@@ -1374,7 +1375,7 @@ let ds = class Kg {
1374
1375
  Jg._keyMap.delete(this.key), (A || A === 0) && Jg._keyMap.set(A, this), this.#A = A;
1375
1376
  }
1376
1377
  // prettier-ignore
1377
- #g = [
1378
+ #I = [
1378
1379
  1,
1379
1380
  0,
1380
1381
  0,
@@ -1393,12 +1394,12 @@ let ds = class Kg {
1393
1394
  1
1394
1395
  ];
1395
1396
  get matrix() {
1396
- return this.#g;
1397
+ return this.#I;
1397
1398
  }
1398
1399
  set matrix(A) {
1399
- this.#g = A;
1400
- const I = GC(this.#g.length * 4);
1401
- EC.set(Float32Array.from(this.#g), I / 4), Ls(this.scene.handle, this.id, I), iG(I);
1400
+ this.#I = A;
1401
+ const I = GC(this.#I.length * 4);
1402
+ EC.set(Float32Array.from(this.#I), I / 4), Ls(this.scene.handle, this.id, I), iG(I);
1402
1403
  }
1403
1404
  get boundingBox() {
1404
1405
  const A = GC(24);
@@ -1421,9 +1422,9 @@ let ds = class Kg {
1421
1422
  };
1422
1423
  return Object.freeze(D), D;
1423
1424
  }
1424
- #I = /* @__PURE__ */ new Set();
1425
+ #B = /* @__PURE__ */ new Set();
1425
1426
  get chunks() {
1426
- return new Set(this.#I);
1427
+ return new Set(this.#B);
1427
1428
  }
1428
1429
  constructor(A) {
1429
1430
  this.init(A), Jg._idMap.set(this.id, this), A.scene.add(this);
@@ -1436,14 +1437,17 @@ let ds = class Kg {
1436
1437
  id: { value: B }
1437
1438
  });
1438
1439
  }
1440
+ onStreamLoaded() {
1441
+ this.#g || (this.key?.onStreamLoaded(), this.#g = !0);
1442
+ }
1439
1443
  add(A) {
1440
- this.#I.add(A);
1444
+ this.#B.add(A);
1441
1445
  }
1442
1446
  end() {
1443
1447
  Ns(this.scene.handle, this.id);
1444
- for (const A of this.#I)
1448
+ for (const A of this.#B)
1445
1449
  A.dispose();
1446
- this.#I.clear(), Jg._idMap.delete(this.id), Jg._keyMap.delete(this.key), this.scene.streams.has(this) && this.scene.delete(this);
1450
+ this.#B.clear(), Jg._idMap.delete(this.id), Jg._keyMap.delete(this.key), this.scene.streams.has(this) && this.scene.delete(this);
1447
1451
  }
1448
1452
  };
1449
1453
  const ls = 2048, rs = 4, JD = ls * rs;
@@ -1583,34 +1587,35 @@ let qs = class {
1583
1587
  A.handle,
1584
1588
  g
1585
1589
  ) === _I.GaussianSplats) {
1586
- const Q = this.#Q(
1590
+ A.getStreamForDescendentId(g)?.onStreamLoaded();
1591
+ const E = this.#Q(
1587
1592
  A.handle,
1588
1593
  g,
1589
1594
  6,
1590
1595
  oM
1591
- ), E = as(A.handle, g), G = new $B();
1596
+ ), G = as(A.handle, g), D = new $B();
1592
1597
  try {
1593
- const { ptr: D } = G.$$;
1594
- IC(A.handle, g, "sparkPackedSplats", D);
1595
- const R = AC(G), M = Math.ceil(R.length / JD) * JD, i = new Uint32Array(M);
1596
- i.set(R);
1597
- const o = QB.forId(g);
1598
- if (!o) {
1598
+ const { ptr: R } = D.$$;
1599
+ IC(A.handle, g, "sparkPackedSplats", R);
1600
+ const M = AC(D), i = Math.ceil(M.length / JD) * JD, o = new Uint32Array(i);
1601
+ o.set(M);
1602
+ const F = QB.forId(g);
1603
+ if (!F) {
1599
1604
  console.warn(
1600
1605
  `Received modified event for LOD ${g} which does not exist.`
1601
1606
  );
1602
1607
  continue;
1603
1608
  }
1604
- o.splats = i, o.bounds = Q, o.lodIndex = E, ps(
1609
+ F.splats = o, F.bounds = E, F.lodIndex = G, ps(
1605
1610
  A.handle,
1606
1611
  g,
1607
- M,
1608
- o
1612
+ i,
1613
+ F
1609
1614
  );
1610
- const F = new jB({ type: "created", lod: o });
1611
- this.#g.push(F), this.#B.delete(g) && this.#g.push(new jB({ type: "activated", lod: o }));
1615
+ const y = new jB({ type: "created", lod: F });
1616
+ this.#g.push(y), this.#B.delete(g) && this.#g.push(new jB({ type: "activated", lod: F }));
1612
1617
  } finally {
1613
- G.delete();
1618
+ D.delete();
1614
1619
  }
1615
1620
  }
1616
1621
  for (const g of Gs(this.#I))
@@ -28525,6 +28530,9 @@ class Wy extends LM {
28525
28530
  g.instanceCount = I, g.attributes.instanceMatrix.needsUpdate = !0, g.attributes.instanceColor.needsUpdate = !0;
28526
28531
  }
28527
28532
  }
28533
+ onStreamLoaded() {
28534
+ this.dispatchEvent({ type: "streamloaded" });
28535
+ }
28528
28536
  getObjectBounds() {
28529
28537
  const A = new vA(), I = this.#C(), g = I.length;
28530
28538
  for (let E = 0; E < g; E++) {