gl-draw 0.15.0-beta.3 → 0.15.0-beta.30

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