gl-draw 0.17.0-beta.35 → 0.17.0-beta.37
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/cartographicToCartesian.js +1 -0
- package/dist/cartographicToCartesian.module.js +49 -0
- package/dist/index.module2.js +412 -349
- package/dist/index2.js +5 -5
- package/dist/objects/conicPolygon/geometry/index.d.ts +1 -2
- package/dist/objects/ellipsoid/createGeometry.d.ts +30 -0
- package/dist/objects/ellipsoid/index.d.ts +38 -0
- package/dist/objects/index.d.ts +1 -0
- package/dist/objects/index.js +1 -1
- package/dist/objects/index.module.js +662 -619
- package/dist/plugins/Worker/getAttributes/conicLine.d.ts +1 -1
- package/dist/plugins/Worker/getAttributes/conicPolygon.d.ts +2 -3
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/index.module.js +36 -36
- package/dist/utils/Sprite2Points.d.ts +1 -1
- package/dist/utils/cartographicToCartesian.d.ts +30 -0
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.module.js +15 -13
- package/dist/utils/proposedRaycast.d.ts +1 -0
- package/package.json +1 -1
- package/dist/polar2Cartesian.js +0 -1
- package/dist/polar2Cartesian.module.js +0 -18
- package/dist/utils/polar2Cartesian.d.ts +0 -1
package/dist/index.module2.js
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var _e = Object.defineProperty, Ne = Object.defineProperties;
|
|
2
|
+
var Re = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var _ = Object.getOwnPropertySymbols;
|
|
4
|
+
var oe = Object.prototype.hasOwnProperty, ae = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var ce = Math.pow, re = (r, e, t) => e in r ? _e(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, k = (r, e) => {
|
|
6
6
|
for (var t in e || (e = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var t of
|
|
10
|
-
|
|
11
|
-
return
|
|
12
|
-
},
|
|
13
|
-
var
|
|
7
|
+
oe.call(e, t) && re(r, t, e[t]);
|
|
8
|
+
if (_)
|
|
9
|
+
for (var t of _(e))
|
|
10
|
+
ae.call(e, t) && re(r, t, e[t]);
|
|
11
|
+
return r;
|
|
12
|
+
}, X = (r, e) => Ne(r, Re(e));
|
|
13
|
+
var le = (r, e) => {
|
|
14
14
|
var t = {};
|
|
15
|
-
for (var i in
|
|
16
|
-
|
|
17
|
-
if (
|
|
18
|
-
for (var i of
|
|
19
|
-
e.indexOf(i) < 0 &&
|
|
15
|
+
for (var i in r)
|
|
16
|
+
oe.call(r, i) && e.indexOf(i) < 0 && (t[i] = r[i]);
|
|
17
|
+
if (r != null && _)
|
|
18
|
+
for (var i of _(r))
|
|
19
|
+
e.indexOf(i) < 0 && ae.call(r, i) && (t[i] = r[i]);
|
|
20
20
|
return t;
|
|
21
21
|
};
|
|
22
|
-
var
|
|
22
|
+
var ue = (r, e, t) => new Promise((i, s) => {
|
|
23
23
|
var o = (a) => {
|
|
24
24
|
try {
|
|
25
|
-
|
|
26
|
-
} catch (
|
|
27
|
-
s(
|
|
25
|
+
n(t.next(a));
|
|
26
|
+
} catch (h) {
|
|
27
|
+
s(h);
|
|
28
28
|
}
|
|
29
29
|
}, c = (a) => {
|
|
30
30
|
try {
|
|
31
|
-
|
|
32
|
-
} catch (
|
|
33
|
-
s(
|
|
31
|
+
n(t.throw(a));
|
|
32
|
+
} catch (h) {
|
|
33
|
+
s(h);
|
|
34
34
|
}
|
|
35
|
-
},
|
|
36
|
-
|
|
35
|
+
}, n = (a) => a.done ? i(a.value) : Promise.resolve(a.value).then(o, c);
|
|
36
|
+
n((t = t.apply(r, e)).next());
|
|
37
37
|
});
|
|
38
|
-
import { merge as
|
|
39
|
-
import
|
|
40
|
-
import { Material as
|
|
41
|
-
import
|
|
42
|
-
import { p as
|
|
43
|
-
import
|
|
44
|
-
import
|
|
45
|
-
import { geoBounds as
|
|
46
|
-
import { geoVoronoi as
|
|
47
|
-
import { scaleLinear as
|
|
48
|
-
import { LineSegmentsGeometry as
|
|
49
|
-
import { CSS2DObject as
|
|
50
|
-
import { CSS3DObject as
|
|
38
|
+
import { merge as ie, mean as Ue, extent as he } from "d3-array";
|
|
39
|
+
import Ge, { flatten as Oe } from "earcut";
|
|
40
|
+
import { Material as de, Object3D as G, Texture as fe, Vector3 as S, Matrix4 as De, Ray as $e, Sphere as ze, BufferGeometry as se, Float32BufferAttribute as $, PointsMaterial as Fe, Points as ne, InstancedMesh as Ee, Quaternion as qe, Group as Xe, Mesh as Le, Sprite as pe, Box3 as ke, ShaderMaterial as Ke, Vector2 as K, Color as me, Vector4 as V, Line3 as Qe, InstancedInterleavedBuffer as Ye, InterleavedBufferAttribute as ve, MathUtils as Ze } from "three";
|
|
41
|
+
import Je from "@turf/boolean-clockwise";
|
|
42
|
+
import { p as be, W as Q, c as ye } from "./cartographicToCartesian.module.js";
|
|
43
|
+
import He from "delaunator";
|
|
44
|
+
import et from "@turf/boolean-point-in-polygon";
|
|
45
|
+
import { geoBounds as Ve, geoContains as tt, geoDistance as it, geoInterpolate as st } from "d3-geo";
|
|
46
|
+
import { geoVoronoi as nt } from "d3-geo-voronoi";
|
|
47
|
+
import { scaleLinear as ge } from "d3-scale";
|
|
48
|
+
import { LineSegmentsGeometry as rt } from "three/examples/jsm/lines/LineSegmentsGeometry";
|
|
49
|
+
import { CSS2DObject as ot } from "three/examples/jsm/renderers/CSS2DRenderer";
|
|
50
|
+
import { CSS3DObject as at, CSS3DSprite as ct } from "three/examples/jsm/renderers/CSS3DRenderer";
|
|
51
51
|
import "d3-geo-projection";
|
|
52
|
-
const
|
|
53
|
-
class
|
|
52
|
+
const Me = 0, xe = 1, Nt = !1;
|
|
53
|
+
class lt {
|
|
54
54
|
constructor() {
|
|
55
55
|
this.resources = /* @__PURE__ */ new Set(), this.disposeMaterial = !0, this.disposeVideo = !0;
|
|
56
56
|
}
|
|
@@ -59,24 +59,24 @@ class it {
|
|
|
59
59
|
return e;
|
|
60
60
|
if (Array.isArray(e))
|
|
61
61
|
return e.forEach((t) => this.track(t)), e;
|
|
62
|
-
if (!this.disposeMaterial && e instanceof
|
|
62
|
+
if (!this.disposeMaterial && e instanceof de)
|
|
63
63
|
return e;
|
|
64
|
-
if (e instanceof
|
|
64
|
+
if (e instanceof ee ? (e.disposeTrack && e.object3d ? this.track(e.object3d) : this.resources.add(e), Object.values(e.materialList).map((t) => this.track(t))) : (e instanceof G || Reflect.has(e, "dispose")) && this.resources.add(e), e instanceof ee)
|
|
65
65
|
e.children.forEach((t) => {
|
|
66
66
|
t.disposeTrack = !1;
|
|
67
67
|
}), this.track(e.children);
|
|
68
|
-
else if (e instanceof
|
|
68
|
+
else if (e instanceof G) {
|
|
69
69
|
const t = e;
|
|
70
70
|
this.track(t.geometry), this.track(t.material), this.track(t.children);
|
|
71
|
-
} else if (e instanceof
|
|
71
|
+
} else if (e instanceof de) {
|
|
72
72
|
for (const i of Object.values(e))
|
|
73
|
-
i instanceof
|
|
73
|
+
i instanceof fe && this.track(i);
|
|
74
74
|
const t = e;
|
|
75
75
|
if (t.uniforms) {
|
|
76
76
|
for (const i of Object.values(t.uniforms))
|
|
77
77
|
if (i) {
|
|
78
78
|
const s = i.value;
|
|
79
|
-
(s instanceof
|
|
79
|
+
(s instanceof fe || Array.isArray(s)) && this.track(s);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
} else this.disposeVideo && e.isVideoTexture && e.source.data && this.resources.add(e.source.data);
|
|
@@ -85,22 +85,78 @@ class it {
|
|
|
85
85
|
dispose() {
|
|
86
86
|
const e = [];
|
|
87
87
|
for (const t of this.resources)
|
|
88
|
-
t instanceof
|
|
88
|
+
t instanceof G ? e.push(t) : t instanceof HTMLVideoElement && t.pause(), Reflect.has(t, "dispose") && t.dispose();
|
|
89
89
|
e.forEach((t) => {
|
|
90
90
|
t.removeFromParent();
|
|
91
91
|
}), e.length = 0, this.resources.clear();
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
const
|
|
95
|
-
|
|
94
|
+
const we = /* @__PURE__ */ new De(), We = /* @__PURE__ */ new $e(), Y = /* @__PURE__ */ new ze(), N = /* @__PURE__ */ new S();
|
|
95
|
+
function ut(r, e) {
|
|
96
|
+
const t = this.geometry, i = this.matrixWorld, s = r.params.Points.threshold, o = t.drawRange;
|
|
97
|
+
t.boundingSphere === null && t.computeBoundingSphere(), Y.copy(t.boundingSphere), Y.applyMatrix4(i), Y.radius += s, we.copy(i).invert(), We.copy(r.ray).applyMatrix4(we);
|
|
98
|
+
const c = s / ((this.scale.x + this.scale.y + this.scale.z) / 3), n = t.index, h = t.attributes.position;
|
|
99
|
+
if (n !== null) {
|
|
100
|
+
const d = Math.max(0, o.start), u = Math.min(n.count, o.start + o.count);
|
|
101
|
+
for (let f = d, l = u; f < l; f++) {
|
|
102
|
+
const p = n.getX(f);
|
|
103
|
+
N.fromBufferAttribute(h, p), Se(
|
|
104
|
+
N,
|
|
105
|
+
p,
|
|
106
|
+
c,
|
|
107
|
+
i,
|
|
108
|
+
r,
|
|
109
|
+
e,
|
|
110
|
+
this
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
} else {
|
|
114
|
+
const d = Math.max(0, o.start), u = Math.min(
|
|
115
|
+
h.count,
|
|
116
|
+
o.start + o.count
|
|
117
|
+
);
|
|
118
|
+
for (let f = d, l = u; f < l; f++)
|
|
119
|
+
N.fromBufferAttribute(h, f), Se(
|
|
120
|
+
N,
|
|
121
|
+
f,
|
|
122
|
+
c,
|
|
123
|
+
i,
|
|
124
|
+
r,
|
|
125
|
+
e,
|
|
126
|
+
this
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function Se(r, e, t, i, s, o, c) {
|
|
131
|
+
const n = new S();
|
|
132
|
+
We.closestPointToPoint(r, n), n.applyMatrix4(i);
|
|
133
|
+
const a = s.ray.origin.distanceTo(r), h = n.distanceTo(r), d = Math.asin(
|
|
134
|
+
h / a
|
|
135
|
+
);
|
|
136
|
+
if (d < t) {
|
|
137
|
+
if (a < s.near || a > s.far)
|
|
138
|
+
return;
|
|
139
|
+
o.push({
|
|
140
|
+
distance: a,
|
|
141
|
+
distanceToRay: h,
|
|
142
|
+
angleToRay: d,
|
|
143
|
+
point: n,
|
|
144
|
+
index: e,
|
|
145
|
+
face: null,
|
|
146
|
+
object: c
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
const ht = (r, e = 1) => {
|
|
151
|
+
const t = new se();
|
|
96
152
|
t.setAttribute(
|
|
97
153
|
"position",
|
|
98
|
-
new
|
|
154
|
+
new $(new Array(e * 3).fill(0), 3)
|
|
99
155
|
), t.setAttribute(
|
|
100
156
|
"scaleAtt",
|
|
101
|
-
new
|
|
157
|
+
new $(new Array(e).fill(1), 1)
|
|
102
158
|
);
|
|
103
|
-
const i =
|
|
159
|
+
const i = r.material, s = new Fe({
|
|
104
160
|
size: 10,
|
|
105
161
|
map: i.map,
|
|
106
162
|
alphaMap: i.alphaMap,
|
|
@@ -113,30 +169,32 @@ const st = (n, e = 1) => {
|
|
|
113
169
|
alphaTest: i.alphaTest,
|
|
114
170
|
sizeAttenuation: !1
|
|
115
171
|
});
|
|
116
|
-
|
|
117
|
-
|
|
172
|
+
s.onBeforeCompile = (c) => {
|
|
173
|
+
c.vertexShader = `
|
|
118
174
|
attribute float scaleAtt;
|
|
119
|
-
${
|
|
175
|
+
${c.vertexShader.replace(
|
|
120
176
|
"gl_PointSize = size;",
|
|
121
177
|
"gl_PointSize = size * scaleAtt;"
|
|
122
178
|
)}
|
|
123
179
|
`;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
|
|
180
|
+
};
|
|
181
|
+
const o = new ne(t, s);
|
|
182
|
+
return o.raycast = ut, o;
|
|
183
|
+
}, dt = (r, e) => {
|
|
184
|
+
const t = new G();
|
|
127
185
|
e.forEach((i, s) => {
|
|
128
|
-
const o =
|
|
186
|
+
const o = be(i.position), c = be(i.scale || [1, 1, 1]);
|
|
129
187
|
t.position.copy(o), t.scale.copy(c), t.updateMatrix();
|
|
130
|
-
const
|
|
131
|
-
if (
|
|
132
|
-
|
|
133
|
-
else if (
|
|
134
|
-
const
|
|
135
|
-
|
|
188
|
+
const n = t.matrix.clone();
|
|
189
|
+
if (r instanceof Ee || r.isInstantiate)
|
|
190
|
+
r.setMatrixAt(s, n);
|
|
191
|
+
else if (r instanceof ne || r.type === "Points") {
|
|
192
|
+
const h = r.geometry, d = h.attributes.position.array, u = h.attributes.scaleAtt.array, f = new S(), l = new S(), p = new qe(), m = s * 3, b = s * 1;
|
|
193
|
+
n.decompose(f, p, l), d[m] = f.x, d[m + 1] = f.y, d[m + 2] = f.z, u[b] = Math.max(l.x, l.y, l.z), h.attributes.position.needsUpdate = !0, h.attributes.scaleAtt.needsUpdate = !0;
|
|
136
194
|
}
|
|
137
195
|
});
|
|
138
196
|
};
|
|
139
|
-
class
|
|
197
|
+
class ft {
|
|
140
198
|
constructor() {
|
|
141
199
|
this.onPointerIndex = [];
|
|
142
200
|
}
|
|
@@ -168,7 +226,7 @@ class nt {
|
|
|
168
226
|
});
|
|
169
227
|
}
|
|
170
228
|
}
|
|
171
|
-
class
|
|
229
|
+
class pt extends ft {
|
|
172
230
|
constructor() {
|
|
173
231
|
super(...arguments), this.userData = {}, this.materialList = {}, this.useMaterialType = "origin", this.disposeMaterialIfNotUsed = !0;
|
|
174
232
|
}
|
|
@@ -226,7 +284,7 @@ class ot extends nt {
|
|
|
226
284
|
);
|
|
227
285
|
}
|
|
228
286
|
}
|
|
229
|
-
class
|
|
287
|
+
class ee extends pt {
|
|
230
288
|
constructor() {
|
|
231
289
|
super(...arguments), this.key = "", this.objectType = "BaseObject", this.userData = {}, this.isPrefab = !1, this.isInstantiate = !1, this.isBloom = !1, this.isBaseObject = !0, this.disposeTrack = !0, this.isDispose = !1;
|
|
232
290
|
}
|
|
@@ -294,7 +352,7 @@ class Z extends ot {
|
|
|
294
352
|
*/
|
|
295
353
|
_disableLayersRecursive() {
|
|
296
354
|
var e;
|
|
297
|
-
(e = this.object3d) == null || e.layers.disable(
|
|
355
|
+
(e = this.object3d) == null || e.layers.disable(Me), this.children.forEach((t) => {
|
|
298
356
|
t._disableLayersRecursive();
|
|
299
357
|
});
|
|
300
358
|
}
|
|
@@ -303,30 +361,30 @@ class Z extends ot {
|
|
|
303
361
|
*/
|
|
304
362
|
_enableLayersRecursive() {
|
|
305
363
|
var e;
|
|
306
|
-
this.object3d.visible && ((e = this.object3d) == null || e.layers.enable(
|
|
364
|
+
this.object3d.visible && ((e = this.object3d) == null || e.layers.enable(Me), this.children.forEach((t) => {
|
|
307
365
|
t._enableLayersRecursive();
|
|
308
366
|
}));
|
|
309
367
|
}
|
|
310
368
|
createGroup() {
|
|
311
|
-
return this.object3d = new
|
|
369
|
+
return this.object3d = new Xe(), this;
|
|
312
370
|
}
|
|
313
371
|
createMesh(...e) {
|
|
314
|
-
return this.object3d = new
|
|
372
|
+
return this.object3d = new Le(...e), this;
|
|
315
373
|
}
|
|
316
374
|
createPoints(...e) {
|
|
317
|
-
return this.object3d = new
|
|
375
|
+
return this.object3d = new ne(...e), this;
|
|
318
376
|
}
|
|
319
377
|
createCSS2DObject(e) {
|
|
320
|
-
return this.object3d = new
|
|
378
|
+
return this.object3d = new ot(e), this;
|
|
321
379
|
}
|
|
322
380
|
createCSS3DObject(e) {
|
|
323
|
-
return this.object3d = new
|
|
381
|
+
return this.object3d = new at(e), this;
|
|
324
382
|
}
|
|
325
383
|
createCSS3DSprite(e) {
|
|
326
|
-
return this.object3d = new
|
|
384
|
+
return this.object3d = new ct(e), this;
|
|
327
385
|
}
|
|
328
386
|
createSprite(e) {
|
|
329
|
-
return this.object3d = new
|
|
387
|
+
return this.object3d = new pe(e), this;
|
|
330
388
|
}
|
|
331
389
|
attach(...e) {
|
|
332
390
|
return [...e].forEach((t) => {
|
|
@@ -334,7 +392,7 @@ class Z extends ot {
|
|
|
334
392
|
}), this;
|
|
335
393
|
}
|
|
336
394
|
getSize() {
|
|
337
|
-
const e = new
|
|
395
|
+
const e = new ke().setFromObject(this.object3d);
|
|
338
396
|
return {
|
|
339
397
|
min: e.min,
|
|
340
398
|
max: e.max,
|
|
@@ -351,49 +409,49 @@ class Z extends ot {
|
|
|
351
409
|
});
|
|
352
410
|
}
|
|
353
411
|
instantiate(e) {
|
|
354
|
-
return
|
|
355
|
-
var
|
|
356
|
-
const t = (
|
|
357
|
-
let c = e == null ? void 0 : e.create,
|
|
358
|
-
return a === this.lead.prefabGroup && (a = this.lead.group), this.objectType === "BaseObject" ?
|
|
412
|
+
return ue(this, null, function* () {
|
|
413
|
+
var h, d;
|
|
414
|
+
const t = (h = e == null ? void 0 : e.recursive) != null ? h : !0, i = (d = e == null ? void 0 : e.cloneMaterial) != null ? d : !1, { objectType: s, objectOptions: o } = this;
|
|
415
|
+
let c = e == null ? void 0 : e.create, n, a = (e == null ? void 0 : e.target) || this.parent;
|
|
416
|
+
return a === this.lead.prefabGroup && (a = this.lead.group), this.objectType === "BaseObject" ? n = this.lead.createBaseObject(this.object3d.clone(!1), {
|
|
359
417
|
target: a
|
|
360
418
|
}) : (c === void 0 && (c = (u) => {
|
|
361
419
|
var f;
|
|
362
420
|
if (this.object3d) {
|
|
363
421
|
if ((f = e == null ? void 0 : e.instancedAttr) != null && f.length) {
|
|
364
|
-
const
|
|
365
|
-
if (this.object3d instanceof
|
|
366
|
-
u.object3d =
|
|
422
|
+
const l = e.instancedAttr.length;
|
|
423
|
+
if (this.object3d instanceof pe)
|
|
424
|
+
u.object3d = ht(this.object3d, l);
|
|
367
425
|
else {
|
|
368
|
-
const p = this.object3d,
|
|
369
|
-
u.object3d = new
|
|
426
|
+
const p = this.object3d, m = i ? this.cloneMaterial() : p.material;
|
|
427
|
+
u.object3d = new Ee(
|
|
370
428
|
p.geometry,
|
|
371
|
-
|
|
372
|
-
|
|
429
|
+
m,
|
|
430
|
+
l
|
|
373
431
|
);
|
|
374
432
|
}
|
|
375
|
-
|
|
433
|
+
dt(u.object3d, e == null ? void 0 : e.instancedAttr);
|
|
376
434
|
} else
|
|
377
435
|
u.object3d = this.object3d.clone(!1), i && u.object3d.material && (u.object3d.material = this.cloneMaterial());
|
|
378
436
|
u.object3d.userData.prefab && delete u.object3d.userData.prefab;
|
|
379
437
|
}
|
|
380
|
-
}),
|
|
438
|
+
}), n = yield this.lead.draw(s, X(k({}, o || {}), {
|
|
381
439
|
create: c,
|
|
382
440
|
prefab: !1,
|
|
383
441
|
keyType: this.keyType,
|
|
384
442
|
key: (e == null ? void 0 : e.key) || this.keyName,
|
|
385
443
|
uId: (e == null ? void 0 : e.uId) || this.keyUId,
|
|
386
444
|
target: a
|
|
387
|
-
}))), this.isBloom &&
|
|
445
|
+
}))), this.isBloom && n.enableBloom(), t && (yield Promise.all(
|
|
388
446
|
this.children.map(
|
|
389
447
|
(u) => u.instantiate({
|
|
390
448
|
key: u.keyUId && u.keyName ? `${u.keyName}-${u.keyUId}` : u.keyName,
|
|
391
449
|
uId: e == null ? void 0 : e.uId,
|
|
392
450
|
cloneMaterial: i,
|
|
393
|
-
target:
|
|
451
|
+
target: n
|
|
394
452
|
})
|
|
395
453
|
)
|
|
396
|
-
)),
|
|
454
|
+
)), n.isInstantiate = !0, n;
|
|
397
455
|
});
|
|
398
456
|
}
|
|
399
457
|
erase() {
|
|
@@ -413,7 +471,7 @@ class Z extends ot {
|
|
|
413
471
|
});
|
|
414
472
|
return;
|
|
415
473
|
}
|
|
416
|
-
this.object3d && ((i = this.pencil.composerController) == null || i.bloomSelection.add(this), this.object3d.layers.enable(
|
|
474
|
+
this.object3d && ((i = this.pencil.composerController) == null || i.bloomSelection.add(this), this.object3d.layers.enable(xe)), (s = this.pencil.composerController) == null || s.checkBloomComposerActive(), this.isBloom = !0;
|
|
417
475
|
}
|
|
418
476
|
disableBloom(e = !0) {
|
|
419
477
|
var t, i, s;
|
|
@@ -427,230 +485,237 @@ class Z extends ot {
|
|
|
427
485
|
});
|
|
428
486
|
return;
|
|
429
487
|
}
|
|
430
|
-
this.object3d && ((i = this.pencil.composerController) == null || i.bloomSelection.delete(this), this.object3d.layers.disable(
|
|
488
|
+
this.object3d && ((i = this.pencil.composerController) == null || i.bloomSelection.delete(this), this.object3d.layers.disable(xe)), (s = this.pencil.composerController) == null || s.checkBloomComposerActive(), this.isBloom = !1;
|
|
431
489
|
}
|
|
432
490
|
dispose() {
|
|
433
491
|
var e, t;
|
|
434
492
|
if (!this.isDispose && (this.isDispose = !0, super.dispose(), this.isBloom && (this.disableBloom(!1), (e = this.pencil.composerController) == null || e.checkBloomComposerActive()), (t = this.lead) == null || t.disableCursor(this), this.lead && (this.lead.objects.delete(this.key), this.lead.objectWrapChindIdMap.delete(this), this.object3d && this.lead.objMap.delete(this.object3d)), this.disposeTrack)) {
|
|
435
|
-
const i = new
|
|
493
|
+
const i = new lt();
|
|
436
494
|
i.disposeMaterial = !1, i.track(this), i.dispose();
|
|
437
495
|
}
|
|
438
496
|
}
|
|
439
497
|
}
|
|
440
|
-
function
|
|
441
|
-
return
|
|
498
|
+
function mt(r, e) {
|
|
499
|
+
return r.map((t) => {
|
|
442
500
|
const i = [];
|
|
443
501
|
let s;
|
|
444
502
|
return t.forEach((o) => {
|
|
445
503
|
if (s) {
|
|
446
|
-
const c =
|
|
504
|
+
const c = it(o, s) * 180 / Math.PI;
|
|
447
505
|
if (c > e) {
|
|
448
|
-
const
|
|
449
|
-
let
|
|
450
|
-
for (;
|
|
451
|
-
i.push(
|
|
506
|
+
const n = st(s, o), a = 1 / Math.ceil(c / e);
|
|
507
|
+
let h = a;
|
|
508
|
+
for (; h < 1; )
|
|
509
|
+
i.push(n(h)), h += a;
|
|
452
510
|
}
|
|
453
511
|
}
|
|
454
512
|
i.push(s = o);
|
|
455
513
|
}), i;
|
|
456
514
|
});
|
|
457
515
|
}
|
|
458
|
-
function
|
|
459
|
-
const o = Math.round(
|
|
460
|
-
s !== void 0 ? Math.ceil(
|
|
461
|
-
i !== void 0 ? Math.floor(
|
|
462
|
-
], u = e === void 0 && t === void 0 ? () => !0 : e === void 0 ? (
|
|
463
|
-
for (let
|
|
464
|
-
const p =
|
|
465
|
-
u(p) && f.push([p, a(
|
|
516
|
+
function vt(r, { minLng: e, maxLng: t, minLat: i, maxLat: s } = {}) {
|
|
517
|
+
const o = Math.round(ce(360 / r, 2) / Math.PI), c = (1 + Math.sqrt(5)) / 2, n = (l) => l / c * 360 % 360 - 180, a = (l) => Math.acos(2 * l / o - 1) / Math.PI * 180 - 90, h = (l) => o * (Math.cos((l + 90) * Math.PI / 180) + 1) / 2, d = [
|
|
518
|
+
s !== void 0 ? Math.ceil(h(s)) : 0,
|
|
519
|
+
i !== void 0 ? Math.floor(h(i)) : o - 1
|
|
520
|
+
], u = e === void 0 && t === void 0 ? () => !0 : e === void 0 ? (l) => l <= t : t === void 0 ? (l) => l >= e : t >= e ? (l) => l >= e && l <= t : (l) => l >= e || l <= t, f = [];
|
|
521
|
+
for (let l = d[0]; l <= d[1]; l++) {
|
|
522
|
+
const p = n(l);
|
|
523
|
+
u(p) && f.push([p, a(l)]);
|
|
466
524
|
}
|
|
467
525
|
return f;
|
|
468
526
|
}
|
|
469
|
-
function
|
|
470
|
-
return t ?
|
|
527
|
+
function te(r, e, t = !1) {
|
|
528
|
+
return t ? tt(e, r) : et(r, e);
|
|
471
529
|
}
|
|
472
|
-
function
|
|
473
|
-
const t = { type: "Polygon", coordinates:
|
|
530
|
+
function bt(r, e) {
|
|
531
|
+
const t = { type: "Polygon", coordinates: r }, [[i, s], [o, c]] = Ve(t);
|
|
474
532
|
if (Math.min(Math.abs(o - i), Math.abs(c - s)) < e)
|
|
475
533
|
return [];
|
|
476
|
-
const
|
|
477
|
-
return
|
|
534
|
+
const n = i > o || c >= 89 || s <= -89;
|
|
535
|
+
return vt(e, {
|
|
478
536
|
minLng: i,
|
|
479
537
|
maxLng: o,
|
|
480
538
|
minLat: s,
|
|
481
539
|
maxLat: c
|
|
482
540
|
}).filter(
|
|
483
|
-
(a) =>
|
|
541
|
+
(a) => te(a, t, n)
|
|
484
542
|
);
|
|
485
543
|
}
|
|
486
|
-
function
|
|
487
|
-
const s =
|
|
544
|
+
function yt(r, { resolution: e = 1 / 0, bbox: t, projection: i } = {}) {
|
|
545
|
+
const s = mt(r, e), o = ie(s), c = bt(r, e), n = [...o, ...c], a = { type: "Polygon", coordinates: r }, [[h, d], [u, f]] = Ve(a), l = h > u || // crosses antimeridian
|
|
488
546
|
f >= 89 || // crosses north pole
|
|
489
|
-
|
|
547
|
+
d <= -89;
|
|
490
548
|
let p = [];
|
|
491
|
-
if (
|
|
492
|
-
const y =
|
|
493
|
-
|
|
549
|
+
if (l) {
|
|
550
|
+
const y = nt(n).triangles(), w = new Map(
|
|
551
|
+
n.map(([I, T], E) => [`${I}-${T}`, E])
|
|
494
552
|
);
|
|
495
|
-
y.features.forEach((
|
|
496
|
-
const
|
|
497
|
-
if (
|
|
498
|
-
const
|
|
499
|
-
|
|
500
|
-
}),
|
|
501
|
-
if (
|
|
502
|
-
const
|
|
503
|
-
if (!
|
|
504
|
-
|
|
553
|
+
y.features.forEach((I) => {
|
|
554
|
+
const T = I.geometry.coordinates[0].slice(0, 3).reverse(), E = [];
|
|
555
|
+
if (T.forEach(([A, q]) => {
|
|
556
|
+
const W = `${A}-${q}`;
|
|
557
|
+
w.has(W) && E.push(w.get(W));
|
|
558
|
+
}), E.length === 3) {
|
|
559
|
+
if (E.some((A) => A < o.length)) {
|
|
560
|
+
const A = I.properties.circumcenter;
|
|
561
|
+
if (!te(
|
|
562
|
+
A,
|
|
505
563
|
a,
|
|
506
|
-
|
|
564
|
+
l
|
|
507
565
|
))
|
|
508
566
|
return;
|
|
509
567
|
}
|
|
510
|
-
p.push(...
|
|
568
|
+
p.push(...E);
|
|
511
569
|
}
|
|
512
570
|
});
|
|
513
571
|
} else if (c.length) {
|
|
514
|
-
const y =
|
|
515
|
-
for (let
|
|
516
|
-
const
|
|
517
|
-
if (
|
|
518
|
-
const
|
|
519
|
-
(
|
|
572
|
+
const y = He.from(n);
|
|
573
|
+
for (let w = 0, I = y.triangles.length; w < I; w += 3) {
|
|
574
|
+
const T = [2, 1, 0].map((A) => y.triangles[w + A]), E = T.map((A) => n[A]);
|
|
575
|
+
if (T.some((A) => A < o.length)) {
|
|
576
|
+
const A = [0, 1].map(
|
|
577
|
+
(q) => Ue(E, (W) => W[q])
|
|
520
578
|
);
|
|
521
|
-
if (!
|
|
522
|
-
|
|
579
|
+
if (!te(
|
|
580
|
+
A,
|
|
523
581
|
a,
|
|
524
|
-
|
|
582
|
+
l
|
|
525
583
|
))
|
|
526
584
|
continue;
|
|
527
585
|
}
|
|
528
|
-
p.push(...
|
|
586
|
+
p.push(...T);
|
|
529
587
|
}
|
|
530
588
|
} else {
|
|
531
|
-
const { vertices: y, holes:
|
|
532
|
-
p =
|
|
589
|
+
const { vertices: y, holes: w = [] } = Oe(s);
|
|
590
|
+
p = Ge(y, w, 2);
|
|
533
591
|
}
|
|
534
|
-
let
|
|
592
|
+
let m = t ? [t[0], t[2]] : he(n, (y) => y[0]), b = t ? [t[1], t[3]] : he(n, (y) => y[1]);
|
|
535
593
|
if (i) {
|
|
536
|
-
const [y,
|
|
537
|
-
|
|
594
|
+
const [y, w] = i([m[0], b[0]]), [I, T] = i([m[1], b[1]]);
|
|
595
|
+
m = [y, I], b = [-w, -T];
|
|
538
596
|
}
|
|
539
|
-
const j =
|
|
597
|
+
const j = ge(m, [0, 1]), z = ge(b, [0, 1]), C = n.map(([y, w]) => {
|
|
540
598
|
if (i) {
|
|
541
|
-
const [
|
|
542
|
-
return [j(
|
|
599
|
+
const [I, T] = i([y, w]);
|
|
600
|
+
return [j(I), z(-T)];
|
|
543
601
|
} else
|
|
544
|
-
return [j(y),
|
|
602
|
+
return [j(y), z(w)];
|
|
545
603
|
});
|
|
546
|
-
return { contour: s, triangles: { points:
|
|
604
|
+
return { contour: s, triangles: { points: n, indices: p, uvs: C } };
|
|
547
605
|
}
|
|
548
|
-
const
|
|
549
|
-
function
|
|
550
|
-
const
|
|
551
|
-
(
|
|
552
|
-
if (
|
|
553
|
-
const
|
|
554
|
-
return [
|
|
606
|
+
const je = new se().setAttribute ? "setAttribute" : "addAttribute";
|
|
607
|
+
function F(r, e, t) {
|
|
608
|
+
const i = r.map(
|
|
609
|
+
(s) => s.map(([o, c]) => {
|
|
610
|
+
if (t === "cesium") {
|
|
611
|
+
const n = 1 / Q.a, a = e / n, h = Math.max(0, a - Q.a), d = ye(o, c, h, n, !1);
|
|
612
|
+
return [d.x, d.y, d.z];
|
|
613
|
+
}
|
|
614
|
+
if (t === "sphere") {
|
|
615
|
+
const n = ye(
|
|
616
|
+
o,
|
|
617
|
+
c,
|
|
618
|
+
e - Q.a,
|
|
619
|
+
1,
|
|
620
|
+
!0
|
|
621
|
+
);
|
|
622
|
+
return [n.x, n.y, n.z];
|
|
623
|
+
}
|
|
624
|
+
if (typeof t == "function") {
|
|
625
|
+
const [n, a] = t([o, c]);
|
|
626
|
+
return [n, -a, e];
|
|
555
627
|
}
|
|
556
|
-
return
|
|
628
|
+
return [o, c, e];
|
|
557
629
|
})
|
|
558
630
|
);
|
|
559
|
-
return
|
|
631
|
+
return Oe(i);
|
|
560
632
|
}
|
|
561
|
-
function
|
|
562
|
-
const { vertices:
|
|
563
|
-
|
|
633
|
+
function gt(r, e, t, i) {
|
|
634
|
+
const { vertices: s, holes: o } = F(
|
|
635
|
+
r,
|
|
564
636
|
e,
|
|
565
|
-
i
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
n,
|
|
637
|
+
i
|
|
638
|
+
), { vertices: c } = F(
|
|
639
|
+
r,
|
|
569
640
|
t,
|
|
570
|
-
i
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
h = u, u = v;
|
|
641
|
+
i
|
|
642
|
+
), n = ie([c, s]), a = Math.round(c.length / 3), h = new Set(o);
|
|
643
|
+
let d = 0;
|
|
644
|
+
const u = [];
|
|
645
|
+
for (let l = 0; l < a; l++) {
|
|
646
|
+
let p = l + 1;
|
|
647
|
+
if (p === a)
|
|
648
|
+
p = d;
|
|
649
|
+
else if (h.has(p)) {
|
|
650
|
+
const m = p;
|
|
651
|
+
p = d, d = m;
|
|
582
652
|
}
|
|
583
|
-
|
|
653
|
+
u.push(l, l + a, p + a), u.push(p + a, p, l);
|
|
584
654
|
}
|
|
585
|
-
const
|
|
586
|
-
for (let
|
|
587
|
-
for (let
|
|
588
|
-
return { indices:
|
|
655
|
+
const f = [];
|
|
656
|
+
for (let l = 1; l >= 0; l--)
|
|
657
|
+
for (let p = 0; p < a; p += 1) f.push(p / (a - 1), l);
|
|
658
|
+
return { indices: u, vertices: n, uvs: f, topVerts: c };
|
|
589
659
|
}
|
|
590
|
-
function
|
|
660
|
+
function Ce(r, e, t, i, s) {
|
|
591
661
|
return {
|
|
592
|
-
indices: i ?
|
|
593
|
-
vertices:
|
|
594
|
-
[
|
|
662
|
+
indices: i ? r.indices : r.indices.slice().reverse(),
|
|
663
|
+
vertices: F(
|
|
664
|
+
[r.points],
|
|
595
665
|
e,
|
|
596
|
-
s
|
|
597
|
-
o
|
|
666
|
+
s
|
|
598
667
|
).vertices,
|
|
599
668
|
uvs: t
|
|
600
669
|
};
|
|
601
670
|
}
|
|
602
|
-
const
|
|
603
|
-
polygonGeoJson:
|
|
671
|
+
const Mt = ({
|
|
672
|
+
polygonGeoJson: r,
|
|
604
673
|
startHeight: e,
|
|
605
674
|
endHeight: t,
|
|
606
675
|
curvatureResolution: i = 1,
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
bbox: l
|
|
676
|
+
hasSide: s = !0,
|
|
677
|
+
hasBottom: o = !1,
|
|
678
|
+
hasTop: c = !1,
|
|
679
|
+
projection: n = "sphere",
|
|
680
|
+
bbox: a
|
|
613
681
|
}) => {
|
|
614
|
-
|
|
615
|
-
|
|
682
|
+
r.forEach((j) => {
|
|
683
|
+
Je(j) || j.reverse();
|
|
616
684
|
});
|
|
617
|
-
const { contour:
|
|
685
|
+
const h = typeof n == "function" ? n : void 0, { contour: d, triangles: u } = yt(r, {
|
|
618
686
|
resolution: i,
|
|
619
|
-
bbox:
|
|
620
|
-
projection:
|
|
687
|
+
bbox: a,
|
|
688
|
+
projection: h
|
|
621
689
|
});
|
|
622
|
-
let f = {},
|
|
623
|
-
|
|
624
|
-
|
|
690
|
+
let f = {}, l;
|
|
691
|
+
s && (f = gt(
|
|
692
|
+
d,
|
|
625
693
|
e != null ? e : t,
|
|
626
694
|
t != null ? t : e,
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
), d = f.topVerts);
|
|
695
|
+
n
|
|
696
|
+
), l = f.topVerts);
|
|
630
697
|
let p = [];
|
|
631
|
-
(
|
|
632
|
-
let
|
|
633
|
-
|
|
698
|
+
(o || c) && (p = ie(u.uvs));
|
|
699
|
+
let m = {};
|
|
700
|
+
o && (m = Ce(
|
|
634
701
|
u,
|
|
635
702
|
e,
|
|
636
703
|
p,
|
|
637
704
|
!1,
|
|
638
|
-
|
|
639
|
-
a
|
|
705
|
+
n
|
|
640
706
|
));
|
|
641
|
-
let
|
|
642
|
-
return
|
|
707
|
+
let b = {};
|
|
708
|
+
return c && (b = Ce(
|
|
643
709
|
u,
|
|
644
710
|
t,
|
|
645
711
|
p,
|
|
646
712
|
!0,
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
)), { contour: m, triangles: u, sideTorso: f, bottomCap: h, topCap: v, topVerts: d };
|
|
713
|
+
n
|
|
714
|
+
)), { contour: d, triangles: u, sideTorso: f, bottomCap: m, topCap: b, topVerts: l };
|
|
650
715
|
};
|
|
651
|
-
class
|
|
716
|
+
class Rt extends se {
|
|
652
717
|
constructor(e, t = {}) {
|
|
653
|
-
super(), this.type = "PolygonBufferGeometry", this.parameters =
|
|
718
|
+
super(), this.type = "PolygonBufferGeometry", this.parameters = k({
|
|
654
719
|
polygonGeoJson: e,
|
|
655
720
|
startHeight: 0,
|
|
656
721
|
endHeight: 1,
|
|
@@ -659,7 +724,7 @@ class Et extends ee {
|
|
|
659
724
|
hasBottom: !0,
|
|
660
725
|
hasSide: !0,
|
|
661
726
|
curvatureResolution: 1,
|
|
662
|
-
|
|
727
|
+
projection: "sphere",
|
|
663
728
|
userDataRsoOffset: 0
|
|
664
729
|
}, t);
|
|
665
730
|
const {
|
|
@@ -667,27 +732,25 @@ class Et extends ee {
|
|
|
667
732
|
hasTop: s,
|
|
668
733
|
topFirst: o,
|
|
669
734
|
hasBottom: c,
|
|
670
|
-
hasSide:
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
), this.addGroup(P, C.length - P, O++);
|
|
735
|
+
hasSide: n,
|
|
736
|
+
userDataRsoOffset: a,
|
|
737
|
+
projection: h
|
|
738
|
+
} = this.parameters, { contour: d, sideTorso: u, topVerts: f, bottomCap: l, topCap: p } = Mt(k({}, this.parameters));
|
|
739
|
+
let m = [], b = [], j = [], z = 0;
|
|
740
|
+
const C = (P) => {
|
|
741
|
+
const y = Math.round(m.length / 3), w = j.length;
|
|
742
|
+
m = m.concat(P.vertices), b = b.concat(P.uvs), j = j.concat(
|
|
743
|
+
y ? P.indices.map((I) => I + y) : P.indices
|
|
744
|
+
), this.addGroup(w, j.length - w, z++);
|
|
681
745
|
};
|
|
682
|
-
s && o &&
|
|
683
|
-
|
|
684
|
-
i +
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
).vertices : d), c && A(p), s && !o && A(h), this.setIndex(C), this[ye]("position", new G(v, 3)), this[ye]("uv", new G(j, 2)), this.computeVertexNormals();
|
|
746
|
+
s && o && C(p), n && (C(u), this.userData.topVerts = a ? F(
|
|
747
|
+
d,
|
|
748
|
+
i + a,
|
|
749
|
+
h
|
|
750
|
+
).vertices : f), c && C(l), s && !o && C(p), this.setIndex(j), this[je]("position", new $(m, 3)), this[je]("uv", new $(b, 2)), this.computeVertexNormals();
|
|
688
751
|
}
|
|
689
752
|
}
|
|
690
|
-
const
|
|
753
|
+
const xt = `
|
|
691
754
|
#include <fog_pars_fragment>
|
|
692
755
|
#include <logdepthbuf_pars_fragment>
|
|
693
756
|
|
|
@@ -731,7 +794,7 @@ void main() {
|
|
|
731
794
|
#include <tonemapping_fragment>
|
|
732
795
|
#include <colorspace_fragment>
|
|
733
796
|
}
|
|
734
|
-
`,
|
|
797
|
+
`, wt = `
|
|
735
798
|
#include <common>
|
|
736
799
|
#include <logdepthbuf_pars_vertex>
|
|
737
800
|
#include <fog_pars_vertex>
|
|
@@ -824,25 +887,25 @@ void main() {
|
|
|
824
887
|
#include <fog_vertex>
|
|
825
888
|
}
|
|
826
889
|
`;
|
|
827
|
-
class
|
|
890
|
+
class Ut extends Ke {
|
|
828
891
|
constructor(e = {}) {
|
|
829
|
-
const
|
|
892
|
+
const z = e, {
|
|
830
893
|
lineWidth: t = 1,
|
|
831
894
|
color: i = "#ffffff",
|
|
832
895
|
opacity: s = 1,
|
|
833
896
|
map: o = null,
|
|
834
897
|
dashOffset: c = 0,
|
|
835
|
-
dashArray:
|
|
898
|
+
dashArray: n = 0,
|
|
836
899
|
dashRatio: a = 0,
|
|
837
|
-
sizeAttenuation:
|
|
838
|
-
offsetLoop:
|
|
900
|
+
sizeAttenuation: h = !0,
|
|
901
|
+
offsetLoop: d = !0,
|
|
839
902
|
offset: u = new K(0, 0),
|
|
840
903
|
scaleDown: f = 0,
|
|
841
|
-
alphaMap:
|
|
904
|
+
alphaMap: l = void 0,
|
|
842
905
|
alphaTest: p = 0,
|
|
843
|
-
repeat:
|
|
844
|
-
resolution:
|
|
845
|
-
} =
|
|
906
|
+
repeat: m = new K(1, 1),
|
|
907
|
+
resolution: b = new K(1, 1)
|
|
908
|
+
} = z, j = le(z, [
|
|
846
909
|
"lineWidth",
|
|
847
910
|
"color",
|
|
848
911
|
"opacity",
|
|
@@ -859,29 +922,29 @@ class Lt extends Ne {
|
|
|
859
922
|
"repeat",
|
|
860
923
|
"resolution"
|
|
861
924
|
]);
|
|
862
|
-
super(
|
|
925
|
+
super(X(k({}, j), {
|
|
863
926
|
uniforms: {
|
|
864
927
|
lineWidth: { value: t },
|
|
865
|
-
color: { value: new
|
|
928
|
+
color: { value: new me(i) },
|
|
866
929
|
opacity: { value: s },
|
|
867
930
|
map: { value: o },
|
|
868
931
|
useMap: { value: o ? 1 : 0 },
|
|
869
|
-
resolution: { value:
|
|
870
|
-
sizeAttenuation: { value:
|
|
932
|
+
resolution: { value: b },
|
|
933
|
+
sizeAttenuation: { value: h ? 1 : 0 },
|
|
871
934
|
offset: { value: u },
|
|
872
|
-
offsetLoop: { value:
|
|
873
|
-
dashArray: { value:
|
|
935
|
+
offsetLoop: { value: d ? 1 : 0 },
|
|
936
|
+
dashArray: { value: n },
|
|
874
937
|
dashOffset: { value: c },
|
|
875
938
|
dashRatio: { value: a },
|
|
876
|
-
useDash: { value:
|
|
939
|
+
useDash: { value: n > 0 ? 1 : 0 },
|
|
877
940
|
scaleDown: { value: f / 10 },
|
|
878
941
|
alphaTest: { value: p },
|
|
879
|
-
alphaMap: { value:
|
|
880
|
-
useAlphaMap: { value:
|
|
881
|
-
repeat: { value:
|
|
942
|
+
alphaMap: { value: l },
|
|
943
|
+
useAlphaMap: { value: l ? 1 : 0 },
|
|
944
|
+
repeat: { value: m }
|
|
882
945
|
},
|
|
883
|
-
vertexShader:
|
|
884
|
-
fragmentShader:
|
|
946
|
+
vertexShader: wt,
|
|
947
|
+
fragmentShader: xt
|
|
885
948
|
})), this.type = "MeshLineMaterial";
|
|
886
949
|
}
|
|
887
950
|
// Getter and setter for color
|
|
@@ -889,7 +952,7 @@ class Lt extends Ne {
|
|
|
889
952
|
return this.uniforms.color.value;
|
|
890
953
|
}
|
|
891
954
|
set color(e) {
|
|
892
|
-
this.uniforms.color.value = new
|
|
955
|
+
this.uniforms.color.value = new me(e);
|
|
893
956
|
}
|
|
894
957
|
get opacity() {
|
|
895
958
|
var e;
|
|
@@ -932,53 +995,53 @@ class Lt extends Ne {
|
|
|
932
995
|
this.uniforms.sizeAttenuation.value = e ? 1 : 0;
|
|
933
996
|
}
|
|
934
997
|
}
|
|
935
|
-
const
|
|
936
|
-
let
|
|
937
|
-
function
|
|
938
|
-
return
|
|
998
|
+
const Z = new V(), Pe = new S(), Ae = new S(), g = new V(), M = new V(), B = new V(), J = new S(), H = new De(), x = new Qe(), Ie = new S(), R = new ke(), U = new ze(), O = new V();
|
|
999
|
+
let D, L;
|
|
1000
|
+
function Te(r, e, t) {
|
|
1001
|
+
return O.set(0, 0, -e, 1).applyMatrix4(r.projectionMatrix), O.multiplyScalar(1 / O.w), O.x = L / t.width, O.y = L / t.height, O.applyMatrix4(r.projectionMatrixInverse), O.multiplyScalar(1 / O.w), Math.abs(Math.max(O.x, O.y));
|
|
939
1002
|
}
|
|
940
|
-
function
|
|
941
|
-
const t =
|
|
942
|
-
for (let
|
|
943
|
-
|
|
944
|
-
const
|
|
945
|
-
|
|
946
|
-
point:
|
|
947
|
-
pointOnLine:
|
|
948
|
-
distance:
|
|
949
|
-
object:
|
|
1003
|
+
function St(r, e) {
|
|
1004
|
+
const t = r.matrixWorld, i = r.geometry, s = i.attributes.instanceStart, o = i.attributes.instanceEnd, c = Math.min(i.instanceCount, s.count);
|
|
1005
|
+
for (let n = 0, a = c; n < a; n++) {
|
|
1006
|
+
x.start.fromBufferAttribute(s, n), x.end.fromBufferAttribute(o, n), x.applyMatrix4(t);
|
|
1007
|
+
const h = new S(), d = new S();
|
|
1008
|
+
D.distanceSqToSegment(x.start, x.end, d, h), d.distanceTo(h) < L * 0.5 && e.push({
|
|
1009
|
+
point: d,
|
|
1010
|
+
pointOnLine: h,
|
|
1011
|
+
distance: D.origin.distanceTo(d),
|
|
1012
|
+
object: r,
|
|
950
1013
|
face: null,
|
|
951
|
-
faceIndex:
|
|
1014
|
+
faceIndex: n,
|
|
952
1015
|
uv: null,
|
|
953
1016
|
uv1: null
|
|
954
1017
|
});
|
|
955
1018
|
}
|
|
956
1019
|
}
|
|
957
|
-
function
|
|
958
|
-
const i = e.projectionMatrix, o =
|
|
959
|
-
|
|
960
|
-
for (let f = 0,
|
|
961
|
-
if (g.fromBufferAttribute(a, f), M.fromBufferAttribute(
|
|
1020
|
+
function jt(r, e, t) {
|
|
1021
|
+
const i = e.projectionMatrix, o = r.material.resolution, c = r.matrixWorld, n = r.geometry, a = n.attributes.instanceStart, h = n.attributes.instanceEnd, d = Math.min(n.instanceCount, a.count), u = -e.near;
|
|
1022
|
+
D.at(1, B), B.w = 1, B.applyMatrix4(e.matrixWorldInverse), B.applyMatrix4(i), B.multiplyScalar(1 / B.w), B.x *= o.x / 2, B.y *= o.y / 2, B.z = 0, J.copy(B), H.multiplyMatrices(e.matrixWorldInverse, c);
|
|
1023
|
+
for (let f = 0, l = d; f < l; f++) {
|
|
1024
|
+
if (g.fromBufferAttribute(a, f), M.fromBufferAttribute(h, f), g.w = 1, M.w = 1, g.applyMatrix4(H), M.applyMatrix4(H), g.z > u && M.z > u)
|
|
962
1025
|
continue;
|
|
963
1026
|
if (g.z > u) {
|
|
964
|
-
const
|
|
965
|
-
g.lerp(M,
|
|
1027
|
+
const C = g.z - M.z, P = (g.z - u) / C;
|
|
1028
|
+
g.lerp(M, P);
|
|
966
1029
|
} else if (M.z > u) {
|
|
967
|
-
const
|
|
968
|
-
M.lerp(g,
|
|
1030
|
+
const C = M.z - g.z, P = (M.z - u) / C;
|
|
1031
|
+
M.lerp(g, P);
|
|
969
1032
|
}
|
|
970
|
-
g.applyMatrix4(i), M.applyMatrix4(i), g.multiplyScalar(1 / g.w), M.multiplyScalar(1 / M.w), g.x *= o.x / 2, g.y *= o.y / 2, M.x *= o.x / 2, M.y *= o.y / 2,
|
|
971
|
-
const
|
|
972
|
-
|
|
973
|
-
const
|
|
974
|
-
if (j &&
|
|
975
|
-
|
|
976
|
-
const
|
|
977
|
-
|
|
978
|
-
point:
|
|
979
|
-
pointOnLine:
|
|
980
|
-
distance:
|
|
981
|
-
object:
|
|
1033
|
+
g.applyMatrix4(i), M.applyMatrix4(i), g.multiplyScalar(1 / g.w), M.multiplyScalar(1 / M.w), g.x *= o.x / 2, g.y *= o.y / 2, M.x *= o.x / 2, M.y *= o.y / 2, x.start.copy(g), x.start.z = 0, x.end.copy(M), x.end.z = 0;
|
|
1034
|
+
const m = x.closestPointToPointParameter(J, !0);
|
|
1035
|
+
x.at(m, Ie);
|
|
1036
|
+
const b = Ze.lerp(g.z, M.z, m), j = b >= -1 && b <= 1, z = J.distanceTo(Ie) < L * 0.5;
|
|
1037
|
+
if (j && z) {
|
|
1038
|
+
x.start.fromBufferAttribute(a, f), x.end.fromBufferAttribute(h, f), x.start.applyMatrix4(c), x.end.applyMatrix4(c);
|
|
1039
|
+
const C = new S(), P = new S();
|
|
1040
|
+
D.distanceSqToSegment(x.start, x.end, P, C), t.push({
|
|
1041
|
+
point: P,
|
|
1042
|
+
pointOnLine: C,
|
|
1043
|
+
distance: D.origin.distanceTo(P),
|
|
1044
|
+
object: r,
|
|
982
1045
|
face: null,
|
|
983
1046
|
faceIndex: f,
|
|
984
1047
|
uv: null,
|
|
@@ -987,26 +1050,26 @@ function vt(n, e, t) {
|
|
|
987
1050
|
}
|
|
988
1051
|
}
|
|
989
1052
|
}
|
|
990
|
-
class
|
|
991
|
-
constructor(e = new
|
|
1053
|
+
class Gt extends Le {
|
|
1054
|
+
constructor(e = new rt(), t) {
|
|
992
1055
|
super(e, t), this.isLineSegments2 = !0, this.type = "LineSegments2";
|
|
993
1056
|
}
|
|
994
1057
|
// for backwards-compatibility, but could be a method of LineSegmentsGeometry...
|
|
995
1058
|
computeLineDistances() {
|
|
996
1059
|
const e = this.geometry, t = e.attributes.instanceStart, i = e.attributes.instanceEnd, s = new Float32Array(2 * t.count);
|
|
997
|
-
for (let c = 0,
|
|
998
|
-
|
|
999
|
-
const o = new
|
|
1060
|
+
for (let c = 0, n = 0, a = t.count; c < a; c++, n += 2)
|
|
1061
|
+
Pe.fromBufferAttribute(t, c), Ae.fromBufferAttribute(i, c), s[n] = n === 0 ? 0 : s[n - 1], s[n + 1] = s[n] + Pe.distanceTo(Ae);
|
|
1062
|
+
const o = new Ye(
|
|
1000
1063
|
s,
|
|
1001
1064
|
2,
|
|
1002
1065
|
1
|
|
1003
1066
|
);
|
|
1004
1067
|
return e.setAttribute(
|
|
1005
1068
|
"instanceDistanceStart",
|
|
1006
|
-
new
|
|
1069
|
+
new ve(o, 1, 0)
|
|
1007
1070
|
), e.setAttribute(
|
|
1008
1071
|
"instanceDistanceEnd",
|
|
1009
|
-
new
|
|
1072
|
+
new ve(o, 1, 1)
|
|
1010
1073
|
), this;
|
|
1011
1074
|
}
|
|
1012
1075
|
raycast(e, t) {
|
|
@@ -1015,50 +1078,50 @@ class kt extends Pe {
|
|
|
1015
1078
|
'LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'
|
|
1016
1079
|
);
|
|
1017
1080
|
const o = e.params.Line2 !== void 0 && e.params.Line2.threshold || 0;
|
|
1018
|
-
|
|
1019
|
-
const c = this.matrixWorld,
|
|
1020
|
-
|
|
1021
|
-
let
|
|
1081
|
+
D = e.ray;
|
|
1082
|
+
const c = this.matrixWorld, n = this.geometry, a = this.material;
|
|
1083
|
+
L = a.linewidth + o, n.boundingSphere === null && n.computeBoundingSphere(), U.copy(n.boundingSphere).applyMatrix4(c);
|
|
1084
|
+
let h;
|
|
1022
1085
|
if (i)
|
|
1023
|
-
|
|
1086
|
+
h = L * 0.5;
|
|
1024
1087
|
else {
|
|
1025
1088
|
const u = Math.max(
|
|
1026
1089
|
s.near,
|
|
1027
|
-
U.distanceToPoint(
|
|
1090
|
+
U.distanceToPoint(D.origin)
|
|
1028
1091
|
);
|
|
1029
|
-
|
|
1092
|
+
h = Te(
|
|
1030
1093
|
s,
|
|
1031
1094
|
u,
|
|
1032
1095
|
a.resolution
|
|
1033
1096
|
);
|
|
1034
1097
|
}
|
|
1035
|
-
if (U.radius +=
|
|
1098
|
+
if (U.radius += h, D.intersectsSphere(U) === !1)
|
|
1036
1099
|
return;
|
|
1037
|
-
|
|
1038
|
-
let
|
|
1100
|
+
n.boundingBox === null && n.computeBoundingBox(), R.copy(n.boundingBox).applyMatrix4(c);
|
|
1101
|
+
let d;
|
|
1039
1102
|
if (i)
|
|
1040
|
-
|
|
1103
|
+
d = L * 0.5;
|
|
1041
1104
|
else {
|
|
1042
1105
|
const u = Math.max(
|
|
1043
1106
|
s.near,
|
|
1044
|
-
|
|
1107
|
+
R.distanceToPoint(D.origin)
|
|
1045
1108
|
);
|
|
1046
|
-
|
|
1109
|
+
d = Te(
|
|
1047
1110
|
s,
|
|
1048
1111
|
u,
|
|
1049
1112
|
a.resolution
|
|
1050
1113
|
);
|
|
1051
1114
|
}
|
|
1052
|
-
|
|
1115
|
+
R.expandByScalar(d), D.intersectsBox(R) !== !1 && (i ? St(this, t) : jt(this, s, t));
|
|
1053
1116
|
}
|
|
1054
1117
|
onBeforeRender(e) {
|
|
1055
1118
|
const t = this.material.uniforms;
|
|
1056
|
-
t && t.resolution && (e.getViewport(
|
|
1119
|
+
t && t.resolution && (e.getViewport(Z), this.material.uniforms.resolution.value.set(Z.z, Z.w));
|
|
1057
1120
|
}
|
|
1058
1121
|
}
|
|
1059
|
-
const
|
|
1122
|
+
const v = class v extends ee {
|
|
1060
1123
|
constructor(e) {
|
|
1061
|
-
super(), this.objectType = "Node", this.onNodePointerIndex = [], this.options =
|
|
1124
|
+
super(), this.objectType = "Node", this.onNodePointerIndex = [], this.options = k({
|
|
1062
1125
|
type: "2d"
|
|
1063
1126
|
}, e);
|
|
1064
1127
|
}
|
|
@@ -1079,17 +1142,17 @@ const b = class b extends Z {
|
|
|
1079
1142
|
const e = this.options.children;
|
|
1080
1143
|
if (!e) return;
|
|
1081
1144
|
const t = e.getBoundingClientRect(), i = window.innerWidth, s = window.innerHeight, o = t.width, c = t.height;
|
|
1082
|
-
let
|
|
1083
|
-
o > i ? t.left > 0 && (
|
|
1145
|
+
let n = 0, a = 0;
|
|
1146
|
+
o > i ? t.left > 0 && (n = -t.left) : t.left < 0 ? n = -t.left : t.right > i && (n = i - t.right, t.left + n < 0 && (n = -t.left)), c > s ? t.top > 0 && (a = -t.top) : t.top < 0 ? a = -t.top : t.bottom > s && (a = s - t.bottom, t.top + a < 0 && (a = -t.top)), (n !== 0 || a !== 0) && (e.style.transform = `translate(${n}px, ${a}px)`);
|
|
1084
1147
|
}
|
|
1085
1148
|
ensureVisible() {
|
|
1086
1149
|
const e = this.options.children;
|
|
1087
|
-
e && (e.style.transform && (e.style.transform = ""), !
|
|
1150
|
+
e && (e.style.transform && (e.style.transform = ""), !v.observerMap.has(e) && (v.sharedObserver || (v.sharedObserver = new IntersectionObserver((t) => {
|
|
1088
1151
|
t.forEach((i) => {
|
|
1089
|
-
const s = i.target, o =
|
|
1090
|
-
o && i.isIntersecting && (o.moveElementToViewport(),
|
|
1152
|
+
const s = i.target, o = v.observerMap.get(s);
|
|
1153
|
+
o && i.isIntersecting && (o.moveElementToViewport(), v.observerMap.delete(s), v.sharedObserver && (v.sharedObserver.unobserve(s), v.observerMap.size === 0 && (v.sharedObserver.disconnect(), v.sharedObserver = void 0)));
|
|
1091
1154
|
});
|
|
1092
|
-
})),
|
|
1155
|
+
})), v.observerMap.set(e, this), v.sharedObserver.observe(e)));
|
|
1093
1156
|
}
|
|
1094
1157
|
onPointerEvent(e, t) {
|
|
1095
1158
|
const i = this.lead.handlePickNode([this], e, t);
|
|
@@ -1097,21 +1160,21 @@ const b = class b extends Z {
|
|
|
1097
1160
|
}
|
|
1098
1161
|
dispose() {
|
|
1099
1162
|
const e = this.options.children;
|
|
1100
|
-
e &&
|
|
1163
|
+
e && v.sharedObserver && (v.observerMap.delete(e), v.sharedObserver.unobserve(e), v.observerMap.size === 0 && (v.sharedObserver.disconnect(), v.sharedObserver = void 0)), this.onNodePointerIndex.forEach((t) => {
|
|
1101
1164
|
this.lead.removePickNode(t);
|
|
1102
1165
|
}), super.dispose();
|
|
1103
1166
|
}
|
|
1104
1167
|
};
|
|
1105
|
-
|
|
1106
|
-
let
|
|
1168
|
+
v.observerMap = /* @__PURE__ */ new Map();
|
|
1169
|
+
let Be = v;
|
|
1107
1170
|
export {
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1171
|
+
xe as B,
|
|
1172
|
+
Nt as I,
|
|
1173
|
+
Gt as L,
|
|
1174
|
+
Ut as M,
|
|
1175
|
+
Be as N,
|
|
1176
|
+
Rt as P,
|
|
1177
|
+
lt as R,
|
|
1178
|
+
ee as a,
|
|
1179
|
+
Mt as g
|
|
1117
1180
|
};
|