endset_three_editor 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/DrawingBoard.vue.d.ts +6 -1
- package/dist/endset_three_editor.css +1 -1
- package/dist/three/index.d.ts +17 -1
- package/dist/three-editor.cjs.js +2 -2
- package/dist/three-editor.cjs.js.map +1 -1
- package/dist/three-editor.es.js +1079 -909
- 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 Fe, 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 k 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 w, 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 Et, Color as pe, SRGBColorSpace as Re, Group as tt, Material as je, PointsMaterial as Ce, MeshPhongMaterial as kn, LineSegments as gt, Points as nt, TrianglesDrawMode as jn, TriangleFanDrawMode as yt, TriangleStripDrawMode as cn, LoaderUtils as He, MeshPhysicalMaterial as se, LinearSRGBColorSpace as ae, SpotLight as Hn, PointLight as Fn, DirectionalLight as Un, InstancedMesh as zn, InstancedBufferAttribute as Gn, TextureLoader as Xn, ImageBitmapLoader as Yn, BufferAttribute as at, InterleavedBuffer as Bn, InterleavedBufferAttribute as Kn, LinearMipmapLinearFilter as hn, NearestMipmapLinearFilter as Vn, LinearMipmapNearestFilter as Zn, NearestMipmapNearestFilter as Qn, LinearFilter as _t, NearestFilter as un, RepeatWrapping as bt, 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" }, Mt = { type: "start" }, fn = { type: "end" }, qe = new Ln(), kt = new In(), ds = Math.cos(70 * rn.DEG2RAD), j = 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
|
+
}, lt = 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
|
+
j.copy(t).sub(this.target), j.applyQuaternion(this._quat), this._spherical.setFromVector3(j), 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 (j.setFromSpherical(this._spherical), j.applyQuaternion(this._quatInverse), t.copy(this.target).add(j), this.object.lookAt(this.target), this.enableDamping === !0 ? (this._sphericalDelta.theta *= 1 - this.dampingFactor, this._sphericalDelta.phi *= 1 - this.dampingFactor, this._panOffset.multiplyScalar(1 - this.dampingFactor)) : (this._sphericalDelta.set(0, 0, 0), this._panOffset.set(0, 0, 0)), this.zoomToCursor && this._performCursorZoom) {
|
|
152
152
|
let o = null;
|
|
153
153
|
if (this.object.isPerspectiveCamera) {
|
|
154
|
-
const a =
|
|
154
|
+
const a = j.length();
|
|
155
155
|
o = this._clampDistance(a * this._scale);
|
|
156
156
|
const l = a - o;
|
|
157
157
|
this.object.position.addScaledVector(this._dollyDirection, l), this.object.updateMatrixWorld(), i = !!l;
|
|
158
158
|
} else if (this.object.isOrthographicCamera) {
|
|
159
|
-
const a = new
|
|
159
|
+
const a = new 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 = j.length();
|
|
165
165
|
} else
|
|
166
166
|
console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
|
|
167
|
-
o !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position) : (
|
|
167
|
+
o !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position) : (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) > lt || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > lt || this._lastTargetPosition.distanceToSquared(this.target) > lt ? (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
|
+
j.setFromMatrixColumn(t, 0), j.multiplyScalar(-e), this._panOffset.add(j);
|
|
189
189
|
}
|
|
190
190
|
_panUp(e, t) {
|
|
191
|
-
this.screenSpacePanning === !0 ?
|
|
191
|
+
this.screenSpacePanning === !0 ? j.setFromMatrixColumn(t, 1) : (j.setFromMatrixColumn(t, 0), j.crossVectors(this.object.up, j)), j.multiplyScalar(e), this._panOffset.add(j);
|
|
192
192
|
}
|
|
193
193
|
// deltaX and deltaY are in pixels; right and down are positive
|
|
194
194
|
_pan(e, t) {
|
|
195
195
|
const s = this.domElement;
|
|
196
196
|
if (this.object.isPerspectiveCamera) {
|
|
197
197
|
const n = this.object.position;
|
|
198
|
-
|
|
199
|
-
let i =
|
|
198
|
+
j.copy(n).sub(this.target);
|
|
199
|
+
let i = j.length();
|
|
200
200
|
i *= Math.tan(this.object.fov / 2 * Math.PI / 180), this._panLeft(2 * e * i / s.clientHeight, this.object.matrix), this._panUp(2 * t * i / s.clientHeight, this.object.matrix);
|
|
201
201
|
} else this.object.isOrthographicCamera ? (this._panLeft(e * (this.object.right - this.object.left) / this.object.zoom / s.clientWidth, this.object.matrix), this._panUp(t * (this.object.top - this.object.bottom) / this.object.zoom / s.clientHeight, this.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), this.enablePan = !1);
|
|
202
202
|
}
|
|
@@ -231,7 +231,7 @@ class ps extends 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(Mt);
|
|
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(Mt), 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(Mt);
|
|
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(), F = 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
|
+
}, ct = { type: "change" }, Ht = { type: "mouseDown", mode: null }, Ft = { 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(ct));
|
|
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 = ht(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 = ht(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, Ht.mode = this.mode, this.dispatchEvent(Ht);
|
|
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 = ht(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(F.setFromMatrixPosition(n.parent.matrixWorld)), t.search("X") !== -1 && (n.position.x = Math.round(n.position.x / this.translationSnap) * this.translationSnap), t.search("Y") !== -1 && (n.position.y = Math.round(n.position.y / this.translationSnap) * this.translationSnap), t.search("Z") !== -1 && (n.position.z = Math.round(n.position.z / this.translationSnap) * this.translationSnap), n.parent && n.position.sub(F.setFromMatrixPosition(n.parent.matrixWorld)))), n.position.x = Math.max(this.minX, Math.min(this.maxX, n.position.x)), n.position.y = Math.max(this.minY, Math.min(this.maxY, n.position.y)), n.position.z = Math.max(this.minZ, Math.min(this.maxZ, n.position.z));
|
|
585
585
|
else if (s === "scale") {
|
|
586
586
|
if (t.search("XYZ") !== -1) {
|
|
587
587
|
let a = this.pointEnd.length() / this.pointStart.length();
|
|
588
588
|
this.pointEnd.dot(this.pointStart) < 0 && (a *= -1), le.set(a, a, a);
|
|
589
589
|
} else
|
|
590
|
-
|
|
590
|
+
F.copy(this.pointStart), le.copy(this.pointEnd), F.applyQuaternion(this._worldQuaternionInv), le.applyQuaternion(this._worldQuaternionInv), le.divide(F), 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(F.setFromMatrixPosition(this.camera.matrixWorld));
|
|
595
595
|
let l = !1;
|
|
596
|
-
t === "XYZE" ? (this.rotationAxis.copy(this._offset).cross(this.eye).normalize(), this.rotationAngle = this._offset.dot(
|
|
596
|
+
t === "XYZE" ? (this.rotationAxis.copy(this._offset).cross(this.eye).normalize(), this.rotationAngle = this._offset.dot(F.copy(this.rotationAxis).cross(this.eye)) * a) : (t === "X" || t === "Y" || t === "Z") && (this.rotationAxis.copy(jt[t]), F.copy(jt[t]), i === "local" && F.applyQuaternion(this.worldQuaternion), F.cross(this.eye), F.length() === 0 ? l = !0 : this.rotationAngle = this._offset.dot(F.normalize()) * a), (t === "E" || l) && (this.rotationAxis.copy(this.eye), this.rotationAngle = this.pointEnd.angleTo(this.pointStart), this._startNorm.copy(this.pointStart).normalize(), this._endNorm.copy(this.pointEnd).normalize(), this.rotationAngle *= this._endNorm.cross(this._startNorm).dot(this.eye) < 0 ? 1 : -1), this.rotationSnap && (this.rotationAngle = Math.round(this.rotationAngle / this.rotationSnap) * this.rotationSnap), i === "local" && t !== "E" && t !== "XYZE" ? (n.quaternion.copy(this._quaternionStart), n.quaternion.multiply(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(ct), 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 && (Ft.mode = this.mode, this.dispatchEvent(Ft)), 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(ct), 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 ht(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 w(f, i), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
|
|
832
|
+
[new w(f, i), [-0.5, 0, 0], [0, 0, Math.PI / 2]],
|
|
833
|
+
[new w(_, i), [0, 0, 0], [0, 0, -Math.PI / 2]]
|
|
834
834
|
],
|
|
835
835
|
Y: [
|
|
836
|
-
[new
|
|
837
|
-
[new
|
|
838
|
-
[new
|
|
836
|
+
[new w(f, o), [0, 0.5, 0]],
|
|
837
|
+
[new w(f, o), [0, -0.5, 0], [Math.PI, 0, 0]],
|
|
838
|
+
[new w(_, o)]
|
|
839
839
|
],
|
|
840
840
|
Z: [
|
|
841
|
-
[new
|
|
842
|
-
[new
|
|
843
|
-
[new
|
|
841
|
+
[new w(f, a), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
|
|
842
|
+
[new w(f, a), [0, 0, -0.5], [-Math.PI / 2, 0, 0]],
|
|
843
|
+
[new w(_, a), null, [Math.PI / 2, 0, 0]]
|
|
844
844
|
],
|
|
845
845
|
XYZ: [
|
|
846
|
-
[new
|
|
846
|
+
[new w(new Qe(0.1, 0), c), [0, 0, 0]]
|
|
847
847
|
],
|
|
848
848
|
XY: [
|
|
849
|
-
[new
|
|
849
|
+
[new w(new z(0.15, 0.15, 0.01), u), [0.15, 0.15, 0]]
|
|
850
850
|
],
|
|
851
851
|
YZ: [
|
|
852
|
-
[new
|
|
852
|
+
[new w(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 w(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 w(new Y(0.2, 0, 0.6, 4), s), [0.3, 0, 0], [0, 0, -Math.PI / 2]],
|
|
860
|
+
[new w(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 w(new Y(0.2, 0, 0.6, 4), s), [0, 0.3, 0]],
|
|
864
|
+
[new w(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 w(new Y(0.2, 0, 0.6, 4), s), [0, 0, 0.3], [Math.PI / 2, 0, 0]],
|
|
868
|
+
[new w(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 w(new Qe(0.2, 0), s)]
|
|
872
872
|
],
|
|
873
873
|
XY: [
|
|
874
|
-
[new
|
|
874
|
+
[new w(new z(0.2, 0.2, 0.01), s), [0.15, 0.15, 0]]
|
|
875
875
|
],
|
|
876
876
|
YZ: [
|
|
877
|
-
[new
|
|
877
|
+
[new w(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 w(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 w(new Qe(0.01, 2), n), null, null, null, "helper"]
|
|
885
885
|
],
|
|
886
886
|
END: [
|
|
887
|
-
[new
|
|
887
|
+
[new w(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 w(x(0.5, 1), b), null, [0, Math.PI / 2, 0]]
|
|
904
904
|
],
|
|
905
905
|
X: [
|
|
906
|
-
[new
|
|
906
|
+
[new w(x(0.5, 0.5), i)]
|
|
907
907
|
],
|
|
908
908
|
Y: [
|
|
909
|
-
[new
|
|
909
|
+
[new w(x(0.5, 0.5), o), null, [0, 0, -Math.PI / 2]]
|
|
910
910
|
],
|
|
911
911
|
Z: [
|
|
912
|
-
[new
|
|
912
|
+
[new w(x(0.5, 0.5), a), null, [0, Math.PI / 2, 0]]
|
|
913
913
|
],
|
|
914
914
|
E: [
|
|
915
|
-
[new
|
|
915
|
+
[new w(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 w(new Cn(0.25, 10, 8), s)]
|
|
924
924
|
],
|
|
925
925
|
X: [
|
|
926
|
-
[new
|
|
926
|
+
[new w(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 w(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 w(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 w(new Pe(0.75, 0.1, 2, 24), s)]
|
|
936
936
|
]
|
|
937
|
-
},
|
|
937
|
+
}, $ = {
|
|
938
938
|
X: [
|
|
939
|
-
[new
|
|
940
|
-
[new
|
|
941
|
-
[new
|
|
939
|
+
[new w(y, i), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
|
|
940
|
+
[new w(_, i), [0, 0, 0], [0, 0, -Math.PI / 2]],
|
|
941
|
+
[new w(y, i), [-0.5, 0, 0], [0, 0, Math.PI / 2]]
|
|
942
942
|
],
|
|
943
943
|
Y: [
|
|
944
|
-
[new
|
|
945
|
-
[new
|
|
946
|
-
[new
|
|
944
|
+
[new w(y, o), [0, 0.5, 0]],
|
|
945
|
+
[new w(_, o)],
|
|
946
|
+
[new w(y, o), [0, -0.5, 0], [0, 0, Math.PI]]
|
|
947
947
|
],
|
|
948
948
|
Z: [
|
|
949
|
-
[new
|
|
950
|
-
[new
|
|
951
|
-
[new
|
|
949
|
+
[new w(y, a), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
|
|
950
|
+
[new w(_, a), [0, 0, 0], [Math.PI / 2, 0, 0]],
|
|
951
|
+
[new w(y, a), [0, 0, -0.5], [-Math.PI / 2, 0, 0]]
|
|
952
952
|
],
|
|
953
953
|
XY: [
|
|
954
|
-
[new
|
|
954
|
+
[new w(new z(0.15, 0.15, 0.01), u), [0.15, 0.15, 0]]
|
|
955
955
|
],
|
|
956
956
|
YZ: [
|
|
957
|
-
[new
|
|
957
|
+
[new w(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 w(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 w(new z(0.1, 0.1, 0.1), c)]
|
|
964
964
|
]
|
|
965
|
-
},
|
|
965
|
+
}, E = {
|
|
966
966
|
X: [
|
|
967
|
-
[new
|
|
968
|
-
[new
|
|
967
|
+
[new w(new Y(0.2, 0, 0.6, 4), s), [0.3, 0, 0], [0, 0, -Math.PI / 2]],
|
|
968
|
+
[new w(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 w(new Y(0.2, 0, 0.6, 4), s), [0, 0.3, 0]],
|
|
972
|
+
[new w(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 w(new Y(0.2, 0, 0.6, 4), s), [0, 0, 0.3], [Math.PI / 2, 0, 0]],
|
|
976
|
+
[new w(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 w(new z(0.2, 0.2, 0.01), s), [0.15, 0.15, 0]]
|
|
980
980
|
],
|
|
981
981
|
YZ: [
|
|
982
|
-
[new
|
|
982
|
+
[new w(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 w(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 w(new z(0.2, 0.2, 0.2), s), [0, 0, 0]]
|
|
989
989
|
]
|
|
990
|
-
},
|
|
990
|
+
}, H = {
|
|
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(H)), 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), F.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1), F.applyQuaternion(this.worldQuaternionStart.clone().invert()), o.scale.copy(F), o.visible = this.dragging) : (o.quaternion.copy(s), this.dragging ? o.position.copy(this.worldPositionStart) : o.position.copy(this.worldPosition), this.axis && (o.visible = this.axis.search(o.name) !== -1));
|
|
1026
1026
|
continue;
|
|
1027
1027
|
}
|
|
1028
|
-
o.quaternion.copy(s), this.mode === "translate" || this.mode === "scale" ? (o.name === "X" && Math.abs(
|
|
1028
|
+
o.quaternion.copy(s), this.mode === "translate" || this.mode === "scale" ? (o.name === "X" && Math.abs(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 w {
|
|
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(F.set(0, 0, 0), te, L), this.quaternion.setFromRotationMatrix(Xt)), super.updateMatrixWorld(e);
|
|
1077
1077
|
}
|
|
1078
1078
|
}
|
|
1079
|
-
const
|
|
1079
|
+
const T = {
|
|
1080
|
+
mode: "",
|
|
1080
1081
|
/** Three.js 场景 */
|
|
1081
1082
|
scene: null,
|
|
1082
1083
|
/** 透视相机 */
|
|
@@ -1094,138 +1095,153 @@ const w = {
|
|
|
1094
1095
|
/** 当前选中的物体 */
|
|
1095
1096
|
selectedObject: null
|
|
1096
1097
|
};
|
|
1097
|
-
let
|
|
1098
|
-
function Ns(r) {
|
|
1099
|
-
|
|
1098
|
+
let ut = !1, Ae = !1, be = null, wt = null, it = null, we = [];
|
|
1099
|
+
function Ns(r, e = "edit") {
|
|
1100
|
+
T.container = r, T.mode = e, ks(), js(), e === "edit" && Hs(), Fs(), zs(), Us(), Qs(), Gs(), mn(), e === "edit" && r.addEventListener("click", Ys), window.addEventListener("resize", Xs);
|
|
1100
1101
|
}
|
|
1101
1102
|
function ks() {
|
|
1102
|
-
const r = new
|
|
1103
|
-
r.setSize(
|
|
1103
|
+
const r = new k.WebGLRenderer({ antialias: !0, alpha: !0 });
|
|
1104
|
+
r.setSize(T.container.clientWidth, T.container.clientHeight), r.setPixelRatio(Math.min(window.devicePixelRatio, 2)), T.container.appendChild(r.domElement), T.renderer = r;
|
|
1104
1105
|
}
|
|
1105
1106
|
function js() {
|
|
1106
|
-
|
|
1107
|
+
T.scene = new k.Scene(), T.scene.name = "sl_scene";
|
|
1107
1108
|
}
|
|
1108
1109
|
function Hs() {
|
|
1109
|
-
const r = new
|
|
1110
|
-
r.name = "地板",
|
|
1110
|
+
const r = new k.GridHelper(30, 30, 8956671, 3364232);
|
|
1111
|
+
r.name = "地板", T.scene.add(r), T.gridHelper = r;
|
|
1111
1112
|
}
|
|
1112
1113
|
function Fs() {
|
|
1113
|
-
const r =
|
|
1114
|
-
t.position.set(0, 6, 15), t.lookAt(0, 0, 0),
|
|
1114
|
+
const r = T.container, e = r.clientWidth / r.clientHeight, t = new k.PerspectiveCamera(45, e, 0.1, 1e3);
|
|
1115
|
+
t.position.set(0, 6, 15), t.lookAt(0, 0, 0), T.camera = t;
|
|
1115
1116
|
}
|
|
1116
1117
|
function Us() {
|
|
1117
|
-
const r = new ps(
|
|
1118
|
+
const r = new ps(T.camera, T.renderer.domElement);
|
|
1118
1119
|
r.minDistance = 0, r.maxDistance = 1 / 0, r.addEventListener("start", () => {
|
|
1119
|
-
|
|
1120
|
+
ut = !1;
|
|
1120
1121
|
}), r.addEventListener("change", () => {
|
|
1121
|
-
|
|
1122
|
+
ut = !0;
|
|
1122
1123
|
}), r.addEventListener("end", () => {
|
|
1123
|
-
|
|
1124
|
-
|
|
1124
|
+
ut && (Ae = !0, setTimeout(() => {
|
|
1125
|
+
Ae = !1;
|
|
1125
1126
|
}, 200));
|
|
1126
|
-
}),
|
|
1127
|
+
}), T.orbitControls = r;
|
|
1127
1128
|
}
|
|
1128
1129
|
function zs() {
|
|
1129
|
-
const r = new
|
|
1130
|
-
|
|
1131
|
-
|
|
1130
|
+
const r = new Ss(
|
|
1131
|
+
T.camera,
|
|
1132
|
+
T.renderer.domElement
|
|
1132
1133
|
);
|
|
1133
1134
|
r.addEventListener("dragging-changed", (e) => {
|
|
1134
|
-
|
|
1135
|
-
|
|
1135
|
+
T.orbitControls.enabled = !e.value, e.value || (Ae = !0, setTimeout(() => {
|
|
1136
|
+
Ae = !1;
|
|
1136
1137
|
}, 200));
|
|
1137
1138
|
}), r.addEventListener("objectChange", () => {
|
|
1138
|
-
|
|
1139
|
-
}),
|
|
1139
|
+
wt && T.selectedObject && wt(T.selectedObject);
|
|
1140
|
+
}), T.scene.add(r.getHelper()), T.transformControls = r;
|
|
1140
1141
|
}
|
|
1141
1142
|
function Gs() {
|
|
1142
|
-
const r = new
|
|
1143
|
-
|
|
1144
|
-
const e = new
|
|
1145
|
-
e.position.set(48, 104, 138),
|
|
1146
|
-
const t = new
|
|
1147
|
-
n.position.y = 1, n.userData.isMovable = !0, n.name = "默认立方体",
|
|
1148
|
-
}
|
|
1149
|
-
function
|
|
1143
|
+
const r = new k.AmbientLight(16777215, 2);
|
|
1144
|
+
T.scene.add(r);
|
|
1145
|
+
const e = new k.DirectionalLight(16777215, 3);
|
|
1146
|
+
e.position.set(48, 104, 138), T.scene.add(e);
|
|
1147
|
+
const t = new k.BoxGeometry(1, 1, 1), s = new k.MeshStandardMaterial({ color: 16777215 }), n = new k.Mesh(t, s);
|
|
1148
|
+
n.position.y = 1, n.userData.isMovable = !0, n.name = "默认立方体", rt(n, !0);
|
|
1149
|
+
}
|
|
1150
|
+
function mn() {
|
|
1150
1151
|
var r, e;
|
|
1151
|
-
requestAnimationFrame(
|
|
1152
|
+
requestAnimationFrame(mn), us.update(), (r = T.orbitControls) == null || r.update(), (e = T.renderer) == null || e.render(T.scene, T.camera);
|
|
1152
1153
|
}
|
|
1153
1154
|
function Xs() {
|
|
1154
|
-
if (!
|
|
1155
|
-
const r =
|
|
1156
|
-
r === 0 || e === 0 || (
|
|
1155
|
+
if (!T.container || !T.camera || !T.renderer) return;
|
|
1156
|
+
const r = T.container.clientWidth, e = T.container.clientHeight;
|
|
1157
|
+
r === 0 || e === 0 || (T.camera.aspect = r / e, T.camera.updateProjectionMatrix(), T.renderer.setSize(r, e));
|
|
1157
1158
|
}
|
|
1158
|
-
function
|
|
1159
|
-
|
|
1159
|
+
function vt(r) {
|
|
1160
|
+
T.selectedObject !== r && (T.selectedObject && T.transformControls.detach(), T.selectedObject = r, T.transformControls.attach(r), T.transformControls.setMode("translate"), T.transformControls.showX = !0, T.transformControls.showY = !0, T.transformControls.showZ = !0, be == null || be(r));
|
|
1160
1161
|
}
|
|
1161
|
-
function
|
|
1162
|
-
|
|
1162
|
+
function gn() {
|
|
1163
|
+
T.selectedObject && (T.transformControls.detach(), T.selectedObject = null, be == null || be(null));
|
|
1163
1164
|
}
|
|
1164
1165
|
function Ys(r) {
|
|
1165
|
-
if (
|
|
1166
|
-
|
|
1166
|
+
if (Ae) {
|
|
1167
|
+
Ae = !1;
|
|
1167
1168
|
return;
|
|
1168
1169
|
}
|
|
1169
|
-
const e =
|
|
1170
|
+
const e = T.renderer.domElement.getBoundingClientRect(), t = new k.Vector2(
|
|
1170
1171
|
(r.clientX - e.left) / e.width * 2 - 1,
|
|
1171
1172
|
-((r.clientY - e.top) / e.height) * 2 + 1
|
|
1172
|
-
), s = new
|
|
1173
|
-
s.setFromCamera(t,
|
|
1173
|
+
), s = new k.Raycaster();
|
|
1174
|
+
s.setFromCamera(t, T.camera);
|
|
1174
1175
|
const n = [];
|
|
1175
|
-
|
|
1176
|
+
T.scene.traverse((o) => {
|
|
1176
1177
|
o.type === "Mesh" && o.userData.isMovable && n.push(o);
|
|
1177
1178
|
});
|
|
1178
1179
|
const i = s.intersectObjects(n);
|
|
1179
|
-
i.length > 0 ?
|
|
1180
|
+
i.length > 0 ? vt(i[0].object) : gn();
|
|
1180
1181
|
}
|
|
1181
|
-
function
|
|
1182
|
-
|
|
1182
|
+
function rt(r, e = !1) {
|
|
1183
|
+
T.scene.add(r), r.userData.isMovable && (Vs(r), St()), e && T.mode === "edit" && vt(r);
|
|
1183
1184
|
}
|
|
1184
1185
|
function Bs(r) {
|
|
1185
|
-
|
|
1186
|
+
T.selectedObject === r && gn(), r.parent ? r.parent.remove(r) : T.scene.remove(r), Zs(r), St();
|
|
1186
1187
|
}
|
|
1187
1188
|
function Ks(r) {
|
|
1188
|
-
const e =
|
|
1189
|
+
const e = T.scene.getObjectByProperty("uuid", r);
|
|
1189
1190
|
e && Bs(e);
|
|
1190
1191
|
}
|
|
1191
1192
|
function Vs(r) {
|
|
1192
|
-
r.userData.isMovable && r.parent ===
|
|
1193
|
+
r.userData.isMovable && r.parent === T.scene && (we.includes(r) || we.push(r));
|
|
1193
1194
|
}
|
|
1194
1195
|
function Zs(r) {
|
|
1195
|
-
const e =
|
|
1196
|
-
e !== -1 &&
|
|
1196
|
+
const e = we.indexOf(r);
|
|
1197
|
+
e !== -1 && we.splice(e, 1);
|
|
1197
1198
|
}
|
|
1198
1199
|
function Qs() {
|
|
1199
1200
|
const r = [];
|
|
1200
|
-
|
|
1201
|
+
T.scene.children.forEach((e) => {
|
|
1201
1202
|
e.userData.isMovable && r.push(e);
|
|
1202
|
-
}),
|
|
1203
|
+
}), we = r, St();
|
|
1203
1204
|
}
|
|
1204
|
-
function
|
|
1205
|
-
|
|
1205
|
+
function St() {
|
|
1206
|
+
it == null || it([...we]);
|
|
1206
1207
|
}
|
|
1207
1208
|
function qs(r) {
|
|
1208
|
-
|
|
1209
|
+
be = r;
|
|
1209
1210
|
}
|
|
1210
1211
|
function Ws(r) {
|
|
1211
|
-
|
|
1212
|
+
wt = r;
|
|
1212
1213
|
}
|
|
1213
1214
|
function $s(r) {
|
|
1214
|
-
|
|
1215
|
+
it = r;
|
|
1215
1216
|
}
|
|
1216
1217
|
function Js() {
|
|
1217
|
-
return
|
|
1218
|
+
return we;
|
|
1218
1219
|
}
|
|
1219
|
-
function
|
|
1220
|
-
return
|
|
1220
|
+
function zo() {
|
|
1221
|
+
return T.scene;
|
|
1221
1222
|
}
|
|
1222
|
-
function
|
|
1223
|
-
return
|
|
1223
|
+
function Go() {
|
|
1224
|
+
return T.camera;
|
|
1224
1225
|
}
|
|
1225
|
-
function
|
|
1226
|
-
return
|
|
1226
|
+
function Xo() {
|
|
1227
|
+
return T.renderer;
|
|
1227
1228
|
}
|
|
1228
|
-
|
|
1229
|
+
function Yo(r) {
|
|
1230
|
+
const e = T.scene;
|
|
1231
|
+
if (!e) return "{}";
|
|
1232
|
+
const { includeHelpers: t = !1 } = r || {};
|
|
1233
|
+
let s = e;
|
|
1234
|
+
t || (s = e.clone(), s.children = s.children.filter(
|
|
1235
|
+
(i) => i.userData.isMovable === !0
|
|
1236
|
+
));
|
|
1237
|
+
const n = s.toJSON();
|
|
1238
|
+
return JSON.stringify(n, null);
|
|
1239
|
+
}
|
|
1240
|
+
function Bo(r) {
|
|
1241
|
+
const e = typeof r == "string" ? JSON.parse(r) : r;
|
|
1242
|
+
return new k.ObjectLoader().parse(e);
|
|
1243
|
+
}
|
|
1244
|
+
const ei = /^[og]\s*(.+)?/, ti = /^mtllib /, ni = /^usemtl /, si = /^usemap /, Yt = /\s+/, Bt = new M(), dt = new M(), Kt = new M(), Vt = new M(), q = new M(), et = new pe();
|
|
1229
1245
|
function ii() {
|
|
1230
1246
|
const r = {
|
|
1231
1247
|
objects: [],
|
|
@@ -1335,7 +1351,7 @@ function ii() {
|
|
|
1335
1351
|
},
|
|
1336
1352
|
addFaceNormal: function(e, t, s) {
|
|
1337
1353
|
const n = this.vertices, i = this.object.geometry.normals;
|
|
1338
|
-
|
|
1354
|
+
Bt.fromArray(n, e), dt.fromArray(n, t), Kt.fromArray(n, s), q.subVectors(Kt, dt), Vt.subVectors(Bt, dt), 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
1355
|
},
|
|
1340
1356
|
addColor: function(e, t, s) {
|
|
1341
1357
|
const n = this.colors, i = this.object.geometry.colors;
|
|
@@ -1355,15 +1371,15 @@ function ii() {
|
|
|
1355
1371
|
},
|
|
1356
1372
|
addFace: function(e, t, s, n, i, o, a, l, h) {
|
|
1357
1373
|
const u = this.vertices.length;
|
|
1358
|
-
let c = this.parseVertexIndex(e, u),
|
|
1359
|
-
if (this.addVertex(c,
|
|
1360
|
-
const
|
|
1361
|
-
c = this.parseNormalIndex(a,
|
|
1374
|
+
let c = this.parseVertexIndex(e, u), p = this.parseVertexIndex(t, u), m = this.parseVertexIndex(s, u);
|
|
1375
|
+
if (this.addVertex(c, p, m), this.addColor(c, p, m), a !== void 0 && a !== "") {
|
|
1376
|
+
const b = this.normals.length;
|
|
1377
|
+
c = this.parseNormalIndex(a, b), p = this.parseNormalIndex(l, b), m = this.parseNormalIndex(h, b), this.addNormal(c, p, m);
|
|
1362
1378
|
} else
|
|
1363
|
-
this.addFaceNormal(c,
|
|
1379
|
+
this.addFaceNormal(c, p, m);
|
|
1364
1380
|
if (n !== void 0 && n !== "") {
|
|
1365
|
-
const
|
|
1366
|
-
c = this.parseUVIndex(n,
|
|
1381
|
+
const b = this.uvs.length;
|
|
1382
|
+
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
1383
|
} else
|
|
1368
1384
|
this.addDefaultUV();
|
|
1369
1385
|
},
|
|
@@ -1386,7 +1402,7 @@ function ii() {
|
|
|
1386
1402
|
};
|
|
1387
1403
|
return r.startObject("", !1), r;
|
|
1388
1404
|
}
|
|
1389
|
-
class oi extends
|
|
1405
|
+
class oi extends ln {
|
|
1390
1406
|
/**
|
|
1391
1407
|
* Constructs a new OBJ loader.
|
|
1392
1408
|
*
|
|
@@ -1405,7 +1421,7 @@ class oi extends rn {
|
|
|
1405
1421
|
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
1406
1422
|
*/
|
|
1407
1423
|
load(e, t, s, n) {
|
|
1408
|
-
const i = this, o = new
|
|
1424
|
+
const i = this, o = new Et(this.manager);
|
|
1409
1425
|
o.setPath(this.path), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(e, function(a) {
|
|
1410
1426
|
try {
|
|
1411
1427
|
t(i.parse(a));
|
|
@@ -1444,19 +1460,19 @@ class oi extends rn {
|
|
|
1444
1460
|
const u = h.charAt(0);
|
|
1445
1461
|
if (u !== "#")
|
|
1446
1462
|
if (u === "v") {
|
|
1447
|
-
const c = h.split(
|
|
1463
|
+
const c = h.split(Yt);
|
|
1448
1464
|
switch (c[0]) {
|
|
1449
1465
|
case "v":
|
|
1450
1466
|
t.vertices.push(
|
|
1451
1467
|
parseFloat(c[1]),
|
|
1452
1468
|
parseFloat(c[2]),
|
|
1453
1469
|
parseFloat(c[3])
|
|
1454
|
-
), c.length >= 7 ? (
|
|
1470
|
+
), c.length >= 7 ? (et.setRGB(
|
|
1455
1471
|
parseFloat(c[4]),
|
|
1456
1472
|
parseFloat(c[5]),
|
|
1457
1473
|
parseFloat(c[6]),
|
|
1458
|
-
|
|
1459
|
-
), t.colors.push(
|
|
1474
|
+
Re
|
|
1475
|
+
), t.colors.push(et.r, et.g, et.b)) : t.colors.push(void 0, void 0, void 0);
|
|
1460
1476
|
break;
|
|
1461
1477
|
case "vn":
|
|
1462
1478
|
t.normals.push(
|
|
@@ -1473,44 +1489,44 @@ class oi extends rn {
|
|
|
1473
1489
|
break;
|
|
1474
1490
|
}
|
|
1475
1491
|
} else if (u === "f") {
|
|
1476
|
-
const
|
|
1477
|
-
for (let
|
|
1478
|
-
const
|
|
1479
|
-
if (
|
|
1480
|
-
const
|
|
1481
|
-
|
|
1492
|
+
const p = h.slice(1).trim().split(Yt), m = [];
|
|
1493
|
+
for (let f = 0, y = p.length; f < y; f++) {
|
|
1494
|
+
const d = p[f];
|
|
1495
|
+
if (d.length > 0) {
|
|
1496
|
+
const _ = d.split("/");
|
|
1497
|
+
m.push(_);
|
|
1482
1498
|
}
|
|
1483
1499
|
}
|
|
1484
|
-
const
|
|
1485
|
-
for (let
|
|
1486
|
-
const
|
|
1500
|
+
const b = m[0];
|
|
1501
|
+
for (let f = 1, y = m.length - 1; f < y; f++) {
|
|
1502
|
+
const d = m[f], _ = m[f + 1];
|
|
1487
1503
|
t.addFace(
|
|
1488
|
-
|
|
1504
|
+
b[0],
|
|
1505
|
+
d[0],
|
|
1489
1506
|
_[0],
|
|
1490
|
-
|
|
1491
|
-
|
|
1507
|
+
b[1],
|
|
1508
|
+
d[1],
|
|
1492
1509
|
_[1],
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
_[2]
|
|
1496
|
-
x[2]
|
|
1510
|
+
b[2],
|
|
1511
|
+
d[2],
|
|
1512
|
+
_[2]
|
|
1497
1513
|
);
|
|
1498
1514
|
}
|
|
1499
1515
|
} else if (u === "l") {
|
|
1500
1516
|
const c = h.substring(1).trim().split(" ");
|
|
1501
|
-
let
|
|
1502
|
-
const
|
|
1517
|
+
let p = [];
|
|
1518
|
+
const m = [];
|
|
1503
1519
|
if (h.indexOf("/") === -1)
|
|
1504
|
-
|
|
1520
|
+
p = c;
|
|
1505
1521
|
else
|
|
1506
|
-
for (let
|
|
1507
|
-
const y = c[
|
|
1508
|
-
y[0] !== "" &&
|
|
1522
|
+
for (let b = 0, f = c.length; b < f; b++) {
|
|
1523
|
+
const y = c[b].split("/");
|
|
1524
|
+
y[0] !== "" && p.push(y[0]), y[1] !== "" && m.push(y[1]);
|
|
1509
1525
|
}
|
|
1510
|
-
t.addLineGeometry(
|
|
1526
|
+
t.addLineGeometry(p, m);
|
|
1511
1527
|
} else if (u === "p") {
|
|
1512
|
-
const
|
|
1513
|
-
t.addPointGeometry(
|
|
1528
|
+
const p = h.slice(1).trim().split(" ");
|
|
1529
|
+
t.addPointGeometry(p);
|
|
1514
1530
|
} else if ((n = ei.exec(h)) !== null) {
|
|
1515
1531
|
const c = (" " + n[0].slice(1).trim()).slice(1);
|
|
1516
1532
|
t.startObject(c);
|
|
@@ -1522,8 +1538,8 @@ class oi extends rn {
|
|
|
1522
1538
|
console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');
|
|
1523
1539
|
else if (u === "s") {
|
|
1524
1540
|
if (n = h.split(" "), n.length > 1) {
|
|
1525
|
-
const
|
|
1526
|
-
t.object.smooth =
|
|
1541
|
+
const p = n[1].trim().toLowerCase();
|
|
1542
|
+
t.object.smooth = p !== "0" && p !== "off";
|
|
1527
1543
|
} else
|
|
1528
1544
|
t.object.smooth = !0;
|
|
1529
1545
|
const c = t.object.currentMaterial();
|
|
@@ -1534,53 +1550,53 @@ class oi extends rn {
|
|
|
1534
1550
|
}
|
|
1535
1551
|
}
|
|
1536
1552
|
t.finalize();
|
|
1537
|
-
const i = new
|
|
1553
|
+
const i = new tt();
|
|
1538
1554
|
if (i.materialLibraries = [].concat(t.materialLibraries), !(t.objects.length === 1 && t.objects[0].geometry.vertices.length === 0) === !0)
|
|
1539
1555
|
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
|
|
1556
|
+
const h = t.objects[a], u = h.geometry, c = h.materials, p = u.type === "Line", m = u.type === "Points";
|
|
1557
|
+
let b = !1;
|
|
1542
1558
|
if (u.vertices.length === 0) continue;
|
|
1543
|
-
const
|
|
1544
|
-
|
|
1559
|
+
const f = new ze();
|
|
1560
|
+
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
1561
|
const y = [];
|
|
1546
|
-
for (let
|
|
1547
|
-
const S = c[
|
|
1548
|
-
let v = t.materials[
|
|
1562
|
+
for (let _ = 0, x = c.length; _ < x; _++) {
|
|
1563
|
+
const S = c[_], A = S.name + "_" + S.smooth + "_" + b;
|
|
1564
|
+
let v = t.materials[A];
|
|
1549
1565
|
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
|
-
|
|
1566
|
+
if (v = this.materials.create(S.name), p && v && !(v instanceof ke)) {
|
|
1567
|
+
const I = new ke();
|
|
1568
|
+
je.prototype.copy.call(I, v), I.color.copy(v.color), v = I;
|
|
1569
|
+
} else if (m && v && !(v instanceof Ce)) {
|
|
1570
|
+
const I = new Ce({ size: 10, sizeAttenuation: !1 });
|
|
1571
|
+
je.prototype.copy.call(I, v), I.color.copy(v.color), I.map = v.map, v = I;
|
|
1556
1572
|
}
|
|
1557
1573
|
}
|
|
1558
|
-
v === void 0 && (
|
|
1574
|
+
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
1575
|
}
|
|
1560
|
-
let
|
|
1576
|
+
let d;
|
|
1561
1577
|
if (y.length > 1) {
|
|
1562
|
-
for (let
|
|
1563
|
-
const S = c[
|
|
1564
|
-
|
|
1578
|
+
for (let _ = 0, x = c.length; _ < x; _++) {
|
|
1579
|
+
const S = c[_];
|
|
1580
|
+
f.addGroup(S.groupStart, S.groupCount, _);
|
|
1565
1581
|
}
|
|
1566
|
-
|
|
1582
|
+
p ? d = new gt(f, y) : m ? d = new nt(f, y) : d = new w(f, y);
|
|
1567
1583
|
} else
|
|
1568
|
-
|
|
1569
|
-
|
|
1584
|
+
p ? d = new gt(f, y[0]) : m ? d = new nt(f, y[0]) : d = new w(f, y[0]);
|
|
1585
|
+
d.name = h.name, i.add(d);
|
|
1570
1586
|
}
|
|
1571
1587
|
else if (t.vertices.length > 0) {
|
|
1572
|
-
const a = new
|
|
1573
|
-
l.setAttribute("position", new
|
|
1574
|
-
const h = new
|
|
1588
|
+
const a = new Ce({ size: 1, sizeAttenuation: !1 }), l = new ze();
|
|
1589
|
+
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);
|
|
1590
|
+
const h = new nt(l, a);
|
|
1575
1591
|
i.add(h);
|
|
1576
1592
|
}
|
|
1577
1593
|
return i;
|
|
1578
1594
|
}
|
|
1579
1595
|
}
|
|
1580
|
-
function
|
|
1596
|
+
function Zt(r, e) {
|
|
1581
1597
|
if (e === jn)
|
|
1582
1598
|
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), r;
|
|
1583
|
-
if (e ===
|
|
1599
|
+
if (e === yt || e === cn) {
|
|
1584
1600
|
let t = r.getIndex();
|
|
1585
1601
|
if (t === null) {
|
|
1586
1602
|
const o = [], a = r.getAttribute("position");
|
|
@@ -1592,7 +1608,7 @@ function Kt(r, e) {
|
|
|
1592
1608
|
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), r;
|
|
1593
1609
|
}
|
|
1594
1610
|
const s = t.count - 2, n = [];
|
|
1595
|
-
if (e ===
|
|
1611
|
+
if (e === yt)
|
|
1596
1612
|
for (let o = 1; o <= s; o++)
|
|
1597
1613
|
n.push(t.getX(0)), n.push(t.getX(o)), n.push(t.getX(o + 1));
|
|
1598
1614
|
else
|
|
@@ -1606,7 +1622,7 @@ function Kt(r, e) {
|
|
|
1606
1622
|
}
|
|
1607
1623
|
function ri(r) {
|
|
1608
1624
|
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), s = r.clone();
|
|
1609
|
-
return
|
|
1625
|
+
return yn(r, s, function(n, i) {
|
|
1610
1626
|
e.set(i, n), t.set(n, i);
|
|
1611
1627
|
}), s.traverse(function(n) {
|
|
1612
1628
|
if (!n.isSkinnedMesh) return;
|
|
@@ -1616,12 +1632,12 @@ function ri(r) {
|
|
|
1616
1632
|
}), i.bind(i.skeleton, i.bindMatrix);
|
|
1617
1633
|
}), s;
|
|
1618
1634
|
}
|
|
1619
|
-
function
|
|
1635
|
+
function yn(r, e, t) {
|
|
1620
1636
|
t(r, e);
|
|
1621
1637
|
for (let s = 0; s < r.children.length; s++)
|
|
1622
|
-
|
|
1638
|
+
yn(r.children[s], e.children[s], t);
|
|
1623
1639
|
}
|
|
1624
|
-
class ai extends
|
|
1640
|
+
class ai extends ln {
|
|
1625
1641
|
/**
|
|
1626
1642
|
* Constructs a new glTF loader.
|
|
1627
1643
|
*
|
|
@@ -1659,11 +1675,11 @@ class ai extends rn {
|
|
|
1659
1675
|
}), this.register(function(t) {
|
|
1660
1676
|
return new ci(t);
|
|
1661
1677
|
}), this.register(function(t) {
|
|
1662
|
-
return new
|
|
1678
|
+
return new Qt(t, R.EXT_MESHOPT_COMPRESSION);
|
|
1663
1679
|
}), this.register(function(t) {
|
|
1664
|
-
return new
|
|
1680
|
+
return new Qt(t, R.KHR_MESHOPT_COMPRESSION);
|
|
1665
1681
|
}), this.register(function(t) {
|
|
1666
|
-
return new
|
|
1682
|
+
return new vi(t);
|
|
1667
1683
|
});
|
|
1668
1684
|
}
|
|
1669
1685
|
/**
|
|
@@ -1681,14 +1697,14 @@ class ai extends rn {
|
|
|
1681
1697
|
if (this.resourcePath !== "")
|
|
1682
1698
|
o = this.resourcePath;
|
|
1683
1699
|
else if (this.path !== "") {
|
|
1684
|
-
const h =
|
|
1685
|
-
o =
|
|
1700
|
+
const h = He.extractUrlBase(e);
|
|
1701
|
+
o = He.resolveURL(h, this.path);
|
|
1686
1702
|
} else
|
|
1687
|
-
o =
|
|
1703
|
+
o = He.extractUrlBase(e);
|
|
1688
1704
|
this.manager.itemStart(e);
|
|
1689
1705
|
const a = function(h) {
|
|
1690
1706
|
n ? n(h) : console.error(h), i.manager.itemError(e), i.manager.itemEnd(e);
|
|
1691
|
-
}, l = new
|
|
1707
|
+
}, l = new Et(this.manager);
|
|
1692
1708
|
l.setPath(this.path), l.setResponseType("arraybuffer"), l.setRequestHeader(this.requestHeader), l.setWithCredentials(this.withCredentials), l.load(e, function(h) {
|
|
1693
1709
|
try {
|
|
1694
1710
|
i.parse(h, o, function(u) {
|
|
@@ -1763,9 +1779,9 @@ class ai extends rn {
|
|
|
1763
1779
|
if (typeof e == "string")
|
|
1764
1780
|
i = JSON.parse(e);
|
|
1765
1781
|
else if (e instanceof ArrayBuffer)
|
|
1766
|
-
if (l.decode(new Uint8Array(e, 0, 4)) ===
|
|
1782
|
+
if (l.decode(new Uint8Array(e, 0, 4)) === _n) {
|
|
1767
1783
|
try {
|
|
1768
|
-
o[R.KHR_BINARY_GLTF] = new
|
|
1784
|
+
o[R.KHR_BINARY_GLTF] = new Si(e);
|
|
1769
1785
|
} catch (c) {
|
|
1770
1786
|
n && n(c);
|
|
1771
1787
|
return;
|
|
@@ -1794,7 +1810,7 @@ class ai extends rn {
|
|
|
1794
1810
|
}
|
|
1795
1811
|
if (i.extensionsUsed)
|
|
1796
1812
|
for (let u = 0; u < i.extensionsUsed.length; ++u) {
|
|
1797
|
-
const c = i.extensionsUsed[u],
|
|
1813
|
+
const c = i.extensionsUsed[u], p = i.extensionsRequired || [];
|
|
1798
1814
|
switch (c) {
|
|
1799
1815
|
case R.KHR_MATERIALS_UNLIT:
|
|
1800
1816
|
o[c] = new hi();
|
|
@@ -1809,7 +1825,7 @@ class ai extends rn {
|
|
|
1809
1825
|
o[c] = new Pi();
|
|
1810
1826
|
break;
|
|
1811
1827
|
default:
|
|
1812
|
-
|
|
1828
|
+
p.indexOf(c) >= 0 && a[c] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + c + '".');
|
|
1813
1829
|
}
|
|
1814
1830
|
}
|
|
1815
1831
|
h.setExtensions(o), h.setPlugins(a), h.parse(s, n);
|
|
@@ -1892,7 +1908,7 @@ class ci {
|
|
|
1892
1908
|
if (n) return n;
|
|
1893
1909
|
const i = t.json, l = ((i.extensions && i.extensions[this.name] || {}).lights || [])[e];
|
|
1894
1910
|
let h;
|
|
1895
|
-
const u = new
|
|
1911
|
+
const u = new pe(16777215);
|
|
1896
1912
|
l.color !== void 0 && u.setRGB(l.color[0], l.color[1], l.color[2], ae);
|
|
1897
1913
|
const c = l.range !== void 0 ? l.range : 0;
|
|
1898
1914
|
switch (l.type) {
|
|
@@ -1908,7 +1924,7 @@ class ci {
|
|
|
1908
1924
|
default:
|
|
1909
1925
|
throw new Error("THREE.GLTFLoader: Unexpected light type: " + l.type);
|
|
1910
1926
|
}
|
|
1911
|
-
return h.position.set(0, 0, 0),
|
|
1927
|
+
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
1928
|
}
|
|
1913
1929
|
getDependency(e, t) {
|
|
1914
1930
|
if (e === "light")
|
|
@@ -1926,18 +1942,18 @@ class hi {
|
|
|
1926
1942
|
this.name = R.KHR_MATERIALS_UNLIT;
|
|
1927
1943
|
}
|
|
1928
1944
|
getMaterialType() {
|
|
1929
|
-
return
|
|
1945
|
+
return _e;
|
|
1930
1946
|
}
|
|
1931
1947
|
extendParams(e, t, s) {
|
|
1932
1948
|
const n = [];
|
|
1933
|
-
e.color = new
|
|
1949
|
+
e.color = new pe(1, 1, 1), e.opacity = 1;
|
|
1934
1950
|
const i = t.pbrMetallicRoughness;
|
|
1935
1951
|
if (i) {
|
|
1936
1952
|
if (Array.isArray(i.baseColorFactor)) {
|
|
1937
1953
|
const o = i.baseColorFactor;
|
|
1938
1954
|
e.color.setRGB(o[0], o[1], o[2], ae), e.opacity = o[3];
|
|
1939
1955
|
}
|
|
1940
|
-
i.baseColorTexture !== void 0 && n.push(s.assignTexture(e, "map", i.baseColorTexture,
|
|
1956
|
+
i.baseColorTexture !== void 0 && n.push(s.assignTexture(e, "map", i.baseColorTexture, Re));
|
|
1941
1957
|
}
|
|
1942
1958
|
return Promise.all(n);
|
|
1943
1959
|
}
|
|
@@ -1956,7 +1972,7 @@ class di {
|
|
|
1956
1972
|
this.parser = e, this.name = R.KHR_MATERIALS_CLEARCOAT;
|
|
1957
1973
|
}
|
|
1958
1974
|
getMaterialType(e) {
|
|
1959
|
-
return C(this.parser, e, this.name) !== null ?
|
|
1975
|
+
return C(this.parser, e, this.name) !== null ? se : null;
|
|
1960
1976
|
}
|
|
1961
1977
|
extendMaterialParams(e, t) {
|
|
1962
1978
|
const s = C(this.parser, e, this.name);
|
|
@@ -1964,7 +1980,7 @@ class di {
|
|
|
1964
1980
|
const n = [];
|
|
1965
1981
|
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
1982
|
const i = s.clearcoatNormalTexture.scale;
|
|
1967
|
-
t.clearcoatNormalScale = new
|
|
1983
|
+
t.clearcoatNormalScale = new V(i, i);
|
|
1968
1984
|
}
|
|
1969
1985
|
return Promise.all(n);
|
|
1970
1986
|
}
|
|
@@ -1974,7 +1990,7 @@ class pi {
|
|
|
1974
1990
|
this.parser = e, this.name = R.KHR_MATERIALS_DISPERSION;
|
|
1975
1991
|
}
|
|
1976
1992
|
getMaterialType(e) {
|
|
1977
|
-
return C(this.parser, e, this.name) !== null ?
|
|
1993
|
+
return C(this.parser, e, this.name) !== null ? se : null;
|
|
1978
1994
|
}
|
|
1979
1995
|
extendMaterialParams(e, t) {
|
|
1980
1996
|
const s = C(this.parser, e, this.name);
|
|
@@ -1986,7 +2002,7 @@ class fi {
|
|
|
1986
2002
|
this.parser = e, this.name = R.KHR_MATERIALS_IRIDESCENCE;
|
|
1987
2003
|
}
|
|
1988
2004
|
getMaterialType(e) {
|
|
1989
|
-
return C(this.parser, e, this.name) !== null ?
|
|
2005
|
+
return C(this.parser, e, this.name) !== null ? se : null;
|
|
1990
2006
|
}
|
|
1991
2007
|
extendMaterialParams(e, t) {
|
|
1992
2008
|
const s = C(this.parser, e, this.name);
|
|
@@ -2000,17 +2016,17 @@ class mi {
|
|
|
2000
2016
|
this.parser = e, this.name = R.KHR_MATERIALS_SHEEN;
|
|
2001
2017
|
}
|
|
2002
2018
|
getMaterialType(e) {
|
|
2003
|
-
return C(this.parser, e, this.name) !== null ?
|
|
2019
|
+
return C(this.parser, e, this.name) !== null ? se : null;
|
|
2004
2020
|
}
|
|
2005
2021
|
extendMaterialParams(e, t) {
|
|
2006
2022
|
const s = C(this.parser, e, this.name);
|
|
2007
2023
|
if (s === null) return Promise.resolve();
|
|
2008
2024
|
const n = [];
|
|
2009
|
-
if (t.sheenColor = new
|
|
2025
|
+
if (t.sheenColor = new pe(0, 0, 0), t.sheenRoughness = 0, t.sheen = 1, s.sheenColorFactor !== void 0) {
|
|
2010
2026
|
const i = s.sheenColorFactor;
|
|
2011
2027
|
t.sheenColor.setRGB(i[0], i[1], i[2], ae);
|
|
2012
2028
|
}
|
|
2013
|
-
return s.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = s.sheenRoughnessFactor), s.sheenColorTexture !== void 0 && n.push(this.parser.assignTexture(t, "sheenColorMap", s.sheenColorTexture,
|
|
2029
|
+
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
2030
|
}
|
|
2015
2031
|
}
|
|
2016
2032
|
class gi {
|
|
@@ -2018,7 +2034,7 @@ class gi {
|
|
|
2018
2034
|
this.parser = e, this.name = R.KHR_MATERIALS_TRANSMISSION;
|
|
2019
2035
|
}
|
|
2020
2036
|
getMaterialType(e) {
|
|
2021
|
-
return C(this.parser, e, this.name) !== null ?
|
|
2037
|
+
return C(this.parser, e, this.name) !== null ? se : null;
|
|
2022
2038
|
}
|
|
2023
2039
|
extendMaterialParams(e, t) {
|
|
2024
2040
|
const s = C(this.parser, e, this.name);
|
|
@@ -2032,7 +2048,7 @@ class yi {
|
|
|
2032
2048
|
this.parser = e, this.name = R.KHR_MATERIALS_VOLUME;
|
|
2033
2049
|
}
|
|
2034
2050
|
getMaterialType(e) {
|
|
2035
|
-
return C(this.parser, e, this.name) !== null ?
|
|
2051
|
+
return C(this.parser, e, this.name) !== null ? se : null;
|
|
2036
2052
|
}
|
|
2037
2053
|
extendMaterialParams(e, t) {
|
|
2038
2054
|
const s = C(this.parser, e, this.name);
|
|
@@ -2040,7 +2056,7 @@ class yi {
|
|
|
2040
2056
|
const n = [];
|
|
2041
2057
|
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
2058
|
const i = s.attenuationColor || [1, 1, 1];
|
|
2043
|
-
return t.attenuationColor = new
|
|
2059
|
+
return t.attenuationColor = new pe().setRGB(i[0], i[1], i[2], ae), Promise.all(n);
|
|
2044
2060
|
}
|
|
2045
2061
|
}
|
|
2046
2062
|
class _i {
|
|
@@ -2048,7 +2064,7 @@ class _i {
|
|
|
2048
2064
|
this.parser = e, this.name = R.KHR_MATERIALS_IOR;
|
|
2049
2065
|
}
|
|
2050
2066
|
getMaterialType(e) {
|
|
2051
|
-
return C(this.parser, e, this.name) !== null ?
|
|
2067
|
+
return C(this.parser, e, this.name) !== null ? se : null;
|
|
2052
2068
|
}
|
|
2053
2069
|
extendMaterialParams(e, t) {
|
|
2054
2070
|
const s = C(this.parser, e, this.name);
|
|
@@ -2060,7 +2076,7 @@ class bi {
|
|
|
2060
2076
|
this.parser = e, this.name = R.KHR_MATERIALS_SPECULAR;
|
|
2061
2077
|
}
|
|
2062
2078
|
getMaterialType(e) {
|
|
2063
|
-
return C(this.parser, e, this.name) !== null ?
|
|
2079
|
+
return C(this.parser, e, this.name) !== null ? se : null;
|
|
2064
2080
|
}
|
|
2065
2081
|
extendMaterialParams(e, t) {
|
|
2066
2082
|
const s = C(this.parser, e, this.name);
|
|
@@ -2068,7 +2084,7 @@ class bi {
|
|
|
2068
2084
|
const n = [];
|
|
2069
2085
|
t.specularIntensity = s.specularFactor !== void 0 ? s.specularFactor : 1, s.specularTexture !== void 0 && n.push(this.parser.assignTexture(t, "specularIntensityMap", s.specularTexture));
|
|
2070
2086
|
const i = s.specularColorFactor || [1, 1, 1];
|
|
2071
|
-
return t.specularColor = new
|
|
2087
|
+
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
2088
|
}
|
|
2073
2089
|
}
|
|
2074
2090
|
class wi {
|
|
@@ -2076,7 +2092,7 @@ class wi {
|
|
|
2076
2092
|
this.parser = e, this.name = R.EXT_MATERIALS_BUMP;
|
|
2077
2093
|
}
|
|
2078
2094
|
getMaterialType(e) {
|
|
2079
|
-
return C(this.parser, e, this.name) !== null ?
|
|
2095
|
+
return C(this.parser, e, this.name) !== null ? se : null;
|
|
2080
2096
|
}
|
|
2081
2097
|
extendMaterialParams(e, t) {
|
|
2082
2098
|
const s = C(this.parser, e, this.name);
|
|
@@ -2090,7 +2106,7 @@ class Ti {
|
|
|
2090
2106
|
this.parser = e, this.name = R.KHR_MATERIALS_ANISOTROPY;
|
|
2091
2107
|
}
|
|
2092
2108
|
getMaterialType(e) {
|
|
2093
|
-
return C(this.parser, e, this.name) !== null ?
|
|
2109
|
+
return C(this.parser, e, this.name) !== null ? se : null;
|
|
2094
2110
|
}
|
|
2095
2111
|
extendMaterialParams(e, t) {
|
|
2096
2112
|
const s = C(this.parser, e, this.name);
|
|
@@ -2150,7 +2166,7 @@ class Mi {
|
|
|
2150
2166
|
return s.loadTextureImage(e, o.source, l);
|
|
2151
2167
|
}
|
|
2152
2168
|
}
|
|
2153
|
-
class
|
|
2169
|
+
class Qt {
|
|
2154
2170
|
constructor(e, t) {
|
|
2155
2171
|
this.name = t, this.parser = e;
|
|
2156
2172
|
}
|
|
@@ -2164,19 +2180,19 @@ class Vt {
|
|
|
2164
2180
|
return null;
|
|
2165
2181
|
}
|
|
2166
2182
|
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
|
|
2183
|
+
const l = n.byteOffset || 0, h = n.byteLength || 0, u = n.count, c = n.byteStride, p = new Uint8Array(a, l, h);
|
|
2184
|
+
return o.decodeGltfBufferAsync ? o.decodeGltfBufferAsync(u, c, p, n.mode, n.filter).then(function(m) {
|
|
2185
|
+
return m.buffer;
|
|
2170
2186
|
}) : o.ready.then(function() {
|
|
2171
|
-
const
|
|
2172
|
-
return o.decodeGltfBuffer(new Uint8Array(
|
|
2187
|
+
const m = new ArrayBuffer(u * c);
|
|
2188
|
+
return o.decodeGltfBuffer(new Uint8Array(m), u, c, p, n.mode, n.filter), m;
|
|
2173
2189
|
});
|
|
2174
2190
|
});
|
|
2175
2191
|
} else
|
|
2176
2192
|
return null;
|
|
2177
2193
|
}
|
|
2178
2194
|
}
|
|
2179
|
-
class
|
|
2195
|
+
class vi {
|
|
2180
2196
|
constructor(e) {
|
|
2181
2197
|
this.name = R.EXT_MESH_GPU_INSTANCING, this.parser = e;
|
|
2182
2198
|
}
|
|
@@ -2186,52 +2202,52 @@ class Si {
|
|
|
2186
2202
|
return null;
|
|
2187
2203
|
const n = t.meshes[s.mesh];
|
|
2188
2204
|
for (const h of n.primitives)
|
|
2189
|
-
if (h.mode !==
|
|
2205
|
+
if (h.mode !== W.TRIANGLES && h.mode !== W.TRIANGLE_STRIP && h.mode !== W.TRIANGLE_FAN && h.mode !== void 0)
|
|
2190
2206
|
return null;
|
|
2191
2207
|
const o = s.extensions[this.name].attributes, a = [], l = {};
|
|
2192
2208
|
for (const h in o)
|
|
2193
2209
|
a.push(this.parser.getDependency("accessor", o[h]).then((u) => (l[h] = u, l[h])));
|
|
2194
2210
|
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 &&
|
|
2211
|
+
const u = h.pop(), c = u.isGroup ? u.children : [u], p = h[0].count, m = [];
|
|
2212
|
+
for (const b of c) {
|
|
2213
|
+
const f = new Se(), y = new M(), d = new K(), _ = new M(1, 1, 1), x = new zn(b.geometry, b.material, p);
|
|
2214
|
+
for (let S = 0; S < p; S++)
|
|
2215
|
+
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
2216
|
for (const S in l)
|
|
2201
2217
|
if (S === "_COLOR_0") {
|
|
2202
|
-
const
|
|
2203
|
-
|
|
2204
|
-
} else S !== "TRANSLATION" && S !== "ROTATION" && S !== "SCALE" &&
|
|
2205
|
-
|
|
2218
|
+
const A = l[S];
|
|
2219
|
+
x.instanceColor = new Gn(A.array, A.itemSize, A.normalized);
|
|
2220
|
+
} else S !== "TRANSLATION" && S !== "ROTATION" && S !== "SCALE" && b.geometry.setAttribute(S, l[S]);
|
|
2221
|
+
Ue.prototype.copy.call(x, b), this.parser.assignFinalMaterial(x), m.push(x);
|
|
2206
2222
|
}
|
|
2207
|
-
return u.isGroup ? (u.clear(), u.add(...
|
|
2223
|
+
return u.isGroup ? (u.clear(), u.add(...m), u) : m[0];
|
|
2208
2224
|
}));
|
|
2209
2225
|
}
|
|
2210
2226
|
}
|
|
2211
|
-
const
|
|
2212
|
-
class
|
|
2227
|
+
const _n = "glTF", Oe = 12, qt = { JSON: 1313821514, BIN: 5130562 };
|
|
2228
|
+
class Si {
|
|
2213
2229
|
constructor(e) {
|
|
2214
2230
|
this.name = R.KHR_BINARY_GLTF, this.content = null, this.body = null;
|
|
2215
|
-
const t = new DataView(e, 0,
|
|
2231
|
+
const t = new DataView(e, 0, Oe), s = new TextDecoder();
|
|
2216
2232
|
if (this.header = {
|
|
2217
2233
|
magic: s.decode(new Uint8Array(e.slice(0, 4))),
|
|
2218
2234
|
version: t.getUint32(4, !0),
|
|
2219
2235
|
length: t.getUint32(8, !0)
|
|
2220
|
-
}, this.header.magic !==
|
|
2236
|
+
}, this.header.magic !== _n)
|
|
2221
2237
|
throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
|
|
2222
2238
|
if (this.header.version < 2)
|
|
2223
2239
|
throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
|
|
2224
|
-
const n = this.header.length -
|
|
2240
|
+
const n = this.header.length - Oe, i = new DataView(e, Oe);
|
|
2225
2241
|
let o = 0;
|
|
2226
2242
|
for (; o < n; ) {
|
|
2227
2243
|
const a = i.getUint32(o, !0);
|
|
2228
2244
|
o += 4;
|
|
2229
2245
|
const l = i.getUint32(o, !0);
|
|
2230
|
-
if (o += 4, l ===
|
|
2231
|
-
const h = new Uint8Array(e,
|
|
2246
|
+
if (o += 4, l === qt.JSON) {
|
|
2247
|
+
const h = new Uint8Array(e, Oe + o, a);
|
|
2232
2248
|
this.content = s.decode(h);
|
|
2233
|
-
} else if (l ===
|
|
2234
|
-
const h =
|
|
2249
|
+
} else if (l === qt.BIN) {
|
|
2250
|
+
const h = Oe + o;
|
|
2235
2251
|
this.body = e.slice(h, h + a);
|
|
2236
2252
|
}
|
|
2237
2253
|
o += a;
|
|
@@ -2249,25 +2265,25 @@ class Ri {
|
|
|
2249
2265
|
decodePrimitive(e, t) {
|
|
2250
2266
|
const s = this.json, n = this.dracoLoader, i = e.extensions[this.name].bufferView, o = e.extensions[this.name].attributes, a = {}, l = {}, h = {};
|
|
2251
2267
|
for (const u in o) {
|
|
2252
|
-
const c =
|
|
2268
|
+
const c = Tt[u] || u.toLowerCase();
|
|
2253
2269
|
a[c] = o[u];
|
|
2254
2270
|
}
|
|
2255
2271
|
for (const u in e.attributes) {
|
|
2256
|
-
const c =
|
|
2272
|
+
const c = Tt[u] || u.toLowerCase();
|
|
2257
2273
|
if (o[u] !== void 0) {
|
|
2258
|
-
const
|
|
2259
|
-
h[c] =
|
|
2274
|
+
const p = s.accessors[e.attributes[u]], m = ve[p.componentType];
|
|
2275
|
+
h[c] = m.name, l[c] = p.normalized === !0;
|
|
2260
2276
|
}
|
|
2261
2277
|
}
|
|
2262
2278
|
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 && (
|
|
2279
|
+
return new Promise(function(c, p) {
|
|
2280
|
+
n.decodeDracoFile(u, function(m) {
|
|
2281
|
+
for (const b in m.attributes) {
|
|
2282
|
+
const f = m.attributes[b], y = l[b];
|
|
2283
|
+
y !== void 0 && (f.normalized = y);
|
|
2268
2284
|
}
|
|
2269
|
-
c(
|
|
2270
|
-
}, a, h, ae,
|
|
2285
|
+
c(m);
|
|
2286
|
+
}, a, h, ae, p);
|
|
2271
2287
|
});
|
|
2272
2288
|
});
|
|
2273
2289
|
}
|
|
@@ -2285,7 +2301,7 @@ class Pi {
|
|
|
2285
2301
|
this.name = R.KHR_MESH_QUANTIZATION;
|
|
2286
2302
|
}
|
|
2287
2303
|
}
|
|
2288
|
-
class
|
|
2304
|
+
class bn extends ls {
|
|
2289
2305
|
constructor(e, t, s, n) {
|
|
2290
2306
|
super(e, t, s, n);
|
|
2291
2307
|
}
|
|
@@ -2296,22 +2312,22 @@ class yn extends ls {
|
|
|
2296
2312
|
return t;
|
|
2297
2313
|
}
|
|
2298
2314
|
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,
|
|
2315
|
+
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
2316
|
for (let S = 0; S !== a; S++) {
|
|
2301
|
-
const
|
|
2302
|
-
i[S] =
|
|
2317
|
+
const A = o[f + S + a], v = o[f + S + l] * u, I = o[b + S + a], ie = o[b + S] * u;
|
|
2318
|
+
i[S] = _ * A + x * v + y * I + d * ie;
|
|
2303
2319
|
}
|
|
2304
2320
|
return i;
|
|
2305
2321
|
}
|
|
2306
2322
|
}
|
|
2307
|
-
const Li = new
|
|
2308
|
-
class Ii extends
|
|
2323
|
+
const Li = new K();
|
|
2324
|
+
class Ii extends bn {
|
|
2309
2325
|
interpolate_(e, t, s, n) {
|
|
2310
2326
|
const i = super.interpolate_(e, t, s, n);
|
|
2311
2327
|
return Li.fromArray(i).normalize().toArray(i), i;
|
|
2312
2328
|
}
|
|
2313
2329
|
}
|
|
2314
|
-
const
|
|
2330
|
+
const W = {
|
|
2315
2331
|
POINTS: 0,
|
|
2316
2332
|
LINES: 1,
|
|
2317
2333
|
LINE_LOOP: 2,
|
|
@@ -2319,25 +2335,25 @@ const Q = {
|
|
|
2319
2335
|
TRIANGLES: 4,
|
|
2320
2336
|
TRIANGLE_STRIP: 5,
|
|
2321
2337
|
TRIANGLE_FAN: 6
|
|
2322
|
-
},
|
|
2338
|
+
}, ve = {
|
|
2323
2339
|
5120: Int8Array,
|
|
2324
2340
|
5121: Uint8Array,
|
|
2325
2341
|
5122: Int16Array,
|
|
2326
2342
|
5123: Uint16Array,
|
|
2327
2343
|
5125: Uint32Array,
|
|
2328
2344
|
5126: Float32Array
|
|
2329
|
-
},
|
|
2330
|
-
9728:
|
|
2331
|
-
9729:
|
|
2345
|
+
}, Wt = {
|
|
2346
|
+
9728: un,
|
|
2347
|
+
9729: _t,
|
|
2332
2348
|
9984: Qn,
|
|
2333
2349
|
9985: Zn,
|
|
2334
2350
|
9986: Vn,
|
|
2335
|
-
9987:
|
|
2336
|
-
},
|
|
2351
|
+
9987: hn
|
|
2352
|
+
}, $t = {
|
|
2337
2353
|
33071: Wn,
|
|
2338
2354
|
33648: qn,
|
|
2339
|
-
10497:
|
|
2340
|
-
},
|
|
2355
|
+
10497: bt
|
|
2356
|
+
}, pt = {
|
|
2341
2357
|
SCALAR: 1,
|
|
2342
2358
|
VEC2: 2,
|
|
2343
2359
|
VEC3: 3,
|
|
@@ -2345,7 +2361,7 @@ const Q = {
|
|
|
2345
2361
|
MAT2: 4,
|
|
2346
2362
|
MAT3: 9,
|
|
2347
2363
|
MAT4: 16
|
|
2348
|
-
},
|
|
2364
|
+
}, Tt = {
|
|
2349
2365
|
POSITION: "position",
|
|
2350
2366
|
NORMAL: "normal",
|
|
2351
2367
|
TANGENT: "tangent",
|
|
@@ -2365,15 +2381,15 @@ const Q = {
|
|
|
2365
2381
|
CUBICSPLINE: void 0,
|
|
2366
2382
|
// We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
|
|
2367
2383
|
// keyframe track will be initialized with a default interpolation type, then modified.
|
|
2368
|
-
LINEAR:
|
|
2384
|
+
LINEAR: pn,
|
|
2369
2385
|
STEP: rs
|
|
2370
|
-
},
|
|
2386
|
+
}, ft = {
|
|
2371
2387
|
OPAQUE: "OPAQUE",
|
|
2372
2388
|
MASK: "MASK",
|
|
2373
2389
|
BLEND: "BLEND"
|
|
2374
2390
|
};
|
|
2375
2391
|
function Ci(r) {
|
|
2376
|
-
return r.DefaultMaterial === void 0 && (r.DefaultMaterial = new
|
|
2392
|
+
return r.DefaultMaterial === void 0 && (r.DefaultMaterial = new dn({
|
|
2377
2393
|
color: 16777215,
|
|
2378
2394
|
emissive: 0,
|
|
2379
2395
|
metalness: 1,
|
|
@@ -2383,11 +2399,11 @@ function Ci(r) {
|
|
|
2383
2399
|
side: as
|
|
2384
2400
|
})), r.DefaultMaterial;
|
|
2385
2401
|
}
|
|
2386
|
-
function
|
|
2402
|
+
function ge(r, e, t) {
|
|
2387
2403
|
for (const s in t.extensions)
|
|
2388
2404
|
r[s] === void 0 && (e.userData.gltfExtensions = e.userData.gltfExtensions || {}, e.userData.gltfExtensions[s] = t.extensions[s]);
|
|
2389
2405
|
}
|
|
2390
|
-
function
|
|
2406
|
+
function ne(r, e) {
|
|
2391
2407
|
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
2408
|
}
|
|
2393
2409
|
function Di(r, e, t) {
|
|
@@ -2401,16 +2417,16 @@ function Di(r, e, t) {
|
|
|
2401
2417
|
for (let h = 0, u = e.length; h < u; h++) {
|
|
2402
2418
|
const c = e[h];
|
|
2403
2419
|
if (s) {
|
|
2404
|
-
const
|
|
2405
|
-
o.push(
|
|
2420
|
+
const p = c.POSITION !== void 0 ? t.getDependency("accessor", c.POSITION) : r.attributes.position;
|
|
2421
|
+
o.push(p);
|
|
2406
2422
|
}
|
|
2407
2423
|
if (n) {
|
|
2408
|
-
const
|
|
2409
|
-
a.push(
|
|
2424
|
+
const p = c.NORMAL !== void 0 ? t.getDependency("accessor", c.NORMAL) : r.attributes.normal;
|
|
2425
|
+
a.push(p);
|
|
2410
2426
|
}
|
|
2411
2427
|
if (i) {
|
|
2412
|
-
const
|
|
2413
|
-
l.push(
|
|
2428
|
+
const p = c.COLOR_0 !== void 0 ? t.getDependency("accessor", c.COLOR_0) : r.attributes.color;
|
|
2429
|
+
l.push(p);
|
|
2414
2430
|
}
|
|
2415
2431
|
}
|
|
2416
2432
|
return Promise.all([
|
|
@@ -2418,8 +2434,8 @@ function Di(r, e, t) {
|
|
|
2418
2434
|
Promise.all(a),
|
|
2419
2435
|
Promise.all(l)
|
|
2420
2436
|
]).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 =
|
|
2437
|
+
const u = h[0], c = h[1], p = h[2];
|
|
2438
|
+
return s && (r.morphAttributes.position = u), n && (r.morphAttributes.normal = c), i && (r.morphAttributes.color = p), r.morphTargetsRelative = !0, r;
|
|
2423
2439
|
});
|
|
2424
2440
|
}
|
|
2425
2441
|
function Ni(r, e) {
|
|
@@ -2439,19 +2455,19 @@ function Ni(r, e) {
|
|
|
2439
2455
|
function ki(r) {
|
|
2440
2456
|
let e;
|
|
2441
2457
|
const t = r.extensions && r.extensions[R.KHR_DRACO_MESH_COMPRESSION];
|
|
2442
|
-
if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" +
|
|
2458
|
+
if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + mt(t.attributes) : e = r.indices + ":" + mt(r.attributes) + ":" + r.mode, r.targets !== void 0)
|
|
2443
2459
|
for (let s = 0, n = r.targets.length; s < n; s++)
|
|
2444
|
-
e += ":" +
|
|
2460
|
+
e += ":" + mt(r.targets[s]);
|
|
2445
2461
|
return e;
|
|
2446
2462
|
}
|
|
2447
|
-
function
|
|
2463
|
+
function mt(r) {
|
|
2448
2464
|
let e = "";
|
|
2449
2465
|
const t = Object.keys(r).sort();
|
|
2450
2466
|
for (let s = 0, n = t.length; s < n; s++)
|
|
2451
2467
|
e += t[s] + ":" + r[t[s]] + ";";
|
|
2452
2468
|
return e;
|
|
2453
2469
|
}
|
|
2454
|
-
function
|
|
2470
|
+
function xt(r) {
|
|
2455
2471
|
switch (r) {
|
|
2456
2472
|
case Int8Array:
|
|
2457
2473
|
return 1 / 127;
|
|
@@ -2468,7 +2484,7 @@ function wt(r) {
|
|
|
2468
2484
|
function ji(r) {
|
|
2469
2485
|
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
2486
|
}
|
|
2471
|
-
const Hi = new
|
|
2487
|
+
const Hi = new Se();
|
|
2472
2488
|
class Fi {
|
|
2473
2489
|
constructor(e = {}, t = {}) {
|
|
2474
2490
|
this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new li(), 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 = {};
|
|
@@ -2479,7 +2495,7 @@ class Fi {
|
|
|
2479
2495
|
const l = a.match(/Version\/(\d+)/);
|
|
2480
2496
|
n = s && l ? parseInt(l[1], 10) : -1, i = a.indexOf("Firefox") > -1, o = i ? a.match(/Firefox\/([0-9]+)\./)[1] : -1;
|
|
2481
2497
|
}
|
|
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
|
|
2498
|
+
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 Et(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
|
|
2483
2499
|
}
|
|
2484
2500
|
setExtensions(e) {
|
|
2485
2501
|
this.extensions = e;
|
|
@@ -2509,7 +2525,7 @@ class Fi {
|
|
|
2509
2525
|
parser: s,
|
|
2510
2526
|
userData: {}
|
|
2511
2527
|
};
|
|
2512
|
-
return
|
|
2528
|
+
return ge(i, a, n), ne(a, n), Promise.all(s._invokeAll(function(l) {
|
|
2513
2529
|
return l.afterRoot && l.afterRoot(a);
|
|
2514
2530
|
})).then(function() {
|
|
2515
2531
|
for (const l of a.scenes)
|
|
@@ -2690,7 +2706,7 @@ class Fi {
|
|
|
2690
2706
|
return Promise.resolve(this.extensions[R.KHR_BINARY_GLTF].body);
|
|
2691
2707
|
const n = this.options;
|
|
2692
2708
|
return new Promise(function(i, o) {
|
|
2693
|
-
s.load(
|
|
2709
|
+
s.load(He.resolveURL(t.uri, n.path), i, void 0, function() {
|
|
2694
2710
|
o(new Error('THREE.GLTFLoader: Failed to load buffer "' + t.uri + '".'));
|
|
2695
2711
|
});
|
|
2696
2712
|
});
|
|
@@ -2719,27 +2735,27 @@ class Fi {
|
|
|
2719
2735
|
loadAccessor(e) {
|
|
2720
2736
|
const t = this, s = this.json, n = this.json.accessors[e];
|
|
2721
2737
|
if (n.bufferView === void 0 && n.sparse === void 0) {
|
|
2722
|
-
const o =
|
|
2723
|
-
return Promise.resolve(new
|
|
2738
|
+
const o = pt[n.type], a = ve[n.componentType], l = n.normalized === !0, h = new a(n.count * o);
|
|
2739
|
+
return Promise.resolve(new at(h, o, l));
|
|
2724
2740
|
}
|
|
2725
2741
|
const i = [];
|
|
2726
2742
|
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
|
-
|
|
2743
|
+
const a = o[0], l = pt[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;
|
|
2744
|
+
let f, y;
|
|
2745
|
+
if (m && m !== c) {
|
|
2746
|
+
const d = Math.floor(p / m), _ = "InterleavedBuffer:" + n.bufferView + ":" + n.componentType + ":" + d + ":" + n.count;
|
|
2747
|
+
let x = t.cache.get(_);
|
|
2748
|
+
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
2749
|
} else
|
|
2734
|
-
a === null ?
|
|
2750
|
+
a === null ? f = new h(n.count * l) : f = new h(a, p, n.count * l), y = new at(f, l, b);
|
|
2735
2751
|
if (n.sparse !== void 0) {
|
|
2736
|
-
const
|
|
2737
|
-
a !== null && (y = new
|
|
2738
|
-
for (let I = 0,
|
|
2739
|
-
const
|
|
2740
|
-
if (y.setX(
|
|
2752
|
+
const d = pt.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);
|
|
2753
|
+
a !== null && (y = new at(y.array.slice(), y.itemSize, y.normalized)), y.normalized = !1;
|
|
2754
|
+
for (let I = 0, ie = A.length; I < ie; I++) {
|
|
2755
|
+
const ee = A[I];
|
|
2756
|
+
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
2757
|
}
|
|
2742
|
-
y.normalized =
|
|
2758
|
+
y.normalized = b;
|
|
2743
2759
|
}
|
|
2744
2760
|
return y;
|
|
2745
2761
|
});
|
|
@@ -2766,8 +2782,8 @@ class Fi {
|
|
|
2766
2782
|
return this.textureCache[l];
|
|
2767
2783
|
const h = this.loadImageSource(t, s).then(function(u) {
|
|
2768
2784
|
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 =
|
|
2785
|
+
const p = (i.samplers || {})[o.sampler] || {};
|
|
2786
|
+
return u.magFilter = Wt[p.magFilter] || _t, u.minFilter = Wt[p.minFilter] || hn, u.wrapS = $t[p.wrapS] || bt, u.wrapT = $t[p.wrapT] || bt, u.generateMipmaps = !u.isCompressedTexture && u.minFilter !== un && u.minFilter !== _t, n.associations.set(u, { textures: e }), u;
|
|
2771
2787
|
}).catch(function() {
|
|
2772
2788
|
return null;
|
|
2773
2789
|
});
|
|
@@ -2782,21 +2798,21 @@ class Fi {
|
|
|
2782
2798
|
if (o.bufferView !== void 0)
|
|
2783
2799
|
l = s.getDependency("bufferView", o.bufferView).then(function(c) {
|
|
2784
2800
|
h = !0;
|
|
2785
|
-
const
|
|
2786
|
-
return l = a.createObjectURL(
|
|
2801
|
+
const p = new Blob([c], { type: o.mimeType });
|
|
2802
|
+
return l = a.createObjectURL(p), l;
|
|
2787
2803
|
});
|
|
2788
2804
|
else if (o.uri === void 0)
|
|
2789
2805
|
throw new Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView");
|
|
2790
2806
|
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(
|
|
2807
|
+
return new Promise(function(p, m) {
|
|
2808
|
+
let b = p;
|
|
2809
|
+
t.isImageBitmapLoader === !0 && (b = function(f) {
|
|
2810
|
+
const y = new Lt(f);
|
|
2811
|
+
y.needsUpdate = !0, p(y);
|
|
2812
|
+
}), t.load(He.resolveURL(c, i.path), b, void 0, m);
|
|
2797
2813
|
});
|
|
2798
2814
|
}).then(function(c) {
|
|
2799
|
-
return h === !0 && a.revokeObjectURL(l),
|
|
2815
|
+
return h === !0 && a.revokeObjectURL(l), ne(c, o), c.userData.mimeType = o.mimeType || ji(o.uri), c;
|
|
2800
2816
|
}).catch(function(c) {
|
|
2801
2817
|
throw console.error("THREE.GLTFLoader: Couldn't load texture", l), c;
|
|
2802
2818
|
});
|
|
@@ -2843,11 +2859,11 @@ class Fi {
|
|
|
2843
2859
|
if (e.isPoints) {
|
|
2844
2860
|
const a = "PointsMaterial:" + s.uuid;
|
|
2845
2861
|
let l = this.cache.get(a);
|
|
2846
|
-
l || (l = new
|
|
2862
|
+
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
2863
|
} else if (e.isLine) {
|
|
2848
2864
|
const a = "LineBasicMaterial:" + s.uuid;
|
|
2849
2865
|
let l = this.cache.get(a);
|
|
2850
|
-
l || (l = new
|
|
2866
|
+
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
2867
|
}
|
|
2852
2868
|
if (n || i || o) {
|
|
2853
2869
|
let a = "ClonedMaterial:" + s.uuid + ":";
|
|
@@ -2858,7 +2874,7 @@ class Fi {
|
|
|
2858
2874
|
e.material = s;
|
|
2859
2875
|
}
|
|
2860
2876
|
getMaterialType() {
|
|
2861
|
-
return
|
|
2877
|
+
return dn;
|
|
2862
2878
|
}
|
|
2863
2879
|
/**
|
|
2864
2880
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
|
|
@@ -2876,29 +2892,29 @@ class Fi {
|
|
|
2876
2892
|
o = c.getMaterialType(), h.push(c.extendParams(a, i, t));
|
|
2877
2893
|
} else {
|
|
2878
2894
|
const c = i.pbrMetallicRoughness || {};
|
|
2879
|
-
if (a.color = new
|
|
2880
|
-
const
|
|
2881
|
-
a.color.setRGB(
|
|
2895
|
+
if (a.color = new pe(1, 1, 1), a.opacity = 1, Array.isArray(c.baseColorFactor)) {
|
|
2896
|
+
const p = c.baseColorFactor;
|
|
2897
|
+
a.color.setRGB(p[0], p[1], p[2], ae), a.opacity = p[3];
|
|
2882
2898
|
}
|
|
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
|
|
2899
|
+
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) {
|
|
2900
|
+
return p.getMaterialType && p.getMaterialType(e);
|
|
2901
|
+
}), h.push(Promise.all(this._invokeAll(function(p) {
|
|
2902
|
+
return p.extendMaterialParams && p.extendMaterialParams(e, a);
|
|
2887
2903
|
})));
|
|
2888
2904
|
}
|
|
2889
|
-
i.doubleSided === !0 && (a.side =
|
|
2890
|
-
const u = i.alphaMode ||
|
|
2891
|
-
if (u ===
|
|
2905
|
+
i.doubleSided === !0 && (a.side = an);
|
|
2906
|
+
const u = i.alphaMode || ft.OPAQUE;
|
|
2907
|
+
if (u === ft.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, u === ft.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
2908
|
const c = i.normalTexture.scale;
|
|
2893
2909
|
a.normalScale.set(c, c);
|
|
2894
2910
|
}
|
|
2895
|
-
if (i.occlusionTexture !== void 0 && o !==
|
|
2911
|
+
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
2912
|
const c = i.emissiveFactor;
|
|
2897
|
-
a.emissive = new
|
|
2913
|
+
a.emissive = new pe().setRGB(c[0], c[1], c[2], ae);
|
|
2898
2914
|
}
|
|
2899
|
-
return i.emissiveTexture !== void 0 && o !==
|
|
2915
|
+
return i.emissiveTexture !== void 0 && o !== _e && h.push(t.assignTexture(a, "emissiveMap", i.emissiveTexture, Re)), Promise.all(h).then(function() {
|
|
2900
2916
|
const c = new o(a);
|
|
2901
|
-
return i.name && (c.name = i.name),
|
|
2917
|
+
return i.name && (c.name = i.name), ne(c, i), t.associations.set(c, { materials: e }), i.extensions && ge(n, c, i), c;
|
|
2902
2918
|
});
|
|
2903
2919
|
}
|
|
2904
2920
|
/**
|
|
@@ -2925,7 +2941,7 @@ class Fi {
|
|
|
2925
2941
|
const t = this, s = this.extensions, n = this.primitiveCache;
|
|
2926
2942
|
function i(a) {
|
|
2927
2943
|
return s[R.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, t).then(function(l) {
|
|
2928
|
-
return
|
|
2944
|
+
return Jt(l, a, t);
|
|
2929
2945
|
});
|
|
2930
2946
|
}
|
|
2931
2947
|
const o = [];
|
|
@@ -2934,8 +2950,8 @@ class Fi {
|
|
|
2934
2950
|
if (c)
|
|
2935
2951
|
o.push(c.promise);
|
|
2936
2952
|
else {
|
|
2937
|
-
let
|
|
2938
|
-
h.extensions && h.extensions[R.KHR_DRACO_MESH_COMPRESSION] ?
|
|
2953
|
+
let p;
|
|
2954
|
+
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
2955
|
}
|
|
2940
2956
|
}
|
|
2941
2957
|
return Promise.all(o);
|
|
@@ -2955,36 +2971,36 @@ class Fi {
|
|
|
2955
2971
|
}
|
|
2956
2972
|
return a.push(t.loadGeometries(o)), Promise.all(a).then(function(l) {
|
|
2957
2973
|
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
|
-
|
|
2974
|
+
for (let m = 0, b = u.length; m < b; m++) {
|
|
2975
|
+
const f = u[m], y = o[m];
|
|
2976
|
+
let d;
|
|
2977
|
+
const _ = h[m];
|
|
2978
|
+
if (y.mode === W.TRIANGLES || y.mode === W.TRIANGLE_STRIP || y.mode === W.TRIANGLE_FAN || y.mode === void 0)
|
|
2979
|
+
d = i.isSkinnedMesh === !0 ? new Jn(f, _) : new w(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, yt));
|
|
2980
|
+
else if (y.mode === W.LINES)
|
|
2981
|
+
d = new gt(f, _);
|
|
2982
|
+
else if (y.mode === W.LINE_STRIP)
|
|
2983
|
+
d = new re(f, _);
|
|
2984
|
+
else if (y.mode === W.LINE_LOOP)
|
|
2985
|
+
d = new es(f, _);
|
|
2986
|
+
else if (y.mode === W.POINTS)
|
|
2987
|
+
d = new nt(f, _);
|
|
2972
2988
|
else
|
|
2973
2989
|
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + y.mode);
|
|
2974
|
-
Object.keys(
|
|
2990
|
+
Object.keys(d.geometry.morphAttributes).length > 0 && Ni(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
2991
|
}
|
|
2976
|
-
for (let
|
|
2977
|
-
t.associations.set(c[
|
|
2992
|
+
for (let m = 0, b = c.length; m < b; m++)
|
|
2993
|
+
t.associations.set(c[m], {
|
|
2978
2994
|
meshes: e,
|
|
2979
|
-
primitives:
|
|
2995
|
+
primitives: m
|
|
2980
2996
|
});
|
|
2981
2997
|
if (c.length === 1)
|
|
2982
|
-
return i.extensions &&
|
|
2983
|
-
const
|
|
2984
|
-
i.extensions &&
|
|
2985
|
-
for (let
|
|
2986
|
-
|
|
2987
|
-
return
|
|
2998
|
+
return i.extensions && ge(n, c[0], i), c[0];
|
|
2999
|
+
const p = new tt();
|
|
3000
|
+
i.extensions && ge(n, p, i), t.associations.set(p, { meshes: e });
|
|
3001
|
+
for (let m = 0, b = c.length; m < b; m++)
|
|
3002
|
+
p.add(c[m]);
|
|
3003
|
+
return p;
|
|
2988
3004
|
});
|
|
2989
3005
|
}
|
|
2990
3006
|
/**
|
|
@@ -3001,7 +3017,7 @@ class Fi {
|
|
|
3001
3017
|
console.warn("THREE.GLTFLoader: Missing camera parameters.");
|
|
3002
3018
|
return;
|
|
3003
3019
|
}
|
|
3004
|
-
return s.type === "perspective" ? t = new ts(
|
|
3020
|
+
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
3021
|
}
|
|
3006
3022
|
/**
|
|
3007
3023
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
|
|
@@ -3020,8 +3036,8 @@ class Fi {
|
|
|
3020
3036
|
const c = o[h];
|
|
3021
3037
|
if (c) {
|
|
3022
3038
|
a.push(c);
|
|
3023
|
-
const
|
|
3024
|
-
i !== null &&
|
|
3039
|
+
const p = new Se();
|
|
3040
|
+
i !== null && p.fromArray(i.array, h * 16), l.push(p);
|
|
3025
3041
|
} else
|
|
3026
3042
|
console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', t.joints[h]);
|
|
3027
3043
|
}
|
|
@@ -3037,9 +3053,9 @@ class Fi {
|
|
|
3037
3053
|
*/
|
|
3038
3054
|
loadAnimation(e) {
|
|
3039
3055
|
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
|
-
|
|
3056
|
+
for (let c = 0, p = n.channels.length; c < p; c++) {
|
|
3057
|
+
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;
|
|
3058
|
+
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
3059
|
}
|
|
3044
3060
|
return Promise.all([
|
|
3045
3061
|
Promise.all(o),
|
|
@@ -3048,18 +3064,18 @@ class Fi {
|
|
|
3048
3064
|
Promise.all(h),
|
|
3049
3065
|
Promise.all(u)
|
|
3050
3066
|
]).then(function(c) {
|
|
3051
|
-
const
|
|
3052
|
-
for (let
|
|
3053
|
-
const
|
|
3054
|
-
if (
|
|
3055
|
-
|
|
3056
|
-
const
|
|
3057
|
-
if (
|
|
3058
|
-
for (let
|
|
3059
|
-
|
|
3067
|
+
const p = c[0], m = c[1], b = c[2], f = c[3], y = c[4], d = [];
|
|
3068
|
+
for (let x = 0, S = p.length; x < S; x++) {
|
|
3069
|
+
const A = p[x], v = m[x], I = b[x], ie = f[x], ee = y[x];
|
|
3070
|
+
if (A === void 0) continue;
|
|
3071
|
+
A.updateMatrix && A.updateMatrix();
|
|
3072
|
+
const fe = s._createAnimationTracks(A, v, I, ie, ee);
|
|
3073
|
+
if (fe)
|
|
3074
|
+
for (let $ = 0; $ < fe.length; $++)
|
|
3075
|
+
d.push(fe[$]);
|
|
3060
3076
|
}
|
|
3061
|
-
const
|
|
3062
|
-
return
|
|
3077
|
+
const _ = new is(i, void 0, d);
|
|
3078
|
+
return ne(_, n), _;
|
|
3063
3079
|
});
|
|
3064
3080
|
}
|
|
3065
3081
|
createNodeMesh(e) {
|
|
@@ -3090,15 +3106,15 @@ class Fi {
|
|
|
3090
3106
|
Promise.all(o),
|
|
3091
3107
|
l
|
|
3092
3108
|
]).then(function(h) {
|
|
3093
|
-
const u = h[0], c = h[1],
|
|
3094
|
-
|
|
3095
|
-
|
|
3109
|
+
const u = h[0], c = h[1], p = h[2];
|
|
3110
|
+
p !== null && u.traverse(function(m) {
|
|
3111
|
+
m.isSkinnedMesh && m.bind(p, Hi);
|
|
3096
3112
|
});
|
|
3097
|
-
for (let
|
|
3098
|
-
u.add(c[
|
|
3113
|
+
for (let m = 0, b = c.length; m < b; m++)
|
|
3114
|
+
u.add(c[m]);
|
|
3099
3115
|
if (u.userData.pivot !== void 0 && c.length > 0) {
|
|
3100
|
-
const
|
|
3101
|
-
u.pivot = new
|
|
3116
|
+
const m = u.userData.pivot, b = c[0];
|
|
3117
|
+
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
3118
|
}
|
|
3103
3119
|
return u;
|
|
3104
3120
|
});
|
|
@@ -3120,11 +3136,11 @@ class Fi {
|
|
|
3120
3136
|
a.push(h);
|
|
3121
3137
|
}), this.nodeCache[e] = Promise.all(a).then(function(h) {
|
|
3122
3138
|
let u;
|
|
3123
|
-
if (i.isBone === !0 ? u = new os() : h.length > 1 ? u = new
|
|
3124
|
-
for (let c = 0,
|
|
3139
|
+
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])
|
|
3140
|
+
for (let c = 0, p = h.length; c < p; c++)
|
|
3125
3141
|
u.add(h[c]);
|
|
3126
|
-
if (i.name && (u.userData.name = i.name, u.name = o),
|
|
3127
|
-
const c = new
|
|
3142
|
+
if (i.name && (u.userData.name = i.name, u.name = o), ne(u, i), i.extensions && ge(s, u, i), i.matrix !== void 0) {
|
|
3143
|
+
const c = new Se();
|
|
3128
3144
|
c.fromArray(i.matrix), u.applyMatrix4(c);
|
|
3129
3145
|
} else
|
|
3130
3146
|
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 +3161,23 @@ class Fi {
|
|
|
3145
3161
|
* @return {Promise<Group>}
|
|
3146
3162
|
*/
|
|
3147
3163
|
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)),
|
|
3164
|
+
const t = this.extensions, s = this.json.scenes[e], n = this, i = new tt();
|
|
3165
|
+
s.name && (i.name = n.createUniqueName(s.name)), ne(i, s), s.extensions && ge(t, i, s);
|
|
3150
3166
|
const o = s.nodes || [], a = [];
|
|
3151
3167
|
for (let l = 0, h = o.length; l < h; l++)
|
|
3152
3168
|
a.push(n.getDependency("node", o[l]));
|
|
3153
3169
|
return Promise.all(a).then(function(l) {
|
|
3154
3170
|
for (let u = 0, c = l.length; u < c; u++) {
|
|
3155
|
-
const
|
|
3156
|
-
|
|
3171
|
+
const p = l[u];
|
|
3172
|
+
p.parent !== null ? i.add(ri(p)) : i.add(p);
|
|
3157
3173
|
}
|
|
3158
3174
|
const h = (u) => {
|
|
3159
3175
|
const c = /* @__PURE__ */ new Map();
|
|
3160
|
-
for (const [
|
|
3161
|
-
(
|
|
3162
|
-
return u.traverse((
|
|
3163
|
-
const
|
|
3164
|
-
|
|
3176
|
+
for (const [p, m] of n.associations)
|
|
3177
|
+
(p instanceof je || p instanceof Lt) && c.set(p, m);
|
|
3178
|
+
return u.traverse((p) => {
|
|
3179
|
+
const m = n.associations.get(p);
|
|
3180
|
+
m != null && c.set(p, m);
|
|
3165
3181
|
}), c;
|
|
3166
3182
|
};
|
|
3167
3183
|
return n.associations = h(i), i;
|
|
@@ -3169,51 +3185,51 @@ class Fi {
|
|
|
3169
3185
|
}
|
|
3170
3186
|
_createAnimationTracks(e, t, s, n, i) {
|
|
3171
3187
|
const o = [], a = e.name ? e.name : e.uuid, l = [];
|
|
3172
|
-
function h(
|
|
3173
|
-
|
|
3188
|
+
function h(m) {
|
|
3189
|
+
m.morphTargetInfluences && l.push(m.name ? m.name : m.uuid);
|
|
3174
3190
|
}
|
|
3175
3191
|
ce[i.path] === ce.weights ? (h(e), e.isGroup && e.children.forEach(h)) : l.push(a);
|
|
3176
3192
|
let u;
|
|
3177
3193
|
switch (ce[i.path]) {
|
|
3178
3194
|
case ce.weights:
|
|
3179
|
-
u =
|
|
3195
|
+
u = Ot;
|
|
3180
3196
|
break;
|
|
3181
3197
|
case ce.rotation:
|
|
3182
|
-
u =
|
|
3198
|
+
u = Ct;
|
|
3183
3199
|
break;
|
|
3184
3200
|
case ce.translation:
|
|
3185
3201
|
case ce.scale:
|
|
3186
|
-
u =
|
|
3202
|
+
u = It;
|
|
3187
3203
|
break;
|
|
3188
3204
|
default:
|
|
3189
3205
|
switch (s.itemSize) {
|
|
3190
3206
|
case 1:
|
|
3191
|
-
u =
|
|
3207
|
+
u = Ot;
|
|
3192
3208
|
break;
|
|
3193
3209
|
case 2:
|
|
3194
3210
|
case 3:
|
|
3195
3211
|
default:
|
|
3196
|
-
u =
|
|
3212
|
+
u = It;
|
|
3197
3213
|
break;
|
|
3198
3214
|
}
|
|
3199
3215
|
break;
|
|
3200
3216
|
}
|
|
3201
|
-
const c = n.interpolation !== void 0 ? Oi[n.interpolation] :
|
|
3202
|
-
for (let
|
|
3203
|
-
const
|
|
3204
|
-
l[
|
|
3217
|
+
const c = n.interpolation !== void 0 ? Oi[n.interpolation] : pn, p = this._getArrayFromAccessor(s);
|
|
3218
|
+
for (let m = 0, b = l.length; m < b; m++) {
|
|
3219
|
+
const f = new u(
|
|
3220
|
+
l[m] + "." + ce[i.path],
|
|
3205
3221
|
t.array,
|
|
3206
|
-
|
|
3222
|
+
p,
|
|
3207
3223
|
c
|
|
3208
3224
|
);
|
|
3209
|
-
n.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(
|
|
3225
|
+
n.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(f), o.push(f);
|
|
3210
3226
|
}
|
|
3211
3227
|
return o;
|
|
3212
3228
|
}
|
|
3213
3229
|
_getArrayFromAccessor(e) {
|
|
3214
3230
|
let t = e.array;
|
|
3215
3231
|
if (e.normalized) {
|
|
3216
|
-
const s =
|
|
3232
|
+
const s = xt(t.constructor), n = new Float32Array(t.length);
|
|
3217
3233
|
for (let i = 0, o = t.length; i < o; i++)
|
|
3218
3234
|
n[i] = t[i] * s;
|
|
3219
3235
|
t = n;
|
|
@@ -3222,7 +3238,7 @@ class Fi {
|
|
|
3222
3238
|
}
|
|
3223
3239
|
_createCubicSplineTrackInterpolant(e) {
|
|
3224
3240
|
e.createInterpolant = function(s) {
|
|
3225
|
-
const n = this instanceof
|
|
3241
|
+
const n = this instanceof Ct ? Ii : bn;
|
|
3226
3242
|
return new n(this.times, this.values, this.getValueSize() / 3, s);
|
|
3227
3243
|
}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
|
|
3228
3244
|
}
|
|
@@ -3233,10 +3249,10 @@ function Ui(r, e, t) {
|
|
|
3233
3249
|
const a = t.json.accessors[s.POSITION], l = a.min, h = a.max;
|
|
3234
3250
|
if (l !== void 0 && h !== void 0) {
|
|
3235
3251
|
if (n.set(
|
|
3236
|
-
new
|
|
3237
|
-
new
|
|
3252
|
+
new M(l[0], l[1], l[2]),
|
|
3253
|
+
new M(h[0], h[1], h[2])
|
|
3238
3254
|
), a.normalized) {
|
|
3239
|
-
const u =
|
|
3255
|
+
const u = xt(ve[a.componentType]);
|
|
3240
3256
|
n.min.multiplyScalar(u), n.max.multiplyScalar(u);
|
|
3241
3257
|
}
|
|
3242
3258
|
} else {
|
|
@@ -3247,15 +3263,15 @@ function Ui(r, e, t) {
|
|
|
3247
3263
|
return;
|
|
3248
3264
|
const i = e.targets;
|
|
3249
3265
|
if (i !== void 0) {
|
|
3250
|
-
const a = new
|
|
3266
|
+
const a = new M(), l = new M();
|
|
3251
3267
|
for (let h = 0, u = i.length; h < u; h++) {
|
|
3252
3268
|
const c = i[h];
|
|
3253
3269
|
if (c.POSITION !== void 0) {
|
|
3254
|
-
const
|
|
3255
|
-
if (
|
|
3256
|
-
if (l.setX(Math.max(Math.abs(
|
|
3257
|
-
const
|
|
3258
|
-
l.multiplyScalar(
|
|
3270
|
+
const p = t.json.accessors[c.POSITION], m = p.min, b = p.max;
|
|
3271
|
+
if (m !== void 0 && b !== void 0) {
|
|
3272
|
+
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) {
|
|
3273
|
+
const f = xt(ve[p.componentType]);
|
|
3274
|
+
l.multiplyScalar(f);
|
|
3259
3275
|
}
|
|
3260
3276
|
a.max(l);
|
|
3261
3277
|
} else
|
|
@@ -3268,7 +3284,7 @@ function Ui(r, e, t) {
|
|
|
3268
3284
|
const o = new hs();
|
|
3269
3285
|
n.getCenter(o.center), o.radius = n.min.distanceTo(n.max) / 2, r.boundingSphere = o;
|
|
3270
3286
|
}
|
|
3271
|
-
function
|
|
3287
|
+
function Jt(r, e, t) {
|
|
3272
3288
|
const s = e.attributes, n = [];
|
|
3273
3289
|
function i(o, a) {
|
|
3274
3290
|
return t.getDependency("accessor", o).then(function(l) {
|
|
@@ -3276,7 +3292,7 @@ function Wt(r, e, t) {
|
|
|
3276
3292
|
});
|
|
3277
3293
|
}
|
|
3278
3294
|
for (const o in s) {
|
|
3279
|
-
const a =
|
|
3295
|
+
const a = Tt[o] || o.toLowerCase();
|
|
3280
3296
|
a in r.attributes || n.push(i(s[o], a));
|
|
3281
3297
|
}
|
|
3282
3298
|
if (e.indices !== void 0 && !r.index) {
|
|
@@ -3285,17 +3301,17 @@ function Wt(r, e, t) {
|
|
|
3285
3301
|
});
|
|
3286
3302
|
n.push(o);
|
|
3287
3303
|
}
|
|
3288
|
-
return
|
|
3304
|
+
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), Ui(r, e, t), Promise.all(n).then(function() {
|
|
3289
3305
|
return e.targets !== void 0 ? Di(r, e.targets, t) : r;
|
|
3290
3306
|
});
|
|
3291
3307
|
}
|
|
3292
3308
|
function zi() {
|
|
3293
|
-
const r = new
|
|
3294
|
-
return t.position.y = 0.5, t.userData.isMovable = !0, t.name = "正方体",
|
|
3309
|
+
const r = new k.BoxGeometry(1, 1, 1), e = new k.MeshStandardMaterial({ color: 43775 }), t = new k.Mesh(r, e);
|
|
3310
|
+
return t.position.y = 0.5, t.userData.isMovable = !0, t.name = "正方体", rt(t, !0), t;
|
|
3295
3311
|
}
|
|
3296
3312
|
function Gi() {
|
|
3297
|
-
const r = new
|
|
3298
|
-
return t.position.y = 0.6, t.userData.isMovable = !0, t.name = "球体",
|
|
3313
|
+
const r = new k.SphereGeometry(0.6, 32, 32), e = new k.MeshStandardMaterial({ color: 16746496 }), t = new k.Mesh(r, e);
|
|
3314
|
+
return t.position.y = 0.6, t.userData.isMovable = !0, t.name = "球体", rt(t, !0), t;
|
|
3299
3315
|
}
|
|
3300
3316
|
function Xi(r) {
|
|
3301
3317
|
return new Promise((e, t) => {
|
|
@@ -3313,11 +3329,11 @@ function Xi(r) {
|
|
|
3313
3329
|
(a) => {
|
|
3314
3330
|
const l = s === "gltf" || s === "glb" ? a.scene : a;
|
|
3315
3331
|
l.traverse((c) => {
|
|
3316
|
-
var
|
|
3317
|
-
c.userData.isMovable = !0, c.name || (c.name = c.type), c.type === "Mesh" && (c.frustumCulled = !0, (
|
|
3332
|
+
var p;
|
|
3333
|
+
c.userData.isMovable = !0, c.name || (c.name = c.type), c.type === "Mesh" && (c.frustumCulled = !0, (p = c.geometry) == null || p.computeVertexNormals());
|
|
3318
3334
|
});
|
|
3319
|
-
const u = new
|
|
3320
|
-
l.position.sub(u),
|
|
3335
|
+
const u = new k.Box3().setFromObject(l).getCenter(new k.Vector3());
|
|
3336
|
+
l.position.sub(u), rt(l, !0), e(l);
|
|
3321
3337
|
},
|
|
3322
3338
|
void 0,
|
|
3323
3339
|
(a) => t(a)
|
|
@@ -3340,7 +3356,7 @@ const Bi = {
|
|
|
3340
3356
|
}, Ki = { class: "tree-icon" }, Vi = { class: "tree-name" }, Zi = {
|
|
3341
3357
|
key: 0,
|
|
3342
3358
|
class: "tree-children"
|
|
3343
|
-
}, Qi = /* @__PURE__ */
|
|
3359
|
+
}, Qi = /* @__PURE__ */ Ge({
|
|
3344
3360
|
__name: "TreeItem",
|
|
3345
3361
|
props: {
|
|
3346
3362
|
node: {},
|
|
@@ -3349,15 +3365,15 @@ const Bi = {
|
|
|
3349
3365
|
},
|
|
3350
3366
|
emits: ["select", "delete"],
|
|
3351
3367
|
setup(r, { emit: e }) {
|
|
3352
|
-
const t = r, s = e, n =
|
|
3353
|
-
(
|
|
3354
|
-
))), u =
|
|
3368
|
+
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(
|
|
3369
|
+
(f) => f.userData.isMovable === !0
|
|
3370
|
+
))), u = Ze(
|
|
3355
3371
|
() => {
|
|
3356
|
-
var
|
|
3357
|
-
return ((
|
|
3372
|
+
var f;
|
|
3373
|
+
return ((f = t.selectedObject) == null ? void 0 : f.uuid) === t.node.uuid;
|
|
3358
3374
|
}
|
|
3359
3375
|
);
|
|
3360
|
-
|
|
3376
|
+
xn(
|
|
3361
3377
|
() => {
|
|
3362
3378
|
u.value && n.value && n.value.scrollIntoView({
|
|
3363
3379
|
block: "nearest",
|
|
@@ -3368,55 +3384,55 @@ const Bi = {
|
|
|
3368
3384
|
},
|
|
3369
3385
|
{ flush: "post" }
|
|
3370
3386
|
);
|
|
3371
|
-
const c = (
|
|
3372
|
-
|
|
3373
|
-
},
|
|
3374
|
-
|
|
3375
|
-
},
|
|
3376
|
-
return (
|
|
3377
|
-
const
|
|
3378
|
-
return
|
|
3387
|
+
const c = (f) => {
|
|
3388
|
+
f.stopPropagation(), s("select", t.node);
|
|
3389
|
+
}, p = (f) => {
|
|
3390
|
+
f.stopPropagation(), s("delete", t.node);
|
|
3391
|
+
}, m = (f) => f.type === "Mesh" || f.type === "Sprite" ? "🟦" : f.type === "Light" ? "💡" : "📦", b = (f) => f.name || `${f.type} (${f.id})`;
|
|
3392
|
+
return (f, y) => {
|
|
3393
|
+
const d = En("TreeItem", !0);
|
|
3394
|
+
return N(), U("div", {
|
|
3379
3395
|
class: "tree-node",
|
|
3380
3396
|
ref_key: "nodeRef",
|
|
3381
3397
|
ref: n
|
|
3382
3398
|
}, [
|
|
3383
3399
|
g("div", {
|
|
3384
|
-
class:
|
|
3400
|
+
class: Fe(["tree-item", { selected: u.value }]),
|
|
3385
3401
|
onClick: c
|
|
3386
3402
|
}, [
|
|
3387
|
-
l.value ? (
|
|
3403
|
+
l.value ? (N(), U("span", {
|
|
3388
3404
|
key: 0,
|
|
3389
3405
|
class: "toggle-icon",
|
|
3390
|
-
onClick: y[0] || (y[0] =
|
|
3391
|
-
},
|
|
3392
|
-
g("span", Ki,
|
|
3393
|
-
g("span", Vi,
|
|
3406
|
+
onClick: y[0] || (y[0] = At((_) => Mn(o)(r.node.uuid), ["stop"]))
|
|
3407
|
+
}, Ee(a.value ? "▼" : "▶"), 1)) : (N(), U("span", Bi)),
|
|
3408
|
+
g("span", Ki, Ee(m(r.node)), 1),
|
|
3409
|
+
g("span", Vi, Ee(b(r.node)), 1),
|
|
3394
3410
|
g("button", {
|
|
3395
3411
|
class: "tree-delete",
|
|
3396
|
-
onClick:
|
|
3412
|
+
onClick: At(p, ["stop"])
|
|
3397
3413
|
}, "×")
|
|
3398
3414
|
], 2),
|
|
3399
|
-
a.value && l.value ? (
|
|
3400
|
-
(
|
|
3401
|
-
key:
|
|
3402
|
-
node:
|
|
3415
|
+
a.value && l.value ? (N(), U("div", Zi, [
|
|
3416
|
+
(N(!0), U(en, null, tn(h.value, (_) => (N(), ot(d, {
|
|
3417
|
+
key: _.uuid,
|
|
3418
|
+
node: _,
|
|
3403
3419
|
"selected-object": r.selectedObject,
|
|
3404
3420
|
version: r.version,
|
|
3405
|
-
onSelect: y[1] || (y[1] = (
|
|
3406
|
-
onDelete: y[2] || (y[2] = (
|
|
3421
|
+
onSelect: y[1] || (y[1] = (x) => s("select", x)),
|
|
3422
|
+
onDelete: y[2] || (y[2] = (x) => s("delete", x))
|
|
3407
3423
|
}, null, 8, ["node", "selected-object", "version"]))), 128))
|
|
3408
|
-
])) :
|
|
3424
|
+
])) : de("", !0)
|
|
3409
3425
|
], 512);
|
|
3410
3426
|
};
|
|
3411
3427
|
}
|
|
3412
|
-
}),
|
|
3428
|
+
}), Xe = (r, e) => {
|
|
3413
3429
|
const t = r.__vccOpts || r;
|
|
3414
3430
|
for (const [s, n] of e)
|
|
3415
3431
|
t[s] = n;
|
|
3416
3432
|
return t;
|
|
3417
|
-
}, qi = /* @__PURE__ */
|
|
3433
|
+
}, qi = /* @__PURE__ */ Xe(Qi, [["__scopeId", "data-v-5ad9c842"]]);
|
|
3418
3434
|
function Wi(r) {
|
|
3419
|
-
const e =
|
|
3435
|
+
const e = G(/* @__PURE__ */ new Set()), t = (n) => {
|
|
3420
3436
|
const i = new Set(e.value);
|
|
3421
3437
|
i.has(n) ? i.delete(n) : i.add(n), e.value = i;
|
|
3422
3438
|
}, s = (n) => {
|
|
@@ -3427,7 +3443,7 @@ function Wi(r) {
|
|
|
3427
3443
|
i.add(o.uuid), o = o.parent;
|
|
3428
3444
|
e.value = i;
|
|
3429
3445
|
};
|
|
3430
|
-
return
|
|
3446
|
+
return nn(
|
|
3431
3447
|
r,
|
|
3432
3448
|
(n) => {
|
|
3433
3449
|
n && s(n);
|
|
@@ -3441,10 +3457,22 @@ const $i = {
|
|
|
3441
3457
|
}, Ji = { class: "property-group tree-group" }, eo = { class: "tree-container" }, to = {
|
|
3442
3458
|
key: 0,
|
|
3443
3459
|
class: "tree-empty"
|
|
3444
|
-
}, no = {
|
|
3460
|
+
}, no = {
|
|
3461
|
+
key: 0,
|
|
3462
|
+
class: "tabs"
|
|
3463
|
+
}, so = {
|
|
3464
|
+
key: 1,
|
|
3465
|
+
class: "tab-content"
|
|
3466
|
+
}, io = { class: "property-group" }, oo = { class: "row" }, ro = { class: "property-group" }, ao = { class: "row" }, lo = { class: "property-group" }, co = { class: "row" }, ho = {
|
|
3467
|
+
key: 0,
|
|
3468
|
+
class: "property-group material-group"
|
|
3469
|
+
}, uo = { class: "slider-row" }, po = { class: "slider-value" }, fo = { class: "slider-row" }, mo = { class: "slider-value" }, go = { class: "slider-row" }, yo = { class: "slider-value" }, _o = {
|
|
3470
|
+
key: 0,
|
|
3471
|
+
class: "material-hint"
|
|
3472
|
+
}, bo = {
|
|
3445
3473
|
key: 1,
|
|
3446
3474
|
class: "property-panel empty"
|
|
3447
|
-
},
|
|
3475
|
+
}, wo = /* @__PURE__ */ Ge({
|
|
3448
3476
|
__name: "PropertyPanel",
|
|
3449
3477
|
props: {
|
|
3450
3478
|
transform: {},
|
|
@@ -3453,330 +3481,463 @@ const $i = {
|
|
|
3453
3481
|
},
|
|
3454
3482
|
emits: ["propertyChange", "treeSelect", "treeDelete"],
|
|
3455
3483
|
setup(r, { emit: e }) {
|
|
3456
|
-
const t = r, s = e, n = () => s("propertyChange"), i =
|
|
3457
|
-
|
|
3458
|
-
const
|
|
3459
|
-
|
|
3460
|
-
}
|
|
3461
|
-
|
|
3462
|
-
|
|
3484
|
+
const t = r, s = e, n = () => s("propertyChange"), i = G("transform"), o = G(0), a = vn(t, "selectedObject"), { expandedSet: l, toggleExpand: h } = Wi(a);
|
|
3485
|
+
Sn("treeExpand", { expandedSet: l, toggleExpand: h });
|
|
3486
|
+
const u = (y) => {
|
|
3487
|
+
o.value++, s("treeDelete", y);
|
|
3488
|
+
}, c = sn({
|
|
3489
|
+
metalness: 0,
|
|
3490
|
+
roughness: 0.5,
|
|
3491
|
+
opacity: 1
|
|
3492
|
+
}), p = G(!1);
|
|
3493
|
+
function m(y) {
|
|
3494
|
+
let d = null;
|
|
3495
|
+
return y.traverse((_) => {
|
|
3496
|
+
if (_.type === "Mesh" && !d) {
|
|
3497
|
+
const x = _, S = Array.isArray(x.material) ? x.material : [x.material];
|
|
3498
|
+
for (const A of S)
|
|
3499
|
+
if (A && (A.type === "MeshStandardMaterial" || A.type === "MeshPhongMaterial")) {
|
|
3500
|
+
const v = A;
|
|
3501
|
+
d = {
|
|
3502
|
+
metalness: v.metalness ?? 0,
|
|
3503
|
+
roughness: v.roughness ?? 0.5,
|
|
3504
|
+
opacity: A.opacity ?? 1
|
|
3505
|
+
};
|
|
3506
|
+
break;
|
|
3507
|
+
}
|
|
3508
|
+
}
|
|
3509
|
+
}), d;
|
|
3510
|
+
}
|
|
3511
|
+
function b(y, d) {
|
|
3512
|
+
let _ = !1;
|
|
3513
|
+
return y.traverse((x) => {
|
|
3514
|
+
if (x.type === "Mesh") {
|
|
3515
|
+
const S = x, A = Array.isArray(S.material) ? S.material : [S.material];
|
|
3516
|
+
for (const v of A)
|
|
3517
|
+
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);
|
|
3518
|
+
}
|
|
3519
|
+
}), _;
|
|
3520
|
+
}
|
|
3521
|
+
function f() {
|
|
3522
|
+
if (t.selectedObject) {
|
|
3523
|
+
const y = b(t.selectedObject, {
|
|
3524
|
+
metalness: c.metalness,
|
|
3525
|
+
roughness: c.roughness,
|
|
3526
|
+
opacity: c.opacity
|
|
3527
|
+
});
|
|
3528
|
+
p.value = y;
|
|
3529
|
+
}
|
|
3530
|
+
}
|
|
3531
|
+
return nn(
|
|
3532
|
+
() => t.selectedObject,
|
|
3533
|
+
(y) => {
|
|
3534
|
+
if (y) {
|
|
3535
|
+
const d = m(y);
|
|
3536
|
+
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);
|
|
3537
|
+
} else
|
|
3538
|
+
c.metalness = 0, c.roughness = 0.5, c.opacity = 1, p.value = !1;
|
|
3539
|
+
},
|
|
3540
|
+
{ immediate: !0 }
|
|
3541
|
+
), (y, d) => r.transform ? (N(), U("div", $i, [
|
|
3542
|
+
d[32] || (d[32] = g("h3", null, "属性面板", -1)),
|
|
3463
3543
|
g("div", Ji, [
|
|
3464
|
-
|
|
3544
|
+
d[15] || (d[15] = g("label", null, "场景物体", -1)),
|
|
3465
3545
|
g("div", eo, [
|
|
3466
|
-
(
|
|
3467
|
-
key:
|
|
3468
|
-
node:
|
|
3546
|
+
(N(!0), U(en, null, tn(r.treeData, (_) => (N(), ot(qi, {
|
|
3547
|
+
key: _.uuid,
|
|
3548
|
+
node: _,
|
|
3469
3549
|
"selected-object": r.selectedObject,
|
|
3470
|
-
version:
|
|
3471
|
-
onSelect:
|
|
3472
|
-
onDelete:
|
|
3550
|
+
version: o.value,
|
|
3551
|
+
onSelect: d[0] || (d[0] = (x) => s("treeSelect", x)),
|
|
3552
|
+
onDelete: u
|
|
3473
3553
|
}, null, 8, ["node", "selected-object", "version"]))), 128)),
|
|
3474
|
-
r.treeData.length === 0 ? (
|
|
3554
|
+
r.treeData.length === 0 ? (N(), U("div", to, "暂无物体")) : de("", !0)
|
|
3475
3555
|
])
|
|
3476
3556
|
]),
|
|
3477
|
-
g("div",
|
|
3478
|
-
|
|
3479
|
-
g("div",
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
]
|
|
3540
|
-
]),
|
|
3541
|
-
c[16] || (c[16] = g("span", null, "Y:", -1)),
|
|
3542
|
-
H(g("input", {
|
|
3543
|
-
type: "number",
|
|
3544
|
-
"onUpdate:modelValue": c[5] || (c[5] = (d) => r.transform.rotation.y = d),
|
|
3545
|
-
step: "0.01",
|
|
3546
|
-
onInput: n
|
|
3547
|
-
}, null, 544), [
|
|
3548
|
-
[
|
|
3549
|
-
oe,
|
|
3550
|
-
r.transform.rotation.y,
|
|
3551
|
-
void 0,
|
|
3552
|
-
{ number: !0 }
|
|
3553
|
-
]
|
|
3557
|
+
d[33] || (d[33] = g("div", { class: "property-group" }, [
|
|
3558
|
+
g("label", null, "全局属性"),
|
|
3559
|
+
g("div", { class: "row" })
|
|
3560
|
+
], -1)),
|
|
3561
|
+
r.selectedObject ? (N(), U("div", no, [
|
|
3562
|
+
g("button", {
|
|
3563
|
+
class: Fe(["tab-btn", { active: i.value === "transform" }]),
|
|
3564
|
+
onClick: d[1] || (d[1] = (_) => i.value = "transform")
|
|
3565
|
+
}, " 🔄 变换 ", 2),
|
|
3566
|
+
g("button", {
|
|
3567
|
+
class: Fe(["tab-btn", { active: i.value === "info" }]),
|
|
3568
|
+
onClick: d[2] || (d[2] = (_) => i.value = "info")
|
|
3569
|
+
}, " ℹ️ 信息 ", 2)
|
|
3570
|
+
])) : de("", !0),
|
|
3571
|
+
r.selectedObject ? (N(), U("div", so, [
|
|
3572
|
+
D(g("div", null, [
|
|
3573
|
+
g("div", io, [
|
|
3574
|
+
d[19] || (d[19] = g("label", null, "位置", -1)),
|
|
3575
|
+
g("div", oo, [
|
|
3576
|
+
d[16] || (d[16] = g("span", null, "X:", -1)),
|
|
3577
|
+
D(g("input", {
|
|
3578
|
+
type: "number",
|
|
3579
|
+
"onUpdate:modelValue": d[3] || (d[3] = (_) => r.transform.position.x = _),
|
|
3580
|
+
step: "0.01",
|
|
3581
|
+
onInput: n
|
|
3582
|
+
}, null, 544), [
|
|
3583
|
+
[
|
|
3584
|
+
Q,
|
|
3585
|
+
r.transform.position.x,
|
|
3586
|
+
void 0,
|
|
3587
|
+
{ number: !0 }
|
|
3588
|
+
]
|
|
3589
|
+
]),
|
|
3590
|
+
d[17] || (d[17] = g("span", null, "Y:", -1)),
|
|
3591
|
+
D(g("input", {
|
|
3592
|
+
type: "number",
|
|
3593
|
+
"onUpdate:modelValue": d[4] || (d[4] = (_) => r.transform.position.y = _),
|
|
3594
|
+
step: "0.01",
|
|
3595
|
+
onInput: n
|
|
3596
|
+
}, null, 544), [
|
|
3597
|
+
[
|
|
3598
|
+
Q,
|
|
3599
|
+
r.transform.position.y,
|
|
3600
|
+
void 0,
|
|
3601
|
+
{ number: !0 }
|
|
3602
|
+
]
|
|
3603
|
+
]),
|
|
3604
|
+
d[18] || (d[18] = g("span", null, "Z:", -1)),
|
|
3605
|
+
D(g("input", {
|
|
3606
|
+
type: "number",
|
|
3607
|
+
"onUpdate:modelValue": d[5] || (d[5] = (_) => r.transform.position.z = _),
|
|
3608
|
+
step: "0.01",
|
|
3609
|
+
onInput: n
|
|
3610
|
+
}, null, 544), [
|
|
3611
|
+
[
|
|
3612
|
+
Q,
|
|
3613
|
+
r.transform.position.z,
|
|
3614
|
+
void 0,
|
|
3615
|
+
{ number: !0 }
|
|
3616
|
+
]
|
|
3617
|
+
])
|
|
3618
|
+
])
|
|
3554
3619
|
]),
|
|
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
|
-
|
|
3620
|
+
g("div", ro, [
|
|
3621
|
+
d[23] || (d[23] = g("label", null, "旋转 (弧度)", -1)),
|
|
3622
|
+
g("div", ao, [
|
|
3623
|
+
d[20] || (d[20] = g("span", null, "X:", -1)),
|
|
3624
|
+
D(g("input", {
|
|
3625
|
+
type: "number",
|
|
3626
|
+
"onUpdate:modelValue": d[6] || (d[6] = (_) => r.transform.rotation.x = _),
|
|
3627
|
+
step: "0.01",
|
|
3628
|
+
onInput: n
|
|
3629
|
+
}, null, 544), [
|
|
3630
|
+
[
|
|
3631
|
+
Q,
|
|
3632
|
+
r.transform.rotation.x,
|
|
3633
|
+
void 0,
|
|
3634
|
+
{ number: !0 }
|
|
3635
|
+
]
|
|
3636
|
+
]),
|
|
3637
|
+
d[21] || (d[21] = g("span", null, "Y:", -1)),
|
|
3638
|
+
D(g("input", {
|
|
3639
|
+
type: "number",
|
|
3640
|
+
"onUpdate:modelValue": d[7] || (d[7] = (_) => r.transform.rotation.y = _),
|
|
3641
|
+
step: "0.01",
|
|
3642
|
+
onInput: n
|
|
3643
|
+
}, null, 544), [
|
|
3644
|
+
[
|
|
3645
|
+
Q,
|
|
3646
|
+
r.transform.rotation.y,
|
|
3647
|
+
void 0,
|
|
3648
|
+
{ number: !0 }
|
|
3649
|
+
]
|
|
3650
|
+
]),
|
|
3651
|
+
d[22] || (d[22] = g("span", null, "Z:", -1)),
|
|
3652
|
+
D(g("input", {
|
|
3653
|
+
type: "number",
|
|
3654
|
+
"onUpdate:modelValue": d[8] || (d[8] = (_) => r.transform.rotation.z = _),
|
|
3655
|
+
step: "0.01",
|
|
3656
|
+
onInput: n
|
|
3657
|
+
}, null, 544), [
|
|
3658
|
+
[
|
|
3659
|
+
Q,
|
|
3660
|
+
r.transform.rotation.z,
|
|
3661
|
+
void 0,
|
|
3662
|
+
{ number: !0 }
|
|
3663
|
+
]
|
|
3664
|
+
])
|
|
3665
|
+
])
|
|
3587
3666
|
]),
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3667
|
+
g("div", lo, [
|
|
3668
|
+
d[27] || (d[27] = g("label", null, "缩放", -1)),
|
|
3669
|
+
g("div", co, [
|
|
3670
|
+
d[24] || (d[24] = g("span", null, "X:", -1)),
|
|
3671
|
+
D(g("input", {
|
|
3672
|
+
type: "number",
|
|
3673
|
+
"onUpdate:modelValue": d[9] || (d[9] = (_) => r.transform.scale.x = _),
|
|
3674
|
+
step: "0.01",
|
|
3675
|
+
onInput: n
|
|
3676
|
+
}, null, 544), [
|
|
3677
|
+
[
|
|
3678
|
+
Q,
|
|
3679
|
+
r.transform.scale.x,
|
|
3680
|
+
void 0,
|
|
3681
|
+
{ number: !0 }
|
|
3682
|
+
]
|
|
3683
|
+
]),
|
|
3684
|
+
d[25] || (d[25] = g("span", null, "Y:", -1)),
|
|
3685
|
+
D(g("input", {
|
|
3686
|
+
type: "number",
|
|
3687
|
+
"onUpdate:modelValue": d[10] || (d[10] = (_) => r.transform.scale.y = _),
|
|
3688
|
+
step: "0.01",
|
|
3689
|
+
onInput: n
|
|
3690
|
+
}, null, 544), [
|
|
3691
|
+
[
|
|
3692
|
+
Q,
|
|
3693
|
+
r.transform.scale.y,
|
|
3694
|
+
void 0,
|
|
3695
|
+
{ number: !0 }
|
|
3696
|
+
]
|
|
3697
|
+
]),
|
|
3698
|
+
d[26] || (d[26] = g("span", null, "Z:", -1)),
|
|
3699
|
+
D(g("input", {
|
|
3700
|
+
type: "number",
|
|
3701
|
+
"onUpdate:modelValue": d[11] || (d[11] = (_) => r.transform.scale.z = _),
|
|
3702
|
+
step: "0.01",
|
|
3703
|
+
onInput: n
|
|
3704
|
+
}, null, 544), [
|
|
3705
|
+
[
|
|
3706
|
+
Q,
|
|
3707
|
+
r.transform.scale.z,
|
|
3708
|
+
void 0,
|
|
3709
|
+
{ number: !0 }
|
|
3710
|
+
]
|
|
3711
|
+
])
|
|
3712
|
+
])
|
|
3601
3713
|
]),
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3714
|
+
r.selectedObject ? (N(), U("div", ho, [
|
|
3715
|
+
d[31] || (d[31] = g("label", null, "材质", -1)),
|
|
3716
|
+
g("div", uo, [
|
|
3717
|
+
d[28] || (d[28] = g("span", { class: "slider-label" }, "金属度", -1)),
|
|
3718
|
+
D(g("input", {
|
|
3719
|
+
type: "range",
|
|
3720
|
+
min: "0",
|
|
3721
|
+
max: "1",
|
|
3722
|
+
step: "0.01",
|
|
3723
|
+
"onUpdate:modelValue": d[12] || (d[12] = (_) => c.metalness = _),
|
|
3724
|
+
onInput: f
|
|
3725
|
+
}, null, 544), [
|
|
3726
|
+
[
|
|
3727
|
+
Q,
|
|
3728
|
+
c.metalness,
|
|
3729
|
+
void 0,
|
|
3730
|
+
{ number: !0 }
|
|
3731
|
+
]
|
|
3732
|
+
]),
|
|
3733
|
+
g("span", po, Ee(c.metalness.toFixed(2)), 1)
|
|
3734
|
+
]),
|
|
3735
|
+
g("div", fo, [
|
|
3736
|
+
d[29] || (d[29] = g("span", { class: "slider-label" }, "粗糙度", -1)),
|
|
3737
|
+
D(g("input", {
|
|
3738
|
+
type: "range",
|
|
3739
|
+
min: "0",
|
|
3740
|
+
max: "1",
|
|
3741
|
+
step: "0.01",
|
|
3742
|
+
"onUpdate:modelValue": d[13] || (d[13] = (_) => c.roughness = _),
|
|
3743
|
+
onInput: f
|
|
3744
|
+
}, null, 544), [
|
|
3745
|
+
[
|
|
3746
|
+
Q,
|
|
3747
|
+
c.roughness,
|
|
3748
|
+
void 0,
|
|
3749
|
+
{ number: !0 }
|
|
3750
|
+
]
|
|
3751
|
+
]),
|
|
3752
|
+
g("span", mo, Ee(c.roughness.toFixed(2)), 1)
|
|
3753
|
+
]),
|
|
3754
|
+
g("div", go, [
|
|
3755
|
+
d[30] || (d[30] = g("span", { class: "slider-label" }, "透明度", -1)),
|
|
3756
|
+
D(g("input", {
|
|
3757
|
+
type: "range",
|
|
3758
|
+
min: "0",
|
|
3759
|
+
max: "1",
|
|
3760
|
+
step: "0.01",
|
|
3761
|
+
"onUpdate:modelValue": d[14] || (d[14] = (_) => c.opacity = _),
|
|
3762
|
+
onInput: f
|
|
3763
|
+
}, null, 544), [
|
|
3764
|
+
[
|
|
3765
|
+
Q,
|
|
3766
|
+
c.opacity,
|
|
3767
|
+
void 0,
|
|
3768
|
+
{ number: !0 }
|
|
3769
|
+
]
|
|
3770
|
+
]),
|
|
3771
|
+
g("span", yo, Ee(c.opacity.toFixed(2)), 1)
|
|
3772
|
+
]),
|
|
3773
|
+
p.value ? de("", !0) : (N(), U("div", _o, " ⚠️ 当前材质不支持金属度/粗糙度(仅支持 Standard/Phong) "))
|
|
3774
|
+
])) : de("", !0)
|
|
3775
|
+
], 512), [
|
|
3776
|
+
[he, i.value === "transform"]
|
|
3616
3777
|
])
|
|
3617
|
-
])
|
|
3618
|
-
])) : (
|
|
3778
|
+
])) : de("", !0)
|
|
3779
|
+
])) : (N(), U("div", bo, [...d[34] || (d[34] = [
|
|
3619
3780
|
g("p", null, "未选中任何模型", -1)
|
|
3620
3781
|
])]));
|
|
3621
3782
|
}
|
|
3622
|
-
}),
|
|
3783
|
+
}), To = /* @__PURE__ */ Xe(wo, [["__scopeId", "data-v-d75c643f"]]), xo = { class: "top-bar" }, Eo = { class: "left-section" }, Mo = { class: "dropdown-menu" }, vo = { class: "dropdown-menu sub-menu" }, So = { class: "dropdown-menu" }, Ro = { class: "dropdown-menu sub-menu" }, Ao = { class: "dropdown-menu" }, Po = { class: "dropdown-menu" }, Lo = { class: "dropdown-menu" }, Io = /* @__PURE__ */ Ge({
|
|
3623
3784
|
__name: "TopBar",
|
|
3624
3785
|
emits: ["addModel", "importModel"],
|
|
3625
3786
|
setup(r, { emit: e }) {
|
|
3626
|
-
const t =
|
|
3627
|
-
var
|
|
3628
|
-
return (
|
|
3629
|
-
},
|
|
3630
|
-
const
|
|
3631
|
-
|
|
3632
|
-
},
|
|
3633
|
-
return (
|
|
3634
|
-
g("div",
|
|
3787
|
+
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 = () => {
|
|
3788
|
+
var $;
|
|
3789
|
+
return ($ = u.value) == null ? void 0 : $.click();
|
|
3790
|
+
}, p = ($) => {
|
|
3791
|
+
const E = $.target;
|
|
3792
|
+
E.files && E.files.length > 0 && (h("importModel", E.files[0]), E.value = "");
|
|
3793
|
+
}, 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("打开场景");
|
|
3794
|
+
return ($, E) => (N(), U("div", xo, [
|
|
3795
|
+
g("div", Eo, [
|
|
3635
3796
|
g("div", {
|
|
3636
3797
|
class: "dropdown-wrapper",
|
|
3637
|
-
onMouseenter:
|
|
3638
|
-
onMouseleave:
|
|
3798
|
+
onMouseenter: E[2] || (E[2] = (H) => t.value = !0),
|
|
3799
|
+
onMouseleave: E[3] || (E[3] = (H) => t.value = !1)
|
|
3639
3800
|
}, [
|
|
3640
|
-
|
|
3641
|
-
|
|
3801
|
+
E[17] || (E[17] = g("button", { class: "menu-btn" }, "文件", -1)),
|
|
3802
|
+
D(g("div", Mo, [
|
|
3642
3803
|
g("div", {
|
|
3643
3804
|
class: "menu-item",
|
|
3644
|
-
onClick:
|
|
3805
|
+
onClick: m
|
|
3645
3806
|
}, "新建"),
|
|
3646
3807
|
g("div", {
|
|
3647
3808
|
class: "menu-item dropdown-wrapper sub-trigger",
|
|
3648
|
-
onMouseenter:
|
|
3649
|
-
onMouseleave:
|
|
3809
|
+
onMouseenter: E[0] || (E[0] = (H) => a.value = !0),
|
|
3810
|
+
onMouseleave: E[1] || (E[1] = (H) => a.value = !1)
|
|
3650
3811
|
}, [
|
|
3651
|
-
|
|
3652
|
-
|
|
3812
|
+
E[16] || (E[16] = g("span", null, "打开", -1)),
|
|
3813
|
+
D(g("div", vo, [
|
|
3653
3814
|
g("div", {
|
|
3654
3815
|
class: "menu-item",
|
|
3655
|
-
onClick:
|
|
3816
|
+
onClick: ie
|
|
3656
3817
|
}, "打开项目"),
|
|
3657
3818
|
g("div", {
|
|
3658
3819
|
class: "menu-item",
|
|
3659
|
-
onClick:
|
|
3820
|
+
onClick: ee
|
|
3660
3821
|
}, "打开模型"),
|
|
3661
3822
|
g("div", {
|
|
3662
3823
|
class: "menu-item",
|
|
3663
|
-
onClick:
|
|
3824
|
+
onClick: fe
|
|
3664
3825
|
}, "打开场景")
|
|
3665
3826
|
], 512), [
|
|
3666
|
-
[
|
|
3827
|
+
[he, a.value]
|
|
3667
3828
|
])
|
|
3668
3829
|
], 32),
|
|
3669
3830
|
g("div", {
|
|
3670
3831
|
class: "menu-item",
|
|
3671
|
-
onClick:
|
|
3832
|
+
onClick: b
|
|
3672
3833
|
}, "保存"),
|
|
3673
3834
|
g("div", {
|
|
3674
3835
|
class: "menu-item",
|
|
3675
|
-
onClick:
|
|
3836
|
+
onClick: f
|
|
3676
3837
|
}, "导出")
|
|
3677
3838
|
], 512), [
|
|
3678
|
-
[
|
|
3839
|
+
[he, t.value]
|
|
3679
3840
|
])
|
|
3680
3841
|
], 32),
|
|
3681
3842
|
g("div", {
|
|
3682
3843
|
class: "dropdown-wrapper",
|
|
3683
|
-
onMouseenter:
|
|
3684
|
-
onMouseleave:
|
|
3844
|
+
onMouseenter: E[8] || (E[8] = (H) => o.value = !0),
|
|
3845
|
+
onMouseleave: E[9] || (E[9] = (H) => o.value = !1)
|
|
3685
3846
|
}, [
|
|
3686
|
-
|
|
3687
|
-
|
|
3847
|
+
E[19] || (E[19] = g("button", { class: "menu-btn" }, "添加", -1)),
|
|
3848
|
+
D(g("div", So, [
|
|
3688
3849
|
g("div", {
|
|
3689
3850
|
class: "menu-item",
|
|
3690
3851
|
onClick: y
|
|
3691
3852
|
}, "组"),
|
|
3692
3853
|
g("div", {
|
|
3693
3854
|
class: "menu-item dropdown-wrapper sub-trigger",
|
|
3694
|
-
onMouseenter:
|
|
3695
|
-
onMouseleave:
|
|
3855
|
+
onMouseenter: E[6] || (E[6] = (H) => l.value = !0),
|
|
3856
|
+
onMouseleave: E[7] || (E[7] = (H) => l.value = !1)
|
|
3696
3857
|
}, [
|
|
3697
|
-
|
|
3698
|
-
|
|
3858
|
+
E[18] || (E[18] = g("span", null, "网格", -1)),
|
|
3859
|
+
D(g("div", Ro, [
|
|
3699
3860
|
g("div", {
|
|
3700
3861
|
class: "menu-item",
|
|
3701
|
-
onClick:
|
|
3862
|
+
onClick: E[4] || (E[4] = (H) => h("addModel", "box"))
|
|
3702
3863
|
}, " 正方体 "),
|
|
3703
3864
|
g("div", {
|
|
3704
3865
|
class: "menu-item",
|
|
3705
|
-
onClick:
|
|
3866
|
+
onClick: E[5] || (E[5] = (H) => h("addModel", "sphere"))
|
|
3706
3867
|
}, " 球体 "),
|
|
3707
3868
|
g("div", {
|
|
3708
3869
|
class: "menu-item",
|
|
3709
3870
|
onClick: c
|
|
3710
3871
|
}, "导入")
|
|
3711
3872
|
], 512), [
|
|
3712
|
-
[
|
|
3873
|
+
[he, l.value]
|
|
3713
3874
|
])
|
|
3714
3875
|
], 32),
|
|
3715
3876
|
g("div", {
|
|
3716
3877
|
class: "menu-item",
|
|
3717
|
-
onClick:
|
|
3878
|
+
onClick: _
|
|
3718
3879
|
}, "光源"),
|
|
3719
3880
|
g("div", {
|
|
3720
3881
|
class: "menu-item",
|
|
3721
|
-
onClick:
|
|
3882
|
+
onClick: x
|
|
3722
3883
|
}, "摄像机")
|
|
3723
3884
|
], 512), [
|
|
3724
|
-
[
|
|
3885
|
+
[he, o.value]
|
|
3725
3886
|
])
|
|
3726
3887
|
], 32),
|
|
3727
3888
|
g("div", {
|
|
3728
3889
|
class: "dropdown-wrapper",
|
|
3729
|
-
onMouseenter:
|
|
3730
|
-
onMouseleave:
|
|
3890
|
+
onMouseenter: E[10] || (E[10] = (H) => s.value = !0),
|
|
3891
|
+
onMouseleave: E[11] || (E[11] = (H) => s.value = !1)
|
|
3731
3892
|
}, [
|
|
3732
|
-
|
|
3733
|
-
|
|
3893
|
+
E[20] || (E[20] = g("button", { class: "menu-btn" }, "编辑", -1)),
|
|
3894
|
+
D(g("div", Ao, [
|
|
3734
3895
|
g("div", {
|
|
3735
3896
|
class: "menu-item",
|
|
3736
3897
|
onClick: y
|
|
3737
3898
|
}, "撤销"),
|
|
3738
3899
|
g("div", {
|
|
3739
3900
|
class: "menu-item",
|
|
3740
|
-
onClick:
|
|
3901
|
+
onClick: d
|
|
3741
3902
|
}, "重做"),
|
|
3742
3903
|
g("div", {
|
|
3743
3904
|
class: "menu-item",
|
|
3744
|
-
onClick:
|
|
3905
|
+
onClick: _
|
|
3745
3906
|
}, "复制"),
|
|
3746
3907
|
g("div", {
|
|
3747
3908
|
class: "menu-item",
|
|
3748
|
-
onClick:
|
|
3909
|
+
onClick: x
|
|
3749
3910
|
}, "删除")
|
|
3750
3911
|
], 512), [
|
|
3751
|
-
[
|
|
3912
|
+
[he, s.value]
|
|
3752
3913
|
])
|
|
3753
3914
|
], 32),
|
|
3754
3915
|
g("div", {
|
|
3755
3916
|
class: "dropdown-wrapper",
|
|
3756
|
-
onMouseenter:
|
|
3757
|
-
onMouseleave:
|
|
3917
|
+
onMouseenter: E[12] || (E[12] = (H) => n.value = !0),
|
|
3918
|
+
onMouseleave: E[13] || (E[13] = (H) => n.value = !1)
|
|
3758
3919
|
}, [
|
|
3759
|
-
|
|
3760
|
-
|
|
3920
|
+
E[21] || (E[21] = g("button", { class: "menu-btn" }, "视图", -1)),
|
|
3921
|
+
D(g("div", Po, [
|
|
3761
3922
|
g("div", {
|
|
3762
3923
|
class: "menu-item",
|
|
3763
3924
|
onClick: S
|
|
3764
3925
|
}, "重置相机"),
|
|
3765
3926
|
g("div", {
|
|
3766
3927
|
class: "menu-item",
|
|
3767
|
-
onClick:
|
|
3928
|
+
onClick: A
|
|
3768
3929
|
}, "显示网格")
|
|
3769
3930
|
], 512), [
|
|
3770
|
-
[
|
|
3931
|
+
[he, n.value]
|
|
3771
3932
|
])
|
|
3772
3933
|
], 32),
|
|
3773
3934
|
g("div", {
|
|
3774
3935
|
class: "dropdown-wrapper",
|
|
3775
|
-
onMouseenter:
|
|
3776
|
-
onMouseleave:
|
|
3936
|
+
onMouseenter: E[14] || (E[14] = (H) => i.value = !0),
|
|
3937
|
+
onMouseleave: E[15] || (E[15] = (H) => i.value = !1)
|
|
3777
3938
|
}, [
|
|
3778
|
-
|
|
3779
|
-
|
|
3939
|
+
E[22] || (E[22] = g("button", { class: "menu-btn" }, "帮助", -1)),
|
|
3940
|
+
D(g("div", Lo, [
|
|
3780
3941
|
g("div", {
|
|
3781
3942
|
class: "menu-item",
|
|
3782
3943
|
onClick: v
|
|
@@ -3786,11 +3947,11 @@ const $i = {
|
|
|
3786
3947
|
onClick: I
|
|
3787
3948
|
}, "关于")
|
|
3788
3949
|
], 512), [
|
|
3789
|
-
[
|
|
3950
|
+
[he, i.value]
|
|
3790
3951
|
])
|
|
3791
3952
|
], 32)
|
|
3792
3953
|
]),
|
|
3793
|
-
|
|
3954
|
+
E[23] || (E[23] = g("div", { class: "right-section" }, [
|
|
3794
3955
|
g("span", { class: "app-title" }, "3D 模型编辑器")
|
|
3795
3956
|
], -1)),
|
|
3796
3957
|
g("input", {
|
|
@@ -3799,14 +3960,14 @@ const $i = {
|
|
|
3799
3960
|
ref: u,
|
|
3800
3961
|
accept: ".obj,.gltf,.glb",
|
|
3801
3962
|
style: { display: "none" },
|
|
3802
|
-
onChange:
|
|
3963
|
+
onChange: p
|
|
3803
3964
|
}, null, 544)
|
|
3804
3965
|
]));
|
|
3805
3966
|
}
|
|
3806
|
-
}),
|
|
3967
|
+
}), Oo = /* @__PURE__ */ Xe(Io, [["__scopeId", "data-v-6bb4762f"]]), Co = { class: "bottom-bar" }, Do = /* @__PURE__ */ Ge({
|
|
3807
3968
|
__name: "BottomBar",
|
|
3808
3969
|
setup(r) {
|
|
3809
|
-
return (e, t) => (
|
|
3970
|
+
return (e, t) => (N(), U("div", Co, [...t[0] || (t[0] = [
|
|
3810
3971
|
g("div", { class: "status-left" }, [
|
|
3811
3972
|
g("span", null, "就绪")
|
|
3812
3973
|
], -1),
|
|
@@ -3815,93 +3976,102 @@ const $i = {
|
|
|
3815
3976
|
], -1)
|
|
3816
3977
|
])]));
|
|
3817
3978
|
}
|
|
3818
|
-
}),
|
|
3979
|
+
}), No = /* @__PURE__ */ Xe(Do, [["__scopeId", "data-v-3427bb27"]]), ko = { class: "app-layout" }, jo = /* @__PURE__ */ Ge({
|
|
3819
3980
|
__name: "DrawingBoard",
|
|
3981
|
+
props: {
|
|
3982
|
+
mode: { default: "edit" }
|
|
3983
|
+
},
|
|
3820
3984
|
setup(r) {
|
|
3821
|
-
const e =
|
|
3985
|
+
const e = r, t = G(null), s = sn({
|
|
3822
3986
|
position: { x: 0, y: 0, z: 0 },
|
|
3823
3987
|
rotation: { x: 0, y: 0, z: 0 },
|
|
3824
3988
|
scale: { x: 1, y: 1, z: 1 }
|
|
3825
|
-
}),
|
|
3826
|
-
|
|
3827
|
-
},
|
|
3989
|
+
}), n = (f) => {
|
|
3990
|
+
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));
|
|
3991
|
+
}, i = (f) => {
|
|
3828
3992
|
f.position.set(
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3993
|
+
s.position.x,
|
|
3994
|
+
s.position.y,
|
|
3995
|
+
s.position.z
|
|
3832
3996
|
), f.rotation.set(
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
), f.scale.set(
|
|
3997
|
+
s.rotation.x,
|
|
3998
|
+
s.rotation.y,
|
|
3999
|
+
s.rotation.z
|
|
4000
|
+
), f.scale.set(s.scale.x, s.scale.y, s.scale.z);
|
|
3837
4001
|
};
|
|
3838
4002
|
qs((f) => {
|
|
3839
|
-
|
|
4003
|
+
t.value = f, f && n(f);
|
|
3840
4004
|
}), Ws((f) => {
|
|
3841
|
-
|
|
4005
|
+
n(f);
|
|
3842
4006
|
});
|
|
3843
|
-
const
|
|
3844
|
-
|
|
3845
|
-
},
|
|
4007
|
+
const o = () => {
|
|
4008
|
+
t.value && i(t.value);
|
|
4009
|
+
}, a = (f) => Yi(f), l = async (f) => {
|
|
3846
4010
|
try {
|
|
3847
4011
|
await Xi(f);
|
|
3848
|
-
} catch (
|
|
3849
|
-
console.error("导入失败:",
|
|
4012
|
+
} catch (y) {
|
|
4013
|
+
console.error("导入失败:", y), alert("导入失败:" + y.message);
|
|
3850
4014
|
}
|
|
3851
|
-
},
|
|
4015
|
+
}, h = Rn([]);
|
|
3852
4016
|
$s((f) => {
|
|
3853
|
-
|
|
4017
|
+
h.value = f;
|
|
3854
4018
|
});
|
|
3855
|
-
const
|
|
4019
|
+
const u = () => {
|
|
3856
4020
|
const f = Js();
|
|
3857
|
-
f && (
|
|
3858
|
-
},
|
|
3859
|
-
return
|
|
3860
|
-
|
|
3861
|
-
}), (f,
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
4021
|
+
f && (h.value = f);
|
|
4022
|
+
}, c = (f) => vt(f), p = (f) => Ks(f.uuid), m = G(null);
|
|
4023
|
+
return An(() => {
|
|
4024
|
+
m.value && Ns(m.value, e.mode), u();
|
|
4025
|
+
}), (f, y) => (N(), U("div", ko, [
|
|
4026
|
+
r.mode === "edit" ? (N(), ot(Oo, {
|
|
4027
|
+
key: 0,
|
|
4028
|
+
onAddModel: a,
|
|
4029
|
+
onImportModel: l
|
|
4030
|
+
})) : de("", !0),
|
|
4031
|
+
g("div", {
|
|
4032
|
+
class: Fe(`editor-container editor-container-mode-${r.mode}`)
|
|
4033
|
+
}, [
|
|
3867
4034
|
g("div", {
|
|
3868
|
-
class:
|
|
4035
|
+
class: Fe(`canvas canvas-mode-${r.mode}`),
|
|
3869
4036
|
ref_key: "containerRef",
|
|
3870
|
-
ref:
|
|
3871
|
-
}, null,
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
"
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
4037
|
+
ref: m
|
|
4038
|
+
}, null, 2),
|
|
4039
|
+
r.mode === "edit" ? (N(), ot(To, {
|
|
4040
|
+
key: 0,
|
|
4041
|
+
transform: s,
|
|
4042
|
+
"tree-data": h.value,
|
|
4043
|
+
"selected-object": t.value,
|
|
4044
|
+
onPropertyChange: o,
|
|
4045
|
+
onTreeSelect: c,
|
|
4046
|
+
onTreeDelete: p
|
|
4047
|
+
}, null, 8, ["transform", "tree-data", "selected-object"])) : de("", !0)
|
|
4048
|
+
], 2),
|
|
4049
|
+
Pn(No)
|
|
3882
4050
|
]));
|
|
3883
4051
|
}
|
|
3884
|
-
}),
|
|
4052
|
+
}), Ko = /* @__PURE__ */ Xe(jo, [["__scopeId", "data-v-290e9b49"]]);
|
|
3885
4053
|
export {
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
4054
|
+
No as BottomBar,
|
|
4055
|
+
Ko as DrawingBoard,
|
|
4056
|
+
To as PropertyPanel,
|
|
4057
|
+
Oo as TopBar,
|
|
3890
4058
|
qi as TreeItem,
|
|
3891
4059
|
zi as addBox,
|
|
3892
|
-
|
|
4060
|
+
rt as addModel,
|
|
3893
4061
|
Yi as addModelByType,
|
|
3894
4062
|
Gi as addSphere,
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
4063
|
+
Yo as exportSceneToJSON,
|
|
4064
|
+
Go as getCamera,
|
|
4065
|
+
Xo as getRenderer,
|
|
4066
|
+
zo as getScene,
|
|
3898
4067
|
Js as getSceneObjects,
|
|
3899
4068
|
Xi as importModelFromFile,
|
|
4069
|
+
Bo as importSceneFromJSON,
|
|
3900
4070
|
Ns as initEditor,
|
|
3901
4071
|
$s as onSceneObjectsChangeCallback,
|
|
3902
4072
|
Bs as removeModel,
|
|
3903
4073
|
Ks as removeModelById,
|
|
3904
|
-
|
|
4074
|
+
vt as selectObject,
|
|
3905
4075
|
qs as setSelectedObjectCallback,
|
|
3906
4076
|
Ws as setTransformChangeCallback,
|
|
3907
4077
|
Wi as useTreeExpand
|