belowjs 1.4.2 → 1.5.0
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/CHANGELOG.md +23 -0
- package/README.md +3 -3
- package/dist/belowjs.css +1 -1
- package/dist/belowjs.js +1185 -714
- package/package.json +1 -1
package/dist/belowjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { Controls as Oi, Vector3 as
|
|
3
|
-
class
|
|
1
|
+
import * as g from "three";
|
|
2
|
+
import { Controls as Oi, Vector3 as L, MOUSE as Ce, TOUCH as pe, Quaternion as Ve, Spherical as Dt, Vector2 as V, Ray as Hi, Plane as qi, MathUtils as Bt, TrianglesDrawMode as ji, TriangleFanDrawMode as ht, TriangleStripDrawMode as li, Loader as yt, LoaderUtils as ve, FileLoader as le, MeshPhysicalMaterial as ee, Color as re, LinearSRGBColorSpace as Y, SRGBColorSpace as se, SpotLight as Ki, PointLight as zi, DirectionalLight as Yi, Matrix4 as Ie, InstancedMesh as ci, InstancedBufferAttribute as Ji, Object3D as He, TextureLoader as Wi, ImageBitmapLoader as Xi, BufferAttribute as Re, InterleavedBuffer as Zi, InterleavedBufferAttribute as Ae, LinearMipmapLinearFilter as qe, NearestMipmapLinearFilter as $i, LinearMipmapNearestFilter as es, NearestMipmapNearestFilter as ts, LinearFilter as he, NearestFilter as hi, RepeatWrapping as dt, MirroredRepeatWrapping as is, ClampToEdgeWrapping as ss, PointsMaterial as os, Material as ze, LineBasicMaterial as ns, MeshStandardMaterial as wt, DoubleSide as rs, MeshBasicMaterial as fe, PropertyBinding as as, BufferGeometry as di, SkinnedMesh as As, Mesh as St, LineSegments as ls, Line as cs, LineLoop as hs, Points as ds, Group as Ye, PerspectiveCamera as us, OrthographicCamera as gs, Skeleton as ps, AnimationClip as fs, Bone as ms, InterpolateDiscrete as bs, InterpolateLinear as ui, Texture as Lt, VectorKeyframeTrack as Tt, NumberKeyframeTrack as kt, QuaternionKeyframeTrack as Ft, ColorManagement as ut, FrontSide as Cs, Interpolant as Es, Box3 as je, Sphere as Qt, CompressedCubeTexture as Is, CompressedArrayTexture as Bs, CompressedTexture as gi, NoColorSpace as _t, RGBA_BPTC_Format as gt, RGBA_S3TC_DXT5_Format as pt, RGBA_S3TC_DXT3_Format as Gt, RGB_S3TC_DXT1_Format as Pt, RGBA_S3TC_DXT1_Format as ft, RGBA_ASTC_6x6_Format as Nt, RGBA_ASTC_4x4_Format as Pe, RGBA_ETC2_EAC_Format as pi, RGB_ETC2_Format as fi, RedFormat as Me, RGFormat as xe, RGBAFormat as me, UnsignedByteType as z, HalfFloatType as be, FloatType as De, DataTexture as ys, Data3DTexture as ws, RGB_PVRTC_4BPPV1_Format as Ss, RGB_ETC1_Format as Qs, RGBA_PVRTC_4BPPV1_Format as Ms, RGB_BPTC_UNSIGNED_Format as xs, SphereGeometry as mi, BoxGeometry as vs, DynamicDrawUsage as Rs, InstancedBufferGeometry as Ds, Float32BufferAttribute as Ut, InstancedInterleavedBuffer as mt, WireframeGeometry as Ls, ShaderMaterial as Ts, ShaderLib as Ne, UniformsUtils as bi, UniformsLib as Ue, Vector4 as Le, Line3 as ks } from "three";
|
|
3
|
+
class Te {
|
|
4
4
|
/**
|
|
5
5
|
* Creates a new EventSystem instance
|
|
6
6
|
*/
|
|
@@ -143,13 +143,13 @@ class Ke {
|
|
|
143
143
|
return Array.isArray(t) ? t.some((s) => i(e, s)) : i(e, t);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
class
|
|
146
|
+
class Fs {
|
|
147
147
|
constructor(e = {}) {
|
|
148
|
-
this.config = e, this.scene = new
|
|
148
|
+
this.config = e, this.scene = new g.Scene(), this.init();
|
|
149
149
|
}
|
|
150
150
|
init() {
|
|
151
151
|
let e = "#001122";
|
|
152
|
-
this.config.background && (typeof this.config.background == "object" && this.config.background.value ? e = this.config.background.value : typeof this.config.background == "string" && (e = this.config.background)), this.scene.background = new
|
|
152
|
+
this.config.background && (typeof this.config.background == "object" && this.config.background.value ? e = this.config.background.value : typeof this.config.background == "string" && (e = this.config.background)), this.scene.background = new g.Color(e);
|
|
153
153
|
}
|
|
154
154
|
add(e) {
|
|
155
155
|
this.scene.add(e);
|
|
@@ -164,7 +164,7 @@ class ks {
|
|
|
164
164
|
this.scene.clear();
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
const Vt = { type: "change" }, Mt = { type: "start" }, Ci = { type: "end" },
|
|
167
|
+
const Vt = { type: "change" }, Mt = { type: "start" }, Ci = { type: "end" }, ke = new Hi(), Ot = new qi(), _s = Math.cos(70 * Bt.DEG2RAD), F = new L(), U = 2 * Math.PI, v = {
|
|
168
168
|
NONE: -1,
|
|
169
169
|
ROTATE: 0,
|
|
170
170
|
DOLLY: 1,
|
|
@@ -182,7 +182,7 @@ class Gs extends Oi {
|
|
|
182
182
|
* @param {?HTMLDOMElement} domElement - The HTML element used for event listeners.
|
|
183
183
|
*/
|
|
184
184
|
constructor(e, t = null) {
|
|
185
|
-
super(e, t), this.state =
|
|
185
|
+
super(e, t), this.state = v.NONE, this.target = new L(), this.cursor = new L(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: Ce.ROTATE, MIDDLE: Ce.DOLLY, RIGHT: Ce.PAN }, this.touches = { ONE: pe.ROTATE, TWO: pe.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new L(), this._lastQuaternion = new Ve(), this._lastTargetPosition = new L(), this._quat = new Ve().setFromUnitVectors(e.up, new L(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new Dt(), this._sphericalDelta = new Dt(), this._scale = 1, this._panOffset = new L(), this._rotateStart = new V(), this._rotateEnd = new V(), this._rotateDelta = new V(), this._panStart = new V(), this._panEnd = new V(), this._panDelta = new V(), this._dollyStart = new V(), this._dollyEnd = new V(), this._dollyDelta = new V(), this._dollyDirection = new L(), this._mouse = new V(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = Ns.bind(this), this._onPointerDown = Ps.bind(this), this._onPointerUp = Us.bind(this), this._onContextMenu = zs.bind(this), this._onMouseWheel = Hs.bind(this), this._onKeyDown = qs.bind(this), this._onTouchStart = js.bind(this), this._onTouchMove = Ks.bind(this), this._onMouseDown = Vs.bind(this), this._onMouseMove = Os.bind(this), this._interceptControlDown = Ys.bind(this), this._interceptControlUp = Js.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
|
|
186
186
|
}
|
|
187
187
|
connect(e) {
|
|
188
188
|
super.connect(e), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointercancel", this._onPointerUp), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: !1 }), this.domElement.getRootNode().addEventListener("keydown", this._interceptControlDown, { passive: !0, capture: !0 }), this.domElement.style.touchAction = "none";
|
|
@@ -243,11 +243,11 @@ class Gs extends Oi {
|
|
|
243
243
|
* was called, or the initial state.
|
|
244
244
|
*/
|
|
245
245
|
reset() {
|
|
246
|
-
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(Vt), this.update(), this.state =
|
|
246
|
+
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(Vt), this.update(), this.state = v.NONE;
|
|
247
247
|
}
|
|
248
248
|
update(e = null) {
|
|
249
249
|
const t = this.object.position;
|
|
250
|
-
|
|
250
|
+
F.copy(t).sub(this.target), F.applyQuaternion(this._quat), this._spherical.setFromVector3(F), this.autoRotate && this.state === v.NONE && this._rotateLeft(this._getAutoRotationAngle(e)), this.enableDamping ? (this._spherical.theta += this._sphericalDelta.theta * this.dampingFactor, this._spherical.phi += this._sphericalDelta.phi * this.dampingFactor) : (this._spherical.theta += this._sphericalDelta.theta, this._spherical.phi += this._sphericalDelta.phi);
|
|
251
251
|
let i = this.minAzimuthAngle, s = this.maxAzimuthAngle;
|
|
252
252
|
isFinite(i) && isFinite(s) && (i < -Math.PI ? i += U : i > Math.PI && (i -= U), s < -Math.PI ? s += U : s > Math.PI && (s -= U), i <= s ? this._spherical.theta = Math.max(i, Math.min(s, this._spherical.theta)) : this._spherical.theta = this._spherical.theta > (i + s) / 2 ? Math.max(i, this._spherical.theta) : Math.min(s, this._spherical.theta)), this._spherical.phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, this._spherical.phi)), this._spherical.makeSafe(), this.enableDamping === !0 ? this.target.addScaledVector(this._panOffset, this.dampingFactor) : this.target.add(this._panOffset), this.target.sub(this.cursor), this.target.clampLength(this.minTargetRadius, this.maxTargetRadius), this.target.add(this.cursor);
|
|
253
253
|
let o = !1;
|
|
@@ -257,23 +257,23 @@ class Gs extends Oi {
|
|
|
257
257
|
const n = this._spherical.radius;
|
|
258
258
|
this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale), o = n != this._spherical.radius;
|
|
259
259
|
}
|
|
260
|
-
if (
|
|
260
|
+
if (F.setFromSpherical(this._spherical), F.applyQuaternion(this._quatInverse), t.copy(this.target).add(F), this.object.lookAt(this.target), this.enableDamping === !0 ? (this._sphericalDelta.theta *= 1 - this.dampingFactor, this._sphericalDelta.phi *= 1 - this.dampingFactor, this._panOffset.multiplyScalar(1 - this.dampingFactor)) : (this._sphericalDelta.set(0, 0, 0), this._panOffset.set(0, 0, 0)), this.zoomToCursor && this._performCursorZoom) {
|
|
261
261
|
let n = null;
|
|
262
262
|
if (this.object.isPerspectiveCamera) {
|
|
263
|
-
const r =
|
|
263
|
+
const r = F.length();
|
|
264
264
|
n = this._clampDistance(r * this._scale);
|
|
265
265
|
const A = r - n;
|
|
266
266
|
this.object.position.addScaledVector(this._dollyDirection, A), this.object.updateMatrixWorld(), o = !!A;
|
|
267
267
|
} else if (this.object.isOrthographicCamera) {
|
|
268
|
-
const r = new
|
|
268
|
+
const r = new L(this._mouse.x, this._mouse.y, 0);
|
|
269
269
|
r.unproject(this.object);
|
|
270
270
|
const A = this.object.zoom;
|
|
271
271
|
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), o = A !== this.object.zoom;
|
|
272
|
-
const a = new
|
|
273
|
-
a.unproject(this.object), this.object.position.sub(a).add(r), this.object.updateMatrixWorld(), n =
|
|
272
|
+
const a = new L(this._mouse.x, this._mouse.y, 0);
|
|
273
|
+
a.unproject(this.object), this.object.position.sub(a).add(r), this.object.updateMatrixWorld(), n = F.length();
|
|
274
274
|
} else
|
|
275
275
|
console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
|
|
276
|
-
n !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(n).add(this.object.position) : (
|
|
276
|
+
n !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(n).add(this.object.position) : (ke.origin.copy(this.object.position), ke.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(ke.direction)) < _s ? this.object.lookAt(this.target) : (Ot.setFromNormalAndCoplanarPoint(this.object.up, this.target), ke.intersectPlane(Ot, this.target))));
|
|
277
277
|
} else if (this.object.isOrthographicCamera) {
|
|
278
278
|
const n = this.object.zoom;
|
|
279
279
|
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), n !== this.object.zoom && (this.object.updateProjectionMatrix(), o = !0);
|
|
@@ -294,18 +294,18 @@ class Gs extends Oi {
|
|
|
294
294
|
this._sphericalDelta.phi -= e;
|
|
295
295
|
}
|
|
296
296
|
_panLeft(e, t) {
|
|
297
|
-
|
|
297
|
+
F.setFromMatrixColumn(t, 0), F.multiplyScalar(-e), this._panOffset.add(F);
|
|
298
298
|
}
|
|
299
299
|
_panUp(e, t) {
|
|
300
|
-
this.screenSpacePanning === !0 ?
|
|
300
|
+
this.screenSpacePanning === !0 ? F.setFromMatrixColumn(t, 1) : (F.setFromMatrixColumn(t, 0), F.crossVectors(this.object.up, F)), F.multiplyScalar(e), this._panOffset.add(F);
|
|
301
301
|
}
|
|
302
302
|
// deltaX and deltaY are in pixels; right and down are positive
|
|
303
303
|
_pan(e, t) {
|
|
304
304
|
const i = this.domElement;
|
|
305
305
|
if (this.object.isPerspectiveCamera) {
|
|
306
306
|
const s = this.object.position;
|
|
307
|
-
|
|
308
|
-
let o =
|
|
307
|
+
F.copy(s).sub(this.target);
|
|
308
|
+
let o = F.length();
|
|
309
309
|
o *= Math.tan(this.object.fov / 2 * Math.PI / 180), this._panLeft(2 * e * o / i.clientHeight, this.object.matrix), this._panUp(2 * t * o / i.clientHeight, this.object.matrix);
|
|
310
310
|
} else this.object.isOrthographicCamera ? (this._panLeft(e * (this.object.right - this.object.left) / this.object.zoom / i.clientWidth, this.object.matrix), this._panUp(t * (this.object.top - this.object.bottom) / this.object.zoom / i.clientHeight, this.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), this.enablePan = !1);
|
|
311
311
|
}
|
|
@@ -479,7 +479,7 @@ function Ns(c) {
|
|
|
479
479
|
function Us(c) {
|
|
480
480
|
switch (this._removePointer(c), this._pointers.length) {
|
|
481
481
|
case 0:
|
|
482
|
-
this.domElement.releasePointerCapture(c.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(Ci), this.state =
|
|
482
|
+
this.domElement.releasePointerCapture(c.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(Ci), this.state = v.NONE;
|
|
483
483
|
break;
|
|
484
484
|
case 1:
|
|
485
485
|
const e = this._pointers[0], t = this._pointerPositions[e];
|
|
@@ -505,49 +505,49 @@ function Vs(c) {
|
|
|
505
505
|
switch (e) {
|
|
506
506
|
case Ce.DOLLY:
|
|
507
507
|
if (this.enableZoom === !1) return;
|
|
508
|
-
this._handleMouseDownDolly(c), this.state =
|
|
508
|
+
this._handleMouseDownDolly(c), this.state = v.DOLLY;
|
|
509
509
|
break;
|
|
510
510
|
case Ce.ROTATE:
|
|
511
511
|
if (c.ctrlKey || c.metaKey || c.shiftKey) {
|
|
512
512
|
if (this.enablePan === !1) return;
|
|
513
|
-
this._handleMouseDownPan(c), this.state =
|
|
513
|
+
this._handleMouseDownPan(c), this.state = v.PAN;
|
|
514
514
|
} else {
|
|
515
515
|
if (this.enableRotate === !1) return;
|
|
516
|
-
this._handleMouseDownRotate(c), this.state =
|
|
516
|
+
this._handleMouseDownRotate(c), this.state = v.ROTATE;
|
|
517
517
|
}
|
|
518
518
|
break;
|
|
519
519
|
case Ce.PAN:
|
|
520
520
|
if (c.ctrlKey || c.metaKey || c.shiftKey) {
|
|
521
521
|
if (this.enableRotate === !1) return;
|
|
522
|
-
this._handleMouseDownRotate(c), this.state =
|
|
522
|
+
this._handleMouseDownRotate(c), this.state = v.ROTATE;
|
|
523
523
|
} else {
|
|
524
524
|
if (this.enablePan === !1) return;
|
|
525
|
-
this._handleMouseDownPan(c), this.state =
|
|
525
|
+
this._handleMouseDownPan(c), this.state = v.PAN;
|
|
526
526
|
}
|
|
527
527
|
break;
|
|
528
528
|
default:
|
|
529
|
-
this.state =
|
|
529
|
+
this.state = v.NONE;
|
|
530
530
|
}
|
|
531
|
-
this.state !==
|
|
531
|
+
this.state !== v.NONE && this.dispatchEvent(Mt);
|
|
532
532
|
}
|
|
533
533
|
function Os(c) {
|
|
534
534
|
switch (this.state) {
|
|
535
|
-
case
|
|
535
|
+
case v.ROTATE:
|
|
536
536
|
if (this.enableRotate === !1) return;
|
|
537
537
|
this._handleMouseMoveRotate(c);
|
|
538
538
|
break;
|
|
539
|
-
case
|
|
539
|
+
case v.DOLLY:
|
|
540
540
|
if (this.enableZoom === !1) return;
|
|
541
541
|
this._handleMouseMoveDolly(c);
|
|
542
542
|
break;
|
|
543
|
-
case
|
|
543
|
+
case v.PAN:
|
|
544
544
|
if (this.enablePan === !1) return;
|
|
545
545
|
this._handleMouseMovePan(c);
|
|
546
546
|
break;
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
549
|
function Hs(c) {
|
|
550
|
-
this.enabled === !1 || this.enableZoom === !1 || this.state !==
|
|
550
|
+
this.enabled === !1 || this.enableZoom === !1 || this.state !== v.NONE || (c.preventDefault(), this.dispatchEvent(Mt), this._handleMouseWheel(this._customWheelEvent(c)), this.dispatchEvent(Ci));
|
|
551
551
|
}
|
|
552
552
|
function qs(c) {
|
|
553
553
|
this.enabled !== !1 && this._handleKeyDown(c);
|
|
@@ -558,55 +558,55 @@ function js(c) {
|
|
|
558
558
|
switch (this.touches.ONE) {
|
|
559
559
|
case pe.ROTATE:
|
|
560
560
|
if (this.enableRotate === !1) return;
|
|
561
|
-
this._handleTouchStartRotate(c), this.state =
|
|
561
|
+
this._handleTouchStartRotate(c), this.state = v.TOUCH_ROTATE;
|
|
562
562
|
break;
|
|
563
563
|
case pe.PAN:
|
|
564
564
|
if (this.enablePan === !1) return;
|
|
565
|
-
this._handleTouchStartPan(c), this.state =
|
|
565
|
+
this._handleTouchStartPan(c), this.state = v.TOUCH_PAN;
|
|
566
566
|
break;
|
|
567
567
|
default:
|
|
568
|
-
this.state =
|
|
568
|
+
this.state = v.NONE;
|
|
569
569
|
}
|
|
570
570
|
break;
|
|
571
571
|
case 2:
|
|
572
572
|
switch (this.touches.TWO) {
|
|
573
573
|
case pe.DOLLY_PAN:
|
|
574
574
|
if (this.enableZoom === !1 && this.enablePan === !1) return;
|
|
575
|
-
this._handleTouchStartDollyPan(c), this.state =
|
|
575
|
+
this._handleTouchStartDollyPan(c), this.state = v.TOUCH_DOLLY_PAN;
|
|
576
576
|
break;
|
|
577
577
|
case pe.DOLLY_ROTATE:
|
|
578
578
|
if (this.enableZoom === !1 && this.enableRotate === !1) return;
|
|
579
|
-
this._handleTouchStartDollyRotate(c), this.state =
|
|
579
|
+
this._handleTouchStartDollyRotate(c), this.state = v.TOUCH_DOLLY_ROTATE;
|
|
580
580
|
break;
|
|
581
581
|
default:
|
|
582
|
-
this.state =
|
|
582
|
+
this.state = v.NONE;
|
|
583
583
|
}
|
|
584
584
|
break;
|
|
585
585
|
default:
|
|
586
|
-
this.state =
|
|
586
|
+
this.state = v.NONE;
|
|
587
587
|
}
|
|
588
|
-
this.state !==
|
|
588
|
+
this.state !== v.NONE && this.dispatchEvent(Mt);
|
|
589
589
|
}
|
|
590
590
|
function Ks(c) {
|
|
591
591
|
switch (this._trackPointer(c), this.state) {
|
|
592
|
-
case
|
|
592
|
+
case v.TOUCH_ROTATE:
|
|
593
593
|
if (this.enableRotate === !1) return;
|
|
594
594
|
this._handleTouchMoveRotate(c), this.update();
|
|
595
595
|
break;
|
|
596
|
-
case
|
|
596
|
+
case v.TOUCH_PAN:
|
|
597
597
|
if (this.enablePan === !1) return;
|
|
598
598
|
this._handleTouchMovePan(c), this.update();
|
|
599
599
|
break;
|
|
600
|
-
case
|
|
600
|
+
case v.TOUCH_DOLLY_PAN:
|
|
601
601
|
if (this.enableZoom === !1 && this.enablePan === !1) return;
|
|
602
602
|
this._handleTouchMoveDollyPan(c), this.update();
|
|
603
603
|
break;
|
|
604
|
-
case
|
|
604
|
+
case v.TOUCH_DOLLY_ROTATE:
|
|
605
605
|
if (this.enableZoom === !1 && this.enableRotate === !1) return;
|
|
606
606
|
this._handleTouchMoveDollyRotate(c), this.update();
|
|
607
607
|
break;
|
|
608
608
|
default:
|
|
609
|
-
this.state =
|
|
609
|
+
this.state = v.NONE;
|
|
610
610
|
}
|
|
611
611
|
}
|
|
612
612
|
function zs(c) {
|
|
@@ -618,7 +618,7 @@ function Ys(c) {
|
|
|
618
618
|
function Js(c) {
|
|
619
619
|
c.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
|
|
620
620
|
}
|
|
621
|
-
class Ws extends
|
|
621
|
+
class Ws extends Te {
|
|
622
622
|
/**
|
|
623
623
|
* Creates a new Camera instance
|
|
624
624
|
*
|
|
@@ -628,7 +628,7 @@ class Ws extends je {
|
|
|
628
628
|
super(), this.config = e, this.camera = null, this.controls = null, this.focusAnimation = null, this.init();
|
|
629
629
|
}
|
|
630
630
|
init() {
|
|
631
|
-
this.camera = new
|
|
631
|
+
this.camera = new g.PerspectiveCamera(
|
|
632
632
|
this.config.fov || 65,
|
|
633
633
|
window.innerWidth / window.innerHeight,
|
|
634
634
|
this.config.near || 0.05,
|
|
@@ -714,8 +714,8 @@ class Ws extends je {
|
|
|
714
714
|
};
|
|
715
715
|
this.controls.addEventListener("start", a, { once: !0 });
|
|
716
716
|
const l = () => {
|
|
717
|
-
const h = performance.now() - A, d = Math.min(h / r, 1),
|
|
718
|
-
this.controls.target.lerpVectors(i, e,
|
|
717
|
+
const h = performance.now() - A, d = Math.min(h / r, 1), u = 1 - Math.pow(1 - d, 3);
|
|
718
|
+
this.controls.target.lerpVectors(i, e, u), this.camera.position.lerpVectors(s, n, u), d < 1 ? this.focusAnimation = requestAnimationFrame(l) : (this.focusAnimation = null, this.controls.removeEventListener("start", a), this.emit("focus-complete", { target: e, position: n }));
|
|
719
719
|
};
|
|
720
720
|
this.focusAnimation = requestAnimationFrame(l), this.emit("focus-start", { target: e, startPosition: s, newPosition: n });
|
|
721
721
|
}
|
|
@@ -778,10 +778,10 @@ class xt extends yt {
|
|
|
778
778
|
return new io(t);
|
|
779
779
|
}), this.register(function(t) {
|
|
780
780
|
return new ho(t);
|
|
781
|
-
}), this.register(function(t) {
|
|
782
|
-
return new go(t);
|
|
783
781
|
}), this.register(function(t) {
|
|
784
782
|
return new uo(t);
|
|
783
|
+
}), this.register(function(t) {
|
|
784
|
+
return new go(t);
|
|
785
785
|
}), this.register(function(t) {
|
|
786
786
|
return new oo(t);
|
|
787
787
|
}), this.register(function(t) {
|
|
@@ -907,12 +907,12 @@ class xt extends yt {
|
|
|
907
907
|
else if (e instanceof ArrayBuffer)
|
|
908
908
|
if (A.decode(new Uint8Array(e, 0, 4)) === Ei) {
|
|
909
909
|
try {
|
|
910
|
-
n[
|
|
910
|
+
n[Q.KHR_BINARY_GLTF] = new mo(e);
|
|
911
911
|
} catch (h) {
|
|
912
912
|
s && s(h);
|
|
913
913
|
return;
|
|
914
914
|
}
|
|
915
|
-
o = JSON.parse(n[
|
|
915
|
+
o = JSON.parse(n[Q.KHR_BINARY_GLTF].content);
|
|
916
916
|
} else
|
|
917
917
|
o = JSON.parse(A.decode(e));
|
|
918
918
|
else
|
|
@@ -938,16 +938,16 @@ class xt extends yt {
|
|
|
938
938
|
for (let l = 0; l < o.extensionsUsed.length; ++l) {
|
|
939
939
|
const h = o.extensionsUsed[l], d = o.extensionsRequired || [];
|
|
940
940
|
switch (h) {
|
|
941
|
-
case
|
|
941
|
+
case Q.KHR_MATERIALS_UNLIT:
|
|
942
942
|
n[h] = new $s();
|
|
943
943
|
break;
|
|
944
|
-
case
|
|
944
|
+
case Q.KHR_DRACO_MESH_COMPRESSION:
|
|
945
945
|
n[h] = new bo(o, this.dracoLoader);
|
|
946
946
|
break;
|
|
947
|
-
case
|
|
947
|
+
case Q.KHR_TEXTURE_TRANSFORM:
|
|
948
948
|
n[h] = new Co();
|
|
949
949
|
break;
|
|
950
|
-
case
|
|
950
|
+
case Q.KHR_MESH_QUANTIZATION:
|
|
951
951
|
n[h] = new Eo();
|
|
952
952
|
break;
|
|
953
953
|
default:
|
|
@@ -988,7 +988,7 @@ function Xs() {
|
|
|
988
988
|
}
|
|
989
989
|
};
|
|
990
990
|
}
|
|
991
|
-
const
|
|
991
|
+
const Q = {
|
|
992
992
|
KHR_BINARY_GLTF: "KHR_binary_glTF",
|
|
993
993
|
KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression",
|
|
994
994
|
KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual",
|
|
@@ -1014,7 +1014,7 @@ const S = {
|
|
|
1014
1014
|
};
|
|
1015
1015
|
class Zs {
|
|
1016
1016
|
constructor(e) {
|
|
1017
|
-
this.parser = e, this.name =
|
|
1017
|
+
this.parser = e, this.name = Q.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
|
|
1018
1018
|
}
|
|
1019
1019
|
_markDefs() {
|
|
1020
1020
|
const e = this.parser, t = this.parser.json.nodes || [];
|
|
@@ -1060,7 +1060,7 @@ class Zs {
|
|
|
1060
1060
|
}
|
|
1061
1061
|
class $s {
|
|
1062
1062
|
constructor() {
|
|
1063
|
-
this.name =
|
|
1063
|
+
this.name = Q.KHR_MATERIALS_UNLIT;
|
|
1064
1064
|
}
|
|
1065
1065
|
getMaterialType() {
|
|
1066
1066
|
return fe;
|
|
@@ -1081,7 +1081,7 @@ class $s {
|
|
|
1081
1081
|
}
|
|
1082
1082
|
class eo {
|
|
1083
1083
|
constructor(e) {
|
|
1084
|
-
this.parser = e, this.name =
|
|
1084
|
+
this.parser = e, this.name = Q.KHR_MATERIALS_EMISSIVE_STRENGTH;
|
|
1085
1085
|
}
|
|
1086
1086
|
extendMaterialParams(e, t) {
|
|
1087
1087
|
const s = this.parser.json.materials[e];
|
|
@@ -1093,7 +1093,7 @@ class eo {
|
|
|
1093
1093
|
}
|
|
1094
1094
|
class to {
|
|
1095
1095
|
constructor(e) {
|
|
1096
|
-
this.parser = e, this.name =
|
|
1096
|
+
this.parser = e, this.name = Q.KHR_MATERIALS_CLEARCOAT;
|
|
1097
1097
|
}
|
|
1098
1098
|
getMaterialType(e) {
|
|
1099
1099
|
const i = this.parser.json.materials[e];
|
|
@@ -1113,7 +1113,7 @@ class to {
|
|
|
1113
1113
|
}
|
|
1114
1114
|
class io {
|
|
1115
1115
|
constructor(e) {
|
|
1116
|
-
this.parser = e, this.name =
|
|
1116
|
+
this.parser = e, this.name = Q.KHR_MATERIALS_DISPERSION;
|
|
1117
1117
|
}
|
|
1118
1118
|
getMaterialType(e) {
|
|
1119
1119
|
const i = this.parser.json.materials[e];
|
|
@@ -1129,7 +1129,7 @@ class io {
|
|
|
1129
1129
|
}
|
|
1130
1130
|
class so {
|
|
1131
1131
|
constructor(e) {
|
|
1132
|
-
this.parser = e, this.name =
|
|
1132
|
+
this.parser = e, this.name = Q.KHR_MATERIALS_IRIDESCENCE;
|
|
1133
1133
|
}
|
|
1134
1134
|
getMaterialType(e) {
|
|
1135
1135
|
const i = this.parser.json.materials[e];
|
|
@@ -1145,7 +1145,7 @@ class so {
|
|
|
1145
1145
|
}
|
|
1146
1146
|
class oo {
|
|
1147
1147
|
constructor(e) {
|
|
1148
|
-
this.parser = e, this.name =
|
|
1148
|
+
this.parser = e, this.name = Q.KHR_MATERIALS_SHEEN;
|
|
1149
1149
|
}
|
|
1150
1150
|
getMaterialType(e) {
|
|
1151
1151
|
const i = this.parser.json.materials[e];
|
|
@@ -1167,7 +1167,7 @@ class oo {
|
|
|
1167
1167
|
}
|
|
1168
1168
|
class no {
|
|
1169
1169
|
constructor(e) {
|
|
1170
|
-
this.parser = e, this.name =
|
|
1170
|
+
this.parser = e, this.name = Q.KHR_MATERIALS_TRANSMISSION;
|
|
1171
1171
|
}
|
|
1172
1172
|
getMaterialType(e) {
|
|
1173
1173
|
const i = this.parser.json.materials[e];
|
|
@@ -1183,7 +1183,7 @@ class no {
|
|
|
1183
1183
|
}
|
|
1184
1184
|
class ro {
|
|
1185
1185
|
constructor(e) {
|
|
1186
|
-
this.parser = e, this.name =
|
|
1186
|
+
this.parser = e, this.name = Q.KHR_MATERIALS_VOLUME;
|
|
1187
1187
|
}
|
|
1188
1188
|
getMaterialType(e) {
|
|
1189
1189
|
const i = this.parser.json.materials[e];
|
|
@@ -1201,7 +1201,7 @@ class ro {
|
|
|
1201
1201
|
}
|
|
1202
1202
|
class ao {
|
|
1203
1203
|
constructor(e) {
|
|
1204
|
-
this.parser = e, this.name =
|
|
1204
|
+
this.parser = e, this.name = Q.KHR_MATERIALS_IOR;
|
|
1205
1205
|
}
|
|
1206
1206
|
getMaterialType(e) {
|
|
1207
1207
|
const i = this.parser.json.materials[e];
|
|
@@ -1217,7 +1217,7 @@ class ao {
|
|
|
1217
1217
|
}
|
|
1218
1218
|
class Ao {
|
|
1219
1219
|
constructor(e) {
|
|
1220
|
-
this.parser = e, this.name =
|
|
1220
|
+
this.parser = e, this.name = Q.KHR_MATERIALS_SPECULAR;
|
|
1221
1221
|
}
|
|
1222
1222
|
getMaterialType(e) {
|
|
1223
1223
|
const i = this.parser.json.materials[e];
|
|
@@ -1235,7 +1235,7 @@ class Ao {
|
|
|
1235
1235
|
}
|
|
1236
1236
|
class lo {
|
|
1237
1237
|
constructor(e) {
|
|
1238
|
-
this.parser = e, this.name =
|
|
1238
|
+
this.parser = e, this.name = Q.EXT_MATERIALS_BUMP;
|
|
1239
1239
|
}
|
|
1240
1240
|
getMaterialType(e) {
|
|
1241
1241
|
const i = this.parser.json.materials[e];
|
|
@@ -1251,7 +1251,7 @@ class lo {
|
|
|
1251
1251
|
}
|
|
1252
1252
|
class co {
|
|
1253
1253
|
constructor(e) {
|
|
1254
|
-
this.parser = e, this.name =
|
|
1254
|
+
this.parser = e, this.name = Q.KHR_MATERIALS_ANISOTROPY;
|
|
1255
1255
|
}
|
|
1256
1256
|
getMaterialType(e) {
|
|
1257
1257
|
const i = this.parser.json.materials[e];
|
|
@@ -1267,7 +1267,7 @@ class co {
|
|
|
1267
1267
|
}
|
|
1268
1268
|
class ho {
|
|
1269
1269
|
constructor(e) {
|
|
1270
|
-
this.parser = e, this.name =
|
|
1270
|
+
this.parser = e, this.name = Q.KHR_TEXTURE_BASISU;
|
|
1271
1271
|
}
|
|
1272
1272
|
loadTexture(e) {
|
|
1273
1273
|
const t = this.parser, i = t.json, s = i.textures[e];
|
|
@@ -1282,9 +1282,9 @@ class ho {
|
|
|
1282
1282
|
return t.loadTextureImage(e, o.source, n);
|
|
1283
1283
|
}
|
|
1284
1284
|
}
|
|
1285
|
-
class
|
|
1285
|
+
class uo {
|
|
1286
1286
|
constructor(e) {
|
|
1287
|
-
this.parser = e, this.name =
|
|
1287
|
+
this.parser = e, this.name = Q.EXT_TEXTURE_WEBP;
|
|
1288
1288
|
}
|
|
1289
1289
|
loadTexture(e) {
|
|
1290
1290
|
const t = this.name, i = this.parser, s = i.json, o = s.textures[e];
|
|
@@ -1299,9 +1299,9 @@ class go {
|
|
|
1299
1299
|
return i.loadTextureImage(e, n.source, A);
|
|
1300
1300
|
}
|
|
1301
1301
|
}
|
|
1302
|
-
class
|
|
1302
|
+
class go {
|
|
1303
1303
|
constructor(e) {
|
|
1304
|
-
this.parser = e, this.name =
|
|
1304
|
+
this.parser = e, this.name = Q.EXT_TEXTURE_AVIF;
|
|
1305
1305
|
}
|
|
1306
1306
|
loadTexture(e) {
|
|
1307
1307
|
const t = this.name, i = this.parser, s = i.json, o = s.textures[e];
|
|
@@ -1318,7 +1318,7 @@ class uo {
|
|
|
1318
1318
|
}
|
|
1319
1319
|
class po {
|
|
1320
1320
|
constructor(e) {
|
|
1321
|
-
this.name =
|
|
1321
|
+
this.name = Q.EXT_MESHOPT_COMPRESSION, this.parser = e;
|
|
1322
1322
|
}
|
|
1323
1323
|
loadBufferView(e) {
|
|
1324
1324
|
const t = this.parser.json, i = t.bufferViews[e];
|
|
@@ -1331,11 +1331,11 @@ class po {
|
|
|
1331
1331
|
}
|
|
1332
1332
|
return o.then(function(r) {
|
|
1333
1333
|
const A = s.byteOffset || 0, a = s.byteLength || 0, l = s.count, h = s.byteStride, d = new Uint8Array(r, A, a);
|
|
1334
|
-
return n.decodeGltfBufferAsync ? n.decodeGltfBufferAsync(l, h, d, s.mode, s.filter).then(function(
|
|
1335
|
-
return
|
|
1334
|
+
return n.decodeGltfBufferAsync ? n.decodeGltfBufferAsync(l, h, d, s.mode, s.filter).then(function(u) {
|
|
1335
|
+
return u.buffer;
|
|
1336
1336
|
}) : n.ready.then(function() {
|
|
1337
|
-
const
|
|
1338
|
-
return n.decodeGltfBuffer(new Uint8Array(
|
|
1337
|
+
const u = new ArrayBuffer(l * h);
|
|
1338
|
+
return n.decodeGltfBuffer(new Uint8Array(u), l, h, d, s.mode, s.filter), u;
|
|
1339
1339
|
});
|
|
1340
1340
|
});
|
|
1341
1341
|
} else
|
|
@@ -1344,7 +1344,7 @@ class po {
|
|
|
1344
1344
|
}
|
|
1345
1345
|
class fo {
|
|
1346
1346
|
constructor(e) {
|
|
1347
|
-
this.name =
|
|
1347
|
+
this.name = Q.EXT_MESH_GPU_INSTANCING, this.parser = e;
|
|
1348
1348
|
}
|
|
1349
1349
|
createNodeMesh(e) {
|
|
1350
1350
|
const t = this.parser.json, i = t.nodes[e];
|
|
@@ -1358,27 +1358,27 @@ class fo {
|
|
|
1358
1358
|
for (const a in n)
|
|
1359
1359
|
r.push(this.parser.getDependency("accessor", n[a]).then((l) => (A[a] = l, A[a])));
|
|
1360
1360
|
return r.length < 1 ? null : (r.push(this.parser.createNodeMesh(e)), Promise.all(r).then((a) => {
|
|
1361
|
-
const l = a.pop(), h = l.isGroup ? l.children : [l], d = a[0].count,
|
|
1361
|
+
const l = a.pop(), h = l.isGroup ? l.children : [l], d = a[0].count, u = [];
|
|
1362
1362
|
for (const p of h) {
|
|
1363
|
-
const
|
|
1364
|
-
for (let
|
|
1365
|
-
A.TRANSLATION && E.fromBufferAttribute(A.TRANSLATION,
|
|
1366
|
-
for (const
|
|
1367
|
-
if (
|
|
1368
|
-
const B = A[
|
|
1363
|
+
const b = new Ie(), E = new L(), f = new Ve(), m = new L(1, 1, 1), I = new ci(p.geometry, p.material, d);
|
|
1364
|
+
for (let C = 0; C < d; C++)
|
|
1365
|
+
A.TRANSLATION && E.fromBufferAttribute(A.TRANSLATION, C), A.ROTATION && f.fromBufferAttribute(A.ROTATION, C), A.SCALE && m.fromBufferAttribute(A.SCALE, C), I.setMatrixAt(C, b.compose(E, f, m));
|
|
1366
|
+
for (const C in A)
|
|
1367
|
+
if (C === "_COLOR_0") {
|
|
1368
|
+
const B = A[C];
|
|
1369
1369
|
I.instanceColor = new Ji(B.array, B.itemSize, B.normalized);
|
|
1370
|
-
} else
|
|
1371
|
-
|
|
1370
|
+
} else C !== "TRANSLATION" && C !== "ROTATION" && C !== "SCALE" && p.geometry.setAttribute(C, A[C]);
|
|
1371
|
+
He.prototype.copy.call(I, p), this.parser.assignFinalMaterial(I), u.push(I);
|
|
1372
1372
|
}
|
|
1373
|
-
return l.isGroup ? (l.clear(), l.add(...
|
|
1373
|
+
return l.isGroup ? (l.clear(), l.add(...u), l) : u[0];
|
|
1374
1374
|
}));
|
|
1375
1375
|
}
|
|
1376
1376
|
}
|
|
1377
|
-
const Ei = "glTF",
|
|
1377
|
+
const Ei = "glTF", Se = 12, qt = { JSON: 1313821514, BIN: 5130562 };
|
|
1378
1378
|
class mo {
|
|
1379
1379
|
constructor(e) {
|
|
1380
|
-
this.name =
|
|
1381
|
-
const t = new DataView(e, 0,
|
|
1380
|
+
this.name = Q.KHR_BINARY_GLTF, this.content = null, this.body = null;
|
|
1381
|
+
const t = new DataView(e, 0, Se), i = new TextDecoder();
|
|
1382
1382
|
if (this.header = {
|
|
1383
1383
|
magic: i.decode(new Uint8Array(e.slice(0, 4))),
|
|
1384
1384
|
version: t.getUint32(4, !0),
|
|
@@ -1387,17 +1387,17 @@ class mo {
|
|
|
1387
1387
|
throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
|
|
1388
1388
|
if (this.header.version < 2)
|
|
1389
1389
|
throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
|
|
1390
|
-
const s = this.header.length -
|
|
1390
|
+
const s = this.header.length - Se, o = new DataView(e, Se);
|
|
1391
1391
|
let n = 0;
|
|
1392
1392
|
for (; n < s; ) {
|
|
1393
1393
|
const r = o.getUint32(n, !0);
|
|
1394
1394
|
n += 4;
|
|
1395
1395
|
const A = o.getUint32(n, !0);
|
|
1396
1396
|
if (n += 4, A === qt.JSON) {
|
|
1397
|
-
const a = new Uint8Array(e,
|
|
1397
|
+
const a = new Uint8Array(e, Se + n, r);
|
|
1398
1398
|
this.content = i.decode(a);
|
|
1399
1399
|
} else if (A === qt.BIN) {
|
|
1400
|
-
const a =
|
|
1400
|
+
const a = Se + n;
|
|
1401
1401
|
this.body = e.slice(a, a + r);
|
|
1402
1402
|
}
|
|
1403
1403
|
n += r;
|
|
@@ -1410,7 +1410,7 @@ class bo {
|
|
|
1410
1410
|
constructor(e, t) {
|
|
1411
1411
|
if (!t)
|
|
1412
1412
|
throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
|
|
1413
|
-
this.name =
|
|
1413
|
+
this.name = Q.KHR_DRACO_MESH_COMPRESSION, this.json = e, this.dracoLoader = t, this.dracoLoader.preload();
|
|
1414
1414
|
}
|
|
1415
1415
|
decodePrimitive(e, t) {
|
|
1416
1416
|
const i = this.json, s = this.dracoLoader, o = e.extensions[this.name].bufferView, n = e.extensions[this.name].attributes, r = {}, A = {}, a = {};
|
|
@@ -1421,18 +1421,18 @@ class bo {
|
|
|
1421
1421
|
for (const l in e.attributes) {
|
|
1422
1422
|
const h = bt[l] || l.toLowerCase();
|
|
1423
1423
|
if (n[l] !== void 0) {
|
|
1424
|
-
const d = i.accessors[e.attributes[l]],
|
|
1425
|
-
a[h] =
|
|
1424
|
+
const d = i.accessors[e.attributes[l]], u = Ee[d.componentType];
|
|
1425
|
+
a[h] = u.name, A[h] = d.normalized === !0;
|
|
1426
1426
|
}
|
|
1427
1427
|
}
|
|
1428
1428
|
return t.getDependency("bufferView", o).then(function(l) {
|
|
1429
1429
|
return new Promise(function(h, d) {
|
|
1430
|
-
s.decodeDracoFile(l, function(
|
|
1431
|
-
for (const p in
|
|
1432
|
-
const
|
|
1433
|
-
E !== void 0 && (
|
|
1430
|
+
s.decodeDracoFile(l, function(u) {
|
|
1431
|
+
for (const p in u.attributes) {
|
|
1432
|
+
const b = u.attributes[p], E = A[p];
|
|
1433
|
+
E !== void 0 && (b.normalized = E);
|
|
1434
1434
|
}
|
|
1435
|
-
h(
|
|
1435
|
+
h(u);
|
|
1436
1436
|
}, r, a, Y, d);
|
|
1437
1437
|
});
|
|
1438
1438
|
});
|
|
@@ -1440,7 +1440,7 @@ class bo {
|
|
|
1440
1440
|
}
|
|
1441
1441
|
class Co {
|
|
1442
1442
|
constructor() {
|
|
1443
|
-
this.name =
|
|
1443
|
+
this.name = Q.KHR_TEXTURE_TRANSFORM;
|
|
1444
1444
|
}
|
|
1445
1445
|
extendTexture(e, t) {
|
|
1446
1446
|
return (t.texCoord === void 0 || t.texCoord === e.channel) && t.offset === void 0 && t.rotation === void 0 && t.scale === void 0 || (e = e.clone(), t.texCoord !== void 0 && (e.channel = t.texCoord), t.offset !== void 0 && e.offset.fromArray(t.offset), t.rotation !== void 0 && (e.rotation = t.rotation), t.scale !== void 0 && e.repeat.fromArray(t.scale), e.needsUpdate = !0), e;
|
|
@@ -1448,7 +1448,7 @@ class Co {
|
|
|
1448
1448
|
}
|
|
1449
1449
|
class Eo {
|
|
1450
1450
|
constructor() {
|
|
1451
|
-
this.name =
|
|
1451
|
+
this.name = Q.KHR_MESH_QUANTIZATION;
|
|
1452
1452
|
}
|
|
1453
1453
|
}
|
|
1454
1454
|
class Ii extends Es {
|
|
@@ -1462,15 +1462,15 @@ class Ii extends Es {
|
|
|
1462
1462
|
return t;
|
|
1463
1463
|
}
|
|
1464
1464
|
interpolate_(e, t, i, s) {
|
|
1465
|
-
const o = this.resultBuffer, n = this.sampleValues, r = this.valueSize, A = r * 2, a = r * 3, l = s - t, h = (i - t) / l, d = h * h,
|
|
1466
|
-
for (let
|
|
1467
|
-
const B = n[
|
|
1468
|
-
o[
|
|
1465
|
+
const o = this.resultBuffer, n = this.sampleValues, r = this.valueSize, A = r * 2, a = r * 3, l = s - t, h = (i - t) / l, d = h * h, u = d * h, p = e * a, b = p - a, E = -2 * u + 3 * d, f = u - d, m = 1 - E, I = f - d + h;
|
|
1466
|
+
for (let C = 0; C !== r; C++) {
|
|
1467
|
+
const B = n[b + C + r], y = n[b + C + A] * l, w = n[p + C + r], M = n[p + C] * l;
|
|
1468
|
+
o[C] = m * B + I * y + E * w + f * M;
|
|
1469
1469
|
}
|
|
1470
1470
|
return o;
|
|
1471
1471
|
}
|
|
1472
1472
|
}
|
|
1473
|
-
const Io = new
|
|
1473
|
+
const Io = new Ve();
|
|
1474
1474
|
class Bo extends Ii {
|
|
1475
1475
|
interpolate_(e, t, i, s) {
|
|
1476
1476
|
const o = super.interpolate_(e, t, i, s);
|
|
@@ -1498,7 +1498,7 @@ const j = {
|
|
|
1498
1498
|
9984: ts,
|
|
1499
1499
|
9985: es,
|
|
1500
1500
|
9986: $i,
|
|
1501
|
-
9987:
|
|
1501
|
+
9987: qe
|
|
1502
1502
|
}, Kt = {
|
|
1503
1503
|
33071: ss,
|
|
1504
1504
|
33648: is,
|
|
@@ -1531,7 +1531,7 @@ const j = {
|
|
|
1531
1531
|
CUBICSPLINE: void 0,
|
|
1532
1532
|
// We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
|
|
1533
1533
|
// keyframe track will be initialized with a default interpolation type, then modified.
|
|
1534
|
-
LINEAR:
|
|
1534
|
+
LINEAR: ui,
|
|
1535
1535
|
STEP: bs
|
|
1536
1536
|
}, Xe = {
|
|
1537
1537
|
OPAQUE: "OPAQUE",
|
|
@@ -1556,7 +1556,7 @@ function ae(c, e, t) {
|
|
|
1556
1556
|
function ie(c, e) {
|
|
1557
1557
|
e.extras !== void 0 && (typeof e.extras == "object" ? Object.assign(c.userData, e.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + e.extras));
|
|
1558
1558
|
}
|
|
1559
|
-
function
|
|
1559
|
+
function So(c, e, t) {
|
|
1560
1560
|
let i = !1, s = !1, o = !1;
|
|
1561
1561
|
for (let a = 0, l = e.length; a < l; a++) {
|
|
1562
1562
|
const h = e[a];
|
|
@@ -1588,7 +1588,7 @@ function Qo(c, e, t) {
|
|
|
1588
1588
|
return i && (c.morphAttributes.position = l), s && (c.morphAttributes.normal = h), o && (c.morphAttributes.color = d), c.morphTargetsRelative = !0, c;
|
|
1589
1589
|
});
|
|
1590
1590
|
}
|
|
1591
|
-
function
|
|
1591
|
+
function Qo(c, e) {
|
|
1592
1592
|
if (c.updateMorphTargets(), e.weights !== void 0)
|
|
1593
1593
|
for (let t = 0, i = e.weights.length; t < i; t++)
|
|
1594
1594
|
c.morphTargetInfluences[t] = e.weights[t];
|
|
@@ -1604,7 +1604,7 @@ function So(c, e) {
|
|
|
1604
1604
|
}
|
|
1605
1605
|
function Mo(c) {
|
|
1606
1606
|
let e;
|
|
1607
|
-
const t = c.extensions && c.extensions[
|
|
1607
|
+
const t = c.extensions && c.extensions[Q.KHR_DRACO_MESH_COMPRESSION];
|
|
1608
1608
|
if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + Ze(t.attributes) : e = c.indices + ":" + Ze(c.attributes) + ":" + c.mode, c.targets !== void 0)
|
|
1609
1609
|
for (let i = 0, s = c.targets.length; i < s; i++)
|
|
1610
1610
|
e += ":" + Ze(c.targets[i]);
|
|
@@ -1853,7 +1853,7 @@ class Ro {
|
|
|
1853
1853
|
if (t.type && t.type !== "arraybuffer")
|
|
1854
1854
|
throw new Error("THREE.GLTFLoader: " + t.type + " buffer type is not supported.");
|
|
1855
1855
|
if (t.uri === void 0 && e === 0)
|
|
1856
|
-
return Promise.resolve(this.extensions[
|
|
1856
|
+
return Promise.resolve(this.extensions[Q.KHR_BINARY_GLTF].body);
|
|
1857
1857
|
const s = this.options;
|
|
1858
1858
|
return new Promise(function(o, n) {
|
|
1859
1859
|
i.load(ve.resolveURL(t.uri, s.path), o, void 0, function() {
|
|
@@ -1890,18 +1890,18 @@ class Ro {
|
|
|
1890
1890
|
}
|
|
1891
1891
|
const o = [];
|
|
1892
1892
|
return s.bufferView !== void 0 ? o.push(this.getDependency("bufferView", s.bufferView)) : o.push(null), s.sparse !== void 0 && (o.push(this.getDependency("bufferView", s.sparse.indices.bufferView)), o.push(this.getDependency("bufferView", s.sparse.values.bufferView))), Promise.all(o).then(function(n) {
|
|
1893
|
-
const r = n[0], A = We[s.type], a = Ee[s.componentType], l = a.BYTES_PER_ELEMENT, h = l * A, d = s.byteOffset || 0,
|
|
1894
|
-
let
|
|
1895
|
-
if (
|
|
1896
|
-
const f = Math.floor(d /
|
|
1893
|
+
const r = n[0], A = We[s.type], a = Ee[s.componentType], l = a.BYTES_PER_ELEMENT, h = l * A, d = s.byteOffset || 0, u = s.bufferView !== void 0 ? i.bufferViews[s.bufferView].byteStride : void 0, p = s.normalized === !0;
|
|
1894
|
+
let b, E;
|
|
1895
|
+
if (u && u !== h) {
|
|
1896
|
+
const f = Math.floor(d / u), m = "InterleavedBuffer:" + s.bufferView + ":" + s.componentType + ":" + f + ":" + s.count;
|
|
1897
1897
|
let I = t.cache.get(m);
|
|
1898
|
-
I || (
|
|
1898
|
+
I || (b = new a(r, f * u, s.count * u / l), I = new Zi(b, u / l), t.cache.add(m, I)), E = new Ae(I, A, d % u / l, p);
|
|
1899
1899
|
} else
|
|
1900
|
-
r === null ?
|
|
1900
|
+
r === null ? b = new a(s.count * A) : b = new a(r, d, s.count * A), E = new Re(b, A, p);
|
|
1901
1901
|
if (s.sparse !== void 0) {
|
|
1902
|
-
const f = We.SCALAR, m = Ee[s.sparse.indices.componentType], I = s.sparse.indices.byteOffset || 0,
|
|
1902
|
+
const f = We.SCALAR, m = Ee[s.sparse.indices.componentType], I = s.sparse.indices.byteOffset || 0, C = s.sparse.values.byteOffset || 0, B = new m(n[1], I, s.sparse.count * f), y = new a(n[2], C, s.sparse.count * A);
|
|
1903
1903
|
r !== null && (E = new Re(E.array.slice(), E.itemSize, E.normalized)), E.normalized = !1;
|
|
1904
|
-
for (let w = 0,
|
|
1904
|
+
for (let w = 0, M = B.length; w < M; w++) {
|
|
1905
1905
|
const D = B[w];
|
|
1906
1906
|
if (E.setX(D, y[w * A]), A >= 2 && E.setY(D, y[w * A + 1]), A >= 3 && E.setZ(D, y[w * A + 2]), A >= 4 && E.setW(D, y[w * A + 3]), A >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
|
|
1907
1907
|
}
|
|
@@ -1933,7 +1933,7 @@ class Ro {
|
|
|
1933
1933
|
const a = this.loadImageSource(t, i).then(function(l) {
|
|
1934
1934
|
l.flipY = !1, l.name = n.name || r.name || "", l.name === "" && typeof r.uri == "string" && r.uri.startsWith("data:image/") === !1 && (l.name = r.uri);
|
|
1935
1935
|
const d = (o.samplers || {})[n.sampler] || {};
|
|
1936
|
-
return l.magFilter = jt[d.magFilter] || he, l.minFilter = jt[d.minFilter] ||
|
|
1936
|
+
return l.magFilter = jt[d.magFilter] || he, l.minFilter = jt[d.minFilter] || qe, l.wrapS = Kt[d.wrapS] || dt, l.wrapT = Kt[d.wrapT] || dt, l.generateMipmaps = !l.isCompressedTexture && l.minFilter !== hi && l.minFilter !== he, s.associations.set(l, { textures: e }), l;
|
|
1937
1937
|
}).catch(function() {
|
|
1938
1938
|
return null;
|
|
1939
1939
|
});
|
|
@@ -1954,12 +1954,12 @@ class Ro {
|
|
|
1954
1954
|
else if (n.uri === void 0)
|
|
1955
1955
|
throw new Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView");
|
|
1956
1956
|
const l = Promise.resolve(A).then(function(h) {
|
|
1957
|
-
return new Promise(function(d,
|
|
1957
|
+
return new Promise(function(d, u) {
|
|
1958
1958
|
let p = d;
|
|
1959
|
-
t.isImageBitmapLoader === !0 && (p = function(
|
|
1960
|
-
const E = new
|
|
1959
|
+
t.isImageBitmapLoader === !0 && (p = function(b) {
|
|
1960
|
+
const E = new Lt(b);
|
|
1961
1961
|
E.needsUpdate = !0, d(E);
|
|
1962
|
-
}), t.load(ve.resolveURL(h, o.path), p, void 0,
|
|
1962
|
+
}), t.load(ve.resolveURL(h, o.path), p, void 0, u);
|
|
1963
1963
|
});
|
|
1964
1964
|
}).then(function(h) {
|
|
1965
1965
|
return a === !0 && r.revokeObjectURL(A), ie(h, n), h.userData.mimeType = n.mimeType || xo(n.uri), h;
|
|
@@ -1982,11 +1982,11 @@ class Ro {
|
|
|
1982
1982
|
const o = this;
|
|
1983
1983
|
return this.getDependency("texture", i.index).then(function(n) {
|
|
1984
1984
|
if (!n) return null;
|
|
1985
|
-
if (i.texCoord !== void 0 && i.texCoord > 0 && (n = n.clone(), n.channel = i.texCoord), o.extensions[
|
|
1986
|
-
const r = i.extensions !== void 0 ? i.extensions[
|
|
1985
|
+
if (i.texCoord !== void 0 && i.texCoord > 0 && (n = n.clone(), n.channel = i.texCoord), o.extensions[Q.KHR_TEXTURE_TRANSFORM]) {
|
|
1986
|
+
const r = i.extensions !== void 0 ? i.extensions[Q.KHR_TEXTURE_TRANSFORM] : void 0;
|
|
1987
1987
|
if (r) {
|
|
1988
1988
|
const A = o.associations.get(n);
|
|
1989
|
-
n = o.extensions[
|
|
1989
|
+
n = o.extensions[Q.KHR_TEXTURE_TRANSFORM].extendTexture(n, r), o.associations.set(n, A);
|
|
1990
1990
|
}
|
|
1991
1991
|
}
|
|
1992
1992
|
return s !== void 0 && (n.colorSpace = s), e[t] = n, n;
|
|
@@ -2037,8 +2037,8 @@ class Ro {
|
|
|
2037
2037
|
const t = this, i = this.json, s = this.extensions, o = i.materials[e];
|
|
2038
2038
|
let n;
|
|
2039
2039
|
const r = {}, A = o.extensions || {}, a = [];
|
|
2040
|
-
if (A[
|
|
2041
|
-
const h = s[
|
|
2040
|
+
if (A[Q.KHR_MATERIALS_UNLIT]) {
|
|
2041
|
+
const h = s[Q.KHR_MATERIALS_UNLIT];
|
|
2042
2042
|
n = h.getMaterialType(), a.push(h.extendParams(r, o, t));
|
|
2043
2043
|
} else {
|
|
2044
2044
|
const h = o.pbrMetallicRoughness || {};
|
|
@@ -2090,7 +2090,7 @@ class Ro {
|
|
|
2090
2090
|
loadGeometries(e) {
|
|
2091
2091
|
const t = this, i = this.extensions, s = this.primitiveCache;
|
|
2092
2092
|
function o(r) {
|
|
2093
|
-
return i[
|
|
2093
|
+
return i[Q.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(r, t).then(function(A) {
|
|
2094
2094
|
return zt(A, r, t);
|
|
2095
2095
|
});
|
|
2096
2096
|
}
|
|
@@ -2101,7 +2101,7 @@ class Ro {
|
|
|
2101
2101
|
n.push(h.promise);
|
|
2102
2102
|
else {
|
|
2103
2103
|
let d;
|
|
2104
|
-
a.extensions && a.extensions[
|
|
2104
|
+
a.extensions && a.extensions[Q.KHR_DRACO_MESH_COMPRESSION] ? d = o(a) : d = zt(new di(), a, t), s[l] = { primitive: a, promise: d }, n.push(d);
|
|
2105
2105
|
}
|
|
2106
2106
|
}
|
|
2107
2107
|
return Promise.all(n);
|
|
@@ -2121,35 +2121,35 @@ class Ro {
|
|
|
2121
2121
|
}
|
|
2122
2122
|
return r.push(t.loadGeometries(n)), Promise.all(r).then(function(A) {
|
|
2123
2123
|
const a = A.slice(0, A.length - 1), l = A[A.length - 1], h = [];
|
|
2124
|
-
for (let
|
|
2125
|
-
const
|
|
2124
|
+
for (let u = 0, p = l.length; u < p; u++) {
|
|
2125
|
+
const b = l[u], E = n[u];
|
|
2126
2126
|
let f;
|
|
2127
|
-
const m = a[
|
|
2127
|
+
const m = a[u];
|
|
2128
2128
|
if (E.mode === j.TRIANGLES || E.mode === j.TRIANGLE_STRIP || E.mode === j.TRIANGLE_FAN || E.mode === void 0)
|
|
2129
|
-
f = o.isSkinnedMesh === !0 ? new As(
|
|
2129
|
+
f = o.isSkinnedMesh === !0 ? new As(b, m) : new St(b, m), f.isSkinnedMesh === !0 && f.normalizeSkinWeights(), E.mode === j.TRIANGLE_STRIP ? f.geometry = Ht(f.geometry, li) : E.mode === j.TRIANGLE_FAN && (f.geometry = Ht(f.geometry, ht));
|
|
2130
2130
|
else if (E.mode === j.LINES)
|
|
2131
|
-
f = new ls(
|
|
2131
|
+
f = new ls(b, m);
|
|
2132
2132
|
else if (E.mode === j.LINE_STRIP)
|
|
2133
|
-
f = new cs(
|
|
2133
|
+
f = new cs(b, m);
|
|
2134
2134
|
else if (E.mode === j.LINE_LOOP)
|
|
2135
|
-
f = new hs(
|
|
2135
|
+
f = new hs(b, m);
|
|
2136
2136
|
else if (E.mode === j.POINTS)
|
|
2137
|
-
f = new ds(
|
|
2137
|
+
f = new ds(b, m);
|
|
2138
2138
|
else
|
|
2139
2139
|
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + E.mode);
|
|
2140
|
-
Object.keys(f.geometry.morphAttributes).length > 0 &&
|
|
2140
|
+
Object.keys(f.geometry.morphAttributes).length > 0 && Qo(f, o), f.name = t.createUniqueName(o.name || "mesh_" + e), ie(f, o), E.extensions && ae(s, f, E), t.assignFinalMaterial(f), h.push(f);
|
|
2141
2141
|
}
|
|
2142
|
-
for (let
|
|
2143
|
-
t.associations.set(h[
|
|
2142
|
+
for (let u = 0, p = h.length; u < p; u++)
|
|
2143
|
+
t.associations.set(h[u], {
|
|
2144
2144
|
meshes: e,
|
|
2145
|
-
primitives:
|
|
2145
|
+
primitives: u
|
|
2146
2146
|
});
|
|
2147
2147
|
if (h.length === 1)
|
|
2148
2148
|
return o.extensions && ae(s, h[0], o), h[0];
|
|
2149
2149
|
const d = new Ye();
|
|
2150
2150
|
o.extensions && ae(s, d, o), t.associations.set(d, { meshes: e });
|
|
2151
|
-
for (let
|
|
2152
|
-
d.add(h[
|
|
2151
|
+
for (let u = 0, p = h.length; u < p; u++)
|
|
2152
|
+
d.add(h[u]);
|
|
2153
2153
|
return d;
|
|
2154
2154
|
});
|
|
2155
2155
|
}
|
|
@@ -2167,7 +2167,7 @@ class Ro {
|
|
|
2167
2167
|
console.warn("THREE.GLTFLoader: Missing camera parameters.");
|
|
2168
2168
|
return;
|
|
2169
2169
|
}
|
|
2170
|
-
return i.type === "perspective" ? t = new
|
|
2170
|
+
return i.type === "perspective" ? t = new us(Bt.radToDeg(s.yfov), s.aspectRatio || 1, s.znear || 1, s.zfar || 2e6) : i.type === "orthographic" && (t = new gs(-s.xmag, s.xmag, s.ymag, -s.ymag, s.znear, s.zfar)), i.name && (t.name = this.createUniqueName(i.name)), ie(t, i), Promise.resolve(t);
|
|
2171
2171
|
}
|
|
2172
2172
|
/**
|
|
2173
2173
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
|
|
@@ -2204,8 +2204,8 @@ class Ro {
|
|
|
2204
2204
|
loadAnimation(e) {
|
|
2205
2205
|
const t = this.json, i = this, s = t.animations[e], o = s.name ? s.name : "animation_" + e, n = [], r = [], A = [], a = [], l = [];
|
|
2206
2206
|
for (let h = 0, d = s.channels.length; h < d; h++) {
|
|
2207
|
-
const
|
|
2208
|
-
|
|
2207
|
+
const u = s.channels[h], p = s.samplers[u.sampler], b = u.target, E = b.node, f = s.parameters !== void 0 ? s.parameters[p.input] : p.input, m = s.parameters !== void 0 ? s.parameters[p.output] : p.output;
|
|
2208
|
+
b.node !== void 0 && (n.push(this.getDependency("node", E)), r.push(this.getDependency("accessor", f)), A.push(this.getDependency("accessor", m)), a.push(p), l.push(b));
|
|
2209
2209
|
}
|
|
2210
2210
|
return Promise.all([
|
|
2211
2211
|
Promise.all(n),
|
|
@@ -2214,15 +2214,15 @@ class Ro {
|
|
|
2214
2214
|
Promise.all(a),
|
|
2215
2215
|
Promise.all(l)
|
|
2216
2216
|
]).then(function(h) {
|
|
2217
|
-
const d = h[0],
|
|
2217
|
+
const d = h[0], u = h[1], p = h[2], b = h[3], E = h[4], f = [];
|
|
2218
2218
|
for (let m = 0, I = d.length; m < I; m++) {
|
|
2219
|
-
const
|
|
2220
|
-
if (
|
|
2221
|
-
|
|
2222
|
-
const D = i._createAnimationTracks(
|
|
2219
|
+
const C = d[m], B = u[m], y = p[m], w = b[m], M = E[m];
|
|
2220
|
+
if (C === void 0) continue;
|
|
2221
|
+
C.updateMatrix && C.updateMatrix();
|
|
2222
|
+
const D = i._createAnimationTracks(C, B, y, w, M);
|
|
2223
2223
|
if (D)
|
|
2224
|
-
for (let
|
|
2225
|
-
f.push(D[
|
|
2224
|
+
for (let S = 0; S < D.length; S++)
|
|
2225
|
+
f.push(D[S]);
|
|
2226
2226
|
}
|
|
2227
2227
|
return new fs(o, void 0, f);
|
|
2228
2228
|
});
|
|
@@ -2256,11 +2256,11 @@ class Ro {
|
|
|
2256
2256
|
A
|
|
2257
2257
|
]).then(function(a) {
|
|
2258
2258
|
const l = a[0], h = a[1], d = a[2];
|
|
2259
|
-
d !== null && l.traverse(function(
|
|
2260
|
-
|
|
2259
|
+
d !== null && l.traverse(function(u) {
|
|
2260
|
+
u.isSkinnedMesh && u.bind(d, vo);
|
|
2261
2261
|
});
|
|
2262
|
-
for (let
|
|
2263
|
-
l.add(h[
|
|
2262
|
+
for (let u = 0, p = h.length; u < p; u++)
|
|
2263
|
+
l.add(h[u]);
|
|
2264
2264
|
return l;
|
|
2265
2265
|
});
|
|
2266
2266
|
}
|
|
@@ -2281,7 +2281,7 @@ class Ro {
|
|
|
2281
2281
|
r.push(a);
|
|
2282
2282
|
}), this.nodeCache[e] = Promise.all(r).then(function(a) {
|
|
2283
2283
|
let l;
|
|
2284
|
-
if (o.isBone === !0 ? l = new ms() : a.length > 1 ? l = new Ye() : a.length === 1 ? l = a[0] : l = new
|
|
2284
|
+
if (o.isBone === !0 ? l = new ms() : a.length > 1 ? l = new Ye() : a.length === 1 ? l = a[0] : l = new He(), l !== a[0])
|
|
2285
2285
|
for (let h = 0, d = a.length; h < d; h++)
|
|
2286
2286
|
l.add(a[h]);
|
|
2287
2287
|
if (o.name && (l.userData.name = o.name, l.name = n), ie(l, o), o.extensions && ae(i, l, o), o.matrix !== void 0) {
|
|
@@ -2316,11 +2316,11 @@ class Ro {
|
|
|
2316
2316
|
o.add(A[l]);
|
|
2317
2317
|
const a = (l) => {
|
|
2318
2318
|
const h = /* @__PURE__ */ new Map();
|
|
2319
|
-
for (const [d,
|
|
2320
|
-
(d instanceof ze || d instanceof
|
|
2319
|
+
for (const [d, u] of s.associations)
|
|
2320
|
+
(d instanceof ze || d instanceof Lt) && h.set(d, u);
|
|
2321
2321
|
return l.traverse((d) => {
|
|
2322
|
-
const
|
|
2323
|
-
|
|
2322
|
+
const u = s.associations.get(d);
|
|
2323
|
+
u != null && h.set(d, u);
|
|
2324
2324
|
}), h;
|
|
2325
2325
|
};
|
|
2326
2326
|
return s.associations = a(o), o;
|
|
@@ -2334,30 +2334,30 @@ class Ro {
|
|
|
2334
2334
|
let a;
|
|
2335
2335
|
switch (ne[o.path]) {
|
|
2336
2336
|
case ne.weights:
|
|
2337
|
-
a =
|
|
2337
|
+
a = kt;
|
|
2338
2338
|
break;
|
|
2339
2339
|
case ne.rotation:
|
|
2340
|
-
a =
|
|
2340
|
+
a = Ft;
|
|
2341
2341
|
break;
|
|
2342
2342
|
case ne.translation:
|
|
2343
2343
|
case ne.scale:
|
|
2344
|
-
a =
|
|
2344
|
+
a = Tt;
|
|
2345
2345
|
break;
|
|
2346
2346
|
default:
|
|
2347
2347
|
switch (i.itemSize) {
|
|
2348
2348
|
case 1:
|
|
2349
|
-
a =
|
|
2349
|
+
a = kt;
|
|
2350
2350
|
break;
|
|
2351
2351
|
case 2:
|
|
2352
2352
|
case 3:
|
|
2353
2353
|
default:
|
|
2354
|
-
a =
|
|
2354
|
+
a = Tt;
|
|
2355
2355
|
break;
|
|
2356
2356
|
}
|
|
2357
2357
|
break;
|
|
2358
2358
|
}
|
|
2359
|
-
const l = s.interpolation !== void 0 ? yo[s.interpolation] :
|
|
2360
|
-
for (let d = 0,
|
|
2359
|
+
const l = s.interpolation !== void 0 ? yo[s.interpolation] : ui, h = this._getArrayFromAccessor(i);
|
|
2360
|
+
for (let d = 0, u = A.length; d < u; d++) {
|
|
2361
2361
|
const p = new a(
|
|
2362
2362
|
A[d] + "." + ne[o.path],
|
|
2363
2363
|
t.array,
|
|
@@ -2380,19 +2380,19 @@ class Ro {
|
|
|
2380
2380
|
}
|
|
2381
2381
|
_createCubicSplineTrackInterpolant(e) {
|
|
2382
2382
|
e.createInterpolant = function(i) {
|
|
2383
|
-
const s = this instanceof
|
|
2383
|
+
const s = this instanceof Ft ? Bo : Ii;
|
|
2384
2384
|
return new s(this.times, this.values, this.getValueSize() / 3, i);
|
|
2385
2385
|
}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
|
|
2386
2386
|
}
|
|
2387
2387
|
}
|
|
2388
2388
|
function Do(c, e, t) {
|
|
2389
|
-
const i = e.attributes, s = new
|
|
2389
|
+
const i = e.attributes, s = new je();
|
|
2390
2390
|
if (i.POSITION !== void 0) {
|
|
2391
2391
|
const r = t.json.accessors[i.POSITION], A = r.min, a = r.max;
|
|
2392
2392
|
if (A !== void 0 && a !== void 0) {
|
|
2393
2393
|
if (s.set(
|
|
2394
|
-
new
|
|
2395
|
-
new
|
|
2394
|
+
new L(A[0], A[1], A[2]),
|
|
2395
|
+
new L(a[0], a[1], a[2])
|
|
2396
2396
|
), r.normalized) {
|
|
2397
2397
|
const l = Ct(Ee[r.componentType]);
|
|
2398
2398
|
s.min.multiplyScalar(l), s.max.multiplyScalar(l);
|
|
@@ -2405,15 +2405,15 @@ function Do(c, e, t) {
|
|
|
2405
2405
|
return;
|
|
2406
2406
|
const o = e.targets;
|
|
2407
2407
|
if (o !== void 0) {
|
|
2408
|
-
const r = new
|
|
2408
|
+
const r = new L(), A = new L();
|
|
2409
2409
|
for (let a = 0, l = o.length; a < l; a++) {
|
|
2410
2410
|
const h = o[a];
|
|
2411
2411
|
if (h.POSITION !== void 0) {
|
|
2412
|
-
const d = t.json.accessors[h.POSITION],
|
|
2413
|
-
if (
|
|
2414
|
-
if (A.setX(Math.max(Math.abs(
|
|
2415
|
-
const
|
|
2416
|
-
A.multiplyScalar(
|
|
2412
|
+
const d = t.json.accessors[h.POSITION], u = d.min, p = d.max;
|
|
2413
|
+
if (u !== void 0 && p !== void 0) {
|
|
2414
|
+
if (A.setX(Math.max(Math.abs(u[0]), Math.abs(p[0]))), A.setY(Math.max(Math.abs(u[1]), Math.abs(p[1]))), A.setZ(Math.max(Math.abs(u[2]), Math.abs(p[2]))), d.normalized) {
|
|
2415
|
+
const b = Ct(Ee[d.componentType]);
|
|
2416
|
+
A.multiplyScalar(b);
|
|
2417
2417
|
}
|
|
2418
2418
|
r.max(A);
|
|
2419
2419
|
} else
|
|
@@ -2423,7 +2423,7 @@ function Do(c, e, t) {
|
|
|
2423
2423
|
s.expandByVector(r);
|
|
2424
2424
|
}
|
|
2425
2425
|
c.boundingBox = s;
|
|
2426
|
-
const n = new
|
|
2426
|
+
const n = new Qt();
|
|
2427
2427
|
s.getCenter(n.center), n.radius = s.min.distanceTo(s.max) / 2, c.boundingSphere = n;
|
|
2428
2428
|
}
|
|
2429
2429
|
function zt(c, e, t) {
|
|
@@ -2443,12 +2443,12 @@ function zt(c, e, t) {
|
|
|
2443
2443
|
});
|
|
2444
2444
|
s.push(n);
|
|
2445
2445
|
}
|
|
2446
|
-
return
|
|
2447
|
-
return e.targets !== void 0 ?
|
|
2446
|
+
return ut.workingColorSpace !== Y && "COLOR_0" in i && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${ut.workingColorSpace}" not supported.`), ie(c, e), Do(c, e, t), Promise.all(s).then(function() {
|
|
2447
|
+
return e.targets !== void 0 ? So(c, e.targets, t) : c;
|
|
2448
2448
|
});
|
|
2449
2449
|
}
|
|
2450
2450
|
const $e = /* @__PURE__ */ new WeakMap();
|
|
2451
|
-
class
|
|
2451
|
+
class Lo extends yt {
|
|
2452
2452
|
/**
|
|
2453
2453
|
* Constructs a new Draco loader.
|
|
2454
2454
|
*
|
|
@@ -2567,7 +2567,7 @@ class To extends yt {
|
|
|
2567
2567
|
if (t !== se) return;
|
|
2568
2568
|
const i = new re();
|
|
2569
2569
|
for (let s = 0, o = e.count; s < o; s++)
|
|
2570
|
-
i.fromBufferAttribute(e, s),
|
|
2570
|
+
i.fromBufferAttribute(e, s), ut.colorSpaceToWorking(i, se), e.setXYZ(s, i.r, i.g, i.b);
|
|
2571
2571
|
}
|
|
2572
2572
|
_loadLibrary(e, t) {
|
|
2573
2573
|
const i = new le(this.manager);
|
|
@@ -2584,7 +2584,7 @@ class To extends yt {
|
|
|
2584
2584
|
return e ? t.push(this._loadLibrary("draco_decoder.js", "text")) : (t.push(this._loadLibrary("draco_wasm_wrapper.js", "text")), t.push(this._loadLibrary("draco_decoder.wasm", "arraybuffer"))), this.decoderPending = Promise.all(t).then((i) => {
|
|
2585
2585
|
const s = i[0];
|
|
2586
2586
|
e || (this.decoderConfig.wasmBinary = i[1]);
|
|
2587
|
-
const o =
|
|
2587
|
+
const o = To.toString(), n = [
|
|
2588
2588
|
"/* draco decoder */",
|
|
2589
2589
|
s,
|
|
2590
2590
|
"",
|
|
@@ -2632,7 +2632,7 @@ class To extends yt {
|
|
|
2632
2632
|
return this.workerPool.length = 0, this.workerSourceURL !== "" && URL.revokeObjectURL(this.workerSourceURL), this;
|
|
2633
2633
|
}
|
|
2634
2634
|
}
|
|
2635
|
-
function
|
|
2635
|
+
function To() {
|
|
2636
2636
|
let c, e;
|
|
2637
2637
|
onmessage = function(n) {
|
|
2638
2638
|
const r = n.data;
|
|
@@ -2649,10 +2649,10 @@ function Lo() {
|
|
|
2649
2649
|
e.then((l) => {
|
|
2650
2650
|
const h = l.draco, d = new h.Decoder();
|
|
2651
2651
|
try {
|
|
2652
|
-
const
|
|
2653
|
-
|
|
2654
|
-
} catch (
|
|
2655
|
-
console.error(
|
|
2652
|
+
const u = t(h, d, new Int8Array(A), a), p = u.attributes.map((b) => b.array.buffer);
|
|
2653
|
+
u.index && p.push(u.index.array.buffer), self.postMessage({ type: "decode", id: r.id, geometry: u }, p);
|
|
2654
|
+
} catch (u) {
|
|
2655
|
+
console.error(u), self.postMessage({ type: "error", id: r.id, error: u.message });
|
|
2656
2656
|
} finally {
|
|
2657
2657
|
h.destroy(d);
|
|
2658
2658
|
}
|
|
@@ -2662,17 +2662,17 @@ function Lo() {
|
|
|
2662
2662
|
};
|
|
2663
2663
|
function t(n, r, A, a) {
|
|
2664
2664
|
const l = a.attributeIDs, h = a.attributeTypes;
|
|
2665
|
-
let d,
|
|
2665
|
+
let d, u;
|
|
2666
2666
|
const p = r.GetEncodedGeometryType(A);
|
|
2667
2667
|
if (p === n.TRIANGULAR_MESH)
|
|
2668
|
-
d = new n.Mesh(),
|
|
2668
|
+
d = new n.Mesh(), u = r.DecodeArrayToMesh(A, A.byteLength, d);
|
|
2669
2669
|
else if (p === n.POINT_CLOUD)
|
|
2670
|
-
d = new n.PointCloud(),
|
|
2670
|
+
d = new n.PointCloud(), u = r.DecodeArrayToPointCloud(A, A.byteLength, d);
|
|
2671
2671
|
else
|
|
2672
2672
|
throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
|
|
2673
|
-
if (!
|
|
2674
|
-
throw new Error("THREE.DRACOLoader: Decoding failed: " +
|
|
2675
|
-
const
|
|
2673
|
+
if (!u.ok() || d.ptr === 0)
|
|
2674
|
+
throw new Error("THREE.DRACOLoader: Decoding failed: " + u.error_msg());
|
|
2675
|
+
const b = { index: null, attributes: [] };
|
|
2676
2676
|
for (const E in l) {
|
|
2677
2677
|
const f = self[h[E]];
|
|
2678
2678
|
let m, I;
|
|
@@ -2682,20 +2682,20 @@ function Lo() {
|
|
|
2682
2682
|
if (I = r.GetAttributeId(d, n[l[E]]), I === -1) continue;
|
|
2683
2683
|
m = r.GetAttribute(d, I);
|
|
2684
2684
|
}
|
|
2685
|
-
const
|
|
2686
|
-
E === "color" && (
|
|
2685
|
+
const C = s(n, r, d, E, f, m);
|
|
2686
|
+
E === "color" && (C.vertexColorSpace = a.vertexColorSpace), b.attributes.push(C);
|
|
2687
2687
|
}
|
|
2688
|
-
return p === n.TRIANGULAR_MESH && (
|
|
2688
|
+
return p === n.TRIANGULAR_MESH && (b.index = i(n, r, d)), n.destroy(d), b;
|
|
2689
2689
|
}
|
|
2690
2690
|
function i(n, r, A) {
|
|
2691
2691
|
const l = A.num_faces() * 3, h = l * 4, d = n._malloc(h);
|
|
2692
2692
|
r.GetTrianglesUInt32Array(A, h, d);
|
|
2693
|
-
const
|
|
2694
|
-
return n._free(d), { array:
|
|
2693
|
+
const u = new Uint32Array(n.HEAPF32.buffer, d, l).slice();
|
|
2694
|
+
return n._free(d), { array: u, itemSize: 1 };
|
|
2695
2695
|
}
|
|
2696
2696
|
function s(n, r, A, a, l, h) {
|
|
2697
|
-
const d = h.num_components(), p = A.num_points() * d,
|
|
2698
|
-
r.GetAttributeDataArrayForAllPoints(A, h, E,
|
|
2697
|
+
const d = h.num_components(), p = A.num_points() * d, b = p * l.BYTES_PER_ELEMENT, E = o(n, l), f = n._malloc(b);
|
|
2698
|
+
r.GetAttributeDataArrayForAllPoints(A, h, E, b, f);
|
|
2699
2699
|
const m = new l(n.HEAPF32.buffer, f, p).slice();
|
|
2700
2700
|
return n._free(f), {
|
|
2701
2701
|
name: a,
|
|
@@ -2722,7 +2722,7 @@ function Lo() {
|
|
|
2722
2722
|
}
|
|
2723
2723
|
}
|
|
2724
2724
|
}
|
|
2725
|
-
class
|
|
2725
|
+
class ko {
|
|
2726
2726
|
/**
|
|
2727
2727
|
* Constructs a new Worker pool.
|
|
2728
2728
|
*
|
|
@@ -2788,13 +2788,13 @@ class Fo {
|
|
|
2788
2788
|
this.workers.forEach((e) => e.terminate()), this.workersResolve.length = 0, this.workers.length = 0, this.queue.length = 0, this.workerStatus = 0;
|
|
2789
2789
|
}
|
|
2790
2790
|
}
|
|
2791
|
-
const
|
|
2791
|
+
const Fo = 0, Yt = 2, _o = 1, Jt = 2, Go = 0, Po = 1, No = 10, Uo = 0, Bi = 9, yi = 15, wi = 16, Si = 22, Qi = 37, Mi = 43, xi = 76, vi = 83, Ri = 97, Di = 100, Li = 103, Ti = 109, Vo = 131, Oo = 132, Ho = 133, qo = 134, jo = 137, Ko = 138, zo = 141, Yo = 142, Jo = 145, Wo = 146, ki = 148, Fi = 152, Xo = 157, Zo = 158, _i = 165, Gi = 166, vt = 1000066e3;
|
|
2792
2792
|
class $o {
|
|
2793
2793
|
constructor() {
|
|
2794
2794
|
this.vkFormat = 0, this.typeSize = 1, this.pixelWidth = 0, this.pixelHeight = 0, this.pixelDepth = 0, this.layerCount = 0, this.faceCount = 1, this.supercompressionScheme = 0, this.levels = [], this.dataFormatDescriptor = [{ vendorId: 0, descriptorType: 0, descriptorBlockSize: 0, versionNumber: 2, colorModel: 0, colorPrimaries: 1, transferFunction: 2, flags: 0, texelBlockDimension: [0, 0, 0, 0], bytesPlane: [0, 0, 0, 0, 0, 0, 0, 0], samples: [] }], this.keyValue = {}, this.globalData = null;
|
|
2795
2795
|
}
|
|
2796
2796
|
}
|
|
2797
|
-
class
|
|
2797
|
+
class Qe {
|
|
2798
2798
|
constructor(e, t, i, s) {
|
|
2799
2799
|
this._dataView = void 0, this._littleEndian = void 0, this._offset = void 0, this._dataView = new DataView(e.buffer, e.byteOffset + t, i), this._littleEndian = s, this._offset = 0;
|
|
2800
2800
|
}
|
|
@@ -2840,32 +2840,32 @@ function Wt(c) {
|
|
|
2840
2840
|
function en(c) {
|
|
2841
2841
|
const e = new Uint8Array(c.buffer, c.byteOffset, N.length);
|
|
2842
2842
|
if (e[0] !== N[0] || e[1] !== N[1] || e[2] !== N[2] || e[3] !== N[3] || e[4] !== N[4] || e[5] !== N[5] || e[6] !== N[6] || e[7] !== N[7] || e[8] !== N[8] || e[9] !== N[9] || e[10] !== N[10] || e[11] !== N[11]) throw new Error("Missing KTX 2.0 identifier.");
|
|
2843
|
-
const t = new $o(), i = 17 * Uint32Array.BYTES_PER_ELEMENT, s = new
|
|
2843
|
+
const t = new $o(), i = 17 * Uint32Array.BYTES_PER_ELEMENT, s = new Qe(c, N.length, i, !0);
|
|
2844
2844
|
t.vkFormat = s._nextUint32(), t.typeSize = s._nextUint32(), t.pixelWidth = s._nextUint32(), t.pixelHeight = s._nextUint32(), t.pixelDepth = s._nextUint32(), t.layerCount = s._nextUint32(), t.faceCount = s._nextUint32();
|
|
2845
2845
|
const o = s._nextUint32();
|
|
2846
2846
|
t.supercompressionScheme = s._nextUint32();
|
|
2847
|
-
const n = s._nextUint32(), r = s._nextUint32(), A = s._nextUint32(), a = s._nextUint32(), l = s._nextUint64(), h = s._nextUint64(), d = new
|
|
2848
|
-
for (let
|
|
2849
|
-
const
|
|
2850
|
-
for (let
|
|
2851
|
-
const H = { bitOffset:
|
|
2852
|
-
64 & H.channelType ? (H.sampleLower =
|
|
2847
|
+
const n = s._nextUint32(), r = s._nextUint32(), A = s._nextUint32(), a = s._nextUint32(), l = s._nextUint64(), h = s._nextUint64(), d = new Qe(c, N.length + i, 3 * o * 8, !0);
|
|
2848
|
+
for (let k = 0; k < o; k++) t.levels.push({ levelData: new Uint8Array(c.buffer, c.byteOffset + d._nextUint64(), d._nextUint64()), uncompressedByteLength: d._nextUint64() });
|
|
2849
|
+
const u = new Qe(c, n, r, !0), p = { vendorId: u._skip(4)._nextUint16(), descriptorType: u._nextUint16(), versionNumber: u._nextUint16(), descriptorBlockSize: u._nextUint16(), colorModel: u._nextUint8(), colorPrimaries: u._nextUint8(), transferFunction: u._nextUint8(), flags: u._nextUint8(), texelBlockDimension: [u._nextUint8(), u._nextUint8(), u._nextUint8(), u._nextUint8()], bytesPlane: [u._nextUint8(), u._nextUint8(), u._nextUint8(), u._nextUint8(), u._nextUint8(), u._nextUint8(), u._nextUint8(), u._nextUint8()], samples: [] }, b = (p.descriptorBlockSize / 4 - 6) / 4;
|
|
2850
|
+
for (let k = 0; k < b; k++) {
|
|
2851
|
+
const H = { bitOffset: u._nextUint16(), bitLength: u._nextUint8(), channelType: u._nextUint8(), samplePosition: [u._nextUint8(), u._nextUint8(), u._nextUint8(), u._nextUint8()], sampleLower: -1 / 0, sampleUpper: 1 / 0 };
|
|
2852
|
+
64 & H.channelType ? (H.sampleLower = u._nextInt32(), H.sampleUpper = u._nextInt32()) : (H.sampleLower = u._nextUint32(), H.sampleUpper = u._nextUint32()), p.samples[k] = H;
|
|
2853
2853
|
}
|
|
2854
2854
|
t.dataFormatDescriptor.length = 0, t.dataFormatDescriptor.push(p);
|
|
2855
|
-
const E = new
|
|
2855
|
+
const E = new Qe(c, A, a, !0);
|
|
2856
2856
|
for (; E._offset < a; ) {
|
|
2857
|
-
const
|
|
2858
|
-
if (t.keyValue[oe] = E._nextUint8Array(
|
|
2857
|
+
const k = E._nextUint32(), H = E._scan(k), oe = Wt(H);
|
|
2858
|
+
if (t.keyValue[oe] = E._nextUint8Array(k - H.byteLength - 1), oe.match(/^ktx/i)) {
|
|
2859
2859
|
const we = Wt(t.keyValue[oe]);
|
|
2860
2860
|
t.keyValue[oe] = we.substring(0, we.lastIndexOf("\0"));
|
|
2861
2861
|
}
|
|
2862
|
-
E._skip(
|
|
2862
|
+
E._skip(k % 4 ? 4 - k % 4 : 0);
|
|
2863
2863
|
}
|
|
2864
2864
|
if (h <= 0) return t;
|
|
2865
|
-
const f = new
|
|
2866
|
-
for (let
|
|
2867
|
-
const D = l + f._offset,
|
|
2868
|
-
return t.globalData = { endpointCount: m, selectorCount: I, imageDescs:
|
|
2865
|
+
const f = new Qe(c, l, h, !0), m = f._nextUint16(), I = f._nextUint16(), C = f._nextUint32(), B = f._nextUint32(), y = f._nextUint32(), w = f._nextUint32(), M = [];
|
|
2866
|
+
for (let k = 0; k < o; k++) M.push({ imageFlags: f._nextUint32(), rgbSliceByteOffset: f._nextUint32(), rgbSliceByteLength: f._nextUint32(), alphaSliceByteOffset: f._nextUint32(), alphaSliceByteLength: f._nextUint32() });
|
|
2867
|
+
const D = l + f._offset, S = D + C, R = S + B, x = R + y, J = new Uint8Array(c.buffer, c.byteOffset + D, C), W = new Uint8Array(c.buffer, c.byteOffset + S, B), ye = new Uint8Array(c.buffer, c.byteOffset + R, y), q = new Uint8Array(c.buffer, c.byteOffset + x, w);
|
|
2868
|
+
return t.globalData = { endpointCount: m, selectorCount: I, imageDescs: M, endpointsData: J, selectorsData: W, tablesData: ye, extendedData: q }, t;
|
|
2869
2869
|
}
|
|
2870
2870
|
let et, te, Et;
|
|
2871
2871
|
const tt = { env: { emscripten_notify_memory_growth: function(c) {
|
|
@@ -2895,7 +2895,7 @@ class K extends yt {
|
|
|
2895
2895
|
* @param {LoadingManager} [manager] - The loading manager.
|
|
2896
2896
|
*/
|
|
2897
2897
|
constructor(e) {
|
|
2898
|
-
super(e), this.transcoderPath = "", this.transcoderBinary = null, this.transcoderPending = null, this.workerPool = new
|
|
2898
|
+
super(e), this.transcoderPath = "", this.transcoderBinary = null, this.transcoderPending = null, this.workerPool = new ko(), this.workerSourceURL = "", this.workerConfig = null, typeof MSC_TRANSCODER < "u" && console.warn(
|
|
2899
2899
|
'THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.'
|
|
2900
2900
|
);
|
|
2901
2901
|
}
|
|
@@ -3036,9 +3036,9 @@ class K extends yt {
|
|
|
3036
3036
|
h = new Is(o, A, a);
|
|
3037
3037
|
else {
|
|
3038
3038
|
const d = o[0].mipmaps;
|
|
3039
|
-
h = t.layerCount > 1 ? new Bs(d, n, r, t.layerCount, A, a) : new
|
|
3039
|
+
h = t.layerCount > 1 ? new Bs(d, n, r, t.layerCount, A, a) : new gi(d, n, r, A, a);
|
|
3040
3040
|
}
|
|
3041
|
-
return h.minFilter = o[0].mipmaps.length === 1 ? he :
|
|
3041
|
+
return h.minFilter = o[0].mipmaps.length === 1 ? he : qe, h.magFilter = he, h.generateMipmaps = !1, h.needsUpdate = !0, h.colorSpace = Pi(t), h.premultiplyAlpha = !!(l & _o), h;
|
|
3042
3042
|
}
|
|
3043
3043
|
/**
|
|
3044
3044
|
* @private
|
|
@@ -3090,15 +3090,15 @@ K.TranscoderFormat = {
|
|
|
3090
3090
|
};
|
|
3091
3091
|
K.EngineFormat = {
|
|
3092
3092
|
RGBAFormat: me,
|
|
3093
|
-
RGBA_ASTC_4x4_Format:
|
|
3093
|
+
RGBA_ASTC_4x4_Format: Pe,
|
|
3094
3094
|
RGB_BPTC_UNSIGNED_Format: xs,
|
|
3095
|
-
RGBA_BPTC_Format:
|
|
3095
|
+
RGBA_BPTC_Format: gt,
|
|
3096
3096
|
RGBA_ETC2_EAC_Format: pi,
|
|
3097
3097
|
RGBA_PVRTC_4BPPV1_Format: Ms,
|
|
3098
3098
|
RGBA_S3TC_DXT5_Format: pt,
|
|
3099
|
-
RGB_ETC1_Format:
|
|
3099
|
+
RGB_ETC1_Format: Qs,
|
|
3100
3100
|
RGB_ETC2_Format: fi,
|
|
3101
|
-
RGB_PVRTC_4BPPV1_Format:
|
|
3101
|
+
RGB_PVRTC_4BPPV1_Format: Ss,
|
|
3102
3102
|
RGBA_S3TC_DXT1_Format: ft
|
|
3103
3103
|
};
|
|
3104
3104
|
K.EngineType = {
|
|
@@ -3110,72 +3110,72 @@ K.BasisWorker = function() {
|
|
|
3110
3110
|
let c, e, t;
|
|
3111
3111
|
const i = _EngineFormat, s = _EngineType, o = _TranscoderFormat, n = _BasisFormat;
|
|
3112
3112
|
self.addEventListener("message", function(p) {
|
|
3113
|
-
const
|
|
3114
|
-
switch (
|
|
3113
|
+
const b = p.data;
|
|
3114
|
+
switch (b.type) {
|
|
3115
3115
|
case "init":
|
|
3116
|
-
c =
|
|
3116
|
+
c = b.config, r(b.transcoderBinary);
|
|
3117
3117
|
break;
|
|
3118
3118
|
case "transcode":
|
|
3119
3119
|
e.then(() => {
|
|
3120
3120
|
try {
|
|
3121
|
-
const { faces: E, buffers: f, width: m, height: I, hasAlpha:
|
|
3122
|
-
self.postMessage({ type: "transcode", id:
|
|
3121
|
+
const { faces: E, buffers: f, width: m, height: I, hasAlpha: C, format: B, type: y, dfdFlags: w } = A(b.buffer);
|
|
3122
|
+
self.postMessage({ type: "transcode", id: b.id, data: { faces: E, width: m, height: I, hasAlpha: C, format: B, type: y, dfdFlags: w } }, f);
|
|
3123
3123
|
} catch (E) {
|
|
3124
|
-
console.error(E), self.postMessage({ type: "error", id:
|
|
3124
|
+
console.error(E), self.postMessage({ type: "error", id: b.id, error: E.message });
|
|
3125
3125
|
}
|
|
3126
3126
|
});
|
|
3127
3127
|
break;
|
|
3128
3128
|
}
|
|
3129
3129
|
});
|
|
3130
3130
|
function r(p) {
|
|
3131
|
-
e = new Promise((
|
|
3132
|
-
t = { wasmBinary: p, onRuntimeInitialized:
|
|
3131
|
+
e = new Promise((b) => {
|
|
3132
|
+
t = { wasmBinary: p, onRuntimeInitialized: b }, BASIS(t);
|
|
3133
3133
|
}).then(() => {
|
|
3134
3134
|
t.initializeBasis(), t.KTX2File === void 0 && console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.");
|
|
3135
3135
|
});
|
|
3136
3136
|
}
|
|
3137
3137
|
function A(p) {
|
|
3138
|
-
const
|
|
3138
|
+
const b = new t.KTX2File(new Uint8Array(p));
|
|
3139
3139
|
function E() {
|
|
3140
|
-
|
|
3140
|
+
b.close(), b.delete();
|
|
3141
3141
|
}
|
|
3142
|
-
if (!
|
|
3142
|
+
if (!b.isValid())
|
|
3143
3143
|
throw E(), new Error("THREE.KTX2Loader: Invalid or unsupported .ktx2 file");
|
|
3144
3144
|
let f;
|
|
3145
|
-
if (
|
|
3145
|
+
if (b.isUASTC())
|
|
3146
3146
|
f = n.UASTC;
|
|
3147
|
-
else if (
|
|
3147
|
+
else if (b.isETC1S())
|
|
3148
3148
|
f = n.ETC1S;
|
|
3149
|
-
else if (
|
|
3149
|
+
else if (b.isHDR())
|
|
3150
3150
|
f = n.UASTC_HDR;
|
|
3151
3151
|
else
|
|
3152
3152
|
throw new Error("THREE.KTX2Loader: Unknown Basis encoding");
|
|
3153
|
-
const m =
|
|
3153
|
+
const m = b.getWidth(), I = b.getHeight(), C = b.getLayers() || 1, B = b.getLevels(), y = b.getFaces(), w = b.getHasAlpha(), M = b.getDFDFlags(), { transcoderFormat: D, engineFormat: S, engineType: R } = h(f, m, I, w);
|
|
3154
3154
|
if (!m || !I || !B)
|
|
3155
3155
|
throw E(), new Error("THREE.KTX2Loader: Invalid texture");
|
|
3156
|
-
if (!
|
|
3156
|
+
if (!b.startTranscoding())
|
|
3157
3157
|
throw E(), new Error("THREE.KTX2Loader: .startTranscoding failed");
|
|
3158
|
-
const
|
|
3158
|
+
const x = [], J = [];
|
|
3159
3159
|
for (let W = 0; W < y; W++) {
|
|
3160
3160
|
const ye = [];
|
|
3161
3161
|
for (let q = 0; q < B; q++) {
|
|
3162
|
-
const
|
|
3162
|
+
const k = [];
|
|
3163
3163
|
let H, oe;
|
|
3164
|
-
for (let de = 0; de <
|
|
3165
|
-
const
|
|
3166
|
-
W === 0 && q === 0 && de === 0 && (
|
|
3167
|
-
let
|
|
3168
|
-
const Vi =
|
|
3169
|
-
if (
|
|
3164
|
+
for (let de = 0; de < C; de++) {
|
|
3165
|
+
const ue = b.getImageLevelInfo(q, de, W);
|
|
3166
|
+
W === 0 && q === 0 && de === 0 && (ue.origWidth % 4 !== 0 || ue.origHeight % 4 !== 0) && console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."), B > 1 ? (H = ue.origWidth, oe = ue.origHeight) : (H = ue.width, oe = ue.height);
|
|
3167
|
+
let ge = new Uint8Array(b.getImageTranscodedSizeInBytes(q, de, 0, D));
|
|
3168
|
+
const Vi = b.transcodeImage(ge, q, de, W, D, 0, -1, -1);
|
|
3169
|
+
if (R === s.HalfFloatType && (ge = new Uint16Array(ge.buffer, ge.byteOffset, ge.byteLength / Uint16Array.BYTES_PER_ELEMENT)), !Vi)
|
|
3170
3170
|
throw E(), new Error("THREE.KTX2Loader: .transcodeImage failed.");
|
|
3171
|
-
|
|
3171
|
+
k.push(ge);
|
|
3172
3172
|
}
|
|
3173
|
-
const we =
|
|
3173
|
+
const we = u(k);
|
|
3174
3174
|
ye.push({ data: we, width: H, height: oe }), J.push(we.buffer);
|
|
3175
3175
|
}
|
|
3176
|
-
|
|
3176
|
+
x.push({ mipmaps: ye, width: m, height: I, format: S, type: R });
|
|
3177
3177
|
}
|
|
3178
|
-
return E(), { faces:
|
|
3178
|
+
return E(), { faces: x, buffers: J, width: m, height: I, hasAlpha: w, dfdFlags: M, format: S, type: R };
|
|
3179
3179
|
}
|
|
3180
3180
|
const a = [
|
|
3181
3181
|
{
|
|
@@ -3270,16 +3270,16 @@ K.BasisWorker = function() {
|
|
|
3270
3270
|
// a historical accident shown to avoid performance pitfalls for Linux with
|
|
3271
3271
|
// Firefox & AMD GPU (RadeonSI). Further work needed.
|
|
3272
3272
|
// See https://github.com/mrdoob/three.js/pull/29730.
|
|
3273
|
-
[n.ETC1S]: a.filter((p) => p.basisFormat.includes(n.ETC1S)).sort((p,
|
|
3274
|
-
[n.UASTC]: a.filter((p) => p.basisFormat.includes(n.UASTC)).sort((p,
|
|
3275
|
-
[n.UASTC_HDR]: a.filter((p) => p.basisFormat.includes(n.UASTC_HDR)).sort((p,
|
|
3273
|
+
[n.ETC1S]: a.filter((p) => p.basisFormat.includes(n.ETC1S)).sort((p, b) => p.priorityUASTC - b.priorityUASTC),
|
|
3274
|
+
[n.UASTC]: a.filter((p) => p.basisFormat.includes(n.UASTC)).sort((p, b) => p.priorityUASTC - b.priorityUASTC),
|
|
3275
|
+
[n.UASTC_HDR]: a.filter((p) => p.basisFormat.includes(n.UASTC_HDR)).sort((p, b) => p.priorityHDR - b.priorityHDR)
|
|
3276
3276
|
};
|
|
3277
|
-
function h(p,
|
|
3277
|
+
function h(p, b, E, f) {
|
|
3278
3278
|
const m = l[p];
|
|
3279
3279
|
for (let I = 0; I < m.length; I++) {
|
|
3280
|
-
const
|
|
3281
|
-
if (
|
|
3282
|
-
const B =
|
|
3280
|
+
const C = m[I];
|
|
3281
|
+
if (C.if && !c[C.if] || !C.basisFormat.includes(p) || f && C.transcoderFormat.length < 2 || C.needsPowerOfTwo && !(d(b) && d(E))) continue;
|
|
3282
|
+
const B = C.transcoderFormat[f ? 1 : 0], y = C.engineFormat[f ? 1 : 0], w = C.engineType[0];
|
|
3283
3283
|
return { transcoderFormat: B, engineFormat: y, engineType: w };
|
|
3284
3284
|
}
|
|
3285
3285
|
throw new Error("THREE.KTX2Loader: Failed to identify transcoding target.");
|
|
@@ -3287,14 +3287,14 @@ K.BasisWorker = function() {
|
|
|
3287
3287
|
function d(p) {
|
|
3288
3288
|
return p <= 2 ? !0 : (p & p - 1) === 0 && p !== 0;
|
|
3289
3289
|
}
|
|
3290
|
-
function
|
|
3290
|
+
function u(p) {
|
|
3291
3291
|
if (p.length === 1) return p[0];
|
|
3292
|
-
let
|
|
3292
|
+
let b = 0;
|
|
3293
3293
|
for (let m = 0; m < p.length; m++) {
|
|
3294
3294
|
const I = p[m];
|
|
3295
|
-
|
|
3295
|
+
b += I.byteLength;
|
|
3296
3296
|
}
|
|
3297
|
-
const E = new Uint8Array(
|
|
3297
|
+
const E = new Uint8Array(b);
|
|
3298
3298
|
let f = 0;
|
|
3299
3299
|
for (let m = 0; m < p.length; m++) {
|
|
3300
3300
|
const I = p[m];
|
|
@@ -3304,23 +3304,23 @@ K.BasisWorker = function() {
|
|
|
3304
3304
|
}
|
|
3305
3305
|
};
|
|
3306
3306
|
const nn = /* @__PURE__ */ new Set([me, xe, Me]), nt = {
|
|
3307
|
-
[
|
|
3307
|
+
[Ti]: me,
|
|
3308
3308
|
[Ri]: me,
|
|
3309
|
-
[
|
|
3309
|
+
[Qi]: me,
|
|
3310
3310
|
[Mi]: me,
|
|
3311
|
-
[
|
|
3311
|
+
[Li]: xe,
|
|
3312
3312
|
[vi]: xe,
|
|
3313
3313
|
[wi]: xe,
|
|
3314
|
-
[
|
|
3314
|
+
[Si]: xe,
|
|
3315
3315
|
[Di]: Me,
|
|
3316
3316
|
[xi]: Me,
|
|
3317
3317
|
[yi]: Me,
|
|
3318
3318
|
[Bi]: Me,
|
|
3319
|
-
[
|
|
3320
|
-
[
|
|
3321
|
-
[vt]:
|
|
3322
|
-
[Zo]:
|
|
3323
|
-
[Xo]:
|
|
3319
|
+
[ki]: fi,
|
|
3320
|
+
[Fi]: pi,
|
|
3321
|
+
[vt]: Pe,
|
|
3322
|
+
[Zo]: Pe,
|
|
3323
|
+
[Xo]: Pe,
|
|
3324
3324
|
[Gi]: Nt,
|
|
3325
3325
|
[_i]: Nt,
|
|
3326
3326
|
[Ho]: ft,
|
|
@@ -3331,23 +3331,23 @@ const nn = /* @__PURE__ */ new Set([me, xe, Me]), nt = {
|
|
|
3331
3331
|
[jo]: Gt,
|
|
3332
3332
|
[Yo]: pt,
|
|
3333
3333
|
[zo]: pt,
|
|
3334
|
-
[Wo]:
|
|
3335
|
-
[Jo]:
|
|
3334
|
+
[Wo]: gt,
|
|
3335
|
+
[Jo]: gt
|
|
3336
3336
|
}, rt = {
|
|
3337
|
-
[
|
|
3337
|
+
[Ti]: De,
|
|
3338
3338
|
[Ri]: be,
|
|
3339
|
-
[
|
|
3339
|
+
[Qi]: z,
|
|
3340
3340
|
[Mi]: z,
|
|
3341
|
-
[
|
|
3341
|
+
[Li]: De,
|
|
3342
3342
|
[vi]: be,
|
|
3343
3343
|
[wi]: z,
|
|
3344
|
-
[
|
|
3344
|
+
[Si]: z,
|
|
3345
3345
|
[Di]: De,
|
|
3346
3346
|
[xi]: be,
|
|
3347
3347
|
[yi]: z,
|
|
3348
3348
|
[Bi]: z,
|
|
3349
|
-
[Fi]: z,
|
|
3350
3349
|
[ki]: z,
|
|
3350
|
+
[Fi]: z,
|
|
3351
3351
|
[vt]: be,
|
|
3352
3352
|
[Gi]: z,
|
|
3353
3353
|
[_i]: z
|
|
@@ -3365,7 +3365,7 @@ async function rn(c) {
|
|
|
3365
3365
|
for (let o = 0; o < c.levels.length; o++) {
|
|
3366
3366
|
const n = Math.max(1, c.pixelWidth >> o), r = Math.max(1, c.pixelHeight >> o), A = c.pixelDepth ? Math.max(1, c.pixelDepth >> o) : 0, a = c.levels[o];
|
|
3367
3367
|
let l;
|
|
3368
|
-
if (c.supercompressionScheme ===
|
|
3368
|
+
if (c.supercompressionScheme === Fo)
|
|
3369
3369
|
l = a.levelData;
|
|
3370
3370
|
else if (c.supercompressionScheme === Yt)
|
|
3371
3371
|
l = t.decode(a.levelData, a.uncompressedByteLength);
|
|
@@ -3392,7 +3392,7 @@ async function rn(c) {
|
|
|
3392
3392
|
s = c.pixelDepth === 0 ? new ys(i[0].data, c.pixelWidth, c.pixelHeight) : new ws(i[0].data, c.pixelWidth, c.pixelHeight, c.pixelDepth);
|
|
3393
3393
|
else {
|
|
3394
3394
|
if (c.pixelDepth > 0) throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");
|
|
3395
|
-
s = new
|
|
3395
|
+
s = new gi(i, c.pixelWidth, c.pixelHeight), s.minFilter = i.length === 1 ? he : qe, s.magFilter = he;
|
|
3396
3396
|
}
|
|
3397
3397
|
return s.mipmaps = i, s.type = rt[e], s.format = nt[e], s.colorSpace = Pi(c), s.needsUpdate = !0, Promise.resolve(s);
|
|
3398
3398
|
}
|
|
@@ -3524,18 +3524,18 @@ var an = function() {
|
|
|
3524
3524
|
});
|
|
3525
3525
|
function r(f) {
|
|
3526
3526
|
for (var m = new Uint8Array(f.length), I = 0; I < f.length; ++I) {
|
|
3527
|
-
var
|
|
3528
|
-
m[I] =
|
|
3527
|
+
var C = f.charCodeAt(I);
|
|
3528
|
+
m[I] = C > 96 ? C - 97 : C > 64 ? C - 39 : C + 4;
|
|
3529
3529
|
}
|
|
3530
3530
|
for (var B = 0, I = 0; I < f.length; ++I)
|
|
3531
3531
|
m[B++] = m[I] < 60 ? i[m[I]] : (m[I] - 60) * 64 + m[++I];
|
|
3532
3532
|
return m.buffer.slice(0, B);
|
|
3533
3533
|
}
|
|
3534
|
-
function A(f, m, I,
|
|
3535
|
-
var
|
|
3536
|
-
|
|
3537
|
-
var J = m(
|
|
3538
|
-
if (J == 0 && w && w(
|
|
3534
|
+
function A(f, m, I, C, B, y, w) {
|
|
3535
|
+
var M = f.exports.sbrk, D = C + 3 & -4, S = M(D * B), R = M(y.length), x = new Uint8Array(f.exports.memory.buffer);
|
|
3536
|
+
x.set(y, R);
|
|
3537
|
+
var J = m(S, C, B, R, y.length);
|
|
3538
|
+
if (J == 0 && w && w(S, D, B), I.set(x.subarray(S, S + C * B)), M(S - M(0)), J != 0)
|
|
3539
3539
|
throw new Error("Malformed buffer data: " + J);
|
|
3540
3540
|
}
|
|
3541
3541
|
var a = {
|
|
@@ -3548,30 +3548,30 @@ var an = function() {
|
|
|
3548
3548
|
TRIANGLES: "meshopt_decodeIndexBuffer",
|
|
3549
3549
|
INDICES: "meshopt_decodeIndexSequence"
|
|
3550
3550
|
}, h = [], d = 0;
|
|
3551
|
-
function
|
|
3551
|
+
function u(f) {
|
|
3552
3552
|
var m = {
|
|
3553
3553
|
object: new Worker(f),
|
|
3554
3554
|
pending: 0,
|
|
3555
3555
|
requests: {}
|
|
3556
3556
|
};
|
|
3557
3557
|
return m.object.onmessage = function(I) {
|
|
3558
|
-
var
|
|
3559
|
-
m.pending -=
|
|
3558
|
+
var C = I.data;
|
|
3559
|
+
m.pending -= C.count, m.requests[C.id][C.action](C.value), delete m.requests[C.id];
|
|
3560
3560
|
}, m;
|
|
3561
3561
|
}
|
|
3562
3562
|
function p(f) {
|
|
3563
|
-
for (var m = "self.ready = WebAssembly.instantiate(new Uint8Array([" + new Uint8Array(s) + "]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = " + E.name + ";" + A.toString() + E.toString(), I = new Blob([m], { type: "text/javascript" }),
|
|
3564
|
-
h[B] =
|
|
3563
|
+
for (var m = "self.ready = WebAssembly.instantiate(new Uint8Array([" + new Uint8Array(s) + "]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = " + E.name + ";" + A.toString() + E.toString(), I = new Blob([m], { type: "text/javascript" }), C = URL.createObjectURL(I), B = h.length; B < f; ++B)
|
|
3564
|
+
h[B] = u(C);
|
|
3565
3565
|
for (var B = f; B < h.length; ++B)
|
|
3566
3566
|
h[B].object.postMessage({});
|
|
3567
|
-
h.length = f, URL.revokeObjectURL(
|
|
3567
|
+
h.length = f, URL.revokeObjectURL(C);
|
|
3568
3568
|
}
|
|
3569
|
-
function
|
|
3569
|
+
function b(f, m, I, C, B) {
|
|
3570
3570
|
for (var y = h[0], w = 1; w < h.length; ++w)
|
|
3571
3571
|
h[w].pending < y.pending && (y = h[w]);
|
|
3572
|
-
return new Promise(function(
|
|
3573
|
-
var
|
|
3574
|
-
y.pending += f, y.requests[
|
|
3572
|
+
return new Promise(function(M, D) {
|
|
3573
|
+
var S = new Uint8Array(I), R = ++d;
|
|
3574
|
+
y.pending += f, y.requests[R] = { resolve: M, reject: D }, y.object.postMessage({ id: R, count: f, size: m, source: S, mode: C, filter: B }, [S.buffer]);
|
|
3575
3575
|
});
|
|
3576
3576
|
}
|
|
3577
3577
|
function E(f) {
|
|
@@ -3580,8 +3580,8 @@ var an = function() {
|
|
|
3580
3580
|
return self.close();
|
|
3581
3581
|
self.ready.then(function(I) {
|
|
3582
3582
|
try {
|
|
3583
|
-
var
|
|
3584
|
-
A(I, I.exports[m.mode],
|
|
3583
|
+
var C = new Uint8Array(m.count * m.size);
|
|
3584
|
+
A(I, I.exports[m.mode], C, m.count, m.size, m.source, I.exports[m.filter]), self.postMessage({ id: m.id, count: m.count, action: "resolve", value: C }, [C.buffer]);
|
|
3585
3585
|
} catch (B) {
|
|
3586
3586
|
self.postMessage({ id: m.id, count: m.count, action: "reject", value: B });
|
|
3587
3587
|
}
|
|
@@ -3593,22 +3593,22 @@ var an = function() {
|
|
|
3593
3593
|
useWorkers: function(f) {
|
|
3594
3594
|
p(f);
|
|
3595
3595
|
},
|
|
3596
|
-
decodeVertexBuffer: function(f, m, I,
|
|
3597
|
-
A(o, o.exports.meshopt_decodeVertexBuffer, f, m, I,
|
|
3596
|
+
decodeVertexBuffer: function(f, m, I, C, B) {
|
|
3597
|
+
A(o, o.exports.meshopt_decodeVertexBuffer, f, m, I, C, o.exports[a[B]]);
|
|
3598
3598
|
},
|
|
3599
|
-
decodeIndexBuffer: function(f, m, I,
|
|
3600
|
-
A(o, o.exports.meshopt_decodeIndexBuffer, f, m, I,
|
|
3599
|
+
decodeIndexBuffer: function(f, m, I, C) {
|
|
3600
|
+
A(o, o.exports.meshopt_decodeIndexBuffer, f, m, I, C);
|
|
3601
3601
|
},
|
|
3602
|
-
decodeIndexSequence: function(f, m, I,
|
|
3603
|
-
A(o, o.exports.meshopt_decodeIndexSequence, f, m, I,
|
|
3602
|
+
decodeIndexSequence: function(f, m, I, C) {
|
|
3603
|
+
A(o, o.exports.meshopt_decodeIndexSequence, f, m, I, C);
|
|
3604
3604
|
},
|
|
3605
|
-
decodeGltfBuffer: function(f, m, I,
|
|
3606
|
-
A(o, o.exports[l[B]], f, m, I,
|
|
3605
|
+
decodeGltfBuffer: function(f, m, I, C, B, y) {
|
|
3606
|
+
A(o, o.exports[l[B]], f, m, I, C, o.exports[a[y]]);
|
|
3607
3607
|
},
|
|
3608
|
-
decodeGltfBufferAsync: function(f, m, I,
|
|
3609
|
-
return h.length > 0 ?
|
|
3608
|
+
decodeGltfBufferAsync: function(f, m, I, C, B) {
|
|
3609
|
+
return h.length > 0 ? b(f, m, I, l[C], a[B]) : n.then(function() {
|
|
3610
3610
|
var y = new Uint8Array(f * m);
|
|
3611
|
-
return A(o, o.exports[l[
|
|
3611
|
+
return A(o, o.exports[l[C]], y, f, m, I, o.exports[a[B]]), y;
|
|
3612
3612
|
});
|
|
3613
3613
|
}
|
|
3614
3614
|
};
|
|
@@ -3628,11 +3628,20 @@ function at(c) {
|
|
|
3628
3628
|
});
|
|
3629
3629
|
}
|
|
3630
3630
|
function ln() {
|
|
3631
|
-
|
|
3631
|
+
g.Cache && typeof g.Cache.clear == "function" && g.Cache.clear();
|
|
3632
3632
|
}
|
|
3633
3633
|
class O {
|
|
3634
3634
|
constructor(e = null) {
|
|
3635
|
-
this.renderer = e, this.isIOSWebKit = O.isIOSWebKit(), this.platformKey = O.getPlatformKey(), this.loader = new xt(), this.dracoLoader = new
|
|
3635
|
+
this.renderer = e, this.isIOSWebKit = O.isIOSWebKit(), this.platformKey = O.getPlatformKey(), this.loader = new xt(), this.dracoLoader = new Lo(), this.ktx2Loader = null, this.loadQueue = Promise.resolve(), this.activeIOSLoad = !1, this.dracoLoader.setDecoderPath("https://www.gstatic.com/draco/versioned/decoders/1.5.6/"), this.isIOSWebKit && typeof this.dracoLoader.setWorkerLimit == "function" && this.dracoLoader.setWorkerLimit(1), this.loader.setDRACOLoader(this.dracoLoader), this.loader.setMeshoptDecoder(an), this.loader.register((t) => ({
|
|
3636
|
+
name: "KHR_materials_pbrSpecularGlossiness",
|
|
3637
|
+
extendMaterialParams: async (i, s) => {
|
|
3638
|
+
const o = t.json.materials[i];
|
|
3639
|
+
if (!o.extensions || !o.extensions.KHR_materials_pbrSpecularGlossiness)
|
|
3640
|
+
return Promise.resolve();
|
|
3641
|
+
const n = o.extensions.KHR_materials_pbrSpecularGlossiness;
|
|
3642
|
+
return n.diffuseTexture !== void 0 && (s.map = await t.getDependency("texture", n.diffuseTexture.index)), n.diffuseFactor !== void 0 && (s.color = new g.Color().fromArray(n.diffuseFactor)), n.glossinessFactor !== void 0 && (s.roughness = 1 - n.glossinessFactor), s.metalness = 0, Promise.resolve();
|
|
3643
|
+
}
|
|
3644
|
+
})), this.cache = /* @__PURE__ */ new Map(), this.ktx2SetupComplete = !1, this.setupKTX2Loader();
|
|
3636
3645
|
}
|
|
3637
3646
|
setupKTX2Loader() {
|
|
3638
3647
|
const e = this.platformKey;
|
|
@@ -3716,16 +3725,23 @@ class O {
|
|
|
3716
3725
|
const n = Array.isArray(o.material) ? o.material : [o.material];
|
|
3717
3726
|
n.forEach((r, A) => {
|
|
3718
3727
|
if (r.emissive && r.emissive.setHex(0), r.emissiveIntensity !== void 0 && (r.emissiveIntensity = 0), r.emissiveMap && (r.emissiveMap = null), r.lightMap && (r.lightMap = null), r.lightMapIntensity !== void 0 && (r.lightMapIntensity = 0), r.type === "MeshBasicMaterial" || r.type === "MeshPhongMaterial") {
|
|
3719
|
-
const l = new
|
|
3728
|
+
const l = new g.MeshStandardMaterial({
|
|
3720
3729
|
// Only include common, safe params; set specialized textures conditionally below
|
|
3721
|
-
color: r.color || new
|
|
3722
|
-
side: r.side !== void 0 ? r.side :
|
|
3730
|
+
color: r.color || new g.Color(16777215),
|
|
3731
|
+
side: r.side !== void 0 ? r.side : g.FrontSide,
|
|
3723
3732
|
wireframe: r.wireframe || !1,
|
|
3724
3733
|
vertexColors: r.vertexColors || !1,
|
|
3725
3734
|
fog: r.fog !== void 0 ? r.fog : !0,
|
|
3726
|
-
flatShading: !1
|
|
3735
|
+
flatShading: !1,
|
|
3736
|
+
// Realistic shipwreck appearance
|
|
3737
|
+
roughness: 0.8,
|
|
3738
|
+
// Weathered, corroded metal/wood
|
|
3739
|
+
metalness: 0.3
|
|
3740
|
+
// Mix of metal and non-metal
|
|
3727
3741
|
});
|
|
3728
|
-
r.map && (l.map = r.map), r.alphaMap && (l.alphaMap = r.alphaMap), r.aoMap && (l.aoMap = r.aoMap), typeof r.aoMapIntensity == "number" && (l.aoMapIntensity = r.aoMapIntensity), r.envMap && (l.envMap = r.envMap),
|
|
3742
|
+
r.map && (l.map = r.map), r.alphaMap && (l.alphaMap = r.alphaMap), r.aoMap && (l.aoMap = r.aoMap), typeof r.aoMapIntensity == "number" && (l.aoMapIntensity = r.aoMapIntensity), r.envMap && (l.envMap = r.envMap), r.roughnessMap && (l.roughnessMap = r.roughnessMap), r.metalnessMap && (l.metalnessMap = r.metalnessMap), r.transparent !== void 0 && (l.transparent = r.transparent), typeof r.opacity == "number" && (l.opacity = r.opacity), r.normalMap && (l.normalMap = r.normalMap, l.normalScale = r.normalScale || new g.Vector2(1, 1)), i !== null && ["map", "normalMap", "roughnessMap", "metalnessMap", "aoMap"].forEach((d) => {
|
|
3743
|
+
l[d] && (l[d].anisotropy = i, l[d].needsUpdate = !0);
|
|
3744
|
+
}), l.needsUpdate = !0, Array.isArray(o.material) ? o.material[A] = l : o.material = l, r !== l && typeof r?.dispose == "function" && r.dispose();
|
|
3729
3745
|
} else (r.type === "MeshStandardMaterial" || r.type === "MeshPhysicalMaterial") && (i !== null && ["map", "normalMap", "roughnessMap", "metalnessMap", "aoMap", "emissiveMap"].forEach((h) => {
|
|
3730
3746
|
r[h] && (r[h].anisotropy = i, r[h].needsUpdate = !0);
|
|
3731
3747
|
}), r.needsUpdate = !0);
|
|
@@ -3734,7 +3750,7 @@ class O {
|
|
|
3734
3750
|
}), o.geometry && (o.geometry.computeVertexNormals(), o.geometry.normalizeNormals(), n.some((A) => A.normalMap) && o.geometry.computeTangents());
|
|
3735
3751
|
}
|
|
3736
3752
|
});
|
|
3737
|
-
const s = new
|
|
3753
|
+
const s = new g.Box3().setFromObject(t);
|
|
3738
3754
|
return t.userData.boundingBox = s, t;
|
|
3739
3755
|
}
|
|
3740
3756
|
getMaxAnisotropy() {
|
|
@@ -3829,8 +3845,8 @@ class Be {
|
|
|
3829
3845
|
const i = document.createElement("button");
|
|
3830
3846
|
function s() {
|
|
3831
3847
|
let a = null;
|
|
3832
|
-
async function l(
|
|
3833
|
-
|
|
3848
|
+
async function l(u) {
|
|
3849
|
+
u.addEventListener("end", h), await e.xr.setSession(u), i.textContent = "EXIT VR", a = u;
|
|
3834
3850
|
}
|
|
3835
3851
|
function h() {
|
|
3836
3852
|
a.removeEventListener("end", h), i.textContent = "ENTER VR", a = null;
|
|
@@ -3850,11 +3866,11 @@ class Be {
|
|
|
3850
3866
|
}, i.onmouseleave = function() {
|
|
3851
3867
|
i.style.opacity = "0.5";
|
|
3852
3868
|
}, i.onclick = function() {
|
|
3853
|
-
a === null ? navigator.xr.requestSession("immersive-vr", d).then(l) : (a.end(), navigator.xr.offerSession !== void 0 && navigator.xr.offerSession("immersive-vr", d).then(l).catch((
|
|
3854
|
-
console.warn(
|
|
3869
|
+
a === null ? navigator.xr.requestSession("immersive-vr", d).then(l) : (a.end(), navigator.xr.offerSession !== void 0 && navigator.xr.offerSession("immersive-vr", d).then(l).catch((u) => {
|
|
3870
|
+
console.warn(u);
|
|
3855
3871
|
}));
|
|
3856
|
-
}, navigator.xr.offerSession !== void 0 && navigator.xr.offerSession("immersive-vr", d).then(l).catch((
|
|
3857
|
-
console.warn(
|
|
3872
|
+
}, navigator.xr.offerSession !== void 0 && navigator.xr.offerSession("immersive-vr", d).then(l).catch((u) => {
|
|
3873
|
+
console.warn(u);
|
|
3858
3874
|
});
|
|
3859
3875
|
}
|
|
3860
3876
|
function o() {
|
|
@@ -4128,13 +4144,13 @@ async function dn(c, e, t = null, i = !0) {
|
|
|
4128
4144
|
}
|
|
4129
4145
|
return { profile: n, assetPath: r };
|
|
4130
4146
|
}
|
|
4131
|
-
const
|
|
4147
|
+
const un = {
|
|
4132
4148
|
xAxis: 0,
|
|
4133
4149
|
yAxis: 0,
|
|
4134
4150
|
button: 0,
|
|
4135
4151
|
state: T.ComponentState.DEFAULT
|
|
4136
4152
|
};
|
|
4137
|
-
function
|
|
4153
|
+
function gn(c = 0, e = 0) {
|
|
4138
4154
|
let t = c, i = e;
|
|
4139
4155
|
if (Math.sqrt(c * c + e * e) > 1) {
|
|
4140
4156
|
const n = Math.atan2(e, c);
|
|
@@ -4147,7 +4163,7 @@ function un(c = 0, e = 0) {
|
|
|
4147
4163
|
}
|
|
4148
4164
|
class pn {
|
|
4149
4165
|
constructor(e) {
|
|
4150
|
-
this.componentProperty = e.componentProperty, this.states = e.states, this.valueNodeName = e.valueNodeName, this.valueNodeProperty = e.valueNodeProperty, this.valueNodeProperty === T.VisualResponseProperty.TRANSFORM && (this.minNodeName = e.minNodeName, this.maxNodeName = e.maxNodeName), this.value = 0, this.updateFromComponent(
|
|
4166
|
+
this.componentProperty = e.componentProperty, this.states = e.states, this.valueNodeName = e.valueNodeName, this.valueNodeProperty = e.valueNodeProperty, this.valueNodeProperty === T.VisualResponseProperty.TRANSFORM && (this.minNodeName = e.minNodeName, this.maxNodeName = e.maxNodeName), this.value = 0, this.updateFromComponent(un);
|
|
4151
4167
|
}
|
|
4152
4168
|
/**
|
|
4153
4169
|
* Computes the visual response's interpolation weight based on component state
|
|
@@ -4163,7 +4179,7 @@ class pn {
|
|
|
4163
4179
|
button: i,
|
|
4164
4180
|
state: s
|
|
4165
4181
|
}) {
|
|
4166
|
-
const { normalizedXAxis: o, normalizedYAxis: n } =
|
|
4182
|
+
const { normalizedXAxis: o, normalizedYAxis: n } = gn(e, t);
|
|
4167
4183
|
switch (this.componentProperty) {
|
|
4168
4184
|
case T.ComponentProperty.X_AXIS:
|
|
4169
4185
|
this.value = this.states.includes(s) ? o : 0.5;
|
|
@@ -4258,7 +4274,7 @@ class mn {
|
|
|
4258
4274
|
}
|
|
4259
4275
|
}
|
|
4260
4276
|
const bn = "https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles", Cn = "generic-trigger";
|
|
4261
|
-
class En extends
|
|
4277
|
+
class En extends He {
|
|
4262
4278
|
/**
|
|
4263
4279
|
* Constructs a new XR controller model.
|
|
4264
4280
|
*/
|
|
@@ -4305,7 +4321,7 @@ function In(c, e) {
|
|
|
4305
4321
|
const { type: i, touchPointNodeName: s, visualResponses: o } = t;
|
|
4306
4322
|
if (i === T.ComponentType.TOUCHPAD)
|
|
4307
4323
|
if (t.touchPointNode = e.getObjectByName(s), t.touchPointNode) {
|
|
4308
|
-
const n = new mi(1e-3), r = new fe({ color: 255 }), A = new
|
|
4324
|
+
const n = new mi(1e-3), r = new fe({ color: 255 }), A = new St(n, r);
|
|
4309
4325
|
t.touchPointNode.add(A);
|
|
4310
4326
|
} else
|
|
4311
4327
|
console.warn(`Could not find touch dot, ${t.touchPointNodeName}, in touchpad component ${t.id}`);
|
|
@@ -4394,9 +4410,9 @@ class Bn {
|
|
|
4394
4410
|
class yn {
|
|
4395
4411
|
constructor(e, t) {
|
|
4396
4412
|
this.renderer = e, this.camera = t, this.controller1 = null, this.controller2 = null, this.controllerGrip1 = null, this.controllerGrip2 = null, this.controllers = [], this.controllerGrips = [], this.buttonStates = /* @__PURE__ */ new Map(), this.inputDeadzone = 0.15, this.turnSmoothingFactor = 0.1, this.lastTurnInput = 0, this.onSelectStart = null, this.onSelectEnd = null, this.onSqueezeStart = null, this.onSqueezeEnd = null, this.onModeToggle = null, this.onMovementStart = null, this.onMovementStop = null, this.handsActive = !1, this.handStates = {
|
|
4397
|
-
left: { pinch: !1, fist: !1, direction: new
|
|
4398
|
-
right: { pinch: !1, fist: !1, direction: new
|
|
4399
|
-
};
|
|
4413
|
+
left: { pinch: !1, fist: !1, direction: new g.Vector3() },
|
|
4414
|
+
right: { pinch: !1, fist: !1, direction: new g.Vector3() }
|
|
4415
|
+
}, this._fallbackHandedness = /* @__PURE__ */ new Map();
|
|
4400
4416
|
}
|
|
4401
4417
|
init() {
|
|
4402
4418
|
this.initControllers(), this.initHands();
|
|
@@ -4424,26 +4440,26 @@ class yn {
|
|
|
4424
4440
|
if (!s || !o || !s.transform || !o.transform)
|
|
4425
4441
|
this.handStates[i].pinch = !1;
|
|
4426
4442
|
else {
|
|
4427
|
-
const A = new
|
|
4443
|
+
const A = new g.Vector3().setFromMatrixPosition(new g.Matrix4().fromArray(s.transform.matrix)), a = new g.Vector3().setFromMatrixPosition(new g.Matrix4().fromArray(o.transform.matrix)), l = A.distanceTo(a);
|
|
4428
4444
|
this.handStates[i].pinch = l < 0.025;
|
|
4429
4445
|
}
|
|
4430
4446
|
let n = !0;
|
|
4431
4447
|
const r = t.hand.get("wrist");
|
|
4432
4448
|
if (r && r.transform) {
|
|
4433
|
-
const A = new
|
|
4449
|
+
const A = new g.Vector3().setFromMatrixPosition(new g.Matrix4().fromArray(r.transform.matrix));
|
|
4434
4450
|
for (const a of ["index-finger-tip", "middle-finger-tip", "ring-finger-tip", "pinky-finger-tip"]) {
|
|
4435
4451
|
const l = t.hand.get(a);
|
|
4436
4452
|
if (!l || !l.transform) {
|
|
4437
4453
|
n = !1;
|
|
4438
4454
|
continue;
|
|
4439
4455
|
}
|
|
4440
|
-
new
|
|
4456
|
+
new g.Vector3().setFromMatrixPosition(new g.Matrix4().fromArray(l.transform.matrix)).distanceTo(A) > 0.045 && (n = !1);
|
|
4441
4457
|
}
|
|
4442
4458
|
} else
|
|
4443
4459
|
n = !1;
|
|
4444
4460
|
if (this.handStates[i].fist = n, o && r && o.transform && r.transform) {
|
|
4445
|
-
const A = new
|
|
4446
|
-
this.handStates[i].direction = new
|
|
4461
|
+
const A = new g.Vector3().setFromMatrixPosition(new g.Matrix4().fromArray(r.transform.matrix)), a = new g.Vector3().setFromMatrixPosition(new g.Matrix4().fromArray(o.transform.matrix));
|
|
4462
|
+
this.handStates[i].direction = new g.Vector3().subVectors(a, A).normalize();
|
|
4447
4463
|
}
|
|
4448
4464
|
}
|
|
4449
4465
|
}
|
|
@@ -4490,9 +4506,9 @@ class yn {
|
|
|
4490
4506
|
this.onSqueezeEnd && this.onSqueezeEnd(i, e, t);
|
|
4491
4507
|
}
|
|
4492
4508
|
checkControllerButtons() {
|
|
4493
|
-
const e = this.
|
|
4494
|
-
if (e) {
|
|
4495
|
-
for (const t of e
|
|
4509
|
+
const e = this.getInputSources();
|
|
4510
|
+
if (!(!e || e.length === 0)) {
|
|
4511
|
+
for (const t of e)
|
|
4496
4512
|
if (t.gamepad && t.handedness) {
|
|
4497
4513
|
const i = t.gamepad, s = t.handedness, o = `debug-${s}`;
|
|
4498
4514
|
this.buttonStates.get(o) || this.buttonStates.set(o, !0);
|
|
@@ -4507,20 +4523,20 @@ class yn {
|
|
|
4507
4523
|
}
|
|
4508
4524
|
}
|
|
4509
4525
|
getControllerInput() {
|
|
4510
|
-
const e = this.
|
|
4511
|
-
if (!e) return { movement: null, teleport: null };
|
|
4526
|
+
const e = this.getInputSources();
|
|
4527
|
+
if (!e || e.length === 0) return { movement: null, teleport: null };
|
|
4512
4528
|
let t = null, i = null;
|
|
4513
|
-
for (const s of e
|
|
4529
|
+
for (const s of e)
|
|
4514
4530
|
if (s.gamepad && s.handedness) {
|
|
4515
4531
|
const o = s.gamepad, n = s.handedness;
|
|
4516
4532
|
if (o.axes.length >= 4) {
|
|
4517
|
-
const r = o.axes[2] || 0, A = o.axes[3] || 0, a = o.axes[0] || 0, l = o.axes[1] || 0, h = Math.abs(r) > this.inputDeadzone ? r : 0, d = Math.abs(A) > this.inputDeadzone ? A : 0,
|
|
4533
|
+
const r = o.axes[2] || 0, A = o.axes[3] || 0, a = o.axes[0] || 0, l = o.axes[1] || 0, h = Math.abs(r) > this.inputDeadzone ? r : 0, d = Math.abs(A) > this.inputDeadzone ? A : 0, u = Math.abs(a) > this.inputDeadzone ? a : 0, p = Math.abs(l) > this.inputDeadzone ? l : 0;
|
|
4518
4534
|
n === "left" ? (h !== 0 || d !== 0) && (t = {
|
|
4519
4535
|
x: h,
|
|
4520
4536
|
y: d,
|
|
4521
4537
|
handedness: "left"
|
|
4522
|
-
}) : n === "right" && (
|
|
4523
|
-
x:
|
|
4538
|
+
}) : n === "right" && (u !== 0 || p !== 0) && (i = {
|
|
4539
|
+
x: u,
|
|
4524
4540
|
y: p,
|
|
4525
4541
|
handedness: "right"
|
|
4526
4542
|
});
|
|
@@ -4528,6 +4544,33 @@ class yn {
|
|
|
4528
4544
|
}
|
|
4529
4545
|
return { movement: t, teleport: i };
|
|
4530
4546
|
}
|
|
4547
|
+
getInputSources() {
|
|
4548
|
+
const e = this.renderer.xr.getSession && this.renderer.xr.getSession();
|
|
4549
|
+
return e && e.inputSources ? Array.from(e.inputSources) : this._getFallbackInputSources();
|
|
4550
|
+
}
|
|
4551
|
+
_getFallbackInputSources() {
|
|
4552
|
+
if (typeof navigator > "u" || !navigator.getGamepads) return [];
|
|
4553
|
+
const e = navigator.getGamepads();
|
|
4554
|
+
if (!e) return [];
|
|
4555
|
+
const t = [];
|
|
4556
|
+
let i = 0;
|
|
4557
|
+
for (const s of e) {
|
|
4558
|
+
if (!s || !s.buttons || !s.axes) continue;
|
|
4559
|
+
const o = this._resolveHandedness(s, i);
|
|
4560
|
+
if (!o) {
|
|
4561
|
+
i += 1;
|
|
4562
|
+
continue;
|
|
4563
|
+
}
|
|
4564
|
+
t.push({ gamepad: s, handedness: o }), i += 1;
|
|
4565
|
+
}
|
|
4566
|
+
return t;
|
|
4567
|
+
}
|
|
4568
|
+
_resolveHandedness(e, t) {
|
|
4569
|
+
const i = (e.hand || "").toLowerCase();
|
|
4570
|
+
if (i === "left" || i === "right") return i;
|
|
4571
|
+
const s = (e.id || "").toLowerCase();
|
|
4572
|
+
return s.includes("left") ? "left" : s.includes("right") ? "right" : this._fallbackHandedness.has(e.index) ? this._fallbackHandedness.get(e.index) : t === 0 ? (this._fallbackHandedness.set(e.index, "left"), "left") : t === 1 ? (this._fallbackHandedness.set(e.index, "right"), "right") : null;
|
|
4573
|
+
}
|
|
4531
4574
|
getControllers() {
|
|
4532
4575
|
return {
|
|
4533
4576
|
controller1: this.controller1,
|
|
@@ -4558,41 +4601,41 @@ class wn {
|
|
|
4558
4601
|
}
|
|
4559
4602
|
createTeleportArc() {
|
|
4560
4603
|
const e = [
|
|
4561
|
-
new
|
|
4562
|
-
new
|
|
4563
|
-
], t = new
|
|
4604
|
+
new g.Vector3(0, 0, 0),
|
|
4605
|
+
new g.Vector3(0, 1, -5)
|
|
4606
|
+
], t = new g.CatmullRomCurve3(e), i = new g.TubeGeometry(t, 20, 0.03, 8, !1), s = new g.MeshBasicMaterial({
|
|
4564
4607
|
color: 16777215,
|
|
4565
4608
|
transparent: !0,
|
|
4566
4609
|
opacity: 0.8,
|
|
4567
|
-
side:
|
|
4610
|
+
side: g.DoubleSide
|
|
4568
4611
|
});
|
|
4569
|
-
if (this.teleportCurve = new
|
|
4570
|
-
const o = new
|
|
4612
|
+
if (this.teleportCurve = new g.Mesh(i, s), this.teleportCurve.visible = !1, this.scene.add(this.teleportCurve), !this.teleportMarker) {
|
|
4613
|
+
const o = new g.RingGeometry(0.4, 0.6, 20), n = new g.MeshBasicMaterial({
|
|
4571
4614
|
color: 16777215,
|
|
4572
4615
|
transparent: !0,
|
|
4573
4616
|
opacity: 0.9,
|
|
4574
|
-
side:
|
|
4617
|
+
side: g.DoubleSide
|
|
4575
4618
|
});
|
|
4576
|
-
this.teleportMarker = new
|
|
4577
|
-
const r = new
|
|
4619
|
+
this.teleportMarker = new g.Mesh(o, n), this.teleportMarker.rotation.x = -Math.PI / 2, this.teleportMarker.visible = !1, this.scene.add(this.teleportMarker);
|
|
4620
|
+
const r = new g.RingGeometry(0.3, 0.7, 20), A = new g.MeshBasicMaterial({
|
|
4578
4621
|
color: 16777215,
|
|
4579
4622
|
transparent: !0,
|
|
4580
4623
|
opacity: 0.3,
|
|
4581
|
-
side:
|
|
4582
|
-
}), a = new
|
|
4624
|
+
side: g.DoubleSide
|
|
4625
|
+
}), a = new g.Mesh(r, A);
|
|
4583
4626
|
a.rotation.x = -Math.PI / 2, this.teleportMarker.add(a);
|
|
4584
4627
|
}
|
|
4585
4628
|
if (!this.teleportFloor) {
|
|
4586
|
-
const o = new
|
|
4629
|
+
const o = new g.PlaneGeometry(100, 100), n = new g.MeshBasicMaterial({
|
|
4587
4630
|
color: 65280,
|
|
4588
4631
|
transparent: !0,
|
|
4589
4632
|
opacity: 0.1,
|
|
4590
4633
|
// Very subtle when visible
|
|
4591
|
-
side:
|
|
4634
|
+
side: g.DoubleSide,
|
|
4592
4635
|
visible: !1
|
|
4593
4636
|
// Invisible by default
|
|
4594
4637
|
});
|
|
4595
|
-
this.teleportFloor = new
|
|
4638
|
+
this.teleportFloor = new g.Mesh(o, n), this.teleportFloor.rotation.x = -Math.PI / 2, this.teleportFloor.visible = !1, this.scene.add(this.teleportFloor);
|
|
4596
4639
|
}
|
|
4597
4640
|
}
|
|
4598
4641
|
executeTeleport() {
|
|
@@ -4643,54 +4686,54 @@ class wn {
|
|
|
4643
4686
|
}
|
|
4644
4687
|
updateTeleportArc() {
|
|
4645
4688
|
if (!this.teleportController || !this.teleportCurve) return;
|
|
4646
|
-
const e = new
|
|
4689
|
+
const e = new g.Vector3();
|
|
4647
4690
|
this.teleportController.getWorldPosition(e);
|
|
4648
|
-
const t = new
|
|
4691
|
+
const t = new g.Quaternion();
|
|
4649
4692
|
this.teleportController.getWorldQuaternion(t);
|
|
4650
|
-
const i = new
|
|
4693
|
+
const i = new g.Vector3(0, 0, -1);
|
|
4651
4694
|
i.applyQuaternion(t);
|
|
4652
4695
|
const s = 3, o = 30, n = Math.min(this.teleportMaxMagnitude / this.teleportThreshold, 1), r = o - s, A = Math.pow(n, 0.7), a = s + r * A, l = [], h = 40, d = -9.8;
|
|
4653
|
-
let
|
|
4654
|
-
if (i.y > 0.3 ?
|
|
4655
|
-
const
|
|
4656
|
-
|
|
4696
|
+
let u = Math.sqrt(a * Math.abs(d) / 2);
|
|
4697
|
+
if (i.y > 0.3 ? u *= 1 - i.y * 0.5 : i.y < -0.5 && (u *= 1 + Math.abs(i.y) * 0.3), Math.sqrt(i.x * i.x + i.z * i.z) > 0.1) {
|
|
4698
|
+
const S = Math.min(1, a / (u * 2));
|
|
4699
|
+
u *= S;
|
|
4657
4700
|
}
|
|
4658
|
-
const
|
|
4659
|
-
let B = null, y = !1, w = e.y,
|
|
4701
|
+
const b = i.x * u, E = Math.max(i.y * u, u * 0.3), f = i.z * u, m = E / Math.abs(d), I = Math.max(m * 2.2, 1.5), C = this.teleportFloorHeight;
|
|
4702
|
+
let B = null, y = !1, w = e.y, M = 0;
|
|
4660
4703
|
const D = 8;
|
|
4661
|
-
for (let
|
|
4662
|
-
const
|
|
4663
|
-
e.x +
|
|
4664
|
-
e.y + E *
|
|
4665
|
-
e.z + f *
|
|
4704
|
+
for (let S = 0; S <= h; S++) {
|
|
4705
|
+
const R = S / h * I, x = new g.Vector3(
|
|
4706
|
+
e.x + b * R,
|
|
4707
|
+
e.y + E * R + 0.5 * d * R * R,
|
|
4708
|
+
e.z + f * R
|
|
4666
4709
|
);
|
|
4667
|
-
Math.abs(
|
|
4668
|
-
const J = y ?
|
|
4669
|
-
if (!B && W &&
|
|
4670
|
-
if (
|
|
4671
|
-
const q = l[
|
|
4672
|
-
B = new
|
|
4710
|
+
Math.abs(x.y - e.y) > D && (x.y = e.y + Math.sign(x.y - e.y) * D), !y && x.y < w && (y = !0, M = R), l.push(x);
|
|
4711
|
+
const J = y ? R - M : 0, W = y && J > 0.1;
|
|
4712
|
+
if (!B && W && x.y <= C) {
|
|
4713
|
+
if (S > 0) {
|
|
4714
|
+
const q = l[S - 1], k = (C - q.y) / (x.y - q.y);
|
|
4715
|
+
B = new g.Vector3().lerpVectors(q, x, k), B.y = C;
|
|
4673
4716
|
} else
|
|
4674
|
-
B =
|
|
4675
|
-
l[
|
|
4717
|
+
B = x.clone(), B.y = C;
|
|
4718
|
+
l[S] = B, l.length = S + 1;
|
|
4676
4719
|
break;
|
|
4677
4720
|
}
|
|
4678
|
-
if (w =
|
|
4679
|
-
Math.pow(
|
|
4721
|
+
if (w = x.y, Math.sqrt(
|
|
4722
|
+
Math.pow(x.x - e.x, 2) + Math.pow(x.z - e.z, 2)
|
|
4680
4723
|
) > o) {
|
|
4681
|
-
W && (B = new
|
|
4724
|
+
W && (B = new g.Vector3(x.x, C, x.z), l[S] = B, l.length = S + 1);
|
|
4682
4725
|
break;
|
|
4683
4726
|
}
|
|
4684
4727
|
}
|
|
4685
4728
|
if (!B && l.length > 0) {
|
|
4686
|
-
let
|
|
4687
|
-
for (let
|
|
4688
|
-
l[
|
|
4689
|
-
|
|
4729
|
+
let S = l[0], R = 0;
|
|
4730
|
+
for (let x = 1; x < l.length; x++)
|
|
4731
|
+
l[x].y < S.y && (S = l[x], R = x);
|
|
4732
|
+
R > l.length / 3 && (B = new g.Vector3(S.x, C, S.z), l.length = R + 1, l[R] = B);
|
|
4690
4733
|
}
|
|
4691
4734
|
if (l.length > 1) {
|
|
4692
|
-
const
|
|
4693
|
-
this.teleportCurve.geometry && this.teleportCurve.geometry.dispose(), this.teleportCurve.geometry =
|
|
4735
|
+
const S = new g.CatmullRomCurve3(l), R = new g.TubeGeometry(S, 20, 0.03, 6, !1);
|
|
4736
|
+
this.teleportCurve.geometry && this.teleportCurve.geometry.dispose(), this.teleportCurve.geometry = R;
|
|
4694
4737
|
}
|
|
4695
4738
|
this.teleportMarker && B && (this.teleportMarker.position.copy(B), this.teleportMarker.visible = !0, this.teleportFloorHeight < -0.5 ? this.teleportMarker.material.color.setHex(8965375) : this.teleportFloorHeight > 0.5 ? this.teleportMarker.material.color.setHex(16777096) : this.teleportMarker.material.color.setHex(16777215));
|
|
4696
4739
|
}
|
|
@@ -4706,7 +4749,7 @@ class wn {
|
|
|
4706
4749
|
Math.pow(e.x - t.x, 2) + Math.pow(e.z - t.z, 2)
|
|
4707
4750
|
);
|
|
4708
4751
|
if (i >= 3 && i <= 30) {
|
|
4709
|
-
const s = new
|
|
4752
|
+
const s = new g.Vector3(e.x, this.teleportFloorHeight, e.z);
|
|
4710
4753
|
this.validTeleportPosition = s, this.executeTeleport(), this.teleportFloorHeight = null;
|
|
4711
4754
|
}
|
|
4712
4755
|
}
|
|
@@ -4733,9 +4776,9 @@ class wn {
|
|
|
4733
4776
|
this.lastSnapTurnTime = 0;
|
|
4734
4777
|
}
|
|
4735
4778
|
}
|
|
4736
|
-
class
|
|
4779
|
+
class Sn {
|
|
4737
4780
|
constructor(e, t) {
|
|
4738
|
-
this.camera = e, this.renderer = t, this.MOVE_SPEED = 2, this.TURN_SPEED = 1.5, this.FLY_SPEED = 1, this.currentSpeed = 0, this.targetSpeed = 0, this.currentBoostLevel = 0, this.targetBoostLevel = 0, this.SPEED_RAMP_RATE = 3, this.BOOST_RAMP_RATE = 6, this.handMoveActive = !1, this.handMoveBoost = !1, this.handMoveDirection = new
|
|
4781
|
+
this.camera = e, this.renderer = t, this.MOVE_SPEED = 2, this.TURN_SPEED = 1.5, this.FLY_SPEED = 1, this.currentSpeed = 0, this.targetSpeed = 0, this.currentBoostLevel = 0, this.targetBoostLevel = 0, this.SPEED_RAMP_RATE = 3, this.BOOST_RAMP_RATE = 6, this.handMoveActive = !1, this.handMoveBoost = !1, this.handMoveDirection = new g.Vector3(), this.isMoving = !1, this.inputDeadzone = 0.15, this.turnSmoothingFactor = 0.1, this.lastTurnInput = 0, this.comfortSettings = {
|
|
4739
4782
|
locomotionMode: "smooth",
|
|
4740
4783
|
// 'smooth', 'teleport'
|
|
4741
4784
|
turningMode: "smooth",
|
|
@@ -4763,95 +4806,97 @@ class Qn {
|
|
|
4763
4806
|
this.teleportSystem = e;
|
|
4764
4807
|
}
|
|
4765
4808
|
updateMovement(e, t) {
|
|
4766
|
-
const i = this.renderer.xr.getSession();
|
|
4767
|
-
if (
|
|
4809
|
+
const i = this.renderer.xr.getSession && this.renderer.xr.getSession();
|
|
4810
|
+
if (i && i.visibilityState !== "visible")
|
|
4811
|
+
return;
|
|
4812
|
+
const s = t?.inputSources || (i ? Array.from(i.inputSources || []) : []);
|
|
4813
|
+
if (!s || s.length === 0)
|
|
4768
4814
|
return;
|
|
4769
|
-
if (t.updateHandGestures && t.handsActive) {
|
|
4815
|
+
if (i && t.updateHandGestures && t.handsActive) {
|
|
4770
4816
|
t.updateHandGestures();
|
|
4771
|
-
let
|
|
4772
|
-
const
|
|
4773
|
-
let
|
|
4774
|
-
for (const
|
|
4775
|
-
if (t.handStates[
|
|
4776
|
-
|
|
4817
|
+
let u = null;
|
|
4818
|
+
const p = new g.Vector3();
|
|
4819
|
+
let b = !1;
|
|
4820
|
+
for (const E of ["left", "right"])
|
|
4821
|
+
if (t.handStates[E].pinch) {
|
|
4822
|
+
u = E, p.copy(t.handStates[E].direction), b = t.handStates[E].fist;
|
|
4777
4823
|
break;
|
|
4778
4824
|
}
|
|
4779
|
-
if (
|
|
4780
|
-
this.handMoveActive = !0, this.handMoveBoost =
|
|
4781
|
-
const
|
|
4782
|
-
|
|
4825
|
+
if (u) {
|
|
4826
|
+
this.handMoveActive = !0, this.handMoveBoost = b, this.handMoveDirection.copy(p);
|
|
4827
|
+
const E = this.camera.parent || this.camera, f = this.MOVE_SPEED * (b ? 3 : 1) * e;
|
|
4828
|
+
E.position.addScaledVector(p, f), this.isMoving = !0, this.onMovementStart && !this._wasMoving && this.onMovementStart(), this.onMovementUpdate && this.onMovementUpdate({
|
|
4783
4829
|
isMoving: !0,
|
|
4784
4830
|
currentSpeed: this.MOVE_SPEED,
|
|
4785
|
-
isBoosted:
|
|
4786
|
-
currentBoostLevel:
|
|
4831
|
+
isBoosted: b,
|
|
4832
|
+
currentBoostLevel: b ? 1 : 0
|
|
4787
4833
|
}), this._wasMoving = !0;
|
|
4788
4834
|
return;
|
|
4789
4835
|
} else
|
|
4790
4836
|
this.handMoveActive && this.onMovementStop && this.onMovementStop(), this.handMoveActive = !1, this.isMoving = !1, this._wasMoving = !1;
|
|
4791
4837
|
}
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
let
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
if (!d || !d.gamepad || !d.gamepad.buttons || !d.gamepad.axes || d.gamepad.axes.length < 4)
|
|
4838
|
+
const o = this.camera.parent || this.camera;
|
|
4839
|
+
let n = !1, r = !1;
|
|
4840
|
+
for (let u = 0; u < s.length; u++) {
|
|
4841
|
+
const p = s[u];
|
|
4842
|
+
if (!p || !p.gamepad || !p.gamepad.buttons || !p.gamepad.axes || p.gamepad.axes.length < 4)
|
|
4798
4843
|
continue;
|
|
4799
|
-
const
|
|
4800
|
-
if (!
|
|
4801
|
-
const
|
|
4802
|
-
if (
|
|
4803
|
-
const
|
|
4804
|
-
if (
|
|
4805
|
-
this.teleportSystem.processTeleportation(
|
|
4844
|
+
const b = p.gamepad, f = p.handedness === "left" ? t.controller1 : t.controller2;
|
|
4845
|
+
if (!f) continue;
|
|
4846
|
+
const m = b.axes[2] || 0, I = b.axes[3] || 0;
|
|
4847
|
+
if (p.handedness === "left") {
|
|
4848
|
+
const C = b.buttons[1], B = C && C.pressed ? 3 : 1, y = this.comfortSettings.reducedMotion ? this.comfortSettings.comfortSpeed : 1;
|
|
4849
|
+
if (C && C.pressed && (r = !0), this.comfortSettings.locomotionMode === "teleport" && this.teleportSystem && f) {
|
|
4850
|
+
this.teleportSystem.processTeleportation(f, m, I);
|
|
4806
4851
|
continue;
|
|
4807
4852
|
} else {
|
|
4808
|
-
const
|
|
4809
|
-
this.camera.getWorldDirection(
|
|
4810
|
-
const
|
|
4811
|
-
if (Math.abs(
|
|
4812
|
-
const
|
|
4813
|
-
|
|
4853
|
+
const M = new g.Vector3();
|
|
4854
|
+
this.camera.getWorldDirection(M), M.y = 0, M.normalize();
|
|
4855
|
+
const D = new g.Vector3().crossVectors(M, this.camera.up).normalize();
|
|
4856
|
+
if (Math.abs(I) > 0.1) {
|
|
4857
|
+
const S = this.MOVE_SPEED * B * y * this.currentSpeed * e;
|
|
4858
|
+
o.position.addScaledVector(M, -I * S), n = !0;
|
|
4814
4859
|
}
|
|
4815
|
-
if (Math.abs(
|
|
4816
|
-
const
|
|
4817
|
-
|
|
4860
|
+
if (Math.abs(m) > 0.1) {
|
|
4861
|
+
const S = this.MOVE_SPEED * B * y * this.currentSpeed * e;
|
|
4862
|
+
o.position.addScaledVector(D, m * S), n = !0;
|
|
4818
4863
|
}
|
|
4819
4864
|
}
|
|
4820
4865
|
}
|
|
4821
|
-
if (
|
|
4822
|
-
const
|
|
4823
|
-
if (
|
|
4824
|
-
if (Math.abs(
|
|
4825
|
-
const
|
|
4826
|
-
this.teleportSystem.adjustFloorHeight(
|
|
4866
|
+
if (p.handedness === "right") {
|
|
4867
|
+
const C = b.buttons[1], B = C && C.pressed ? 3 : 1, y = this.comfortSettings.reducedMotion ? this.comfortSettings.comfortSpeed : 1;
|
|
4868
|
+
if (C && C.pressed && Math.abs(I) > 0.1 && (r = !0), this.teleportSystem && this.teleportSystem.teleportPressed && this.teleportSystem.teleportCurve && this.teleportSystem.teleportCurve.visible) {
|
|
4869
|
+
if (Math.abs(I) > 0.1) {
|
|
4870
|
+
const w = 4 * e;
|
|
4871
|
+
this.teleportSystem.adjustFloorHeight(I * w);
|
|
4827
4872
|
}
|
|
4828
4873
|
} else {
|
|
4829
4874
|
if (this.comfortSettings.turningMode === "snap" && this.teleportSystem)
|
|
4830
|
-
this.teleportSystem.processSnapTurn(
|
|
4831
|
-
else if (Math.abs(
|
|
4832
|
-
const
|
|
4833
|
-
if (this.lastTurnInput =
|
|
4834
|
-
const
|
|
4835
|
-
|
|
4875
|
+
this.teleportSystem.processSnapTurn(m, this.comfortSettings.snapTurnAngle);
|
|
4876
|
+
else if (Math.abs(m) > this.inputDeadzone) {
|
|
4877
|
+
const w = this.lastTurnInput * this.turnSmoothingFactor + m * (1 - this.turnSmoothingFactor);
|
|
4878
|
+
if (this.lastTurnInput = w, Math.abs(w) > this.inputDeadzone) {
|
|
4879
|
+
const M = this.comfortSettings.reducedMotion ? this.TURN_SPEED * 0.5 : this.TURN_SPEED, D = w * M * Math.min(e, 1 / 30);
|
|
4880
|
+
o.rotation.y -= D, o.rotation.y = this.normalizeAngle(o.rotation.y);
|
|
4836
4881
|
}
|
|
4837
4882
|
} else
|
|
4838
4883
|
this.lastTurnInput *= 0.9;
|
|
4839
|
-
if (Math.abs(
|
|
4840
|
-
const
|
|
4841
|
-
|
|
4884
|
+
if (Math.abs(I) > 0.1) {
|
|
4885
|
+
const w = this.FLY_SPEED * B * y * this.currentSpeed * e;
|
|
4886
|
+
o.position.y -= I * w, n = !0;
|
|
4842
4887
|
}
|
|
4843
4888
|
}
|
|
4844
4889
|
}
|
|
4845
4890
|
}
|
|
4846
|
-
const
|
|
4847
|
-
this.isMoving =
|
|
4848
|
-
const
|
|
4849
|
-
this.currentSpeed +=
|
|
4850
|
-
const
|
|
4851
|
-
this.currentBoostLevel +=
|
|
4891
|
+
const A = this.isMoving;
|
|
4892
|
+
this.isMoving = n;
|
|
4893
|
+
const l = (this.isMoving ? this.MOVE_SPEED : 0) - this.currentSpeed;
|
|
4894
|
+
this.currentSpeed += l * this.SPEED_RAMP_RATE * e, this.currentSpeed = Math.max(0, this.currentSpeed);
|
|
4895
|
+
const d = (r ? 1 : 0) - this.currentBoostLevel;
|
|
4896
|
+
this.currentBoostLevel += d * this.BOOST_RAMP_RATE * e, this.currentBoostLevel = Math.max(0, Math.min(1, this.currentBoostLevel)), !A && this.isMoving && this.onMovementStart && this.onMovementStart(), A && !this.isMoving && this.onMovementStop && this.onMovementStop(), this.onMovementUpdate && this.onMovementUpdate({
|
|
4852
4897
|
isMoving: this.isMoving,
|
|
4853
4898
|
currentSpeed: this.currentSpeed,
|
|
4854
|
-
isBoosted:
|
|
4899
|
+
isBoosted: r,
|
|
4855
4900
|
currentBoostLevel: this.currentBoostLevel
|
|
4856
4901
|
});
|
|
4857
4902
|
}
|
|
@@ -4861,8 +4906,8 @@ class Qn {
|
|
|
4861
4906
|
return e;
|
|
4862
4907
|
}
|
|
4863
4908
|
correctDrift() {
|
|
4864
|
-
const e = this.camera.parent;
|
|
4865
|
-
e.rotation.y = this.normalizeAngle(e.rotation.y), e.position.x = Math.round(e.position.x * 1e3) / 1e3, e.position.y = Math.round(e.position.y * 1e3) / 1e3, e.position.z = Math.round(e.position.z * 1e3) / 1e3;
|
|
4909
|
+
const e = this.camera.parent || this.camera;
|
|
4910
|
+
e && (e.rotation.y = this.normalizeAngle(e.rotation.y), e.position.x = Math.round(e.position.x * 1e3) / 1e3, e.position.y = Math.round(e.position.y * 1e3) / 1e3, e.position.z = Math.round(e.position.z * 1e3) / 1e3);
|
|
4866
4911
|
}
|
|
4867
4912
|
setComfortSettings(e) {
|
|
4868
4913
|
const t = ["smooth", "teleport"], i = ["smooth", "snap"];
|
|
@@ -4920,7 +4965,7 @@ class Qn {
|
|
|
4920
4965
|
};
|
|
4921
4966
|
}
|
|
4922
4967
|
}
|
|
4923
|
-
class
|
|
4968
|
+
class Qn {
|
|
4924
4969
|
constructor() {
|
|
4925
4970
|
this.soundEnabled = !1, this.audioContext = null, this._basePath = "./sound/", this.dpvSound = null, this.dpvHighSound = null, this.ambienceSound = null, this.currentMovementSound = null, this.currentBoostSound = null, this.currentAmbienceSound = null, this.baseGainNode = null, this.boostGainNode = null, this.ambienceGainNode = null, this.baseVolumeMultiplier = 1.52, this.boostVolumeMultiplier = 1.01, this.ambienceVolume = 0.1;
|
|
4926
4971
|
}
|
|
@@ -5066,7 +5111,7 @@ class Mn {
|
|
|
5066
5111
|
* @param {boolean} [enableAudio=false] - Enable VR audio system
|
|
5067
5112
|
*/
|
|
5068
5113
|
constructor(e, t, i, s = "./sound/", o = !1, n = null) {
|
|
5069
|
-
this.renderer = e, this.camera = t, this.scene = i, this.audioPath = s, this.enableAudio = o, this.container = n, this.vrCore = new cn(e, t, i, n), this.vrControllers = new yn(e, t), this.vrTeleport = new wn(i, t), this.vrLocomotion = new
|
|
5114
|
+
this.renderer = e, this.camera = t, this.scene = i, this.audioPath = s, this.enableAudio = o, this.container = n, this.vrCore = new cn(e, t, i, n), this.vrControllers = new yn(e, t), this.vrTeleport = new wn(i, t), this.vrLocomotion = new Sn(t, e), this.vrAudio = this.enableAudio ? new Qn() : null, this.isVRSupported = !1, this.isVRPresenting = !1, this.controller1 = null, this.controller2 = null, this.controllerGrip1 = null, this.controllerGrip2 = null, this.controllers = [], this.controllerGrips = [], this._preVRCameraState = {
|
|
5070
5115
|
target: null,
|
|
5071
5116
|
position: null,
|
|
5072
5117
|
zoom: null,
|
|
@@ -5114,6 +5159,7 @@ class Mn {
|
|
|
5114
5159
|
this.vrControllers.checkControllerButtons();
|
|
5115
5160
|
const t = {
|
|
5116
5161
|
...this.vrControllers.getControllers(),
|
|
5162
|
+
inputSources: this.vrControllers.getInputSources(),
|
|
5117
5163
|
handsActive: this.vrControllers.handsActive,
|
|
5118
5164
|
handStates: this.vrControllers.handStates,
|
|
5119
5165
|
updateHandGestures: this.vrControllers.updateHandGestures ? this.vrControllers.updateHandGestures.bind(this.vrControllers) : void 0
|
|
@@ -5304,12 +5350,12 @@ class xn {
|
|
|
5304
5350
|
if (t.domOverlay === void 0) {
|
|
5305
5351
|
const d = document.createElement("div");
|
|
5306
5352
|
d.style.display = "none", document.body.appendChild(d);
|
|
5307
|
-
const
|
|
5308
|
-
|
|
5353
|
+
const u = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
5354
|
+
u.setAttribute("width", 38), u.setAttribute("height", 38), u.style.position = "absolute", u.style.right = "20px", u.style.top = "20px", u.addEventListener("click", function() {
|
|
5309
5355
|
a.end();
|
|
5310
|
-
}), d.appendChild(
|
|
5356
|
+
}), d.appendChild(u);
|
|
5311
5357
|
const p = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
5312
|
-
p.setAttribute("d", "M 12,12 L 28,28 M 28,12 12,28"), p.setAttribute("stroke", "#fff"), p.setAttribute("stroke-width", 2),
|
|
5358
|
+
p.setAttribute("d", "M 12,12 L 28,28 M 28,12 12,28"), p.setAttribute("stroke", "#fff"), p.setAttribute("stroke-width", 2), u.appendChild(p), t.optionalFeatures === void 0 && (t.optionalFeatures = []), t.optionalFeatures.push("dom-overlay"), t.domOverlay = { root: d };
|
|
5313
5359
|
}
|
|
5314
5360
|
let a = null;
|
|
5315
5361
|
async function l(d) {
|
|
@@ -5473,7 +5519,7 @@ class vn {
|
|
|
5473
5519
|
this.buttonObserver && (this.buttonObserver.disconnect(), this.buttonObserver = null), this.arButton && this.arButton.parentNode && this.arButton.parentNode.removeChild(this.arButton), this.isQuest2 = !1, this.isQuest3 = !1, this.isARSupported = !1, this.isARPresenting = !1;
|
|
5474
5520
|
}
|
|
5475
5521
|
}
|
|
5476
|
-
const $t = new Ie(), ei = new
|
|
5522
|
+
const $t = new Ie(), ei = new L();
|
|
5477
5523
|
class ti {
|
|
5478
5524
|
/**
|
|
5479
5525
|
* Constructs a new XR hand primitive model.
|
|
@@ -5596,7 +5642,7 @@ class Dn {
|
|
|
5596
5642
|
}
|
|
5597
5643
|
}
|
|
5598
5644
|
}
|
|
5599
|
-
class
|
|
5645
|
+
class Ln extends He {
|
|
5600
5646
|
/**
|
|
5601
5647
|
* Constructs a new XR hand model.
|
|
5602
5648
|
*
|
|
@@ -5615,7 +5661,7 @@ class Tn extends Oe {
|
|
|
5615
5661
|
super.updateMatrixWorld(e), this.motionController && this.motionController.updateMesh();
|
|
5616
5662
|
}
|
|
5617
5663
|
}
|
|
5618
|
-
class
|
|
5664
|
+
class Tn {
|
|
5619
5665
|
/**
|
|
5620
5666
|
* Constructs a new XR hand model factory.
|
|
5621
5667
|
*
|
|
@@ -5642,7 +5688,7 @@ class Ln {
|
|
|
5642
5688
|
* @return {XRHandModel} The XR hand model.
|
|
5643
5689
|
*/
|
|
5644
5690
|
createHandModel(e, t) {
|
|
5645
|
-
const i = new
|
|
5691
|
+
const i = new Ln(e);
|
|
5646
5692
|
return e.addEventListener("connected", (s) => {
|
|
5647
5693
|
const o = s.data;
|
|
5648
5694
|
o.hand && !i.motionController && (i.xrInputSource = o, t === void 0 || t === "spheres" ? i.motionController = new ti(i, e, this.path, o.handedness, { primitive: "sphere" }) : t === "boxes" ? i.motionController = new ti(i, e, this.path, o.handedness, { primitive: "box" }) : t === "mesh" && (i.motionController = new Dn(i, e, this.path, o.handedness, this.gltfLoader, this.onLoad))), e.visible = !0;
|
|
@@ -5651,13 +5697,13 @@ class Ln {
|
|
|
5651
5697
|
}), i;
|
|
5652
5698
|
}
|
|
5653
5699
|
}
|
|
5654
|
-
class
|
|
5700
|
+
class kn {
|
|
5655
5701
|
constructor(e) {
|
|
5656
|
-
this.renderer = e, this.handModelFactory = new
|
|
5702
|
+
this.renderer = e, this.handModelFactory = new Tn(), this.hand1 = null, this.hand2 = null, this.interactionEnabled = !0, this.dragging = !1, this.scaling = !1, this.rotating = !1, this.dragStartPos = new g.Vector3(), this.scaleStartDistance = 0, this.rotateStartAngle = 0, this.pinchIntent = {
|
|
5657
5703
|
hand1Start: 0,
|
|
5658
5704
|
hand2Start: 0,
|
|
5659
5705
|
delay: 100
|
|
5660
|
-
}, this.inertiaActive = !1, this.posVelocity = new
|
|
5706
|
+
}, this.inertiaActive = !1, this.posVelocity = new g.Vector3(), this.rotVelocity = 0, this.scaleVelocity = 0, this.POSITION_DAMPING = 100, this.ROTATION_DAMPING = 8, this.SCALE_DAMPING = 8, this.MAX_ROT_VELOCITY = Math.PI, this.MAX_SCALE_VELOCITY = 0.5, this.MIN_SCALE = 0.01, this.MAX_SCALE = 1, this.VELOCITY_DEAD_ZONE = 1e-3, this.DISTANCE_GAIN_THRESHOLD = 5, this.MAX_DISTANCE_GAIN = 3, this.MAX_DELTA_PER_FRAME = 0.5, this.VELOCITY_SMOOTHING = 0.3, this.tempVec1 = new g.Vector3(), this.tempVec2 = new g.Vector3(), this.onGestureStart = null, this.onGestureEnd = null;
|
|
5661
5707
|
}
|
|
5662
5708
|
init(e) {
|
|
5663
5709
|
this.hand1 = this.setupHand(e, 0, "hand1Start"), this.hand2 = this.setupHand(e, 1, "hand2Start");
|
|
@@ -5676,7 +5722,7 @@ class Fn {
|
|
|
5676
5722
|
}
|
|
5677
5723
|
styleHandModel(e, t, i) {
|
|
5678
5724
|
e.traverse((s) => {
|
|
5679
|
-
s.isMesh && (s.material = new
|
|
5725
|
+
s.isMesh && (s.material = new g.MeshStandardMaterial({
|
|
5680
5726
|
color: t,
|
|
5681
5727
|
roughness: 0.8,
|
|
5682
5728
|
metalness: 0.2,
|
|
@@ -5702,15 +5748,15 @@ class Fn {
|
|
|
5702
5748
|
(this.scaling || this.rotating) && (this.rotVelocity = 0, this.scaleVelocity = 0), this.dragging = !0, this.scaling = !1, this.rotating = !1, l.getWorldPosition(this.dragStartPos), this.onGestureStart && this.onGestureStart("drag");
|
|
5703
5749
|
else {
|
|
5704
5750
|
l.getWorldPosition(this.tempVec1);
|
|
5705
|
-
|
|
5751
|
+
const h = this.tempVec1.clone().sub(this.dragStartPos);
|
|
5706
5752
|
if (h.length() > this.MAX_DELTA_PER_FRAME && h.normalize().multiplyScalar(this.MAX_DELTA_PER_FRAME), i) {
|
|
5707
5753
|
const d = i.position.distanceTo(t.position);
|
|
5708
5754
|
if (d > this.DISTANCE_GAIN_THRESHOLD) {
|
|
5709
|
-
const
|
|
5755
|
+
const u = Math.min(
|
|
5710
5756
|
this.MAX_DISTANCE_GAIN,
|
|
5711
5757
|
1 + (d - this.DISTANCE_GAIN_THRESHOLD) / 7.5
|
|
5712
5758
|
);
|
|
5713
|
-
h.multiplyScalar(
|
|
5759
|
+
h.multiplyScalar(u);
|
|
5714
5760
|
}
|
|
5715
5761
|
}
|
|
5716
5762
|
if (t.position.add(h), e > 0) {
|
|
@@ -5725,17 +5771,17 @@ class Fn {
|
|
|
5725
5771
|
const a = this.tempVec2.x - this.tempVec1.x, l = this.tempVec2.z - this.tempVec1.z;
|
|
5726
5772
|
this.rotateStartAngle = Math.atan2(l, a), this.onGestureStart && this.onGestureStart("two-hand");
|
|
5727
5773
|
} else {
|
|
5728
|
-
const a = this.tempVec1.distanceTo(this.tempVec2), l = a / this.scaleStartDistance, h = Math.log(t.scale.x), d = Math.log(l),
|
|
5774
|
+
const a = this.tempVec1.distanceTo(this.tempVec2), l = a / this.scaleStartDistance, h = Math.log(t.scale.x), d = Math.log(l), u = h + d, p = Math.max(this.MIN_SCALE, Math.min(this.MAX_SCALE, Math.exp(u)));
|
|
5729
5775
|
if (t.scale.setScalar(p), e > 0) {
|
|
5730
|
-
const I = d / e,
|
|
5731
|
-
this.scaleVelocity = this.scaleVelocity * (1 - this.VELOCITY_SMOOTHING) +
|
|
5776
|
+
const I = d / e, C = Math.max(-this.MAX_SCALE_VELOCITY, Math.min(this.MAX_SCALE_VELOCITY, I));
|
|
5777
|
+
this.scaleVelocity = this.scaleVelocity * (1 - this.VELOCITY_SMOOTHING) + C * this.VELOCITY_SMOOTHING;
|
|
5732
5778
|
}
|
|
5733
5779
|
this.scaleStartDistance = a;
|
|
5734
|
-
const
|
|
5780
|
+
const b = this.tempVec2.x - this.tempVec1.x, E = this.tempVec2.z - this.tempVec1.z, f = Math.atan2(E, b);
|
|
5735
5781
|
let m = f - this.rotateStartAngle;
|
|
5736
5782
|
if (m > Math.PI && (m -= 2 * Math.PI), m < -Math.PI && (m += 2 * Math.PI), t.rotation.y -= m, e > 0) {
|
|
5737
|
-
const I = -m / e,
|
|
5738
|
-
this.rotVelocity = this.rotVelocity * (1 - this.VELOCITY_SMOOTHING) +
|
|
5783
|
+
const I = -m / e, C = Math.max(-this.MAX_ROT_VELOCITY, Math.min(this.MAX_ROT_VELOCITY, I));
|
|
5784
|
+
this.rotVelocity = this.rotVelocity * (1 - this.VELOCITY_SMOOTHING) + C * this.VELOCITY_SMOOTHING;
|
|
5739
5785
|
}
|
|
5740
5786
|
this.rotateStartAngle = f;
|
|
5741
5787
|
}
|
|
@@ -5767,7 +5813,7 @@ class Fn {
|
|
|
5767
5813
|
this.hand1 && this.hand1.clear(), this.hand2 && this.hand2.clear(), this.stop();
|
|
5768
5814
|
}
|
|
5769
5815
|
}
|
|
5770
|
-
class
|
|
5816
|
+
class Fn extends Te {
|
|
5771
5817
|
constructor(e, t, i, s = {}, o = null) {
|
|
5772
5818
|
super(), this.renderer = e, this.camera = t, this.scene = i, this.config = {
|
|
5773
5819
|
enableHandTracking: !0,
|
|
@@ -5776,7 +5822,7 @@ class kn extends je {
|
|
|
5776
5822
|
worldCubeSize: 1e3,
|
|
5777
5823
|
worldCubeOpacity: 0.1,
|
|
5778
5824
|
...s
|
|
5779
|
-
}, this.container = o, this.arCore = new vn(e, t, i, o), this.handTracking = this.config.enableHandTracking ? new
|
|
5825
|
+
}, this.container = o, this.arCore = new vn(e, t, i, o), this.handTracking = this.config.enableHandTracking ? new kn(e) : null, this.modelGroup = new g.Group(), this.modelGroup.name = "AR Model Group", this.scene.add(this.modelGroup), this.currentModel = null, this.pendingModel = null, this.pendingModelConfig = null, this.currentModelScale = this.config.defaultScale, this.worldCube = null, this.config.enableWorldCube && this.createWorldCube(), this.isARPresenting = !1, this.previousGestureType = null, this.init();
|
|
5780
5826
|
}
|
|
5781
5827
|
init() {
|
|
5782
5828
|
this.arCore.init(), this.handTracking && (this.handTracking.init(this.scene), this.handTracking.onGestureStart = (e) => {
|
|
@@ -5814,14 +5860,14 @@ class kn extends je {
|
|
|
5814
5860
|
this.handTracking && this.handTracking.update(t, this.modelGroup, this.camera);
|
|
5815
5861
|
}
|
|
5816
5862
|
createWorldCube() {
|
|
5817
|
-
const e = this.config.worldCubeSize, t = new
|
|
5863
|
+
const e = this.config.worldCubeSize, t = new g.BoxGeometry(e, e, e), i = new g.MeshBasicMaterial({
|
|
5818
5864
|
color: 0,
|
|
5819
5865
|
transparent: !0,
|
|
5820
5866
|
opacity: this.config.worldCubeOpacity,
|
|
5821
|
-
side:
|
|
5867
|
+
side: g.BackSide,
|
|
5822
5868
|
depthWrite: !1
|
|
5823
5869
|
});
|
|
5824
|
-
this.worldCube = new
|
|
5870
|
+
this.worldCube = new g.Mesh(t, i), this.worldCube.name = "AR World Cube", this.worldCube.visible = !1, this.scene.add(this.worldCube);
|
|
5825
5871
|
}
|
|
5826
5872
|
setWorldCubeOpacity(e) {
|
|
5827
5873
|
this.worldCube && (this.worldCube.material.opacity = Math.max(0, Math.min(1, e)));
|
|
@@ -6000,18 +6046,28 @@ class ii {
|
|
|
6000
6046
|
}
|
|
6001
6047
|
};
|
|
6002
6048
|
return console.log("🌊 Particle information:"), console.table(i), i;
|
|
6049
|
+
}, window.stereo = (t, i) => {
|
|
6050
|
+
if (t === void 0) {
|
|
6051
|
+
const s = {
|
|
6052
|
+
enabled: e.stereoEnabled || !1,
|
|
6053
|
+
mode: e.stereoMode || "sbs",
|
|
6054
|
+
eyeSeparation: e.stereoEyeSeparation || 0.064
|
|
6055
|
+
};
|
|
6056
|
+
return console.log("👓 Stereo information:"), console.table(s), console.log(""), console.log("Usage:"), console.log(" stereo(true) - Enable stereo mode"), console.log(" stereo(false) - Disable stereo mode"), console.log(" stereo(true, 0.065) - Enable with custom eye separation"), s;
|
|
6057
|
+
}
|
|
6058
|
+
return e.setStereoEnabled(t), i !== void 0 && e.setStereoEyeSeparation(i), console.log(`👓 Stereo ${t ? "enabled" : "disabled"}`), i !== void 0 && console.log(`👓 Eye separation: ${i}m`), { enabled: t, eyeSeparation: e.stereoEyeSeparation };
|
|
6003
6059
|
}, window.debugHelp = () => {
|
|
6004
|
-
console.log("🔧 BelowJS Debug Commands:"), console.log(" camera() - Get current camera position data"), console.log(" scene() - Get scene information and object counts"), console.log(" models() - Get loaded models information"), console.log(" particles() - Get particle system information"), console.log(" vr() - Get VR state and settings"), console.log(" debugHelp() - Show this help message"), console.log(""), console.log("Global objects:"), console.log(" belowViewer - Direct access to BelowViewer instance");
|
|
6060
|
+
console.log("🔧 BelowJS Debug Commands:"), console.log(" camera() - Get current camera position data"), console.log(" scene() - Get scene information and object counts"), console.log(" models() - Get loaded models information"), console.log(" particles() - Get particle system information"), console.log(" vr() - Get VR state and settings"), console.log(" stereo() - Get/set stereo mode and eye separation"), console.log(" debugHelp() - Show this help message"), console.log(""), console.log("Global objects:"), console.log(" belowViewer - Direct access to BelowViewer instance");
|
|
6005
6061
|
});
|
|
6006
6062
|
}
|
|
6007
6063
|
/**
|
|
6008
6064
|
* Clean up debug commands when viewer is disposed
|
|
6009
6065
|
*/
|
|
6010
6066
|
static cleanup() {
|
|
6011
|
-
typeof window > "u" || (delete window.camera, delete window.scene, delete window.models, delete window.particles, delete window.vr, delete window.debugHelp, delete window.belowViewer);
|
|
6067
|
+
typeof window > "u" || (delete window.camera, delete window.scene, delete window.models, delete window.particles, delete window.vr, delete window.stereo, delete window.debugHelp, delete window.belowViewer);
|
|
6012
6068
|
}
|
|
6013
6069
|
}
|
|
6014
|
-
class _n extends
|
|
6070
|
+
class _n extends Te {
|
|
6015
6071
|
/**
|
|
6016
6072
|
* Creates a new BelowViewer instance
|
|
6017
6073
|
*
|
|
@@ -6059,12 +6115,27 @@ class _n extends je {
|
|
|
6059
6115
|
default: {
|
|
6060
6116
|
antialias: !0,
|
|
6061
6117
|
alpha: !1,
|
|
6062
|
-
powerPreference: "high-performance"
|
|
6118
|
+
powerPreference: "high-performance",
|
|
6119
|
+
logarithmicDepthBuffer: !1
|
|
6063
6120
|
},
|
|
6064
6121
|
schema: {
|
|
6065
6122
|
antialias: { type: "boolean", default: !0 },
|
|
6066
6123
|
alpha: { type: "boolean", default: !1 },
|
|
6067
|
-
powerPreference: { type: "string", default: "high-performance" }
|
|
6124
|
+
powerPreference: { type: "string", default: "high-performance" },
|
|
6125
|
+
logarithmicDepthBuffer: { type: "boolean", default: !1 }
|
|
6126
|
+
}
|
|
6127
|
+
},
|
|
6128
|
+
stereo: {
|
|
6129
|
+
type: "object",
|
|
6130
|
+
default: {
|
|
6131
|
+
enabled: !1,
|
|
6132
|
+
mode: "sbs",
|
|
6133
|
+
eyeSeparation: 0.064
|
|
6134
|
+
},
|
|
6135
|
+
schema: {
|
|
6136
|
+
enabled: { type: "boolean", default: !1 },
|
|
6137
|
+
mode: { type: "string", default: "sbs" },
|
|
6138
|
+
eyeSeparation: { type: "number", default: 0.064 }
|
|
6068
6139
|
}
|
|
6069
6140
|
},
|
|
6070
6141
|
vr: {
|
|
@@ -6094,33 +6165,39 @@ class _n extends je {
|
|
|
6094
6165
|
audioPath: { type: "string", default: "./sound/" },
|
|
6095
6166
|
enableVRAudio: { type: "boolean", default: !1 }
|
|
6096
6167
|
};
|
|
6097
|
-
this.config = new Ke(i).validate(t), this.renderer = null, this.sceneManager = null, this.cameraManager = null, this.modelLoader = null, this.vrManager = null, this.arManager = null, this.isVREnabled = this.config.vr?.enabled !== !1, this.isAREnabled = this.config.ar?.enabled === !0, this.
|
|
6168
|
+
this.config = new Ke(i).validate(t), this.renderer = null, this.sceneManager = null, this.cameraManager = null, this.modelLoader = null, this.vrManager = null, this.arManager = null, this.stereoCamera = null, this.isVREnabled = this.config.vr?.enabled !== !1, this.isAREnabled = this.config.ar?.enabled === !0, this.stereoEnabled = this.config.stereo?.enabled === !0, this.stereoMode = this.config.stereo?.mode || "sbs";
|
|
6169
|
+
const s = this.config.stereo?.eyeSeparation ?? 0.064;
|
|
6170
|
+
this.stereoEyeSeparation = Math.max(0.05, Math.min(0.07, s)), this.stereoEyeSeparation !== s && console.warn(`[BelowJS] Initial eye separation ${s}m clamped to ${this.stereoEyeSeparation}m (comfortable range for screens: 0.050-0.070m)`), this.dolly = null, this.isInitialized = !1, this.loadedModels = [], this.currentAbortController = null, this.skipRenderDuringLoad = !1, this.pixelRatioBeforeThrottle = 1, this.originalPixelRatio = 1, this.isConstrainedSafari = !1, this.init();
|
|
6098
6171
|
}
|
|
6099
6172
|
init() {
|
|
6100
6173
|
try {
|
|
6101
|
-
this.initRenderer(), this.sceneManager = new
|
|
6174
|
+
this.initRenderer(), this.sceneManager = new Fs(this.config.scene), this.cameraManager = new Ws(this.config.camera), this.modelLoader = new O(this.renderer), this.isConstrainedSafari = this.modelLoader?.isIOSWebKit || !1, this.initStereo(), this.renderer?.getPixelRatio ? this.originalPixelRatio = this.renderer.getPixelRatio() : typeof window < "u" && (this.originalPixelRatio = window.devicePixelRatio || 1), this.pixelRatioBeforeThrottle = this.originalPixelRatio, this.isVREnabled && this.initVR(), this.isAREnabled && this.initAR(), this.cameraManager.initControls(this.renderer.domElement), this.setupEventListeners(), this.startRenderLoop(), this.isInitialized = !0, typeof window < "u" && ii.init(this), this.emit("initialized");
|
|
6102
6175
|
} catch (e) {
|
|
6103
6176
|
console.error("Failed to initialize BelowViewer:", e), this.emit("error", e);
|
|
6104
6177
|
}
|
|
6105
6178
|
}
|
|
6106
6179
|
initRenderer() {
|
|
6107
|
-
this.renderer = new
|
|
6180
|
+
this.renderer = new g.WebGLRenderer({
|
|
6108
6181
|
antialias: this.config.renderer.antialias,
|
|
6109
6182
|
alpha: this.config.renderer.alpha,
|
|
6110
6183
|
powerPreference: this.config.renderer.powerPreference,
|
|
6184
|
+
logarithmicDepthBuffer: this.config.renderer.logarithmicDepthBuffer,
|
|
6111
6185
|
preserveDrawingBuffer: !0
|
|
6112
|
-
}), this.renderer.setSize(this.container.clientWidth, this.container.clientHeight), this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.shadowMap.enabled = !0, this.renderer.shadowMap.type =
|
|
6186
|
+
}), this.renderer.setSize(this.container.clientWidth, this.container.clientHeight), this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.shadowMap.enabled = !0, this.renderer.shadowMap.type = g.PCFSoftShadowMap, this.renderer.outputColorSpace = g.SRGBColorSpace;
|
|
6113
6187
|
const e = {
|
|
6114
|
-
none:
|
|
6115
|
-
linear:
|
|
6116
|
-
reinhard:
|
|
6117
|
-
cineon:
|
|
6118
|
-
"aces-filmic":
|
|
6188
|
+
none: g.NoToneMapping,
|
|
6189
|
+
linear: g.LinearToneMapping,
|
|
6190
|
+
reinhard: g.ReinhardToneMapping,
|
|
6191
|
+
cineon: g.CineonToneMapping,
|
|
6192
|
+
"aces-filmic": g.ACESFilmicToneMapping
|
|
6119
6193
|
};
|
|
6120
6194
|
this.config.renderer.toneMapping && e[this.config.renderer.toneMapping] && (this.renderer.toneMapping = e[this.config.renderer.toneMapping]), this.renderer.toneMappingExposure = this.config.renderer.toneMappingExposure, this.container.appendChild(this.renderer.domElement);
|
|
6121
6195
|
}
|
|
6196
|
+
initStereo() {
|
|
6197
|
+
this.stereoCamera || (this.stereoCamera = new g.StereoCamera()), this.stereoCamera.eyeSep = this.stereoEyeSeparation;
|
|
6198
|
+
}
|
|
6122
6199
|
initVR() {
|
|
6123
|
-
this.dolly = new
|
|
6200
|
+
this.dolly = new g.Group(), this.dolly.add(this.cameraManager.camera), this.sceneManager.scene.add(this.dolly);
|
|
6124
6201
|
const e = this.config.audioPath || "./sound/", t = this.config.enableVRAudio === !0;
|
|
6125
6202
|
this.vrManager = new Mn(this.renderer, this.cameraManager.camera, this.sceneManager.scene, e, t, this.container), this.vrManager.setControls(this.cameraManager.controls), this.config.initialPositions && this.vrManager.setInitialPositions(this.config.initialPositions), this.vrManager.onModeToggle = () => {
|
|
6126
6203
|
this.emit("vr-mode-toggle");
|
|
@@ -6142,7 +6219,7 @@ class _n extends je {
|
|
|
6142
6219
|
}
|
|
6143
6220
|
initAR() {
|
|
6144
6221
|
const e = this.config.ar?.settings || {};
|
|
6145
|
-
this.arManager = new
|
|
6222
|
+
this.arManager = new Fn(
|
|
6146
6223
|
this.renderer,
|
|
6147
6224
|
this.cameraManager.camera,
|
|
6148
6225
|
this.sceneManager.scene,
|
|
@@ -6229,10 +6306,10 @@ class _n extends je {
|
|
|
6229
6306
|
}
|
|
6230
6307
|
frameModel(e) {
|
|
6231
6308
|
if (!e.userData.boundingBox) {
|
|
6232
|
-
const o = new
|
|
6309
|
+
const o = new g.Box3().setFromObject(e);
|
|
6233
6310
|
e.userData.boundingBox = o;
|
|
6234
6311
|
}
|
|
6235
|
-
const t = e.userData.boundingBox, i = t.getSize(new
|
|
6312
|
+
const t = e.userData.boundingBox, i = t.getSize(new g.Vector3()).length(), s = t.getCenter(new g.Vector3());
|
|
6236
6313
|
this.cameraManager.frameObject(s, i);
|
|
6237
6314
|
}
|
|
6238
6315
|
/**
|
|
@@ -6244,11 +6321,11 @@ class _n extends je {
|
|
|
6244
6321
|
*/
|
|
6245
6322
|
centerModelAndRecalculateBounds(e) {
|
|
6246
6323
|
if (!e.userData.boundingBox) {
|
|
6247
|
-
const s = new
|
|
6324
|
+
const s = new g.Box3().setFromObject(e);
|
|
6248
6325
|
e.userData.boundingBox = s;
|
|
6249
6326
|
}
|
|
6250
|
-
const i = e.userData.boundingBox.getCenter(new
|
|
6251
|
-
return e.position.sub(i), e.userData.boundingBox = new
|
|
6327
|
+
const i = e.userData.boundingBox.getCenter(new g.Vector3());
|
|
6328
|
+
return e.position.sub(i), e.userData.boundingBox = new g.Box3().setFromObject(e), i;
|
|
6252
6329
|
}
|
|
6253
6330
|
startRenderLoop() {
|
|
6254
6331
|
let e = 0;
|
|
@@ -6256,10 +6333,59 @@ class _n extends je {
|
|
|
6256
6333
|
const s = Math.min((i - e) / 1e3, 0.1);
|
|
6257
6334
|
e = i, this.vrManager && this.vrManager.update(s), this.arManager && this.arManager.update(s * 1e3), this.cameraManager && this.cameraManager.update(), this.emit("before-render", s);
|
|
6258
6335
|
const o = this.renderer?.xr?.isPresenting;
|
|
6259
|
-
this.renderer && this.sceneManager && this.cameraManager && (!this.skipRenderDuringLoad || o) && this.renderer.render(this.sceneManager.scene, this.cameraManager.camera);
|
|
6336
|
+
this.renderer && this.sceneManager && this.cameraManager && (!this.skipRenderDuringLoad || o) && (this.stereoEnabled && !o && this.stereoMode === "sbs" ? this.renderSbsStereo() : this.renderer.render(this.sceneManager.scene, this.cameraManager.camera));
|
|
6260
6337
|
};
|
|
6261
6338
|
this.renderer.setAnimationLoop(t);
|
|
6262
6339
|
}
|
|
6340
|
+
renderSbsStereo() {
|
|
6341
|
+
if (!this.stereoCamera || !this.renderer || !this.sceneManager || !this.cameraManager)
|
|
6342
|
+
return;
|
|
6343
|
+
const e = this.renderer.getSize(new g.Vector2()), t = e.width, i = e.height, s = Math.floor(t / 2), o = t - s;
|
|
6344
|
+
this.stereoCamera.aspect = i > 0 ? s / i : 1, this.stereoCamera.update(this.cameraManager.camera), this.renderer.setScissorTest(!0), this.renderer.setViewport(0, 0, s, i), this.renderer.setScissor(0, 0, s, i), this.renderer.render(this.sceneManager.scene, this.stereoCamera.cameraL), this.renderer.setViewport(s, 0, o, i), this.renderer.setScissor(s, 0, o, i), this.renderer.render(this.sceneManager.scene, this.stereoCamera.cameraR), this.renderer.setScissorTest(!1), this.renderer.setViewport(0, 0, t, i);
|
|
6345
|
+
}
|
|
6346
|
+
/**
|
|
6347
|
+
* Enable or disable stereo rendering.
|
|
6348
|
+
*
|
|
6349
|
+
* Note: Stereo rendering (SBS) is automatically disabled when entering VR/XR mode,
|
|
6350
|
+
* as VR headsets provide native stereoscopic rendering. When exiting VR, stereo
|
|
6351
|
+
* rendering will resume if it was enabled before entering VR.
|
|
6352
|
+
*
|
|
6353
|
+
* @param {boolean} enabled - Whether stereo rendering is enabled.
|
|
6354
|
+
*/
|
|
6355
|
+
setStereoEnabled(e) {
|
|
6356
|
+
this.stereoEnabled = e === !0, this.stereoEnabled && this.initStereo();
|
|
6357
|
+
}
|
|
6358
|
+
/**
|
|
6359
|
+
* Set the eye separation distance for stereo rendering.
|
|
6360
|
+
*
|
|
6361
|
+
* @param {number} eyeSeparation - Eye separation in meters (clamped to 0.050-0.070m for screen comfort).
|
|
6362
|
+
*/
|
|
6363
|
+
setStereoEyeSeparation(e) {
|
|
6364
|
+
if (typeof e != "number" || Number.isNaN(e))
|
|
6365
|
+
return;
|
|
6366
|
+
const t = Math.max(0.05, Math.min(0.07, e));
|
|
6367
|
+
t !== e && console.warn(`[BelowJS] Eye separation ${e}m clamped to ${t}m (comfortable range for screens: 0.050-0.070m)`), this.stereoEyeSeparation = t, this.stereoCamera && (this.stereoCamera.eyeSep = t);
|
|
6368
|
+
}
|
|
6369
|
+
/**
|
|
6370
|
+
* Set the stereo mode (currently only 'sbs').
|
|
6371
|
+
*
|
|
6372
|
+
* @param {string} mode - Stereo mode string.
|
|
6373
|
+
*/
|
|
6374
|
+
setStereoMode(e) {
|
|
6375
|
+
e === "sbs" && (this.stereoMode = e);
|
|
6376
|
+
}
|
|
6377
|
+
/**
|
|
6378
|
+
* Get the current stereo configuration.
|
|
6379
|
+
*
|
|
6380
|
+
* @returns {{enabled: boolean, mode: string, eyeSeparation: number}}
|
|
6381
|
+
*/
|
|
6382
|
+
getStereoSettings() {
|
|
6383
|
+
return {
|
|
6384
|
+
enabled: this.stereoEnabled,
|
|
6385
|
+
mode: this.stereoMode,
|
|
6386
|
+
eyeSeparation: this.stereoEyeSeparation
|
|
6387
|
+
};
|
|
6388
|
+
}
|
|
6263
6389
|
applyLoadRenderingConstraints(e) {
|
|
6264
6390
|
if (!(!this.isConstrainedSafari || !this.renderer))
|
|
6265
6391
|
if (e) {
|
|
@@ -6463,7 +6589,7 @@ class _n extends je {
|
|
|
6463
6589
|
t && e.vr && this.vrManager ? this.vrManager.applyVRPositions(e) : !t && e.desktop && this.applyDesktopPositions(e.desktop);
|
|
6464
6590
|
}
|
|
6465
6591
|
}
|
|
6466
|
-
const si = new
|
|
6592
|
+
const si = new je(), Fe = new L();
|
|
6467
6593
|
class Ui extends Ds {
|
|
6468
6594
|
/**
|
|
6469
6595
|
* Constructs a new line segments geometry.
|
|
@@ -6534,7 +6660,7 @@ class Ui extends Ds {
|
|
|
6534
6660
|
* @return {LineSegmentsGeometry} A reference to this geometry.
|
|
6535
6661
|
*/
|
|
6536
6662
|
fromMesh(e) {
|
|
6537
|
-
return this.fromWireframeGeometry(new
|
|
6663
|
+
return this.fromWireframeGeometry(new Ls(e.geometry)), this;
|
|
6538
6664
|
}
|
|
6539
6665
|
/**
|
|
6540
6666
|
* Setups this line segments geometry from the given line segments.
|
|
@@ -6548,12 +6674,12 @@ class Ui extends Ds {
|
|
|
6548
6674
|
return this.setPositions(t.attributes.position.array), this;
|
|
6549
6675
|
}
|
|
6550
6676
|
computeBoundingBox() {
|
|
6551
|
-
this.boundingBox === null && (this.boundingBox = new
|
|
6677
|
+
this.boundingBox === null && (this.boundingBox = new je());
|
|
6552
6678
|
const e = this.attributes.instanceStart, t = this.attributes.instanceEnd;
|
|
6553
6679
|
e !== void 0 && t !== void 0 && (this.boundingBox.setFromBufferAttribute(e), si.setFromBufferAttribute(t), this.boundingBox.union(si));
|
|
6554
6680
|
}
|
|
6555
6681
|
computeBoundingSphere() {
|
|
6556
|
-
this.boundingSphere === null && (this.boundingSphere = new
|
|
6682
|
+
this.boundingSphere === null && (this.boundingSphere = new Qt()), this.boundingBox === null && this.computeBoundingBox();
|
|
6557
6683
|
const e = this.attributes.instanceStart, t = this.attributes.instanceEnd;
|
|
6558
6684
|
if (e !== void 0 && t !== void 0) {
|
|
6559
6685
|
const i = this.boundingSphere.center;
|
|
@@ -6567,7 +6693,7 @@ class Ui extends Ds {
|
|
|
6567
6693
|
toJSON() {
|
|
6568
6694
|
}
|
|
6569
6695
|
}
|
|
6570
|
-
|
|
6696
|
+
Ue.line = {
|
|
6571
6697
|
worldUnits: { value: 1 },
|
|
6572
6698
|
linewidth: { value: 1 },
|
|
6573
6699
|
resolution: { value: new V(1, 1) },
|
|
@@ -6577,11 +6703,11 @@ Ne.line = {
|
|
|
6577
6703
|
gapSize: { value: 1 }
|
|
6578
6704
|
// todo FIX - maybe change to totalSize
|
|
6579
6705
|
};
|
|
6580
|
-
|
|
6706
|
+
Ne.line = {
|
|
6581
6707
|
uniforms: bi.merge([
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6708
|
+
Ue.common,
|
|
6709
|
+
Ue.fog,
|
|
6710
|
+
Ue.line
|
|
6585
6711
|
]),
|
|
6586
6712
|
vertexShader: (
|
|
6587
6713
|
/* glsl */
|
|
@@ -6961,7 +7087,7 @@ Pe.line = {
|
|
|
6961
7087
|
`
|
|
6962
7088
|
)
|
|
6963
7089
|
};
|
|
6964
|
-
class
|
|
7090
|
+
class Oe extends Ts {
|
|
6965
7091
|
/**
|
|
6966
7092
|
* Constructs a new line segments geometry.
|
|
6967
7093
|
*
|
|
@@ -6974,9 +7100,9 @@ class Ve extends Ls {
|
|
|
6974
7100
|
constructor(e) {
|
|
6975
7101
|
super({
|
|
6976
7102
|
type: "LineMaterial",
|
|
6977
|
-
uniforms: bi.clone(
|
|
6978
|
-
vertexShader:
|
|
6979
|
-
fragmentShader:
|
|
7103
|
+
uniforms: bi.clone(Ne.line.uniforms),
|
|
7104
|
+
vertexShader: Ne.line.vertexShader,
|
|
7105
|
+
fragmentShader: Ne.line.fragmentShader,
|
|
6980
7106
|
clipping: !0
|
|
6981
7107
|
// required for clipping support
|
|
6982
7108
|
}), this.isLineMaterial = !0, this.setValues(e);
|
|
@@ -7116,7 +7242,7 @@ class Ve extends Ls {
|
|
|
7116
7242
|
this.defines && (e === !0 !== this.alphaToCoverage && (this.needsUpdate = !0), e === !0 ? this.defines.USE_ALPHA_TO_COVERAGE = "" : delete this.defines.USE_ALPHA_TO_COVERAGE);
|
|
7117
7243
|
}
|
|
7118
7244
|
}
|
|
7119
|
-
const At = new
|
|
7245
|
+
const At = new Le(), oi = new L(), ni = new L(), _ = new Le(), G = new Le(), X = new Le(), lt = new L(), ct = new Ie(), P = new ks(), ri = new L(), _e = new je(), Ge = new Qt(), Z = new Le();
|
|
7120
7246
|
let $, ce;
|
|
7121
7247
|
function ai(c, e, t) {
|
|
7122
7248
|
return Z.set(0, 0, -e, 1).applyMatrix4(c.projectionMatrix), Z.multiplyScalar(1 / Z.w), Z.x = ce / t.width, Z.y = ce / t.height, Z.applyMatrix4(c.projectionMatrixInverse), Z.multiplyScalar(1 / Z.w), Math.abs(Math.max(Z.x, Z.y));
|
|
@@ -7125,7 +7251,7 @@ function Gn(c, e) {
|
|
|
7125
7251
|
const t = c.matrixWorld, i = c.geometry, s = i.attributes.instanceStart, o = i.attributes.instanceEnd, n = Math.min(i.instanceCount, s.count);
|
|
7126
7252
|
for (let r = 0, A = n; r < A; r++) {
|
|
7127
7253
|
P.start.fromBufferAttribute(s, r), P.end.fromBufferAttribute(o, r), P.applyMatrix4(t);
|
|
7128
|
-
const a = new
|
|
7254
|
+
const a = new L(), l = new L();
|
|
7129
7255
|
$.distanceSqToSegment(P.start, P.end, l, a), l.distanceTo(a) < ce * 0.5 && e.push({
|
|
7130
7256
|
point: l,
|
|
7131
7257
|
pointOnLine: a,
|
|
@@ -7141,27 +7267,27 @@ function Gn(c, e) {
|
|
|
7141
7267
|
function Pn(c, e, t) {
|
|
7142
7268
|
const i = e.projectionMatrix, o = c.material.resolution, n = c.matrixWorld, r = c.geometry, A = r.attributes.instanceStart, a = r.attributes.instanceEnd, l = Math.min(r.instanceCount, A.count), h = -e.near;
|
|
7143
7269
|
$.at(1, X), X.w = 1, X.applyMatrix4(e.matrixWorldInverse), X.applyMatrix4(i), X.multiplyScalar(1 / X.w), X.x *= o.x / 2, X.y *= o.y / 2, X.z = 0, lt.copy(X), ct.multiplyMatrices(e.matrixWorldInverse, n);
|
|
7144
|
-
for (let d = 0,
|
|
7270
|
+
for (let d = 0, u = l; d < u; d++) {
|
|
7145
7271
|
if (_.fromBufferAttribute(A, d), G.fromBufferAttribute(a, d), _.w = 1, G.w = 1, _.applyMatrix4(ct), G.applyMatrix4(ct), _.z > h && G.z > h)
|
|
7146
7272
|
continue;
|
|
7147
7273
|
if (_.z > h) {
|
|
7148
|
-
const I = _.z - G.z,
|
|
7149
|
-
_.lerp(G,
|
|
7274
|
+
const I = _.z - G.z, C = (_.z - h) / I;
|
|
7275
|
+
_.lerp(G, C);
|
|
7150
7276
|
} else if (G.z > h) {
|
|
7151
|
-
const I = G.z - _.z,
|
|
7152
|
-
G.lerp(_,
|
|
7277
|
+
const I = G.z - _.z, C = (G.z - h) / I;
|
|
7278
|
+
G.lerp(_, C);
|
|
7153
7279
|
}
|
|
7154
7280
|
_.applyMatrix4(i), G.applyMatrix4(i), _.multiplyScalar(1 / _.w), G.multiplyScalar(1 / G.w), _.x *= o.x / 2, _.y *= o.y / 2, G.x *= o.x / 2, G.y *= o.y / 2, P.start.copy(_), P.start.z = 0, P.end.copy(G), P.end.z = 0;
|
|
7155
|
-
const
|
|
7156
|
-
P.at(
|
|
7157
|
-
const E = Bt.lerp(_.z, G.z,
|
|
7281
|
+
const b = P.closestPointToPointParameter(lt, !0);
|
|
7282
|
+
P.at(b, ri);
|
|
7283
|
+
const E = Bt.lerp(_.z, G.z, b), f = E >= -1 && E <= 1, m = lt.distanceTo(ri) < ce * 0.5;
|
|
7158
7284
|
if (f && m) {
|
|
7159
7285
|
P.start.fromBufferAttribute(A, d), P.end.fromBufferAttribute(a, d), P.start.applyMatrix4(n), P.end.applyMatrix4(n);
|
|
7160
|
-
const I = new
|
|
7161
|
-
$.distanceSqToSegment(P.start, P.end,
|
|
7162
|
-
point:
|
|
7286
|
+
const I = new L(), C = new L();
|
|
7287
|
+
$.distanceSqToSegment(P.start, P.end, C, I), t.push({
|
|
7288
|
+
point: C,
|
|
7163
7289
|
pointOnLine: I,
|
|
7164
|
-
distance: $.origin.distanceTo(
|
|
7290
|
+
distance: $.origin.distanceTo(C),
|
|
7165
7291
|
object: c,
|
|
7166
7292
|
face: null,
|
|
7167
7293
|
faceIndex: d,
|
|
@@ -7171,14 +7297,14 @@ function Pn(c, e, t) {
|
|
|
7171
7297
|
}
|
|
7172
7298
|
}
|
|
7173
7299
|
}
|
|
7174
|
-
class Nn extends
|
|
7300
|
+
class Nn extends St {
|
|
7175
7301
|
/**
|
|
7176
7302
|
* Constructs a new wide line.
|
|
7177
7303
|
*
|
|
7178
7304
|
* @param {LineSegmentsGeometry} [geometry] - The line geometry.
|
|
7179
7305
|
* @param {LineMaterial} [material] - The line material.
|
|
7180
7306
|
*/
|
|
7181
|
-
constructor(e = new Ui(), t = new
|
|
7307
|
+
constructor(e = new Ui(), t = new Oe({ color: Math.random() * 16777215 })) {
|
|
7182
7308
|
super(e, t), this.isLineSegments2 = !0, this.type = "LineSegments2";
|
|
7183
7309
|
}
|
|
7184
7310
|
/**
|
|
@@ -7207,25 +7333,25 @@ class Nn extends Qt {
|
|
|
7207
7333
|
const o = e.params.Line2 !== void 0 && e.params.Line2.threshold || 0;
|
|
7208
7334
|
$ = e.ray;
|
|
7209
7335
|
const n = this.matrixWorld, r = this.geometry, A = this.material;
|
|
7210
|
-
ce = A.linewidth + o, r.boundingSphere === null && r.computeBoundingSphere(),
|
|
7336
|
+
ce = A.linewidth + o, r.boundingSphere === null && r.computeBoundingSphere(), Ge.copy(r.boundingSphere).applyMatrix4(n);
|
|
7211
7337
|
let a;
|
|
7212
7338
|
if (i)
|
|
7213
7339
|
a = ce * 0.5;
|
|
7214
7340
|
else {
|
|
7215
|
-
const h = Math.max(s.near,
|
|
7341
|
+
const h = Math.max(s.near, Ge.distanceToPoint($.origin));
|
|
7216
7342
|
a = ai(s, h, A.resolution);
|
|
7217
7343
|
}
|
|
7218
|
-
if (
|
|
7344
|
+
if (Ge.radius += a, $.intersectsSphere(Ge) === !1)
|
|
7219
7345
|
return;
|
|
7220
|
-
r.boundingBox === null && r.computeBoundingBox(),
|
|
7346
|
+
r.boundingBox === null && r.computeBoundingBox(), _e.copy(r.boundingBox).applyMatrix4(n);
|
|
7221
7347
|
let l;
|
|
7222
7348
|
if (i)
|
|
7223
7349
|
l = ce * 0.5;
|
|
7224
7350
|
else {
|
|
7225
|
-
const h = Math.max(s.near,
|
|
7351
|
+
const h = Math.max(s.near, _e.distanceToPoint($.origin));
|
|
7226
7352
|
l = ai(s, h, A.resolution);
|
|
7227
7353
|
}
|
|
7228
|
-
|
|
7354
|
+
_e.expandByScalar(l), $.intersectsBox(_e) !== !1 && (i ? Gn(this, t) : Pn(this, s, t));
|
|
7229
7355
|
}
|
|
7230
7356
|
onBeforeRender(e) {
|
|
7231
7357
|
const t = this.material.uniforms;
|
|
@@ -7293,7 +7419,7 @@ class Ai extends Nn {
|
|
|
7293
7419
|
* @param {LineGeometry} [geometry] - The line geometry.
|
|
7294
7420
|
* @param {LineMaterial} [material] - The line material.
|
|
7295
7421
|
*/
|
|
7296
|
-
constructor(e = new It(), t = new
|
|
7422
|
+
constructor(e = new It(), t = new Oe({ color: Math.random() * 16777215 })) {
|
|
7297
7423
|
super(e, t), this.isLine2 = !0, this.type = "Line2";
|
|
7298
7424
|
}
|
|
7299
7425
|
}
|
|
@@ -7340,24 +7466,24 @@ class Un {
|
|
|
7340
7466
|
*
|
|
7341
7467
|
* @param {MeasurementSystemConfig} config - Configuration object
|
|
7342
7468
|
*/
|
|
7343
|
-
constructor({ scene: e, camera: t, renderer: i, controls: s, dolly: o,
|
|
7469
|
+
constructor({ scene: e, camera: t, renderer: i, controls: s, dolly: o, uiParent: n, getRaycastInfo: r, config: A = {}, theme: a = "dark", showMeasurementLabels: l = !1 }) {
|
|
7344
7470
|
this.ghostSpheres = {
|
|
7345
7471
|
left: null,
|
|
7346
7472
|
right: null
|
|
7347
|
-
}, this.MAX_SPHERES = 2, this.measurementSpheres = [], this.measurementLine = null, this.measurementLabel = null, this.previousTriggerState = {}, this.unifiedMeasurementPoints = [], this.unifiedMeasurementLine = null, this.desktopMeasurementPoints = [], this.desktopMeasurementLine = null, typeof window < "u" && (window.measurementSystem = this), this.scene = e, this.camera = t, this.renderer = i, this.controls = s, this.dolly = o, this.config =
|
|
7348
|
-
const
|
|
7349
|
-
let
|
|
7350
|
-
const
|
|
7351
|
-
if (e && e.children && e.children.forEach((
|
|
7352
|
-
|
|
7353
|
-
}), (!
|
|
7473
|
+
}, this.MAX_SPHERES = 2, this.measurementSpheres = [], this.measurementLine = null, this.measurementLabel = null, this.previousTriggerState = {}, this.unifiedMeasurementPoints = [], this.unifiedMeasurementLine = null, this.desktopMeasurementPoints = [], this.desktopMeasurementLine = null, typeof window < "u" && (window.measurementSystem = this), this.scene = e, this.camera = t, this.renderer = i, this.uiParent = n || null, this.getRaycastInfo = typeof r == "function" ? r : null, this.controls = s, this.dolly = o, this.config = A, this.theme = a, this.showMeasurementLabels = l, this._raycastTargets = e && e.children ? e.children : [], this.enabled = !0, this.isVR = !1, this.measurementPanel = null, this.desktopMeasurementMode = !1, this.measurementSystemEnabled = !0, this.desktopMeasurementPoints = [], this.connectionLine = null, this.desktopMeasurementLine = null, this.measurementSprite = null, this.measurementCanvas = null, this.measurementTexture = null, this.lastClickTime = 0, this.lastTriggerTime = 0, this._wasInVR = !1, this.focusAnimation = null, this.mouse = new g.Vector2(), this.raycaster = new g.Raycaster();
|
|
7474
|
+
const h = () => {
|
|
7475
|
+
let d = null, u = null;
|
|
7476
|
+
const p = null, b = null;
|
|
7477
|
+
if (e && e.children && e.children.forEach((E) => {
|
|
7478
|
+
E && E.inputSource && E.inputSource.handedness && (E.inputSource.handedness === "left" && (d = E), E.inputSource.handedness === "right" && (u = E));
|
|
7479
|
+
}), (!d || !u) && i && i.xr && i.xr.getController)
|
|
7354
7480
|
try {
|
|
7355
|
-
|
|
7481
|
+
d = d || i.xr.getController(0), u = u || i.xr.getController(1);
|
|
7356
7482
|
} catch {
|
|
7357
7483
|
}
|
|
7358
|
-
|
|
7484
|
+
d && u ? (this.attachVR({ controller1: d, controller2: u, controllerGrip1: p, controllerGrip2: b }), this.ghostSpheres && this.ghostSpheres.left && this.ghostSpheres.right && (this.ghostSpheres.left.visible = !0, this.ghostSpheres.right.visible = !0)) : (this._ghostSphereAttachRetries || (this._ghostSphereAttachRetries = 0), this._ghostSphereAttachRetries < 40 ? (this._ghostSphereAttachRetries++, setTimeout(h, 250)) : typeof window < "u" && window.console && console.warn("[MeasurementSystem] Could not find VR controllers to attach ghost spheres after multiple attempts."));
|
|
7359
7485
|
};
|
|
7360
|
-
if (
|
|
7486
|
+
if (h(), i && i.xr && i.xr.addEventListener && i.xr.addEventListener("sessionstart", h), this.sphereGeometry = new g.SphereGeometry(0.02, 8, 6), this.placedMaterial = new g.MeshBasicMaterial({ color: 16777215 }), this.vrLineMaterial = new Oe({
|
|
7361
7487
|
color: 16777215,
|
|
7362
7488
|
linewidth: 3,
|
|
7363
7489
|
transparent: !0,
|
|
@@ -7365,7 +7491,7 @@ class Un {
|
|
|
7365
7491
|
depthTest: !1,
|
|
7366
7492
|
vertexColors: !1,
|
|
7367
7493
|
dashed: !1
|
|
7368
|
-
}), this.desktopLineMaterial = new
|
|
7494
|
+
}), this.desktopLineMaterial = new Oe({
|
|
7369
7495
|
color: 16777215,
|
|
7370
7496
|
linewidth: 3,
|
|
7371
7497
|
transparent: !0,
|
|
@@ -7374,19 +7500,19 @@ class Un {
|
|
|
7374
7500
|
vertexColors: !1,
|
|
7375
7501
|
dashed: !1
|
|
7376
7502
|
}), this.MAX_DESKTOP_POINTS = 2, this.DRAG_THRESHOLD = 5, this.isDragging = !1, this.dragStartPosition = { x: 0, y: 0 }, this.createMeasurementPanel(), this.updateMeasurementPanel(), this._boundOnMouseClick = this.onMouseClick.bind(this), this._boundOnMouseDown = this.onMouseDown.bind(this), this._boundOnMouseMove = this.onMouseMove.bind(this), this._boundOnMouseUp = this.onMouseUp.bind(this), this.renderer.domElement.addEventListener("click", this._boundOnMouseClick, !1), this.renderer.domElement.addEventListener("mousedown", this._boundOnMouseDown, !1), this.renderer.domElement.addEventListener("mousemove", this._boundOnMouseMove, !1), this.renderer.domElement.addEventListener("mouseup", this._boundOnMouseUp, !1), i && i.xr && typeof i.xr.getController == "function") {
|
|
7377
|
-
const
|
|
7503
|
+
const d = () => {
|
|
7378
7504
|
if (i.xr.isPresenting) {
|
|
7379
|
-
const
|
|
7380
|
-
this.attachVR({ controller1:
|
|
7505
|
+
const u = i.xr.getController(0), p = i.xr.getController(1), b = i.xr.getControllerGrip ? i.xr.getControllerGrip(0) : void 0, E = i.xr.getControllerGrip ? i.xr.getControllerGrip(1) : void 0;
|
|
7506
|
+
this.attachVR({ controller1: u, controller2: p, controllerGrip1: b, controllerGrip2: E });
|
|
7381
7507
|
}
|
|
7382
7508
|
};
|
|
7383
|
-
if (i.xr.addEventListener && i.xr.addEventListener("sessionstart",
|
|
7384
|
-
const
|
|
7385
|
-
i.xr.requestSession = async (...
|
|
7386
|
-
const
|
|
7509
|
+
if (i.xr.addEventListener && i.xr.addEventListener("sessionstart", d), i.xr.isPresenting && d(), i.xr && typeof i.xr.requestSession == "function" && !i.xr._measurementSystemPatched) {
|
|
7510
|
+
const u = i.xr.requestSession.bind(i.xr);
|
|
7511
|
+
i.xr.requestSession = async (...p) => {
|
|
7512
|
+
const b = await u(...p);
|
|
7387
7513
|
return setTimeout(() => {
|
|
7388
|
-
|
|
7389
|
-
}, 100),
|
|
7514
|
+
d();
|
|
7515
|
+
}, 100), b;
|
|
7390
7516
|
}, i.xr._measurementSystemPatched = !0;
|
|
7391
7517
|
}
|
|
7392
7518
|
}
|
|
@@ -7459,14 +7585,14 @@ class Un {
|
|
|
7459
7585
|
syncToVR() {
|
|
7460
7586
|
if (this.desktopMeasurementPoints.length === 2) {
|
|
7461
7587
|
if (this.clearVRMeasurement(), this.desktopMeasurementPoints.forEach((e) => {
|
|
7462
|
-
const t = new
|
|
7588
|
+
const t = new g.Mesh(this.sphereGeometry, this.placedMaterial);
|
|
7463
7589
|
t.position.copy(e.position), this.scene.add(t), this.measurementSpheres.push(t);
|
|
7464
7590
|
}), this.measurementSpheres.length === 2) {
|
|
7465
|
-
const e = new
|
|
7591
|
+
const e = new g.BufferGeometry().setFromPoints([
|
|
7466
7592
|
this.measurementSpheres[0].position,
|
|
7467
7593
|
this.measurementSpheres[1].position
|
|
7468
|
-
]), t = this.vrLineMaterial || new
|
|
7469
|
-
this.connectionLine = new
|
|
7594
|
+
]), t = this.vrLineMaterial || new g.LineBasicMaterial({ color: 16777215, transparent: !0, opacity: 0.8, depthTest: !1 });
|
|
7595
|
+
this.connectionLine = new g.Line(e, t), this.scene.add(this.connectionLine), this.createMeasurementDisplay(this.measurementSpheres[0].position.distanceTo(this.measurementSpheres[1].position)), this.measurementSprite && !this.scene.children.includes(this.measurementSprite) && this.scene.add(this.measurementSprite);
|
|
7470
7596
|
}
|
|
7471
7597
|
this.measurementSystemEnabled = !0, this.updateMeasurementPanel();
|
|
7472
7598
|
}
|
|
@@ -7478,10 +7604,10 @@ class Un {
|
|
|
7478
7604
|
const t = this.measurementSpheres[e].position.clone();
|
|
7479
7605
|
let i = t;
|
|
7480
7606
|
if (this._raycastTargets && this._raycastTargets.length > 0 && this.camera) {
|
|
7481
|
-
const o = t.clone().sub(this.camera.position).normalize(), r = new
|
|
7607
|
+
const o = t.clone().sub(this.camera.position).normalize(), r = new g.Raycaster(this.camera.position, o).intersectObjects(this._raycastTargets, !0);
|
|
7482
7608
|
r.length > 0 && (i = r[0].point);
|
|
7483
7609
|
}
|
|
7484
|
-
const s = new
|
|
7610
|
+
const s = new g.Mesh(this.sphereGeometry, this.placedMaterial);
|
|
7485
7611
|
s.position.copy(i), this.scene.add(s), this.desktopMeasurementPoints.push(s);
|
|
7486
7612
|
}
|
|
7487
7613
|
if (this.desktopMeasurementPoints.length === 2) {
|
|
@@ -7496,7 +7622,7 @@ class Un {
|
|
|
7496
7622
|
]), this.desktopMeasurementLine = new Ai(e, this.desktopLineMaterial), this.desktopMeasurementLine.computeLineDistances(), this.scene.add(this.desktopMeasurementLine);
|
|
7497
7623
|
const t = this.desktopMeasurementPoints[0].position.distanceTo(this.desktopMeasurementPoints[1].position);
|
|
7498
7624
|
if (this.createMeasurementDisplay(t), this.measurementSprite) {
|
|
7499
|
-
const i = new
|
|
7625
|
+
const i = new g.Vector3();
|
|
7500
7626
|
i.addVectors(this.desktopMeasurementPoints[0].position, this.desktopMeasurementPoints[1].position), i.multiplyScalar(0.5);
|
|
7501
7627
|
const s = Math.max(0.05, Math.min(0.2, t * 0.03));
|
|
7502
7628
|
i.y += s, this.measurementSprite.position.copy(i), this.measurementSprite.visible = !1, this.scene.children.includes(this.measurementSprite) || this.scene.add(this.measurementSprite);
|
|
@@ -7505,6 +7631,10 @@ class Un {
|
|
|
7505
7631
|
this.updateMeasurementPanel();
|
|
7506
7632
|
}
|
|
7507
7633
|
}
|
|
7634
|
+
formatDistance(e) {
|
|
7635
|
+
const t = e * 100;
|
|
7636
|
+
return t <= 20 ? `${t.toFixed(2)} cm` : `${e.toFixed(2)}m`;
|
|
7637
|
+
}
|
|
7508
7638
|
createMeasurementDisplay(e) {
|
|
7509
7639
|
const t = (window.devicePixelRatio || 1) * 4, i = 256, s = 64, o = i * t, n = s * t;
|
|
7510
7640
|
this.measurementCanvas || (this.measurementCanvas = document.createElement("canvas")), (this.measurementCanvas.width !== o || this.measurementCanvas.height !== n) && (this.measurementCanvas.width = o, this.measurementCanvas.height = n);
|
|
@@ -7515,14 +7645,14 @@ class Un {
|
|
|
7515
7645
|
e <= 2 ? a = 0.4 + e / 2 * 0.3 : e <= 4 ? a = 0.7 + (e - 2) / 2 * 0.2 : a = 0.9 + Math.min((e - 4) / 16, 1) * 0.5;
|
|
7516
7646
|
const l = Math.round(A * a);
|
|
7517
7647
|
r.font = `600 ${l}px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif`;
|
|
7518
|
-
const h =
|
|
7519
|
-
if (r.fillStyle = "rgba(0, 0, 0, 0.8)", r.beginPath(), r.roundRect(m, I, E, f, Math.max(4, l * 0.2)), r.fill(), r.fillStyle = "white", r.textAlign = "center", r.textBaseline = "middle", r.fillText(h, i / 2, s / 2), r.restore(), this.measurementTexture ? this.measurementTexture.needsUpdate = !0 : (this.measurementTexture = new
|
|
7520
|
-
const w = new
|
|
7648
|
+
const h = this.formatDistance(e), u = r.measureText(h).width, p = l, b = Math.max(6, l * 0.3), E = u + b * 2, f = p + b * 2, m = (i - E) / 2, I = (s - f) / 2;
|
|
7649
|
+
if (r.fillStyle = "rgba(0, 0, 0, 0.8)", r.beginPath(), r.roundRect(m, I, E, f, Math.max(4, l * 0.2)), r.fill(), r.fillStyle = "white", r.textAlign = "center", r.textBaseline = "middle", r.fillText(h, i / 2, s / 2), r.restore(), this.measurementTexture ? this.measurementTexture.needsUpdate = !0 : (this.measurementTexture = new g.CanvasTexture(this.measurementCanvas), this.measurementTexture.minFilter = g.LinearFilter, this.measurementTexture.magFilter = g.LinearFilter), !this.measurementSprite) {
|
|
7650
|
+
const w = new g.SpriteMaterial({
|
|
7521
7651
|
map: this.measurementTexture,
|
|
7522
7652
|
depthTest: !1,
|
|
7523
7653
|
depthWrite: !1
|
|
7524
7654
|
});
|
|
7525
|
-
this.measurementSprite = new
|
|
7655
|
+
this.measurementSprite = new g.Sprite(w);
|
|
7526
7656
|
}
|
|
7527
7657
|
const B = 0.3 * a, y = i / s;
|
|
7528
7658
|
return this.measurementSprite.scale.set(B * y, B, 1), this.measurementSprite;
|
|
@@ -7554,7 +7684,7 @@ class Un {
|
|
|
7554
7684
|
*/
|
|
7555
7685
|
attachVR({ controller1: e, controller2: t, controllerGrip1: i, controllerGrip2: s }) {
|
|
7556
7686
|
this.controller1 = e, this.controller2 = t, this.controllerGrip1 = i, this.controllerGrip2 = s;
|
|
7557
|
-
const o = new
|
|
7687
|
+
const o = new g.MeshBasicMaterial({
|
|
7558
7688
|
color: 8947848,
|
|
7559
7689
|
// ghostly grey
|
|
7560
7690
|
transparent: !0,
|
|
@@ -7562,7 +7692,7 @@ class Un {
|
|
|
7562
7692
|
depthTest: !1,
|
|
7563
7693
|
depthWrite: !1
|
|
7564
7694
|
});
|
|
7565
|
-
this.ghostSpheres.left && this.ghostSpheres.left.parent && this.ghostSpheres.left.parent.remove(this.ghostSpheres.left), this.ghostSpheres.right && this.ghostSpheres.right.parent && this.ghostSpheres.right.parent.remove(this.ghostSpheres.right), this.ghostSpheres.left = new
|
|
7695
|
+
this.ghostSpheres.left && this.ghostSpheres.left.parent && this.ghostSpheres.left.parent.remove(this.ghostSpheres.left), this.ghostSpheres.right && this.ghostSpheres.right.parent && this.ghostSpheres.right.parent.remove(this.ghostSpheres.right), this.ghostSpheres.left = new g.Mesh(this.sphereGeometry, o.clone()), this.ghostSpheres.right = new g.Mesh(this.sphereGeometry, o.clone()), this.ghostSpheres.left.scale.set(0.5, 0.5, 0.5), this.ghostSpheres.right.scale.set(0.5, 0.5, 0.5), this.ghostSpheres.left.position.set(0, 0, -0.07), this.ghostSpheres.right.position.set(0, 0, -0.07), this.ghostSpheres.left.visible = !0, this.ghostSpheres.right.visible = !0, this.controller1 && this.controller1.add(this.ghostSpheres.left), this.controller2 && this.controller2.add(this.ghostSpheres.right), this.yButtonPressed = !1, this.MAX_SPHERES = 2, this.triggerState = {
|
|
7566
7696
|
left: !1,
|
|
7567
7697
|
right: !1
|
|
7568
7698
|
}, this._onVRTriggerDown = this._onVRTriggerDown.bind(this), this._onVRTriggerUp = this._onVRTriggerUp.bind(this), this._onVRYButtonDown = this._onVRYButtonDown.bind(this), this._onVRYButtonUp = this._onVRYButtonUp.bind(this), this.controller1 && this.controller2 && (this.controller1.addEventListener("selectstart", this._onVRTriggerDown), this.controller1.addEventListener("selectend", this._onVRTriggerUp), this.controller2.addEventListener("selectstart", this._onVRTriggerDown), this.controller2.addEventListener("selectend", this._onVRTriggerUp), this.controller1.addEventListener("ybuttondown", this._onVRYButtonDown), this.controller1.addEventListener("ybuttonup", this._onVRYButtonUp), this.controller2.addEventListener("ybuttondown", this._onVRYButtonDown), this.controller2.addEventListener("ybuttonup", this._onVRYButtonUp)), this.isVR = !0, this.refreshMeasurementDisplayForVR();
|
|
@@ -7572,13 +7702,13 @@ class Un {
|
|
|
7572
7702
|
_onVRTriggerUp(e) {
|
|
7573
7703
|
const t = e.target, i = performance.now();
|
|
7574
7704
|
if (!(this.lastTriggerTime && i - this.lastTriggerTime < 200) && (this.lastTriggerTime = i, this.measurementSystemEnabled)) {
|
|
7575
|
-
const s = new
|
|
7705
|
+
const s = new g.Vector3();
|
|
7576
7706
|
let o = null;
|
|
7577
7707
|
if (t === this.controller1 && this.ghostSpheres.left ? o = this.ghostSpheres.left : t === this.controller2 && this.ghostSpheres.right && (o = this.ghostSpheres.right), o)
|
|
7578
7708
|
o.getWorldPosition(s);
|
|
7579
7709
|
else {
|
|
7580
7710
|
t.getWorldPosition(s);
|
|
7581
|
-
const n = new
|
|
7711
|
+
const n = new g.Vector3(0, 0, -0.05);
|
|
7582
7712
|
n.applyQuaternion(t.quaternion), s.add(n);
|
|
7583
7713
|
}
|
|
7584
7714
|
this._placeVRMeasurementPoint(s);
|
|
@@ -7590,11 +7720,11 @@ class Un {
|
|
|
7590
7720
|
_onVRYButtonUp() {
|
|
7591
7721
|
}
|
|
7592
7722
|
_getVRControllerIntersection(e) {
|
|
7593
|
-
const t = new
|
|
7723
|
+
const t = new g.Matrix4();
|
|
7594
7724
|
t.identity().extractRotation(e.matrixWorld);
|
|
7595
|
-
const i = new
|
|
7725
|
+
const i = new g.Vector3(), s = new g.Vector3(0, 0, -1).applyMatrix4(t);
|
|
7596
7726
|
e.getWorldPosition(i);
|
|
7597
|
-
const r = new
|
|
7727
|
+
const r = new g.Raycaster(i, s.normalize()).intersectObjects(this.scene.children, !0).filter((A) => {
|
|
7598
7728
|
const a = this.unifiedMeasurementPoints.some((d) => d.sphere === A.object), l = A.object === this.unifiedMeasurementLine, h = this.isMeasurementHelper(A.object);
|
|
7599
7729
|
return !a && !l && !h;
|
|
7600
7730
|
});
|
|
@@ -7621,8 +7751,8 @@ class Un {
|
|
|
7621
7751
|
const s = this.unifiedMeasurementPoints.shift();
|
|
7622
7752
|
s.sphere && this.scene.remove(s.sphere);
|
|
7623
7753
|
}
|
|
7624
|
-
const i = new
|
|
7625
|
-
i.position.copy(e), i.userData.isMeasurementSphere = !0, this.scene.add(i), this.unifiedMeasurementPoints.push({
|
|
7754
|
+
const i = new g.Mesh(this.sphereGeometry, this.placedMaterial);
|
|
7755
|
+
i.position.copy(e), i.scale.setScalar(0.5), i.userData.isMeasurementSphere = !0, this.scene.add(i), this.unifiedMeasurementPoints.push({
|
|
7626
7756
|
position: e.clone(),
|
|
7627
7757
|
sphere: i,
|
|
7628
7758
|
source: t
|
|
@@ -7643,13 +7773,17 @@ class Un {
|
|
|
7643
7773
|
t.z
|
|
7644
7774
|
]), this.unifiedMeasurementLine = new Ai(i, this.desktopLineMaterial), this.unifiedMeasurementLine.computeLineDistances(), this.unifiedMeasurementLine.userData.isMeasurementLine = !0, this.scene.add(this.unifiedMeasurementLine);
|
|
7645
7775
|
const s = e.distanceTo(t);
|
|
7646
|
-
|
|
7647
|
-
|
|
7648
|
-
|
|
7649
|
-
|
|
7650
|
-
|
|
7651
|
-
const
|
|
7652
|
-
|
|
7776
|
+
this.createMeasurementDisplay(s);
|
|
7777
|
+
const o = s * 100 <= 20 ? 0.125 : 0.5;
|
|
7778
|
+
if (this.unifiedMeasurementPoints.forEach((n) => {
|
|
7779
|
+
n.sphere && n.sphere.scale.setScalar(o);
|
|
7780
|
+
}), this.measurementSprite) {
|
|
7781
|
+
const n = new g.Vector3();
|
|
7782
|
+
n.addVectors(e, t), n.multiplyScalar(0.5);
|
|
7783
|
+
const r = Math.max(0.05, Math.min(0.2, s * 0.03));
|
|
7784
|
+
n.y += r, this.measurementSprite.position.copy(n), this.scene.children.includes(this.measurementSprite) || this.scene.add(this.measurementSprite);
|
|
7785
|
+
const A = this.renderer && this.renderer.xr && this.renderer.xr.isPresenting;
|
|
7786
|
+
this.measurementSprite.visible = A || this.showMeasurementLabels;
|
|
7653
7787
|
}
|
|
7654
7788
|
this.desktopMeasurementMode || (this.desktopMeasurementMode = !0);
|
|
7655
7789
|
}
|
|
@@ -7659,7 +7793,7 @@ class Un {
|
|
|
7659
7793
|
* Useful when VR coordinate systems get corrupted (e.g., returning from Quest browser)
|
|
7660
7794
|
*/
|
|
7661
7795
|
resetGhostSpherePositions() {
|
|
7662
|
-
this.isVR && this.ghostSpheres && (this.ghostSpheres.left && this.controller1 && this.ghostSpheres.left.parent === this.controller1 && (this.ghostSpheres.left.position.set(0, 0, -0.
|
|
7796
|
+
this.isVR && this.ghostSpheres && (this.ghostSpheres.left && this.controller1 && this.ghostSpheres.left.parent === this.controller1 && (this.ghostSpheres.left.position.set(0, 0, -0.07), this.ghostSpheres.left.rotation.set(0, 0, 0), this.ghostSpheres.left.scale.set(1, 1, 1)), this.ghostSpheres.right && this.controller2 && this.ghostSpheres.right.parent === this.controller2 && (this.ghostSpheres.right.position.set(0, 0, -0.07), this.ghostSpheres.right.rotation.set(0, 0, 0), this.ghostSpheres.right.scale.set(1, 1, 1)));
|
|
7663
7797
|
}
|
|
7664
7798
|
/**
|
|
7665
7799
|
* Update method called each frame by the render loop
|
|
@@ -7692,7 +7826,7 @@ class Un {
|
|
|
7692
7826
|
const e = document.createElement("div");
|
|
7693
7827
|
e.className = `measurement-panel${this.theme === "light" ? " light-theme" : ""}`, e.addEventListener("click", () => {
|
|
7694
7828
|
this.renderer && this.renderer.xr && this.renderer.xr.isPresenting ? (this.measurementSystemEnabled = !this.measurementSystemEnabled, this.measurementSystemEnabled ? (this.ghostSpheres.left && (this.ghostSpheres.left.visible = !0), this.ghostSpheres.right && (this.ghostSpheres.right.visible = !0), this.resetGhostSpherePositions()) : (this.clearUnifiedMeasurement(), this.ghostSpheres.left && (this.ghostSpheres.left.visible = !1), this.ghostSpheres.right && (this.ghostSpheres.right.visible = !1)), this.updateMeasurementPanel()) : (this.desktopMeasurementMode = !this.desktopMeasurementMode, this.desktopMeasurementMode || this.clearUnifiedMeasurement(), this.updateMeasurementPanel());
|
|
7695
|
-
}), (this.renderer && this.renderer.domElement && this.renderer.domElement.parentElement || document.body).appendChild(e), this.measurementPanel = e;
|
|
7829
|
+
}), (this.uiParent || this.renderer && this.renderer.domElement && this.renderer.domElement.parentElement || document.body).appendChild(e), this.measurementPanel = e;
|
|
7696
7830
|
}
|
|
7697
7831
|
updateMeasurementPanel() {
|
|
7698
7832
|
const e = this.measurementPanel;
|
|
@@ -7706,7 +7840,7 @@ class Un {
|
|
|
7706
7840
|
`;
|
|
7707
7841
|
else if (s)
|
|
7708
7842
|
e.classList.add("measured"), e.innerHTML = `
|
|
7709
|
-
<div>${
|
|
7843
|
+
<div>${this.formatDistance(n)}</div>
|
|
7710
7844
|
<div style="font-size: 12px; margin-top: 4px;">Click to disable</div>
|
|
7711
7845
|
`;
|
|
7712
7846
|
else {
|
|
@@ -7737,23 +7871,29 @@ class Un {
|
|
|
7737
7871
|
if (this.lastClickTime = t, this.isDragging || !this.desktopMeasurementMode)
|
|
7738
7872
|
return;
|
|
7739
7873
|
this.desktopMeasurementMode && (e.stopPropagation(), e.preventDefault());
|
|
7740
|
-
|
|
7741
|
-
|
|
7742
|
-
|
|
7874
|
+
let s = this.camera, o = !1;
|
|
7875
|
+
if (this.getRaycastInfo) {
|
|
7876
|
+
const a = this.getRaycastInfo(e);
|
|
7877
|
+
a && a.mouse && Number.isFinite(a.mouse.x) && Number.isFinite(a.mouse.y) && (a.mouse.isVector2 ? this.mouse.copy(a.mouse) : (this.mouse.x = a.mouse.x, this.mouse.y = a.mouse.y), a.camera && (s = a.camera), o = !0);
|
|
7878
|
+
}
|
|
7879
|
+
if (!o) {
|
|
7880
|
+
const a = this.renderer.domElement.getBoundingClientRect();
|
|
7881
|
+
this.mouse.x = (e.clientX - a.left) / a.width * 2 - 1, this.mouse.y = -((e.clientY - a.top) / a.height) * 2 + 1;
|
|
7882
|
+
}
|
|
7743
7883
|
if (this.renderer && this.renderer.xr && this.renderer.xr.isPresenting) {
|
|
7744
7884
|
const a = this.renderer.xr.getCamera();
|
|
7745
|
-
a && (
|
|
7885
|
+
a && (s = a);
|
|
7746
7886
|
}
|
|
7747
|
-
if ((!
|
|
7887
|
+
if ((!s || !s.isPerspectiveCamera && !s.isOrthographicCamera) && this.scene && this.scene.children) {
|
|
7748
7888
|
for (const a of this.scene.children)
|
|
7749
7889
|
if (a.isCamera) {
|
|
7750
|
-
|
|
7890
|
+
s = a;
|
|
7751
7891
|
break;
|
|
7752
7892
|
}
|
|
7753
7893
|
}
|
|
7754
|
-
if ((!
|
|
7894
|
+
if ((!s || !s.isPerspectiveCamera && !s.isOrthographicCamera) && typeof window < "u" && window.camera && (window.camera.isPerspectiveCamera || window.camera.isOrthographicCamera) && (s = window.camera), !s || !s.isPerspectiveCamera && !s.isOrthographicCamera && s.type !== "ArrayCamera")
|
|
7755
7895
|
return;
|
|
7756
|
-
this.raycaster.setFromCamera(this.mouse,
|
|
7896
|
+
this.raycaster.setFromCamera(this.mouse, s);
|
|
7757
7897
|
const n = this._raycastTargets && this._raycastTargets.length > 0 ? this._raycastTargets : [];
|
|
7758
7898
|
if (n.length === 0)
|
|
7759
7899
|
return;
|
|
@@ -7761,7 +7901,7 @@ class Un {
|
|
|
7761
7901
|
if (r.length === 0)
|
|
7762
7902
|
return;
|
|
7763
7903
|
const A = r.filter((a) => {
|
|
7764
|
-
const l = this.unifiedMeasurementPoints.some((
|
|
7904
|
+
const l = this.unifiedMeasurementPoints.some((u) => u.sphere === a.object), h = a.object === this.unifiedMeasurementLine, d = this.isMeasurementHelper(a.object);
|
|
7765
7905
|
return !l && !h && !d;
|
|
7766
7906
|
});
|
|
7767
7907
|
if (A.length > 0)
|
|
@@ -7799,7 +7939,7 @@ class Un {
|
|
|
7799
7939
|
if (this.unifiedMeasurementPoints && this.unifiedMeasurementPoints.length === 2) {
|
|
7800
7940
|
const e = this.unifiedMeasurementPoints[0].position, t = this.unifiedMeasurementPoints[1].position, i = e.distanceTo(t);
|
|
7801
7941
|
if (this.createMeasurementDisplay(i), this.measurementSprite) {
|
|
7802
|
-
const s = new
|
|
7942
|
+
const s = new g.Vector3();
|
|
7803
7943
|
s.addVectors(e, t), s.multiplyScalar(0.5);
|
|
7804
7944
|
const o = Math.max(0.05, Math.min(0.2, i * 0.03));
|
|
7805
7945
|
s.y += o, this.measurementSprite.position.copy(s), this.scene.children.includes(this.measurementSprite) || this.scene.add(this.measurementSprite);
|
|
@@ -8104,12 +8244,12 @@ class Rt {
|
|
|
8104
8244
|
class Vn {
|
|
8105
8245
|
constructor(e) {
|
|
8106
8246
|
this.scene = e, this.particleBounds = {
|
|
8107
|
-
min: new
|
|
8108
|
-
max: new
|
|
8247
|
+
min: new g.Vector3(-50, -25, -50),
|
|
8248
|
+
max: new g.Vector3(50, 25, 50)
|
|
8109
8249
|
}, this.particleCount = 1750, this.densityMultiplier = 1, this.createParticleSystem();
|
|
8110
8250
|
}
|
|
8111
8251
|
calculateParticleCount(e) {
|
|
8112
|
-
const t = new
|
|
8252
|
+
const t = new g.Vector3();
|
|
8113
8253
|
e.getSize(t);
|
|
8114
8254
|
const s = t.clone().multiplyScalar(2.5), o = s.x * s.y * s.z, n = Math.round(o * 0.01 * this.densityMultiplier);
|
|
8115
8255
|
return Math.max(100, Math.min(16e3, n));
|
|
@@ -8122,16 +8262,16 @@ class Vn {
|
|
|
8122
8262
|
this.disable();
|
|
8123
8263
|
return;
|
|
8124
8264
|
}
|
|
8125
|
-
const t = new
|
|
8265
|
+
const t = new g.Box3(this.particleBounds.min, this.particleBounds.max), i = this.calculateParticleCount(t);
|
|
8126
8266
|
this.particles && (this.scene.remove(this.particles), this.particles.geometry && this.particles.geometry.dispose(), this.particles.material && this.particles.material.dispose(), this.particles = null), this.particleCount = i, this.createParticleSystem(), this.enable();
|
|
8127
8267
|
}
|
|
8128
8268
|
createParticleSystem() {
|
|
8129
8269
|
const e = new Float32Array(this.particleCount * 3), t = new Float32Array(this.particleCount * 3), i = new Float32Array(this.particleCount);
|
|
8130
8270
|
this.initializeParticleData(e, t, i);
|
|
8131
|
-
const s = new
|
|
8271
|
+
const s = new g.BufferGeometry(), o = new Float32Array(this.particleCount);
|
|
8132
8272
|
for (let n = 0; n < this.particleCount; n++)
|
|
8133
8273
|
o[n] = n;
|
|
8134
|
-
s.setAttribute("position", new
|
|
8274
|
+
s.setAttribute("position", new g.BufferAttribute(e, 3)), s.setAttribute("originalSize", new g.BufferAttribute(i, 1)), s.setAttribute("velocity", new g.BufferAttribute(t, 3)), s.setAttribute("particleIndex", new g.BufferAttribute(o, 1)), this.originalMaterial = this.createParticleMaterial(), this.particles = new g.Points(s, this.originalMaterial), this.particles.visible = !1, this.scene.add(this.particles);
|
|
8135
8275
|
}
|
|
8136
8276
|
/**
|
|
8137
8277
|
* Initialize particle data arrays
|
|
@@ -8154,17 +8294,17 @@ class Vn {
|
|
|
8154
8294
|
e.width = e.height = 32;
|
|
8155
8295
|
const t = e.getContext("2d"), i = t.createRadialGradient(16, 16, 0, 16, 16, 16);
|
|
8156
8296
|
i.addColorStop(0, "rgba(255, 255, 255, 1)"), i.addColorStop(0.7, "rgba(255, 255, 255, 0.8)"), i.addColorStop(1, "rgba(255, 255, 255, 0)"), t.fillStyle = i, t.fillRect(0, 0, 32, 32);
|
|
8157
|
-
const s = new
|
|
8158
|
-
return s.needsUpdate = !0, new
|
|
8297
|
+
const s = new g.CanvasTexture(e);
|
|
8298
|
+
return s.needsUpdate = !0, new g.ShaderMaterial({
|
|
8159
8299
|
uniforms: {
|
|
8160
8300
|
time: { value: 0 },
|
|
8161
8301
|
pointTexture: { value: s },
|
|
8162
|
-
color: { value: new
|
|
8302
|
+
color: { value: new g.Color(16777215) },
|
|
8163
8303
|
opacity: { value: 1 },
|
|
8164
8304
|
size: { value: 2 },
|
|
8165
8305
|
boundsMin: { value: this.particleBounds.min.clone() },
|
|
8166
8306
|
boundsMax: { value: this.particleBounds.max.clone() },
|
|
8167
|
-
fogColor: { value: new
|
|
8307
|
+
fogColor: { value: new g.Color(268073) },
|
|
8168
8308
|
fogDensity: { value: 0 }
|
|
8169
8309
|
},
|
|
8170
8310
|
vertexShader: `
|
|
@@ -8246,7 +8386,7 @@ class Vn {
|
|
|
8246
8386
|
`,
|
|
8247
8387
|
transparent: !0,
|
|
8248
8388
|
depthWrite: !1,
|
|
8249
|
-
blending:
|
|
8389
|
+
blending: g.NormalBlending,
|
|
8250
8390
|
fog: !1
|
|
8251
8391
|
});
|
|
8252
8392
|
}
|
|
@@ -8273,9 +8413,9 @@ class Vn {
|
|
|
8273
8413
|
*/
|
|
8274
8414
|
updateBounds(e) {
|
|
8275
8415
|
if (!e) return;
|
|
8276
|
-
const t = new
|
|
8416
|
+
const t = new g.Box3().setFromObject(e), i = t.getSize(new g.Vector3()), s = t.getCenter(new g.Vector3()), n = i.clone().multiplyScalar(2.5 * 0.5);
|
|
8277
8417
|
this.particleBounds.min.copy(s).sub(n), this.particleBounds.max.copy(s).add(n);
|
|
8278
|
-
const r = this.calculateParticleCount(new
|
|
8418
|
+
const r = this.calculateParticleCount(new g.Box3(this.particleBounds.min, this.particleBounds.max));
|
|
8279
8419
|
Math.abs(r - this.particleCount) > this.particleCount * 0.2 ? (this.particles && (this.scene.remove(this.particles), this.particles.geometry && this.particles.geometry.dispose(), this.particles.material && this.particles.material.dispose(), this.particles = null), this.particleCount = r, this.createParticleSystem()) : this.redistributeParticles();
|
|
8280
8420
|
}
|
|
8281
8421
|
/**
|
|
@@ -8321,7 +8461,7 @@ class On {
|
|
|
8321
8461
|
createSpotlight(e = 25) {
|
|
8322
8462
|
this.controllerSpotlight && (this.scene.remove(this.controllerSpotlight), this.scene.remove(this.spotlightTarget));
|
|
8323
8463
|
const t = e * Math.PI / 180, i = (this.isQuest2, 15);
|
|
8324
|
-
this.controllerSpotlight = new
|
|
8464
|
+
this.controllerSpotlight = new g.SpotLight(
|
|
8325
8465
|
16777215,
|
|
8326
8466
|
// Pure white light
|
|
8327
8467
|
2.5,
|
|
@@ -8336,7 +8476,7 @@ class On {
|
|
|
8336
8476
|
// Higher decay for realistic underwater attenuation
|
|
8337
8477
|
), this.controllerSpotlight.position.set(0, 0, 0), this.controllerSpotlight.visible = !0, this.controllerSpotlight.castShadow = !0;
|
|
8338
8478
|
const s = this.isQuest2 ? 512 : 1024;
|
|
8339
|
-
this.controllerSpotlight.shadow.mapSize.width = s, this.controllerSpotlight.shadow.mapSize.height = s, this.controllerSpotlight.shadow.camera.near = 0.1, this.controllerSpotlight.shadow.camera.far = i, this.controllerSpotlight.shadow.camera.fov = e, this.controllerSpotlight.shadow.bias = -5e-4, this.controllerSpotlight.shadow.normalBias = 0.02, this.controllerSpotlight.shadow.radius = 4, this.controllerSpotlight.shadow.blurSamples = 10, this.scene.add(this.controllerSpotlight), this.spotlightTarget = new
|
|
8479
|
+
this.controllerSpotlight.shadow.mapSize.width = s, this.controllerSpotlight.shadow.mapSize.height = s, this.controllerSpotlight.shadow.camera.near = 0.1, this.controllerSpotlight.shadow.camera.far = i, this.controllerSpotlight.shadow.camera.fov = e, this.controllerSpotlight.shadow.bias = -5e-4, this.controllerSpotlight.shadow.normalBias = 0.02, this.controllerSpotlight.shadow.radius = 4, this.controllerSpotlight.shadow.blurSamples = 10, this.scene.add(this.controllerSpotlight), this.spotlightTarget = new g.Object3D(), this.scene.add(this.spotlightTarget), this.controllerSpotlight.target = this.spotlightTarget;
|
|
8340
8480
|
}
|
|
8341
8481
|
enableTorch() {
|
|
8342
8482
|
this.controllerSpotlight ? this.controllerSpotlight.visible = !0 : console.error("Cannot enable torch - controllerSpotlight is null");
|
|
@@ -8355,9 +8495,9 @@ class On {
|
|
|
8355
8495
|
e || console.warn("updatePosition called with null controller");
|
|
8356
8496
|
return;
|
|
8357
8497
|
}
|
|
8358
|
-
const t = new
|
|
8498
|
+
const t = new g.Vector3(), i = new g.Quaternion();
|
|
8359
8499
|
e.getWorldPosition(t), e.getWorldQuaternion(i), this.controllerSpotlight.position.copy(t);
|
|
8360
|
-
const s = new
|
|
8500
|
+
const s = new g.Vector3(0, 0, -1);
|
|
8361
8501
|
s.applyQuaternion(i);
|
|
8362
8502
|
const o = t.clone().add(s.multiplyScalar(2));
|
|
8363
8503
|
this.spotlightTarget.position.copy(o);
|
|
@@ -8365,7 +8505,7 @@ class On {
|
|
|
8365
8505
|
updateCameraPosition(e) {
|
|
8366
8506
|
if (!this.controllerSpotlight || !this.spotlightTarget) return;
|
|
8367
8507
|
this.controllerSpotlight.position.copy(e.position);
|
|
8368
|
-
const t = new
|
|
8508
|
+
const t = new g.Vector3(0, 0, -1);
|
|
8369
8509
|
t.applyQuaternion(e.quaternion);
|
|
8370
8510
|
const i = e.position.clone().add(t.multiplyScalar(8));
|
|
8371
8511
|
this.spotlightTarget.position.copy(i);
|
|
@@ -8420,7 +8560,7 @@ class Hn {
|
|
|
8420
8560
|
return;
|
|
8421
8561
|
}
|
|
8422
8562
|
try {
|
|
8423
|
-
this.overheadLight = new
|
|
8563
|
+
this.overheadLight = new g.AmbientLight(16777215, 0.5), this.currentMode = null;
|
|
8424
8564
|
} catch (e) {
|
|
8425
8565
|
console.error("Failed to initialize lighting system:", e);
|
|
8426
8566
|
}
|
|
@@ -8428,7 +8568,7 @@ class Hn {
|
|
|
8428
8568
|
createSurveyModeLights() {
|
|
8429
8569
|
if (!(this.isDisposed || !this.scene))
|
|
8430
8570
|
try {
|
|
8431
|
-
this.clearModeDirectionalLight || (this.clearModeDirectionalLight = new
|
|
8571
|
+
this.clearModeDirectionalLight || (this.clearModeDirectionalLight = new g.DirectionalLight(16777215, 1.32), this.clearModeDirectionalLight.position.set(50, 100, 50), this.clearModeDirectionalLight.castShadow = !0, this.clearModeDirectionalLight.shadow.mapSize.width = 2048, this.clearModeDirectionalLight.shadow.mapSize.height = 2048, this.clearModeDirectionalLight.shadow.camera.near = 0.5, this.clearModeDirectionalLight.shadow.camera.far = 500, this.clearModeDirectionalLight.shadow.camera.left = -150, this.clearModeDirectionalLight.shadow.camera.right = 150, this.clearModeDirectionalLight.shadow.camera.top = 150, this.clearModeDirectionalLight.shadow.camera.bottom = -150, this.scene.add(this.clearModeDirectionalLight)), this.clearModeHemisphereLight || (this.clearModeHemisphereLight = new g.HemisphereLight(16777215, 4473924, 0.77), this.scene.add(this.clearModeHemisphereLight)), this.fillLight || (this.fillLight = new g.DirectionalLight(16777215, 0.88), this.fillLight.position.set(-10, 10, -10), this.scene.add(this.fillLight)), this.bottomLight || (this.bottomLight = new g.DirectionalLight(16777215, 0.33), this.bottomLight.position.set(0, -10, 0), this.scene.add(this.bottomLight));
|
|
8432
8572
|
} catch (e) {
|
|
8433
8573
|
console.error("Failed to create survey mode lights:", e);
|
|
8434
8574
|
}
|
|
@@ -8437,7 +8577,7 @@ class Hn {
|
|
|
8437
8577
|
this.overheadLight && this.scene.children.includes(this.overheadLight) && this.scene.remove(this.overheadLight), this.clearModeDirectionalLight && (this.scene.remove(this.clearModeDirectionalLight), this.clearModeDirectionalLight = null), this.clearModeHemisphereLight && (this.scene.remove(this.clearModeHemisphereLight), this.clearModeHemisphereLight = null), this.fillLight && (this.scene.remove(this.fillLight), this.fillLight = null), this.bottomLight && (this.scene.remove(this.bottomLight), this.bottomLight = null), this.currentMode = "dive";
|
|
8438
8578
|
}
|
|
8439
8579
|
enableSurveyMode() {
|
|
8440
|
-
this.overheadLight && !this.scene.children.includes(this.overheadLight) && this.scene.add(this.overheadLight), this.overheadLight && (this.overheadLight.intensity = 0.
|
|
8580
|
+
this.overheadLight && !this.scene.children.includes(this.overheadLight) && this.scene.add(this.overheadLight), this.overheadLight && (this.overheadLight.intensity = 0.66, this.overheadLight.color.setHex(16777215)), this.createSurveyModeLights(), this.currentMode = "survey";
|
|
8441
8581
|
}
|
|
8442
8582
|
setVRDiveMode() {
|
|
8443
8583
|
this.overheadLight && this.scene.children.includes(this.overheadLight) && this.scene.remove(this.overheadLight);
|
|
@@ -8454,24 +8594,24 @@ class Hn {
|
|
|
8454
8594
|
this.pendingAnimations.add(A);
|
|
8455
8595
|
const a = performance.now(), l = i - t;
|
|
8456
8596
|
let h, d;
|
|
8457
|
-
s !== void 0 && o !== void 0 && (h = new
|
|
8458
|
-
const
|
|
8597
|
+
s !== void 0 && o !== void 0 && (h = new g.Color(s), d = new g.Color(o));
|
|
8598
|
+
const u = (p) => {
|
|
8459
8599
|
if (!this.pendingAnimations.has(A) || this.isDisposed) {
|
|
8460
8600
|
r && r();
|
|
8461
8601
|
return;
|
|
8462
8602
|
}
|
|
8463
8603
|
try {
|
|
8464
|
-
const
|
|
8604
|
+
const b = p - a, E = Math.min(b / n, 1), f = 1 - Math.pow(1 - E, 3);
|
|
8465
8605
|
if (!e || this.scene && !this.scene.children.includes(e)) {
|
|
8466
8606
|
this.pendingAnimations.delete(A), r && r();
|
|
8467
8607
|
return;
|
|
8468
8608
|
}
|
|
8469
|
-
e.intensity = t + l * f, h && d && e.color && e.color.lerpColors(h, d, f), E < 1 ? requestAnimationFrame(
|
|
8470
|
-
} catch (
|
|
8471
|
-
console.error("Error in lighting animation:",
|
|
8609
|
+
e.intensity = t + l * f, h && d && e.color && e.color.lerpColors(h, d, f), E < 1 ? requestAnimationFrame(u) : (this.pendingAnimations.delete(A), r && r());
|
|
8610
|
+
} catch (b) {
|
|
8611
|
+
console.error("Error in lighting animation:", b), this.pendingAnimations.delete(A), r && r();
|
|
8472
8612
|
}
|
|
8473
8613
|
};
|
|
8474
|
-
requestAnimationFrame(
|
|
8614
|
+
requestAnimationFrame(u);
|
|
8475
8615
|
}
|
|
8476
8616
|
cancelActiveAnimations() {
|
|
8477
8617
|
this.pendingAnimations.clear();
|
|
@@ -8492,7 +8632,7 @@ class Hn {
|
|
|
8492
8632
|
}
|
|
8493
8633
|
setSurveyBrightness(e = 1) {
|
|
8494
8634
|
const t = Math.max(0.5, Math.min(5, e));
|
|
8495
|
-
this.overheadLight && (this.overheadLight.intensity = 0.
|
|
8635
|
+
this.overheadLight && (this.overheadLight.intensity = 0.66 * t), this.clearModeDirectionalLight && (this.clearModeDirectionalLight.intensity = 1.32 * t), this.clearModeHemisphereLight && (this.clearModeHemisphereLight.intensity = 0.77 * t), this.fillLight && (this.fillLight.intensity = 0.88 * t), this.bottomLight && (this.bottomLight.intensity = 0.33 * t);
|
|
8496
8636
|
}
|
|
8497
8637
|
dispose() {
|
|
8498
8638
|
this.isDisposed = !0, this.cancelActiveAnimations(), requestAnimationFrame(() => {
|
|
@@ -8506,7 +8646,7 @@ class Hn {
|
|
|
8506
8646
|
}
|
|
8507
8647
|
class qn {
|
|
8508
8648
|
constructor(e, t, i) {
|
|
8509
|
-
this.scene = e, this.renderer = t, this.camera = i, this.isDiveModeEnabled = !1, this.currentVRMode = null, this.lighting = new Hn(e), this.particles = new Vn(e), this.torch = new On(e), this.isQuest2 = !1, this.isQuest3 = !1, this.detectQuestDevice(), this.applyModeSettings();
|
|
8649
|
+
this.scene = e, this.renderer = t, this.camera = i, this.isDiveModeEnabled = !1, this.currentVRMode = null, this.lighting = new Hn(e), this.particles = new Vn(e), this.torch = new On(e), this.isQuest2 = !1, this.isQuest3 = !1, this._fallbackHandedness = /* @__PURE__ */ new Map(), this.detectQuestDevice(), this.applyModeSettings();
|
|
8510
8650
|
}
|
|
8511
8651
|
/**
|
|
8512
8652
|
* Toggle between dive and survey modes
|
|
@@ -8534,7 +8674,7 @@ class qn {
|
|
|
8534
8674
|
* Apply Quest-specific optimizations
|
|
8535
8675
|
*/
|
|
8536
8676
|
applyQuestOptimizations() {
|
|
8537
|
-
this.isQuest2 ? (this.camera.far = 20, this.camera.updateProjectionMatrix(), this.isDiveModeEnabled && (this.scene.fog = new
|
|
8677
|
+
this.isQuest2 ? (this.camera.far = 20, this.camera.updateProjectionMatrix(), this.isDiveModeEnabled && (this.scene.fog = new g.FogExp2(268073, 0.084))) : (this.camera.far = 2e3, this.camera.updateProjectionMatrix(), this.isDiveModeEnabled && (this.scene.fog = new g.FogExp2(268073, 0.056)));
|
|
8538
8678
|
}
|
|
8539
8679
|
/**
|
|
8540
8680
|
* Apply mode-specific settings for VR vs Desktop
|
|
@@ -8546,7 +8686,7 @@ class qn {
|
|
|
8546
8686
|
this.scene.fog = null;
|
|
8547
8687
|
return;
|
|
8548
8688
|
}
|
|
8549
|
-
e ? (this.scene.fog = new
|
|
8689
|
+
e ? (this.scene.fog = new g.FogExp2(268073, 0.056), this.lighting.setVRDiveMode(), this.isDiveModeEnabled && this.torch.enableTorch()) : (this.scene.fog = new g.FogExp2(268073, 5e-3), this.lighting.setDesktopDiveMode()), this.particles.updateFog(this.scene.fog);
|
|
8550
8690
|
}
|
|
8551
8691
|
}
|
|
8552
8692
|
/**
|
|
@@ -8644,22 +8784,45 @@ class qn {
|
|
|
8644
8784
|
*/
|
|
8645
8785
|
checkVRControllerButtons(e) {
|
|
8646
8786
|
if (!e || !e.xr) return;
|
|
8647
|
-
const t = e.xr.getSession();
|
|
8648
|
-
if (
|
|
8649
|
-
for (const
|
|
8650
|
-
if (
|
|
8651
|
-
const
|
|
8652
|
-
[4, 5].forEach((
|
|
8653
|
-
if (
|
|
8654
|
-
const
|
|
8787
|
+
const t = e.xr.getSession && e.xr.getSession(), i = t && t.inputSources ? Array.from(t.inputSources) : this._getFallbackInputSources();
|
|
8788
|
+
if (!(!i || i.length === 0)) {
|
|
8789
|
+
for (const s of i)
|
|
8790
|
+
if (s.gamepad && s.handedness) {
|
|
8791
|
+
const o = s.gamepad, n = s.handedness;
|
|
8792
|
+
[4, 5].forEach((A) => {
|
|
8793
|
+
if (o.buttons[A]) {
|
|
8794
|
+
const a = o.buttons[A], l = `${n}-${A}`;
|
|
8655
8795
|
this.buttonStates || (this.buttonStates = /* @__PURE__ */ new Map());
|
|
8656
|
-
const
|
|
8657
|
-
|
|
8796
|
+
const h = this.buttonStates.get(l) || !1, d = a.pressed;
|
|
8797
|
+
d && !h && this.toggleDiveMode(), this.buttonStates.set(l, d);
|
|
8658
8798
|
}
|
|
8659
8799
|
});
|
|
8660
8800
|
}
|
|
8661
8801
|
}
|
|
8662
8802
|
}
|
|
8803
|
+
_getFallbackInputSources() {
|
|
8804
|
+
if (typeof navigator > "u" || !navigator.getGamepads) return [];
|
|
8805
|
+
const e = navigator.getGamepads();
|
|
8806
|
+
if (!e) return [];
|
|
8807
|
+
const t = [];
|
|
8808
|
+
let i = 0;
|
|
8809
|
+
for (const s of e) {
|
|
8810
|
+
if (!s || !s.buttons) continue;
|
|
8811
|
+
const o = this._resolveHandedness(s, i);
|
|
8812
|
+
if (!o) {
|
|
8813
|
+
i += 1;
|
|
8814
|
+
continue;
|
|
8815
|
+
}
|
|
8816
|
+
t.push({ gamepad: s, handedness: o }), i += 1;
|
|
8817
|
+
}
|
|
8818
|
+
return t;
|
|
8819
|
+
}
|
|
8820
|
+
_resolveHandedness(e, t) {
|
|
8821
|
+
const i = (e.hand || "").toLowerCase();
|
|
8822
|
+
if (i === "left" || i === "right") return i;
|
|
8823
|
+
const s = (e.id || "").toLowerCase();
|
|
8824
|
+
return s.includes("left") ? "left" : s.includes("right") ? "right" : this._fallbackHandedness.has(e.index) ? this._fallbackHandedness.get(e.index) : t === 0 ? (this._fallbackHandedness.set(e.index, "left"), "left") : t === 1 ? (this._fallbackHandedness.set(e.index, "right"), "right") : null;
|
|
8825
|
+
}
|
|
8663
8826
|
/**
|
|
8664
8827
|
* Dispose of all resources
|
|
8665
8828
|
*/
|
|
@@ -8667,7 +8830,115 @@ class qn {
|
|
|
8667
8830
|
this.lighting.dispose(), this.particles.dispose(), this.torch.dispose();
|
|
8668
8831
|
}
|
|
8669
8832
|
}
|
|
8670
|
-
class
|
|
8833
|
+
class jn extends Te {
|
|
8834
|
+
/**
|
|
8835
|
+
* @param {Object} options
|
|
8836
|
+
* @param {HTMLElement} options.domElement - Element used for pointer lock
|
|
8837
|
+
* @param {THREE.PerspectiveCamera} options.camera - Camera to control
|
|
8838
|
+
* @param {Object} options.controls - OrbitControls instance
|
|
8839
|
+
* @param {THREE.WebGLRenderer} [options.renderer] - Renderer (for XR checks)
|
|
8840
|
+
* @param {boolean} [options.enabled=true] - Enable fly controls
|
|
8841
|
+
* @param {number} [options.baseSpeed=6] - Base movement speed
|
|
8842
|
+
* @param {number} [options.boostSpeed=20] - Boosted speed (shift held)
|
|
8843
|
+
* @param {number} [options.speedScale=100] - Reference size for scaling speed
|
|
8844
|
+
* @param {number} [options.mouseSensitivity=0.002] - Mouse sensitivity
|
|
8845
|
+
* @param {boolean} [options.clickToExit=true] - Exit fly mode on click
|
|
8846
|
+
*/
|
|
8847
|
+
constructor(e = {}) {
|
|
8848
|
+
super(), this.domElement = e.domElement || null, this.camera = e.camera || null, this.controls = e.controls || null, this.renderer = e.renderer || null, this.enabled = e.enabled ?? !0, this.baseSpeed = e.baseSpeed ?? 6, this.boostSpeed = e.boostSpeed ?? 20, this.speedScale = e.speedScale ?? 100, this.mouseSensitivity = e.mouseSensitivity ?? 2e-3, this.clickToExit = e.clickToExit ?? !0, this.pointerLocked = !1, this.modelSize = this.speedScale, this.cameraYaw = 0, this.cameraPitch = 0, this.keys = {
|
|
8849
|
+
w: !1,
|
|
8850
|
+
a: !1,
|
|
8851
|
+
s: !1,
|
|
8852
|
+
d: !1,
|
|
8853
|
+
q: !1,
|
|
8854
|
+
e: !1,
|
|
8855
|
+
shift: !1
|
|
8856
|
+
}, this._controlsEnabledBefore = !0, this._onKeyDown = this._onKeyDown.bind(this), this._onKeyUp = this._onKeyUp.bind(this), this._onMouseMove = this._onMouseMove.bind(this), this._onPointerLockChange = this._onPointerLockChange.bind(this), this._onClick = this._onClick.bind(this), this.attach();
|
|
8857
|
+
}
|
|
8858
|
+
attach() {
|
|
8859
|
+
!this.domElement || typeof document > "u" || (document.addEventListener("keydown", this._onKeyDown), document.addEventListener("keyup", this._onKeyUp), document.addEventListener("mousemove", this._onMouseMove), document.addEventListener("pointerlockchange", this._onPointerLockChange), this.clickToExit && this.domElement.addEventListener("click", this._onClick));
|
|
8860
|
+
}
|
|
8861
|
+
dispose() {
|
|
8862
|
+
document.removeEventListener("keydown", this._onKeyDown), document.removeEventListener("keyup", this._onKeyUp), document.removeEventListener("mousemove", this._onMouseMove), document.removeEventListener("pointerlockchange", this._onPointerLockChange), this.domElement && this.clickToExit && this.domElement.removeEventListener("click", this._onClick), this.exitFlyMode();
|
|
8863
|
+
}
|
|
8864
|
+
setEnabled(e) {
|
|
8865
|
+
this.enabled = !!e, this.enabled || this.exitFlyMode();
|
|
8866
|
+
}
|
|
8867
|
+
isActive() {
|
|
8868
|
+
return this.pointerLocked;
|
|
8869
|
+
}
|
|
8870
|
+
enterFlyMode() {
|
|
8871
|
+
!this.enabled || !this.domElement || document.pointerLockElement !== this.domElement && this.domElement.requestPointerLock();
|
|
8872
|
+
}
|
|
8873
|
+
exitFlyMode() {
|
|
8874
|
+
typeof document > "u" || document.pointerLockElement === this.domElement && document.exitPointerLock();
|
|
8875
|
+
}
|
|
8876
|
+
toggleFlyMode() {
|
|
8877
|
+
this.pointerLocked ? this.exitFlyMode() : this.enterFlyMode();
|
|
8878
|
+
}
|
|
8879
|
+
setModelSizeFromObject(e) {
|
|
8880
|
+
if (!e) return;
|
|
8881
|
+
const t = new g.Box3().setFromObject(e);
|
|
8882
|
+
if (t.isEmpty()) return;
|
|
8883
|
+
const i = t.getSize(new g.Vector3()), s = Math.max(i.x, i.y, i.z);
|
|
8884
|
+
s > 0 && Number.isFinite(s) && (this.modelSize = Math.max(1, Math.min(1e4, s)));
|
|
8885
|
+
}
|
|
8886
|
+
update(e) {
|
|
8887
|
+
if (!this.enabled || !this.pointerLocked) return;
|
|
8888
|
+
if (this.renderer?.xr?.isPresenting) {
|
|
8889
|
+
this.exitFlyMode();
|
|
8890
|
+
return;
|
|
8891
|
+
}
|
|
8892
|
+
if (!this.camera) return;
|
|
8893
|
+
const t = this.modelSize / this.speedScale, s = (this.keys.shift ? this.boostSpeed : this.baseSpeed) * t, o = new g.Vector3();
|
|
8894
|
+
this.keys.w && (o.z -= 1), this.keys.s && (o.z += 1), this.keys.a && (o.x -= 1), this.keys.d && (o.x += 1), this.keys.q && (o.y -= 1), this.keys.e && (o.y += 1), o.lengthSq() > 0 && (o.normalize(), o.applyQuaternion(this.camera.quaternion), this.camera.position.addScaledVector(o, s * e), this._syncControlsTarget());
|
|
8895
|
+
}
|
|
8896
|
+
_syncControlsTarget() {
|
|
8897
|
+
if (!this.controls || !this.camera) return;
|
|
8898
|
+
const e = new g.Vector3(0, 0, -5).applyQuaternion(this.camera.quaternion);
|
|
8899
|
+
this.controls.target.copy(this.camera.position).add(e);
|
|
8900
|
+
}
|
|
8901
|
+
_onKeyDown(e) {
|
|
8902
|
+
if (!this.enabled) return;
|
|
8903
|
+
const t = e.target;
|
|
8904
|
+
if (t instanceof HTMLElement) {
|
|
8905
|
+
const s = t.tagName;
|
|
8906
|
+
if (s === "INPUT" || s === "SELECT" || s === "TEXTAREA" || t.isContentEditable)
|
|
8907
|
+
return;
|
|
8908
|
+
}
|
|
8909
|
+
const i = e.key.toLowerCase();
|
|
8910
|
+
if (i in this.keys && (this.keys[i] = !0), e.shiftKey && (this.keys.shift = !0), e.shiftKey && (e.key === "`" || e.key === "~" || e.code === "Backquote")) {
|
|
8911
|
+
e.preventDefault(), this.pointerLocked || this.enterFlyMode();
|
|
8912
|
+
return;
|
|
8913
|
+
}
|
|
8914
|
+
(e.code === "KeyF" || i === "f") && (e.preventDefault(), this.toggleFlyMode());
|
|
8915
|
+
}
|
|
8916
|
+
_onKeyUp(e) {
|
|
8917
|
+
const t = e.key.toLowerCase();
|
|
8918
|
+
t in this.keys && (this.keys[t] = !1), e.shiftKey || (this.keys.shift = !1);
|
|
8919
|
+
}
|
|
8920
|
+
_onMouseMove(e) {
|
|
8921
|
+
if (!this.pointerLocked || !this.camera) return;
|
|
8922
|
+
this.cameraYaw -= e.movementX * this.mouseSensitivity, this.cameraPitch -= e.movementY * this.mouseSensitivity, this.cameraPitch = Math.max(
|
|
8923
|
+
-Math.PI / 2 + 0.01,
|
|
8924
|
+
Math.min(Math.PI / 2 - 0.01, this.cameraPitch)
|
|
8925
|
+
);
|
|
8926
|
+
const t = new g.Euler(this.cameraPitch, this.cameraYaw, 0, "YXZ");
|
|
8927
|
+
this.camera.quaternion.setFromEuler(t), this._syncControlsTarget();
|
|
8928
|
+
}
|
|
8929
|
+
_onPointerLockChange() {
|
|
8930
|
+
const e = this.pointerLocked;
|
|
8931
|
+
if (this.pointerLocked = document.pointerLockElement === this.domElement, this.pointerLocked && !e && this.camera) {
|
|
8932
|
+
const t = new g.Euler().setFromQuaternion(this.camera.quaternion, "YXZ");
|
|
8933
|
+
this.cameraYaw = t.y, this.cameraPitch = t.x;
|
|
8934
|
+
}
|
|
8935
|
+
this.controls && (this.pointerLocked ? (this._controlsEnabledBefore = this.controls.enabled, this.controls.enabled = !1) : this.controls.enabled = this._controlsEnabledBefore), this.emit("fly-mode-change", { active: this.pointerLocked });
|
|
8936
|
+
}
|
|
8937
|
+
_onClick() {
|
|
8938
|
+
this.pointerLocked && this.exitFlyMode();
|
|
8939
|
+
}
|
|
8940
|
+
}
|
|
8941
|
+
class zn extends Te {
|
|
8671
8942
|
/**
|
|
8672
8943
|
* Creates a new ModelViewer instance
|
|
8673
8944
|
*
|
|
@@ -8692,6 +8963,8 @@ class Kn extends je {
|
|
|
8692
8963
|
showDiveToggle: { type: "boolean", default: !0 },
|
|
8693
8964
|
enableFullscreen: { type: "boolean", default: !1 },
|
|
8694
8965
|
enableScreenshot: { type: "boolean", default: !1 },
|
|
8966
|
+
enableFlyControls: { type: "boolean", default: !0 },
|
|
8967
|
+
flyControls: { type: "object", default: {} },
|
|
8695
8968
|
enableVRAudio: { type: "boolean", default: !1 },
|
|
8696
8969
|
audioPath: { type: "string", default: "./sound/" },
|
|
8697
8970
|
viewerConfig: {
|
|
@@ -8705,7 +8978,7 @@ class Kn extends je {
|
|
|
8705
8978
|
initialModel: { type: "string", default: null },
|
|
8706
8979
|
initialPositions: { type: "object", default: null }
|
|
8707
8980
|
};
|
|
8708
|
-
this.config = new Ke(i).validate(t), this.options = this.config, this.currentModelKey = null, this.belowViewer = null, this.ui = {}, this.measurementSystem = null, this.comfortGlyph = null, this.diveSystem = null, this.fullscreenButton = null, this.screenshotButton = null, this.lastComfortMode = null, this.isLoading = !1, this.loadingMessage = "", this.loadingModelName = "", this.loadingPercentage = 0, this.lastManualLoadingMessage = "", this.stageOverrideActive = !1, this.vrUpdateLoop = null, typeof window < "u" && (window.modelViewer = this), this.init();
|
|
8981
|
+
this.config = new Ke(i).validate(t), this.options = this.config, this.currentModelKey = null, this.belowViewer = null, this.ui = {}, this.uiRoot = null, this.stereoUiMirror = null, this.stereoUiObserver = null, this.stereoUiSyncQueued = !1, this.stereoUiActive = !1, this.measurementSystem = null, this.comfortGlyph = null, this.diveSystem = null, this.fullscreenButton = null, this.screenshotButton = null, this.flyControls = null, this.lastComfortMode = null, this._vrButtonWasVisible = !1, this.isLoading = !1, this.loadingMessage = "", this.loadingModelName = "", this.loadingPercentage = 0, this.lastManualLoadingMessage = "", this.stageOverrideActive = !1, this.vrUpdateLoop = null, typeof window < "u" && (window.modelViewer = this), this.init();
|
|
8709
8982
|
}
|
|
8710
8983
|
init() {
|
|
8711
8984
|
const e = {
|
|
@@ -8720,8 +8993,8 @@ class Kn extends je {
|
|
|
8720
8993
|
...typeof this.config.enableVRAudio < "u" && { enableVRAudio: this.config.enableVRAudio }
|
|
8721
8994
|
};
|
|
8722
8995
|
if (this.belowViewer = new _n(this.container, e), this.setupEventForwarding(), this.belowViewer.on("initialized", () => {
|
|
8723
|
-
this.setupFocusInteraction(), this._maybeAttachMeasurementSystem(), this._maybeAttachVRComfortGlyph(), this._maybeAttachDiveSystem(), this._maybeAttachScreenshotButton(), this._maybeAttachFullscreenButton();
|
|
8724
|
-
}), this.belowViewer.isInitialized && (this.setupFocusInteraction(), this._maybeAttachMeasurementSystem(), this._maybeAttachVRComfortGlyph(), this._maybeAttachDiveSystem(), this._maybeAttachScreenshotButton(), this._maybeAttachFullscreenButton()), Object.keys(this.config.models).length > 0 && (this.createUI(), this.populateDropdown(), this.config.autoLoadFirst)) {
|
|
8996
|
+
this.setupFocusInteraction(), this._maybeAttachMeasurementSystem(), this._maybeAttachVRComfortGlyph(), this._maybeAttachDiveSystem(), this._maybeAttachScreenshotButton(), this._maybeAttachFullscreenButton(), this._maybeAttachFlyControls();
|
|
8997
|
+
}), this.belowViewer.isInitialized && (this.setupFocusInteraction(), this._maybeAttachMeasurementSystem(), this._maybeAttachVRComfortGlyph(), this._maybeAttachDiveSystem(), this._maybeAttachScreenshotButton(), this._maybeAttachFullscreenButton(), this._maybeAttachFlyControls()), Object.keys(this.config.models).length > 0 && (this.createUI(), this.populateDropdown(), this.config.autoLoadFirst)) {
|
|
8725
8998
|
const t = Object.keys(this.config.models)[0];
|
|
8726
8999
|
setTimeout(() => this.loadModel(t), 100);
|
|
8727
9000
|
}
|
|
@@ -8733,6 +9006,8 @@ class Kn extends je {
|
|
|
8733
9006
|
camera: this.belowViewer.cameraManager.camera,
|
|
8734
9007
|
renderer: this.belowViewer.renderer,
|
|
8735
9008
|
controls: this.belowViewer.cameraManager.controls,
|
|
9009
|
+
uiParent: this.getUiContainer(),
|
|
9010
|
+
getRaycastInfo: (t) => this.getPointerRaycastInfo(t),
|
|
8736
9011
|
theme: this.config.measurementTheme,
|
|
8737
9012
|
showMeasurementLabels: this.config.showMeasurementLabels
|
|
8738
9013
|
});
|
|
@@ -8781,7 +9056,9 @@ class Kn extends je {
|
|
|
8781
9056
|
this.belowViewer.cameraManager.camera
|
|
8782
9057
|
), setTimeout(() => {
|
|
8783
9058
|
this.diveSystem.initializeToggleSwitch();
|
|
8784
|
-
}, 100)
|
|
9059
|
+
}, 100), document.addEventListener("keydown", (t) => {
|
|
9060
|
+
t.code === "KeyZ" && !t.ctrlKey && !t.metaKey && !t.altKey && (t.preventDefault(), this.diveSystem && this.diveSystem.toggleDiveMode()), t.code === "KeyH" && !t.ctrlKey && !t.metaKey && !t.altKey && (t.preventDefault(), this.takeScreenshot());
|
|
9061
|
+
});
|
|
8785
9062
|
const e = (t) => {
|
|
8786
9063
|
if (this.diveSystem) {
|
|
8787
9064
|
const i = performance.now();
|
|
@@ -8800,14 +9077,54 @@ class Kn extends je {
|
|
|
8800
9077
|
<circle cx="12" cy="13" r="4"></circle>
|
|
8801
9078
|
</svg>`, e.tabIndex = 0, e.title = "Save Screenshot", e.setAttribute("aria-label", "Save Screenshot"), e.addEventListener("click", () => this.takeScreenshot()), e.addEventListener("keydown", (t) => {
|
|
8802
9079
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.takeScreenshot());
|
|
8803
|
-
}), this.
|
|
9080
|
+
}), this.getUiContainer().appendChild(e), this.screenshotButton = e, this.ui.screenshot = e;
|
|
8804
9081
|
}
|
|
8805
9082
|
_maybeAttachFullscreenButton() {
|
|
8806
9083
|
if (!this.config.enableFullscreen || this.fullscreenButton) return;
|
|
8807
9084
|
const e = document.createElement("div");
|
|
8808
9085
|
e.id = "fullscreenButton", e.className = "fullscreen-button", this.config.measurementTheme === "light" && e.classList.add("light-theme"), this.config.enableMeasurement || e.classList.add("no-measurement"), e.textContent = "⛶", e.tabIndex = 0, e.title = "Enter Fullscreen", e.setAttribute("aria-label", "Enter Fullscreen"), e.addEventListener("click", () => this.toggleFullscreen()), e.addEventListener("keydown", (t) => {
|
|
8809
9086
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.toggleFullscreen());
|
|
8810
|
-
}), this.
|
|
9087
|
+
}), this.getUiContainer().appendChild(e), this.fullscreenButton = e, this.ui.fullscreen = e, this._onFullscreenChange = () => this.updateFullscreenButton(), document.addEventListener("fullscreenchange", this._onFullscreenChange), this.updateFullscreenButton();
|
|
9088
|
+
}
|
|
9089
|
+
_maybeAttachFlyControls() {
|
|
9090
|
+
if (!this.config.enableFlyControls || this.flyControls || !this.belowViewer?.cameraManager || !this.belowViewer?.renderer) return;
|
|
9091
|
+
this.flyControls = new jn({
|
|
9092
|
+
domElement: this.belowViewer.renderer.domElement,
|
|
9093
|
+
camera: this.belowViewer.cameraManager.camera,
|
|
9094
|
+
controls: this.belowViewer.cameraManager.controls,
|
|
9095
|
+
renderer: this.belowViewer.renderer,
|
|
9096
|
+
...this.config.flyControls
|
|
9097
|
+
}), this._ensureFlyModeIndicator(), this.flyControls.on("fly-mode-change", (t) => {
|
|
9098
|
+
this.emit("fly-mode-change", t), this.ui.flyIndicator && this.ui.flyIndicator.classList.toggle("visible", t.active), this._handleVRButtonVisibility(t.active);
|
|
9099
|
+
});
|
|
9100
|
+
const e = (t) => {
|
|
9101
|
+
this.flyControls && this.flyControls.update(t);
|
|
9102
|
+
};
|
|
9103
|
+
this.belowViewer.onAfterRender ? this.belowViewer.onAfterRender(e) : this.belowViewer.on("before-render", e);
|
|
9104
|
+
}
|
|
9105
|
+
_ensureFlyModeIndicator() {
|
|
9106
|
+
if (this.ui.flyIndicator || typeof document > "u") return;
|
|
9107
|
+
const e = document.getElementById("flyModeIndicator");
|
|
9108
|
+
if (e) {
|
|
9109
|
+
this.ui.flyIndicator = e;
|
|
9110
|
+
return;
|
|
9111
|
+
}
|
|
9112
|
+
const t = document.createElement("div");
|
|
9113
|
+
t.className = "fly-mode-indicator";
|
|
9114
|
+
const i = this.flyControls?.clickToExit ? "Click to exit or press Esc" : "Press Esc to exit";
|
|
9115
|
+
t.innerHTML = `
|
|
9116
|
+
<div class="crosshair"></div>
|
|
9117
|
+
<div class="hint">
|
|
9118
|
+
<kbd>W</kbd><kbd>A</kbd><kbd>S</kbd><kbd>D</kbd> Move
|
|
9119
|
+
<kbd>Q</kbd><kbd>E</kbd> Up/Down
|
|
9120
|
+
<kbd>Shift</kbd> Fast<br>
|
|
9121
|
+
<span class="fly-exit">${i}</span>
|
|
9122
|
+
</div>
|
|
9123
|
+
`, this.container.appendChild(t), this.ui.flyIndicator = t;
|
|
9124
|
+
}
|
|
9125
|
+
_handleVRButtonVisibility(e) {
|
|
9126
|
+
const t = this.belowViewer?.vrManager?.vrCore?.vrButton;
|
|
9127
|
+
t && (e ? window.getComputedStyle(t).visibility !== "hidden" && (this._vrButtonWasVisible = !0, t.style.setProperty("visibility", "hidden", "important"), t.style.setProperty("opacity", "0", "important"), t.style.setProperty("pointer-events", "none", "important")) : this._vrButtonWasVisible && (t.style.setProperty("visibility", "visible", "important"), t.style.setProperty("opacity", "1", "important"), t.style.setProperty("pointer-events", "auto", "important"), this._vrButtonWasVisible = !1));
|
|
8811
9128
|
}
|
|
8812
9129
|
toggleFullscreen() {
|
|
8813
9130
|
if (this.isFullscreen()) {
|
|
@@ -8881,7 +9198,7 @@ class Kn extends je {
|
|
|
8881
9198
|
}), this.belowViewer.on("vr-movement-start", (e) => this.emit("vr-movement-start", e)), this.belowViewer.on("vr-movement-stop", (e) => this.emit("vr-movement-stop", e)), this.belowViewer.on("vr-movement-update", (e) => this.emit("vr-movement-update", e));
|
|
8882
9199
|
}
|
|
8883
9200
|
onVRSessionStart() {
|
|
8884
|
-
if (this.ui.info && (this.ui.info.style.display = "none"), this.ui.selector && (this.ui.selector.style.pointerEvents = "none", this.ui.selector.style.opacity = "0.5"), this.isLoading && this.updateVRLoadingIndicator(), !this.vrUpdateLoop) {
|
|
9201
|
+
if (this.flyControls && this.flyControls.exitFlyMode(), this.ui.info && (this.ui.info.style.display = "none"), this.ui.selector && (this.ui.selector.style.pointerEvents = "none", this.ui.selector.style.opacity = "0.5"), this.isLoading && this.updateVRLoadingIndicator(), !this.vrUpdateLoop) {
|
|
8885
9202
|
let e = 0;
|
|
8886
9203
|
const t = (i) => {
|
|
8887
9204
|
this.belowViewer && this.belowViewer.renderer && this.belowViewer.renderer.xr && this.belowViewer.renderer.xr.isPresenting ? (i - e > 100 && (this.vrLoadingSprite && this.belowViewer.sceneManager.scene.children.includes(this.vrLoadingSprite) && this.isLoading && this.positionVRLoadingSprite(), e = i), this.vrUpdateLoop = requestAnimationFrame(t)) : this.vrUpdateLoop = null;
|
|
@@ -8908,16 +9225,16 @@ class Kn extends je {
|
|
|
8908
9225
|
s = !1, o.x = h.clientX, o.y = h.clientY;
|
|
8909
9226
|
}, A = (h) => {
|
|
8910
9227
|
if (!s) {
|
|
8911
|
-
const d = Math.abs(h.clientX - o.x),
|
|
8912
|
-
(d > n ||
|
|
9228
|
+
const d = Math.abs(h.clientX - o.x), u = Math.abs(h.clientY - o.y);
|
|
9229
|
+
(d > n || u > n) && (s = !0);
|
|
8913
9230
|
}
|
|
8914
9231
|
}, a = () => {
|
|
8915
9232
|
setTimeout(() => {
|
|
8916
9233
|
s = !1;
|
|
8917
9234
|
}, 10);
|
|
8918
9235
|
}, l = (h) => {
|
|
8919
|
-
const d = Date.now(),
|
|
8920
|
-
i = d, !(this.belowViewer.renderer.xr?.isPresenting || s) &&
|
|
9236
|
+
const d = Date.now(), u = d - i < t;
|
|
9237
|
+
i = d, !(this.belowViewer.renderer.xr?.isPresenting || s) && u && this.focusOnPoint(h);
|
|
8921
9238
|
};
|
|
8922
9239
|
e.addEventListener("mousedown", r), e.addEventListener("mousemove", A), e.addEventListener("mouseup", a), e.addEventListener("click", l), this.focusEventHandlers = {
|
|
8923
9240
|
onMouseDown: r,
|
|
@@ -8926,27 +9243,48 @@ class Kn extends je {
|
|
|
8926
9243
|
onMouseClick: l
|
|
8927
9244
|
};
|
|
8928
9245
|
}
|
|
9246
|
+
getPointerRaycastInfo(e) {
|
|
9247
|
+
if (!e || typeof e.clientX != "number" || typeof e.clientY != "number" || !this.belowViewer || !this.belowViewer.renderer || !this.belowViewer.cameraManager || this.belowViewer.renderer.xr?.isPresenting)
|
|
9248
|
+
return null;
|
|
9249
|
+
const i = this.belowViewer.renderer.domElement.getBoundingClientRect();
|
|
9250
|
+
if (!i.width || !i.height)
|
|
9251
|
+
return null;
|
|
9252
|
+
const s = e.clientX - i.left, o = e.clientY - i.top;
|
|
9253
|
+
if (!Number.isFinite(s) || !Number.isFinite(o))
|
|
9254
|
+
return null;
|
|
9255
|
+
const n = this.belowViewer.cameraManager.getCamera();
|
|
9256
|
+
let r = n, A = s / i.width * 2 - 1;
|
|
9257
|
+
const a = -(o / i.height * 2 - 1), l = this.belowViewer.getStereoSettings?.();
|
|
9258
|
+
if (l?.enabled === !0 && l?.mode === "sbs" && this.belowViewer.stereoCamera) {
|
|
9259
|
+
const h = this.belowViewer.stereoCamera, d = i.width / 2, u = s <= d, p = u ? d : i.width - d, b = u ? s : s - d;
|
|
9260
|
+
p > 0 && (A = b / p * 2 - 1), h.aspect = i.height > 0 ? d / i.height : 1, h.update(n), r = u ? h.cameraL : h.cameraR;
|
|
9261
|
+
}
|
|
9262
|
+
return {
|
|
9263
|
+
mouse: { x: A, y: a },
|
|
9264
|
+
camera: r
|
|
9265
|
+
};
|
|
9266
|
+
}
|
|
8929
9267
|
focusOnPoint(e) {
|
|
8930
|
-
const
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
|
|
8934
|
-
o.setFromCamera(
|
|
8935
|
-
let
|
|
9268
|
+
const t = this.getPointerRaycastInfo(e), i = t?.mouse, s = t?.camera;
|
|
9269
|
+
if (!i || !s)
|
|
9270
|
+
return;
|
|
9271
|
+
const o = new g.Raycaster();
|
|
9272
|
+
o.setFromCamera(i, s);
|
|
9273
|
+
let n = [];
|
|
8936
9274
|
if (this.measurementSystem && this.measurementSystem._raycastTargets && this.measurementSystem._raycastTargets.length > 0)
|
|
8937
|
-
|
|
9275
|
+
n = this.measurementSystem._raycastTargets;
|
|
8938
9276
|
else {
|
|
8939
|
-
const
|
|
8940
|
-
|
|
8941
|
-
|
|
9277
|
+
const A = this.belowViewer.sceneManager.getScene();
|
|
9278
|
+
n = [], A.traverse((a) => {
|
|
9279
|
+
a.isMesh && a.geometry && !this.isMeasurementHelper(a) && n.push(a);
|
|
8942
9280
|
});
|
|
8943
9281
|
}
|
|
8944
|
-
if (
|
|
9282
|
+
if (n.length === 0)
|
|
8945
9283
|
return;
|
|
8946
|
-
const
|
|
8947
|
-
if (
|
|
8948
|
-
const
|
|
8949
|
-
this.belowViewer.cameraManager.focusOn(
|
|
9284
|
+
const r = o.intersectObjects(n, !0);
|
|
9285
|
+
if (r.length > 0) {
|
|
9286
|
+
const A = r[0].point;
|
|
9287
|
+
this.belowViewer.cameraManager.focusOn(A), this.emit("focus", { point: A, intersect: r[0] });
|
|
8950
9288
|
}
|
|
8951
9289
|
}
|
|
8952
9290
|
isMeasurementHelper(e) {
|
|
@@ -8961,14 +9299,72 @@ class Kn extends je {
|
|
|
8961
9299
|
return !!(typeof e.name == "string" && (e.name.startsWith("MeasurementHelper") || e.name.includes("measurement") || e.name.includes("ghost")));
|
|
8962
9300
|
}
|
|
8963
9301
|
createUI() {
|
|
8964
|
-
this.container === document.body ? document.documentElement.classList.add("below-viewer") : this.container.classList.add("below-viewer-container");
|
|
9302
|
+
this.container === document.body ? document.documentElement.classList.add("below-viewer") : this.container.classList.add("below-viewer-container"), this.ensureUiRoot();
|
|
8965
9303
|
const e = Object.keys(this.config.models).length;
|
|
8966
9304
|
e > 1 && !this.ui.dropdown && this.createModelSelector(), this.config.enableDiveSystem && this.config.showDiveToggle && e <= 1 && !this.ui.diveToggle && this.createDiveModeToggle(), this.config.showInfo && !this.ui.info && this.createInfoPanel(), this.config.showLoadingIndicator && !this.ui.loading && this.createLoadingIndicator(), this.config.showStatus && !this.ui.status && this.createStatusIndicator(), this.ui.dropdown && this.ui.dropdown.addEventListener("change", (t) => {
|
|
8967
9305
|
t.target.value && this.loadModel(t.target.value);
|
|
8968
9306
|
});
|
|
8969
9307
|
}
|
|
9308
|
+
ensureUiRoot() {
|
|
9309
|
+
if (this.uiRoot)
|
|
9310
|
+
return this.uiRoot;
|
|
9311
|
+
const e = document.createElement("div");
|
|
9312
|
+
return e.className = "below-ui-root", this.container.appendChild(e), this.uiRoot = e, this.applyStereoUiState(), e;
|
|
9313
|
+
}
|
|
9314
|
+
getUiContainer() {
|
|
9315
|
+
return this.ensureUiRoot();
|
|
9316
|
+
}
|
|
9317
|
+
applyStereoUiState() {
|
|
9318
|
+
const e = this.belowViewer?.getStereoSettings?.(), t = e?.enabled === !0 && e?.mode === "sbs";
|
|
9319
|
+
this.uiRoot && (t ? this.enableStereoUi() : this.disableStereoUi());
|
|
9320
|
+
}
|
|
9321
|
+
updateStereoUiState() {
|
|
9322
|
+
this.applyStereoUiState();
|
|
9323
|
+
}
|
|
9324
|
+
enableStereoUi() {
|
|
9325
|
+
if (this.stereoUiActive) {
|
|
9326
|
+
this.scheduleStereoUiSync();
|
|
9327
|
+
return;
|
|
9328
|
+
}
|
|
9329
|
+
if (this.stereoUiActive = !0, this.uiRoot.classList.add("below-ui-root--stereo-left"), !this.stereoUiMirror) {
|
|
9330
|
+
const e = document.createElement("div");
|
|
9331
|
+
e.className = "below-ui-root below-ui-root--stereo-right", e.setAttribute("aria-hidden", "true"), e.setAttribute("inert", ""), e.tabIndex = -1, e.style.pointerEvents = "none", this.container.appendChild(e), this.stereoUiMirror = e;
|
|
9332
|
+
}
|
|
9333
|
+
this.scheduleStereoUiSync(), !this.stereoUiObserver && typeof MutationObserver < "u" && (this.stereoUiObserver = new MutationObserver(() => this.scheduleStereoUiSync()), this.stereoUiObserver.observe(this.uiRoot, {
|
|
9334
|
+
childList: !0,
|
|
9335
|
+
attributes: !0,
|
|
9336
|
+
characterData: !0,
|
|
9337
|
+
subtree: !0
|
|
9338
|
+
}));
|
|
9339
|
+
}
|
|
9340
|
+
disableStereoUi() {
|
|
9341
|
+
this.stereoUiActive && (this.stereoUiActive = !1, this.uiRoot.classList.remove("below-ui-root--stereo-left"), this.stereoUiObserver && (this.stereoUiObserver.disconnect(), this.stereoUiObserver = null), this.stereoUiMirror && (this.stereoUiMirror.remove(), this.stereoUiMirror = null));
|
|
9342
|
+
}
|
|
9343
|
+
scheduleStereoUiSync() {
|
|
9344
|
+
if (this.stereoUiSyncQueued || !this.stereoUiMirror)
|
|
9345
|
+
return;
|
|
9346
|
+
this.stereoUiSyncQueued = !0, (typeof requestAnimationFrame == "function" ? requestAnimationFrame : (t) => setTimeout(t, 0))(() => {
|
|
9347
|
+
this.stereoUiSyncQueued = !1, this.syncStereoUiMirror();
|
|
9348
|
+
});
|
|
9349
|
+
}
|
|
9350
|
+
syncStereoUiMirror() {
|
|
9351
|
+
if (!(!this.stereoUiMirror || !this.uiRoot)) {
|
|
9352
|
+
this.stereoUiMirror.innerHTML = "";
|
|
9353
|
+
for (const e of this.uiRoot.childNodes) {
|
|
9354
|
+
const t = e.cloneNode(!0);
|
|
9355
|
+
this.stripStereoCloneIds(t), this.stereoUiMirror.appendChild(t);
|
|
9356
|
+
}
|
|
9357
|
+
}
|
|
9358
|
+
}
|
|
9359
|
+
stripStereoCloneIds(e) {
|
|
9360
|
+
if (!(!e || e.nodeType !== 1)) {
|
|
9361
|
+
e.hasAttribute("id") && e.removeAttribute("id"), e.hasAttribute("for") && e.removeAttribute("for");
|
|
9362
|
+
for (const t of e.children)
|
|
9363
|
+
this.stripStereoCloneIds(t);
|
|
9364
|
+
}
|
|
9365
|
+
}
|
|
8970
9366
|
createModelSelector() {
|
|
8971
|
-
const e = this.
|
|
9367
|
+
const e = this.getUiContainer(), t = e.querySelector(".model-selector");
|
|
8972
9368
|
t && t.parentElement && t.remove();
|
|
8973
9369
|
const i = document.createElement("div");
|
|
8974
9370
|
i.className = "model-selector below-panel", e.appendChild(i);
|
|
@@ -8990,16 +9386,16 @@ class Kn extends je {
|
|
|
8990
9386
|
h.className = "toggle-text", h.textContent = "Survey", a.appendChild(l), a.appendChild(h);
|
|
8991
9387
|
const d = document.createElement("div");
|
|
8992
9388
|
d.className = "toggle-option right";
|
|
8993
|
-
const
|
|
8994
|
-
|
|
9389
|
+
const u = document.createElement("div");
|
|
9390
|
+
u.className = "toggle-icon", u.textContent = "🌊";
|
|
8995
9391
|
const p = document.createElement("div");
|
|
8996
|
-
p.className = "toggle-text", p.textContent = "Dive", d.appendChild(
|
|
9392
|
+
p.className = "toggle-text", p.textContent = "Dive", d.appendChild(u), d.appendChild(p), n.appendChild(a), n.appendChild(d), o.appendChild(n), i.appendChild(o);
|
|
8997
9393
|
}
|
|
8998
9394
|
this.ui.dropdown = s, this.ui.selector = i;
|
|
8999
9395
|
}
|
|
9000
9396
|
createDiveModeToggle() {
|
|
9001
9397
|
const e = document.createElement("div");
|
|
9002
|
-
e.className = "dive-mode-toggle-container", e.style.position = "
|
|
9398
|
+
e.className = "dive-mode-toggle-container", e.style.position = "absolute", e.style.top = "20px", e.style.right = "20px", e.style.zIndex = "1000";
|
|
9003
9399
|
const t = document.createElement("div");
|
|
9004
9400
|
t.className = "semantic-toggle";
|
|
9005
9401
|
const i = document.createElement("input");
|
|
@@ -9017,7 +9413,7 @@ class Kn extends je {
|
|
|
9017
9413
|
const a = document.createElement("div");
|
|
9018
9414
|
a.className = "toggle-icon", a.textContent = "🌊";
|
|
9019
9415
|
const l = document.createElement("div");
|
|
9020
|
-
l.className = "toggle-text", l.textContent = "Dive", A.appendChild(a), A.appendChild(l), t.appendChild(o), t.appendChild(A), e.appendChild(t), this.
|
|
9416
|
+
l.className = "toggle-text", l.textContent = "Dive", A.appendChild(a), A.appendChild(l), t.appendChild(o), t.appendChild(A), e.appendChild(t), this.getUiContainer().appendChild(e), this.ui.diveToggle = e;
|
|
9021
9417
|
}
|
|
9022
9418
|
createLoadingIndicator() {
|
|
9023
9419
|
const e = document.createElement("div");
|
|
@@ -9032,7 +9428,7 @@ class Kn extends je {
|
|
|
9032
9428
|
<div class="loading-model-name">Loading Model</div>
|
|
9033
9429
|
<div class="loading-status">Initializing...</div>
|
|
9034
9430
|
</div>
|
|
9035
|
-
`, this.
|
|
9431
|
+
`, this.getUiContainer().appendChild(e), this.ui.loading = e;
|
|
9036
9432
|
}
|
|
9037
9433
|
/**
|
|
9038
9434
|
* Create VR loading indicator as a canvas-based sprite
|
|
@@ -9043,27 +9439,27 @@ class Kn extends je {
|
|
|
9043
9439
|
this.vrLoadingCanvas || (this.vrLoadingCanvas = document.createElement("canvas")), (this.vrLoadingCanvas.width !== r || this.vrLoadingCanvas.height !== A) && (this.vrLoadingCanvas.width = r, this.vrLoadingCanvas.height = A);
|
|
9044
9440
|
const a = this.vrLoadingCanvas.getContext("2d");
|
|
9045
9441
|
a.setTransform(1, 0, 0, 1, 0, 0), a.clearRect(0, 0, r, A), a.save(), a.scale(s, s);
|
|
9046
|
-
const l = o / 2, h = n / 2, d = 25,
|
|
9047
|
-
if (a.shadowColor = "rgba(0, 0, 0, 0.8)", a.shadowBlur = 3, a.strokeStyle = "rgba(255, 255, 255, 0.3)", a.lineWidth = 3, a.beginPath(), a.arc(l,
|
|
9442
|
+
const l = o / 2, h = n / 2, d = 25, u = h - 40;
|
|
9443
|
+
if (a.shadowColor = "rgba(0, 0, 0, 0.8)", a.shadowBlur = 3, a.strokeStyle = "rgba(255, 255, 255, 0.3)", a.lineWidth = 3, a.beginPath(), a.arc(l, u, d, 0, Math.PI * 2), a.stroke(), a.shadowColor = "transparent", a.shadowBlur = 0, i > 0) {
|
|
9048
9444
|
const p = i / 100 * Math.PI * 2;
|
|
9049
|
-
a.strokeStyle = "#ffffff", a.lineWidth = 3, a.beginPath(), a.arc(l,
|
|
9445
|
+
a.strokeStyle = "#ffffff", a.lineWidth = 3, a.beginPath(), a.arc(l, u, d, -Math.PI / 2, -Math.PI / 2 + p), a.stroke();
|
|
9050
9446
|
}
|
|
9051
|
-
if (a.fillStyle = "white", a.font = '600 16px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', a.textAlign = "center", a.textBaseline = "middle", a.shadowColor = "rgba(0, 0, 0, 0.8)", a.shadowBlur = 2, a.shadowOffsetX = 1, a.shadowOffsetY = 1, a.fillText(`${Math.round(i)}%`, l,
|
|
9052
|
-
const p = new
|
|
9447
|
+
if (a.fillStyle = "white", a.font = '600 16px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', a.textAlign = "center", a.textBaseline = "middle", a.shadowColor = "rgba(0, 0, 0, 0.8)", a.shadowBlur = 2, a.shadowOffsetX = 1, a.shadowOffsetY = 1, a.fillText(`${Math.round(i)}%`, l, u), t && (a.fillStyle = "white", a.font = '600 28px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', a.textAlign = "center", a.textBaseline = "middle", a.shadowColor = "rgba(0, 0, 0, 0.8)", a.shadowBlur = 4, a.shadowOffsetX = 1, a.shadowOffsetY = 1, a.fillText(t, l, h + 20)), a.fillStyle = "rgba(255, 255, 255, 0.9)", a.font = '400 20px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', a.shadowColor = "rgba(0, 0, 0, 0.8)", a.shadowBlur = 3, a.shadowOffsetX = 1, a.shadowOffsetY = 1, a.fillText(e, l, h + 50), a.restore(), this.vrLoadingTexture ? this.vrLoadingTexture.needsUpdate = !0 : (this.vrLoadingTexture = new g.CanvasTexture(this.vrLoadingCanvas), this.vrLoadingTexture.minFilter = g.LinearFilter, this.vrLoadingTexture.magFilter = g.LinearFilter), !this.vrLoadingSprite) {
|
|
9448
|
+
const p = new g.SpriteMaterial({
|
|
9053
9449
|
map: this.vrLoadingTexture,
|
|
9054
9450
|
depthTest: !1,
|
|
9055
9451
|
depthWrite: !1,
|
|
9056
9452
|
transparent: !0
|
|
9057
9453
|
});
|
|
9058
|
-
this.vrLoadingSprite = new
|
|
9059
|
-
const
|
|
9060
|
-
this.vrLoadingSprite.scale.set(
|
|
9454
|
+
this.vrLoadingSprite = new g.Sprite(p);
|
|
9455
|
+
const b = 0.7, E = o / n;
|
|
9456
|
+
this.vrLoadingSprite.scale.set(b * E, b, 1);
|
|
9061
9457
|
}
|
|
9062
9458
|
return this.vrLoadingSprite;
|
|
9063
9459
|
}
|
|
9064
9460
|
createStatusIndicator() {
|
|
9065
9461
|
const e = document.createElement("div");
|
|
9066
|
-
e.id = "status", e.className = "status below-status", e.style.display = "none", this.
|
|
9462
|
+
e.id = "status", e.className = "status below-status", e.style.display = "none", this.getUiContainer().appendChild(e), this.ui.status = e;
|
|
9067
9463
|
}
|
|
9068
9464
|
createInfoPanel() {
|
|
9069
9465
|
const e = document.createElement("div");
|
|
@@ -9074,7 +9470,7 @@ class Kn extends je {
|
|
|
9074
9470
|
i.id = "infoControls", i.className = "info-panel__controls", i.innerHTML = `
|
|
9075
9471
|
<strong>Desktop:</strong> Drag to rotate • Scroll to zoom<br>
|
|
9076
9472
|
<strong>Mobile:</strong> Touch and drag to explore
|
|
9077
|
-
`, e.appendChild(t), e.appendChild(i), this.
|
|
9473
|
+
`, e.appendChild(t), e.appendChild(i), this.getUiContainer().appendChild(e), this.ui.info = e;
|
|
9078
9474
|
}
|
|
9079
9475
|
populateDropdown() {
|
|
9080
9476
|
if (!this.ui.dropdown) return;
|
|
@@ -9201,11 +9597,11 @@ class Kn extends je {
|
|
|
9201
9597
|
positionVRLoadingSprite() {
|
|
9202
9598
|
if (!this.vrLoadingSprite || !this.belowViewer || !this.belowViewer.cameraManager)
|
|
9203
9599
|
return;
|
|
9204
|
-
const e = this.belowViewer.cameraManager.camera, t = 2, i = new
|
|
9600
|
+
const e = this.belowViewer.cameraManager.camera, t = 2, i = new g.Vector3();
|
|
9205
9601
|
e.getWorldDirection(i);
|
|
9206
|
-
const s = new
|
|
9602
|
+
const s = new g.Vector3();
|
|
9207
9603
|
e.getWorldPosition(s);
|
|
9208
|
-
const o = new
|
|
9604
|
+
const o = new g.Vector3();
|
|
9209
9605
|
o.copy(s), o.add(i.multiplyScalar(t)), this.vrLoadingSprite.position.copy(o), this.vrLoadingSprite.lookAt(s);
|
|
9210
9606
|
}
|
|
9211
9607
|
updateStatus(e) {
|
|
@@ -9225,7 +9621,7 @@ class Kn extends je {
|
|
|
9225
9621
|
}
|
|
9226
9622
|
}
|
|
9227
9623
|
onModelLoaded({ model: e }) {
|
|
9228
|
-
this.measurementSystem && this.measurementSystem.setRaycastTargets(e);
|
|
9624
|
+
this.measurementSystem && this.measurementSystem.setRaycastTargets(e), this.flyControls && this.flyControls.setModelSizeFromObject(e);
|
|
9229
9625
|
}
|
|
9230
9626
|
onModelLoadError({ error: e }) {
|
|
9231
9627
|
this.hideLoading(), this.updateStatus(`Failed to load model: ${e.message}`);
|
|
@@ -9337,6 +9733,48 @@ class Kn extends je {
|
|
|
9337
9733
|
}
|
|
9338
9734
|
}
|
|
9339
9735
|
}
|
|
9736
|
+
/**
|
|
9737
|
+
* Enable or disable fly controls.
|
|
9738
|
+
*
|
|
9739
|
+
* @method setFlyControlsEnabled
|
|
9740
|
+
* @param {boolean} enabled - Whether fly controls should be enabled
|
|
9741
|
+
*/
|
|
9742
|
+
setFlyControlsEnabled(e) {
|
|
9743
|
+
this.flyControls && this.flyControls.setEnabled(e);
|
|
9744
|
+
}
|
|
9745
|
+
/**
|
|
9746
|
+
* Enter fly mode (pointer lock).
|
|
9747
|
+
*
|
|
9748
|
+
* @method enterFlyMode
|
|
9749
|
+
*/
|
|
9750
|
+
enterFlyMode() {
|
|
9751
|
+
this.flyControls && this.flyControls.enterFlyMode();
|
|
9752
|
+
}
|
|
9753
|
+
/**
|
|
9754
|
+
* Exit fly mode (pointer lock).
|
|
9755
|
+
*
|
|
9756
|
+
* @method exitFlyMode
|
|
9757
|
+
*/
|
|
9758
|
+
exitFlyMode() {
|
|
9759
|
+
this.flyControls && this.flyControls.exitFlyMode();
|
|
9760
|
+
}
|
|
9761
|
+
/**
|
|
9762
|
+
* Toggle fly mode (pointer lock).
|
|
9763
|
+
*
|
|
9764
|
+
* @method toggleFlyMode
|
|
9765
|
+
*/
|
|
9766
|
+
toggleFlyMode() {
|
|
9767
|
+
this.flyControls && this.flyControls.toggleFlyMode();
|
|
9768
|
+
}
|
|
9769
|
+
/**
|
|
9770
|
+
* Check if fly mode is currently active.
|
|
9771
|
+
*
|
|
9772
|
+
* @method isFlyModeActive
|
|
9773
|
+
* @returns {boolean} True if fly mode is active
|
|
9774
|
+
*/
|
|
9775
|
+
isFlyModeActive() {
|
|
9776
|
+
return this.flyControls ? this.flyControls.isActive() : !1;
|
|
9777
|
+
}
|
|
9340
9778
|
/**
|
|
9341
9779
|
* Set VR comfort settings for motion sickness reduction
|
|
9342
9780
|
*
|
|
@@ -9380,6 +9818,38 @@ class Kn extends je {
|
|
|
9380
9818
|
getVRComfortSettings() {
|
|
9381
9819
|
return this.belowViewer && this.belowViewer.getVRComfortSettings ? this.belowViewer.getVRComfortSettings() : null;
|
|
9382
9820
|
}
|
|
9821
|
+
/**
|
|
9822
|
+
* Enable or disable SBS stereo rendering.
|
|
9823
|
+
*
|
|
9824
|
+
* @param {boolean} enabled - Whether stereo rendering is enabled.
|
|
9825
|
+
*/
|
|
9826
|
+
setStereoEnabled(e) {
|
|
9827
|
+
this.belowViewer && this.belowViewer.setStereoEnabled && this.belowViewer.setStereoEnabled(e), this.updateStereoUiState();
|
|
9828
|
+
}
|
|
9829
|
+
/**
|
|
9830
|
+
* Adjust the SBS stereo eye separation.
|
|
9831
|
+
*
|
|
9832
|
+
* @param {number} eyeSeparation - Eye separation in meters.
|
|
9833
|
+
*/
|
|
9834
|
+
setStereoEyeSeparation(e) {
|
|
9835
|
+
this.belowViewer && this.belowViewer.setStereoEyeSeparation && this.belowViewer.setStereoEyeSeparation(e);
|
|
9836
|
+
}
|
|
9837
|
+
/**
|
|
9838
|
+
* Set the stereo mode (currently only 'sbs').
|
|
9839
|
+
*
|
|
9840
|
+
* @param {string} mode - Stereo mode string.
|
|
9841
|
+
*/
|
|
9842
|
+
setStereoMode(e) {
|
|
9843
|
+
this.belowViewer && this.belowViewer.setStereoMode && this.belowViewer.setStereoMode(e), this.updateStereoUiState();
|
|
9844
|
+
}
|
|
9845
|
+
/**
|
|
9846
|
+
* Get current stereo settings.
|
|
9847
|
+
*
|
|
9848
|
+
* @returns {{enabled: boolean, mode: string, eyeSeparation: number}|null}
|
|
9849
|
+
*/
|
|
9850
|
+
getStereoSettings() {
|
|
9851
|
+
return this.belowViewer && this.belowViewer.getStereoSettings ? this.belowViewer.getStereoSettings() : null;
|
|
9852
|
+
}
|
|
9383
9853
|
/**
|
|
9384
9854
|
* Clean up and dispose of all resources
|
|
9385
9855
|
*
|
|
@@ -9400,19 +9870,20 @@ class Kn extends je {
|
|
|
9400
9870
|
const e = this.belowViewer.renderer.domElement;
|
|
9401
9871
|
e.removeEventListener("mousedown", this.focusEventHandlers.onMouseDown), e.removeEventListener("mousemove", this.focusEventHandlers.onMouseMove), e.removeEventListener("mouseup", this.focusEventHandlers.onMouseUp), e.removeEventListener("click", this.focusEventHandlers.onMouseClick), this.focusEventHandlers = null;
|
|
9402
9872
|
}
|
|
9403
|
-
this.measurementSystem && (this.measurementSystem.dispose(), this.measurementSystem = null), this.comfortGlyph && (this.comfortGlyph.dispose(), this.comfortGlyph = null), this.diveSystem && (this.diveSystem.dispose(), this.diveSystem = null, typeof window < "u" && window.diveSystem === this.diveSystem && (window.diveSystem = null)), this.fullscreenButton && (this.fullscreenButton.remove(), this.fullscreenButton = null, document.removeEventListener("fullscreenchange", this._onFullscreenChange)), this.screenshotButton && (this.screenshotButton.remove(), this.screenshotButton = null), this.belowViewer && this.belowViewer.dispose(), this.removeAllListeners();
|
|
9873
|
+
this.measurementSystem && (this.measurementSystem.dispose(), this.measurementSystem = null), this.comfortGlyph && (this.comfortGlyph.dispose(), this.comfortGlyph = null), this.diveSystem && (this.diveSystem.dispose(), this.diveSystem = null, typeof window < "u" && window.diveSystem === this.diveSystem && (window.diveSystem = null)), this.fullscreenButton && (this.fullscreenButton.remove(), this.fullscreenButton = null, document.removeEventListener("fullscreenchange", this._onFullscreenChange)), this.screenshotButton && (this.screenshotButton.remove(), this.screenshotButton = null), this.stereoUiObserver && (this.stereoUiObserver.disconnect(), this.stereoUiObserver = null), this.stereoUiMirror && (this.stereoUiMirror.remove(), this.stereoUiMirror = null), this.belowViewer && this.belowViewer.dispose(), this.removeAllListeners();
|
|
9404
9874
|
}
|
|
9405
9875
|
}
|
|
9406
9876
|
export {
|
|
9407
9877
|
_n as BelowViewer,
|
|
9408
9878
|
Ws as Camera,
|
|
9409
9879
|
Ke as ConfigValidator,
|
|
9410
|
-
|
|
9880
|
+
Te as EventSystem,
|
|
9881
|
+
jn as FlyControls,
|
|
9411
9882
|
Ai as Line2,
|
|
9412
9883
|
It as LineGeometry,
|
|
9413
|
-
|
|
9884
|
+
Oe as LineMaterial,
|
|
9414
9885
|
O as ModelLoader,
|
|
9415
|
-
|
|
9416
|
-
|
|
9886
|
+
zn as ModelViewer,
|
|
9887
|
+
Fs as Scene,
|
|
9417
9888
|
Mn as VRManager
|
|
9418
9889
|
};
|