endset_three_editor 0.1.6 → 0.1.8
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/components/DrawingBoard.vue.d.ts +6 -1
- package/dist/endset_three_editor.css +1 -1
- package/dist/three/index.d.ts +15 -1
- package/dist/three-editor.cjs.js +2 -2
- package/dist/three-editor.cjs.js.map +1 -1
- package/dist/three-editor.es.js +1135 -967
- 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
|
|
1
|
+
import { defineComponent as Ge, ref as G, inject as Tn, computed as Ze, watchEffect as xn, resolveComponent as En, openBlock as N, createElementBlock as U, createElementVNode as g, normalizeClass as He, withModifiers as At, unref as Mn, toDisplayString as Ee, Fragment as en, renderList as tn, createBlock as ot, createCommentVNode as de, watch as nn, toRef as vn, provide as Sn, reactive as sn, withDirectives as D, vModelText as Q, vShow as he, shallowRef as Rn, onMounted as An, createVNode as Pn } from "vue";
|
|
2
|
+
import * as F from "three";
|
|
3
|
+
import { Controls as on, Vector3 as M, MOUSE as Me, TOUCH as xe, Quaternion as K, Spherical as Pt, Vector2 as V, Ray as Ln, Plane as In, MathUtils as rn, Raycaster as On, Object3D as Ue, MeshBasicMaterial as _e, LineBasicMaterial as ke, CylinderGeometry as Y, BoxGeometry as z, BufferGeometry as ze, Float32BufferAttribute as ue, Mesh as T, OctahedronGeometry as Qe, Line as re, TorusGeometry as Pe, SphereGeometry as Cn, Euler as Dn, Matrix4 as Se, PlaneGeometry as Nn, DoubleSide as an, Loader as ln, FileLoader as xt, Color as pe, SRGBColorSpace as Re, Group as tt, Material as je, PointsMaterial as Ce, MeshPhongMaterial as kn, LineSegments as mt, Points as nt, TrianglesDrawMode as jn, TriangleFanDrawMode as gt, TriangleStripDrawMode as cn, LoaderUtils as Fe, MeshPhysicalMaterial as se, LinearSRGBColorSpace as ae, SpotLight as Fn, PointLight as Hn, DirectionalLight as Un, InstancedMesh as zn, InstancedBufferAttribute as Gn, TextureLoader as Xn, ImageBitmapLoader as Yn, BufferAttribute as rt, InterleavedBuffer as Bn, InterleavedBufferAttribute as Kn, LinearMipmapLinearFilter as hn, NearestMipmapLinearFilter as Vn, LinearMipmapNearestFilter as Zn, NearestMipmapNearestFilter as Qn, LinearFilter as yt, NearestFilter as un, RepeatWrapping as _t, MirroredRepeatWrapping as qn, ClampToEdgeWrapping as Wn, MeshStandardMaterial as dn, PropertyBinding as $n, SkinnedMesh as Jn, LineLoop as es, PerspectiveCamera as ts, OrthographicCamera as ns, Skeleton as ss, AnimationClip as is, Bone as os, InterpolateDiscrete as rs, InterpolateLinear as pn, Texture as Lt, VectorKeyframeTrack as It, NumberKeyframeTrack as Ot, QuaternionKeyframeTrack as Ct, ColorManagement as Dt, FrontSide as as, Interpolant as ls, Box3 as cs, Sphere as hs } from "three";
|
|
4
4
|
import us from "@tweenjs/tween.js";
|
|
5
|
-
const
|
|
5
|
+
const Nt = { type: "change" }, Et = { type: "start" }, fn = { type: "end" }, qe = new Ln(), kt = new In(), ds = Math.cos(70 * rn.DEG2RAD), k = new M(), B = 2 * Math.PI, P = {
|
|
6
6
|
NONE: -1,
|
|
7
7
|
ROTATE: 0,
|
|
8
8
|
DOLLY: 1,
|
|
@@ -11,8 +11,8 @@ const Ct = { type: "change" }, xt = { type: "start" }, dn = { type: "end" }, Ve
|
|
|
11
11
|
TOUCH_PAN: 4,
|
|
12
12
|
TOUCH_DOLLY_PAN: 5,
|
|
13
13
|
TOUCH_DOLLY_ROTATE: 6
|
|
14
|
-
},
|
|
15
|
-
class ps extends
|
|
14
|
+
}, at = 1e-6;
|
|
15
|
+
class ps extends on {
|
|
16
16
|
/**
|
|
17
17
|
* Constructs a new controls instance.
|
|
18
18
|
*
|
|
@@ -20,7 +20,7 @@ class ps extends nn {
|
|
|
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 = P.NONE, this.target = new M(), this.cursor = new M(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: Me.ROTATE, MIDDLE: Me.DOLLY, RIGHT: Me.PAN }, this.touches = { ONE: xe.ROTATE, TWO: xe.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._cursorStyle = "auto", this._domElementKeyEvents = null, this._lastPosition = new M(), this._lastQuaternion = new K(), this._lastTargetPosition = new M(), this._quat = new K().setFromUnitVectors(e.up, new M(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new Pt(), this._sphericalDelta = new Pt(), this._scale = 1, this._panOffset = new M(), this._rotateStart = new V(), this._rotateEnd = new V(), this._rotateDelta = new V(), this._panStart = new V(), this._panEnd = new V(), this._panDelta = new V(), this._dollyStart = new V(), this._dollyEnd = new V(), this._dollyDelta = new V(), this._dollyDirection = new M(), this._mouse = new V(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = ms.bind(this), this._onPointerDown = fs.bind(this), this._onPointerUp = gs.bind(this), this._onContextMenu = Es.bind(this), this._onMouseWheel = bs.bind(this), this._onKeyDown = ws.bind(this), this._onTouchStart = Ts.bind(this), this._onTouchMove = xs.bind(this), this._onMouseDown = ys.bind(this), this._onMouseMove = _s.bind(this), this._interceptControlDown = Ms.bind(this), this._interceptControlUp = vs.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 nn {
|
|
|
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(Nt), this.update(), this.state = P.NONE;
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
99
99
|
* Programmatically pan the camera.
|
|
@@ -138,9 +138,9 @@ class ps extends nn {
|
|
|
138
138
|
}
|
|
139
139
|
update(e = null) {
|
|
140
140
|
const t = this.object.position;
|
|
141
|
-
|
|
141
|
+
k.copy(t).sub(this.target), k.applyQuaternion(this._quat), this._spherical.setFromVector3(k), this.autoRotate && this.state === P.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 += B : s > Math.PI && (s -= B), n < -Math.PI ? n += B : n > Math.PI && (n -= B), 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 nn {
|
|
|
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 (k.setFromSpherical(this._spherical), k.applyQuaternion(this._quatInverse), t.copy(this.target).add(k), 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 = k.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 M(this._mouse.x, this._mouse.y, 0);
|
|
160
160
|
a.unproject(this.object);
|
|
161
161
|
const l = this.object.zoom;
|
|
162
162
|
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), i = l !== this.object.zoom;
|
|
163
|
-
const h = new
|
|
164
|
-
h.unproject(this.object), this.object.position.sub(h).add(a), this.object.updateMatrixWorld(), o =
|
|
163
|
+
const h = new M(this._mouse.x, this._mouse.y, 0);
|
|
164
|
+
h.unproject(this.object), this.object.position.sub(h).add(a), this.object.updateMatrixWorld(), o = k.length();
|
|
165
165
|
} else
|
|
166
166
|
console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
|
|
167
|
-
o !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position) : (
|
|
167
|
+
o !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position) : (qe.origin.copy(this.object.position), qe.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(qe.direction)) < ds ? this.object.lookAt(this.target) : (kt.setFromNormalAndCoplanarPoint(this.object.up, this.target), qe.intersectPlane(kt, 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) > at || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > at || this._lastTargetPosition.distanceToSquared(this.target) > at ? (this.dispatchEvent(Nt), 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 ? B / 60 * this.autoRotateSpeed * e : B / 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 nn {
|
|
|
185
185
|
this._sphericalDelta.phi -= e;
|
|
186
186
|
}
|
|
187
187
|
_panLeft(e, t) {
|
|
188
|
-
|
|
188
|
+
k.setFromMatrixColumn(t, 0), k.multiplyScalar(-e), this._panOffset.add(k);
|
|
189
189
|
}
|
|
190
190
|
_panUp(e, t) {
|
|
191
|
-
this.screenSpacePanning === !0 ?
|
|
191
|
+
this.screenSpacePanning === !0 ? k.setFromMatrixColumn(t, 1) : (k.setFromMatrixColumn(t, 0), k.crossVectors(this.object.up, k)), k.multiplyScalar(e), this._panOffset.add(k);
|
|
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
|
+
k.copy(n).sub(this.target);
|
|
199
|
+
let i = k.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 nn {
|
|
|
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(B * this._rotateDelta.x / t.clientHeight), this._rotateUp(B * 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 nn {
|
|
|
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(B * 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(-B * 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(B * 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(-B * 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 nn {
|
|
|
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(B * this._rotateDelta.x / t.clientHeight), this._rotateUp(B * 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 nn {
|
|
|
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 V(), 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];
|
|
@@ -370,7 +370,7 @@ function ms(r) {
|
|
|
370
370
|
function gs(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(fn), this.state = P.NONE, this._cursorStyle === "grab" && (this.domElement.style.cursor = "grab");
|
|
374
374
|
break;
|
|
375
375
|
case 1:
|
|
376
376
|
const e = this._pointers[0], t = this._pointerPositions[e];
|
|
@@ -394,51 +394,51 @@ function ys(r) {
|
|
|
394
394
|
e = -1;
|
|
395
395
|
}
|
|
396
396
|
switch (e) {
|
|
397
|
-
case
|
|
397
|
+
case Me.DOLLY:
|
|
398
398
|
if (this.enableZoom === !1) return;
|
|
399
|
-
this._handleMouseDownDolly(r), this.state =
|
|
399
|
+
this._handleMouseDownDolly(r), this.state = P.DOLLY;
|
|
400
400
|
break;
|
|
401
|
-
case
|
|
401
|
+
case Me.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 = P.PAN;
|
|
405
405
|
} else {
|
|
406
406
|
if (this.enableRotate === !1) return;
|
|
407
|
-
this._handleMouseDownRotate(r), this.state =
|
|
407
|
+
this._handleMouseDownRotate(r), this.state = P.ROTATE;
|
|
408
408
|
}
|
|
409
409
|
break;
|
|
410
|
-
case
|
|
410
|
+
case Me.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 = P.ROTATE;
|
|
414
414
|
} else {
|
|
415
415
|
if (this.enablePan === !1) return;
|
|
416
|
-
this._handleMouseDownPan(r), this.state =
|
|
416
|
+
this._handleMouseDownPan(r), this.state = P.PAN;
|
|
417
417
|
}
|
|
418
418
|
break;
|
|
419
419
|
default:
|
|
420
|
-
this.state =
|
|
420
|
+
this.state = P.NONE;
|
|
421
421
|
}
|
|
422
|
-
this.state !==
|
|
422
|
+
this.state !== P.NONE && this.dispatchEvent(Et);
|
|
423
423
|
}
|
|
424
424
|
function _s(r) {
|
|
425
425
|
switch (this.state) {
|
|
426
|
-
case
|
|
426
|
+
case P.ROTATE:
|
|
427
427
|
if (this.enableRotate === !1) return;
|
|
428
428
|
this._handleMouseMoveRotate(r);
|
|
429
429
|
break;
|
|
430
|
-
case
|
|
430
|
+
case P.DOLLY:
|
|
431
431
|
if (this.enableZoom === !1) return;
|
|
432
432
|
this._handleMouseMoveDolly(r);
|
|
433
433
|
break;
|
|
434
|
-
case
|
|
434
|
+
case P.PAN:
|
|
435
435
|
if (this.enablePan === !1) return;
|
|
436
436
|
this._handleMouseMovePan(r);
|
|
437
437
|
break;
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
440
|
function bs(r) {
|
|
441
|
-
this.enabled === !1 || this.enableZoom === !1 || this.state !==
|
|
441
|
+
this.enabled === !1 || this.enableZoom === !1 || this.state !== P.NONE || (r.preventDefault(), this.dispatchEvent(Et), this._handleMouseWheel(this._customWheelEvent(r)), this.dispatchEvent(fn));
|
|
442
442
|
}
|
|
443
443
|
function ws(r) {
|
|
444
444
|
this.enabled !== !1 && this._handleKeyDown(r);
|
|
@@ -447,57 +447,57 @@ function Ts(r) {
|
|
|
447
447
|
switch (this._trackPointer(r), this._pointers.length) {
|
|
448
448
|
case 1:
|
|
449
449
|
switch (this.touches.ONE) {
|
|
450
|
-
case
|
|
450
|
+
case xe.ROTATE:
|
|
451
451
|
if (this.enableRotate === !1) return;
|
|
452
|
-
this._handleTouchStartRotate(r), this.state =
|
|
452
|
+
this._handleTouchStartRotate(r), this.state = P.TOUCH_ROTATE;
|
|
453
453
|
break;
|
|
454
|
-
case
|
|
454
|
+
case xe.PAN:
|
|
455
455
|
if (this.enablePan === !1) return;
|
|
456
|
-
this._handleTouchStartPan(r), this.state =
|
|
456
|
+
this._handleTouchStartPan(r), this.state = P.TOUCH_PAN;
|
|
457
457
|
break;
|
|
458
458
|
default:
|
|
459
|
-
this.state =
|
|
459
|
+
this.state = P.NONE;
|
|
460
460
|
}
|
|
461
461
|
break;
|
|
462
462
|
case 2:
|
|
463
463
|
switch (this.touches.TWO) {
|
|
464
|
-
case
|
|
464
|
+
case xe.DOLLY_PAN:
|
|
465
465
|
if (this.enableZoom === !1 && this.enablePan === !1) return;
|
|
466
|
-
this._handleTouchStartDollyPan(r), this.state =
|
|
466
|
+
this._handleTouchStartDollyPan(r), this.state = P.TOUCH_DOLLY_PAN;
|
|
467
467
|
break;
|
|
468
|
-
case
|
|
468
|
+
case xe.DOLLY_ROTATE:
|
|
469
469
|
if (this.enableZoom === !1 && this.enableRotate === !1) return;
|
|
470
|
-
this._handleTouchStartDollyRotate(r), this.state =
|
|
470
|
+
this._handleTouchStartDollyRotate(r), this.state = P.TOUCH_DOLLY_ROTATE;
|
|
471
471
|
break;
|
|
472
472
|
default:
|
|
473
|
-
this.state =
|
|
473
|
+
this.state = P.NONE;
|
|
474
474
|
}
|
|
475
475
|
break;
|
|
476
476
|
default:
|
|
477
|
-
this.state =
|
|
477
|
+
this.state = P.NONE;
|
|
478
478
|
}
|
|
479
|
-
this.state !==
|
|
479
|
+
this.state !== P.NONE && this.dispatchEvent(Et);
|
|
480
480
|
}
|
|
481
481
|
function xs(r) {
|
|
482
482
|
switch (this._trackPointer(r), this.state) {
|
|
483
|
-
case
|
|
483
|
+
case P.TOUCH_ROTATE:
|
|
484
484
|
if (this.enableRotate === !1) return;
|
|
485
485
|
this._handleTouchMoveRotate(r), this.update();
|
|
486
486
|
break;
|
|
487
|
-
case
|
|
487
|
+
case P.TOUCH_PAN:
|
|
488
488
|
if (this.enablePan === !1) return;
|
|
489
489
|
this._handleTouchMovePan(r), this.update();
|
|
490
490
|
break;
|
|
491
|
-
case
|
|
491
|
+
case P.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 P.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 = P.NONE;
|
|
501
501
|
}
|
|
502
502
|
}
|
|
503
503
|
function Es(r) {
|
|
@@ -506,15 +506,15 @@ function Es(r) {
|
|
|
506
506
|
function Ms(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 vs(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 me = new On(), H = new M(), le = new M(), O = new K(), jt = {
|
|
513
|
+
X: new M(1, 0, 0),
|
|
514
|
+
Y: new M(0, 1, 0),
|
|
515
|
+
Z: new M(0, 0, 1)
|
|
516
|
+
}, lt = { type: "change" }, Ft = { type: "mouseDown", mode: null }, Ht = { type: "mouseUp", mode: null }, Ut = { type: "objectChange" };
|
|
517
|
+
class Ss extends on {
|
|
518
518
|
/**
|
|
519
519
|
* Constructs a new controls instance.
|
|
520
520
|
*
|
|
@@ -530,20 +530,20 @@ class vs extends nn {
|
|
|
530
530
|
const i = new Ds();
|
|
531
531
|
this._plane = i, s.add(i);
|
|
532
532
|
const o = this;
|
|
533
|
-
function a(
|
|
534
|
-
let
|
|
535
|
-
Object.defineProperty(o,
|
|
533
|
+
function a(x, S) {
|
|
534
|
+
let A = S;
|
|
535
|
+
Object.defineProperty(o, x, {
|
|
536
536
|
get: function() {
|
|
537
|
-
return
|
|
537
|
+
return A !== void 0 ? A : S;
|
|
538
538
|
},
|
|
539
539
|
set: function(v) {
|
|
540
|
-
|
|
540
|
+
A !== v && (A = v, i[x] = v, n[x] = v, o.dispatchEvent({ type: x + "-changed", value: v }), o.dispatchEvent(lt));
|
|
541
541
|
}
|
|
542
|
-
}), o[
|
|
542
|
+
}), o[x] = S, i[x] = S, n[x] = S;
|
|
543
543
|
}
|
|
544
544
|
a("camera", e), a("object", void 0), a("enabled", !0), a("axis", null), a("mode", "translate"), a("translationSnap", null), a("rotationSnap", null), a("scaleSnap", null), a("space", "world"), a("size", 1), a("dragging", !1), a("showX", !0), a("showY", !0), a("showZ", !0), a("showXY", !0), a("showYZ", !0), a("showXZ", !0), a("minX", -1 / 0), a("maxX", 1 / 0), a("minY", -1 / 0), a("maxY", 1 / 0), a("minZ", -1 / 0), a("maxZ", 1 / 0);
|
|
545
|
-
const l = new
|
|
546
|
-
a("worldPosition", l), a("worldPositionStart", h), a("worldQuaternion", u), a("worldQuaternionStart", c), a("cameraPosition",
|
|
545
|
+
const l = new M(), h = new M(), u = new K(), c = new K(), p = new M(), m = new K(), b = new M(), f = new M(), y = new M(), d = 0, _ = new M();
|
|
546
|
+
a("worldPosition", l), a("worldPositionStart", h), a("worldQuaternion", u), a("worldQuaternionStart", c), a("cameraPosition", p), a("cameraQuaternion", m), a("pointStart", b), a("pointEnd", f), a("rotationAxis", y), a("rotationAngle", d), a("eye", _), this._offset = new M(), this._startNorm = new M(), this._endNorm = new M(), this._cameraScale = new M(), this._parentPosition = new M(), this._parentQuaternion = new K(), this._parentQuaternionInv = new K(), this._parentScale = new M(), this._worldScaleStart = new M(), this._worldQuaternionInv = new K(), this._worldScale = new M(), this._positionStart = new M(), this._quaternionStart = new K(), this._scaleStart = new M(), this._getPointer = Rs.bind(this), this._onPointerDown = Ps.bind(this), this._onPointerHover = As.bind(this), this._onPointerMove = Ls.bind(this), this._onPointerUp = Is.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 vs extends nn {
|
|
|
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 && me.setFromCamera(e, this.camera);
|
|
566
|
+
const t = ct(this._gizmo.picker[this.mode], me);
|
|
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 && me.setFromCamera(e, this.camera);
|
|
572
|
+
const t = ct(this._plane, me, !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, Ft.mode = this.mode, this.dispatchEvent(Ft);
|
|
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 && me.setFromCamera(e, this.camera);
|
|
581
|
+
const o = ct(this._plane, me, !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(O.copy(this._quaternionStart).invert()), t.search("X") !== -1 && (n.position.x = Math.round(n.position.x / this.translationSnap) * this.translationSnap), t.search("Y") !== -1 && (n.position.y = Math.round(n.position.y / this.translationSnap) * this.translationSnap), t.search("Z") !== -1 && (n.position.z = Math.round(n.position.z / this.translationSnap) * this.translationSnap), n.position.applyQuaternion(this._quaternionStart)), i === "world" && (n.parent && n.position.add(
|
|
584
|
+
this._offset.copy(this.pointEnd).sub(this.pointStart), i === "local" && t !== "XYZ" && this._offset.applyQuaternion(this._worldQuaternionInv), t.indexOf("X") === -1 && (this._offset.x = 0), t.indexOf("Y") === -1 && (this._offset.y = 0), t.indexOf("Z") === -1 && (this._offset.z = 0), i === "local" && t !== "XYZ" ? this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale) : this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale), n.position.copy(this._offset).add(this._positionStart), this.translationSnap && (i === "local" && (n.position.applyQuaternion(O.copy(this._quaternionStart).invert()), t.search("X") !== -1 && (n.position.x = Math.round(n.position.x / this.translationSnap) * this.translationSnap), t.search("Y") !== -1 && (n.position.y = Math.round(n.position.y / this.translationSnap) * this.translationSnap), t.search("Z") !== -1 && (n.position.z = Math.round(n.position.z / this.translationSnap) * this.translationSnap), n.position.applyQuaternion(this._quaternionStart)), i === "world" && (n.parent && n.position.add(H.setFromMatrixPosition(n.parent.matrixWorld)), t.search("X") !== -1 && (n.position.x = Math.round(n.position.x / this.translationSnap) * this.translationSnap), t.search("Y") !== -1 && (n.position.y = Math.round(n.position.y / this.translationSnap) * this.translationSnap), t.search("Z") !== -1 && (n.position.z = Math.round(n.position.z / this.translationSnap) * this.translationSnap), n.parent && n.position.sub(H.setFromMatrixPosition(n.parent.matrixWorld)))), n.position.x = Math.max(this.minX, Math.min(this.maxX, n.position.x)), n.position.y = Math.max(this.minY, Math.min(this.maxY, n.position.y)), n.position.z = Math.max(this.minZ, Math.min(this.maxZ, n.position.z));
|
|
585
585
|
else if (s === "scale") {
|
|
586
586
|
if (t.search("XYZ") !== -1) {
|
|
587
587
|
let a = this.pointEnd.length() / this.pointStart.length();
|
|
588
588
|
this.pointEnd.dot(this.pointStart) < 0 && (a *= -1), le.set(a, a, a);
|
|
589
589
|
} else
|
|
590
|
-
|
|
590
|
+
H.copy(this.pointStart), le.copy(this.pointEnd), H.applyQuaternion(this._worldQuaternionInv), le.applyQuaternion(this._worldQuaternionInv), le.divide(H), t.search("X") === -1 && (le.x = 1), t.search("Y") === -1 && (le.y = 1), t.search("Z") === -1 && (le.z = 1);
|
|
591
591
|
n.scale.copy(this._scaleStart).multiply(le), 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(H.setFromMatrixPosition(this.camera.matrixWorld));
|
|
595
595
|
let l = !1;
|
|
596
|
-
t === "XYZE" ? (this.rotationAxis.copy(this._offset).cross(this.eye).normalize(), this.rotationAngle = this._offset.dot(
|
|
596
|
+
t === "XYZE" ? (this.rotationAxis.copy(this._offset).cross(this.eye).normalize(), this.rotationAngle = this._offset.dot(H.copy(this.rotationAxis).cross(this.eye)) * a) : (t === "X" || t === "Y" || t === "Z") && (this.rotationAxis.copy(jt[t]), H.copy(jt[t]), i === "local" && H.applyQuaternion(this.worldQuaternion), H.cross(this.eye), H.length() === 0 ? l = !0 : this.rotationAngle = this._offset.dot(H.normalize()) * a), (t === "E" || l) && (this.rotationAxis.copy(this.eye), this.rotationAngle = this.pointEnd.angleTo(this.pointStart), this._startNorm.copy(this.pointStart).normalize(), this._endNorm.copy(this.pointEnd).normalize(), this.rotationAngle *= this._endNorm.cross(this._startNorm).dot(this.eye) < 0 ? 1 : -1), this.rotationSnap && (this.rotationAngle = Math.round(this.rotationAngle / this.rotationSnap) * this.rotationSnap), i === "local" && t !== "E" && t !== "XYZE" ? (n.quaternion.copy(this._quaternionStart), n.quaternion.multiply(O.setFromAxisAngle(this.rotationAxis, this.rotationAngle)).normalize()) : (this.rotationAxis.applyQuaternion(this._parentQuaternionInv), n.quaternion.copy(O.setFromAxisAngle(this.rotationAxis, this.rotationAngle)), n.quaternion.multiply(this._quaternionStart).normalize());
|
|
597
597
|
}
|
|
598
|
-
this.dispatchEvent(
|
|
598
|
+
this.dispatchEvent(lt), this.dispatchEvent(Ut);
|
|
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 && (Ht.mode = this.mode, this.dispatchEvent(Ht)), this.dragging = !1, this.axis = null);
|
|
603
603
|
}
|
|
604
604
|
dispose() {
|
|
605
605
|
this.disconnect(), this._root.dispose();
|
|
@@ -625,7 +625,7 @@ class vs extends nn {
|
|
|
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(lt), this.dispatchEvent(Ut), 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 vs extends nn {
|
|
|
634
634
|
* @returns {Raycaster} The internal raycaster.
|
|
635
635
|
*/
|
|
636
636
|
getRaycaster() {
|
|
637
|
-
return
|
|
637
|
+
return me;
|
|
638
638
|
}
|
|
639
639
|
/**
|
|
640
640
|
* Returns the transformation mode.
|
|
@@ -739,15 +739,15 @@ function Ls(r) {
|
|
|
739
739
|
function Is(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 ct(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 Os extends
|
|
749
|
+
const We = new Dn(), L = new M(0, 1, 0), zt = new M(0, 0, 0), Gt = new Se(), $e = new K(), st = new K(), te = new M(), Xt = new Se(), De = new M(1, 0, 0), ye = new M(0, 1, 0), Ne = new M(0, 0, 1), Je = new M(), Le = new M(), Ie = new M();
|
|
750
|
+
class Os extends Ue {
|
|
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 je {
|
|
|
762
762
|
});
|
|
763
763
|
}
|
|
764
764
|
}
|
|
765
|
-
class Cs extends
|
|
765
|
+
class Cs extends Ue {
|
|
766
766
|
constructor() {
|
|
767
767
|
super(), this.isTransformControlsGizmo = !0, this.type = "TransformControlsGizmo";
|
|
768
|
-
const e = new
|
|
768
|
+
const e = new _e({
|
|
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 ke({
|
|
775
775
|
depthTest: !1,
|
|
776
776
|
depthWrite: !1,
|
|
777
777
|
fog: !1,
|
|
@@ -795,225 +795,225 @@ class Cs extends je {
|
|
|
795
795
|
u.color.setHex(255), u.opacity = 0.5;
|
|
796
796
|
const c = e.clone();
|
|
797
797
|
c.opacity = 0.25;
|
|
798
|
-
const d = e.clone();
|
|
799
|
-
d.color.setHex(16776960), d.opacity = 0.25;
|
|
800
798
|
const p = e.clone();
|
|
801
|
-
p.color.setHex(16776960);
|
|
802
|
-
const
|
|
803
|
-
|
|
799
|
+
p.color.setHex(16776960), p.opacity = 0.25;
|
|
800
|
+
const m = e.clone();
|
|
801
|
+
m.color.setHex(16776960);
|
|
802
|
+
const b = e.clone();
|
|
803
|
+
b.color.setHex(7895160), this.materialLib = {
|
|
804
804
|
xAxis: i,
|
|
805
805
|
yAxis: o,
|
|
806
806
|
zAxis: a,
|
|
807
|
-
active:
|
|
807
|
+
active: m,
|
|
808
808
|
xAxisTransparent: l,
|
|
809
809
|
yAxisTransparent: h,
|
|
810
810
|
zAxisTransparent: u,
|
|
811
|
-
activeTransparent:
|
|
811
|
+
activeTransparent: p
|
|
812
812
|
};
|
|
813
|
-
const
|
|
814
|
-
|
|
815
|
-
const y = new
|
|
813
|
+
const f = new Y(0, 0.04, 0.1, 12);
|
|
814
|
+
f.translate(0, 0.05, 0);
|
|
815
|
+
const y = new z(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 d = new ze();
|
|
818
|
+
d.setAttribute("position", new ue([0, 0, 0, 1, 0, 0], 3));
|
|
819
|
+
const _ = new Y(75e-4, 75e-4, 0.5, 3);
|
|
820
|
+
_.translate(0, 0.25, 0);
|
|
821
|
+
function x(Z, Ye) {
|
|
822
|
+
const J = new Pe(Z, 75e-4, 3, 64, Ye * Math.PI * 2);
|
|
823
|
+
return J.rotateY(Math.PI / 2), J.rotateX(Math.PI / 2), J;
|
|
824
824
|
}
|
|
825
825
|
function S() {
|
|
826
|
-
const
|
|
827
|
-
return
|
|
826
|
+
const Z = new ze();
|
|
827
|
+
return Z.setAttribute("position", new ue([0, 0, 0, 1, 1, 1], 3)), Z;
|
|
828
828
|
}
|
|
829
|
-
const
|
|
829
|
+
const A = {
|
|
830
830
|
X: [
|
|
831
|
-
[new
|
|
832
|
-
[new
|
|
833
|
-
[new
|
|
831
|
+
[new T(f, i), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
|
|
832
|
+
[new T(f, i), [-0.5, 0, 0], [0, 0, Math.PI / 2]],
|
|
833
|
+
[new T(_, i), [0, 0, 0], [0, 0, -Math.PI / 2]]
|
|
834
834
|
],
|
|
835
835
|
Y: [
|
|
836
|
-
[new
|
|
837
|
-
[new
|
|
838
|
-
[new
|
|
836
|
+
[new T(f, o), [0, 0.5, 0]],
|
|
837
|
+
[new T(f, o), [0, -0.5, 0], [Math.PI, 0, 0]],
|
|
838
|
+
[new T(_, o)]
|
|
839
839
|
],
|
|
840
840
|
Z: [
|
|
841
|
-
[new
|
|
842
|
-
[new
|
|
843
|
-
[new
|
|
841
|
+
[new T(f, a), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
|
|
842
|
+
[new T(f, a), [0, 0, -0.5], [-Math.PI / 2, 0, 0]],
|
|
843
|
+
[new T(_, a), null, [Math.PI / 2, 0, 0]]
|
|
844
844
|
],
|
|
845
845
|
XYZ: [
|
|
846
|
-
[new
|
|
846
|
+
[new T(new Qe(0.1, 0), c), [0, 0, 0]]
|
|
847
847
|
],
|
|
848
848
|
XY: [
|
|
849
|
-
[new
|
|
849
|
+
[new T(new z(0.15, 0.15, 0.01), u), [0.15, 0.15, 0]]
|
|
850
850
|
],
|
|
851
851
|
YZ: [
|
|
852
|
-
[new
|
|
852
|
+
[new T(new z(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 T(new z(0.15, 0.15, 0.01), h), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
|
|
856
856
|
]
|
|
857
857
|
}, v = {
|
|
858
858
|
X: [
|
|
859
|
-
[new
|
|
860
|
-
[new
|
|
859
|
+
[new T(new Y(0.2, 0, 0.6, 4), s), [0.3, 0, 0], [0, 0, -Math.PI / 2]],
|
|
860
|
+
[new T(new Y(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 T(new Y(0.2, 0, 0.6, 4), s), [0, 0.3, 0]],
|
|
864
|
+
[new T(new Y(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 T(new Y(0.2, 0, 0.6, 4), s), [0, 0, 0.3], [Math.PI / 2, 0, 0]],
|
|
868
|
+
[new T(new Y(0.2, 0, 0.6, 4), s), [0, 0, -0.3], [-Math.PI / 2, 0, 0]]
|
|
869
869
|
],
|
|
870
870
|
XYZ: [
|
|
871
|
-
[new
|
|
871
|
+
[new T(new Qe(0.2, 0), s)]
|
|
872
872
|
],
|
|
873
873
|
XY: [
|
|
874
|
-
[new
|
|
874
|
+
[new T(new z(0.2, 0.2, 0.01), s), [0.15, 0.15, 0]]
|
|
875
875
|
],
|
|
876
876
|
YZ: [
|
|
877
|
-
[new
|
|
877
|
+
[new T(new z(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 T(new z(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 T(new Qe(0.01, 2), n), null, null, null, "helper"]
|
|
885
885
|
],
|
|
886
886
|
END: [
|
|
887
|
-
[new
|
|
887
|
+
[new T(new Qe(0.01, 2), n), null, null, null, "helper"]
|
|
888
888
|
],
|
|
889
889
|
DELTA: [
|
|
890
890
|
[new re(S(), n), null, null, null, "helper"]
|
|
891
891
|
],
|
|
892
892
|
X: [
|
|
893
|
-
[new re(
|
|
893
|
+
[new re(d, n), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]
|
|
894
894
|
],
|
|
895
895
|
Y: [
|
|
896
|
-
[new re(
|
|
896
|
+
[new re(d, n), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]
|
|
897
897
|
],
|
|
898
898
|
Z: [
|
|
899
|
-
[new re(
|
|
899
|
+
[new re(d, n), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]
|
|
900
900
|
]
|
|
901
|
-
},
|
|
901
|
+
}, ie = {
|
|
902
902
|
XYZE: [
|
|
903
|
-
[new
|
|
903
|
+
[new T(x(0.5, 1), b), null, [0, Math.PI / 2, 0]]
|
|
904
904
|
],
|
|
905
905
|
X: [
|
|
906
|
-
[new
|
|
906
|
+
[new T(x(0.5, 0.5), i)]
|
|
907
907
|
],
|
|
908
908
|
Y: [
|
|
909
|
-
[new
|
|
909
|
+
[new T(x(0.5, 0.5), o), null, [0, 0, -Math.PI / 2]]
|
|
910
910
|
],
|
|
911
911
|
Z: [
|
|
912
|
-
[new
|
|
912
|
+
[new T(x(0.5, 0.5), a), null, [0, Math.PI / 2, 0]]
|
|
913
913
|
],
|
|
914
914
|
E: [
|
|
915
|
-
[new
|
|
915
|
+
[new T(x(0.75, 1), p), null, [0, Math.PI / 2, 0]]
|
|
916
916
|
]
|
|
917
|
-
},
|
|
917
|
+
}, ee = {
|
|
918
918
|
AXIS: [
|
|
919
|
-
[new re(
|
|
919
|
+
[new re(d, n), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]
|
|
920
920
|
]
|
|
921
|
-
},
|
|
921
|
+
}, fe = {
|
|
922
922
|
XYZE: [
|
|
923
|
-
[new
|
|
923
|
+
[new T(new Cn(0.25, 10, 8), s)]
|
|
924
924
|
],
|
|
925
925
|
X: [
|
|
926
|
-
[new
|
|
926
|
+
[new T(new Pe(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 T(new Pe(0.5, 0.1, 4, 24), s), [0, 0, 0], [Math.PI / 2, 0, 0]]
|
|
930
930
|
],
|
|
931
931
|
Z: [
|
|
932
|
-
[new
|
|
932
|
+
[new T(new Pe(0.5, 0.1, 4, 24), s), [0, 0, 0], [0, 0, -Math.PI / 2]]
|
|
933
933
|
],
|
|
934
934
|
E: [
|
|
935
|
-
[new
|
|
935
|
+
[new T(new Pe(0.75, 0.1, 2, 24), s)]
|
|
936
936
|
]
|
|
937
|
-
},
|
|
937
|
+
}, $ = {
|
|
938
938
|
X: [
|
|
939
|
-
[new
|
|
940
|
-
[new
|
|
941
|
-
[new
|
|
939
|
+
[new T(y, i), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
|
|
940
|
+
[new T(_, i), [0, 0, 0], [0, 0, -Math.PI / 2]],
|
|
941
|
+
[new T(y, i), [-0.5, 0, 0], [0, 0, Math.PI / 2]]
|
|
942
942
|
],
|
|
943
943
|
Y: [
|
|
944
|
-
[new
|
|
945
|
-
[new
|
|
946
|
-
[new
|
|
944
|
+
[new T(y, o), [0, 0.5, 0]],
|
|
945
|
+
[new T(_, o)],
|
|
946
|
+
[new T(y, o), [0, -0.5, 0], [0, 0, Math.PI]]
|
|
947
947
|
],
|
|
948
948
|
Z: [
|
|
949
|
-
[new
|
|
950
|
-
[new
|
|
951
|
-
[new
|
|
949
|
+
[new T(y, a), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
|
|
950
|
+
[new T(_, a), [0, 0, 0], [Math.PI / 2, 0, 0]],
|
|
951
|
+
[new T(y, a), [0, 0, -0.5], [-Math.PI / 2, 0, 0]]
|
|
952
952
|
],
|
|
953
953
|
XY: [
|
|
954
|
-
[new
|
|
954
|
+
[new T(new z(0.15, 0.15, 0.01), u), [0.15, 0.15, 0]]
|
|
955
955
|
],
|
|
956
956
|
YZ: [
|
|
957
|
-
[new
|
|
957
|
+
[new T(new z(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 T(new z(0.15, 0.15, 0.01), h), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
|
|
961
961
|
],
|
|
962
962
|
XYZ: [
|
|
963
|
-
[new
|
|
963
|
+
[new T(new z(0.1, 0.1, 0.1), c)]
|
|
964
964
|
]
|
|
965
|
-
},
|
|
965
|
+
}, E = {
|
|
966
966
|
X: [
|
|
967
|
-
[new
|
|
968
|
-
[new
|
|
967
|
+
[new T(new Y(0.2, 0, 0.6, 4), s), [0.3, 0, 0], [0, 0, -Math.PI / 2]],
|
|
968
|
+
[new T(new Y(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 T(new Y(0.2, 0, 0.6, 4), s), [0, 0.3, 0]],
|
|
972
|
+
[new T(new Y(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 T(new Y(0.2, 0, 0.6, 4), s), [0, 0, 0.3], [Math.PI / 2, 0, 0]],
|
|
976
|
+
[new T(new Y(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 T(new z(0.2, 0.2, 0.01), s), [0.15, 0.15, 0]]
|
|
980
980
|
],
|
|
981
981
|
YZ: [
|
|
982
|
-
[new
|
|
982
|
+
[new T(new z(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 T(new z(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 T(new z(0.2, 0.2, 0.2), s), [0, 0, 0]]
|
|
989
989
|
]
|
|
990
|
-
},
|
|
990
|
+
}, j = {
|
|
991
991
|
X: [
|
|
992
|
-
[new re(
|
|
992
|
+
[new re(d, n), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]
|
|
993
993
|
],
|
|
994
994
|
Y: [
|
|
995
|
-
[new re(
|
|
995
|
+
[new re(d, n), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]
|
|
996
996
|
],
|
|
997
997
|
Z: [
|
|
998
|
-
[new re(
|
|
998
|
+
[new re(d, 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
|
|
1006
|
-
|
|
1007
|
-
const
|
|
1008
|
-
|
|
1001
|
+
function oe(Z) {
|
|
1002
|
+
const Ye = new Ue();
|
|
1003
|
+
for (const J in Z)
|
|
1004
|
+
for (let Te = Z[J].length; Te--; ) {
|
|
1005
|
+
const X = Z[J][Te][0].clone(), Be = Z[J][Te][1], Ke = Z[J][Te][2], Ve = Z[J][Te][3], wn = Z[J][Te][4];
|
|
1006
|
+
X.name = J, X.tag = wn, Be && X.position.set(Be[0], Be[1], Be[2]), Ke && X.rotation.set(Ke[0], Ke[1], Ke[2]), Ve && X.scale.set(Ve[0], Ve[1], Ve[2]), X.updateMatrix();
|
|
1007
|
+
const Rt = X.geometry.clone();
|
|
1008
|
+
Rt.applyMatrix4(X.matrix), X.geometry = Rt, X.renderOrder = 1 / 0, X.position.set(0, 0, 0), X.rotation.set(0, 0, 0), X.scale.set(1, 1, 1), Ye.add(X);
|
|
1009
1009
|
}
|
|
1010
|
-
return
|
|
1010
|
+
return Ye;
|
|
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 = oe(A)), this.add(this.gizmo.rotate = oe(ie)), this.add(this.gizmo.scale = oe($)), this.add(this.picker.translate = oe(v)), this.add(this.picker.rotate = oe(fe)), this.add(this.picker.scale = oe(E)), this.add(this.helper.translate = oe(I)), this.add(this.helper.rotate = oe(ee)), this.add(this.helper.scale = oe(j)), this.picker.translate.visible = !1, this.picker.rotate.visible = !1, this.picker.scale.visible = !1;
|
|
1013
1013
|
}
|
|
1014
1014
|
// updateMatrixWorld will update transformations and appearance of individual handles
|
|
1015
1015
|
updateMatrixWorld(e) {
|
|
1016
|
-
const s = (this.mode === "scale" ? "local" : this.space) === "local" ? this.worldQuaternion :
|
|
1016
|
+
const s = (this.mode === "scale" ? "local" : this.space) === "local" ? this.worldQuaternion : st;
|
|
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,62 @@ class Cs extends je {
|
|
|
1022
1022
|
o.visible = !0, o.rotation.set(0, 0, 0), o.position.copy(this.worldPosition);
|
|
1023
1023
|
let a;
|
|
1024
1024
|
if (this.camera.isOrthographicCamera ? a = (this.camera.top - this.camera.bottom) / this.camera.zoom : a = this.worldPosition.distanceTo(this.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * this.camera.fov / 360) / this.camera.zoom, 7), o.scale.set(1, 1, 1).multiplyScalar(a * this.size / 4), o.tag === "helper") {
|
|
1025
|
-
o.visible = !1, o.name === "AXIS" ? (o.visible = !!this.axis, this.axis === "X" && (O.setFromEuler(
|
|
1025
|
+
o.visible = !1, o.name === "AXIS" ? (o.visible = !!this.axis, this.axis === "X" && (O.setFromEuler(We.set(0, 0, 0)), o.quaternion.copy(s).multiply(O), Math.abs(L.copy(De).applyQuaternion(s).dot(this.eye)) > 0.9 && (o.visible = !1)), this.axis === "Y" && (O.setFromEuler(We.set(0, 0, Math.PI / 2)), o.quaternion.copy(s).multiply(O), Math.abs(L.copy(ye).applyQuaternion(s).dot(this.eye)) > 0.9 && (o.visible = !1)), this.axis === "Z" && (O.setFromEuler(We.set(0, Math.PI / 2, 0)), o.quaternion.copy(s).multiply(O), Math.abs(L.copy(Ne).applyQuaternion(s).dot(this.eye)) > 0.9 && (o.visible = !1)), this.axis === "XYZE" && (O.setFromEuler(We.set(0, Math.PI / 2, 0)), L.copy(this.rotationAxis), o.quaternion.setFromRotationMatrix(Gt.lookAt(zt, L, ye)), o.quaternion.multiply(O), o.visible = this.dragging), this.axis === "E" && (o.visible = !1)) : o.name === "START" ? (o.position.copy(this.worldPositionStart), o.visible = this.dragging) : o.name === "END" ? (o.position.copy(this.worldPosition), o.visible = this.dragging) : o.name === "DELTA" ? (o.position.copy(this.worldPositionStart), o.quaternion.copy(this.worldQuaternionStart), H.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1), H.applyQuaternion(this.worldQuaternionStart.clone().invert()), o.scale.copy(H), o.visible = this.dragging) : (o.quaternion.copy(s), this.dragging ? o.position.copy(this.worldPositionStart) : o.position.copy(this.worldPosition), this.axis && (o.visible = this.axis.search(o.name) !== -1));
|
|
1026
1026
|
continue;
|
|
1027
1027
|
}
|
|
1028
|
-
o.quaternion.copy(s), this.mode === "translate" || this.mode === "scale" ? (o.name === "X" && Math.abs(
|
|
1028
|
+
o.quaternion.copy(s), this.mode === "translate" || this.mode === "scale" ? (o.name === "X" && Math.abs(L.copy(De).applyQuaternion(s).dot(this.eye)) > 0.99 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1), o.name === "Y" && Math.abs(L.copy(ye).applyQuaternion(s).dot(this.eye)) > 0.99 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1), o.name === "Z" && Math.abs(L.copy(Ne).applyQuaternion(s).dot(this.eye)) > 0.99 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1), o.name === "XY" && Math.abs(L.copy(Ne).applyQuaternion(s).dot(this.eye)) < 0.2 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1), o.name === "YZ" && Math.abs(L.copy(De).applyQuaternion(s).dot(this.eye)) < 0.2 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1), o.name === "XZ" && Math.abs(L.copy(ye).applyQuaternion(s).dot(this.eye)) < 0.2 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1)) : this.mode === "rotate" && ($e.copy(s), L.copy(this.eye).applyQuaternion(O.copy(s).invert()), o.name.search("E") !== -1 && o.quaternion.setFromRotationMatrix(Gt.lookAt(this.eye, zt, ye)), o.name === "X" && (O.setFromAxisAngle(De, Math.atan2(-L.y, L.z)), O.multiplyQuaternions($e, O), o.quaternion.copy(O)), o.name === "Y" && (O.setFromAxisAngle(ye, Math.atan2(L.x, L.z)), O.multiplyQuaternions($e, O), o.quaternion.copy(O)), o.name === "Z" && (O.setFromAxisAngle(Ne, Math.atan2(L.y, L.x)), O.multiplyQuaternions($e, O), o.quaternion.copy(O))), o.visible = o.visible && (o.name.indexOf("X") === -1 || this.showX), o.visible = o.visible && (o.name.indexOf("Y") === -1 || this.showY), o.visible = o.visible && (o.name.indexOf("Z") === -1 || this.showZ), o.visible = o.visible && (o.name.indexOf("E") === -1 || this.showX && this.showY && this.showZ), o.visible = o.visible && (o.name.indexOf("XY") === -1 || this.showXY), o.visible = o.visible && (o.name.indexOf("YZ") === -1 || this.showYZ), o.visible = o.visible && (o.name.indexOf("XZ") === -1 || this.showXZ), o.material._color = o.material._color || o.material.color.clone(), o.material._opacity = o.material._opacity || o.material.opacity, o.material.color.copy(o.material._color), o.material.opacity = o.material._opacity, this.enabled && this.axis && (o.name === this.axis ? (o.material.color.copy(this.materialLib.active.color), o.material.opacity = 1) : this.axis.split("").some(function(l) {
|
|
1029
1029
|
return o.name === l;
|
|
1030
1030
|
}) && (o.material.color.copy(this.materialLib.active.color), o.material.opacity = 1));
|
|
1031
1031
|
}
|
|
1032
1032
|
super.updateMatrixWorld(e);
|
|
1033
1033
|
}
|
|
1034
1034
|
}
|
|
1035
|
-
class Ds extends
|
|
1035
|
+
class Ds extends T {
|
|
1036
1036
|
constructor() {
|
|
1037
1037
|
super(
|
|
1038
1038
|
new Nn(1e5, 1e5, 2, 2),
|
|
1039
|
-
new
|
|
1039
|
+
new _e({ visible: !1, wireframe: !0, side: an, 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"), Je.copy(De).applyQuaternion(t === "local" ? this.worldQuaternion : st), Le.copy(ye).applyQuaternion(t === "local" ? this.worldQuaternion : st), Ie.copy(Ne).applyQuaternion(t === "local" ? this.worldQuaternion : st), L.copy(Le), this.mode) {
|
|
1045
1045
|
case "translate":
|
|
1046
1046
|
case "scale":
|
|
1047
1047
|
switch (this.axis) {
|
|
1048
1048
|
case "X":
|
|
1049
|
-
|
|
1049
|
+
L.copy(this.eye).cross(Je), te.copy(Je).cross(L);
|
|
1050
1050
|
break;
|
|
1051
1051
|
case "Y":
|
|
1052
|
-
|
|
1052
|
+
L.copy(this.eye).cross(Le), te.copy(Le).cross(L);
|
|
1053
1053
|
break;
|
|
1054
1054
|
case "Z":
|
|
1055
|
-
|
|
1055
|
+
L.copy(this.eye).cross(Ie), te.copy(Ie).cross(L);
|
|
1056
1056
|
break;
|
|
1057
1057
|
case "XY":
|
|
1058
|
-
|
|
1058
|
+
te.copy(Ie);
|
|
1059
1059
|
break;
|
|
1060
1060
|
case "YZ":
|
|
1061
|
-
|
|
1061
|
+
te.copy(Je);
|
|
1062
1062
|
break;
|
|
1063
1063
|
case "XZ":
|
|
1064
|
-
|
|
1064
|
+
L.copy(Ie), te.copy(Le);
|
|
1065
1065
|
break;
|
|
1066
1066
|
case "XYZ":
|
|
1067
1067
|
case "E":
|
|
1068
|
-
|
|
1068
|
+
te.set(0, 0, 0);
|
|
1069
1069
|
break;
|
|
1070
1070
|
}
|
|
1071
1071
|
break;
|
|
1072
1072
|
case "rotate":
|
|
1073
1073
|
default:
|
|
1074
|
-
|
|
1074
|
+
te.set(0, 0, 0);
|
|
1075
1075
|
}
|
|
1076
|
-
|
|
1076
|
+
te.length() === 0 ? this.quaternion.copy(this.cameraQuaternion) : (Xt.lookAt(H.set(0, 0, 0), te, L), this.quaternion.setFromRotationMatrix(Xt)), super.updateMatrixWorld(e);
|
|
1077
1077
|
}
|
|
1078
1078
|
}
|
|
1079
1079
|
const w = {
|
|
1080
|
+
mode: "",
|
|
1080
1081
|
/** Three.js 场景 */
|
|
1081
1082
|
scene: null,
|
|
1082
1083
|
/** 透视相机 */
|
|
@@ -1094,139 +1095,152 @@ const w = {
|
|
|
1094
1095
|
/** 当前选中的物体 */
|
|
1095
1096
|
selectedObject: null
|
|
1096
1097
|
};
|
|
1097
|
-
let
|
|
1098
|
-
function Ns(r) {
|
|
1099
|
-
w.container = r, ks(), js(),
|
|
1098
|
+
let ht = !1, Ae = !1, be = null, bt = null, it = null, we = [];
|
|
1099
|
+
function Ns(r, e = "edit", t) {
|
|
1100
|
+
w.container = r, w.mode = e, ks(), js(), t ? ei(t, e) : Hs(), zs(), Us(), Qs(), mn(), e === "edit" && r.addEventListener("click", Ys), window.addEventListener("resize", Xs), t || Gs(), e === "edit" && Fs();
|
|
1100
1101
|
}
|
|
1101
1102
|
function ks() {
|
|
1102
|
-
const r = new
|
|
1103
|
+
const r = new F.WebGLRenderer({ antialias: !0, alpha: !0 });
|
|
1103
1104
|
r.setSize(w.container.clientWidth, w.container.clientHeight), r.setPixelRatio(Math.min(window.devicePixelRatio, 2)), w.container.appendChild(r.domElement), w.renderer = r;
|
|
1104
1105
|
}
|
|
1105
1106
|
function js() {
|
|
1106
|
-
w.scene = new
|
|
1107
|
-
}
|
|
1108
|
-
function Hs() {
|
|
1109
|
-
const r = new N.GridHelper(30, 30, 8956671, 3364232);
|
|
1110
|
-
r.name = "地板", w.scene.add(r), w.gridHelper = r;
|
|
1107
|
+
w.scene = new F.Scene(), w.scene.name = "sl_scene";
|
|
1111
1108
|
}
|
|
1112
1109
|
function Fs() {
|
|
1113
|
-
const r =
|
|
1110
|
+
const r = new F.GridHelper(30, 30, 8956671, 3364232);
|
|
1111
|
+
r.name = "地板", r.userData.type = "initFloor", w.scene.add(r), w.gridHelper = r;
|
|
1112
|
+
}
|
|
1113
|
+
function Hs() {
|
|
1114
|
+
const r = w.container, e = r.clientWidth / r.clientHeight, t = new F.PerspectiveCamera(45, e, 0.1, 1e3);
|
|
1114
1115
|
t.position.set(0, 6, 15), t.lookAt(0, 0, 0), w.camera = t;
|
|
1115
1116
|
}
|
|
1116
1117
|
function Us() {
|
|
1117
1118
|
const r = new ps(w.camera, w.renderer.domElement);
|
|
1118
1119
|
r.minDistance = 0, r.maxDistance = 1 / 0, r.addEventListener("start", () => {
|
|
1119
|
-
|
|
1120
|
+
ht = !1;
|
|
1120
1121
|
}), r.addEventListener("change", () => {
|
|
1121
|
-
|
|
1122
|
+
ht = !0;
|
|
1122
1123
|
}), r.addEventListener("end", () => {
|
|
1123
|
-
|
|
1124
|
-
|
|
1124
|
+
ht && (Ae = !0, setTimeout(() => {
|
|
1125
|
+
Ae = !1;
|
|
1125
1126
|
}, 200));
|
|
1126
1127
|
}), w.orbitControls = r;
|
|
1127
1128
|
}
|
|
1128
1129
|
function zs() {
|
|
1129
|
-
const r = new
|
|
1130
|
+
const r = new Ss(
|
|
1130
1131
|
w.camera,
|
|
1131
1132
|
w.renderer.domElement
|
|
1132
1133
|
);
|
|
1133
1134
|
r.addEventListener("dragging-changed", (e) => {
|
|
1134
|
-
w.orbitControls.enabled = !e.value, e.value || (
|
|
1135
|
-
|
|
1135
|
+
w.orbitControls.enabled = !e.value, e.value || (Ae = !0, setTimeout(() => {
|
|
1136
|
+
Ae = !1;
|
|
1136
1137
|
}, 200));
|
|
1137
1138
|
}), r.addEventListener("objectChange", () => {
|
|
1138
|
-
|
|
1139
|
+
bt && w.selectedObject && bt(w.selectedObject);
|
|
1139
1140
|
}), w.scene.add(r.getHelper()), w.transformControls = r;
|
|
1140
1141
|
}
|
|
1141
1142
|
function Gs() {
|
|
1142
|
-
const r = new
|
|
1143
|
+
const r = new F.AmbientLight(16777215, 2);
|
|
1143
1144
|
w.scene.add(r);
|
|
1144
|
-
const e = new
|
|
1145
|
+
const e = new F.DirectionalLight(16777215, 3);
|
|
1145
1146
|
e.position.set(48, 104, 138), w.scene.add(e);
|
|
1146
|
-
const t = new N.BoxGeometry(1, 1, 1), s = new N.MeshStandardMaterial({ color: 16777215 }), n = new N.Mesh(t, s);
|
|
1147
|
-
n.position.y = 1, n.userData.isMovable = !0, n.name = "默认立方体", nt(n, !0);
|
|
1148
1147
|
}
|
|
1149
|
-
function
|
|
1148
|
+
function mn() {
|
|
1150
1149
|
var r, e;
|
|
1151
|
-
requestAnimationFrame(
|
|
1150
|
+
requestAnimationFrame(mn), us.update(), (r = w.orbitControls) == null || r.update(), (e = w.renderer) == null || e.render(w.scene, w.camera);
|
|
1152
1151
|
}
|
|
1153
1152
|
function Xs() {
|
|
1154
1153
|
if (!w.container || !w.camera || !w.renderer) return;
|
|
1155
1154
|
const r = w.container.clientWidth, e = w.container.clientHeight;
|
|
1156
1155
|
r === 0 || e === 0 || (w.camera.aspect = r / e, w.camera.updateProjectionMatrix(), w.renderer.setSize(r, e));
|
|
1157
1156
|
}
|
|
1158
|
-
function
|
|
1159
|
-
w.selectedObject !== r && (w.selectedObject && w.transformControls.detach(), w.selectedObject = r, w.transformControls.attach(r), w.transformControls.setMode("translate"), w.transformControls.showX = !0, w.transformControls.showY = !0, w.transformControls.showZ = !0,
|
|
1157
|
+
function Mt(r) {
|
|
1158
|
+
w.selectedObject !== r && (w.selectedObject && w.transformControls.detach(), w.selectedObject = r, w.transformControls.attach(r), w.transformControls.setMode("translate"), w.transformControls.showX = !0, w.transformControls.showY = !0, w.transformControls.showZ = !0, be == null || be(r));
|
|
1160
1159
|
}
|
|
1161
|
-
function
|
|
1162
|
-
w.selectedObject && (w.transformControls.detach(), w.selectedObject = null,
|
|
1160
|
+
function gn() {
|
|
1161
|
+
w.selectedObject && (w.transformControls.detach(), w.selectedObject = null, be == null || be(null));
|
|
1163
1162
|
}
|
|
1164
1163
|
function Ys(r) {
|
|
1165
|
-
if (
|
|
1166
|
-
|
|
1164
|
+
if (Ae) {
|
|
1165
|
+
Ae = !1;
|
|
1167
1166
|
return;
|
|
1168
1167
|
}
|
|
1169
|
-
const e = w.renderer.domElement.getBoundingClientRect(), t = new
|
|
1168
|
+
const e = w.renderer.domElement.getBoundingClientRect(), t = new F.Vector2(
|
|
1170
1169
|
(r.clientX - e.left) / e.width * 2 - 1,
|
|
1171
1170
|
-((r.clientY - e.top) / e.height) * 2 + 1
|
|
1172
|
-
), s = new
|
|
1171
|
+
), s = new F.Raycaster();
|
|
1173
1172
|
s.setFromCamera(t, w.camera);
|
|
1174
1173
|
const n = [];
|
|
1175
1174
|
w.scene.traverse((o) => {
|
|
1176
1175
|
o.type === "Mesh" && o.userData.isMovable && n.push(o);
|
|
1177
1176
|
});
|
|
1178
1177
|
const i = s.intersectObjects(n);
|
|
1179
|
-
i.length > 0 ?
|
|
1178
|
+
i.length > 0 ? Mt(i[0].object) : gn();
|
|
1180
1179
|
}
|
|
1181
|
-
function
|
|
1182
|
-
w.scene.add(r), r.userData.isMovable && (Vs(r),
|
|
1180
|
+
function vt(r, e = !1) {
|
|
1181
|
+
w.scene.add(r), r.userData.isMovable && (Vs(r), St()), e && w.mode === "edit" && Mt(r);
|
|
1183
1182
|
}
|
|
1184
1183
|
function Bs(r) {
|
|
1185
|
-
w.selectedObject === r &&
|
|
1184
|
+
w.selectedObject === r && gn(), r.parent ? r.parent.remove(r) : w.scene.remove(r), Zs(r), St();
|
|
1186
1185
|
}
|
|
1187
1186
|
function Ks(r) {
|
|
1188
1187
|
const e = w.scene.getObjectByProperty("uuid", r);
|
|
1189
1188
|
e && Bs(e);
|
|
1190
1189
|
}
|
|
1191
1190
|
function Vs(r) {
|
|
1192
|
-
r.userData.isMovable && r.parent === w.scene && (
|
|
1191
|
+
r.userData.isMovable && r.parent === w.scene && (we.includes(r) || we.push(r));
|
|
1193
1192
|
}
|
|
1194
1193
|
function Zs(r) {
|
|
1195
|
-
const e =
|
|
1196
|
-
e !== -1 &&
|
|
1194
|
+
const e = we.indexOf(r);
|
|
1195
|
+
e !== -1 && we.splice(e, 1);
|
|
1197
1196
|
}
|
|
1198
1197
|
function Qs() {
|
|
1199
1198
|
const r = [];
|
|
1200
1199
|
w.scene.children.forEach((e) => {
|
|
1201
1200
|
e.userData.isMovable && r.push(e);
|
|
1202
|
-
}),
|
|
1201
|
+
}), we = r, St();
|
|
1203
1202
|
}
|
|
1204
|
-
function
|
|
1205
|
-
|
|
1203
|
+
function St() {
|
|
1204
|
+
it == null || it([...we]);
|
|
1206
1205
|
}
|
|
1207
1206
|
function qs(r) {
|
|
1208
|
-
|
|
1207
|
+
be = r;
|
|
1209
1208
|
}
|
|
1210
1209
|
function Ws(r) {
|
|
1211
|
-
|
|
1210
|
+
bt = r;
|
|
1212
1211
|
}
|
|
1213
1212
|
function $s(r) {
|
|
1214
|
-
|
|
1213
|
+
it = r;
|
|
1215
1214
|
}
|
|
1216
1215
|
function Js() {
|
|
1217
|
-
return
|
|
1216
|
+
return we;
|
|
1218
1217
|
}
|
|
1219
|
-
function
|
|
1218
|
+
function Go() {
|
|
1220
1219
|
return w.scene;
|
|
1221
1220
|
}
|
|
1222
|
-
function
|
|
1221
|
+
function Xo() {
|
|
1223
1222
|
return w.camera;
|
|
1224
1223
|
}
|
|
1225
|
-
function
|
|
1224
|
+
function Yo() {
|
|
1226
1225
|
return w.renderer;
|
|
1227
1226
|
}
|
|
1228
|
-
|
|
1229
|
-
|
|
1227
|
+
function Bo() {
|
|
1228
|
+
const r = w.scene;
|
|
1229
|
+
if (!r) return "{}";
|
|
1230
|
+
let e = r;
|
|
1231
|
+
e = r.clone(), e.children = e.children.filter(
|
|
1232
|
+
(s) => s.userData.type === "initFloor"
|
|
1233
|
+
);
|
|
1234
|
+
const t = e.toJSON();
|
|
1235
|
+
return JSON.stringify(t, null);
|
|
1236
|
+
}
|
|
1237
|
+
function ei(r, e = "edit") {
|
|
1238
|
+
var i;
|
|
1239
|
+
const t = typeof r == "string" ? JSON.parse(r) : r, n = new F.ObjectLoader().parse(t);
|
|
1240
|
+
n.type === "scene" ? w.scene = n : (i = w.scene) == null || i.add(n);
|
|
1241
|
+
}
|
|
1242
|
+
const ti = /^[og]\s*(.+)?/, ni = /^mtllib /, si = /^usemtl /, ii = /^usemap /, Yt = /\s+/, Bt = new M(), ut = new M(), Kt = new M(), Vt = new M(), q = new M(), et = new pe();
|
|
1243
|
+
function oi() {
|
|
1230
1244
|
const r = {
|
|
1231
1245
|
objects: [],
|
|
1232
1246
|
object: {},
|
|
@@ -1335,7 +1349,7 @@ function ii() {
|
|
|
1335
1349
|
},
|
|
1336
1350
|
addFaceNormal: function(e, t, s) {
|
|
1337
1351
|
const n = this.vertices, i = this.object.geometry.normals;
|
|
1338
|
-
|
|
1352
|
+
Bt.fromArray(n, e), ut.fromArray(n, t), Kt.fromArray(n, s), q.subVectors(Kt, ut), Vt.subVectors(Bt, ut), q.cross(Vt), q.normalize(), i.push(q.x, q.y, q.z), i.push(q.x, q.y, q.z), i.push(q.x, q.y, q.z);
|
|
1339
1353
|
},
|
|
1340
1354
|
addColor: function(e, t, s) {
|
|
1341
1355
|
const n = this.colors, i = this.object.geometry.colors;
|
|
@@ -1355,15 +1369,15 @@ function ii() {
|
|
|
1355
1369
|
},
|
|
1356
1370
|
addFace: function(e, t, s, n, i, o, a, l, h) {
|
|
1357
1371
|
const u = this.vertices.length;
|
|
1358
|
-
let c = this.parseVertexIndex(e, u),
|
|
1359
|
-
if (this.addVertex(c,
|
|
1360
|
-
const
|
|
1361
|
-
c = this.parseNormalIndex(a,
|
|
1372
|
+
let c = this.parseVertexIndex(e, u), p = this.parseVertexIndex(t, u), m = this.parseVertexIndex(s, u);
|
|
1373
|
+
if (this.addVertex(c, p, m), this.addColor(c, p, m), a !== void 0 && a !== "") {
|
|
1374
|
+
const b = this.normals.length;
|
|
1375
|
+
c = this.parseNormalIndex(a, b), p = this.parseNormalIndex(l, b), m = this.parseNormalIndex(h, b), this.addNormal(c, p, m);
|
|
1362
1376
|
} else
|
|
1363
|
-
this.addFaceNormal(c,
|
|
1377
|
+
this.addFaceNormal(c, p, m);
|
|
1364
1378
|
if (n !== void 0 && n !== "") {
|
|
1365
|
-
const
|
|
1366
|
-
c = this.parseUVIndex(n,
|
|
1379
|
+
const b = this.uvs.length;
|
|
1380
|
+
c = this.parseUVIndex(n, b), p = this.parseUVIndex(i, b), m = this.parseUVIndex(o, b), this.addUV(c, p, m), this.object.geometry.hasUVIndices = !0;
|
|
1367
1381
|
} else
|
|
1368
1382
|
this.addDefaultUV();
|
|
1369
1383
|
},
|
|
@@ -1386,7 +1400,7 @@ function ii() {
|
|
|
1386
1400
|
};
|
|
1387
1401
|
return r.startObject("", !1), r;
|
|
1388
1402
|
}
|
|
1389
|
-
class
|
|
1403
|
+
class ri extends ln {
|
|
1390
1404
|
/**
|
|
1391
1405
|
* Constructs a new OBJ loader.
|
|
1392
1406
|
*
|
|
@@ -1405,7 +1419,7 @@ class oi extends rn {
|
|
|
1405
1419
|
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
1406
1420
|
*/
|
|
1407
1421
|
load(e, t, s, n) {
|
|
1408
|
-
const i = this, o = new
|
|
1422
|
+
const i = this, o = new xt(this.manager);
|
|
1409
1423
|
o.setPath(this.path), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(e, function(a) {
|
|
1410
1424
|
try {
|
|
1411
1425
|
t(i.parse(a));
|
|
@@ -1430,7 +1444,7 @@ class oi extends rn {
|
|
|
1430
1444
|
* @return {Group} The parsed OBJ.
|
|
1431
1445
|
*/
|
|
1432
1446
|
parse(e) {
|
|
1433
|
-
const t = new
|
|
1447
|
+
const t = new oi();
|
|
1434
1448
|
e.indexOf(`\r
|
|
1435
1449
|
`) !== -1 && (e = e.replace(/\r\n/g, `
|
|
1436
1450
|
`)), e.indexOf(`\\
|
|
@@ -1444,19 +1458,19 @@ class oi extends rn {
|
|
|
1444
1458
|
const u = h.charAt(0);
|
|
1445
1459
|
if (u !== "#")
|
|
1446
1460
|
if (u === "v") {
|
|
1447
|
-
const c = h.split(
|
|
1461
|
+
const c = h.split(Yt);
|
|
1448
1462
|
switch (c[0]) {
|
|
1449
1463
|
case "v":
|
|
1450
1464
|
t.vertices.push(
|
|
1451
1465
|
parseFloat(c[1]),
|
|
1452
1466
|
parseFloat(c[2]),
|
|
1453
1467
|
parseFloat(c[3])
|
|
1454
|
-
), c.length >= 7 ? (
|
|
1468
|
+
), c.length >= 7 ? (et.setRGB(
|
|
1455
1469
|
parseFloat(c[4]),
|
|
1456
1470
|
parseFloat(c[5]),
|
|
1457
1471
|
parseFloat(c[6]),
|
|
1458
|
-
|
|
1459
|
-
), t.colors.push(
|
|
1472
|
+
Re
|
|
1473
|
+
), t.colors.push(et.r, et.g, et.b)) : t.colors.push(void 0, void 0, void 0);
|
|
1460
1474
|
break;
|
|
1461
1475
|
case "vn":
|
|
1462
1476
|
t.normals.push(
|
|
@@ -1473,57 +1487,57 @@ class oi extends rn {
|
|
|
1473
1487
|
break;
|
|
1474
1488
|
}
|
|
1475
1489
|
} else if (u === "f") {
|
|
1476
|
-
const
|
|
1477
|
-
for (let
|
|
1478
|
-
const
|
|
1479
|
-
if (
|
|
1480
|
-
const
|
|
1481
|
-
|
|
1490
|
+
const p = h.slice(1).trim().split(Yt), m = [];
|
|
1491
|
+
for (let f = 0, y = p.length; f < y; f++) {
|
|
1492
|
+
const d = p[f];
|
|
1493
|
+
if (d.length > 0) {
|
|
1494
|
+
const _ = d.split("/");
|
|
1495
|
+
m.push(_);
|
|
1482
1496
|
}
|
|
1483
1497
|
}
|
|
1484
|
-
const
|
|
1485
|
-
for (let
|
|
1486
|
-
const
|
|
1498
|
+
const b = m[0];
|
|
1499
|
+
for (let f = 1, y = m.length - 1; f < y; f++) {
|
|
1500
|
+
const d = m[f], _ = m[f + 1];
|
|
1487
1501
|
t.addFace(
|
|
1488
|
-
|
|
1502
|
+
b[0],
|
|
1503
|
+
d[0],
|
|
1489
1504
|
_[0],
|
|
1490
|
-
|
|
1491
|
-
|
|
1505
|
+
b[1],
|
|
1506
|
+
d[1],
|
|
1492
1507
|
_[1],
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
_[2]
|
|
1496
|
-
x[2]
|
|
1508
|
+
b[2],
|
|
1509
|
+
d[2],
|
|
1510
|
+
_[2]
|
|
1497
1511
|
);
|
|
1498
1512
|
}
|
|
1499
1513
|
} else if (u === "l") {
|
|
1500
1514
|
const c = h.substring(1).trim().split(" ");
|
|
1501
|
-
let
|
|
1502
|
-
const
|
|
1515
|
+
let p = [];
|
|
1516
|
+
const m = [];
|
|
1503
1517
|
if (h.indexOf("/") === -1)
|
|
1504
|
-
|
|
1518
|
+
p = c;
|
|
1505
1519
|
else
|
|
1506
|
-
for (let
|
|
1507
|
-
const y = c[
|
|
1508
|
-
y[0] !== "" &&
|
|
1520
|
+
for (let b = 0, f = c.length; b < f; b++) {
|
|
1521
|
+
const y = c[b].split("/");
|
|
1522
|
+
y[0] !== "" && p.push(y[0]), y[1] !== "" && m.push(y[1]);
|
|
1509
1523
|
}
|
|
1510
|
-
t.addLineGeometry(
|
|
1524
|
+
t.addLineGeometry(p, m);
|
|
1511
1525
|
} else if (u === "p") {
|
|
1512
|
-
const
|
|
1513
|
-
t.addPointGeometry(
|
|
1514
|
-
} else if ((n =
|
|
1526
|
+
const p = h.slice(1).trim().split(" ");
|
|
1527
|
+
t.addPointGeometry(p);
|
|
1528
|
+
} else if ((n = ti.exec(h)) !== null) {
|
|
1515
1529
|
const c = (" " + n[0].slice(1).trim()).slice(1);
|
|
1516
1530
|
t.startObject(c);
|
|
1517
|
-
} else if (
|
|
1531
|
+
} else if (si.test(h))
|
|
1518
1532
|
t.object.startMaterial(h.substring(7).trim(), t.materialLibraries);
|
|
1519
|
-
else if (
|
|
1533
|
+
else if (ni.test(h))
|
|
1520
1534
|
t.materialLibraries.push(h.substring(7).trim());
|
|
1521
|
-
else if (
|
|
1535
|
+
else if (ii.test(h))
|
|
1522
1536
|
console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');
|
|
1523
1537
|
else if (u === "s") {
|
|
1524
1538
|
if (n = h.split(" "), n.length > 1) {
|
|
1525
|
-
const
|
|
1526
|
-
t.object.smooth =
|
|
1539
|
+
const p = n[1].trim().toLowerCase();
|
|
1540
|
+
t.object.smooth = p !== "0" && p !== "off";
|
|
1527
1541
|
} else
|
|
1528
1542
|
t.object.smooth = !0;
|
|
1529
1543
|
const c = t.object.currentMaterial();
|
|
@@ -1534,53 +1548,53 @@ class oi extends rn {
|
|
|
1534
1548
|
}
|
|
1535
1549
|
}
|
|
1536
1550
|
t.finalize();
|
|
1537
|
-
const i = new
|
|
1551
|
+
const i = new tt();
|
|
1538
1552
|
if (i.materialLibraries = [].concat(t.materialLibraries), !(t.objects.length === 1 && t.objects[0].geometry.vertices.length === 0) === !0)
|
|
1539
1553
|
for (let a = 0, l = t.objects.length; a < l; a++) {
|
|
1540
|
-
const h = t.objects[a], u = h.geometry, c = h.materials,
|
|
1541
|
-
let
|
|
1554
|
+
const h = t.objects[a], u = h.geometry, c = h.materials, p = u.type === "Line", m = u.type === "Points";
|
|
1555
|
+
let b = !1;
|
|
1542
1556
|
if (u.vertices.length === 0) continue;
|
|
1543
|
-
const
|
|
1544
|
-
|
|
1557
|
+
const f = new ze();
|
|
1558
|
+
f.setAttribute("position", new ue(u.vertices, 3)), u.normals.length > 0 && f.setAttribute("normal", new ue(u.normals, 3)), u.colors.length > 0 && (b = !0, f.setAttribute("color", new ue(u.colors, 3))), u.hasUVIndices === !0 && f.setAttribute("uv", new ue(u.uvs, 2));
|
|
1545
1559
|
const y = [];
|
|
1546
|
-
for (let
|
|
1547
|
-
const S = c[
|
|
1548
|
-
let v = t.materials[
|
|
1560
|
+
for (let _ = 0, x = c.length; _ < x; _++) {
|
|
1561
|
+
const S = c[_], A = S.name + "_" + S.smooth + "_" + b;
|
|
1562
|
+
let v = t.materials[A];
|
|
1549
1563
|
if (this.materials !== null) {
|
|
1550
|
-
if (v = this.materials.create(S.name),
|
|
1551
|
-
const I = new
|
|
1552
|
-
|
|
1553
|
-
} else if (
|
|
1554
|
-
const I = new
|
|
1555
|
-
|
|
1564
|
+
if (v = this.materials.create(S.name), p && v && !(v instanceof ke)) {
|
|
1565
|
+
const I = new ke();
|
|
1566
|
+
je.prototype.copy.call(I, v), I.color.copy(v.color), v = I;
|
|
1567
|
+
} else if (m && v && !(v instanceof Ce)) {
|
|
1568
|
+
const I = new Ce({ size: 10, sizeAttenuation: !1 });
|
|
1569
|
+
je.prototype.copy.call(I, v), I.color.copy(v.color), I.map = v.map, v = I;
|
|
1556
1570
|
}
|
|
1557
1571
|
}
|
|
1558
|
-
v === void 0 && (
|
|
1572
|
+
v === void 0 && (p ? v = new ke() : m ? v = new Ce({ size: 1, sizeAttenuation: !1 }) : v = new kn(), v.name = S.name, v.flatShading = !S.smooth, v.vertexColors = b, t.materials[A] = v), y.push(v);
|
|
1559
1573
|
}
|
|
1560
|
-
let
|
|
1574
|
+
let d;
|
|
1561
1575
|
if (y.length > 1) {
|
|
1562
|
-
for (let
|
|
1563
|
-
const S = c[
|
|
1564
|
-
|
|
1576
|
+
for (let _ = 0, x = c.length; _ < x; _++) {
|
|
1577
|
+
const S = c[_];
|
|
1578
|
+
f.addGroup(S.groupStart, S.groupCount, _);
|
|
1565
1579
|
}
|
|
1566
|
-
|
|
1580
|
+
p ? d = new mt(f, y) : m ? d = new nt(f, y) : d = new T(f, y);
|
|
1567
1581
|
} else
|
|
1568
|
-
|
|
1569
|
-
|
|
1582
|
+
p ? d = new mt(f, y[0]) : m ? d = new nt(f, y[0]) : d = new T(f, y[0]);
|
|
1583
|
+
d.name = h.name, i.add(d);
|
|
1570
1584
|
}
|
|
1571
1585
|
else if (t.vertices.length > 0) {
|
|
1572
|
-
const a = new
|
|
1573
|
-
l.setAttribute("position", new
|
|
1574
|
-
const h = new
|
|
1586
|
+
const a = new Ce({ size: 1, sizeAttenuation: !1 }), l = new ze();
|
|
1587
|
+
l.setAttribute("position", new ue(t.vertices, 3)), t.colors.length > 0 && t.colors[0] !== void 0 && (l.setAttribute("color", new ue(t.colors, 3)), a.vertexColors = !0);
|
|
1588
|
+
const h = new nt(l, a);
|
|
1575
1589
|
i.add(h);
|
|
1576
1590
|
}
|
|
1577
1591
|
return i;
|
|
1578
1592
|
}
|
|
1579
1593
|
}
|
|
1580
|
-
function
|
|
1594
|
+
function Zt(r, e) {
|
|
1581
1595
|
if (e === jn)
|
|
1582
1596
|
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), r;
|
|
1583
|
-
if (e ===
|
|
1597
|
+
if (e === gt || e === cn) {
|
|
1584
1598
|
let t = r.getIndex();
|
|
1585
1599
|
if (t === null) {
|
|
1586
1600
|
const o = [], a = r.getAttribute("position");
|
|
@@ -1592,7 +1606,7 @@ function Kt(r, e) {
|
|
|
1592
1606
|
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), r;
|
|
1593
1607
|
}
|
|
1594
1608
|
const s = t.count - 2, n = [];
|
|
1595
|
-
if (e ===
|
|
1609
|
+
if (e === gt)
|
|
1596
1610
|
for (let o = 1; o <= s; o++)
|
|
1597
1611
|
n.push(t.getX(0)), n.push(t.getX(o)), n.push(t.getX(o + 1));
|
|
1598
1612
|
else
|
|
@@ -1604,9 +1618,9 @@ function Kt(r, e) {
|
|
|
1604
1618
|
} else
|
|
1605
1619
|
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e), r;
|
|
1606
1620
|
}
|
|
1607
|
-
function
|
|
1621
|
+
function ai(r) {
|
|
1608
1622
|
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), s = r.clone();
|
|
1609
|
-
return
|
|
1623
|
+
return yn(r, s, function(n, i) {
|
|
1610
1624
|
e.set(i, n), t.set(n, i);
|
|
1611
1625
|
}), s.traverse(function(n) {
|
|
1612
1626
|
if (!n.isSkinnedMesh) return;
|
|
@@ -1616,12 +1630,12 @@ function ri(r) {
|
|
|
1616
1630
|
}), i.bind(i.skeleton, i.bindMatrix);
|
|
1617
1631
|
}), s;
|
|
1618
1632
|
}
|
|
1619
|
-
function
|
|
1633
|
+
function yn(r, e, t) {
|
|
1620
1634
|
t(r, e);
|
|
1621
1635
|
for (let s = 0; s < r.children.length; s++)
|
|
1622
|
-
|
|
1636
|
+
yn(r.children[s], e.children[s], t);
|
|
1623
1637
|
}
|
|
1624
|
-
class
|
|
1638
|
+
class li extends ln {
|
|
1625
1639
|
/**
|
|
1626
1640
|
* Constructs a new glTF loader.
|
|
1627
1641
|
*
|
|
@@ -1629,39 +1643,39 @@ class ai extends rn {
|
|
|
1629
1643
|
*/
|
|
1630
1644
|
constructor(e) {
|
|
1631
1645
|
super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(t) {
|
|
1632
|
-
return new di(t);
|
|
1633
|
-
}), this.register(function(t) {
|
|
1634
1646
|
return new pi(t);
|
|
1635
1647
|
}), this.register(function(t) {
|
|
1636
|
-
return new
|
|
1648
|
+
return new fi(t);
|
|
1637
1649
|
}), this.register(function(t) {
|
|
1638
1650
|
return new Ei(t);
|
|
1639
1651
|
}), this.register(function(t) {
|
|
1640
1652
|
return new Mi(t);
|
|
1641
1653
|
}), this.register(function(t) {
|
|
1642
|
-
return new
|
|
1654
|
+
return new vi(t);
|
|
1643
1655
|
}), this.register(function(t) {
|
|
1644
1656
|
return new gi(t);
|
|
1645
1657
|
}), this.register(function(t) {
|
|
1646
1658
|
return new yi(t);
|
|
1647
1659
|
}), this.register(function(t) {
|
|
1648
1660
|
return new _i(t);
|
|
1649
|
-
}), this.register(function(t) {
|
|
1650
|
-
return new ui(t);
|
|
1651
1661
|
}), this.register(function(t) {
|
|
1652
1662
|
return new bi(t);
|
|
1653
1663
|
}), this.register(function(t) {
|
|
1654
|
-
return new
|
|
1655
|
-
}), this.register(function(t) {
|
|
1656
|
-
return new Ti(t);
|
|
1664
|
+
return new di(t);
|
|
1657
1665
|
}), this.register(function(t) {
|
|
1658
1666
|
return new wi(t);
|
|
1659
1667
|
}), this.register(function(t) {
|
|
1660
|
-
return new
|
|
1668
|
+
return new mi(t);
|
|
1669
|
+
}), this.register(function(t) {
|
|
1670
|
+
return new xi(t);
|
|
1671
|
+
}), this.register(function(t) {
|
|
1672
|
+
return new Ti(t);
|
|
1673
|
+
}), this.register(function(t) {
|
|
1674
|
+
return new hi(t);
|
|
1661
1675
|
}), this.register(function(t) {
|
|
1662
|
-
return new
|
|
1676
|
+
return new Qt(t, R.EXT_MESHOPT_COMPRESSION);
|
|
1663
1677
|
}), this.register(function(t) {
|
|
1664
|
-
return new
|
|
1678
|
+
return new Qt(t, R.KHR_MESHOPT_COMPRESSION);
|
|
1665
1679
|
}), this.register(function(t) {
|
|
1666
1680
|
return new Si(t);
|
|
1667
1681
|
});
|
|
@@ -1681,14 +1695,14 @@ class ai extends rn {
|
|
|
1681
1695
|
if (this.resourcePath !== "")
|
|
1682
1696
|
o = this.resourcePath;
|
|
1683
1697
|
else if (this.path !== "") {
|
|
1684
|
-
const h =
|
|
1685
|
-
o =
|
|
1698
|
+
const h = Fe.extractUrlBase(e);
|
|
1699
|
+
o = Fe.resolveURL(h, this.path);
|
|
1686
1700
|
} else
|
|
1687
|
-
o =
|
|
1701
|
+
o = Fe.extractUrlBase(e);
|
|
1688
1702
|
this.manager.itemStart(e);
|
|
1689
1703
|
const a = function(h) {
|
|
1690
1704
|
n ? n(h) : console.error(h), i.manager.itemError(e), i.manager.itemEnd(e);
|
|
1691
|
-
}, l = new
|
|
1705
|
+
}, l = new xt(this.manager);
|
|
1692
1706
|
l.setPath(this.path), l.setResponseType("arraybuffer"), l.setRequestHeader(this.requestHeader), l.setWithCredentials(this.withCredentials), l.load(e, function(h) {
|
|
1693
1707
|
try {
|
|
1694
1708
|
i.parse(h, o, function(u) {
|
|
@@ -1763,9 +1777,9 @@ class ai extends rn {
|
|
|
1763
1777
|
if (typeof e == "string")
|
|
1764
1778
|
i = JSON.parse(e);
|
|
1765
1779
|
else if (e instanceof ArrayBuffer)
|
|
1766
|
-
if (l.decode(new Uint8Array(e, 0, 4)) ===
|
|
1780
|
+
if (l.decode(new Uint8Array(e, 0, 4)) === _n) {
|
|
1767
1781
|
try {
|
|
1768
|
-
o[R.KHR_BINARY_GLTF] = new
|
|
1782
|
+
o[R.KHR_BINARY_GLTF] = new Ri(e);
|
|
1769
1783
|
} catch (c) {
|
|
1770
1784
|
n && n(c);
|
|
1771
1785
|
return;
|
|
@@ -1779,7 +1793,7 @@ class ai extends rn {
|
|
|
1779
1793
|
n && n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
|
|
1780
1794
|
return;
|
|
1781
1795
|
}
|
|
1782
|
-
const h = new
|
|
1796
|
+
const h = new Ui(i, {
|
|
1783
1797
|
path: t || this.resourcePath || "",
|
|
1784
1798
|
crossOrigin: this.crossOrigin,
|
|
1785
1799
|
requestHeader: this.requestHeader,
|
|
@@ -1794,22 +1808,22 @@ class ai extends rn {
|
|
|
1794
1808
|
}
|
|
1795
1809
|
if (i.extensionsUsed)
|
|
1796
1810
|
for (let u = 0; u < i.extensionsUsed.length; ++u) {
|
|
1797
|
-
const c = i.extensionsUsed[u],
|
|
1811
|
+
const c = i.extensionsUsed[u], p = i.extensionsRequired || [];
|
|
1798
1812
|
switch (c) {
|
|
1799
1813
|
case R.KHR_MATERIALS_UNLIT:
|
|
1800
|
-
o[c] = new
|
|
1814
|
+
o[c] = new ui();
|
|
1801
1815
|
break;
|
|
1802
1816
|
case R.KHR_DRACO_MESH_COMPRESSION:
|
|
1803
|
-
o[c] = new
|
|
1817
|
+
o[c] = new Ai(i, this.dracoLoader);
|
|
1804
1818
|
break;
|
|
1805
1819
|
case R.KHR_TEXTURE_TRANSFORM:
|
|
1806
|
-
o[c] = new
|
|
1820
|
+
o[c] = new Pi();
|
|
1807
1821
|
break;
|
|
1808
1822
|
case R.KHR_MESH_QUANTIZATION:
|
|
1809
|
-
o[c] = new
|
|
1823
|
+
o[c] = new Li();
|
|
1810
1824
|
break;
|
|
1811
1825
|
default:
|
|
1812
|
-
|
|
1826
|
+
p.indexOf(c) >= 0 && a[c] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + c + '".');
|
|
1813
1827
|
}
|
|
1814
1828
|
}
|
|
1815
1829
|
h.setExtensions(o), h.setPlugins(a), h.parse(s, n);
|
|
@@ -1829,7 +1843,7 @@ class ai extends rn {
|
|
|
1829
1843
|
});
|
|
1830
1844
|
}
|
|
1831
1845
|
}
|
|
1832
|
-
function
|
|
1846
|
+
function ci() {
|
|
1833
1847
|
let r = {};
|
|
1834
1848
|
return {
|
|
1835
1849
|
get: function(e) {
|
|
@@ -1875,7 +1889,7 @@ const R = {
|
|
|
1875
1889
|
KHR_MESHOPT_COMPRESSION: "KHR_meshopt_compression",
|
|
1876
1890
|
EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing"
|
|
1877
1891
|
};
|
|
1878
|
-
class
|
|
1892
|
+
class hi {
|
|
1879
1893
|
constructor(e) {
|
|
1880
1894
|
this.parser = e, this.name = R.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
|
|
1881
1895
|
}
|
|
@@ -1892,7 +1906,7 @@ class ci {
|
|
|
1892
1906
|
if (n) return n;
|
|
1893
1907
|
const i = t.json, l = ((i.extensions && i.extensions[this.name] || {}).lights || [])[e];
|
|
1894
1908
|
let h;
|
|
1895
|
-
const u = new
|
|
1909
|
+
const u = new pe(16777215);
|
|
1896
1910
|
l.color !== void 0 && u.setRGB(l.color[0], l.color[1], l.color[2], ae);
|
|
1897
1911
|
const c = l.range !== void 0 ? l.range : 0;
|
|
1898
1912
|
switch (l.type) {
|
|
@@ -1900,15 +1914,15 @@ class ci {
|
|
|
1900
1914
|
h = new Un(u), h.target.position.set(0, 0, -1), h.add(h.target);
|
|
1901
1915
|
break;
|
|
1902
1916
|
case "point":
|
|
1903
|
-
h = new
|
|
1917
|
+
h = new Hn(u), h.distance = c;
|
|
1904
1918
|
break;
|
|
1905
1919
|
case "spot":
|
|
1906
|
-
h = new
|
|
1920
|
+
h = new Fn(u), h.distance = c, l.spot = l.spot || {}, l.spot.innerConeAngle = l.spot.innerConeAngle !== void 0 ? l.spot.innerConeAngle : 0, l.spot.outerConeAngle = l.spot.outerConeAngle !== void 0 ? l.spot.outerConeAngle : Math.PI / 4, h.angle = l.spot.outerConeAngle, h.penumbra = 1 - l.spot.innerConeAngle / l.spot.outerConeAngle, h.target.position.set(0, 0, -1), h.add(h.target);
|
|
1907
1921
|
break;
|
|
1908
1922
|
default:
|
|
1909
1923
|
throw new Error("THREE.GLTFLoader: Unexpected light type: " + l.type);
|
|
1910
1924
|
}
|
|
1911
|
-
return h.position.set(0, 0, 0),
|
|
1925
|
+
return h.position.set(0, 0, 0), ne(h, l), l.intensity !== void 0 && (h.intensity = l.intensity), h.name = t.createUniqueName(l.name || "light_" + e), n = Promise.resolve(h), t.cache.add(s, n), n;
|
|
1912
1926
|
}
|
|
1913
1927
|
getDependency(e, t) {
|
|
1914
1928
|
if (e === "light")
|
|
@@ -1921,28 +1935,28 @@ class ci {
|
|
|
1921
1935
|
});
|
|
1922
1936
|
}
|
|
1923
1937
|
}
|
|
1924
|
-
class
|
|
1938
|
+
class ui {
|
|
1925
1939
|
constructor() {
|
|
1926
1940
|
this.name = R.KHR_MATERIALS_UNLIT;
|
|
1927
1941
|
}
|
|
1928
1942
|
getMaterialType() {
|
|
1929
|
-
return
|
|
1943
|
+
return _e;
|
|
1930
1944
|
}
|
|
1931
1945
|
extendParams(e, t, s) {
|
|
1932
1946
|
const n = [];
|
|
1933
|
-
e.color = new
|
|
1947
|
+
e.color = new pe(1, 1, 1), e.opacity = 1;
|
|
1934
1948
|
const i = t.pbrMetallicRoughness;
|
|
1935
1949
|
if (i) {
|
|
1936
1950
|
if (Array.isArray(i.baseColorFactor)) {
|
|
1937
1951
|
const o = i.baseColorFactor;
|
|
1938
1952
|
e.color.setRGB(o[0], o[1], o[2], ae), e.opacity = o[3];
|
|
1939
1953
|
}
|
|
1940
|
-
i.baseColorTexture !== void 0 && n.push(s.assignTexture(e, "map", i.baseColorTexture,
|
|
1954
|
+
i.baseColorTexture !== void 0 && n.push(s.assignTexture(e, "map", i.baseColorTexture, Re));
|
|
1941
1955
|
}
|
|
1942
1956
|
return Promise.all(n);
|
|
1943
1957
|
}
|
|
1944
1958
|
}
|
|
1945
|
-
class
|
|
1959
|
+
class di {
|
|
1946
1960
|
constructor(e) {
|
|
1947
1961
|
this.parser = e, this.name = R.KHR_MATERIALS_EMISSIVE_STRENGTH;
|
|
1948
1962
|
}
|
|
@@ -1951,12 +1965,12 @@ class ui {
|
|
|
1951
1965
|
return s === null || s.emissiveStrength !== void 0 && (t.emissiveIntensity = s.emissiveStrength), Promise.resolve();
|
|
1952
1966
|
}
|
|
1953
1967
|
}
|
|
1954
|
-
class
|
|
1968
|
+
class pi {
|
|
1955
1969
|
constructor(e) {
|
|
1956
1970
|
this.parser = e, this.name = R.KHR_MATERIALS_CLEARCOAT;
|
|
1957
1971
|
}
|
|
1958
1972
|
getMaterialType(e) {
|
|
1959
|
-
return C(this.parser, e, this.name) !== null ?
|
|
1973
|
+
return C(this.parser, e, this.name) !== null ? se : null;
|
|
1960
1974
|
}
|
|
1961
1975
|
extendMaterialParams(e, t) {
|
|
1962
1976
|
const s = C(this.parser, e, this.name);
|
|
@@ -1964,29 +1978,29 @@ class di {
|
|
|
1964
1978
|
const n = [];
|
|
1965
1979
|
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)) {
|
|
1966
1980
|
const i = s.clearcoatNormalTexture.scale;
|
|
1967
|
-
t.clearcoatNormalScale = new
|
|
1981
|
+
t.clearcoatNormalScale = new V(i, i);
|
|
1968
1982
|
}
|
|
1969
1983
|
return Promise.all(n);
|
|
1970
1984
|
}
|
|
1971
1985
|
}
|
|
1972
|
-
class
|
|
1986
|
+
class fi {
|
|
1973
1987
|
constructor(e) {
|
|
1974
1988
|
this.parser = e, this.name = R.KHR_MATERIALS_DISPERSION;
|
|
1975
1989
|
}
|
|
1976
1990
|
getMaterialType(e) {
|
|
1977
|
-
return C(this.parser, e, this.name) !== null ?
|
|
1991
|
+
return C(this.parser, e, this.name) !== null ? se : null;
|
|
1978
1992
|
}
|
|
1979
1993
|
extendMaterialParams(e, t) {
|
|
1980
1994
|
const s = C(this.parser, e, this.name);
|
|
1981
1995
|
return s === null || (t.dispersion = s.dispersion !== void 0 ? s.dispersion : 0), Promise.resolve();
|
|
1982
1996
|
}
|
|
1983
1997
|
}
|
|
1984
|
-
class
|
|
1998
|
+
class mi {
|
|
1985
1999
|
constructor(e) {
|
|
1986
2000
|
this.parser = e, this.name = R.KHR_MATERIALS_IRIDESCENCE;
|
|
1987
2001
|
}
|
|
1988
2002
|
getMaterialType(e) {
|
|
1989
|
-
return C(this.parser, e, this.name) !== null ?
|
|
2003
|
+
return C(this.parser, e, this.name) !== null ? se : null;
|
|
1990
2004
|
}
|
|
1991
2005
|
extendMaterialParams(e, t) {
|
|
1992
2006
|
const s = C(this.parser, e, this.name);
|
|
@@ -1995,30 +2009,30 @@ class fi {
|
|
|
1995
2009
|
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);
|
|
1996
2010
|
}
|
|
1997
2011
|
}
|
|
1998
|
-
class
|
|
2012
|
+
class gi {
|
|
1999
2013
|
constructor(e) {
|
|
2000
2014
|
this.parser = e, this.name = R.KHR_MATERIALS_SHEEN;
|
|
2001
2015
|
}
|
|
2002
2016
|
getMaterialType(e) {
|
|
2003
|
-
return C(this.parser, e, this.name) !== null ?
|
|
2017
|
+
return C(this.parser, e, this.name) !== null ? se : null;
|
|
2004
2018
|
}
|
|
2005
2019
|
extendMaterialParams(e, t) {
|
|
2006
2020
|
const s = C(this.parser, e, this.name);
|
|
2007
2021
|
if (s === null) return Promise.resolve();
|
|
2008
2022
|
const n = [];
|
|
2009
|
-
if (t.sheenColor = new
|
|
2023
|
+
if (t.sheenColor = new pe(0, 0, 0), t.sheenRoughness = 0, t.sheen = 1, s.sheenColorFactor !== void 0) {
|
|
2010
2024
|
const i = s.sheenColorFactor;
|
|
2011
2025
|
t.sheenColor.setRGB(i[0], i[1], i[2], ae);
|
|
2012
2026
|
}
|
|
2013
|
-
return s.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = s.sheenRoughnessFactor), s.sheenColorTexture !== void 0 && n.push(this.parser.assignTexture(t, "sheenColorMap", s.sheenColorTexture,
|
|
2027
|
+
return s.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = s.sheenRoughnessFactor), s.sheenColorTexture !== void 0 && n.push(this.parser.assignTexture(t, "sheenColorMap", s.sheenColorTexture, Re)), s.sheenRoughnessTexture !== void 0 && n.push(this.parser.assignTexture(t, "sheenRoughnessMap", s.sheenRoughnessTexture)), Promise.all(n);
|
|
2014
2028
|
}
|
|
2015
2029
|
}
|
|
2016
|
-
class
|
|
2030
|
+
class yi {
|
|
2017
2031
|
constructor(e) {
|
|
2018
2032
|
this.parser = e, this.name = R.KHR_MATERIALS_TRANSMISSION;
|
|
2019
2033
|
}
|
|
2020
2034
|
getMaterialType(e) {
|
|
2021
|
-
return C(this.parser, e, this.name) !== null ?
|
|
2035
|
+
return C(this.parser, e, this.name) !== null ? se : null;
|
|
2022
2036
|
}
|
|
2023
2037
|
extendMaterialParams(e, t) {
|
|
2024
2038
|
const s = C(this.parser, e, this.name);
|
|
@@ -2027,12 +2041,12 @@ class gi {
|
|
|
2027
2041
|
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);
|
|
2028
2042
|
}
|
|
2029
2043
|
}
|
|
2030
|
-
class
|
|
2044
|
+
class _i {
|
|
2031
2045
|
constructor(e) {
|
|
2032
2046
|
this.parser = e, this.name = R.KHR_MATERIALS_VOLUME;
|
|
2033
2047
|
}
|
|
2034
2048
|
getMaterialType(e) {
|
|
2035
|
-
return C(this.parser, e, this.name) !== null ?
|
|
2049
|
+
return C(this.parser, e, this.name) !== null ? se : null;
|
|
2036
2050
|
}
|
|
2037
2051
|
extendMaterialParams(e, t) {
|
|
2038
2052
|
const s = C(this.parser, e, this.name);
|
|
@@ -2040,27 +2054,27 @@ class yi {
|
|
|
2040
2054
|
const n = [];
|
|
2041
2055
|
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;
|
|
2042
2056
|
const i = s.attenuationColor || [1, 1, 1];
|
|
2043
|
-
return t.attenuationColor = new
|
|
2057
|
+
return t.attenuationColor = new pe().setRGB(i[0], i[1], i[2], ae), Promise.all(n);
|
|
2044
2058
|
}
|
|
2045
2059
|
}
|
|
2046
|
-
class
|
|
2060
|
+
class bi {
|
|
2047
2061
|
constructor(e) {
|
|
2048
2062
|
this.parser = e, this.name = R.KHR_MATERIALS_IOR;
|
|
2049
2063
|
}
|
|
2050
2064
|
getMaterialType(e) {
|
|
2051
|
-
return C(this.parser, e, this.name) !== null ?
|
|
2065
|
+
return C(this.parser, e, this.name) !== null ? se : null;
|
|
2052
2066
|
}
|
|
2053
2067
|
extendMaterialParams(e, t) {
|
|
2054
2068
|
const s = C(this.parser, e, this.name);
|
|
2055
2069
|
return s === null || (t.ior = s.ior !== void 0 ? s.ior : 1.5, t.ior === 0 && (t.ior = 1e3)), Promise.resolve();
|
|
2056
2070
|
}
|
|
2057
2071
|
}
|
|
2058
|
-
class
|
|
2072
|
+
class wi {
|
|
2059
2073
|
constructor(e) {
|
|
2060
2074
|
this.parser = e, this.name = R.KHR_MATERIALS_SPECULAR;
|
|
2061
2075
|
}
|
|
2062
2076
|
getMaterialType(e) {
|
|
2063
|
-
return C(this.parser, e, this.name) !== null ?
|
|
2077
|
+
return C(this.parser, e, this.name) !== null ? se : null;
|
|
2064
2078
|
}
|
|
2065
2079
|
extendMaterialParams(e, t) {
|
|
2066
2080
|
const s = C(this.parser, e, this.name);
|
|
@@ -2068,15 +2082,15 @@ class bi {
|
|
|
2068
2082
|
const n = [];
|
|
2069
2083
|
t.specularIntensity = s.specularFactor !== void 0 ? s.specularFactor : 1, s.specularTexture !== void 0 && n.push(this.parser.assignTexture(t, "specularIntensityMap", s.specularTexture));
|
|
2070
2084
|
const i = s.specularColorFactor || [1, 1, 1];
|
|
2071
|
-
return t.specularColor = new
|
|
2085
|
+
return t.specularColor = new pe().setRGB(i[0], i[1], i[2], ae), s.specularColorTexture !== void 0 && n.push(this.parser.assignTexture(t, "specularColorMap", s.specularColorTexture, Re)), Promise.all(n);
|
|
2072
2086
|
}
|
|
2073
2087
|
}
|
|
2074
|
-
class
|
|
2088
|
+
class Ti {
|
|
2075
2089
|
constructor(e) {
|
|
2076
2090
|
this.parser = e, this.name = R.EXT_MATERIALS_BUMP;
|
|
2077
2091
|
}
|
|
2078
2092
|
getMaterialType(e) {
|
|
2079
|
-
return C(this.parser, e, this.name) !== null ?
|
|
2093
|
+
return C(this.parser, e, this.name) !== null ? se : null;
|
|
2080
2094
|
}
|
|
2081
2095
|
extendMaterialParams(e, t) {
|
|
2082
2096
|
const s = C(this.parser, e, this.name);
|
|
@@ -2085,12 +2099,12 @@ class wi {
|
|
|
2085
2099
|
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);
|
|
2086
2100
|
}
|
|
2087
2101
|
}
|
|
2088
|
-
class
|
|
2102
|
+
class xi {
|
|
2089
2103
|
constructor(e) {
|
|
2090
2104
|
this.parser = e, this.name = R.KHR_MATERIALS_ANISOTROPY;
|
|
2091
2105
|
}
|
|
2092
2106
|
getMaterialType(e) {
|
|
2093
|
-
return C(this.parser, e, this.name) !== null ?
|
|
2107
|
+
return C(this.parser, e, this.name) !== null ? se : null;
|
|
2094
2108
|
}
|
|
2095
2109
|
extendMaterialParams(e, t) {
|
|
2096
2110
|
const s = C(this.parser, e, this.name);
|
|
@@ -2099,7 +2113,7 @@ class Ti {
|
|
|
2099
2113
|
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);
|
|
2100
2114
|
}
|
|
2101
2115
|
}
|
|
2102
|
-
class
|
|
2116
|
+
class Ei {
|
|
2103
2117
|
constructor(e) {
|
|
2104
2118
|
this.parser = e, this.name = R.KHR_TEXTURE_BASISU;
|
|
2105
2119
|
}
|
|
@@ -2116,7 +2130,7 @@ class xi {
|
|
|
2116
2130
|
return t.loadTextureImage(e, i.source, o);
|
|
2117
2131
|
}
|
|
2118
2132
|
}
|
|
2119
|
-
class
|
|
2133
|
+
class Mi {
|
|
2120
2134
|
constructor(e) {
|
|
2121
2135
|
this.parser = e, this.name = R.EXT_TEXTURE_WEBP;
|
|
2122
2136
|
}
|
|
@@ -2133,7 +2147,7 @@ class Ei {
|
|
|
2133
2147
|
return s.loadTextureImage(e, o.source, l);
|
|
2134
2148
|
}
|
|
2135
2149
|
}
|
|
2136
|
-
class
|
|
2150
|
+
class vi {
|
|
2137
2151
|
constructor(e) {
|
|
2138
2152
|
this.parser = e, this.name = R.EXT_TEXTURE_AVIF;
|
|
2139
2153
|
}
|
|
@@ -2150,7 +2164,7 @@ class Mi {
|
|
|
2150
2164
|
return s.loadTextureImage(e, o.source, l);
|
|
2151
2165
|
}
|
|
2152
2166
|
}
|
|
2153
|
-
class
|
|
2167
|
+
class Qt {
|
|
2154
2168
|
constructor(e, t) {
|
|
2155
2169
|
this.name = t, this.parser = e;
|
|
2156
2170
|
}
|
|
@@ -2164,12 +2178,12 @@ class Vt {
|
|
|
2164
2178
|
return null;
|
|
2165
2179
|
}
|
|
2166
2180
|
return i.then(function(a) {
|
|
2167
|
-
const l = n.byteOffset || 0, h = n.byteLength || 0, u = n.count, c = n.byteStride,
|
|
2168
|
-
return o.decodeGltfBufferAsync ? o.decodeGltfBufferAsync(u, c,
|
|
2169
|
-
return
|
|
2181
|
+
const l = n.byteOffset || 0, h = n.byteLength || 0, u = n.count, c = n.byteStride, p = new Uint8Array(a, l, h);
|
|
2182
|
+
return o.decodeGltfBufferAsync ? o.decodeGltfBufferAsync(u, c, p, n.mode, n.filter).then(function(m) {
|
|
2183
|
+
return m.buffer;
|
|
2170
2184
|
}) : o.ready.then(function() {
|
|
2171
|
-
const
|
|
2172
|
-
return o.decodeGltfBuffer(new Uint8Array(
|
|
2185
|
+
const m = new ArrayBuffer(u * c);
|
|
2186
|
+
return o.decodeGltfBuffer(new Uint8Array(m), u, c, p, n.mode, n.filter), m;
|
|
2173
2187
|
});
|
|
2174
2188
|
});
|
|
2175
2189
|
} else
|
|
@@ -2186,52 +2200,52 @@ class Si {
|
|
|
2186
2200
|
return null;
|
|
2187
2201
|
const n = t.meshes[s.mesh];
|
|
2188
2202
|
for (const h of n.primitives)
|
|
2189
|
-
if (h.mode !==
|
|
2203
|
+
if (h.mode !== W.TRIANGLES && h.mode !== W.TRIANGLE_STRIP && h.mode !== W.TRIANGLE_FAN && h.mode !== void 0)
|
|
2190
2204
|
return null;
|
|
2191
2205
|
const o = s.extensions[this.name].attributes, a = [], l = {};
|
|
2192
2206
|
for (const h in o)
|
|
2193
2207
|
a.push(this.parser.getDependency("accessor", o[h]).then((u) => (l[h] = u, l[h])));
|
|
2194
2208
|
return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((h) => {
|
|
2195
|
-
const u = h.pop(), c = u.isGroup ? u.children : [u],
|
|
2196
|
-
for (const
|
|
2197
|
-
const
|
|
2198
|
-
for (let S = 0; S <
|
|
2199
|
-
l.TRANSLATION && y.fromBufferAttribute(l.TRANSLATION, S), l.ROTATION &&
|
|
2209
|
+
const u = h.pop(), c = u.isGroup ? u.children : [u], p = h[0].count, m = [];
|
|
2210
|
+
for (const b of c) {
|
|
2211
|
+
const f = new Se(), y = new M(), d = new K(), _ = new M(1, 1, 1), x = new zn(b.geometry, b.material, p);
|
|
2212
|
+
for (let S = 0; S < p; S++)
|
|
2213
|
+
l.TRANSLATION && y.fromBufferAttribute(l.TRANSLATION, S), l.ROTATION && d.fromBufferAttribute(l.ROTATION, S), l.SCALE && _.fromBufferAttribute(l.SCALE, S), x.setMatrixAt(S, f.compose(y, d, _));
|
|
2200
2214
|
for (const S in l)
|
|
2201
2215
|
if (S === "_COLOR_0") {
|
|
2202
|
-
const
|
|
2203
|
-
|
|
2204
|
-
} else S !== "TRANSLATION" && S !== "ROTATION" && S !== "SCALE" &&
|
|
2205
|
-
|
|
2216
|
+
const A = l[S];
|
|
2217
|
+
x.instanceColor = new Gn(A.array, A.itemSize, A.normalized);
|
|
2218
|
+
} else S !== "TRANSLATION" && S !== "ROTATION" && S !== "SCALE" && b.geometry.setAttribute(S, l[S]);
|
|
2219
|
+
Ue.prototype.copy.call(x, b), this.parser.assignFinalMaterial(x), m.push(x);
|
|
2206
2220
|
}
|
|
2207
|
-
return u.isGroup ? (u.clear(), u.add(...
|
|
2221
|
+
return u.isGroup ? (u.clear(), u.add(...m), u) : m[0];
|
|
2208
2222
|
}));
|
|
2209
2223
|
}
|
|
2210
2224
|
}
|
|
2211
|
-
const
|
|
2212
|
-
class
|
|
2225
|
+
const _n = "glTF", Oe = 12, qt = { JSON: 1313821514, BIN: 5130562 };
|
|
2226
|
+
class Ri {
|
|
2213
2227
|
constructor(e) {
|
|
2214
2228
|
this.name = R.KHR_BINARY_GLTF, this.content = null, this.body = null;
|
|
2215
|
-
const t = new DataView(e, 0,
|
|
2229
|
+
const t = new DataView(e, 0, Oe), s = new TextDecoder();
|
|
2216
2230
|
if (this.header = {
|
|
2217
2231
|
magic: s.decode(new Uint8Array(e.slice(0, 4))),
|
|
2218
2232
|
version: t.getUint32(4, !0),
|
|
2219
2233
|
length: t.getUint32(8, !0)
|
|
2220
|
-
}, this.header.magic !==
|
|
2234
|
+
}, this.header.magic !== _n)
|
|
2221
2235
|
throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
|
|
2222
2236
|
if (this.header.version < 2)
|
|
2223
2237
|
throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
|
|
2224
|
-
const n = this.header.length -
|
|
2238
|
+
const n = this.header.length - Oe, i = new DataView(e, Oe);
|
|
2225
2239
|
let o = 0;
|
|
2226
2240
|
for (; o < n; ) {
|
|
2227
2241
|
const a = i.getUint32(o, !0);
|
|
2228
2242
|
o += 4;
|
|
2229
2243
|
const l = i.getUint32(o, !0);
|
|
2230
|
-
if (o += 4, l ===
|
|
2231
|
-
const h = new Uint8Array(e,
|
|
2244
|
+
if (o += 4, l === qt.JSON) {
|
|
2245
|
+
const h = new Uint8Array(e, Oe + o, a);
|
|
2232
2246
|
this.content = s.decode(h);
|
|
2233
|
-
} else if (l ===
|
|
2234
|
-
const h =
|
|
2247
|
+
} else if (l === qt.BIN) {
|
|
2248
|
+
const h = Oe + o;
|
|
2235
2249
|
this.body = e.slice(h, h + a);
|
|
2236
2250
|
}
|
|
2237
2251
|
o += a;
|
|
@@ -2240,7 +2254,7 @@ class vi {
|
|
|
2240
2254
|
throw new Error("THREE.GLTFLoader: JSON content not found.");
|
|
2241
2255
|
}
|
|
2242
2256
|
}
|
|
2243
|
-
class
|
|
2257
|
+
class Ai {
|
|
2244
2258
|
constructor(e, t) {
|
|
2245
2259
|
if (!t)
|
|
2246
2260
|
throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
|
|
@@ -2249,30 +2263,30 @@ class Ri {
|
|
|
2249
2263
|
decodePrimitive(e, t) {
|
|
2250
2264
|
const s = this.json, n = this.dracoLoader, i = e.extensions[this.name].bufferView, o = e.extensions[this.name].attributes, a = {}, l = {}, h = {};
|
|
2251
2265
|
for (const u in o) {
|
|
2252
|
-
const c =
|
|
2266
|
+
const c = wt[u] || u.toLowerCase();
|
|
2253
2267
|
a[c] = o[u];
|
|
2254
2268
|
}
|
|
2255
2269
|
for (const u in e.attributes) {
|
|
2256
|
-
const c =
|
|
2270
|
+
const c = wt[u] || u.toLowerCase();
|
|
2257
2271
|
if (o[u] !== void 0) {
|
|
2258
|
-
const
|
|
2259
|
-
h[c] =
|
|
2272
|
+
const p = s.accessors[e.attributes[u]], m = ve[p.componentType];
|
|
2273
|
+
h[c] = m.name, l[c] = p.normalized === !0;
|
|
2260
2274
|
}
|
|
2261
2275
|
}
|
|
2262
2276
|
return t.getDependency("bufferView", i).then(function(u) {
|
|
2263
|
-
return new Promise(function(c,
|
|
2264
|
-
n.decodeDracoFile(u, function(
|
|
2265
|
-
for (const
|
|
2266
|
-
const
|
|
2267
|
-
y !== void 0 && (
|
|
2277
|
+
return new Promise(function(c, p) {
|
|
2278
|
+
n.decodeDracoFile(u, function(m) {
|
|
2279
|
+
for (const b in m.attributes) {
|
|
2280
|
+
const f = m.attributes[b], y = l[b];
|
|
2281
|
+
y !== void 0 && (f.normalized = y);
|
|
2268
2282
|
}
|
|
2269
|
-
c(
|
|
2270
|
-
}, a, h, ae,
|
|
2283
|
+
c(m);
|
|
2284
|
+
}, a, h, ae, p);
|
|
2271
2285
|
});
|
|
2272
2286
|
});
|
|
2273
2287
|
}
|
|
2274
2288
|
}
|
|
2275
|
-
class
|
|
2289
|
+
class Pi {
|
|
2276
2290
|
constructor() {
|
|
2277
2291
|
this.name = R.KHR_TEXTURE_TRANSFORM;
|
|
2278
2292
|
}
|
|
@@ -2280,12 +2294,12 @@ class Ai {
|
|
|
2280
2294
|
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;
|
|
2281
2295
|
}
|
|
2282
2296
|
}
|
|
2283
|
-
class
|
|
2297
|
+
class Li {
|
|
2284
2298
|
constructor() {
|
|
2285
2299
|
this.name = R.KHR_MESH_QUANTIZATION;
|
|
2286
2300
|
}
|
|
2287
2301
|
}
|
|
2288
|
-
class
|
|
2302
|
+
class bn extends ls {
|
|
2289
2303
|
constructor(e, t, s, n) {
|
|
2290
2304
|
super(e, t, s, n);
|
|
2291
2305
|
}
|
|
@@ -2296,22 +2310,22 @@ class yn extends ls {
|
|
|
2296
2310
|
return t;
|
|
2297
2311
|
}
|
|
2298
2312
|
interpolate_(e, t, s, n) {
|
|
2299
|
-
const i = this.resultBuffer, o = this.sampleValues, a = this.valueSize, l = a * 2, h = a * 3, u = n - t, c = (s - t) / u,
|
|
2313
|
+
const i = this.resultBuffer, o = this.sampleValues, a = this.valueSize, l = a * 2, h = a * 3, u = n - t, c = (s - t) / u, p = c * c, m = p * c, b = e * h, f = b - h, y = -2 * m + 3 * p, d = m - p, _ = 1 - y, x = d - p + c;
|
|
2300
2314
|
for (let S = 0; S !== a; S++) {
|
|
2301
|
-
const
|
|
2302
|
-
i[S] =
|
|
2315
|
+
const A = o[f + S + a], v = o[f + S + l] * u, I = o[b + S + a], ie = o[b + S] * u;
|
|
2316
|
+
i[S] = _ * A + x * v + y * I + d * ie;
|
|
2303
2317
|
}
|
|
2304
2318
|
return i;
|
|
2305
2319
|
}
|
|
2306
2320
|
}
|
|
2307
|
-
const
|
|
2308
|
-
class
|
|
2321
|
+
const Ii = new K();
|
|
2322
|
+
class Oi extends bn {
|
|
2309
2323
|
interpolate_(e, t, s, n) {
|
|
2310
2324
|
const i = super.interpolate_(e, t, s, n);
|
|
2311
|
-
return
|
|
2325
|
+
return Ii.fromArray(i).normalize().toArray(i), i;
|
|
2312
2326
|
}
|
|
2313
2327
|
}
|
|
2314
|
-
const
|
|
2328
|
+
const W = {
|
|
2315
2329
|
POINTS: 0,
|
|
2316
2330
|
LINES: 1,
|
|
2317
2331
|
LINE_LOOP: 2,
|
|
@@ -2319,25 +2333,25 @@ const Q = {
|
|
|
2319
2333
|
TRIANGLES: 4,
|
|
2320
2334
|
TRIANGLE_STRIP: 5,
|
|
2321
2335
|
TRIANGLE_FAN: 6
|
|
2322
|
-
},
|
|
2336
|
+
}, ve = {
|
|
2323
2337
|
5120: Int8Array,
|
|
2324
2338
|
5121: Uint8Array,
|
|
2325
2339
|
5122: Int16Array,
|
|
2326
2340
|
5123: Uint16Array,
|
|
2327
2341
|
5125: Uint32Array,
|
|
2328
2342
|
5126: Float32Array
|
|
2329
|
-
},
|
|
2330
|
-
9728:
|
|
2331
|
-
9729:
|
|
2343
|
+
}, Wt = {
|
|
2344
|
+
9728: un,
|
|
2345
|
+
9729: yt,
|
|
2332
2346
|
9984: Qn,
|
|
2333
2347
|
9985: Zn,
|
|
2334
2348
|
9986: Vn,
|
|
2335
|
-
9987:
|
|
2336
|
-
},
|
|
2349
|
+
9987: hn
|
|
2350
|
+
}, $t = {
|
|
2337
2351
|
33071: Wn,
|
|
2338
2352
|
33648: qn,
|
|
2339
|
-
10497:
|
|
2340
|
-
},
|
|
2353
|
+
10497: _t
|
|
2354
|
+
}, dt = {
|
|
2341
2355
|
SCALAR: 1,
|
|
2342
2356
|
VEC2: 2,
|
|
2343
2357
|
VEC3: 3,
|
|
@@ -2345,7 +2359,7 @@ const Q = {
|
|
|
2345
2359
|
MAT2: 4,
|
|
2346
2360
|
MAT3: 9,
|
|
2347
2361
|
MAT4: 16
|
|
2348
|
-
},
|
|
2362
|
+
}, wt = {
|
|
2349
2363
|
POSITION: "position",
|
|
2350
2364
|
NORMAL: "normal",
|
|
2351
2365
|
TANGENT: "tangent",
|
|
@@ -2361,19 +2375,19 @@ const Q = {
|
|
|
2361
2375
|
translation: "position",
|
|
2362
2376
|
rotation: "quaternion",
|
|
2363
2377
|
weights: "morphTargetInfluences"
|
|
2364
|
-
},
|
|
2378
|
+
}, Ci = {
|
|
2365
2379
|
CUBICSPLINE: void 0,
|
|
2366
2380
|
// We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
|
|
2367
2381
|
// keyframe track will be initialized with a default interpolation type, then modified.
|
|
2368
|
-
LINEAR:
|
|
2382
|
+
LINEAR: pn,
|
|
2369
2383
|
STEP: rs
|
|
2370
|
-
},
|
|
2384
|
+
}, pt = {
|
|
2371
2385
|
OPAQUE: "OPAQUE",
|
|
2372
2386
|
MASK: "MASK",
|
|
2373
2387
|
BLEND: "BLEND"
|
|
2374
2388
|
};
|
|
2375
|
-
function
|
|
2376
|
-
return r.DefaultMaterial === void 0 && (r.DefaultMaterial = new
|
|
2389
|
+
function Di(r) {
|
|
2390
|
+
return r.DefaultMaterial === void 0 && (r.DefaultMaterial = new dn({
|
|
2377
2391
|
color: 16777215,
|
|
2378
2392
|
emissive: 0,
|
|
2379
2393
|
metalness: 1,
|
|
@@ -2383,14 +2397,14 @@ function Ci(r) {
|
|
|
2383
2397
|
side: as
|
|
2384
2398
|
})), r.DefaultMaterial;
|
|
2385
2399
|
}
|
|
2386
|
-
function
|
|
2400
|
+
function ge(r, e, t) {
|
|
2387
2401
|
for (const s in t.extensions)
|
|
2388
2402
|
r[s] === void 0 && (e.userData.gltfExtensions = e.userData.gltfExtensions || {}, e.userData.gltfExtensions[s] = t.extensions[s]);
|
|
2389
2403
|
}
|
|
2390
|
-
function
|
|
2404
|
+
function ne(r, e) {
|
|
2391
2405
|
e.extras !== void 0 && (typeof e.extras == "object" ? Object.assign(r.userData, e.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + e.extras));
|
|
2392
2406
|
}
|
|
2393
|
-
function
|
|
2407
|
+
function Ni(r, e, t) {
|
|
2394
2408
|
let s = !1, n = !1, i = !1;
|
|
2395
2409
|
for (let h = 0, u = e.length; h < u; h++) {
|
|
2396
2410
|
const c = e[h];
|
|
@@ -2401,16 +2415,16 @@ function Di(r, e, t) {
|
|
|
2401
2415
|
for (let h = 0, u = e.length; h < u; h++) {
|
|
2402
2416
|
const c = e[h];
|
|
2403
2417
|
if (s) {
|
|
2404
|
-
const
|
|
2405
|
-
o.push(
|
|
2418
|
+
const p = c.POSITION !== void 0 ? t.getDependency("accessor", c.POSITION) : r.attributes.position;
|
|
2419
|
+
o.push(p);
|
|
2406
2420
|
}
|
|
2407
2421
|
if (n) {
|
|
2408
|
-
const
|
|
2409
|
-
a.push(
|
|
2422
|
+
const p = c.NORMAL !== void 0 ? t.getDependency("accessor", c.NORMAL) : r.attributes.normal;
|
|
2423
|
+
a.push(p);
|
|
2410
2424
|
}
|
|
2411
2425
|
if (i) {
|
|
2412
|
-
const
|
|
2413
|
-
l.push(
|
|
2426
|
+
const p = c.COLOR_0 !== void 0 ? t.getDependency("accessor", c.COLOR_0) : r.attributes.color;
|
|
2427
|
+
l.push(p);
|
|
2414
2428
|
}
|
|
2415
2429
|
}
|
|
2416
2430
|
return Promise.all([
|
|
@@ -2418,11 +2432,11 @@ function Di(r, e, t) {
|
|
|
2418
2432
|
Promise.all(a),
|
|
2419
2433
|
Promise.all(l)
|
|
2420
2434
|
]).then(function(h) {
|
|
2421
|
-
const u = h[0], c = h[1],
|
|
2422
|
-
return s && (r.morphAttributes.position = u), n && (r.morphAttributes.normal = c), i && (r.morphAttributes.color =
|
|
2435
|
+
const u = h[0], c = h[1], p = h[2];
|
|
2436
|
+
return s && (r.morphAttributes.position = u), n && (r.morphAttributes.normal = c), i && (r.morphAttributes.color = p), r.morphTargetsRelative = !0, r;
|
|
2423
2437
|
});
|
|
2424
2438
|
}
|
|
2425
|
-
function
|
|
2439
|
+
function ki(r, e) {
|
|
2426
2440
|
if (r.updateMorphTargets(), e.weights !== void 0)
|
|
2427
2441
|
for (let t = 0, s = e.weights.length; t < s; t++)
|
|
2428
2442
|
r.morphTargetInfluences[t] = e.weights[t];
|
|
@@ -2436,22 +2450,22 @@ function Ni(r, e) {
|
|
|
2436
2450
|
console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
|
|
2437
2451
|
}
|
|
2438
2452
|
}
|
|
2439
|
-
function
|
|
2453
|
+
function ji(r) {
|
|
2440
2454
|
let e;
|
|
2441
2455
|
const t = r.extensions && r.extensions[R.KHR_DRACO_MESH_COMPRESSION];
|
|
2442
|
-
if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" +
|
|
2456
|
+
if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + ft(t.attributes) : e = r.indices + ":" + ft(r.attributes) + ":" + r.mode, r.targets !== void 0)
|
|
2443
2457
|
for (let s = 0, n = r.targets.length; s < n; s++)
|
|
2444
|
-
e += ":" +
|
|
2458
|
+
e += ":" + ft(r.targets[s]);
|
|
2445
2459
|
return e;
|
|
2446
2460
|
}
|
|
2447
|
-
function
|
|
2461
|
+
function ft(r) {
|
|
2448
2462
|
let e = "";
|
|
2449
2463
|
const t = Object.keys(r).sort();
|
|
2450
2464
|
for (let s = 0, n = t.length; s < n; s++)
|
|
2451
2465
|
e += t[s] + ":" + r[t[s]] + ";";
|
|
2452
2466
|
return e;
|
|
2453
2467
|
}
|
|
2454
|
-
function
|
|
2468
|
+
function Tt(r) {
|
|
2455
2469
|
switch (r) {
|
|
2456
2470
|
case Int8Array:
|
|
2457
2471
|
return 1 / 127;
|
|
@@ -2465,13 +2479,13 @@ function wt(r) {
|
|
|
2465
2479
|
throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
|
|
2466
2480
|
}
|
|
2467
2481
|
}
|
|
2468
|
-
function
|
|
2482
|
+
function Fi(r) {
|
|
2469
2483
|
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";
|
|
2470
2484
|
}
|
|
2471
|
-
const Hi = new
|
|
2472
|
-
class
|
|
2485
|
+
const Hi = new Se();
|
|
2486
|
+
class Ui {
|
|
2473
2487
|
constructor(e = {}, t = {}) {
|
|
2474
|
-
this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new
|
|
2488
|
+
this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new ci(), 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 = {};
|
|
2475
2489
|
let s = !1, n = -1, i = !1, o = -1;
|
|
2476
2490
|
if (typeof navigator < "u" && typeof navigator.userAgent < "u") {
|
|
2477
2491
|
const a = navigator.userAgent;
|
|
@@ -2479,7 +2493,7 @@ class Fi {
|
|
|
2479
2493
|
const l = a.match(/Version\/(\d+)/);
|
|
2480
2494
|
n = s && l ? parseInt(l[1], 10) : -1, i = a.indexOf("Firefox") > -1, o = i ? a.match(/Firefox\/([0-9]+)\./)[1] : -1;
|
|
2481
2495
|
}
|
|
2482
|
-
typeof createImageBitmap > "u" || s && n < 17 || i && o < 98 ? this.textureLoader = new Xn(this.options.manager) : this.textureLoader = new Yn(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new
|
|
2496
|
+
typeof createImageBitmap > "u" || s && n < 17 || i && o < 98 ? this.textureLoader = new Xn(this.options.manager) : this.textureLoader = new Yn(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new xt(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
|
|
2483
2497
|
}
|
|
2484
2498
|
setExtensions(e) {
|
|
2485
2499
|
this.extensions = e;
|
|
@@ -2509,7 +2523,7 @@ class Fi {
|
|
|
2509
2523
|
parser: s,
|
|
2510
2524
|
userData: {}
|
|
2511
2525
|
};
|
|
2512
|
-
return
|
|
2526
|
+
return ge(i, a, n), ne(a, n), Promise.all(s._invokeAll(function(l) {
|
|
2513
2527
|
return l.afterRoot && l.afterRoot(a);
|
|
2514
2528
|
})).then(function() {
|
|
2515
2529
|
for (const l of a.scenes)
|
|
@@ -2690,7 +2704,7 @@ class Fi {
|
|
|
2690
2704
|
return Promise.resolve(this.extensions[R.KHR_BINARY_GLTF].body);
|
|
2691
2705
|
const n = this.options;
|
|
2692
2706
|
return new Promise(function(i, o) {
|
|
2693
|
-
s.load(
|
|
2707
|
+
s.load(Fe.resolveURL(t.uri, n.path), i, void 0, function() {
|
|
2694
2708
|
o(new Error('THREE.GLTFLoader: Failed to load buffer "' + t.uri + '".'));
|
|
2695
2709
|
});
|
|
2696
2710
|
});
|
|
@@ -2719,27 +2733,27 @@ class Fi {
|
|
|
2719
2733
|
loadAccessor(e) {
|
|
2720
2734
|
const t = this, s = this.json, n = this.json.accessors[e];
|
|
2721
2735
|
if (n.bufferView === void 0 && n.sparse === void 0) {
|
|
2722
|
-
const o =
|
|
2723
|
-
return Promise.resolve(new
|
|
2736
|
+
const o = dt[n.type], a = ve[n.componentType], l = n.normalized === !0, h = new a(n.count * o);
|
|
2737
|
+
return Promise.resolve(new rt(h, o, l));
|
|
2724
2738
|
}
|
|
2725
2739
|
const i = [];
|
|
2726
2740
|
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) {
|
|
2727
|
-
const a = o[0], l =
|
|
2728
|
-
let
|
|
2729
|
-
if (
|
|
2730
|
-
const
|
|
2731
|
-
let
|
|
2732
|
-
|
|
2741
|
+
const a = o[0], l = dt[n.type], h = ve[n.componentType], u = h.BYTES_PER_ELEMENT, c = u * l, p = n.byteOffset || 0, m = n.bufferView !== void 0 ? s.bufferViews[n.bufferView].byteStride : void 0, b = n.normalized === !0;
|
|
2742
|
+
let f, y;
|
|
2743
|
+
if (m && m !== c) {
|
|
2744
|
+
const d = Math.floor(p / m), _ = "InterleavedBuffer:" + n.bufferView + ":" + n.componentType + ":" + d + ":" + n.count;
|
|
2745
|
+
let x = t.cache.get(_);
|
|
2746
|
+
x || (f = new h(a, d * m, n.count * m / u), x = new Bn(f, m / u), t.cache.add(_, x)), y = new Kn(x, l, p % m / u, b);
|
|
2733
2747
|
} else
|
|
2734
|
-
a === null ?
|
|
2748
|
+
a === null ? f = new h(n.count * l) : f = new h(a, p, n.count * l), y = new rt(f, l, b);
|
|
2735
2749
|
if (n.sparse !== void 0) {
|
|
2736
|
-
const
|
|
2737
|
-
a !== null && (y = new
|
|
2738
|
-
for (let I = 0,
|
|
2739
|
-
const
|
|
2740
|
-
if (y.setX(
|
|
2750
|
+
const d = dt.SCALAR, _ = ve[n.sparse.indices.componentType], x = n.sparse.indices.byteOffset || 0, S = n.sparse.values.byteOffset || 0, A = new _(o[1], x, n.sparse.count * d), v = new h(o[2], S, n.sparse.count * l);
|
|
2751
|
+
a !== null && (y = new rt(y.array.slice(), y.itemSize, y.normalized)), y.normalized = !1;
|
|
2752
|
+
for (let I = 0, ie = A.length; I < ie; I++) {
|
|
2753
|
+
const ee = A[I];
|
|
2754
|
+
if (y.setX(ee, v[I * l]), l >= 2 && y.setY(ee, v[I * l + 1]), l >= 3 && y.setZ(ee, v[I * l + 2]), l >= 4 && y.setW(ee, v[I * l + 3]), l >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
|
|
2741
2755
|
}
|
|
2742
|
-
y.normalized =
|
|
2756
|
+
y.normalized = b;
|
|
2743
2757
|
}
|
|
2744
2758
|
return y;
|
|
2745
2759
|
});
|
|
@@ -2766,8 +2780,8 @@ class Fi {
|
|
|
2766
2780
|
return this.textureCache[l];
|
|
2767
2781
|
const h = this.loadImageSource(t, s).then(function(u) {
|
|
2768
2782
|
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);
|
|
2769
|
-
const
|
|
2770
|
-
return u.magFilter =
|
|
2783
|
+
const p = (i.samplers || {})[o.sampler] || {};
|
|
2784
|
+
return u.magFilter = Wt[p.magFilter] || yt, u.minFilter = Wt[p.minFilter] || hn, u.wrapS = $t[p.wrapS] || _t, u.wrapT = $t[p.wrapT] || _t, u.generateMipmaps = !u.isCompressedTexture && u.minFilter !== un && u.minFilter !== yt, n.associations.set(u, { textures: e }), u;
|
|
2771
2785
|
}).catch(function() {
|
|
2772
2786
|
return null;
|
|
2773
2787
|
});
|
|
@@ -2782,21 +2796,21 @@ class Fi {
|
|
|
2782
2796
|
if (o.bufferView !== void 0)
|
|
2783
2797
|
l = s.getDependency("bufferView", o.bufferView).then(function(c) {
|
|
2784
2798
|
h = !0;
|
|
2785
|
-
const
|
|
2786
|
-
return l = a.createObjectURL(
|
|
2799
|
+
const p = new Blob([c], { type: o.mimeType });
|
|
2800
|
+
return l = a.createObjectURL(p), l;
|
|
2787
2801
|
});
|
|
2788
2802
|
else if (o.uri === void 0)
|
|
2789
2803
|
throw new Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView");
|
|
2790
2804
|
const u = Promise.resolve(l).then(function(c) {
|
|
2791
|
-
return new Promise(function(
|
|
2792
|
-
let
|
|
2793
|
-
t.isImageBitmapLoader === !0 && (
|
|
2794
|
-
const y = new
|
|
2795
|
-
y.needsUpdate = !0,
|
|
2796
|
-
}), t.load(
|
|
2805
|
+
return new Promise(function(p, m) {
|
|
2806
|
+
let b = p;
|
|
2807
|
+
t.isImageBitmapLoader === !0 && (b = function(f) {
|
|
2808
|
+
const y = new Lt(f);
|
|
2809
|
+
y.needsUpdate = !0, p(y);
|
|
2810
|
+
}), t.load(Fe.resolveURL(c, i.path), b, void 0, m);
|
|
2797
2811
|
});
|
|
2798
2812
|
}).then(function(c) {
|
|
2799
|
-
return h === !0 && a.revokeObjectURL(l),
|
|
2813
|
+
return h === !0 && a.revokeObjectURL(l), ne(c, o), c.userData.mimeType = o.mimeType || Fi(o.uri), c;
|
|
2800
2814
|
}).catch(function(c) {
|
|
2801
2815
|
throw console.error("THREE.GLTFLoader: Couldn't load texture", l), c;
|
|
2802
2816
|
});
|
|
@@ -2843,11 +2857,11 @@ class Fi {
|
|
|
2843
2857
|
if (e.isPoints) {
|
|
2844
2858
|
const a = "PointsMaterial:" + s.uuid;
|
|
2845
2859
|
let l = this.cache.get(a);
|
|
2846
|
-
l || (l = new
|
|
2860
|
+
l || (l = new Ce(), je.prototype.copy.call(l, s), l.color.copy(s.color), l.map = s.map, l.sizeAttenuation = !1, this.cache.add(a, l)), s = l;
|
|
2847
2861
|
} else if (e.isLine) {
|
|
2848
2862
|
const a = "LineBasicMaterial:" + s.uuid;
|
|
2849
2863
|
let l = this.cache.get(a);
|
|
2850
|
-
l || (l = new
|
|
2864
|
+
l || (l = new ke(), je.prototype.copy.call(l, s), l.color.copy(s.color), l.map = s.map, this.cache.add(a, l)), s = l;
|
|
2851
2865
|
}
|
|
2852
2866
|
if (n || i || o) {
|
|
2853
2867
|
let a = "ClonedMaterial:" + s.uuid + ":";
|
|
@@ -2858,7 +2872,7 @@ class Fi {
|
|
|
2858
2872
|
e.material = s;
|
|
2859
2873
|
}
|
|
2860
2874
|
getMaterialType() {
|
|
2861
|
-
return
|
|
2875
|
+
return dn;
|
|
2862
2876
|
}
|
|
2863
2877
|
/**
|
|
2864
2878
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
|
|
@@ -2876,29 +2890,29 @@ class Fi {
|
|
|
2876
2890
|
o = c.getMaterialType(), h.push(c.extendParams(a, i, t));
|
|
2877
2891
|
} else {
|
|
2878
2892
|
const c = i.pbrMetallicRoughness || {};
|
|
2879
|
-
if (a.color = new
|
|
2880
|
-
const
|
|
2881
|
-
a.color.setRGB(
|
|
2893
|
+
if (a.color = new pe(1, 1, 1), a.opacity = 1, Array.isArray(c.baseColorFactor)) {
|
|
2894
|
+
const p = c.baseColorFactor;
|
|
2895
|
+
a.color.setRGB(p[0], p[1], p[2], ae), a.opacity = p[3];
|
|
2882
2896
|
}
|
|
2883
|
-
c.baseColorTexture !== void 0 && h.push(t.assignTexture(a, "map", c.baseColorTexture,
|
|
2884
|
-
return
|
|
2885
|
-
}), h.push(Promise.all(this._invokeAll(function(
|
|
2886
|
-
return
|
|
2897
|
+
c.baseColorTexture !== void 0 && h.push(t.assignTexture(a, "map", c.baseColorTexture, Re)), a.metalness = c.metallicFactor !== void 0 ? c.metallicFactor : 1, a.roughness = c.roughnessFactor !== void 0 ? c.roughnessFactor : 1, c.metallicRoughnessTexture !== void 0 && (h.push(t.assignTexture(a, "metalnessMap", c.metallicRoughnessTexture)), h.push(t.assignTexture(a, "roughnessMap", c.metallicRoughnessTexture))), o = this._invokeOne(function(p) {
|
|
2898
|
+
return p.getMaterialType && p.getMaterialType(e);
|
|
2899
|
+
}), h.push(Promise.all(this._invokeAll(function(p) {
|
|
2900
|
+
return p.extendMaterialParams && p.extendMaterialParams(e, a);
|
|
2887
2901
|
})));
|
|
2888
2902
|
}
|
|
2889
|
-
i.doubleSided === !0 && (a.side =
|
|
2890
|
-
const u = i.alphaMode ||
|
|
2891
|
-
if (u ===
|
|
2903
|
+
i.doubleSided === !0 && (a.side = an);
|
|
2904
|
+
const u = i.alphaMode || pt.OPAQUE;
|
|
2905
|
+
if (u === pt.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, u === pt.MASK && (a.alphaTest = i.alphaCutoff !== void 0 ? i.alphaCutoff : 0.5)), i.normalTexture !== void 0 && o !== _e && (h.push(t.assignTexture(a, "normalMap", i.normalTexture)), a.normalScale = new V(1, 1), i.normalTexture.scale !== void 0)) {
|
|
2892
2906
|
const c = i.normalTexture.scale;
|
|
2893
2907
|
a.normalScale.set(c, c);
|
|
2894
2908
|
}
|
|
2895
|
-
if (i.occlusionTexture !== void 0 && o !==
|
|
2909
|
+
if (i.occlusionTexture !== void 0 && o !== _e && (h.push(t.assignTexture(a, "aoMap", i.occlusionTexture)), i.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = i.occlusionTexture.strength)), i.emissiveFactor !== void 0 && o !== _e) {
|
|
2896
2910
|
const c = i.emissiveFactor;
|
|
2897
|
-
a.emissive = new
|
|
2911
|
+
a.emissive = new pe().setRGB(c[0], c[1], c[2], ae);
|
|
2898
2912
|
}
|
|
2899
|
-
return i.emissiveTexture !== void 0 && o !==
|
|
2913
|
+
return i.emissiveTexture !== void 0 && o !== _e && h.push(t.assignTexture(a, "emissiveMap", i.emissiveTexture, Re)), Promise.all(h).then(function() {
|
|
2900
2914
|
const c = new o(a);
|
|
2901
|
-
return i.name && (c.name = i.name),
|
|
2915
|
+
return i.name && (c.name = i.name), ne(c, i), t.associations.set(c, { materials: e }), i.extensions && ge(n, c, i), c;
|
|
2902
2916
|
});
|
|
2903
2917
|
}
|
|
2904
2918
|
/**
|
|
@@ -2925,17 +2939,17 @@ class Fi {
|
|
|
2925
2939
|
const t = this, s = this.extensions, n = this.primitiveCache;
|
|
2926
2940
|
function i(a) {
|
|
2927
2941
|
return s[R.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, t).then(function(l) {
|
|
2928
|
-
return
|
|
2942
|
+
return Jt(l, a, t);
|
|
2929
2943
|
});
|
|
2930
2944
|
}
|
|
2931
2945
|
const o = [];
|
|
2932
2946
|
for (let a = 0, l = e.length; a < l; a++) {
|
|
2933
|
-
const h = e[a], u =
|
|
2947
|
+
const h = e[a], u = ji(h), c = n[u];
|
|
2934
2948
|
if (c)
|
|
2935
2949
|
o.push(c.promise);
|
|
2936
2950
|
else {
|
|
2937
|
-
let
|
|
2938
|
-
h.extensions && h.extensions[R.KHR_DRACO_MESH_COMPRESSION] ?
|
|
2951
|
+
let p;
|
|
2952
|
+
h.extensions && h.extensions[R.KHR_DRACO_MESH_COMPRESSION] ? p = i(h) : p = Jt(new ze(), h, t), n[u] = { primitive: h, promise: p }, o.push(p);
|
|
2939
2953
|
}
|
|
2940
2954
|
}
|
|
2941
2955
|
return Promise.all(o);
|
|
@@ -2950,41 +2964,41 @@ class Fi {
|
|
|
2950
2964
|
loadMesh(e) {
|
|
2951
2965
|
const t = this, s = this.json, n = this.extensions, i = s.meshes[e], o = i.primitives, a = [];
|
|
2952
2966
|
for (let l = 0, h = o.length; l < h; l++) {
|
|
2953
|
-
const u = o[l].material === void 0 ?
|
|
2967
|
+
const u = o[l].material === void 0 ? Di(this.cache) : this.getDependency("material", o[l].material);
|
|
2954
2968
|
a.push(u);
|
|
2955
2969
|
}
|
|
2956
2970
|
return a.push(t.loadGeometries(o)), Promise.all(a).then(function(l) {
|
|
2957
2971
|
const h = l.slice(0, l.length - 1), u = l[l.length - 1], c = [];
|
|
2958
|
-
for (let
|
|
2959
|
-
const
|
|
2960
|
-
let
|
|
2961
|
-
const
|
|
2962
|
-
if (y.mode ===
|
|
2963
|
-
|
|
2964
|
-
else if (y.mode ===
|
|
2965
|
-
|
|
2966
|
-
else if (y.mode ===
|
|
2967
|
-
|
|
2968
|
-
else if (y.mode ===
|
|
2969
|
-
|
|
2970
|
-
else if (y.mode ===
|
|
2971
|
-
|
|
2972
|
+
for (let m = 0, b = u.length; m < b; m++) {
|
|
2973
|
+
const f = u[m], y = o[m];
|
|
2974
|
+
let d;
|
|
2975
|
+
const _ = h[m];
|
|
2976
|
+
if (y.mode === W.TRIANGLES || y.mode === W.TRIANGLE_STRIP || y.mode === W.TRIANGLE_FAN || y.mode === void 0)
|
|
2977
|
+
d = i.isSkinnedMesh === !0 ? new Jn(f, _) : new T(f, _), d.isSkinnedMesh === !0 && d.normalizeSkinWeights(), y.mode === W.TRIANGLE_STRIP ? d.geometry = Zt(d.geometry, cn) : y.mode === W.TRIANGLE_FAN && (d.geometry = Zt(d.geometry, gt));
|
|
2978
|
+
else if (y.mode === W.LINES)
|
|
2979
|
+
d = new mt(f, _);
|
|
2980
|
+
else if (y.mode === W.LINE_STRIP)
|
|
2981
|
+
d = new re(f, _);
|
|
2982
|
+
else if (y.mode === W.LINE_LOOP)
|
|
2983
|
+
d = new es(f, _);
|
|
2984
|
+
else if (y.mode === W.POINTS)
|
|
2985
|
+
d = new nt(f, _);
|
|
2972
2986
|
else
|
|
2973
2987
|
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + y.mode);
|
|
2974
|
-
Object.keys(
|
|
2988
|
+
Object.keys(d.geometry.morphAttributes).length > 0 && ki(d, i), d.name = t.createUniqueName(i.name || "mesh_" + e), ne(d, i), y.extensions && ge(n, d, y), t.assignFinalMaterial(d), c.push(d);
|
|
2975
2989
|
}
|
|
2976
|
-
for (let
|
|
2977
|
-
t.associations.set(c[
|
|
2990
|
+
for (let m = 0, b = c.length; m < b; m++)
|
|
2991
|
+
t.associations.set(c[m], {
|
|
2978
2992
|
meshes: e,
|
|
2979
|
-
primitives:
|
|
2993
|
+
primitives: m
|
|
2980
2994
|
});
|
|
2981
2995
|
if (c.length === 1)
|
|
2982
|
-
return i.extensions &&
|
|
2983
|
-
const
|
|
2984
|
-
i.extensions &&
|
|
2985
|
-
for (let
|
|
2986
|
-
|
|
2987
|
-
return
|
|
2996
|
+
return i.extensions && ge(n, c[0], i), c[0];
|
|
2997
|
+
const p = new tt();
|
|
2998
|
+
i.extensions && ge(n, p, i), t.associations.set(p, { meshes: e });
|
|
2999
|
+
for (let m = 0, b = c.length; m < b; m++)
|
|
3000
|
+
p.add(c[m]);
|
|
3001
|
+
return p;
|
|
2988
3002
|
});
|
|
2989
3003
|
}
|
|
2990
3004
|
/**
|
|
@@ -3001,7 +3015,7 @@ class Fi {
|
|
|
3001
3015
|
console.warn("THREE.GLTFLoader: Missing camera parameters.");
|
|
3002
3016
|
return;
|
|
3003
3017
|
}
|
|
3004
|
-
return s.type === "perspective" ? t = new ts(
|
|
3018
|
+
return s.type === "perspective" ? t = new ts(rn.radToDeg(n.yfov), n.aspectRatio || 1, n.znear || 1, n.zfar || 2e6) : s.type === "orthographic" && (t = new ns(-n.xmag, n.xmag, n.ymag, -n.ymag, n.znear, n.zfar)), s.name && (t.name = this.createUniqueName(s.name)), ne(t, s), Promise.resolve(t);
|
|
3005
3019
|
}
|
|
3006
3020
|
/**
|
|
3007
3021
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
|
|
@@ -3020,8 +3034,8 @@ class Fi {
|
|
|
3020
3034
|
const c = o[h];
|
|
3021
3035
|
if (c) {
|
|
3022
3036
|
a.push(c);
|
|
3023
|
-
const
|
|
3024
|
-
i !== null &&
|
|
3037
|
+
const p = new Se();
|
|
3038
|
+
i !== null && p.fromArray(i.array, h * 16), l.push(p);
|
|
3025
3039
|
} else
|
|
3026
3040
|
console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', t.joints[h]);
|
|
3027
3041
|
}
|
|
@@ -3037,9 +3051,9 @@ class Fi {
|
|
|
3037
3051
|
*/
|
|
3038
3052
|
loadAnimation(e) {
|
|
3039
3053
|
const t = this.json, s = this, n = t.animations[e], i = n.name ? n.name : "animation_" + e, o = [], a = [], l = [], h = [], u = [];
|
|
3040
|
-
for (let c = 0,
|
|
3041
|
-
const
|
|
3042
|
-
|
|
3054
|
+
for (let c = 0, p = n.channels.length; c < p; c++) {
|
|
3055
|
+
const m = n.channels[c], b = n.samplers[m.sampler], f = m.target, y = f.node, d = n.parameters !== void 0 ? n.parameters[b.input] : b.input, _ = n.parameters !== void 0 ? n.parameters[b.output] : b.output;
|
|
3056
|
+
f.node !== void 0 && (o.push(this.getDependency("node", y)), a.push(this.getDependency("accessor", d)), l.push(this.getDependency("accessor", _)), h.push(b), u.push(f));
|
|
3043
3057
|
}
|
|
3044
3058
|
return Promise.all([
|
|
3045
3059
|
Promise.all(o),
|
|
@@ -3048,18 +3062,18 @@ class Fi {
|
|
|
3048
3062
|
Promise.all(h),
|
|
3049
3063
|
Promise.all(u)
|
|
3050
3064
|
]).then(function(c) {
|
|
3051
|
-
const
|
|
3052
|
-
for (let
|
|
3053
|
-
const
|
|
3054
|
-
if (
|
|
3055
|
-
|
|
3056
|
-
const
|
|
3057
|
-
if (
|
|
3058
|
-
for (let
|
|
3059
|
-
|
|
3065
|
+
const p = c[0], m = c[1], b = c[2], f = c[3], y = c[4], d = [];
|
|
3066
|
+
for (let x = 0, S = p.length; x < S; x++) {
|
|
3067
|
+
const A = p[x], v = m[x], I = b[x], ie = f[x], ee = y[x];
|
|
3068
|
+
if (A === void 0) continue;
|
|
3069
|
+
A.updateMatrix && A.updateMatrix();
|
|
3070
|
+
const fe = s._createAnimationTracks(A, v, I, ie, ee);
|
|
3071
|
+
if (fe)
|
|
3072
|
+
for (let $ = 0; $ < fe.length; $++)
|
|
3073
|
+
d.push(fe[$]);
|
|
3060
3074
|
}
|
|
3061
|
-
const
|
|
3062
|
-
return
|
|
3075
|
+
const _ = new is(i, void 0, d);
|
|
3076
|
+
return ne(_, n), _;
|
|
3063
3077
|
});
|
|
3064
3078
|
}
|
|
3065
3079
|
createNodeMesh(e) {
|
|
@@ -3090,15 +3104,15 @@ class Fi {
|
|
|
3090
3104
|
Promise.all(o),
|
|
3091
3105
|
l
|
|
3092
3106
|
]).then(function(h) {
|
|
3093
|
-
const u = h[0], c = h[1],
|
|
3094
|
-
|
|
3095
|
-
|
|
3107
|
+
const u = h[0], c = h[1], p = h[2];
|
|
3108
|
+
p !== null && u.traverse(function(m) {
|
|
3109
|
+
m.isSkinnedMesh && m.bind(p, Hi);
|
|
3096
3110
|
});
|
|
3097
|
-
for (let
|
|
3098
|
-
u.add(c[
|
|
3111
|
+
for (let m = 0, b = c.length; m < b; m++)
|
|
3112
|
+
u.add(c[m]);
|
|
3099
3113
|
if (u.userData.pivot !== void 0 && c.length > 0) {
|
|
3100
|
-
const
|
|
3101
|
-
u.pivot = new
|
|
3114
|
+
const m = u.userData.pivot, b = c[0];
|
|
3115
|
+
u.pivot = new M().fromArray(m), u.position.x -= m[0], u.position.y -= m[1], u.position.z -= m[2], b.position.set(0, 0, 0), delete u.userData.pivot;
|
|
3102
3116
|
}
|
|
3103
3117
|
return u;
|
|
3104
3118
|
});
|
|
@@ -3120,11 +3134,11 @@ class Fi {
|
|
|
3120
3134
|
a.push(h);
|
|
3121
3135
|
}), this.nodeCache[e] = Promise.all(a).then(function(h) {
|
|
3122
3136
|
let u;
|
|
3123
|
-
if (i.isBone === !0 ? u = new os() : h.length > 1 ? u = new
|
|
3124
|
-
for (let c = 0,
|
|
3137
|
+
if (i.isBone === !0 ? u = new os() : h.length > 1 ? u = new tt() : h.length === 1 ? u = h[0] : u = new Ue(), u !== h[0])
|
|
3138
|
+
for (let c = 0, p = h.length; c < p; c++)
|
|
3125
3139
|
u.add(h[c]);
|
|
3126
|
-
if (i.name && (u.userData.name = i.name, u.name = o),
|
|
3127
|
-
const c = new
|
|
3140
|
+
if (i.name && (u.userData.name = i.name, u.name = o), ne(u, i), i.extensions && ge(s, u, i), i.matrix !== void 0) {
|
|
3141
|
+
const c = new Se();
|
|
3128
3142
|
c.fromArray(i.matrix), u.applyMatrix4(c);
|
|
3129
3143
|
} else
|
|
3130
3144
|
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);
|
|
@@ -3145,23 +3159,23 @@ class Fi {
|
|
|
3145
3159
|
* @return {Promise<Group>}
|
|
3146
3160
|
*/
|
|
3147
3161
|
loadScene(e) {
|
|
3148
|
-
const t = this.extensions, s = this.json.scenes[e], n = this, i = new
|
|
3149
|
-
s.name && (i.name = n.createUniqueName(s.name)),
|
|
3162
|
+
const t = this.extensions, s = this.json.scenes[e], n = this, i = new tt();
|
|
3163
|
+
s.name && (i.name = n.createUniqueName(s.name)), ne(i, s), s.extensions && ge(t, i, s);
|
|
3150
3164
|
const o = s.nodes || [], a = [];
|
|
3151
3165
|
for (let l = 0, h = o.length; l < h; l++)
|
|
3152
3166
|
a.push(n.getDependency("node", o[l]));
|
|
3153
3167
|
return Promise.all(a).then(function(l) {
|
|
3154
3168
|
for (let u = 0, c = l.length; u < c; u++) {
|
|
3155
|
-
const
|
|
3156
|
-
|
|
3169
|
+
const p = l[u];
|
|
3170
|
+
p.parent !== null ? i.add(ai(p)) : i.add(p);
|
|
3157
3171
|
}
|
|
3158
3172
|
const h = (u) => {
|
|
3159
3173
|
const c = /* @__PURE__ */ new Map();
|
|
3160
|
-
for (const [
|
|
3161
|
-
(
|
|
3162
|
-
return u.traverse((
|
|
3163
|
-
const
|
|
3164
|
-
|
|
3174
|
+
for (const [p, m] of n.associations)
|
|
3175
|
+
(p instanceof je || p instanceof Lt) && c.set(p, m);
|
|
3176
|
+
return u.traverse((p) => {
|
|
3177
|
+
const m = n.associations.get(p);
|
|
3178
|
+
m != null && c.set(p, m);
|
|
3165
3179
|
}), c;
|
|
3166
3180
|
};
|
|
3167
3181
|
return n.associations = h(i), i;
|
|
@@ -3169,51 +3183,51 @@ class Fi {
|
|
|
3169
3183
|
}
|
|
3170
3184
|
_createAnimationTracks(e, t, s, n, i) {
|
|
3171
3185
|
const o = [], a = e.name ? e.name : e.uuid, l = [];
|
|
3172
|
-
function h(
|
|
3173
|
-
|
|
3186
|
+
function h(m) {
|
|
3187
|
+
m.morphTargetInfluences && l.push(m.name ? m.name : m.uuid);
|
|
3174
3188
|
}
|
|
3175
3189
|
ce[i.path] === ce.weights ? (h(e), e.isGroup && e.children.forEach(h)) : l.push(a);
|
|
3176
3190
|
let u;
|
|
3177
3191
|
switch (ce[i.path]) {
|
|
3178
3192
|
case ce.weights:
|
|
3179
|
-
u =
|
|
3193
|
+
u = Ot;
|
|
3180
3194
|
break;
|
|
3181
3195
|
case ce.rotation:
|
|
3182
|
-
u =
|
|
3196
|
+
u = Ct;
|
|
3183
3197
|
break;
|
|
3184
3198
|
case ce.translation:
|
|
3185
3199
|
case ce.scale:
|
|
3186
|
-
u =
|
|
3200
|
+
u = It;
|
|
3187
3201
|
break;
|
|
3188
3202
|
default:
|
|
3189
3203
|
switch (s.itemSize) {
|
|
3190
3204
|
case 1:
|
|
3191
|
-
u =
|
|
3205
|
+
u = Ot;
|
|
3192
3206
|
break;
|
|
3193
3207
|
case 2:
|
|
3194
3208
|
case 3:
|
|
3195
3209
|
default:
|
|
3196
|
-
u =
|
|
3210
|
+
u = It;
|
|
3197
3211
|
break;
|
|
3198
3212
|
}
|
|
3199
3213
|
break;
|
|
3200
3214
|
}
|
|
3201
|
-
const c = n.interpolation !== void 0 ?
|
|
3202
|
-
for (let
|
|
3203
|
-
const
|
|
3204
|
-
l[
|
|
3215
|
+
const c = n.interpolation !== void 0 ? Ci[n.interpolation] : pn, p = this._getArrayFromAccessor(s);
|
|
3216
|
+
for (let m = 0, b = l.length; m < b; m++) {
|
|
3217
|
+
const f = new u(
|
|
3218
|
+
l[m] + "." + ce[i.path],
|
|
3205
3219
|
t.array,
|
|
3206
|
-
|
|
3220
|
+
p,
|
|
3207
3221
|
c
|
|
3208
3222
|
);
|
|
3209
|
-
n.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(
|
|
3223
|
+
n.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(f), o.push(f);
|
|
3210
3224
|
}
|
|
3211
3225
|
return o;
|
|
3212
3226
|
}
|
|
3213
3227
|
_getArrayFromAccessor(e) {
|
|
3214
3228
|
let t = e.array;
|
|
3215
3229
|
if (e.normalized) {
|
|
3216
|
-
const s =
|
|
3230
|
+
const s = Tt(t.constructor), n = new Float32Array(t.length);
|
|
3217
3231
|
for (let i = 0, o = t.length; i < o; i++)
|
|
3218
3232
|
n[i] = t[i] * s;
|
|
3219
3233
|
t = n;
|
|
@@ -3222,21 +3236,21 @@ class Fi {
|
|
|
3222
3236
|
}
|
|
3223
3237
|
_createCubicSplineTrackInterpolant(e) {
|
|
3224
3238
|
e.createInterpolant = function(s) {
|
|
3225
|
-
const n = this instanceof
|
|
3239
|
+
const n = this instanceof Ct ? Oi : bn;
|
|
3226
3240
|
return new n(this.times, this.values, this.getValueSize() / 3, s);
|
|
3227
3241
|
}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
|
|
3228
3242
|
}
|
|
3229
3243
|
}
|
|
3230
|
-
function
|
|
3244
|
+
function zi(r, e, t) {
|
|
3231
3245
|
const s = e.attributes, n = new cs();
|
|
3232
3246
|
if (s.POSITION !== void 0) {
|
|
3233
3247
|
const a = t.json.accessors[s.POSITION], l = a.min, h = a.max;
|
|
3234
3248
|
if (l !== void 0 && h !== void 0) {
|
|
3235
3249
|
if (n.set(
|
|
3236
|
-
new
|
|
3237
|
-
new
|
|
3250
|
+
new M(l[0], l[1], l[2]),
|
|
3251
|
+
new M(h[0], h[1], h[2])
|
|
3238
3252
|
), a.normalized) {
|
|
3239
|
-
const u =
|
|
3253
|
+
const u = Tt(ve[a.componentType]);
|
|
3240
3254
|
n.min.multiplyScalar(u), n.max.multiplyScalar(u);
|
|
3241
3255
|
}
|
|
3242
3256
|
} else {
|
|
@@ -3247,15 +3261,15 @@ function Ui(r, e, t) {
|
|
|
3247
3261
|
return;
|
|
3248
3262
|
const i = e.targets;
|
|
3249
3263
|
if (i !== void 0) {
|
|
3250
|
-
const a = new
|
|
3264
|
+
const a = new M(), l = new M();
|
|
3251
3265
|
for (let h = 0, u = i.length; h < u; h++) {
|
|
3252
3266
|
const c = i[h];
|
|
3253
3267
|
if (c.POSITION !== void 0) {
|
|
3254
|
-
const
|
|
3255
|
-
if (
|
|
3256
|
-
if (l.setX(Math.max(Math.abs(
|
|
3257
|
-
const
|
|
3258
|
-
l.multiplyScalar(
|
|
3268
|
+
const p = t.json.accessors[c.POSITION], m = p.min, b = p.max;
|
|
3269
|
+
if (m !== void 0 && b !== void 0) {
|
|
3270
|
+
if (l.setX(Math.max(Math.abs(m[0]), Math.abs(b[0]))), l.setY(Math.max(Math.abs(m[1]), Math.abs(b[1]))), l.setZ(Math.max(Math.abs(m[2]), Math.abs(b[2]))), p.normalized) {
|
|
3271
|
+
const f = Tt(ve[p.componentType]);
|
|
3272
|
+
l.multiplyScalar(f);
|
|
3259
3273
|
}
|
|
3260
3274
|
a.max(l);
|
|
3261
3275
|
} else
|
|
@@ -3268,7 +3282,7 @@ function Ui(r, e, t) {
|
|
|
3268
3282
|
const o = new hs();
|
|
3269
3283
|
n.getCenter(o.center), o.radius = n.min.distanceTo(n.max) / 2, r.boundingSphere = o;
|
|
3270
3284
|
}
|
|
3271
|
-
function
|
|
3285
|
+
function Jt(r, e, t) {
|
|
3272
3286
|
const s = e.attributes, n = [];
|
|
3273
3287
|
function i(o, a) {
|
|
3274
3288
|
return t.getDependency("accessor", o).then(function(l) {
|
|
@@ -3276,7 +3290,7 @@ function Wt(r, e, t) {
|
|
|
3276
3290
|
});
|
|
3277
3291
|
}
|
|
3278
3292
|
for (const o in s) {
|
|
3279
|
-
const a =
|
|
3293
|
+
const a = wt[o] || o.toLowerCase();
|
|
3280
3294
|
a in r.attributes || n.push(i(s[o], a));
|
|
3281
3295
|
}
|
|
3282
3296
|
if (e.indices !== void 0 && !r.index) {
|
|
@@ -3285,25 +3299,25 @@ function Wt(r, e, t) {
|
|
|
3285
3299
|
});
|
|
3286
3300
|
n.push(o);
|
|
3287
3301
|
}
|
|
3288
|
-
return
|
|
3289
|
-
return e.targets !== void 0 ?
|
|
3302
|
+
return Dt.workingColorSpace !== ae && "COLOR_0" in s && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Dt.workingColorSpace}" not supported.`), ne(r, e), zi(r, e, t), Promise.all(n).then(function() {
|
|
3303
|
+
return e.targets !== void 0 ? Ni(r, e.targets, t) : r;
|
|
3290
3304
|
});
|
|
3291
3305
|
}
|
|
3292
|
-
function zi() {
|
|
3293
|
-
const r = new N.BoxGeometry(1, 1, 1), e = new N.MeshStandardMaterial({ color: 43775 }), t = new N.Mesh(r, e);
|
|
3294
|
-
return t.position.y = 0.5, t.userData.isMovable = !0, t.name = "正方体", nt(t, !0), t;
|
|
3295
|
-
}
|
|
3296
3306
|
function Gi() {
|
|
3297
|
-
const r = new
|
|
3298
|
-
return t.position.y = 0.
|
|
3307
|
+
const r = new F.BoxGeometry(1, 1, 1), e = new F.MeshStandardMaterial({ color: 43775 }), t = new F.Mesh(r, e);
|
|
3308
|
+
return t.position.y = 0.5, t.userData.isMovable = !0, t.name = "正方体", vt(t, !0), t;
|
|
3299
3309
|
}
|
|
3300
|
-
function Xi(
|
|
3310
|
+
function Xi() {
|
|
3311
|
+
const r = new F.SphereGeometry(0.6, 32, 32), e = new F.MeshStandardMaterial({ color: 16746496 }), t = new F.Mesh(r, e);
|
|
3312
|
+
return t.position.y = 0.6, t.userData.isMovable = !0, t.name = "球体", vt(t, !0), t;
|
|
3313
|
+
}
|
|
3314
|
+
function Yi(r) {
|
|
3301
3315
|
return new Promise((e, t) => {
|
|
3302
3316
|
var o;
|
|
3303
3317
|
const s = (o = r.name.split(".").pop()) == null ? void 0 : o.toLowerCase(), n = URL.createObjectURL(r);
|
|
3304
3318
|
let i;
|
|
3305
|
-
if (s === "obj") i = new
|
|
3306
|
-
else if (s === "gltf" || s === "glb") i = new
|
|
3319
|
+
if (s === "obj") i = new ri();
|
|
3320
|
+
else if (s === "gltf" || s === "glb") i = new li();
|
|
3307
3321
|
else {
|
|
3308
3322
|
t(new Error("不支持的文件格式,请使用 .obj, .gltf, .glb"));
|
|
3309
3323
|
return;
|
|
@@ -3313,34 +3327,34 @@ function Xi(r) {
|
|
|
3313
3327
|
(a) => {
|
|
3314
3328
|
const l = s === "gltf" || s === "glb" ? a.scene : a;
|
|
3315
3329
|
l.traverse((c) => {
|
|
3316
|
-
var
|
|
3317
|
-
c.userData.isMovable = !0, c.name || (c.name = c.type), c.type === "Mesh" && (c.frustumCulled = !0, (
|
|
3330
|
+
var p;
|
|
3331
|
+
c.userData.isMovable = !0, c.name || (c.name = c.type), c.type === "Mesh" && (c.frustumCulled = !0, (p = c.geometry) == null || p.computeVertexNormals());
|
|
3318
3332
|
});
|
|
3319
|
-
const u = new
|
|
3320
|
-
l.position.sub(u),
|
|
3333
|
+
const u = new F.Box3().setFromObject(l).getCenter(new F.Vector3());
|
|
3334
|
+
l.position.sub(u), vt(l, !0), e(l);
|
|
3321
3335
|
},
|
|
3322
3336
|
void 0,
|
|
3323
3337
|
(a) => t(a)
|
|
3324
3338
|
);
|
|
3325
3339
|
});
|
|
3326
3340
|
}
|
|
3327
|
-
function
|
|
3341
|
+
function Bi(r) {
|
|
3328
3342
|
switch (r) {
|
|
3329
3343
|
case "box":
|
|
3330
|
-
|
|
3344
|
+
Gi();
|
|
3331
3345
|
break;
|
|
3332
3346
|
case "sphere":
|
|
3333
|
-
|
|
3347
|
+
Xi();
|
|
3334
3348
|
break;
|
|
3335
3349
|
}
|
|
3336
3350
|
}
|
|
3337
|
-
const
|
|
3351
|
+
const Ki = {
|
|
3338
3352
|
key: 1,
|
|
3339
3353
|
class: "toggle-placeholder"
|
|
3340
|
-
},
|
|
3354
|
+
}, Vi = { class: "tree-icon" }, Zi = { class: "tree-name" }, Qi = {
|
|
3341
3355
|
key: 0,
|
|
3342
3356
|
class: "tree-children"
|
|
3343
|
-
},
|
|
3357
|
+
}, qi = /* @__PURE__ */ Ge({
|
|
3344
3358
|
__name: "TreeItem",
|
|
3345
3359
|
props: {
|
|
3346
3360
|
node: {},
|
|
@@ -3349,15 +3363,15 @@ const Bi = {
|
|
|
3349
3363
|
},
|
|
3350
3364
|
emits: ["select", "delete"],
|
|
3351
3365
|
setup(r, { emit: e }) {
|
|
3352
|
-
const t = r, s = e, n =
|
|
3353
|
-
(
|
|
3354
|
-
))), u =
|
|
3366
|
+
const t = r, s = e, n = G(null), { expandedSet: i, toggleExpand: o } = Tn("treeExpand"), a = Ze(() => i.value.has(t.node.uuid)), l = Ze(() => (t.version, t.node.children.some((f) => f.userData.isMovable === !0))), h = Ze(() => (t.version, t.node.children.filter(
|
|
3367
|
+
(f) => f.userData.isMovable === !0
|
|
3368
|
+
))), u = Ze(
|
|
3355
3369
|
() => {
|
|
3356
|
-
var
|
|
3357
|
-
return ((
|
|
3370
|
+
var f;
|
|
3371
|
+
return ((f = t.selectedObject) == null ? void 0 : f.uuid) === t.node.uuid;
|
|
3358
3372
|
}
|
|
3359
3373
|
);
|
|
3360
|
-
|
|
3374
|
+
xn(
|
|
3361
3375
|
() => {
|
|
3362
3376
|
u.value && n.value && n.value.scrollIntoView({
|
|
3363
3377
|
block: "nearest",
|
|
@@ -3368,55 +3382,55 @@ const Bi = {
|
|
|
3368
3382
|
},
|
|
3369
3383
|
{ flush: "post" }
|
|
3370
3384
|
);
|
|
3371
|
-
const c = (
|
|
3372
|
-
|
|
3373
|
-
},
|
|
3374
|
-
|
|
3375
|
-
},
|
|
3376
|
-
return (
|
|
3377
|
-
const
|
|
3378
|
-
return
|
|
3385
|
+
const c = (f) => {
|
|
3386
|
+
f.stopPropagation(), s("select", t.node);
|
|
3387
|
+
}, p = (f) => {
|
|
3388
|
+
f.stopPropagation(), s("delete", t.node);
|
|
3389
|
+
}, m = (f) => f.type === "Mesh" || f.type === "Sprite" ? "🟦" : f.type === "Light" ? "💡" : "📦", b = (f) => f.name || `${f.type} (${f.id})`;
|
|
3390
|
+
return (f, y) => {
|
|
3391
|
+
const d = En("TreeItem", !0);
|
|
3392
|
+
return N(), U("div", {
|
|
3379
3393
|
class: "tree-node",
|
|
3380
3394
|
ref_key: "nodeRef",
|
|
3381
3395
|
ref: n
|
|
3382
3396
|
}, [
|
|
3383
3397
|
g("div", {
|
|
3384
|
-
class:
|
|
3398
|
+
class: He(["tree-item", { selected: u.value }]),
|
|
3385
3399
|
onClick: c
|
|
3386
3400
|
}, [
|
|
3387
|
-
l.value ? (
|
|
3401
|
+
l.value ? (N(), U("span", {
|
|
3388
3402
|
key: 0,
|
|
3389
3403
|
class: "toggle-icon",
|
|
3390
|
-
onClick: y[0] || (y[0] =
|
|
3391
|
-
},
|
|
3392
|
-
g("span",
|
|
3393
|
-
g("span",
|
|
3404
|
+
onClick: y[0] || (y[0] = At((_) => Mn(o)(r.node.uuid), ["stop"]))
|
|
3405
|
+
}, Ee(a.value ? "▼" : "▶"), 1)) : (N(), U("span", Ki)),
|
|
3406
|
+
g("span", Vi, Ee(m(r.node)), 1),
|
|
3407
|
+
g("span", Zi, Ee(b(r.node)), 1),
|
|
3394
3408
|
g("button", {
|
|
3395
3409
|
class: "tree-delete",
|
|
3396
|
-
onClick:
|
|
3410
|
+
onClick: At(p, ["stop"])
|
|
3397
3411
|
}, "×")
|
|
3398
3412
|
], 2),
|
|
3399
|
-
a.value && l.value ? (
|
|
3400
|
-
(
|
|
3401
|
-
key:
|
|
3402
|
-
node:
|
|
3413
|
+
a.value && l.value ? (N(), U("div", Qi, [
|
|
3414
|
+
(N(!0), U(en, null, tn(h.value, (_) => (N(), ot(d, {
|
|
3415
|
+
key: _.uuid,
|
|
3416
|
+
node: _,
|
|
3403
3417
|
"selected-object": r.selectedObject,
|
|
3404
3418
|
version: r.version,
|
|
3405
|
-
onSelect: y[1] || (y[1] = (
|
|
3406
|
-
onDelete: y[2] || (y[2] = (
|
|
3419
|
+
onSelect: y[1] || (y[1] = (x) => s("select", x)),
|
|
3420
|
+
onDelete: y[2] || (y[2] = (x) => s("delete", x))
|
|
3407
3421
|
}, null, 8, ["node", "selected-object", "version"]))), 128))
|
|
3408
|
-
])) :
|
|
3422
|
+
])) : de("", !0)
|
|
3409
3423
|
], 512);
|
|
3410
3424
|
};
|
|
3411
3425
|
}
|
|
3412
|
-
}),
|
|
3426
|
+
}), Xe = (r, e) => {
|
|
3413
3427
|
const t = r.__vccOpts || r;
|
|
3414
3428
|
for (const [s, n] of e)
|
|
3415
3429
|
t[s] = n;
|
|
3416
3430
|
return t;
|
|
3417
|
-
},
|
|
3418
|
-
function
|
|
3419
|
-
const e =
|
|
3431
|
+
}, Wi = /* @__PURE__ */ Xe(qi, [["__scopeId", "data-v-5ad9c842"]]);
|
|
3432
|
+
function $i(r) {
|
|
3433
|
+
const e = G(/* @__PURE__ */ new Set()), t = (n) => {
|
|
3420
3434
|
const i = new Set(e.value);
|
|
3421
3435
|
i.has(n) ? i.delete(n) : i.add(n), e.value = i;
|
|
3422
3436
|
}, s = (n) => {
|
|
@@ -3427,7 +3441,7 @@ function Wi(r) {
|
|
|
3427
3441
|
i.add(o.uuid), o = o.parent;
|
|
3428
3442
|
e.value = i;
|
|
3429
3443
|
};
|
|
3430
|
-
return
|
|
3444
|
+
return nn(
|
|
3431
3445
|
r,
|
|
3432
3446
|
(n) => {
|
|
3433
3447
|
n && s(n);
|
|
@@ -3435,16 +3449,28 @@ function Wi(r) {
|
|
|
3435
3449
|
{ immediate: !0 }
|
|
3436
3450
|
), { expandedSet: e, toggleExpand: t };
|
|
3437
3451
|
}
|
|
3438
|
-
const
|
|
3452
|
+
const Ji = {
|
|
3439
3453
|
key: 0,
|
|
3440
3454
|
class: "property-panel"
|
|
3441
|
-
},
|
|
3455
|
+
}, eo = { class: "property-group tree-group" }, to = { class: "tree-container" }, no = {
|
|
3442
3456
|
key: 0,
|
|
3443
3457
|
class: "tree-empty"
|
|
3444
|
-
},
|
|
3458
|
+
}, so = {
|
|
3459
|
+
key: 0,
|
|
3460
|
+
class: "tabs"
|
|
3461
|
+
}, io = {
|
|
3462
|
+
key: 1,
|
|
3463
|
+
class: "tab-content"
|
|
3464
|
+
}, oo = { class: "property-group" }, ro = { class: "row" }, ao = { class: "property-group" }, lo = { class: "row" }, co = { class: "property-group" }, ho = { class: "row" }, uo = {
|
|
3465
|
+
key: 0,
|
|
3466
|
+
class: "property-group material-group"
|
|
3467
|
+
}, po = { class: "slider-row" }, fo = { class: "slider-value" }, mo = { class: "slider-row" }, go = { class: "slider-value" }, yo = { class: "slider-row" }, _o = { class: "slider-value" }, bo = {
|
|
3468
|
+
key: 0,
|
|
3469
|
+
class: "material-hint"
|
|
3470
|
+
}, wo = {
|
|
3445
3471
|
key: 1,
|
|
3446
3472
|
class: "property-panel empty"
|
|
3447
|
-
},
|
|
3473
|
+
}, To = /* @__PURE__ */ Ge({
|
|
3448
3474
|
__name: "PropertyPanel",
|
|
3449
3475
|
props: {
|
|
3450
3476
|
transform: {},
|
|
@@ -3453,330 +3479,463 @@ const $i = {
|
|
|
3453
3479
|
},
|
|
3454
3480
|
emits: ["propertyChange", "treeSelect", "treeDelete"],
|
|
3455
3481
|
setup(r, { emit: e }) {
|
|
3456
|
-
const t = r, s = e, n = () => s("propertyChange"), i =
|
|
3457
|
-
|
|
3458
|
-
const
|
|
3459
|
-
|
|
3460
|
-
}
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3482
|
+
const t = r, s = e, n = () => s("propertyChange"), i = G("transform"), o = G(0), a = vn(t, "selectedObject"), { expandedSet: l, toggleExpand: h } = $i(a);
|
|
3483
|
+
Sn("treeExpand", { expandedSet: l, toggleExpand: h });
|
|
3484
|
+
const u = (y) => {
|
|
3485
|
+
o.value++, s("treeDelete", y);
|
|
3486
|
+
}, c = sn({
|
|
3487
|
+
metalness: 0,
|
|
3488
|
+
roughness: 0.5,
|
|
3489
|
+
opacity: 1
|
|
3490
|
+
}), p = G(!1);
|
|
3491
|
+
function m(y) {
|
|
3492
|
+
let d = null;
|
|
3493
|
+
return y.traverse((_) => {
|
|
3494
|
+
if (_.type === "Mesh" && !d) {
|
|
3495
|
+
const x = _, S = Array.isArray(x.material) ? x.material : [x.material];
|
|
3496
|
+
for (const A of S)
|
|
3497
|
+
if (A && (A.type === "MeshStandardMaterial" || A.type === "MeshPhongMaterial")) {
|
|
3498
|
+
const v = A;
|
|
3499
|
+
d = {
|
|
3500
|
+
metalness: v.metalness ?? 0,
|
|
3501
|
+
roughness: v.roughness ?? 0.5,
|
|
3502
|
+
opacity: A.opacity ?? 1
|
|
3503
|
+
};
|
|
3504
|
+
break;
|
|
3505
|
+
}
|
|
3506
|
+
}
|
|
3507
|
+
}), d;
|
|
3508
|
+
}
|
|
3509
|
+
function b(y, d) {
|
|
3510
|
+
let _ = !1;
|
|
3511
|
+
return y.traverse((x) => {
|
|
3512
|
+
if (x.type === "Mesh") {
|
|
3513
|
+
const S = x, A = Array.isArray(S.material) ? S.material : [S.material];
|
|
3514
|
+
for (const v of A)
|
|
3515
|
+
v && (v.type === "MeshStandardMaterial" || v.type === "MeshPhongMaterial") && (d.metalness !== void 0 && (v.metalness = d.metalness), d.roughness !== void 0 && (v.roughness = d.roughness), d.opacity !== void 0 && (v.opacity = d.opacity, v.transparent = d.opacity < 1), v.needsUpdate = !0, _ = !0);
|
|
3516
|
+
}
|
|
3517
|
+
}), _;
|
|
3518
|
+
}
|
|
3519
|
+
function f() {
|
|
3520
|
+
if (t.selectedObject) {
|
|
3521
|
+
const y = b(t.selectedObject, {
|
|
3522
|
+
metalness: c.metalness,
|
|
3523
|
+
roughness: c.roughness,
|
|
3524
|
+
opacity: c.opacity
|
|
3525
|
+
});
|
|
3526
|
+
p.value = y;
|
|
3527
|
+
}
|
|
3528
|
+
}
|
|
3529
|
+
return nn(
|
|
3530
|
+
() => t.selectedObject,
|
|
3531
|
+
(y) => {
|
|
3532
|
+
if (y) {
|
|
3533
|
+
const d = m(y);
|
|
3534
|
+
d ? (c.metalness = d.metalness, c.roughness = d.roughness, c.opacity = d.opacity, p.value = !0) : (c.metalness = 0, c.roughness = 0.5, c.opacity = 1, p.value = !1);
|
|
3535
|
+
} else
|
|
3536
|
+
c.metalness = 0, c.roughness = 0.5, c.opacity = 1, p.value = !1;
|
|
3537
|
+
},
|
|
3538
|
+
{ immediate: !0 }
|
|
3539
|
+
), (y, d) => r.transform ? (N(), U("div", Ji, [
|
|
3540
|
+
d[32] || (d[32] = g("h3", null, "属性面板", -1)),
|
|
3541
|
+
g("div", eo, [
|
|
3542
|
+
d[15] || (d[15] = g("label", null, "场景物体", -1)),
|
|
3543
|
+
g("div", to, [
|
|
3544
|
+
(N(!0), U(en, null, tn(r.treeData, (_) => (N(), ot(Wi, {
|
|
3545
|
+
key: _.uuid,
|
|
3546
|
+
node: _,
|
|
3469
3547
|
"selected-object": r.selectedObject,
|
|
3470
|
-
version:
|
|
3471
|
-
onSelect:
|
|
3472
|
-
onDelete:
|
|
3548
|
+
version: o.value,
|
|
3549
|
+
onSelect: d[0] || (d[0] = (x) => s("treeSelect", x)),
|
|
3550
|
+
onDelete: u
|
|
3473
3551
|
}, null, 8, ["node", "selected-object", "version"]))), 128)),
|
|
3474
|
-
r.treeData.length === 0 ? (
|
|
3475
|
-
])
|
|
3476
|
-
]),
|
|
3477
|
-
g("div", no, [
|
|
3478
|
-
c[14] || (c[14] = g("label", null, "位置", -1)),
|
|
3479
|
-
g("div", so, [
|
|
3480
|
-
c[11] || (c[11] = g("span", null, "X:", -1)),
|
|
3481
|
-
H(g("input", {
|
|
3482
|
-
type: "number",
|
|
3483
|
-
"onUpdate:modelValue": c[1] || (c[1] = (d) => r.transform.position.x = d),
|
|
3484
|
-
step: "0.01",
|
|
3485
|
-
onInput: n
|
|
3486
|
-
}, null, 544), [
|
|
3487
|
-
[
|
|
3488
|
-
oe,
|
|
3489
|
-
r.transform.position.x,
|
|
3490
|
-
void 0,
|
|
3491
|
-
{ number: !0 }
|
|
3492
|
-
]
|
|
3493
|
-
]),
|
|
3494
|
-
c[12] || (c[12] = g("span", null, "Y:", -1)),
|
|
3495
|
-
H(g("input", {
|
|
3496
|
-
type: "number",
|
|
3497
|
-
"onUpdate:modelValue": c[2] || (c[2] = (d) => r.transform.position.y = d),
|
|
3498
|
-
step: "0.01",
|
|
3499
|
-
onInput: n
|
|
3500
|
-
}, null, 544), [
|
|
3501
|
-
[
|
|
3502
|
-
oe,
|
|
3503
|
-
r.transform.position.y,
|
|
3504
|
-
void 0,
|
|
3505
|
-
{ number: !0 }
|
|
3506
|
-
]
|
|
3507
|
-
]),
|
|
3508
|
-
c[13] || (c[13] = g("span", null, "Z:", -1)),
|
|
3509
|
-
H(g("input", {
|
|
3510
|
-
type: "number",
|
|
3511
|
-
"onUpdate:modelValue": c[3] || (c[3] = (d) => r.transform.position.z = d),
|
|
3512
|
-
step: "0.01",
|
|
3513
|
-
onInput: n
|
|
3514
|
-
}, null, 544), [
|
|
3515
|
-
[
|
|
3516
|
-
oe,
|
|
3517
|
-
r.transform.position.z,
|
|
3518
|
-
void 0,
|
|
3519
|
-
{ number: !0 }
|
|
3520
|
-
]
|
|
3521
|
-
])
|
|
3552
|
+
r.treeData.length === 0 ? (N(), U("div", no, "暂无物体")) : de("", !0)
|
|
3522
3553
|
])
|
|
3523
3554
|
]),
|
|
3524
|
-
g("div",
|
|
3525
|
-
|
|
3526
|
-
g("div",
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3555
|
+
d[33] || (d[33] = g("div", { class: "property-group" }, [
|
|
3556
|
+
g("label", null, "全局属性"),
|
|
3557
|
+
g("div", { class: "row" })
|
|
3558
|
+
], -1)),
|
|
3559
|
+
r.selectedObject ? (N(), U("div", so, [
|
|
3560
|
+
g("button", {
|
|
3561
|
+
class: He(["tab-btn", { active: i.value === "transform" }]),
|
|
3562
|
+
onClick: d[1] || (d[1] = (_) => i.value = "transform")
|
|
3563
|
+
}, " 🔄 变换 ", 2),
|
|
3564
|
+
g("button", {
|
|
3565
|
+
class: He(["tab-btn", { active: i.value === "info" }]),
|
|
3566
|
+
onClick: d[2] || (d[2] = (_) => i.value = "info")
|
|
3567
|
+
}, " ℹ️ 信息 ", 2)
|
|
3568
|
+
])) : de("", !0),
|
|
3569
|
+
r.selectedObject ? (N(), U("div", io, [
|
|
3570
|
+
D(g("div", null, [
|
|
3571
|
+
g("div", oo, [
|
|
3572
|
+
d[19] || (d[19] = g("label", null, "位置", -1)),
|
|
3573
|
+
g("div", ro, [
|
|
3574
|
+
d[16] || (d[16] = g("span", null, "X:", -1)),
|
|
3575
|
+
D(g("input", {
|
|
3576
|
+
type: "number",
|
|
3577
|
+
"onUpdate:modelValue": d[3] || (d[3] = (_) => r.transform.position.x = _),
|
|
3578
|
+
step: "0.01",
|
|
3579
|
+
onInput: n
|
|
3580
|
+
}, null, 544), [
|
|
3581
|
+
[
|
|
3582
|
+
Q,
|
|
3583
|
+
r.transform.position.x,
|
|
3584
|
+
void 0,
|
|
3585
|
+
{ number: !0 }
|
|
3586
|
+
]
|
|
3587
|
+
]),
|
|
3588
|
+
d[17] || (d[17] = g("span", null, "Y:", -1)),
|
|
3589
|
+
D(g("input", {
|
|
3590
|
+
type: "number",
|
|
3591
|
+
"onUpdate:modelValue": d[4] || (d[4] = (_) => r.transform.position.y = _),
|
|
3592
|
+
step: "0.01",
|
|
3593
|
+
onInput: n
|
|
3594
|
+
}, null, 544), [
|
|
3595
|
+
[
|
|
3596
|
+
Q,
|
|
3597
|
+
r.transform.position.y,
|
|
3598
|
+
void 0,
|
|
3599
|
+
{ number: !0 }
|
|
3600
|
+
]
|
|
3601
|
+
]),
|
|
3602
|
+
d[18] || (d[18] = g("span", null, "Z:", -1)),
|
|
3603
|
+
D(g("input", {
|
|
3604
|
+
type: "number",
|
|
3605
|
+
"onUpdate:modelValue": d[5] || (d[5] = (_) => r.transform.position.z = _),
|
|
3606
|
+
step: "0.01",
|
|
3607
|
+
onInput: n
|
|
3608
|
+
}, null, 544), [
|
|
3609
|
+
[
|
|
3610
|
+
Q,
|
|
3611
|
+
r.transform.position.z,
|
|
3612
|
+
void 0,
|
|
3613
|
+
{ number: !0 }
|
|
3614
|
+
]
|
|
3615
|
+
])
|
|
3616
|
+
])
|
|
3554
3617
|
]),
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3618
|
+
g("div", ao, [
|
|
3619
|
+
d[23] || (d[23] = g("label", null, "旋转 (弧度)", -1)),
|
|
3620
|
+
g("div", lo, [
|
|
3621
|
+
d[20] || (d[20] = g("span", null, "X:", -1)),
|
|
3622
|
+
D(g("input", {
|
|
3623
|
+
type: "number",
|
|
3624
|
+
"onUpdate:modelValue": d[6] || (d[6] = (_) => r.transform.rotation.x = _),
|
|
3625
|
+
step: "0.01",
|
|
3626
|
+
onInput: n
|
|
3627
|
+
}, null, 544), [
|
|
3628
|
+
[
|
|
3629
|
+
Q,
|
|
3630
|
+
r.transform.rotation.x,
|
|
3631
|
+
void 0,
|
|
3632
|
+
{ number: !0 }
|
|
3633
|
+
]
|
|
3634
|
+
]),
|
|
3635
|
+
d[21] || (d[21] = g("span", null, "Y:", -1)),
|
|
3636
|
+
D(g("input", {
|
|
3637
|
+
type: "number",
|
|
3638
|
+
"onUpdate:modelValue": d[7] || (d[7] = (_) => r.transform.rotation.y = _),
|
|
3639
|
+
step: "0.01",
|
|
3640
|
+
onInput: n
|
|
3641
|
+
}, null, 544), [
|
|
3642
|
+
[
|
|
3643
|
+
Q,
|
|
3644
|
+
r.transform.rotation.y,
|
|
3645
|
+
void 0,
|
|
3646
|
+
{ number: !0 }
|
|
3647
|
+
]
|
|
3648
|
+
]),
|
|
3649
|
+
d[22] || (d[22] = g("span", null, "Z:", -1)),
|
|
3650
|
+
D(g("input", {
|
|
3651
|
+
type: "number",
|
|
3652
|
+
"onUpdate:modelValue": d[8] || (d[8] = (_) => r.transform.rotation.z = _),
|
|
3653
|
+
step: "0.01",
|
|
3654
|
+
onInput: n
|
|
3655
|
+
}, null, 544), [
|
|
3656
|
+
[
|
|
3657
|
+
Q,
|
|
3658
|
+
r.transform.rotation.z,
|
|
3659
|
+
void 0,
|
|
3660
|
+
{ number: !0 }
|
|
3661
|
+
]
|
|
3662
|
+
])
|
|
3663
|
+
])
|
|
3587
3664
|
]),
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3665
|
+
g("div", co, [
|
|
3666
|
+
d[27] || (d[27] = g("label", null, "缩放", -1)),
|
|
3667
|
+
g("div", ho, [
|
|
3668
|
+
d[24] || (d[24] = g("span", null, "X:", -1)),
|
|
3669
|
+
D(g("input", {
|
|
3670
|
+
type: "number",
|
|
3671
|
+
"onUpdate:modelValue": d[9] || (d[9] = (_) => r.transform.scale.x = _),
|
|
3672
|
+
step: "0.01",
|
|
3673
|
+
onInput: n
|
|
3674
|
+
}, null, 544), [
|
|
3675
|
+
[
|
|
3676
|
+
Q,
|
|
3677
|
+
r.transform.scale.x,
|
|
3678
|
+
void 0,
|
|
3679
|
+
{ number: !0 }
|
|
3680
|
+
]
|
|
3681
|
+
]),
|
|
3682
|
+
d[25] || (d[25] = g("span", null, "Y:", -1)),
|
|
3683
|
+
D(g("input", {
|
|
3684
|
+
type: "number",
|
|
3685
|
+
"onUpdate:modelValue": d[10] || (d[10] = (_) => r.transform.scale.y = _),
|
|
3686
|
+
step: "0.01",
|
|
3687
|
+
onInput: n
|
|
3688
|
+
}, null, 544), [
|
|
3689
|
+
[
|
|
3690
|
+
Q,
|
|
3691
|
+
r.transform.scale.y,
|
|
3692
|
+
void 0,
|
|
3693
|
+
{ number: !0 }
|
|
3694
|
+
]
|
|
3695
|
+
]),
|
|
3696
|
+
d[26] || (d[26] = g("span", null, "Z:", -1)),
|
|
3697
|
+
D(g("input", {
|
|
3698
|
+
type: "number",
|
|
3699
|
+
"onUpdate:modelValue": d[11] || (d[11] = (_) => r.transform.scale.z = _),
|
|
3700
|
+
step: "0.01",
|
|
3701
|
+
onInput: n
|
|
3702
|
+
}, null, 544), [
|
|
3703
|
+
[
|
|
3704
|
+
Q,
|
|
3705
|
+
r.transform.scale.z,
|
|
3706
|
+
void 0,
|
|
3707
|
+
{ number: !0 }
|
|
3708
|
+
]
|
|
3709
|
+
])
|
|
3710
|
+
])
|
|
3601
3711
|
]),
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3712
|
+
r.selectedObject ? (N(), U("div", uo, [
|
|
3713
|
+
d[31] || (d[31] = g("label", null, "材质", -1)),
|
|
3714
|
+
g("div", po, [
|
|
3715
|
+
d[28] || (d[28] = g("span", { class: "slider-label" }, "金属度", -1)),
|
|
3716
|
+
D(g("input", {
|
|
3717
|
+
type: "range",
|
|
3718
|
+
min: "0",
|
|
3719
|
+
max: "1",
|
|
3720
|
+
step: "0.01",
|
|
3721
|
+
"onUpdate:modelValue": d[12] || (d[12] = (_) => c.metalness = _),
|
|
3722
|
+
onInput: f
|
|
3723
|
+
}, null, 544), [
|
|
3724
|
+
[
|
|
3725
|
+
Q,
|
|
3726
|
+
c.metalness,
|
|
3727
|
+
void 0,
|
|
3728
|
+
{ number: !0 }
|
|
3729
|
+
]
|
|
3730
|
+
]),
|
|
3731
|
+
g("span", fo, Ee(c.metalness.toFixed(2)), 1)
|
|
3732
|
+
]),
|
|
3733
|
+
g("div", mo, [
|
|
3734
|
+
d[29] || (d[29] = g("span", { class: "slider-label" }, "粗糙度", -1)),
|
|
3735
|
+
D(g("input", {
|
|
3736
|
+
type: "range",
|
|
3737
|
+
min: "0",
|
|
3738
|
+
max: "1",
|
|
3739
|
+
step: "0.01",
|
|
3740
|
+
"onUpdate:modelValue": d[13] || (d[13] = (_) => c.roughness = _),
|
|
3741
|
+
onInput: f
|
|
3742
|
+
}, null, 544), [
|
|
3743
|
+
[
|
|
3744
|
+
Q,
|
|
3745
|
+
c.roughness,
|
|
3746
|
+
void 0,
|
|
3747
|
+
{ number: !0 }
|
|
3748
|
+
]
|
|
3749
|
+
]),
|
|
3750
|
+
g("span", go, Ee(c.roughness.toFixed(2)), 1)
|
|
3751
|
+
]),
|
|
3752
|
+
g("div", yo, [
|
|
3753
|
+
d[30] || (d[30] = g("span", { class: "slider-label" }, "透明度", -1)),
|
|
3754
|
+
D(g("input", {
|
|
3755
|
+
type: "range",
|
|
3756
|
+
min: "0",
|
|
3757
|
+
max: "1",
|
|
3758
|
+
step: "0.01",
|
|
3759
|
+
"onUpdate:modelValue": d[14] || (d[14] = (_) => c.opacity = _),
|
|
3760
|
+
onInput: f
|
|
3761
|
+
}, null, 544), [
|
|
3762
|
+
[
|
|
3763
|
+
Q,
|
|
3764
|
+
c.opacity,
|
|
3765
|
+
void 0,
|
|
3766
|
+
{ number: !0 }
|
|
3767
|
+
]
|
|
3768
|
+
]),
|
|
3769
|
+
g("span", _o, Ee(c.opacity.toFixed(2)), 1)
|
|
3770
|
+
]),
|
|
3771
|
+
p.value ? de("", !0) : (N(), U("div", bo, " ⚠️ 当前材质不支持金属度/粗糙度(仅支持 Standard/Phong) "))
|
|
3772
|
+
])) : de("", !0)
|
|
3773
|
+
], 512), [
|
|
3774
|
+
[he, i.value === "transform"]
|
|
3616
3775
|
])
|
|
3617
|
-
])
|
|
3618
|
-
])) : (
|
|
3776
|
+
])) : de("", !0)
|
|
3777
|
+
])) : (N(), U("div", wo, [...d[34] || (d[34] = [
|
|
3619
3778
|
g("p", null, "未选中任何模型", -1)
|
|
3620
3779
|
])]));
|
|
3621
3780
|
}
|
|
3622
|
-
}),
|
|
3781
|
+
}), xo = /* @__PURE__ */ Xe(To, [["__scopeId", "data-v-d75c643f"]]), Eo = { class: "top-bar" }, Mo = { class: "left-section" }, vo = { class: "dropdown-menu" }, So = { class: "dropdown-menu sub-menu" }, Ro = { class: "dropdown-menu" }, Ao = { class: "dropdown-menu sub-menu" }, Po = { class: "dropdown-menu" }, Lo = { class: "dropdown-menu" }, Io = { class: "dropdown-menu" }, Oo = /* @__PURE__ */ Ge({
|
|
3623
3782
|
__name: "TopBar",
|
|
3624
3783
|
emits: ["addModel", "importModel"],
|
|
3625
3784
|
setup(r, { emit: e }) {
|
|
3626
|
-
const t =
|
|
3627
|
-
var
|
|
3628
|
-
return (
|
|
3629
|
-
},
|
|
3630
|
-
const
|
|
3631
|
-
|
|
3632
|
-
},
|
|
3633
|
-
return (
|
|
3634
|
-
g("div",
|
|
3785
|
+
const t = G(!1), s = G(!1), n = G(!1), i = G(!1), o = G(!1), a = G(!1), l = G(!1), h = e, u = G(null), c = () => {
|
|
3786
|
+
var $;
|
|
3787
|
+
return ($ = u.value) == null ? void 0 : $.click();
|
|
3788
|
+
}, p = ($) => {
|
|
3789
|
+
const E = $.target;
|
|
3790
|
+
E.files && E.files.length > 0 && (h("importModel", E.files[0]), E.value = "");
|
|
3791
|
+
}, m = () => console.log("新建项目"), b = () => console.log("保存场景"), f = () => console.log("导出模型"), y = () => console.log("撤销"), d = () => console.log("重做"), _ = () => console.log("复制物体"), x = () => console.log("删除物体"), S = () => console.log("重置相机"), A = () => console.log("切换网格"), v = () => console.log("打开帮助"), I = () => console.log("关于编辑器"), ie = () => console.log("打开项目"), ee = () => console.log("打开模型"), fe = () => console.log("打开场景");
|
|
3792
|
+
return ($, E) => (N(), U("div", Eo, [
|
|
3793
|
+
g("div", Mo, [
|
|
3635
3794
|
g("div", {
|
|
3636
3795
|
class: "dropdown-wrapper",
|
|
3637
|
-
onMouseenter:
|
|
3638
|
-
onMouseleave:
|
|
3796
|
+
onMouseenter: E[2] || (E[2] = (j) => t.value = !0),
|
|
3797
|
+
onMouseleave: E[3] || (E[3] = (j) => t.value = !1)
|
|
3639
3798
|
}, [
|
|
3640
|
-
|
|
3641
|
-
|
|
3799
|
+
E[17] || (E[17] = g("button", { class: "menu-btn" }, "文件", -1)),
|
|
3800
|
+
D(g("div", vo, [
|
|
3642
3801
|
g("div", {
|
|
3643
3802
|
class: "menu-item",
|
|
3644
|
-
onClick:
|
|
3803
|
+
onClick: m
|
|
3645
3804
|
}, "新建"),
|
|
3646
3805
|
g("div", {
|
|
3647
3806
|
class: "menu-item dropdown-wrapper sub-trigger",
|
|
3648
|
-
onMouseenter:
|
|
3649
|
-
onMouseleave:
|
|
3807
|
+
onMouseenter: E[0] || (E[0] = (j) => a.value = !0),
|
|
3808
|
+
onMouseleave: E[1] || (E[1] = (j) => a.value = !1)
|
|
3650
3809
|
}, [
|
|
3651
|
-
|
|
3652
|
-
|
|
3810
|
+
E[16] || (E[16] = g("span", null, "打开", -1)),
|
|
3811
|
+
D(g("div", So, [
|
|
3653
3812
|
g("div", {
|
|
3654
3813
|
class: "menu-item",
|
|
3655
|
-
onClick:
|
|
3814
|
+
onClick: ie
|
|
3656
3815
|
}, "打开项目"),
|
|
3657
3816
|
g("div", {
|
|
3658
3817
|
class: "menu-item",
|
|
3659
|
-
onClick:
|
|
3818
|
+
onClick: ee
|
|
3660
3819
|
}, "打开模型"),
|
|
3661
3820
|
g("div", {
|
|
3662
3821
|
class: "menu-item",
|
|
3663
|
-
onClick:
|
|
3822
|
+
onClick: fe
|
|
3664
3823
|
}, "打开场景")
|
|
3665
3824
|
], 512), [
|
|
3666
|
-
[
|
|
3825
|
+
[he, a.value]
|
|
3667
3826
|
])
|
|
3668
3827
|
], 32),
|
|
3669
3828
|
g("div", {
|
|
3670
3829
|
class: "menu-item",
|
|
3671
|
-
onClick:
|
|
3830
|
+
onClick: b
|
|
3672
3831
|
}, "保存"),
|
|
3673
3832
|
g("div", {
|
|
3674
3833
|
class: "menu-item",
|
|
3675
|
-
onClick:
|
|
3834
|
+
onClick: f
|
|
3676
3835
|
}, "导出")
|
|
3677
3836
|
], 512), [
|
|
3678
|
-
[
|
|
3837
|
+
[he, t.value]
|
|
3679
3838
|
])
|
|
3680
3839
|
], 32),
|
|
3681
3840
|
g("div", {
|
|
3682
3841
|
class: "dropdown-wrapper",
|
|
3683
|
-
onMouseenter:
|
|
3684
|
-
onMouseleave:
|
|
3842
|
+
onMouseenter: E[8] || (E[8] = (j) => o.value = !0),
|
|
3843
|
+
onMouseleave: E[9] || (E[9] = (j) => o.value = !1)
|
|
3685
3844
|
}, [
|
|
3686
|
-
|
|
3687
|
-
|
|
3845
|
+
E[19] || (E[19] = g("button", { class: "menu-btn" }, "添加", -1)),
|
|
3846
|
+
D(g("div", Ro, [
|
|
3688
3847
|
g("div", {
|
|
3689
3848
|
class: "menu-item",
|
|
3690
3849
|
onClick: y
|
|
3691
3850
|
}, "组"),
|
|
3692
3851
|
g("div", {
|
|
3693
3852
|
class: "menu-item dropdown-wrapper sub-trigger",
|
|
3694
|
-
onMouseenter:
|
|
3695
|
-
onMouseleave:
|
|
3853
|
+
onMouseenter: E[6] || (E[6] = (j) => l.value = !0),
|
|
3854
|
+
onMouseleave: E[7] || (E[7] = (j) => l.value = !1)
|
|
3696
3855
|
}, [
|
|
3697
|
-
|
|
3698
|
-
|
|
3856
|
+
E[18] || (E[18] = g("span", null, "网格", -1)),
|
|
3857
|
+
D(g("div", Ao, [
|
|
3699
3858
|
g("div", {
|
|
3700
3859
|
class: "menu-item",
|
|
3701
|
-
onClick:
|
|
3860
|
+
onClick: E[4] || (E[4] = (j) => h("addModel", "box"))
|
|
3702
3861
|
}, " 正方体 "),
|
|
3703
3862
|
g("div", {
|
|
3704
3863
|
class: "menu-item",
|
|
3705
|
-
onClick:
|
|
3864
|
+
onClick: E[5] || (E[5] = (j) => h("addModel", "sphere"))
|
|
3706
3865
|
}, " 球体 "),
|
|
3707
3866
|
g("div", {
|
|
3708
3867
|
class: "menu-item",
|
|
3709
3868
|
onClick: c
|
|
3710
3869
|
}, "导入")
|
|
3711
3870
|
], 512), [
|
|
3712
|
-
[
|
|
3871
|
+
[he, l.value]
|
|
3713
3872
|
])
|
|
3714
3873
|
], 32),
|
|
3715
3874
|
g("div", {
|
|
3716
3875
|
class: "menu-item",
|
|
3717
|
-
onClick:
|
|
3876
|
+
onClick: _
|
|
3718
3877
|
}, "光源"),
|
|
3719
3878
|
g("div", {
|
|
3720
3879
|
class: "menu-item",
|
|
3721
|
-
onClick:
|
|
3880
|
+
onClick: x
|
|
3722
3881
|
}, "摄像机")
|
|
3723
3882
|
], 512), [
|
|
3724
|
-
[
|
|
3883
|
+
[he, o.value]
|
|
3725
3884
|
])
|
|
3726
3885
|
], 32),
|
|
3727
3886
|
g("div", {
|
|
3728
3887
|
class: "dropdown-wrapper",
|
|
3729
|
-
onMouseenter:
|
|
3730
|
-
onMouseleave:
|
|
3888
|
+
onMouseenter: E[10] || (E[10] = (j) => s.value = !0),
|
|
3889
|
+
onMouseleave: E[11] || (E[11] = (j) => s.value = !1)
|
|
3731
3890
|
}, [
|
|
3732
|
-
|
|
3733
|
-
|
|
3891
|
+
E[20] || (E[20] = g("button", { class: "menu-btn" }, "编辑", -1)),
|
|
3892
|
+
D(g("div", Po, [
|
|
3734
3893
|
g("div", {
|
|
3735
3894
|
class: "menu-item",
|
|
3736
3895
|
onClick: y
|
|
3737
3896
|
}, "撤销"),
|
|
3738
3897
|
g("div", {
|
|
3739
3898
|
class: "menu-item",
|
|
3740
|
-
onClick:
|
|
3899
|
+
onClick: d
|
|
3741
3900
|
}, "重做"),
|
|
3742
3901
|
g("div", {
|
|
3743
3902
|
class: "menu-item",
|
|
3744
|
-
onClick:
|
|
3903
|
+
onClick: _
|
|
3745
3904
|
}, "复制"),
|
|
3746
3905
|
g("div", {
|
|
3747
3906
|
class: "menu-item",
|
|
3748
|
-
onClick:
|
|
3907
|
+
onClick: x
|
|
3749
3908
|
}, "删除")
|
|
3750
3909
|
], 512), [
|
|
3751
|
-
[
|
|
3910
|
+
[he, s.value]
|
|
3752
3911
|
])
|
|
3753
3912
|
], 32),
|
|
3754
3913
|
g("div", {
|
|
3755
3914
|
class: "dropdown-wrapper",
|
|
3756
|
-
onMouseenter:
|
|
3757
|
-
onMouseleave:
|
|
3915
|
+
onMouseenter: E[12] || (E[12] = (j) => n.value = !0),
|
|
3916
|
+
onMouseleave: E[13] || (E[13] = (j) => n.value = !1)
|
|
3758
3917
|
}, [
|
|
3759
|
-
|
|
3760
|
-
|
|
3918
|
+
E[21] || (E[21] = g("button", { class: "menu-btn" }, "视图", -1)),
|
|
3919
|
+
D(g("div", Lo, [
|
|
3761
3920
|
g("div", {
|
|
3762
3921
|
class: "menu-item",
|
|
3763
3922
|
onClick: S
|
|
3764
3923
|
}, "重置相机"),
|
|
3765
3924
|
g("div", {
|
|
3766
3925
|
class: "menu-item",
|
|
3767
|
-
onClick:
|
|
3926
|
+
onClick: A
|
|
3768
3927
|
}, "显示网格")
|
|
3769
3928
|
], 512), [
|
|
3770
|
-
[
|
|
3929
|
+
[he, n.value]
|
|
3771
3930
|
])
|
|
3772
3931
|
], 32),
|
|
3773
3932
|
g("div", {
|
|
3774
3933
|
class: "dropdown-wrapper",
|
|
3775
|
-
onMouseenter:
|
|
3776
|
-
onMouseleave:
|
|
3934
|
+
onMouseenter: E[14] || (E[14] = (j) => i.value = !0),
|
|
3935
|
+
onMouseleave: E[15] || (E[15] = (j) => i.value = !1)
|
|
3777
3936
|
}, [
|
|
3778
|
-
|
|
3779
|
-
|
|
3937
|
+
E[22] || (E[22] = g("button", { class: "menu-btn" }, "帮助", -1)),
|
|
3938
|
+
D(g("div", Io, [
|
|
3780
3939
|
g("div", {
|
|
3781
3940
|
class: "menu-item",
|
|
3782
3941
|
onClick: v
|
|
@@ -3786,11 +3945,11 @@ const $i = {
|
|
|
3786
3945
|
onClick: I
|
|
3787
3946
|
}, "关于")
|
|
3788
3947
|
], 512), [
|
|
3789
|
-
[
|
|
3948
|
+
[he, i.value]
|
|
3790
3949
|
])
|
|
3791
3950
|
], 32)
|
|
3792
3951
|
]),
|
|
3793
|
-
|
|
3952
|
+
E[23] || (E[23] = g("div", { class: "right-section" }, [
|
|
3794
3953
|
g("span", { class: "app-title" }, "3D 模型编辑器")
|
|
3795
3954
|
], -1)),
|
|
3796
3955
|
g("input", {
|
|
@@ -3799,14 +3958,14 @@ const $i = {
|
|
|
3799
3958
|
ref: u,
|
|
3800
3959
|
accept: ".obj,.gltf,.glb",
|
|
3801
3960
|
style: { display: "none" },
|
|
3802
|
-
onChange:
|
|
3961
|
+
onChange: p
|
|
3803
3962
|
}, null, 544)
|
|
3804
3963
|
]));
|
|
3805
3964
|
}
|
|
3806
|
-
}),
|
|
3965
|
+
}), Co = /* @__PURE__ */ Xe(Oo, [["__scopeId", "data-v-6bb4762f"]]), Do = { class: "bottom-bar" }, No = /* @__PURE__ */ Ge({
|
|
3807
3966
|
__name: "BottomBar",
|
|
3808
3967
|
setup(r) {
|
|
3809
|
-
return (e, t) => (
|
|
3968
|
+
return (e, t) => (N(), U("div", Do, [...t[0] || (t[0] = [
|
|
3810
3969
|
g("div", { class: "status-left" }, [
|
|
3811
3970
|
g("span", null, "就绪")
|
|
3812
3971
|
], -1),
|
|
@@ -3815,95 +3974,104 @@ const $i = {
|
|
|
3815
3974
|
], -1)
|
|
3816
3975
|
])]));
|
|
3817
3976
|
}
|
|
3818
|
-
}),
|
|
3977
|
+
}), ko = /* @__PURE__ */ Xe(No, [["__scopeId", "data-v-3427bb27"]]), jo = { class: "app-layout" }, Fo = /* @__PURE__ */ Ge({
|
|
3819
3978
|
__name: "DrawingBoard",
|
|
3979
|
+
props: {
|
|
3980
|
+
mode: { default: "edit" }
|
|
3981
|
+
},
|
|
3820
3982
|
setup(r) {
|
|
3821
|
-
const e =
|
|
3983
|
+
const e = r, t = G(null), s = sn({
|
|
3822
3984
|
position: { x: 0, y: 0, z: 0 },
|
|
3823
3985
|
rotation: { x: 0, y: 0, z: 0 },
|
|
3824
3986
|
scale: { x: 1, y: 1, z: 1 }
|
|
3825
|
-
}),
|
|
3826
|
-
|
|
3827
|
-
},
|
|
3987
|
+
}), n = (f) => {
|
|
3988
|
+
s.position.x = Number(f.position.x.toFixed(3)), s.position.y = Number(f.position.y.toFixed(3)), s.position.z = Number(f.position.z.toFixed(3)), s.rotation.x = Number(f.rotation.x.toFixed(3)), s.rotation.y = Number(f.rotation.y.toFixed(3)), s.rotation.z = Number(f.rotation.z.toFixed(3)), s.scale.x = Number(f.scale.x.toFixed(3)), s.scale.y = Number(f.scale.y.toFixed(3)), s.scale.z = Number(f.scale.z.toFixed(3));
|
|
3989
|
+
}, i = (f) => {
|
|
3828
3990
|
f.position.set(
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3991
|
+
s.position.x,
|
|
3992
|
+
s.position.y,
|
|
3993
|
+
s.position.z
|
|
3832
3994
|
), f.rotation.set(
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
), f.scale.set(
|
|
3995
|
+
s.rotation.x,
|
|
3996
|
+
s.rotation.y,
|
|
3997
|
+
s.rotation.z
|
|
3998
|
+
), f.scale.set(s.scale.x, s.scale.y, s.scale.z);
|
|
3837
3999
|
};
|
|
3838
4000
|
qs((f) => {
|
|
3839
|
-
|
|
4001
|
+
t.value = f, f && n(f);
|
|
3840
4002
|
}), Ws((f) => {
|
|
3841
|
-
|
|
4003
|
+
n(f);
|
|
3842
4004
|
});
|
|
3843
|
-
const
|
|
3844
|
-
|
|
3845
|
-
},
|
|
4005
|
+
const o = () => {
|
|
4006
|
+
t.value && i(t.value);
|
|
4007
|
+
}, a = (f) => Bi(f), l = async (f) => {
|
|
3846
4008
|
try {
|
|
3847
|
-
await
|
|
3848
|
-
} catch (
|
|
3849
|
-
console.error("导入失败:",
|
|
4009
|
+
await Yi(f);
|
|
4010
|
+
} catch (y) {
|
|
4011
|
+
console.error("导入失败:", y), alert("导入失败:" + y.message);
|
|
3850
4012
|
}
|
|
3851
|
-
},
|
|
4013
|
+
}, h = Rn([]);
|
|
3852
4014
|
$s((f) => {
|
|
3853
|
-
|
|
4015
|
+
h.value = f;
|
|
3854
4016
|
});
|
|
3855
|
-
const
|
|
4017
|
+
const u = () => {
|
|
3856
4018
|
const f = Js();
|
|
3857
|
-
f && (
|
|
3858
|
-
},
|
|
3859
|
-
return
|
|
3860
|
-
|
|
3861
|
-
}), (f,
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
4019
|
+
f && (h.value = f);
|
|
4020
|
+
}, c = (f) => Mt(f), p = (f) => Ks(f.uuid), m = G(null);
|
|
4021
|
+
return An(() => {
|
|
4022
|
+
m.value && Ns(m.value, e.mode), u();
|
|
4023
|
+
}), (f, y) => (N(), U("div", jo, [
|
|
4024
|
+
r.mode === "edit" ? (N(), ot(Co, {
|
|
4025
|
+
key: 0,
|
|
4026
|
+
onAddModel: a,
|
|
4027
|
+
onImportModel: l
|
|
4028
|
+
})) : de("", !0),
|
|
4029
|
+
g("div", {
|
|
4030
|
+
class: He(`editor-container editor-container-mode-${r.mode}`)
|
|
4031
|
+
}, [
|
|
3867
4032
|
g("div", {
|
|
3868
|
-
class:
|
|
4033
|
+
class: He(`canvas canvas-mode-${r.mode}`),
|
|
3869
4034
|
ref_key: "containerRef",
|
|
3870
|
-
ref:
|
|
3871
|
-
}, null,
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
"
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
4035
|
+
ref: m
|
|
4036
|
+
}, null, 2),
|
|
4037
|
+
r.mode === "edit" ? (N(), ot(xo, {
|
|
4038
|
+
key: 0,
|
|
4039
|
+
transform: s,
|
|
4040
|
+
"tree-data": h.value,
|
|
4041
|
+
"selected-object": t.value,
|
|
4042
|
+
onPropertyChange: o,
|
|
4043
|
+
onTreeSelect: c,
|
|
4044
|
+
onTreeDelete: p
|
|
4045
|
+
}, null, 8, ["transform", "tree-data", "selected-object"])) : de("", !0)
|
|
4046
|
+
], 2),
|
|
4047
|
+
Pn(ko)
|
|
3882
4048
|
]));
|
|
3883
4049
|
}
|
|
3884
|
-
}),
|
|
4050
|
+
}), Ko = /* @__PURE__ */ Xe(Fo, [["__scopeId", "data-v-290e9b49"]]);
|
|
3885
4051
|
export {
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
4052
|
+
ko as BottomBar,
|
|
4053
|
+
Ko as DrawingBoard,
|
|
4054
|
+
xo as PropertyPanel,
|
|
4055
|
+
Co as TopBar,
|
|
4056
|
+
Wi as TreeItem,
|
|
4057
|
+
Gi as addBox,
|
|
4058
|
+
vt as addModel,
|
|
4059
|
+
Bi as addModelByType,
|
|
4060
|
+
Xi as addSphere,
|
|
4061
|
+
Bo as exportSceneToJSON,
|
|
4062
|
+
Xo as getCamera,
|
|
4063
|
+
Yo as getRenderer,
|
|
4064
|
+
Go as getScene,
|
|
3898
4065
|
Js as getSceneObjects,
|
|
3899
|
-
|
|
4066
|
+
Yi as importModelFromFile,
|
|
3900
4067
|
Ns as initEditor,
|
|
4068
|
+
ei as loadSceneFromJSON,
|
|
3901
4069
|
$s as onSceneObjectsChangeCallback,
|
|
3902
4070
|
Bs as removeModel,
|
|
3903
4071
|
Ks as removeModelById,
|
|
3904
|
-
|
|
4072
|
+
Mt as selectObject,
|
|
3905
4073
|
qs as setSelectedObjectCallback,
|
|
3906
4074
|
Ws as setTransformChangeCallback,
|
|
3907
|
-
|
|
4075
|
+
$i as useTreeExpand
|
|
3908
4076
|
};
|
|
3909
4077
|
//# sourceMappingURL=three-editor.es.js.map
|