gl-draw 0.11.21 → 0.11.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/objects/index.js +2 -2
- package/dist/objects/index.module.js +244 -228
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/index.module.js +1 -1
- package/package.json +1 -1
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
var xe = Object.defineProperty, we = Object.defineProperties;
|
|
2
2
|
var Ae = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var
|
|
3
|
+
var bt = Object.getOwnPropertySymbols;
|
|
4
4
|
var $t = Object.prototype.hasOwnProperty, qt = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var Zt = Math.pow, Ht = (o, t, e) => t in o ? xe(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e,
|
|
5
|
+
var Zt = Math.pow, Ht = (o, t, e) => t in o ? xe(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e, U = (o, t) => {
|
|
6
6
|
for (var e in t || (t = {}))
|
|
7
7
|
$t.call(t, e) && Ht(o, e, t[e]);
|
|
8
|
-
if (
|
|
9
|
-
for (var e of
|
|
8
|
+
if (bt)
|
|
9
|
+
for (var e of bt(t))
|
|
10
10
|
qt.call(t, e) && Ht(o, e, t[e]);
|
|
11
11
|
return o;
|
|
12
|
-
},
|
|
12
|
+
}, ft = (o, t) => we(o, Ae(t));
|
|
13
13
|
var _t = (o, t) => {
|
|
14
14
|
var e = {};
|
|
15
15
|
for (var i in o)
|
|
16
16
|
$t.call(o, i) && t.indexOf(i) < 0 && (e[i] = o[i]);
|
|
17
|
-
if (o != null &&
|
|
18
|
-
for (var i of
|
|
17
|
+
if (o != null && bt)
|
|
18
|
+
for (var i of bt(o))
|
|
19
19
|
t.indexOf(i) < 0 && qt.call(o, i) && (e[i] = o[i]);
|
|
20
20
|
return e;
|
|
21
21
|
};
|
|
22
|
-
var
|
|
22
|
+
var pt = (o, t, e) => new Promise((i, s) => {
|
|
23
23
|
var n = (u) => {
|
|
24
24
|
try {
|
|
25
25
|
r(e.next(u));
|
|
@@ -38,7 +38,7 @@ var ht = (o, t, e) => new Promise((i, s) => {
|
|
|
38
38
|
import { B as ot } from "../BaseObject.module.js";
|
|
39
39
|
import { G as ki } from "../index.module2.js";
|
|
40
40
|
import * as b from "three";
|
|
41
|
-
import { BufferGeometry as he, BufferAttribute as Me, Vector4 as
|
|
41
|
+
import { BufferGeometry as he, BufferAttribute as Me, Vector4 as dt, Vector3 as $, Matrix4 as Se, Line3 as _e, Box3 as Pe, Sphere as Te, Mesh as Le, InstancedInterleavedBuffer as Ie, InterleavedBufferAttribute as Jt, MathUtils as Be, Float32BufferAttribute as Xt, ShapeUtils as Pt, Shape as Ce, Vector2 as R } from "three";
|
|
42
42
|
import * as lt from "@tweenjs/tween.js";
|
|
43
43
|
import { RectAreaLightUniformsLib as Ee } from "three/examples/jsm/lights/RectAreaLightUniformsLib";
|
|
44
44
|
import { LineSegments2 as ze } from "three/examples/jsm/lines/LineSegments2";
|
|
@@ -58,7 +58,7 @@ import { scaleLinear as Kt } from "d3-scale";
|
|
|
58
58
|
import { Brush as Qt, Evaluator as qe, INTERSECTION as Ze } from "three-bvh-csg";
|
|
59
59
|
class Ei extends ot {
|
|
60
60
|
constructor(t) {
|
|
61
|
-
super(), this.objectType = "BaseObject#Node", this.onNodePointerIndex = [], this.options =
|
|
61
|
+
super(), this.objectType = "BaseObject#Node", this.onNodePointerIndex = [], this.options = U({
|
|
62
62
|
type: "2d"
|
|
63
63
|
}, t);
|
|
64
64
|
}
|
|
@@ -105,7 +105,7 @@ class Ei extends ot {
|
|
|
105
105
|
}
|
|
106
106
|
class zi extends ot {
|
|
107
107
|
constructor(t) {
|
|
108
|
-
super(), this.options =
|
|
108
|
+
super(), this.options = U({
|
|
109
109
|
maxDepth: 10,
|
|
110
110
|
percentDepth: !1,
|
|
111
111
|
innerRadius: 25,
|
|
@@ -114,17 +114,17 @@ class zi extends ot {
|
|
|
114
114
|
}, t);
|
|
115
115
|
}
|
|
116
116
|
create() {
|
|
117
|
-
return
|
|
117
|
+
return pt(this, null, function* () {
|
|
118
118
|
this.createGroup();
|
|
119
119
|
const { data: t, maxDepth: e, colors: i, material: s, percentDepth: n, activeIndex: a } = this.options, r = Math.max(...t), u = t.reduce((l, c) => l + c, 0);
|
|
120
120
|
let h = Math.PI / 2;
|
|
121
121
|
t.forEach((l, c) => {
|
|
122
122
|
if (l === 0) return;
|
|
123
|
-
const p = Math.PI * 2 * (l / u), f = i[c], d = n ? e * (l / r) : e,
|
|
123
|
+
const p = Math.PI * 2 * (l / u), f = i[c], d = n ? e * (l / r) : e, x = this.createGeometry(d, p), g = s ? s.clone() : new b.MeshBasicMaterial({
|
|
124
124
|
color: f
|
|
125
125
|
});
|
|
126
|
-
s &&
|
|
127
|
-
const S = new b.Mesh(
|
|
126
|
+
s && g.color.set(f);
|
|
127
|
+
const S = new b.Mesh(x, g);
|
|
128
128
|
S.userData.depth = d, S.userData.index = c, S.rotateZ(h), h += p, this.add(S);
|
|
129
129
|
}), a !== -1 && this.setActive(a);
|
|
130
130
|
});
|
|
@@ -168,7 +168,7 @@ class Vi extends ot {
|
|
|
168
168
|
super(), this.rectAreaLightUniformsLibInit = !1, this.options = t;
|
|
169
169
|
}
|
|
170
170
|
create() {
|
|
171
|
-
var e, i, s, n, a, r, u, h, l, c, p, f, d,
|
|
171
|
+
var e, i, s, n, a, r, u, h, l, c, p, f, d, x, g, S, I;
|
|
172
172
|
const t = this.options;
|
|
173
173
|
if (t.type === "AmbientLight") {
|
|
174
174
|
const A = new b.AmbientLight(t.color);
|
|
@@ -204,10 +204,10 @@ class Vi extends ot {
|
|
|
204
204
|
} else if (t.type === "RectAreaLight") {
|
|
205
205
|
this.rectAreaLightUniformsLibInit || (Ee.init(), this.rectAreaLightUniformsLibInit = !0);
|
|
206
206
|
const A = new b.RectAreaLight(
|
|
207
|
-
(
|
|
208
|
-
(
|
|
207
|
+
(x = t.color) != null ? x : 16777215,
|
|
208
|
+
(g = t.intensity) != null ? g : 1,
|
|
209
209
|
(S = t.width) != null ? S : 10,
|
|
210
|
-
(
|
|
210
|
+
(I = t.height) != null ? I : 10
|
|
211
211
|
);
|
|
212
212
|
A.name = "矩形区域光", this.object3d = A, this.rectAreaLight = A;
|
|
213
213
|
}
|
|
@@ -274,11 +274,11 @@ function Y(o, t = 0) {
|
|
|
274
274
|
u.addGroup(h, f, l);
|
|
275
275
|
else if (t === 2 && c.groups.length > 0)
|
|
276
276
|
for (let d of c.groups) {
|
|
277
|
-
let
|
|
277
|
+
let x = d.materialIndex;
|
|
278
278
|
u.addGroup(
|
|
279
279
|
h + d.start,
|
|
280
280
|
Math.min(d.count, f),
|
|
281
|
-
|
|
281
|
+
x
|
|
282
282
|
);
|
|
283
283
|
}
|
|
284
284
|
h += f;
|
|
@@ -309,8 +309,8 @@ function Y(o, t = 0) {
|
|
|
309
309
|
u.morphAttributes = u.morphAttributes || {}, u.morphAttributes[l] = [];
|
|
310
310
|
for (let p = 0; p < c; ++p) {
|
|
311
311
|
const f = [];
|
|
312
|
-
for (let
|
|
313
|
-
f.push(a[l][
|
|
312
|
+
for (let x = 0; x < a[l].length; ++x)
|
|
313
|
+
f.push(a[l][x][p]);
|
|
314
314
|
const d = te(f);
|
|
315
315
|
if (!d)
|
|
316
316
|
return console.error(
|
|
@@ -351,8 +351,8 @@ function te(o) {
|
|
|
351
351
|
const c = u / e;
|
|
352
352
|
for (let p = 0, f = l.count; p < f; p++)
|
|
353
353
|
for (let d = 0; d < e; d++) {
|
|
354
|
-
const
|
|
355
|
-
r.setComponent(p + c, d,
|
|
354
|
+
const x = l.getComponent(p, d);
|
|
355
|
+
r.setComponent(p + c, d, x);
|
|
356
356
|
}
|
|
357
357
|
} else
|
|
358
358
|
a.set(l.array, u);
|
|
@@ -392,7 +392,7 @@ function Je(o) {
|
|
|
392
392
|
}
|
|
393
393
|
return o;
|
|
394
394
|
}
|
|
395
|
-
const Tt = new
|
|
395
|
+
const Tt = new dt(), ee = new $(), ie = new $(), W = new dt(), j = new dt(), Z = new dt(), Lt = new $(), It = new Se(), D = new _e(), se = new $(), xt = new Pe(), wt = new Te(), J = new dt();
|
|
396
396
|
let X, rt;
|
|
397
397
|
function ne(o, t, e) {
|
|
398
398
|
return J.set(0, 0, -t, 1).applyMatrix4(o.projectionMatrix), J.multiplyScalar(1 / J.w), J.x = rt / e.width, J.y = rt / e.height, J.applyMatrix4(o.projectionMatrixInverse), J.multiplyScalar(1 / J.w), Math.abs(Math.max(J.x, J.y));
|
|
@@ -400,9 +400,9 @@ function ne(o, t, e) {
|
|
|
400
400
|
function Xe(o, t) {
|
|
401
401
|
const e = o.matrixWorld, i = o.geometry, s = i.attributes.instanceStart, n = i.attributes.instanceEnd, a = Math.min(i.instanceCount, s.count);
|
|
402
402
|
for (let r = 0, u = a; r < u; r++) {
|
|
403
|
-
|
|
403
|
+
D.start.fromBufferAttribute(s, r), D.end.fromBufferAttribute(n, r), D.applyMatrix4(e);
|
|
404
404
|
const h = new $(), l = new $();
|
|
405
|
-
X.distanceSqToSegment(
|
|
405
|
+
X.distanceSqToSegment(D.start, D.end, l, h), l.distanceTo(h) < rt * 0.5 && t.push({
|
|
406
406
|
point: l,
|
|
407
407
|
pointOnLine: h,
|
|
408
408
|
distance: X.origin.distanceTo(l),
|
|
@@ -418,26 +418,26 @@ function Ye(o, t, e) {
|
|
|
418
418
|
const i = t.projectionMatrix, n = o.material.resolution, a = o.matrixWorld, r = o.geometry, u = r.attributes.instanceStart, h = r.attributes.instanceEnd, l = Math.min(r.instanceCount, u.count), c = -t.near;
|
|
419
419
|
X.at(1, Z), Z.w = 1, Z.applyMatrix4(t.matrixWorldInverse), Z.applyMatrix4(i), Z.multiplyScalar(1 / Z.w), Z.x *= n.x / 2, Z.y *= n.y / 2, Z.z = 0, Lt.copy(Z), It.multiplyMatrices(t.matrixWorldInverse, a);
|
|
420
420
|
for (let p = 0, f = l; p < f; p++) {
|
|
421
|
-
if (
|
|
421
|
+
if (W.fromBufferAttribute(u, p), j.fromBufferAttribute(h, p), W.w = 1, j.w = 1, W.applyMatrix4(It), j.applyMatrix4(It), W.z > c && j.z > c)
|
|
422
422
|
continue;
|
|
423
|
-
if (
|
|
424
|
-
const A =
|
|
425
|
-
|
|
426
|
-
} else if (
|
|
427
|
-
const A =
|
|
428
|
-
|
|
423
|
+
if (W.z > c) {
|
|
424
|
+
const A = W.z - j.z, B = (W.z - c) / A;
|
|
425
|
+
W.lerp(j, B);
|
|
426
|
+
} else if (j.z > c) {
|
|
427
|
+
const A = j.z - W.z, B = (j.z - c) / A;
|
|
428
|
+
j.lerp(W, B);
|
|
429
429
|
}
|
|
430
|
-
|
|
431
|
-
const
|
|
432
|
-
|
|
433
|
-
const
|
|
434
|
-
if (S &&
|
|
435
|
-
|
|
436
|
-
const A = new $(),
|
|
437
|
-
X.distanceSqToSegment(
|
|
438
|
-
point:
|
|
430
|
+
W.applyMatrix4(i), j.applyMatrix4(i), W.multiplyScalar(1 / W.w), j.multiplyScalar(1 / j.w), W.x *= n.x / 2, W.y *= n.y / 2, j.x *= n.x / 2, j.y *= n.y / 2, D.start.copy(W), D.start.z = 0, D.end.copy(j), D.end.z = 0;
|
|
431
|
+
const x = D.closestPointToPointParameter(Lt, !0);
|
|
432
|
+
D.at(x, se);
|
|
433
|
+
const g = Be.lerp(W.z, j.z, x), S = g >= -1 && g <= 1, I = Lt.distanceTo(se) < rt * 0.5;
|
|
434
|
+
if (S && I) {
|
|
435
|
+
D.start.fromBufferAttribute(u, p), D.end.fromBufferAttribute(h, p), D.start.applyMatrix4(a), D.end.applyMatrix4(a);
|
|
436
|
+
const A = new $(), B = new $();
|
|
437
|
+
X.distanceSqToSegment(D.start, D.end, B, A), e.push({
|
|
438
|
+
point: B,
|
|
439
439
|
pointOnLine: A,
|
|
440
|
-
distance: X.origin.distanceTo(
|
|
440
|
+
distance: X.origin.distanceTo(B),
|
|
441
441
|
object: o,
|
|
442
442
|
face: null,
|
|
443
443
|
faceIndex: p,
|
|
@@ -522,14 +522,14 @@ const re = (o) => {
|
|
|
522
522
|
};
|
|
523
523
|
let Gi = class extends ot {
|
|
524
524
|
constructor(t = {}) {
|
|
525
|
-
super(), this.options =
|
|
525
|
+
super(), this.options = U({}, t);
|
|
526
526
|
}
|
|
527
527
|
get material() {
|
|
528
528
|
var t;
|
|
529
529
|
return (t = this.object3d) == null ? void 0 : t.material;
|
|
530
530
|
}
|
|
531
531
|
create() {
|
|
532
|
-
return
|
|
532
|
+
return pt(this, null, function* () {
|
|
533
533
|
const {
|
|
534
534
|
points: t,
|
|
535
535
|
pointsArr: e,
|
|
@@ -568,12 +568,12 @@ let Gi = class extends ot {
|
|
|
568
568
|
});
|
|
569
569
|
}
|
|
570
570
|
getMaterial(t) {
|
|
571
|
-
return new Ve(
|
|
571
|
+
return new Ve(U({
|
|
572
572
|
color: new b.Color("#ffffff")
|
|
573
573
|
}, t));
|
|
574
574
|
}
|
|
575
575
|
};
|
|
576
|
-
function
|
|
576
|
+
function Bt(o, t, e, i, s) {
|
|
577
577
|
let n;
|
|
578
578
|
if (o = o.subarray || o.slice ? o : o.buffer, e = e.subarray || e.slice ? e : e.buffer, o = t ? (
|
|
579
579
|
// @ts-ignore
|
|
@@ -670,7 +670,7 @@ class ti extends b.BufferGeometry {
|
|
|
670
670
|
*/
|
|
671
671
|
advance({ x: t, y: e, z: i }) {
|
|
672
672
|
const s = this._attributes.position.array, n = this._attributes.previous.array, a = this._attributes.next.array, r = s.length;
|
|
673
|
-
|
|
673
|
+
Bt(s, 0, n, 0, r), Bt(s, 6, s, 0, r - 6), s[r - 6] = t, s[r - 5] = e, s[r - 4] = i, s[r - 3] = t, s[r - 2] = e, s[r - 1] = i, Bt(s, 6, a, 0, r - 6), a[r - 6] = t, a[r - 5] = e, a[r - 4] = i, a[r - 3] = t, a[r - 2] = e, a[r - 1] = i, this._attributes.position.needsUpdate = !0, this._attributes.previous.needsUpdate = !0, this._attributes.next.needsUpdate = !0;
|
|
674
674
|
}
|
|
675
675
|
}
|
|
676
676
|
const oe = ["encodings_fragment", "colorspace_fragment"], ei = (
|
|
@@ -828,7 +828,7 @@ const oe = ["encodings_fragment", "colorspace_fragment"], ei = (
|
|
|
828
828
|
class si extends b.ShaderMaterial {
|
|
829
829
|
constructor(t) {
|
|
830
830
|
super({
|
|
831
|
-
uniforms:
|
|
831
|
+
uniforms: ft(U({}, b.UniformsLib.fog), {
|
|
832
832
|
lineWidth: { value: 1 },
|
|
833
833
|
map: { value: null },
|
|
834
834
|
useMap: { value: 0 },
|
|
@@ -1087,11 +1087,11 @@ function Wi(o, t) {
|
|
|
1087
1087
|
e.copy(this.matrixWorld).invert(), i.copy(o.ray).applyMatrix4(e);
|
|
1088
1088
|
const r = new b.Vector3(), u = new b.Vector3(), h = new b.Vector3(), l = this instanceof b.LineSegments ? 2 : 1, c = a.index, p = a.attributes;
|
|
1089
1089
|
if (c !== null) {
|
|
1090
|
-
const f = c.array, d = p.position.array,
|
|
1091
|
-
for (let
|
|
1092
|
-
const
|
|
1093
|
-
r.fromArray(d,
|
|
1094
|
-
const
|
|
1090
|
+
const f = c.array, d = p.position.array, x = p.width.array;
|
|
1091
|
+
for (let g = 0, S = f.length - 1; g < S; g += l) {
|
|
1092
|
+
const I = f[g], A = f[g + 1];
|
|
1093
|
+
r.fromArray(d, I * 3), u.fromArray(d, A * 3);
|
|
1094
|
+
const B = x[Math.floor(g / 3)] != null ? x[Math.floor(g / 3)] : 1, T = o.params.Line.threshold + this.material.lineWidth * B / 2, L = T * T;
|
|
1095
1095
|
if (i.distanceSqToSegment(
|
|
1096
1096
|
r,
|
|
1097
1097
|
u,
|
|
@@ -1099,34 +1099,34 @@ function Wi(o, t) {
|
|
|
1099
1099
|
h
|
|
1100
1100
|
) > L) continue;
|
|
1101
1101
|
n.applyMatrix4(this.matrixWorld);
|
|
1102
|
-
const
|
|
1103
|
-
|
|
1104
|
-
distance:
|
|
1102
|
+
const C = o.ray.origin.distanceTo(n);
|
|
1103
|
+
C < o.near || C > o.far || (t.push({
|
|
1104
|
+
distance: C,
|
|
1105
1105
|
// What do we want? intersection point on the ray or on the segment??
|
|
1106
1106
|
// point: raycaster.ray.at( distance ),
|
|
1107
1107
|
point: h.clone().applyMatrix4(this.matrixWorld),
|
|
1108
|
-
index:
|
|
1108
|
+
index: g,
|
|
1109
1109
|
face: null,
|
|
1110
1110
|
faceIndex: void 0,
|
|
1111
1111
|
object: this
|
|
1112
|
-
}),
|
|
1112
|
+
}), g = S);
|
|
1113
1113
|
}
|
|
1114
1114
|
}
|
|
1115
1115
|
}
|
|
1116
|
-
const
|
|
1116
|
+
const Ct = (o) => {
|
|
1117
1117
|
const { setPointWidth: t, nodes: e } = o, i = new ti();
|
|
1118
1118
|
return i.setPoints(e, t), i;
|
|
1119
1119
|
};
|
|
1120
1120
|
class ji extends ot {
|
|
1121
1121
|
constructor(t = {}) {
|
|
1122
|
-
super(), this.options =
|
|
1122
|
+
super(), this.options = U({}, t);
|
|
1123
1123
|
}
|
|
1124
1124
|
get material() {
|
|
1125
1125
|
var t;
|
|
1126
1126
|
return (t = this.object3d) == null ? void 0 : t.material;
|
|
1127
1127
|
}
|
|
1128
1128
|
create() {
|
|
1129
|
-
return
|
|
1129
|
+
return pt(this, null, function* () {
|
|
1130
1130
|
const {
|
|
1131
1131
|
nodes: t,
|
|
1132
1132
|
nodesArr: e,
|
|
@@ -1139,16 +1139,16 @@ class ji extends ot {
|
|
|
1139
1139
|
materialParameters: h
|
|
1140
1140
|
} = this.options;
|
|
1141
1141
|
let l = n, c = i;
|
|
1142
|
-
!l && h && (l = this.getMaterial(h)), !c && t ? c =
|
|
1142
|
+
!l && h && (l = this.getMaterial(h)), !c && t ? c = Ct({
|
|
1143
1143
|
nodes: t,
|
|
1144
1144
|
setPointWidth: r
|
|
1145
1145
|
}) : !c && e ? c = Y(
|
|
1146
1146
|
e.map((p, f) => {
|
|
1147
1147
|
let d = r;
|
|
1148
1148
|
return !d && u && (d = () => {
|
|
1149
|
-
var
|
|
1150
|
-
return (
|
|
1151
|
-
}),
|
|
1149
|
+
var x;
|
|
1150
|
+
return (x = u[f]) != null ? x : u[0];
|
|
1151
|
+
}), Ct({
|
|
1152
1152
|
nodes: p,
|
|
1153
1153
|
setPointWidth: d
|
|
1154
1154
|
});
|
|
@@ -1161,7 +1161,7 @@ class ji extends ot {
|
|
|
1161
1161
|
});
|
|
1162
1162
|
}
|
|
1163
1163
|
setGeometry(t, e) {
|
|
1164
|
-
const i =
|
|
1164
|
+
const i = Ct({
|
|
1165
1165
|
nodes: t,
|
|
1166
1166
|
setPointWidth: e
|
|
1167
1167
|
}), s = this.object3d, n = s.geometry;
|
|
@@ -1169,7 +1169,7 @@ class ji extends ot {
|
|
|
1169
1169
|
}
|
|
1170
1170
|
getMaterial(t) {
|
|
1171
1171
|
const { width: e, height: i } = this.pencil.getSize();
|
|
1172
|
-
return new si(
|
|
1172
|
+
return new si(U({
|
|
1173
1173
|
color: new b.Color("#ffffff"),
|
|
1174
1174
|
resolution: new b.Vector2(e, i)
|
|
1175
1175
|
}, t));
|
|
@@ -1275,11 +1275,11 @@ function ai(o, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
|
|
|
1275
1275
|
let d = [];
|
|
1276
1276
|
if (f) {
|
|
1277
1277
|
const T = $e(r).triangles(), L = new Map(
|
|
1278
|
-
r.map(([z,
|
|
1278
|
+
r.map(([z, C], N) => [`${z}-${C}`, N])
|
|
1279
1279
|
);
|
|
1280
1280
|
T.features.forEach((z) => {
|
|
1281
|
-
const
|
|
1282
|
-
if (
|
|
1281
|
+
const C = z.geometry.coordinates[0].slice(0, 3).reverse(), N = [];
|
|
1282
|
+
if (C.forEach(([V, k]) => {
|
|
1283
1283
|
const nt = `${V}-${k}`;
|
|
1284
1284
|
L.has(nt) && N.push(L.get(nt));
|
|
1285
1285
|
}), N.length === 3) {
|
|
@@ -1298,8 +1298,8 @@ function ai(o, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
|
|
|
1298
1298
|
} else if (a.length) {
|
|
1299
1299
|
const T = Oe.from(r);
|
|
1300
1300
|
for (let L = 0, z = T.triangles.length; L < z; L += 3) {
|
|
1301
|
-
const
|
|
1302
|
-
if (
|
|
1301
|
+
const C = [2, 1, 0].map((V) => T.triangles[L + V]), N = C.map((V) => r[V]);
|
|
1302
|
+
if (C.some((V) => V < n.length)) {
|
|
1303
1303
|
const V = [0, 1].map(
|
|
1304
1304
|
(k) => Ge(N, (nt) => nt[k])
|
|
1305
1305
|
);
|
|
@@ -1310,23 +1310,23 @@ function ai(o, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
|
|
|
1310
1310
|
))
|
|
1311
1311
|
continue;
|
|
1312
1312
|
}
|
|
1313
|
-
d.push(...
|
|
1313
|
+
d.push(...C);
|
|
1314
1314
|
}
|
|
1315
1315
|
} else {
|
|
1316
1316
|
const { vertices: T, holes: L = [] } = pe(s);
|
|
1317
1317
|
d = Ue(T, L, 2);
|
|
1318
1318
|
}
|
|
1319
|
-
let
|
|
1319
|
+
let x = e ? [e[0], e[2]] : Yt(r, (T) => T[0]), g = e ? [e[1], e[3]] : Yt(r, (T) => T[1]);
|
|
1320
1320
|
if (i) {
|
|
1321
|
-
const [T, L] = i([
|
|
1322
|
-
|
|
1321
|
+
const [T, L] = i([x[0], g[0]]), [z, C] = i([x[1], g[1]]);
|
|
1322
|
+
x = [T, z], g = [-L, -C];
|
|
1323
1323
|
}
|
|
1324
|
-
const S = Kt(
|
|
1324
|
+
const S = Kt(x, [0, 1]), I = Kt(g, [0, 1]), A = r.map(([T, L]) => {
|
|
1325
1325
|
if (i) {
|
|
1326
|
-
const [z,
|
|
1327
|
-
return [S(z),
|
|
1326
|
+
const [z, C] = i([T, L]);
|
|
1327
|
+
return [S(z), I(-C)];
|
|
1328
1328
|
} else
|
|
1329
|
-
return [S(T),
|
|
1329
|
+
return [S(T), I(L)];
|
|
1330
1330
|
});
|
|
1331
1331
|
return { contour: s, triangles: { points: r, indices: d, uvs: A } };
|
|
1332
1332
|
}
|
|
@@ -1358,18 +1358,18 @@ function li(o, t, e, i, s) {
|
|
|
1358
1358
|
let c = 0;
|
|
1359
1359
|
const p = [];
|
|
1360
1360
|
for (let d = 0; d < h; d++) {
|
|
1361
|
-
let
|
|
1362
|
-
if (
|
|
1363
|
-
|
|
1364
|
-
else if (l.has(
|
|
1365
|
-
const
|
|
1366
|
-
|
|
1361
|
+
let x = d + 1;
|
|
1362
|
+
if (x === h)
|
|
1363
|
+
x = c;
|
|
1364
|
+
else if (l.has(x)) {
|
|
1365
|
+
const g = x;
|
|
1366
|
+
x = c, c = g;
|
|
1367
1367
|
}
|
|
1368
|
-
p.push(d, d + h,
|
|
1368
|
+
p.push(d, d + h, x + h), p.push(x + h, x, d);
|
|
1369
1369
|
}
|
|
1370
1370
|
const f = [];
|
|
1371
1371
|
for (let d = 1; d >= 0; d--)
|
|
1372
|
-
for (let
|
|
1372
|
+
for (let x = 0; x < h; x += 1) f.push(x / (h - 1), d);
|
|
1373
1373
|
return { indices: p, vertices: u, uvs: f, topVerts: r };
|
|
1374
1374
|
}
|
|
1375
1375
|
function le(o, t, e, i, s, n) {
|
|
@@ -1414,8 +1414,8 @@ const ui = ({
|
|
|
1414
1414
|
), f = p.topVerts);
|
|
1415
1415
|
let d = [];
|
|
1416
1416
|
(a || r) && (d = zt(c.uvs));
|
|
1417
|
-
let
|
|
1418
|
-
a && (
|
|
1417
|
+
let x = {};
|
|
1418
|
+
a && (x = le(
|
|
1419
1419
|
c,
|
|
1420
1420
|
t,
|
|
1421
1421
|
d,
|
|
@@ -1423,19 +1423,19 @@ const ui = ({
|
|
|
1423
1423
|
s,
|
|
1424
1424
|
u
|
|
1425
1425
|
));
|
|
1426
|
-
let
|
|
1427
|
-
return r && (
|
|
1426
|
+
let g = {};
|
|
1427
|
+
return r && (g = le(
|
|
1428
1428
|
c,
|
|
1429
1429
|
e,
|
|
1430
1430
|
d,
|
|
1431
1431
|
!0,
|
|
1432
1432
|
s,
|
|
1433
1433
|
u
|
|
1434
|
-
)), { contour: l, triangles: c, sideTorso: p, bottomCap:
|
|
1434
|
+
)), { contour: l, triangles: c, sideTorso: p, bottomCap: x, topCap: g, topVerts: f };
|
|
1435
1435
|
};
|
|
1436
1436
|
class ci extends b.BufferGeometry {
|
|
1437
1437
|
constructor(t, e = {}) {
|
|
1438
|
-
super(), this.type = "PolygonBufferGeometry", this.parameters =
|
|
1438
|
+
super(), this.type = "PolygonBufferGeometry", this.parameters = U({
|
|
1439
1439
|
polygonGeoJson: t,
|
|
1440
1440
|
startHeight: 0,
|
|
1441
1441
|
endHeight: 1,
|
|
@@ -1456,36 +1456,36 @@ class ci extends b.BufferGeometry {
|
|
|
1456
1456
|
cartesian: u,
|
|
1457
1457
|
userDataRsoOffset: h,
|
|
1458
1458
|
projection: l
|
|
1459
|
-
} = this.parameters, { contour: c, sideTorso: p, topVerts: f, bottomCap: d, topCap:
|
|
1460
|
-
let
|
|
1461
|
-
const
|
|
1462
|
-
const L = Math.round(
|
|
1463
|
-
|
|
1464
|
-
L ? T.indices.map((
|
|
1465
|
-
), this.addGroup(z,
|
|
1459
|
+
} = this.parameters, { contour: c, sideTorso: p, topVerts: f, bottomCap: d, topCap: x } = ui(U({}, this.parameters));
|
|
1460
|
+
let g = [], S = [], I = [], A = 0;
|
|
1461
|
+
const B = (T) => {
|
|
1462
|
+
const L = Math.round(g.length / 3), z = I.length;
|
|
1463
|
+
g = g.concat(T.vertices), S = S.concat(T.uvs), I = I.concat(
|
|
1464
|
+
L ? T.indices.map((C) => C + L) : T.indices
|
|
1465
|
+
), this.addGroup(z, I.length - z, A++);
|
|
1466
1466
|
};
|
|
1467
|
-
s && n &&
|
|
1467
|
+
s && n && B(x), r && (B(p), this.userData.topVerts = h ? At(
|
|
1468
1468
|
c,
|
|
1469
1469
|
i + h,
|
|
1470
1470
|
u,
|
|
1471
1471
|
l
|
|
1472
|
-
).vertices : f), a &&
|
|
1472
|
+
).vertices : f), a && B(d), s && !n && B(x), this.setIndex(I), this[ae](
|
|
1473
1473
|
"position",
|
|
1474
|
-
new b.Float32BufferAttribute(
|
|
1474
|
+
new b.Float32BufferAttribute(g, 3)
|
|
1475
1475
|
), this[ae]("uv", new b.Float32BufferAttribute(S, 2)), this.computeVertexNormals();
|
|
1476
1476
|
}
|
|
1477
1477
|
}
|
|
1478
1478
|
const ue = (o) => {
|
|
1479
1479
|
const r = o, { coordinate: t, startHeight: e, height: i } = r, s = _t(r, ["coordinate", "startHeight", "height"]);
|
|
1480
1480
|
let n = e || 0;
|
|
1481
|
-
return typeof e != "undefined" && typeof i != "undefined" && (n = e + i), new ci([t],
|
|
1481
|
+
return typeof e != "undefined" && typeof i != "undefined" && (n = e + i), new ci([t], ft(U({}, s), {
|
|
1482
1482
|
startHeight: e,
|
|
1483
1483
|
endHeight: n
|
|
1484
1484
|
}));
|
|
1485
1485
|
};
|
|
1486
1486
|
class Di extends ot {
|
|
1487
1487
|
constructor(t) {
|
|
1488
|
-
super(), this.options =
|
|
1488
|
+
super(), this.options = U({}, t);
|
|
1489
1489
|
}
|
|
1490
1490
|
create() {
|
|
1491
1491
|
const u = this.options, {
|
|
@@ -1503,12 +1503,12 @@ class Di extends ot {
|
|
|
1503
1503
|
]);
|
|
1504
1504
|
let r = t;
|
|
1505
1505
|
if (!r && i)
|
|
1506
|
-
r = ue(
|
|
1506
|
+
r = ue(U({
|
|
1507
1507
|
coordinate: i
|
|
1508
1508
|
}, a));
|
|
1509
1509
|
else if (!r && e) {
|
|
1510
1510
|
const h = e.map(
|
|
1511
|
-
(l) => ue(
|
|
1511
|
+
(l) => ue(U({
|
|
1512
1512
|
coordinate: l
|
|
1513
1513
|
}, a))
|
|
1514
1514
|
);
|
|
@@ -1520,12 +1520,12 @@ class Di extends ot {
|
|
|
1520
1520
|
this.createMesh(r, s);
|
|
1521
1521
|
}
|
|
1522
1522
|
}
|
|
1523
|
-
class
|
|
1524
|
-
constructor(t = new
|
|
1525
|
-
new
|
|
1526
|
-
new
|
|
1527
|
-
new
|
|
1528
|
-
new
|
|
1523
|
+
class ut extends he {
|
|
1524
|
+
constructor(t = new Ce([
|
|
1525
|
+
new R(0.5, 0.5),
|
|
1526
|
+
new R(-0.5, 0.5),
|
|
1527
|
+
new R(-0.5, -0.5),
|
|
1528
|
+
new R(0.5, -0.5)
|
|
1529
1529
|
]), e = {}) {
|
|
1530
1530
|
super(), this.type = "ExtrudeGeometry", this.parameters = {
|
|
1531
1531
|
shapes: t,
|
|
@@ -1540,10 +1540,10 @@ class ft extends he {
|
|
|
1540
1540
|
function a(r) {
|
|
1541
1541
|
var Wt, jt, Dt;
|
|
1542
1542
|
const u = [], h = e.curveSegments !== void 0 ? e.curveSegments : 12, l = e.steps !== void 0 ? e.steps : 1, c = e.depth !== void 0 ? e.depth : 1;
|
|
1543
|
-
let p = e.bevelEnabled !== void 0 ? e.bevelEnabled : !0, f = e.bevelThickness !== void 0 ? e.bevelThickness : 0.2, d = e.bevelSize !== void 0 ? e.bevelSize : f - 0.1,
|
|
1544
|
-
const S = e.extrudePath,
|
|
1545
|
-
let L, z = !1,
|
|
1546
|
-
S && (L = S.getSpacedPoints(l), z = !0, p = !1,
|
|
1543
|
+
let p = e.bevelEnabled !== void 0 ? e.bevelEnabled : !0, f = e.bevelThickness !== void 0 ? e.bevelThickness : 0.2, d = e.bevelSize !== void 0 ? e.bevelSize : f - 0.1, x = e.bevelOffset !== void 0 ? e.bevelOffset : 0, g = e.bevelSegments !== void 0 ? e.bevelSegments : 3;
|
|
1544
|
+
const S = e.extrudePath, I = e.UVGenerator !== void 0 ? e.UVGenerator : hi, A = (Wt = e.hasTop) != null ? Wt : !0, B = (jt = e.hasBottom) != null ? jt : !0, T = (Dt = e.hasSide) != null ? Dt : !0;
|
|
1545
|
+
let L, z = !1, C, N, V, k;
|
|
1546
|
+
S && (L = S.getSpacedPoints(l), z = !0, p = !1, C = S.computeFrenetFrames(l, !1), N = new $(), V = new $(), k = new $()), p || (g = 0, f = 0, d = 0, x = 0);
|
|
1547
1547
|
const nt = r.extractPoints(h);
|
|
1548
1548
|
let H = nt.shape;
|
|
1549
1549
|
const F = nt.holes;
|
|
@@ -1554,7 +1554,7 @@ class ft extends he {
|
|
|
1554
1554
|
Pt.isClockWise(v) && (F[m] = v.reverse());
|
|
1555
1555
|
}
|
|
1556
1556
|
}
|
|
1557
|
-
const
|
|
1557
|
+
const ct = Pt.triangulateShape(H, F), q = H;
|
|
1558
1558
|
for (let m = 0, y = F.length; m < y; m++) {
|
|
1559
1559
|
const v = F[m];
|
|
1560
1560
|
H = H.concat(v);
|
|
@@ -1562,73 +1562,73 @@ class ft extends he {
|
|
|
1562
1562
|
function at(m, y, v) {
|
|
1563
1563
|
return y || console.error("THREE.ExtrudeGeometry: vec does not exist"), m.clone().addScaledVector(y, v);
|
|
1564
1564
|
}
|
|
1565
|
-
const K = H.length,
|
|
1565
|
+
const K = H.length, mt = ct.length;
|
|
1566
1566
|
function Vt(m, y, v) {
|
|
1567
|
-
let M,
|
|
1568
|
-
const P = m.x - y.x,
|
|
1567
|
+
let M, w, _;
|
|
1568
|
+
const P = m.x - y.x, E = m.y - y.y, O = v.x - m.x, G = v.y - m.y, ht = P * P + E * E, St = P * G - E * O;
|
|
1569
1569
|
if (Math.abs(St) > Number.EPSILON) {
|
|
1570
|
-
const it = Math.sqrt(
|
|
1570
|
+
const it = Math.sqrt(ht), Rt = Math.sqrt(
|
|
1571
1571
|
O * O + G * G
|
|
1572
|
-
), Ot = y.x -
|
|
1573
|
-
M = Ot + P * Ft - m.x,
|
|
1574
|
-
const kt = M * M +
|
|
1572
|
+
), Ot = y.x - E / it, Nt = y.y + P / it, ve = v.x - G / Rt, be = v.y + O / Rt, Ft = ((ve - Ot) * G - (be - Nt) * O) / (P * G - E * O);
|
|
1573
|
+
M = Ot + P * Ft - m.x, w = Nt + E * Ft - m.y;
|
|
1574
|
+
const kt = M * M + w * w;
|
|
1575
1575
|
if (kt <= 2)
|
|
1576
|
-
return new
|
|
1576
|
+
return new R(M, w);
|
|
1577
1577
|
_ = Math.sqrt(kt / 2);
|
|
1578
1578
|
} else {
|
|
1579
1579
|
let it = !1;
|
|
1580
|
-
P > Number.EPSILON ? O > Number.EPSILON && (it = !0) : P < -Number.EPSILON ? O < -Number.EPSILON && (it = !0) : Math.sign(
|
|
1580
|
+
P > Number.EPSILON ? O > Number.EPSILON && (it = !0) : P < -Number.EPSILON ? O < -Number.EPSILON && (it = !0) : Math.sign(E) === Math.sign(G) && (it = !0), it ? (M = -E, w = P, _ = Math.sqrt(ht)) : (M = P, w = E, _ = Math.sqrt(ht / 2));
|
|
1581
1581
|
}
|
|
1582
|
-
return new
|
|
1582
|
+
return new R(M / _, w / _);
|
|
1583
1583
|
}
|
|
1584
|
-
const
|
|
1584
|
+
const gt = [];
|
|
1585
1585
|
for (let m = 0, y = q.length, v = y - 1, M = m + 1; m < y; m++, v++, M++)
|
|
1586
|
-
v === y && (v = 0), M === y && (M = 0),
|
|
1586
|
+
v === y && (v = 0), M === y && (M = 0), gt[m] = Vt(q[m], q[v], q[M]);
|
|
1587
1587
|
const Mt = [];
|
|
1588
|
-
let st,
|
|
1588
|
+
let st, yt = gt.concat();
|
|
1589
1589
|
for (let m = 0, y = F.length; m < y; m++) {
|
|
1590
1590
|
const v = F[m];
|
|
1591
1591
|
st = [];
|
|
1592
|
-
for (let M = 0,
|
|
1593
|
-
_ ===
|
|
1594
|
-
Mt.push(st),
|
|
1592
|
+
for (let M = 0, w = v.length, _ = w - 1, P = M + 1; M < w; M++, _++, P++)
|
|
1593
|
+
_ === w && (_ = 0), P === w && (P = 0), st[M] = Vt(v[M], v[_], v[P]);
|
|
1594
|
+
Mt.push(st), yt = yt.concat(st);
|
|
1595
1595
|
}
|
|
1596
|
-
for (let m = 0; m <
|
|
1597
|
-
const y = m /
|
|
1598
|
-
for (let
|
|
1599
|
-
const P = at(q[
|
|
1596
|
+
for (let m = 0; m < g; m++) {
|
|
1597
|
+
const y = m / g, v = f * Math.cos(y * Math.PI / 2), M = d * Math.sin(y * Math.PI / 2) + x;
|
|
1598
|
+
for (let w = 0, _ = q.length; w < _; w++) {
|
|
1599
|
+
const P = at(q[w], gt[w], M);
|
|
1600
1600
|
Q(P.x, P.y, -v);
|
|
1601
1601
|
}
|
|
1602
|
-
for (let
|
|
1603
|
-
const P = F[
|
|
1604
|
-
st = Mt[
|
|
1605
|
-
for (let
|
|
1606
|
-
const G = at(P[
|
|
1602
|
+
for (let w = 0, _ = F.length; w < _; w++) {
|
|
1603
|
+
const P = F[w];
|
|
1604
|
+
st = Mt[w];
|
|
1605
|
+
for (let E = 0, O = P.length; E < O; E++) {
|
|
1606
|
+
const G = at(P[E], st[E], M);
|
|
1607
1607
|
Q(G.x, G.y, -v);
|
|
1608
1608
|
}
|
|
1609
1609
|
}
|
|
1610
1610
|
}
|
|
1611
|
-
const Gt = d +
|
|
1611
|
+
const Gt = d + x;
|
|
1612
1612
|
for (let m = 0; m < K; m++) {
|
|
1613
|
-
const y = p ? at(H[m],
|
|
1614
|
-
z ? (V.copy(
|
|
1613
|
+
const y = p ? at(H[m], yt[m], Gt) : H[m];
|
|
1614
|
+
z ? (V.copy(C.normals[0]).multiplyScalar(y.x), N.copy(C.binormals[0]).multiplyScalar(y.y), k.copy(L[0]).add(V).add(N), Q(k.x, k.y, k.z)) : Q(y.x, y.y, 0);
|
|
1615
1615
|
}
|
|
1616
1616
|
for (let m = 1; m <= l; m++)
|
|
1617
1617
|
for (let y = 0; y < K; y++) {
|
|
1618
|
-
const v = p ? at(H[y],
|
|
1619
|
-
z ? (V.copy(
|
|
1618
|
+
const v = p ? at(H[y], yt[y], Gt) : H[y];
|
|
1619
|
+
z ? (V.copy(C.normals[m]).multiplyScalar(v.x), N.copy(C.binormals[m]).multiplyScalar(v.y), k.copy(L[m]).add(V).add(N), Q(k.x, k.y, k.z)) : Q(v.x, v.y, c / l * m);
|
|
1620
1620
|
}
|
|
1621
|
-
for (let m =
|
|
1622
|
-
const y = m /
|
|
1623
|
-
for (let
|
|
1624
|
-
const P = at(q[
|
|
1621
|
+
for (let m = g - 1; m >= 0; m--) {
|
|
1622
|
+
const y = m / g, v = f * Math.cos(y * Math.PI / 2), M = d * Math.sin(y * Math.PI / 2) + x;
|
|
1623
|
+
for (let w = 0, _ = q.length; w < _; w++) {
|
|
1624
|
+
const P = at(q[w], gt[w], M);
|
|
1625
1625
|
Q(P.x, P.y, c + v);
|
|
1626
1626
|
}
|
|
1627
|
-
for (let
|
|
1628
|
-
const P = F[
|
|
1629
|
-
st = Mt[
|
|
1630
|
-
for (let
|
|
1631
|
-
const G = at(P[
|
|
1627
|
+
for (let w = 0, _ = F.length; w < _; w++) {
|
|
1628
|
+
const P = F[w];
|
|
1629
|
+
st = Mt[w];
|
|
1630
|
+
for (let E = 0, O = P.length; E < O; E++) {
|
|
1631
|
+
const G = at(P[E], st[E], M);
|
|
1632
1632
|
z ? Q(
|
|
1633
1633
|
G.x,
|
|
1634
1634
|
G.y + L[l - 1].y,
|
|
@@ -1642,26 +1642,26 @@ class ft extends he {
|
|
|
1642
1642
|
const m = s.length / 3;
|
|
1643
1643
|
if (p) {
|
|
1644
1644
|
let y = 0, v = K * y;
|
|
1645
|
-
if (
|
|
1646
|
-
for (let M = 0; M <
|
|
1647
|
-
const
|
|
1648
|
-
|
|
1645
|
+
if (B)
|
|
1646
|
+
for (let M = 0; M < mt; M++) {
|
|
1647
|
+
const w = ct[M];
|
|
1648
|
+
vt(w[2] + v, w[1] + v, w[0] + v);
|
|
1649
1649
|
}
|
|
1650
|
-
if (y = l +
|
|
1651
|
-
for (let M = 0; M <
|
|
1652
|
-
const
|
|
1653
|
-
|
|
1650
|
+
if (y = l + g * 2, v = K * y, A)
|
|
1651
|
+
for (let M = 0; M < mt; M++) {
|
|
1652
|
+
const w = ct[M];
|
|
1653
|
+
vt(w[0] + v, w[1] + v, w[2] + v);
|
|
1654
1654
|
}
|
|
1655
1655
|
} else {
|
|
1656
|
-
if (
|
|
1657
|
-
for (let y = 0; y <
|
|
1658
|
-
const v =
|
|
1659
|
-
|
|
1656
|
+
if (B)
|
|
1657
|
+
for (let y = 0; y < mt; y++) {
|
|
1658
|
+
const v = ct[y];
|
|
1659
|
+
vt(v[2], v[1], v[0]);
|
|
1660
1660
|
}
|
|
1661
1661
|
if (A)
|
|
1662
|
-
for (let y = 0; y <
|
|
1663
|
-
const v =
|
|
1664
|
-
|
|
1662
|
+
for (let y = 0; y < mt; y++) {
|
|
1663
|
+
const v = ct[y];
|
|
1664
|
+
vt(
|
|
1665
1665
|
v[0] + K * l,
|
|
1666
1666
|
v[1] + K * l,
|
|
1667
1667
|
v[2] + K * l
|
|
@@ -1675,8 +1675,8 @@ class ft extends he {
|
|
|
1675
1675
|
let y = 0;
|
|
1676
1676
|
Ut(q, y), y += q.length;
|
|
1677
1677
|
for (let v = 0, M = F.length; v < M; v++) {
|
|
1678
|
-
const
|
|
1679
|
-
Ut(
|
|
1678
|
+
const w = F[v];
|
|
1679
|
+
Ut(w, y), y += w.length;
|
|
1680
1680
|
}
|
|
1681
1681
|
i.addGroup(m, s.length / 3 - m, 1);
|
|
1682
1682
|
}
|
|
@@ -1684,37 +1684,37 @@ class ft extends he {
|
|
|
1684
1684
|
let v = m.length;
|
|
1685
1685
|
for (; --v >= 0; ) {
|
|
1686
1686
|
const M = v;
|
|
1687
|
-
let
|
|
1688
|
-
|
|
1689
|
-
for (let _ = 0, P = l +
|
|
1690
|
-
const
|
|
1691
|
-
ye(G,
|
|
1687
|
+
let w = v - 1;
|
|
1688
|
+
w < 0 && (w = m.length - 1);
|
|
1689
|
+
for (let _ = 0, P = l + g * 2; _ < P; _++) {
|
|
1690
|
+
const E = K * _, O = K * (_ + 1), G = y + M + E, ht = y + w + E, St = y + w + O, it = y + M + O;
|
|
1691
|
+
ye(G, ht, St, it);
|
|
1692
1692
|
}
|
|
1693
1693
|
}
|
|
1694
1694
|
}
|
|
1695
1695
|
function Q(m, y, v) {
|
|
1696
1696
|
u.push(m), u.push(y), u.push(v);
|
|
1697
1697
|
}
|
|
1698
|
-
function
|
|
1698
|
+
function vt(m, y, v) {
|
|
1699
1699
|
tt(m), tt(y), tt(v);
|
|
1700
|
-
const M = s.length / 3,
|
|
1700
|
+
const M = s.length / 3, w = I.generateTopUV(
|
|
1701
1701
|
i,
|
|
1702
1702
|
s,
|
|
1703
1703
|
M - 3,
|
|
1704
1704
|
M - 2,
|
|
1705
1705
|
M - 1
|
|
1706
1706
|
);
|
|
1707
|
-
et(
|
|
1707
|
+
et(w[0]), et(w[1]), et(w[2]);
|
|
1708
1708
|
}
|
|
1709
1709
|
function ye(m, y, v, M) {
|
|
1710
1710
|
tt(m), tt(y), tt(M), tt(y), tt(v), tt(M);
|
|
1711
|
-
const
|
|
1711
|
+
const w = s.length / 3, _ = I.generateSideWallUV(
|
|
1712
1712
|
i,
|
|
1713
1713
|
s,
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1714
|
+
w - 6,
|
|
1715
|
+
w - 3,
|
|
1716
|
+
w - 2,
|
|
1717
|
+
w - 1
|
|
1718
1718
|
);
|
|
1719
1719
|
et(_[0]), et(_[1]), et(_[3]), et(_[1]), et(_[2]), et(_[3]);
|
|
1720
1720
|
}
|
|
@@ -1740,30 +1740,30 @@ class ft extends he {
|
|
|
1740
1740
|
i.push(r);
|
|
1741
1741
|
}
|
|
1742
1742
|
const s = t.options.extrudePath;
|
|
1743
|
-
return console.log(s.type), s !== void 0 && (t.options.extrudePath = new b[`${s.type}Curve`]().fromJSON(s)), new
|
|
1743
|
+
return console.log(s.type), s !== void 0 && (t.options.extrudePath = new b[`${s.type}Curve`]().fromJSON(s)), new ut(i, t.options);
|
|
1744
1744
|
}
|
|
1745
1745
|
}
|
|
1746
1746
|
const hi = {
|
|
1747
1747
|
generateTopUV: function(o, t, e, i, s) {
|
|
1748
1748
|
const n = t[e * 3], a = t[e * 3 + 1], r = t[i * 3], u = t[i * 3 + 1], h = t[s * 3], l = t[s * 3 + 1];
|
|
1749
1749
|
return [
|
|
1750
|
-
new
|
|
1751
|
-
new
|
|
1752
|
-
new
|
|
1750
|
+
new R(n, a),
|
|
1751
|
+
new R(r, u),
|
|
1752
|
+
new R(h, l)
|
|
1753
1753
|
];
|
|
1754
1754
|
},
|
|
1755
1755
|
generateSideWallUV: function(o, t, e, i, s, n) {
|
|
1756
|
-
const a = t[e * 3], r = t[e * 3 + 1], u = t[e * 3 + 2], h = t[i * 3], l = t[i * 3 + 1], c = t[i * 3 + 2], p = t[s * 3], f = t[s * 3 + 1], d = t[s * 3 + 2],
|
|
1756
|
+
const a = t[e * 3], r = t[e * 3 + 1], u = t[e * 3 + 2], h = t[i * 3], l = t[i * 3 + 1], c = t[i * 3 + 2], p = t[s * 3], f = t[s * 3 + 1], d = t[s * 3 + 2], x = t[n * 3], g = t[n * 3 + 1], S = t[n * 3 + 2];
|
|
1757
1757
|
return Math.abs(r - l) < Math.abs(a - h) ? [
|
|
1758
|
-
new
|
|
1759
|
-
new
|
|
1760
|
-
new
|
|
1761
|
-
new
|
|
1758
|
+
new R(a, 1 - u),
|
|
1759
|
+
new R(h, 1 - c),
|
|
1760
|
+
new R(p, 1 - d),
|
|
1761
|
+
new R(x, 1 - S)
|
|
1762
1762
|
] : [
|
|
1763
|
-
new
|
|
1764
|
-
new
|
|
1765
|
-
new
|
|
1766
|
-
new
|
|
1763
|
+
new R(r, 1 - u),
|
|
1764
|
+
new R(l, 1 - c),
|
|
1765
|
+
new R(f, 1 - d),
|
|
1766
|
+
new R(g, 1 - S)
|
|
1767
1767
|
];
|
|
1768
1768
|
}
|
|
1769
1769
|
};
|
|
@@ -1777,10 +1777,15 @@ function fi(o, t, e) {
|
|
|
1777
1777
|
e.shapes.push(o.uuid);
|
|
1778
1778
|
return e.options = Object.assign({}, t), t.extrudePath !== void 0 && (e.options.extrudePath = t.extrudePath.toJSON()), e;
|
|
1779
1779
|
}
|
|
1780
|
-
class pi extends
|
|
1780
|
+
class pi extends ut {
|
|
1781
1781
|
constructor(t, e) {
|
|
1782
1782
|
super(t, e);
|
|
1783
|
-
const i = new Qt(
|
|
1783
|
+
const i = new Qt(
|
|
1784
|
+
new ut(t, ft(U({}, e), {
|
|
1785
|
+
hasTop: !0,
|
|
1786
|
+
hasSide: !0
|
|
1787
|
+
}))
|
|
1788
|
+
);
|
|
1784
1789
|
i.updateMatrixWorld();
|
|
1785
1790
|
const s = new b.Box3().setFromObject(i), n = new b.Vector3();
|
|
1786
1791
|
s.getSize(n);
|
|
@@ -1793,8 +1798,8 @@ class pi extends ft {
|
|
|
1793
1798
|
if (e.box3) {
|
|
1794
1799
|
const g = new b.Vector3();
|
|
1795
1800
|
e.box3.getSize(g);
|
|
1796
|
-
const
|
|
1797
|
-
r = Math.ceil(e.topSegments *
|
|
1801
|
+
const S = Math.max(n.x / g.x, n.y / g.y);
|
|
1802
|
+
r = Math.ceil(e.topSegments * S);
|
|
1798
1803
|
}
|
|
1799
1804
|
if (r < 4)
|
|
1800
1805
|
return this;
|
|
@@ -1805,19 +1810,30 @@ class pi extends ft {
|
|
|
1805
1810
|
r
|
|
1806
1811
|
), h = new Qt(u);
|
|
1807
1812
|
h.position.set(a.x, a.y, a.z), h.updateMatrixWorld();
|
|
1808
|
-
const c = new qe().evaluate(h, i, Ze), p = c.geometry.getAttribute("position")
|
|
1813
|
+
const c = new qe().evaluate(h, i, Ze), p = c.geometry.getAttribute("position"), f = new b.Float32BufferAttribute(
|
|
1814
|
+
p.count * 2,
|
|
1815
|
+
2
|
|
1816
|
+
);
|
|
1809
1817
|
for (let g = 0; g < p.count; g++) {
|
|
1810
|
-
const
|
|
1811
|
-
p.setZ(g,
|
|
1818
|
+
const S = p.getZ(g);
|
|
1819
|
+
p.setZ(g, S * 2);
|
|
1820
|
+
}
|
|
1821
|
+
if (e.box3) {
|
|
1822
|
+
const g = e.box3.min, S = e.box3.max, I = new b.Vector3().subVectors(S, g);
|
|
1823
|
+
for (let A = 0; A < p.count; A++) {
|
|
1824
|
+
const B = p.getX(A), T = p.getY(A), L = (B - g.x) / I.x, z = (T - g.y) / I.y;
|
|
1825
|
+
f.setXY(A, L, z);
|
|
1826
|
+
}
|
|
1827
|
+
c.geometry.setAttribute("uv", f);
|
|
1812
1828
|
}
|
|
1813
1829
|
p.needsUpdate = !0;
|
|
1814
|
-
const
|
|
1830
|
+
const d = new ut(t, ft(U({}, e), {
|
|
1815
1831
|
hasTop: !1
|
|
1816
|
-
})),
|
|
1817
|
-
[c.geometry,
|
|
1832
|
+
})), x = Y(
|
|
1833
|
+
[c.geometry, d],
|
|
1818
1834
|
2
|
|
1819
1835
|
);
|
|
1820
|
-
this.copy(
|
|
1836
|
+
this.copy(x.toNonIndexed());
|
|
1821
1837
|
}
|
|
1822
1838
|
}
|
|
1823
1839
|
const ce = (o) => {
|
|
@@ -1831,7 +1847,7 @@ const ce = (o) => {
|
|
|
1831
1847
|
hasSide: r,
|
|
1832
1848
|
sideRepeat: u,
|
|
1833
1849
|
topSegments: h
|
|
1834
|
-
} = o, l = h ? pi :
|
|
1850
|
+
} = o, l = h ? pi : ut, c = new l(new b.Shape(i), {
|
|
1835
1851
|
depth: e,
|
|
1836
1852
|
bevelEnabled: !1,
|
|
1837
1853
|
box3: s,
|
|
@@ -1849,12 +1865,12 @@ const ce = (o) => {
|
|
|
1849
1865
|
};
|
|
1850
1866
|
class Ri extends ot {
|
|
1851
1867
|
constructor(t) {
|
|
1852
|
-
super(), this.options =
|
|
1868
|
+
super(), this.options = U({
|
|
1853
1869
|
depth: 1
|
|
1854
1870
|
}, t);
|
|
1855
1871
|
}
|
|
1856
1872
|
create() {
|
|
1857
|
-
return
|
|
1873
|
+
return pt(this, null, function* () {
|
|
1858
1874
|
const {
|
|
1859
1875
|
points: t,
|
|
1860
1876
|
pointsArr: e,
|
|
@@ -1868,9 +1884,9 @@ class Ri extends ot {
|
|
|
1868
1884
|
hasTop: l,
|
|
1869
1885
|
hasBottom: c,
|
|
1870
1886
|
hasSide: p
|
|
1871
|
-
} = this.options, f = Array.isArray(s) ? s : [s], d = Array.isArray(u) ? u : [u],
|
|
1872
|
-
let
|
|
1873
|
-
|
|
1887
|
+
} = this.options, f = Array.isArray(s) ? s : [s], d = Array.isArray(u) ? u : [u], x = r;
|
|
1888
|
+
let g = n;
|
|
1889
|
+
x || console.log("material is null"), !g && t ? g = ce({
|
|
1874
1890
|
points: t,
|
|
1875
1891
|
depth: f[0],
|
|
1876
1892
|
box3: d[0],
|
|
@@ -1878,14 +1894,14 @@ class Ri extends ot {
|
|
|
1878
1894
|
hasTop: l,
|
|
1879
1895
|
hasBottom: c,
|
|
1880
1896
|
hasSide: p
|
|
1881
|
-
}) : !
|
|
1897
|
+
}) : !g && e ? g = Y(
|
|
1882
1898
|
e.map(
|
|
1883
|
-
(S,
|
|
1884
|
-
var A,
|
|
1899
|
+
(S, I) => {
|
|
1900
|
+
var A, B;
|
|
1885
1901
|
return ce({
|
|
1886
1902
|
points: S,
|
|
1887
|
-
depth: (A = f[
|
|
1888
|
-
box3: (
|
|
1903
|
+
depth: (A = f[I]) != null ? A : f[0],
|
|
1904
|
+
box3: (B = d[I]) != null ? B : d[0],
|
|
1889
1905
|
split: h,
|
|
1890
1906
|
hasTop: l,
|
|
1891
1907
|
hasBottom: c,
|
|
@@ -1894,10 +1910,10 @@ class Ri extends ot {
|
|
|
1894
1910
|
}
|
|
1895
1911
|
),
|
|
1896
1912
|
i != null ? i : 0
|
|
1897
|
-
) : !
|
|
1913
|
+
) : !g && a && a.length > 1 ? g = Y(
|
|
1898
1914
|
a,
|
|
1899
1915
|
i != null ? i : 0
|
|
1900
|
-
) : !
|
|
1916
|
+
) : !g && a && a.length === 1 && ([g] = a), this.createMesh(g, x);
|
|
1901
1917
|
});
|
|
1902
1918
|
}
|
|
1903
1919
|
addGeometries(t) {
|