gl-draw 0.15.21 → 0.15.23
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/WebGPULineSegments2.js +12 -11
- package/dist/WebGPULineSegments2.module.js +173 -166
- package/dist/core/Pencil.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/index.module.js +427 -332
- package/dist/objects/line/meshLine/MeshLineMaterial.d.ts +2 -0
- package/dist/objects/line/meshLine/fragment.d.ts +1 -1
- package/dist/objects/line/meshLine/vertex.d.ts +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/index.module.js +10 -10
- package/dist/utils/Timer.d.ts +72 -0
- package/package.json +1 -1
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var Ct = Object.defineProperty, Pt = Object.defineProperties;
|
|
2
|
+
var It = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var k = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var et = Object.prototype.hasOwnProperty, it = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var st = Math.pow, tt = (n, t, e) => t in n ? Ct(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, L = (n, t) => {
|
|
6
6
|
for (var e in t || (t = {}))
|
|
7
|
-
|
|
7
|
+
et.call(t, e) && tt(n, e, t[e]);
|
|
8
8
|
if (k)
|
|
9
9
|
for (var e of k(t))
|
|
10
|
-
|
|
10
|
+
it.call(t, e) && tt(n, e, t[e]);
|
|
11
11
|
return n;
|
|
12
|
-
},
|
|
13
|
-
var
|
|
12
|
+
}, $ = (n, t) => Pt(n, It(t));
|
|
13
|
+
var nt = (n, t) => {
|
|
14
14
|
var e = {};
|
|
15
15
|
for (var i in n)
|
|
16
|
-
|
|
16
|
+
et.call(n, i) && t.indexOf(i) < 0 && (e[i] = n[i]);
|
|
17
17
|
if (n != null && k)
|
|
18
18
|
for (var i of k(n))
|
|
19
|
-
t.indexOf(i) < 0 &&
|
|
19
|
+
t.indexOf(i) < 0 && it.call(n, i) && (e[i] = n[i]);
|
|
20
20
|
return e;
|
|
21
21
|
};
|
|
22
|
-
var
|
|
22
|
+
var rt = (n, t, e) => new Promise((i, s) => {
|
|
23
23
|
var a = (c) => {
|
|
24
24
|
try {
|
|
25
25
|
r(e.next(c));
|
|
@@ -35,22 +35,22 @@ 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
|
|
39
|
-
import { CSS2DObject as
|
|
40
|
-
import { CSS3DObject as
|
|
41
|
-
import { geoBounds as
|
|
38
|
+
import { Material as ot, Object3D as N, Texture as at, VideoTexture as Dt, BufferGeometry as Z, Float32BufferAttribute as R, PointsMaterial as Bt, Points as J, InstancedMesh as xt, Vector3 as I, Quaternion as Tt, Group as zt, Mesh as wt, Sprite as ct, Box3 as St, ShaderMaterial as _t, Vector2 as q, Color as lt, Vector4 as O, Matrix4 as Et, Line3 as Lt, Sphere as Ot, InstancedInterleavedBuffer as Vt, InterleavedBufferAttribute as ut, MathUtils as kt } from "three";
|
|
39
|
+
import { CSS2DObject as Wt } from "three/examples/jsm/renderers/CSS2DRenderer";
|
|
40
|
+
import { CSS3DObject as Ut, CSS3DSprite as Nt } from "three/examples/jsm/renderers/CSS3DRenderer";
|
|
41
|
+
import { geoBounds as jt, geoContains as Rt, geoDistance as Gt, geoInterpolate as Ft } from "d3-geo";
|
|
42
42
|
import "d3-geo-projection";
|
|
43
|
-
import { p as
|
|
44
|
-
import { merge as
|
|
45
|
-
import
|
|
46
|
-
import
|
|
47
|
-
import
|
|
48
|
-
import
|
|
49
|
-
import { geoVoronoi as
|
|
50
|
-
import { scaleLinear as
|
|
51
|
-
import { LineSegmentsGeometry as
|
|
52
|
-
const
|
|
53
|
-
class
|
|
43
|
+
import { p as ft, a as $t } from "./parseVector.module.js";
|
|
44
|
+
import { merge as H, mean as qt, extent as dt } from "d3-array";
|
|
45
|
+
import Kt, { flatten as At } from "earcut";
|
|
46
|
+
import Qt from "@turf/boolean-clockwise";
|
|
47
|
+
import Xt from "delaunator";
|
|
48
|
+
import Yt from "@turf/boolean-point-in-polygon";
|
|
49
|
+
import { geoVoronoi as Zt } from "d3-geo-voronoi";
|
|
50
|
+
import { scaleLinear as ht } from "d3-scale";
|
|
51
|
+
import { LineSegmentsGeometry as Jt } from "three/examples/jsm/lines/LineSegmentsGeometry";
|
|
52
|
+
const Ht = 0, Te = 1, te = 2, ze = !1;
|
|
53
|
+
class ee {
|
|
54
54
|
constructor() {
|
|
55
55
|
this.resources = /* @__PURE__ */ new Set(), this.disposeMaterial = !0, this.disposeVideo = !0;
|
|
56
56
|
}
|
|
@@ -59,48 +59,48 @@ class se {
|
|
|
59
59
|
return t;
|
|
60
60
|
if (Array.isArray(t))
|
|
61
61
|
return t.forEach((e) => this.track(e)), t;
|
|
62
|
-
if (!this.disposeMaterial && t instanceof
|
|
62
|
+
if (!this.disposeMaterial && t instanceof ot)
|
|
63
63
|
return t;
|
|
64
|
-
if (t instanceof
|
|
64
|
+
if (t instanceof pt ? (t.disposeTrack && t.object3d ? this.track(t.object3d) : this.resources.add(t), Object.values(t.materialList).map((e) => this.track(e))) : (t instanceof N || Reflect.has(t, "dispose")) && this.resources.add(t), t instanceof pt)
|
|
65
65
|
t.children.forEach((e) => {
|
|
66
66
|
e.disposeTrack = !1;
|
|
67
67
|
}), this.track(t.children);
|
|
68
|
-
else if (t instanceof
|
|
68
|
+
else if (t instanceof N) {
|
|
69
69
|
const e = t;
|
|
70
70
|
this.track(e.geometry), this.track(e.material), this.track(e.children);
|
|
71
|
-
} else if (t instanceof
|
|
71
|
+
} else if (t instanceof ot) {
|
|
72
72
|
for (const i of Object.values(t))
|
|
73
|
-
i instanceof
|
|
73
|
+
i instanceof at && this.track(i);
|
|
74
74
|
const e = t;
|
|
75
75
|
if (e.uniforms) {
|
|
76
76
|
for (const i of Object.values(e.uniforms))
|
|
77
77
|
if (i) {
|
|
78
78
|
const s = i.value;
|
|
79
|
-
(s instanceof
|
|
79
|
+
(s instanceof at || Array.isArray(s)) && this.track(s);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
} else this.disposeVideo && t instanceof
|
|
82
|
+
} else this.disposeVideo && t instanceof Dt && t.source.data && this.resources.add(t.source.data);
|
|
83
83
|
return t;
|
|
84
84
|
}
|
|
85
85
|
dispose() {
|
|
86
86
|
const t = [];
|
|
87
87
|
for (const e of this.resources)
|
|
88
|
-
e instanceof
|
|
88
|
+
e instanceof N ? t.push(e) : e instanceof HTMLVideoElement && e.pause(), Reflect.has(e, "dispose") && e.dispose();
|
|
89
89
|
t.forEach((e) => {
|
|
90
90
|
e.removeFromParent();
|
|
91
91
|
}), t.length = 0, this.resources.clear();
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
const
|
|
95
|
-
const e = new
|
|
94
|
+
const ie = (n, t = 1) => {
|
|
95
|
+
const e = new Z();
|
|
96
96
|
e.setAttribute(
|
|
97
97
|
"position",
|
|
98
|
-
new
|
|
98
|
+
new R(new Array(t * 3).fill(0), 3)
|
|
99
99
|
), e.setAttribute(
|
|
100
100
|
"scaleAtt",
|
|
101
|
-
new
|
|
101
|
+
new R(new Array(t).fill(1), 1)
|
|
102
102
|
);
|
|
103
|
-
const i = n.material, s = new
|
|
103
|
+
const i = n.material, s = new Bt({
|
|
104
104
|
size: 10,
|
|
105
105
|
map: i.map,
|
|
106
106
|
alphaMap: i.alphaMap,
|
|
@@ -121,22 +121,22 @@ const ne = (n, t = 1) => {
|
|
|
121
121
|
"gl_PointSize = size * scaleAtt;"
|
|
122
122
|
)}
|
|
123
123
|
`;
|
|
124
|
-
}, new
|
|
125
|
-
},
|
|
126
|
-
const e = new
|
|
124
|
+
}, new J(e, s);
|
|
125
|
+
}, se = (n, t) => {
|
|
126
|
+
const e = new N();
|
|
127
127
|
t.forEach((i, s) => {
|
|
128
|
-
const a =
|
|
128
|
+
const a = ft(i.position), l = ft(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
|
-
if (n instanceof
|
|
131
|
+
if (n instanceof xt || n.isInstantiate)
|
|
132
132
|
n.setMatrixAt(s, r);
|
|
133
|
-
else if (n instanceof
|
|
133
|
+
else if (n instanceof J || n.type === "Points") {
|
|
134
134
|
const o = n.geometry, h = o.attributes.position.array, f = o.attributes.scaleAtt.array, p = new I(), u = new I(), m = new Tt(), d = s * 3, v = s * 1;
|
|
135
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
|
};
|
|
139
|
-
class
|
|
139
|
+
class ne {
|
|
140
140
|
constructor() {
|
|
141
141
|
this.onPointerIndex = [];
|
|
142
142
|
}
|
|
@@ -165,7 +165,7 @@ class oe {
|
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
|
-
class
|
|
168
|
+
class re extends ne {
|
|
169
169
|
constructor() {
|
|
170
170
|
super(...arguments), this.userData = {}, this.materialList = {}, this.useMaterialType = "origin", this.disposeMaterialIfNotUsed = !0;
|
|
171
171
|
}
|
|
@@ -223,7 +223,7 @@ class ae extends oe {
|
|
|
223
223
|
);
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
|
-
class
|
|
226
|
+
class pt extends re {
|
|
227
227
|
constructor() {
|
|
228
228
|
super(...arguments), this.objectType = "BaseObject", this.userData = {}, this.prefab = !1, this.isInstantiate = !1, this.isBloom = !1, this.disposeTrack = !0;
|
|
229
229
|
}
|
|
@@ -284,31 +284,31 @@ class mt extends ae {
|
|
|
284
284
|
resize(t, e) {
|
|
285
285
|
}
|
|
286
286
|
show() {
|
|
287
|
-
return this.object3d.visible = !0, this.object3d.layers.set(
|
|
287
|
+
return this.object3d.visible = !0, this.object3d.layers.set(Ht), this;
|
|
288
288
|
}
|
|
289
289
|
hide() {
|
|
290
|
-
return this.object3d.visible = !1, this.object3d.layers.set(
|
|
290
|
+
return this.object3d.visible = !1, this.object3d.layers.set(te), this;
|
|
291
291
|
}
|
|
292
292
|
createGroup() {
|
|
293
|
-
return this.object3d = new
|
|
293
|
+
return this.object3d = new zt(), this;
|
|
294
294
|
}
|
|
295
295
|
createMesh(...t) {
|
|
296
|
-
return this.object3d = new
|
|
296
|
+
return this.object3d = new wt(...t), this;
|
|
297
297
|
}
|
|
298
298
|
createPoints(...t) {
|
|
299
|
-
return this.object3d = new
|
|
299
|
+
return this.object3d = new J(...t), this;
|
|
300
300
|
}
|
|
301
301
|
createCSS2DObject(t) {
|
|
302
|
-
return this.object3d = new
|
|
302
|
+
return this.object3d = new Wt(t), this;
|
|
303
303
|
}
|
|
304
304
|
createCSS3DObject(t) {
|
|
305
|
-
return this.object3d = new
|
|
305
|
+
return this.object3d = new Ut(t), this;
|
|
306
306
|
}
|
|
307
307
|
createCSS3DSprite(t) {
|
|
308
|
-
return this.object3d = new
|
|
308
|
+
return this.object3d = new Nt(t), this;
|
|
309
309
|
}
|
|
310
310
|
createSprite(t) {
|
|
311
|
-
return this.object3d = new
|
|
311
|
+
return this.object3d = new ct(t), this;
|
|
312
312
|
}
|
|
313
313
|
attach(...t) {
|
|
314
314
|
return [...t].forEach((e) => {
|
|
@@ -316,7 +316,7 @@ class mt extends ae {
|
|
|
316
316
|
}), this;
|
|
317
317
|
}
|
|
318
318
|
getSize() {
|
|
319
|
-
const t = new
|
|
319
|
+
const t = new St().setFromObject(this.object3d);
|
|
320
320
|
return {
|
|
321
321
|
min: t.min,
|
|
322
322
|
max: t.max,
|
|
@@ -333,7 +333,7 @@ class mt extends ae {
|
|
|
333
333
|
});
|
|
334
334
|
}
|
|
335
335
|
instantiate(t) {
|
|
336
|
-
return
|
|
336
|
+
return rt(this, null, function* () {
|
|
337
337
|
var c;
|
|
338
338
|
const e = (c = t == null ? void 0 : t.recursive) != null ? c : !0, { objectType: i, objectOptions: s } = this, [, a] = i.split("#");
|
|
339
339
|
let l = t == null ? void 0 : t.create;
|
|
@@ -342,19 +342,19 @@ class mt extends ae {
|
|
|
342
342
|
if (this.object3d) {
|
|
343
343
|
if ((h = t == null ? void 0 : t.instancedAttr) != null && h.length) {
|
|
344
344
|
const f = t.instancedAttr.length;
|
|
345
|
-
if (this.object3d instanceof
|
|
346
|
-
o.object3d =
|
|
345
|
+
if (this.object3d instanceof ct)
|
|
346
|
+
o.object3d = ie(this.object3d, f);
|
|
347
347
|
else {
|
|
348
348
|
const p = this.object3d, u = this.cloneMaterial();
|
|
349
|
-
o.object3d = new
|
|
349
|
+
o.object3d = new xt(p.geometry, u, f);
|
|
350
350
|
}
|
|
351
|
-
|
|
351
|
+
se(o.object3d, t == null ? void 0 : t.instancedAttr);
|
|
352
352
|
} else
|
|
353
353
|
o.object3d = this.object3d.clone(!1), o.object3d.material && (o.object3d.material = this.cloneMaterial());
|
|
354
354
|
o.object3d.userData.prefab && delete o.object3d.userData.prefab;
|
|
355
355
|
}
|
|
356
356
|
});
|
|
357
|
-
const r = yield this.lead.draw(a,
|
|
357
|
+
const r = yield this.lead.draw(a, $(L({}, s || {}), {
|
|
358
358
|
create: l,
|
|
359
359
|
prefab: !1,
|
|
360
360
|
key: (t == null ? void 0 : t.key) || (s == null ? void 0 : s.key),
|
|
@@ -385,20 +385,20 @@ class mt extends ae {
|
|
|
385
385
|
dispose() {
|
|
386
386
|
var t;
|
|
387
387
|
if (super.dispose(), (t = this.pencil.composerController) == null || t.bloomSelection.delete(this), this.lead && (this.lead.objects.delete(this.key), this.lead.objectWrapChindIdMap.delete(this), this.object3d && this.lead.objMap.delete(this.object3d)), this.disposeTrack) {
|
|
388
|
-
const e = new
|
|
388
|
+
const e = new ee();
|
|
389
389
|
e.disposeMaterial = !1, e.track(this), e.dispose();
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
|
-
function
|
|
393
|
+
function oe(n, t) {
|
|
394
394
|
return n.map((e) => {
|
|
395
395
|
const i = [];
|
|
396
396
|
let s;
|
|
397
397
|
return e.forEach((a) => {
|
|
398
398
|
if (s) {
|
|
399
|
-
const l =
|
|
399
|
+
const l = Gt(a, s) * 180 / Math.PI;
|
|
400
400
|
if (l > t) {
|
|
401
|
-
const r =
|
|
401
|
+
const r = Ft(s, a), c = 1 / Math.ceil(l / t);
|
|
402
402
|
let o = c;
|
|
403
403
|
for (; o < 1; )
|
|
404
404
|
i.push(r(o)), o += c;
|
|
@@ -408,8 +408,8 @@ function ce(n, t) {
|
|
|
408
408
|
}), i;
|
|
409
409
|
});
|
|
410
410
|
}
|
|
411
|
-
function
|
|
412
|
-
const a = Math.round(
|
|
411
|
+
function ae(n, { minLng: t, maxLng: e, minLat: i, maxLat: s } = {}) {
|
|
412
|
+
const a = Math.round(st(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 = [
|
|
413
413
|
s !== void 0 ? Math.ceil(o(s)) : 0,
|
|
414
414
|
i !== void 0 ? Math.floor(o(i)) : a - 1
|
|
415
415
|
], 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 = [];
|
|
@@ -419,30 +419,30 @@ function le(n, { minLng: t, maxLng: e, minLat: i, maxLat: s } = {}) {
|
|
|
419
419
|
}
|
|
420
420
|
return p;
|
|
421
421
|
}
|
|
422
|
-
function
|
|
423
|
-
return e ?
|
|
422
|
+
function Y(n, t, e = !1) {
|
|
423
|
+
return e ? Rt(t, n) : Yt(n, t);
|
|
424
424
|
}
|
|
425
|
-
function
|
|
426
|
-
const e = { type: "Polygon", coordinates: n }, [[i, s], [a, l]] =
|
|
425
|
+
function ce(n, t) {
|
|
426
|
+
const e = { type: "Polygon", coordinates: n }, [[i, s], [a, l]] = jt(e);
|
|
427
427
|
if (Math.min(Math.abs(a - i), Math.abs(l - s)) < t)
|
|
428
428
|
return [];
|
|
429
429
|
const r = i > a || l >= 89 || s <= -89;
|
|
430
|
-
return
|
|
430
|
+
return ae(t, {
|
|
431
431
|
minLng: i,
|
|
432
432
|
maxLng: a,
|
|
433
433
|
minLat: s,
|
|
434
434
|
maxLat: l
|
|
435
435
|
}).filter(
|
|
436
|
-
(c) =>
|
|
436
|
+
(c) => Y(c, e, r)
|
|
437
437
|
);
|
|
438
438
|
}
|
|
439
|
-
function
|
|
440
|
-
const s =
|
|
439
|
+
function le(n, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
|
|
440
|
+
const s = oe(n, t), a = H(s), l = ce(n, t), r = [...a, ...l], c = { type: "Polygon", coordinates: n }, [[o, h], [f, p]] = jt(c), u = o > f || // crosses antimeridian
|
|
441
441
|
p >= 89 || // crosses north pole
|
|
442
442
|
h <= -89;
|
|
443
443
|
let m = [];
|
|
444
444
|
if (u) {
|
|
445
|
-
const y =
|
|
445
|
+
const y = Zt(r).triangles(), x = new Map(
|
|
446
446
|
r.map(([A, C], _) => [`${A}-${C}`, _])
|
|
447
447
|
);
|
|
448
448
|
y.features.forEach((A) => {
|
|
@@ -453,7 +453,7 @@ function fe(n, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
|
|
|
453
453
|
}), _.length === 3) {
|
|
454
454
|
if (_.some((P) => P < a.length)) {
|
|
455
455
|
const P = A.properties.circumcenter;
|
|
456
|
-
if (!
|
|
456
|
+
if (!Y(
|
|
457
457
|
P,
|
|
458
458
|
c,
|
|
459
459
|
u
|
|
@@ -464,14 +464,14 @@ function fe(n, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
|
|
|
464
464
|
}
|
|
465
465
|
});
|
|
466
466
|
} else if (l.length) {
|
|
467
|
-
const y =
|
|
467
|
+
const y = Xt.from(r);
|
|
468
468
|
for (let x = 0, A = y.triangles.length; x < A; x += 3) {
|
|
469
469
|
const C = [2, 1, 0].map((P) => y.triangles[x + P]), _ = C.map((P) => r[P]);
|
|
470
470
|
if (C.some((P) => P < a.length)) {
|
|
471
471
|
const P = [0, 1].map(
|
|
472
|
-
(F) =>
|
|
472
|
+
(F) => qt(_, (V) => V[F])
|
|
473
473
|
);
|
|
474
|
-
if (!
|
|
474
|
+
if (!Y(
|
|
475
475
|
P,
|
|
476
476
|
c,
|
|
477
477
|
u
|
|
@@ -481,15 +481,15 @@ function fe(n, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
|
|
|
481
481
|
m.push(...C);
|
|
482
482
|
}
|
|
483
483
|
} else {
|
|
484
|
-
const { vertices: y, holes: x = [] } =
|
|
485
|
-
m =
|
|
484
|
+
const { vertices: y, holes: x = [] } = At(s);
|
|
485
|
+
m = Kt(y, x, 2);
|
|
486
486
|
}
|
|
487
|
-
let d = e ? [e[0], e[2]] :
|
|
487
|
+
let d = e ? [e[0], e[2]] : dt(r, (y) => y[0]), v = e ? [e[1], e[3]] : dt(r, (y) => y[1]);
|
|
488
488
|
if (i) {
|
|
489
489
|
const [y, x] = i([d[0], v[0]]), [A, C] = i([d[1], v[1]]);
|
|
490
490
|
d = [y, A], v = [-x, -C];
|
|
491
491
|
}
|
|
492
|
-
const w =
|
|
492
|
+
const w = ht(d, [0, 1]), S = ht(v, [0, 1]), D = r.map(([y, x]) => {
|
|
493
493
|
if (i) {
|
|
494
494
|
const [A, C] = i([y, x]);
|
|
495
495
|
return [w(A), S(-C)];
|
|
@@ -498,31 +498,31 @@ function fe(n, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
|
|
|
498
498
|
});
|
|
499
499
|
return { contour: s, triangles: { points: r, indices: m, uvs: D } };
|
|
500
500
|
}
|
|
501
|
-
const
|
|
502
|
-
function
|
|
501
|
+
const mt = new Z().setAttribute ? "setAttribute" : "addAttribute";
|
|
502
|
+
function G(n, t, e, i) {
|
|
503
503
|
const s = n.map(
|
|
504
504
|
(a) => a.map(([l, r]) => {
|
|
505
505
|
if (i) {
|
|
506
506
|
const [c, o] = i([l, r]);
|
|
507
507
|
return [c, -o, t];
|
|
508
508
|
}
|
|
509
|
-
return e ?
|
|
509
|
+
return e ? $t(l, r, t) : [l, r, t];
|
|
510
510
|
})
|
|
511
511
|
);
|
|
512
|
-
return
|
|
512
|
+
return At(s);
|
|
513
513
|
}
|
|
514
|
-
function
|
|
515
|
-
const { vertices: a, holes: l } =
|
|
514
|
+
function ue(n, t, e, i, s) {
|
|
515
|
+
const { vertices: a, holes: l } = G(
|
|
516
516
|
n,
|
|
517
517
|
t,
|
|
518
518
|
i,
|
|
519
519
|
s
|
|
520
|
-
), { vertices: r } =
|
|
520
|
+
), { vertices: r } = G(
|
|
521
521
|
n,
|
|
522
522
|
e,
|
|
523
523
|
i,
|
|
524
524
|
s
|
|
525
|
-
), c =
|
|
525
|
+
), c = H([r, a]), o = Math.round(r.length / 3), h = new Set(l);
|
|
526
526
|
let f = 0;
|
|
527
527
|
const p = [];
|
|
528
528
|
for (let m = 0; m < o; m++) {
|
|
@@ -540,10 +540,10 @@ function de(n, t, e, i, s) {
|
|
|
540
540
|
for (let d = 0; d < o; d += 1) u.push(d / (o - 1), m);
|
|
541
541
|
return { indices: p, vertices: c, uvs: u, topVerts: r };
|
|
542
542
|
}
|
|
543
|
-
function
|
|
543
|
+
function vt(n, t, e, i, s, a) {
|
|
544
544
|
return {
|
|
545
545
|
indices: i ? n.indices : n.indices.slice().reverse(),
|
|
546
|
-
vertices:
|
|
546
|
+
vertices: G(
|
|
547
547
|
[n.points],
|
|
548
548
|
t,
|
|
549
549
|
s,
|
|
@@ -552,7 +552,7 @@ function yt(n, t, e, i, s, a) {
|
|
|
552
552
|
uvs: e
|
|
553
553
|
};
|
|
554
554
|
}
|
|
555
|
-
const
|
|
555
|
+
const fe = ({
|
|
556
556
|
polygonGeoJson: n,
|
|
557
557
|
startHeight: t,
|
|
558
558
|
endHeight: e,
|
|
@@ -565,15 +565,15 @@ const he = ({
|
|
|
565
565
|
bbox: o
|
|
566
566
|
}) => {
|
|
567
567
|
n.forEach((w) => {
|
|
568
|
-
|
|
568
|
+
Qt(w) || w.reverse();
|
|
569
569
|
});
|
|
570
|
-
const { contour: h, triangles: f } =
|
|
570
|
+
const { contour: h, triangles: f } = le(n, {
|
|
571
571
|
resolution: i,
|
|
572
572
|
bbox: o,
|
|
573
573
|
projection: c
|
|
574
574
|
});
|
|
575
575
|
let p = {}, u;
|
|
576
|
-
a && (p =
|
|
576
|
+
a && (p = ue(
|
|
577
577
|
h,
|
|
578
578
|
t != null ? t : e,
|
|
579
579
|
e != null ? e : t,
|
|
@@ -581,9 +581,9 @@ const he = ({
|
|
|
581
581
|
c
|
|
582
582
|
), u = p.topVerts);
|
|
583
583
|
let m = [];
|
|
584
|
-
(l || r) && (m =
|
|
584
|
+
(l || r) && (m = H(f.uvs));
|
|
585
585
|
let d = {};
|
|
586
|
-
l && (d =
|
|
586
|
+
l && (d = vt(
|
|
587
587
|
f,
|
|
588
588
|
t,
|
|
589
589
|
m,
|
|
@@ -592,7 +592,7 @@ const he = ({
|
|
|
592
592
|
c
|
|
593
593
|
));
|
|
594
594
|
let v = {};
|
|
595
|
-
return r && (v =
|
|
595
|
+
return r && (v = vt(
|
|
596
596
|
f,
|
|
597
597
|
e,
|
|
598
598
|
m,
|
|
@@ -601,7 +601,7 @@ const he = ({
|
|
|
601
601
|
c
|
|
602
602
|
)), { contour: h, triangles: f, sideTorso: p, bottomCap: d, topCap: v, topVerts: u };
|
|
603
603
|
};
|
|
604
|
-
class
|
|
604
|
+
class _e extends Z {
|
|
605
605
|
constructor(t, e = {}) {
|
|
606
606
|
super(), this.type = "PolygonBufferGeometry", this.parameters = L({
|
|
607
607
|
polygonGeoJson: t,
|
|
@@ -624,7 +624,7 @@ class Le extends J {
|
|
|
624
624
|
cartesian: c,
|
|
625
625
|
userDataRsoOffset: o,
|
|
626
626
|
projection: h
|
|
627
|
-
} = this.parameters, { contour: f, sideTorso: p, topVerts: u, bottomCap: m, topCap: d } =
|
|
627
|
+
} = this.parameters, { contour: f, sideTorso: p, topVerts: u, bottomCap: m, topCap: d } = fe(L({}, this.parameters));
|
|
628
628
|
let v = [], w = [], S = [], D = 0;
|
|
629
629
|
const j = (y) => {
|
|
630
630
|
const x = Math.round(v.length / 3), A = S.length;
|
|
@@ -632,17 +632,17 @@ class Le extends J {
|
|
|
632
632
|
x ? y.indices.map((C) => C + x) : y.indices
|
|
633
633
|
), this.addGroup(A, S.length - A, D++);
|
|
634
634
|
};
|
|
635
|
-
s && a && j(d), r && (j(p), this.userData.topVerts = o ?
|
|
635
|
+
s && a && j(d), r && (j(p), this.userData.topVerts = o ? G(
|
|
636
636
|
f,
|
|
637
637
|
i + o,
|
|
638
638
|
c,
|
|
639
639
|
h
|
|
640
|
-
).vertices : u), l && j(m), s && !a && j(d), this.setIndex(S), this[
|
|
640
|
+
).vertices : u), l && j(m), s && !a && j(d), this.setIndex(S), this[mt]("position", new R(v, 3)), this[mt]("uv", new R(w, 2)), this.computeVertexNormals();
|
|
641
641
|
}
|
|
642
642
|
}
|
|
643
|
-
const
|
|
644
|
-
#include <fog_pars_fragment>
|
|
645
|
-
#include <logdepthbuf_pars_fragment>
|
|
643
|
+
const de = `
|
|
644
|
+
#include <fog_pars_fragment>
|
|
645
|
+
#include <logdepthbuf_pars_fragment>
|
|
646
646
|
|
|
647
647
|
uniform float useDash;
|
|
648
648
|
uniform float dashArray;
|
|
@@ -680,13 +680,14 @@ void main() {
|
|
|
680
680
|
c.a *= ceil(mod(vCounters + dashOffset, dashArray) - (dashArray * dashRatio));
|
|
681
681
|
}
|
|
682
682
|
gl_FragColor = c;
|
|
683
|
-
|
|
684
|
-
|
|
683
|
+
#include <fog_fragment>
|
|
684
|
+
#include <tonemapping_fragment>
|
|
685
|
+
#include <colorspace_fragment>
|
|
685
686
|
}
|
|
686
|
-
`,
|
|
687
|
+
`, he = `
|
|
687
688
|
#include <common>
|
|
688
|
-
|
|
689
|
-
|
|
689
|
+
#include <logdepthbuf_pars_vertex>
|
|
690
|
+
#include <fog_pars_vertex>
|
|
690
691
|
|
|
691
692
|
attribute vec3 previous;
|
|
692
693
|
attribute vec3 next;
|
|
@@ -772,11 +773,11 @@ void main() {
|
|
|
772
773
|
|
|
773
774
|
gl_Position = currentClip.w * vec4(withOffsetNormed, 1.0);
|
|
774
775
|
|
|
775
|
-
|
|
776
|
-
|
|
776
|
+
#include <logdepthbuf_vertex>
|
|
777
|
+
#include <fog_vertex>
|
|
777
778
|
}
|
|
778
779
|
`;
|
|
779
|
-
class
|
|
780
|
+
class Ee extends _t {
|
|
780
781
|
constructor(t = {}) {
|
|
781
782
|
const S = t, {
|
|
782
783
|
lineWidth: e = 1,
|
|
@@ -788,13 +789,13 @@ class Oe extends Lt {
|
|
|
788
789
|
dashRatio: c = 0,
|
|
789
790
|
sizeAttenuation: o = !0,
|
|
790
791
|
offsetLoop: h = !0,
|
|
791
|
-
offset: f = new
|
|
792
|
+
offset: f = new q(0, 0),
|
|
792
793
|
scaleDown: p = 0,
|
|
793
794
|
alphaMap: u = void 0,
|
|
794
795
|
alphaTest: m = 0,
|
|
795
|
-
repeat: d = new
|
|
796
|
-
resolution: v = new
|
|
797
|
-
} = S, w =
|
|
796
|
+
repeat: d = new q(1, 1),
|
|
797
|
+
resolution: v = new q(1, 1)
|
|
798
|
+
} = S, w = nt(S, [
|
|
798
799
|
"lineWidth",
|
|
799
800
|
"color",
|
|
800
801
|
"opacity",
|
|
@@ -811,10 +812,10 @@ class Oe extends Lt {
|
|
|
811
812
|
"repeat",
|
|
812
813
|
"resolution"
|
|
813
814
|
]);
|
|
814
|
-
super(
|
|
815
|
+
super($(L({}, w), {
|
|
815
816
|
uniforms: {
|
|
816
817
|
lineWidth: { value: e },
|
|
817
|
-
color: { value: new
|
|
818
|
+
color: { value: new lt(i) },
|
|
818
819
|
opacity: { value: s },
|
|
819
820
|
map: { value: a },
|
|
820
821
|
useMap: { value: a ? 1 : 0 },
|
|
@@ -832,8 +833,8 @@ class Oe extends Lt {
|
|
|
832
833
|
useAlphaMap: { value: u ? 1 : 0 },
|
|
833
834
|
repeat: { value: d }
|
|
834
835
|
},
|
|
835
|
-
vertexShader:
|
|
836
|
-
fragmentShader:
|
|
836
|
+
vertexShader: he,
|
|
837
|
+
fragmentShader: de
|
|
837
838
|
})), this.type = "MeshLineMaterial";
|
|
838
839
|
}
|
|
839
840
|
// Getter and setter for color
|
|
@@ -841,7 +842,7 @@ class Oe extends Lt {
|
|
|
841
842
|
return this.uniforms.color.value;
|
|
842
843
|
}
|
|
843
844
|
set color(t) {
|
|
844
|
-
this.uniforms.color.value = new
|
|
845
|
+
this.uniforms.color.value = new lt(t);
|
|
845
846
|
}
|
|
846
847
|
get opacity() {
|
|
847
848
|
var t;
|
|
@@ -850,6 +851,12 @@ class Oe extends Lt {
|
|
|
850
851
|
set opacity(t) {
|
|
851
852
|
this.uniforms && (this.uniforms.opacity.value = t);
|
|
852
853
|
}
|
|
854
|
+
get alphaTest() {
|
|
855
|
+
return this.uniforms.alphaTest.value;
|
|
856
|
+
}
|
|
857
|
+
set alphaTest(t) {
|
|
858
|
+
this.uniforms && (this.uniforms.alphaTest.value = t);
|
|
859
|
+
}
|
|
853
860
|
// Getter and setter for map
|
|
854
861
|
get map() {
|
|
855
862
|
return this.uniforms.map.value;
|
|
@@ -878,20 +885,20 @@ class Oe extends Lt {
|
|
|
878
885
|
this.uniforms.sizeAttenuation.value = t ? 1 : 0;
|
|
879
886
|
}
|
|
880
887
|
}
|
|
881
|
-
const
|
|
882
|
-
let
|
|
883
|
-
function
|
|
884
|
-
return
|
|
888
|
+
const K = new O(), yt = new I(), gt = new I(), g = new O(), b = new O(), B = new O(), Q = new I(), X = new Et(), M = new Lt(), bt = new I(), W = new St(), U = new Ot(), T = new O();
|
|
889
|
+
let z, E;
|
|
890
|
+
function Mt(n, t, e) {
|
|
891
|
+
return T.set(0, 0, -t, 1).applyMatrix4(n.projectionMatrix), T.multiplyScalar(1 / T.w), T.x = E / e.width, T.y = E / e.height, T.applyMatrix4(n.projectionMatrixInverse), T.multiplyScalar(1 / T.w), Math.abs(Math.max(T.x, T.y));
|
|
885
892
|
}
|
|
886
|
-
function
|
|
893
|
+
function pe(n, t) {
|
|
887
894
|
const e = n.matrixWorld, i = n.geometry, s = i.attributes.instanceStart, a = i.attributes.instanceEnd, l = Math.min(i.instanceCount, s.count);
|
|
888
895
|
for (let r = 0, c = l; r < c; r++) {
|
|
889
896
|
M.start.fromBufferAttribute(s, r), M.end.fromBufferAttribute(a, r), M.applyMatrix4(e);
|
|
890
897
|
const o = new I(), h = new I();
|
|
891
|
-
|
|
898
|
+
z.distanceSqToSegment(M.start, M.end, h, o), h.distanceTo(o) < E * 0.5 && t.push({
|
|
892
899
|
point: h,
|
|
893
900
|
pointOnLine: o,
|
|
894
|
-
distance:
|
|
901
|
+
distance: z.origin.distanceTo(h),
|
|
895
902
|
object: n,
|
|
896
903
|
face: null,
|
|
897
904
|
faceIndex: r,
|
|
@@ -900,11 +907,11 @@ function ve(n, t) {
|
|
|
900
907
|
});
|
|
901
908
|
}
|
|
902
909
|
}
|
|
903
|
-
function
|
|
910
|
+
function me(n, t, e) {
|
|
904
911
|
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;
|
|
905
|
-
|
|
912
|
+
z.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, Q.copy(B), X.multiplyMatrices(t.matrixWorldInverse, l);
|
|
906
913
|
for (let p = 0, u = h; p < u; p++) {
|
|
907
|
-
if (g.fromBufferAttribute(c, p), b.fromBufferAttribute(o, p), g.w = 1, b.w = 1, g.applyMatrix4(
|
|
914
|
+
if (g.fromBufferAttribute(c, p), b.fromBufferAttribute(o, p), g.w = 1, b.w = 1, g.applyMatrix4(X), b.applyMatrix4(X), g.z > f && b.z > f)
|
|
908
915
|
continue;
|
|
909
916
|
if (g.z > f) {
|
|
910
917
|
const D = g.z - b.z, j = (g.z - f) / D;
|
|
@@ -914,16 +921,16 @@ function ye(n, t, e) {
|
|
|
914
921
|
b.lerp(g, j);
|
|
915
922
|
}
|
|
916
923
|
g.applyMatrix4(i), b.applyMatrix4(i), g.multiplyScalar(1 / g.w), b.multiplyScalar(1 / b.w), g.x *= a.x / 2, g.y *= a.y / 2, b.x *= a.x / 2, b.y *= a.y / 2, M.start.copy(g), M.start.z = 0, M.end.copy(b), M.end.z = 0;
|
|
917
|
-
const d = M.closestPointToPointParameter(
|
|
918
|
-
M.at(d,
|
|
919
|
-
const v =
|
|
924
|
+
const d = M.closestPointToPointParameter(Q, !0);
|
|
925
|
+
M.at(d, bt);
|
|
926
|
+
const v = kt.lerp(g.z, b.z, d), w = v >= -1 && v <= 1, S = Q.distanceTo(bt) < E * 0.5;
|
|
920
927
|
if (w && S) {
|
|
921
928
|
M.start.fromBufferAttribute(c, p), M.end.fromBufferAttribute(o, p), M.start.applyMatrix4(l), M.end.applyMatrix4(l);
|
|
922
929
|
const D = new I(), j = new I();
|
|
923
|
-
|
|
930
|
+
z.distanceSqToSegment(M.start, M.end, j, D), e.push({
|
|
924
931
|
point: j,
|
|
925
932
|
pointOnLine: D,
|
|
926
|
-
distance:
|
|
933
|
+
distance: z.origin.distanceTo(j),
|
|
927
934
|
object: n,
|
|
928
935
|
face: null,
|
|
929
936
|
faceIndex: p,
|
|
@@ -933,26 +940,26 @@ function ye(n, t, e) {
|
|
|
933
940
|
}
|
|
934
941
|
}
|
|
935
942
|
}
|
|
936
|
-
class
|
|
937
|
-
constructor(t = new
|
|
943
|
+
class Le extends wt {
|
|
944
|
+
constructor(t = new Jt(), e) {
|
|
938
945
|
super(t, e), this.isLineSegments2 = !0, this.type = "LineSegments2";
|
|
939
946
|
}
|
|
940
947
|
// for backwards-compatibility, but could be a method of LineSegmentsGeometry...
|
|
941
948
|
computeLineDistances() {
|
|
942
949
|
const t = this.geometry, e = t.attributes.instanceStart, i = t.attributes.instanceEnd, s = new Float32Array(2 * e.count);
|
|
943
950
|
for (let l = 0, r = 0, c = e.count; l < c; l++, r += 2)
|
|
944
|
-
|
|
945
|
-
const a = new
|
|
951
|
+
yt.fromBufferAttribute(e, l), gt.fromBufferAttribute(i, l), s[r] = r === 0 ? 0 : s[r - 1], s[r + 1] = s[r] + yt.distanceTo(gt);
|
|
952
|
+
const a = new Vt(
|
|
946
953
|
s,
|
|
947
954
|
2,
|
|
948
955
|
1
|
|
949
956
|
);
|
|
950
957
|
return t.setAttribute(
|
|
951
958
|
"instanceDistanceStart",
|
|
952
|
-
new
|
|
959
|
+
new ut(a, 1, 0)
|
|
953
960
|
), t.setAttribute(
|
|
954
961
|
"instanceDistanceEnd",
|
|
955
|
-
new
|
|
962
|
+
new ut(a, 1, 1)
|
|
956
963
|
), this;
|
|
957
964
|
}
|
|
958
965
|
raycast(t, e) {
|
|
@@ -961,7 +968,7 @@ class Ve extends St {
|
|
|
961
968
|
'LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'
|
|
962
969
|
);
|
|
963
970
|
const a = t.params.Line2 !== void 0 && t.params.Line2.threshold || 0;
|
|
964
|
-
|
|
971
|
+
z = t.ray;
|
|
965
972
|
const l = this.matrixWorld, r = this.geometry, c = this.material;
|
|
966
973
|
E = c.linewidth + a, r.boundingSphere === null && r.computeBoundingSphere(), U.copy(r.boundingSphere).applyMatrix4(l);
|
|
967
974
|
let o;
|
|
@@ -970,45 +977,45 @@ class Ve extends St {
|
|
|
970
977
|
else {
|
|
971
978
|
const f = Math.max(
|
|
972
979
|
s.near,
|
|
973
|
-
U.distanceToPoint(
|
|
980
|
+
U.distanceToPoint(z.origin)
|
|
974
981
|
);
|
|
975
|
-
o =
|
|
982
|
+
o = Mt(
|
|
976
983
|
s,
|
|
977
984
|
f,
|
|
978
985
|
c.resolution
|
|
979
986
|
);
|
|
980
987
|
}
|
|
981
|
-
if (U.radius += o,
|
|
988
|
+
if (U.radius += o, z.intersectsSphere(U) === !1)
|
|
982
989
|
return;
|
|
983
|
-
r.boundingBox === null && r.computeBoundingBox(),
|
|
990
|
+
r.boundingBox === null && r.computeBoundingBox(), W.copy(r.boundingBox).applyMatrix4(l);
|
|
984
991
|
let h;
|
|
985
992
|
if (i)
|
|
986
993
|
h = E * 0.5;
|
|
987
994
|
else {
|
|
988
995
|
const f = Math.max(
|
|
989
996
|
s.near,
|
|
990
|
-
|
|
997
|
+
W.distanceToPoint(z.origin)
|
|
991
998
|
);
|
|
992
|
-
h =
|
|
999
|
+
h = Mt(
|
|
993
1000
|
s,
|
|
994
1001
|
f,
|
|
995
1002
|
c.resolution
|
|
996
1003
|
);
|
|
997
1004
|
}
|
|
998
|
-
|
|
1005
|
+
W.expandByScalar(h), z.intersectsBox(W) !== !1 && (i ? pe(this, e) : me(this, s, e));
|
|
999
1006
|
}
|
|
1000
1007
|
onBeforeRender(t) {
|
|
1001
1008
|
const e = this.material.uniforms;
|
|
1002
|
-
e && e.resolution && (t.getViewport(
|
|
1009
|
+
e && e.resolution && (t.getViewport(K), this.material.uniforms.resolution.value.set(K.z, K.w));
|
|
1003
1010
|
}
|
|
1004
1011
|
}
|
|
1005
1012
|
export {
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1013
|
+
Te as B,
|
|
1014
|
+
ze as I,
|
|
1015
|
+
Le as L,
|
|
1016
|
+
Ee as M,
|
|
1017
|
+
_e as P,
|
|
1018
|
+
ee as R,
|
|
1019
|
+
pt as a,
|
|
1020
|
+
fe as g
|
|
1014
1021
|
};
|