endset_three_editor 0.2.7 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/three-editor.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import * as
|
|
3
|
-
import { Controls as
|
|
4
|
-
import
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent as Ze, ref as U, inject as Pn, computed as et, watchEffect as Ln, resolveComponent as In, openBlock as k, createElementBlock as z, createElementVNode as g, normalizeClass as Be, withModifiers as Nt, unref as Cn, toDisplayString as ve, Fragment as ln, renderList as cn, createBlock as je, createCommentVNode as le, watch as hn, toRef as Dn, provide as On, reactive as un, withDirectives as O, vModelText as $, vShow as re, shallowRef as kn, onMounted as Nn, onBeforeUnmount as jn } from "vue";
|
|
2
|
+
import * as H from "three";
|
|
3
|
+
import { Controls as dn, Vector3 as S, MOUSE as Se, TOUCH as Me, Quaternion as K, Spherical as jt, Vector2 as Z, Ray as Hn, Plane as Fn, MathUtils as pn, Raycaster as Un, Object3D as Ye, MeshBasicMaterial as we, LineBasicMaterial as He, CylinderGeometry as B, BoxGeometry as G, BufferGeometry as Re, Float32BufferAttribute as pe, Mesh as E, OctahedronGeometry as tt, Line as ae, TorusGeometry as Le, SphereGeometry as zn, Euler as Gn, Matrix4 as Pe, PlaneGeometry as Xn, DoubleSide as fn, Loader as It, FileLoader as Ke, Color as he, SRGBColorSpace as ce, Group as at, Material as Fe, PointsMaterial as Oe, MeshPhongMaterial as Bn, LineSegments as Et, Points as lt, TrianglesDrawMode as Yn, TriangleFanDrawMode as Mt, TriangleStripDrawMode as mn, LoaderUtils as Ue, MeshPhysicalMaterial as oe, LinearSRGBColorSpace as ie, SpotLight as Kn, PointLight as Vn, DirectionalLight as Zn, InstancedMesh as Wn, InstancedBufferAttribute as Qn, TextureLoader as qn, ImageBitmapLoader as $n, BufferAttribute as ze, InterleavedBuffer as gn, InterleavedBufferAttribute as yn, LinearMipmapLinearFilter as _n, NearestMipmapLinearFilter as Jn, LinearMipmapNearestFilter as es, NearestMipmapNearestFilter as ts, LinearFilter as vt, NearestFilter as bn, RepeatWrapping as St, MirroredRepeatWrapping as ns, ClampToEdgeWrapping as ss, MeshStandardMaterial as wn, PropertyBinding as is, SkinnedMesh as os, LineLoop as rs, PerspectiveCamera as as, OrthographicCamera as ls, Skeleton as cs, AnimationClip as hs, Bone as us, InterpolateDiscrete as ds, InterpolateLinear as Tn, Texture as Ht, VectorKeyframeTrack as Ft, NumberKeyframeTrack as Ut, QuaternionKeyframeTrack as zt, ColorManagement as At, FrontSide as ps, Interpolant as fs, Box3 as ms, Sphere as gs } from "three";
|
|
4
|
+
import ys from "@tweenjs/tween.js";
|
|
5
|
+
const Gt = { type: "change" }, Ct = { type: "start" }, xn = { type: "end" }, nt = new Hn(), Xt = new Fn(), _s = Math.cos(70 * pn.DEG2RAD), j = new S(), Y = 2 * Math.PI, L = {
|
|
6
6
|
NONE: -1,
|
|
7
7
|
ROTATE: 0,
|
|
8
8
|
DOLLY: 1,
|
|
@@ -11,8 +11,8 @@ const Ut = { type: "change" }, Rt = { type: "start" }, bn = { type: "end" }, Je
|
|
|
11
11
|
TOUCH_PAN: 4,
|
|
12
12
|
TOUCH_DOLLY_PAN: 5,
|
|
13
13
|
TOUCH_DOLLY_ROTATE: 6
|
|
14
|
-
},
|
|
15
|
-
class
|
|
14
|
+
}, ft = 1e-6;
|
|
15
|
+
class bs extends dn {
|
|
16
16
|
/**
|
|
17
17
|
* Constructs a new controls instance.
|
|
18
18
|
*
|
|
@@ -20,7 +20,7 @@ class _s extends hn {
|
|
|
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 =
|
|
23
|
+
super(e, t), this.state = L.NONE, this.target = new S(), this.cursor = new S(), 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: Se.ROTATE, MIDDLE: Se.DOLLY, RIGHT: Se.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 S(), this._lastQuaternion = new K(), this._lastTargetPosition = new S(), this._quat = new K().setFromUnitVectors(e.up, new S(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new jt(), this._sphericalDelta = new jt(), this._scale = 1, this._panOffset = new S(), this._rotateStart = new Z(), this._rotateEnd = new Z(), this._rotateDelta = new Z(), this._panStart = new Z(), this._panEnd = new Z(), this._panDelta = new Z(), this._dollyStart = new Z(), this._dollyEnd = new Z(), this._dollyDelta = new Z(), this._dollyDirection = new S(), this._mouse = new Z(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = Ts.bind(this), this._onPointerDown = ws.bind(this), this._onPointerUp = xs.bind(this), this._onContextMenu = Ps.bind(this), this._onMouseWheel = vs.bind(this), this._onKeyDown = Ss.bind(this), this._onTouchStart = As.bind(this), this._onTouchMove = Rs.bind(this), this._onMouseDown = Es.bind(this), this._onMouseMove = Ms.bind(this), this._interceptControlDown = Ls.bind(this), this._interceptControlUp = Is.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 _s extends hn {
|
|
|
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(Gt), this.update(), this.state = L.NONE;
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
99
99
|
* Programmatically pan the camera.
|
|
@@ -138,9 +138,9 @@ class _s extends hn {
|
|
|
138
138
|
}
|
|
139
139
|
update(e = null) {
|
|
140
140
|
const t = this.object.position;
|
|
141
|
-
|
|
141
|
+
j.copy(t).sub(this.target), j.applyQuaternion(this._quat), this._spherical.setFromVector3(j), this.autoRotate && this.state === L.NONE && this._rotateLeft(this._getAutoRotationAngle(e)), this.enableDamping ? (this._spherical.theta += this._sphericalDelta.theta * this.dampingFactor, this._spherical.phi += this._sphericalDelta.phi * this.dampingFactor) : (this._spherical.theta += this._sphericalDelta.theta, this._spherical.phi += this._sphericalDelta.phi);
|
|
142
142
|
let s = this.minAzimuthAngle, n = this.maxAzimuthAngle;
|
|
143
|
-
isFinite(s) && isFinite(n) && (s < -Math.PI ? s +=
|
|
143
|
+
isFinite(s) && isFinite(n) && (s < -Math.PI ? s += Y : s > Math.PI && (s -= Y), n < -Math.PI ? n += Y : n > Math.PI && (n -= Y), s <= n ? this._spherical.theta = Math.max(s, Math.min(n, this._spherical.theta)) : this._spherical.theta = this._spherical.theta > (s + n) / 2 ? Math.max(s, this._spherical.theta) : Math.min(n, this._spherical.theta)), this._spherical.phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, this._spherical.phi)), this._spherical.makeSafe(), this.enableDamping === !0 ? this.target.addScaledVector(this._panOffset, this.dampingFactor) : this.target.add(this._panOffset), this.target.sub(this.cursor), this.target.clampLength(this.minTargetRadius, this.maxTargetRadius), this.target.add(this.cursor);
|
|
144
144
|
let i = !1;
|
|
145
145
|
if (this.zoomToCursor && this._performCursorZoom || this.object.isOrthographicCamera)
|
|
146
146
|
this._spherical.radius = this._clampDistance(this._spherical.radius);
|
|
@@ -148,31 +148,31 @@ class _s extends hn {
|
|
|
148
148
|
const o = this._spherical.radius;
|
|
149
149
|
this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale), i = o != this._spherical.radius;
|
|
150
150
|
}
|
|
151
|
-
if (
|
|
151
|
+
if (j.setFromSpherical(this._spherical), j.applyQuaternion(this._quatInverse), t.copy(this.target).add(j), this.object.lookAt(this.target), this.enableDamping === !0 ? (this._sphericalDelta.theta *= 1 - this.dampingFactor, this._sphericalDelta.phi *= 1 - this.dampingFactor, this._panOffset.multiplyScalar(1 - this.dampingFactor)) : (this._sphericalDelta.set(0, 0, 0), this._panOffset.set(0, 0, 0)), this.zoomToCursor && this._performCursorZoom) {
|
|
152
152
|
let o = null;
|
|
153
153
|
if (this.object.isPerspectiveCamera) {
|
|
154
|
-
const a =
|
|
154
|
+
const a = j.length();
|
|
155
155
|
o = this._clampDistance(a * this._scale);
|
|
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 S(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
|
|
164
|
-
|
|
163
|
+
const c = new S(this._mouse.x, this._mouse.y, 0);
|
|
164
|
+
c.unproject(this.object), this.object.position.sub(c).add(a), this.object.updateMatrixWorld(), o = j.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) : (nt.origin.copy(this.object.position), nt.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(nt.direction)) < _s ? this.object.lookAt(this.target) : (Xt.setFromNormalAndCoplanarPoint(this.object.up, this.target), nt.intersectPlane(Xt, 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) > ft || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > ft || this._lastTargetPosition.distanceToSquared(this.target) > ft ? (this.dispatchEvent(Gt), 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
|
-
return e !== null ?
|
|
175
|
+
return e !== null ? Y / 60 * this.autoRotateSpeed * e : Y / 60 / 60 * this.autoRotateSpeed;
|
|
176
176
|
}
|
|
177
177
|
_getZoomScale(e) {
|
|
178
178
|
const t = Math.abs(e * 0.01);
|
|
@@ -185,18 +185,18 @@ class _s extends hn {
|
|
|
185
185
|
this._sphericalDelta.phi -= e;
|
|
186
186
|
}
|
|
187
187
|
_panLeft(e, t) {
|
|
188
|
-
|
|
188
|
+
j.setFromMatrixColumn(t, 0), j.multiplyScalar(-e), this._panOffset.add(j);
|
|
189
189
|
}
|
|
190
190
|
_panUp(e, t) {
|
|
191
|
-
this.screenSpacePanning === !0 ?
|
|
191
|
+
this.screenSpacePanning === !0 ? j.setFromMatrixColumn(t, 1) : (j.setFromMatrixColumn(t, 0), j.crossVectors(this.object.up, j)), j.multiplyScalar(e), this._panOffset.add(j);
|
|
192
192
|
}
|
|
193
193
|
// deltaX and deltaY are in pixels; right and down are positive
|
|
194
194
|
_pan(e, t) {
|
|
195
195
|
const s = this.domElement;
|
|
196
196
|
if (this.object.isPerspectiveCamera) {
|
|
197
197
|
const n = this.object.position;
|
|
198
|
-
|
|
199
|
-
let i =
|
|
198
|
+
j.copy(n).sub(this.target);
|
|
199
|
+
let i = j.length();
|
|
200
200
|
i *= Math.tan(this.object.fov / 2 * Math.PI / 180), this._panLeft(2 * e * i / s.clientHeight, this.object.matrix), this._panUp(2 * t * i / s.clientHeight, this.object.matrix);
|
|
201
201
|
} else this.object.isOrthographicCamera ? (this._panLeft(e * (this.object.right - this.object.left) / this.object.zoom / s.clientWidth, this.object.matrix), this._panUp(t * (this.object.top - this.object.bottom) / this.object.zoom / s.clientHeight, this.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), this.enablePan = !1);
|
|
202
202
|
}
|
|
@@ -231,7 +231,7 @@ class _s extends hn {
|
|
|
231
231
|
_handleMouseMoveRotate(e) {
|
|
232
232
|
this._rotateEnd.set(e.clientX, e.clientY), this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
|
|
233
233
|
const t = this.domElement;
|
|
234
|
-
this._rotateLeft(
|
|
234
|
+
this._rotateLeft(Y * this._rotateDelta.x / t.clientHeight), this._rotateUp(Y * this._rotateDelta.y / t.clientHeight), this._rotateStart.copy(this._rotateEnd), this.update();
|
|
235
235
|
}
|
|
236
236
|
_handleMouseMoveDolly(e) {
|
|
237
237
|
this._dollyEnd.set(e.clientX, e.clientY), this._dollyDelta.subVectors(this._dollyEnd, this._dollyStart), this._dollyDelta.y > 0 ? this._dollyOut(this._getZoomScale(this._dollyDelta.y)) : this._dollyDelta.y < 0 && this._dollyIn(this._getZoomScale(this._dollyDelta.y)), this._dollyStart.copy(this._dollyEnd), this.update();
|
|
@@ -246,16 +246,16 @@ class _s extends hn {
|
|
|
246
246
|
let t = !1;
|
|
247
247
|
switch (e.code) {
|
|
248
248
|
case this.keys.UP:
|
|
249
|
-
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(
|
|
249
|
+
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(Y * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, this.keyPanSpeed), t = !0;
|
|
250
250
|
break;
|
|
251
251
|
case this.keys.BOTTOM:
|
|
252
|
-
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(-
|
|
252
|
+
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(-Y * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, -this.keyPanSpeed), t = !0;
|
|
253
253
|
break;
|
|
254
254
|
case this.keys.LEFT:
|
|
255
|
-
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(
|
|
255
|
+
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(Y * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(this.keyPanSpeed, 0), t = !0;
|
|
256
256
|
break;
|
|
257
257
|
case this.keys.RIGHT:
|
|
258
|
-
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(-
|
|
258
|
+
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(-Y * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(-this.keyPanSpeed, 0), t = !0;
|
|
259
259
|
break;
|
|
260
260
|
}
|
|
261
261
|
t && (e.preventDefault(), this.update());
|
|
@@ -295,7 +295,7 @@ class _s extends hn {
|
|
|
295
295
|
}
|
|
296
296
|
this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
|
|
297
297
|
const t = this.domElement;
|
|
298
|
-
this._rotateLeft(
|
|
298
|
+
this._rotateLeft(Y * this._rotateDelta.x / t.clientHeight), this._rotateUp(Y * this._rotateDelta.y / t.clientHeight), this._rotateStart.copy(this._rotateEnd);
|
|
299
299
|
}
|
|
300
300
|
_handleTouchMovePan(e) {
|
|
301
301
|
if (this._pointers.length === 1)
|
|
@@ -337,7 +337,7 @@ class _s extends hn {
|
|
|
337
337
|
}
|
|
338
338
|
_trackPointer(e) {
|
|
339
339
|
let t = this._pointerPositions[e.pointerId];
|
|
340
|
-
t === void 0 && (t = new
|
|
340
|
+
t === void 0 && (t = new Z(), this._pointerPositions[e.pointerId] = t), t.set(e.pageX, e.pageY);
|
|
341
341
|
}
|
|
342
342
|
_getSecondPointerPosition(e) {
|
|
343
343
|
const t = e.pointerId === this._pointers[0] ? this._pointers[1] : this._pointers[0];
|
|
@@ -361,16 +361,16 @@ class _s extends hn {
|
|
|
361
361
|
return e.ctrlKey && !this._controlActive && (s.deltaY *= 10), s;
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
|
-
function
|
|
364
|
+
function ws(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 Ts(r) {
|
|
368
368
|
this.enabled !== !1 && (r.pointerType === "touch" ? this._onTouchMove(r) : this._onMouseMove(r));
|
|
369
369
|
}
|
|
370
|
-
function
|
|
370
|
+
function xs(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(xn), this.state = L.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 Ts(r) {
|
|
|
378
378
|
break;
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
|
-
function
|
|
381
|
+
function Es(r) {
|
|
382
382
|
let e;
|
|
383
383
|
switch (r.button) {
|
|
384
384
|
case 0:
|
|
@@ -394,127 +394,127 @@ function xs(r) {
|
|
|
394
394
|
e = -1;
|
|
395
395
|
}
|
|
396
396
|
switch (e) {
|
|
397
|
-
case
|
|
397
|
+
case Se.DOLLY:
|
|
398
398
|
if (this.enableZoom === !1) return;
|
|
399
|
-
this._handleMouseDownDolly(r), this.state =
|
|
399
|
+
this._handleMouseDownDolly(r), this.state = L.DOLLY;
|
|
400
400
|
break;
|
|
401
|
-
case
|
|
401
|
+
case Se.ROTATE:
|
|
402
402
|
if (r.ctrlKey || r.metaKey || r.shiftKey) {
|
|
403
403
|
if (this.enablePan === !1) return;
|
|
404
|
-
this._handleMouseDownPan(r), this.state =
|
|
404
|
+
this._handleMouseDownPan(r), this.state = L.PAN;
|
|
405
405
|
} else {
|
|
406
406
|
if (this.enableRotate === !1) return;
|
|
407
|
-
this._handleMouseDownRotate(r), this.state =
|
|
407
|
+
this._handleMouseDownRotate(r), this.state = L.ROTATE;
|
|
408
408
|
}
|
|
409
409
|
break;
|
|
410
|
-
case
|
|
410
|
+
case Se.PAN:
|
|
411
411
|
if (r.ctrlKey || r.metaKey || r.shiftKey) {
|
|
412
412
|
if (this.enableRotate === !1) return;
|
|
413
|
-
this._handleMouseDownRotate(r), this.state =
|
|
413
|
+
this._handleMouseDownRotate(r), this.state = L.ROTATE;
|
|
414
414
|
} else {
|
|
415
415
|
if (this.enablePan === !1) return;
|
|
416
|
-
this._handleMouseDownPan(r), this.state =
|
|
416
|
+
this._handleMouseDownPan(r), this.state = L.PAN;
|
|
417
417
|
}
|
|
418
418
|
break;
|
|
419
419
|
default:
|
|
420
|
-
this.state =
|
|
420
|
+
this.state = L.NONE;
|
|
421
421
|
}
|
|
422
|
-
this.state !==
|
|
422
|
+
this.state !== L.NONE && this.dispatchEvent(Ct);
|
|
423
423
|
}
|
|
424
424
|
function Ms(r) {
|
|
425
425
|
switch (this.state) {
|
|
426
|
-
case
|
|
426
|
+
case L.ROTATE:
|
|
427
427
|
if (this.enableRotate === !1) return;
|
|
428
428
|
this._handleMouseMoveRotate(r);
|
|
429
429
|
break;
|
|
430
|
-
case
|
|
430
|
+
case L.DOLLY:
|
|
431
431
|
if (this.enableZoom === !1) return;
|
|
432
432
|
this._handleMouseMoveDolly(r);
|
|
433
433
|
break;
|
|
434
|
-
case
|
|
434
|
+
case L.PAN:
|
|
435
435
|
if (this.enablePan === !1) return;
|
|
436
436
|
this._handleMouseMovePan(r);
|
|
437
437
|
break;
|
|
438
438
|
}
|
|
439
439
|
}
|
|
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
|
-
}
|
|
443
440
|
function vs(r) {
|
|
444
|
-
this.enabled
|
|
441
|
+
this.enabled === !1 || this.enableZoom === !1 || this.state !== L.NONE || (r.preventDefault(), this.dispatchEvent(Ct), this._handleMouseWheel(this._customWheelEvent(r)), this.dispatchEvent(xn));
|
|
445
442
|
}
|
|
446
443
|
function Ss(r) {
|
|
444
|
+
this.enabled !== !1 && this._handleKeyDown(r);
|
|
445
|
+
}
|
|
446
|
+
function As(r) {
|
|
447
447
|
switch (this._trackPointer(r), this._pointers.length) {
|
|
448
448
|
case 1:
|
|
449
449
|
switch (this.touches.ONE) {
|
|
450
450
|
case Me.ROTATE:
|
|
451
451
|
if (this.enableRotate === !1) return;
|
|
452
|
-
this._handleTouchStartRotate(r), this.state =
|
|
452
|
+
this._handleTouchStartRotate(r), this.state = L.TOUCH_ROTATE;
|
|
453
453
|
break;
|
|
454
454
|
case Me.PAN:
|
|
455
455
|
if (this.enablePan === !1) return;
|
|
456
|
-
this._handleTouchStartPan(r), this.state =
|
|
456
|
+
this._handleTouchStartPan(r), this.state = L.TOUCH_PAN;
|
|
457
457
|
break;
|
|
458
458
|
default:
|
|
459
|
-
this.state =
|
|
459
|
+
this.state = L.NONE;
|
|
460
460
|
}
|
|
461
461
|
break;
|
|
462
462
|
case 2:
|
|
463
463
|
switch (this.touches.TWO) {
|
|
464
464
|
case Me.DOLLY_PAN:
|
|
465
465
|
if (this.enableZoom === !1 && this.enablePan === !1) return;
|
|
466
|
-
this._handleTouchStartDollyPan(r), this.state =
|
|
466
|
+
this._handleTouchStartDollyPan(r), this.state = L.TOUCH_DOLLY_PAN;
|
|
467
467
|
break;
|
|
468
468
|
case Me.DOLLY_ROTATE:
|
|
469
469
|
if (this.enableZoom === !1 && this.enableRotate === !1) return;
|
|
470
|
-
this._handleTouchStartDollyRotate(r), this.state =
|
|
470
|
+
this._handleTouchStartDollyRotate(r), this.state = L.TOUCH_DOLLY_ROTATE;
|
|
471
471
|
break;
|
|
472
472
|
default:
|
|
473
|
-
this.state =
|
|
473
|
+
this.state = L.NONE;
|
|
474
474
|
}
|
|
475
475
|
break;
|
|
476
476
|
default:
|
|
477
|
-
this.state =
|
|
477
|
+
this.state = L.NONE;
|
|
478
478
|
}
|
|
479
|
-
this.state !==
|
|
479
|
+
this.state !== L.NONE && this.dispatchEvent(Ct);
|
|
480
480
|
}
|
|
481
|
-
function
|
|
481
|
+
function Rs(r) {
|
|
482
482
|
switch (this._trackPointer(r), this.state) {
|
|
483
|
-
case
|
|
483
|
+
case L.TOUCH_ROTATE:
|
|
484
484
|
if (this.enableRotate === !1) return;
|
|
485
485
|
this._handleTouchMoveRotate(r), this.update();
|
|
486
486
|
break;
|
|
487
|
-
case
|
|
487
|
+
case L.TOUCH_PAN:
|
|
488
488
|
if (this.enablePan === !1) return;
|
|
489
489
|
this._handleTouchMovePan(r), this.update();
|
|
490
490
|
break;
|
|
491
|
-
case
|
|
491
|
+
case L.TOUCH_DOLLY_PAN:
|
|
492
492
|
if (this.enableZoom === !1 && this.enablePan === !1) return;
|
|
493
493
|
this._handleTouchMoveDollyPan(r), this.update();
|
|
494
494
|
break;
|
|
495
|
-
case
|
|
495
|
+
case L.TOUCH_DOLLY_ROTATE:
|
|
496
496
|
if (this.enableZoom === !1 && this.enableRotate === !1) return;
|
|
497
497
|
this._handleTouchMoveDollyRotate(r), this.update();
|
|
498
498
|
break;
|
|
499
499
|
default:
|
|
500
|
-
this.state =
|
|
500
|
+
this.state = L.NONE;
|
|
501
501
|
}
|
|
502
502
|
}
|
|
503
|
-
function
|
|
503
|
+
function Ps(r) {
|
|
504
504
|
this.enabled !== !1 && r.preventDefault();
|
|
505
505
|
}
|
|
506
|
-
function
|
|
506
|
+
function Ls(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 Is(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 ye = new Un(), F = new S(), ue = new S(), D = new K(), Bt = {
|
|
513
|
+
X: new S(1, 0, 0),
|
|
514
|
+
Y: new S(0, 1, 0),
|
|
515
|
+
Z: new S(0, 0, 1)
|
|
516
|
+
}, mt = { type: "change" }, Yt = { type: "mouseDown", mode: null }, Kt = { type: "mouseUp", mode: null }, Vt = { type: "objectChange" };
|
|
517
|
+
class Cs extends dn {
|
|
518
518
|
/**
|
|
519
519
|
* Constructs a new controls instance.
|
|
520
520
|
*
|
|
@@ -523,27 +523,27 @@ class Is extends hn {
|
|
|
523
523
|
*/
|
|
524
524
|
constructor(e, t = null) {
|
|
525
525
|
super(void 0, t);
|
|
526
|
-
const s = new
|
|
526
|
+
const s = new Hs(this);
|
|
527
527
|
this._root = s;
|
|
528
528
|
const n = new Fs();
|
|
529
529
|
this._gizmo = n, s.add(n);
|
|
530
|
-
const i = new
|
|
530
|
+
const i = new Us();
|
|
531
531
|
this._plane = i, s.add(i);
|
|
532
532
|
const o = this;
|
|
533
|
-
function a(
|
|
534
|
-
let R =
|
|
535
|
-
Object.defineProperty(o,
|
|
533
|
+
function a(T, M) {
|
|
534
|
+
let R = M;
|
|
535
|
+
Object.defineProperty(o, T, {
|
|
536
536
|
get: function() {
|
|
537
|
-
return R !== void 0 ? R :
|
|
537
|
+
return R !== void 0 ? R : M;
|
|
538
538
|
},
|
|
539
539
|
set: function(v) {
|
|
540
|
-
R !== v && (R = v, i[
|
|
540
|
+
R !== v && (R = v, i[T] = v, n[T] = v, o.dispatchEvent({ type: T + "-changed", value: v }), o.dispatchEvent(mt));
|
|
541
541
|
}
|
|
542
|
-
}), o[
|
|
542
|
+
}), o[T] = M, i[T] = M, n[T] = M;
|
|
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",
|
|
545
|
+
const l = new S(), c = new S(), u = new K(), h = new K(), d = new S(), m = new K(), w = new S(), f = new S(), y = new S(), p = 0, b = new S();
|
|
546
|
+
a("worldPosition", l), a("worldPositionStart", c), a("worldQuaternion", u), a("worldQuaternionStart", h), a("cameraPosition", d), a("cameraQuaternion", m), a("pointStart", w), a("pointEnd", f), a("rotationAxis", y), a("rotationAngle", p), a("eye", b), this._offset = new S(), this._startNorm = new S(), this._endNorm = new S(), this._cameraScale = new S(), this._parentPosition = new S(), this._parentQuaternion = new K(), this._parentQuaternionInv = new K(), this._parentScale = new S(), this._worldScaleStart = new S(), this._worldQuaternionInv = new K(), this._worldScale = new S(), this._positionStart = new S(), this._quaternionStart = new K(), this._scaleStart = new S(), this._getPointer = Ds.bind(this), this._onPointerDown = ks.bind(this), this._onPointerHover = Os.bind(this), this._onPointerMove = Ns.bind(this), this._onPointerUp = js.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,44 +562,44 @@ class Is extends hn {
|
|
|
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 && ye.setFromCamera(e, this.camera);
|
|
566
|
+
const t = gt(this._gizmo.picker[this.mode], ye);
|
|
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 && ye.setFromCamera(e, this.camera);
|
|
572
|
+
const t = gt(this._plane, ye, !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, Yt.mode = this.mode, this.dispatchEvent(Yt);
|
|
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 && ye.setFromCamera(e, this.camera);
|
|
581
|
+
const o = gt(this._plane, ye, !0);
|
|
582
582
|
if (o) {
|
|
583
583
|
if (this.pointEnd.copy(o.point).sub(this.worldPositionStart), s === "translate")
|
|
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(
|
|
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(D.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(F.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(F.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));
|
|
585
585
|
else if (s === "scale") {
|
|
586
586
|
if (t.search("XYZ") !== -1) {
|
|
587
587
|
let a = this.pointEnd.length() / this.pointStart.length();
|
|
588
|
-
this.pointEnd.dot(this.pointStart) < 0 && (a *= -1),
|
|
588
|
+
this.pointEnd.dot(this.pointStart) < 0 && (a *= -1), ue.set(a, a, a);
|
|
589
589
|
} else
|
|
590
|
-
|
|
591
|
-
n.scale.copy(this._scaleStart).multiply(
|
|
590
|
+
F.copy(this.pointStart), ue.copy(this.pointEnd), F.applyQuaternion(this._worldQuaternionInv), ue.applyQuaternion(this._worldQuaternionInv), ue.divide(F), t.search("X") === -1 && (ue.x = 1), t.search("Y") === -1 && (ue.y = 1), t.search("Z") === -1 && (ue.z = 1);
|
|
591
|
+
n.scale.copy(this._scaleStart).multiply(ue), this.scaleSnap && (t.search("X") !== -1 && (n.scale.x = Math.round(n.scale.x / this.scaleSnap) * this.scaleSnap || this.scaleSnap), t.search("Y") !== -1 && (n.scale.y = Math.round(n.scale.y / this.scaleSnap) * this.scaleSnap || this.scaleSnap), t.search("Z") !== -1 && (n.scale.z = Math.round(n.scale.z / this.scaleSnap) * this.scaleSnap || this.scaleSnap));
|
|
592
592
|
} else if (s === "rotate") {
|
|
593
593
|
this._offset.copy(this.pointEnd).sub(this.pointStart);
|
|
594
|
-
const a = 20 / this.worldPosition.distanceTo(
|
|
594
|
+
const a = 20 / this.worldPosition.distanceTo(F.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(
|
|
596
|
+
t === "XYZE" ? (this.rotationAxis.copy(this._offset).cross(this.eye).normalize(), this.rotationAngle = this._offset.dot(F.copy(this.rotationAxis).cross(this.eye)) * a) : (t === "X" || t === "Y" || t === "Z") && (this.rotationAxis.copy(Bt[t]), F.copy(Bt[t]), i === "local" && F.applyQuaternion(this.worldQuaternion), F.cross(this.eye), F.length() === 0 ? l = !0 : this.rotationAngle = this._offset.dot(F.normalize()) * a), (t === "E" || l) && (this.rotationAxis.copy(this.eye), this.rotationAngle = this.pointEnd.angleTo(this.pointStart), this._startNorm.copy(this.pointStart).normalize(), this._endNorm.copy(this.pointEnd).normalize(), this.rotationAngle *= this._endNorm.cross(this._startNorm).dot(this.eye) < 0 ? 1 : -1), this.rotationSnap && (this.rotationAngle = Math.round(this.rotationAngle / this.rotationSnap) * this.rotationSnap), i === "local" && t !== "E" && t !== "XYZE" ? (n.quaternion.copy(this._quaternionStart), n.quaternion.multiply(D.setFromAxisAngle(this.rotationAxis, this.rotationAngle)).normalize()) : (this.rotationAxis.applyQuaternion(this._parentQuaternionInv), n.quaternion.copy(D.setFromAxisAngle(this.rotationAxis, this.rotationAngle)), n.quaternion.multiply(this._quaternionStart).normalize());
|
|
597
597
|
}
|
|
598
|
-
this.dispatchEvent(
|
|
598
|
+
this.dispatchEvent(mt), this.dispatchEvent(Vt);
|
|
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 && (Kt.mode = this.mode, this.dispatchEvent(Kt)), this.dragging = !1, this.axis = null);
|
|
603
603
|
}
|
|
604
604
|
dispose() {
|
|
605
605
|
this.disconnect(), this._root.dispose();
|
|
@@ -625,7 +625,7 @@ class Is extends hn {
|
|
|
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(mt), this.dispatchEvent(Vt), 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 Is extends hn {
|
|
|
634
634
|
* @returns {Raycaster} The internal raycaster.
|
|
635
635
|
*/
|
|
636
636
|
getRaycaster() {
|
|
637
|
-
return
|
|
637
|
+
return ye;
|
|
638
638
|
}
|
|
639
639
|
/**
|
|
640
640
|
* Returns the transformation mode.
|
|
@@ -705,7 +705,7 @@ class Is extends hn {
|
|
|
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 Ds(r) {
|
|
709
709
|
if (this.domElement.ownerDocument.pointerLockElement)
|
|
710
710
|
return {
|
|
711
711
|
x: 0,
|
|
@@ -721,7 +721,7 @@ function Os(r) {
|
|
|
721
721
|
};
|
|
722
722
|
}
|
|
723
723
|
}
|
|
724
|
-
function
|
|
724
|
+
function Os(r) {
|
|
725
725
|
if (this.enabled)
|
|
726
726
|
switch (r.pointerType) {
|
|
727
727
|
case "mouse":
|
|
@@ -730,24 +730,24 @@ function Cs(r) {
|
|
|
730
730
|
break;
|
|
731
731
|
}
|
|
732
732
|
}
|
|
733
|
-
function
|
|
733
|
+
function ks(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
736
|
function Ns(r) {
|
|
737
737
|
this.enabled && this.pointerMove(this._getPointer(r));
|
|
738
738
|
}
|
|
739
|
-
function
|
|
739
|
+
function js(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 gt(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 st = new Gn(), C = new S(0, 1, 0), Zt = new S(0, 0, 0), Wt = new Pe(), it = new K(), ct = new K(), ne = new S(), Qt = new Pe(), ke = new S(1, 0, 0), be = new S(0, 1, 0), Ne = new S(0, 0, 1), ot = new S(), Ie = new S(), Ce = new S();
|
|
750
|
+
class Hs extends Ye {
|
|
751
751
|
constructor(e) {
|
|
752
752
|
super(), this.isTransformControlsRoot = !0, this.controls = e, this.visible = !1;
|
|
753
753
|
}
|
|
@@ -762,16 +762,16 @@ class js extends Xe {
|
|
|
762
762
|
});
|
|
763
763
|
}
|
|
764
764
|
}
|
|
765
|
-
class Fs extends
|
|
765
|
+
class Fs extends Ye {
|
|
766
766
|
constructor() {
|
|
767
767
|
super(), this.isTransformControlsGizmo = !0, this.type = "TransformControlsGizmo";
|
|
768
|
-
const e = new
|
|
768
|
+
const e = new we({
|
|
769
769
|
depthTest: !1,
|
|
770
770
|
depthWrite: !1,
|
|
771
771
|
fog: !1,
|
|
772
772
|
toneMapped: !1,
|
|
773
773
|
transparent: !0
|
|
774
|
-
}), t = new
|
|
774
|
+
}), t = new He({
|
|
775
775
|
depthTest: !1,
|
|
776
776
|
depthWrite: !1,
|
|
777
777
|
fog: !1,
|
|
@@ -789,14 +789,14 @@ class Fs extends Xe {
|
|
|
789
789
|
a.color.setHex(255);
|
|
790
790
|
const l = e.clone();
|
|
791
791
|
l.color.setHex(16711680), l.opacity = 0.5;
|
|
792
|
-
const
|
|
793
|
-
|
|
792
|
+
const c = e.clone();
|
|
793
|
+
c.color.setHex(65280), c.opacity = 0.5;
|
|
794
794
|
const u = e.clone();
|
|
795
795
|
u.color.setHex(255), u.opacity = 0.5;
|
|
796
|
-
const
|
|
797
|
-
|
|
798
|
-
const
|
|
799
|
-
|
|
796
|
+
const h = e.clone();
|
|
797
|
+
h.opacity = 0.25;
|
|
798
|
+
const d = e.clone();
|
|
799
|
+
d.color.setHex(16776960), d.opacity = 0.25;
|
|
800
800
|
const m = e.clone();
|
|
801
801
|
m.color.setHex(16776960);
|
|
802
802
|
const w = e.clone();
|
|
@@ -806,214 +806,214 @@ class Fs extends Xe {
|
|
|
806
806
|
zAxis: a,
|
|
807
807
|
active: m,
|
|
808
808
|
xAxisTransparent: l,
|
|
809
|
-
yAxisTransparent:
|
|
809
|
+
yAxisTransparent: c,
|
|
810
810
|
zAxisTransparent: u,
|
|
811
|
-
activeTransparent:
|
|
811
|
+
activeTransparent: d
|
|
812
812
|
};
|
|
813
|
-
const f = new
|
|
813
|
+
const f = new B(0, 0.04, 0.1, 12);
|
|
814
814
|
f.translate(0, 0.05, 0);
|
|
815
|
-
const y = new
|
|
815
|
+
const y = new G(0.08, 0.08, 0.08);
|
|
816
816
|
y.translate(0, 0.04, 0);
|
|
817
|
-
const
|
|
818
|
-
|
|
819
|
-
const b = new
|
|
817
|
+
const p = new Re();
|
|
818
|
+
p.setAttribute("position", new pe([0, 0, 0, 1, 0, 0], 3));
|
|
819
|
+
const b = new B(75e-4, 75e-4, 0.5, 3);
|
|
820
820
|
b.translate(0, 0.25, 0);
|
|
821
|
-
function
|
|
822
|
-
const
|
|
823
|
-
return
|
|
821
|
+
function T(q, Qe) {
|
|
822
|
+
const te = new Le(q, 75e-4, 3, 64, Qe * Math.PI * 2);
|
|
823
|
+
return te.rotateY(Math.PI / 2), te.rotateX(Math.PI / 2), te;
|
|
824
824
|
}
|
|
825
|
-
function
|
|
826
|
-
const
|
|
827
|
-
return
|
|
825
|
+
function M() {
|
|
826
|
+
const q = new Re();
|
|
827
|
+
return q.setAttribute("position", new pe([0, 0, 0, 1, 1, 1], 3)), q;
|
|
828
828
|
}
|
|
829
829
|
const R = {
|
|
830
830
|
X: [
|
|
831
|
-
[new
|
|
832
|
-
[new
|
|
833
|
-
[new
|
|
831
|
+
[new E(f, i), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
|
|
832
|
+
[new E(f, i), [-0.5, 0, 0], [0, 0, Math.PI / 2]],
|
|
833
|
+
[new E(b, i), [0, 0, 0], [0, 0, -Math.PI / 2]]
|
|
834
834
|
],
|
|
835
835
|
Y: [
|
|
836
|
-
[new
|
|
837
|
-
[new
|
|
838
|
-
[new
|
|
836
|
+
[new E(f, o), [0, 0.5, 0]],
|
|
837
|
+
[new E(f, o), [0, -0.5, 0], [Math.PI, 0, 0]],
|
|
838
|
+
[new E(b, o)]
|
|
839
839
|
],
|
|
840
840
|
Z: [
|
|
841
|
-
[new
|
|
842
|
-
[new
|
|
843
|
-
[new
|
|
841
|
+
[new E(f, a), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
|
|
842
|
+
[new E(f, a), [0, 0, -0.5], [-Math.PI / 2, 0, 0]],
|
|
843
|
+
[new E(b, a), null, [Math.PI / 2, 0, 0]]
|
|
844
844
|
],
|
|
845
845
|
XYZ: [
|
|
846
|
-
[new
|
|
846
|
+
[new E(new tt(0.1, 0), h), [0, 0, 0]]
|
|
847
847
|
],
|
|
848
848
|
XY: [
|
|
849
|
-
[new
|
|
849
|
+
[new E(new G(0.15, 0.15, 0.01), u), [0.15, 0.15, 0]]
|
|
850
850
|
],
|
|
851
851
|
YZ: [
|
|
852
|
-
[new
|
|
852
|
+
[new E(new G(0.15, 0.15, 0.01), l), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
|
|
853
853
|
],
|
|
854
854
|
XZ: [
|
|
855
|
-
[new
|
|
855
|
+
[new E(new G(0.15, 0.15, 0.01), c), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
|
|
856
856
|
]
|
|
857
857
|
}, v = {
|
|
858
858
|
X: [
|
|
859
|
-
[new
|
|
860
|
-
[new
|
|
859
|
+
[new E(new B(0.2, 0, 0.6, 4), s), [0.3, 0, 0], [0, 0, -Math.PI / 2]],
|
|
860
|
+
[new E(new B(0.2, 0, 0.6, 4), s), [-0.3, 0, 0], [0, 0, Math.PI / 2]]
|
|
861
861
|
],
|
|
862
862
|
Y: [
|
|
863
|
-
[new
|
|
864
|
-
[new
|
|
863
|
+
[new E(new B(0.2, 0, 0.6, 4), s), [0, 0.3, 0]],
|
|
864
|
+
[new E(new B(0.2, 0, 0.6, 4), s), [0, -0.3, 0], [0, 0, Math.PI]]
|
|
865
865
|
],
|
|
866
866
|
Z: [
|
|
867
|
-
[new
|
|
868
|
-
[new
|
|
867
|
+
[new E(new B(0.2, 0, 0.6, 4), s), [0, 0, 0.3], [Math.PI / 2, 0, 0]],
|
|
868
|
+
[new E(new B(0.2, 0, 0.6, 4), s), [0, 0, -0.3], [-Math.PI / 2, 0, 0]]
|
|
869
869
|
],
|
|
870
870
|
XYZ: [
|
|
871
|
-
[new
|
|
871
|
+
[new E(new tt(0.2, 0), s)]
|
|
872
872
|
],
|
|
873
873
|
XY: [
|
|
874
|
-
[new
|
|
874
|
+
[new E(new G(0.2, 0.2, 0.01), s), [0.15, 0.15, 0]]
|
|
875
875
|
],
|
|
876
876
|
YZ: [
|
|
877
|
-
[new
|
|
877
|
+
[new E(new G(0.2, 0.2, 0.01), s), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
|
|
878
878
|
],
|
|
879
879
|
XZ: [
|
|
880
|
-
[new
|
|
880
|
+
[new E(new G(0.2, 0.2, 0.01), s), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
|
|
881
881
|
]
|
|
882
882
|
}, I = {
|
|
883
883
|
START: [
|
|
884
|
-
[new
|
|
884
|
+
[new E(new tt(0.01, 2), n), null, null, null, "helper"]
|
|
885
885
|
],
|
|
886
886
|
END: [
|
|
887
|
-
[new
|
|
887
|
+
[new E(new tt(0.01, 2), n), null, null, null, "helper"]
|
|
888
888
|
],
|
|
889
889
|
DELTA: [
|
|
890
|
-
[new
|
|
890
|
+
[new ae(M(), n), null, null, null, "helper"]
|
|
891
891
|
],
|
|
892
892
|
X: [
|
|
893
|
-
[new
|
|
893
|
+
[new ae(p, n), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]
|
|
894
894
|
],
|
|
895
895
|
Y: [
|
|
896
|
-
[new
|
|
896
|
+
[new ae(p, n), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]
|
|
897
897
|
],
|
|
898
898
|
Z: [
|
|
899
|
-
[new
|
|
899
|
+
[new ae(p, n), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]
|
|
900
900
|
]
|
|
901
|
-
},
|
|
901
|
+
}, V = {
|
|
902
902
|
XYZE: [
|
|
903
|
-
[new T(
|
|
903
|
+
[new E(T(0.5, 1), w), null, [0, Math.PI / 2, 0]]
|
|
904
904
|
],
|
|
905
905
|
X: [
|
|
906
|
-
[new T(
|
|
906
|
+
[new E(T(0.5, 0.5), i)]
|
|
907
907
|
],
|
|
908
908
|
Y: [
|
|
909
|
-
[new T(
|
|
909
|
+
[new E(T(0.5, 0.5), o), null, [0, 0, -Math.PI / 2]]
|
|
910
910
|
],
|
|
911
911
|
Z: [
|
|
912
|
-
[new T(
|
|
912
|
+
[new E(T(0.5, 0.5), a), null, [0, Math.PI / 2, 0]]
|
|
913
913
|
],
|
|
914
914
|
E: [
|
|
915
|
-
[new T(
|
|
915
|
+
[new E(T(0.75, 1), d), null, [0, Math.PI / 2, 0]]
|
|
916
916
|
]
|
|
917
|
-
},
|
|
917
|
+
}, W = {
|
|
918
918
|
AXIS: [
|
|
919
|
-
[new
|
|
919
|
+
[new ae(p, n), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]
|
|
920
920
|
]
|
|
921
|
-
},
|
|
921
|
+
}, Q = {
|
|
922
922
|
XYZE: [
|
|
923
|
-
[new
|
|
923
|
+
[new E(new zn(0.25, 10, 8), s)]
|
|
924
924
|
],
|
|
925
925
|
X: [
|
|
926
|
-
[new
|
|
926
|
+
[new E(new Le(0.5, 0.1, 4, 24), s), [0, 0, 0], [0, -Math.PI / 2, -Math.PI / 2]]
|
|
927
927
|
],
|
|
928
928
|
Y: [
|
|
929
|
-
[new
|
|
929
|
+
[new E(new Le(0.5, 0.1, 4, 24), s), [0, 0, 0], [Math.PI / 2, 0, 0]]
|
|
930
930
|
],
|
|
931
931
|
Z: [
|
|
932
|
-
[new
|
|
932
|
+
[new E(new Le(0.5, 0.1, 4, 24), s), [0, 0, 0], [0, 0, -Math.PI / 2]]
|
|
933
933
|
],
|
|
934
934
|
E: [
|
|
935
|
-
[new
|
|
935
|
+
[new E(new Le(0.75, 0.1, 2, 24), s)]
|
|
936
936
|
]
|
|
937
|
-
},
|
|
937
|
+
}, me = {
|
|
938
938
|
X: [
|
|
939
|
-
[new
|
|
940
|
-
[new
|
|
941
|
-
[new
|
|
939
|
+
[new E(y, i), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
|
|
940
|
+
[new E(b, i), [0, 0, 0], [0, 0, -Math.PI / 2]],
|
|
941
|
+
[new E(y, i), [-0.5, 0, 0], [0, 0, Math.PI / 2]]
|
|
942
942
|
],
|
|
943
943
|
Y: [
|
|
944
|
-
[new
|
|
945
|
-
[new
|
|
946
|
-
[new
|
|
944
|
+
[new E(y, o), [0, 0.5, 0]],
|
|
945
|
+
[new E(b, o)],
|
|
946
|
+
[new E(y, o), [0, -0.5, 0], [0, 0, Math.PI]]
|
|
947
947
|
],
|
|
948
948
|
Z: [
|
|
949
|
-
[new
|
|
950
|
-
[new
|
|
951
|
-
[new
|
|
949
|
+
[new E(y, a), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
|
|
950
|
+
[new E(b, a), [0, 0, 0], [Math.PI / 2, 0, 0]],
|
|
951
|
+
[new E(y, a), [0, 0, -0.5], [-Math.PI / 2, 0, 0]]
|
|
952
952
|
],
|
|
953
953
|
XY: [
|
|
954
|
-
[new
|
|
954
|
+
[new E(new G(0.15, 0.15, 0.01), u), [0.15, 0.15, 0]]
|
|
955
955
|
],
|
|
956
956
|
YZ: [
|
|
957
|
-
[new
|
|
957
|
+
[new E(new G(0.15, 0.15, 0.01), l), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
|
|
958
958
|
],
|
|
959
959
|
XZ: [
|
|
960
|
-
[new
|
|
960
|
+
[new E(new G(0.15, 0.15, 0.01), c), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
|
|
961
961
|
],
|
|
962
962
|
XYZ: [
|
|
963
|
-
[new
|
|
963
|
+
[new E(new G(0.1, 0.1, 0.1), h)]
|
|
964
964
|
]
|
|
965
|
-
},
|
|
965
|
+
}, ge = {
|
|
966
966
|
X: [
|
|
967
|
-
[new
|
|
968
|
-
[new
|
|
967
|
+
[new E(new B(0.2, 0, 0.6, 4), s), [0.3, 0, 0], [0, 0, -Math.PI / 2]],
|
|
968
|
+
[new E(new B(0.2, 0, 0.6, 4), s), [-0.3, 0, 0], [0, 0, Math.PI / 2]]
|
|
969
969
|
],
|
|
970
970
|
Y: [
|
|
971
|
-
[new
|
|
972
|
-
[new
|
|
971
|
+
[new E(new B(0.2, 0, 0.6, 4), s), [0, 0.3, 0]],
|
|
972
|
+
[new E(new B(0.2, 0, 0.6, 4), s), [0, -0.3, 0], [0, 0, Math.PI]]
|
|
973
973
|
],
|
|
974
974
|
Z: [
|
|
975
|
-
[new
|
|
976
|
-
[new
|
|
975
|
+
[new E(new B(0.2, 0, 0.6, 4), s), [0, 0, 0.3], [Math.PI / 2, 0, 0]],
|
|
976
|
+
[new E(new B(0.2, 0, 0.6, 4), s), [0, 0, -0.3], [-Math.PI / 2, 0, 0]]
|
|
977
977
|
],
|
|
978
978
|
XY: [
|
|
979
|
-
[new
|
|
979
|
+
[new E(new G(0.2, 0.2, 0.01), s), [0.15, 0.15, 0]]
|
|
980
980
|
],
|
|
981
981
|
YZ: [
|
|
982
|
-
[new
|
|
982
|
+
[new E(new G(0.2, 0.2, 0.01), s), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
|
|
983
983
|
],
|
|
984
984
|
XZ: [
|
|
985
|
-
[new
|
|
985
|
+
[new E(new G(0.2, 0.2, 0.01), s), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
|
|
986
986
|
],
|
|
987
987
|
XYZ: [
|
|
988
|
-
[new
|
|
988
|
+
[new E(new G(0.2, 0.2, 0.2), s), [0, 0, 0]]
|
|
989
989
|
]
|
|
990
|
-
},
|
|
990
|
+
}, x = {
|
|
991
991
|
X: [
|
|
992
|
-
[new
|
|
992
|
+
[new ae(p, n), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]
|
|
993
993
|
],
|
|
994
994
|
Y: [
|
|
995
|
-
[new
|
|
995
|
+
[new ae(p, n), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]
|
|
996
996
|
],
|
|
997
997
|
Z: [
|
|
998
|
-
[new
|
|
998
|
+
[new ae(p, n), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]
|
|
999
999
|
]
|
|
1000
1000
|
};
|
|
1001
|
-
function
|
|
1002
|
-
const
|
|
1003
|
-
for (const
|
|
1004
|
-
for (let
|
|
1005
|
-
const X =
|
|
1006
|
-
X.name =
|
|
1007
|
-
const
|
|
1008
|
-
|
|
1001
|
+
function P(q) {
|
|
1002
|
+
const Qe = new Ye();
|
|
1003
|
+
for (const te in q)
|
|
1004
|
+
for (let Ee = q[te].length; Ee--; ) {
|
|
1005
|
+
const X = q[te][Ee][0].clone(), qe = q[te][Ee][1], $e = q[te][Ee][2], Je = q[te][Ee][3], Rn = q[te][Ee][4];
|
|
1006
|
+
X.name = te, X.tag = Rn, qe && X.position.set(qe[0], qe[1], qe[2]), $e && X.rotation.set($e[0], $e[1], $e[2]), Je && X.scale.set(Je[0], Je[1], Je[2]), X.updateMatrix();
|
|
1007
|
+
const kt = X.geometry.clone();
|
|
1008
|
+
kt.applyMatrix4(X.matrix), X.geometry = kt, X.renderOrder = 1 / 0, X.position.set(0, 0, 0), X.rotation.set(0, 0, 0), X.scale.set(1, 1, 1), Qe.add(X);
|
|
1009
1009
|
}
|
|
1010
|
-
return
|
|
1010
|
+
return Qe;
|
|
1011
1011
|
}
|
|
1012
|
-
this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate =
|
|
1012
|
+
this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = P(R)), this.add(this.gizmo.rotate = P(V)), this.add(this.gizmo.scale = P(me)), this.add(this.picker.translate = P(v)), this.add(this.picker.rotate = P(Q)), this.add(this.picker.scale = P(ge)), this.add(this.helper.translate = P(I)), this.add(this.helper.rotate = P(W)), this.add(this.helper.scale = P(x)), 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 : ct;
|
|
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,58 +1022,58 @@ class Fs extends Xe {
|
|
|
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" && (
|
|
1025
|
+
o.visible = !1, o.name === "AXIS" ? (o.visible = !!this.axis, this.axis === "X" && (D.setFromEuler(st.set(0, 0, 0)), o.quaternion.copy(s).multiply(D), Math.abs(C.copy(ke).applyQuaternion(s).dot(this.eye)) > 0.9 && (o.visible = !1)), this.axis === "Y" && (D.setFromEuler(st.set(0, 0, Math.PI / 2)), o.quaternion.copy(s).multiply(D), Math.abs(C.copy(be).applyQuaternion(s).dot(this.eye)) > 0.9 && (o.visible = !1)), this.axis === "Z" && (D.setFromEuler(st.set(0, Math.PI / 2, 0)), o.quaternion.copy(s).multiply(D), Math.abs(C.copy(Ne).applyQuaternion(s).dot(this.eye)) > 0.9 && (o.visible = !1)), this.axis === "XYZE" && (D.setFromEuler(st.set(0, Math.PI / 2, 0)), C.copy(this.rotationAxis), o.quaternion.setFromRotationMatrix(Wt.lookAt(Zt, C, be)), o.quaternion.multiply(D), o.visible = this.dragging), this.axis === "E" && (o.visible = !1)) : o.name === "START" ? (o.position.copy(this.worldPositionStart), o.visible = this.dragging) : o.name === "END" ? (o.position.copy(this.worldPosition), o.visible = this.dragging) : o.name === "DELTA" ? (o.position.copy(this.worldPositionStart), o.quaternion.copy(this.worldQuaternionStart), F.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1), F.applyQuaternion(this.worldQuaternionStart.clone().invert()), o.scale.copy(F), o.visible = this.dragging) : (o.quaternion.copy(s), this.dragging ? o.position.copy(this.worldPositionStart) : o.position.copy(this.worldPosition), this.axis && (o.visible = this.axis.search(o.name) !== -1));
|
|
1026
1026
|
continue;
|
|
1027
1027
|
}
|
|
1028
|
-
o.quaternion.copy(s), this.mode === "translate" || this.mode === "scale" ? (o.name === "X" && Math.abs(
|
|
1028
|
+
o.quaternion.copy(s), this.mode === "translate" || this.mode === "scale" ? (o.name === "X" && Math.abs(C.copy(ke).applyQuaternion(s).dot(this.eye)) > 0.99 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1), o.name === "Y" && Math.abs(C.copy(be).applyQuaternion(s).dot(this.eye)) > 0.99 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1), o.name === "Z" && Math.abs(C.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(C.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(C.copy(ke).applyQuaternion(s).dot(this.eye)) < 0.2 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1), o.name === "XZ" && Math.abs(C.copy(be).applyQuaternion(s).dot(this.eye)) < 0.2 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1)) : this.mode === "rotate" && (it.copy(s), C.copy(this.eye).applyQuaternion(D.copy(s).invert()), o.name.search("E") !== -1 && o.quaternion.setFromRotationMatrix(Wt.lookAt(this.eye, Zt, be)), o.name === "X" && (D.setFromAxisAngle(ke, Math.atan2(-C.y, C.z)), D.multiplyQuaternions(it, D), o.quaternion.copy(D)), o.name === "Y" && (D.setFromAxisAngle(be, Math.atan2(C.x, C.z)), D.multiplyQuaternions(it, D), o.quaternion.copy(D)), o.name === "Z" && (D.setFromAxisAngle(Ne, Math.atan2(C.y, C.x)), D.multiplyQuaternions(it, D), o.quaternion.copy(D))), 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 Us extends E {
|
|
1036
1036
|
constructor() {
|
|
1037
1037
|
super(
|
|
1038
|
-
new
|
|
1039
|
-
new
|
|
1038
|
+
new Xn(1e5, 1e5, 2, 2),
|
|
1039
|
+
new we({ visible: !1, wireframe: !0, side: fn, 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"), ot.copy(ke).applyQuaternion(t === "local" ? this.worldQuaternion : ct), Ie.copy(be).applyQuaternion(t === "local" ? this.worldQuaternion : ct), Ce.copy(Ne).applyQuaternion(t === "local" ? this.worldQuaternion : ct), C.copy(Ie), this.mode) {
|
|
1045
1045
|
case "translate":
|
|
1046
1046
|
case "scale":
|
|
1047
1047
|
switch (this.axis) {
|
|
1048
1048
|
case "X":
|
|
1049
|
-
|
|
1049
|
+
C.copy(this.eye).cross(ot), ne.copy(ot).cross(C);
|
|
1050
1050
|
break;
|
|
1051
1051
|
case "Y":
|
|
1052
|
-
|
|
1052
|
+
C.copy(this.eye).cross(Ie), ne.copy(Ie).cross(C);
|
|
1053
1053
|
break;
|
|
1054
1054
|
case "Z":
|
|
1055
|
-
|
|
1055
|
+
C.copy(this.eye).cross(Ce), ne.copy(Ce).cross(C);
|
|
1056
1056
|
break;
|
|
1057
1057
|
case "XY":
|
|
1058
|
-
|
|
1058
|
+
ne.copy(Ce);
|
|
1059
1059
|
break;
|
|
1060
1060
|
case "YZ":
|
|
1061
|
-
|
|
1061
|
+
ne.copy(ot);
|
|
1062
1062
|
break;
|
|
1063
1063
|
case "XZ":
|
|
1064
|
-
|
|
1064
|
+
C.copy(Ce), ne.copy(Ie);
|
|
1065
1065
|
break;
|
|
1066
1066
|
case "XYZ":
|
|
1067
1067
|
case "E":
|
|
1068
|
-
|
|
1068
|
+
ne.set(0, 0, 0);
|
|
1069
1069
|
break;
|
|
1070
1070
|
}
|
|
1071
1071
|
break;
|
|
1072
1072
|
case "rotate":
|
|
1073
1073
|
default:
|
|
1074
|
-
|
|
1074
|
+
ne.set(0, 0, 0);
|
|
1075
1075
|
}
|
|
1076
|
-
|
|
1076
|
+
ne.length() === 0 ? this.quaternion.copy(this.cameraQuaternion) : (Qt.lookAt(F.set(0, 0, 0), ne, C), this.quaternion.setFromRotationMatrix(Qt)), super.updateMatrixWorld(e);
|
|
1077
1077
|
}
|
|
1078
1078
|
}
|
|
1079
1079
|
const _ = {
|
|
@@ -1095,9 +1095,9 @@ const _ = {
|
|
|
1095
1095
|
/** 当前选中的物体 */
|
|
1096
1096
|
selectedObject: null
|
|
1097
1097
|
};
|
|
1098
|
-
let
|
|
1099
|
-
function
|
|
1100
|
-
if (_.container = r, _.mode = e,
|
|
1098
|
+
let ht = !1, xe = !1, Te = null, Rt = null, ut = null, fe = [], yt, dt = null, Ge = null, Xe = null;
|
|
1099
|
+
function zs(r, e = "edit", t) {
|
|
1100
|
+
if (_.container = r, _.mode = e, Gs(), Xs(), Ys(), t && (ai(t.scene, e), t != null && t.camera)) {
|
|
1101
1101
|
const s = t.camera;
|
|
1102
1102
|
_.camera.position.set(
|
|
1103
1103
|
s.position[0],
|
|
@@ -1107,157 +1107,195 @@ function Us(r, e = "edit", t) {
|
|
|
1107
1107
|
s.rotation[0],
|
|
1108
1108
|
s.rotation[1],
|
|
1109
1109
|
s.rotation[2]
|
|
1110
|
-
), _.camera.updateProjectionMatrix(),
|
|
1110
|
+
), _.camera.updateProjectionMatrix(), yt = s.target;
|
|
1111
1111
|
}
|
|
1112
|
-
|
|
1113
|
-
}
|
|
1114
|
-
function zs() {
|
|
1115
|
-
const r = new F.WebGLRenderer({ antialias: !0, alpha: !0 });
|
|
1116
|
-
r.setSize(_.container.clientWidth, _.container.clientHeight), r.setPixelRatio(Math.min(window.devicePixelRatio, 2)), _.container.appendChild(r.domElement), _.renderer = r;
|
|
1112
|
+
Vs(), Ks(), yt && _.orbitControls && (_.orbitControls.target.fromArray(yt), _.orbitControls.update()), ni(), En(), Ge = (s) => Qs(s), Xe = () => Ws(), e === "edit" && r.addEventListener("click", Ge), window.addEventListener("resize", Xe), t || Zs(), e === "edit" && Bs();
|
|
1117
1113
|
}
|
|
1118
1114
|
function Gs() {
|
|
1119
|
-
|
|
1115
|
+
const r = new H.WebGLRenderer({ antialias: !0, alpha: !0 });
|
|
1116
|
+
r.setSize(_.container.clientWidth, _.container.clientHeight), r.setPixelRatio(Math.min(window.devicePixelRatio, 2)), _.container.appendChild(r.domElement), _.renderer = r;
|
|
1120
1117
|
}
|
|
1121
1118
|
function Xs() {
|
|
1122
|
-
|
|
1119
|
+
_.scene = new H.Scene(), _.scene.name = "sl_scene";
|
|
1120
|
+
}
|
|
1121
|
+
function Bs() {
|
|
1122
|
+
const r = new H.GridHelper(30, 30, 8956671, 3364232);
|
|
1123
1123
|
r.name = "地板", r.userData.type = "initFloor", _.scene.add(r), _.gridHelper = r;
|
|
1124
1124
|
}
|
|
1125
1125
|
function Ys() {
|
|
1126
|
-
const r = _.container, e = r.clientWidth / r.clientHeight, t = new
|
|
1126
|
+
const r = _.container, e = r.clientWidth / r.clientHeight, t = new H.PerspectiveCamera(45, e, 0.1, 1e3);
|
|
1127
1127
|
t.position.set(0, 6, 15), t.lookAt(0, 0, 0), _.camera = t;
|
|
1128
1128
|
}
|
|
1129
|
-
function
|
|
1130
|
-
const r = new
|
|
1129
|
+
function Ks() {
|
|
1130
|
+
const r = new bs(_.camera, _.renderer.domElement);
|
|
1131
1131
|
r.minDistance = 0, r.maxDistance = 1 / 0, r.addEventListener("start", () => {
|
|
1132
|
-
|
|
1132
|
+
ht = !1;
|
|
1133
1133
|
}), r.addEventListener("change", () => {
|
|
1134
|
-
|
|
1134
|
+
ht = !0;
|
|
1135
1135
|
}), r.addEventListener("end", () => {
|
|
1136
|
-
|
|
1137
|
-
|
|
1136
|
+
ht && (xe = !0, setTimeout(() => {
|
|
1137
|
+
xe = !1;
|
|
1138
1138
|
}, 200));
|
|
1139
1139
|
}), _.orbitControls = r;
|
|
1140
1140
|
}
|
|
1141
|
-
function
|
|
1142
|
-
const r = new
|
|
1141
|
+
function Vs() {
|
|
1142
|
+
const r = new Cs(
|
|
1143
1143
|
_.camera,
|
|
1144
1144
|
_.renderer.domElement
|
|
1145
1145
|
);
|
|
1146
1146
|
r.addEventListener("dragging-changed", (e) => {
|
|
1147
|
-
_.orbitControls.enabled = !e.value, e.value || (
|
|
1148
|
-
|
|
1147
|
+
_.orbitControls.enabled = !e.value, e.value || (xe = !0, setTimeout(() => {
|
|
1148
|
+
xe = !1;
|
|
1149
1149
|
}, 200));
|
|
1150
1150
|
}), r.addEventListener("objectChange", () => {
|
|
1151
|
-
|
|
1151
|
+
const e = _.selectedObject;
|
|
1152
|
+
if (Rt && e && Rt(e), e && e.type === "DirectionalLight") {
|
|
1153
|
+
const t = e.userData.helper;
|
|
1154
|
+
t && t.update && t.update();
|
|
1155
|
+
}
|
|
1152
1156
|
}), _.scene.add(r.getHelper()), _.transformControls = r;
|
|
1153
1157
|
}
|
|
1154
|
-
function
|
|
1155
|
-
const r = new
|
|
1158
|
+
function Zs() {
|
|
1159
|
+
const r = new H.AmbientLight(16777215, 1);
|
|
1156
1160
|
_.scene.add(r);
|
|
1157
|
-
const e = new F.DirectionalLight(16777215, 3);
|
|
1158
|
-
e.position.set(48, 104, 138), _.scene.add(e);
|
|
1159
1161
|
}
|
|
1160
|
-
function
|
|
1162
|
+
function En() {
|
|
1161
1163
|
var r, e;
|
|
1162
|
-
|
|
1164
|
+
dt = requestAnimationFrame(En), ys.update(), (r = _.orbitControls) == null || r.update(), (e = _.renderer) == null || e.render(_.scene, _.camera);
|
|
1163
1165
|
}
|
|
1164
|
-
function
|
|
1166
|
+
function Ws() {
|
|
1165
1167
|
if (!_.container || !_.camera || !_.renderer) return;
|
|
1166
1168
|
const r = _.container.clientWidth, e = _.container.clientHeight;
|
|
1167
1169
|
r === 0 || e === 0 || (_.camera.aspect = r / e, _.camera.updateProjectionMatrix(), _.renderer.setSize(r, e));
|
|
1168
1170
|
}
|
|
1169
|
-
function
|
|
1170
|
-
_.selectedObject !== r && (_.selectedObject && _.transformControls.detach(), _.selectedObject = r, _.transformControls.attach(r), _.transformControls.setMode("translate"), _.transformControls.showX = !0, _.transformControls.showY = !0, _.transformControls.showZ = !0,
|
|
1171
|
+
function Dt(r) {
|
|
1172
|
+
_.selectedObject !== r && (_.selectedObject && _.transformControls.detach(), _.selectedObject = r, _.transformControls.attach(r), _.transformControls.setMode("translate"), _.transformControls.showX = !0, _.transformControls.showY = !0, _.transformControls.showZ = !0, Te == null || Te(r));
|
|
1171
1173
|
}
|
|
1172
|
-
function
|
|
1173
|
-
_.selectedObject && (_.transformControls.detach(), _.selectedObject = null,
|
|
1174
|
+
function Ot() {
|
|
1175
|
+
_.selectedObject && (_.transformControls.detach(), _.selectedObject = null, Te == null || Te(null));
|
|
1174
1176
|
}
|
|
1175
1177
|
function Qs(r) {
|
|
1176
|
-
if (
|
|
1177
|
-
|
|
1178
|
+
if (xe) {
|
|
1179
|
+
xe = !1;
|
|
1178
1180
|
return;
|
|
1179
1181
|
}
|
|
1180
|
-
const e = _.renderer.domElement.getBoundingClientRect(), t = new
|
|
1182
|
+
const e = _.renderer.domElement.getBoundingClientRect(), t = new H.Vector2(
|
|
1181
1183
|
(r.clientX - e.left) / e.width * 2 - 1,
|
|
1182
1184
|
-((r.clientY - e.top) / e.height) * 2 + 1
|
|
1183
|
-
), s = new
|
|
1185
|
+
), s = new H.Raycaster();
|
|
1184
1186
|
s.setFromCamera(t, _.camera);
|
|
1185
1187
|
const n = [];
|
|
1186
1188
|
_.scene.traverse((o) => {
|
|
1187
|
-
o.type === "
|
|
1189
|
+
(o.userData.isMovable || o.userData.type === "lightHelper") && n.push(o);
|
|
1188
1190
|
});
|
|
1189
1191
|
const i = s.intersectObjects(n);
|
|
1190
|
-
i.length > 0
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1192
|
+
if (i.length > 0) {
|
|
1193
|
+
let o = qs(i[0].object);
|
|
1194
|
+
Dt(o);
|
|
1195
|
+
} else
|
|
1196
|
+
Ot();
|
|
1194
1197
|
}
|
|
1195
1198
|
function qs(r) {
|
|
1196
|
-
|
|
1199
|
+
if (r.type === "Line") {
|
|
1200
|
+
console.log("firstObject", r);
|
|
1201
|
+
const e = r.parent;
|
|
1202
|
+
switch (e.type) {
|
|
1203
|
+
case "DirectionalLightHelper":
|
|
1204
|
+
return e.light;
|
|
1205
|
+
}
|
|
1206
|
+
} else
|
|
1207
|
+
return r;
|
|
1197
1208
|
}
|
|
1198
|
-
function
|
|
1199
|
-
|
|
1200
|
-
e && qs(e);
|
|
1209
|
+
function Ve(r, e = !1) {
|
|
1210
|
+
_.scene.add(r), r.userData.isMovable && (ei(r), pt()), e && _.mode === "edit" && Dt(r);
|
|
1201
1211
|
}
|
|
1202
1212
|
function $s(r) {
|
|
1203
|
-
|
|
1213
|
+
_.selectedObject === r && Ot(), r.parent ? r.parent.remove(r) : _.scene.remove(r), ti(r), pt();
|
|
1204
1214
|
}
|
|
1205
1215
|
function Js(r) {
|
|
1216
|
+
const e = _.scene.getObjectByProperty("uuid", r);
|
|
1217
|
+
e && $s(e);
|
|
1218
|
+
}
|
|
1219
|
+
function ei(r) {
|
|
1220
|
+
r.userData.isMovable && r.parent === _.scene && (fe.includes(r) || fe.push(r));
|
|
1221
|
+
}
|
|
1222
|
+
function ti(r) {
|
|
1206
1223
|
const e = fe.indexOf(r);
|
|
1207
1224
|
e !== -1 && fe.splice(e, 1);
|
|
1208
1225
|
}
|
|
1209
|
-
function
|
|
1226
|
+
function ni() {
|
|
1210
1227
|
const r = [];
|
|
1211
1228
|
_.scene.children.forEach((e) => {
|
|
1212
1229
|
e.userData.isMovable && r.push(e);
|
|
1213
|
-
}), fe = r,
|
|
1230
|
+
}), fe = r, pt();
|
|
1214
1231
|
}
|
|
1215
|
-
function
|
|
1216
|
-
|
|
1232
|
+
function pt() {
|
|
1233
|
+
ut == null || ut([...fe]);
|
|
1217
1234
|
}
|
|
1218
|
-
function
|
|
1219
|
-
|
|
1235
|
+
function si(r) {
|
|
1236
|
+
Te = r;
|
|
1220
1237
|
}
|
|
1221
|
-
function
|
|
1222
|
-
|
|
1238
|
+
function ii(r) {
|
|
1239
|
+
Rt = r;
|
|
1223
1240
|
}
|
|
1224
|
-
function
|
|
1225
|
-
|
|
1241
|
+
function oi(r) {
|
|
1242
|
+
ut = r;
|
|
1226
1243
|
}
|
|
1227
|
-
function
|
|
1244
|
+
function ri() {
|
|
1228
1245
|
return fe;
|
|
1229
1246
|
}
|
|
1230
|
-
function
|
|
1247
|
+
function er() {
|
|
1231
1248
|
return _.scene;
|
|
1232
1249
|
}
|
|
1233
|
-
function
|
|
1250
|
+
function tr() {
|
|
1234
1251
|
return _.camera;
|
|
1235
1252
|
}
|
|
1236
|
-
function
|
|
1253
|
+
function nr() {
|
|
1237
1254
|
return _.renderer;
|
|
1238
1255
|
}
|
|
1239
|
-
function
|
|
1240
|
-
var
|
|
1241
|
-
|
|
1256
|
+
function sr() {
|
|
1257
|
+
var o, a, l;
|
|
1258
|
+
Ot();
|
|
1242
1259
|
const r = _.scene;
|
|
1243
1260
|
if (!r) return "{}";
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
(
|
|
1261
|
+
const e = [], t = /* @__PURE__ */ new Map();
|
|
1262
|
+
r.children.forEach((c) => {
|
|
1263
|
+
c.userData.type === "lightHelper" && e.push(c), c.type === "DirectionalLight" && c.userData.helper && (t.set(c, c.userData.helper), c.userData.helper = void 0);
|
|
1264
|
+
}), e.forEach((c) => r.remove(c));
|
|
1265
|
+
const s = r.clone();
|
|
1266
|
+
s.children = s.children.filter(
|
|
1267
|
+
(c) => c.userData.type !== "initFloor"
|
|
1247
1268
|
);
|
|
1248
|
-
const
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1269
|
+
const n = s.toJSON();
|
|
1270
|
+
e.forEach((c) => r.add(c)), t.forEach((c, u) => {
|
|
1271
|
+
u.userData.helper = c;
|
|
1272
|
+
});
|
|
1273
|
+
const i = {
|
|
1274
|
+
position: (o = _.camera) == null ? void 0 : o.position.toArray(),
|
|
1275
|
+
rotation: (a = _.camera) == null ? void 0 : a.rotation.toArray(),
|
|
1276
|
+
target: ((l = _.orbitControls) == null ? void 0 : l.target.toArray()) || [0, 0, 0]
|
|
1252
1277
|
};
|
|
1253
|
-
return JSON.stringify({
|
|
1278
|
+
return JSON.stringify({
|
|
1279
|
+
scene: n,
|
|
1280
|
+
camera: i
|
|
1281
|
+
// lightHelpers: lightHelpers,
|
|
1282
|
+
});
|
|
1254
1283
|
}
|
|
1255
|
-
function
|
|
1256
|
-
var i;
|
|
1257
|
-
const t = typeof r == "string" ? JSON.parse(r) : r, n = new
|
|
1258
|
-
n.type === "Scene" ? _.scene = n : (i = _.scene) == null || i.add(n)
|
|
1284
|
+
function ai(r, e = "edit") {
|
|
1285
|
+
var i, o;
|
|
1286
|
+
const t = typeof r == "string" ? JSON.parse(r) : r, n = new H.ObjectLoader().parse(t);
|
|
1287
|
+
n.type === "Scene" ? _.scene = n : (i = _.scene) == null || i.add(n), e === "edit" && ((o = _.scene) == null || o.traverse((a) => {
|
|
1288
|
+
var l;
|
|
1289
|
+
if (a.type === "DirectionalLight") {
|
|
1290
|
+
const c = a;
|
|
1291
|
+
if (!c.userData.helper) {
|
|
1292
|
+
const u = new H.DirectionalLightHelper(c, 1);
|
|
1293
|
+
u.userData.type = "lightHelper", c.userData.helper = u, (l = _.scene) == null || l.add(u);
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
}));
|
|
1259
1297
|
}
|
|
1260
|
-
function
|
|
1298
|
+
function Mn(r) {
|
|
1261
1299
|
if (!r) return;
|
|
1262
1300
|
if (r.type === "Mesh") {
|
|
1263
1301
|
const t = r;
|
|
@@ -1267,13 +1305,13 @@ function Tn(r) {
|
|
|
1267
1305
|
}
|
|
1268
1306
|
const e = r.children.slice();
|
|
1269
1307
|
for (const t of e)
|
|
1270
|
-
|
|
1308
|
+
Mn(t);
|
|
1271
1309
|
}
|
|
1272
|
-
function
|
|
1273
|
-
|
|
1310
|
+
function li() {
|
|
1311
|
+
dt !== null && (cancelAnimationFrame(dt), dt = null), Ge && _.container && (_.container.removeEventListener("click", Ge), Ge = null), Xe && (window.removeEventListener("resize", Xe), Xe = null), _.orbitControls && (_.orbitControls.dispose(), _.orbitControls = null), _.transformControls && (_.transformControls.dispose(), _.transformControls = null), _.scene && (Mn(_.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 = [], pt(), ht = !1, xe = !1;
|
|
1274
1312
|
}
|
|
1275
|
-
const
|
|
1276
|
-
function
|
|
1313
|
+
const ci = /^[og]\s*(.+)?/, hi = /^mtllib /, ui = /^usemtl /, di = /^usemap /, qt = /\s+/, $t = new S(), _t = new S(), Jt = new S(), en = new S(), J = new S(), rt = new he();
|
|
1314
|
+
function pi() {
|
|
1277
1315
|
const r = {
|
|
1278
1316
|
objects: [],
|
|
1279
1317
|
object: {},
|
|
@@ -1314,7 +1352,7 @@ function ui() {
|
|
|
1314
1352
|
groupCount: -1,
|
|
1315
1353
|
inherited: !1,
|
|
1316
1354
|
clone: function(l) {
|
|
1317
|
-
const
|
|
1355
|
+
const c = {
|
|
1318
1356
|
index: typeof l == "number" ? l : this.index,
|
|
1319
1357
|
name: this.name,
|
|
1320
1358
|
mtllib: this.mtllib,
|
|
@@ -1324,7 +1362,7 @@ function ui() {
|
|
|
1324
1362
|
groupCount: -1,
|
|
1325
1363
|
inherited: !1
|
|
1326
1364
|
};
|
|
1327
|
-
return
|
|
1365
|
+
return c.clone = this.clone.bind(c), c;
|
|
1328
1366
|
}
|
|
1329
1367
|
};
|
|
1330
1368
|
return this.materials.push(a), a;
|
|
@@ -1382,7 +1420,7 @@ function ui() {
|
|
|
1382
1420
|
},
|
|
1383
1421
|
addFaceNormal: function(e, t, s) {
|
|
1384
1422
|
const n = this.vertices, i = this.object.geometry.normals;
|
|
1385
|
-
|
|
1423
|
+
$t.fromArray(n, e), _t.fromArray(n, t), Jt.fromArray(n, s), J.subVectors(Jt, _t), en.subVectors($t, _t), J.cross(en), J.normalize(), i.push(J.x, J.y, J.z), i.push(J.x, J.y, J.z), i.push(J.x, J.y, J.z);
|
|
1386
1424
|
},
|
|
1387
1425
|
addColor: function(e, t, s) {
|
|
1388
1426
|
const n = this.colors, i = this.object.geometry.colors;
|
|
@@ -1400,17 +1438,17 @@ function ui() {
|
|
|
1400
1438
|
const t = this.uvs;
|
|
1401
1439
|
this.object.geometry.uvs.push(t[e + 0], t[e + 1]);
|
|
1402
1440
|
},
|
|
1403
|
-
addFace: function(e, t, s, n, i, o, a, l,
|
|
1441
|
+
addFace: function(e, t, s, n, i, o, a, l, c) {
|
|
1404
1442
|
const u = this.vertices.length;
|
|
1405
|
-
let
|
|
1406
|
-
if (this.addVertex(
|
|
1443
|
+
let h = this.parseVertexIndex(e, u), d = this.parseVertexIndex(t, u), m = this.parseVertexIndex(s, u);
|
|
1444
|
+
if (this.addVertex(h, d, m), this.addColor(h, d, m), a !== void 0 && a !== "") {
|
|
1407
1445
|
const w = this.normals.length;
|
|
1408
|
-
|
|
1446
|
+
h = this.parseNormalIndex(a, w), d = this.parseNormalIndex(l, w), m = this.parseNormalIndex(c, w), this.addNormal(h, d, m);
|
|
1409
1447
|
} else
|
|
1410
|
-
this.addFaceNormal(
|
|
1448
|
+
this.addFaceNormal(h, d, m);
|
|
1411
1449
|
if (n !== void 0 && n !== "") {
|
|
1412
1450
|
const w = this.uvs.length;
|
|
1413
|
-
|
|
1451
|
+
h = this.parseUVIndex(n, w), d = this.parseUVIndex(i, w), m = this.parseUVIndex(o, w), this.addUV(h, d, m), this.object.geometry.hasUVIndices = !0;
|
|
1414
1452
|
} else
|
|
1415
1453
|
this.addDefaultUV();
|
|
1416
1454
|
},
|
|
@@ -1433,7 +1471,7 @@ function ui() {
|
|
|
1433
1471
|
};
|
|
1434
1472
|
return r.startObject("", !1), r;
|
|
1435
1473
|
}
|
|
1436
|
-
class
|
|
1474
|
+
class fi extends It {
|
|
1437
1475
|
/**
|
|
1438
1476
|
* Constructs a new OBJ loader.
|
|
1439
1477
|
*
|
|
@@ -1452,7 +1490,7 @@ class di extends pn {
|
|
|
1452
1490
|
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
1453
1491
|
*/
|
|
1454
1492
|
load(e, t, s, n) {
|
|
1455
|
-
const i = this, o = new
|
|
1493
|
+
const i = this, o = new Ke(this.manager);
|
|
1456
1494
|
o.setPath(this.path), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(e, function(a) {
|
|
1457
1495
|
try {
|
|
1458
1496
|
t(i.parse(a));
|
|
@@ -1477,7 +1515,7 @@ class di extends pn {
|
|
|
1477
1515
|
* @return {Group} The parsed OBJ.
|
|
1478
1516
|
*/
|
|
1479
1517
|
parse(e) {
|
|
1480
|
-
const t = new
|
|
1518
|
+
const t = new pi();
|
|
1481
1519
|
e.indexOf(`\r
|
|
1482
1520
|
`) !== -1 && (e = e.replace(/\r\n/g, `
|
|
1483
1521
|
`)), e.indexOf(`\\
|
|
@@ -1486,148 +1524,148 @@ class di extends pn {
|
|
|
1486
1524
|
`);
|
|
1487
1525
|
let n = [];
|
|
1488
1526
|
for (let a = 0, l = s.length; a < l; a++) {
|
|
1489
|
-
const
|
|
1490
|
-
if (
|
|
1491
|
-
const u =
|
|
1527
|
+
const c = s[a].trimStart();
|
|
1528
|
+
if (c.length === 0) continue;
|
|
1529
|
+
const u = c.charAt(0);
|
|
1492
1530
|
if (u !== "#")
|
|
1493
1531
|
if (u === "v") {
|
|
1494
|
-
const
|
|
1495
|
-
switch (
|
|
1532
|
+
const h = c.split(qt);
|
|
1533
|
+
switch (h[0]) {
|
|
1496
1534
|
case "v":
|
|
1497
1535
|
t.vertices.push(
|
|
1498
|
-
parseFloat(
|
|
1499
|
-
parseFloat(
|
|
1500
|
-
parseFloat(
|
|
1501
|
-
),
|
|
1502
|
-
parseFloat(
|
|
1503
|
-
parseFloat(
|
|
1504
|
-
parseFloat(
|
|
1505
|
-
|
|
1506
|
-
), t.colors.push(
|
|
1536
|
+
parseFloat(h[1]),
|
|
1537
|
+
parseFloat(h[2]),
|
|
1538
|
+
parseFloat(h[3])
|
|
1539
|
+
), h.length >= 7 ? (rt.setRGB(
|
|
1540
|
+
parseFloat(h[4]),
|
|
1541
|
+
parseFloat(h[5]),
|
|
1542
|
+
parseFloat(h[6]),
|
|
1543
|
+
ce
|
|
1544
|
+
), t.colors.push(rt.r, rt.g, rt.b)) : t.colors.push(void 0, void 0, void 0);
|
|
1507
1545
|
break;
|
|
1508
1546
|
case "vn":
|
|
1509
1547
|
t.normals.push(
|
|
1510
|
-
parseFloat(
|
|
1511
|
-
parseFloat(
|
|
1512
|
-
parseFloat(
|
|
1548
|
+
parseFloat(h[1]),
|
|
1549
|
+
parseFloat(h[2]),
|
|
1550
|
+
parseFloat(h[3])
|
|
1513
1551
|
);
|
|
1514
1552
|
break;
|
|
1515
1553
|
case "vt":
|
|
1516
1554
|
t.uvs.push(
|
|
1517
|
-
parseFloat(
|
|
1518
|
-
parseFloat(
|
|
1555
|
+
parseFloat(h[1]),
|
|
1556
|
+
parseFloat(h[2])
|
|
1519
1557
|
);
|
|
1520
1558
|
break;
|
|
1521
1559
|
}
|
|
1522
1560
|
} else if (u === "f") {
|
|
1523
|
-
const
|
|
1524
|
-
for (let f = 0, y =
|
|
1525
|
-
const
|
|
1526
|
-
if (
|
|
1527
|
-
const b =
|
|
1561
|
+
const d = c.slice(1).trim().split(qt), m = [];
|
|
1562
|
+
for (let f = 0, y = d.length; f < y; f++) {
|
|
1563
|
+
const p = d[f];
|
|
1564
|
+
if (p.length > 0) {
|
|
1565
|
+
const b = p.split("/");
|
|
1528
1566
|
m.push(b);
|
|
1529
1567
|
}
|
|
1530
1568
|
}
|
|
1531
1569
|
const w = m[0];
|
|
1532
1570
|
for (let f = 1, y = m.length - 1; f < y; f++) {
|
|
1533
|
-
const
|
|
1571
|
+
const p = m[f], b = m[f + 1];
|
|
1534
1572
|
t.addFace(
|
|
1535
1573
|
w[0],
|
|
1536
|
-
|
|
1574
|
+
p[0],
|
|
1537
1575
|
b[0],
|
|
1538
1576
|
w[1],
|
|
1539
|
-
|
|
1577
|
+
p[1],
|
|
1540
1578
|
b[1],
|
|
1541
1579
|
w[2],
|
|
1542
|
-
|
|
1580
|
+
p[2],
|
|
1543
1581
|
b[2]
|
|
1544
1582
|
);
|
|
1545
1583
|
}
|
|
1546
1584
|
} else if (u === "l") {
|
|
1547
|
-
const
|
|
1548
|
-
let
|
|
1585
|
+
const h = c.substring(1).trim().split(" ");
|
|
1586
|
+
let d = [];
|
|
1549
1587
|
const m = [];
|
|
1550
|
-
if (
|
|
1551
|
-
|
|
1588
|
+
if (c.indexOf("/") === -1)
|
|
1589
|
+
d = h;
|
|
1552
1590
|
else
|
|
1553
|
-
for (let w = 0, f =
|
|
1554
|
-
const y =
|
|
1555
|
-
y[0] !== "" &&
|
|
1591
|
+
for (let w = 0, f = h.length; w < f; w++) {
|
|
1592
|
+
const y = h[w].split("/");
|
|
1593
|
+
y[0] !== "" && d.push(y[0]), y[1] !== "" && m.push(y[1]);
|
|
1556
1594
|
}
|
|
1557
|
-
t.addLineGeometry(
|
|
1595
|
+
t.addLineGeometry(d, m);
|
|
1558
1596
|
} else if (u === "p") {
|
|
1559
|
-
const
|
|
1560
|
-
t.addPointGeometry(
|
|
1561
|
-
} else if ((n =
|
|
1562
|
-
const
|
|
1563
|
-
t.startObject(
|
|
1564
|
-
} else if (
|
|
1565
|
-
t.object.startMaterial(
|
|
1566
|
-
else if (
|
|
1567
|
-
t.materialLibraries.push(
|
|
1568
|
-
else if (
|
|
1597
|
+
const d = c.slice(1).trim().split(" ");
|
|
1598
|
+
t.addPointGeometry(d);
|
|
1599
|
+
} else if ((n = ci.exec(c)) !== null) {
|
|
1600
|
+
const h = (" " + n[0].slice(1).trim()).slice(1);
|
|
1601
|
+
t.startObject(h);
|
|
1602
|
+
} else if (ui.test(c))
|
|
1603
|
+
t.object.startMaterial(c.substring(7).trim(), t.materialLibraries);
|
|
1604
|
+
else if (hi.test(c))
|
|
1605
|
+
t.materialLibraries.push(c.substring(7).trim());
|
|
1606
|
+
else if (di.test(c))
|
|
1569
1607
|
console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');
|
|
1570
1608
|
else if (u === "s") {
|
|
1571
|
-
if (n =
|
|
1572
|
-
const
|
|
1573
|
-
t.object.smooth =
|
|
1609
|
+
if (n = c.split(" "), n.length > 1) {
|
|
1610
|
+
const d = n[1].trim().toLowerCase();
|
|
1611
|
+
t.object.smooth = d !== "0" && d !== "off";
|
|
1574
1612
|
} else
|
|
1575
1613
|
t.object.smooth = !0;
|
|
1576
|
-
const
|
|
1577
|
-
|
|
1614
|
+
const h = t.object.currentMaterial();
|
|
1615
|
+
h && (h.smooth = t.object.smooth);
|
|
1578
1616
|
} else {
|
|
1579
|
-
if (
|
|
1580
|
-
console.warn('THREE.OBJLoader: Unexpected line: "' +
|
|
1617
|
+
if (c === "\0") continue;
|
|
1618
|
+
console.warn('THREE.OBJLoader: Unexpected line: "' + c + '"');
|
|
1581
1619
|
}
|
|
1582
1620
|
}
|
|
1583
1621
|
t.finalize();
|
|
1584
|
-
const i = new
|
|
1622
|
+
const i = new at();
|
|
1585
1623
|
if (i.materialLibraries = [].concat(t.materialLibraries), !(t.objects.length === 1 && t.objects[0].geometry.vertices.length === 0) === !0)
|
|
1586
1624
|
for (let a = 0, l = t.objects.length; a < l; a++) {
|
|
1587
|
-
const
|
|
1625
|
+
const c = t.objects[a], u = c.geometry, h = c.materials, d = u.type === "Line", m = u.type === "Points";
|
|
1588
1626
|
let w = !1;
|
|
1589
1627
|
if (u.vertices.length === 0) continue;
|
|
1590
|
-
const f = new
|
|
1591
|
-
f.setAttribute("position", new
|
|
1628
|
+
const f = new Re();
|
|
1629
|
+
f.setAttribute("position", new pe(u.vertices, 3)), u.normals.length > 0 && f.setAttribute("normal", new pe(u.normals, 3)), u.colors.length > 0 && (w = !0, f.setAttribute("color", new pe(u.colors, 3))), u.hasUVIndices === !0 && f.setAttribute("uv", new pe(u.uvs, 2));
|
|
1592
1630
|
const y = [];
|
|
1593
|
-
for (let b = 0,
|
|
1594
|
-
const
|
|
1631
|
+
for (let b = 0, T = h.length; b < T; b++) {
|
|
1632
|
+
const M = h[b], R = M.name + "_" + M.smooth + "_" + w;
|
|
1595
1633
|
let v = t.materials[R];
|
|
1596
1634
|
if (this.materials !== null) {
|
|
1597
|
-
if (v = this.materials.create(
|
|
1598
|
-
const I = new
|
|
1635
|
+
if (v = this.materials.create(M.name), d && v && !(v instanceof He)) {
|
|
1636
|
+
const I = new He();
|
|
1599
1637
|
Fe.prototype.copy.call(I, v), I.color.copy(v.color), v = I;
|
|
1600
|
-
} else if (m && v && !(v instanceof
|
|
1601
|
-
const I = new
|
|
1638
|
+
} else if (m && v && !(v instanceof Oe)) {
|
|
1639
|
+
const I = new Oe({ size: 10, sizeAttenuation: !1 });
|
|
1602
1640
|
Fe.prototype.copy.call(I, v), I.color.copy(v.color), I.map = v.map, v = I;
|
|
1603
1641
|
}
|
|
1604
1642
|
}
|
|
1605
|
-
v === void 0 && (
|
|
1643
|
+
v === void 0 && (d ? v = new He() : m ? v = new Oe({ size: 1, sizeAttenuation: !1 }) : v = new Bn(), v.name = M.name, v.flatShading = !M.smooth, v.vertexColors = w, t.materials[R] = v), y.push(v);
|
|
1606
1644
|
}
|
|
1607
|
-
let
|
|
1645
|
+
let p;
|
|
1608
1646
|
if (y.length > 1) {
|
|
1609
|
-
for (let b = 0,
|
|
1610
|
-
const
|
|
1611
|
-
f.addGroup(
|
|
1647
|
+
for (let b = 0, T = h.length; b < T; b++) {
|
|
1648
|
+
const M = h[b];
|
|
1649
|
+
f.addGroup(M.groupStart, M.groupCount, b);
|
|
1612
1650
|
}
|
|
1613
|
-
|
|
1651
|
+
d ? p = new Et(f, y) : m ? p = new lt(f, y) : p = new E(f, y);
|
|
1614
1652
|
} else
|
|
1615
|
-
|
|
1616
|
-
|
|
1653
|
+
d ? p = new Et(f, y[0]) : m ? p = new lt(f, y[0]) : p = new E(f, y[0]);
|
|
1654
|
+
p.name = c.name, i.add(p);
|
|
1617
1655
|
}
|
|
1618
1656
|
else if (t.vertices.length > 0) {
|
|
1619
|
-
const a = new
|
|
1620
|
-
l.setAttribute("position", new
|
|
1621
|
-
const
|
|
1622
|
-
i.add(
|
|
1657
|
+
const a = new Oe({ size: 1, sizeAttenuation: !1 }), l = new Re();
|
|
1658
|
+
l.setAttribute("position", new pe(t.vertices, 3)), t.colors.length > 0 && t.colors[0] !== void 0 && (l.setAttribute("color", new pe(t.colors, 3)), a.vertexColors = !0);
|
|
1659
|
+
const c = new lt(l, a);
|
|
1660
|
+
i.add(c);
|
|
1623
1661
|
}
|
|
1624
1662
|
return i;
|
|
1625
1663
|
}
|
|
1626
1664
|
}
|
|
1627
|
-
function
|
|
1628
|
-
if (e ===
|
|
1665
|
+
function tn(r, e) {
|
|
1666
|
+
if (e === Yn)
|
|
1629
1667
|
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), r;
|
|
1630
|
-
if (e ===
|
|
1668
|
+
if (e === Mt || e === mn) {
|
|
1631
1669
|
let t = r.getIndex();
|
|
1632
1670
|
if (t === null) {
|
|
1633
1671
|
const o = [], a = r.getAttribute("position");
|
|
@@ -1639,7 +1677,7 @@ function Jt(r, e) {
|
|
|
1639
1677
|
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), r;
|
|
1640
1678
|
}
|
|
1641
1679
|
const s = t.count - 2, n = [];
|
|
1642
|
-
if (e ===
|
|
1680
|
+
if (e === Mt)
|
|
1643
1681
|
for (let o = 1; o <= s; o++)
|
|
1644
1682
|
n.push(t.getX(0)), n.push(t.getX(o)), n.push(t.getX(o + 1));
|
|
1645
1683
|
else
|
|
@@ -1651,9 +1689,9 @@ function Jt(r, e) {
|
|
|
1651
1689
|
} else
|
|
1652
1690
|
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e), r;
|
|
1653
1691
|
}
|
|
1654
|
-
function
|
|
1692
|
+
function mi(r) {
|
|
1655
1693
|
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), s = r.clone();
|
|
1656
|
-
return
|
|
1694
|
+
return vn(r, s, function(n, i) {
|
|
1657
1695
|
e.set(i, n), t.set(n, i);
|
|
1658
1696
|
}), s.traverse(function(n) {
|
|
1659
1697
|
if (!n.isSkinnedMesh) return;
|
|
@@ -1663,12 +1701,12 @@ function pi(r) {
|
|
|
1663
1701
|
}), i.bind(i.skeleton, i.bindMatrix);
|
|
1664
1702
|
}), s;
|
|
1665
1703
|
}
|
|
1666
|
-
function
|
|
1704
|
+
function vn(r, e, t) {
|
|
1667
1705
|
t(r, e);
|
|
1668
1706
|
for (let s = 0; s < r.children.length; s++)
|
|
1669
|
-
|
|
1707
|
+
vn(r.children[s], e.children[s], t);
|
|
1670
1708
|
}
|
|
1671
|
-
class
|
|
1709
|
+
class gi extends It {
|
|
1672
1710
|
/**
|
|
1673
1711
|
* Constructs a new glTF loader.
|
|
1674
1712
|
*
|
|
@@ -1676,39 +1714,39 @@ class fi extends pn {
|
|
|
1676
1714
|
*/
|
|
1677
1715
|
constructor(e) {
|
|
1678
1716
|
super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(t) {
|
|
1679
|
-
return new
|
|
1680
|
-
}), this.register(function(t) {
|
|
1681
|
-
return new wi(t);
|
|
1682
|
-
}), this.register(function(t) {
|
|
1683
|
-
return new Pi(t);
|
|
1717
|
+
return new Ti(t);
|
|
1684
1718
|
}), this.register(function(t) {
|
|
1685
|
-
return new
|
|
1719
|
+
return new xi(t);
|
|
1686
1720
|
}), this.register(function(t) {
|
|
1687
1721
|
return new Ii(t);
|
|
1688
1722
|
}), this.register(function(t) {
|
|
1689
|
-
return new
|
|
1723
|
+
return new Ci(t);
|
|
1690
1724
|
}), this.register(function(t) {
|
|
1691
|
-
return new
|
|
1725
|
+
return new Di(t);
|
|
1692
1726
|
}), this.register(function(t) {
|
|
1693
|
-
return new
|
|
1727
|
+
return new Mi(t);
|
|
1694
1728
|
}), this.register(function(t) {
|
|
1695
1729
|
return new vi(t);
|
|
1696
|
-
}), this.register(function(t) {
|
|
1697
|
-
return new _i(t);
|
|
1698
1730
|
}), this.register(function(t) {
|
|
1699
1731
|
return new Si(t);
|
|
1700
1732
|
}), this.register(function(t) {
|
|
1701
|
-
return new
|
|
1733
|
+
return new Ai(t);
|
|
1734
|
+
}), this.register(function(t) {
|
|
1735
|
+
return new wi(t);
|
|
1702
1736
|
}), this.register(function(t) {
|
|
1703
1737
|
return new Ri(t);
|
|
1704
1738
|
}), this.register(function(t) {
|
|
1705
|
-
return new
|
|
1739
|
+
return new Ei(t);
|
|
1740
|
+
}), this.register(function(t) {
|
|
1741
|
+
return new Li(t);
|
|
1742
|
+
}), this.register(function(t) {
|
|
1743
|
+
return new Pi(t);
|
|
1706
1744
|
}), this.register(function(t) {
|
|
1707
|
-
return new
|
|
1745
|
+
return new _i(t);
|
|
1708
1746
|
}), this.register(function(t) {
|
|
1709
|
-
return new
|
|
1747
|
+
return new nn(t, A.EXT_MESHOPT_COMPRESSION);
|
|
1710
1748
|
}), this.register(function(t) {
|
|
1711
|
-
return new
|
|
1749
|
+
return new nn(t, A.KHR_MESHOPT_COMPRESSION);
|
|
1712
1750
|
}), this.register(function(t) {
|
|
1713
1751
|
return new Oi(t);
|
|
1714
1752
|
});
|
|
@@ -1728,17 +1766,17 @@ class fi extends pn {
|
|
|
1728
1766
|
if (this.resourcePath !== "")
|
|
1729
1767
|
o = this.resourcePath;
|
|
1730
1768
|
else if (this.path !== "") {
|
|
1731
|
-
const
|
|
1732
|
-
o =
|
|
1769
|
+
const c = Ue.extractUrlBase(e);
|
|
1770
|
+
o = Ue.resolveURL(c, this.path);
|
|
1733
1771
|
} else
|
|
1734
|
-
o =
|
|
1772
|
+
o = Ue.extractUrlBase(e);
|
|
1735
1773
|
this.manager.itemStart(e);
|
|
1736
|
-
const a = function(
|
|
1737
|
-
n ? n(
|
|
1738
|
-
}, l = new
|
|
1739
|
-
l.setPath(this.path), l.setResponseType("arraybuffer"), l.setRequestHeader(this.requestHeader), l.setWithCredentials(this.withCredentials), l.load(e, function(
|
|
1774
|
+
const a = function(c) {
|
|
1775
|
+
n ? n(c) : console.error(c), i.manager.itemError(e), i.manager.itemEnd(e);
|
|
1776
|
+
}, l = new Ke(this.manager);
|
|
1777
|
+
l.setPath(this.path), l.setResponseType("arraybuffer"), l.setRequestHeader(this.requestHeader), l.setWithCredentials(this.withCredentials), l.load(e, function(c) {
|
|
1740
1778
|
try {
|
|
1741
|
-
i.parse(
|
|
1779
|
+
i.parse(c, o, function(u) {
|
|
1742
1780
|
t(u), i.manager.itemEnd(e);
|
|
1743
1781
|
}, a);
|
|
1744
1782
|
} catch (u) {
|
|
@@ -1810,11 +1848,11 @@ class fi extends pn {
|
|
|
1810
1848
|
if (typeof e == "string")
|
|
1811
1849
|
i = JSON.parse(e);
|
|
1812
1850
|
else if (e instanceof ArrayBuffer)
|
|
1813
|
-
if (l.decode(new Uint8Array(e, 0, 4)) ===
|
|
1851
|
+
if (l.decode(new Uint8Array(e, 0, 4)) === Sn) {
|
|
1814
1852
|
try {
|
|
1815
|
-
o[A.KHR_BINARY_GLTF] = new
|
|
1816
|
-
} catch (
|
|
1817
|
-
n && n(
|
|
1853
|
+
o[A.KHR_BINARY_GLTF] = new ki(e);
|
|
1854
|
+
} catch (h) {
|
|
1855
|
+
n && n(h);
|
|
1818
1856
|
return;
|
|
1819
1857
|
}
|
|
1820
1858
|
i = JSON.parse(o[A.KHR_BINARY_GLTF].content);
|
|
@@ -1826,7 +1864,7 @@ class fi extends pn {
|
|
|
1826
1864
|
n && n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
|
|
1827
1865
|
return;
|
|
1828
1866
|
}
|
|
1829
|
-
const
|
|
1867
|
+
const c = new Zi(i, {
|
|
1830
1868
|
path: t || this.resourcePath || "",
|
|
1831
1869
|
crossOrigin: this.crossOrigin,
|
|
1832
1870
|
requestHeader: this.requestHeader,
|
|
@@ -1834,32 +1872,32 @@ class fi extends pn {
|
|
|
1834
1872
|
ktx2Loader: this.ktx2Loader,
|
|
1835
1873
|
meshoptDecoder: this.meshoptDecoder
|
|
1836
1874
|
});
|
|
1837
|
-
|
|
1875
|
+
c.fileLoader.setRequestHeader(this.requestHeader);
|
|
1838
1876
|
for (let u = 0; u < this.pluginCallbacks.length; u++) {
|
|
1839
|
-
const
|
|
1840
|
-
|
|
1877
|
+
const h = this.pluginCallbacks[u](c);
|
|
1878
|
+
h.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"), a[h.name] = h, o[h.name] = !0;
|
|
1841
1879
|
}
|
|
1842
1880
|
if (i.extensionsUsed)
|
|
1843
1881
|
for (let u = 0; u < i.extensionsUsed.length; ++u) {
|
|
1844
|
-
const
|
|
1845
|
-
switch (
|
|
1882
|
+
const h = i.extensionsUsed[u], d = i.extensionsRequired || [];
|
|
1883
|
+
switch (h) {
|
|
1846
1884
|
case A.KHR_MATERIALS_UNLIT:
|
|
1847
|
-
o[
|
|
1885
|
+
o[h] = new bi();
|
|
1848
1886
|
break;
|
|
1849
1887
|
case A.KHR_DRACO_MESH_COMPRESSION:
|
|
1850
|
-
o[
|
|
1888
|
+
o[h] = new Ni(i, this.dracoLoader);
|
|
1851
1889
|
break;
|
|
1852
1890
|
case A.KHR_TEXTURE_TRANSFORM:
|
|
1853
|
-
o[
|
|
1891
|
+
o[h] = new ji();
|
|
1854
1892
|
break;
|
|
1855
1893
|
case A.KHR_MESH_QUANTIZATION:
|
|
1856
|
-
o[
|
|
1894
|
+
o[h] = new Hi();
|
|
1857
1895
|
break;
|
|
1858
1896
|
default:
|
|
1859
|
-
|
|
1897
|
+
d.indexOf(h) >= 0 && a[h] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + h + '".');
|
|
1860
1898
|
}
|
|
1861
1899
|
}
|
|
1862
|
-
|
|
1900
|
+
c.setExtensions(o), c.setPlugins(a), c.parse(s, n);
|
|
1863
1901
|
}
|
|
1864
1902
|
/**
|
|
1865
1903
|
* Async version of {@link GLTFLoader#parse}.
|
|
@@ -1876,7 +1914,7 @@ class fi extends pn {
|
|
|
1876
1914
|
});
|
|
1877
1915
|
}
|
|
1878
1916
|
}
|
|
1879
|
-
function
|
|
1917
|
+
function yi() {
|
|
1880
1918
|
let r = {};
|
|
1881
1919
|
return {
|
|
1882
1920
|
get: function(e) {
|
|
@@ -1893,7 +1931,7 @@ function mi() {
|
|
|
1893
1931
|
}
|
|
1894
1932
|
};
|
|
1895
1933
|
}
|
|
1896
|
-
function
|
|
1934
|
+
function N(r, e, t) {
|
|
1897
1935
|
const s = r.json.materials[e];
|
|
1898
1936
|
return s.extensions && s.extensions[t] ? s.extensions[t] : null;
|
|
1899
1937
|
}
|
|
@@ -1922,7 +1960,7 @@ const A = {
|
|
|
1922
1960
|
KHR_MESHOPT_COMPRESSION: "KHR_meshopt_compression",
|
|
1923
1961
|
EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing"
|
|
1924
1962
|
};
|
|
1925
|
-
class
|
|
1963
|
+
class _i {
|
|
1926
1964
|
constructor(e) {
|
|
1927
1965
|
this.parser = e, this.name = A.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
|
|
1928
1966
|
}
|
|
@@ -1938,24 +1976,24 @@ class gi {
|
|
|
1938
1976
|
let n = t.cache.get(s);
|
|
1939
1977
|
if (n) return n;
|
|
1940
1978
|
const i = t.json, l = ((i.extensions && i.extensions[this.name] || {}).lights || [])[e];
|
|
1941
|
-
let
|
|
1942
|
-
const u = new
|
|
1943
|
-
l.color !== void 0 && u.setRGB(l.color[0], l.color[1], l.color[2],
|
|
1944
|
-
const
|
|
1979
|
+
let c;
|
|
1980
|
+
const u = new he(16777215);
|
|
1981
|
+
l.color !== void 0 && u.setRGB(l.color[0], l.color[1], l.color[2], ie);
|
|
1982
|
+
const h = l.range !== void 0 ? l.range : 0;
|
|
1945
1983
|
switch (l.type) {
|
|
1946
1984
|
case "directional":
|
|
1947
|
-
|
|
1985
|
+
c = new Zn(u), c.target.position.set(0, 0, -1), c.add(c.target);
|
|
1948
1986
|
break;
|
|
1949
1987
|
case "point":
|
|
1950
|
-
|
|
1988
|
+
c = new Vn(u), c.distance = h;
|
|
1951
1989
|
break;
|
|
1952
1990
|
case "spot":
|
|
1953
|
-
|
|
1991
|
+
c = new Kn(u), c.distance = h, l.spot = l.spot || {}, l.spot.innerConeAngle = l.spot.innerConeAngle !== void 0 ? l.spot.innerConeAngle : 0, l.spot.outerConeAngle = l.spot.outerConeAngle !== void 0 ? l.spot.outerConeAngle : Math.PI / 4, c.angle = l.spot.outerConeAngle, c.penumbra = 1 - l.spot.innerConeAngle / l.spot.outerConeAngle, c.target.position.set(0, 0, -1), c.add(c.target);
|
|
1954
1992
|
break;
|
|
1955
1993
|
default:
|
|
1956
1994
|
throw new Error("THREE.GLTFLoader: Unexpected light type: " + l.type);
|
|
1957
1995
|
}
|
|
1958
|
-
return
|
|
1996
|
+
return c.position.set(0, 0, 0), se(c, l), l.intensity !== void 0 && (c.intensity = l.intensity), c.name = t.createUniqueName(l.name || "light_" + e), n = Promise.resolve(c), t.cache.add(s, n), n;
|
|
1959
1997
|
}
|
|
1960
1998
|
getDependency(e, t) {
|
|
1961
1999
|
if (e === "light")
|
|
@@ -1968,185 +2006,185 @@ class gi {
|
|
|
1968
2006
|
});
|
|
1969
2007
|
}
|
|
1970
2008
|
}
|
|
1971
|
-
class
|
|
2009
|
+
class bi {
|
|
1972
2010
|
constructor() {
|
|
1973
2011
|
this.name = A.KHR_MATERIALS_UNLIT;
|
|
1974
2012
|
}
|
|
1975
2013
|
getMaterialType() {
|
|
1976
|
-
return
|
|
2014
|
+
return we;
|
|
1977
2015
|
}
|
|
1978
2016
|
extendParams(e, t, s) {
|
|
1979
2017
|
const n = [];
|
|
1980
|
-
e.color = new
|
|
2018
|
+
e.color = new he(1, 1, 1), e.opacity = 1;
|
|
1981
2019
|
const i = t.pbrMetallicRoughness;
|
|
1982
2020
|
if (i) {
|
|
1983
2021
|
if (Array.isArray(i.baseColorFactor)) {
|
|
1984
2022
|
const o = i.baseColorFactor;
|
|
1985
|
-
e.color.setRGB(o[0], o[1], o[2],
|
|
2023
|
+
e.color.setRGB(o[0], o[1], o[2], ie), e.opacity = o[3];
|
|
1986
2024
|
}
|
|
1987
|
-
i.baseColorTexture !== void 0 && n.push(s.assignTexture(e, "map", i.baseColorTexture,
|
|
2025
|
+
i.baseColorTexture !== void 0 && n.push(s.assignTexture(e, "map", i.baseColorTexture, ce));
|
|
1988
2026
|
}
|
|
1989
2027
|
return Promise.all(n);
|
|
1990
2028
|
}
|
|
1991
2029
|
}
|
|
1992
|
-
class
|
|
2030
|
+
class wi {
|
|
1993
2031
|
constructor(e) {
|
|
1994
2032
|
this.parser = e, this.name = A.KHR_MATERIALS_EMISSIVE_STRENGTH;
|
|
1995
2033
|
}
|
|
1996
2034
|
extendMaterialParams(e, t) {
|
|
1997
|
-
const s =
|
|
2035
|
+
const s = N(this.parser, e, this.name);
|
|
1998
2036
|
return s === null || s.emissiveStrength !== void 0 && (t.emissiveIntensity = s.emissiveStrength), Promise.resolve();
|
|
1999
2037
|
}
|
|
2000
2038
|
}
|
|
2001
|
-
class
|
|
2039
|
+
class Ti {
|
|
2002
2040
|
constructor(e) {
|
|
2003
2041
|
this.parser = e, this.name = A.KHR_MATERIALS_CLEARCOAT;
|
|
2004
2042
|
}
|
|
2005
2043
|
getMaterialType(e) {
|
|
2006
|
-
return
|
|
2044
|
+
return N(this.parser, e, this.name) !== null ? oe : null;
|
|
2007
2045
|
}
|
|
2008
2046
|
extendMaterialParams(e, t) {
|
|
2009
|
-
const s =
|
|
2047
|
+
const s = N(this.parser, e, this.name);
|
|
2010
2048
|
if (s === null) return Promise.resolve();
|
|
2011
2049
|
const n = [];
|
|
2012
2050
|
if (s.clearcoatFactor !== void 0 && (t.clearcoat = s.clearcoatFactor), s.clearcoatTexture !== void 0 && n.push(this.parser.assignTexture(t, "clearcoatMap", s.clearcoatTexture)), s.clearcoatRoughnessFactor !== void 0 && (t.clearcoatRoughness = s.clearcoatRoughnessFactor), s.clearcoatRoughnessTexture !== void 0 && n.push(this.parser.assignTexture(t, "clearcoatRoughnessMap", s.clearcoatRoughnessTexture)), s.clearcoatNormalTexture !== void 0 && (n.push(this.parser.assignTexture(t, "clearcoatNormalMap", s.clearcoatNormalTexture)), s.clearcoatNormalTexture.scale !== void 0)) {
|
|
2013
2051
|
const i = s.clearcoatNormalTexture.scale;
|
|
2014
|
-
t.clearcoatNormalScale = new
|
|
2052
|
+
t.clearcoatNormalScale = new Z(i, i);
|
|
2015
2053
|
}
|
|
2016
2054
|
return Promise.all(n);
|
|
2017
2055
|
}
|
|
2018
2056
|
}
|
|
2019
|
-
class
|
|
2057
|
+
class xi {
|
|
2020
2058
|
constructor(e) {
|
|
2021
2059
|
this.parser = e, this.name = A.KHR_MATERIALS_DISPERSION;
|
|
2022
2060
|
}
|
|
2023
2061
|
getMaterialType(e) {
|
|
2024
|
-
return
|
|
2062
|
+
return N(this.parser, e, this.name) !== null ? oe : null;
|
|
2025
2063
|
}
|
|
2026
2064
|
extendMaterialParams(e, t) {
|
|
2027
|
-
const s =
|
|
2065
|
+
const s = N(this.parser, e, this.name);
|
|
2028
2066
|
return s === null || (t.dispersion = s.dispersion !== void 0 ? s.dispersion : 0), Promise.resolve();
|
|
2029
2067
|
}
|
|
2030
2068
|
}
|
|
2031
|
-
class
|
|
2069
|
+
class Ei {
|
|
2032
2070
|
constructor(e) {
|
|
2033
2071
|
this.parser = e, this.name = A.KHR_MATERIALS_IRIDESCENCE;
|
|
2034
2072
|
}
|
|
2035
2073
|
getMaterialType(e) {
|
|
2036
|
-
return
|
|
2074
|
+
return N(this.parser, e, this.name) !== null ? oe : null;
|
|
2037
2075
|
}
|
|
2038
2076
|
extendMaterialParams(e, t) {
|
|
2039
|
-
const s =
|
|
2077
|
+
const s = N(this.parser, e, this.name);
|
|
2040
2078
|
if (s === null) return Promise.resolve();
|
|
2041
2079
|
const n = [];
|
|
2042
2080
|
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);
|
|
2043
2081
|
}
|
|
2044
2082
|
}
|
|
2045
|
-
class
|
|
2083
|
+
class Mi {
|
|
2046
2084
|
constructor(e) {
|
|
2047
2085
|
this.parser = e, this.name = A.KHR_MATERIALS_SHEEN;
|
|
2048
2086
|
}
|
|
2049
2087
|
getMaterialType(e) {
|
|
2050
|
-
return
|
|
2088
|
+
return N(this.parser, e, this.name) !== null ? oe : null;
|
|
2051
2089
|
}
|
|
2052
2090
|
extendMaterialParams(e, t) {
|
|
2053
|
-
const s =
|
|
2091
|
+
const s = N(this.parser, e, this.name);
|
|
2054
2092
|
if (s === null) return Promise.resolve();
|
|
2055
2093
|
const n = [];
|
|
2056
|
-
if (t.sheenColor = new
|
|
2094
|
+
if (t.sheenColor = new he(0, 0, 0), t.sheenRoughness = 0, t.sheen = 1, s.sheenColorFactor !== void 0) {
|
|
2057
2095
|
const i = s.sheenColorFactor;
|
|
2058
|
-
t.sheenColor.setRGB(i[0], i[1], i[2],
|
|
2096
|
+
t.sheenColor.setRGB(i[0], i[1], i[2], ie);
|
|
2059
2097
|
}
|
|
2060
|
-
return s.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = s.sheenRoughnessFactor), s.sheenColorTexture !== void 0 && n.push(this.parser.assignTexture(t, "sheenColorMap", s.sheenColorTexture,
|
|
2098
|
+
return s.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = s.sheenRoughnessFactor), s.sheenColorTexture !== void 0 && n.push(this.parser.assignTexture(t, "sheenColorMap", s.sheenColorTexture, ce)), s.sheenRoughnessTexture !== void 0 && n.push(this.parser.assignTexture(t, "sheenRoughnessMap", s.sheenRoughnessTexture)), Promise.all(n);
|
|
2061
2099
|
}
|
|
2062
2100
|
}
|
|
2063
|
-
class
|
|
2101
|
+
class vi {
|
|
2064
2102
|
constructor(e) {
|
|
2065
2103
|
this.parser = e, this.name = A.KHR_MATERIALS_TRANSMISSION;
|
|
2066
2104
|
}
|
|
2067
2105
|
getMaterialType(e) {
|
|
2068
|
-
return
|
|
2106
|
+
return N(this.parser, e, this.name) !== null ? oe : null;
|
|
2069
2107
|
}
|
|
2070
2108
|
extendMaterialParams(e, t) {
|
|
2071
|
-
const s =
|
|
2109
|
+
const s = N(this.parser, e, this.name);
|
|
2072
2110
|
if (s === null) return Promise.resolve();
|
|
2073
2111
|
const n = [];
|
|
2074
2112
|
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);
|
|
2075
2113
|
}
|
|
2076
2114
|
}
|
|
2077
|
-
class
|
|
2115
|
+
class Si {
|
|
2078
2116
|
constructor(e) {
|
|
2079
2117
|
this.parser = e, this.name = A.KHR_MATERIALS_VOLUME;
|
|
2080
2118
|
}
|
|
2081
2119
|
getMaterialType(e) {
|
|
2082
|
-
return
|
|
2120
|
+
return N(this.parser, e, this.name) !== null ? oe : null;
|
|
2083
2121
|
}
|
|
2084
2122
|
extendMaterialParams(e, t) {
|
|
2085
|
-
const s =
|
|
2123
|
+
const s = N(this.parser, e, this.name);
|
|
2086
2124
|
if (s === null) return Promise.resolve();
|
|
2087
2125
|
const n = [];
|
|
2088
2126
|
t.thickness = s.thicknessFactor !== void 0 ? s.thicknessFactor : 0, s.thicknessTexture !== void 0 && n.push(this.parser.assignTexture(t, "thicknessMap", s.thicknessTexture)), t.attenuationDistance = s.attenuationDistance || 1 / 0;
|
|
2089
2127
|
const i = s.attenuationColor || [1, 1, 1];
|
|
2090
|
-
return t.attenuationColor = new
|
|
2128
|
+
return t.attenuationColor = new he().setRGB(i[0], i[1], i[2], ie), Promise.all(n);
|
|
2091
2129
|
}
|
|
2092
2130
|
}
|
|
2093
|
-
class
|
|
2131
|
+
class Ai {
|
|
2094
2132
|
constructor(e) {
|
|
2095
2133
|
this.parser = e, this.name = A.KHR_MATERIALS_IOR;
|
|
2096
2134
|
}
|
|
2097
2135
|
getMaterialType(e) {
|
|
2098
|
-
return
|
|
2136
|
+
return N(this.parser, e, this.name) !== null ? oe : null;
|
|
2099
2137
|
}
|
|
2100
2138
|
extendMaterialParams(e, t) {
|
|
2101
|
-
const s =
|
|
2139
|
+
const s = N(this.parser, e, this.name);
|
|
2102
2140
|
return s === null || (t.ior = s.ior !== void 0 ? s.ior : 1.5, t.ior === 0 && (t.ior = 1e3)), Promise.resolve();
|
|
2103
2141
|
}
|
|
2104
2142
|
}
|
|
2105
|
-
class
|
|
2143
|
+
class Ri {
|
|
2106
2144
|
constructor(e) {
|
|
2107
2145
|
this.parser = e, this.name = A.KHR_MATERIALS_SPECULAR;
|
|
2108
2146
|
}
|
|
2109
2147
|
getMaterialType(e) {
|
|
2110
|
-
return
|
|
2148
|
+
return N(this.parser, e, this.name) !== null ? oe : null;
|
|
2111
2149
|
}
|
|
2112
2150
|
extendMaterialParams(e, t) {
|
|
2113
|
-
const s =
|
|
2151
|
+
const s = N(this.parser, e, this.name);
|
|
2114
2152
|
if (s === null) return Promise.resolve();
|
|
2115
2153
|
const n = [];
|
|
2116
2154
|
t.specularIntensity = s.specularFactor !== void 0 ? s.specularFactor : 1, s.specularTexture !== void 0 && n.push(this.parser.assignTexture(t, "specularIntensityMap", s.specularTexture));
|
|
2117
2155
|
const i = s.specularColorFactor || [1, 1, 1];
|
|
2118
|
-
return t.specularColor = new
|
|
2156
|
+
return t.specularColor = new he().setRGB(i[0], i[1], i[2], ie), s.specularColorTexture !== void 0 && n.push(this.parser.assignTexture(t, "specularColorMap", s.specularColorTexture, ce)), Promise.all(n);
|
|
2119
2157
|
}
|
|
2120
2158
|
}
|
|
2121
|
-
class
|
|
2159
|
+
class Pi {
|
|
2122
2160
|
constructor(e) {
|
|
2123
2161
|
this.parser = e, this.name = A.EXT_MATERIALS_BUMP;
|
|
2124
2162
|
}
|
|
2125
2163
|
getMaterialType(e) {
|
|
2126
|
-
return
|
|
2164
|
+
return N(this.parser, e, this.name) !== null ? oe : null;
|
|
2127
2165
|
}
|
|
2128
2166
|
extendMaterialParams(e, t) {
|
|
2129
|
-
const s =
|
|
2167
|
+
const s = N(this.parser, e, this.name);
|
|
2130
2168
|
if (s === null) return Promise.resolve();
|
|
2131
2169
|
const n = [];
|
|
2132
2170
|
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);
|
|
2133
2171
|
}
|
|
2134
2172
|
}
|
|
2135
|
-
class
|
|
2173
|
+
class Li {
|
|
2136
2174
|
constructor(e) {
|
|
2137
2175
|
this.parser = e, this.name = A.KHR_MATERIALS_ANISOTROPY;
|
|
2138
2176
|
}
|
|
2139
2177
|
getMaterialType(e) {
|
|
2140
|
-
return
|
|
2178
|
+
return N(this.parser, e, this.name) !== null ? oe : null;
|
|
2141
2179
|
}
|
|
2142
2180
|
extendMaterialParams(e, t) {
|
|
2143
|
-
const s =
|
|
2181
|
+
const s = N(this.parser, e, this.name);
|
|
2144
2182
|
if (s === null) return Promise.resolve();
|
|
2145
2183
|
const n = [];
|
|
2146
2184
|
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);
|
|
2147
2185
|
}
|
|
2148
2186
|
}
|
|
2149
|
-
class
|
|
2187
|
+
class Ii {
|
|
2150
2188
|
constructor(e) {
|
|
2151
2189
|
this.parser = e, this.name = A.KHR_TEXTURE_BASISU;
|
|
2152
2190
|
}
|
|
@@ -2163,7 +2201,7 @@ class Pi {
|
|
|
2163
2201
|
return t.loadTextureImage(e, i.source, o);
|
|
2164
2202
|
}
|
|
2165
2203
|
}
|
|
2166
|
-
class
|
|
2204
|
+
class Ci {
|
|
2167
2205
|
constructor(e) {
|
|
2168
2206
|
this.parser = e, this.name = A.EXT_TEXTURE_WEBP;
|
|
2169
2207
|
}
|
|
@@ -2174,13 +2212,13 @@ class Li {
|
|
|
2174
2212
|
const o = i.extensions[t], a = n.images[o.source];
|
|
2175
2213
|
let l = s.textureLoader;
|
|
2176
2214
|
if (a.uri) {
|
|
2177
|
-
const
|
|
2178
|
-
|
|
2215
|
+
const c = s.options.manager.getHandler(a.uri);
|
|
2216
|
+
c !== null && (l = c);
|
|
2179
2217
|
}
|
|
2180
2218
|
return s.loadTextureImage(e, o.source, l);
|
|
2181
2219
|
}
|
|
2182
2220
|
}
|
|
2183
|
-
class
|
|
2221
|
+
class Di {
|
|
2184
2222
|
constructor(e) {
|
|
2185
2223
|
this.parser = e, this.name = A.EXT_TEXTURE_AVIF;
|
|
2186
2224
|
}
|
|
@@ -2191,13 +2229,13 @@ class Ii {
|
|
|
2191
2229
|
const o = i.extensions[t], a = n.images[o.source];
|
|
2192
2230
|
let l = s.textureLoader;
|
|
2193
2231
|
if (a.uri) {
|
|
2194
|
-
const
|
|
2195
|
-
|
|
2232
|
+
const c = s.options.manager.getHandler(a.uri);
|
|
2233
|
+
c !== null && (l = c);
|
|
2196
2234
|
}
|
|
2197
2235
|
return s.loadTextureImage(e, o.source, l);
|
|
2198
2236
|
}
|
|
2199
2237
|
}
|
|
2200
|
-
class
|
|
2238
|
+
class nn {
|
|
2201
2239
|
constructor(e, t) {
|
|
2202
2240
|
this.name = t, this.parser = e;
|
|
2203
2241
|
}
|
|
@@ -2211,12 +2249,12 @@ class en {
|
|
|
2211
2249
|
return null;
|
|
2212
2250
|
}
|
|
2213
2251
|
return i.then(function(a) {
|
|
2214
|
-
const l = n.byteOffset || 0,
|
|
2215
|
-
return o.decodeGltfBufferAsync ? o.decodeGltfBufferAsync(u,
|
|
2252
|
+
const l = n.byteOffset || 0, c = n.byteLength || 0, u = n.count, h = n.byteStride, d = new Uint8Array(a, l, c);
|
|
2253
|
+
return o.decodeGltfBufferAsync ? o.decodeGltfBufferAsync(u, h, d, n.mode, n.filter).then(function(m) {
|
|
2216
2254
|
return m.buffer;
|
|
2217
2255
|
}) : o.ready.then(function() {
|
|
2218
|
-
const m = new ArrayBuffer(u *
|
|
2219
|
-
return o.decodeGltfBuffer(new Uint8Array(m), u,
|
|
2256
|
+
const m = new ArrayBuffer(u * h);
|
|
2257
|
+
return o.decodeGltfBuffer(new Uint8Array(m), u, h, d, n.mode, n.filter), m;
|
|
2220
2258
|
});
|
|
2221
2259
|
});
|
|
2222
2260
|
} else
|
|
@@ -2232,54 +2270,54 @@ class Oi {
|
|
|
2232
2270
|
if (!s.extensions || !s.extensions[this.name] || s.mesh === void 0)
|
|
2233
2271
|
return null;
|
|
2234
2272
|
const n = t.meshes[s.mesh];
|
|
2235
|
-
for (const
|
|
2236
|
-
if (
|
|
2273
|
+
for (const c of n.primitives)
|
|
2274
|
+
if (c.mode !== ee.TRIANGLES && c.mode !== ee.TRIANGLE_STRIP && c.mode !== ee.TRIANGLE_FAN && c.mode !== void 0)
|
|
2237
2275
|
return null;
|
|
2238
2276
|
const o = s.extensions[this.name].attributes, a = [], l = {};
|
|
2239
|
-
for (const
|
|
2240
|
-
a.push(this.parser.getDependency("accessor", o[
|
|
2241
|
-
return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((
|
|
2242
|
-
const u =
|
|
2243
|
-
for (const w of
|
|
2244
|
-
const f = new
|
|
2245
|
-
for (let
|
|
2246
|
-
l.TRANSLATION && y.fromBufferAttribute(l.TRANSLATION,
|
|
2247
|
-
for (const
|
|
2248
|
-
if (
|
|
2249
|
-
const R = l[
|
|
2250
|
-
|
|
2251
|
-
} else
|
|
2252
|
-
|
|
2277
|
+
for (const c in o)
|
|
2278
|
+
a.push(this.parser.getDependency("accessor", o[c]).then((u) => (l[c] = u, l[c])));
|
|
2279
|
+
return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((c) => {
|
|
2280
|
+
const u = c.pop(), h = u.isGroup ? u.children : [u], d = c[0].count, m = [];
|
|
2281
|
+
for (const w of h) {
|
|
2282
|
+
const f = new Pe(), y = new S(), p = new K(), b = new S(1, 1, 1), T = new Wn(w.geometry, w.material, d);
|
|
2283
|
+
for (let M = 0; M < d; M++)
|
|
2284
|
+
l.TRANSLATION && y.fromBufferAttribute(l.TRANSLATION, M), l.ROTATION && p.fromBufferAttribute(l.ROTATION, M), l.SCALE && b.fromBufferAttribute(l.SCALE, M), T.setMatrixAt(M, f.compose(y, p, b));
|
|
2285
|
+
for (const M in l)
|
|
2286
|
+
if (M === "_COLOR_0") {
|
|
2287
|
+
const R = l[M];
|
|
2288
|
+
T.instanceColor = new Qn(R.array, R.itemSize, R.normalized);
|
|
2289
|
+
} else M !== "TRANSLATION" && M !== "ROTATION" && M !== "SCALE" && w.geometry.setAttribute(M, l[M]);
|
|
2290
|
+
Ye.prototype.copy.call(T, w), this.parser.assignFinalMaterial(T), m.push(T);
|
|
2253
2291
|
}
|
|
2254
2292
|
return u.isGroup ? (u.clear(), u.add(...m), u) : m[0];
|
|
2255
2293
|
}));
|
|
2256
2294
|
}
|
|
2257
2295
|
}
|
|
2258
|
-
const
|
|
2259
|
-
class
|
|
2296
|
+
const Sn = "glTF", De = 12, sn = { JSON: 1313821514, BIN: 5130562 };
|
|
2297
|
+
class ki {
|
|
2260
2298
|
constructor(e) {
|
|
2261
2299
|
this.name = A.KHR_BINARY_GLTF, this.content = null, this.body = null;
|
|
2262
|
-
const t = new DataView(e, 0,
|
|
2300
|
+
const t = new DataView(e, 0, De), s = new TextDecoder();
|
|
2263
2301
|
if (this.header = {
|
|
2264
2302
|
magic: s.decode(new Uint8Array(e.slice(0, 4))),
|
|
2265
2303
|
version: t.getUint32(4, !0),
|
|
2266
2304
|
length: t.getUint32(8, !0)
|
|
2267
|
-
}, this.header.magic !==
|
|
2305
|
+
}, this.header.magic !== Sn)
|
|
2268
2306
|
throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
|
|
2269
2307
|
if (this.header.version < 2)
|
|
2270
2308
|
throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
|
|
2271
|
-
const n = this.header.length -
|
|
2309
|
+
const n = this.header.length - De, i = new DataView(e, De);
|
|
2272
2310
|
let o = 0;
|
|
2273
2311
|
for (; o < n; ) {
|
|
2274
2312
|
const a = i.getUint32(o, !0);
|
|
2275
2313
|
o += 4;
|
|
2276
2314
|
const l = i.getUint32(o, !0);
|
|
2277
|
-
if (o += 4, l ===
|
|
2278
|
-
const
|
|
2279
|
-
this.content = s.decode(
|
|
2280
|
-
} else if (l ===
|
|
2281
|
-
const
|
|
2282
|
-
this.body = e.slice(
|
|
2315
|
+
if (o += 4, l === sn.JSON) {
|
|
2316
|
+
const c = new Uint8Array(e, De + o, a);
|
|
2317
|
+
this.content = s.decode(c);
|
|
2318
|
+
} else if (l === sn.BIN) {
|
|
2319
|
+
const c = De + o;
|
|
2320
|
+
this.body = e.slice(c, c + a);
|
|
2283
2321
|
}
|
|
2284
2322
|
o += a;
|
|
2285
2323
|
}
|
|
@@ -2287,39 +2325,39 @@ class Ci {
|
|
|
2287
2325
|
throw new Error("THREE.GLTFLoader: JSON content not found.");
|
|
2288
2326
|
}
|
|
2289
2327
|
}
|
|
2290
|
-
class
|
|
2328
|
+
class Ni {
|
|
2291
2329
|
constructor(e, t) {
|
|
2292
2330
|
if (!t)
|
|
2293
2331
|
throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
|
|
2294
2332
|
this.name = A.KHR_DRACO_MESH_COMPRESSION, this.json = e, this.dracoLoader = t, this.dracoLoader.preload();
|
|
2295
2333
|
}
|
|
2296
2334
|
decodePrimitive(e, t) {
|
|
2297
|
-
const s = this.json, n = this.dracoLoader, i = e.extensions[this.name].bufferView, o = e.extensions[this.name].attributes, a = {}, l = {},
|
|
2335
|
+
const s = this.json, n = this.dracoLoader, i = e.extensions[this.name].bufferView, o = e.extensions[this.name].attributes, a = {}, l = {}, c = {};
|
|
2298
2336
|
for (const u in o) {
|
|
2299
|
-
const
|
|
2300
|
-
a[
|
|
2337
|
+
const h = Pt[u] || u.toLowerCase();
|
|
2338
|
+
a[h] = o[u];
|
|
2301
2339
|
}
|
|
2302
2340
|
for (const u in e.attributes) {
|
|
2303
|
-
const
|
|
2341
|
+
const h = Pt[u] || u.toLowerCase();
|
|
2304
2342
|
if (o[u] !== void 0) {
|
|
2305
|
-
const
|
|
2306
|
-
h
|
|
2343
|
+
const d = s.accessors[e.attributes[u]], m = Ae[d.componentType];
|
|
2344
|
+
c[h] = m.name, l[h] = d.normalized === !0;
|
|
2307
2345
|
}
|
|
2308
2346
|
}
|
|
2309
2347
|
return t.getDependency("bufferView", i).then(function(u) {
|
|
2310
|
-
return new Promise(function(
|
|
2348
|
+
return new Promise(function(h, d) {
|
|
2311
2349
|
n.decodeDracoFile(u, function(m) {
|
|
2312
2350
|
for (const w in m.attributes) {
|
|
2313
2351
|
const f = m.attributes[w], y = l[w];
|
|
2314
2352
|
y !== void 0 && (f.normalized = y);
|
|
2315
2353
|
}
|
|
2316
|
-
|
|
2317
|
-
}, a,
|
|
2354
|
+
h(m);
|
|
2355
|
+
}, a, c, ie, d);
|
|
2318
2356
|
});
|
|
2319
2357
|
});
|
|
2320
2358
|
}
|
|
2321
2359
|
}
|
|
2322
|
-
class
|
|
2360
|
+
class ji {
|
|
2323
2361
|
constructor() {
|
|
2324
2362
|
this.name = A.KHR_TEXTURE_TRANSFORM;
|
|
2325
2363
|
}
|
|
@@ -2327,12 +2365,12 @@ class Ni {
|
|
|
2327
2365
|
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;
|
|
2328
2366
|
}
|
|
2329
2367
|
}
|
|
2330
|
-
class
|
|
2368
|
+
class Hi {
|
|
2331
2369
|
constructor() {
|
|
2332
2370
|
this.name = A.KHR_MESH_QUANTIZATION;
|
|
2333
2371
|
}
|
|
2334
2372
|
}
|
|
2335
|
-
class
|
|
2373
|
+
class An extends fs {
|
|
2336
2374
|
constructor(e, t, s, n) {
|
|
2337
2375
|
super(e, t, s, n);
|
|
2338
2376
|
}
|
|
@@ -2343,22 +2381,22 @@ class En extends ps {
|
|
|
2343
2381
|
return t;
|
|
2344
2382
|
}
|
|
2345
2383
|
interpolate_(e, t, s, n) {
|
|
2346
|
-
const i = this.resultBuffer, o = this.sampleValues, a = this.valueSize, l = a * 2,
|
|
2347
|
-
for (let
|
|
2348
|
-
const R = o[f +
|
|
2349
|
-
i[
|
|
2384
|
+
const i = this.resultBuffer, o = this.sampleValues, a = this.valueSize, l = a * 2, c = a * 3, u = n - t, h = (s - t) / u, d = h * h, m = d * h, w = e * c, f = w - c, y = -2 * m + 3 * d, p = m - d, b = 1 - y, T = p - d + h;
|
|
2385
|
+
for (let M = 0; M !== a; M++) {
|
|
2386
|
+
const R = o[f + M + a], v = o[f + M + l] * u, I = o[w + M + a], V = o[w + M] * u;
|
|
2387
|
+
i[M] = b * R + T * v + y * I + p * V;
|
|
2350
2388
|
}
|
|
2351
2389
|
return i;
|
|
2352
2390
|
}
|
|
2353
2391
|
}
|
|
2354
|
-
const
|
|
2355
|
-
class
|
|
2392
|
+
const Fi = new K();
|
|
2393
|
+
class Ui extends An {
|
|
2356
2394
|
interpolate_(e, t, s, n) {
|
|
2357
2395
|
const i = super.interpolate_(e, t, s, n);
|
|
2358
|
-
return
|
|
2396
|
+
return Fi.fromArray(i).normalize().toArray(i), i;
|
|
2359
2397
|
}
|
|
2360
2398
|
}
|
|
2361
|
-
const
|
|
2399
|
+
const ee = {
|
|
2362
2400
|
POINTS: 0,
|
|
2363
2401
|
LINES: 1,
|
|
2364
2402
|
LINE_LOOP: 2,
|
|
@@ -2366,25 +2404,25 @@ const W = {
|
|
|
2366
2404
|
TRIANGLES: 4,
|
|
2367
2405
|
TRIANGLE_STRIP: 5,
|
|
2368
2406
|
TRIANGLE_FAN: 6
|
|
2369
|
-
},
|
|
2407
|
+
}, Ae = {
|
|
2370
2408
|
5120: Int8Array,
|
|
2371
2409
|
5121: Uint8Array,
|
|
2372
2410
|
5122: Int16Array,
|
|
2373
2411
|
5123: Uint16Array,
|
|
2374
2412
|
5125: Uint32Array,
|
|
2375
2413
|
5126: Float32Array
|
|
2376
|
-
},
|
|
2377
|
-
9728:
|
|
2378
|
-
9729:
|
|
2379
|
-
9984:
|
|
2380
|
-
9985:
|
|
2381
|
-
9986:
|
|
2382
|
-
9987:
|
|
2383
|
-
},
|
|
2384
|
-
33071:
|
|
2385
|
-
33648:
|
|
2386
|
-
10497:
|
|
2387
|
-
},
|
|
2414
|
+
}, on = {
|
|
2415
|
+
9728: bn,
|
|
2416
|
+
9729: vt,
|
|
2417
|
+
9984: ts,
|
|
2418
|
+
9985: es,
|
|
2419
|
+
9986: Jn,
|
|
2420
|
+
9987: _n
|
|
2421
|
+
}, rn = {
|
|
2422
|
+
33071: ss,
|
|
2423
|
+
33648: ns,
|
|
2424
|
+
10497: St
|
|
2425
|
+
}, bt = {
|
|
2388
2426
|
SCALAR: 1,
|
|
2389
2427
|
VEC2: 2,
|
|
2390
2428
|
VEC3: 3,
|
|
@@ -2392,7 +2430,7 @@ const W = {
|
|
|
2392
2430
|
MAT2: 4,
|
|
2393
2431
|
MAT3: 9,
|
|
2394
2432
|
MAT4: 16
|
|
2395
|
-
},
|
|
2433
|
+
}, Pt = {
|
|
2396
2434
|
POSITION: "position",
|
|
2397
2435
|
NORMAL: "normal",
|
|
2398
2436
|
TANGENT: "tangent",
|
|
@@ -2403,73 +2441,73 @@ const W = {
|
|
|
2403
2441
|
COLOR_0: "color",
|
|
2404
2442
|
WEIGHTS_0: "skinWeight",
|
|
2405
2443
|
JOINTS_0: "skinIndex"
|
|
2406
|
-
},
|
|
2444
|
+
}, de = {
|
|
2407
2445
|
scale: "scale",
|
|
2408
2446
|
translation: "position",
|
|
2409
2447
|
rotation: "quaternion",
|
|
2410
2448
|
weights: "morphTargetInfluences"
|
|
2411
|
-
},
|
|
2449
|
+
}, zi = {
|
|
2412
2450
|
CUBICSPLINE: void 0,
|
|
2413
2451
|
// We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
|
|
2414
2452
|
// keyframe track will be initialized with a default interpolation type, then modified.
|
|
2415
|
-
LINEAR:
|
|
2416
|
-
STEP:
|
|
2417
|
-
},
|
|
2453
|
+
LINEAR: Tn,
|
|
2454
|
+
STEP: ds
|
|
2455
|
+
}, wt = {
|
|
2418
2456
|
OPAQUE: "OPAQUE",
|
|
2419
2457
|
MASK: "MASK",
|
|
2420
2458
|
BLEND: "BLEND"
|
|
2421
2459
|
};
|
|
2422
|
-
function
|
|
2423
|
-
return r.DefaultMaterial === void 0 && (r.DefaultMaterial = new
|
|
2460
|
+
function Gi(r) {
|
|
2461
|
+
return r.DefaultMaterial === void 0 && (r.DefaultMaterial = new wn({
|
|
2424
2462
|
color: 16777215,
|
|
2425
2463
|
emissive: 0,
|
|
2426
2464
|
metalness: 1,
|
|
2427
2465
|
roughness: 1,
|
|
2428
2466
|
transparent: !1,
|
|
2429
2467
|
depthTest: !0,
|
|
2430
|
-
side:
|
|
2468
|
+
side: ps
|
|
2431
2469
|
})), r.DefaultMaterial;
|
|
2432
2470
|
}
|
|
2433
|
-
function
|
|
2471
|
+
function _e(r, e, t) {
|
|
2434
2472
|
for (const s in t.extensions)
|
|
2435
2473
|
r[s] === void 0 && (e.userData.gltfExtensions = e.userData.gltfExtensions || {}, e.userData.gltfExtensions[s] = t.extensions[s]);
|
|
2436
2474
|
}
|
|
2437
|
-
function
|
|
2475
|
+
function se(r, e) {
|
|
2438
2476
|
e.extras !== void 0 && (typeof e.extras == "object" ? Object.assign(r.userData, e.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + e.extras));
|
|
2439
2477
|
}
|
|
2440
|
-
function
|
|
2478
|
+
function Xi(r, e, t) {
|
|
2441
2479
|
let s = !1, n = !1, i = !1;
|
|
2442
|
-
for (let
|
|
2443
|
-
const
|
|
2444
|
-
if (
|
|
2480
|
+
for (let c = 0, u = e.length; c < u; c++) {
|
|
2481
|
+
const h = e[c];
|
|
2482
|
+
if (h.POSITION !== void 0 && (s = !0), h.NORMAL !== void 0 && (n = !0), h.COLOR_0 !== void 0 && (i = !0), s && n && i) break;
|
|
2445
2483
|
}
|
|
2446
2484
|
if (!s && !n && !i) return Promise.resolve(r);
|
|
2447
2485
|
const o = [], a = [], l = [];
|
|
2448
|
-
for (let
|
|
2449
|
-
const
|
|
2486
|
+
for (let c = 0, u = e.length; c < u; c++) {
|
|
2487
|
+
const h = e[c];
|
|
2450
2488
|
if (s) {
|
|
2451
|
-
const
|
|
2452
|
-
o.push(
|
|
2489
|
+
const d = h.POSITION !== void 0 ? t.getDependency("accessor", h.POSITION) : r.attributes.position;
|
|
2490
|
+
o.push(d);
|
|
2453
2491
|
}
|
|
2454
2492
|
if (n) {
|
|
2455
|
-
const
|
|
2456
|
-
a.push(
|
|
2493
|
+
const d = h.NORMAL !== void 0 ? t.getDependency("accessor", h.NORMAL) : r.attributes.normal;
|
|
2494
|
+
a.push(d);
|
|
2457
2495
|
}
|
|
2458
2496
|
if (i) {
|
|
2459
|
-
const
|
|
2460
|
-
l.push(
|
|
2497
|
+
const d = h.COLOR_0 !== void 0 ? t.getDependency("accessor", h.COLOR_0) : r.attributes.color;
|
|
2498
|
+
l.push(d);
|
|
2461
2499
|
}
|
|
2462
2500
|
}
|
|
2463
2501
|
return Promise.all([
|
|
2464
2502
|
Promise.all(o),
|
|
2465
2503
|
Promise.all(a),
|
|
2466
2504
|
Promise.all(l)
|
|
2467
|
-
]).then(function(
|
|
2468
|
-
const u =
|
|
2469
|
-
return s && (r.morphAttributes.position = u), n && (r.morphAttributes.normal =
|
|
2505
|
+
]).then(function(c) {
|
|
2506
|
+
const u = c[0], h = c[1], d = c[2];
|
|
2507
|
+
return s && (r.morphAttributes.position = u), n && (r.morphAttributes.normal = h), i && (r.morphAttributes.color = d), r.morphTargetsRelative = !0, r;
|
|
2470
2508
|
});
|
|
2471
2509
|
}
|
|
2472
|
-
function
|
|
2510
|
+
function Bi(r, e) {
|
|
2473
2511
|
if (r.updateMorphTargets(), e.weights !== void 0)
|
|
2474
2512
|
for (let t = 0, s = e.weights.length; t < s; t++)
|
|
2475
2513
|
r.morphTargetInfluences[t] = e.weights[t];
|
|
@@ -2483,22 +2521,22 @@ function Gi(r, e) {
|
|
|
2483
2521
|
console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
|
|
2484
2522
|
}
|
|
2485
2523
|
}
|
|
2486
|
-
function
|
|
2524
|
+
function Yi(r) {
|
|
2487
2525
|
let e;
|
|
2488
2526
|
const t = r.extensions && r.extensions[A.KHR_DRACO_MESH_COMPRESSION];
|
|
2489
|
-
if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" +
|
|
2527
|
+
if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + Tt(t.attributes) : e = r.indices + ":" + Tt(r.attributes) + ":" + r.mode, r.targets !== void 0)
|
|
2490
2528
|
for (let s = 0, n = r.targets.length; s < n; s++)
|
|
2491
|
-
e += ":" +
|
|
2529
|
+
e += ":" + Tt(r.targets[s]);
|
|
2492
2530
|
return e;
|
|
2493
2531
|
}
|
|
2494
|
-
function
|
|
2532
|
+
function Tt(r) {
|
|
2495
2533
|
let e = "";
|
|
2496
2534
|
const t = Object.keys(r).sort();
|
|
2497
2535
|
for (let s = 0, n = t.length; s < n; s++)
|
|
2498
2536
|
e += t[s] + ":" + r[t[s]] + ";";
|
|
2499
2537
|
return e;
|
|
2500
2538
|
}
|
|
2501
|
-
function
|
|
2539
|
+
function Lt(r) {
|
|
2502
2540
|
switch (r) {
|
|
2503
2541
|
case Int8Array:
|
|
2504
2542
|
return 1 / 127;
|
|
@@ -2512,13 +2550,13 @@ function St(r) {
|
|
|
2512
2550
|
throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
|
|
2513
2551
|
}
|
|
2514
2552
|
}
|
|
2515
|
-
function
|
|
2553
|
+
function Ki(r) {
|
|
2516
2554
|
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";
|
|
2517
2555
|
}
|
|
2518
|
-
const
|
|
2519
|
-
class
|
|
2556
|
+
const Vi = new Pe();
|
|
2557
|
+
class Zi {
|
|
2520
2558
|
constructor(e = {}, t = {}) {
|
|
2521
|
-
this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new
|
|
2559
|
+
this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new yi(), 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 = {};
|
|
2522
2560
|
let s = !1, n = -1, i = !1, o = -1;
|
|
2523
2561
|
if (typeof navigator < "u" && typeof navigator.userAgent < "u") {
|
|
2524
2562
|
const a = navigator.userAgent;
|
|
@@ -2526,7 +2564,7 @@ class Ki {
|
|
|
2526
2564
|
const l = a.match(/Version\/(\d+)/);
|
|
2527
2565
|
n = s && l ? parseInt(l[1], 10) : -1, i = a.indexOf("Firefox") > -1, o = i ? a.match(/Firefox\/([0-9]+)\./)[1] : -1;
|
|
2528
2566
|
}
|
|
2529
|
-
typeof createImageBitmap > "u" || s && n < 17 || i && o < 98 ? this.textureLoader = new
|
|
2567
|
+
typeof createImageBitmap > "u" || s && n < 17 || i && o < 98 ? this.textureLoader = new qn(this.options.manager) : this.textureLoader = new $n(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new Ke(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
|
|
2530
2568
|
}
|
|
2531
2569
|
setExtensions(e) {
|
|
2532
2570
|
this.extensions = e;
|
|
@@ -2556,7 +2594,7 @@ class Ki {
|
|
|
2556
2594
|
parser: s,
|
|
2557
2595
|
userData: {}
|
|
2558
2596
|
};
|
|
2559
|
-
return
|
|
2597
|
+
return _e(i, a, n), se(a, n), Promise.all(s._invokeAll(function(l) {
|
|
2560
2598
|
return l.afterRoot && l.afterRoot(a);
|
|
2561
2599
|
})).then(function() {
|
|
2562
2600
|
for (const l of a.scenes)
|
|
@@ -2612,8 +2650,8 @@ class Ki {
|
|
|
2612
2650
|
const n = s.clone(), i = (o, a) => {
|
|
2613
2651
|
const l = this.associations.get(o);
|
|
2614
2652
|
l != null && this.associations.set(a, l);
|
|
2615
|
-
for (const [
|
|
2616
|
-
i(u, a.children[
|
|
2653
|
+
for (const [c, u] of o.children.entries())
|
|
2654
|
+
i(u, a.children[c]);
|
|
2617
2655
|
};
|
|
2618
2656
|
return i(s, n), n.name += "_instance_" + e.uses[t]++, n;
|
|
2619
2657
|
}
|
|
@@ -2737,7 +2775,7 @@ class Ki {
|
|
|
2737
2775
|
return Promise.resolve(this.extensions[A.KHR_BINARY_GLTF].body);
|
|
2738
2776
|
const n = this.options;
|
|
2739
2777
|
return new Promise(function(i, o) {
|
|
2740
|
-
s.load(
|
|
2778
|
+
s.load(Ue.resolveURL(t.uri, n.path), i, void 0, function() {
|
|
2741
2779
|
o(new Error('THREE.GLTFLoader: Failed to load buffer "' + t.uri + '".'));
|
|
2742
2780
|
});
|
|
2743
2781
|
});
|
|
@@ -2766,25 +2804,25 @@ class Ki {
|
|
|
2766
2804
|
loadAccessor(e) {
|
|
2767
2805
|
const t = this, s = this.json, n = this.json.accessors[e];
|
|
2768
2806
|
if (n.bufferView === void 0 && n.sparse === void 0) {
|
|
2769
|
-
const o =
|
|
2770
|
-
return Promise.resolve(new
|
|
2807
|
+
const o = bt[n.type], a = Ae[n.componentType], l = n.normalized === !0, c = new a(n.count * o);
|
|
2808
|
+
return Promise.resolve(new ze(c, o, l));
|
|
2771
2809
|
}
|
|
2772
2810
|
const i = [];
|
|
2773
2811
|
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) {
|
|
2774
|
-
const a = o[0], l =
|
|
2812
|
+
const a = o[0], l = bt[n.type], c = Ae[n.componentType], u = c.BYTES_PER_ELEMENT, h = u * l, d = n.byteOffset || 0, m = n.bufferView !== void 0 ? s.bufferViews[n.bufferView].byteStride : void 0, w = n.normalized === !0;
|
|
2775
2813
|
let f, y;
|
|
2776
|
-
if (m && m !==
|
|
2777
|
-
const
|
|
2778
|
-
let
|
|
2779
|
-
|
|
2814
|
+
if (m && m !== h) {
|
|
2815
|
+
const p = Math.floor(d / m), b = "InterleavedBuffer:" + n.bufferView + ":" + n.componentType + ":" + p + ":" + n.count;
|
|
2816
|
+
let T = t.cache.get(b);
|
|
2817
|
+
T || (f = new c(a, p * m, n.count * m / u), T = new gn(f, m / u), t.cache.add(b, T)), y = new yn(T, l, d % m / u, w);
|
|
2780
2818
|
} else
|
|
2781
|
-
a === null ? f = new
|
|
2819
|
+
a === null ? f = new c(n.count * l) : f = new c(a, d, n.count * l), y = new ze(f, l, w);
|
|
2782
2820
|
if (n.sparse !== void 0) {
|
|
2783
|
-
const
|
|
2784
|
-
a !== null && (y = new
|
|
2785
|
-
for (let I = 0,
|
|
2786
|
-
const
|
|
2787
|
-
if (y.setX(
|
|
2821
|
+
const p = bt.SCALAR, b = Ae[n.sparse.indices.componentType], T = n.sparse.indices.byteOffset || 0, M = n.sparse.values.byteOffset || 0, R = new b(o[1], T, n.sparse.count * p), v = new c(o[2], M, n.sparse.count * l);
|
|
2822
|
+
a !== null && (y = new ze(y.array.slice(), y.itemSize, y.normalized)), y.normalized = !1;
|
|
2823
|
+
for (let I = 0, V = R.length; I < V; I++) {
|
|
2824
|
+
const W = R[I];
|
|
2825
|
+
if (y.setX(W, v[I * l]), l >= 2 && y.setY(W, v[I * l + 1]), l >= 3 && y.setZ(W, v[I * l + 2]), l >= 4 && y.setW(W, v[I * l + 3]), l >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
|
|
2788
2826
|
}
|
|
2789
2827
|
y.normalized = w;
|
|
2790
2828
|
}
|
|
@@ -2811,41 +2849,41 @@ class Ki {
|
|
|
2811
2849
|
const n = this, i = this.json, o = i.textures[e], a = i.images[t], l = (a.uri || a.bufferView) + ":" + o.sampler;
|
|
2812
2850
|
if (this.textureCache[l])
|
|
2813
2851
|
return this.textureCache[l];
|
|
2814
|
-
const
|
|
2852
|
+
const c = this.loadImageSource(t, s).then(function(u) {
|
|
2815
2853
|
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);
|
|
2816
|
-
const
|
|
2817
|
-
return u.magFilter =
|
|
2854
|
+
const d = (i.samplers || {})[o.sampler] || {};
|
|
2855
|
+
return u.magFilter = on[d.magFilter] || vt, u.minFilter = on[d.minFilter] || _n, u.wrapS = rn[d.wrapS] || St, u.wrapT = rn[d.wrapT] || St, u.generateMipmaps = !u.isCompressedTexture && u.minFilter !== bn && u.minFilter !== vt, n.associations.set(u, { textures: e }), u;
|
|
2818
2856
|
}).catch(function() {
|
|
2819
2857
|
return null;
|
|
2820
2858
|
});
|
|
2821
|
-
return this.textureCache[l] =
|
|
2859
|
+
return this.textureCache[l] = c, c;
|
|
2822
2860
|
}
|
|
2823
2861
|
loadImageSource(e, t) {
|
|
2824
2862
|
const s = this, n = this.json, i = this.options;
|
|
2825
2863
|
if (this.sourceCache[e] !== void 0)
|
|
2826
|
-
return this.sourceCache[e].then((
|
|
2864
|
+
return this.sourceCache[e].then((h) => h.clone());
|
|
2827
2865
|
const o = n.images[e], a = self.URL || self.webkitURL;
|
|
2828
|
-
let l = o.uri || "",
|
|
2866
|
+
let l = o.uri || "", c = !1;
|
|
2829
2867
|
if (o.bufferView !== void 0)
|
|
2830
|
-
l = s.getDependency("bufferView", o.bufferView).then(function(
|
|
2831
|
-
|
|
2832
|
-
const
|
|
2833
|
-
return l = a.createObjectURL(
|
|
2868
|
+
l = s.getDependency("bufferView", o.bufferView).then(function(h) {
|
|
2869
|
+
c = !0;
|
|
2870
|
+
const d = new Blob([h], { type: o.mimeType });
|
|
2871
|
+
return l = a.createObjectURL(d), l;
|
|
2834
2872
|
});
|
|
2835
2873
|
else if (o.uri === void 0)
|
|
2836
2874
|
throw new Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView");
|
|
2837
|
-
const u = Promise.resolve(l).then(function(
|
|
2838
|
-
return new Promise(function(
|
|
2839
|
-
let w =
|
|
2875
|
+
const u = Promise.resolve(l).then(function(h) {
|
|
2876
|
+
return new Promise(function(d, m) {
|
|
2877
|
+
let w = d;
|
|
2840
2878
|
t.isImageBitmapLoader === !0 && (w = function(f) {
|
|
2841
|
-
const y = new
|
|
2842
|
-
y.needsUpdate = !0,
|
|
2843
|
-
}), t.load(
|
|
2879
|
+
const y = new Ht(f);
|
|
2880
|
+
y.needsUpdate = !0, d(y);
|
|
2881
|
+
}), t.load(Ue.resolveURL(h, i.path), w, void 0, m);
|
|
2844
2882
|
});
|
|
2845
|
-
}).then(function(
|
|
2846
|
-
return
|
|
2847
|
-
}).catch(function(
|
|
2848
|
-
throw console.error("THREE.GLTFLoader: Couldn't load texture", l),
|
|
2883
|
+
}).then(function(h) {
|
|
2884
|
+
return c === !0 && a.revokeObjectURL(l), se(h, o), h.userData.mimeType = o.mimeType || Ki(o.uri), h;
|
|
2885
|
+
}).catch(function(h) {
|
|
2886
|
+
throw console.error("THREE.GLTFLoader: Couldn't load texture", l), h;
|
|
2849
2887
|
});
|
|
2850
2888
|
return this.sourceCache[e] = u, u;
|
|
2851
2889
|
}
|
|
@@ -2890,11 +2928,11 @@ class Ki {
|
|
|
2890
2928
|
if (e.isPoints) {
|
|
2891
2929
|
const a = "PointsMaterial:" + s.uuid;
|
|
2892
2930
|
let l = this.cache.get(a);
|
|
2893
|
-
l || (l = new
|
|
2931
|
+
l || (l = new Oe(), Fe.prototype.copy.call(l, s), l.color.copy(s.color), l.map = s.map, l.sizeAttenuation = !1, this.cache.add(a, l)), s = l;
|
|
2894
2932
|
} else if (e.isLine) {
|
|
2895
2933
|
const a = "LineBasicMaterial:" + s.uuid;
|
|
2896
2934
|
let l = this.cache.get(a);
|
|
2897
|
-
l || (l = new
|
|
2935
|
+
l || (l = new He(), Fe.prototype.copy.call(l, s), l.color.copy(s.color), l.map = s.map, this.cache.add(a, l)), s = l;
|
|
2898
2936
|
}
|
|
2899
2937
|
if (n || i || o) {
|
|
2900
2938
|
let a = "ClonedMaterial:" + s.uuid + ":";
|
|
@@ -2905,7 +2943,7 @@ class Ki {
|
|
|
2905
2943
|
e.material = s;
|
|
2906
2944
|
}
|
|
2907
2945
|
getMaterialType() {
|
|
2908
|
-
return
|
|
2946
|
+
return wn;
|
|
2909
2947
|
}
|
|
2910
2948
|
/**
|
|
2911
2949
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
|
|
@@ -2917,35 +2955,35 @@ class Ki {
|
|
|
2917
2955
|
loadMaterial(e) {
|
|
2918
2956
|
const t = this, s = this.json, n = this.extensions, i = s.materials[e];
|
|
2919
2957
|
let o;
|
|
2920
|
-
const a = {}, l = i.extensions || {},
|
|
2958
|
+
const a = {}, l = i.extensions || {}, c = [];
|
|
2921
2959
|
if (l[A.KHR_MATERIALS_UNLIT]) {
|
|
2922
|
-
const
|
|
2923
|
-
o =
|
|
2960
|
+
const h = n[A.KHR_MATERIALS_UNLIT];
|
|
2961
|
+
o = h.getMaterialType(), c.push(h.extendParams(a, i, t));
|
|
2924
2962
|
} else {
|
|
2925
|
-
const
|
|
2926
|
-
if (a.color = new
|
|
2927
|
-
const
|
|
2928
|
-
a.color.setRGB(
|
|
2963
|
+
const h = i.pbrMetallicRoughness || {};
|
|
2964
|
+
if (a.color = new he(1, 1, 1), a.opacity = 1, Array.isArray(h.baseColorFactor)) {
|
|
2965
|
+
const d = h.baseColorFactor;
|
|
2966
|
+
a.color.setRGB(d[0], d[1], d[2], ie), a.opacity = d[3];
|
|
2929
2967
|
}
|
|
2930
|
-
|
|
2931
|
-
return
|
|
2932
|
-
}),
|
|
2933
|
-
return
|
|
2968
|
+
h.baseColorTexture !== void 0 && c.push(t.assignTexture(a, "map", h.baseColorTexture, ce)), a.metalness = h.metallicFactor !== void 0 ? h.metallicFactor : 1, a.roughness = h.roughnessFactor !== void 0 ? h.roughnessFactor : 1, h.metallicRoughnessTexture !== void 0 && (c.push(t.assignTexture(a, "metalnessMap", h.metallicRoughnessTexture)), c.push(t.assignTexture(a, "roughnessMap", h.metallicRoughnessTexture))), o = this._invokeOne(function(d) {
|
|
2969
|
+
return d.getMaterialType && d.getMaterialType(e);
|
|
2970
|
+
}), c.push(Promise.all(this._invokeAll(function(d) {
|
|
2971
|
+
return d.extendMaterialParams && d.extendMaterialParams(e, a);
|
|
2934
2972
|
})));
|
|
2935
2973
|
}
|
|
2936
|
-
i.doubleSided === !0 && (a.side =
|
|
2937
|
-
const u = i.alphaMode ||
|
|
2938
|
-
if (u ===
|
|
2939
|
-
const
|
|
2940
|
-
a.normalScale.set(
|
|
2974
|
+
i.doubleSided === !0 && (a.side = fn);
|
|
2975
|
+
const u = i.alphaMode || wt.OPAQUE;
|
|
2976
|
+
if (u === wt.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, u === wt.MASK && (a.alphaTest = i.alphaCutoff !== void 0 ? i.alphaCutoff : 0.5)), i.normalTexture !== void 0 && o !== we && (c.push(t.assignTexture(a, "normalMap", i.normalTexture)), a.normalScale = new Z(1, 1), i.normalTexture.scale !== void 0)) {
|
|
2977
|
+
const h = i.normalTexture.scale;
|
|
2978
|
+
a.normalScale.set(h, h);
|
|
2941
2979
|
}
|
|
2942
|
-
if (i.occlusionTexture !== void 0 && o !==
|
|
2943
|
-
const
|
|
2944
|
-
a.emissive = new
|
|
2980
|
+
if (i.occlusionTexture !== void 0 && o !== we && (c.push(t.assignTexture(a, "aoMap", i.occlusionTexture)), i.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = i.occlusionTexture.strength)), i.emissiveFactor !== void 0 && o !== we) {
|
|
2981
|
+
const h = i.emissiveFactor;
|
|
2982
|
+
a.emissive = new he().setRGB(h[0], h[1], h[2], ie);
|
|
2945
2983
|
}
|
|
2946
|
-
return i.emissiveTexture !== void 0 && o !==
|
|
2947
|
-
const
|
|
2948
|
-
return i.name && (
|
|
2984
|
+
return i.emissiveTexture !== void 0 && o !== we && c.push(t.assignTexture(a, "emissiveMap", i.emissiveTexture, ce)), Promise.all(c).then(function() {
|
|
2985
|
+
const h = new o(a);
|
|
2986
|
+
return i.name && (h.name = i.name), se(h, i), t.associations.set(h, { materials: e }), i.extensions && _e(n, h, i), h;
|
|
2949
2987
|
});
|
|
2950
2988
|
}
|
|
2951
2989
|
/**
|
|
@@ -2956,7 +2994,7 @@ class Ki {
|
|
|
2956
2994
|
* @return {string}
|
|
2957
2995
|
*/
|
|
2958
2996
|
createUniqueName(e) {
|
|
2959
|
-
const t =
|
|
2997
|
+
const t = is.sanitizeNodeName(e || "");
|
|
2960
2998
|
return t in this.nodeNamesUsed ? t + "_" + ++this.nodeNamesUsed[t] : (this.nodeNamesUsed[t] = 0, t);
|
|
2961
2999
|
}
|
|
2962
3000
|
/**
|
|
@@ -2972,17 +3010,17 @@ class Ki {
|
|
|
2972
3010
|
const t = this, s = this.extensions, n = this.primitiveCache;
|
|
2973
3011
|
function i(a) {
|
|
2974
3012
|
return s[A.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, t).then(function(l) {
|
|
2975
|
-
return
|
|
3013
|
+
return an(l, a, t);
|
|
2976
3014
|
});
|
|
2977
3015
|
}
|
|
2978
3016
|
const o = [];
|
|
2979
3017
|
for (let a = 0, l = e.length; a < l; a++) {
|
|
2980
|
-
const
|
|
2981
|
-
if (
|
|
2982
|
-
o.push(
|
|
3018
|
+
const c = e[a], u = Yi(c), h = n[u];
|
|
3019
|
+
if (h)
|
|
3020
|
+
o.push(h.promise);
|
|
2983
3021
|
else {
|
|
2984
|
-
let
|
|
2985
|
-
|
|
3022
|
+
let d;
|
|
3023
|
+
c.extensions && c.extensions[A.KHR_DRACO_MESH_COMPRESSION] ? d = i(c) : d = an(new Re(), c, t), n[u] = { primitive: c, promise: d }, o.push(d);
|
|
2986
3024
|
}
|
|
2987
3025
|
}
|
|
2988
3026
|
return Promise.all(o);
|
|
@@ -2996,42 +3034,42 @@ class Ki {
|
|
|
2996
3034
|
*/
|
|
2997
3035
|
loadMesh(e) {
|
|
2998
3036
|
const t = this, s = this.json, n = this.extensions, i = s.meshes[e], o = i.primitives, a = [];
|
|
2999
|
-
for (let l = 0,
|
|
3000
|
-
const u = o[l].material === void 0 ?
|
|
3037
|
+
for (let l = 0, c = o.length; l < c; l++) {
|
|
3038
|
+
const u = o[l].material === void 0 ? Gi(this.cache) : this.getDependency("material", o[l].material);
|
|
3001
3039
|
a.push(u);
|
|
3002
3040
|
}
|
|
3003
3041
|
return a.push(t.loadGeometries(o)), Promise.all(a).then(function(l) {
|
|
3004
|
-
const
|
|
3042
|
+
const c = l.slice(0, l.length - 1), u = l[l.length - 1], h = [];
|
|
3005
3043
|
for (let m = 0, w = u.length; m < w; m++) {
|
|
3006
3044
|
const f = u[m], y = o[m];
|
|
3007
|
-
let
|
|
3008
|
-
const b =
|
|
3009
|
-
if (y.mode ===
|
|
3010
|
-
|
|
3011
|
-
else if (y.mode ===
|
|
3012
|
-
|
|
3013
|
-
else if (y.mode ===
|
|
3014
|
-
|
|
3015
|
-
else if (y.mode ===
|
|
3016
|
-
|
|
3017
|
-
else if (y.mode ===
|
|
3018
|
-
|
|
3045
|
+
let p;
|
|
3046
|
+
const b = c[m];
|
|
3047
|
+
if (y.mode === ee.TRIANGLES || y.mode === ee.TRIANGLE_STRIP || y.mode === ee.TRIANGLE_FAN || y.mode === void 0)
|
|
3048
|
+
p = i.isSkinnedMesh === !0 ? new os(f, b) : new E(f, b), p.isSkinnedMesh === !0 && p.normalizeSkinWeights(), y.mode === ee.TRIANGLE_STRIP ? p.geometry = tn(p.geometry, mn) : y.mode === ee.TRIANGLE_FAN && (p.geometry = tn(p.geometry, Mt));
|
|
3049
|
+
else if (y.mode === ee.LINES)
|
|
3050
|
+
p = new Et(f, b);
|
|
3051
|
+
else if (y.mode === ee.LINE_STRIP)
|
|
3052
|
+
p = new ae(f, b);
|
|
3053
|
+
else if (y.mode === ee.LINE_LOOP)
|
|
3054
|
+
p = new rs(f, b);
|
|
3055
|
+
else if (y.mode === ee.POINTS)
|
|
3056
|
+
p = new lt(f, b);
|
|
3019
3057
|
else
|
|
3020
3058
|
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + y.mode);
|
|
3021
|
-
Object.keys(
|
|
3059
|
+
Object.keys(p.geometry.morphAttributes).length > 0 && Bi(p, i), p.name = t.createUniqueName(i.name || "mesh_" + e), se(p, i), y.extensions && _e(n, p, y), t.assignFinalMaterial(p), h.push(p);
|
|
3022
3060
|
}
|
|
3023
|
-
for (let m = 0, w =
|
|
3024
|
-
t.associations.set(
|
|
3061
|
+
for (let m = 0, w = h.length; m < w; m++)
|
|
3062
|
+
t.associations.set(h[m], {
|
|
3025
3063
|
meshes: e,
|
|
3026
3064
|
primitives: m
|
|
3027
3065
|
});
|
|
3028
|
-
if (
|
|
3029
|
-
return i.extensions &&
|
|
3030
|
-
const
|
|
3031
|
-
i.extensions &&
|
|
3032
|
-
for (let m = 0, w =
|
|
3033
|
-
|
|
3034
|
-
return
|
|
3066
|
+
if (h.length === 1)
|
|
3067
|
+
return i.extensions && _e(n, h[0], i), h[0];
|
|
3068
|
+
const d = new at();
|
|
3069
|
+
i.extensions && _e(n, d, i), t.associations.set(d, { meshes: e });
|
|
3070
|
+
for (let m = 0, w = h.length; m < w; m++)
|
|
3071
|
+
d.add(h[m]);
|
|
3072
|
+
return d;
|
|
3035
3073
|
});
|
|
3036
3074
|
}
|
|
3037
3075
|
/**
|
|
@@ -3048,7 +3086,7 @@ class Ki {
|
|
|
3048
3086
|
console.warn("THREE.GLTFLoader: Missing camera parameters.");
|
|
3049
3087
|
return;
|
|
3050
3088
|
}
|
|
3051
|
-
return s.type === "perspective" ? t = new
|
|
3089
|
+
return s.type === "perspective" ? t = new as(pn.radToDeg(n.yfov), n.aspectRatio || 1, n.znear || 1, n.zfar || 2e6) : s.type === "orthographic" && (t = new ls(-n.xmag, n.xmag, n.ymag, -n.ymag, n.znear, n.zfar)), s.name && (t.name = this.createUniqueName(s.name)), se(t, s), Promise.resolve(t);
|
|
3052
3090
|
}
|
|
3053
3091
|
/**
|
|
3054
3092
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
|
|
@@ -3063,16 +3101,16 @@ class Ki {
|
|
|
3063
3101
|
s.push(this._loadNodeShallow(t.joints[n]));
|
|
3064
3102
|
return t.inverseBindMatrices !== void 0 ? s.push(this.getDependency("accessor", t.inverseBindMatrices)) : s.push(null), Promise.all(s).then(function(n) {
|
|
3065
3103
|
const i = n.pop(), o = n, a = [], l = [];
|
|
3066
|
-
for (let
|
|
3067
|
-
const
|
|
3068
|
-
if (
|
|
3069
|
-
a.push(
|
|
3070
|
-
const
|
|
3071
|
-
i !== null &&
|
|
3104
|
+
for (let c = 0, u = o.length; c < u; c++) {
|
|
3105
|
+
const h = o[c];
|
|
3106
|
+
if (h) {
|
|
3107
|
+
a.push(h);
|
|
3108
|
+
const d = new Pe();
|
|
3109
|
+
i !== null && d.fromArray(i.array, c * 16), l.push(d);
|
|
3072
3110
|
} else
|
|
3073
|
-
console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', t.joints[
|
|
3111
|
+
console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', t.joints[c]);
|
|
3074
3112
|
}
|
|
3075
|
-
return new
|
|
3113
|
+
return new cs(a, l);
|
|
3076
3114
|
});
|
|
3077
3115
|
}
|
|
3078
3116
|
/**
|
|
@@ -3083,30 +3121,30 @@ class Ki {
|
|
|
3083
3121
|
* @return {Promise<AnimationClip>}
|
|
3084
3122
|
*/
|
|
3085
3123
|
loadAnimation(e) {
|
|
3086
|
-
const t = this.json, s = this, n = t.animations[e], i = n.name ? n.name : "animation_" + e, o = [], a = [], l = [],
|
|
3087
|
-
for (let
|
|
3088
|
-
const m = n.channels[
|
|
3089
|
-
f.node !== void 0 && (o.push(this.getDependency("node", y)), a.push(this.getDependency("accessor",
|
|
3124
|
+
const t = this.json, s = this, n = t.animations[e], i = n.name ? n.name : "animation_" + e, o = [], a = [], l = [], c = [], u = [];
|
|
3125
|
+
for (let h = 0, d = n.channels.length; h < d; h++) {
|
|
3126
|
+
const m = n.channels[h], w = n.samplers[m.sampler], f = m.target, y = f.node, p = n.parameters !== void 0 ? n.parameters[w.input] : w.input, b = n.parameters !== void 0 ? n.parameters[w.output] : w.output;
|
|
3127
|
+
f.node !== void 0 && (o.push(this.getDependency("node", y)), a.push(this.getDependency("accessor", p)), l.push(this.getDependency("accessor", b)), c.push(w), u.push(f));
|
|
3090
3128
|
}
|
|
3091
3129
|
return Promise.all([
|
|
3092
3130
|
Promise.all(o),
|
|
3093
3131
|
Promise.all(a),
|
|
3094
3132
|
Promise.all(l),
|
|
3095
|
-
Promise.all(
|
|
3133
|
+
Promise.all(c),
|
|
3096
3134
|
Promise.all(u)
|
|
3097
|
-
]).then(function(
|
|
3098
|
-
const
|
|
3099
|
-
for (let
|
|
3100
|
-
const R =
|
|
3135
|
+
]).then(function(h) {
|
|
3136
|
+
const d = h[0], m = h[1], w = h[2], f = h[3], y = h[4], p = [];
|
|
3137
|
+
for (let T = 0, M = d.length; T < M; T++) {
|
|
3138
|
+
const R = d[T], v = m[T], I = w[T], V = f[T], W = y[T];
|
|
3101
3139
|
if (R === void 0) continue;
|
|
3102
3140
|
R.updateMatrix && R.updateMatrix();
|
|
3103
|
-
const
|
|
3104
|
-
if (
|
|
3105
|
-
for (let
|
|
3106
|
-
|
|
3141
|
+
const Q = s._createAnimationTracks(R, v, I, V, W);
|
|
3142
|
+
if (Q)
|
|
3143
|
+
for (let me = 0; me < Q.length; me++)
|
|
3144
|
+
p.push(Q[me]);
|
|
3107
3145
|
}
|
|
3108
|
-
const b = new
|
|
3109
|
-
return
|
|
3146
|
+
const b = new hs(i, void 0, p);
|
|
3147
|
+
return se(b, n), b;
|
|
3110
3148
|
});
|
|
3111
3149
|
}
|
|
3112
3150
|
createNodeMesh(e) {
|
|
@@ -3115,7 +3153,7 @@ class Ki {
|
|
|
3115
3153
|
const o = s._getNodeRef(s.meshCache, n.mesh, i);
|
|
3116
3154
|
return n.weights !== void 0 && o.traverse(function(a) {
|
|
3117
3155
|
if (a.isMesh)
|
|
3118
|
-
for (let l = 0,
|
|
3156
|
+
for (let l = 0, c = n.weights.length; l < c; l++)
|
|
3119
3157
|
a.morphTargetInfluences[l] = n.weights[l];
|
|
3120
3158
|
}), o;
|
|
3121
3159
|
});
|
|
@@ -3129,23 +3167,23 @@ class Ki {
|
|
|
3129
3167
|
*/
|
|
3130
3168
|
loadNode(e) {
|
|
3131
3169
|
const t = this.json, s = this, n = t.nodes[e], i = s._loadNodeShallow(e), o = [], a = n.children || [];
|
|
3132
|
-
for (let
|
|
3133
|
-
o.push(s.getDependency("node", a[
|
|
3170
|
+
for (let c = 0, u = a.length; c < u; c++)
|
|
3171
|
+
o.push(s.getDependency("node", a[c]));
|
|
3134
3172
|
const l = n.skin === void 0 ? Promise.resolve(null) : s.getDependency("skin", n.skin);
|
|
3135
3173
|
return Promise.all([
|
|
3136
3174
|
i,
|
|
3137
3175
|
Promise.all(o),
|
|
3138
3176
|
l
|
|
3139
|
-
]).then(function(
|
|
3140
|
-
const u =
|
|
3141
|
-
|
|
3142
|
-
m.isSkinnedMesh && m.bind(
|
|
3177
|
+
]).then(function(c) {
|
|
3178
|
+
const u = c[0], h = c[1], d = c[2];
|
|
3179
|
+
d !== null && u.traverse(function(m) {
|
|
3180
|
+
m.isSkinnedMesh && m.bind(d, Vi);
|
|
3143
3181
|
});
|
|
3144
|
-
for (let m = 0, w =
|
|
3145
|
-
u.add(
|
|
3146
|
-
if (u.userData.pivot !== void 0 &&
|
|
3147
|
-
const m = u.userData.pivot, w =
|
|
3148
|
-
u.pivot = new
|
|
3182
|
+
for (let m = 0, w = h.length; m < w; m++)
|
|
3183
|
+
u.add(h[m]);
|
|
3184
|
+
if (u.userData.pivot !== void 0 && h.length > 0) {
|
|
3185
|
+
const m = u.userData.pivot, w = h[0];
|
|
3186
|
+
u.pivot = new S().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;
|
|
3149
3187
|
}
|
|
3150
3188
|
return u;
|
|
3151
3189
|
});
|
|
@@ -3156,30 +3194,30 @@ class Ki {
|
|
|
3156
3194
|
const t = this.json, s = this.extensions, n = this;
|
|
3157
3195
|
if (this.nodeCache[e] !== void 0)
|
|
3158
3196
|
return this.nodeCache[e];
|
|
3159
|
-
const i = t.nodes[e], o = i.name ? n.createUniqueName(i.name) : "", a = [], l = n._invokeOne(function(
|
|
3160
|
-
return
|
|
3197
|
+
const i = t.nodes[e], o = i.name ? n.createUniqueName(i.name) : "", a = [], l = n._invokeOne(function(c) {
|
|
3198
|
+
return c.createNodeMesh && c.createNodeMesh(e);
|
|
3161
3199
|
});
|
|
3162
|
-
return l && a.push(l), i.camera !== void 0 && a.push(n.getDependency("camera", i.camera).then(function(
|
|
3163
|
-
return n._getNodeRef(n.cameraCache, i.camera,
|
|
3164
|
-
})), n._invokeAll(function(
|
|
3165
|
-
return
|
|
3166
|
-
}).forEach(function(
|
|
3167
|
-
a.push(
|
|
3168
|
-
}), this.nodeCache[e] = Promise.all(a).then(function(
|
|
3200
|
+
return l && a.push(l), i.camera !== void 0 && a.push(n.getDependency("camera", i.camera).then(function(c) {
|
|
3201
|
+
return n._getNodeRef(n.cameraCache, i.camera, c);
|
|
3202
|
+
})), n._invokeAll(function(c) {
|
|
3203
|
+
return c.createNodeAttachment && c.createNodeAttachment(e);
|
|
3204
|
+
}).forEach(function(c) {
|
|
3205
|
+
a.push(c);
|
|
3206
|
+
}), this.nodeCache[e] = Promise.all(a).then(function(c) {
|
|
3169
3207
|
let u;
|
|
3170
|
-
if (i.isBone === !0 ? u = new
|
|
3171
|
-
for (let
|
|
3172
|
-
u.add(h
|
|
3173
|
-
if (i.name && (u.userData.name = i.name, u.name = o),
|
|
3174
|
-
const
|
|
3175
|
-
|
|
3208
|
+
if (i.isBone === !0 ? u = new us() : c.length > 1 ? u = new at() : c.length === 1 ? u = c[0] : u = new Ye(), u !== c[0])
|
|
3209
|
+
for (let h = 0, d = c.length; h < d; h++)
|
|
3210
|
+
u.add(c[h]);
|
|
3211
|
+
if (i.name && (u.userData.name = i.name, u.name = o), se(u, i), i.extensions && _e(s, u, i), i.matrix !== void 0) {
|
|
3212
|
+
const h = new Pe();
|
|
3213
|
+
h.fromArray(i.matrix), u.applyMatrix4(h);
|
|
3176
3214
|
} else
|
|
3177
3215
|
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);
|
|
3178
3216
|
if (!n.associations.has(u))
|
|
3179
3217
|
n.associations.set(u, {});
|
|
3180
3218
|
else if (i.mesh !== void 0 && n.meshCache.refs[i.mesh] > 1) {
|
|
3181
|
-
const
|
|
3182
|
-
n.associations.set(u, { ...
|
|
3219
|
+
const h = n.associations.get(u);
|
|
3220
|
+
n.associations.set(u, { ...h });
|
|
3183
3221
|
}
|
|
3184
3222
|
return n.associations.get(u).nodes = e, u;
|
|
3185
3223
|
}), this.nodeCache[e];
|
|
@@ -3192,66 +3230,66 @@ class Ki {
|
|
|
3192
3230
|
* @return {Promise<Group>}
|
|
3193
3231
|
*/
|
|
3194
3232
|
loadScene(e) {
|
|
3195
|
-
const t = this.extensions, s = this.json.scenes[e], n = this, i = new
|
|
3196
|
-
s.name && (i.name = n.createUniqueName(s.name)),
|
|
3233
|
+
const t = this.extensions, s = this.json.scenes[e], n = this, i = new at();
|
|
3234
|
+
s.name && (i.name = n.createUniqueName(s.name)), se(i, s), s.extensions && _e(t, i, s);
|
|
3197
3235
|
const o = s.nodes || [], a = [];
|
|
3198
|
-
for (let l = 0,
|
|
3236
|
+
for (let l = 0, c = o.length; l < c; l++)
|
|
3199
3237
|
a.push(n.getDependency("node", o[l]));
|
|
3200
3238
|
return Promise.all(a).then(function(l) {
|
|
3201
|
-
for (let u = 0,
|
|
3202
|
-
const
|
|
3203
|
-
|
|
3239
|
+
for (let u = 0, h = l.length; u < h; u++) {
|
|
3240
|
+
const d = l[u];
|
|
3241
|
+
d.parent !== null ? i.add(mi(d)) : i.add(d);
|
|
3204
3242
|
}
|
|
3205
|
-
const
|
|
3206
|
-
const
|
|
3207
|
-
for (const [
|
|
3208
|
-
(
|
|
3209
|
-
return u.traverse((
|
|
3210
|
-
const m = n.associations.get(
|
|
3211
|
-
m != null &&
|
|
3212
|
-
}),
|
|
3243
|
+
const c = (u) => {
|
|
3244
|
+
const h = /* @__PURE__ */ new Map();
|
|
3245
|
+
for (const [d, m] of n.associations)
|
|
3246
|
+
(d instanceof Fe || d instanceof Ht) && h.set(d, m);
|
|
3247
|
+
return u.traverse((d) => {
|
|
3248
|
+
const m = n.associations.get(d);
|
|
3249
|
+
m != null && h.set(d, m);
|
|
3250
|
+
}), h;
|
|
3213
3251
|
};
|
|
3214
|
-
return n.associations =
|
|
3252
|
+
return n.associations = c(i), i;
|
|
3215
3253
|
});
|
|
3216
3254
|
}
|
|
3217
3255
|
_createAnimationTracks(e, t, s, n, i) {
|
|
3218
3256
|
const o = [], a = e.name ? e.name : e.uuid, l = [];
|
|
3219
|
-
function
|
|
3257
|
+
function c(m) {
|
|
3220
3258
|
m.morphTargetInfluences && l.push(m.name ? m.name : m.uuid);
|
|
3221
3259
|
}
|
|
3222
|
-
|
|
3260
|
+
de[i.path] === de.weights ? (c(e), e.isGroup && e.children.forEach(c)) : l.push(a);
|
|
3223
3261
|
let u;
|
|
3224
|
-
switch (
|
|
3225
|
-
case
|
|
3226
|
-
u =
|
|
3262
|
+
switch (de[i.path]) {
|
|
3263
|
+
case de.weights:
|
|
3264
|
+
u = Ut;
|
|
3227
3265
|
break;
|
|
3228
|
-
case
|
|
3229
|
-
u =
|
|
3266
|
+
case de.rotation:
|
|
3267
|
+
u = zt;
|
|
3230
3268
|
break;
|
|
3231
|
-
case
|
|
3232
|
-
case
|
|
3233
|
-
u =
|
|
3269
|
+
case de.translation:
|
|
3270
|
+
case de.scale:
|
|
3271
|
+
u = Ft;
|
|
3234
3272
|
break;
|
|
3235
3273
|
default:
|
|
3236
3274
|
switch (s.itemSize) {
|
|
3237
3275
|
case 1:
|
|
3238
|
-
u =
|
|
3276
|
+
u = Ut;
|
|
3239
3277
|
break;
|
|
3240
3278
|
case 2:
|
|
3241
3279
|
case 3:
|
|
3242
3280
|
default:
|
|
3243
|
-
u =
|
|
3281
|
+
u = Ft;
|
|
3244
3282
|
break;
|
|
3245
3283
|
}
|
|
3246
3284
|
break;
|
|
3247
3285
|
}
|
|
3248
|
-
const
|
|
3286
|
+
const h = n.interpolation !== void 0 ? zi[n.interpolation] : Tn, d = this._getArrayFromAccessor(s);
|
|
3249
3287
|
for (let m = 0, w = l.length; m < w; m++) {
|
|
3250
3288
|
const f = new u(
|
|
3251
|
-
l[m] + "." +
|
|
3289
|
+
l[m] + "." + de[i.path],
|
|
3252
3290
|
t.array,
|
|
3253
|
-
|
|
3254
|
-
|
|
3291
|
+
d,
|
|
3292
|
+
h
|
|
3255
3293
|
);
|
|
3256
3294
|
n.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(f), o.push(f);
|
|
3257
3295
|
}
|
|
@@ -3260,7 +3298,7 @@ class Ki {
|
|
|
3260
3298
|
_getArrayFromAccessor(e) {
|
|
3261
3299
|
let t = e.array;
|
|
3262
3300
|
if (e.normalized) {
|
|
3263
|
-
const s =
|
|
3301
|
+
const s = Lt(t.constructor), n = new Float32Array(t.length);
|
|
3264
3302
|
for (let i = 0, o = t.length; i < o; i++)
|
|
3265
3303
|
n[i] = t[i] * s;
|
|
3266
3304
|
t = n;
|
|
@@ -3269,21 +3307,21 @@ class Ki {
|
|
|
3269
3307
|
}
|
|
3270
3308
|
_createCubicSplineTrackInterpolant(e) {
|
|
3271
3309
|
e.createInterpolant = function(s) {
|
|
3272
|
-
const n = this instanceof
|
|
3310
|
+
const n = this instanceof zt ? Ui : An;
|
|
3273
3311
|
return new n(this.times, this.values, this.getValueSize() / 3, s);
|
|
3274
3312
|
}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
|
|
3275
3313
|
}
|
|
3276
3314
|
}
|
|
3277
|
-
function
|
|
3278
|
-
const s = e.attributes, n = new
|
|
3315
|
+
function Wi(r, e, t) {
|
|
3316
|
+
const s = e.attributes, n = new ms();
|
|
3279
3317
|
if (s.POSITION !== void 0) {
|
|
3280
|
-
const a = t.json.accessors[s.POSITION], l = a.min,
|
|
3281
|
-
if (l !== void 0 &&
|
|
3318
|
+
const a = t.json.accessors[s.POSITION], l = a.min, c = a.max;
|
|
3319
|
+
if (l !== void 0 && c !== void 0) {
|
|
3282
3320
|
if (n.set(
|
|
3283
|
-
new
|
|
3284
|
-
new
|
|
3321
|
+
new S(l[0], l[1], l[2]),
|
|
3322
|
+
new S(c[0], c[1], c[2])
|
|
3285
3323
|
), a.normalized) {
|
|
3286
|
-
const u =
|
|
3324
|
+
const u = Lt(Ae[a.componentType]);
|
|
3287
3325
|
n.min.multiplyScalar(u), n.max.multiplyScalar(u);
|
|
3288
3326
|
}
|
|
3289
3327
|
} else {
|
|
@@ -3294,14 +3332,14 @@ function Vi(r, e, t) {
|
|
|
3294
3332
|
return;
|
|
3295
3333
|
const i = e.targets;
|
|
3296
3334
|
if (i !== void 0) {
|
|
3297
|
-
const a = new
|
|
3298
|
-
for (let
|
|
3299
|
-
const
|
|
3300
|
-
if (
|
|
3301
|
-
const
|
|
3335
|
+
const a = new S(), l = new S();
|
|
3336
|
+
for (let c = 0, u = i.length; c < u; c++) {
|
|
3337
|
+
const h = i[c];
|
|
3338
|
+
if (h.POSITION !== void 0) {
|
|
3339
|
+
const d = t.json.accessors[h.POSITION], m = d.min, w = d.max;
|
|
3302
3340
|
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]))),
|
|
3304
|
-
const f =
|
|
3341
|
+
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]))), d.normalized) {
|
|
3342
|
+
const f = Lt(Ae[d.componentType]);
|
|
3305
3343
|
l.multiplyScalar(f);
|
|
3306
3344
|
}
|
|
3307
3345
|
a.max(l);
|
|
@@ -3312,10 +3350,10 @@ function Vi(r, e, t) {
|
|
|
3312
3350
|
n.expandByVector(a);
|
|
3313
3351
|
}
|
|
3314
3352
|
r.boundingBox = n;
|
|
3315
|
-
const o = new
|
|
3353
|
+
const o = new gs();
|
|
3316
3354
|
n.getCenter(o.center), o.radius = n.min.distanceTo(n.max) / 2, r.boundingSphere = o;
|
|
3317
3355
|
}
|
|
3318
|
-
function
|
|
3356
|
+
function an(r, e, t) {
|
|
3319
3357
|
const s = e.attributes, n = [];
|
|
3320
3358
|
function i(o, a) {
|
|
3321
3359
|
return t.getDependency("accessor", o).then(function(l) {
|
|
@@ -3323,7 +3361,7 @@ function on(r, e, t) {
|
|
|
3323
3361
|
});
|
|
3324
3362
|
}
|
|
3325
3363
|
for (const o in s) {
|
|
3326
|
-
const a =
|
|
3364
|
+
const a = Pt[o] || o.toLowerCase();
|
|
3327
3365
|
a in r.attributes || n.push(i(s[o], a));
|
|
3328
3366
|
}
|
|
3329
3367
|
if (e.indices !== void 0 && !r.index) {
|
|
@@ -3332,26 +3370,335 @@ function on(r, e, t) {
|
|
|
3332
3370
|
});
|
|
3333
3371
|
n.push(o);
|
|
3334
3372
|
}
|
|
3335
|
-
return
|
|
3336
|
-
return e.targets !== void 0 ?
|
|
3373
|
+
return At.workingColorSpace !== ie && "COLOR_0" in s && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${At.workingColorSpace}" not supported.`), se(r, e), Wi(r, e, t), Promise.all(n).then(function() {
|
|
3374
|
+
return e.targets !== void 0 ? Xi(r, e.targets, t) : r;
|
|
3337
3375
|
});
|
|
3338
3376
|
}
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3377
|
+
const xt = /* @__PURE__ */ new WeakMap();
|
|
3378
|
+
class Qi extends It {
|
|
3379
|
+
/**
|
|
3380
|
+
* Constructs a new Draco loader.
|
|
3381
|
+
*
|
|
3382
|
+
* @param {LoadingManager} [manager] - The loading manager.
|
|
3383
|
+
*/
|
|
3384
|
+
constructor(e) {
|
|
3385
|
+
super(e), this.decoderPath = "", this.decoderConfig = {}, this.decoderBinary = null, this.decoderPending = null, this.workerLimit = 4, this.workerPool = [], this.workerNextTaskID = 1, this.workerSourceURL = "", this.defaultAttributeIDs = {
|
|
3386
|
+
position: "POSITION",
|
|
3387
|
+
normal: "NORMAL",
|
|
3388
|
+
color: "COLOR",
|
|
3389
|
+
uv: "TEX_COORD"
|
|
3390
|
+
}, this.defaultAttributeTypes = {
|
|
3391
|
+
position: "Float32Array",
|
|
3392
|
+
normal: "Float32Array",
|
|
3393
|
+
color: "Float32Array",
|
|
3394
|
+
uv: "Float32Array"
|
|
3395
|
+
};
|
|
3396
|
+
}
|
|
3397
|
+
/**
|
|
3398
|
+
* Provides configuration for the decoder libraries. Configuration cannot be changed after decoding begins.
|
|
3399
|
+
*
|
|
3400
|
+
* @param {string} path - The decoder path.
|
|
3401
|
+
* @return {DRACOLoader} A reference to this loader.
|
|
3402
|
+
*/
|
|
3403
|
+
setDecoderPath(e) {
|
|
3404
|
+
return this.decoderPath = e, this;
|
|
3405
|
+
}
|
|
3406
|
+
/**
|
|
3407
|
+
* Provides configuration for the decoder libraries. Configuration cannot be changed after decoding begins.
|
|
3408
|
+
*
|
|
3409
|
+
* @param {{type:('js'|'wasm')}} config - The decoder config.
|
|
3410
|
+
* @return {DRACOLoader} A reference to this loader.
|
|
3411
|
+
*/
|
|
3412
|
+
setDecoderConfig(e) {
|
|
3413
|
+
return this.decoderConfig = e, this;
|
|
3414
|
+
}
|
|
3415
|
+
/**
|
|
3416
|
+
* Sets the maximum number of Web Workers to be used during decoding.
|
|
3417
|
+
* A lower limit may be preferable if workers are also for other tasks in the application.
|
|
3418
|
+
*
|
|
3419
|
+
* @param {number} workerLimit - The worker limit.
|
|
3420
|
+
* @return {DRACOLoader} A reference to this loader.
|
|
3421
|
+
*/
|
|
3422
|
+
setWorkerLimit(e) {
|
|
3423
|
+
return this.workerLimit = e, this;
|
|
3424
|
+
}
|
|
3425
|
+
/**
|
|
3426
|
+
* Starts loading from the given URL and passes the loaded Draco asset
|
|
3427
|
+
* to the `onLoad()` callback.
|
|
3428
|
+
*
|
|
3429
|
+
* @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
|
|
3430
|
+
* @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished.
|
|
3431
|
+
* @param {onProgressCallback} onProgress - Executed while the loading is in progress.
|
|
3432
|
+
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
3433
|
+
*/
|
|
3434
|
+
load(e, t, s, n) {
|
|
3435
|
+
const i = new Ke(this.manager);
|
|
3436
|
+
i.setPath(this.path), i.setResponseType("arraybuffer"), i.setRequestHeader(this.requestHeader), i.setWithCredentials(this.withCredentials), i.load(e, (o) => {
|
|
3437
|
+
this.parse(o, t, n);
|
|
3438
|
+
}, s, n);
|
|
3439
|
+
}
|
|
3440
|
+
/**
|
|
3441
|
+
* Parses the given Draco data.
|
|
3442
|
+
*
|
|
3443
|
+
* @param {ArrayBuffer} buffer - The raw Draco data as an array buffer.
|
|
3444
|
+
* @param {function(BufferGeometry)} onLoad - Executed when the loading/parsing process has been finished.
|
|
3445
|
+
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
3446
|
+
*/
|
|
3447
|
+
parse(e, t, s = () => {
|
|
3448
|
+
}) {
|
|
3449
|
+
this.decodeDracoFile(e, t, null, null, ce, s).catch(s);
|
|
3450
|
+
}
|
|
3451
|
+
//
|
|
3452
|
+
decodeDracoFile(e, t, s, n, i = ie, o = () => {
|
|
3453
|
+
}) {
|
|
3454
|
+
const a = {
|
|
3455
|
+
attributeIDs: s || this.defaultAttributeIDs,
|
|
3456
|
+
attributeTypes: n || this.defaultAttributeTypes,
|
|
3457
|
+
useUniqueIDs: !!s,
|
|
3458
|
+
vertexColorSpace: i
|
|
3459
|
+
};
|
|
3460
|
+
return this.decodeGeometry(e, a).then(t).catch(o);
|
|
3461
|
+
}
|
|
3462
|
+
decodeGeometry(e, t) {
|
|
3463
|
+
const s = JSON.stringify(t);
|
|
3464
|
+
if (xt.has(e)) {
|
|
3465
|
+
const l = xt.get(e);
|
|
3466
|
+
if (l.key === s)
|
|
3467
|
+
return l.promise;
|
|
3468
|
+
if (e.byteLength === 0)
|
|
3469
|
+
throw new Error(
|
|
3470
|
+
"THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred."
|
|
3471
|
+
);
|
|
3472
|
+
}
|
|
3473
|
+
let n;
|
|
3474
|
+
const i = this.workerNextTaskID++, o = e.byteLength, a = this._getWorker(i, o).then((l) => (n = l, new Promise((c, u) => {
|
|
3475
|
+
n._callbacks[i] = { resolve: c, reject: u }, n.postMessage({ type: "decode", id: i, taskConfig: t, buffer: e }, [e]);
|
|
3476
|
+
}))).then((l) => this._createGeometry(l.geometry));
|
|
3477
|
+
return a.catch(() => !0).then(() => {
|
|
3478
|
+
n && i && this._releaseTask(n, i);
|
|
3479
|
+
}), xt.set(e, {
|
|
3480
|
+
key: s,
|
|
3481
|
+
promise: a
|
|
3482
|
+
}), a;
|
|
3483
|
+
}
|
|
3484
|
+
_createGeometry(e) {
|
|
3485
|
+
const t = new Re();
|
|
3486
|
+
e.index && t.setIndex(new ze(e.index.array, 1));
|
|
3487
|
+
for (let s = 0; s < e.attributes.length; s++) {
|
|
3488
|
+
const { name: n, array: i, itemSize: o, stride: a, vertexColorSpace: l } = e.attributes[s];
|
|
3489
|
+
let c;
|
|
3490
|
+
if (o === a)
|
|
3491
|
+
c = new ze(i, o);
|
|
3492
|
+
else {
|
|
3493
|
+
const u = new gn(i, a);
|
|
3494
|
+
c = new yn(u, o, 0);
|
|
3495
|
+
}
|
|
3496
|
+
n === "color" && (this._assignVertexColorSpace(c, l), c.normalized = !(i instanceof Float32Array)), t.setAttribute(n, c);
|
|
3497
|
+
}
|
|
3498
|
+
return t;
|
|
3499
|
+
}
|
|
3500
|
+
_assignVertexColorSpace(e, t) {
|
|
3501
|
+
if (t !== ce) return;
|
|
3502
|
+
const s = new he();
|
|
3503
|
+
for (let n = 0, i = e.count; n < i; n++)
|
|
3504
|
+
s.fromBufferAttribute(e, n), At.colorSpaceToWorking(s, ce), e.setXYZ(n, s.r, s.g, s.b);
|
|
3505
|
+
}
|
|
3506
|
+
_loadLibrary(e, t) {
|
|
3507
|
+
const s = new Ke(this.manager);
|
|
3508
|
+
return s.setPath(this.decoderPath), s.setResponseType(t), s.setWithCredentials(this.withCredentials), new Promise((n, i) => {
|
|
3509
|
+
s.load(e, n, void 0, i);
|
|
3510
|
+
});
|
|
3511
|
+
}
|
|
3512
|
+
preload() {
|
|
3513
|
+
return this._initDecoder(), this;
|
|
3514
|
+
}
|
|
3515
|
+
_initDecoder() {
|
|
3516
|
+
if (this.decoderPending) return this.decoderPending;
|
|
3517
|
+
const e = typeof WebAssembly != "object" || this.decoderConfig.type === "js", t = [];
|
|
3518
|
+
return e ? t.push(this._loadLibrary("draco_decoder.js", "text")) : (t.push(this._loadLibrary("draco_wasm_wrapper.js", "text")), t.push(this._loadLibrary("draco_decoder.wasm", "arraybuffer"))), this.decoderPending = Promise.all(t).then((s) => {
|
|
3519
|
+
const n = s[0];
|
|
3520
|
+
e || (this.decoderConfig.wasmBinary = s[1]);
|
|
3521
|
+
const i = qi.toString(), o = [
|
|
3522
|
+
"/* draco decoder */",
|
|
3523
|
+
n,
|
|
3524
|
+
"",
|
|
3525
|
+
"/* worker */",
|
|
3526
|
+
i.substring(i.indexOf("{") + 1, i.lastIndexOf("}"))
|
|
3527
|
+
].join(`
|
|
3528
|
+
`);
|
|
3529
|
+
this.workerSourceURL = URL.createObjectURL(new Blob([o]));
|
|
3530
|
+
}), this.decoderPending;
|
|
3531
|
+
}
|
|
3532
|
+
_getWorker(e, t) {
|
|
3533
|
+
return this._initDecoder().then(() => {
|
|
3534
|
+
if (this.workerPool.length < this.workerLimit) {
|
|
3535
|
+
const n = new Worker(this.workerSourceURL);
|
|
3536
|
+
n._callbacks = {}, n._taskCosts = {}, n._taskLoad = 0, n.postMessage({ type: "init", decoderConfig: this.decoderConfig }), n.onmessage = function(i) {
|
|
3537
|
+
const o = i.data;
|
|
3538
|
+
switch (o.type) {
|
|
3539
|
+
case "decode":
|
|
3540
|
+
n._callbacks[o.id].resolve(o);
|
|
3541
|
+
break;
|
|
3542
|
+
case "error":
|
|
3543
|
+
n._callbacks[o.id].reject(o);
|
|
3544
|
+
break;
|
|
3545
|
+
default:
|
|
3546
|
+
console.error('THREE.DRACOLoader: Unexpected message, "' + o.type + '"');
|
|
3547
|
+
}
|
|
3548
|
+
}, this.workerPool.push(n);
|
|
3549
|
+
} else
|
|
3550
|
+
this.workerPool.sort(function(n, i) {
|
|
3551
|
+
return n._taskLoad > i._taskLoad ? -1 : 1;
|
|
3552
|
+
});
|
|
3553
|
+
const s = this.workerPool[this.workerPool.length - 1];
|
|
3554
|
+
return s._taskCosts[e] = t, s._taskLoad += t, s;
|
|
3555
|
+
});
|
|
3556
|
+
}
|
|
3557
|
+
_releaseTask(e, t) {
|
|
3558
|
+
e._taskLoad -= e._taskCosts[t], delete e._callbacks[t], delete e._taskCosts[t];
|
|
3559
|
+
}
|
|
3560
|
+
debug() {
|
|
3561
|
+
console.log("Task load: ", this.workerPool.map((e) => e._taskLoad));
|
|
3562
|
+
}
|
|
3563
|
+
dispose() {
|
|
3564
|
+
for (let e = 0; e < this.workerPool.length; ++e)
|
|
3565
|
+
this.workerPool[e].terminate();
|
|
3566
|
+
return this.workerPool.length = 0, this.workerSourceURL !== "" && URL.revokeObjectURL(this.workerSourceURL), this;
|
|
3567
|
+
}
|
|
3342
3568
|
}
|
|
3343
|
-
function
|
|
3344
|
-
|
|
3345
|
-
|
|
3569
|
+
function qi() {
|
|
3570
|
+
let r, e;
|
|
3571
|
+
onmessage = function(o) {
|
|
3572
|
+
const a = o.data;
|
|
3573
|
+
switch (a.type) {
|
|
3574
|
+
case "init":
|
|
3575
|
+
r = a.decoderConfig, e = new Promise(function(u) {
|
|
3576
|
+
r.onModuleLoaded = function(h) {
|
|
3577
|
+
u({ draco: h });
|
|
3578
|
+
}, DracoDecoderModule(r);
|
|
3579
|
+
});
|
|
3580
|
+
break;
|
|
3581
|
+
case "decode":
|
|
3582
|
+
const l = a.buffer, c = a.taskConfig;
|
|
3583
|
+
e.then((u) => {
|
|
3584
|
+
const h = u.draco, d = new h.Decoder();
|
|
3585
|
+
try {
|
|
3586
|
+
const m = t(h, d, new Int8Array(l), c), w = m.attributes.map((f) => f.array.buffer);
|
|
3587
|
+
m.index && w.push(m.index.array.buffer), self.postMessage({ type: "decode", id: a.id, geometry: m }, w);
|
|
3588
|
+
} catch (m) {
|
|
3589
|
+
console.error(m), self.postMessage({ type: "error", id: a.id, error: m.message });
|
|
3590
|
+
} finally {
|
|
3591
|
+
h.destroy(d);
|
|
3592
|
+
}
|
|
3593
|
+
});
|
|
3594
|
+
break;
|
|
3595
|
+
}
|
|
3596
|
+
};
|
|
3597
|
+
function t(o, a, l, c) {
|
|
3598
|
+
const u = c.attributeIDs, h = c.attributeTypes;
|
|
3599
|
+
let d, m;
|
|
3600
|
+
const w = a.GetEncodedGeometryType(l);
|
|
3601
|
+
if (w === o.TRIANGULAR_MESH)
|
|
3602
|
+
d = new o.Mesh(), m = a.DecodeArrayToMesh(l, l.byteLength, d);
|
|
3603
|
+
else if (w === o.POINT_CLOUD)
|
|
3604
|
+
d = new o.PointCloud(), m = a.DecodeArrayToPointCloud(l, l.byteLength, d);
|
|
3605
|
+
else
|
|
3606
|
+
throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
|
|
3607
|
+
if (!m.ok() || d.ptr === 0)
|
|
3608
|
+
throw new Error("THREE.DRACOLoader: Decoding failed: " + m.error_msg());
|
|
3609
|
+
const f = { index: null, attributes: [] };
|
|
3610
|
+
for (const y in u) {
|
|
3611
|
+
const p = self[h[y]];
|
|
3612
|
+
let b, T;
|
|
3613
|
+
if (c.useUniqueIDs)
|
|
3614
|
+
T = u[y], b = a.GetAttributeByUniqueId(d, T);
|
|
3615
|
+
else {
|
|
3616
|
+
if (T = a.GetAttributeId(d, o[u[y]]), T === -1) continue;
|
|
3617
|
+
b = a.GetAttribute(d, T);
|
|
3618
|
+
}
|
|
3619
|
+
const M = n(o, a, d, y, p, b);
|
|
3620
|
+
y === "color" && (M.vertexColorSpace = c.vertexColorSpace), f.attributes.push(M);
|
|
3621
|
+
}
|
|
3622
|
+
return w === o.TRIANGULAR_MESH && (f.index = s(o, a, d)), o.destroy(d), f;
|
|
3623
|
+
}
|
|
3624
|
+
function s(o, a, l) {
|
|
3625
|
+
const u = l.num_faces() * 3, h = u * 4, d = o._malloc(h);
|
|
3626
|
+
a.GetTrianglesUInt32Array(l, h, d);
|
|
3627
|
+
const m = new Uint32Array(o.HEAPF32.buffer, d, u).slice();
|
|
3628
|
+
return o._free(d), { array: m, itemSize: 1 };
|
|
3629
|
+
}
|
|
3630
|
+
function n(o, a, l, c, u, h) {
|
|
3631
|
+
const d = l.num_points(), m = h.num_components(), w = i(o, u), f = m * u.BYTES_PER_ELEMENT, y = Math.ceil(f / 4) * 4, p = y / u.BYTES_PER_ELEMENT, b = d * f, T = d * y, M = o._malloc(b);
|
|
3632
|
+
a.GetAttributeDataArrayForAllPoints(l, h, w, b, M);
|
|
3633
|
+
const R = new u(o.HEAPF32.buffer, M, b / u.BYTES_PER_ELEMENT);
|
|
3634
|
+
let v;
|
|
3635
|
+
if (f === y)
|
|
3636
|
+
v = R.slice();
|
|
3637
|
+
else {
|
|
3638
|
+
v = new u(T / u.BYTES_PER_ELEMENT);
|
|
3639
|
+
let I = 0;
|
|
3640
|
+
for (let V = 0, W = R.length; V < W; V++) {
|
|
3641
|
+
for (let Q = 0; Q < m; Q++)
|
|
3642
|
+
v[I + Q] = R[V * m + Q];
|
|
3643
|
+
I += p;
|
|
3644
|
+
}
|
|
3645
|
+
}
|
|
3646
|
+
return o._free(M), {
|
|
3647
|
+
name: c,
|
|
3648
|
+
count: d,
|
|
3649
|
+
itemSize: m,
|
|
3650
|
+
array: v,
|
|
3651
|
+
stride: p
|
|
3652
|
+
};
|
|
3653
|
+
}
|
|
3654
|
+
function i(o, a) {
|
|
3655
|
+
switch (a) {
|
|
3656
|
+
case Float32Array:
|
|
3657
|
+
return o.DT_FLOAT32;
|
|
3658
|
+
case Int8Array:
|
|
3659
|
+
return o.DT_INT8;
|
|
3660
|
+
case Int16Array:
|
|
3661
|
+
return o.DT_INT16;
|
|
3662
|
+
case Int32Array:
|
|
3663
|
+
return o.DT_INT32;
|
|
3664
|
+
case Uint8Array:
|
|
3665
|
+
return o.DT_UINT8;
|
|
3666
|
+
case Uint16Array:
|
|
3667
|
+
return o.DT_UINT16;
|
|
3668
|
+
case Uint32Array:
|
|
3669
|
+
return o.DT_UINT32;
|
|
3670
|
+
}
|
|
3671
|
+
}
|
|
3672
|
+
}
|
|
3673
|
+
function $i() {
|
|
3674
|
+
const r = new H.BoxGeometry(1, 1, 1), e = new H.MeshStandardMaterial({ color: 43775 }), t = new H.Mesh(r, e);
|
|
3675
|
+
return t.position.y = 0.5, t.userData.isMovable = !0, t.name = "正方体", Ve(t, !0), t;
|
|
3676
|
+
}
|
|
3677
|
+
function Ji() {
|
|
3678
|
+
const r = new H.SphereGeometry(0.6, 32, 32), e = new H.MeshStandardMaterial({ color: 16746496 }), t = new H.Mesh(r, e);
|
|
3679
|
+
return t.position.y = 0.6, t.userData.isMovable = !0, t.name = "球体", Ve(t, !0), t;
|
|
3346
3680
|
}
|
|
3347
|
-
function
|
|
3681
|
+
function eo() {
|
|
3682
|
+
const r = new H.DirectionalLight(16777215);
|
|
3683
|
+
r.position.set(5, 5, 5), r.name = "平行光", r.userData.isMovable = !0, r.target.position.set(0, 0, 0);
|
|
3684
|
+
const e = new H.DirectionalLightHelper(r, 1);
|
|
3685
|
+
e.lightPlane.userData.name = "平行光辅助", e.userData.type = "lightHelper", r.userData.helper = e, Ve(e), Ve(r, !0);
|
|
3686
|
+
}
|
|
3687
|
+
function to(r) {
|
|
3348
3688
|
return new Promise((e, t) => {
|
|
3349
3689
|
var o;
|
|
3350
3690
|
const s = (o = r.name.split(".").pop()) == null ? void 0 : o.toLowerCase(), n = URL.createObjectURL(r);
|
|
3351
3691
|
let i;
|
|
3352
|
-
if (s === "obj")
|
|
3353
|
-
|
|
3354
|
-
else {
|
|
3692
|
+
if (s === "obj")
|
|
3693
|
+
i = new fi();
|
|
3694
|
+
else if (s === "gltf" || s === "glb") {
|
|
3695
|
+
const a = new Qi();
|
|
3696
|
+
a.setDecoderPath(
|
|
3697
|
+
"https://www.gstatic.com/draco/versioned/decoders/1.5.7/"
|
|
3698
|
+
);
|
|
3699
|
+
const l = new gi();
|
|
3700
|
+
l.setDRACOLoader(a), i = l;
|
|
3701
|
+
} else {
|
|
3355
3702
|
t(new Error("不支持的文件格式,请使用 .obj, .gltf, .glb"));
|
|
3356
3703
|
return;
|
|
3357
3704
|
}
|
|
@@ -3359,35 +3706,38 @@ function qi(r) {
|
|
|
3359
3706
|
n,
|
|
3360
3707
|
(a) => {
|
|
3361
3708
|
const l = s === "gltf" || s === "glb" ? a.scene : a;
|
|
3362
|
-
l.traverse((
|
|
3363
|
-
var
|
|
3364
|
-
|
|
3709
|
+
l.traverse((h) => {
|
|
3710
|
+
var d;
|
|
3711
|
+
h.userData.isMovable = !0, h.name || (h.name = h.type), h.type === "Mesh" && (h.frustumCulled = !0, (d = h.geometry) == null || d.computeVertexNormals());
|
|
3365
3712
|
});
|
|
3366
|
-
const u = new
|
|
3367
|
-
l.position.sub(u),
|
|
3713
|
+
const u = new H.Box3().setFromObject(l).getCenter(new H.Vector3());
|
|
3714
|
+
l.position.sub(u), Ve(l, !0), e(l);
|
|
3368
3715
|
},
|
|
3369
3716
|
void 0,
|
|
3370
3717
|
(a) => t(a)
|
|
3371
3718
|
);
|
|
3372
3719
|
});
|
|
3373
3720
|
}
|
|
3374
|
-
function
|
|
3721
|
+
function no(r) {
|
|
3375
3722
|
switch (r) {
|
|
3376
3723
|
case "box":
|
|
3377
|
-
|
|
3724
|
+
$i();
|
|
3378
3725
|
break;
|
|
3379
3726
|
case "sphere":
|
|
3380
|
-
|
|
3727
|
+
Ji();
|
|
3728
|
+
break;
|
|
3729
|
+
case "directionalLight":
|
|
3730
|
+
eo();
|
|
3381
3731
|
break;
|
|
3382
3732
|
}
|
|
3383
3733
|
}
|
|
3384
|
-
const
|
|
3734
|
+
const so = {
|
|
3385
3735
|
key: 1,
|
|
3386
3736
|
class: "toggle-placeholder"
|
|
3387
|
-
},
|
|
3737
|
+
}, io = { class: "tree-icon" }, oo = { class: "tree-name" }, ro = {
|
|
3388
3738
|
key: 0,
|
|
3389
3739
|
class: "tree-children"
|
|
3390
|
-
},
|
|
3740
|
+
}, ao = /* @__PURE__ */ Ze({
|
|
3391
3741
|
__name: "TreeItem",
|
|
3392
3742
|
props: {
|
|
3393
3743
|
node: {},
|
|
@@ -3396,15 +3746,15 @@ const $i = {
|
|
|
3396
3746
|
},
|
|
3397
3747
|
emits: ["select", "delete"],
|
|
3398
3748
|
setup(r, { emit: e }) {
|
|
3399
|
-
const t = r, s = e, n =
|
|
3749
|
+
const t = r, s = e, n = U(null), { expandedSet: i, toggleExpand: o } = Pn("treeExpand"), a = et(() => i.value.has(t.node.uuid)), l = et(() => (t.version, t.node.children.some((f) => f.userData.isMovable === !0))), c = et(() => (t.version, t.node.children.filter(
|
|
3400
3750
|
(f) => f.userData.isMovable === !0
|
|
3401
|
-
))), u =
|
|
3751
|
+
))), u = et(
|
|
3402
3752
|
() => {
|
|
3403
3753
|
var f;
|
|
3404
3754
|
return ((f = t.selectedObject) == null ? void 0 : f.uuid) === t.node.uuid;
|
|
3405
3755
|
}
|
|
3406
3756
|
);
|
|
3407
|
-
|
|
3757
|
+
Ln(
|
|
3408
3758
|
() => {
|
|
3409
3759
|
u.value && n.value && n.value.scrollIntoView({
|
|
3410
3760
|
block: "nearest",
|
|
@@ -3415,55 +3765,55 @@ const $i = {
|
|
|
3415
3765
|
},
|
|
3416
3766
|
{ flush: "post" }
|
|
3417
3767
|
);
|
|
3418
|
-
const
|
|
3768
|
+
const h = (f) => {
|
|
3419
3769
|
f.stopPropagation(), s("select", t.node);
|
|
3420
|
-
},
|
|
3770
|
+
}, d = (f) => {
|
|
3421
3771
|
f.stopPropagation(), s("delete", t.node);
|
|
3422
3772
|
}, m = (f) => f.type === "Mesh" || f.type === "Sprite" ? "🟦" : f.type === "Light" ? "💡" : "📦", w = (f) => f.name || `${f.type} (${f.id})`;
|
|
3423
3773
|
return (f, y) => {
|
|
3424
|
-
const
|
|
3425
|
-
return
|
|
3774
|
+
const p = In("TreeItem", !0);
|
|
3775
|
+
return k(), z("div", {
|
|
3426
3776
|
class: "tree-node",
|
|
3427
3777
|
ref_key: "nodeRef",
|
|
3428
3778
|
ref: n
|
|
3429
3779
|
}, [
|
|
3430
3780
|
g("div", {
|
|
3431
|
-
class:
|
|
3432
|
-
onClick:
|
|
3781
|
+
class: Be(["tree-item", { selected: u.value }]),
|
|
3782
|
+
onClick: h
|
|
3433
3783
|
}, [
|
|
3434
|
-
l.value ? (
|
|
3784
|
+
l.value ? (k(), z("span", {
|
|
3435
3785
|
key: 0,
|
|
3436
3786
|
class: "toggle-icon",
|
|
3437
|
-
onClick: y[0] || (y[0] =
|
|
3438
|
-
},
|
|
3439
|
-
g("span",
|
|
3440
|
-
g("span",
|
|
3787
|
+
onClick: y[0] || (y[0] = Nt((b) => Cn(o)(r.node.uuid), ["stop"]))
|
|
3788
|
+
}, ve(a.value ? "▼" : "▶"), 1)) : (k(), z("span", so)),
|
|
3789
|
+
g("span", io, ve(m(r.node)), 1),
|
|
3790
|
+
g("span", oo, ve(w(r.node)), 1),
|
|
3441
3791
|
g("button", {
|
|
3442
3792
|
class: "tree-delete",
|
|
3443
|
-
onClick:
|
|
3793
|
+
onClick: Nt(d, ["stop"])
|
|
3444
3794
|
}, "×")
|
|
3445
3795
|
], 2),
|
|
3446
|
-
a.value && l.value ? (
|
|
3447
|
-
(
|
|
3796
|
+
a.value && l.value ? (k(), z("div", ro, [
|
|
3797
|
+
(k(!0), z(ln, null, cn(c.value, (b) => (k(), je(p, {
|
|
3448
3798
|
key: b.uuid,
|
|
3449
3799
|
node: b,
|
|
3450
3800
|
"selected-object": r.selectedObject,
|
|
3451
3801
|
version: r.version,
|
|
3452
|
-
onSelect: y[1] || (y[1] = (
|
|
3453
|
-
onDelete: y[2] || (y[2] = (
|
|
3802
|
+
onSelect: y[1] || (y[1] = (T) => s("select", T)),
|
|
3803
|
+
onDelete: y[2] || (y[2] = (T) => s("delete", T))
|
|
3454
3804
|
}, null, 8, ["node", "selected-object", "version"]))), 128))
|
|
3455
|
-
])) :
|
|
3805
|
+
])) : le("", !0)
|
|
3456
3806
|
], 512);
|
|
3457
3807
|
};
|
|
3458
3808
|
}
|
|
3459
|
-
}),
|
|
3809
|
+
}), We = (r, e) => {
|
|
3460
3810
|
const t = r.__vccOpts || r;
|
|
3461
3811
|
for (const [s, n] of e)
|
|
3462
3812
|
t[s] = n;
|
|
3463
3813
|
return t;
|
|
3464
|
-
},
|
|
3465
|
-
function
|
|
3466
|
-
const e =
|
|
3814
|
+
}, lo = /* @__PURE__ */ We(ao, [["__scopeId", "data-v-5ad9c842"]]);
|
|
3815
|
+
function co(r) {
|
|
3816
|
+
const e = U(/* @__PURE__ */ new Set()), t = (n) => {
|
|
3467
3817
|
const i = new Set(e.value);
|
|
3468
3818
|
i.has(n) ? i.delete(n) : i.add(n), e.value = i;
|
|
3469
3819
|
}, s = (n) => {
|
|
@@ -3474,7 +3824,7 @@ function io(r) {
|
|
|
3474
3824
|
i.add(o.uuid), o = o.parent;
|
|
3475
3825
|
e.value = i;
|
|
3476
3826
|
};
|
|
3477
|
-
return
|
|
3827
|
+
return hn(
|
|
3478
3828
|
r,
|
|
3479
3829
|
(n) => {
|
|
3480
3830
|
n && s(n);
|
|
@@ -3482,28 +3832,28 @@ function io(r) {
|
|
|
3482
3832
|
{ immediate: !0 }
|
|
3483
3833
|
), { expandedSet: e, toggleExpand: t };
|
|
3484
3834
|
}
|
|
3485
|
-
const
|
|
3835
|
+
const ho = {
|
|
3486
3836
|
key: 0,
|
|
3487
3837
|
class: "property-panel"
|
|
3488
|
-
},
|
|
3838
|
+
}, uo = { class: "property-group tree-group" }, po = { class: "tree-container" }, fo = {
|
|
3489
3839
|
key: 0,
|
|
3490
3840
|
class: "tree-empty"
|
|
3491
|
-
},
|
|
3841
|
+
}, mo = {
|
|
3492
3842
|
key: 0,
|
|
3493
3843
|
class: "tabs"
|
|
3494
|
-
},
|
|
3844
|
+
}, go = {
|
|
3495
3845
|
key: 1,
|
|
3496
3846
|
class: "tab-content"
|
|
3497
|
-
},
|
|
3847
|
+
}, yo = { class: "property-group" }, _o = { class: "row" }, bo = { class: "property-group" }, wo = { class: "row" }, To = { class: "property-group" }, xo = { class: "row" }, Eo = {
|
|
3498
3848
|
key: 0,
|
|
3499
3849
|
class: "property-group material-group"
|
|
3500
|
-
},
|
|
3850
|
+
}, Mo = { class: "slider-row" }, vo = { class: "slider-value" }, So = { class: "slider-row" }, Ao = { class: "slider-value" }, Ro = { class: "slider-row" }, Po = { class: "slider-value" }, Lo = {
|
|
3501
3851
|
key: 0,
|
|
3502
3852
|
class: "material-hint"
|
|
3503
|
-
},
|
|
3853
|
+
}, Io = {
|
|
3504
3854
|
key: 1,
|
|
3505
3855
|
class: "property-panel empty"
|
|
3506
|
-
},
|
|
3856
|
+
}, Co = /* @__PURE__ */ Ze({
|
|
3507
3857
|
__name: "PropertyPanel",
|
|
3508
3858
|
props: {
|
|
3509
3859
|
transform: {},
|
|
@@ -3512,24 +3862,24 @@ const oo = {
|
|
|
3512
3862
|
},
|
|
3513
3863
|
emits: ["propertyChange", "treeSelect", "treeDelete"],
|
|
3514
3864
|
setup(r, { emit: e }) {
|
|
3515
|
-
const t = r, s = e, n = () => s("propertyChange"), i =
|
|
3516
|
-
|
|
3865
|
+
const t = r, s = e, n = () => s("propertyChange"), i = U("transform"), o = U(0), a = Dn(t, "selectedObject"), { expandedSet: l, toggleExpand: c } = co(a);
|
|
3866
|
+
On("treeExpand", { expandedSet: l, toggleExpand: c });
|
|
3517
3867
|
const u = (y) => {
|
|
3518
3868
|
o.value++, s("treeDelete", y);
|
|
3519
|
-
},
|
|
3869
|
+
}, h = un({
|
|
3520
3870
|
metalness: 0,
|
|
3521
3871
|
roughness: 0.5,
|
|
3522
3872
|
opacity: 1
|
|
3523
|
-
}),
|
|
3873
|
+
}), d = U(!1);
|
|
3524
3874
|
function m(y) {
|
|
3525
|
-
let
|
|
3875
|
+
let p = null;
|
|
3526
3876
|
return y.traverse((b) => {
|
|
3527
|
-
if (b.type === "Mesh" && !
|
|
3528
|
-
const
|
|
3529
|
-
for (const R of
|
|
3877
|
+
if (b.type === "Mesh" && !p) {
|
|
3878
|
+
const T = b, M = Array.isArray(T.material) ? T.material : [T.material];
|
|
3879
|
+
for (const R of M)
|
|
3530
3880
|
if (R && (R.type === "MeshStandardMaterial" || R.type === "MeshPhongMaterial")) {
|
|
3531
3881
|
const v = R;
|
|
3532
|
-
|
|
3882
|
+
p = {
|
|
3533
3883
|
metalness: v.metalness ?? 0,
|
|
3534
3884
|
roughness: v.roughness ?? 0.5,
|
|
3535
3885
|
opacity: R.opacity ?? 1
|
|
@@ -3537,110 +3887,110 @@ const oo = {
|
|
|
3537
3887
|
break;
|
|
3538
3888
|
}
|
|
3539
3889
|
}
|
|
3540
|
-
}),
|
|
3890
|
+
}), p;
|
|
3541
3891
|
}
|
|
3542
|
-
function w(y,
|
|
3892
|
+
function w(y, p) {
|
|
3543
3893
|
let b = !1;
|
|
3544
|
-
return y.traverse((
|
|
3545
|
-
if (
|
|
3546
|
-
const
|
|
3894
|
+
return y.traverse((T) => {
|
|
3895
|
+
if (T.type === "Mesh") {
|
|
3896
|
+
const M = T, R = Array.isArray(M.material) ? M.material : [M.material];
|
|
3547
3897
|
for (const v of R)
|
|
3548
|
-
v && (v.type === "MeshStandardMaterial" || v.type === "MeshPhongMaterial") && (
|
|
3898
|
+
v && (v.type === "MeshStandardMaterial" || v.type === "MeshPhongMaterial") && (p.metalness !== void 0 && (v.metalness = p.metalness), p.roughness !== void 0 && (v.roughness = p.roughness), p.opacity !== void 0 && (v.opacity = p.opacity, v.transparent = p.opacity < 1), v.needsUpdate = !0, b = !0);
|
|
3549
3899
|
}
|
|
3550
3900
|
}), b;
|
|
3551
3901
|
}
|
|
3552
3902
|
function f() {
|
|
3553
3903
|
if (t.selectedObject) {
|
|
3554
3904
|
const y = w(t.selectedObject, {
|
|
3555
|
-
metalness:
|
|
3556
|
-
roughness:
|
|
3557
|
-
opacity:
|
|
3905
|
+
metalness: h.metalness,
|
|
3906
|
+
roughness: h.roughness,
|
|
3907
|
+
opacity: h.opacity
|
|
3558
3908
|
});
|
|
3559
|
-
|
|
3909
|
+
d.value = y;
|
|
3560
3910
|
}
|
|
3561
3911
|
}
|
|
3562
|
-
return
|
|
3912
|
+
return hn(
|
|
3563
3913
|
() => t.selectedObject,
|
|
3564
3914
|
(y) => {
|
|
3565
3915
|
if (y) {
|
|
3566
|
-
const
|
|
3567
|
-
|
|
3916
|
+
const p = m(y);
|
|
3917
|
+
p ? (h.metalness = p.metalness, h.roughness = p.roughness, h.opacity = p.opacity, d.value = !0) : (h.metalness = 0, h.roughness = 0.5, h.opacity = 1, d.value = !1);
|
|
3568
3918
|
} else
|
|
3569
|
-
|
|
3919
|
+
h.metalness = 0, h.roughness = 0.5, h.opacity = 1, d.value = !1;
|
|
3570
3920
|
},
|
|
3571
3921
|
{ immediate: !0 }
|
|
3572
|
-
), (y,
|
|
3573
|
-
|
|
3574
|
-
g("div",
|
|
3575
|
-
|
|
3576
|
-
g("div",
|
|
3577
|
-
(
|
|
3922
|
+
), (y, p) => r.transform ? (k(), z("div", ho, [
|
|
3923
|
+
p[32] || (p[32] = g("h3", null, "属性面板", -1)),
|
|
3924
|
+
g("div", uo, [
|
|
3925
|
+
p[15] || (p[15] = g("label", null, "场景物体", -1)),
|
|
3926
|
+
g("div", po, [
|
|
3927
|
+
(k(!0), z(ln, null, cn(r.treeData, (b) => (k(), je(lo, {
|
|
3578
3928
|
key: b.uuid,
|
|
3579
3929
|
node: b,
|
|
3580
3930
|
"selected-object": r.selectedObject,
|
|
3581
3931
|
version: o.value,
|
|
3582
|
-
onSelect:
|
|
3932
|
+
onSelect: p[0] || (p[0] = (T) => s("treeSelect", T)),
|
|
3583
3933
|
onDelete: u
|
|
3584
3934
|
}, null, 8, ["node", "selected-object", "version"]))), 128)),
|
|
3585
|
-
r.treeData.length === 0 ? (
|
|
3935
|
+
r.treeData.length === 0 ? (k(), z("div", fo, "暂无物体")) : le("", !0)
|
|
3586
3936
|
])
|
|
3587
3937
|
]),
|
|
3588
|
-
|
|
3938
|
+
p[33] || (p[33] = g("div", { class: "property-group" }, [
|
|
3589
3939
|
g("label", null, "全局属性"),
|
|
3590
3940
|
g("div", { class: "row" })
|
|
3591
3941
|
], -1)),
|
|
3592
|
-
r.selectedObject ? (
|
|
3942
|
+
r.selectedObject ? (k(), z("div", mo, [
|
|
3593
3943
|
g("button", {
|
|
3594
|
-
class:
|
|
3595
|
-
onClick:
|
|
3944
|
+
class: Be(["tab-btn", { active: i.value === "transform" }]),
|
|
3945
|
+
onClick: p[1] || (p[1] = (b) => i.value = "transform")
|
|
3596
3946
|
}, " 🔄 变换 ", 2),
|
|
3597
3947
|
g("button", {
|
|
3598
|
-
class:
|
|
3599
|
-
onClick:
|
|
3948
|
+
class: Be(["tab-btn", { active: i.value === "info" }]),
|
|
3949
|
+
onClick: p[2] || (p[2] = (b) => i.value = "info")
|
|
3600
3950
|
}, " ℹ️ 信息 ", 2)
|
|
3601
|
-
])) :
|
|
3602
|
-
r.selectedObject ? (
|
|
3603
|
-
|
|
3604
|
-
g("div",
|
|
3605
|
-
|
|
3606
|
-
g("div",
|
|
3607
|
-
|
|
3608
|
-
|
|
3951
|
+
])) : le("", !0),
|
|
3952
|
+
r.selectedObject ? (k(), z("div", go, [
|
|
3953
|
+
O(g("div", null, [
|
|
3954
|
+
g("div", yo, [
|
|
3955
|
+
p[19] || (p[19] = g("label", null, "位置", -1)),
|
|
3956
|
+
g("div", _o, [
|
|
3957
|
+
p[16] || (p[16] = g("span", null, "X:", -1)),
|
|
3958
|
+
O(g("input", {
|
|
3609
3959
|
type: "number",
|
|
3610
|
-
"onUpdate:modelValue":
|
|
3960
|
+
"onUpdate:modelValue": p[3] || (p[3] = (b) => r.transform.position.x = b),
|
|
3611
3961
|
step: "0.01",
|
|
3612
3962
|
onInput: n
|
|
3613
3963
|
}, null, 544), [
|
|
3614
3964
|
[
|
|
3615
|
-
|
|
3965
|
+
$,
|
|
3616
3966
|
r.transform.position.x,
|
|
3617
3967
|
void 0,
|
|
3618
3968
|
{ number: !0 }
|
|
3619
3969
|
]
|
|
3620
3970
|
]),
|
|
3621
|
-
|
|
3622
|
-
|
|
3971
|
+
p[17] || (p[17] = g("span", null, "Y:", -1)),
|
|
3972
|
+
O(g("input", {
|
|
3623
3973
|
type: "number",
|
|
3624
|
-
"onUpdate:modelValue":
|
|
3974
|
+
"onUpdate:modelValue": p[4] || (p[4] = (b) => r.transform.position.y = b),
|
|
3625
3975
|
step: "0.01",
|
|
3626
3976
|
onInput: n
|
|
3627
3977
|
}, null, 544), [
|
|
3628
3978
|
[
|
|
3629
|
-
|
|
3979
|
+
$,
|
|
3630
3980
|
r.transform.position.y,
|
|
3631
3981
|
void 0,
|
|
3632
3982
|
{ number: !0 }
|
|
3633
3983
|
]
|
|
3634
3984
|
]),
|
|
3635
|
-
|
|
3636
|
-
|
|
3985
|
+
p[18] || (p[18] = g("span", null, "Z:", -1)),
|
|
3986
|
+
O(g("input", {
|
|
3637
3987
|
type: "number",
|
|
3638
|
-
"onUpdate:modelValue":
|
|
3988
|
+
"onUpdate:modelValue": p[5] || (p[5] = (b) => r.transform.position.z = b),
|
|
3639
3989
|
step: "0.01",
|
|
3640
3990
|
onInput: n
|
|
3641
3991
|
}, null, 544), [
|
|
3642
3992
|
[
|
|
3643
|
-
|
|
3993
|
+
$,
|
|
3644
3994
|
r.transform.position.z,
|
|
3645
3995
|
void 0,
|
|
3646
3996
|
{ number: !0 }
|
|
@@ -3648,46 +3998,46 @@ const oo = {
|
|
|
3648
3998
|
])
|
|
3649
3999
|
])
|
|
3650
4000
|
]),
|
|
3651
|
-
g("div",
|
|
3652
|
-
|
|
3653
|
-
g("div",
|
|
3654
|
-
|
|
3655
|
-
|
|
4001
|
+
g("div", bo, [
|
|
4002
|
+
p[23] || (p[23] = g("label", null, "旋转 (弧度)", -1)),
|
|
4003
|
+
g("div", wo, [
|
|
4004
|
+
p[20] || (p[20] = g("span", null, "X:", -1)),
|
|
4005
|
+
O(g("input", {
|
|
3656
4006
|
type: "number",
|
|
3657
|
-
"onUpdate:modelValue":
|
|
4007
|
+
"onUpdate:modelValue": p[6] || (p[6] = (b) => r.transform.rotation.x = b),
|
|
3658
4008
|
step: "0.01",
|
|
3659
4009
|
onInput: n
|
|
3660
4010
|
}, null, 544), [
|
|
3661
4011
|
[
|
|
3662
|
-
|
|
4012
|
+
$,
|
|
3663
4013
|
r.transform.rotation.x,
|
|
3664
4014
|
void 0,
|
|
3665
4015
|
{ number: !0 }
|
|
3666
4016
|
]
|
|
3667
4017
|
]),
|
|
3668
|
-
|
|
3669
|
-
|
|
4018
|
+
p[21] || (p[21] = g("span", null, "Y:", -1)),
|
|
4019
|
+
O(g("input", {
|
|
3670
4020
|
type: "number",
|
|
3671
|
-
"onUpdate:modelValue":
|
|
4021
|
+
"onUpdate:modelValue": p[7] || (p[7] = (b) => r.transform.rotation.y = b),
|
|
3672
4022
|
step: "0.01",
|
|
3673
4023
|
onInput: n
|
|
3674
4024
|
}, null, 544), [
|
|
3675
4025
|
[
|
|
3676
|
-
|
|
4026
|
+
$,
|
|
3677
4027
|
r.transform.rotation.y,
|
|
3678
4028
|
void 0,
|
|
3679
4029
|
{ number: !0 }
|
|
3680
4030
|
]
|
|
3681
4031
|
]),
|
|
3682
|
-
|
|
3683
|
-
|
|
4032
|
+
p[22] || (p[22] = g("span", null, "Z:", -1)),
|
|
4033
|
+
O(g("input", {
|
|
3684
4034
|
type: "number",
|
|
3685
|
-
"onUpdate:modelValue":
|
|
4035
|
+
"onUpdate:modelValue": p[8] || (p[8] = (b) => r.transform.rotation.z = b),
|
|
3686
4036
|
step: "0.01",
|
|
3687
4037
|
onInput: n
|
|
3688
4038
|
}, null, 544), [
|
|
3689
4039
|
[
|
|
3690
|
-
|
|
4040
|
+
$,
|
|
3691
4041
|
r.transform.rotation.z,
|
|
3692
4042
|
void 0,
|
|
3693
4043
|
{ number: !0 }
|
|
@@ -3695,46 +4045,46 @@ const oo = {
|
|
|
3695
4045
|
])
|
|
3696
4046
|
])
|
|
3697
4047
|
]),
|
|
3698
|
-
g("div",
|
|
3699
|
-
|
|
3700
|
-
g("div",
|
|
3701
|
-
|
|
3702
|
-
|
|
4048
|
+
g("div", To, [
|
|
4049
|
+
p[27] || (p[27] = g("label", null, "缩放", -1)),
|
|
4050
|
+
g("div", xo, [
|
|
4051
|
+
p[24] || (p[24] = g("span", null, "X:", -1)),
|
|
4052
|
+
O(g("input", {
|
|
3703
4053
|
type: "number",
|
|
3704
|
-
"onUpdate:modelValue":
|
|
4054
|
+
"onUpdate:modelValue": p[9] || (p[9] = (b) => r.transform.scale.x = b),
|
|
3705
4055
|
step: "0.01",
|
|
3706
4056
|
onInput: n
|
|
3707
4057
|
}, null, 544), [
|
|
3708
4058
|
[
|
|
3709
|
-
|
|
4059
|
+
$,
|
|
3710
4060
|
r.transform.scale.x,
|
|
3711
4061
|
void 0,
|
|
3712
4062
|
{ number: !0 }
|
|
3713
4063
|
]
|
|
3714
4064
|
]),
|
|
3715
|
-
|
|
3716
|
-
|
|
4065
|
+
p[25] || (p[25] = g("span", null, "Y:", -1)),
|
|
4066
|
+
O(g("input", {
|
|
3717
4067
|
type: "number",
|
|
3718
|
-
"onUpdate:modelValue":
|
|
4068
|
+
"onUpdate:modelValue": p[10] || (p[10] = (b) => r.transform.scale.y = b),
|
|
3719
4069
|
step: "0.01",
|
|
3720
4070
|
onInput: n
|
|
3721
4071
|
}, null, 544), [
|
|
3722
4072
|
[
|
|
3723
|
-
|
|
4073
|
+
$,
|
|
3724
4074
|
r.transform.scale.y,
|
|
3725
4075
|
void 0,
|
|
3726
4076
|
{ number: !0 }
|
|
3727
4077
|
]
|
|
3728
4078
|
]),
|
|
3729
|
-
|
|
3730
|
-
|
|
4079
|
+
p[26] || (p[26] = g("span", null, "Z:", -1)),
|
|
4080
|
+
O(g("input", {
|
|
3731
4081
|
type: "number",
|
|
3732
|
-
"onUpdate:modelValue":
|
|
4082
|
+
"onUpdate:modelValue": p[11] || (p[11] = (b) => r.transform.scale.z = b),
|
|
3733
4083
|
step: "0.01",
|
|
3734
4084
|
onInput: n
|
|
3735
4085
|
}, null, 544), [
|
|
3736
4086
|
[
|
|
3737
|
-
|
|
4087
|
+
$,
|
|
3738
4088
|
r.transform.scale.z,
|
|
3739
4089
|
void 0,
|
|
3740
4090
|
{ number: !0 }
|
|
@@ -3742,263 +4092,274 @@ const oo = {
|
|
|
3742
4092
|
])
|
|
3743
4093
|
])
|
|
3744
4094
|
]),
|
|
3745
|
-
r.selectedObject ? (
|
|
3746
|
-
|
|
3747
|
-
g("div",
|
|
3748
|
-
|
|
3749
|
-
|
|
4095
|
+
r.selectedObject ? (k(), z("div", Eo, [
|
|
4096
|
+
p[31] || (p[31] = g("label", null, "材质", -1)),
|
|
4097
|
+
g("div", Mo, [
|
|
4098
|
+
p[28] || (p[28] = g("span", { class: "slider-label" }, "金属度", -1)),
|
|
4099
|
+
O(g("input", {
|
|
3750
4100
|
type: "range",
|
|
3751
4101
|
min: "0",
|
|
3752
4102
|
max: "1",
|
|
3753
4103
|
step: "0.01",
|
|
3754
|
-
"onUpdate:modelValue":
|
|
4104
|
+
"onUpdate:modelValue": p[12] || (p[12] = (b) => h.metalness = b),
|
|
3755
4105
|
onInput: f
|
|
3756
4106
|
}, null, 544), [
|
|
3757
4107
|
[
|
|
3758
|
-
|
|
3759
|
-
|
|
4108
|
+
$,
|
|
4109
|
+
h.metalness,
|
|
3760
4110
|
void 0,
|
|
3761
4111
|
{ number: !0 }
|
|
3762
4112
|
]
|
|
3763
4113
|
]),
|
|
3764
|
-
g("span",
|
|
4114
|
+
g("span", vo, ve(h.metalness.toFixed(2)), 1)
|
|
3765
4115
|
]),
|
|
3766
|
-
g("div",
|
|
3767
|
-
|
|
3768
|
-
|
|
4116
|
+
g("div", So, [
|
|
4117
|
+
p[29] || (p[29] = g("span", { class: "slider-label" }, "粗糙度", -1)),
|
|
4118
|
+
O(g("input", {
|
|
3769
4119
|
type: "range",
|
|
3770
4120
|
min: "0",
|
|
3771
4121
|
max: "1",
|
|
3772
4122
|
step: "0.01",
|
|
3773
|
-
"onUpdate:modelValue":
|
|
4123
|
+
"onUpdate:modelValue": p[13] || (p[13] = (b) => h.roughness = b),
|
|
3774
4124
|
onInput: f
|
|
3775
4125
|
}, null, 544), [
|
|
3776
4126
|
[
|
|
3777
|
-
|
|
3778
|
-
|
|
4127
|
+
$,
|
|
4128
|
+
h.roughness,
|
|
3779
4129
|
void 0,
|
|
3780
4130
|
{ number: !0 }
|
|
3781
4131
|
]
|
|
3782
4132
|
]),
|
|
3783
|
-
g("span",
|
|
4133
|
+
g("span", Ao, ve(h.roughness.toFixed(2)), 1)
|
|
3784
4134
|
]),
|
|
3785
|
-
g("div",
|
|
3786
|
-
|
|
3787
|
-
|
|
4135
|
+
g("div", Ro, [
|
|
4136
|
+
p[30] || (p[30] = g("span", { class: "slider-label" }, "透明度", -1)),
|
|
4137
|
+
O(g("input", {
|
|
3788
4138
|
type: "range",
|
|
3789
4139
|
min: "0",
|
|
3790
4140
|
max: "1",
|
|
3791
4141
|
step: "0.01",
|
|
3792
|
-
"onUpdate:modelValue":
|
|
4142
|
+
"onUpdate:modelValue": p[14] || (p[14] = (b) => h.opacity = b),
|
|
3793
4143
|
onInput: f
|
|
3794
4144
|
}, null, 544), [
|
|
3795
4145
|
[
|
|
3796
|
-
|
|
3797
|
-
|
|
4146
|
+
$,
|
|
4147
|
+
h.opacity,
|
|
3798
4148
|
void 0,
|
|
3799
4149
|
{ number: !0 }
|
|
3800
4150
|
]
|
|
3801
4151
|
]),
|
|
3802
|
-
g("span",
|
|
4152
|
+
g("span", Po, ve(h.opacity.toFixed(2)), 1)
|
|
3803
4153
|
]),
|
|
3804
|
-
|
|
3805
|
-
])) :
|
|
4154
|
+
d.value ? le("", !0) : (k(), z("div", Lo, " ⚠️ 当前材质不支持金属度/粗糙度(仅支持 Standard/Phong) "))
|
|
4155
|
+
])) : le("", !0)
|
|
3806
4156
|
], 512), [
|
|
3807
|
-
[
|
|
4157
|
+
[re, i.value === "transform"]
|
|
3808
4158
|
])
|
|
3809
|
-
])) :
|
|
3810
|
-
])) : (
|
|
4159
|
+
])) : le("", !0)
|
|
4160
|
+
])) : (k(), z("div", Io, [...p[34] || (p[34] = [
|
|
3811
4161
|
g("p", null, "未选中任何模型", -1)
|
|
3812
4162
|
])]));
|
|
3813
4163
|
}
|
|
3814
|
-
}),
|
|
4164
|
+
}), Do = /* @__PURE__ */ We(Co, [["__scopeId", "data-v-d75c643f"]]), Oo = { class: "top-bar" }, ko = { class: "left-section" }, No = { class: "dropdown-menu" }, jo = { class: "dropdown-menu sub-menu" }, Ho = { class: "dropdown-menu" }, Fo = { class: "dropdown-menu sub-menu" }, Uo = { class: "dropdown-menu sub-menu" }, zo = { class: "dropdown-menu" }, Go = { class: "dropdown-menu" }, Xo = { class: "dropdown-menu" }, Bo = /* @__PURE__ */ Ze({
|
|
3815
4165
|
__name: "TopBar",
|
|
3816
4166
|
emits: ["addModel", "importModel"],
|
|
3817
4167
|
setup(r, { emit: e }) {
|
|
3818
|
-
const t =
|
|
3819
|
-
var
|
|
3820
|
-
return (
|
|
3821
|
-
},
|
|
3822
|
-
const
|
|
3823
|
-
|
|
3824
|
-
},
|
|
3825
|
-
return (
|
|
3826
|
-
g("div",
|
|
4168
|
+
const t = U(!1), s = U(!1), n = U(!1), i = U(!1), o = U(!1), a = U(!1), l = U(!1), c = U(!1), u = e, h = U(null), d = () => {
|
|
4169
|
+
var ge;
|
|
4170
|
+
return (ge = h.value) == null ? void 0 : ge.click();
|
|
4171
|
+
}, m = (ge) => {
|
|
4172
|
+
const x = ge.target;
|
|
4173
|
+
x.files && x.files.length > 0 && (u("importModel", x.files[0]), x.value = "");
|
|
4174
|
+
}, w = () => console.log("新建项目"), f = () => console.log("保存场景"), y = () => console.log("导出模型"), p = () => console.log("撤销"), b = () => console.log("重做"), T = () => console.log("复制物体"), M = () => console.log("删除物体"), R = () => console.log("重置相机"), v = () => console.log("切换网格"), I = () => console.log("打开帮助"), V = () => console.log("关于编辑器"), W = () => console.log("打开项目"), Q = () => console.log("打开模型"), me = () => console.log("打开场景");
|
|
4175
|
+
return (ge, x) => (k(), z("div", Oo, [
|
|
4176
|
+
g("div", ko, [
|
|
3827
4177
|
g("div", {
|
|
3828
4178
|
class: "dropdown-wrapper",
|
|
3829
|
-
onMouseenter:
|
|
3830
|
-
onMouseleave:
|
|
4179
|
+
onMouseenter: x[2] || (x[2] = (P) => t.value = !0),
|
|
4180
|
+
onMouseleave: x[3] || (x[3] = (P) => t.value = !1)
|
|
3831
4181
|
}, [
|
|
3832
|
-
|
|
3833
|
-
|
|
4182
|
+
x[20] || (x[20] = g("button", { class: "menu-btn" }, "文件", -1)),
|
|
4183
|
+
O(g("div", No, [
|
|
3834
4184
|
g("div", {
|
|
3835
4185
|
class: "menu-item",
|
|
3836
|
-
onClick:
|
|
4186
|
+
onClick: w
|
|
3837
4187
|
}, "新建"),
|
|
3838
4188
|
g("div", {
|
|
3839
4189
|
class: "menu-item dropdown-wrapper sub-trigger",
|
|
3840
|
-
onMouseenter:
|
|
3841
|
-
onMouseleave:
|
|
4190
|
+
onMouseenter: x[0] || (x[0] = (P) => a.value = !0),
|
|
4191
|
+
onMouseleave: x[1] || (x[1] = (P) => a.value = !1)
|
|
3842
4192
|
}, [
|
|
3843
|
-
|
|
3844
|
-
|
|
4193
|
+
x[19] || (x[19] = g("span", null, "打开", -1)),
|
|
4194
|
+
O(g("div", jo, [
|
|
3845
4195
|
g("div", {
|
|
3846
4196
|
class: "menu-item",
|
|
3847
|
-
onClick:
|
|
4197
|
+
onClick: W
|
|
3848
4198
|
}, "打开项目"),
|
|
3849
4199
|
g("div", {
|
|
3850
4200
|
class: "menu-item",
|
|
3851
|
-
onClick:
|
|
4201
|
+
onClick: Q
|
|
3852
4202
|
}, "打开模型"),
|
|
3853
4203
|
g("div", {
|
|
3854
4204
|
class: "menu-item",
|
|
3855
4205
|
onClick: me
|
|
3856
4206
|
}, "打开场景")
|
|
3857
4207
|
], 512), [
|
|
3858
|
-
[
|
|
4208
|
+
[re, a.value]
|
|
3859
4209
|
])
|
|
3860
4210
|
], 32),
|
|
3861
4211
|
g("div", {
|
|
3862
4212
|
class: "menu-item",
|
|
3863
|
-
onClick:
|
|
4213
|
+
onClick: f
|
|
3864
4214
|
}, "保存"),
|
|
3865
4215
|
g("div", {
|
|
3866
4216
|
class: "menu-item",
|
|
3867
|
-
onClick:
|
|
4217
|
+
onClick: y
|
|
3868
4218
|
}, "导出")
|
|
3869
4219
|
], 512), [
|
|
3870
|
-
[
|
|
4220
|
+
[re, t.value]
|
|
3871
4221
|
])
|
|
3872
4222
|
], 32),
|
|
3873
4223
|
g("div", {
|
|
3874
4224
|
class: "dropdown-wrapper",
|
|
3875
|
-
onMouseenter:
|
|
3876
|
-
onMouseleave:
|
|
4225
|
+
onMouseenter: x[11] || (x[11] = (P) => o.value = !0),
|
|
4226
|
+
onMouseleave: x[12] || (x[12] = (P) => o.value = !1)
|
|
3877
4227
|
}, [
|
|
3878
|
-
|
|
3879
|
-
|
|
4228
|
+
x[23] || (x[23] = g("button", { class: "menu-btn" }, "添加", -1)),
|
|
4229
|
+
O(g("div", Ho, [
|
|
3880
4230
|
g("div", {
|
|
3881
4231
|
class: "menu-item",
|
|
3882
|
-
onClick:
|
|
4232
|
+
onClick: p
|
|
3883
4233
|
}, "组"),
|
|
3884
4234
|
g("div", {
|
|
3885
4235
|
class: "menu-item dropdown-wrapper sub-trigger",
|
|
3886
|
-
onMouseenter:
|
|
3887
|
-
onMouseleave:
|
|
4236
|
+
onMouseenter: x[6] || (x[6] = (P) => l.value = !0),
|
|
4237
|
+
onMouseleave: x[7] || (x[7] = (P) => l.value = !1)
|
|
3888
4238
|
}, [
|
|
3889
|
-
|
|
3890
|
-
|
|
4239
|
+
x[21] || (x[21] = g("span", null, "网格", -1)),
|
|
4240
|
+
O(g("div", Fo, [
|
|
3891
4241
|
g("div", {
|
|
3892
4242
|
class: "menu-item",
|
|
3893
|
-
onClick:
|
|
4243
|
+
onClick: x[4] || (x[4] = (P) => u("addModel", "box"))
|
|
3894
4244
|
}, " 正方体 "),
|
|
3895
4245
|
g("div", {
|
|
3896
4246
|
class: "menu-item",
|
|
3897
|
-
onClick:
|
|
4247
|
+
onClick: x[5] || (x[5] = (P) => u("addModel", "sphere"))
|
|
3898
4248
|
}, " 球体 "),
|
|
3899
4249
|
g("div", {
|
|
3900
4250
|
class: "menu-item",
|
|
3901
|
-
onClick:
|
|
4251
|
+
onClick: d
|
|
3902
4252
|
}, "导入")
|
|
3903
4253
|
], 512), [
|
|
3904
|
-
[
|
|
4254
|
+
[re, l.value]
|
|
3905
4255
|
])
|
|
3906
4256
|
], 32),
|
|
3907
4257
|
g("div", {
|
|
3908
|
-
class: "menu-item",
|
|
3909
|
-
|
|
3910
|
-
|
|
4258
|
+
class: "menu-item dropdown-wrapper sub-trigger",
|
|
4259
|
+
onMouseenter: x[9] || (x[9] = (P) => c.value = !0),
|
|
4260
|
+
onMouseleave: x[10] || (x[10] = (P) => c.value = !1)
|
|
4261
|
+
}, [
|
|
4262
|
+
x[22] || (x[22] = g("span", null, "光源", -1)),
|
|
4263
|
+
O(g("div", Uo, [
|
|
4264
|
+
g("div", {
|
|
4265
|
+
class: "menu-item",
|
|
4266
|
+
onClick: x[8] || (x[8] = (P) => u("addModel", "directionalLight"))
|
|
4267
|
+
}, " 平行光 ")
|
|
4268
|
+
], 512), [
|
|
4269
|
+
[re, c.value]
|
|
4270
|
+
])
|
|
4271
|
+
], 32),
|
|
3911
4272
|
g("div", {
|
|
3912
4273
|
class: "menu-item",
|
|
3913
|
-
onClick:
|
|
4274
|
+
onClick: M
|
|
3914
4275
|
}, "摄像机")
|
|
3915
4276
|
], 512), [
|
|
3916
|
-
[
|
|
4277
|
+
[re, o.value]
|
|
3917
4278
|
])
|
|
3918
4279
|
], 32),
|
|
3919
4280
|
g("div", {
|
|
3920
4281
|
class: "dropdown-wrapper",
|
|
3921
|
-
onMouseenter:
|
|
3922
|
-
onMouseleave:
|
|
4282
|
+
onMouseenter: x[13] || (x[13] = (P) => s.value = !0),
|
|
4283
|
+
onMouseleave: x[14] || (x[14] = (P) => s.value = !1)
|
|
3923
4284
|
}, [
|
|
3924
|
-
|
|
3925
|
-
|
|
4285
|
+
x[24] || (x[24] = g("button", { class: "menu-btn" }, "编辑", -1)),
|
|
4286
|
+
O(g("div", zo, [
|
|
3926
4287
|
g("div", {
|
|
3927
4288
|
class: "menu-item",
|
|
3928
|
-
onClick:
|
|
4289
|
+
onClick: p
|
|
3929
4290
|
}, "撤销"),
|
|
3930
4291
|
g("div", {
|
|
3931
4292
|
class: "menu-item",
|
|
3932
|
-
onClick:
|
|
4293
|
+
onClick: b
|
|
3933
4294
|
}, "重做"),
|
|
3934
4295
|
g("div", {
|
|
3935
4296
|
class: "menu-item",
|
|
3936
|
-
onClick:
|
|
4297
|
+
onClick: T
|
|
3937
4298
|
}, "复制"),
|
|
3938
4299
|
g("div", {
|
|
3939
4300
|
class: "menu-item",
|
|
3940
|
-
onClick:
|
|
4301
|
+
onClick: M
|
|
3941
4302
|
}, "删除")
|
|
3942
4303
|
], 512), [
|
|
3943
|
-
[
|
|
4304
|
+
[re, s.value]
|
|
3944
4305
|
])
|
|
3945
4306
|
], 32),
|
|
3946
4307
|
g("div", {
|
|
3947
4308
|
class: "dropdown-wrapper",
|
|
3948
|
-
onMouseenter:
|
|
3949
|
-
onMouseleave:
|
|
4309
|
+
onMouseenter: x[15] || (x[15] = (P) => n.value = !0),
|
|
4310
|
+
onMouseleave: x[16] || (x[16] = (P) => n.value = !1)
|
|
3950
4311
|
}, [
|
|
3951
|
-
|
|
3952
|
-
|
|
4312
|
+
x[25] || (x[25] = g("button", { class: "menu-btn" }, "视图", -1)),
|
|
4313
|
+
O(g("div", Go, [
|
|
3953
4314
|
g("div", {
|
|
3954
4315
|
class: "menu-item",
|
|
3955
|
-
onClick:
|
|
4316
|
+
onClick: R
|
|
3956
4317
|
}, "重置相机"),
|
|
3957
4318
|
g("div", {
|
|
3958
4319
|
class: "menu-item",
|
|
3959
|
-
onClick:
|
|
4320
|
+
onClick: v
|
|
3960
4321
|
}, "显示网格")
|
|
3961
4322
|
], 512), [
|
|
3962
|
-
[
|
|
4323
|
+
[re, n.value]
|
|
3963
4324
|
])
|
|
3964
4325
|
], 32),
|
|
3965
4326
|
g("div", {
|
|
3966
4327
|
class: "dropdown-wrapper",
|
|
3967
|
-
onMouseenter:
|
|
3968
|
-
onMouseleave:
|
|
4328
|
+
onMouseenter: x[17] || (x[17] = (P) => i.value = !0),
|
|
4329
|
+
onMouseleave: x[18] || (x[18] = (P) => i.value = !1)
|
|
3969
4330
|
}, [
|
|
3970
|
-
|
|
3971
|
-
|
|
4331
|
+
x[26] || (x[26] = g("button", { class: "menu-btn" }, "帮助", -1)),
|
|
4332
|
+
O(g("div", Xo, [
|
|
3972
4333
|
g("div", {
|
|
3973
4334
|
class: "menu-item",
|
|
3974
|
-
onClick:
|
|
4335
|
+
onClick: I
|
|
3975
4336
|
}, "使用帮助"),
|
|
3976
4337
|
g("div", {
|
|
3977
4338
|
class: "menu-item",
|
|
3978
|
-
onClick:
|
|
4339
|
+
onClick: V
|
|
3979
4340
|
}, "关于")
|
|
3980
4341
|
], 512), [
|
|
3981
|
-
[
|
|
4342
|
+
[re, i.value]
|
|
3982
4343
|
])
|
|
3983
4344
|
], 32)
|
|
3984
4345
|
]),
|
|
3985
|
-
|
|
4346
|
+
x[27] || (x[27] = g("div", { class: "right-section" }, [
|
|
3986
4347
|
g("span", { class: "app-title" }, "3D 模型编辑器")
|
|
3987
4348
|
], -1)),
|
|
3988
4349
|
g("input", {
|
|
3989
4350
|
type: "file",
|
|
3990
4351
|
ref_key: "fileInput",
|
|
3991
|
-
ref:
|
|
4352
|
+
ref: h,
|
|
3992
4353
|
accept: ".obj,.gltf,.glb",
|
|
3993
4354
|
style: { display: "none" },
|
|
3994
|
-
onChange:
|
|
4355
|
+
onChange: m
|
|
3995
4356
|
}, null, 544)
|
|
3996
4357
|
]));
|
|
3997
4358
|
}
|
|
3998
|
-
}),
|
|
4359
|
+
}), Yo = /* @__PURE__ */ We(Bo, [["__scopeId", "data-v-5b71862f"]]), Ko = { class: "bottom-bar" }, Vo = /* @__PURE__ */ Ze({
|
|
3999
4360
|
__name: "BottomBar",
|
|
4000
4361
|
setup(r) {
|
|
4001
|
-
return (e, t) => (
|
|
4362
|
+
return (e, t) => (k(), z("div", Ko, [...t[0] || (t[0] = [
|
|
4002
4363
|
g("div", { class: "status-left" }, [
|
|
4003
4364
|
g("span", null, "就绪")
|
|
4004
4365
|
], -1),
|
|
@@ -4007,14 +4368,14 @@ const oo = {
|
|
|
4007
4368
|
], -1)
|
|
4008
4369
|
])]));
|
|
4009
4370
|
}
|
|
4010
|
-
}),
|
|
4371
|
+
}), Zo = /* @__PURE__ */ We(Vo, [["__scopeId", "data-v-3427bb27"]]), Wo = { class: "app-layout" }, Qo = /* @__PURE__ */ Ze({
|
|
4011
4372
|
__name: "DrawingBoard",
|
|
4012
4373
|
props: {
|
|
4013
4374
|
mode: { default: "edit" },
|
|
4014
4375
|
sceneData: { default: null }
|
|
4015
4376
|
},
|
|
4016
4377
|
setup(r) {
|
|
4017
|
-
const e = r, t =
|
|
4378
|
+
const e = r, t = U(null), s = un({
|
|
4018
4379
|
position: { x: 0, y: 0, z: 0 },
|
|
4019
4380
|
rotation: { x: 0, y: 0, z: 0 },
|
|
4020
4381
|
scale: { x: 1, y: 1, z: 1 }
|
|
@@ -4031,84 +4392,88 @@ const oo = {
|
|
|
4031
4392
|
s.rotation.z
|
|
4032
4393
|
), f.scale.set(s.scale.x, s.scale.y, s.scale.z);
|
|
4033
4394
|
};
|
|
4034
|
-
|
|
4395
|
+
si((f) => {
|
|
4035
4396
|
t.value = f, f && n(f);
|
|
4036
|
-
}),
|
|
4397
|
+
}), ii((f) => {
|
|
4037
4398
|
n(f);
|
|
4038
4399
|
});
|
|
4039
4400
|
const o = () => {
|
|
4040
|
-
t.value && i(t.value)
|
|
4041
|
-
|
|
4401
|
+
if (t.value && (i(t.value), t.value.type === "DirectionalLight")) {
|
|
4402
|
+
const f = t.value.userData.helper;
|
|
4403
|
+
f && f.update && f.update();
|
|
4404
|
+
}
|
|
4405
|
+
}, a = (f) => no(f), l = async (f) => {
|
|
4042
4406
|
try {
|
|
4043
|
-
await
|
|
4407
|
+
await to(f);
|
|
4044
4408
|
} catch (y) {
|
|
4045
4409
|
console.error("导入失败:", y), alert("导入失败:" + y.message);
|
|
4046
4410
|
}
|
|
4047
|
-
},
|
|
4048
|
-
|
|
4049
|
-
|
|
4411
|
+
}, c = kn([]);
|
|
4412
|
+
oi((f) => {
|
|
4413
|
+
c.value = f;
|
|
4050
4414
|
});
|
|
4051
4415
|
const u = () => {
|
|
4052
|
-
const f =
|
|
4053
|
-
f && (
|
|
4054
|
-
},
|
|
4055
|
-
return
|
|
4056
|
-
m.value &&
|
|
4057
|
-
}),
|
|
4058
|
-
console.log("endset_three_editor destroy"),
|
|
4059
|
-
}), (f, y) => (
|
|
4060
|
-
r.mode === "edit" ? (
|
|
4416
|
+
const f = ri();
|
|
4417
|
+
f && (c.value = f);
|
|
4418
|
+
}, h = (f) => Dt(f), d = (f) => Js(f.uuid), m = U(null);
|
|
4419
|
+
return Nn(() => {
|
|
4420
|
+
m.value && zs(m.value, e.mode, e.sceneData), u();
|
|
4421
|
+
}), jn(() => {
|
|
4422
|
+
console.log("endset_three_editor destroy"), li();
|
|
4423
|
+
}), (f, y) => (k(), z("div", Wo, [
|
|
4424
|
+
r.mode === "edit" ? (k(), je(Yo, {
|
|
4061
4425
|
key: 0,
|
|
4062
4426
|
onAddModel: a,
|
|
4063
4427
|
onImportModel: l
|
|
4064
|
-
})) :
|
|
4428
|
+
})) : le("", !0),
|
|
4065
4429
|
g("div", {
|
|
4066
|
-
class:
|
|
4430
|
+
class: Be(`editor-container editor-container-mode-${r.mode}`)
|
|
4067
4431
|
}, [
|
|
4068
4432
|
g("div", {
|
|
4069
|
-
class:
|
|
4433
|
+
class: Be(`canvas canvas-mode-${r.mode}`),
|
|
4070
4434
|
ref_key: "containerRef",
|
|
4071
4435
|
ref: m
|
|
4072
4436
|
}, null, 2),
|
|
4073
|
-
r.mode === "edit" ? (
|
|
4437
|
+
r.mode === "edit" ? (k(), je(Do, {
|
|
4074
4438
|
key: 0,
|
|
4075
4439
|
transform: s,
|
|
4076
|
-
"tree-data":
|
|
4440
|
+
"tree-data": c.value,
|
|
4077
4441
|
"selected-object": t.value,
|
|
4078
4442
|
onPropertyChange: o,
|
|
4079
|
-
onTreeSelect:
|
|
4080
|
-
onTreeDelete:
|
|
4081
|
-
}, null, 8, ["transform", "tree-data", "selected-object"])) :
|
|
4443
|
+
onTreeSelect: h,
|
|
4444
|
+
onTreeDelete: d
|
|
4445
|
+
}, null, 8, ["transform", "tree-data", "selected-object"])) : le("", !0)
|
|
4082
4446
|
], 2),
|
|
4083
|
-
r.mode === "edit" ? (
|
|
4447
|
+
r.mode === "edit" ? (k(), je(Zo, { key: 1 })) : le("", !0)
|
|
4084
4448
|
]));
|
|
4085
4449
|
}
|
|
4086
|
-
}),
|
|
4450
|
+
}), ir = /* @__PURE__ */ We(Qo, [["__scopeId", "data-v-9bbe42aa"]]);
|
|
4087
4451
|
export {
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4452
|
+
Zo as BottomBar,
|
|
4453
|
+
ir as DrawingBoard,
|
|
4454
|
+
Do as PropertyPanel,
|
|
4455
|
+
Yo as TopBar,
|
|
4456
|
+
lo as TreeItem,
|
|
4457
|
+
$i as addBox,
|
|
4458
|
+
eo as addDirectionalLight,
|
|
4459
|
+
Ve as addModel,
|
|
4460
|
+
no as addModelByType,
|
|
4461
|
+
Ji as addSphere,
|
|
4462
|
+
li as destroyEditor,
|
|
4463
|
+
sr as exportSceneToJSON,
|
|
4464
|
+
tr as getCamera,
|
|
4465
|
+
nr as getRenderer,
|
|
4466
|
+
er as getScene,
|
|
4467
|
+
ri as getSceneObjects,
|
|
4468
|
+
to as importModelFromFile,
|
|
4469
|
+
zs as initEditor,
|
|
4470
|
+
ai as loadSceneFromJSON,
|
|
4471
|
+
oi as onSceneObjectsChangeCallback,
|
|
4472
|
+
$s as removeModel,
|
|
4473
|
+
Js as removeModelById,
|
|
4474
|
+
Dt as selectObject,
|
|
4475
|
+
si as setSelectedObjectCallback,
|
|
4476
|
+
ii as setTransformChangeCallback,
|
|
4477
|
+
co as useTreeExpand
|
|
4113
4478
|
};
|
|
4114
4479
|
//# sourceMappingURL=three-editor.es.js.map
|