gl-draw 0.14.41 → 0.15.0-beta.1

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,15 +1,15 @@
1
- var At = Object.defineProperty, jt = Object.defineProperties;
1
+ var jt = Object.defineProperty, At = Object.defineProperties;
2
2
  var St = Object.getOwnPropertyDescriptors;
3
3
  var tt = 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 ? At(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e, L = (a, t) => {
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) => {
6
6
  for (var e in t || (t = {}))
7
7
  Ct.call(t, e) && et(a, e, t[e]);
8
8
  if (tt)
9
9
  for (var e of tt(t))
10
10
  zt.call(t, e) && et(a, e, t[e]);
11
11
  return a;
12
- }, q = (a, t) => jt(a, St(t));
12
+ }, q = (a, t) => At(a, St(t));
13
13
  var st = (a, t, e) => new Promise((i, s) => {
14
14
  var r = (l) => {
15
15
  try {
@@ -26,7 +26,7 @@ var st = (a, t, e) => new Promise((i, s) => {
26
26
  }, n = (l) => l.done ? i(l.value) : Promise.resolve(l.value).then(r, o);
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 Tt, Sprite as at, Box3 as Mt, Vector3 as C, InstancedMesh as ot, Quaternion as Wt, Vector4 as V, Matrix4 as Bt, Line3 as _t, Sphere as Lt, 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 { 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
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
32
  import { geoBounds as wt, geoContains as Zt, geoDistance as $t, geoInterpolate as qt } from "d3-geo";
@@ -113,7 +113,7 @@ const ee = (a, t = 1) => {
113
113
  };
114
114
  class ie extends O {
115
115
  constructor() {
116
- super(...arguments), this.objectType = "BaseObject", this.userData = {}, this.prefab = !1, this.isInstantiate = !1, this.isBloom = !1, this.materialList = {}, this.useMaterialType = "origin", this.onPointerIndex = [];
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 = [];
117
117
  }
118
118
  get parent() {
119
119
  const t = this.object3d.parent;
@@ -171,7 +171,7 @@ class ie extends O {
171
171
  return this.object3d = new xt(...t), this;
172
172
  }
173
173
  createGroup() {
174
- return this.object3d = new Tt(), this;
174
+ return this.object3d = new Bt(), this;
175
175
  }
176
176
  createPoints(...t) {
177
177
  return this.object3d = new X(...t), this;
@@ -239,7 +239,7 @@ class ie extends O {
239
239
  u.object3d.userData.prefab && delete u.object3d.userData.prefab;
240
240
  }
241
241
  });
242
- const c = yield this.lead.draw(n, q(L({}, o || {}), {
242
+ const c = yield this.lead.draw(n, q(_({}, o || {}), {
243
243
  create: l,
244
244
  prefab: !1,
245
245
  key: (e == null ? void 0 : e.key) || (o == null ? void 0 : o.key),
@@ -258,7 +258,7 @@ class ie extends O {
258
258
  if (this.object3d instanceof ot || this.object3d.isInstantiate)
259
259
  this.object3d.setMatrixAt(t, e);
260
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 Wt(), d = t * 3, u = t * 1;
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
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
263
  }
264
264
  }
@@ -320,10 +320,7 @@ class ie extends O {
320
320
  var t;
321
321
  this.onPointerIndex.forEach((e) => {
322
322
  this.lead.removePick(e);
323
- }), (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
- disposeWithOutMaterial() {
326
- this.disposeWithMaterial = !1, this.dispose();
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();
327
324
  }
328
325
  }
329
326
  class ze extends ie {
@@ -331,20 +328,20 @@ class ze extends ie {
331
328
  this.createGroup();
332
329
  }
333
330
  }
334
- const N = new V(), dt = new C(), pt = new C(), b = new V(), y = new V(), I = new V(), Q = new C(), K = new Bt(), x = new _t(), mt = new C(), U = new Mt(), R = new Lt(), T = new V();
335
- let W, _;
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;
336
333
  function vt(a, t, e) {
337
- return T.set(0, 0, -t, 1).applyMatrix4(a.projectionMatrix), T.multiplyScalar(1 / T.w), T.x = _ / e.width, T.y = _ / e.height, T.applyMatrix4(a.projectionMatrixInverse), T.multiplyScalar(1 / T.w), Math.abs(Math.max(T.x, T.y));
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));
338
335
  }
339
336
  function se(a, t) {
340
337
  const e = a.matrixWorld, i = a.geometry, s = i.attributes.instanceStart, r = i.attributes.instanceEnd, o = Math.min(i.instanceCount, s.count);
341
338
  for (let n = 0, l = o; n < l; n++) {
342
339
  x.start.fromBufferAttribute(s, n), x.end.fromBufferAttribute(r, n), x.applyMatrix4(e);
343
340
  const c = new C(), d = new C();
344
- W.distanceSqToSegment(x.start, x.end, d, c), d.distanceTo(c) < _ * 0.5 && t.push({
341
+ T.distanceSqToSegment(x.start, x.end, d, c), d.distanceTo(c) < W * 0.5 && t.push({
345
342
  point: d,
346
343
  pointOnLine: c,
347
- distance: W.origin.distanceTo(d),
344
+ distance: T.origin.distanceTo(d),
348
345
  object: a,
349
346
  face: null,
350
347
  faceIndex: n,
@@ -355,7 +352,7 @@ function se(a, t) {
355
352
  }
356
353
  function ne(a, t, e) {
357
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;
358
- W.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);
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);
359
356
  for (let m = 0, h = d; m < h; m++) {
360
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)
361
358
  continue;
@@ -369,14 +366,14 @@ function ne(a, t, e) {
369
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;
370
367
  const p = x.closestPointToPointParameter(Q, !0);
371
368
  x.at(p, mt);
372
- const g = Vt.lerp(b.z, y.z, p), w = g >= -1 && g <= 1, z = Q.distanceTo(mt) < _ * 0.5;
369
+ const g = Vt.lerp(b.z, y.z, p), w = g >= -1 && g <= 1, z = Q.distanceTo(mt) < W * 0.5;
373
370
  if (w && z) {
374
371
  x.start.fromBufferAttribute(l, m), x.end.fromBufferAttribute(c, m), x.start.applyMatrix4(o), x.end.applyMatrix4(o);
375
372
  const D = new C(), P = new C();
376
- W.distanceSqToSegment(x.start, x.end, P, D), e.push({
373
+ T.distanceSqToSegment(x.start, x.end, P, D), e.push({
377
374
  point: P,
378
375
  pointOnLine: D,
379
- distance: W.origin.distanceTo(P),
376
+ distance: T.origin.distanceTo(P),
380
377
  object: a,
381
378
  face: null,
382
379
  faceIndex: m,
@@ -414,16 +411,16 @@ class De extends xt {
414
411
  'LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'
415
412
  );
416
413
  const r = t.params.Line2 !== void 0 && t.params.Line2.threshold || 0;
417
- W = t.ray;
414
+ T = t.ray;
418
415
  const o = this.matrixWorld, n = this.geometry, l = this.material;
419
- _ = l.linewidth + r, n.boundingSphere === null && n.computeBoundingSphere(), R.copy(n.boundingSphere).applyMatrix4(o);
416
+ W = l.linewidth + r, n.boundingSphere === null && n.computeBoundingSphere(), R.copy(n.boundingSphere).applyMatrix4(o);
420
417
  let c;
421
418
  if (i)
422
- c = _ * 0.5;
419
+ c = W * 0.5;
423
420
  else {
424
421
  const u = Math.max(
425
422
  s.near,
426
- R.distanceToPoint(W.origin)
423
+ R.distanceToPoint(T.origin)
427
424
  );
428
425
  c = vt(
429
426
  s,
@@ -431,16 +428,16 @@ class De extends xt {
431
428
  l.resolution
432
429
  );
433
430
  }
434
- if (R.radius += c, W.intersectsSphere(R) === !1)
431
+ if (R.radius += c, T.intersectsSphere(R) === !1)
435
432
  return;
436
433
  n.boundingBox === null && n.computeBoundingBox(), U.copy(n.boundingBox).applyMatrix4(o);
437
434
  let d;
438
435
  if (i)
439
- d = _ * 0.5;
436
+ d = W * 0.5;
440
437
  else {
441
438
  const u = Math.max(
442
439
  s.near,
443
- U.distanceToPoint(W.origin)
440
+ U.distanceToPoint(T.origin)
444
441
  );
445
442
  d = vt(
446
443
  s,
@@ -448,7 +445,7 @@ class De extends xt {
448
445
  l.resolution
449
446
  );
450
447
  }
451
- U.expandByScalar(d), W.intersectsBox(U) !== !1 && (i ? se(this, e) : ne(this, s, e));
448
+ U.expandByScalar(d), T.intersectsBox(U) !== !1 && (i ? se(this, e) : ne(this, s, e));
452
449
  }
453
450
  onBeforeRender(t) {
454
451
  const e = this.material.uniforms;
@@ -610,7 +607,7 @@ const gt = ["encodings_fragment", "colorspace_fragment"], re = (
610
607
  class Ie extends kt {
611
608
  constructor(t) {
612
609
  super({
613
- uniforms: q(L({}, Et.fog), {
610
+ uniforms: q(_({}, Et.fog), {
614
611
  lineWidth: { value: 1 },
615
612
  map: { value: null },
616
613
  useMap: { value: 0 },
@@ -916,16 +913,16 @@ function ue(a, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
916
913
  let f = [];
917
914
  if (h) {
918
915
  const v = te(n).triangles(), M = new Map(
919
- n.map(([A, j], B) => [`${A}-${j}`, B])
916
+ n.map(([j, A], L) => [`${j}-${A}`, L])
920
917
  );
921
- v.features.forEach((A) => {
922
- const j = A.geometry.coordinates[0].slice(0, 3).reverse(), B = [];
923
- if (j.forEach(([S, $]) => {
918
+ v.features.forEach((j) => {
919
+ const A = j.geometry.coordinates[0].slice(0, 3).reverse(), L = [];
920
+ if (A.forEach(([S, $]) => {
924
921
  const k = `${S}-${$}`;
925
- M.has(k) && B.push(M.get(k));
926
- }), B.length === 3) {
927
- if (B.some((S) => S < r.length)) {
928
- const S = A.properties.circumcenter;
922
+ M.has(k) && L.push(M.get(k));
923
+ }), L.length === 3) {
924
+ if (L.some((S) => S < r.length)) {
925
+ const S = j.properties.circumcenter;
929
926
  if (!Y(
930
927
  S,
931
928
  l,
@@ -933,16 +930,16 @@ function ue(a, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
933
930
  ))
934
931
  return;
935
932
  }
936
- f.push(...B);
933
+ f.push(...L);
937
934
  }
938
935
  });
939
936
  } else if (o.length) {
940
937
  const v = Ht.from(n);
941
- for (let M = 0, A = v.triangles.length; M < A; M += 3) {
942
- const j = [2, 1, 0].map((S) => v.triangles[M + S]), B = j.map((S) => n[S]);
943
- if (j.some((S) => S < r.length)) {
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)) {
944
941
  const S = [0, 1].map(
945
- ($) => Kt(B, (k) => k[$])
942
+ ($) => Kt(L, (k) => k[$])
946
943
  );
947
944
  if (!Y(
948
945
  S,
@@ -951,7 +948,7 @@ function ue(a, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
951
948
  ))
952
949
  continue;
953
950
  }
954
- f.push(...j);
951
+ f.push(...A);
955
952
  }
956
953
  } else {
957
954
  const { vertices: v, holes: M = [] } = Pt(s);
@@ -959,13 +956,13 @@ function ue(a, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
959
956
  }
960
957
  let p = e ? [e[0], e[2]] : ht(n, (v) => v[0]), g = e ? [e[1], e[3]] : ht(n, (v) => v[1]);
961
958
  if (i) {
962
- const [v, M] = i([p[0], g[0]]), [A, j] = i([p[1], g[1]]);
963
- p = [v, A], g = [-M, -j];
959
+ const [v, M] = i([p[0], g[0]]), [j, A] = i([p[1], g[1]]);
960
+ p = [v, j], g = [-M, -A];
964
961
  }
965
962
  const w = ft(p, [0, 1]), z = ft(g, [0, 1]), D = n.map(([v, M]) => {
966
963
  if (i) {
967
- const [A, j] = i([v, M]);
968
- return [w(A), z(-j)];
964
+ const [j, A] = i([v, M]);
965
+ return [w(j), z(-A)];
969
966
  } else
970
967
  return [w(v), z(M)];
971
968
  });
@@ -1074,9 +1071,9 @@ const fe = ({
1074
1071
  l
1075
1072
  )), { contour: d, triangles: u, sideTorso: m, bottomCap: p, topCap: g, topVerts: h };
1076
1073
  };
1077
- class Te extends H {
1074
+ class Be extends H {
1078
1075
  constructor(t, e = {}) {
1079
- super(), this.type = "PolygonBufferGeometry", this.parameters = L({
1076
+ super(), this.type = "PolygonBufferGeometry", this.parameters = _({
1080
1077
  polygonGeoJson: t,
1081
1078
  startHeight: 0,
1082
1079
  endHeight: 1,
@@ -1097,13 +1094,13 @@ class Te extends H {
1097
1094
  cartesian: l,
1098
1095
  userDataRsoOffset: c,
1099
1096
  projection: d
1100
- } = this.parameters, { contour: u, sideTorso: m, topVerts: h, bottomCap: f, topCap: p } = fe(L({}, this.parameters));
1097
+ } = this.parameters, { contour: u, sideTorso: m, topVerts: h, bottomCap: f, topCap: p } = fe(_({}, this.parameters));
1101
1098
  let g = [], w = [], z = [], D = 0;
1102
1099
  const P = (v) => {
1103
- const M = Math.round(g.length / 3), A = z.length;
1100
+ const M = Math.round(g.length / 3), j = z.length;
1104
1101
  g = g.concat(v.vertices), w = w.concat(v.uvs), z = z.concat(
1105
- M ? v.indices.map((j) => j + M) : v.indices
1106
- ), this.addGroup(A, z.length - A, D++);
1102
+ M ? v.indices.map((A) => A + M) : v.indices
1103
+ ), this.addGroup(j, z.length - j, D++);
1107
1104
  };
1108
1105
  s && r && P(p), n && (P(m), this.userData.topVerts = c ? Z(
1109
1106
  u,
@@ -1118,7 +1115,7 @@ export {
1118
1115
  ze as G,
1119
1116
  De as L,
1120
1117
  Ie as M,
1121
- Te as P,
1118
+ Be as P,
1122
1119
  O as R,
1123
1120
  fe as g
1124
1121
  };
package/dist/index2.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";var ft=Object.defineProperty,dt=Object.defineProperties;var pt=Object.getOwnPropertyDescriptors;var Y=Object.getOwnPropertySymbols;var mt=Object.prototype.hasOwnProperty,vt=Object.prototype.propertyIsEnumerable;var J=Math.pow,H=(o,t,e)=>t in o?ft(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,O=(o,t)=>{for(var e in t||(t={}))mt.call(t,e)&&H(o,e,t[e]);if(Y)for(var e of Y(t))vt.call(t,e)&&H(o,e,t[e]);return o},F=(o,t)=>dt(o,pt(t));var tt=(o,t,e)=>new Promise((i,s)=>{var a=c=>{try{r(e.next(c))}catch(u){s(u)}},l=c=>{try{r(e.throw(c))}catch(u){s(u)}},r=c=>c.done?i(c.value):Promise.resolve(c.value).then(a,l);r((e=e.apply(o,t)).next())});const n=require("three"),gt=require("three/examples/jsm/renderers/CSS2DRenderer"),et=require("three/examples/jsm/renderers/CSS3DRenderer"),k=require("d3-geo");require("d3-geo-projection");const Q=require("./parseVector.js"),bt=require("three/examples/jsm/lines/LineSegmentsGeometry"),W=require("d3-array"),K=require("earcut"),yt=require("@turf/boolean-clockwise"),xt=require("delaunator"),Mt=require("@turf/boolean-point-in-polygon"),wt=require("d3-geo-voronoi"),it=require("d3-scale");class _{constructor(){this.resources=new Set,this.disposeWithMaterial=!0,this.disposeVideo=!0,this.materialList={},this.disposeTrack=!0}track(t){if(!t||this.disposeTrack===!1)return t;if(Array.isArray(t))return t.forEach(e=>this.track(e)),t;if(!this.disposeWithMaterial&&t instanceof n.Material)return t;if(t instanceof _?(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 n.Object3D||Reflect.has(t,"dispose"))&&this.resources.add(t),t instanceof _)this.track(t.children);else if(t instanceof n.Object3D){const e=t;this.track(e.geometry),this.track(e.material),this.track(e.children)}else if(t instanceof n.Material){for(const i of Object.values(t))i instanceof n.Texture&&this.track(i);const e=t;if(e.uniforms){for(const i of Object.values(e.uniforms))if(i){const s=i.value;(s instanceof n.Texture||Array.isArray(s))&&this.track(s)}}}else this.disposeVideo&&t instanceof n.VideoTexture&&t.source.data&&this.resources.add(t.source.data);return t}dispose(){const t=[];for(const e of this.resources)e instanceof n.Object3D?t.push(e):e instanceof HTMLVideoElement&&e.pause(),Reflect.has(e,"dispose")&&e.dispose();t.forEach(e=>{e.removeFromParent()}),t.length=0,this.resources.clear()}}const Pt=(o,t=1)=>{const e=new n.BufferGeometry;e.setAttribute("position",new n.Float32BufferAttribute(new Array(t*3).fill(0),3)),e.setAttribute("scaleAtt",new n.Float32BufferAttribute(new Array(t).fill(1),1));const i=o.material,s=new n.PointsMaterial({size:10,map:i.map,alphaMap:i.alphaMap,color:i.color,blending:i.blending,depthTest:i.depthTest,depthWrite:!1,opacity:i.opacity,transparent:!0,alphaTest:i.alphaTest,sizeAttenuation:!1});return s.onBeforeCompile=a=>{a.vertexShader=`
2
2
  attribute float scaleAtt;
3
3
  ${a.vertexShader.replace("gl_PointSize = size;","gl_PointSize = size * scaleAtt;")}
4
- `},new n.Points(e,s)};class ut extends _{constructor(){super(...arguments),this.objectType="BaseObject",this.userData={},this.prefab=!1,this.isInstantiate=!1,this.isBloom=!1,this.materialList={},this.useMaterialType="origin",this.onPointerIndex=[]}get parent(){const t=this.object3d.parent;return t&&this.lead.objMap.get(t)||null}get children(){return this.object3d.children.map(t=>this.lead.objMap.get(t)).filter(t=>!!t)}get position(){return this.object3d.position}get rotation(){return this.object3d.rotation}get scale(){return this.object3d.scale}get add(){return this.object3d.add.bind(this.object3d)}get remove(){return this.object3d.remove.bind(this.object3d)}get visible(){return this.object3d.visible}get visibleWithAncestors(){if(this.visible){let t=this.parent;for(;t;){if(!t.visible)return!1;t=t.parent}return!0}else return!1}create(){this.createGroup()}render(){}update(t,e){}resize(t,e){}show(){return this.object3d.visible=!0,this}hide(){return this.object3d.visible=!1,this}createMesh(...t){return this.object3d=new n.Mesh(...t),this}createGroup(){return this.object3d=new n.Group,this}createPoints(...t){return this.object3d=new n.Points(...t),this}createCSS2DObject(t){return this.object3d=new gt.CSS2DObject(t),this}createCSS3DObject(t){return this.object3d=new et.CSS3DObject(t),this}createCSS3DSprite(t){return this.object3d=new et.CSS3DSprite(t),this}createSprite(t){return this.object3d=new n.Sprite(t),this}attach(...t){return[...t].forEach(e=>{this.object3d.attach(e.object3d)}),this}getSize(){const t=new n.Box3().setFromObject(this.object3d);return{min:t.min,max:t.max,size:t.getSize(new n.Vector3),center:t.getCenter(new n.Vector3)}}traverse(t){t(this),this.children.forEach(e=>{e.traverse(t)})}clone(){return this.instantiate()}instantiate(t,e){return tt(this,null,function*(){var p;const i=t&&t.length>0,s=(p=e==null?void 0:e.recursive)!=null?p:!0,{objectType:a,objectOptions:l}=this,[,r]=a.split("#");let c=e==null?void 0:e.create;c===void 0&&(c=h=>{if(this.object3d){if(i){const v=t.length;if(this.object3d instanceof n.Sprite)h.object3d=Pt(this.object3d,v);else{const d=this.object3d;h.object3d=new n.InstancedMesh(d.geometry,d.material,v),h.setMaterialList("instantiate","clone"),h.useMaterial("instantiate")}const f=new n.Object3D;t.forEach((d,m)=>{const b=Q.parseVector3(d.position),P=Q.parseVector3(d.scale||[1,1,1]);f.position.copy(b),f.scale.copy(P),f.updateMatrix(),h.setInstancedMatrix(m,f.matrix.clone())})}else h.object3d=this.object3d.clone(!1),h.setMaterialList("instantiate","clone"),h.useMaterial("instantiate");h.object3d.userData.prefab&&delete h.object3d.userData.prefab}});const u=yield this.lead.draw(r,F(O({},l||{}),{create:c,prefab:!1,key:(e==null?void 0:e.key)||(l==null?void 0:l.key),target:(e==null?void 0:e.target)||(l==null?void 0:l.target)}));return this.isBloom&&u.enableBloom(),s&&(yield Promise.all(this.children.map(h=>h.instantiate(void 0,{target:u})))),u.isInstantiate=!0,u})}setInstancedMatrix(t,e){if(this.object3d instanceof n.InstancedMesh||this.object3d.isInstantiate)this.object3d.setMatrixAt(t,e);else if(this.object3d instanceof n.Points||this.object3d.type==="Points"){const s=this.object3d.geometry,a=s.attributes.position.array,l=s.attributes.scaleAtt.array,r=new n.Vector3,c=new n.Vector3,u=new n.Quaternion,p=t*3,h=t*1;e.decompose(r,u,c),a[p]=r.x,a[p+1]=r.y,a[p+2]=r.z,l[h]=Math.max(c.x,c.y,c.z),s.attributes.position.needsUpdate=!0,s.attributes.scaleAtt.needsUpdate=!0}}erase(){this.lead.erase(this)}cloneMaterial(){const t=this.object3d;if(!t||!t.material)return;const e=t.material;if(Array.isArray(e))return e.map(i=>{const s=i.userData;i.userData={};const a=i.clone();return i.userData=s,a});{const i=e.userData;e.userData={};const s=e.clone();return e.userData=i,s}}setMaterialList(t,e,i=!0){const s=this.object3d;if(!s||!s.material)return;if(this.materialList.origin||(this.materialList.origin=s.material),this.materialList[t])if(i){const l=this.materialList[t],r=new _;r.track(l),r.dispose()}else return this.materialList[t];const a=e==="clone"?this.cloneMaterial():e;return this.materialList[t]=a,a}useMaterial(t){const e=this.object3d;!e||!e.material||this.useMaterialType===t||!this.materialList[t]||(this.useMaterialType=t,e.material=this.materialList[t])}setTop(t){this.object3d&&(this.object3d.renderOrder=t)}onPointerEvent(t,e){const i=this.lead.handlePick([this],t,e);this.onPointerIndex.push(i)}enableBloom(){var t;(t=this.pencil.composerController)==null||t.setBloomSelection(this,!0),this.isBloom=!0}disableBloom(){var t;(t=this.pencil.composerController)==null||t.setBloomSelection(this,!1),this.isBloom=!1}dispose(){var t;this.onPointerIndex.forEach(e=>{this.lead.removePick(e)}),(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()}disposeWithOutMaterial(){this.disposeWithMaterial=!1,this.dispose()}}class At extends ut{create(){this.createGroup()}}const Z=new n.Vector4,st=new n.Vector3,rt=new n.Vector3,y=new n.Vector4,x=new n.Vector4,z=new n.Vector4,$=new n.Vector3,N=new n.Matrix4,M=new n.Line3,nt=new n.Vector3,R=new n.Box3,E=new n.Sphere,B=new n.Vector4;let I,L;function at(o,t,e){return B.set(0,0,-t,1).applyMatrix4(o.projectionMatrix),B.multiplyScalar(1/B.w),B.x=L/e.width,B.y=L/e.height,B.applyMatrix4(o.projectionMatrixInverse),B.multiplyScalar(1/B.w),Math.abs(Math.max(B.x,B.y))}function St(o,t){const e=o.matrixWorld,i=o.geometry,s=i.attributes.instanceStart,a=i.attributes.instanceEnd,l=Math.min(i.instanceCount,s.count);for(let r=0,c=l;r<c;r++){M.start.fromBufferAttribute(s,r),M.end.fromBufferAttribute(a,r),M.applyMatrix4(e);const u=new n.Vector3,p=new n.Vector3;I.distanceSqToSegment(M.start,M.end,p,u),p.distanceTo(u)<L*.5&&t.push({point:p,pointOnLine:u,distance:I.origin.distanceTo(p),object:o,face:null,faceIndex:r,uv:null,uv1:null})}}function jt(o,t,e){const i=t.projectionMatrix,a=o.material.resolution,l=o.matrixWorld,r=o.geometry,c=r.attributes.instanceStart,u=r.attributes.instanceEnd,p=Math.min(r.instanceCount,c.count),h=-t.near;I.at(1,z),z.w=1,z.applyMatrix4(t.matrixWorldInverse),z.applyMatrix4(i),z.multiplyScalar(1/z.w),z.x*=a.x/2,z.y*=a.y/2,z.z=0,$.copy(z),N.multiplyMatrices(t.matrixWorldInverse,l);for(let v=0,f=p;v<f;v++){if(y.fromBufferAttribute(c,v),x.fromBufferAttribute(u,v),y.w=1,x.w=1,y.applyMatrix4(N),x.applyMatrix4(N),y.z>h&&x.z>h)continue;if(y.z>h){const D=y.z-x.z,A=(y.z-h)/D;y.lerp(x,A)}else if(x.z>h){const D=x.z-y.z,A=(x.z-h)/D;x.lerp(y,A)}y.applyMatrix4(i),x.applyMatrix4(i),y.multiplyScalar(1/y.w),x.multiplyScalar(1/x.w),y.x*=a.x/2,y.y*=a.y/2,x.x*=a.x/2,x.y*=a.y/2,M.start.copy(y),M.start.z=0,M.end.copy(x),M.end.z=0;const m=M.closestPointToPointParameter($,!0);M.at(m,nt);const b=n.MathUtils.lerp(y.z,x.z,m),P=b>=-1&&b<=1,V=$.distanceTo(nt)<L*.5;if(P&&V){M.start.fromBufferAttribute(c,v),M.end.fromBufferAttribute(u,v),M.start.applyMatrix4(l),M.end.applyMatrix4(l);const D=new n.Vector3,A=new n.Vector3;I.distanceSqToSegment(M.start,M.end,A,D),e.push({point:A,pointOnLine:D,distance:I.origin.distanceTo(A),object:o,face:null,faceIndex:v,uv:null,uv1:null})}}}class Ct extends n.Mesh{constructor(t=new bt.LineSegmentsGeometry,e){super(t,e),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const t=this.geometry,e=t.attributes.instanceStart,i=t.attributes.instanceEnd,s=new Float32Array(2*e.count);for(let l=0,r=0,c=e.count;l<c;l++,r+=2)st.fromBufferAttribute(e,l),rt.fromBufferAttribute(i,l),s[r]=r===0?0:s[r-1],s[r+1]=s[r]+st.distanceTo(rt);const a=new n.InstancedInterleavedBuffer(s,2,1);return t.setAttribute("instanceDistanceStart",new n.InterleavedBufferAttribute(a,1,0)),t.setAttribute("instanceDistanceEnd",new n.InterleavedBufferAttribute(a,1,1)),this}raycast(t,e){const i=this.material.worldUnits,s=t.camera;s===null&&!i&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const a=t.params.Line2!==void 0&&t.params.Line2.threshold||0;I=t.ray;const l=this.matrixWorld,r=this.geometry,c=this.material;L=c.linewidth+a,r.boundingSphere===null&&r.computeBoundingSphere(),E.copy(r.boundingSphere).applyMatrix4(l);let u;if(i)u=L*.5;else{const h=Math.max(s.near,E.distanceToPoint(I.origin));u=at(s,h,c.resolution)}if(E.radius+=u,I.intersectsSphere(E)===!1)return;r.boundingBox===null&&r.computeBoundingBox(),R.copy(r.boundingBox).applyMatrix4(l);let p;if(i)p=L*.5;else{const h=Math.max(s.near,R.distanceToPoint(I.origin));p=at(s,h,c.resolution)}R.expandByScalar(p),I.intersectsBox(R)!==!1&&(i?St(this,e):jt(this,s,e))}onBeforeRender(t){const e=this.material.uniforms;e&&e.resolution&&(t.getViewport(Z),this.material.uniforms.resolution.value.set(Z.z,Z.w))}}const ot=["encodings_fragment","colorspace_fragment"],Vt=`
4
+ `},new n.Points(e,s)};class ut extends _{constructor(){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=[]}get parent(){const t=this.object3d.parent;return t&&this.lead.objMap.get(t)||null}get children(){return this.object3d.children.map(t=>this.lead.objMap.get(t)).filter(t=>!!t)}get position(){return this.object3d.position}get rotation(){return this.object3d.rotation}get scale(){return this.object3d.scale}get add(){return this.object3d.add.bind(this.object3d)}get remove(){return this.object3d.remove.bind(this.object3d)}get visible(){return this.object3d.visible}get visibleWithAncestors(){if(this.visible){let t=this.parent;for(;t;){if(!t.visible)return!1;t=t.parent}return!0}else return!1}create(){this.createGroup()}render(){}update(t,e){}resize(t,e){}show(){return this.object3d.visible=!0,this}hide(){return this.object3d.visible=!1,this}createMesh(...t){return this.object3d=new n.Mesh(...t),this}createGroup(){return this.object3d=new n.Group,this}createPoints(...t){return this.object3d=new n.Points(...t),this}createCSS2DObject(t){return this.object3d=new gt.CSS2DObject(t),this}createCSS3DObject(t){return this.object3d=new et.CSS3DObject(t),this}createCSS3DSprite(t){return this.object3d=new et.CSS3DSprite(t),this}createSprite(t){return this.object3d=new n.Sprite(t),this}attach(...t){return[...t].forEach(e=>{this.object3d.attach(e.object3d)}),this}getSize(){const t=new n.Box3().setFromObject(this.object3d);return{min:t.min,max:t.max,size:t.getSize(new n.Vector3),center:t.getCenter(new n.Vector3)}}traverse(t){t(this),this.children.forEach(e=>{e.traverse(t)})}clone(){return this.instantiate()}instantiate(t,e){return tt(this,null,function*(){var p;const i=t&&t.length>0,s=(p=e==null?void 0:e.recursive)!=null?p:!0,{objectType:a,objectOptions:l}=this,[,r]=a.split("#");let c=e==null?void 0:e.create;c===void 0&&(c=h=>{if(this.object3d){if(i){const v=t.length;if(this.object3d instanceof n.Sprite)h.object3d=Pt(this.object3d,v);else{const d=this.object3d;h.object3d=new n.InstancedMesh(d.geometry,d.material,v),h.setMaterialList("instantiate","clone"),h.useMaterial("instantiate")}const f=new n.Object3D;t.forEach((d,m)=>{const b=Q.parseVector3(d.position),P=Q.parseVector3(d.scale||[1,1,1]);f.position.copy(b),f.scale.copy(P),f.updateMatrix(),h.setInstancedMatrix(m,f.matrix.clone())})}else h.object3d=this.object3d.clone(!1),h.setMaterialList("instantiate","clone"),h.useMaterial("instantiate");h.object3d.userData.prefab&&delete h.object3d.userData.prefab}});const u=yield this.lead.draw(r,F(O({},l||{}),{create:c,prefab:!1,key:(e==null?void 0:e.key)||(l==null?void 0:l.key),target:(e==null?void 0:e.target)||(l==null?void 0:l.target)}));return this.isBloom&&u.enableBloom(),s&&(yield Promise.all(this.children.map(h=>h.instantiate(void 0,{target:u})))),u.isInstantiate=!0,u})}setInstancedMatrix(t,e){if(this.object3d instanceof n.InstancedMesh||this.object3d.isInstantiate)this.object3d.setMatrixAt(t,e);else if(this.object3d instanceof n.Points||this.object3d.type==="Points"){const s=this.object3d.geometry,a=s.attributes.position.array,l=s.attributes.scaleAtt.array,r=new n.Vector3,c=new n.Vector3,u=new n.Quaternion,p=t*3,h=t*1;e.decompose(r,u,c),a[p]=r.x,a[p+1]=r.y,a[p+2]=r.z,l[h]=Math.max(c.x,c.y,c.z),s.attributes.position.needsUpdate=!0,s.attributes.scaleAtt.needsUpdate=!0}}erase(){this.lead.erase(this)}cloneMaterial(){const t=this.object3d;if(!t||!t.material)return;const e=t.material;if(Array.isArray(e))return e.map(i=>{const s=i.userData;i.userData={};const a=i.clone();return i.userData=s,a});{const i=e.userData;e.userData={};const s=e.clone();return e.userData=i,s}}setMaterialList(t,e,i=!0){const s=this.object3d;if(!s||!s.material)return;if(this.materialList.origin||(this.materialList.origin=s.material),this.materialList[t])if(i){const l=this.materialList[t],r=new _;r.track(l),r.dispose()}else return this.materialList[t];const a=e==="clone"?this.cloneMaterial():e;return this.materialList[t]=a,a}useMaterial(t){const e=this.object3d;!e||!e.material||this.useMaterialType===t||!this.materialList[t]||(this.useMaterialType=t,e.material=this.materialList[t])}setTop(t){this.object3d&&(this.object3d.renderOrder=t)}onPointerEvent(t,e){const i=this.lead.handlePick([this],t,e);this.onPointerIndex.push(i)}enableBloom(){var t;(t=this.pencil.composerController)==null||t.setBloomSelection(this,!0),this.isBloom=!0}disableBloom(){var t;(t=this.pencil.composerController)==null||t.setBloomSelection(this,!1),this.isBloom=!1}dispose(){var t;this.onPointerIndex.forEach(e=>{this.lead.removePick(e)}),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()}}class At extends ut{create(){this.createGroup()}}const Z=new n.Vector4,st=new n.Vector3,rt=new n.Vector3,y=new n.Vector4,x=new n.Vector4,D=new n.Vector4,$=new n.Vector3,N=new n.Matrix4,M=new n.Line3,nt=new n.Vector3,R=new n.Box3,E=new n.Sphere,z=new n.Vector4;let I,T;function at(o,t,e){return z.set(0,0,-t,1).applyMatrix4(o.projectionMatrix),z.multiplyScalar(1/z.w),z.x=T/e.width,z.y=T/e.height,z.applyMatrix4(o.projectionMatrixInverse),z.multiplyScalar(1/z.w),Math.abs(Math.max(z.x,z.y))}function St(o,t){const e=o.matrixWorld,i=o.geometry,s=i.attributes.instanceStart,a=i.attributes.instanceEnd,l=Math.min(i.instanceCount,s.count);for(let r=0,c=l;r<c;r++){M.start.fromBufferAttribute(s,r),M.end.fromBufferAttribute(a,r),M.applyMatrix4(e);const u=new n.Vector3,p=new n.Vector3;I.distanceSqToSegment(M.start,M.end,p,u),p.distanceTo(u)<T*.5&&t.push({point:p,pointOnLine:u,distance:I.origin.distanceTo(p),object:o,face:null,faceIndex:r,uv:null,uv1:null})}}function jt(o,t,e){const i=t.projectionMatrix,a=o.material.resolution,l=o.matrixWorld,r=o.geometry,c=r.attributes.instanceStart,u=r.attributes.instanceEnd,p=Math.min(r.instanceCount,c.count),h=-t.near;I.at(1,D),D.w=1,D.applyMatrix4(t.matrixWorldInverse),D.applyMatrix4(i),D.multiplyScalar(1/D.w),D.x*=a.x/2,D.y*=a.y/2,D.z=0,$.copy(D),N.multiplyMatrices(t.matrixWorldInverse,l);for(let v=0,f=p;v<f;v++){if(y.fromBufferAttribute(c,v),x.fromBufferAttribute(u,v),y.w=1,x.w=1,y.applyMatrix4(N),x.applyMatrix4(N),y.z>h&&x.z>h)continue;if(y.z>h){const B=y.z-x.z,A=(y.z-h)/B;y.lerp(x,A)}else if(x.z>h){const B=x.z-y.z,A=(x.z-h)/B;x.lerp(y,A)}y.applyMatrix4(i),x.applyMatrix4(i),y.multiplyScalar(1/y.w),x.multiplyScalar(1/x.w),y.x*=a.x/2,y.y*=a.y/2,x.x*=a.x/2,x.y*=a.y/2,M.start.copy(y),M.start.z=0,M.end.copy(x),M.end.z=0;const m=M.closestPointToPointParameter($,!0);M.at(m,nt);const b=n.MathUtils.lerp(y.z,x.z,m),P=b>=-1&&b<=1,V=$.distanceTo(nt)<T*.5;if(P&&V){M.start.fromBufferAttribute(c,v),M.end.fromBufferAttribute(u,v),M.start.applyMatrix4(l),M.end.applyMatrix4(l);const B=new n.Vector3,A=new n.Vector3;I.distanceSqToSegment(M.start,M.end,A,B),e.push({point:A,pointOnLine:B,distance:I.origin.distanceTo(A),object:o,face:null,faceIndex:v,uv:null,uv1:null})}}}class Ct extends n.Mesh{constructor(t=new bt.LineSegmentsGeometry,e){super(t,e),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const t=this.geometry,e=t.attributes.instanceStart,i=t.attributes.instanceEnd,s=new Float32Array(2*e.count);for(let l=0,r=0,c=e.count;l<c;l++,r+=2)st.fromBufferAttribute(e,l),rt.fromBufferAttribute(i,l),s[r]=r===0?0:s[r-1],s[r+1]=s[r]+st.distanceTo(rt);const a=new n.InstancedInterleavedBuffer(s,2,1);return t.setAttribute("instanceDistanceStart",new n.InterleavedBufferAttribute(a,1,0)),t.setAttribute("instanceDistanceEnd",new n.InterleavedBufferAttribute(a,1,1)),this}raycast(t,e){const i=this.material.worldUnits,s=t.camera;s===null&&!i&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const a=t.params.Line2!==void 0&&t.params.Line2.threshold||0;I=t.ray;const l=this.matrixWorld,r=this.geometry,c=this.material;T=c.linewidth+a,r.boundingSphere===null&&r.computeBoundingSphere(),E.copy(r.boundingSphere).applyMatrix4(l);let u;if(i)u=T*.5;else{const h=Math.max(s.near,E.distanceToPoint(I.origin));u=at(s,h,c.resolution)}if(E.radius+=u,I.intersectsSphere(E)===!1)return;r.boundingBox===null&&r.computeBoundingBox(),R.copy(r.boundingBox).applyMatrix4(l);let p;if(i)p=T*.5;else{const h=Math.max(s.near,R.distanceToPoint(I.origin));p=at(s,h,c.resolution)}R.expandByScalar(p),I.intersectsBox(R)!==!1&&(i?St(this,e):jt(this,s,e))}onBeforeRender(t){const e=this.material.uniforms;e&&e.resolution&&(t.getViewport(Z),this.material.uniforms.resolution.value.set(Z.z,Z.w))}}const ot=["encodings_fragment","colorspace_fragment"],Vt=`
5
5
  #include <common>
6
6
  #include <logdepthbuf_pars_vertex>
7
7
  #include <fog_pars_vertex>
@@ -94,7 +94,7 @@
94
94
  vHighPrecisionZW = finalPosition.zw;
95
95
  #include <fog_vertex>
96
96
  }
97
- `,Dt=`
97
+ `,Bt=`
98
98
  #include <packing>
99
99
  #include <fog_pars_fragment>
100
100
  #include <logdepthbuf_pars_fragment>
@@ -146,4 +146,4 @@
146
146
  #include <tonemapping_fragment>
147
147
  #include <${+n.REVISION<154?ot[0]:ot[1]}>
148
148
  }
149
- `;class zt extends n.ShaderMaterial{constructor(t){super({uniforms:F(O({},n.UniformsLib.fog),{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new n.Color(16777215)},opacity:{value:1},resolution:{value:new n.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},useDepth:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new n.Vector2(1,1)},offset:{value:new n.Vector2(0,0)},offsetLoop:{value:1},lineLightAnimation:{value:0},time:{value:0},size:{value:300},speed:{value:.3},lightWidth:{value:.1},uCenter:{value:new n.Vector2(0,0)},lightColor:{value:new n.Color(16777215)}}),vertexShader:Vt,fragmentShader:Dt}),this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get(){return this.uniforms.lineWidth.value},set(e){this.uniforms.lineWidth.value=e}},map:{enumerable:!0,get(){return this.uniforms.map.value},set(e){this.uniforms.map.value=e}},useMap:{enumerable:!0,get(){return this.uniforms.useMap.value},set(e){this.uniforms.useMap.value=e}},alphaMap:{enumerable:!0,get(){return this.uniforms.alphaMap.value},set(e){this.uniforms.alphaMap.value=e}},useAlphaMap:{enumerable:!0,get(){return this.uniforms.useAlphaMap.value},set(e){this.uniforms.useAlphaMap.value=e}},color:{enumerable:!0,get(){return this.uniforms.color.value},set(e){this.uniforms.color.value=e}},opacity:{enumerable:!0,get(){return this.uniforms.opacity.value},set(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get(){return this.uniforms.resolution.value},set(e){this.uniforms.resolution.value.copy(e)}},sizeAttenuation:{enumerable:!0,get(){return this.uniforms.sizeAttenuation.value},set(e){this.uniforms.sizeAttenuation.value=e}},dashArray:{enumerable:!0,get(){return this.uniforms.dashArray.value},set(e){this.uniforms.dashArray.value=e,this.useDash=e!==0?1:0}},dashOffset:{enumerable:!0,get(){return this.uniforms.dashOffset.value},set(e){this.uniforms.dashOffset.value=e}},dashRatio:{enumerable:!0,get(){return this.uniforms.dashRatio.value},set(e){this.uniforms.dashRatio.value=e}},useDash:{enumerable:!0,get(){return this.uniforms.useDash.value},set(e){this.uniforms.useDash.value=e}},useDepth:{enumerable:!0,get(){return this.uniforms.useDepth.value},set(e){this.uniforms.useDepth.value=e}},visibility:{enumerable:!0,get(){return this.uniforms.visibility.value},set(e){this.uniforms.visibility.value=e}},alphaTest:{enumerable:!0,get(){return this.uniforms.alphaTest.value},set(e){this.uniforms.alphaTest.value=e}},repeat:{enumerable:!0,get(){return this.uniforms.repeat.value},set(e){this.uniforms.repeat.value.copy(e)}},lineLightAnimation:{enumerable:!0,get:function(){return this.uniforms.lineLightAnimation.value},set:function(e){this.uniforms.lineLightAnimation.value=e}},time:{enumerable:!0,get:function(){return this.uniforms.time.value},set:function(e){this.uniforms.time.value=e}},size:{enumerable:!0,get:function(){return this.uniforms.size.value},set:function(e){this.uniforms.size.value=e}},speed:{enumerable:!0,get:function(){return this.uniforms.speed.value},set:function(e){this.uniforms.speed.value=e}},lightWidth:{enumerable:!0,get:function(){return this.uniforms.lightWidth.value},set:function(e){this.uniforms.lightWidth.value=e}},uCenter:{enumerable:!0,get:function(){return this.uniforms.uCenter.value},set:function(e){this.uniforms.uCenter.value=e}},lightColor:{enumerable:!0,get:function(){return this.uniforms.lightColor.value},set:function(e){e&&(this.uniforms.lightColor.value=e)}}}),this.setValues(t)}copy(t){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}}function Bt(o,t){return o.map(e=>{const i=[];let s;return e.forEach(a=>{if(s){const l=k.geoDistance(a,s)*180/Math.PI;if(l>t){const r=k.geoInterpolate(s,a),c=1/Math.ceil(l/t);let u=c;for(;u<1;)i.push(r(u)),u+=c}}i.push(s=a)}),i})}function It(o,{minLng:t,maxLng:e,minLat:i,maxLat:s}={}){const a=Math.round(J(360/o,2)/Math.PI),l=(1+Math.sqrt(5))/2,r=f=>f/l*360%360-180,c=f=>Math.acos(2*f/a-1)/Math.PI*180-90,u=f=>a*(Math.cos((f+90)*Math.PI/180)+1)/2,p=[s!==void 0?Math.ceil(u(s)):0,i!==void 0?Math.floor(u(i)):a-1],h=t===void 0&&e===void 0?()=>!0:t===void 0?f=>f<=e:e===void 0?f=>f>=t:e>=t?f=>f>=t&&f<=e:f=>f>=t||f<=e,v=[];for(let f=p[0];f<=p[1];f++){const d=r(f);h(d)&&v.push([d,c(f)])}return v}function X(o,t,e=!1){return e?k.geoContains(t,o):Mt(o,t)}function Tt(o,t){const e={type:"Polygon",coordinates:o},[[i,s],[a,l]]=k.geoBounds(e);if(Math.min(Math.abs(a-i),Math.abs(l-s))<t)return[];const r=i>a||l>=89||s<=-89;return It(t,{minLng:i,maxLng:a,minLat:s,maxLat:l}).filter(c=>X(c,e,r))}function Lt(o,{resolution:t=1/0,bbox:e,projection:i}={}){const s=Bt(o,t),a=W.merge(s),l=Tt(o,t),r=[...a,...l],c={type:"Polygon",coordinates:o},[[u,p],[h,v]]=k.geoBounds(c),f=u>h||v>=89||p<=-89;let d=[];if(f){const g=wt.geoVoronoi(r).triangles(),w=new Map(r.map(([S,j],T)=>[`${S}-${j}`,T]));g.features.forEach(S=>{const j=S.geometry.coordinates[0].slice(0,3).reverse(),T=[];if(j.forEach(([C,q])=>{const G=`${C}-${q}`;w.has(G)&&T.push(w.get(G))}),T.length===3){if(T.some(C=>C<a.length)){const C=S.properties.circumcenter;if(!X(C,c,f))return}d.push(...T)}})}else if(l.length){const g=xt.from(r);for(let w=0,S=g.triangles.length;w<S;w+=3){const j=[2,1,0].map(C=>g.triangles[w+C]),T=j.map(C=>r[C]);if(j.some(C=>C<a.length)){const C=[0,1].map(q=>W.mean(T,G=>G[q]));if(!X(C,c,f))continue}d.push(...j)}}else{const{vertices:g,holes:w=[]}=K.flatten(s);d=K(g,w,2)}let m=e?[e[0],e[2]]:W.extent(r,g=>g[0]),b=e?[e[1],e[3]]:W.extent(r,g=>g[1]);if(i){const[g,w]=i([m[0],b[0]]),[S,j]=i([m[1],b[1]]);m=[g,S],b=[-w,-j]}const P=it.scaleLinear(m,[0,1]),V=it.scaleLinear(b,[0,1]),D=r.map(([g,w])=>{if(i){const[S,j]=i([g,w]);return[P(S),V(-j)]}else return[P(g),V(w)]});return{contour:s,triangles:{points:r,indices:d,uvs:D}}}const lt=new n.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function U(o,t,e,i){const s=o.map(a=>a.map(([l,r])=>{if(i){const[c,u]=i([l,r]);return[c,-u,t]}return e?Q.polar2Cartesian(l,r,t):[l,r,t]}));return K.flatten(s)}function Wt(o,t,e,i,s){const{vertices:a,holes:l}=U(o,t,i,s),{vertices:r}=U(o,e,i,s),c=W.merge([r,a]),u=Math.round(r.length/3),p=new Set(l);let h=0;const v=[];for(let d=0;d<u;d++){let m=d+1;if(m===u)m=h;else if(p.has(m)){const b=m;m=h,h=b}v.push(d,d+u,m+u),v.push(m+u,m,d)}const f=[];for(let d=1;d>=0;d--)for(let m=0;m<u;m+=1)f.push(m/(u-1),d);return{indices:v,vertices:c,uvs:f,topVerts:r}}function ct(o,t,e,i,s,a){return{indices:i?o.indices:o.indices.slice().reverse(),vertices:U([o.points],t,s,a).vertices,uvs:e}}const ht=({polygonGeoJson:o,startHeight:t,endHeight:e,curvatureResolution:i=1,cartesian:s=!0,hasSide:a=!0,hasBottom:l=!1,hasTop:r=!1,projection:c,bbox:u})=>{o.forEach(P=>{yt(P)||P.reverse()});const{contour:p,triangles:h}=Lt(o,{resolution:i,bbox:u,projection:c});let v={},f;a&&(v=Wt(p,t!=null?t:e,e!=null?e:t,s,c),f=v.topVerts);let d=[];(l||r)&&(d=W.merge(h.uvs));let m={};l&&(m=ct(h,t,d,!1,s,c));let b={};return r&&(b=ct(h,e,d,!0,s,c)),{contour:p,triangles:h,sideTorso:v,bottomCap:m,topCap:b,topVerts:f}};class _t extends n.BufferGeometry{constructor(t,e={}){super(),this.type="PolygonBufferGeometry",this.parameters=O({polygonGeoJson:t,startHeight:0,endHeight:1,hasTop:!0,topFirst:!1,hasBottom:!0,hasSide:!0,curvatureResolution:1,cartesian:!0,userDataRsoOffset:0},e);const{endHeight:i,hasTop:s,topFirst:a,hasBottom:l,hasSide:r,cartesian:c,userDataRsoOffset:u,projection:p}=this.parameters,{contour:h,sideTorso:v,topVerts:f,bottomCap:d,topCap:m}=ht(O({},this.parameters));let b=[],P=[],V=[],D=0;const A=g=>{const w=Math.round(b.length/3),S=V.length;b=b.concat(g.vertices),P=P.concat(g.uvs),V=V.concat(w?g.indices.map(j=>j+w):g.indices),this.addGroup(S,V.length-S,D++)};s&&a&&A(m),r&&(A(v),this.userData.topVerts=u?U(h,i+u,c,p).vertices:f),l&&A(d),s&&!a&&A(m),this.setIndex(V),this[lt]("position",new n.Float32BufferAttribute(b,3)),this[lt]("uv",new n.Float32BufferAttribute(P,2)),this.computeVertexNormals()}}exports.BaseObject=ut;exports.Group=At;exports.LineSegments2=Ct;exports.MeshLineMaterial=zt;exports.PolygonGeometry=_t;exports.ResourceTracker=_;exports.getMetas=ht;
149
+ `;class Dt extends n.ShaderMaterial{constructor(t){super({uniforms:F(O({},n.UniformsLib.fog),{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new n.Color(16777215)},opacity:{value:1},resolution:{value:new n.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},useDepth:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new n.Vector2(1,1)},offset:{value:new n.Vector2(0,0)},offsetLoop:{value:1},lineLightAnimation:{value:0},time:{value:0},size:{value:300},speed:{value:.3},lightWidth:{value:.1},uCenter:{value:new n.Vector2(0,0)},lightColor:{value:new n.Color(16777215)}}),vertexShader:Vt,fragmentShader:Bt}),this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get(){return this.uniforms.lineWidth.value},set(e){this.uniforms.lineWidth.value=e}},map:{enumerable:!0,get(){return this.uniforms.map.value},set(e){this.uniforms.map.value=e}},useMap:{enumerable:!0,get(){return this.uniforms.useMap.value},set(e){this.uniforms.useMap.value=e}},alphaMap:{enumerable:!0,get(){return this.uniforms.alphaMap.value},set(e){this.uniforms.alphaMap.value=e}},useAlphaMap:{enumerable:!0,get(){return this.uniforms.useAlphaMap.value},set(e){this.uniforms.useAlphaMap.value=e}},color:{enumerable:!0,get(){return this.uniforms.color.value},set(e){this.uniforms.color.value=e}},opacity:{enumerable:!0,get(){return this.uniforms.opacity.value},set(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get(){return this.uniforms.resolution.value},set(e){this.uniforms.resolution.value.copy(e)}},sizeAttenuation:{enumerable:!0,get(){return this.uniforms.sizeAttenuation.value},set(e){this.uniforms.sizeAttenuation.value=e}},dashArray:{enumerable:!0,get(){return this.uniforms.dashArray.value},set(e){this.uniforms.dashArray.value=e,this.useDash=e!==0?1:0}},dashOffset:{enumerable:!0,get(){return this.uniforms.dashOffset.value},set(e){this.uniforms.dashOffset.value=e}},dashRatio:{enumerable:!0,get(){return this.uniforms.dashRatio.value},set(e){this.uniforms.dashRatio.value=e}},useDash:{enumerable:!0,get(){return this.uniforms.useDash.value},set(e){this.uniforms.useDash.value=e}},useDepth:{enumerable:!0,get(){return this.uniforms.useDepth.value},set(e){this.uniforms.useDepth.value=e}},visibility:{enumerable:!0,get(){return this.uniforms.visibility.value},set(e){this.uniforms.visibility.value=e}},alphaTest:{enumerable:!0,get(){return this.uniforms.alphaTest.value},set(e){this.uniforms.alphaTest.value=e}},repeat:{enumerable:!0,get(){return this.uniforms.repeat.value},set(e){this.uniforms.repeat.value.copy(e)}},lineLightAnimation:{enumerable:!0,get:function(){return this.uniforms.lineLightAnimation.value},set:function(e){this.uniforms.lineLightAnimation.value=e}},time:{enumerable:!0,get:function(){return this.uniforms.time.value},set:function(e){this.uniforms.time.value=e}},size:{enumerable:!0,get:function(){return this.uniforms.size.value},set:function(e){this.uniforms.size.value=e}},speed:{enumerable:!0,get:function(){return this.uniforms.speed.value},set:function(e){this.uniforms.speed.value=e}},lightWidth:{enumerable:!0,get:function(){return this.uniforms.lightWidth.value},set:function(e){this.uniforms.lightWidth.value=e}},uCenter:{enumerable:!0,get:function(){return this.uniforms.uCenter.value},set:function(e){this.uniforms.uCenter.value=e}},lightColor:{enumerable:!0,get:function(){return this.uniforms.lightColor.value},set:function(e){e&&(this.uniforms.lightColor.value=e)}}}),this.setValues(t)}copy(t){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}}function zt(o,t){return o.map(e=>{const i=[];let s;return e.forEach(a=>{if(s){const l=k.geoDistance(a,s)*180/Math.PI;if(l>t){const r=k.geoInterpolate(s,a),c=1/Math.ceil(l/t);let u=c;for(;u<1;)i.push(r(u)),u+=c}}i.push(s=a)}),i})}function It(o,{minLng:t,maxLng:e,minLat:i,maxLat:s}={}){const a=Math.round(J(360/o,2)/Math.PI),l=(1+Math.sqrt(5))/2,r=f=>f/l*360%360-180,c=f=>Math.acos(2*f/a-1)/Math.PI*180-90,u=f=>a*(Math.cos((f+90)*Math.PI/180)+1)/2,p=[s!==void 0?Math.ceil(u(s)):0,i!==void 0?Math.floor(u(i)):a-1],h=t===void 0&&e===void 0?()=>!0:t===void 0?f=>f<=e:e===void 0?f=>f>=t:e>=t?f=>f>=t&&f<=e:f=>f>=t||f<=e,v=[];for(let f=p[0];f<=p[1];f++){const d=r(f);h(d)&&v.push([d,c(f)])}return v}function X(o,t,e=!1){return e?k.geoContains(t,o):Mt(o,t)}function Lt(o,t){const e={type:"Polygon",coordinates:o},[[i,s],[a,l]]=k.geoBounds(e);if(Math.min(Math.abs(a-i),Math.abs(l-s))<t)return[];const r=i>a||l>=89||s<=-89;return It(t,{minLng:i,maxLng:a,minLat:s,maxLat:l}).filter(c=>X(c,e,r))}function Tt(o,{resolution:t=1/0,bbox:e,projection:i}={}){const s=zt(o,t),a=W.merge(s),l=Lt(o,t),r=[...a,...l],c={type:"Polygon",coordinates:o},[[u,p],[h,v]]=k.geoBounds(c),f=u>h||v>=89||p<=-89;let d=[];if(f){const g=wt.geoVoronoi(r).triangles(),w=new Map(r.map(([S,j],L)=>[`${S}-${j}`,L]));g.features.forEach(S=>{const j=S.geometry.coordinates[0].slice(0,3).reverse(),L=[];if(j.forEach(([C,q])=>{const G=`${C}-${q}`;w.has(G)&&L.push(w.get(G))}),L.length===3){if(L.some(C=>C<a.length)){const C=S.properties.circumcenter;if(!X(C,c,f))return}d.push(...L)}})}else if(l.length){const g=xt.from(r);for(let w=0,S=g.triangles.length;w<S;w+=3){const j=[2,1,0].map(C=>g.triangles[w+C]),L=j.map(C=>r[C]);if(j.some(C=>C<a.length)){const C=[0,1].map(q=>W.mean(L,G=>G[q]));if(!X(C,c,f))continue}d.push(...j)}}else{const{vertices:g,holes:w=[]}=K.flatten(s);d=K(g,w,2)}let m=e?[e[0],e[2]]:W.extent(r,g=>g[0]),b=e?[e[1],e[3]]:W.extent(r,g=>g[1]);if(i){const[g,w]=i([m[0],b[0]]),[S,j]=i([m[1],b[1]]);m=[g,S],b=[-w,-j]}const P=it.scaleLinear(m,[0,1]),V=it.scaleLinear(b,[0,1]),B=r.map(([g,w])=>{if(i){const[S,j]=i([g,w]);return[P(S),V(-j)]}else return[P(g),V(w)]});return{contour:s,triangles:{points:r,indices:d,uvs:B}}}const lt=new n.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function U(o,t,e,i){const s=o.map(a=>a.map(([l,r])=>{if(i){const[c,u]=i([l,r]);return[c,-u,t]}return e?Q.polar2Cartesian(l,r,t):[l,r,t]}));return K.flatten(s)}function Wt(o,t,e,i,s){const{vertices:a,holes:l}=U(o,t,i,s),{vertices:r}=U(o,e,i,s),c=W.merge([r,a]),u=Math.round(r.length/3),p=new Set(l);let h=0;const v=[];for(let d=0;d<u;d++){let m=d+1;if(m===u)m=h;else if(p.has(m)){const b=m;m=h,h=b}v.push(d,d+u,m+u),v.push(m+u,m,d)}const f=[];for(let d=1;d>=0;d--)for(let m=0;m<u;m+=1)f.push(m/(u-1),d);return{indices:v,vertices:c,uvs:f,topVerts:r}}function ct(o,t,e,i,s,a){return{indices:i?o.indices:o.indices.slice().reverse(),vertices:U([o.points],t,s,a).vertices,uvs:e}}const ht=({polygonGeoJson:o,startHeight:t,endHeight:e,curvatureResolution:i=1,cartesian:s=!0,hasSide:a=!0,hasBottom:l=!1,hasTop:r=!1,projection:c,bbox:u})=>{o.forEach(P=>{yt(P)||P.reverse()});const{contour:p,triangles:h}=Tt(o,{resolution:i,bbox:u,projection:c});let v={},f;a&&(v=Wt(p,t!=null?t:e,e!=null?e:t,s,c),f=v.topVerts);let d=[];(l||r)&&(d=W.merge(h.uvs));let m={};l&&(m=ct(h,t,d,!1,s,c));let b={};return r&&(b=ct(h,e,d,!0,s,c)),{contour:p,triangles:h,sideTorso:v,bottomCap:m,topCap:b,topVerts:f}};class _t extends n.BufferGeometry{constructor(t,e={}){super(),this.type="PolygonBufferGeometry",this.parameters=O({polygonGeoJson:t,startHeight:0,endHeight:1,hasTop:!0,topFirst:!1,hasBottom:!0,hasSide:!0,curvatureResolution:1,cartesian:!0,userDataRsoOffset:0},e);const{endHeight:i,hasTop:s,topFirst:a,hasBottom:l,hasSide:r,cartesian:c,userDataRsoOffset:u,projection:p}=this.parameters,{contour:h,sideTorso:v,topVerts:f,bottomCap:d,topCap:m}=ht(O({},this.parameters));let b=[],P=[],V=[],B=0;const A=g=>{const w=Math.round(b.length/3),S=V.length;b=b.concat(g.vertices),P=P.concat(g.uvs),V=V.concat(w?g.indices.map(j=>j+w):g.indices),this.addGroup(S,V.length-S,B++)};s&&a&&A(m),r&&(A(v),this.userData.topVerts=u?U(h,i+u,c,p).vertices:f),l&&A(d),s&&!a&&A(m),this.setIndex(V),this[lt]("position",new n.Float32BufferAttribute(b,3)),this[lt]("uv",new n.Float32BufferAttribute(P,2)),this.computeVertexNormals()}}exports.BaseObject=ut;exports.Group=At;exports.LineSegments2=Ct;exports.MeshLineMaterial=Dt;exports.PolygonGeometry=_t;exports.ResourceTracker=_;exports.getMetas=ht;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gl-draw",
3
- "version": "0.14.41",
3
+ "version": "0.15.0-beta.1",
4
4
  "author": "gitplus <hstits@gmail.com>",
5
5
  "scripts": {
6
6
  "start": "bundler-dev",