gl-draw 0.15.13 → 0.15.14
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/constants.d.ts +1 -0
- package/dist/index.js +3 -3
- package/dist/index.module.js +176 -176
- package/dist/index.module2.js +131 -129
- package/dist/index2.js +4 -4
- package/dist/objects/index.module.js +28 -28
- package/package.json +1 -1
package/dist/index.module2.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Pt = Object.defineProperty, At = Object.defineProperties;
|
|
2
2
|
var St = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var J = Object.getOwnPropertySymbols;
|
|
4
|
-
var Ct = Object.prototype.hasOwnProperty,
|
|
5
|
-
var et = Math.pow, tt = (a, t, e) => t in a ?
|
|
4
|
+
var Ct = Object.prototype.hasOwnProperty, It = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var et = Math.pow, tt = (a, t, e) => t in a ? Pt(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e, W = (a, t) => {
|
|
6
6
|
for (var e in t || (t = {}))
|
|
7
7
|
Ct.call(t, e) && tt(a, e, t[e]);
|
|
8
8
|
if (J)
|
|
9
9
|
for (var e of J(t))
|
|
10
|
-
|
|
10
|
+
It.call(t, e) && tt(a, e, t[e]);
|
|
11
11
|
return a;
|
|
12
12
|
}, Z = (a, t) => At(a, St(t));
|
|
13
13
|
var it = (a, t, e) => new Promise((i, s) => {
|
|
@@ -26,22 +26,22 @@ var it = (a, t, e) => new Promise((i, s) => {
|
|
|
26
26
|
}, n = (o) => o.done ? i(o.value) : Promise.resolve(o.value).then(r, l);
|
|
27
27
|
n((e = e.apply(a, t)).next());
|
|
28
28
|
});
|
|
29
|
-
import { BufferGeometry as
|
|
30
|
-
import { CSS2DObject as
|
|
31
|
-
import { CSS3DObject as Gt, CSS3DSprite as
|
|
32
|
-
import { geoBounds as wt, geoContains as
|
|
29
|
+
import { BufferGeometry as X, Float32BufferAttribute as G, PointsMaterial as zt, Points as Q, Mesh as Mt, Group as Bt, Sprite as st, Box3 as xt, Vector3 as C, InstancedMesh as nt, Quaternion as Dt, Object3D as U, Material as rt, Texture as at, VideoTexture as Lt, Vector4 as O, Matrix4 as _t, Line3 as Tt, Sphere as Wt, InstancedInterleavedBuffer as Ot, InterleavedBufferAttribute as ot, MathUtils as Et, ShaderMaterial as Vt, UniformsLib as kt, Color as lt, Vector2 as V, REVISION as Rt } from "three";
|
|
30
|
+
import { CSS2DObject as Ut } from "three/examples/jsm/renderers/CSS2DRenderer";
|
|
31
|
+
import { CSS3DObject as Gt, CSS3DSprite as Nt } from "three/examples/jsm/renderers/CSS3DRenderer";
|
|
32
|
+
import { geoBounds as wt, geoContains as Ft, geoDistance as Zt, geoInterpolate as $t } from "d3-geo";
|
|
33
33
|
import "d3-geo-projection";
|
|
34
34
|
import { p as ct, a as qt } from "./parseVector.module.js";
|
|
35
35
|
import { LineSegmentsGeometry as Kt } from "three/examples/jsm/lines/LineSegmentsGeometry";
|
|
36
|
-
import { merge as
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import
|
|
36
|
+
import { merge as Y, mean as Qt, extent as ut } from "d3-array";
|
|
37
|
+
import Ht, { flatten as jt } from "earcut";
|
|
38
|
+
import Xt from "@turf/boolean-clockwise";
|
|
39
|
+
import Yt from "delaunator";
|
|
40
40
|
import Jt from "@turf/boolean-point-in-polygon";
|
|
41
41
|
import { geoVoronoi as te } from "d3-geo-voronoi";
|
|
42
42
|
import { scaleLinear as ht } from "d3-scale";
|
|
43
43
|
const ee = (a, t = 1) => {
|
|
44
|
-
const e = new
|
|
44
|
+
const e = new X();
|
|
45
45
|
e.setAttribute(
|
|
46
46
|
"position",
|
|
47
47
|
new G(new Array(t * 3).fill(0), 3)
|
|
@@ -49,7 +49,7 @@ const ee = (a, t = 1) => {
|
|
|
49
49
|
"scaleAtt",
|
|
50
50
|
new G(new Array(t).fill(1), 1)
|
|
51
51
|
);
|
|
52
|
-
const i = a.material, s = new
|
|
52
|
+
const i = a.material, s = new zt({
|
|
53
53
|
size: 10,
|
|
54
54
|
map: i.map,
|
|
55
55
|
alphaMap: i.alphaMap,
|
|
@@ -71,7 +71,7 @@ const ee = (a, t = 1) => {
|
|
|
71
71
|
)}
|
|
72
72
|
`;
|
|
73
73
|
}, new Q(e, s);
|
|
74
|
-
};
|
|
74
|
+
}, ie = 0, Be = 1, se = 2, De = !1;
|
|
75
75
|
class ft {
|
|
76
76
|
constructor() {
|
|
77
77
|
this.objectType = "BaseObject", this.userData = {}, this.prefab = !1, this.isInstantiate = !1, this.isBloom = !1, this.materialList = {}, this.useMaterialType = "origin", this.onPointerIndex = [], this.disposeTrack = !0, this.disposeMaterialIfNotUsed = !0;
|
|
@@ -129,10 +129,10 @@ class ft {
|
|
|
129
129
|
resize(t, e) {
|
|
130
130
|
}
|
|
131
131
|
show() {
|
|
132
|
-
return this.object3d.visible = !0, this;
|
|
132
|
+
return this.object3d.visible = !0, this.object3d.layers.set(ie), this;
|
|
133
133
|
}
|
|
134
134
|
hide() {
|
|
135
|
-
return this.object3d.visible = !1, this;
|
|
135
|
+
return this.object3d.visible = !1, this.object3d.layers.set(se), this;
|
|
136
136
|
}
|
|
137
137
|
createMesh(...t) {
|
|
138
138
|
return this.object3d = new Mt(...t), this;
|
|
@@ -144,13 +144,13 @@ class ft {
|
|
|
144
144
|
return this.object3d = new Q(...t), this;
|
|
145
145
|
}
|
|
146
146
|
createCSS2DObject(t) {
|
|
147
|
-
return this.object3d = new
|
|
147
|
+
return this.object3d = new Ut(t), this;
|
|
148
148
|
}
|
|
149
149
|
createCSS3DObject(t) {
|
|
150
150
|
return this.object3d = new Gt(t), this;
|
|
151
151
|
}
|
|
152
152
|
createCSS3DSprite(t) {
|
|
153
|
-
return this.object3d = new
|
|
153
|
+
return this.object3d = new Nt(t), this;
|
|
154
154
|
}
|
|
155
155
|
createSprite(t) {
|
|
156
156
|
return this.object3d = new st(t), this;
|
|
@@ -192,7 +192,7 @@ class ft {
|
|
|
192
192
|
const f = this.object3d, d = this.cloneMaterial();
|
|
193
193
|
u.object3d = new nt(f.geometry, d, m);
|
|
194
194
|
}
|
|
195
|
-
const h = new
|
|
195
|
+
const h = new U();
|
|
196
196
|
t.forEach((f, d) => {
|
|
197
197
|
const g = ct(f.position), w = ct(f.scale || [1, 1, 1]);
|
|
198
198
|
h.position.copy(g), h.scale.copy(w), h.updateMatrix(), u.setInstancedMatrix(d, h.matrix.clone());
|
|
@@ -221,7 +221,7 @@ class ft {
|
|
|
221
221
|
if (this.object3d instanceof nt || this.object3d.isInstantiate)
|
|
222
222
|
this.object3d.setMatrixAt(t, e);
|
|
223
223
|
else if (this.object3d instanceof Q || this.object3d.type === "Points") {
|
|
224
|
-
const s = this.object3d.geometry, r = s.attributes.position.array, l = s.attributes.scaleAtt.array, n = new C(), o = new C(), c = new
|
|
224
|
+
const s = this.object3d.geometry, r = s.attributes.position.array, l = s.attributes.scaleAtt.array, n = new C(), o = new C(), c = new Dt(), p = t * 3, u = t * 1;
|
|
225
225
|
e.decompose(n, c, o), r[p] = n.x, r[p + 1] = n.y, r[p + 2] = n.z, l[u] = Math.max(o.x, o.y, o.z), s.attributes.position.needsUpdate = !0, s.attributes.scaleAtt.needsUpdate = !0;
|
|
226
226
|
}
|
|
227
227
|
}
|
|
@@ -299,12 +299,12 @@ class ft {
|
|
|
299
299
|
void 0,
|
|
300
300
|
this.disposeMaterialIfNotUsed
|
|
301
301
|
), (t = this.pencil.composerController) == null || t.bloomSelection.delete(this), this.lead && (this.lead.objects.delete(this.key), this.object3d && this.lead.objMap.delete(this.object3d)), this.disposeTrack) {
|
|
302
|
-
const e = new
|
|
302
|
+
const e = new ne();
|
|
303
303
|
e.disposeMaterial = !this.pencil.options.mList, e.track(this), e.dispose();
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
|
-
class
|
|
307
|
+
class ne {
|
|
308
308
|
constructor() {
|
|
309
309
|
this.resources = /* @__PURE__ */ new Set(), this.disposeMaterial = !0, this.disposeVideo = !0;
|
|
310
310
|
}
|
|
@@ -315,11 +315,11 @@ class ie {
|
|
|
315
315
|
return t.forEach((e) => this.track(e)), t;
|
|
316
316
|
if (!this.disposeMaterial && t instanceof rt)
|
|
317
317
|
return t;
|
|
318
|
-
if (t instanceof ft ? (t.disposeTrack && t.object3d ? this.track(t.object3d) : this.resources.add(t), Object.values(t.materialList).map((e) => this.track(e))) : (t instanceof
|
|
318
|
+
if (t instanceof ft ? (t.disposeTrack && t.object3d ? this.track(t.object3d) : this.resources.add(t), Object.values(t.materialList).map((e) => this.track(e))) : (t instanceof U || Reflect.has(t, "dispose")) && this.resources.add(t), t instanceof ft)
|
|
319
319
|
t.children.forEach((e) => {
|
|
320
320
|
e.disposeTrack = !1;
|
|
321
321
|
}), this.track(t.children);
|
|
322
|
-
else if (t instanceof
|
|
322
|
+
else if (t instanceof U) {
|
|
323
323
|
const e = t;
|
|
324
324
|
this.track(e.geometry), this.track(e.material), this.track(e.children);
|
|
325
325
|
} else if (t instanceof rt) {
|
|
@@ -333,32 +333,32 @@ class ie {
|
|
|
333
333
|
(s instanceof at || Array.isArray(s)) && this.track(s);
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
|
-
} else this.disposeVideo && t instanceof
|
|
336
|
+
} else this.disposeVideo && t instanceof Lt && t.source.data && this.resources.add(t.source.data);
|
|
337
337
|
return t;
|
|
338
338
|
}
|
|
339
339
|
dispose() {
|
|
340
340
|
const t = [];
|
|
341
341
|
for (const e of this.resources)
|
|
342
|
-
e instanceof
|
|
342
|
+
e instanceof U ? t.push(e) : e instanceof HTMLVideoElement && e.pause(), Reflect.has(e, "dispose") && e.dispose();
|
|
343
343
|
t.forEach((e) => {
|
|
344
344
|
e.removeFromParent();
|
|
345
345
|
}), t.length = 0, this.resources.clear();
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
|
-
const $ = new O(), dt = new C(), pt = new C(), b = new O(), y = new O(), B = new O(), q = new C(), K = new
|
|
349
|
-
let
|
|
348
|
+
const $ = new O(), dt = new C(), pt = new C(), b = new O(), y = new O(), B = new O(), q = new C(), K = new _t(), M = new Tt(), mt = new C(), k = new xt(), R = new Wt(), D = new O();
|
|
349
|
+
let L, T;
|
|
350
350
|
function vt(a, t, e) {
|
|
351
|
-
return
|
|
351
|
+
return D.set(0, 0, -t, 1).applyMatrix4(a.projectionMatrix), D.multiplyScalar(1 / D.w), D.x = T / e.width, D.y = T / e.height, D.applyMatrix4(a.projectionMatrixInverse), D.multiplyScalar(1 / D.w), Math.abs(Math.max(D.x, D.y));
|
|
352
352
|
}
|
|
353
|
-
function
|
|
353
|
+
function re(a, t) {
|
|
354
354
|
const e = a.matrixWorld, i = a.geometry, s = i.attributes.instanceStart, r = i.attributes.instanceEnd, l = Math.min(i.instanceCount, s.count);
|
|
355
355
|
for (let n = 0, o = l; n < o; n++) {
|
|
356
356
|
M.start.fromBufferAttribute(s, n), M.end.fromBufferAttribute(r, n), M.applyMatrix4(e);
|
|
357
357
|
const c = new C(), p = new C();
|
|
358
|
-
|
|
358
|
+
L.distanceSqToSegment(M.start, M.end, p, c), p.distanceTo(c) < T * 0.5 && t.push({
|
|
359
359
|
point: p,
|
|
360
360
|
pointOnLine: c,
|
|
361
|
-
distance:
|
|
361
|
+
distance: L.origin.distanceTo(p),
|
|
362
362
|
object: a,
|
|
363
363
|
face: null,
|
|
364
364
|
faceIndex: n,
|
|
@@ -367,30 +367,30 @@ function se(a, t) {
|
|
|
367
367
|
});
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
|
-
function
|
|
370
|
+
function ae(a, t, e) {
|
|
371
371
|
const i = t.projectionMatrix, r = a.material.resolution, l = a.matrixWorld, n = a.geometry, o = n.attributes.instanceStart, c = n.attributes.instanceEnd, p = Math.min(n.instanceCount, o.count), u = -t.near;
|
|
372
|
-
|
|
372
|
+
L.at(1, B), B.w = 1, B.applyMatrix4(t.matrixWorldInverse), B.applyMatrix4(i), B.multiplyScalar(1 / B.w), B.x *= r.x / 2, B.y *= r.y / 2, B.z = 0, q.copy(B), K.multiplyMatrices(t.matrixWorldInverse, l);
|
|
373
373
|
for (let m = 0, h = p; m < h; m++) {
|
|
374
374
|
if (b.fromBufferAttribute(o, m), y.fromBufferAttribute(c, m), b.w = 1, y.w = 1, b.applyMatrix4(K), y.applyMatrix4(K), b.z > u && y.z > u)
|
|
375
375
|
continue;
|
|
376
376
|
if (b.z > u) {
|
|
377
|
-
const
|
|
378
|
-
b.lerp(y,
|
|
377
|
+
const z = b.z - y.z, j = (b.z - u) / z;
|
|
378
|
+
b.lerp(y, j);
|
|
379
379
|
} else if (y.z > u) {
|
|
380
|
-
const
|
|
381
|
-
y.lerp(b,
|
|
380
|
+
const z = y.z - b.z, j = (y.z - u) / z;
|
|
381
|
+
y.lerp(b, j);
|
|
382
382
|
}
|
|
383
383
|
b.applyMatrix4(i), y.applyMatrix4(i), b.multiplyScalar(1 / b.w), y.multiplyScalar(1 / y.w), b.x *= r.x / 2, b.y *= r.y / 2, y.x *= r.x / 2, y.y *= r.y / 2, M.start.copy(b), M.start.z = 0, M.end.copy(y), M.end.z = 0;
|
|
384
384
|
const d = M.closestPointToPointParameter(q, !0);
|
|
385
385
|
M.at(d, mt);
|
|
386
|
-
const g =
|
|
387
|
-
if (w &&
|
|
386
|
+
const g = Et.lerp(b.z, y.z, d), w = g >= -1 && g <= 1, I = q.distanceTo(mt) < T * 0.5;
|
|
387
|
+
if (w && I) {
|
|
388
388
|
M.start.fromBufferAttribute(o, m), M.end.fromBufferAttribute(c, m), M.start.applyMatrix4(l), M.end.applyMatrix4(l);
|
|
389
|
-
const
|
|
390
|
-
|
|
391
|
-
point:
|
|
392
|
-
pointOnLine:
|
|
393
|
-
distance:
|
|
389
|
+
const z = new C(), j = new C();
|
|
390
|
+
L.distanceSqToSegment(M.start, M.end, j, z), e.push({
|
|
391
|
+
point: j,
|
|
392
|
+
pointOnLine: z,
|
|
393
|
+
distance: L.origin.distanceTo(j),
|
|
394
394
|
object: a,
|
|
395
395
|
face: null,
|
|
396
396
|
faceIndex: m,
|
|
@@ -400,7 +400,7 @@ function ne(a, t, e) {
|
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
|
-
class
|
|
403
|
+
class Le extends Mt {
|
|
404
404
|
constructor(t = new Kt(), e) {
|
|
405
405
|
super(t, e), this.isLineSegments2 = !0, this.type = "LineSegments2";
|
|
406
406
|
}
|
|
@@ -428,16 +428,16 @@ class ze extends Mt {
|
|
|
428
428
|
'LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'
|
|
429
429
|
);
|
|
430
430
|
const r = t.params.Line2 !== void 0 && t.params.Line2.threshold || 0;
|
|
431
|
-
|
|
431
|
+
L = t.ray;
|
|
432
432
|
const l = this.matrixWorld, n = this.geometry, o = this.material;
|
|
433
|
-
|
|
433
|
+
T = o.linewidth + r, n.boundingSphere === null && n.computeBoundingSphere(), R.copy(n.boundingSphere).applyMatrix4(l);
|
|
434
434
|
let c;
|
|
435
435
|
if (i)
|
|
436
|
-
c =
|
|
436
|
+
c = T * 0.5;
|
|
437
437
|
else {
|
|
438
438
|
const u = Math.max(
|
|
439
439
|
s.near,
|
|
440
|
-
|
|
440
|
+
R.distanceToPoint(L.origin)
|
|
441
441
|
);
|
|
442
442
|
c = vt(
|
|
443
443
|
s,
|
|
@@ -445,16 +445,16 @@ class ze extends Mt {
|
|
|
445
445
|
o.resolution
|
|
446
446
|
);
|
|
447
447
|
}
|
|
448
|
-
if (
|
|
448
|
+
if (R.radius += c, L.intersectsSphere(R) === !1)
|
|
449
449
|
return;
|
|
450
|
-
n.boundingBox === null && n.computeBoundingBox(),
|
|
450
|
+
n.boundingBox === null && n.computeBoundingBox(), k.copy(n.boundingBox).applyMatrix4(l);
|
|
451
451
|
let p;
|
|
452
452
|
if (i)
|
|
453
|
-
p =
|
|
453
|
+
p = T * 0.5;
|
|
454
454
|
else {
|
|
455
455
|
const u = Math.max(
|
|
456
456
|
s.near,
|
|
457
|
-
|
|
457
|
+
k.distanceToPoint(L.origin)
|
|
458
458
|
);
|
|
459
459
|
p = vt(
|
|
460
460
|
s,
|
|
@@ -462,14 +462,14 @@ class ze extends Mt {
|
|
|
462
462
|
o.resolution
|
|
463
463
|
);
|
|
464
464
|
}
|
|
465
|
-
|
|
465
|
+
k.expandByScalar(p), L.intersectsBox(k) !== !1 && (i ? re(this, e) : ae(this, s, e));
|
|
466
466
|
}
|
|
467
467
|
onBeforeRender(t) {
|
|
468
468
|
const e = this.material.uniforms;
|
|
469
469
|
e && e.resolution && (t.getViewport($), this.material.uniforms.resolution.value.set($.z, $.w));
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
|
-
const gt = ["encodings_fragment", "colorspace_fragment"],
|
|
472
|
+
const gt = ["encodings_fragment", "colorspace_fragment"], oe = (
|
|
473
473
|
/* glsl */
|
|
474
474
|
`
|
|
475
475
|
#include <common>
|
|
@@ -565,7 +565,7 @@ const gt = ["encodings_fragment", "colorspace_fragment"], re = (
|
|
|
565
565
|
#include <fog_vertex>
|
|
566
566
|
}
|
|
567
567
|
`
|
|
568
|
-
),
|
|
568
|
+
), le = (
|
|
569
569
|
/* glsl */
|
|
570
570
|
`
|
|
571
571
|
#include <packing>
|
|
@@ -617,14 +617,14 @@ const gt = ["encodings_fragment", "colorspace_fragment"], re = (
|
|
|
617
617
|
|
|
618
618
|
#include <fog_fragment>
|
|
619
619
|
#include <tonemapping_fragment>
|
|
620
|
-
#include <${+
|
|
620
|
+
#include <${+Rt < 154 ? gt[0] : gt[1]}>
|
|
621
621
|
}
|
|
622
622
|
`
|
|
623
623
|
);
|
|
624
|
-
class
|
|
624
|
+
class _e extends Vt {
|
|
625
625
|
constructor(t) {
|
|
626
626
|
super({
|
|
627
|
-
uniforms: Z(W({},
|
|
627
|
+
uniforms: Z(W({}, kt.fog), {
|
|
628
628
|
lineWidth: { value: 1 },
|
|
629
629
|
map: { value: null },
|
|
630
630
|
useMap: { value: 0 },
|
|
@@ -632,7 +632,7 @@ class Ie extends kt {
|
|
|
632
632
|
useAlphaMap: { value: 0 },
|
|
633
633
|
color: { value: new lt(16777215) },
|
|
634
634
|
opacity: { value: 1 },
|
|
635
|
-
resolution: { value: new
|
|
635
|
+
resolution: { value: new V(1, 1) },
|
|
636
636
|
sizeAttenuation: { value: 1 },
|
|
637
637
|
dashArray: { value: 0 },
|
|
638
638
|
dashOffset: { value: 0 },
|
|
@@ -641,19 +641,19 @@ class Ie extends kt {
|
|
|
641
641
|
useDepth: { value: 0 },
|
|
642
642
|
visibility: { value: 1 },
|
|
643
643
|
alphaTest: { value: 0 },
|
|
644
|
-
repeat: { value: new
|
|
645
|
-
offset: { value: new
|
|
644
|
+
repeat: { value: new V(1, 1) },
|
|
645
|
+
offset: { value: new V(0, 0) },
|
|
646
646
|
offsetLoop: { value: 1 },
|
|
647
647
|
lineLightAnimation: { value: 0 },
|
|
648
648
|
time: { value: 0 },
|
|
649
649
|
size: { value: 300 },
|
|
650
650
|
speed: { value: 0.3 },
|
|
651
651
|
lightWidth: { value: 0.1 },
|
|
652
|
-
uCenter: { value: new
|
|
652
|
+
uCenter: { value: new V(0, 0) },
|
|
653
653
|
lightColor: { value: new lt(16777215) }
|
|
654
654
|
}),
|
|
655
|
-
vertexShader:
|
|
656
|
-
fragmentShader:
|
|
655
|
+
vertexShader: oe,
|
|
656
|
+
fragmentShader: le
|
|
657
657
|
}), this.type = "MeshLineMaterial", Object.defineProperties(this, {
|
|
658
658
|
lineWidth: {
|
|
659
659
|
enumerable: !0,
|
|
@@ -877,7 +877,7 @@ class Ie extends kt {
|
|
|
877
877
|
return super.copy(t), this.lineWidth = t.lineWidth, this.map = t.map, this.useMap = t.useMap, this.alphaMap = t.alphaMap, this.useAlphaMap = t.useAlphaMap, this.color.copy(t.color), this.opacity = t.opacity, this.resolution.copy(t.resolution), this.sizeAttenuation = t.sizeAttenuation, this.dashArray = t.dashArray, this.dashOffset = t.dashOffset, this.dashRatio = t.dashRatio, this.useDash = t.useDash, this.visibility = t.visibility, this.alphaTest = t.alphaTest, this.repeat.copy(t.repeat), this;
|
|
878
878
|
}
|
|
879
879
|
}
|
|
880
|
-
function
|
|
880
|
+
function ce(a, t) {
|
|
881
881
|
return a.map((e) => {
|
|
882
882
|
const i = [];
|
|
883
883
|
let s;
|
|
@@ -895,7 +895,7 @@ function oe(a, t) {
|
|
|
895
895
|
}), i;
|
|
896
896
|
});
|
|
897
897
|
}
|
|
898
|
-
function
|
|
898
|
+
function ue(a, { minLng: t, maxLng: e, minLat: i, maxLat: s } = {}) {
|
|
899
899
|
const r = Math.round(et(360 / a, 2) / Math.PI), l = (1 + Math.sqrt(5)) / 2, n = (h) => h / l * 360 % 360 - 180, o = (h) => Math.acos(2 * h / r - 1) / Math.PI * 180 - 90, c = (h) => r * (Math.cos((h + 90) * Math.PI / 180) + 1) / 2, p = [
|
|
900
900
|
s !== void 0 ? Math.ceil(c(s)) : 0,
|
|
901
901
|
i !== void 0 ? Math.floor(c(i)) : r - 1
|
|
@@ -906,59 +906,59 @@ function le(a, { minLng: t, maxLng: e, minLat: i, maxLat: s } = {}) {
|
|
|
906
906
|
}
|
|
907
907
|
return m;
|
|
908
908
|
}
|
|
909
|
-
function
|
|
910
|
-
return e ?
|
|
909
|
+
function H(a, t, e = !1) {
|
|
910
|
+
return e ? Ft(t, a) : Jt(a, t);
|
|
911
911
|
}
|
|
912
|
-
function
|
|
912
|
+
function he(a, t) {
|
|
913
913
|
const e = { type: "Polygon", coordinates: a }, [[i, s], [r, l]] = wt(e);
|
|
914
914
|
if (Math.min(Math.abs(r - i), Math.abs(l - s)) < t)
|
|
915
915
|
return [];
|
|
916
916
|
const n = i > r || l >= 89 || s <= -89;
|
|
917
|
-
return
|
|
917
|
+
return ue(t, {
|
|
918
918
|
minLng: i,
|
|
919
919
|
maxLng: r,
|
|
920
920
|
minLat: s,
|
|
921
921
|
maxLat: l
|
|
922
922
|
}).filter(
|
|
923
|
-
(o) =>
|
|
923
|
+
(o) => H(o, e, n)
|
|
924
924
|
);
|
|
925
925
|
}
|
|
926
|
-
function
|
|
927
|
-
const s =
|
|
926
|
+
function fe(a, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
|
|
927
|
+
const s = ce(a, t), r = Y(s), l = he(a, t), n = [...r, ...l], o = { type: "Polygon", coordinates: a }, [[c, p], [u, m]] = wt(o), h = c > u || // crosses antimeridian
|
|
928
928
|
m >= 89 || // crosses north pole
|
|
929
929
|
p <= -89;
|
|
930
930
|
let f = [];
|
|
931
931
|
if (h) {
|
|
932
932
|
const v = te(n).triangles(), x = new Map(
|
|
933
|
-
n.map(([
|
|
933
|
+
n.map(([P, A], _) => [`${P}-${A}`, _])
|
|
934
934
|
);
|
|
935
|
-
v.features.forEach((
|
|
936
|
-
const A =
|
|
937
|
-
if (A.forEach(([S,
|
|
938
|
-
const
|
|
939
|
-
x.has(
|
|
940
|
-
}),
|
|
941
|
-
if (
|
|
942
|
-
const S =
|
|
943
|
-
if (!
|
|
935
|
+
v.features.forEach((P) => {
|
|
936
|
+
const A = P.geometry.coordinates[0].slice(0, 3).reverse(), _ = [];
|
|
937
|
+
if (A.forEach(([S, F]) => {
|
|
938
|
+
const E = `${S}-${F}`;
|
|
939
|
+
x.has(E) && _.push(x.get(E));
|
|
940
|
+
}), _.length === 3) {
|
|
941
|
+
if (_.some((S) => S < r.length)) {
|
|
942
|
+
const S = P.properties.circumcenter;
|
|
943
|
+
if (!H(
|
|
944
944
|
S,
|
|
945
945
|
o,
|
|
946
946
|
h
|
|
947
947
|
))
|
|
948
948
|
return;
|
|
949
949
|
}
|
|
950
|
-
f.push(...
|
|
950
|
+
f.push(..._);
|
|
951
951
|
}
|
|
952
952
|
});
|
|
953
953
|
} else if (l.length) {
|
|
954
|
-
const v =
|
|
955
|
-
for (let x = 0,
|
|
956
|
-
const A = [2, 1, 0].map((S) => v.triangles[x + S]),
|
|
954
|
+
const v = Yt.from(n);
|
|
955
|
+
for (let x = 0, P = v.triangles.length; x < P; x += 3) {
|
|
956
|
+
const A = [2, 1, 0].map((S) => v.triangles[x + S]), _ = A.map((S) => n[S]);
|
|
957
957
|
if (A.some((S) => S < r.length)) {
|
|
958
958
|
const S = [0, 1].map(
|
|
959
|
-
(
|
|
959
|
+
(F) => Qt(_, (E) => E[F])
|
|
960
960
|
);
|
|
961
|
-
if (!
|
|
961
|
+
if (!H(
|
|
962
962
|
S,
|
|
963
963
|
o,
|
|
964
964
|
h
|
|
@@ -968,25 +968,25 @@ function ue(a, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
|
|
|
968
968
|
f.push(...A);
|
|
969
969
|
}
|
|
970
970
|
} else {
|
|
971
|
-
const { vertices: v, holes: x = [] } =
|
|
972
|
-
f =
|
|
971
|
+
const { vertices: v, holes: x = [] } = jt(s);
|
|
972
|
+
f = Ht(v, x, 2);
|
|
973
973
|
}
|
|
974
974
|
let d = e ? [e[0], e[2]] : ut(n, (v) => v[0]), g = e ? [e[1], e[3]] : ut(n, (v) => v[1]);
|
|
975
975
|
if (i) {
|
|
976
|
-
const [v, x] = i([d[0], g[0]]), [
|
|
977
|
-
d = [v,
|
|
976
|
+
const [v, x] = i([d[0], g[0]]), [P, A] = i([d[1], g[1]]);
|
|
977
|
+
d = [v, P], g = [-x, -A];
|
|
978
978
|
}
|
|
979
|
-
const w = ht(d, [0, 1]),
|
|
979
|
+
const w = ht(d, [0, 1]), I = ht(g, [0, 1]), z = n.map(([v, x]) => {
|
|
980
980
|
if (i) {
|
|
981
|
-
const [
|
|
982
|
-
return [w(
|
|
981
|
+
const [P, A] = i([v, x]);
|
|
982
|
+
return [w(P), I(-A)];
|
|
983
983
|
} else
|
|
984
|
-
return [w(v),
|
|
984
|
+
return [w(v), I(x)];
|
|
985
985
|
});
|
|
986
|
-
return { contour: s, triangles: { points: n, indices: f, uvs:
|
|
986
|
+
return { contour: s, triangles: { points: n, indices: f, uvs: z } };
|
|
987
987
|
}
|
|
988
|
-
const bt = new
|
|
989
|
-
function
|
|
988
|
+
const bt = new X().setAttribute ? "setAttribute" : "addAttribute";
|
|
989
|
+
function N(a, t, e, i) {
|
|
990
990
|
const s = a.map(
|
|
991
991
|
(r) => r.map(([l, n]) => {
|
|
992
992
|
if (i) {
|
|
@@ -996,20 +996,20 @@ function F(a, t, e, i) {
|
|
|
996
996
|
return e ? qt(l, n, t) : [l, n, t];
|
|
997
997
|
})
|
|
998
998
|
);
|
|
999
|
-
return
|
|
999
|
+
return jt(s);
|
|
1000
1000
|
}
|
|
1001
|
-
function
|
|
1002
|
-
const { vertices: r, holes: l } =
|
|
1001
|
+
function de(a, t, e, i, s) {
|
|
1002
|
+
const { vertices: r, holes: l } = N(
|
|
1003
1003
|
a,
|
|
1004
1004
|
t,
|
|
1005
1005
|
i,
|
|
1006
1006
|
s
|
|
1007
|
-
), { vertices: n } =
|
|
1007
|
+
), { vertices: n } = N(
|
|
1008
1008
|
a,
|
|
1009
1009
|
e,
|
|
1010
1010
|
i,
|
|
1011
1011
|
s
|
|
1012
|
-
), o =
|
|
1012
|
+
), o = Y([n, r]), c = Math.round(n.length / 3), p = new Set(l);
|
|
1013
1013
|
let u = 0;
|
|
1014
1014
|
const m = [];
|
|
1015
1015
|
for (let f = 0; f < c; f++) {
|
|
@@ -1030,7 +1030,7 @@ function he(a, t, e, i, s) {
|
|
|
1030
1030
|
function yt(a, t, e, i, s, r) {
|
|
1031
1031
|
return {
|
|
1032
1032
|
indices: i ? a.indices : a.indices.slice().reverse(),
|
|
1033
|
-
vertices:
|
|
1033
|
+
vertices: N(
|
|
1034
1034
|
[a.points],
|
|
1035
1035
|
t,
|
|
1036
1036
|
s,
|
|
@@ -1039,7 +1039,7 @@ function yt(a, t, e, i, s, r) {
|
|
|
1039
1039
|
uvs: e
|
|
1040
1040
|
};
|
|
1041
1041
|
}
|
|
1042
|
-
const
|
|
1042
|
+
const pe = ({
|
|
1043
1043
|
polygonGeoJson: a,
|
|
1044
1044
|
startHeight: t,
|
|
1045
1045
|
endHeight: e,
|
|
@@ -1052,15 +1052,15 @@ const fe = ({
|
|
|
1052
1052
|
bbox: c
|
|
1053
1053
|
}) => {
|
|
1054
1054
|
a.forEach((w) => {
|
|
1055
|
-
|
|
1055
|
+
Xt(w) || w.reverse();
|
|
1056
1056
|
});
|
|
1057
|
-
const { contour: p, triangles: u } =
|
|
1057
|
+
const { contour: p, triangles: u } = fe(a, {
|
|
1058
1058
|
resolution: i,
|
|
1059
1059
|
bbox: c,
|
|
1060
1060
|
projection: o
|
|
1061
1061
|
});
|
|
1062
1062
|
let m = {}, h;
|
|
1063
|
-
r && (m =
|
|
1063
|
+
r && (m = de(
|
|
1064
1064
|
p,
|
|
1065
1065
|
t != null ? t : e,
|
|
1066
1066
|
e != null ? e : t,
|
|
@@ -1068,7 +1068,7 @@ const fe = ({
|
|
|
1068
1068
|
o
|
|
1069
1069
|
), h = m.topVerts);
|
|
1070
1070
|
let f = [];
|
|
1071
|
-
(l || n) && (f =
|
|
1071
|
+
(l || n) && (f = Y(u.uvs));
|
|
1072
1072
|
let d = {};
|
|
1073
1073
|
l && (d = yt(
|
|
1074
1074
|
u,
|
|
@@ -1088,7 +1088,7 @@ const fe = ({
|
|
|
1088
1088
|
o
|
|
1089
1089
|
)), { contour: p, triangles: u, sideTorso: m, bottomCap: d, topCap: g, topVerts: h };
|
|
1090
1090
|
};
|
|
1091
|
-
class
|
|
1091
|
+
class Te extends X {
|
|
1092
1092
|
constructor(t, e = {}) {
|
|
1093
1093
|
super(), this.type = "PolygonBufferGeometry", this.parameters = W({
|
|
1094
1094
|
polygonGeoJson: t,
|
|
@@ -1111,27 +1111,29 @@ class Be extends Y {
|
|
|
1111
1111
|
cartesian: o,
|
|
1112
1112
|
userDataRsoOffset: c,
|
|
1113
1113
|
projection: p
|
|
1114
|
-
} = this.parameters, { contour: u, sideTorso: m, topVerts: h, bottomCap: f, topCap: d } =
|
|
1115
|
-
let g = [], w = [],
|
|
1116
|
-
const
|
|
1117
|
-
const x = Math.round(g.length / 3),
|
|
1118
|
-
g = g.concat(v.vertices), w = w.concat(v.uvs),
|
|
1114
|
+
} = this.parameters, { contour: u, sideTorso: m, topVerts: h, bottomCap: f, topCap: d } = pe(W({}, this.parameters));
|
|
1115
|
+
let g = [], w = [], I = [], z = 0;
|
|
1116
|
+
const j = (v) => {
|
|
1117
|
+
const x = Math.round(g.length / 3), P = I.length;
|
|
1118
|
+
g = g.concat(v.vertices), w = w.concat(v.uvs), I = I.concat(
|
|
1119
1119
|
x ? v.indices.map((A) => A + x) : v.indices
|
|
1120
|
-
), this.addGroup(
|
|
1120
|
+
), this.addGroup(P, I.length - P, z++);
|
|
1121
1121
|
};
|
|
1122
|
-
s && r &&
|
|
1122
|
+
s && r && j(d), n && (j(m), this.userData.topVerts = c ? N(
|
|
1123
1123
|
u,
|
|
1124
1124
|
i + c,
|
|
1125
1125
|
o,
|
|
1126
1126
|
p
|
|
1127
|
-
).vertices : h), l &&
|
|
1127
|
+
).vertices : h), l && j(f), s && !r && j(d), this.setIndex(I), this[bt]("position", new G(g, 3)), this[bt]("uv", new G(w, 2)), this.computeVertexNormals();
|
|
1128
1128
|
}
|
|
1129
1129
|
}
|
|
1130
1130
|
export {
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1131
|
+
Be as B,
|
|
1132
|
+
De as I,
|
|
1133
|
+
Le as L,
|
|
1134
|
+
_e as M,
|
|
1135
|
+
Te as P,
|
|
1136
|
+
ne as R,
|
|
1137
|
+
ft as a,
|
|
1138
|
+
pe as g
|
|
1137
1139
|
};
|