endset_three_editor 0.2.6 → 0.2.7
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,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as Be, ref as G, inject as Sn, computed as We, watchEffect as An, resolveComponent as Rn, openBlock as C, createElementBlock as U, createElementVNode as g, normalizeClass as Ge, withModifiers as Ct, unref as Pn, toDisplayString as Ee, Fragment as rn, renderList as an, createBlock as ke, createCommentVNode as ae, watch as ln, toRef as Ln, provide as In, reactive as cn, withDirectives as N, vModelText as Q, vShow as ue, shallowRef as On, onMounted as Cn, onBeforeUnmount as Dn } from "vue";
|
|
2
2
|
import * as F from "three";
|
|
3
|
-
import { Controls as
|
|
4
|
-
import
|
|
5
|
-
const
|
|
3
|
+
import { Controls as hn, Vector3 as E, MOUSE as ve, TOUCH as Me, Quaternion as K, Spherical as Dt, Vector2 as V, Ray as Nn, Plane as kn, MathUtils as un, Raycaster as jn, Object3D as Xe, MeshBasicMaterial as be, LineBasicMaterial as je, CylinderGeometry as Y, BoxGeometry as z, BufferGeometry as Ye, Float32BufferAttribute as de, Mesh as T, OctahedronGeometry as $e, Line as re, TorusGeometry as Pe, SphereGeometry as Fn, Euler as Hn, Matrix4 as Ae, PlaneGeometry as Un, DoubleSide as dn, Loader as pn, FileLoader as At, Color as pe, SRGBColorSpace as Re, Group as it, Material as Fe, PointsMaterial as Ce, MeshPhongMaterial as zn, LineSegments as wt, Points as ot, TrianglesDrawMode as Gn, TriangleFanDrawMode as Tt, TriangleStripDrawMode as fn, LoaderUtils as He, MeshPhysicalMaterial as se, LinearSRGBColorSpace as le, SpotLight as Xn, PointLight as Yn, DirectionalLight as Bn, InstancedMesh as Kn, InstancedBufferAttribute as Vn, TextureLoader as Zn, ImageBitmapLoader as Qn, BufferAttribute as ut, InterleavedBuffer as qn, InterleavedBufferAttribute as Wn, LinearMipmapLinearFilter as mn, NearestMipmapLinearFilter as $n, LinearMipmapNearestFilter as Jn, NearestMipmapNearestFilter as es, LinearFilter as xt, NearestFilter as gn, RepeatWrapping as Mt, MirroredRepeatWrapping as ts, ClampToEdgeWrapping as ns, MeshStandardMaterial as yn, PropertyBinding as ss, SkinnedMesh as is, LineLoop as os, PerspectiveCamera as rs, OrthographicCamera as as, Skeleton as ls, AnimationClip as cs, Bone as hs, InterpolateDiscrete as us, InterpolateLinear as _n, Texture as Nt, VectorKeyframeTrack as kt, NumberKeyframeTrack as jt, QuaternionKeyframeTrack as Ft, ColorManagement as Ht, FrontSide as ds, Interpolant as ps, Box3 as fs, Sphere as ms } from "three";
|
|
4
|
+
import gs from "@tweenjs/tween.js";
|
|
5
|
+
const Ut = { type: "change" }, Rt = { type: "start" }, bn = { type: "end" }, Je = new Nn(), zt = new kn(), ys = Math.cos(70 * un.DEG2RAD), k = new E(), B = 2 * Math.PI, P = {
|
|
6
6
|
NONE: -1,
|
|
7
7
|
ROTATE: 0,
|
|
8
8
|
DOLLY: 1,
|
|
@@ -11,8 +11,8 @@ const jt = { type: "change" }, Mt = { type: "start" }, gn = { type: "end" }, We
|
|
|
11
11
|
TOUCH_PAN: 4,
|
|
12
12
|
TOUCH_DOLLY_PAN: 5,
|
|
13
13
|
TOUCH_DOLLY_ROTATE: 6
|
|
14
|
-
},
|
|
15
|
-
class
|
|
14
|
+
}, dt = 1e-6;
|
|
15
|
+
class _s extends hn {
|
|
16
16
|
/**
|
|
17
17
|
* Constructs a new controls instance.
|
|
18
18
|
*
|
|
@@ -20,7 +20,7 @@ class ps extends an {
|
|
|
20
20
|
* @param {?HTMLElement} domElement - The HTML element used for event listeners.
|
|
21
21
|
*/
|
|
22
22
|
constructor(e, t = null) {
|
|
23
|
-
super(e, t), this.state = P.NONE, this.target = new
|
|
23
|
+
super(e, t), this.state = P.NONE, this.target = new E(), this.cursor = new E(), 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: ve.ROTATE, MIDDLE: ve.DOLLY, RIGHT: ve.PAN }, this.touches = { ONE: Me.ROTATE, TWO: Me.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 E(), this._lastQuaternion = new K(), this._lastTargetPosition = new E(), this._quat = new K().setFromUnitVectors(e.up, new E(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new Dt(), this._sphericalDelta = new Dt(), this._scale = 1, this._panOffset = new E(), this._rotateStart = new V(), this._rotateEnd = new V(), this._rotateDelta = new V(), this._panStart = new V(), this._panEnd = new V(), this._panDelta = new V(), this._dollyStart = new V(), this._dollyEnd = new V(), this._dollyDelta = new V(), this._dollyDirection = new E(), this._mouse = new V(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = ws.bind(this), this._onPointerDown = bs.bind(this), this._onPointerUp = Ts.bind(this), this._onContextMenu = Rs.bind(this), this._onMouseWheel = Es.bind(this), this._onKeyDown = vs.bind(this), this._onTouchStart = Ss.bind(this), this._onTouchMove = As.bind(this), this._onMouseDown = xs.bind(this), this._onMouseMove = Ms.bind(this), this._interceptControlDown = Ps.bind(this), this._interceptControlUp = Ls.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* Defines the visual representation of the cursor.
|
|
@@ -93,7 +93,7 @@ class ps extends an {
|
|
|
93
93
|
* was called, or the initial state.
|
|
94
94
|
*/
|
|
95
95
|
reset() {
|
|
96
|
-
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(
|
|
96
|
+
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(Ut), this.update(), this.state = P.NONE;
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
99
99
|
* Programmatically pan the camera.
|
|
@@ -156,20 +156,20 @@ class ps extends an {
|
|
|
156
156
|
const l = a - o;
|
|
157
157
|
this.object.position.addScaledVector(this._dollyDirection, l), this.object.updateMatrixWorld(), i = !!l;
|
|
158
158
|
} else if (this.object.isOrthographicCamera) {
|
|
159
|
-
const a = new
|
|
159
|
+
const a = new E(this._mouse.x, this._mouse.y, 0);
|
|
160
160
|
a.unproject(this.object);
|
|
161
161
|
const l = this.object.zoom;
|
|
162
162
|
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), i = l !== this.object.zoom;
|
|
163
|
-
const h = new
|
|
163
|
+
const h = new E(this._mouse.x, this._mouse.y, 0);
|
|
164
164
|
h.unproject(this.object), this.object.position.sub(h).add(a), this.object.updateMatrixWorld(), o = k.length();
|
|
165
165
|
} else
|
|
166
166
|
console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
|
|
167
|
-
o !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position) : (
|
|
167
|
+
o !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position) : (Je.origin.copy(this.object.position), Je.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(Je.direction)) < ys ? this.object.lookAt(this.target) : (zt.setFromNormalAndCoplanarPoint(this.object.up, this.target), Je.intersectPlane(zt, this.target))));
|
|
168
168
|
} else if (this.object.isOrthographicCamera) {
|
|
169
169
|
const o = this.object.zoom;
|
|
170
170
|
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);
|
|
171
171
|
}
|
|
172
|
-
return this._scale = 1, this._performCursorZoom = !1, i || this._lastPosition.distanceToSquared(this.object.position) >
|
|
172
|
+
return this._scale = 1, this._performCursorZoom = !1, i || this._lastPosition.distanceToSquared(this.object.position) > dt || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > dt || this._lastTargetPosition.distanceToSquared(this.target) > dt ? (this.dispatchEvent(Ut), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
|
|
173
173
|
}
|
|
174
174
|
_getAutoRotationAngle(e) {
|
|
175
175
|
return e !== null ? B / 60 * this.autoRotateSpeed * e : B / 60 / 60 * this.autoRotateSpeed;
|
|
@@ -361,16 +361,16 @@ class ps extends an {
|
|
|
361
361
|
return e.ctrlKey && !this._controlActive && (s.deltaY *= 10), s;
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
|
-
function
|
|
364
|
+
function bs(r) {
|
|
365
365
|
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")));
|
|
366
366
|
}
|
|
367
|
-
function
|
|
367
|
+
function ws(r) {
|
|
368
368
|
this.enabled !== !1 && (r.pointerType === "touch" ? this._onTouchMove(r) : this._onMouseMove(r));
|
|
369
369
|
}
|
|
370
|
-
function
|
|
370
|
+
function Ts(r) {
|
|
371
371
|
switch (this._removePointer(r), this._pointers.length) {
|
|
372
372
|
case 0:
|
|
373
|
-
this.domElement.releasePointerCapture(r.pointerId), this.domElement.ownerDocument.removeEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(
|
|
373
|
+
this.domElement.releasePointerCapture(r.pointerId), this.domElement.ownerDocument.removeEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(bn), this.state = P.NONE, this._cursorStyle === "grab" && (this.domElement.style.cursor = "grab");
|
|
374
374
|
break;
|
|
375
375
|
case 1:
|
|
376
376
|
const e = this._pointers[0], t = this._pointerPositions[e];
|
|
@@ -378,7 +378,7 @@ function gs(r) {
|
|
|
378
378
|
break;
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
|
-
function
|
|
381
|
+
function xs(r) {
|
|
382
382
|
let e;
|
|
383
383
|
switch (r.button) {
|
|
384
384
|
case 0:
|
|
@@ -394,11 +394,11 @@ function ys(r) {
|
|
|
394
394
|
e = -1;
|
|
395
395
|
}
|
|
396
396
|
switch (e) {
|
|
397
|
-
case
|
|
397
|
+
case ve.DOLLY:
|
|
398
398
|
if (this.enableZoom === !1) return;
|
|
399
399
|
this._handleMouseDownDolly(r), this.state = P.DOLLY;
|
|
400
400
|
break;
|
|
401
|
-
case
|
|
401
|
+
case ve.ROTATE:
|
|
402
402
|
if (r.ctrlKey || r.metaKey || r.shiftKey) {
|
|
403
403
|
if (this.enablePan === !1) return;
|
|
404
404
|
this._handleMouseDownPan(r), this.state = P.PAN;
|
|
@@ -407,7 +407,7 @@ function ys(r) {
|
|
|
407
407
|
this._handleMouseDownRotate(r), this.state = P.ROTATE;
|
|
408
408
|
}
|
|
409
409
|
break;
|
|
410
|
-
case
|
|
410
|
+
case ve.PAN:
|
|
411
411
|
if (r.ctrlKey || r.metaKey || r.shiftKey) {
|
|
412
412
|
if (this.enableRotate === !1) return;
|
|
413
413
|
this._handleMouseDownRotate(r), this.state = P.ROTATE;
|
|
@@ -419,9 +419,9 @@ function ys(r) {
|
|
|
419
419
|
default:
|
|
420
420
|
this.state = P.NONE;
|
|
421
421
|
}
|
|
422
|
-
this.state !== P.NONE && this.dispatchEvent(
|
|
422
|
+
this.state !== P.NONE && this.dispatchEvent(Rt);
|
|
423
423
|
}
|
|
424
|
-
function
|
|
424
|
+
function Ms(r) {
|
|
425
425
|
switch (this.state) {
|
|
426
426
|
case P.ROTATE:
|
|
427
427
|
if (this.enableRotate === !1) return;
|
|
@@ -437,21 +437,21 @@ function _s(r) {
|
|
|
437
437
|
break;
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
|
-
function
|
|
441
|
-
this.enabled === !1 || this.enableZoom === !1 || this.state !== P.NONE || (r.preventDefault(), this.dispatchEvent(
|
|
440
|
+
function Es(r) {
|
|
441
|
+
this.enabled === !1 || this.enableZoom === !1 || this.state !== P.NONE || (r.preventDefault(), this.dispatchEvent(Rt), this._handleMouseWheel(this._customWheelEvent(r)), this.dispatchEvent(bn));
|
|
442
442
|
}
|
|
443
|
-
function
|
|
443
|
+
function vs(r) {
|
|
444
444
|
this.enabled !== !1 && this._handleKeyDown(r);
|
|
445
445
|
}
|
|
446
|
-
function
|
|
446
|
+
function Ss(r) {
|
|
447
447
|
switch (this._trackPointer(r), this._pointers.length) {
|
|
448
448
|
case 1:
|
|
449
449
|
switch (this.touches.ONE) {
|
|
450
|
-
case
|
|
450
|
+
case Me.ROTATE:
|
|
451
451
|
if (this.enableRotate === !1) return;
|
|
452
452
|
this._handleTouchStartRotate(r), this.state = P.TOUCH_ROTATE;
|
|
453
453
|
break;
|
|
454
|
-
case
|
|
454
|
+
case Me.PAN:
|
|
455
455
|
if (this.enablePan === !1) return;
|
|
456
456
|
this._handleTouchStartPan(r), this.state = P.TOUCH_PAN;
|
|
457
457
|
break;
|
|
@@ -461,11 +461,11 @@ function Ts(r) {
|
|
|
461
461
|
break;
|
|
462
462
|
case 2:
|
|
463
463
|
switch (this.touches.TWO) {
|
|
464
|
-
case
|
|
464
|
+
case Me.DOLLY_PAN:
|
|
465
465
|
if (this.enableZoom === !1 && this.enablePan === !1) return;
|
|
466
466
|
this._handleTouchStartDollyPan(r), this.state = P.TOUCH_DOLLY_PAN;
|
|
467
467
|
break;
|
|
468
|
-
case
|
|
468
|
+
case Me.DOLLY_ROTATE:
|
|
469
469
|
if (this.enableZoom === !1 && this.enableRotate === !1) return;
|
|
470
470
|
this._handleTouchStartDollyRotate(r), this.state = P.TOUCH_DOLLY_ROTATE;
|
|
471
471
|
break;
|
|
@@ -476,9 +476,9 @@ function Ts(r) {
|
|
|
476
476
|
default:
|
|
477
477
|
this.state = P.NONE;
|
|
478
478
|
}
|
|
479
|
-
this.state !== P.NONE && this.dispatchEvent(
|
|
479
|
+
this.state !== P.NONE && this.dispatchEvent(Rt);
|
|
480
480
|
}
|
|
481
|
-
function
|
|
481
|
+
function As(r) {
|
|
482
482
|
switch (this._trackPointer(r), this.state) {
|
|
483
483
|
case P.TOUCH_ROTATE:
|
|
484
484
|
if (this.enableRotate === !1) return;
|
|
@@ -500,21 +500,21 @@ function xs(r) {
|
|
|
500
500
|
this.state = P.NONE;
|
|
501
501
|
}
|
|
502
502
|
}
|
|
503
|
-
function
|
|
503
|
+
function Rs(r) {
|
|
504
504
|
this.enabled !== !1 && r.preventDefault();
|
|
505
505
|
}
|
|
506
|
-
function
|
|
506
|
+
function Ps(r) {
|
|
507
507
|
r.key === "Control" && (this._controlActive = !0, this.domElement.getRootNode().addEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
|
|
508
508
|
}
|
|
509
|
-
function
|
|
509
|
+
function Ls(r) {
|
|
510
510
|
r.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
|
|
511
511
|
}
|
|
512
|
-
const
|
|
513
|
-
X: new
|
|
514
|
-
Y: new
|
|
515
|
-
Z: new
|
|
516
|
-
},
|
|
517
|
-
class
|
|
512
|
+
const ge = new jn(), H = new E(), ce = new E(), O = new K(), Gt = {
|
|
513
|
+
X: new E(1, 0, 0),
|
|
514
|
+
Y: new E(0, 1, 0),
|
|
515
|
+
Z: new E(0, 0, 1)
|
|
516
|
+
}, pt = { type: "change" }, Xt = { type: "mouseDown", mode: null }, Yt = { type: "mouseUp", mode: null }, Bt = { type: "objectChange" };
|
|
517
|
+
class Is extends hn {
|
|
518
518
|
/**
|
|
519
519
|
* Constructs a new controls instance.
|
|
520
520
|
*
|
|
@@ -523,11 +523,11 @@ class Ss extends an {
|
|
|
523
523
|
*/
|
|
524
524
|
constructor(e, t = null) {
|
|
525
525
|
super(void 0, t);
|
|
526
|
-
const s = new
|
|
526
|
+
const s = new js(this);
|
|
527
527
|
this._root = s;
|
|
528
|
-
const n = new
|
|
528
|
+
const n = new Fs();
|
|
529
529
|
this._gizmo = n, s.add(n);
|
|
530
|
-
const i = new
|
|
530
|
+
const i = new Hs();
|
|
531
531
|
this._plane = i, s.add(i);
|
|
532
532
|
const o = this;
|
|
533
533
|
function a(x, S) {
|
|
@@ -537,13 +537,13 @@ class Ss extends an {
|
|
|
537
537
|
return R !== void 0 ? R : S;
|
|
538
538
|
},
|
|
539
539
|
set: function(v) {
|
|
540
|
-
R !== v && (R = v, i[x] = v, n[x] = v, o.dispatchEvent({ type: x + "-changed", value: v }), o.dispatchEvent(
|
|
540
|
+
R !== v && (R = v, i[x] = v, n[x] = v, o.dispatchEvent({ type: x + "-changed", value: v }), o.dispatchEvent(pt));
|
|
541
541
|
}
|
|
542
542
|
}), o[x] = S, i[x] = S, n[x] = S;
|
|
543
543
|
}
|
|
544
544
|
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);
|
|
545
|
-
const l = new
|
|
546
|
-
a("worldPosition", l), a("worldPositionStart", h), a("worldQuaternion", u), a("worldQuaternionStart", c), a("cameraPosition", p), a("cameraQuaternion", m), a("pointStart",
|
|
545
|
+
const l = new E(), h = new E(), u = new K(), c = new K(), p = new E(), m = new K(), w = new E(), f = new E(), y = new E(), d = 0, b = new E();
|
|
546
|
+
a("worldPosition", l), a("worldPositionStart", h), a("worldQuaternion", u), a("worldQuaternionStart", c), a("cameraPosition", p), a("cameraQuaternion", m), a("pointStart", w), a("pointEnd", f), a("rotationAxis", y), a("rotationAngle", d), a("eye", b), this._offset = new E(), this._startNorm = new E(), this._endNorm = new E(), this._cameraScale = new E(), this._parentPosition = new E(), this._parentQuaternion = new K(), this._parentQuaternionInv = new K(), this._parentScale = new E(), this._worldScaleStart = new E(), this._worldQuaternionInv = new K(), this._worldScale = new E(), this._positionStart = new E(), this._quaternionStart = new K(), this._scaleStart = new E(), this._getPointer = Os.bind(this), this._onPointerDown = Ds.bind(this), this._onPointerHover = Cs.bind(this), this._onPointerMove = Ns.bind(this), this._onPointerUp = ks.bind(this), t !== null && this.connect(t);
|
|
547
547
|
}
|
|
548
548
|
connect(e) {
|
|
549
549
|
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";
|
|
@@ -562,23 +562,23 @@ class Ss extends an {
|
|
|
562
562
|
}
|
|
563
563
|
pointerHover(e) {
|
|
564
564
|
if (this.object === void 0 || this.dragging === !0) return;
|
|
565
|
-
e !== null &&
|
|
566
|
-
const t =
|
|
565
|
+
e !== null && ge.setFromCamera(e, this.camera);
|
|
566
|
+
const t = ft(this._gizmo.picker[this.mode], ge);
|
|
567
567
|
t ? this.axis = t.object.name : this.axis = null;
|
|
568
568
|
}
|
|
569
569
|
pointerDown(e) {
|
|
570
570
|
if (!(this.object === void 0 || this.dragging === !0 || e != null && e.button !== 0) && this.axis !== null) {
|
|
571
|
-
e !== null &&
|
|
572
|
-
const t =
|
|
573
|
-
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,
|
|
571
|
+
e !== null && ge.setFromCamera(e, this.camera);
|
|
572
|
+
const t = ft(this._plane, ge, !0);
|
|
573
|
+
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, Xt.mode = this.mode, this.dispatchEvent(Xt);
|
|
574
574
|
}
|
|
575
575
|
}
|
|
576
576
|
pointerMove(e) {
|
|
577
577
|
const t = this.axis, s = this.mode, n = this.object;
|
|
578
578
|
let i = this.space;
|
|
579
579
|
if (s === "scale" ? i = "local" : (t === "E" || t === "XYZE" || t === "XYZ") && (i = "world"), n === void 0 || t === null || this.dragging === !1 || e !== null && e.button !== -1) return;
|
|
580
|
-
e !== null &&
|
|
581
|
-
const o =
|
|
580
|
+
e !== null && ge.setFromCamera(e, this.camera);
|
|
581
|
+
const o = ft(this._plane, ge, !0);
|
|
582
582
|
if (o) {
|
|
583
583
|
if (this.pointEnd.copy(o.point).sub(this.worldPositionStart), s === "translate")
|
|
584
584
|
this._offset.copy(this.pointEnd).sub(this.pointStart), i === "local" && t !== "XYZ" && this._offset.applyQuaternion(this._worldQuaternionInv), t.indexOf("X") === -1 && (this._offset.x = 0), t.indexOf("Y") === -1 && (this._offset.y = 0), t.indexOf("Z") === -1 && (this._offset.z = 0), i === "local" && t !== "XYZ" ? this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale) : this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale), n.position.copy(this._offset).add(this._positionStart), this.translationSnap && (i === "local" && (n.position.applyQuaternion(O.copy(this._quaternionStart).invert()), t.search("X") !== -1 && (n.position.x = Math.round(n.position.x / this.translationSnap) * this.translationSnap), t.search("Y") !== -1 && (n.position.y = Math.round(n.position.y / this.translationSnap) * this.translationSnap), t.search("Z") !== -1 && (n.position.z = Math.round(n.position.z / this.translationSnap) * this.translationSnap), n.position.applyQuaternion(this._quaternionStart)), i === "world" && (n.parent && n.position.add(H.setFromMatrixPosition(n.parent.matrixWorld)), t.search("X") !== -1 && (n.position.x = Math.round(n.position.x / this.translationSnap) * this.translationSnap), t.search("Y") !== -1 && (n.position.y = Math.round(n.position.y / this.translationSnap) * this.translationSnap), t.search("Z") !== -1 && (n.position.z = Math.round(n.position.z / this.translationSnap) * this.translationSnap), n.parent && n.position.sub(H.setFromMatrixPosition(n.parent.matrixWorld)))), n.position.x = Math.max(this.minX, Math.min(this.maxX, n.position.x)), n.position.y = Math.max(this.minY, Math.min(this.maxY, n.position.y)), n.position.z = Math.max(this.minZ, Math.min(this.maxZ, n.position.z));
|
|
@@ -593,13 +593,13 @@ class Ss extends an {
|
|
|
593
593
|
this._offset.copy(this.pointEnd).sub(this.pointStart);
|
|
594
594
|
const a = 20 / this.worldPosition.distanceTo(H.setFromMatrixPosition(this.camera.matrixWorld));
|
|
595
595
|
let l = !1;
|
|
596
|
-
t === "XYZE" ? (this.rotationAxis.copy(this._offset).cross(this.eye).normalize(), this.rotationAngle = this._offset.dot(H.copy(this.rotationAxis).cross(this.eye)) * a) : (t === "X" || t === "Y" || t === "Z") && (this.rotationAxis.copy(
|
|
596
|
+
t === "XYZE" ? (this.rotationAxis.copy(this._offset).cross(this.eye).normalize(), this.rotationAngle = this._offset.dot(H.copy(this.rotationAxis).cross(this.eye)) * a) : (t === "X" || t === "Y" || t === "Z") && (this.rotationAxis.copy(Gt[t]), H.copy(Gt[t]), i === "local" && H.applyQuaternion(this.worldQuaternion), H.cross(this.eye), H.length() === 0 ? l = !0 : this.rotationAngle = this._offset.dot(H.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(O.setFromAxisAngle(this.rotationAxis, this.rotationAngle)).normalize()) : (this.rotationAxis.applyQuaternion(this._parentQuaternionInv), n.quaternion.copy(O.setFromAxisAngle(this.rotationAxis, this.rotationAngle)), n.quaternion.multiply(this._quaternionStart).normalize());
|
|
597
597
|
}
|
|
598
|
-
this.dispatchEvent(
|
|
598
|
+
this.dispatchEvent(pt), this.dispatchEvent(Bt);
|
|
599
599
|
}
|
|
600
600
|
}
|
|
601
601
|
pointerUp(e) {
|
|
602
|
-
e !== null && e.button !== 0 || (this.dragging && this.axis !== null && (
|
|
602
|
+
e !== null && e.button !== 0 || (this.dragging && this.axis !== null && (Yt.mode = this.mode, this.dispatchEvent(Yt)), this.dragging = !1, this.axis = null);
|
|
603
603
|
}
|
|
604
604
|
dispose() {
|
|
605
605
|
this.disconnect(), this._root.dispose();
|
|
@@ -625,7 +625,7 @@ class Ss extends an {
|
|
|
625
625
|
* Resets the object's position, rotation and scale to when the current transform began.
|
|
626
626
|
*/
|
|
627
627
|
reset() {
|
|
628
|
-
this.enabled && this.dragging && (this.object.position.copy(this._positionStart), this.object.quaternion.copy(this._quaternionStart), this.object.scale.copy(this._scaleStart), this.dispatchEvent(
|
|
628
|
+
this.enabled && this.dragging && (this.object.position.copy(this._positionStart), this.object.quaternion.copy(this._quaternionStart), this.object.scale.copy(this._scaleStart), this.dispatchEvent(pt), this.dispatchEvent(Bt), this.pointStart.copy(this.pointEnd));
|
|
629
629
|
}
|
|
630
630
|
/**
|
|
631
631
|
* Returns the raycaster that is used for user interaction. This object is shared between all
|
|
@@ -634,7 +634,7 @@ class Ss extends an {
|
|
|
634
634
|
* @returns {Raycaster} The internal raycaster.
|
|
635
635
|
*/
|
|
636
636
|
getRaycaster() {
|
|
637
|
-
return
|
|
637
|
+
return ge;
|
|
638
638
|
}
|
|
639
639
|
/**
|
|
640
640
|
* Returns the transformation mode.
|
|
@@ -705,7 +705,7 @@ class Ss extends an {
|
|
|
705
705
|
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);
|
|
706
706
|
}
|
|
707
707
|
}
|
|
708
|
-
function
|
|
708
|
+
function Os(r) {
|
|
709
709
|
if (this.domElement.ownerDocument.pointerLockElement)
|
|
710
710
|
return {
|
|
711
711
|
x: 0,
|
|
@@ -721,7 +721,7 @@ function As(r) {
|
|
|
721
721
|
};
|
|
722
722
|
}
|
|
723
723
|
}
|
|
724
|
-
function
|
|
724
|
+
function Cs(r) {
|
|
725
725
|
if (this.enabled)
|
|
726
726
|
switch (r.pointerType) {
|
|
727
727
|
case "mouse":
|
|
@@ -730,24 +730,24 @@ function Rs(r) {
|
|
|
730
730
|
break;
|
|
731
731
|
}
|
|
732
732
|
}
|
|
733
|
-
function
|
|
733
|
+
function Ds(r) {
|
|
734
734
|
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)));
|
|
735
735
|
}
|
|
736
|
-
function
|
|
736
|
+
function Ns(r) {
|
|
737
737
|
this.enabled && this.pointerMove(this._getPointer(r));
|
|
738
738
|
}
|
|
739
|
-
function
|
|
739
|
+
function ks(r) {
|
|
740
740
|
this.enabled && (this.domElement.releasePointerCapture(r.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.pointerUp(this._getPointer(r)));
|
|
741
741
|
}
|
|
742
|
-
function
|
|
742
|
+
function ft(r, e, t) {
|
|
743
743
|
const s = e.intersectObject(r, !0);
|
|
744
744
|
for (let n = 0; n < s.length; n++)
|
|
745
745
|
if (s[n].object.visible || t)
|
|
746
746
|
return s[n];
|
|
747
747
|
return !1;
|
|
748
748
|
}
|
|
749
|
-
const
|
|
750
|
-
class
|
|
749
|
+
const et = new Hn(), L = new E(0, 1, 0), Kt = new E(0, 0, 0), Vt = new Ae(), tt = new K(), rt = new K(), te = new E(), Zt = new Ae(), De = new E(1, 0, 0), _e = new E(0, 1, 0), Ne = new E(0, 0, 1), nt = new E(), Le = new E(), Ie = new E();
|
|
750
|
+
class js extends Xe {
|
|
751
751
|
constructor(e) {
|
|
752
752
|
super(), this.isTransformControlsRoot = !0, this.controls = e, this.visible = !1;
|
|
753
753
|
}
|
|
@@ -762,10 +762,10 @@ class Os extends ze {
|
|
|
762
762
|
});
|
|
763
763
|
}
|
|
764
764
|
}
|
|
765
|
-
class
|
|
765
|
+
class Fs extends Xe {
|
|
766
766
|
constructor() {
|
|
767
767
|
super(), this.isTransformControlsGizmo = !0, this.type = "TransformControlsGizmo";
|
|
768
|
-
const e = new
|
|
768
|
+
const e = new be({
|
|
769
769
|
depthTest: !1,
|
|
770
770
|
depthWrite: !1,
|
|
771
771
|
fog: !1,
|
|
@@ -799,8 +799,8 @@ class Cs extends ze {
|
|
|
799
799
|
p.color.setHex(16776960), p.opacity = 0.25;
|
|
800
800
|
const m = e.clone();
|
|
801
801
|
m.color.setHex(16776960);
|
|
802
|
-
const
|
|
803
|
-
|
|
802
|
+
const w = e.clone();
|
|
803
|
+
w.color.setHex(7895160), this.materialLib = {
|
|
804
804
|
xAxis: i,
|
|
805
805
|
yAxis: o,
|
|
806
806
|
zAxis: a,
|
|
@@ -814,36 +814,36 @@ class Cs extends ze {
|
|
|
814
814
|
f.translate(0, 0.05, 0);
|
|
815
815
|
const y = new z(0.08, 0.08, 0.08);
|
|
816
816
|
y.translate(0, 0.04, 0);
|
|
817
|
-
const d = new
|
|
817
|
+
const d = new Ye();
|
|
818
818
|
d.setAttribute("position", new de([0, 0, 0, 1, 0, 0], 3));
|
|
819
|
-
const
|
|
820
|
-
|
|
821
|
-
function x(Z,
|
|
822
|
-
const J = new Pe(Z, 75e-4, 3, 64,
|
|
819
|
+
const b = new Y(75e-4, 75e-4, 0.5, 3);
|
|
820
|
+
b.translate(0, 0.25, 0);
|
|
821
|
+
function x(Z, Ve) {
|
|
822
|
+
const J = new Pe(Z, 75e-4, 3, 64, Ve * Math.PI * 2);
|
|
823
823
|
return J.rotateY(Math.PI / 2), J.rotateX(Math.PI / 2), J;
|
|
824
824
|
}
|
|
825
825
|
function S() {
|
|
826
|
-
const Z = new
|
|
826
|
+
const Z = new Ye();
|
|
827
827
|
return Z.setAttribute("position", new de([0, 0, 0, 1, 1, 1], 3)), Z;
|
|
828
828
|
}
|
|
829
829
|
const R = {
|
|
830
830
|
X: [
|
|
831
831
|
[new T(f, i), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
|
|
832
832
|
[new T(f, i), [-0.5, 0, 0], [0, 0, Math.PI / 2]],
|
|
833
|
-
[new T(
|
|
833
|
+
[new T(b, i), [0, 0, 0], [0, 0, -Math.PI / 2]]
|
|
834
834
|
],
|
|
835
835
|
Y: [
|
|
836
836
|
[new T(f, o), [0, 0.5, 0]],
|
|
837
837
|
[new T(f, o), [0, -0.5, 0], [Math.PI, 0, 0]],
|
|
838
|
-
[new T(
|
|
838
|
+
[new T(b, o)]
|
|
839
839
|
],
|
|
840
840
|
Z: [
|
|
841
841
|
[new T(f, a), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
|
|
842
842
|
[new T(f, a), [0, 0, -0.5], [-Math.PI / 2, 0, 0]],
|
|
843
|
-
[new T(
|
|
843
|
+
[new T(b, a), null, [Math.PI / 2, 0, 0]]
|
|
844
844
|
],
|
|
845
845
|
XYZ: [
|
|
846
|
-
[new T(new
|
|
846
|
+
[new T(new $e(0.1, 0), c), [0, 0, 0]]
|
|
847
847
|
],
|
|
848
848
|
XY: [
|
|
849
849
|
[new T(new z(0.15, 0.15, 0.01), u), [0.15, 0.15, 0]]
|
|
@@ -868,7 +868,7 @@ class Cs extends ze {
|
|
|
868
868
|
[new T(new Y(0.2, 0, 0.6, 4), s), [0, 0, -0.3], [-Math.PI / 2, 0, 0]]
|
|
869
869
|
],
|
|
870
870
|
XYZ: [
|
|
871
|
-
[new T(new
|
|
871
|
+
[new T(new $e(0.2, 0), s)]
|
|
872
872
|
],
|
|
873
873
|
XY: [
|
|
874
874
|
[new T(new z(0.2, 0.2, 0.01), s), [0.15, 0.15, 0]]
|
|
@@ -881,10 +881,10 @@ class Cs extends ze {
|
|
|
881
881
|
]
|
|
882
882
|
}, I = {
|
|
883
883
|
START: [
|
|
884
|
-
[new T(new
|
|
884
|
+
[new T(new $e(0.01, 2), n), null, null, null, "helper"]
|
|
885
885
|
],
|
|
886
886
|
END: [
|
|
887
|
-
[new T(new
|
|
887
|
+
[new T(new $e(0.01, 2), n), null, null, null, "helper"]
|
|
888
888
|
],
|
|
889
889
|
DELTA: [
|
|
890
890
|
[new re(S(), n), null, null, null, "helper"]
|
|
@@ -900,7 +900,7 @@ class Cs extends ze {
|
|
|
900
900
|
]
|
|
901
901
|
}, ie = {
|
|
902
902
|
XYZE: [
|
|
903
|
-
[new T(x(0.5, 1),
|
|
903
|
+
[new T(x(0.5, 1), w), null, [0, Math.PI / 2, 0]]
|
|
904
904
|
],
|
|
905
905
|
X: [
|
|
906
906
|
[new T(x(0.5, 0.5), i)]
|
|
@@ -918,9 +918,9 @@ class Cs extends ze {
|
|
|
918
918
|
AXIS: [
|
|
919
919
|
[new re(d, n), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]
|
|
920
920
|
]
|
|
921
|
-
},
|
|
921
|
+
}, me = {
|
|
922
922
|
XYZE: [
|
|
923
|
-
[new T(new
|
|
923
|
+
[new T(new Fn(0.25, 10, 8), s)]
|
|
924
924
|
],
|
|
925
925
|
X: [
|
|
926
926
|
[new T(new Pe(0.5, 0.1, 4, 24), s), [0, 0, 0], [0, -Math.PI / 2, -Math.PI / 2]]
|
|
@@ -937,17 +937,17 @@ class Cs extends ze {
|
|
|
937
937
|
}, $ = {
|
|
938
938
|
X: [
|
|
939
939
|
[new T(y, i), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
|
|
940
|
-
[new T(
|
|
940
|
+
[new T(b, i), [0, 0, 0], [0, 0, -Math.PI / 2]],
|
|
941
941
|
[new T(y, i), [-0.5, 0, 0], [0, 0, Math.PI / 2]]
|
|
942
942
|
],
|
|
943
943
|
Y: [
|
|
944
944
|
[new T(y, o), [0, 0.5, 0]],
|
|
945
|
-
[new T(
|
|
945
|
+
[new T(b, o)],
|
|
946
946
|
[new T(y, o), [0, -0.5, 0], [0, 0, Math.PI]]
|
|
947
947
|
],
|
|
948
948
|
Z: [
|
|
949
949
|
[new T(y, a), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
|
|
950
|
-
[new T(
|
|
950
|
+
[new T(b, a), [0, 0, 0], [Math.PI / 2, 0, 0]],
|
|
951
951
|
[new T(y, a), [0, 0, -0.5], [-Math.PI / 2, 0, 0]]
|
|
952
952
|
],
|
|
953
953
|
XY: [
|
|
@@ -962,7 +962,7 @@ class Cs extends ze {
|
|
|
962
962
|
XYZ: [
|
|
963
963
|
[new T(new z(0.1, 0.1, 0.1), c)]
|
|
964
964
|
]
|
|
965
|
-
},
|
|
965
|
+
}, M = {
|
|
966
966
|
X: [
|
|
967
967
|
[new T(new Y(0.2, 0, 0.6, 4), s), [0.3, 0, 0], [0, 0, -Math.PI / 2]],
|
|
968
968
|
[new T(new Y(0.2, 0, 0.6, 4), s), [-0.3, 0, 0], [0, 0, Math.PI / 2]]
|
|
@@ -999,21 +999,21 @@ class Cs extends ze {
|
|
|
999
999
|
]
|
|
1000
1000
|
};
|
|
1001
1001
|
function oe(Z) {
|
|
1002
|
-
const
|
|
1002
|
+
const Ve = new Xe();
|
|
1003
1003
|
for (const J in Z)
|
|
1004
|
-
for (let
|
|
1005
|
-
const X = Z[J][
|
|
1006
|
-
X.name = J, X.tag =
|
|
1007
|
-
const
|
|
1008
|
-
|
|
1004
|
+
for (let xe = Z[J].length; xe--; ) {
|
|
1005
|
+
const X = Z[J][xe][0].clone(), Ze = Z[J][xe][1], Qe = Z[J][xe][2], qe = Z[J][xe][3], vn = Z[J][xe][4];
|
|
1006
|
+
X.name = J, X.tag = vn, Ze && X.position.set(Ze[0], Ze[1], Ze[2]), Qe && X.rotation.set(Qe[0], Qe[1], Qe[2]), qe && X.scale.set(qe[0], qe[1], qe[2]), X.updateMatrix();
|
|
1007
|
+
const Ot = X.geometry.clone();
|
|
1008
|
+
Ot.applyMatrix4(X.matrix), X.geometry = Ot, X.renderOrder = 1 / 0, X.position.set(0, 0, 0), X.rotation.set(0, 0, 0), X.scale.set(1, 1, 1), Ve.add(X);
|
|
1009
1009
|
}
|
|
1010
|
-
return
|
|
1010
|
+
return Ve;
|
|
1011
1011
|
}
|
|
1012
|
-
this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = oe(R)), this.add(this.gizmo.rotate = oe(ie)), this.add(this.gizmo.scale = oe($)), this.add(this.picker.translate = oe(v)), this.add(this.picker.rotate = oe(
|
|
1012
|
+
this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = oe(R)), this.add(this.gizmo.rotate = oe(ie)), this.add(this.gizmo.scale = oe($)), this.add(this.picker.translate = oe(v)), this.add(this.picker.rotate = oe(me)), this.add(this.picker.scale = oe(M)), this.add(this.helper.translate = oe(I)), this.add(this.helper.rotate = oe(ee)), this.add(this.helper.scale = oe(j)), this.picker.translate.visible = !1, this.picker.rotate.visible = !1, this.picker.scale.visible = !1;
|
|
1013
1013
|
}
|
|
1014
1014
|
// updateMatrixWorld will update transformations and appearance of individual handles
|
|
1015
1015
|
updateMatrixWorld(e) {
|
|
1016
|
-
const s = (this.mode === "scale" ? "local" : this.space) === "local" ? this.worldQuaternion :
|
|
1016
|
+
const s = (this.mode === "scale" ? "local" : this.space) === "local" ? this.worldQuaternion : rt;
|
|
1017
1017
|
this.gizmo.translate.visible = this.mode === "translate", this.gizmo.rotate.visible = this.mode === "rotate", this.gizmo.scale.visible = this.mode === "scale", this.helper.translate.visible = this.mode === "translate", this.helper.rotate.visible = this.mode === "rotate", this.helper.scale.visible = this.mode === "scale";
|
|
1018
1018
|
let n = [];
|
|
1019
1019
|
n = n.concat(this.picker[this.mode].children), n = n.concat(this.gizmo[this.mode].children), n = n.concat(this.helper[this.mode].children);
|
|
@@ -1022,31 +1022,31 @@ class Cs extends ze {
|
|
|
1022
1022
|
o.visible = !0, o.rotation.set(0, 0, 0), o.position.copy(this.worldPosition);
|
|
1023
1023
|
let a;
|
|
1024
1024
|
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") {
|
|
1025
|
-
o.visible = !1, o.name === "AXIS" ? (o.visible = !!this.axis, this.axis === "X" && (O.setFromEuler(
|
|
1025
|
+
o.visible = !1, o.name === "AXIS" ? (o.visible = !!this.axis, this.axis === "X" && (O.setFromEuler(et.set(0, 0, 0)), o.quaternion.copy(s).multiply(O), Math.abs(L.copy(De).applyQuaternion(s).dot(this.eye)) > 0.9 && (o.visible = !1)), this.axis === "Y" && (O.setFromEuler(et.set(0, 0, Math.PI / 2)), o.quaternion.copy(s).multiply(O), Math.abs(L.copy(_e).applyQuaternion(s).dot(this.eye)) > 0.9 && (o.visible = !1)), this.axis === "Z" && (O.setFromEuler(et.set(0, Math.PI / 2, 0)), o.quaternion.copy(s).multiply(O), Math.abs(L.copy(Ne).applyQuaternion(s).dot(this.eye)) > 0.9 && (o.visible = !1)), this.axis === "XYZE" && (O.setFromEuler(et.set(0, Math.PI / 2, 0)), L.copy(this.rotationAxis), o.quaternion.setFromRotationMatrix(Vt.lookAt(Kt, L, _e)), o.quaternion.multiply(O), 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), H.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1), H.applyQuaternion(this.worldQuaternionStart.clone().invert()), o.scale.copy(H), 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));
|
|
1026
1026
|
continue;
|
|
1027
1027
|
}
|
|
1028
|
-
o.quaternion.copy(s), this.mode === "translate" || this.mode === "scale" ? (o.name === "X" && Math.abs(L.copy(De).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(
|
|
1028
|
+
o.quaternion.copy(s), this.mode === "translate" || this.mode === "scale" ? (o.name === "X" && Math.abs(L.copy(De).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(_e).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(Ne).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(Ne).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(De).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(_e).applyQuaternion(s).dot(this.eye)) < 0.2 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1)) : this.mode === "rotate" && (tt.copy(s), L.copy(this.eye).applyQuaternion(O.copy(s).invert()), o.name.search("E") !== -1 && o.quaternion.setFromRotationMatrix(Vt.lookAt(this.eye, Kt, _e)), o.name === "X" && (O.setFromAxisAngle(De, Math.atan2(-L.y, L.z)), O.multiplyQuaternions(tt, O), o.quaternion.copy(O)), o.name === "Y" && (O.setFromAxisAngle(_e, Math.atan2(L.x, L.z)), O.multiplyQuaternions(tt, O), o.quaternion.copy(O)), o.name === "Z" && (O.setFromAxisAngle(Ne, Math.atan2(L.y, L.x)), O.multiplyQuaternions(tt, O), o.quaternion.copy(O))), 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) {
|
|
1029
1029
|
return o.name === l;
|
|
1030
1030
|
}) && (o.material.color.copy(this.materialLib.active.color), o.material.opacity = 1));
|
|
1031
1031
|
}
|
|
1032
1032
|
super.updateMatrixWorld(e);
|
|
1033
1033
|
}
|
|
1034
1034
|
}
|
|
1035
|
-
class
|
|
1035
|
+
class Hs extends T {
|
|
1036
1036
|
constructor() {
|
|
1037
1037
|
super(
|
|
1038
|
-
new
|
|
1039
|
-
new
|
|
1038
|
+
new Un(1e5, 1e5, 2, 2),
|
|
1039
|
+
new be({ visible: !1, wireframe: !0, side: dn, transparent: !0, opacity: 0.1, toneMapped: !1 })
|
|
1040
1040
|
), this.isTransformControlsPlane = !0, this.type = "TransformControlsPlane";
|
|
1041
1041
|
}
|
|
1042
1042
|
updateMatrixWorld(e) {
|
|
1043
1043
|
let t = this.space;
|
|
1044
|
-
switch (this.position.copy(this.worldPosition), this.mode === "scale" && (t = "local"),
|
|
1044
|
+
switch (this.position.copy(this.worldPosition), this.mode === "scale" && (t = "local"), nt.copy(De).applyQuaternion(t === "local" ? this.worldQuaternion : rt), Le.copy(_e).applyQuaternion(t === "local" ? this.worldQuaternion : rt), Ie.copy(Ne).applyQuaternion(t === "local" ? this.worldQuaternion : rt), L.copy(Le), this.mode) {
|
|
1045
1045
|
case "translate":
|
|
1046
1046
|
case "scale":
|
|
1047
1047
|
switch (this.axis) {
|
|
1048
1048
|
case "X":
|
|
1049
|
-
L.copy(this.eye).cross(
|
|
1049
|
+
L.copy(this.eye).cross(nt), te.copy(nt).cross(L);
|
|
1050
1050
|
break;
|
|
1051
1051
|
case "Y":
|
|
1052
1052
|
L.copy(this.eye).cross(Le), te.copy(Le).cross(L);
|
|
@@ -1058,7 +1058,7 @@ class Ds extends T {
|
|
|
1058
1058
|
te.copy(Ie);
|
|
1059
1059
|
break;
|
|
1060
1060
|
case "YZ":
|
|
1061
|
-
te.copy(
|
|
1061
|
+
te.copy(nt);
|
|
1062
1062
|
break;
|
|
1063
1063
|
case "XZ":
|
|
1064
1064
|
L.copy(Ie), te.copy(Le);
|
|
@@ -1073,10 +1073,10 @@ class Ds extends T {
|
|
|
1073
1073
|
default:
|
|
1074
1074
|
te.set(0, 0, 0);
|
|
1075
1075
|
}
|
|
1076
|
-
te.length() === 0 ? this.quaternion.copy(this.cameraQuaternion) : (
|
|
1076
|
+
te.length() === 0 ? this.quaternion.copy(this.cameraQuaternion) : (Zt.lookAt(H.set(0, 0, 0), te, L), this.quaternion.setFromRotationMatrix(Zt)), super.updateMatrixWorld(e);
|
|
1077
1077
|
}
|
|
1078
1078
|
}
|
|
1079
|
-
const
|
|
1079
|
+
const _ = {
|
|
1080
1080
|
mode: "",
|
|
1081
1081
|
/** Three.js 场景 */
|
|
1082
1082
|
scene: null,
|
|
@@ -1095,170 +1095,185 @@ const w = {
|
|
|
1095
1095
|
/** 当前选中的物体 */
|
|
1096
1096
|
selectedObject: null
|
|
1097
1097
|
};
|
|
1098
|
-
let
|
|
1099
|
-
function
|
|
1100
|
-
if (
|
|
1098
|
+
let at = !1, Te = !1, we = null, Et = null, lt = null, fe = [], mt, ct = null, Ue = null, ze = null;
|
|
1099
|
+
function Us(r, e = "edit", t) {
|
|
1100
|
+
if (_.container = r, _.mode = e, zs(), Gs(), Ys(), t && (oi(t.scene, e), t != null && t.camera)) {
|
|
1101
1101
|
const s = t.camera;
|
|
1102
|
-
|
|
1102
|
+
_.camera.position.set(
|
|
1103
1103
|
s.position[0],
|
|
1104
1104
|
s.position[1],
|
|
1105
1105
|
s.position[2]
|
|
1106
|
-
),
|
|
1106
|
+
), _.camera.rotation.set(
|
|
1107
1107
|
s.rotation[0],
|
|
1108
1108
|
s.rotation[1],
|
|
1109
1109
|
s.rotation[2]
|
|
1110
|
-
),
|
|
1110
|
+
), _.camera.updateProjectionMatrix(), mt = s.target;
|
|
1111
1111
|
}
|
|
1112
|
-
|
|
1112
|
+
Ks(), Bs(), mt && _.orbitControls && (_.orbitControls.target.fromArray(mt), _.orbitControls.update()), ei(), wn(), Ue = (s) => Qs(s), ze = () => Zs(), e === "edit" && r.addEventListener("click", Ue), window.addEventListener("resize", ze), t || Vs(), e === "edit" && Xs();
|
|
1113
1113
|
}
|
|
1114
|
-
function
|
|
1114
|
+
function zs() {
|
|
1115
1115
|
const r = new F.WebGLRenderer({ antialias: !0, alpha: !0 });
|
|
1116
|
-
r.setSize(
|
|
1116
|
+
r.setSize(_.container.clientWidth, _.container.clientHeight), r.setPixelRatio(Math.min(window.devicePixelRatio, 2)), _.container.appendChild(r.domElement), _.renderer = r;
|
|
1117
1117
|
}
|
|
1118
|
-
function
|
|
1119
|
-
|
|
1118
|
+
function Gs() {
|
|
1119
|
+
_.scene = new F.Scene(), _.scene.name = "sl_scene";
|
|
1120
1120
|
}
|
|
1121
|
-
function
|
|
1121
|
+
function Xs() {
|
|
1122
1122
|
const r = new F.GridHelper(30, 30, 8956671, 3364232);
|
|
1123
|
-
r.name = "地板", r.userData.type = "initFloor",
|
|
1123
|
+
r.name = "地板", r.userData.type = "initFloor", _.scene.add(r), _.gridHelper = r;
|
|
1124
1124
|
}
|
|
1125
|
-
function
|
|
1126
|
-
const r =
|
|
1127
|
-
t.position.set(0, 6, 15), t.lookAt(0, 0, 0),
|
|
1125
|
+
function Ys() {
|
|
1126
|
+
const r = _.container, e = r.clientWidth / r.clientHeight, t = new F.PerspectiveCamera(45, e, 0.1, 1e3);
|
|
1127
|
+
t.position.set(0, 6, 15), t.lookAt(0, 0, 0), _.camera = t;
|
|
1128
1128
|
}
|
|
1129
|
-
function
|
|
1130
|
-
const r = new
|
|
1129
|
+
function Bs() {
|
|
1130
|
+
const r = new _s(_.camera, _.renderer.domElement);
|
|
1131
1131
|
r.minDistance = 0, r.maxDistance = 1 / 0, r.addEventListener("start", () => {
|
|
1132
|
-
|
|
1132
|
+
at = !1;
|
|
1133
1133
|
}), r.addEventListener("change", () => {
|
|
1134
|
-
|
|
1134
|
+
at = !0;
|
|
1135
1135
|
}), r.addEventListener("end", () => {
|
|
1136
|
-
|
|
1137
|
-
|
|
1136
|
+
at && (Te = !0, setTimeout(() => {
|
|
1137
|
+
Te = !1;
|
|
1138
1138
|
}, 200));
|
|
1139
|
-
}),
|
|
1139
|
+
}), _.orbitControls = r;
|
|
1140
1140
|
}
|
|
1141
|
-
function
|
|
1142
|
-
const r = new
|
|
1143
|
-
|
|
1144
|
-
|
|
1141
|
+
function Ks() {
|
|
1142
|
+
const r = new Is(
|
|
1143
|
+
_.camera,
|
|
1144
|
+
_.renderer.domElement
|
|
1145
1145
|
);
|
|
1146
1146
|
r.addEventListener("dragging-changed", (e) => {
|
|
1147
|
-
|
|
1148
|
-
|
|
1147
|
+
_.orbitControls.enabled = !e.value, e.value || (Te = !0, setTimeout(() => {
|
|
1148
|
+
Te = !1;
|
|
1149
1149
|
}, 200));
|
|
1150
1150
|
}), r.addEventListener("objectChange", () => {
|
|
1151
|
-
|
|
1152
|
-
}),
|
|
1151
|
+
Et && _.selectedObject && Et(_.selectedObject);
|
|
1152
|
+
}), _.scene.add(r.getHelper()), _.transformControls = r;
|
|
1153
1153
|
}
|
|
1154
|
-
function
|
|
1154
|
+
function Vs() {
|
|
1155
1155
|
const r = new F.AmbientLight(16777215, 2);
|
|
1156
|
-
|
|
1156
|
+
_.scene.add(r);
|
|
1157
1157
|
const e = new F.DirectionalLight(16777215, 3);
|
|
1158
|
-
e.position.set(48, 104, 138),
|
|
1158
|
+
e.position.set(48, 104, 138), _.scene.add(e);
|
|
1159
1159
|
}
|
|
1160
|
-
function
|
|
1160
|
+
function wn() {
|
|
1161
1161
|
var r, e;
|
|
1162
|
-
requestAnimationFrame(
|
|
1162
|
+
ct = requestAnimationFrame(wn), gs.update(), (r = _.orbitControls) == null || r.update(), (e = _.renderer) == null || e.render(_.scene, _.camera);
|
|
1163
1163
|
}
|
|
1164
|
-
function
|
|
1165
|
-
if (!
|
|
1166
|
-
const r =
|
|
1167
|
-
r === 0 || e === 0 || (
|
|
1164
|
+
function Zs() {
|
|
1165
|
+
if (!_.container || !_.camera || !_.renderer) return;
|
|
1166
|
+
const r = _.container.clientWidth, e = _.container.clientHeight;
|
|
1167
|
+
r === 0 || e === 0 || (_.camera.aspect = r / e, _.camera.updateProjectionMatrix(), _.renderer.setSize(r, e));
|
|
1168
1168
|
}
|
|
1169
|
-
function
|
|
1170
|
-
|
|
1169
|
+
function Pt(r) {
|
|
1170
|
+
_.selectedObject !== r && (_.selectedObject && _.transformControls.detach(), _.selectedObject = r, _.transformControls.attach(r), _.transformControls.setMode("translate"), _.transformControls.showX = !0, _.transformControls.showY = !0, _.transformControls.showZ = !0, we == null || we(r));
|
|
1171
1171
|
}
|
|
1172
|
-
function
|
|
1173
|
-
|
|
1172
|
+
function Lt() {
|
|
1173
|
+
_.selectedObject && (_.transformControls.detach(), _.selectedObject = null, we == null || we(null));
|
|
1174
1174
|
}
|
|
1175
|
-
function
|
|
1176
|
-
if (
|
|
1177
|
-
|
|
1175
|
+
function Qs(r) {
|
|
1176
|
+
if (Te) {
|
|
1177
|
+
Te = !1;
|
|
1178
1178
|
return;
|
|
1179
1179
|
}
|
|
1180
|
-
const e =
|
|
1180
|
+
const e = _.renderer.domElement.getBoundingClientRect(), t = new F.Vector2(
|
|
1181
1181
|
(r.clientX - e.left) / e.width * 2 - 1,
|
|
1182
1182
|
-((r.clientY - e.top) / e.height) * 2 + 1
|
|
1183
1183
|
), s = new F.Raycaster();
|
|
1184
|
-
s.setFromCamera(t,
|
|
1184
|
+
s.setFromCamera(t, _.camera);
|
|
1185
1185
|
const n = [];
|
|
1186
|
-
|
|
1186
|
+
_.scene.traverse((o) => {
|
|
1187
1187
|
o.type === "Mesh" && o.userData.isMovable && n.push(o);
|
|
1188
1188
|
});
|
|
1189
1189
|
const i = s.intersectObjects(n);
|
|
1190
|
-
i.length > 0 ?
|
|
1190
|
+
i.length > 0 ? Pt(i[0].object) : Lt();
|
|
1191
1191
|
}
|
|
1192
|
-
function
|
|
1193
|
-
|
|
1192
|
+
function It(r, e = !1) {
|
|
1193
|
+
_.scene.add(r), r.userData.isMovable && ($s(r), ht()), e && _.mode === "edit" && Pt(r);
|
|
1194
1194
|
}
|
|
1195
|
-
function
|
|
1196
|
-
|
|
1195
|
+
function qs(r) {
|
|
1196
|
+
_.selectedObject === r && Lt(), r.parent ? r.parent.remove(r) : _.scene.remove(r), Js(r), ht();
|
|
1197
1197
|
}
|
|
1198
|
-
function
|
|
1199
|
-
const e =
|
|
1200
|
-
e &&
|
|
1198
|
+
function Ws(r) {
|
|
1199
|
+
const e = _.scene.getObjectByProperty("uuid", r);
|
|
1200
|
+
e && qs(e);
|
|
1201
1201
|
}
|
|
1202
|
-
function
|
|
1203
|
-
r.userData.isMovable && r.parent ===
|
|
1202
|
+
function $s(r) {
|
|
1203
|
+
r.userData.isMovable && r.parent === _.scene && (fe.includes(r) || fe.push(r));
|
|
1204
1204
|
}
|
|
1205
|
-
function
|
|
1206
|
-
const e =
|
|
1207
|
-
e !== -1 &&
|
|
1205
|
+
function Js(r) {
|
|
1206
|
+
const e = fe.indexOf(r);
|
|
1207
|
+
e !== -1 && fe.splice(e, 1);
|
|
1208
1208
|
}
|
|
1209
|
-
function
|
|
1209
|
+
function ei() {
|
|
1210
1210
|
const r = [];
|
|
1211
|
-
|
|
1211
|
+
_.scene.children.forEach((e) => {
|
|
1212
1212
|
e.userData.isMovable && r.push(e);
|
|
1213
|
-
}),
|
|
1213
|
+
}), fe = r, ht();
|
|
1214
1214
|
}
|
|
1215
|
-
function
|
|
1216
|
-
|
|
1215
|
+
function ht() {
|
|
1216
|
+
lt == null || lt([...fe]);
|
|
1217
1217
|
}
|
|
1218
|
-
function
|
|
1219
|
-
|
|
1218
|
+
function ti(r) {
|
|
1219
|
+
we = r;
|
|
1220
1220
|
}
|
|
1221
|
-
function
|
|
1222
|
-
|
|
1221
|
+
function ni(r) {
|
|
1222
|
+
Et = r;
|
|
1223
1223
|
}
|
|
1224
|
-
function
|
|
1225
|
-
|
|
1224
|
+
function si(r) {
|
|
1225
|
+
lt = r;
|
|
1226
1226
|
}
|
|
1227
|
-
function
|
|
1228
|
-
return
|
|
1227
|
+
function ii() {
|
|
1228
|
+
return fe;
|
|
1229
1229
|
}
|
|
1230
|
-
function
|
|
1231
|
-
return
|
|
1230
|
+
function Zo() {
|
|
1231
|
+
return _.scene;
|
|
1232
1232
|
}
|
|
1233
|
-
function
|
|
1234
|
-
return
|
|
1233
|
+
function Qo() {
|
|
1234
|
+
return _.camera;
|
|
1235
1235
|
}
|
|
1236
|
-
function
|
|
1237
|
-
return
|
|
1236
|
+
function qo() {
|
|
1237
|
+
return _.renderer;
|
|
1238
1238
|
}
|
|
1239
|
-
function
|
|
1239
|
+
function Wo() {
|
|
1240
1240
|
var n, i, o;
|
|
1241
|
-
|
|
1242
|
-
const r =
|
|
1241
|
+
Lt();
|
|
1242
|
+
const r = _.scene;
|
|
1243
1243
|
if (!r) return "{}";
|
|
1244
1244
|
let e = r;
|
|
1245
1245
|
e = r.clone(), e.children = e.children.filter(
|
|
1246
1246
|
(a) => a.userData.type !== "initFloor"
|
|
1247
1247
|
);
|
|
1248
1248
|
const t = e.toJSON(), s = {
|
|
1249
|
-
position: (n =
|
|
1250
|
-
rotation: (i =
|
|
1251
|
-
target: ((o =
|
|
1249
|
+
position: (n = _.camera) == null ? void 0 : n.position.toArray(),
|
|
1250
|
+
rotation: (i = _.camera) == null ? void 0 : i.rotation.toArray(),
|
|
1251
|
+
target: ((o = _.orbitControls) == null ? void 0 : o.target.toArray()) || [0, 0, 0]
|
|
1252
1252
|
};
|
|
1253
1253
|
return JSON.stringify({ scene: t, camera: s });
|
|
1254
1254
|
}
|
|
1255
|
-
function
|
|
1255
|
+
function oi(r, e = "edit") {
|
|
1256
1256
|
var i;
|
|
1257
1257
|
const t = typeof r == "string" ? JSON.parse(r) : r, n = new F.ObjectLoader().parse(t);
|
|
1258
|
-
n.type === "Scene" ?
|
|
1258
|
+
n.type === "Scene" ? _.scene = n : (i = _.scene) == null || i.add(n);
|
|
1259
1259
|
}
|
|
1260
|
-
|
|
1261
|
-
|
|
1260
|
+
function Tn(r) {
|
|
1261
|
+
if (!r) return;
|
|
1262
|
+
if (r.type === "Mesh") {
|
|
1263
|
+
const t = r;
|
|
1264
|
+
t.geometry && t.geometry.dispose(), t.material && (Array.isArray(t.material) ? t.material : [t.material]).forEach((n) => {
|
|
1265
|
+
n.map && (n.map = null), n.lightMap && (n.lightMap = null), n.aoMap && (n.aoMap = null), n.emissiveMap && (n.emissiveMap = null), n.bumpMap && (n.bumpMap = null), n.normalMap && (n.normalMap = null), n.displacementMap && (n.displacementMap = null), n.roughnessMap && (n.roughnessMap = null), n.metalnessMap && (n.metalnessMap = null), n.alphaMap && (n.alphaMap = null), n.envMap && (n.envMap = null), n.dispose();
|
|
1266
|
+
});
|
|
1267
|
+
}
|
|
1268
|
+
const e = r.children.slice();
|
|
1269
|
+
for (const t of e)
|
|
1270
|
+
Tn(t);
|
|
1271
|
+
}
|
|
1272
|
+
function ri() {
|
|
1273
|
+
ct !== null && (cancelAnimationFrame(ct), ct = null), Ue && _.container && (_.container.removeEventListener("click", Ue), Ue = null), ze && (window.removeEventListener("resize", ze), ze = null), _.orbitControls && (_.orbitControls.dispose(), _.orbitControls = null), _.transformControls && (_.transformControls.dispose(), _.transformControls = null), _.scene && (Tn(_.scene), _.scene = null), _.renderer && (_.renderer.dispose(), _.renderer.domElement && _.container && _.container.removeChild(_.renderer.domElement), _.renderer = null), _.camera = null, _.gridHelper = null, _.selectedObject = null, _.container = null, _.mode = "", fe = [], ht(), at = !1, Te = !1;
|
|
1274
|
+
}
|
|
1275
|
+
const ai = /^[og]\s*(.+)?/, li = /^mtllib /, ci = /^usemtl /, hi = /^usemap /, Qt = /\s+/, qt = new E(), gt = new E(), Wt = new E(), $t = new E(), q = new E(), st = new pe();
|
|
1276
|
+
function ui() {
|
|
1262
1277
|
const r = {
|
|
1263
1278
|
objects: [],
|
|
1264
1279
|
object: {},
|
|
@@ -1367,7 +1382,7 @@ function oi() {
|
|
|
1367
1382
|
},
|
|
1368
1383
|
addFaceNormal: function(e, t, s) {
|
|
1369
1384
|
const n = this.vertices, i = this.object.geometry.normals;
|
|
1370
|
-
|
|
1385
|
+
qt.fromArray(n, e), gt.fromArray(n, t), Wt.fromArray(n, s), q.subVectors(Wt, gt), $t.subVectors(qt, gt), q.cross($t), q.normalize(), i.push(q.x, q.y, q.z), i.push(q.x, q.y, q.z), i.push(q.x, q.y, q.z);
|
|
1371
1386
|
},
|
|
1372
1387
|
addColor: function(e, t, s) {
|
|
1373
1388
|
const n = this.colors, i = this.object.geometry.colors;
|
|
@@ -1389,13 +1404,13 @@ function oi() {
|
|
|
1389
1404
|
const u = this.vertices.length;
|
|
1390
1405
|
let c = this.parseVertexIndex(e, u), p = this.parseVertexIndex(t, u), m = this.parseVertexIndex(s, u);
|
|
1391
1406
|
if (this.addVertex(c, p, m), this.addColor(c, p, m), a !== void 0 && a !== "") {
|
|
1392
|
-
const
|
|
1393
|
-
c = this.parseNormalIndex(a,
|
|
1407
|
+
const w = this.normals.length;
|
|
1408
|
+
c = this.parseNormalIndex(a, w), p = this.parseNormalIndex(l, w), m = this.parseNormalIndex(h, w), this.addNormal(c, p, m);
|
|
1394
1409
|
} else
|
|
1395
1410
|
this.addFaceNormal(c, p, m);
|
|
1396
1411
|
if (n !== void 0 && n !== "") {
|
|
1397
|
-
const
|
|
1398
|
-
c = this.parseUVIndex(n,
|
|
1412
|
+
const w = this.uvs.length;
|
|
1413
|
+
c = this.parseUVIndex(n, w), p = this.parseUVIndex(i, w), m = this.parseUVIndex(o, w), this.addUV(c, p, m), this.object.geometry.hasUVIndices = !0;
|
|
1399
1414
|
} else
|
|
1400
1415
|
this.addDefaultUV();
|
|
1401
1416
|
},
|
|
@@ -1418,7 +1433,7 @@ function oi() {
|
|
|
1418
1433
|
};
|
|
1419
1434
|
return r.startObject("", !1), r;
|
|
1420
1435
|
}
|
|
1421
|
-
class
|
|
1436
|
+
class di extends pn {
|
|
1422
1437
|
/**
|
|
1423
1438
|
* Constructs a new OBJ loader.
|
|
1424
1439
|
*
|
|
@@ -1437,7 +1452,7 @@ class ri extends hn {
|
|
|
1437
1452
|
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
1438
1453
|
*/
|
|
1439
1454
|
load(e, t, s, n) {
|
|
1440
|
-
const i = this, o = new
|
|
1455
|
+
const i = this, o = new At(this.manager);
|
|
1441
1456
|
o.setPath(this.path), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(e, function(a) {
|
|
1442
1457
|
try {
|
|
1443
1458
|
t(i.parse(a));
|
|
@@ -1462,7 +1477,7 @@ class ri extends hn {
|
|
|
1462
1477
|
* @return {Group} The parsed OBJ.
|
|
1463
1478
|
*/
|
|
1464
1479
|
parse(e) {
|
|
1465
|
-
const t = new
|
|
1480
|
+
const t = new ui();
|
|
1466
1481
|
e.indexOf(`\r
|
|
1467
1482
|
`) !== -1 && (e = e.replace(/\r\n/g, `
|
|
1468
1483
|
`)), e.indexOf(`\\
|
|
@@ -1476,19 +1491,19 @@ class ri extends hn {
|
|
|
1476
1491
|
const u = h.charAt(0);
|
|
1477
1492
|
if (u !== "#")
|
|
1478
1493
|
if (u === "v") {
|
|
1479
|
-
const c = h.split(
|
|
1494
|
+
const c = h.split(Qt);
|
|
1480
1495
|
switch (c[0]) {
|
|
1481
1496
|
case "v":
|
|
1482
1497
|
t.vertices.push(
|
|
1483
1498
|
parseFloat(c[1]),
|
|
1484
1499
|
parseFloat(c[2]),
|
|
1485
1500
|
parseFloat(c[3])
|
|
1486
|
-
), c.length >= 7 ? (
|
|
1501
|
+
), c.length >= 7 ? (st.setRGB(
|
|
1487
1502
|
parseFloat(c[4]),
|
|
1488
1503
|
parseFloat(c[5]),
|
|
1489
1504
|
parseFloat(c[6]),
|
|
1490
|
-
|
|
1491
|
-
), t.colors.push(
|
|
1505
|
+
Re
|
|
1506
|
+
), t.colors.push(st.r, st.g, st.b)) : t.colors.push(void 0, void 0, void 0);
|
|
1492
1507
|
break;
|
|
1493
1508
|
case "vn":
|
|
1494
1509
|
t.normals.push(
|
|
@@ -1505,27 +1520,27 @@ class ri extends hn {
|
|
|
1505
1520
|
break;
|
|
1506
1521
|
}
|
|
1507
1522
|
} else if (u === "f") {
|
|
1508
|
-
const p = h.slice(1).trim().split(
|
|
1523
|
+
const p = h.slice(1).trim().split(Qt), m = [];
|
|
1509
1524
|
for (let f = 0, y = p.length; f < y; f++) {
|
|
1510
1525
|
const d = p[f];
|
|
1511
1526
|
if (d.length > 0) {
|
|
1512
|
-
const
|
|
1513
|
-
m.push(
|
|
1527
|
+
const b = d.split("/");
|
|
1528
|
+
m.push(b);
|
|
1514
1529
|
}
|
|
1515
1530
|
}
|
|
1516
|
-
const
|
|
1531
|
+
const w = m[0];
|
|
1517
1532
|
for (let f = 1, y = m.length - 1; f < y; f++) {
|
|
1518
|
-
const d = m[f],
|
|
1533
|
+
const d = m[f], b = m[f + 1];
|
|
1519
1534
|
t.addFace(
|
|
1520
|
-
|
|
1535
|
+
w[0],
|
|
1521
1536
|
d[0],
|
|
1522
|
-
|
|
1523
|
-
|
|
1537
|
+
b[0],
|
|
1538
|
+
w[1],
|
|
1524
1539
|
d[1],
|
|
1525
|
-
|
|
1526
|
-
|
|
1540
|
+
b[1],
|
|
1541
|
+
w[2],
|
|
1527
1542
|
d[2],
|
|
1528
|
-
|
|
1543
|
+
b[2]
|
|
1529
1544
|
);
|
|
1530
1545
|
}
|
|
1531
1546
|
} else if (u === "l") {
|
|
@@ -1535,22 +1550,22 @@ class ri extends hn {
|
|
|
1535
1550
|
if (h.indexOf("/") === -1)
|
|
1536
1551
|
p = c;
|
|
1537
1552
|
else
|
|
1538
|
-
for (let
|
|
1539
|
-
const y = c[
|
|
1553
|
+
for (let w = 0, f = c.length; w < f; w++) {
|
|
1554
|
+
const y = c[w].split("/");
|
|
1540
1555
|
y[0] !== "" && p.push(y[0]), y[1] !== "" && m.push(y[1]);
|
|
1541
1556
|
}
|
|
1542
1557
|
t.addLineGeometry(p, m);
|
|
1543
1558
|
} else if (u === "p") {
|
|
1544
1559
|
const p = h.slice(1).trim().split(" ");
|
|
1545
1560
|
t.addPointGeometry(p);
|
|
1546
|
-
} else if ((n =
|
|
1561
|
+
} else if ((n = ai.exec(h)) !== null) {
|
|
1547
1562
|
const c = (" " + n[0].slice(1).trim()).slice(1);
|
|
1548
1563
|
t.startObject(c);
|
|
1549
|
-
} else if (
|
|
1564
|
+
} else if (ci.test(h))
|
|
1550
1565
|
t.object.startMaterial(h.substring(7).trim(), t.materialLibraries);
|
|
1551
|
-
else if (
|
|
1566
|
+
else if (li.test(h))
|
|
1552
1567
|
t.materialLibraries.push(h.substring(7).trim());
|
|
1553
|
-
else if (
|
|
1568
|
+
else if (hi.test(h))
|
|
1554
1569
|
console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');
|
|
1555
1570
|
else if (u === "s") {
|
|
1556
1571
|
if (n = h.split(" "), n.length > 1) {
|
|
@@ -1566,17 +1581,17 @@ class ri extends hn {
|
|
|
1566
1581
|
}
|
|
1567
1582
|
}
|
|
1568
1583
|
t.finalize();
|
|
1569
|
-
const i = new
|
|
1584
|
+
const i = new it();
|
|
1570
1585
|
if (i.materialLibraries = [].concat(t.materialLibraries), !(t.objects.length === 1 && t.objects[0].geometry.vertices.length === 0) === !0)
|
|
1571
1586
|
for (let a = 0, l = t.objects.length; a < l; a++) {
|
|
1572
1587
|
const h = t.objects[a], u = h.geometry, c = h.materials, p = u.type === "Line", m = u.type === "Points";
|
|
1573
|
-
let
|
|
1588
|
+
let w = !1;
|
|
1574
1589
|
if (u.vertices.length === 0) continue;
|
|
1575
|
-
const f = new
|
|
1576
|
-
f.setAttribute("position", new de(u.vertices, 3)), u.normals.length > 0 && f.setAttribute("normal", new de(u.normals, 3)), u.colors.length > 0 && (
|
|
1590
|
+
const f = new Ye();
|
|
1591
|
+
f.setAttribute("position", new de(u.vertices, 3)), u.normals.length > 0 && f.setAttribute("normal", new de(u.normals, 3)), u.colors.length > 0 && (w = !0, f.setAttribute("color", new de(u.colors, 3))), u.hasUVIndices === !0 && f.setAttribute("uv", new de(u.uvs, 2));
|
|
1577
1592
|
const y = [];
|
|
1578
|
-
for (let
|
|
1579
|
-
const S = c[
|
|
1593
|
+
for (let b = 0, x = c.length; b < x; b++) {
|
|
1594
|
+
const S = c[b], R = S.name + "_" + S.smooth + "_" + w;
|
|
1580
1595
|
let v = t.materials[R];
|
|
1581
1596
|
if (this.materials !== null) {
|
|
1582
1597
|
if (v = this.materials.create(S.name), p && v && !(v instanceof je)) {
|
|
@@ -1587,32 +1602,32 @@ class ri extends hn {
|
|
|
1587
1602
|
Fe.prototype.copy.call(I, v), I.color.copy(v.color), I.map = v.map, v = I;
|
|
1588
1603
|
}
|
|
1589
1604
|
}
|
|
1590
|
-
v === void 0 && (p ? v = new je() : m ? v = new Ce({ size: 1, sizeAttenuation: !1 }) : v = new
|
|
1605
|
+
v === void 0 && (p ? v = new je() : m ? v = new Ce({ size: 1, sizeAttenuation: !1 }) : v = new zn(), v.name = S.name, v.flatShading = !S.smooth, v.vertexColors = w, t.materials[R] = v), y.push(v);
|
|
1591
1606
|
}
|
|
1592
1607
|
let d;
|
|
1593
1608
|
if (y.length > 1) {
|
|
1594
|
-
for (let
|
|
1595
|
-
const S = c[
|
|
1596
|
-
f.addGroup(S.groupStart, S.groupCount,
|
|
1609
|
+
for (let b = 0, x = c.length; b < x; b++) {
|
|
1610
|
+
const S = c[b];
|
|
1611
|
+
f.addGroup(S.groupStart, S.groupCount, b);
|
|
1597
1612
|
}
|
|
1598
|
-
p ? d = new
|
|
1613
|
+
p ? d = new wt(f, y) : m ? d = new ot(f, y) : d = new T(f, y);
|
|
1599
1614
|
} else
|
|
1600
|
-
p ? d = new
|
|
1615
|
+
p ? d = new wt(f, y[0]) : m ? d = new ot(f, y[0]) : d = new T(f, y[0]);
|
|
1601
1616
|
d.name = h.name, i.add(d);
|
|
1602
1617
|
}
|
|
1603
1618
|
else if (t.vertices.length > 0) {
|
|
1604
|
-
const a = new Ce({ size: 1, sizeAttenuation: !1 }), l = new
|
|
1619
|
+
const a = new Ce({ size: 1, sizeAttenuation: !1 }), l = new Ye();
|
|
1605
1620
|
l.setAttribute("position", new de(t.vertices, 3)), t.colors.length > 0 && t.colors[0] !== void 0 && (l.setAttribute("color", new de(t.colors, 3)), a.vertexColors = !0);
|
|
1606
|
-
const h = new
|
|
1621
|
+
const h = new ot(l, a);
|
|
1607
1622
|
i.add(h);
|
|
1608
1623
|
}
|
|
1609
1624
|
return i;
|
|
1610
1625
|
}
|
|
1611
1626
|
}
|
|
1612
|
-
function
|
|
1613
|
-
if (e ===
|
|
1627
|
+
function Jt(r, e) {
|
|
1628
|
+
if (e === Gn)
|
|
1614
1629
|
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), r;
|
|
1615
|
-
if (e ===
|
|
1630
|
+
if (e === Tt || e === fn) {
|
|
1616
1631
|
let t = r.getIndex();
|
|
1617
1632
|
if (t === null) {
|
|
1618
1633
|
const o = [], a = r.getAttribute("position");
|
|
@@ -1624,7 +1639,7 @@ function qt(r, e) {
|
|
|
1624
1639
|
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), r;
|
|
1625
1640
|
}
|
|
1626
1641
|
const s = t.count - 2, n = [];
|
|
1627
|
-
if (e ===
|
|
1642
|
+
if (e === Tt)
|
|
1628
1643
|
for (let o = 1; o <= s; o++)
|
|
1629
1644
|
n.push(t.getX(0)), n.push(t.getX(o)), n.push(t.getX(o + 1));
|
|
1630
1645
|
else
|
|
@@ -1636,9 +1651,9 @@ function qt(r, e) {
|
|
|
1636
1651
|
} else
|
|
1637
1652
|
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e), r;
|
|
1638
1653
|
}
|
|
1639
|
-
function
|
|
1654
|
+
function pi(r) {
|
|
1640
1655
|
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), s = r.clone();
|
|
1641
|
-
return
|
|
1656
|
+
return xn(r, s, function(n, i) {
|
|
1642
1657
|
e.set(i, n), t.set(n, i);
|
|
1643
1658
|
}), s.traverse(function(n) {
|
|
1644
1659
|
if (!n.isSkinnedMesh) return;
|
|
@@ -1648,12 +1663,12 @@ function ai(r) {
|
|
|
1648
1663
|
}), i.bind(i.skeleton, i.bindMatrix);
|
|
1649
1664
|
}), s;
|
|
1650
1665
|
}
|
|
1651
|
-
function
|
|
1666
|
+
function xn(r, e, t) {
|
|
1652
1667
|
t(r, e);
|
|
1653
1668
|
for (let s = 0; s < r.children.length; s++)
|
|
1654
|
-
|
|
1669
|
+
xn(r.children[s], e.children[s], t);
|
|
1655
1670
|
}
|
|
1656
|
-
class
|
|
1671
|
+
class fi extends pn {
|
|
1657
1672
|
/**
|
|
1658
1673
|
* Constructs a new glTF loader.
|
|
1659
1674
|
*
|
|
@@ -1661,41 +1676,41 @@ class li extends hn {
|
|
|
1661
1676
|
*/
|
|
1662
1677
|
constructor(e) {
|
|
1663
1678
|
super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(t) {
|
|
1664
|
-
return new
|
|
1679
|
+
return new bi(t);
|
|
1665
1680
|
}), this.register(function(t) {
|
|
1666
|
-
return new
|
|
1681
|
+
return new wi(t);
|
|
1667
1682
|
}), this.register(function(t) {
|
|
1668
|
-
return new
|
|
1683
|
+
return new Pi(t);
|
|
1669
1684
|
}), this.register(function(t) {
|
|
1670
|
-
return new
|
|
1685
|
+
return new Li(t);
|
|
1671
1686
|
}), this.register(function(t) {
|
|
1672
|
-
return new
|
|
1687
|
+
return new Ii(t);
|
|
1673
1688
|
}), this.register(function(t) {
|
|
1674
|
-
return new
|
|
1689
|
+
return new xi(t);
|
|
1675
1690
|
}), this.register(function(t) {
|
|
1676
|
-
return new
|
|
1691
|
+
return new Mi(t);
|
|
1677
1692
|
}), this.register(function(t) {
|
|
1678
|
-
return new
|
|
1693
|
+
return new Ei(t);
|
|
1679
1694
|
}), this.register(function(t) {
|
|
1680
|
-
return new
|
|
1695
|
+
return new vi(t);
|
|
1681
1696
|
}), this.register(function(t) {
|
|
1682
|
-
return new
|
|
1697
|
+
return new _i(t);
|
|
1683
1698
|
}), this.register(function(t) {
|
|
1684
|
-
return new
|
|
1699
|
+
return new Si(t);
|
|
1685
1700
|
}), this.register(function(t) {
|
|
1686
|
-
return new
|
|
1701
|
+
return new Ti(t);
|
|
1687
1702
|
}), this.register(function(t) {
|
|
1688
|
-
return new
|
|
1703
|
+
return new Ri(t);
|
|
1689
1704
|
}), this.register(function(t) {
|
|
1690
|
-
return new
|
|
1705
|
+
return new Ai(t);
|
|
1691
1706
|
}), this.register(function(t) {
|
|
1692
|
-
return new
|
|
1707
|
+
return new gi(t);
|
|
1693
1708
|
}), this.register(function(t) {
|
|
1694
|
-
return new
|
|
1709
|
+
return new en(t, A.EXT_MESHOPT_COMPRESSION);
|
|
1695
1710
|
}), this.register(function(t) {
|
|
1696
|
-
return new
|
|
1711
|
+
return new en(t, A.KHR_MESHOPT_COMPRESSION);
|
|
1697
1712
|
}), this.register(function(t) {
|
|
1698
|
-
return new
|
|
1713
|
+
return new Oi(t);
|
|
1699
1714
|
});
|
|
1700
1715
|
}
|
|
1701
1716
|
/**
|
|
@@ -1720,7 +1735,7 @@ class li extends hn {
|
|
|
1720
1735
|
this.manager.itemStart(e);
|
|
1721
1736
|
const a = function(h) {
|
|
1722
1737
|
n ? n(h) : console.error(h), i.manager.itemError(e), i.manager.itemEnd(e);
|
|
1723
|
-
}, l = new
|
|
1738
|
+
}, l = new At(this.manager);
|
|
1724
1739
|
l.setPath(this.path), l.setResponseType("arraybuffer"), l.setRequestHeader(this.requestHeader), l.setWithCredentials(this.withCredentials), l.load(e, function(h) {
|
|
1725
1740
|
try {
|
|
1726
1741
|
i.parse(h, o, function(u) {
|
|
@@ -1795,9 +1810,9 @@ class li extends hn {
|
|
|
1795
1810
|
if (typeof e == "string")
|
|
1796
1811
|
i = JSON.parse(e);
|
|
1797
1812
|
else if (e instanceof ArrayBuffer)
|
|
1798
|
-
if (l.decode(new Uint8Array(e, 0, 4)) ===
|
|
1813
|
+
if (l.decode(new Uint8Array(e, 0, 4)) === Mn) {
|
|
1799
1814
|
try {
|
|
1800
|
-
o[A.KHR_BINARY_GLTF] = new
|
|
1815
|
+
o[A.KHR_BINARY_GLTF] = new Ci(e);
|
|
1801
1816
|
} catch (c) {
|
|
1802
1817
|
n && n(c);
|
|
1803
1818
|
return;
|
|
@@ -1811,7 +1826,7 @@ class li extends hn {
|
|
|
1811
1826
|
n && n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
|
|
1812
1827
|
return;
|
|
1813
1828
|
}
|
|
1814
|
-
const h = new
|
|
1829
|
+
const h = new Ki(i, {
|
|
1815
1830
|
path: t || this.resourcePath || "",
|
|
1816
1831
|
crossOrigin: this.crossOrigin,
|
|
1817
1832
|
requestHeader: this.requestHeader,
|
|
@@ -1829,16 +1844,16 @@ class li extends hn {
|
|
|
1829
1844
|
const c = i.extensionsUsed[u], p = i.extensionsRequired || [];
|
|
1830
1845
|
switch (c) {
|
|
1831
1846
|
case A.KHR_MATERIALS_UNLIT:
|
|
1832
|
-
o[c] = new
|
|
1847
|
+
o[c] = new yi();
|
|
1833
1848
|
break;
|
|
1834
1849
|
case A.KHR_DRACO_MESH_COMPRESSION:
|
|
1835
|
-
o[c] = new
|
|
1850
|
+
o[c] = new Di(i, this.dracoLoader);
|
|
1836
1851
|
break;
|
|
1837
1852
|
case A.KHR_TEXTURE_TRANSFORM:
|
|
1838
|
-
o[c] = new
|
|
1853
|
+
o[c] = new Ni();
|
|
1839
1854
|
break;
|
|
1840
1855
|
case A.KHR_MESH_QUANTIZATION:
|
|
1841
|
-
o[c] = new
|
|
1856
|
+
o[c] = new ki();
|
|
1842
1857
|
break;
|
|
1843
1858
|
default:
|
|
1844
1859
|
p.indexOf(c) >= 0 && a[c] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + c + '".');
|
|
@@ -1861,7 +1876,7 @@ class li extends hn {
|
|
|
1861
1876
|
});
|
|
1862
1877
|
}
|
|
1863
1878
|
}
|
|
1864
|
-
function
|
|
1879
|
+
function mi() {
|
|
1865
1880
|
let r = {};
|
|
1866
1881
|
return {
|
|
1867
1882
|
get: function(e) {
|
|
@@ -1907,7 +1922,7 @@ const A = {
|
|
|
1907
1922
|
KHR_MESHOPT_COMPRESSION: "KHR_meshopt_compression",
|
|
1908
1923
|
EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing"
|
|
1909
1924
|
};
|
|
1910
|
-
class
|
|
1925
|
+
class gi {
|
|
1911
1926
|
constructor(e) {
|
|
1912
1927
|
this.parser = e, this.name = A.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
|
|
1913
1928
|
}
|
|
@@ -1929,13 +1944,13 @@ class hi {
|
|
|
1929
1944
|
const c = l.range !== void 0 ? l.range : 0;
|
|
1930
1945
|
switch (l.type) {
|
|
1931
1946
|
case "directional":
|
|
1932
|
-
h = new
|
|
1947
|
+
h = new Bn(u), h.target.position.set(0, 0, -1), h.add(h.target);
|
|
1933
1948
|
break;
|
|
1934
1949
|
case "point":
|
|
1935
|
-
h = new
|
|
1950
|
+
h = new Yn(u), h.distance = c;
|
|
1936
1951
|
break;
|
|
1937
1952
|
case "spot":
|
|
1938
|
-
h = new
|
|
1953
|
+
h = new Xn(u), h.distance = c, 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, h.angle = l.spot.outerConeAngle, h.penumbra = 1 - l.spot.innerConeAngle / l.spot.outerConeAngle, h.target.position.set(0, 0, -1), h.add(h.target);
|
|
1939
1954
|
break;
|
|
1940
1955
|
default:
|
|
1941
1956
|
throw new Error("THREE.GLTFLoader: Unexpected light type: " + l.type);
|
|
@@ -1953,12 +1968,12 @@ class hi {
|
|
|
1953
1968
|
});
|
|
1954
1969
|
}
|
|
1955
1970
|
}
|
|
1956
|
-
class
|
|
1971
|
+
class yi {
|
|
1957
1972
|
constructor() {
|
|
1958
1973
|
this.name = A.KHR_MATERIALS_UNLIT;
|
|
1959
1974
|
}
|
|
1960
1975
|
getMaterialType() {
|
|
1961
|
-
return
|
|
1976
|
+
return be;
|
|
1962
1977
|
}
|
|
1963
1978
|
extendParams(e, t, s) {
|
|
1964
1979
|
const n = [];
|
|
@@ -1969,12 +1984,12 @@ class ui {
|
|
|
1969
1984
|
const o = i.baseColorFactor;
|
|
1970
1985
|
e.color.setRGB(o[0], o[1], o[2], le), e.opacity = o[3];
|
|
1971
1986
|
}
|
|
1972
|
-
i.baseColorTexture !== void 0 && n.push(s.assignTexture(e, "map", i.baseColorTexture,
|
|
1987
|
+
i.baseColorTexture !== void 0 && n.push(s.assignTexture(e, "map", i.baseColorTexture, Re));
|
|
1973
1988
|
}
|
|
1974
1989
|
return Promise.all(n);
|
|
1975
1990
|
}
|
|
1976
1991
|
}
|
|
1977
|
-
class
|
|
1992
|
+
class _i {
|
|
1978
1993
|
constructor(e) {
|
|
1979
1994
|
this.parser = e, this.name = A.KHR_MATERIALS_EMISSIVE_STRENGTH;
|
|
1980
1995
|
}
|
|
@@ -1983,7 +1998,7 @@ class di {
|
|
|
1983
1998
|
return s === null || s.emissiveStrength !== void 0 && (t.emissiveIntensity = s.emissiveStrength), Promise.resolve();
|
|
1984
1999
|
}
|
|
1985
2000
|
}
|
|
1986
|
-
class
|
|
2001
|
+
class bi {
|
|
1987
2002
|
constructor(e) {
|
|
1988
2003
|
this.parser = e, this.name = A.KHR_MATERIALS_CLEARCOAT;
|
|
1989
2004
|
}
|
|
@@ -2001,7 +2016,7 @@ class pi {
|
|
|
2001
2016
|
return Promise.all(n);
|
|
2002
2017
|
}
|
|
2003
2018
|
}
|
|
2004
|
-
class
|
|
2019
|
+
class wi {
|
|
2005
2020
|
constructor(e) {
|
|
2006
2021
|
this.parser = e, this.name = A.KHR_MATERIALS_DISPERSION;
|
|
2007
2022
|
}
|
|
@@ -2013,7 +2028,7 @@ class fi {
|
|
|
2013
2028
|
return s === null || (t.dispersion = s.dispersion !== void 0 ? s.dispersion : 0), Promise.resolve();
|
|
2014
2029
|
}
|
|
2015
2030
|
}
|
|
2016
|
-
class
|
|
2031
|
+
class Ti {
|
|
2017
2032
|
constructor(e) {
|
|
2018
2033
|
this.parser = e, this.name = A.KHR_MATERIALS_IRIDESCENCE;
|
|
2019
2034
|
}
|
|
@@ -2027,7 +2042,7 @@ class mi {
|
|
|
2027
2042
|
return s.iridescenceFactor !== void 0 && (t.iridescence = s.iridescenceFactor), s.iridescenceTexture !== void 0 && n.push(this.parser.assignTexture(t, "iridescenceMap", s.iridescenceTexture)), s.iridescenceIor !== void 0 && (t.iridescenceIOR = s.iridescenceIor), t.iridescenceThicknessRange === void 0 && (t.iridescenceThicknessRange = [100, 400]), s.iridescenceThicknessMinimum !== void 0 && (t.iridescenceThicknessRange[0] = s.iridescenceThicknessMinimum), s.iridescenceThicknessMaximum !== void 0 && (t.iridescenceThicknessRange[1] = s.iridescenceThicknessMaximum), s.iridescenceThicknessTexture !== void 0 && n.push(this.parser.assignTexture(t, "iridescenceThicknessMap", s.iridescenceThicknessTexture)), Promise.all(n);
|
|
2028
2043
|
}
|
|
2029
2044
|
}
|
|
2030
|
-
class
|
|
2045
|
+
class xi {
|
|
2031
2046
|
constructor(e) {
|
|
2032
2047
|
this.parser = e, this.name = A.KHR_MATERIALS_SHEEN;
|
|
2033
2048
|
}
|
|
@@ -2042,10 +2057,10 @@ class gi {
|
|
|
2042
2057
|
const i = s.sheenColorFactor;
|
|
2043
2058
|
t.sheenColor.setRGB(i[0], i[1], i[2], le);
|
|
2044
2059
|
}
|
|
2045
|
-
return s.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = s.sheenRoughnessFactor), s.sheenColorTexture !== void 0 && n.push(this.parser.assignTexture(t, "sheenColorMap", s.sheenColorTexture,
|
|
2060
|
+
return s.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = s.sheenRoughnessFactor), s.sheenColorTexture !== void 0 && n.push(this.parser.assignTexture(t, "sheenColorMap", s.sheenColorTexture, Re)), s.sheenRoughnessTexture !== void 0 && n.push(this.parser.assignTexture(t, "sheenRoughnessMap", s.sheenRoughnessTexture)), Promise.all(n);
|
|
2046
2061
|
}
|
|
2047
2062
|
}
|
|
2048
|
-
class
|
|
2063
|
+
class Mi {
|
|
2049
2064
|
constructor(e) {
|
|
2050
2065
|
this.parser = e, this.name = A.KHR_MATERIALS_TRANSMISSION;
|
|
2051
2066
|
}
|
|
@@ -2059,7 +2074,7 @@ class yi {
|
|
|
2059
2074
|
return s.transmissionFactor !== void 0 && (t.transmission = s.transmissionFactor), s.transmissionTexture !== void 0 && n.push(this.parser.assignTexture(t, "transmissionMap", s.transmissionTexture)), Promise.all(n);
|
|
2060
2075
|
}
|
|
2061
2076
|
}
|
|
2062
|
-
class
|
|
2077
|
+
class Ei {
|
|
2063
2078
|
constructor(e) {
|
|
2064
2079
|
this.parser = e, this.name = A.KHR_MATERIALS_VOLUME;
|
|
2065
2080
|
}
|
|
@@ -2075,7 +2090,7 @@ class _i {
|
|
|
2075
2090
|
return t.attenuationColor = new pe().setRGB(i[0], i[1], i[2], le), Promise.all(n);
|
|
2076
2091
|
}
|
|
2077
2092
|
}
|
|
2078
|
-
class
|
|
2093
|
+
class vi {
|
|
2079
2094
|
constructor(e) {
|
|
2080
2095
|
this.parser = e, this.name = A.KHR_MATERIALS_IOR;
|
|
2081
2096
|
}
|
|
@@ -2087,7 +2102,7 @@ class bi {
|
|
|
2087
2102
|
return s === null || (t.ior = s.ior !== void 0 ? s.ior : 1.5, t.ior === 0 && (t.ior = 1e3)), Promise.resolve();
|
|
2088
2103
|
}
|
|
2089
2104
|
}
|
|
2090
|
-
class
|
|
2105
|
+
class Si {
|
|
2091
2106
|
constructor(e) {
|
|
2092
2107
|
this.parser = e, this.name = A.KHR_MATERIALS_SPECULAR;
|
|
2093
2108
|
}
|
|
@@ -2100,10 +2115,10 @@ class wi {
|
|
|
2100
2115
|
const n = [];
|
|
2101
2116
|
t.specularIntensity = s.specularFactor !== void 0 ? s.specularFactor : 1, s.specularTexture !== void 0 && n.push(this.parser.assignTexture(t, "specularIntensityMap", s.specularTexture));
|
|
2102
2117
|
const i = s.specularColorFactor || [1, 1, 1];
|
|
2103
|
-
return t.specularColor = new pe().setRGB(i[0], i[1], i[2], le), s.specularColorTexture !== void 0 && n.push(this.parser.assignTexture(t, "specularColorMap", s.specularColorTexture,
|
|
2118
|
+
return t.specularColor = new pe().setRGB(i[0], i[1], i[2], le), s.specularColorTexture !== void 0 && n.push(this.parser.assignTexture(t, "specularColorMap", s.specularColorTexture, Re)), Promise.all(n);
|
|
2104
2119
|
}
|
|
2105
2120
|
}
|
|
2106
|
-
class
|
|
2121
|
+
class Ai {
|
|
2107
2122
|
constructor(e) {
|
|
2108
2123
|
this.parser = e, this.name = A.EXT_MATERIALS_BUMP;
|
|
2109
2124
|
}
|
|
@@ -2117,7 +2132,7 @@ class Ti {
|
|
|
2117
2132
|
return t.bumpScale = s.bumpFactor !== void 0 ? s.bumpFactor : 1, s.bumpTexture !== void 0 && n.push(this.parser.assignTexture(t, "bumpMap", s.bumpTexture)), Promise.all(n);
|
|
2118
2133
|
}
|
|
2119
2134
|
}
|
|
2120
|
-
class
|
|
2135
|
+
class Ri {
|
|
2121
2136
|
constructor(e) {
|
|
2122
2137
|
this.parser = e, this.name = A.KHR_MATERIALS_ANISOTROPY;
|
|
2123
2138
|
}
|
|
@@ -2131,7 +2146,7 @@ class xi {
|
|
|
2131
2146
|
return s.anisotropyStrength !== void 0 && (t.anisotropy = s.anisotropyStrength), s.anisotropyRotation !== void 0 && (t.anisotropyRotation = s.anisotropyRotation), s.anisotropyTexture !== void 0 && n.push(this.parser.assignTexture(t, "anisotropyMap", s.anisotropyTexture)), Promise.all(n);
|
|
2132
2147
|
}
|
|
2133
2148
|
}
|
|
2134
|
-
class
|
|
2149
|
+
class Pi {
|
|
2135
2150
|
constructor(e) {
|
|
2136
2151
|
this.parser = e, this.name = A.KHR_TEXTURE_BASISU;
|
|
2137
2152
|
}
|
|
@@ -2148,7 +2163,7 @@ class Ei {
|
|
|
2148
2163
|
return t.loadTextureImage(e, i.source, o);
|
|
2149
2164
|
}
|
|
2150
2165
|
}
|
|
2151
|
-
class
|
|
2166
|
+
class Li {
|
|
2152
2167
|
constructor(e) {
|
|
2153
2168
|
this.parser = e, this.name = A.EXT_TEXTURE_WEBP;
|
|
2154
2169
|
}
|
|
@@ -2165,7 +2180,7 @@ class Mi {
|
|
|
2165
2180
|
return s.loadTextureImage(e, o.source, l);
|
|
2166
2181
|
}
|
|
2167
2182
|
}
|
|
2168
|
-
class
|
|
2183
|
+
class Ii {
|
|
2169
2184
|
constructor(e) {
|
|
2170
2185
|
this.parser = e, this.name = A.EXT_TEXTURE_AVIF;
|
|
2171
2186
|
}
|
|
@@ -2182,7 +2197,7 @@ class vi {
|
|
|
2182
2197
|
return s.loadTextureImage(e, o.source, l);
|
|
2183
2198
|
}
|
|
2184
2199
|
}
|
|
2185
|
-
class
|
|
2200
|
+
class en {
|
|
2186
2201
|
constructor(e, t) {
|
|
2187
2202
|
this.name = t, this.parser = e;
|
|
2188
2203
|
}
|
|
@@ -2208,7 +2223,7 @@ class Wt {
|
|
|
2208
2223
|
return null;
|
|
2209
2224
|
}
|
|
2210
2225
|
}
|
|
2211
|
-
class
|
|
2226
|
+
class Oi {
|
|
2212
2227
|
constructor(e) {
|
|
2213
2228
|
this.name = A.EXT_MESH_GPU_INSTANCING, this.parser = e;
|
|
2214
2229
|
}
|
|
@@ -2225,23 +2240,23 @@ class Si {
|
|
|
2225
2240
|
a.push(this.parser.getDependency("accessor", o[h]).then((u) => (l[h] = u, l[h])));
|
|
2226
2241
|
return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((h) => {
|
|
2227
2242
|
const u = h.pop(), c = u.isGroup ? u.children : [u], p = h[0].count, m = [];
|
|
2228
|
-
for (const
|
|
2229
|
-
const f = new
|
|
2243
|
+
for (const w of c) {
|
|
2244
|
+
const f = new Ae(), y = new E(), d = new K(), b = new E(1, 1, 1), x = new Kn(w.geometry, w.material, p);
|
|
2230
2245
|
for (let S = 0; S < p; S++)
|
|
2231
|
-
l.TRANSLATION && y.fromBufferAttribute(l.TRANSLATION, S), l.ROTATION && d.fromBufferAttribute(l.ROTATION, S), l.SCALE &&
|
|
2246
|
+
l.TRANSLATION && y.fromBufferAttribute(l.TRANSLATION, S), l.ROTATION && d.fromBufferAttribute(l.ROTATION, S), l.SCALE && b.fromBufferAttribute(l.SCALE, S), x.setMatrixAt(S, f.compose(y, d, b));
|
|
2232
2247
|
for (const S in l)
|
|
2233
2248
|
if (S === "_COLOR_0") {
|
|
2234
2249
|
const R = l[S];
|
|
2235
|
-
x.instanceColor = new
|
|
2236
|
-
} else S !== "TRANSLATION" && S !== "ROTATION" && S !== "SCALE" &&
|
|
2237
|
-
|
|
2250
|
+
x.instanceColor = new Vn(R.array, R.itemSize, R.normalized);
|
|
2251
|
+
} else S !== "TRANSLATION" && S !== "ROTATION" && S !== "SCALE" && w.geometry.setAttribute(S, l[S]);
|
|
2252
|
+
Xe.prototype.copy.call(x, w), this.parser.assignFinalMaterial(x), m.push(x);
|
|
2238
2253
|
}
|
|
2239
2254
|
return u.isGroup ? (u.clear(), u.add(...m), u) : m[0];
|
|
2240
2255
|
}));
|
|
2241
2256
|
}
|
|
2242
2257
|
}
|
|
2243
|
-
const
|
|
2244
|
-
class
|
|
2258
|
+
const Mn = "glTF", Oe = 12, tn = { JSON: 1313821514, BIN: 5130562 };
|
|
2259
|
+
class Ci {
|
|
2245
2260
|
constructor(e) {
|
|
2246
2261
|
this.name = A.KHR_BINARY_GLTF, this.content = null, this.body = null;
|
|
2247
2262
|
const t = new DataView(e, 0, Oe), s = new TextDecoder();
|
|
@@ -2249,7 +2264,7 @@ class Ai {
|
|
|
2249
2264
|
magic: s.decode(new Uint8Array(e.slice(0, 4))),
|
|
2250
2265
|
version: t.getUint32(4, !0),
|
|
2251
2266
|
length: t.getUint32(8, !0)
|
|
2252
|
-
}, this.header.magic !==
|
|
2267
|
+
}, this.header.magic !== Mn)
|
|
2253
2268
|
throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
|
|
2254
2269
|
if (this.header.version < 2)
|
|
2255
2270
|
throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
|
|
@@ -2259,10 +2274,10 @@ class Ai {
|
|
|
2259
2274
|
const a = i.getUint32(o, !0);
|
|
2260
2275
|
o += 4;
|
|
2261
2276
|
const l = i.getUint32(o, !0);
|
|
2262
|
-
if (o += 4, l ===
|
|
2277
|
+
if (o += 4, l === tn.JSON) {
|
|
2263
2278
|
const h = new Uint8Array(e, Oe + o, a);
|
|
2264
2279
|
this.content = s.decode(h);
|
|
2265
|
-
} else if (l ===
|
|
2280
|
+
} else if (l === tn.BIN) {
|
|
2266
2281
|
const h = Oe + o;
|
|
2267
2282
|
this.body = e.slice(h, h + a);
|
|
2268
2283
|
}
|
|
@@ -2272,7 +2287,7 @@ class Ai {
|
|
|
2272
2287
|
throw new Error("THREE.GLTFLoader: JSON content not found.");
|
|
2273
2288
|
}
|
|
2274
2289
|
}
|
|
2275
|
-
class
|
|
2290
|
+
class Di {
|
|
2276
2291
|
constructor(e, t) {
|
|
2277
2292
|
if (!t)
|
|
2278
2293
|
throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
|
|
@@ -2281,21 +2296,21 @@ class Ri {
|
|
|
2281
2296
|
decodePrimitive(e, t) {
|
|
2282
2297
|
const s = this.json, n = this.dracoLoader, i = e.extensions[this.name].bufferView, o = e.extensions[this.name].attributes, a = {}, l = {}, h = {};
|
|
2283
2298
|
for (const u in o) {
|
|
2284
|
-
const c =
|
|
2299
|
+
const c = vt[u] || u.toLowerCase();
|
|
2285
2300
|
a[c] = o[u];
|
|
2286
2301
|
}
|
|
2287
2302
|
for (const u in e.attributes) {
|
|
2288
|
-
const c =
|
|
2303
|
+
const c = vt[u] || u.toLowerCase();
|
|
2289
2304
|
if (o[u] !== void 0) {
|
|
2290
|
-
const p = s.accessors[e.attributes[u]], m =
|
|
2305
|
+
const p = s.accessors[e.attributes[u]], m = Se[p.componentType];
|
|
2291
2306
|
h[c] = m.name, l[c] = p.normalized === !0;
|
|
2292
2307
|
}
|
|
2293
2308
|
}
|
|
2294
2309
|
return t.getDependency("bufferView", i).then(function(u) {
|
|
2295
2310
|
return new Promise(function(c, p) {
|
|
2296
2311
|
n.decodeDracoFile(u, function(m) {
|
|
2297
|
-
for (const
|
|
2298
|
-
const f = m.attributes[
|
|
2312
|
+
for (const w in m.attributes) {
|
|
2313
|
+
const f = m.attributes[w], y = l[w];
|
|
2299
2314
|
y !== void 0 && (f.normalized = y);
|
|
2300
2315
|
}
|
|
2301
2316
|
c(m);
|
|
@@ -2304,7 +2319,7 @@ class Ri {
|
|
|
2304
2319
|
});
|
|
2305
2320
|
}
|
|
2306
2321
|
}
|
|
2307
|
-
class
|
|
2322
|
+
class Ni {
|
|
2308
2323
|
constructor() {
|
|
2309
2324
|
this.name = A.KHR_TEXTURE_TRANSFORM;
|
|
2310
2325
|
}
|
|
@@ -2312,12 +2327,12 @@ class Pi {
|
|
|
2312
2327
|
return (t.texCoord === void 0 || t.texCoord === e.channel) && t.offset === void 0 && t.rotation === void 0 && t.scale === void 0 || (e = e.clone(), t.texCoord !== void 0 && (e.channel = t.texCoord), t.offset !== void 0 && e.offset.fromArray(t.offset), t.rotation !== void 0 && (e.rotation = t.rotation), t.scale !== void 0 && e.repeat.fromArray(t.scale), e.needsUpdate = !0), e;
|
|
2313
2328
|
}
|
|
2314
2329
|
}
|
|
2315
|
-
class
|
|
2330
|
+
class ki {
|
|
2316
2331
|
constructor() {
|
|
2317
2332
|
this.name = A.KHR_MESH_QUANTIZATION;
|
|
2318
2333
|
}
|
|
2319
2334
|
}
|
|
2320
|
-
class
|
|
2335
|
+
class En extends ps {
|
|
2321
2336
|
constructor(e, t, s, n) {
|
|
2322
2337
|
super(e, t, s, n);
|
|
2323
2338
|
}
|
|
@@ -2328,19 +2343,19 @@ class wn extends ls {
|
|
|
2328
2343
|
return t;
|
|
2329
2344
|
}
|
|
2330
2345
|
interpolate_(e, t, s, n) {
|
|
2331
|
-
const i = this.resultBuffer, o = this.sampleValues, a = this.valueSize, l = a * 2, h = a * 3, u = n - t, c = (s - t) / u, p = c * c, m = p * c,
|
|
2346
|
+
const i = this.resultBuffer, o = this.sampleValues, a = this.valueSize, l = a * 2, h = a * 3, u = n - t, c = (s - t) / u, p = c * c, m = p * c, w = e * h, f = w - h, y = -2 * m + 3 * p, d = m - p, b = 1 - y, x = d - p + c;
|
|
2332
2347
|
for (let S = 0; S !== a; S++) {
|
|
2333
|
-
const R = o[f + S + a], v = o[f + S + l] * u, I = o[
|
|
2334
|
-
i[S] =
|
|
2348
|
+
const R = o[f + S + a], v = o[f + S + l] * u, I = o[w + S + a], ie = o[w + S] * u;
|
|
2349
|
+
i[S] = b * R + x * v + y * I + d * ie;
|
|
2335
2350
|
}
|
|
2336
2351
|
return i;
|
|
2337
2352
|
}
|
|
2338
2353
|
}
|
|
2339
|
-
const
|
|
2340
|
-
class
|
|
2354
|
+
const ji = new K();
|
|
2355
|
+
class Fi extends En {
|
|
2341
2356
|
interpolate_(e, t, s, n) {
|
|
2342
2357
|
const i = super.interpolate_(e, t, s, n);
|
|
2343
|
-
return
|
|
2358
|
+
return ji.fromArray(i).normalize().toArray(i), i;
|
|
2344
2359
|
}
|
|
2345
2360
|
}
|
|
2346
2361
|
const W = {
|
|
@@ -2351,25 +2366,25 @@ const W = {
|
|
|
2351
2366
|
TRIANGLES: 4,
|
|
2352
2367
|
TRIANGLE_STRIP: 5,
|
|
2353
2368
|
TRIANGLE_FAN: 6
|
|
2354
|
-
},
|
|
2369
|
+
}, Se = {
|
|
2355
2370
|
5120: Int8Array,
|
|
2356
2371
|
5121: Uint8Array,
|
|
2357
2372
|
5122: Int16Array,
|
|
2358
2373
|
5123: Uint16Array,
|
|
2359
2374
|
5125: Uint32Array,
|
|
2360
2375
|
5126: Float32Array
|
|
2361
|
-
},
|
|
2362
|
-
9728:
|
|
2363
|
-
9729:
|
|
2364
|
-
9984:
|
|
2365
|
-
9985:
|
|
2366
|
-
9986:
|
|
2367
|
-
9987:
|
|
2368
|
-
},
|
|
2369
|
-
33071:
|
|
2370
|
-
33648:
|
|
2371
|
-
10497:
|
|
2372
|
-
},
|
|
2376
|
+
}, nn = {
|
|
2377
|
+
9728: gn,
|
|
2378
|
+
9729: xt,
|
|
2379
|
+
9984: es,
|
|
2380
|
+
9985: Jn,
|
|
2381
|
+
9986: $n,
|
|
2382
|
+
9987: mn
|
|
2383
|
+
}, sn = {
|
|
2384
|
+
33071: ns,
|
|
2385
|
+
33648: ts,
|
|
2386
|
+
10497: Mt
|
|
2387
|
+
}, yt = {
|
|
2373
2388
|
SCALAR: 1,
|
|
2374
2389
|
VEC2: 2,
|
|
2375
2390
|
VEC3: 3,
|
|
@@ -2377,7 +2392,7 @@ const W = {
|
|
|
2377
2392
|
MAT2: 4,
|
|
2378
2393
|
MAT3: 9,
|
|
2379
2394
|
MAT4: 16
|
|
2380
|
-
},
|
|
2395
|
+
}, vt = {
|
|
2381
2396
|
POSITION: "position",
|
|
2382
2397
|
NORMAL: "normal",
|
|
2383
2398
|
TANGENT: "tangent",
|
|
@@ -2393,36 +2408,36 @@ const W = {
|
|
|
2393
2408
|
translation: "position",
|
|
2394
2409
|
rotation: "quaternion",
|
|
2395
2410
|
weights: "morphTargetInfluences"
|
|
2396
|
-
},
|
|
2411
|
+
}, Hi = {
|
|
2397
2412
|
CUBICSPLINE: void 0,
|
|
2398
2413
|
// We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
|
|
2399
2414
|
// keyframe track will be initialized with a default interpolation type, then modified.
|
|
2400
|
-
LINEAR:
|
|
2401
|
-
STEP:
|
|
2402
|
-
},
|
|
2415
|
+
LINEAR: _n,
|
|
2416
|
+
STEP: us
|
|
2417
|
+
}, _t = {
|
|
2403
2418
|
OPAQUE: "OPAQUE",
|
|
2404
2419
|
MASK: "MASK",
|
|
2405
2420
|
BLEND: "BLEND"
|
|
2406
2421
|
};
|
|
2407
|
-
function
|
|
2408
|
-
return r.DefaultMaterial === void 0 && (r.DefaultMaterial = new
|
|
2422
|
+
function Ui(r) {
|
|
2423
|
+
return r.DefaultMaterial === void 0 && (r.DefaultMaterial = new yn({
|
|
2409
2424
|
color: 16777215,
|
|
2410
2425
|
emissive: 0,
|
|
2411
2426
|
metalness: 1,
|
|
2412
2427
|
roughness: 1,
|
|
2413
2428
|
transparent: !1,
|
|
2414
2429
|
depthTest: !0,
|
|
2415
|
-
side:
|
|
2430
|
+
side: ds
|
|
2416
2431
|
})), r.DefaultMaterial;
|
|
2417
2432
|
}
|
|
2418
|
-
function
|
|
2433
|
+
function ye(r, e, t) {
|
|
2419
2434
|
for (const s in t.extensions)
|
|
2420
2435
|
r[s] === void 0 && (e.userData.gltfExtensions = e.userData.gltfExtensions || {}, e.userData.gltfExtensions[s] = t.extensions[s]);
|
|
2421
2436
|
}
|
|
2422
2437
|
function ne(r, e) {
|
|
2423
2438
|
e.extras !== void 0 && (typeof e.extras == "object" ? Object.assign(r.userData, e.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + e.extras));
|
|
2424
2439
|
}
|
|
2425
|
-
function
|
|
2440
|
+
function zi(r, e, t) {
|
|
2426
2441
|
let s = !1, n = !1, i = !1;
|
|
2427
2442
|
for (let h = 0, u = e.length; h < u; h++) {
|
|
2428
2443
|
const c = e[h];
|
|
@@ -2454,7 +2469,7 @@ function Ni(r, e, t) {
|
|
|
2454
2469
|
return s && (r.morphAttributes.position = u), n && (r.morphAttributes.normal = c), i && (r.morphAttributes.color = p), r.morphTargetsRelative = !0, r;
|
|
2455
2470
|
});
|
|
2456
2471
|
}
|
|
2457
|
-
function
|
|
2472
|
+
function Gi(r, e) {
|
|
2458
2473
|
if (r.updateMorphTargets(), e.weights !== void 0)
|
|
2459
2474
|
for (let t = 0, s = e.weights.length; t < s; t++)
|
|
2460
2475
|
r.morphTargetInfluences[t] = e.weights[t];
|
|
@@ -2468,22 +2483,22 @@ function ki(r, e) {
|
|
|
2468
2483
|
console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
|
|
2469
2484
|
}
|
|
2470
2485
|
}
|
|
2471
|
-
function
|
|
2486
|
+
function Xi(r) {
|
|
2472
2487
|
let e;
|
|
2473
2488
|
const t = r.extensions && r.extensions[A.KHR_DRACO_MESH_COMPRESSION];
|
|
2474
|
-
if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" +
|
|
2489
|
+
if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + bt(t.attributes) : e = r.indices + ":" + bt(r.attributes) + ":" + r.mode, r.targets !== void 0)
|
|
2475
2490
|
for (let s = 0, n = r.targets.length; s < n; s++)
|
|
2476
|
-
e += ":" +
|
|
2491
|
+
e += ":" + bt(r.targets[s]);
|
|
2477
2492
|
return e;
|
|
2478
2493
|
}
|
|
2479
|
-
function
|
|
2494
|
+
function bt(r) {
|
|
2480
2495
|
let e = "";
|
|
2481
2496
|
const t = Object.keys(r).sort();
|
|
2482
2497
|
for (let s = 0, n = t.length; s < n; s++)
|
|
2483
2498
|
e += t[s] + ":" + r[t[s]] + ";";
|
|
2484
2499
|
return e;
|
|
2485
2500
|
}
|
|
2486
|
-
function
|
|
2501
|
+
function St(r) {
|
|
2487
2502
|
switch (r) {
|
|
2488
2503
|
case Int8Array:
|
|
2489
2504
|
return 1 / 127;
|
|
@@ -2497,13 +2512,13 @@ function xt(r) {
|
|
|
2497
2512
|
throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
|
|
2498
2513
|
}
|
|
2499
2514
|
}
|
|
2500
|
-
function
|
|
2515
|
+
function Yi(r) {
|
|
2501
2516
|
return r.search(/\.jpe?g($|\?)/i) > 0 || r.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : r.search(/\.webp($|\?)/i) > 0 || r.search(/^data\:image\/webp/) === 0 ? "image/webp" : r.search(/\.ktx2($|\?)/i) > 0 || r.search(/^data\:image\/ktx2/) === 0 ? "image/ktx2" : "image/png";
|
|
2502
2517
|
}
|
|
2503
|
-
const
|
|
2504
|
-
class
|
|
2518
|
+
const Bi = new Ae();
|
|
2519
|
+
class Ki {
|
|
2505
2520
|
constructor(e = {}, t = {}) {
|
|
2506
|
-
this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new
|
|
2521
|
+
this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new mi(), this.associations = /* @__PURE__ */ new Map(), this.primitiveCache = {}, this.nodeCache = {}, this.meshCache = { refs: {}, uses: {} }, this.cameraCache = { refs: {}, uses: {} }, this.lightCache = { refs: {}, uses: {} }, this.sourceCache = {}, this.textureCache = {}, this.nodeNamesUsed = {};
|
|
2507
2522
|
let s = !1, n = -1, i = !1, o = -1;
|
|
2508
2523
|
if (typeof navigator < "u" && typeof navigator.userAgent < "u") {
|
|
2509
2524
|
const a = navigator.userAgent;
|
|
@@ -2511,7 +2526,7 @@ class Ui {
|
|
|
2511
2526
|
const l = a.match(/Version\/(\d+)/);
|
|
2512
2527
|
n = s && l ? parseInt(l[1], 10) : -1, i = a.indexOf("Firefox") > -1, o = i ? a.match(/Firefox\/([0-9]+)\./)[1] : -1;
|
|
2513
2528
|
}
|
|
2514
|
-
typeof createImageBitmap > "u" || s && n < 17 || i && o < 98 ? this.textureLoader = new
|
|
2529
|
+
typeof createImageBitmap > "u" || s && n < 17 || i && o < 98 ? this.textureLoader = new Zn(this.options.manager) : this.textureLoader = new Qn(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new At(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
|
|
2515
2530
|
}
|
|
2516
2531
|
setExtensions(e) {
|
|
2517
2532
|
this.extensions = e;
|
|
@@ -2541,7 +2556,7 @@ class Ui {
|
|
|
2541
2556
|
parser: s,
|
|
2542
2557
|
userData: {}
|
|
2543
2558
|
};
|
|
2544
|
-
return
|
|
2559
|
+
return ye(i, a, n), ne(a, n), Promise.all(s._invokeAll(function(l) {
|
|
2545
2560
|
return l.afterRoot && l.afterRoot(a);
|
|
2546
2561
|
})).then(function() {
|
|
2547
2562
|
for (const l of a.scenes)
|
|
@@ -2751,27 +2766,27 @@ class Ui {
|
|
|
2751
2766
|
loadAccessor(e) {
|
|
2752
2767
|
const t = this, s = this.json, n = this.json.accessors[e];
|
|
2753
2768
|
if (n.bufferView === void 0 && n.sparse === void 0) {
|
|
2754
|
-
const o =
|
|
2755
|
-
return Promise.resolve(new
|
|
2769
|
+
const o = yt[n.type], a = Se[n.componentType], l = n.normalized === !0, h = new a(n.count * o);
|
|
2770
|
+
return Promise.resolve(new ut(h, o, l));
|
|
2756
2771
|
}
|
|
2757
2772
|
const i = [];
|
|
2758
2773
|
return n.bufferView !== void 0 ? i.push(this.getDependency("bufferView", n.bufferView)) : i.push(null), n.sparse !== void 0 && (i.push(this.getDependency("bufferView", n.sparse.indices.bufferView)), i.push(this.getDependency("bufferView", n.sparse.values.bufferView))), Promise.all(i).then(function(o) {
|
|
2759
|
-
const a = o[0], l =
|
|
2774
|
+
const a = o[0], l = yt[n.type], h = Se[n.componentType], u = h.BYTES_PER_ELEMENT, c = u * l, p = n.byteOffset || 0, m = n.bufferView !== void 0 ? s.bufferViews[n.bufferView].byteStride : void 0, w = n.normalized === !0;
|
|
2760
2775
|
let f, y;
|
|
2761
2776
|
if (m && m !== c) {
|
|
2762
|
-
const d = Math.floor(p / m),
|
|
2763
|
-
let x = t.cache.get(
|
|
2764
|
-
x || (f = new h(a, d * m, n.count * m / u), x = new
|
|
2777
|
+
const d = Math.floor(p / m), b = "InterleavedBuffer:" + n.bufferView + ":" + n.componentType + ":" + d + ":" + n.count;
|
|
2778
|
+
let x = t.cache.get(b);
|
|
2779
|
+
x || (f = new h(a, d * m, n.count * m / u), x = new qn(f, m / u), t.cache.add(b, x)), y = new Wn(x, l, p % m / u, w);
|
|
2765
2780
|
} else
|
|
2766
|
-
a === null ? f = new h(n.count * l) : f = new h(a, p, n.count * l), y = new
|
|
2781
|
+
a === null ? f = new h(n.count * l) : f = new h(a, p, n.count * l), y = new ut(f, l, w);
|
|
2767
2782
|
if (n.sparse !== void 0) {
|
|
2768
|
-
const d =
|
|
2769
|
-
a !== null && (y = new
|
|
2783
|
+
const d = yt.SCALAR, b = Se[n.sparse.indices.componentType], x = n.sparse.indices.byteOffset || 0, S = n.sparse.values.byteOffset || 0, R = new b(o[1], x, n.sparse.count * d), v = new h(o[2], S, n.sparse.count * l);
|
|
2784
|
+
a !== null && (y = new ut(y.array.slice(), y.itemSize, y.normalized)), y.normalized = !1;
|
|
2770
2785
|
for (let I = 0, ie = R.length; I < ie; I++) {
|
|
2771
2786
|
const ee = R[I];
|
|
2772
2787
|
if (y.setX(ee, v[I * l]), l >= 2 && y.setY(ee, v[I * l + 1]), l >= 3 && y.setZ(ee, v[I * l + 2]), l >= 4 && y.setW(ee, v[I * l + 3]), l >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
|
|
2773
2788
|
}
|
|
2774
|
-
y.normalized =
|
|
2789
|
+
y.normalized = w;
|
|
2775
2790
|
}
|
|
2776
2791
|
return y;
|
|
2777
2792
|
});
|
|
@@ -2799,7 +2814,7 @@ class Ui {
|
|
|
2799
2814
|
const h = this.loadImageSource(t, s).then(function(u) {
|
|
2800
2815
|
u.flipY = !1, u.name = o.name || a.name || "", u.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (u.name = a.uri);
|
|
2801
2816
|
const p = (i.samplers || {})[o.sampler] || {};
|
|
2802
|
-
return u.magFilter =
|
|
2817
|
+
return u.magFilter = nn[p.magFilter] || xt, u.minFilter = nn[p.minFilter] || mn, u.wrapS = sn[p.wrapS] || Mt, u.wrapT = sn[p.wrapT] || Mt, u.generateMipmaps = !u.isCompressedTexture && u.minFilter !== gn && u.minFilter !== xt, n.associations.set(u, { textures: e }), u;
|
|
2803
2818
|
}).catch(function() {
|
|
2804
2819
|
return null;
|
|
2805
2820
|
});
|
|
@@ -2821,14 +2836,14 @@ class Ui {
|
|
|
2821
2836
|
throw new Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView");
|
|
2822
2837
|
const u = Promise.resolve(l).then(function(c) {
|
|
2823
2838
|
return new Promise(function(p, m) {
|
|
2824
|
-
let
|
|
2825
|
-
t.isImageBitmapLoader === !0 && (
|
|
2826
|
-
const y = new
|
|
2839
|
+
let w = p;
|
|
2840
|
+
t.isImageBitmapLoader === !0 && (w = function(f) {
|
|
2841
|
+
const y = new Nt(f);
|
|
2827
2842
|
y.needsUpdate = !0, p(y);
|
|
2828
|
-
}), t.load(He.resolveURL(c, i.path),
|
|
2843
|
+
}), t.load(He.resolveURL(c, i.path), w, void 0, m);
|
|
2829
2844
|
});
|
|
2830
2845
|
}).then(function(c) {
|
|
2831
|
-
return h === !0 && a.revokeObjectURL(l), ne(c, o), c.userData.mimeType = o.mimeType ||
|
|
2846
|
+
return h === !0 && a.revokeObjectURL(l), ne(c, o), c.userData.mimeType = o.mimeType || Yi(o.uri), c;
|
|
2832
2847
|
}).catch(function(c) {
|
|
2833
2848
|
throw console.error("THREE.GLTFLoader: Couldn't load texture", l), c;
|
|
2834
2849
|
});
|
|
@@ -2890,7 +2905,7 @@ class Ui {
|
|
|
2890
2905
|
e.material = s;
|
|
2891
2906
|
}
|
|
2892
2907
|
getMaterialType() {
|
|
2893
|
-
return
|
|
2908
|
+
return yn;
|
|
2894
2909
|
}
|
|
2895
2910
|
/**
|
|
2896
2911
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
|
|
@@ -2912,25 +2927,25 @@ class Ui {
|
|
|
2912
2927
|
const p = c.baseColorFactor;
|
|
2913
2928
|
a.color.setRGB(p[0], p[1], p[2], le), a.opacity = p[3];
|
|
2914
2929
|
}
|
|
2915
|
-
c.baseColorTexture !== void 0 && h.push(t.assignTexture(a, "map", c.baseColorTexture,
|
|
2930
|
+
c.baseColorTexture !== void 0 && h.push(t.assignTexture(a, "map", c.baseColorTexture, Re)), a.metalness = c.metallicFactor !== void 0 ? c.metallicFactor : 1, a.roughness = c.roughnessFactor !== void 0 ? c.roughnessFactor : 1, c.metallicRoughnessTexture !== void 0 && (h.push(t.assignTexture(a, "metalnessMap", c.metallicRoughnessTexture)), h.push(t.assignTexture(a, "roughnessMap", c.metallicRoughnessTexture))), o = this._invokeOne(function(p) {
|
|
2916
2931
|
return p.getMaterialType && p.getMaterialType(e);
|
|
2917
2932
|
}), h.push(Promise.all(this._invokeAll(function(p) {
|
|
2918
2933
|
return p.extendMaterialParams && p.extendMaterialParams(e, a);
|
|
2919
2934
|
})));
|
|
2920
2935
|
}
|
|
2921
|
-
i.doubleSided === !0 && (a.side =
|
|
2922
|
-
const u = i.alphaMode ||
|
|
2923
|
-
if (u ===
|
|
2936
|
+
i.doubleSided === !0 && (a.side = dn);
|
|
2937
|
+
const u = i.alphaMode || _t.OPAQUE;
|
|
2938
|
+
if (u === _t.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, u === _t.MASK && (a.alphaTest = i.alphaCutoff !== void 0 ? i.alphaCutoff : 0.5)), i.normalTexture !== void 0 && o !== be && (h.push(t.assignTexture(a, "normalMap", i.normalTexture)), a.normalScale = new V(1, 1), i.normalTexture.scale !== void 0)) {
|
|
2924
2939
|
const c = i.normalTexture.scale;
|
|
2925
2940
|
a.normalScale.set(c, c);
|
|
2926
2941
|
}
|
|
2927
|
-
if (i.occlusionTexture !== void 0 && o !==
|
|
2942
|
+
if (i.occlusionTexture !== void 0 && o !== be && (h.push(t.assignTexture(a, "aoMap", i.occlusionTexture)), i.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = i.occlusionTexture.strength)), i.emissiveFactor !== void 0 && o !== be) {
|
|
2928
2943
|
const c = i.emissiveFactor;
|
|
2929
2944
|
a.emissive = new pe().setRGB(c[0], c[1], c[2], le);
|
|
2930
2945
|
}
|
|
2931
|
-
return i.emissiveTexture !== void 0 && o !==
|
|
2946
|
+
return i.emissiveTexture !== void 0 && o !== be && h.push(t.assignTexture(a, "emissiveMap", i.emissiveTexture, Re)), Promise.all(h).then(function() {
|
|
2932
2947
|
const c = new o(a);
|
|
2933
|
-
return i.name && (c.name = i.name), ne(c, i), t.associations.set(c, { materials: e }), i.extensions &&
|
|
2948
|
+
return i.name && (c.name = i.name), ne(c, i), t.associations.set(c, { materials: e }), i.extensions && ye(n, c, i), c;
|
|
2934
2949
|
});
|
|
2935
2950
|
}
|
|
2936
2951
|
/**
|
|
@@ -2941,7 +2956,7 @@ class Ui {
|
|
|
2941
2956
|
* @return {string}
|
|
2942
2957
|
*/
|
|
2943
2958
|
createUniqueName(e) {
|
|
2944
|
-
const t =
|
|
2959
|
+
const t = ss.sanitizeNodeName(e || "");
|
|
2945
2960
|
return t in this.nodeNamesUsed ? t + "_" + ++this.nodeNamesUsed[t] : (this.nodeNamesUsed[t] = 0, t);
|
|
2946
2961
|
}
|
|
2947
2962
|
/**
|
|
@@ -2957,17 +2972,17 @@ class Ui {
|
|
|
2957
2972
|
const t = this, s = this.extensions, n = this.primitiveCache;
|
|
2958
2973
|
function i(a) {
|
|
2959
2974
|
return s[A.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, t).then(function(l) {
|
|
2960
|
-
return
|
|
2975
|
+
return on(l, a, t);
|
|
2961
2976
|
});
|
|
2962
2977
|
}
|
|
2963
2978
|
const o = [];
|
|
2964
2979
|
for (let a = 0, l = e.length; a < l; a++) {
|
|
2965
|
-
const h = e[a], u =
|
|
2980
|
+
const h = e[a], u = Xi(h), c = n[u];
|
|
2966
2981
|
if (c)
|
|
2967
2982
|
o.push(c.promise);
|
|
2968
2983
|
else {
|
|
2969
2984
|
let p;
|
|
2970
|
-
h.extensions && h.extensions[A.KHR_DRACO_MESH_COMPRESSION] ? p = i(h) : p =
|
|
2985
|
+
h.extensions && h.extensions[A.KHR_DRACO_MESH_COMPRESSION] ? p = i(h) : p = on(new Ye(), h, t), n[u] = { primitive: h, promise: p }, o.push(p);
|
|
2971
2986
|
}
|
|
2972
2987
|
}
|
|
2973
2988
|
return Promise.all(o);
|
|
@@ -2982,39 +2997,39 @@ class Ui {
|
|
|
2982
2997
|
loadMesh(e) {
|
|
2983
2998
|
const t = this, s = this.json, n = this.extensions, i = s.meshes[e], o = i.primitives, a = [];
|
|
2984
2999
|
for (let l = 0, h = o.length; l < h; l++) {
|
|
2985
|
-
const u = o[l].material === void 0 ?
|
|
3000
|
+
const u = o[l].material === void 0 ? Ui(this.cache) : this.getDependency("material", o[l].material);
|
|
2986
3001
|
a.push(u);
|
|
2987
3002
|
}
|
|
2988
3003
|
return a.push(t.loadGeometries(o)), Promise.all(a).then(function(l) {
|
|
2989
3004
|
const h = l.slice(0, l.length - 1), u = l[l.length - 1], c = [];
|
|
2990
|
-
for (let m = 0,
|
|
3005
|
+
for (let m = 0, w = u.length; m < w; m++) {
|
|
2991
3006
|
const f = u[m], y = o[m];
|
|
2992
3007
|
let d;
|
|
2993
|
-
const
|
|
3008
|
+
const b = h[m];
|
|
2994
3009
|
if (y.mode === W.TRIANGLES || y.mode === W.TRIANGLE_STRIP || y.mode === W.TRIANGLE_FAN || y.mode === void 0)
|
|
2995
|
-
d = i.isSkinnedMesh === !0 ? new
|
|
3010
|
+
d = i.isSkinnedMesh === !0 ? new is(f, b) : new T(f, b), d.isSkinnedMesh === !0 && d.normalizeSkinWeights(), y.mode === W.TRIANGLE_STRIP ? d.geometry = Jt(d.geometry, fn) : y.mode === W.TRIANGLE_FAN && (d.geometry = Jt(d.geometry, Tt));
|
|
2996
3011
|
else if (y.mode === W.LINES)
|
|
2997
|
-
d = new
|
|
3012
|
+
d = new wt(f, b);
|
|
2998
3013
|
else if (y.mode === W.LINE_STRIP)
|
|
2999
|
-
d = new re(f,
|
|
3014
|
+
d = new re(f, b);
|
|
3000
3015
|
else if (y.mode === W.LINE_LOOP)
|
|
3001
|
-
d = new
|
|
3016
|
+
d = new os(f, b);
|
|
3002
3017
|
else if (y.mode === W.POINTS)
|
|
3003
|
-
d = new
|
|
3018
|
+
d = new ot(f, b);
|
|
3004
3019
|
else
|
|
3005
3020
|
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + y.mode);
|
|
3006
|
-
Object.keys(d.geometry.morphAttributes).length > 0 &&
|
|
3021
|
+
Object.keys(d.geometry.morphAttributes).length > 0 && Gi(d, i), d.name = t.createUniqueName(i.name || "mesh_" + e), ne(d, i), y.extensions && ye(n, d, y), t.assignFinalMaterial(d), c.push(d);
|
|
3007
3022
|
}
|
|
3008
|
-
for (let m = 0,
|
|
3023
|
+
for (let m = 0, w = c.length; m < w; m++)
|
|
3009
3024
|
t.associations.set(c[m], {
|
|
3010
3025
|
meshes: e,
|
|
3011
3026
|
primitives: m
|
|
3012
3027
|
});
|
|
3013
3028
|
if (c.length === 1)
|
|
3014
|
-
return i.extensions &&
|
|
3015
|
-
const p = new
|
|
3016
|
-
i.extensions &&
|
|
3017
|
-
for (let m = 0,
|
|
3029
|
+
return i.extensions && ye(n, c[0], i), c[0];
|
|
3030
|
+
const p = new it();
|
|
3031
|
+
i.extensions && ye(n, p, i), t.associations.set(p, { meshes: e });
|
|
3032
|
+
for (let m = 0, w = c.length; m < w; m++)
|
|
3018
3033
|
p.add(c[m]);
|
|
3019
3034
|
return p;
|
|
3020
3035
|
});
|
|
@@ -3033,7 +3048,7 @@ class Ui {
|
|
|
3033
3048
|
console.warn("THREE.GLTFLoader: Missing camera parameters.");
|
|
3034
3049
|
return;
|
|
3035
3050
|
}
|
|
3036
|
-
return s.type === "perspective" ? t = new
|
|
3051
|
+
return s.type === "perspective" ? t = new rs(un.radToDeg(n.yfov), n.aspectRatio || 1, n.znear || 1, n.zfar || 2e6) : s.type === "orthographic" && (t = new as(-n.xmag, n.xmag, n.ymag, -n.ymag, n.znear, n.zfar)), s.name && (t.name = this.createUniqueName(s.name)), ne(t, s), Promise.resolve(t);
|
|
3037
3052
|
}
|
|
3038
3053
|
/**
|
|
3039
3054
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
|
|
@@ -3052,12 +3067,12 @@ class Ui {
|
|
|
3052
3067
|
const c = o[h];
|
|
3053
3068
|
if (c) {
|
|
3054
3069
|
a.push(c);
|
|
3055
|
-
const p = new
|
|
3070
|
+
const p = new Ae();
|
|
3056
3071
|
i !== null && p.fromArray(i.array, h * 16), l.push(p);
|
|
3057
3072
|
} else
|
|
3058
3073
|
console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', t.joints[h]);
|
|
3059
3074
|
}
|
|
3060
|
-
return new
|
|
3075
|
+
return new ls(a, l);
|
|
3061
3076
|
});
|
|
3062
3077
|
}
|
|
3063
3078
|
/**
|
|
@@ -3070,8 +3085,8 @@ class Ui {
|
|
|
3070
3085
|
loadAnimation(e) {
|
|
3071
3086
|
const t = this.json, s = this, n = t.animations[e], i = n.name ? n.name : "animation_" + e, o = [], a = [], l = [], h = [], u = [];
|
|
3072
3087
|
for (let c = 0, p = n.channels.length; c < p; c++) {
|
|
3073
|
-
const m = n.channels[c],
|
|
3074
|
-
f.node !== void 0 && (o.push(this.getDependency("node", y)), a.push(this.getDependency("accessor", d)), l.push(this.getDependency("accessor",
|
|
3088
|
+
const m = n.channels[c], w = n.samplers[m.sampler], f = m.target, y = f.node, d = n.parameters !== void 0 ? n.parameters[w.input] : w.input, b = n.parameters !== void 0 ? n.parameters[w.output] : w.output;
|
|
3089
|
+
f.node !== void 0 && (o.push(this.getDependency("node", y)), a.push(this.getDependency("accessor", d)), l.push(this.getDependency("accessor", b)), h.push(w), u.push(f));
|
|
3075
3090
|
}
|
|
3076
3091
|
return Promise.all([
|
|
3077
3092
|
Promise.all(o),
|
|
@@ -3080,18 +3095,18 @@ class Ui {
|
|
|
3080
3095
|
Promise.all(h),
|
|
3081
3096
|
Promise.all(u)
|
|
3082
3097
|
]).then(function(c) {
|
|
3083
|
-
const p = c[0], m = c[1],
|
|
3098
|
+
const p = c[0], m = c[1], w = c[2], f = c[3], y = c[4], d = [];
|
|
3084
3099
|
for (let x = 0, S = p.length; x < S; x++) {
|
|
3085
|
-
const R = p[x], v = m[x], I =
|
|
3100
|
+
const R = p[x], v = m[x], I = w[x], ie = f[x], ee = y[x];
|
|
3086
3101
|
if (R === void 0) continue;
|
|
3087
3102
|
R.updateMatrix && R.updateMatrix();
|
|
3088
|
-
const
|
|
3089
|
-
if (
|
|
3090
|
-
for (let $ = 0; $ <
|
|
3091
|
-
d.push(
|
|
3103
|
+
const me = s._createAnimationTracks(R, v, I, ie, ee);
|
|
3104
|
+
if (me)
|
|
3105
|
+
for (let $ = 0; $ < me.length; $++)
|
|
3106
|
+
d.push(me[$]);
|
|
3092
3107
|
}
|
|
3093
|
-
const
|
|
3094
|
-
return ne(
|
|
3108
|
+
const b = new cs(i, void 0, d);
|
|
3109
|
+
return ne(b, n), b;
|
|
3095
3110
|
});
|
|
3096
3111
|
}
|
|
3097
3112
|
createNodeMesh(e) {
|
|
@@ -3124,13 +3139,13 @@ class Ui {
|
|
|
3124
3139
|
]).then(function(h) {
|
|
3125
3140
|
const u = h[0], c = h[1], p = h[2];
|
|
3126
3141
|
p !== null && u.traverse(function(m) {
|
|
3127
|
-
m.isSkinnedMesh && m.bind(p,
|
|
3142
|
+
m.isSkinnedMesh && m.bind(p, Bi);
|
|
3128
3143
|
});
|
|
3129
|
-
for (let m = 0,
|
|
3144
|
+
for (let m = 0, w = c.length; m < w; m++)
|
|
3130
3145
|
u.add(c[m]);
|
|
3131
3146
|
if (u.userData.pivot !== void 0 && c.length > 0) {
|
|
3132
|
-
const m = u.userData.pivot,
|
|
3133
|
-
u.pivot = new
|
|
3147
|
+
const m = u.userData.pivot, w = c[0];
|
|
3148
|
+
u.pivot = new E().fromArray(m), u.position.x -= m[0], u.position.y -= m[1], u.position.z -= m[2], w.position.set(0, 0, 0), delete u.userData.pivot;
|
|
3134
3149
|
}
|
|
3135
3150
|
return u;
|
|
3136
3151
|
});
|
|
@@ -3152,11 +3167,11 @@ class Ui {
|
|
|
3152
3167
|
a.push(h);
|
|
3153
3168
|
}), this.nodeCache[e] = Promise.all(a).then(function(h) {
|
|
3154
3169
|
let u;
|
|
3155
|
-
if (i.isBone === !0 ? u = new
|
|
3170
|
+
if (i.isBone === !0 ? u = new hs() : h.length > 1 ? u = new it() : h.length === 1 ? u = h[0] : u = new Xe(), u !== h[0])
|
|
3156
3171
|
for (let c = 0, p = h.length; c < p; c++)
|
|
3157
3172
|
u.add(h[c]);
|
|
3158
|
-
if (i.name && (u.userData.name = i.name, u.name = o), ne(u, i), i.extensions &&
|
|
3159
|
-
const c = new
|
|
3173
|
+
if (i.name && (u.userData.name = i.name, u.name = o), ne(u, i), i.extensions && ye(s, u, i), i.matrix !== void 0) {
|
|
3174
|
+
const c = new Ae();
|
|
3160
3175
|
c.fromArray(i.matrix), u.applyMatrix4(c);
|
|
3161
3176
|
} else
|
|
3162
3177
|
i.translation !== void 0 && u.position.fromArray(i.translation), i.rotation !== void 0 && u.quaternion.fromArray(i.rotation), i.scale !== void 0 && u.scale.fromArray(i.scale);
|
|
@@ -3177,20 +3192,20 @@ class Ui {
|
|
|
3177
3192
|
* @return {Promise<Group>}
|
|
3178
3193
|
*/
|
|
3179
3194
|
loadScene(e) {
|
|
3180
|
-
const t = this.extensions, s = this.json.scenes[e], n = this, i = new
|
|
3181
|
-
s.name && (i.name = n.createUniqueName(s.name)), ne(i, s), s.extensions &&
|
|
3195
|
+
const t = this.extensions, s = this.json.scenes[e], n = this, i = new it();
|
|
3196
|
+
s.name && (i.name = n.createUniqueName(s.name)), ne(i, s), s.extensions && ye(t, i, s);
|
|
3182
3197
|
const o = s.nodes || [], a = [];
|
|
3183
3198
|
for (let l = 0, h = o.length; l < h; l++)
|
|
3184
3199
|
a.push(n.getDependency("node", o[l]));
|
|
3185
3200
|
return Promise.all(a).then(function(l) {
|
|
3186
3201
|
for (let u = 0, c = l.length; u < c; u++) {
|
|
3187
3202
|
const p = l[u];
|
|
3188
|
-
p.parent !== null ? i.add(
|
|
3203
|
+
p.parent !== null ? i.add(pi(p)) : i.add(p);
|
|
3189
3204
|
}
|
|
3190
3205
|
const h = (u) => {
|
|
3191
3206
|
const c = /* @__PURE__ */ new Map();
|
|
3192
3207
|
for (const [p, m] of n.associations)
|
|
3193
|
-
(p instanceof Fe || p instanceof
|
|
3208
|
+
(p instanceof Fe || p instanceof Nt) && c.set(p, m);
|
|
3194
3209
|
return u.traverse((p) => {
|
|
3195
3210
|
const m = n.associations.get(p);
|
|
3196
3211
|
m != null && c.set(p, m);
|
|
@@ -3208,30 +3223,30 @@ class Ui {
|
|
|
3208
3223
|
let u;
|
|
3209
3224
|
switch (he[i.path]) {
|
|
3210
3225
|
case he.weights:
|
|
3211
|
-
u =
|
|
3226
|
+
u = jt;
|
|
3212
3227
|
break;
|
|
3213
3228
|
case he.rotation:
|
|
3214
|
-
u =
|
|
3229
|
+
u = Ft;
|
|
3215
3230
|
break;
|
|
3216
3231
|
case he.translation:
|
|
3217
3232
|
case he.scale:
|
|
3218
|
-
u =
|
|
3233
|
+
u = kt;
|
|
3219
3234
|
break;
|
|
3220
3235
|
default:
|
|
3221
3236
|
switch (s.itemSize) {
|
|
3222
3237
|
case 1:
|
|
3223
|
-
u =
|
|
3238
|
+
u = jt;
|
|
3224
3239
|
break;
|
|
3225
3240
|
case 2:
|
|
3226
3241
|
case 3:
|
|
3227
3242
|
default:
|
|
3228
|
-
u =
|
|
3243
|
+
u = kt;
|
|
3229
3244
|
break;
|
|
3230
3245
|
}
|
|
3231
3246
|
break;
|
|
3232
3247
|
}
|
|
3233
|
-
const c = n.interpolation !== void 0 ?
|
|
3234
|
-
for (let m = 0,
|
|
3248
|
+
const c = n.interpolation !== void 0 ? Hi[n.interpolation] : _n, p = this._getArrayFromAccessor(s);
|
|
3249
|
+
for (let m = 0, w = l.length; m < w; m++) {
|
|
3235
3250
|
const f = new u(
|
|
3236
3251
|
l[m] + "." + he[i.path],
|
|
3237
3252
|
t.array,
|
|
@@ -3245,7 +3260,7 @@ class Ui {
|
|
|
3245
3260
|
_getArrayFromAccessor(e) {
|
|
3246
3261
|
let t = e.array;
|
|
3247
3262
|
if (e.normalized) {
|
|
3248
|
-
const s =
|
|
3263
|
+
const s = St(t.constructor), n = new Float32Array(t.length);
|
|
3249
3264
|
for (let i = 0, o = t.length; i < o; i++)
|
|
3250
3265
|
n[i] = t[i] * s;
|
|
3251
3266
|
t = n;
|
|
@@ -3254,21 +3269,21 @@ class Ui {
|
|
|
3254
3269
|
}
|
|
3255
3270
|
_createCubicSplineTrackInterpolant(e) {
|
|
3256
3271
|
e.createInterpolant = function(s) {
|
|
3257
|
-
const n = this instanceof
|
|
3272
|
+
const n = this instanceof Ft ? Fi : En;
|
|
3258
3273
|
return new n(this.times, this.values, this.getValueSize() / 3, s);
|
|
3259
3274
|
}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
|
|
3260
3275
|
}
|
|
3261
3276
|
}
|
|
3262
|
-
function
|
|
3263
|
-
const s = e.attributes, n = new
|
|
3277
|
+
function Vi(r, e, t) {
|
|
3278
|
+
const s = e.attributes, n = new fs();
|
|
3264
3279
|
if (s.POSITION !== void 0) {
|
|
3265
3280
|
const a = t.json.accessors[s.POSITION], l = a.min, h = a.max;
|
|
3266
3281
|
if (l !== void 0 && h !== void 0) {
|
|
3267
3282
|
if (n.set(
|
|
3268
|
-
new
|
|
3269
|
-
new
|
|
3283
|
+
new E(l[0], l[1], l[2]),
|
|
3284
|
+
new E(h[0], h[1], h[2])
|
|
3270
3285
|
), a.normalized) {
|
|
3271
|
-
const u =
|
|
3286
|
+
const u = St(Se[a.componentType]);
|
|
3272
3287
|
n.min.multiplyScalar(u), n.max.multiplyScalar(u);
|
|
3273
3288
|
}
|
|
3274
3289
|
} else {
|
|
@@ -3279,14 +3294,14 @@ function zi(r, e, t) {
|
|
|
3279
3294
|
return;
|
|
3280
3295
|
const i = e.targets;
|
|
3281
3296
|
if (i !== void 0) {
|
|
3282
|
-
const a = new
|
|
3297
|
+
const a = new E(), l = new E();
|
|
3283
3298
|
for (let h = 0, u = i.length; h < u; h++) {
|
|
3284
3299
|
const c = i[h];
|
|
3285
3300
|
if (c.POSITION !== void 0) {
|
|
3286
|
-
const p = t.json.accessors[c.POSITION], m = p.min,
|
|
3287
|
-
if (m !== void 0 &&
|
|
3288
|
-
if (l.setX(Math.max(Math.abs(m[0]), Math.abs(
|
|
3289
|
-
const f =
|
|
3301
|
+
const p = t.json.accessors[c.POSITION], m = p.min, w = p.max;
|
|
3302
|
+
if (m !== void 0 && w !== void 0) {
|
|
3303
|
+
if (l.setX(Math.max(Math.abs(m[0]), Math.abs(w[0]))), l.setY(Math.max(Math.abs(m[1]), Math.abs(w[1]))), l.setZ(Math.max(Math.abs(m[2]), Math.abs(w[2]))), p.normalized) {
|
|
3304
|
+
const f = St(Se[p.componentType]);
|
|
3290
3305
|
l.multiplyScalar(f);
|
|
3291
3306
|
}
|
|
3292
3307
|
a.max(l);
|
|
@@ -3297,10 +3312,10 @@ function zi(r, e, t) {
|
|
|
3297
3312
|
n.expandByVector(a);
|
|
3298
3313
|
}
|
|
3299
3314
|
r.boundingBox = n;
|
|
3300
|
-
const o = new
|
|
3315
|
+
const o = new ms();
|
|
3301
3316
|
n.getCenter(o.center), o.radius = n.min.distanceTo(n.max) / 2, r.boundingSphere = o;
|
|
3302
3317
|
}
|
|
3303
|
-
function
|
|
3318
|
+
function on(r, e, t) {
|
|
3304
3319
|
const s = e.attributes, n = [];
|
|
3305
3320
|
function i(o, a) {
|
|
3306
3321
|
return t.getDependency("accessor", o).then(function(l) {
|
|
@@ -3308,7 +3323,7 @@ function tn(r, e, t) {
|
|
|
3308
3323
|
});
|
|
3309
3324
|
}
|
|
3310
3325
|
for (const o in s) {
|
|
3311
|
-
const a =
|
|
3326
|
+
const a = vt[o] || o.toLowerCase();
|
|
3312
3327
|
a in r.attributes || n.push(i(s[o], a));
|
|
3313
3328
|
}
|
|
3314
3329
|
if (e.indices !== void 0 && !r.index) {
|
|
@@ -3317,25 +3332,25 @@ function tn(r, e, t) {
|
|
|
3317
3332
|
});
|
|
3318
3333
|
n.push(o);
|
|
3319
3334
|
}
|
|
3320
|
-
return
|
|
3321
|
-
return e.targets !== void 0 ?
|
|
3335
|
+
return Ht.workingColorSpace !== le && "COLOR_0" in s && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Ht.workingColorSpace}" not supported.`), ne(r, e), Vi(r, e, t), Promise.all(n).then(function() {
|
|
3336
|
+
return e.targets !== void 0 ? zi(r, e.targets, t) : r;
|
|
3322
3337
|
});
|
|
3323
3338
|
}
|
|
3324
|
-
function
|
|
3339
|
+
function Zi() {
|
|
3325
3340
|
const r = new F.BoxGeometry(1, 1, 1), e = new F.MeshStandardMaterial({ color: 43775 }), t = new F.Mesh(r, e);
|
|
3326
|
-
return t.position.y = 0.5, t.userData.isMovable = !0, t.name = "正方体",
|
|
3341
|
+
return t.position.y = 0.5, t.userData.isMovable = !0, t.name = "正方体", It(t, !0), t;
|
|
3327
3342
|
}
|
|
3328
|
-
function
|
|
3343
|
+
function Qi() {
|
|
3329
3344
|
const r = new F.SphereGeometry(0.6, 32, 32), e = new F.MeshStandardMaterial({ color: 16746496 }), t = new F.Mesh(r, e);
|
|
3330
|
-
return t.position.y = 0.6, t.userData.isMovable = !0, t.name = "球体",
|
|
3345
|
+
return t.position.y = 0.6, t.userData.isMovable = !0, t.name = "球体", It(t, !0), t;
|
|
3331
3346
|
}
|
|
3332
|
-
function
|
|
3347
|
+
function qi(r) {
|
|
3333
3348
|
return new Promise((e, t) => {
|
|
3334
3349
|
var o;
|
|
3335
3350
|
const s = (o = r.name.split(".").pop()) == null ? void 0 : o.toLowerCase(), n = URL.createObjectURL(r);
|
|
3336
3351
|
let i;
|
|
3337
|
-
if (s === "obj") i = new
|
|
3338
|
-
else if (s === "gltf" || s === "glb") i = new
|
|
3352
|
+
if (s === "obj") i = new di();
|
|
3353
|
+
else if (s === "gltf" || s === "glb") i = new fi();
|
|
3339
3354
|
else {
|
|
3340
3355
|
t(new Error("不支持的文件格式,请使用 .obj, .gltf, .glb"));
|
|
3341
3356
|
return;
|
|
@@ -3349,30 +3364,30 @@ function Yi(r) {
|
|
|
3349
3364
|
c.userData.isMovable = !0, c.name || (c.name = c.type), c.type === "Mesh" && (c.frustumCulled = !0, (p = c.geometry) == null || p.computeVertexNormals());
|
|
3350
3365
|
});
|
|
3351
3366
|
const u = new F.Box3().setFromObject(l).getCenter(new F.Vector3());
|
|
3352
|
-
l.position.sub(u),
|
|
3367
|
+
l.position.sub(u), It(l, !0), e(l);
|
|
3353
3368
|
},
|
|
3354
3369
|
void 0,
|
|
3355
3370
|
(a) => t(a)
|
|
3356
3371
|
);
|
|
3357
3372
|
});
|
|
3358
3373
|
}
|
|
3359
|
-
function
|
|
3374
|
+
function Wi(r) {
|
|
3360
3375
|
switch (r) {
|
|
3361
3376
|
case "box":
|
|
3362
|
-
|
|
3377
|
+
Zi();
|
|
3363
3378
|
break;
|
|
3364
3379
|
case "sphere":
|
|
3365
|
-
|
|
3380
|
+
Qi();
|
|
3366
3381
|
break;
|
|
3367
3382
|
}
|
|
3368
3383
|
}
|
|
3369
|
-
const
|
|
3384
|
+
const $i = {
|
|
3370
3385
|
key: 1,
|
|
3371
3386
|
class: "toggle-placeholder"
|
|
3372
|
-
},
|
|
3387
|
+
}, Ji = { class: "tree-icon" }, eo = { class: "tree-name" }, to = {
|
|
3373
3388
|
key: 0,
|
|
3374
3389
|
class: "tree-children"
|
|
3375
|
-
},
|
|
3390
|
+
}, no = /* @__PURE__ */ Be({
|
|
3376
3391
|
__name: "TreeItem",
|
|
3377
3392
|
props: {
|
|
3378
3393
|
node: {},
|
|
@@ -3381,15 +3396,15 @@ const Ki = {
|
|
|
3381
3396
|
},
|
|
3382
3397
|
emits: ["select", "delete"],
|
|
3383
3398
|
setup(r, { emit: e }) {
|
|
3384
|
-
const t = r, s = e, n = G(null), { expandedSet: i, toggleExpand: o } =
|
|
3399
|
+
const t = r, s = e, n = G(null), { expandedSet: i, toggleExpand: o } = Sn("treeExpand"), a = We(() => i.value.has(t.node.uuid)), l = We(() => (t.version, t.node.children.some((f) => f.userData.isMovable === !0))), h = We(() => (t.version, t.node.children.filter(
|
|
3385
3400
|
(f) => f.userData.isMovable === !0
|
|
3386
|
-
))), u =
|
|
3401
|
+
))), u = We(
|
|
3387
3402
|
() => {
|
|
3388
3403
|
var f;
|
|
3389
3404
|
return ((f = t.selectedObject) == null ? void 0 : f.uuid) === t.node.uuid;
|
|
3390
3405
|
}
|
|
3391
3406
|
);
|
|
3392
|
-
|
|
3407
|
+
An(
|
|
3393
3408
|
() => {
|
|
3394
3409
|
u.value && n.value && n.value.scrollIntoView({
|
|
3395
3410
|
block: "nearest",
|
|
@@ -3404,34 +3419,34 @@ const Ki = {
|
|
|
3404
3419
|
f.stopPropagation(), s("select", t.node);
|
|
3405
3420
|
}, p = (f) => {
|
|
3406
3421
|
f.stopPropagation(), s("delete", t.node);
|
|
3407
|
-
}, m = (f) => f.type === "Mesh" || f.type === "Sprite" ? "🟦" : f.type === "Light" ? "💡" : "📦",
|
|
3422
|
+
}, m = (f) => f.type === "Mesh" || f.type === "Sprite" ? "🟦" : f.type === "Light" ? "💡" : "📦", w = (f) => f.name || `${f.type} (${f.id})`;
|
|
3408
3423
|
return (f, y) => {
|
|
3409
|
-
const d =
|
|
3424
|
+
const d = Rn("TreeItem", !0);
|
|
3410
3425
|
return C(), U("div", {
|
|
3411
3426
|
class: "tree-node",
|
|
3412
3427
|
ref_key: "nodeRef",
|
|
3413
3428
|
ref: n
|
|
3414
3429
|
}, [
|
|
3415
3430
|
g("div", {
|
|
3416
|
-
class:
|
|
3431
|
+
class: Ge(["tree-item", { selected: u.value }]),
|
|
3417
3432
|
onClick: c
|
|
3418
3433
|
}, [
|
|
3419
3434
|
l.value ? (C(), U("span", {
|
|
3420
3435
|
key: 0,
|
|
3421
3436
|
class: "toggle-icon",
|
|
3422
|
-
onClick: y[0] || (y[0] =
|
|
3423
|
-
}, Ee(a.value ? "▼" : "▶"), 1)) : (C(), U("span",
|
|
3424
|
-
g("span",
|
|
3425
|
-
g("span",
|
|
3437
|
+
onClick: y[0] || (y[0] = Ct((b) => Pn(o)(r.node.uuid), ["stop"]))
|
|
3438
|
+
}, Ee(a.value ? "▼" : "▶"), 1)) : (C(), U("span", $i)),
|
|
3439
|
+
g("span", Ji, Ee(m(r.node)), 1),
|
|
3440
|
+
g("span", eo, Ee(w(r.node)), 1),
|
|
3426
3441
|
g("button", {
|
|
3427
3442
|
class: "tree-delete",
|
|
3428
|
-
onClick:
|
|
3443
|
+
onClick: Ct(p, ["stop"])
|
|
3429
3444
|
}, "×")
|
|
3430
3445
|
], 2),
|
|
3431
|
-
a.value && l.value ? (C(), U("div",
|
|
3432
|
-
(C(!0), U(
|
|
3433
|
-
key:
|
|
3434
|
-
node:
|
|
3446
|
+
a.value && l.value ? (C(), U("div", to, [
|
|
3447
|
+
(C(!0), U(rn, null, an(h.value, (b) => (C(), ke(d, {
|
|
3448
|
+
key: b.uuid,
|
|
3449
|
+
node: b,
|
|
3435
3450
|
"selected-object": r.selectedObject,
|
|
3436
3451
|
version: r.version,
|
|
3437
3452
|
onSelect: y[1] || (y[1] = (x) => s("select", x)),
|
|
@@ -3441,13 +3456,13 @@ const Ki = {
|
|
|
3441
3456
|
], 512);
|
|
3442
3457
|
};
|
|
3443
3458
|
}
|
|
3444
|
-
}),
|
|
3459
|
+
}), Ke = (r, e) => {
|
|
3445
3460
|
const t = r.__vccOpts || r;
|
|
3446
3461
|
for (const [s, n] of e)
|
|
3447
3462
|
t[s] = n;
|
|
3448
3463
|
return t;
|
|
3449
|
-
},
|
|
3450
|
-
function
|
|
3464
|
+
}, so = /* @__PURE__ */ Ke(no, [["__scopeId", "data-v-5ad9c842"]]);
|
|
3465
|
+
function io(r) {
|
|
3451
3466
|
const e = G(/* @__PURE__ */ new Set()), t = (n) => {
|
|
3452
3467
|
const i = new Set(e.value);
|
|
3453
3468
|
i.has(n) ? i.delete(n) : i.add(n), e.value = i;
|
|
@@ -3459,7 +3474,7 @@ function $i(r) {
|
|
|
3459
3474
|
i.add(o.uuid), o = o.parent;
|
|
3460
3475
|
e.value = i;
|
|
3461
3476
|
};
|
|
3462
|
-
return
|
|
3477
|
+
return ln(
|
|
3463
3478
|
r,
|
|
3464
3479
|
(n) => {
|
|
3465
3480
|
n && s(n);
|
|
@@ -3467,28 +3482,28 @@ function $i(r) {
|
|
|
3467
3482
|
{ immediate: !0 }
|
|
3468
3483
|
), { expandedSet: e, toggleExpand: t };
|
|
3469
3484
|
}
|
|
3470
|
-
const
|
|
3485
|
+
const oo = {
|
|
3471
3486
|
key: 0,
|
|
3472
3487
|
class: "property-panel"
|
|
3473
|
-
},
|
|
3488
|
+
}, ro = { class: "property-group tree-group" }, ao = { class: "tree-container" }, lo = {
|
|
3474
3489
|
key: 0,
|
|
3475
3490
|
class: "tree-empty"
|
|
3476
|
-
},
|
|
3491
|
+
}, co = {
|
|
3477
3492
|
key: 0,
|
|
3478
3493
|
class: "tabs"
|
|
3479
|
-
},
|
|
3494
|
+
}, ho = {
|
|
3480
3495
|
key: 1,
|
|
3481
3496
|
class: "tab-content"
|
|
3482
|
-
},
|
|
3497
|
+
}, uo = { class: "property-group" }, po = { class: "row" }, fo = { class: "property-group" }, mo = { class: "row" }, go = { class: "property-group" }, yo = { class: "row" }, _o = {
|
|
3483
3498
|
key: 0,
|
|
3484
3499
|
class: "property-group material-group"
|
|
3485
|
-
},
|
|
3500
|
+
}, bo = { class: "slider-row" }, wo = { class: "slider-value" }, To = { class: "slider-row" }, xo = { class: "slider-value" }, Mo = { class: "slider-row" }, Eo = { class: "slider-value" }, vo = {
|
|
3486
3501
|
key: 0,
|
|
3487
3502
|
class: "material-hint"
|
|
3488
|
-
},
|
|
3503
|
+
}, So = {
|
|
3489
3504
|
key: 1,
|
|
3490
3505
|
class: "property-panel empty"
|
|
3491
|
-
},
|
|
3506
|
+
}, Ao = /* @__PURE__ */ Be({
|
|
3492
3507
|
__name: "PropertyPanel",
|
|
3493
3508
|
props: {
|
|
3494
3509
|
transform: {},
|
|
@@ -3497,20 +3512,20 @@ const Ji = {
|
|
|
3497
3512
|
},
|
|
3498
3513
|
emits: ["propertyChange", "treeSelect", "treeDelete"],
|
|
3499
3514
|
setup(r, { emit: e }) {
|
|
3500
|
-
const t = r, s = e, n = () => s("propertyChange"), i = G("transform"), o = G(0), a =
|
|
3501
|
-
|
|
3515
|
+
const t = r, s = e, n = () => s("propertyChange"), i = G("transform"), o = G(0), a = Ln(t, "selectedObject"), { expandedSet: l, toggleExpand: h } = io(a);
|
|
3516
|
+
In("treeExpand", { expandedSet: l, toggleExpand: h });
|
|
3502
3517
|
const u = (y) => {
|
|
3503
3518
|
o.value++, s("treeDelete", y);
|
|
3504
|
-
}, c =
|
|
3519
|
+
}, c = cn({
|
|
3505
3520
|
metalness: 0,
|
|
3506
3521
|
roughness: 0.5,
|
|
3507
3522
|
opacity: 1
|
|
3508
3523
|
}), p = G(!1);
|
|
3509
3524
|
function m(y) {
|
|
3510
3525
|
let d = null;
|
|
3511
|
-
return y.traverse((
|
|
3512
|
-
if (
|
|
3513
|
-
const x =
|
|
3526
|
+
return y.traverse((b) => {
|
|
3527
|
+
if (b.type === "Mesh" && !d) {
|
|
3528
|
+
const x = b, S = Array.isArray(x.material) ? x.material : [x.material];
|
|
3514
3529
|
for (const R of S)
|
|
3515
3530
|
if (R && (R.type === "MeshStandardMaterial" || R.type === "MeshPhongMaterial")) {
|
|
3516
3531
|
const v = R;
|
|
@@ -3524,19 +3539,19 @@ const Ji = {
|
|
|
3524
3539
|
}
|
|
3525
3540
|
}), d;
|
|
3526
3541
|
}
|
|
3527
|
-
function
|
|
3528
|
-
let
|
|
3542
|
+
function w(y, d) {
|
|
3543
|
+
let b = !1;
|
|
3529
3544
|
return y.traverse((x) => {
|
|
3530
3545
|
if (x.type === "Mesh") {
|
|
3531
3546
|
const S = x, R = Array.isArray(S.material) ? S.material : [S.material];
|
|
3532
3547
|
for (const v of R)
|
|
3533
|
-
v && (v.type === "MeshStandardMaterial" || v.type === "MeshPhongMaterial") && (d.metalness !== void 0 && (v.metalness = d.metalness), d.roughness !== void 0 && (v.roughness = d.roughness), d.opacity !== void 0 && (v.opacity = d.opacity, v.transparent = d.opacity < 1), v.needsUpdate = !0,
|
|
3548
|
+
v && (v.type === "MeshStandardMaterial" || v.type === "MeshPhongMaterial") && (d.metalness !== void 0 && (v.metalness = d.metalness), d.roughness !== void 0 && (v.roughness = d.roughness), d.opacity !== void 0 && (v.opacity = d.opacity, v.transparent = d.opacity < 1), v.needsUpdate = !0, b = !0);
|
|
3534
3549
|
}
|
|
3535
|
-
}),
|
|
3550
|
+
}), b;
|
|
3536
3551
|
}
|
|
3537
3552
|
function f() {
|
|
3538
3553
|
if (t.selectedObject) {
|
|
3539
|
-
const y =
|
|
3554
|
+
const y = w(t.selectedObject, {
|
|
3540
3555
|
metalness: c.metalness,
|
|
3541
3556
|
roughness: c.roughness,
|
|
3542
3557
|
opacity: c.opacity
|
|
@@ -3544,7 +3559,7 @@ const Ji = {
|
|
|
3544
3559
|
p.value = y;
|
|
3545
3560
|
}
|
|
3546
3561
|
}
|
|
3547
|
-
return
|
|
3562
|
+
return ln(
|
|
3548
3563
|
() => t.selectedObject,
|
|
3549
3564
|
(y) => {
|
|
3550
3565
|
if (y) {
|
|
@@ -3554,45 +3569,45 @@ const Ji = {
|
|
|
3554
3569
|
c.metalness = 0, c.roughness = 0.5, c.opacity = 1, p.value = !1;
|
|
3555
3570
|
},
|
|
3556
3571
|
{ immediate: !0 }
|
|
3557
|
-
), (y, d) => r.transform ? (C(), U("div",
|
|
3572
|
+
), (y, d) => r.transform ? (C(), U("div", oo, [
|
|
3558
3573
|
d[32] || (d[32] = g("h3", null, "属性面板", -1)),
|
|
3559
|
-
g("div",
|
|
3574
|
+
g("div", ro, [
|
|
3560
3575
|
d[15] || (d[15] = g("label", null, "场景物体", -1)),
|
|
3561
|
-
g("div",
|
|
3562
|
-
(C(!0), U(
|
|
3563
|
-
key:
|
|
3564
|
-
node:
|
|
3576
|
+
g("div", ao, [
|
|
3577
|
+
(C(!0), U(rn, null, an(r.treeData, (b) => (C(), ke(so, {
|
|
3578
|
+
key: b.uuid,
|
|
3579
|
+
node: b,
|
|
3565
3580
|
"selected-object": r.selectedObject,
|
|
3566
3581
|
version: o.value,
|
|
3567
3582
|
onSelect: d[0] || (d[0] = (x) => s("treeSelect", x)),
|
|
3568
3583
|
onDelete: u
|
|
3569
3584
|
}, null, 8, ["node", "selected-object", "version"]))), 128)),
|
|
3570
|
-
r.treeData.length === 0 ? (C(), U("div",
|
|
3585
|
+
r.treeData.length === 0 ? (C(), U("div", lo, "暂无物体")) : ae("", !0)
|
|
3571
3586
|
])
|
|
3572
3587
|
]),
|
|
3573
3588
|
d[33] || (d[33] = g("div", { class: "property-group" }, [
|
|
3574
3589
|
g("label", null, "全局属性"),
|
|
3575
3590
|
g("div", { class: "row" })
|
|
3576
3591
|
], -1)),
|
|
3577
|
-
r.selectedObject ? (C(), U("div",
|
|
3592
|
+
r.selectedObject ? (C(), U("div", co, [
|
|
3578
3593
|
g("button", {
|
|
3579
|
-
class:
|
|
3580
|
-
onClick: d[1] || (d[1] = (
|
|
3594
|
+
class: Ge(["tab-btn", { active: i.value === "transform" }]),
|
|
3595
|
+
onClick: d[1] || (d[1] = (b) => i.value = "transform")
|
|
3581
3596
|
}, " 🔄 变换 ", 2),
|
|
3582
3597
|
g("button", {
|
|
3583
|
-
class:
|
|
3584
|
-
onClick: d[2] || (d[2] = (
|
|
3598
|
+
class: Ge(["tab-btn", { active: i.value === "info" }]),
|
|
3599
|
+
onClick: d[2] || (d[2] = (b) => i.value = "info")
|
|
3585
3600
|
}, " ℹ️ 信息 ", 2)
|
|
3586
3601
|
])) : ae("", !0),
|
|
3587
|
-
r.selectedObject ? (C(), U("div",
|
|
3602
|
+
r.selectedObject ? (C(), U("div", ho, [
|
|
3588
3603
|
N(g("div", null, [
|
|
3589
|
-
g("div",
|
|
3604
|
+
g("div", uo, [
|
|
3590
3605
|
d[19] || (d[19] = g("label", null, "位置", -1)),
|
|
3591
|
-
g("div",
|
|
3606
|
+
g("div", po, [
|
|
3592
3607
|
d[16] || (d[16] = g("span", null, "X:", -1)),
|
|
3593
3608
|
N(g("input", {
|
|
3594
3609
|
type: "number",
|
|
3595
|
-
"onUpdate:modelValue": d[3] || (d[3] = (
|
|
3610
|
+
"onUpdate:modelValue": d[3] || (d[3] = (b) => r.transform.position.x = b),
|
|
3596
3611
|
step: "0.01",
|
|
3597
3612
|
onInput: n
|
|
3598
3613
|
}, null, 544), [
|
|
@@ -3606,7 +3621,7 @@ const Ji = {
|
|
|
3606
3621
|
d[17] || (d[17] = g("span", null, "Y:", -1)),
|
|
3607
3622
|
N(g("input", {
|
|
3608
3623
|
type: "number",
|
|
3609
|
-
"onUpdate:modelValue": d[4] || (d[4] = (
|
|
3624
|
+
"onUpdate:modelValue": d[4] || (d[4] = (b) => r.transform.position.y = b),
|
|
3610
3625
|
step: "0.01",
|
|
3611
3626
|
onInput: n
|
|
3612
3627
|
}, null, 544), [
|
|
@@ -3620,7 +3635,7 @@ const Ji = {
|
|
|
3620
3635
|
d[18] || (d[18] = g("span", null, "Z:", -1)),
|
|
3621
3636
|
N(g("input", {
|
|
3622
3637
|
type: "number",
|
|
3623
|
-
"onUpdate:modelValue": d[5] || (d[5] = (
|
|
3638
|
+
"onUpdate:modelValue": d[5] || (d[5] = (b) => r.transform.position.z = b),
|
|
3624
3639
|
step: "0.01",
|
|
3625
3640
|
onInput: n
|
|
3626
3641
|
}, null, 544), [
|
|
@@ -3633,13 +3648,13 @@ const Ji = {
|
|
|
3633
3648
|
])
|
|
3634
3649
|
])
|
|
3635
3650
|
]),
|
|
3636
|
-
g("div",
|
|
3651
|
+
g("div", fo, [
|
|
3637
3652
|
d[23] || (d[23] = g("label", null, "旋转 (弧度)", -1)),
|
|
3638
|
-
g("div",
|
|
3653
|
+
g("div", mo, [
|
|
3639
3654
|
d[20] || (d[20] = g("span", null, "X:", -1)),
|
|
3640
3655
|
N(g("input", {
|
|
3641
3656
|
type: "number",
|
|
3642
|
-
"onUpdate:modelValue": d[6] || (d[6] = (
|
|
3657
|
+
"onUpdate:modelValue": d[6] || (d[6] = (b) => r.transform.rotation.x = b),
|
|
3643
3658
|
step: "0.01",
|
|
3644
3659
|
onInput: n
|
|
3645
3660
|
}, null, 544), [
|
|
@@ -3653,7 +3668,7 @@ const Ji = {
|
|
|
3653
3668
|
d[21] || (d[21] = g("span", null, "Y:", -1)),
|
|
3654
3669
|
N(g("input", {
|
|
3655
3670
|
type: "number",
|
|
3656
|
-
"onUpdate:modelValue": d[7] || (d[7] = (
|
|
3671
|
+
"onUpdate:modelValue": d[7] || (d[7] = (b) => r.transform.rotation.y = b),
|
|
3657
3672
|
step: "0.01",
|
|
3658
3673
|
onInput: n
|
|
3659
3674
|
}, null, 544), [
|
|
@@ -3667,7 +3682,7 @@ const Ji = {
|
|
|
3667
3682
|
d[22] || (d[22] = g("span", null, "Z:", -1)),
|
|
3668
3683
|
N(g("input", {
|
|
3669
3684
|
type: "number",
|
|
3670
|
-
"onUpdate:modelValue": d[8] || (d[8] = (
|
|
3685
|
+
"onUpdate:modelValue": d[8] || (d[8] = (b) => r.transform.rotation.z = b),
|
|
3671
3686
|
step: "0.01",
|
|
3672
3687
|
onInput: n
|
|
3673
3688
|
}, null, 544), [
|
|
@@ -3680,13 +3695,13 @@ const Ji = {
|
|
|
3680
3695
|
])
|
|
3681
3696
|
])
|
|
3682
3697
|
]),
|
|
3683
|
-
g("div",
|
|
3698
|
+
g("div", go, [
|
|
3684
3699
|
d[27] || (d[27] = g("label", null, "缩放", -1)),
|
|
3685
|
-
g("div",
|
|
3700
|
+
g("div", yo, [
|
|
3686
3701
|
d[24] || (d[24] = g("span", null, "X:", -1)),
|
|
3687
3702
|
N(g("input", {
|
|
3688
3703
|
type: "number",
|
|
3689
|
-
"onUpdate:modelValue": d[9] || (d[9] = (
|
|
3704
|
+
"onUpdate:modelValue": d[9] || (d[9] = (b) => r.transform.scale.x = b),
|
|
3690
3705
|
step: "0.01",
|
|
3691
3706
|
onInput: n
|
|
3692
3707
|
}, null, 544), [
|
|
@@ -3700,7 +3715,7 @@ const Ji = {
|
|
|
3700
3715
|
d[25] || (d[25] = g("span", null, "Y:", -1)),
|
|
3701
3716
|
N(g("input", {
|
|
3702
3717
|
type: "number",
|
|
3703
|
-
"onUpdate:modelValue": d[10] || (d[10] = (
|
|
3718
|
+
"onUpdate:modelValue": d[10] || (d[10] = (b) => r.transform.scale.y = b),
|
|
3704
3719
|
step: "0.01",
|
|
3705
3720
|
onInput: n
|
|
3706
3721
|
}, null, 544), [
|
|
@@ -3714,7 +3729,7 @@ const Ji = {
|
|
|
3714
3729
|
d[26] || (d[26] = g("span", null, "Z:", -1)),
|
|
3715
3730
|
N(g("input", {
|
|
3716
3731
|
type: "number",
|
|
3717
|
-
"onUpdate:modelValue": d[11] || (d[11] = (
|
|
3732
|
+
"onUpdate:modelValue": d[11] || (d[11] = (b) => r.transform.scale.z = b),
|
|
3718
3733
|
step: "0.01",
|
|
3719
3734
|
onInput: n
|
|
3720
3735
|
}, null, 544), [
|
|
@@ -3727,16 +3742,16 @@ const Ji = {
|
|
|
3727
3742
|
])
|
|
3728
3743
|
])
|
|
3729
3744
|
]),
|
|
3730
|
-
r.selectedObject ? (C(), U("div",
|
|
3745
|
+
r.selectedObject ? (C(), U("div", _o, [
|
|
3731
3746
|
d[31] || (d[31] = g("label", null, "材质", -1)),
|
|
3732
|
-
g("div",
|
|
3747
|
+
g("div", bo, [
|
|
3733
3748
|
d[28] || (d[28] = g("span", { class: "slider-label" }, "金属度", -1)),
|
|
3734
3749
|
N(g("input", {
|
|
3735
3750
|
type: "range",
|
|
3736
3751
|
min: "0",
|
|
3737
3752
|
max: "1",
|
|
3738
3753
|
step: "0.01",
|
|
3739
|
-
"onUpdate:modelValue": d[12] || (d[12] = (
|
|
3754
|
+
"onUpdate:modelValue": d[12] || (d[12] = (b) => c.metalness = b),
|
|
3740
3755
|
onInput: f
|
|
3741
3756
|
}, null, 544), [
|
|
3742
3757
|
[
|
|
@@ -3746,16 +3761,16 @@ const Ji = {
|
|
|
3746
3761
|
{ number: !0 }
|
|
3747
3762
|
]
|
|
3748
3763
|
]),
|
|
3749
|
-
g("span",
|
|
3764
|
+
g("span", wo, Ee(c.metalness.toFixed(2)), 1)
|
|
3750
3765
|
]),
|
|
3751
|
-
g("div",
|
|
3766
|
+
g("div", To, [
|
|
3752
3767
|
d[29] || (d[29] = g("span", { class: "slider-label" }, "粗糙度", -1)),
|
|
3753
3768
|
N(g("input", {
|
|
3754
3769
|
type: "range",
|
|
3755
3770
|
min: "0",
|
|
3756
3771
|
max: "1",
|
|
3757
3772
|
step: "0.01",
|
|
3758
|
-
"onUpdate:modelValue": d[13] || (d[13] = (
|
|
3773
|
+
"onUpdate:modelValue": d[13] || (d[13] = (b) => c.roughness = b),
|
|
3759
3774
|
onInput: f
|
|
3760
3775
|
}, null, 544), [
|
|
3761
3776
|
[
|
|
@@ -3765,16 +3780,16 @@ const Ji = {
|
|
|
3765
3780
|
{ number: !0 }
|
|
3766
3781
|
]
|
|
3767
3782
|
]),
|
|
3768
|
-
g("span",
|
|
3783
|
+
g("span", xo, Ee(c.roughness.toFixed(2)), 1)
|
|
3769
3784
|
]),
|
|
3770
|
-
g("div",
|
|
3785
|
+
g("div", Mo, [
|
|
3771
3786
|
d[30] || (d[30] = g("span", { class: "slider-label" }, "透明度", -1)),
|
|
3772
3787
|
N(g("input", {
|
|
3773
3788
|
type: "range",
|
|
3774
3789
|
min: "0",
|
|
3775
3790
|
max: "1",
|
|
3776
3791
|
step: "0.01",
|
|
3777
|
-
"onUpdate:modelValue": d[14] || (d[14] = (
|
|
3792
|
+
"onUpdate:modelValue": d[14] || (d[14] = (b) => c.opacity = b),
|
|
3778
3793
|
onInput: f
|
|
3779
3794
|
}, null, 544), [
|
|
3780
3795
|
[
|
|
@@ -3784,19 +3799,19 @@ const Ji = {
|
|
|
3784
3799
|
{ number: !0 }
|
|
3785
3800
|
]
|
|
3786
3801
|
]),
|
|
3787
|
-
g("span",
|
|
3802
|
+
g("span", Eo, Ee(c.opacity.toFixed(2)), 1)
|
|
3788
3803
|
]),
|
|
3789
|
-
p.value ? ae("", !0) : (C(), U("div",
|
|
3804
|
+
p.value ? ae("", !0) : (C(), U("div", vo, " ⚠️ 当前材质不支持金属度/粗糙度(仅支持 Standard/Phong) "))
|
|
3790
3805
|
])) : ae("", !0)
|
|
3791
3806
|
], 512), [
|
|
3792
3807
|
[ue, i.value === "transform"]
|
|
3793
3808
|
])
|
|
3794
3809
|
])) : ae("", !0)
|
|
3795
|
-
])) : (C(), U("div",
|
|
3810
|
+
])) : (C(), U("div", So, [...d[34] || (d[34] = [
|
|
3796
3811
|
g("p", null, "未选中任何模型", -1)
|
|
3797
3812
|
])]));
|
|
3798
3813
|
}
|
|
3799
|
-
}),
|
|
3814
|
+
}), Ro = /* @__PURE__ */ Ke(Ao, [["__scopeId", "data-v-d75c643f"]]), Po = { class: "top-bar" }, Lo = { class: "left-section" }, Io = { class: "dropdown-menu" }, Oo = { class: "dropdown-menu sub-menu" }, Co = { class: "dropdown-menu" }, Do = { class: "dropdown-menu sub-menu" }, No = { class: "dropdown-menu" }, ko = { class: "dropdown-menu" }, jo = { class: "dropdown-menu" }, Fo = /* @__PURE__ */ Be({
|
|
3800
3815
|
__name: "TopBar",
|
|
3801
3816
|
emits: ["addModel", "importModel"],
|
|
3802
3817
|
setup(r, { emit: e }) {
|
|
@@ -3804,29 +3819,29 @@ const Ji = {
|
|
|
3804
3819
|
var $;
|
|
3805
3820
|
return ($ = u.value) == null ? void 0 : $.click();
|
|
3806
3821
|
}, p = ($) => {
|
|
3807
|
-
const
|
|
3808
|
-
|
|
3809
|
-
}, m = () => console.log("新建项目"),
|
|
3810
|
-
return ($,
|
|
3811
|
-
g("div",
|
|
3822
|
+
const M = $.target;
|
|
3823
|
+
M.files && M.files.length > 0 && (h("importModel", M.files[0]), M.value = "");
|
|
3824
|
+
}, m = () => console.log("新建项目"), w = () => console.log("保存场景"), f = () => console.log("导出模型"), y = () => console.log("撤销"), d = () => console.log("重做"), b = () => console.log("复制物体"), x = () => console.log("删除物体"), S = () => console.log("重置相机"), R = () => console.log("切换网格"), v = () => console.log("打开帮助"), I = () => console.log("关于编辑器"), ie = () => console.log("打开项目"), ee = () => console.log("打开模型"), me = () => console.log("打开场景");
|
|
3825
|
+
return ($, M) => (C(), U("div", Po, [
|
|
3826
|
+
g("div", Lo, [
|
|
3812
3827
|
g("div", {
|
|
3813
3828
|
class: "dropdown-wrapper",
|
|
3814
|
-
onMouseenter:
|
|
3815
|
-
onMouseleave:
|
|
3829
|
+
onMouseenter: M[2] || (M[2] = (j) => t.value = !0),
|
|
3830
|
+
onMouseleave: M[3] || (M[3] = (j) => t.value = !1)
|
|
3816
3831
|
}, [
|
|
3817
|
-
|
|
3818
|
-
N(g("div",
|
|
3832
|
+
M[17] || (M[17] = g("button", { class: "menu-btn" }, "文件", -1)),
|
|
3833
|
+
N(g("div", Io, [
|
|
3819
3834
|
g("div", {
|
|
3820
3835
|
class: "menu-item",
|
|
3821
3836
|
onClick: m
|
|
3822
3837
|
}, "新建"),
|
|
3823
3838
|
g("div", {
|
|
3824
3839
|
class: "menu-item dropdown-wrapper sub-trigger",
|
|
3825
|
-
onMouseenter:
|
|
3826
|
-
onMouseleave:
|
|
3840
|
+
onMouseenter: M[0] || (M[0] = (j) => a.value = !0),
|
|
3841
|
+
onMouseleave: M[1] || (M[1] = (j) => a.value = !1)
|
|
3827
3842
|
}, [
|
|
3828
|
-
|
|
3829
|
-
N(g("div",
|
|
3843
|
+
M[16] || (M[16] = g("span", null, "打开", -1)),
|
|
3844
|
+
N(g("div", Oo, [
|
|
3830
3845
|
g("div", {
|
|
3831
3846
|
class: "menu-item",
|
|
3832
3847
|
onClick: ie
|
|
@@ -3837,7 +3852,7 @@ const Ji = {
|
|
|
3837
3852
|
}, "打开模型"),
|
|
3838
3853
|
g("div", {
|
|
3839
3854
|
class: "menu-item",
|
|
3840
|
-
onClick:
|
|
3855
|
+
onClick: me
|
|
3841
3856
|
}, "打开场景")
|
|
3842
3857
|
], 512), [
|
|
3843
3858
|
[ue, a.value]
|
|
@@ -3845,7 +3860,7 @@ const Ji = {
|
|
|
3845
3860
|
], 32),
|
|
3846
3861
|
g("div", {
|
|
3847
3862
|
class: "menu-item",
|
|
3848
|
-
onClick:
|
|
3863
|
+
onClick: w
|
|
3849
3864
|
}, "保存"),
|
|
3850
3865
|
g("div", {
|
|
3851
3866
|
class: "menu-item",
|
|
@@ -3857,29 +3872,29 @@ const Ji = {
|
|
|
3857
3872
|
], 32),
|
|
3858
3873
|
g("div", {
|
|
3859
3874
|
class: "dropdown-wrapper",
|
|
3860
|
-
onMouseenter:
|
|
3861
|
-
onMouseleave:
|
|
3875
|
+
onMouseenter: M[8] || (M[8] = (j) => o.value = !0),
|
|
3876
|
+
onMouseleave: M[9] || (M[9] = (j) => o.value = !1)
|
|
3862
3877
|
}, [
|
|
3863
|
-
|
|
3864
|
-
N(g("div",
|
|
3878
|
+
M[19] || (M[19] = g("button", { class: "menu-btn" }, "添加", -1)),
|
|
3879
|
+
N(g("div", Co, [
|
|
3865
3880
|
g("div", {
|
|
3866
3881
|
class: "menu-item",
|
|
3867
3882
|
onClick: y
|
|
3868
3883
|
}, "组"),
|
|
3869
3884
|
g("div", {
|
|
3870
3885
|
class: "menu-item dropdown-wrapper sub-trigger",
|
|
3871
|
-
onMouseenter:
|
|
3872
|
-
onMouseleave:
|
|
3886
|
+
onMouseenter: M[6] || (M[6] = (j) => l.value = !0),
|
|
3887
|
+
onMouseleave: M[7] || (M[7] = (j) => l.value = !1)
|
|
3873
3888
|
}, [
|
|
3874
|
-
|
|
3875
|
-
N(g("div",
|
|
3889
|
+
M[18] || (M[18] = g("span", null, "网格", -1)),
|
|
3890
|
+
N(g("div", Do, [
|
|
3876
3891
|
g("div", {
|
|
3877
3892
|
class: "menu-item",
|
|
3878
|
-
onClick:
|
|
3893
|
+
onClick: M[4] || (M[4] = (j) => h("addModel", "box"))
|
|
3879
3894
|
}, " 正方体 "),
|
|
3880
3895
|
g("div", {
|
|
3881
3896
|
class: "menu-item",
|
|
3882
|
-
onClick:
|
|
3897
|
+
onClick: M[5] || (M[5] = (j) => h("addModel", "sphere"))
|
|
3883
3898
|
}, " 球体 "),
|
|
3884
3899
|
g("div", {
|
|
3885
3900
|
class: "menu-item",
|
|
@@ -3891,7 +3906,7 @@ const Ji = {
|
|
|
3891
3906
|
], 32),
|
|
3892
3907
|
g("div", {
|
|
3893
3908
|
class: "menu-item",
|
|
3894
|
-
onClick:
|
|
3909
|
+
onClick: b
|
|
3895
3910
|
}, "光源"),
|
|
3896
3911
|
g("div", {
|
|
3897
3912
|
class: "menu-item",
|
|
@@ -3903,11 +3918,11 @@ const Ji = {
|
|
|
3903
3918
|
], 32),
|
|
3904
3919
|
g("div", {
|
|
3905
3920
|
class: "dropdown-wrapper",
|
|
3906
|
-
onMouseenter:
|
|
3907
|
-
onMouseleave:
|
|
3921
|
+
onMouseenter: M[10] || (M[10] = (j) => s.value = !0),
|
|
3922
|
+
onMouseleave: M[11] || (M[11] = (j) => s.value = !1)
|
|
3908
3923
|
}, [
|
|
3909
|
-
|
|
3910
|
-
N(g("div",
|
|
3924
|
+
M[20] || (M[20] = g("button", { class: "menu-btn" }, "编辑", -1)),
|
|
3925
|
+
N(g("div", No, [
|
|
3911
3926
|
g("div", {
|
|
3912
3927
|
class: "menu-item",
|
|
3913
3928
|
onClick: y
|
|
@@ -3918,7 +3933,7 @@ const Ji = {
|
|
|
3918
3933
|
}, "重做"),
|
|
3919
3934
|
g("div", {
|
|
3920
3935
|
class: "menu-item",
|
|
3921
|
-
onClick:
|
|
3936
|
+
onClick: b
|
|
3922
3937
|
}, "复制"),
|
|
3923
3938
|
g("div", {
|
|
3924
3939
|
class: "menu-item",
|
|
@@ -3930,11 +3945,11 @@ const Ji = {
|
|
|
3930
3945
|
], 32),
|
|
3931
3946
|
g("div", {
|
|
3932
3947
|
class: "dropdown-wrapper",
|
|
3933
|
-
onMouseenter:
|
|
3934
|
-
onMouseleave:
|
|
3948
|
+
onMouseenter: M[12] || (M[12] = (j) => n.value = !0),
|
|
3949
|
+
onMouseleave: M[13] || (M[13] = (j) => n.value = !1)
|
|
3935
3950
|
}, [
|
|
3936
|
-
|
|
3937
|
-
N(g("div",
|
|
3951
|
+
M[21] || (M[21] = g("button", { class: "menu-btn" }, "视图", -1)),
|
|
3952
|
+
N(g("div", ko, [
|
|
3938
3953
|
g("div", {
|
|
3939
3954
|
class: "menu-item",
|
|
3940
3955
|
onClick: S
|
|
@@ -3949,11 +3964,11 @@ const Ji = {
|
|
|
3949
3964
|
], 32),
|
|
3950
3965
|
g("div", {
|
|
3951
3966
|
class: "dropdown-wrapper",
|
|
3952
|
-
onMouseenter:
|
|
3953
|
-
onMouseleave:
|
|
3967
|
+
onMouseenter: M[14] || (M[14] = (j) => i.value = !0),
|
|
3968
|
+
onMouseleave: M[15] || (M[15] = (j) => i.value = !1)
|
|
3954
3969
|
}, [
|
|
3955
|
-
|
|
3956
|
-
N(g("div",
|
|
3970
|
+
M[22] || (M[22] = g("button", { class: "menu-btn" }, "帮助", -1)),
|
|
3971
|
+
N(g("div", jo, [
|
|
3957
3972
|
g("div", {
|
|
3958
3973
|
class: "menu-item",
|
|
3959
3974
|
onClick: v
|
|
@@ -3967,7 +3982,7 @@ const Ji = {
|
|
|
3967
3982
|
])
|
|
3968
3983
|
], 32)
|
|
3969
3984
|
]),
|
|
3970
|
-
|
|
3985
|
+
M[23] || (M[23] = g("div", { class: "right-section" }, [
|
|
3971
3986
|
g("span", { class: "app-title" }, "3D 模型编辑器")
|
|
3972
3987
|
], -1)),
|
|
3973
3988
|
g("input", {
|
|
@@ -3980,10 +3995,10 @@ const Ji = {
|
|
|
3980
3995
|
}, null, 544)
|
|
3981
3996
|
]));
|
|
3982
3997
|
}
|
|
3983
|
-
}),
|
|
3998
|
+
}), Ho = /* @__PURE__ */ Ke(Fo, [["__scopeId", "data-v-6bb4762f"]]), Uo = { class: "bottom-bar" }, zo = /* @__PURE__ */ Be({
|
|
3984
3999
|
__name: "BottomBar",
|
|
3985
4000
|
setup(r) {
|
|
3986
|
-
return (e, t) => (C(), U("div",
|
|
4001
|
+
return (e, t) => (C(), U("div", Uo, [...t[0] || (t[0] = [
|
|
3987
4002
|
g("div", { class: "status-left" }, [
|
|
3988
4003
|
g("span", null, "就绪")
|
|
3989
4004
|
], -1),
|
|
@@ -3992,14 +4007,14 @@ const Ji = {
|
|
|
3992
4007
|
], -1)
|
|
3993
4008
|
])]));
|
|
3994
4009
|
}
|
|
3995
|
-
}),
|
|
4010
|
+
}), Go = /* @__PURE__ */ Ke(zo, [["__scopeId", "data-v-3427bb27"]]), Xo = { class: "app-layout" }, Yo = /* @__PURE__ */ Be({
|
|
3996
4011
|
__name: "DrawingBoard",
|
|
3997
4012
|
props: {
|
|
3998
4013
|
mode: { default: "edit" },
|
|
3999
4014
|
sceneData: { default: null }
|
|
4000
4015
|
},
|
|
4001
4016
|
setup(r) {
|
|
4002
|
-
const e = r, t = G(null), s =
|
|
4017
|
+
const e = r, t = G(null), s = cn({
|
|
4003
4018
|
position: { x: 0, y: 0, z: 0 },
|
|
4004
4019
|
rotation: { x: 0, y: 0, z: 0 },
|
|
4005
4020
|
scale: { x: 1, y: 1, z: 1 }
|
|
@@ -4016,44 +4031,46 @@ const Ji = {
|
|
|
4016
4031
|
s.rotation.z
|
|
4017
4032
|
), f.scale.set(s.scale.x, s.scale.y, s.scale.z);
|
|
4018
4033
|
};
|
|
4019
|
-
|
|
4034
|
+
ti((f) => {
|
|
4020
4035
|
t.value = f, f && n(f);
|
|
4021
|
-
}),
|
|
4036
|
+
}), ni((f) => {
|
|
4022
4037
|
n(f);
|
|
4023
4038
|
});
|
|
4024
4039
|
const o = () => {
|
|
4025
4040
|
t.value && i(t.value);
|
|
4026
|
-
}, a = (f) =>
|
|
4041
|
+
}, a = (f) => Wi(f), l = async (f) => {
|
|
4027
4042
|
try {
|
|
4028
|
-
await
|
|
4043
|
+
await qi(f);
|
|
4029
4044
|
} catch (y) {
|
|
4030
4045
|
console.error("导入失败:", y), alert("导入失败:" + y.message);
|
|
4031
4046
|
}
|
|
4032
|
-
}, h =
|
|
4033
|
-
|
|
4047
|
+
}, h = On([]);
|
|
4048
|
+
si((f) => {
|
|
4034
4049
|
h.value = f;
|
|
4035
4050
|
});
|
|
4036
4051
|
const u = () => {
|
|
4037
|
-
const f =
|
|
4052
|
+
const f = ii();
|
|
4038
4053
|
f && (h.value = f);
|
|
4039
|
-
}, c = (f) =>
|
|
4040
|
-
return
|
|
4041
|
-
m.value &&
|
|
4042
|
-
}), (
|
|
4043
|
-
|
|
4054
|
+
}, c = (f) => Pt(f), p = (f) => Ws(f.uuid), m = G(null);
|
|
4055
|
+
return Cn(() => {
|
|
4056
|
+
m.value && Us(m.value, e.mode, e.sceneData), u();
|
|
4057
|
+
}), Dn(() => {
|
|
4058
|
+
console.log("endset_three_editor destroy"), ri();
|
|
4059
|
+
}), (f, y) => (C(), U("div", Xo, [
|
|
4060
|
+
r.mode === "edit" ? (C(), ke(Ho, {
|
|
4044
4061
|
key: 0,
|
|
4045
4062
|
onAddModel: a,
|
|
4046
4063
|
onImportModel: l
|
|
4047
4064
|
})) : ae("", !0),
|
|
4048
4065
|
g("div", {
|
|
4049
|
-
class:
|
|
4066
|
+
class: Ge(`editor-container editor-container-mode-${r.mode}`)
|
|
4050
4067
|
}, [
|
|
4051
4068
|
g("div", {
|
|
4052
|
-
class:
|
|
4069
|
+
class: Ge(`canvas canvas-mode-${r.mode}`),
|
|
4053
4070
|
ref_key: "containerRef",
|
|
4054
4071
|
ref: m
|
|
4055
4072
|
}, null, 2),
|
|
4056
|
-
r.mode === "edit" ? (C(), ke(
|
|
4073
|
+
r.mode === "edit" ? (C(), ke(Ro, {
|
|
4057
4074
|
key: 0,
|
|
4058
4075
|
transform: s,
|
|
4059
4076
|
"tree-data": h.value,
|
|
@@ -4063,34 +4080,35 @@ const Ji = {
|
|
|
4063
4080
|
onTreeDelete: p
|
|
4064
4081
|
}, null, 8, ["transform", "tree-data", "selected-object"])) : ae("", !0)
|
|
4065
4082
|
], 2),
|
|
4066
|
-
r.mode === "edit" ? (C(), ke(
|
|
4083
|
+
r.mode === "edit" ? (C(), ke(Go, { key: 1 })) : ae("", !0)
|
|
4067
4084
|
]));
|
|
4068
4085
|
}
|
|
4069
|
-
}),
|
|
4086
|
+
}), $o = /* @__PURE__ */ Ke(Yo, [["__scopeId", "data-v-dd20c794"]]);
|
|
4070
4087
|
export {
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4088
|
+
Go as BottomBar,
|
|
4089
|
+
$o as DrawingBoard,
|
|
4090
|
+
Ro as PropertyPanel,
|
|
4091
|
+
Ho as TopBar,
|
|
4092
|
+
so as TreeItem,
|
|
4093
|
+
Zi as addBox,
|
|
4094
|
+
It as addModel,
|
|
4095
|
+
Wi as addModelByType,
|
|
4096
|
+
Qi as addSphere,
|
|
4097
|
+
ri as destroyEditor,
|
|
4098
|
+
Wo as exportSceneToJSON,
|
|
4099
|
+
Qo as getCamera,
|
|
4100
|
+
qo as getRenderer,
|
|
4101
|
+
Zo as getScene,
|
|
4102
|
+
ii as getSceneObjects,
|
|
4103
|
+
qi as importModelFromFile,
|
|
4104
|
+
Us as initEditor,
|
|
4105
|
+
oi as loadSceneFromJSON,
|
|
4106
|
+
si as onSceneObjectsChangeCallback,
|
|
4107
|
+
qs as removeModel,
|
|
4108
|
+
Ws as removeModelById,
|
|
4109
|
+
Pt as selectObject,
|
|
4110
|
+
ti as setSelectedObjectCallback,
|
|
4111
|
+
ni as setTransformChangeCallback,
|
|
4112
|
+
io as useTreeExpand
|
|
4095
4113
|
};
|
|
4096
4114
|
//# sourceMappingURL=three-editor.es.js.map
|