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