gl-draw 0.16.0-beta.1 → 0.16.0-beta.3
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/dist/WebGPULineSegments2.js +3 -3
- package/dist/WebGPULineSegments2.module.js +234 -233
- package/dist/core/BaseObject/index.d.ts +2 -1
- package/dist/index.js +2 -2
- package/dist/index.module.js +263 -263
- package/dist/objects/index.js +1 -1
- package/dist/objects/index.module.js +32 -32
- package/dist/objects/node/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.module.js
CHANGED
|
@@ -14,14 +14,14 @@ var se = (h, e, t) => new Promise((s, i) => {
|
|
|
14
14
|
var r = (a) => {
|
|
15
15
|
try {
|
|
16
16
|
n(t.next(a));
|
|
17
|
-
} catch (
|
|
18
|
-
i(
|
|
17
|
+
} catch (d) {
|
|
18
|
+
i(d);
|
|
19
19
|
}
|
|
20
20
|
}, o = (a) => {
|
|
21
21
|
try {
|
|
22
22
|
n(t.throw(a));
|
|
23
|
-
} catch (
|
|
24
|
-
i(
|
|
23
|
+
} catch (d) {
|
|
24
|
+
i(d);
|
|
25
25
|
}
|
|
26
26
|
}, n = (a) => a.done ? s(a.value) : Promise.resolve(a.value).then(r, o);
|
|
27
27
|
n((t = t.apply(h, e)).next());
|
|
@@ -61,7 +61,7 @@ const M = {
|
|
|
61
61
|
LEFT: 1,
|
|
62
62
|
RIGHT: 2,
|
|
63
63
|
MIDDLE: 4
|
|
64
|
-
},
|
|
64
|
+
}, c = Object.freeze({
|
|
65
65
|
NONE: 0,
|
|
66
66
|
ROTATE: 1,
|
|
67
67
|
TRUCK: 2,
|
|
@@ -116,26 +116,26 @@ function oe(h) {
|
|
|
116
116
|
function ce(h, e, t, s, i = 1 / 0, r) {
|
|
117
117
|
s = Math.max(1e-4, s);
|
|
118
118
|
const o = 2 / s, n = o * r, a = 1 / (1 + n + 0.48 * n * n + 0.235 * n * n * n);
|
|
119
|
-
let
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
const v = (t.value + o *
|
|
119
|
+
let d = h - e;
|
|
120
|
+
const m = e, p = i * s;
|
|
121
|
+
d = k(d, -p, p), e = h - d;
|
|
122
|
+
const v = (t.value + o * d) * r;
|
|
123
123
|
t.value = (t.value - o * v) * a;
|
|
124
|
-
let
|
|
125
|
-
return
|
|
124
|
+
let u = e + (d + v) * a;
|
|
125
|
+
return m - h > 0 == u > m && (u = m, t.value = (u - m) / r), u;
|
|
126
126
|
}
|
|
127
127
|
function Be(h, e, t, s, i = 1 / 0, r, o) {
|
|
128
128
|
s = Math.max(1e-4, s);
|
|
129
|
-
const n = 2 / s, a = n * r,
|
|
130
|
-
let
|
|
131
|
-
const y =
|
|
129
|
+
const n = 2 / s, a = n * r, d = 1 / (1 + a + 0.48 * a * a + 0.235 * a * a * a);
|
|
130
|
+
let m = e.x, p = e.y, v = e.z, u = h.x - m, f = h.y - p, g = h.z - v;
|
|
131
|
+
const y = m, l = p, _ = v, O = i * s, C = O * O, w = u * u + f * f + g * g;
|
|
132
132
|
if (w > C) {
|
|
133
133
|
const ve = Math.sqrt(w);
|
|
134
|
-
|
|
134
|
+
u = u / ve * O, f = f / ve * O, g = g / ve * O;
|
|
135
135
|
}
|
|
136
|
-
|
|
137
|
-
const E = (t.x + n *
|
|
138
|
-
t.x = (t.x - n * E) *
|
|
136
|
+
m = h.x - u, p = h.y - f, v = h.z - g;
|
|
137
|
+
const E = (t.x + n * u) * r, x = (t.y + n * f) * r, R = (t.z + n * g) * r;
|
|
138
|
+
t.x = (t.x - n * E) * d, t.y = (t.y - n * x) * d, t.z = (t.z - n * R) * d, o.x = m + (u + E) * d, o.y = p + (f + x) * d, o.z = v + (g + R) * d;
|
|
139
139
|
const V = y - h.x, le = l - h.y, bt = _ - h.z, xt = o.x - y, Lt = o.y - l, Pt = o.z - _;
|
|
140
140
|
return V * xt + le * Lt + bt * Pt > 0 && (o.x = y, o.y = l, o.z = _, t.x = (o.x - y) / r, t.y = (o.y - l) / r, t.z = (o.z - _) / r), o;
|
|
141
141
|
}
|
|
@@ -222,7 +222,7 @@ class J extends ws {
|
|
|
222
222
|
* @category Statics
|
|
223
223
|
*/
|
|
224
224
|
static get ACTION() {
|
|
225
|
-
return
|
|
225
|
+
return c;
|
|
226
226
|
}
|
|
227
227
|
/**
|
|
228
228
|
* Creates a `CameraControls` instance.
|
|
@@ -243,7 +243,7 @@ class J extends ws {
|
|
|
243
243
|
*/
|
|
244
244
|
constructor(e, t) {
|
|
245
245
|
super(), this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.minDistance = Number.EPSILON, this.maxDistance = 1 / 0, this.infinityDolly = !1, this.minZoom = 0.01, this.maxZoom = 1 / 0, this.smoothTime = 0.25, this.draggingSmoothTime = 0.125, this.maxSpeed = 1 / 0, this.azimuthRotateSpeed = 1, this.polarRotateSpeed = 1, this.dollySpeed = 1, this.dollyDragInverted = !1, this.truckSpeed = 2, this.dollyToCursor = !1, this.dragToOffset = !1, this.boundaryFriction = 0, this.restThreshold = 0.01, this.colliderMeshes = [], this.cancel = () => {
|
|
246
|
-
}, this._enabled = !0, this._state =
|
|
246
|
+
}, this._enabled = !0, this._state = c.NONE, this._viewport = null, this._changedDolly = 0, this._changedZoom = 0, this._hasRested = !0, this._boundaryEnclosesCamera = !1, this._needsUpdate = !0, this._updatedLastTime = !1, this._elementRect = new DOMRect(), this._isDragging = !1, this._dragNeedsUpdate = !0, this._activePointers = [], this._lockedPointer = null, this._interactiveArea = new DOMRect(0, 0, 1, 1), this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._isUserControllingOffset = !1, this._isUserControllingZoom = !1, this._lastDollyDirection = K.NONE, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new T.Vector3(), this._focalOffsetVelocity = new T.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (l, _, O, C) => {
|
|
247
247
|
let w, E;
|
|
248
248
|
if (Y(this._camera)) {
|
|
249
249
|
const x = b.copy(this._camera.position).sub(this._target), R = this._camera.getEffectiveFOV() * ie, V = x.length() * Math.tan(R * 0.5);
|
|
@@ -282,7 +282,7 @@ class J extends ws {
|
|
|
282
282
|
), this._camera = e, this._yAxisUpSpace = new T.Quaternion().setFromUnitVectors(
|
|
283
283
|
this._camera.up,
|
|
284
284
|
pe
|
|
285
|
-
), this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert(), this._state =
|
|
285
|
+
), this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert(), this._state = c.NONE, this._target = new T.Vector3(), this._targetEnd = this._target.clone(), this._focalOffset = new T.Vector3(), this._focalOffsetEnd = this._focalOffset.clone(), this._spherical = new T.Spherical().setFromVector3(
|
|
286
286
|
b.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)
|
|
287
287
|
), this._sphericalEnd = this._spherical.clone(), this._lastDistance = this._spherical.radius, this._zoom = this._camera.zoom, this._zoomEnd = this._zoom, this._lastZoom = this._zoom, this._nearPlaneCorners = [
|
|
288
288
|
new T.Vector3(),
|
|
@@ -293,14 +293,14 @@ class J extends ws {
|
|
|
293
293
|
new T.Vector3(-1 / 0, -1 / 0, -1 / 0),
|
|
294
294
|
new T.Vector3(1 / 0, 1 / 0, 1 / 0)
|
|
295
295
|
), this._cameraUp0 = this._camera.up.clone(), this._target0 = this._target.clone(), this._position0 = this._camera.position.clone(), this._zoom0 = this._zoom, this._focalOffset0 = this._focalOffset.clone(), this._dollyControlCoord = new T.Vector2(), this.mouseButtons = {
|
|
296
|
-
left:
|
|
297
|
-
middle:
|
|
298
|
-
right:
|
|
299
|
-
wheel: Y(this._camera) ?
|
|
296
|
+
left: c.ROTATE,
|
|
297
|
+
middle: c.DOLLY,
|
|
298
|
+
right: c.TRUCK,
|
|
299
|
+
wheel: Y(this._camera) ? c.DOLLY : H(this._camera) ? c.ZOOM : c.NONE
|
|
300
300
|
}, this.touches = {
|
|
301
|
-
one:
|
|
302
|
-
two: Y(this._camera) ?
|
|
303
|
-
three:
|
|
301
|
+
one: c.TOUCH_ROTATE,
|
|
302
|
+
two: Y(this._camera) ? c.TOUCH_DOLLY_TRUCK : H(this._camera) ? c.TOUCH_ZOOM_TRUCK : c.NONE,
|
|
303
|
+
three: c.TOUCH_TRUCK
|
|
304
304
|
};
|
|
305
305
|
const s = new T.Vector2(), i = new T.Vector2(), r = new T.Vector2(), o = (l) => {
|
|
306
306
|
if (!this._enabled || !this._domElement) return;
|
|
@@ -354,7 +354,7 @@ class J extends ws {
|
|
|
354
354
|
}
|
|
355
355
|
else
|
|
356
356
|
(!this._isDragging && this._lockedPointer || this._isDragging && (l.buttons & M.LEFT) === M.LEFT) && (this._state = this._state | this.mouseButtons.left), this._isDragging && (l.buttons & M.MIDDLE) === M.MIDDLE && (this._state = this._state | this.mouseButtons.middle), this._isDragging && (l.buttons & M.RIGHT) === M.RIGHT && (this._state = this._state | this.mouseButtons.right);
|
|
357
|
-
|
|
357
|
+
u();
|
|
358
358
|
}
|
|
359
359
|
}, a = (l) => {
|
|
360
360
|
const _ = this._findPointerById(l.pointerId);
|
|
@@ -362,7 +362,7 @@ class J extends ws {
|
|
|
362
362
|
if (_ && this._disposePointer(_), l.pointerType === "touch")
|
|
363
363
|
switch (this._activePointers.length) {
|
|
364
364
|
case 0:
|
|
365
|
-
this._state =
|
|
365
|
+
this._state = c.NONE;
|
|
366
366
|
break;
|
|
367
367
|
case 1:
|
|
368
368
|
this._state = this.touches.one;
|
|
@@ -375,45 +375,45 @@ class J extends ws {
|
|
|
375
375
|
break;
|
|
376
376
|
}
|
|
377
377
|
else
|
|
378
|
-
this._state =
|
|
379
|
-
|
|
378
|
+
this._state = c.NONE;
|
|
379
|
+
f();
|
|
380
380
|
}
|
|
381
381
|
};
|
|
382
|
-
let
|
|
383
|
-
const
|
|
384
|
-
if (!this._domElement || !this._enabled || this.mouseButtons.wheel ===
|
|
382
|
+
let d = -1;
|
|
383
|
+
const m = (l) => {
|
|
384
|
+
if (!this._domElement || !this._enabled || this.mouseButtons.wheel === c.NONE) return;
|
|
385
385
|
if (this._interactiveArea.left !== 0 || this._interactiveArea.top !== 0 || this._interactiveArea.width !== 1 || this._interactiveArea.height !== 1) {
|
|
386
386
|
const E = this._domElement.getBoundingClientRect(), x = (l.clientX - E.left) / (E.right - E.left), R = (l.clientY - E.top) / (E.bottom - E.top);
|
|
387
387
|
if (x < this._interactiveArea.left || x > this._interactiveArea.right || R < this._interactiveArea.top || R > this._interactiveArea.bottom)
|
|
388
388
|
return;
|
|
389
389
|
}
|
|
390
|
-
if (l.preventDefault(), this.dollyToCursor || this.mouseButtons.wheel ===
|
|
390
|
+
if (l.preventDefault(), this.dollyToCursor || this.mouseButtons.wheel === c.ROTATE || this.mouseButtons.wheel === c.TRUCK) {
|
|
391
391
|
const E = performance.now();
|
|
392
|
-
|
|
392
|
+
d - E < 1e3 && this._getClientRect(this._elementRect), d = E;
|
|
393
393
|
}
|
|
394
394
|
const _ = bs ? -1 : -3, O = l.deltaMode === 1 || l.ctrlKey ? l.deltaY / _ : l.deltaY / (_ * 10), C = this.dollyToCursor ? (l.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, w = this.dollyToCursor ? (l.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
395
395
|
switch (this.mouseButtons.wheel) {
|
|
396
|
-
case
|
|
396
|
+
case c.ROTATE: {
|
|
397
397
|
this._rotateInternal(l.deltaX, l.deltaY), this._isUserControllingRotate = !0;
|
|
398
398
|
break;
|
|
399
399
|
}
|
|
400
|
-
case
|
|
400
|
+
case c.TRUCK: {
|
|
401
401
|
this._truckInternal(l.deltaX, l.deltaY, !1, !1), this._isUserControllingTruck = !0;
|
|
402
402
|
break;
|
|
403
403
|
}
|
|
404
|
-
case
|
|
404
|
+
case c.SCREEN_PAN: {
|
|
405
405
|
this._truckInternal(l.deltaX, l.deltaY, !1, !0), this._isUserControllingTruck = !0;
|
|
406
406
|
break;
|
|
407
407
|
}
|
|
408
|
-
case
|
|
408
|
+
case c.OFFSET: {
|
|
409
409
|
this._truckInternal(l.deltaX, l.deltaY, !0, !1), this._isUserControllingOffset = !0;
|
|
410
410
|
break;
|
|
411
411
|
}
|
|
412
|
-
case
|
|
412
|
+
case c.DOLLY: {
|
|
413
413
|
this._dollyInternal(-O, C, w), this._isUserControllingDolly = !0;
|
|
414
414
|
break;
|
|
415
415
|
}
|
|
416
|
-
case
|
|
416
|
+
case c.ZOOM: {
|
|
417
417
|
this._zoomInternal(-O, C, w), this._isUserControllingZoom = !0;
|
|
418
418
|
break;
|
|
419
419
|
}
|
|
@@ -459,14 +459,14 @@ class J extends ws {
|
|
|
459
459
|
}
|
|
460
460
|
else
|
|
461
461
|
!this._lockedPointer && (l.buttons & M.LEFT) === M.LEFT && (this._state = this._state | this.mouseButtons.left), (l.buttons & M.MIDDLE) === M.MIDDLE && (this._state = this._state | this.mouseButtons.middle), (l.buttons & M.RIGHT) === M.RIGHT && (this._state = this._state | this.mouseButtons.right);
|
|
462
|
-
((this._state &
|
|
463
|
-
},
|
|
462
|
+
((this._state & c.ROTATE) === c.ROTATE || (this._state & c.TOUCH_ROTATE) === c.TOUCH_ROTATE || (this._state & c.TOUCH_DOLLY_ROTATE) === c.TOUCH_DOLLY_ROTATE || (this._state & c.TOUCH_ZOOM_ROTATE) === c.TOUCH_ZOOM_ROTATE) && (this._sphericalEnd.theta = this._spherical.theta, this._sphericalEnd.phi = this._spherical.phi, this._thetaVelocity.value = 0, this._phiVelocity.value = 0), ((this._state & c.TRUCK) === c.TRUCK || (this._state & c.SCREEN_PAN) === c.SCREEN_PAN || (this._state & c.TOUCH_TRUCK) === c.TOUCH_TRUCK || (this._state & c.TOUCH_SCREEN_PAN) === c.TOUCH_SCREEN_PAN || (this._state & c.TOUCH_DOLLY_TRUCK) === c.TOUCH_DOLLY_TRUCK || (this._state & c.TOUCH_DOLLY_SCREEN_PAN) === c.TOUCH_DOLLY_SCREEN_PAN || (this._state & c.TOUCH_ZOOM_TRUCK) === c.TOUCH_ZOOM_TRUCK || (this._state & c.TOUCH_ZOOM_SCREEN_PAN) === c.TOUCH_DOLLY_SCREEN_PAN) && (this._targetEnd.copy(this._target), this._targetVelocity.set(0, 0, 0)), ((this._state & c.DOLLY) === c.DOLLY || (this._state & c.TOUCH_DOLLY) === c.TOUCH_DOLLY || (this._state & c.TOUCH_DOLLY_TRUCK) === c.TOUCH_DOLLY_TRUCK || (this._state & c.TOUCH_DOLLY_SCREEN_PAN) === c.TOUCH_DOLLY_SCREEN_PAN || (this._state & c.TOUCH_DOLLY_OFFSET) === c.TOUCH_DOLLY_OFFSET || (this._state & c.TOUCH_DOLLY_ROTATE) === c.TOUCH_DOLLY_ROTATE) && (this._sphericalEnd.radius = this._spherical.radius, this._radiusVelocity.value = 0), ((this._state & c.ZOOM) === c.ZOOM || (this._state & c.TOUCH_ZOOM) === c.TOUCH_ZOOM || (this._state & c.TOUCH_ZOOM_TRUCK) === c.TOUCH_ZOOM_TRUCK || (this._state & c.TOUCH_ZOOM_SCREEN_PAN) === c.TOUCH_ZOOM_SCREEN_PAN || (this._state & c.TOUCH_ZOOM_OFFSET) === c.TOUCH_ZOOM_OFFSET || (this._state & c.TOUCH_ZOOM_ROTATE) === c.TOUCH_ZOOM_ROTATE) && (this._zoomEnd = this._zoom, this._zoomVelocity.value = 0), ((this._state & c.OFFSET) === c.OFFSET || (this._state & c.TOUCH_OFFSET) === c.TOUCH_OFFSET || (this._state & c.TOUCH_DOLLY_OFFSET) === c.TOUCH_DOLLY_OFFSET || (this._state & c.TOUCH_ZOOM_OFFSET) === c.TOUCH_ZOOM_OFFSET) && (this._focalOffsetEnd.copy(this._focalOffset), this._focalOffsetVelocity.set(0, 0, 0)), this.dispatchEvent({ type: "controlstart" });
|
|
463
|
+
}, u = () => {
|
|
464
464
|
if (!this._enabled || !this._dragNeedsUpdate) return;
|
|
465
465
|
this._dragNeedsUpdate = !1, Ee(this._activePointers, D);
|
|
466
466
|
const _ = this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, O = _ ? -_.deltaX : i.x - D.x, C = _ ? -_.deltaY : i.y - D.y;
|
|
467
|
-
if (i.copy(D), ((this._state &
|
|
467
|
+
if (i.copy(D), ((this._state & c.ROTATE) === c.ROTATE || (this._state & c.TOUCH_ROTATE) === c.TOUCH_ROTATE || (this._state & c.TOUCH_DOLLY_ROTATE) === c.TOUCH_DOLLY_ROTATE || (this._state & c.TOUCH_ZOOM_ROTATE) === c.TOUCH_ZOOM_ROTATE) && (this._rotateInternal(O, C), this._isUserControllingRotate = !0), (this._state & c.DOLLY) === c.DOLLY || (this._state & c.ZOOM) === c.ZOOM) {
|
|
468
468
|
const w = this.dollyToCursor ? (s.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, E = this.dollyToCursor ? (s.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0, x = this.dollyDragInverted ? -1 : 1;
|
|
469
|
-
(this._state &
|
|
469
|
+
(this._state & c.DOLLY) === c.DOLLY ? (this._dollyInternal(
|
|
470
470
|
x * C * de,
|
|
471
471
|
w,
|
|
472
472
|
E
|
|
@@ -476,14 +476,14 @@ class J extends ws {
|
|
|
476
476
|
E
|
|
477
477
|
), this._isUserControllingZoom = !0);
|
|
478
478
|
}
|
|
479
|
-
if ((this._state &
|
|
479
|
+
if ((this._state & c.TOUCH_DOLLY) === c.TOUCH_DOLLY || (this._state & c.TOUCH_ZOOM) === c.TOUCH_ZOOM || (this._state & c.TOUCH_DOLLY_TRUCK) === c.TOUCH_DOLLY_TRUCK || (this._state & c.TOUCH_ZOOM_TRUCK) === c.TOUCH_ZOOM_TRUCK || (this._state & c.TOUCH_DOLLY_SCREEN_PAN) === c.TOUCH_DOLLY_SCREEN_PAN || (this._state & c.TOUCH_ZOOM_SCREEN_PAN) === c.TOUCH_ZOOM_SCREEN_PAN || (this._state & c.TOUCH_DOLLY_OFFSET) === c.TOUCH_DOLLY_OFFSET || (this._state & c.TOUCH_ZOOM_OFFSET) === c.TOUCH_ZOOM_OFFSET || (this._state & c.TOUCH_DOLLY_ROTATE) === c.TOUCH_DOLLY_ROTATE || (this._state & c.TOUCH_ZOOM_ROTATE) === c.TOUCH_ZOOM_ROTATE) {
|
|
480
480
|
const w = D.x - this._activePointers[1].clientX, E = D.y - this._activePointers[1].clientY, x = Math.sqrt(w * w + E * E), R = r.y - x;
|
|
481
481
|
r.set(0, x);
|
|
482
482
|
const V = this.dollyToCursor ? (i.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, le = this.dollyToCursor ? (i.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
483
|
-
(this._state &
|
|
483
|
+
(this._state & c.TOUCH_DOLLY) === c.TOUCH_DOLLY || (this._state & c.TOUCH_DOLLY_ROTATE) === c.TOUCH_DOLLY_ROTATE || (this._state & c.TOUCH_DOLLY_TRUCK) === c.TOUCH_DOLLY_TRUCK || (this._state & c.TOUCH_DOLLY_SCREEN_PAN) === c.TOUCH_DOLLY_SCREEN_PAN || (this._state & c.TOUCH_DOLLY_OFFSET) === c.TOUCH_DOLLY_OFFSET ? (this._dollyInternal(R * de, V, le), this._isUserControllingDolly = !0) : (this._zoomInternal(R * de, V, le), this._isUserControllingZoom = !0);
|
|
484
484
|
}
|
|
485
|
-
((this._state &
|
|
486
|
-
},
|
|
485
|
+
((this._state & c.TRUCK) === c.TRUCK || (this._state & c.TOUCH_TRUCK) === c.TOUCH_TRUCK || (this._state & c.TOUCH_DOLLY_TRUCK) === c.TOUCH_DOLLY_TRUCK || (this._state & c.TOUCH_ZOOM_TRUCK) === c.TOUCH_ZOOM_TRUCK) && (this._truckInternal(O, C, !1, !1), this._isUserControllingTruck = !0), ((this._state & c.SCREEN_PAN) === c.SCREEN_PAN || (this._state & c.TOUCH_SCREEN_PAN) === c.TOUCH_SCREEN_PAN || (this._state & c.TOUCH_DOLLY_SCREEN_PAN) === c.TOUCH_DOLLY_SCREEN_PAN || (this._state & c.TOUCH_ZOOM_SCREEN_PAN) === c.TOUCH_ZOOM_SCREEN_PAN) && (this._truckInternal(O, C, !1, !0), this._isUserControllingTruck = !0), ((this._state & c.OFFSET) === c.OFFSET || (this._state & c.TOUCH_OFFSET) === c.TOUCH_OFFSET || (this._state & c.TOUCH_DOLLY_OFFSET) === c.TOUCH_DOLLY_OFFSET || (this._state & c.TOUCH_ZOOM_OFFSET) === c.TOUCH_ZOOM_OFFSET) && (this._truckInternal(O, C, !0, !1), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" });
|
|
486
|
+
}, f = () => {
|
|
487
487
|
Ee(this._activePointers, D), i.copy(D), this._dragNeedsUpdate = !1, (this._activePointers.length === 0 || this._activePointers.length === 1 && this._activePointers[0] === this._lockedPointer) && (this._isDragging = !1), this._activePointers.length === 0 && this._domElement && (this._domElement.ownerDocument.removeEventListener(
|
|
488
488
|
"pointermove",
|
|
489
489
|
n,
|
|
@@ -535,11 +535,11 @@ class J extends ws {
|
|
|
535
535
|
this.unlockPointer();
|
|
536
536
|
};
|
|
537
537
|
this._addAllEventListeners = (l) => {
|
|
538
|
-
this._domElement = l, this._domElement.style.touchAction = "none", this._domElement.style.userSelect = "none", this._domElement.style.webkitUserSelect = "none", this._domElement.addEventListener("pointerdown", o), this._domElement.addEventListener("pointercancel", a), this._domElement.addEventListener("wheel",
|
|
538
|
+
this._domElement = l, this._domElement.style.touchAction = "none", this._domElement.style.userSelect = "none", this._domElement.style.webkitUserSelect = "none", this._domElement.addEventListener("pointerdown", o), this._domElement.addEventListener("pointercancel", a), this._domElement.addEventListener("wheel", m, {
|
|
539
539
|
passive: !1
|
|
540
540
|
}), this._domElement.addEventListener("contextmenu", p);
|
|
541
541
|
}, this._removeAllEventListeners = () => {
|
|
542
|
-
this._domElement && (this._domElement.style.touchAction = "", this._domElement.style.userSelect = "", this._domElement.style.webkitUserSelect = "", this._domElement.removeEventListener("pointerdown", o), this._domElement.removeEventListener("pointercancel", a), this._domElement.removeEventListener("wheel",
|
|
542
|
+
this._domElement && (this._domElement.style.touchAction = "", this._domElement.style.userSelect = "", this._domElement.style.webkitUserSelect = "", this._domElement.removeEventListener("pointerdown", o), this._domElement.removeEventListener("pointercancel", a), this._domElement.removeEventListener("wheel", m, {
|
|
543
543
|
passive: !1
|
|
544
544
|
}), this._domElement.removeEventListener("contextmenu", p), this._domElement.ownerDocument.removeEventListener(
|
|
545
545
|
"pointermove",
|
|
@@ -556,7 +556,7 @@ class J extends ws {
|
|
|
556
556
|
y
|
|
557
557
|
));
|
|
558
558
|
}, this.cancel = () => {
|
|
559
|
-
this._state !==
|
|
559
|
+
this._state !== c.NONE && (this._state = c.NONE, this._activePointers.length = 0, f());
|
|
560
560
|
}, t && this.connect(t), this.update(0);
|
|
561
561
|
}
|
|
562
562
|
/**
|
|
@@ -981,17 +981,17 @@ class J extends ws {
|
|
|
981
981
|
paddingBottom: o = 0,
|
|
982
982
|
paddingTop: n = 0
|
|
983
983
|
} = {}) {
|
|
984
|
-
const a = [],
|
|
985
|
-
|
|
984
|
+
const a = [], d = e.isBox3 ? X.copy(e) : X.setFromObject(e);
|
|
985
|
+
d.isEmpty() && (console.warn(
|
|
986
986
|
"camera-controls: fitTo() cannot be used with an empty box. Aborting"
|
|
987
987
|
), Promise.resolve());
|
|
988
|
-
const
|
|
989
|
-
a.push(this.rotateTo(
|
|
990
|
-
const v = b.setFromSpherical(this._sphericalEnd).normalize(),
|
|
991
|
-
|
|
988
|
+
const m = He(this._sphericalEnd.theta, je), p = He(this._sphericalEnd.phi, je);
|
|
989
|
+
a.push(this.rotateTo(m, p, t));
|
|
990
|
+
const v = b.setFromSpherical(this._sphericalEnd).normalize(), u = Ke.setFromUnitVectors(v, we), f = P(Math.abs(v.y), 1);
|
|
991
|
+
f && u.multiply(xe.setFromAxisAngle(pe, m)), u.multiply(this._yAxisUpSpaceInverse);
|
|
992
992
|
const g = We.makeEmpty();
|
|
993
|
-
L.copy(
|
|
994
|
-
const y = g.getSize(b), l = g.getCenter(L).applyQuaternion(
|
|
993
|
+
L.copy(d.min).applyQuaternion(u), g.expandByPoint(L), L.copy(d.min).setX(d.max.x).applyQuaternion(u), g.expandByPoint(L), L.copy(d.min).setY(d.max.y).applyQuaternion(u), g.expandByPoint(L), L.copy(d.max).setZ(d.min.z).applyQuaternion(u), g.expandByPoint(L), L.copy(d.min).setZ(d.max.z).applyQuaternion(u), g.expandByPoint(L), L.copy(d.max).setY(d.min.y).applyQuaternion(u), g.expandByPoint(L), L.copy(d.max).setX(d.min.x).applyQuaternion(u), g.expandByPoint(L), L.copy(d.max).applyQuaternion(u), g.expandByPoint(L), g.min.x -= i, g.min.y -= o, g.max.x += r, g.max.y += n, u.setFromUnitVectors(we, v), f && u.premultiply(xe.invert()), u.premultiply(this._yAxisUpSpace);
|
|
994
|
+
const y = g.getSize(b), l = g.getCenter(L).applyQuaternion(u);
|
|
995
995
|
if (Y(this._camera)) {
|
|
996
996
|
const _ = this.getDistanceToFitBox(
|
|
997
997
|
y.x,
|
|
@@ -1029,8 +1029,8 @@ class J extends ws {
|
|
|
1029
1029
|
const o = this.getDistanceToFitSphere(r.radius);
|
|
1030
1030
|
s.push(this.dollyTo(o, t));
|
|
1031
1031
|
} else if (H(this._camera)) {
|
|
1032
|
-
const o = this._camera.right - this._camera.left, n = this._camera.top - this._camera.bottom, a = 2 * r.radius,
|
|
1033
|
-
s.push(this.zoomTo(
|
|
1032
|
+
const o = this._camera.right - this._camera.left, n = this._camera.top - this._camera.bottom, a = 2 * r.radius, d = Math.min(o / a, n / a);
|
|
1033
|
+
s.push(this.zoomTo(d, t));
|
|
1034
1034
|
}
|
|
1035
1035
|
return s.push(this.setFocalOffset(0, 0, 0, t)), Promise.all(s);
|
|
1036
1036
|
}
|
|
@@ -1047,11 +1047,11 @@ class J extends ws {
|
|
|
1047
1047
|
*/
|
|
1048
1048
|
setLookAt(e, t, s, i, r, o, n = !1) {
|
|
1049
1049
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = K.NONE, this._changedDolly = 0;
|
|
1050
|
-
const a = L.set(i, r, o),
|
|
1050
|
+
const a = L.set(i, r, o), d = b.set(e, t, s);
|
|
1051
1051
|
this._targetEnd.copy(a), this._sphericalEnd.setFromVector3(
|
|
1052
|
-
|
|
1052
|
+
d.sub(a).applyQuaternion(this._yAxisUpSpace)
|
|
1053
1053
|
), this.normalizeRotations(), this._needsUpdate = !0, n || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
1054
|
-
const
|
|
1054
|
+
const m = !n || P(this._target.x, this._targetEnd.x, this.restThreshold) && P(this._target.y, this._targetEnd.y, this.restThreshold) && P(this._target.z, this._targetEnd.z, this.restThreshold) && P(
|
|
1055
1055
|
this._spherical.theta,
|
|
1056
1056
|
this._sphericalEnd.theta,
|
|
1057
1057
|
this.restThreshold
|
|
@@ -1064,7 +1064,7 @@ class J extends ws {
|
|
|
1064
1064
|
this._sphericalEnd.radius,
|
|
1065
1065
|
this.restThreshold
|
|
1066
1066
|
);
|
|
1067
|
-
return this._createOnRestPromise(
|
|
1067
|
+
return this._createOnRestPromise(m);
|
|
1068
1068
|
}
|
|
1069
1069
|
/**
|
|
1070
1070
|
* Similar to setLookAt, but it interpolates between two states.
|
|
@@ -1084,23 +1084,23 @@ class J extends ws {
|
|
|
1084
1084
|
* @param enableTransition
|
|
1085
1085
|
* @category Methods
|
|
1086
1086
|
*/
|
|
1087
|
-
lerpLookAt(e, t, s, i, r, o, n, a,
|
|
1087
|
+
lerpLookAt(e, t, s, i, r, o, n, a, d, m, p, v, u, f = !1) {
|
|
1088
1088
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = K.NONE, this._changedDolly = 0;
|
|
1089
1089
|
const g = b.set(i, r, o), y = L.set(e, t, s);
|
|
1090
1090
|
z.setFromVector3(
|
|
1091
1091
|
y.sub(g).applyQuaternion(this._yAxisUpSpace)
|
|
1092
1092
|
);
|
|
1093
|
-
const l = G.set(
|
|
1093
|
+
const l = G.set(m, p, v), _ = L.set(n, a, d);
|
|
1094
1094
|
ae.setFromVector3(
|
|
1095
1095
|
_.sub(l).applyQuaternion(this._yAxisUpSpace)
|
|
1096
|
-
), this._targetEnd.copy(g.lerp(l,
|
|
1096
|
+
), this._targetEnd.copy(g.lerp(l, u));
|
|
1097
1097
|
const O = ae.theta - z.theta, C = ae.phi - z.phi, w = ae.radius - z.radius;
|
|
1098
1098
|
this._sphericalEnd.set(
|
|
1099
|
-
z.radius + w *
|
|
1100
|
-
z.phi + C *
|
|
1101
|
-
z.theta + O *
|
|
1102
|
-
), this.normalizeRotations(), this._needsUpdate = !0,
|
|
1103
|
-
const E = !
|
|
1099
|
+
z.radius + w * u,
|
|
1100
|
+
z.phi + C * u,
|
|
1101
|
+
z.theta + O * u
|
|
1102
|
+
), this.normalizeRotations(), this._needsUpdate = !0, f || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
1103
|
+
const E = !f || P(this._target.x, this._targetEnd.x, this.restThreshold) && P(this._target.y, this._targetEnd.y, this.restThreshold) && P(this._target.z, this._targetEnd.z, this.restThreshold) && P(
|
|
1104
1104
|
this._spherical.theta,
|
|
1105
1105
|
this._sphericalEnd.theta,
|
|
1106
1106
|
this.restThreshold
|
|
@@ -1454,10 +1454,10 @@ class J extends ws {
|
|
|
1454
1454
|
}
|
|
1455
1455
|
if (this.dollyToCursor) {
|
|
1456
1456
|
if (Y(this._camera) && this._changedDolly !== 0) {
|
|
1457
|
-
const p = this._spherical.radius - this._lastDistance, v = this._camera,
|
|
1458
|
-
|
|
1459
|
-
const g = L.crossVectors(
|
|
1460
|
-
|
|
1457
|
+
const p = this._spherical.radius - this._lastDistance, v = this._camera, u = this._getCameraDirection(ne), f = b.copy(u).cross(v.up).normalize();
|
|
1458
|
+
f.lengthSq() === 0 && (f.x = 1);
|
|
1459
|
+
const g = L.crossVectors(f, u), y = this._sphericalEnd.radius * Math.tan(v.getEffectiveFOV() * ie * 0.5), _ = (this._sphericalEnd.radius - p - this._sphericalEnd.radius) / this._sphericalEnd.radius, O = G.copy(this._targetEnd).add(
|
|
1460
|
+
f.multiplyScalar(
|
|
1461
1461
|
this._dollyControlCoord.x * y * v.aspect
|
|
1462
1462
|
)
|
|
1463
1463
|
).add(
|
|
@@ -1465,18 +1465,18 @@ class J extends ws {
|
|
|
1465
1465
|
), C = b.copy(this._targetEnd).lerp(O, _), w = this._lastDollyDirection === K.IN && this._spherical.radius <= this.minDistance, E = this._lastDollyDirection === K.OUT && this.maxDistance <= this._spherical.radius;
|
|
1466
1466
|
if (this.infinityDolly && (w || E)) {
|
|
1467
1467
|
this._sphericalEnd.radius -= p, this._spherical.radius -= p;
|
|
1468
|
-
const R = L.copy(
|
|
1468
|
+
const R = L.copy(u).multiplyScalar(-p);
|
|
1469
1469
|
C.add(R);
|
|
1470
1470
|
}
|
|
1471
1471
|
this._boundary.clampPoint(C, C);
|
|
1472
1472
|
const x = L.subVectors(C, this._targetEnd);
|
|
1473
1473
|
this._targetEnd.copy(C), this._target.add(x), this._changedDolly -= p, A(this._changedDolly) && (this._changedDolly = 0);
|
|
1474
1474
|
} else if (H(this._camera) && this._changedZoom !== 0) {
|
|
1475
|
-
const p = this._zoom - this._lastZoom, v = this._camera,
|
|
1475
|
+
const p = this._zoom - this._lastZoom, v = this._camera, u = b.set(
|
|
1476
1476
|
this._dollyControlCoord.x,
|
|
1477
1477
|
this._dollyControlCoord.y,
|
|
1478
1478
|
(v.near + v.far) / (v.near - v.far)
|
|
1479
|
-
).unproject(v),
|
|
1479
|
+
).unproject(v), f = L.set(0, 0, -1).applyQuaternion(v.quaternion), g = G.copy(u).add(f.multiplyScalar(-u.dot(v.up))), l = -(this._zoom - p - this._zoom) / this._zoom, _ = this._getCameraDirection(ne), O = this._targetEnd.dot(_), C = b.copy(this._targetEnd).lerp(g, l), w = C.dot(_), E = _.multiplyScalar(
|
|
1480
1480
|
w - O
|
|
1481
1481
|
);
|
|
1482
1482
|
C.sub(E), this._boundary.clampPoint(C, C);
|
|
@@ -1491,8 +1491,8 @@ class J extends ws {
|
|
|
1491
1491
|
b.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),
|
|
1492
1492
|
1
|
|
1493
1493
|
);
|
|
1494
|
-
const
|
|
1495
|
-
return
|
|
1494
|
+
const m = this._needsUpdate;
|
|
1495
|
+
return m && !this._updatedLastTime ? (this._hasRested = !1, this.dispatchEvent({ type: "wake" }), this.dispatchEvent({ type: "update" })) : m ? (this.dispatchEvent({ type: "update" }), A(t, this.restThreshold) && A(s, this.restThreshold) && A(i, this.restThreshold) && A(r.x, this.restThreshold) && A(r.y, this.restThreshold) && A(r.z, this.restThreshold) && A(o.x, this.restThreshold) && A(o.y, this.restThreshold) && A(o.z, this.restThreshold) && A(n, this.restThreshold) && !this._hasRested && (this._hasRested = !0, this.dispatchEvent({ type: "rest" }))) : !m && this._updatedLastTime && (this._hasRested || (this._hasRested = !0, this.dispatchEvent({ type: "rest" })), this.dispatchEvent({ type: "sleep" })), this._lastDistance = this._spherical.radius, this._lastZoom = this._zoom, this._updatedLastTime = m, this._needsUpdate = !1, m;
|
|
1496
1496
|
}
|
|
1497
1497
|
/**
|
|
1498
1498
|
* Get all state in JSON string
|
|
@@ -1598,8 +1598,8 @@ class J extends ws {
|
|
|
1598
1598
|
if (s === 0)
|
|
1599
1599
|
return e.add(t).add(n);
|
|
1600
1600
|
{
|
|
1601
|
-
const
|
|
1602
|
-
return e.add(L.copy(t).multiplyScalar(
|
|
1601
|
+
const d = 1 + s * a / t.dot(n);
|
|
1602
|
+
return e.add(L.copy(t).multiplyScalar(d)).add(n.multiplyScalar(1 - s));
|
|
1603
1603
|
}
|
|
1604
1604
|
}
|
|
1605
1605
|
_updateNearPlaneCorners() {
|
|
@@ -1701,9 +1701,9 @@ class J extends ws {
|
|
|
1701
1701
|
if (!n.geometry) return;
|
|
1702
1702
|
const a = n.geometry.clone();
|
|
1703
1703
|
a.applyMatrix4(n.matrixWorld);
|
|
1704
|
-
const
|
|
1705
|
-
for (let p = 0, v =
|
|
1706
|
-
b.fromBufferAttribute(
|
|
1704
|
+
const m = a.attributes.position;
|
|
1705
|
+
for (let p = 0, v = m.count; p < v; p++)
|
|
1706
|
+
b.fromBufferAttribute(m, p), r = Math.max(r, i.distanceToSquared(b));
|
|
1707
1707
|
}), s.radius = Math.sqrt(r), s;
|
|
1708
1708
|
}
|
|
1709
1709
|
}
|
|
@@ -1780,8 +1780,8 @@ S.prototype.emit = function(e) {
|
|
|
1780
1780
|
if (typeof a == "function")
|
|
1781
1781
|
$e(a, this, t);
|
|
1782
1782
|
else
|
|
1783
|
-
for (var
|
|
1784
|
-
$e(
|
|
1783
|
+
for (var d = a.length, m = Et(a, d), s = 0; s < d; ++s)
|
|
1784
|
+
$e(m[s], this, t);
|
|
1785
1785
|
return !0;
|
|
1786
1786
|
};
|
|
1787
1787
|
function yt(h, e, t, s) {
|
|
@@ -2005,8 +2005,8 @@ class Ds extends ee {
|
|
|
2005
2005
|
return this.controller;
|
|
2006
2006
|
}
|
|
2007
2007
|
addPerspectiveCamera(e = wt, t) {
|
|
2008
|
-
const { fov: s, far: i, near: r, up: o, aspect: n } = e, a = n != null ? n : this.width / this.height,
|
|
2009
|
-
return
|
|
2008
|
+
const { fov: s, far: i, near: r, up: o, aspect: n } = e, a = n != null ? n : this.width / this.height, d = new kt(s, a, r, i);
|
|
2009
|
+
return d.up = o, this.addController(d, t);
|
|
2010
2010
|
}
|
|
2011
2011
|
setPageActive(e) {
|
|
2012
2012
|
super.setPageActive(e, (t, s) => {
|
|
@@ -2072,8 +2072,8 @@ class Ds extends ee {
|
|
|
2072
2072
|
s[7],
|
|
2073
2073
|
s[11],
|
|
2074
2074
|
s[15]
|
|
2075
|
-
), { width: n, height: a } = this,
|
|
2076
|
-
(this.camera.fov !== t.fov || this.camera.aspect !==
|
|
2075
|
+
), { width: n, height: a } = this, d = n / a;
|
|
2076
|
+
(this.camera.fov !== t.fov || this.camera.aspect !== d || !this.camera.matrixWorld.equals(r) || !this.camera.matrixWorldInverse.equals(o)) && (this.camera.fov = t.fov, this.camera.updateProjectionMatrix(), this.camera.matrixAutoUpdate = !1, this.camera.matrixWorld.copy(r), this.camera.matrixWorldInverse.copy(o), this.camera.aspect = d, this.camera.updateProjectionMatrix());
|
|
2077
2077
|
}
|
|
2078
2078
|
}
|
|
2079
2079
|
}
|
|
@@ -2258,23 +2258,23 @@ class Ws {
|
|
|
2258
2258
|
composerParams: r
|
|
2259
2259
|
} = e, { renderer: o } = t;
|
|
2260
2260
|
this.renderer = o;
|
|
2261
|
-
const { multisampling: n } = r, { maxSamples: a } = o.capabilities,
|
|
2262
|
-
|
|
2263
|
-
|
|
2261
|
+
const { multisampling: n } = r, { maxSamples: a } = o.capabilities, d = o.getDrawingBufferSize(new B()), m = new Vt(
|
|
2262
|
+
d.width,
|
|
2263
|
+
d.height,
|
|
2264
2264
|
{
|
|
2265
2265
|
samples: Math.min(n, a),
|
|
2266
2266
|
type: Yt
|
|
2267
2267
|
}
|
|
2268
|
-
), p = new ke(o,
|
|
2268
|
+
), p = new ke(o, m), v = this.getSize();
|
|
2269
2269
|
p.setSize(v.width, v.height);
|
|
2270
|
-
const
|
|
2270
|
+
const u = new hs(
|
|
2271
2271
|
s.scene,
|
|
2272
2272
|
i.camera
|
|
2273
2273
|
);
|
|
2274
|
-
p.addPass(
|
|
2275
|
-
this.changeCamera(
|
|
2276
|
-
}), s.event.on("pageChange", (
|
|
2277
|
-
this.changeScene(
|
|
2274
|
+
p.addPass(u), this.scene = s.scene, this.camera = i.camera, this.finalComposer = p, this.renderPass = u, i.event.on("pageChange", (f) => {
|
|
2275
|
+
this.changeCamera(f);
|
|
2276
|
+
}), s.event.on("pageChange", (f) => {
|
|
2277
|
+
this.changeScene(f);
|
|
2278
2278
|
});
|
|
2279
2279
|
}
|
|
2280
2280
|
changeCamera(e) {
|
|
@@ -2304,8 +2304,8 @@ class Ws {
|
|
|
2304
2304
|
this.bloomPass = n;
|
|
2305
2305
|
const a = new ke(t);
|
|
2306
2306
|
a.renderToScreen = !1, a.addPass(this.renderPass), a.addPass(n), this.bloomComposer = a;
|
|
2307
|
-
const
|
|
2308
|
-
|
|
2307
|
+
const d = Us(a);
|
|
2308
|
+
d.uniforms.bloomAlphaType.value = o, this.bloomComposer = a, this.finalComposer.addPass(d), this.mixPass = d, this.bloomLayer.set(Oe);
|
|
2309
2309
|
}
|
|
2310
2310
|
setBloomSelection(e, t) {
|
|
2311
2311
|
if (!this.bloomComposer) {
|
|
@@ -2337,9 +2337,9 @@ class Ws {
|
|
|
2337
2337
|
i.isTransformControls || i.isTransformControlsRoot || i.type === "RectAreaLightHelper" ? e.push(i) : t.push(i);
|
|
2338
2338
|
}), t.forEach((i) => {
|
|
2339
2339
|
i.traverse((r) => {
|
|
2340
|
-
var
|
|
2340
|
+
var d;
|
|
2341
2341
|
const o = r, n = r, a = r;
|
|
2342
|
-
if ((
|
|
2342
|
+
if ((d = o.material) != null && d.isShadowMaterial)
|
|
2343
2343
|
e.push(o);
|
|
2344
2344
|
else if (o.material && this.bloomLayer.test(o.layers) === !1) {
|
|
2345
2345
|
if (o.material.transparent === !0 && (o.material.opacity !== 1 || o.material.alphaMap)) {
|
|
@@ -2458,23 +2458,23 @@ class Xs {
|
|
|
2458
2458
|
objects: /* @__PURE__ */ new WeakMap()
|
|
2459
2459
|
}, a = e.element !== void 0 ? e.element : document.createElement("div");
|
|
2460
2460
|
a.style.overflow = "hidden", this.domElement = a;
|
|
2461
|
-
const
|
|
2462
|
-
|
|
2463
|
-
const
|
|
2464
|
-
|
|
2461
|
+
const d = document.createElement("div");
|
|
2462
|
+
d.style.transformOrigin = "0 0", d.style.pointerEvents = "none", a.appendChild(d);
|
|
2463
|
+
const m = document.createElement("div");
|
|
2464
|
+
m.style.transformStyle = "preserve-3d", d.appendChild(m), this.getSize = function() {
|
|
2465
2465
|
return {
|
|
2466
2466
|
width: s,
|
|
2467
2467
|
height: i
|
|
2468
2468
|
};
|
|
2469
2469
|
}, this.render = function(y, l) {
|
|
2470
2470
|
const _ = l.projectionMatrix.elements[5] * o;
|
|
2471
|
-
l.view && l.view.enabled ? (
|
|
2471
|
+
l.view && l.view.enabled ? (d.style.transform = `translate( ${-l.view.offsetX * (s / l.view.width)}px, ${-l.view.offsetY * (i / l.view.height)}px )`, d.style.transform += `scale( ${l.view.fullWidth / l.view.width}, ${l.view.fullHeight / l.view.height} )`) : d.style.transform = "", y.matrixWorldAutoUpdate === !0 && y.updateMatrixWorld(), l.parent === null && l.matrixWorldAutoUpdate === !0 && l.updateMatrixWorld();
|
|
2472
2472
|
let O, C;
|
|
2473
2473
|
l.isOrthographicCamera && (O = -(l.right + l.left) / 2, C = (l.top + l.bottom) / 2);
|
|
2474
2474
|
const w = l.view && l.view.enabled ? l.view.height / l.view.fullHeight : 1, E = l.isOrthographicCamera ? `scale( ${w} )scale(` + _ + ")translate(" + p(O) + "px," + p(C) + "px)" + v(l.matrixWorldInverse) : `scale( ${w} )translateZ(` + _ + "px)" + v(l.matrixWorldInverse), R = (l.isPerspectiveCamera ? "perspective(" + _ + "px) " : "") + E + "translate(" + r + "px," + o + "px)";
|
|
2475
|
-
n.camera.style !== R && (
|
|
2475
|
+
n.camera.style !== R && (m.style.transform = R, n.camera.style = R), g(y, y, l);
|
|
2476
2476
|
}, this.setSize = function(y, l) {
|
|
2477
|
-
s = y, i = l, r = s / 2, o = i / 2, a.style.width = y + "px", a.style.height = l + "px",
|
|
2477
|
+
s = y, i = l, r = s / 2, o = i / 2, a.style.width = y + "px", a.style.height = l + "px", d.style.width = y + "px", d.style.height = l + "px", m.style.width = y + "px", m.style.height = l + "px";
|
|
2478
2478
|
};
|
|
2479
2479
|
function p(y) {
|
|
2480
2480
|
return Math.abs(y) < 1e-10 ? 0 : y;
|
|
@@ -2483,18 +2483,18 @@ class Xs {
|
|
|
2483
2483
|
const l = y.elements;
|
|
2484
2484
|
return "matrix3d(" + p(l[0]) + "," + p(-l[1]) + "," + p(l[2]) + "," + p(l[3]) + "," + p(l[4]) + "," + p(-l[5]) + "," + p(l[6]) + "," + p(l[7]) + "," + p(l[8]) + "," + p(-l[9]) + "," + p(l[10]) + "," + p(l[11]) + "," + p(l[12]) + "," + p(-l[13]) + "," + p(l[14]) + "," + p(l[15]) + ")";
|
|
2485
2485
|
}
|
|
2486
|
-
function
|
|
2486
|
+
function u(y) {
|
|
2487
2487
|
const l = y.elements;
|
|
2488
2488
|
return "translate(-50%,-50%)" + ("matrix3d(" + p(l[0]) + "," + p(l[1]) + "," + p(l[2]) + "," + p(l[3]) + "," + p(-l[4]) + "," + p(-l[5]) + "," + p(-l[6]) + "," + p(-l[7]) + "," + p(l[8]) + "," + p(l[9]) + "," + p(l[10]) + "," + p(l[11]) + "," + p(l[12]) + "," + p(l[13]) + "," + p(l[14]) + "," + p(l[15]) + ")");
|
|
2489
2489
|
}
|
|
2490
|
-
function
|
|
2490
|
+
function f(y) {
|
|
2491
2491
|
y.isCSS3DObject && (y.element.style.display = "none");
|
|
2492
2492
|
for (let l = 0, _ = y.children.length; l < _; l++)
|
|
2493
|
-
|
|
2493
|
+
f(y.children[l]);
|
|
2494
2494
|
}
|
|
2495
2495
|
function g(y, l, _, O) {
|
|
2496
2496
|
if (y.visible === !1) {
|
|
2497
|
-
|
|
2497
|
+
f(y);
|
|
2498
2498
|
return;
|
|
2499
2499
|
}
|
|
2500
2500
|
if (y.isCSS3DObject) {
|
|
@@ -2502,14 +2502,14 @@ class Xs {
|
|
|
2502
2502
|
if (w.style.display = C === !0 ? "" : "none", C === !0) {
|
|
2503
2503
|
y.onBeforeRender(t, l, _);
|
|
2504
2504
|
let E;
|
|
2505
|
-
y.isCSS3DSprite ? (I.copy(_.matrixWorldInverse), I.transpose(), y.rotation2D !== 0 && I.multiply(Gs.makeRotationZ(y.rotation2D)), y.matrixWorld.decompose(qe, $s, Qe), I.setPosition(qe), I.scale(Qe), I.elements[3] = 0, I.elements[7] = 0, I.elements[11] = 0, I.elements[15] = 1, E =
|
|
2505
|
+
y.isCSS3DSprite ? (I.copy(_.matrixWorldInverse), I.transpose(), y.rotation2D !== 0 && I.multiply(Gs.makeRotationZ(y.rotation2D)), y.matrixWorld.decompose(qe, $s, Qe), I.setPosition(qe), I.scale(Qe), I.elements[3] = 0, I.elements[7] = 0, I.elements[11] = 0, I.elements[15] = 1, E = u(I)) : E = u(y.matrixWorld);
|
|
2506
2506
|
const x = n.objects.get(y);
|
|
2507
2507
|
if (x === void 0 || x.style !== E) {
|
|
2508
2508
|
w.style.transform = E;
|
|
2509
2509
|
const R = { style: E };
|
|
2510
2510
|
n.objects.set(y, R);
|
|
2511
2511
|
}
|
|
2512
|
-
w.parentNode !==
|
|
2512
|
+
w.parentNode !== m && m.appendChild(w), y.onAfterRender(t, l, _);
|
|
2513
2513
|
}
|
|
2514
2514
|
}
|
|
2515
2515
|
for (let C = 0, w = y.children.length; C < w; C++)
|
|
@@ -2535,44 +2535,44 @@ class qs {
|
|
|
2535
2535
|
width: s,
|
|
2536
2536
|
height: i
|
|
2537
2537
|
};
|
|
2538
|
-
}, this.render = function(
|
|
2539
|
-
|
|
2540
|
-
}, this.setSize = function(
|
|
2541
|
-
s =
|
|
2538
|
+
}, this.render = function(f, g) {
|
|
2539
|
+
f.matrixWorldAutoUpdate === !0 && f.updateMatrixWorld(), g.parent === null && g.matrixWorldAutoUpdate === !0 && g.updateMatrixWorld(), Je.copy(g.matrixWorldInverse), et.multiplyMatrices(g.projectionMatrix, Je), m(f, f, g), u(f);
|
|
2540
|
+
}, this.setSize = function(f, g) {
|
|
2541
|
+
s = f, i = g, r = s / 2, o = i / 2, a.style.width = f + "px", a.style.height = g + "px";
|
|
2542
2542
|
};
|
|
2543
|
-
function
|
|
2544
|
-
|
|
2545
|
-
for (let g = 0, y =
|
|
2546
|
-
|
|
2543
|
+
function d(f) {
|
|
2544
|
+
f.isCSS2DObject && (f.element.style.display = "none");
|
|
2545
|
+
for (let g = 0, y = f.children.length; g < y; g++)
|
|
2546
|
+
d(f.children[g]);
|
|
2547
2547
|
}
|
|
2548
|
-
function f
|
|
2549
|
-
if (
|
|
2550
|
-
|
|
2548
|
+
function m(f, g, y) {
|
|
2549
|
+
if (f.visible === !1) {
|
|
2550
|
+
d(f);
|
|
2551
2551
|
return;
|
|
2552
2552
|
}
|
|
2553
|
-
if (
|
|
2554
|
-
q.setFromMatrixPosition(
|
|
2555
|
-
const l = q.z >= -1 && q.z <= 1 &&
|
|
2556
|
-
_.style.display = l === !0 ? "" : "none", l === !0 && (
|
|
2553
|
+
if (f.isCSS2DObject) {
|
|
2554
|
+
q.setFromMatrixPosition(f.matrixWorld), q.applyMatrix4(et);
|
|
2555
|
+
const l = q.z >= -1 && q.z <= 1 && f.layers.test(y.layers) === !0, _ = f.element;
|
|
2556
|
+
_.style.display = l === !0 ? "" : "none", l === !0 && (f.onBeforeRender(t, g, y), _.style.transform = "translate(" + -100 * f.center.x + "%," + -100 * f.center.y + "%)translate(" + (q.x * r + r) + "px," + (-q.y * o + o) + "px)", _.parentNode !== a && a.appendChild(_), f.onAfterRender(t, g, y));
|
|
2557
2557
|
const O = {
|
|
2558
|
-
distanceToCameraSquared: p(y,
|
|
2558
|
+
distanceToCameraSquared: p(y, f)
|
|
2559
2559
|
};
|
|
2560
|
-
n.objects.set(
|
|
2560
|
+
n.objects.set(f, O);
|
|
2561
2561
|
}
|
|
2562
|
-
for (let l = 0, _ =
|
|
2563
|
-
f
|
|
2562
|
+
for (let l = 0, _ = f.children.length; l < _; l++)
|
|
2563
|
+
m(f.children[l], g, y);
|
|
2564
2564
|
}
|
|
2565
|
-
function p(
|
|
2566
|
-
return tt.setFromMatrixPosition(
|
|
2565
|
+
function p(f, g) {
|
|
2566
|
+
return tt.setFromMatrixPosition(f.matrixWorld), st.setFromMatrixPosition(g.matrixWorld), tt.distanceToSquared(st);
|
|
2567
2567
|
}
|
|
2568
|
-
function v(
|
|
2568
|
+
function v(f) {
|
|
2569
2569
|
const g = [];
|
|
2570
|
-
return
|
|
2570
|
+
return f.traverseVisible(function(y) {
|
|
2571
2571
|
y.isCSS2DObject && g.push(y);
|
|
2572
2572
|
}), g;
|
|
2573
2573
|
}
|
|
2574
|
-
function
|
|
2575
|
-
const g = v(
|
|
2574
|
+
function u(f) {
|
|
2575
|
+
const g = v(f).sort(function(l, _) {
|
|
2576
2576
|
if (l.renderOrder !== _.renderOrder)
|
|
2577
2577
|
return _.renderOrder - l.renderOrder;
|
|
2578
2578
|
const O = n.objects.get(l).distanceToCameraSquared, C = n.objects.get(_).distanceToCameraSquared;
|
|
@@ -2674,8 +2674,8 @@ class Js {
|
|
|
2674
2674
|
const { cameraController: i } = this.options;
|
|
2675
2675
|
Object.values(this.helpers).forEach((n) => {
|
|
2676
2676
|
if (n.update && n.update(), n instanceof Ue) {
|
|
2677
|
-
const a = n.material, { object:
|
|
2678
|
-
|
|
2677
|
+
const a = n.material, { object: d } = a.userData;
|
|
2678
|
+
d && n.box.setFromObject(d, !0);
|
|
2679
2679
|
}
|
|
2680
2680
|
}), ((r = this.viewHelper) == null ? void 0 : r.animating) === !0 && (this.viewHelper.update(e), (o = t.cameraControls) == null || o.setPosition(
|
|
2681
2681
|
...i.camera.position.toArray()
|
|
@@ -2715,27 +2715,27 @@ class ei {
|
|
|
2715
2715
|
return;
|
|
2716
2716
|
r.preventDefault();
|
|
2717
2717
|
const o = e === "move" ? t : s, n = [];
|
|
2718
|
-
if (this.pickFunctionsMap.forEach((
|
|
2719
|
-
o.has(
|
|
2720
|
-
objArr:
|
|
2718
|
+
if (this.pickFunctionsMap.forEach((u) => {
|
|
2719
|
+
o.has(u.type) && n.push(te(U({}, u), {
|
|
2720
|
+
objArr: u.objArr instanceof Function ? u.objArr() : u.objArr
|
|
2721
2721
|
}));
|
|
2722
2722
|
}), n.length === 0) return;
|
|
2723
2723
|
this.activeObjects.clear(), this.objCallbackMap.clear(), this.activeObject = null;
|
|
2724
2724
|
const a = this.objCallbackMap;
|
|
2725
|
-
for (const
|
|
2726
|
-
for (const
|
|
2727
|
-
if (!
|
|
2728
|
-
a.has(
|
|
2729
|
-
const g = a.get(
|
|
2730
|
-
g.has(
|
|
2725
|
+
for (const u of n)
|
|
2726
|
+
for (const f of u.objArr) {
|
|
2727
|
+
if (!f.object3d || !f.visibleWithAncestors) continue;
|
|
2728
|
+
a.has(f) || a.set(f, /* @__PURE__ */ new Map());
|
|
2729
|
+
const g = a.get(f);
|
|
2730
|
+
g.has(u.type) || g.set(u.type, []), g.get(u.type).push(u.cb);
|
|
2731
2731
|
}
|
|
2732
2732
|
if (a.size === 0) return;
|
|
2733
|
-
const
|
|
2734
|
-
if (!
|
|
2733
|
+
const d = [...a.keys()].map((u) => u.object3d), m = (v = this.pencil.pick(r, d, !0)) == null ? void 0 : v.intersects;
|
|
2734
|
+
if (!m || m.length === 0)
|
|
2735
2735
|
e === "down" ? this.handleDownOutside(r) : e === "move" && this.handleLeaveEvents(r);
|
|
2736
2736
|
else {
|
|
2737
|
-
const
|
|
2738
|
-
this.processIntersection(
|
|
2737
|
+
const u = m[0];
|
|
2738
|
+
this.processIntersection(u, r, e);
|
|
2739
2739
|
}
|
|
2740
2740
|
const p = this.prevActiveObjects;
|
|
2741
2741
|
this.prevActiveObjects = this.activeObjects, this.activeObjects = p, this.activeObjects.clear();
|
|
@@ -2766,9 +2766,9 @@ class ei {
|
|
|
2766
2766
|
const a = i.get(n);
|
|
2767
2767
|
if (a)
|
|
2768
2768
|
if (t === "move") {
|
|
2769
|
-
const
|
|
2770
|
-
if (
|
|
2771
|
-
for (const p of
|
|
2769
|
+
const d = a.get("enter");
|
|
2770
|
+
if (d && !this.prevActiveObjects.has(n))
|
|
2771
|
+
for (const p of d)
|
|
2772
2772
|
p({
|
|
2773
2773
|
baseObject: n,
|
|
2774
2774
|
realBaseObject: this.activeObject,
|
|
@@ -2776,9 +2776,9 @@ class ei {
|
|
|
2776
2776
|
sp: o,
|
|
2777
2777
|
intersectionIndex: s
|
|
2778
2778
|
});
|
|
2779
|
-
const
|
|
2780
|
-
if (
|
|
2781
|
-
for (const p of
|
|
2779
|
+
const m = a.get("move");
|
|
2780
|
+
if (m)
|
|
2781
|
+
for (const p of m)
|
|
2782
2782
|
p({
|
|
2783
2783
|
baseObject: n,
|
|
2784
2784
|
realBaseObject: this.activeObject,
|
|
@@ -2787,9 +2787,9 @@ class ei {
|
|
|
2787
2787
|
intersectionIndex: s
|
|
2788
2788
|
});
|
|
2789
2789
|
} else {
|
|
2790
|
-
const
|
|
2791
|
-
if (
|
|
2792
|
-
for (const p of
|
|
2790
|
+
const d = a.get("down");
|
|
2791
|
+
if (d)
|
|
2792
|
+
for (const p of d)
|
|
2793
2793
|
p({
|
|
2794
2794
|
baseObject: n,
|
|
2795
2795
|
realBaseObject: this.activeObject,
|
|
@@ -2797,14 +2797,14 @@ class ei {
|
|
|
2797
2797
|
sp: o,
|
|
2798
2798
|
intersectionIndex: s
|
|
2799
2799
|
});
|
|
2800
|
-
const
|
|
2801
|
-
if (
|
|
2800
|
+
const m = a.get("click");
|
|
2801
|
+
if (m) {
|
|
2802
2802
|
const p = (v) => {
|
|
2803
2803
|
v.preventDefault();
|
|
2804
|
-
const
|
|
2805
|
-
if (!r && Math.abs(v.clientX - e.clientX) <=
|
|
2806
|
-
for (const
|
|
2807
|
-
|
|
2804
|
+
const u = 5;
|
|
2805
|
+
if (!r && Math.abs(v.clientX - e.clientX) <= u && Math.abs(v.clientY - e.clientY) <= u)
|
|
2806
|
+
for (const f of m)
|
|
2807
|
+
f({
|
|
2808
2808
|
baseObject: n,
|
|
2809
2809
|
realBaseObject: this.activeObject,
|
|
2810
2810
|
mouseEvent: e,
|
|
@@ -2861,13 +2861,13 @@ class ei {
|
|
|
2861
2861
|
for (const n of r) {
|
|
2862
2862
|
const a = n;
|
|
2863
2863
|
a.element.style.pointerEvents = "auto";
|
|
2864
|
-
const
|
|
2864
|
+
const d = (p) => {
|
|
2865
2865
|
this.enabled && (p.preventDefault(), s({
|
|
2866
2866
|
baseObject: a,
|
|
2867
2867
|
mouseEvent: p
|
|
2868
2868
|
}));
|
|
2869
|
-
},
|
|
2870
|
-
a.element.addEventListener(
|
|
2869
|
+
}, m = `pointer${t}`;
|
|
2870
|
+
a.element.addEventListener(m, rt(d), !1), o.push({ arr: a, type: m, listener: d });
|
|
2871
2871
|
}
|
|
2872
2872
|
return this.pickNodeFunctionsMap.set(i, o), i;
|
|
2873
2873
|
}
|
|
@@ -2954,35 +2954,35 @@ class ti extends ei {
|
|
|
2954
2954
|
}
|
|
2955
2955
|
draw(e, t, s) {
|
|
2956
2956
|
return se(this, null, function* () {
|
|
2957
|
-
var r, o, n
|
|
2957
|
+
var r, o, n;
|
|
2958
2958
|
const i = this.objectNamesToFactories.get(e);
|
|
2959
2959
|
if (i) {
|
|
2960
2960
|
t || (t = {}), t.target === void 0 && (t.target = s);
|
|
2961
|
-
const
|
|
2961
|
+
const a = t.target, d = (r = t.onTop) != null ? r : 0, m = (o = t.prefab) != null ? o : !1, p = (n = t.create) != null ? n : !0, v = new i().create(t);
|
|
2962
2962
|
let u;
|
|
2963
|
-
return
|
|
2964
|
-
} :
|
|
2965
|
-
v
|
|
2966
|
-
}),
|
|
2967
|
-
|
|
2963
|
+
return a === null ? u = null : typeof a == "string" ? u = this.objects.get(a) : a != null && a.isBaseObject || a ? u = a : m ? u = this.prefabGroup : u = this.group, p === !1 ? v.create = () => {
|
|
2964
|
+
} : p !== !0 && (v.create = () => {
|
|
2965
|
+
p(v);
|
|
2966
|
+
}), v.pencil = this.pencil, v.lead = this, v.mList = this.mList, v.isPrefab = m, v.objectType = `${e}`, v.objectOptions = t, this.setBaseObjectKey(
|
|
2967
|
+
v,
|
|
2968
2968
|
t.key ? `$t:#${t.key}` : "$t:",
|
|
2969
2969
|
u == null ? void 0 : u.key
|
|
2970
2970
|
), this.objectsPm.set(
|
|
2971
|
-
|
|
2972
|
-
this.addBaseObject(
|
|
2973
|
-
), yield this.objectsPm.get(
|
|
2971
|
+
v,
|
|
2972
|
+
this.addBaseObject(v, u, d)
|
|
2973
|
+
), yield this.objectsPm.get(v), this.objectsPm.delete(v), v;
|
|
2974
2974
|
}
|
|
2975
2975
|
throw new Error(`Unrecognized:${e}`);
|
|
2976
2976
|
});
|
|
2977
2977
|
}
|
|
2978
2978
|
setBaseObjectKey(e, t, s) {
|
|
2979
|
-
const i = e.objectType
|
|
2980
|
-
let
|
|
2979
|
+
const i = e.objectType;
|
|
2980
|
+
let r = t.replace("$t:", i);
|
|
2981
2981
|
if (s) {
|
|
2982
|
-
const [,
|
|
2983
|
-
|
|
2982
|
+
const [, o] = s.split("#");
|
|
2983
|
+
r = r.replace("$p:", o);
|
|
2984
2984
|
}
|
|
2985
|
-
return this.objects.has(
|
|
2985
|
+
return this.objects.has(r) && (r.includes("#") ? r += `-${Ne()}` : r += `#${Ne()}`), e.key = r, this.objects.set(r, e), r;
|
|
2986
2986
|
}
|
|
2987
2987
|
updateBaseObjectKey(e, t) {
|
|
2988
2988
|
var o;
|
|
@@ -3089,8 +3089,8 @@ class ii extends mt {
|
|
|
3089
3089
|
r.setResponseType("blob"), r.setRequestHeader(this.requestHeader), r.setPath(this.path), r.setWithCredentials(this.withCredentials), r.load(
|
|
3090
3090
|
e,
|
|
3091
3091
|
(o) => {
|
|
3092
|
-
const n = o, a = new DecompressionStream("gzip"),
|
|
3093
|
-
new Response(
|
|
3092
|
+
const n = o, a = new DecompressionStream("gzip"), d = n.stream().pipeThrough(a);
|
|
3093
|
+
new Response(d).json().then((p) => {
|
|
3094
3094
|
t == null || t(p);
|
|
3095
3095
|
}).catch((p) => {
|
|
3096
3096
|
i == null || i(p);
|
|
@@ -3115,18 +3115,18 @@ class ot extends mt {
|
|
|
3115
3115
|
return n.setResponseType("blob"), n.setRequestHeader(this.requestHeader), n.setPath(this.path), n.setWithCredentials(this.withCredentials), n.load(
|
|
3116
3116
|
e,
|
|
3117
3117
|
(a) => {
|
|
3118
|
-
let
|
|
3119
|
-
const
|
|
3120
|
-
|
|
3118
|
+
let d = a;
|
|
3119
|
+
const m = e.split(".").pop(), p = this.options.type === "image" ? `image/${m || "png"}` : `video/${m || "mp4"}`;
|
|
3120
|
+
d = d.slice(0, a.size, p);
|
|
3121
3121
|
const v = () => {
|
|
3122
|
-
o.removeEventListener("load",
|
|
3123
|
-
},
|
|
3122
|
+
o.removeEventListener("load", u, !1), o.removeEventListener("error", f, !1);
|
|
3123
|
+
}, u = () => {
|
|
3124
3124
|
v(), r.needsUpdate = !0, t && t(r);
|
|
3125
|
-
},
|
|
3125
|
+
}, f = (y) => {
|
|
3126
3126
|
v(), i && i(y), this.manager.itemError(e), this.manager.itemEnd(e);
|
|
3127
3127
|
};
|
|
3128
|
-
o.addEventListener("load",
|
|
3129
|
-
const g = window.URL.createObjectURL(
|
|
3128
|
+
o.addEventListener("load", u, !1), o.addEventListener("error", f, !1);
|
|
3129
|
+
const g = window.URL.createObjectURL(d);
|
|
3130
3130
|
o.src = g;
|
|
3131
3131
|
},
|
|
3132
3132
|
s,
|
|
@@ -3250,13 +3250,13 @@ class oi {
|
|
|
3250
3250
|
}
|
|
3251
3251
|
const o = this.getLoader(s, t);
|
|
3252
3252
|
try {
|
|
3253
|
-
const
|
|
3254
|
-
if (this.assets.set(e,
|
|
3255
|
-
const
|
|
3256
|
-
|
|
3253
|
+
const d = yield o.loadAsync(e);
|
|
3254
|
+
if (this.assets.set(e, d), r.resolve(d), s === "images" || s === "media" || s === "exr" || s === "lottie") {
|
|
3255
|
+
const m = (a = t == null ? void 0 : t.anisotropy) != null ? a : this.options.anisotropy;
|
|
3256
|
+
d.anisotropy = m;
|
|
3257
3257
|
}
|
|
3258
|
-
return
|
|
3259
|
-
} catch (
|
|
3258
|
+
return d;
|
|
3259
|
+
} catch (d) {
|
|
3260
3260
|
r.reject(`Failed to load ${e}`);
|
|
3261
3261
|
return;
|
|
3262
3262
|
}
|
|
@@ -3277,10 +3277,10 @@ class oi {
|
|
|
3277
3277
|
a.roughnessMap,
|
|
3278
3278
|
a.metalnessMap,
|
|
3279
3279
|
a.aoMap
|
|
3280
|
-
].forEach((
|
|
3281
|
-
if (
|
|
3282
|
-
const
|
|
3283
|
-
|
|
3280
|
+
].forEach((d) => {
|
|
3281
|
+
if (d) {
|
|
3282
|
+
const m = this.getSrcByAsset(d, s);
|
|
3283
|
+
m && t.add(m);
|
|
3284
3284
|
}
|
|
3285
3285
|
});
|
|
3286
3286
|
});
|
|
@@ -3396,8 +3396,8 @@ class li {
|
|
|
3396
3396
|
if (r.startsWith(i)) {
|
|
3397
3397
|
const n = r.substring(i.length), a = o.clone();
|
|
3398
3398
|
s[n] = a;
|
|
3399
|
-
const
|
|
3400
|
-
this.add(
|
|
3399
|
+
const d = `${t}#${n}`;
|
|
3400
|
+
this.add(d, a);
|
|
3401
3401
|
}
|
|
3402
3402
|
return s;
|
|
3403
3403
|
}
|
|
@@ -3422,15 +3422,15 @@ class li {
|
|
|
3422
3422
|
if ("__isProxy" in o)
|
|
3423
3423
|
return o;
|
|
3424
3424
|
const n = new Proxy(o, {
|
|
3425
|
-
set: (a,
|
|
3426
|
-
if (typeof
|
|
3427
|
-
const p = Number(
|
|
3425
|
+
set: (a, d, m) => {
|
|
3426
|
+
if (typeof d == "string" && !Number.isNaN(Number(d))) {
|
|
3427
|
+
const p = Number(d);
|
|
3428
3428
|
if (p >= 0 && p < a.length) {
|
|
3429
3429
|
const v = a[p];
|
|
3430
|
-
return this.rmBaseObjectMap(e, v), a[p] =
|
|
3430
|
+
return this.rmBaseObjectMap(e, v), a[p] = m, m && (this.applyColorSpaceToMaterials(m), this.addBaseObjectMap(e)), !0;
|
|
3431
3431
|
}
|
|
3432
3432
|
}
|
|
3433
|
-
return a[
|
|
3433
|
+
return a[d] = m, !0;
|
|
3434
3434
|
}
|
|
3435
3435
|
});
|
|
3436
3436
|
return Object.defineProperty(n, "__isProxy", {
|
|
@@ -3443,8 +3443,8 @@ class li {
|
|
|
3443
3443
|
}), e.materialList = new Proxy(e.materialList, {
|
|
3444
3444
|
set: (o, n, a) => {
|
|
3445
3445
|
if (typeof n == "string") {
|
|
3446
|
-
const
|
|
3447
|
-
return this.rmBaseObjectMap(e,
|
|
3446
|
+
const d = o[n];
|
|
3447
|
+
return this.rmBaseObjectMap(e, d), o[n] = a, a && (this.applyColorSpaceToMaterials(a), this.addBaseObjectMap(e)), !0;
|
|
3448
3448
|
}
|
|
3449
3449
|
return o[n] = a, !0;
|
|
3450
3450
|
},
|
|
@@ -3452,8 +3452,8 @@ class li {
|
|
|
3452
3452
|
if (typeof n == "string" && o[n]) {
|
|
3453
3453
|
const a = o[n];
|
|
3454
3454
|
if (Array.isArray(a)) {
|
|
3455
|
-
const
|
|
3456
|
-
return
|
|
3455
|
+
const d = s(a);
|
|
3456
|
+
return d !== a && (o[n] = d), d;
|
|
3457
3457
|
}
|
|
3458
3458
|
return a;
|
|
3459
3459
|
}
|
|
@@ -3530,11 +3530,11 @@ class li {
|
|
|
3530
3530
|
n !== -1 && (o[n] = t);
|
|
3531
3531
|
} else o === e && (r.material = t);
|
|
3532
3532
|
i.materialList && Object.keys(i.materialList).forEach((n) => {
|
|
3533
|
-
var
|
|
3534
|
-
const a = (
|
|
3533
|
+
var d;
|
|
3534
|
+
const a = (d = i.materialList) == null ? void 0 : d[n];
|
|
3535
3535
|
if (Array.isArray(a)) {
|
|
3536
|
-
const
|
|
3537
|
-
|
|
3536
|
+
const m = a.indexOf(e);
|
|
3537
|
+
m !== -1 && (a[m] = t);
|
|
3538
3538
|
} else a === e && i.materialList && (i.materialList[n] = t);
|
|
3539
3539
|
});
|
|
3540
3540
|
});
|
|
@@ -3581,22 +3581,22 @@ class di {
|
|
|
3581
3581
|
devicePixelRatio: o,
|
|
3582
3582
|
antialias: n,
|
|
3583
3583
|
powerPreference: a,
|
|
3584
|
-
toneMappingExposure:
|
|
3585
|
-
outputColorSpace:
|
|
3584
|
+
toneMappingExposure: d,
|
|
3585
|
+
outputColorSpace: m,
|
|
3586
3586
|
logarithmicDepthBuffer: p,
|
|
3587
3587
|
preserveDrawingBuffer: v,
|
|
3588
|
-
stencil:
|
|
3589
|
-
depth:
|
|
3588
|
+
stencil: u,
|
|
3589
|
+
depth: f
|
|
3590
3590
|
} = i, g = new rs({
|
|
3591
3591
|
alpha: r,
|
|
3592
3592
|
antialias: n,
|
|
3593
3593
|
powerPreference: a,
|
|
3594
3594
|
logarithmicDepthBuffer: p,
|
|
3595
3595
|
preserveDrawingBuffer: v,
|
|
3596
|
-
stencil:
|
|
3597
|
-
depth:
|
|
3596
|
+
stencil: u,
|
|
3597
|
+
depth: f
|
|
3598
3598
|
});
|
|
3599
|
-
g.setSize(t, s), g.setPixelRatio(o), g.toneMappingExposure =
|
|
3599
|
+
g.setSize(t, s), g.setPixelRatio(o), g.toneMappingExposure = d, g.outputColorSpace = m, this.renderer = g;
|
|
3600
3600
|
}
|
|
3601
3601
|
setSize(e, t) {
|
|
3602
3602
|
this.renderer.setSize(e, t);
|
|
@@ -3608,8 +3608,8 @@ class di {
|
|
|
3608
3608
|
this.renderer.render(e, t);
|
|
3609
3609
|
}
|
|
3610
3610
|
setViewport(e) {
|
|
3611
|
-
var a,
|
|
3612
|
-
const { x: t, y: s, width: i, height: r } = e, o = (a = e.scissor) != null ? a : !1, n = (
|
|
3611
|
+
var a, d;
|
|
3612
|
+
const { x: t, y: s, width: i, height: r } = e, o = (a = e.scissor) != null ? a : !1, n = (d = e.scissorTest) != null ? d : !1;
|
|
3613
3613
|
this.renderer.setViewport(t, s, i, r), o && (this.renderer.setScissor(t, s, i, r), this.renderer.setScissorTest(n));
|
|
3614
3614
|
}
|
|
3615
3615
|
dispose() {
|
|
@@ -3824,28 +3824,28 @@ const _e = class _e {
|
|
|
3824
3824
|
renderer: r,
|
|
3825
3825
|
controls: o,
|
|
3826
3826
|
loader: n
|
|
3827
|
-
} = this.options, { width: a, height:
|
|
3827
|
+
} = this.options, { width: a, height: d } = this.getSize(), m = t ? new _i({
|
|
3828
3828
|
width: a,
|
|
3829
|
-
height:
|
|
3829
|
+
height: d,
|
|
3830
3830
|
//@ts-ignore
|
|
3831
3831
|
renderer: this.options.WebGPURenderer,
|
|
3832
3832
|
rendererParams: fi
|
|
3833
3833
|
}) : new di({
|
|
3834
3834
|
width: a,
|
|
3835
|
-
height:
|
|
3835
|
+
height: d,
|
|
3836
3836
|
rendererParams: te(U({}, r), {
|
|
3837
3837
|
antialias: !1
|
|
3838
3838
|
})
|
|
3839
3839
|
});
|
|
3840
|
-
this.rendererController =
|
|
3840
|
+
this.rendererController = m;
|
|
3841
3841
|
const p = new Ds({
|
|
3842
3842
|
width: a,
|
|
3843
|
-
height:
|
|
3844
|
-
}), v = new mi({}),
|
|
3843
|
+
height: d
|
|
3844
|
+
}), v = new mi({}), u = new Ks({
|
|
3845
3845
|
controlsParams: {
|
|
3846
|
-
domElement: (_ = o == null ? void 0 : o.domElement) != null ? _ :
|
|
3846
|
+
domElement: (_ = o == null ? void 0 : o.domElement) != null ? _ : m.renderer.domElement
|
|
3847
3847
|
}
|
|
3848
|
-
}),
|
|
3848
|
+
}), f = new ai({
|
|
3849
3849
|
loaderParams: U({
|
|
3850
3850
|
anisotropy: this.maxAnisotropy
|
|
3851
3851
|
}, n)
|
|
@@ -3854,7 +3854,7 @@ const _e = class _e {
|
|
|
3854
3854
|
}), y = new si({
|
|
3855
3855
|
pencil: this
|
|
3856
3856
|
});
|
|
3857
|
-
this.sceneController = v, this.cameraController = p, this.controlsController =
|
|
3857
|
+
this.sceneController = v, this.cameraController = p, this.controlsController = u, this.loaderController = f, this.mListController = g, this.leadController = y;
|
|
3858
3858
|
const l = this.addPage({
|
|
3859
3859
|
sceneOptions: this.options.scene,
|
|
3860
3860
|
cameraOptions: this.options.camera
|
|
@@ -3867,7 +3867,7 @@ const _e = class _e {
|
|
|
3867
3867
|
});
|
|
3868
3868
|
O.add(v.scene), this.helperController = O, i && O.addViewHelper();
|
|
3869
3869
|
}
|
|
3870
|
-
e.appendChild(
|
|
3870
|
+
e.appendChild(m.renderer.domElement);
|
|
3871
3871
|
}
|
|
3872
3872
|
initComposer() {
|
|
3873
3873
|
const {
|
|
@@ -3936,11 +3936,11 @@ const _e = class _e {
|
|
|
3936
3936
|
composerController: o,
|
|
3937
3937
|
cssRendererController: n,
|
|
3938
3938
|
leadController: a
|
|
3939
|
-
} = this,
|
|
3940
|
-
|
|
3939
|
+
} = this, d = this.renderer.getSize(new B());
|
|
3940
|
+
d.x === e && d.y === t || (r.setSize(e, t), i.setSize(e, t), o == null || o.setSize(e, t), n == null || n.setSize(e, t), a.setSize(e, t), this.installPlugins.forEach((m) => {
|
|
3941
3941
|
var p;
|
|
3942
|
-
(p =
|
|
3943
|
-
}), this.viewPadding.some((
|
|
3942
|
+
(p = m.setSize) == null || p.call(m, e, t);
|
|
3943
|
+
}), this.viewPadding.some((m) => m !== 0) && this.setViewPadding(...this.viewPadding), this.render(), s && this.event.emit("resize", { width: e, height: t }));
|
|
3944
3944
|
}
|
|
3945
3945
|
setDevicePixelRatio(e) {
|
|
3946
3946
|
var n;
|
|
@@ -3971,15 +3971,15 @@ const _e = class _e {
|
|
|
3971
3971
|
const { raycaster: i, options: r } = this, { container: o } = r, n = new B(), a = o.getBoundingClientRect();
|
|
3972
3972
|
if (n.x = (e.clientX - a.left) / (a.right - a.left) * 2 - 1, n.y = -((e.clientY - a.top) / (a.bottom - a.top)) * 2 + 1, this.camera && this.scene) {
|
|
3973
3973
|
i.setFromCamera(n, this.camera);
|
|
3974
|
-
const
|
|
3974
|
+
const d = i.intersectObjects(
|
|
3975
3975
|
t || this.scene.children,
|
|
3976
3976
|
s
|
|
3977
3977
|
);
|
|
3978
|
-
if (
|
|
3978
|
+
if (d.length)
|
|
3979
3979
|
return {
|
|
3980
|
-
object:
|
|
3981
|
-
index:
|
|
3982
|
-
intersects:
|
|
3980
|
+
object: d[0].object,
|
|
3981
|
+
index: d[0].index,
|
|
3982
|
+
intersects: d
|
|
3983
3983
|
};
|
|
3984
3984
|
}
|
|
3985
3985
|
}
|
|
@@ -3989,9 +3989,9 @@ const _e = class _e {
|
|
|
3989
3989
|
return;
|
|
3990
3990
|
this.event.emit("beforeRender"), this.timer.update(), Ce.update();
|
|
3991
3991
|
const e = this.timer.getDelta(), t = this.timer.getElapsed();
|
|
3992
|
-
this.controlsController.update(e, t), this.leadController.update(e, t), this.installPlugins.forEach((
|
|
3993
|
-
var
|
|
3994
|
-
(
|
|
3992
|
+
this.controlsController.update(e, t), this.leadController.update(e, t), this.installPlugins.forEach((d) => {
|
|
3993
|
+
var m;
|
|
3994
|
+
(m = d.update) == null || m.call(d, e, t);
|
|
3995
3995
|
}), (s = this.helperController) == null || s.update(
|
|
3996
3996
|
e,
|
|
3997
3997
|
this.controlsController,
|
|
@@ -4036,11 +4036,11 @@ const _e = class _e {
|
|
|
4036
4036
|
}
|
|
4037
4037
|
}
|
|
4038
4038
|
dispose() {
|
|
4039
|
-
var e, t, s, i, r, o, n, a,
|
|
4039
|
+
var e, t, s, i, r, o, n, a, d, m, p, v, u, f;
|
|
4040
4040
|
this.handeleResize(1, 1, !1), this.stop(), this.timer.dispose(), Ce.removeAll(), this.event.removeAllListeners(), (e = this.resizeObserver) == null || e.unobserve(this.options.container), this.installPlugins.forEach((g) => {
|
|
4041
4041
|
var y;
|
|
4042
4042
|
(y = g.dispose) == null || y.call(g);
|
|
4043
|
-
}), (t = this.controlsController) == null || t.dispose(), (s = this.transformController) == null || s.dispose(), (i = this.cssRendererController) == null || i.dispose(), (r = this.sceneController) == null || r.dispose(), (o = this.cameraController) == null || o.dispose(), (n = this.helperController) == null || n.dispose(), (a = this.composerController) == null || a.dispose(), (
|
|
4043
|
+
}), (t = this.controlsController) == null || t.dispose(), (s = this.transformController) == null || s.dispose(), (i = this.cssRendererController) == null || i.dispose(), (r = this.sceneController) == null || r.dispose(), (o = this.cameraController) == null || o.dispose(), (n = this.helperController) == null || n.dispose(), (a = this.composerController) == null || a.dispose(), (d = this.rendererController) == null || d.dispose(), (m = this.loaderController) == null || m.dispose(), (p = this.leadController) == null || p.dispose(), (v = this.mListController) == null || v.dispose(), this.cssRendererController = void 0, this.installPlugins.clear(), (u = this.stats) == null || u.dom.remove(), (f = this.renderer) == null || f.domElement.remove(), this._isDispose = !0;
|
|
4044
4044
|
}
|
|
4045
4045
|
};
|
|
4046
4046
|
_e.options = {
|