gl-draw 0.17.0-beta.40 → 0.17.0-beta.42

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