gl-draw 0.11.21 → 0.11.22

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.
@@ -38,7 +38,7 @@ var ht = (o, t, e) => new Promise((i, s) => {
38
38
  import { B as ot } from "../BaseObject.module.js";
39
39
  import { G as ki } from "../index.module2.js";
40
40
  import * as b from "three";
41
- import { BufferGeometry as he, BufferAttribute as Me, Vector4 as pt, Vector3 as $, Matrix4 as Se, Line3 as _e, Box3 as Pe, Sphere as Te, Mesh as Le, InstancedInterleavedBuffer as Ie, InterleavedBufferAttribute as Jt, MathUtils as Ce, Float32BufferAttribute as Xt, ShapeUtils as Pt, Shape as Be, Vector2 as D } from "three";
41
+ import { BufferGeometry as he, BufferAttribute as Me, Vector4 as pt, Vector3 as $, Matrix4 as Se, Line3 as _e, Box3 as Pe, Sphere as Te, Mesh as Le, InstancedInterleavedBuffer as Ie, InterleavedBufferAttribute as Jt, MathUtils as Be, Float32BufferAttribute as Xt, ShapeUtils as Pt, Shape as Ce, Vector2 as D } from "three";
42
42
  import * as lt from "@tweenjs/tween.js";
43
43
  import { RectAreaLightUniformsLib as Ee } from "three/examples/jsm/lights/RectAreaLightUniformsLib";
44
44
  import { LineSegments2 as ze } from "three/examples/jsm/lines/LineSegments2";
@@ -120,11 +120,11 @@ class zi extends ot {
120
120
  let h = Math.PI / 2;
121
121
  t.forEach((l, c) => {
122
122
  if (l === 0) return;
123
- const p = Math.PI * 2 * (l / u), f = i[c], d = n ? e * (l / r) : e, g = this.createGeometry(d, p), w = s ? s.clone() : new b.MeshBasicMaterial({
123
+ const p = Math.PI * 2 * (l / u), f = i[c], d = n ? e * (l / r) : e, x = this.createGeometry(d, p), g = s ? s.clone() : new b.MeshBasicMaterial({
124
124
  color: f
125
125
  });
126
- s && w.color.set(f);
127
- const S = new b.Mesh(g, w);
126
+ s && g.color.set(f);
127
+ const S = new b.Mesh(x, g);
128
128
  S.userData.depth = d, S.userData.index = c, S.rotateZ(h), h += p, this.add(S);
129
129
  }), a !== -1 && this.setActive(a);
130
130
  });
@@ -168,7 +168,7 @@ class Vi extends ot {
168
168
  super(), this.rectAreaLightUniformsLibInit = !1, this.options = t;
169
169
  }
170
170
  create() {
171
- var e, i, s, n, a, r, u, h, l, c, p, f, d, g, w, S, B;
171
+ var e, i, s, n, a, r, u, h, l, c, p, f, d, x, g, S, I;
172
172
  const t = this.options;
173
173
  if (t.type === "AmbientLight") {
174
174
  const A = new b.AmbientLight(t.color);
@@ -204,10 +204,10 @@ class Vi extends ot {
204
204
  } else if (t.type === "RectAreaLight") {
205
205
  this.rectAreaLightUniformsLibInit || (Ee.init(), this.rectAreaLightUniformsLibInit = !0);
206
206
  const A = new b.RectAreaLight(
207
- (g = t.color) != null ? g : 16777215,
208
- (w = t.intensity) != null ? w : 1,
207
+ (x = t.color) != null ? x : 16777215,
208
+ (g = t.intensity) != null ? g : 1,
209
209
  (S = t.width) != null ? S : 10,
210
- (B = t.height) != null ? B : 10
210
+ (I = t.height) != null ? I : 10
211
211
  );
212
212
  A.name = "矩形区域光", this.object3d = A, this.rectAreaLight = A;
213
213
  }
@@ -274,11 +274,11 @@ function Y(o, t = 0) {
274
274
  u.addGroup(h, f, l);
275
275
  else if (t === 2 && c.groups.length > 0)
276
276
  for (let d of c.groups) {
277
- let g = d.materialIndex;
277
+ let x = d.materialIndex;
278
278
  u.addGroup(
279
279
  h + d.start,
280
280
  Math.min(d.count, f),
281
- g
281
+ x
282
282
  );
283
283
  }
284
284
  h += f;
@@ -309,8 +309,8 @@ function Y(o, t = 0) {
309
309
  u.morphAttributes = u.morphAttributes || {}, u.morphAttributes[l] = [];
310
310
  for (let p = 0; p < c; ++p) {
311
311
  const f = [];
312
- for (let g = 0; g < a[l].length; ++g)
313
- f.push(a[l][g][p]);
312
+ for (let x = 0; x < a[l].length; ++x)
313
+ f.push(a[l][x][p]);
314
314
  const d = te(f);
315
315
  if (!d)
316
316
  return console.error(
@@ -351,8 +351,8 @@ function te(o) {
351
351
  const c = u / e;
352
352
  for (let p = 0, f = l.count; p < f; p++)
353
353
  for (let d = 0; d < e; d++) {
354
- const g = l.getComponent(p, d);
355
- r.setComponent(p + c, d, g);
354
+ const x = l.getComponent(p, d);
355
+ r.setComponent(p + c, d, x);
356
356
  }
357
357
  } else
358
358
  a.set(l.array, u);
@@ -421,23 +421,23 @@ function Ye(o, t, e) {
421
421
  if (U.fromBufferAttribute(u, p), W.fromBufferAttribute(h, p), U.w = 1, W.w = 1, U.applyMatrix4(It), W.applyMatrix4(It), U.z > c && W.z > c)
422
422
  continue;
423
423
  if (U.z > c) {
424
- const A = U.z - W.z, E = (U.z - c) / A;
425
- U.lerp(W, E);
424
+ const A = U.z - W.z, B = (U.z - c) / A;
425
+ U.lerp(W, B);
426
426
  } else if (W.z > c) {
427
- const A = W.z - U.z, E = (W.z - c) / A;
428
- W.lerp(U, E);
427
+ const A = W.z - U.z, B = (W.z - c) / A;
428
+ W.lerp(U, B);
429
429
  }
430
430
  U.applyMatrix4(i), W.applyMatrix4(i), U.multiplyScalar(1 / U.w), W.multiplyScalar(1 / W.w), U.x *= n.x / 2, U.y *= n.y / 2, W.x *= n.x / 2, W.y *= n.y / 2, j.start.copy(U), j.start.z = 0, j.end.copy(W), j.end.z = 0;
431
- const g = j.closestPointToPointParameter(Lt, !0);
432
- j.at(g, se);
433
- const w = Ce.lerp(U.z, W.z, g), S = w >= -1 && w <= 1, B = Lt.distanceTo(se) < rt * 0.5;
434
- if (S && B) {
431
+ const x = j.closestPointToPointParameter(Lt, !0);
432
+ j.at(x, se);
433
+ const g = Be.lerp(U.z, W.z, x), S = g >= -1 && g <= 1, I = Lt.distanceTo(se) < rt * 0.5;
434
+ if (S && I) {
435
435
  j.start.fromBufferAttribute(u, p), j.end.fromBufferAttribute(h, p), j.start.applyMatrix4(a), j.end.applyMatrix4(a);
436
- const A = new $(), E = new $();
437
- X.distanceSqToSegment(j.start, j.end, E, A), e.push({
438
- point: E,
436
+ const A = new $(), B = new $();
437
+ X.distanceSqToSegment(j.start, j.end, B, A), e.push({
438
+ point: B,
439
439
  pointOnLine: A,
440
- distance: X.origin.distanceTo(E),
440
+ distance: X.origin.distanceTo(B),
441
441
  object: o,
442
442
  face: null,
443
443
  faceIndex: p,
@@ -573,7 +573,7 @@ let Gi = class extends ot {
573
573
  }, t));
574
574
  }
575
575
  };
576
- function Ct(o, t, e, i, s) {
576
+ function Bt(o, t, e, i, s) {
577
577
  let n;
578
578
  if (o = o.subarray || o.slice ? o : o.buffer, e = e.subarray || e.slice ? e : e.buffer, o = t ? (
579
579
  // @ts-ignore
@@ -670,7 +670,7 @@ class ti extends b.BufferGeometry {
670
670
  */
671
671
  advance({ x: t, y: e, z: i }) {
672
672
  const s = this._attributes.position.array, n = this._attributes.previous.array, a = this._attributes.next.array, r = s.length;
673
- Ct(s, 0, n, 0, r), Ct(s, 6, s, 0, r - 6), s[r - 6] = t, s[r - 5] = e, s[r - 4] = i, s[r - 3] = t, s[r - 2] = e, s[r - 1] = i, Ct(s, 6, a, 0, r - 6), a[r - 6] = t, a[r - 5] = e, a[r - 4] = i, a[r - 3] = t, a[r - 2] = e, a[r - 1] = i, this._attributes.position.needsUpdate = !0, this._attributes.previous.needsUpdate = !0, this._attributes.next.needsUpdate = !0;
673
+ Bt(s, 0, n, 0, r), Bt(s, 6, s, 0, r - 6), s[r - 6] = t, s[r - 5] = e, s[r - 4] = i, s[r - 3] = t, s[r - 2] = e, s[r - 1] = i, Bt(s, 6, a, 0, r - 6), a[r - 6] = t, a[r - 5] = e, a[r - 4] = i, a[r - 3] = t, a[r - 2] = e, a[r - 1] = i, this._attributes.position.needsUpdate = !0, this._attributes.previous.needsUpdate = !0, this._attributes.next.needsUpdate = !0;
674
674
  }
675
675
  }
676
676
  const oe = ["encodings_fragment", "colorspace_fragment"], ei = (
@@ -1087,11 +1087,11 @@ function Wi(o, t) {
1087
1087
  e.copy(this.matrixWorld).invert(), i.copy(o.ray).applyMatrix4(e);
1088
1088
  const r = new b.Vector3(), u = new b.Vector3(), h = new b.Vector3(), l = this instanceof b.LineSegments ? 2 : 1, c = a.index, p = a.attributes;
1089
1089
  if (c !== null) {
1090
- const f = c.array, d = p.position.array, g = p.width.array;
1091
- for (let w = 0, S = f.length - 1; w < S; w += l) {
1092
- const B = f[w], A = f[w + 1];
1093
- r.fromArray(d, B * 3), u.fromArray(d, A * 3);
1094
- const E = g[Math.floor(w / 3)] != null ? g[Math.floor(w / 3)] : 1, T = o.params.Line.threshold + this.material.lineWidth * E / 2, L = T * T;
1090
+ const f = c.array, d = p.position.array, x = p.width.array;
1091
+ for (let g = 0, S = f.length - 1; g < S; g += l) {
1092
+ const I = f[g], A = f[g + 1];
1093
+ r.fromArray(d, I * 3), u.fromArray(d, A * 3);
1094
+ const B = x[Math.floor(g / 3)] != null ? x[Math.floor(g / 3)] : 1, T = o.params.Line.threshold + this.material.lineWidth * B / 2, L = T * T;
1095
1095
  if (i.distanceSqToSegment(
1096
1096
  r,
1097
1097
  u,
@@ -1099,21 +1099,21 @@ function Wi(o, t) {
1099
1099
  h
1100
1100
  ) > L) continue;
1101
1101
  n.applyMatrix4(this.matrixWorld);
1102
- const I = o.ray.origin.distanceTo(n);
1103
- I < o.near || I > o.far || (t.push({
1104
- distance: I,
1102
+ const C = o.ray.origin.distanceTo(n);
1103
+ C < o.near || C > o.far || (t.push({
1104
+ distance: C,
1105
1105
  // What do we want? intersection point on the ray or on the segment??
1106
1106
  // point: raycaster.ray.at( distance ),
1107
1107
  point: h.clone().applyMatrix4(this.matrixWorld),
1108
- index: w,
1108
+ index: g,
1109
1109
  face: null,
1110
1110
  faceIndex: void 0,
1111
1111
  object: this
1112
- }), w = S);
1112
+ }), g = S);
1113
1113
  }
1114
1114
  }
1115
1115
  }
1116
- const Bt = (o) => {
1116
+ const Ct = (o) => {
1117
1117
  const { setPointWidth: t, nodes: e } = o, i = new ti();
1118
1118
  return i.setPoints(e, t), i;
1119
1119
  };
@@ -1139,16 +1139,16 @@ class ji extends ot {
1139
1139
  materialParameters: h
1140
1140
  } = this.options;
1141
1141
  let l = n, c = i;
1142
- !l && h && (l = this.getMaterial(h)), !c && t ? c = Bt({
1142
+ !l && h && (l = this.getMaterial(h)), !c && t ? c = Ct({
1143
1143
  nodes: t,
1144
1144
  setPointWidth: r
1145
1145
  }) : !c && e ? c = Y(
1146
1146
  e.map((p, f) => {
1147
1147
  let d = r;
1148
1148
  return !d && u && (d = () => {
1149
- var g;
1150
- return (g = u[f]) != null ? g : u[0];
1151
- }), Bt({
1149
+ var x;
1150
+ return (x = u[f]) != null ? x : u[0];
1151
+ }), Ct({
1152
1152
  nodes: p,
1153
1153
  setPointWidth: d
1154
1154
  });
@@ -1161,7 +1161,7 @@ class ji extends ot {
1161
1161
  });
1162
1162
  }
1163
1163
  setGeometry(t, e) {
1164
- const i = Bt({
1164
+ const i = Ct({
1165
1165
  nodes: t,
1166
1166
  setPointWidth: e
1167
1167
  }), s = this.object3d, n = s.geometry;
@@ -1275,11 +1275,11 @@ function ai(o, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
1275
1275
  let d = [];
1276
1276
  if (f) {
1277
1277
  const T = $e(r).triangles(), L = new Map(
1278
- r.map(([z, I], N) => [`${z}-${I}`, N])
1278
+ r.map(([z, C], N) => [`${z}-${C}`, N])
1279
1279
  );
1280
1280
  T.features.forEach((z) => {
1281
- const I = z.geometry.coordinates[0].slice(0, 3).reverse(), N = [];
1282
- if (I.forEach(([V, k]) => {
1281
+ const C = z.geometry.coordinates[0].slice(0, 3).reverse(), N = [];
1282
+ if (C.forEach(([V, k]) => {
1283
1283
  const nt = `${V}-${k}`;
1284
1284
  L.has(nt) && N.push(L.get(nt));
1285
1285
  }), N.length === 3) {
@@ -1298,8 +1298,8 @@ function ai(o, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
1298
1298
  } else if (a.length) {
1299
1299
  const T = Oe.from(r);
1300
1300
  for (let L = 0, z = T.triangles.length; L < z; L += 3) {
1301
- const I = [2, 1, 0].map((V) => T.triangles[L + V]), N = I.map((V) => r[V]);
1302
- if (I.some((V) => V < n.length)) {
1301
+ const C = [2, 1, 0].map((V) => T.triangles[L + V]), N = C.map((V) => r[V]);
1302
+ if (C.some((V) => V < n.length)) {
1303
1303
  const V = [0, 1].map(
1304
1304
  (k) => Ge(N, (nt) => nt[k])
1305
1305
  );
@@ -1310,23 +1310,23 @@ function ai(o, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
1310
1310
  ))
1311
1311
  continue;
1312
1312
  }
1313
- d.push(...I);
1313
+ d.push(...C);
1314
1314
  }
1315
1315
  } else {
1316
1316
  const { vertices: T, holes: L = [] } = pe(s);
1317
1317
  d = Ue(T, L, 2);
1318
1318
  }
1319
- let g = e ? [e[0], e[2]] : Yt(r, (T) => T[0]), w = e ? [e[1], e[3]] : Yt(r, (T) => T[1]);
1319
+ let x = e ? [e[0], e[2]] : Yt(r, (T) => T[0]), g = e ? [e[1], e[3]] : Yt(r, (T) => T[1]);
1320
1320
  if (i) {
1321
- const [T, L] = i([g[0], w[0]]), [z, I] = i([g[1], w[1]]);
1322
- g = [T, z], w = [-L, -I];
1321
+ const [T, L] = i([x[0], g[0]]), [z, C] = i([x[1], g[1]]);
1322
+ x = [T, z], g = [-L, -C];
1323
1323
  }
1324
- const S = Kt(g, [0, 1]), B = Kt(w, [0, 1]), A = r.map(([T, L]) => {
1324
+ const S = Kt(x, [0, 1]), I = Kt(g, [0, 1]), A = r.map(([T, L]) => {
1325
1325
  if (i) {
1326
- const [z, I] = i([T, L]);
1327
- return [S(z), B(-I)];
1326
+ const [z, C] = i([T, L]);
1327
+ return [S(z), I(-C)];
1328
1328
  } else
1329
- return [S(T), B(L)];
1329
+ return [S(T), I(L)];
1330
1330
  });
1331
1331
  return { contour: s, triangles: { points: r, indices: d, uvs: A } };
1332
1332
  }
@@ -1358,18 +1358,18 @@ function li(o, t, e, i, s) {
1358
1358
  let c = 0;
1359
1359
  const p = [];
1360
1360
  for (let d = 0; d < h; d++) {
1361
- let g = d + 1;
1362
- if (g === h)
1363
- g = c;
1364
- else if (l.has(g)) {
1365
- const w = g;
1366
- g = c, c = w;
1361
+ let x = d + 1;
1362
+ if (x === h)
1363
+ x = c;
1364
+ else if (l.has(x)) {
1365
+ const g = x;
1366
+ x = c, c = g;
1367
1367
  }
1368
- p.push(d, d + h, g + h), p.push(g + h, g, d);
1368
+ p.push(d, d + h, x + h), p.push(x + h, x, d);
1369
1369
  }
1370
1370
  const f = [];
1371
1371
  for (let d = 1; d >= 0; d--)
1372
- for (let g = 0; g < h; g += 1) f.push(g / (h - 1), d);
1372
+ for (let x = 0; x < h; x += 1) f.push(x / (h - 1), d);
1373
1373
  return { indices: p, vertices: u, uvs: f, topVerts: r };
1374
1374
  }
1375
1375
  function le(o, t, e, i, s, n) {
@@ -1414,8 +1414,8 @@ const ui = ({
1414
1414
  ), f = p.topVerts);
1415
1415
  let d = [];
1416
1416
  (a || r) && (d = zt(c.uvs));
1417
- let g = {};
1418
- a && (g = le(
1417
+ let x = {};
1418
+ a && (x = le(
1419
1419
  c,
1420
1420
  t,
1421
1421
  d,
@@ -1423,15 +1423,15 @@ const ui = ({
1423
1423
  s,
1424
1424
  u
1425
1425
  ));
1426
- let w = {};
1427
- return r && (w = le(
1426
+ let g = {};
1427
+ return r && (g = le(
1428
1428
  c,
1429
1429
  e,
1430
1430
  d,
1431
1431
  !0,
1432
1432
  s,
1433
1433
  u
1434
- )), { contour: l, triangles: c, sideTorso: p, bottomCap: g, topCap: w, topVerts: f };
1434
+ )), { contour: l, triangles: c, sideTorso: p, bottomCap: x, topCap: g, topVerts: f };
1435
1435
  };
1436
1436
  class ci extends b.BufferGeometry {
1437
1437
  constructor(t, e = {}) {
@@ -1456,22 +1456,22 @@ class ci extends b.BufferGeometry {
1456
1456
  cartesian: u,
1457
1457
  userDataRsoOffset: h,
1458
1458
  projection: l
1459
- } = this.parameters, { contour: c, sideTorso: p, topVerts: f, bottomCap: d, topCap: g } = ui(R({}, this.parameters));
1460
- let w = [], S = [], B = [], A = 0;
1461
- const E = (T) => {
1462
- const L = Math.round(w.length / 3), z = B.length;
1463
- w = w.concat(T.vertices), S = S.concat(T.uvs), B = B.concat(
1464
- L ? T.indices.map((I) => I + L) : T.indices
1465
- ), this.addGroup(z, B.length - z, A++);
1459
+ } = this.parameters, { contour: c, sideTorso: p, topVerts: f, bottomCap: d, topCap: x } = ui(R({}, this.parameters));
1460
+ let g = [], S = [], I = [], A = 0;
1461
+ const B = (T) => {
1462
+ const L = Math.round(g.length / 3), z = I.length;
1463
+ g = g.concat(T.vertices), S = S.concat(T.uvs), I = I.concat(
1464
+ L ? T.indices.map((C) => C + L) : T.indices
1465
+ ), this.addGroup(z, I.length - z, A++);
1466
1466
  };
1467
- s && n && E(g), r && (E(p), this.userData.topVerts = h ? At(
1467
+ s && n && B(x), r && (B(p), this.userData.topVerts = h ? At(
1468
1468
  c,
1469
1469
  i + h,
1470
1470
  u,
1471
1471
  l
1472
- ).vertices : f), a && E(d), s && !n && E(g), this.setIndex(B), this[ae](
1472
+ ).vertices : f), a && B(d), s && !n && B(x), this.setIndex(I), this[ae](
1473
1473
  "position",
1474
- new b.Float32BufferAttribute(w, 3)
1474
+ new b.Float32BufferAttribute(g, 3)
1475
1475
  ), this[ae]("uv", new b.Float32BufferAttribute(S, 2)), this.computeVertexNormals();
1476
1476
  }
1477
1477
  }
@@ -1521,7 +1521,7 @@ class Di extends ot {
1521
1521
  }
1522
1522
  }
1523
1523
  class ft extends he {
1524
- constructor(t = new Be([
1524
+ constructor(t = new Ce([
1525
1525
  new D(0.5, 0.5),
1526
1526
  new D(-0.5, 0.5),
1527
1527
  new D(-0.5, -0.5),
@@ -1540,10 +1540,10 @@ class ft extends he {
1540
1540
  function a(r) {
1541
1541
  var Wt, jt, Dt;
1542
1542
  const u = [], h = e.curveSegments !== void 0 ? e.curveSegments : 12, l = e.steps !== void 0 ? e.steps : 1, c = e.depth !== void 0 ? e.depth : 1;
1543
- let p = e.bevelEnabled !== void 0 ? e.bevelEnabled : !0, f = e.bevelThickness !== void 0 ? e.bevelThickness : 0.2, d = e.bevelSize !== void 0 ? e.bevelSize : f - 0.1, g = e.bevelOffset !== void 0 ? e.bevelOffset : 0, w = e.bevelSegments !== void 0 ? e.bevelSegments : 3;
1544
- const S = e.extrudePath, B = e.UVGenerator !== void 0 ? e.UVGenerator : hi, A = (Wt = e.hasTop) != null ? Wt : !0, E = (jt = e.hasBottom) != null ? jt : !0, T = (Dt = e.hasSide) != null ? Dt : !0;
1545
- let L, z = !1, I, N, V, k;
1546
- S && (L = S.getSpacedPoints(l), z = !0, p = !1, I = S.computeFrenetFrames(l, !1), N = new $(), V = new $(), k = new $()), p || (w = 0, f = 0, d = 0, g = 0);
1543
+ let p = e.bevelEnabled !== void 0 ? e.bevelEnabled : !0, f = e.bevelThickness !== void 0 ? e.bevelThickness : 0.2, d = e.bevelSize !== void 0 ? e.bevelSize : f - 0.1, x = e.bevelOffset !== void 0 ? e.bevelOffset : 0, g = e.bevelSegments !== void 0 ? e.bevelSegments : 3;
1544
+ const S = e.extrudePath, I = e.UVGenerator !== void 0 ? e.UVGenerator : hi, A = (Wt = e.hasTop) != null ? Wt : !0, B = (jt = e.hasBottom) != null ? jt : !0, T = (Dt = e.hasSide) != null ? Dt : !0;
1545
+ let L, z = !1, C, N, V, k;
1546
+ S && (L = S.getSpacedPoints(l), z = !0, p = !1, C = S.computeFrenetFrames(l, !1), N = new $(), V = new $(), k = new $()), p || (g = 0, f = 0, d = 0, x = 0);
1547
1547
  const nt = r.extractPoints(h);
1548
1548
  let H = nt.shape;
1549
1549
  const F = nt.holes;
@@ -1564,22 +1564,22 @@ class ft extends he {
1564
1564
  }
1565
1565
  const K = H.length, dt = ut.length;
1566
1566
  function Vt(m, y, v) {
1567
- let M, x, _;
1568
- const P = m.x - y.x, C = m.y - y.y, O = v.x - m.x, G = v.y - m.y, ct = P * P + C * C, St = P * G - C * O;
1567
+ let M, w, _;
1568
+ const P = m.x - y.x, E = m.y - y.y, O = v.x - m.x, G = v.y - m.y, ct = P * P + E * E, St = P * G - E * O;
1569
1569
  if (Math.abs(St) > Number.EPSILON) {
1570
1570
  const it = Math.sqrt(ct), Rt = Math.sqrt(
1571
1571
  O * O + G * G
1572
- ), Ot = y.x - C / it, Nt = y.y + P / it, ve = v.x - G / Rt, be = v.y + O / Rt, Ft = ((ve - Ot) * G - (be - Nt) * O) / (P * G - C * O);
1573
- M = Ot + P * Ft - m.x, x = Nt + C * Ft - m.y;
1574
- const kt = M * M + x * x;
1572
+ ), Ot = y.x - E / it, Nt = y.y + P / it, ve = v.x - G / Rt, be = v.y + O / Rt, Ft = ((ve - Ot) * G - (be - Nt) * O) / (P * G - E * O);
1573
+ M = Ot + P * Ft - m.x, w = Nt + E * Ft - m.y;
1574
+ const kt = M * M + w * w;
1575
1575
  if (kt <= 2)
1576
- return new D(M, x);
1576
+ return new D(M, w);
1577
1577
  _ = Math.sqrt(kt / 2);
1578
1578
  } else {
1579
1579
  let it = !1;
1580
- P > Number.EPSILON ? O > Number.EPSILON && (it = !0) : P < -Number.EPSILON ? O < -Number.EPSILON && (it = !0) : Math.sign(C) === Math.sign(G) && (it = !0), it ? (M = -C, x = P, _ = Math.sqrt(ct)) : (M = P, x = C, _ = Math.sqrt(ct / 2));
1580
+ P > Number.EPSILON ? O > Number.EPSILON && (it = !0) : P < -Number.EPSILON ? O < -Number.EPSILON && (it = !0) : Math.sign(E) === Math.sign(G) && (it = !0), it ? (M = -E, w = P, _ = Math.sqrt(ct)) : (M = P, w = E, _ = Math.sqrt(ct / 2));
1581
1581
  }
1582
- return new D(M / _, x / _);
1582
+ return new D(M / _, w / _);
1583
1583
  }
1584
1584
  const mt = [];
1585
1585
  for (let m = 0, y = q.length, v = y - 1, M = m + 1; m < y; m++, v++, M++)
@@ -1589,46 +1589,46 @@ class ft extends he {
1589
1589
  for (let m = 0, y = F.length; m < y; m++) {
1590
1590
  const v = F[m];
1591
1591
  st = [];
1592
- for (let M = 0, x = v.length, _ = x - 1, P = M + 1; M < x; M++, _++, P++)
1593
- _ === x && (_ = 0), P === x && (P = 0), st[M] = Vt(v[M], v[_], v[P]);
1592
+ for (let M = 0, w = v.length, _ = w - 1, P = M + 1; M < w; M++, _++, P++)
1593
+ _ === w && (_ = 0), P === w && (P = 0), st[M] = Vt(v[M], v[_], v[P]);
1594
1594
  Mt.push(st), gt = gt.concat(st);
1595
1595
  }
1596
- for (let m = 0; m < w; m++) {
1597
- const y = m / w, v = f * Math.cos(y * Math.PI / 2), M = d * Math.sin(y * Math.PI / 2) + g;
1598
- for (let x = 0, _ = q.length; x < _; x++) {
1599
- const P = at(q[x], mt[x], M);
1596
+ for (let m = 0; m < g; m++) {
1597
+ const y = m / g, v = f * Math.cos(y * Math.PI / 2), M = d * Math.sin(y * Math.PI / 2) + x;
1598
+ for (let w = 0, _ = q.length; w < _; w++) {
1599
+ const P = at(q[w], mt[w], M);
1600
1600
  Q(P.x, P.y, -v);
1601
1601
  }
1602
- for (let x = 0, _ = F.length; x < _; x++) {
1603
- const P = F[x];
1604
- st = Mt[x];
1605
- for (let C = 0, O = P.length; C < O; C++) {
1606
- const G = at(P[C], st[C], M);
1602
+ for (let w = 0, _ = F.length; w < _; w++) {
1603
+ const P = F[w];
1604
+ st = Mt[w];
1605
+ for (let E = 0, O = P.length; E < O; E++) {
1606
+ const G = at(P[E], st[E], M);
1607
1607
  Q(G.x, G.y, -v);
1608
1608
  }
1609
1609
  }
1610
1610
  }
1611
- const Gt = d + g;
1611
+ const Gt = d + x;
1612
1612
  for (let m = 0; m < K; m++) {
1613
1613
  const y = p ? at(H[m], gt[m], Gt) : H[m];
1614
- z ? (V.copy(I.normals[0]).multiplyScalar(y.x), N.copy(I.binormals[0]).multiplyScalar(y.y), k.copy(L[0]).add(V).add(N), Q(k.x, k.y, k.z)) : Q(y.x, y.y, 0);
1614
+ z ? (V.copy(C.normals[0]).multiplyScalar(y.x), N.copy(C.binormals[0]).multiplyScalar(y.y), k.copy(L[0]).add(V).add(N), Q(k.x, k.y, k.z)) : Q(y.x, y.y, 0);
1615
1615
  }
1616
1616
  for (let m = 1; m <= l; m++)
1617
1617
  for (let y = 0; y < K; y++) {
1618
1618
  const v = p ? at(H[y], gt[y], Gt) : H[y];
1619
- z ? (V.copy(I.normals[m]).multiplyScalar(v.x), N.copy(I.binormals[m]).multiplyScalar(v.y), k.copy(L[m]).add(V).add(N), Q(k.x, k.y, k.z)) : Q(v.x, v.y, c / l * m);
1619
+ z ? (V.copy(C.normals[m]).multiplyScalar(v.x), N.copy(C.binormals[m]).multiplyScalar(v.y), k.copy(L[m]).add(V).add(N), Q(k.x, k.y, k.z)) : Q(v.x, v.y, c / l * m);
1620
1620
  }
1621
- for (let m = w - 1; m >= 0; m--) {
1622
- const y = m / w, v = f * Math.cos(y * Math.PI / 2), M = d * Math.sin(y * Math.PI / 2) + g;
1623
- for (let x = 0, _ = q.length; x < _; x++) {
1624
- const P = at(q[x], mt[x], M);
1621
+ for (let m = g - 1; m >= 0; m--) {
1622
+ const y = m / g, v = f * Math.cos(y * Math.PI / 2), M = d * Math.sin(y * Math.PI / 2) + x;
1623
+ for (let w = 0, _ = q.length; w < _; w++) {
1624
+ const P = at(q[w], mt[w], M);
1625
1625
  Q(P.x, P.y, c + v);
1626
1626
  }
1627
- for (let x = 0, _ = F.length; x < _; x++) {
1628
- const P = F[x];
1629
- st = Mt[x];
1630
- for (let C = 0, O = P.length; C < O; C++) {
1631
- const G = at(P[C], st[C], M);
1627
+ for (let w = 0, _ = F.length; w < _; w++) {
1628
+ const P = F[w];
1629
+ st = Mt[w];
1630
+ for (let E = 0, O = P.length; E < O; E++) {
1631
+ const G = at(P[E], st[E], M);
1632
1632
  z ? Q(
1633
1633
  G.x,
1634
1634
  G.y + L[l - 1].y,
@@ -1642,18 +1642,18 @@ class ft extends he {
1642
1642
  const m = s.length / 3;
1643
1643
  if (p) {
1644
1644
  let y = 0, v = K * y;
1645
- if (E)
1645
+ if (B)
1646
1646
  for (let M = 0; M < dt; M++) {
1647
- const x = ut[M];
1648
- yt(x[2] + v, x[1] + v, x[0] + v);
1647
+ const w = ut[M];
1648
+ yt(w[2] + v, w[1] + v, w[0] + v);
1649
1649
  }
1650
- if (y = l + w * 2, v = K * y, A)
1650
+ if (y = l + g * 2, v = K * y, A)
1651
1651
  for (let M = 0; M < dt; M++) {
1652
- const x = ut[M];
1653
- yt(x[0] + v, x[1] + v, x[2] + v);
1652
+ const w = ut[M];
1653
+ yt(w[0] + v, w[1] + v, w[2] + v);
1654
1654
  }
1655
1655
  } else {
1656
- if (E)
1656
+ if (B)
1657
1657
  for (let y = 0; y < dt; y++) {
1658
1658
  const v = ut[y];
1659
1659
  yt(v[2], v[1], v[0]);
@@ -1675,8 +1675,8 @@ class ft extends he {
1675
1675
  let y = 0;
1676
1676
  Ut(q, y), y += q.length;
1677
1677
  for (let v = 0, M = F.length; v < M; v++) {
1678
- const x = F[v];
1679
- Ut(x, y), y += x.length;
1678
+ const w = F[v];
1679
+ Ut(w, y), y += w.length;
1680
1680
  }
1681
1681
  i.addGroup(m, s.length / 3 - m, 1);
1682
1682
  }
@@ -1684,10 +1684,10 @@ class ft extends he {
1684
1684
  let v = m.length;
1685
1685
  for (; --v >= 0; ) {
1686
1686
  const M = v;
1687
- let x = v - 1;
1688
- x < 0 && (x = m.length - 1);
1689
- for (let _ = 0, P = l + w * 2; _ < P; _++) {
1690
- const C = K * _, O = K * (_ + 1), G = y + M + C, ct = y + x + C, St = y + x + O, it = y + M + O;
1687
+ let w = v - 1;
1688
+ w < 0 && (w = m.length - 1);
1689
+ for (let _ = 0, P = l + g * 2; _ < P; _++) {
1690
+ const E = K * _, O = K * (_ + 1), G = y + M + E, ct = y + w + E, St = y + w + O, it = y + M + O;
1691
1691
  ye(G, ct, St, it);
1692
1692
  }
1693
1693
  }
@@ -1697,24 +1697,24 @@ class ft extends he {
1697
1697
  }
1698
1698
  function yt(m, y, v) {
1699
1699
  tt(m), tt(y), tt(v);
1700
- const M = s.length / 3, x = B.generateTopUV(
1700
+ const M = s.length / 3, w = I.generateTopUV(
1701
1701
  i,
1702
1702
  s,
1703
1703
  M - 3,
1704
1704
  M - 2,
1705
1705
  M - 1
1706
1706
  );
1707
- et(x[0]), et(x[1]), et(x[2]);
1707
+ et(w[0]), et(w[1]), et(w[2]);
1708
1708
  }
1709
1709
  function ye(m, y, v, M) {
1710
1710
  tt(m), tt(y), tt(M), tt(y), tt(v), tt(M);
1711
- const x = s.length / 3, _ = B.generateSideWallUV(
1711
+ const w = s.length / 3, _ = I.generateSideWallUV(
1712
1712
  i,
1713
1713
  s,
1714
- x - 6,
1715
- x - 3,
1716
- x - 2,
1717
- x - 1
1714
+ w - 6,
1715
+ w - 3,
1716
+ w - 2,
1717
+ w - 1
1718
1718
  );
1719
1719
  et(_[0]), et(_[1]), et(_[3]), et(_[1]), et(_[2]), et(_[3]);
1720
1720
  }
@@ -1753,17 +1753,17 @@ const hi = {
1753
1753
  ];
1754
1754
  },
1755
1755
  generateSideWallUV: function(o, t, e, i, s, n) {
1756
- const a = t[e * 3], r = t[e * 3 + 1], u = t[e * 3 + 2], h = t[i * 3], l = t[i * 3 + 1], c = t[i * 3 + 2], p = t[s * 3], f = t[s * 3 + 1], d = t[s * 3 + 2], g = t[n * 3], w = t[n * 3 + 1], S = t[n * 3 + 2];
1756
+ const a = t[e * 3], r = t[e * 3 + 1], u = t[e * 3 + 2], h = t[i * 3], l = t[i * 3 + 1], c = t[i * 3 + 2], p = t[s * 3], f = t[s * 3 + 1], d = t[s * 3 + 2], x = t[n * 3], g = t[n * 3 + 1], S = t[n * 3 + 2];
1757
1757
  return Math.abs(r - l) < Math.abs(a - h) ? [
1758
1758
  new D(a, 1 - u),
1759
1759
  new D(h, 1 - c),
1760
1760
  new D(p, 1 - d),
1761
- new D(g, 1 - S)
1761
+ new D(x, 1 - S)
1762
1762
  ] : [
1763
1763
  new D(r, 1 - u),
1764
1764
  new D(l, 1 - c),
1765
1765
  new D(f, 1 - d),
1766
- new D(w, 1 - S)
1766
+ new D(g, 1 - S)
1767
1767
  ];
1768
1768
  }
1769
1769
  };
@@ -1793,8 +1793,8 @@ class pi extends ft {
1793
1793
  if (e.box3) {
1794
1794
  const g = new b.Vector3();
1795
1795
  e.box3.getSize(g);
1796
- const w = Math.max(n.x / g.x, n.y / g.y);
1797
- r = Math.ceil(e.topSegments * w);
1796
+ const S = Math.max(n.x / g.x, n.y / g.y);
1797
+ r = Math.ceil(e.topSegments * S);
1798
1798
  }
1799
1799
  if (r < 4)
1800
1800
  return this;
@@ -1805,19 +1805,30 @@ class pi extends ft {
1805
1805
  r
1806
1806
  ), h = new Qt(u);
1807
1807
  h.position.set(a.x, a.y, a.z), h.updateMatrixWorld();
1808
- const c = new qe().evaluate(h, i, Ze), p = c.geometry.getAttribute("position");
1808
+ const c = new qe().evaluate(h, i, Ze), p = c.geometry.getAttribute("position"), f = new b.Float32BufferAttribute(
1809
+ p.count * 2,
1810
+ 2
1811
+ );
1809
1812
  for (let g = 0; g < p.count; g++) {
1810
- const w = p.getZ(g);
1811
- p.setZ(g, w * 2);
1813
+ const S = p.getZ(g);
1814
+ p.setZ(g, S * 2);
1815
+ }
1816
+ if (e.box3) {
1817
+ const g = e.box3.min, S = e.box3.max, I = new b.Vector3().subVectors(S, g);
1818
+ for (let A = 0; A < p.count; A++) {
1819
+ const B = p.getX(A), T = p.getY(A), L = (B - g.x) / I.x, z = (T - g.y) / I.y;
1820
+ f.setXY(A, L, z);
1821
+ }
1822
+ c.geometry.setAttribute("uv", f);
1812
1823
  }
1813
1824
  p.needsUpdate = !0;
1814
- const f = new ft(t, bt(R({}, e), {
1825
+ const d = new ft(t, bt(R({}, e), {
1815
1826
  hasTop: !1
1816
- })), d = Y(
1817
- [c.geometry, f],
1827
+ })), x = Y(
1828
+ [c.geometry, d],
1818
1829
  2
1819
1830
  );
1820
- this.copy(d.toNonIndexed());
1831
+ this.copy(x.toNonIndexed());
1821
1832
  }
1822
1833
  }
1823
1834
  const ce = (o) => {
@@ -1868,9 +1879,9 @@ class Ri extends ot {
1868
1879
  hasTop: l,
1869
1880
  hasBottom: c,
1870
1881
  hasSide: p
1871
- } = this.options, f = Array.isArray(s) ? s : [s], d = Array.isArray(u) ? u : [u], g = r;
1872
- let w = n;
1873
- g || console.log("material is null"), !w && t ? w = ce({
1882
+ } = this.options, f = Array.isArray(s) ? s : [s], d = Array.isArray(u) ? u : [u], x = r;
1883
+ let g = n;
1884
+ x || console.log("material is null"), !g && t ? g = ce({
1874
1885
  points: t,
1875
1886
  depth: f[0],
1876
1887
  box3: d[0],
@@ -1878,14 +1889,14 @@ class Ri extends ot {
1878
1889
  hasTop: l,
1879
1890
  hasBottom: c,
1880
1891
  hasSide: p
1881
- }) : !w && e ? w = Y(
1892
+ }) : !g && e ? g = Y(
1882
1893
  e.map(
1883
- (S, B) => {
1884
- var A, E;
1894
+ (S, I) => {
1895
+ var A, B;
1885
1896
  return ce({
1886
1897
  points: S,
1887
- depth: (A = f[B]) != null ? A : f[0],
1888
- box3: (E = d[B]) != null ? E : d[0],
1898
+ depth: (A = f[I]) != null ? A : f[0],
1899
+ box3: (B = d[I]) != null ? B : d[0],
1889
1900
  split: h,
1890
1901
  hasTop: l,
1891
1902
  hasBottom: c,
@@ -1894,10 +1905,10 @@ class Ri extends ot {
1894
1905
  }
1895
1906
  ),
1896
1907
  i != null ? i : 0
1897
- ) : !w && a && a.length > 1 ? w = Y(
1908
+ ) : !g && a && a.length > 1 ? g = Y(
1898
1909
  a,
1899
1910
  i != null ? i : 0
1900
- ) : !w && a && a.length === 1 && ([w] = a), this.createMesh(w, g);
1911
+ ) : !g && a && a.length === 1 && ([g] = a), this.createMesh(g, x);
1901
1912
  });
1902
1913
  }
1903
1914
  addGeometries(t) {