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