gl-draw 0.17.0-beta.36 → 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 +325 -320
- package/dist/index2.js +4 -4
- 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/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/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
|
-
|
|
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
11
|
return r;
|
|
12
|
-
}, X = (r, e) =>
|
|
13
|
-
var
|
|
12
|
+
}, X = (r, e) => Ne(r, Re(e));
|
|
13
|
+
var le = (r, e) => {
|
|
14
14
|
var t = {};
|
|
15
15
|
for (var i in r)
|
|
16
|
-
|
|
17
|
-
if (r != null &&
|
|
18
|
-
for (var i of
|
|
19
|
-
e.indexOf(i) < 0 &&
|
|
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
25
|
n(t.next(a));
|
|
26
|
-
} catch (
|
|
27
|
-
s(
|
|
26
|
+
} catch (h) {
|
|
27
|
+
s(h);
|
|
28
28
|
}
|
|
29
29
|
}, c = (a) => {
|
|
30
30
|
try {
|
|
31
31
|
n(t.throw(a));
|
|
32
|
-
} catch (
|
|
33
|
-
s(
|
|
32
|
+
} catch (h) {
|
|
33
|
+
s(h);
|
|
34
34
|
}
|
|
35
35
|
}, n = (a) => a.done ? i(a.value) : Promise.resolve(a.value).then(o, c);
|
|
36
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 ct {
|
|
|
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
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);
|
|
@@ -91,17 +91,17 @@ class ct {
|
|
|
91
91
|
}), e.length = 0, this.resources.clear();
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
const
|
|
95
|
-
function
|
|
94
|
+
const we = /* @__PURE__ */ new De(), We = /* @__PURE__ */ new $e(), Y = /* @__PURE__ */ new ze(), N = /* @__PURE__ */ new S();
|
|
95
|
+
function ut(r, e) {
|
|
96
96
|
const t = this.geometry, i = this.matrixWorld, s = r.params.Points.threshold, o = t.drawRange;
|
|
97
|
-
t.boundingSphere === null && t.computeBoundingSphere(),
|
|
98
|
-
const c = s / ((this.scale.x + this.scale.y + this.scale.z) / 3), n = t.index,
|
|
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
99
|
if (n !== null) {
|
|
100
|
-
const
|
|
101
|
-
for (let
|
|
102
|
-
const p = n.getX(
|
|
103
|
-
|
|
104
|
-
|
|
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
105
|
p,
|
|
106
106
|
c,
|
|
107
107
|
i,
|
|
@@ -111,14 +111,14 @@ function lt(r, e) {
|
|
|
111
111
|
);
|
|
112
112
|
}
|
|
113
113
|
} else {
|
|
114
|
-
const
|
|
115
|
-
|
|
114
|
+
const d = Math.max(0, o.start), u = Math.min(
|
|
115
|
+
h.count,
|
|
116
116
|
o.start + o.count
|
|
117
117
|
);
|
|
118
|
-
for (let
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
118
|
+
for (let f = d, l = u; f < l; f++)
|
|
119
|
+
N.fromBufferAttribute(h, f), Se(
|
|
120
|
+
N,
|
|
121
|
+
f,
|
|
122
122
|
c,
|
|
123
123
|
i,
|
|
124
124
|
r,
|
|
@@ -127,19 +127,19 @@ function lt(r, e) {
|
|
|
127
127
|
);
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function Se(r, e, t, i, s, o, c) {
|
|
131
131
|
const n = new S();
|
|
132
|
-
|
|
133
|
-
const a = s.ray.origin.distanceTo(r),
|
|
134
|
-
|
|
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
135
|
);
|
|
136
|
-
if (
|
|
136
|
+
if (d < t) {
|
|
137
137
|
if (a < s.near || a > s.far)
|
|
138
138
|
return;
|
|
139
139
|
o.push({
|
|
140
140
|
distance: a,
|
|
141
|
-
distanceToRay:
|
|
142
|
-
angleToRay:
|
|
141
|
+
distanceToRay: h,
|
|
142
|
+
angleToRay: d,
|
|
143
143
|
point: n,
|
|
144
144
|
index: e,
|
|
145
145
|
face: null,
|
|
@@ -147,8 +147,8 @@ function we(r, e, t, i, s, o, c) {
|
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
|
-
const
|
|
151
|
-
const t = new
|
|
150
|
+
const ht = (r, e = 1) => {
|
|
151
|
+
const t = new se();
|
|
152
152
|
t.setAttribute(
|
|
153
153
|
"position",
|
|
154
154
|
new $(new Array(e * 3).fill(0), 3)
|
|
@@ -156,7 +156,7 @@ const ut = (r, e = 1) => {
|
|
|
156
156
|
"scaleAtt",
|
|
157
157
|
new $(new Array(e).fill(1), 1)
|
|
158
158
|
);
|
|
159
|
-
const i = r.material, s = new
|
|
159
|
+
const i = r.material, s = new Fe({
|
|
160
160
|
size: 10,
|
|
161
161
|
map: i.map,
|
|
162
162
|
alphaMap: i.alphaMap,
|
|
@@ -178,23 +178,23 @@ const ut = (r, e = 1) => {
|
|
|
178
178
|
)}
|
|
179
179
|
`;
|
|
180
180
|
};
|
|
181
|
-
const o = new
|
|
182
|
-
return o.raycast =
|
|
183
|
-
},
|
|
181
|
+
const o = new ne(t, s);
|
|
182
|
+
return o.raycast = ut, o;
|
|
183
|
+
}, dt = (r, e) => {
|
|
184
184
|
const t = new G();
|
|
185
185
|
e.forEach((i, s) => {
|
|
186
|
-
const o =
|
|
186
|
+
const o = be(i.position), c = be(i.scale || [1, 1, 1]);
|
|
187
187
|
t.position.copy(o), t.scale.copy(c), t.updateMatrix();
|
|
188
188
|
const n = t.matrix.clone();
|
|
189
|
-
if (r instanceof
|
|
189
|
+
if (r instanceof Ee || r.isInstantiate)
|
|
190
190
|
r.setMatrixAt(s, n);
|
|
191
|
-
else if (r instanceof
|
|
192
|
-
const
|
|
193
|
-
n.decompose(
|
|
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;
|
|
194
194
|
}
|
|
195
195
|
});
|
|
196
196
|
};
|
|
197
|
-
class
|
|
197
|
+
class ft {
|
|
198
198
|
constructor() {
|
|
199
199
|
this.onPointerIndex = [];
|
|
200
200
|
}
|
|
@@ -226,7 +226,7 @@ class dt {
|
|
|
226
226
|
});
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
|
-
class
|
|
229
|
+
class pt extends ft {
|
|
230
230
|
constructor() {
|
|
231
231
|
super(...arguments), this.userData = {}, this.materialList = {}, this.useMaterialType = "origin", this.disposeMaterialIfNotUsed = !0;
|
|
232
232
|
}
|
|
@@ -284,7 +284,7 @@ class ft extends dt {
|
|
|
284
284
|
);
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
|
-
class
|
|
287
|
+
class ee extends pt {
|
|
288
288
|
constructor() {
|
|
289
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;
|
|
290
290
|
}
|
|
@@ -352,7 +352,7 @@ class H extends ft {
|
|
|
352
352
|
*/
|
|
353
353
|
_disableLayersRecursive() {
|
|
354
354
|
var e;
|
|
355
|
-
(e = this.object3d) == null || e.layers.disable(
|
|
355
|
+
(e = this.object3d) == null || e.layers.disable(Me), this.children.forEach((t) => {
|
|
356
356
|
t._disableLayersRecursive();
|
|
357
357
|
});
|
|
358
358
|
}
|
|
@@ -361,30 +361,30 @@ class H extends ft {
|
|
|
361
361
|
*/
|
|
362
362
|
_enableLayersRecursive() {
|
|
363
363
|
var e;
|
|
364
|
-
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) => {
|
|
365
365
|
t._enableLayersRecursive();
|
|
366
366
|
}));
|
|
367
367
|
}
|
|
368
368
|
createGroup() {
|
|
369
|
-
return this.object3d = new
|
|
369
|
+
return this.object3d = new Xe(), this;
|
|
370
370
|
}
|
|
371
371
|
createMesh(...e) {
|
|
372
|
-
return this.object3d = new
|
|
372
|
+
return this.object3d = new Le(...e), this;
|
|
373
373
|
}
|
|
374
374
|
createPoints(...e) {
|
|
375
|
-
return this.object3d = new
|
|
375
|
+
return this.object3d = new ne(...e), this;
|
|
376
376
|
}
|
|
377
377
|
createCSS2DObject(e) {
|
|
378
|
-
return this.object3d = new
|
|
378
|
+
return this.object3d = new ot(e), this;
|
|
379
379
|
}
|
|
380
380
|
createCSS3DObject(e) {
|
|
381
|
-
return this.object3d = new
|
|
381
|
+
return this.object3d = new at(e), this;
|
|
382
382
|
}
|
|
383
383
|
createCSS3DSprite(e) {
|
|
384
|
-
return this.object3d = new
|
|
384
|
+
return this.object3d = new ct(e), this;
|
|
385
385
|
}
|
|
386
386
|
createSprite(e) {
|
|
387
|
-
return this.object3d = new
|
|
387
|
+
return this.object3d = new pe(e), this;
|
|
388
388
|
}
|
|
389
389
|
attach(...e) {
|
|
390
390
|
return [...e].forEach((t) => {
|
|
@@ -392,7 +392,7 @@ class H extends ft {
|
|
|
392
392
|
}), this;
|
|
393
393
|
}
|
|
394
394
|
getSize() {
|
|
395
|
-
const e = new
|
|
395
|
+
const e = new ke().setFromObject(this.object3d);
|
|
396
396
|
return {
|
|
397
397
|
min: e.min,
|
|
398
398
|
max: e.max,
|
|
@@ -409,28 +409,28 @@ class H extends ft {
|
|
|
409
409
|
});
|
|
410
410
|
}
|
|
411
411
|
instantiate(e) {
|
|
412
|
-
return
|
|
413
|
-
var
|
|
414
|
-
const t = (
|
|
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
415
|
let c = e == null ? void 0 : e.create, n, a = (e == null ? void 0 : e.target) || this.parent;
|
|
416
416
|
return a === this.lead.prefabGroup && (a = this.lead.group), this.objectType === "BaseObject" ? n = this.lead.createBaseObject(this.object3d.clone(!1), {
|
|
417
417
|
target: a
|
|
418
418
|
}) : (c === void 0 && (c = (u) => {
|
|
419
|
-
var
|
|
419
|
+
var f;
|
|
420
420
|
if (this.object3d) {
|
|
421
|
-
if ((
|
|
422
|
-
const
|
|
423
|
-
if (this.object3d instanceof
|
|
424
|
-
u.object3d =
|
|
421
|
+
if ((f = e == null ? void 0 : e.instancedAttr) != null && f.length) {
|
|
422
|
+
const l = e.instancedAttr.length;
|
|
423
|
+
if (this.object3d instanceof pe)
|
|
424
|
+
u.object3d = ht(this.object3d, l);
|
|
425
425
|
else {
|
|
426
426
|
const p = this.object3d, m = i ? this.cloneMaterial() : p.material;
|
|
427
|
-
u.object3d = new
|
|
427
|
+
u.object3d = new Ee(
|
|
428
428
|
p.geometry,
|
|
429
429
|
m,
|
|
430
|
-
|
|
430
|
+
l
|
|
431
431
|
);
|
|
432
432
|
}
|
|
433
|
-
|
|
433
|
+
dt(u.object3d, e == null ? void 0 : e.instancedAttr);
|
|
434
434
|
} else
|
|
435
435
|
u.object3d = this.object3d.clone(!1), i && u.object3d.material && (u.object3d.material = this.cloneMaterial());
|
|
436
436
|
u.object3d.userData.prefab && delete u.object3d.userData.prefab;
|
|
@@ -471,7 +471,7 @@ class H extends ft {
|
|
|
471
471
|
});
|
|
472
472
|
return;
|
|
473
473
|
}
|
|
474
|
-
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;
|
|
475
475
|
}
|
|
476
476
|
disableBloom(e = !0) {
|
|
477
477
|
var t, i, s;
|
|
@@ -485,228 +485,235 @@ class H extends ft {
|
|
|
485
485
|
});
|
|
486
486
|
return;
|
|
487
487
|
}
|
|
488
|
-
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;
|
|
489
489
|
}
|
|
490
490
|
dispose() {
|
|
491
491
|
var e, t;
|
|
492
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)) {
|
|
493
|
-
const i = new
|
|
493
|
+
const i = new lt();
|
|
494
494
|
i.disposeMaterial = !1, i.track(this), i.dispose();
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
497
|
}
|
|
498
|
-
function
|
|
498
|
+
function mt(r, e) {
|
|
499
499
|
return r.map((t) => {
|
|
500
500
|
const i = [];
|
|
501
501
|
let s;
|
|
502
502
|
return t.forEach((o) => {
|
|
503
503
|
if (s) {
|
|
504
|
-
const c =
|
|
504
|
+
const c = it(o, s) * 180 / Math.PI;
|
|
505
505
|
if (c > e) {
|
|
506
|
-
const n =
|
|
507
|
-
let
|
|
508
|
-
for (;
|
|
509
|
-
i.push(n(
|
|
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;
|
|
510
510
|
}
|
|
511
511
|
}
|
|
512
512
|
i.push(s = o);
|
|
513
513
|
}), i;
|
|
514
514
|
});
|
|
515
515
|
}
|
|
516
|
-
function
|
|
517
|
-
const o = Math.round(
|
|
518
|
-
s !== void 0 ? Math.ceil(
|
|
519
|
-
i !== void 0 ? Math.floor(
|
|
520
|
-
], u = e === void 0 && t === void 0 ? () => !0 : e === void 0 ? (
|
|
521
|
-
for (let
|
|
522
|
-
const p = n(
|
|
523
|
-
u(p) &&
|
|
524
|
-
}
|
|
525
|
-
return
|
|
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)]);
|
|
524
|
+
}
|
|
525
|
+
return f;
|
|
526
526
|
}
|
|
527
|
-
function
|
|
528
|
-
return t ?
|
|
527
|
+
function te(r, e, t = !1) {
|
|
528
|
+
return t ? tt(e, r) : et(r, e);
|
|
529
529
|
}
|
|
530
|
-
function
|
|
531
|
-
const t = { type: "Polygon", coordinates: r }, [[i, s], [o, c]] =
|
|
530
|
+
function bt(r, e) {
|
|
531
|
+
const t = { type: "Polygon", coordinates: r }, [[i, s], [o, c]] = Ve(t);
|
|
532
532
|
if (Math.min(Math.abs(o - i), Math.abs(c - s)) < e)
|
|
533
533
|
return [];
|
|
534
534
|
const n = i > o || c >= 89 || s <= -89;
|
|
535
|
-
return
|
|
535
|
+
return vt(e, {
|
|
536
536
|
minLng: i,
|
|
537
537
|
maxLng: o,
|
|
538
538
|
minLat: s,
|
|
539
539
|
maxLat: c
|
|
540
540
|
}).filter(
|
|
541
|
-
(a) =>
|
|
541
|
+
(a) => te(a, t, n)
|
|
542
542
|
);
|
|
543
543
|
}
|
|
544
|
-
function
|
|
545
|
-
const s =
|
|
546
|
-
|
|
547
|
-
|
|
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
|
|
546
|
+
f >= 89 || // crosses north pole
|
|
547
|
+
d <= -89;
|
|
548
548
|
let p = [];
|
|
549
|
-
if (
|
|
550
|
-
const y =
|
|
551
|
-
n.map(([
|
|
549
|
+
if (l) {
|
|
550
|
+
const y = nt(n).triangles(), w = new Map(
|
|
551
|
+
n.map(([I, T], E) => [`${I}-${T}`, E])
|
|
552
552
|
);
|
|
553
|
-
y.features.forEach((
|
|
554
|
-
const
|
|
555
|
-
if (
|
|
556
|
-
const
|
|
557
|
-
|
|
558
|
-
}),
|
|
559
|
-
if (
|
|
560
|
-
const
|
|
561
|
-
if (!
|
|
562
|
-
|
|
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,
|
|
563
563
|
a,
|
|
564
|
-
|
|
564
|
+
l
|
|
565
565
|
))
|
|
566
566
|
return;
|
|
567
567
|
}
|
|
568
|
-
p.push(...
|
|
568
|
+
p.push(...E);
|
|
569
569
|
}
|
|
570
570
|
});
|
|
571
571
|
} else if (c.length) {
|
|
572
|
-
const y =
|
|
573
|
-
for (let
|
|
574
|
-
const
|
|
575
|
-
if (
|
|
576
|
-
const
|
|
577
|
-
(q) =>
|
|
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])
|
|
578
578
|
);
|
|
579
|
-
if (!
|
|
580
|
-
|
|
579
|
+
if (!te(
|
|
580
|
+
A,
|
|
581
581
|
a,
|
|
582
|
-
|
|
582
|
+
l
|
|
583
583
|
))
|
|
584
584
|
continue;
|
|
585
585
|
}
|
|
586
|
-
p.push(...
|
|
586
|
+
p.push(...T);
|
|
587
587
|
}
|
|
588
588
|
} else {
|
|
589
|
-
const { vertices: y, holes:
|
|
590
|
-
p =
|
|
589
|
+
const { vertices: y, holes: w = [] } = Oe(s);
|
|
590
|
+
p = Ge(y, w, 2);
|
|
591
591
|
}
|
|
592
|
-
let m = t ? [t[0], t[2]] :
|
|
592
|
+
let m = t ? [t[0], t[2]] : he(n, (y) => y[0]), b = t ? [t[1], t[3]] : he(n, (y) => y[1]);
|
|
593
593
|
if (i) {
|
|
594
|
-
const [y,
|
|
595
|
-
m = [y,
|
|
594
|
+
const [y, w] = i([m[0], b[0]]), [I, T] = i([m[1], b[1]]);
|
|
595
|
+
m = [y, I], b = [-w, -T];
|
|
596
596
|
}
|
|
597
|
-
const j =
|
|
597
|
+
const j = ge(m, [0, 1]), z = ge(b, [0, 1]), C = n.map(([y, w]) => {
|
|
598
598
|
if (i) {
|
|
599
|
-
const [
|
|
600
|
-
return [j(
|
|
599
|
+
const [I, T] = i([y, w]);
|
|
600
|
+
return [j(I), z(-T)];
|
|
601
601
|
} else
|
|
602
|
-
return [j(y),
|
|
602
|
+
return [j(y), z(w)];
|
|
603
603
|
});
|
|
604
|
-
return { contour: s, triangles: { points: n, indices: p, uvs:
|
|
604
|
+
return { contour: s, triangles: { points: n, indices: p, uvs: C } };
|
|
605
605
|
}
|
|
606
|
-
const
|
|
607
|
-
function F(r, e, t
|
|
608
|
-
const
|
|
609
|
-
(
|
|
610
|
-
if (
|
|
611
|
-
const
|
|
612
|
-
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
613
|
}
|
|
614
|
-
|
|
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];
|
|
627
|
+
}
|
|
628
|
+
return [o, c, e];
|
|
615
629
|
})
|
|
616
630
|
);
|
|
617
|
-
return
|
|
631
|
+
return Oe(i);
|
|
618
632
|
}
|
|
619
|
-
function
|
|
620
|
-
const { vertices:
|
|
633
|
+
function gt(r, e, t, i) {
|
|
634
|
+
const { vertices: s, holes: o } = F(
|
|
621
635
|
r,
|
|
622
636
|
e,
|
|
623
|
-
i
|
|
624
|
-
|
|
625
|
-
), { vertices: n } = F(
|
|
637
|
+
i
|
|
638
|
+
), { vertices: c } = F(
|
|
626
639
|
r,
|
|
627
640
|
t,
|
|
628
|
-
i
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
m = 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;
|
|
640
652
|
}
|
|
641
|
-
|
|
653
|
+
u.push(l, l + a, p + a), u.push(p + a, p, l);
|
|
642
654
|
}
|
|
643
|
-
const
|
|
644
|
-
for (let
|
|
645
|
-
for (let
|
|
646
|
-
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 };
|
|
647
659
|
}
|
|
648
|
-
function
|
|
660
|
+
function Ce(r, e, t, i, s) {
|
|
649
661
|
return {
|
|
650
662
|
indices: i ? r.indices : r.indices.slice().reverse(),
|
|
651
663
|
vertices: F(
|
|
652
664
|
[r.points],
|
|
653
665
|
e,
|
|
654
|
-
s
|
|
655
|
-
o
|
|
666
|
+
s
|
|
656
667
|
).vertices,
|
|
657
668
|
uvs: t
|
|
658
669
|
};
|
|
659
670
|
}
|
|
660
|
-
const
|
|
671
|
+
const Mt = ({
|
|
661
672
|
polygonGeoJson: r,
|
|
662
673
|
startHeight: e,
|
|
663
674
|
endHeight: t,
|
|
664
675
|
curvatureResolution: i = 1,
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
bbox: l
|
|
676
|
+
hasSide: s = !0,
|
|
677
|
+
hasBottom: o = !1,
|
|
678
|
+
hasTop: c = !1,
|
|
679
|
+
projection: n = "sphere",
|
|
680
|
+
bbox: a
|
|
671
681
|
}) => {
|
|
672
682
|
r.forEach((j) => {
|
|
673
|
-
|
|
683
|
+
Je(j) || j.reverse();
|
|
674
684
|
});
|
|
675
|
-
const { contour:
|
|
685
|
+
const h = typeof n == "function" ? n : void 0, { contour: d, triangles: u } = yt(r, {
|
|
676
686
|
resolution: i,
|
|
677
|
-
bbox:
|
|
678
|
-
projection:
|
|
687
|
+
bbox: a,
|
|
688
|
+
projection: h
|
|
679
689
|
});
|
|
680
|
-
let
|
|
681
|
-
|
|
682
|
-
|
|
690
|
+
let f = {}, l;
|
|
691
|
+
s && (f = gt(
|
|
692
|
+
d,
|
|
683
693
|
e != null ? e : t,
|
|
684
694
|
t != null ? t : e,
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
), h = d.topVerts);
|
|
695
|
+
n
|
|
696
|
+
), l = f.topVerts);
|
|
688
697
|
let p = [];
|
|
689
|
-
(
|
|
698
|
+
(o || c) && (p = ie(u.uvs));
|
|
690
699
|
let m = {};
|
|
691
|
-
|
|
700
|
+
o && (m = Ce(
|
|
692
701
|
u,
|
|
693
702
|
e,
|
|
694
703
|
p,
|
|
695
704
|
!1,
|
|
696
|
-
|
|
697
|
-
a
|
|
705
|
+
n
|
|
698
706
|
));
|
|
699
|
-
let
|
|
700
|
-
return
|
|
707
|
+
let b = {};
|
|
708
|
+
return c && (b = Ce(
|
|
701
709
|
u,
|
|
702
710
|
t,
|
|
703
711
|
p,
|
|
704
712
|
!0,
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
)), { contour: f, triangles: u, sideTorso: d, bottomCap: m, topCap: v, topVerts: h };
|
|
713
|
+
n
|
|
714
|
+
)), { contour: d, triangles: u, sideTorso: f, bottomCap: m, topCap: b, topVerts: l };
|
|
708
715
|
};
|
|
709
|
-
class
|
|
716
|
+
class Rt extends se {
|
|
710
717
|
constructor(e, t = {}) {
|
|
711
718
|
super(), this.type = "PolygonBufferGeometry", this.parameters = k({
|
|
712
719
|
polygonGeoJson: e,
|
|
@@ -717,7 +724,7 @@ class Wt extends ie {
|
|
|
717
724
|
hasBottom: !0,
|
|
718
725
|
hasSide: !0,
|
|
719
726
|
curvatureResolution: 1,
|
|
720
|
-
|
|
727
|
+
projection: "sphere",
|
|
721
728
|
userDataRsoOffset: 0
|
|
722
729
|
}, t);
|
|
723
730
|
const {
|
|
@@ -726,26 +733,24 @@ class Wt extends ie {
|
|
|
726
733
|
topFirst: o,
|
|
727
734
|
hasBottom: c,
|
|
728
735
|
hasSide: n,
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
), this.addGroup(A, C.length - A, B++);
|
|
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++);
|
|
739
745
|
};
|
|
740
|
-
s && o &&
|
|
741
|
-
|
|
742
|
-
i +
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
).vertices : h), c && P(p), s && !o && P(m), this.setIndex(C), this[xe]("position", new $(v, 3)), this[xe]("uv", new $(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();
|
|
746
751
|
}
|
|
747
752
|
}
|
|
748
|
-
const
|
|
753
|
+
const xt = `
|
|
749
754
|
#include <fog_pars_fragment>
|
|
750
755
|
#include <logdepthbuf_pars_fragment>
|
|
751
756
|
|
|
@@ -882,9 +887,9 @@ void main() {
|
|
|
882
887
|
#include <fog_vertex>
|
|
883
888
|
}
|
|
884
889
|
`;
|
|
885
|
-
class
|
|
890
|
+
class Ut extends Ke {
|
|
886
891
|
constructor(e = {}) {
|
|
887
|
-
const
|
|
892
|
+
const z = e, {
|
|
888
893
|
lineWidth: t = 1,
|
|
889
894
|
color: i = "#ffffff",
|
|
890
895
|
opacity: s = 1,
|
|
@@ -892,15 +897,15 @@ class Rt extends qe {
|
|
|
892
897
|
dashOffset: c = 0,
|
|
893
898
|
dashArray: n = 0,
|
|
894
899
|
dashRatio: a = 0,
|
|
895
|
-
sizeAttenuation:
|
|
896
|
-
offsetLoop:
|
|
900
|
+
sizeAttenuation: h = !0,
|
|
901
|
+
offsetLoop: d = !0,
|
|
897
902
|
offset: u = new K(0, 0),
|
|
898
|
-
scaleDown:
|
|
899
|
-
alphaMap:
|
|
903
|
+
scaleDown: f = 0,
|
|
904
|
+
alphaMap: l = void 0,
|
|
900
905
|
alphaTest: p = 0,
|
|
901
906
|
repeat: m = new K(1, 1),
|
|
902
|
-
resolution:
|
|
903
|
-
} =
|
|
907
|
+
resolution: b = new K(1, 1)
|
|
908
|
+
} = z, j = le(z, [
|
|
904
909
|
"lineWidth",
|
|
905
910
|
"color",
|
|
906
911
|
"opacity",
|
|
@@ -920,26 +925,26 @@ class Rt extends qe {
|
|
|
920
925
|
super(X(k({}, j), {
|
|
921
926
|
uniforms: {
|
|
922
927
|
lineWidth: { value: t },
|
|
923
|
-
color: { value: new
|
|
928
|
+
color: { value: new me(i) },
|
|
924
929
|
opacity: { value: s },
|
|
925
930
|
map: { value: o },
|
|
926
931
|
useMap: { value: o ? 1 : 0 },
|
|
927
|
-
resolution: { value:
|
|
928
|
-
sizeAttenuation: { value:
|
|
932
|
+
resolution: { value: b },
|
|
933
|
+
sizeAttenuation: { value: h ? 1 : 0 },
|
|
929
934
|
offset: { value: u },
|
|
930
|
-
offsetLoop: { value:
|
|
935
|
+
offsetLoop: { value: d ? 1 : 0 },
|
|
931
936
|
dashArray: { value: n },
|
|
932
937
|
dashOffset: { value: c },
|
|
933
938
|
dashRatio: { value: a },
|
|
934
939
|
useDash: { value: n > 0 ? 1 : 0 },
|
|
935
|
-
scaleDown: { value:
|
|
940
|
+
scaleDown: { value: f / 10 },
|
|
936
941
|
alphaTest: { value: p },
|
|
937
|
-
alphaMap: { value:
|
|
938
|
-
useAlphaMap: { value:
|
|
942
|
+
alphaMap: { value: l },
|
|
943
|
+
useAlphaMap: { value: l ? 1 : 0 },
|
|
939
944
|
repeat: { value: m }
|
|
940
945
|
},
|
|
941
946
|
vertexShader: wt,
|
|
942
|
-
fragmentShader:
|
|
947
|
+
fragmentShader: xt
|
|
943
948
|
})), this.type = "MeshLineMaterial";
|
|
944
949
|
}
|
|
945
950
|
// Getter and setter for color
|
|
@@ -947,7 +952,7 @@ class Rt extends qe {
|
|
|
947
952
|
return this.uniforms.color.value;
|
|
948
953
|
}
|
|
949
954
|
set color(e) {
|
|
950
|
-
this.uniforms.color.value = new
|
|
955
|
+
this.uniforms.color.value = new me(e);
|
|
951
956
|
}
|
|
952
957
|
get opacity() {
|
|
953
958
|
var e;
|
|
@@ -990,20 +995,20 @@ class Rt extends qe {
|
|
|
990
995
|
this.uniforms.sizeAttenuation.value = e ? 1 : 0;
|
|
991
996
|
}
|
|
992
997
|
}
|
|
993
|
-
const
|
|
994
|
-
let
|
|
995
|
-
function
|
|
996
|
-
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));
|
|
997
1002
|
}
|
|
998
|
-
function
|
|
1003
|
+
function St(r, e) {
|
|
999
1004
|
const t = r.matrixWorld, i = r.geometry, s = i.attributes.instanceStart, o = i.attributes.instanceEnd, c = Math.min(i.instanceCount, s.count);
|
|
1000
1005
|
for (let n = 0, a = c; n < a; n++) {
|
|
1001
|
-
|
|
1002
|
-
const
|
|
1003
|
-
|
|
1004
|
-
point:
|
|
1005
|
-
pointOnLine:
|
|
1006
|
-
distance:
|
|
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),
|
|
1007
1012
|
object: r,
|
|
1008
1013
|
face: null,
|
|
1009
1014
|
faceIndex: n,
|
|
@@ -1012,59 +1017,59 @@ function xt(r, e) {
|
|
|
1012
1017
|
});
|
|
1013
1018
|
}
|
|
1014
1019
|
}
|
|
1015
|
-
function
|
|
1016
|
-
const i = e.projectionMatrix, o = r.material.resolution, c = r.matrixWorld, n = r.geometry, a = n.attributes.instanceStart,
|
|
1017
|
-
|
|
1018
|
-
for (let
|
|
1019
|
-
if (g.fromBufferAttribute(a,
|
|
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)
|
|
1020
1025
|
continue;
|
|
1021
1026
|
if (g.z > u) {
|
|
1022
|
-
const
|
|
1027
|
+
const C = g.z - M.z, P = (g.z - u) / C;
|
|
1023
1028
|
g.lerp(M, P);
|
|
1024
1029
|
} else if (M.z > u) {
|
|
1025
|
-
const
|
|
1030
|
+
const C = M.z - g.z, P = (M.z - u) / C;
|
|
1026
1031
|
M.lerp(g, P);
|
|
1027
1032
|
}
|
|
1028
|
-
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,
|
|
1029
|
-
const m =
|
|
1030
|
-
|
|
1031
|
-
const
|
|
1032
|
-
if (j &&
|
|
1033
|
-
|
|
1034
|
-
const
|
|
1035
|
-
|
|
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({
|
|
1036
1041
|
point: P,
|
|
1037
|
-
pointOnLine:
|
|
1038
|
-
distance:
|
|
1042
|
+
pointOnLine: C,
|
|
1043
|
+
distance: D.origin.distanceTo(P),
|
|
1039
1044
|
object: r,
|
|
1040
1045
|
face: null,
|
|
1041
|
-
faceIndex:
|
|
1046
|
+
faceIndex: f,
|
|
1042
1047
|
uv: null,
|
|
1043
1048
|
uv1: null
|
|
1044
1049
|
});
|
|
1045
1050
|
}
|
|
1046
1051
|
}
|
|
1047
1052
|
}
|
|
1048
|
-
class
|
|
1049
|
-
constructor(e = new
|
|
1053
|
+
class Gt extends Le {
|
|
1054
|
+
constructor(e = new rt(), t) {
|
|
1050
1055
|
super(e, t), this.isLineSegments2 = !0, this.type = "LineSegments2";
|
|
1051
1056
|
}
|
|
1052
1057
|
// for backwards-compatibility, but could be a method of LineSegmentsGeometry...
|
|
1053
1058
|
computeLineDistances() {
|
|
1054
1059
|
const e = this.geometry, t = e.attributes.instanceStart, i = e.attributes.instanceEnd, s = new Float32Array(2 * t.count);
|
|
1055
1060
|
for (let c = 0, n = 0, a = t.count; c < a; c++, n += 2)
|
|
1056
|
-
|
|
1057
|
-
const o = new
|
|
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(
|
|
1058
1063
|
s,
|
|
1059
1064
|
2,
|
|
1060
1065
|
1
|
|
1061
1066
|
);
|
|
1062
1067
|
return e.setAttribute(
|
|
1063
1068
|
"instanceDistanceStart",
|
|
1064
|
-
new
|
|
1069
|
+
new ve(o, 1, 0)
|
|
1065
1070
|
), e.setAttribute(
|
|
1066
1071
|
"instanceDistanceEnd",
|
|
1067
|
-
new
|
|
1072
|
+
new ve(o, 1, 1)
|
|
1068
1073
|
), this;
|
|
1069
1074
|
}
|
|
1070
1075
|
raycast(e, t) {
|
|
@@ -1073,48 +1078,48 @@ class Ut extends Ee {
|
|
|
1073
1078
|
'LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'
|
|
1074
1079
|
);
|
|
1075
1080
|
const o = e.params.Line2 !== void 0 && e.params.Line2.threshold || 0;
|
|
1076
|
-
|
|
1081
|
+
D = e.ray;
|
|
1077
1082
|
const c = this.matrixWorld, n = this.geometry, a = this.material;
|
|
1078
1083
|
L = a.linewidth + o, n.boundingSphere === null && n.computeBoundingSphere(), U.copy(n.boundingSphere).applyMatrix4(c);
|
|
1079
|
-
let
|
|
1084
|
+
let h;
|
|
1080
1085
|
if (i)
|
|
1081
|
-
|
|
1086
|
+
h = L * 0.5;
|
|
1082
1087
|
else {
|
|
1083
1088
|
const u = Math.max(
|
|
1084
1089
|
s.near,
|
|
1085
|
-
U.distanceToPoint(
|
|
1090
|
+
U.distanceToPoint(D.origin)
|
|
1086
1091
|
);
|
|
1087
|
-
|
|
1092
|
+
h = Te(
|
|
1088
1093
|
s,
|
|
1089
1094
|
u,
|
|
1090
1095
|
a.resolution
|
|
1091
1096
|
);
|
|
1092
1097
|
}
|
|
1093
|
-
if (U.radius +=
|
|
1098
|
+
if (U.radius += h, D.intersectsSphere(U) === !1)
|
|
1094
1099
|
return;
|
|
1095
1100
|
n.boundingBox === null && n.computeBoundingBox(), R.copy(n.boundingBox).applyMatrix4(c);
|
|
1096
|
-
let
|
|
1101
|
+
let d;
|
|
1097
1102
|
if (i)
|
|
1098
|
-
|
|
1103
|
+
d = L * 0.5;
|
|
1099
1104
|
else {
|
|
1100
1105
|
const u = Math.max(
|
|
1101
1106
|
s.near,
|
|
1102
|
-
R.distanceToPoint(
|
|
1107
|
+
R.distanceToPoint(D.origin)
|
|
1103
1108
|
);
|
|
1104
|
-
|
|
1109
|
+
d = Te(
|
|
1105
1110
|
s,
|
|
1106
1111
|
u,
|
|
1107
1112
|
a.resolution
|
|
1108
1113
|
);
|
|
1109
1114
|
}
|
|
1110
|
-
R.expandByScalar(
|
|
1115
|
+
R.expandByScalar(d), D.intersectsBox(R) !== !1 && (i ? St(this, t) : jt(this, s, t));
|
|
1111
1116
|
}
|
|
1112
1117
|
onBeforeRender(e) {
|
|
1113
1118
|
const t = this.material.uniforms;
|
|
1114
|
-
t && t.resolution && (e.getViewport(
|
|
1119
|
+
t && t.resolution && (e.getViewport(Z), this.material.uniforms.resolution.value.set(Z.z, Z.w));
|
|
1115
1120
|
}
|
|
1116
1121
|
}
|
|
1117
|
-
const
|
|
1122
|
+
const v = class v extends ee {
|
|
1118
1123
|
constructor(e) {
|
|
1119
1124
|
super(), this.objectType = "Node", this.onNodePointerIndex = [], this.options = k({
|
|
1120
1125
|
type: "2d"
|
|
@@ -1142,12 +1147,12 @@ const b = class b extends H {
|
|
|
1142
1147
|
}
|
|
1143
1148
|
ensureVisible() {
|
|
1144
1149
|
const e = this.options.children;
|
|
1145
|
-
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) => {
|
|
1146
1151
|
t.forEach((i) => {
|
|
1147
|
-
const s = i.target, o =
|
|
1148
|
-
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)));
|
|
1149
1154
|
});
|
|
1150
|
-
})),
|
|
1155
|
+
})), v.observerMap.set(e, this), v.sharedObserver.observe(e)));
|
|
1151
1156
|
}
|
|
1152
1157
|
onPointerEvent(e, t) {
|
|
1153
1158
|
const i = this.lead.handlePickNode([this], e, t);
|
|
@@ -1155,21 +1160,21 @@ const b = class b extends H {
|
|
|
1155
1160
|
}
|
|
1156
1161
|
dispose() {
|
|
1157
1162
|
const e = this.options.children;
|
|
1158
|
-
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) => {
|
|
1159
1164
|
this.lead.removePickNode(t);
|
|
1160
1165
|
}), super.dispose();
|
|
1161
1166
|
}
|
|
1162
1167
|
};
|
|
1163
|
-
|
|
1164
|
-
let
|
|
1168
|
+
v.observerMap = /* @__PURE__ */ new Map();
|
|
1169
|
+
let Be = v;
|
|
1165
1170
|
export {
|
|
1166
|
-
|
|
1171
|
+
xe as B,
|
|
1167
1172
|
Nt as I,
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
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
|
|
1175
1180
|
};
|