gl-draw 0.15.0-beta.30 → 0.15.0-beta.32

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.
@@ -1,46 +1,46 @@
1
1
  var Pt = Object.defineProperty, It = Object.defineProperties;
2
2
  var Dt = Object.getOwnPropertyDescriptors;
3
3
  var k = Object.getOwnPropertySymbols;
4
- var it = Object.prototype.hasOwnProperty, st = Object.prototype.propertyIsEnumerable;
5
- var nt = Math.pow, et = (n, t, e) => t in n ? Pt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, E = (n, t) => {
4
+ var it = Object.prototype.hasOwnProperty, nt = Object.prototype.propertyIsEnumerable;
5
+ var st = Math.pow, et = (s, t, e) => t in s ? Pt(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e, L = (s, t) => {
6
6
  for (var e in t || (t = {}))
7
- it.call(t, e) && et(n, e, t[e]);
7
+ it.call(t, e) && et(s, e, t[e]);
8
8
  if (k)
9
9
  for (var e of k(t))
10
- st.call(t, e) && et(n, e, t[e]);
11
- return n;
12
- }, q = (n, t) => It(n, Dt(t));
13
- var ot = (n, t) => {
10
+ nt.call(t, e) && et(s, e, t[e]);
11
+ return s;
12
+ }, q = (s, t) => It(s, Dt(t));
13
+ var rt = (s, t) => {
14
14
  var e = {};
15
- for (var i in n)
16
- it.call(n, i) && t.indexOf(i) < 0 && (e[i] = n[i]);
17
- if (n != null && k)
18
- for (var i of k(n))
19
- t.indexOf(i) < 0 && st.call(n, i) && (e[i] = n[i]);
15
+ for (var i in s)
16
+ it.call(s, i) && t.indexOf(i) < 0 && (e[i] = s[i]);
17
+ if (s != null && k)
18
+ for (var i of k(s))
19
+ t.indexOf(i) < 0 && nt.call(s, i) && (e[i] = s[i]);
20
20
  return e;
21
21
  };
22
- var rt = (n, t, e) => new Promise((i, s) => {
22
+ var ot = (s, t, e) => new Promise((i, n) => {
23
23
  var a = (c) => {
24
24
  try {
25
- o(e.next(c));
26
- } catch (r) {
27
- s(r);
25
+ r(e.next(c));
26
+ } catch (o) {
27
+ n(o);
28
28
  }
29
29
  }, l = (c) => {
30
30
  try {
31
- o(e.throw(c));
32
- } catch (r) {
33
- s(r);
31
+ r(e.throw(c));
32
+ } catch (o) {
33
+ n(o);
34
34
  }
35
- }, o = (c) => c.done ? i(c.value) : Promise.resolve(c.value).then(a, l);
36
- o((e = e.apply(n, t)).next());
35
+ }, r = (c) => c.done ? i(c.value) : Promise.resolve(c.value).then(a, l);
36
+ r((e = e.apply(s, 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 Tt, Points as H, InstancedMesh as wt, Vector3 as D, Quaternion as zt, Group as Lt, Mesh as St, Sprite as lt, Box3 as jt, Vector4 as O, Matrix4 as _t, Line3 as Et, Sphere as Ot, InstancedInterleavedBuffer as Vt, InterleavedBufferAttribute as ut, MathUtils as kt, REVISION as Wt, ShaderChunk as W, ShaderMaterial as Ut, Vector2 as K, Color as ft } from "three";
39
- import { CSS2DObject as Nt } from "three/examples/jsm/renderers/CSS2DRenderer";
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 dt } from "three";
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 dt, a as Kt } from "./parseVector.module.js";
43
+ import { p as ft, 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";
@@ -49,8 +49,8 @@ import Jt from "delaunator";
49
49
  import Ht from "@turf/boolean-point-in-polygon";
50
50
  import { geoVoronoi as te } from "d3-geo-voronoi";
51
51
  import { scaleLinear as pt } from "d3-scale";
52
- const ee = 0, Le = 1, ie = 2, _e = !1;
53
- class se {
52
+ const ee = 0, _e = 1, ie = 2, Ee = !1;
53
+ class ne {
54
54
  constructor() {
55
55
  this.resources = /* @__PURE__ */ new Set(), this.disposeMaterial = !0, this.disposeVideo = !0;
56
56
  }
@@ -75,8 +75,8 @@ class se {
75
75
  if (e.uniforms) {
76
76
  for (const i of Object.values(e.uniforms))
77
77
  if (i) {
78
- const s = i.value;
79
- (s instanceof ct || Array.isArray(s)) && this.track(s);
78
+ const n = i.value;
79
+ (n instanceof ct || Array.isArray(n)) && this.track(n);
80
80
  }
81
81
  }
82
82
  } else this.disposeVideo && t instanceof Bt && t.source.data && this.resources.add(t.source.data);
@@ -91,7 +91,7 @@ class se {
91
91
  }), t.length = 0, this.resources.clear();
92
92
  }
93
93
  }
94
- const ne = (n, t = 1) => {
94
+ const se = (s, t = 1) => {
95
95
  const e = new J();
96
96
  e.setAttribute(
97
97
  "position",
@@ -100,7 +100,7 @@ const ne = (n, t = 1) => {
100
100
  "scaleAtt",
101
101
  new G(new Array(t).fill(1), 1)
102
102
  );
103
- const i = n.material, s = new Tt({
103
+ const i = s.material, n = new zt({
104
104
  size: 10,
105
105
  map: i.map,
106
106
  alphaMap: i.alphaMap,
@@ -113,7 +113,7 @@ const ne = (n, t = 1) => {
113
113
  alphaTest: i.alphaTest,
114
114
  sizeAttenuation: !1
115
115
  });
116
- return s.onBeforeCompile = (a) => {
116
+ return n.onBeforeCompile = (a) => {
117
117
  a.vertexShader = `
118
118
  attribute float scaleAtt;
119
119
  ${a.vertexShader.replace(
@@ -121,22 +121,22 @@ const ne = (n, t = 1) => {
121
121
  "gl_PointSize = size * scaleAtt;"
122
122
  )}
123
123
  `;
124
- }, new H(e, s);
125
- }, oe = (n, t) => {
124
+ }, new H(e, n);
125
+ }, re = (s, t) => {
126
126
  const e = new R();
127
- t.forEach((i, s) => {
128
- const a = dt(i.position), l = dt(i.scale || [1, 1, 1]);
127
+ t.forEach((i, n) => {
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
- const o = e.matrix.clone();
131
- if (n instanceof wt || n.isInstantiate)
132
- n.setMatrixAt(s, o);
133
- else if (n instanceof H || n.type === "Points") {
134
- const r = n.geometry, h = r.attributes.position.array, f = r.attributes.scaleAtt.array, p = new D(), u = new D(), m = new zt(), d = s * 3, v = s * 1;
135
- o.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), r.attributes.position.needsUpdate = !0, r.attributes.scaleAtt.needsUpdate = !0;
130
+ const r = e.matrix.clone();
131
+ if (s instanceof wt || s.isInstantiate)
132
+ s.setMatrixAt(n, r);
133
+ else if (s instanceof H || s.type === "Points") {
134
+ const o = s.geometry, h = o.attributes.position.array, d = o.attributes.scaleAtt.array, p = new D(), u = new D(), m = new Tt(), f = n * 3, v = n * 1;
135
+ r.decompose(p, m, u), h[f] = p.x, h[f + 1] = p.y, h[f + 2] = p.z, d[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 re {
139
+ class oe {
140
140
  constructor() {
141
141
  this.onPointerIndex = [];
142
142
  }
@@ -165,7 +165,7 @@ class re {
165
165
  });
166
166
  }
167
167
  }
168
- class ae extends re {
168
+ class ae extends oe {
169
169
  constructor() {
170
170
  super(...arguments), this.userData = {}, this.materialList = {}, this.useMaterialType = "origin", this.disposeMaterialIfNotUsed = !0;
171
171
  }
@@ -176,16 +176,16 @@ class ae extends re {
176
176
  const e = t.material;
177
177
  if (Array.isArray(e))
178
178
  return e.map((i) => {
179
- const s = i.userData;
179
+ const n = i.userData;
180
180
  i.userData = {};
181
181
  const a = i.clone();
182
- return i.userData = s, a;
182
+ return i.userData = n, a;
183
183
  });
184
184
  {
185
185
  const i = e.userData;
186
186
  e.userData = {};
187
- const s = e.clone();
188
- return e.userData = i, s;
187
+ const n = e.clone();
188
+ return e.userData = i, n;
189
189
  }
190
190
  }
191
191
  setMaterialList(t, e) {
@@ -193,8 +193,8 @@ class ae extends re {
193
193
  if (!i || !i.material)
194
194
  return;
195
195
  this.materialList.origin || (this.materialList.origin = i.material);
196
- const s = e === "clone" ? this.cloneMaterial() : Array.isArray(e) ? e.slice() : e;
197
- return this.materialList[t] = s, s;
196
+ const n = e === "clone" ? this.cloneMaterial() : Array.isArray(e) ? e.slice() : e;
197
+ return this.materialList[t] = n, n;
198
198
  }
199
199
  useMaterial(t) {
200
200
  const e = this.object3d;
@@ -206,8 +206,8 @@ class ae extends re {
206
206
  const i = this.mList.get(t);
207
207
  if (!i)
208
208
  return;
209
- const s = this.object3d;
210
- Array.isArray(s.material) && e !== void 0 ? s.material[e] = i : s.material = i;
209
+ const n = this.object3d;
210
+ Array.isArray(n.material) && e !== void 0 ? n.material[e] = i : n.material = i;
211
211
  }
212
212
  useMListByName(t, e) {
213
213
  if (!this.mList)
@@ -290,7 +290,7 @@ class mt extends ae {
290
290
  return this.object3d.visible = !1, this.object3d.layers.set(ie), this;
291
291
  }
292
292
  createGroup() {
293
- return this.object3d = new Lt(), this;
293
+ return this.object3d = new _t(), this;
294
294
  }
295
295
  createMesh(...t) {
296
296
  return this.object3d = new St(...t), this;
@@ -299,7 +299,7 @@ class mt extends ae {
299
299
  return this.object3d = new H(...t), this;
300
300
  }
301
301
  createCSS2DObject(t) {
302
- return this.object3d = new Nt(t), this;
302
+ return this.object3d = new Ut(t), this;
303
303
  }
304
304
  createCSS3DObject(t) {
305
305
  return this.object3d = new Rt(t), this;
@@ -333,40 +333,40 @@ class mt extends ae {
333
333
  });
334
334
  }
335
335
  instantiate(t) {
336
- return rt(this, null, function* () {
336
+ return ot(this, null, function* () {
337
337
  var c;
338
- const e = (c = t == null ? void 0 : t.recursive) != null ? c : !0, { objectType: i, objectOptions: s } = this, [, a] = i.split("#");
338
+ const e = (c = t == null ? void 0 : t.recursive) != null ? c : !0, { objectType: i, objectOptions: n } = this, [, a] = i.split("#");
339
339
  let l = t == null ? void 0 : t.create;
340
- l === void 0 && (l = (r) => {
340
+ l === void 0 && (l = (o) => {
341
341
  var h;
342
342
  if (this.object3d) {
343
343
  if ((h = t == null ? void 0 : t.instancedAttr) != null && h.length) {
344
- const f = t.instancedAttr.length;
344
+ const d = t.instancedAttr.length;
345
345
  if (this.object3d instanceof lt)
346
- r.object3d = ne(this.object3d, f);
346
+ o.object3d = se(this.object3d, d);
347
347
  else {
348
348
  const p = this.object3d, u = this.cloneMaterial();
349
- r.object3d = new wt(p.geometry, u, f);
349
+ o.object3d = new wt(p.geometry, u, d);
350
350
  }
351
- oe(r.object3d, t == null ? void 0 : t.instancedAttr);
351
+ re(o.object3d, t == null ? void 0 : t.instancedAttr);
352
352
  } else
353
- r.object3d = this.object3d.clone(!1), r.object3d.material && (r.object3d.material = this.cloneMaterial());
354
- r.object3d.userData.prefab && delete r.object3d.userData.prefab;
353
+ o.object3d = this.object3d.clone(!1), o.object3d.material && (o.object3d.material = this.cloneMaterial());
354
+ o.object3d.userData.prefab && delete o.object3d.userData.prefab;
355
355
  }
356
356
  });
357
- const o = yield this.lead.draw(a, q(E({}, s || {}), {
357
+ const r = yield this.lead.draw(a, q(L({}, n || {}), {
358
358
  create: l,
359
359
  prefab: !1,
360
- key: (t == null ? void 0 : t.key) || (s == null ? void 0 : s.key),
361
- target: (t == null ? void 0 : t.target) || (s == null ? void 0 : s.target)
360
+ key: (t == null ? void 0 : t.key) || (n == null ? void 0 : n.key),
361
+ target: (t == null ? void 0 : t.target) || (n == null ? void 0 : n.target)
362
362
  }));
363
- return this.isBloom && o.enableBloom(), e && (yield Promise.all(
363
+ return this.isBloom && r.enableBloom(), e && (yield Promise.all(
364
364
  this.children.map(
365
- (r) => r.instantiate({
366
- target: o
365
+ (o) => o.instantiate({
366
+ target: r
367
367
  })
368
368
  )
369
- )), o.isInstantiate = !0, o;
369
+ )), r.isInstantiate = !0, r;
370
370
  });
371
371
  }
372
372
  erase() {
@@ -383,58 +383,58 @@ class mt extends ae {
383
383
  dispose() {
384
384
  var t;
385
385
  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) {
386
- const e = new se();
386
+ const e = new ne();
387
387
  e.disposeMaterial = !1, e.track(this), e.dispose();
388
388
  }
389
389
  }
390
390
  }
391
- const Q = new O(), vt = new D(), yt = new D(), b = new O(), g = new O(), B = new O(), X = new D(), Y = new _t(), M = new Et(), bt = new D(), U = new jt(), N = new Ot(), T = new O();
392
- let z, _;
393
- function gt(n, t, e) {
394
- return T.set(0, 0, -t, 1).applyMatrix4(n.projectionMatrix), T.multiplyScalar(1 / T.w), T.x = _ / e.width, T.y = _ / e.height, T.applyMatrix4(n.projectionMatrixInverse), T.multiplyScalar(1 / T.w), Math.abs(Math.max(T.x, T.y));
391
+ const Q = new O(), vt = new D(), bt = new D(), g = new O(), y = new O(), B = new O(), X = new D(), Y = new Et(), M = new Lt(), gt = new D(), N = new jt(), U = new Ot(), z = new O();
392
+ let T, E;
393
+ function yt(s, t, e) {
394
+ return z.set(0, 0, -t, 1).applyMatrix4(s.projectionMatrix), z.multiplyScalar(1 / z.w), z.x = E / e.width, z.y = E / e.height, z.applyMatrix4(s.projectionMatrixInverse), z.multiplyScalar(1 / z.w), Math.abs(Math.max(z.x, z.y));
395
395
  }
396
- function ce(n, t) {
397
- const e = n.matrixWorld, i = n.geometry, s = i.attributes.instanceStart, a = i.attributes.instanceEnd, l = Math.min(i.instanceCount, s.count);
398
- for (let o = 0, c = l; o < c; o++) {
399
- M.start.fromBufferAttribute(s, o), M.end.fromBufferAttribute(a, o), M.applyMatrix4(e);
400
- const r = new D(), h = new D();
401
- z.distanceSqToSegment(M.start, M.end, h, r), h.distanceTo(r) < _ * 0.5 && t.push({
396
+ function ce(s, t) {
397
+ const e = s.matrixWorld, i = s.geometry, n = i.attributes.instanceStart, a = i.attributes.instanceEnd, l = Math.min(i.instanceCount, n.count);
398
+ for (let r = 0, c = l; r < c; r++) {
399
+ M.start.fromBufferAttribute(n, r), M.end.fromBufferAttribute(a, r), M.applyMatrix4(e);
400
+ const o = new D(), h = new D();
401
+ T.distanceSqToSegment(M.start, M.end, h, o), h.distanceTo(o) < E * 0.5 && t.push({
402
402
  point: h,
403
- pointOnLine: r,
404
- distance: z.origin.distanceTo(h),
405
- object: n,
403
+ pointOnLine: o,
404
+ distance: T.origin.distanceTo(h),
405
+ object: s,
406
406
  face: null,
407
- faceIndex: o,
407
+ faceIndex: r,
408
408
  uv: null,
409
409
  uv1: null
410
410
  });
411
411
  }
412
412
  }
413
- function le(n, t, e) {
414
- const i = t.projectionMatrix, a = n.material.resolution, l = n.matrixWorld, o = n.geometry, c = o.attributes.instanceStart, r = o.attributes.instanceEnd, h = Math.min(o.instanceCount, c.count), f = -t.near;
415
- 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, X.copy(B), Y.multiplyMatrices(t.matrixWorldInverse, l);
413
+ function le(s, t, e) {
414
+ const i = t.projectionMatrix, a = s.material.resolution, l = s.matrixWorld, r = s.geometry, c = r.attributes.instanceStart, o = r.attributes.instanceEnd, h = Math.min(r.instanceCount, c.count), d = -t.near;
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(r, p), b.w = 1, g.w = 1, b.applyMatrix4(Y), g.applyMatrix4(Y), b.z > f && g.z > f)
417
+ if (g.fromBufferAttribute(c, p), y.fromBufferAttribute(o, p), g.w = 1, y.w = 1, g.applyMatrix4(Y), y.applyMatrix4(Y), g.z > d && y.z > d)
418
418
  continue;
419
- if (b.z > f) {
420
- const j = b.z - g.z, A = (b.z - f) / j;
421
- b.lerp(g, A);
422
- } else if (g.z > f) {
423
- const j = g.z - b.z, A = (g.z - f) / j;
424
- g.lerp(b, A);
419
+ if (g.z > d) {
420
+ const j = g.z - y.z, A = (g.z - d) / j;
421
+ g.lerp(y, A);
422
+ } else if (y.z > d) {
423
+ const j = y.z - g.z, A = (y.z - d) / j;
424
+ y.lerp(g, A);
425
425
  }
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 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, S = X.distanceTo(bt) < _ * 0.5;
426
+ g.applyMatrix4(i), y.applyMatrix4(i), g.multiplyScalar(1 / g.w), y.multiplyScalar(1 / y.w), g.x *= a.x / 2, g.y *= a.y / 2, y.x *= a.x / 2, y.y *= a.y / 2, M.start.copy(g), M.start.z = 0, M.end.copy(y), M.end.z = 0;
427
+ const f = M.closestPointToPointParameter(X, !0);
428
+ M.at(f, gt);
429
+ const v = kt.lerp(g.z, y.z, f), w = v >= -1 && v <= 1, S = X.distanceTo(gt) < E * 0.5;
430
430
  if (w && S) {
431
- M.start.fromBufferAttribute(c, p), M.end.fromBufferAttribute(r, p), M.start.applyMatrix4(l), M.end.applyMatrix4(l);
431
+ M.start.fromBufferAttribute(c, p), M.end.fromBufferAttribute(o, p), M.start.applyMatrix4(l), M.end.applyMatrix4(l);
432
432
  const j = new D(), A = new D();
433
- z.distanceSqToSegment(M.start, M.end, A, j), e.push({
433
+ T.distanceSqToSegment(M.start, M.end, A, j), e.push({
434
434
  point: A,
435
435
  pointOnLine: j,
436
- distance: z.origin.distanceTo(A),
437
- object: n,
436
+ distance: T.origin.distanceTo(A),
437
+ object: s,
438
438
  face: null,
439
439
  faceIndex: p,
440
440
  uv: null,
@@ -443,17 +443,17 @@ function le(n, t, e) {
443
443
  }
444
444
  }
445
445
  }
446
- class Ee extends St {
446
+ class Le extends St {
447
447
  constructor(t = new Qt(), e) {
448
448
  super(t, e), this.isLineSegments2 = !0, this.type = "LineSegments2";
449
449
  }
450
450
  // for backwards-compatibility, but could be a method of LineSegmentsGeometry...
451
451
  computeLineDistances() {
452
- const t = this.geometry, e = t.attributes.instanceStart, i = t.attributes.instanceEnd, s = new Float32Array(2 * e.count);
453
- for (let l = 0, o = 0, c = e.count; l < c; l++, o += 2)
454
- vt.fromBufferAttribute(e, l), yt.fromBufferAttribute(i, l), s[o] = o === 0 ? 0 : s[o - 1], s[o + 1] = s[o] + vt.distanceTo(yt);
452
+ const t = this.geometry, e = t.attributes.instanceStart, i = t.attributes.instanceEnd, n = new Float32Array(2 * e.count);
453
+ for (let l = 0, r = 0, c = e.count; l < c; l++, r += 2)
454
+ vt.fromBufferAttribute(e, l), bt.fromBufferAttribute(i, l), n[r] = r === 0 ? 0 : n[r - 1], n[r + 1] = n[r] + vt.distanceTo(bt);
455
455
  const a = new Vt(
456
- s,
456
+ n,
457
457
  2,
458
458
  1
459
459
  );
@@ -466,46 +466,46 @@ class Ee extends St {
466
466
  ), this;
467
467
  }
468
468
  raycast(t, e) {
469
- const i = this.material.worldUnits, s = t.camera;
470
- s === null && !i && console.error(
469
+ const i = this.material.worldUnits, n = t.camera;
470
+ n === null && !i && console.error(
471
471
  'LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'
472
472
  );
473
473
  const a = t.params.Line2 !== void 0 && t.params.Line2.threshold || 0;
474
- z = t.ray;
475
- const l = this.matrixWorld, o = this.geometry, c = this.material;
476
- _ = c.linewidth + a, o.boundingSphere === null && o.computeBoundingSphere(), N.copy(o.boundingSphere).applyMatrix4(l);
477
- let r;
474
+ T = t.ray;
475
+ const l = this.matrixWorld, r = this.geometry, c = this.material;
476
+ E = c.linewidth + a, r.boundingSphere === null && r.computeBoundingSphere(), U.copy(r.boundingSphere).applyMatrix4(l);
477
+ let o;
478
478
  if (i)
479
- r = _ * 0.5;
479
+ o = E * 0.5;
480
480
  else {
481
- const f = Math.max(
482
- s.near,
483
- N.distanceToPoint(z.origin)
481
+ const d = Math.max(
482
+ n.near,
483
+ U.distanceToPoint(T.origin)
484
484
  );
485
- r = gt(
486
- s,
487
- f,
485
+ o = yt(
486
+ n,
487
+ d,
488
488
  c.resolution
489
489
  );
490
490
  }
491
- if (N.radius += r, z.intersectsSphere(N) === !1)
491
+ if (U.radius += o, T.intersectsSphere(U) === !1)
492
492
  return;
493
- o.boundingBox === null && o.computeBoundingBox(), U.copy(o.boundingBox).applyMatrix4(l);
493
+ r.boundingBox === null && r.computeBoundingBox(), N.copy(r.boundingBox).applyMatrix4(l);
494
494
  let h;
495
495
  if (i)
496
- h = _ * 0.5;
496
+ h = E * 0.5;
497
497
  else {
498
- const f = Math.max(
499
- s.near,
500
- U.distanceToPoint(z.origin)
498
+ const d = Math.max(
499
+ n.near,
500
+ N.distanceToPoint(T.origin)
501
501
  );
502
- h = gt(
503
- s,
504
- f,
502
+ h = yt(
503
+ n,
504
+ d,
505
505
  c.resolution
506
506
  );
507
507
  }
508
- U.expandByScalar(h), z.intersectsBox(U) !== !1 && (i ? ce(this, e) : le(this, s, e));
508
+ N.expandByScalar(h), T.intersectsBox(N) !== !1 && (i ? ce(this, e) : le(this, n, e));
509
509
  }
510
510
  onBeforeRender(t) {
511
511
  const e = this.material.uniforms;
@@ -555,7 +555,7 @@ void main() {
555
555
  #include <fog_fragment>
556
556
  #include <${parseInt(Wt) < 154 ? "encodings_fragment" : "colorspace_fragment"}>
557
557
  }
558
- `, fe = `
558
+ `, de = `
559
559
  #include <common>
560
560
  ${W.logdepthbuf_pars_vertex}
561
561
  ${W.fog_pars_vertex}
@@ -599,7 +599,7 @@ void main() {
599
599
  vec2 prevScreen = intoScreen(prevNormed);
600
600
  vec2 nextScreen = intoScreen(nextNormed);
601
601
 
602
- float actualWidth = lineWidth * width;
602
+ float actualWidth = lineWidth * width *0.5;
603
603
 
604
604
  vec2 dir;
605
605
  if(nextScreen == currentScreen) {
@@ -648,26 +648,26 @@ void main() {
648
648
  ${W.fog_vertex}
649
649
  }
650
650
  `;
651
- class Oe extends Ut {
651
+ class Oe extends Nt {
652
652
  constructor(t = {}) {
653
653
  var j;
654
654
  const S = t, {
655
655
  lineWidth: e = 1,
656
656
  color: i = "#ffffff",
657
- map: s = null,
657
+ map: n = null,
658
658
  useMap: a = 0,
659
659
  dashOffset: l = 0,
660
- dashArray: o = 0,
660
+ dashArray: r = 0,
661
661
  dashRatio: c = 0,
662
- sizeAttenuation: r = !0,
662
+ sizeAttenuation: o = !0,
663
663
  offsetLoop: h = !0,
664
- offset: f = new K(0, 0),
664
+ offset: d = new K(0, 0),
665
665
  scaleDown: p = 0,
666
666
  alphaMap: u = void 0,
667
667
  alphaTest: m = 0,
668
- repeat: d = new K(1, 1),
668
+ repeat: f = new K(1, 1),
669
669
  resolution: v = new K(1, 1)
670
- } = S, w = ot(S, [
670
+ } = S, w = rt(S, [
671
671
  "lineWidth",
672
672
  "color",
673
673
  "map",
@@ -684,97 +684,122 @@ class Oe extends Ut {
684
684
  "repeat",
685
685
  "resolution"
686
686
  ]);
687
- super(q(E({}, w), {
687
+ super(q(L({}, w), {
688
688
  uniforms: {
689
689
  lineWidth: { value: e },
690
- color: { value: new ft(i) },
690
+ color: { value: new dt(i) },
691
691
  opacity: { value: (j = t.opacity) != null ? j : 1 },
692
- map: { value: s },
693
- useMap: { value: s ? 1 : a },
692
+ map: { value: n },
693
+ useMap: { value: n ? 1 : a },
694
694
  resolution: { value: v },
695
- sizeAttenuation: { value: r ? 1 : 0 },
696
- offset: { value: f },
695
+ sizeAttenuation: { value: o ? 1 : 0 },
696
+ offset: { value: d },
697
697
  offsetLoop: { value: h ? 1 : 0 },
698
- dashArray: { value: o },
698
+ dashArray: { value: r },
699
699
  dashOffset: { value: l },
700
700
  dashRatio: { value: c },
701
- useDash: { value: o > 0 ? 1 : 0 },
701
+ useDash: { value: r > 0 ? 1 : 0 },
702
702
  scaleDown: { value: p / 10 },
703
703
  alphaTest: { value: m },
704
704
  alphaMap: { value: u },
705
705
  useAlphaMap: { value: u ? 1 : 0 },
706
- repeat: { value: d }
706
+ repeat: { value: f }
707
707
  },
708
- vertexShader: fe,
708
+ vertexShader: de,
709
709
  fragmentShader: ue
710
710
  })), this.type = "MeshLineMaterial";
711
711
  }
712
- updateUniforms(t) {
713
- t.opacity !== void 0 && (this.uniforms.opacity.value = t.opacity), t.color !== void 0 && (this.uniforms.color.value = new ft(t.color)), t.map !== void 0 && (this.uniforms.map.value = t.map, this.uniforms.useMap.value = t.map ? 1 : 0), t.useMap !== void 0 && (this.uniforms.useMap.value = t.useMap), t.dashOffset !== void 0 && (this.uniforms.dashOffset.value = t.dashOffset), t.dashArray !== void 0 && (this.uniforms.dashArray.value = t.dashArray, this.uniforms.useDash.value = t.dashArray > 0 ? 1 : 0), t.dashRatio !== void 0 && (this.uniforms.dashRatio.value = t.dashRatio), t.sizeAttenuation !== void 0 && (this.uniforms.sizeAttenuation.value = t.sizeAttenuation ? 1 : 0), t.offset !== void 0 && (this.uniforms.offset.value = t.offset), t.offsetLoop !== void 0 && (this.uniforms.offsetLoop.value = t.offsetLoop ? 1 : 0), t.lineWidth !== void 0 && (this.uniforms.lineWidth.value = t.lineWidth), t.scaleDown !== void 0 && (this.uniforms.scaleDown.value = t.scaleDown / 10), t.alphaMap !== void 0 && (this.uniforms.alphaMap.value = t.alphaMap, this.uniforms.useAlphaMap.value = t.alphaMap ? 1 : 0), t.resolution !== void 0 && (this.uniforms.resolution.value = t.resolution), t.repeat !== void 0 && (this.uniforms.repeat.value = t.repeat), t.alphaTest !== void 0 && (this.uniforms.alphaTest.value = t.alphaTest);
712
+ // Getter and setter for color
713
+ get color() {
714
+ return this.uniforms.color.value;
715
+ }
716
+ set color(t) {
717
+ this.uniforms.color.value = new dt(t);
718
+ }
719
+ // Getter and setter for map
720
+ get map() {
721
+ return this.uniforms.map.value;
722
+ }
723
+ set map(t) {
724
+ this.uniforms.map.value = t, this.uniforms.useMap.value = t ? 1 : 0;
725
+ }
726
+ // Getter and setter for lineWidth
727
+ get lineWidth() {
728
+ return this.uniforms.lineWidth.value;
729
+ }
730
+ set lineWidth(t) {
731
+ this.uniforms.lineWidth.value = t;
732
+ }
733
+ // Getter and setter for sizeAttenuation
734
+ get sizeAttenuation() {
735
+ return this.uniforms.sizeAttenuation.value === 1;
736
+ }
737
+ set sizeAttenuation(t) {
738
+ this.uniforms.sizeAttenuation.value = t ? 1 : 0;
714
739
  }
715
740
  }
716
- function de(n, t) {
717
- return n.map((e) => {
741
+ function fe(s, t) {
742
+ return s.map((e) => {
718
743
  const i = [];
719
- let s;
744
+ let n;
720
745
  return e.forEach((a) => {
721
- if (s) {
722
- const l = Ft(a, s) * 180 / Math.PI;
746
+ if (n) {
747
+ const l = Ft(a, n) * 180 / Math.PI;
723
748
  if (l > t) {
724
- const o = qt(s, a), c = 1 / Math.ceil(l / t);
725
- let r = c;
726
- for (; r < 1; )
727
- i.push(o(r)), r += c;
749
+ const r = qt(n, a), c = 1 / Math.ceil(l / t);
750
+ let o = c;
751
+ for (; o < 1; )
752
+ i.push(r(o)), o += c;
728
753
  }
729
754
  }
730
- i.push(s = a);
755
+ i.push(n = a);
731
756
  }), i;
732
757
  });
733
758
  }
734
- function he(n, { minLng: t, maxLng: e, minLat: i, maxLat: s } = {}) {
735
- const a = Math.round(nt(360 / n, 2) / Math.PI), l = (1 + Math.sqrt(5)) / 2, o = (u) => u / l * 360 % 360 - 180, c = (u) => Math.acos(2 * u / a - 1) / Math.PI * 180 - 90, r = (u) => a * (Math.cos((u + 90) * Math.PI / 180) + 1) / 2, h = [
736
- s !== void 0 ? Math.ceil(r(s)) : 0,
737
- i !== void 0 ? Math.floor(r(i)) : a - 1
738
- ], 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 = [];
759
+ function he(s, { minLng: t, maxLng: e, minLat: i, maxLat: n } = {}) {
760
+ const a = Math.round(st(360 / s, 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 = [
761
+ n !== void 0 ? Math.ceil(o(n)) : 0,
762
+ i !== void 0 ? Math.floor(o(i)) : a - 1
763
+ ], d = 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 = [];
739
764
  for (let u = h[0]; u <= h[1]; u++) {
740
- const m = o(u);
741
- f(m) && p.push([m, c(u)]);
765
+ const m = r(u);
766
+ d(m) && p.push([m, c(u)]);
742
767
  }
743
768
  return p;
744
769
  }
745
- function Z(n, t, e = !1) {
746
- return e ? $t(t, n) : Ht(n, t);
770
+ function Z(s, t, e = !1) {
771
+ return e ? $t(t, s) : Ht(s, t);
747
772
  }
748
- function pe(n, t) {
749
- const e = { type: "Polygon", coordinates: n }, [[i, s], [a, l]] = At(e);
750
- if (Math.min(Math.abs(a - i), Math.abs(l - s)) < t)
773
+ function pe(s, t) {
774
+ const e = { type: "Polygon", coordinates: s }, [[i, n], [a, l]] = At(e);
775
+ if (Math.min(Math.abs(a - i), Math.abs(l - n)) < t)
751
776
  return [];
752
- const o = i > a || l >= 89 || s <= -89;
777
+ const r = i > a || l >= 89 || n <= -89;
753
778
  return he(t, {
754
779
  minLng: i,
755
780
  maxLng: a,
756
- minLat: s,
781
+ minLat: n,
757
782
  maxLat: l
758
783
  }).filter(
759
- (c) => Z(c, e, o)
784
+ (c) => Z(c, e, r)
760
785
  );
761
786
  }
762
- function me(n, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
763
- const s = de(n, t), a = tt(s), l = pe(n, t), o = [...a, ...l], c = { type: "Polygon", coordinates: n }, [[r, h], [f, p]] = At(c), u = r > f || // crosses antimeridian
787
+ function me(s, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
788
+ const n = fe(s, t), a = tt(n), l = pe(s, t), r = [...a, ...l], c = { type: "Polygon", coordinates: s }, [[o, h], [d, p]] = At(c), u = o > d || // crosses antimeridian
764
789
  p >= 89 || // crosses north pole
765
790
  h <= -89;
766
791
  let m = [];
767
792
  if (u) {
768
- const y = te(o).triangles(), x = new Map(
769
- o.map(([C, P], L) => [`${C}-${P}`, L])
793
+ const b = te(r).triangles(), x = new Map(
794
+ r.map(([C, P], _) => [`${C}-${P}`, _])
770
795
  );
771
- y.features.forEach((C) => {
772
- const P = C.geometry.coordinates[0].slice(0, 3).reverse(), L = [];
796
+ b.features.forEach((C) => {
797
+ const P = C.geometry.coordinates[0].slice(0, 3).reverse(), _ = [];
773
798
  if (P.forEach(([I, F]) => {
774
799
  const V = `${I}-${F}`;
775
- x.has(V) && L.push(x.get(V));
776
- }), L.length === 3) {
777
- if (L.some((I) => I < a.length)) {
800
+ x.has(V) && _.push(x.get(V));
801
+ }), _.length === 3) {
802
+ if (_.some((I) => I < a.length)) {
778
803
  const I = C.properties.circumcenter;
779
804
  if (!Z(
780
805
  I,
@@ -783,16 +808,16 @@ function me(n, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
783
808
  ))
784
809
  return;
785
810
  }
786
- m.push(...L);
811
+ m.push(..._);
787
812
  }
788
813
  });
789
814
  } else if (l.length) {
790
- const y = Jt.from(o);
791
- for (let x = 0, C = y.triangles.length; x < C; x += 3) {
792
- const P = [2, 1, 0].map((I) => y.triangles[x + I]), L = P.map((I) => o[I]);
815
+ const b = Jt.from(r);
816
+ for (let x = 0, C = b.triangles.length; x < C; x += 3) {
817
+ const P = [2, 1, 0].map((I) => b.triangles[x + I]), _ = P.map((I) => r[I]);
793
818
  if (P.some((I) => I < a.length)) {
794
819
  const I = [0, 1].map(
795
- (F) => Xt(L, (V) => V[F])
820
+ (F) => Xt(_, (V) => V[F])
796
821
  );
797
822
  if (!Z(
798
823
  I,
@@ -804,95 +829,95 @@ function me(n, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
804
829
  m.push(...P);
805
830
  }
806
831
  } else {
807
- const { vertices: y, holes: x = [] } = Ct(s);
808
- m = Yt(y, x, 2);
832
+ const { vertices: b, holes: x = [] } = Ct(n);
833
+ m = Yt(b, x, 2);
809
834
  }
810
- let d = e ? [e[0], e[2]] : ht(o, (y) => y[0]), v = e ? [e[1], e[3]] : ht(o, (y) => y[1]);
835
+ let f = e ? [e[0], e[2]] : ht(r, (b) => b[0]), v = e ? [e[1], e[3]] : ht(r, (b) => b[1]);
811
836
  if (i) {
812
- const [y, x] = i([d[0], v[0]]), [C, P] = i([d[1], v[1]]);
813
- d = [y, C], v = [-x, -P];
837
+ const [b, x] = i([f[0], v[0]]), [C, P] = i([f[1], v[1]]);
838
+ f = [b, C], v = [-x, -P];
814
839
  }
815
- const w = pt(d, [0, 1]), S = pt(v, [0, 1]), j = o.map(([y, x]) => {
840
+ const w = pt(f, [0, 1]), S = pt(v, [0, 1]), j = r.map(([b, x]) => {
816
841
  if (i) {
817
- const [C, P] = i([y, x]);
842
+ const [C, P] = i([b, x]);
818
843
  return [w(C), S(-P)];
819
844
  } else
820
- return [w(y), S(x)];
845
+ return [w(b), S(x)];
821
846
  });
822
- return { contour: s, triangles: { points: o, indices: m, uvs: j } };
847
+ return { contour: n, triangles: { points: r, indices: m, uvs: j } };
823
848
  }
824
849
  const Mt = new J().setAttribute ? "setAttribute" : "addAttribute";
825
- function $(n, t, e, i) {
826
- const s = n.map(
827
- (a) => a.map(([l, o]) => {
850
+ function $(s, t, e, i) {
851
+ const n = s.map(
852
+ (a) => a.map(([l, r]) => {
828
853
  if (i) {
829
- const [c, r] = i([l, o]);
830
- return [c, -r, t];
854
+ const [c, o] = i([l, r]);
855
+ return [c, -o, t];
831
856
  }
832
- return e ? Kt(l, o, t) : [l, o, t];
857
+ return e ? Kt(l, r, t) : [l, r, t];
833
858
  })
834
859
  );
835
- return Ct(s);
860
+ return Ct(n);
836
861
  }
837
- function ve(n, t, e, i, s) {
862
+ function ve(s, t, e, i, n) {
838
863
  const { vertices: a, holes: l } = $(
839
- n,
864
+ s,
840
865
  t,
841
866
  i,
842
- s
843
- ), { vertices: o } = $(
844
- n,
867
+ n
868
+ ), { vertices: r } = $(
869
+ s,
845
870
  e,
846
871
  i,
847
- s
848
- ), c = tt([o, a]), r = Math.round(o.length / 3), h = new Set(l);
849
- let f = 0;
872
+ n
873
+ ), c = tt([r, a]), o = Math.round(r.length / 3), h = new Set(l);
874
+ let d = 0;
850
875
  const p = [];
851
- for (let m = 0; m < r; m++) {
852
- let d = m + 1;
853
- if (d === r)
854
- d = f;
855
- else if (h.has(d)) {
856
- const v = d;
857
- d = f, f = v;
876
+ for (let m = 0; m < o; m++) {
877
+ let f = m + 1;
878
+ if (f === o)
879
+ f = d;
880
+ else if (h.has(f)) {
881
+ const v = f;
882
+ f = d, d = v;
858
883
  }
859
- p.push(m, m + r, d + r), p.push(d + r, d, m);
884
+ p.push(m, m + o, f + o), p.push(f + o, f, m);
860
885
  }
861
886
  const u = [];
862
887
  for (let m = 1; m >= 0; m--)
863
- for (let d = 0; d < r; d += 1) u.push(d / (r - 1), m);
864
- return { indices: p, vertices: c, uvs: u, topVerts: o };
888
+ for (let f = 0; f < o; f += 1) u.push(f / (o - 1), m);
889
+ return { indices: p, vertices: c, uvs: u, topVerts: r };
865
890
  }
866
- function xt(n, t, e, i, s, a) {
891
+ function xt(s, t, e, i, n, a) {
867
892
  return {
868
- indices: i ? n.indices : n.indices.slice().reverse(),
893
+ indices: i ? s.indices : s.indices.slice().reverse(),
869
894
  vertices: $(
870
- [n.points],
895
+ [s.points],
871
896
  t,
872
- s,
897
+ n,
873
898
  a
874
899
  ).vertices,
875
900
  uvs: e
876
901
  };
877
902
  }
878
- const ye = ({
879
- polygonGeoJson: n,
903
+ const be = ({
904
+ polygonGeoJson: s,
880
905
  startHeight: t,
881
906
  endHeight: e,
882
907
  curvatureResolution: i = 1,
883
- cartesian: s = !0,
908
+ cartesian: n = !0,
884
909
  hasSide: a = !0,
885
910
  hasBottom: l = !1,
886
- hasTop: o = !1,
911
+ hasTop: r = !1,
887
912
  projection: c,
888
- bbox: r
913
+ bbox: o
889
914
  }) => {
890
- n.forEach((w) => {
915
+ s.forEach((w) => {
891
916
  Zt(w) || w.reverse();
892
917
  });
893
- const { contour: h, triangles: f } = me(n, {
918
+ const { contour: h, triangles: d } = me(s, {
894
919
  resolution: i,
895
- bbox: r,
920
+ bbox: o,
896
921
  projection: c
897
922
  });
898
923
  let p = {}, u;
@@ -900,33 +925,33 @@ const ye = ({
900
925
  h,
901
926
  t != null ? t : e,
902
927
  e != null ? e : t,
903
- s,
928
+ n,
904
929
  c
905
930
  ), u = p.topVerts);
906
931
  let m = [];
907
- (l || o) && (m = tt(f.uvs));
908
- let d = {};
909
- l && (d = xt(
910
- f,
932
+ (l || r) && (m = tt(d.uvs));
933
+ let f = {};
934
+ l && (f = xt(
935
+ d,
911
936
  t,
912
937
  m,
913
938
  !1,
914
- s,
939
+ n,
915
940
  c
916
941
  ));
917
942
  let v = {};
918
- return o && (v = xt(
919
- f,
943
+ return r && (v = xt(
944
+ d,
920
945
  e,
921
946
  m,
922
947
  !0,
923
- s,
948
+ n,
924
949
  c
925
- )), { contour: h, triangles: f, sideTorso: p, bottomCap: d, topCap: v, topVerts: u };
950
+ )), { contour: h, triangles: d, sideTorso: p, bottomCap: f, topCap: v, topVerts: u };
926
951
  };
927
952
  class Ve extends J {
928
953
  constructor(t, e = {}) {
929
- super(), this.type = "PolygonBufferGeometry", this.parameters = E({
954
+ super(), this.type = "PolygonBufferGeometry", this.parameters = L({
930
955
  polygonGeoJson: t,
931
956
  startHeight: 0,
932
957
  endHeight: 1,
@@ -940,36 +965,36 @@ class Ve extends J {
940
965
  }, e);
941
966
  const {
942
967
  endHeight: i,
943
- hasTop: s,
968
+ hasTop: n,
944
969
  topFirst: a,
945
970
  hasBottom: l,
946
- hasSide: o,
971
+ hasSide: r,
947
972
  cartesian: c,
948
- userDataRsoOffset: r,
973
+ userDataRsoOffset: o,
949
974
  projection: h
950
- } = this.parameters, { contour: f, sideTorso: p, topVerts: u, bottomCap: m, topCap: d } = ye(E({}, this.parameters));
975
+ } = this.parameters, { contour: d, sideTorso: p, topVerts: u, bottomCap: m, topCap: f } = be(L({}, this.parameters));
951
976
  let v = [], w = [], S = [], j = 0;
952
- const A = (y) => {
977
+ const A = (b) => {
953
978
  const x = Math.round(v.length / 3), C = S.length;
954
- v = v.concat(y.vertices), w = w.concat(y.uvs), S = S.concat(
955
- x ? y.indices.map((P) => P + x) : y.indices
979
+ v = v.concat(b.vertices), w = w.concat(b.uvs), S = S.concat(
980
+ x ? b.indices.map((P) => P + x) : b.indices
956
981
  ), this.addGroup(C, S.length - C, j++);
957
982
  };
958
- s && a && A(d), o && (A(p), this.userData.topVerts = r ? $(
959
- f,
960
- i + r,
983
+ n && a && A(f), r && (A(p), this.userData.topVerts = o ? $(
984
+ d,
985
+ i + o,
961
986
  c,
962
987
  h
963
- ).vertices : u), l && A(m), s && !a && A(d), this.setIndex(S), this[Mt]("position", new G(v, 3)), this[Mt]("uv", new G(w, 2)), this.computeVertexNormals();
988
+ ).vertices : u), l && A(m), n && !a && A(f), this.setIndex(S), this[Mt]("position", new G(v, 3)), this[Mt]("uv", new G(w, 2)), this.computeVertexNormals();
964
989
  }
965
990
  }
966
991
  export {
967
- Le as B,
968
- _e as I,
969
- Ee as L,
992
+ _e as B,
993
+ Ee as I,
994
+ Le as L,
970
995
  Oe as M,
971
996
  Ve as P,
972
- se as R,
997
+ ne as R,
973
998
  mt as a,
974
- ye as g
999
+ be as g
975
1000
  };
package/dist/index2.js CHANGED
@@ -1,7 +1,7 @@
1
- "use strict";var pe=Object.defineProperty,me=Object.defineProperties;var ve=Object.getOwnPropertyDescriptors;var W=Object.getOwnPropertySymbols;var H=Object.prototype.hasOwnProperty,ee=Object.prototype.propertyIsEnumerable;var te=Math.pow,J=(s,e,t)=>e in s?pe(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,_=(s,e)=>{for(var t in e||(e={}))H.call(e,t)&&J(s,t,e[t]);if(W)for(var t of W(e))ee.call(e,t)&&J(s,t,e[t]);return s},q=(s,e)=>me(s,ve(e));var ie=(s,e)=>{var t={};for(var i in s)H.call(s,i)&&e.indexOf(i)<0&&(t[i]=s[i]);if(s!=null&&W)for(var i of W(s))e.indexOf(i)<0&&ee.call(s,i)&&(t[i]=s[i]);return t};var ne=(s,e,t)=>new Promise((i,n)=>{var c=l=>{try{r(t.next(l))}catch(a){n(a)}},u=l=>{try{r(t.throw(l))}catch(a){n(a)}},r=l=>l.done?i(l.value):Promise.resolve(l.value).then(c,u);r((t=t.apply(s,e)).next())});const o=require("three"),ye=require("three/examples/jsm/renderers/CSS2DRenderer"),se=require("three/examples/jsm/renderers/CSS3DRenderer"),z=require("d3-geo");require("d3-geo-projection");const Q=require("./parseVector.js"),be=require("three/examples/jsm/lines/LineSegmentsGeometry"),E=require("d3-array"),X=require("earcut"),ge=require("@turf/boolean-clockwise"),Me=require("delaunator"),Se=require("@turf/boolean-point-in-polygon"),xe=require("d3-geo-voronoi"),re=require("d3-scale"),we=0,je=1,Ae=2,Ce=!1;class de{constructor(){this.resources=new Set,this.disposeMaterial=!0,this.disposeVideo=!0}track(e){if(!e)return e;if(Array.isArray(e))return e.forEach(t=>this.track(t)),e;if(!this.disposeMaterial&&e instanceof o.Material)return e;if(e instanceof Y?(e.disposeTrack&&e.object3d?this.track(e.object3d):this.resources.add(e),Object.values(e.materialList).map(t=>this.track(t))):(e instanceof o.Object3D||Reflect.has(e,"dispose"))&&this.resources.add(e),e instanceof Y)e.children.forEach(t=>{t.disposeTrack=!1}),this.track(e.children);else if(e instanceof o.Object3D){const t=e;this.track(t.geometry),this.track(t.material),this.track(t.children)}else if(e instanceof o.Material){for(const i of Object.values(e))i instanceof o.Texture&&this.track(i);const t=e;if(t.uniforms){for(const i of Object.values(t.uniforms))if(i){const n=i.value;(n instanceof o.Texture||Array.isArray(n))&&this.track(n)}}}else this.disposeVideo&&e instanceof o.VideoTexture&&e.source.data&&this.resources.add(e.source.data);return e}dispose(){const e=[];for(const t of this.resources)t instanceof o.Object3D?e.push(t):t instanceof HTMLVideoElement&&t.pause(),Reflect.has(t,"dispose")&&t.dispose();e.forEach(t=>{t.removeFromParent()}),e.length=0,this.resources.clear()}}const De=(s,e=1)=>{const t=new o.BufferGeometry;t.setAttribute("position",new o.Float32BufferAttribute(new Array(e*3).fill(0),3)),t.setAttribute("scaleAtt",new o.Float32BufferAttribute(new Array(e).fill(1),1));const i=s.material,n=new o.PointsMaterial({size:10,map:i.map,alphaMap:i.alphaMap,color:i.color,blending:i.blending,depthTest:i.depthTest,depthWrite:!1,opacity:i.opacity,transparent:!0,alphaTest:i.alphaTest,sizeAttenuation:!1});return n.onBeforeCompile=c=>{c.vertexShader=`
1
+ "use strict";var pe=Object.defineProperty,me=Object.defineProperties;var ve=Object.getOwnPropertyDescriptors;var W=Object.getOwnPropertySymbols;var H=Object.prototype.hasOwnProperty,ee=Object.prototype.propertyIsEnumerable;var te=Math.pow,J=(i,e,t)=>e in i?pe(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,_=(i,e)=>{for(var t in e||(e={}))H.call(e,t)&&J(i,t,e[t]);if(W)for(var t of W(e))ee.call(e,t)&&J(i,t,e[t]);return i},q=(i,e)=>me(i,ve(e));var re=(i,e)=>{var t={};for(var r in i)H.call(i,r)&&e.indexOf(r)<0&&(t[r]=i[r]);if(i!=null&&W)for(var r of W(i))e.indexOf(r)<0&&ee.call(i,r)&&(t[r]=i[r]);return t};var ne=(i,e,t)=>new Promise((r,n)=>{var c=l=>{try{s(t.next(l))}catch(a){n(a)}},u=l=>{try{s(t.throw(l))}catch(a){n(a)}},s=l=>l.done?r(l.value):Promise.resolve(l.value).then(c,u);s((t=t.apply(i,e)).next())});const o=require("three"),be=require("three/examples/jsm/renderers/CSS2DRenderer"),ie=require("three/examples/jsm/renderers/CSS3DRenderer"),O=require("d3-geo");require("d3-geo-projection");const Q=require("./parseVector.js"),ge=require("three/examples/jsm/lines/LineSegmentsGeometry"),L=require("d3-array"),X=require("earcut"),ye=require("@turf/boolean-clockwise"),Me=require("delaunator"),Se=require("@turf/boolean-point-in-polygon"),xe=require("d3-geo-voronoi"),se=require("d3-scale"),we=0,je=1,Ae=2,Ce=!1;class fe{constructor(){this.resources=new Set,this.disposeMaterial=!0,this.disposeVideo=!0}track(e){if(!e)return e;if(Array.isArray(e))return e.forEach(t=>this.track(t)),e;if(!this.disposeMaterial&&e instanceof o.Material)return e;if(e instanceof Y?(e.disposeTrack&&e.object3d?this.track(e.object3d):this.resources.add(e),Object.values(e.materialList).map(t=>this.track(t))):(e instanceof o.Object3D||Reflect.has(e,"dispose"))&&this.resources.add(e),e instanceof Y)e.children.forEach(t=>{t.disposeTrack=!1}),this.track(e.children);else if(e instanceof o.Object3D){const t=e;this.track(t.geometry),this.track(t.material),this.track(t.children)}else if(e instanceof o.Material){for(const r of Object.values(e))r instanceof o.Texture&&this.track(r);const t=e;if(t.uniforms){for(const r of Object.values(t.uniforms))if(r){const n=r.value;(n instanceof o.Texture||Array.isArray(n))&&this.track(n)}}}else this.disposeVideo&&e instanceof o.VideoTexture&&e.source.data&&this.resources.add(e.source.data);return e}dispose(){const e=[];for(const t of this.resources)t instanceof o.Object3D?e.push(t):t instanceof HTMLVideoElement&&t.pause(),Reflect.has(t,"dispose")&&t.dispose();e.forEach(t=>{t.removeFromParent()}),e.length=0,this.resources.clear()}}const Pe=(i,e=1)=>{const t=new o.BufferGeometry;t.setAttribute("position",new o.Float32BufferAttribute(new Array(e*3).fill(0),3)),t.setAttribute("scaleAtt",new o.Float32BufferAttribute(new Array(e).fill(1),1));const r=i.material,n=new o.PointsMaterial({size:10,map:r.map,alphaMap:r.alphaMap,color:r.color,blending:r.blending,depthTest:r.depthTest,depthWrite:!1,opacity:r.opacity,transparent:!0,alphaTest:r.alphaTest,sizeAttenuation:!1});return n.onBeforeCompile=c=>{c.vertexShader=`
2
2
  attribute float scaleAtt;
3
3
  ${c.vertexShader.replace("gl_PointSize = size;","gl_PointSize = size * scaleAtt;")}
4
- `},new o.Points(t,n)},Pe=(s,e)=>{const t=new o.Object3D;e.forEach((i,n)=>{const c=Q.parseVector3(i.position),u=Q.parseVector3(i.scale||[1,1,1]);t.position.copy(c),t.scale.copy(u),t.updateMatrix();const r=t.matrix.clone();if(s instanceof o.InstancedMesh||s.isInstantiate)s.setMatrixAt(n,r);else if(s instanceof o.Points||s.type==="Points"){const a=s.geometry,p=a.attributes.position.array,d=a.attributes.scaleAtt.array,m=new o.Vector3,f=new o.Vector3,v=new o.Quaternion,h=n*3,y=n*1;r.decompose(m,v,f),p[h]=m.x,p[h+1]=m.y,p[h+2]=m.z,d[y]=Math.max(f.x,f.y,f.z),a.attributes.position.needsUpdate=!0,a.attributes.scaleAtt.needsUpdate=!0}})};class Be{constructor(){this.onPointerIndex=[]}onPointerEvent(e,t){const i=this.lead.handlePick([this],e,t);this.onPointerIndex.push(i)}onClick(e){this.onPointerEvent("click",e)}onPointerEnter(e){this.onPointerEvent("enter",e)}onPointerLeave(e){this.onPointerEvent("leave",e)}onPointerMove(e){this.onPointerEvent("move",e)}onPointerDown(e){this.onPointerEvent("down",e)}dispose(){this.onPointerIndex.forEach(e=>{this.lead.removePick(e)})}}class Ie extends Be{constructor(){super(...arguments),this.userData={},this.materialList={},this.useMaterialType="origin",this.disposeMaterialIfNotUsed=!0}cloneMaterial(){const e=this.object3d;if(!e||!e.material)return;const t=e.material;if(Array.isArray(t))return t.map(i=>{const n=i.userData;i.userData={};const c=i.clone();return i.userData=n,c});{const i=t.userData;t.userData={};const n=t.clone();return t.userData=i,n}}setMaterialList(e,t){const i=this.object3d;if(!i||!i.material)return;this.materialList.origin||(this.materialList.origin=i.material);const n=t==="clone"?this.cloneMaterial():Array.isArray(t)?t.slice():t;return this.materialList[e]=n,n}useMaterial(e){const t=this.object3d;!t||!t.material||this.useMaterialType===e||!this.materialList[e]||(this.useMaterialType=e,t.material=this.materialList[e])}useMListById(e,t){if(!this.mList)return;const i=this.mList.get(e);if(!i)return;const n=this.object3d;Array.isArray(n.material)&&t!==void 0?n.material[t]=i:n.material=i}useMListByName(e,t){if(!this.mList)return;const i=this.mList.getKeyByName(e);i&&this.useMListById(i,t)}dispose(){super.dispose(),this.mList.rmBaseObjectMap(this,void 0,this.disposeMaterialIfNotUsed)}}class Y extends Ie{constructor(){super(...arguments),this.objectType="BaseObject",this.userData={},this.prefab=!1,this.isInstantiate=!1,this.isBloom=!1,this.disposeTrack=!0}get parent(){const e=this.object3d.parent;return e&&this.lead.objMap.get(e)||null}get children(){return this.object3d.children.map(e=>this.lead.objMap.get(e)).filter(e=>!!e)}get position(){return this.object3d.position}get rotation(){return this.object3d.rotation}get scale(){return this.object3d.scale}get lookAt(){return this.object3d.lookAt}add(...e){[...e].forEach(t=>{this.lead.objMap.get(t)?this.object3d.add(t):this.lead.createBaseObject(t,{target:this})})}remove(...e){[...e].forEach(t=>{var i;this.lead.objMap.get(t)?(i=this.lead.objMap.get(t))==null||i.erase():this.object3d.remove(t)})}get visible(){return this.object3d.visible}get visibleWithAncestors(){if(this.visible){let e=this.parent;for(;e;){if(!e.visible)return!1;e=e.parent}return!0}else return!1}create(){this.createGroup()}render(){}update(e,t){}resize(e,t){}show(){return this.object3d.visible=!0,this.object3d.layers.set(we),this}hide(){return this.object3d.visible=!1,this.object3d.layers.set(Ae),this}createGroup(){return this.object3d=new o.Group,this}createMesh(...e){return this.object3d=new o.Mesh(...e),this}createPoints(...e){return this.object3d=new o.Points(...e),this}createCSS2DObject(e){return this.object3d=new ye.CSS2DObject(e),this}createCSS3DObject(e){return this.object3d=new se.CSS3DObject(e),this}createCSS3DSprite(e){return this.object3d=new se.CSS3DSprite(e),this}createSprite(e){return this.object3d=new o.Sprite(e),this}attach(...e){return[...e].forEach(t=>{this.object3d.attach(t.object3d)}),this}getSize(){const e=new o.Box3().setFromObject(this.object3d);return{min:e.min,max:e.max,size:e.getSize(new o.Vector3),center:e.getCenter(new o.Vector3)}}setTop(e){this.object3d&&(this.object3d.renderOrder=e)}traverse(e){e(this),this.children.forEach(t=>{t.traverse(e)})}instantiate(e){return ne(this,null,function*(){var l;const t=(l=e==null?void 0:e.recursive)!=null?l:!0,{objectType:i,objectOptions:n}=this,[,c]=i.split("#");let u=e==null?void 0:e.create;u===void 0&&(u=a=>{var p;if(this.object3d){if((p=e==null?void 0:e.instancedAttr)!=null&&p.length){const d=e.instancedAttr.length;if(this.object3d instanceof o.Sprite)a.object3d=De(this.object3d,d);else{const m=this.object3d,f=this.cloneMaterial();a.object3d=new o.InstancedMesh(m.geometry,f,d)}Pe(a.object3d,e==null?void 0:e.instancedAttr)}else a.object3d=this.object3d.clone(!1),a.object3d.material&&(a.object3d.material=this.cloneMaterial());a.object3d.userData.prefab&&delete a.object3d.userData.prefab}});const r=yield this.lead.draw(c,q(_({},n||{}),{create:u,prefab:!1,key:(e==null?void 0:e.key)||(n==null?void 0:n.key),target:(e==null?void 0:e.target)||(n==null?void 0:n.target)}));return this.isBloom&&r.enableBloom(),t&&(yield Promise.all(this.children.map(a=>a.instantiate({target:r})))),r.isInstantiate=!0,r})}erase(){this.lead.erase(this)}enableBloom(){var e;(e=this.pencil.composerController)==null||e.setBloomSelection(this,!0),this.isBloom=!0}disableBloom(){var e;(e=this.pencil.composerController)==null||e.setBloomSelection(this,!1),this.isBloom=!1}dispose(){var e;if(super.dispose(),(e=this.pencil.composerController)==null||e.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){const t=new de;t.disposeMaterial=!1,t.track(this),t.dispose()}}}const F=new o.Vector4,oe=new o.Vector3,ae=new o.Vector3,g=new o.Vector4,M=new o.Vector4,I=new o.Vector4,$=new o.Vector3,K=new o.Matrix4,S=new o.Line3,ce=new o.Vector3,N=new o.Box3,U=new o.Sphere,V=new o.Vector4;let T,O;function le(s,e,t){return V.set(0,0,-e,1).applyMatrix4(s.projectionMatrix),V.multiplyScalar(1/V.w),V.x=O/t.width,V.y=O/t.height,V.applyMatrix4(s.projectionMatrixInverse),V.multiplyScalar(1/V.w),Math.abs(Math.max(V.x,V.y))}function Ve(s,e){const t=s.matrixWorld,i=s.geometry,n=i.attributes.instanceStart,c=i.attributes.instanceEnd,u=Math.min(i.instanceCount,n.count);for(let r=0,l=u;r<l;r++){S.start.fromBufferAttribute(n,r),S.end.fromBufferAttribute(c,r),S.applyMatrix4(t);const a=new o.Vector3,p=new o.Vector3;T.distanceSqToSegment(S.start,S.end,p,a),p.distanceTo(a)<O*.5&&e.push({point:p,pointOnLine:a,distance:T.origin.distanceTo(p),object:s,face:null,faceIndex:r,uv:null,uv1:null})}}function Te(s,e,t){const i=e.projectionMatrix,c=s.material.resolution,u=s.matrixWorld,r=s.geometry,l=r.attributes.instanceStart,a=r.attributes.instanceEnd,p=Math.min(r.instanceCount,l.count),d=-e.near;T.at(1,I),I.w=1,I.applyMatrix4(e.matrixWorldInverse),I.applyMatrix4(i),I.multiplyScalar(1/I.w),I.x*=c.x/2,I.y*=c.y/2,I.z=0,$.copy(I),K.multiplyMatrices(e.matrixWorldInverse,u);for(let m=0,f=p;m<f;m++){if(g.fromBufferAttribute(l,m),M.fromBufferAttribute(a,m),g.w=1,M.w=1,g.applyMatrix4(K),M.applyMatrix4(K),g.z>d&&M.z>d)continue;if(g.z>d){const A=g.z-M.z,C=(g.z-d)/A;g.lerp(M,C)}else if(M.z>d){const A=M.z-g.z,C=(M.z-d)/A;M.lerp(g,C)}g.applyMatrix4(i),M.applyMatrix4(i),g.multiplyScalar(1/g.w),M.multiplyScalar(1/M.w),g.x*=c.x/2,g.y*=c.y/2,M.x*=c.x/2,M.y*=c.y/2,S.start.copy(g),S.start.z=0,S.end.copy(M),S.end.z=0;const h=S.closestPointToPointParameter($,!0);S.at(h,ce);const y=o.MathUtils.lerp(g.z,M.z,h),w=y>=-1&&y<=1,j=$.distanceTo(ce)<O*.5;if(w&&j){S.start.fromBufferAttribute(l,m),S.end.fromBufferAttribute(a,m),S.start.applyMatrix4(u),S.end.applyMatrix4(u);const A=new o.Vector3,C=new o.Vector3;T.distanceSqToSegment(S.start,S.end,C,A),t.push({point:C,pointOnLine:A,distance:T.origin.distanceTo(C),object:s,face:null,faceIndex:m,uv:null,uv1:null})}}}class Le extends o.Mesh{constructor(e=new be.LineSegmentsGeometry,t){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,i=e.attributes.instanceEnd,n=new Float32Array(2*t.count);for(let u=0,r=0,l=t.count;u<l;u++,r+=2)oe.fromBufferAttribute(t,u),ae.fromBufferAttribute(i,u),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+oe.distanceTo(ae);const c=new o.InstancedInterleavedBuffer(n,2,1);return e.setAttribute("instanceDistanceStart",new o.InterleavedBufferAttribute(c,1,0)),e.setAttribute("instanceDistanceEnd",new o.InterleavedBufferAttribute(c,1,1)),this}raycast(e,t){const i=this.material.worldUnits,n=e.camera;n===null&&!i&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const c=e.params.Line2!==void 0&&e.params.Line2.threshold||0;T=e.ray;const u=this.matrixWorld,r=this.geometry,l=this.material;O=l.linewidth+c,r.boundingSphere===null&&r.computeBoundingSphere(),U.copy(r.boundingSphere).applyMatrix4(u);let a;if(i)a=O*.5;else{const d=Math.max(n.near,U.distanceToPoint(T.origin));a=le(n,d,l.resolution)}if(U.radius+=a,T.intersectsSphere(U)===!1)return;r.boundingBox===null&&r.computeBoundingBox(),N.copy(r.boundingBox).applyMatrix4(u);let p;if(i)p=O*.5;else{const d=Math.max(n.near,N.distanceToPoint(T.origin));p=le(n,d,l.resolution)}N.expandByScalar(p),T.intersectsBox(N)!==!1&&(i?Ve(this,t):Te(this,n,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(F),this.material.uniforms.resolution.value.set(F.z,F.w))}}const Oe=`
4
+ `},new o.Points(t,n)},Be=(i,e)=>{const t=new o.Object3D;e.forEach((r,n)=>{const c=Q.parseVector3(r.position),u=Q.parseVector3(r.scale||[1,1,1]);t.position.copy(c),t.scale.copy(u),t.updateMatrix();const s=t.matrix.clone();if(i instanceof o.InstancedMesh||i.isInstantiate)i.setMatrixAt(n,s);else if(i instanceof o.Points||i.type==="Points"){const a=i.geometry,p=a.attributes.position.array,f=a.attributes.scaleAtt.array,m=new o.Vector3,d=new o.Vector3,v=new o.Quaternion,h=n*3,b=n*1;s.decompose(m,v,d),p[h]=m.x,p[h+1]=m.y,p[h+2]=m.z,f[b]=Math.max(d.x,d.y,d.z),a.attributes.position.needsUpdate=!0,a.attributes.scaleAtt.needsUpdate=!0}})};class Ie{constructor(){this.onPointerIndex=[]}onPointerEvent(e,t){const r=this.lead.handlePick([this],e,t);this.onPointerIndex.push(r)}onClick(e){this.onPointerEvent("click",e)}onPointerEnter(e){this.onPointerEvent("enter",e)}onPointerLeave(e){this.onPointerEvent("leave",e)}onPointerMove(e){this.onPointerEvent("move",e)}onPointerDown(e){this.onPointerEvent("down",e)}dispose(){this.onPointerIndex.forEach(e=>{this.lead.removePick(e)})}}class De extends Ie{constructor(){super(...arguments),this.userData={},this.materialList={},this.useMaterialType="origin",this.disposeMaterialIfNotUsed=!0}cloneMaterial(){const e=this.object3d;if(!e||!e.material)return;const t=e.material;if(Array.isArray(t))return t.map(r=>{const n=r.userData;r.userData={};const c=r.clone();return r.userData=n,c});{const r=t.userData;t.userData={};const n=t.clone();return t.userData=r,n}}setMaterialList(e,t){const r=this.object3d;if(!r||!r.material)return;this.materialList.origin||(this.materialList.origin=r.material);const n=t==="clone"?this.cloneMaterial():Array.isArray(t)?t.slice():t;return this.materialList[e]=n,n}useMaterial(e){const t=this.object3d;!t||!t.material||this.useMaterialType===e||!this.materialList[e]||(this.useMaterialType=e,t.material=this.materialList[e])}useMListById(e,t){if(!this.mList)return;const r=this.mList.get(e);if(!r)return;const n=this.object3d;Array.isArray(n.material)&&t!==void 0?n.material[t]=r:n.material=r}useMListByName(e,t){if(!this.mList)return;const r=this.mList.getKeyByName(e);r&&this.useMListById(r,t)}dispose(){super.dispose(),this.mList.rmBaseObjectMap(this,void 0,this.disposeMaterialIfNotUsed)}}class Y extends De{constructor(){super(...arguments),this.objectType="BaseObject",this.userData={},this.prefab=!1,this.isInstantiate=!1,this.isBloom=!1,this.disposeTrack=!0}get parent(){const e=this.object3d.parent;return e&&this.lead.objMap.get(e)||null}get children(){return this.object3d.children.map(e=>this.lead.objMap.get(e)).filter(e=>!!e)}get position(){return this.object3d.position}get rotation(){return this.object3d.rotation}get scale(){return this.object3d.scale}get lookAt(){return this.object3d.lookAt}add(...e){[...e].forEach(t=>{this.lead.objMap.get(t)?this.object3d.add(t):this.lead.createBaseObject(t,{target:this})})}remove(...e){[...e].forEach(t=>{var r;this.lead.objMap.get(t)?(r=this.lead.objMap.get(t))==null||r.erase():this.object3d.remove(t)})}get visible(){return this.object3d.visible}get visibleWithAncestors(){if(this.visible){let e=this.parent;for(;e;){if(!e.visible)return!1;e=e.parent}return!0}else return!1}create(){this.createGroup()}render(){}update(e,t){}resize(e,t){}show(){return this.object3d.visible=!0,this.object3d.layers.set(we),this}hide(){return this.object3d.visible=!1,this.object3d.layers.set(Ae),this}createGroup(){return this.object3d=new o.Group,this}createMesh(...e){return this.object3d=new o.Mesh(...e),this}createPoints(...e){return this.object3d=new o.Points(...e),this}createCSS2DObject(e){return this.object3d=new be.CSS2DObject(e),this}createCSS3DObject(e){return this.object3d=new ie.CSS3DObject(e),this}createCSS3DSprite(e){return this.object3d=new ie.CSS3DSprite(e),this}createSprite(e){return this.object3d=new o.Sprite(e),this}attach(...e){return[...e].forEach(t=>{this.object3d.attach(t.object3d)}),this}getSize(){const e=new o.Box3().setFromObject(this.object3d);return{min:e.min,max:e.max,size:e.getSize(new o.Vector3),center:e.getCenter(new o.Vector3)}}setTop(e){this.object3d&&(this.object3d.renderOrder=e)}traverse(e){e(this),this.children.forEach(t=>{t.traverse(e)})}instantiate(e){return ne(this,null,function*(){var l;const t=(l=e==null?void 0:e.recursive)!=null?l:!0,{objectType:r,objectOptions:n}=this,[,c]=r.split("#");let u=e==null?void 0:e.create;u===void 0&&(u=a=>{var p;if(this.object3d){if((p=e==null?void 0:e.instancedAttr)!=null&&p.length){const f=e.instancedAttr.length;if(this.object3d instanceof o.Sprite)a.object3d=Pe(this.object3d,f);else{const m=this.object3d,d=this.cloneMaterial();a.object3d=new o.InstancedMesh(m.geometry,d,f)}Be(a.object3d,e==null?void 0:e.instancedAttr)}else a.object3d=this.object3d.clone(!1),a.object3d.material&&(a.object3d.material=this.cloneMaterial());a.object3d.userData.prefab&&delete a.object3d.userData.prefab}});const s=yield this.lead.draw(c,q(_({},n||{}),{create:u,prefab:!1,key:(e==null?void 0:e.key)||(n==null?void 0:n.key),target:(e==null?void 0:e.target)||(n==null?void 0:n.target)}));return this.isBloom&&s.enableBloom(),t&&(yield Promise.all(this.children.map(a=>a.instantiate({target:s})))),s.isInstantiate=!0,s})}erase(){this.lead.erase(this)}enableBloom(){var e;(e=this.pencil.composerController)==null||e.setBloomSelection(this,!0),this.isBloom=!0}disableBloom(){var e;(e=this.pencil.composerController)==null||e.setBloomSelection(this,!1),this.isBloom=!1}dispose(){var e;if(super.dispose(),(e=this.pencil.composerController)==null||e.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){const t=new fe;t.disposeMaterial=!1,t.track(this),t.dispose()}}}const F=new o.Vector4,oe=new o.Vector3,ae=new o.Vector3,y=new o.Vector4,M=new o.Vector4,D=new o.Vector4,$=new o.Vector3,K=new o.Matrix4,S=new o.Line3,ce=new o.Vector3,N=new o.Box3,U=new o.Sphere,V=new o.Vector4;let T,E;function le(i,e,t){return V.set(0,0,-e,1).applyMatrix4(i.projectionMatrix),V.multiplyScalar(1/V.w),V.x=E/t.width,V.y=E/t.height,V.applyMatrix4(i.projectionMatrixInverse),V.multiplyScalar(1/V.w),Math.abs(Math.max(V.x,V.y))}function Ve(i,e){const t=i.matrixWorld,r=i.geometry,n=r.attributes.instanceStart,c=r.attributes.instanceEnd,u=Math.min(r.instanceCount,n.count);for(let s=0,l=u;s<l;s++){S.start.fromBufferAttribute(n,s),S.end.fromBufferAttribute(c,s),S.applyMatrix4(t);const a=new o.Vector3,p=new o.Vector3;T.distanceSqToSegment(S.start,S.end,p,a),p.distanceTo(a)<E*.5&&e.push({point:p,pointOnLine:a,distance:T.origin.distanceTo(p),object:i,face:null,faceIndex:s,uv:null,uv1:null})}}function Te(i,e,t){const r=e.projectionMatrix,c=i.material.resolution,u=i.matrixWorld,s=i.geometry,l=s.attributes.instanceStart,a=s.attributes.instanceEnd,p=Math.min(s.instanceCount,l.count),f=-e.near;T.at(1,D),D.w=1,D.applyMatrix4(e.matrixWorldInverse),D.applyMatrix4(r),D.multiplyScalar(1/D.w),D.x*=c.x/2,D.y*=c.y/2,D.z=0,$.copy(D),K.multiplyMatrices(e.matrixWorldInverse,u);for(let m=0,d=p;m<d;m++){if(y.fromBufferAttribute(l,m),M.fromBufferAttribute(a,m),y.w=1,M.w=1,y.applyMatrix4(K),M.applyMatrix4(K),y.z>f&&M.z>f)continue;if(y.z>f){const A=y.z-M.z,C=(y.z-f)/A;y.lerp(M,C)}else if(M.z>f){const A=M.z-y.z,C=(M.z-f)/A;M.lerp(y,C)}y.applyMatrix4(r),M.applyMatrix4(r),y.multiplyScalar(1/y.w),M.multiplyScalar(1/M.w),y.x*=c.x/2,y.y*=c.y/2,M.x*=c.x/2,M.y*=c.y/2,S.start.copy(y),S.start.z=0,S.end.copy(M),S.end.z=0;const h=S.closestPointToPointParameter($,!0);S.at(h,ce);const b=o.MathUtils.lerp(y.z,M.z,h),w=b>=-1&&b<=1,j=$.distanceTo(ce)<E*.5;if(w&&j){S.start.fromBufferAttribute(l,m),S.end.fromBufferAttribute(a,m),S.start.applyMatrix4(u),S.end.applyMatrix4(u);const A=new o.Vector3,C=new o.Vector3;T.distanceSqToSegment(S.start,S.end,C,A),t.push({point:C,pointOnLine:A,distance:T.origin.distanceTo(C),object:i,face:null,faceIndex:m,uv:null,uv1:null})}}}class ze extends o.Mesh{constructor(e=new ge.LineSegmentsGeometry,t){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,r=e.attributes.instanceEnd,n=new Float32Array(2*t.count);for(let u=0,s=0,l=t.count;u<l;u++,s+=2)oe.fromBufferAttribute(t,u),ae.fromBufferAttribute(r,u),n[s]=s===0?0:n[s-1],n[s+1]=n[s]+oe.distanceTo(ae);const c=new o.InstancedInterleavedBuffer(n,2,1);return e.setAttribute("instanceDistanceStart",new o.InterleavedBufferAttribute(c,1,0)),e.setAttribute("instanceDistanceEnd",new o.InterleavedBufferAttribute(c,1,1)),this}raycast(e,t){const r=this.material.worldUnits,n=e.camera;n===null&&!r&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const c=e.params.Line2!==void 0&&e.params.Line2.threshold||0;T=e.ray;const u=this.matrixWorld,s=this.geometry,l=this.material;E=l.linewidth+c,s.boundingSphere===null&&s.computeBoundingSphere(),U.copy(s.boundingSphere).applyMatrix4(u);let a;if(r)a=E*.5;else{const f=Math.max(n.near,U.distanceToPoint(T.origin));a=le(n,f,l.resolution)}if(U.radius+=a,T.intersectsSphere(U)===!1)return;s.boundingBox===null&&s.computeBoundingBox(),N.copy(s.boundingBox).applyMatrix4(u);let p;if(r)p=E*.5;else{const f=Math.max(n.near,N.distanceToPoint(T.origin));p=le(n,f,l.resolution)}N.expandByScalar(p),T.intersectsBox(N)!==!1&&(r?Ve(this,t):Te(this,n,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(F),this.material.uniforms.resolution.value.set(F.z,F.w))}}const Ee=`
5
5
  #include <fog_pars_fragment>
6
6
  #include <logdepthbuf_pars_fragment>
7
7
 
@@ -44,7 +44,7 @@ void main() {
44
44
  #include <fog_fragment>
45
45
  #include <${parseInt(o.REVISION)<154?"encodings_fragment":"colorspace_fragment"}>
46
46
  }
47
- `,Ee=`
47
+ `,Le=`
48
48
  #include <common>
49
49
  ${o.ShaderChunk.logdepthbuf_pars_vertex}
50
50
  ${o.ShaderChunk.fog_pars_vertex}
@@ -88,7 +88,7 @@ void main() {
88
88
  vec2 prevScreen = intoScreen(prevNormed);
89
89
  vec2 nextScreen = intoScreen(nextNormed);
90
90
 
91
- float actualWidth = lineWidth * width;
91
+ float actualWidth = lineWidth * width *0.5;
92
92
 
93
93
  vec2 dir;
94
94
  if(nextScreen == currentScreen) {
@@ -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={}){var A;const j=e,{lineWidth:t=1,color:i="#ffffff",map:n=null,useMap:c=0,dashOffset:u=0,dashArray:r=0,dashRatio:l=0,sizeAttenuation:a=!0,offsetLoop:p=!0,offset:d=new o.Vector2(0,0),scaleDown:m=0,alphaMap:f=void 0,alphaTest:v=0,repeat:h=new o.Vector2(1,1),resolution:y=new o.Vector2(1,1)}=j,w=ie(j,["lineWidth","color","map","useMap","dashOffset","dashArray","dashRatio","sizeAttenuation","offsetLoop","offset","scaleDown","alphaMap","alphaTest","repeat","resolution"]);super(q(_({},w),{uniforms:{lineWidth:{value:t},color:{value:new o.Color(i)},opacity:{value:(A=e.opacity)!=null?A:1},map:{value:n},useMap:{value:n?1:c},resolution:{value:y},sizeAttenuation:{value:a?1:0},offset:{value:d},offsetLoop:{value:p?1:0},dashArray:{value:r},dashOffset:{value:u},dashRatio:{value:l},useDash:{value:r>0?1:0},scaleDown:{value:m/10},alphaTest:{value:v},alphaMap:{value:f},useAlphaMap:{value:f?1:0},repeat:{value:h}},vertexShader:Ee,fragmentShader:Oe})),this.type="MeshLineMaterial"}updateUniforms(e){e.opacity!==void 0&&(this.uniforms.opacity.value=e.opacity),e.color!==void 0&&(this.uniforms.color.value=new o.Color(e.color)),e.map!==void 0&&(this.uniforms.map.value=e.map,this.uniforms.useMap.value=e.map?1:0),e.useMap!==void 0&&(this.uniforms.useMap.value=e.useMap),e.dashOffset!==void 0&&(this.uniforms.dashOffset.value=e.dashOffset),e.dashArray!==void 0&&(this.uniforms.dashArray.value=e.dashArray,this.uniforms.useDash.value=e.dashArray>0?1:0),e.dashRatio!==void 0&&(this.uniforms.dashRatio.value=e.dashRatio),e.sizeAttenuation!==void 0&&(this.uniforms.sizeAttenuation.value=e.sizeAttenuation?1:0),e.offset!==void 0&&(this.uniforms.offset.value=e.offset),e.offsetLoop!==void 0&&(this.uniforms.offsetLoop.value=e.offsetLoop?1:0),e.lineWidth!==void 0&&(this.uniforms.lineWidth.value=e.lineWidth),e.scaleDown!==void 0&&(this.uniforms.scaleDown.value=e.scaleDown/10),e.alphaMap!==void 0&&(this.uniforms.alphaMap.value=e.alphaMap,this.uniforms.useAlphaMap.value=e.alphaMap?1:0),e.resolution!==void 0&&(this.uniforms.resolution.value=e.resolution),e.repeat!==void 0&&(this.uniforms.repeat.value=e.repeat),e.alphaTest!==void 0&&(this.uniforms.alphaTest.value=e.alphaTest)}}function ze(s,e){return s.map(t=>{const i=[];let n;return t.forEach(c=>{if(n){const u=z.geoDistance(c,n)*180/Math.PI;if(u>e){const r=z.geoInterpolate(n,c),l=1/Math.ceil(u/e);let a=l;for(;a<1;)i.push(r(a)),a+=l}}i.push(n=c)}),i})}function ke(s,{minLng:e,maxLng:t,minLat:i,maxLat:n}={}){const c=Math.round(te(360/s,2)/Math.PI),u=(1+Math.sqrt(5))/2,r=f=>f/u*360%360-180,l=f=>Math.acos(2*f/c-1)/Math.PI*180-90,a=f=>c*(Math.cos((f+90)*Math.PI/180)+1)/2,p=[n!==void 0?Math.ceil(a(n)):0,i!==void 0?Math.floor(a(i)):c-1],d=e===void 0&&t===void 0?()=>!0:e===void 0?f=>f<=t:t===void 0?f=>f>=e:t>=e?f=>f>=e&&f<=t:f=>f>=e||f<=t,m=[];for(let f=p[0];f<=p[1];f++){const v=r(f);d(v)&&m.push([v,l(f)])}return m}function Z(s,e,t=!1){return t?z.geoContains(e,s):Se(s,e)}function We(s,e){const t={type:"Polygon",coordinates:s},[[i,n],[c,u]]=z.geoBounds(t);if(Math.min(Math.abs(c-i),Math.abs(u-n))<e)return[];const r=i>c||u>=89||n<=-89;return ke(e,{minLng:i,maxLng:c,minLat:n,maxLat:u}).filter(l=>Z(l,t,r))}function Ne(s,{resolution:e=1/0,bbox:t,projection:i}={}){const n=ze(s,e),c=E.merge(n),u=We(s,e),r=[...c,...u],l={type:"Polygon",coordinates:s},[[a,p],[d,m]]=z.geoBounds(l),f=a>d||m>=89||p<=-89;let v=[];if(f){const b=xe.geoVoronoi(r).triangles(),x=new Map(r.map(([D,P],L)=>[`${D}-${P}`,L]));b.features.forEach(D=>{const P=D.geometry.coordinates[0].slice(0,3).reverse(),L=[];if(P.forEach(([B,G])=>{const k=`${B}-${G}`;x.has(k)&&L.push(x.get(k))}),L.length===3){if(L.some(B=>B<c.length)){const B=D.properties.circumcenter;if(!Z(B,l,f))return}v.push(...L)}})}else if(u.length){const b=Me.from(r);for(let x=0,D=b.triangles.length;x<D;x+=3){const P=[2,1,0].map(B=>b.triangles[x+B]),L=P.map(B=>r[B]);if(P.some(B=>B<c.length)){const B=[0,1].map(G=>E.mean(L,k=>k[G]));if(!Z(B,l,f))continue}v.push(...P)}}else{const{vertices:b,holes:x=[]}=X.flatten(n);v=X(b,x,2)}let h=t?[t[0],t[2]]:E.extent(r,b=>b[0]),y=t?[t[1],t[3]]:E.extent(r,b=>b[1]);if(i){const[b,x]=i([h[0],y[0]]),[D,P]=i([h[1],y[1]]);h=[b,D],y=[-x,-P]}const w=re.scaleLinear(h,[0,1]),j=re.scaleLinear(y,[0,1]),A=r.map(([b,x])=>{if(i){const[D,P]=i([b,x]);return[w(D),j(-P)]}else return[w(b),j(x)]});return{contour:n,triangles:{points:r,indices:v,uvs:A}}}const ue=new o.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function R(s,e,t,i){const n=s.map(c=>c.map(([u,r])=>{if(i){const[l,a]=i([u,r]);return[l,-a,e]}return t?Q.polar2Cartesian(u,r,e):[u,r,e]}));return X.flatten(n)}function Ue(s,e,t,i,n){const{vertices:c,holes:u}=R(s,e,i,n),{vertices:r}=R(s,t,i,n),l=E.merge([r,c]),a=Math.round(r.length/3),p=new Set(u);let d=0;const m=[];for(let v=0;v<a;v++){let h=v+1;if(h===a)h=d;else if(p.has(h)){const y=h;h=d,d=y}m.push(v,v+a,h+a),m.push(h+a,h,v)}const f=[];for(let v=1;v>=0;v--)for(let h=0;h<a;h+=1)f.push(h/(a-1),v);return{indices:m,vertices:l,uvs:f,topVerts:r}}function fe(s,e,t,i,n,c){return{indices:i?s.indices:s.indices.slice().reverse(),vertices:R([s.points],e,n,c).vertices,uvs:t}}const he=({polygonGeoJson:s,startHeight:e,endHeight:t,curvatureResolution:i=1,cartesian:n=!0,hasSide:c=!0,hasBottom:u=!1,hasTop:r=!1,projection:l,bbox:a})=>{s.forEach(w=>{ge(w)||w.reverse()});const{contour:p,triangles:d}=Ne(s,{resolution:i,bbox:a,projection:l});let m={},f;c&&(m=Ue(p,e!=null?e:t,t!=null?t:e,n,l),f=m.topVerts);let v=[];(u||r)&&(v=E.merge(d.uvs));let h={};u&&(h=fe(d,e,v,!1,n,l));let y={};return r&&(y=fe(d,t,v,!0,n,l)),{contour:p,triangles:d,sideTorso:m,bottomCap:h,topCap:y,topVerts:f}};class Re 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:i,hasTop:n,topFirst:c,hasBottom:u,hasSide:r,cartesian:l,userDataRsoOffset:a,projection:p}=this.parameters,{contour:d,sideTorso:m,topVerts:f,bottomCap:v,topCap:h}=he(_({},this.parameters));let y=[],w=[],j=[],A=0;const C=b=>{const x=Math.round(y.length/3),D=j.length;y=y.concat(b.vertices),w=w.concat(b.uvs),j=j.concat(x?b.indices.map(P=>P+x):b.indices),this.addGroup(D,j.length-D,A++)};n&&c&&C(h),r&&(C(m),this.userData.topVerts=a?R(d,i+a,l,p).vertices:f),u&&C(v),n&&!c&&C(h),this.setIndex(j),this[ue]("position",new o.Float32BufferAttribute(y,3)),this[ue]("uv",new o.Float32BufferAttribute(w,2)),this.computeVertexNormals()}}exports.BLOOM_SCENE=je;exports.BaseObject=Y;exports.IS_DEV=Ce;exports.LineSegments2=Le;exports.MeshLineMaterial=_e;exports.PolygonGeometry=Re;exports.ResourceTracker=de;exports.getMetas=he;
139
+ `;class _e extends o.ShaderMaterial{constructor(e={}){var A;const j=e,{lineWidth:t=1,color:r="#ffffff",map:n=null,useMap:c=0,dashOffset:u=0,dashArray:s=0,dashRatio:l=0,sizeAttenuation:a=!0,offsetLoop:p=!0,offset:f=new o.Vector2(0,0),scaleDown:m=0,alphaMap:d=void 0,alphaTest:v=0,repeat:h=new o.Vector2(1,1),resolution:b=new o.Vector2(1,1)}=j,w=re(j,["lineWidth","color","map","useMap","dashOffset","dashArray","dashRatio","sizeAttenuation","offsetLoop","offset","scaleDown","alphaMap","alphaTest","repeat","resolution"]);super(q(_({},w),{uniforms:{lineWidth:{value:t},color:{value:new o.Color(r)},opacity:{value:(A=e.opacity)!=null?A:1},map:{value:n},useMap:{value:n?1:c},resolution:{value:b},sizeAttenuation:{value:a?1:0},offset:{value:f},offsetLoop:{value:p?1:0},dashArray:{value:s},dashOffset:{value:u},dashRatio:{value:l},useDash:{value:s>0?1:0},scaleDown:{value:m/10},alphaTest:{value:v},alphaMap:{value:d},useAlphaMap:{value:d?1:0},repeat:{value:h}},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 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(i,e){return i.map(t=>{const r=[];let n;return t.forEach(c=>{if(n){const u=O.geoDistance(c,n)*180/Math.PI;if(u>e){const s=O.geoInterpolate(n,c),l=1/Math.ceil(u/e);let a=l;for(;a<1;)r.push(s(a)),a+=l}}r.push(n=c)}),r})}function ke(i,{minLng:e,maxLng:t,minLat:r,maxLat:n}={}){const c=Math.round(te(360/i,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=[n!==void 0?Math.ceil(a(n)):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(i,e,t=!1){return t?O.geoContains(e,i):Se(i,e)}function We(i,e){const t={type:"Polygon",coordinates:i},[[r,n],[c,u]]=O.geoBounds(t);if(Math.min(Math.abs(c-r),Math.abs(u-n))<e)return[];const s=r>c||u>=89||n<=-89;return ke(e,{minLng:r,maxLng:c,minLat:n,maxLat:u}).filter(l=>Z(l,t,s))}function Ne(i,{resolution:e=1/0,bbox:t,projection:r}={}){const n=Oe(i,e),c=L.merge(n),u=We(i,e),s=[...c,...u],l={type:"Polygon",coordinates:i},[[a,p],[f,m]]=O.geoBounds(l),d=a>f||m>=89||p<=-89;let v=[];if(d){const g=xe.geoVoronoi(s).triangles(),x=new Map(s.map(([P,B],z)=>[`${P}-${B}`,z]));g.features.forEach(P=>{const B=P.geometry.coordinates[0].slice(0,3).reverse(),z=[];if(B.forEach(([I,R])=>{const k=`${I}-${R}`;x.has(k)&&z.push(x.get(k))}),z.length===3){if(z.some(I=>I<c.length)){const I=P.properties.circumcenter;if(!Z(I,l,d))return}v.push(...z)}})}else if(u.length){const g=Me.from(s);for(let x=0,P=g.triangles.length;x<P;x+=3){const B=[2,1,0].map(I=>g.triangles[x+I]),z=B.map(I=>s[I]);if(B.some(I=>I<c.length)){const I=[0,1].map(R=>L.mean(z,k=>k[R]));if(!Z(I,l,d))continue}v.push(...B)}}else{const{vertices:g,holes:x=[]}=X.flatten(n);v=X(g,x,2)}let h=t?[t[0],t[2]]:L.extent(s,g=>g[0]),b=t?[t[1],t[3]]:L.extent(s,g=>g[1]);if(r){const[g,x]=r([h[0],b[0]]),[P,B]=r([h[1],b[1]]);h=[g,P],b=[-x,-B]}const w=se.scaleLinear(h,[0,1]),j=se.scaleLinear(b,[0,1]),A=s.map(([g,x])=>{if(r){const[P,B]=r([g,x]);return[w(P),j(-B)]}else return[w(g),j(x)]});return{contour:n,triangles:{points:s,indices:v,uvs:A}}}const ue=new o.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function G(i,e,t,r){const n=i.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(n)}function Ue(i,e,t,r,n){const{vertices:c,holes:u}=G(i,e,r,n),{vertices:s}=G(i,t,r,n),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(i,e,t,r,n,c){return{indices:r?i.indices:i.indices.slice().reverse(),vertices:G([i.points],e,n,c).vertices,uvs:t}}const he=({polygonGeoJson:i,startHeight:e,endHeight:t,curvatureResolution:r=1,cartesian:n=!0,hasSide:c=!0,hasBottom:u=!1,hasTop:s=!1,projection:l,bbox:a})=>{i.forEach(w=>{ye(w)||w.reverse()});const{contour:p,triangles:f}=Ne(i,{resolution:r,bbox:a,projection:l});let m={},d;c&&(m=Ue(p,e!=null?e:t,t!=null?t:e,n,l),d=m.topVerts);let v=[];(u||s)&&(v=L.merge(f.uvs));let h={};u&&(h=de(f,e,v,!1,n,l));let b={};return s&&(b=de(f,t,v,!0,n,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:n,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=[],j=[],A=0;const C=g=>{const x=Math.round(b.length/3),P=j.length;b=b.concat(g.vertices),w=w.concat(g.uvs),j=j.concat(x?g.indices.map(B=>B+x):g.indices),this.addGroup(P,j.length-P,A++)};n&&c&&C(h),s&&(C(m),this.userData.topVerts=a?G(f,r+a,l,p).vertices:d),u&&C(v),n&&!c&&C(h),this.setIndex(j),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;
@@ -1,4 +1,4 @@
1
- import { type ColorRepresentation, ShaderMaterial, type ShaderMaterialParameters, Texture, Vector2 } from 'three';
1
+ import { Color, type ColorRepresentation, ShaderMaterial, type ShaderMaterialParameters, Texture, Vector2 } from 'three';
2
2
  export interface MeshLineMaterialParameters extends ShaderMaterialParameters {
3
3
  /**
4
4
  * Line width
@@ -64,5 +64,12 @@ export interface MeshLineMaterialParameters extends ShaderMaterialParameters {
64
64
  export declare class MeshLineMaterial extends ShaderMaterial {
65
65
  type: string;
66
66
  constructor(parameters?: MeshLineMaterialParameters);
67
- updateUniforms(parameters: Partial<MeshLineMaterialParameters>): void;
67
+ get color(): Color;
68
+ set color(value: ColorRepresentation);
69
+ get map(): Texture | null;
70
+ set map(value: Texture | null);
71
+ get lineWidth(): number;
72
+ set lineWidth(value: number);
73
+ get sizeAttenuation(): boolean;
74
+ set sizeAttenuation(value: boolean);
68
75
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gl-draw",
3
- "version": "0.15.0-beta.30",
3
+ "version": "0.15.0-beta.32",
4
4
  "author": "gitplus <hstits@gmail.com>",
5
5
  "scripts": {
6
6
  "start": "bundler-dev",