gl-draw 0.15.31 → 0.15.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.
@@ -1,5 +1,5 @@
1
- var Pt = Object.defineProperty, At = Object.defineProperties;
2
- var St = Object.getOwnPropertyDescriptors;
1
+ var Pt = Object.defineProperty, St = Object.defineProperties;
2
+ var At = Object.getOwnPropertyDescriptors;
3
3
  var Me = Object.getOwnPropertySymbols;
4
4
  var Mt = Object.prototype.hasOwnProperty, Rt = Object.prototype.propertyIsEnumerable;
5
5
  var Re = (h, e, t) => e in h ? Pt(h, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[e] = t, U = (h, e) => {
@@ -9,7 +9,7 @@ var Re = (h, e, t) => e in h ? Pt(h, e, { enumerable: !0, configurable: !0, writ
9
9
  for (var t of Me(e))
10
10
  Rt.call(e, t) && Re(h, t, e[t]);
11
11
  return h;
12
- }, te = (h, e) => At(h, St(e));
12
+ }, te = (h, e) => St(h, At(e));
13
13
  var se = (h, e, t) => new Promise((s, i) => {
14
14
  var r = (a) => {
15
15
  try {
@@ -29,7 +29,7 @@ var se = (h, e, t) => new Promise((s, i) => {
29
29
  import * as Ce from "@tweenjs/tween.js";
30
30
  import Dt from "deepmerge";
31
31
  import Ut from "stats-gl";
32
- import { Vector3 as I, PerspectiveCamera as zt, Matrix4 as W, ShaderMaterial as kt, UniformsUtils as Ft, RawShaderMaterial as Nt, MeshBasicMaterial as Ht, PointsMaterial as nt, SpriteMaterial as at, Layers as It, Vector2 as B, WebGLRenderTarget as jt, HalfFloatType as Bt, MathUtils as Vt, Vector4 as Yt, Quaternion as lt, Spherical as Zt, Box3 as ht, Sphere as Wt, Raycaster as ct, AxesHelper as De, CameraHelper as Kt, PointLightHelper as $t, DirectionalLightHelper as Gt, SpotLightHelper as Xt, HemisphereLightHelper as qt, Box3Helper as Ue, Scene as dt, Group as ze, Camera as Qt, Loader as mt, FileLoader as Ae, Texture as fe, VideoTexture as Jt, LoadingManager as es, DataTexture as ts, WebGLRenderer as ss, REVISION as is, Object3D as rs } from "three";
32
+ import { Vector3 as I, PerspectiveCamera as zt, Matrix4 as W, ShaderMaterial as kt, UniformsUtils as Ft, RawShaderMaterial as Nt, MeshBasicMaterial as Ht, PointsMaterial as nt, SpriteMaterial as at, Layers as It, Vector2 as B, WebGLRenderTarget as jt, HalfFloatType as Bt, MathUtils as Vt, Vector4 as Yt, Quaternion as lt, Spherical as Zt, Box3 as ht, Sphere as Wt, Raycaster as ct, AxesHelper as De, CameraHelper as Kt, PointLightHelper as $t, DirectionalLightHelper as Gt, SpotLightHelper as Xt, HemisphereLightHelper as qt, Box3Helper as Ue, Scene as dt, Group as ze, Camera as Qt, Loader as mt, FileLoader as Se, Texture as fe, VideoTexture as Jt, LoadingManager as es, DataTexture as ts, WebGLRenderer as ss, REVISION as is, Object3D as rs } from "three";
33
33
  import { M as pt, B as Oe, a as os, R as Pe, I as he } from "./WebGPULineSegments2.module.js";
34
34
  import { EffectComposer as ke } from "three/examples/jsm/postprocessing/EffectComposer";
35
35
  import { RenderPass as ns } from "three/examples/jsm/postprocessing/RenderPass";
@@ -55,7 +55,7 @@ import { DRACOLoader as us } from "three/examples/jsm/loaders/DRACOLoader";
55
55
  import { EXRLoader as fs } from "three/examples/jsm/loaders/EXRLoader";
56
56
  import { GLTFLoader as He } from "three/examples/jsm/loaders/GLTFLoader";
57
57
  import { LottieLoader as _s } from "three/examples/jsm/loaders/LottieLoader";
58
- import { c as gs, C as ys, i as vs } from "./isPlainObject.module.js";
58
+ import { a as gs, C as ys, i as vs } from "./isPlainObject.module.js";
59
59
  import { TransformControls as Cs } from "three/examples/jsm/controls/TransformControls";
60
60
  const M = {
61
61
  LEFT: 1,
@@ -98,11 +98,11 @@ const $ = Math.PI * 2, Ie = Math.PI / 2, ut = 1e-5, ie = Math.PI / 180;
98
98
  function k(h, e, t) {
99
99
  return Math.max(e, Math.min(t, h));
100
100
  }
101
- function S(h, e = ut) {
101
+ function A(h, e = ut) {
102
102
  return Math.abs(h) < e;
103
103
  }
104
104
  function P(h, e, t = ut) {
105
- return S(h - e, t);
105
+ return A(h - e, t);
106
106
  }
107
107
  function je(h, e) {
108
108
  return Math.round(h / e) * e;
@@ -1372,7 +1372,7 @@ class J extends Os {
1372
1372
  this._focalOffsetEnd,
1373
1373
  this._focalOffset
1374
1374
  ), n = this._zoomEnd - this._zoom;
1375
- if (S(t))
1375
+ if (A(t))
1376
1376
  this._thetaVelocity.value = 0, this._spherical.theta = this._sphericalEnd.theta;
1377
1377
  else {
1378
1378
  const m = this._isUserControllingRotate ? this.draggingSmoothTime : this.smoothTime;
@@ -1385,7 +1385,7 @@ class J extends Os {
1385
1385
  e
1386
1386
  ), this._needsUpdate = !0;
1387
1387
  }
1388
- if (S(s))
1388
+ if (A(s))
1389
1389
  this._phiVelocity.value = 0, this._spherical.phi = this._sphericalEnd.phi;
1390
1390
  else {
1391
1391
  const m = this._isUserControllingRotate ? this.draggingSmoothTime : this.smoothTime;
@@ -1398,7 +1398,7 @@ class J extends Os {
1398
1398
  e
1399
1399
  ), this._needsUpdate = !0;
1400
1400
  }
1401
- if (S(i))
1401
+ if (A(i))
1402
1402
  this._radiusVelocity.value = 0, this._spherical.radius = this._sphericalEnd.radius;
1403
1403
  else {
1404
1404
  const m = this._isUserControllingDolly ? this.draggingSmoothTime : this.smoothTime;
@@ -1411,7 +1411,7 @@ class J extends Os {
1411
1411
  e
1412
1412
  ), this._needsUpdate = !0;
1413
1413
  }
1414
- if (S(r.x) && S(r.y) && S(r.z))
1414
+ if (A(r.x) && A(r.y) && A(r.z))
1415
1415
  this._targetVelocity.set(0, 0, 0), this._target.copy(this._targetEnd);
1416
1416
  else {
1417
1417
  const m = this._isUserControllingTruck ? this.draggingSmoothTime : this.smoothTime;
@@ -1425,7 +1425,7 @@ class J extends Os {
1425
1425
  this._target
1426
1426
  ), this._needsUpdate = !0;
1427
1427
  }
1428
- if (S(o.x) && S(o.y) && S(o.z))
1428
+ if (A(o.x) && A(o.y) && A(o.z))
1429
1429
  this._focalOffsetVelocity.set(0, 0, 0), this._focalOffset.copy(this._focalOffsetEnd);
1430
1430
  else {
1431
1431
  const m = this._isUserControllingOffset ? this.draggingSmoothTime : this.smoothTime;
@@ -1439,7 +1439,7 @@ class J extends Os {
1439
1439
  this._focalOffset
1440
1440
  ), this._needsUpdate = !0;
1441
1441
  }
1442
- if (S(n))
1442
+ if (A(n))
1443
1443
  this._zoomVelocity.value = 0, this._zoom = this._zoomEnd;
1444
1444
  else {
1445
1445
  const m = this._isUserControllingZoom ? this.draggingSmoothTime : this.smoothTime;
@@ -1470,7 +1470,7 @@ class J extends Os {
1470
1470
  }
1471
1471
  this._boundary.clampPoint(C, C);
1472
1472
  const x = L.subVectors(C, this._targetEnd);
1473
- this._targetEnd.copy(C), this._target.add(x), this._changedDolly -= m, S(this._changedDolly) && (this._changedDolly = 0);
1473
+ this._targetEnd.copy(C), this._target.add(x), this._changedDolly -= m, A(this._changedDolly) && (this._changedDolly = 0);
1474
1474
  } else if (j(this._camera) && this._changedZoom !== 0) {
1475
1475
  const m = this._zoom - this._lastZoom, v = this._camera, p = w.set(
1476
1476
  this._dollyControlCoord.x,
@@ -1481,18 +1481,18 @@ class J extends Os {
1481
1481
  );
1482
1482
  C.sub(E), this._boundary.clampPoint(C, C);
1483
1483
  const x = L.subVectors(C, this._targetEnd);
1484
- this._targetEnd.copy(C), this._target.add(x), this._changedZoom -= m, S(this._changedZoom) && (this._changedZoom = 0);
1484
+ this._targetEnd.copy(C), this._target.add(x), this._changedZoom -= m, A(this._changedZoom) && (this._changedZoom = 0);
1485
1485
  }
1486
1486
  }
1487
1487
  this._camera.zoom !== this._zoom && (this._camera.zoom = this._zoom, this._camera.updateProjectionMatrix(), this._updateNearPlaneCorners(), this._needsUpdate = !0), this._dragNeedsUpdate = !0;
1488
1488
  const a = this._collisionTest();
1489
- this._spherical.radius = Math.min(this._spherical.radius, a), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!S(this._focalOffset.x) || !S(this._focalOffset.y) || !S(this._focalOffset.z)) && (F.setFromMatrixColumn(this._camera.matrix, 0), N.setFromMatrixColumn(this._camera.matrix, 1), Z.setFromMatrixColumn(this._camera.matrix, 2), F.multiplyScalar(this._focalOffset.x), N.multiplyScalar(-this._focalOffset.y), Z.multiplyScalar(this._focalOffset.z), w.copy(F).add(N).add(Z), this._camera.position.add(w), this._camera.updateMatrixWorld()), this._boundaryEnclosesCamera && this._encloseToBoundary(
1489
+ this._spherical.radius = Math.min(this._spherical.radius, a), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!A(this._focalOffset.x) || !A(this._focalOffset.y) || !A(this._focalOffset.z)) && (F.setFromMatrixColumn(this._camera.matrix, 0), N.setFromMatrixColumn(this._camera.matrix, 1), Z.setFromMatrixColumn(this._camera.matrix, 2), F.multiplyScalar(this._focalOffset.x), N.multiplyScalar(-this._focalOffset.y), Z.multiplyScalar(this._focalOffset.z), w.copy(F).add(N).add(Z), this._camera.position.add(w), this._camera.updateMatrixWorld()), this._boundaryEnclosesCamera && this._encloseToBoundary(
1490
1490
  this._camera.position.copy(this._target),
1491
1491
  w.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),
1492
1492
  1
1493
1493
  );
1494
1494
  const f = this._needsUpdate;
1495
- return f && !this._updatedLastTime ? (this._hasRested = !1, this.dispatchEvent({ type: "wake" }), this.dispatchEvent({ type: "update" })) : f ? (this.dispatchEvent({ type: "update" }), S(t, this.restThreshold) && S(s, this.restThreshold) && S(i, this.restThreshold) && S(r.x, this.restThreshold) && S(r.y, this.restThreshold) && S(r.z, this.restThreshold) && S(o.x, this.restThreshold) && S(o.y, this.restThreshold) && S(o.z, this.restThreshold) && S(n, this.restThreshold) && !this._hasRested && (this._hasRested = !0, this.dispatchEvent({ type: "rest" }))) : !f && this._updatedLastTime && (this._hasRested || (this._hasRested = !0, this.dispatchEvent({ type: "rest" })), this.dispatchEvent({ type: "sleep" })), this._lastDistance = this._spherical.radius, this._lastZoom = this._zoom, this._updatedLastTime = f, this._needsUpdate = !1, f;
1495
+ return f && !this._updatedLastTime ? (this._hasRested = !1, this.dispatchEvent({ type: "wake" }), this.dispatchEvent({ type: "update" })) : f ? (this.dispatchEvent({ type: "update" }), A(t, this.restThreshold) && A(s, this.restThreshold) && A(i, this.restThreshold) && A(r.x, this.restThreshold) && A(r.y, this.restThreshold) && A(r.z, this.restThreshold) && A(o.x, this.restThreshold) && A(o.y, this.restThreshold) && A(o.z, this.restThreshold) && A(n, this.restThreshold) && !this._hasRested && (this._hasRested = !0, this.dispatchEvent({ type: "rest" }))) : !f && this._updatedLastTime && (this._hasRested || (this._hasRested = !0, this.dispatchEvent({ type: "rest" })), this.dispatchEvent({ type: "sleep" })), this._lastDistance = this._spherical.radius, this._lastZoom = this._zoom, this._updatedLastTime = f, this._needsUpdate = !1, f;
1496
1496
  }
1497
1497
  /**
1498
1498
  * Get all state in JSON string
@@ -1707,7 +1707,7 @@ class J extends Os {
1707
1707
  }), s.radius = Math.sqrt(r), s;
1708
1708
  }
1709
1709
  }
1710
- var Se = { exports: {} }, Q = typeof Reflect == "object" ? Reflect : null, $e = Q && typeof Q.apply == "function" ? Q.apply : function(e, t, s) {
1710
+ var Ae = { exports: {} }, Q = typeof Reflect == "object" ? Reflect : null, $e = Q && typeof Q.apply == "function" ? Q.apply : function(e, t, s) {
1711
1711
  return Function.prototype.apply.call(e, t, s);
1712
1712
  }, ue;
1713
1713
  Q && typeof Q.ownKeys == "function" ? ue = Q.ownKeys : Object.getOwnPropertySymbols ? ue = function(e) {
@@ -1721,21 +1721,21 @@ function Ts(h) {
1721
1721
  var ft = Number.isNaN || function(e) {
1722
1722
  return e !== e;
1723
1723
  };
1724
- function A() {
1725
- A.init.call(this);
1724
+ function S() {
1725
+ S.init.call(this);
1726
1726
  }
1727
- Se.exports = A;
1728
- Se.exports.once = Ls;
1729
- A.EventEmitter = A;
1730
- A.prototype._events = void 0;
1731
- A.prototype._eventsCount = 0;
1732
- A.prototype._maxListeners = void 0;
1727
+ Ae.exports = S;
1728
+ Ae.exports.once = Ls;
1729
+ S.EventEmitter = S;
1730
+ S.prototype._events = void 0;
1731
+ S.prototype._eventsCount = 0;
1732
+ S.prototype._maxListeners = void 0;
1733
1733
  var Ge = 10;
1734
1734
  function ge(h) {
1735
1735
  if (typeof h != "function")
1736
1736
  throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof h);
1737
1737
  }
1738
- Object.defineProperty(A, "defaultMaxListeners", {
1738
+ Object.defineProperty(S, "defaultMaxListeners", {
1739
1739
  enumerable: !0,
1740
1740
  get: function() {
1741
1741
  return Ge;
@@ -1746,21 +1746,21 @@ Object.defineProperty(A, "defaultMaxListeners", {
1746
1746
  Ge = h;
1747
1747
  }
1748
1748
  });
1749
- A.init = function() {
1749
+ S.init = function() {
1750
1750
  (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
1751
1751
  };
1752
- A.prototype.setMaxListeners = function(e) {
1752
+ S.prototype.setMaxListeners = function(e) {
1753
1753
  if (typeof e != "number" || e < 0 || ft(e))
1754
1754
  throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + e + ".");
1755
1755
  return this._maxListeners = e, this;
1756
1756
  };
1757
1757
  function _t(h) {
1758
- return h._maxListeners === void 0 ? A.defaultMaxListeners : h._maxListeners;
1758
+ return h._maxListeners === void 0 ? S.defaultMaxListeners : h._maxListeners;
1759
1759
  }
1760
- A.prototype.getMaxListeners = function() {
1760
+ S.prototype.getMaxListeners = function() {
1761
1761
  return _t(this);
1762
1762
  };
1763
- A.prototype.emit = function(e) {
1763
+ S.prototype.emit = function(e) {
1764
1764
  for (var t = [], s = 1; s < arguments.length; s++) t.push(arguments[s]);
1765
1765
  var i = e === "error", r = this._events;
1766
1766
  if (r !== void 0)
@@ -1799,11 +1799,11 @@ function gt(h, e, t, s) {
1799
1799
  }
1800
1800
  return h;
1801
1801
  }
1802
- A.prototype.addListener = function(e, t) {
1802
+ S.prototype.addListener = function(e, t) {
1803
1803
  return gt(this, e, t, !1);
1804
1804
  };
1805
- A.prototype.on = A.prototype.addListener;
1806
- A.prototype.prependListener = function(e, t) {
1805
+ S.prototype.on = S.prototype.addListener;
1806
+ S.prototype.prependListener = function(e, t) {
1807
1807
  return gt(this, e, t, !0);
1808
1808
  };
1809
1809
  function bs() {
@@ -1814,13 +1814,13 @@ function yt(h, e, t) {
1814
1814
  var s = { fired: !1, wrapFn: void 0, target: h, type: e, listener: t }, i = bs.bind(s);
1815
1815
  return i.listener = t, s.wrapFn = i, i;
1816
1816
  }
1817
- A.prototype.once = function(e, t) {
1817
+ S.prototype.once = function(e, t) {
1818
1818
  return ge(t), this.on(e, yt(this, e, t)), this;
1819
1819
  };
1820
- A.prototype.prependOnceListener = function(e, t) {
1820
+ S.prototype.prependOnceListener = function(e, t) {
1821
1821
  return ge(t), this.prependListener(e, yt(this, e, t)), this;
1822
1822
  };
1823
- A.prototype.removeListener = function(e, t) {
1823
+ S.prototype.removeListener = function(e, t) {
1824
1824
  var s, i, r, o, n;
1825
1825
  if (ge(t), i = this._events, i === void 0)
1826
1826
  return this;
@@ -1840,8 +1840,8 @@ A.prototype.removeListener = function(e, t) {
1840
1840
  }
1841
1841
  return this;
1842
1842
  };
1843
- A.prototype.off = A.prototype.removeListener;
1844
- A.prototype.removeAllListeners = function(e) {
1843
+ S.prototype.off = S.prototype.removeListener;
1844
+ S.prototype.removeAllListeners = function(e) {
1845
1845
  var t, s, i;
1846
1846
  if (s = this._events, s === void 0)
1847
1847
  return this;
@@ -1867,16 +1867,16 @@ function vt(h, e, t) {
1867
1867
  var i = s[e];
1868
1868
  return i === void 0 ? [] : typeof i == "function" ? t ? [i.listener || i] : [i] : t ? xs(i) : Ot(i, i.length);
1869
1869
  }
1870
- A.prototype.listeners = function(e) {
1870
+ S.prototype.listeners = function(e) {
1871
1871
  return vt(this, e, !0);
1872
1872
  };
1873
- A.prototype.rawListeners = function(e) {
1873
+ S.prototype.rawListeners = function(e) {
1874
1874
  return vt(this, e, !1);
1875
1875
  };
1876
- A.listenerCount = function(h, e) {
1876
+ S.listenerCount = function(h, e) {
1877
1877
  return typeof h.listenerCount == "function" ? h.listenerCount(e) : Ct.call(h, e);
1878
1878
  };
1879
- A.prototype.listenerCount = Ct;
1879
+ S.prototype.listenerCount = Ct;
1880
1880
  function Ct(h) {
1881
1881
  var e = this._events;
1882
1882
  if (e !== void 0) {
@@ -1888,7 +1888,7 @@ function Ct(h) {
1888
1888
  }
1889
1889
  return 0;
1890
1890
  }
1891
- A.prototype.eventNames = function() {
1891
+ S.prototype.eventNames = function() {
1892
1892
  return this._eventsCount > 0 ? ue(this._events) : [];
1893
1893
  };
1894
1894
  function Ot(h, e) {
@@ -1930,8 +1930,8 @@ function Et(h, e, t, s) {
1930
1930
  else
1931
1931
  throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof h);
1932
1932
  }
1933
- var ye = Se.exports;
1934
- let As = class {
1933
+ var ye = Ae.exports;
1934
+ let Ss = class {
1935
1935
  constructor() {
1936
1936
  this.mask = 1;
1937
1937
  }
@@ -1962,7 +1962,7 @@ class ee {
1962
1962
  this.event = new ye.EventEmitter(), this.controllerMap = /* @__PURE__ */ new Map(), this.activeIndex = -1, this.activeControllerSet = /* @__PURE__ */ new Set();
1963
1963
  }
1964
1964
  addController(e, t) {
1965
- const s = new As();
1965
+ const s = new Ss();
1966
1966
  return s.disableAll(), t !== void 0 && s.set(t), this.controllerMap.set(e, s), t === this.activeIndex && this.activeControllerSet.add(e), e;
1967
1967
  }
1968
1968
  removePage(e, t) {
@@ -1997,7 +1997,7 @@ const Tt = {
1997
1997
  far: 1e3,
1998
1998
  up: new I(0, 1, 0)
1999
1999
  };
2000
- class Ss extends ee {
2000
+ class As extends ee {
2001
2001
  constructor(e) {
2002
2002
  super(), this.width = 0, this.height = 0, this.width = e.width, this.height = e.height;
2003
2003
  }
@@ -3080,7 +3080,7 @@ class ei extends mt {
3080
3080
  super(e);
3081
3081
  }
3082
3082
  load(e, t, s, i) {
3083
- const r = new Ae(this.manager);
3083
+ const r = new Se(this.manager);
3084
3084
  r.setResponseType("blob"), r.setRequestHeader(this.requestHeader), r.setPath(this.path), r.setWithCredentials(this.withCredentials), r.load(
3085
3085
  e,
3086
3086
  (o) => {
@@ -3106,7 +3106,7 @@ class rt extends mt {
3106
3106
  load(e, t, s, i) {
3107
3107
  let r, o;
3108
3108
  this.options.type === "image" ? (o = document.createElement("img"), r = new fe(o)) : this.options.type === "video" ? (o = document.createElement("video"), o.preload = "auto", o.autoplay = !1, o.loop = !1, o.muted = !0, o.setAttribute("webkit-playsinline", "webkit-playsinline"), o.setAttribute("playsinline", ""), r = new Jt(o)) : r = new fe();
3109
- const n = new Ae(this.manager);
3109
+ const n = new Se(this.manager);
3110
3110
  return n.setResponseType("blob"), n.setRequestHeader(this.requestHeader), n.setPath(this.path), n.setWithCredentials(this.withCredentials), n.load(
3111
3111
  e,
3112
3112
  (a) => {
@@ -3199,7 +3199,7 @@ class si {
3199
3199
  if (e === "gzipJson")
3200
3200
  return this.gzipJsonLoader || (this.gzipJsonLoader = new ei(this.loadingManager), this.options.prefix && this.gzipJsonLoader.setPath(this.options.prefix)), this.gzipJsonLoader;
3201
3201
  if (e === "json")
3202
- return this.jsonLoader || (this.jsonLoader = new Ae(this.loadingManager), this.jsonLoader.setResponseType("json"), this.options.prefix && this.jsonLoader.setPath(this.options.prefix)), this.jsonLoader;
3202
+ return this.jsonLoader || (this.jsonLoader = new Se(this.loadingManager), this.jsonLoader.setResponseType("json"), this.options.prefix && this.jsonLoader.setPath(this.options.prefix)), this.jsonLoader;
3203
3203
  if (e === "exr")
3204
3204
  return this.exrLoader || (this.exrLoader = new fs(this.loadingManager), this.options.prefix && this.exrLoader.setPath(this.options.prefix)), this.exrLoader;
3205
3205
  }
@@ -3247,7 +3247,6 @@ class si {
3247
3247
  try {
3248
3248
  const c = yield o.loadAsync(e);
3249
3249
  if (this.assets.set(e, c), r.resolve(c), s === "images" || s === "media" || s === "exr" || s === "lottie") {
3250
- (t == null ? void 0 : t.colorCorrection) !== !1 && gs({ texture: c });
3251
3250
  const f = (a = t == null ? void 0 : t.anisotropy) != null ? a : this.options.anisotropy;
3252
3251
  c.anisotropy = f;
3253
3252
  }
@@ -3347,9 +3346,9 @@ class oi {
3347
3346
  return t || console.warn(`Material with key "${e}" not found.`), t;
3348
3347
  }
3349
3348
  getByName(e) {
3350
- for (const [t, s] of this.materials.entries())
3351
- if (s.name === e)
3352
- return s;
3349
+ for (const [, t] of this.materials.entries())
3350
+ if (t.name === e)
3351
+ return t;
3353
3352
  console.warn(`Material with name "${e}" not found.`);
3354
3353
  }
3355
3354
  getKey(e) {
@@ -3413,16 +3412,17 @@ class oi {
3413
3412
  const t = e.object3d;
3414
3413
  if (!t.material)
3415
3414
  return;
3415
+ this.applyColorSpaceToMaterials(t.material);
3416
3416
  const s = (o) => {
3417
- if (o.hasOwnProperty("__isProxy"))
3417
+ if ("__isProxy" in o)
3418
3418
  return o;
3419
3419
  const n = new Proxy(o, {
3420
3420
  set: (a, c, f) => {
3421
- if (typeof c == "string" && !isNaN(Number(c))) {
3421
+ if (typeof c == "string" && !Number.isNaN(Number(c))) {
3422
3422
  const m = Number(c);
3423
3423
  if (m >= 0 && m < a.length) {
3424
3424
  const v = a[m];
3425
- return this.rmBaseObjectMap(e, v), a[m] = f, f && this.addBaseObjectMap(e), !0;
3425
+ return this.rmBaseObjectMap(e, v), a[m] = f, f && (this.applyColorSpaceToMaterials(f), this.addBaseObjectMap(e)), !0;
3426
3426
  }
3427
3427
  }
3428
3428
  return a[c] = f, !0;
@@ -3433,11 +3433,13 @@ class oi {
3433
3433
  enumerable: !1
3434
3434
  }), n;
3435
3435
  };
3436
- e.materialList && (e.materialList = new Proxy(e.materialList, {
3436
+ e.materialList && (Object.values(e.materialList).forEach((o) => {
3437
+ o && this.applyColorSpaceToMaterials(o);
3438
+ }), e.materialList = new Proxy(e.materialList, {
3437
3439
  set: (o, n, a) => {
3438
3440
  if (typeof n == "string") {
3439
3441
  const c = o[n];
3440
- return this.rmBaseObjectMap(e, c), o[n] = a, a && this.addBaseObjectMap(e), !0;
3442
+ return this.rmBaseObjectMap(e, c), o[n] = a, a && (this.applyColorSpaceToMaterials(a), this.addBaseObjectMap(e)), !0;
3441
3443
  }
3442
3444
  return o[n] = a, !0;
3443
3445
  },
@@ -3480,7 +3482,7 @@ class oi {
3480
3482
  t[r] = o;
3481
3483
  return;
3482
3484
  }
3483
- this.rmBaseObjectMap(e), t[r] = o, this.addBaseObjectMap(e);
3485
+ this.rmBaseObjectMap(e), t[r] = o, o && this.applyColorSpaceToMaterials(o), this.addBaseObjectMap(e);
3484
3486
  }
3485
3487
  e.handleMaterialChange(o);
3486
3488
  },
@@ -3488,6 +3490,9 @@ class oi {
3488
3490
  configurable: !0
3489
3491
  });
3490
3492
  }
3493
+ applyColorSpaceToMaterials(e) {
3494
+ gs({ material: e });
3495
+ }
3491
3496
  material2array(e) {
3492
3497
  return Array.isArray(e) ? e : [e];
3493
3498
  }
@@ -3520,11 +3525,12 @@ class oi {
3520
3525
  n !== -1 && (o[n] = t);
3521
3526
  } else o === e && (r.material = t);
3522
3527
  i.materialList && Object.keys(i.materialList).forEach((n) => {
3523
- const a = i.materialList[n];
3528
+ var c;
3529
+ const a = (c = i.materialList) == null ? void 0 : c[n];
3524
3530
  if (Array.isArray(a)) {
3525
- const c = a.indexOf(e);
3526
- c !== -1 && (a[c] = t);
3527
- } else a === e && (i.materialList[n] = t);
3531
+ const f = a.indexOf(e);
3532
+ f !== -1 && (a[f] = t);
3533
+ } else a === e && i.materialList && (i.materialList[n] = t);
3528
3534
  });
3529
3535
  });
3530
3536
  }
@@ -3923,7 +3929,7 @@ const _e = class _e {
3923
3929
  })
3924
3930
  });
3925
3931
  this.rendererController = f;
3926
- const m = new Ss({
3932
+ const m = new As({
3927
3933
  width: a,
3928
3934
  height: c
3929
3935
  }), v = new ci({}), p = new Ys({
@@ -1 +1 @@
1
- "use strict";const e={linearSRGB:"srgb-linear",sRGB:"srgb"},a={map:e.sRGB,sheenColorMap:e.sRGB,specularColorMap:e.sRGB,emissiveMap:e.sRGB,envMap:e.sRGB};function i({node:r,material:o,texture:t}){n({node:r,material:o,texture:t}).forEach(l)}function n({node:r,material:o,texture:t}){return t?[{map:t}]:o?Array.isArray(o)?o:[o]:r!=null&&r.material?Array.isArray(r.material)?r.material:[r.material]:[]}function l(r){Object.keys(a).forEach(t=>{const s=r;s[t]&&(s[t].colorSpace=a[t])})}function c(r){return Object.prototype.toString.call(r)==="[object Object]"}function f(r){if(c(r)===!1)return!1;const o=r.constructor;if(o===void 0)return!0;const t=o.prototype;return!(c(t)===!1||t.hasOwnProperty("isPrototypeOf")===!1)}exports.ColorSpace=e;exports.colorCorrection=i;exports.isPlainObject=f;
1
+ "use strict";const t=require("three"),r={linearSRGB:t.LinearSRGBColorSpace,sRGB:t.SRGBColorSpace,none:t.NoColorSpace},c={map:r.sRGB,emissiveMap:r.sRGB,sheenColorMap:r.sRGB,specularColorMap:r.sRGB,normalMap:r.none,bumpMap:r.none,displacementMap:r.none,roughnessMap:r.none,metalnessMap:r.none,aoMap:r.none,lightMap:r.none,alphaMap:r.none,specularIntensityMap:r.none,clearcoatMap:r.none,clearcoatNormalMap:r.none,clearcoatRoughnessMap:r.none,iridescenceMap:r.none,iridescenceThicknessMap:r.none,sheenRoughnessMap:r.none,specularMap:r.none,thicknessMap:r.none,transmissionMap:r.none},p=[".hdr",".exr",".rgbe"];function l(e){if(e.userData&&typeof e.userData.isHDR=="boolean")return e.userData.isHDR;if(e.colorSpace===t.LinearSRGBColorSpace)return!0;if(!e.image||!e.image.src)return!1;const n=typeof e.image.src=="string"?e.image.src:"";return p.some(a=>n.toLowerCase().includes(a))}function u(e){return l(e)?r.linearSRGB:r.sRGB}function f({node:e,material:n,texture:a}){M({node:e,material:n,texture:a}).forEach(s=>S(s))}function M({node:e,material:n,texture:a}){return a?[{map:a}]:n?Array.isArray(n)?n:[n]:e!=null&&e.material?Array.isArray(e.material)?e.material:[e.material]:[]}function S(e){Object.keys(c).forEach(o=>{const s=e;s[o]&&(s[o].colorSpace=c[o])});const a=e;a.envMap&&(a.envMap.colorSpace=u(a.envMap))}function i(e){return Object.prototype.toString.call(e)==="[object Object]"}function R(e){if(i(e)===!1)return!1;const n=e.constructor;if(n===void 0)return!0;const a=n.prototype;return!(i(a)===!1||a.hasOwnProperty("isPrototypeOf")===!1)}exports.ColorSpace=r;exports.applyTextureColorSpace=f;exports.isPlainObject=R;
@@ -1,45 +1,104 @@
1
- const e = {
2
- linearSRGB: "srgb-linear",
3
- sRGB: "srgb"
4
- }, a = {
5
- map: e.sRGB,
6
- sheenColorMap: e.sRGB,
7
- specularColorMap: e.sRGB,
8
- emissiveMap: e.sRGB,
9
- envMap: e.sRGB
10
- };
11
- function l({
12
- node: r,
13
- material: s,
14
- texture: t
1
+ import { LinearSRGBColorSpace as i, SRGBColorSpace as p, NoColorSpace as l } from "three";
2
+ const a = {
3
+ linearSRGB: i,
4
+ sRGB: p,
5
+ none: l
6
+ }, t = {
7
+ // 颜色纹理 - 使用 sRGB 颜色空间
8
+ map: a.sRGB,
9
+ // 漫反射贴图
10
+ emissiveMap: a.sRGB,
11
+ // 自发光贴图
12
+ sheenColorMap: a.sRGB,
13
+ // 光泽颜色贴图
14
+ specularColorMap: a.sRGB,
15
+ // 镜面反射颜色贴图
16
+ // 数据纹理 - 使用线性颜色空间(存储非颜色数据)
17
+ normalMap: a.none,
18
+ // 法线贴图
19
+ bumpMap: a.none,
20
+ // 凹凸贴图
21
+ displacementMap: a.none,
22
+ // 位移贴图
23
+ roughnessMap: a.none,
24
+ // 粗糙度贴图
25
+ metalnessMap: a.none,
26
+ // 金属度贴图
27
+ aoMap: a.none,
28
+ // 环境光遮蔽贴图
29
+ lightMap: a.none,
30
+ // 光照贴图
31
+ alphaMap: a.none,
32
+ // 透明度贴图
33
+ specularIntensityMap: a.none,
34
+ // 镜面反射强度贴图
35
+ clearcoatMap: a.none,
36
+ // 清漆贴图
37
+ clearcoatNormalMap: a.none,
38
+ // 清漆法线贴图
39
+ clearcoatRoughnessMap: a.none,
40
+ // 清漆粗糙度贴图
41
+ iridescenceMap: a.none,
42
+ // 彩虹贴图
43
+ iridescenceThicknessMap: a.none,
44
+ // 彩虹厚度贴图
45
+ sheenRoughnessMap: a.none,
46
+ // 光泽粗糙度贴图
47
+ specularMap: a.none,
48
+ // 镜面反射贴图(强度)
49
+ thicknessMap: a.none,
50
+ // 厚度贴图
51
+ transmissionMap: a.none
52
+ // 透射贴图
53
+ }, u = [".hdr", ".exr", ".rgbe"];
54
+ function f(e) {
55
+ if (e.userData && typeof e.userData.isHDR == "boolean")
56
+ return e.userData.isHDR;
57
+ if (e.colorSpace === i)
58
+ return !0;
59
+ if (!e.image || !e.image.src) return !1;
60
+ const n = typeof e.image.src == "string" ? e.image.src : "";
61
+ return u.some((r) => n.toLowerCase().includes(r));
62
+ }
63
+ function M(e) {
64
+ return f(e) ? a.linearSRGB : a.sRGB;
65
+ }
66
+ function h({
67
+ node: e,
68
+ material: n,
69
+ texture: r
15
70
  }) {
16
- i({ node: r, material: s, texture: t }).forEach(n);
71
+ S({ node: e, material: n, texture: r }).forEach((s) => m(s));
17
72
  }
18
- function i({
19
- node: r,
20
- material: s,
21
- texture: t
73
+ function S({
74
+ node: e,
75
+ material: n,
76
+ texture: r
22
77
  }) {
23
- return t ? [{ map: t }] : s ? Array.isArray(s) ? s : [s] : r != null && r.material ? Array.isArray(r.material) ? r.material : [r.material] : [];
78
+ return r ? [{ map: r }] : n ? Array.isArray(n) ? n : [n] : e != null && e.material ? Array.isArray(e.material) ? e.material : [e.material] : [];
24
79
  }
25
- function n(r) {
26
- Object.keys(a).forEach((t) => {
27
- const o = r;
28
- o[t] && (o[t].colorSpace = a[t]);
80
+ function m(e) {
81
+ Object.keys(t).forEach((o) => {
82
+ const s = e;
83
+ s[o] && (s[o].colorSpace = t[o]);
29
84
  });
85
+ const r = e;
86
+ r.envMap && (r.envMap.colorSpace = M(
87
+ r.envMap
88
+ ));
30
89
  }
31
- function c(r) {
32
- return Object.prototype.toString.call(r) === "[object Object]";
90
+ function c(e) {
91
+ return Object.prototype.toString.call(e) === "[object Object]";
33
92
  }
34
- function f(r) {
35
- if (c(r) === !1) return !1;
36
- const s = r.constructor;
37
- if (s === void 0) return !0;
38
- const t = s.prototype;
39
- return !(c(t) === !1 || t.hasOwnProperty("isPrototypeOf") === !1);
93
+ function y(e) {
94
+ if (c(e) === !1) return !1;
95
+ const n = e.constructor;
96
+ if (n === void 0) return !0;
97
+ const r = n.prototype;
98
+ return !(c(r) === !1 || r.hasOwnProperty("isPrototypeOf") === !1);
40
99
  }
41
100
  export {
42
- e as C,
43
- l as c,
44
- f as i
101
+ a as C,
102
+ h as a,
103
+ y as i
45
104
  };