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

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.
Files changed (37) hide show
  1. package/dist/constants.d.ts +1 -0
  2. package/dist/core/BaseObject/PointerEvent.d.ts +13 -0
  3. package/dist/core/BaseObject/UseMaterial.d.ts +23 -0
  4. package/dist/core/{BaseObject.d.ts → BaseObject/index.d.ts} +24 -29
  5. package/dist/core/Composer.d.ts +5 -5
  6. package/dist/core/Lead/Lead.d.ts +17 -10
  7. package/dist/core/Lead/Pick.d.ts +2 -1
  8. package/dist/core/MList/MList.d.ts +11 -5
  9. package/dist/core/Pencil.d.ts +12 -10
  10. package/dist/core/Renderer.d.ts +0 -1
  11. package/dist/core/ResourceTracker.d.ts +4 -6
  12. package/dist/index.js +23 -23
  13. package/dist/index.module.js +1702 -1562
  14. package/dist/index.module2.js +641 -787
  15. package/dist/index2.js +130 -140
  16. package/dist/objects/conicPolygon/geometry/index.d.ts +4 -4
  17. package/dist/objects/extrudePolygon/ExtrudeGeometry.d.ts +1 -1
  18. package/dist/objects/extrudePolygon/createGeometry.d.ts +9 -13
  19. package/dist/objects/index.js +1 -1
  20. package/dist/objects/index.module.js +811 -783
  21. package/dist/objects/line/createGeometry.d.ts +2 -2
  22. package/dist/objects/line/index.d.ts +4 -4
  23. package/dist/objects/line/meshLine/MeshLineGeometry.d.ts +16 -35
  24. package/dist/objects/line/meshLine/MeshLineMaterial.d.ts +59 -40
  25. package/dist/objects/line/meshLine/fragment.d.ts +1 -0
  26. package/dist/objects/line/meshLine/utils.d.ts +4 -0
  27. package/dist/objects/line/meshLine/vertex.d.ts +1 -0
  28. package/dist/objects/line2/WebGPULineSegments2.d.ts +1 -1
  29. package/dist/objects/line2/createGeometry.d.ts +1 -1
  30. package/dist/objects/pie/index.d.ts +9 -13
  31. package/dist/plugins/Worker/createGeometry.d.ts +1 -1
  32. package/dist/plugins/index.js +1 -1
  33. package/dist/plugins/index.module.js +36 -36
  34. package/dist/utils/Sprite2Points.d.ts +1 -1
  35. package/dist/utils/setInstancedAttr.d.ts +6 -0
  36. package/package.json +1 -1
  37. package/dist/objects/scene/index.d.ts +0 -11
@@ -1,94 +1,106 @@
1
- var jt = Object.defineProperty, At = Object.defineProperties;
2
- var St = Object.getOwnPropertyDescriptors;
3
- var tt = Object.getOwnPropertySymbols;
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) => {
1
+ var Pt = Object.defineProperty, It = Object.defineProperties;
2
+ var Dt = Object.getOwnPropertyDescriptors;
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) => {
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]);
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) => {
7
+ it.call(t, e) && et(n, e, t[e]);
8
+ if (k)
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) => {
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]);
20
+ return e;
21
+ };
22
+ var rt = (n, t, e) => new Promise((i, s) => {
23
+ var a = (c) => {
15
24
  try {
16
- n(e.next(l));
17
- } catch (c) {
18
- s(c);
25
+ o(e.next(c));
26
+ } catch (r) {
27
+ s(r);
19
28
  }
20
- }, o = (l) => {
29
+ }, l = (c) => {
21
30
  try {
22
- n(e.throw(l));
23
- } catch (c) {
24
- s(c);
31
+ o(e.throw(c));
32
+ } catch (r) {
33
+ s(r);
25
34
  }
26
- }, n = (l) => l.done ? i(l.value) : Promise.resolve(l.value).then(r, o);
27
- n((e = e.apply(a, t)).next());
35
+ }, o = (c) => c.done ? i(c.value) : Promise.resolve(c.value).then(a, l);
36
+ o((e = e.apply(n, t)).next());
28
37
  });
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";
30
- import { CSS2DObject as Rt } from "three/examples/jsm/renderers/CSS2DRenderer";
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";
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";
40
+ import { CSS3DObject as Rt, CSS3DSprite as Gt } from "three/examples/jsm/renderers/CSS3DRenderer";
41
+ import { geoBounds as At, geoContains as $t, geoDistance as Ft, geoInterpolate as qt } from "d3-geo";
33
42
  import "d3-geo-projection";
34
- import { p as ut, a as Nt } from "./parseVector.module.js";
43
+ import { p as dt, a as Kt } from "./parseVector.module.js";
35
44
  import { LineSegmentsGeometry as Qt } from "three/examples/jsm/lines/LineSegmentsGeometry";
36
- import { merge as J, mean as Kt, extent as ht } from "d3-array";
37
- import Xt, { flatten as Pt } from "earcut";
38
- import Yt from "@turf/boolean-clockwise";
39
- import Ht from "delaunator";
40
- import Jt from "@turf/boolean-point-in-polygon";
45
+ import { merge as tt, mean as Xt, extent as ht } from "d3-array";
46
+ import Yt, { flatten as Ct } from "earcut";
47
+ import Zt from "@turf/boolean-clockwise";
48
+ import Jt from "delaunator";
49
+ import Ht from "@turf/boolean-point-in-polygon";
41
50
  import { geoVoronoi as te } from "d3-geo-voronoi";
42
- import { scaleLinear as ft } from "d3-scale";
43
- class O {
51
+ import { scaleLinear as pt } from "d3-scale";
52
+ const ee = 0, Le = 1, ie = 2, _e = !1;
53
+ class se {
44
54
  constructor() {
45
- this.resources = /* @__PURE__ */ new Set(), this.disposeWithMaterial = !0, this.disposeVideo = !0, this.materialList = {}, this.disposeTrack = !0;
55
+ this.resources = /* @__PURE__ */ new Set(), this.disposeMaterial = !0, this.disposeVideo = !0;
46
56
  }
47
57
  track(t) {
48
- if (!t || this.disposeTrack === !1)
58
+ if (!t)
49
59
  return t;
50
60
  if (Array.isArray(t))
51
61
  return t.forEach((e) => this.track(e)), t;
52
- if (!this.disposeWithMaterial && t instanceof nt)
62
+ if (!this.disposeMaterial && t instanceof at)
53
63
  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) {
64
+ if (t instanceof mt ? (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 mt)
65
+ t.children.forEach((e) => {
66
+ e.disposeTrack = !1;
67
+ }), this.track(t.children);
68
+ else if (t instanceof R) {
57
69
  const e = t;
58
70
  this.track(e.geometry), this.track(e.material), this.track(e.children);
59
- } else if (t instanceof nt) {
71
+ } else if (t instanceof at) {
60
72
  for (const i of Object.values(t))
61
- i instanceof rt && this.track(i);
73
+ i instanceof ct && this.track(i);
62
74
  const e = t;
63
75
  if (e.uniforms) {
64
76
  for (const i of Object.values(e.uniforms))
65
77
  if (i) {
66
78
  const s = i.value;
67
- (s instanceof rt || Array.isArray(s)) && this.track(s);
79
+ (s instanceof ct || Array.isArray(s)) && this.track(s);
68
80
  }
69
81
  }
70
- } else this.disposeVideo && t instanceof Dt && t.source.data && this.resources.add(t.source.data);
82
+ } else this.disposeVideo && t instanceof Bt && t.source.data && this.resources.add(t.source.data);
71
83
  return t;
72
84
  }
73
85
  dispose() {
74
86
  const t = [];
75
87
  for (const e of this.resources)
76
- e instanceof G ? t.push(e) : e instanceof HTMLVideoElement && e.pause(), Reflect.has(e, "dispose") && e.dispose();
88
+ e instanceof R ? t.push(e) : e instanceof HTMLVideoElement && e.pause(), Reflect.has(e, "dispose") && e.dispose();
77
89
  t.forEach((e) => {
78
90
  e.removeFromParent();
79
91
  }), t.length = 0, this.resources.clear();
80
92
  }
81
93
  }
82
- const ee = (a, t = 1) => {
83
- const e = new H();
94
+ const ne = (n, t = 1) => {
95
+ const e = new J();
84
96
  e.setAttribute(
85
97
  "position",
86
- new F(new Array(t * 3).fill(0), 3)
98
+ new G(new Array(t * 3).fill(0), 3)
87
99
  ), e.setAttribute(
88
100
  "scaleAtt",
89
- new F(new Array(t).fill(1), 1)
101
+ new G(new Array(t).fill(1), 1)
90
102
  );
91
- const i = a.material, s = new It({
103
+ const i = n.material, s = new Tt({
92
104
  size: 10,
93
105
  map: i.map,
94
106
  alphaMap: i.alphaMap,
@@ -101,19 +113,119 @@ const ee = (a, t = 1) => {
101
113
  alphaTest: i.alphaTest,
102
114
  sizeAttenuation: !1
103
115
  });
104
- return s.onBeforeCompile = (r) => {
105
- r.vertexShader = `
116
+ return s.onBeforeCompile = (a) => {
117
+ a.vertexShader = `
106
118
  attribute float scaleAtt;
107
- ${r.vertexShader.replace(
119
+ ${a.vertexShader.replace(
108
120
  "gl_PointSize = size;",
109
121
  "gl_PointSize = size * scaleAtt;"
110
122
  )}
111
123
  `;
112
- }, new X(e, s);
124
+ }, new H(e, s);
125
+ }, oe = (n, t) => {
126
+ const e = new R();
127
+ t.forEach((i, s) => {
128
+ const a = dt(i.position), l = dt(i.scale || [1, 1, 1]);
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;
136
+ }
137
+ });
113
138
  };
114
- class ie extends O {
139
+ class re {
140
+ constructor() {
141
+ this.onPointerIndex = [];
142
+ }
143
+ onPointerEvent(t, e) {
144
+ const i = this.lead.handlePick([this], t, e);
145
+ this.onPointerIndex.push(i);
146
+ }
147
+ onClick(t) {
148
+ this.onPointerEvent("click", t);
149
+ }
150
+ onPointerEnter(t) {
151
+ this.onPointerEvent("enter", t);
152
+ }
153
+ onPointerLeave(t) {
154
+ this.onPointerEvent("leave", t);
155
+ }
156
+ onPointerMove(t) {
157
+ this.onPointerEvent("move", t);
158
+ }
159
+ onPointerDown(t) {
160
+ this.onPointerEvent("down", t);
161
+ }
162
+ dispose() {
163
+ this.onPointerIndex.forEach((t) => {
164
+ this.lead.removePick(t);
165
+ });
166
+ }
167
+ }
168
+ class ae extends re {
169
+ constructor() {
170
+ super(...arguments), this.userData = {}, this.materialList = {}, this.useMaterialType = "origin", this.disposeMaterialIfNotUsed = !0;
171
+ }
172
+ cloneMaterial() {
173
+ const t = this.object3d;
174
+ if (!t || !t.material)
175
+ return;
176
+ const e = t.material;
177
+ if (Array.isArray(e))
178
+ return e.map((i) => {
179
+ const s = i.userData;
180
+ i.userData = {};
181
+ const a = i.clone();
182
+ return i.userData = s, a;
183
+ });
184
+ {
185
+ const i = e.userData;
186
+ e.userData = {};
187
+ const s = e.clone();
188
+ return e.userData = i, s;
189
+ }
190
+ }
191
+ setMaterialList(t, e) {
192
+ const i = this.object3d;
193
+ if (!i || !i.material)
194
+ return;
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;
198
+ }
199
+ useMaterial(t) {
200
+ const e = this.object3d;
201
+ !e || !e.material || this.useMaterialType === t || !this.materialList[t] || (this.useMaterialType = t, e.material = this.materialList[t]);
202
+ }
203
+ useMListById(t, e) {
204
+ if (!this.mList)
205
+ return;
206
+ const i = this.mList.get(t);
207
+ if (!i)
208
+ return;
209
+ const s = this.object3d;
210
+ Array.isArray(s.material) && e !== void 0 ? s.material[e] = i : s.material = i;
211
+ }
212
+ useMListByName(t, e) {
213
+ if (!this.mList)
214
+ return;
215
+ const i = this.mList.getKeyByName(t);
216
+ i && this.useMListById(i, e);
217
+ }
218
+ dispose() {
219
+ super.dispose(), this.mList.rmBaseObjectMap(
220
+ this,
221
+ void 0,
222
+ this.disposeMaterialIfNotUsed
223
+ );
224
+ }
225
+ }
226
+ class mt extends ae {
115
227
  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 = [];
228
+ super(...arguments), this.objectType = "BaseObject", this.userData = {}, this.prefab = !1, this.isInstantiate = !1, this.isBloom = !1, this.disposeTrack = !0;
117
229
  }
118
230
  get parent() {
119
231
  const t = this.object3d.parent;
@@ -131,11 +243,21 @@ class ie extends O {
131
243
  get scale() {
132
244
  return this.object3d.scale;
133
245
  }
134
- get add() {
135
- return this.object3d.add.bind(this.object3d);
246
+ get lookAt() {
247
+ return this.object3d.lookAt;
136
248
  }
137
- get remove() {
138
- return this.object3d.remove.bind(this.object3d);
249
+ add(...t) {
250
+ [...t].forEach((e) => {
251
+ this.lead.objMap.get(e) ? this.object3d.add(e) : this.lead.createBaseObject(e, {
252
+ target: this
253
+ });
254
+ });
255
+ }
256
+ remove(...t) {
257
+ [...t].forEach((e) => {
258
+ var i;
259
+ this.lead.objMap.get(e) ? (i = this.lead.objMap.get(e)) == null || i.erase() : this.object3d.remove(e);
260
+ });
139
261
  }
140
262
  get visible() {
141
263
  return this.object3d.visible;
@@ -162,31 +284,31 @@ class ie extends O {
162
284
  resize(t, e) {
163
285
  }
164
286
  show() {
165
- return this.object3d.visible = !0, this;
287
+ return this.object3d.visible = !0, this.object3d.layers.set(ee), this;
166
288
  }
167
289
  hide() {
168
- return this.object3d.visible = !1, this;
169
- }
170
- createMesh(...t) {
171
- return this.object3d = new xt(...t), this;
290
+ return this.object3d.visible = !1, this.object3d.layers.set(ie), this;
172
291
  }
173
292
  createGroup() {
174
- return this.object3d = new Bt(), this;
293
+ return this.object3d = new Lt(), this;
294
+ }
295
+ createMesh(...t) {
296
+ return this.object3d = new St(...t), this;
175
297
  }
176
298
  createPoints(...t) {
177
- return this.object3d = new X(...t), this;
299
+ return this.object3d = new H(...t), this;
178
300
  }
179
301
  createCSS2DObject(t) {
180
- return this.object3d = new Rt(t), this;
302
+ return this.object3d = new Nt(t), this;
181
303
  }
182
304
  createCSS3DObject(t) {
183
- return this.object3d = new Gt(t), this;
305
+ return this.object3d = new Rt(t), this;
184
306
  }
185
307
  createCSS3DSprite(t) {
186
- return this.object3d = new Ft(t), this;
308
+ return this.object3d = new Gt(t), this;
187
309
  }
188
310
  createSprite(t) {
189
- return this.object3d = new at(t), this;
311
+ return this.object3d = new lt(t), this;
190
312
  }
191
313
  attach(...t) {
192
314
  return [...t].forEach((e) => {
@@ -194,120 +316,62 @@ class ie extends O {
194
316
  }), this;
195
317
  }
196
318
  getSize() {
197
- const t = new Mt().setFromObject(this.object3d);
319
+ const t = new jt().setFromObject(this.object3d);
198
320
  return {
199
321
  min: t.min,
200
322
  max: t.max,
201
- size: t.getSize(new C()),
202
- center: t.getCenter(new C())
323
+ size: t.getSize(new D()),
324
+ center: t.getCenter(new D())
203
325
  };
204
326
  }
327
+ setTop(t) {
328
+ this.object3d && (this.object3d.renderOrder = t);
329
+ }
205
330
  traverse(t) {
206
331
  t(this), this.children.forEach((e) => {
207
332
  e.traverse(t);
208
333
  });
209
334
  }
210
- clone() {
211
- return this.instantiate();
212
- }
213
- 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) => {
335
+ instantiate(t) {
336
+ return rt(this, null, function* () {
337
+ var c;
338
+ const e = (c = t == null ? void 0 : t.recursive) != null ? c : !0, { objectType: i, objectOptions: s } = this, [, a] = i.split("#");
339
+ let l = t == null ? void 0 : t.create;
340
+ l === void 0 && (l = (r) => {
341
+ var h;
219
342
  if (this.object3d) {
220
- if (i) {
221
- const m = t.length;
222
- if (this.object3d instanceof at)
223
- u.object3d = ee(this.object3d, m);
343
+ if ((h = t == null ? void 0 : t.instancedAttr) != null && h.length) {
344
+ const f = t.instancedAttr.length;
345
+ if (this.object3d instanceof lt)
346
+ r.object3d = ne(this.object3d, f);
224
347
  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");
348
+ const p = this.object3d, u = this.cloneMaterial();
349
+ r.object3d = new wt(p.geometry, u, f);
231
350
  }
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());
236
- });
351
+ oe(r.object3d, t == null ? void 0 : t.instancedAttr);
237
352
  } else
238
- u.object3d = this.object3d.clone(!1), u.setMaterialList("instantiate", "clone"), u.useMaterial("instantiate");
239
- u.object3d.userData.prefab && delete u.object3d.userData.prefab;
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;
240
355
  }
241
356
  });
242
- const c = yield this.lead.draw(n, q(_({}, o || {}), {
357
+ const o = yield this.lead.draw(a, q(E({}, s || {}), {
243
358
  create: l,
244
359
  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)
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)
247
362
  }));
248
- return this.isBloom && c.enableBloom(), s && (yield Promise.all(
363
+ return this.isBloom && o.enableBloom(), e && (yield Promise.all(
249
364
  this.children.map(
250
- (u) => u.instantiate(void 0, {
251
- target: c
365
+ (r) => r.instantiate({
366
+ target: o
252
367
  })
253
368
  )
254
- )), c.isInstantiate = !0, c;
369
+ )), o.isInstantiate = !0, o;
255
370
  });
256
371
  }
257
- setInstancedMatrix(t, e) {
258
- if (this.object3d instanceof ot || this.object3d.isInstantiate)
259
- 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;
263
- }
264
- }
265
372
  erase() {
266
373
  this.lead.erase(this);
267
374
  }
268
- cloneMaterial() {
269
- const t = this.object3d;
270
- if (!t || !t.material)
271
- return;
272
- const e = t.material;
273
- if (Array.isArray(e))
274
- return e.map((i) => {
275
- const s = i.userData;
276
- i.userData = {};
277
- const r = i.clone();
278
- return i.userData = s, r;
279
- });
280
- {
281
- const i = e.userData;
282
- e.userData = {};
283
- const s = e.clone();
284
- return e.userData = i, s;
285
- }
286
- }
287
- setMaterialList(t, e, i = !0) {
288
- const s = this.object3d;
289
- if (!s || !s.material)
290
- 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];
297
- const r = e === "clone" ? this.cloneMaterial() : e;
298
- return this.materialList[t] = r, r;
299
- }
300
- useMaterial(t) {
301
- const e = this.object3d;
302
- !e || !e.material || this.useMaterialType === t || !this.materialList[t] || (this.useMaterialType = t, e.material = this.materialList[t]);
303
- }
304
- setTop(t) {
305
- this.object3d && (this.object3d.renderOrder = t);
306
- }
307
- onPointerEvent(t, e) {
308
- const i = this.lead.handlePick([this], t, e);
309
- this.onPointerIndex.push(i);
310
- }
311
375
  enableBloom() {
312
376
  var t;
313
377
  (t = this.pencil.composerController) == null || t.setBloomSelection(this, !0), this.isBloom = !0;
@@ -318,91 +382,87 @@ class ie extends O {
318
382
  }
319
383
  dispose() {
320
384
  var t;
321
- this.onPointerIndex.forEach((e) => {
322
- 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();
324
- }
325
- }
326
- class ze extends ie {
327
- create() {
328
- this.createGroup();
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();
387
+ e.disposeMaterial = !1, e.track(this), e.dispose();
388
+ }
329
389
  }
330
390
  }
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;
333
- 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));
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));
335
395
  }
336
- 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++) {
339
- 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,
343
- pointOnLine: c,
344
- distance: T.origin.distanceTo(d),
345
- object: a,
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({
402
+ point: h,
403
+ pointOnLine: r,
404
+ distance: z.origin.distanceTo(h),
405
+ object: n,
346
406
  face: null,
347
- faceIndex: n,
407
+ faceIndex: o,
348
408
  uv: null,
349
409
  uv1: null
350
410
  });
351
411
  }
352
412
  }
353
- 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)
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);
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)
358
418
  continue;
359
- if (b.z > u) {
360
- const D = b.z - y.z, P = (b.z - u) / D;
361
- b.lerp(y, P);
362
- } else if (y.z > u) {
363
- const D = y.z - b.z, P = (y.z - u) / D;
364
- y.lerp(b, P);
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);
365
425
  }
366
- 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;
370
- 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({
374
- point: P,
375
- pointOnLine: D,
376
- distance: T.origin.distanceTo(P),
377
- object: a,
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;
430
+ if (w && S) {
431
+ M.start.fromBufferAttribute(c, p), M.end.fromBufferAttribute(r, p), M.start.applyMatrix4(l), M.end.applyMatrix4(l);
432
+ const j = new D(), A = new D();
433
+ z.distanceSqToSegment(M.start, M.end, A, j), e.push({
434
+ point: A,
435
+ pointOnLine: j,
436
+ distance: z.origin.distanceTo(A),
437
+ object: n,
378
438
  face: null,
379
- faceIndex: m,
439
+ faceIndex: p,
380
440
  uv: null,
381
441
  uv1: null
382
442
  });
383
443
  }
384
444
  }
385
445
  }
386
- class De extends xt {
446
+ class Ee extends St {
387
447
  constructor(t = new Qt(), e) {
388
448
  super(t, e), this.isLineSegments2 = !0, this.type = "LineSegments2";
389
449
  }
390
450
  // for backwards-compatibility, but could be a method of LineSegmentsGeometry...
391
451
  computeLineDistances() {
392
452
  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);
395
- const r = new Ot(
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);
455
+ const a = new Vt(
396
456
  s,
397
457
  2,
398
458
  1
399
459
  );
400
460
  return t.setAttribute(
401
461
  "instanceDistanceStart",
402
- new lt(r, 1, 0)
462
+ new ut(a, 1, 0)
403
463
  ), t.setAttribute(
404
464
  "instanceDistanceEnd",
405
- new lt(r, 1, 1)
465
+ new ut(a, 1, 1)
406
466
  ), this;
407
467
  }
408
468
  raycast(t, e) {
@@ -410,670 +470,463 @@ class De extends xt {
410
470
  s === null && !i && console.error(
411
471
  'LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'
412
472
  );
413
- 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);
417
- let c;
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;
418
478
  if (i)
419
- c = W * 0.5;
479
+ r = _ * 0.5;
420
480
  else {
421
- const u = Math.max(
481
+ const f = Math.max(
422
482
  s.near,
423
- R.distanceToPoint(T.origin)
483
+ N.distanceToPoint(z.origin)
424
484
  );
425
- c = vt(
485
+ r = gt(
426
486
  s,
427
- u,
428
- l.resolution
487
+ f,
488
+ c.resolution
429
489
  );
430
490
  }
431
- if (R.radius += c, T.intersectsSphere(R) === !1)
491
+ if (N.radius += r, z.intersectsSphere(N) === !1)
432
492
  return;
433
- n.boundingBox === null && n.computeBoundingBox(), U.copy(n.boundingBox).applyMatrix4(o);
434
- let d;
493
+ o.boundingBox === null && o.computeBoundingBox(), U.copy(o.boundingBox).applyMatrix4(l);
494
+ let h;
435
495
  if (i)
436
- d = W * 0.5;
496
+ h = _ * 0.5;
437
497
  else {
438
- const u = Math.max(
498
+ const f = Math.max(
439
499
  s.near,
440
- U.distanceToPoint(T.origin)
500
+ U.distanceToPoint(z.origin)
441
501
  );
442
- d = vt(
502
+ h = gt(
443
503
  s,
444
- u,
445
- l.resolution
504
+ f,
505
+ c.resolution
446
506
  );
447
507
  }
448
- U.expandByScalar(d), T.intersectsBox(U) !== !1 && (i ? se(this, e) : ne(this, s, e));
508
+ U.expandByScalar(h), z.intersectsBox(U) !== !1 && (i ? ce(this, e) : le(this, s, e));
449
509
  }
450
510
  onBeforeRender(t) {
451
511
  const e = this.material.uniforms;
452
- e && e.resolution && (t.getViewport(N), this.material.uniforms.resolution.value.set(N.z, N.w));
512
+ e && e.resolution && (t.getViewport(Q), this.material.uniforms.resolution.value.set(Q.z, Q.w));
453
513
  }
454
514
  }
455
- const gt = ["encodings_fragment", "colorspace_fragment"], re = (
456
- /* glsl */
457
- `
458
- #include <common>
459
- #include <logdepthbuf_pars_vertex>
460
- #include <fog_pars_vertex>
515
+ const ue = `
516
+ #include <fog_pars_fragment>
517
+ #include <logdepthbuf_pars_fragment>
461
518
 
462
- attribute vec3 previous;
463
- attribute vec3 next;
464
- attribute float side;
465
- attribute float width;
466
- attribute float counters;
467
-
468
- uniform vec2 resolution;
469
- uniform float lineWidth;
470
- uniform vec3 color;
471
- uniform float opacity;
472
- uniform float sizeAttenuation;
473
- uniform vec2 offset;
519
+ uniform float useDash;
520
+ uniform float dashArray;
521
+ uniform float dashOffset;
522
+ uniform float dashRatio;
523
+ uniform sampler2D alphaMap;
524
+ uniform float useAlphaMap;
474
525
 
475
- uniform float time;
476
- uniform vec3 lightColor;
477
- uniform vec2 uCenter;
478
- uniform float size;
479
- uniform float speed;
480
- uniform float lightWidth;
481
- uniform float lineLightAnimation;
482
-
483
- varying vec2 vUV;
484
- varying vec4 vColor;
485
- varying float vCounters;
486
- varying vec2 vHighPrecisionZW;
487
-
488
- vec2 fix(vec4 i, float aspect) {
489
- vec2 res = i.xy / i.w;
490
- res.x *= aspect;
491
- vCounters = counters;
492
- return res;
493
- }
494
-
495
- void main() {
496
- float aspect = resolution.x / resolution.y;
497
- if (lineLightAnimation == 1.0) {
498
- vec2 vWorld=position.xy;
499
- float r_time=mod(time/(speed*size),2.);
500
- float l=distance(vWorld, uCenter)/size;
501
- float r_opacity=smoothstep(r_time-lightWidth*2.,r_time-lightWidth,l)-smoothstep(r_time-lightWidth,r_time,l);
502
- vColor=vec4(mix(color,lightColor,r_opacity),opacity);
503
- } else {
504
- vColor=vec4(color,opacity);
505
- }
526
+ varying vec2 vUV;
527
+ varying vec4 vColor;
528
+ varying float vCounters;
506
529
 
507
- vUV=uv+offset;
530
+ uniform sampler2D map;
531
+ uniform float useMap;
532
+ uniform vec2 repeat;
533
+ uniform float offsetLoop;
534
+ uniform float alphaTest;
508
535
 
509
- mat4 m = projectionMatrix * modelViewMatrix;
510
- vec4 finalPosition = m * vec4(position, 1.0);
511
- vec4 prevPos = m * vec4(previous, 1.0);
512
- vec4 nextPos = m * vec4(next, 1.0);
513
-
514
- vec2 currentP = fix(finalPosition, aspect);
515
- vec2 prevP = fix(prevPos, aspect);
516
- vec2 nextP = fix(nextPos, aspect);
517
-
518
- float w = lineWidth * width;
519
-
520
- vec2 dir;
521
- if (nextP == currentP) dir = normalize(currentP - prevP);
522
- else if (prevP == currentP) dir = normalize(nextP - currentP);
523
- else {
524
- vec2 dir1 = normalize(currentP - prevP);
525
- vec2 dir2 = normalize(nextP - currentP);
526
- dir = normalize(dir1 + dir2);
527
-
528
- vec2 perp = vec2(-dir1.y, dir1.x);
529
- vec2 miter = vec2(-dir.y, dir.x);
530
- //w = clamp(w / dot(miter, perp), 0., 4. * lineWidth * width);
531
- }
532
-
533
- //vec2 normal = (cross(vec3(dir, 0.), vec3(0., 0., 1.))).xy;
534
- vec4 normal = vec4(-dir.y, dir.x, 0., 1.);
535
- normal.xy *= .5 * w;
536
- //normal *= projectionMatrix;
537
- if (sizeAttenuation == 0.) {
538
- normal.xy *= finalPosition.w;
539
- normal.xy /= (vec4(resolution, 0., 1.) * projectionMatrix).xy;
540
- }
541
-
542
- finalPosition.xy += normal.xy * side;
543
- gl_Position = finalPosition;
544
- #include <logdepthbuf_vertex>
545
- #include <fog_vertex>
546
- vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);
547
- vHighPrecisionZW = finalPosition.zw;
548
- #include <fog_vertex>
549
- }
550
- `
551
- ), ae = (
552
- /* glsl */
553
- `
554
- #include <packing>
555
- #include <fog_pars_fragment>
556
- #include <logdepthbuf_pars_fragment>
557
-
558
- uniform sampler2D map;
559
- uniform sampler2D alphaMap;
560
- uniform float useMap;
561
- uniform float useAlphaMap;
562
- uniform float useDash;
563
- uniform float dashArray;
564
- uniform float dashOffset;
565
- uniform float dashRatio;
566
- uniform float visibility;
567
- uniform float alphaTest;
568
- uniform vec2 repeat;
569
- uniform float useDepth;
570
- uniform float offsetLoop;
571
-
572
- varying vec2 vUV;
573
- varying vec4 vColor;
574
- varying float vCounters;
575
- varying vec2 vHighPrecisionZW;
576
-
577
- void main() {
578
- #include <logdepthbuf_fragment>
579
- vec4 c = vColor;
580
- if (useMap == 1.) c *= texture2D(map, vUV * repeat);
581
- if (useAlphaMap == 1.) c.a *= texture2D(alphaMap, vUV * repeat).a;
582
- if(offsetLoop!=1.0){
536
+
537
+
538
+ void main() {
539
+ #include <logdepthbuf_fragment>
540
+
541
+ vec4 c = vColor;
542
+
543
+ if( useMap == 1. ) c *= texture2D( map, vUV * repeat );
544
+ if( useAlphaMap == 1. ) c.a *= texture2D( alphaMap, vUV * repeat ).r;
545
+ if(offsetLoop!=1.0){
583
546
  if(vUV.x>1.0 || vUV.x<0.0){
584
547
  c.a = 0.0;
585
548
  }
586
549
  }
550
+ if (c.a < alphaTest) discard;
551
+ if( useDash == 1. ){
552
+ c.a *= ceil(mod(vCounters + dashOffset, dashArray) - (dashArray * dashRatio));
553
+ }
554
+ gl_FragColor = c;
555
+ #include <fog_fragment>
556
+ #include <${parseInt(Wt) < 154 ? "encodings_fragment" : "colorspace_fragment"}>
557
+ }
558
+ `, fe = `
559
+ #include <common>
560
+ ${W.logdepthbuf_pars_vertex}
561
+ ${W.fog_pars_vertex}
587
562
 
588
- if (c.a < alphaTest) discard;
589
- if (useDash == 1.) {
590
- c.a *= ceil(mod(vCounters + dashOffset, dashArray) - (dashArray * dashRatio));
591
- }
592
- if (useDepth == 1.) {
593
- float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
594
- gl_FragColor = packDepthToRGBA( fragCoordZ );
595
- }else{
596
- gl_FragColor = c;
597
- gl_FragColor.a *= step(vCounters, visibility);
563
+ attribute vec3 previous;
564
+ attribute vec3 next;
565
+ attribute float side;
566
+ attribute float width;
567
+ attribute float counters;
568
+
569
+ uniform vec2 resolution;
570
+ uniform float lineWidth;
571
+ uniform vec3 color;
572
+ uniform float opacity;
573
+ uniform float sizeAttenuation;
574
+ uniform float scaleDown;
575
+ uniform vec2 offset;
576
+
577
+ varying vec2 vUV;
578
+ varying vec4 vColor;
579
+ varying float vCounters;
580
+
581
+ vec2 intoScreen(vec4 i) {
582
+ return resolution * (0.5 * i.xy / i.w + 0.5);
598
583
  }
599
-
600
-
601
- #include <fog_fragment>
602
- #include <tonemapping_fragment>
603
- #include <${+Ut < 154 ? gt[0] : gt[1]}>
604
- }
605
- `
606
- );
607
- class Ie extends kt {
608
- constructor(t) {
609
- super({
610
- uniforms: q(_({}, Et.fog), {
611
- lineWidth: { value: 1 },
612
- map: { value: null },
613
- useMap: { value: 0 },
614
- alphaMap: { value: null },
615
- useAlphaMap: { value: 0 },
616
- color: { value: new ct(16777215) },
617
- opacity: { value: 1 },
618
- resolution: { value: new E(1, 1) },
619
- sizeAttenuation: { value: 1 },
620
- dashArray: { value: 0 },
621
- dashOffset: { value: 0 },
622
- dashRatio: { value: 0.5 },
623
- useDash: { value: 0 },
624
- useDepth: { value: 0 },
625
- visibility: { value: 1 },
626
- alphaTest: { value: 0 },
627
- repeat: { value: new E(1, 1) },
628
- offset: { value: new E(0, 0) },
629
- offsetLoop: { value: 1 },
630
- lineLightAnimation: { value: 0 },
631
- time: { value: 0 },
632
- size: { value: 300 },
633
- speed: { value: 0.3 },
634
- lightWidth: { value: 0.1 },
635
- uCenter: { value: new E(0, 0) },
636
- lightColor: { value: new ct(16777215) }
637
- }),
638
- vertexShader: re,
639
- fragmentShader: ae
640
- }), this.type = "MeshLineMaterial", Object.defineProperties(this, {
641
- lineWidth: {
642
- enumerable: !0,
643
- get() {
644
- return this.uniforms.lineWidth.value;
645
- },
646
- set(e) {
647
- this.uniforms.lineWidth.value = e;
648
- }
649
- },
650
- map: {
651
- enumerable: !0,
652
- get() {
653
- return this.uniforms.map.value;
654
- },
655
- set(e) {
656
- this.uniforms.map.value = e;
657
- }
658
- },
659
- useMap: {
660
- enumerable: !0,
661
- get() {
662
- return this.uniforms.useMap.value;
663
- },
664
- set(e) {
665
- this.uniforms.useMap.value = e;
666
- }
667
- },
668
- alphaMap: {
669
- enumerable: !0,
670
- get() {
671
- return this.uniforms.alphaMap.value;
672
- },
673
- set(e) {
674
- this.uniforms.alphaMap.value = e;
675
- }
676
- },
677
- useAlphaMap: {
678
- enumerable: !0,
679
- get() {
680
- return this.uniforms.useAlphaMap.value;
681
- },
682
- set(e) {
683
- this.uniforms.useAlphaMap.value = e;
684
- }
685
- },
686
- color: {
687
- enumerable: !0,
688
- get() {
689
- return this.uniforms.color.value;
690
- },
691
- set(e) {
692
- this.uniforms.color.value = e;
693
- }
694
- },
695
- opacity: {
696
- enumerable: !0,
697
- get() {
698
- return this.uniforms.opacity.value;
699
- },
700
- set(e) {
701
- this.uniforms.opacity.value = e;
702
- }
703
- },
704
- resolution: {
705
- enumerable: !0,
706
- get() {
707
- return this.uniforms.resolution.value;
708
- },
709
- set(e) {
710
- this.uniforms.resolution.value.copy(e);
711
- }
712
- },
713
- sizeAttenuation: {
714
- enumerable: !0,
715
- get() {
716
- return this.uniforms.sizeAttenuation.value;
717
- },
718
- set(e) {
719
- this.uniforms.sizeAttenuation.value = e;
720
- }
721
- },
722
- dashArray: {
723
- enumerable: !0,
724
- get() {
725
- return this.uniforms.dashArray.value;
726
- },
727
- set(e) {
728
- this.uniforms.dashArray.value = e, this.useDash = e !== 0 ? 1 : 0;
729
- }
730
- },
731
- dashOffset: {
732
- enumerable: !0,
733
- get() {
734
- return this.uniforms.dashOffset.value;
735
- },
736
- set(e) {
737
- this.uniforms.dashOffset.value = e;
738
- }
739
- },
740
- dashRatio: {
741
- enumerable: !0,
742
- get() {
743
- return this.uniforms.dashRatio.value;
744
- },
745
- set(e) {
746
- this.uniforms.dashRatio.value = e;
747
- }
748
- },
749
- useDash: {
750
- enumerable: !0,
751
- get() {
752
- return this.uniforms.useDash.value;
753
- },
754
- set(e) {
755
- this.uniforms.useDash.value = e;
756
- }
757
- },
758
- useDepth: {
759
- enumerable: !0,
760
- get() {
761
- return this.uniforms.useDepth.value;
762
- },
763
- set(e) {
764
- this.uniforms.useDepth.value = e;
765
- }
766
- },
767
- visibility: {
768
- enumerable: !0,
769
- get() {
770
- return this.uniforms.visibility.value;
771
- },
772
- set(e) {
773
- this.uniforms.visibility.value = e;
774
- }
775
- },
776
- alphaTest: {
777
- enumerable: !0,
778
- get() {
779
- return this.uniforms.alphaTest.value;
780
- },
781
- set(e) {
782
- this.uniforms.alphaTest.value = e;
783
- }
784
- },
785
- repeat: {
786
- enumerable: !0,
787
- get() {
788
- return this.uniforms.repeat.value;
789
- },
790
- set(e) {
791
- this.uniforms.repeat.value.copy(e);
792
- }
793
- },
794
- lineLightAnimation: {
795
- enumerable: !0,
796
- get: function() {
797
- return this.uniforms.lineLightAnimation.value;
798
- },
799
- set: function(e) {
800
- this.uniforms.lineLightAnimation.value = e;
801
- }
802
- },
803
- time: {
804
- enumerable: !0,
805
- get: function() {
806
- return this.uniforms.time.value;
807
- },
808
- set: function(e) {
809
- this.uniforms.time.value = e;
810
- }
811
- },
812
- size: {
813
- enumerable: !0,
814
- get: function() {
815
- return this.uniforms.size.value;
816
- },
817
- set: function(e) {
818
- this.uniforms.size.value = e;
819
- }
820
- },
821
- speed: {
822
- enumerable: !0,
823
- get: function() {
824
- return this.uniforms.speed.value;
825
- },
826
- set: function(e) {
827
- this.uniforms.speed.value = e;
584
+
585
+ void main() {
586
+ float aspect = resolution.y / resolution.x;
587
+
588
+ mat4 m = projectionMatrix * modelViewMatrix;
589
+
590
+ vec4 currentClip = m * vec4( position, 1.0 );
591
+ vec4 prevClip = m * vec4( previous, 1.0 );
592
+ vec4 nextClip = m * vec4( next, 1.0 );
593
+
594
+ vec4 currentNormed = currentClip / currentClip.w;
595
+ vec4 prevNormed = prevClip / prevClip.w;
596
+ vec4 nextNormed = nextClip / nextClip.w;
597
+
598
+ vec2 currentScreen = intoScreen(currentNormed);
599
+ vec2 prevScreen = intoScreen(prevNormed);
600
+ vec2 nextScreen = intoScreen(nextNormed);
601
+
602
+ float actualWidth = lineWidth * width;
603
+
604
+ vec2 dir;
605
+ if(nextScreen == currentScreen) {
606
+ dir = normalize( currentScreen - prevScreen );
607
+ } else if(prevScreen == currentScreen) {
608
+ dir = normalize( nextScreen - currentScreen );
609
+ } else {
610
+ vec2 inDir = currentScreen - prevScreen;
611
+ vec2 outDir = nextScreen - currentScreen;
612
+ vec2 fullDir = nextScreen - prevScreen;
613
+
614
+ if(length(fullDir) > 0.0) {
615
+ dir = normalize(fullDir);
616
+ } else if(length(inDir) > 0.0){
617
+ dir = normalize(inDir);
618
+ } else {
619
+ dir = normalize(outDir);
620
+ }
828
621
  }
829
- },
830
- lightWidth: {
831
- enumerable: !0,
832
- get: function() {
833
- return this.uniforms.lightWidth.value;
834
- },
835
- set: function(e) {
836
- this.uniforms.lightWidth.value = e;
622
+
623
+ vec2 normal = vec2(-dir.y, dir.x);
624
+
625
+ if(sizeAttenuation != 0.0) {
626
+ normal /= currentClip.w;
627
+ normal *= min(resolution.x, resolution.y);
837
628
  }
838
- },
839
- uCenter: {
840
- enumerable: !0,
841
- get: function() {
842
- return this.uniforms.uCenter.value;
843
- },
844
- set: function(e) {
845
- this.uniforms.uCenter.value = e;
629
+
630
+ if (scaleDown > 0.0) {
631
+ float dist = length(nextNormed - prevNormed);
632
+ normal *= smoothstep(0.0, scaleDown, dist);
846
633
  }
634
+
635
+ vec2 offsetInScreen = actualWidth * normal * side * 0.5;
636
+
637
+ vec2 withOffsetScreen = currentScreen + offsetInScreen;
638
+ vec3 withOffsetNormed = vec3((2.0 * withOffsetScreen/resolution - 1.0), currentNormed.z);
639
+
640
+ vCounters = counters;
641
+ vColor = vec4( color, opacity );
642
+ vUV = uv;
643
+ vUV=uv+offset;
644
+
645
+ gl_Position = currentClip.w * vec4(withOffsetNormed, 1.0);
646
+
647
+ ${W.logdepthbuf_vertex}
648
+ ${W.fog_vertex}
649
+ }
650
+ `;
651
+ class Oe extends Ut {
652
+ constructor(t = {}) {
653
+ var j;
654
+ const S = t, {
655
+ lineWidth: e = 1,
656
+ color: i = "#ffffff",
657
+ map: s = null,
658
+ useMap: a = 0,
659
+ dashOffset: l = 0,
660
+ dashArray: o = 0,
661
+ dashRatio: c = 0,
662
+ sizeAttenuation: r = !0,
663
+ offsetLoop: h = !0,
664
+ offset: f = new K(0, 0),
665
+ scaleDown: p = 0,
666
+ alphaMap: u = void 0,
667
+ alphaTest: m = 0,
668
+ repeat: d = new K(1, 1),
669
+ resolution: v = new K(1, 1)
670
+ } = S, w = ot(S, [
671
+ "lineWidth",
672
+ "color",
673
+ "map",
674
+ "useMap",
675
+ "dashOffset",
676
+ "dashArray",
677
+ "dashRatio",
678
+ "sizeAttenuation",
679
+ "offsetLoop",
680
+ "offset",
681
+ "scaleDown",
682
+ "alphaMap",
683
+ "alphaTest",
684
+ "repeat",
685
+ "resolution"
686
+ ]);
687
+ super(q(E({}, w), {
688
+ uniforms: {
689
+ lineWidth: { value: e },
690
+ color: { value: new ft(i) },
691
+ opacity: { value: (j = t.opacity) != null ? j : 1 },
692
+ map: { value: s },
693
+ useMap: { value: s ? 1 : a },
694
+ resolution: { value: v },
695
+ sizeAttenuation: { value: r ? 1 : 0 },
696
+ offset: { value: f },
697
+ offsetLoop: { value: h ? 1 : 0 },
698
+ dashArray: { value: o },
699
+ dashOffset: { value: l },
700
+ dashRatio: { value: c },
701
+ useDash: { value: o > 0 ? 1 : 0 },
702
+ scaleDown: { value: p / 10 },
703
+ alphaTest: { value: m },
704
+ alphaMap: { value: u },
705
+ useAlphaMap: { value: u ? 1 : 0 },
706
+ repeat: { value: d }
847
707
  },
848
- lightColor: {
849
- enumerable: !0,
850
- get: function() {
851
- return this.uniforms.lightColor.value;
852
- },
853
- set: function(e) {
854
- e && (this.uniforms.lightColor.value = e);
855
- }
856
- }
857
- }), this.setValues(t);
708
+ vertexShader: fe,
709
+ fragmentShader: ue
710
+ })), this.type = "MeshLineMaterial";
858
711
  }
859
- copy(t) {
860
- return super.copy(t), this.lineWidth = t.lineWidth, this.map = t.map, this.useMap = t.useMap, this.alphaMap = t.alphaMap, this.useAlphaMap = t.useAlphaMap, this.color.copy(t.color), this.opacity = t.opacity, this.resolution.copy(t.resolution), this.sizeAttenuation = t.sizeAttenuation, this.dashArray = t.dashArray, this.dashOffset = t.dashOffset, this.dashRatio = t.dashRatio, this.useDash = t.useDash, this.visibility = t.visibility, this.alphaTest = t.alphaTest, this.repeat.copy(t.repeat), this;
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);
861
714
  }
862
715
  }
863
- function oe(a, t) {
864
- return a.map((e) => {
716
+ function de(n, t) {
717
+ return n.map((e) => {
865
718
  const i = [];
866
719
  let s;
867
- return e.forEach((r) => {
720
+ return e.forEach((a) => {
868
721
  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;
873
- for (; c < 1; )
874
- i.push(n(c)), c += l;
722
+ const l = Ft(a, s) * 180 / Math.PI;
723
+ 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;
875
728
  }
876
729
  }
877
- i.push(s = r);
730
+ i.push(s = a);
878
731
  }), i;
879
732
  });
880
733
  }
881
- 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 = [
883
- s !== void 0 ? Math.ceil(c(s)) : 0,
884
- i !== void 0 ? Math.floor(c(i)) : r - 1
885
- ], 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++) {
887
- const f = n(h);
888
- u(f) && m.push([f, l(h)]);
889
- }
890
- return m;
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 = [];
739
+ for (let u = h[0]; u <= h[1]; u++) {
740
+ const m = o(u);
741
+ f(m) && p.push([m, c(u)]);
742
+ }
743
+ return p;
891
744
  }
892
- function Y(a, t, e = !1) {
893
- return e ? Zt(t, a) : Jt(a, t);
745
+ function Z(n, t, e = !1) {
746
+ return e ? $t(t, n) : Ht(n, t);
894
747
  }
895
- 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)
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)
898
751
  return [];
899
- const n = i > r || o >= 89 || s <= -89;
900
- return le(t, {
752
+ const o = i > a || l >= 89 || s <= -89;
753
+ return he(t, {
901
754
  minLng: i,
902
- maxLng: r,
755
+ maxLng: a,
903
756
  minLat: s,
904
- maxLat: o
757
+ maxLat: l
905
758
  }).filter(
906
- (l) => Y(l, e, n)
759
+ (c) => Z(c, e, o)
907
760
  );
908
761
  }
909
- 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
911
- m >= 89 || // crosses north pole
912
- d <= -89;
913
- let f = [];
914
- if (h) {
915
- const v = te(n).triangles(), M = new Map(
916
- n.map(([j, A], L) => [`${j}-${A}`, L])
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
764
+ p >= 89 || // crosses north pole
765
+ h <= -89;
766
+ let m = [];
767
+ if (u) {
768
+ const y = te(o).triangles(), x = new Map(
769
+ o.map(([C, P], L) => [`${C}-${P}`, L])
917
770
  );
918
- 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));
771
+ y.features.forEach((C) => {
772
+ const P = C.geometry.coordinates[0].slice(0, 3).reverse(), L = [];
773
+ if (P.forEach(([I, F]) => {
774
+ const V = `${I}-${F}`;
775
+ x.has(V) && L.push(x.get(V));
923
776
  }), L.length === 3) {
924
- if (L.some((S) => S < r.length)) {
925
- const S = j.properties.circumcenter;
926
- if (!Y(
927
- S,
928
- l,
929
- h
777
+ if (L.some((I) => I < a.length)) {
778
+ const I = C.properties.circumcenter;
779
+ if (!Z(
780
+ I,
781
+ c,
782
+ u
930
783
  ))
931
784
  return;
932
785
  }
933
- f.push(...L);
786
+ m.push(...L);
934
787
  }
935
788
  });
936
- } else if (o.length) {
937
- const v = Ht.from(n);
938
- 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]);
940
- if (A.some((S) => S < r.length)) {
941
- const S = [0, 1].map(
942
- ($) => Kt(L, (k) => k[$])
789
+ } 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]);
793
+ if (P.some((I) => I < a.length)) {
794
+ const I = [0, 1].map(
795
+ (F) => Xt(L, (V) => V[F])
943
796
  );
944
- if (!Y(
945
- S,
946
- l,
947
- h
797
+ if (!Z(
798
+ I,
799
+ c,
800
+ u
948
801
  ))
949
802
  continue;
950
803
  }
951
- f.push(...A);
804
+ m.push(...P);
952
805
  }
953
806
  } else {
954
- const { vertices: v, holes: M = [] } = Pt(s);
955
- f = Xt(v, M, 2);
807
+ const { vertices: y, holes: x = [] } = Ct(s);
808
+ m = Yt(y, x, 2);
956
809
  }
957
- let p = e ? [e[0], e[2]] : ht(n, (v) => v[0]), g = e ? [e[1], e[3]] : ht(n, (v) => v[1]);
810
+ let d = e ? [e[0], e[2]] : ht(o, (y) => y[0]), v = e ? [e[1], e[3]] : ht(o, (y) => y[1]);
958
811
  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];
812
+ const [y, x] = i([d[0], v[0]]), [C, P] = i([d[1], v[1]]);
813
+ d = [y, C], v = [-x, -P];
961
814
  }
962
- const w = ft(p, [0, 1]), z = ft(g, [0, 1]), D = n.map(([v, M]) => {
815
+ const w = pt(d, [0, 1]), S = pt(v, [0, 1]), j = o.map(([y, x]) => {
963
816
  if (i) {
964
- const [j, A] = i([v, M]);
965
- return [w(j), z(-A)];
817
+ const [C, P] = i([y, x]);
818
+ return [w(C), S(-P)];
966
819
  } else
967
- return [w(v), z(M)];
820
+ return [w(y), S(x)];
968
821
  });
969
- return { contour: s, triangles: { points: n, indices: f, uvs: D } };
822
+ return { contour: s, triangles: { points: o, indices: m, uvs: j } };
970
823
  }
971
- const bt = new H().setAttribute ? "setAttribute" : "addAttribute";
972
- function Z(a, t, e, i) {
973
- const s = a.map(
974
- (r) => r.map(([o, n]) => {
824
+ const Mt = new J().setAttribute ? "setAttribute" : "addAttribute";
825
+ function $(n, t, e, i) {
826
+ const s = n.map(
827
+ (a) => a.map(([l, o]) => {
975
828
  if (i) {
976
- const [l, c] = i([o, n]);
977
- return [l, -c, t];
829
+ const [c, r] = i([l, o]);
830
+ return [c, -r, t];
978
831
  }
979
- return e ? Nt(o, n, t) : [o, n, t];
832
+ return e ? Kt(l, o, t) : [l, o, t];
980
833
  })
981
834
  );
982
- return Pt(s);
835
+ return Ct(s);
983
836
  }
984
- function he(a, t, e, i, s) {
985
- const { vertices: r, holes: o } = Z(
986
- a,
837
+ function ve(n, t, e, i, s) {
838
+ const { vertices: a, holes: l } = $(
839
+ n,
987
840
  t,
988
841
  i,
989
842
  s
990
- ), { vertices: n } = Z(
991
- a,
843
+ ), { vertices: o } = $(
844
+ n,
992
845
  e,
993
846
  i,
994
847
  s
995
- ), l = J([n, r]), c = Math.round(n.length / 3), d = new Set(o);
996
- let u = 0;
997
- const m = [];
998
- 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;
848
+ ), c = tt([o, a]), r = Math.round(o.length / 3), h = new Set(l);
849
+ let f = 0;
850
+ 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;
1005
858
  }
1006
- m.push(f, f + c, p + c), m.push(p + c, p, f);
859
+ p.push(m, m + r, d + r), p.push(d + r, d, m);
1007
860
  }
1008
- const h = [];
1009
- 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 };
861
+ const u = [];
862
+ 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 };
1012
865
  }
1013
- function yt(a, t, e, i, s, r) {
866
+ function xt(n, t, e, i, s, a) {
1014
867
  return {
1015
- indices: i ? a.indices : a.indices.slice().reverse(),
1016
- vertices: Z(
1017
- [a.points],
868
+ indices: i ? n.indices : n.indices.slice().reverse(),
869
+ vertices: $(
870
+ [n.points],
1018
871
  t,
1019
872
  s,
1020
- r
873
+ a
1021
874
  ).vertices,
1022
875
  uvs: e
1023
876
  };
1024
877
  }
1025
- const fe = ({
1026
- polygonGeoJson: a,
878
+ const ye = ({
879
+ polygonGeoJson: n,
1027
880
  startHeight: t,
1028
881
  endHeight: e,
1029
882
  curvatureResolution: i = 1,
1030
883
  cartesian: s = !0,
1031
- hasSide: r = !0,
1032
- hasBottom: o = !1,
1033
- hasTop: n = !1,
1034
- projection: l,
1035
- bbox: c
884
+ hasSide: a = !0,
885
+ hasBottom: l = !1,
886
+ hasTop: o = !1,
887
+ projection: c,
888
+ bbox: r
1036
889
  }) => {
1037
- a.forEach((w) => {
1038
- Yt(w) || w.reverse();
890
+ n.forEach((w) => {
891
+ Zt(w) || w.reverse();
1039
892
  });
1040
- const { contour: d, triangles: u } = ue(a, {
893
+ const { contour: h, triangles: f } = me(n, {
1041
894
  resolution: i,
1042
- bbox: c,
1043
- projection: l
895
+ bbox: r,
896
+ projection: c
1044
897
  });
1045
- let m = {}, h;
1046
- r && (m = he(
1047
- d,
898
+ let p = {}, u;
899
+ a && (p = ve(
900
+ h,
1048
901
  t != null ? t : e,
1049
902
  e != null ? e : t,
1050
903
  s,
1051
- l
1052
- ), h = m.topVerts);
1053
- let f = [];
1054
- (o || n) && (f = J(u.uvs));
1055
- let p = {};
1056
- o && (p = yt(
1057
- u,
1058
- t,
904
+ c
905
+ ), u = p.topVerts);
906
+ let m = [];
907
+ (l || o) && (m = tt(f.uvs));
908
+ let d = {};
909
+ l && (d = xt(
1059
910
  f,
911
+ t,
912
+ m,
1060
913
  !1,
1061
914
  s,
1062
- l
915
+ c
1063
916
  ));
1064
- let g = {};
1065
- return n && (g = yt(
1066
- u,
1067
- e,
917
+ let v = {};
918
+ return o && (v = xt(
1068
919
  f,
920
+ e,
921
+ m,
1069
922
  !0,
1070
923
  s,
1071
- l
1072
- )), { contour: d, triangles: u, sideTorso: m, bottomCap: p, topCap: g, topVerts: h };
924
+ c
925
+ )), { contour: h, triangles: f, sideTorso: p, bottomCap: d, topCap: v, topVerts: u };
1073
926
  };
1074
- class Be extends H {
927
+ class Ve extends J {
1075
928
  constructor(t, e = {}) {
1076
- super(), this.type = "PolygonBufferGeometry", this.parameters = _({
929
+ super(), this.type = "PolygonBufferGeometry", this.parameters = E({
1077
930
  polygonGeoJson: t,
1078
931
  startHeight: 0,
1079
932
  endHeight: 1,
@@ -1088,34 +941,35 @@ class Be extends H {
1088
941
  const {
1089
942
  endHeight: i,
1090
943
  hasTop: s,
1091
- topFirst: r,
1092
- hasBottom: o,
1093
- hasSide: n,
1094
- cartesian: l,
1095
- 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;
1099
- const P = (v) => {
1100
- const M = Math.round(g.length / 3), j = z.length;
1101
- g = g.concat(v.vertices), w = w.concat(v.uvs), z = z.concat(
1102
- M ? v.indices.map((A) => A + M) : v.indices
1103
- ), this.addGroup(j, z.length - j, D++);
944
+ topFirst: a,
945
+ hasBottom: l,
946
+ hasSide: o,
947
+ cartesian: c,
948
+ userDataRsoOffset: r,
949
+ projection: h
950
+ } = this.parameters, { contour: f, sideTorso: p, topVerts: u, bottomCap: m, topCap: d } = ye(E({}, this.parameters));
951
+ let v = [], w = [], S = [], j = 0;
952
+ const A = (y) => {
953
+ 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
956
+ ), this.addGroup(C, S.length - C, j++);
1104
957
  };
1105
- s && r && P(p), n && (P(m), this.userData.topVerts = c ? Z(
1106
- u,
1107
- 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();
958
+ s && a && A(d), o && (A(p), this.userData.topVerts = r ? $(
959
+ f,
960
+ i + r,
961
+ c,
962
+ 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();
1111
964
  }
1112
965
  }
1113
966
  export {
1114
- ie as B,
1115
- ze as G,
1116
- De as L,
1117
- Ie as M,
1118
- Be as P,
1119
- O as R,
1120
- fe as g
967
+ Le as B,
968
+ _e as I,
969
+ Ee as L,
970
+ Oe as M,
971
+ Ve as P,
972
+ se as R,
973
+ mt as a,
974
+ ye as g
1121
975
  };