gl-draw 0.17.0-beta.36 → 0.17.0-beta.37

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,73 +1,74 @@
1
- var Je = Object.defineProperty, Qe = Object.defineProperties;
2
- var Ke = Object.getOwnPropertyDescriptors;
3
- var he = Object.getOwnPropertySymbols;
4
- var Be = Object.prototype.hasOwnProperty, Oe = Object.prototype.propertyIsEnumerable;
5
- var Ie = (p, e, t) => e in p ? Je(p, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : p[e] = t, O = (p, e) => {
6
- for (var t in e || (e = {}))
7
- Be.call(e, t) && Ie(p, t, e[t]);
8
- if (he)
9
- for (var t of he(e))
10
- Oe.call(e, t) && Ie(p, t, e[t]);
11
- return p;
12
- }, ue = (p, e) => Qe(p, Ke(e));
13
- var ye = (p, e) => {
14
- var t = {};
15
- for (var n in p)
16
- Be.call(p, n) && e.indexOf(n) < 0 && (t[n] = p[n]);
17
- if (p != null && he)
18
- for (var n of he(p))
19
- e.indexOf(n) < 0 && Oe.call(p, n) && (t[n] = p[n]);
20
- return t;
1
+ var te = Object.defineProperty, ee = Object.defineProperties;
2
+ var se = Object.getOwnPropertyDescriptors;
3
+ var yt = Object.getOwnPropertySymbols;
4
+ var Ot = Object.prototype.hasOwnProperty, Ut = Object.prototype.propertyIsEnumerable;
5
+ var Rt = (m, t, e) => t in m ? te(m, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : m[t] = e, W = (m, t) => {
6
+ for (var e in t || (t = {}))
7
+ Ot.call(t, e) && Rt(m, e, t[e]);
8
+ if (yt)
9
+ for (var e of yt(t))
10
+ Ut.call(t, e) && Rt(m, e, t[e]);
11
+ return m;
12
+ }, bt = (m, t) => ee(m, se(t));
13
+ var vt = (m, t) => {
14
+ var e = {};
15
+ for (var s in m)
16
+ Ot.call(m, s) && t.indexOf(s) < 0 && (e[s] = m[s]);
17
+ if (m != null && yt)
18
+ for (var s of yt(m))
19
+ t.indexOf(s) < 0 && Ut.call(m, s) && (e[s] = m[s]);
20
+ return e;
21
21
  };
22
- var ie = (p, e, t) => new Promise((n, s) => {
22
+ var ut = (m, t, e) => new Promise((s, n) => {
23
23
  var r = (i) => {
24
24
  try {
25
- f(t.next(i));
25
+ f(e.next(i));
26
26
  } catch (h) {
27
- s(h);
27
+ n(h);
28
28
  }
29
29
  }, a = (i) => {
30
30
  try {
31
- f(t.throw(i));
31
+ f(e.throw(i));
32
32
  } catch (h) {
33
- s(h);
33
+ n(h);
34
34
  }
35
- }, f = (i) => i.done ? n(i.value) : Promise.resolve(i.value).then(r, a);
36
- f((t = t.apply(p, e)).next());
35
+ }, f = (i) => i.done ? s(i.value) : Promise.resolve(i.value).then(r, a);
36
+ f((e = e.apply(m, t)).next());
37
37
  });
38
- import { LineMaterial as et } from "three/examples/jsm/lines/LineMaterial";
39
- import { LineMaterial as hn } from "three/examples/jsm/lines/LineMaterial";
40
- import { LineSegmentsGeometry as tt } from "three/examples/jsm/lines/LineSegmentsGeometry";
41
- import { LineSegmentsGeometry as fn } from "three/examples/jsm/lines/LineSegmentsGeometry";
42
- import { P as nt, a as K, M as st, L as ot } from "../index.module2.js";
43
- import { N as mn, g as pn } from "../index.module2.js";
44
- import { BufferGeometry as me, Float32BufferAttribute as xe, Vector3 as z, ShapeUtils as fe, Shape as we, Vector2 as E, ArcCurve as it, CatmullRomCurve3 as rt, CubicBezierCurve as at, CubicBezierCurve3 as ct, EllipseCurve as lt, LineCurve as ht, LineCurve3 as ut, QuadraticBezierCurve as ft, QuadraticBezierCurve3 as dt, SplineCurve as mt, Box3 as pt, PlaneGeometry as gt, CanvasTexture as yt, AmbientLight as bt, DirectionalLight as xt, PointLight as wt, SpotLight as vt, HemisphereLight as St, RectAreaLight as At, Matrix4 as We, BufferAttribute as Y, Ray as Mt, Sphere as Lt, LineSegments as Ne, Color as ke, MeshBasicMaterial as Tt, Mesh as Gt } from "three";
45
- import { mergeAttributes as Ue, mergeGroups as _t } from "three/examples/jsm/utils/BufferGeometryUtils";
46
- import { g as Et, c as Pt } from "../uvGenerator.module.js";
47
- import { Brush as Re, Evaluator as zt, INTERSECTION as Ct } from "three-bvh-csg";
48
- import { RectAreaLightUniformsLib as jt } from "three/examples/jsm/lights/RectAreaLightUniformsLib";
49
- import * as ne from "@tweenjs/tween.js";
50
- import { LineSegments2 as It } from "three/examples/jsm/lines/LineSegments2";
51
- function H(p, e = 0) {
52
- const t = p[0].index !== null, n = new Set(Object.keys(p[0].attributes)), s = new Set(
53
- Object.keys(p[0].morphAttributes)
54
- ), r = {}, a = {}, f = p[0].morphTargetsRelative, i = new me();
38
+ import { LineMaterial as ne } from "three/examples/jsm/lines/LineMaterial";
39
+ import { LineMaterial as ds } from "three/examples/jsm/lines/LineMaterial";
40
+ import { LineSegmentsGeometry as oe } from "three/examples/jsm/lines/LineSegmentsGeometry";
41
+ import { LineSegmentsGeometry as gs } from "three/examples/jsm/lines/LineSegmentsGeometry";
42
+ import { P as ie, a as tt, M as re, L as ae } from "../index.module2.js";
43
+ import { N as bs, g as xs } from "../index.module2.js";
44
+ import { BufferGeometry as ft, Float32BufferAttribute as ct, MeshStandardMaterial as ce, Mesh as kt, Vector3 as j, ShapeUtils as xt, Shape as At, Vector2 as z, ArcCurve as le, CatmullRomCurve3 as he, CubicBezierCurve as ue, CubicBezierCurve3 as fe, EllipseCurve as me, LineCurve as de, LineCurve3 as pe, QuadraticBezierCurve as ge, QuadraticBezierCurve3 as ye, SplineCurve as be, Box3 as xe, PlaneGeometry as we, CanvasTexture as ve, AmbientLight as Se, DirectionalLight as Me, PointLight as Ae, SpotLight as Le, HemisphereLight as Te, RectAreaLight as Ge, Matrix4 as qt, BufferAttribute as K, Ray as Ee, Sphere as _e, LineSegments as Ft, Color as Yt, MeshBasicMaterial as Pe } from "three";
45
+ import { mergeAttributes as Dt, mergeGroups as ze } from "three/examples/jsm/utils/BufferGeometryUtils";
46
+ import { W as St } from "../cartographicToCartesian.module.js";
47
+ import { g as je, c as Ce } from "../uvGenerator.module.js";
48
+ import { Brush as Xt, Evaluator as Ie, INTERSECTION as Be } from "three-bvh-csg";
49
+ import { RectAreaLightUniformsLib as Re } from "three/examples/jsm/lights/RectAreaLightUniformsLib";
50
+ import * as at from "@tweenjs/tween.js";
51
+ import { LineSegments2 as Oe } from "three/examples/jsm/lines/LineSegments2";
52
+ function k(m, t = 0) {
53
+ const e = m[0].index !== null, s = new Set(Object.keys(m[0].attributes)), n = new Set(
54
+ Object.keys(m[0].morphAttributes)
55
+ ), r = {}, a = {}, f = m[0].morphTargetsRelative, i = new ft();
55
56
  let h = 0;
56
- for (let o = 0; o < p.length; ++o) {
57
- const c = p[o];
57
+ for (let o = 0; o < m.length; ++o) {
58
+ const c = m[o];
58
59
  let g = 0;
59
- if (t !== (c.index !== null))
60
+ if (e !== (c.index !== null))
60
61
  return console.error(
61
62
  "THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + o + ". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."
62
63
  ), null;
63
64
  for (const u in c.attributes) {
64
- if (!n.has(u))
65
+ if (!s.has(u))
65
66
  return console.error(
66
67
  "THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + o + '. All geometries must have compatible attributes; make sure "' + u + '" attribute exists among all geometries, or in none of them.'
67
68
  ), null;
68
69
  r[u] === void 0 && (r[u] = []), r[u].push(c.attributes[u]), g++;
69
70
  }
70
- if (g !== n.size)
71
+ if (g !== s.size)
71
72
  return console.error(
72
73
  "THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + o + ". Make sure all geometries have the same number of attributes."
73
74
  ), null;
@@ -76,15 +77,15 @@ function H(p, e = 0) {
76
77
  "THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + o + ". .morphTargetsRelative must be consistent throughout all geometries."
77
78
  ), null;
78
79
  for (const u in c.morphAttributes) {
79
- if (!s.has(u))
80
+ if (!n.has(u))
80
81
  return console.error(
81
82
  "THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + o + ". .morphAttributes must be consistent throughout all geometries."
82
83
  ), null;
83
84
  a[u] === void 0 && (a[u] = []), a[u].push(c.morphAttributes[u]);
84
85
  }
85
- if (e) {
86
+ if (t) {
86
87
  let u;
87
- if (t)
88
+ if (e)
88
89
  u = c.index.count;
89
90
  else if (c.attributes.position !== void 0)
90
91
  u = c.attributes.position.count;
@@ -92,33 +93,33 @@ function H(p, e = 0) {
92
93
  return console.error(
93
94
  "THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + o + ". The geometry must have either an index or a position attribute"
94
95
  ), null;
95
- if (e === 1)
96
+ if (t === 1)
96
97
  i.addGroup(h, u, o);
97
- else if (e === 2 && c.groups.length > 0)
98
+ else if (t === 2 && c.groups.length > 0)
98
99
  for (let y of c.groups) {
99
- let L = y.materialIndex;
100
+ let A = y.materialIndex;
100
101
  i.addGroup(
101
102
  h + y.start,
102
103
  Math.min(y.count, u),
103
- L
104
+ A
104
105
  );
105
106
  }
106
107
  h += u;
107
108
  }
108
109
  }
109
- if (t) {
110
+ if (e) {
110
111
  let o = 0;
111
112
  const c = [];
112
- for (let g = 0; g < p.length; ++g) {
113
- const u = p[g].index;
113
+ for (let g = 0; g < m.length; ++g) {
114
+ const u = m[g].index;
114
115
  for (let y = 0; y < u.count; ++y)
115
116
  c.push(u.getX(y) + o);
116
- o += p[g].attributes.position.count;
117
+ o += m[g].attributes.position.count;
117
118
  }
118
119
  i.setIndex(c);
119
120
  }
120
121
  for (const o in r) {
121
- const c = Ue(r[o]);
122
+ const c = Dt(r[o]);
122
123
  if (!c)
123
124
  return console.error(
124
125
  "THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + o + " attribute."
@@ -131,9 +132,9 @@ function H(p, e = 0) {
131
132
  i.morphAttributes = i.morphAttributes || {}, i.morphAttributes[o] = [];
132
133
  for (let g = 0; g < c; ++g) {
133
134
  const u = [];
134
- for (let L = 0; L < a[o].length; ++L)
135
- u.push(a[o][L][g]);
136
- const y = Ue(u);
135
+ for (let A = 0; A < a[o].length; ++A)
136
+ u.push(a[o][A][g]);
137
+ const y = Dt(u);
137
138
  if (!y)
138
139
  return console.error(
139
140
  "THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + o + " morphAttribute."
@@ -141,310 +142,351 @@ function H(p, e = 0) {
141
142
  i.morphAttributes[o].push(y);
142
143
  }
143
144
  }
144
- return e === 2 ? _t(i) : i;
145
+ return t === 2 ? ze(i) : i;
145
146
  }
146
- const De = (p) => {
147
- const f = p, { coordinate: e, startHeight: t, height: n } = f, s = ye(f, ["coordinate", "startHeight", "height"]);
148
- let r = t || 0;
149
- return typeof t != "undefined" && typeof n != "undefined" && (r = t + n), new nt([e], ue(O({}, s), {
150
- startHeight: t,
147
+ const Ht = (m) => {
148
+ const f = m, { coordinate: t, startHeight: e, height: s } = f, n = vt(f, ["coordinate", "startHeight", "height"]);
149
+ let r = e || 0;
150
+ return typeof e != "undefined" && typeof s != "undefined" && (r = e + s), new ie([t], bt(W({}, n), {
151
+ startHeight: e,
151
152
  endHeight: r
152
153
  }));
153
154
  };
154
- class Jt extends K {
155
- constructor(e) {
156
- super(), this.options = O({}, e);
155
+ class es extends tt {
156
+ constructor(t) {
157
+ super(), this.options = W({}, t);
157
158
  }
158
159
  create() {
159
160
  const i = this.options, {
160
- geometry: e,
161
- coordinateArr: t,
162
- coordinate: n,
163
- material: s,
161
+ geometry: t,
162
+ coordinateArr: e,
163
+ coordinate: s,
164
+ material: n,
164
165
  useGroups: r
165
- } = i, a = ye(i, [
166
+ } = i, a = vt(i, [
166
167
  "geometry",
167
168
  "coordinateArr",
168
169
  "coordinate",
169
170
  "material",
170
171
  "useGroups"
171
172
  ]);
172
- let f = e;
173
- if (!f && n)
174
- f = De(O({
175
- coordinate: n
173
+ let f = t;
174
+ if (!f && s)
175
+ f = Ht(W({
176
+ coordinate: s
176
177
  }, a));
177
- else if (!f && t) {
178
- const h = t.map(
179
- (o) => De(O({
178
+ else if (!f && e) {
179
+ const h = e.map(
180
+ (o) => Ht(W({
180
181
  coordinate: o
181
182
  }, a))
182
183
  );
183
- f = H(h, r != null ? r : 0);
184
+ f = k(h, r != null ? r : 0);
185
+ }
186
+ this.createMesh(f, n);
187
+ }
188
+ }
189
+ function Ue(m = {}) {
190
+ const {
191
+ a: t = St.a,
192
+ b: e = St.b,
193
+ scaleFactor: s = 1 / St.a,
194
+ widthSegments: n = 64,
195
+ heightSegments: r = 32
196
+ } = m, a = new ft(), f = [], i = [], h = [], o = [], c = t * t, g = e * e, u = (c - g) / c;
197
+ let y = 0;
198
+ const A = [];
199
+ for (let w = 0; w <= r; w++) {
200
+ const v = [], E = w / r, P = (0.5 - E) * 180 * Math.PI / 180, R = Math.sin(P), O = Math.cos(P), N = t / Math.sqrt(1 - u * R * R);
201
+ for (let C = 0; C <= n; C++) {
202
+ const Z = C / n, V = (Z - 0.5) * 360 * Math.PI / 180, lt = Math.sin(V), I = Math.cos(V), B = N * O * I * s, Lt = N * O * lt * s, mt = N * (1 - u) * R * s, ht = B, U = mt, $ = Lt;
203
+ i.push(ht, U, $);
204
+ const D = O * I / t, rt = R * (1 - u) / e, J = O * lt / t, et = Math.sqrt(D * D + rt * rt + J * J);
205
+ h.push(D / et, rt / et, J / et), o.push(Z, 1 - E), v.push(y++);
184
206
  }
185
- this.createMesh(f, s);
207
+ A.push(v);
186
208
  }
209
+ for (let w = 0; w < r; w++)
210
+ for (let v = 0; v < n; v++) {
211
+ const E = A[w][v + 1], S = A[w][v], P = A[w + 1][v], R = A[w + 1][v + 1];
212
+ f.push(E, S, R), f.push(S, P, R);
213
+ }
214
+ return a.setIndex(f), a.setAttribute("position", new ct(i, 3)), a.setAttribute("normal", new ct(h, 3)), a.setAttribute("uv", new ct(o, 2)), a;
187
215
  }
188
- const Bt = {
189
- ArcCurve: it,
190
- CatmullRomCurve3: rt,
191
- CubicBezierCurve: at,
192
- CubicBezierCurve3: ct,
193
- EllipseCurve: lt,
194
- LineCurve: ht,
195
- LineCurve3: ut,
196
- QuadraticBezierCurve: ft,
197
- QuadraticBezierCurve3: dt,
198
- SplineCurve: mt
216
+ class ss extends tt {
217
+ constructor(t = {}) {
218
+ super(), this.options = t;
219
+ }
220
+ create() {
221
+ const t = Ue(this.options), e = this.options.material || new ce({
222
+ color: 2200782,
223
+ metalness: 0.1,
224
+ roughness: 0.7,
225
+ wireframe: !1
226
+ }), s = new kt(t, e);
227
+ return s.name = "Ellipsoid", this.object3d = s, s;
228
+ }
229
+ }
230
+ const De = {
231
+ ArcCurve: le,
232
+ CatmullRomCurve3: he,
233
+ CubicBezierCurve: ue,
234
+ CubicBezierCurve3: fe,
235
+ EllipseCurve: me,
236
+ LineCurve: de,
237
+ LineCurve3: pe,
238
+ QuadraticBezierCurve: ge,
239
+ QuadraticBezierCurve3: ye,
240
+ SplineCurve: be
199
241
  };
200
- class Q extends me {
242
+ class ot extends ft {
201
243
  /**
202
244
  * Constructs a new extrude geometry.
203
245
  *
204
246
  * @param {Shape|Array<Shape>} [shapes] - A shape or an array of shapes.
205
247
  * @param {ExtrudeGeometry~Options} [options] - The extrude settings.
206
248
  */
207
- constructor(e = new we([
208
- new E(0.5, 0.5),
209
- new E(-0.5, 0.5),
210
- new E(-0.5, -0.5),
211
- new E(0.5, -0.5)
212
- ]), t = {}) {
249
+ constructor(t = new At([
250
+ new z(0.5, 0.5),
251
+ new z(-0.5, 0.5),
252
+ new z(-0.5, -0.5),
253
+ new z(0.5, -0.5)
254
+ ]), e = {}) {
213
255
  super(), this.type = "ExtrudeGeometry", this.parameters = {
214
- shapes: e,
215
- options: t
216
- }, e = Array.isArray(e) ? e : [e];
217
- const n = this, s = [], r = [];
218
- for (let f = 0, i = e.length; f < i; f++) {
219
- const h = e[f];
256
+ shapes: t,
257
+ options: e
258
+ }, t = Array.isArray(t) ? t : [t];
259
+ const s = this, n = [], r = [];
260
+ for (let f = 0, i = t.length; f < i; f++) {
261
+ const h = t[f];
220
262
  a(h);
221
263
  }
222
- this.setAttribute("position", new xe(s, 3)), this.setAttribute("uv", new xe(r, 2)), this.computeVertexNormals();
264
+ this.setAttribute("position", new ct(n, 3)), this.setAttribute("uv", new ct(r, 2)), this.computeVertexNormals();
223
265
  function a(f) {
224
- var Te, Ge, _e;
225
- const i = [], h = t.curveSegments !== void 0 ? t.curveSegments : 12, o = t.steps !== void 0 ? t.steps : 1, c = t.depth !== void 0 ? t.depth : 1;
226
- let g = t.bevelEnabled !== void 0 ? t.bevelEnabled : !0, u = t.bevelThickness !== void 0 ? t.bevelThickness : 0.2, y = t.bevelSize !== void 0 ? t.bevelSize : u - 0.1, L = t.bevelOffset !== void 0 ? t.bevelOffset : 0, S = t.bevelSegments !== void 0 ? t.bevelSegments : 3;
227
- const A = t.extrudePath, P = t.UVGenerator !== void 0 ? t.UVGenerator : Ot, v = (Te = t.hasTop) != null ? Te : !0, C = (Ge = t.hasBottom) != null ? Ge : !0, ee = (_e = t.hasSide) != null ? _e : !0;
228
- let X, Z = !1, R, se, oe, V;
229
- A && (X = A.getSpacedPoints(o), Z = !0, g = !1, R = A.computeFrenetFrames(o, !1), se = new z(), oe = new z(), V = new z()), g || (S = 0, u = 0, y = 0, L = 0);
230
- const ve = f.extractPoints(h);
231
- let U = ve.shape;
232
- const j = ve.holes;
233
- if (!fe.isClockWise(U)) {
234
- U = U.reverse();
235
- for (let l = 0, d = j.length; l < d; l++) {
236
- const m = j[l];
237
- fe.isClockWise(m) && (j[l] = m.reverse());
266
+ var Et, _t, Pt;
267
+ const i = [], h = e.curveSegments !== void 0 ? e.curveSegments : 12, o = e.steps !== void 0 ? e.steps : 1, c = e.depth !== void 0 ? e.depth : 1;
268
+ let g = e.bevelEnabled !== void 0 ? e.bevelEnabled : !0, u = e.bevelThickness !== void 0 ? e.bevelThickness : 0.2, y = e.bevelSize !== void 0 ? e.bevelSize : u - 0.1, A = e.bevelOffset !== void 0 ? e.bevelOffset : 0, w = e.bevelSegments !== void 0 ? e.bevelSegments : 3;
269
+ const v = e.extrudePath, E = e.UVGenerator !== void 0 ? e.UVGenerator : Xe, S = (Et = e.hasTop) != null ? Et : !0, P = (_t = e.hasBottom) != null ? _t : !0, R = (Pt = e.hasSide) != null ? Pt : !0;
270
+ let O, N = !1, C, Z, it, V;
271
+ v && (O = v.getSpacedPoints(o), N = !0, g = !1, C = v.computeFrenetFrames(o, !1), Z = new j(), it = new j(), V = new j()), g || (w = 0, u = 0, y = 0, A = 0);
272
+ const lt = f.extractPoints(h);
273
+ let I = lt.shape;
274
+ const B = lt.holes;
275
+ if (!xt.isClockWise(I)) {
276
+ I = I.reverse();
277
+ for (let l = 0, d = B.length; l < d; l++) {
278
+ const p = B[l];
279
+ xt.isClockWise(p) && (B[l] = p.reverse());
238
280
  }
239
281
  }
240
- function Se(l) {
241
- const m = 10000000000000001e-36;
282
+ function mt(l) {
283
+ const p = 10000000000000001e-36;
242
284
  let x = l[0];
243
285
  for (let b = 1; b <= l.length; b++) {
244
- const M = b % l.length, w = l[M], T = w.x - x.x, G = w.y - x.y, _ = T * T + G * G, I = Math.max(
245
- Math.abs(w.x),
246
- Math.abs(w.y),
286
+ const L = b % l.length, M = l[L], T = M.x - x.x, G = M.y - x.y, _ = T * T + G * G, X = Math.max(
287
+ Math.abs(M.x),
288
+ Math.abs(M.y),
247
289
  Math.abs(x.x),
248
290
  Math.abs(x.y)
249
- ), J = m * I * I;
250
- if (_ <= J) {
251
- l.splice(M, 1), b--;
291
+ ), nt = p * X * X;
292
+ if (_ <= nt) {
293
+ l.splice(L, 1), b--;
252
294
  continue;
253
295
  }
254
- x = w;
296
+ x = M;
255
297
  }
256
298
  }
257
- Se(U), j.forEach(Se);
258
- const pe = j.length, D = U;
259
- for (let l = 0; l < pe; l++) {
260
- const d = j[l];
261
- U = U.concat(d);
299
+ mt(I), B.forEach(mt);
300
+ const ht = B.length, U = I;
301
+ for (let l = 0; l < ht; l++) {
302
+ const d = B[l];
303
+ I = I.concat(d);
262
304
  }
263
- function te(l, d, m) {
264
- return d || error("ExtrudeGeometry: vec does not exist"), l.clone().addScaledVector(d, m);
305
+ function $(l, d, p) {
306
+ return d || error("ExtrudeGeometry: vec does not exist"), l.clone().addScaledVector(d, p);
265
307
  }
266
- const W = U.length;
267
- function Ae(l, d, m) {
268
- let x, b, M;
269
- const w = l.x - d.x, T = l.y - d.y, G = m.x - l.x, _ = m.y - l.y, I = w * w + T * T, J = w * _ - T * G;
270
- if (Math.abs(J) > Number.EPSILON) {
271
- const B = Math.sqrt(I), Ee = Math.sqrt(
308
+ const D = I.length;
309
+ function rt(l, d, p) {
310
+ let x, b, L;
311
+ const M = l.x - d.x, T = l.y - d.y, G = p.x - l.x, _ = p.y - l.y, X = M * M + T * T, nt = M * _ - T * G;
312
+ if (Math.abs(nt) > Number.EPSILON) {
313
+ const H = Math.sqrt(X), zt = Math.sqrt(
272
314
  G * G + _ * _
273
- ), Pe = d.x - T / B, ze = d.y + w / B, Ze = m.x - _ / Ee, $e = m.y + G / Ee, Ce = ((Ze - Pe) * _ - ($e - ze) * G) / (w * _ - T * G);
274
- x = Pe + w * Ce - l.x, b = ze + T * Ce - l.y;
275
- const je = x * x + b * b;
276
- if (je <= 2)
277
- return new E(x, b);
278
- M = Math.sqrt(je / 2);
315
+ ), jt = d.x - T / H, Ct = d.y + M / H, Qt = p.x - _ / zt, Kt = p.y + G / zt, It = ((Qt - jt) * _ - (Kt - Ct) * G) / (M * _ - T * G);
316
+ x = jt + M * It - l.x, b = Ct + T * It - l.y;
317
+ const Bt = x * x + b * b;
318
+ if (Bt <= 2)
319
+ return new z(x, b);
320
+ L = Math.sqrt(Bt / 2);
279
321
  } else {
280
- let B = !1;
281
- w > Number.EPSILON ? G > Number.EPSILON && (B = !0) : w < -Number.EPSILON ? G < -Number.EPSILON && (B = !0) : Math.sign(T) === Math.sign(_) && (B = !0), B ? (x = -T, b = w, M = Math.sqrt(I)) : (x = w, b = T, M = Math.sqrt(I / 2));
322
+ let H = !1;
323
+ M > Number.EPSILON ? G > Number.EPSILON && (H = !0) : M < -Number.EPSILON ? G < -Number.EPSILON && (H = !0) : Math.sign(T) === Math.sign(_) && (H = !0), H ? (x = -T, b = M, L = Math.sqrt(X)) : (x = M, b = T, L = Math.sqrt(X / 2));
282
324
  }
283
- return new E(x / M, b / M);
325
+ return new z(x / L, b / L);
284
326
  }
285
- const re = [];
286
- for (let l = 0, d = D.length, m = d - 1, x = l + 1; l < d; l++, m++, x++)
287
- m === d && (m = 0), x === d && (x = 0), re[l] = Ae(D[l], D[m], D[x]);
288
- const ge = [];
289
- let q, ae = re.concat();
290
- for (let l = 0, d = pe; l < d; l++) {
291
- const m = j[l];
292
- q = [];
293
- for (let x = 0, b = m.length, M = b - 1, w = x + 1; x < b; x++, M++, w++)
294
- M === b && (M = 0), w === b && (w = 0), q[x] = Ae(m[x], m[M], m[w]);
295
- ge.push(q), ae = ae.concat(q);
327
+ const J = [];
328
+ for (let l = 0, d = U.length, p = d - 1, x = l + 1; l < d; l++, p++, x++)
329
+ p === d && (p = 0), x === d && (x = 0), J[l] = rt(U[l], U[p], U[x]);
330
+ const et = [];
331
+ let Q, dt = J.concat();
332
+ for (let l = 0, d = ht; l < d; l++) {
333
+ const p = B[l];
334
+ Q = [];
335
+ for (let x = 0, b = p.length, L = b - 1, M = x + 1; x < b; x++, L++, M++)
336
+ L === b && (L = 0), M === b && (M = 0), Q[x] = rt(p[x], p[L], p[M]);
337
+ et.push(Q), dt = dt.concat(Q);
296
338
  }
297
- let $;
298
- if (S === 0)
299
- $ = fe.triangulateShape(D, j);
339
+ let st;
340
+ if (w === 0)
341
+ st = xt.triangulateShape(U, B);
300
342
  else {
301
343
  const l = [], d = [];
302
- for (let m = 0; m < S; m++) {
303
- const x = m / S, b = u * Math.cos(x * Math.PI / 2), M = y * Math.sin(x * Math.PI / 2) + L;
304
- for (let w = 0, T = D.length; w < T; w++) {
305
- const G = te(D[w], re[w], M);
306
- N(G.x, G.y, -b), x === 0 && l.push(G);
344
+ for (let p = 0; p < w; p++) {
345
+ const x = p / w, b = u * Math.cos(x * Math.PI / 2), L = y * Math.sin(x * Math.PI / 2) + A;
346
+ for (let M = 0, T = U.length; M < T; M++) {
347
+ const G = $(U[M], J[M], L);
348
+ q(G.x, G.y, -b), x === 0 && l.push(G);
307
349
  }
308
- for (let w = 0, T = pe; w < T; w++) {
309
- const G = j[w];
310
- q = ge[w];
350
+ for (let M = 0, T = ht; M < T; M++) {
351
+ const G = B[M];
352
+ Q = et[M];
311
353
  const _ = [];
312
- for (let I = 0, J = G.length; I < J; I++) {
313
- const B = te(G[I], q[I], M);
314
- N(B.x, B.y, -b), x === 0 && _.push(B);
354
+ for (let X = 0, nt = G.length; X < nt; X++) {
355
+ const H = $(G[X], Q[X], L);
356
+ q(H.x, H.y, -b), x === 0 && _.push(H);
315
357
  }
316
358
  x === 0 && d.push(_);
317
359
  }
318
360
  }
319
- $ = fe.triangulateShape(
361
+ st = xt.triangulateShape(
320
362
  l,
321
363
  d
322
364
  );
323
365
  }
324
- const ce = $.length, Me = y + L;
325
- for (let l = 0; l < W; l++) {
326
- const d = g ? te(U[l], ae[l], Me) : U[l];
327
- Z ? (oe.copy(R.normals[0]).multiplyScalar(d.x), se.copy(R.binormals[0]).multiplyScalar(d.y), V.copy(X[0]).add(oe).add(se), N(V.x, V.y, V.z)) : N(d.x, d.y, 0);
366
+ const pt = st.length, Tt = y + A;
367
+ for (let l = 0; l < D; l++) {
368
+ const d = g ? $(I[l], dt[l], Tt) : I[l];
369
+ N ? (it.copy(C.normals[0]).multiplyScalar(d.x), Z.copy(C.binormals[0]).multiplyScalar(d.y), V.copy(O[0]).add(it).add(Z), q(V.x, V.y, V.z)) : q(d.x, d.y, 0);
328
370
  }
329
371
  for (let l = 1; l <= o; l++)
330
- for (let d = 0; d < W; d++) {
331
- const m = g ? te(U[d], ae[d], Me) : U[d];
332
- Z ? (oe.copy(R.normals[l]).multiplyScalar(m.x), se.copy(R.binormals[l]).multiplyScalar(m.y), V.copy(X[l]).add(oe).add(se), N(V.x, V.y, V.z)) : N(m.x, m.y, c / o * l);
372
+ for (let d = 0; d < D; d++) {
373
+ const p = g ? $(I[d], dt[d], Tt) : I[d];
374
+ N ? (it.copy(C.normals[l]).multiplyScalar(p.x), Z.copy(C.binormals[l]).multiplyScalar(p.y), V.copy(O[l]).add(it).add(Z), q(V.x, V.y, V.z)) : q(p.x, p.y, c / o * l);
333
375
  }
334
- for (let l = S - 1; l >= 0; l--) {
335
- const d = l / S, m = u * Math.cos(d * Math.PI / 2), x = y * Math.sin(d * Math.PI / 2) + L;
336
- for (let b = 0, M = D.length; b < M; b++) {
337
- const w = te(D[b], re[b], x);
338
- N(w.x, w.y, c + m);
376
+ for (let l = w - 1; l >= 0; l--) {
377
+ const d = l / w, p = u * Math.cos(d * Math.PI / 2), x = y * Math.sin(d * Math.PI / 2) + A;
378
+ for (let b = 0, L = U.length; b < L; b++) {
379
+ const M = $(U[b], J[b], x);
380
+ q(M.x, M.y, c + p);
339
381
  }
340
- for (let b = 0, M = j.length; b < M; b++) {
341
- const w = j[b];
342
- q = ge[b];
343
- for (let T = 0, G = w.length; T < G; T++) {
344
- const _ = te(w[T], q[T], x);
345
- Z ? N(
382
+ for (let b = 0, L = B.length; b < L; b++) {
383
+ const M = B[b];
384
+ Q = et[b];
385
+ for (let T = 0, G = M.length; T < G; T++) {
386
+ const _ = $(M[T], Q[T], x);
387
+ N ? q(
346
388
  _.x,
347
- _.y + X[o - 1].y,
348
- X[o - 1].x + m
349
- ) : N(_.x, _.y, c + m);
389
+ _.y + O[o - 1].y,
390
+ O[o - 1].x + p
391
+ ) : q(_.x, _.y, c + p);
350
392
  }
351
393
  }
352
394
  }
353
- Fe(), ee && qe();
354
- function Fe() {
355
- const l = s.length / 3;
395
+ Zt(), R && $t();
396
+ function Zt() {
397
+ const l = n.length / 3;
356
398
  if (g) {
357
- let d = 0, m = W * d;
358
- if (C)
359
- for (let x = 0; x < ce; x++) {
360
- const b = $[x];
361
- le(b[2] + m, b[1] + m, b[0] + m);
399
+ let d = 0, p = D * d;
400
+ if (P)
401
+ for (let x = 0; x < pt; x++) {
402
+ const b = st[x];
403
+ gt(b[2] + p, b[1] + p, b[0] + p);
362
404
  }
363
- if (d = o + S * 2, m = W * d, v)
364
- for (let x = 0; x < ce; x++) {
365
- const b = $[x];
366
- le(b[0] + m, b[1] + m, b[2] + m);
405
+ if (d = o + w * 2, p = D * d, S)
406
+ for (let x = 0; x < pt; x++) {
407
+ const b = st[x];
408
+ gt(b[0] + p, b[1] + p, b[2] + p);
367
409
  }
368
410
  } else {
369
- if (C)
370
- for (let d = 0; d < ce; d++) {
371
- const m = $[d];
372
- le(m[2], m[1], m[0]);
411
+ if (P)
412
+ for (let d = 0; d < pt; d++) {
413
+ const p = st[d];
414
+ gt(p[2], p[1], p[0]);
373
415
  }
374
- if (v)
375
- for (let d = 0; d < ce; d++) {
376
- const m = $[d];
377
- le(
378
- m[0] + W * o,
379
- m[1] + W * o,
380
- m[2] + W * o
416
+ if (S)
417
+ for (let d = 0; d < pt; d++) {
418
+ const p = st[d];
419
+ gt(
420
+ p[0] + D * o,
421
+ p[1] + D * o,
422
+ p[2] + D * o
381
423
  );
382
424
  }
383
425
  }
384
- n.addGroup(l, s.length / 3 - l, 0);
426
+ s.addGroup(l, n.length / 3 - l, 0);
385
427
  }
386
- function qe() {
387
- const l = s.length / 3;
428
+ function $t() {
429
+ const l = n.length / 3;
388
430
  let d = 0;
389
- Le(D, d), d += D.length;
390
- for (let m = 0, x = j.length; m < x; m++) {
391
- const b = j[m];
392
- Le(b, d), d += b.length;
431
+ Gt(U, d), d += U.length;
432
+ for (let p = 0, x = B.length; p < x; p++) {
433
+ const b = B[p];
434
+ Gt(b, d), d += b.length;
393
435
  }
394
- n.addGroup(l, s.length / 3 - l, 1);
436
+ s.addGroup(l, n.length / 3 - l, 1);
395
437
  }
396
- function Le(l, d) {
397
- let m = l.length;
398
- for (; --m >= 0; ) {
399
- const x = m;
400
- let b = m - 1;
438
+ function Gt(l, d) {
439
+ let p = l.length;
440
+ for (; --p >= 0; ) {
441
+ const x = p;
442
+ let b = p - 1;
401
443
  b < 0 && (b = l.length - 1);
402
- for (let M = 0, w = o + S * 2; M < w; M++) {
403
- const T = W * M, G = W * (M + 1), _ = d + x + T, I = d + b + T, J = d + b + G, B = d + x + G;
404
- Ye(_, I, J, B);
444
+ for (let L = 0, M = o + w * 2; L < M; L++) {
445
+ const T = D * L, G = D * (L + 1), _ = d + x + T, X = d + b + T, nt = d + b + G, H = d + x + G;
446
+ Jt(_, X, nt, H);
405
447
  }
406
448
  }
407
449
  }
408
- function N(l, d, m) {
409
- i.push(l), i.push(d), i.push(m);
450
+ function q(l, d, p) {
451
+ i.push(l), i.push(d), i.push(p);
410
452
  }
411
- function le(l, d, m) {
412
- k(l), k(d), k(m);
413
- const x = s.length / 3, b = P.generateTopUV(
414
- n,
453
+ function gt(l, d, p) {
454
+ F(l), F(d), F(p);
455
+ const x = n.length / 3, b = E.generateTopUV(
415
456
  s,
457
+ n,
416
458
  x - 3,
417
459
  x - 2,
418
460
  x - 1
419
461
  );
420
- F(b[0]), F(b[1]), F(b[2]);
462
+ Y(b[0]), Y(b[1]), Y(b[2]);
421
463
  }
422
- function Ye(l, d, m, x) {
423
- k(l), k(d), k(x), k(d), k(m), k(x);
424
- const b = s.length / 3, M = P.generateSideWallUV(
425
- n,
464
+ function Jt(l, d, p, x) {
465
+ F(l), F(d), F(x), F(d), F(p), F(x);
466
+ const b = n.length / 3, L = E.generateSideWallUV(
426
467
  s,
468
+ n,
427
469
  b - 6,
428
470
  b - 3,
429
471
  b - 2,
430
472
  b - 1
431
473
  );
432
- F(M[0]), F(M[1]), F(M[3]), F(M[1]), F(M[2]), F(M[3]);
433
- }
434
- function k(l) {
435
- s.push(i[l * 3 + 0]), s.push(i[l * 3 + 1]), s.push(i[l * 3 + 2]);
474
+ Y(L[0]), Y(L[1]), Y(L[3]), Y(L[1]), Y(L[2]), Y(L[3]);
436
475
  }
437
476
  function F(l) {
477
+ n.push(i[l * 3 + 0]), n.push(i[l * 3 + 1]), n.push(i[l * 3 + 2]);
478
+ }
479
+ function Y(l) {
438
480
  r.push(l.x), r.push(l.y);
439
481
  }
440
482
  }
441
483
  }
442
- copy(e) {
443
- return super.copy(e), this.parameters = Object.assign({}, e.parameters), this;
484
+ copy(t) {
485
+ return super.copy(t), this.parameters = Object.assign({}, t.parameters), this;
444
486
  }
445
487
  toJSON() {
446
- const e = super.toJSON(), t = this.parameters.shapes, n = this.parameters.options;
447
- return Ut(t, n, e);
488
+ const t = super.toJSON(), e = this.parameters.shapes, s = this.parameters.options;
489
+ return He(e, s, t);
448
490
  }
449
491
  /**
450
492
  * Factory method for creating an instance of this class from the given
@@ -454,131 +496,131 @@ class Q extends me {
454
496
  * @param {Array<Shape>} shapes - An array of shapes.
455
497
  * @return {ExtrudeGeometry} A new instance.
456
498
  */
457
- static fromJSON(e, t) {
458
- const n = [];
459
- for (let r = 0, a = e.shapes.length; r < a; r++) {
460
- const f = t[e.shapes[r]];
461
- n.push(f);
499
+ static fromJSON(t, e) {
500
+ const s = [];
501
+ for (let r = 0, a = t.shapes.length; r < a; r++) {
502
+ const f = e[t.shapes[r]];
503
+ s.push(f);
462
504
  }
463
- const s = e.options.extrudePath;
464
- return s !== void 0 && (e.options.extrudePath = new Bt[s.type]().fromJSON(
465
- s
466
- )), new Q(n, e.options);
505
+ const n = t.options.extrudePath;
506
+ return n !== void 0 && (t.options.extrudePath = new De[n.type]().fromJSON(
507
+ n
508
+ )), new ot(s, t.options);
467
509
  }
468
510
  }
469
- const Ot = {
470
- generateTopUV: function(p, e, t, n, s) {
471
- const r = e[t * 3], a = e[t * 3 + 1], f = e[n * 3], i = e[n * 3 + 1], h = e[s * 3], o = e[s * 3 + 1];
511
+ const Xe = {
512
+ generateTopUV: function(m, t, e, s, n) {
513
+ const r = t[e * 3], a = t[e * 3 + 1], f = t[s * 3], i = t[s * 3 + 1], h = t[n * 3], o = t[n * 3 + 1];
472
514
  return [
473
- new E(r, a),
474
- new E(f, i),
475
- new E(h, o)
515
+ new z(r, a),
516
+ new z(f, i),
517
+ new z(h, o)
476
518
  ];
477
519
  },
478
- generateSideWallUV: function(p, e, t, n, s, r) {
479
- const a = e[t * 3], f = e[t * 3 + 1], i = e[t * 3 + 2], h = e[n * 3], o = e[n * 3 + 1], c = e[n * 3 + 2], g = e[s * 3], u = e[s * 3 + 1], y = e[s * 3 + 2], L = e[r * 3], S = e[r * 3 + 1], A = e[r * 3 + 2];
520
+ generateSideWallUV: function(m, t, e, s, n, r) {
521
+ const a = t[e * 3], f = t[e * 3 + 1], i = t[e * 3 + 2], h = t[s * 3], o = t[s * 3 + 1], c = t[s * 3 + 2], g = t[n * 3], u = t[n * 3 + 1], y = t[n * 3 + 2], A = t[r * 3], w = t[r * 3 + 1], v = t[r * 3 + 2];
480
522
  return Math.abs(f - o) < Math.abs(a - h) ? [
481
- new E(a, 1 - i),
482
- new E(h, 1 - c),
483
- new E(g, 1 - y),
484
- new E(L, 1 - A)
523
+ new z(a, 1 - i),
524
+ new z(h, 1 - c),
525
+ new z(g, 1 - y),
526
+ new z(A, 1 - v)
485
527
  ] : [
486
- new E(f, 1 - i),
487
- new E(o, 1 - c),
488
- new E(u, 1 - y),
489
- new E(S, 1 - A)
528
+ new z(f, 1 - i),
529
+ new z(o, 1 - c),
530
+ new z(u, 1 - y),
531
+ new z(w, 1 - v)
490
532
  ];
491
533
  }
492
534
  };
493
- function Ut(p, e, t) {
494
- if (t.shapes = [], Array.isArray(p))
495
- for (let n = 0, s = p.length; n < s; n++) {
496
- const r = p[n];
497
- t.shapes.push(r.uuid);
535
+ function He(m, t, e) {
536
+ if (e.shapes = [], Array.isArray(m))
537
+ for (let s = 0, n = m.length; s < n; s++) {
538
+ const r = m[s];
539
+ e.shapes.push(r.uuid);
498
540
  }
499
541
  else
500
- t.shapes.push(p.uuid);
501
- return t.options = Object.assign({}, e), e.extrudePath !== void 0 && (t.options.extrudePath = e.extrudePath.toJSON()), t;
542
+ e.shapes.push(m.uuid);
543
+ return e.options = Object.assign({}, t), t.extrudePath !== void 0 && (e.options.extrudePath = t.extrudePath.toJSON()), e;
502
544
  }
503
- class Rt extends Q {
504
- constructor(e, t) {
505
- super(e, t);
506
- const n = new Re(
507
- new Q(e, ue(O({}, t), {
545
+ class We extends ot {
546
+ constructor(t, e) {
547
+ super(t, e);
548
+ const s = new Xt(
549
+ new ot(t, bt(W({}, e), {
508
550
  hasTop: !0,
509
551
  hasSide: !0,
510
552
  hasBottom: !1
511
553
  }))
512
554
  );
513
- n.updateMatrixWorld();
514
- const s = new pt().setFromObject(n), r = new z();
515
- s.getSize(r);
516
- const a = new z(
517
- s.min.x + r.x / 2,
518
- s.min.y + r.y / 2,
555
+ s.updateMatrixWorld();
556
+ const n = new xe().setFromObject(s), r = new j();
557
+ n.getSize(r);
558
+ const a = new j(
559
+ n.min.x + r.x / 2,
560
+ n.min.y + r.y / 2,
519
561
  0
520
562
  );
521
- let f = t.topSegments, i = t.box3;
563
+ let f = e.topSegments, i = e.box3;
522
564
  if (i) {
523
- i = i.union(s);
524
- const A = new z();
525
- i.getSize(A);
526
- const P = Math.max(
527
- r.x / A.x,
528
- r.y / A.y
565
+ i = i.union(n);
566
+ const v = new j();
567
+ i.getSize(v);
568
+ const E = Math.max(
569
+ r.x / v.x,
570
+ r.y / v.y
529
571
  );
530
- f = Math.ceil(t.topSegments * P);
572
+ f = Math.ceil(e.topSegments * E);
531
573
  }
532
574
  if (f < 4)
533
575
  return this;
534
- const h = new gt(
576
+ const h = new we(
535
577
  r.x,
536
578
  r.y,
537
579
  f,
538
580
  f
539
- ), o = new Re(h);
581
+ ), o = new Xt(h);
540
582
  o.position.set(a.x, a.y, a.z), o.updateMatrixWorld();
541
- const g = new zt().evaluate(o, n, Ct), u = g.geometry.getAttribute("position"), y = new xe(
583
+ const g = new Ie().evaluate(o, s, Be), u = g.geometry.getAttribute("position"), y = new ct(
542
584
  u.count * 2,
543
585
  2
544
586
  );
545
- for (let A = 0; A < u.count; A++) {
546
- const P = u.getZ(A);
547
- u.setZ(A, t.depth + P);
587
+ for (let v = 0; v < u.count; v++) {
588
+ const E = u.getZ(v);
589
+ u.setZ(v, e.depth + E);
548
590
  }
549
591
  if (i) {
550
- const A = i.min, P = i.max, v = new z().subVectors(P, A);
551
- for (let C = 0; C < u.count; C++) {
552
- const ee = u.getX(C), X = u.getY(C), Z = (ee - A.x) / v.x, R = (X - A.y) / v.y;
553
- y.setXY(C, Z, R);
592
+ const v = i.min, E = i.max, S = new j().subVectors(E, v);
593
+ for (let P = 0; P < u.count; P++) {
594
+ const R = u.getX(P), O = u.getY(P), N = (R - v.x) / S.x, C = (O - v.y) / S.y;
595
+ y.setXY(P, N, C);
554
596
  }
555
597
  g.geometry.setAttribute("uv", y);
556
598
  }
557
599
  u.needsUpdate = !0;
558
- const L = new Q(e, ue(O({}, t), {
600
+ const A = new ot(t, bt(W({}, e), {
559
601
  hasTop: !1
560
- })), S = H([g.geometry, L], 2);
561
- this.copy(S.toNonIndexed());
602
+ })), w = k([g.geometry, A], 2);
603
+ this.copy(w.toNonIndexed());
562
604
  }
563
605
  }
564
- const He = (p) => {
606
+ const Wt = (m) => {
565
607
  const {
566
- split: e,
567
- depth: t,
568
- points: n,
569
- box3: s,
608
+ split: t,
609
+ depth: e,
610
+ points: s,
611
+ box3: n,
570
612
  hasTop: r,
571
613
  hasBottom: a,
572
614
  hasSide: f,
573
615
  sideRepeat: i,
574
616
  topSegments: h
575
- } = p, o = h ? Rt : Q, c = new o(new we(n), {
576
- depth: t,
617
+ } = m, o = h ? We : ot, c = new o(new At(s), {
618
+ depth: e,
577
619
  bevelEnabled: !1,
578
- box3: s,
579
- UVGenerator: Et({
580
- split: e,
581
- box3: s,
620
+ box3: n,
621
+ UVGenerator: je({
622
+ split: t,
623
+ box3: n,
582
624
  sideRepeat: i
583
625
  }),
584
626
  hasTop: r,
@@ -586,21 +628,21 @@ const He = (p) => {
586
628
  hasSide: f,
587
629
  topSegments: h
588
630
  });
589
- return Pt(), c;
631
+ return Ce(), c;
590
632
  };
591
- class Qt extends K {
592
- constructor(e) {
593
- super(), this.options = O({
633
+ class ns extends tt {
634
+ constructor(t) {
635
+ super(), this.options = W({
594
636
  depth: 1
595
- }, e);
637
+ }, t);
596
638
  }
597
639
  create() {
598
- return ie(this, null, function* () {
640
+ return ut(this, null, function* () {
599
641
  const {
600
- points: e,
601
- pointsArr: t,
602
- useGroups: n,
603
- depth: s,
642
+ points: t,
643
+ pointsArr: e,
644
+ useGroups: s,
645
+ depth: n,
604
646
  geometry: r,
605
647
  geometryArr: a,
606
648
  material: f,
@@ -609,24 +651,24 @@ class Qt extends K {
609
651
  hasTop: o,
610
652
  hasBottom: c,
611
653
  hasSide: g
612
- } = this.options, u = Array.isArray(s) ? s : [s], y = Array.isArray(i) ? i : [i], L = f;
613
- let S = r;
614
- L || console.log("material is null"), !S && e ? S = He({
615
- points: e,
654
+ } = this.options, u = Array.isArray(n) ? n : [n], y = Array.isArray(i) ? i : [i], A = f;
655
+ let w = r;
656
+ A || console.log("material is null"), !w && t ? w = Wt({
657
+ points: t,
616
658
  depth: u[0],
617
659
  box3: y[0],
618
660
  split: h,
619
661
  hasTop: o,
620
662
  hasBottom: c,
621
663
  hasSide: g
622
- }) : !S && t ? S = H(
623
- t.map(
624
- (A, P) => {
625
- var v, C;
626
- return He({
627
- points: A,
628
- depth: (v = u[P]) != null ? v : u[0],
629
- box3: (C = y[P]) != null ? C : y[0],
664
+ }) : !w && e ? w = k(
665
+ e.map(
666
+ (v, E) => {
667
+ var S, P;
668
+ return Wt({
669
+ points: v,
670
+ depth: (S = u[E]) != null ? S : u[0],
671
+ box3: (P = y[E]) != null ? P : y[0],
630
672
  split: h,
631
673
  hasTop: o,
632
674
  hasBottom: c,
@@ -634,29 +676,29 @@ class Qt extends K {
634
676
  });
635
677
  }
636
678
  ),
637
- n != null ? n : 0
638
- ) : !S && a && a.length > 1 ? S = H(a, n != null ? n : 0) : !S && a && a.length === 1 && ([S] = a), this.createMesh(S, L);
679
+ s != null ? s : 0
680
+ ) : !w && a && a.length > 1 ? w = k(a, s != null ? s : 0) : !w && a && a.length === 1 && ([w] = a), this.createMesh(w, A);
639
681
  });
640
682
  }
641
- addGeometries(e) {
642
- const t = this.object3d, n = H([t.geometry, ...e]);
643
- t.geometry = n;
683
+ addGeometries(t) {
684
+ const e = this.object3d, s = k([e.geometry, ...t]);
685
+ e.geometry = s;
644
686
  }
645
- setTextureAnisotropic(e, t) {
646
- e.anisotropy = t || this.pencil.renderer.capabilities.getMaxAnisotropy();
687
+ setTextureAnisotropic(t, e) {
688
+ t.anisotropy = e || this.pencil.renderer.capabilities.getMaxAnisotropy();
647
689
  }
648
690
  }
649
- const Kt = (p) => {
691
+ const os = (m) => {
650
692
  const {
651
- topColor: e,
652
- sideColor: t,
653
- sideMap: n,
654
- createCanvasObjectURL: s,
693
+ topColor: t,
694
+ sideColor: e,
695
+ sideMap: s,
696
+ createCanvasObjectURL: n,
655
697
  split: r,
656
698
  maxAnisotropy: a
657
- } = p;
699
+ } = m;
658
700
  return new Promise((f) => {
659
- const i = n ? document.createElement("img") : {
701
+ const i = s ? document.createElement("img") : {
660
702
  src: "",
661
703
  onload: () => {
662
704
  },
@@ -665,134 +707,134 @@ const Kt = (p) => {
665
707
  };
666
708
  i.onload = () => {
667
709
  const h = r, o = document.createElement("canvas"), c = o.getContext("2d");
668
- o.height = i.height / (1 - h), o.width = i.width, h && e && (c.fillStyle = e, c.fillRect(0, 0, i.width, o.height * h)), n && i instanceof HTMLImageElement ? c.drawImage(i, 0, o.height * h, i.width, i.height) : t && (c.fillStyle = t, c.fillRect(0, o.height * h, i.width, i.height)), s && o.toBlob((u) => {
710
+ o.height = i.height / (1 - h), o.width = i.width, h && t && (c.fillStyle = t, c.fillRect(0, 0, i.width, o.height * h)), s && i instanceof HTMLImageElement ? c.drawImage(i, 0, o.height * h, i.width, i.height) : e && (c.fillStyle = e, c.fillRect(0, o.height * h, i.width, i.height)), n && o.toBlob((u) => {
669
711
  console.log(URL.createObjectURL(u));
670
712
  });
671
- const g = new yt(o);
713
+ const g = new ve(o);
672
714
  f(g);
673
- }, n ? i.src = n : i instanceof HTMLImageElement || i.onload();
715
+ }, s ? i.src = s : i instanceof HTMLImageElement || i.onload();
674
716
  });
675
717
  };
676
- class en extends K {
718
+ class is extends tt {
677
719
  create() {
678
720
  this.createGroup();
679
721
  }
680
722
  render() {
681
- this.object3d.raycast = (e, t) => e.intersectObjects(
723
+ this.object3d.raycast = (t, e) => t.intersectObjects(
682
724
  this.object3d.children,
683
725
  !0,
684
- t
726
+ e
685
727
  );
686
728
  }
687
729
  }
688
- class tn extends K {
689
- constructor(e) {
690
- super(), this.rectAreaLightUniformsLibInit = !1, this.options = e;
730
+ class rs extends tt {
731
+ constructor(t) {
732
+ super(), this.rectAreaLightUniformsLibInit = !1, this.options = t;
691
733
  }
692
734
  create() {
693
- var t, n, s, r, a, f, i, h, o, c, g, u, y, L, S, A, P;
694
- const e = this.options;
695
- if (e.type === "AmbientLight") {
696
- const v = new bt(e.color);
697
- v.name = "环境光", this.object3d = v;
698
- } else if (e.type === "DirectionalLight") {
699
- const v = new xt(e.color, e.intensity);
700
- v.name = "平行光", v.target.position.set(0, 0, 0), this.object3d = v, v.target.name = "平行光目标", v.shadow.camera.name = "平行光阴影相机", v.shadow.camera.userData.directionalLightShadow = !0, this.directionalLight = v;
701
- } else if (e.type === "PointLight") {
702
- const v = new wt(
703
- (t = e.color) != null ? t : 16777215,
704
- (n = e.intensity) != null ? n : 1,
705
- (s = e.distance) != null ? s : 0,
706
- (r = e.decay) != null ? r : 2
735
+ var e, s, n, r, a, f, i, h, o, c, g, u, y, A, w, v, E;
736
+ const t = this.options;
737
+ if (t.type === "AmbientLight") {
738
+ const S = new Se(t.color);
739
+ S.name = "环境光", this.object3d = S;
740
+ } else if (t.type === "DirectionalLight") {
741
+ const S = new Me(t.color, t.intensity);
742
+ S.name = "平行光", S.target.position.set(0, 0, 0), this.object3d = S, S.target.name = "平行光目标", S.shadow.camera.name = "平行光阴影相机", S.shadow.camera.userData.directionalLightShadow = !0, this.directionalLight = S;
743
+ } else if (t.type === "PointLight") {
744
+ const S = new Ae(
745
+ (e = t.color) != null ? e : 16777215,
746
+ (s = t.intensity) != null ? s : 1,
747
+ (n = t.distance) != null ? n : 0,
748
+ (r = t.decay) != null ? r : 2
707
749
  );
708
- v.name = "点光源", this.object3d = v, this.pointLight = v;
709
- } else if (e.type === "SpotLight") {
710
- const v = new vt(
711
- (a = e.color) != null ? a : 16777215,
712
- (f = e.intensity) != null ? f : 1,
713
- (i = e.distance) != null ? i : 0,
714
- (h = e.angle) != null ? h : Math.PI / 3,
715
- (o = e.penumbra) != null ? o : 1,
716
- (c = e.decay) != null ? c : 2
750
+ S.name = "点光源", this.object3d = S, this.pointLight = S;
751
+ } else if (t.type === "SpotLight") {
752
+ const S = new Le(
753
+ (a = t.color) != null ? a : 16777215,
754
+ (f = t.intensity) != null ? f : 1,
755
+ (i = t.distance) != null ? i : 0,
756
+ (h = t.angle) != null ? h : Math.PI / 3,
757
+ (o = t.penumbra) != null ? o : 1,
758
+ (c = t.decay) != null ? c : 2
717
759
  );
718
- v.name = "聚光灯", this.object3d = v, this.spotLight = v, v.target.name = "聚光灯目标";
719
- } else if (e.type === "HemisphereLight") {
720
- const v = new St(
721
- (g = e.color) != null ? g : 16777215,
722
- (u = e.groundColor) != null ? u : 16777215,
723
- (y = e.intensity) != null ? y : 1
760
+ S.name = "聚光灯", this.object3d = S, this.spotLight = S, S.target.name = "聚光灯目标";
761
+ } else if (t.type === "HemisphereLight") {
762
+ const S = new Te(
763
+ (g = t.color) != null ? g : 16777215,
764
+ (u = t.groundColor) != null ? u : 16777215,
765
+ (y = t.intensity) != null ? y : 1
724
766
  );
725
- v.name = "半球光", this.object3d = v, this.hemisphereLight = v;
726
- } else if (e.type === "RectAreaLight") {
727
- this.rectAreaLightUniformsLibInit || (jt.init(), this.rectAreaLightUniformsLibInit = !0);
728
- const v = new At(
729
- (L = e.color) != null ? L : 16777215,
730
- (S = e.intensity) != null ? S : 1,
731
- (A = e.width) != null ? A : 10,
732
- (P = e.height) != null ? P : 10
767
+ S.name = "半球光", this.object3d = S, this.hemisphereLight = S;
768
+ } else if (t.type === "RectAreaLight") {
769
+ this.rectAreaLightUniformsLibInit || (Re.init(), this.rectAreaLightUniformsLibInit = !0);
770
+ const S = new Ge(
771
+ (A = t.color) != null ? A : 16777215,
772
+ (w = t.intensity) != null ? w : 1,
773
+ (v = t.width) != null ? v : 10,
774
+ (E = t.height) != null ? E : 10
733
775
  );
734
- v.name = "矩形区域光", this.object3d = v, this.rectAreaLight = v;
776
+ S.name = "矩形区域光", this.object3d = S, this.rectAreaLight = S;
735
777
  }
736
778
  }
737
779
  render() {
738
- const e = this.object3d;
739
- e.target && this.pencil.scene.add(e.target);
740
- const t = this.pencil.cameraTarget;
780
+ const t = this.object3d;
781
+ t.target && this.pencil.scene.add(t.target);
782
+ const e = this.pencil.cameraTarget;
741
783
  if (this.spotLight || this.directionalLight) {
742
- const n = this.spotLight || this.directionalLight;
743
- n.position.copy(t), n.target.position.copy(t);
744
- } else this.pointLight && this.pointLight.position.copy(t);
784
+ const s = this.spotLight || this.directionalLight;
785
+ s.position.copy(e), s.target.position.copy(e);
786
+ } else this.pointLight && this.pointLight.position.copy(e);
745
787
  }
746
788
  dispose() {
747
- const e = this.object3d;
748
- e.target && this.pencil.scene.remove(e.target), super.dispose();
789
+ const t = this.object3d;
790
+ t.target && this.pencil.scene.remove(t.target), super.dispose();
749
791
  }
750
792
  }
751
- class Dt extends me {
752
- constructor(e = [], t = "none", n) {
753
- super(), this.type = "MeshLineGeometry", this.pointCount = 0, this._points = [], this.shape = "none", this.shapeFunction = (s) => 1, this.matrixWorld = new We(), this.shape = t, n && (this.shapeFunction = n), e.length > 0 && this.setPoints(e);
793
+ class Ve extends ft {
794
+ constructor(t = [], e = "none", s) {
795
+ super(), this.type = "MeshLineGeometry", this.pointCount = 0, this._points = [], this.shape = "none", this.shapeFunction = (n) => 1, this.matrixWorld = new qt(), this.shape = e, s && (this.shapeFunction = s), t.length > 0 && this.setPoints(t);
754
796
  }
755
- convertToVector3Array(e) {
756
- if (typeof e[0] == "number") {
757
- const t = [], n = e;
758
- for (let s = 0; s < n.length; s += 3)
759
- t.push(new z(n[s], n[s + 1], n[s + 2]));
760
- return t;
797
+ convertToVector3Array(t) {
798
+ if (typeof t[0] == "number") {
799
+ const e = [], s = t;
800
+ for (let n = 0; n < s.length; n += 3)
801
+ e.push(new j(s[n], s[n + 1], s[n + 2]));
802
+ return e;
761
803
  } else
762
- return e.map((t) => {
763
- if (t instanceof E)
764
- return new z(t.x, t.y, 0);
765
- if (t instanceof z)
766
- return t;
767
- if (Array.isArray(t) && t.length === 2)
768
- return new z(t[0], t[1], 0);
769
- if (Array.isArray(t) && t.length === 3)
770
- return new z(t[0], t[1], t[2]);
804
+ return t.map((e) => {
805
+ if (e instanceof z)
806
+ return new j(e.x, e.y, 0);
807
+ if (e instanceof j)
808
+ return e;
809
+ if (Array.isArray(e) && e.length === 2)
810
+ return new j(e[0], e[1], 0);
811
+ if (Array.isArray(e) && e.length === 3)
812
+ return new j(e[0], e[1], e[2]);
771
813
  }).filter(Boolean);
772
814
  }
773
- setMatrixWorld(e) {
774
- this.matrixWorld = e;
815
+ setMatrixWorld(t) {
816
+ this.matrixWorld = t;
775
817
  }
776
- setPoints(e, t) {
777
- !e || e.length === 0 || (this._points = this.convertToVector3Array(e), this.pointCount = this._points.length, t && (this.shapeFunction = t, this.shape = "custom"), this.initializeGeometry(), this.updateGeometry());
818
+ setPoints(t, e) {
819
+ !t || t.length === 0 || (this._points = this.convertToVector3Array(t), this.pointCount = this._points.length, e && (this.shapeFunction = e, this.shape = "custom"), this.initializeGeometry(), this.updateGeometry());
778
820
  }
779
821
  initializeGeometry() {
780
- const e = new Y(
822
+ const t = new K(
781
823
  new Float32Array(this.pointCount * 6),
782
824
  3
783
- ), t = new Y(
825
+ ), e = new K(
784
826
  new Float32Array(this.pointCount * 6),
785
827
  3
786
- ), n = new Y(new Float32Array(this.pointCount * 6), 3), s = new Y(
828
+ ), s = new K(new Float32Array(this.pointCount * 6), 3), n = new K(
787
829
  new Float32Array(this.pointCount * 2),
788
830
  1
789
- ), r = new Y(new Float32Array(this.pointCount * 2), 1), a = new Y(new Float32Array(this.pointCount * 2), 1), f = new Y(new Float32Array(this.pointCount * 4), 2), i = new Y(
831
+ ), r = new K(new Float32Array(this.pointCount * 2), 1), a = new K(new Float32Array(this.pointCount * 2), 1), f = new K(new Float32Array(this.pointCount * 4), 2), i = new K(
790
832
  new Uint16Array((this.pointCount - 1) * 6),
791
833
  1
792
834
  );
793
835
  this.shape === "taper" && (this.shapeFunction = (h) => 1 * Math.pow(4 * h * (1 - h), 1));
794
836
  for (let h = 0, o = 0, c = 0; h < this.pointCount; h += 1, o += 2, c += 6) {
795
- s.setX(o, h / this.pointCount), s.setX(o + 1, h / this.pointCount), r.setX(o, 1), r.setX(o + 1, -1);
837
+ n.setX(o, h / this.pointCount), n.setX(o + 1, h / this.pointCount), r.setX(o, 1), r.setX(o + 1, -1);
796
838
  const g = this.shape === "none" ? 1 : this.shapeFunction(h / (this.pointCount - 1));
797
839
  a.setX(o, g), a.setX(o + 1, g);
798
840
  const u = h / (this.pointCount - 1);
@@ -801,161 +843,161 @@ class Dt extends me {
801
843
  i.setX(c + 0, y + 0), i.setX(c + 1, y + 1), i.setX(c + 2, y + 2), i.setX(c + 3, y + 2), i.setX(c + 4, y + 1), i.setX(c + 5, y + 3);
802
844
  }
803
845
  }
804
- this.setAttribute("position", e), this.setAttribute("previous", t), this.setAttribute("next", n), this.setAttribute("counters", s), this.setAttribute("side", r), this.setAttribute("width", a), this.setAttribute("uv", f), this.setIndex(i);
846
+ this.setAttribute("position", t), this.setAttribute("previous", e), this.setAttribute("next", s), this.setAttribute("counters", n), this.setAttribute("side", r), this.setAttribute("width", a), this.setAttribute("uv", f), this.setIndex(i);
805
847
  }
806
848
  updateGeometry() {
807
849
  if (!this._points[0]) return;
808
- const e = this.getAttribute("position"), t = this.getAttribute("previous"), n = this.getAttribute("next");
809
- let s = 0, r = 0, a = 0;
850
+ const t = this.getAttribute("position"), e = this.getAttribute("previous"), s = this.getAttribute("next");
851
+ let n = 0, r = 0, a = 0;
810
852
  const f = this._points[0];
811
- t.setXYZ(r, f.x, f.y, f.z), r += 1, t.setXYZ(r, f.x, f.y, f.z), r += 1;
853
+ e.setXYZ(r, f.x, f.y, f.z), r += 1, e.setXYZ(r, f.x, f.y, f.z), r += 1;
812
854
  for (let h = 0; h < this.pointCount; h++) {
813
855
  const o = this._points[h];
814
- e.setXYZ(s, o.x, o.y, o.z), s += 1, e.setXYZ(s, o.x, o.y, o.z), s += 1, h < this.pointCount - 1 && (t.setXYZ(r, o.x, o.y, o.z), r += 1, t.setXYZ(r, o.x, o.y, o.z), r += 1), h > 0 && h + 1 <= this.pointCount && (n.setXYZ(a, o.x, o.y, o.z), a += 1, n.setXYZ(a, o.x, o.y, o.z), a += 1);
856
+ t.setXYZ(n, o.x, o.y, o.z), n += 1, t.setXYZ(n, o.x, o.y, o.z), n += 1, h < this.pointCount - 1 && (e.setXYZ(r, o.x, o.y, o.z), r += 1, e.setXYZ(r, o.x, o.y, o.z), r += 1), h > 0 && h + 1 <= this.pointCount && (s.setXYZ(a, o.x, o.y, o.z), a += 1, s.setXYZ(a, o.x, o.y, o.z), a += 1);
815
857
  }
816
858
  const i = this._points[this.pointCount - 1];
817
- n.setXYZ(a, i.x, i.y, i.z), a += 1, n.setXYZ(a, i.x, i.y, i.z), a += 1, e.needsUpdate = !0, t.needsUpdate = !0, n.needsUpdate = !0, this.computeBoundingSphere(), this.computeBoundingBox();
859
+ s.setXYZ(a, i.x, i.y, i.z), a += 1, s.setXYZ(a, i.x, i.y, i.z), a += 1, t.needsUpdate = !0, e.needsUpdate = !0, s.needsUpdate = !0, this.computeBoundingSphere(), this.computeBoundingBox();
818
860
  }
819
861
  get points() {
820
862
  return this._points;
821
863
  }
822
- set points(e) {
823
- this.setPoints(e);
864
+ set points(t) {
865
+ this.setPoints(t);
824
866
  }
825
- updatePoints(e, t) {
826
- const n = this.convertToVector3Array(e);
827
- if (n.length !== this.pointCount) {
867
+ updatePoints(t, e) {
868
+ const s = this.convertToVector3Array(t);
869
+ if (s.length !== this.pointCount) {
828
870
  console.warn(
829
871
  "MeshLineGeometry: Cannot update points with different length. Use setPoints() instead."
830
872
  );
831
873
  return;
832
874
  }
833
- this._points = n, t && (this.shapeFunction = t, this.shape = "custom", this.initializeGeometry()), this.updateGeometry();
875
+ this._points = s, e && (this.shapeFunction = e, this.shape = "custom", this.initializeGeometry()), this.updateGeometry();
834
876
  }
835
- setShape(e, t) {
836
- this.shape = e, t && (this.shapeFunction = t), this._points.length > 0 && (this.initializeGeometry(), this.updateGeometry());
877
+ setShape(t, e) {
878
+ this.shape = t, e && (this.shapeFunction = e), this._points.length > 0 && (this.initializeGeometry(), this.updateGeometry());
837
879
  }
838
880
  }
839
- function nn(p, e) {
840
- const t = new We(), n = new Mt(), s = new Lt(), r = new z(), a = this.geometry;
841
- if (s.copy(a.boundingSphere), s.applyMatrix4(this.matrixWorld), !p.ray.intersectSphere(s, r)) return;
842
- t.copy(this.matrixWorld).invert(), n.copy(p.ray).applyMatrix4(t);
843
- const f = new z(), i = new z(), h = new z(), o = this instanceof Ne ? 2 : 1, c = a.index, g = a.attributes;
881
+ function as(m, t) {
882
+ const e = new qt(), s = new Ee(), n = new _e(), r = new j(), a = this.geometry;
883
+ if (n.copy(a.boundingSphere), n.applyMatrix4(this.matrixWorld), !m.ray.intersectSphere(n, r)) return;
884
+ e.copy(this.matrixWorld).invert(), s.copy(m.ray).applyMatrix4(e);
885
+ const f = new j(), i = new j(), h = new j(), o = this instanceof Ft ? 2 : 1, c = a.index, g = a.attributes;
844
886
  if (c !== null) {
845
- const u = c.array, y = g.position.array, L = g.width.array;
846
- for (let S = 0, A = u.length - 1; S < A; S += o) {
847
- const P = u[S], v = u[S + 1];
848
- f.fromArray(y, P * 3), i.fromArray(y, v * 3);
849
- const C = L[Math.floor(S / 3)] !== void 0 ? L[Math.floor(S / 3)] : 1, ee = p.params.Line.threshold + this.material.lineWidth * C / 2, X = ee * ee;
850
- if (n.distanceSqToSegment(
887
+ const u = c.array, y = g.position.array, A = g.width.array;
888
+ for (let w = 0, v = u.length - 1; w < v; w += o) {
889
+ const E = u[w], S = u[w + 1];
890
+ f.fromArray(y, E * 3), i.fromArray(y, S * 3);
891
+ const P = A[Math.floor(w / 3)] !== void 0 ? A[Math.floor(w / 3)] : 1, R = m.params.Line.threshold + this.material.lineWidth * P / 2, O = R * R;
892
+ if (s.distanceSqToSegment(
851
893
  f,
852
894
  i,
853
895
  r,
854
896
  h
855
- ) > X) continue;
897
+ ) > O) continue;
856
898
  r.applyMatrix4(this.matrixWorld);
857
- const R = p.ray.origin.distanceTo(r);
858
- R < p.near || R > p.far || (e.push({
859
- distance: R,
899
+ const C = m.ray.origin.distanceTo(r);
900
+ C < m.near || C > m.far || (t.push({
901
+ distance: C,
860
902
  // What do we want? intersection point on the ray or on the segment??
861
903
  // point: raycaster.ray.at( distance ),
862
904
  point: h.clone().applyMatrix4(this.matrixWorld),
863
- index: S,
905
+ index: w,
864
906
  face: null,
865
907
  faceIndex: void 0,
866
908
  object: this
867
- }), S = A);
909
+ }), w = v);
868
910
  }
869
911
  }
870
912
  }
871
- const be = (p) => {
872
- const { setPointWidth: e, nodes: t } = p, n = new Dt();
873
- return n.setPoints(t, e), n;
874
- }, Xe = /* @__PURE__ */ new WeakMap(), de = /* @__PURE__ */ new Map();
875
- let sn = class extends K {
876
- constructor(e = {}) {
877
- super(), this.options = O({}, e);
913
+ const Mt = (m) => {
914
+ const { setPointWidth: t, nodes: e } = m, s = new Ve();
915
+ return s.setPoints(e, t), s;
916
+ }, Vt = /* @__PURE__ */ new WeakMap(), wt = /* @__PURE__ */ new Map();
917
+ let cs = class extends tt {
918
+ constructor(t = {}) {
919
+ super(), this.options = W({}, t);
878
920
  }
879
921
  get material() {
880
- var e;
881
- return (e = this.object3d) == null ? void 0 : e.material;
922
+ var t;
923
+ return (t = this.object3d) == null ? void 0 : t.material;
882
924
  }
883
925
  create() {
884
- return ie(this, null, function* () {
926
+ return ut(this, null, function* () {
885
927
  const {
886
- nodes: e,
887
- nodesArr: t,
888
- geometry: n,
889
- geometryArr: s,
928
+ nodes: t,
929
+ nodesArr: e,
930
+ geometry: s,
931
+ geometryArr: n,
890
932
  material: r,
891
933
  useGroups: a,
892
934
  setPointWidth: f,
893
935
  lineWidthArr: i,
894
936
  materialParameters: h
895
937
  } = this.options;
896
- let o = r, c = n;
897
- !o && h && (o = this.getMaterial(h)), !c && e ? c = be({
898
- nodes: e,
938
+ let o = r, c = s;
939
+ !o && h && (o = this.getMaterial(h)), !c && t ? c = Mt({
940
+ nodes: t,
899
941
  setPointWidth: f
900
- }) : !c && t ? c = H(
901
- t.map((g, u) => {
942
+ }) : !c && e ? c = k(
943
+ e.map((g, u) => {
902
944
  let y = f;
903
945
  return !y && i && (y = () => {
904
- var L;
905
- return (L = i[u]) != null ? L : i[0];
906
- }), be({
946
+ var A;
947
+ return (A = i[u]) != null ? A : i[0];
948
+ }), Mt({
907
949
  nodes: g,
908
950
  setPointWidth: y
909
951
  });
910
952
  }),
911
953
  a != null ? a : 0
912
- ) : !c && s && s.length > 1 ? c = H(s, a != null ? a : 0) : !c && s && s.length === 1 && ([c] = s), this.createMesh(c, o);
954
+ ) : !c && n && n.length > 1 ? c = k(n, a != null ? a : 0) : !c && n && n.length === 1 && ([c] = n), this.createMesh(c, o);
913
955
  });
914
956
  }
915
- setGeometry(e, t) {
916
- const n = be({
917
- nodes: e,
918
- setPointWidth: t
919
- }), s = this.object3d, r = s.geometry;
920
- s.geometry = n, r.dispose();
957
+ setGeometry(t, e) {
958
+ const s = Mt({
959
+ nodes: t,
960
+ setPointWidth: e
961
+ }), n = this.object3d, r = n.geometry;
962
+ n.geometry = s, r.dispose();
921
963
  }
922
- getMaterial(e) {
923
- const { width: t, height: n } = this.pencil.getSize(), s = new st(O({
924
- color: new ke("#ffffff")
925
- }, e));
926
- return s.uniforms.resolution.value.set(t, n), s;
964
+ getMaterial(t) {
965
+ const { width: e, height: s } = this.pencil.getSize(), n = new re(W({
966
+ color: new Yt("#ffffff")
967
+ }, t));
968
+ return n.uniforms.resolution.value.set(e, s), n;
927
969
  }
928
- addGeometries(e) {
929
- const t = this.object3d, n = H([t.geometry, ...e]);
930
- t.geometry = n;
970
+ addGeometries(t) {
971
+ const e = this.object3d, s = k([e.geometry, ...t]);
972
+ e.geometry = s;
931
973
  }
932
- resize(e, t) {
933
- var n, s;
934
- (s = (n = this.material) == null ? void 0 : n.uniforms) == null || s.resolution.value.set(e, t);
974
+ resize(t, e) {
975
+ var s, n;
976
+ (n = (s = this.material) == null ? void 0 : s.uniforms) == null || n.resolution.value.set(t, e);
935
977
  }
936
- handleMaterialChange(e) {
937
- if (e) {
938
- const { width: t, height: n } = this.pencil.getSize();
939
- this.resize(t, n);
978
+ handleMaterialChange(t) {
979
+ if (t) {
980
+ const { width: e, height: s } = this.pencil.getSize();
981
+ this.resize(e, s);
940
982
  }
941
983
  }
942
984
  animate({
943
- duration: e = 1e3,
944
- delay: t = 0,
945
- repeat: n = 0,
946
- lineLoop: s,
985
+ duration: t = 1e3,
986
+ delay: e = 0,
987
+ repeat: s = 0,
988
+ lineLoop: n,
947
989
  onRepeat: r,
948
990
  onUpdate: a,
949
991
  onComplete: f,
950
992
  startShow: i
951
993
  } = {}) {
952
- const { offset: h, offsetLoop: o } = this.material.uniforms, c = this.pencil.userData.debugLine ? de : Xe;
953
- if (c.get(this.material) && this.stopAnimation(), e === 0) return;
954
- const g = s != null ? s : !0;
994
+ const { offset: h, offsetLoop: o } = this.material.uniforms, c = this.pencil.userData.debugLine ? wt : Vt;
995
+ if (c.get(this.material) && this.stopAnimation(), t === 0) return;
996
+ const g = n != null ? n : !0;
955
997
  h.value.x = 1, o.value = g && i ? 1 : 0;
956
998
  let u = 0;
957
- const y = new ne.Tween(h.value).to({ x: -1 }, e).delay(t).repeat(n).onUpdate(({ x: L }) => {
958
- g && L <= 0 && o.value === 0 && (o.value = 1), a == null || a(L);
999
+ const y = new at.Tween(h.value).to({ x: -1 }, t).delay(e).repeat(s).onUpdate(({ x: A }) => {
1000
+ g && A <= 0 && o.value === 0 && (o.value = 1), a == null || a(A);
959
1001
  }).onRepeat(() => {
960
1002
  u += 1, r == null || r(u);
961
1003
  }).onComplete(() => {
@@ -963,36 +1005,36 @@ let sn = class extends K {
963
1005
  }).start();
964
1006
  c.set(this.material, y), this.material.addEventListener("dispose", () => {
965
1007
  this.stopAnimation();
966
- }), this.pencil.userData.debugLine && console.log("animate", de.size);
1008
+ }), this.pencil.userData.debugLine && console.log("animate", wt.size);
967
1009
  }
968
1010
  stopAnimation() {
969
- const e = this.pencil.userData.debugLine ? de : Xe, t = e.get(this.material);
970
- t && (t.stop(), ne.remove(t), e.delete(this.material), this.material.uniforms.offset.value.x = 0, this.material.uniforms.offsetLoop.value = 1), this.pencil.userData.debugLine && console.log("stopAnimation", de.size);
1011
+ const t = this.pencil.userData.debugLine ? wt : Vt, e = t.get(this.material);
1012
+ e && (e.stop(), at.remove(e), t.delete(this.material), this.material.uniforms.offset.value.x = 0, this.material.uniforms.offsetLoop.value = 1), this.pencil.userData.debugLine && console.log("stopAnimation", wt.size);
971
1013
  }
972
1014
  render() {
973
- const { width: e, height: t } = this.pencil.getSize();
974
- this.resize(e, t);
1015
+ const { width: t, height: e } = this.pencil.getSize();
1016
+ this.resize(t, e);
975
1017
  }
976
1018
  };
977
- const Ve = (p) => {
978
- const { points: e } = p, t = e.reduce((s, r, a) => (a < e.length - 1 && s.push(r, e[a + 1]), s), []);
979
- return new me().setFromPoints(t);
1019
+ const Nt = (m) => {
1020
+ const { points: t } = m, e = t.reduce((n, r, a) => (a < t.length - 1 && n.push(r, t[a + 1]), n), []);
1021
+ return new ft().setFromPoints(e);
980
1022
  };
981
- class rn extends K {
982
- constructor(e = {}) {
983
- super(), this.options = O({}, e);
1023
+ class hs extends tt {
1024
+ constructor(t = {}) {
1025
+ super(), this.options = W({}, t);
984
1026
  }
985
1027
  get material() {
986
- var e;
987
- return (e = this.object3d) == null ? void 0 : e.material;
1028
+ var t;
1029
+ return (t = this.object3d) == null ? void 0 : t.material;
988
1030
  }
989
1031
  create() {
990
- return ie(this, null, function* () {
1032
+ return ut(this, null, function* () {
991
1033
  const {
992
- points: e,
993
- pointsArr: t,
994
- geometry: n,
995
- geometryArr: s,
1034
+ points: t,
1035
+ pointsArr: e,
1036
+ geometry: s,
1037
+ geometryArr: n,
996
1038
  material: r,
997
1039
  useGroups: a,
998
1040
  setPointWidth: f,
@@ -1000,109 +1042,110 @@ class rn extends K {
1000
1042
  materialParameters: h,
1001
1043
  instanceCount: o
1002
1044
  } = this.options;
1003
- let c = r, g = n;
1004
- !c && h && (c = this.getMaterial(h)), !g && e ? g = Ve({
1005
- points: e
1006
- }) : !g && t ? g = H(
1007
- t.map((y) => Ve({
1045
+ let c = r, g = s;
1046
+ !c && h && (c = this.getMaterial(h)), !g && t ? g = Nt({
1047
+ points: t
1048
+ }) : !g && e ? g = k(
1049
+ e.map((y) => Nt({
1008
1050
  points: y
1009
1051
  })),
1010
1052
  a != null ? a : 0
1011
- ) : !g && s && s.length > 1 ? g = H(s, a != null ? a : 0) : !g && s && s.length === 1 && ([g] = s);
1012
- const u = new tt().fromLineSegments(
1013
- new Ne(g)
1053
+ ) : !g && n && n.length > 1 ? g = k(n, a != null ? a : 0) : !g && n && n.length === 1 && ([g] = n);
1054
+ const u = new oe().fromLineSegments(
1055
+ new Ft(g)
1014
1056
  );
1015
1057
  if (this.pencil.options.WebGPUTHREE) {
1016
1058
  o && (u.instanceCount = o);
1017
- const y = new ot(u, c);
1059
+ const y = new ae(u, c);
1018
1060
  y.computeLineDistances(), this.object3d = y;
1019
1061
  } else {
1020
- const y = new It(u, c);
1062
+ const y = new Oe(u, c);
1021
1063
  y.computeLineDistances(), this.object3d = y;
1022
1064
  }
1023
1065
  });
1024
1066
  }
1025
- getMaterial(e) {
1026
- return new et(O({
1027
- color: new ke("#ffffff")
1028
- }, e));
1067
+ getMaterial(t) {
1068
+ return new ne(W({
1069
+ color: new Yt("#ffffff")
1070
+ }, t));
1029
1071
  }
1030
1072
  }
1031
- class an extends K {
1032
- constructor(e) {
1033
- super(), this.options = O({
1073
+ class us extends tt {
1074
+ constructor(t) {
1075
+ super(), this.options = W({
1034
1076
  maxDepth: 10,
1035
1077
  percentDepth: !1,
1036
1078
  innerRadius: 25,
1037
1079
  outRadius: 42,
1038
1080
  activeIndex: -1
1039
- }, e);
1081
+ }, t);
1040
1082
  }
1041
1083
  create() {
1042
- return ie(this, null, function* () {
1084
+ return ut(this, null, function* () {
1043
1085
  this.createGroup();
1044
- const { data: e, maxDepth: t, colors: n, material: s, percentDepth: r, activeIndex: a } = this.options, f = Math.max(...e), i = e.reduce((o, c) => o + c, 0);
1086
+ const { data: t, maxDepth: e, colors: s, material: n, percentDepth: r, activeIndex: a } = this.options, f = Math.max(...t), i = t.reduce((o, c) => o + c, 0);
1045
1087
  let h = Math.PI / 2;
1046
- e.forEach((o, c) => {
1088
+ t.forEach((o, c) => {
1047
1089
  if (o === 0) return;
1048
- const g = Math.PI * 2 * (o / i), u = n[c], y = r ? t * (o / f) : t, L = this.createGeometry(y, g), S = s ? s.clone() : new Tt({
1090
+ const g = Math.PI * 2 * (o / i), u = s[c], y = r ? e * (o / f) : e, A = this.createGeometry(y, g), w = n ? n.clone() : new Pe({
1049
1091
  color: u
1050
1092
  });
1051
- s && S.color.set(u);
1052
- const A = new Gt(L, S);
1053
- A.userData.depth = y, A.userData.index = c, A.rotateZ(h), h += g, this.add(A);
1093
+ n && w.color.set(u);
1094
+ const v = new kt(A, w);
1095
+ v.userData.depth = y, v.userData.index = c, v.rotateZ(h), h += g, this.add(v);
1054
1096
  }), a !== -1 && this.setActive(a);
1055
1097
  });
1056
1098
  }
1057
- createGeometry(e, t) {
1058
- const { outRadius: n, innerRadius: s } = this.options, r = new we();
1059
- return r.moveTo(n, 0), r.lineTo(s, 0), r.absarc(0, 0, s, 0, t, !1), r.absarc(0, 0, n, t, 0, !0), new Q(r, {
1099
+ createGeometry(t, e) {
1100
+ const { outRadius: s, innerRadius: n } = this.options, r = new At();
1101
+ return r.moveTo(s, 0), r.lineTo(n, 0), r.absarc(0, 0, n, 0, e, !1), r.absarc(0, 0, s, e, 0, !0), new ot(r, {
1060
1102
  curveSegments: 48,
1061
- depth: e,
1103
+ depth: t,
1062
1104
  bevelEnabled: !1
1063
1105
  });
1064
1106
  }
1065
- handlePick(e, t = 1.3) {
1066
- const { object: n } = this.pencil.pick(e, this.object3d.children) || {}, s = n ? this.object3d.children.findIndex((r) => r === n) : this.options.activeIndex;
1067
- return this.setActive(s, t);
1107
+ handlePick(t, e = 1.3) {
1108
+ const { object: s } = this.pencil.pick(t, this.object3d.children) || {}, n = s ? this.object3d.children.findIndex((r) => r === s) : this.options.activeIndex;
1109
+ return this.setActive(n, e);
1068
1110
  }
1069
- setActive(e, t = 1.3) {
1070
- const n = this.object3d.children[e];
1071
- if (this.object3d.children.forEach((s) => {
1072
- if (!(n && n === s) && s.scale.z !== 1) {
1073
- if (s.userData.levTween) return;
1074
- s.userData.enTween && (s.userData.enTween.stop(), s.userData.enTween = null);
1075
- const r = new ne.Tween(s.scale).to({ z: 1 }, 100);
1076
- s.userData.levTween = r, r.start();
1111
+ setActive(t, e = 1.3) {
1112
+ const s = this.object3d.children[t];
1113
+ if (this.object3d.children.forEach((n) => {
1114
+ if (!(s && s === n) && n.scale.z !== 1) {
1115
+ if (n.userData.levTween) return;
1116
+ n.userData.enTween && (n.userData.enTween.stop(), n.userData.enTween = null);
1117
+ const r = new at.Tween(n.scale).to({ z: 1 }, 100);
1118
+ n.userData.levTween = r, r.start();
1077
1119
  }
1078
- }), n) {
1079
- if (n.userData.enTween)
1120
+ }), s) {
1121
+ if (s.userData.enTween)
1080
1122
  return;
1081
- n.userData.levTween && (n.userData.levTween.stop(), n.userData.levTween = null);
1082
- const s = new ne.Tween(n.scale).to({ z: t }, 100);
1083
- return n.userData.enTween = s, s.start(), n.userData.index;
1123
+ s.userData.levTween && (s.userData.levTween.stop(), s.userData.levTween = null);
1124
+ const n = new at.Tween(s.scale).to({ z: e }, 100);
1125
+ return s.userData.enTween = n, n.start(), s.userData.index;
1084
1126
  }
1085
1127
  return -1;
1086
1128
  }
1087
1129
  render() {
1088
- this.object3d.scale.z = 0, new ne.Tween(this.object3d.scale).to({ z: 1 }, 1e3).easing(ne.Easing.Sinusoidal.InOut).start();
1130
+ this.object3d.scale.z = 0, new at.Tween(this.object3d.scale).to({ z: 1 }, 1e3).easing(at.Easing.Sinusoidal.InOut).start();
1089
1131
  }
1090
1132
  }
1091
1133
  export {
1092
- Jt as ConicPolygon,
1093
- Qt as ExtrudePolygon,
1094
- en as Group,
1095
- tn as Light,
1096
- sn as Line,
1097
- rn as Line2,
1098
- hn as Line2Material,
1099
- fn as LineSegmentsGeometry,
1100
- Dt as MeshLineGeometry,
1101
- st as MeshLineMaterial,
1102
- nn as MeshLineRaycast,
1103
- mn as Node,
1104
- an as Pie,
1105
- nt as getConicPolygonGeometry,
1106
- pn as getConicPolygonGeometryMetas,
1107
- Kt as getSplitTexture
1134
+ es as ConicPolygon,
1135
+ ss as Ellipsoid,
1136
+ ns as ExtrudePolygon,
1137
+ is as Group,
1138
+ rs as Light,
1139
+ cs as Line,
1140
+ hs as Line2,
1141
+ ds as Line2Material,
1142
+ gs as LineSegmentsGeometry,
1143
+ Ve as MeshLineGeometry,
1144
+ re as MeshLineMaterial,
1145
+ as as MeshLineRaycast,
1146
+ bs as Node,
1147
+ us as Pie,
1148
+ ie as getConicPolygonGeometry,
1149
+ xs as getConicPolygonGeometryMetas,
1150
+ os as getSplitTexture
1108
1151
  };