@ridp/threejs 1.3.0 → 1.3.2
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/{common-D1_IztgM.js → common-C8KE_lHC.js} +1 -1
- package/dist/{common-C1rNPPkt.cjs → common-lRDriwln.cjs} +1 -1
- package/dist/hooks.cjs +1 -1
- package/dist/hooks.js +1 -1
- package/dist/modelSerialize-BJf_M0Ys.cjs +5 -0
- package/dist/{modelSerialize-5oJb1ka7.js → modelSerialize-BybDeWER.js} +453 -335
- package/dist/threejs.cjs +1 -1
- package/dist/threejs.js +26 -24
- package/dist/useGLTFLoader-C73cebsn.js +2478 -0
- package/dist/useGLTFLoader-Csew3AhP.cjs +2 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +12 -10
- package/package.json +1 -1
- package/readme.md +21 -1
- package/dist/modelSerialize-Ds_2KBaA.cjs +0 -5
- package/dist/useGLTFLoader-2awW2QaH.cjs +0 -4
- package/dist/useGLTFLoader-BBGTGOYm.js +0 -5507
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { Matrix4 as
|
|
1
|
+
import * as M from "three";
|
|
2
|
+
import { Matrix4 as ft, Vector3 as x, Quaternion as nt, Object3D as wt, Controls as Dt, MOUSE as z, TOUCH as F, Spherical as ht, Vector2 as L, Ray as St, Plane as Pt, MathUtils as Tt, CameraHelper as Mt, GridHelper as At, BoxHelper as Rt, Raycaster as xt, AxesHelper as Ot, ArrowHelper as vt, DataTextureLoader as Lt, HalfFloatType as X, FloatType as et, DataUtils as V, LinearSRGBColorSpace as kt, LinearFilter as ct, EquirectangularReflectionMapping as Ct } from "three";
|
|
3
3
|
var K = function() {
|
|
4
4
|
var e = 0, t = document.createElement("div");
|
|
5
5
|
t.style.cssText = "position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000", t.addEventListener("click", function(m) {
|
|
6
|
-
m.preventDefault(),
|
|
6
|
+
m.preventDefault(), s(++e % t.children.length);
|
|
7
7
|
}, !1);
|
|
8
8
|
function i(m) {
|
|
9
9
|
return t.appendChild(m.dom), m;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function s(m) {
|
|
12
12
|
for (var h = 0; h < t.children.length; h++)
|
|
13
13
|
t.children[h].style.display = h === m ? "block" : "none";
|
|
14
14
|
e = m;
|
|
15
15
|
}
|
|
16
|
-
var r = (performance || Date).now(),
|
|
16
|
+
var r = (performance || Date).now(), a = r, n = 0, c = i(new K.Panel("FPS", "#0ff", "#002")), d = i(new K.Panel("MS", "#0f0", "#020"));
|
|
17
17
|
if (self.performance && self.performance.memory)
|
|
18
|
-
var
|
|
19
|
-
return
|
|
18
|
+
var g = i(new K.Panel("MB", "#f08", "#201"));
|
|
19
|
+
return s(0), {
|
|
20
20
|
REVISION: 16,
|
|
21
21
|
dom: t,
|
|
22
22
|
addPanel: i,
|
|
23
|
-
showPanel:
|
|
23
|
+
showPanel: s,
|
|
24
24
|
begin: function() {
|
|
25
25
|
r = (performance || Date).now();
|
|
26
26
|
},
|
|
27
27
|
end: function() {
|
|
28
|
-
|
|
28
|
+
n++;
|
|
29
29
|
var m = (performance || Date).now();
|
|
30
|
-
if (
|
|
30
|
+
if (d.update(m - r, 200), m >= a + 1e3 && (c.update(n * 1e3 / (m - a), 100), a = m, n = 0, g)) {
|
|
31
31
|
var h = performance.memory;
|
|
32
|
-
|
|
32
|
+
g.update(h.usedJSHeapSize / 1048576, h.jsHeapSizeLimit / 1048576);
|
|
33
33
|
}
|
|
34
34
|
return m;
|
|
35
35
|
},
|
|
@@ -38,22 +38,22 @@ var K = function() {
|
|
|
38
38
|
},
|
|
39
39
|
// Backwards Compatibility
|
|
40
40
|
domElement: t,
|
|
41
|
-
setMode:
|
|
41
|
+
setMode: s
|
|
42
42
|
};
|
|
43
43
|
};
|
|
44
44
|
K.Panel = function(e, t, i) {
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
var
|
|
48
|
-
return
|
|
49
|
-
dom:
|
|
50
|
-
update: function(
|
|
51
|
-
|
|
45
|
+
var s = 1 / 0, r = 0, a = Math.round, n = a(window.devicePixelRatio || 1), c = 80 * n, d = 48 * n, g = 3 * n, m = 2 * n, h = 3 * n, v = 15 * n, k = 74 * n, C = 30 * n, I = document.createElement("canvas");
|
|
46
|
+
I.width = c, I.height = d, I.style.cssText = "width:80px;height:48px";
|
|
47
|
+
var l = I.getContext("2d");
|
|
48
|
+
return l.font = "bold " + 9 * n + "px Helvetica,Arial,sans-serif", l.textBaseline = "top", l.fillStyle = i, l.fillRect(0, 0, c, d), l.fillStyle = t, l.fillText(e, g, m), l.fillRect(h, v, k, C), l.fillStyle = i, l.globalAlpha = 0.9, l.fillRect(h, v, k, C), {
|
|
49
|
+
dom: I,
|
|
50
|
+
update: function(o, T) {
|
|
51
|
+
s = Math.min(s, o), r = Math.max(r, o), l.fillStyle = i, l.globalAlpha = 1, l.fillRect(0, 0, c, v), l.fillStyle = t, l.fillText(a(o) + " " + e + " (" + a(s) + "-" + a(r) + ")", g, m), l.drawImage(I, h + n, v, k - n, C, h, v, k - n, C), l.fillRect(h + k - n, v, n, C), l.fillStyle = i, l.globalAlpha = 0.9, l.fillRect(h + k - n, v, n, a((1 - o / T) * C));
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
};
|
|
55
|
-
const
|
|
56
|
-
class
|
|
55
|
+
const pt = new x(), It = new nt(), dt = new x();
|
|
56
|
+
class jt extends wt {
|
|
57
57
|
/**
|
|
58
58
|
* Constructs a new CSS3D object.
|
|
59
59
|
*
|
|
@@ -70,7 +70,7 @@ class vt extends yt {
|
|
|
70
70
|
return super.copy(t, i), this.element = t.element.cloneNode(!0), this;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
class
|
|
73
|
+
class ee extends jt {
|
|
74
74
|
/**
|
|
75
75
|
* Constructs a new CSS3D sprite object.
|
|
76
76
|
*
|
|
@@ -83,8 +83,8 @@ class se extends vt {
|
|
|
83
83
|
return super.copy(t, i), this.rotation2D = t.rotation2D, this;
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
const H = new
|
|
87
|
-
class
|
|
86
|
+
const H = new ft(), Nt = new ft();
|
|
87
|
+
class ie {
|
|
88
88
|
/**
|
|
89
89
|
* Constructs a new CSS3D renderer.
|
|
90
90
|
*
|
|
@@ -92,72 +92,72 @@ class oe {
|
|
|
92
92
|
*/
|
|
93
93
|
constructor(t = {}) {
|
|
94
94
|
const i = this;
|
|
95
|
-
let
|
|
96
|
-
const
|
|
95
|
+
let s, r, a, n;
|
|
96
|
+
const c = {
|
|
97
97
|
camera: { style: "" },
|
|
98
98
|
objects: /* @__PURE__ */ new WeakMap()
|
|
99
|
-
},
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
|
|
99
|
+
}, d = t.element !== void 0 ? t.element : document.createElement("div");
|
|
100
|
+
d.style.overflow = "hidden", this.domElement = d;
|
|
101
|
+
const g = document.createElement("div");
|
|
102
|
+
g.style.transformOrigin = "0 0", g.style.pointerEvents = "none", d.appendChild(g);
|
|
103
103
|
const m = document.createElement("div");
|
|
104
|
-
m.style.transformStyle = "preserve-3d",
|
|
104
|
+
m.style.transformStyle = "preserve-3d", g.appendChild(m), this.getSize = function() {
|
|
105
105
|
return {
|
|
106
|
-
width:
|
|
106
|
+
width: s,
|
|
107
107
|
height: r
|
|
108
108
|
};
|
|
109
|
-
}, this.render = function(
|
|
110
|
-
const T =
|
|
111
|
-
|
|
112
|
-
let B,
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
}, this.setSize = function(
|
|
117
|
-
|
|
109
|
+
}, this.render = function(l, o) {
|
|
110
|
+
const T = o.projectionMatrix.elements[5] * n;
|
|
111
|
+
o.view && o.view.enabled ? (g.style.transform = `translate( ${-o.view.offsetX * (s / o.view.width)}px, ${-o.view.offsetY * (r / o.view.height)}px )`, g.style.transform += `scale( ${o.view.fullWidth / o.view.width}, ${o.view.fullHeight / o.view.height} )`) : g.style.transform = "", l.matrixWorldAutoUpdate === !0 && l.updateMatrixWorld(), o.parent === null && o.matrixWorldAutoUpdate === !0 && o.updateMatrixWorld();
|
|
112
|
+
let B, A;
|
|
113
|
+
o.isOrthographicCamera && (B = -(o.right + o.left) / 2, A = (o.top + o.bottom) / 2);
|
|
114
|
+
const O = o.view && o.view.enabled ? o.view.height / o.view.fullHeight : 1, j = o.isOrthographicCamera ? `scale( ${O} )scale(` + T + ")translate(" + h(B) + "px," + h(A) + "px)" + v(o.matrixWorldInverse) : `scale( ${O} )translateZ(` + T + "px)" + v(o.matrixWorldInverse), p = (o.isPerspectiveCamera ? "perspective(" + T + "px) " : "") + j + "translate(" + a + "px," + n + "px)";
|
|
115
|
+
c.camera.style !== p && (m.style.transform = p, c.camera.style = p), I(l, l, o);
|
|
116
|
+
}, this.setSize = function(l, o) {
|
|
117
|
+
s = l, r = o, a = s / 2, n = r / 2, d.style.width = l + "px", d.style.height = o + "px", g.style.width = l + "px", g.style.height = o + "px", m.style.width = l + "px", m.style.height = o + "px";
|
|
118
118
|
};
|
|
119
|
-
function h(
|
|
120
|
-
return Math.abs(
|
|
119
|
+
function h(l) {
|
|
120
|
+
return Math.abs(l) < 1e-10 ? 0 : l;
|
|
121
121
|
}
|
|
122
|
-
function
|
|
123
|
-
const
|
|
124
|
-
return "matrix3d(" + h(
|
|
122
|
+
function v(l) {
|
|
123
|
+
const o = l.elements;
|
|
124
|
+
return "matrix3d(" + h(o[0]) + "," + h(-o[1]) + "," + h(o[2]) + "," + h(o[3]) + "," + h(o[4]) + "," + h(-o[5]) + "," + h(o[6]) + "," + h(o[7]) + "," + h(o[8]) + "," + h(-o[9]) + "," + h(o[10]) + "," + h(o[11]) + "," + h(o[12]) + "," + h(-o[13]) + "," + h(o[14]) + "," + h(o[15]) + ")";
|
|
125
125
|
}
|
|
126
|
-
function
|
|
127
|
-
const
|
|
128
|
-
return "translate(-50%,-50%)" + ("matrix3d(" + h(
|
|
126
|
+
function k(l) {
|
|
127
|
+
const o = l.elements;
|
|
128
|
+
return "translate(-50%,-50%)" + ("matrix3d(" + h(o[0]) + "," + h(o[1]) + "," + h(o[2]) + "," + h(o[3]) + "," + h(-o[4]) + "," + h(-o[5]) + "," + h(-o[6]) + "," + h(-o[7]) + "," + h(o[8]) + "," + h(o[9]) + "," + h(o[10]) + "," + h(o[11]) + "," + h(o[12]) + "," + h(o[13]) + "," + h(o[14]) + "," + h(o[15]) + ")");
|
|
129
129
|
}
|
|
130
|
-
function C(
|
|
131
|
-
|
|
132
|
-
for (let
|
|
133
|
-
C(
|
|
130
|
+
function C(l) {
|
|
131
|
+
l.isCSS3DObject && (l.element.style.display = "none");
|
|
132
|
+
for (let o = 0, T = l.children.length; o < T; o++)
|
|
133
|
+
C(l.children[o]);
|
|
134
134
|
}
|
|
135
|
-
function
|
|
136
|
-
if (
|
|
137
|
-
C(
|
|
135
|
+
function I(l, o, T, B) {
|
|
136
|
+
if (l.visible === !1) {
|
|
137
|
+
C(l);
|
|
138
138
|
return;
|
|
139
139
|
}
|
|
140
|
-
if (
|
|
141
|
-
const
|
|
142
|
-
if (
|
|
143
|
-
|
|
144
|
-
let
|
|
145
|
-
|
|
146
|
-
const N =
|
|
147
|
-
if (N === void 0 || N.style !==
|
|
148
|
-
|
|
149
|
-
const
|
|
150
|
-
|
|
140
|
+
if (l.isCSS3DObject) {
|
|
141
|
+
const A = l.layers.test(T.layers) === !0, O = l.element;
|
|
142
|
+
if (O.style.display = A === !0 ? "" : "none", A === !0) {
|
|
143
|
+
l.onBeforeRender(i, o, T);
|
|
144
|
+
let j;
|
|
145
|
+
l.isCSS3DSprite ? (H.copy(T.matrixWorldInverse), H.transpose(), l.rotation2D !== 0 && H.multiply(Nt.makeRotationZ(l.rotation2D)), l.matrixWorld.decompose(pt, It, dt), H.setPosition(pt), H.scale(dt), H.elements[3] = 0, H.elements[7] = 0, H.elements[11] = 0, H.elements[15] = 1, j = k(H)) : j = k(l.matrixWorld);
|
|
146
|
+
const N = c.objects.get(l);
|
|
147
|
+
if (N === void 0 || N.style !== j) {
|
|
148
|
+
O.style.transform = j;
|
|
149
|
+
const p = { style: j };
|
|
150
|
+
c.objects.set(l, p);
|
|
151
151
|
}
|
|
152
|
-
|
|
152
|
+
O.parentNode !== m && m.appendChild(O), l.onAfterRender(i, o, T);
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
for (let
|
|
156
|
-
|
|
155
|
+
for (let A = 0, O = l.children.length; A < O; A++)
|
|
156
|
+
I(l.children[A], o, T);
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
-
const
|
|
160
|
+
const ut = { type: "change" }, at = { type: "start" }, yt = { type: "end" }, q = new St(), mt = new Pt(), Ht = Math.cos(70 * Tt.DEG2RAD), P = new x(), R = 2 * Math.PI, _ = {
|
|
161
161
|
NONE: -1,
|
|
162
162
|
ROTATE: 0,
|
|
163
163
|
DOLLY: 1,
|
|
@@ -166,8 +166,8 @@ const lt = { type: "change" }, it = { type: "start" }, ut = { type: "end" }, q =
|
|
|
166
166
|
TOUCH_PAN: 4,
|
|
167
167
|
TOUCH_DOLLY_PAN: 5,
|
|
168
168
|
TOUCH_DOLLY_ROTATE: 6
|
|
169
|
-
},
|
|
170
|
-
class
|
|
169
|
+
}, it = 1e-6;
|
|
170
|
+
class gt extends Dt {
|
|
171
171
|
/**
|
|
172
172
|
* Constructs a new controls instance.
|
|
173
173
|
*
|
|
@@ -175,7 +175,7 @@ class mt extends gt {
|
|
|
175
175
|
* @param {?HTMLDOMElement} domElement - The HTML element used for event listeners.
|
|
176
176
|
*/
|
|
177
177
|
constructor(t, i = null) {
|
|
178
|
-
super(t, i), this.state =
|
|
178
|
+
super(t, i), this.state = _.NONE, this.target = new x(), this.cursor = new x(), 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: z.ROTATE, MIDDLE: z.DOLLY, RIGHT: z.PAN }, this.touches = { ONE: F.ROTATE, TWO: F.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new x(), this._lastQuaternion = new nt(), this._lastTargetPosition = new x(), this._quat = new nt().setFromUnitVectors(t.up, new x(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new ht(), this._sphericalDelta = new ht(), this._scale = 1, this._panOffset = new x(), this._rotateStart = new L(), this._rotateEnd = new L(), this._rotateDelta = new L(), this._panStart = new L(), this._panEnd = new L(), this._panDelta = new L(), this._dollyStart = new L(), this._dollyEnd = new L(), this._dollyDelta = new L(), this._dollyDirection = new x(), this._mouse = new L(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = Ut.bind(this), this._onPointerDown = Gt.bind(this), this._onPointerUp = Yt.bind(this), this._onContextMenu = Xt.bind(this), this._onMouseWheel = Bt.bind(this), this._onKeyDown = Zt.bind(this), this._onTouchStart = Wt.bind(this), this._onTouchMove = Kt.bind(this), this._onMouseDown = zt.bind(this), this._onMouseMove = Ft.bind(this), this._interceptControlDown = Vt.bind(this), this._interceptControlUp = qt.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
|
|
179
179
|
}
|
|
180
180
|
connect(t) {
|
|
181
181
|
super.connect(t), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointercancel", this._onPointerUp), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: !1 }), this.domElement.getRootNode().addEventListener("keydown", this._interceptControlDown, { passive: !0, capture: !0 }), this.domElement.style.touchAction = "none";
|
|
@@ -236,42 +236,42 @@ class mt extends gt {
|
|
|
236
236
|
* was called, or the initial state.
|
|
237
237
|
*/
|
|
238
238
|
reset() {
|
|
239
|
-
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(
|
|
239
|
+
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(ut), this.update(), this.state = _.NONE;
|
|
240
240
|
}
|
|
241
241
|
update(t = null) {
|
|
242
242
|
const i = this.object.position;
|
|
243
|
-
|
|
244
|
-
let
|
|
245
|
-
isFinite(
|
|
246
|
-
let
|
|
243
|
+
P.copy(i).sub(this.target), P.applyQuaternion(this._quat), this._spherical.setFromVector3(P), this.autoRotate && this.state === _.NONE && this._rotateLeft(this._getAutoRotationAngle(t)), 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);
|
|
244
|
+
let s = this.minAzimuthAngle, r = this.maxAzimuthAngle;
|
|
245
|
+
isFinite(s) && isFinite(r) && (s < -Math.PI ? s += R : s > Math.PI && (s -= R), r < -Math.PI ? r += R : r > Math.PI && (r -= R), s <= r ? this._spherical.theta = Math.max(s, Math.min(r, this._spherical.theta)) : this._spherical.theta = this._spherical.theta > (s + r) / 2 ? Math.max(s, this._spherical.theta) : Math.min(r, 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);
|
|
246
|
+
let a = !1;
|
|
247
247
|
if (this.zoomToCursor && this._performCursorZoom || this.object.isOrthographicCamera)
|
|
248
248
|
this._spherical.radius = this._clampDistance(this._spherical.radius);
|
|
249
249
|
else {
|
|
250
|
-
const
|
|
251
|
-
this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale),
|
|
250
|
+
const n = this._spherical.radius;
|
|
251
|
+
this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale), a = n != this._spherical.radius;
|
|
252
252
|
}
|
|
253
|
-
if (
|
|
254
|
-
let
|
|
253
|
+
if (P.setFromSpherical(this._spherical), P.applyQuaternion(this._quatInverse), i.copy(this.target).add(P), 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) {
|
|
254
|
+
let n = null;
|
|
255
255
|
if (this.object.isPerspectiveCamera) {
|
|
256
|
-
const
|
|
257
|
-
|
|
258
|
-
const
|
|
259
|
-
this.object.position.addScaledVector(this._dollyDirection,
|
|
256
|
+
const c = P.length();
|
|
257
|
+
n = this._clampDistance(c * this._scale);
|
|
258
|
+
const d = c - n;
|
|
259
|
+
this.object.position.addScaledVector(this._dollyDirection, d), this.object.updateMatrixWorld(), a = !!d;
|
|
260
260
|
} else if (this.object.isOrthographicCamera) {
|
|
261
|
-
const
|
|
262
|
-
|
|
263
|
-
const
|
|
264
|
-
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(),
|
|
265
|
-
const
|
|
266
|
-
|
|
261
|
+
const c = new x(this._mouse.x, this._mouse.y, 0);
|
|
262
|
+
c.unproject(this.object);
|
|
263
|
+
const d = this.object.zoom;
|
|
264
|
+
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), a = d !== this.object.zoom;
|
|
265
|
+
const g = new x(this._mouse.x, this._mouse.y, 0);
|
|
266
|
+
g.unproject(this.object), this.object.position.sub(g).add(c), this.object.updateMatrixWorld(), n = P.length();
|
|
267
267
|
} else
|
|
268
268
|
console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
|
|
269
|
-
|
|
269
|
+
n !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(n).add(this.object.position) : (q.origin.copy(this.object.position), q.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(q.direction)) < Ht ? this.object.lookAt(this.target) : (mt.setFromNormalAndCoplanarPoint(this.object.up, this.target), q.intersectPlane(mt, this.target))));
|
|
270
270
|
} else if (this.object.isOrthographicCamera) {
|
|
271
|
-
const
|
|
272
|
-
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)),
|
|
271
|
+
const n = this.object.zoom;
|
|
272
|
+
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), n !== this.object.zoom && (this.object.updateProjectionMatrix(), a = !0);
|
|
273
273
|
}
|
|
274
|
-
return this._scale = 1, this._performCursorZoom = !1,
|
|
274
|
+
return this._scale = 1, this._performCursorZoom = !1, a || this._lastPosition.distanceToSquared(this.object.position) > it || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > it || this._lastTargetPosition.distanceToSquared(this.target) > it ? (this.dispatchEvent(ut), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
|
|
275
275
|
}
|
|
276
276
|
_getAutoRotationAngle(t) {
|
|
277
277
|
return t !== null ? R / 60 * this.autoRotateSpeed * t : R / 60 / 60 * this.autoRotateSpeed;
|
|
@@ -287,20 +287,20 @@ class mt extends gt {
|
|
|
287
287
|
this._sphericalDelta.phi -= t;
|
|
288
288
|
}
|
|
289
289
|
_panLeft(t, i) {
|
|
290
|
-
|
|
290
|
+
P.setFromMatrixColumn(i, 0), P.multiplyScalar(-t), this._panOffset.add(P);
|
|
291
291
|
}
|
|
292
292
|
_panUp(t, i) {
|
|
293
|
-
this.screenSpacePanning === !0 ?
|
|
293
|
+
this.screenSpacePanning === !0 ? P.setFromMatrixColumn(i, 1) : (P.setFromMatrixColumn(i, 0), P.crossVectors(this.object.up, P)), P.multiplyScalar(t), this._panOffset.add(P);
|
|
294
294
|
}
|
|
295
295
|
// deltaX and deltaY are in pixels; right and down are positive
|
|
296
296
|
_pan(t, i) {
|
|
297
|
-
const
|
|
297
|
+
const s = this.domElement;
|
|
298
298
|
if (this.object.isPerspectiveCamera) {
|
|
299
299
|
const r = this.object.position;
|
|
300
|
-
|
|
301
|
-
let
|
|
302
|
-
|
|
303
|
-
} else this.object.isOrthographicCamera ? (this._panLeft(t * (this.object.right - this.object.left) / this.object.zoom /
|
|
300
|
+
P.copy(r).sub(this.target);
|
|
301
|
+
let a = P.length();
|
|
302
|
+
a *= Math.tan(this.object.fov / 2 * Math.PI / 180), this._panLeft(2 * t * a / s.clientHeight, this.object.matrix), this._panUp(2 * i * a / s.clientHeight, this.object.matrix);
|
|
303
|
+
} else this.object.isOrthographicCamera ? (this._panLeft(t * (this.object.right - this.object.left) / this.object.zoom / s.clientWidth, this.object.matrix), this._panUp(i * (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);
|
|
304
304
|
}
|
|
305
305
|
_dollyOut(t) {
|
|
306
306
|
this.object.isPerspectiveCamera || this.object.isOrthographicCamera ? this._scale /= t : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), this.enableZoom = !1);
|
|
@@ -312,8 +312,8 @@ class mt extends gt {
|
|
|
312
312
|
if (!this.zoomToCursor)
|
|
313
313
|
return;
|
|
314
314
|
this._performCursorZoom = !0;
|
|
315
|
-
const
|
|
316
|
-
this._mouse.x = r /
|
|
315
|
+
const s = this.domElement.getBoundingClientRect(), r = t - s.left, a = i - s.top, n = s.width, c = s.height;
|
|
316
|
+
this._mouse.x = r / n * 2 - 1, this._mouse.y = -(a / c) * 2 + 1, this._dollyDirection.set(this._mouse.x, this._mouse.y, 1).unproject(this.object).sub(this.object.position).normalize();
|
|
317
317
|
}
|
|
318
318
|
_clampDistance(t) {
|
|
319
319
|
return Math.max(this.minDistance, Math.min(this.maxDistance, t));
|
|
@@ -366,21 +366,21 @@ class mt extends gt {
|
|
|
366
366
|
if (this._pointers.length === 1)
|
|
367
367
|
this._rotateStart.set(t.pageX, t.pageY);
|
|
368
368
|
else {
|
|
369
|
-
const i = this._getSecondPointerPosition(t),
|
|
370
|
-
this._rotateStart.set(
|
|
369
|
+
const i = this._getSecondPointerPosition(t), s = 0.5 * (t.pageX + i.x), r = 0.5 * (t.pageY + i.y);
|
|
370
|
+
this._rotateStart.set(s, r);
|
|
371
371
|
}
|
|
372
372
|
}
|
|
373
373
|
_handleTouchStartPan(t) {
|
|
374
374
|
if (this._pointers.length === 1)
|
|
375
375
|
this._panStart.set(t.pageX, t.pageY);
|
|
376
376
|
else {
|
|
377
|
-
const i = this._getSecondPointerPosition(t),
|
|
378
|
-
this._panStart.set(
|
|
377
|
+
const i = this._getSecondPointerPosition(t), s = 0.5 * (t.pageX + i.x), r = 0.5 * (t.pageY + i.y);
|
|
378
|
+
this._panStart.set(s, r);
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
381
|
_handleTouchStartDolly(t) {
|
|
382
|
-
const i = this._getSecondPointerPosition(t),
|
|
383
|
-
this._dollyStart.set(0,
|
|
382
|
+
const i = this._getSecondPointerPosition(t), s = t.pageX - i.x, r = t.pageY - i.y, a = Math.sqrt(s * s + r * r);
|
|
383
|
+
this._dollyStart.set(0, a);
|
|
384
384
|
}
|
|
385
385
|
_handleTouchStartDollyPan(t) {
|
|
386
386
|
this.enableZoom && this._handleTouchStartDolly(t), this.enablePan && this._handleTouchStartPan(t);
|
|
@@ -392,8 +392,8 @@ class mt extends gt {
|
|
|
392
392
|
if (this._pointers.length == 1)
|
|
393
393
|
this._rotateEnd.set(t.pageX, t.pageY);
|
|
394
394
|
else {
|
|
395
|
-
const
|
|
396
|
-
this._rotateEnd.set(r,
|
|
395
|
+
const s = this._getSecondPointerPosition(t), r = 0.5 * (t.pageX + s.x), a = 0.5 * (t.pageY + s.y);
|
|
396
|
+
this._rotateEnd.set(r, a);
|
|
397
397
|
}
|
|
398
398
|
this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
|
|
399
399
|
const i = this.domElement;
|
|
@@ -403,16 +403,16 @@ class mt extends gt {
|
|
|
403
403
|
if (this._pointers.length === 1)
|
|
404
404
|
this._panEnd.set(t.pageX, t.pageY);
|
|
405
405
|
else {
|
|
406
|
-
const i = this._getSecondPointerPosition(t),
|
|
407
|
-
this._panEnd.set(
|
|
406
|
+
const i = this._getSecondPointerPosition(t), s = 0.5 * (t.pageX + i.x), r = 0.5 * (t.pageY + i.y);
|
|
407
|
+
this._panEnd.set(s, r);
|
|
408
408
|
}
|
|
409
409
|
this._panDelta.subVectors(this._panEnd, this._panStart).multiplyScalar(this.panSpeed), this._pan(this._panDelta.x, this._panDelta.y), this._panStart.copy(this._panEnd);
|
|
410
410
|
}
|
|
411
411
|
_handleTouchMoveDolly(t) {
|
|
412
|
-
const i = this._getSecondPointerPosition(t),
|
|
413
|
-
this._dollyEnd.set(0,
|
|
414
|
-
const
|
|
415
|
-
this._updateZoomParameters(
|
|
412
|
+
const i = this._getSecondPointerPosition(t), s = t.pageX - i.x, r = t.pageY - i.y, a = Math.sqrt(s * s + r * r);
|
|
413
|
+
this._dollyEnd.set(0, a), this._dollyDelta.set(0, Math.pow(this._dollyEnd.y / this._dollyStart.y, this.zoomSpeed)), this._dollyOut(this._dollyDelta.y), this._dollyStart.copy(this._dollyEnd);
|
|
414
|
+
const n = (t.pageX + i.x) * 0.5, c = (t.pageY + i.y) * 0.5;
|
|
415
|
+
this._updateZoomParameters(n, c);
|
|
416
416
|
}
|
|
417
417
|
_handleTouchMoveDollyPan(t) {
|
|
418
418
|
this.enableZoom && this._handleTouchMoveDolly(t), this.enablePan && this._handleTouchMovePan(t);
|
|
@@ -447,32 +447,32 @@ class mt extends gt {
|
|
|
447
447
|
}
|
|
448
448
|
//
|
|
449
449
|
_customWheelEvent(t) {
|
|
450
|
-
const i = t.deltaMode,
|
|
450
|
+
const i = t.deltaMode, s = {
|
|
451
451
|
clientX: t.clientX,
|
|
452
452
|
clientY: t.clientY,
|
|
453
453
|
deltaY: t.deltaY
|
|
454
454
|
};
|
|
455
455
|
switch (i) {
|
|
456
456
|
case 1:
|
|
457
|
-
|
|
457
|
+
s.deltaY *= 16;
|
|
458
458
|
break;
|
|
459
459
|
case 2:
|
|
460
|
-
|
|
460
|
+
s.deltaY *= 100;
|
|
461
461
|
break;
|
|
462
462
|
}
|
|
463
|
-
return t.ctrlKey && !this._controlActive && (
|
|
463
|
+
return t.ctrlKey && !this._controlActive && (s.deltaY *= 10), s;
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
|
-
function
|
|
466
|
+
function Gt(e) {
|
|
467
467
|
this.enabled !== !1 && (this._pointers.length === 0 && (this.domElement.setPointerCapture(e.pointerId), this.domElement.addEventListener("pointermove", this._onPointerMove), this.domElement.addEventListener("pointerup", this._onPointerUp)), !this._isTrackingPointer(e) && (this._addPointer(e), e.pointerType === "touch" ? this._onTouchStart(e) : this._onMouseDown(e)));
|
|
468
468
|
}
|
|
469
|
-
function
|
|
469
|
+
function Ut(e) {
|
|
470
470
|
this.enabled !== !1 && (e.pointerType === "touch" ? this._onTouchMove(e) : this._onMouseMove(e));
|
|
471
471
|
}
|
|
472
|
-
function
|
|
472
|
+
function Yt(e) {
|
|
473
473
|
switch (this._removePointer(e), this._pointers.length) {
|
|
474
474
|
case 0:
|
|
475
|
-
this.domElement.releasePointerCapture(e.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(
|
|
475
|
+
this.domElement.releasePointerCapture(e.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(yt), this.state = _.NONE;
|
|
476
476
|
break;
|
|
477
477
|
case 1:
|
|
478
478
|
const t = this._pointers[0], i = this._pointerPositions[t];
|
|
@@ -480,7 +480,7 @@ function Ht(e) {
|
|
|
480
480
|
break;
|
|
481
481
|
}
|
|
482
482
|
}
|
|
483
|
-
function
|
|
483
|
+
function zt(e) {
|
|
484
484
|
let t;
|
|
485
485
|
switch (e.button) {
|
|
486
486
|
case 0:
|
|
@@ -498,157 +498,157 @@ function jt(e) {
|
|
|
498
498
|
switch (t) {
|
|
499
499
|
case z.DOLLY:
|
|
500
500
|
if (this.enableZoom === !1) return;
|
|
501
|
-
this._handleMouseDownDolly(e), this.state =
|
|
501
|
+
this._handleMouseDownDolly(e), this.state = _.DOLLY;
|
|
502
502
|
break;
|
|
503
503
|
case z.ROTATE:
|
|
504
504
|
if (e.ctrlKey || e.metaKey || e.shiftKey) {
|
|
505
505
|
if (this.enablePan === !1) return;
|
|
506
|
-
this._handleMouseDownPan(e), this.state =
|
|
506
|
+
this._handleMouseDownPan(e), this.state = _.PAN;
|
|
507
507
|
} else {
|
|
508
508
|
if (this.enableRotate === !1) return;
|
|
509
|
-
this._handleMouseDownRotate(e), this.state =
|
|
509
|
+
this._handleMouseDownRotate(e), this.state = _.ROTATE;
|
|
510
510
|
}
|
|
511
511
|
break;
|
|
512
512
|
case z.PAN:
|
|
513
513
|
if (e.ctrlKey || e.metaKey || e.shiftKey) {
|
|
514
514
|
if (this.enableRotate === !1) return;
|
|
515
|
-
this._handleMouseDownRotate(e), this.state =
|
|
515
|
+
this._handleMouseDownRotate(e), this.state = _.ROTATE;
|
|
516
516
|
} else {
|
|
517
517
|
if (this.enablePan === !1) return;
|
|
518
|
-
this._handleMouseDownPan(e), this.state =
|
|
518
|
+
this._handleMouseDownPan(e), this.state = _.PAN;
|
|
519
519
|
}
|
|
520
520
|
break;
|
|
521
521
|
default:
|
|
522
|
-
this.state =
|
|
522
|
+
this.state = _.NONE;
|
|
523
523
|
}
|
|
524
|
-
this.state !==
|
|
524
|
+
this.state !== _.NONE && this.dispatchEvent(at);
|
|
525
525
|
}
|
|
526
|
-
function
|
|
526
|
+
function Ft(e) {
|
|
527
527
|
switch (this.state) {
|
|
528
|
-
case
|
|
528
|
+
case _.ROTATE:
|
|
529
529
|
if (this.enableRotate === !1) return;
|
|
530
530
|
this._handleMouseMoveRotate(e);
|
|
531
531
|
break;
|
|
532
|
-
case
|
|
532
|
+
case _.DOLLY:
|
|
533
533
|
if (this.enableZoom === !1) return;
|
|
534
534
|
this._handleMouseMoveDolly(e);
|
|
535
535
|
break;
|
|
536
|
-
case
|
|
536
|
+
case _.PAN:
|
|
537
537
|
if (this.enablePan === !1) return;
|
|
538
538
|
this._handleMouseMovePan(e);
|
|
539
539
|
break;
|
|
540
540
|
}
|
|
541
541
|
}
|
|
542
|
-
function
|
|
543
|
-
this.enabled === !1 || this.enableZoom === !1 || this.state !==
|
|
542
|
+
function Bt(e) {
|
|
543
|
+
this.enabled === !1 || this.enableZoom === !1 || this.state !== _.NONE || (e.preventDefault(), this.dispatchEvent(at), this._handleMouseWheel(this._customWheelEvent(e)), this.dispatchEvent(yt));
|
|
544
544
|
}
|
|
545
|
-
function
|
|
545
|
+
function Zt(e) {
|
|
546
546
|
this.enabled !== !1 && this._handleKeyDown(e);
|
|
547
547
|
}
|
|
548
|
-
function
|
|
548
|
+
function Wt(e) {
|
|
549
549
|
switch (this._trackPointer(e), this._pointers.length) {
|
|
550
550
|
case 1:
|
|
551
551
|
switch (this.touches.ONE) {
|
|
552
|
-
case
|
|
552
|
+
case F.ROTATE:
|
|
553
553
|
if (this.enableRotate === !1) return;
|
|
554
|
-
this._handleTouchStartRotate(e), this.state =
|
|
554
|
+
this._handleTouchStartRotate(e), this.state = _.TOUCH_ROTATE;
|
|
555
555
|
break;
|
|
556
|
-
case
|
|
556
|
+
case F.PAN:
|
|
557
557
|
if (this.enablePan === !1) return;
|
|
558
|
-
this._handleTouchStartPan(e), this.state =
|
|
558
|
+
this._handleTouchStartPan(e), this.state = _.TOUCH_PAN;
|
|
559
559
|
break;
|
|
560
560
|
default:
|
|
561
|
-
this.state =
|
|
561
|
+
this.state = _.NONE;
|
|
562
562
|
}
|
|
563
563
|
break;
|
|
564
564
|
case 2:
|
|
565
565
|
switch (this.touches.TWO) {
|
|
566
|
-
case
|
|
566
|
+
case F.DOLLY_PAN:
|
|
567
567
|
if (this.enableZoom === !1 && this.enablePan === !1) return;
|
|
568
|
-
this._handleTouchStartDollyPan(e), this.state =
|
|
568
|
+
this._handleTouchStartDollyPan(e), this.state = _.TOUCH_DOLLY_PAN;
|
|
569
569
|
break;
|
|
570
|
-
case
|
|
570
|
+
case F.DOLLY_ROTATE:
|
|
571
571
|
if (this.enableZoom === !1 && this.enableRotate === !1) return;
|
|
572
|
-
this._handleTouchStartDollyRotate(e), this.state =
|
|
572
|
+
this._handleTouchStartDollyRotate(e), this.state = _.TOUCH_DOLLY_ROTATE;
|
|
573
573
|
break;
|
|
574
574
|
default:
|
|
575
|
-
this.state =
|
|
575
|
+
this.state = _.NONE;
|
|
576
576
|
}
|
|
577
577
|
break;
|
|
578
578
|
default:
|
|
579
|
-
this.state =
|
|
579
|
+
this.state = _.NONE;
|
|
580
580
|
}
|
|
581
|
-
this.state !==
|
|
581
|
+
this.state !== _.NONE && this.dispatchEvent(at);
|
|
582
582
|
}
|
|
583
|
-
function
|
|
583
|
+
function Kt(e) {
|
|
584
584
|
switch (this._trackPointer(e), this.state) {
|
|
585
|
-
case
|
|
585
|
+
case _.TOUCH_ROTATE:
|
|
586
586
|
if (this.enableRotate === !1) return;
|
|
587
587
|
this._handleTouchMoveRotate(e), this.update();
|
|
588
588
|
break;
|
|
589
|
-
case
|
|
589
|
+
case _.TOUCH_PAN:
|
|
590
590
|
if (this.enablePan === !1) return;
|
|
591
591
|
this._handleTouchMovePan(e), this.update();
|
|
592
592
|
break;
|
|
593
|
-
case
|
|
593
|
+
case _.TOUCH_DOLLY_PAN:
|
|
594
594
|
if (this.enableZoom === !1 && this.enablePan === !1) return;
|
|
595
595
|
this._handleTouchMoveDollyPan(e), this.update();
|
|
596
596
|
break;
|
|
597
|
-
case
|
|
597
|
+
case _.TOUCH_DOLLY_ROTATE:
|
|
598
598
|
if (this.enableZoom === !1 && this.enableRotate === !1) return;
|
|
599
599
|
this._handleTouchMoveDollyRotate(e), this.update();
|
|
600
600
|
break;
|
|
601
601
|
default:
|
|
602
|
-
this.state =
|
|
602
|
+
this.state = _.NONE;
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
|
-
function
|
|
605
|
+
function Xt(e) {
|
|
606
606
|
this.enabled !== !1 && e.preventDefault();
|
|
607
607
|
}
|
|
608
|
-
function
|
|
608
|
+
function Vt(e) {
|
|
609
609
|
e.key === "Control" && (this._controlActive = !0, this.domElement.getRootNode().addEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
|
|
610
610
|
}
|
|
611
|
-
function
|
|
611
|
+
function qt(e) {
|
|
612
612
|
e.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
|
|
613
613
|
}
|
|
614
|
-
class
|
|
614
|
+
class $t extends gt {
|
|
615
615
|
constructor(t, i) {
|
|
616
|
-
super(t, i), this.screenSpacePanning = !1, this.mouseButtons = { LEFT: z.PAN, MIDDLE: z.DOLLY, RIGHT: z.ROTATE }, this.touches = { ONE:
|
|
616
|
+
super(t, i), this.screenSpacePanning = !1, this.mouseButtons = { LEFT: z.PAN, MIDDLE: z.DOLLY, RIGHT: z.ROTATE }, this.touches = { ONE: F.PAN, TWO: F.DOLLY_ROTATE };
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
|
-
function
|
|
620
|
-
return new
|
|
619
|
+
function se(e) {
|
|
620
|
+
return new Mt(e);
|
|
621
621
|
}
|
|
622
|
-
function
|
|
623
|
-
return new
|
|
622
|
+
function oe(e = 150, ...t) {
|
|
623
|
+
return new At(e, e / 10, ...t);
|
|
624
624
|
}
|
|
625
|
-
function
|
|
626
|
-
return new
|
|
625
|
+
function ne(e) {
|
|
626
|
+
return new Rt(e, 16776960);
|
|
627
627
|
}
|
|
628
|
-
function
|
|
629
|
-
return new
|
|
628
|
+
function ae(e, t) {
|
|
629
|
+
return new gt(e, t);
|
|
630
630
|
}
|
|
631
|
-
function
|
|
632
|
-
return new
|
|
631
|
+
function re(e, t) {
|
|
632
|
+
return new $t(e, t);
|
|
633
633
|
}
|
|
634
|
-
function
|
|
635
|
-
const e = new
|
|
634
|
+
function le() {
|
|
635
|
+
const e = new xt(), t = new L(0, 0);
|
|
636
636
|
return {
|
|
637
637
|
raycaster: e,
|
|
638
638
|
pointer: t
|
|
639
639
|
};
|
|
640
640
|
}
|
|
641
|
-
function
|
|
642
|
-
return new
|
|
641
|
+
function he(e = 10) {
|
|
642
|
+
return new Ot(e);
|
|
643
643
|
}
|
|
644
|
-
function
|
|
645
|
-
return e.normalize(), new
|
|
644
|
+
function ce(e = new x(1, 1, 1), t = new x(10, 10, 10), i = 5, s = 16776960) {
|
|
645
|
+
return e.normalize(), new vt(e, t, i, s);
|
|
646
646
|
}
|
|
647
|
-
function
|
|
647
|
+
function pe() {
|
|
648
648
|
const e = new K();
|
|
649
649
|
return e.dom.style.cssText = "position:absolute;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000", e;
|
|
650
650
|
}
|
|
651
|
-
class
|
|
651
|
+
class Qt extends Lt {
|
|
652
652
|
/**
|
|
653
653
|
* Constructs a new RGBE loader.
|
|
654
654
|
*
|
|
@@ -664,27 +664,27 @@ class Xt extends xt {
|
|
|
664
664
|
* @return {DataTextureLoader~TexData} An object representing the parsed texture data.
|
|
665
665
|
*/
|
|
666
666
|
parse(t) {
|
|
667
|
-
const
|
|
668
|
-
switch (
|
|
667
|
+
const n = function(p, f) {
|
|
668
|
+
switch (p) {
|
|
669
669
|
case 1:
|
|
670
|
-
throw new Error("THREE.RGBELoader: Read Error: " + (
|
|
670
|
+
throw new Error("THREE.RGBELoader: Read Error: " + (f || ""));
|
|
671
671
|
case 2:
|
|
672
|
-
throw new Error("THREE.RGBELoader: Write Error: " + (
|
|
672
|
+
throw new Error("THREE.RGBELoader: Write Error: " + (f || ""));
|
|
673
673
|
case 3:
|
|
674
|
-
throw new Error("THREE.RGBELoader: Bad File Format: " + (
|
|
674
|
+
throw new Error("THREE.RGBELoader: Bad File Format: " + (f || ""));
|
|
675
675
|
default:
|
|
676
676
|
case 4:
|
|
677
|
-
throw new Error("THREE.RGBELoader: Memory Error: " + (
|
|
677
|
+
throw new Error("THREE.RGBELoader: Memory Error: " + (f || ""));
|
|
678
678
|
}
|
|
679
679
|
}, m = `
|
|
680
|
-
`, h = function(
|
|
681
|
-
|
|
682
|
-
let
|
|
683
|
-
for (; 0 > (
|
|
684
|
-
|
|
685
|
-
return -1 <
|
|
686
|
-
},
|
|
687
|
-
const
|
|
680
|
+
`, h = function(p, f, b) {
|
|
681
|
+
f = f || 1024;
|
|
682
|
+
let D = p.pos, w = -1, u = 0, S = "", y = String.fromCharCode.apply(null, new Uint16Array(p.subarray(D, D + 128)));
|
|
683
|
+
for (; 0 > (w = y.indexOf(m)) && u < f && D < p.byteLength; )
|
|
684
|
+
S += y, u += y.length, D += 128, y += String.fromCharCode.apply(null, new Uint16Array(p.subarray(D, D + 128)));
|
|
685
|
+
return -1 < w ? (p.pos += u + w + 1, S + y.slice(0, w)) : !1;
|
|
686
|
+
}, v = function(p) {
|
|
687
|
+
const f = /^#\?(\S+)/, b = /^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/, E = /^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/, D = /^\s*FORMAT=(\S+)\s*$/, w = /^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/, u = {
|
|
688
688
|
valid: 0,
|
|
689
689
|
/* indicate which fields are valid */
|
|
690
690
|
string: "",
|
|
@@ -703,77 +703,77 @@ class Xt extends xt {
|
|
|
703
703
|
height: 0
|
|
704
704
|
/* image dimensions, width/height */
|
|
705
705
|
};
|
|
706
|
-
let
|
|
707
|
-
for ((
|
|
708
|
-
`;
|
|
709
|
-
if (
|
|
710
|
-
`,
|
|
711
|
-
|
|
706
|
+
let S, y;
|
|
707
|
+
for ((p.pos >= p.byteLength || !(S = h(p))) && n(1, "no header found"), (y = S.match(f)) || n(3, "bad initial token"), u.valid |= 1, u.programtype = y[1], u.string += S + `
|
|
708
|
+
`; S = h(p), S !== !1; ) {
|
|
709
|
+
if (u.string += S + `
|
|
710
|
+
`, S.charAt(0) === "#") {
|
|
711
|
+
u.comments += S + `
|
|
712
712
|
`;
|
|
713
713
|
continue;
|
|
714
714
|
}
|
|
715
|
-
if ((
|
|
715
|
+
if ((y = S.match(b)) && (u.gamma = parseFloat(y[1])), (y = S.match(E)) && (u.exposure = parseFloat(y[1])), (y = S.match(D)) && (u.valid |= 2, u.format = y[1]), (y = S.match(w)) && (u.valid |= 4, u.height = parseInt(y[1], 10), u.width = parseInt(y[2], 10)), u.valid & 2 && u.valid & 4) break;
|
|
716
716
|
}
|
|
717
|
-
return
|
|
718
|
-
},
|
|
719
|
-
const
|
|
717
|
+
return u.valid & 2 || n(3, "missing format specifier"), u.valid & 4 || n(3, "missing image size specifier"), u;
|
|
718
|
+
}, k = function(p, f, b) {
|
|
719
|
+
const E = f;
|
|
720
720
|
if (
|
|
721
721
|
// run length encoding is not allowed so read flat
|
|
722
|
-
|
|
723
|
-
|
|
722
|
+
E < 8 || E > 32767 || // this file is not run length encoded
|
|
723
|
+
p[0] !== 2 || p[1] !== 2 || p[2] & 128
|
|
724
724
|
)
|
|
725
|
-
return new Uint8Array(
|
|
726
|
-
|
|
727
|
-
const
|
|
728
|
-
|
|
729
|
-
let
|
|
730
|
-
const
|
|
731
|
-
let
|
|
732
|
-
for (;
|
|
733
|
-
|
|
734
|
-
let W = 0,
|
|
735
|
-
for (; W <
|
|
736
|
-
|
|
737
|
-
const U =
|
|
738
|
-
if (U && (
|
|
739
|
-
const Y =
|
|
740
|
-
for (let
|
|
725
|
+
return new Uint8Array(p);
|
|
726
|
+
E !== (p[2] << 8 | p[3]) && n(3, "wrong scanline width");
|
|
727
|
+
const D = new Uint8Array(4 * f * b);
|
|
728
|
+
D.length || n(4, "unable to allocate buffer space");
|
|
729
|
+
let w = 0, u = 0;
|
|
730
|
+
const S = 4 * E, y = new Uint8Array(4), Z = new Uint8Array(S);
|
|
731
|
+
let rt = b;
|
|
732
|
+
for (; rt > 0 && u < p.byteLength; ) {
|
|
733
|
+
u + 4 > p.byteLength && n(1), y[0] = p[u++], y[1] = p[u++], y[2] = p[u++], y[3] = p[u++], (y[0] != 2 || y[1] != 2 || (y[2] << 8 | y[3]) != E) && n(3, "bad rgbe scanline format");
|
|
734
|
+
let W = 0, G;
|
|
735
|
+
for (; W < S && u < p.byteLength; ) {
|
|
736
|
+
G = p[u++];
|
|
737
|
+
const U = G > 128;
|
|
738
|
+
if (U && (G -= 128), (G === 0 || W + G > S) && n(3, "bad scanline data"), U) {
|
|
739
|
+
const Y = p[u++];
|
|
740
|
+
for (let lt = 0; lt < G; lt++)
|
|
741
741
|
Z[W++] = Y;
|
|
742
742
|
} else
|
|
743
|
-
Z.set(
|
|
743
|
+
Z.set(p.subarray(u, u + G), W), W += G, u += G;
|
|
744
744
|
}
|
|
745
|
-
const
|
|
746
|
-
for (let U = 0; U <
|
|
745
|
+
const Et = E;
|
|
746
|
+
for (let U = 0; U < Et; U++) {
|
|
747
747
|
let Y = 0;
|
|
748
|
-
w
|
|
748
|
+
D[w] = Z[U + Y], Y += E, D[w + 1] = Z[U + Y], Y += E, D[w + 2] = Z[U + Y], Y += E, D[w + 3] = Z[U + Y], w += 4;
|
|
749
749
|
}
|
|
750
|
-
|
|
750
|
+
rt--;
|
|
751
751
|
}
|
|
752
|
-
return
|
|
753
|
-
}, C = function(
|
|
754
|
-
const
|
|
755
|
-
|
|
756
|
-
},
|
|
757
|
-
const
|
|
758
|
-
|
|
759
|
-
},
|
|
760
|
-
|
|
761
|
-
const
|
|
762
|
-
let
|
|
752
|
+
return D;
|
|
753
|
+
}, C = function(p, f, b, E) {
|
|
754
|
+
const D = p[f + 3], w = Math.pow(2, D - 128) / 255;
|
|
755
|
+
b[E + 0] = p[f + 0] * w, b[E + 1] = p[f + 1] * w, b[E + 2] = p[f + 2] * w, b[E + 3] = 1;
|
|
756
|
+
}, I = function(p, f, b, E) {
|
|
757
|
+
const D = p[f + 3], w = Math.pow(2, D - 128) / 255;
|
|
758
|
+
b[E + 0] = V.toHalfFloat(Math.min(p[f + 0] * w, 65504)), b[E + 1] = V.toHalfFloat(Math.min(p[f + 1] * w, 65504)), b[E + 2] = V.toHalfFloat(Math.min(p[f + 2] * w, 65504)), b[E + 3] = V.toHalfFloat(1);
|
|
759
|
+
}, l = new Uint8Array(t);
|
|
760
|
+
l.pos = 0;
|
|
761
|
+
const o = v(l), T = o.width, B = o.height, A = k(l.subarray(l.pos), T, B);
|
|
762
|
+
let O, j, N;
|
|
763
763
|
switch (this.type) {
|
|
764
|
-
case
|
|
765
|
-
N =
|
|
766
|
-
const
|
|
767
|
-
for (let
|
|
768
|
-
C(
|
|
769
|
-
|
|
764
|
+
case et:
|
|
765
|
+
N = A.length / 4;
|
|
766
|
+
const p = new Float32Array(N * 4);
|
|
767
|
+
for (let b = 0; b < N; b++)
|
|
768
|
+
C(A, b * 4, p, b * 4);
|
|
769
|
+
O = p, j = et;
|
|
770
770
|
break;
|
|
771
771
|
case X:
|
|
772
|
-
N =
|
|
773
|
-
const
|
|
774
|
-
for (let
|
|
775
|
-
|
|
776
|
-
|
|
772
|
+
N = A.length / 4;
|
|
773
|
+
const f = new Uint16Array(N * 4);
|
|
774
|
+
for (let b = 0; b < N; b++)
|
|
775
|
+
I(A, b * 4, f, b * 4);
|
|
776
|
+
O = f, j = X;
|
|
777
777
|
break;
|
|
778
778
|
default:
|
|
779
779
|
throw new Error("THREE.RGBELoader: Unsupported type: " + this.type);
|
|
@@ -781,11 +781,11 @@ class Xt extends xt {
|
|
|
781
781
|
return {
|
|
782
782
|
width: T,
|
|
783
783
|
height: B,
|
|
784
|
-
data:
|
|
785
|
-
header:
|
|
786
|
-
gamma:
|
|
787
|
-
exposure:
|
|
788
|
-
type:
|
|
784
|
+
data: O,
|
|
785
|
+
header: o.string,
|
|
786
|
+
gamma: o.gamma,
|
|
787
|
+
exposure: o.exposure,
|
|
788
|
+
type: j
|
|
789
789
|
};
|
|
790
790
|
}
|
|
791
791
|
/**
|
|
@@ -797,53 +797,89 @@ class Xt extends xt {
|
|
|
797
797
|
setDataType(t) {
|
|
798
798
|
return this.type = t, this;
|
|
799
799
|
}
|
|
800
|
-
load(t, i,
|
|
801
|
-
function
|
|
802
|
-
switch (
|
|
803
|
-
case
|
|
800
|
+
load(t, i, s, r) {
|
|
801
|
+
function a(n, c) {
|
|
802
|
+
switch (n.type) {
|
|
803
|
+
case et:
|
|
804
804
|
case X:
|
|
805
|
-
|
|
805
|
+
n.colorSpace = kt, n.minFilter = ct, n.magFilter = ct, n.generateMipmaps = !1, n.flipY = !0;
|
|
806
806
|
break;
|
|
807
807
|
}
|
|
808
|
-
i && i(
|
|
808
|
+
i && i(n, c);
|
|
809
809
|
}
|
|
810
|
-
return super.load(t,
|
|
810
|
+
return super.load(t, a, s, r);
|
|
811
811
|
}
|
|
812
812
|
}
|
|
813
|
-
const
|
|
813
|
+
const Jt = (e) => {
|
|
814
814
|
e.geometry && e.geometry.dispose(), e.material && (Array.isArray(e.material) ? e.material.forEach((t) => {
|
|
815
|
-
|
|
816
|
-
}) :
|
|
815
|
+
_t(t);
|
|
816
|
+
}) : _t(e.material)), e.children && e.children.forEach((t) => Jt(t));
|
|
817
817
|
};
|
|
818
|
-
function
|
|
818
|
+
function _t(e) {
|
|
819
819
|
for (const t in e)
|
|
820
820
|
e[t] && e[t].isTexture && e[t].dispose();
|
|
821
821
|
e.dispose();
|
|
822
822
|
}
|
|
823
|
-
const
|
|
824
|
-
async function
|
|
823
|
+
const st = {}, bt = new Qt();
|
|
824
|
+
async function de(e, t) {
|
|
825
825
|
if (t) {
|
|
826
|
-
if (
|
|
827
|
-
const i =
|
|
826
|
+
if (st[t]) {
|
|
827
|
+
const i = st[t];
|
|
828
828
|
e.environment = i;
|
|
829
829
|
return;
|
|
830
830
|
}
|
|
831
|
-
return new Promise((i,
|
|
832
|
-
|
|
831
|
+
return new Promise((i, s) => {
|
|
832
|
+
bt.load(t, i, void 0, s);
|
|
833
833
|
}).then((i) => {
|
|
834
|
-
i.mapping =
|
|
834
|
+
i.mapping = Ct, e.environment = i, st[t] = i;
|
|
835
835
|
}).catch((i) => {
|
|
836
836
|
console.log(" =====> e:", i);
|
|
837
837
|
});
|
|
838
838
|
}
|
|
839
839
|
}
|
|
840
|
-
async function
|
|
840
|
+
async function ue(e) {
|
|
841
841
|
return new Promise((t, i) => {
|
|
842
|
-
|
|
842
|
+
bt.load(e, t, void 0, i);
|
|
843
843
|
});
|
|
844
844
|
}
|
|
845
|
-
const
|
|
846
|
-
function
|
|
845
|
+
const ot = {};
|
|
846
|
+
async function me(e, t = 50) {
|
|
847
|
+
const i = {
|
|
848
|
+
type: e.type,
|
|
849
|
+
name: e.name,
|
|
850
|
+
position: e.position.toArray(),
|
|
851
|
+
rotation: e.rotation.toArray(),
|
|
852
|
+
scale: e.scale.toArray(),
|
|
853
|
+
visible: e.visible,
|
|
854
|
+
children: [],
|
|
855
|
+
geometry: null,
|
|
856
|
+
material: null,
|
|
857
|
+
userData: e.userData
|
|
858
|
+
};
|
|
859
|
+
e.isMesh && (i.geometry = $(e.geometry), i.material = J(e.material));
|
|
860
|
+
const s = [{ object: e, parentData: i }];
|
|
861
|
+
let r = 0;
|
|
862
|
+
for (; s.length > 0; ) {
|
|
863
|
+
const { object: a, parentData: n } = s.pop();
|
|
864
|
+
for (const c of a.children) {
|
|
865
|
+
const d = {
|
|
866
|
+
type: c.type,
|
|
867
|
+
name: c.name,
|
|
868
|
+
position: c.position.toArray(),
|
|
869
|
+
rotation: c.rotation.toArray(),
|
|
870
|
+
scale: c.scale.toArray(),
|
|
871
|
+
visible: c.visible,
|
|
872
|
+
children: [],
|
|
873
|
+
geometry: null,
|
|
874
|
+
material: null,
|
|
875
|
+
userData: c.userData
|
|
876
|
+
};
|
|
877
|
+
c.isMesh && (d.geometry = $(c.geometry), d.material = J(c.material)), n.children.push(d), s.push({ object: c, parentData: d }), r++, r % t === 0 && await new Promise((g) => requestAnimationFrame(g));
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
return i;
|
|
881
|
+
}
|
|
882
|
+
function _e(e) {
|
|
847
883
|
const t = {
|
|
848
884
|
type: e.type,
|
|
849
885
|
name: e.name,
|
|
@@ -856,36 +892,114 @@ function qt(e) {
|
|
|
856
892
|
material: null,
|
|
857
893
|
userData: e.userData
|
|
858
894
|
};
|
|
859
|
-
e.isMesh && (t.geometry =
|
|
860
|
-
|
|
861
|
-
|
|
895
|
+
e.isMesh && (t.geometry = $(e.geometry), t.material = J(e.material));
|
|
896
|
+
const i = [{ object: e, parentData: t }];
|
|
897
|
+
for (; i.length > 0; ) {
|
|
898
|
+
const { object: s, parentData: r } = i.pop();
|
|
899
|
+
for (const a of s.children) {
|
|
900
|
+
const n = {
|
|
901
|
+
type: a.type,
|
|
902
|
+
name: a.name,
|
|
903
|
+
position: a.position.toArray(),
|
|
904
|
+
rotation: a.rotation.toArray(),
|
|
905
|
+
scale: a.scale.toArray(),
|
|
906
|
+
visible: a.visible,
|
|
907
|
+
children: [],
|
|
908
|
+
geometry: null,
|
|
909
|
+
material: null,
|
|
910
|
+
userData: a.userData
|
|
911
|
+
};
|
|
912
|
+
a.isMesh && (n.geometry = $(a.geometry), n.material = J(a.material)), r.children.push(n), i.push({ object: a, parentData: n });
|
|
913
|
+
}
|
|
914
|
+
}
|
|
862
915
|
return t;
|
|
863
916
|
}
|
|
864
|
-
function
|
|
865
|
-
|
|
917
|
+
async function fe(e, t = 50) {
|
|
918
|
+
const i = [];
|
|
919
|
+
let s;
|
|
866
920
|
switch (e.type) {
|
|
867
921
|
case "Mesh":
|
|
868
|
-
const
|
|
869
|
-
|
|
922
|
+
const a = Q(e.geometry), n = tt(e.material);
|
|
923
|
+
s = new M.Mesh(a, n);
|
|
870
924
|
break;
|
|
871
925
|
case "Group":
|
|
872
|
-
|
|
926
|
+
s = new M.Group();
|
|
873
927
|
break;
|
|
874
928
|
case "Object3D":
|
|
875
|
-
|
|
929
|
+
s = new M.Object3D();
|
|
876
930
|
break;
|
|
877
931
|
default:
|
|
878
932
|
return console.warn(`Unsupported object type: ${e.type}`), null;
|
|
879
933
|
}
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
934
|
+
s.name = e.name, s.position.fromArray(e.position), s.rotation.fromArray(e.rotation), s.scale.fromArray(e.scale), s.visible = e.visible, s.userData = e.userData, i.push({ data: e, object: s });
|
|
935
|
+
let r = 0;
|
|
936
|
+
for (; i.length > 0; ) {
|
|
937
|
+
const { data: a, object: n } = i.pop();
|
|
938
|
+
for (const c of [...a.children].reverse()) {
|
|
939
|
+
let d;
|
|
940
|
+
switch (c.type) {
|
|
941
|
+
case "Mesh":
|
|
942
|
+
const g = Q(c.geometry), m = tt(c.material);
|
|
943
|
+
d = new M.Mesh(g, m);
|
|
944
|
+
break;
|
|
945
|
+
case "Group":
|
|
946
|
+
d = new M.Group();
|
|
947
|
+
break;
|
|
948
|
+
case "Object3D":
|
|
949
|
+
d = new M.Object3D();
|
|
950
|
+
break;
|
|
951
|
+
default:
|
|
952
|
+
console.warn(`Unsupported object type: ${c.type}`);
|
|
953
|
+
continue;
|
|
954
|
+
}
|
|
955
|
+
d && (d.name = c.name, d.position.fromArray(c.position), d.rotation.fromArray(c.rotation), d.scale.fromArray(c.scale), d.visible = c.visible, d.userData = c.userData, n.add(d), i.push({ data: c, object: d }), r++, r % t === 0 && await new Promise((g) => requestAnimationFrame(g)));
|
|
956
|
+
}
|
|
884
957
|
}
|
|
885
|
-
return
|
|
958
|
+
return s;
|
|
959
|
+
}
|
|
960
|
+
function ye(e) {
|
|
961
|
+
const t = [];
|
|
962
|
+
let i;
|
|
963
|
+
switch (e.type) {
|
|
964
|
+
case "Mesh":
|
|
965
|
+
const s = Q(e.geometry), r = tt(e.material);
|
|
966
|
+
i = new M.Mesh(s, r);
|
|
967
|
+
break;
|
|
968
|
+
case "Group":
|
|
969
|
+
i = new M.Group();
|
|
970
|
+
break;
|
|
971
|
+
case "Object3D":
|
|
972
|
+
i = new M.Object3D();
|
|
973
|
+
break;
|
|
974
|
+
default:
|
|
975
|
+
return console.warn(`Unsupported object type: ${e.type}`), null;
|
|
976
|
+
}
|
|
977
|
+
for (i.name = e.name, i.position.fromArray(e.position), i.rotation.fromArray(e.rotation), i.scale.fromArray(e.scale), i.visible = e.visible, i.userData = e.userData, t.push({ data: e, object: i }); t.length > 0; ) {
|
|
978
|
+
const { data: s, object: r } = t.pop();
|
|
979
|
+
for (const a of [...s.children].reverse()) {
|
|
980
|
+
let n;
|
|
981
|
+
switch (a.type) {
|
|
982
|
+
case "Mesh":
|
|
983
|
+
const c = Q(a.geometry), d = tt(a.material);
|
|
984
|
+
n = new M.Mesh(c, d);
|
|
985
|
+
break;
|
|
986
|
+
case "Group":
|
|
987
|
+
n = new M.Group();
|
|
988
|
+
break;
|
|
989
|
+
case "Object3D":
|
|
990
|
+
n = new M.Object3D();
|
|
991
|
+
break;
|
|
992
|
+
default:
|
|
993
|
+
console.warn(`Unsupported object type: ${a.type}`);
|
|
994
|
+
continue;
|
|
995
|
+
}
|
|
996
|
+
n && (n.name = a.name, n.position.fromArray(a.position), n.rotation.fromArray(a.rotation), n.scale.fromArray(a.scale), n.visible = a.visible, n.userData = a.userData, r.add(n), t.push({ data: a, object: n }));
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
return i;
|
|
886
1000
|
}
|
|
887
|
-
function
|
|
888
|
-
const t =
|
|
1001
|
+
function $(e) {
|
|
1002
|
+
const t = {}, { attributes: i, index: s, type: r } = e;
|
|
889
1003
|
i.position && (t.position = {
|
|
890
1004
|
type: "Float32Array",
|
|
891
1005
|
array: Array.from(i.position.array),
|
|
@@ -899,27 +1013,29 @@ function Qt(e) {
|
|
|
899
1013
|
array: Array.from(i.uv.array),
|
|
900
1014
|
itemSize: 2
|
|
901
1015
|
});
|
|
902
|
-
const
|
|
1016
|
+
const a = {
|
|
903
1017
|
type: r,
|
|
904
1018
|
attributes: t
|
|
905
1019
|
};
|
|
906
|
-
return
|
|
1020
|
+
return s && s.array && (a.index = {
|
|
907
1021
|
type: "Uint32Array",
|
|
908
|
-
array: Array.from(
|
|
1022
|
+
array: Array.from(s.array),
|
|
909
1023
|
itemSize: 1
|
|
910
|
-
}),
|
|
911
|
-
}
|
|
912
|
-
function
|
|
913
|
-
const { type: t, attributes: i, index:
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
}
|
|
922
|
-
|
|
1024
|
+
}), a;
|
|
1025
|
+
}
|
|
1026
|
+
function Q(e) {
|
|
1027
|
+
const { type: t, attributes: i, index: s } = e, r = new M.BufferGeometry();
|
|
1028
|
+
for (const a in i)
|
|
1029
|
+
if (i.hasOwnProperty(a)) {
|
|
1030
|
+
const { type: n, array: c, itemSize: d } = i[a];
|
|
1031
|
+
r.setAttribute(
|
|
1032
|
+
a,
|
|
1033
|
+
new M.BufferAttribute(new Float32Array(c), d)
|
|
1034
|
+
);
|
|
1035
|
+
}
|
|
1036
|
+
return s && r.setIndex(s.array), r;
|
|
1037
|
+
}
|
|
1038
|
+
function J(e) {
|
|
923
1039
|
return {
|
|
924
1040
|
type: e.type,
|
|
925
1041
|
color: e.color.getHex(),
|
|
@@ -935,31 +1051,33 @@ function te(e) {
|
|
|
935
1051
|
emissive: e.emissive.getHex()
|
|
936
1052
|
};
|
|
937
1053
|
}
|
|
938
|
-
function
|
|
939
|
-
if (
|
|
940
|
-
const { type: t, ...i } = e,
|
|
1054
|
+
function tt(e) {
|
|
1055
|
+
if (ot[e.name]) return ot[e.name];
|
|
1056
|
+
const { type: t, ...i } = e, s = t || "MeshStandardMaterial", r = new M[s]({ ...i });
|
|
941
1057
|
if (e.map) {
|
|
942
|
-
const
|
|
943
|
-
r.map =
|
|
1058
|
+
const a = new M.TextureLoader().load(e.map);
|
|
1059
|
+
r.map = a;
|
|
944
1060
|
}
|
|
945
|
-
return r.needsUpdate = !0,
|
|
1061
|
+
return r.needsUpdate = !0, ot[e.name] = r, r;
|
|
946
1062
|
}
|
|
947
1063
|
export {
|
|
948
|
-
|
|
949
|
-
|
|
1064
|
+
ie as C,
|
|
1065
|
+
ue as I,
|
|
950
1066
|
K as S,
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
1067
|
+
oe as a,
|
|
1068
|
+
ne as b,
|
|
1069
|
+
se as c,
|
|
1070
|
+
ae as d,
|
|
1071
|
+
re as e,
|
|
1072
|
+
le as f,
|
|
1073
|
+
he as g,
|
|
1074
|
+
ce as h,
|
|
1075
|
+
pe as i,
|
|
1076
|
+
Jt as j,
|
|
1077
|
+
de as k,
|
|
1078
|
+
_e as l,
|
|
1079
|
+
fe as m,
|
|
1080
|
+
ye as n,
|
|
1081
|
+
me as o,
|
|
1082
|
+
ee as p
|
|
965
1083
|
};
|