gl-draw 0.15.25 → 0.15.26

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