endset_three_editor 0.4.8 → 0.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/dist/three-editor.es.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var Re = (r, e, t) =>
|
|
4
|
-
import { toRaw as vt, defineComponent as be, ref as j, inject as
|
|
1
|
+
var es = Object.defineProperty;
|
|
2
|
+
var ts = (r, e, t) => e in r ? es(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var Re = (r, e, t) => ts(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { toRaw as vt, defineComponent as be, ref as j, inject as ns, computed as Ue, watchEffect as ss, resolveComponent as is, openBlock as T, createElementBlock as R, createElementVNode as b, normalizeClass as se, withModifiers as Wt, unref as os, toDisplayString as ie, Fragment as ve, renderList as Mt, createBlock as Ze, createCommentVNode as X, reactive as zt, watch as Me, withDirectives as E, vModelText as N, withKeys as He, vModelCheckbox as rs, toRef as as, provide as ls, createVNode as Tt, vShow as De, shallowRef as nn, onMounted as cs, onBeforeUnmount as us } from "vue";
|
|
5
5
|
import * as P from "three";
|
|
6
|
-
import { Controls as
|
|
6
|
+
import { Controls as Sn, Vector3 as M, MOUSE as Ne, TOUCH as Le, Quaternion as K, Spherical as sn, Vector2 as Y, Ray as As, Plane as ds, MathUtils as Hn, Raycaster as hs, Object3D as ke, MeshBasicMaterial as Pe, LineBasicMaterial as Qe, CylinderGeometry as U, BoxGeometry as q, BufferGeometry as We, Float32BufferAttribute as pe, Mesh as v, OctahedronGeometry as ut, Line as ue, TorusGeometry as Ge, SphereGeometry as fs, Euler as ps, Matrix4 as me, PlaneGeometry as ms, DoubleSide as Ln, Loader as Zt, FileLoader as nt, Color as de, SRGBColorSpace as Ae, Group as mt, Material as Je, PointsMaterial as Ve, MeshPhongMaterial as gs, LineSegments as Gt, Points as gt, TrianglesDrawMode as bs, TriangleFanDrawMode as Ft, TriangleStripDrawMode as Nn, LoaderUtils as _e, MeshPhysicalMaterial as le, LinearSRGBColorSpace as ae, SpotLight as Is, PointLight as ys, DirectionalLight as Cs, InstancedMesh as xs, InstancedBufferAttribute as ws, TextureLoader as vs, ImageBitmapLoader as Ms, BufferAttribute as $e, InterleavedBuffer as jn, InterleavedBufferAttribute as kn, LinearMipmapLinearFilter as Wn, NearestMipmapLinearFilter as Ds, LinearMipmapNearestFilter as Ps, NearestMipmapNearestFilter as Ts, LinearFilter as qt, NearestFilter as zn, RepeatWrapping as Xt, MirroredRepeatWrapping as Os, ClampToEdgeWrapping as Es, MeshStandardMaterial as Gn, PropertyBinding as Rs, SkinnedMesh as Ss, LineLoop as Hs, PerspectiveCamera as Ls, OrthographicCamera as Ns, Skeleton as js, AnimationClip as ks, Bone as Ws, InterpolateDiscrete as zs, InterpolateLinear as Fn, Texture as on, VectorKeyframeTrack as rn, NumberKeyframeTrack as an, QuaternionKeyframeTrack as ln, ColorManagement as Bt, FrontSide as Gs, Interpolant as Fs, Box3 as qs, Sphere as Xs } from "three";
|
|
7
7
|
import st from "@tweenjs/tween.js";
|
|
8
|
-
const
|
|
8
|
+
const cn = { type: "change" }, Qt = { type: "start" }, qn = { type: "end" }, At = new As(), un = new ds(), Bs = Math.cos(70 * Hn.DEG2RAD), G = new M(), V = 2 * Math.PI, H = {
|
|
9
9
|
NONE: -1,
|
|
10
10
|
ROTATE: 0,
|
|
11
11
|
DOLLY: 1,
|
|
@@ -15,7 +15,7 @@ const ln = { type: "change" }, Qt = { type: "start" }, Fn = { type: "end" }, At
|
|
|
15
15
|
TOUCH_DOLLY_PAN: 5,
|
|
16
16
|
TOUCH_DOLLY_ROTATE: 6
|
|
17
17
|
}, Ot = 1e-6;
|
|
18
|
-
class
|
|
18
|
+
class Us extends Sn {
|
|
19
19
|
/**
|
|
20
20
|
* Constructs a new controls instance.
|
|
21
21
|
*
|
|
@@ -23,7 +23,7 @@ class Bs extends Rn {
|
|
|
23
23
|
* @param {?HTMLElement} domElement - The HTML element used for event listeners.
|
|
24
24
|
*/
|
|
25
25
|
constructor(e, t = null) {
|
|
26
|
-
super(e, t), this.state = H.NONE, this.target = new M(), this.cursor = new M(), 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: Ne.ROTATE, MIDDLE: Ne.DOLLY, RIGHT: Ne.PAN }, this.touches = { ONE: Le.ROTATE, TWO: Le.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._cursorStyle = "auto", this._domElementKeyEvents = null, this._lastPosition = new M(), this._lastQuaternion = new K(), this._lastTargetPosition = new M(), this._quat = new K().setFromUnitVectors(e.up, new M(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new
|
|
26
|
+
super(e, t), this.state = H.NONE, this.target = new M(), this.cursor = new M(), 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: Ne.ROTATE, MIDDLE: Ne.DOLLY, RIGHT: Ne.PAN }, this.touches = { ONE: Le.ROTATE, TWO: Le.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._cursorStyle = "auto", this._domElementKeyEvents = null, this._lastPosition = new M(), this._lastQuaternion = new K(), this._lastTargetPosition = new M(), this._quat = new K().setFromUnitVectors(e.up, new M(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new sn(), this._sphericalDelta = new sn(), this._scale = 1, this._panOffset = new M(), this._rotateStart = new Y(), this._rotateEnd = new Y(), this._rotateDelta = new Y(), this._panStart = new Y(), this._panEnd = new Y(), this._panDelta = new Y(), this._dollyStart = new Y(), this._dollyEnd = new Y(), this._dollyDelta = new Y(), this._dollyDirection = new M(), this._mouse = new Y(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = Ys.bind(this), this._onPointerDown = Vs.bind(this), this._onPointerUp = Ks.bind(this), this._onContextMenu = ti.bind(this), this._onMouseWheel = Js.bind(this), this._onKeyDown = _s.bind(this), this._onTouchStart = $s.bind(this), this._onTouchMove = ei.bind(this), this._onMouseDown = Zs.bind(this), this._onMouseMove = Qs.bind(this), this._interceptControlDown = ni.bind(this), this._interceptControlUp = si.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Defines the visual representation of the cursor.
|
|
@@ -96,7 +96,7 @@ class Bs extends Rn {
|
|
|
96
96
|
* was called, or the initial state.
|
|
97
97
|
*/
|
|
98
98
|
reset() {
|
|
99
|
-
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(
|
|
99
|
+
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(cn), this.update(), this.state = H.NONE;
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
102
102
|
* Programmatically pan the camera.
|
|
@@ -167,12 +167,12 @@ class Bs extends Rn {
|
|
|
167
167
|
c.unproject(this.object), this.object.position.sub(c).add(a), this.object.updateMatrixWorld(), o = G.length();
|
|
168
168
|
} else
|
|
169
169
|
console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
|
|
170
|
-
o !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position) : (At.origin.copy(this.object.position), At.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(At.direction)) <
|
|
170
|
+
o !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position) : (At.origin.copy(this.object.position), At.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(At.direction)) < Bs ? this.object.lookAt(this.target) : (un.setFromNormalAndCoplanarPoint(this.object.up, this.target), At.intersectPlane(un, this.target))));
|
|
171
171
|
} else if (this.object.isOrthographicCamera) {
|
|
172
172
|
const o = this.object.zoom;
|
|
173
173
|
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), o !== this.object.zoom && (this.object.updateProjectionMatrix(), i = !0);
|
|
174
174
|
}
|
|
175
|
-
return this._scale = 1, this._performCursorZoom = !1, i || this._lastPosition.distanceToSquared(this.object.position) > Ot || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > Ot || this._lastTargetPosition.distanceToSquared(this.target) > Ot ? (this.dispatchEvent(
|
|
175
|
+
return this._scale = 1, this._performCursorZoom = !1, i || this._lastPosition.distanceToSquared(this.object.position) > Ot || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > Ot || this._lastTargetPosition.distanceToSquared(this.target) > Ot ? (this.dispatchEvent(cn), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
|
|
176
176
|
}
|
|
177
177
|
_getAutoRotationAngle(e) {
|
|
178
178
|
return e !== null ? V / 60 * this.autoRotateSpeed * e : V / 60 / 60 * this.autoRotateSpeed;
|
|
@@ -364,16 +364,16 @@ class Bs extends Rn {
|
|
|
364
364
|
return e.ctrlKey && !this._controlActive && (s.deltaY *= 10), s;
|
|
365
365
|
}
|
|
366
366
|
}
|
|
367
|
-
function
|
|
367
|
+
function Vs(r) {
|
|
368
368
|
this.enabled !== !1 && (this._pointers.length === 0 && (this.domElement.setPointerCapture(r.pointerId), this.domElement.ownerDocument.addEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.addEventListener("pointerup", this._onPointerUp)), !this._isTrackingPointer(r) && (this._addPointer(r), r.pointerType === "touch" ? this._onTouchStart(r) : this._onMouseDown(r), this._cursorStyle === "grab" && (this.domElement.style.cursor = "grabbing")));
|
|
369
369
|
}
|
|
370
|
-
function
|
|
370
|
+
function Ys(r) {
|
|
371
371
|
this.enabled !== !1 && (r.pointerType === "touch" ? this._onTouchMove(r) : this._onMouseMove(r));
|
|
372
372
|
}
|
|
373
|
-
function
|
|
373
|
+
function Ks(r) {
|
|
374
374
|
switch (this._removePointer(r), this._pointers.length) {
|
|
375
375
|
case 0:
|
|
376
|
-
this.domElement.releasePointerCapture(r.pointerId), this.domElement.ownerDocument.removeEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(
|
|
376
|
+
this.domElement.releasePointerCapture(r.pointerId), this.domElement.ownerDocument.removeEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(qn), this.state = H.NONE, this._cursorStyle === "grab" && (this.domElement.style.cursor = "grab");
|
|
377
377
|
break;
|
|
378
378
|
case 1:
|
|
379
379
|
const e = this._pointers[0], t = this._pointerPositions[e];
|
|
@@ -381,7 +381,7 @@ function Ys(r) {
|
|
|
381
381
|
break;
|
|
382
382
|
}
|
|
383
383
|
}
|
|
384
|
-
function
|
|
384
|
+
function Zs(r) {
|
|
385
385
|
let e;
|
|
386
386
|
switch (r.button) {
|
|
387
387
|
case 0:
|
|
@@ -424,7 +424,7 @@ function Ks(r) {
|
|
|
424
424
|
}
|
|
425
425
|
this.state !== H.NONE && this.dispatchEvent(Qt);
|
|
426
426
|
}
|
|
427
|
-
function
|
|
427
|
+
function Qs(r) {
|
|
428
428
|
switch (this.state) {
|
|
429
429
|
case H.ROTATE:
|
|
430
430
|
if (this.enableRotate === !1) return;
|
|
@@ -440,13 +440,13 @@ function Zs(r) {
|
|
|
440
440
|
break;
|
|
441
441
|
}
|
|
442
442
|
}
|
|
443
|
-
function Qs(r) {
|
|
444
|
-
this.enabled === !1 || this.enableZoom === !1 || this.state !== H.NONE || (r.preventDefault(), this.dispatchEvent(Qt), this._handleMouseWheel(this._customWheelEvent(r)), this.dispatchEvent(Fn));
|
|
445
|
-
}
|
|
446
443
|
function Js(r) {
|
|
447
|
-
this.enabled
|
|
444
|
+
this.enabled === !1 || this.enableZoom === !1 || this.state !== H.NONE || (r.preventDefault(), this.dispatchEvent(Qt), this._handleMouseWheel(this._customWheelEvent(r)), this.dispatchEvent(qn));
|
|
448
445
|
}
|
|
449
446
|
function _s(r) {
|
|
447
|
+
this.enabled !== !1 && this._handleKeyDown(r);
|
|
448
|
+
}
|
|
449
|
+
function $s(r) {
|
|
450
450
|
switch (this._trackPointer(r), this._pointers.length) {
|
|
451
451
|
case 1:
|
|
452
452
|
switch (this.touches.ONE) {
|
|
@@ -481,7 +481,7 @@ function _s(r) {
|
|
|
481
481
|
}
|
|
482
482
|
this.state !== H.NONE && this.dispatchEvent(Qt);
|
|
483
483
|
}
|
|
484
|
-
function
|
|
484
|
+
function ei(r) {
|
|
485
485
|
switch (this._trackPointer(r), this.state) {
|
|
486
486
|
case H.TOUCH_ROTATE:
|
|
487
487
|
if (this.enableRotate === !1) return;
|
|
@@ -503,21 +503,21 @@ function $s(r) {
|
|
|
503
503
|
this.state = H.NONE;
|
|
504
504
|
}
|
|
505
505
|
}
|
|
506
|
-
function
|
|
506
|
+
function ti(r) {
|
|
507
507
|
this.enabled !== !1 && r.preventDefault();
|
|
508
508
|
}
|
|
509
|
-
function
|
|
509
|
+
function ni(r) {
|
|
510
510
|
r.key === "Control" && (this._controlActive = !0, this.domElement.getRootNode().addEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
|
|
511
511
|
}
|
|
512
|
-
function
|
|
512
|
+
function si(r) {
|
|
513
513
|
r.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
|
|
514
514
|
}
|
|
515
|
-
const Ce = new
|
|
515
|
+
const Ce = new hs(), F = new M(), he = new M(), k = new K(), An = {
|
|
516
516
|
X: new M(1, 0, 0),
|
|
517
517
|
Y: new M(0, 1, 0),
|
|
518
518
|
Z: new M(0, 0, 1)
|
|
519
|
-
}, Et = { type: "change" },
|
|
520
|
-
class
|
|
519
|
+
}, Et = { type: "change" }, dn = { type: "mouseDown", mode: null }, hn = { type: "mouseUp", mode: null }, fn = { type: "objectChange" };
|
|
520
|
+
class ii extends Sn {
|
|
521
521
|
/**
|
|
522
522
|
* Constructs a new controls instance.
|
|
523
523
|
*
|
|
@@ -526,11 +526,11 @@ class si extends Rn {
|
|
|
526
526
|
*/
|
|
527
527
|
constructor(e, t = null) {
|
|
528
528
|
super(void 0, t);
|
|
529
|
-
const s = new
|
|
529
|
+
const s = new ui(this);
|
|
530
530
|
this._root = s;
|
|
531
|
-
const n = new
|
|
531
|
+
const n = new Ai();
|
|
532
532
|
this._gizmo = n, s.add(n);
|
|
533
|
-
const i = new
|
|
533
|
+
const i = new di();
|
|
534
534
|
this._plane = i, s.add(i);
|
|
535
535
|
const o = this;
|
|
536
536
|
function a(y, C) {
|
|
@@ -546,7 +546,7 @@ class si extends Rn {
|
|
|
546
546
|
}
|
|
547
547
|
a("camera", e), a("object", void 0), a("enabled", !0), a("axis", null), a("mode", "translate"), a("translationSnap", null), a("rotationSnap", null), a("scaleSnap", null), a("space", "world"), a("size", 1), a("dragging", !1), a("showX", !0), a("showY", !0), a("showZ", !0), a("showXY", !0), a("showYZ", !0), a("showXZ", !0), a("minX", -1 / 0), a("maxX", 1 / 0), a("minY", -1 / 0), a("maxY", 1 / 0), a("minZ", -1 / 0), a("maxZ", 1 / 0);
|
|
548
548
|
const l = new M(), c = new M(), A = new K(), u = new K(), h = new M(), d = new K(), p = new M(), m = new M(), f = new M(), g = 0, x = new M();
|
|
549
|
-
a("worldPosition", l), a("worldPositionStart", c), a("worldQuaternion", A), a("worldQuaternionStart", u), a("cameraPosition", h), a("cameraQuaternion", d), a("pointStart", p), a("pointEnd", m), a("rotationAxis", f), a("rotationAngle", g), a("eye", x), this._offset = new M(), this._startNorm = new M(), this._endNorm = new M(), this._cameraScale = new M(), this._parentPosition = new M(), this._parentQuaternion = new K(), this._parentQuaternionInv = new K(), this._parentScale = new M(), this._worldScaleStart = new M(), this._worldQuaternionInv = new K(), this._worldScale = new M(), this._positionStart = new M(), this._quaternionStart = new K(), this._scaleStart = new M(), this._getPointer =
|
|
549
|
+
a("worldPosition", l), a("worldPositionStart", c), a("worldQuaternion", A), a("worldQuaternionStart", u), a("cameraPosition", h), a("cameraQuaternion", d), a("pointStart", p), a("pointEnd", m), a("rotationAxis", f), a("rotationAngle", g), a("eye", x), this._offset = new M(), this._startNorm = new M(), this._endNorm = new M(), this._cameraScale = new M(), this._parentPosition = new M(), this._parentQuaternion = new K(), this._parentQuaternionInv = new K(), this._parentScale = new M(), this._worldScaleStart = new M(), this._worldQuaternionInv = new K(), this._worldScale = new M(), this._positionStart = new M(), this._quaternionStart = new K(), this._scaleStart = new M(), this._getPointer = oi.bind(this), this._onPointerDown = ai.bind(this), this._onPointerHover = ri.bind(this), this._onPointerMove = li.bind(this), this._onPointerUp = ci.bind(this), t !== null && this.connect(t);
|
|
550
550
|
}
|
|
551
551
|
connect(e) {
|
|
552
552
|
super.connect(e), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointermove", this._onPointerHover), this.domElement.addEventListener("pointerup", this._onPointerUp), this.domElement.style.touchAction = "none";
|
|
@@ -573,7 +573,7 @@ class si extends Rn {
|
|
|
573
573
|
if (!(this.object === void 0 || this.dragging === !0 || e != null && e.button !== 0) && this.axis !== null) {
|
|
574
574
|
e !== null && Ce.setFromCamera(e, this.camera);
|
|
575
575
|
const t = Rt(this._plane, Ce, !0);
|
|
576
|
-
t && (this.object.updateMatrixWorld(), this.object.parent.updateMatrixWorld(), this._positionStart.copy(this.object.position), this._quaternionStart.copy(this.object.quaternion), this._scaleStart.copy(this.object.scale), this.object.matrixWorld.decompose(this.worldPositionStart, this.worldQuaternionStart, this._worldScaleStart), this.pointStart.copy(t.point).sub(this.worldPositionStart)), this.dragging = !0,
|
|
576
|
+
t && (this.object.updateMatrixWorld(), this.object.parent.updateMatrixWorld(), this._positionStart.copy(this.object.position), this._quaternionStart.copy(this.object.quaternion), this._scaleStart.copy(this.object.scale), this.object.matrixWorld.decompose(this.worldPositionStart, this.worldQuaternionStart, this._worldScaleStart), this.pointStart.copy(t.point).sub(this.worldPositionStart)), this.dragging = !0, dn.mode = this.mode, this.dispatchEvent(dn);
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
579
|
pointerMove(e) {
|
|
@@ -596,13 +596,13 @@ class si extends Rn {
|
|
|
596
596
|
this._offset.copy(this.pointEnd).sub(this.pointStart);
|
|
597
597
|
const a = 20 / this.worldPosition.distanceTo(F.setFromMatrixPosition(this.camera.matrixWorld));
|
|
598
598
|
let l = !1;
|
|
599
|
-
t === "XYZE" ? (this.rotationAxis.copy(this._offset).cross(this.eye).normalize(), this.rotationAngle = this._offset.dot(F.copy(this.rotationAxis).cross(this.eye)) * a) : (t === "X" || t === "Y" || t === "Z") && (this.rotationAxis.copy(
|
|
599
|
+
t === "XYZE" ? (this.rotationAxis.copy(this._offset).cross(this.eye).normalize(), this.rotationAngle = this._offset.dot(F.copy(this.rotationAxis).cross(this.eye)) * a) : (t === "X" || t === "Y" || t === "Z") && (this.rotationAxis.copy(An[t]), F.copy(An[t]), i === "local" && F.applyQuaternion(this.worldQuaternion), F.cross(this.eye), F.length() === 0 ? l = !0 : this.rotationAngle = this._offset.dot(F.normalize()) * a), (t === "E" || l) && (this.rotationAxis.copy(this.eye), this.rotationAngle = this.pointEnd.angleTo(this.pointStart), this._startNorm.copy(this.pointStart).normalize(), this._endNorm.copy(this.pointEnd).normalize(), this.rotationAngle *= this._endNorm.cross(this._startNorm).dot(this.eye) < 0 ? 1 : -1), this.rotationSnap && (this.rotationAngle = Math.round(this.rotationAngle / this.rotationSnap) * this.rotationSnap), i === "local" && t !== "E" && t !== "XYZE" ? (n.quaternion.copy(this._quaternionStart), n.quaternion.multiply(k.setFromAxisAngle(this.rotationAxis, this.rotationAngle)).normalize()) : (this.rotationAxis.applyQuaternion(this._parentQuaternionInv), n.quaternion.copy(k.setFromAxisAngle(this.rotationAxis, this.rotationAngle)), n.quaternion.multiply(this._quaternionStart).normalize());
|
|
600
600
|
}
|
|
601
|
-
this.dispatchEvent(Et), this.dispatchEvent(
|
|
601
|
+
this.dispatchEvent(Et), this.dispatchEvent(fn);
|
|
602
602
|
}
|
|
603
603
|
}
|
|
604
604
|
pointerUp(e) {
|
|
605
|
-
e !== null && e.button !== 0 || (this.dragging && this.axis !== null && (
|
|
605
|
+
e !== null && e.button !== 0 || (this.dragging && this.axis !== null && (hn.mode = this.mode, this.dispatchEvent(hn)), this.dragging = !1, this.axis = null);
|
|
606
606
|
}
|
|
607
607
|
dispose() {
|
|
608
608
|
this.disconnect(), this._root.dispose();
|
|
@@ -628,7 +628,7 @@ class si extends Rn {
|
|
|
628
628
|
* Resets the object's position, rotation and scale to when the current transform began.
|
|
629
629
|
*/
|
|
630
630
|
reset() {
|
|
631
|
-
this.enabled && this.dragging && (this.object.position.copy(this._positionStart), this.object.quaternion.copy(this._quaternionStart), this.object.scale.copy(this._scaleStart), this.dispatchEvent(Et), this.dispatchEvent(
|
|
631
|
+
this.enabled && this.dragging && (this.object.position.copy(this._positionStart), this.object.quaternion.copy(this._quaternionStart), this.object.scale.copy(this._scaleStart), this.dispatchEvent(Et), this.dispatchEvent(fn), this.pointStart.copy(this.pointEnd));
|
|
632
632
|
}
|
|
633
633
|
/**
|
|
634
634
|
* Returns the raycaster that is used for user interaction. This object is shared between all
|
|
@@ -708,7 +708,7 @@ class si extends Rn {
|
|
|
708
708
|
i.xAxis.color.set(e), i.yAxis.color.set(t), i.zAxis.color.set(s), i.active.color.set(n), i.xAxisTransparent.color.set(e), i.yAxisTransparent.color.set(t), i.zAxisTransparent.color.set(s), i.activeTransparent.color.set(n), i.xAxis._color && i.xAxis._color.set(e), i.yAxis._color && i.yAxis._color.set(t), i.zAxis._color && i.zAxis._color.set(s), i.active._color && i.active._color.set(n), i.xAxisTransparent._color && i.xAxisTransparent._color.set(e), i.yAxisTransparent._color && i.yAxisTransparent._color.set(t), i.zAxisTransparent._color && i.zAxisTransparent._color.set(s), i.activeTransparent._color && i.activeTransparent._color.set(n);
|
|
709
709
|
}
|
|
710
710
|
}
|
|
711
|
-
function
|
|
711
|
+
function oi(r) {
|
|
712
712
|
if (this.domElement.ownerDocument.pointerLockElement)
|
|
713
713
|
return {
|
|
714
714
|
x: 0,
|
|
@@ -724,7 +724,7 @@ function ii(r) {
|
|
|
724
724
|
};
|
|
725
725
|
}
|
|
726
726
|
}
|
|
727
|
-
function
|
|
727
|
+
function ri(r) {
|
|
728
728
|
if (this.enabled)
|
|
729
729
|
switch (r.pointerType) {
|
|
730
730
|
case "mouse":
|
|
@@ -733,13 +733,13 @@ function oi(r) {
|
|
|
733
733
|
break;
|
|
734
734
|
}
|
|
735
735
|
}
|
|
736
|
-
function
|
|
736
|
+
function ai(r) {
|
|
737
737
|
this.enabled && (document.pointerLockElement || this.domElement.setPointerCapture(r.pointerId), this.domElement.addEventListener("pointermove", this._onPointerMove), this.pointerHover(this._getPointer(r)), this.pointerDown(this._getPointer(r)));
|
|
738
738
|
}
|
|
739
|
-
function
|
|
739
|
+
function li(r) {
|
|
740
740
|
this.enabled && this.pointerMove(this._getPointer(r));
|
|
741
741
|
}
|
|
742
|
-
function
|
|
742
|
+
function ci(r) {
|
|
743
743
|
this.enabled && (this.domElement.releasePointerCapture(r.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.pointerUp(this._getPointer(r)));
|
|
744
744
|
}
|
|
745
745
|
function Rt(r, e, t) {
|
|
@@ -749,8 +749,8 @@ function Rt(r, e, t) {
|
|
|
749
749
|
return s[n];
|
|
750
750
|
return !1;
|
|
751
751
|
}
|
|
752
|
-
const dt = new
|
|
753
|
-
class
|
|
752
|
+
const dt = new ps(), L = new M(0, 1, 0), pn = new M(0, 0, 0), mn = new me(), ht = new K(), bt = new K(), oe = new M(), gn = new me(), Ye = new M(1, 0, 0), we = new M(0, 1, 0), Ke = new M(0, 0, 1), ft = new M(), Fe = new M(), qe = new M();
|
|
753
|
+
class ui extends ke {
|
|
754
754
|
constructor(e) {
|
|
755
755
|
super(), this.isTransformControlsRoot = !0, this.controls = e, this.visible = !1;
|
|
756
756
|
}
|
|
@@ -765,7 +765,7 @@ class ci extends ke {
|
|
|
765
765
|
});
|
|
766
766
|
}
|
|
767
767
|
}
|
|
768
|
-
class
|
|
768
|
+
class Ai extends ke {
|
|
769
769
|
constructor() {
|
|
770
770
|
super(), this.isTransformControlsGizmo = !0, this.type = "TransformControlsGizmo";
|
|
771
771
|
const e = new Pe({
|
|
@@ -923,7 +923,7 @@ class ui extends ke {
|
|
|
923
923
|
]
|
|
924
924
|
}, Q = {
|
|
925
925
|
XYZE: [
|
|
926
|
-
[new v(new
|
|
926
|
+
[new v(new fs(0.25, 10, 8), s)]
|
|
927
927
|
],
|
|
928
928
|
X: [
|
|
929
929
|
[new v(new Ge(0.5, 0.1, 4, 24), s), [0, 0, 0], [0, -Math.PI / 2, -Math.PI / 2]]
|
|
@@ -990,7 +990,7 @@ class ui extends ke {
|
|
|
990
990
|
XYZ: [
|
|
991
991
|
[new v(new q(0.2, 0.2, 0.2), s), [0, 0, 0]]
|
|
992
992
|
]
|
|
993
|
-
},
|
|
993
|
+
}, _n = {
|
|
994
994
|
X: [
|
|
995
995
|
[new ue(g, n), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]
|
|
996
996
|
],
|
|
@@ -1005,14 +1005,14 @@ class ui extends ke {
|
|
|
1005
1005
|
const rt = new ke();
|
|
1006
1006
|
for (const ne in $)
|
|
1007
1007
|
for (let Ee = $[ne].length; Ee--; ) {
|
|
1008
|
-
const B = $[ne][Ee][0].clone(), at = $[ne][Ee][1], lt = $[ne][Ee][2], ct = $[ne][Ee][3],
|
|
1009
|
-
B.name = ne, B.tag =
|
|
1010
|
-
const
|
|
1011
|
-
|
|
1008
|
+
const B = $[ne][Ee][0].clone(), at = $[ne][Ee][1], lt = $[ne][Ee][2], ct = $[ne][Ee][3], $n = $[ne][Ee][4];
|
|
1009
|
+
B.name = ne, B.tag = $n, at && B.position.set(at[0], at[1], at[2]), lt && B.rotation.set(lt[0], lt[1], lt[2]), ct && B.scale.set(ct[0], ct[1], ct[2]), B.updateMatrix();
|
|
1010
|
+
const tn = B.geometry.clone();
|
|
1011
|
+
tn.applyMatrix4(B.matrix), B.geometry = tn, B.renderOrder = 1 / 0, B.position.set(0, 0, 0), B.rotation.set(0, 0, 0), B.scale.set(1, 1, 1), rt.add(B);
|
|
1012
1012
|
}
|
|
1013
1013
|
return rt;
|
|
1014
1014
|
}
|
|
1015
|
-
this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = ce(w)), this.add(this.gizmo.rotate = ce(Z)), this.add(this.gizmo.scale = ce(ye)), this.add(this.picker.translate = ce(D)), this.add(this.picker.rotate = ce(Q)), this.add(this.picker.scale = ce(Pt)), this.add(this.helper.translate = ce(S)), this.add(this.helper.rotate = ce(_)), this.add(this.helper.scale = ce(
|
|
1015
|
+
this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = ce(w)), this.add(this.gizmo.rotate = ce(Z)), this.add(this.gizmo.scale = ce(ye)), this.add(this.picker.translate = ce(D)), this.add(this.picker.rotate = ce(Q)), this.add(this.picker.scale = ce(Pt)), this.add(this.helper.translate = ce(S)), this.add(this.helper.rotate = ce(_)), this.add(this.helper.scale = ce(_n)), this.picker.translate.visible = !1, this.picker.rotate.visible = !1, this.picker.scale.visible = !1;
|
|
1016
1016
|
}
|
|
1017
1017
|
// updateMatrixWorld will update transformations and appearance of individual handles
|
|
1018
1018
|
updateMatrixWorld(e) {
|
|
@@ -1025,21 +1025,21 @@ class ui extends ke {
|
|
|
1025
1025
|
o.visible = !0, o.rotation.set(0, 0, 0), o.position.copy(this.worldPosition);
|
|
1026
1026
|
let a;
|
|
1027
1027
|
if (this.camera.isOrthographicCamera ? a = (this.camera.top - this.camera.bottom) / this.camera.zoom : a = this.worldPosition.distanceTo(this.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * this.camera.fov / 360) / this.camera.zoom, 7), o.scale.set(1, 1, 1).multiplyScalar(a * this.size / 4), o.tag === "helper") {
|
|
1028
|
-
o.visible = !1, o.name === "AXIS" ? (o.visible = !!this.axis, this.axis === "X" && (k.setFromEuler(dt.set(0, 0, 0)), o.quaternion.copy(s).multiply(k), Math.abs(L.copy(Ye).applyQuaternion(s).dot(this.eye)) > 0.9 && (o.visible = !1)), this.axis === "Y" && (k.setFromEuler(dt.set(0, 0, Math.PI / 2)), o.quaternion.copy(s).multiply(k), Math.abs(L.copy(we).applyQuaternion(s).dot(this.eye)) > 0.9 && (o.visible = !1)), this.axis === "Z" && (k.setFromEuler(dt.set(0, Math.PI / 2, 0)), o.quaternion.copy(s).multiply(k), Math.abs(L.copy(Ke).applyQuaternion(s).dot(this.eye)) > 0.9 && (o.visible = !1)), this.axis === "XYZE" && (k.setFromEuler(dt.set(0, Math.PI / 2, 0)), L.copy(this.rotationAxis), o.quaternion.setFromRotationMatrix(
|
|
1028
|
+
o.visible = !1, o.name === "AXIS" ? (o.visible = !!this.axis, this.axis === "X" && (k.setFromEuler(dt.set(0, 0, 0)), o.quaternion.copy(s).multiply(k), Math.abs(L.copy(Ye).applyQuaternion(s).dot(this.eye)) > 0.9 && (o.visible = !1)), this.axis === "Y" && (k.setFromEuler(dt.set(0, 0, Math.PI / 2)), o.quaternion.copy(s).multiply(k), Math.abs(L.copy(we).applyQuaternion(s).dot(this.eye)) > 0.9 && (o.visible = !1)), this.axis === "Z" && (k.setFromEuler(dt.set(0, Math.PI / 2, 0)), o.quaternion.copy(s).multiply(k), Math.abs(L.copy(Ke).applyQuaternion(s).dot(this.eye)) > 0.9 && (o.visible = !1)), this.axis === "XYZE" && (k.setFromEuler(dt.set(0, Math.PI / 2, 0)), L.copy(this.rotationAxis), o.quaternion.setFromRotationMatrix(mn.lookAt(pn, L, we)), o.quaternion.multiply(k), o.visible = this.dragging), this.axis === "E" && (o.visible = !1)) : o.name === "START" ? (o.position.copy(this.worldPositionStart), o.visible = this.dragging) : o.name === "END" ? (o.position.copy(this.worldPosition), o.visible = this.dragging) : o.name === "DELTA" ? (o.position.copy(this.worldPositionStart), o.quaternion.copy(this.worldQuaternionStart), F.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1), F.applyQuaternion(this.worldQuaternionStart.clone().invert()), o.scale.copy(F), o.visible = this.dragging) : (o.quaternion.copy(s), this.dragging ? o.position.copy(this.worldPositionStart) : o.position.copy(this.worldPosition), this.axis && (o.visible = this.axis.search(o.name) !== -1));
|
|
1029
1029
|
continue;
|
|
1030
1030
|
}
|
|
1031
|
-
o.quaternion.copy(s), this.mode === "translate" || this.mode === "scale" ? (o.name === "X" && Math.abs(L.copy(Ye).applyQuaternion(s).dot(this.eye)) > 0.99 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1), o.name === "Y" && Math.abs(L.copy(we).applyQuaternion(s).dot(this.eye)) > 0.99 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1), o.name === "Z" && Math.abs(L.copy(Ke).applyQuaternion(s).dot(this.eye)) > 0.99 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1), o.name === "XY" && Math.abs(L.copy(Ke).applyQuaternion(s).dot(this.eye)) < 0.2 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1), o.name === "YZ" && Math.abs(L.copy(Ye).applyQuaternion(s).dot(this.eye)) < 0.2 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1), o.name === "XZ" && Math.abs(L.copy(we).applyQuaternion(s).dot(this.eye)) < 0.2 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1)) : this.mode === "rotate" && (ht.copy(s), L.copy(this.eye).applyQuaternion(k.copy(s).invert()), o.name.search("E") !== -1 && o.quaternion.setFromRotationMatrix(
|
|
1031
|
+
o.quaternion.copy(s), this.mode === "translate" || this.mode === "scale" ? (o.name === "X" && Math.abs(L.copy(Ye).applyQuaternion(s).dot(this.eye)) > 0.99 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1), o.name === "Y" && Math.abs(L.copy(we).applyQuaternion(s).dot(this.eye)) > 0.99 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1), o.name === "Z" && Math.abs(L.copy(Ke).applyQuaternion(s).dot(this.eye)) > 0.99 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1), o.name === "XY" && Math.abs(L.copy(Ke).applyQuaternion(s).dot(this.eye)) < 0.2 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1), o.name === "YZ" && Math.abs(L.copy(Ye).applyQuaternion(s).dot(this.eye)) < 0.2 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1), o.name === "XZ" && Math.abs(L.copy(we).applyQuaternion(s).dot(this.eye)) < 0.2 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1)) : this.mode === "rotate" && (ht.copy(s), L.copy(this.eye).applyQuaternion(k.copy(s).invert()), o.name.search("E") !== -1 && o.quaternion.setFromRotationMatrix(mn.lookAt(this.eye, pn, we)), o.name === "X" && (k.setFromAxisAngle(Ye, Math.atan2(-L.y, L.z)), k.multiplyQuaternions(ht, k), o.quaternion.copy(k)), o.name === "Y" && (k.setFromAxisAngle(we, Math.atan2(L.x, L.z)), k.multiplyQuaternions(ht, k), o.quaternion.copy(k)), o.name === "Z" && (k.setFromAxisAngle(Ke, Math.atan2(L.y, L.x)), k.multiplyQuaternions(ht, k), o.quaternion.copy(k))), o.visible = o.visible && (o.name.indexOf("X") === -1 || this.showX), o.visible = o.visible && (o.name.indexOf("Y") === -1 || this.showY), o.visible = o.visible && (o.name.indexOf("Z") === -1 || this.showZ), o.visible = o.visible && (o.name.indexOf("E") === -1 || this.showX && this.showY && this.showZ), o.visible = o.visible && (o.name.indexOf("XY") === -1 || this.showXY), o.visible = o.visible && (o.name.indexOf("YZ") === -1 || this.showYZ), o.visible = o.visible && (o.name.indexOf("XZ") === -1 || this.showXZ), o.material._color = o.material._color || o.material.color.clone(), o.material._opacity = o.material._opacity || o.material.opacity, o.material.color.copy(o.material._color), o.material.opacity = o.material._opacity, this.enabled && this.axis && (o.name === this.axis ? (o.material.color.copy(this.materialLib.active.color), o.material.opacity = 1) : this.axis.split("").some(function(l) {
|
|
1032
1032
|
return o.name === l;
|
|
1033
1033
|
}) && (o.material.color.copy(this.materialLib.active.color), o.material.opacity = 1));
|
|
1034
1034
|
}
|
|
1035
1035
|
super.updateMatrixWorld(e);
|
|
1036
1036
|
}
|
|
1037
1037
|
}
|
|
1038
|
-
class
|
|
1038
|
+
class di extends v {
|
|
1039
1039
|
constructor() {
|
|
1040
1040
|
super(
|
|
1041
|
-
new
|
|
1042
|
-
new Pe({ visible: !1, wireframe: !0, side:
|
|
1041
|
+
new ms(1e5, 1e5, 2, 2),
|
|
1042
|
+
new Pe({ visible: !1, wireframe: !0, side: Ln, transparent: !0, opacity: 0.1, toneMapped: !1 })
|
|
1043
1043
|
), this.isTransformControlsPlane = !0, this.type = "TransformControlsPlane";
|
|
1044
1044
|
}
|
|
1045
1045
|
updateMatrixWorld(e) {
|
|
@@ -1076,10 +1076,10 @@ class Ai extends v {
|
|
|
1076
1076
|
default:
|
|
1077
1077
|
oe.set(0, 0, 0);
|
|
1078
1078
|
}
|
|
1079
|
-
oe.length() === 0 ? this.quaternion.copy(this.cameraQuaternion) : (
|
|
1079
|
+
oe.length() === 0 ? this.quaternion.copy(this.cameraQuaternion) : (gn.lookAt(F.set(0, 0, 0), oe, L), this.quaternion.setFromRotationMatrix(gn)), super.updateMatrixWorld(e);
|
|
1080
1080
|
}
|
|
1081
1081
|
}
|
|
1082
|
-
class
|
|
1082
|
+
class hi extends ke {
|
|
1083
1083
|
/**
|
|
1084
1084
|
* Constructs a new CSS2D object.
|
|
1085
1085
|
*
|
|
@@ -1096,8 +1096,8 @@ class di extends ke {
|
|
|
1096
1096
|
return super.copy(e, t), this.element = e.element.cloneNode(!0), this.center = e.center, this;
|
|
1097
1097
|
}
|
|
1098
1098
|
}
|
|
1099
|
-
const Se = new M(),
|
|
1100
|
-
class
|
|
1099
|
+
const Se = new M(), bn = new me(), In = new me(), yn = new M(), Cn = new M();
|
|
1100
|
+
class fi {
|
|
1101
1101
|
/**
|
|
1102
1102
|
* Constructs a new CSS2D renderer.
|
|
1103
1103
|
*
|
|
@@ -1115,7 +1115,7 @@ class hi {
|
|
|
1115
1115
|
height: n
|
|
1116
1116
|
};
|
|
1117
1117
|
}, this.render = function(p, m) {
|
|
1118
|
-
p.matrixWorldAutoUpdate === !0 && p.updateMatrixWorld(), m.parent === null && m.matrixWorldAutoUpdate === !0 && m.updateMatrixWorld(),
|
|
1118
|
+
p.matrixWorldAutoUpdate === !0 && p.updateMatrixWorld(), m.parent === null && m.matrixWorldAutoUpdate === !0 && m.updateMatrixWorld(), bn.copy(m.matrixWorldInverse), In.multiplyMatrices(m.projectionMatrix, bn), A(p, p, m), this.sortObjects && d(p);
|
|
1119
1119
|
}, this.setSize = function(p, m) {
|
|
1120
1120
|
s = p, n = m, i = s / 2, o = n / 2, l.style.width = p + "px", l.style.height = m + "px";
|
|
1121
1121
|
};
|
|
@@ -1130,7 +1130,7 @@ class hi {
|
|
|
1130
1130
|
return;
|
|
1131
1131
|
}
|
|
1132
1132
|
if (p.isCSS2DObject) {
|
|
1133
|
-
Se.setFromMatrixPosition(p.matrixWorld), Se.applyMatrix4(
|
|
1133
|
+
Se.setFromMatrixPosition(p.matrixWorld), Se.applyMatrix4(In);
|
|
1134
1134
|
const g = Se.z >= -1 && Se.z <= 1 && p.layers.test(f.layers) === !0, x = p.element;
|
|
1135
1135
|
x.style.display = g === !0 ? "" : "none", g === !0 && (p.onBeforeRender(t, m, f), x.style.transform = "translate(" + -100 * p.center.x + "%," + -100 * p.center.y + "%)translate(" + (Se.x * i + i) + "px," + (-Se.y * o + o) + "px)", x.parentNode !== l && l.appendChild(x), p.onAfterRender(t, m, f));
|
|
1136
1136
|
const y = {
|
|
@@ -1142,7 +1142,7 @@ class hi {
|
|
|
1142
1142
|
A(p.children[g], m, f);
|
|
1143
1143
|
}
|
|
1144
1144
|
function u(p, m) {
|
|
1145
|
-
return
|
|
1145
|
+
return yn.setFromMatrixPosition(p.matrixWorld), Cn.setFromMatrixPosition(m.matrixWorld), yn.distanceToSquared(Cn);
|
|
1146
1146
|
}
|
|
1147
1147
|
function h(p) {
|
|
1148
1148
|
const m = [];
|
|
@@ -1162,15 +1162,15 @@ class hi {
|
|
|
1162
1162
|
}
|
|
1163
1163
|
}
|
|
1164
1164
|
}
|
|
1165
|
-
const
|
|
1166
|
-
document.documentElement.style.setProperty("--sl-css2d-base-font-size",
|
|
1165
|
+
const pi = 1920, mi = 13, gi = 0.6, bi = 4, Ii = window.innerWidth / pi, yi = Math.min(Math.max(Ii, gi), bi), Ci = Math.round(mi * yi);
|
|
1166
|
+
document.documentElement.style.setProperty("--sl-css2d-base-font-size", Ci + "px");
|
|
1167
1167
|
const Xe = {
|
|
1168
1168
|
panel: "sl-css2d-data-panel",
|
|
1169
1169
|
title: "sl-css2d-data-panel-title",
|
|
1170
1170
|
list: "sl-css2d-data-panel-list",
|
|
1171
1171
|
arrow: "sl-css2d-data-panel-arrow",
|
|
1172
1172
|
item: "sl-css2d-data-panel-item"
|
|
1173
|
-
},
|
|
1173
|
+
}, xi = "--sl-css2d-base-font-size";
|
|
1174
1174
|
class it {
|
|
1175
1175
|
constructor(e = {}) {
|
|
1176
1176
|
/** CSS2DObject 实例 */
|
|
@@ -1211,7 +1211,7 @@ class it {
|
|
|
1211
1211
|
border-radius: ${t(8)}em;
|
|
1212
1212
|
padding: ${t(10)}em ${t(14)}em;
|
|
1213
1213
|
font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
|
|
1214
|
-
font-size: var(${
|
|
1214
|
+
font-size: var(${xi}, 13px);
|
|
1215
1215
|
line-height: 1.7;
|
|
1216
1216
|
box-shadow: 0 ${t(4)}em ${t(16)}em rgba(0, 0, 0, 0.4);
|
|
1217
1217
|
backdrop-filter: blur(4px);
|
|
@@ -1275,7 +1275,7 @@ class it {
|
|
|
1275
1275
|
const t = new P.Box3().setFromObject(e), s = new P.Vector3();
|
|
1276
1276
|
t.getSize(s);
|
|
1277
1277
|
const n = s.y / 2 + this.options.offsetY;
|
|
1278
|
-
this.css2dObject || (this.css2dObject = new
|
|
1278
|
+
this.css2dObject || (this.css2dObject = new hi(this.container), this.css2dObject.name = `DataPanel_${e.name || e.uuid}`, this.css2dObject.center.set(0.5, 1)), this.css2dObject.position.set(0, n, 0), e.add(this.css2dObject), this.attachedObject = e;
|
|
1279
1279
|
}
|
|
1280
1280
|
/**
|
|
1281
1281
|
* 从附着的物体上移除面板
|
|
@@ -1411,31 +1411,31 @@ class it {
|
|
|
1411
1411
|
}
|
|
1412
1412
|
}
|
|
1413
1413
|
const xt = /* @__PURE__ */ new WeakMap();
|
|
1414
|
-
function
|
|
1414
|
+
function Xn(r, e) {
|
|
1415
1415
|
const t = vt(r);
|
|
1416
1416
|
xt.set(t, e), t.userData._hasDataPanel = !0;
|
|
1417
1417
|
}
|
|
1418
1418
|
function Jt(r) {
|
|
1419
1419
|
return xt.get(vt(r)) || null;
|
|
1420
1420
|
}
|
|
1421
|
-
function
|
|
1421
|
+
function wi(r) {
|
|
1422
1422
|
const e = vt(r), t = xt.get(e);
|
|
1423
1423
|
t && (t.dispose(), xt.delete(e)), e.userData._hasDataPanel = void 0;
|
|
1424
1424
|
}
|
|
1425
1425
|
let W = null;
|
|
1426
|
-
function
|
|
1427
|
-
return W ? (W.domElement.parentNode !== r && r.appendChild(W.domElement), W) : (W = new
|
|
1426
|
+
function vi(r) {
|
|
1427
|
+
return W ? (W.domElement.parentNode !== r && r.appendChild(W.domElement), W) : (W = new fi(), W.setSize(r.clientWidth, r.clientHeight), W.domElement.style.position = "absolute", W.domElement.style.top = "0", W.domElement.style.left = "0", W.domElement.style.pointerEvents = "none", r.appendChild(W.domElement), W);
|
|
1428
1428
|
}
|
|
1429
1429
|
function ka() {
|
|
1430
1430
|
return W;
|
|
1431
1431
|
}
|
|
1432
|
-
function
|
|
1432
|
+
function Mi(r, e) {
|
|
1433
1433
|
W && W.render(r, e);
|
|
1434
1434
|
}
|
|
1435
|
-
function
|
|
1435
|
+
function Di(r, e) {
|
|
1436
1436
|
W && W.setSize(r, e);
|
|
1437
1437
|
}
|
|
1438
|
-
function
|
|
1438
|
+
function Pi() {
|
|
1439
1439
|
W && (W.domElement.parentNode && W.domElement.parentNode.removeChild(W.domElement), W = null);
|
|
1440
1440
|
}
|
|
1441
1441
|
const I = {
|
|
@@ -1463,21 +1463,21 @@ const I = {
|
|
|
1463
1463
|
selectedObject: null
|
|
1464
1464
|
};
|
|
1465
1465
|
let It = !1, Oe = !1, Ut = [];
|
|
1466
|
-
const
|
|
1466
|
+
const Ti = 16755200;
|
|
1467
1467
|
let Te = null, Vt = null, yt = null, ge = [];
|
|
1468
1468
|
const ot = /* @__PURE__ */ new Map();
|
|
1469
1469
|
let wt, Ct = null, et = null, tt = null;
|
|
1470
|
-
function
|
|
1471
|
-
I.container = r, I.mode = e,
|
|
1470
|
+
function Oi(r, e = "edit", t) {
|
|
1471
|
+
I.container = r, I.mode = e, Ei(), Ri(), Hi(), t && (io(t.scene, e, t.dataPanels), t != null && t.camera && (I.defaultMainCamera = t.camera, Bn(!0))), Ni(), Li(), wt && I.orbitControls && (I.orbitControls.target.fromArray(wt), I.orbitControls.update()), Qi(), Un(), et = (s) => Gi(s), tt = () => ki(), e === "edit" && r.addEventListener("click", et), window.addEventListener("resize", tt), t || ji(), e === "edit" && Si();
|
|
1472
1472
|
}
|
|
1473
|
-
function
|
|
1473
|
+
function Ei() {
|
|
1474
1474
|
const r = new P.WebGLRenderer({ antialias: !0, alpha: !0 });
|
|
1475
1475
|
r.setSize(I.container.clientWidth, I.container.clientHeight), r.setPixelRatio(Math.min(window.devicePixelRatio, 2)), r.shadowMap.enabled = !0, r.shadowMap.type = P.PCFSoftShadowMap, I.container.appendChild(r.domElement), I.renderer = r;
|
|
1476
1476
|
}
|
|
1477
|
-
function
|
|
1477
|
+
function Ri() {
|
|
1478
1478
|
I.scene = new P.Scene(), I.scene.name = "sl_scene";
|
|
1479
1479
|
}
|
|
1480
|
-
function
|
|
1480
|
+
function Si() {
|
|
1481
1481
|
const r = new P.GridHelper(30, 30, 8956671, 3364232);
|
|
1482
1482
|
r.name = "地板", r.userData.type = "initFloor", I.scene.add(r), I.gridHelper = r;
|
|
1483
1483
|
const e = new P.PlaneGeometry(30, 30), t = new P.ShadowMaterial({
|
|
@@ -1486,11 +1486,11 @@ function Ri() {
|
|
|
1486
1486
|
}), s = new P.Mesh(e, t);
|
|
1487
1487
|
s.rotation.x = -Math.PI / 2, s.position.y = -0.01, s.name = "阴影接收平面", s.userData.type = "initFloor", s.receiveShadow = !0, I.scene.add(s);
|
|
1488
1488
|
}
|
|
1489
|
-
function
|
|
1489
|
+
function Hi() {
|
|
1490
1490
|
const r = I.container, e = r.clientWidth / r.clientHeight, t = new P.PerspectiveCamera(45, e, 0.1, 1e3);
|
|
1491
1491
|
t.position.set(0, 6, 15), t.lookAt(0, 0, 0), I.camera = t;
|
|
1492
1492
|
}
|
|
1493
|
-
function
|
|
1493
|
+
function Bn(r = !1) {
|
|
1494
1494
|
if (!I.defaultMainCamera) return;
|
|
1495
1495
|
const e = I.defaultMainCamera;
|
|
1496
1496
|
if (r) {
|
|
@@ -1504,7 +1504,8 @@ function Xn(r = !1) {
|
|
|
1504
1504
|
e.rotation[2]
|
|
1505
1505
|
), I.camera.updateProjectionMatrix(), wt = e.target;
|
|
1506
1506
|
return;
|
|
1507
|
-
}
|
|
1507
|
+
} else
|
|
1508
|
+
Yn(""), $t();
|
|
1508
1509
|
if (!I.camera || !I.orbitControls) return;
|
|
1509
1510
|
const t = I.camera.position.clone(), s = I.orbitControls.target.clone(), n = new P.Vector3(
|
|
1510
1511
|
e.position[0],
|
|
@@ -1534,8 +1535,8 @@ function Xn(r = !1) {
|
|
|
1534
1535
|
wt = e.target, I.orbitControls.enabled = !0;
|
|
1535
1536
|
}).start();
|
|
1536
1537
|
}
|
|
1537
|
-
function
|
|
1538
|
-
const r = new
|
|
1538
|
+
function Li() {
|
|
1539
|
+
const r = new Us(I.camera, I.renderer.domElement);
|
|
1539
1540
|
r.minDistance = 0, r.maxDistance = 1 / 0, r.addEventListener("start", () => {
|
|
1540
1541
|
It = !1;
|
|
1541
1542
|
}), r.addEventListener("change", () => {
|
|
@@ -1546,8 +1547,8 @@ function Hi() {
|
|
|
1546
1547
|
}, 200));
|
|
1547
1548
|
}), I.orbitControls = r;
|
|
1548
1549
|
}
|
|
1549
|
-
function
|
|
1550
|
-
const r = new
|
|
1550
|
+
function Ni() {
|
|
1551
|
+
const r = new ii(
|
|
1551
1552
|
I.camera,
|
|
1552
1553
|
I.renderer.domElement
|
|
1553
1554
|
);
|
|
@@ -1563,13 +1564,13 @@ function Li() {
|
|
|
1563
1564
|
}
|
|
1564
1565
|
}), I.scene.add(r.getHelper()), I.transformControls = r;
|
|
1565
1566
|
}
|
|
1566
|
-
function
|
|
1567
|
+
function ji() {
|
|
1567
1568
|
const r = new P.AmbientLight(16777215, 1);
|
|
1568
1569
|
I.scene.add(r);
|
|
1569
1570
|
}
|
|
1570
|
-
function
|
|
1571
|
+
function Un() {
|
|
1571
1572
|
var r, e;
|
|
1572
|
-
Ct = requestAnimationFrame(
|
|
1573
|
+
Ct = requestAnimationFrame(Un), st.update(), (r = I.orbitControls) == null || r.update(), (e = I.renderer) == null || e.render(I.scene, I.camera), I.scene && I.camera && Mi(I.scene, I.camera), I.scene && I.scene.traverse((t) => {
|
|
1573
1574
|
if (t.userData.isWater && t.type === "Mesh") {
|
|
1574
1575
|
const s = t, n = s.material;
|
|
1575
1576
|
if (n.normalMap) {
|
|
@@ -1579,49 +1580,44 @@ function Bn() {
|
|
|
1579
1580
|
}
|
|
1580
1581
|
});
|
|
1581
1582
|
}
|
|
1582
|
-
function
|
|
1583
|
+
function ki() {
|
|
1583
1584
|
if (!I.container || !I.camera || !I.renderer) return;
|
|
1584
1585
|
const r = I.container.clientWidth, e = I.container.clientHeight;
|
|
1585
|
-
r === 0 || e === 0 || (I.camera.aspect = r / e, I.camera.updateProjectionMatrix(), I.renderer.setSize(r, e),
|
|
1586
|
+
r === 0 || e === 0 || (I.camera.aspect = r / e, I.camera.updateProjectionMatrix(), I.renderer.setSize(r, e), Di(r, e));
|
|
1586
1587
|
}
|
|
1587
1588
|
function _t(r) {
|
|
1588
|
-
I.selectedObject !== r && (I.selectedObject && I.transformControls.detach(), I.selectedObject = r, I.transformControls.attach(r), I.transformControls.setMode(I.transformControlsMode), I.transformControls.showX = !0, I.transformControls.showY = !0, I.transformControls.showZ = !0,
|
|
1589
|
+
I.selectedObject !== r && (I.selectedObject && I.transformControls.detach(), I.selectedObject = r, I.transformControls.attach(r), I.transformControls.setMode(I.transformControlsMode), I.transformControls.showX = !0, I.transformControls.showY = !0, I.transformControls.showZ = !0, Vn(r), console.log("选中", I.selectedObject), Te == null || Te(r));
|
|
1589
1590
|
}
|
|
1590
1591
|
let J = null;
|
|
1591
|
-
function
|
|
1592
|
+
function Wi(r) {
|
|
1592
1593
|
J = r;
|
|
1593
1594
|
}
|
|
1594
1595
|
function St(r) {
|
|
1595
1596
|
J == null || J(r);
|
|
1596
1597
|
}
|
|
1597
|
-
function
|
|
1598
|
+
function zi(r) {
|
|
1598
1599
|
I.transformControlsMode = r, I.transformControls && I.transformControls.setMode(I.transformControlsMode);
|
|
1599
1600
|
}
|
|
1600
|
-
function
|
|
1601
|
-
|
|
1601
|
+
function Vn(r) {
|
|
1602
|
+
$t(), r.traverse((e) => {
|
|
1602
1603
|
if (e.isMesh) {
|
|
1603
1604
|
const t = e, s = new P.EdgesGeometry(t.geometry), n = new P.LineBasicMaterial({
|
|
1604
|
-
color:
|
|
1605
|
+
color: Ti,
|
|
1605
1606
|
depthTest: !0
|
|
1606
1607
|
}), i = new P.LineSegments(s, n);
|
|
1607
1608
|
e.add(i), Ut.push(i);
|
|
1608
1609
|
}
|
|
1609
1610
|
});
|
|
1610
1611
|
}
|
|
1611
|
-
function
|
|
1612
|
+
function $t() {
|
|
1612
1613
|
for (const r of Ut)
|
|
1613
1614
|
r.parent && r.parent.remove(r), r.geometry.dispose(), r.material.dispose();
|
|
1614
1615
|
Ut = [];
|
|
1615
1616
|
}
|
|
1616
|
-
function
|
|
1617
|
-
I.selectedObject && (
|
|
1617
|
+
function en() {
|
|
1618
|
+
I.selectedObject && ($t(), I.transformControls.detach(), I.selectedObject = null, Te == null || Te(null));
|
|
1618
1619
|
}
|
|
1619
|
-
function
|
|
1620
|
-
if (!r) {
|
|
1621
|
-
console.warn("[selectModelHandle] 传入的 objectId 为空");
|
|
1622
|
-
return;
|
|
1623
|
-
}
|
|
1624
|
-
qi(r);
|
|
1620
|
+
function Yn(r) {
|
|
1625
1621
|
let e = null;
|
|
1626
1622
|
ot.forEach((t) => {
|
|
1627
1623
|
t.userData.id == r && (e = t), t.children && t.children.forEach((s) => {
|
|
@@ -1629,7 +1625,7 @@ function zi(r) {
|
|
|
1629
1625
|
});
|
|
1630
1626
|
}), e && (e.children.forEach((t) => {
|
|
1631
1627
|
t.name && t.name.startsWith("DataPanel_") && (t.visible = !0);
|
|
1632
|
-
}),
|
|
1628
|
+
}), Vn(e), qi(r));
|
|
1633
1629
|
}
|
|
1634
1630
|
function Gi(r) {
|
|
1635
1631
|
if (Oe) {
|
|
@@ -1650,7 +1646,7 @@ function Gi(r) {
|
|
|
1650
1646
|
let o = Fi(i[0].object);
|
|
1651
1647
|
_t(o);
|
|
1652
1648
|
} else
|
|
1653
|
-
|
|
1649
|
+
en();
|
|
1654
1650
|
}
|
|
1655
1651
|
function Fi(r) {
|
|
1656
1652
|
if (r.type === "Line") {
|
|
@@ -1734,7 +1730,7 @@ function ze(r, e = !1) {
|
|
|
1734
1730
|
I.scene.add(r), r.userData.isMovable && (Ki(r), Dt()), e && I.mode === "edit" && _t(r);
|
|
1735
1731
|
}
|
|
1736
1732
|
function Vi(r) {
|
|
1737
|
-
I.selectedObject === r &&
|
|
1733
|
+
I.selectedObject === r && en(), Ui(r), Bi(r), r.userData.helper && I.scene.remove(r.userData.helper), r.parent ? r.parent.remove(r) : I.scene.remove(r), Zi(r), Dt();
|
|
1738
1734
|
}
|
|
1739
1735
|
function Yi(r) {
|
|
1740
1736
|
const e = I.scene.getObjectByProperty("uuid", r);
|
|
@@ -1790,7 +1786,7 @@ function Ga() {
|
|
|
1790
1786
|
}
|
|
1791
1787
|
async function so() {
|
|
1792
1788
|
var c, A, u;
|
|
1793
|
-
J == null || J(!0), await new Promise((h) => setTimeout(h, 50)),
|
|
1789
|
+
J == null || J(!0), await new Promise((h) => setTimeout(h, 50)), en();
|
|
1794
1790
|
const r = I.scene;
|
|
1795
1791
|
if (!r)
|
|
1796
1792
|
return J == null || J(!1), "{}";
|
|
@@ -1866,7 +1862,7 @@ function io(r, e = "edit", t) {
|
|
|
1866
1862
|
title: u.title,
|
|
1867
1863
|
items: u.items
|
|
1868
1864
|
});
|
|
1869
|
-
h.attachTo(c), h.visible = !1, u.width && h.setWidth(u.width), u.fontSize && h.setFontSize(u.fontSize),
|
|
1865
|
+
h.attachTo(c), h.visible = !1, u.width && h.setWidth(u.width), u.fontSize && h.setFontSize(u.fontSize), Xn(c, h);
|
|
1870
1866
|
}
|
|
1871
1867
|
})), e === "edit" && ((l = I.scene) == null || l.traverse((c) => {
|
|
1872
1868
|
var A;
|
|
@@ -1879,7 +1875,7 @@ function io(r, e = "edit", t) {
|
|
|
1879
1875
|
}
|
|
1880
1876
|
}));
|
|
1881
1877
|
}
|
|
1882
|
-
function
|
|
1878
|
+
function Kn(r) {
|
|
1883
1879
|
if (!r) return;
|
|
1884
1880
|
if (r.type === "Mesh") {
|
|
1885
1881
|
const t = r;
|
|
@@ -1889,12 +1885,12 @@ function Yn(r) {
|
|
|
1889
1885
|
}
|
|
1890
1886
|
const e = r.children.slice();
|
|
1891
1887
|
for (const t of e)
|
|
1892
|
-
|
|
1888
|
+
Kn(t);
|
|
1893
1889
|
}
|
|
1894
1890
|
function oo() {
|
|
1895
|
-
Ct !== null && (cancelAnimationFrame(Ct), Ct = null), et && I.container && (I.container.removeEventListener("click", et), et = null), tt && (window.removeEventListener("resize", tt), tt = null), I.orbitControls && (I.orbitControls.dispose(), I.orbitControls = null), I.transformControls && (I.transformControls.dispose(), I.transformControls = null), I.scene && (
|
|
1891
|
+
Ct !== null && (cancelAnimationFrame(Ct), Ct = null), et && I.container && (I.container.removeEventListener("click", et), et = null), tt && (window.removeEventListener("resize", tt), tt = null), I.orbitControls && (I.orbitControls.dispose(), I.orbitControls = null), I.transformControls && (I.transformControls.dispose(), I.transformControls = null), I.scene && (Kn(I.scene), I.scene = null), I.renderer && (I.renderer.dispose(), I.renderer.domElement && I.container && I.container.removeChild(I.renderer.domElement), I.renderer = null), Pi(), I.camera = null, I.gridHelper = null, I.selectedObject = null, I.container = null, I.mode = "", ge = [], ot.clear(), Dt(), It = !1, Oe = !1;
|
|
1896
1892
|
}
|
|
1897
|
-
const ro = /^[og]\s*(.+)?/, ao = /^mtllib /, lo = /^usemtl /, co = /^usemap /,
|
|
1893
|
+
const ro = /^[og]\s*(.+)?/, ao = /^mtllib /, lo = /^usemtl /, co = /^usemap /, xn = /\s+/, wn = new M(), Ht = new M(), vn = new M(), Mn = new M(), ee = new M(), pt = new de();
|
|
1898
1894
|
function uo() {
|
|
1899
1895
|
const r = {
|
|
1900
1896
|
objects: [],
|
|
@@ -2004,7 +2000,7 @@ function uo() {
|
|
|
2004
2000
|
},
|
|
2005
2001
|
addFaceNormal: function(e, t, s) {
|
|
2006
2002
|
const n = this.vertices, i = this.object.geometry.normals;
|
|
2007
|
-
|
|
2003
|
+
wn.fromArray(n, e), Ht.fromArray(n, t), vn.fromArray(n, s), ee.subVectors(vn, Ht), Mn.subVectors(wn, Ht), ee.cross(Mn), ee.normalize(), i.push(ee.x, ee.y, ee.z), i.push(ee.x, ee.y, ee.z), i.push(ee.x, ee.y, ee.z);
|
|
2008
2004
|
},
|
|
2009
2005
|
addColor: function(e, t, s) {
|
|
2010
2006
|
const n = this.colors, i = this.object.geometry.colors;
|
|
@@ -2113,7 +2109,7 @@ class Ao extends Zt {
|
|
|
2113
2109
|
const A = c.charAt(0);
|
|
2114
2110
|
if (A !== "#")
|
|
2115
2111
|
if (A === "v") {
|
|
2116
|
-
const u = c.split(
|
|
2112
|
+
const u = c.split(xn);
|
|
2117
2113
|
switch (u[0]) {
|
|
2118
2114
|
case "v":
|
|
2119
2115
|
t.vertices.push(
|
|
@@ -2142,7 +2138,7 @@ class Ao extends Zt {
|
|
|
2142
2138
|
break;
|
|
2143
2139
|
}
|
|
2144
2140
|
} else if (A === "f") {
|
|
2145
|
-
const h = c.slice(1).trim().split(
|
|
2141
|
+
const h = c.slice(1).trim().split(xn), d = [];
|
|
2146
2142
|
for (let m = 0, f = h.length; m < f; m++) {
|
|
2147
2143
|
const g = h[m];
|
|
2148
2144
|
if (g.length > 0) {
|
|
@@ -2224,7 +2220,7 @@ class Ao extends Zt {
|
|
|
2224
2220
|
Je.prototype.copy.call(S, D), S.color.copy(D.color), S.map = D.map, D = S;
|
|
2225
2221
|
}
|
|
2226
2222
|
}
|
|
2227
|
-
D === void 0 && (h ? D = new Qe() : d ? D = new Ve({ size: 1, sizeAttenuation: !1 }) : D = new
|
|
2223
|
+
D === void 0 && (h ? D = new Qe() : d ? D = new Ve({ size: 1, sizeAttenuation: !1 }) : D = new gs(), D.name = C.name, D.flatShading = !C.smooth, D.vertexColors = p, t.materials[w] = D), f.push(D);
|
|
2228
2224
|
}
|
|
2229
2225
|
let g;
|
|
2230
2226
|
if (f.length > 1) {
|
|
@@ -2246,10 +2242,10 @@ class Ao extends Zt {
|
|
|
2246
2242
|
return i;
|
|
2247
2243
|
}
|
|
2248
2244
|
}
|
|
2249
|
-
function
|
|
2250
|
-
if (e ===
|
|
2245
|
+
function Dn(r, e) {
|
|
2246
|
+
if (e === bs)
|
|
2251
2247
|
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), r;
|
|
2252
|
-
if (e === Ft || e ===
|
|
2248
|
+
if (e === Ft || e === Nn) {
|
|
2253
2249
|
let t = r.getIndex();
|
|
2254
2250
|
if (t === null) {
|
|
2255
2251
|
const o = [], a = r.getAttribute("position");
|
|
@@ -2275,7 +2271,7 @@ function Mn(r, e) {
|
|
|
2275
2271
|
}
|
|
2276
2272
|
function ho(r) {
|
|
2277
2273
|
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), s = r.clone();
|
|
2278
|
-
return
|
|
2274
|
+
return Zn(r, s, function(n, i) {
|
|
2279
2275
|
e.set(i, n), t.set(n, i);
|
|
2280
2276
|
}), s.traverse(function(n) {
|
|
2281
2277
|
if (!n.isSkinnedMesh) return;
|
|
@@ -2285,10 +2281,10 @@ function ho(r) {
|
|
|
2285
2281
|
}), i.bind(i.skeleton, i.bindMatrix);
|
|
2286
2282
|
}), s;
|
|
2287
2283
|
}
|
|
2288
|
-
function
|
|
2284
|
+
function Zn(r, e, t) {
|
|
2289
2285
|
t(r, e);
|
|
2290
2286
|
for (let s = 0; s < r.children.length; s++)
|
|
2291
|
-
|
|
2287
|
+
Zn(r.children[s], e.children[s], t);
|
|
2292
2288
|
}
|
|
2293
2289
|
class fo extends Zt {
|
|
2294
2290
|
/**
|
|
@@ -2328,9 +2324,9 @@ class fo extends Zt {
|
|
|
2328
2324
|
}), this.register(function(t) {
|
|
2329
2325
|
return new mo(t);
|
|
2330
2326
|
}), this.register(function(t) {
|
|
2331
|
-
return new
|
|
2327
|
+
return new Pn(t, O.EXT_MESHOPT_COMPRESSION);
|
|
2332
2328
|
}), this.register(function(t) {
|
|
2333
|
-
return new
|
|
2329
|
+
return new Pn(t, O.KHR_MESHOPT_COMPRESSION);
|
|
2334
2330
|
}), this.register(function(t) {
|
|
2335
2331
|
return new So(t);
|
|
2336
2332
|
});
|
|
@@ -2432,7 +2428,7 @@ class fo extends Zt {
|
|
|
2432
2428
|
if (typeof e == "string")
|
|
2433
2429
|
i = JSON.parse(e);
|
|
2434
2430
|
else if (e instanceof ArrayBuffer)
|
|
2435
|
-
if (l.decode(new Uint8Array(e, 0, 4)) ===
|
|
2431
|
+
if (l.decode(new Uint8Array(e, 0, 4)) === Qn) {
|
|
2436
2432
|
try {
|
|
2437
2433
|
o[O.KHR_BINARY_GLTF] = new Ho(e);
|
|
2438
2434
|
} catch (u) {
|
|
@@ -2566,13 +2562,13 @@ class mo {
|
|
|
2566
2562
|
const u = l.range !== void 0 ? l.range : 0;
|
|
2567
2563
|
switch (l.type) {
|
|
2568
2564
|
case "directional":
|
|
2569
|
-
c = new
|
|
2565
|
+
c = new Cs(A), c.target.position.set(0, 0, -1), c.add(c.target);
|
|
2570
2566
|
break;
|
|
2571
2567
|
case "point":
|
|
2572
|
-
c = new
|
|
2568
|
+
c = new ys(A), c.distance = u;
|
|
2573
2569
|
break;
|
|
2574
2570
|
case "spot":
|
|
2575
|
-
c = new
|
|
2571
|
+
c = new Is(A), c.distance = u, l.spot = l.spot || {}, l.spot.innerConeAngle = l.spot.innerConeAngle !== void 0 ? l.spot.innerConeAngle : 0, l.spot.outerConeAngle = l.spot.outerConeAngle !== void 0 ? l.spot.outerConeAngle : Math.PI / 4, c.angle = l.spot.outerConeAngle, c.penumbra = 1 - l.spot.innerConeAngle / l.spot.outerConeAngle, c.target.position.set(0, 0, -1), c.add(c.target);
|
|
2576
2572
|
break;
|
|
2577
2573
|
default:
|
|
2578
2574
|
throw new Error("THREE.GLTFLoader: Unexpected light type: " + l.type);
|
|
@@ -2819,7 +2815,7 @@ class Ro {
|
|
|
2819
2815
|
return s.loadTextureImage(e, o.source, l);
|
|
2820
2816
|
}
|
|
2821
2817
|
}
|
|
2822
|
-
class
|
|
2818
|
+
class Pn {
|
|
2823
2819
|
constructor(e, t) {
|
|
2824
2820
|
this.name = t, this.parser = e;
|
|
2825
2821
|
}
|
|
@@ -2863,13 +2859,13 @@ class So {
|
|
|
2863
2859
|
return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((c) => {
|
|
2864
2860
|
const A = c.pop(), u = A.isGroup ? A.children : [A], h = c[0].count, d = [];
|
|
2865
2861
|
for (const p of u) {
|
|
2866
|
-
const m = new me(), f = new M(), g = new K(), x = new M(1, 1, 1), y = new
|
|
2862
|
+
const m = new me(), f = new M(), g = new K(), x = new M(1, 1, 1), y = new xs(p.geometry, p.material, h);
|
|
2867
2863
|
for (let C = 0; C < h; C++)
|
|
2868
2864
|
l.TRANSLATION && f.fromBufferAttribute(l.TRANSLATION, C), l.ROTATION && g.fromBufferAttribute(l.ROTATION, C), l.SCALE && x.fromBufferAttribute(l.SCALE, C), y.setMatrixAt(C, m.compose(f, g, x));
|
|
2869
2865
|
for (const C in l)
|
|
2870
2866
|
if (C === "_COLOR_0") {
|
|
2871
2867
|
const w = l[C];
|
|
2872
|
-
y.instanceColor = new
|
|
2868
|
+
y.instanceColor = new ws(w.array, w.itemSize, w.normalized);
|
|
2873
2869
|
} else C !== "TRANSLATION" && C !== "ROTATION" && C !== "SCALE" && p.geometry.setAttribute(C, l[C]);
|
|
2874
2870
|
ke.prototype.copy.call(y, p), this.parser.assignFinalMaterial(y), d.push(y);
|
|
2875
2871
|
}
|
|
@@ -2877,7 +2873,7 @@ class So {
|
|
|
2877
2873
|
}));
|
|
2878
2874
|
}
|
|
2879
2875
|
}
|
|
2880
|
-
const
|
|
2876
|
+
const Qn = "glTF", Be = 12, Tn = { JSON: 1313821514, BIN: 5130562 };
|
|
2881
2877
|
class Ho {
|
|
2882
2878
|
constructor(e) {
|
|
2883
2879
|
this.name = O.KHR_BINARY_GLTF, this.content = null, this.body = null;
|
|
@@ -2886,7 +2882,7 @@ class Ho {
|
|
|
2886
2882
|
magic: s.decode(new Uint8Array(e.slice(0, 4))),
|
|
2887
2883
|
version: t.getUint32(4, !0),
|
|
2888
2884
|
length: t.getUint32(8, !0)
|
|
2889
|
-
}, this.header.magic !==
|
|
2885
|
+
}, this.header.magic !== Qn)
|
|
2890
2886
|
throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
|
|
2891
2887
|
if (this.header.version < 2)
|
|
2892
2888
|
throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
|
|
@@ -2896,10 +2892,10 @@ class Ho {
|
|
|
2896
2892
|
const a = i.getUint32(o, !0);
|
|
2897
2893
|
o += 4;
|
|
2898
2894
|
const l = i.getUint32(o, !0);
|
|
2899
|
-
if (o += 4, l ===
|
|
2895
|
+
if (o += 4, l === Tn.JSON) {
|
|
2900
2896
|
const c = new Uint8Array(e, Be + o, a);
|
|
2901
2897
|
this.content = s.decode(c);
|
|
2902
|
-
} else if (l ===
|
|
2898
|
+
} else if (l === Tn.BIN) {
|
|
2903
2899
|
const c = Be + o;
|
|
2904
2900
|
this.body = e.slice(c, c + a);
|
|
2905
2901
|
}
|
|
@@ -2954,7 +2950,7 @@ class jo {
|
|
|
2954
2950
|
this.name = O.KHR_MESH_QUANTIZATION;
|
|
2955
2951
|
}
|
|
2956
2952
|
}
|
|
2957
|
-
class
|
|
2953
|
+
class Jn extends Fs {
|
|
2958
2954
|
constructor(e, t, s, n) {
|
|
2959
2955
|
super(e, t, s, n);
|
|
2960
2956
|
}
|
|
@@ -2974,7 +2970,7 @@ class Qn extends Gs {
|
|
|
2974
2970
|
}
|
|
2975
2971
|
}
|
|
2976
2972
|
const ko = new K();
|
|
2977
|
-
class Wo extends
|
|
2973
|
+
class Wo extends Jn {
|
|
2978
2974
|
interpolate_(e, t, s, n) {
|
|
2979
2975
|
const i = super.interpolate_(e, t, s, n);
|
|
2980
2976
|
return ko.fromArray(i).normalize().toArray(i), i;
|
|
@@ -2995,16 +2991,16 @@ const te = {
|
|
|
2995
2991
|
5123: Uint16Array,
|
|
2996
2992
|
5125: Uint32Array,
|
|
2997
2993
|
5126: Float32Array
|
|
2998
|
-
}, Tn = {
|
|
2999
|
-
9728: Wn,
|
|
3000
|
-
9729: qt,
|
|
3001
|
-
9984: Ps,
|
|
3002
|
-
9985: Ds,
|
|
3003
|
-
9986: Ms,
|
|
3004
|
-
9987: kn
|
|
3005
2994
|
}, On = {
|
|
3006
|
-
|
|
3007
|
-
|
|
2995
|
+
9728: zn,
|
|
2996
|
+
9729: qt,
|
|
2997
|
+
9984: Ts,
|
|
2998
|
+
9985: Ps,
|
|
2999
|
+
9986: Ds,
|
|
3000
|
+
9987: Wn
|
|
3001
|
+
}, En = {
|
|
3002
|
+
33071: Es,
|
|
3003
|
+
33648: Os,
|
|
3008
3004
|
10497: Xt
|
|
3009
3005
|
}, Lt = {
|
|
3010
3006
|
SCALAR: 1,
|
|
@@ -3034,22 +3030,22 @@ const te = {
|
|
|
3034
3030
|
CUBICSPLINE: void 0,
|
|
3035
3031
|
// We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
|
|
3036
3032
|
// keyframe track will be initialized with a default interpolation type, then modified.
|
|
3037
|
-
LINEAR:
|
|
3038
|
-
STEP:
|
|
3033
|
+
LINEAR: Fn,
|
|
3034
|
+
STEP: zs
|
|
3039
3035
|
}, Nt = {
|
|
3040
3036
|
OPAQUE: "OPAQUE",
|
|
3041
3037
|
MASK: "MASK",
|
|
3042
3038
|
BLEND: "BLEND"
|
|
3043
3039
|
};
|
|
3044
3040
|
function Go(r) {
|
|
3045
|
-
return r.DefaultMaterial === void 0 && (r.DefaultMaterial = new
|
|
3041
|
+
return r.DefaultMaterial === void 0 && (r.DefaultMaterial = new Gn({
|
|
3046
3042
|
color: 16777215,
|
|
3047
3043
|
emissive: 0,
|
|
3048
3044
|
metalness: 1,
|
|
3049
3045
|
roughness: 1,
|
|
3050
3046
|
transparent: !1,
|
|
3051
3047
|
depthTest: !0,
|
|
3052
|
-
side:
|
|
3048
|
+
side: Gs
|
|
3053
3049
|
})), r.DefaultMaterial;
|
|
3054
3050
|
}
|
|
3055
3051
|
function xe(r, e, t) {
|
|
@@ -3148,7 +3144,7 @@ class Vo {
|
|
|
3148
3144
|
const l = a.match(/Version\/(\d+)/);
|
|
3149
3145
|
n = s && l ? parseInt(l[1], 10) : -1, i = a.indexOf("Firefox") > -1, o = i ? a.match(/Firefox\/([0-9]+)\./)[1] : -1;
|
|
3150
3146
|
}
|
|
3151
|
-
typeof createImageBitmap > "u" || s && n < 17 || i && o < 98 ? this.textureLoader = new
|
|
3147
|
+
typeof createImageBitmap > "u" || s && n < 17 || i && o < 98 ? this.textureLoader = new vs(this.options.manager) : this.textureLoader = new Ms(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new nt(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
|
|
3152
3148
|
}
|
|
3153
3149
|
setExtensions(e) {
|
|
3154
3150
|
this.extensions = e;
|
|
@@ -3398,7 +3394,7 @@ class Vo {
|
|
|
3398
3394
|
if (d && d !== u) {
|
|
3399
3395
|
const g = Math.floor(h / d), x = "InterleavedBuffer:" + n.bufferView + ":" + n.componentType + ":" + g + ":" + n.count;
|
|
3400
3396
|
let y = t.cache.get(x);
|
|
3401
|
-
y || (m = new c(a, g * d, n.count * d / A), y = new
|
|
3397
|
+
y || (m = new c(a, g * d, n.count * d / A), y = new jn(m, d / A), t.cache.add(x, y)), f = new kn(y, l, h % d / A, p);
|
|
3402
3398
|
} else
|
|
3403
3399
|
a === null ? m = new c(n.count * l) : m = new c(a, h, n.count * l), f = new $e(m, l, p);
|
|
3404
3400
|
if (n.sparse !== void 0) {
|
|
@@ -3436,7 +3432,7 @@ class Vo {
|
|
|
3436
3432
|
const c = this.loadImageSource(t, s).then(function(A) {
|
|
3437
3433
|
A.flipY = !1, A.name = o.name || a.name || "", A.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (A.name = a.uri);
|
|
3438
3434
|
const h = (i.samplers || {})[o.sampler] || {};
|
|
3439
|
-
return A.magFilter =
|
|
3435
|
+
return A.magFilter = On[h.magFilter] || qt, A.minFilter = On[h.minFilter] || Wn, A.wrapS = En[h.wrapS] || Xt, A.wrapT = En[h.wrapT] || Xt, A.generateMipmaps = !A.isCompressedTexture && A.minFilter !== zn && A.minFilter !== qt, n.associations.set(A, { textures: e }), A;
|
|
3440
3436
|
}).catch(function() {
|
|
3441
3437
|
return null;
|
|
3442
3438
|
});
|
|
@@ -3460,7 +3456,7 @@ class Vo {
|
|
|
3460
3456
|
return new Promise(function(h, d) {
|
|
3461
3457
|
let p = h;
|
|
3462
3458
|
t.isImageBitmapLoader === !0 && (p = function(m) {
|
|
3463
|
-
const f = new
|
|
3459
|
+
const f = new on(m);
|
|
3464
3460
|
f.needsUpdate = !0, h(f);
|
|
3465
3461
|
}), t.load(_e.resolveURL(u, i.path), p, void 0, d);
|
|
3466
3462
|
});
|
|
@@ -3527,7 +3523,7 @@ class Vo {
|
|
|
3527
3523
|
e.material = s;
|
|
3528
3524
|
}
|
|
3529
3525
|
getMaterialType() {
|
|
3530
|
-
return
|
|
3526
|
+
return Gn;
|
|
3531
3527
|
}
|
|
3532
3528
|
/**
|
|
3533
3529
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
|
|
@@ -3555,7 +3551,7 @@ class Vo {
|
|
|
3555
3551
|
return h.extendMaterialParams && h.extendMaterialParams(e, a);
|
|
3556
3552
|
})));
|
|
3557
3553
|
}
|
|
3558
|
-
i.doubleSided === !0 && (a.side =
|
|
3554
|
+
i.doubleSided === !0 && (a.side = Ln);
|
|
3559
3555
|
const A = i.alphaMode || Nt.OPAQUE;
|
|
3560
3556
|
if (A === Nt.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, A === Nt.MASK && (a.alphaTest = i.alphaCutoff !== void 0 ? i.alphaCutoff : 0.5)), i.normalTexture !== void 0 && o !== Pe && (c.push(t.assignTexture(a, "normalMap", i.normalTexture)), a.normalScale = new Y(1, 1), i.normalTexture.scale !== void 0)) {
|
|
3561
3557
|
const u = i.normalTexture.scale;
|
|
@@ -3578,7 +3574,7 @@ class Vo {
|
|
|
3578
3574
|
* @return {string}
|
|
3579
3575
|
*/
|
|
3580
3576
|
createUniqueName(e) {
|
|
3581
|
-
const t =
|
|
3577
|
+
const t = Rs.sanitizeNodeName(e || "");
|
|
3582
3578
|
return t in this.nodeNamesUsed ? t + "_" + ++this.nodeNamesUsed[t] : (this.nodeNamesUsed[t] = 0, t);
|
|
3583
3579
|
}
|
|
3584
3580
|
/**
|
|
@@ -3594,7 +3590,7 @@ class Vo {
|
|
|
3594
3590
|
const t = this, s = this.extensions, n = this.primitiveCache;
|
|
3595
3591
|
function i(a) {
|
|
3596
3592
|
return s[O.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, t).then(function(l) {
|
|
3597
|
-
return
|
|
3593
|
+
return Rn(l, a, t);
|
|
3598
3594
|
});
|
|
3599
3595
|
}
|
|
3600
3596
|
const o = [];
|
|
@@ -3604,7 +3600,7 @@ class Vo {
|
|
|
3604
3600
|
o.push(u.promise);
|
|
3605
3601
|
else {
|
|
3606
3602
|
let h;
|
|
3607
|
-
c.extensions && c.extensions[O.KHR_DRACO_MESH_COMPRESSION] ? h = i(c) : h =
|
|
3603
|
+
c.extensions && c.extensions[O.KHR_DRACO_MESH_COMPRESSION] ? h = i(c) : h = Rn(new We(), c, t), n[A] = { primitive: c, promise: h }, o.push(h);
|
|
3608
3604
|
}
|
|
3609
3605
|
}
|
|
3610
3606
|
return Promise.all(o);
|
|
@@ -3629,13 +3625,13 @@ class Vo {
|
|
|
3629
3625
|
let g;
|
|
3630
3626
|
const x = c[d];
|
|
3631
3627
|
if (f.mode === te.TRIANGLES || f.mode === te.TRIANGLE_STRIP || f.mode === te.TRIANGLE_FAN || f.mode === void 0)
|
|
3632
|
-
g = i.isSkinnedMesh === !0 ? new
|
|
3628
|
+
g = i.isSkinnedMesh === !0 ? new Ss(m, x) : new v(m, x), g.isSkinnedMesh === !0 && g.normalizeSkinWeights(), f.mode === te.TRIANGLE_STRIP ? g.geometry = Dn(g.geometry, Nn) : f.mode === te.TRIANGLE_FAN && (g.geometry = Dn(g.geometry, Ft));
|
|
3633
3629
|
else if (f.mode === te.LINES)
|
|
3634
3630
|
g = new Gt(m, x);
|
|
3635
3631
|
else if (f.mode === te.LINE_STRIP)
|
|
3636
3632
|
g = new ue(m, x);
|
|
3637
3633
|
else if (f.mode === te.LINE_LOOP)
|
|
3638
|
-
g = new
|
|
3634
|
+
g = new Hs(m, x);
|
|
3639
3635
|
else if (f.mode === te.POINTS)
|
|
3640
3636
|
g = new gt(m, x);
|
|
3641
3637
|
else
|
|
@@ -3670,7 +3666,7 @@ class Vo {
|
|
|
3670
3666
|
console.warn("THREE.GLTFLoader: Missing camera parameters.");
|
|
3671
3667
|
return;
|
|
3672
3668
|
}
|
|
3673
|
-
return s.type === "perspective" ? t = new
|
|
3669
|
+
return s.type === "perspective" ? t = new Ls(Hn.radToDeg(n.yfov), n.aspectRatio || 1, n.znear || 1, n.zfar || 2e6) : s.type === "orthographic" && (t = new Ns(-n.xmag, n.xmag, n.ymag, -n.ymag, n.znear, n.zfar)), s.name && (t.name = this.createUniqueName(s.name)), re(t, s), Promise.resolve(t);
|
|
3674
3670
|
}
|
|
3675
3671
|
/**
|
|
3676
3672
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
|
|
@@ -3694,7 +3690,7 @@ class Vo {
|
|
|
3694
3690
|
} else
|
|
3695
3691
|
console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', t.joints[c]);
|
|
3696
3692
|
}
|
|
3697
|
-
return new
|
|
3693
|
+
return new js(a, l);
|
|
3698
3694
|
});
|
|
3699
3695
|
}
|
|
3700
3696
|
/**
|
|
@@ -3727,7 +3723,7 @@ class Vo {
|
|
|
3727
3723
|
for (let ye = 0; ye < Q.length; ye++)
|
|
3728
3724
|
g.push(Q[ye]);
|
|
3729
3725
|
}
|
|
3730
|
-
const x = new
|
|
3726
|
+
const x = new ks(i, void 0, g);
|
|
3731
3727
|
return re(x, n), x;
|
|
3732
3728
|
});
|
|
3733
3729
|
}
|
|
@@ -3789,7 +3785,7 @@ class Vo {
|
|
|
3789
3785
|
a.push(c);
|
|
3790
3786
|
}), this.nodeCache[e] = Promise.all(a).then(function(c) {
|
|
3791
3787
|
let A;
|
|
3792
|
-
if (i.isBone === !0 ? A = new
|
|
3788
|
+
if (i.isBone === !0 ? A = new Ws() : c.length > 1 ? A = new mt() : c.length === 1 ? A = c[0] : A = new ke(), A !== c[0])
|
|
3793
3789
|
for (let u = 0, h = c.length; u < h; u++)
|
|
3794
3790
|
A.add(c[u]);
|
|
3795
3791
|
if (i.name && (A.userData.name = i.name, A.name = o), re(A, i), i.extensions && xe(s, A, i), i.matrix !== void 0) {
|
|
@@ -3827,7 +3823,7 @@ class Vo {
|
|
|
3827
3823
|
const c = (A) => {
|
|
3828
3824
|
const u = /* @__PURE__ */ new Map();
|
|
3829
3825
|
for (const [h, d] of n.associations)
|
|
3830
|
-
(h instanceof Je || h instanceof
|
|
3826
|
+
(h instanceof Je || h instanceof on) && u.set(h, d);
|
|
3831
3827
|
return A.traverse((h) => {
|
|
3832
3828
|
const d = n.associations.get(h);
|
|
3833
3829
|
d != null && u.set(h, d);
|
|
@@ -3845,29 +3841,29 @@ class Vo {
|
|
|
3845
3841
|
let A;
|
|
3846
3842
|
switch (fe[i.path]) {
|
|
3847
3843
|
case fe.weights:
|
|
3848
|
-
A =
|
|
3844
|
+
A = an;
|
|
3849
3845
|
break;
|
|
3850
3846
|
case fe.rotation:
|
|
3851
|
-
A =
|
|
3847
|
+
A = ln;
|
|
3852
3848
|
break;
|
|
3853
3849
|
case fe.translation:
|
|
3854
3850
|
case fe.scale:
|
|
3855
|
-
A =
|
|
3851
|
+
A = rn;
|
|
3856
3852
|
break;
|
|
3857
3853
|
default:
|
|
3858
3854
|
switch (s.itemSize) {
|
|
3859
3855
|
case 1:
|
|
3860
|
-
A =
|
|
3856
|
+
A = an;
|
|
3861
3857
|
break;
|
|
3862
3858
|
case 2:
|
|
3863
3859
|
case 3:
|
|
3864
3860
|
default:
|
|
3865
|
-
A =
|
|
3861
|
+
A = rn;
|
|
3866
3862
|
break;
|
|
3867
3863
|
}
|
|
3868
3864
|
break;
|
|
3869
3865
|
}
|
|
3870
|
-
const u = n.interpolation !== void 0 ? zo[n.interpolation] :
|
|
3866
|
+
const u = n.interpolation !== void 0 ? zo[n.interpolation] : Fn, h = this._getArrayFromAccessor(s);
|
|
3871
3867
|
for (let d = 0, p = l.length; d < p; d++) {
|
|
3872
3868
|
const m = new A(
|
|
3873
3869
|
l[d] + "." + fe[i.path],
|
|
@@ -3891,13 +3887,13 @@ class Vo {
|
|
|
3891
3887
|
}
|
|
3892
3888
|
_createCubicSplineTrackInterpolant(e) {
|
|
3893
3889
|
e.createInterpolant = function(s) {
|
|
3894
|
-
const n = this instanceof
|
|
3890
|
+
const n = this instanceof ln ? Wo : Jn;
|
|
3895
3891
|
return new n(this.times, this.values, this.getValueSize() / 3, s);
|
|
3896
3892
|
}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
|
|
3897
3893
|
}
|
|
3898
3894
|
}
|
|
3899
3895
|
function Yo(r, e, t) {
|
|
3900
|
-
const s = e.attributes, n = new
|
|
3896
|
+
const s = e.attributes, n = new qs();
|
|
3901
3897
|
if (s.POSITION !== void 0) {
|
|
3902
3898
|
const a = t.json.accessors[s.POSITION], l = a.min, c = a.max;
|
|
3903
3899
|
if (l !== void 0 && c !== void 0) {
|
|
@@ -3934,10 +3930,10 @@ function Yo(r, e, t) {
|
|
|
3934
3930
|
n.expandByVector(a);
|
|
3935
3931
|
}
|
|
3936
3932
|
r.boundingBox = n;
|
|
3937
|
-
const o = new
|
|
3933
|
+
const o = new Xs();
|
|
3938
3934
|
n.getCenter(o.center), o.radius = n.min.distanceTo(n.max) / 2, r.boundingSphere = o;
|
|
3939
3935
|
}
|
|
3940
|
-
function
|
|
3936
|
+
function Rn(r, e, t) {
|
|
3941
3937
|
const s = e.attributes, n = [];
|
|
3942
3938
|
function i(o, a) {
|
|
3943
3939
|
return t.getDependency("accessor", o).then(function(l) {
|
|
@@ -4074,8 +4070,8 @@ class Ko extends Zt {
|
|
|
4074
4070
|
if (o === a)
|
|
4075
4071
|
c = new $e(i, o);
|
|
4076
4072
|
else {
|
|
4077
|
-
const A = new
|
|
4078
|
-
c = new
|
|
4073
|
+
const A = new jn(i, a);
|
|
4074
|
+
c = new kn(A, o, 0);
|
|
4079
4075
|
}
|
|
4080
4076
|
n === "color" && (this._assignVertexColorSpace(c, l), c.normalized = !(i instanceof Float32Array)), t.setAttribute(n, c);
|
|
4081
4077
|
}
|
|
@@ -4358,7 +4354,7 @@ function sr(r) {
|
|
|
4358
4354
|
if (!e)
|
|
4359
4355
|
return console.warn("请先选中一个模型,再添加数据面板"), null;
|
|
4360
4356
|
const t = Jt(e);
|
|
4361
|
-
t && (t.dispose(),
|
|
4357
|
+
t && (t.dispose(), wi(e));
|
|
4362
4358
|
const s = [
|
|
4363
4359
|
{ label: "温度", value: "30", unit: "℃" },
|
|
4364
4360
|
{ label: "湿度", value: "65", unit: "%" },
|
|
@@ -4368,7 +4364,7 @@ function sr(r) {
|
|
|
4368
4364
|
title: (r == null ? void 0 : r.title) || "数据面板",
|
|
4369
4365
|
items: (r == null ? void 0 : r.items) || s
|
|
4370
4366
|
});
|
|
4371
|
-
return n.attachTo(e),
|
|
4367
|
+
return n.attachTo(e), Xn(e, n), n;
|
|
4372
4368
|
}
|
|
4373
4369
|
const ir = {
|
|
4374
4370
|
key: 1,
|
|
@@ -4385,7 +4381,7 @@ const ir = {
|
|
|
4385
4381
|
},
|
|
4386
4382
|
emits: ["select", "delete"],
|
|
4387
4383
|
setup(r, { emit: e }) {
|
|
4388
|
-
const t = r, s = e, n = j(null), { expandedSet: i, toggleExpand: o } =
|
|
4384
|
+
const t = r, s = e, n = j(null), { expandedSet: i, toggleExpand: o } = ns("treeExpand"), a = Ue(() => i.value.has(t.node.uuid)), l = Ue(() => (t.version, t.node.children.some((m) => m.userData.isMovable === !0))), c = Ue(() => (t.version, t.node.children.filter(
|
|
4389
4385
|
(m) => m.userData.isMovable === !0
|
|
4390
4386
|
))), A = Ue(
|
|
4391
4387
|
() => {
|
|
@@ -4393,7 +4389,7 @@ const ir = {
|
|
|
4393
4389
|
return ((m = t.selectedObject) == null ? void 0 : m.uuid) === t.node.uuid;
|
|
4394
4390
|
}
|
|
4395
4391
|
);
|
|
4396
|
-
|
|
4392
|
+
ss(
|
|
4397
4393
|
() => {
|
|
4398
4394
|
A.value && n.value && n.value.scrollIntoView({
|
|
4399
4395
|
block: "nearest",
|
|
@@ -4410,7 +4406,7 @@ const ir = {
|
|
|
4410
4406
|
m.stopPropagation(), s("delete", t.node);
|
|
4411
4407
|
}, d = (m) => m.type === "Mesh" || m.type === "Sprite" ? "🟦" : m.type === "Light" ? "💡" : "📦", p = (m) => m.name || `${m.type} (${m.id})`;
|
|
4412
4408
|
return (m, f) => {
|
|
4413
|
-
const g =
|
|
4409
|
+
const g = is("TreeItem", !0);
|
|
4414
4410
|
return T(), R("div", {
|
|
4415
4411
|
class: "tree-node",
|
|
4416
4412
|
ref_key: "nodeRef",
|
|
@@ -4423,7 +4419,7 @@ const ir = {
|
|
|
4423
4419
|
l.value ? (T(), R("span", {
|
|
4424
4420
|
key: 0,
|
|
4425
4421
|
class: "toggle-icon",
|
|
4426
|
-
onClick: f[0] || (f[0] = Wt((x) =>
|
|
4422
|
+
onClick: f[0] || (f[0] = Wt((x) => os(o)(r.node.uuid), ["stop"]))
|
|
4427
4423
|
}, ie(a.value ? "▼" : "▶"), 1)) : (T(), R("span", ir)),
|
|
4428
4424
|
b("span", or, ie(d(r.node)), 1),
|
|
4429
4425
|
b("span", rr, ie(p(r.node)), 1),
|
|
@@ -5030,7 +5026,7 @@ const ir = {
|
|
|
5030
5026
|
type: "checkbox",
|
|
5031
5027
|
"onUpdate:modelValue": f[0] || (f[0] = (g) => n.value = g)
|
|
5032
5028
|
}, null, 512), [
|
|
5033
|
-
[
|
|
5029
|
+
[rs, n.value]
|
|
5034
5030
|
]),
|
|
5035
5031
|
f[6] || (f[6] = b("span", { class: "dp-toggle-slider" }, null, -1))
|
|
5036
5032
|
]),
|
|
@@ -5193,8 +5189,8 @@ const la = {
|
|
|
5193
5189
|
const o = () => s("propertyChange"), a = j("transform"), l = Ue(() => {
|
|
5194
5190
|
var p;
|
|
5195
5191
|
return !!(t.selectedObject && ((p = t.selectedObject.userData) != null && p._hasDataPanel));
|
|
5196
|
-
}), c = j(0), A =
|
|
5197
|
-
|
|
5192
|
+
}), c = j(0), A = as(t, "selectedObject"), { expandedSet: u, toggleExpand: h } = aa(A);
|
|
5193
|
+
ls("treeExpand", { expandedSet: u, toggleExpand: h });
|
|
5198
5194
|
const d = (p) => {
|
|
5199
5195
|
c.value++, s("treeDelete", p);
|
|
5200
5196
|
};
|
|
@@ -5282,8 +5278,8 @@ const la = {
|
|
|
5282
5278
|
console.log(JSON.parse(await m));
|
|
5283
5279
|
}, d = () => {
|
|
5284
5280
|
if (!localStorage.getItem("test_id")) return localStorage.setItem("test_id", "123");
|
|
5285
|
-
|
|
5286
|
-
}, p = () =>
|
|
5281
|
+
Yn(localStorage.getItem("test_id"));
|
|
5282
|
+
}, p = () => Bn();
|
|
5287
5283
|
return (m, f) => (T(), R("div", Ia, [
|
|
5288
5284
|
b("div", ya, [
|
|
5289
5285
|
b("div", {
|
|
@@ -5411,10 +5407,10 @@ const la = {
|
|
|
5411
5407
|
},
|
|
5412
5408
|
setup(r) {
|
|
5413
5409
|
const e = r, t = j(!1);
|
|
5414
|
-
|
|
5410
|
+
Wi((g) => {
|
|
5415
5411
|
t.value = g;
|
|
5416
5412
|
});
|
|
5417
|
-
const s =
|
|
5413
|
+
const s = nn(null), n = zt({
|
|
5418
5414
|
position: { x: 0, y: 0, z: 0 },
|
|
5419
5415
|
rotation: { x: 0, y: 0, z: 0 },
|
|
5420
5416
|
scale: { x: 1, y: 1, z: 1 }
|
|
@@ -5447,7 +5443,7 @@ const la = {
|
|
|
5447
5443
|
} catch (x) {
|
|
5448
5444
|
console.error("导入失败:", x), alert("导入失败:" + x.message);
|
|
5449
5445
|
}
|
|
5450
|
-
}, A =
|
|
5446
|
+
}, A = nn([]);
|
|
5451
5447
|
$i((g) => {
|
|
5452
5448
|
A.value = g;
|
|
5453
5449
|
});
|
|
@@ -5455,13 +5451,13 @@ const la = {
|
|
|
5455
5451
|
const g = eo();
|
|
5456
5452
|
g && (A.value = g);
|
|
5457
5453
|
}, h = (g) => _t(g), d = (g) => Yi(g.uuid), p = (g) => {
|
|
5458
|
-
|
|
5454
|
+
zi(g);
|
|
5459
5455
|
}, m = j(null), f = () => {
|
|
5460
|
-
m.value &&
|
|
5456
|
+
m.value && Oi(m.value, e.mode, e.sceneData), u();
|
|
5461
5457
|
};
|
|
5462
|
-
return
|
|
5463
|
-
f(), m.value &&
|
|
5464
|
-
}),
|
|
5458
|
+
return cs(() => {
|
|
5459
|
+
f(), m.value && vi(m.value);
|
|
5460
|
+
}), us(() => {
|
|
5465
5461
|
console.log("endset_three_editor destroy"), oo();
|
|
5466
5462
|
}), (g, x) => (T(), R("div", Ea, [
|
|
5467
5463
|
t.value ? (T(), R("div", Ra, [...x[0] || (x[0] = [
|
|
@@ -5510,9 +5506,9 @@ export {
|
|
|
5510
5506
|
nr as addModelByType,
|
|
5511
5507
|
_o as addSphere,
|
|
5512
5508
|
er as addWaterPlane,
|
|
5513
|
-
|
|
5509
|
+
vi as createCSS2DRenderer,
|
|
5514
5510
|
oo as destroyEditor,
|
|
5515
|
-
|
|
5511
|
+
Pi as disposeCSS2DRenderer,
|
|
5516
5512
|
so as exportSceneToJSON,
|
|
5517
5513
|
qi as focusOnObject,
|
|
5518
5514
|
ka as getCSS2DRenderer,
|
|
@@ -5523,22 +5519,22 @@ export {
|
|
|
5523
5519
|
eo as getSceneObjects,
|
|
5524
5520
|
to as getSelectedObject,
|
|
5525
5521
|
tr as importModelFromFile,
|
|
5526
|
-
|
|
5527
|
-
|
|
5522
|
+
Bn as initDefaultMainCamera,
|
|
5523
|
+
Oi as initEditor,
|
|
5528
5524
|
io as loadSceneFromJSON,
|
|
5529
5525
|
$i as onSceneObjectsChangeCallback,
|
|
5530
|
-
|
|
5526
|
+
wi as removeDataPanel,
|
|
5531
5527
|
Vi as removeModel,
|
|
5532
5528
|
Yi as removeModelById,
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5529
|
+
Mi as renderCSS2D,
|
|
5530
|
+
Di as resizeCSS2DRenderer,
|
|
5531
|
+
Yn as selectModelHandle,
|
|
5536
5532
|
_t as selectObject,
|
|
5537
5533
|
St as setLoading,
|
|
5538
|
-
|
|
5534
|
+
Wi as setLoadingCallback,
|
|
5539
5535
|
Ji as setSelectedObjectCallback,
|
|
5540
5536
|
_i as setTransformChangeCallback,
|
|
5541
|
-
|
|
5537
|
+
zi as setTransformMode,
|
|
5542
5538
|
Wa as updateDataPanelValue,
|
|
5543
5539
|
aa as useTreeExpand
|
|
5544
5540
|
};
|