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