gl-draw 0.14.18 → 0.14.21

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.
@@ -40,8 +40,8 @@ import { TransformControls as Rt } from "three/examples/jsm/controls/TransformCo
40
40
  import { EffectComposer as Me } from "three/examples/jsm/postprocessing/EffectComposer";
41
41
  import { RenderPass as Ut } from "three/examples/jsm/postprocessing/RenderPass";
42
42
  import { SSAOPass as zt } from "three/examples/jsm/postprocessing/SSAOPass";
43
- import { FullScreenQuad as Ft } from "three/examples/jsm/postprocessing/Pass";
44
- import { OutputPass as kt } from "three/examples/jsm/postprocessing/OutputPass";
43
+ import { FullScreenQuad as kt } from "three/examples/jsm/postprocessing/Pass";
44
+ import { OutputPass as Ft } from "three/examples/jsm/postprocessing/OutputPass";
45
45
  import { ShaderPass as Nt } from "three/examples/jsm/postprocessing/ShaderPass";
46
46
  import { UnrealBloomPass as Ht } from "three/examples/jsm/postprocessing/UnrealBloomPass";
47
47
  import "three/examples/jsm/renderers/CSS2DRenderer";
@@ -96,7 +96,7 @@ function j(l) {
96
96
  return l.isOrthographicCamera;
97
97
  }
98
98
  const W = Math.PI * 2, Ue = Math.PI / 2, tt = 1e-5, ee = Math.PI / 180;
99
- function k(l, e, t) {
99
+ function F(l, e, t) {
100
100
  return Math.max(e, Math.min(t, l));
101
101
  }
102
102
  function M(l, e = tt) {
@@ -119,13 +119,13 @@ function he(l, e, t, s, i = 1 / 0, r) {
119
119
  const o = 2 / s, a = o * r, h = 1 / (1 + a + 0.48 * a * a + 0.235 * a * a * a);
120
120
  let d = l - e;
121
121
  const f = e, p = i * s;
122
- d = k(d, -p, p), e = l - d;
122
+ d = F(d, -p, p), e = l - d;
123
123
  const y = (t.value + o * d) * r;
124
124
  t.value = (t.value - o * y) * h;
125
125
  let v = e + (d + y) * h;
126
126
  return f - l > 0 == v > f && (v = f, t.value = (v - f) / r), v;
127
127
  }
128
- function Fe(l, e, t, s, i = 1 / 0, r, o) {
128
+ function ke(l, e, t, s, i = 1 / 0, r, o) {
129
129
  s = Math.max(1e-4, s);
130
130
  const a = 2 / s, h = a * r, d = 1 / (1 + h + 0.48 * h * h + 0.235 * h * h * h);
131
131
  let f = e.x, p = e.y, y = e.z, v = l.x - f, m = l.y - p, u = l.z - y;
@@ -213,7 +213,7 @@ class Bt {
213
213
  }
214
214
  }
215
215
  const le = 1 / 8, Zt = /Mac/.test(navigator.platform);
216
- let x, ke, ce, Oe, U, b, L, G, ie, N, H, B, Ne, He, F, re, K, Ie, Te, je, xe, we, de;
216
+ let x, Fe, ce, Oe, U, b, L, G, ie, N, H, B, Ne, He, k, re, K, Ie, Te, je, xe, we, de;
217
217
  class $ extends Bt {
218
218
  /**
219
219
  * Injects THREE as the dependency. You can then proceed to use CameraControls.
@@ -256,7 +256,7 @@ class $ extends Bt {
256
256
  * @category Statics
257
257
  */
258
258
  static install(e) {
259
- x = e.THREE, ke = Object.freeze(new x.Vector3(0, 0, 0)), ce = Object.freeze(new x.Vector3(0, 1, 0)), Oe = Object.freeze(new x.Vector3(0, 0, 1)), U = new x.Vector2(), b = new x.Vector3(), L = new x.Vector3(), G = new x.Vector3(), ie = new x.Vector3(), N = new x.Vector3(), H = new x.Vector3(), B = new x.Vector3(), Ne = new x.Vector3(), He = new x.Vector3(), F = new x.Spherical(), re = new x.Spherical(), K = new x.Box3(), Ie = new x.Box3(), Te = new x.Sphere(), je = new x.Quaternion(), xe = new x.Quaternion(), we = new x.Matrix4(), de = new x.Raycaster();
259
+ x = e.THREE, Fe = Object.freeze(new x.Vector3(0, 0, 0)), ce = Object.freeze(new x.Vector3(0, 1, 0)), Oe = Object.freeze(new x.Vector3(0, 0, 1)), U = new x.Vector2(), b = new x.Vector3(), L = new x.Vector3(), G = new x.Vector3(), ie = new x.Vector3(), N = new x.Vector3(), H = new x.Vector3(), B = new x.Vector3(), Ne = new x.Vector3(), He = new x.Vector3(), k = new x.Spherical(), re = new x.Spherical(), K = new x.Box3(), Ie = new x.Box3(), Te = new x.Sphere(), je = new x.Quaternion(), xe = new x.Quaternion(), we = new x.Matrix4(), de = new x.Raycaster();
260
260
  }
261
261
  /**
262
262
  * list all ACTIONs
@@ -309,7 +309,7 @@ class $ extends Bt {
309
309
  const E = W * this.azimuthRotateSpeed * n / this._elementRect.height, C = W * this.polarRotateSpeed * g / this._elementRect.height;
310
310
  this.rotate(E, C, !0);
311
311
  }, this._dollyInternal = (n, g, E) => {
312
- const C = Math.pow(0.95, -n * this.dollySpeed), w = this._sphericalEnd.radius, T = this._sphericalEnd.radius * C, P = k(
312
+ const C = Math.pow(0.95, -n * this.dollySpeed), w = this._sphericalEnd.radius, T = this._sphericalEnd.radius * C, P = F(
313
313
  T,
314
314
  this.minDistance,
315
315
  this.maxDistance
@@ -687,11 +687,11 @@ class $ extends Bt {
687
687
  * @category Properties
688
688
  */
689
689
  set interactiveArea(e) {
690
- this._interactiveArea.width = k(e.width, 0, 1), this._interactiveArea.height = k(e.height, 0, 1), this._interactiveArea.x = k(
690
+ this._interactiveArea.width = F(e.width, 0, 1), this._interactiveArea.height = F(e.height, 0, 1), this._interactiveArea.x = F(
691
691
  e.x,
692
692
  0,
693
693
  1 - this._interactiveArea.width
694
- ), this._interactiveArea.y = k(
694
+ ), this._interactiveArea.y = F(
695
695
  e.y,
696
696
  0,
697
697
  1 - this._interactiveArea.height
@@ -829,11 +829,11 @@ class $ extends Bt {
829
829
  */
830
830
  rotateTo(e, t, s = !1) {
831
831
  this._isUserControllingRotate = !1;
832
- const i = k(
832
+ const i = F(
833
833
  e,
834
834
  this.minAzimuthAngle,
835
835
  this.maxAzimuthAngle
836
- ), r = k(t, this.minPolarAngle, this.maxPolarAngle);
836
+ ), r = F(t, this.minPolarAngle, this.maxPolarAngle);
837
837
  this._sphericalEnd.theta = i, this._sphericalEnd.phi = r, this._sphericalEnd.makeSafe(), this._needsUpdate = !0, s || (this._spherical.theta = this._sphericalEnd.theta, this._spherical.phi = this._sphericalEnd.phi);
838
838
  const o = !s || S(
839
839
  this._spherical.theta,
@@ -863,7 +863,7 @@ class $ extends Bt {
863
863
  */
864
864
  dollyTo(e, t = !1) {
865
865
  return this._isUserControllingDolly = !1, this._lastDollyDirection = Z.NONE, this._changedDolly = 0, this._dollyToNoClamp(
866
- k(e, this.minDistance, this.maxDistance),
866
+ F(e, this.minDistance, this.maxDistance),
867
867
  t
868
868
  );
869
869
  }
@@ -921,7 +921,7 @@ class $ extends Bt {
921
921
  * @category Methods
922
922
  */
923
923
  zoomTo(e, t = !1) {
924
- this._isUserControllingZoom = !1, this._zoomEnd = k(e, this.minZoom, this.maxZoom), this._needsUpdate = !0, t || (this._zoom = this._zoomEnd);
924
+ this._isUserControllingZoom = !1, this._zoomEnd = F(e, this.minZoom, this.maxZoom), this._needsUpdate = !0, t || (this._zoom = this._zoomEnd);
925
925
  const s = !t || S(this._zoom, this._zoomEnd, this.restThreshold);
926
926
  return this._changedZoom = 0, this._createOnRestPromise(s);
927
927
  }
@@ -1128,18 +1128,18 @@ class $ extends Bt {
1128
1128
  lerpLookAt(e, t, s, i, r, o, a, h, d, f, p, y, v, m = !1) {
1129
1129
  this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = Z.NONE, this._changedDolly = 0;
1130
1130
  const u = b.set(i, r, o), _ = L.set(e, t, s);
1131
- F.setFromVector3(
1131
+ k.setFromVector3(
1132
1132
  _.sub(u).applyQuaternion(this._yAxisUpSpace)
1133
1133
  );
1134
1134
  const n = G.set(f, p, y), g = L.set(a, h, d);
1135
1135
  re.setFromVector3(
1136
1136
  g.sub(n).applyQuaternion(this._yAxisUpSpace)
1137
1137
  ), this._targetEnd.copy(u.lerp(n, v));
1138
- const E = re.theta - F.theta, C = re.phi - F.phi, w = re.radius - F.radius;
1138
+ const E = re.theta - k.theta, C = re.phi - k.phi, w = re.radius - k.radius;
1139
1139
  this._sphericalEnd.set(
1140
- F.radius + w * v,
1141
- F.phi + C * v,
1142
- F.theta + E * v
1140
+ k.radius + w * v,
1141
+ k.phi + C * v,
1142
+ k.theta + E * v
1143
1143
  ), this.normalizeRotations(), this._needsUpdate = !0, m || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
1144
1144
  const T = !m || S(this._target.x, this._targetEnd.x, this.restThreshold) && S(this._target.y, this._targetEnd.y, this.restThreshold) && S(this._target.z, this._targetEnd.z, this.restThreshold) && S(
1145
1145
  this._spherical.theta,
@@ -1195,7 +1195,7 @@ class $ extends Bt {
1195
1195
  s,
1196
1196
  i
1197
1197
  );
1198
- return this._sphericalEnd.phi = k(
1198
+ return this._sphericalEnd.phi = F(
1199
1199
  this._sphericalEnd.phi,
1200
1200
  this.minPolarAngle,
1201
1201
  this.maxPolarAngle
@@ -1456,7 +1456,7 @@ class $ extends Bt {
1456
1456
  this._targetVelocity.set(0, 0, 0), this._target.copy(this._targetEnd);
1457
1457
  else {
1458
1458
  const p = this._isUserControllingTruck ? this.draggingSmoothTime : this.smoothTime;
1459
- Fe(
1459
+ ke(
1460
1460
  this._target,
1461
1461
  this._targetEnd,
1462
1462
  this._targetVelocity,
@@ -1470,7 +1470,7 @@ class $ extends Bt {
1470
1470
  this._focalOffsetVelocity.set(0, 0, 0), this._focalOffset.copy(this._focalOffsetEnd);
1471
1471
  else {
1472
1472
  const p = this._isUserControllingOffset ? this.draggingSmoothTime : this.smoothTime;
1473
- Fe(
1473
+ ke(
1474
1474
  this._focalOffset,
1475
1475
  this._focalOffsetEnd,
1476
1476
  this._focalOffsetVelocity,
@@ -1573,9 +1573,9 @@ class $ extends Bt {
1573
1573
  */
1574
1574
  fromJSON(e, t = !1) {
1575
1575
  const s = JSON.parse(e);
1576
- this.enabled = s.enabled, this.minDistance = s.minDistance, this.maxDistance = se(s.maxDistance), this.minZoom = s.minZoom, this.maxZoom = se(s.maxZoom), this.minPolarAngle = s.minPolarAngle, this.maxPolarAngle = se(s.maxPolarAngle), this.minAzimuthAngle = se(s.minAzimuthAngle), this.maxAzimuthAngle = se(s.maxAzimuthAngle), this.smoothTime = s.smoothTime, this.draggingSmoothTime = s.draggingSmoothTime, this.dollySpeed = s.dollySpeed, this.truckSpeed = s.truckSpeed, this.dollyToCursor = s.dollyToCursor, this._target0.fromArray(s.target0), this._position0.fromArray(s.position0), this._zoom0 = s.zoom0, this._focalOffset0.fromArray(s.focalOffset0), this.moveTo(s.target[0], s.target[1], s.target[2], t), F.setFromVector3(
1576
+ this.enabled = s.enabled, this.minDistance = s.minDistance, this.maxDistance = se(s.maxDistance), this.minZoom = s.minZoom, this.maxZoom = se(s.maxZoom), this.minPolarAngle = s.minPolarAngle, this.maxPolarAngle = se(s.maxPolarAngle), this.minAzimuthAngle = se(s.minAzimuthAngle), this.maxAzimuthAngle = se(s.maxAzimuthAngle), this.smoothTime = s.smoothTime, this.draggingSmoothTime = s.draggingSmoothTime, this.dollySpeed = s.dollySpeed, this.truckSpeed = s.truckSpeed, this.dollyToCursor = s.dollyToCursor, this._target0.fromArray(s.target0), this._position0.fromArray(s.position0), this._zoom0 = s.zoom0, this._focalOffset0.fromArray(s.focalOffset0), this.moveTo(s.target[0], s.target[1], s.target[2], t), k.setFromVector3(
1577
1577
  b.fromArray(s.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)
1578
- ), this.rotateTo(F.theta, F.phi, t), this.dollyTo(F.radius, t), this.zoomTo(s.zoom, t), this.setFocalOffset(
1578
+ ), this.rotateTo(k.theta, k.phi, t), this.dollyTo(k.radius, t), this.zoomTo(s.zoom, t), this.setFocalOffset(
1579
1579
  s.focalOffset[0],
1580
1580
  s.focalOffset[1],
1581
1581
  s.focalOffset[2],
@@ -1658,7 +1658,7 @@ class $ extends Bt {
1658
1658
  if (!(this.colliderMeshes.length >= 1) || Ee(this._camera, "_collisionTest"))
1659
1659
  return e;
1660
1660
  const s = this._getTargetDirection(ie);
1661
- we.lookAt(ke, s, this._camera.up);
1661
+ we.lookAt(Fe, s, this._camera.up);
1662
1662
  for (let i = 0; i < 4; i++) {
1663
1663
  const r = L.copy(this._nearPlaneCorners[i]);
1664
1664
  r.applyMatrix4(we);
@@ -2657,7 +2657,7 @@ const us = {
2657
2657
  }`
2658
2658
  )
2659
2659
  };
2660
- class fs extends kt {
2660
+ class fs extends Ft {
2661
2661
  constructor() {
2662
2662
  super();
2663
2663
  const e = us;
@@ -2666,7 +2666,7 @@ class fs extends kt {
2666
2666
  uniforms: this.uniforms,
2667
2667
  vertexShader: e.vertexShader,
2668
2668
  fragmentShader: e.fragmentShader
2669
- }), this.fsQuad = new Ft(this.material);
2669
+ }), this.fsQuad = new kt(this.material);
2670
2670
  }
2671
2671
  }
2672
2672
  const _s = (l) => {
@@ -3375,6 +3375,12 @@ class Us extends Rs {
3375
3375
  throw new Error(`Unrecognized:${e}`);
3376
3376
  });
3377
3377
  }
3378
+ changeBaseObjectKey(e, t, s = !0) {
3379
+ const i = e.key;
3380
+ this.objects.delete(i);
3381
+ const [r] = i.split("#"), o = s ? `${r}#${t}` : `${t}`;
3382
+ this.objects.set(o, e), e.key = o;
3383
+ }
3378
3384
  addBaseObject(e, t, s) {
3379
3385
  return J(this, null, function* () {
3380
3386
  return yield e.create(), e.object3d && (s && e.setTop(s), t !== null && (t.add(e.object3d), this.objMap.set(e.object3d, e))), e.render(), e;