gl-draw 0.14.33 → 0.14.35

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