endset_three_editor 0.2.6 → 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/endset_three_editor.css +1 -1
- package/dist/three/addHandle.d.ts +10 -2
- package/dist/three/index.d.ts +5 -0
- package/dist/three-editor.cjs.js +3 -2
- package/dist/three-editor.cjs.js.map +1 -1
- package/dist/three-editor.es.js +1544 -1161
- package/dist/three-editor.es.js.map +1 -1
- package/package.json +1 -1
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 jt = { type: "change" }, Mt = { type: "start" }, gn = { type: "end" }, We
|
|
|
11
11
|
TOUCH_PAN: 4,
|
|
12
12
|
TOUCH_DOLLY_PAN: 5,
|
|
13
13
|
TOUCH_DOLLY_ROTATE: 6
|
|
14
|
-
},
|
|
15
|
-
class
|
|
14
|
+
}, ft = 1e-6;
|
|
15
|
+
class bs extends dn {
|
|
16
16
|
/**
|
|
17
17
|
* Constructs a new controls instance.
|
|
18
18
|
*
|
|
@@ -20,7 +20,7 @@ class ps extends an {
|
|
|
20
20
|
* @param {?HTMLElement} domElement - The HTML element used for event listeners.
|
|
21
21
|
*/
|
|
22
22
|
constructor(e, t = null) {
|
|
23
|
-
super(e, t), this.state =
|
|
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 ps extends an {
|
|
|
93
93
|
* was called, or the initial state.
|
|
94
94
|
*/
|
|
95
95
|
reset() {
|
|
96
|
-
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(
|
|
96
|
+
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(Gt), this.update(), this.state = L.NONE;
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
99
99
|
* Programmatically pan the camera.
|
|
@@ -138,9 +138,9 @@ class ps extends an {
|
|
|
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 ps extends an {
|
|
|
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 ps extends an {
|
|
|
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 ps extends an {
|
|
|
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 ps extends an {
|
|
|
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 ps extends an {
|
|
|
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 ps extends an {
|
|
|
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 ps extends an {
|
|
|
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 gs(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 ys(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
|
-
function
|
|
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
|
|
441
|
-
this.enabled === !1 || this.enableZoom === !1 || this.state !==
|
|
440
|
+
function vs(r) {
|
|
441
|
+
this.enabled === !1 || this.enableZoom === !1 || this.state !== L.NONE || (r.preventDefault(), this.dispatchEvent(Ct), this._handleMouseWheel(this._customWheelEvent(r)), this.dispatchEvent(xn));
|
|
442
442
|
}
|
|
443
|
-
function
|
|
443
|
+
function Ss(r) {
|
|
444
444
|
this.enabled !== !1 && this._handleKeyDown(r);
|
|
445
445
|
}
|
|
446
|
-
function
|
|
446
|
+
function As(r) {
|
|
447
447
|
switch (this._trackPointer(r), this._pointers.length) {
|
|
448
448
|
case 1:
|
|
449
449
|
switch (this.touches.ONE) {
|
|
450
|
-
case
|
|
450
|
+
case Me.ROTATE:
|
|
451
451
|
if (this.enableRotate === !1) return;
|
|
452
|
-
this._handleTouchStartRotate(r), this.state =
|
|
452
|
+
this._handleTouchStartRotate(r), this.state = L.TOUCH_ROTATE;
|
|
453
453
|
break;
|
|
454
|
-
case
|
|
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
|
-
case
|
|
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
|
-
case
|
|
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 Ss extends an {
|
|
|
523
523
|
*/
|
|
524
524
|
constructor(e, t = null) {
|
|
525
525
|
super(void 0, t);
|
|
526
|
-
const s = new
|
|
526
|
+
const s = new Hs(this);
|
|
527
527
|
this._root = s;
|
|
528
|
-
const n = new
|
|
528
|
+
const n = new Fs();
|
|
529
529
|
this._gizmo = n, s.add(n);
|
|
530
|
-
const i = new
|
|
530
|
+
const i = new 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 Ss extends an {
|
|
|
562
562
|
}
|
|
563
563
|
pointerHover(e) {
|
|
564
564
|
if (this.object === void 0 || this.dragging === !0) return;
|
|
565
|
-
e !== null &&
|
|
566
|
-
const t =
|
|
565
|
+
e !== null && 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 Ss extends an {
|
|
|
625
625
|
* Resets the object's position, rotation and scale to when the current transform began.
|
|
626
626
|
*/
|
|
627
627
|
reset() {
|
|
628
|
-
this.enabled && this.dragging && (this.object.position.copy(this._positionStart), this.object.quaternion.copy(this._quaternionStart), this.object.scale.copy(this._scaleStart), this.dispatchEvent(
|
|
628
|
+
this.enabled && this.dragging && (this.object.position.copy(this._positionStart), this.object.quaternion.copy(this._quaternionStart), this.object.scale.copy(this._scaleStart), this.dispatchEvent(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 Ss extends an {
|
|
|
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 Ss extends an {
|
|
|
705
705
|
i.xAxis.color.set(e), i.yAxis.color.set(t), i.zAxis.color.set(s), i.active.color.set(n), i.xAxisTransparent.color.set(e), i.yAxisTransparent.color.set(t), i.zAxisTransparent.color.set(s), i.activeTransparent.color.set(n), i.xAxis._color && i.xAxis._color.set(e), i.yAxis._color && i.yAxis._color.set(t), i.zAxis._color && i.zAxis._color.set(s), i.active._color && i.active._color.set(n), i.xAxisTransparent._color && i.xAxisTransparent._color.set(e), i.yAxisTransparent._color && i.yAxisTransparent._color.set(t), i.zAxisTransparent._color && i.zAxisTransparent._color.set(s), i.activeTransparent._color && i.activeTransparent._color.set(n);
|
|
706
706
|
}
|
|
707
707
|
}
|
|
708
|
-
function
|
|
708
|
+
function Ds(r) {
|
|
709
709
|
if (this.domElement.ownerDocument.pointerLockElement)
|
|
710
710
|
return {
|
|
711
711
|
x: 0,
|
|
@@ -721,7 +721,7 @@ function As(r) {
|
|
|
721
721
|
};
|
|
722
722
|
}
|
|
723
723
|
}
|
|
724
|
-
function
|
|
724
|
+
function Os(r) {
|
|
725
725
|
if (this.enabled)
|
|
726
726
|
switch (r.pointerType) {
|
|
727
727
|
case "mouse":
|
|
@@ -730,24 +730,24 @@ function Rs(r) {
|
|
|
730
730
|
break;
|
|
731
731
|
}
|
|
732
732
|
}
|
|
733
|
-
function
|
|
733
|
+
function 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
|
-
function
|
|
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 Os extends ze {
|
|
|
762
762
|
});
|
|
763
763
|
}
|
|
764
764
|
}
|
|
765
|
-
class
|
|
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,231 +789,231 @@ class Cs extends ze {
|
|
|
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
|
-
const
|
|
803
|
-
|
|
802
|
+
const w = e.clone();
|
|
803
|
+
w.color.setHex(7895160), this.materialLib = {
|
|
804
804
|
xAxis: i,
|
|
805
805
|
yAxis: o,
|
|
806
806
|
zAxis: a,
|
|
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
|
|
820
|
-
|
|
821
|
-
function
|
|
822
|
-
const
|
|
823
|
-
return
|
|
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
|
+
b.translate(0, 0.25, 0);
|
|
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,61 +1022,61 @@ class Cs extends ze {
|
|
|
1022
1022
|
o.visible = !0, o.rotation.set(0, 0, 0), o.position.copy(this.worldPosition);
|
|
1023
1023
|
let a;
|
|
1024
1024
|
if (this.camera.isOrthographicCamera ? a = (this.camera.top - this.camera.bottom) / this.camera.zoom : a = this.worldPosition.distanceTo(this.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * this.camera.fov / 360) / this.camera.zoom, 7), o.scale.set(1, 1, 1).multiplyScalar(a * this.size / 4), o.tag === "helper") {
|
|
1025
|
-
o.visible = !1, o.name === "AXIS" ? (o.visible = !!this.axis, this.axis === "X" && (
|
|
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
|
-
const
|
|
1079
|
+
const _ = {
|
|
1080
1080
|
mode: "",
|
|
1081
1081
|
/** Three.js 场景 */
|
|
1082
1082
|
scene: null,
|
|
@@ -1095,170 +1095,223 @@ const w = {
|
|
|
1095
1095
|
/** 当前选中的物体 */
|
|
1096
1096
|
selectedObject: null
|
|
1097
1097
|
};
|
|
1098
|
-
let ht = !1,
|
|
1099
|
-
function
|
|
1100
|
-
if (
|
|
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],
|
|
1104
1104
|
s.position[1],
|
|
1105
1105
|
s.position[2]
|
|
1106
|
-
),
|
|
1106
|
+
), _.camera.rotation.set(
|
|
1107
1107
|
s.rotation[0],
|
|
1108
1108
|
s.rotation[1],
|
|
1109
1109
|
s.rotation[2]
|
|
1110
|
-
),
|
|
1110
|
+
), _.camera.updateProjectionMatrix(), yt = s.target;
|
|
1111
1111
|
}
|
|
1112
|
-
|
|
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();
|
|
1113
1113
|
}
|
|
1114
|
-
function
|
|
1115
|
-
const r = new
|
|
1116
|
-
r.setSize(
|
|
1114
|
+
function Gs() {
|
|
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;
|
|
1117
1117
|
}
|
|
1118
|
-
function
|
|
1119
|
-
|
|
1118
|
+
function Xs() {
|
|
1119
|
+
_.scene = new H.Scene(), _.scene.name = "sl_scene";
|
|
1120
1120
|
}
|
|
1121
|
-
function
|
|
1122
|
-
const r = new
|
|
1123
|
-
r.name = "地板", r.userData.type = "initFloor",
|
|
1121
|
+
function Bs() {
|
|
1122
|
+
const r = new H.GridHelper(30, 30, 8956671, 3364232);
|
|
1123
|
+
r.name = "地板", r.userData.type = "initFloor", _.scene.add(r), _.gridHelper = r;
|
|
1124
1124
|
}
|
|
1125
|
-
function
|
|
1126
|
-
const r =
|
|
1127
|
-
t.position.set(0, 6, 15), t.lookAt(0, 0, 0),
|
|
1125
|
+
function Ys() {
|
|
1126
|
+
const r = _.container, e = r.clientWidth / r.clientHeight, t = new H.PerspectiveCamera(45, e, 0.1, 1e3);
|
|
1127
|
+
t.position.set(0, 6, 15), t.lookAt(0, 0, 0), _.camera = t;
|
|
1128
1128
|
}
|
|
1129
|
-
function
|
|
1130
|
-
const r = new
|
|
1129
|
+
function 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
|
-
ht && (
|
|
1137
|
-
|
|
1136
|
+
ht && (xe = !0, setTimeout(() => {
|
|
1137
|
+
xe = !1;
|
|
1138
1138
|
}, 200));
|
|
1139
|
-
}),
|
|
1139
|
+
}), _.orbitControls = r;
|
|
1140
1140
|
}
|
|
1141
|
-
function
|
|
1142
|
-
const r = new
|
|
1143
|
-
|
|
1144
|
-
|
|
1141
|
+
function Vs() {
|
|
1142
|
+
const r = new Cs(
|
|
1143
|
+
_.camera,
|
|
1144
|
+
_.renderer.domElement
|
|
1145
1145
|
);
|
|
1146
1146
|
r.addEventListener("dragging-changed", (e) => {
|
|
1147
|
-
|
|
1148
|
-
|
|
1147
|
+
_.orbitControls.enabled = !e.value, e.value || (xe = !0, setTimeout(() => {
|
|
1148
|
+
xe = !1;
|
|
1149
1149
|
}, 200));
|
|
1150
1150
|
}), r.addEventListener("objectChange", () => {
|
|
1151
|
-
|
|
1152
|
-
|
|
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
|
+
}
|
|
1156
|
+
}), _.scene.add(r.getHelper()), _.transformControls = r;
|
|
1153
1157
|
}
|
|
1154
|
-
function
|
|
1155
|
-
const r = new
|
|
1156
|
-
|
|
1157
|
-
const e = new F.DirectionalLight(16777215, 3);
|
|
1158
|
-
e.position.set(48, 104, 138), w.scene.add(e);
|
|
1158
|
+
function Zs() {
|
|
1159
|
+
const r = new H.AmbientLight(16777215, 1);
|
|
1160
|
+
_.scene.add(r);
|
|
1159
1161
|
}
|
|
1160
|
-
function
|
|
1162
|
+
function En() {
|
|
1161
1163
|
var r, e;
|
|
1162
|
-
requestAnimationFrame(
|
|
1164
|
+
dt = requestAnimationFrame(En), ys.update(), (r = _.orbitControls) == null || r.update(), (e = _.renderer) == null || e.render(_.scene, _.camera);
|
|
1163
1165
|
}
|
|
1164
|
-
function
|
|
1165
|
-
if (!
|
|
1166
|
-
const r =
|
|
1167
|
-
r === 0 || e === 0 || (
|
|
1166
|
+
function Ws() {
|
|
1167
|
+
if (!_.container || !_.camera || !_.renderer) return;
|
|
1168
|
+
const r = _.container.clientWidth, e = _.container.clientHeight;
|
|
1169
|
+
r === 0 || e === 0 || (_.camera.aspect = r / e, _.camera.updateProjectionMatrix(), _.renderer.setSize(r, e));
|
|
1168
1170
|
}
|
|
1169
|
-
function
|
|
1170
|
-
|
|
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
|
-
|
|
1174
|
+
function Ot() {
|
|
1175
|
+
_.selectedObject && (_.transformControls.detach(), _.selectedObject = null, Te == null || Te(null));
|
|
1174
1176
|
}
|
|
1175
|
-
function
|
|
1176
|
-
if (
|
|
1177
|
-
|
|
1177
|
+
function Qs(r) {
|
|
1178
|
+
if (xe) {
|
|
1179
|
+
xe = !1;
|
|
1178
1180
|
return;
|
|
1179
1181
|
}
|
|
1180
|
-
const e =
|
|
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
|
|
1184
|
-
s.setFromCamera(t,
|
|
1185
|
+
), s = new H.Raycaster();
|
|
1186
|
+
s.setFromCamera(t, _.camera);
|
|
1185
1187
|
const n = [];
|
|
1186
|
-
|
|
1187
|
-
o.type === "
|
|
1188
|
+
_.scene.traverse((o) => {
|
|
1189
|
+
(o.userData.isMovable || o.userData.type === "lightHelper") && n.push(o);
|
|
1188
1190
|
});
|
|
1189
1191
|
const i = s.intersectObjects(n);
|
|
1190
|
-
i.length > 0
|
|
1192
|
+
if (i.length > 0) {
|
|
1193
|
+
let o = qs(i[0].object);
|
|
1194
|
+
Dt(o);
|
|
1195
|
+
} else
|
|
1196
|
+
Ot();
|
|
1191
1197
|
}
|
|
1192
|
-
function
|
|
1193
|
-
|
|
1198
|
+
function qs(r) {
|
|
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;
|
|
1208
|
+
}
|
|
1209
|
+
function Ve(r, e = !1) {
|
|
1210
|
+
_.scene.add(r), r.userData.isMovable && (ei(r), pt()), e && _.mode === "edit" && Dt(r);
|
|
1194
1211
|
}
|
|
1195
|
-
function
|
|
1196
|
-
|
|
1212
|
+
function $s(r) {
|
|
1213
|
+
_.selectedObject === r && Ot(), r.parent ? r.parent.remove(r) : _.scene.remove(r), ti(r), pt();
|
|
1197
1214
|
}
|
|
1198
|
-
function
|
|
1199
|
-
const e =
|
|
1200
|
-
e &&
|
|
1215
|
+
function Js(r) {
|
|
1216
|
+
const e = _.scene.getObjectByProperty("uuid", r);
|
|
1217
|
+
e && $s(e);
|
|
1201
1218
|
}
|
|
1202
|
-
function
|
|
1203
|
-
r.userData.isMovable && r.parent ===
|
|
1219
|
+
function ei(r) {
|
|
1220
|
+
r.userData.isMovable && r.parent === _.scene && (fe.includes(r) || fe.push(r));
|
|
1204
1221
|
}
|
|
1205
|
-
function
|
|
1206
|
-
const e =
|
|
1207
|
-
e !== -1 &&
|
|
1222
|
+
function ti(r) {
|
|
1223
|
+
const e = fe.indexOf(r);
|
|
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
|
-
}),
|
|
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
|
|
1228
|
-
return
|
|
1244
|
+
function ri() {
|
|
1245
|
+
return fe;
|
|
1229
1246
|
}
|
|
1230
|
-
function
|
|
1231
|
-
return
|
|
1247
|
+
function er() {
|
|
1248
|
+
return _.scene;
|
|
1232
1249
|
}
|
|
1233
|
-
function
|
|
1234
|
-
return
|
|
1250
|
+
function tr() {
|
|
1251
|
+
return _.camera;
|
|
1235
1252
|
}
|
|
1236
|
-
function
|
|
1237
|
-
return
|
|
1253
|
+
function nr() {
|
|
1254
|
+
return _.renderer;
|
|
1238
1255
|
}
|
|
1239
|
-
function
|
|
1240
|
-
var
|
|
1241
|
-
|
|
1242
|
-
const r =
|
|
1256
|
+
function sr() {
|
|
1257
|
+
var o, a, l;
|
|
1258
|
+
Ot();
|
|
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" ?
|
|
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
|
+
}));
|
|
1297
|
+
}
|
|
1298
|
+
function Mn(r) {
|
|
1299
|
+
if (!r) return;
|
|
1300
|
+
if (r.type === "Mesh") {
|
|
1301
|
+
const t = r;
|
|
1302
|
+
t.geometry && t.geometry.dispose(), t.material && (Array.isArray(t.material) ? t.material : [t.material]).forEach((n) => {
|
|
1303
|
+
n.map && (n.map = null), n.lightMap && (n.lightMap = null), n.aoMap && (n.aoMap = null), n.emissiveMap && (n.emissiveMap = null), n.bumpMap && (n.bumpMap = null), n.normalMap && (n.normalMap = null), n.displacementMap && (n.displacementMap = null), n.roughnessMap && (n.roughnessMap = null), n.metalnessMap && (n.metalnessMap = null), n.alphaMap && (n.alphaMap = null), n.envMap && (n.envMap = null), n.dispose();
|
|
1304
|
+
});
|
|
1305
|
+
}
|
|
1306
|
+
const e = r.children.slice();
|
|
1307
|
+
for (const t of e)
|
|
1308
|
+
Mn(t);
|
|
1259
1309
|
}
|
|
1260
|
-
|
|
1261
|
-
|
|
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;
|
|
1312
|
+
}
|
|
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() {
|
|
1262
1315
|
const r = {
|
|
1263
1316
|
objects: [],
|
|
1264
1317
|
object: {},
|
|
@@ -1299,7 +1352,7 @@ function oi() {
|
|
|
1299
1352
|
groupCount: -1,
|
|
1300
1353
|
inherited: !1,
|
|
1301
1354
|
clone: function(l) {
|
|
1302
|
-
const
|
|
1355
|
+
const c = {
|
|
1303
1356
|
index: typeof l == "number" ? l : this.index,
|
|
1304
1357
|
name: this.name,
|
|
1305
1358
|
mtllib: this.mtllib,
|
|
@@ -1309,7 +1362,7 @@ function oi() {
|
|
|
1309
1362
|
groupCount: -1,
|
|
1310
1363
|
inherited: !1
|
|
1311
1364
|
};
|
|
1312
|
-
return
|
|
1365
|
+
return c.clone = this.clone.bind(c), c;
|
|
1313
1366
|
}
|
|
1314
1367
|
};
|
|
1315
1368
|
return this.materials.push(a), a;
|
|
@@ -1367,7 +1420,7 @@ function oi() {
|
|
|
1367
1420
|
},
|
|
1368
1421
|
addFaceNormal: function(e, t, s) {
|
|
1369
1422
|
const n = this.vertices, i = this.object.geometry.normals;
|
|
1370
|
-
|
|
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);
|
|
1371
1424
|
},
|
|
1372
1425
|
addColor: function(e, t, s) {
|
|
1373
1426
|
const n = this.colors, i = this.object.geometry.colors;
|
|
@@ -1385,17 +1438,17 @@ function oi() {
|
|
|
1385
1438
|
const t = this.uvs;
|
|
1386
1439
|
this.object.geometry.uvs.push(t[e + 0], t[e + 1]);
|
|
1387
1440
|
},
|
|
1388
|
-
addFace: function(e, t, s, n, i, o, a, l,
|
|
1441
|
+
addFace: function(e, t, s, n, i, o, a, l, c) {
|
|
1389
1442
|
const u = this.vertices.length;
|
|
1390
|
-
let
|
|
1391
|
-
if (this.addVertex(
|
|
1392
|
-
const
|
|
1393
|
-
|
|
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 !== "") {
|
|
1445
|
+
const w = this.normals.length;
|
|
1446
|
+
h = this.parseNormalIndex(a, w), d = this.parseNormalIndex(l, w), m = this.parseNormalIndex(c, w), this.addNormal(h, d, m);
|
|
1394
1447
|
} else
|
|
1395
|
-
this.addFaceNormal(
|
|
1448
|
+
this.addFaceNormal(h, d, m);
|
|
1396
1449
|
if (n !== void 0 && n !== "") {
|
|
1397
|
-
const
|
|
1398
|
-
|
|
1450
|
+
const w = this.uvs.length;
|
|
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;
|
|
1399
1452
|
} else
|
|
1400
1453
|
this.addDefaultUV();
|
|
1401
1454
|
},
|
|
@@ -1418,7 +1471,7 @@ function oi() {
|
|
|
1418
1471
|
};
|
|
1419
1472
|
return r.startObject("", !1), r;
|
|
1420
1473
|
}
|
|
1421
|
-
class
|
|
1474
|
+
class fi extends It {
|
|
1422
1475
|
/**
|
|
1423
1476
|
* Constructs a new OBJ loader.
|
|
1424
1477
|
*
|
|
@@ -1437,7 +1490,7 @@ class ri extends hn {
|
|
|
1437
1490
|
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
1438
1491
|
*/
|
|
1439
1492
|
load(e, t, s, n) {
|
|
1440
|
-
const i = this, o = new
|
|
1493
|
+
const i = this, o = new Ke(this.manager);
|
|
1441
1494
|
o.setPath(this.path), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(e, function(a) {
|
|
1442
1495
|
try {
|
|
1443
1496
|
t(i.parse(a));
|
|
@@ -1462,7 +1515,7 @@ class ri extends hn {
|
|
|
1462
1515
|
* @return {Group} The parsed OBJ.
|
|
1463
1516
|
*/
|
|
1464
1517
|
parse(e) {
|
|
1465
|
-
const t = new
|
|
1518
|
+
const t = new pi();
|
|
1466
1519
|
e.indexOf(`\r
|
|
1467
1520
|
`) !== -1 && (e = e.replace(/\r\n/g, `
|
|
1468
1521
|
`)), e.indexOf(`\\
|
|
@@ -1471,148 +1524,148 @@ class ri extends hn {
|
|
|
1471
1524
|
`);
|
|
1472
1525
|
let n = [];
|
|
1473
1526
|
for (let a = 0, l = s.length; a < l; a++) {
|
|
1474
|
-
const
|
|
1475
|
-
if (
|
|
1476
|
-
const u =
|
|
1527
|
+
const c = s[a].trimStart();
|
|
1528
|
+
if (c.length === 0) continue;
|
|
1529
|
+
const u = c.charAt(0);
|
|
1477
1530
|
if (u !== "#")
|
|
1478
1531
|
if (u === "v") {
|
|
1479
|
-
const
|
|
1480
|
-
switch (
|
|
1532
|
+
const h = c.split(qt);
|
|
1533
|
+
switch (h[0]) {
|
|
1481
1534
|
case "v":
|
|
1482
1535
|
t.vertices.push(
|
|
1483
|
-
parseFloat(
|
|
1484
|
-
parseFloat(
|
|
1485
|
-
parseFloat(
|
|
1486
|
-
),
|
|
1487
|
-
parseFloat(
|
|
1488
|
-
parseFloat(
|
|
1489
|
-
parseFloat(
|
|
1490
|
-
|
|
1491
|
-
), 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);
|
|
1492
1545
|
break;
|
|
1493
1546
|
case "vn":
|
|
1494
1547
|
t.normals.push(
|
|
1495
|
-
parseFloat(
|
|
1496
|
-
parseFloat(
|
|
1497
|
-
parseFloat(
|
|
1548
|
+
parseFloat(h[1]),
|
|
1549
|
+
parseFloat(h[2]),
|
|
1550
|
+
parseFloat(h[3])
|
|
1498
1551
|
);
|
|
1499
1552
|
break;
|
|
1500
1553
|
case "vt":
|
|
1501
1554
|
t.uvs.push(
|
|
1502
|
-
parseFloat(
|
|
1503
|
-
parseFloat(
|
|
1555
|
+
parseFloat(h[1]),
|
|
1556
|
+
parseFloat(h[2])
|
|
1504
1557
|
);
|
|
1505
1558
|
break;
|
|
1506
1559
|
}
|
|
1507
1560
|
} else if (u === "f") {
|
|
1508
|
-
const
|
|
1509
|
-
for (let f = 0, y =
|
|
1510
|
-
const
|
|
1511
|
-
if (
|
|
1512
|
-
const
|
|
1513
|
-
m.push(
|
|
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("/");
|
|
1566
|
+
m.push(b);
|
|
1514
1567
|
}
|
|
1515
1568
|
}
|
|
1516
|
-
const
|
|
1569
|
+
const w = m[0];
|
|
1517
1570
|
for (let f = 1, y = m.length - 1; f < y; f++) {
|
|
1518
|
-
const
|
|
1571
|
+
const p = m[f], b = m[f + 1];
|
|
1519
1572
|
t.addFace(
|
|
1573
|
+
w[0],
|
|
1574
|
+
p[0],
|
|
1520
1575
|
b[0],
|
|
1521
|
-
|
|
1522
|
-
|
|
1576
|
+
w[1],
|
|
1577
|
+
p[1],
|
|
1523
1578
|
b[1],
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
b[2]
|
|
1527
|
-
d[2],
|
|
1528
|
-
_[2]
|
|
1579
|
+
w[2],
|
|
1580
|
+
p[2],
|
|
1581
|
+
b[2]
|
|
1529
1582
|
);
|
|
1530
1583
|
}
|
|
1531
1584
|
} else if (u === "l") {
|
|
1532
|
-
const
|
|
1533
|
-
let
|
|
1585
|
+
const h = c.substring(1).trim().split(" ");
|
|
1586
|
+
let d = [];
|
|
1534
1587
|
const m = [];
|
|
1535
|
-
if (
|
|
1536
|
-
|
|
1588
|
+
if (c.indexOf("/") === -1)
|
|
1589
|
+
d = h;
|
|
1537
1590
|
else
|
|
1538
|
-
for (let
|
|
1539
|
-
const y =
|
|
1540
|
-
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]);
|
|
1541
1594
|
}
|
|
1542
|
-
t.addLineGeometry(
|
|
1595
|
+
t.addLineGeometry(d, m);
|
|
1543
1596
|
} else if (u === "p") {
|
|
1544
|
-
const
|
|
1545
|
-
t.addPointGeometry(
|
|
1546
|
-
} else if ((n =
|
|
1547
|
-
const
|
|
1548
|
-
t.startObject(
|
|
1549
|
-
} else if (
|
|
1550
|
-
t.object.startMaterial(
|
|
1551
|
-
else if (
|
|
1552
|
-
t.materialLibraries.push(
|
|
1553
|
-
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))
|
|
1554
1607
|
console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');
|
|
1555
1608
|
else if (u === "s") {
|
|
1556
|
-
if (n =
|
|
1557
|
-
const
|
|
1558
|
-
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";
|
|
1559
1612
|
} else
|
|
1560
1613
|
t.object.smooth = !0;
|
|
1561
|
-
const
|
|
1562
|
-
|
|
1614
|
+
const h = t.object.currentMaterial();
|
|
1615
|
+
h && (h.smooth = t.object.smooth);
|
|
1563
1616
|
} else {
|
|
1564
|
-
if (
|
|
1565
|
-
console.warn('THREE.OBJLoader: Unexpected line: "' +
|
|
1617
|
+
if (c === "\0") continue;
|
|
1618
|
+
console.warn('THREE.OBJLoader: Unexpected line: "' + c + '"');
|
|
1566
1619
|
}
|
|
1567
1620
|
}
|
|
1568
1621
|
t.finalize();
|
|
1569
|
-
const i = new
|
|
1622
|
+
const i = new at();
|
|
1570
1623
|
if (i.materialLibraries = [].concat(t.materialLibraries), !(t.objects.length === 1 && t.objects[0].geometry.vertices.length === 0) === !0)
|
|
1571
1624
|
for (let a = 0, l = t.objects.length; a < l; a++) {
|
|
1572
|
-
const
|
|
1573
|
-
let
|
|
1625
|
+
const c = t.objects[a], u = c.geometry, h = c.materials, d = u.type === "Line", m = u.type === "Points";
|
|
1626
|
+
let w = !1;
|
|
1574
1627
|
if (u.vertices.length === 0) continue;
|
|
1575
|
-
const f = new
|
|
1576
|
-
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));
|
|
1577
1630
|
const y = [];
|
|
1578
|
-
for (let
|
|
1579
|
-
const
|
|
1631
|
+
for (let b = 0, T = h.length; b < T; b++) {
|
|
1632
|
+
const M = h[b], R = M.name + "_" + M.smooth + "_" + w;
|
|
1580
1633
|
let v = t.materials[R];
|
|
1581
1634
|
if (this.materials !== null) {
|
|
1582
|
-
if (v = this.materials.create(
|
|
1583
|
-
const I = new
|
|
1635
|
+
if (v = this.materials.create(M.name), d && v && !(v instanceof He)) {
|
|
1636
|
+
const I = new He();
|
|
1584
1637
|
Fe.prototype.copy.call(I, v), I.color.copy(v.color), v = I;
|
|
1585
|
-
} else if (m && v && !(v instanceof
|
|
1586
|
-
const I = new
|
|
1638
|
+
} else if (m && v && !(v instanceof Oe)) {
|
|
1639
|
+
const I = new Oe({ size: 10, sizeAttenuation: !1 });
|
|
1587
1640
|
Fe.prototype.copy.call(I, v), I.color.copy(v.color), I.map = v.map, v = I;
|
|
1588
1641
|
}
|
|
1589
1642
|
}
|
|
1590
|
-
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);
|
|
1591
1644
|
}
|
|
1592
|
-
let
|
|
1645
|
+
let p;
|
|
1593
1646
|
if (y.length > 1) {
|
|
1594
|
-
for (let
|
|
1595
|
-
const
|
|
1596
|
-
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);
|
|
1597
1650
|
}
|
|
1598
|
-
|
|
1651
|
+
d ? p = new Et(f, y) : m ? p = new lt(f, y) : p = new E(f, y);
|
|
1599
1652
|
} else
|
|
1600
|
-
|
|
1601
|
-
|
|
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);
|
|
1602
1655
|
}
|
|
1603
1656
|
else if (t.vertices.length > 0) {
|
|
1604
|
-
const a = new
|
|
1605
|
-
l.setAttribute("position", new
|
|
1606
|
-
const
|
|
1607
|
-
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);
|
|
1608
1661
|
}
|
|
1609
1662
|
return i;
|
|
1610
1663
|
}
|
|
1611
1664
|
}
|
|
1612
|
-
function
|
|
1613
|
-
if (e ===
|
|
1665
|
+
function tn(r, e) {
|
|
1666
|
+
if (e === Yn)
|
|
1614
1667
|
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), r;
|
|
1615
|
-
if (e ===
|
|
1668
|
+
if (e === Mt || e === mn) {
|
|
1616
1669
|
let t = r.getIndex();
|
|
1617
1670
|
if (t === null) {
|
|
1618
1671
|
const o = [], a = r.getAttribute("position");
|
|
@@ -1624,7 +1677,7 @@ function qt(r, e) {
|
|
|
1624
1677
|
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), r;
|
|
1625
1678
|
}
|
|
1626
1679
|
const s = t.count - 2, n = [];
|
|
1627
|
-
if (e ===
|
|
1680
|
+
if (e === Mt)
|
|
1628
1681
|
for (let o = 1; o <= s; o++)
|
|
1629
1682
|
n.push(t.getX(0)), n.push(t.getX(o)), n.push(t.getX(o + 1));
|
|
1630
1683
|
else
|
|
@@ -1636,9 +1689,9 @@ function qt(r, e) {
|
|
|
1636
1689
|
} else
|
|
1637
1690
|
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e), r;
|
|
1638
1691
|
}
|
|
1639
|
-
function
|
|
1692
|
+
function mi(r) {
|
|
1640
1693
|
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), s = r.clone();
|
|
1641
|
-
return
|
|
1694
|
+
return vn(r, s, function(n, i) {
|
|
1642
1695
|
e.set(i, n), t.set(n, i);
|
|
1643
1696
|
}), s.traverse(function(n) {
|
|
1644
1697
|
if (!n.isSkinnedMesh) return;
|
|
@@ -1648,12 +1701,12 @@ function ai(r) {
|
|
|
1648
1701
|
}), i.bind(i.skeleton, i.bindMatrix);
|
|
1649
1702
|
}), s;
|
|
1650
1703
|
}
|
|
1651
|
-
function
|
|
1704
|
+
function vn(r, e, t) {
|
|
1652
1705
|
t(r, e);
|
|
1653
1706
|
for (let s = 0; s < r.children.length; s++)
|
|
1654
|
-
|
|
1707
|
+
vn(r.children[s], e.children[s], t);
|
|
1655
1708
|
}
|
|
1656
|
-
class
|
|
1709
|
+
class gi extends It {
|
|
1657
1710
|
/**
|
|
1658
1711
|
* Constructs a new glTF loader.
|
|
1659
1712
|
*
|
|
@@ -1661,41 +1714,41 @@ class li extends hn {
|
|
|
1661
1714
|
*/
|
|
1662
1715
|
constructor(e) {
|
|
1663
1716
|
super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(t) {
|
|
1664
|
-
return new
|
|
1665
|
-
}), this.register(function(t) {
|
|
1666
|
-
return new fi(t);
|
|
1717
|
+
return new Ti(t);
|
|
1667
1718
|
}), this.register(function(t) {
|
|
1668
|
-
return new
|
|
1719
|
+
return new xi(t);
|
|
1669
1720
|
}), this.register(function(t) {
|
|
1670
|
-
return new
|
|
1721
|
+
return new Ii(t);
|
|
1671
1722
|
}), this.register(function(t) {
|
|
1672
|
-
return new
|
|
1723
|
+
return new Ci(t);
|
|
1673
1724
|
}), this.register(function(t) {
|
|
1674
|
-
return new
|
|
1725
|
+
return new Di(t);
|
|
1675
1726
|
}), this.register(function(t) {
|
|
1676
|
-
return new
|
|
1727
|
+
return new Mi(t);
|
|
1677
1728
|
}), this.register(function(t) {
|
|
1678
|
-
return new
|
|
1729
|
+
return new vi(t);
|
|
1679
1730
|
}), this.register(function(t) {
|
|
1680
|
-
return new
|
|
1731
|
+
return new Si(t);
|
|
1681
1732
|
}), this.register(function(t) {
|
|
1682
|
-
return new
|
|
1733
|
+
return new Ai(t);
|
|
1683
1734
|
}), this.register(function(t) {
|
|
1684
1735
|
return new wi(t);
|
|
1685
1736
|
}), this.register(function(t) {
|
|
1686
|
-
return new
|
|
1737
|
+
return new Ri(t);
|
|
1687
1738
|
}), this.register(function(t) {
|
|
1688
|
-
return new
|
|
1739
|
+
return new Ei(t);
|
|
1689
1740
|
}), this.register(function(t) {
|
|
1690
|
-
return new
|
|
1741
|
+
return new Li(t);
|
|
1691
1742
|
}), this.register(function(t) {
|
|
1692
|
-
return new
|
|
1743
|
+
return new Pi(t);
|
|
1693
1744
|
}), this.register(function(t) {
|
|
1694
|
-
return new
|
|
1745
|
+
return new _i(t);
|
|
1695
1746
|
}), this.register(function(t) {
|
|
1696
|
-
return new
|
|
1747
|
+
return new nn(t, A.EXT_MESHOPT_COMPRESSION);
|
|
1697
1748
|
}), this.register(function(t) {
|
|
1698
|
-
return new
|
|
1749
|
+
return new nn(t, A.KHR_MESHOPT_COMPRESSION);
|
|
1750
|
+
}), this.register(function(t) {
|
|
1751
|
+
return new Oi(t);
|
|
1699
1752
|
});
|
|
1700
1753
|
}
|
|
1701
1754
|
/**
|
|
@@ -1713,17 +1766,17 @@ class li extends hn {
|
|
|
1713
1766
|
if (this.resourcePath !== "")
|
|
1714
1767
|
o = this.resourcePath;
|
|
1715
1768
|
else if (this.path !== "") {
|
|
1716
|
-
const
|
|
1717
|
-
o =
|
|
1769
|
+
const c = Ue.extractUrlBase(e);
|
|
1770
|
+
o = Ue.resolveURL(c, this.path);
|
|
1718
1771
|
} else
|
|
1719
|
-
o =
|
|
1772
|
+
o = Ue.extractUrlBase(e);
|
|
1720
1773
|
this.manager.itemStart(e);
|
|
1721
|
-
const a = function(
|
|
1722
|
-
n ? n(
|
|
1723
|
-
}, l = new
|
|
1724
|
-
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) {
|
|
1725
1778
|
try {
|
|
1726
|
-
i.parse(
|
|
1779
|
+
i.parse(c, o, function(u) {
|
|
1727
1780
|
t(u), i.manager.itemEnd(e);
|
|
1728
1781
|
}, a);
|
|
1729
1782
|
} catch (u) {
|
|
@@ -1795,11 +1848,11 @@ class li extends hn {
|
|
|
1795
1848
|
if (typeof e == "string")
|
|
1796
1849
|
i = JSON.parse(e);
|
|
1797
1850
|
else if (e instanceof ArrayBuffer)
|
|
1798
|
-
if (l.decode(new Uint8Array(e, 0, 4)) ===
|
|
1851
|
+
if (l.decode(new Uint8Array(e, 0, 4)) === Sn) {
|
|
1799
1852
|
try {
|
|
1800
|
-
o[A.KHR_BINARY_GLTF] = new
|
|
1801
|
-
} catch (
|
|
1802
|
-
n && n(
|
|
1853
|
+
o[A.KHR_BINARY_GLTF] = new ki(e);
|
|
1854
|
+
} catch (h) {
|
|
1855
|
+
n && n(h);
|
|
1803
1856
|
return;
|
|
1804
1857
|
}
|
|
1805
1858
|
i = JSON.parse(o[A.KHR_BINARY_GLTF].content);
|
|
@@ -1811,7 +1864,7 @@ class li extends hn {
|
|
|
1811
1864
|
n && n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
|
|
1812
1865
|
return;
|
|
1813
1866
|
}
|
|
1814
|
-
const
|
|
1867
|
+
const c = new Zi(i, {
|
|
1815
1868
|
path: t || this.resourcePath || "",
|
|
1816
1869
|
crossOrigin: this.crossOrigin,
|
|
1817
1870
|
requestHeader: this.requestHeader,
|
|
@@ -1819,32 +1872,32 @@ class li extends hn {
|
|
|
1819
1872
|
ktx2Loader: this.ktx2Loader,
|
|
1820
1873
|
meshoptDecoder: this.meshoptDecoder
|
|
1821
1874
|
});
|
|
1822
|
-
|
|
1875
|
+
c.fileLoader.setRequestHeader(this.requestHeader);
|
|
1823
1876
|
for (let u = 0; u < this.pluginCallbacks.length; u++) {
|
|
1824
|
-
const
|
|
1825
|
-
|
|
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;
|
|
1826
1879
|
}
|
|
1827
1880
|
if (i.extensionsUsed)
|
|
1828
1881
|
for (let u = 0; u < i.extensionsUsed.length; ++u) {
|
|
1829
|
-
const
|
|
1830
|
-
switch (
|
|
1882
|
+
const h = i.extensionsUsed[u], d = i.extensionsRequired || [];
|
|
1883
|
+
switch (h) {
|
|
1831
1884
|
case A.KHR_MATERIALS_UNLIT:
|
|
1832
|
-
o[
|
|
1885
|
+
o[h] = new bi();
|
|
1833
1886
|
break;
|
|
1834
1887
|
case A.KHR_DRACO_MESH_COMPRESSION:
|
|
1835
|
-
o[
|
|
1888
|
+
o[h] = new Ni(i, this.dracoLoader);
|
|
1836
1889
|
break;
|
|
1837
1890
|
case A.KHR_TEXTURE_TRANSFORM:
|
|
1838
|
-
o[
|
|
1891
|
+
o[h] = new ji();
|
|
1839
1892
|
break;
|
|
1840
1893
|
case A.KHR_MESH_QUANTIZATION:
|
|
1841
|
-
o[
|
|
1894
|
+
o[h] = new Hi();
|
|
1842
1895
|
break;
|
|
1843
1896
|
default:
|
|
1844
|
-
|
|
1897
|
+
d.indexOf(h) >= 0 && a[h] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + h + '".');
|
|
1845
1898
|
}
|
|
1846
1899
|
}
|
|
1847
|
-
|
|
1900
|
+
c.setExtensions(o), c.setPlugins(a), c.parse(s, n);
|
|
1848
1901
|
}
|
|
1849
1902
|
/**
|
|
1850
1903
|
* Async version of {@link GLTFLoader#parse}.
|
|
@@ -1861,7 +1914,7 @@ class li extends hn {
|
|
|
1861
1914
|
});
|
|
1862
1915
|
}
|
|
1863
1916
|
}
|
|
1864
|
-
function
|
|
1917
|
+
function yi() {
|
|
1865
1918
|
let r = {};
|
|
1866
1919
|
return {
|
|
1867
1920
|
get: function(e) {
|
|
@@ -1878,7 +1931,7 @@ function ci() {
|
|
|
1878
1931
|
}
|
|
1879
1932
|
};
|
|
1880
1933
|
}
|
|
1881
|
-
function
|
|
1934
|
+
function N(r, e, t) {
|
|
1882
1935
|
const s = r.json.materials[e];
|
|
1883
1936
|
return s.extensions && s.extensions[t] ? s.extensions[t] : null;
|
|
1884
1937
|
}
|
|
@@ -1907,7 +1960,7 @@ const A = {
|
|
|
1907
1960
|
KHR_MESHOPT_COMPRESSION: "KHR_meshopt_compression",
|
|
1908
1961
|
EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing"
|
|
1909
1962
|
};
|
|
1910
|
-
class
|
|
1963
|
+
class _i {
|
|
1911
1964
|
constructor(e) {
|
|
1912
1965
|
this.parser = e, this.name = A.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
|
|
1913
1966
|
}
|
|
@@ -1923,24 +1976,24 @@ class hi {
|
|
|
1923
1976
|
let n = t.cache.get(s);
|
|
1924
1977
|
if (n) return n;
|
|
1925
1978
|
const i = t.json, l = ((i.extensions && i.extensions[this.name] || {}).lights || [])[e];
|
|
1926
|
-
let
|
|
1927
|
-
const u = new
|
|
1928
|
-
l.color !== void 0 && u.setRGB(l.color[0], l.color[1], l.color[2],
|
|
1929
|
-
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;
|
|
1930
1983
|
switch (l.type) {
|
|
1931
1984
|
case "directional":
|
|
1932
|
-
|
|
1985
|
+
c = new Zn(u), c.target.position.set(0, 0, -1), c.add(c.target);
|
|
1933
1986
|
break;
|
|
1934
1987
|
case "point":
|
|
1935
|
-
|
|
1988
|
+
c = new Vn(u), c.distance = h;
|
|
1936
1989
|
break;
|
|
1937
1990
|
case "spot":
|
|
1938
|
-
|
|
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);
|
|
1939
1992
|
break;
|
|
1940
1993
|
default:
|
|
1941
1994
|
throw new Error("THREE.GLTFLoader: Unexpected light type: " + l.type);
|
|
1942
1995
|
}
|
|
1943
|
-
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;
|
|
1944
1997
|
}
|
|
1945
1998
|
getDependency(e, t) {
|
|
1946
1999
|
if (e === "light")
|
|
@@ -1953,185 +2006,185 @@ class hi {
|
|
|
1953
2006
|
});
|
|
1954
2007
|
}
|
|
1955
2008
|
}
|
|
1956
|
-
class
|
|
2009
|
+
class bi {
|
|
1957
2010
|
constructor() {
|
|
1958
2011
|
this.name = A.KHR_MATERIALS_UNLIT;
|
|
1959
2012
|
}
|
|
1960
2013
|
getMaterialType() {
|
|
1961
|
-
return
|
|
2014
|
+
return we;
|
|
1962
2015
|
}
|
|
1963
2016
|
extendParams(e, t, s) {
|
|
1964
2017
|
const n = [];
|
|
1965
|
-
e.color = new
|
|
2018
|
+
e.color = new he(1, 1, 1), e.opacity = 1;
|
|
1966
2019
|
const i = t.pbrMetallicRoughness;
|
|
1967
2020
|
if (i) {
|
|
1968
2021
|
if (Array.isArray(i.baseColorFactor)) {
|
|
1969
2022
|
const o = i.baseColorFactor;
|
|
1970
|
-
e.color.setRGB(o[0], o[1], o[2],
|
|
2023
|
+
e.color.setRGB(o[0], o[1], o[2], ie), e.opacity = o[3];
|
|
1971
2024
|
}
|
|
1972
|
-
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));
|
|
1973
2026
|
}
|
|
1974
2027
|
return Promise.all(n);
|
|
1975
2028
|
}
|
|
1976
2029
|
}
|
|
1977
|
-
class
|
|
2030
|
+
class wi {
|
|
1978
2031
|
constructor(e) {
|
|
1979
2032
|
this.parser = e, this.name = A.KHR_MATERIALS_EMISSIVE_STRENGTH;
|
|
1980
2033
|
}
|
|
1981
2034
|
extendMaterialParams(e, t) {
|
|
1982
|
-
const s =
|
|
2035
|
+
const s = N(this.parser, e, this.name);
|
|
1983
2036
|
return s === null || s.emissiveStrength !== void 0 && (t.emissiveIntensity = s.emissiveStrength), Promise.resolve();
|
|
1984
2037
|
}
|
|
1985
2038
|
}
|
|
1986
|
-
class
|
|
2039
|
+
class Ti {
|
|
1987
2040
|
constructor(e) {
|
|
1988
2041
|
this.parser = e, this.name = A.KHR_MATERIALS_CLEARCOAT;
|
|
1989
2042
|
}
|
|
1990
2043
|
getMaterialType(e) {
|
|
1991
|
-
return
|
|
2044
|
+
return N(this.parser, e, this.name) !== null ? oe : null;
|
|
1992
2045
|
}
|
|
1993
2046
|
extendMaterialParams(e, t) {
|
|
1994
|
-
const s =
|
|
2047
|
+
const s = N(this.parser, e, this.name);
|
|
1995
2048
|
if (s === null) return Promise.resolve();
|
|
1996
2049
|
const n = [];
|
|
1997
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)) {
|
|
1998
2051
|
const i = s.clearcoatNormalTexture.scale;
|
|
1999
|
-
t.clearcoatNormalScale = new
|
|
2052
|
+
t.clearcoatNormalScale = new Z(i, i);
|
|
2000
2053
|
}
|
|
2001
2054
|
return Promise.all(n);
|
|
2002
2055
|
}
|
|
2003
2056
|
}
|
|
2004
|
-
class
|
|
2057
|
+
class xi {
|
|
2005
2058
|
constructor(e) {
|
|
2006
2059
|
this.parser = e, this.name = A.KHR_MATERIALS_DISPERSION;
|
|
2007
2060
|
}
|
|
2008
2061
|
getMaterialType(e) {
|
|
2009
|
-
return
|
|
2062
|
+
return N(this.parser, e, this.name) !== null ? oe : null;
|
|
2010
2063
|
}
|
|
2011
2064
|
extendMaterialParams(e, t) {
|
|
2012
|
-
const s =
|
|
2065
|
+
const s = N(this.parser, e, this.name);
|
|
2013
2066
|
return s === null || (t.dispersion = s.dispersion !== void 0 ? s.dispersion : 0), Promise.resolve();
|
|
2014
2067
|
}
|
|
2015
2068
|
}
|
|
2016
|
-
class
|
|
2069
|
+
class Ei {
|
|
2017
2070
|
constructor(e) {
|
|
2018
2071
|
this.parser = e, this.name = A.KHR_MATERIALS_IRIDESCENCE;
|
|
2019
2072
|
}
|
|
2020
2073
|
getMaterialType(e) {
|
|
2021
|
-
return
|
|
2074
|
+
return N(this.parser, e, this.name) !== null ? oe : null;
|
|
2022
2075
|
}
|
|
2023
2076
|
extendMaterialParams(e, t) {
|
|
2024
|
-
const s =
|
|
2077
|
+
const s = N(this.parser, e, this.name);
|
|
2025
2078
|
if (s === null) return Promise.resolve();
|
|
2026
2079
|
const n = [];
|
|
2027
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);
|
|
2028
2081
|
}
|
|
2029
2082
|
}
|
|
2030
|
-
class
|
|
2083
|
+
class Mi {
|
|
2031
2084
|
constructor(e) {
|
|
2032
2085
|
this.parser = e, this.name = A.KHR_MATERIALS_SHEEN;
|
|
2033
2086
|
}
|
|
2034
2087
|
getMaterialType(e) {
|
|
2035
|
-
return
|
|
2088
|
+
return N(this.parser, e, this.name) !== null ? oe : null;
|
|
2036
2089
|
}
|
|
2037
2090
|
extendMaterialParams(e, t) {
|
|
2038
|
-
const s =
|
|
2091
|
+
const s = N(this.parser, e, this.name);
|
|
2039
2092
|
if (s === null) return Promise.resolve();
|
|
2040
2093
|
const n = [];
|
|
2041
|
-
if (t.sheenColor = new
|
|
2094
|
+
if (t.sheenColor = new he(0, 0, 0), t.sheenRoughness = 0, t.sheen = 1, s.sheenColorFactor !== void 0) {
|
|
2042
2095
|
const i = s.sheenColorFactor;
|
|
2043
|
-
t.sheenColor.setRGB(i[0], i[1], i[2],
|
|
2096
|
+
t.sheenColor.setRGB(i[0], i[1], i[2], ie);
|
|
2044
2097
|
}
|
|
2045
|
-
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);
|
|
2046
2099
|
}
|
|
2047
2100
|
}
|
|
2048
|
-
class
|
|
2101
|
+
class vi {
|
|
2049
2102
|
constructor(e) {
|
|
2050
2103
|
this.parser = e, this.name = A.KHR_MATERIALS_TRANSMISSION;
|
|
2051
2104
|
}
|
|
2052
2105
|
getMaterialType(e) {
|
|
2053
|
-
return
|
|
2106
|
+
return N(this.parser, e, this.name) !== null ? oe : null;
|
|
2054
2107
|
}
|
|
2055
2108
|
extendMaterialParams(e, t) {
|
|
2056
|
-
const s =
|
|
2109
|
+
const s = N(this.parser, e, this.name);
|
|
2057
2110
|
if (s === null) return Promise.resolve();
|
|
2058
2111
|
const n = [];
|
|
2059
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);
|
|
2060
2113
|
}
|
|
2061
2114
|
}
|
|
2062
|
-
class
|
|
2115
|
+
class Si {
|
|
2063
2116
|
constructor(e) {
|
|
2064
2117
|
this.parser = e, this.name = A.KHR_MATERIALS_VOLUME;
|
|
2065
2118
|
}
|
|
2066
2119
|
getMaterialType(e) {
|
|
2067
|
-
return
|
|
2120
|
+
return N(this.parser, e, this.name) !== null ? oe : null;
|
|
2068
2121
|
}
|
|
2069
2122
|
extendMaterialParams(e, t) {
|
|
2070
|
-
const s =
|
|
2123
|
+
const s = N(this.parser, e, this.name);
|
|
2071
2124
|
if (s === null) return Promise.resolve();
|
|
2072
2125
|
const n = [];
|
|
2073
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;
|
|
2074
2127
|
const i = s.attenuationColor || [1, 1, 1];
|
|
2075
|
-
return t.attenuationColor = new
|
|
2128
|
+
return t.attenuationColor = new he().setRGB(i[0], i[1], i[2], ie), Promise.all(n);
|
|
2076
2129
|
}
|
|
2077
2130
|
}
|
|
2078
|
-
class
|
|
2131
|
+
class Ai {
|
|
2079
2132
|
constructor(e) {
|
|
2080
2133
|
this.parser = e, this.name = A.KHR_MATERIALS_IOR;
|
|
2081
2134
|
}
|
|
2082
2135
|
getMaterialType(e) {
|
|
2083
|
-
return
|
|
2136
|
+
return N(this.parser, e, this.name) !== null ? oe : null;
|
|
2084
2137
|
}
|
|
2085
2138
|
extendMaterialParams(e, t) {
|
|
2086
|
-
const s =
|
|
2139
|
+
const s = N(this.parser, e, this.name);
|
|
2087
2140
|
return s === null || (t.ior = s.ior !== void 0 ? s.ior : 1.5, t.ior === 0 && (t.ior = 1e3)), Promise.resolve();
|
|
2088
2141
|
}
|
|
2089
2142
|
}
|
|
2090
|
-
class
|
|
2143
|
+
class Ri {
|
|
2091
2144
|
constructor(e) {
|
|
2092
2145
|
this.parser = e, this.name = A.KHR_MATERIALS_SPECULAR;
|
|
2093
2146
|
}
|
|
2094
2147
|
getMaterialType(e) {
|
|
2095
|
-
return
|
|
2148
|
+
return N(this.parser, e, this.name) !== null ? oe : null;
|
|
2096
2149
|
}
|
|
2097
2150
|
extendMaterialParams(e, t) {
|
|
2098
|
-
const s =
|
|
2151
|
+
const s = N(this.parser, e, this.name);
|
|
2099
2152
|
if (s === null) return Promise.resolve();
|
|
2100
2153
|
const n = [];
|
|
2101
2154
|
t.specularIntensity = s.specularFactor !== void 0 ? s.specularFactor : 1, s.specularTexture !== void 0 && n.push(this.parser.assignTexture(t, "specularIntensityMap", s.specularTexture));
|
|
2102
2155
|
const i = s.specularColorFactor || [1, 1, 1];
|
|
2103
|
-
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);
|
|
2104
2157
|
}
|
|
2105
2158
|
}
|
|
2106
|
-
class
|
|
2159
|
+
class Pi {
|
|
2107
2160
|
constructor(e) {
|
|
2108
2161
|
this.parser = e, this.name = A.EXT_MATERIALS_BUMP;
|
|
2109
2162
|
}
|
|
2110
2163
|
getMaterialType(e) {
|
|
2111
|
-
return
|
|
2164
|
+
return N(this.parser, e, this.name) !== null ? oe : null;
|
|
2112
2165
|
}
|
|
2113
2166
|
extendMaterialParams(e, t) {
|
|
2114
|
-
const s =
|
|
2167
|
+
const s = N(this.parser, e, this.name);
|
|
2115
2168
|
if (s === null) return Promise.resolve();
|
|
2116
2169
|
const n = [];
|
|
2117
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);
|
|
2118
2171
|
}
|
|
2119
2172
|
}
|
|
2120
|
-
class
|
|
2173
|
+
class Li {
|
|
2121
2174
|
constructor(e) {
|
|
2122
2175
|
this.parser = e, this.name = A.KHR_MATERIALS_ANISOTROPY;
|
|
2123
2176
|
}
|
|
2124
2177
|
getMaterialType(e) {
|
|
2125
|
-
return
|
|
2178
|
+
return N(this.parser, e, this.name) !== null ? oe : null;
|
|
2126
2179
|
}
|
|
2127
2180
|
extendMaterialParams(e, t) {
|
|
2128
|
-
const s =
|
|
2181
|
+
const s = N(this.parser, e, this.name);
|
|
2129
2182
|
if (s === null) return Promise.resolve();
|
|
2130
2183
|
const n = [];
|
|
2131
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);
|
|
2132
2185
|
}
|
|
2133
2186
|
}
|
|
2134
|
-
class
|
|
2187
|
+
class Ii {
|
|
2135
2188
|
constructor(e) {
|
|
2136
2189
|
this.parser = e, this.name = A.KHR_TEXTURE_BASISU;
|
|
2137
2190
|
}
|
|
@@ -2148,7 +2201,7 @@ class Ei {
|
|
|
2148
2201
|
return t.loadTextureImage(e, i.source, o);
|
|
2149
2202
|
}
|
|
2150
2203
|
}
|
|
2151
|
-
class
|
|
2204
|
+
class Ci {
|
|
2152
2205
|
constructor(e) {
|
|
2153
2206
|
this.parser = e, this.name = A.EXT_TEXTURE_WEBP;
|
|
2154
2207
|
}
|
|
@@ -2159,13 +2212,13 @@ class Mi {
|
|
|
2159
2212
|
const o = i.extensions[t], a = n.images[o.source];
|
|
2160
2213
|
let l = s.textureLoader;
|
|
2161
2214
|
if (a.uri) {
|
|
2162
|
-
const
|
|
2163
|
-
|
|
2215
|
+
const c = s.options.manager.getHandler(a.uri);
|
|
2216
|
+
c !== null && (l = c);
|
|
2164
2217
|
}
|
|
2165
2218
|
return s.loadTextureImage(e, o.source, l);
|
|
2166
2219
|
}
|
|
2167
2220
|
}
|
|
2168
|
-
class
|
|
2221
|
+
class Di {
|
|
2169
2222
|
constructor(e) {
|
|
2170
2223
|
this.parser = e, this.name = A.EXT_TEXTURE_AVIF;
|
|
2171
2224
|
}
|
|
@@ -2176,13 +2229,13 @@ class vi {
|
|
|
2176
2229
|
const o = i.extensions[t], a = n.images[o.source];
|
|
2177
2230
|
let l = s.textureLoader;
|
|
2178
2231
|
if (a.uri) {
|
|
2179
|
-
const
|
|
2180
|
-
|
|
2232
|
+
const c = s.options.manager.getHandler(a.uri);
|
|
2233
|
+
c !== null && (l = c);
|
|
2181
2234
|
}
|
|
2182
2235
|
return s.loadTextureImage(e, o.source, l);
|
|
2183
2236
|
}
|
|
2184
2237
|
}
|
|
2185
|
-
class
|
|
2238
|
+
class nn {
|
|
2186
2239
|
constructor(e, t) {
|
|
2187
2240
|
this.name = t, this.parser = e;
|
|
2188
2241
|
}
|
|
@@ -2196,19 +2249,19 @@ class Wt {
|
|
|
2196
2249
|
return null;
|
|
2197
2250
|
}
|
|
2198
2251
|
return i.then(function(a) {
|
|
2199
|
-
const l = n.byteOffset || 0,
|
|
2200
|
-
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) {
|
|
2201
2254
|
return m.buffer;
|
|
2202
2255
|
}) : o.ready.then(function() {
|
|
2203
|
-
const m = new ArrayBuffer(u *
|
|
2204
|
-
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;
|
|
2205
2258
|
});
|
|
2206
2259
|
});
|
|
2207
2260
|
} else
|
|
2208
2261
|
return null;
|
|
2209
2262
|
}
|
|
2210
2263
|
}
|
|
2211
|
-
class
|
|
2264
|
+
class Oi {
|
|
2212
2265
|
constructor(e) {
|
|
2213
2266
|
this.name = A.EXT_MESH_GPU_INSTANCING, this.parser = e;
|
|
2214
2267
|
}
|
|
@@ -2217,54 +2270,54 @@ class Si {
|
|
|
2217
2270
|
if (!s.extensions || !s.extensions[this.name] || s.mesh === void 0)
|
|
2218
2271
|
return null;
|
|
2219
2272
|
const n = t.meshes[s.mesh];
|
|
2220
|
-
for (const
|
|
2221
|
-
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)
|
|
2222
2275
|
return null;
|
|
2223
2276
|
const o = s.extensions[this.name].attributes, a = [], l = {};
|
|
2224
|
-
for (const
|
|
2225
|
-
a.push(this.parser.getDependency("accessor", o[
|
|
2226
|
-
return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((
|
|
2227
|
-
const u =
|
|
2228
|
-
for (const
|
|
2229
|
-
const f = new
|
|
2230
|
-
for (let
|
|
2231
|
-
l.TRANSLATION && y.fromBufferAttribute(l.TRANSLATION,
|
|
2232
|
-
for (const
|
|
2233
|
-
if (
|
|
2234
|
-
const R = l[
|
|
2235
|
-
|
|
2236
|
-
} else
|
|
2237
|
-
|
|
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);
|
|
2238
2291
|
}
|
|
2239
2292
|
return u.isGroup ? (u.clear(), u.add(...m), u) : m[0];
|
|
2240
2293
|
}));
|
|
2241
2294
|
}
|
|
2242
2295
|
}
|
|
2243
|
-
const
|
|
2244
|
-
class
|
|
2296
|
+
const Sn = "glTF", De = 12, sn = { JSON: 1313821514, BIN: 5130562 };
|
|
2297
|
+
class ki {
|
|
2245
2298
|
constructor(e) {
|
|
2246
2299
|
this.name = A.KHR_BINARY_GLTF, this.content = null, this.body = null;
|
|
2247
|
-
const t = new DataView(e, 0,
|
|
2300
|
+
const t = new DataView(e, 0, De), s = new TextDecoder();
|
|
2248
2301
|
if (this.header = {
|
|
2249
2302
|
magic: s.decode(new Uint8Array(e.slice(0, 4))),
|
|
2250
2303
|
version: t.getUint32(4, !0),
|
|
2251
2304
|
length: t.getUint32(8, !0)
|
|
2252
|
-
}, this.header.magic !==
|
|
2305
|
+
}, this.header.magic !== Sn)
|
|
2253
2306
|
throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
|
|
2254
2307
|
if (this.header.version < 2)
|
|
2255
2308
|
throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
|
|
2256
|
-
const n = this.header.length -
|
|
2309
|
+
const n = this.header.length - De, i = new DataView(e, De);
|
|
2257
2310
|
let o = 0;
|
|
2258
2311
|
for (; o < n; ) {
|
|
2259
2312
|
const a = i.getUint32(o, !0);
|
|
2260
2313
|
o += 4;
|
|
2261
2314
|
const l = i.getUint32(o, !0);
|
|
2262
|
-
if (o += 4, l ===
|
|
2263
|
-
const
|
|
2264
|
-
this.content = s.decode(
|
|
2265
|
-
} else if (l ===
|
|
2266
|
-
const
|
|
2267
|
-
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);
|
|
2268
2321
|
}
|
|
2269
2322
|
o += a;
|
|
2270
2323
|
}
|
|
@@ -2272,39 +2325,39 @@ class Ai {
|
|
|
2272
2325
|
throw new Error("THREE.GLTFLoader: JSON content not found.");
|
|
2273
2326
|
}
|
|
2274
2327
|
}
|
|
2275
|
-
class
|
|
2328
|
+
class Ni {
|
|
2276
2329
|
constructor(e, t) {
|
|
2277
2330
|
if (!t)
|
|
2278
2331
|
throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
|
|
2279
2332
|
this.name = A.KHR_DRACO_MESH_COMPRESSION, this.json = e, this.dracoLoader = t, this.dracoLoader.preload();
|
|
2280
2333
|
}
|
|
2281
2334
|
decodePrimitive(e, t) {
|
|
2282
|
-
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 = {};
|
|
2283
2336
|
for (const u in o) {
|
|
2284
|
-
const
|
|
2285
|
-
a[
|
|
2337
|
+
const h = Pt[u] || u.toLowerCase();
|
|
2338
|
+
a[h] = o[u];
|
|
2286
2339
|
}
|
|
2287
2340
|
for (const u in e.attributes) {
|
|
2288
|
-
const
|
|
2341
|
+
const h = Pt[u] || u.toLowerCase();
|
|
2289
2342
|
if (o[u] !== void 0) {
|
|
2290
|
-
const
|
|
2291
|
-
h
|
|
2343
|
+
const d = s.accessors[e.attributes[u]], m = Ae[d.componentType];
|
|
2344
|
+
c[h] = m.name, l[h] = d.normalized === !0;
|
|
2292
2345
|
}
|
|
2293
2346
|
}
|
|
2294
2347
|
return t.getDependency("bufferView", i).then(function(u) {
|
|
2295
|
-
return new Promise(function(
|
|
2348
|
+
return new Promise(function(h, d) {
|
|
2296
2349
|
n.decodeDracoFile(u, function(m) {
|
|
2297
|
-
for (const
|
|
2298
|
-
const f = m.attributes[
|
|
2350
|
+
for (const w in m.attributes) {
|
|
2351
|
+
const f = m.attributes[w], y = l[w];
|
|
2299
2352
|
y !== void 0 && (f.normalized = y);
|
|
2300
2353
|
}
|
|
2301
|
-
|
|
2302
|
-
}, a,
|
|
2354
|
+
h(m);
|
|
2355
|
+
}, a, c, ie, d);
|
|
2303
2356
|
});
|
|
2304
2357
|
});
|
|
2305
2358
|
}
|
|
2306
2359
|
}
|
|
2307
|
-
class
|
|
2360
|
+
class ji {
|
|
2308
2361
|
constructor() {
|
|
2309
2362
|
this.name = A.KHR_TEXTURE_TRANSFORM;
|
|
2310
2363
|
}
|
|
@@ -2312,12 +2365,12 @@ class Pi {
|
|
|
2312
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;
|
|
2313
2366
|
}
|
|
2314
2367
|
}
|
|
2315
|
-
class
|
|
2368
|
+
class Hi {
|
|
2316
2369
|
constructor() {
|
|
2317
2370
|
this.name = A.KHR_MESH_QUANTIZATION;
|
|
2318
2371
|
}
|
|
2319
2372
|
}
|
|
2320
|
-
class
|
|
2373
|
+
class An extends fs {
|
|
2321
2374
|
constructor(e, t, s, n) {
|
|
2322
2375
|
super(e, t, s, n);
|
|
2323
2376
|
}
|
|
@@ -2328,22 +2381,22 @@ class wn extends ls {
|
|
|
2328
2381
|
return t;
|
|
2329
2382
|
}
|
|
2330
2383
|
interpolate_(e, t, s, n) {
|
|
2331
|
-
const i = this.resultBuffer, o = this.sampleValues, a = this.valueSize, l = a * 2,
|
|
2332
|
-
for (let
|
|
2333
|
-
const R = o[f +
|
|
2334
|
-
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;
|
|
2335
2388
|
}
|
|
2336
2389
|
return i;
|
|
2337
2390
|
}
|
|
2338
2391
|
}
|
|
2339
|
-
const
|
|
2340
|
-
class
|
|
2392
|
+
const Fi = new K();
|
|
2393
|
+
class Ui extends An {
|
|
2341
2394
|
interpolate_(e, t, s, n) {
|
|
2342
2395
|
const i = super.interpolate_(e, t, s, n);
|
|
2343
|
-
return
|
|
2396
|
+
return Fi.fromArray(i).normalize().toArray(i), i;
|
|
2344
2397
|
}
|
|
2345
2398
|
}
|
|
2346
|
-
const
|
|
2399
|
+
const ee = {
|
|
2347
2400
|
POINTS: 0,
|
|
2348
2401
|
LINES: 1,
|
|
2349
2402
|
LINE_LOOP: 2,
|
|
@@ -2351,25 +2404,25 @@ const W = {
|
|
|
2351
2404
|
TRIANGLES: 4,
|
|
2352
2405
|
TRIANGLE_STRIP: 5,
|
|
2353
2406
|
TRIANGLE_FAN: 6
|
|
2354
|
-
},
|
|
2407
|
+
}, Ae = {
|
|
2355
2408
|
5120: Int8Array,
|
|
2356
2409
|
5121: Uint8Array,
|
|
2357
2410
|
5122: Int16Array,
|
|
2358
2411
|
5123: Uint16Array,
|
|
2359
2412
|
5125: Uint32Array,
|
|
2360
2413
|
5126: Float32Array
|
|
2361
|
-
},
|
|
2362
|
-
9728:
|
|
2363
|
-
9729:
|
|
2364
|
-
9984:
|
|
2365
|
-
9985:
|
|
2366
|
-
9986:
|
|
2367
|
-
9987:
|
|
2368
|
-
},
|
|
2369
|
-
33071:
|
|
2370
|
-
33648:
|
|
2371
|
-
10497:
|
|
2372
|
-
},
|
|
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 = {
|
|
2373
2426
|
SCALAR: 1,
|
|
2374
2427
|
VEC2: 2,
|
|
2375
2428
|
VEC3: 3,
|
|
@@ -2377,7 +2430,7 @@ const W = {
|
|
|
2377
2430
|
MAT2: 4,
|
|
2378
2431
|
MAT3: 9,
|
|
2379
2432
|
MAT4: 16
|
|
2380
|
-
},
|
|
2433
|
+
}, Pt = {
|
|
2381
2434
|
POSITION: "position",
|
|
2382
2435
|
NORMAL: "normal",
|
|
2383
2436
|
TANGENT: "tangent",
|
|
@@ -2388,73 +2441,73 @@ const W = {
|
|
|
2388
2441
|
COLOR_0: "color",
|
|
2389
2442
|
WEIGHTS_0: "skinWeight",
|
|
2390
2443
|
JOINTS_0: "skinIndex"
|
|
2391
|
-
},
|
|
2444
|
+
}, de = {
|
|
2392
2445
|
scale: "scale",
|
|
2393
2446
|
translation: "position",
|
|
2394
2447
|
rotation: "quaternion",
|
|
2395
2448
|
weights: "morphTargetInfluences"
|
|
2396
|
-
},
|
|
2449
|
+
}, zi = {
|
|
2397
2450
|
CUBICSPLINE: void 0,
|
|
2398
2451
|
// We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
|
|
2399
2452
|
// keyframe track will be initialized with a default interpolation type, then modified.
|
|
2400
|
-
LINEAR:
|
|
2401
|
-
STEP:
|
|
2402
|
-
},
|
|
2453
|
+
LINEAR: Tn,
|
|
2454
|
+
STEP: ds
|
|
2455
|
+
}, wt = {
|
|
2403
2456
|
OPAQUE: "OPAQUE",
|
|
2404
2457
|
MASK: "MASK",
|
|
2405
2458
|
BLEND: "BLEND"
|
|
2406
2459
|
};
|
|
2407
|
-
function
|
|
2408
|
-
return r.DefaultMaterial === void 0 && (r.DefaultMaterial = new
|
|
2460
|
+
function Gi(r) {
|
|
2461
|
+
return r.DefaultMaterial === void 0 && (r.DefaultMaterial = new wn({
|
|
2409
2462
|
color: 16777215,
|
|
2410
2463
|
emissive: 0,
|
|
2411
2464
|
metalness: 1,
|
|
2412
2465
|
roughness: 1,
|
|
2413
2466
|
transparent: !1,
|
|
2414
2467
|
depthTest: !0,
|
|
2415
|
-
side:
|
|
2468
|
+
side: ps
|
|
2416
2469
|
})), r.DefaultMaterial;
|
|
2417
2470
|
}
|
|
2418
|
-
function
|
|
2471
|
+
function _e(r, e, t) {
|
|
2419
2472
|
for (const s in t.extensions)
|
|
2420
2473
|
r[s] === void 0 && (e.userData.gltfExtensions = e.userData.gltfExtensions || {}, e.userData.gltfExtensions[s] = t.extensions[s]);
|
|
2421
2474
|
}
|
|
2422
|
-
function
|
|
2475
|
+
function se(r, e) {
|
|
2423
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));
|
|
2424
2477
|
}
|
|
2425
|
-
function
|
|
2478
|
+
function Xi(r, e, t) {
|
|
2426
2479
|
let s = !1, n = !1, i = !1;
|
|
2427
|
-
for (let
|
|
2428
|
-
const
|
|
2429
|
-
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;
|
|
2430
2483
|
}
|
|
2431
2484
|
if (!s && !n && !i) return Promise.resolve(r);
|
|
2432
2485
|
const o = [], a = [], l = [];
|
|
2433
|
-
for (let
|
|
2434
|
-
const
|
|
2486
|
+
for (let c = 0, u = e.length; c < u; c++) {
|
|
2487
|
+
const h = e[c];
|
|
2435
2488
|
if (s) {
|
|
2436
|
-
const
|
|
2437
|
-
o.push(
|
|
2489
|
+
const d = h.POSITION !== void 0 ? t.getDependency("accessor", h.POSITION) : r.attributes.position;
|
|
2490
|
+
o.push(d);
|
|
2438
2491
|
}
|
|
2439
2492
|
if (n) {
|
|
2440
|
-
const
|
|
2441
|
-
a.push(
|
|
2493
|
+
const d = h.NORMAL !== void 0 ? t.getDependency("accessor", h.NORMAL) : r.attributes.normal;
|
|
2494
|
+
a.push(d);
|
|
2442
2495
|
}
|
|
2443
2496
|
if (i) {
|
|
2444
|
-
const
|
|
2445
|
-
l.push(
|
|
2497
|
+
const d = h.COLOR_0 !== void 0 ? t.getDependency("accessor", h.COLOR_0) : r.attributes.color;
|
|
2498
|
+
l.push(d);
|
|
2446
2499
|
}
|
|
2447
2500
|
}
|
|
2448
2501
|
return Promise.all([
|
|
2449
2502
|
Promise.all(o),
|
|
2450
2503
|
Promise.all(a),
|
|
2451
2504
|
Promise.all(l)
|
|
2452
|
-
]).then(function(
|
|
2453
|
-
const u =
|
|
2454
|
-
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;
|
|
2455
2508
|
});
|
|
2456
2509
|
}
|
|
2457
|
-
function
|
|
2510
|
+
function Bi(r, e) {
|
|
2458
2511
|
if (r.updateMorphTargets(), e.weights !== void 0)
|
|
2459
2512
|
for (let t = 0, s = e.weights.length; t < s; t++)
|
|
2460
2513
|
r.morphTargetInfluences[t] = e.weights[t];
|
|
@@ -2468,22 +2521,22 @@ function ki(r, e) {
|
|
|
2468
2521
|
console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
|
|
2469
2522
|
}
|
|
2470
2523
|
}
|
|
2471
|
-
function
|
|
2524
|
+
function Yi(r) {
|
|
2472
2525
|
let e;
|
|
2473
2526
|
const t = r.extensions && r.extensions[A.KHR_DRACO_MESH_COMPRESSION];
|
|
2474
|
-
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)
|
|
2475
2528
|
for (let s = 0, n = r.targets.length; s < n; s++)
|
|
2476
|
-
e += ":" +
|
|
2529
|
+
e += ":" + Tt(r.targets[s]);
|
|
2477
2530
|
return e;
|
|
2478
2531
|
}
|
|
2479
|
-
function
|
|
2532
|
+
function Tt(r) {
|
|
2480
2533
|
let e = "";
|
|
2481
2534
|
const t = Object.keys(r).sort();
|
|
2482
2535
|
for (let s = 0, n = t.length; s < n; s++)
|
|
2483
2536
|
e += t[s] + ":" + r[t[s]] + ";";
|
|
2484
2537
|
return e;
|
|
2485
2538
|
}
|
|
2486
|
-
function
|
|
2539
|
+
function Lt(r) {
|
|
2487
2540
|
switch (r) {
|
|
2488
2541
|
case Int8Array:
|
|
2489
2542
|
return 1 / 127;
|
|
@@ -2497,13 +2550,13 @@ function xt(r) {
|
|
|
2497
2550
|
throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
|
|
2498
2551
|
}
|
|
2499
2552
|
}
|
|
2500
|
-
function
|
|
2553
|
+
function Ki(r) {
|
|
2501
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";
|
|
2502
2555
|
}
|
|
2503
|
-
const
|
|
2504
|
-
class
|
|
2556
|
+
const Vi = new Pe();
|
|
2557
|
+
class Zi {
|
|
2505
2558
|
constructor(e = {}, t = {}) {
|
|
2506
|
-
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 = {};
|
|
2507
2560
|
let s = !1, n = -1, i = !1, o = -1;
|
|
2508
2561
|
if (typeof navigator < "u" && typeof navigator.userAgent < "u") {
|
|
2509
2562
|
const a = navigator.userAgent;
|
|
@@ -2511,7 +2564,7 @@ class Ui {
|
|
|
2511
2564
|
const l = a.match(/Version\/(\d+)/);
|
|
2512
2565
|
n = s && l ? parseInt(l[1], 10) : -1, i = a.indexOf("Firefox") > -1, o = i ? a.match(/Firefox\/([0-9]+)\./)[1] : -1;
|
|
2513
2566
|
}
|
|
2514
|
-
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);
|
|
2515
2568
|
}
|
|
2516
2569
|
setExtensions(e) {
|
|
2517
2570
|
this.extensions = e;
|
|
@@ -2541,7 +2594,7 @@ class Ui {
|
|
|
2541
2594
|
parser: s,
|
|
2542
2595
|
userData: {}
|
|
2543
2596
|
};
|
|
2544
|
-
return
|
|
2597
|
+
return _e(i, a, n), se(a, n), Promise.all(s._invokeAll(function(l) {
|
|
2545
2598
|
return l.afterRoot && l.afterRoot(a);
|
|
2546
2599
|
})).then(function() {
|
|
2547
2600
|
for (const l of a.scenes)
|
|
@@ -2597,8 +2650,8 @@ class Ui {
|
|
|
2597
2650
|
const n = s.clone(), i = (o, a) => {
|
|
2598
2651
|
const l = this.associations.get(o);
|
|
2599
2652
|
l != null && this.associations.set(a, l);
|
|
2600
|
-
for (const [
|
|
2601
|
-
i(u, a.children[
|
|
2653
|
+
for (const [c, u] of o.children.entries())
|
|
2654
|
+
i(u, a.children[c]);
|
|
2602
2655
|
};
|
|
2603
2656
|
return i(s, n), n.name += "_instance_" + e.uses[t]++, n;
|
|
2604
2657
|
}
|
|
@@ -2722,7 +2775,7 @@ class Ui {
|
|
|
2722
2775
|
return Promise.resolve(this.extensions[A.KHR_BINARY_GLTF].body);
|
|
2723
2776
|
const n = this.options;
|
|
2724
2777
|
return new Promise(function(i, o) {
|
|
2725
|
-
s.load(
|
|
2778
|
+
s.load(Ue.resolveURL(t.uri, n.path), i, void 0, function() {
|
|
2726
2779
|
o(new Error('THREE.GLTFLoader: Failed to load buffer "' + t.uri + '".'));
|
|
2727
2780
|
});
|
|
2728
2781
|
});
|
|
@@ -2751,27 +2804,27 @@ class Ui {
|
|
|
2751
2804
|
loadAccessor(e) {
|
|
2752
2805
|
const t = this, s = this.json, n = this.json.accessors[e];
|
|
2753
2806
|
if (n.bufferView === void 0 && n.sparse === void 0) {
|
|
2754
|
-
const o =
|
|
2755
|
-
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));
|
|
2756
2809
|
}
|
|
2757
2810
|
const i = [];
|
|
2758
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) {
|
|
2759
|
-
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;
|
|
2760
2813
|
let f, y;
|
|
2761
|
-
if (m && m !==
|
|
2762
|
-
const
|
|
2763
|
-
let
|
|
2764
|
-
|
|
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);
|
|
2765
2818
|
} else
|
|
2766
|
-
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);
|
|
2767
2820
|
if (n.sparse !== void 0) {
|
|
2768
|
-
const
|
|
2769
|
-
a !== null && (y = new
|
|
2770
|
-
for (let I = 0,
|
|
2771
|
-
const
|
|
2772
|
-
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.");
|
|
2773
2826
|
}
|
|
2774
|
-
y.normalized =
|
|
2827
|
+
y.normalized = w;
|
|
2775
2828
|
}
|
|
2776
2829
|
return y;
|
|
2777
2830
|
});
|
|
@@ -2796,41 +2849,41 @@ class Ui {
|
|
|
2796
2849
|
const n = this, i = this.json, o = i.textures[e], a = i.images[t], l = (a.uri || a.bufferView) + ":" + o.sampler;
|
|
2797
2850
|
if (this.textureCache[l])
|
|
2798
2851
|
return this.textureCache[l];
|
|
2799
|
-
const
|
|
2852
|
+
const c = this.loadImageSource(t, s).then(function(u) {
|
|
2800
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);
|
|
2801
|
-
const
|
|
2802
|
-
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;
|
|
2803
2856
|
}).catch(function() {
|
|
2804
2857
|
return null;
|
|
2805
2858
|
});
|
|
2806
|
-
return this.textureCache[l] =
|
|
2859
|
+
return this.textureCache[l] = c, c;
|
|
2807
2860
|
}
|
|
2808
2861
|
loadImageSource(e, t) {
|
|
2809
2862
|
const s = this, n = this.json, i = this.options;
|
|
2810
2863
|
if (this.sourceCache[e] !== void 0)
|
|
2811
|
-
return this.sourceCache[e].then((
|
|
2864
|
+
return this.sourceCache[e].then((h) => h.clone());
|
|
2812
2865
|
const o = n.images[e], a = self.URL || self.webkitURL;
|
|
2813
|
-
let l = o.uri || "",
|
|
2866
|
+
let l = o.uri || "", c = !1;
|
|
2814
2867
|
if (o.bufferView !== void 0)
|
|
2815
|
-
l = s.getDependency("bufferView", o.bufferView).then(function(
|
|
2816
|
-
|
|
2817
|
-
const
|
|
2818
|
-
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;
|
|
2819
2872
|
});
|
|
2820
2873
|
else if (o.uri === void 0)
|
|
2821
2874
|
throw new Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView");
|
|
2822
|
-
const u = Promise.resolve(l).then(function(
|
|
2823
|
-
return new Promise(function(
|
|
2824
|
-
let
|
|
2825
|
-
t.isImageBitmapLoader === !0 && (
|
|
2826
|
-
const y = new
|
|
2827
|
-
y.needsUpdate = !0,
|
|
2828
|
-
}), t.load(
|
|
2875
|
+
const u = Promise.resolve(l).then(function(h) {
|
|
2876
|
+
return new Promise(function(d, m) {
|
|
2877
|
+
let w = d;
|
|
2878
|
+
t.isImageBitmapLoader === !0 && (w = function(f) {
|
|
2879
|
+
const y = new Ht(f);
|
|
2880
|
+
y.needsUpdate = !0, d(y);
|
|
2881
|
+
}), t.load(Ue.resolveURL(h, i.path), w, void 0, m);
|
|
2829
2882
|
});
|
|
2830
|
-
}).then(function(
|
|
2831
|
-
return
|
|
2832
|
-
}).catch(function(
|
|
2833
|
-
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;
|
|
2834
2887
|
});
|
|
2835
2888
|
return this.sourceCache[e] = u, u;
|
|
2836
2889
|
}
|
|
@@ -2875,11 +2928,11 @@ class Ui {
|
|
|
2875
2928
|
if (e.isPoints) {
|
|
2876
2929
|
const a = "PointsMaterial:" + s.uuid;
|
|
2877
2930
|
let l = this.cache.get(a);
|
|
2878
|
-
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;
|
|
2879
2932
|
} else if (e.isLine) {
|
|
2880
2933
|
const a = "LineBasicMaterial:" + s.uuid;
|
|
2881
2934
|
let l = this.cache.get(a);
|
|
2882
|
-
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;
|
|
2883
2936
|
}
|
|
2884
2937
|
if (n || i || o) {
|
|
2885
2938
|
let a = "ClonedMaterial:" + s.uuid + ":";
|
|
@@ -2890,7 +2943,7 @@ class Ui {
|
|
|
2890
2943
|
e.material = s;
|
|
2891
2944
|
}
|
|
2892
2945
|
getMaterialType() {
|
|
2893
|
-
return
|
|
2946
|
+
return wn;
|
|
2894
2947
|
}
|
|
2895
2948
|
/**
|
|
2896
2949
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
|
|
@@ -2902,35 +2955,35 @@ class Ui {
|
|
|
2902
2955
|
loadMaterial(e) {
|
|
2903
2956
|
const t = this, s = this.json, n = this.extensions, i = s.materials[e];
|
|
2904
2957
|
let o;
|
|
2905
|
-
const a = {}, l = i.extensions || {},
|
|
2958
|
+
const a = {}, l = i.extensions || {}, c = [];
|
|
2906
2959
|
if (l[A.KHR_MATERIALS_UNLIT]) {
|
|
2907
|
-
const
|
|
2908
|
-
o =
|
|
2960
|
+
const h = n[A.KHR_MATERIALS_UNLIT];
|
|
2961
|
+
o = h.getMaterialType(), c.push(h.extendParams(a, i, t));
|
|
2909
2962
|
} else {
|
|
2910
|
-
const
|
|
2911
|
-
if (a.color = new
|
|
2912
|
-
const
|
|
2913
|
-
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];
|
|
2914
2967
|
}
|
|
2915
|
-
|
|
2916
|
-
return
|
|
2917
|
-
}),
|
|
2918
|
-
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);
|
|
2919
2972
|
})));
|
|
2920
2973
|
}
|
|
2921
|
-
i.doubleSided === !0 && (a.side =
|
|
2922
|
-
const u = i.alphaMode ||
|
|
2923
|
-
if (u ===
|
|
2924
|
-
const
|
|
2925
|
-
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);
|
|
2926
2979
|
}
|
|
2927
|
-
if (i.occlusionTexture !== void 0 && o !==
|
|
2928
|
-
const
|
|
2929
|
-
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);
|
|
2930
2983
|
}
|
|
2931
|
-
return i.emissiveTexture !== void 0 && o !==
|
|
2932
|
-
const
|
|
2933
|
-
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;
|
|
2934
2987
|
});
|
|
2935
2988
|
}
|
|
2936
2989
|
/**
|
|
@@ -2941,7 +2994,7 @@ class Ui {
|
|
|
2941
2994
|
* @return {string}
|
|
2942
2995
|
*/
|
|
2943
2996
|
createUniqueName(e) {
|
|
2944
|
-
const t =
|
|
2997
|
+
const t = is.sanitizeNodeName(e || "");
|
|
2945
2998
|
return t in this.nodeNamesUsed ? t + "_" + ++this.nodeNamesUsed[t] : (this.nodeNamesUsed[t] = 0, t);
|
|
2946
2999
|
}
|
|
2947
3000
|
/**
|
|
@@ -2957,17 +3010,17 @@ class Ui {
|
|
|
2957
3010
|
const t = this, s = this.extensions, n = this.primitiveCache;
|
|
2958
3011
|
function i(a) {
|
|
2959
3012
|
return s[A.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, t).then(function(l) {
|
|
2960
|
-
return
|
|
3013
|
+
return an(l, a, t);
|
|
2961
3014
|
});
|
|
2962
3015
|
}
|
|
2963
3016
|
const o = [];
|
|
2964
3017
|
for (let a = 0, l = e.length; a < l; a++) {
|
|
2965
|
-
const
|
|
2966
|
-
if (
|
|
2967
|
-
o.push(
|
|
3018
|
+
const c = e[a], u = Yi(c), h = n[u];
|
|
3019
|
+
if (h)
|
|
3020
|
+
o.push(h.promise);
|
|
2968
3021
|
else {
|
|
2969
|
-
let
|
|
2970
|
-
|
|
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);
|
|
2971
3024
|
}
|
|
2972
3025
|
}
|
|
2973
3026
|
return Promise.all(o);
|
|
@@ -2981,42 +3034,42 @@ class Ui {
|
|
|
2981
3034
|
*/
|
|
2982
3035
|
loadMesh(e) {
|
|
2983
3036
|
const t = this, s = this.json, n = this.extensions, i = s.meshes[e], o = i.primitives, a = [];
|
|
2984
|
-
for (let l = 0,
|
|
2985
|
-
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);
|
|
2986
3039
|
a.push(u);
|
|
2987
3040
|
}
|
|
2988
3041
|
return a.push(t.loadGeometries(o)), Promise.all(a).then(function(l) {
|
|
2989
|
-
const
|
|
2990
|
-
for (let m = 0,
|
|
3042
|
+
const c = l.slice(0, l.length - 1), u = l[l.length - 1], h = [];
|
|
3043
|
+
for (let m = 0, w = u.length; m < w; m++) {
|
|
2991
3044
|
const f = u[m], y = o[m];
|
|
2992
|
-
let
|
|
2993
|
-
const
|
|
2994
|
-
if (y.mode ===
|
|
2995
|
-
|
|
2996
|
-
else if (y.mode ===
|
|
2997
|
-
|
|
2998
|
-
else if (y.mode ===
|
|
2999
|
-
|
|
3000
|
-
else if (y.mode ===
|
|
3001
|
-
|
|
3002
|
-
else if (y.mode ===
|
|
3003
|
-
|
|
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);
|
|
3004
3057
|
else
|
|
3005
3058
|
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + y.mode);
|
|
3006
|
-
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);
|
|
3007
3060
|
}
|
|
3008
|
-
for (let m = 0,
|
|
3009
|
-
t.associations.set(
|
|
3061
|
+
for (let m = 0, w = h.length; m < w; m++)
|
|
3062
|
+
t.associations.set(h[m], {
|
|
3010
3063
|
meshes: e,
|
|
3011
3064
|
primitives: m
|
|
3012
3065
|
});
|
|
3013
|
-
if (
|
|
3014
|
-
return i.extensions &&
|
|
3015
|
-
const
|
|
3016
|
-
i.extensions &&
|
|
3017
|
-
for (let m = 0,
|
|
3018
|
-
|
|
3019
|
-
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;
|
|
3020
3073
|
});
|
|
3021
3074
|
}
|
|
3022
3075
|
/**
|
|
@@ -3033,7 +3086,7 @@ class Ui {
|
|
|
3033
3086
|
console.warn("THREE.GLTFLoader: Missing camera parameters.");
|
|
3034
3087
|
return;
|
|
3035
3088
|
}
|
|
3036
|
-
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);
|
|
3037
3090
|
}
|
|
3038
3091
|
/**
|
|
3039
3092
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
|
|
@@ -3048,16 +3101,16 @@ class Ui {
|
|
|
3048
3101
|
s.push(this._loadNodeShallow(t.joints[n]));
|
|
3049
3102
|
return t.inverseBindMatrices !== void 0 ? s.push(this.getDependency("accessor", t.inverseBindMatrices)) : s.push(null), Promise.all(s).then(function(n) {
|
|
3050
3103
|
const i = n.pop(), o = n, a = [], l = [];
|
|
3051
|
-
for (let
|
|
3052
|
-
const
|
|
3053
|
-
if (
|
|
3054
|
-
a.push(
|
|
3055
|
-
const
|
|
3056
|
-
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);
|
|
3057
3110
|
} else
|
|
3058
|
-
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]);
|
|
3059
3112
|
}
|
|
3060
|
-
return new
|
|
3113
|
+
return new cs(a, l);
|
|
3061
3114
|
});
|
|
3062
3115
|
}
|
|
3063
3116
|
/**
|
|
@@ -3068,30 +3121,30 @@ class Ui {
|
|
|
3068
3121
|
* @return {Promise<AnimationClip>}
|
|
3069
3122
|
*/
|
|
3070
3123
|
loadAnimation(e) {
|
|
3071
|
-
const t = this.json, s = this, n = t.animations[e], i = n.name ? n.name : "animation_" + e, o = [], a = [], l = [],
|
|
3072
|
-
for (let
|
|
3073
|
-
const m = n.channels[
|
|
3074
|
-
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));
|
|
3075
3128
|
}
|
|
3076
3129
|
return Promise.all([
|
|
3077
3130
|
Promise.all(o),
|
|
3078
3131
|
Promise.all(a),
|
|
3079
3132
|
Promise.all(l),
|
|
3080
|
-
Promise.all(
|
|
3133
|
+
Promise.all(c),
|
|
3081
3134
|
Promise.all(u)
|
|
3082
|
-
]).then(function(
|
|
3083
|
-
const
|
|
3084
|
-
for (let
|
|
3085
|
-
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];
|
|
3086
3139
|
if (R === void 0) continue;
|
|
3087
3140
|
R.updateMatrix && R.updateMatrix();
|
|
3088
|
-
const
|
|
3089
|
-
if (
|
|
3090
|
-
for (let
|
|
3091
|
-
|
|
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]);
|
|
3092
3145
|
}
|
|
3093
|
-
const
|
|
3094
|
-
return
|
|
3146
|
+
const b = new hs(i, void 0, p);
|
|
3147
|
+
return se(b, n), b;
|
|
3095
3148
|
});
|
|
3096
3149
|
}
|
|
3097
3150
|
createNodeMesh(e) {
|
|
@@ -3100,7 +3153,7 @@ class Ui {
|
|
|
3100
3153
|
const o = s._getNodeRef(s.meshCache, n.mesh, i);
|
|
3101
3154
|
return n.weights !== void 0 && o.traverse(function(a) {
|
|
3102
3155
|
if (a.isMesh)
|
|
3103
|
-
for (let l = 0,
|
|
3156
|
+
for (let l = 0, c = n.weights.length; l < c; l++)
|
|
3104
3157
|
a.morphTargetInfluences[l] = n.weights[l];
|
|
3105
3158
|
}), o;
|
|
3106
3159
|
});
|
|
@@ -3114,23 +3167,23 @@ class Ui {
|
|
|
3114
3167
|
*/
|
|
3115
3168
|
loadNode(e) {
|
|
3116
3169
|
const t = this.json, s = this, n = t.nodes[e], i = s._loadNodeShallow(e), o = [], a = n.children || [];
|
|
3117
|
-
for (let
|
|
3118
|
-
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]));
|
|
3119
3172
|
const l = n.skin === void 0 ? Promise.resolve(null) : s.getDependency("skin", n.skin);
|
|
3120
3173
|
return Promise.all([
|
|
3121
3174
|
i,
|
|
3122
3175
|
Promise.all(o),
|
|
3123
3176
|
l
|
|
3124
|
-
]).then(function(
|
|
3125
|
-
const u =
|
|
3126
|
-
|
|
3127
|
-
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);
|
|
3128
3181
|
});
|
|
3129
|
-
for (let m = 0,
|
|
3130
|
-
u.add(
|
|
3131
|
-
if (u.userData.pivot !== void 0 &&
|
|
3132
|
-
const m = u.userData.pivot,
|
|
3133
|
-
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;
|
|
3134
3187
|
}
|
|
3135
3188
|
return u;
|
|
3136
3189
|
});
|
|
@@ -3141,30 +3194,30 @@ class Ui {
|
|
|
3141
3194
|
const t = this.json, s = this.extensions, n = this;
|
|
3142
3195
|
if (this.nodeCache[e] !== void 0)
|
|
3143
3196
|
return this.nodeCache[e];
|
|
3144
|
-
const i = t.nodes[e], o = i.name ? n.createUniqueName(i.name) : "", a = [], l = n._invokeOne(function(
|
|
3145
|
-
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);
|
|
3146
3199
|
});
|
|
3147
|
-
return l && a.push(l), i.camera !== void 0 && a.push(n.getDependency("camera", i.camera).then(function(
|
|
3148
|
-
return n._getNodeRef(n.cameraCache, i.camera,
|
|
3149
|
-
})), n._invokeAll(function(
|
|
3150
|
-
return
|
|
3151
|
-
}).forEach(function(
|
|
3152
|
-
a.push(
|
|
3153
|
-
}), 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) {
|
|
3154
3207
|
let u;
|
|
3155
|
-
if (i.isBone === !0 ? u = new
|
|
3156
|
-
for (let
|
|
3157
|
-
u.add(h
|
|
3158
|
-
if (i.name && (u.userData.name = i.name, u.name = o),
|
|
3159
|
-
const
|
|
3160
|
-
|
|
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);
|
|
3161
3214
|
} else
|
|
3162
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);
|
|
3163
3216
|
if (!n.associations.has(u))
|
|
3164
3217
|
n.associations.set(u, {});
|
|
3165
3218
|
else if (i.mesh !== void 0 && n.meshCache.refs[i.mesh] > 1) {
|
|
3166
|
-
const
|
|
3167
|
-
n.associations.set(u, { ...
|
|
3219
|
+
const h = n.associations.get(u);
|
|
3220
|
+
n.associations.set(u, { ...h });
|
|
3168
3221
|
}
|
|
3169
3222
|
return n.associations.get(u).nodes = e, u;
|
|
3170
3223
|
}), this.nodeCache[e];
|
|
@@ -3177,66 +3230,66 @@ class Ui {
|
|
|
3177
3230
|
* @return {Promise<Group>}
|
|
3178
3231
|
*/
|
|
3179
3232
|
loadScene(e) {
|
|
3180
|
-
const t = this.extensions, s = this.json.scenes[e], n = this, i = new
|
|
3181
|
-
s.name && (i.name = n.createUniqueName(s.name)),
|
|
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);
|
|
3182
3235
|
const o = s.nodes || [], a = [];
|
|
3183
|
-
for (let l = 0,
|
|
3236
|
+
for (let l = 0, c = o.length; l < c; l++)
|
|
3184
3237
|
a.push(n.getDependency("node", o[l]));
|
|
3185
3238
|
return Promise.all(a).then(function(l) {
|
|
3186
|
-
for (let u = 0,
|
|
3187
|
-
const
|
|
3188
|
-
|
|
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);
|
|
3189
3242
|
}
|
|
3190
|
-
const
|
|
3191
|
-
const
|
|
3192
|
-
for (const [
|
|
3193
|
-
(
|
|
3194
|
-
return u.traverse((
|
|
3195
|
-
const m = n.associations.get(
|
|
3196
|
-
m != null &&
|
|
3197
|
-
}),
|
|
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;
|
|
3198
3251
|
};
|
|
3199
|
-
return n.associations =
|
|
3252
|
+
return n.associations = c(i), i;
|
|
3200
3253
|
});
|
|
3201
3254
|
}
|
|
3202
3255
|
_createAnimationTracks(e, t, s, n, i) {
|
|
3203
3256
|
const o = [], a = e.name ? e.name : e.uuid, l = [];
|
|
3204
|
-
function
|
|
3257
|
+
function c(m) {
|
|
3205
3258
|
m.morphTargetInfluences && l.push(m.name ? m.name : m.uuid);
|
|
3206
3259
|
}
|
|
3207
|
-
|
|
3260
|
+
de[i.path] === de.weights ? (c(e), e.isGroup && e.children.forEach(c)) : l.push(a);
|
|
3208
3261
|
let u;
|
|
3209
|
-
switch (
|
|
3210
|
-
case
|
|
3211
|
-
u =
|
|
3262
|
+
switch (de[i.path]) {
|
|
3263
|
+
case de.weights:
|
|
3264
|
+
u = Ut;
|
|
3212
3265
|
break;
|
|
3213
|
-
case
|
|
3214
|
-
u =
|
|
3266
|
+
case de.rotation:
|
|
3267
|
+
u = zt;
|
|
3215
3268
|
break;
|
|
3216
|
-
case
|
|
3217
|
-
case
|
|
3218
|
-
u =
|
|
3269
|
+
case de.translation:
|
|
3270
|
+
case de.scale:
|
|
3271
|
+
u = Ft;
|
|
3219
3272
|
break;
|
|
3220
3273
|
default:
|
|
3221
3274
|
switch (s.itemSize) {
|
|
3222
3275
|
case 1:
|
|
3223
|
-
u =
|
|
3276
|
+
u = Ut;
|
|
3224
3277
|
break;
|
|
3225
3278
|
case 2:
|
|
3226
3279
|
case 3:
|
|
3227
3280
|
default:
|
|
3228
|
-
u =
|
|
3281
|
+
u = Ft;
|
|
3229
3282
|
break;
|
|
3230
3283
|
}
|
|
3231
3284
|
break;
|
|
3232
3285
|
}
|
|
3233
|
-
const
|
|
3234
|
-
for (let m = 0,
|
|
3286
|
+
const h = n.interpolation !== void 0 ? zi[n.interpolation] : Tn, d = this._getArrayFromAccessor(s);
|
|
3287
|
+
for (let m = 0, w = l.length; m < w; m++) {
|
|
3235
3288
|
const f = new u(
|
|
3236
|
-
l[m] + "." +
|
|
3289
|
+
l[m] + "." + de[i.path],
|
|
3237
3290
|
t.array,
|
|
3238
|
-
|
|
3239
|
-
|
|
3291
|
+
d,
|
|
3292
|
+
h
|
|
3240
3293
|
);
|
|
3241
3294
|
n.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(f), o.push(f);
|
|
3242
3295
|
}
|
|
@@ -3245,7 +3298,7 @@ class Ui {
|
|
|
3245
3298
|
_getArrayFromAccessor(e) {
|
|
3246
3299
|
let t = e.array;
|
|
3247
3300
|
if (e.normalized) {
|
|
3248
|
-
const s =
|
|
3301
|
+
const s = Lt(t.constructor), n = new Float32Array(t.length);
|
|
3249
3302
|
for (let i = 0, o = t.length; i < o; i++)
|
|
3250
3303
|
n[i] = t[i] * s;
|
|
3251
3304
|
t = n;
|
|
@@ -3254,21 +3307,21 @@ class Ui {
|
|
|
3254
3307
|
}
|
|
3255
3308
|
_createCubicSplineTrackInterpolant(e) {
|
|
3256
3309
|
e.createInterpolant = function(s) {
|
|
3257
|
-
const n = this instanceof
|
|
3310
|
+
const n = this instanceof zt ? Ui : An;
|
|
3258
3311
|
return new n(this.times, this.values, this.getValueSize() / 3, s);
|
|
3259
3312
|
}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
|
|
3260
3313
|
}
|
|
3261
3314
|
}
|
|
3262
|
-
function
|
|
3263
|
-
const s = e.attributes, n = new
|
|
3315
|
+
function Wi(r, e, t) {
|
|
3316
|
+
const s = e.attributes, n = new ms();
|
|
3264
3317
|
if (s.POSITION !== void 0) {
|
|
3265
|
-
const a = t.json.accessors[s.POSITION], l = a.min,
|
|
3266
|
-
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) {
|
|
3267
3320
|
if (n.set(
|
|
3268
|
-
new
|
|
3269
|
-
new
|
|
3321
|
+
new S(l[0], l[1], l[2]),
|
|
3322
|
+
new S(c[0], c[1], c[2])
|
|
3270
3323
|
), a.normalized) {
|
|
3271
|
-
const u =
|
|
3324
|
+
const u = Lt(Ae[a.componentType]);
|
|
3272
3325
|
n.min.multiplyScalar(u), n.max.multiplyScalar(u);
|
|
3273
3326
|
}
|
|
3274
3327
|
} else {
|
|
@@ -3279,14 +3332,14 @@ function zi(r, e, t) {
|
|
|
3279
3332
|
return;
|
|
3280
3333
|
const i = e.targets;
|
|
3281
3334
|
if (i !== void 0) {
|
|
3282
|
-
const a = new
|
|
3283
|
-
for (let
|
|
3284
|
-
const
|
|
3285
|
-
if (
|
|
3286
|
-
const
|
|
3287
|
-
if (m !== void 0 &&
|
|
3288
|
-
if (l.setX(Math.max(Math.abs(m[0]), Math.abs(
|
|
3289
|
-
const f =
|
|
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;
|
|
3340
|
+
if (m !== void 0 && w !== void 0) {
|
|
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]);
|
|
3290
3343
|
l.multiplyScalar(f);
|
|
3291
3344
|
}
|
|
3292
3345
|
a.max(l);
|
|
@@ -3297,10 +3350,10 @@ function zi(r, e, t) {
|
|
|
3297
3350
|
n.expandByVector(a);
|
|
3298
3351
|
}
|
|
3299
3352
|
r.boundingBox = n;
|
|
3300
|
-
const o = new
|
|
3353
|
+
const o = new gs();
|
|
3301
3354
|
n.getCenter(o.center), o.radius = n.min.distanceTo(n.max) / 2, r.boundingSphere = o;
|
|
3302
3355
|
}
|
|
3303
|
-
function
|
|
3356
|
+
function an(r, e, t) {
|
|
3304
3357
|
const s = e.attributes, n = [];
|
|
3305
3358
|
function i(o, a) {
|
|
3306
3359
|
return t.getDependency("accessor", o).then(function(l) {
|
|
@@ -3308,7 +3361,7 @@ function tn(r, e, t) {
|
|
|
3308
3361
|
});
|
|
3309
3362
|
}
|
|
3310
3363
|
for (const o in s) {
|
|
3311
|
-
const a =
|
|
3364
|
+
const a = Pt[o] || o.toLowerCase();
|
|
3312
3365
|
a in r.attributes || n.push(i(s[o], a));
|
|
3313
3366
|
}
|
|
3314
3367
|
if (e.indices !== void 0 && !r.index) {
|
|
@@ -3317,26 +3370,335 @@ function tn(r, e, t) {
|
|
|
3317
3370
|
});
|
|
3318
3371
|
n.push(o);
|
|
3319
3372
|
}
|
|
3320
|
-
return
|
|
3321
|
-
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;
|
|
3322
3375
|
});
|
|
3323
3376
|
}
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
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
|
+
}
|
|
3568
|
+
}
|
|
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;
|
|
3327
3676
|
}
|
|
3328
|
-
function
|
|
3329
|
-
const r = new
|
|
3330
|
-
return t.position.y = 0.6, t.userData.isMovable = !0, t.name = "球体",
|
|
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;
|
|
3331
3680
|
}
|
|
3332
|
-
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) {
|
|
3333
3688
|
return new Promise((e, t) => {
|
|
3334
3689
|
var o;
|
|
3335
3690
|
const s = (o = r.name.split(".").pop()) == null ? void 0 : o.toLowerCase(), n = URL.createObjectURL(r);
|
|
3336
3691
|
let i;
|
|
3337
|
-
if (s === "obj")
|
|
3338
|
-
|
|
3339
|
-
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 {
|
|
3340
3702
|
t(new Error("不支持的文件格式,请使用 .obj, .gltf, .glb"));
|
|
3341
3703
|
return;
|
|
3342
3704
|
}
|
|
@@ -3344,35 +3706,38 @@ function Yi(r) {
|
|
|
3344
3706
|
n,
|
|
3345
3707
|
(a) => {
|
|
3346
3708
|
const l = s === "gltf" || s === "glb" ? a.scene : a;
|
|
3347
|
-
l.traverse((
|
|
3348
|
-
var
|
|
3349
|
-
|
|
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());
|
|
3350
3712
|
});
|
|
3351
|
-
const u = new
|
|
3352
|
-
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);
|
|
3353
3715
|
},
|
|
3354
3716
|
void 0,
|
|
3355
3717
|
(a) => t(a)
|
|
3356
3718
|
);
|
|
3357
3719
|
});
|
|
3358
3720
|
}
|
|
3359
|
-
function
|
|
3721
|
+
function no(r) {
|
|
3360
3722
|
switch (r) {
|
|
3361
3723
|
case "box":
|
|
3362
|
-
|
|
3724
|
+
$i();
|
|
3363
3725
|
break;
|
|
3364
3726
|
case "sphere":
|
|
3365
|
-
|
|
3727
|
+
Ji();
|
|
3728
|
+
break;
|
|
3729
|
+
case "directionalLight":
|
|
3730
|
+
eo();
|
|
3366
3731
|
break;
|
|
3367
3732
|
}
|
|
3368
3733
|
}
|
|
3369
|
-
const
|
|
3734
|
+
const so = {
|
|
3370
3735
|
key: 1,
|
|
3371
3736
|
class: "toggle-placeholder"
|
|
3372
|
-
},
|
|
3737
|
+
}, io = { class: "tree-icon" }, oo = { class: "tree-name" }, ro = {
|
|
3373
3738
|
key: 0,
|
|
3374
3739
|
class: "tree-children"
|
|
3375
|
-
},
|
|
3740
|
+
}, ao = /* @__PURE__ */ Ze({
|
|
3376
3741
|
__name: "TreeItem",
|
|
3377
3742
|
props: {
|
|
3378
3743
|
node: {},
|
|
@@ -3381,15 +3746,15 @@ const Ki = {
|
|
|
3381
3746
|
},
|
|
3382
3747
|
emits: ["select", "delete"],
|
|
3383
3748
|
setup(r, { emit: e }) {
|
|
3384
|
-
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(
|
|
3385
3750
|
(f) => f.userData.isMovable === !0
|
|
3386
|
-
))), u =
|
|
3751
|
+
))), u = et(
|
|
3387
3752
|
() => {
|
|
3388
3753
|
var f;
|
|
3389
3754
|
return ((f = t.selectedObject) == null ? void 0 : f.uuid) === t.node.uuid;
|
|
3390
3755
|
}
|
|
3391
3756
|
);
|
|
3392
|
-
|
|
3757
|
+
Ln(
|
|
3393
3758
|
() => {
|
|
3394
3759
|
u.value && n.value && n.value.scrollIntoView({
|
|
3395
3760
|
block: "nearest",
|
|
@@ -3400,55 +3765,55 @@ const Ki = {
|
|
|
3400
3765
|
},
|
|
3401
3766
|
{ flush: "post" }
|
|
3402
3767
|
);
|
|
3403
|
-
const
|
|
3768
|
+
const h = (f) => {
|
|
3404
3769
|
f.stopPropagation(), s("select", t.node);
|
|
3405
|
-
},
|
|
3770
|
+
}, d = (f) => {
|
|
3406
3771
|
f.stopPropagation(), s("delete", t.node);
|
|
3407
|
-
}, m = (f) => f.type === "Mesh" || f.type === "Sprite" ? "🟦" : f.type === "Light" ? "💡" : "📦",
|
|
3772
|
+
}, m = (f) => f.type === "Mesh" || f.type === "Sprite" ? "🟦" : f.type === "Light" ? "💡" : "📦", w = (f) => f.name || `${f.type} (${f.id})`;
|
|
3408
3773
|
return (f, y) => {
|
|
3409
|
-
const
|
|
3410
|
-
return
|
|
3774
|
+
const p = In("TreeItem", !0);
|
|
3775
|
+
return k(), z("div", {
|
|
3411
3776
|
class: "tree-node",
|
|
3412
3777
|
ref_key: "nodeRef",
|
|
3413
3778
|
ref: n
|
|
3414
3779
|
}, [
|
|
3415
3780
|
g("div", {
|
|
3416
|
-
class:
|
|
3417
|
-
onClick:
|
|
3781
|
+
class: Be(["tree-item", { selected: u.value }]),
|
|
3782
|
+
onClick: h
|
|
3418
3783
|
}, [
|
|
3419
|
-
l.value ? (
|
|
3784
|
+
l.value ? (k(), z("span", {
|
|
3420
3785
|
key: 0,
|
|
3421
3786
|
class: "toggle-icon",
|
|
3422
|
-
onClick: y[0] || (y[0] =
|
|
3423
|
-
},
|
|
3424
|
-
g("span",
|
|
3425
|
-
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),
|
|
3426
3791
|
g("button", {
|
|
3427
3792
|
class: "tree-delete",
|
|
3428
|
-
onClick:
|
|
3793
|
+
onClick: Nt(d, ["stop"])
|
|
3429
3794
|
}, "×")
|
|
3430
3795
|
], 2),
|
|
3431
|
-
a.value && l.value ? (
|
|
3432
|
-
(
|
|
3433
|
-
key:
|
|
3434
|
-
node:
|
|
3796
|
+
a.value && l.value ? (k(), z("div", ro, [
|
|
3797
|
+
(k(!0), z(ln, null, cn(c.value, (b) => (k(), je(p, {
|
|
3798
|
+
key: b.uuid,
|
|
3799
|
+
node: b,
|
|
3435
3800
|
"selected-object": r.selectedObject,
|
|
3436
3801
|
version: r.version,
|
|
3437
|
-
onSelect: y[1] || (y[1] = (
|
|
3438
|
-
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))
|
|
3439
3804
|
}, null, 8, ["node", "selected-object", "version"]))), 128))
|
|
3440
|
-
])) :
|
|
3805
|
+
])) : le("", !0)
|
|
3441
3806
|
], 512);
|
|
3442
3807
|
};
|
|
3443
3808
|
}
|
|
3444
|
-
}),
|
|
3809
|
+
}), We = (r, e) => {
|
|
3445
3810
|
const t = r.__vccOpts || r;
|
|
3446
3811
|
for (const [s, n] of e)
|
|
3447
3812
|
t[s] = n;
|
|
3448
3813
|
return t;
|
|
3449
|
-
},
|
|
3450
|
-
function
|
|
3451
|
-
const e =
|
|
3814
|
+
}, lo = /* @__PURE__ */ We(ao, [["__scopeId", "data-v-5ad9c842"]]);
|
|
3815
|
+
function co(r) {
|
|
3816
|
+
const e = U(/* @__PURE__ */ new Set()), t = (n) => {
|
|
3452
3817
|
const i = new Set(e.value);
|
|
3453
3818
|
i.has(n) ? i.delete(n) : i.add(n), e.value = i;
|
|
3454
3819
|
}, s = (n) => {
|
|
@@ -3459,7 +3824,7 @@ function $i(r) {
|
|
|
3459
3824
|
i.add(o.uuid), o = o.parent;
|
|
3460
3825
|
e.value = i;
|
|
3461
3826
|
};
|
|
3462
|
-
return
|
|
3827
|
+
return hn(
|
|
3463
3828
|
r,
|
|
3464
3829
|
(n) => {
|
|
3465
3830
|
n && s(n);
|
|
@@ -3467,28 +3832,28 @@ function $i(r) {
|
|
|
3467
3832
|
{ immediate: !0 }
|
|
3468
3833
|
), { expandedSet: e, toggleExpand: t };
|
|
3469
3834
|
}
|
|
3470
|
-
const
|
|
3835
|
+
const ho = {
|
|
3471
3836
|
key: 0,
|
|
3472
3837
|
class: "property-panel"
|
|
3473
|
-
},
|
|
3838
|
+
}, uo = { class: "property-group tree-group" }, po = { class: "tree-container" }, fo = {
|
|
3474
3839
|
key: 0,
|
|
3475
3840
|
class: "tree-empty"
|
|
3476
|
-
},
|
|
3841
|
+
}, mo = {
|
|
3477
3842
|
key: 0,
|
|
3478
3843
|
class: "tabs"
|
|
3479
|
-
},
|
|
3844
|
+
}, go = {
|
|
3480
3845
|
key: 1,
|
|
3481
3846
|
class: "tab-content"
|
|
3482
|
-
},
|
|
3847
|
+
}, yo = { class: "property-group" }, _o = { class: "row" }, bo = { class: "property-group" }, wo = { class: "row" }, To = { class: "property-group" }, xo = { class: "row" }, Eo = {
|
|
3483
3848
|
key: 0,
|
|
3484
3849
|
class: "property-group material-group"
|
|
3485
|
-
},
|
|
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 = {
|
|
3486
3851
|
key: 0,
|
|
3487
3852
|
class: "material-hint"
|
|
3488
|
-
},
|
|
3853
|
+
}, Io = {
|
|
3489
3854
|
key: 1,
|
|
3490
3855
|
class: "property-panel empty"
|
|
3491
|
-
},
|
|
3856
|
+
}, Co = /* @__PURE__ */ Ze({
|
|
3492
3857
|
__name: "PropertyPanel",
|
|
3493
3858
|
props: {
|
|
3494
3859
|
transform: {},
|
|
@@ -3497,24 +3862,24 @@ const Ji = {
|
|
|
3497
3862
|
},
|
|
3498
3863
|
emits: ["propertyChange", "treeSelect", "treeDelete"],
|
|
3499
3864
|
setup(r, { emit: e }) {
|
|
3500
|
-
const t = r, s = e, n = () => s("propertyChange"), i =
|
|
3501
|
-
|
|
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 });
|
|
3502
3867
|
const u = (y) => {
|
|
3503
3868
|
o.value++, s("treeDelete", y);
|
|
3504
|
-
},
|
|
3869
|
+
}, h = un({
|
|
3505
3870
|
metalness: 0,
|
|
3506
3871
|
roughness: 0.5,
|
|
3507
3872
|
opacity: 1
|
|
3508
|
-
}),
|
|
3873
|
+
}), d = U(!1);
|
|
3509
3874
|
function m(y) {
|
|
3510
|
-
let
|
|
3511
|
-
return y.traverse((
|
|
3512
|
-
if (
|
|
3513
|
-
const
|
|
3514
|
-
for (const R of
|
|
3875
|
+
let p = null;
|
|
3876
|
+
return y.traverse((b) => {
|
|
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)
|
|
3515
3880
|
if (R && (R.type === "MeshStandardMaterial" || R.type === "MeshPhongMaterial")) {
|
|
3516
3881
|
const v = R;
|
|
3517
|
-
|
|
3882
|
+
p = {
|
|
3518
3883
|
metalness: v.metalness ?? 0,
|
|
3519
3884
|
roughness: v.roughness ?? 0.5,
|
|
3520
3885
|
opacity: R.opacity ?? 1
|
|
@@ -3522,110 +3887,110 @@ const Ji = {
|
|
|
3522
3887
|
break;
|
|
3523
3888
|
}
|
|
3524
3889
|
}
|
|
3525
|
-
}),
|
|
3890
|
+
}), p;
|
|
3526
3891
|
}
|
|
3527
|
-
function
|
|
3528
|
-
let
|
|
3529
|
-
return y.traverse((
|
|
3530
|
-
if (
|
|
3531
|
-
const
|
|
3892
|
+
function w(y, p) {
|
|
3893
|
+
let b = !1;
|
|
3894
|
+
return y.traverse((T) => {
|
|
3895
|
+
if (T.type === "Mesh") {
|
|
3896
|
+
const M = T, R = Array.isArray(M.material) ? M.material : [M.material];
|
|
3532
3897
|
for (const v of R)
|
|
3533
|
-
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);
|
|
3534
3899
|
}
|
|
3535
|
-
}),
|
|
3900
|
+
}), b;
|
|
3536
3901
|
}
|
|
3537
3902
|
function f() {
|
|
3538
3903
|
if (t.selectedObject) {
|
|
3539
|
-
const y =
|
|
3540
|
-
metalness:
|
|
3541
|
-
roughness:
|
|
3542
|
-
opacity:
|
|
3904
|
+
const y = w(t.selectedObject, {
|
|
3905
|
+
metalness: h.metalness,
|
|
3906
|
+
roughness: h.roughness,
|
|
3907
|
+
opacity: h.opacity
|
|
3543
3908
|
});
|
|
3544
|
-
|
|
3909
|
+
d.value = y;
|
|
3545
3910
|
}
|
|
3546
3911
|
}
|
|
3547
|
-
return
|
|
3912
|
+
return hn(
|
|
3548
3913
|
() => t.selectedObject,
|
|
3549
3914
|
(y) => {
|
|
3550
3915
|
if (y) {
|
|
3551
|
-
const
|
|
3552
|
-
|
|
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);
|
|
3553
3918
|
} else
|
|
3554
|
-
|
|
3919
|
+
h.metalness = 0, h.roughness = 0.5, h.opacity = 1, d.value = !1;
|
|
3555
3920
|
},
|
|
3556
3921
|
{ immediate: !0 }
|
|
3557
|
-
), (y,
|
|
3558
|
-
|
|
3559
|
-
g("div",
|
|
3560
|
-
|
|
3561
|
-
g("div",
|
|
3562
|
-
(
|
|
3563
|
-
key:
|
|
3564
|
-
node:
|
|
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, {
|
|
3928
|
+
key: b.uuid,
|
|
3929
|
+
node: b,
|
|
3565
3930
|
"selected-object": r.selectedObject,
|
|
3566
3931
|
version: o.value,
|
|
3567
|
-
onSelect:
|
|
3932
|
+
onSelect: p[0] || (p[0] = (T) => s("treeSelect", T)),
|
|
3568
3933
|
onDelete: u
|
|
3569
3934
|
}, null, 8, ["node", "selected-object", "version"]))), 128)),
|
|
3570
|
-
r.treeData.length === 0 ? (
|
|
3935
|
+
r.treeData.length === 0 ? (k(), z("div", fo, "暂无物体")) : le("", !0)
|
|
3571
3936
|
])
|
|
3572
3937
|
]),
|
|
3573
|
-
|
|
3938
|
+
p[33] || (p[33] = g("div", { class: "property-group" }, [
|
|
3574
3939
|
g("label", null, "全局属性"),
|
|
3575
3940
|
g("div", { class: "row" })
|
|
3576
3941
|
], -1)),
|
|
3577
|
-
r.selectedObject ? (
|
|
3942
|
+
r.selectedObject ? (k(), z("div", mo, [
|
|
3578
3943
|
g("button", {
|
|
3579
|
-
class:
|
|
3580
|
-
onClick:
|
|
3944
|
+
class: Be(["tab-btn", { active: i.value === "transform" }]),
|
|
3945
|
+
onClick: p[1] || (p[1] = (b) => i.value = "transform")
|
|
3581
3946
|
}, " 🔄 变换 ", 2),
|
|
3582
3947
|
g("button", {
|
|
3583
|
-
class:
|
|
3584
|
-
onClick:
|
|
3948
|
+
class: Be(["tab-btn", { active: i.value === "info" }]),
|
|
3949
|
+
onClick: p[2] || (p[2] = (b) => i.value = "info")
|
|
3585
3950
|
}, " ℹ️ 信息 ", 2)
|
|
3586
|
-
])) :
|
|
3587
|
-
r.selectedObject ? (
|
|
3588
|
-
|
|
3589
|
-
g("div",
|
|
3590
|
-
|
|
3591
|
-
g("div",
|
|
3592
|
-
|
|
3593
|
-
|
|
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", {
|
|
3594
3959
|
type: "number",
|
|
3595
|
-
"onUpdate:modelValue":
|
|
3960
|
+
"onUpdate:modelValue": p[3] || (p[3] = (b) => r.transform.position.x = b),
|
|
3596
3961
|
step: "0.01",
|
|
3597
3962
|
onInput: n
|
|
3598
3963
|
}, null, 544), [
|
|
3599
3964
|
[
|
|
3600
|
-
|
|
3965
|
+
$,
|
|
3601
3966
|
r.transform.position.x,
|
|
3602
3967
|
void 0,
|
|
3603
3968
|
{ number: !0 }
|
|
3604
3969
|
]
|
|
3605
3970
|
]),
|
|
3606
|
-
|
|
3607
|
-
|
|
3971
|
+
p[17] || (p[17] = g("span", null, "Y:", -1)),
|
|
3972
|
+
O(g("input", {
|
|
3608
3973
|
type: "number",
|
|
3609
|
-
"onUpdate:modelValue":
|
|
3974
|
+
"onUpdate:modelValue": p[4] || (p[4] = (b) => r.transform.position.y = b),
|
|
3610
3975
|
step: "0.01",
|
|
3611
3976
|
onInput: n
|
|
3612
3977
|
}, null, 544), [
|
|
3613
3978
|
[
|
|
3614
|
-
|
|
3979
|
+
$,
|
|
3615
3980
|
r.transform.position.y,
|
|
3616
3981
|
void 0,
|
|
3617
3982
|
{ number: !0 }
|
|
3618
3983
|
]
|
|
3619
3984
|
]),
|
|
3620
|
-
|
|
3621
|
-
|
|
3985
|
+
p[18] || (p[18] = g("span", null, "Z:", -1)),
|
|
3986
|
+
O(g("input", {
|
|
3622
3987
|
type: "number",
|
|
3623
|
-
"onUpdate:modelValue":
|
|
3988
|
+
"onUpdate:modelValue": p[5] || (p[5] = (b) => r.transform.position.z = b),
|
|
3624
3989
|
step: "0.01",
|
|
3625
3990
|
onInput: n
|
|
3626
3991
|
}, null, 544), [
|
|
3627
3992
|
[
|
|
3628
|
-
|
|
3993
|
+
$,
|
|
3629
3994
|
r.transform.position.z,
|
|
3630
3995
|
void 0,
|
|
3631
3996
|
{ number: !0 }
|
|
@@ -3633,46 +3998,46 @@ const Ji = {
|
|
|
3633
3998
|
])
|
|
3634
3999
|
])
|
|
3635
4000
|
]),
|
|
3636
|
-
g("div",
|
|
3637
|
-
|
|
3638
|
-
g("div",
|
|
3639
|
-
|
|
3640
|
-
|
|
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", {
|
|
3641
4006
|
type: "number",
|
|
3642
|
-
"onUpdate:modelValue":
|
|
4007
|
+
"onUpdate:modelValue": p[6] || (p[6] = (b) => r.transform.rotation.x = b),
|
|
3643
4008
|
step: "0.01",
|
|
3644
4009
|
onInput: n
|
|
3645
4010
|
}, null, 544), [
|
|
3646
4011
|
[
|
|
3647
|
-
|
|
4012
|
+
$,
|
|
3648
4013
|
r.transform.rotation.x,
|
|
3649
4014
|
void 0,
|
|
3650
4015
|
{ number: !0 }
|
|
3651
4016
|
]
|
|
3652
4017
|
]),
|
|
3653
|
-
|
|
3654
|
-
|
|
4018
|
+
p[21] || (p[21] = g("span", null, "Y:", -1)),
|
|
4019
|
+
O(g("input", {
|
|
3655
4020
|
type: "number",
|
|
3656
|
-
"onUpdate:modelValue":
|
|
4021
|
+
"onUpdate:modelValue": p[7] || (p[7] = (b) => r.transform.rotation.y = b),
|
|
3657
4022
|
step: "0.01",
|
|
3658
4023
|
onInput: n
|
|
3659
4024
|
}, null, 544), [
|
|
3660
4025
|
[
|
|
3661
|
-
|
|
4026
|
+
$,
|
|
3662
4027
|
r.transform.rotation.y,
|
|
3663
4028
|
void 0,
|
|
3664
4029
|
{ number: !0 }
|
|
3665
4030
|
]
|
|
3666
4031
|
]),
|
|
3667
|
-
|
|
3668
|
-
|
|
4032
|
+
p[22] || (p[22] = g("span", null, "Z:", -1)),
|
|
4033
|
+
O(g("input", {
|
|
3669
4034
|
type: "number",
|
|
3670
|
-
"onUpdate:modelValue":
|
|
4035
|
+
"onUpdate:modelValue": p[8] || (p[8] = (b) => r.transform.rotation.z = b),
|
|
3671
4036
|
step: "0.01",
|
|
3672
4037
|
onInput: n
|
|
3673
4038
|
}, null, 544), [
|
|
3674
4039
|
[
|
|
3675
|
-
|
|
4040
|
+
$,
|
|
3676
4041
|
r.transform.rotation.z,
|
|
3677
4042
|
void 0,
|
|
3678
4043
|
{ number: !0 }
|
|
@@ -3680,46 +4045,46 @@ const Ji = {
|
|
|
3680
4045
|
])
|
|
3681
4046
|
])
|
|
3682
4047
|
]),
|
|
3683
|
-
g("div",
|
|
3684
|
-
|
|
3685
|
-
g("div",
|
|
3686
|
-
|
|
3687
|
-
|
|
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", {
|
|
3688
4053
|
type: "number",
|
|
3689
|
-
"onUpdate:modelValue":
|
|
4054
|
+
"onUpdate:modelValue": p[9] || (p[9] = (b) => r.transform.scale.x = b),
|
|
3690
4055
|
step: "0.01",
|
|
3691
4056
|
onInput: n
|
|
3692
4057
|
}, null, 544), [
|
|
3693
4058
|
[
|
|
3694
|
-
|
|
4059
|
+
$,
|
|
3695
4060
|
r.transform.scale.x,
|
|
3696
4061
|
void 0,
|
|
3697
4062
|
{ number: !0 }
|
|
3698
4063
|
]
|
|
3699
4064
|
]),
|
|
3700
|
-
|
|
3701
|
-
|
|
4065
|
+
p[25] || (p[25] = g("span", null, "Y:", -1)),
|
|
4066
|
+
O(g("input", {
|
|
3702
4067
|
type: "number",
|
|
3703
|
-
"onUpdate:modelValue":
|
|
4068
|
+
"onUpdate:modelValue": p[10] || (p[10] = (b) => r.transform.scale.y = b),
|
|
3704
4069
|
step: "0.01",
|
|
3705
4070
|
onInput: n
|
|
3706
4071
|
}, null, 544), [
|
|
3707
4072
|
[
|
|
3708
|
-
|
|
4073
|
+
$,
|
|
3709
4074
|
r.transform.scale.y,
|
|
3710
4075
|
void 0,
|
|
3711
4076
|
{ number: !0 }
|
|
3712
4077
|
]
|
|
3713
4078
|
]),
|
|
3714
|
-
|
|
3715
|
-
|
|
4079
|
+
p[26] || (p[26] = g("span", null, "Z:", -1)),
|
|
4080
|
+
O(g("input", {
|
|
3716
4081
|
type: "number",
|
|
3717
|
-
"onUpdate:modelValue":
|
|
4082
|
+
"onUpdate:modelValue": p[11] || (p[11] = (b) => r.transform.scale.z = b),
|
|
3718
4083
|
step: "0.01",
|
|
3719
4084
|
onInput: n
|
|
3720
4085
|
}, null, 544), [
|
|
3721
4086
|
[
|
|
3722
|
-
|
|
4087
|
+
$,
|
|
3723
4088
|
r.transform.scale.z,
|
|
3724
4089
|
void 0,
|
|
3725
4090
|
{ number: !0 }
|
|
@@ -3727,263 +4092,274 @@ const Ji = {
|
|
|
3727
4092
|
])
|
|
3728
4093
|
])
|
|
3729
4094
|
]),
|
|
3730
|
-
r.selectedObject ? (
|
|
3731
|
-
|
|
3732
|
-
g("div",
|
|
3733
|
-
|
|
3734
|
-
|
|
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", {
|
|
3735
4100
|
type: "range",
|
|
3736
4101
|
min: "0",
|
|
3737
4102
|
max: "1",
|
|
3738
4103
|
step: "0.01",
|
|
3739
|
-
"onUpdate:modelValue":
|
|
4104
|
+
"onUpdate:modelValue": p[12] || (p[12] = (b) => h.metalness = b),
|
|
3740
4105
|
onInput: f
|
|
3741
4106
|
}, null, 544), [
|
|
3742
4107
|
[
|
|
3743
|
-
|
|
3744
|
-
|
|
4108
|
+
$,
|
|
4109
|
+
h.metalness,
|
|
3745
4110
|
void 0,
|
|
3746
4111
|
{ number: !0 }
|
|
3747
4112
|
]
|
|
3748
4113
|
]),
|
|
3749
|
-
g("span",
|
|
4114
|
+
g("span", vo, ve(h.metalness.toFixed(2)), 1)
|
|
3750
4115
|
]),
|
|
3751
|
-
g("div",
|
|
3752
|
-
|
|
3753
|
-
|
|
4116
|
+
g("div", So, [
|
|
4117
|
+
p[29] || (p[29] = g("span", { class: "slider-label" }, "粗糙度", -1)),
|
|
4118
|
+
O(g("input", {
|
|
3754
4119
|
type: "range",
|
|
3755
4120
|
min: "0",
|
|
3756
4121
|
max: "1",
|
|
3757
4122
|
step: "0.01",
|
|
3758
|
-
"onUpdate:modelValue":
|
|
4123
|
+
"onUpdate:modelValue": p[13] || (p[13] = (b) => h.roughness = b),
|
|
3759
4124
|
onInput: f
|
|
3760
4125
|
}, null, 544), [
|
|
3761
4126
|
[
|
|
3762
|
-
|
|
3763
|
-
|
|
4127
|
+
$,
|
|
4128
|
+
h.roughness,
|
|
3764
4129
|
void 0,
|
|
3765
4130
|
{ number: !0 }
|
|
3766
4131
|
]
|
|
3767
4132
|
]),
|
|
3768
|
-
g("span",
|
|
4133
|
+
g("span", Ao, ve(h.roughness.toFixed(2)), 1)
|
|
3769
4134
|
]),
|
|
3770
|
-
g("div",
|
|
3771
|
-
|
|
3772
|
-
|
|
4135
|
+
g("div", Ro, [
|
|
4136
|
+
p[30] || (p[30] = g("span", { class: "slider-label" }, "透明度", -1)),
|
|
4137
|
+
O(g("input", {
|
|
3773
4138
|
type: "range",
|
|
3774
4139
|
min: "0",
|
|
3775
4140
|
max: "1",
|
|
3776
4141
|
step: "0.01",
|
|
3777
|
-
"onUpdate:modelValue":
|
|
4142
|
+
"onUpdate:modelValue": p[14] || (p[14] = (b) => h.opacity = b),
|
|
3778
4143
|
onInput: f
|
|
3779
4144
|
}, null, 544), [
|
|
3780
4145
|
[
|
|
3781
|
-
|
|
3782
|
-
|
|
4146
|
+
$,
|
|
4147
|
+
h.opacity,
|
|
3783
4148
|
void 0,
|
|
3784
4149
|
{ number: !0 }
|
|
3785
4150
|
]
|
|
3786
4151
|
]),
|
|
3787
|
-
g("span",
|
|
4152
|
+
g("span", Po, ve(h.opacity.toFixed(2)), 1)
|
|
3788
4153
|
]),
|
|
3789
|
-
|
|
3790
|
-
])) :
|
|
4154
|
+
d.value ? le("", !0) : (k(), z("div", Lo, " ⚠️ 当前材质不支持金属度/粗糙度(仅支持 Standard/Phong) "))
|
|
4155
|
+
])) : le("", !0)
|
|
3791
4156
|
], 512), [
|
|
3792
|
-
[
|
|
4157
|
+
[re, i.value === "transform"]
|
|
3793
4158
|
])
|
|
3794
|
-
])) :
|
|
3795
|
-
])) : (
|
|
4159
|
+
])) : le("", !0)
|
|
4160
|
+
])) : (k(), z("div", Io, [...p[34] || (p[34] = [
|
|
3796
4161
|
g("p", null, "未选中任何模型", -1)
|
|
3797
4162
|
])]));
|
|
3798
4163
|
}
|
|
3799
|
-
}),
|
|
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({
|
|
3800
4165
|
__name: "TopBar",
|
|
3801
4166
|
emits: ["addModel", "importModel"],
|
|
3802
4167
|
setup(r, { emit: e }) {
|
|
3803
|
-
const t =
|
|
3804
|
-
var
|
|
3805
|
-
return (
|
|
3806
|
-
},
|
|
3807
|
-
const
|
|
3808
|
-
|
|
3809
|
-
},
|
|
3810
|
-
return (
|
|
3811
|
-
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, [
|
|
3812
4177
|
g("div", {
|
|
3813
4178
|
class: "dropdown-wrapper",
|
|
3814
|
-
onMouseenter:
|
|
3815
|
-
onMouseleave:
|
|
4179
|
+
onMouseenter: x[2] || (x[2] = (P) => t.value = !0),
|
|
4180
|
+
onMouseleave: x[3] || (x[3] = (P) => t.value = !1)
|
|
3816
4181
|
}, [
|
|
3817
|
-
|
|
3818
|
-
|
|
4182
|
+
x[20] || (x[20] = g("button", { class: "menu-btn" }, "文件", -1)),
|
|
4183
|
+
O(g("div", No, [
|
|
3819
4184
|
g("div", {
|
|
3820
4185
|
class: "menu-item",
|
|
3821
|
-
onClick:
|
|
4186
|
+
onClick: w
|
|
3822
4187
|
}, "新建"),
|
|
3823
4188
|
g("div", {
|
|
3824
4189
|
class: "menu-item dropdown-wrapper sub-trigger",
|
|
3825
|
-
onMouseenter:
|
|
3826
|
-
onMouseleave:
|
|
4190
|
+
onMouseenter: x[0] || (x[0] = (P) => a.value = !0),
|
|
4191
|
+
onMouseleave: x[1] || (x[1] = (P) => a.value = !1)
|
|
3827
4192
|
}, [
|
|
3828
|
-
|
|
3829
|
-
|
|
4193
|
+
x[19] || (x[19] = g("span", null, "打开", -1)),
|
|
4194
|
+
O(g("div", jo, [
|
|
3830
4195
|
g("div", {
|
|
3831
4196
|
class: "menu-item",
|
|
3832
|
-
onClick:
|
|
4197
|
+
onClick: W
|
|
3833
4198
|
}, "打开项目"),
|
|
3834
4199
|
g("div", {
|
|
3835
4200
|
class: "menu-item",
|
|
3836
|
-
onClick:
|
|
4201
|
+
onClick: Q
|
|
3837
4202
|
}, "打开模型"),
|
|
3838
4203
|
g("div", {
|
|
3839
4204
|
class: "menu-item",
|
|
3840
|
-
onClick:
|
|
4205
|
+
onClick: me
|
|
3841
4206
|
}, "打开场景")
|
|
3842
4207
|
], 512), [
|
|
3843
|
-
[
|
|
4208
|
+
[re, a.value]
|
|
3844
4209
|
])
|
|
3845
4210
|
], 32),
|
|
3846
4211
|
g("div", {
|
|
3847
4212
|
class: "menu-item",
|
|
3848
|
-
onClick:
|
|
4213
|
+
onClick: f
|
|
3849
4214
|
}, "保存"),
|
|
3850
4215
|
g("div", {
|
|
3851
4216
|
class: "menu-item",
|
|
3852
|
-
onClick:
|
|
4217
|
+
onClick: y
|
|
3853
4218
|
}, "导出")
|
|
3854
4219
|
], 512), [
|
|
3855
|
-
[
|
|
4220
|
+
[re, t.value]
|
|
3856
4221
|
])
|
|
3857
4222
|
], 32),
|
|
3858
4223
|
g("div", {
|
|
3859
4224
|
class: "dropdown-wrapper",
|
|
3860
|
-
onMouseenter:
|
|
3861
|
-
onMouseleave:
|
|
4225
|
+
onMouseenter: x[11] || (x[11] = (P) => o.value = !0),
|
|
4226
|
+
onMouseleave: x[12] || (x[12] = (P) => o.value = !1)
|
|
3862
4227
|
}, [
|
|
3863
|
-
|
|
3864
|
-
|
|
4228
|
+
x[23] || (x[23] = g("button", { class: "menu-btn" }, "添加", -1)),
|
|
4229
|
+
O(g("div", Ho, [
|
|
3865
4230
|
g("div", {
|
|
3866
4231
|
class: "menu-item",
|
|
3867
|
-
onClick:
|
|
4232
|
+
onClick: p
|
|
3868
4233
|
}, "组"),
|
|
3869
4234
|
g("div", {
|
|
3870
4235
|
class: "menu-item dropdown-wrapper sub-trigger",
|
|
3871
|
-
onMouseenter:
|
|
3872
|
-
onMouseleave:
|
|
4236
|
+
onMouseenter: x[6] || (x[6] = (P) => l.value = !0),
|
|
4237
|
+
onMouseleave: x[7] || (x[7] = (P) => l.value = !1)
|
|
3873
4238
|
}, [
|
|
3874
|
-
|
|
3875
|
-
|
|
4239
|
+
x[21] || (x[21] = g("span", null, "网格", -1)),
|
|
4240
|
+
O(g("div", Fo, [
|
|
3876
4241
|
g("div", {
|
|
3877
4242
|
class: "menu-item",
|
|
3878
|
-
onClick:
|
|
4243
|
+
onClick: x[4] || (x[4] = (P) => u("addModel", "box"))
|
|
3879
4244
|
}, " 正方体 "),
|
|
3880
4245
|
g("div", {
|
|
3881
4246
|
class: "menu-item",
|
|
3882
|
-
onClick:
|
|
4247
|
+
onClick: x[5] || (x[5] = (P) => u("addModel", "sphere"))
|
|
3883
4248
|
}, " 球体 "),
|
|
3884
4249
|
g("div", {
|
|
3885
4250
|
class: "menu-item",
|
|
3886
|
-
onClick:
|
|
4251
|
+
onClick: d
|
|
3887
4252
|
}, "导入")
|
|
3888
4253
|
], 512), [
|
|
3889
|
-
[
|
|
4254
|
+
[re, l.value]
|
|
3890
4255
|
])
|
|
3891
4256
|
], 32),
|
|
3892
4257
|
g("div", {
|
|
3893
|
-
class: "menu-item",
|
|
3894
|
-
|
|
3895
|
-
|
|
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),
|
|
3896
4272
|
g("div", {
|
|
3897
4273
|
class: "menu-item",
|
|
3898
|
-
onClick:
|
|
4274
|
+
onClick: M
|
|
3899
4275
|
}, "摄像机")
|
|
3900
4276
|
], 512), [
|
|
3901
|
-
[
|
|
4277
|
+
[re, o.value]
|
|
3902
4278
|
])
|
|
3903
4279
|
], 32),
|
|
3904
4280
|
g("div", {
|
|
3905
4281
|
class: "dropdown-wrapper",
|
|
3906
|
-
onMouseenter:
|
|
3907
|
-
onMouseleave:
|
|
4282
|
+
onMouseenter: x[13] || (x[13] = (P) => s.value = !0),
|
|
4283
|
+
onMouseleave: x[14] || (x[14] = (P) => s.value = !1)
|
|
3908
4284
|
}, [
|
|
3909
|
-
|
|
3910
|
-
|
|
4285
|
+
x[24] || (x[24] = g("button", { class: "menu-btn" }, "编辑", -1)),
|
|
4286
|
+
O(g("div", zo, [
|
|
3911
4287
|
g("div", {
|
|
3912
4288
|
class: "menu-item",
|
|
3913
|
-
onClick:
|
|
4289
|
+
onClick: p
|
|
3914
4290
|
}, "撤销"),
|
|
3915
4291
|
g("div", {
|
|
3916
4292
|
class: "menu-item",
|
|
3917
|
-
onClick:
|
|
4293
|
+
onClick: b
|
|
3918
4294
|
}, "重做"),
|
|
3919
4295
|
g("div", {
|
|
3920
4296
|
class: "menu-item",
|
|
3921
|
-
onClick:
|
|
4297
|
+
onClick: T
|
|
3922
4298
|
}, "复制"),
|
|
3923
4299
|
g("div", {
|
|
3924
4300
|
class: "menu-item",
|
|
3925
|
-
onClick:
|
|
4301
|
+
onClick: M
|
|
3926
4302
|
}, "删除")
|
|
3927
4303
|
], 512), [
|
|
3928
|
-
[
|
|
4304
|
+
[re, s.value]
|
|
3929
4305
|
])
|
|
3930
4306
|
], 32),
|
|
3931
4307
|
g("div", {
|
|
3932
4308
|
class: "dropdown-wrapper",
|
|
3933
|
-
onMouseenter:
|
|
3934
|
-
onMouseleave:
|
|
4309
|
+
onMouseenter: x[15] || (x[15] = (P) => n.value = !0),
|
|
4310
|
+
onMouseleave: x[16] || (x[16] = (P) => n.value = !1)
|
|
3935
4311
|
}, [
|
|
3936
|
-
|
|
3937
|
-
|
|
4312
|
+
x[25] || (x[25] = g("button", { class: "menu-btn" }, "视图", -1)),
|
|
4313
|
+
O(g("div", Go, [
|
|
3938
4314
|
g("div", {
|
|
3939
4315
|
class: "menu-item",
|
|
3940
|
-
onClick:
|
|
4316
|
+
onClick: R
|
|
3941
4317
|
}, "重置相机"),
|
|
3942
4318
|
g("div", {
|
|
3943
4319
|
class: "menu-item",
|
|
3944
|
-
onClick:
|
|
4320
|
+
onClick: v
|
|
3945
4321
|
}, "显示网格")
|
|
3946
4322
|
], 512), [
|
|
3947
|
-
[
|
|
4323
|
+
[re, n.value]
|
|
3948
4324
|
])
|
|
3949
4325
|
], 32),
|
|
3950
4326
|
g("div", {
|
|
3951
4327
|
class: "dropdown-wrapper",
|
|
3952
|
-
onMouseenter:
|
|
3953
|
-
onMouseleave:
|
|
4328
|
+
onMouseenter: x[17] || (x[17] = (P) => i.value = !0),
|
|
4329
|
+
onMouseleave: x[18] || (x[18] = (P) => i.value = !1)
|
|
3954
4330
|
}, [
|
|
3955
|
-
|
|
3956
|
-
|
|
4331
|
+
x[26] || (x[26] = g("button", { class: "menu-btn" }, "帮助", -1)),
|
|
4332
|
+
O(g("div", Xo, [
|
|
3957
4333
|
g("div", {
|
|
3958
4334
|
class: "menu-item",
|
|
3959
|
-
onClick:
|
|
4335
|
+
onClick: I
|
|
3960
4336
|
}, "使用帮助"),
|
|
3961
4337
|
g("div", {
|
|
3962
4338
|
class: "menu-item",
|
|
3963
|
-
onClick:
|
|
4339
|
+
onClick: V
|
|
3964
4340
|
}, "关于")
|
|
3965
4341
|
], 512), [
|
|
3966
|
-
[
|
|
4342
|
+
[re, i.value]
|
|
3967
4343
|
])
|
|
3968
4344
|
], 32)
|
|
3969
4345
|
]),
|
|
3970
|
-
|
|
4346
|
+
x[27] || (x[27] = g("div", { class: "right-section" }, [
|
|
3971
4347
|
g("span", { class: "app-title" }, "3D 模型编辑器")
|
|
3972
4348
|
], -1)),
|
|
3973
4349
|
g("input", {
|
|
3974
4350
|
type: "file",
|
|
3975
4351
|
ref_key: "fileInput",
|
|
3976
|
-
ref:
|
|
4352
|
+
ref: h,
|
|
3977
4353
|
accept: ".obj,.gltf,.glb",
|
|
3978
4354
|
style: { display: "none" },
|
|
3979
|
-
onChange:
|
|
4355
|
+
onChange: m
|
|
3980
4356
|
}, null, 544)
|
|
3981
4357
|
]));
|
|
3982
4358
|
}
|
|
3983
|
-
}),
|
|
4359
|
+
}), Yo = /* @__PURE__ */ We(Bo, [["__scopeId", "data-v-5b71862f"]]), Ko = { class: "bottom-bar" }, Vo = /* @__PURE__ */ Ze({
|
|
3984
4360
|
__name: "BottomBar",
|
|
3985
4361
|
setup(r) {
|
|
3986
|
-
return (e, t) => (
|
|
4362
|
+
return (e, t) => (k(), z("div", Ko, [...t[0] || (t[0] = [
|
|
3987
4363
|
g("div", { class: "status-left" }, [
|
|
3988
4364
|
g("span", null, "就绪")
|
|
3989
4365
|
], -1),
|
|
@@ -3992,14 +4368,14 @@ const Ji = {
|
|
|
3992
4368
|
], -1)
|
|
3993
4369
|
])]));
|
|
3994
4370
|
}
|
|
3995
|
-
}),
|
|
4371
|
+
}), Zo = /* @__PURE__ */ We(Vo, [["__scopeId", "data-v-3427bb27"]]), Wo = { class: "app-layout" }, Qo = /* @__PURE__ */ Ze({
|
|
3996
4372
|
__name: "DrawingBoard",
|
|
3997
4373
|
props: {
|
|
3998
4374
|
mode: { default: "edit" },
|
|
3999
4375
|
sceneData: { default: null }
|
|
4000
4376
|
},
|
|
4001
4377
|
setup(r) {
|
|
4002
|
-
const e = r, t =
|
|
4378
|
+
const e = r, t = U(null), s = un({
|
|
4003
4379
|
position: { x: 0, y: 0, z: 0 },
|
|
4004
4380
|
rotation: { x: 0, y: 0, z: 0 },
|
|
4005
4381
|
scale: { x: 1, y: 1, z: 1 }
|
|
@@ -4016,81 +4392,88 @@ const Ji = {
|
|
|
4016
4392
|
s.rotation.z
|
|
4017
4393
|
), f.scale.set(s.scale.x, s.scale.y, s.scale.z);
|
|
4018
4394
|
};
|
|
4019
|
-
|
|
4395
|
+
si((f) => {
|
|
4020
4396
|
t.value = f, f && n(f);
|
|
4021
|
-
}),
|
|
4397
|
+
}), ii((f) => {
|
|
4022
4398
|
n(f);
|
|
4023
4399
|
});
|
|
4024
4400
|
const o = () => {
|
|
4025
|
-
t.value && i(t.value)
|
|
4026
|
-
|
|
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) => {
|
|
4027
4406
|
try {
|
|
4028
|
-
await
|
|
4407
|
+
await to(f);
|
|
4029
4408
|
} catch (y) {
|
|
4030
4409
|
console.error("导入失败:", y), alert("导入失败:" + y.message);
|
|
4031
4410
|
}
|
|
4032
|
-
},
|
|
4033
|
-
|
|
4034
|
-
|
|
4411
|
+
}, c = kn([]);
|
|
4412
|
+
oi((f) => {
|
|
4413
|
+
c.value = f;
|
|
4035
4414
|
});
|
|
4036
4415
|
const u = () => {
|
|
4037
|
-
const f =
|
|
4038
|
-
f && (
|
|
4039
|
-
},
|
|
4040
|
-
return
|
|
4041
|
-
m.value &&
|
|
4042
|
-
}), (
|
|
4043
|
-
|
|
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, {
|
|
4044
4425
|
key: 0,
|
|
4045
4426
|
onAddModel: a,
|
|
4046
4427
|
onImportModel: l
|
|
4047
|
-
})) :
|
|
4428
|
+
})) : le("", !0),
|
|
4048
4429
|
g("div", {
|
|
4049
|
-
class:
|
|
4430
|
+
class: Be(`editor-container editor-container-mode-${r.mode}`)
|
|
4050
4431
|
}, [
|
|
4051
4432
|
g("div", {
|
|
4052
|
-
class:
|
|
4433
|
+
class: Be(`canvas canvas-mode-${r.mode}`),
|
|
4053
4434
|
ref_key: "containerRef",
|
|
4054
4435
|
ref: m
|
|
4055
4436
|
}, null, 2),
|
|
4056
|
-
r.mode === "edit" ? (
|
|
4437
|
+
r.mode === "edit" ? (k(), je(Do, {
|
|
4057
4438
|
key: 0,
|
|
4058
4439
|
transform: s,
|
|
4059
|
-
"tree-data":
|
|
4440
|
+
"tree-data": c.value,
|
|
4060
4441
|
"selected-object": t.value,
|
|
4061
4442
|
onPropertyChange: o,
|
|
4062
|
-
onTreeSelect:
|
|
4063
|
-
onTreeDelete:
|
|
4064
|
-
}, null, 8, ["transform", "tree-data", "selected-object"])) :
|
|
4443
|
+
onTreeSelect: h,
|
|
4444
|
+
onTreeDelete: d
|
|
4445
|
+
}, null, 8, ["transform", "tree-data", "selected-object"])) : le("", !0)
|
|
4065
4446
|
], 2),
|
|
4066
|
-
r.mode === "edit" ? (
|
|
4447
|
+
r.mode === "edit" ? (k(), je(Zo, { key: 1 })) : le("", !0)
|
|
4067
4448
|
]));
|
|
4068
4449
|
}
|
|
4069
|
-
}),
|
|
4450
|
+
}), ir = /* @__PURE__ */ We(Qo, [["__scopeId", "data-v-9bbe42aa"]]);
|
|
4070
4451
|
export {
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
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
|
|
4095
4478
|
};
|
|
4096
4479
|
//# sourceMappingURL=three-editor.es.js.map
|