build-dxf 0.0.45 → 0.0.46
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/package.json +1 -1
- package/src/build.js +143 -150
package/package.json
CHANGED
package/src/build.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as P from "three";
|
|
2
|
-
import { EventDispatcher as Vt, Color as Ht, Matrix4 as
|
|
2
|
+
import { EventDispatcher as Vt, Color as Ht, Matrix4 as vt, Vector3 as rt, Quaternion as Jt, BufferAttribute as Y, REVISION as $t, CompressedTexture as lt, Source as Kt, NoColorSpace as Zt, MathUtils as ft, RGBAFormat as Qt, ImageUtils as te, DoubleSide as ee, PropertyBinding as ot, InterpolateDiscrete as ne, Scene as yt, SRGBColorSpace as se, NearestFilter as ie, NearestMipmapNearestFilter as re, NearestMipmapLinearFilter as oe, LinearFilter as ae, LinearMipmapNearestFilter as ce, LinearMipmapLinearFilter as le, ClampToEdgeWrapping as he, RepeatWrapping as ue, MirroredRepeatWrapping as de, InterpolateLinear as fe } from "three";
|
|
3
3
|
import xt from "clipper-lib";
|
|
4
4
|
import it from "dxf-writer";
|
|
5
5
|
import { OBJExporter as pe } from "three/examples/jsm/exporters/OBJExporter.js";
|
|
@@ -9,7 +9,7 @@ function tt() {
|
|
|
9
9
|
return e.toString(16);
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
|
-
class
|
|
12
|
+
class Rt extends Vt {
|
|
13
13
|
uuid = tt();
|
|
14
14
|
addEventListener(t, e, n) {
|
|
15
15
|
const { once: s = !1 } = n ?? {}, i = (o) => {
|
|
@@ -30,7 +30,7 @@ class Ct extends Vt {
|
|
|
30
30
|
e && (e.forEach((n) => n()), this.eventRecordStack.delete(t));
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
class z extends
|
|
33
|
+
class z extends Rt {
|
|
34
34
|
parent;
|
|
35
35
|
destroyed = !1;
|
|
36
36
|
constructor(...t) {
|
|
@@ -48,7 +48,7 @@ class z extends Ct {
|
|
|
48
48
|
this.destroyed = !0;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
class ge extends
|
|
51
|
+
class ge extends Rt {
|
|
52
52
|
static EventType = {
|
|
53
53
|
ADD_COMPONENT: "addComponent"
|
|
54
54
|
};
|
|
@@ -1671,7 +1671,7 @@ async function X(u, t = !0) {
|
|
|
1671
1671
|
return t && (e = e.default), e;
|
|
1672
1672
|
}
|
|
1673
1673
|
}
|
|
1674
|
-
function
|
|
1674
|
+
function Ct(u, t = 0, e, n) {
|
|
1675
1675
|
const s = u.userData, i = s.drawWindow, r = e ? e.queryLineSegment(u).filter((a) => a.line !== u && !a.userData?.isDoor).map((a) => ({ index: n?.indexOf(a.line) })) : [];
|
|
1676
1676
|
return {
|
|
1677
1677
|
...W(s),
|
|
@@ -1686,7 +1686,7 @@ function Nt(u, t = 0, e, n) {
|
|
|
1686
1686
|
};
|
|
1687
1687
|
}
|
|
1688
1688
|
function et(u, t = 0, e) {
|
|
1689
|
-
return e || (e = new O(R.fromByLineSegment(...u)), u.forEach((n) => e?.insert({ line: n, userData: void 0 }))), u.map((n) =>
|
|
1689
|
+
return e || (e = new O(R.fromByLineSegment(...u)), u.forEach((n) => e?.insert({ line: n, userData: void 0 }))), u.map((n) => Ct(n, t, e, u));
|
|
1690
1690
|
}
|
|
1691
1691
|
function at(u, t = 0.03) {
|
|
1692
1692
|
const e = new O(R.fromByLineSegment(...u));
|
|
@@ -1731,7 +1731,7 @@ function V(...u) {
|
|
|
1731
1731
|
});
|
|
1732
1732
|
});
|
|
1733
1733
|
}
|
|
1734
|
-
function
|
|
1734
|
+
function Nt(u) {
|
|
1735
1735
|
if (u.length < 3) return 0;
|
|
1736
1736
|
let t = 0;
|
|
1737
1737
|
const e = u.length;
|
|
@@ -1811,7 +1811,7 @@ class nt extends ye {
|
|
|
1811
1811
|
}), this;
|
|
1812
1812
|
}
|
|
1813
1813
|
}
|
|
1814
|
-
function
|
|
1814
|
+
function Bt(u, t, e, n = !0) {
|
|
1815
1815
|
e = e ?? /* @__PURE__ */ new Set();
|
|
1816
1816
|
const s = t || J(u);
|
|
1817
1817
|
function i(r) {
|
|
@@ -1825,7 +1825,7 @@ function Ot(u, t, e, n = !0) {
|
|
|
1825
1825
|
}
|
|
1826
1826
|
return e;
|
|
1827
1827
|
}
|
|
1828
|
-
function
|
|
1828
|
+
function Ot(u, t) {
|
|
1829
1829
|
const e = t || J(u);
|
|
1830
1830
|
function n(r, o, a) {
|
|
1831
1831
|
e.queryPoint(r, !0).forEach((h) => {
|
|
@@ -1871,7 +1871,7 @@ function xe(u, t = /* @__PURE__ */ new Set(), e) {
|
|
|
1871
1871
|
r(a, a.start, l) ? l.forEach((h) => s.add(h)) : (t.add(a), n.remove(a.start), n.remove(a.end));
|
|
1872
1872
|
}
|
|
1873
1873
|
const o = u.length;
|
|
1874
|
-
return u = u.filter((a) => !t.has(a)), o !== u.length ?
|
|
1874
|
+
return u = u.filter((a) => !t.has(a)), o !== u.length ? Ot(u) : [u];
|
|
1875
1875
|
}
|
|
1876
1876
|
function me(u) {
|
|
1877
1877
|
const t = J(u), e = u[0].start, n = /* @__PURE__ */ new Set();
|
|
@@ -1909,17 +1909,17 @@ function we(u, t) {
|
|
|
1909
1909
|
}
|
|
1910
1910
|
let o = 0, a = [];
|
|
1911
1911
|
n.forEach((h) => {
|
|
1912
|
-
const c = me(h), d =
|
|
1912
|
+
const c = me(h), d = Nt(c);
|
|
1913
1913
|
d >= o && (o = d, a = h);
|
|
1914
1914
|
});
|
|
1915
1915
|
const l = Date.now().toString(16) + "-" + Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0");
|
|
1916
1916
|
return a.forEach((h) => Object.assign(h.userData, { groupId: l, groupType: "doubleWall" })), a;
|
|
1917
1917
|
}
|
|
1918
|
-
function
|
|
1918
|
+
function jt(u) {
|
|
1919
1919
|
if (u.length === 0) return { lines: u, groups: [], removeLines: [] };
|
|
1920
|
-
const t = J(u), e =
|
|
1920
|
+
const t = J(u), e = Bt(u, t);
|
|
1921
1921
|
let n = u.filter((i) => !e.has(i));
|
|
1922
|
-
const s =
|
|
1922
|
+
const s = Ot(n, t).flatMap((i) => xe(i, e, t)).map((i) => we(i));
|
|
1923
1923
|
return u = [...e, ...s.flat()], {
|
|
1924
1924
|
removeLines: [...e],
|
|
1925
1925
|
groups: s,
|
|
@@ -2130,7 +2130,7 @@ function Ee(u, t, e, n = 15) {
|
|
|
2130
2130
|
}
|
|
2131
2131
|
return c.forEach((d) => d()), { parallelLines: s, verticalLines: i, doorLines: r, windowLines: o };
|
|
2132
2132
|
}
|
|
2133
|
-
function
|
|
2133
|
+
function mt(u, t, e, n, s) {
|
|
2134
2134
|
const i = [], r = /* @__PURE__ */ new Map();
|
|
2135
2135
|
u.forEach((l) => {
|
|
2136
2136
|
const h = e.projectPoint(l.start, !1);
|
|
@@ -2163,7 +2163,7 @@ function wt(u, t, e, n, s) {
|
|
|
2163
2163
|
}), f.push([...d]), f;
|
|
2164
2164
|
});
|
|
2165
2165
|
}
|
|
2166
|
-
function
|
|
2166
|
+
function wt(u, t, e, n) {
|
|
2167
2167
|
const s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), o = [];
|
|
2168
2168
|
u.forEach((d) => {
|
|
2169
2169
|
const f = e.projectPoint(d.start, !1);
|
|
@@ -2225,7 +2225,7 @@ function Mt(u, t, e, n) {
|
|
|
2225
2225
|
}
|
|
2226
2226
|
return c;
|
|
2227
2227
|
}
|
|
2228
|
-
function
|
|
2228
|
+
function Mt(u, t) {
|
|
2229
2229
|
function e(i, r = /* @__PURE__ */ new Set()) {
|
|
2230
2230
|
if (r.has(i)) return r;
|
|
2231
2231
|
r.add(i);
|
|
@@ -2253,16 +2253,16 @@ function Ae(u, t, e, n, s, i) {
|
|
|
2253
2253
|
groupMethod: a = "principalAndCross"
|
|
2254
2254
|
} = i ?? {}, l = {
|
|
2255
2255
|
cross: () => [
|
|
2256
|
-
...
|
|
2257
|
-
...
|
|
2256
|
+
...wt(u, n, e, o),
|
|
2257
|
+
...wt(t, e, n, o)
|
|
2258
2258
|
],
|
|
2259
2259
|
principalAndCross: () => [
|
|
2260
|
-
...
|
|
2261
|
-
...
|
|
2260
|
+
...mt(u, n, e, r, o),
|
|
2261
|
+
...mt(t, e, n, r, o)
|
|
2262
2262
|
],
|
|
2263
2263
|
originalInterPoint: () => [
|
|
2264
|
-
...
|
|
2265
|
-
...
|
|
2264
|
+
...Mt(u, s),
|
|
2265
|
+
...Mt(t, s)
|
|
2266
2266
|
]
|
|
2267
2267
|
};
|
|
2268
2268
|
return l[a] ? l[a]() : l.originalInterPoint();
|
|
@@ -2398,7 +2398,7 @@ function ve(u) {
|
|
|
2398
2398
|
}
|
|
2399
2399
|
return u;
|
|
2400
2400
|
}
|
|
2401
|
-
function
|
|
2401
|
+
function Dt(u, t = 0.01) {
|
|
2402
2402
|
const e = new G();
|
|
2403
2403
|
return u.forEach((n) => n.points.forEach((s) => e.insert(s, n))), u = u.filter((n) => {
|
|
2404
2404
|
if (n.length() <= t) {
|
|
@@ -2410,6 +2410,13 @@ function St(u, t = 0.01) {
|
|
|
2410
2410
|
s.forEach((i) => $(n, i)), V(n);
|
|
2411
2411
|
}), u;
|
|
2412
2412
|
}
|
|
2413
|
+
function Re(u) {
|
|
2414
|
+
const { lines: t, groups: e, removeLines: n } = jt(u);
|
|
2415
|
+
return e.forEach((s) => {
|
|
2416
|
+
const i = tt();
|
|
2417
|
+
s.forEach((r) => Object.assign(r.userData, { groupId: i, groupType: "doubleWall" }));
|
|
2418
|
+
}), n.forEach((s) => Object.assign(s.userData, { groupId: "default", groupType: "wall" })), u = t, u;
|
|
2419
|
+
}
|
|
2413
2420
|
class qt {
|
|
2414
2421
|
/**
|
|
2415
2422
|
* 轴对齐垂直修正
|
|
@@ -2430,36 +2437,25 @@ class qt {
|
|
|
2430
2437
|
let y = Ae(r, o, f, p, i, n);
|
|
2431
2438
|
y = be(y, i);
|
|
2432
2439
|
let g = Te(y, 0.1, n);
|
|
2433
|
-
g = E.autoMergeLines(g).lines, g = Pe(g, i, n), Ie(l), g = at(g, 1e-9), g =
|
|
2440
|
+
g = E.autoMergeLines(g).lines, g = Pe(g, i, n), Ie(l), g = at(g, 1e-9), g = Dt(g, 0.15);
|
|
2434
2441
|
const { removeClosedLine: x = !0, wallGroup: M = !0 } = n ?? {};
|
|
2435
|
-
|
|
2436
|
-
if (g = mt(g).lines, M) {
|
|
2437
|
-
g = Me.complementSide(g), g = E.brokenLineMerging(g, $), V(...g), g = at(g, 1e-9);
|
|
2438
|
-
const { lines: w, groups: m, removeLines: S } = mt(g);
|
|
2439
|
-
m.forEach((A) => {
|
|
2440
|
-
const L = tt();
|
|
2441
|
-
A.forEach((b) => Object.assign(b.userData, { groupId: L, groupType: "doubleWall" }));
|
|
2442
|
-
}), S.forEach((A) => Object.assign(A.userData, { groupId: "default", groupType: "wall" })), g = w;
|
|
2443
|
-
}
|
|
2444
|
-
g = St(g, 0.15);
|
|
2445
|
-
}
|
|
2446
|
-
return ve(a), g.push(...a), g;
|
|
2442
|
+
return x && (g = jt(g).lines, M && (g = Me.complementSide(g), g = E.brokenLineMerging(g, $), V(...g), g = at(g, 1e-9), g = Re(g)), g = Dt(g, 0.15)), ve(a), g.push(...a), g;
|
|
2447
2443
|
}
|
|
2448
2444
|
}
|
|
2449
|
-
const
|
|
2445
|
+
const Ce = new E(
|
|
2450
2446
|
new D(0, 0),
|
|
2451
2447
|
new D(0, 1)
|
|
2452
2448
|
);
|
|
2453
|
-
function
|
|
2449
|
+
function Ne(u) {
|
|
2454
2450
|
const t = [...u].sort((i, r) => r.length() - i.length()).slice(0, 20), e = t.map((i) => {
|
|
2455
|
-
let r = parseInt(
|
|
2451
|
+
let r = parseInt(Ce.includedAngle(i) + "");
|
|
2456
2452
|
return r > 90 && (r = 180 - r), r;
|
|
2457
2453
|
}), n = /* @__PURE__ */ new Map();
|
|
2458
2454
|
return e.forEach((i, r) => {
|
|
2459
2455
|
n.has(i) || n.set(i, []), n.get(i)?.push(t[r]);
|
|
2460
2456
|
}), [...n.values()].sort((i, r) => r.length - i.length)[0].sort((i, r) => r.length() - i.length())[0];
|
|
2461
2457
|
}
|
|
2462
|
-
function
|
|
2458
|
+
function Be(u) {
|
|
2463
2459
|
let t = [], e = -1;
|
|
2464
2460
|
const n = [];
|
|
2465
2461
|
return u.forEach(({ start: i, end: r, ...o }, a) => {
|
|
@@ -2475,7 +2471,7 @@ function Ne(u) {
|
|
|
2475
2471
|
verticalReferenceIndex: e
|
|
2476
2472
|
};
|
|
2477
2473
|
}
|
|
2478
|
-
const
|
|
2474
|
+
const Oe = {
|
|
2479
2475
|
Unitless: 1,
|
|
2480
2476
|
// 无单位,1米 = 1(无单位)
|
|
2481
2477
|
Inches: 39.37007874015748,
|
|
@@ -2519,7 +2515,7 @@ const Be = {
|
|
|
2519
2515
|
Parsecs: 3240779289666404e-32
|
|
2520
2516
|
// 秒差距,1米 ≈ 0.00000000000000003240779289666404秒差距
|
|
2521
2517
|
};
|
|
2522
|
-
function
|
|
2518
|
+
function St(u) {
|
|
2523
2519
|
const t = [];
|
|
2524
2520
|
for (let e = 0; e < u.length; e++)
|
|
2525
2521
|
t.push(new E(
|
|
@@ -2528,7 +2524,7 @@ function Lt(u) {
|
|
|
2528
2524
|
));
|
|
2529
2525
|
return t;
|
|
2530
2526
|
}
|
|
2531
|
-
function
|
|
2527
|
+
function Lt(u) {
|
|
2532
2528
|
return u.flatMap((t, e) => (e === u.length - 1 && [...t.points, u[0].points[0]], [t.points[0]]));
|
|
2533
2529
|
}
|
|
2534
2530
|
class k extends z {
|
|
@@ -2576,9 +2572,9 @@ class k extends z {
|
|
|
2576
2572
|
* @param data
|
|
2577
2573
|
*/
|
|
2578
2574
|
preprocessing(t) {
|
|
2579
|
-
let { lineSegments: e, verticalReferenceIndex: n, originalZAverage: s } =
|
|
2575
|
+
let { lineSegments: e, verticalReferenceIndex: n, originalZAverage: s } = Be(t);
|
|
2580
2576
|
if (this.originalZAverage = s, n === -1) {
|
|
2581
|
-
const r =
|
|
2577
|
+
const r = Ne(e);
|
|
2582
2578
|
n = e.indexOf(r);
|
|
2583
2579
|
}
|
|
2584
2580
|
const i = e[n];
|
|
@@ -2740,7 +2736,7 @@ class k extends z {
|
|
|
2740
2736
|
break;
|
|
2741
2737
|
}
|
|
2742
2738
|
}
|
|
2743
|
-
const e = this.mergeSameDirectionLine(
|
|
2739
|
+
const e = this.mergeSameDirectionLine(St(t)), n = [e[0]];
|
|
2744
2740
|
for (let s = 1; s < e.length; s++) {
|
|
2745
2741
|
const i = e[s], r = e[(e.length + s - 1) % e.length];
|
|
2746
2742
|
if (i.length() > this.width * 0.9) {
|
|
@@ -2755,7 +2751,7 @@ class k extends z {
|
|
|
2755
2751
|
const a = e[s + 2];
|
|
2756
2752
|
a && r.includedAngle(a) < 2 ? (s = s + 2, n.push(a)) : n.push(i);
|
|
2757
2753
|
}
|
|
2758
|
-
return n.length > 3 ?
|
|
2754
|
+
return n.length > 3 ? Lt(this.mergeSameDirectionLine(n)) : [];
|
|
2759
2755
|
}
|
|
2760
2756
|
/**
|
|
2761
2757
|
* 移除短线段
|
|
@@ -2763,7 +2759,7 @@ class k extends z {
|
|
|
2763
2759
|
* @param path
|
|
2764
2760
|
*/
|
|
2765
2761
|
removeShortLine(t, e = this.shortLine) {
|
|
2766
|
-
const n =
|
|
2762
|
+
const n = St(t), s = [], i = Math.PI / 180;
|
|
2767
2763
|
for (let r = 0; r < n.length; r++) {
|
|
2768
2764
|
const o = n[r], a = o.length(), l = r;
|
|
2769
2765
|
if (a > e || s.length === 0) {
|
|
@@ -2791,7 +2787,7 @@ class k extends z {
|
|
|
2791
2787
|
} else
|
|
2792
2788
|
r = l;
|
|
2793
2789
|
}
|
|
2794
|
-
return s.length > 3 ?
|
|
2790
|
+
return s.length > 3 ? Lt(s) : [];
|
|
2795
2791
|
}
|
|
2796
2792
|
/** 线偏移
|
|
2797
2793
|
* @description 使用 ClipperLib 对每个点组进行线偏移处理,生成具有指定宽度的墙体路径
|
|
@@ -2805,7 +2801,7 @@ class k extends z {
|
|
|
2805
2801
|
}), i.Execute(s, this.width / 2 * n), this.wallsGroup = s.map((r) => {
|
|
2806
2802
|
let o = r.map((a) => D.from(a).divisionScalar(n));
|
|
2807
2803
|
return o = this.lineSegmentStraightening(o), t == k.EndType.etOpenSquare && (o = this.squareRemoveBurr(o)), o;
|
|
2808
|
-
}).filter((r) => r.length > 4 ||
|
|
2804
|
+
}).filter((r) => r.length > 4 || Nt(r) > 0.2), this.dispatchEvent({
|
|
2809
2805
|
type: "lineOffset",
|
|
2810
2806
|
wallsGroup: this.wallsGroup
|
|
2811
2807
|
}), this.wallsGroup;
|
|
@@ -2868,7 +2864,7 @@ class k extends z {
|
|
|
2868
2864
|
* 转为绘制数据
|
|
2869
2865
|
*/
|
|
2870
2866
|
toDrawDataJson(t = "Millimeters") {
|
|
2871
|
-
const e =
|
|
2867
|
+
const e = Oe[t], n = {
|
|
2872
2868
|
unit: t,
|
|
2873
2869
|
line: [],
|
|
2874
2870
|
arc: [],
|
|
@@ -3063,7 +3059,7 @@ class k extends z {
|
|
|
3063
3059
|
}
|
|
3064
3060
|
}
|
|
3065
3061
|
const _ = new E();
|
|
3066
|
-
class
|
|
3062
|
+
class je extends k {
|
|
3067
3063
|
static name = "AngleCorrectionDxf";
|
|
3068
3064
|
angle = 0;
|
|
3069
3065
|
onAddFromParent(t) {
|
|
@@ -3266,7 +3262,7 @@ class Gt extends z {
|
|
|
3266
3262
|
}
|
|
3267
3263
|
}
|
|
3268
3264
|
}
|
|
3269
|
-
class
|
|
3265
|
+
class Fe {
|
|
3270
3266
|
// 所有可查找的点位
|
|
3271
3267
|
possibleDoorPoints = [];
|
|
3272
3268
|
doorPoint = [];
|
|
@@ -3577,7 +3573,7 @@ class je {
|
|
|
3577
3573
|
return e;
|
|
3578
3574
|
}
|
|
3579
3575
|
}
|
|
3580
|
-
class
|
|
3576
|
+
class qe extends z {
|
|
3581
3577
|
doorSearchNearAngle = 110;
|
|
3582
3578
|
doorSearchDistance = 2;
|
|
3583
3579
|
DoorsAnalysis;
|
|
@@ -3591,17 +3587,17 @@ class Fe extends z {
|
|
|
3591
3587
|
onAddFromParent(t) {
|
|
3592
3588
|
const e = t.findComponentByType(k), n = this.parent?.findComponentByType(Gt);
|
|
3593
3589
|
e.addEventListener("createGroup", () => {
|
|
3594
|
-
this.skipFindDoor ? this.needsSaveDoor && (this.doors = e.doors.map((s) => e.lineSegments[s[4]])) : this.DoorsAnalysis = new
|
|
3590
|
+
this.skipFindDoor ? this.needsSaveDoor && (this.doors = e.doors.map((s) => e.lineSegments[s[4]])) : this.DoorsAnalysis = new Fe(n), this.skipFindDoor = !1, this.dispatchEvent({ type: "analysisCompleted" });
|
|
3595
3591
|
});
|
|
3596
3592
|
}
|
|
3597
3593
|
}
|
|
3598
|
-
function
|
|
3594
|
+
function Ue(u) {
|
|
3599
3595
|
const t = new G();
|
|
3600
3596
|
for (const e of u)
|
|
3601
3597
|
t.insert(e.start, e), t.insert(e.end, e);
|
|
3602
3598
|
return t;
|
|
3603
3599
|
}
|
|
3604
|
-
function
|
|
3600
|
+
function Ge(u, t) {
|
|
3605
3601
|
const e = t.queryPoint(u.start, !0)[0], n = t.queryPoint(u.end, !0)[0];
|
|
3606
3602
|
if (e && n) {
|
|
3607
3603
|
const s = e.userData.length(), i = n.userData.length();
|
|
@@ -3615,7 +3611,7 @@ function Ue(u, t) {
|
|
|
3615
3611
|
}
|
|
3616
3612
|
return null;
|
|
3617
3613
|
}
|
|
3618
|
-
function
|
|
3614
|
+
function ze(u, t) {
|
|
3619
3615
|
const e = new O(R.fromByLineSegment(...u)), n = t.clone().expansion(100), s = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
|
|
3620
3616
|
u.forEach((a) => e.insert(a));
|
|
3621
3617
|
const r = e.queryLineSegment(n);
|
|
@@ -3650,11 +3646,11 @@ function Ge(u, t) {
|
|
|
3650
3646
|
function zt(u) {
|
|
3651
3647
|
if (u = u.map((n) => n.clone()), u = E.brokenLineMerging(u, $), u.length <= 4) return [u];
|
|
3652
3648
|
u = u.sort((n, s) => s.length() - n.length());
|
|
3653
|
-
const t =
|
|
3649
|
+
const t = Ue(u), e = [];
|
|
3654
3650
|
for (let n = 0; n < u.length; n++) {
|
|
3655
|
-
const s = u[n], i =
|
|
3651
|
+
const s = u[n], i = Ge(s, t);
|
|
3656
3652
|
if (i) {
|
|
3657
|
-
|
|
3653
|
+
ze(u, i).forEach((r) => {
|
|
3658
3654
|
r.length === 4 ? e.push(r) : e.push(...zt(r));
|
|
3659
3655
|
});
|
|
3660
3656
|
break;
|
|
@@ -3662,7 +3658,7 @@ function zt(u) {
|
|
|
3662
3658
|
}
|
|
3663
3659
|
return e;
|
|
3664
3660
|
}
|
|
3665
|
-
class
|
|
3661
|
+
class _e extends z {
|
|
3666
3662
|
static name = "ThreeVJia";
|
|
3667
3663
|
lineSegments = [];
|
|
3668
3664
|
neededUpdate = !0;
|
|
@@ -3844,7 +3840,7 @@ class K extends ge {
|
|
|
3844
3840
|
* @param scale 原始数据缩放比例
|
|
3845
3841
|
*/
|
|
3846
3842
|
constructor(t = 0.1, e = 1) {
|
|
3847
|
-
super(), this.environment = typeof window < "u" ? "browser" : typeof global < "u" ? "node" : "unknown", this.wallWidth = t, this.Dxf = new k(this.wallWidth, e), this.AngleCorrectionDxf = new
|
|
3843
|
+
super(), this.environment = typeof window < "u" ? "browser" : typeof global < "u" ? "node" : "unknown", this.wallWidth = t, this.Dxf = new k(this.wallWidth, e), this.AngleCorrectionDxf = new je(), this.Variable = new Ut(), this.LineAnalysis = new Gt(), this.DoorsAnalysis = new qe(), this.addComponent(this.Variable), this.addComponent(this.Dxf), this.addComponent(this.LineAnalysis), this.addComponent(this.DoorsAnalysis), this.addComponent(this.AngleCorrectionDxf), this.addComponent(new _e()), K.finalInstance = this;
|
|
3848
3844
|
}
|
|
3849
3845
|
usePlugin(t) {
|
|
3850
3846
|
return typeof t == "function" && t.call(this, this), this;
|
|
@@ -3932,7 +3928,7 @@ class pt {
|
|
|
3932
3928
|
return b.userData.groupType === "wall" && (v = "wall"), L.append(v, b);
|
|
3933
3929
|
}, new nt());
|
|
3934
3930
|
return m.size === 1 || (m.group((L, b) => ({ wall: "wall", door: "wall" })[b] ?? "doubleWall").get("doubleWall") ?? []).forEach((L) => {
|
|
3935
|
-
|
|
3931
|
+
Bt(L).forEach((v) => {
|
|
3936
3932
|
v.userData.groupId = "default", v.userData.groupType = "wall";
|
|
3937
3933
|
});
|
|
3938
3934
|
}), w;
|
|
@@ -3969,15 +3965,15 @@ class pt {
|
|
|
3969
3965
|
}), c.push(...E.deduplication(M)), c.forEach((w) => w.userData.isWindow && V(w)), c = at(c), c = E.deduplication(c), c = a(c), et(c, d);
|
|
3970
3966
|
}
|
|
3971
3967
|
}
|
|
3972
|
-
const
|
|
3968
|
+
const vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3973
3969
|
__proto__: null,
|
|
3974
3970
|
AxisAlignCorr: qt,
|
|
3975
3971
|
BoundExt: pt,
|
|
3976
3972
|
lineDataToOriginalData: et,
|
|
3977
3973
|
lineSegmentClipping: at,
|
|
3978
3974
|
recomputedWindow: V,
|
|
3979
|
-
toOriginalDataItem:
|
|
3980
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
3975
|
+
toOriginalDataItem: Ct
|
|
3976
|
+
}, Symbol.toStringTag, { value: "Module" })), Et = {
|
|
3981
3977
|
POSITION: [
|
|
3982
3978
|
"byte",
|
|
3983
3979
|
"byte normalized",
|
|
@@ -4008,11 +4004,9 @@ const In = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4008
4004
|
class ct {
|
|
4009
4005
|
constructor() {
|
|
4010
4006
|
this.textureUtils = null, this.pluginCallbacks = [], this.register(function(t) {
|
|
4011
|
-
return new Ze(t);
|
|
4012
|
-
}), this.register(function(t) {
|
|
4013
4007
|
return new Qe(t);
|
|
4014
4008
|
}), this.register(function(t) {
|
|
4015
|
-
return new
|
|
4009
|
+
return new tn(t);
|
|
4016
4010
|
}), this.register(function(t) {
|
|
4017
4011
|
return new rn(t);
|
|
4018
4012
|
}), this.register(function(t) {
|
|
@@ -4020,13 +4014,13 @@ class ct {
|
|
|
4020
4014
|
}), this.register(function(t) {
|
|
4021
4015
|
return new an(t);
|
|
4022
4016
|
}), this.register(function(t) {
|
|
4023
|
-
return new
|
|
4017
|
+
return new cn(t);
|
|
4024
4018
|
}), this.register(function(t) {
|
|
4025
4019
|
return new en(t);
|
|
4026
4020
|
}), this.register(function(t) {
|
|
4027
4021
|
return new nn(t);
|
|
4028
4022
|
}), this.register(function(t) {
|
|
4029
|
-
return new
|
|
4023
|
+
return new sn(t);
|
|
4030
4024
|
}), this.register(function(t) {
|
|
4031
4025
|
return new ln(t);
|
|
4032
4026
|
}), this.register(function(t) {
|
|
@@ -4035,6 +4029,8 @@ class ct {
|
|
|
4035
4029
|
return new un(t);
|
|
4036
4030
|
}), this.register(function(t) {
|
|
4037
4031
|
return new dn(t);
|
|
4032
|
+
}), this.register(function(t) {
|
|
4033
|
+
return new fn(t);
|
|
4038
4034
|
});
|
|
4039
4035
|
}
|
|
4040
4036
|
register(t) {
|
|
@@ -4047,7 +4043,7 @@ class ct {
|
|
|
4047
4043
|
return this.textureUtils = t, this;
|
|
4048
4044
|
}
|
|
4049
4045
|
parse(t, e, n, s) {
|
|
4050
|
-
const i = new
|
|
4046
|
+
const i = new Ze(), r = [];
|
|
4051
4047
|
for (let o = 0, a = this.pluginCallbacks.length; o < a; o++)
|
|
4052
4048
|
r.push(this.pluginCallbacks[o](i));
|
|
4053
4049
|
i.setPlugins(r), i.setTextureUtils(this.textureUtils), i.writeAsync(t, e, s).catch(n);
|
|
@@ -4093,24 +4089,24 @@ q[le] = T.LINEAR_MIPMAP_LINEAR;
|
|
|
4093
4089
|
q[he] = T.CLAMP_TO_EDGE;
|
|
4094
4090
|
q[ue] = T.REPEAT;
|
|
4095
4091
|
q[de] = T.MIRRORED_REPEAT;
|
|
4096
|
-
const
|
|
4092
|
+
const At = {
|
|
4097
4093
|
scale: "scale",
|
|
4098
4094
|
position: "translation",
|
|
4099
4095
|
quaternion: "rotation",
|
|
4100
4096
|
morphTargetInfluences: "weights"
|
|
4101
|
-
},
|
|
4097
|
+
}, Ye = new Ht(), bt = 12, ke = 1179937895, Xe = 2, Tt = 8, We = 1313821514, Ve = 5130562;
|
|
4102
4098
|
function Q(u, t) {
|
|
4103
4099
|
return u.length === t.length && u.every(function(e, n) {
|
|
4104
4100
|
return e === t[n];
|
|
4105
4101
|
});
|
|
4106
4102
|
}
|
|
4107
|
-
function
|
|
4103
|
+
function He(u) {
|
|
4108
4104
|
return new TextEncoder().encode(u).buffer;
|
|
4109
4105
|
}
|
|
4110
|
-
function
|
|
4106
|
+
function Je(u) {
|
|
4111
4107
|
return Q(u.elements, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
|
|
4112
4108
|
}
|
|
4113
|
-
function
|
|
4109
|
+
function $e(u, t, e) {
|
|
4114
4110
|
const n = {
|
|
4115
4111
|
min: new Array(u.itemSize).fill(Number.POSITIVE_INFINITY),
|
|
4116
4112
|
max: new Array(u.itemSize).fill(Number.NEGATIVE_INFINITY)
|
|
@@ -4136,10 +4132,10 @@ function ut(u, t = 0) {
|
|
|
4136
4132
|
}
|
|
4137
4133
|
return u;
|
|
4138
4134
|
}
|
|
4139
|
-
function
|
|
4135
|
+
function Pt() {
|
|
4140
4136
|
return typeof document > "u" && typeof OffscreenCanvas < "u" ? new OffscreenCanvas(1, 1) : document.createElement("canvas");
|
|
4141
4137
|
}
|
|
4142
|
-
function
|
|
4138
|
+
function Ke(u, t) {
|
|
4143
4139
|
if (typeof OffscreenCanvas < "u" && u instanceof OffscreenCanvas) {
|
|
4144
4140
|
let e;
|
|
4145
4141
|
return t === "image/jpeg" ? e = 0.92 : t === "image/webp" && (e = 0.8), u.convertToBlob({
|
|
@@ -4149,7 +4145,7 @@ function $e(u, t) {
|
|
|
4149
4145
|
} else
|
|
4150
4146
|
return new Promise((e) => u.toBlob(e, t));
|
|
4151
4147
|
}
|
|
4152
|
-
class
|
|
4148
|
+
class Ze {
|
|
4153
4149
|
constructor() {
|
|
4154
4150
|
this.plugins = [], this.options = {}, this.pending = [], this.buffers = [], this.byteOffset = 0, this.buffers = [], this.nodeMap = /* @__PURE__ */ new Map(), this.skins = [], this.extensionsUsed = {}, this.extensionsRequired = {}, this.uids = /* @__PURE__ */ new Map(), this.uid = 0, this.json = {
|
|
4155
4151
|
asset: {
|
|
@@ -4192,13 +4188,13 @@ class Ke {
|
|
|
4192
4188
|
n = s.options;
|
|
4193
4189
|
const o = s.extensionsUsed, a = s.extensionsRequired, l = new Blob(i, { type: "application/octet-stream" }), h = Object.keys(o), c = Object.keys(a);
|
|
4194
4190
|
h.length > 0 && (r.extensionsUsed = h), c.length > 0 && (r.extensionsRequired = c), r.buffers && r.buffers.length > 0 && (r.buffers[0].byteLength = l.size), n.binary === !0 ? dt(l).then(function(d) {
|
|
4195
|
-
const f = ut(d), p = new DataView(new ArrayBuffer(
|
|
4196
|
-
p.setUint32(0, f.byteLength, !0), p.setUint32(4,
|
|
4197
|
-
const y = ut(
|
|
4198
|
-
g.setUint32(0, y.byteLength, !0), g.setUint32(4,
|
|
4199
|
-
const x = new ArrayBuffer(
|
|
4200
|
-
M.setUint32(0,
|
|
4201
|
-
const w =
|
|
4191
|
+
const f = ut(d), p = new DataView(new ArrayBuffer(Tt));
|
|
4192
|
+
p.setUint32(0, f.byteLength, !0), p.setUint32(4, Ve, !0);
|
|
4193
|
+
const y = ut(He(JSON.stringify(r)), 32), g = new DataView(new ArrayBuffer(Tt));
|
|
4194
|
+
g.setUint32(0, y.byteLength, !0), g.setUint32(4, We, !0);
|
|
4195
|
+
const x = new ArrayBuffer(bt), M = new DataView(x);
|
|
4196
|
+
M.setUint32(0, ke, !0), M.setUint32(4, Xe, !0);
|
|
4197
|
+
const w = bt + g.byteLength + y.byteLength + p.byteLength + f.byteLength;
|
|
4202
4198
|
M.setUint32(8, w, !0);
|
|
4203
4199
|
const m = new Blob([
|
|
4204
4200
|
x,
|
|
@@ -4210,7 +4206,7 @@ class Ke {
|
|
|
4210
4206
|
dt(m).then((S) => {
|
|
4211
4207
|
e(S);
|
|
4212
4208
|
});
|
|
4213
|
-
}) : r.buffers && r.buffers.length > 0 ?
|
|
4209
|
+
}) : r.buffers && r.buffers.length > 0 ? pn(l).then((d) => {
|
|
4214
4210
|
r.buffers[0].uri = d, e(r);
|
|
4215
4211
|
}) : e(r);
|
|
4216
4212
|
}
|
|
@@ -4300,7 +4296,7 @@ class Ke {
|
|
|
4300
4296
|
};
|
|
4301
4297
|
}
|
|
4302
4298
|
t instanceof lt && (t = await this.decompressTextureAsync(t)), e instanceof lt && (e = await this.decompressTextureAsync(e));
|
|
4303
|
-
const s = t ? t.image : null, i = e ? e.image : null, r = Math.max(s ? s.width : 0, i ? i.width : 0), o = Math.max(s ? s.height : 0, i ? i.height : 0), a =
|
|
4299
|
+
const s = t ? t.image : null, i = e ? e.image : null, r = Math.max(s ? s.width : 0, i ? i.width : 0), o = Math.max(s ? s.height : 0, i ? i.height : 0), a = Pt();
|
|
4304
4300
|
a.width = r, a.height = o;
|
|
4305
4301
|
const l = a.getContext("2d", {
|
|
4306
4302
|
willReadFrequently: !0
|
|
@@ -4436,7 +4432,7 @@ class Ke {
|
|
|
4436
4432
|
else
|
|
4437
4433
|
throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: " + t.array.constructor.name);
|
|
4438
4434
|
if (n === void 0 && (n = 0), (s === void 0 || s === 1 / 0) && (s = t.count), s === 0) return null;
|
|
4439
|
-
const a =
|
|
4435
|
+
const a = $e(t, n, s);
|
|
4440
4436
|
let l;
|
|
4441
4437
|
e !== void 0 && (l = t === e.index ? T.ELEMENT_ARRAY_BUFFER : T.ARRAY_BUFFER);
|
|
4442
4438
|
const h = this.processBufferView(t, o, n, s, l), c = {
|
|
@@ -4465,7 +4461,7 @@ class Ke {
|
|
|
4465
4461
|
const h = r.images.get(t), c = s + ":flipY/" + n.toString();
|
|
4466
4462
|
if (h[c] !== void 0) return h[c];
|
|
4467
4463
|
o.images || (o.images = []);
|
|
4468
|
-
const d = { mimeType: s }, f =
|
|
4464
|
+
const d = { mimeType: s }, f = Pt();
|
|
4469
4465
|
f.width = Math.min(t.width, a.maxTextureSize), f.height = Math.min(t.height, a.maxTextureSize);
|
|
4470
4466
|
const p = f.getContext("2d", {
|
|
4471
4467
|
willReadFrequently: !0
|
|
@@ -4481,7 +4477,7 @@ class Ke {
|
|
|
4481
4477
|
else
|
|
4482
4478
|
throw new Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");
|
|
4483
4479
|
a.binary === !0 ? l.push(
|
|
4484
|
-
|
|
4480
|
+
Ke(f, s).then((g) => i.processBufferViewImage(g)).then((g) => {
|
|
4485
4481
|
d.bufferView = g;
|
|
4486
4482
|
})
|
|
4487
4483
|
) : d.uri = te.getDataURL(f, s);
|
|
@@ -4716,7 +4712,7 @@ class Ke {
|
|
|
4716
4712
|
}
|
|
4717
4713
|
e.normalized && (n += " normalized");
|
|
4718
4714
|
const s = t.split("_", 1)[0];
|
|
4719
|
-
|
|
4715
|
+
Et[s] && Et[s].includes(n) && (this.extensionsUsed[ht] = !0, this.extensionsRequired[ht] = !0);
|
|
4720
4716
|
}
|
|
4721
4717
|
/**
|
|
4722
4718
|
* Process camera
|
|
@@ -4758,14 +4754,14 @@ class Ke {
|
|
|
4758
4754
|
for (let l = 0; l < i.length; ++l) {
|
|
4759
4755
|
const h = i[l], c = ot.parseTrackName(h.name);
|
|
4760
4756
|
let d = ot.findNode(e, c.nodeName);
|
|
4761
|
-
const f =
|
|
4757
|
+
const f = At[c.propertyName];
|
|
4762
4758
|
if (c.objectName === "bones" && (d.isSkinnedMesh === !0 ? d = d.skeleton.getBoneByName(c.objectIndex) : d = void 0), !d || !f) {
|
|
4763
4759
|
console.warn('THREE.GLTFExporter: Could not export animation track "%s".', h.name);
|
|
4764
4760
|
continue;
|
|
4765
4761
|
}
|
|
4766
4762
|
const p = 1;
|
|
4767
4763
|
let y = h.values.length / h.times.length;
|
|
4768
|
-
f ===
|
|
4764
|
+
f === At.morphTargetInfluences && (y /= d.morphTargetInfluences.length);
|
|
4769
4765
|
let g;
|
|
4770
4766
|
h.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === !0 ? (g = "CUBICSPLINE", y /= 3) : h.getInterpolation() === ne ? g = "STEP" : g = "LINEAR", o.push({
|
|
4771
4767
|
input: this.processAccessor(new Y(h.times, p)),
|
|
@@ -4795,7 +4791,7 @@ class Ke {
|
|
|
4795
4791
|
if (i === void 0) return null;
|
|
4796
4792
|
const r = t.skeleton.bones[0];
|
|
4797
4793
|
if (r === void 0) return null;
|
|
4798
|
-
const o = [], a = new Float32Array(i.bones.length * 16), l = new
|
|
4794
|
+
const o = [], a = new Float32Array(i.bones.length * 16), l = new vt();
|
|
4799
4795
|
for (let c = 0; c < i.bones.length; ++c)
|
|
4800
4796
|
o.push(n.get(i.bones[c])), l.copy(i.boneInverses[c]), l.multiply(t.bindMatrix).toArray(a, c * 16);
|
|
4801
4797
|
return e.skins === void 0 && (e.skins = []), e.skins.push({
|
|
@@ -4817,7 +4813,7 @@ class Ke {
|
|
|
4817
4813
|
const o = t.quaternion.toArray(), a = t.position.toArray(), l = t.scale.toArray();
|
|
4818
4814
|
Q(o, [0, 0, 0, 1]) || (i.rotation = o), Q(a, [0, 0, 0]) || (i.translation = a), Q(l, [1, 1, 1]) || (i.scale = l);
|
|
4819
4815
|
} else
|
|
4820
|
-
t.matrixAutoUpdate && t.updateMatrix(),
|
|
4816
|
+
t.matrixAutoUpdate && t.updateMatrix(), Je(t.matrix) === !1 && (i.matrix = t.matrix.elements);
|
|
4821
4817
|
if (t.name !== "" && (i.name = String(t.name)), this.serializeUserData(t, i), t.isMesh || t.isLine || t.isPoints) {
|
|
4822
4818
|
const o = await this.processMeshAsync(t);
|
|
4823
4819
|
o !== null && (i.mesh = o);
|
|
@@ -4894,7 +4890,7 @@ class Ke {
|
|
|
4894
4890
|
await t(this.plugins[e]);
|
|
4895
4891
|
}
|
|
4896
4892
|
}
|
|
4897
|
-
class
|
|
4893
|
+
class Qe {
|
|
4898
4894
|
constructor(t) {
|
|
4899
4895
|
this.writer = t, this.name = "KHR_lights_punctual";
|
|
4900
4896
|
}
|
|
@@ -4910,7 +4906,7 @@ class Ze {
|
|
|
4910
4906
|
o.push(r), e.extensions = e.extensions || {}, e.extensions[this.name] = { light: o.length - 1 };
|
|
4911
4907
|
}
|
|
4912
4908
|
}
|
|
4913
|
-
class
|
|
4909
|
+
class tn {
|
|
4914
4910
|
constructor(t) {
|
|
4915
4911
|
this.writer = t, this.name = "KHR_materials_unlit";
|
|
4916
4912
|
}
|
|
@@ -4920,7 +4916,7 @@ class Qe {
|
|
|
4920
4916
|
e.extensions = e.extensions || {}, e.extensions[this.name] = {}, s[this.name] = !0, e.pbrMetallicRoughness.metallicFactor = 0, e.pbrMetallicRoughness.roughnessFactor = 0.9;
|
|
4921
4917
|
}
|
|
4922
4918
|
}
|
|
4923
|
-
class
|
|
4919
|
+
class en {
|
|
4924
4920
|
constructor(t) {
|
|
4925
4921
|
this.writer = t, this.name = "KHR_materials_clearcoat";
|
|
4926
4922
|
}
|
|
@@ -4951,7 +4947,7 @@ class tn {
|
|
|
4951
4947
|
e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
4952
4948
|
}
|
|
4953
4949
|
}
|
|
4954
|
-
class
|
|
4950
|
+
class nn {
|
|
4955
4951
|
constructor(t) {
|
|
4956
4952
|
this.writer = t, this.name = "KHR_materials_dispersion";
|
|
4957
4953
|
}
|
|
@@ -4961,7 +4957,7 @@ class en {
|
|
|
4961
4957
|
i.dispersion = t.dispersion, e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
4962
4958
|
}
|
|
4963
4959
|
}
|
|
4964
|
-
class
|
|
4960
|
+
class sn {
|
|
4965
4961
|
constructor(t) {
|
|
4966
4962
|
this.writer = t, this.name = "KHR_materials_iridescence";
|
|
4967
4963
|
}
|
|
@@ -4985,7 +4981,7 @@ class nn {
|
|
|
4985
4981
|
e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
4986
4982
|
}
|
|
4987
4983
|
}
|
|
4988
|
-
class
|
|
4984
|
+
class rn {
|
|
4989
4985
|
constructor(t) {
|
|
4990
4986
|
this.writer = t, this.name = "KHR_materials_transmission";
|
|
4991
4987
|
}
|
|
@@ -5002,7 +4998,7 @@ class sn {
|
|
|
5002
4998
|
e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
5003
4999
|
}
|
|
5004
5000
|
}
|
|
5005
|
-
class
|
|
5001
|
+
class on {
|
|
5006
5002
|
constructor(t) {
|
|
5007
5003
|
this.writer = t, this.name = "KHR_materials_volume";
|
|
5008
5004
|
}
|
|
@@ -5019,7 +5015,7 @@ class rn {
|
|
|
5019
5015
|
t.attenuationDistance !== 1 / 0 && (i.attenuationDistance = t.attenuationDistance), i.attenuationColor = t.attenuationColor.toArray(), e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
5020
5016
|
}
|
|
5021
5017
|
}
|
|
5022
|
-
class
|
|
5018
|
+
class an {
|
|
5023
5019
|
constructor(t) {
|
|
5024
5020
|
this.writer = t, this.name = "KHR_materials_ior";
|
|
5025
5021
|
}
|
|
@@ -5029,12 +5025,12 @@ class on {
|
|
|
5029
5025
|
i.ior = t.ior, e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
5030
5026
|
}
|
|
5031
5027
|
}
|
|
5032
|
-
class
|
|
5028
|
+
class cn {
|
|
5033
5029
|
constructor(t) {
|
|
5034
5030
|
this.writer = t, this.name = "KHR_materials_specular";
|
|
5035
5031
|
}
|
|
5036
5032
|
async writeMaterialAsync(t, e) {
|
|
5037
|
-
if (!t.isMeshPhysicalMaterial || t.specularIntensity === 1 && t.specularColor.equals(
|
|
5033
|
+
if (!t.isMeshPhysicalMaterial || t.specularIntensity === 1 && t.specularColor.equals(Ye) && !t.specularIntensityMap && !t.specularColorMap) return;
|
|
5038
5034
|
const n = this.writer, s = n.extensionsUsed, i = {};
|
|
5039
5035
|
if (t.specularIntensityMap) {
|
|
5040
5036
|
const r = {
|
|
@@ -5053,7 +5049,7 @@ class an {
|
|
|
5053
5049
|
i.specularFactor = t.specularIntensity, i.specularColorFactor = t.specularColor.toArray(), e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
5054
5050
|
}
|
|
5055
5051
|
}
|
|
5056
|
-
class
|
|
5052
|
+
class ln {
|
|
5057
5053
|
constructor(t) {
|
|
5058
5054
|
this.writer = t, this.name = "KHR_materials_sheen";
|
|
5059
5055
|
}
|
|
@@ -5077,7 +5073,7 @@ class cn {
|
|
|
5077
5073
|
i.sheenRoughnessFactor = t.sheenRoughness, i.sheenColorFactor = t.sheenColor.toArray(), e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
5078
5074
|
}
|
|
5079
5075
|
}
|
|
5080
|
-
class
|
|
5076
|
+
class hn {
|
|
5081
5077
|
constructor(t) {
|
|
5082
5078
|
this.writer = t, this.name = "KHR_materials_anisotropy";
|
|
5083
5079
|
}
|
|
@@ -5091,7 +5087,7 @@ class ln {
|
|
|
5091
5087
|
i.anisotropyStrength = t.anisotropy, i.anisotropyRotation = t.anisotropyRotation, e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
5092
5088
|
}
|
|
5093
5089
|
}
|
|
5094
|
-
class
|
|
5090
|
+
class un {
|
|
5095
5091
|
constructor(t) {
|
|
5096
5092
|
this.writer = t, this.name = "KHR_materials_emissive_strength";
|
|
5097
5093
|
}
|
|
@@ -5101,7 +5097,7 @@ class hn {
|
|
|
5101
5097
|
i.emissiveStrength = t.emissiveIntensity, e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
5102
5098
|
}
|
|
5103
5099
|
}
|
|
5104
|
-
class
|
|
5100
|
+
class dn {
|
|
5105
5101
|
constructor(t) {
|
|
5106
5102
|
this.writer = t, this.name = "EXT_materials_bump";
|
|
5107
5103
|
}
|
|
@@ -5118,13 +5114,13 @@ class un {
|
|
|
5118
5114
|
i.bumpFactor = t.bumpScale, e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
5119
5115
|
}
|
|
5120
5116
|
}
|
|
5121
|
-
class
|
|
5117
|
+
class fn {
|
|
5122
5118
|
constructor(t) {
|
|
5123
5119
|
this.writer = t, this.name = "EXT_mesh_gpu_instancing";
|
|
5124
5120
|
}
|
|
5125
5121
|
writeNode(t, e) {
|
|
5126
5122
|
if (!t.isInstancedMesh) return;
|
|
5127
|
-
const n = this.writer, s = t, i = new Float32Array(s.count * 3), r = new Float32Array(s.count * 4), o = new Float32Array(s.count * 3), a = new
|
|
5123
|
+
const n = this.writer, s = t, i = new Float32Array(s.count * 3), r = new Float32Array(s.count * 4), o = new Float32Array(s.count * 3), a = new vt(), l = new rt(), h = new Jt(), c = new rt();
|
|
5128
5124
|
for (let f = 0; f < s.count; f++)
|
|
5129
5125
|
s.getMatrixAt(f, a), a.decompose(l, h, c), l.toArray(i, f * 3), h.toArray(r, f * 4), c.toArray(o, f * 3);
|
|
5130
5126
|
const d = {
|
|
@@ -5208,7 +5204,7 @@ ct.Utils = {
|
|
|
5208
5204
|
return t;
|
|
5209
5205
|
}
|
|
5210
5206
|
};
|
|
5211
|
-
async function
|
|
5207
|
+
async function pn(u) {
|
|
5212
5208
|
if (typeof FileReader > "u") {
|
|
5213
5209
|
const t = await u.arrayBuffer(), n = Buffer.from(t).toString("base64");
|
|
5214
5210
|
return `data:${u.type};base64,${n}`;
|
|
@@ -5231,8 +5227,8 @@ async function dt(u) {
|
|
|
5231
5227
|
return t.buffer.slice(t.byteOffset, t.byteOffset + t.byteLength);
|
|
5232
5228
|
}
|
|
5233
5229
|
}
|
|
5234
|
-
const
|
|
5235
|
-
function
|
|
5230
|
+
const gn = new pe(), yn = new ct();
|
|
5231
|
+
function xn(u, t, e = 0.1) {
|
|
5236
5232
|
const n = t.normal(u), s = t.direction(u).mutiplyScalar(e * 0.5), i = u.direction(t).mutiplyScalar(e * 0.5), r = n.x * e * 0.5, o = n.y * e * 0.5;
|
|
5237
5233
|
return {
|
|
5238
5234
|
points: [
|
|
@@ -5277,7 +5273,7 @@ class Yt extends z {
|
|
|
5277
5273
|
new P.LineSegments(new P.EdgesGeometry(i), new P.LineBasicMaterial({ color: 0 }))
|
|
5278
5274
|
);
|
|
5279
5275
|
}), t.originalData.map(({ start: n, end: s, insetionArr: i }) => {
|
|
5280
|
-
const r = new D(n.x, n.y).mutiplyScalar(t.scale), o = new D(s.x, s.y).mutiplyScalar(t.scale), { points: a, indices: l, rectIndices: h } =
|
|
5276
|
+
const r = new D(n.x, n.y).mutiplyScalar(t.scale), o = new D(s.x, s.y).mutiplyScalar(t.scale), { points: a, indices: l, rectIndices: h } = xn(r, o, t.width);
|
|
5281
5277
|
return {
|
|
5282
5278
|
points: a,
|
|
5283
5279
|
indices: l,
|
|
@@ -5310,7 +5306,7 @@ class Yt extends z {
|
|
|
5310
5306
|
toOBJ() {
|
|
5311
5307
|
return new Promise((t) => {
|
|
5312
5308
|
this.material.opacity = 1, this.material.needsUpdate = !0, setTimeout(() => {
|
|
5313
|
-
t(
|
|
5309
|
+
t(gn.parse(this.whiteModelGroup)), this.material.opacity = 0.8, this.material.transparent = !0;
|
|
5314
5310
|
}, 20);
|
|
5315
5311
|
});
|
|
5316
5312
|
}
|
|
@@ -5322,7 +5318,7 @@ class Yt extends z {
|
|
|
5322
5318
|
toGltf(t = !0) {
|
|
5323
5319
|
return new Promise((e) => {
|
|
5324
5320
|
this.material.opacity = 1, this.material.needsUpdate = !0, setTimeout(async () => {
|
|
5325
|
-
|
|
5321
|
+
yn.parse(this.whiteModelGroup.children, (n) => {
|
|
5326
5322
|
e(n), this.material.opacity = 0.8, this.material.transparent = !0;
|
|
5327
5323
|
}, () => {
|
|
5328
5324
|
e(void 0);
|
|
@@ -5483,13 +5479,13 @@ class Xt extends z {
|
|
|
5483
5479
|
});
|
|
5484
5480
|
}
|
|
5485
5481
|
}
|
|
5486
|
-
const
|
|
5482
|
+
const mn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5487
5483
|
__proto__: null,
|
|
5488
5484
|
DetailsPoint: kt,
|
|
5489
5485
|
DxfLineModel: Xt,
|
|
5490
5486
|
WhiteModel: Yt
|
|
5491
5487
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
5492
|
-
function
|
|
5488
|
+
function It(u, t = {}) {
|
|
5493
5489
|
const {
|
|
5494
5490
|
detailsPoint: e = !0,
|
|
5495
5491
|
whiteModel: n = !0,
|
|
@@ -5497,14 +5493,14 @@ function vt(u, t = {}) {
|
|
|
5497
5493
|
} = t;
|
|
5498
5494
|
s && u.addComponent(new Xt()), n && u.addComponent(new Yt()), e && u.addComponent(new kt());
|
|
5499
5495
|
}
|
|
5500
|
-
const
|
|
5496
|
+
const wn = Object.assign(It, {
|
|
5501
5497
|
create(u = {}) {
|
|
5502
|
-
return (t) =>
|
|
5498
|
+
return (t) => It(t, u);
|
|
5503
5499
|
}
|
|
5504
|
-
}),
|
|
5500
|
+
}), Mn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5505
5501
|
__proto__: null,
|
|
5506
|
-
ModelDataPlugin:
|
|
5507
|
-
components:
|
|
5502
|
+
ModelDataPlugin: wn,
|
|
5503
|
+
components: mn
|
|
5508
5504
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
5509
5505
|
function Wt(u, t, e = 1e-3) {
|
|
5510
5506
|
if (Array.isArray(u) && u[0] instanceof D) {
|
|
@@ -5524,7 +5520,7 @@ function Wt(u, t, e = 1e-3) {
|
|
|
5524
5520
|
}
|
|
5525
5521
|
}
|
|
5526
5522
|
}
|
|
5527
|
-
function
|
|
5523
|
+
function Dn(u, t, e = 1e-3) {
|
|
5528
5524
|
const n = K.finalInstance;
|
|
5529
5525
|
if (n) {
|
|
5530
5526
|
const s = n.findComponentByName("Renderer");
|
|
@@ -5534,7 +5530,7 @@ function Mn(u, t, e = 1e-3) {
|
|
|
5534
5530
|
}
|
|
5535
5531
|
}
|
|
5536
5532
|
}
|
|
5537
|
-
function
|
|
5533
|
+
function Sn(u, t, e, n = 1e-3) {
|
|
5538
5534
|
const s = K.finalInstance;
|
|
5539
5535
|
if (s) {
|
|
5540
5536
|
const i = s.findComponentByName("Renderer"), r = s.findComponentByName("Editor");
|
|
@@ -5544,19 +5540,16 @@ function Dn(u, t, e, n = 1e-3) {
|
|
|
5544
5540
|
}
|
|
5545
5541
|
}
|
|
5546
5542
|
}
|
|
5547
|
-
function
|
|
5543
|
+
function Ln() {
|
|
5548
5544
|
return import("./index2.js");
|
|
5549
5545
|
}
|
|
5550
|
-
function
|
|
5546
|
+
function En() {
|
|
5551
5547
|
return import("./index3.js");
|
|
5552
5548
|
}
|
|
5553
5549
|
let gt = null;
|
|
5554
|
-
window.drawLines = Wt;
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
window.rendomColor = () => Math.floor(Math.random() * 16777215);
|
|
5558
|
-
async function vn(u, t, e = !1, n) {
|
|
5559
|
-
const s = await Promise.resolve().then(() => wn), i = await Sn(), r = await Ln(), o = new K().usePlugin(s.ModelDataPlugin.create({
|
|
5550
|
+
typeof window < "u" && (window.drawLines = Wt, window.drawPoint = Dn, window.drawText = Sn, window.rendomColor = () => Math.floor(Math.random() * 16777215));
|
|
5551
|
+
async function Rn(u, t, e = !1, n) {
|
|
5552
|
+
const s = await Promise.resolve().then(() => Mn), i = await Ln(), r = await En(), o = new K().usePlugin(s.ModelDataPlugin.create({
|
|
5560
5553
|
detailsPoint: !1,
|
|
5561
5554
|
whiteModel: !0
|
|
5562
5555
|
})).usePlugin(i.RenderPlugin.create({
|
|
@@ -5568,10 +5561,10 @@ async function vn(u, t, e = !1, n) {
|
|
|
5568
5561
|
})).usePlugin(r.Editor.create({ viewPermission: n })), a = o.findComponentByType(i.components.DomContainer);
|
|
5569
5562
|
return a && u.appendChild(a.domElement), gt = o, {
|
|
5570
5563
|
dxfSystem: o,
|
|
5571
|
-
getFileAll: () =>
|
|
5564
|
+
getFileAll: () => An(o)
|
|
5572
5565
|
};
|
|
5573
5566
|
}
|
|
5574
|
-
async function
|
|
5567
|
+
async function An(u = gt) {
|
|
5575
5568
|
const t = u.findComponentByName("WhiteModel"), e = new File([await u.AngleCorrectionDxf.toDxfImageBlob()], "img.jpg", { type: "image/jpeg" }), n = new File([u.Dxf.toDxfBlob()], "dxf.dxf", { type: "application/dxf" }), s = new File([u.AngleCorrectionDxf.toDxfBlob()], "dxf.dxf", { type: "application/dxf" }), i = new File([await t.toOBJBlob()], "model.obj", { type: "application/octet-stream" }), r = new File([await t.toGltfBlob(!0)], "model.glb", { type: "application/octet-stream" }), o = new File([await t.toGltfBlob(!1)], "model.gltf", { type: "application/json" }), a = new File([JSON.stringify(u.Dxf.originalData)], "json.json", { type: "application/json" });
|
|
5576
5569
|
return {
|
|
5577
5570
|
dxf: n,
|
|
@@ -5583,7 +5576,7 @@ async function En(u = gt) {
|
|
|
5583
5576
|
correctionDxf: s
|
|
5584
5577
|
};
|
|
5585
5578
|
}
|
|
5586
|
-
function
|
|
5579
|
+
function Cn() {
|
|
5587
5580
|
return gt;
|
|
5588
5581
|
}
|
|
5589
5582
|
export {
|
|
@@ -5591,24 +5584,24 @@ export {
|
|
|
5591
5584
|
R as B,
|
|
5592
5585
|
z as C,
|
|
5593
5586
|
K as D,
|
|
5594
|
-
|
|
5587
|
+
Rt as E,
|
|
5595
5588
|
E as L,
|
|
5596
|
-
|
|
5589
|
+
wn as M,
|
|
5597
5590
|
D as P,
|
|
5598
5591
|
O as Q,
|
|
5599
|
-
|
|
5592
|
+
_e as T,
|
|
5600
5593
|
Ut as V,
|
|
5601
5594
|
Yt as W,
|
|
5602
5595
|
kt as a,
|
|
5603
5596
|
G as b,
|
|
5604
5597
|
W as c,
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5598
|
+
qe as d,
|
|
5599
|
+
Rn as e,
|
|
5600
|
+
Cn as f,
|
|
5601
|
+
An as g,
|
|
5609
5602
|
k as h,
|
|
5610
|
-
|
|
5611
|
-
|
|
5603
|
+
mn as i,
|
|
5604
|
+
vn as j,
|
|
5612
5605
|
V as r,
|
|
5613
5606
|
tt as u
|
|
5614
5607
|
};
|