gl-draw 0.10.21 → 0.10.22
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/objects/index.js +2 -2
- package/dist/objects/index.module.js +312 -323
- package/dist/objects/node/index.d.ts +3 -5
- package/dist/plugins/Draw.d.ts +4 -0
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/index.module.js +92 -66
- package/package.json +1 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
var xe = Object.defineProperty, we = Object.defineProperties;
|
|
2
|
-
var
|
|
2
|
+
var Me = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var gt = Object.getOwnPropertySymbols;
|
|
4
4
|
var qt = Object.prototype.hasOwnProperty, Zt = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var Jt = Math.pow, $t = (a, t, e) => t in a ? xe(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e,
|
|
5
|
+
var Jt = Math.pow, $t = (a, t, e) => t in a ? xe(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e, V = (a, t) => {
|
|
6
6
|
for (var e in t || (t = {}))
|
|
7
7
|
qt.call(t, e) && $t(a, e, t[e]);
|
|
8
8
|
if (gt)
|
|
9
9
|
for (var e of gt(t))
|
|
10
10
|
Zt.call(t, e) && $t(a, e, t[e]);
|
|
11
11
|
return a;
|
|
12
|
-
},
|
|
13
|
-
var
|
|
12
|
+
}, Mt = (a, t) => we(a, Me(t));
|
|
13
|
+
var At = (a, t) => {
|
|
14
14
|
var e = {};
|
|
15
15
|
for (var i in a)
|
|
16
16
|
qt.call(a, i) && t.indexOf(i) < 0 && (e[i] = a[i]);
|
|
@@ -19,46 +19,46 @@ var Mt = (a, t) => {
|
|
|
19
19
|
t.indexOf(i) < 0 && Zt.call(a, i) && (e[i] = a[i]);
|
|
20
20
|
return e;
|
|
21
21
|
};
|
|
22
|
-
var
|
|
23
|
-
var
|
|
22
|
+
var nt = (a, t, e) => new Promise((i, s) => {
|
|
23
|
+
var n = (u) => {
|
|
24
24
|
try {
|
|
25
25
|
o(e.next(u));
|
|
26
26
|
} catch (c) {
|
|
27
27
|
s(c);
|
|
28
28
|
}
|
|
29
|
-
},
|
|
29
|
+
}, r = (u) => {
|
|
30
30
|
try {
|
|
31
31
|
o(e.throw(u));
|
|
32
32
|
} catch (c) {
|
|
33
33
|
s(c);
|
|
34
34
|
}
|
|
35
|
-
}, o = (u) => u.done ? i(u.value) : Promise.resolve(u.value).then(
|
|
35
|
+
}, o = (u) => u.done ? i(u.value) : Promise.resolve(u.value).then(n, r);
|
|
36
36
|
o((e = e.apply(a, t)).next());
|
|
37
37
|
});
|
|
38
38
|
import * as y from "three";
|
|
39
|
-
import { BufferGeometry as he, BufferAttribute as
|
|
39
|
+
import { BufferGeometry as he, BufferAttribute as Ae, Vector4 as ht, Vector3 as N, Matrix4 as Se, Line3 as _e, Box3 as Pe, Sphere as Te, Mesh as Ce, InstancedInterleavedBuffer as Le, InterleavedBufferAttribute as Xt, MathUtils as Be, Float32BufferAttribute as Kt, ShapeUtils as St, Shape as Ie, Vector2 as U } from "three";
|
|
40
40
|
import { B as it } from "../BaseObject.module.js";
|
|
41
|
-
import { makePromiseCreator as
|
|
42
|
-
import { G as
|
|
41
|
+
import { makePromiseCreator as Ve } from "esus-lite";
|
|
42
|
+
import { G as Ni } from "../index.module2.js";
|
|
43
43
|
import * as at from "@tweenjs/tween.js";
|
|
44
|
-
import { LineSegments2 as
|
|
44
|
+
import { LineSegments2 as Ee } from "three/examples/jsm/lines/LineSegments2";
|
|
45
45
|
import { LineSegmentsGeometry as fe } from "three/examples/jsm/lines/LineSegmentsGeometry";
|
|
46
46
|
import { LineSegmentsGeometry as Hi } from "three/examples/jsm/lines/LineSegmentsGeometry";
|
|
47
47
|
import { LineMaterial as Ge } from "three/examples/jsm/lines/LineMaterial";
|
|
48
48
|
import { LineMaterial as qi } from "three/examples/jsm/lines/LineMaterial";
|
|
49
|
-
import { merge as
|
|
49
|
+
import { merge as Vt, mean as ze, extent as Qt } from "d3-array";
|
|
50
50
|
import Bt from "earcut";
|
|
51
51
|
import je from "@turf/boolean-clockwise";
|
|
52
52
|
import { p as Ue, g as We, c as De } from "../uvGenerator.module.js";
|
|
53
53
|
import Re from "delaunator";
|
|
54
54
|
import Oe from "@turf/boolean-point-in-polygon";
|
|
55
|
-
import { geoBounds as pe, geoContains as ke, geoDistance as
|
|
55
|
+
import { geoBounds as pe, geoContains as ke, geoDistance as Ne, geoInterpolate as Fe } from "d3-geo";
|
|
56
56
|
import { geoVoronoi as He } from "d3-geo-voronoi";
|
|
57
57
|
import { scaleLinear as Yt } from "d3-scale";
|
|
58
58
|
const $e = +y.REVISION < 144, de = $e ? "PlaneBufferGeometry" : "PlaneGeometry";
|
|
59
59
|
class qe extends it {
|
|
60
60
|
constructor(t) {
|
|
61
|
-
super(), this.scaleValue = 1, this.options =
|
|
61
|
+
super(), this.scaleValue = 1, this.options = V({
|
|
62
62
|
scale: 1
|
|
63
63
|
}, t);
|
|
64
64
|
}
|
|
@@ -67,14 +67,14 @@ class qe extends it {
|
|
|
67
67
|
return (t = this.object3d) == null ? void 0 : t.material;
|
|
68
68
|
}
|
|
69
69
|
getMaterial() {
|
|
70
|
-
return
|
|
70
|
+
return nt(this, null, function* () {
|
|
71
71
|
const {
|
|
72
72
|
src: t,
|
|
73
73
|
texture: e,
|
|
74
74
|
transparent: i,
|
|
75
75
|
opacity: s,
|
|
76
|
-
blending:
|
|
77
|
-
depthWrite:
|
|
76
|
+
blending: n,
|
|
77
|
+
depthWrite: r,
|
|
78
78
|
depthTest: o,
|
|
79
79
|
alphaTest: u,
|
|
80
80
|
sprite: c,
|
|
@@ -84,8 +84,8 @@ class qe extends it {
|
|
|
84
84
|
return c ? new y.SpriteMaterial({
|
|
85
85
|
map: p,
|
|
86
86
|
transparent: i != null ? i : !1,
|
|
87
|
-
blending:
|
|
88
|
-
depthWrite:
|
|
87
|
+
blending: n != null ? n : y.NormalBlending,
|
|
88
|
+
depthWrite: r != null ? r : !0,
|
|
89
89
|
depthTest: o != null ? o : !0,
|
|
90
90
|
alphaTest: u != null ? u : 0,
|
|
91
91
|
opacity: s != null ? s : 1,
|
|
@@ -94,8 +94,8 @@ class qe extends it {
|
|
|
94
94
|
color: h != null ? h : 16777215,
|
|
95
95
|
map: p,
|
|
96
96
|
transparent: i != null ? i : !1,
|
|
97
|
-
blending:
|
|
98
|
-
depthWrite:
|
|
97
|
+
blending: n != null ? n : y.NormalBlending,
|
|
98
|
+
depthWrite: r != null ? r : !0,
|
|
99
99
|
depthTest: o != null ? o : !0,
|
|
100
100
|
alphaTest: u != null ? u : 0,
|
|
101
101
|
opacity: s != null ? s : 1
|
|
@@ -103,7 +103,7 @@ class qe extends it {
|
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
105
|
create() {
|
|
106
|
-
return
|
|
106
|
+
return nt(this, null, function* () {
|
|
107
107
|
const { position: t, material: e, sprite: i } = this.options, s = e || (yield this.getMaterial());
|
|
108
108
|
i ? this.createSprite(s) : this.createMesh(new y[de](1, 1), s), t && this.object3d.position.copy(t);
|
|
109
109
|
});
|
|
@@ -132,7 +132,7 @@ class Li extends qe {
|
|
|
132
132
|
super(t), this.canvas = document.createElement("canvas");
|
|
133
133
|
}
|
|
134
134
|
getTexture() {
|
|
135
|
-
const { text: t, textOptions: e } = this.options, { fontSize: i, fontFamily: s, fontWeight:
|
|
135
|
+
const { text: t, textOptions: e } = this.options, { fontSize: i, fontFamily: s, fontWeight: n, flipX: r, color: o, setCtx: u } = V({
|
|
136
136
|
fontSize: 28,
|
|
137
137
|
fontFamily: "system-ui,-apple-system,BlinkMacSystemFont,sans-serif",
|
|
138
138
|
fontWeight: "normal",
|
|
@@ -143,16 +143,16 @@ class Li extends qe {
|
|
|
143
143
|
}, e || {}), { canvas: c } = this;
|
|
144
144
|
c.width = i * t.length * 2, c.height = i;
|
|
145
145
|
let l = c.getContext("2d");
|
|
146
|
-
l.font = `${
|
|
146
|
+
l.font = `${n} ${i}px/1 ${s}`;
|
|
147
147
|
const { width: h } = l.measureText(t);
|
|
148
|
-
c.width = h, l = c.getContext("2d"), l.clearRect(0, 0, c.width, c.height),
|
|
148
|
+
c.width = h, l = c.getContext("2d"), l.clearRect(0, 0, c.width, c.height), r && l.scale(-1, 1), l.font = `${n} ${i}px/1 ${s}`, l.textBaseline = "middle", l.fillStyle = o, u && u(l), l.fillText(t, r ? h * -1 : 0, c.height / 2), l.restore();
|
|
149
149
|
const p = new y.Texture(c);
|
|
150
150
|
return p.anisotropy = this.pencil.renderer.capabilities.getMaxAnisotropy(), p.needsUpdate = !0, Promise.resolve(p);
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
class Bi extends it {
|
|
154
154
|
constructor(t) {
|
|
155
|
-
super(), this.scaleValue = 1, this.options =
|
|
155
|
+
super(), this.scaleValue = 1, this.options = V({
|
|
156
156
|
scale: 1,
|
|
157
157
|
autoPlay: !0,
|
|
158
158
|
loop: !0
|
|
@@ -164,33 +164,33 @@ class Bi extends it {
|
|
|
164
164
|
transparent: e,
|
|
165
165
|
blending: i,
|
|
166
166
|
depthWrite: s,
|
|
167
|
-
depthTest:
|
|
168
|
-
format:
|
|
167
|
+
depthTest: n,
|
|
168
|
+
format: r,
|
|
169
169
|
autoPlay: o,
|
|
170
170
|
loop: u,
|
|
171
171
|
alphaTest: c,
|
|
172
172
|
sprite: l
|
|
173
|
-
} = this.options, h =
|
|
173
|
+
} = this.options, h = Ve();
|
|
174
174
|
if (!t) return Promise.reject("src is required");
|
|
175
175
|
const p = document.createElement("video");
|
|
176
176
|
return p.addEventListener(
|
|
177
177
|
"loadedmetadata",
|
|
178
178
|
() => {
|
|
179
179
|
const f = new y.VideoTexture(p);
|
|
180
|
-
f.format =
|
|
180
|
+
f.format = r != null ? r : y.RGBAFormat, f.needsUpdate = !0;
|
|
181
181
|
const d = l ? new y.SpriteMaterial({
|
|
182
182
|
map: f,
|
|
183
183
|
transparent: e != null ? e : !1,
|
|
184
184
|
blending: i != null ? i : y.NormalBlending,
|
|
185
185
|
depthWrite: s != null ? s : !0,
|
|
186
|
-
depthTest:
|
|
186
|
+
depthTest: n != null ? n : !0,
|
|
187
187
|
alphaTest: c != null ? c : 0
|
|
188
188
|
}) : new y.MeshBasicMaterial({
|
|
189
189
|
map: f,
|
|
190
190
|
transparent: e != null ? e : !1,
|
|
191
191
|
blending: i != null ? i : y.NormalBlending,
|
|
192
192
|
depthWrite: s != null ? s : !0,
|
|
193
|
-
depthTest:
|
|
193
|
+
depthTest: n != null ? n : !0,
|
|
194
194
|
alphaTest: c != null ? c : 0
|
|
195
195
|
});
|
|
196
196
|
h.resolve(d);
|
|
@@ -199,9 +199,9 @@ class Bi extends it {
|
|
|
199
199
|
), p.src = t, p.muted = !0, p.autoplay = o, p.loop = u, p.preload = "auto", h.promise;
|
|
200
200
|
}
|
|
201
201
|
create() {
|
|
202
|
-
return
|
|
203
|
-
const { scale: t, position: e, src: i, cache: s, sprite:
|
|
204
|
-
this.video =
|
|
202
|
+
return nt(this, null, function* () {
|
|
203
|
+
const { scale: t, position: e, src: i, cache: s, sprite: n } = this.options, r = i && (s ? yield s.get(i, () => this.getMaterial()) : yield this.getMaterial());
|
|
204
|
+
this.video = r.map.image, n ? this.createSprite(r) : this.createMesh(new y[de](1, 1), r), this.setScale(t), e && this.object3d.position.copy(e);
|
|
205
205
|
});
|
|
206
206
|
}
|
|
207
207
|
setScale(t) {
|
|
@@ -219,26 +219,16 @@ class Bi extends it {
|
|
|
219
219
|
this.video.pause(), this.video.src = "", super.dispose();
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
|
-
class
|
|
222
|
+
class Ii extends it {
|
|
223
223
|
constructor(t) {
|
|
224
|
-
super(), this.objectType = "BaseObject#Node", this.drawGroupShow = !0, this.visibleCache = !0, this.options =
|
|
224
|
+
super(), this.objectType = "BaseObject#Node", this.drawGroupShow = !0, this.visibleCache = !0, this.onNodePointerIndex = [], this.options = V({
|
|
225
225
|
event: "click",
|
|
226
226
|
type: "2d"
|
|
227
227
|
}, t);
|
|
228
228
|
}
|
|
229
|
-
get clickTarge() {
|
|
230
|
-
const { eventTarge: t } = this.options;
|
|
231
|
-
return t ? t.map((i) => [...this.element.querySelectorAll(i)]).flat() : [this.element];
|
|
232
|
-
}
|
|
233
229
|
create() {
|
|
234
|
-
const { position: t, children: e
|
|
235
|
-
this.element =
|
|
236
|
-
const o = Array.isArray(s) ? s : [s], u = Array.isArray(i) ? i : [i];
|
|
237
|
-
o.forEach((c, l) => {
|
|
238
|
-
const h = u[l];
|
|
239
|
-
h && n.addEventListener(c, h);
|
|
240
|
-
});
|
|
241
|
-
});
|
|
230
|
+
const { position: t, children: e } = this.options, i = document.createElement("div");
|
|
231
|
+
this.element = i, e && i.appendChild(e), this.options.type === "3d" ? this.createCSS3DObject(i) : this.options.type === "3dSprite" ? this.createCSS3DSprite(i) : this.createCSS2DObject(i), t && this.object3d.position.copy(t);
|
|
242
232
|
}
|
|
243
233
|
setChildren(t) {
|
|
244
234
|
this.element.innerHTML = "", this.element.appendChild(t);
|
|
@@ -255,20 +245,19 @@ class Ei extends it {
|
|
|
255
245
|
checkVisible() {
|
|
256
246
|
this.drawGroupShow && this.visibleCache ? super.show() : (!this.drawGroupShow || !this.visibleCache) && super.hide();
|
|
257
247
|
}
|
|
248
|
+
onPointerEvent(t, e) {
|
|
249
|
+
const i = this.drawController.handlePickNode([this], t, e);
|
|
250
|
+
this.onNodePointerIndex.push(i);
|
|
251
|
+
}
|
|
258
252
|
dispose() {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
const s = Array.isArray(e) ? e : [e], r = Array.isArray(t) ? t : [t];
|
|
262
|
-
s.forEach((n, o) => {
|
|
263
|
-
const u = r[o];
|
|
264
|
-
u && i.removeEventListener(n, u);
|
|
265
|
-
});
|
|
253
|
+
this.onNodePointerIndex.forEach((t) => {
|
|
254
|
+
this.drawController.removePickNode(t);
|
|
266
255
|
}), super.dispose();
|
|
267
256
|
}
|
|
268
257
|
}
|
|
269
|
-
class
|
|
258
|
+
class Vi extends it {
|
|
270
259
|
constructor(t) {
|
|
271
|
-
super(), this.options =
|
|
260
|
+
super(), this.options = V({
|
|
272
261
|
maxDepth: 10,
|
|
273
262
|
percentDepth: !1,
|
|
274
263
|
innerRadius: 25,
|
|
@@ -277,31 +266,31 @@ class Ii extends it {
|
|
|
277
266
|
}, t);
|
|
278
267
|
}
|
|
279
268
|
create() {
|
|
280
|
-
return
|
|
269
|
+
return nt(this, null, function* () {
|
|
281
270
|
this.createGroup();
|
|
282
|
-
const { data: t, maxDepth: e, colors: i, material: s, percentDepth:
|
|
271
|
+
const { data: t, maxDepth: e, colors: i, material: s, percentDepth: n, activeIndex: r } = this.options, o = Math.max(...t), u = t.reduce((l, h) => l + h, 0);
|
|
283
272
|
let c = Math.PI / 2;
|
|
284
273
|
t.forEach((l, h) => {
|
|
285
274
|
if (l === 0) return;
|
|
286
|
-
const p = Math.PI * 2 * (l / u), f = i[h], d =
|
|
275
|
+
const p = Math.PI * 2 * (l / u), f = i[h], d = n ? e * (l / o) : e, m = this.createGeometry(d, p), w = s ? s.clone() : new y.MeshBasicMaterial({
|
|
287
276
|
color: f
|
|
288
277
|
});
|
|
289
278
|
s && w.color.set(f);
|
|
290
279
|
const P = new y.Mesh(m, w);
|
|
291
280
|
P.userData.depth = d, P.userData.index = h, P.rotateZ(c), c += p, this.add(P);
|
|
292
|
-
}),
|
|
281
|
+
}), r !== -1 && this.setActive(r);
|
|
293
282
|
});
|
|
294
283
|
}
|
|
295
284
|
createGeometry(t, e) {
|
|
296
|
-
const { outRadius: i, innerRadius: s } = this.options,
|
|
297
|
-
return
|
|
285
|
+
const { outRadius: i, innerRadius: s } = this.options, n = new y.Shape();
|
|
286
|
+
return n.moveTo(i, 0), n.lineTo(s, 0), n.absarc(0, 0, s, 0, e, !1), n.absarc(0, 0, i, e, 0, !0), new y.ExtrudeGeometry(n, {
|
|
298
287
|
curveSegments: 48,
|
|
299
288
|
depth: t,
|
|
300
289
|
bevelEnabled: !1
|
|
301
290
|
});
|
|
302
291
|
}
|
|
303
292
|
handlePick(t, e = 1.3) {
|
|
304
|
-
const { object: i } = this.pencil.pick(t, this.object3d.children) || {}, s = i ? this.object3d.children.findIndex((
|
|
293
|
+
const { object: i } = this.pencil.pick(t, this.object3d.children) || {}, s = i ? this.object3d.children.findIndex((n) => n === i) : this.options.activeIndex;
|
|
305
294
|
return this.setActive(s, e);
|
|
306
295
|
}
|
|
307
296
|
setActive(t, e = 1.3) {
|
|
@@ -310,8 +299,8 @@ class Ii extends it {
|
|
|
310
299
|
if (!(i && i === s) && s.scale.z !== 1) {
|
|
311
300
|
if (s.userData.levTween) return;
|
|
312
301
|
s.userData.enTween && (s.userData.enTween.stop(), s.userData.enTween = null);
|
|
313
|
-
const
|
|
314
|
-
s.userData.levTween =
|
|
302
|
+
const n = new at.Tween(s.scale).to({ z: 1 }, 100);
|
|
303
|
+
s.userData.levTween = n, n.start();
|
|
315
304
|
}
|
|
316
305
|
}), i) {
|
|
317
306
|
if (i.userData.enTween)
|
|
@@ -326,12 +315,12 @@ class Ii extends it {
|
|
|
326
315
|
this.object3d.scale.z = 0, new at.Tween(this.object3d.scale).to({ z: 1 }, 1e3).easing(at.Easing.Sinusoidal.InOut).start();
|
|
327
316
|
}
|
|
328
317
|
}
|
|
329
|
-
class
|
|
318
|
+
class Ei extends it {
|
|
330
319
|
constructor(t) {
|
|
331
320
|
super(), this.options = t;
|
|
332
321
|
}
|
|
333
322
|
create() {
|
|
334
|
-
var e, i, s,
|
|
323
|
+
var e, i, s, n, r, o, u, c, l, h, p, f, d;
|
|
335
324
|
const t = this.options;
|
|
336
325
|
if (t.type === "AmbientLight") {
|
|
337
326
|
const m = new y.AmbientLight(t.color);
|
|
@@ -344,12 +333,12 @@ class Vi extends it {
|
|
|
344
333
|
(e = t.color) != null ? e : 16777215,
|
|
345
334
|
(i = t.intensity) != null ? i : 1,
|
|
346
335
|
(s = t.distance) != null ? s : 0,
|
|
347
|
-
(
|
|
336
|
+
(n = t.decay) != null ? n : 2
|
|
348
337
|
);
|
|
349
338
|
m.name = "PointLight", this.object3d = m, this.pointLight = m;
|
|
350
339
|
} else if (t.type === "SpotLight") {
|
|
351
340
|
const m = new y.SpotLight(
|
|
352
|
-
(
|
|
341
|
+
(r = t.color) != null ? r : 16777215,
|
|
353
342
|
(o = t.intensity) != null ? o : 1,
|
|
354
343
|
(u = t.distance) != null ? u : 0,
|
|
355
344
|
(c = t.angle) != null ? c : Math.PI / 3,
|
|
@@ -381,7 +370,7 @@ class Vi extends it {
|
|
|
381
370
|
function et(a, t = 0) {
|
|
382
371
|
const e = a[0].index !== null, i = new Set(Object.keys(a[0].attributes)), s = new Set(
|
|
383
372
|
Object.keys(a[0].morphAttributes)
|
|
384
|
-
),
|
|
373
|
+
), n = {}, r = {}, o = a[0].morphTargetsRelative, u = new he();
|
|
385
374
|
let c = 0;
|
|
386
375
|
for (let l = 0; l < a.length; ++l) {
|
|
387
376
|
const h = a[l];
|
|
@@ -395,7 +384,7 @@ function et(a, t = 0) {
|
|
|
395
384
|
return console.error(
|
|
396
385
|
"THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + l + '. All geometries must have compatible attributes; make sure "' + f + '" attribute exists among all geometries, or in none of them.'
|
|
397
386
|
), null;
|
|
398
|
-
|
|
387
|
+
n[f] === void 0 && (n[f] = []), n[f].push(h.attributes[f]), p++;
|
|
399
388
|
}
|
|
400
389
|
if (p !== i.size)
|
|
401
390
|
return console.error(
|
|
@@ -410,7 +399,7 @@ function et(a, t = 0) {
|
|
|
410
399
|
return console.error(
|
|
411
400
|
"THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + l + ". .morphAttributes must be consistent throughout all geometries."
|
|
412
401
|
), null;
|
|
413
|
-
|
|
402
|
+
r[f] === void 0 && (r[f] = []), r[f].push(h.morphAttributes[f]);
|
|
414
403
|
}
|
|
415
404
|
if (t) {
|
|
416
405
|
let f;
|
|
@@ -447,22 +436,22 @@ function et(a, t = 0) {
|
|
|
447
436
|
}
|
|
448
437
|
u.setIndex(h);
|
|
449
438
|
}
|
|
450
|
-
for (const l in
|
|
451
|
-
const h = te(
|
|
439
|
+
for (const l in n) {
|
|
440
|
+
const h = te(n[l]);
|
|
452
441
|
if (!h)
|
|
453
442
|
return console.error(
|
|
454
443
|
"THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + l + " attribute."
|
|
455
444
|
), null;
|
|
456
445
|
u.setAttribute(l, h);
|
|
457
446
|
}
|
|
458
|
-
for (const l in
|
|
459
|
-
const h =
|
|
447
|
+
for (const l in r) {
|
|
448
|
+
const h = r[l][0].length;
|
|
460
449
|
if (h === 0) break;
|
|
461
450
|
u.morphAttributes = u.morphAttributes || {}, u.morphAttributes[l] = [];
|
|
462
451
|
for (let p = 0; p < h; ++p) {
|
|
463
452
|
const f = [];
|
|
464
|
-
for (let m = 0; m <
|
|
465
|
-
f.push(
|
|
453
|
+
for (let m = 0; m < r[l].length; ++m)
|
|
454
|
+
f.push(r[l][m][p]);
|
|
466
455
|
const d = te(f);
|
|
467
456
|
if (!d)
|
|
468
457
|
return console.error(
|
|
@@ -474,7 +463,7 @@ function et(a, t = 0) {
|
|
|
474
463
|
return t === 2 ? Ze(u) : u;
|
|
475
464
|
}
|
|
476
465
|
function te(a) {
|
|
477
|
-
let t, e, i, s = -1,
|
|
466
|
+
let t, e, i, s = -1, n = 0;
|
|
478
467
|
for (let c = 0; c < a.length; ++c) {
|
|
479
468
|
const l = a[c];
|
|
480
469
|
if (t === void 0 && (t = l.array.constructor), t !== l.array.constructor)
|
|
@@ -493,9 +482,9 @@ function te(a) {
|
|
|
493
482
|
return console.error(
|
|
494
483
|
"THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."
|
|
495
484
|
), null;
|
|
496
|
-
|
|
485
|
+
n += l.count * e;
|
|
497
486
|
}
|
|
498
|
-
const
|
|
487
|
+
const r = new t(n), o = new Ae(r, e, i);
|
|
499
488
|
let u = 0;
|
|
500
489
|
for (let c = 0; c < a.length; ++c) {
|
|
501
490
|
const l = a[c];
|
|
@@ -507,7 +496,7 @@ function te(a) {
|
|
|
507
496
|
o.setComponent(p + h, d, m);
|
|
508
497
|
}
|
|
509
498
|
} else
|
|
510
|
-
|
|
499
|
+
r.set(l.array, u);
|
|
511
500
|
u += l.count * e;
|
|
512
501
|
}
|
|
513
502
|
return s !== void 0 && (o.gpuType = s), o;
|
|
@@ -518,43 +507,43 @@ function Ze(a) {
|
|
|
518
507
|
"THREE.BufferGeometryUtils.mergeGroups(): No groups are defined. Nothing to merge."
|
|
519
508
|
), a;
|
|
520
509
|
let t = a.groups;
|
|
521
|
-
if (t = t.sort((
|
|
522
|
-
const
|
|
523
|
-
for (let u = 0; u <
|
|
510
|
+
if (t = t.sort((r, o) => r.materialIndex !== o.materialIndex ? r.materialIndex - o.materialIndex : r.start - o.start), a.getIndex() === null) {
|
|
511
|
+
const r = a.getAttribute("position"), o = [];
|
|
512
|
+
for (let u = 0; u < r.count; u += 3)
|
|
524
513
|
o.push(u, u + 1, u + 2);
|
|
525
514
|
a.setIndex(o);
|
|
526
515
|
}
|
|
527
516
|
const e = a.getIndex(), i = [];
|
|
528
|
-
for (let
|
|
529
|
-
const o = t[
|
|
517
|
+
for (let r = 0; r < t.length; r++) {
|
|
518
|
+
const o = t[r], u = o.start, c = u + o.count;
|
|
530
519
|
for (let l = u; l < c; l++)
|
|
531
520
|
i.push(e.getX(l));
|
|
532
521
|
}
|
|
533
522
|
a.dispose(), a.setIndex(i);
|
|
534
523
|
let s = 0;
|
|
535
|
-
for (let
|
|
536
|
-
const o = t[
|
|
524
|
+
for (let r = 0; r < t.length; r++) {
|
|
525
|
+
const o = t[r];
|
|
537
526
|
o.start = s, s += o.count;
|
|
538
527
|
}
|
|
539
|
-
let
|
|
540
|
-
a.groups = [
|
|
541
|
-
for (let
|
|
542
|
-
const o = t[
|
|
543
|
-
|
|
528
|
+
let n = t[0];
|
|
529
|
+
a.groups = [n];
|
|
530
|
+
for (let r = 1; r < t.length; r++) {
|
|
531
|
+
const o = t[r];
|
|
532
|
+
n.materialIndex === o.materialIndex ? n.count += o.count : (n = o, a.groups.push(n));
|
|
544
533
|
}
|
|
545
534
|
return a;
|
|
546
535
|
}
|
|
547
|
-
const _t = new ht(), ee = new
|
|
548
|
-
let Z,
|
|
549
|
-
function
|
|
550
|
-
return q.set(0, 0, -t, 1).applyMatrix4(a.projectionMatrix), q.multiplyScalar(1 / q.w), q.x =
|
|
536
|
+
const _t = new ht(), ee = new N(), ie = new N(), G = new ht(), z = new ht(), $ = new ht(), Pt = new N(), Tt = new Se(), j = new _e(), se = new N(), yt = new Pe(), vt = new Te(), q = new ht();
|
|
537
|
+
let Z, rt;
|
|
538
|
+
function ne(a, t, e) {
|
|
539
|
+
return q.set(0, 0, -t, 1).applyMatrix4(a.projectionMatrix), q.multiplyScalar(1 / q.w), q.x = rt / e.width, q.y = rt / e.height, q.applyMatrix4(a.projectionMatrixInverse), q.multiplyScalar(1 / q.w), Math.abs(Math.max(q.x, q.y));
|
|
551
540
|
}
|
|
552
541
|
function Je(a, t) {
|
|
553
|
-
const e = a.matrixWorld, i = a.geometry, s = i.attributes.instanceStart,
|
|
554
|
-
for (let o = 0, u =
|
|
555
|
-
j.start.fromBufferAttribute(s, o), j.end.fromBufferAttribute(
|
|
556
|
-
const c = new
|
|
557
|
-
Z.distanceSqToSegment(j.start, j.end, l, c), l.distanceTo(c) <
|
|
542
|
+
const e = a.matrixWorld, i = a.geometry, s = i.attributes.instanceStart, n = i.attributes.instanceEnd, r = Math.min(i.instanceCount, s.count);
|
|
543
|
+
for (let o = 0, u = r; o < u; o++) {
|
|
544
|
+
j.start.fromBufferAttribute(s, o), j.end.fromBufferAttribute(n, o), j.applyMatrix4(e);
|
|
545
|
+
const c = new N(), l = new N();
|
|
546
|
+
Z.distanceSqToSegment(j.start, j.end, l, c), l.distanceTo(c) < rt * 0.5 && t.push({
|
|
558
547
|
point: l,
|
|
559
548
|
pointOnLine: c,
|
|
560
549
|
distance: Z.origin.distanceTo(l),
|
|
@@ -567,8 +556,8 @@ function Je(a, t) {
|
|
|
567
556
|
}
|
|
568
557
|
}
|
|
569
558
|
function Xe(a, t, e) {
|
|
570
|
-
const i = t.projectionMatrix,
|
|
571
|
-
Z.at(1, $), $.w = 1, $.applyMatrix4(t.matrixWorldInverse), $.applyMatrix4(i), $.multiplyScalar(1 / $.w), $.x *=
|
|
559
|
+
const i = t.projectionMatrix, n = a.material.resolution, r = a.matrixWorld, o = a.geometry, u = o.attributes.instanceStart, c = o.attributes.instanceEnd, l = Math.min(o.instanceCount, u.count), h = -t.near;
|
|
560
|
+
Z.at(1, $), $.w = 1, $.applyMatrix4(t.matrixWorldInverse), $.applyMatrix4(i), $.multiplyScalar(1 / $.w), $.x *= n.x / 2, $.y *= n.y / 2, $.z = 0, Pt.copy($), Tt.multiplyMatrices(t.matrixWorldInverse, r);
|
|
572
561
|
for (let p = 0, f = l; p < f; p++) {
|
|
573
562
|
if (G.fromBufferAttribute(u, p), z.fromBufferAttribute(c, p), G.w = 1, z.w = 1, G.applyMatrix4(Tt), z.applyMatrix4(Tt), G.z > h && z.z > h)
|
|
574
563
|
continue;
|
|
@@ -579,13 +568,13 @@ function Xe(a, t, e) {
|
|
|
579
568
|
const S = z.z - G.z, T = (z.z - h) / S;
|
|
580
569
|
z.lerp(G, T);
|
|
581
570
|
}
|
|
582
|
-
G.applyMatrix4(i), z.applyMatrix4(i), G.multiplyScalar(1 / G.w), z.multiplyScalar(1 / z.w), G.x *=
|
|
571
|
+
G.applyMatrix4(i), z.applyMatrix4(i), G.multiplyScalar(1 / G.w), z.multiplyScalar(1 / z.w), G.x *= n.x / 2, G.y *= n.y / 2, z.x *= n.x / 2, z.y *= n.y / 2, j.start.copy(G), j.start.z = 0, j.end.copy(z), j.end.z = 0;
|
|
583
572
|
const m = j.closestPointToPointParameter(Pt, !0);
|
|
584
573
|
j.at(m, se);
|
|
585
|
-
const w = Be.lerp(G.z, z.z, m), P = w >= -1 && w <= 1, C = Pt.distanceTo(se) <
|
|
574
|
+
const w = Be.lerp(G.z, z.z, m), P = w >= -1 && w <= 1, C = Pt.distanceTo(se) < rt * 0.5;
|
|
586
575
|
if (P && C) {
|
|
587
|
-
j.start.fromBufferAttribute(u, p), j.end.fromBufferAttribute(c, p), j.start.applyMatrix4(
|
|
588
|
-
const S = new
|
|
576
|
+
j.start.fromBufferAttribute(u, p), j.end.fromBufferAttribute(c, p), j.start.applyMatrix4(r), j.end.applyMatrix4(r);
|
|
577
|
+
const S = new N(), T = new N();
|
|
589
578
|
Z.distanceSqToSegment(j.start, j.end, T, S), e.push({
|
|
590
579
|
point: T,
|
|
591
580
|
pointOnLine: S,
|
|
@@ -606,19 +595,19 @@ class Ke extends Ce {
|
|
|
606
595
|
// for backwards-compatibility, but could be a method of LineSegmentsGeometry...
|
|
607
596
|
computeLineDistances() {
|
|
608
597
|
const t = this.geometry, e = t.attributes.instanceStart, i = t.attributes.instanceEnd, s = new Float32Array(2 * e.count);
|
|
609
|
-
for (let
|
|
610
|
-
ee.fromBufferAttribute(e,
|
|
611
|
-
const
|
|
598
|
+
for (let r = 0, o = 0, u = e.count; r < u; r++, o += 2)
|
|
599
|
+
ee.fromBufferAttribute(e, r), ie.fromBufferAttribute(i, r), s[o] = o === 0 ? 0 : s[o - 1], s[o + 1] = s[o] + ee.distanceTo(ie);
|
|
600
|
+
const n = new Le(
|
|
612
601
|
s,
|
|
613
602
|
2,
|
|
614
603
|
1
|
|
615
604
|
);
|
|
616
605
|
return t.setAttribute(
|
|
617
606
|
"instanceDistanceStart",
|
|
618
|
-
new Xt(
|
|
607
|
+
new Xt(n, 1, 0)
|
|
619
608
|
), t.setAttribute(
|
|
620
609
|
"instanceDistanceEnd",
|
|
621
|
-
new Xt(
|
|
610
|
+
new Xt(n, 1, 1)
|
|
622
611
|
), this;
|
|
623
612
|
}
|
|
624
613
|
raycast(t, e) {
|
|
@@ -626,19 +615,19 @@ class Ke extends Ce {
|
|
|
626
615
|
s === null && !i && console.error(
|
|
627
616
|
'LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'
|
|
628
617
|
);
|
|
629
|
-
const
|
|
618
|
+
const n = t.params.Line2 !== void 0 && t.params.Line2.threshold || 0;
|
|
630
619
|
Z = t.ray;
|
|
631
|
-
const
|
|
632
|
-
|
|
620
|
+
const r = this.matrixWorld, o = this.geometry, u = this.material;
|
|
621
|
+
rt = u.linewidth + n, o.boundingSphere === null && o.computeBoundingSphere(), vt.copy(o.boundingSphere).applyMatrix4(r);
|
|
633
622
|
let c;
|
|
634
623
|
if (i)
|
|
635
|
-
c =
|
|
624
|
+
c = rt * 0.5;
|
|
636
625
|
else {
|
|
637
626
|
const h = Math.max(
|
|
638
627
|
s.near,
|
|
639
628
|
vt.distanceToPoint(Z.origin)
|
|
640
629
|
);
|
|
641
|
-
c =
|
|
630
|
+
c = ne(
|
|
642
631
|
s,
|
|
643
632
|
h,
|
|
644
633
|
u.resolution
|
|
@@ -646,16 +635,16 @@ class Ke extends Ce {
|
|
|
646
635
|
}
|
|
647
636
|
if (vt.radius += c, Z.intersectsSphere(vt) === !1)
|
|
648
637
|
return;
|
|
649
|
-
o.boundingBox === null && o.computeBoundingBox(), yt.copy(o.boundingBox).applyMatrix4(
|
|
638
|
+
o.boundingBox === null && o.computeBoundingBox(), yt.copy(o.boundingBox).applyMatrix4(r);
|
|
650
639
|
let l;
|
|
651
640
|
if (i)
|
|
652
|
-
l =
|
|
641
|
+
l = rt * 0.5;
|
|
653
642
|
else {
|
|
654
643
|
const h = Math.max(
|
|
655
644
|
s.near,
|
|
656
645
|
yt.distanceToPoint(Z.origin)
|
|
657
646
|
);
|
|
658
|
-
l =
|
|
647
|
+
l = ne(
|
|
659
648
|
s,
|
|
660
649
|
h,
|
|
661
650
|
u.resolution
|
|
@@ -668,43 +657,43 @@ class Ke extends Ce {
|
|
|
668
657
|
e && e.resolution && (t.getViewport(_t), this.material.uniforms.resolution.value.set(_t.z, _t.w));
|
|
669
658
|
}
|
|
670
659
|
}
|
|
671
|
-
const
|
|
672
|
-
const { points: t } = a, e = t.reduce((s,
|
|
660
|
+
const re = (a) => {
|
|
661
|
+
const { points: t } = a, e = t.reduce((s, n, r) => (r < t.length - 1 && s.push(n, t[r + 1]), s), []);
|
|
673
662
|
return new y.BufferGeometry().setFromPoints(e);
|
|
674
663
|
};
|
|
675
664
|
let Gi = class extends it {
|
|
676
665
|
constructor(t = {}) {
|
|
677
|
-
super(), this.options =
|
|
666
|
+
super(), this.options = V({}, t);
|
|
678
667
|
}
|
|
679
668
|
get material() {
|
|
680
669
|
var t;
|
|
681
670
|
return (t = this.object3d) == null ? void 0 : t.material;
|
|
682
671
|
}
|
|
683
672
|
create() {
|
|
684
|
-
return
|
|
673
|
+
return nt(this, null, function* () {
|
|
685
674
|
const {
|
|
686
675
|
points: t,
|
|
687
676
|
pointsArr: e,
|
|
688
677
|
geometry: i,
|
|
689
678
|
geometryArr: s,
|
|
690
|
-
material:
|
|
691
|
-
useGroups:
|
|
679
|
+
material: n,
|
|
680
|
+
useGroups: r,
|
|
692
681
|
setPointWidth: o,
|
|
693
682
|
lineWidthArr: u,
|
|
694
683
|
materialParameters: c,
|
|
695
684
|
instanceCount: l
|
|
696
685
|
} = this.options;
|
|
697
|
-
let h =
|
|
698
|
-
!h && c && (h = this.getMaterial(c)), !p && t ? p =
|
|
686
|
+
let h = n, p = i;
|
|
687
|
+
!h && c && (h = this.getMaterial(c)), !p && t ? p = re({
|
|
699
688
|
points: t
|
|
700
689
|
}) : !p && e ? p = et(
|
|
701
|
-
e.map((d) =>
|
|
690
|
+
e.map((d) => re({
|
|
702
691
|
points: d
|
|
703
692
|
})),
|
|
704
|
-
|
|
693
|
+
r != null ? r : 0
|
|
705
694
|
) : !p && s && s.length > 1 ? p = et(
|
|
706
695
|
s,
|
|
707
|
-
|
|
696
|
+
r != null ? r : 0
|
|
708
697
|
) : !p && s && s.length === 1 && ([p] = s);
|
|
709
698
|
const f = new fe().fromLineSegments(
|
|
710
699
|
new y.LineSegments(p)
|
|
@@ -714,19 +703,19 @@ let Gi = class extends it {
|
|
|
714
703
|
const d = new Ke(f, h);
|
|
715
704
|
d.computeLineDistances(), this.object3d = d;
|
|
716
705
|
} else {
|
|
717
|
-
const d = new
|
|
706
|
+
const d = new Ee(f, h);
|
|
718
707
|
d.computeLineDistances(), this.object3d = d;
|
|
719
708
|
}
|
|
720
709
|
});
|
|
721
710
|
}
|
|
722
711
|
getMaterial(t) {
|
|
723
|
-
return new Ge(
|
|
712
|
+
return new Ge(V({
|
|
724
713
|
color: new y.Color("#ffffff")
|
|
725
714
|
}, t));
|
|
726
715
|
}
|
|
727
716
|
};
|
|
728
717
|
function Ct(a, t, e, i, s) {
|
|
729
|
-
let
|
|
718
|
+
let n;
|
|
730
719
|
if (a = a.subarray || a.slice ? a : a.buffer, e = e.subarray || e.slice ? e : e.buffer, a = t ? (
|
|
731
720
|
// @ts-ignore
|
|
732
721
|
a.subarray ? (
|
|
@@ -739,7 +728,7 @@ function Ct(a, t, e, i, s) {
|
|
|
739
728
|
) : a, e.set)
|
|
740
729
|
e.set(a, i);
|
|
741
730
|
else
|
|
742
|
-
for (
|
|
731
|
+
for (n = 0; n < a.length; n++) e[n + i] = a[n];
|
|
743
732
|
return e;
|
|
744
733
|
}
|
|
745
734
|
function Qe(a) {
|
|
@@ -768,8 +757,8 @@ class Ye extends y.BufferGeometry {
|
|
|
768
757
|
setPoints(t, e) {
|
|
769
758
|
if (t = Qe(t), this._points = t, this.widthCallback = e != null ? e : null, this.positions = [], this.counters = [], t.length && t[0] instanceof y.Vector3)
|
|
770
759
|
for (let i = 0; i < t.length; i++) {
|
|
771
|
-
const s = t[i],
|
|
772
|
-
this.positions.push(s.x, s.y, s.z), this.positions.push(s.x, s.y, s.z), this.counters.push(
|
|
760
|
+
const s = t[i], n = i / (t.length - 1);
|
|
761
|
+
this.positions.push(s.x, s.y, s.z), this.positions.push(s.x, s.y, s.z), this.counters.push(n), this.counters.push(n);
|
|
773
762
|
}
|
|
774
763
|
else
|
|
775
764
|
for (let i = 0; i < t.length; i += 3) {
|
|
@@ -794,8 +783,8 @@ class Ye extends y.BufferGeometry {
|
|
|
794
783
|
for (let s = 0; s < t; s++) {
|
|
795
784
|
if (this.side.push(1), this.side.push(-1), this.widthCallback ? e = this.widthCallback(s / (t - 1)) : e = 1, this.width.push(e), this.width.push(e), this.uvs.push(s / (t - 1), 0), this.uvs.push(s / (t - 1), 1), s < t - 1) {
|
|
796
785
|
i = this.copyV3(s), this.previous.push(i[0], i[1], i[2]), this.previous.push(i[0], i[1], i[2]);
|
|
797
|
-
const
|
|
798
|
-
this.indices_array.push(
|
|
786
|
+
const n = s * 2;
|
|
787
|
+
this.indices_array.push(n, n + 1, n + 2), this.indices_array.push(n + 2, n + 1, n + 3);
|
|
799
788
|
}
|
|
800
789
|
s > 0 && (i = this.copyV3(s), this.next.push(i[0], i[1], i[2]), this.next.push(i[0], i[1], i[2]));
|
|
801
790
|
}
|
|
@@ -821,8 +810,8 @@ class Ye extends y.BufferGeometry {
|
|
|
821
810
|
* @param position
|
|
822
811
|
*/
|
|
823
812
|
advance({ x: t, y: e, z: i }) {
|
|
824
|
-
const s = this._attributes.position.array,
|
|
825
|
-
Ct(s, 0,
|
|
813
|
+
const s = this._attributes.position.array, n = this._attributes.previous.array, r = this._attributes.next.array, o = s.length;
|
|
814
|
+
Ct(s, 0, n, 0, o), Ct(s, 6, s, 0, o - 6), s[o - 6] = t, s[o - 5] = e, s[o - 4] = i, s[o - 3] = t, s[o - 2] = e, s[o - 1] = i, Ct(s, 6, r, 0, o - 6), r[o - 6] = t, r[o - 5] = e, r[o - 4] = i, r[o - 3] = t, r[o - 2] = e, r[o - 1] = i, this._attributes.position.needsUpdate = !0, this._attributes.previous.needsUpdate = !0, this._attributes.next.needsUpdate = !0;
|
|
826
815
|
}
|
|
827
816
|
}
|
|
828
817
|
const oe = ["encodings_fragment", "colorspace_fragment"], ti = (
|
|
@@ -980,7 +969,7 @@ const oe = ["encodings_fragment", "colorspace_fragment"], ti = (
|
|
|
980
969
|
class ii extends y.ShaderMaterial {
|
|
981
970
|
constructor(t) {
|
|
982
971
|
super({
|
|
983
|
-
uniforms:
|
|
972
|
+
uniforms: Mt(V({}, y.UniformsLib.fog), {
|
|
984
973
|
lineWidth: { value: 1 },
|
|
985
974
|
map: { value: null },
|
|
986
975
|
useMap: { value: 0 },
|
|
@@ -1234,24 +1223,24 @@ class ii extends y.ShaderMaterial {
|
|
|
1234
1223
|
}
|
|
1235
1224
|
}
|
|
1236
1225
|
function ji(a, t) {
|
|
1237
|
-
const e = new y.Matrix4(), i = new y.Ray(), s = new y.Sphere(),
|
|
1238
|
-
if (s.copy(
|
|
1226
|
+
const e = new y.Matrix4(), i = new y.Ray(), s = new y.Sphere(), n = new y.Vector3(), r = this.geometry;
|
|
1227
|
+
if (s.copy(r.boundingSphere), s.applyMatrix4(this.matrixWorld), !a.ray.intersectSphere(s, n)) return;
|
|
1239
1228
|
e.copy(this.matrixWorld).invert(), i.copy(a.ray).applyMatrix4(e);
|
|
1240
|
-
const o = new y.Vector3(), u = new y.Vector3(), c = new y.Vector3(), l = this instanceof y.LineSegments ? 2 : 1, h =
|
|
1229
|
+
const o = new y.Vector3(), u = new y.Vector3(), c = new y.Vector3(), l = this instanceof y.LineSegments ? 2 : 1, h = r.index, p = r.attributes;
|
|
1241
1230
|
if (h !== null) {
|
|
1242
1231
|
const f = h.array, d = p.position.array, m = p.width.array;
|
|
1243
1232
|
for (let w = 0, P = f.length - 1; w < P; w += l) {
|
|
1244
1233
|
const C = f[w], S = f[w + 1];
|
|
1245
1234
|
o.fromArray(d, C * 3), u.fromArray(d, S * 3);
|
|
1246
|
-
const T = m[Math.floor(w / 3)] != null ? m[Math.floor(w / 3)] : 1, W = a.params.Line.threshold + this.material.lineWidth * T / 2,
|
|
1235
|
+
const T = m[Math.floor(w / 3)] != null ? m[Math.floor(w / 3)] : 1, W = a.params.Line.threshold + this.material.lineWidth * T / 2, I = W * W;
|
|
1247
1236
|
if (i.distanceSqToSegment(
|
|
1248
1237
|
o,
|
|
1249
1238
|
u,
|
|
1250
|
-
|
|
1239
|
+
n,
|
|
1251
1240
|
c
|
|
1252
|
-
) >
|
|
1253
|
-
|
|
1254
|
-
const O = a.ray.origin.distanceTo(
|
|
1241
|
+
) > I) continue;
|
|
1242
|
+
n.applyMatrix4(this.matrixWorld);
|
|
1243
|
+
const O = a.ray.origin.distanceTo(n);
|
|
1255
1244
|
O < a.near || O > a.far || (t.push({
|
|
1256
1245
|
distance: O,
|
|
1257
1246
|
// What do we want? intersection point on the ray or on the segment??
|
|
@@ -1271,26 +1260,26 @@ const Lt = (a) => {
|
|
|
1271
1260
|
};
|
|
1272
1261
|
class Ui extends it {
|
|
1273
1262
|
constructor(t = {}) {
|
|
1274
|
-
super(), this.options =
|
|
1263
|
+
super(), this.options = V({}, t);
|
|
1275
1264
|
}
|
|
1276
1265
|
get material() {
|
|
1277
1266
|
var t;
|
|
1278
1267
|
return (t = this.object3d) == null ? void 0 : t.material;
|
|
1279
1268
|
}
|
|
1280
1269
|
create() {
|
|
1281
|
-
return
|
|
1270
|
+
return nt(this, null, function* () {
|
|
1282
1271
|
const {
|
|
1283
1272
|
nodes: t,
|
|
1284
1273
|
nodesArr: e,
|
|
1285
1274
|
geometry: i,
|
|
1286
1275
|
geometryArr: s,
|
|
1287
|
-
material:
|
|
1288
|
-
useGroups:
|
|
1276
|
+
material: n,
|
|
1277
|
+
useGroups: r,
|
|
1289
1278
|
setPointWidth: o,
|
|
1290
1279
|
lineWidthArr: u,
|
|
1291
1280
|
materialParameters: c
|
|
1292
1281
|
} = this.options;
|
|
1293
|
-
let l =
|
|
1282
|
+
let l = n, h = i;
|
|
1294
1283
|
!l && c && (l = this.getMaterial(c)), !h && t ? h = Lt({
|
|
1295
1284
|
nodes: t,
|
|
1296
1285
|
setPointWidth: o
|
|
@@ -1305,10 +1294,10 @@ class Ui extends it {
|
|
|
1305
1294
|
setPointWidth: d
|
|
1306
1295
|
});
|
|
1307
1296
|
}),
|
|
1308
|
-
|
|
1297
|
+
r != null ? r : 0
|
|
1309
1298
|
) : !h && s && s.length > 1 ? h = et(
|
|
1310
1299
|
s,
|
|
1311
|
-
|
|
1300
|
+
r != null ? r : 0
|
|
1312
1301
|
) : !h && s && s.length === 1 && ([h] = s), this.createMesh(h, l);
|
|
1313
1302
|
});
|
|
1314
1303
|
}
|
|
@@ -1316,12 +1305,12 @@ class Ui extends it {
|
|
|
1316
1305
|
const i = Lt({
|
|
1317
1306
|
nodes: t,
|
|
1318
1307
|
setPointWidth: e
|
|
1319
|
-
}), s = this.object3d,
|
|
1320
|
-
s.geometry = i,
|
|
1308
|
+
}), s = this.object3d, n = s.geometry;
|
|
1309
|
+
s.geometry = i, n.dispose();
|
|
1321
1310
|
}
|
|
1322
1311
|
getMaterial(t) {
|
|
1323
1312
|
const { width: e, height: i } = this.pencil.getSize();
|
|
1324
|
-
return new ii(
|
|
1313
|
+
return new ii(V({
|
|
1325
1314
|
color: new y.Color("#ffffff"),
|
|
1326
1315
|
resolution: new y.Vector2(e, i)
|
|
1327
1316
|
}, t));
|
|
@@ -1347,8 +1336,8 @@ class Ui extends it {
|
|
|
1347
1336
|
delay: e = 0,
|
|
1348
1337
|
repeat: i = 0,
|
|
1349
1338
|
lineLoop: s,
|
|
1350
|
-
onRepeat:
|
|
1351
|
-
onUpdate:
|
|
1339
|
+
onRepeat: n,
|
|
1340
|
+
onUpdate: r,
|
|
1352
1341
|
onComplete: o
|
|
1353
1342
|
} = {}) {
|
|
1354
1343
|
const { offset: u, offsetLoop: c } = this.material.uniforms;
|
|
@@ -1358,9 +1347,9 @@ class Ui extends it {
|
|
|
1358
1347
|
u.value.x = 1, c.value = 0;
|
|
1359
1348
|
let h = 0;
|
|
1360
1349
|
const p = new at.Tween(u.value).to({ x: -1 }, t).delay(e).repeat(i).onUpdate(({ x: f }) => {
|
|
1361
|
-
l && f <= 0 && c.value === 0 && (c.value = 1),
|
|
1350
|
+
l && f <= 0 && c.value === 0 && (c.value = 1), r && r(f);
|
|
1362
1351
|
}).onRepeat(() => {
|
|
1363
|
-
h += 1,
|
|
1352
|
+
h += 1, n && n(h);
|
|
1364
1353
|
}).onComplete(() => {
|
|
1365
1354
|
o && o();
|
|
1366
1355
|
}).start();
|
|
@@ -1378,24 +1367,24 @@ function si(a, t) {
|
|
|
1378
1367
|
return a.map((e) => {
|
|
1379
1368
|
const i = [];
|
|
1380
1369
|
let s;
|
|
1381
|
-
return e.forEach((
|
|
1370
|
+
return e.forEach((n) => {
|
|
1382
1371
|
if (s) {
|
|
1383
|
-
const
|
|
1384
|
-
if (
|
|
1385
|
-
const o =
|
|
1372
|
+
const r = Ne(n, s) * 180 / Math.PI;
|
|
1373
|
+
if (r > t) {
|
|
1374
|
+
const o = Fe(s, n), u = 1 / Math.ceil(r / t);
|
|
1386
1375
|
let c = u;
|
|
1387
1376
|
for (; c < 1; )
|
|
1388
1377
|
i.push(o(c)), c += u;
|
|
1389
1378
|
}
|
|
1390
1379
|
}
|
|
1391
|
-
i.push(s =
|
|
1380
|
+
i.push(s = n);
|
|
1392
1381
|
}), i;
|
|
1393
1382
|
});
|
|
1394
1383
|
}
|
|
1395
|
-
function
|
|
1396
|
-
const
|
|
1384
|
+
function ni(a, { minLng: t, maxLng: e, minLat: i, maxLat: s } = {}) {
|
|
1385
|
+
const n = Math.round(Jt(360 / a, 2) / Math.PI), r = (1 + Math.sqrt(5)) / 2, o = (f) => f / r * 360 % 360 - 180, u = (f) => Math.acos(2 * f / n - 1) / Math.PI * 180 - 90, c = (f) => n * (Math.cos((f + 90) * Math.PI / 180) + 1) / 2, l = [
|
|
1397
1386
|
s !== void 0 ? Math.ceil(c(s)) : 0,
|
|
1398
|
-
i !== void 0 ? Math.floor(c(i)) :
|
|
1387
|
+
i !== void 0 ? Math.floor(c(i)) : n - 1
|
|
1399
1388
|
], h = t === void 0 && e === void 0 ? () => !0 : t === void 0 ? (f) => f <= e : e === void 0 ? (f) => f >= t : e >= t ? (f) => f >= t && f <= e : (f) => f >= t || f <= e, p = [];
|
|
1400
1389
|
for (let f = l[0]; f <= l[1]; f++) {
|
|
1401
1390
|
const d = o(f);
|
|
@@ -1403,59 +1392,59 @@ function ri(a, { minLng: t, maxLng: e, minLat: i, maxLat: s } = {}) {
|
|
|
1403
1392
|
}
|
|
1404
1393
|
return p;
|
|
1405
1394
|
}
|
|
1406
|
-
function
|
|
1395
|
+
function It(a, t, e = !1) {
|
|
1407
1396
|
return e ? ke(t, a) : Oe(a, t);
|
|
1408
1397
|
}
|
|
1409
|
-
function
|
|
1410
|
-
const e = { type: "Polygon", coordinates: a }, [[i, s], [
|
|
1411
|
-
if (Math.min(Math.abs(
|
|
1398
|
+
function ri(a, t) {
|
|
1399
|
+
const e = { type: "Polygon", coordinates: a }, [[i, s], [n, r]] = pe(e);
|
|
1400
|
+
if (Math.min(Math.abs(n - i), Math.abs(r - s)) < t)
|
|
1412
1401
|
return [];
|
|
1413
|
-
const o = i >
|
|
1414
|
-
return
|
|
1402
|
+
const o = i > n || r >= 89 || s <= -89;
|
|
1403
|
+
return ni(t, {
|
|
1415
1404
|
minLng: i,
|
|
1416
|
-
maxLng:
|
|
1405
|
+
maxLng: n,
|
|
1417
1406
|
minLat: s,
|
|
1418
|
-
maxLat:
|
|
1407
|
+
maxLat: r
|
|
1419
1408
|
}).filter(
|
|
1420
|
-
(u) =>
|
|
1409
|
+
(u) => It(u, e, o)
|
|
1421
1410
|
);
|
|
1422
1411
|
}
|
|
1423
1412
|
function oi(a, { resolution: t = 1 / 0, bbox: e } = {}) {
|
|
1424
|
-
const i = si(a, t), s =
|
|
1413
|
+
const i = si(a, t), s = Vt(i), n = ri(a, t), r = [...s, ...n], o = { type: "Polygon", coordinates: a }, [[u, c], [l, h]] = pe(o), p = u > l || // crosses antimeridian
|
|
1425
1414
|
h >= 89 || // crosses north pole
|
|
1426
1415
|
c <= -89;
|
|
1427
1416
|
let f = [];
|
|
1428
1417
|
if (p) {
|
|
1429
|
-
const C = He(
|
|
1430
|
-
|
|
1418
|
+
const C = He(r).triangles(), S = new Map(
|
|
1419
|
+
r.map(([T, W], I) => [`${T}-${W}`, I])
|
|
1431
1420
|
);
|
|
1432
1421
|
C.features.forEach((T) => {
|
|
1433
|
-
const W = T.geometry.coordinates[0].slice(0, 3).reverse(),
|
|
1422
|
+
const W = T.geometry.coordinates[0].slice(0, 3).reverse(), I = [];
|
|
1434
1423
|
if (W.forEach(([B, O]) => {
|
|
1435
|
-
const
|
|
1436
|
-
S.has(
|
|
1437
|
-
}),
|
|
1438
|
-
if (
|
|
1424
|
+
const F = `${B}-${O}`;
|
|
1425
|
+
S.has(F) && I.push(S.get(F));
|
|
1426
|
+
}), I.length === 3) {
|
|
1427
|
+
if (I.some((B) => B < s.length)) {
|
|
1439
1428
|
const B = T.properties.circumcenter;
|
|
1440
|
-
if (!
|
|
1429
|
+
if (!It(
|
|
1441
1430
|
B,
|
|
1442
1431
|
o,
|
|
1443
1432
|
p
|
|
1444
1433
|
))
|
|
1445
1434
|
return;
|
|
1446
1435
|
}
|
|
1447
|
-
f.push(...
|
|
1436
|
+
f.push(...I);
|
|
1448
1437
|
}
|
|
1449
1438
|
});
|
|
1450
|
-
} else if (
|
|
1451
|
-
const C = Re.from(
|
|
1439
|
+
} else if (n.length) {
|
|
1440
|
+
const C = Re.from(r);
|
|
1452
1441
|
for (let S = 0, T = C.triangles.length; S < T; S += 3) {
|
|
1453
|
-
const W = [2, 1, 0].map((B) => C.triangles[S + B]),
|
|
1442
|
+
const W = [2, 1, 0].map((B) => C.triangles[S + B]), I = W.map((B) => r[B]);
|
|
1454
1443
|
if (W.some((B) => B < s.length)) {
|
|
1455
1444
|
const B = [0, 1].map(
|
|
1456
|
-
(O) => ze(
|
|
1445
|
+
(O) => ze(I, (F) => F[O])
|
|
1457
1446
|
);
|
|
1458
|
-
if (!
|
|
1447
|
+
if (!It(
|
|
1459
1448
|
B,
|
|
1460
1449
|
o,
|
|
1461
1450
|
p
|
|
@@ -1469,29 +1458,29 @@ function oi(a, { resolution: t = 1 / 0, bbox: e } = {}) {
|
|
|
1469
1458
|
f = Bt(C, S, 2);
|
|
1470
1459
|
}
|
|
1471
1460
|
const d = Yt(
|
|
1472
|
-
e ? [e[0], e[2]] : Qt(
|
|
1461
|
+
e ? [e[0], e[2]] : Qt(r, (C) => C[0]),
|
|
1473
1462
|
[0, 1]
|
|
1474
1463
|
), m = Yt(
|
|
1475
|
-
e ? [e[1], e[3]] : Qt(
|
|
1464
|
+
e ? [e[1], e[3]] : Qt(r, (C) => C[1]),
|
|
1476
1465
|
[0, 1]
|
|
1477
|
-
), w =
|
|
1478
|
-
return { contour: i, triangles: { points:
|
|
1466
|
+
), w = r.map(([C, S]) => [d(C), m(S)]);
|
|
1467
|
+
return { contour: i, triangles: { points: r, indices: f, uvs: w } };
|
|
1479
1468
|
}
|
|
1480
1469
|
const ae = new y.BufferGeometry().setAttribute ? "setAttribute" : "addAttribute";
|
|
1481
1470
|
function bt(a, t, e, i) {
|
|
1482
1471
|
const s = a.map(
|
|
1483
|
-
(
|
|
1472
|
+
(n) => n.map(([r, o]) => {
|
|
1484
1473
|
if (i) {
|
|
1485
|
-
const [u, c] = i([
|
|
1474
|
+
const [u, c] = i([r, o]);
|
|
1486
1475
|
return [u, -c, t];
|
|
1487
1476
|
}
|
|
1488
|
-
return e ? Ue(
|
|
1477
|
+
return e ? Ue(r, o, t) : [r, o, t];
|
|
1489
1478
|
})
|
|
1490
1479
|
);
|
|
1491
1480
|
return Bt.flatten(s);
|
|
1492
1481
|
}
|
|
1493
1482
|
function ai(a, t, e, i, s) {
|
|
1494
|
-
const { vertices:
|
|
1483
|
+
const { vertices: n, holes: r } = bt(
|
|
1495
1484
|
a,
|
|
1496
1485
|
t,
|
|
1497
1486
|
i,
|
|
@@ -1501,7 +1490,7 @@ function ai(a, t, e, i, s) {
|
|
|
1501
1490
|
e,
|
|
1502
1491
|
i,
|
|
1503
1492
|
s
|
|
1504
|
-
), u =
|
|
1493
|
+
), u = Vt([o, n]), c = Math.round(o.length / 3), l = new Set(r);
|
|
1505
1494
|
let h = 0;
|
|
1506
1495
|
const p = [];
|
|
1507
1496
|
for (let d = 0; d < c; d++) {
|
|
@@ -1519,14 +1508,14 @@ function ai(a, t, e, i, s) {
|
|
|
1519
1508
|
for (let m = 0; m < c; m += 1) f.push(m / (c - 1), d);
|
|
1520
1509
|
return { indices: p, vertices: u, uvs: f, topVerts: o };
|
|
1521
1510
|
}
|
|
1522
|
-
function le(a, t, e, i, s,
|
|
1511
|
+
function le(a, t, e, i, s, n) {
|
|
1523
1512
|
return {
|
|
1524
1513
|
indices: i ? a.indices : a.indices.slice().reverse(),
|
|
1525
1514
|
vertices: bt(
|
|
1526
1515
|
[a.points],
|
|
1527
1516
|
t,
|
|
1528
1517
|
s,
|
|
1529
|
-
|
|
1518
|
+
n
|
|
1530
1519
|
).vertices,
|
|
1531
1520
|
uvs: e
|
|
1532
1521
|
};
|
|
@@ -1537,8 +1526,8 @@ const li = ({
|
|
|
1537
1526
|
endHeight: e,
|
|
1538
1527
|
curvatureResolution: i = 1,
|
|
1539
1528
|
cartesian: s = !0,
|
|
1540
|
-
hasSide:
|
|
1541
|
-
hasBottom:
|
|
1529
|
+
hasSide: n = !0,
|
|
1530
|
+
hasBottom: r = !1,
|
|
1542
1531
|
hasTop: o = !1,
|
|
1543
1532
|
projection: u,
|
|
1544
1533
|
bbox: c
|
|
@@ -1551,7 +1540,7 @@ const li = ({
|
|
|
1551
1540
|
bbox: c
|
|
1552
1541
|
});
|
|
1553
1542
|
let p = {}, f;
|
|
1554
|
-
|
|
1543
|
+
n && (p = ai(
|
|
1555
1544
|
l,
|
|
1556
1545
|
t != null ? t : e,
|
|
1557
1546
|
e != null ? e : t,
|
|
@@ -1559,9 +1548,9 @@ const li = ({
|
|
|
1559
1548
|
u
|
|
1560
1549
|
), f = p.topVerts);
|
|
1561
1550
|
let d = [];
|
|
1562
|
-
(
|
|
1551
|
+
(r || o) && (d = Vt(h.uvs));
|
|
1563
1552
|
let m = {};
|
|
1564
|
-
|
|
1553
|
+
r && (m = le(
|
|
1565
1554
|
h,
|
|
1566
1555
|
t,
|
|
1567
1556
|
d,
|
|
@@ -1581,7 +1570,7 @@ const li = ({
|
|
|
1581
1570
|
};
|
|
1582
1571
|
class ui extends y.BufferGeometry {
|
|
1583
1572
|
constructor(t, e = {}) {
|
|
1584
|
-
super(), this.type = "PolygonBufferGeometry", this.parameters =
|
|
1573
|
+
super(), this.type = "PolygonBufferGeometry", this.parameters = V({
|
|
1585
1574
|
polygonGeoJson: t,
|
|
1586
1575
|
startHeight: 0,
|
|
1587
1576
|
endHeight: 1,
|
|
@@ -1595,41 +1584,41 @@ class ui extends y.BufferGeometry {
|
|
|
1595
1584
|
const {
|
|
1596
1585
|
endHeight: i,
|
|
1597
1586
|
hasTop: s,
|
|
1598
|
-
hasBottom:
|
|
1599
|
-
hasSide:
|
|
1587
|
+
hasBottom: n,
|
|
1588
|
+
hasSide: r,
|
|
1600
1589
|
cartesian: o,
|
|
1601
1590
|
userDataRsoOffset: u,
|
|
1602
1591
|
projection: c
|
|
1603
|
-
} = this.parameters, { contour: l, sideTorso: h, topVerts: p, bottomCap: f, topCap: d } = li(
|
|
1592
|
+
} = this.parameters, { contour: l, sideTorso: h, topVerts: p, bottomCap: f, topCap: d } = li(V({}, this.parameters));
|
|
1604
1593
|
let m = [], w = [], P = [], C = 0;
|
|
1605
1594
|
const S = (T) => {
|
|
1606
|
-
const W = Math.round(m.length / 3),
|
|
1595
|
+
const W = Math.round(m.length / 3), I = P.length;
|
|
1607
1596
|
m = m.concat(T.vertices), w = w.concat(T.uvs), P = P.concat(
|
|
1608
1597
|
W ? T.indices.map((B) => B + W) : T.indices
|
|
1609
|
-
), this.addGroup(
|
|
1598
|
+
), this.addGroup(I, P.length - I, C++);
|
|
1610
1599
|
};
|
|
1611
|
-
|
|
1600
|
+
r && (S(h), this.userData.topVerts = u ? bt(
|
|
1612
1601
|
l,
|
|
1613
1602
|
i + u,
|
|
1614
1603
|
o,
|
|
1615
1604
|
c
|
|
1616
|
-
).vertices : p),
|
|
1605
|
+
).vertices : p), n && S(f), s && S(d), this.setIndex(P), this[ae](
|
|
1617
1606
|
"position",
|
|
1618
1607
|
new y.Float32BufferAttribute(m, 3)
|
|
1619
1608
|
), this[ae]("uv", new y.Float32BufferAttribute(w, 2)), this.computeVertexNormals();
|
|
1620
1609
|
}
|
|
1621
1610
|
}
|
|
1622
1611
|
const ue = (a) => {
|
|
1623
|
-
const o = a, { coordinate: t, startHeight: e, height: i } = o, s =
|
|
1624
|
-
let
|
|
1625
|
-
return typeof e != "undefined" && typeof i != "undefined" && (
|
|
1612
|
+
const o = a, { coordinate: t, startHeight: e, height: i } = o, s = At(o, ["coordinate", "startHeight", "height"]);
|
|
1613
|
+
let n = e || 0;
|
|
1614
|
+
return typeof e != "undefined" && typeof i != "undefined" && (n = e + i), new ui([t], Mt(V({}, s), {
|
|
1626
1615
|
startHeight: e,
|
|
1627
|
-
endHeight:
|
|
1616
|
+
endHeight: n
|
|
1628
1617
|
}));
|
|
1629
1618
|
};
|
|
1630
1619
|
class Wi extends it {
|
|
1631
1620
|
constructor(t) {
|
|
1632
|
-
super(), this.options =
|
|
1621
|
+
super(), this.options = V({}, t);
|
|
1633
1622
|
}
|
|
1634
1623
|
create() {
|
|
1635
1624
|
const u = this.options, {
|
|
@@ -1637,8 +1626,8 @@ class Wi extends it {
|
|
|
1637
1626
|
coordinateArr: e,
|
|
1638
1627
|
coordinate: i,
|
|
1639
1628
|
material: s,
|
|
1640
|
-
useGroups:
|
|
1641
|
-
} = u,
|
|
1629
|
+
useGroups: n
|
|
1630
|
+
} = u, r = At(u, [
|
|
1642
1631
|
"geometry",
|
|
1643
1632
|
"coordinateArr",
|
|
1644
1633
|
"coordinate",
|
|
@@ -1647,25 +1636,25 @@ class Wi extends it {
|
|
|
1647
1636
|
]);
|
|
1648
1637
|
let o = t;
|
|
1649
1638
|
if (!o && i)
|
|
1650
|
-
o = ue(
|
|
1639
|
+
o = ue(V({
|
|
1651
1640
|
coordinate: i
|
|
1652
|
-
},
|
|
1641
|
+
}, r));
|
|
1653
1642
|
else if (!o && e) {
|
|
1654
1643
|
const c = e.map(
|
|
1655
|
-
(l) => ue(
|
|
1644
|
+
(l) => ue(V({
|
|
1656
1645
|
coordinate: l
|
|
1657
|
-
},
|
|
1646
|
+
}, r))
|
|
1658
1647
|
);
|
|
1659
1648
|
o = et(
|
|
1660
1649
|
c,
|
|
1661
|
-
|
|
1650
|
+
n != null ? n : 0
|
|
1662
1651
|
);
|
|
1663
1652
|
}
|
|
1664
1653
|
this.createMesh(o, s);
|
|
1665
1654
|
}
|
|
1666
1655
|
}
|
|
1667
|
-
class
|
|
1668
|
-
constructor(t = new
|
|
1656
|
+
class Et extends he {
|
|
1657
|
+
constructor(t = new Ie([
|
|
1669
1658
|
new U(0.5, 0.5),
|
|
1670
1659
|
new U(-0.5, 0.5),
|
|
1671
1660
|
new U(-0.5, -0.5),
|
|
@@ -1675,19 +1664,19 @@ class Vt extends he {
|
|
|
1675
1664
|
shapes: t,
|
|
1676
1665
|
options: e
|
|
1677
1666
|
}, t = Array.isArray(t) ? t : [t];
|
|
1678
|
-
const i = this, s = [],
|
|
1667
|
+
const i = this, s = [], n = [];
|
|
1679
1668
|
for (let o = 0, u = t.length; o < u; o++) {
|
|
1680
1669
|
const c = t[o];
|
|
1681
|
-
|
|
1670
|
+
r(c);
|
|
1682
1671
|
}
|
|
1683
|
-
this.setAttribute("position", new Kt(s, 3)), this.setAttribute("uv", new Kt(
|
|
1684
|
-
function
|
|
1672
|
+
this.setAttribute("position", new Kt(s, 3)), this.setAttribute("uv", new Kt(n, 2)), this.computeVertexNormals();
|
|
1673
|
+
function r(o) {
|
|
1685
1674
|
var Wt, Dt, Rt;
|
|
1686
1675
|
const u = [], c = e.curveSegments !== void 0 ? e.curveSegments : 12, l = e.steps !== void 0 ? e.steps : 1, h = e.depth !== void 0 ? e.depth : 1;
|
|
1687
1676
|
let p = e.bevelEnabled !== void 0 ? e.bevelEnabled : !0, f = e.bevelThickness !== void 0 ? e.bevelThickness : 0.2, d = e.bevelSize !== void 0 ? e.bevelSize : f - 0.1, m = e.bevelOffset !== void 0 ? e.bevelOffset : 0, w = e.bevelSegments !== void 0 ? e.bevelSegments : 3;
|
|
1688
1677
|
const P = e.extrudePath, C = e.UVGenerator !== void 0 ? e.UVGenerator : ci, S = (Wt = e.hasTop) != null ? Wt : !0, T = (Dt = e.hasBottom) != null ? Dt : !0, W = (Rt = e.hasSide) != null ? Rt : !0;
|
|
1689
|
-
let
|
|
1690
|
-
P && (
|
|
1678
|
+
let I, B = !1, O, F, lt, J;
|
|
1679
|
+
P && (I = P.getSpacedPoints(l), B = !0, p = !1, O = P.computeFrenetFrames(l, !1), F = new N(), lt = new N(), J = new N()), p || (w = 0, f = 0, d = 0, m = 0);
|
|
1691
1680
|
const Gt = o.extractPoints(c);
|
|
1692
1681
|
let k = Gt.shape;
|
|
1693
1682
|
const R = Gt.holes;
|
|
@@ -1708,76 +1697,76 @@ class Vt extends he {
|
|
|
1708
1697
|
}
|
|
1709
1698
|
const X = k.length, ft = ut.length;
|
|
1710
1699
|
function zt(g, v, b) {
|
|
1711
|
-
let
|
|
1712
|
-
const _ = g.x - v.x, L = g.y - v.y, D = b.x - g.x,
|
|
1700
|
+
let M, x, A;
|
|
1701
|
+
const _ = g.x - v.x, L = g.y - v.y, D = b.x - g.x, E = b.y - g.y, ct = _ * _ + L * L, wt = _ * E - L * D;
|
|
1713
1702
|
if (Math.abs(wt) > Number.EPSILON) {
|
|
1714
1703
|
const tt = Math.sqrt(ct), Ot = Math.sqrt(
|
|
1715
|
-
D * D +
|
|
1716
|
-
), kt = v.x - L / tt,
|
|
1717
|
-
|
|
1718
|
-
const Ht =
|
|
1704
|
+
D * D + E * E
|
|
1705
|
+
), kt = v.x - L / tt, Nt = v.y + _ / tt, ve = b.x - E / Ot, be = b.y + D / Ot, Ft = ((ve - kt) * E - (be - Nt) * D) / (_ * E - L * D);
|
|
1706
|
+
M = kt + _ * Ft - g.x, x = Nt + L * Ft - g.y;
|
|
1707
|
+
const Ht = M * M + x * x;
|
|
1719
1708
|
if (Ht <= 2)
|
|
1720
|
-
return new U(
|
|
1721
|
-
|
|
1709
|
+
return new U(M, x);
|
|
1710
|
+
A = Math.sqrt(Ht / 2);
|
|
1722
1711
|
} else {
|
|
1723
1712
|
let tt = !1;
|
|
1724
|
-
_ > Number.EPSILON ? D > Number.EPSILON && (tt = !0) : _ < -Number.EPSILON ? D < -Number.EPSILON && (tt = !0) : Math.sign(L) === Math.sign(
|
|
1713
|
+
_ > Number.EPSILON ? D > Number.EPSILON && (tt = !0) : _ < -Number.EPSILON ? D < -Number.EPSILON && (tt = !0) : Math.sign(L) === Math.sign(E) && (tt = !0), tt ? (M = -L, x = _, A = Math.sqrt(ct)) : (M = _, x = L, A = Math.sqrt(ct / 2));
|
|
1725
1714
|
}
|
|
1726
|
-
return new U(
|
|
1715
|
+
return new U(M / A, x / A);
|
|
1727
1716
|
}
|
|
1728
1717
|
const pt = [];
|
|
1729
|
-
for (let g = 0, v = H.length, b = v - 1,
|
|
1730
|
-
b === v && (b = 0),
|
|
1718
|
+
for (let g = 0, v = H.length, b = v - 1, M = g + 1; g < v; g++, b++, M++)
|
|
1719
|
+
b === v && (b = 0), M === v && (M = 0), pt[g] = zt(H[g], H[b], H[M]);
|
|
1731
1720
|
const xt = [];
|
|
1732
1721
|
let st, dt = pt.concat();
|
|
1733
1722
|
for (let g = 0, v = R.length; g < v; g++) {
|
|
1734
1723
|
const b = R[g];
|
|
1735
1724
|
st = [];
|
|
1736
|
-
for (let
|
|
1737
|
-
|
|
1725
|
+
for (let M = 0, x = b.length, A = x - 1, _ = M + 1; M < x; M++, A++, _++)
|
|
1726
|
+
A === x && (A = 0), _ === x && (_ = 0), st[M] = zt(b[M], b[A], b[_]);
|
|
1738
1727
|
xt.push(st), dt = dt.concat(st);
|
|
1739
1728
|
}
|
|
1740
1729
|
for (let g = 0; g < w; g++) {
|
|
1741
|
-
const v = g / w, b = f * Math.cos(v * Math.PI / 2),
|
|
1742
|
-
for (let x = 0,
|
|
1743
|
-
const _ = ot(H[x], pt[x],
|
|
1730
|
+
const v = g / w, b = f * Math.cos(v * Math.PI / 2), M = d * Math.sin(v * Math.PI / 2) + m;
|
|
1731
|
+
for (let x = 0, A = H.length; x < A; x++) {
|
|
1732
|
+
const _ = ot(H[x], pt[x], M);
|
|
1744
1733
|
K(_.x, _.y, -b);
|
|
1745
1734
|
}
|
|
1746
|
-
for (let x = 0,
|
|
1735
|
+
for (let x = 0, A = R.length; x < A; x++) {
|
|
1747
1736
|
const _ = R[x];
|
|
1748
1737
|
st = xt[x];
|
|
1749
1738
|
for (let L = 0, D = _.length; L < D; L++) {
|
|
1750
|
-
const
|
|
1751
|
-
K(
|
|
1739
|
+
const E = ot(_[L], st[L], M);
|
|
1740
|
+
K(E.x, E.y, -b);
|
|
1752
1741
|
}
|
|
1753
1742
|
}
|
|
1754
1743
|
}
|
|
1755
1744
|
const jt = d + m;
|
|
1756
1745
|
for (let g = 0; g < X; g++) {
|
|
1757
1746
|
const v = p ? ot(k[g], dt[g], jt) : k[g];
|
|
1758
|
-
B ? (lt.copy(O.normals[0]).multiplyScalar(v.x),
|
|
1747
|
+
B ? (lt.copy(O.normals[0]).multiplyScalar(v.x), F.copy(O.binormals[0]).multiplyScalar(v.y), J.copy(I[0]).add(lt).add(F), K(J.x, J.y, J.z)) : K(v.x, v.y, 0);
|
|
1759
1748
|
}
|
|
1760
1749
|
for (let g = 1; g <= l; g++)
|
|
1761
1750
|
for (let v = 0; v < X; v++) {
|
|
1762
1751
|
const b = p ? ot(k[v], dt[v], jt) : k[v];
|
|
1763
|
-
B ? (lt.copy(O.normals[g]).multiplyScalar(b.x),
|
|
1752
|
+
B ? (lt.copy(O.normals[g]).multiplyScalar(b.x), F.copy(O.binormals[g]).multiplyScalar(b.y), J.copy(I[g]).add(lt).add(F), K(J.x, J.y, J.z)) : K(b.x, b.y, h / l * g);
|
|
1764
1753
|
}
|
|
1765
1754
|
for (let g = w - 1; g >= 0; g--) {
|
|
1766
|
-
const v = g / w, b = f * Math.cos(v * Math.PI / 2),
|
|
1767
|
-
for (let x = 0,
|
|
1768
|
-
const _ = ot(H[x], pt[x],
|
|
1755
|
+
const v = g / w, b = f * Math.cos(v * Math.PI / 2), M = d * Math.sin(v * Math.PI / 2) + m;
|
|
1756
|
+
for (let x = 0, A = H.length; x < A; x++) {
|
|
1757
|
+
const _ = ot(H[x], pt[x], M);
|
|
1769
1758
|
K(_.x, _.y, h + b);
|
|
1770
1759
|
}
|
|
1771
|
-
for (let x = 0,
|
|
1760
|
+
for (let x = 0, A = R.length; x < A; x++) {
|
|
1772
1761
|
const _ = R[x];
|
|
1773
1762
|
st = xt[x];
|
|
1774
1763
|
for (let L = 0, D = _.length; L < D; L++) {
|
|
1775
|
-
const
|
|
1764
|
+
const E = ot(_[L], st[L], M);
|
|
1776
1765
|
B ? K(
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
) : K(
|
|
1766
|
+
E.x,
|
|
1767
|
+
E.y + I[l - 1].y,
|
|
1768
|
+
I[l - 1].x + b
|
|
1769
|
+
) : K(E.x, E.y, h + b);
|
|
1781
1770
|
}
|
|
1782
1771
|
}
|
|
1783
1772
|
}
|
|
@@ -1787,13 +1776,13 @@ class Vt extends he {
|
|
|
1787
1776
|
if (p) {
|
|
1788
1777
|
let v = 0, b = X * v;
|
|
1789
1778
|
if (T)
|
|
1790
|
-
for (let
|
|
1791
|
-
const x = ut[
|
|
1779
|
+
for (let M = 0; M < ft; M++) {
|
|
1780
|
+
const x = ut[M];
|
|
1792
1781
|
mt(x[2] + b, x[1] + b, x[0] + b);
|
|
1793
1782
|
}
|
|
1794
1783
|
if (v = l + w * 2, b = X * v, S)
|
|
1795
|
-
for (let
|
|
1796
|
-
const x = ut[
|
|
1784
|
+
for (let M = 0; M < ft; M++) {
|
|
1785
|
+
const x = ut[M];
|
|
1797
1786
|
mt(x[0] + b, x[1] + b, x[2] + b);
|
|
1798
1787
|
}
|
|
1799
1788
|
} else {
|
|
@@ -1818,7 +1807,7 @@ class Vt extends he {
|
|
|
1818
1807
|
const g = s.length / 3;
|
|
1819
1808
|
let v = 0;
|
|
1820
1809
|
Ut(H, v), v += H.length;
|
|
1821
|
-
for (let b = 0,
|
|
1810
|
+
for (let b = 0, M = R.length; b < M; b++) {
|
|
1822
1811
|
const x = R[b];
|
|
1823
1812
|
Ut(x, v), v += x.length;
|
|
1824
1813
|
}
|
|
@@ -1827,12 +1816,12 @@ class Vt extends he {
|
|
|
1827
1816
|
function Ut(g, v) {
|
|
1828
1817
|
let b = g.length;
|
|
1829
1818
|
for (; --b >= 0; ) {
|
|
1830
|
-
const
|
|
1819
|
+
const M = b;
|
|
1831
1820
|
let x = b - 1;
|
|
1832
1821
|
x < 0 && (x = g.length - 1);
|
|
1833
|
-
for (let
|
|
1834
|
-
const L = X *
|
|
1835
|
-
ye(
|
|
1822
|
+
for (let A = 0, _ = l + w * 2; A < _; A++) {
|
|
1823
|
+
const L = X * A, D = X * (A + 1), E = v + M + L, ct = v + x + L, wt = v + x + D, tt = v + M + D;
|
|
1824
|
+
ye(E, ct, wt, tt);
|
|
1836
1825
|
}
|
|
1837
1826
|
}
|
|
1838
1827
|
}
|
|
@@ -1841,18 +1830,18 @@ class Vt extends he {
|
|
|
1841
1830
|
}
|
|
1842
1831
|
function mt(g, v, b) {
|
|
1843
1832
|
Q(g), Q(v), Q(b);
|
|
1844
|
-
const
|
|
1833
|
+
const M = s.length / 3, x = C.generateTopUV(
|
|
1845
1834
|
i,
|
|
1846
1835
|
s,
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1836
|
+
M - 3,
|
|
1837
|
+
M - 2,
|
|
1838
|
+
M - 1
|
|
1850
1839
|
);
|
|
1851
1840
|
Y(x[0]), Y(x[1]), Y(x[2]);
|
|
1852
1841
|
}
|
|
1853
|
-
function ye(g, v, b,
|
|
1854
|
-
Q(g), Q(v), Q(
|
|
1855
|
-
const x = s.length / 3,
|
|
1842
|
+
function ye(g, v, b, M) {
|
|
1843
|
+
Q(g), Q(v), Q(M), Q(v), Q(b), Q(M);
|
|
1844
|
+
const x = s.length / 3, A = C.generateSideWallUV(
|
|
1856
1845
|
i,
|
|
1857
1846
|
s,
|
|
1858
1847
|
x - 6,
|
|
@@ -1860,13 +1849,13 @@ class Vt extends he {
|
|
|
1860
1849
|
x - 2,
|
|
1861
1850
|
x - 1
|
|
1862
1851
|
);
|
|
1863
|
-
Y(
|
|
1852
|
+
Y(A[0]), Y(A[1]), Y(A[3]), Y(A[1]), Y(A[2]), Y(A[3]);
|
|
1864
1853
|
}
|
|
1865
1854
|
function Q(g) {
|
|
1866
1855
|
s.push(u[g * 3 + 0]), s.push(u[g * 3 + 1]), s.push(u[g * 3 + 2]);
|
|
1867
1856
|
}
|
|
1868
1857
|
function Y(g) {
|
|
1869
|
-
|
|
1858
|
+
n.push(g.x), n.push(g.y);
|
|
1870
1859
|
}
|
|
1871
1860
|
}
|
|
1872
1861
|
}
|
|
@@ -1879,27 +1868,27 @@ class Vt extends he {
|
|
|
1879
1868
|
}
|
|
1880
1869
|
static fromJSON(t, e) {
|
|
1881
1870
|
const i = [];
|
|
1882
|
-
for (let
|
|
1883
|
-
const o = e[t.shapes[
|
|
1871
|
+
for (let n = 0, r = t.shapes.length; n < r; n++) {
|
|
1872
|
+
const o = e[t.shapes[n]];
|
|
1884
1873
|
i.push(o);
|
|
1885
1874
|
}
|
|
1886
1875
|
const s = t.options.extrudePath;
|
|
1887
|
-
return console.log(s.type), s !== void 0 && (t.options.extrudePath = new y[`${s.type}Curve`]().fromJSON(s)), new
|
|
1876
|
+
return console.log(s.type), s !== void 0 && (t.options.extrudePath = new y[`${s.type}Curve`]().fromJSON(s)), new Et(i, t.options);
|
|
1888
1877
|
}
|
|
1889
1878
|
}
|
|
1890
1879
|
const ci = {
|
|
1891
1880
|
generateTopUV: function(a, t, e, i, s) {
|
|
1892
|
-
const
|
|
1881
|
+
const n = t[e * 3], r = t[e * 3 + 1], o = t[i * 3], u = t[i * 3 + 1], c = t[s * 3], l = t[s * 3 + 1];
|
|
1893
1882
|
return [
|
|
1894
|
-
new U(
|
|
1883
|
+
new U(n, r),
|
|
1895
1884
|
new U(o, u),
|
|
1896
1885
|
new U(c, l)
|
|
1897
1886
|
];
|
|
1898
1887
|
},
|
|
1899
|
-
generateSideWallUV: function(a, t, e, i, s,
|
|
1900
|
-
const
|
|
1901
|
-
return Math.abs(o - l) < Math.abs(
|
|
1902
|
-
new U(
|
|
1888
|
+
generateSideWallUV: function(a, t, e, i, s, n) {
|
|
1889
|
+
const r = t[e * 3], o = t[e * 3 + 1], u = t[e * 3 + 2], c = t[i * 3], l = t[i * 3 + 1], h = t[i * 3 + 2], p = t[s * 3], f = t[s * 3 + 1], d = t[s * 3 + 2], m = t[n * 3], w = t[n * 3 + 1], P = t[n * 3 + 2];
|
|
1890
|
+
return Math.abs(o - l) < Math.abs(r - c) ? [
|
|
1891
|
+
new U(r, 1 - u),
|
|
1903
1892
|
new U(c, 1 - h),
|
|
1904
1893
|
new U(p, 1 - d),
|
|
1905
1894
|
new U(m, 1 - P)
|
|
@@ -1914,15 +1903,15 @@ const ci = {
|
|
|
1914
1903
|
function hi(a, t, e) {
|
|
1915
1904
|
if (e.shapes = [], Array.isArray(a))
|
|
1916
1905
|
for (let i = 0, s = a.length; i < s; i++) {
|
|
1917
|
-
const
|
|
1918
|
-
e.shapes.push(
|
|
1906
|
+
const n = a[i];
|
|
1907
|
+
e.shapes.push(n.uuid);
|
|
1919
1908
|
}
|
|
1920
1909
|
else
|
|
1921
1910
|
e.shapes.push(a.uuid);
|
|
1922
1911
|
return e.options = Object.assign({}, t), t.extrudePath !== void 0 && (e.options.extrudePath = t.extrudePath.toJSON()), e;
|
|
1923
1912
|
}
|
|
1924
1913
|
const ce = (a) => {
|
|
1925
|
-
const { split: t, depth: e, points: i, box3: s, hasTop:
|
|
1914
|
+
const { split: t, depth: e, points: i, box3: s, hasTop: n, hasBottom: r, hasSide: o, sideRepeat: u } = a, c = new Et(new y.Shape(i), {
|
|
1926
1915
|
depth: e,
|
|
1927
1916
|
bevelEnabled: !1,
|
|
1928
1917
|
UVGenerator: We({
|
|
@@ -1930,27 +1919,27 @@ const ce = (a) => {
|
|
|
1930
1919
|
box3: s,
|
|
1931
1920
|
sideRepeat: u
|
|
1932
1921
|
}),
|
|
1933
|
-
hasTop:
|
|
1934
|
-
hasBottom:
|
|
1922
|
+
hasTop: n,
|
|
1923
|
+
hasBottom: r,
|
|
1935
1924
|
hasSide: o
|
|
1936
1925
|
});
|
|
1937
1926
|
return De(), c;
|
|
1938
1927
|
};
|
|
1939
1928
|
class Di extends it {
|
|
1940
1929
|
constructor(t) {
|
|
1941
|
-
super(), this.options =
|
|
1930
|
+
super(), this.options = V({
|
|
1942
1931
|
depth: 1
|
|
1943
1932
|
}, t);
|
|
1944
1933
|
}
|
|
1945
1934
|
create() {
|
|
1946
|
-
return
|
|
1935
|
+
return nt(this, null, function* () {
|
|
1947
1936
|
const {
|
|
1948
1937
|
points: t,
|
|
1949
1938
|
pointsArr: e,
|
|
1950
1939
|
useGroups: i,
|
|
1951
1940
|
depth: s,
|
|
1952
|
-
geometry:
|
|
1953
|
-
geometryArr:
|
|
1941
|
+
geometry: n,
|
|
1942
|
+
geometryArr: r,
|
|
1954
1943
|
material: o,
|
|
1955
1944
|
box3: u,
|
|
1956
1945
|
split: c,
|
|
@@ -1958,7 +1947,7 @@ class Di extends it {
|
|
|
1958
1947
|
hasBottom: h,
|
|
1959
1948
|
hasSide: p
|
|
1960
1949
|
} = this.options, f = Array.isArray(s) ? s : [s], d = Array.isArray(u) ? u : [u], m = o;
|
|
1961
|
-
let w =
|
|
1950
|
+
let w = n;
|
|
1962
1951
|
m || console.log("material is null"), !w && t ? w = ce({
|
|
1963
1952
|
points: t,
|
|
1964
1953
|
depth: f[0],
|
|
@@ -1983,10 +1972,10 @@ class Di extends it {
|
|
|
1983
1972
|
}
|
|
1984
1973
|
),
|
|
1985
1974
|
i != null ? i : 0
|
|
1986
|
-
) : !w &&
|
|
1987
|
-
|
|
1975
|
+
) : !w && r && r.length > 1 ? w = et(
|
|
1976
|
+
r,
|
|
1988
1977
|
i != null ? i : 0
|
|
1989
|
-
) : !w &&
|
|
1978
|
+
) : !w && r && r.length === 1 && ([w] = r), this.createMesh(w, m);
|
|
1990
1979
|
});
|
|
1991
1980
|
}
|
|
1992
1981
|
addGeometries(t) {
|
|
@@ -2006,8 +1995,8 @@ const Ri = (a) => {
|
|
|
2006
1995
|
sideColor: e,
|
|
2007
1996
|
sideMap: i,
|
|
2008
1997
|
createCanvasObjectURL: s,
|
|
2009
|
-
split:
|
|
2010
|
-
maxAnisotropy:
|
|
1998
|
+
split: n,
|
|
1999
|
+
maxAnisotropy: r
|
|
2011
2000
|
} = a;
|
|
2012
2001
|
return new Promise((o) => {
|
|
2013
2002
|
const u = i ? document.createElement("img") : {
|
|
@@ -2018,7 +2007,7 @@ const Ri = (a) => {
|
|
|
2018
2007
|
height: 128
|
|
2019
2008
|
};
|
|
2020
2009
|
u.onload = () => {
|
|
2021
|
-
const c =
|
|
2010
|
+
const c = n, l = document.createElement("canvas"), h = l.getContext("2d");
|
|
2022
2011
|
l.height = u.height / (1 - c), l.width = u.width, c && t && (h.fillStyle = t, h.fillRect(0, 0, u.width, l.height * c)), i && u instanceof HTMLImageElement ? h.drawImage(u, 0, l.height * c, u.width, u.height) : e && (h.fillStyle = e, h.fillRect(0, l.height * c, u.width, u.height)), s && l.toBlob((f) => {
|
|
2023
2012
|
console.log(URL.createObjectURL(f));
|
|
2024
2013
|
});
|
|
@@ -2030,9 +2019,9 @@ const Ri = (a) => {
|
|
|
2030
2019
|
export {
|
|
2031
2020
|
Wi as ConicPolygon,
|
|
2032
2021
|
Di as ExtrudePolygon,
|
|
2033
|
-
|
|
2022
|
+
Ni as Group,
|
|
2034
2023
|
qe as Image,
|
|
2035
|
-
|
|
2024
|
+
Ei as Light,
|
|
2036
2025
|
Ui as Line,
|
|
2037
2026
|
Gi as Line2,
|
|
2038
2027
|
qi as Line2Material,
|
|
@@ -2040,8 +2029,8 @@ export {
|
|
|
2040
2029
|
Ye as MeshLineGeometry,
|
|
2041
2030
|
ii as MeshLineMaterial,
|
|
2042
2031
|
ji as MeshLineRaycast,
|
|
2043
|
-
|
|
2044
|
-
|
|
2032
|
+
Ii as Node,
|
|
2033
|
+
Vi as Pie,
|
|
2045
2034
|
Li as Text,
|
|
2046
2035
|
Bi as Video,
|
|
2047
2036
|
ui as getConicPolygonGeometry,
|