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.
- package/dist/objects/index.js +1 -1
- package/dist/objects/index.module.js +374 -371
- package/dist/objects/line/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var $e = Object.defineProperty, Je = Object.defineProperties;
|
|
2
|
+
var Qe = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var he = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
5
|
-
var
|
|
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
|
-
|
|
7
|
+
Be.call(e, t) && Ie(p, t, e[t]);
|
|
8
8
|
if (he)
|
|
9
9
|
for (var t of he(e))
|
|
10
|
-
|
|
11
|
-
return
|
|
12
|
-
}, ue = (
|
|
13
|
-
var
|
|
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
|
|
16
|
-
|
|
17
|
-
if (
|
|
18
|
-
for (var n of he(
|
|
19
|
-
e.indexOf(n) < 0 &&
|
|
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
|
|
23
|
-
var
|
|
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(
|
|
36
|
-
f((t = t.apply(
|
|
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
|
|
39
|
-
import { LineMaterial as
|
|
40
|
-
import { LineSegmentsGeometry as
|
|
41
|
-
import { LineSegmentsGeometry as
|
|
42
|
-
import { P as
|
|
43
|
-
import { g as
|
|
44
|
-
import { BufferGeometry as
|
|
45
|
-
import { mergeAttributes as Re, mergeGroups as
|
|
46
|
-
import { g as
|
|
47
|
-
import { Brush as
|
|
48
|
-
import { RectAreaLightUniformsLib as
|
|
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
|
|
51
|
-
function V(
|
|
52
|
-
const t =
|
|
53
|
-
Object.keys(
|
|
54
|
-
),
|
|
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
|
|
57
|
-
const c =
|
|
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 " +
|
|
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 " +
|
|
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
|
-
|
|
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 " +
|
|
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 " +
|
|
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 " +
|
|
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 " +
|
|
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,
|
|
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
|
|
110
|
+
let i = 0;
|
|
111
111
|
const c = [];
|
|
112
|
-
for (let y = 0; y <
|
|
113
|
-
const u =
|
|
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) +
|
|
116
|
-
|
|
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
|
|
121
|
-
const c = Re(i
|
|
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 " +
|
|
124
|
+
"THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + i + " attribute."
|
|
125
125
|
), null;
|
|
126
|
-
r.setAttribute(
|
|
126
|
+
r.setAttribute(i, c);
|
|
127
127
|
}
|
|
128
|
-
for (const
|
|
129
|
-
const c = a[
|
|
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[
|
|
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[
|
|
135
|
-
u.push(a[
|
|
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 " +
|
|
139
|
+
"THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + i + " morphAttribute."
|
|
140
140
|
), null;
|
|
141
|
-
r.morphAttributes[
|
|
141
|
+
r.morphAttributes[i].push(g);
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
return e === 2 ?
|
|
144
|
+
return e === 2 ? Et(r) : r;
|
|
145
145
|
}
|
|
146
|
-
const
|
|
147
|
-
const f =
|
|
148
|
-
let
|
|
149
|
-
return typeof t != "undefined" && typeof n != "undefined" && (
|
|
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:
|
|
151
|
+
endHeight: o
|
|
152
152
|
}));
|
|
153
153
|
};
|
|
154
|
-
class
|
|
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:
|
|
165
|
-
} = r, a =
|
|
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 =
|
|
174
|
+
f = He(j({
|
|
175
175
|
coordinate: n
|
|
176
176
|
}, a));
|
|
177
177
|
else if (!f && t) {
|
|
178
178
|
const h = t.map(
|
|
179
|
-
(
|
|
180
|
-
coordinate:
|
|
179
|
+
(i) => He(j({
|
|
180
|
+
coordinate: i
|
|
181
181
|
}, a))
|
|
182
182
|
);
|
|
183
|
-
f = V(h,
|
|
183
|
+
f = V(h, o != null ? o : 0);
|
|
184
184
|
}
|
|
185
185
|
this.createMesh(f, s);
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
const
|
|
189
|
-
ArcCurve:
|
|
188
|
+
const It = {
|
|
189
|
+
ArcCurve: it,
|
|
190
190
|
CatmullRomCurve3: ot,
|
|
191
|
-
CubicBezierCurve:
|
|
192
|
-
CubicBezierCurve3:
|
|
193
|
-
EllipseCurve:
|
|
194
|
-
LineCurve:
|
|
195
|
-
LineCurve3:
|
|
196
|
-
QuadraticBezierCurve:
|
|
197
|
-
QuadraticBezierCurve3:
|
|
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
|
|
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
|
|
208
|
-
new
|
|
209
|
-
new
|
|
210
|
-
new
|
|
211
|
-
new
|
|
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 = [],
|
|
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
|
|
222
|
+
this.setAttribute("position", new xe(s, 3)), this.setAttribute("uv", new xe(o, 2)), this.computeVertexNormals();
|
|
223
223
|
function a(f) {
|
|
224
|
-
var
|
|
225
|
-
const r = [], h = t.curveSegments !== void 0 ? t.curveSegments : 12,
|
|
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,
|
|
228
|
-
let
|
|
229
|
-
A && (
|
|
230
|
-
const
|
|
231
|
-
let
|
|
232
|
-
const I =
|
|
233
|
-
if (!
|
|
234
|
-
|
|
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
|
|
237
|
-
|
|
236
|
+
const m = I[l];
|
|
237
|
+
fe.isClockWise(m) && (I[l] = m.reverse());
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
-
function
|
|
241
|
-
const
|
|
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,
|
|
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 =
|
|
250
|
-
if (
|
|
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
|
-
|
|
258
|
-
const pe = I.length, H =
|
|
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
|
-
|
|
261
|
+
R = R.concat(d);
|
|
262
262
|
}
|
|
263
|
-
function te(l, d,
|
|
264
|
-
return d || console.error("THREE.ExtrudeGeometry: vec does not exist"), l.clone().addScaledVector(d,
|
|
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 =
|
|
267
|
-
function
|
|
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 =
|
|
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
|
|
272
|
-
E * E +
|
|
273
|
-
),
|
|
274
|
-
x =
|
|
275
|
-
const
|
|
276
|
-
if (
|
|
277
|
-
return new
|
|
278
|
-
M = Math.sqrt(
|
|
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
|
|
281
|
-
w > Number.EPSILON ? E > Number.EPSILON && (
|
|
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
|
|
283
|
+
return new P(x / M, b / M);
|
|
284
284
|
}
|
|
285
285
|
const re = [];
|
|
286
|
-
for (let l = 0, d = H.length,
|
|
287
|
-
|
|
288
|
-
const
|
|
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
|
|
291
|
+
const m = I[l];
|
|
292
292
|
q = [];
|
|
293
|
-
for (let x = 0, b =
|
|
294
|
-
M === b && (M = 0), w === b && (w = 0), q[x] =
|
|
295
|
-
|
|
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 =
|
|
299
|
+
J = fe.triangulateShape(H, I);
|
|
300
300
|
else {
|
|
301
301
|
const l = [], d = [];
|
|
302
|
-
for (let
|
|
303
|
-
const x =
|
|
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 =
|
|
311
|
-
const
|
|
310
|
+
q = ge[w];
|
|
311
|
+
const G = [];
|
|
312
312
|
for (let B = 0, Q = E.length; B < Q; B++) {
|
|
313
|
-
const
|
|
314
|
-
W(
|
|
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(
|
|
316
|
+
x === 0 && d.push(G);
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
|
-
J =
|
|
319
|
+
J = fe.triangulateShape(
|
|
320
320
|
l,
|
|
321
321
|
d
|
|
322
322
|
);
|
|
323
323
|
}
|
|
324
|
-
const ce = J.length,
|
|
324
|
+
const ce = J.length, Me = g + L;
|
|
325
325
|
for (let l = 0; l < N; l++) {
|
|
326
|
-
const d = y ? te(
|
|
327
|
-
$ ? (
|
|
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 <=
|
|
329
|
+
for (let l = 1; l <= i; l++)
|
|
330
330
|
for (let d = 0; d < N; d++) {
|
|
331
|
-
const
|
|
332
|
-
$ ? (
|
|
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,
|
|
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 +
|
|
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 =
|
|
342
|
+
q = ge[b];
|
|
343
343
|
for (let T = 0, E = w.length; T < E; T++) {
|
|
344
|
-
const
|
|
344
|
+
const G = te(w[T], q[T], x);
|
|
345
345
|
$ ? W(
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
) : W(
|
|
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
|
-
|
|
354
|
-
function
|
|
353
|
+
ke(), ee && Fe();
|
|
354
|
+
function ke() {
|
|
355
355
|
const l = s.length / 3;
|
|
356
356
|
if (y) {
|
|
357
|
-
let d = 0,
|
|
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] +
|
|
361
|
+
le(b[2] + m, b[1] + m, b[0] + m);
|
|
362
362
|
}
|
|
363
|
-
if (d =
|
|
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] +
|
|
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
|
|
372
|
-
le(
|
|
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
|
|
376
|
+
const m = J[d];
|
|
377
377
|
le(
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
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
|
|
386
|
+
function Fe() {
|
|
387
387
|
const l = s.length / 3;
|
|
388
388
|
let d = 0;
|
|
389
|
-
|
|
390
|
-
for (let
|
|
391
|
-
const b = I[
|
|
392
|
-
|
|
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
|
|
397
|
-
let
|
|
398
|
-
for (; --
|
|
399
|
-
const x =
|
|
400
|
-
let b =
|
|
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 =
|
|
403
|
-
const T = N * M, E = N * (M + 1),
|
|
404
|
-
|
|
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,
|
|
409
|
-
r.push(l), r.push(d), r.push(
|
|
408
|
+
function W(l, d, m) {
|
|
409
|
+
r.push(l), r.push(d), r.push(m);
|
|
410
410
|
}
|
|
411
|
-
function le(l, d,
|
|
412
|
-
k(l), k(d), k(
|
|
413
|
-
const x = s.length / 3, b =
|
|
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
|
|
423
|
-
k(l), k(d), k(x), k(d), k(
|
|
424
|
-
const b = s.length / 3, M =
|
|
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
|
-
|
|
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
|
|
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
|
|
460
|
-
const f = t[e.shapes[
|
|
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
|
|
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
|
|
470
|
-
generateTopUV: function(
|
|
471
|
-
const
|
|
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
|
|
474
|
-
new
|
|
475
|
-
new
|
|
473
|
+
new P(o, a),
|
|
474
|
+
new P(f, r),
|
|
475
|
+
new P(h, i)
|
|
476
476
|
];
|
|
477
477
|
},
|
|
478
|
-
generateSideWallUV: function(
|
|
479
|
-
const a = e[t * 3], f = e[t * 3 + 1], r = e[t * 3 + 2], h = e[n * 3],
|
|
480
|
-
return Math.abs(f -
|
|
481
|
-
new
|
|
482
|
-
new
|
|
483
|
-
new
|
|
484
|
-
new
|
|
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
|
|
487
|
-
new
|
|
488
|
-
new
|
|
489
|
-
new
|
|
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
|
|
494
|
-
if (t.shapes = [], Array.isArray(
|
|
495
|
-
for (let n = 0, s =
|
|
496
|
-
const
|
|
497
|
-
t.shapes.push(
|
|
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(
|
|
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
|
|
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
|
|
515
|
-
s.getSize(
|
|
514
|
+
const s = new mt().setFromObject(n), o = new _();
|
|
515
|
+
s.getSize(o);
|
|
516
516
|
const a = new _(
|
|
517
|
-
s.min.x +
|
|
518
|
-
s.min.y +
|
|
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
|
|
527
|
-
|
|
528
|
-
|
|
526
|
+
const C = Math.max(
|
|
527
|
+
o.x / A.x,
|
|
528
|
+
o.y / A.y
|
|
529
529
|
);
|
|
530
|
-
f = Math.ceil(t.topSegments *
|
|
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
|
-
|
|
536
|
-
|
|
535
|
+
o.x,
|
|
536
|
+
o.y,
|
|
537
537
|
f,
|
|
538
538
|
f
|
|
539
|
-
),
|
|
540
|
-
|
|
541
|
-
const y = new
|
|
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
|
|
547
|
-
u.setZ(A, t.depth +
|
|
546
|
+
const C = u.getZ(A);
|
|
547
|
+
u.setZ(A, t.depth + C);
|
|
548
548
|
}
|
|
549
549
|
if (r) {
|
|
550
|
-
const A = r.min,
|
|
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),
|
|
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
|
|
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:
|
|
570
|
+
hasTop: o,
|
|
571
571
|
hasBottom: a,
|
|
572
572
|
hasSide: f,
|
|
573
573
|
sideRepeat: r,
|
|
574
574
|
topSegments: h
|
|
575
|
-
} =
|
|
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:
|
|
579
|
+
UVGenerator: Gt({
|
|
580
580
|
split: e,
|
|
581
581
|
box3: s,
|
|
582
582
|
sideRepeat: r
|
|
583
583
|
}),
|
|
584
|
-
hasTop:
|
|
584
|
+
hasTop: o,
|
|
585
585
|
hasBottom: a,
|
|
586
586
|
hasSide: f,
|
|
587
587
|
topSegments: h
|
|
588
588
|
});
|
|
589
|
-
return
|
|
589
|
+
return Pt(), c;
|
|
590
590
|
};
|
|
591
|
-
class
|
|
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
|
|
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:
|
|
604
|
+
geometry: o,
|
|
605
605
|
geometryArr: a,
|
|
606
606
|
material: f,
|
|
607
607
|
box3: r,
|
|
608
608
|
split: h,
|
|
609
|
-
hasTop:
|
|
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 =
|
|
614
|
-
L || console.log("material is null"), !S && e ? S =
|
|
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:
|
|
619
|
+
hasTop: i,
|
|
620
620
|
hasBottom: c,
|
|
621
621
|
hasSide: y
|
|
622
622
|
}) : !S && t ? S = V(
|
|
623
623
|
t.map(
|
|
624
|
-
(A,
|
|
624
|
+
(A, C) => {
|
|
625
625
|
var v, z;
|
|
626
|
-
return
|
|
626
|
+
return Ve({
|
|
627
627
|
points: A,
|
|
628
|
-
depth: (v = u[
|
|
629
|
-
box3: (z = g[
|
|
628
|
+
depth: (v = u[C]) != null ? v : u[0],
|
|
629
|
+
box3: (z = g[C]) != null ? z : g[0],
|
|
630
630
|
split: h,
|
|
631
|
-
hasTop:
|
|
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
|
|
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:
|
|
655
|
+
split: o,
|
|
656
656
|
maxAnisotropy: a
|
|
657
|
-
} =
|
|
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 =
|
|
668
|
-
|
|
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
|
|
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
|
|
676
|
+
class Kt extends Z {
|
|
677
677
|
create() {
|
|
678
678
|
this.createGroup();
|
|
679
679
|
}
|
|
680
680
|
}
|
|
681
|
-
class
|
|
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,
|
|
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
|
|
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
|
|
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
|
|
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
|
-
(
|
|
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
|
|
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
|
-
(
|
|
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
|
|
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 || (
|
|
721
|
-
const v = new
|
|
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
|
-
(
|
|
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
|
|
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
|
|
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
|
-
),
|
|
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,
|
|
788
|
-
s.setX(
|
|
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(
|
|
790
|
+
a.setX(i, y), a.setX(i + 1, y);
|
|
791
791
|
const u = h / (this.pointCount - 1);
|
|
792
|
-
if (f.setXY(
|
|
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",
|
|
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,
|
|
802
|
+
let s = 0, o = 0, a = 0;
|
|
803
803
|
const f = this._points[0];
|
|
804
|
-
t.setXYZ(
|
|
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
|
|
807
|
-
e.setXYZ(s,
|
|
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
|
|
833
|
-
const t = new De(), n = new
|
|
834
|
-
if (s.copy(a.boundingSphere), s.applyMatrix4(this.matrixWorld), !
|
|
835
|
-
t.copy(this.matrixWorld).invert(), n.copy(
|
|
836
|
-
const f = new _(), r = new _(), h = new _(),
|
|
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 +=
|
|
840
|
-
const
|
|
841
|
-
f.fromArray(g,
|
|
842
|
-
const z = L[Math.floor(S / 3)] !== void 0 ? L[Math.floor(S / 3)] : 1, 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
|
-
|
|
846
|
+
o,
|
|
847
847
|
h
|
|
848
|
-
) >
|
|
849
|
-
|
|
850
|
-
const U =
|
|
851
|
-
U <
|
|
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
|
|
865
|
-
const { setPointWidth: e, nodes: t } =
|
|
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
|
|
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
|
|
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:
|
|
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
|
|
890
|
-
!
|
|
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
|
-
}),
|
|
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,
|
|
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 =
|
|
909
|
+
const n = be({
|
|
910
910
|
nodes: e,
|
|
911
911
|
setPointWidth: t
|
|
912
|
-
}), s = this.object3d,
|
|
913
|
-
s.geometry = n,
|
|
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
|
|
917
|
-
color: new
|
|
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:
|
|
940
|
+
onRepeat: o,
|
|
941
941
|
onUpdate: a,
|
|
942
942
|
onComplete: f,
|
|
943
943
|
startShow: r
|
|
944
944
|
} = {}) {
|
|
945
|
-
const { offset: h, offsetLoop:
|
|
946
|
-
if (this.material.
|
|
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,
|
|
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 &&
|
|
951
|
+
c && g <= 0 && i.value === 0 && (i.value = 1), a == null || a(g);
|
|
953
952
|
}).onRepeat(() => {
|
|
954
|
-
y += 1,
|
|
953
|
+
y += 1, o == null || o(y);
|
|
955
954
|
}).onComplete(() => {
|
|
956
|
-
f
|
|
955
|
+
f == null || f();
|
|
957
956
|
}).start();
|
|
958
|
-
this.material
|
|
959
|
-
|
|
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
|
|
968
|
-
const { points: e } =
|
|
969
|
-
return new
|
|
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
|
|
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
|
|
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:
|
|
989
|
+
material: o,
|
|
987
990
|
useGroups: a,
|
|
988
991
|
setPointWidth: f,
|
|
989
992
|
lineWidthArr: r,
|
|
990
993
|
materialParameters: h,
|
|
991
|
-
instanceCount:
|
|
994
|
+
instanceCount: i
|
|
992
995
|
} = this.options;
|
|
993
|
-
let c =
|
|
994
|
-
!c && h && (c = this.getMaterial(h)), !y && e ? y =
|
|
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) =>
|
|
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
|
|
1003
|
-
new
|
|
1005
|
+
const u = new et().fromLineSegments(
|
|
1006
|
+
new Ne(y)
|
|
1004
1007
|
);
|
|
1005
1008
|
if (this.pencil.options.WebGPUTHREE) {
|
|
1006
|
-
|
|
1007
|
-
const g = new
|
|
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
|
|
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
|
|
1017
|
-
color: new
|
|
1019
|
+
return new Ke(j({
|
|
1020
|
+
color: new We("#ffffff")
|
|
1018
1021
|
}, e));
|
|
1019
1022
|
}
|
|
1020
1023
|
}
|
|
1021
|
-
class
|
|
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
|
|
1045
|
-
t.left < 0 ?
|
|
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
|
|
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
|
|
1082
|
+
return oe(this, null, function* () {
|
|
1080
1083
|
this.createGroup();
|
|
1081
|
-
const { data: e, maxDepth: t, colors: n, material: s, percentDepth:
|
|
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((
|
|
1084
|
-
if (
|
|
1085
|
-
const y = Math.PI * 2 * (
|
|
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
|
|
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,
|
|
1096
|
-
return
|
|
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((
|
|
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
|
|
1113
|
-
s.userData.levTween =
|
|
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
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
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
|
};
|