gl-draw 0.15.0-beta.2 → 0.15.0-beta.20

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,92 +1,53 @@
1
1
  var jt = Object.defineProperty, At = Object.defineProperties;
2
2
  var St = Object.getOwnPropertyDescriptors;
3
- var tt = Object.getOwnPropertySymbols;
3
+ var J = Object.getOwnPropertySymbols;
4
4
  var Ct = Object.prototype.hasOwnProperty, zt = Object.prototype.propertyIsEnumerable;
5
- var it = Math.pow, et = (a, t, e) => t in a ? jt(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e, _ = (a, t) => {
5
+ var et = Math.pow, tt = (a, t, e) => t in a ? jt(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e, W = (a, t) => {
6
6
  for (var e in t || (t = {}))
7
- Ct.call(t, e) && et(a, e, t[e]);
8
- if (tt)
9
- for (var e of tt(t))
10
- zt.call(t, e) && et(a, e, t[e]);
7
+ Ct.call(t, e) && tt(a, e, t[e]);
8
+ if (J)
9
+ for (var e of J(t))
10
+ zt.call(t, e) && tt(a, e, t[e]);
11
11
  return a;
12
- }, q = (a, t) => At(a, St(t));
13
- var st = (a, t, e) => new Promise((i, s) => {
14
- var r = (l) => {
12
+ }, N = (a, t) => At(a, St(t));
13
+ var it = (a, t, e) => new Promise((i, s) => {
14
+ var r = (o) => {
15
15
  try {
16
- n(e.next(l));
16
+ n(e.next(o));
17
17
  } catch (c) {
18
18
  s(c);
19
19
  }
20
- }, o = (l) => {
20
+ }, l = (o) => {
21
21
  try {
22
- n(e.throw(l));
22
+ n(e.throw(o));
23
23
  } catch (c) {
24
24
  s(c);
25
25
  }
26
- }, n = (l) => l.done ? i(l.value) : Promise.resolve(l.value).then(r, o);
26
+ }, n = (o) => o.done ? i(o.value) : Promise.resolve(o.value).then(r, l);
27
27
  n((e = e.apply(a, t)).next());
28
28
  });
29
- import { Material as nt, Object3D as G, Texture as rt, VideoTexture as Dt, BufferGeometry as H, Float32BufferAttribute as F, PointsMaterial as It, Points as X, Mesh as xt, Group as Bt, Sprite as at, Box3 as Mt, Vector3 as C, InstancedMesh as ot, Quaternion as Tt, Vector4 as V, Matrix4 as Lt, Line3 as Wt, Sphere as _t, InstancedInterleavedBuffer as Ot, InterleavedBufferAttribute as lt, MathUtils as Vt, ShaderMaterial as kt, UniformsLib as Et, Color as ct, Vector2 as E, REVISION as Ut } from "three";
29
+ import { BufferGeometry as Y, Float32BufferAttribute as G, PointsMaterial as It, Points as K, Mesh as xt, Group as Dt, Sprite as st, Box3 as Mt, Vector3 as C, InstancedMesh as nt, Quaternion as Tt, Object3D as R, Material as rt, Texture as at, VideoTexture as _t, Vector4 as O, Matrix4 as Bt, Line3 as Lt, Sphere as Wt, InstancedInterleavedBuffer as Ot, InterleavedBufferAttribute as ot, MathUtils as Vt, ShaderMaterial as kt, UniformsLib as Ut, Color as lt, Vector2 as k, REVISION as Et } from "three";
30
30
  import { CSS2DObject as Rt } from "three/examples/jsm/renderers/CSS2DRenderer";
31
31
  import { CSS3DObject as Gt, CSS3DSprite as Ft } from "three/examples/jsm/renderers/CSS3DRenderer";
32
- import { geoBounds as wt, geoContains as Zt, geoDistance as $t, geoInterpolate as qt } from "d3-geo";
32
+ import { geoBounds as wt, geoContains as Zt, geoDistance as Nt, geoInterpolate as $t } from "d3-geo";
33
33
  import "d3-geo-projection";
34
- import { p as ut, a as Nt } from "./parseVector.module.js";
34
+ import { p as ct, a as qt } from "./parseVector.module.js";
35
35
  import { LineSegmentsGeometry as Qt } from "three/examples/jsm/lines/LineSegmentsGeometry";
36
- import { merge as J, mean as Kt, extent as ht } from "d3-array";
36
+ import { merge as H, mean as Kt, extent as ut } from "d3-array";
37
37
  import Xt, { flatten as Pt } from "earcut";
38
38
  import Yt from "@turf/boolean-clockwise";
39
39
  import Ht from "delaunator";
40
40
  import Jt from "@turf/boolean-point-in-polygon";
41
41
  import { geoVoronoi as te } from "d3-geo-voronoi";
42
- import { scaleLinear as ft } from "d3-scale";
43
- class O {
44
- constructor() {
45
- this.resources = /* @__PURE__ */ new Set(), this.disposeWithMaterial = !0, this.disposeVideo = !0, this.materialList = {}, this.disposeTrack = !0;
46
- }
47
- track(t) {
48
- if (!t || this.disposeTrack === !1)
49
- return t;
50
- if (Array.isArray(t))
51
- return t.forEach((e) => this.track(e)), t;
52
- if (!this.disposeWithMaterial && t instanceof nt)
53
- return t;
54
- if (t instanceof O ? (t === this && t.object3d ? this.track(t.object3d) : (t.disposeTrack = !1, this.resources.add(t)), Object.values(t.materialList).map((e) => this.track(e))) : (t instanceof G || Reflect.has(t, "dispose")) && this.resources.add(t), t instanceof O)
55
- this.track(t.children);
56
- else if (t instanceof G) {
57
- const e = t;
58
- this.track(e.geometry), this.track(e.material), this.track(e.children);
59
- } else if (t instanceof nt) {
60
- for (const i of Object.values(t))
61
- i instanceof rt && this.track(i);
62
- const e = t;
63
- if (e.uniforms) {
64
- for (const i of Object.values(e.uniforms))
65
- if (i) {
66
- const s = i.value;
67
- (s instanceof rt || Array.isArray(s)) && this.track(s);
68
- }
69
- }
70
- } else this.disposeVideo && t instanceof Dt && t.source.data && this.resources.add(t.source.data);
71
- return t;
72
- }
73
- dispose() {
74
- const t = [];
75
- for (const e of this.resources)
76
- e instanceof G ? t.push(e) : e instanceof HTMLVideoElement && e.pause(), Reflect.has(e, "dispose") && e.dispose();
77
- t.forEach((e) => {
78
- e.removeFromParent();
79
- }), t.length = 0, this.resources.clear();
80
- }
81
- }
42
+ import { scaleLinear as ht } from "d3-scale";
82
43
  const ee = (a, t = 1) => {
83
- const e = new H();
44
+ const e = new Y();
84
45
  e.setAttribute(
85
46
  "position",
86
- new F(new Array(t * 3).fill(0), 3)
47
+ new G(new Array(t * 3).fill(0), 3)
87
48
  ), e.setAttribute(
88
49
  "scaleAtt",
89
- new F(new Array(t).fill(1), 1)
50
+ new G(new Array(t).fill(1), 1)
90
51
  );
91
52
  const i = a.material, s = new It({
92
53
  size: 10,
@@ -109,11 +70,11 @@ const ee = (a, t = 1) => {
109
70
  "gl_PointSize = size * scaleAtt;"
110
71
  )}
111
72
  `;
112
- }, new X(e, s);
73
+ }, new K(e, s);
113
74
  };
114
- class ie extends O {
75
+ class ft {
115
76
  constructor() {
116
- super(...arguments), this.objectType = "BaseObject", this.userData = {}, this.disposeWithMaterial = !1, this.prefab = !1, this.isInstantiate = !1, this.isBloom = !1, this.materialList = {}, this.useMaterialType = "origin", this.onPointerIndex = [];
77
+ this.objectType = "BaseObject", this.userData = {}, this.prefab = !1, this.isInstantiate = !1, this.isBloom = !1, this.materialList = {}, this.useMaterialType = "origin", this.onPointerIndex = [], this.disposeTrack = !0, this.disposeMaterialIfNotUsed = !0;
117
78
  }
118
79
  get parent() {
119
80
  const t = this.object3d.parent;
@@ -171,10 +132,10 @@ class ie extends O {
171
132
  return this.object3d = new xt(...t), this;
172
133
  }
173
134
  createGroup() {
174
- return this.object3d = new Bt(), this;
135
+ return this.object3d = new Dt(), this;
175
136
  }
176
137
  createPoints(...t) {
177
- return this.object3d = new X(...t), this;
138
+ return this.object3d = new K(...t), this;
178
139
  }
179
140
  createCSS2DObject(t) {
180
141
  return this.object3d = new Rt(t), this;
@@ -186,7 +147,7 @@ class ie extends O {
186
147
  return this.object3d = new Ft(t), this;
187
148
  }
188
149
  createSprite(t) {
189
- return this.object3d = new at(t), this;
150
+ return this.object3d = new st(t), this;
190
151
  }
191
152
  attach(...t) {
192
153
  return [...t].forEach((e) => {
@@ -211,39 +172,35 @@ class ie extends O {
211
172
  return this.instantiate();
212
173
  }
213
174
  instantiate(t, e) {
214
- return st(this, null, function* () {
215
- var d;
216
- const i = t && t.length > 0, s = (d = e == null ? void 0 : e.recursive) != null ? d : !0, { objectType: r, objectOptions: o } = this, [, n] = r.split("#");
217
- let l = e == null ? void 0 : e.create;
218
- l === void 0 && (l = (u) => {
175
+ return it(this, null, function* () {
176
+ var p;
177
+ const i = t && t.length > 0, s = (p = e == null ? void 0 : e.recursive) != null ? p : !0, { objectType: r, objectOptions: l } = this, [, n] = r.split("#");
178
+ let o = e == null ? void 0 : e.create;
179
+ o === void 0 && (o = (u) => {
219
180
  if (this.object3d) {
220
181
  if (i) {
221
182
  const m = t.length;
222
- if (this.object3d instanceof at)
183
+ if (this.object3d instanceof st)
223
184
  u.object3d = ee(this.object3d, m);
224
185
  else {
225
- const f = this.object3d;
226
- u.object3d = new ot(
227
- f.geometry,
228
- f.material,
229
- m
230
- ), u.setMaterialList("instantiate", "clone"), u.useMaterial("instantiate");
186
+ const f = this.object3d, d = this.cloneMaterial();
187
+ u.object3d = new nt(f.geometry, d, m);
231
188
  }
232
- const h = new G();
233
- t.forEach((f, p) => {
234
- const g = ut(f.position), w = ut(f.scale || [1, 1, 1]);
235
- h.position.copy(g), h.scale.copy(w), h.updateMatrix(), u.setInstancedMatrix(p, h.matrix.clone());
189
+ const h = new R();
190
+ t.forEach((f, d) => {
191
+ const g = ct(f.position), w = ct(f.scale || [1, 1, 1]);
192
+ h.position.copy(g), h.scale.copy(w), h.updateMatrix(), u.setInstancedMatrix(d, h.matrix.clone());
236
193
  });
237
194
  } else
238
- u.object3d = this.object3d.clone(!1), u.setMaterialList("instantiate", "clone"), u.useMaterial("instantiate");
195
+ u.object3d = this.object3d.clone(!1), u.object3d.material && (u.object3d.material = this.cloneMaterial());
239
196
  u.object3d.userData.prefab && delete u.object3d.userData.prefab;
240
197
  }
241
198
  });
242
- const c = yield this.lead.draw(n, q(_({}, o || {}), {
243
- create: l,
199
+ const c = yield this.lead.draw(n, N(W({}, l || {}), {
200
+ create: o,
244
201
  prefab: !1,
245
- key: (e == null ? void 0 : e.key) || (o == null ? void 0 : o.key),
246
- target: (e == null ? void 0 : e.target) || (o == null ? void 0 : o.target)
202
+ key: (e == null ? void 0 : e.key) || (l == null ? void 0 : l.key),
203
+ target: (e == null ? void 0 : e.target) || (l == null ? void 0 : l.target)
247
204
  }));
248
205
  return this.isBloom && c.enableBloom(), s && (yield Promise.all(
249
206
  this.children.map(
@@ -255,11 +212,11 @@ class ie extends O {
255
212
  });
256
213
  }
257
214
  setInstancedMatrix(t, e) {
258
- if (this.object3d instanceof ot || this.object3d.isInstantiate)
215
+ if (this.object3d instanceof nt || this.object3d.isInstantiate)
259
216
  this.object3d.setMatrixAt(t, e);
260
- else if (this.object3d instanceof X || this.object3d.type === "Points") {
261
- const s = this.object3d.geometry, r = s.attributes.position.array, o = s.attributes.scaleAtt.array, n = new C(), l = new C(), c = new Tt(), d = t * 3, u = t * 1;
262
- e.decompose(n, c, l), r[d] = n.x, r[d + 1] = n.y, r[d + 2] = n.z, o[u] = Math.max(l.x, l.y, l.z), s.attributes.position.needsUpdate = !0, s.attributes.scaleAtt.needsUpdate = !0;
217
+ else if (this.object3d instanceof K || this.object3d.type === "Points") {
218
+ const s = this.object3d.geometry, r = s.attributes.position.array, l = s.attributes.scaleAtt.array, n = new C(), o = new C(), c = new Tt(), p = t * 3, u = t * 1;
219
+ e.decompose(n, c, o), r[p] = n.x, r[p + 1] = n.y, r[p + 2] = n.z, l[u] = Math.max(o.x, o.y, o.z), s.attributes.position.needsUpdate = !0, s.attributes.scaleAtt.needsUpdate = !0;
263
220
  }
264
221
  }
265
222
  erase() {
@@ -288,12 +245,8 @@ class ie extends O {
288
245
  const s = this.object3d;
289
246
  if (!s || !s.material)
290
247
  return;
291
- if (this.materialList.origin || (this.materialList.origin = s.material), this.materialList[t])
292
- if (i) {
293
- const o = this.materialList[t], n = new O();
294
- n.track(o), n.dispose();
295
- } else
296
- return this.materialList[t];
248
+ if (this.materialList.origin || (this.materialList.origin = s.material), this.materialList[t] && !i)
249
+ return this.materialList[t];
297
250
  const r = e === "clone" ? this.cloneMaterial() : e;
298
251
  return this.materialList[t] = r, r;
299
252
  }
@@ -318,30 +271,73 @@ class ie extends O {
318
271
  }
319
272
  dispose() {
320
273
  var t;
321
- this.onPointerIndex.forEach((e) => {
274
+ if (this.onPointerIndex.forEach((e) => {
322
275
  this.lead.removePick(e);
323
- }), this.mList.rmBaseObjectMap(this), (t = this.pencil.composerController) == null || t.bloomSelection.delete(this), this.lead && (this.lead.objects.delete(this.key), this.object3d && this.lead.objMap.delete(this.object3d)), this.track(this), super.dispose();
276
+ }), this.pencil.options.mList && this.mList.rmBaseObjectMap(
277
+ this,
278
+ void 0,
279
+ this.disposeMaterialIfNotUsed
280
+ ), (t = this.pencil.composerController) == null || t.bloomSelection.delete(this), this.lead && (this.lead.objects.delete(this.key), this.object3d && this.lead.objMap.delete(this.object3d)), this.disposeTrack) {
281
+ const e = new ie();
282
+ e.disposeMaterial = !this.pencil.options.mList, e.track(this), e.dispose();
283
+ }
324
284
  }
325
285
  }
326
- class ze extends ie {
327
- create() {
328
- this.createGroup();
286
+ class ie {
287
+ constructor() {
288
+ this.resources = /* @__PURE__ */ new Set(), this.disposeMaterial = !0, this.disposeVideo = !0;
289
+ }
290
+ track(t) {
291
+ if (!t)
292
+ return t;
293
+ if (Array.isArray(t))
294
+ return t.forEach((e) => this.track(e)), t;
295
+ if (!this.disposeMaterial && t instanceof rt)
296
+ return t;
297
+ if (t instanceof ft ? (t.disposeTrack && t.object3d ? this.track(t.object3d) : this.resources.add(t), Object.values(t.materialList).map((e) => this.track(e))) : (t instanceof R || Reflect.has(t, "dispose")) && this.resources.add(t), t instanceof ft)
298
+ t.children.forEach((e) => {
299
+ e.disposeTrack = !1;
300
+ }), this.track(t.children);
301
+ else if (t instanceof R) {
302
+ const e = t;
303
+ this.track(e.geometry), this.track(e.material), this.track(e.children);
304
+ } else if (t instanceof rt) {
305
+ for (const i of Object.values(t))
306
+ i instanceof at && this.track(i);
307
+ const e = t;
308
+ if (e.uniforms) {
309
+ for (const i of Object.values(e.uniforms))
310
+ if (i) {
311
+ const s = i.value;
312
+ (s instanceof at || Array.isArray(s)) && this.track(s);
313
+ }
314
+ }
315
+ } else this.disposeVideo && t instanceof _t && t.source.data && this.resources.add(t.source.data);
316
+ return t;
317
+ }
318
+ dispose() {
319
+ const t = [];
320
+ for (const e of this.resources)
321
+ e instanceof R ? t.push(e) : e instanceof HTMLVideoElement && e.pause(), Reflect.has(e, "dispose") && e.dispose();
322
+ t.forEach((e) => {
323
+ e.removeFromParent();
324
+ }), t.length = 0, this.resources.clear();
329
325
  }
330
326
  }
331
- const N = new V(), dt = new C(), pt = new C(), b = new V(), y = new V(), I = new V(), Q = new C(), K = new Lt(), x = new Wt(), mt = new C(), U = new Mt(), R = new _t(), B = new V();
332
- let T, W;
327
+ const $ = new O(), dt = new C(), pt = new C(), b = new O(), y = new O(), D = new O(), q = new C(), Q = new Bt(), x = new Lt(), mt = new C(), U = new Mt(), E = new Wt(), T = new O();
328
+ let _, L;
333
329
  function vt(a, t, e) {
334
- return B.set(0, 0, -t, 1).applyMatrix4(a.projectionMatrix), B.multiplyScalar(1 / B.w), B.x = W / e.width, B.y = W / e.height, B.applyMatrix4(a.projectionMatrixInverse), B.multiplyScalar(1 / B.w), Math.abs(Math.max(B.x, B.y));
330
+ return T.set(0, 0, -t, 1).applyMatrix4(a.projectionMatrix), T.multiplyScalar(1 / T.w), T.x = L / e.width, T.y = L / e.height, T.applyMatrix4(a.projectionMatrixInverse), T.multiplyScalar(1 / T.w), Math.abs(Math.max(T.x, T.y));
335
331
  }
336
332
  function se(a, t) {
337
- const e = a.matrixWorld, i = a.geometry, s = i.attributes.instanceStart, r = i.attributes.instanceEnd, o = Math.min(i.instanceCount, s.count);
338
- for (let n = 0, l = o; n < l; n++) {
333
+ const e = a.matrixWorld, i = a.geometry, s = i.attributes.instanceStart, r = i.attributes.instanceEnd, l = Math.min(i.instanceCount, s.count);
334
+ for (let n = 0, o = l; n < o; n++) {
339
335
  x.start.fromBufferAttribute(s, n), x.end.fromBufferAttribute(r, n), x.applyMatrix4(e);
340
- const c = new C(), d = new C();
341
- T.distanceSqToSegment(x.start, x.end, d, c), d.distanceTo(c) < W * 0.5 && t.push({
342
- point: d,
336
+ const c = new C(), p = new C();
337
+ _.distanceSqToSegment(x.start, x.end, p, c), p.distanceTo(c) < L * 0.5 && t.push({
338
+ point: p,
343
339
  pointOnLine: c,
344
- distance: T.origin.distanceTo(d),
340
+ distance: _.origin.distanceTo(p),
345
341
  object: a,
346
342
  face: null,
347
343
  faceIndex: n,
@@ -351,29 +347,29 @@ function se(a, t) {
351
347
  }
352
348
  }
353
349
  function ne(a, t, e) {
354
- const i = t.projectionMatrix, r = a.material.resolution, o = a.matrixWorld, n = a.geometry, l = n.attributes.instanceStart, c = n.attributes.instanceEnd, d = Math.min(n.instanceCount, l.count), u = -t.near;
355
- T.at(1, I), I.w = 1, I.applyMatrix4(t.matrixWorldInverse), I.applyMatrix4(i), I.multiplyScalar(1 / I.w), I.x *= r.x / 2, I.y *= r.y / 2, I.z = 0, Q.copy(I), K.multiplyMatrices(t.matrixWorldInverse, o);
356
- for (let m = 0, h = d; m < h; m++) {
357
- if (b.fromBufferAttribute(l, m), y.fromBufferAttribute(c, m), b.w = 1, y.w = 1, b.applyMatrix4(K), y.applyMatrix4(K), b.z > u && y.z > u)
350
+ const i = t.projectionMatrix, r = a.material.resolution, l = a.matrixWorld, n = a.geometry, o = n.attributes.instanceStart, c = n.attributes.instanceEnd, p = Math.min(n.instanceCount, o.count), u = -t.near;
351
+ _.at(1, D), D.w = 1, D.applyMatrix4(t.matrixWorldInverse), D.applyMatrix4(i), D.multiplyScalar(1 / D.w), D.x *= r.x / 2, D.y *= r.y / 2, D.z = 0, q.copy(D), Q.multiplyMatrices(t.matrixWorldInverse, l);
352
+ for (let m = 0, h = p; m < h; m++) {
353
+ if (b.fromBufferAttribute(o, m), y.fromBufferAttribute(c, m), b.w = 1, y.w = 1, b.applyMatrix4(Q), y.applyMatrix4(Q), b.z > u && y.z > u)
358
354
  continue;
359
355
  if (b.z > u) {
360
- const D = b.z - y.z, P = (b.z - u) / D;
356
+ const I = b.z - y.z, P = (b.z - u) / I;
361
357
  b.lerp(y, P);
362
358
  } else if (y.z > u) {
363
- const D = y.z - b.z, P = (y.z - u) / D;
359
+ const I = y.z - b.z, P = (y.z - u) / I;
364
360
  y.lerp(b, P);
365
361
  }
366
362
  b.applyMatrix4(i), y.applyMatrix4(i), b.multiplyScalar(1 / b.w), y.multiplyScalar(1 / y.w), b.x *= r.x / 2, b.y *= r.y / 2, y.x *= r.x / 2, y.y *= r.y / 2, x.start.copy(b), x.start.z = 0, x.end.copy(y), x.end.z = 0;
367
- const p = x.closestPointToPointParameter(Q, !0);
368
- x.at(p, mt);
369
- const g = Vt.lerp(b.z, y.z, p), w = g >= -1 && g <= 1, z = Q.distanceTo(mt) < W * 0.5;
363
+ const d = x.closestPointToPointParameter(q, !0);
364
+ x.at(d, mt);
365
+ const g = Vt.lerp(b.z, y.z, d), w = g >= -1 && g <= 1, z = q.distanceTo(mt) < L * 0.5;
370
366
  if (w && z) {
371
- x.start.fromBufferAttribute(l, m), x.end.fromBufferAttribute(c, m), x.start.applyMatrix4(o), x.end.applyMatrix4(o);
372
- const D = new C(), P = new C();
373
- T.distanceSqToSegment(x.start, x.end, P, D), e.push({
367
+ x.start.fromBufferAttribute(o, m), x.end.fromBufferAttribute(c, m), x.start.applyMatrix4(l), x.end.applyMatrix4(l);
368
+ const I = new C(), P = new C();
369
+ _.distanceSqToSegment(x.start, x.end, P, I), e.push({
374
370
  point: P,
375
- pointOnLine: D,
376
- distance: T.origin.distanceTo(P),
371
+ pointOnLine: I,
372
+ distance: _.origin.distanceTo(P),
377
373
  object: a,
378
374
  face: null,
379
375
  faceIndex: m,
@@ -383,15 +379,15 @@ function ne(a, t, e) {
383
379
  }
384
380
  }
385
381
  }
386
- class De extends xt {
382
+ class ze extends xt {
387
383
  constructor(t = new Qt(), e) {
388
384
  super(t, e), this.isLineSegments2 = !0, this.type = "LineSegments2";
389
385
  }
390
386
  // for backwards-compatibility, but could be a method of LineSegmentsGeometry...
391
387
  computeLineDistances() {
392
388
  const t = this.geometry, e = t.attributes.instanceStart, i = t.attributes.instanceEnd, s = new Float32Array(2 * e.count);
393
- for (let o = 0, n = 0, l = e.count; o < l; o++, n += 2)
394
- dt.fromBufferAttribute(e, o), pt.fromBufferAttribute(i, o), s[n] = n === 0 ? 0 : s[n - 1], s[n + 1] = s[n] + dt.distanceTo(pt);
389
+ for (let l = 0, n = 0, o = e.count; l < o; l++, n += 2)
390
+ dt.fromBufferAttribute(e, l), pt.fromBufferAttribute(i, l), s[n] = n === 0 ? 0 : s[n - 1], s[n + 1] = s[n] + dt.distanceTo(pt);
395
391
  const r = new Ot(
396
392
  s,
397
393
  2,
@@ -399,10 +395,10 @@ class De extends xt {
399
395
  );
400
396
  return t.setAttribute(
401
397
  "instanceDistanceStart",
402
- new lt(r, 1, 0)
398
+ new ot(r, 1, 0)
403
399
  ), t.setAttribute(
404
400
  "instanceDistanceEnd",
405
- new lt(r, 1, 1)
401
+ new ot(r, 1, 1)
406
402
  ), this;
407
403
  }
408
404
  raycast(t, e) {
@@ -411,45 +407,45 @@ class De extends xt {
411
407
  'LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'
412
408
  );
413
409
  const r = t.params.Line2 !== void 0 && t.params.Line2.threshold || 0;
414
- T = t.ray;
415
- const o = this.matrixWorld, n = this.geometry, l = this.material;
416
- W = l.linewidth + r, n.boundingSphere === null && n.computeBoundingSphere(), R.copy(n.boundingSphere).applyMatrix4(o);
410
+ _ = t.ray;
411
+ const l = this.matrixWorld, n = this.geometry, o = this.material;
412
+ L = o.linewidth + r, n.boundingSphere === null && n.computeBoundingSphere(), E.copy(n.boundingSphere).applyMatrix4(l);
417
413
  let c;
418
414
  if (i)
419
- c = W * 0.5;
415
+ c = L * 0.5;
420
416
  else {
421
417
  const u = Math.max(
422
418
  s.near,
423
- R.distanceToPoint(T.origin)
419
+ E.distanceToPoint(_.origin)
424
420
  );
425
421
  c = vt(
426
422
  s,
427
423
  u,
428
- l.resolution
424
+ o.resolution
429
425
  );
430
426
  }
431
- if (R.radius += c, T.intersectsSphere(R) === !1)
427
+ if (E.radius += c, _.intersectsSphere(E) === !1)
432
428
  return;
433
- n.boundingBox === null && n.computeBoundingBox(), U.copy(n.boundingBox).applyMatrix4(o);
434
- let d;
429
+ n.boundingBox === null && n.computeBoundingBox(), U.copy(n.boundingBox).applyMatrix4(l);
430
+ let p;
435
431
  if (i)
436
- d = W * 0.5;
432
+ p = L * 0.5;
437
433
  else {
438
434
  const u = Math.max(
439
435
  s.near,
440
- U.distanceToPoint(T.origin)
436
+ U.distanceToPoint(_.origin)
441
437
  );
442
- d = vt(
438
+ p = vt(
443
439
  s,
444
440
  u,
445
- l.resolution
441
+ o.resolution
446
442
  );
447
443
  }
448
- U.expandByScalar(d), T.intersectsBox(U) !== !1 && (i ? se(this, e) : ne(this, s, e));
444
+ U.expandByScalar(p), _.intersectsBox(U) !== !1 && (i ? se(this, e) : ne(this, s, e));
449
445
  }
450
446
  onBeforeRender(t) {
451
447
  const e = this.material.uniforms;
452
- e && e.resolution && (t.getViewport(N), this.material.uniforms.resolution.value.set(N.z, N.w));
448
+ e && e.resolution && (t.getViewport($), this.material.uniforms.resolution.value.set($.z, $.w));
453
449
  }
454
450
  }
455
451
  const gt = ["encodings_fragment", "colorspace_fragment"], re = (
@@ -600,22 +596,22 @@ const gt = ["encodings_fragment", "colorspace_fragment"], re = (
600
596
 
601
597
  #include <fog_fragment>
602
598
  #include <tonemapping_fragment>
603
- #include <${+Ut < 154 ? gt[0] : gt[1]}>
599
+ #include <${+Et < 154 ? gt[0] : gt[1]}>
604
600
  }
605
601
  `
606
602
  );
607
603
  class Ie extends kt {
608
604
  constructor(t) {
609
605
  super({
610
- uniforms: q(_({}, Et.fog), {
606
+ uniforms: N(W({}, Ut.fog), {
611
607
  lineWidth: { value: 1 },
612
608
  map: { value: null },
613
609
  useMap: { value: 0 },
614
610
  alphaMap: { value: null },
615
611
  useAlphaMap: { value: 0 },
616
- color: { value: new ct(16777215) },
612
+ color: { value: new lt(16777215) },
617
613
  opacity: { value: 1 },
618
- resolution: { value: new E(1, 1) },
614
+ resolution: { value: new k(1, 1) },
619
615
  sizeAttenuation: { value: 1 },
620
616
  dashArray: { value: 0 },
621
617
  dashOffset: { value: 0 },
@@ -624,16 +620,16 @@ class Ie extends kt {
624
620
  useDepth: { value: 0 },
625
621
  visibility: { value: 1 },
626
622
  alphaTest: { value: 0 },
627
- repeat: { value: new E(1, 1) },
628
- offset: { value: new E(0, 0) },
623
+ repeat: { value: new k(1, 1) },
624
+ offset: { value: new k(0, 0) },
629
625
  offsetLoop: { value: 1 },
630
626
  lineLightAnimation: { value: 0 },
631
627
  time: { value: 0 },
632
628
  size: { value: 300 },
633
629
  speed: { value: 0.3 },
634
630
  lightWidth: { value: 0.1 },
635
- uCenter: { value: new E(0, 0) },
636
- lightColor: { value: new ct(16777215) }
631
+ uCenter: { value: new k(0, 0) },
632
+ lightColor: { value: new lt(16777215) }
637
633
  }),
638
634
  vertexShader: re,
639
635
  fragmentShader: ae
@@ -866,12 +862,12 @@ function oe(a, t) {
866
862
  let s;
867
863
  return e.forEach((r) => {
868
864
  if (s) {
869
- const o = $t(r, s) * 180 / Math.PI;
870
- if (o > t) {
871
- const n = qt(s, r), l = 1 / Math.ceil(o / t);
872
- let c = l;
865
+ const l = Nt(r, s) * 180 / Math.PI;
866
+ if (l > t) {
867
+ const n = $t(s, r), o = 1 / Math.ceil(l / t);
868
+ let c = o;
873
869
  for (; c < 1; )
874
- i.push(n(c)), c += l;
870
+ i.push(n(c)), c += o;
875
871
  }
876
872
  }
877
873
  i.push(s = r);
@@ -879,71 +875,71 @@ function oe(a, t) {
879
875
  });
880
876
  }
881
877
  function le(a, { minLng: t, maxLng: e, minLat: i, maxLat: s } = {}) {
882
- const r = Math.round(it(360 / a, 2) / Math.PI), o = (1 + Math.sqrt(5)) / 2, n = (h) => h / o * 360 % 360 - 180, l = (h) => Math.acos(2 * h / r - 1) / Math.PI * 180 - 90, c = (h) => r * (Math.cos((h + 90) * Math.PI / 180) + 1) / 2, d = [
878
+ const r = Math.round(et(360 / a, 2) / Math.PI), l = (1 + Math.sqrt(5)) / 2, n = (h) => h / l * 360 % 360 - 180, o = (h) => Math.acos(2 * h / r - 1) / Math.PI * 180 - 90, c = (h) => r * (Math.cos((h + 90) * Math.PI / 180) + 1) / 2, p = [
883
879
  s !== void 0 ? Math.ceil(c(s)) : 0,
884
880
  i !== void 0 ? Math.floor(c(i)) : r - 1
885
881
  ], u = t === void 0 && e === void 0 ? () => !0 : t === void 0 ? (h) => h <= e : e === void 0 ? (h) => h >= t : e >= t ? (h) => h >= t && h <= e : (h) => h >= t || h <= e, m = [];
886
- for (let h = d[0]; h <= d[1]; h++) {
882
+ for (let h = p[0]; h <= p[1]; h++) {
887
883
  const f = n(h);
888
- u(f) && m.push([f, l(h)]);
884
+ u(f) && m.push([f, o(h)]);
889
885
  }
890
886
  return m;
891
887
  }
892
- function Y(a, t, e = !1) {
888
+ function X(a, t, e = !1) {
893
889
  return e ? Zt(t, a) : Jt(a, t);
894
890
  }
895
891
  function ce(a, t) {
896
- const e = { type: "Polygon", coordinates: a }, [[i, s], [r, o]] = wt(e);
897
- if (Math.min(Math.abs(r - i), Math.abs(o - s)) < t)
892
+ const e = { type: "Polygon", coordinates: a }, [[i, s], [r, l]] = wt(e);
893
+ if (Math.min(Math.abs(r - i), Math.abs(l - s)) < t)
898
894
  return [];
899
- const n = i > r || o >= 89 || s <= -89;
895
+ const n = i > r || l >= 89 || s <= -89;
900
896
  return le(t, {
901
897
  minLng: i,
902
898
  maxLng: r,
903
899
  minLat: s,
904
- maxLat: o
900
+ maxLat: l
905
901
  }).filter(
906
- (l) => Y(l, e, n)
902
+ (o) => X(o, e, n)
907
903
  );
908
904
  }
909
905
  function ue(a, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
910
- const s = oe(a, t), r = J(s), o = ce(a, t), n = [...r, ...o], l = { type: "Polygon", coordinates: a }, [[c, d], [u, m]] = wt(l), h = c > u || // crosses antimeridian
906
+ const s = oe(a, t), r = H(s), l = ce(a, t), n = [...r, ...l], o = { type: "Polygon", coordinates: a }, [[c, p], [u, m]] = wt(o), h = c > u || // crosses antimeridian
911
907
  m >= 89 || // crosses north pole
912
- d <= -89;
908
+ p <= -89;
913
909
  let f = [];
914
910
  if (h) {
915
911
  const v = te(n).triangles(), M = new Map(
916
- n.map(([j, A], L) => [`${j}-${A}`, L])
912
+ n.map(([j, A], B) => [`${j}-${A}`, B])
917
913
  );
918
914
  v.features.forEach((j) => {
919
- const A = j.geometry.coordinates[0].slice(0, 3).reverse(), L = [];
920
- if (A.forEach(([S, $]) => {
921
- const k = `${S}-${$}`;
922
- M.has(k) && L.push(M.get(k));
923
- }), L.length === 3) {
924
- if (L.some((S) => S < r.length)) {
915
+ const A = j.geometry.coordinates[0].slice(0, 3).reverse(), B = [];
916
+ if (A.forEach(([S, Z]) => {
917
+ const V = `${S}-${Z}`;
918
+ M.has(V) && B.push(M.get(V));
919
+ }), B.length === 3) {
920
+ if (B.some((S) => S < r.length)) {
925
921
  const S = j.properties.circumcenter;
926
- if (!Y(
922
+ if (!X(
927
923
  S,
928
- l,
924
+ o,
929
925
  h
930
926
  ))
931
927
  return;
932
928
  }
933
- f.push(...L);
929
+ f.push(...B);
934
930
  }
935
931
  });
936
- } else if (o.length) {
932
+ } else if (l.length) {
937
933
  const v = Ht.from(n);
938
934
  for (let M = 0, j = v.triangles.length; M < j; M += 3) {
939
- const A = [2, 1, 0].map((S) => v.triangles[M + S]), L = A.map((S) => n[S]);
935
+ const A = [2, 1, 0].map((S) => v.triangles[M + S]), B = A.map((S) => n[S]);
940
936
  if (A.some((S) => S < r.length)) {
941
937
  const S = [0, 1].map(
942
- ($) => Kt(L, (k) => k[$])
938
+ (Z) => Kt(B, (V) => V[Z])
943
939
  );
944
- if (!Y(
940
+ if (!X(
945
941
  S,
946
- l,
942
+ o,
947
943
  h
948
944
  ))
949
945
  continue;
@@ -954,66 +950,66 @@ function ue(a, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
954
950
  const { vertices: v, holes: M = [] } = Pt(s);
955
951
  f = Xt(v, M, 2);
956
952
  }
957
- let p = e ? [e[0], e[2]] : ht(n, (v) => v[0]), g = e ? [e[1], e[3]] : ht(n, (v) => v[1]);
953
+ let d = e ? [e[0], e[2]] : ut(n, (v) => v[0]), g = e ? [e[1], e[3]] : ut(n, (v) => v[1]);
958
954
  if (i) {
959
- const [v, M] = i([p[0], g[0]]), [j, A] = i([p[1], g[1]]);
960
- p = [v, j], g = [-M, -A];
955
+ const [v, M] = i([d[0], g[0]]), [j, A] = i([d[1], g[1]]);
956
+ d = [v, j], g = [-M, -A];
961
957
  }
962
- const w = ft(p, [0, 1]), z = ft(g, [0, 1]), D = n.map(([v, M]) => {
958
+ const w = ht(d, [0, 1]), z = ht(g, [0, 1]), I = n.map(([v, M]) => {
963
959
  if (i) {
964
960
  const [j, A] = i([v, M]);
965
961
  return [w(j), z(-A)];
966
962
  } else
967
963
  return [w(v), z(M)];
968
964
  });
969
- return { contour: s, triangles: { points: n, indices: f, uvs: D } };
965
+ return { contour: s, triangles: { points: n, indices: f, uvs: I } };
970
966
  }
971
- const bt = new H().setAttribute ? "setAttribute" : "addAttribute";
972
- function Z(a, t, e, i) {
967
+ const bt = new Y().setAttribute ? "setAttribute" : "addAttribute";
968
+ function F(a, t, e, i) {
973
969
  const s = a.map(
974
- (r) => r.map(([o, n]) => {
970
+ (r) => r.map(([l, n]) => {
975
971
  if (i) {
976
- const [l, c] = i([o, n]);
977
- return [l, -c, t];
972
+ const [o, c] = i([l, n]);
973
+ return [o, -c, t];
978
974
  }
979
- return e ? Nt(o, n, t) : [o, n, t];
975
+ return e ? qt(l, n, t) : [l, n, t];
980
976
  })
981
977
  );
982
978
  return Pt(s);
983
979
  }
984
980
  function he(a, t, e, i, s) {
985
- const { vertices: r, holes: o } = Z(
981
+ const { vertices: r, holes: l } = F(
986
982
  a,
987
983
  t,
988
984
  i,
989
985
  s
990
- ), { vertices: n } = Z(
986
+ ), { vertices: n } = F(
991
987
  a,
992
988
  e,
993
989
  i,
994
990
  s
995
- ), l = J([n, r]), c = Math.round(n.length / 3), d = new Set(o);
991
+ ), o = H([n, r]), c = Math.round(n.length / 3), p = new Set(l);
996
992
  let u = 0;
997
993
  const m = [];
998
994
  for (let f = 0; f < c; f++) {
999
- let p = f + 1;
1000
- if (p === c)
1001
- p = u;
1002
- else if (d.has(p)) {
1003
- const g = p;
1004
- p = u, u = g;
995
+ let d = f + 1;
996
+ if (d === c)
997
+ d = u;
998
+ else if (p.has(d)) {
999
+ const g = d;
1000
+ d = u, u = g;
1005
1001
  }
1006
- m.push(f, f + c, p + c), m.push(p + c, p, f);
1002
+ m.push(f, f + c, d + c), m.push(d + c, d, f);
1007
1003
  }
1008
1004
  const h = [];
1009
1005
  for (let f = 1; f >= 0; f--)
1010
- for (let p = 0; p < c; p += 1) h.push(p / (c - 1), f);
1011
- return { indices: m, vertices: l, uvs: h, topVerts: n };
1006
+ for (let d = 0; d < c; d += 1) h.push(d / (c - 1), f);
1007
+ return { indices: m, vertices: o, uvs: h, topVerts: n };
1012
1008
  }
1013
1009
  function yt(a, t, e, i, s, r) {
1014
1010
  return {
1015
1011
  indices: i ? a.indices : a.indices.slice().reverse(),
1016
- vertices: Z(
1012
+ vertices: F(
1017
1013
  [a.points],
1018
1014
  t,
1019
1015
  s,
@@ -1029,37 +1025,37 @@ const fe = ({
1029
1025
  curvatureResolution: i = 1,
1030
1026
  cartesian: s = !0,
1031
1027
  hasSide: r = !0,
1032
- hasBottom: o = !1,
1028
+ hasBottom: l = !1,
1033
1029
  hasTop: n = !1,
1034
- projection: l,
1030
+ projection: o,
1035
1031
  bbox: c
1036
1032
  }) => {
1037
1033
  a.forEach((w) => {
1038
1034
  Yt(w) || w.reverse();
1039
1035
  });
1040
- const { contour: d, triangles: u } = ue(a, {
1036
+ const { contour: p, triangles: u } = ue(a, {
1041
1037
  resolution: i,
1042
1038
  bbox: c,
1043
- projection: l
1039
+ projection: o
1044
1040
  });
1045
1041
  let m = {}, h;
1046
1042
  r && (m = he(
1047
- d,
1043
+ p,
1048
1044
  t != null ? t : e,
1049
1045
  e != null ? e : t,
1050
1046
  s,
1051
- l
1047
+ o
1052
1048
  ), h = m.topVerts);
1053
1049
  let f = [];
1054
- (o || n) && (f = J(u.uvs));
1055
- let p = {};
1056
- o && (p = yt(
1050
+ (l || n) && (f = H(u.uvs));
1051
+ let d = {};
1052
+ l && (d = yt(
1057
1053
  u,
1058
1054
  t,
1059
1055
  f,
1060
1056
  !1,
1061
1057
  s,
1062
- l
1058
+ o
1063
1059
  ));
1064
1060
  let g = {};
1065
1061
  return n && (g = yt(
@@ -1068,12 +1064,12 @@ const fe = ({
1068
1064
  f,
1069
1065
  !0,
1070
1066
  s,
1071
- l
1072
- )), { contour: d, triangles: u, sideTorso: m, bottomCap: p, topCap: g, topVerts: h };
1067
+ o
1068
+ )), { contour: p, triangles: u, sideTorso: m, bottomCap: d, topCap: g, topVerts: h };
1073
1069
  };
1074
- class Be extends H {
1070
+ class De extends Y {
1075
1071
  constructor(t, e = {}) {
1076
- super(), this.type = "PolygonBufferGeometry", this.parameters = _({
1072
+ super(), this.type = "PolygonBufferGeometry", this.parameters = W({
1077
1073
  polygonGeoJson: t,
1078
1074
  startHeight: 0,
1079
1075
  endHeight: 1,
@@ -1089,33 +1085,32 @@ class Be extends H {
1089
1085
  endHeight: i,
1090
1086
  hasTop: s,
1091
1087
  topFirst: r,
1092
- hasBottom: o,
1088
+ hasBottom: l,
1093
1089
  hasSide: n,
1094
- cartesian: l,
1090
+ cartesian: o,
1095
1091
  userDataRsoOffset: c,
1096
- projection: d
1097
- } = this.parameters, { contour: u, sideTorso: m, topVerts: h, bottomCap: f, topCap: p } = fe(_({}, this.parameters));
1098
- let g = [], w = [], z = [], D = 0;
1092
+ projection: p
1093
+ } = this.parameters, { contour: u, sideTorso: m, topVerts: h, bottomCap: f, topCap: d } = fe(W({}, this.parameters));
1094
+ let g = [], w = [], z = [], I = 0;
1099
1095
  const P = (v) => {
1100
1096
  const M = Math.round(g.length / 3), j = z.length;
1101
1097
  g = g.concat(v.vertices), w = w.concat(v.uvs), z = z.concat(
1102
1098
  M ? v.indices.map((A) => A + M) : v.indices
1103
- ), this.addGroup(j, z.length - j, D++);
1099
+ ), this.addGroup(j, z.length - j, I++);
1104
1100
  };
1105
- s && r && P(p), n && (P(m), this.userData.topVerts = c ? Z(
1101
+ s && r && P(d), n && (P(m), this.userData.topVerts = c ? F(
1106
1102
  u,
1107
1103
  i + c,
1108
- l,
1109
- d
1110
- ).vertices : h), o && P(f), s && !r && P(p), this.setIndex(z), this[bt]("position", new F(g, 3)), this[bt]("uv", new F(w, 2)), this.computeVertexNormals();
1104
+ o,
1105
+ p
1106
+ ).vertices : h), l && P(f), s && !r && P(d), this.setIndex(z), this[bt]("position", new G(g, 3)), this[bt]("uv", new G(w, 2)), this.computeVertexNormals();
1111
1107
  }
1112
1108
  }
1113
1109
  export {
1114
- ie as B,
1115
- ze as G,
1116
- De as L,
1110
+ ft as B,
1111
+ ze as L,
1117
1112
  Ie as M,
1118
- Be as P,
1119
- O as R,
1113
+ De as P,
1114
+ ie as R,
1120
1115
  fe as g
1121
1116
  };