view3d-core 1.1.5 → 1.1.9
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/{SceneConfigPlugin-DOTHJSki.cjs → SceneConfigPlugin-COseIMiE.cjs} +645 -645
- package/dist/SceneConfigPlugin-COseIMiE.cjs.map +1 -0
- package/dist/{SceneConfigPlugin-DZg33RSn.js → SceneConfigPlugin-CSz42Z4m.js} +5 -5
- package/dist/SceneConfigPlugin-CSz42Z4m.js.map +1 -0
- package/dist/img/snow.png +0 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/json/cn1.json +1 -0
- package/dist/json/guangdong.json +1 -0
- package/dist/plugins/index.cjs +1 -1
- package/dist/plugins/index.js +1 -1
- package/package.json +1 -1
- package/dist/SceneConfigPlugin-DOTHJSki.cjs.map +0 -1
- package/dist/SceneConfigPlugin-DZg33RSn.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const e = require("three/examples/jsm/controls/OrbitControls.js"), t = require("three"), n = require("three/examples/jsm/controls/TransformControls.js"), o = require("three/examples/jsm/loaders/GLTFLoader.js"), s = require("three/examples/jsm/loaders/DRACOLoader.js"),
|
|
2
|
+
const e = require("three/examples/jsm/controls/OrbitControls.js"), t = require("three"), n = require("three/examples/jsm/controls/TransformControls.js"), o = require("three/examples/jsm/loaders/GLTFLoader.js"), s = require("three/examples/jsm/loaders/DRACOLoader.js"), r = require("three/examples/jsm/loaders/FBXLoader.js"), i = require("three/examples/jsm/loaders/OBJLoader.js"), a = require("three/examples/jsm/loaders/MTLLoader.js"), l = require("three/examples/jsm/loaders/FontLoader.js"), c = require("three/examples/jsm/postprocessing/EffectComposer.js"), d = require("three/examples/jsm/postprocessing/RenderPass.js"), h = require("three/examples/jsm/postprocessing/OutlinePass.js"), u = require("three/examples/jsm/postprocessing/UnrealBloomPass.js"), p = require("three/examples/jsm/postprocessing/SAOPass.js"), m = require("three/examples/jsm/postprocessing/SSRPass.js"), f = require("three/examples/jsm/postprocessing/ShaderPass.js"), g = require("three/examples/jsm/shaders/FXAAShader.js"), y = require("three/examples/jsm/postprocessing/OutputPass.js"), v = require("three/examples/jsm/renderers/CSS2DRenderer.js"), b = require("three/examples/jsm/renderers/CSS3DRenderer.js"), w = require("three/examples/jsm/libs/stats.module.js"), x = require("three/examples/jsm/helpers/ViewHelper.js"), _ = require("gsap"), C = require("proj4"), M = require("cannon-es"), P = require("three/examples/jsm/geometries/TextGeometry.js"), S = require("three/examples/jsm/loaders/RGBELoader.js"), A = require("three/examples/jsm/lights/RectAreaLightUniformsLib.js");
|
|
3
3
|
function T(e4) {
|
|
4
4
|
const t2 = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
5
5
|
if (e4) {
|
|
@@ -80,7 +80,7 @@ class B {
|
|
|
80
80
|
}
|
|
81
81
|
const L = { enableDamping: true, dampingFactor: 0.05, minDistance: 1, maxDistance: 5e3, minZoom: 1e3, maxPolarAngle: Math.PI, enablePan: true, enableZoom: true, enableRotate: true };
|
|
82
82
|
const O = { mode: "translate", space: "world", showX: true, showY: true, showZ: true, translationSnap: null, rotationSnap: null, scaleSnap: null };
|
|
83
|
-
const k = 1.25, j = 65535,
|
|
83
|
+
const k = 1.25, j = 65535, D = Math.pow(2, -24), z = /* @__PURE__ */ Symbol("SKIP_GENERATION");
|
|
84
84
|
function R(e4) {
|
|
85
85
|
return (function(e5) {
|
|
86
86
|
return e5.index ? e5.index.count : e5.attributes.position.count;
|
|
@@ -96,15 +96,15 @@ function U(e4, n2) {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
function I(e4, t2) {
|
|
99
|
-
const n2 = R(e4), o2 = t2 || e4.drawRange, s2 = o2.start / 3,
|
|
100
|
-
return [{ offset: Math.floor(
|
|
99
|
+
const n2 = R(e4), o2 = t2 || e4.drawRange, s2 = o2.start / 3, r2 = (o2.start + o2.count) / 3, i2 = Math.max(0, s2), a2 = Math.min(n2, r2) - i2;
|
|
100
|
+
return [{ offset: Math.floor(i2), count: Math.floor(a2) }];
|
|
101
101
|
}
|
|
102
102
|
function H(e4, t2) {
|
|
103
103
|
if (!e4.groups || !e4.groups.length) return I(e4, t2);
|
|
104
|
-
const n2 = [], o2 = /* @__PURE__ */ new Set(), s2 = t2 || e4.drawRange,
|
|
104
|
+
const n2 = [], o2 = /* @__PURE__ */ new Set(), s2 = t2 || e4.drawRange, r2 = s2.start / 3, i2 = (s2.start + s2.count) / 3;
|
|
105
105
|
for (const t3 of e4.groups) {
|
|
106
106
|
const e5 = t3.start / 3, n3 = (t3.start + t3.count) / 3;
|
|
107
|
-
o2.add(Math.max(
|
|
107
|
+
o2.add(Math.max(r2, e5)), o2.add(Math.min(i2, n3));
|
|
108
108
|
}
|
|
109
109
|
const a2 = Array.from(o2.values()).sort((e5, t3) => e5 - t3);
|
|
110
110
|
for (let e5 = 0; e5 < a2.length - 1; e5++) {
|
|
@@ -114,16 +114,16 @@ function H(e4, t2) {
|
|
|
114
114
|
return n2;
|
|
115
115
|
}
|
|
116
116
|
function G(e4, t2, n2, o2, s2) {
|
|
117
|
-
let
|
|
117
|
+
let r2 = 1 / 0, i2 = 1 / 0, a2 = 1 / 0, l2 = -1 / 0, c2 = -1 / 0, d2 = -1 / 0, h2 = 1 / 0, u2 = 1 / 0, p2 = 1 / 0, m2 = -1 / 0, f2 = -1 / 0, g2 = -1 / 0;
|
|
118
118
|
for (let o3 = 6 * t2, s3 = 6 * (t2 + n2); o3 < s3; o3 += 6) {
|
|
119
119
|
const t3 = e4[o3 + 0], n3 = e4[o3 + 1], s4 = t3 - n3, y2 = t3 + n3;
|
|
120
|
-
s4 <
|
|
120
|
+
s4 < r2 && (r2 = s4), y2 > l2 && (l2 = y2), t3 < h2 && (h2 = t3), t3 > m2 && (m2 = t3);
|
|
121
121
|
const v2 = e4[o3 + 2], b2 = e4[o3 + 3], w2 = v2 - b2, x2 = v2 + b2;
|
|
122
|
-
w2 <
|
|
122
|
+
w2 < i2 && (i2 = w2), x2 > c2 && (c2 = x2), v2 < u2 && (u2 = v2), v2 > f2 && (f2 = v2);
|
|
123
123
|
const _2 = e4[o3 + 4], C2 = e4[o3 + 5], M2 = _2 - C2, P2 = _2 + C2;
|
|
124
124
|
M2 < a2 && (a2 = M2), P2 > d2 && (d2 = P2), _2 < p2 && (p2 = _2), _2 > g2 && (g2 = _2);
|
|
125
125
|
}
|
|
126
|
-
o2[0] =
|
|
126
|
+
o2[0] = r2, o2[1] = i2, o2[2] = a2, o2[3] = l2, o2[4] = c2, o2[5] = d2, s2[0] = h2, s2[1] = u2, s2[2] = p2, s2[3] = m2, s2[4] = f2, s2[5] = g2;
|
|
127
127
|
}
|
|
128
128
|
function V(e4, t2, n2) {
|
|
129
129
|
return n2.min.x = t2[e4], n2.min.y = t2[e4 + 1], n2.min.z = t2[e4 + 2], n2.max.x = t2[e4 + 3], n2.max.y = t2[e4 + 4], n2.max.z = t2[e4 + 5], n2;
|
|
@@ -141,15 +141,15 @@ function $(e4, t2) {
|
|
|
141
141
|
}
|
|
142
142
|
function X(e4, t2, n2) {
|
|
143
143
|
let o2, s2;
|
|
144
|
-
for (let
|
|
145
|
-
const
|
|
146
|
-
o2 = e4[
|
|
144
|
+
for (let r2 = 0; r2 < 3; r2++) {
|
|
145
|
+
const i2 = r2 + 3;
|
|
146
|
+
o2 = e4[r2], s2 = t2[r2], n2[r2] = o2 < s2 ? o2 : s2, o2 = e4[i2], s2 = t2[i2], n2[i2] = o2 > s2 ? o2 : s2;
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
function q(e4, t2, n2) {
|
|
150
150
|
for (let o2 = 0; o2 < 3; o2++) {
|
|
151
|
-
const s2 = t2[e4 + 2 * o2],
|
|
152
|
-
|
|
151
|
+
const s2 = t2[e4 + 2 * o2], r2 = t2[e4 + 2 * o2 + 1], i2 = s2 - r2, a2 = s2 + r2;
|
|
152
|
+
i2 < n2[o2] && (n2[o2] = i2), a2 > n2[o2 + 3] && (n2[o2 + 3] = a2);
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
function W(e4) {
|
|
@@ -162,39 +162,39 @@ class Q {
|
|
|
162
162
|
this.boundingData = new Float32Array(6);
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
function ee(e4, t2, n2, o2, s2,
|
|
166
|
-
let
|
|
167
|
-
const l2 =
|
|
165
|
+
function ee(e4, t2, n2, o2, s2, r2) {
|
|
166
|
+
let i2 = o2, a2 = o2 + s2 - 1;
|
|
167
|
+
const l2 = r2.pos, c2 = 2 * r2.axis;
|
|
168
168
|
for (; ; ) {
|
|
169
|
-
for (;
|
|
170
|
-
for (;
|
|
171
|
-
if (!(
|
|
169
|
+
for (; i2 <= a2 && n2[6 * i2 + c2] < l2; ) i2++;
|
|
170
|
+
for (; i2 <= a2 && n2[6 * a2 + c2] >= l2; ) a2--;
|
|
171
|
+
if (!(i2 < a2)) return i2;
|
|
172
172
|
for (let e5 = 0; e5 < 3; e5++) {
|
|
173
|
-
let n3 = t2[3 *
|
|
174
|
-
t2[3 *
|
|
173
|
+
let n3 = t2[3 * i2 + e5];
|
|
174
|
+
t2[3 * i2 + e5] = t2[3 * a2 + e5], t2[3 * a2 + e5] = n3;
|
|
175
175
|
}
|
|
176
176
|
for (let e5 = 0; e5 < 6; e5++) {
|
|
177
|
-
let t3 = n2[6 *
|
|
178
|
-
n2[6 *
|
|
177
|
+
let t3 = n2[6 * i2 + e5];
|
|
178
|
+
n2[6 * i2 + e5] = n2[6 * a2 + e5], n2[6 * a2 + e5] = t3;
|
|
179
179
|
}
|
|
180
|
-
|
|
180
|
+
i2++, a2--;
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
-
function te(e4, t2, n2, o2, s2,
|
|
184
|
-
let
|
|
185
|
-
const l2 =
|
|
183
|
+
function te(e4, t2, n2, o2, s2, r2) {
|
|
184
|
+
let i2 = o2, a2 = o2 + s2 - 1;
|
|
185
|
+
const l2 = r2.pos, c2 = 2 * r2.axis;
|
|
186
186
|
for (; ; ) {
|
|
187
|
-
for (;
|
|
188
|
-
for (;
|
|
189
|
-
if (!(
|
|
187
|
+
for (; i2 <= a2 && n2[6 * i2 + c2] < l2; ) i2++;
|
|
188
|
+
for (; i2 <= a2 && n2[6 * a2 + c2] >= l2; ) a2--;
|
|
189
|
+
if (!(i2 < a2)) return i2;
|
|
190
190
|
{
|
|
191
|
-
let t3 = e4[
|
|
192
|
-
e4[
|
|
191
|
+
let t3 = e4[i2];
|
|
192
|
+
e4[i2] = e4[a2], e4[a2] = t3;
|
|
193
193
|
for (let e5 = 0; e5 < 6; e5++) {
|
|
194
|
-
let t4 = n2[6 *
|
|
195
|
-
n2[6 *
|
|
194
|
+
let t4 = n2[6 * i2 + e5];
|
|
195
|
+
n2[6 * i2 + e5] = n2[6 * a2 + e5], n2[6 * a2 + e5] = t4;
|
|
196
196
|
}
|
|
197
|
-
|
|
197
|
+
i2++, a2--;
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
}
|
|
@@ -207,10 +207,10 @@ function oe(e4, t2) {
|
|
|
207
207
|
function se(e4, t2) {
|
|
208
208
|
return t2[e4 + 14];
|
|
209
209
|
}
|
|
210
|
-
function
|
|
210
|
+
function re(e4) {
|
|
211
211
|
return e4 + 8;
|
|
212
212
|
}
|
|
213
|
-
function
|
|
213
|
+
function ie(e4, t2) {
|
|
214
214
|
return t2[e4 + 6];
|
|
215
215
|
}
|
|
216
216
|
function ae(e4, t2) {
|
|
@@ -228,8 +228,8 @@ function fe(e4, t2, n2) {
|
|
|
228
228
|
return ce = new Float32Array(n2), de = new Uint32Array(n2), he = new Uint16Array(n2), ue = new Uint8Array(n2), ge(e4, t2);
|
|
229
229
|
}
|
|
230
230
|
function ge(e4, t2) {
|
|
231
|
-
const n2 = e4 / 4, o2 = e4 / 2, s2 = "count" in t2,
|
|
232
|
-
for (let e5 = 0; e5 < 6; e5++) ce[n2 + e5] =
|
|
231
|
+
const n2 = e4 / 4, o2 = e4 / 2, s2 = "count" in t2, r2 = t2.boundingData;
|
|
232
|
+
for (let e5 = 0; e5 < 6; e5++) ce[n2 + e5] = r2[e5];
|
|
233
233
|
if (s2) {
|
|
234
234
|
if (t2.buffer) {
|
|
235
235
|
const o3 = t2.buffer;
|
|
@@ -240,34 +240,34 @@ function ge(e4, t2) {
|
|
|
240
240
|
return e4 + o3.byteLength;
|
|
241
241
|
}
|
|
242
242
|
{
|
|
243
|
-
const s3 = t2.offset,
|
|
244
|
-
return de[n2 + 6] = s3, he[o2 + 14] =
|
|
243
|
+
const s3 = t2.offset, r3 = t2.count;
|
|
244
|
+
return de[n2 + 6] = s3, he[o2 + 14] = r3, he[o2 + 15] = j, e4 + 32;
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
{
|
|
248
|
-
const o3 = t2.left, s3 = t2.right,
|
|
249
|
-
let
|
|
250
|
-
if (
|
|
251
|
-
return de[n2 + 6] =
|
|
248
|
+
const o3 = t2.left, s3 = t2.right, r3 = t2.splitAxis;
|
|
249
|
+
let i2;
|
|
250
|
+
if (i2 = ge(e4 + 32, o3), i2 / 4 > pe) throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");
|
|
251
|
+
return de[n2 + 6] = i2 / 4, i2 = ge(i2, s3), de[n2 + 7] = r3, i2;
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
254
|
function ye(e4, t2, n2, o2, s2) {
|
|
255
|
-
const { maxDepth:
|
|
255
|
+
const { maxDepth: r2, verbose: i2, maxLeafTris: a2, strategy: l2, onProgress: c2, indirect: d2 } = s2, h2 = e4._indirectBuffer, u2 = e4.geometry, p2 = u2.index ? u2.index.array : null, m2 = d2 ? te : ee, f2 = R(u2), g2 = new Float32Array(6);
|
|
256
256
|
let y2 = false;
|
|
257
257
|
const v2 = new Q();
|
|
258
|
-
return G(t2, n2, o2, v2.boundingData, g2), (function e5(n3, o3, s3,
|
|
259
|
-
!y2 && c3 >=
|
|
260
|
-
if (s3 <= a2 || c3 >=
|
|
261
|
-
const d3 = (function(e6, t3, n4, o4, s4,
|
|
262
|
-
let
|
|
263
|
-
if (0 ===
|
|
264
|
-
else if (1 ===
|
|
258
|
+
return G(t2, n2, o2, v2.boundingData, g2), (function e5(n3, o3, s3, i3 = null, c3 = 0) {
|
|
259
|
+
!y2 && c3 >= r2 && (y2 = true);
|
|
260
|
+
if (s3 <= a2 || c3 >= r2) return b2(o3 + s3), n3.offset = o3, n3.count = s3, n3;
|
|
261
|
+
const d3 = (function(e6, t3, n4, o4, s4, r3) {
|
|
262
|
+
let i4 = -1, a3 = 0;
|
|
263
|
+
if (0 === r3) i4 = N(t3), -1 !== i4 && (a3 = (t3[i4] + t3[i4 + 3]) / 2);
|
|
264
|
+
else if (1 === r3) i4 = N(e6), -1 !== i4 && (a3 = (function(e7, t4, n5, o5) {
|
|
265
265
|
let s5 = 0;
|
|
266
|
-
for (let
|
|
266
|
+
for (let r4 = t4, i5 = t4 + n5; r4 < i5; r4++) s5 += e7[6 * r4 + 2 * o5];
|
|
267
267
|
return s5 / n5;
|
|
268
|
-
})(n4, o4, s4,
|
|
269
|
-
else if (2 ===
|
|
270
|
-
const
|
|
268
|
+
})(n4, o4, s4, i4));
|
|
269
|
+
else if (2 === r3) {
|
|
270
|
+
const r4 = W(e6);
|
|
271
271
|
let l3 = k * s4;
|
|
272
272
|
const c4 = 6 * o4, d4 = 6 * (o4 + s4);
|
|
273
273
|
for (let e7 = 0; e7 < 3; e7++) {
|
|
@@ -277,11 +277,11 @@ function ye(e4, t2, n2, o2, s2) {
|
|
|
277
277
|
t4.length = s4;
|
|
278
278
|
let o6 = 0;
|
|
279
279
|
for (let s5 = c4; s5 < d4; s5 += 6, o6++) {
|
|
280
|
-
const
|
|
281
|
-
|
|
282
|
-
const { bounds:
|
|
283
|
-
for (let e8 = 0; e8 < 3; e8++) l4[e8] = 1 / 0, l4[e8 + 3] = -1 / 0, a4[e8] = 1 / 0, a4[e8 + 3] = -1 / 0,
|
|
284
|
-
q(s5, n4,
|
|
280
|
+
const r5 = t4[o6];
|
|
281
|
+
r5.candidate = n4[s5 + 2 * e7], r5.count = 0;
|
|
282
|
+
const { bounds: i5, leftCacheBounds: a4, rightCacheBounds: l4 } = r5;
|
|
283
|
+
for (let e8 = 0; e8 < 3; e8++) l4[e8] = 1 / 0, l4[e8 + 3] = -1 / 0, a4[e8] = 1 / 0, a4[e8 + 3] = -1 / 0, i5[e8] = 1 / 0, i5[e8 + 3] = -1 / 0;
|
|
284
|
+
q(s5, n4, i5);
|
|
285
285
|
}
|
|
286
286
|
t4.sort(Y);
|
|
287
287
|
let h4 = s4;
|
|
@@ -292,18 +292,18 @@ function ye(e4, t2, n2, o2, s2) {
|
|
|
292
292
|
for (let o7 = c4; o7 < d4; o7 += 6) {
|
|
293
293
|
const s5 = n4[o7 + 2 * e7];
|
|
294
294
|
for (let e8 = 0; e8 < h4; e8++) {
|
|
295
|
-
const
|
|
296
|
-
s5 >=
|
|
295
|
+
const r5 = t4[e8];
|
|
296
|
+
s5 >= r5.candidate ? q(o7, n4, r5.rightCacheBounds) : (q(o7, n4, r5.leftCacheBounds), r5.count++);
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
299
|
for (let n5 = 0; n5 < h4; n5++) {
|
|
300
300
|
const o7 = t4[n5], c5 = o7.count, d5 = s4 - o7.count, h5 = o7.leftCacheBounds, u4 = o7.rightCacheBounds;
|
|
301
301
|
let p3 = 0;
|
|
302
|
-
0 !== c5 && (p3 = W(h5) /
|
|
302
|
+
0 !== c5 && (p3 = W(h5) / r4);
|
|
303
303
|
let m3 = 0;
|
|
304
|
-
0 !== d5 && (m3 = W(u4) /
|
|
304
|
+
0 !== d5 && (m3 = W(u4) / r4);
|
|
305
305
|
const f3 = 1 + k * (p3 * c5 + m3 * d5);
|
|
306
|
-
f3 < l3 && (
|
|
306
|
+
f3 < l3 && (i4 = e7, l3 = f3, a3 = o7.candidate);
|
|
307
307
|
}
|
|
308
308
|
} else {
|
|
309
309
|
for (let e8 = 0; e8 < J; e8++) {
|
|
@@ -315,8 +315,8 @@ function ye(e4, t2, n2, o2, s2) {
|
|
|
315
315
|
for (let t5 = c4; t5 < d4; t5 += 6) {
|
|
316
316
|
let s5 = ~~((n4[t5 + 2 * e7] - o5) / h3);
|
|
317
317
|
s5 >= J && (s5 = 31);
|
|
318
|
-
const
|
|
319
|
-
|
|
318
|
+
const r5 = K[s5];
|
|
319
|
+
r5.count++, q(t5, n4, r5.bounds);
|
|
320
320
|
}
|
|
321
321
|
const t4 = K[31];
|
|
322
322
|
$(t4.bounds, t4.rightCacheBounds);
|
|
@@ -329,24 +329,24 @@ function ye(e4, t2, n2, o2, s2) {
|
|
|
329
329
|
const n5 = K[t5], o6 = n5.count, c5 = n5.bounds, d5 = K[t5 + 1].rightCacheBounds;
|
|
330
330
|
0 !== o6 && (0 === u4 ? $(c5, Z) : X(c5, Z, Z)), u4 += o6;
|
|
331
331
|
let h4 = 0, p3 = 0;
|
|
332
|
-
0 !== u4 && (h4 = W(Z) /
|
|
332
|
+
0 !== u4 && (h4 = W(Z) / r4);
|
|
333
333
|
const m3 = s4 - u4;
|
|
334
|
-
0 !== m3 && (p3 = W(d5) /
|
|
334
|
+
0 !== m3 && (p3 = W(d5) / r4);
|
|
335
335
|
const f3 = 1 + k * (h4 * u4 + p3 * m3);
|
|
336
|
-
f3 < l3 && (
|
|
336
|
+
f3 < l3 && (i4 = e7, l3 = f3, a3 = n5.candidate);
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
340
|
}
|
|
341
|
-
return { axis:
|
|
342
|
-
})(n3.boundingData,
|
|
341
|
+
return { axis: i4, pos: a3 };
|
|
342
|
+
})(n3.boundingData, i3, t2, o3, s3, l2);
|
|
343
343
|
if (-1 === d3.axis) return b2(o3 + s3), n3.offset = o3, n3.count = s3, n3;
|
|
344
344
|
const u3 = m2(h2, p2, t2, o3, s3, d3);
|
|
345
345
|
if (u3 === o3 || u3 === o3 + s3) b2(o3 + s3), n3.offset = o3, n3.count = s3;
|
|
346
346
|
else {
|
|
347
347
|
n3.splitAxis = d3.axis;
|
|
348
|
-
const
|
|
349
|
-
n3.left =
|
|
348
|
+
const r3 = new Q(), i4 = o3, a3 = u3 - o3;
|
|
349
|
+
n3.left = r3, G(t2, i4, a3, r3.boundingData, g2), e5(r3, i4, a3, g2, c3 + 1);
|
|
350
350
|
const l3 = new Q(), h3 = u3, p3 = s3 - a3;
|
|
351
351
|
n3.right = l3, G(t2, h3, p3, l3.boundingData, g2), e5(l3, h3, p3, g2, c3 + 1);
|
|
352
352
|
}
|
|
@@ -359,43 +359,43 @@ function ye(e4, t2, n2, o2, s2) {
|
|
|
359
359
|
function ve(e4, t2) {
|
|
360
360
|
const n2 = e4.geometry;
|
|
361
361
|
t2.indirect && (e4._indirectBuffer = (function(e5, t3) {
|
|
362
|
-
const n3 = (e5.index ? e5.index.count : e5.attributes.position.count) / 3, o3 = n3 > 65536, s3 = o3 ? 4 : 2,
|
|
363
|
-
for (let e6 = 0, t4 =
|
|
364
|
-
return
|
|
362
|
+
const n3 = (e5.index ? e5.index.count : e5.attributes.position.count) / 3, o3 = n3 > 65536, s3 = o3 ? 4 : 2, r3 = t3 ? new SharedArrayBuffer(n3 * s3) : new ArrayBuffer(n3 * s3), i2 = o3 ? new Uint32Array(r3) : new Uint16Array(r3);
|
|
363
|
+
for (let e6 = 0, t4 = i2.length; e6 < t4; e6++) i2[e6] = e6;
|
|
364
|
+
return i2;
|
|
365
365
|
})(n2, t2.useSharedArrayBuffer), (function(e5, t3) {
|
|
366
366
|
const n3 = R(e5), o3 = H(e5, t3).sort((e6, t4) => e6.offset - t4.offset), s3 = o3[o3.length - 1];
|
|
367
367
|
s3.count = Math.min(n3 - s3.offset, s3.count);
|
|
368
|
-
let
|
|
369
|
-
return o3.forEach(({ count: e6 }) =>
|
|
368
|
+
let r3 = 0;
|
|
369
|
+
return o3.forEach(({ count: e6 }) => r3 += e6), n3 !== r3;
|
|
370
370
|
})(n2, t2.range) && t2.verbose), e4._indirectBuffer || U(n2, t2);
|
|
371
371
|
const o2 = t2.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer, s2 = (function(e5, t3 = null, n3 = null, o3 = null) {
|
|
372
|
-
const s3 = e5.attributes.position,
|
|
372
|
+
const s3 = e5.attributes.position, r3 = e5.index ? e5.index.array : null, i2 = R(e5), a2 = s3.normalized;
|
|
373
373
|
let l2;
|
|
374
|
-
null === t3 ? (l2 = new Float32Array(6 *
|
|
374
|
+
null === t3 ? (l2 = new Float32Array(6 * i2), n3 = 0, o3 = i2) : (l2 = t3, n3 = n3 || 0, o3 = o3 || i2);
|
|
375
375
|
const c2 = s3.array, d2 = s3.offset || 0;
|
|
376
376
|
let h2 = 3;
|
|
377
377
|
s3.isInterleavedBufferAttribute && (h2 = s3.data.stride);
|
|
378
378
|
const u2 = ["getX", "getY", "getZ"];
|
|
379
379
|
for (let e6 = n3; e6 < n3 + o3; e6++) {
|
|
380
380
|
const t4 = 3 * e6, n4 = 6 * e6;
|
|
381
|
-
let o4 = t4 + 0,
|
|
382
|
-
|
|
381
|
+
let o4 = t4 + 0, i3 = t4 + 1, p2 = t4 + 2;
|
|
382
|
+
r3 && (o4 = r3[o4], i3 = r3[i3], p2 = r3[p2]), a2 || (o4 = o4 * h2 + d2, i3 = i3 * h2 + d2, p2 = p2 * h2 + d2);
|
|
383
383
|
for (let e7 = 0; e7 < 3; e7++) {
|
|
384
|
-
let t5,
|
|
385
|
-
a2 ? (t5 = s3[u2[e7]](o4),
|
|
384
|
+
let t5, r4, d3;
|
|
385
|
+
a2 ? (t5 = s3[u2[e7]](o4), r4 = s3[u2[e7]](i3), d3 = s3[u2[e7]](p2)) : (t5 = c2[o4 + e7], r4 = c2[i3 + e7], d3 = c2[p2 + e7]);
|
|
386
386
|
let h3 = t5;
|
|
387
|
-
|
|
387
|
+
r4 < h3 && (h3 = r4), d3 < h3 && (h3 = d3);
|
|
388
388
|
let m2 = t5;
|
|
389
|
-
|
|
389
|
+
r4 > m2 && (m2 = r4), d3 > m2 && (m2 = d3);
|
|
390
390
|
const f2 = (m2 - h3) / 2, g2 = 2 * e7;
|
|
391
|
-
l2[n4 + g2 + 0] = h3 + f2, l2[n4 + g2 + 1] = f2 + (Math.abs(h3) + f2) *
|
|
391
|
+
l2[n4 + g2 + 0] = h3 + f2, l2[n4 + g2 + 1] = f2 + (Math.abs(h3) + f2) * D;
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
394
|
return l2;
|
|
395
|
-
})(n2),
|
|
396
|
-
e4._roots =
|
|
397
|
-
const
|
|
398
|
-
return fe(0,
|
|
395
|
+
})(n2), r2 = t2.indirect ? I(n2, t2.range) : H(n2, t2.range);
|
|
396
|
+
e4._roots = r2.map((n3) => {
|
|
397
|
+
const r3 = ye(e4, s2, n3.offset, n3.count, t2), i2 = me(r3), a2 = new o2(32 * i2);
|
|
398
|
+
return fe(0, r3, a2), a2;
|
|
399
399
|
});
|
|
400
400
|
}
|
|
401
401
|
class be {
|
|
@@ -404,17 +404,17 @@ class be {
|
|
|
404
404
|
}
|
|
405
405
|
setFromPointsField(e4, t2) {
|
|
406
406
|
let n2 = 1 / 0, o2 = -1 / 0;
|
|
407
|
-
for (let s2 = 0,
|
|
408
|
-
const
|
|
409
|
-
n2 =
|
|
407
|
+
for (let s2 = 0, r2 = e4.length; s2 < r2; s2++) {
|
|
408
|
+
const r3 = e4[s2][t2];
|
|
409
|
+
n2 = r3 < n2 ? r3 : n2, o2 = r3 > o2 ? r3 : o2;
|
|
410
410
|
}
|
|
411
411
|
this.min = n2, this.max = o2;
|
|
412
412
|
}
|
|
413
413
|
setFromPoints(e4, t2) {
|
|
414
414
|
let n2 = 1 / 0, o2 = -1 / 0;
|
|
415
|
-
for (let s2 = 0,
|
|
416
|
-
const
|
|
417
|
-
n2 =
|
|
415
|
+
for (let s2 = 0, r2 = t2.length; s2 < r2; s2++) {
|
|
416
|
+
const r3 = t2[s2], i2 = e4.dot(r3);
|
|
417
|
+
n2 = i2 < n2 ? i2 : n2, o2 = i2 > o2 ? i2 : o2;
|
|
418
418
|
}
|
|
419
419
|
this.min = n2, this.max = o2;
|
|
420
420
|
}
|
|
@@ -426,53 +426,53 @@ be.prototype.setFromBox = (function() {
|
|
|
426
426
|
const e4 = new t.Vector3();
|
|
427
427
|
return function(t2, n2) {
|
|
428
428
|
const o2 = n2.min, s2 = n2.max;
|
|
429
|
-
let
|
|
429
|
+
let r2 = 1 / 0, i2 = -1 / 0;
|
|
430
430
|
for (let n3 = 0; n3 <= 1; n3++) for (let a2 = 0; a2 <= 1; a2++) for (let l2 = 0; l2 <= 1; l2++) {
|
|
431
431
|
e4.x = o2.x * n3 + s2.x * (1 - n3), e4.y = o2.y * a2 + s2.y * (1 - a2), e4.z = o2.z * l2 + s2.z * (1 - l2);
|
|
432
432
|
const c2 = t2.dot(e4);
|
|
433
|
-
|
|
433
|
+
r2 = Math.min(c2, r2), i2 = Math.max(c2, i2);
|
|
434
434
|
}
|
|
435
|
-
this.min =
|
|
435
|
+
this.min = r2, this.max = i2;
|
|
436
436
|
};
|
|
437
437
|
})();
|
|
438
438
|
const we = (function() {
|
|
439
439
|
const e4 = new t.Vector3(), n2 = new t.Vector3(), o2 = new t.Vector3();
|
|
440
|
-
return function(t2, s2,
|
|
441
|
-
const
|
|
442
|
-
o2.subVectors(
|
|
440
|
+
return function(t2, s2, r2) {
|
|
441
|
+
const i2 = t2.start, a2 = e4, l2 = s2.start, c2 = n2;
|
|
442
|
+
o2.subVectors(i2, l2), e4.subVectors(t2.end, t2.start), n2.subVectors(s2.end, s2.start);
|
|
443
443
|
const d2 = o2.dot(c2), h2 = c2.dot(a2), u2 = c2.dot(c2), p2 = o2.dot(a2), m2 = a2.dot(a2) * u2 - h2 * h2;
|
|
444
444
|
let f2, g2;
|
|
445
|
-
f2 = 0 !== m2 ? (d2 * h2 - p2 * u2) / m2 : 0, g2 = (d2 + f2 * h2) / u2,
|
|
445
|
+
f2 = 0 !== m2 ? (d2 * h2 - p2 * u2) / m2 : 0, g2 = (d2 + f2 * h2) / u2, r2.x = f2, r2.y = g2;
|
|
446
446
|
};
|
|
447
447
|
})(), xe = (function() {
|
|
448
448
|
const e4 = new t.Vector2(), n2 = new t.Vector3(), o2 = new t.Vector3();
|
|
449
|
-
return function(t2, s2,
|
|
449
|
+
return function(t2, s2, r2, i2) {
|
|
450
450
|
we(t2, s2, e4);
|
|
451
451
|
let a2 = e4.x, l2 = e4.y;
|
|
452
|
-
if (a2 >= 0 && a2 <= 1 && l2 >= 0 && l2 <= 1) return t2.at(a2,
|
|
453
|
-
if (a2 >= 0 && a2 <= 1) return l2 < 0 ? s2.at(0,
|
|
454
|
-
if (l2 >= 0 && l2 <= 1) return a2 < 0 ? t2.at(0,
|
|
452
|
+
if (a2 >= 0 && a2 <= 1 && l2 >= 0 && l2 <= 1) return t2.at(a2, r2), void s2.at(l2, i2);
|
|
453
|
+
if (a2 >= 0 && a2 <= 1) return l2 < 0 ? s2.at(0, i2) : s2.at(1, i2), void t2.closestPointToPoint(i2, true, r2);
|
|
454
|
+
if (l2 >= 0 && l2 <= 1) return a2 < 0 ? t2.at(0, r2) : t2.at(1, r2), void s2.closestPointToPoint(r2, true, i2);
|
|
455
455
|
{
|
|
456
456
|
let e5, c2;
|
|
457
457
|
e5 = a2 < 0 ? t2.start : t2.end, c2 = l2 < 0 ? s2.start : s2.end;
|
|
458
458
|
const d2 = n2, h2 = o2;
|
|
459
|
-
return t2.closestPointToPoint(c2, true, n2), s2.closestPointToPoint(e5, true, o2), d2.distanceToSquared(c2) <= h2.distanceToSquared(e5) ? (
|
|
459
|
+
return t2.closestPointToPoint(c2, true, n2), s2.closestPointToPoint(e5, true, o2), d2.distanceToSquared(c2) <= h2.distanceToSquared(e5) ? (r2.copy(d2), void i2.copy(c2)) : (r2.copy(e5), void i2.copy(h2));
|
|
460
460
|
}
|
|
461
461
|
};
|
|
462
462
|
})(), _e = (function() {
|
|
463
463
|
const e4 = new t.Vector3(), n2 = new t.Vector3(), o2 = new t.Plane(), s2 = new t.Line3();
|
|
464
|
-
return function(t2,
|
|
465
|
-
const { radius:
|
|
464
|
+
return function(t2, r2) {
|
|
465
|
+
const { radius: i2, center: a2 } = t2, { a: l2, b: c2, c: d2 } = r2;
|
|
466
466
|
s2.start = l2, s2.end = c2;
|
|
467
|
-
if (s2.closestPointToPoint(a2, true, e4).distanceTo(a2) <=
|
|
467
|
+
if (s2.closestPointToPoint(a2, true, e4).distanceTo(a2) <= i2) return true;
|
|
468
468
|
s2.start = l2, s2.end = d2;
|
|
469
|
-
if (s2.closestPointToPoint(a2, true, e4).distanceTo(a2) <=
|
|
469
|
+
if (s2.closestPointToPoint(a2, true, e4).distanceTo(a2) <= i2) return true;
|
|
470
470
|
s2.start = c2, s2.end = d2;
|
|
471
|
-
if (s2.closestPointToPoint(a2, true, e4).distanceTo(a2) <=
|
|
472
|
-
const h2 =
|
|
473
|
-
if (Math.abs(h2.distanceToPoint(a2)) <=
|
|
471
|
+
if (s2.closestPointToPoint(a2, true, e4).distanceTo(a2) <= i2) return true;
|
|
472
|
+
const h2 = r2.getPlane(o2);
|
|
473
|
+
if (Math.abs(h2.distanceToPoint(a2)) <= i2) {
|
|
474
474
|
const e5 = h2.projectPoint(a2, n2);
|
|
475
|
-
if (
|
|
475
|
+
if (r2.containsPoint(e5)) return true;
|
|
476
476
|
}
|
|
477
477
|
return false;
|
|
478
478
|
};
|
|
@@ -488,49 +488,49 @@ class Me extends t.Triangle {
|
|
|
488
488
|
return _e(e4, this);
|
|
489
489
|
}
|
|
490
490
|
update() {
|
|
491
|
-
const e4 = this.a, t2 = this.b, n2 = this.c, o2 = this.points, s2 = this.satAxes,
|
|
492
|
-
this.getNormal(
|
|
493
|
-
const l2 = s2[1], c2 =
|
|
491
|
+
const e4 = this.a, t2 = this.b, n2 = this.c, o2 = this.points, s2 = this.satAxes, r2 = this.satBounds, i2 = s2[0], a2 = r2[0];
|
|
492
|
+
this.getNormal(i2), a2.setFromPoints(i2, o2);
|
|
493
|
+
const l2 = s2[1], c2 = r2[1];
|
|
494
494
|
l2.subVectors(e4, t2), c2.setFromPoints(l2, o2);
|
|
495
|
-
const d2 = s2[2], h2 =
|
|
495
|
+
const d2 = s2[2], h2 = r2[2];
|
|
496
496
|
d2.subVectors(t2, n2), h2.setFromPoints(d2, o2);
|
|
497
|
-
const u2 = s2[3], p2 =
|
|
498
|
-
u2.subVectors(n2, e4), p2.setFromPoints(u2, o2), this.sphere.setFromPoints(this.points), this.plane.setFromNormalAndCoplanarPoint(
|
|
497
|
+
const u2 = s2[3], p2 = r2[3];
|
|
498
|
+
u2.subVectors(n2, e4), p2.setFromPoints(u2, o2), this.sphere.setFromPoints(this.points), this.plane.setFromNormalAndCoplanarPoint(i2, e4), this.needsUpdate = false;
|
|
499
499
|
}
|
|
500
500
|
}
|
|
501
501
|
Me.prototype.closestPointToSegment = (function() {
|
|
502
502
|
const e4 = new t.Vector3(), n2 = new t.Vector3(), o2 = new t.Line3();
|
|
503
|
-
return function(t2, s2 = null,
|
|
504
|
-
const { start:
|
|
503
|
+
return function(t2, s2 = null, r2 = null) {
|
|
504
|
+
const { start: i2, end: a2 } = t2, l2 = this.points;
|
|
505
505
|
let c2, d2 = 1 / 0;
|
|
506
|
-
for (let
|
|
507
|
-
const a3 = (
|
|
508
|
-
o2.start.copy(l2[
|
|
506
|
+
for (let i3 = 0; i3 < 3; i3++) {
|
|
507
|
+
const a3 = (i3 + 1) % 3;
|
|
508
|
+
o2.start.copy(l2[i3]), o2.end.copy(l2[a3]), xe(o2, t2, e4, n2), c2 = e4.distanceToSquared(n2), c2 < d2 && (d2 = c2, s2 && s2.copy(e4), r2 && r2.copy(n2));
|
|
509
509
|
}
|
|
510
|
-
return this.closestPointToPoint(
|
|
510
|
+
return this.closestPointToPoint(i2, e4), c2 = i2.distanceToSquared(e4), c2 < d2 && (d2 = c2, s2 && s2.copy(e4), r2 && r2.copy(i2)), this.closestPointToPoint(a2, e4), c2 = a2.distanceToSquared(e4), c2 < d2 && (d2 = c2, s2 && s2.copy(e4), r2 && r2.copy(a2)), Math.sqrt(d2);
|
|
511
511
|
};
|
|
512
512
|
})(), Me.prototype.intersectsTriangle = (function() {
|
|
513
|
-
const e4 = new Me(), n2 = new Array(3), o2 = new Array(3), s2 = new be(),
|
|
513
|
+
const e4 = new Me(), n2 = new Array(3), o2 = new Array(3), s2 = new be(), r2 = new be(), i2 = new t.Vector3(), a2 = new t.Vector3(), l2 = new t.Vector3(), c2 = new t.Vector3(), d2 = new t.Vector3(), h2 = new t.Line3(), u2 = new t.Line3(), p2 = new t.Line3(), m2 = new t.Vector3();
|
|
514
514
|
function f2(e5, t2, n3) {
|
|
515
515
|
const o3 = e5.points;
|
|
516
|
-
let s3 = 0,
|
|
516
|
+
let s3 = 0, r3 = -1;
|
|
517
517
|
for (let e6 = 0; e6 < 3; e6++) {
|
|
518
|
-
const { start:
|
|
519
|
-
|
|
520
|
-
const c3 = Ce(t2.distanceToPoint(
|
|
518
|
+
const { start: i3, end: l3 } = h2;
|
|
519
|
+
i3.copy(o3[e6]), l3.copy(o3[(e6 + 1) % 3]), h2.delta(a2);
|
|
520
|
+
const c3 = Ce(t2.distanceToPoint(i3));
|
|
521
521
|
if (Ce(t2.normal.dot(a2)) && c3) {
|
|
522
522
|
n3.copy(h2), s3 = 2;
|
|
523
523
|
break;
|
|
524
524
|
}
|
|
525
525
|
const d3 = t2.intersectLine(h2, m2);
|
|
526
|
-
if (!d3 && c3 && m2.copy(
|
|
526
|
+
if (!d3 && c3 && m2.copy(i3), (d3 || c3) && !Ce(m2.distanceTo(l3))) {
|
|
527
527
|
if (s3 <= 1) {
|
|
528
|
-
(1 === s3 ? n3.start : n3.end).copy(m2), c3 && (
|
|
528
|
+
(1 === s3 ? n3.start : n3.end).copy(m2), c3 && (r3 = s3);
|
|
529
529
|
} else if (s3 >= 2) {
|
|
530
|
-
(1 ===
|
|
530
|
+
(1 === r3 ? n3.start : n3.end).copy(m2), s3 = 2;
|
|
531
531
|
break;
|
|
532
532
|
}
|
|
533
|
-
if (s3++, 2 === s3 && -1 ===
|
|
533
|
+
if (s3++, 2 === s3 && -1 === r3) break;
|
|
534
534
|
}
|
|
535
535
|
}
|
|
536
536
|
return s3;
|
|
@@ -542,8 +542,8 @@ Me.prototype.closestPointToSegment = (function() {
|
|
|
542
542
|
const e5 = this.satBounds, l3 = this.satAxes;
|
|
543
543
|
o2[0] = t2.a, o2[1] = t2.b, o2[2] = t2.c;
|
|
544
544
|
for (let t3 = 0; t3 < 4; t3++) {
|
|
545
|
-
const n3 = e5[t3],
|
|
546
|
-
if (s2.setFromPoints(
|
|
545
|
+
const n3 = e5[t3], r3 = l3[t3];
|
|
546
|
+
if (s2.setFromPoints(r3, o2), n3.isSeparated(s2)) return false;
|
|
547
547
|
}
|
|
548
548
|
const c3 = t2.satBounds, d3 = t2.satAxes;
|
|
549
549
|
n2[0] = this.a, n2[1] = this.b, n2[2] = this.c;
|
|
@@ -555,7 +555,7 @@ Me.prototype.closestPointToSegment = (function() {
|
|
|
555
555
|
const t3 = l3[e6];
|
|
556
556
|
for (let e7 = 0; e7 < 4; e7++) {
|
|
557
557
|
const a4 = d3[e7];
|
|
558
|
-
if (
|
|
558
|
+
if (i2.crossVectors(t3, a4), s2.setFromPoints(i2, n2), r2.setFromPoints(i2, o2), s2.isSeparated(r2)) return false;
|
|
559
559
|
}
|
|
560
560
|
}
|
|
561
561
|
return a3 && (a3.start.set(0, 0, 0), a3.end.set(0, 0, 0)), true;
|
|
@@ -571,8 +571,8 @@ Me.prototype.closestPointToSegment = (function() {
|
|
|
571
571
|
let e6 = p2.start;
|
|
572
572
|
p2.start = p2.end, p2.end = e6;
|
|
573
573
|
}
|
|
574
|
-
const o3 = u2.start.dot(l2), s3 = u2.end.dot(l2),
|
|
575
|
-
return (o3 ===
|
|
574
|
+
const o3 = u2.start.dot(l2), s3 = u2.end.dot(l2), r3 = p2.start.dot(l2), i3 = p2.end.dot(l2);
|
|
575
|
+
return (o3 === i3 || r3 === s3 || s3 < r3 !== o3 < i3) && (a3 && (d2.subVectors(u2.start, p2.start), d2.dot(l2) > 0 ? a3.start.copy(u2.start) : a3.start.copy(p2.start), d2.subVectors(u2.end, p2.end), d2.dot(l2) < 0 ? a3.end.copy(u2.end) : a3.end.copy(p2.end)), true);
|
|
576
576
|
}
|
|
577
577
|
};
|
|
578
578
|
})(), Me.prototype.distanceToPoint = (function() {
|
|
@@ -581,26 +581,26 @@ Me.prototype.closestPointToSegment = (function() {
|
|
|
581
581
|
return this.closestPointToPoint(t2, e4), t2.distanceTo(e4);
|
|
582
582
|
};
|
|
583
583
|
})(), Me.prototype.distanceToTriangle = (function() {
|
|
584
|
-
const e4 = new t.Vector3(), n2 = new t.Vector3(), o2 = ["a", "b", "c"], s2 = new t.Line3(),
|
|
585
|
-
return function(t2,
|
|
586
|
-
const l2 =
|
|
587
|
-
if (this.intersectsTriangle(t2, l2)) return (
|
|
584
|
+
const e4 = new t.Vector3(), n2 = new t.Vector3(), o2 = ["a", "b", "c"], s2 = new t.Line3(), r2 = new t.Line3();
|
|
585
|
+
return function(t2, i2 = null, a2 = null) {
|
|
586
|
+
const l2 = i2 || a2 ? s2 : null;
|
|
587
|
+
if (this.intersectsTriangle(t2, l2)) return (i2 || a2) && (i2 && l2.getCenter(i2), a2 && l2.getCenter(a2)), 0;
|
|
588
588
|
let c2 = 1 / 0;
|
|
589
589
|
for (let n3 = 0; n3 < 3; n3++) {
|
|
590
590
|
let s3;
|
|
591
|
-
const
|
|
592
|
-
this.closestPointToPoint(l3, e4), s3 = l3.distanceToSquared(e4), s3 < c2 && (c2 = s3,
|
|
593
|
-
const d2 = this[
|
|
594
|
-
t2.closestPointToPoint(d2, e4), s3 = d2.distanceToSquared(e4), s3 < c2 && (c2 = s3,
|
|
591
|
+
const r3 = o2[n3], l3 = t2[r3];
|
|
592
|
+
this.closestPointToPoint(l3, e4), s3 = l3.distanceToSquared(e4), s3 < c2 && (c2 = s3, i2 && i2.copy(e4), a2 && a2.copy(l3));
|
|
593
|
+
const d2 = this[r3];
|
|
594
|
+
t2.closestPointToPoint(d2, e4), s3 = d2.distanceToSquared(e4), s3 < c2 && (c2 = s3, i2 && i2.copy(d2), a2 && a2.copy(e4));
|
|
595
595
|
}
|
|
596
596
|
for (let l3 = 0; l3 < 3; l3++) {
|
|
597
597
|
const d2 = o2[l3], h2 = o2[(l3 + 1) % 3];
|
|
598
598
|
s2.set(this[d2], this[h2]);
|
|
599
599
|
for (let l4 = 0; l4 < 3; l4++) {
|
|
600
600
|
const d3 = o2[l4], h3 = o2[(l4 + 1) % 3];
|
|
601
|
-
|
|
601
|
+
r2.set(t2[d3], t2[h3]), xe(s2, r2, e4, n2);
|
|
602
602
|
const u2 = e4.distanceToSquared(n2);
|
|
603
|
-
u2 < c2 && (c2 = u2,
|
|
603
|
+
u2 < c2 && (c2 = u2, i2 && i2.copy(e4), a2 && a2.copy(n2));
|
|
604
604
|
}
|
|
605
605
|
}
|
|
606
606
|
return Math.sqrt(c2);
|
|
@@ -619,14 +619,14 @@ class Pe {
|
|
|
619
619
|
}
|
|
620
620
|
Pe.prototype.update = function() {
|
|
621
621
|
const e4 = this.matrix, t2 = this.min, n2 = this.max, o2 = this.points;
|
|
622
|
-
for (let s3 = 0; s3 <= 1; s3++) for (let
|
|
623
|
-
const a3 = o2[1 * s3 | 2 *
|
|
624
|
-
a3.x = s3 ? n2.x : t2.x, a3.y =
|
|
622
|
+
for (let s3 = 0; s3 <= 1; s3++) for (let r3 = 0; r3 <= 1; r3++) for (let i3 = 0; i3 <= 1; i3++) {
|
|
623
|
+
const a3 = o2[1 * s3 | 2 * r3 | 4 * i3];
|
|
624
|
+
a3.x = s3 ? n2.x : t2.x, a3.y = r3 ? n2.y : t2.y, a3.z = i3 ? n2.z : t2.z, a3.applyMatrix4(e4);
|
|
625
625
|
}
|
|
626
|
-
const s2 = this.satBounds,
|
|
626
|
+
const s2 = this.satBounds, r2 = this.satAxes, i2 = o2[0];
|
|
627
627
|
for (let e5 = 0; e5 < 3; e5++) {
|
|
628
|
-
const t3 =
|
|
629
|
-
t3.subVectors(
|
|
628
|
+
const t3 = r2[e5], n3 = s2[e5], a3 = o2[1 << e5];
|
|
629
|
+
t3.subVectors(i2, a3), n3.setFromPoints(t3, o2);
|
|
630
630
|
}
|
|
631
631
|
const a2 = this.alignedSatBounds;
|
|
632
632
|
a2[0].setFromPointsField(o2, "x"), a2[1].setFromPointsField(o2, "y"), a2[2].setFromPointsField(o2, "z"), this.invMatrix.copy(this.matrix).invert(), this.needsUpdate = false;
|
|
@@ -634,24 +634,24 @@ Pe.prototype.update = function() {
|
|
|
634
634
|
const e4 = new be();
|
|
635
635
|
return function(t2) {
|
|
636
636
|
this.needsUpdate && this.update();
|
|
637
|
-
const n2 = t2.min, o2 = t2.max, s2 = this.satBounds,
|
|
638
|
-
if (e4.min = n2.x, e4.max = o2.x,
|
|
639
|
-
if (e4.min = n2.y, e4.max = o2.y,
|
|
640
|
-
if (e4.min = n2.z, e4.max = o2.z,
|
|
637
|
+
const n2 = t2.min, o2 = t2.max, s2 = this.satBounds, r2 = this.satAxes, i2 = this.alignedSatBounds;
|
|
638
|
+
if (e4.min = n2.x, e4.max = o2.x, i2[0].isSeparated(e4)) return false;
|
|
639
|
+
if (e4.min = n2.y, e4.max = o2.y, i2[1].isSeparated(e4)) return false;
|
|
640
|
+
if (e4.min = n2.z, e4.max = o2.z, i2[2].isSeparated(e4)) return false;
|
|
641
641
|
for (let n3 = 0; n3 < 3; n3++) {
|
|
642
|
-
const o3 =
|
|
643
|
-
if (e4.setFromBox(o3, t2),
|
|
642
|
+
const o3 = r2[n3], i3 = s2[n3];
|
|
643
|
+
if (e4.setFromBox(o3, t2), i3.isSeparated(e4)) return false;
|
|
644
644
|
}
|
|
645
645
|
return true;
|
|
646
646
|
};
|
|
647
647
|
})(), Pe.prototype.intersectsTriangle = (function() {
|
|
648
|
-
const e4 = new Me(), n2 = new Array(3), o2 = new be(), s2 = new be(),
|
|
648
|
+
const e4 = new Me(), n2 = new Array(3), o2 = new be(), s2 = new be(), r2 = new t.Vector3();
|
|
649
649
|
return function(t2) {
|
|
650
650
|
this.needsUpdate && this.update(), t2.isExtendedTriangle ? t2.needsUpdate && t2.update() : (e4.copy(t2), e4.update(), t2 = e4);
|
|
651
|
-
const
|
|
651
|
+
const i2 = this.satBounds, a2 = this.satAxes;
|
|
652
652
|
n2[0] = t2.a, n2[1] = t2.b, n2[2] = t2.c;
|
|
653
653
|
for (let e5 = 0; e5 < 3; e5++) {
|
|
654
|
-
const t3 =
|
|
654
|
+
const t3 = i2[e5], s3 = a2[e5];
|
|
655
655
|
if (o2.setFromPoints(s3, n2), t3.isSeparated(o2)) return false;
|
|
656
656
|
}
|
|
657
657
|
const l2 = t2.satBounds, c2 = t2.satAxes, d2 = this.points;
|
|
@@ -662,8 +662,8 @@ Pe.prototype.update = function() {
|
|
|
662
662
|
for (let e5 = 0; e5 < 3; e5++) {
|
|
663
663
|
const t3 = a2[e5];
|
|
664
664
|
for (let e6 = 0; e6 < 4; e6++) {
|
|
665
|
-
const
|
|
666
|
-
if (
|
|
665
|
+
const i3 = c2[e6];
|
|
666
|
+
if (r2.crossVectors(t3, i3), o2.setFromPoints(r2, n2), s2.setFromPoints(r2, d2), o2.isSeparated(s2)) return false;
|
|
667
667
|
}
|
|
668
668
|
}
|
|
669
669
|
return true;
|
|
@@ -676,36 +676,36 @@ Pe.prototype.update = function() {
|
|
|
676
676
|
return this.closestPointToPoint(t2, e4), t2.distanceTo(e4);
|
|
677
677
|
};
|
|
678
678
|
})(), Pe.prototype.distanceToBox = (function() {
|
|
679
|
-
const e4 = ["x", "y", "z"], n2 = new Array(12).fill().map(() => new t.Line3()), o2 = new Array(12).fill().map(() => new t.Line3()), s2 = new t.Vector3(),
|
|
680
|
-
return function(t2,
|
|
681
|
-
if (this.needsUpdate && this.update(), this.intersectsBox(t2)) return (a2 || l2) && (t2.getCenter(
|
|
682
|
-
const c2 =
|
|
679
|
+
const e4 = ["x", "y", "z"], n2 = new Array(12).fill().map(() => new t.Line3()), o2 = new Array(12).fill().map(() => new t.Line3()), s2 = new t.Vector3(), r2 = new t.Vector3();
|
|
680
|
+
return function(t2, i2 = 0, a2 = null, l2 = null) {
|
|
681
|
+
if (this.needsUpdate && this.update(), this.intersectsBox(t2)) return (a2 || l2) && (t2.getCenter(r2), this.closestPointToPoint(r2, s2), t2.closestPointToPoint(s2, r2), a2 && a2.copy(s2), l2 && l2.copy(r2)), 0;
|
|
682
|
+
const c2 = i2 * i2, d2 = t2.min, h2 = t2.max, u2 = this.points;
|
|
683
683
|
let p2 = 1 / 0;
|
|
684
684
|
for (let e5 = 0; e5 < 8; e5++) {
|
|
685
685
|
const t3 = u2[e5];
|
|
686
|
-
|
|
687
|
-
const n3 = t3.distanceToSquared(
|
|
688
|
-
if (n3 < p2 && (p2 = n3, a2 && a2.copy(t3), l2 && l2.copy(
|
|
686
|
+
r2.copy(t3).clamp(d2, h2);
|
|
687
|
+
const n3 = t3.distanceToSquared(r2);
|
|
688
|
+
if (n3 < p2 && (p2 = n3, a2 && a2.copy(t3), l2 && l2.copy(r2), n3 < c2)) return Math.sqrt(n3);
|
|
689
689
|
}
|
|
690
690
|
let m2 = 0;
|
|
691
|
-
for (let t3 = 0; t3 < 3; t3++) for (let s3 = 0; s3 <= 1; s3++) for (let
|
|
692
|
-
const
|
|
691
|
+
for (let t3 = 0; t3 < 3; t3++) for (let s3 = 0; s3 <= 1; s3++) for (let r3 = 0; r3 <= 1; r3++) {
|
|
692
|
+
const i3 = (t3 + 1) % 3, a3 = (t3 + 2) % 3, l3 = 1 << t3 | s3 << i3 | r3 << a3, c3 = u2[s3 << i3 | r3 << a3], p3 = u2[l3];
|
|
693
693
|
n2[m2].set(c3, p3);
|
|
694
|
-
const f2 = e4[t3], g2 = e4[
|
|
695
|
-
b2[f2] = d2[f2], b2[g2] = s3 ? d2[g2] : h2[g2], b2[y2] =
|
|
694
|
+
const f2 = e4[t3], g2 = e4[i3], y2 = e4[a3], v2 = o2[m2], b2 = v2.start, w2 = v2.end;
|
|
695
|
+
b2[f2] = d2[f2], b2[g2] = s3 ? d2[g2] : h2[g2], b2[y2] = r3 ? d2[y2] : h2[g2], w2[f2] = h2[f2], w2[g2] = s3 ? d2[g2] : h2[g2], w2[y2] = r3 ? d2[y2] : h2[g2], m2++;
|
|
696
696
|
}
|
|
697
697
|
for (let e5 = 0; e5 <= 1; e5++) for (let t3 = 0; t3 <= 1; t3++) for (let n3 = 0; n3 <= 1; n3++) {
|
|
698
|
-
|
|
699
|
-
const o3 =
|
|
700
|
-
if (o3 < p2 && (p2 = o3, a2 && a2.copy(s2), l2 && l2.copy(
|
|
698
|
+
r2.x = e5 ? h2.x : d2.x, r2.y = t3 ? h2.y : d2.y, r2.z = n3 ? h2.z : d2.z, this.closestPointToPoint(r2, s2);
|
|
699
|
+
const o3 = r2.distanceToSquared(s2);
|
|
700
|
+
if (o3 < p2 && (p2 = o3, a2 && a2.copy(s2), l2 && l2.copy(r2), o3 < c2)) return Math.sqrt(o3);
|
|
701
701
|
}
|
|
702
702
|
for (let e5 = 0; e5 < 12; e5++) {
|
|
703
703
|
const t3 = n2[e5];
|
|
704
704
|
for (let e6 = 0; e6 < 12; e6++) {
|
|
705
705
|
const n3 = o2[e6];
|
|
706
|
-
xe(t3, n3, s2,
|
|
707
|
-
const
|
|
708
|
-
if (
|
|
706
|
+
xe(t3, n3, s2, r2);
|
|
707
|
+
const i3 = s2.distanceToSquared(r2);
|
|
708
|
+
if (i3 < p2 && (p2 = i3, a2 && a2.copy(s2), l2 && l2.copy(r2), i3 < c2)) return Math.sqrt(i3);
|
|
709
709
|
}
|
|
710
710
|
}
|
|
711
711
|
return Math.sqrt(p2);
|
|
@@ -743,33 +743,33 @@ const Fe = new class {
|
|
|
743
743
|
}();
|
|
744
744
|
let Ee, Be;
|
|
745
745
|
const Le = [], Oe = new Se(() => new t.Box3());
|
|
746
|
-
function ke(e4, t2, n2, o2, s2,
|
|
746
|
+
function ke(e4, t2, n2, o2, s2, r2) {
|
|
747
747
|
Ee = Oe.getPrimitive(), Be = Oe.getPrimitive(), Le.push(Ee, Be), Fe.setBuffer(e4._roots[t2]);
|
|
748
|
-
const
|
|
748
|
+
const i2 = je(0, e4.geometry, n2, o2, s2, r2);
|
|
749
749
|
Fe.clearBuffer(), Oe.releasePrimitive(Ee), Oe.releasePrimitive(Be), Le.pop(), Le.pop();
|
|
750
750
|
const a2 = Le.length;
|
|
751
|
-
return a2 > 0 && (Be = Le[a2 - 1], Ee = Le[a2 - 2]),
|
|
751
|
+
return a2 > 0 && (Be = Le[a2 - 1], Ee = Le[a2 - 2]), i2;
|
|
752
752
|
}
|
|
753
|
-
function je(e4, t2, n2, o2, s2 = null,
|
|
753
|
+
function je(e4, t2, n2, o2, s2 = null, r2 = 0, i2 = 0) {
|
|
754
754
|
const { float32Array: a2, uint16Array: l2, uint32Array: c2 } = Fe;
|
|
755
755
|
let d2 = 2 * e4;
|
|
756
756
|
if (ne(d2, l2)) {
|
|
757
757
|
const h2 = oe(e4, c2), u2 = se(d2, l2);
|
|
758
|
-
return V(e4, a2, Ee), o2(h2, u2, false,
|
|
758
|
+
return V(e4, a2, Ee), o2(h2, u2, false, i2, r2 + e4, Ee);
|
|
759
759
|
}
|
|
760
760
|
{
|
|
761
761
|
let P2 = function(e5) {
|
|
762
762
|
const { uint16Array: t3, uint32Array: n3 } = Fe;
|
|
763
763
|
let o3 = 2 * e5;
|
|
764
|
-
for (; !ne(o3, t3); ) o3 = 2 * (e5 =
|
|
764
|
+
for (; !ne(o3, t3); ) o3 = 2 * (e5 = re(e5));
|
|
765
765
|
return oe(e5, n3);
|
|
766
766
|
}, S2 = function(e5) {
|
|
767
767
|
const { uint16Array: t3, uint32Array: n3 } = Fe;
|
|
768
768
|
let o3 = 2 * e5;
|
|
769
|
-
for (; !ne(o3, t3); ) o3 = 2 * (e5 =
|
|
769
|
+
for (; !ne(o3, t3); ) o3 = 2 * (e5 = ie(e5, n3));
|
|
770
770
|
return oe(e5, n3) + se(o3, t3);
|
|
771
771
|
};
|
|
772
|
-
const p2 =
|
|
772
|
+
const p2 = re(e4), m2 = ie(e4, c2);
|
|
773
773
|
let f2, g2, y2, v2, b2 = p2, w2 = m2;
|
|
774
774
|
if (s2 && (y2 = Ee, v2 = Be, V(b2, a2, y2), V(w2, a2, v2), f2 = s2(y2), g2 = s2(v2), g2 < f2)) {
|
|
775
775
|
b2 = m2, w2 = p2;
|
|
@@ -777,83 +777,83 @@ function je(e4, t2, n2, o2, s2 = null, i2 = 0, r2 = 0) {
|
|
|
777
777
|
f2 = g2, g2 = A2, y2 = v2;
|
|
778
778
|
}
|
|
779
779
|
y2 || (y2 = Ee, V(b2, a2, y2));
|
|
780
|
-
const x2 = n2(y2, ne(2 * b2, l2), f2,
|
|
780
|
+
const x2 = n2(y2, ne(2 * b2, l2), f2, i2 + 1, r2 + b2);
|
|
781
781
|
let _2;
|
|
782
782
|
if (2 === x2) {
|
|
783
783
|
const T2 = P2(b2);
|
|
784
|
-
_2 = o2(T2, S2(b2) - T2, true,
|
|
785
|
-
} else _2 = x2 && je(b2, t2, n2, o2, s2,
|
|
784
|
+
_2 = o2(T2, S2(b2) - T2, true, i2 + 1, r2 + b2, y2);
|
|
785
|
+
} else _2 = x2 && je(b2, t2, n2, o2, s2, r2, i2 + 1);
|
|
786
786
|
if (_2) return true;
|
|
787
787
|
v2 = Be, V(w2, a2, v2);
|
|
788
|
-
const C2 = n2(v2, ne(2 * w2, l2), g2,
|
|
788
|
+
const C2 = n2(v2, ne(2 * w2, l2), g2, i2 + 1, r2 + w2);
|
|
789
789
|
let M2;
|
|
790
790
|
if (2 === C2) {
|
|
791
791
|
const F2 = P2(w2);
|
|
792
|
-
M2 = o2(F2, S2(w2) - F2, true,
|
|
793
|
-
} else M2 = C2 && je(w2, t2, n2, o2, s2,
|
|
792
|
+
M2 = o2(F2, S2(w2) - F2, true, i2 + 1, r2 + w2, v2);
|
|
793
|
+
} else M2 = C2 && je(w2, t2, n2, o2, s2, r2, i2 + 1);
|
|
794
794
|
return !!M2;
|
|
795
795
|
}
|
|
796
796
|
}
|
|
797
|
-
const
|
|
797
|
+
const De = new t.Vector3(), ze = new t.Vector3();
|
|
798
798
|
const Re = parseInt(t.REVISION) >= 169, Ue = new t.Vector3(), Ie = new t.Vector3(), He = new t.Vector3(), Ge = new t.Vector2(), Ve = new t.Vector2(), Ne = new t.Vector2(), $e = new t.Vector3(), Xe = new t.Vector3(), qe = new t.Vector3(), We = new t.Vector3();
|
|
799
|
-
function Je(e4, n2, o2, s2,
|
|
800
|
-
Ue.fromBufferAttribute(n2,
|
|
801
|
-
const u2 = (function(e5, n3, o3, s3,
|
|
799
|
+
function Je(e4, n2, o2, s2, r2, i2, a2, l2, c2, d2, h2) {
|
|
800
|
+
Ue.fromBufferAttribute(n2, i2), Ie.fromBufferAttribute(n2, a2), He.fromBufferAttribute(n2, l2);
|
|
801
|
+
const u2 = (function(e5, n3, o3, s3, r3, i3, a3, l3) {
|
|
802
802
|
let c3;
|
|
803
|
-
if (c3 =
|
|
804
|
-
const d3 = e5.origin.distanceTo(
|
|
805
|
-
return d3 < a3 || d3 > l3 ? null : { distance: d3, point:
|
|
803
|
+
if (c3 = i3 === t.BackSide ? e5.intersectTriangle(s3, o3, n3, true, r3) : e5.intersectTriangle(n3, o3, s3, i3 !== t.DoubleSide, r3), null === c3) return null;
|
|
804
|
+
const d3 = e5.origin.distanceTo(r3);
|
|
805
|
+
return d3 < a3 || d3 > l3 ? null : { distance: d3, point: r3.clone() };
|
|
806
806
|
})(e4, Ue, Ie, He, We, c2, d2, h2);
|
|
807
807
|
if (u2) {
|
|
808
808
|
const n3 = new t.Vector3();
|
|
809
|
-
t.Triangle.getBarycoord(We, Ue, Ie, He, n3), s2 && (Ge.fromBufferAttribute(s2,
|
|
810
|
-
const c3 = { a:
|
|
811
|
-
t.Triangle.getNormal(Ue, Ie, He, c3.normal), u2.face = c3, u2.faceIndex =
|
|
809
|
+
t.Triangle.getBarycoord(We, Ue, Ie, He, n3), s2 && (Ge.fromBufferAttribute(s2, i2), Ve.fromBufferAttribute(s2, a2), Ne.fromBufferAttribute(s2, l2), u2.uv = t.Triangle.getInterpolation(We, Ue, Ie, He, Ge, Ve, Ne, new t.Vector2())), r2 && (Ge.fromBufferAttribute(r2, i2), Ve.fromBufferAttribute(r2, a2), Ne.fromBufferAttribute(r2, l2), u2.uv1 = t.Triangle.getInterpolation(We, Ue, Ie, He, Ge, Ve, Ne, new t.Vector2())), o2 && ($e.fromBufferAttribute(o2, i2), Xe.fromBufferAttribute(o2, a2), qe.fromBufferAttribute(o2, l2), u2.normal = t.Triangle.getInterpolation(We, Ue, Ie, He, $e, Xe, qe, new t.Vector3()), u2.normal.dot(e4.direction) > 0 && u2.normal.multiplyScalar(-1));
|
|
810
|
+
const c3 = { a: i2, b: a2, c: l2, normal: new t.Vector3(), materialIndex: 0 };
|
|
811
|
+
t.Triangle.getNormal(Ue, Ie, He, c3.normal), u2.face = c3, u2.faceIndex = i2, Re && (u2.barycoord = n3);
|
|
812
812
|
}
|
|
813
813
|
return u2;
|
|
814
814
|
}
|
|
815
|
-
function Ye(e4, t2, n2, o2, s2,
|
|
815
|
+
function Ye(e4, t2, n2, o2, s2, r2, i2) {
|
|
816
816
|
const a2 = 3 * o2;
|
|
817
817
|
let l2 = a2 + 0, c2 = a2 + 1, d2 = a2 + 2;
|
|
818
818
|
const h2 = e4.index;
|
|
819
819
|
e4.index && (l2 = h2.getX(l2), c2 = h2.getX(c2), d2 = h2.getX(d2));
|
|
820
|
-
const { position: u2, normal: p2, uv: m2, uv1: f2 } = e4.attributes, g2 = Je(n2, u2, p2, m2, f2, l2, c2, d2, t2,
|
|
820
|
+
const { position: u2, normal: p2, uv: m2, uv1: f2 } = e4.attributes, g2 = Je(n2, u2, p2, m2, f2, l2, c2, d2, t2, r2, i2);
|
|
821
821
|
return g2 ? (g2.faceIndex = o2, s2 && s2.push(g2), g2) : null;
|
|
822
822
|
}
|
|
823
823
|
function Ke(e4, t2, n2, o2) {
|
|
824
|
-
const s2 = e4.a,
|
|
824
|
+
const s2 = e4.a, r2 = e4.b, i2 = e4.c;
|
|
825
825
|
let a2 = t2, l2 = t2 + 1, c2 = t2 + 2;
|
|
826
|
-
n2 && (a2 = n2.getX(a2), l2 = n2.getX(l2), c2 = n2.getX(c2)), s2.x = o2.getX(a2), s2.y = o2.getY(a2), s2.z = o2.getZ(a2),
|
|
826
|
+
n2 && (a2 = n2.getX(a2), l2 = n2.getX(l2), c2 = n2.getX(c2)), s2.x = o2.getX(a2), s2.y = o2.getY(a2), s2.z = o2.getZ(a2), r2.x = o2.getX(l2), r2.y = o2.getY(l2), r2.z = o2.getZ(l2), i2.x = o2.getX(c2), i2.y = o2.getY(c2), i2.z = o2.getZ(c2);
|
|
827
827
|
}
|
|
828
|
-
function Ze(e4, t2, n2, o2, s2,
|
|
828
|
+
function Ze(e4, t2, n2, o2, s2, r2, i2) {
|
|
829
829
|
const { geometry: a2 } = n2, { index: l2 } = a2, c2 = a2.attributes.position;
|
|
830
830
|
for (let n3 = e4, a3 = t2 + e4; n3 < a3; n3++) {
|
|
831
831
|
let e5;
|
|
832
|
-
if (e5 = n3, Ke(
|
|
832
|
+
if (e5 = n3, Ke(i2, 3 * e5, l2, c2), i2.needsUpdate = true, o2(i2, e5, s2, r2)) return true;
|
|
833
833
|
}
|
|
834
834
|
return false;
|
|
835
835
|
}
|
|
836
836
|
function Qe(e4, t2 = null) {
|
|
837
837
|
t2 && Array.isArray(t2) && (t2 = new Set(t2));
|
|
838
838
|
const n2 = e4.geometry, o2 = n2.index ? n2.index.array : null, s2 = n2.attributes.position;
|
|
839
|
-
let
|
|
839
|
+
let r2, i2, a2, l2, c2 = 0;
|
|
840
840
|
const d2 = e4._roots;
|
|
841
|
-
for (let e5 = 0, t3 = d2.length; e5 < t3; e5++)
|
|
842
|
-
function h2(e5, n3,
|
|
841
|
+
for (let e5 = 0, t3 = d2.length; e5 < t3; e5++) r2 = d2[e5], i2 = new Uint32Array(r2), a2 = new Uint16Array(r2), l2 = new Float32Array(r2), h2(0, c2), c2 += r2.byteLength;
|
|
842
|
+
function h2(e5, n3, r3 = false) {
|
|
843
843
|
const c3 = 2 * e5;
|
|
844
844
|
if (a2[c3 + 15] === j) {
|
|
845
|
-
const t3 =
|
|
846
|
-
let n4 = 1 / 0,
|
|
847
|
-
for (let e6 = 3 * t3,
|
|
845
|
+
const t3 = i2[e5 + 6];
|
|
846
|
+
let n4 = 1 / 0, r4 = 1 / 0, d3 = 1 / 0, h3 = -1 / 0, u2 = -1 / 0, p2 = -1 / 0;
|
|
847
|
+
for (let e6 = 3 * t3, i3 = 3 * (t3 + a2[c3 + 14]); e6 < i3; e6++) {
|
|
848
848
|
let t4 = o2[e6];
|
|
849
|
-
const
|
|
850
|
-
|
|
849
|
+
const i4 = s2.getX(t4), a3 = s2.getY(t4), l3 = s2.getZ(t4);
|
|
850
|
+
i4 < n4 && (n4 = i4), i4 > h3 && (h3 = i4), a3 < r4 && (r4 = a3), a3 > u2 && (u2 = a3), l3 < d3 && (d3 = l3), l3 > p2 && (p2 = l3);
|
|
851
851
|
}
|
|
852
|
-
return (l2[e5 + 0] !== n4 || l2[e5 + 1] !==
|
|
852
|
+
return (l2[e5 + 0] !== n4 || l2[e5 + 1] !== r4 || l2[e5 + 2] !== d3 || l2[e5 + 3] !== h3 || l2[e5 + 4] !== u2 || l2[e5 + 5] !== p2) && (l2[e5 + 0] = n4, l2[e5 + 1] = r4, l2[e5 + 2] = d3, l2[e5 + 3] = h3, l2[e5 + 4] = u2, l2[e5 + 5] = p2, true);
|
|
853
853
|
}
|
|
854
854
|
{
|
|
855
|
-
const o3 = e5 + 8, s3 =
|
|
856
|
-
let d3 =
|
|
855
|
+
const o3 = e5 + 8, s3 = i2[e5 + 6], a3 = o3 + n3, c4 = s3 + n3;
|
|
856
|
+
let d3 = r3, u2 = false, p2 = false;
|
|
857
857
|
t2 ? d3 || (u2 = t2.has(a3), p2 = t2.has(c4), d3 = !u2 && !p2) : (u2 = true, p2 = true);
|
|
858
858
|
const m2 = d3 || p2;
|
|
859
859
|
let f2 = false;
|
|
@@ -862,74 +862,74 @@ function Qe(e4, t2 = null) {
|
|
|
862
862
|
m2 && (g2 = h2(s3, n3, d3));
|
|
863
863
|
const y2 = f2 || g2;
|
|
864
864
|
if (y2) for (let t3 = 0; t3 < 3; t3++) {
|
|
865
|
-
const n4 = o3 + t3,
|
|
866
|
-
l2[e5 + t3] =
|
|
865
|
+
const n4 = o3 + t3, r4 = s3 + t3, i3 = l2[n4], a4 = l2[n4 + 3], c5 = l2[r4], d4 = l2[r4 + 3];
|
|
866
|
+
l2[e5 + t3] = i3 < c5 ? i3 : c5, l2[e5 + t3 + 3] = a4 > d4 ? a4 : d4;
|
|
867
867
|
}
|
|
868
868
|
return y2;
|
|
869
869
|
}
|
|
870
870
|
}
|
|
871
871
|
}
|
|
872
872
|
function et(e4, t2, n2, o2, s2) {
|
|
873
|
-
let
|
|
873
|
+
let r2, i2, a2, l2, c2, d2;
|
|
874
874
|
const h2 = 1 / n2.direction.x, u2 = 1 / n2.direction.y, p2 = 1 / n2.direction.z, m2 = n2.origin.x, f2 = n2.origin.y, g2 = n2.origin.z;
|
|
875
875
|
let y2 = t2[e4], v2 = t2[e4 + 3], b2 = t2[e4 + 1], w2 = t2[e4 + 3 + 1], x2 = t2[e4 + 2], _2 = t2[e4 + 3 + 2];
|
|
876
|
-
return h2 >= 0 ? (
|
|
876
|
+
return h2 >= 0 ? (r2 = (y2 - m2) * h2, i2 = (v2 - m2) * h2) : (r2 = (v2 - m2) * h2, i2 = (y2 - m2) * h2), u2 >= 0 ? (a2 = (b2 - f2) * u2, l2 = (w2 - f2) * u2) : (a2 = (w2 - f2) * u2, l2 = (b2 - f2) * u2), !(r2 > l2 || a2 > i2) && ((a2 > r2 || isNaN(r2)) && (r2 = a2), (l2 < i2 || isNaN(i2)) && (i2 = l2), p2 >= 0 ? (c2 = (x2 - g2) * p2, d2 = (_2 - g2) * p2) : (c2 = (_2 - g2) * p2, d2 = (x2 - g2) * p2), !(r2 > d2 || c2 > i2) && ((c2 > r2 || r2 != r2) && (r2 = c2), (d2 < i2 || i2 != i2) && (i2 = d2), r2 <= s2 && i2 >= o2));
|
|
877
877
|
}
|
|
878
|
-
function tt(e4, t2, n2, o2, s2,
|
|
878
|
+
function tt(e4, t2, n2, o2, s2, r2, i2) {
|
|
879
879
|
const { geometry: a2 } = n2, { index: l2 } = a2, c2 = a2.attributes.position;
|
|
880
880
|
for (let a3 = e4, d2 = t2 + e4; a3 < d2; a3++) {
|
|
881
881
|
let e5;
|
|
882
|
-
if (e5 = n2.resolveTriangleIndex(a3), Ke(
|
|
882
|
+
if (e5 = n2.resolveTriangleIndex(a3), Ke(i2, 3 * e5, l2, c2), i2.needsUpdate = true, o2(i2, e5, s2, r2)) return true;
|
|
883
883
|
}
|
|
884
884
|
return false;
|
|
885
885
|
}
|
|
886
|
-
function nt(e4, t2, n2, o2, s2,
|
|
887
|
-
Fe.setBuffer(e4._roots[t2]), ot(0, e4, n2, o2, s2,
|
|
886
|
+
function nt(e4, t2, n2, o2, s2, r2, i2) {
|
|
887
|
+
Fe.setBuffer(e4._roots[t2]), ot(0, e4, n2, o2, s2, r2, i2), Fe.clearBuffer();
|
|
888
888
|
}
|
|
889
|
-
function ot(e4, t2, n2, o2, s2,
|
|
889
|
+
function ot(e4, t2, n2, o2, s2, r2, i2) {
|
|
890
890
|
const { float32Array: a2, uint16Array: l2, uint32Array: c2 } = Fe, d2 = 2 * e4;
|
|
891
891
|
if (ne(d2, l2)) {
|
|
892
|
-
!(function(e5, t3, n3, o3, s3,
|
|
892
|
+
!(function(e5, t3, n3, o3, s3, r3, i3, a3) {
|
|
893
893
|
const { geometry: l3, _indirectBuffer: c3 } = e5;
|
|
894
|
-
for (let e6 = o3, c4 = o3 + s3; e6 < c4; e6++) Ye(l3, t3, n3, e6,
|
|
895
|
-
})(t2, n2, o2, oe(e4, c2), se(d2, l2), s2,
|
|
894
|
+
for (let e6 = o3, c4 = o3 + s3; e6 < c4; e6++) Ye(l3, t3, n3, e6, r3, i3, a3);
|
|
895
|
+
})(t2, n2, o2, oe(e4, c2), se(d2, l2), s2, r2, i2);
|
|
896
896
|
} else {
|
|
897
|
-
const l3 =
|
|
898
|
-
et(l3, a2, o2,
|
|
899
|
-
const d3 =
|
|
900
|
-
et(d3, a2, o2,
|
|
897
|
+
const l3 = re(e4);
|
|
898
|
+
et(l3, a2, o2, r2, i2) && ot(l3, t2, n2, o2, s2, r2, i2);
|
|
899
|
+
const d3 = ie(e4, c2);
|
|
900
|
+
et(d3, a2, o2, r2, i2) && ot(d3, t2, n2, o2, s2, r2, i2);
|
|
901
901
|
}
|
|
902
902
|
}
|
|
903
903
|
const st = ["x", "y", "z"];
|
|
904
|
-
function
|
|
904
|
+
function rt(e4, t2, n2, o2, s2, r2) {
|
|
905
905
|
Fe.setBuffer(e4._roots[t2]);
|
|
906
|
-
const
|
|
907
|
-
return Fe.clearBuffer(),
|
|
906
|
+
const i2 = it(0, e4, n2, o2, s2, r2);
|
|
907
|
+
return Fe.clearBuffer(), i2;
|
|
908
908
|
}
|
|
909
|
-
function
|
|
910
|
-
const { float32Array:
|
|
909
|
+
function it(e4, t2, n2, o2, s2, r2) {
|
|
910
|
+
const { float32Array: i2, uint16Array: a2, uint32Array: l2 } = Fe;
|
|
911
911
|
let c2 = 2 * e4;
|
|
912
912
|
if (ne(c2, a2)) {
|
|
913
|
-
return (function(e5, t3, n3, o3, s3,
|
|
913
|
+
return (function(e5, t3, n3, o3, s3, r3, i3) {
|
|
914
914
|
const { geometry: a3, _indirectBuffer: l3 } = e5;
|
|
915
915
|
let c3 = 1 / 0, d2 = null;
|
|
916
916
|
for (let e6 = o3, l4 = o3 + s3; e6 < l4; e6++) {
|
|
917
917
|
let o4;
|
|
918
|
-
o4 = Ye(a3, t3, n3, e6, null,
|
|
918
|
+
o4 = Ye(a3, t3, n3, e6, null, r3, i3), o4 && o4.distance < c3 && (d2 = o4, c3 = o4.distance);
|
|
919
919
|
}
|
|
920
920
|
return d2;
|
|
921
|
-
})(t2, n2, o2, oe(e4, l2), se(c2, a2), s2,
|
|
921
|
+
})(t2, n2, o2, oe(e4, l2), se(c2, a2), s2, r2);
|
|
922
922
|
}
|
|
923
923
|
{
|
|
924
924
|
const a3 = ae(e4, l2), c3 = st[a3], d2 = o2.direction[c3] >= 0;
|
|
925
925
|
let h2, u2;
|
|
926
|
-
d2 ? (h2 =
|
|
927
|
-
const p2 = et(h2,
|
|
926
|
+
d2 ? (h2 = re(e4), u2 = ie(e4, l2)) : (h2 = ie(e4, l2), u2 = re(e4));
|
|
927
|
+
const p2 = et(h2, i2, o2, s2, r2) ? it(h2, t2, n2, o2, s2, r2) : null;
|
|
928
928
|
if (p2) {
|
|
929
929
|
const e5 = p2.point[c3];
|
|
930
|
-
if (d2 ? e5 <=
|
|
930
|
+
if (d2 ? e5 <= i2[u2 + a3] : e5 >= i2[u2 + a3 + 3]) return p2;
|
|
931
931
|
}
|
|
932
|
-
const m2 = et(u2,
|
|
932
|
+
const m2 = et(u2, i2, o2, s2, r2) ? it(u2, t2, n2, o2, s2, r2) : null;
|
|
933
933
|
return p2 && m2 ? p2.distance <= m2.distance ? p2 : m2 : p2 || m2 || null;
|
|
934
934
|
}
|
|
935
935
|
}
|
|
@@ -940,20 +940,20 @@ function pt(e4, t2, n2, o2) {
|
|
|
940
940
|
return Fe.clearBuffer(), s2;
|
|
941
941
|
}
|
|
942
942
|
function mt(e4, t2, n2, o2, s2 = null) {
|
|
943
|
-
const { float32Array:
|
|
943
|
+
const { float32Array: r2, uint16Array: i2, uint32Array: a2 } = Fe;
|
|
944
944
|
let l2 = 2 * e4;
|
|
945
945
|
null === s2 && (n2.boundingBox || n2.computeBoundingBox(), ht.set(n2.boundingBox.min, n2.boundingBox.max, o2), s2 = ht);
|
|
946
|
-
if (!ne(l2,
|
|
947
|
-
const
|
|
948
|
-
V(
|
|
949
|
-
if (s2.intersectsBox(at) && mt(
|
|
950
|
-
V(l3,
|
|
946
|
+
if (!ne(l2, i2)) {
|
|
947
|
+
const i3 = e4 + 8, l3 = a2[e4 + 6];
|
|
948
|
+
V(i3, r2, at);
|
|
949
|
+
if (s2.intersectsBox(at) && mt(i3, t2, n2, o2, s2)) return true;
|
|
950
|
+
V(l3, r2, at);
|
|
951
951
|
return !!(s2.intersectsBox(at) && mt(l3, t2, n2, o2, s2));
|
|
952
952
|
}
|
|
953
953
|
{
|
|
954
|
-
const s3 = t2.geometry, c2 = s3.index, d2 = s3.attributes.position, h2 = n2.index, u2 = n2.attributes.position, p2 = oe(e4, a2), m2 = se(l2,
|
|
954
|
+
const s3 = t2.geometry, c2 = s3.index, d2 = s3.attributes.position, h2 = n2.index, u2 = n2.attributes.position, p2 = oe(e4, a2), m2 = se(l2, i2);
|
|
955
955
|
if (dt.copy(o2).invert(), n2.boundsTree) {
|
|
956
|
-
V(e4,
|
|
956
|
+
V(e4, r2, ut), ut.matrix.copy(dt), ut.needsUpdate = true;
|
|
957
957
|
return n2.boundsTree.shapecast({ intersectsBounds: (e5) => ut.intersectsBox(e5), intersectsTriangle: (e5) => {
|
|
958
958
|
e5.a.applyMatrix4(o2), e5.b.applyMatrix4(o2), e5.c.applyMatrix4(o2), e5.needsUpdate = true;
|
|
959
959
|
for (let t3 = 3 * p2, n3 = 3 * (m2 + p2); t3 < n3; t3 += 3) if (Ke(ct, t3, c2, d2), ct.needsUpdate = true, e5.intersectsTriangle(ct)) return true;
|
|
@@ -967,31 +967,31 @@ function mt(e4, t2, n2, o2, s2 = null) {
|
|
|
967
967
|
}
|
|
968
968
|
}
|
|
969
969
|
const ft = new t.Matrix4(), gt = new Pe(), yt = new Pe(), vt = new t.Vector3(), bt = new t.Vector3(), wt = new t.Vector3(), xt = new t.Vector3();
|
|
970
|
-
function _t(e4, t2, n2, o2 = {}, s2 = {},
|
|
970
|
+
function _t(e4, t2, n2, o2 = {}, s2 = {}, r2 = 0, i2 = 1 / 0) {
|
|
971
971
|
t2.boundingBox || t2.computeBoundingBox(), gt.set(t2.boundingBox.min, t2.boundingBox.max, n2), gt.needsUpdate = true;
|
|
972
972
|
const a2 = e4.geometry, l2 = a2.attributes.position, c2 = a2.index, d2 = t2.attributes.position, h2 = t2.index, u2 = Te.getPrimitive(), p2 = Te.getPrimitive();
|
|
973
973
|
let m2 = vt, f2 = bt, g2 = null, y2 = null;
|
|
974
974
|
s2 && (g2 = wt, y2 = xt);
|
|
975
975
|
let v2 = 1 / 0, b2 = null, w2 = null;
|
|
976
|
-
return ft.copy(n2).invert(), yt.matrix.copy(ft), e4.shapecast({ boundsTraverseOrder: (e5) => gt.distanceToBox(e5), intersectsBounds: (e5, t3, n3) => n3 < v2 && n3 <
|
|
976
|
+
return ft.copy(n2).invert(), yt.matrix.copy(ft), e4.shapecast({ boundsTraverseOrder: (e5) => gt.distanceToBox(e5), intersectsBounds: (e5, t3, n3) => n3 < v2 && n3 < i2 && (t3 && (yt.min.copy(e5.min), yt.max.copy(e5.max), yt.needsUpdate = true), true), intersectsRange: (e5, o3) => {
|
|
977
977
|
if (t2.boundsTree) {
|
|
978
|
-
return t2.boundsTree.shapecast({ boundsTraverseOrder: (e6) => yt.distanceToBox(e6), intersectsBounds: (e6, t3, n3) => n3 < v2 && n3 <
|
|
979
|
-
for (let
|
|
980
|
-
Ke(p2, 3 *
|
|
978
|
+
return t2.boundsTree.shapecast({ boundsTraverseOrder: (e6) => yt.distanceToBox(e6), intersectsBounds: (e6, t3, n3) => n3 < v2 && n3 < i2, intersectsRange: (t3, s3) => {
|
|
979
|
+
for (let i3 = t3, a3 = t3 + s3; i3 < a3; i3++) {
|
|
980
|
+
Ke(p2, 3 * i3, h2, d2), p2.a.applyMatrix4(n2), p2.b.applyMatrix4(n2), p2.c.applyMatrix4(n2), p2.needsUpdate = true;
|
|
981
981
|
for (let t4 = e5, n3 = e5 + o3; t4 < n3; t4++) {
|
|
982
982
|
Ke(u2, 3 * t4, c2, l2), u2.needsUpdate = true;
|
|
983
983
|
const e6 = u2.distanceToTriangle(p2, m2, g2);
|
|
984
|
-
if (e6 < v2 && (f2.copy(m2), y2 && y2.copy(g2), v2 = e6, b2 = t4, w2 =
|
|
984
|
+
if (e6 < v2 && (f2.copy(m2), y2 && y2.copy(g2), v2 = e6, b2 = t4, w2 = i3), e6 < r2) return true;
|
|
985
985
|
}
|
|
986
986
|
}
|
|
987
987
|
} });
|
|
988
988
|
}
|
|
989
|
-
for (let s3 = 0,
|
|
989
|
+
for (let s3 = 0, i3 = R(t2); s3 < i3; s3++) {
|
|
990
990
|
Ke(p2, 3 * s3, h2, d2), p2.a.applyMatrix4(n2), p2.b.applyMatrix4(n2), p2.c.applyMatrix4(n2), p2.needsUpdate = true;
|
|
991
991
|
for (let t3 = e5, n3 = e5 + o3; t3 < n3; t3++) {
|
|
992
992
|
Ke(u2, 3 * t3, c2, l2), u2.needsUpdate = true;
|
|
993
993
|
const e6 = u2.distanceToTriangle(p2, m2, g2);
|
|
994
|
-
if (e6 < v2 && (f2.copy(m2), y2 && y2.copy(g2), v2 = e6, b2 = t3, w2 = s3), e6 <
|
|
994
|
+
if (e6 < v2 && (f2.copy(m2), y2 && y2.copy(g2), v2 = e6, b2 = t3, w2 = s3), e6 < r2) return true;
|
|
995
995
|
}
|
|
996
996
|
}
|
|
997
997
|
} }), Te.releasePrimitive(u2), Te.releasePrimitive(p2), v2 === 1 / 0 ? null : (o2.point ? o2.point.copy(f2) : o2.point = f2.clone(), o2.distance = v2, o2.faceIndex = b2, s2 && (s2.point ? s2.point.copy(y2) : s2.point = y2.clone(), s2.point.applyMatrix4(ft), f2.applyMatrix4(ft), s2.distance = f2.sub(s2.point).length(), s2.faceIndex = w2), o2);
|
|
@@ -999,114 +999,114 @@ function _t(e4, t2, n2, o2 = {}, s2 = {}, i2 = 0, r2 = 1 / 0) {
|
|
|
999
999
|
function Ct(e4, t2 = null) {
|
|
1000
1000
|
t2 && Array.isArray(t2) && (t2 = new Set(t2));
|
|
1001
1001
|
const n2 = e4.geometry, o2 = n2.index ? n2.index.array : null, s2 = n2.attributes.position;
|
|
1002
|
-
let
|
|
1002
|
+
let r2, i2, a2, l2, c2 = 0;
|
|
1003
1003
|
const d2 = e4._roots;
|
|
1004
|
-
for (let e5 = 0, t3 = d2.length; e5 < t3; e5++)
|
|
1005
|
-
function h2(n3,
|
|
1004
|
+
for (let e5 = 0, t3 = d2.length; e5 < t3; e5++) r2 = d2[e5], i2 = new Uint32Array(r2), a2 = new Uint16Array(r2), l2 = new Float32Array(r2), h2(0, c2), c2 += r2.byteLength;
|
|
1005
|
+
function h2(n3, r3, c3 = false) {
|
|
1006
1006
|
const d3 = 2 * n3;
|
|
1007
1007
|
if (a2[d3 + 15] === j) {
|
|
1008
|
-
const t3 =
|
|
1009
|
-
let
|
|
1010
|
-
for (let n4 = t3,
|
|
1008
|
+
const t3 = i2[n3 + 6];
|
|
1009
|
+
let r4 = 1 / 0, c4 = 1 / 0, h3 = 1 / 0, u2 = -1 / 0, p2 = -1 / 0, m2 = -1 / 0;
|
|
1010
|
+
for (let n4 = t3, i3 = t3 + a2[d3 + 14]; n4 < i3; n4++) {
|
|
1011
1011
|
const t4 = 3 * e4.resolveTriangleIndex(n4);
|
|
1012
1012
|
for (let e5 = 0; e5 < 3; e5++) {
|
|
1013
1013
|
let n5 = t4 + e5;
|
|
1014
1014
|
n5 = o2 ? o2[n5] : n5;
|
|
1015
|
-
const
|
|
1016
|
-
|
|
1015
|
+
const i4 = s2.getX(n5), a3 = s2.getY(n5), l3 = s2.getZ(n5);
|
|
1016
|
+
i4 < r4 && (r4 = i4), i4 > u2 && (u2 = i4), a3 < c4 && (c4 = a3), a3 > p2 && (p2 = a3), l3 < h3 && (h3 = l3), l3 > m2 && (m2 = l3);
|
|
1017
1017
|
}
|
|
1018
1018
|
}
|
|
1019
|
-
return (l2[n3 + 0] !==
|
|
1019
|
+
return (l2[n3 + 0] !== r4 || l2[n3 + 1] !== c4 || l2[n3 + 2] !== h3 || l2[n3 + 3] !== u2 || l2[n3 + 4] !== p2 || l2[n3 + 5] !== m2) && (l2[n3 + 0] = r4, l2[n3 + 1] = c4, l2[n3 + 2] = h3, l2[n3 + 3] = u2, l2[n3 + 4] = p2, l2[n3 + 5] = m2, true);
|
|
1020
1020
|
}
|
|
1021
1021
|
{
|
|
1022
|
-
const e5 = n3 + 8, o3 =
|
|
1022
|
+
const e5 = n3 + 8, o3 = i2[n3 + 6], s3 = e5 + r3, a3 = o3 + r3;
|
|
1023
1023
|
let d4 = c3, u2 = false, p2 = false;
|
|
1024
1024
|
t2 ? d4 || (u2 = t2.has(s3), p2 = t2.has(a3), d4 = !u2 && !p2) : (u2 = true, p2 = true);
|
|
1025
1025
|
const m2 = d4 || p2;
|
|
1026
1026
|
let f2 = false;
|
|
1027
|
-
(d4 || u2) && (f2 = h2(e5,
|
|
1027
|
+
(d4 || u2) && (f2 = h2(e5, r3, d4));
|
|
1028
1028
|
let g2 = false;
|
|
1029
|
-
m2 && (g2 = h2(o3,
|
|
1029
|
+
m2 && (g2 = h2(o3, r3, d4));
|
|
1030
1030
|
const y2 = f2 || g2;
|
|
1031
1031
|
if (y2) for (let t3 = 0; t3 < 3; t3++) {
|
|
1032
|
-
const s4 = e5 + t3,
|
|
1033
|
-
l2[n3 + t3] =
|
|
1032
|
+
const s4 = e5 + t3, r4 = o3 + t3, i3 = l2[s4], a4 = l2[s4 + 3], c4 = l2[r4], d5 = l2[r4 + 3];
|
|
1033
|
+
l2[n3 + t3] = i3 < c4 ? i3 : c4, l2[n3 + t3 + 3] = a4 > d5 ? a4 : d5;
|
|
1034
1034
|
}
|
|
1035
1035
|
return y2;
|
|
1036
1036
|
}
|
|
1037
1037
|
}
|
|
1038
1038
|
}
|
|
1039
|
-
function Mt(e4, t2, n2, o2, s2,
|
|
1040
|
-
Fe.setBuffer(e4._roots[t2]), Pt(0, e4, n2, o2, s2,
|
|
1039
|
+
function Mt(e4, t2, n2, o2, s2, r2, i2) {
|
|
1040
|
+
Fe.setBuffer(e4._roots[t2]), Pt(0, e4, n2, o2, s2, r2, i2), Fe.clearBuffer();
|
|
1041
1041
|
}
|
|
1042
|
-
function Pt(e4, t2, n2, o2, s2,
|
|
1042
|
+
function Pt(e4, t2, n2, o2, s2, r2, i2) {
|
|
1043
1043
|
const { float32Array: a2, uint16Array: l2, uint32Array: c2 } = Fe, d2 = 2 * e4;
|
|
1044
1044
|
if (ne(d2, l2)) {
|
|
1045
|
-
!(function(e5, t3, n3, o3, s3,
|
|
1045
|
+
!(function(e5, t3, n3, o3, s3, r3, i3, a3) {
|
|
1046
1046
|
const { geometry: l3, _indirectBuffer: c3 } = e5;
|
|
1047
|
-
for (let e6 = o3, d3 = o3 + s3; e6 < d3; e6++) Ye(l3, t3, n3, c3 ? c3[e6] : e6,
|
|
1048
|
-
})(t2, n2, o2, oe(e4, c2), se(d2, l2), s2,
|
|
1047
|
+
for (let e6 = o3, d3 = o3 + s3; e6 < d3; e6++) Ye(l3, t3, n3, c3 ? c3[e6] : e6, r3, i3, a3);
|
|
1048
|
+
})(t2, n2, o2, oe(e4, c2), se(d2, l2), s2, r2, i2);
|
|
1049
1049
|
} else {
|
|
1050
|
-
const l3 =
|
|
1051
|
-
et(l3, a2, o2,
|
|
1052
|
-
const d3 =
|
|
1053
|
-
et(d3, a2, o2,
|
|
1050
|
+
const l3 = re(e4);
|
|
1051
|
+
et(l3, a2, o2, r2, i2) && Pt(l3, t2, n2, o2, s2, r2, i2);
|
|
1052
|
+
const d3 = ie(e4, c2);
|
|
1053
|
+
et(d3, a2, o2, r2, i2) && Pt(d3, t2, n2, o2, s2, r2, i2);
|
|
1054
1054
|
}
|
|
1055
1055
|
}
|
|
1056
1056
|
const St = ["x", "y", "z"];
|
|
1057
|
-
function At(e4, t2, n2, o2, s2,
|
|
1057
|
+
function At(e4, t2, n2, o2, s2, r2) {
|
|
1058
1058
|
Fe.setBuffer(e4._roots[t2]);
|
|
1059
|
-
const
|
|
1060
|
-
return Fe.clearBuffer(),
|
|
1059
|
+
const i2 = Tt(0, e4, n2, o2, s2, r2);
|
|
1060
|
+
return Fe.clearBuffer(), i2;
|
|
1061
1061
|
}
|
|
1062
|
-
function Tt(e4, t2, n2, o2, s2,
|
|
1063
|
-
const { float32Array:
|
|
1062
|
+
function Tt(e4, t2, n2, o2, s2, r2) {
|
|
1063
|
+
const { float32Array: i2, uint16Array: a2, uint32Array: l2 } = Fe;
|
|
1064
1064
|
let c2 = 2 * e4;
|
|
1065
1065
|
if (ne(c2, a2)) {
|
|
1066
|
-
return (function(e5, t3, n3, o3, s3,
|
|
1066
|
+
return (function(e5, t3, n3, o3, s3, r3, i3) {
|
|
1067
1067
|
const { geometry: a3, _indirectBuffer: l3 } = e5;
|
|
1068
1068
|
let c3 = 1 / 0, d2 = null;
|
|
1069
1069
|
for (let e6 = o3, h2 = o3 + s3; e6 < h2; e6++) {
|
|
1070
1070
|
let o4;
|
|
1071
|
-
o4 = Ye(a3, t3, n3, l3 ? l3[e6] : e6, null,
|
|
1071
|
+
o4 = Ye(a3, t3, n3, l3 ? l3[e6] : e6, null, r3, i3), o4 && o4.distance < c3 && (d2 = o4, c3 = o4.distance);
|
|
1072
1072
|
}
|
|
1073
1073
|
return d2;
|
|
1074
|
-
})(t2, n2, o2, oe(e4, l2), se(c2, a2), s2,
|
|
1074
|
+
})(t2, n2, o2, oe(e4, l2), se(c2, a2), s2, r2);
|
|
1075
1075
|
}
|
|
1076
1076
|
{
|
|
1077
1077
|
const a3 = ae(e4, l2), c3 = St[a3], d2 = o2.direction[c3] >= 0;
|
|
1078
1078
|
let h2, u2;
|
|
1079
|
-
d2 ? (h2 =
|
|
1080
|
-
const p2 = et(h2,
|
|
1079
|
+
d2 ? (h2 = re(e4), u2 = ie(e4, l2)) : (h2 = ie(e4, l2), u2 = re(e4));
|
|
1080
|
+
const p2 = et(h2, i2, o2, s2, r2) ? Tt(h2, t2, n2, o2, s2, r2) : null;
|
|
1081
1081
|
if (p2) {
|
|
1082
1082
|
const e5 = p2.point[c3];
|
|
1083
|
-
if (d2 ? e5 <=
|
|
1083
|
+
if (d2 ? e5 <= i2[u2 + a3] : e5 >= i2[u2 + a3 + 3]) return p2;
|
|
1084
1084
|
}
|
|
1085
|
-
const m2 = et(u2,
|
|
1085
|
+
const m2 = et(u2, i2, o2, s2, r2) ? Tt(u2, t2, n2, o2, s2, r2) : null;
|
|
1086
1086
|
return p2 && m2 ? p2.distance <= m2.distance ? p2 : m2 : p2 || m2 || null;
|
|
1087
1087
|
}
|
|
1088
1088
|
}
|
|
1089
1089
|
const Ft = new t.Box3(), Et = new Me(), Bt = new Me(), Lt = new t.Matrix4(), Ot = new Pe(), kt = new Pe();
|
|
1090
1090
|
function jt(e4, t2, n2, o2) {
|
|
1091
1091
|
Fe.setBuffer(e4._roots[t2]);
|
|
1092
|
-
const s2 =
|
|
1092
|
+
const s2 = Dt(0, e4, n2, o2);
|
|
1093
1093
|
return Fe.clearBuffer(), s2;
|
|
1094
1094
|
}
|
|
1095
|
-
function
|
|
1096
|
-
const { float32Array:
|
|
1095
|
+
function Dt(e4, t2, n2, o2, s2 = null) {
|
|
1096
|
+
const { float32Array: r2, uint16Array: i2, uint32Array: a2 } = Fe;
|
|
1097
1097
|
let l2 = 2 * e4;
|
|
1098
1098
|
null === s2 && (n2.boundingBox || n2.computeBoundingBox(), Ot.set(n2.boundingBox.min, n2.boundingBox.max, o2), s2 = Ot);
|
|
1099
|
-
if (!ne(l2,
|
|
1100
|
-
const
|
|
1101
|
-
V(
|
|
1102
|
-
if (s2.intersectsBox(Ft) &&
|
|
1103
|
-
V(l3,
|
|
1104
|
-
return !!(s2.intersectsBox(Ft) &&
|
|
1099
|
+
if (!ne(l2, i2)) {
|
|
1100
|
+
const i3 = e4 + 8, l3 = a2[e4 + 6];
|
|
1101
|
+
V(i3, r2, Ft);
|
|
1102
|
+
if (s2.intersectsBox(Ft) && Dt(i3, t2, n2, o2, s2)) return true;
|
|
1103
|
+
V(l3, r2, Ft);
|
|
1104
|
+
return !!(s2.intersectsBox(Ft) && Dt(l3, t2, n2, o2, s2));
|
|
1105
1105
|
}
|
|
1106
1106
|
{
|
|
1107
|
-
const s3 = t2.geometry, c2 = s3.index, d2 = s3.attributes.position, h2 = n2.index, u2 = n2.attributes.position, p2 = oe(e4, a2), m2 = se(l2,
|
|
1107
|
+
const s3 = t2.geometry, c2 = s3.index, d2 = s3.attributes.position, h2 = n2.index, u2 = n2.attributes.position, p2 = oe(e4, a2), m2 = se(l2, i2);
|
|
1108
1108
|
if (Lt.copy(o2).invert(), n2.boundsTree) {
|
|
1109
|
-
V(e4,
|
|
1109
|
+
V(e4, r2, kt), kt.matrix.copy(Lt), kt.needsUpdate = true;
|
|
1110
1110
|
return n2.boundsTree.shapecast({ intersectsBounds: (e5) => kt.intersectsBox(e5), intersectsTriangle: (e5) => {
|
|
1111
1111
|
e5.a.applyMatrix4(o2), e5.b.applyMatrix4(o2), e5.c.applyMatrix4(o2), e5.needsUpdate = true;
|
|
1112
1112
|
for (let n3 = p2, o3 = m2 + p2; n3 < o3; n3++) if (Ke(Bt, 3 * t2.resolveTriangleIndex(n3), c2, d2), Bt.needsUpdate = true, e5.intersectsTriangle(Bt)) return true;
|
|
@@ -1120,77 +1120,77 @@ function zt(e4, t2, n2, o2, s2 = null) {
|
|
|
1120
1120
|
}
|
|
1121
1121
|
}
|
|
1122
1122
|
}
|
|
1123
|
-
const
|
|
1124
|
-
function Nt(e4, t2, n2, o2 = {}, s2 = {},
|
|
1123
|
+
const zt = new t.Matrix4(), Rt = new Pe(), Ut = new Pe(), It = new t.Vector3(), Ht = new t.Vector3(), Gt = new t.Vector3(), Vt = new t.Vector3();
|
|
1124
|
+
function Nt(e4, t2, n2, o2 = {}, s2 = {}, r2 = 0, i2 = 1 / 0) {
|
|
1125
1125
|
t2.boundingBox || t2.computeBoundingBox(), Rt.set(t2.boundingBox.min, t2.boundingBox.max, n2), Rt.needsUpdate = true;
|
|
1126
1126
|
const a2 = e4.geometry, l2 = a2.attributes.position, c2 = a2.index, d2 = t2.attributes.position, h2 = t2.index, u2 = Te.getPrimitive(), p2 = Te.getPrimitive();
|
|
1127
1127
|
let m2 = It, f2 = Ht, g2 = null, y2 = null;
|
|
1128
1128
|
s2 && (g2 = Gt, y2 = Vt);
|
|
1129
1129
|
let v2 = 1 / 0, b2 = null, w2 = null;
|
|
1130
|
-
return
|
|
1130
|
+
return zt.copy(n2).invert(), Ut.matrix.copy(zt), e4.shapecast({ boundsTraverseOrder: (e5) => Rt.distanceToBox(e5), intersectsBounds: (e5, t3, n3) => n3 < v2 && n3 < i2 && (t3 && (Ut.min.copy(e5.min), Ut.max.copy(e5.max), Ut.needsUpdate = true), true), intersectsRange: (o3, s3) => {
|
|
1131
1131
|
if (t2.boundsTree) {
|
|
1132
1132
|
const a3 = t2.boundsTree;
|
|
1133
|
-
return a3.shapecast({ boundsTraverseOrder: (e5) => Ut.distanceToBox(e5), intersectsBounds: (e5, t3, n3) => n3 < v2 && n3 <
|
|
1134
|
-
for (let x2 = t3, _2 = t3 +
|
|
1133
|
+
return a3.shapecast({ boundsTraverseOrder: (e5) => Ut.distanceToBox(e5), intersectsBounds: (e5, t3, n3) => n3 < v2 && n3 < i2, intersectsRange: (t3, i3) => {
|
|
1134
|
+
for (let x2 = t3, _2 = t3 + i3; x2 < _2; x2++) {
|
|
1135
1135
|
const t4 = a3.resolveTriangleIndex(x2);
|
|
1136
1136
|
Ke(p2, 3 * t4, h2, d2), p2.a.applyMatrix4(n2), p2.b.applyMatrix4(n2), p2.c.applyMatrix4(n2), p2.needsUpdate = true;
|
|
1137
1137
|
for (let t5 = o3, n3 = o3 + s3; t5 < n3; t5++) {
|
|
1138
1138
|
const n4 = e4.resolveTriangleIndex(t5);
|
|
1139
1139
|
Ke(u2, 3 * n4, c2, l2), u2.needsUpdate = true;
|
|
1140
1140
|
const o4 = u2.distanceToTriangle(p2, m2, g2);
|
|
1141
|
-
if (o4 < v2 && (f2.copy(m2), y2 && y2.copy(g2), v2 = o4, b2 = t5, w2 = x2), o4 <
|
|
1141
|
+
if (o4 < v2 && (f2.copy(m2), y2 && y2.copy(g2), v2 = o4, b2 = t5, w2 = x2), o4 < r2) return true;
|
|
1142
1142
|
}
|
|
1143
1143
|
}
|
|
1144
1144
|
} });
|
|
1145
1145
|
}
|
|
1146
|
-
for (let
|
|
1147
|
-
Ke(p2, 3 *
|
|
1146
|
+
for (let i3 = 0, a3 = R(t2); i3 < a3; i3++) {
|
|
1147
|
+
Ke(p2, 3 * i3, h2, d2), p2.a.applyMatrix4(n2), p2.b.applyMatrix4(n2), p2.c.applyMatrix4(n2), p2.needsUpdate = true;
|
|
1148
1148
|
for (let t3 = o3, n3 = o3 + s3; t3 < n3; t3++) {
|
|
1149
1149
|
const n4 = e4.resolveTriangleIndex(t3);
|
|
1150
1150
|
Ke(u2, 3 * n4, c2, l2), u2.needsUpdate = true;
|
|
1151
1151
|
const o4 = u2.distanceToTriangle(p2, m2, g2);
|
|
1152
|
-
if (o4 < v2 && (f2.copy(m2), y2 && y2.copy(g2), v2 = o4, b2 = t3, w2 =
|
|
1152
|
+
if (o4 < v2 && (f2.copy(m2), y2 && y2.copy(g2), v2 = o4, b2 = t3, w2 = i3), o4 < r2) return true;
|
|
1153
1153
|
}
|
|
1154
1154
|
}
|
|
1155
|
-
} }), Te.releasePrimitive(u2), Te.releasePrimitive(p2), v2 === 1 / 0 ? null : (o2.point ? o2.point.copy(f2) : o2.point = f2.clone(), o2.distance = v2, o2.faceIndex = b2, s2 && (s2.point ? s2.point.copy(y2) : s2.point = y2.clone(), s2.point.applyMatrix4(
|
|
1155
|
+
} }), Te.releasePrimitive(u2), Te.releasePrimitive(p2), v2 === 1 / 0 ? null : (o2.point ? o2.point.copy(f2) : o2.point = f2.clone(), o2.distance = v2, o2.faceIndex = b2, s2 && (s2.point ? s2.point.copy(y2) : s2.point = y2.clone(), s2.point.applyMatrix4(zt), f2.applyMatrix4(zt), s2.distance = f2.sub(s2.point).length(), s2.faceIndex = w2), o2);
|
|
1156
1156
|
}
|
|
1157
1157
|
const $t = new Fe.constructor(), Xt = new Fe.constructor(), qt = new Se(() => new t.Box3()), Wt = new t.Box3(), Jt = new t.Box3(), Yt = new t.Box3(), Kt = new t.Box3();
|
|
1158
1158
|
let Zt = false;
|
|
1159
|
-
function Qt(e4, t2, n2, o2, s2,
|
|
1159
|
+
function Qt(e4, t2, n2, o2, s2, r2 = 0, i2 = 0, a2 = 0, l2 = 0, c2 = null, d2 = false) {
|
|
1160
1160
|
let h2, u2;
|
|
1161
1161
|
d2 ? (h2 = Xt, u2 = $t) : (h2 = $t, u2 = Xt);
|
|
1162
1162
|
const p2 = h2.float32Array, m2 = h2.uint32Array, f2 = h2.uint16Array, g2 = u2.float32Array, y2 = u2.uint32Array, v2 = u2.uint16Array, b2 = 2 * t2, w2 = ne(2 * e4, f2), x2 = ne(b2, v2);
|
|
1163
1163
|
let _2 = false;
|
|
1164
|
-
if (x2 && w2) _2 = d2 ? s2(oe(t2, y2), se(2 * t2, v2), oe(e4, m2), se(2 * e4, f2), l2,
|
|
1164
|
+
if (x2 && w2) _2 = d2 ? s2(oe(t2, y2), se(2 * t2, v2), oe(e4, m2), se(2 * e4, f2), l2, i2 + t2, a2, r2 + e4) : s2(oe(e4, m2), se(2 * e4, f2), oe(t2, y2), se(2 * t2, v2), a2, r2 + e4, l2, i2 + t2);
|
|
1165
1165
|
else if (x2) {
|
|
1166
1166
|
const c3 = qt.getPrimitive();
|
|
1167
1167
|
V(t2, g2, c3), c3.applyMatrix4(n2);
|
|
1168
|
-
const h3 =
|
|
1168
|
+
const h3 = re(e4), u3 = ie(e4, m2);
|
|
1169
1169
|
V(h3, p2, Wt), V(u3, p2, Jt);
|
|
1170
1170
|
const f3 = c3.intersectsBox(Wt), y3 = c3.intersectsBox(Jt);
|
|
1171
|
-
_2 = f3 && Qt(t2, h3, o2, n2, s2,
|
|
1171
|
+
_2 = f3 && Qt(t2, h3, o2, n2, s2, i2, r2, l2, a2 + 1, c3, !d2) || y3 && Qt(t2, u3, o2, n2, s2, i2, r2, l2, a2 + 1, c3, !d2), qt.releasePrimitive(c3);
|
|
1172
1172
|
} else {
|
|
1173
|
-
const h3 =
|
|
1173
|
+
const h3 = re(t2), u3 = ie(t2, y2);
|
|
1174
1174
|
V(h3, g2, Yt), V(u3, g2, Kt);
|
|
1175
1175
|
const f3 = c2.intersectsBox(Yt), v3 = c2.intersectsBox(Kt);
|
|
1176
|
-
if (f3 && v3) _2 = Qt(e4, h3, n2, o2, s2,
|
|
1177
|
-
else if (f3) if (w2) _2 = Qt(e4, h3, n2, o2, s2,
|
|
1176
|
+
if (f3 && v3) _2 = Qt(e4, h3, n2, o2, s2, r2, i2, a2, l2 + 1, c2, d2) || Qt(e4, u3, n2, o2, s2, r2, i2, a2, l2 + 1, c2, d2);
|
|
1177
|
+
else if (f3) if (w2) _2 = Qt(e4, h3, n2, o2, s2, r2, i2, a2, l2 + 1, c2, d2);
|
|
1178
1178
|
else {
|
|
1179
1179
|
const t3 = qt.getPrimitive();
|
|
1180
1180
|
t3.copy(Yt).applyMatrix4(n2);
|
|
1181
|
-
const c3 =
|
|
1181
|
+
const c3 = re(e4), u4 = ie(e4, m2);
|
|
1182
1182
|
V(c3, p2, Wt), V(u4, p2, Jt);
|
|
1183
1183
|
const f4 = t3.intersectsBox(Wt), g3 = t3.intersectsBox(Jt);
|
|
1184
|
-
_2 = f4 && Qt(h3, c3, o2, n2, s2,
|
|
1184
|
+
_2 = f4 && Qt(h3, c3, o2, n2, s2, i2, r2, l2, a2 + 1, t3, !d2) || g3 && Qt(h3, u4, o2, n2, s2, i2, r2, l2, a2 + 1, t3, !d2), qt.releasePrimitive(t3);
|
|
1185
1185
|
}
|
|
1186
|
-
else if (v3) if (w2) _2 = Qt(e4, u3, n2, o2, s2,
|
|
1186
|
+
else if (v3) if (w2) _2 = Qt(e4, u3, n2, o2, s2, r2, i2, a2, l2 + 1, c2, d2);
|
|
1187
1187
|
else {
|
|
1188
1188
|
const t3 = qt.getPrimitive();
|
|
1189
1189
|
t3.copy(Kt).applyMatrix4(n2);
|
|
1190
|
-
const c3 =
|
|
1190
|
+
const c3 = re(e4), h4 = ie(e4, m2);
|
|
1191
1191
|
V(c3, p2, Wt), V(h4, p2, Jt);
|
|
1192
1192
|
const f4 = t3.intersectsBox(Wt), g3 = t3.intersectsBox(Jt);
|
|
1193
|
-
_2 = f4 && Qt(u3, c3, o2, n2, s2,
|
|
1193
|
+
_2 = f4 && Qt(u3, c3, o2, n2, s2, i2, r2, l2, a2 + 1, t3, !d2) || g3 && Qt(u3, h4, o2, n2, s2, i2, r2, l2, a2 + 1, t3, !d2), qt.releasePrimitive(t3);
|
|
1194
1194
|
}
|
|
1195
1195
|
}
|
|
1196
1196
|
return _2;
|
|
@@ -1199,14 +1199,14 @@ const en = new Pe(), tn = new t.Box3(), nn = { strategy: 0, maxDepth: 40, maxLea
|
|
|
1199
1199
|
class on {
|
|
1200
1200
|
static serialize(e4, t2 = {}) {
|
|
1201
1201
|
t2 = { cloneBuffers: true, ...t2 };
|
|
1202
|
-
const n2 = e4.geometry, o2 = e4._roots, s2 = e4._indirectBuffer,
|
|
1203
|
-
let
|
|
1204
|
-
return
|
|
1202
|
+
const n2 = e4.geometry, o2 = e4._roots, s2 = e4._indirectBuffer, r2 = n2.getIndex();
|
|
1203
|
+
let i2;
|
|
1204
|
+
return i2 = t2.cloneBuffers ? { roots: o2.map((e5) => e5.slice()), index: r2 ? r2.array.slice() : null, indirectBuffer: s2 ? s2.slice() : null } : { roots: o2, index: r2 ? r2.array : null, indirectBuffer: s2 }, i2;
|
|
1205
1205
|
}
|
|
1206
1206
|
static deserialize(e4, n2, o2 = {}) {
|
|
1207
1207
|
o2 = { setIndex: true, indirect: Boolean(e4.indirectBuffer), ...o2 };
|
|
1208
|
-
const { index: s2, roots:
|
|
1209
|
-
if (a2._roots =
|
|
1208
|
+
const { index: s2, roots: r2, indirectBuffer: i2 } = e4, a2 = new on(n2, { ...o2, [z]: true });
|
|
1209
|
+
if (a2._roots = r2, a2._indirectBuffer = i2 || null, o2.setIndex) {
|
|
1210
1210
|
const o3 = n2.getIndex();
|
|
1211
1211
|
if (null === o3) {
|
|
1212
1212
|
const o4 = new t.BufferAttribute(e4.index, 1, false);
|
|
@@ -1221,108 +1221,108 @@ class on {
|
|
|
1221
1221
|
constructor(e4, n2 = {}) {
|
|
1222
1222
|
if (!e4.isBufferGeometry) throw new Error("MeshBVH: Only BufferGeometries are supported.");
|
|
1223
1223
|
if (e4.index && e4.index.isInterleavedBufferAttribute) throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");
|
|
1224
|
-
if ((n2 = Object.assign({ ...nn, [
|
|
1225
|
-
this.geometry = e4, this._roots = null, this._indirectBuffer = null, n2[
|
|
1224
|
+
if ((n2 = Object.assign({ ...nn, [z]: false }, n2)).useSharedArrayBuffer && "undefined" == typeof SharedArrayBuffer) throw new Error("MeshBVH: SharedArrayBuffer is not available.");
|
|
1225
|
+
this.geometry = e4, this._roots = null, this._indirectBuffer = null, n2[z] || (ve(this, n2), !e4.boundingBox && n2.setBoundingBox && (e4.boundingBox = this.getBoundingBox(new t.Box3()))), this.resolveTriangleIndex = n2.indirect ? (e5) => this._indirectBuffer[e5] : (e5) => e5;
|
|
1226
1226
|
}
|
|
1227
1227
|
refit(e4 = null) {
|
|
1228
1228
|
return (this.indirect ? Ct : Qe)(this, e4);
|
|
1229
1229
|
}
|
|
1230
1230
|
traverse(e4, t2 = 0) {
|
|
1231
1231
|
const n2 = this._roots[t2], o2 = new Uint32Array(n2), s2 = new Uint16Array(n2);
|
|
1232
|
-
!(function t3(
|
|
1233
|
-
const a2 = 2 *
|
|
1232
|
+
!(function t3(r2, i2 = 0) {
|
|
1233
|
+
const a2 = 2 * r2, l2 = s2[a2 + 15] === j;
|
|
1234
1234
|
if (l2) {
|
|
1235
|
-
const t4 = o2[
|
|
1236
|
-
e4(
|
|
1235
|
+
const t4 = o2[r2 + 6], c2 = s2[a2 + 14];
|
|
1236
|
+
e4(i2, l2, new Float32Array(n2, 4 * r2, 6), t4, c2);
|
|
1237
1237
|
} else {
|
|
1238
|
-
const s3 =
|
|
1239
|
-
e4(
|
|
1238
|
+
const s3 = r2 + 8, a3 = o2[r2 + 6], c2 = o2[r2 + 7];
|
|
1239
|
+
e4(i2, l2, new Float32Array(n2, 4 * r2, 6), c2) || (t3(s3, i2 + 1), t3(a3, i2 + 1));
|
|
1240
1240
|
}
|
|
1241
1241
|
})(0);
|
|
1242
1242
|
}
|
|
1243
1243
|
raycast(e4, n2 = t.FrontSide, o2 = 0, s2 = 1 / 0) {
|
|
1244
|
-
const
|
|
1245
|
-
for (let t2 = 0,
|
|
1246
|
-
const
|
|
1247
|
-
if (u2(this, t2,
|
|
1244
|
+
const r2 = this._roots, i2 = this.geometry, a2 = [], l2 = n2.isMaterial, c2 = Array.isArray(n2), d2 = i2.groups, h2 = l2 ? n2.side : n2, u2 = this.indirect ? Mt : nt;
|
|
1245
|
+
for (let t2 = 0, i3 = r2.length; t2 < i3; t2++) {
|
|
1246
|
+
const r3 = c2 ? n2[d2[t2].materialIndex].side : h2, i4 = a2.length;
|
|
1247
|
+
if (u2(this, t2, r3, e4, a2, o2, s2), c2) {
|
|
1248
1248
|
const e5 = d2[t2].materialIndex;
|
|
1249
|
-
for (let t3 =
|
|
1249
|
+
for (let t3 = i4, n3 = a2.length; t3 < n3; t3++) a2[t3].face.materialIndex = e5;
|
|
1250
1250
|
}
|
|
1251
1251
|
}
|
|
1252
1252
|
return a2;
|
|
1253
1253
|
}
|
|
1254
1254
|
raycastFirst(e4, n2 = t.FrontSide, o2 = 0, s2 = 1 / 0) {
|
|
1255
|
-
const
|
|
1255
|
+
const r2 = this._roots, i2 = this.geometry, a2 = n2.isMaterial, l2 = Array.isArray(n2);
|
|
1256
1256
|
let c2 = null;
|
|
1257
|
-
const d2 =
|
|
1258
|
-
for (let t2 = 0,
|
|
1259
|
-
const
|
|
1260
|
-
null !=
|
|
1257
|
+
const d2 = i2.groups, h2 = a2 ? n2.side : n2, u2 = this.indirect ? At : rt;
|
|
1258
|
+
for (let t2 = 0, i3 = r2.length; t2 < i3; t2++) {
|
|
1259
|
+
const r3 = u2(this, t2, l2 ? n2[d2[t2].materialIndex].side : h2, e4, o2, s2);
|
|
1260
|
+
null != r3 && (null == c2 || r3.distance < c2.distance) && (c2 = r3, l2 && (r3.face.materialIndex = d2[t2].materialIndex));
|
|
1261
1261
|
}
|
|
1262
1262
|
return c2;
|
|
1263
1263
|
}
|
|
1264
1264
|
intersectsGeometry(e4, t2) {
|
|
1265
1265
|
let n2 = false;
|
|
1266
1266
|
const o2 = this._roots, s2 = this.indirect ? jt : pt;
|
|
1267
|
-
for (let
|
|
1267
|
+
for (let r2 = 0, i2 = o2.length; r2 < i2 && (n2 = s2(this, r2, e4, t2), !n2); r2++) ;
|
|
1268
1268
|
return n2;
|
|
1269
1269
|
}
|
|
1270
1270
|
shapecast(e4) {
|
|
1271
1271
|
const t2 = Te.getPrimitive(), n2 = this.indirect ? tt : Ze;
|
|
1272
|
-
let { boundsTraverseOrder: o2, intersectsBounds: s2, intersectsRange:
|
|
1273
|
-
if (
|
|
1274
|
-
const e5 =
|
|
1275
|
-
|
|
1276
|
-
} else
|
|
1272
|
+
let { boundsTraverseOrder: o2, intersectsBounds: s2, intersectsRange: r2, intersectsTriangle: i2 } = e4;
|
|
1273
|
+
if (r2 && i2) {
|
|
1274
|
+
const e5 = r2;
|
|
1275
|
+
r2 = (o3, s3, r3, a3, l3) => !!e5(o3, s3, r3, a3, l3) || n2(o3, s3, this, i2, r3, a3, t2);
|
|
1276
|
+
} else r2 || (r2 = i2 ? (e5, o3, s3, r3) => n2(e5, o3, this, i2, s3, r3, t2) : (e5, t3, n3) => n3);
|
|
1277
1277
|
let a2 = false, l2 = 0;
|
|
1278
1278
|
const c2 = this._roots;
|
|
1279
1279
|
for (let e5 = 0, t3 = c2.length; e5 < t3; e5++) {
|
|
1280
1280
|
const t4 = c2[e5];
|
|
1281
|
-
if (a2 = ke(this, e5, s2,
|
|
1281
|
+
if (a2 = ke(this, e5, s2, r2, o2, l2), a2) break;
|
|
1282
1282
|
l2 += t4.byteLength;
|
|
1283
1283
|
}
|
|
1284
1284
|
return Te.releasePrimitive(t2), a2;
|
|
1285
1285
|
}
|
|
1286
1286
|
bvhcast(e4, n2, o2) {
|
|
1287
|
-
let { intersectsRanges: s2, intersectsTriangles:
|
|
1288
|
-
const
|
|
1287
|
+
let { intersectsRanges: s2, intersectsTriangles: r2 } = o2;
|
|
1288
|
+
const i2 = Te.getPrimitive(), a2 = this.geometry.index, l2 = this.geometry.attributes.position, c2 = this.indirect ? (e5) => {
|
|
1289
1289
|
const t2 = this.resolveTriangleIndex(e5);
|
|
1290
|
-
Ke(
|
|
1290
|
+
Ke(i2, 3 * t2, a2, l2);
|
|
1291
1291
|
} : (e5) => {
|
|
1292
|
-
Ke(
|
|
1292
|
+
Ke(i2, 3 * e5, a2, l2);
|
|
1293
1293
|
}, d2 = Te.getPrimitive(), h2 = e4.geometry.index, u2 = e4.geometry.attributes.position, p2 = e4.indirect ? (t2) => {
|
|
1294
1294
|
const n3 = e4.resolveTriangleIndex(t2);
|
|
1295
1295
|
Ke(d2, 3 * n3, h2, u2);
|
|
1296
1296
|
} : (e5) => {
|
|
1297
1297
|
Ke(d2, 3 * e5, h2, u2);
|
|
1298
1298
|
};
|
|
1299
|
-
if (
|
|
1299
|
+
if (r2) {
|
|
1300
1300
|
const e5 = (e6, t2, o3, s3, a3, l3, h3, u3) => {
|
|
1301
1301
|
for (let m2 = o3, f2 = o3 + s3; m2 < f2; m2++) {
|
|
1302
1302
|
p2(m2), d2.a.applyMatrix4(n2), d2.b.applyMatrix4(n2), d2.c.applyMatrix4(n2), d2.needsUpdate = true;
|
|
1303
|
-
for (let n3 = e6, o4 = e6 + t2; n3 < o4; n3++) if (c2(n3),
|
|
1303
|
+
for (let n3 = e6, o4 = e6 + t2; n3 < o4; n3++) if (c2(n3), i2.needsUpdate = true, r2(i2, d2, n3, m2, a3, l3, h3, u3)) return true;
|
|
1304
1304
|
}
|
|
1305
1305
|
return false;
|
|
1306
1306
|
};
|
|
1307
1307
|
if (s2) {
|
|
1308
1308
|
const t2 = s2;
|
|
1309
|
-
s2 = function(n3, o3, s3,
|
|
1310
|
-
return !!t2(n3, o3, s3,
|
|
1309
|
+
s2 = function(n3, o3, s3, r3, i3, a3, l3, c3) {
|
|
1310
|
+
return !!t2(n3, o3, s3, r3, i3, a3, l3, c3) || e5(n3, o3, s3, r3, i3, a3, l3, c3);
|
|
1311
1311
|
};
|
|
1312
1312
|
} else s2 = e5;
|
|
1313
1313
|
}
|
|
1314
1314
|
return (function(e5, n3, o3, s3) {
|
|
1315
1315
|
if (Zt) throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");
|
|
1316
1316
|
Zt = true;
|
|
1317
|
-
const
|
|
1317
|
+
const r3 = e5._roots, i3 = n3._roots;
|
|
1318
1318
|
let a3, l3 = 0, c3 = 0;
|
|
1319
1319
|
const d3 = new t.Matrix4().copy(o3).invert();
|
|
1320
|
-
for (let e6 = 0, t2 =
|
|
1321
|
-
$t.setBuffer(
|
|
1320
|
+
for (let e6 = 0, t2 = r3.length; e6 < t2; e6++) {
|
|
1321
|
+
$t.setBuffer(r3[e6]), c3 = 0;
|
|
1322
1322
|
const t3 = qt.getPrimitive();
|
|
1323
1323
|
V(le(0), $t.float32Array, t3), t3.applyMatrix4(d3);
|
|
1324
|
-
for (let e7 = 0, n4 =
|
|
1325
|
-
if (qt.releasePrimitive(t3), $t.clearBuffer(), l3 +=
|
|
1324
|
+
for (let e7 = 0, n4 = i3.length; e7 < n4 && (Xt.setBuffer(i3[e7]), a3 = Qt(0, 0, o3, d3, s3, l3, c3, 0, 0, t3), Xt.clearBuffer(), c3 += i3[e7].length, !a3); e7++) ;
|
|
1325
|
+
if (qt.releasePrimitive(t3), $t.clearBuffer(), l3 += r3[e6].length, a3) break;
|
|
1326
1326
|
}
|
|
1327
1327
|
return Zt = false, a3;
|
|
1328
1328
|
})(this, e4, n2, s2);
|
|
@@ -1333,20 +1333,20 @@ class on {
|
|
|
1333
1333
|
intersectsSphere(e4) {
|
|
1334
1334
|
return this.shapecast({ intersectsBounds: (t2) => e4.intersectsBox(t2), intersectsTriangle: (t2) => t2.intersectsSphere(e4) });
|
|
1335
1335
|
}
|
|
1336
|
-
closestPointToGeometry(e4, t2, n2 = {}, o2 = {}, s2 = 0,
|
|
1337
|
-
return (this.indirect ? Nt : _t)(this, e4, t2, n2, o2, s2,
|
|
1336
|
+
closestPointToGeometry(e4, t2, n2 = {}, o2 = {}, s2 = 0, r2 = 1 / 0) {
|
|
1337
|
+
return (this.indirect ? Nt : _t)(this, e4, t2, n2, o2, s2, r2);
|
|
1338
1338
|
}
|
|
1339
1339
|
closestPointToPoint(e4, t2 = {}, n2 = 0, o2 = 1 / 0) {
|
|
1340
1340
|
return (function(e5, t3, n3 = {}, o3 = 0, s2 = 1 / 0) {
|
|
1341
|
-
const
|
|
1341
|
+
const r2 = o3 * o3, i2 = s2 * s2;
|
|
1342
1342
|
let a2 = 1 / 0, l2 = null;
|
|
1343
|
-
if (e5.shapecast({ boundsTraverseOrder: (e6) => (
|
|
1344
|
-
e6.closestPointToPoint(t3,
|
|
1345
|
-
const o4 = t3.distanceToSquared(
|
|
1346
|
-
return o4 < a2 && (
|
|
1343
|
+
if (e5.shapecast({ boundsTraverseOrder: (e6) => (De.copy(t3).clamp(e6.min, e6.max), De.distanceToSquared(t3)), intersectsBounds: (e6, t4, n4) => n4 < a2 && n4 < i2, intersectsTriangle: (e6, n4) => {
|
|
1344
|
+
e6.closestPointToPoint(t3, De);
|
|
1345
|
+
const o4 = t3.distanceToSquared(De);
|
|
1346
|
+
return o4 < a2 && (ze.copy(De), a2 = o4, l2 = n4), o4 < r2;
|
|
1347
1347
|
} }), a2 === 1 / 0) return null;
|
|
1348
1348
|
const c2 = Math.sqrt(a2);
|
|
1349
|
-
return n3.point ? n3.point.copy(
|
|
1349
|
+
return n3.point ? n3.point.copy(ze) : n3.point = ze.clone(), n3.distance = c2, n3.faceIndex = l2, n3;
|
|
1350
1350
|
})(this, e4, t2, n2, o2);
|
|
1351
1351
|
}
|
|
1352
1352
|
getBoundingBox(e4) {
|
|
@@ -1365,16 +1365,16 @@ function mn(e4, t2) {
|
|
|
1365
1365
|
}
|
|
1366
1366
|
function fn(e4, n2) {
|
|
1367
1367
|
if (this.boundsTrees) {
|
|
1368
|
-
const o2 = this.boundsTrees, s2 = this._drawInfo || this._instanceInfo,
|
|
1368
|
+
const o2 = this.boundsTrees, s2 = this._drawInfo || this._instanceInfo, r2 = this._drawRanges || this._geometryInfo, i2 = this.matrixWorld;
|
|
1369
1369
|
un.material = this.material, un.geometry = this.geometry;
|
|
1370
1370
|
const a2 = un.geometry.boundsTree, l2 = un.geometry.drawRange;
|
|
1371
1371
|
null === un.geometry.boundingSphere && (un.geometry.boundingSphere = new t.Sphere());
|
|
1372
1372
|
for (let t2 = 0, a3 = s2.length; t2 < a3; t2++) {
|
|
1373
1373
|
if (!this.getVisibleAt(t2)) continue;
|
|
1374
1374
|
const a4 = s2[t2].geometryIndex;
|
|
1375
|
-
if (un.geometry.boundsTree = o2[a4], this.getMatrixAt(t2, un.matrixWorld).premultiply(
|
|
1375
|
+
if (un.geometry.boundsTree = o2[a4], this.getMatrixAt(t2, un.matrixWorld).premultiply(i2), !un.geometry.boundsTree) {
|
|
1376
1376
|
this.getBoundingBoxAt(a4, un.geometry.boundingBox), this.getBoundingSphereAt(a4, un.geometry.boundingSphere);
|
|
1377
|
-
const e5 =
|
|
1377
|
+
const e5 = r2[a4];
|
|
1378
1378
|
un.geometry.setDrawRange(e5.start, e5.count);
|
|
1379
1379
|
}
|
|
1380
1380
|
un.raycast(e4, pn);
|
|
@@ -1391,12 +1391,12 @@ function gn(e4, t2) {
|
|
|
1391
1391
|
if (this.geometry.boundsTree) {
|
|
1392
1392
|
if (void 0 === this.material) return;
|
|
1393
1393
|
ln.copy(this.matrixWorld).invert(), rn.copy(e4.ray).applyMatrix4(ln), hn.setFromMatrixScale(this.matrixWorld), an.copy(rn.direction).multiply(hn);
|
|
1394
|
-
const n2 = an.length(), o2 = e4.near / n2, s2 = e4.far / n2,
|
|
1394
|
+
const n2 = an.length(), o2 = e4.near / n2, s2 = e4.far / n2, r2 = this.geometry.boundsTree;
|
|
1395
1395
|
if (true === e4.firstHitOnly) {
|
|
1396
|
-
const n3 = sn(
|
|
1396
|
+
const n3 = sn(r2.raycastFirst(rn, this.material, o2, s2), this, e4);
|
|
1397
1397
|
n3 && t2.push(n3);
|
|
1398
1398
|
} else {
|
|
1399
|
-
const n3 =
|
|
1399
|
+
const n3 = r2.raycast(rn, this.material, o2, s2);
|
|
1400
1400
|
for (let o3 = 0, s3 = n3.length; o3 < s3; o3++) {
|
|
1401
1401
|
const s4 = sn(n3[o3], this, e4);
|
|
1402
1402
|
s4 && t2.push(s4);
|
|
@@ -1454,12 +1454,12 @@ const Mn = { dracoPath: "/draco/gltf/", useDraco: true, autoBuildBVH: true, opti
|
|
|
1454
1454
|
const Pn = { enabled: true, outline: { enabled: true, edgeStrength: 4, edgeGlow: 0, edgeThickness: 2, pulsePeriod: 0, visibleEdgeColor: 16449071, hiddenEdgeColor: 16449071 }, bloom: { enabled: false, strength: 1.5, radius: 0.4, threshold: 0.85 }, ssao: { enabled: false, intensity: 0.01, scale: 100 }, ssr: { enabled: false, thickness: 0.018, infiniteThick: false, maxDistance: 0.01, opacity: 0.5 }, screenMask: { enabled: false } };
|
|
1455
1455
|
const Sn = { modes: ["选择", "根选择", "变换", "场景绘制", "点击信息"], defaultMode: "变换", isTransformChildren: false, enableKeyboard: false };
|
|
1456
1456
|
function An(e4, t2) {
|
|
1457
|
-
var n2 = e4.__state.conversionName.toString(), o2 = Math.round(e4.r), s2 = Math.round(e4.g),
|
|
1457
|
+
var n2 = e4.__state.conversionName.toString(), o2 = Math.round(e4.r), s2 = Math.round(e4.g), r2 = Math.round(e4.b), i2 = e4.a, a2 = Math.round(e4.h), l2 = e4.s.toFixed(1), c2 = e4.v.toFixed(1);
|
|
1458
1458
|
if (t2 || "THREE_CHAR_HEX" === n2 || "SIX_CHAR_HEX" === n2) {
|
|
1459
1459
|
for (var d2 = e4.hex.toString(16); d2.length < 6; ) d2 = "0" + d2;
|
|
1460
1460
|
return "#" + d2;
|
|
1461
1461
|
}
|
|
1462
|
-
return "CSS_RGB" === n2 ? "rgb(" + o2 + "," + s2 + "," +
|
|
1462
|
+
return "CSS_RGB" === n2 ? "rgb(" + o2 + "," + s2 + "," + r2 + ")" : "CSS_RGBA" === n2 ? "rgba(" + o2 + "," + s2 + "," + r2 + "," + i2 + ")" : "HEX" === n2 ? "0x" + e4.hex.toString(16) : "RGB_ARRAY" === n2 ? "[" + o2 + "," + s2 + "," + r2 + "]" : "RGBA_ARRAY" === n2 ? "[" + o2 + "," + s2 + "," + r2 + "," + i2 + "]" : "RGB_OBJ" === n2 ? "{r:" + o2 + ",g:" + s2 + ",b:" + r2 + "}" : "RGBA_OBJ" === n2 ? "{r:" + o2 + ",g:" + s2 + ",b:" + r2 + ",a:" + i2 + "}" : "HSV_OBJ" === n2 ? "{h:" + a2 + ",s:" + l2 + ",v:" + c2 + "}" : "HSVA_OBJ" === n2 ? "{h:" + a2 + ",s:" + l2 + ",v:" + c2 + ",a:" + i2 + "}" : "unknown format";
|
|
1463
1463
|
}
|
|
1464
1464
|
var Tn = Array.prototype.forEach, Fn = Array.prototype.slice, En = { BREAK: {}, extend: function(e4) {
|
|
1465
1465
|
return this.each(Fn.call(arguments, 1), function(t2) {
|
|
@@ -1485,18 +1485,18 @@ var Tn = Array.prototype.forEach, Fn = Array.prototype.slice, En = { BREAK: {},
|
|
|
1485
1485
|
else if (e4.length === e4.length + 0) {
|
|
1486
1486
|
var o2, s2 = void 0;
|
|
1487
1487
|
for (s2 = 0, o2 = e4.length; s2 < o2; s2++) if (s2 in e4 && t2.call(n2, e4[s2], s2) === this.BREAK) return;
|
|
1488
|
-
} else for (var
|
|
1488
|
+
} else for (var r2 in e4) if (t2.call(n2, e4[r2], r2) === this.BREAK) return;
|
|
1489
1489
|
}
|
|
1490
1490
|
}, defer: function(e4) {
|
|
1491
1491
|
setTimeout(e4, 0);
|
|
1492
1492
|
}, debounce: function(e4, t2, n2) {
|
|
1493
1493
|
var o2 = void 0;
|
|
1494
1494
|
return function() {
|
|
1495
|
-
var s2 = this,
|
|
1496
|
-
var
|
|
1495
|
+
var s2 = this, r2 = arguments;
|
|
1496
|
+
var i2 = n2 || !o2;
|
|
1497
1497
|
clearTimeout(o2), o2 = setTimeout(function() {
|
|
1498
|
-
o2 = null, n2 || e4.apply(s2,
|
|
1499
|
-
}, t2),
|
|
1498
|
+
o2 = null, n2 || e4.apply(s2, r2);
|
|
1499
|
+
}, t2), i2 && e4.apply(s2, r2);
|
|
1500
1500
|
};
|
|
1501
1501
|
}, toArray: function(e4) {
|
|
1502
1502
|
return e4.toArray ? e4.toArray() : Fn.call(e4);
|
|
@@ -1573,12 +1573,12 @@ var Tn = Array.prototype.forEach, Fn = Array.prototype.slice, En = { BREAK: {},
|
|
|
1573
1573
|
if (Ln = t3.read(e4), false === On && false !== Ln) return On = Ln, Ln.conversionName = n2, Ln.conversion = t3, En.BREAK;
|
|
1574
1574
|
}), En.BREAK;
|
|
1575
1575
|
}), On;
|
|
1576
|
-
}, jn = void 0,
|
|
1577
|
-
var o2 = Math.floor(e4 / 60) % 6, s2 = e4 / 60 - Math.floor(e4 / 60),
|
|
1576
|
+
}, jn = void 0, Dn = { hsv_to_rgb: function(e4, t2, n2) {
|
|
1577
|
+
var o2 = Math.floor(e4 / 60) % 6, s2 = e4 / 60 - Math.floor(e4 / 60), r2 = n2 * (1 - t2), i2 = n2 * (1 - s2 * t2), a2 = n2 * (1 - (1 - s2) * t2), l2 = [[n2, a2, r2], [i2, n2, r2], [r2, n2, a2], [r2, i2, n2], [a2, r2, n2], [n2, r2, i2]][o2];
|
|
1578
1578
|
return { r: 255 * l2[0], g: 255 * l2[1], b: 255 * l2[2] };
|
|
1579
1579
|
}, rgb_to_hsv: function(e4, t2, n2) {
|
|
1580
|
-
var o2 = Math.min(e4, t2, n2), s2 = Math.max(e4, t2, n2),
|
|
1581
|
-
return 0 === s2 ? { h: NaN, s: 0, v: 0 } : (
|
|
1580
|
+
var o2 = Math.min(e4, t2, n2), s2 = Math.max(e4, t2, n2), r2 = s2 - o2, i2 = void 0;
|
|
1581
|
+
return 0 === s2 ? { h: NaN, s: 0, v: 0 } : (i2 = e4 === s2 ? (t2 - n2) / r2 : t2 === s2 ? 2 + (n2 - e4) / r2 : 4 + (e4 - t2) / r2, (i2 /= 6) < 0 && (i2 += 1), { h: 360 * i2, s: r2 / s2, v: s2 / 255 });
|
|
1582
1582
|
}, rgb_to_hex: function(e4, t2, n2) {
|
|
1583
1583
|
var o2 = this.hex_with_component(0, 2, e4);
|
|
1584
1584
|
return o2 = this.hex_with_component(o2, 1, t2), o2 = this.hex_with_component(o2, 0, n2);
|
|
@@ -1586,7 +1586,7 @@ var Tn = Array.prototype.forEach, Fn = Array.prototype.slice, En = { BREAK: {},
|
|
|
1586
1586
|
return e4 >> 8 * t2 & 255;
|
|
1587
1587
|
}, hex_with_component: function(e4, t2, n2) {
|
|
1588
1588
|
return n2 << (jn = 8 * t2) | e4 & ~(255 << jn);
|
|
1589
|
-
} },
|
|
1589
|
+
} }, zn = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e4) {
|
|
1590
1590
|
return typeof e4;
|
|
1591
1591
|
} : function(e4) {
|
|
1592
1592
|
return e4 && "function" == typeof Symbol && e4.constructor === Symbol && e4 !== Symbol.prototype ? "symbol" : typeof e4;
|
|
@@ -1606,12 +1606,12 @@ var Tn = Array.prototype.forEach, Fn = Array.prototype.slice, En = { BREAK: {},
|
|
|
1606
1606
|
null === t2 && (t2 = Function.prototype);
|
|
1607
1607
|
var s2 = Object.getOwnPropertyDescriptor(t2, n2);
|
|
1608
1608
|
if (void 0 === s2) {
|
|
1609
|
-
var
|
|
1610
|
-
return null ===
|
|
1609
|
+
var r2 = Object.getPrototypeOf(t2);
|
|
1610
|
+
return null === r2 ? void 0 : e2(r2, n2, o2);
|
|
1611
1611
|
}
|
|
1612
1612
|
if ("value" in s2) return s2.value;
|
|
1613
|
-
var
|
|
1614
|
-
return void 0 !==
|
|
1613
|
+
var i2 = s2.get;
|
|
1614
|
+
return void 0 !== i2 ? i2.call(o2) : void 0;
|
|
1615
1615
|
}, Hn = function(e4, t2) {
|
|
1616
1616
|
if ("function" != typeof t2 && null !== t2) throw new TypeError("Super expression must either be null or a function, not " + typeof t2);
|
|
1617
1617
|
e4.prototype = Object.create(t2 && t2.prototype, { constructor: { value: e4, enumerable: false, writable: true, configurable: true } }), t2 && (Object.setPrototypeOf ? Object.setPrototypeOf(e4, t2) : e4.__proto__ = t2);
|
|
@@ -1646,20 +1646,20 @@ function $n(e4, t2) {
|
|
|
1646
1646
|
} });
|
|
1647
1647
|
}
|
|
1648
1648
|
Vn.recalculateRGB = function(e4, t2, n2) {
|
|
1649
|
-
if ("HEX" === e4.__state.space) e4.__state[t2] =
|
|
1649
|
+
if ("HEX" === e4.__state.space) e4.__state[t2] = Dn.component_from_hex(e4.__state.hex, n2);
|
|
1650
1650
|
else {
|
|
1651
1651
|
if ("HSV" !== e4.__state.space) throw new Error("Corrupted color state");
|
|
1652
|
-
En.extend(e4.__state,
|
|
1652
|
+
En.extend(e4.__state, Dn.hsv_to_rgb(e4.__state.h, e4.__state.s, e4.__state.v));
|
|
1653
1653
|
}
|
|
1654
1654
|
}, Vn.recalculateHSV = function(e4) {
|
|
1655
|
-
var t2 =
|
|
1655
|
+
var t2 = Dn.rgb_to_hsv(e4.r, e4.g, e4.b);
|
|
1656
1656
|
En.extend(e4.__state, { s: t2.s, v: t2.v }), En.isNaN(t2.h) ? En.isUndefined(e4.__state.h) && (e4.__state.h = 0) : e4.__state.h = t2.h;
|
|
1657
1657
|
}, Vn.COMPONENTS = ["r", "g", "b", "h", "s", "v", "hex", "a"], Nn(Vn.prototype, "r", 2), Nn(Vn.prototype, "g", 1), Nn(Vn.prototype, "b", 0), $n(Vn.prototype, "h"), $n(Vn.prototype, "s"), $n(Vn.prototype, "v"), Object.defineProperty(Vn.prototype, "a", { get: function() {
|
|
1658
1658
|
return this.__state.a;
|
|
1659
1659
|
}, set: function(e4) {
|
|
1660
1660
|
this.__state.a = e4;
|
|
1661
1661
|
} }), Object.defineProperty(Vn.prototype, "hex", { get: function() {
|
|
1662
|
-
return "HEX" !== this.__state.space && (this.__state.hex =
|
|
1662
|
+
return "HEX" !== this.__state.space && (this.__state.hex = Dn.rgb_to_hex(this.r, this.g, this.b), this.__state.space = "HEX"), this.__state.hex;
|
|
1663
1663
|
}, set: function(e4) {
|
|
1664
1664
|
this.__state.space = "HEX", this.__state.hex = e4;
|
|
1665
1665
|
} });
|
|
@@ -1701,22 +1701,22 @@ var Yn = { makeSelectable: function(e4, t2) {
|
|
|
1701
1701
|
var o2 = n2, s2 = t2;
|
|
1702
1702
|
En.isUndefined(s2) && (s2 = true), En.isUndefined(o2) && (o2 = true), e4.style.position = "absolute", s2 && (e4.style.left = 0, e4.style.right = 0), o2 && (e4.style.top = 0, e4.style.bottom = 0);
|
|
1703
1703
|
}, fakeEvent: function(e4, t2, n2, o2) {
|
|
1704
|
-
var s2 = n2 || {},
|
|
1705
|
-
if (!
|
|
1706
|
-
var
|
|
1707
|
-
switch (
|
|
1704
|
+
var s2 = n2 || {}, r2 = qn[t2];
|
|
1705
|
+
if (!r2) throw new Error("Event type " + t2 + " not supported.");
|
|
1706
|
+
var i2 = document.createEvent(r2);
|
|
1707
|
+
switch (r2) {
|
|
1708
1708
|
case "MouseEvents":
|
|
1709
1709
|
var a2 = s2.x || s2.clientX || 0, l2 = s2.y || s2.clientY || 0;
|
|
1710
|
-
|
|
1710
|
+
i2.initMouseEvent(t2, s2.bubbles || false, s2.cancelable || true, window, s2.clickCount || 1, 0, 0, a2, l2, false, false, false, false, 0, null);
|
|
1711
1711
|
break;
|
|
1712
1712
|
case "KeyboardEvents":
|
|
1713
|
-
var c2 =
|
|
1713
|
+
var c2 = i2.initKeyboardEvent || i2.initKeyEvent;
|
|
1714
1714
|
En.defaults(s2, { cancelable: true, ctrlKey: false, altKey: false, shiftKey: false, metaKey: false, keyCode: void 0, charCode: void 0 }), c2(t2, s2.bubbles || false, s2.cancelable, window, s2.ctrlKey, s2.altKey, s2.shiftKey, s2.metaKey, s2.keyCode, s2.charCode);
|
|
1715
1715
|
break;
|
|
1716
1716
|
default:
|
|
1717
|
-
|
|
1717
|
+
i2.initEvent(t2, s2.bubbles || false, s2.cancelable || true);
|
|
1718
1718
|
}
|
|
1719
|
-
En.defaults(
|
|
1719
|
+
En.defaults(i2, o2), e4.dispatchEvent(i2);
|
|
1720
1720
|
}, bind: function(e4, t2, n2, o2) {
|
|
1721
1721
|
var s2 = o2 || false;
|
|
1722
1722
|
return e4.addEventListener ? e4.addEventListener(t2, n2, s2) : e4.attachEvent && e4.attachEvent("on" + t2, n2), Yn;
|
|
@@ -1771,19 +1771,19 @@ var Yn = { makeSelectable: function(e4, t2) {
|
|
|
1771
1771
|
})(), Zn = (function() {
|
|
1772
1772
|
function e4(t2, n2, o2) {
|
|
1773
1773
|
Rn(this, e4);
|
|
1774
|
-
var s2 = Gn(this, (e4.__proto__ || Object.getPrototypeOf(e4)).call(this, t2, n2)),
|
|
1775
|
-
if (s2.__select = document.createElement("select"), En.isArray(
|
|
1774
|
+
var s2 = Gn(this, (e4.__proto__ || Object.getPrototypeOf(e4)).call(this, t2, n2)), r2 = o2, i2 = s2;
|
|
1775
|
+
if (s2.__select = document.createElement("select"), En.isArray(r2)) {
|
|
1776
1776
|
var a2 = {};
|
|
1777
|
-
En.each(
|
|
1777
|
+
En.each(r2, function(e5) {
|
|
1778
1778
|
a2[e5] = e5;
|
|
1779
|
-
}),
|
|
1779
|
+
}), r2 = a2;
|
|
1780
1780
|
}
|
|
1781
|
-
return En.each(
|
|
1781
|
+
return En.each(r2, function(e5, t3) {
|
|
1782
1782
|
var n3 = document.createElement("option");
|
|
1783
|
-
n3.innerHTML = t3, n3.setAttribute("value", e5),
|
|
1783
|
+
n3.innerHTML = t3, n3.setAttribute("value", e5), i2.__select.appendChild(n3);
|
|
1784
1784
|
}), s2.updateDisplay(), Yn.bind(s2.__select, "change", function() {
|
|
1785
1785
|
var e5 = this.options[this.selectedIndex].value;
|
|
1786
|
-
|
|
1786
|
+
i2.setValue(e5);
|
|
1787
1787
|
}), s2.domElement.appendChild(s2.__select), s2;
|
|
1788
1788
|
}
|
|
1789
1789
|
return Hn(e4, Xn), Un(e4, [{ key: "setValue", value: function(t2) {
|
|
@@ -1796,10 +1796,10 @@ var Yn = { makeSelectable: function(e4, t2) {
|
|
|
1796
1796
|
function e4(t2, n2) {
|
|
1797
1797
|
Rn(this, e4);
|
|
1798
1798
|
var o2 = Gn(this, (e4.__proto__ || Object.getPrototypeOf(e4)).call(this, t2, n2)), s2 = o2;
|
|
1799
|
-
function
|
|
1799
|
+
function r2() {
|
|
1800
1800
|
s2.setValue(s2.__input.value);
|
|
1801
1801
|
}
|
|
1802
|
-
return o2.__input = document.createElement("input"), o2.__input.setAttribute("type", "text"), Yn.bind(o2.__input, "keyup",
|
|
1802
|
+
return o2.__input = document.createElement("input"), o2.__input.setAttribute("type", "text"), Yn.bind(o2.__input, "keyup", r2), Yn.bind(o2.__input, "change", r2), Yn.bind(o2.__input, "blur", function() {
|
|
1803
1803
|
s2.__onFinishChange && s2.__onFinishChange.call(s2, s2.getValue());
|
|
1804
1804
|
}), Yn.bind(o2.__input, "keydown", function(e5) {
|
|
1805
1805
|
13 === e5.keyCode && this.blur();
|
|
@@ -1816,8 +1816,8 @@ function eo(e4) {
|
|
|
1816
1816
|
var to = (function() {
|
|
1817
1817
|
function e4(t2, n2, o2) {
|
|
1818
1818
|
Rn(this, e4);
|
|
1819
|
-
var s2 = Gn(this, (e4.__proto__ || Object.getPrototypeOf(e4)).call(this, t2, n2)),
|
|
1820
|
-
return s2.__min =
|
|
1819
|
+
var s2 = Gn(this, (e4.__proto__ || Object.getPrototypeOf(e4)).call(this, t2, n2)), r2 = o2 || {};
|
|
1820
|
+
return s2.__min = r2.min, s2.__max = r2.max, s2.__step = r2.step, En.isUndefined(s2.__step) ? 0 === s2.initialValue ? s2.__impliedStep = 1 : s2.__impliedStep = Math.pow(10, Math.floor(Math.log(Math.abs(s2.initialValue)) / Math.LN10)) / 10 : s2.__impliedStep = s2.__step, s2.__precision = eo(s2.__impliedStep), s2;
|
|
1821
1821
|
}
|
|
1822
1822
|
return Hn(e4, Xn), Un(e4, [{ key: "setValue", value: function(t2) {
|
|
1823
1823
|
var n2 = t2;
|
|
@@ -1835,26 +1835,26 @@ var no = (function() {
|
|
|
1835
1835
|
Rn(this, e4);
|
|
1836
1836
|
var s2 = Gn(this, (e4.__proto__ || Object.getPrototypeOf(e4)).call(this, t2, n2, o2));
|
|
1837
1837
|
s2.__truncationSuspended = false;
|
|
1838
|
-
var
|
|
1838
|
+
var r2 = s2, i2 = void 0;
|
|
1839
1839
|
function a2() {
|
|
1840
|
-
|
|
1840
|
+
r2.__onFinishChange && r2.__onFinishChange.call(r2, r2.getValue());
|
|
1841
1841
|
}
|
|
1842
1842
|
function l2(e5) {
|
|
1843
|
-
var t3 =
|
|
1844
|
-
|
|
1843
|
+
var t3 = i2 - e5.clientY;
|
|
1844
|
+
r2.setValue(r2.getValue() + t3 * r2.__impliedStep), i2 = e5.clientY;
|
|
1845
1845
|
}
|
|
1846
1846
|
function c2() {
|
|
1847
1847
|
Yn.unbind(window, "mousemove", l2), Yn.unbind(window, "mouseup", c2), a2();
|
|
1848
1848
|
}
|
|
1849
1849
|
return s2.__input = document.createElement("input"), s2.__input.setAttribute("type", "text"), Yn.bind(s2.__input, "change", function() {
|
|
1850
|
-
var e5 = parseFloat(
|
|
1851
|
-
En.isNaN(e5) ||
|
|
1850
|
+
var e5 = parseFloat(r2.__input.value);
|
|
1851
|
+
En.isNaN(e5) || r2.setValue(e5);
|
|
1852
1852
|
}), Yn.bind(s2.__input, "blur", function() {
|
|
1853
1853
|
a2();
|
|
1854
1854
|
}), Yn.bind(s2.__input, "mousedown", function(e5) {
|
|
1855
|
-
Yn.bind(window, "mousemove", l2), Yn.bind(window, "mouseup", c2),
|
|
1855
|
+
Yn.bind(window, "mousemove", l2), Yn.bind(window, "mouseup", c2), i2 = e5.clientY;
|
|
1856
1856
|
}), Yn.bind(s2.__input, "keydown", function(e5) {
|
|
1857
|
-
13 === e5.keyCode && (
|
|
1857
|
+
13 === e5.keyCode && (r2.__truncationSuspended = true, this.blur(), r2.__truncationSuspended = false, a2());
|
|
1858
1858
|
}), s2.updateDisplay(), s2.domElement.appendChild(s2.__input), s2;
|
|
1859
1859
|
}
|
|
1860
1860
|
return Hn(e4, to), Un(e4, [{ key: "updateDisplay", value: function() {
|
|
@@ -1866,9 +1866,9 @@ function oo(e4, t2, n2, o2, s2) {
|
|
|
1866
1866
|
return o2 + (e4 - t2) / (n2 - t2) * (s2 - o2);
|
|
1867
1867
|
}
|
|
1868
1868
|
var so = (function() {
|
|
1869
|
-
function e4(t2, n2, o2, s2,
|
|
1869
|
+
function e4(t2, n2, o2, s2, r2) {
|
|
1870
1870
|
Rn(this, e4);
|
|
1871
|
-
var
|
|
1871
|
+
var i2 = Gn(this, (e4.__proto__ || Object.getPrototypeOf(e4)).call(this, t2, n2, { min: o2, max: s2, step: r2 })), a2 = i2;
|
|
1872
1872
|
function l2(e5) {
|
|
1873
1873
|
e5.preventDefault();
|
|
1874
1874
|
var t3 = a2.__background.getBoundingClientRect();
|
|
@@ -1884,29 +1884,29 @@ var so = (function() {
|
|
|
1884
1884
|
function h2() {
|
|
1885
1885
|
Yn.unbind(window, "touchmove", d2), Yn.unbind(window, "touchend", h2), a2.__onFinishChange && a2.__onFinishChange.call(a2, a2.getValue());
|
|
1886
1886
|
}
|
|
1887
|
-
return
|
|
1887
|
+
return i2.__background = document.createElement("div"), i2.__foreground = document.createElement("div"), Yn.bind(i2.__background, "mousedown", function(e5) {
|
|
1888
1888
|
document.activeElement.blur(), Yn.bind(window, "mousemove", l2), Yn.bind(window, "mouseup", c2), l2(e5);
|
|
1889
|
-
}), Yn.bind(
|
|
1889
|
+
}), Yn.bind(i2.__background, "touchstart", function(e5) {
|
|
1890
1890
|
if (1 !== e5.touches.length) return;
|
|
1891
1891
|
Yn.bind(window, "touchmove", d2), Yn.bind(window, "touchend", h2), d2(e5);
|
|
1892
|
-
}), Yn.addClass(
|
|
1892
|
+
}), Yn.addClass(i2.__background, "slider"), Yn.addClass(i2.__foreground, "slider-fg"), i2.updateDisplay(), i2.__background.appendChild(i2.__foreground), i2.domElement.appendChild(i2.__background), i2;
|
|
1893
1893
|
}
|
|
1894
1894
|
return Hn(e4, to), Un(e4, [{ key: "updateDisplay", value: function() {
|
|
1895
1895
|
var t2 = (this.getValue() - this.__min) / (this.__max - this.__min);
|
|
1896
1896
|
return this.__foreground.style.width = 100 * t2 + "%", In(e4.prototype.__proto__ || Object.getPrototypeOf(e4.prototype), "updateDisplay", this).call(this);
|
|
1897
1897
|
} }]), e4;
|
|
1898
|
-
})(),
|
|
1898
|
+
})(), ro = (function() {
|
|
1899
1899
|
function e4(t2, n2, o2) {
|
|
1900
1900
|
Rn(this, e4);
|
|
1901
|
-
var s2 = Gn(this, (e4.__proto__ || Object.getPrototypeOf(e4)).call(this, t2, n2)),
|
|
1901
|
+
var s2 = Gn(this, (e4.__proto__ || Object.getPrototypeOf(e4)).call(this, t2, n2)), r2 = s2;
|
|
1902
1902
|
return s2.__button = document.createElement("div"), s2.__button.innerHTML = void 0 === o2 ? "Fire" : o2, Yn.bind(s2.__button, "click", function(e5) {
|
|
1903
|
-
return e5.preventDefault(),
|
|
1903
|
+
return e5.preventDefault(), r2.fire(), false;
|
|
1904
1904
|
}), Yn.addClass(s2.__button, "button"), s2.domElement.appendChild(s2.__button), s2;
|
|
1905
1905
|
}
|
|
1906
1906
|
return Hn(e4, Xn), Un(e4, [{ key: "fire", value: function() {
|
|
1907
1907
|
this.__onChange && this.__onChange.call(this), this.getValue().call(this.object), this.__onFinishChange && this.__onFinishChange.call(this, this.getValue());
|
|
1908
1908
|
} }]), e4;
|
|
1909
|
-
})(),
|
|
1909
|
+
})(), io = (function() {
|
|
1910
1910
|
function e4(t2, n2) {
|
|
1911
1911
|
Rn(this, e4);
|
|
1912
1912
|
var o2 = Gn(this, (e4.__proto__ || Object.getPrototypeOf(e4)).call(this, t2, n2));
|
|
@@ -1923,7 +1923,7 @@ var so = (function() {
|
|
|
1923
1923
|
Yn.removeClass(s2.__selector, "drag");
|
|
1924
1924
|
});
|
|
1925
1925
|
});
|
|
1926
|
-
var
|
|
1926
|
+
var r2, i2 = document.createElement("div");
|
|
1927
1927
|
function a2(e5) {
|
|
1928
1928
|
p2(e5), Yn.bind(window, "mousemove", p2), Yn.bind(window, "touchmove", p2), Yn.bind(window, "mouseup", c2), Yn.bind(window, "touchend", c2);
|
|
1929
1929
|
}
|
|
@@ -1945,15 +1945,15 @@ var so = (function() {
|
|
|
1945
1945
|
}
|
|
1946
1946
|
function p2(e5) {
|
|
1947
1947
|
-1 === e5.type.indexOf("touch") && e5.preventDefault();
|
|
1948
|
-
var t3 = s2.__saturation_field.getBoundingClientRect(), n3 = e5.touches && e5.touches[0] || e5, o3 = n3.clientX,
|
|
1949
|
-
return a3 > 1 ? a3 = 1 : a3 < 0 && (a3 = 0),
|
|
1948
|
+
var t3 = s2.__saturation_field.getBoundingClientRect(), n3 = e5.touches && e5.touches[0] || e5, o3 = n3.clientX, r3 = n3.clientY, i3 = (o3 - t3.left) / (t3.right - t3.left), a3 = 1 - (r3 - t3.top) / (t3.bottom - t3.top);
|
|
1949
|
+
return a3 > 1 ? a3 = 1 : a3 < 0 && (a3 = 0), i3 > 1 ? i3 = 1 : i3 < 0 && (i3 = 0), s2.__color.v = a3, s2.__color.s = i3, s2.setValue(s2.__color.toOriginal()), false;
|
|
1950
1950
|
}
|
|
1951
1951
|
function m2(e5) {
|
|
1952
1952
|
-1 === e5.type.indexOf("touch") && e5.preventDefault();
|
|
1953
1953
|
var t3 = s2.__hue_field.getBoundingClientRect(), n3 = 1 - ((e5.touches && e5.touches[0] || e5).clientY - t3.top) / (t3.bottom - t3.top);
|
|
1954
1954
|
return n3 > 1 ? n3 = 1 : n3 < 0 && (n3 = 0), s2.__color.h = 360 * n3, s2.setValue(s2.__color.toOriginal()), false;
|
|
1955
1955
|
}
|
|
1956
|
-
return En.extend(o2.__selector.style, { width: "122px", height: "102px", padding: "3px", backgroundColor: "#222", boxShadow: "0px 1px 3px rgba(0,0,0,0.3)" }), En.extend(o2.__field_knob.style, { position: "absolute", width: "12px", height: "12px", border: o2.__field_knob_border + (o2.__color.v < 0.5 ? "#fff" : "#000"), boxShadow: "0px 1px 3px rgba(0,0,0,0.5)", borderRadius: "12px", zIndex: 1 }), En.extend(o2.__hue_knob.style, { position: "absolute", width: "15px", height: "2px", borderRight: "4px solid #fff", zIndex: 1 }), En.extend(o2.__saturation_field.style, { width: "100px", height: "100px", border: "1px solid #555", marginRight: "3px", display: "inline-block", cursor: "pointer" }), En.extend(
|
|
1956
|
+
return En.extend(o2.__selector.style, { width: "122px", height: "102px", padding: "3px", backgroundColor: "#222", boxShadow: "0px 1px 3px rgba(0,0,0,0.3)" }), En.extend(o2.__field_knob.style, { position: "absolute", width: "12px", height: "12px", border: o2.__field_knob_border + (o2.__color.v < 0.5 ? "#fff" : "#000"), boxShadow: "0px 1px 3px rgba(0,0,0,0.5)", borderRadius: "12px", zIndex: 1 }), En.extend(o2.__hue_knob.style, { position: "absolute", width: "15px", height: "2px", borderRight: "4px solid #fff", zIndex: 1 }), En.extend(o2.__saturation_field.style, { width: "100px", height: "100px", border: "1px solid #555", marginRight: "3px", display: "inline-block", cursor: "pointer" }), En.extend(i2.style, { width: "100%", height: "100%", background: "none" }), lo(i2, "top", "rgba(0,0,0,0)", "#000"), En.extend(o2.__hue_field.style, { width: "15px", height: "100px", border: "1px solid #555", cursor: "ns-resize", position: "absolute", top: "3px", right: "3px" }), (r2 = o2.__hue_field).style.background = "", r2.style.cssText += "background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);", r2.style.cssText += "background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);", r2.style.cssText += "background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);", r2.style.cssText += "background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);", r2.style.cssText += "background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);", En.extend(o2.__input.style, { outline: "none", textAlign: "center", color: "#fff", border: 0, fontWeight: "bold", textShadow: o2.__input_textShadow + "rgba(0,0,0,0.7)" }), Yn.bind(o2.__saturation_field, "mousedown", a2), Yn.bind(o2.__saturation_field, "touchstart", a2), Yn.bind(o2.__field_knob, "mousedown", a2), Yn.bind(o2.__field_knob, "touchstart", a2), Yn.bind(o2.__hue_field, "mousedown", l2), Yn.bind(o2.__hue_field, "touchstart", l2), o2.__saturation_field.appendChild(i2), o2.__selector.appendChild(o2.__field_knob), o2.__selector.appendChild(o2.__saturation_field), o2.__selector.appendChild(o2.__hue_field), o2.__hue_field.appendChild(o2.__hue_knob), o2.domElement.appendChild(o2.__input), o2.domElement.appendChild(o2.__selector), o2.updateDisplay(), o2;
|
|
1957
1957
|
}
|
|
1958
1958
|
return Hn(e4, Xn), Un(e4, [{ key: "updateDisplay", value: function() {
|
|
1959
1959
|
var e5 = kn(this.getValue());
|
|
@@ -1983,7 +1983,7 @@ var co = function(e4, t2) {
|
|
|
1983
1983
|
}
|
|
1984
1984
|
}, ho = function(e4, t2) {
|
|
1985
1985
|
var n2 = e4[t2];
|
|
1986
|
-
return En.isArray(arguments[2]) || En.isObject(arguments[2]) ? new Zn(e4, t2, arguments[2]) : En.isNumber(n2) ? En.isNumber(arguments[2]) && En.isNumber(arguments[3]) ? En.isNumber(arguments[4]) ? new so(e4, t2, arguments[2], arguments[3], arguments[4]) : new so(e4, t2, arguments[2], arguments[3]) : En.isNumber(arguments[4]) ? new no(e4, t2, { min: arguments[2], max: arguments[3], step: arguments[4] }) : new no(e4, t2, { min: arguments[2], max: arguments[3] }) : En.isString(n2) ? new Qn(e4, t2) : En.isFunction(n2) ? new
|
|
1986
|
+
return En.isArray(arguments[2]) || En.isObject(arguments[2]) ? new Zn(e4, t2, arguments[2]) : En.isNumber(n2) ? En.isNumber(arguments[2]) && En.isNumber(arguments[3]) ? En.isNumber(arguments[4]) ? new so(e4, t2, arguments[2], arguments[3], arguments[4]) : new so(e4, t2, arguments[2], arguments[3]) : En.isNumber(arguments[4]) ? new no(e4, t2, { min: arguments[2], max: arguments[3], step: arguments[4] }) : new no(e4, t2, { min: arguments[2], max: arguments[3] }) : En.isString(n2) ? new Qn(e4, t2) : En.isFunction(n2) ? new ro(e4, t2, "") : En.isBoolean(n2) ? new Kn(e4, t2) : null;
|
|
1987
1987
|
};
|
|
1988
1988
|
var uo = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(e4) {
|
|
1989
1989
|
setTimeout(e4, 1e3 / 60);
|
|
@@ -2024,7 +2024,7 @@ var fo = "Default", go = (function() {
|
|
|
2024
2024
|
})(), yo = void 0, vo = true, bo = void 0, wo = false, xo = [], _o = function e3(t2) {
|
|
2025
2025
|
var n2 = this, o2 = t2 || {};
|
|
2026
2026
|
this.domElement = document.createElement("div"), this.__ul = document.createElement("ul"), this.domElement.appendChild(this.__ul), Yn.addClass(this.domElement, "dg"), this.__folders = {}, this.__controllers = [], this.__rememberedObjects = [], this.__rememberedObjectIndecesToControllers = [], this.__listening = [], o2 = En.defaults(o2, { closeOnTop: false, autoPlace: true, width: e3.DEFAULT_WIDTH }), o2 = En.defaults(o2, { resizable: o2.autoPlace, hideable: o2.autoPlace }), En.isUndefined(o2.load) ? o2.load = { preset: fo } : o2.preset && (o2.load.preset = o2.preset), En.isUndefined(o2.parent) && o2.hideable && xo.push(this), o2.resizable = En.isUndefined(o2.parent) && o2.resizable, o2.autoPlace && En.isUndefined(o2.scrollable) && (o2.scrollable = true);
|
|
2027
|
-
var s2,
|
|
2027
|
+
var s2, r2 = go && "true" === localStorage.getItem(To(this, "isLocal")), i2 = void 0, a2 = void 0;
|
|
2028
2028
|
if (Object.defineProperties(this, { parent: { get: function() {
|
|
2029
2029
|
return o2.parent;
|
|
2030
2030
|
} }, scrollable: { get: function() {
|
|
@@ -2054,11 +2054,11 @@ var fo = "Default", go = (function() {
|
|
|
2054
2054
|
} }, load: { get: function() {
|
|
2055
2055
|
return o2.load;
|
|
2056
2056
|
} }, useLocalStorage: { get: function() {
|
|
2057
|
-
return
|
|
2057
|
+
return r2;
|
|
2058
2058
|
}, set: function(e4) {
|
|
2059
|
-
go && (
|
|
2059
|
+
go && (r2 = e4, e4 ? Yn.bind(window, "unload", i2) : Yn.unbind(window, "unload", i2), localStorage.setItem(To(n2, "isLocal"), e4));
|
|
2060
2060
|
} } }), En.isUndefined(o2.parent)) {
|
|
2061
|
-
if (this.closed = o2.closed || false, Yn.addClass(this.domElement, e3.CLASS_MAIN), Yn.makeSelectable(this.domElement, false), go &&
|
|
2061
|
+
if (this.closed = o2.closed || false, Yn.addClass(this.domElement, e3.CLASS_MAIN), Yn.makeSelectable(this.domElement, false), go && r2) {
|
|
2062
2062
|
n2.useLocalStorage = true;
|
|
2063
2063
|
var l2 = localStorage.getItem(To(this, "gui"));
|
|
2064
2064
|
l2 && (o2.load = JSON.parse(l2));
|
|
@@ -2076,9 +2076,9 @@ var fo = "Default", go = (function() {
|
|
|
2076
2076
|
}
|
|
2077
2077
|
o2.autoPlace && (En.isUndefined(o2.parent) && (vo && (bo = document.createElement("div"), Yn.addClass(bo, "dg"), Yn.addClass(bo, e3.CLASS_AUTO_PLACE_CONTAINER), document.body.appendChild(bo), vo = false), bo.appendChild(this.domElement), Yn.addClass(this.domElement, e3.CLASS_AUTO_PLACE)), this.parent || Lo(n2, o2.width)), this.__resizeHandler = function() {
|
|
2078
2078
|
n2.onResizeDebounced();
|
|
2079
|
-
}, Yn.bind(window, "resize", this.__resizeHandler), Yn.bind(this.__ul, "webkitTransitionEnd", this.__resizeHandler), Yn.bind(this.__ul, "transitionend", this.__resizeHandler), Yn.bind(this.__ul, "oTransitionEnd", this.__resizeHandler), this.onResize(), o2.resizable && Bo(this),
|
|
2079
|
+
}, Yn.bind(window, "resize", this.__resizeHandler), Yn.bind(this.__ul, "webkitTransitionEnd", this.__resizeHandler), Yn.bind(this.__ul, "transitionend", this.__resizeHandler), Yn.bind(this.__ul, "oTransitionEnd", this.__resizeHandler), this.onResize(), o2.resizable && Bo(this), i2 = function() {
|
|
2080
2080
|
go && "true" === localStorage.getItem(To(n2, "isLocal")) && localStorage.setItem(To(n2, "gui"), JSON.stringify(n2.getSaveObject()));
|
|
2081
|
-
}, this.saveToLocalStorageIfPossible =
|
|
2081
|
+
}, this.saveToLocalStorageIfPossible = i2, o2.parent || ((s2 = n2.getRoot()).width += 1, En.defer(function() {
|
|
2082
2082
|
s2.width -= 1;
|
|
2083
2083
|
}));
|
|
2084
2084
|
};
|
|
@@ -2098,14 +2098,14 @@ function So(e4, t2) {
|
|
|
2098
2098
|
if (-1 !== o2) {
|
|
2099
2099
|
var s2 = n2.__rememberedObjectIndecesToControllers[o2];
|
|
2100
2100
|
if (void 0 === s2 && (s2 = {}, n2.__rememberedObjectIndecesToControllers[o2] = s2), s2[t2.property] = t2, n2.load && n2.load.remembered) {
|
|
2101
|
-
var
|
|
2102
|
-
if (
|
|
2101
|
+
var r2 = n2.load.remembered, i2 = void 0;
|
|
2102
|
+
if (r2[e4.preset]) i2 = r2[e4.preset];
|
|
2103
2103
|
else {
|
|
2104
|
-
if (!
|
|
2105
|
-
|
|
2104
|
+
if (!r2[fo]) return;
|
|
2105
|
+
i2 = r2[fo];
|
|
2106
2106
|
}
|
|
2107
|
-
if (
|
|
2108
|
-
var a2 =
|
|
2107
|
+
if (i2[o2] && void 0 !== i2[o2][t2.property]) {
|
|
2108
|
+
var a2 = i2[o2][t2.property];
|
|
2109
2109
|
t2.initialValue = a2, t2.setValue(a2);
|
|
2110
2110
|
}
|
|
2111
2111
|
}
|
|
@@ -2114,18 +2114,18 @@ function So(e4, t2) {
|
|
|
2114
2114
|
function Ao(e4, t2, n2, o2) {
|
|
2115
2115
|
if (void 0 === t2[n2]) throw new Error('Object "' + t2 + '" has no property "' + n2 + '"');
|
|
2116
2116
|
var s2 = void 0;
|
|
2117
|
-
if (o2.color) s2 = new
|
|
2117
|
+
if (o2.color) s2 = new io(t2, n2);
|
|
2118
2118
|
else {
|
|
2119
|
-
var
|
|
2120
|
-
s2 = ho.apply(e4,
|
|
2119
|
+
var r2 = [t2, n2].concat(o2.factoryArgs);
|
|
2120
|
+
s2 = ho.apply(e4, r2);
|
|
2121
2121
|
}
|
|
2122
2122
|
o2.before instanceof Xn && (o2.before = o2.before.__li), So(e4, s2), Yn.addClass(s2.domElement, "c");
|
|
2123
|
-
var
|
|
2124
|
-
Yn.addClass(
|
|
2123
|
+
var i2 = document.createElement("span");
|
|
2124
|
+
Yn.addClass(i2, "property-name"), i2.innerHTML = s2.property;
|
|
2125
2125
|
var a2 = document.createElement("div");
|
|
2126
|
-
a2.appendChild(
|
|
2126
|
+
a2.appendChild(i2), a2.appendChild(s2.domElement);
|
|
2127
2127
|
var l2 = Co(e4, a2, o2.before);
|
|
2128
|
-
return Yn.addClass(l2, _o.CLASS_CONTROLLER_ROW), s2 instanceof
|
|
2128
|
+
return Yn.addClass(l2, _o.CLASS_CONTROLLER_ROW), s2 instanceof io ? Yn.addClass(l2, "color") : Yn.addClass(l2, zn(s2.getValue())), (function(e5, t3, n3) {
|
|
2129
2129
|
if (n3.__li = t3, n3.__gui = e5, En.extend(n3, { options: function(t4) {
|
|
2130
2130
|
if (arguments.length > 1) {
|
|
2131
2131
|
var o4 = n3.__li.nextElementSibling;
|
|
@@ -2155,8 +2155,8 @@ function Ao(e4, t2, n2, o2) {
|
|
|
2155
2155
|
if (En.isNumber(n3.__min) && En.isNumber(n3.__max)) {
|
|
2156
2156
|
var o4 = n3.__li.firstElementChild.firstElementChild.innerHTML, s4 = n3.__gui.__listening.indexOf(n3) > -1;
|
|
2157
2157
|
n3.remove();
|
|
2158
|
-
var
|
|
2159
|
-
return
|
|
2158
|
+
var r3 = Ao(e5, n3.object, n3.property, { before: n3.__li.nextElementSibling, factoryArgs: [n3.__min, n3.__max, n3.__step] });
|
|
2159
|
+
return r3.name(o4), s4 && r3.listen(), r3;
|
|
2160
2160
|
}
|
|
2161
2161
|
return t4;
|
|
2162
2162
|
};
|
|
@@ -2165,13 +2165,13 @@ function Ao(e4, t2, n2, o2) {
|
|
|
2165
2165
|
Yn.fakeEvent(n3.__checkbox, "click");
|
|
2166
2166
|
}), Yn.bind(n3.__checkbox, "click", function(e6) {
|
|
2167
2167
|
e6.stopPropagation();
|
|
2168
|
-
})) : n3 instanceof
|
|
2168
|
+
})) : n3 instanceof ro ? (Yn.bind(t3, "click", function() {
|
|
2169
2169
|
Yn.fakeEvent(n3.__button, "click");
|
|
2170
2170
|
}), Yn.bind(t3, "mouseover", function() {
|
|
2171
2171
|
Yn.addClass(n3.__button, "hover");
|
|
2172
2172
|
}), Yn.bind(t3, "mouseout", function() {
|
|
2173
2173
|
Yn.removeClass(n3.__button, "hover");
|
|
2174
|
-
})) : n3 instanceof
|
|
2174
|
+
})) : n3 instanceof io && (Yn.addClass(t3, "color"), n3.updateDisplay = En.compose(function(e6) {
|
|
2175
2175
|
return t3.style.borderLeftColor = n3.__color.toString(), e6;
|
|
2176
2176
|
}, n3.updateDisplay), n3.updateDisplay());
|
|
2177
2177
|
n3.setValue = En.compose(function(t4) {
|
|
@@ -2208,10 +2208,10 @@ function Lo(e4, t2) {
|
|
|
2208
2208
|
function Oo(e4, t2) {
|
|
2209
2209
|
var n2 = {};
|
|
2210
2210
|
return En.each(e4.__rememberedObjects, function(o2, s2) {
|
|
2211
|
-
var
|
|
2212
|
-
En.each(
|
|
2213
|
-
|
|
2214
|
-
}), n2[s2] =
|
|
2211
|
+
var r2 = {}, i2 = e4.__rememberedObjectIndecesToControllers[s2];
|
|
2212
|
+
En.each(i2, function(e5, n3) {
|
|
2213
|
+
r2[n3] = t2 ? e5.initialValue : e5.getValue();
|
|
2214
|
+
}), n2[s2] = r2;
|
|
2215
2215
|
}), n2;
|
|
2216
2216
|
}
|
|
2217
2217
|
function ko(e4) {
|
|
@@ -2314,16 +2314,16 @@ _o.toggleHide = function() {
|
|
|
2314
2314
|
o2.innerHTML = "Save", Yn.addClass(o2, "button"), Yn.addClass(o2, "save");
|
|
2315
2315
|
var s2 = document.createElement("span");
|
|
2316
2316
|
s2.innerHTML = "New", Yn.addClass(s2, "button"), Yn.addClass(s2, "save-as");
|
|
2317
|
-
var
|
|
2318
|
-
|
|
2319
|
-
var
|
|
2317
|
+
var r2 = document.createElement("span");
|
|
2318
|
+
r2.innerHTML = "Revert", Yn.addClass(r2, "button"), Yn.addClass(r2, "revert");
|
|
2319
|
+
var i2 = e5.__preset_select = document.createElement("select");
|
|
2320
2320
|
e5.load && e5.load.remembered ? En.each(e5.load.remembered, function(t4, n3) {
|
|
2321
2321
|
Fo(e5, n3, n3 === e5.preset);
|
|
2322
2322
|
}) : Fo(e5, fo, false);
|
|
2323
|
-
if (Yn.bind(
|
|
2323
|
+
if (Yn.bind(i2, "change", function() {
|
|
2324
2324
|
for (var t4 = 0; t4 < e5.__preset_select.length; t4++) e5.__preset_select[t4].innerHTML = e5.__preset_select[t4].value;
|
|
2325
2325
|
e5.preset = this.value;
|
|
2326
|
-
}), t3.appendChild(
|
|
2326
|
+
}), t3.appendChild(i2), t3.appendChild(n2), t3.appendChild(o2), t3.appendChild(s2), t3.appendChild(r2), go) {
|
|
2327
2327
|
var a2 = document.getElementById("dg-local-explain"), l2 = document.getElementById("dg-local-storage");
|
|
2328
2328
|
document.getElementById("dg-save-locally").style.display = "block", "true" === localStorage.getItem(To(e5, "isLocal")) && l2.setAttribute("checked", "checked"), Eo(e5, a2), Yn.bind(l2, "change", function() {
|
|
2329
2329
|
e5.useLocalStorage = !e5.useLocalStorage, Eo(e5, a2);
|
|
@@ -2339,7 +2339,7 @@ _o.toggleHide = function() {
|
|
|
2339
2339
|
}), Yn.bind(s2, "click", function() {
|
|
2340
2340
|
var t4 = prompt("Enter a new preset name.");
|
|
2341
2341
|
t4 && e5.saveAs(t4);
|
|
2342
|
-
}), Yn.bind(
|
|
2342
|
+
}), Yn.bind(r2, "click", function() {
|
|
2343
2343
|
e5.revert();
|
|
2344
2344
|
});
|
|
2345
2345
|
})(e4), -1 === e4.__rememberedObjects.indexOf(t2) && e4.__rememberedObjects.push(t2);
|
|
@@ -2373,7 +2373,7 @@ _o.toggleHide = function() {
|
|
|
2373
2373
|
});
|
|
2374
2374
|
} });
|
|
2375
2375
|
var jo = _o;
|
|
2376
|
-
const
|
|
2376
|
+
const Do = { autoPlace: true, width: 300, useProxy: false, closed: false }, zo = ["立方体", "球体", "圆柱体", "圆锥体", "圆环", "平面", "圆环结", "十二面体", "二十面体", "八面体", "四面体"], Ro = ["基础材质", "标准材质", "Lambert材质", "Phong材质", "物理材质", "Toon材质"], Uo = ["AmbientLight", "DirectionalLight", "PointLight", "SpotLight", "HemisphereLight", "RectAreaLight"], Io = ["围栏物体", "平面绘制", "曲线路径", "直线路径"], Ho = ["场景交点", "地图区域中心", "地图行政中心"];
|
|
2377
2377
|
const Go = { grid: { enabled: true, size: 100, divisions: 100, colorCenterLine: 4473924, colorGrid: 8947848 }, axes: { enabled: true, size: 5 }, stats: { enabled: false, mode: 0 }, viewHelper: { enabled: false, size: 128, position: "bottom-right" }, box3Helper: { enabled: false, color: 16776960 } };
|
|
2378
2378
|
function Vo(e4, n2, o2) {
|
|
2379
2379
|
return new t.Vector3().subVectors(n2, e4).normalize().multiplyScalar(o2).add(e4);
|
|
@@ -2382,9 +2382,9 @@ function No(e4, t2, n2) {
|
|
|
2382
2382
|
return Math.max(t2, Math.min(n2, e4));
|
|
2383
2383
|
}
|
|
2384
2384
|
function $o(e4) {
|
|
2385
|
-
const n2 = new t.Box3().setFromObject(e4), { max: o2, min: s2 } = n2,
|
|
2386
|
-
n2.getCenter(
|
|
2387
|
-
return { max: o2, min: s2, center:
|
|
2385
|
+
const n2 = new t.Box3().setFromObject(e4), { max: o2, min: s2 } = n2, r2 = new t.Vector3();
|
|
2386
|
+
n2.getCenter(r2);
|
|
2387
|
+
return { max: o2, min: s2, center: r2, radius: new t.Vector3().subVectors(o2, s2).length() / 2 };
|
|
2388
2388
|
}
|
|
2389
2389
|
const Xo = { speed: 0.01, mixRatio: 0.5 };
|
|
2390
2390
|
const qo = { defaultDuration: 2, defaultEase: "power2.inOut" };
|
|
@@ -2394,7 +2394,7 @@ const Yo = { defaultSize: 1 };
|
|
|
2394
2394
|
const Ko = { defaultType: "标准材质", defaultColor: 8421504 };
|
|
2395
2395
|
const Zo = { particlesSum: 1e4, inner: 0, outer: 100, maxVelocity: 10, mapUrl: "", shaderCodeName: "雪片着色", sportType: "全随机" };
|
|
2396
2396
|
const Qo = { gravity: { x: 0, y: -9.82, z: 0 }, defaultMass: 1 };
|
|
2397
|
-
const es = { defaultFontUrl: "
|
|
2397
|
+
const es = { defaultFontUrl: "/json/cn1.json", defaultSize: 1, defaultHeight: 0.2 };
|
|
2398
2398
|
const ts = { fog: { enabled: false, type: "linear", color: 13421772, near: 1, far: 1e3, density: 25e-5 }, skybox: null, environmentMap: null, environmentIntensity: 1, backgroundBlurriness: 0, backgroundIntensity: 1 };
|
|
2399
2399
|
const ns = { version: "1.0.0", includeGeometry: false, includeMaterial: true, includeUserData: true, excludeHelpers: true };
|
|
2400
2400
|
class os {
|
|
@@ -2409,8 +2409,8 @@ class os {
|
|
|
2409
2409
|
set(e4, t2, n2) {
|
|
2410
2410
|
const o2 = Date.now(), s2 = n2 ?? this.options.ttl;
|
|
2411
2411
|
for (this.cache.has(e4) && this.cache.delete(e4); this.cache.size >= this.options.maxSize; ) this.evictLRU();
|
|
2412
|
-
const
|
|
2413
|
-
this.cache.set(e4,
|
|
2412
|
+
const r2 = { value: t2, expiresAt: o2 + s2, lastAccessed: o2 };
|
|
2413
|
+
this.cache.set(e4, r2);
|
|
2414
2414
|
}
|
|
2415
2415
|
has(e4) {
|
|
2416
2416
|
const t2 = this.cache.get(e4);
|
|
@@ -2457,7 +2457,7 @@ class os {
|
|
|
2457
2457
|
return n2.expiresAt = Date.now() + o2, n2.lastAccessed = Date.now(), true;
|
|
2458
2458
|
}
|
|
2459
2459
|
}
|
|
2460
|
-
const ss = { version: "2.0.0", name: "Untitled Scene" },
|
|
2460
|
+
const ss = { version: "2.0.0", name: "Untitled Scene" }, rs = { url: null, isListMaterial: false, geoEvent: false, geoEventType: "click", geoEventParams: { name: "", _scale: 1, scale: 2, duration: 0.5 }, list: [] }, is = { viewAngleList: [], clipping: { size: 20, clipList: [] }, animations: [], events: [] }, as = ["scene", "perspectiveCamera", "webglRenderer", "orbitControls", "effectComposer", "handler", "lightCores", "modelCores", "innerCores", "drawCores", "textCores", "particleCores", "geoCores", "designCores", "other"];
|
|
2461
2461
|
class ls {
|
|
2462
2462
|
parse(e4) {
|
|
2463
2463
|
const t2 = this.validate(e4);
|
|
@@ -2482,9 +2482,9 @@ class ls {
|
|
|
2482
2482
|
if (null === e4 || "object" != typeof e4) throw new Error("Migration failed: data must be an object");
|
|
2483
2483
|
const n2 = this.deepClone(e4), o2 = [], s2 = this.detectVersion(n2, t2);
|
|
2484
2484
|
if (this.compareVersions(s2, "2.0.0") >= 0) return this.parse(n2);
|
|
2485
|
-
let
|
|
2486
|
-
return this.compareVersions(s2, "1.1.0") < 0 && (
|
|
2487
|
-
}), this.parse(
|
|
2485
|
+
let r2 = n2;
|
|
2486
|
+
return this.compareVersions(s2, "1.1.0") < 0 && (r2 = this.migrateFrom100To110(r2, o2)), this.compareVersions(s2, "2.0.0") < 0 && (r2 = this.migrateFrom110To200(r2, o2)), "unknown" === s2 && (r2 = this.migrateFromUnknown(r2, o2)), o2.length > 0 && o2.forEach((e5) => {
|
|
2487
|
+
}), this.parse(r2);
|
|
2488
2488
|
}
|
|
2489
2489
|
detectVersion(e4, t2) {
|
|
2490
2490
|
if (this.isObject(e4.metadata)) {
|
|
@@ -2535,7 +2535,7 @@ class ls {
|
|
|
2535
2535
|
}
|
|
2536
2536
|
migrateFromUnknown(e4, t2) {
|
|
2537
2537
|
t2.push("Migrating from unknown version - best effort migration");
|
|
2538
|
-
const n2 = { metadata: { version: "2.0.0", name: "Unknown Scene", description: "Migrated from unknown version", createTime: (/* @__PURE__ */ new Date()).toISOString(), updateTime: (/* @__PURE__ */ new Date()).toISOString() }, scene: e4.scene || { backgroundBlurriness: 0, backgroundIntensity: 1, backgroundUrls: null, environmentEnabled: false }, perspectiveCamera: e4.perspectiveCamera || { fov: 50, near: 0.1, far: 1e5, zoom: 1, filmOffset: 0, filmGauge: 35, position: { x: 0, y: 100, z: 500 }, layers: { mask: 1 } }, webglRenderer: e4.webglRenderer || { outputColorSpace: "srgb", toneMapping: 4, toneMappingExposure: 1, shadowMap: { enabled: true, type: 2, autoUpdate: true }, color: 0, opacity: 1, sortObjects: true, localClippingEnabled: false, autoClear: true, autoClearColor: true, renderListCompare: [] }, orbitControls: e4.orbitControls || { autoRotate: false, autoRotateSpeed: 2, enableDamping: true, dampingFactor: 0.05, minDistance: 1, maxDistance: 1e4, maxAzimuthAngle: null, minAzimuthAngle: null, maxPolarAngle: Math.PI, minPolarAngle: 0, enablePan: true, panSpeed: 1, enableRotate: true, rotateSpeed: 1, enableZoom: true, zoomSpeed: 1, zoomToCursor: false, target: { x: 0, y: 0, z: 0 } }, effectComposer: e4.effectComposer || this.getDefaultEffectComposer(), handler: e4.handler || this.getDefaultHandler(), lightCores: e4.lightCores || [], modelCores: e4.modelCores || [], innerCores: e4.innerCores || [], drawCores: e4.drawCores || [], textCores: e4.textCores || [], particleCores: e4.particleCores || [], geoCores: e4.geoCores ||
|
|
2538
|
+
const n2 = { metadata: { version: "2.0.0", name: "Unknown Scene", description: "Migrated from unknown version", createTime: (/* @__PURE__ */ new Date()).toISOString(), updateTime: (/* @__PURE__ */ new Date()).toISOString() }, scene: e4.scene || { backgroundBlurriness: 0, backgroundIntensity: 1, backgroundUrls: null, environmentEnabled: false }, perspectiveCamera: e4.perspectiveCamera || { fov: 50, near: 0.1, far: 1e5, zoom: 1, filmOffset: 0, filmGauge: 35, position: { x: 0, y: 100, z: 500 }, layers: { mask: 1 } }, webglRenderer: e4.webglRenderer || { outputColorSpace: "srgb", toneMapping: 4, toneMappingExposure: 1, shadowMap: { enabled: true, type: 2, autoUpdate: true }, color: 0, opacity: 1, sortObjects: true, localClippingEnabled: false, autoClear: true, autoClearColor: true, renderListCompare: [] }, orbitControls: e4.orbitControls || { autoRotate: false, autoRotateSpeed: 2, enableDamping: true, dampingFactor: 0.05, minDistance: 1, maxDistance: 1e4, maxAzimuthAngle: null, minAzimuthAngle: null, maxPolarAngle: Math.PI, minPolarAngle: 0, enablePan: true, panSpeed: 1, enableRotate: true, rotateSpeed: 1, enableZoom: true, zoomSpeed: 1, zoomToCursor: false, target: { x: 0, y: 0, z: 0 } }, effectComposer: e4.effectComposer || this.getDefaultEffectComposer(), handler: e4.handler || this.getDefaultHandler(), lightCores: e4.lightCores || [], modelCores: e4.modelCores || [], innerCores: e4.innerCores || [], drawCores: e4.drawCores || [], textCores: e4.textCores || [], particleCores: e4.particleCores || [], geoCores: e4.geoCores || rs, designCores: e4.designCores || [], borderCores: e4.borderCores || [], mediaCores: e4.mediaCores || [], other: e4.other || is };
|
|
2539
2539
|
for (const [o2, s2] of Object.entries(n2)) void 0 === e4[o2] && (e4[o2] = s2, t2.push(`Added missing required field: ${o2}`));
|
|
2540
2540
|
return this.migrateFrom110To200(e4, t2);
|
|
2541
2541
|
}
|
|
@@ -2648,14 +2648,14 @@ class ls {
|
|
|
2648
2648
|
return { version: t2.version ?? ss.version, name: t2.name ?? ss.name, description: t2.description, author: t2.author, createTime: t2.createTime, updateTime: t2.updateTime, thumbnail: t2.thumbnail, tags: t2.tags };
|
|
2649
2649
|
}
|
|
2650
2650
|
applyGeoMapDefaults(e4) {
|
|
2651
|
-
if (!this.isObject(e4)) return { ...
|
|
2651
|
+
if (!this.isObject(e4)) return { ...rs };
|
|
2652
2652
|
const t2 = e4;
|
|
2653
|
-
return { url: t2.url ?? null, materialType: t2.materialType, isListMaterial: t2.isListMaterial ??
|
|
2653
|
+
return { url: t2.url ?? null, materialType: t2.materialType, isListMaterial: t2.isListMaterial ?? rs.isListMaterial, geoEvent: t2.geoEvent ?? rs.geoEvent, geoEventType: t2.geoEventType ?? rs.geoEventType, geoEventParams: t2.geoEventParams ?? rs.geoEventParams, list: t2.list ?? [] };
|
|
2654
2654
|
}
|
|
2655
2655
|
applyOtherDefaults(e4) {
|
|
2656
|
-
if (!this.isObject(e4)) return { ...
|
|
2656
|
+
if (!this.isObject(e4)) return { ...is };
|
|
2657
2657
|
const t2 = e4;
|
|
2658
|
-
return { viewAngleList: t2.viewAngleList ??
|
|
2658
|
+
return { viewAngleList: t2.viewAngleList ?? is.viewAngleList, clipping: t2.clipping ?? is.clipping, animations: t2.animations ?? is.animations, events: t2.events ?? is.events };
|
|
2659
2659
|
}
|
|
2660
2660
|
compareVersions(e4, t2) {
|
|
2661
2661
|
const n2 = e4.split(".").map(Number), o2 = t2.split(".").map(Number);
|
|
@@ -2729,8 +2729,8 @@ class ds {
|
|
|
2729
2729
|
if (n2 instanceof SyntaxError) {
|
|
2730
2730
|
const s2 = n2.message.match(/position\s+(\d+)/i);
|
|
2731
2731
|
if (s2 && s2[1]) {
|
|
2732
|
-
const
|
|
2733
|
-
o2 = `Invalid JSON syntax in ${t2} at line ${
|
|
2732
|
+
const r2 = parseInt(s2[1], 10), { line: i2, column: a2 } = this.getLineAndColumn(e4, r2);
|
|
2733
|
+
o2 = `Invalid JSON syntax in ${t2} at line ${i2}, column ${a2}: ${n2.message}`;
|
|
2734
2734
|
} else o2 = `Invalid JSON syntax in ${t2}: ${n2.message}`;
|
|
2735
2735
|
}
|
|
2736
2736
|
throw new cs("ParseError", o2, n2 instanceof Error ? n2 : void 0);
|
|
@@ -2917,15 +2917,15 @@ const _ys = class _ys {
|
|
|
2917
2917
|
if (!t2 || 0 === t2.length) return;
|
|
2918
2918
|
const o2 = new F.AnimationMixer(e4);
|
|
2919
2919
|
e4.userData.animationMixer = o2, e4.userData.animationActions = [], e4.userData.animationPlayParams = n2, t2.forEach((t3, s2) => {
|
|
2920
|
-
const
|
|
2921
|
-
e4.userData.animationActions.push(
|
|
2922
|
-
true === n2.actionIndexs[s2] && (
|
|
2920
|
+
const r2 = o2.clipAction(t3);
|
|
2921
|
+
e4.userData.animationActions.push(r2);
|
|
2922
|
+
true === n2.actionIndexs[s2] && (r2.timeScale = n2.speed, r2.loop = n2.loop ? F.LoopRepeat : F.LoopOnce, n2.loop || (r2.clampWhenFinished = true), n2.startTime > 0 && (r2.time = n2.startTime), n2.initPlay && r2.play());
|
|
2923
2923
|
});
|
|
2924
2924
|
}
|
|
2925
2925
|
async loadLODModel(e4) {
|
|
2926
2926
|
const { group: t2, modelInfo: n2 } = e4, o2 = t2.lod, s2 = new F.LOD();
|
|
2927
2927
|
this.applyModelGroupConfig(s2, t2);
|
|
2928
|
-
const
|
|
2928
|
+
const r2 = o2.levels.map(async (e5) => {
|
|
2929
2929
|
try {
|
|
2930
2930
|
const t3 = e5.url || n2.url, o3 = this.getGLTFLoader();
|
|
2931
2931
|
return new Promise((n3, s3) => {
|
|
@@ -2934,22 +2934,22 @@ const _ys = class _ys {
|
|
|
2934
2934
|
} catch (e6) {
|
|
2935
2935
|
return null;
|
|
2936
2936
|
}
|
|
2937
|
-
}),
|
|
2938
|
-
for (const e5 of
|
|
2937
|
+
}), i2 = await Promise.all(r2);
|
|
2938
|
+
for (const e5 of i2) e5 && s2.addLevel(e5.object, e5.distance);
|
|
2939
2939
|
return s2.levels.length > 0 ? s2 : null;
|
|
2940
2940
|
}
|
|
2941
2941
|
async loadInstancedModel(e4) {
|
|
2942
2942
|
const { group: t2, modelInfo: n2 } = e4, o2 = t2.instancing, s2 = this.getGLTFLoader();
|
|
2943
|
-
return new Promise((e5,
|
|
2943
|
+
return new Promise((e5, r2) => {
|
|
2944
2944
|
s2.load(n2.url, (n3) => {
|
|
2945
|
-
const s3 = n3.scene,
|
|
2946
|
-
|
|
2945
|
+
const s3 = n3.scene, r3 = new F.Group();
|
|
2946
|
+
r3.name = t2.name, this.applyModelGroupConfig(r3, t2), s3.traverse((e6) => {
|
|
2947
2947
|
if (e6.isMesh) {
|
|
2948
2948
|
const t3 = e6, n4 = this.createInstancedMesh(t3, o2);
|
|
2949
|
-
n4 &&
|
|
2949
|
+
n4 && r3.add(n4);
|
|
2950
2950
|
}
|
|
2951
|
-
}), e5(
|
|
2952
|
-
}, void 0,
|
|
2951
|
+
}), e5(r3);
|
|
2952
|
+
}, void 0, r2);
|
|
2953
2953
|
});
|
|
2954
2954
|
}
|
|
2955
2955
|
createInstancedMesh(e4, t2) {
|
|
@@ -2957,12 +2957,12 @@ const _ys = class _ys {
|
|
|
2957
2957
|
if (!n2 || !o2) return null;
|
|
2958
2958
|
const s2 = new F.InstancedMesh(n2, o2, t2.count);
|
|
2959
2959
|
s2.name = e4.name + "_instanced";
|
|
2960
|
-
const
|
|
2960
|
+
const r2 = new F.Matrix4(), i2 = new F.Vector3(), a2 = new F.Quaternion(), l2 = new F.Vector3(1, 1, 1), c2 = new F.Euler();
|
|
2961
2961
|
for (let e5 = 0; e5 < t2.count; e5++) {
|
|
2962
2962
|
if (t2.positions && t2.positions[e5]) {
|
|
2963
2963
|
const n3 = t2.positions[e5];
|
|
2964
|
-
|
|
2965
|
-
} else
|
|
2964
|
+
i2.set(n3.x, n3.y, n3.z);
|
|
2965
|
+
} else i2.set(0, 0, 0);
|
|
2966
2966
|
if (t2.rotations && t2.rotations[e5]) {
|
|
2967
2967
|
const n3 = t2.rotations[e5];
|
|
2968
2968
|
c2.set(n3.x, n3.y, n3.z), a2.setFromEuler(c2);
|
|
@@ -2971,7 +2971,7 @@ const _ys = class _ys {
|
|
|
2971
2971
|
const n3 = t2.scales[e5];
|
|
2972
2972
|
l2.set(n3.x, n3.y, n3.z);
|
|
2973
2973
|
} else l2.set(1, 1, 1);
|
|
2974
|
-
|
|
2974
|
+
r2.compose(i2, a2, l2), s2.setMatrixAt(e5, r2), t2.colors && void 0 !== t2.colors[e5] && s2.setColorAt(e5, new F.Color(t2.colors[e5]));
|
|
2975
2975
|
}
|
|
2976
2976
|
return s2.instanceMatrix.needsUpdate = true, s2.instanceColor && (s2.instanceColor.needsUpdate = true), s2;
|
|
2977
2977
|
}
|
|
@@ -3137,16 +3137,16 @@ const _ys = class _ys {
|
|
|
3137
3137
|
createParticleSystem(e4) {
|
|
3138
3138
|
const t2 = e4.particlesSum, n2 = new Float32Array(3 * t2), { inner: o2, outer: s2 } = e4;
|
|
3139
3139
|
for (let e5 = 0; e5 < t2; e5++) {
|
|
3140
|
-
const t3 = o2 + Math.random() * (s2 - o2),
|
|
3141
|
-
n2[3 * e5] = t3 * Math.sin(
|
|
3140
|
+
const t3 = o2 + Math.random() * (s2 - o2), r3 = Math.random() * Math.PI * 2, i3 = Math.random() * Math.PI;
|
|
3141
|
+
n2[3 * e5] = t3 * Math.sin(i3) * Math.cos(r3), n2[3 * e5 + 1] = t3 * Math.cos(i3), n2[3 * e5 + 2] = t3 * Math.sin(i3) * Math.sin(r3);
|
|
3142
3142
|
}
|
|
3143
|
-
const
|
|
3144
|
-
|
|
3145
|
-
const
|
|
3143
|
+
const r2 = new F.BufferGeometry();
|
|
3144
|
+
r2.setAttribute("position", new F.BufferAttribute(n2, 3));
|
|
3145
|
+
const i2 = new F.PointsMaterial({ size: 1, transparent: true, opacity: 0.8, sizeAttenuation: true });
|
|
3146
3146
|
e4.mapUrl && new F.TextureLoader().load(e4.mapUrl, (e5) => {
|
|
3147
|
-
|
|
3147
|
+
i2.map = e5, i2.needsUpdate = true;
|
|
3148
3148
|
});
|
|
3149
|
-
const a2 = new F.Points(
|
|
3149
|
+
const a2 = new F.Points(r2, i2);
|
|
3150
3150
|
return a2.userData.particleConfig = e4, a2;
|
|
3151
3151
|
}
|
|
3152
3152
|
async applyDesignMeshes(e4, t2) {
|
|
@@ -3250,10 +3250,10 @@ const _ys = class _ys {
|
|
|
3250
3250
|
}
|
|
3251
3251
|
}
|
|
3252
3252
|
}
|
|
3253
|
-
const
|
|
3254
|
-
|
|
3255
|
-
const
|
|
3256
|
-
|
|
3253
|
+
const r2 = new F.ExtrudeGeometry(t4, { depth: 2, bevelEnabled: false });
|
|
3254
|
+
r2.rotateX(-Math.PI / 2);
|
|
3255
|
+
const i2 = new F.Mesh(r2, o2.clone());
|
|
3256
|
+
i2.name = e4.properties?.name || "RegionMesh", n2.add(i2);
|
|
3257
3257
|
}
|
|
3258
3258
|
};
|
|
3259
3259
|
if ("Polygon" === e4.geometry.type) s2(e4.geometry.coordinates);
|
|
@@ -3263,9 +3263,9 @@ const _ys = class _ys {
|
|
|
3263
3263
|
fitCameraToObject(e4, t2) {
|
|
3264
3264
|
const n2 = t2.camera, o2 = t2.controls?.orbit;
|
|
3265
3265
|
if (!n2) return;
|
|
3266
|
-
const s2 = new F.Box3().setFromObject(e4),
|
|
3266
|
+
const s2 = new F.Box3().setFromObject(e4), r2 = s2.getSize(new F.Vector3()), i2 = s2.getCenter(new F.Vector3()), a2 = Math.max(r2.x, r2.y, r2.z), l2 = n2.fov * (Math.PI / 180);
|
|
3267
3267
|
let c2 = a2 / (2 * Math.tan(l2 / 2)) * 1.5;
|
|
3268
|
-
n2.position.set(
|
|
3268
|
+
n2.position.set(i2.x + 0.5 * c2, i2.y + c2, i2.z + 0.5 * c2), o2 ? (o2.target.copy(i2), o2.update()) : n2.lookAt(i2), n2.updateProjectionMatrix();
|
|
3269
3269
|
}
|
|
3270
3270
|
async applyMediaCores(e4, t2) {
|
|
3271
3271
|
const n2 = t2.scene;
|
|
@@ -3292,8 +3292,8 @@ const _ys = class _ys {
|
|
|
3292
3292
|
async createImageCore(e4) {
|
|
3293
3293
|
return new Promise((t2, n2) => {
|
|
3294
3294
|
new F.TextureLoader().load(e4.url, (n3) => {
|
|
3295
|
-
const o2 = new F.PlaneGeometry(e4.width, e4.height), s2 = new F.MeshBasicMaterial({ map: n3, transparent: e4.transparent ?? true, opacity: e4.opacity ?? 1, side: F.DoubleSide }),
|
|
3296
|
-
this.applyMediaCommonProperties(
|
|
3295
|
+
const o2 = new F.PlaneGeometry(e4.width, e4.height), s2 = new F.MeshBasicMaterial({ map: n3, transparent: e4.transparent ?? true, opacity: e4.opacity ?? 1, side: F.DoubleSide }), r2 = new F.Mesh(o2, s2);
|
|
3296
|
+
this.applyMediaCommonProperties(r2, e4), t2(r2);
|
|
3297
3297
|
}, void 0, n2);
|
|
3298
3298
|
});
|
|
3299
3299
|
}
|
|
@@ -3302,21 +3302,21 @@ const _ys = class _ys {
|
|
|
3302
3302
|
t2.src = e4.url, t2.crossOrigin = "anonymous", t2.playsInline = true, false !== e4.autoplay && (t2.autoplay = true), false !== e4.loop && (t2.loop = true), false !== e4.muted && (t2.muted = true);
|
|
3303
3303
|
const n2 = new F.VideoTexture(t2);
|
|
3304
3304
|
n2.colorSpace = F.SRGBColorSpace;
|
|
3305
|
-
const o2 = new F.PlaneGeometry(e4.width, e4.height), s2 = new F.MeshBasicMaterial({ map: n2, side: F.DoubleSide }),
|
|
3306
|
-
return this.applyMediaCommonProperties(
|
|
3307
|
-
}),
|
|
3305
|
+
const o2 = new F.PlaneGeometry(e4.width, e4.height), s2 = new F.MeshBasicMaterial({ map: n2, side: F.DoubleSide }), r2 = new F.Mesh(o2, s2);
|
|
3306
|
+
return this.applyMediaCommonProperties(r2, e4), r2.userData.videoElement = t2, false !== e4.autoplay && t2.play().catch(() => {
|
|
3307
|
+
}), r2;
|
|
3308
3308
|
}
|
|
3309
3309
|
createCanvasCore(e4) {
|
|
3310
3310
|
const t2 = document.createElement("canvas");
|
|
3311
3311
|
t2.width = e4.width, t2.height = e4.height;
|
|
3312
|
-
const n2 = new F.CanvasTexture(t2), o2 = e4.width / e4.height, s2 = new F.PlaneGeometry(o2, 1),
|
|
3313
|
-
return this.applyMediaCommonProperties(
|
|
3312
|
+
const n2 = new F.CanvasTexture(t2), o2 = e4.width / e4.height, s2 = new F.PlaneGeometry(o2, 1), r2 = new F.MeshBasicMaterial({ map: n2, transparent: true, side: F.DoubleSide }), i2 = new F.Mesh(s2, r2);
|
|
3313
|
+
return this.applyMediaCommonProperties(i2, e4), i2.userData.canvasElement = t2, i2.userData.canvasTexture = n2, i2;
|
|
3314
3314
|
}
|
|
3315
3315
|
createWebGLTextureCore(e4, t2) {
|
|
3316
3316
|
const n2 = e4.width / e4.height, o2 = new F.PlaneGeometry(n2, 1), s2 = { time: { value: 0 }, resolution: { value: new F.Vector2(e4.width, e4.height) } };
|
|
3317
3317
|
if (e4.uniforms) for (const [t3, n3] of Object.entries(e4.uniforms)) s2[t3] = { value: n3 };
|
|
3318
|
-
const
|
|
3319
|
-
return this.applyMediaCommonProperties(
|
|
3318
|
+
const r2 = new F.ShaderMaterial({ vertexShader: "varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }", fragmentShader: "uniform float time; uniform vec2 resolution; varying vec2 vUv; void main() { gl_FragColor = vec4(vUv, sin(time) * 0.5 + 0.5, 1.0); }", uniforms: s2, transparent: true, side: F.DoubleSide }), i2 = new F.Mesh(o2, r2);
|
|
3319
|
+
return this.applyMediaCommonProperties(i2, e4), i2;
|
|
3320
3320
|
}
|
|
3321
3321
|
applyMediaCommonProperties(e4, t2) {
|
|
3322
3322
|
e4.name = t2.name, e4.position.set(t2.position.x, t2.position.y, t2.position.z), t2.rotation && e4.rotation.set(t2.rotation.x, t2.rotation.y, t2.rotation.z), t2.scale && e4.scale.set(t2.scale.x, t2.scale.y, t2.scale.z), void 0 !== t2.renderOrder && (e4.renderOrder = t2.renderOrder);
|
|
@@ -3366,8 +3366,8 @@ const _ys = class _ys {
|
|
|
3366
3366
|
if (!o2) return;
|
|
3367
3367
|
const s2 = o2.find((t3) => t3.name === e4);
|
|
3368
3368
|
if (!s2) return;
|
|
3369
|
-
const
|
|
3370
|
-
|
|
3369
|
+
const r2 = t2.camera, i2 = t2.controls?.orbit;
|
|
3370
|
+
r2 && (r2.position.set(s2.position.x, s2.position.y, s2.position.z), i2 && (i2.target.set(s2.target.x, s2.target.y, s2.target.z), i2.update()));
|
|
3371
3371
|
}
|
|
3372
3372
|
getViewAngles(e4) {
|
|
3373
3373
|
return e4.scene?.userData.viewAngles ?? [];
|
|
@@ -3414,8 +3414,8 @@ class ws {
|
|
|
3414
3414
|
return s2 = o2 && !n2 ? JSON.stringify(e4, null, 2) : JSON.stringify(e4), s2;
|
|
3415
3415
|
}
|
|
3416
3416
|
saveConfig(e4, t2) {
|
|
3417
|
-
const n2 = t2 ?? `${e4.metadata?.name ?? "scene"}.json`, o2 = this.exportConfig(e4, { pretty: true }), s2 = new Blob([o2], { type: "application/json" }),
|
|
3418
|
-
|
|
3417
|
+
const n2 = t2 ?? `${e4.metadata?.name ?? "scene"}.json`, o2 = this.exportConfig(e4, { pretty: true }), s2 = new Blob([o2], { type: "application/json" }), r2 = URL.createObjectURL(s2), i2 = document.createElement("a");
|
|
3418
|
+
i2.href = r2, i2.download = n2, i2.click(), URL.revokeObjectURL(r2);
|
|
3419
3419
|
}
|
|
3420
3420
|
async getSceneList() {
|
|
3421
3421
|
if (this.sceneListCache && Date.now() - this.sceneListCacheTime < this.sceneListCacheTTL) return this.sceneListCache;
|
|
@@ -3562,11 +3562,11 @@ exports.AnimationPlugin = class extends B {
|
|
|
3562
3562
|
playModelAnimation(e4, n2) {
|
|
3563
3563
|
const o2 = e4, s2 = e4.animations;
|
|
3564
3564
|
if (!s2 || 0 === s2.length) return null;
|
|
3565
|
-
const
|
|
3565
|
+
const r2 = { ...{ initPlay: true, speed: 1, actionIndexs: s2.map(() => true), startTime: 0, loop: true }, ...n2, ...e4.animationPlayParams }, i2 = new t.Clock(), a2 = new t.AnimationMixer(o2), l2 = s2.filter((e5, t2) => r2.actionIndexs[t2]).map((e5) => {
|
|
3566
3566
|
const n3 = a2.clipAction(e5);
|
|
3567
|
-
return n3.loop =
|
|
3568
|
-
}), c2 = { mixer: a2, object: o2, actions: l2, clock:
|
|
3569
|
-
return this.mixers.push(c2), e4.animationPlayParams =
|
|
3567
|
+
return n3.loop = r2.loop ? t.LoopRepeat : t.LoopOnce, n3.time = r2.startTime, n3.timeScale = r2.speed, n3.clampWhenFinished = true, r2.initPlay && n3.play(), n3;
|
|
3568
|
+
}), c2 = { mixer: a2, object: o2, actions: l2, clock: i2 };
|
|
3569
|
+
return this.mixers.push(c2), e4.animationPlayParams = r2, this.events.emit("animation:start", { object: o2 }), c2;
|
|
3570
3570
|
}
|
|
3571
3571
|
stopModelAnimation(e4) {
|
|
3572
3572
|
const t2 = this.mixers.findIndex((t3) => t3.object === e4);
|
|
@@ -3723,8 +3723,8 @@ exports.AnimationPlugin = class extends B {
|
|
|
3723
3723
|
return this._renderWay;
|
|
3724
3724
|
}
|
|
3725
3725
|
onInstall() {
|
|
3726
|
-
const { scene: e4, camera: n2, renderer: o2 } = this.engine, s2 = o2.domElement.parentElement,
|
|
3727
|
-
this._composer = new c.EffectComposer(o2), this._composer.setSize(
|
|
3726
|
+
const { scene: e4, camera: n2, renderer: o2 } = this.engine, s2 = o2.domElement.parentElement, r2 = s2.clientWidth, i2 = s2.clientHeight, a2 = o2.getPixelRatio();
|
|
3727
|
+
this._composer = new c.EffectComposer(o2), this._composer.setSize(r2, i2), this._composer.setPixelRatio(a2), this.renderPass = new d.RenderPass(e4, n2), this._composer.addPass(this.renderPass), this._saoPass = new p.SAOPass(e4, n2), this._saoPass.enabled = this.config.ssao?.enabled ?? false, this.config.ssao && (this._saoPass.params.saoIntensity = this.config.ssao.intensity, this._saoPass.params.saoScale = this.config.ssao.scale), this._composer.addPass(this._saoPass), this._bloomPass = new u.UnrealBloomPass(new t.Vector2(r2, i2), this.config.bloom?.strength ?? 1.5, this.config.bloom?.radius ?? 0.4, this.config.bloom?.threshold ?? 0.85), this._bloomPass.enabled = this.config.bloom?.enabled ?? false, this._composer.addPass(this._bloomPass), this._ssrPass = new m.SSRPass({ renderer: o2, scene: e4, camera: n2, width: r2, height: i2, selects: this.ssrMeshList, groundReflector: null }), this._ssrPass.enabled = this.config.ssr?.enabled ?? false, this.config.ssr && (this._ssrPass.thickness = this.config.ssr.thickness, this._ssrPass.infiniteThick = this.config.ssr.infiniteThick, this._ssrPass.maxDistance = this.config.ssr.maxDistance, this._ssrPass.opacity = this.config.ssr.opacity), this._composer.addPass(this._ssrPass), this._outlinePass = new h.OutlinePass(new t.Vector2(r2, i2), e4, n2), this._outlinePass.renderToScreen = true, this.config.outline && (this._outlinePass.edgeStrength = this.config.outline.edgeStrength, this._outlinePass.edgeGlow = this.config.outline.edgeGlow, this._outlinePass.edgeThickness = this.config.outline.edgeThickness, this._outlinePass.pulsePeriod = this.config.outline.pulsePeriod, this._outlinePass.visibleEdgeColor.set(this.config.outline.visibleEdgeColor), this._outlinePass.hiddenEdgeColor.set(this.config.outline.hiddenEdgeColor)), this._outlinePass.overlayMaterial.blending = t.CustomBlending, this._outlinePass.overlayMaterial.blendSrc = t.OneFactor, this._composer.addPass(this._outlinePass), this.outputPass = new y.OutputPass(), this._composer.addPass(this.outputPass), this._fxaaPass = new f.ShaderPass(g.FXAAShader), this._fxaaPass.material.uniforms.resolution.value.x = 1 / (r2 * a2), this._fxaaPass.material.uniforms.resolution.value.y = 1 / (i2 * a2), this._composer.addPass(this._fxaaPass);
|
|
3728
3728
|
}
|
|
3729
3729
|
onUninstall() {
|
|
3730
3730
|
this._composer.dispose();
|
|
@@ -3764,7 +3764,7 @@ exports.AnimationPlugin = class extends B {
|
|
|
3764
3764
|
const t2 = this.ssrMeshList.indexOf(e4);
|
|
3765
3765
|
t2 > -1 && this.ssrMeshList.splice(t2, 1);
|
|
3766
3766
|
}
|
|
3767
|
-
}, exports.ConfigApplier = ys, exports.ConfigLoader = ds, exports.ConfigLoaderError = cs, exports.ConfigParser = ls, exports.DEFAULT_ANIMATION_CONFIG = qo, exports.DEFAULT_COMPOSER_CONFIG = Pn, exports.DEFAULT_DRAWING_CONFIG = Wo, exports.DEFAULT_EDITOR_CONFIG = Sn, exports.DEFAULT_GEOMAP_CONFIG = Jo, exports.DEFAULT_GEOMETRY_CONFIG = Yo, exports.DEFAULT_GUI_CONFIG =
|
|
3767
|
+
}, exports.ConfigApplier = ys, exports.ConfigLoader = ds, exports.ConfigLoaderError = cs, exports.ConfigParser = ls, exports.DEFAULT_ANIMATION_CONFIG = qo, exports.DEFAULT_COMPOSER_CONFIG = Pn, exports.DEFAULT_DRAWING_CONFIG = Wo, exports.DEFAULT_EDITOR_CONFIG = Sn, exports.DEFAULT_GEOMAP_CONFIG = Jo, exports.DEFAULT_GEOMETRY_CONFIG = Yo, exports.DEFAULT_GUI_CONFIG = Do, exports.DEFAULT_LOADER_CONFIG = Mn, exports.DEFAULT_MATERIAL_CONFIG = Ko, exports.DEFAULT_ORBIT_CONFIG = L, exports.DEFAULT_PARTICLE_CONFIG = Zo, exports.DEFAULT_PHYSICS_CONFIG = Qo, exports.DEFAULT_SHADER_CONFIG = Xo, exports.DEFAULT_TRANSFORM_CONFIG = O, exports.DrawingPlugin = class extends B {
|
|
3768
3768
|
constructor(e4) {
|
|
3769
3769
|
super({ ...Wo, ...e4 }), this.name = "drawing", this.currentPoints = [], this.previewMesh = null, this._isDrawing = false, this.drawnObjects = [], this._mode = this.config.defaultMode, this._pointMode = this.config.defaultPointMode;
|
|
3770
3770
|
}
|
|
@@ -3857,19 +3857,19 @@ exports.AnimationPlugin = class extends B {
|
|
|
3857
3857
|
}
|
|
3858
3858
|
}
|
|
3859
3859
|
createFence(e4, n2 = false) {
|
|
3860
|
-
const o2 = this.config.fenceHeight, s2 = [],
|
|
3860
|
+
const o2 = this.config.fenceHeight, s2 = [], r2 = [], i2 = [];
|
|
3861
3861
|
for (let t2 = 0; t2 < e4.length; t2++) {
|
|
3862
3862
|
const n3 = e4[t2];
|
|
3863
3863
|
s2.push(n3.x, n3.y, n3.z), s2.push(n3.x, n3.y + o2, n3.z);
|
|
3864
|
-
const
|
|
3865
|
-
|
|
3864
|
+
const r3 = t2 / (e4.length - 1);
|
|
3865
|
+
i2.push(r3, 0), i2.push(r3, 1);
|
|
3866
3866
|
}
|
|
3867
3867
|
for (let t2 = 0; t2 < e4.length - 1; t2++) {
|
|
3868
3868
|
const e5 = 2 * t2;
|
|
3869
|
-
|
|
3869
|
+
r2.push(e5, e5 + 1, e5 + 2), r2.push(e5 + 1, e5 + 3, e5 + 2);
|
|
3870
3870
|
}
|
|
3871
3871
|
const a2 = new t.BufferGeometry();
|
|
3872
|
-
a2.setAttribute("position", new t.Float32BufferAttribute(s2, 3)), a2.setAttribute("uv", new t.Float32BufferAttribute(
|
|
3872
|
+
a2.setAttribute("position", new t.Float32BufferAttribute(s2, 3)), a2.setAttribute("uv", new t.Float32BufferAttribute(i2, 2)), a2.setIndex(r2), a2.computeVertexNormals();
|
|
3873
3873
|
const l2 = new t.MeshStandardMaterial({ color: n2 ? 65280 : 4491519, side: t.DoubleSide, transparent: true, opacity: n2 ? 0.5 : 0.8 }), c2 = new t.Mesh(a2, l2);
|
|
3874
3874
|
return c2.name = "Fence", c2;
|
|
3875
3875
|
}
|
|
@@ -3881,18 +3881,18 @@ exports.AnimationPlugin = class extends B {
|
|
|
3881
3881
|
o2.closePath();
|
|
3882
3882
|
const s2 = new t.ShapeGeometry(o2);
|
|
3883
3883
|
s2.rotateX(-Math.PI / 2);
|
|
3884
|
-
const
|
|
3885
|
-
s2.translate(0,
|
|
3886
|
-
const
|
|
3884
|
+
const r2 = e4.reduce((e5, t2) => e5 + t2.y, 0) / e4.length;
|
|
3885
|
+
s2.translate(0, r2, 0);
|
|
3886
|
+
const i2 = new t.MeshStandardMaterial({ color: n2 ? 65280 : 4491519, side: t.DoubleSide, transparent: true, opacity: n2 ? 0.5 : 0.8 }), a2 = new t.Mesh(s2, i2);
|
|
3887
3887
|
return a2.name = "Plane", a2;
|
|
3888
3888
|
}
|
|
3889
3889
|
createCurve(e4, n2 = false) {
|
|
3890
|
-
const o2 = new t.CatmullRomCurve3(e4), s2 = o2.getPoints(50),
|
|
3890
|
+
const o2 = new t.CatmullRomCurve3(e4), s2 = o2.getPoints(50), r2 = new t.BufferGeometry().setFromPoints(s2), i2 = new t.LineBasicMaterial({ color: n2 ? 65280 : 16729224, linewidth: 2 }), a2 = new t.Line(r2, i2);
|
|
3891
3891
|
return a2.name = "Curve", a2.isCurveMesh = true, a2.curvePath = o2, a2;
|
|
3892
3892
|
}
|
|
3893
3893
|
createLine(e4, n2 = false) {
|
|
3894
|
-
const o2 = new t.BufferGeometry().setFromPoints(e4), s2 = new t.LineBasicMaterial({ color: n2 ? 65280 : 16776960, linewidth: 2 }),
|
|
3895
|
-
return
|
|
3894
|
+
const o2 = new t.BufferGeometry().setFromPoints(e4), s2 = new t.LineBasicMaterial({ color: n2 ? 65280 : 16776960, linewidth: 2 }), r2 = new t.Line(o2, s2);
|
|
3895
|
+
return r2.name = "Line", r2;
|
|
3896
3896
|
}
|
|
3897
3897
|
getDrawnObjects() {
|
|
3898
3898
|
return this.drawnObjects;
|
|
@@ -3938,33 +3938,33 @@ exports.AnimationPlugin = class extends B {
|
|
|
3938
3938
|
const n2 = this.getPlugin("transform-controller"), o2 = this.getPlugin("composer");
|
|
3939
3939
|
if (!n2 || !o2) return null;
|
|
3940
3940
|
n2.detach();
|
|
3941
|
-
const s2 = this.renderer.domElement.getBoundingClientRect(),
|
|
3941
|
+
const s2 = this.renderer.domElement.getBoundingClientRect(), r2 = xn(new t.Vector2((e4.clientX - s2.left) / s2.width * 2 - 1, -(e4.clientY - s2.top) / s2.height * 2 + 1), this.camera, this.scene.children).find((e5) => {
|
|
3942
3942
|
e5.object;
|
|
3943
3943
|
const t2 = _n(e5.object);
|
|
3944
3944
|
return e5.object.visible && t2.visible;
|
|
3945
3945
|
});
|
|
3946
|
-
if (!
|
|
3947
|
-
const { object:
|
|
3946
|
+
if (!r2) return this._currentInfo = null, this.events.emit("click", { event: e4, info: null }), null;
|
|
3947
|
+
const { object: i2, point: a2 } = r2, l2 = _n(i2);
|
|
3948
3948
|
switch (this._mode) {
|
|
3949
3949
|
case "变换":
|
|
3950
|
-
o2.clearOutlineObjects(), this.config.isTransformChildren ? n2.attach(
|
|
3950
|
+
o2.clearOutlineObjects(), this.config.isTransformChildren ? n2.attach(i2) : n2.attach(l2);
|
|
3951
3951
|
break;
|
|
3952
3952
|
case "选择":
|
|
3953
|
-
o2.setOutlineObjects([
|
|
3953
|
+
o2.setOutlineObjects([i2]);
|
|
3954
3954
|
break;
|
|
3955
3955
|
case "根选择":
|
|
3956
3956
|
o2.setOutlineObjects([l2]);
|
|
3957
3957
|
break;
|
|
3958
3958
|
case "场景绘制":
|
|
3959
|
-
this.drawEventCallback?.(a2,
|
|
3959
|
+
this.drawEventCallback?.(a2, i2);
|
|
3960
3960
|
}
|
|
3961
|
-
return this._currentInfo = { currentModel:
|
|
3961
|
+
return this._currentInfo = { currentModel: i2, currentRootModel: l2, point: a2.clone(), mode: this._mode }, this.events.emit("click", { event: e4, info: this._currentInfo }), this.events.emit("object:selected", { object: "选择" === this._mode ? i2 : l2, previous: null }), this._currentInfo;
|
|
3962
3962
|
}
|
|
3963
3963
|
getRawRaycast(e4, n2) {
|
|
3964
3964
|
const o2 = bn(e4), s2 = new t.Raycaster();
|
|
3965
3965
|
s2.setFromCamera(o2, this.camera);
|
|
3966
|
-
const
|
|
3967
|
-
return { raycaster: s2, intersects:
|
|
3966
|
+
const r2 = n2 || this.scene.children, i2 = s2.intersectObjects(r2, true);
|
|
3967
|
+
return { raycaster: s2, intersects: i2 };
|
|
3968
3968
|
}
|
|
3969
3969
|
select(e4) {
|
|
3970
3970
|
const t2 = this.getPlugin("transform-controller"), n2 = this.getPlugin("composer");
|
|
@@ -4115,7 +4115,7 @@ exports.AnimationPlugin = class extends B {
|
|
|
4115
4115
|
}
|
|
4116
4116
|
}, exports.GUIPlugin = class extends B {
|
|
4117
4117
|
constructor(e4) {
|
|
4118
|
-
super({ ...
|
|
4118
|
+
super({ ...Do, ...e4 }), this.name = "gui", this._gui = null, this.sceneFolder = null, this.controlFolder = null, this.meshFolder = null, this.animationFolder = null, this.selectPanel = null, this.modelListFolder = null, this.innerMeshListFolder = null, this.drawMeshListFolder = null, this.geoMapListFolder = null, this.particleListFolder = null, this.borderGroupListFolder = null, this.textMeshListFolder = null, this.designMeshListFolder = null, this.lightListFolder = null, this.handlerParams = { mode: "变换", isTransformChildren: false, openKey: false }, this.innerMeshParams = { geometryType: "立方体", materialType: "标准材质" }, this.drawParams = { mode: "围栏物体", pointMode: "场景交点", materialType: "标准材质" }, this.geoMapParams = { url: "", materialType: "标准材质" }, this.particleParams = { particlesSum: 1e5, inner: 0, outer: 2e3, maxVelocity: 50, mapUrl: "/img/snow.png", sportType: "全随机", shaderCodeName: "水波纹" }, this.borderGroupParams = { url: "https://geo.datav.aliyun.com/areas_v3/bound/100000.json", materialType: "基础材质", dlength: 0 }, this.textMeshParams = { fontLink: "/json/cn1.json", text: "", materialType: "标准材质" }, this.designMeshParams = { type: "镜面" }, this.lightParams = { lightType: "AmbientLight" };
|
|
4119
4119
|
}
|
|
4120
4120
|
onInstall() {
|
|
4121
4121
|
this.createGUI();
|
|
@@ -4244,8 +4244,8 @@ exports.AnimationPlugin = class extends B {
|
|
|
4244
4244
|
o2.hiddenEdgeColor.set(e6);
|
|
4245
4245
|
});
|
|
4246
4246
|
}
|
|
4247
|
-
const s2 = t2.addFolder("泛光"),
|
|
4248
|
-
|
|
4247
|
+
const s2 = t2.addFolder("泛光"), r2 = e4.bloomPass;
|
|
4248
|
+
r2 && (s2.add(r2, "enabled").name("启用"), s2.add(r2, "strength", 0, 3, 0.1).name("强度"), s2.add(r2, "radius", 0, 1, 0.01).name("半径"), s2.add(r2, "threshold", 0, 1, 0.01).name("阈值"));
|
|
4249
4249
|
}
|
|
4250
4250
|
createControlFolder() {
|
|
4251
4251
|
this._gui && (this.controlFolder = this._gui.addFolder("控制配置"), this.controlFolder.add(this.handlerParams, "mode", ["选择", "根选择", "变换", "场景绘制", "点击信息"]).name("模式").listen().onChange((e4) => {
|
|
@@ -4320,15 +4320,15 @@ exports.AnimationPlugin = class extends B {
|
|
|
4320
4320
|
}
|
|
4321
4321
|
addModelPanel(e4) {
|
|
4322
4322
|
if (!this.modelListFolder) return;
|
|
4323
|
-
const n2 = this.modelListFolder.addFolder(e4.name + e4.id), o2 = this.pluginManager?.get("transform-controller"), s2 = this.pluginManager?.get("orbit-controller"),
|
|
4323
|
+
const n2 = this.modelListFolder.addFolder(e4.name + e4.id), o2 = this.pluginManager?.get("transform-controller"), s2 = this.pluginManager?.get("orbit-controller"), r2 = this.pluginManager?.get("composer");
|
|
4324
4324
|
this.addMeshControlPanel(e4, n2.addFolder("物体控制")), this.addGroupGlobalPanel(e4, n2.addFolder("全局和子项控制")), e4.animations?.length > 0 && this.addGroupAnimationPanel(e4, n2.addFolder("动画配置")), n2.add({ fn: () => {
|
|
4325
4325
|
o2?.controls && o2.controls.attach(e4);
|
|
4326
4326
|
} }, "fn").name("选中"), n2.add({ fn: () => {
|
|
4327
4327
|
if (s2?.controls) {
|
|
4328
|
-
const n3 = new t.Box3().setFromObject(e4), o3 = n3.getCenter(new t.Vector3()),
|
|
4329
|
-
s2.controls.target.copy(o3), this.camera.position.copy(o3).add(new t.Vector3(
|
|
4328
|
+
const n3 = new t.Box3().setFromObject(e4), o3 = n3.getCenter(new t.Vector3()), r3 = n3.getSize(new t.Vector3()), i2 = 2 * Math.max(r3.x, r3.y, r3.z);
|
|
4329
|
+
s2.controls.target.copy(o3), this.camera.position.copy(o3).add(new t.Vector3(i2, i2, i2));
|
|
4330
4330
|
}
|
|
4331
|
-
o2?.controls && o2.controls.attach(e4),
|
|
4331
|
+
o2?.controls && o2.controls.attach(e4), r2 && r2.setOutlineObjects([e4]);
|
|
4332
4332
|
} }, "fn").name("定位物体"), n2.add({ fn: () => {
|
|
4333
4333
|
o2?.controls && o2.controls.detach(), e4.parent?.remove(e4), this.modelListFolder?.removeFolder(n2);
|
|
4334
4334
|
} }, "fn").name("删除");
|
|
@@ -4401,7 +4401,7 @@ exports.AnimationPlugin = class extends B {
|
|
|
4401
4401
|
createInnerMeshFolder() {
|
|
4402
4402
|
if (!this.meshFolder) return;
|
|
4403
4403
|
const e4 = this.meshFolder.addFolder("内置物体");
|
|
4404
|
-
this.innerMeshListFolder = e4.addFolder("已有列表"), e4.add(this.innerMeshParams, "geometryType",
|
|
4404
|
+
this.innerMeshListFolder = e4.addFolder("已有列表"), e4.add(this.innerMeshParams, "geometryType", zo).name("几何体"), e4.add(this.innerMeshParams, "materialType", Ro).name("材质"), e4.add({ fn: () => {
|
|
4405
4405
|
const e5 = this.createGeometry(this.innerMeshParams.geometryType), n2 = this.createMaterial(this.innerMeshParams.materialType), o2 = new t.Mesh(e5, n2);
|
|
4406
4406
|
o2.isInnerMesh = true, o2.geometryType = this.innerMeshParams.geometryType, o2.materialType = this.innerMeshParams.materialType, this.scene.add(o2), this.addInnerMeshPanel(o2);
|
|
4407
4407
|
const s2 = this.pluginManager?.get("transform-controller");
|
|
@@ -4438,7 +4438,7 @@ exports.AnimationPlugin = class extends B {
|
|
|
4438
4438
|
if (!this.meshFolder) return;
|
|
4439
4439
|
const e4 = this.meshFolder.addFolder("三维地图");
|
|
4440
4440
|
this.geoMapListFolder = e4.addFolder("地图列表"), e4.add(this.geoMapParams, "url").name("地图数据地址"), e4.add(this.geoMapParams, "materialType", Ro).name("地图材质类型"), e4.add({ fn: () => {
|
|
4441
|
-
const e5 = this.geoMapParams.url || "
|
|
4441
|
+
const e5 = this.geoMapParams.url || "/json/guangdong.json";
|
|
4442
4442
|
this.events.emit("geomap:load", { url: e5, materialType: this.geoMapParams.materialType });
|
|
4443
4443
|
} }, "fn").name("添加地图");
|
|
4444
4444
|
}
|
|
@@ -4702,45 +4702,45 @@ exports.AnimationPlugin = class extends B {
|
|
|
4702
4702
|
}
|
|
4703
4703
|
createFeatureMeshes(e4, t2) {
|
|
4704
4704
|
const n2 = [], { geometry: o2, properties: s2 } = e4;
|
|
4705
|
-
let
|
|
4706
|
-
"Polygon" === o2.type ?
|
|
4707
|
-
for (const e5 of
|
|
4705
|
+
let r2 = [];
|
|
4706
|
+
"Polygon" === o2.type ? r2 = [o2.coordinates] : "MultiPolygon" === o2.type && (r2 = o2.coordinates);
|
|
4707
|
+
for (const e5 of r2) {
|
|
4708
4708
|
const o3 = this.createPolygonMesh(e5, t2);
|
|
4709
4709
|
o3.name = s2.name || "Region";
|
|
4710
|
-
const
|
|
4711
|
-
s2.center && (
|
|
4710
|
+
const r3 = { properties: { ...s2 } };
|
|
4711
|
+
s2.center && (r3.properties.centerCoord3 = this.coordToVector3(s2.center)), s2.centroid && (r3.properties.centroidCoord3 = this.coordToVector3(s2.centroid)), o3.geoInfo = r3, n2.push(o3);
|
|
4712
4712
|
}
|
|
4713
4713
|
return n2;
|
|
4714
4714
|
}
|
|
4715
4715
|
createPolygonMesh(e4, n2) {
|
|
4716
|
-
const o2 = e4[0], s2 = new t.Shape(),
|
|
4717
|
-
s2.moveTo(
|
|
4716
|
+
const o2 = e4[0], s2 = new t.Shape(), r2 = this.coordToVector2(o2[0]);
|
|
4717
|
+
s2.moveTo(r2.x, r2.y);
|
|
4718
4718
|
for (let e5 = 1; e5 < o2.length; e5++) {
|
|
4719
4719
|
const t2 = this.coordToVector2(o2[e5]);
|
|
4720
4720
|
s2.lineTo(t2.x, t2.y);
|
|
4721
4721
|
}
|
|
4722
4722
|
s2.closePath();
|
|
4723
4723
|
for (let n3 = 1; n3 < e4.length; n3++) {
|
|
4724
|
-
const o3 = new t.Path(),
|
|
4725
|
-
o3.moveTo(
|
|
4726
|
-
for (let e5 = 1; e5 <
|
|
4727
|
-
const t2 = this.coordToVector2(
|
|
4724
|
+
const o3 = new t.Path(), r3 = e4[n3], i3 = this.coordToVector2(r3[0]);
|
|
4725
|
+
o3.moveTo(i3.x, i3.y);
|
|
4726
|
+
for (let e5 = 1; e5 < r3.length; e5++) {
|
|
4727
|
+
const t2 = this.coordToVector2(r3[e5]);
|
|
4728
4728
|
o3.lineTo(t2.x, t2.y);
|
|
4729
4729
|
}
|
|
4730
4730
|
s2.holes.push(o3);
|
|
4731
4731
|
}
|
|
4732
|
-
const
|
|
4733
|
-
|
|
4732
|
+
const i2 = new t.ExtrudeGeometry(s2, { depth: n2.depth, bevelEnabled: false });
|
|
4733
|
+
i2.rotateX(-Math.PI / 2);
|
|
4734
4734
|
const a2 = new t.MeshStandardMaterial({ color: n2.color, transparent: true, opacity: n2.opacity, side: t.DoubleSide });
|
|
4735
|
-
return new t.Mesh(
|
|
4735
|
+
return new t.Mesh(i2, a2);
|
|
4736
4736
|
}
|
|
4737
4737
|
coordToVector2(e4) {
|
|
4738
|
-
const [n2, o2] = e4, [s2,
|
|
4739
|
-
return new t.Vector2(s2 / this.config.coordinateScale,
|
|
4738
|
+
const [n2, o2] = e4, [s2, r2] = C("EPSG:4326", "EPSG:3857", [n2, o2]);
|
|
4739
|
+
return new t.Vector2(s2 / this.config.coordinateScale, r2 / this.config.coordinateScale);
|
|
4740
4740
|
}
|
|
4741
4741
|
coordToVector3(e4) {
|
|
4742
|
-
const [n2, o2] = e4, [s2,
|
|
4743
|
-
return new t.Vector3(s2 / this.config.coordinateScale, 0,
|
|
4742
|
+
const [n2, o2] = e4, [s2, r2] = C("EPSG:4326", "EPSG:3857", [n2, o2]);
|
|
4743
|
+
return new t.Vector3(s2 / this.config.coordinateScale, 0, r2 / this.config.coordinateScale);
|
|
4744
4744
|
}
|
|
4745
4745
|
centerGroup(e4) {
|
|
4746
4746
|
const n2 = new t.Box3().setFromObject(e4), o2 = new t.Vector3();
|
|
@@ -4816,8 +4816,8 @@ exports.AnimationPlugin = class extends B {
|
|
|
4816
4816
|
createMesh(e4, n2, o2) {
|
|
4817
4817
|
const s2 = this.createGeometry(e4, o2);
|
|
4818
4818
|
s2.geometryType = e4;
|
|
4819
|
-
const
|
|
4820
|
-
return
|
|
4819
|
+
const r2 = new t.Mesh(s2, n2 ?? new t.MeshStandardMaterial({ color: 8421504 }));
|
|
4820
|
+
return r2.name = e4, r2.isInnerMesh = true, r2;
|
|
4821
4821
|
}
|
|
4822
4822
|
addToScene(e4, t2, n2) {
|
|
4823
4823
|
const o2 = this.createMesh(e4, t2, n2);
|
|
@@ -4954,7 +4954,7 @@ exports.AnimationPlugin = class extends B {
|
|
|
4954
4954
|
super({ ...Mn, ...e4 }), this.name = "loader", this.fontCache = /* @__PURE__ */ new Map();
|
|
4955
4955
|
}
|
|
4956
4956
|
onInstall() {
|
|
4957
|
-
this.dracoLoader = new s.DRACOLoader(), this.dracoLoader.setDecoderPath(this.config.dracoPath), this.dracoLoader.setDecoderConfig({ type: "js" }), this.dracoLoader.preload(), this.gltfLoader = new o.GLTFLoader(), this.config.useDraco && this.gltfLoader.setDRACOLoader(this.dracoLoader), this.fbxLoader = new
|
|
4957
|
+
this.dracoLoader = new s.DRACOLoader(), this.dracoLoader.setDecoderPath(this.config.dracoPath), this.dracoLoader.setWorkerLimit(1), this.dracoLoader.setDecoderConfig({ type: "js" }), this.dracoLoader.preload(), this.gltfLoader = new o.GLTFLoader(), this.config.useDraco && this.gltfLoader.setDRACOLoader(this.dracoLoader), this.fbxLoader = new r.FBXLoader(), this.objLoader = new i.OBJLoader(), this.mtlLoader = new a.MTLLoader(), this.textureLoader = new t.TextureLoader(), this.cubeTextureLoader = new t.CubeTextureLoader(), this.fontLoader = new l.FontLoader();
|
|
4958
4958
|
}
|
|
4959
4959
|
onUninstall() {
|
|
4960
4960
|
this.dracoLoader.dispose(), this.fontCache.clear();
|
|
@@ -5222,24 +5222,24 @@ exports.AnimationPlugin = class extends B {
|
|
|
5222
5222
|
for (const t2 of this.particleSystems) this.updateParticleSystem(t2, e4);
|
|
5223
5223
|
}
|
|
5224
5224
|
createParticleSystem(e4) {
|
|
5225
|
-
const n2 = { particlesSum: e4?.particlesSum ?? this.config.particlesSum, inner: e4?.inner ?? this.config.inner, outer: e4?.outer ?? this.config.outer, maxVelocity: e4?.maxVelocity ?? this.config.maxVelocity, mapUrl: e4?.mapUrl ?? this.config.mapUrl, sportType: e4?.sportType ?? this.config.sportType, size: e4?.size ?? 1, color: e4?.color ?? 16777215, opacity: e4?.opacity ?? 1 }, { particlesSum: o2, inner: s2, outer:
|
|
5225
|
+
const n2 = { particlesSum: e4?.particlesSum ?? this.config.particlesSum, inner: e4?.inner ?? this.config.inner, outer: e4?.outer ?? this.config.outer, maxVelocity: e4?.maxVelocity ?? this.config.maxVelocity, mapUrl: e4?.mapUrl ?? this.config.mapUrl, sportType: e4?.sportType ?? this.config.sportType, size: e4?.size ?? 1, color: e4?.color ?? 16777215, opacity: e4?.opacity ?? 1 }, { particlesSum: o2, inner: s2, outer: r2, maxVelocity: i2, sportType: a2 } = n2, l2 = new t.BufferGeometry(), c2 = new Float32Array(3 * o2), d2 = new Float32Array(3 * o2);
|
|
5226
5226
|
for (let e5 = 0; e5 < o2; e5++) {
|
|
5227
|
-
const t2 = 3 * e5, n3 = s2 + Math.random() * (
|
|
5227
|
+
const t2 = 3 * e5, n3 = s2 + Math.random() * (r2 - s2), o3 = Math.random() * Math.PI * 2, l3 = Math.acos(2 * Math.random() - 1);
|
|
5228
5228
|
switch (c2[t2] = n3 * Math.sin(l3) * Math.cos(o3), c2[t2 + 1] = n3 * Math.sin(l3) * Math.sin(o3), c2[t2 + 2] = n3 * Math.cos(l3), a2) {
|
|
5229
5229
|
case "全随机":
|
|
5230
|
-
d2[t2] = (Math.random() - 0.5) *
|
|
5230
|
+
d2[t2] = (Math.random() - 0.5) * i2, d2[t2 + 1] = (Math.random() - 0.5) * i2, d2[t2 + 2] = (Math.random() - 0.5) * i2;
|
|
5231
5231
|
break;
|
|
5232
5232
|
case "随机向下":
|
|
5233
|
-
d2[t2] = (Math.random() - 0.5) *
|
|
5233
|
+
d2[t2] = (Math.random() - 0.5) * i2 * 0.2, d2[t2 + 1] = -Math.random() * i2, d2[t2 + 2] = (Math.random() - 0.5) * i2 * 0.2;
|
|
5234
5234
|
break;
|
|
5235
5235
|
case "随机向上":
|
|
5236
|
-
d2[t2] = (Math.random() - 0.5) *
|
|
5236
|
+
d2[t2] = (Math.random() - 0.5) * i2 * 0.2, d2[t2 + 1] = Math.random() * i2, d2[t2 + 2] = (Math.random() - 0.5) * i2 * 0.2;
|
|
5237
5237
|
break;
|
|
5238
5238
|
case "直线匀速向上":
|
|
5239
|
-
d2[t2] = 0, d2[t2 + 1] =
|
|
5239
|
+
d2[t2] = 0, d2[t2 + 1] = i2, d2[t2 + 2] = 0;
|
|
5240
5240
|
break;
|
|
5241
5241
|
case "直线匀速向下":
|
|
5242
|
-
d2[t2] = 0, d2[t2 + 1] = -
|
|
5242
|
+
d2[t2] = 0, d2[t2 + 1] = -i2, d2[t2 + 2] = 0;
|
|
5243
5243
|
}
|
|
5244
5244
|
}
|
|
5245
5245
|
l2.setAttribute("position", new t.BufferAttribute(c2, 3));
|
|
@@ -5257,13 +5257,13 @@ exports.AnimationPlugin = class extends B {
|
|
|
5257
5257
|
return this.scene.add(t2), t2;
|
|
5258
5258
|
}
|
|
5259
5259
|
updateParticleSystem(e4, t2) {
|
|
5260
|
-
const { mesh: n2, velocities: o2, config: s2 } = e4,
|
|
5261
|
-
for (let e5 = 0; e5 <
|
|
5262
|
-
|
|
5263
|
-
const n3 = Math.sqrt(
|
|
5264
|
-
if (n3 > a2 || n3 <
|
|
5265
|
-
const t3 =
|
|
5266
|
-
|
|
5260
|
+
const { mesh: n2, velocities: o2, config: s2 } = e4, r2 = n2.geometry.attributes.position.array, { inner: i2, outer: a2 } = s2;
|
|
5261
|
+
for (let e5 = 0; e5 < r2.length; e5 += 3) {
|
|
5262
|
+
r2[e5] += o2[e5] * t2, r2[e5 + 1] += o2[e5 + 1] * t2, r2[e5 + 2] += o2[e5 + 2] * t2;
|
|
5263
|
+
const n3 = Math.sqrt(r2[e5] ** 2 + r2[e5 + 1] ** 2 + r2[e5 + 2] ** 2);
|
|
5264
|
+
if (n3 > a2 || n3 < i2) {
|
|
5265
|
+
const t3 = i2 + Math.random() * (a2 - i2), n4 = Math.random() * Math.PI * 2, o3 = Math.acos(2 * Math.random() - 1);
|
|
5266
|
+
r2[e5] = t3 * Math.sin(o3) * Math.cos(n4), r2[e5 + 1] = t3 * Math.sin(o3) * Math.sin(n4), r2[e5 + 2] = t3 * Math.cos(o3);
|
|
5267
5267
|
}
|
|
5268
5268
|
}
|
|
5269
5269
|
n2.geometry.attributes.position.needsUpdate = true;
|
|
@@ -5311,11 +5311,11 @@ exports.AnimationPlugin = class extends B {
|
|
|
5311
5311
|
this.world.gravity.set(e4, t2, n2), this.config.gravity = { x: e4, y: t2, z: n2 };
|
|
5312
5312
|
}
|
|
5313
5313
|
addBody(e4, t2) {
|
|
5314
|
-
const { center: n2, max: o2, min: s2, radius:
|
|
5314
|
+
const { center: n2, max: o2, min: s2, radius: r2 } = $o(e4), i2 = t2?.isStatic ? 0 : t2?.mass ?? this.config.defaultMass;
|
|
5315
5315
|
let a2;
|
|
5316
5316
|
switch (t2?.shape) {
|
|
5317
5317
|
case "sphere":
|
|
5318
|
-
a2 = new E.Sphere(
|
|
5318
|
+
a2 = new E.Sphere(r2);
|
|
5319
5319
|
break;
|
|
5320
5320
|
case "cylinder":
|
|
5321
5321
|
const e5 = Math.max(o2.x - s2.x, o2.z - s2.z) / 2, t3 = o2.y - s2.y;
|
|
@@ -5324,7 +5324,7 @@ exports.AnimationPlugin = class extends B {
|
|
|
5324
5324
|
default:
|
|
5325
5325
|
a2 = new E.Box(new E.Vec3((o2.x - s2.x) / 2, (o2.y - s2.y) / 2, (o2.z - s2.z) / 2));
|
|
5326
5326
|
}
|
|
5327
|
-
const l2 = new E.Body({ mass:
|
|
5327
|
+
const l2 = new E.Body({ mass: i2, shape: a2, position: new E.Vec3(n2.x, n2.y, n2.z) });
|
|
5328
5328
|
void 0 === t2?.friction && void 0 === t2?.restitution || (l2.material = new E.Material(), void 0 !== t2.friction && (l2.material.friction = t2.friction), void 0 !== t2.restitution && (l2.material.restitution = t2.restitution)), this.world.addBody(l2);
|
|
5329
5329
|
const c2 = { body: l2, mesh: e4, isUpdate: !t2?.isStatic };
|
|
5330
5330
|
return this.bodies.push(c2), e4.physicsBody = l2, l2;
|
|
@@ -5550,8 +5550,8 @@ exports.AnimationPlugin = class extends B {
|
|
|
5550
5550
|
}
|
|
5551
5551
|
async handleLoadConfig(e4) {
|
|
5552
5552
|
const { url: t2, autoApply: n2 = true } = e4, o2 = `url:${t2}`, s2 = this.cacheManager.get(o2);
|
|
5553
|
-
let
|
|
5554
|
-
s2 ? (
|
|
5553
|
+
let r2, i2 = false;
|
|
5554
|
+
s2 ? (r2 = s2, i2 = true) : (r2 = await this.configManager.loadConfig(t2), this.cacheManager.set(o2, r2)), this.events.emit("scene:config:loaded", { source: t2, config: r2, fromCache: i2 }), n2 && await this.applyConfig(r2);
|
|
5555
5555
|
}
|
|
5556
5556
|
async handleApplyConfig(e4) {
|
|
5557
5557
|
await this.applyConfig(e4.config);
|
|
@@ -5989,17 +5989,17 @@ ${e5}`));
|
|
|
5989
5989
|
if (!o2) return null;
|
|
5990
5990
|
const s2 = {};
|
|
5991
5991
|
for (const [e5, n3] of Object.entries(o2.uniforms)) s2[e5] = { ...n3, value: n3.value instanceof t.Color ? n3.value.clone() : n3.value };
|
|
5992
|
-
const
|
|
5993
|
-
if (0 ===
|
|
5994
|
-
|
|
5992
|
+
const r2 = this.getMaterials(e4);
|
|
5993
|
+
if (0 === r2.length) return null;
|
|
5994
|
+
r2.forEach((e5) => {
|
|
5995
5995
|
this.applyShaderToMaterial(e5, s2, o2);
|
|
5996
5996
|
});
|
|
5997
|
-
const
|
|
5997
|
+
const i2 = { uniforms: s2, update: () => {
|
|
5998
5998
|
o2.animate && o2.animate(s2, 0.016);
|
|
5999
5999
|
}, destroy: () => {
|
|
6000
6000
|
this.remove(e4);
|
|
6001
6001
|
} };
|
|
6002
|
-
return this.appliedObjects.set(e4,
|
|
6002
|
+
return this.appliedObjects.set(e4, i2), o2.animate && this.shaderAnimations.push({ object: e4, controller: i2 }), this.events.emit("shader:applied", { object: e4, shaderName: n2 }), i2;
|
|
6003
6003
|
}
|
|
6004
6004
|
applyShaderToMaterial(e4, t2, n2) {
|
|
6005
6005
|
e4.dispose(), e4.onBeforeCompile = (e5) => {
|
|
@@ -6095,10 +6095,10 @@ ${n2.fragFunc || ""}`), e5.fragmentShader = e5.fragmentShader.replace("vec4 diff
|
|
|
6095
6095
|
onInstall() {
|
|
6096
6096
|
const { camera: e4, renderer: o2, scene: s2 } = this.engine;
|
|
6097
6097
|
this._controls = new n.TransformControls(e4, o2.domElement);
|
|
6098
|
-
const
|
|
6099
|
-
|
|
6098
|
+
const r2 = this._controls.getHelper();
|
|
6099
|
+
r2.name = "TransformControls", r2.traverse((e5) => {
|
|
6100
6100
|
e5.isTransformControls = true;
|
|
6101
|
-
}), s2.add(
|
|
6101
|
+
}), s2.add(r2), this.box3Helper = new t.Box3Helper(new t.Box3(), 16776960), this.box3Helper.name = "Box3Helper", this.box3Helper.visible = false, s2.add(this.box3Helper), this.applyConfig(this.config), this._controls.addEventListener("dragging-changed", (e5) => {
|
|
6102
6102
|
const t2 = this.pluginManager?.get("orbit-controller");
|
|
6103
6103
|
t2 && (t2.controls.enabled = !e5.value), this.dragChangeCallback?.(e5.value), e5.value ? this.events.emit("object:transform:start", { object: this._controls.object }) : this.events.emit("object:transform:end", { object: this._controls.object });
|
|
6104
6104
|
}), this._controls.addEventListener("change", () => {
|
|
@@ -6158,15 +6158,15 @@ ${n2.fragFunc || ""}`), e5.fragmentShader = e5.fragmentShader.replace("vec4 diff
|
|
|
6158
6158
|
t2.boundsTree && t2.disposeBoundsTree();
|
|
6159
6159
|
}
|
|
6160
6160
|
});
|
|
6161
|
-
}, exports.drawModeList = Io, exports.geometryList =
|
|
6161
|
+
}, exports.drawModeList = Io, exports.geometryList = zo, exports.getBestViewTarget = function(e4, n2 = 2.5) {
|
|
6162
6162
|
const { center: o2, max: s2 } = $o(e4);
|
|
6163
6163
|
return { position: Vo(o2, s2, new t.Vector3().subVectors(s2, o2).length() * n2), target: o2 };
|
|
6164
6164
|
}, exports.getDistanceScalePoint = function(e4, n2, o2 = 0.9) {
|
|
6165
6165
|
const s2 = e4.distanceTo(n2);
|
|
6166
6166
|
return new t.Vector3().subVectors(n2, e4).normalize().multiplyScalar(s2 * o2).add(e4);
|
|
6167
6167
|
}, exports.getObjectBox3 = $o, exports.getObjectViews = function(e4, n2 = 50) {
|
|
6168
|
-
const { center: o2, max: s2, min:
|
|
6169
|
-
return { frontView: new t.Vector3(o2.x, o2.y, s2.z + a2), backView: new t.Vector3(o2.x, o2.y,
|
|
6168
|
+
const { center: o2, max: s2, min: r2, radius: i2 } = $o(e4), a2 = i2 / Math.tan(n2 * Math.PI / 360);
|
|
6169
|
+
return { frontView: new t.Vector3(o2.x, o2.y, s2.z + a2), backView: new t.Vector3(o2.x, o2.y, r2.z - a2), leftView: new t.Vector3(r2.x - a2, o2.y, o2.z), rightView: new t.Vector3(s2.x + a2, o2.y, o2.z), topView: new t.Vector3(o2.x, s2.y + a2, o2.z), bottomView: new t.Vector3(o2.x, r2.y - a2, o2.z), target: o2 };
|
|
6170
6170
|
}, exports.getPointAtDistance = Vo, exports.getRootModel = _n, exports.getWebGLMouse = bn, exports.getWebGLMouseFromContainer = function(e4, n2) {
|
|
6171
6171
|
const o2 = n2.getBoundingClientRect();
|
|
6172
6172
|
return new t.Vector2((e4.clientX - o2.left) / o2.width * 2 - 1, -(e4.clientY - o2.top) / o2.height * 2 + 1);
|
|
@@ -6178,4 +6178,4 @@ ${n2.fragFunc || ""}`), e5.fragmentShader = e5.fragmentShader.replace("vec4 diff
|
|
|
6178
6178
|
const o2 = No((n2 - e4) / (t2 - e4), 0, 1);
|
|
6179
6179
|
return o2 * o2 * (3 - 2 * o2);
|
|
6180
6180
|
};
|
|
6181
|
-
//# sourceMappingURL=SceneConfigPlugin-
|
|
6181
|
+
//# sourceMappingURL=SceneConfigPlugin-COseIMiE.cjs.map
|