@nebula-spatial/viewer 0.6.4 → 0.6.6

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.
@@ -1,8 +1,8 @@
1
- import { Group as O, MeshStandardMaterial as Z, Mesh as z, PointsMaterial as H, Points as j, Color as J, Box3 as $, Vector3 as b, MeshBasicMaterial as Q, BoxGeometry as q } from "three";
1
+ import { Group as O, MeshStandardMaterial as Z, Mesh as z, PointsMaterial as H, Points as Q, Color as j, Box3 as $, Vector3 as b, MeshBasicMaterial as J, BoxGeometry as q } from "three";
2
2
  import { PLYLoader as X } from "three/examples/jsm/loaders/PLYLoader.js";
3
3
  import { S as ee, a as x } from "./spark.module-kM8pwA1o.js";
4
- import { L as te, A as _, B as ne, D as ie } from "./index-QdE4B8Hz.js";
5
- import { a as re, r as ae } from "./spark-renderer-upJSRoni.js";
4
+ import { Q as te, B as _, D as ne, E as ie } from "./index-DyBfusq5.js";
5
+ import { a as re, r as ae } from "./spark-renderer-dvFIUjr0.js";
6
6
  function xe(t, e) {
7
7
  let u = !1, s = null, c = null, i = null, o = null, w = null, d = null, h = null, r = null, v = "unsupported", B = null, F = null, k = null, S = "y", G;
8
8
  const V = P(), T = () => {
@@ -12,7 +12,7 @@ function xe(t, e) {
12
12
  }, Y = (n, f) => {
13
13
  (h == null ? void 0 : h.scene) !== f && (U(), h = re(n, f, e.requestRender));
14
14
  }, E = (async () => {
15
- var C, N, R, D, L, W;
15
+ var C, N, R, D, W, L;
16
16
  const n = await le(t);
17
17
  if (u || e.signal.aborted) throw I();
18
18
  const f = t.entryPath ?? t.filename, p = te(n, f, e.format);
@@ -42,7 +42,7 @@ function xe(t, e) {
42
42
  vertexColors: a,
43
43
  size: Math.max(4e-3, de(l.boundingBox) * 3e-3),
44
44
  sizeAttenuation: !0
45
- }), g = new j(l, y);
45
+ }), g = new Q(l, y);
46
46
  g.name = "viewer-visual-ply-points", m.add(g);
47
47
  }
48
48
  B = null;
@@ -55,11 +55,11 @@ function xe(t, e) {
55
55
  });
56
56
  if (await a.initialized, u || e.signal.aborted)
57
57
  throw a.dispose(), I();
58
- if (a.name = "viewer-visual-splat", a.position.set(0, 0, 0), (C = e.options.visualAppearance) != null && C.color && (a.recolor = new J(...e.options.visualAppearance.color)), ((N = e.options.visualAppearance) == null ? void 0 : N.opacity) !== void 0 && (a.opacity = e.options.visualAppearance.opacity), m.add(a), o = a, B = ((R = a.packedSplats) == null ? void 0 : R.numSplats) ?? ((D = a.extSplats) == null ? void 0 : D.numSplats) ?? ((L = a.paged) == null ? void 0 : L.numSplats) ?? ((W = a.splats) == null ? void 0 : W.getNumSplats()) ?? null, w = pe(a), w.isEmpty()) throw new Error("Gaussian asset has empty bounds.");
58
+ if (a.name = "viewer-visual-splat", a.position.set(0, 0, 0), (C = e.options.visualAppearance) != null && C.color && (a.recolor = new j(...e.options.visualAppearance.color)), ((N = e.options.visualAppearance) == null ? void 0 : N.opacity) !== void 0 && (a.opacity = e.options.visualAppearance.opacity), m.add(a), o = a, B = ((R = a.packedSplats) == null ? void 0 : R.numSplats) ?? ((D = a.extSplats) == null ? void 0 : D.numSplats) ?? ((W = a.paged) == null ? void 0 : W.numSplats) ?? ((L = a.splats) == null ? void 0 : L.getNumSplats()) ?? null, w = pe(a), w.isEmpty()) throw new Error("Gaussian asset has empty bounds.");
59
59
  }
60
60
  if (S = e.options.upAxis ?? oe(p.kind), _(m, S), A.add(m), m.updateMatrixWorld(!0), r = new $().setFromObject(m), o && w && (o.updateWorldMatrix(!0, !1), r.union(w.clone().applyMatrix4(o.matrixWorld))), r.isEmpty()) throw new Error("Visual asset has no displayable bounds.");
61
61
  if (o && e.options.visualSelectionMode !== "exact") {
62
- const l = r.getSize(new b()), a = new Q({
62
+ const l = r.getSize(new b()), a = new J({
63
63
  transparent: !0,
64
64
  // The scene picker filters fully transparent materials, while colorWrite
65
65
  // keeps this raycastable proxy invisible in the rendered frame.
@@ -1,7 +1,7 @@
1
- import { DataTexture as ne, LinearMipmapLinearFilter as Xe, LinearFilter as _e, Loader as J, LoaderUtils as Ve, FileLoader as Ge, TextureLoader as Se, RepeatWrapping as pe, ClampToEdgeWrapping as fe, Texture as Y, MeshPhongMaterial as W, MeshLambertMaterial as Fe, ColorManagement as N, Color as k, SRGBColorSpace as X, EquirectangularReflectionMapping as Ne, Matrix4 as L, Group as ce, Bone as he, PropertyBinding as ee, Object3D as Z, PerspectiveCamera as $e, PointLight as de, MathUtils as B, SpotLight as ze, DirectionalLight as je, SkinnedMesh as He, Mesh as Ae, LineBasicMaterial as We, Line as Ye, Vector3 as V, Skeleton as qe, AmbientLight as Ke, BufferGeometry as re, Float32BufferAttribute as j, Uint16BufferAttribute as Ze, Matrix3 as Qe, Vector2 as Je, ShapeUtils as et, Vector4 as tt, Euler as z, AnimationClip as nt, Quaternion as G, VectorKeyframeTrack as rt, QuaternionKeyframeTrack as me, NumberKeyframeTrack as st, LoadingManager as at, LinearSRGBColorSpace as ge, RGBAFormat as Ie, UnsignedByteType as Re, NoColorSpace as ot, MeshPhysicalMaterial as De, Box3 as it } from "three";
1
+ import { DataTexture as ne, LinearMipmapLinearFilter as Xe, LinearFilter as _e, Loader as J, LoaderUtils as Ve, FileLoader as Ge, TextureLoader as Se, RepeatWrapping as pe, ClampToEdgeWrapping as fe, Texture as Y, MeshPhongMaterial as W, MeshLambertMaterial as Fe, ColorManagement as N, Color as k, SRGBColorSpace as X, EquirectangularReflectionMapping as Ne, Matrix4 as L, Group as ce, Bone as he, PropertyBinding as ee, Object3D as Z, PerspectiveCamera as $e, PointLight as de, MathUtils as B, SpotLight as je, DirectionalLight as ze, SkinnedMesh as He, Mesh as Ae, LineBasicMaterial as We, Line as Ye, Vector3 as V, Skeleton as qe, AmbientLight as Ke, BufferGeometry as re, Float32BufferAttribute as z, Uint16BufferAttribute as Ze, Matrix3 as Qe, Vector2 as Je, ShapeUtils as et, Vector4 as tt, Euler as j, AnimationClip as nt, Quaternion as G, VectorKeyframeTrack as rt, QuaternionKeyframeTrack as me, NumberKeyframeTrack as st, LoadingManager as at, LinearSRGBColorSpace as ge, RGBAFormat as Ie, UnsignedByteType as Re, NoColorSpace as ot, MeshPhysicalMaterial as De, Box3 as it } from "three";
2
2
  import { DRACOLoader as lt } from "three/examples/jsm/loaders/DRACOLoader.js";
3
3
  import { GLTFLoader as ct } from "three/examples/jsm/loaders/GLTFLoader.js";
4
- import { z as ye, A as we, B as ut, d as ve, D as pt } from "./index-QdE4B8Hz.js";
4
+ import { A as ye, B as we, D as ut, d as ve, E as pt } from "./index-DyBfusq5.js";
5
5
  import { TGALoader as ft } from "three/examples/jsm/loaders/TGALoader.js";
6
6
  import * as ht from "three/examples/jsm/libs/fflate.module.js";
7
7
  import { unzlibSync as dt } from "three/examples/jsm/libs/fflate.module.js";
@@ -551,13 +551,13 @@ class Et {
551
551
  t = new de(s, a, i, l);
552
552
  break;
553
553
  case 1:
554
- t = new je(s, a);
554
+ t = new ze(s, a);
555
555
  break;
556
556
  case 2:
557
557
  let p = Math.PI / 3;
558
558
  n.InnerAngle !== void 0 && (p = B.degToRad(n.InnerAngle.value));
559
559
  let f = 0;
560
- n.OuterAngle !== void 0 && (f = B.degToRad(n.OuterAngle.value), f = Math.max(f, 1)), t = new ze(s, a, i, p, f, l);
560
+ n.OuterAngle !== void 0 && (f = B.degToRad(n.OuterAngle.value), f = Math.max(f, 1)), t = new je(s, a, i, p, f, l);
561
561
  break;
562
562
  default:
563
563
  console.warn("THREE.FBXLoader: Unknown light type " + n.LightType.value + ", defaulting to a PointLight."), t = new de(s, a);
@@ -703,14 +703,14 @@ class bt {
703
703
  genGeometry(e, t, n, r) {
704
704
  const s = new re();
705
705
  e.attrName && (s.name = e.attrName);
706
- const a = this.parseGeoNode(e, t), i = this.genBuffers(a), l = new j(i.vertex, 3);
707
- if (l.applyMatrix4(r), s.setAttribute("position", l), i.colors.length > 0 && s.setAttribute("color", new j(i.colors, 3)), t && (s.setAttribute("skinIndex", new Ze(i.weightsIndices, 4)), s.setAttribute("skinWeight", new j(i.vertexWeights, 4)), s.FBX_Deformer = t), i.normal.length > 0) {
708
- const p = new Qe().getNormalMatrix(r), f = new j(i.normal, 3);
706
+ const a = this.parseGeoNode(e, t), i = this.genBuffers(a), l = new z(i.vertex, 3);
707
+ if (l.applyMatrix4(r), s.setAttribute("position", l), i.colors.length > 0 && s.setAttribute("color", new z(i.colors, 3)), t && (s.setAttribute("skinIndex", new Ze(i.weightsIndices, 4)), s.setAttribute("skinWeight", new z(i.vertexWeights, 4)), s.FBX_Deformer = t), i.normal.length > 0) {
708
+ const p = new Qe().getNormalMatrix(r), f = new z(i.normal, 3);
709
709
  f.applyNormalMatrix(p), s.setAttribute("normal", f);
710
710
  }
711
711
  if (i.uvs.forEach(function(p, f) {
712
712
  const u = f === 0 ? "uv" : `uv${f}`;
713
- s.setAttribute(u, new j(i.uvs[f], 2));
713
+ s.setAttribute(u, new z(i.uvs[f], 2));
714
714
  }), a.material && a.material.mappingType !== "AllSame") {
715
715
  let p = i.materialIndex[0], f = 0;
716
716
  if (i.materialIndex.forEach(function(u, c) {
@@ -864,7 +864,7 @@ class bt {
864
864
  vertexIndices: i,
865
865
  vertexPositions: u,
866
866
  baseVertexPositions: a
867
- }, h = this.genBuffers(c), m = new j(h.vertex, 3);
867
+ }, h = this.genBuffers(c), m = new z(h.vertex, 3);
868
868
  m.name = s || n.attrName, m.applyMatrix4(r), e.morphAttributes.position.push(m);
869
869
  }
870
870
  // Parse normal from FBXTree.Objects.Geometry.LayerElementNormal if it exists
@@ -1106,8 +1106,8 @@ class Mt {
1106
1106
  a = c[0], i = c[1];
1107
1107
  }
1108
1108
  const l = q(0);
1109
- n !== void 0 && (n = n.map(B.degToRad), n.push(l), n = new z().fromArray(n), n = new G().setFromEuler(n)), r !== void 0 && (r = r.map(B.degToRad), r.push(l), r = new z().fromArray(r), r = new G().setFromEuler(r).invert());
1110
- const p = new G(), f = new z(), u = [];
1109
+ n !== void 0 && (n = n.map(B.degToRad), n.push(l), n = new j().fromArray(n), n = new G().setFromEuler(n)), r !== void 0 && (r = r.map(B.degToRad), r.push(l), r = new j().fromArray(r), r = new G().setFromEuler(r).invert());
1110
+ const p = new G(), f = new j(), u = [];
1111
1111
  if (!i || !a) return new me(e + ".quaternion", [0], [0]);
1112
1112
  for (let c = 0; c < i.length; c += 3)
1113
1113
  f.set(i[c], i[c + 1], i[c + 2], s), p.setFromEuler(f), n !== void 0 && p.premultiply(n), r !== void 0 && p.multiply(r), c > 2 && new G().fromArray(
@@ -1190,9 +1190,9 @@ class Mt {
1190
1190
  Math.abs(c[2])
1191
1191
  ];
1192
1192
  if (h[0] >= 180 || h[1] >= 180 || h[2] >= 180) {
1193
- const g = Math.max(...h) / 180, d = new z(...p, r), T = new z(...u, r), F = new G().setFromEuler(d), y = new G().setFromEuler(T);
1193
+ const g = Math.max(...h) / 180, d = new j(...p, r), T = new j(...u, r), F = new G().setFromEuler(d), y = new G().setFromEuler(T);
1194
1194
  F.dot(y) && y.set(-y.x, -y.y, -y.z, -y.w);
1195
- const x = e.times[i - 1], A = e.times[i] - x, I = new G(), b = new z();
1195
+ const x = e.times[i - 1], A = e.times[i] - x, I = new G(), b = new j();
1196
1196
  for (let v = 0; v < 1; v += 1 / g)
1197
1197
  I.copy(F.clone().slerp(y.clone(), v)), s.push(x + v * A), b.setFromQuaternion(I, r), a.push(b.x), a.push(b.y), a.push(b.z);
1198
1198
  } else
@@ -1572,7 +1572,7 @@ function Q(o, e, t, n) {
1572
1572
  const s = r * n.dataSize, a = s + n.dataSize;
1573
1573
  return Ct(Dt, n.buffer, s, a);
1574
1574
  }
1575
- const se = new z(), H = new V();
1575
+ const se = new j(), H = new V();
1576
1576
  function Le(o) {
1577
1577
  const e = new L(), t = new L(), n = new L(), r = new L(), s = new L(), a = new L(), i = new L(), l = new L(), p = new L(), f = new L(), u = new L(), c = new L(), h = o.inheritType ? o.inheritType : 0;
1578
1578
  o.translation && e.setPosition(H.fromArray(o.translation));
@@ -1733,7 +1733,7 @@ async function Lt(o, e, t) {
1733
1733
  return m = new xt(u).parse(o, ""), await Promise.all(i), e.signal.throwIfAborted(), { root: m, textures: l, textureFailures: f };
1734
1734
  } catch (g) {
1735
1735
  if (n.abort(g), await Promise.allSettled(i), m) {
1736
- const { disposeModelResources: d } = await import("./index-QdE4B8Hz.js").then((T) => T.ac);
1736
+ const { disposeModelResources: d } = await import("./index-DyBfusq5.js").then((T) => T.af);
1737
1737
  d(m, l);
1738
1738
  } else for (const d of l) d.dispose();
1739
1739
  throw g;
@@ -1940,7 +1940,7 @@ function Nt(o) {
1940
1940
  if (p.endOffset > s) throw new Error("FBX child extends past its parent.");
1941
1941
  if (te.has(p.name) || Be.has(p.name)) {
1942
1942
  const f = K(e, l, t, p.name !== "UV");
1943
- i.push({ name: f.name, values: ["BlendModes", "Alphas"].includes(f.name) ? zt(e, l, t, f.childrenOffset) : [...f.properties], children: te.has(f.name) ? n(f.childrenOffset, f.endOffset, a + 1) : [] });
1943
+ i.push({ name: f.name, values: ["BlendModes", "Alphas"].includes(f.name) ? jt(e, l, t, f.childrenOffset) : [...f.properties], children: te.has(f.name) ? n(f.childrenOffset, f.endOffset, a + 1) : [] });
1944
1944
  }
1945
1945
  l = p.endOffset;
1946
1946
  }
@@ -2010,7 +2010,7 @@ function $t(o) {
2010
2010
  };
2011
2011
  return s(0);
2012
2012
  }
2013
- function zt(o, e, t, n) {
2013
+ function jt(o, e, t, n) {
2014
2014
  const r = t ? 25 : 13;
2015
2015
  let s = e + r + o.getUint8(e + r - 1);
2016
2016
  if (s === n) return [];
@@ -2024,7 +2024,7 @@ function zt(o, e, t, n) {
2024
2024
  const h = new DataView(c.buffer, c.byteOffset, c.byteLength);
2025
2025
  return Array.from({ length: i }, (m, g) => a === "i" ? h.getInt32(g * f, !0) : a === "d" ? h.getFloat64(g * f, !0) : h.getFloat32(g * f, !0));
2026
2026
  }
2027
- const be = (o) => o <= 0.04045 ? o / 12.92 : ((o + 0.055) / 1.055) ** 2.4, jt = (o) => o <= 31308e-7 ? o * 12.92 : 1.055 * o ** (1 / 2.4) - 0.055, Ht = /* @__PURE__ */ new Set([0, 1, 2, 4, 5]), Wt = 4 * 1024 * 1024;
2027
+ const be = (o) => o <= 0.04045 ? o / 12.92 : ((o + 0.055) / 1.055) ** 2.4, zt = (o) => o <= 31308e-7 ? o * 12.92 : 1.055 * o ** (1 / 2.4) - 0.055, Ht = /* @__PURE__ */ new Set([0, 1, 2, 4, 5]), Wt = 4 * 1024 * 1024;
2028
2028
  function Me(o) {
2029
2029
  const e = o.image, t = (e == null ? void 0 : e.naturalWidth) || (e == null ? void 0 : e.width), n = (e == null ? void 0 : e.naturalHeight) || (e == null ? void 0 : e.height);
2030
2030
  if (!t || !n || t * n > Wt) throw new Error("missing image or image exceeds 4M pixels");
@@ -2085,7 +2085,7 @@ function Yt(o, e, t) {
2085
2085
  }
2086
2086
  const p = new Uint8Array(i * 4);
2087
2087
  for (let u = 0; u < i; u++) p[u * 4 + 3] = 255;
2088
- for (let u = 0; u < i; u++) for (let c = 0; c < 3; c++) p[u * 4 + c] = Math.round(255 * Math.min(1, Math.max(0, jt(l[u * 3 + c]))));
2088
+ for (let u = 0; u < i; u++) for (let c = 0; c < 3; c++) p[u * 4 + c] = Math.round(255 * Math.min(1, Math.max(0, zt(l[u * 3 + c]))));
2089
2089
  const f = new ne(p, a.width, a.height);
2090
2090
  return f.colorSpace = X, f.generateMipmaps = r.generateMipmaps, f.wrapS = r.wrapS, f.wrapT = r.wrapT, f.minFilter = r.minFilter, f.magFilter = r.magFilter, f.anisotropy = r.anisotropy, f.offset.copy(r.offset), f.repeat.copy(r.repeat), f.center.copy(r.center), f.rotation = r.rotation, f.matrix.copy(r.matrix), f.matrixAutoUpdate = r.matrixAutoUpdate, f.channel = r.channel, f.mapping = r.mapping, f.userData.fbxLayerBaseId = o.layers[0].textureId, f.needsUpdate = !0, f;
2091
2091
  }