gl-draw 0.15.0-beta.34 → 0.15.0-beta.35
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/index.module2.js +60 -59
- package/dist/index2.js +1 -1
- package/package.json +1 -1
package/dist/index.module2.js
CHANGED
|
@@ -35,12 +35,12 @@ var ot = (n, t, e) => new Promise((i, s) => {
|
|
|
35
35
|
}, r = (c) => c.done ? i(c.value) : Promise.resolve(c.value).then(a, l);
|
|
36
36
|
r((e = e.apply(n, t)).next());
|
|
37
37
|
});
|
|
38
|
-
import { Material as at, Object3D as R, Texture as ct, VideoTexture as Bt, BufferGeometry as J, Float32BufferAttribute as G, PointsMaterial as zt, Points as H, InstancedMesh as wt, Vector3 as D, Quaternion as Tt, Group as _t, Mesh as St, Sprite as lt, Box3 as jt, Vector4 as O, Matrix4 as Et, Line3 as Lt, Sphere as Ot, InstancedInterleavedBuffer as Vt, InterleavedBufferAttribute as ut, MathUtils as kt, REVISION as Wt, ShaderChunk as W, ShaderMaterial as Nt, Vector2 as K, Color as
|
|
38
|
+
import { Material as at, Object3D as R, Texture as ct, VideoTexture as Bt, BufferGeometry as J, Float32BufferAttribute as G, PointsMaterial as zt, Points as H, InstancedMesh as wt, Vector3 as D, Quaternion as Tt, Group as _t, Mesh as St, Sprite as lt, Box3 as jt, Vector4 as O, Matrix4 as Et, Line3 as Lt, Sphere as Ot, InstancedInterleavedBuffer as Vt, InterleavedBufferAttribute as ut, MathUtils as kt, REVISION as Wt, ShaderChunk as W, ShaderMaterial as Nt, Vector2 as K, Color as ft } from "three";
|
|
39
39
|
import { CSS2DObject as Ut } from "three/examples/jsm/renderers/CSS2DRenderer";
|
|
40
40
|
import { CSS3DObject as Rt, CSS3DSprite as Gt } from "three/examples/jsm/renderers/CSS3DRenderer";
|
|
41
41
|
import { geoBounds as At, geoContains as $t, geoDistance as Ft, geoInterpolate as qt } from "d3-geo";
|
|
42
42
|
import "d3-geo-projection";
|
|
43
|
-
import { p as
|
|
43
|
+
import { p as dt, a as Kt } from "./parseVector.module.js";
|
|
44
44
|
import { LineSegmentsGeometry as Qt } from "three/examples/jsm/lines/LineSegmentsGeometry";
|
|
45
45
|
import { merge as tt, mean as Xt, extent as ht } from "d3-array";
|
|
46
46
|
import Yt, { flatten as Ct } from "earcut";
|
|
@@ -125,14 +125,14 @@ const ne = (n, t = 1) => {
|
|
|
125
125
|
}, re = (n, t) => {
|
|
126
126
|
const e = new R();
|
|
127
127
|
t.forEach((i, s) => {
|
|
128
|
-
const a =
|
|
128
|
+
const a = dt(i.position), l = dt(i.scale || [1, 1, 1]);
|
|
129
129
|
e.position.copy(a), e.scale.copy(l), e.updateMatrix();
|
|
130
130
|
const r = e.matrix.clone();
|
|
131
131
|
if (n instanceof wt || n.isInstantiate)
|
|
132
132
|
n.setMatrixAt(s, r);
|
|
133
133
|
else if (n instanceof H || n.type === "Points") {
|
|
134
|
-
const o = n.geometry, h = o.attributes.position.array,
|
|
135
|
-
r.decompose(p, m, u), h[
|
|
134
|
+
const o = n.geometry, h = o.attributes.position.array, f = o.attributes.scaleAtt.array, p = new D(), u = new D(), m = new Tt(), d = s * 3, v = s * 1;
|
|
135
|
+
r.decompose(p, m, u), h[d] = p.x, h[d + 1] = p.y, h[d + 2] = p.z, f[v] = Math.max(u.x, u.y, u.z), o.attributes.position.needsUpdate = !0, o.attributes.scaleAtt.needsUpdate = !0;
|
|
136
136
|
}
|
|
137
137
|
});
|
|
138
138
|
};
|
|
@@ -341,12 +341,12 @@ class mt extends ae {
|
|
|
341
341
|
var h;
|
|
342
342
|
if (this.object3d) {
|
|
343
343
|
if ((h = t == null ? void 0 : t.instancedAttr) != null && h.length) {
|
|
344
|
-
const
|
|
344
|
+
const f = t.instancedAttr.length;
|
|
345
345
|
if (this.object3d instanceof lt)
|
|
346
|
-
o.object3d = ne(this.object3d,
|
|
346
|
+
o.object3d = ne(this.object3d, f);
|
|
347
347
|
else {
|
|
348
348
|
const p = this.object3d, u = this.cloneMaterial();
|
|
349
|
-
o.object3d = new wt(p.geometry, u,
|
|
349
|
+
o.object3d = new wt(p.geometry, u, f);
|
|
350
350
|
}
|
|
351
351
|
re(o.object3d, t == null ? void 0 : t.instancedAttr);
|
|
352
352
|
} else
|
|
@@ -411,22 +411,22 @@ function ce(n, t) {
|
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
413
|
function le(n, t, e) {
|
|
414
|
-
const i = t.projectionMatrix, a = n.material.resolution, l = n.matrixWorld, r = n.geometry, c = r.attributes.instanceStart, o = r.attributes.instanceEnd, h = Math.min(r.instanceCount, c.count),
|
|
414
|
+
const i = t.projectionMatrix, a = n.material.resolution, l = n.matrixWorld, r = n.geometry, c = r.attributes.instanceStart, o = r.attributes.instanceEnd, h = Math.min(r.instanceCount, c.count), f = -t.near;
|
|
415
415
|
T.at(1, B), B.w = 1, B.applyMatrix4(t.matrixWorldInverse), B.applyMatrix4(i), B.multiplyScalar(1 / B.w), B.x *= a.x / 2, B.y *= a.y / 2, B.z = 0, X.copy(B), Y.multiplyMatrices(t.matrixWorldInverse, l);
|
|
416
416
|
for (let p = 0, u = h; p < u; p++) {
|
|
417
|
-
if (b.fromBufferAttribute(c, p), g.fromBufferAttribute(o, p), b.w = 1, g.w = 1, b.applyMatrix4(Y), g.applyMatrix4(Y), b.z >
|
|
417
|
+
if (b.fromBufferAttribute(c, p), g.fromBufferAttribute(o, p), b.w = 1, g.w = 1, b.applyMatrix4(Y), g.applyMatrix4(Y), b.z > f && g.z > f)
|
|
418
418
|
continue;
|
|
419
|
-
if (b.z >
|
|
420
|
-
const S = b.z - g.z, j = (b.z -
|
|
419
|
+
if (b.z > f) {
|
|
420
|
+
const S = b.z - g.z, j = (b.z - f) / S;
|
|
421
421
|
b.lerp(g, j);
|
|
422
|
-
} else if (g.z >
|
|
423
|
-
const S = g.z - b.z, j = (g.z -
|
|
422
|
+
} else if (g.z > f) {
|
|
423
|
+
const S = g.z - b.z, j = (g.z - f) / S;
|
|
424
424
|
g.lerp(b, j);
|
|
425
425
|
}
|
|
426
426
|
b.applyMatrix4(i), g.applyMatrix4(i), b.multiplyScalar(1 / b.w), g.multiplyScalar(1 / g.w), b.x *= a.x / 2, b.y *= a.y / 2, g.x *= a.x / 2, g.y *= a.y / 2, M.start.copy(b), M.start.z = 0, M.end.copy(g), M.end.z = 0;
|
|
427
|
-
const
|
|
428
|
-
M.at(
|
|
429
|
-
const v = kt.lerp(b.z, g.z,
|
|
427
|
+
const d = M.closestPointToPointParameter(X, !0);
|
|
428
|
+
M.at(d, bt);
|
|
429
|
+
const v = kt.lerp(b.z, g.z, d), w = v >= -1 && v <= 1, I = X.distanceTo(bt) < E * 0.5;
|
|
430
430
|
if (w && I) {
|
|
431
431
|
M.start.fromBufferAttribute(c, p), M.end.fromBufferAttribute(o, p), M.start.applyMatrix4(l), M.end.applyMatrix4(l);
|
|
432
432
|
const S = new D(), j = new D();
|
|
@@ -478,13 +478,13 @@ class Le extends St {
|
|
|
478
478
|
if (i)
|
|
479
479
|
o = E * 0.5;
|
|
480
480
|
else {
|
|
481
|
-
const
|
|
481
|
+
const f = Math.max(
|
|
482
482
|
s.near,
|
|
483
483
|
U.distanceToPoint(T.origin)
|
|
484
484
|
);
|
|
485
485
|
o = gt(
|
|
486
486
|
s,
|
|
487
|
-
|
|
487
|
+
f,
|
|
488
488
|
c.resolution
|
|
489
489
|
);
|
|
490
490
|
}
|
|
@@ -495,13 +495,13 @@ class Le extends St {
|
|
|
495
495
|
if (i)
|
|
496
496
|
h = E * 0.5;
|
|
497
497
|
else {
|
|
498
|
-
const
|
|
498
|
+
const f = Math.max(
|
|
499
499
|
s.near,
|
|
500
500
|
N.distanceToPoint(T.origin)
|
|
501
501
|
);
|
|
502
502
|
h = gt(
|
|
503
503
|
s,
|
|
504
|
-
|
|
504
|
+
f,
|
|
505
505
|
c.resolution
|
|
506
506
|
);
|
|
507
507
|
}
|
|
@@ -555,7 +555,7 @@ void main() {
|
|
|
555
555
|
#include <fog_fragment>
|
|
556
556
|
#include <${parseInt(Wt) < 154 ? "encodings_fragment" : "colorspace_fragment"}>
|
|
557
557
|
}
|
|
558
|
-
`,
|
|
558
|
+
`, fe = `
|
|
559
559
|
#include <common>
|
|
560
560
|
${W.logdepthbuf_pars_vertex}
|
|
561
561
|
${W.fog_pars_vertex}
|
|
@@ -660,11 +660,11 @@ class Oe extends Nt {
|
|
|
660
660
|
dashArray: c = 0,
|
|
661
661
|
dashRatio: o = 0,
|
|
662
662
|
sizeAttenuation: h = !0,
|
|
663
|
-
offsetLoop:
|
|
663
|
+
offsetLoop: f = !0,
|
|
664
664
|
offset: p = new K(0, 0),
|
|
665
665
|
scaleDown: u = 0,
|
|
666
666
|
alphaMap: m = void 0,
|
|
667
|
-
alphaTest:
|
|
667
|
+
alphaTest: d = 0,
|
|
668
668
|
repeat: v = new K(1, 1),
|
|
669
669
|
resolution: w = new K(1, 1)
|
|
670
670
|
} = S, I = rt(S, [
|
|
@@ -688,25 +688,25 @@ class Oe extends Nt {
|
|
|
688
688
|
super(q(L({}, I), {
|
|
689
689
|
uniforms: {
|
|
690
690
|
lineWidth: { value: e },
|
|
691
|
-
color: { value: new
|
|
691
|
+
color: { value: new ft(i) },
|
|
692
692
|
opacity: { value: s },
|
|
693
693
|
map: { value: a },
|
|
694
694
|
useMap: { value: a ? 1 : l },
|
|
695
695
|
resolution: { value: w },
|
|
696
696
|
sizeAttenuation: { value: h ? 1 : 0 },
|
|
697
697
|
offset: { value: p },
|
|
698
|
-
offsetLoop: { value:
|
|
698
|
+
offsetLoop: { value: f ? 1 : 0 },
|
|
699
699
|
dashArray: { value: c },
|
|
700
700
|
dashOffset: { value: r },
|
|
701
701
|
dashRatio: { value: o },
|
|
702
702
|
useDash: { value: c > 0 ? 1 : 0 },
|
|
703
703
|
scaleDown: { value: u / 10 },
|
|
704
|
-
alphaTest: { value:
|
|
704
|
+
alphaTest: { value: d },
|
|
705
705
|
alphaMap: { value: m },
|
|
706
706
|
useAlphaMap: { value: m ? 1 : 0 },
|
|
707
707
|
repeat: { value: v }
|
|
708
708
|
},
|
|
709
|
-
vertexShader:
|
|
709
|
+
vertexShader: fe,
|
|
710
710
|
fragmentShader: ue
|
|
711
711
|
})), this.type = "MeshLineMaterial";
|
|
712
712
|
}
|
|
@@ -715,13 +715,14 @@ class Oe extends Nt {
|
|
|
715
715
|
return this.uniforms.color.value;
|
|
716
716
|
}
|
|
717
717
|
set color(t) {
|
|
718
|
-
this.uniforms.color.value = new
|
|
718
|
+
this.uniforms.color.value = new ft(t);
|
|
719
719
|
}
|
|
720
720
|
get opacity() {
|
|
721
|
-
|
|
721
|
+
var t;
|
|
722
|
+
return ((t = this.uniforms) == null ? void 0 : t.opacity.value) || 1;
|
|
722
723
|
}
|
|
723
724
|
set opacity(t) {
|
|
724
|
-
this.uniforms.opacity.value = t;
|
|
725
|
+
this.uniforms && (this.uniforms.opacity.value = t);
|
|
725
726
|
}
|
|
726
727
|
// Getter and setter for map
|
|
727
728
|
get map() {
|
|
@@ -745,7 +746,7 @@ class Oe extends Nt {
|
|
|
745
746
|
this.uniforms.sizeAttenuation.value = t ? 1 : 0;
|
|
746
747
|
}
|
|
747
748
|
}
|
|
748
|
-
function
|
|
749
|
+
function de(n, t) {
|
|
749
750
|
return n.map((e) => {
|
|
750
751
|
const i = [];
|
|
751
752
|
let s;
|
|
@@ -767,10 +768,10 @@ function he(n, { minLng: t, maxLng: e, minLat: i, maxLat: s } = {}) {
|
|
|
767
768
|
const a = Math.round(nt(360 / n, 2) / Math.PI), l = (1 + Math.sqrt(5)) / 2, r = (u) => u / l * 360 % 360 - 180, c = (u) => Math.acos(2 * u / a - 1) / Math.PI * 180 - 90, o = (u) => a * (Math.cos((u + 90) * Math.PI / 180) + 1) / 2, h = [
|
|
768
769
|
s !== void 0 ? Math.ceil(o(s)) : 0,
|
|
769
770
|
i !== void 0 ? Math.floor(o(i)) : a - 1
|
|
770
|
-
],
|
|
771
|
+
], f = t === void 0 && e === void 0 ? () => !0 : t === void 0 ? (u) => u <= e : e === void 0 ? (u) => u >= t : e >= t ? (u) => u >= t && u <= e : (u) => u >= t || u <= e, p = [];
|
|
771
772
|
for (let u = h[0]; u <= h[1]; u++) {
|
|
772
773
|
const m = r(u);
|
|
773
|
-
|
|
774
|
+
f(m) && p.push([m, c(u)]);
|
|
774
775
|
}
|
|
775
776
|
return p;
|
|
776
777
|
}
|
|
@@ -792,7 +793,7 @@ function pe(n, t) {
|
|
|
792
793
|
);
|
|
793
794
|
}
|
|
794
795
|
function me(n, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
|
|
795
|
-
const s =
|
|
796
|
+
const s = de(n, t), a = tt(s), l = pe(n, t), r = [...a, ...l], c = { type: "Polygon", coordinates: n }, [[o, h], [f, p]] = At(c), u = o > f || // crosses antimeridian
|
|
796
797
|
p >= 89 || // crosses north pole
|
|
797
798
|
h <= -89;
|
|
798
799
|
let m = [];
|
|
@@ -839,12 +840,12 @@ function me(n, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
|
|
|
839
840
|
const { vertices: y, holes: x = [] } = Ct(s);
|
|
840
841
|
m = Yt(y, x, 2);
|
|
841
842
|
}
|
|
842
|
-
let
|
|
843
|
+
let d = e ? [e[0], e[2]] : ht(r, (y) => y[0]), v = e ? [e[1], e[3]] : ht(r, (y) => y[1]);
|
|
843
844
|
if (i) {
|
|
844
|
-
const [y, x] = i([
|
|
845
|
-
|
|
845
|
+
const [y, x] = i([d[0], v[0]]), [A, C] = i([d[1], v[1]]);
|
|
846
|
+
d = [y, A], v = [-x, -C];
|
|
846
847
|
}
|
|
847
|
-
const w = pt(
|
|
848
|
+
const w = pt(d, [0, 1]), I = pt(v, [0, 1]), S = r.map(([y, x]) => {
|
|
848
849
|
if (i) {
|
|
849
850
|
const [A, C] = i([y, x]);
|
|
850
851
|
return [w(A), I(-C)];
|
|
@@ -878,21 +879,21 @@ function ve(n, t, e, i, s) {
|
|
|
878
879
|
i,
|
|
879
880
|
s
|
|
880
881
|
), c = tt([r, a]), o = Math.round(r.length / 3), h = new Set(l);
|
|
881
|
-
let
|
|
882
|
+
let f = 0;
|
|
882
883
|
const p = [];
|
|
883
884
|
for (let m = 0; m < o; m++) {
|
|
884
|
-
let
|
|
885
|
-
if (
|
|
886
|
-
|
|
887
|
-
else if (h.has(
|
|
888
|
-
const v =
|
|
889
|
-
|
|
885
|
+
let d = m + 1;
|
|
886
|
+
if (d === o)
|
|
887
|
+
d = f;
|
|
888
|
+
else if (h.has(d)) {
|
|
889
|
+
const v = d;
|
|
890
|
+
d = f, f = v;
|
|
890
891
|
}
|
|
891
|
-
p.push(m, m + o,
|
|
892
|
+
p.push(m, m + o, d + o), p.push(d + o, d, m);
|
|
892
893
|
}
|
|
893
894
|
const u = [];
|
|
894
895
|
for (let m = 1; m >= 0; m--)
|
|
895
|
-
for (let
|
|
896
|
+
for (let d = 0; d < o; d += 1) u.push(d / (o - 1), m);
|
|
896
897
|
return { indices: p, vertices: c, uvs: u, topVerts: r };
|
|
897
898
|
}
|
|
898
899
|
function xt(n, t, e, i, s, a) {
|
|
@@ -922,7 +923,7 @@ const ye = ({
|
|
|
922
923
|
n.forEach((w) => {
|
|
923
924
|
Zt(w) || w.reverse();
|
|
924
925
|
});
|
|
925
|
-
const { contour: h, triangles:
|
|
926
|
+
const { contour: h, triangles: f } = me(n, {
|
|
926
927
|
resolution: i,
|
|
927
928
|
bbox: o,
|
|
928
929
|
projection: c
|
|
@@ -936,10 +937,10 @@ const ye = ({
|
|
|
936
937
|
c
|
|
937
938
|
), u = p.topVerts);
|
|
938
939
|
let m = [];
|
|
939
|
-
(l || r) && (m = tt(
|
|
940
|
-
let
|
|
941
|
-
l && (
|
|
942
|
-
|
|
940
|
+
(l || r) && (m = tt(f.uvs));
|
|
941
|
+
let d = {};
|
|
942
|
+
l && (d = xt(
|
|
943
|
+
f,
|
|
943
944
|
t,
|
|
944
945
|
m,
|
|
945
946
|
!1,
|
|
@@ -948,13 +949,13 @@ const ye = ({
|
|
|
948
949
|
));
|
|
949
950
|
let v = {};
|
|
950
951
|
return r && (v = xt(
|
|
951
|
-
|
|
952
|
+
f,
|
|
952
953
|
e,
|
|
953
954
|
m,
|
|
954
955
|
!0,
|
|
955
956
|
s,
|
|
956
957
|
c
|
|
957
|
-
)), { contour: h, triangles:
|
|
958
|
+
)), { contour: h, triangles: f, sideTorso: p, bottomCap: d, topCap: v, topVerts: u };
|
|
958
959
|
};
|
|
959
960
|
class Ve extends J {
|
|
960
961
|
constructor(t, e = {}) {
|
|
@@ -979,7 +980,7 @@ class Ve extends J {
|
|
|
979
980
|
cartesian: c,
|
|
980
981
|
userDataRsoOffset: o,
|
|
981
982
|
projection: h
|
|
982
|
-
} = this.parameters, { contour:
|
|
983
|
+
} = this.parameters, { contour: f, sideTorso: p, topVerts: u, bottomCap: m, topCap: d } = ye(L({}, this.parameters));
|
|
983
984
|
let v = [], w = [], I = [], S = 0;
|
|
984
985
|
const j = (y) => {
|
|
985
986
|
const x = Math.round(v.length / 3), A = I.length;
|
|
@@ -987,12 +988,12 @@ class Ve extends J {
|
|
|
987
988
|
x ? y.indices.map((C) => C + x) : y.indices
|
|
988
989
|
), this.addGroup(A, I.length - A, S++);
|
|
989
990
|
};
|
|
990
|
-
s && a && j(
|
|
991
|
-
|
|
991
|
+
s && a && j(d), r && (j(p), this.userData.topVerts = o ? $(
|
|
992
|
+
f,
|
|
992
993
|
i + o,
|
|
993
994
|
c,
|
|
994
995
|
h
|
|
995
|
-
).vertices : u), l && j(m), s && !a && j(
|
|
996
|
+
).vertices : u), l && j(m), s && !a && j(d), this.setIndex(I), this[Mt]("position", new G(v, 3)), this[Mt]("uv", new G(w, 2)), this.computeVertexNormals();
|
|
996
997
|
}
|
|
997
998
|
}
|
|
998
999
|
export {
|
package/dist/index2.js
CHANGED
|
@@ -136,4 +136,4 @@ void main() {
|
|
|
136
136
|
${o.ShaderChunk.logdepthbuf_vertex}
|
|
137
137
|
${o.ShaderChunk.fog_vertex}
|
|
138
138
|
}
|
|
139
|
-
`;class _e extends o.ShaderMaterial{constructor(e={}){const j=e,{lineWidth:t=1,color:r="#ffffff",opacity:i=1,map:c=null,useMap:u=0,dashOffset:s=0,dashArray:l=0,dashRatio:a=0,sizeAttenuation:p=!0,offsetLoop:f=!0,offset:m=new o.Vector2(0,0),scaleDown:d=0,alphaMap:v=void 0,alphaTest:h=0,repeat:b=new o.Vector2(1,1),resolution:w=new o.Vector2(1,1)}=j,I=re(j,["lineWidth","color","opacity","map","useMap","dashOffset","dashArray","dashRatio","sizeAttenuation","offsetLoop","offset","scaleDown","alphaMap","alphaTest","repeat","resolution"]);super(q(_({},I),{uniforms:{lineWidth:{value:t},color:{value:new o.Color(r)},opacity:{value:i},map:{value:c},useMap:{value:c?1:u},resolution:{value:w},sizeAttenuation:{value:p?1:0},offset:{value:m},offsetLoop:{value:f?1:0},dashArray:{value:l},dashOffset:{value:s},dashRatio:{value:a},useDash:{value:l>0?1:0},scaleDown:{value:d/10},alphaTest:{value:h},alphaMap:{value:v},useAlphaMap:{value:v?1:0},repeat:{value:b}},vertexShader:Le,fragmentShader:Ee})),this.type="MeshLineMaterial"}get color(){return this.uniforms.color.value}set color(e){this.uniforms.color.value=new o.Color(e)}get opacity(){return
|
|
139
|
+
`;class _e extends o.ShaderMaterial{constructor(e={}){const j=e,{lineWidth:t=1,color:r="#ffffff",opacity:i=1,map:c=null,useMap:u=0,dashOffset:s=0,dashArray:l=0,dashRatio:a=0,sizeAttenuation:p=!0,offsetLoop:f=!0,offset:m=new o.Vector2(0,0),scaleDown:d=0,alphaMap:v=void 0,alphaTest:h=0,repeat:b=new o.Vector2(1,1),resolution:w=new o.Vector2(1,1)}=j,I=re(j,["lineWidth","color","opacity","map","useMap","dashOffset","dashArray","dashRatio","sizeAttenuation","offsetLoop","offset","scaleDown","alphaMap","alphaTest","repeat","resolution"]);super(q(_({},I),{uniforms:{lineWidth:{value:t},color:{value:new o.Color(r)},opacity:{value:i},map:{value:c},useMap:{value:c?1:u},resolution:{value:w},sizeAttenuation:{value:p?1:0},offset:{value:m},offsetLoop:{value:f?1:0},dashArray:{value:l},dashOffset:{value:s},dashRatio:{value:a},useDash:{value:l>0?1:0},scaleDown:{value:d/10},alphaTest:{value:h},alphaMap:{value:v},useAlphaMap:{value:v?1:0},repeat:{value:b}},vertexShader:Le,fragmentShader:Ee})),this.type="MeshLineMaterial"}get color(){return this.uniforms.color.value}set color(e){this.uniforms.color.value=new o.Color(e)}get opacity(){var e;return((e=this.uniforms)==null?void 0:e.opacity.value)||1}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get map(){return this.uniforms.map.value}set map(e){this.uniforms.map.value=e,this.uniforms.useMap.value=e?1:0}get lineWidth(){return this.uniforms.lineWidth.value}set lineWidth(e){this.uniforms.lineWidth.value=e}get sizeAttenuation(){return this.uniforms.sizeAttenuation.value===1}set sizeAttenuation(e){this.uniforms.sizeAttenuation.value=e?1:0}}function Oe(n,e){return n.map(t=>{const r=[];let i;return t.forEach(c=>{if(i){const u=O.geoDistance(c,i)*180/Math.PI;if(u>e){const s=O.geoInterpolate(i,c),l=1/Math.ceil(u/e);let a=l;for(;a<1;)r.push(s(a)),a+=l}}r.push(i=c)}),r})}function ke(n,{minLng:e,maxLng:t,minLat:r,maxLat:i}={}){const c=Math.round(te(360/n,2)/Math.PI),u=(1+Math.sqrt(5))/2,s=d=>d/u*360%360-180,l=d=>Math.acos(2*d/c-1)/Math.PI*180-90,a=d=>c*(Math.cos((d+90)*Math.PI/180)+1)/2,p=[i!==void 0?Math.ceil(a(i)):0,r!==void 0?Math.floor(a(r)):c-1],f=e===void 0&&t===void 0?()=>!0:e===void 0?d=>d<=t:t===void 0?d=>d>=e:t>=e?d=>d>=e&&d<=t:d=>d>=e||d<=t,m=[];for(let d=p[0];d<=p[1];d++){const v=s(d);f(v)&&m.push([v,l(d)])}return m}function Z(n,e,t=!1){return t?O.geoContains(e,n):Se(n,e)}function We(n,e){const t={type:"Polygon",coordinates:n},[[r,i],[c,u]]=O.geoBounds(t);if(Math.min(Math.abs(c-r),Math.abs(u-i))<e)return[];const s=r>c||u>=89||i<=-89;return ke(e,{minLng:r,maxLng:c,minLat:i,maxLat:u}).filter(l=>Z(l,t,s))}function Ne(n,{resolution:e=1/0,bbox:t,projection:r}={}){const i=Oe(n,e),c=L.merge(i),u=We(n,e),s=[...c,...u],l={type:"Polygon",coordinates:n},[[a,p],[f,m]]=O.geoBounds(l),d=a>f||m>=89||p<=-89;let v=[];if(d){const y=xe.geoVoronoi(s).triangles(),x=new Map(s.map(([C,P],z)=>[`${C}-${P}`,z]));y.features.forEach(C=>{const P=C.geometry.coordinates[0].slice(0,3).reverse(),z=[];if(P.forEach(([B,R])=>{const k=`${B}-${R}`;x.has(k)&&z.push(x.get(k))}),z.length===3){if(z.some(B=>B<c.length)){const B=C.properties.circumcenter;if(!Z(B,l,d))return}v.push(...z)}})}else if(u.length){const y=Me.from(s);for(let x=0,C=y.triangles.length;x<C;x+=3){const P=[2,1,0].map(B=>y.triangles[x+B]),z=P.map(B=>s[B]);if(P.some(B=>B<c.length)){const B=[0,1].map(R=>L.mean(z,k=>k[R]));if(!Z(B,l,d))continue}v.push(...P)}}else{const{vertices:y,holes:x=[]}=X.flatten(i);v=X(y,x,2)}let h=t?[t[0],t[2]]:L.extent(s,y=>y[0]),b=t?[t[1],t[3]]:L.extent(s,y=>y[1]);if(r){const[y,x]=r([h[0],b[0]]),[C,P]=r([h[1],b[1]]);h=[y,C],b=[-x,-P]}const w=se.scaleLinear(h,[0,1]),I=se.scaleLinear(b,[0,1]),j=s.map(([y,x])=>{if(r){const[C,P]=r([y,x]);return[w(C),I(-P)]}else return[w(y),I(x)]});return{contour:i,triangles:{points:s,indices:v,uvs:j}}}const ue=new o.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function G(n,e,t,r){const i=n.map(c=>c.map(([u,s])=>{if(r){const[l,a]=r([u,s]);return[l,-a,e]}return t?Q.polar2Cartesian(u,s,e):[u,s,e]}));return X.flatten(i)}function Ue(n,e,t,r,i){const{vertices:c,holes:u}=G(n,e,r,i),{vertices:s}=G(n,t,r,i),l=L.merge([s,c]),a=Math.round(s.length/3),p=new Set(u);let f=0;const m=[];for(let v=0;v<a;v++){let h=v+1;if(h===a)h=f;else if(p.has(h)){const b=h;h=f,f=b}m.push(v,v+a,h+a),m.push(h+a,h,v)}const d=[];for(let v=1;v>=0;v--)for(let h=0;h<a;h+=1)d.push(h/(a-1),v);return{indices:m,vertices:l,uvs:d,topVerts:s}}function de(n,e,t,r,i,c){return{indices:r?n.indices:n.indices.slice().reverse(),vertices:G([n.points],e,i,c).vertices,uvs:t}}const he=({polygonGeoJson:n,startHeight:e,endHeight:t,curvatureResolution:r=1,cartesian:i=!0,hasSide:c=!0,hasBottom:u=!1,hasTop:s=!1,projection:l,bbox:a})=>{n.forEach(w=>{ge(w)||w.reverse()});const{contour:p,triangles:f}=Ne(n,{resolution:r,bbox:a,projection:l});let m={},d;c&&(m=Ue(p,e!=null?e:t,t!=null?t:e,i,l),d=m.topVerts);let v=[];(u||s)&&(v=L.merge(f.uvs));let h={};u&&(h=de(f,e,v,!1,i,l));let b={};return s&&(b=de(f,t,v,!0,i,l)),{contour:p,triangles:f,sideTorso:m,bottomCap:h,topCap:b,topVerts:d}};class Ge extends o.BufferGeometry{constructor(e,t={}){super(),this.type="PolygonBufferGeometry",this.parameters=_({polygonGeoJson:e,startHeight:0,endHeight:1,hasTop:!0,topFirst:!1,hasBottom:!0,hasSide:!0,curvatureResolution:1,cartesian:!0,userDataRsoOffset:0},t);const{endHeight:r,hasTop:i,topFirst:c,hasBottom:u,hasSide:s,cartesian:l,userDataRsoOffset:a,projection:p}=this.parameters,{contour:f,sideTorso:m,topVerts:d,bottomCap:v,topCap:h}=he(_({},this.parameters));let b=[],w=[],I=[],j=0;const A=y=>{const x=Math.round(b.length/3),C=I.length;b=b.concat(y.vertices),w=w.concat(y.uvs),I=I.concat(x?y.indices.map(P=>P+x):y.indices),this.addGroup(C,I.length-C,j++)};i&&c&&A(h),s&&(A(m),this.userData.topVerts=a?G(f,r+a,l,p).vertices:d),u&&A(v),i&&!c&&A(h),this.setIndex(I),this[ue]("position",new o.Float32BufferAttribute(b,3)),this[ue]("uv",new o.Float32BufferAttribute(w,2)),this.computeVertexNormals()}}exports.BLOOM_SCENE=je;exports.BaseObject=Y;exports.IS_DEV=Ce;exports.LineSegments2=ze;exports.MeshLineMaterial=_e;exports.PolygonGeometry=Ge;exports.ResourceTracker=fe;exports.getMetas=he;
|