bimatter-viewer-react 0.6.7 → 0.6.8
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/lib/index.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import { t as e } from "./three.webgpu-vPugBGTK.js";
|
|
2
2
|
import { a as t, c as n, d as r, f as i, i as a, l as o, n as s, o as c, r as l, t as u, u as d } from "./three.tsl-BarIGkA_.js";
|
|
3
3
|
import f, { Suspense as p, forwardRef as m, lazy as h, memo as g, useCallback as _, useEffect as v, useImperativeHandle as y, useMemo as b, useRef as x, useState as S } from "react";
|
|
4
|
-
import { Canvas as
|
|
5
|
-
import { CameraControls as
|
|
6
|
-
import { Box3 as
|
|
7
|
-
import { CONTAINED as
|
|
8
|
-
import { Fragment as
|
|
9
|
-
import
|
|
4
|
+
import { Canvas as C, useFrame as w, useThree as T } from "@react-three/fiber";
|
|
5
|
+
import { CameraControls as E, Stats as ee } from "@react-three/drei";
|
|
6
|
+
import { Box3 as D, BoxGeometry as O, BufferAttribute as k, BufferGeometry as A, CanvasTexture as j, Color as M, ConeGeometry as N, DoubleSide as P, DynamicDrawUsage as te, Float32BufferAttribute as F, Group as I, Line as L, Line3 as R, LineBasicMaterial as z, LineDashedMaterial as B, LineSegments as ne, LinearFilter as V, LinearMipmapLinearFilter as re, MathUtils as ie, Matrix4 as ae, Mesh as H, MeshBasicMaterial as U, MeshLambertMaterial as oe, Object3D as W, OrthographicCamera as se, PerspectiveCamera as ce, Plane as le, RepeatWrapping as ue, SRGBColorSpace as de, ShapeUtils as fe, Sphere as pe, SphereGeometry as me, Sprite as he, SpriteMaterial as ge, Uint32BufferAttribute as _e, Vector2 as G, Vector3 as K } from "three";
|
|
7
|
+
import { CONTAINED as ve, INTERSECTED as ye, MeshBVH as be, NOT_INTERSECTED as xe, acceleratedRaycast as Se } from "three-mesh-bvh";
|
|
8
|
+
import { Fragment as Ce, jsx as q, jsxs as J } from "react/jsx-runtime";
|
|
9
|
+
import we from "pako";
|
|
10
10
|
//#region src/viewer/SelectableMesh.tsx
|
|
11
|
-
|
|
12
|
-
var
|
|
11
|
+
H.prototype.raycast = Se;
|
|
12
|
+
var Te = 1 / 1.5, Ee = f.memo(function({ colorPaletteTexture: e, material: t, materialMode: n = "quality", data: r, isIfcSpace: i = !1, meshMatrix: a, useDoubleSideMaterial: o = !1 }) {
|
|
13
13
|
let s = x(null), c = d((e) => e.preselectionColor), l = x(c);
|
|
14
14
|
l.current = c;
|
|
15
15
|
let u = b(() => {
|
|
16
|
-
let r = new
|
|
17
|
-
n === "performance" && r.multiplyScalar(
|
|
16
|
+
let r = new M(t.r, t.g, t.b);
|
|
17
|
+
n === "performance" && r.multiplyScalar(Te);
|
|
18
18
|
let i = {
|
|
19
19
|
color: r.clone(),
|
|
20
20
|
transparent: !!(t.opacity && t.opacity != 1),
|
|
21
21
|
opacity: t.opacity ?? 1
|
|
22
22
|
}, a = o ? {
|
|
23
23
|
...i,
|
|
24
|
-
side:
|
|
25
|
-
} : i, s = n === "performance" ? new
|
|
24
|
+
side: P
|
|
25
|
+
} : i, s = n === "performance" ? new U(a) : new oe(a), c = s;
|
|
26
26
|
return c.defaultAttributeValues = {
|
|
27
27
|
...c.defaultAttributeValues,
|
|
28
28
|
colorIndex: [0]
|
|
29
29
|
}, s.onBeforeCompile = (t) => {
|
|
30
|
-
let n = new
|
|
30
|
+
let n = new M(l.current);
|
|
31
31
|
t.uniforms.baseColor = { value: r.clone() }, t.uniforms.preSelectionColor = { value: n }, t.uniforms.preSelectionId = { value: -1 }, t.uniforms.elementColorPalette = { value: e }, t.vertexShader = t.vertexShader.replace("#include <common>", "\n #include <common>\n attribute float colorIndex;\n attribute uint ids;\n flat varying float vColorIndex;\n flat varying float vPreselectId;\n "), t.vertexShader = t.vertexShader.replace("#include <begin_vertex>", "\n #include <begin_vertex>\n vColorIndex = colorIndex;\n vPreselectId = float(ids);\n "), t.fragmentShader = t.fragmentShader.replace("#include <common>", "\n #include <common>\n uniform vec3 baseColor;\n uniform vec3 preSelectionColor;\n uniform sampler2D elementColorPalette;\n flat varying float vPreselectId;\n flat varying float vColorIndex;\n uniform float preSelectionId;\n "), t.fragmentShader = t.fragmentShader.replace("vec4 diffuseColor = vec4( diffuse, opacity );", `
|
|
32
32
|
vec4 diffuseColor;
|
|
33
33
|
if(preSelectionId == vPreselectId && abs(vColorIndex - 1.0) > 0.5){
|
|
@@ -53,14 +53,14 @@ var De = 1 / 1.5, Oe = f.memo(function({ colorPaletteTexture: e, material: t, ma
|
|
|
53
53
|
]);
|
|
54
54
|
return v(() => {
|
|
55
55
|
let e = u.userData.shader?.uniforms.preSelectionColor;
|
|
56
|
-
e && (e.value instanceof
|
|
56
|
+
e && (e.value instanceof M ? e.value.set(c) : e.value = new M(c));
|
|
57
57
|
}, [u, c]), v(() => {
|
|
58
58
|
if (!s.current) return;
|
|
59
|
-
let e = s.current.geometry, t = new
|
|
59
|
+
let e = s.current.geometry, t = new be(e, { indirect: !0 });
|
|
60
60
|
return Object.assign(e, { boundsTree: t }), () => {
|
|
61
61
|
u.dispose(), Object.assign(e, { boundsTree: null });
|
|
62
62
|
};
|
|
63
|
-
}, [u]), /* @__PURE__ */
|
|
63
|
+
}, [u]), /* @__PURE__ */ J("mesh", {
|
|
64
64
|
frustumCulled: !0,
|
|
65
65
|
matrix: a,
|
|
66
66
|
matrixAutoUpdate: !1,
|
|
@@ -71,38 +71,38 @@ var De = 1 / 1.5, Oe = f.memo(function({ colorPaletteTexture: e, material: t, ma
|
|
|
71
71
|
let t = e.object;
|
|
72
72
|
t.preselected &&= !1;
|
|
73
73
|
},
|
|
74
|
-
children: [/* @__PURE__ */
|
|
75
|
-
/* @__PURE__ */
|
|
74
|
+
children: [/* @__PURE__ */ J("bufferGeometry", { children: [
|
|
75
|
+
/* @__PURE__ */ q("bufferAttribute", {
|
|
76
76
|
attach: "attributes-position",
|
|
77
77
|
args: [r.pos, 3]
|
|
78
78
|
}),
|
|
79
|
-
r.norm && /* @__PURE__ */
|
|
79
|
+
r.norm && /* @__PURE__ */ q("bufferAttribute", {
|
|
80
80
|
attach: "attributes-normal",
|
|
81
81
|
args: [r.norm, 3]
|
|
82
82
|
}),
|
|
83
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ q("bufferAttribute", {
|
|
84
84
|
attach: "attributes-ids",
|
|
85
85
|
args: [r.ids, 1]
|
|
86
86
|
}),
|
|
87
|
-
/* @__PURE__ */
|
|
87
|
+
/* @__PURE__ */ q("bufferAttribute", {
|
|
88
88
|
attach: "index",
|
|
89
89
|
args: [r.ind, 1]
|
|
90
90
|
})
|
|
91
|
-
] }), /* @__PURE__ */
|
|
91
|
+
] }), /* @__PURE__ */ q("primitive", { object: u })]
|
|
92
92
|
});
|
|
93
|
-
}),
|
|
94
|
-
function
|
|
93
|
+
}), De = 10, Oe = "#1d2733", ke = 2, Ae = .05, je = "\0", Me = /* @__PURE__ */ new Map();
|
|
94
|
+
function Ne() {
|
|
95
95
|
return typeof window > "u" ? 1 : Math.min(window.devicePixelRatio || 1, 2);
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
let i =
|
|
97
|
+
function Pe(e, t, n, r) {
|
|
98
|
+
let i = Ne(), a = document.createElement("canvas"), o = a.getContext("2d");
|
|
99
99
|
if (!o) throw Error("Could not create grid label canvas context");
|
|
100
100
|
let s = `400 ${r}px system-ui, "Segoe UI", sans-serif`, c = Math.ceil(r * .5), l = Math.ceil(r * .35);
|
|
101
101
|
o.font = s;
|
|
102
102
|
let u = o.measureText(t), d = u.actualBoundingBoxAscent || r * .8, f = u.actualBoundingBoxDescent || r * .2, p = Math.max(1, Math.ceil(u.width + c * 2)), m = Math.max(1, Math.ceil(d + f + l * 2));
|
|
103
103
|
a.width = Math.ceil(p * i), a.height = Math.ceil(m * i), o.scale(i, i), o.clearRect(0, 0, p, m), o.font = s, o.fillStyle = n, o.textAlign = "left", o.textBaseline = "alphabetic", o.fillText(t, c, l + d);
|
|
104
|
-
let h = new
|
|
105
|
-
return h.colorSpace =
|
|
104
|
+
let h = new j(a);
|
|
105
|
+
return h.colorSpace = de, h.generateMipmaps = !1, h.magFilter = V, h.minFilter = V, h.needsUpdate = !0, {
|
|
106
106
|
disposeTimer: null,
|
|
107
107
|
height: m,
|
|
108
108
|
key: e,
|
|
@@ -111,49 +111,49 @@ function Ie(e, t, n, r) {
|
|
|
111
111
|
width: p
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function Fe(e, t, n) {
|
|
115
115
|
let r = [
|
|
116
116
|
e,
|
|
117
117
|
t,
|
|
118
118
|
n
|
|
119
|
-
].join(
|
|
120
|
-
return i || (i =
|
|
119
|
+
].join(je), i = Me.get(r);
|
|
120
|
+
return i || (i = Pe(r, e, t, n), Me.set(r, i)), i;
|
|
121
121
|
}
|
|
122
|
-
function
|
|
123
|
-
let r = b(() =>
|
|
122
|
+
function Ie(e, t, n) {
|
|
123
|
+
let r = b(() => Fe(e, t, n), [
|
|
124
124
|
t,
|
|
125
125
|
n,
|
|
126
126
|
e
|
|
127
127
|
]);
|
|
128
128
|
return v(() => (r.disposeTimer &&= (clearTimeout(r.disposeTimer), null), r.refs++, () => {
|
|
129
129
|
r.refs = Math.max(0, r.refs - 1), r.refs <= 0 && (r.disposeTimer = setTimeout(() => {
|
|
130
|
-
r.refs > 0 || (r.texture.dispose(),
|
|
130
|
+
r.refs > 0 || (r.texture.dispose(), Me.delete(r.key), r.disposeTimer = null);
|
|
131
131
|
}, 1e3));
|
|
132
132
|
}), [r]), r;
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function Le(e, t, n, r) {
|
|
135
135
|
let i = Math.abs(n.projectionMatrix.elements[5]) || 1, a = t.height * 2 / (Math.max(1, r) * i), o = a * (t.width / t.height);
|
|
136
136
|
e.scale.set(o, a, 1);
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function Re(e, t) {
|
|
139
139
|
let n = e[t];
|
|
140
140
|
return n === void 0 ? 0 : Number.isFinite(n) ? n : null;
|
|
141
141
|
}
|
|
142
|
-
function
|
|
143
|
-
return
|
|
142
|
+
function ze(e, t) {
|
|
143
|
+
return Re(e, t) ?? 0;
|
|
144
144
|
}
|
|
145
|
-
function
|
|
146
|
-
let t =
|
|
147
|
-
return t === null || n === null || r === null ? null : new
|
|
145
|
+
function Be(e) {
|
|
146
|
+
let t = Re(e, "x"), n = Re(e, "y"), r = Re(e, "z");
|
|
147
|
+
return t === null || n === null || r === null ? null : new K(t, n, r);
|
|
148
148
|
}
|
|
149
|
-
function
|
|
149
|
+
function Ve(e, t) {
|
|
150
150
|
return [
|
|
151
|
-
|
|
152
|
-
t !== void 0 && Number.isFinite(t) ? t :
|
|
153
|
-
|
|
151
|
+
ze(e, "x"),
|
|
152
|
+
t !== void 0 && Number.isFinite(t) ? t : ze(e, "y"),
|
|
153
|
+
ze(e, "z")
|
|
154
154
|
];
|
|
155
155
|
}
|
|
156
|
-
function
|
|
156
|
+
function He(e) {
|
|
157
157
|
let { h: t, l: n } = e.getHSL({
|
|
158
158
|
h: 0,
|
|
159
159
|
s: 0,
|
|
@@ -161,14 +161,14 @@ function Ue(e) {
|
|
|
161
161
|
});
|
|
162
162
|
return t < .55 && n >= .5 || t >= .55 && n >= .75 ? "#000000" : "#ffffff";
|
|
163
163
|
}
|
|
164
|
-
function
|
|
165
|
-
let t =
|
|
166
|
-
return b(() => e || (t instanceof
|
|
164
|
+
function Ue(e) {
|
|
165
|
+
let t = T((e) => e.scene.background);
|
|
166
|
+
return b(() => e || (t instanceof M ? He(t) : Oe), [t, e]);
|
|
167
167
|
}
|
|
168
|
-
function
|
|
168
|
+
function We({ axis: e, grid: t, endSide: n, startSide: r }) {
|
|
169
169
|
return Object.entries(e).flatMap(([e, i]) => {
|
|
170
170
|
if (i.length < 2) return [];
|
|
171
|
-
let a =
|
|
171
|
+
let a = Be(i[0]), o = Be(i[1]);
|
|
172
172
|
return !a || !o ? [] : (a.y = 0, o.y = 0, [{
|
|
173
173
|
endSide: n,
|
|
174
174
|
loc: t.loc,
|
|
@@ -178,18 +178,18 @@ function Ge({ axis: e, grid: t, endSide: n, startSide: r }) {
|
|
|
178
178
|
}]);
|
|
179
179
|
});
|
|
180
180
|
}
|
|
181
|
-
function
|
|
181
|
+
function Ge({ flattenToFloor: e, grids: t, showBottom: n, showLeft: r, showRight: i, showTop: a }) {
|
|
182
182
|
let o = {
|
|
183
183
|
bottom: n,
|
|
184
184
|
left: r,
|
|
185
185
|
right: i,
|
|
186
186
|
top: a
|
|
187
|
-
}, s = Object.values(t).flatMap((e) => [...
|
|
187
|
+
}, s = Object.values(t).flatMap((e) => [...We({
|
|
188
188
|
axis: e.points.u,
|
|
189
189
|
endSide: "right",
|
|
190
190
|
grid: e,
|
|
191
191
|
startSide: "left"
|
|
192
|
-
}), ...
|
|
192
|
+
}), ...We({
|
|
193
193
|
axis: e.points.v,
|
|
194
194
|
endSide: "bottom",
|
|
195
195
|
grid: e,
|
|
@@ -202,8 +202,8 @@ function Ke({ flattenToFloor: e, grids: t, showBottom: n, showLeft: r, showRight
|
|
|
202
202
|
e.startSide,
|
|
203
203
|
e.endSide,
|
|
204
204
|
e.name,
|
|
205
|
-
|
|
206
|
-
|
|
205
|
+
ze(e.loc, "x"),
|
|
206
|
+
ze(e.loc, "z"),
|
|
207
207
|
e.points[0].x,
|
|
208
208
|
e.points[0].z,
|
|
209
209
|
e.points[1].x,
|
|
@@ -212,57 +212,57 @@ function Ke({ flattenToFloor: e, grids: t, showBottom: n, showLeft: r, showRight
|
|
|
212
212
|
c.has(t) || c.set(t, e);
|
|
213
213
|
}), Array.from(c.values());
|
|
214
214
|
}
|
|
215
|
-
function
|
|
216
|
-
return new
|
|
215
|
+
function Ke(e, t) {
|
|
216
|
+
return new K(...Ve(e.loc, t));
|
|
217
217
|
}
|
|
218
|
-
function
|
|
218
|
+
function qe({ cameraPosition: e, floorY: t, line: n, showBottom: r, showLeft: i, showRight: a, showTop: o }) {
|
|
219
219
|
let s = {
|
|
220
220
|
bottom: r,
|
|
221
221
|
left: i,
|
|
222
222
|
right: a,
|
|
223
223
|
top: o
|
|
224
|
-
}, c =
|
|
224
|
+
}, c = Ke(n, t), l = n.points[0].clone().add(c), u = n.points[1].clone().add(c), d = l.distanceToSquared(e) > u.distanceToSquared(e) ? "start" : "end", f = d === "start" ? "end" : "start", p = (e) => s[e === "start" ? n.startSide : n.endSide];
|
|
225
225
|
return p(d) ? d : p(f) ? f : null;
|
|
226
226
|
}
|
|
227
|
-
function
|
|
227
|
+
function Je({ endpoint: e, labelOffset: t, line: n }) {
|
|
228
228
|
let r = e === "start" ? n.points[0].clone() : n.points[1].clone(), i = n.points[1].clone().sub(n.points[0]);
|
|
229
229
|
return i.y = 0, i.lengthSq() === 0 && i.set(1, 0, 0), i.normalize().multiplyScalar(t), e === "start" && i.negate(), r.add(i);
|
|
230
230
|
}
|
|
231
|
-
function
|
|
232
|
-
let n = new
|
|
231
|
+
function Ye(e, t) {
|
|
232
|
+
let n = new K(), r = 0;
|
|
233
233
|
return e.forEach((e) => {
|
|
234
|
-
let i =
|
|
234
|
+
let i = Ke(e, t);
|
|
235
235
|
e.points.forEach((e) => {
|
|
236
236
|
n.add(e).add(i), r++;
|
|
237
237
|
});
|
|
238
238
|
}), r && n.divideScalar(r), n;
|
|
239
239
|
}
|
|
240
|
-
function
|
|
240
|
+
function Xe(e, t, n) {
|
|
241
241
|
let r = 0;
|
|
242
242
|
return e.forEach((e) => {
|
|
243
|
-
let i =
|
|
243
|
+
let i = Ke(e, n);
|
|
244
244
|
e.points.forEach((e) => {
|
|
245
245
|
r = Math.max(r, e.clone().add(i).distanceTo(t));
|
|
246
246
|
});
|
|
247
247
|
}), r;
|
|
248
248
|
}
|
|
249
|
-
function
|
|
250
|
-
let { camera: i, size: a } =
|
|
249
|
+
function Ze({ color: e, fontSize: t, position: n, text: r }) {
|
|
250
|
+
let { camera: i, size: a } = T(), o = x(null), s = Ie(r, e, t);
|
|
251
251
|
return v(() => {
|
|
252
252
|
let e = o.current;
|
|
253
|
-
e &&
|
|
253
|
+
e && Le(e, s, i, a.height);
|
|
254
254
|
}, [
|
|
255
255
|
i,
|
|
256
256
|
a.height,
|
|
257
257
|
s
|
|
258
|
-
]),
|
|
258
|
+
]), w(({ camera: e, size: t }) => {
|
|
259
259
|
let n = o.current;
|
|
260
|
-
n &&
|
|
261
|
-
}), /* @__PURE__ */
|
|
260
|
+
n && Le(n, s, e, t.height);
|
|
261
|
+
}), /* @__PURE__ */ q("sprite", {
|
|
262
262
|
ref: o,
|
|
263
263
|
position: n,
|
|
264
264
|
renderOrder: 2,
|
|
265
|
-
children: /* @__PURE__ */
|
|
265
|
+
children: /* @__PURE__ */ q("spriteMaterial", {
|
|
266
266
|
alphaTest: .1,
|
|
267
267
|
depthTest: !0,
|
|
268
268
|
depthWrite: !1,
|
|
@@ -273,8 +273,8 @@ function Qe({ color: e, fontSize: t, position: n, text: r }) {
|
|
|
273
273
|
})
|
|
274
274
|
});
|
|
275
275
|
}
|
|
276
|
-
function
|
|
277
|
-
let u = b(() => new
|
|
276
|
+
function Qe({ cameraPosition: e, color: t, floorY: n, fontSize: r, labelOffset: i, line: a, showBottom: o, showLeft: s, showRight: c, showTop: l }) {
|
|
277
|
+
let u = b(() => new A().setFromPoints(a.points), [a.points]), d = qe({
|
|
278
278
|
cameraPosition: e,
|
|
279
279
|
floorY: n,
|
|
280
280
|
line: a,
|
|
@@ -282,19 +282,19 @@ function $e({ cameraPosition: e, color: t, floorY: n, fontSize: r, labelOffset:
|
|
|
282
282
|
showLeft: s,
|
|
283
283
|
showRight: c,
|
|
284
284
|
showTop: l
|
|
285
|
-
}), f = d ?
|
|
285
|
+
}), f = d ? Je({
|
|
286
286
|
endpoint: d,
|
|
287
287
|
labelOffset: i,
|
|
288
288
|
line: a
|
|
289
289
|
}) : null;
|
|
290
|
-
return v(() => () => u.dispose(), [u]), /* @__PURE__ */
|
|
290
|
+
return v(() => () => u.dispose(), [u]), /* @__PURE__ */ J("lineSegments", {
|
|
291
291
|
geometry: u,
|
|
292
|
-
position:
|
|
293
|
-
children: [/* @__PURE__ */
|
|
292
|
+
position: Ve(a.loc, n),
|
|
293
|
+
children: [/* @__PURE__ */ q("lineBasicMaterial", {
|
|
294
294
|
color: t,
|
|
295
295
|
depthWrite: !1,
|
|
296
296
|
linewidth: 2
|
|
297
|
-
}), f && /* @__PURE__ */
|
|
297
|
+
}), f && /* @__PURE__ */ q(Ze, {
|
|
298
298
|
color: t,
|
|
299
299
|
fontSize: r,
|
|
300
300
|
position: f,
|
|
@@ -302,8 +302,8 @@ function $e({ cameraPosition: e, color: t, floorY: n, fontSize: r, labelOffset:
|
|
|
302
302
|
})]
|
|
303
303
|
});
|
|
304
304
|
}
|
|
305
|
-
function
|
|
306
|
-
let u =
|
|
305
|
+
function $e({ color: e, floorY: t, fontSize: n = De, grids: r, labelOffset: i = ke, showBottom: a = !0, showLeft: o = !0, showRight: s = !0, showTop: c = !0, visible: l = !0 }) {
|
|
306
|
+
let u = T((e) => e.camera), d = x(null), [f, p] = S(() => new K()), m = Ue(e), h = b(() => r ? Ge({
|
|
307
307
|
flattenToFloor: t !== void 0,
|
|
308
308
|
grids: r,
|
|
309
309
|
showBottom: a,
|
|
@@ -317,21 +317,21 @@ function et({ color: e, floorY: t, fontSize: n = ke, grids: r, labelOffset: i =
|
|
|
317
317
|
o,
|
|
318
318
|
s,
|
|
319
319
|
c
|
|
320
|
-
]), g = b(() =>
|
|
320
|
+
]), g = b(() => Ye(h, t), [t, h]), _ = b(() => Math.max(i, Xe(h, g, t) * .015), [
|
|
321
321
|
g,
|
|
322
322
|
t,
|
|
323
323
|
i,
|
|
324
324
|
h
|
|
325
325
|
]);
|
|
326
|
-
return
|
|
326
|
+
return w(() => {
|
|
327
327
|
let e = d.current;
|
|
328
328
|
if (!e) return;
|
|
329
329
|
let t = u.position.clone();
|
|
330
|
-
e.worldToLocal(t), !(t.distanceToSquared(f) <
|
|
331
|
-
}), !l || !h.length ? null : /* @__PURE__ */
|
|
330
|
+
e.worldToLocal(t), !(t.distanceToSquared(f) < Ae) && p(t);
|
|
331
|
+
}), !l || !h.length ? null : /* @__PURE__ */ q("group", {
|
|
332
332
|
ref: d,
|
|
333
333
|
userData: { modelGrids: !0 },
|
|
334
|
-
children: h.map((e) => /* @__PURE__ */
|
|
334
|
+
children: h.map((e) => /* @__PURE__ */ q(Qe, {
|
|
335
335
|
cameraPosition: f,
|
|
336
336
|
color: m,
|
|
337
337
|
floorY: t,
|
|
@@ -346,9 +346,9 @@ function et({ color: e, floorY: t, fontSize: n = ke, grids: r, labelOffset: i =
|
|
|
346
346
|
e.startSide,
|
|
347
347
|
e.endSide,
|
|
348
348
|
e.name,
|
|
349
|
-
|
|
350
|
-
t ??
|
|
351
|
-
|
|
349
|
+
ze(e.loc, "x"),
|
|
350
|
+
t ?? ze(e.loc, "y"),
|
|
351
|
+
ze(e.loc, "z"),
|
|
352
352
|
e.points[0].x,
|
|
353
353
|
e.points[0].y,
|
|
354
354
|
e.points[0].z,
|
|
@@ -360,33 +360,33 @@ function et({ color: e, floorY: t, fontSize: n = ke, grids: r, labelOffset: i =
|
|
|
360
360
|
}
|
|
361
361
|
//#endregion
|
|
362
362
|
//#region src/viewer/Model.tsx
|
|
363
|
-
var
|
|
364
|
-
function
|
|
363
|
+
var et = new ae(), tt = h(() => import("./WebGpuSelectableMesh-s4XT_3wd.js").then((e) => ({ default: e.WebGpuSelectableMesh })));
|
|
364
|
+
function nt(e) {
|
|
365
365
|
if (!e) return null;
|
|
366
366
|
try {
|
|
367
367
|
let t = JSON.parse(e);
|
|
368
|
-
return !Array.isArray(t) || t.length !== 16 ? null : new
|
|
368
|
+
return !Array.isArray(t) || t.length !== 16 ? null : new ae().fromArray(t);
|
|
369
369
|
} catch (e) {
|
|
370
370
|
return console.warn("Model matrix parsing error", e), null;
|
|
371
371
|
}
|
|
372
372
|
}
|
|
373
|
-
function
|
|
374
|
-
return
|
|
373
|
+
function rt(e) {
|
|
374
|
+
return nt(it(e));
|
|
375
375
|
}
|
|
376
|
-
function
|
|
376
|
+
function it(e) {
|
|
377
377
|
return e.coordinationMatrix ?? Object.values(e.data)[0]?.matrix;
|
|
378
378
|
}
|
|
379
|
-
function
|
|
379
|
+
function at({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r, materialMode: i, useWebGPU: a = !1 }) {
|
|
380
380
|
let o = d((e) => e.gridAxesVisibility), s = b(() => {
|
|
381
381
|
if (!r) return {
|
|
382
382
|
data: [],
|
|
383
383
|
coordinationMatrix: null,
|
|
384
384
|
floorY: 0
|
|
385
385
|
};
|
|
386
|
-
let e = Object.values(r.data).some((e) => !!e.matrix) ? t?.clone() ??
|
|
386
|
+
let e = Object.values(r.data).some((e) => !!e.matrix) ? t?.clone() ?? rt(r) : null, i = Infinity, a = new K();
|
|
387
387
|
return {
|
|
388
388
|
data: Object.values(r.data).map((e) => {
|
|
389
|
-
let t = (
|
|
389
|
+
let t = (nt(e.matrix) ?? new ae()).clone().invert(), r = e.mat, o = e.pos;
|
|
390
390
|
for (let e = 0; e < o.length; e += 3) a.set(o[e], o[e + 1], o[e + 2]).applyMatrix4(t), Number.isFinite(a.y) && (i = Math.min(i, a.y));
|
|
391
391
|
return {
|
|
392
392
|
data: e,
|
|
@@ -404,8 +404,8 @@ function ot({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
|
|
|
404
404
|
r,
|
|
405
405
|
n
|
|
406
406
|
]);
|
|
407
|
-
if (!r) return /* @__PURE__ */
|
|
408
|
-
let c = i ?? r.renderSettings?.materialMode ?? "quality", l = r.renderSettings?.useDoubleSideMaterial === !0, u = s.data.map(({ data: t, isIfcSpace: n, key: r, material: i, meshMatrix: o }) => /* @__PURE__ */
|
|
407
|
+
if (!r) return /* @__PURE__ */ q(Ce, {});
|
|
408
|
+
let c = i ?? r.renderSettings?.materialMode ?? "quality", l = r.renderSettings?.useDoubleSideMaterial === !0, u = s.data.map(({ data: t, isIfcSpace: n, key: r, material: i, meshMatrix: o }) => /* @__PURE__ */ q(a ? tt : Ee, {
|
|
409
409
|
colorPaletteTexture: e,
|
|
410
410
|
material: i,
|
|
411
411
|
materialMode: c,
|
|
@@ -414,14 +414,14 @@ function ot({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
|
|
|
414
414
|
meshMatrix: o,
|
|
415
415
|
useDoubleSideMaterial: l
|
|
416
416
|
}, r));
|
|
417
|
-
return /* @__PURE__ */
|
|
418
|
-
matrix: s.coordinationMatrix ??
|
|
417
|
+
return /* @__PURE__ */ J("group", {
|
|
418
|
+
matrix: s.coordinationMatrix ?? et,
|
|
419
419
|
matrixAutoUpdate: !1,
|
|
420
420
|
userData: { modelID: n },
|
|
421
|
-
children: [a ? /* @__PURE__ */
|
|
421
|
+
children: [a ? /* @__PURE__ */ q(p, {
|
|
422
422
|
fallback: null,
|
|
423
423
|
children: u
|
|
424
|
-
}) : u, /* @__PURE__ */
|
|
424
|
+
}) : u, /* @__PURE__ */ q($e, {
|
|
425
425
|
floorY: s.floorY,
|
|
426
426
|
grids: r.grids,
|
|
427
427
|
showBottom: o.bottom,
|
|
@@ -432,10 +432,10 @@ function ot({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
|
|
|
432
432
|
})]
|
|
433
433
|
});
|
|
434
434
|
}
|
|
435
|
-
var
|
|
435
|
+
var ot = g(at);
|
|
436
436
|
//#endregion
|
|
437
437
|
//#region src/viewer/utils/GeometryUtils/useGeometryIndex.ts
|
|
438
|
-
function
|
|
438
|
+
function st() {
|
|
439
439
|
return {
|
|
440
440
|
elementBounds: /* @__PURE__ */ new Map(),
|
|
441
441
|
elementIndex: /* @__PURE__ */ new Map(),
|
|
@@ -446,16 +446,16 @@ function ct() {
|
|
|
446
446
|
records: /* @__PURE__ */ new Set()
|
|
447
447
|
};
|
|
448
448
|
}
|
|
449
|
-
function
|
|
449
|
+
function ct(e, t, n, r) {
|
|
450
450
|
let i = e.get(t);
|
|
451
451
|
i || (i = /* @__PURE__ */ new Map(), e.set(t, i));
|
|
452
452
|
let a = i.get(n);
|
|
453
|
-
a || (a = new
|
|
453
|
+
a || (a = new D(), i.set(n, a)), a.expandByPoint(r);
|
|
454
454
|
}
|
|
455
|
-
function
|
|
455
|
+
function lt(e) {
|
|
456
456
|
return e instanceof Uint16Array || e instanceof Uint32Array ? e : e.length > 65535 ? new Uint32Array(e) : new Uint16Array(e);
|
|
457
457
|
}
|
|
458
|
-
function
|
|
458
|
+
function ut(e, t, n, r) {
|
|
459
459
|
let i = n.get(e);
|
|
460
460
|
if (i) return i;
|
|
461
461
|
i = {
|
|
@@ -465,20 +465,20 @@ function dt(e, t, n, r) {
|
|
|
465
465
|
let a = r.get(e);
|
|
466
466
|
return a || (a = [], r.set(e, a)), a.push(i), i;
|
|
467
467
|
}
|
|
468
|
-
function
|
|
469
|
-
n &&
|
|
468
|
+
function dt(e, t, n, r, i, a) {
|
|
469
|
+
n && ut(e, r, i, a).vertexRanges.push({
|
|
470
470
|
count: n,
|
|
471
471
|
start: t
|
|
472
472
|
});
|
|
473
473
|
}
|
|
474
|
-
function
|
|
475
|
-
n && (
|
|
474
|
+
function ft(e, t, n, r, i, a) {
|
|
475
|
+
n && (ut(e, r, i, a), r.triangleRanges.push({
|
|
476
476
|
count: n,
|
|
477
477
|
id: e,
|
|
478
478
|
start: t
|
|
479
479
|
}));
|
|
480
480
|
}
|
|
481
|
-
function
|
|
481
|
+
function pt(e) {
|
|
482
482
|
let t = e;
|
|
483
483
|
for (; t;) {
|
|
484
484
|
let e = t.userData.modelID;
|
|
@@ -487,19 +487,19 @@ function mt(e) {
|
|
|
487
487
|
}
|
|
488
488
|
return 0;
|
|
489
489
|
}
|
|
490
|
-
function
|
|
490
|
+
function mt(e) {
|
|
491
491
|
return e.name === "space" || e.userData.isIfcSpace === !0;
|
|
492
492
|
}
|
|
493
|
-
function
|
|
494
|
-
let t = x(
|
|
493
|
+
function ht(e) {
|
|
494
|
+
let t = x(st()), n = _(() => {
|
|
495
495
|
let n = e.current, r = t.current;
|
|
496
496
|
if (!n || r.indexedModel === n && r.records.size) return r;
|
|
497
|
-
let i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), s = new
|
|
497
|
+
let i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), s = new K();
|
|
498
498
|
return n.updateMatrixWorld(!0), n.traverse((e) => {
|
|
499
|
-
if (!(e instanceof
|
|
499
|
+
if (!(e instanceof H)) return;
|
|
500
500
|
let t = e, n = t.geometry, c = n.index, l = n.attributes.ids;
|
|
501
501
|
if (!c || !l) return;
|
|
502
|
-
let u = n.attributes.position, d =
|
|
502
|
+
let u = n.attributes.position, d = pt(t), f = mt(t), p = lt(c.array), m = {
|
|
503
503
|
hiddenIds: /* @__PURE__ */ new Set(),
|
|
504
504
|
initialVisible: t.visible,
|
|
505
505
|
isIfcSpace: f,
|
|
@@ -512,16 +512,16 @@ function gt(e) {
|
|
|
512
512
|
}, h = /* @__PURE__ */ new Map(), g = null, _ = 0, v = p.length / 3;
|
|
513
513
|
for (let e = 0; e < v; e++) {
|
|
514
514
|
let t = l.getX(p[e * 3]);
|
|
515
|
-
g === null ? (g = t, _ = e) : t !== g && (
|
|
515
|
+
g === null ? (g = t, _ = e) : t !== g && (ft(g, _, e - _, m, h, i), g = t, _ = e);
|
|
516
516
|
}
|
|
517
|
-
g !== null &&
|
|
517
|
+
g !== null && ft(g, _, v - _, m, h, i);
|
|
518
518
|
let y = null, b = 0, x = u ? Math.min(l.count, u.count) : l.count;
|
|
519
519
|
u && t.updateWorldMatrix(!0, !1);
|
|
520
520
|
for (let e = 0; e < l.count; e++) {
|
|
521
521
|
let n = l.getX(e);
|
|
522
|
-
u && e < x && (s.fromBufferAttribute(u, e).applyMatrix4(t.matrixWorld), Number.isFinite(s.x + s.y + s.z) &&
|
|
522
|
+
u && e < x && (s.fromBufferAttribute(u, e).applyMatrix4(t.matrixWorld), Number.isFinite(s.x + s.y + s.z) && ct(a, d, n, s)), y === null ? (y = n, b = e) : n !== y && (dt(y, b, e - b, m, h, i), y = n, b = e);
|
|
523
523
|
}
|
|
524
|
-
y !== null &&
|
|
524
|
+
y !== null && dt(y, b, l.count - b, m, h, i), o.add(m), f && !r.ifcSpacesVisible && (t.visible = !1);
|
|
525
525
|
}), t.current = {
|
|
526
526
|
elementBounds: a,
|
|
527
527
|
elementIndex: i,
|
|
@@ -532,7 +532,7 @@ function gt(e) {
|
|
|
532
532
|
records: o
|
|
533
533
|
}, t.current;
|
|
534
534
|
}, [e]), r = _(() => {
|
|
535
|
-
t.current =
|
|
535
|
+
t.current = st();
|
|
536
536
|
}, []);
|
|
537
537
|
return b(() => ({
|
|
538
538
|
buildIndex: n,
|
|
@@ -541,70 +541,70 @@ function gt(e) {
|
|
|
541
541
|
}
|
|
542
542
|
//#endregion
|
|
543
543
|
//#region src/viewer/utils/GeometryUtils/useGeometryUtils.ts
|
|
544
|
-
function
|
|
544
|
+
function gt(e, t) {
|
|
545
545
|
return e instanceof Uint32Array ? new Uint32Array(t) : new Uint16Array(t);
|
|
546
546
|
}
|
|
547
|
-
function
|
|
547
|
+
function _t(e) {
|
|
548
548
|
let t = e.geometry;
|
|
549
|
-
Object.assign(t, { boundsTree: void 0 }), e.geometry.index?.count && Object.assign(t, { boundsTree: new
|
|
549
|
+
Object.assign(t, { boundsTree: void 0 }), e.geometry.index?.count && Object.assign(t, { boundsTree: new be(e.geometry, { indirect: !0 }) });
|
|
550
550
|
}
|
|
551
|
-
function
|
|
552
|
-
e.mesh.geometry.setIndex(new
|
|
551
|
+
function vt(e, t, n = !0) {
|
|
552
|
+
e.mesh.geometry.setIndex(new k(t, 1)), n && _t(e.mesh);
|
|
553
553
|
}
|
|
554
|
-
function
|
|
554
|
+
function yt(e, t) {
|
|
555
555
|
return e.initialVisible && (!e.isIfcSpace || t);
|
|
556
556
|
}
|
|
557
|
-
function
|
|
557
|
+
function bt(e, t) {
|
|
558
558
|
let n = e.mesh.geometry, r = n.index?.array;
|
|
559
|
-
e.mesh.visible =
|
|
559
|
+
e.mesh.visible = yt(e, t), r !== e.originalIndex && vt(e, e.originalIndex, !1), e.originalBoundsTree ? Object.assign(n, { boundsTree: e.originalBoundsTree }) : (_t(e.mesh), e.originalBoundsTree = e.mesh.geometry.boundsTree ?? null);
|
|
560
560
|
}
|
|
561
|
-
function
|
|
561
|
+
function xt(e) {
|
|
562
562
|
return e === null ? "*" : e.size ? Array.from(e).sort((e, t) => e - t).join(",") : "";
|
|
563
563
|
}
|
|
564
|
-
function
|
|
565
|
-
return `h:${
|
|
564
|
+
function St(e, t, n, r) {
|
|
565
|
+
return `h:${xt(e)}|i:${xt(n)}|s:${r ? Number(t) : ""}`;
|
|
566
566
|
}
|
|
567
|
-
function
|
|
567
|
+
function Ct(e, t, n) {
|
|
568
568
|
return !t.has(e) && (!n || n.has(e));
|
|
569
569
|
}
|
|
570
|
-
function
|
|
570
|
+
function wt(e, t) {
|
|
571
571
|
Object.entries(e).forEach(([e, n]) => {
|
|
572
572
|
n.forEach((n) => t(Number(e), n));
|
|
573
573
|
});
|
|
574
574
|
}
|
|
575
|
-
function
|
|
575
|
+
function Tt(e, t, n) {
|
|
576
576
|
e.hiddenIds.has(t) || (e.hiddenIds.add(t), n.add(e));
|
|
577
577
|
}
|
|
578
|
-
function
|
|
578
|
+
function Et(e, t, n) {
|
|
579
579
|
e && console.log(`${t}:`, Date.now() - n, "ms");
|
|
580
580
|
}
|
|
581
|
-
function
|
|
582
|
-
let { hiddenIds: i, originalIndex: a, triangleRanges: o } = e, s =
|
|
581
|
+
function Dt(e, t, n, r) {
|
|
582
|
+
let { hiddenIds: i, originalIndex: a, triangleRanges: o } = e, s = St(i, t, n, e.isIfcSpace);
|
|
583
583
|
if (e.visibleStateKey === s) return;
|
|
584
584
|
if (!i.size && !n) {
|
|
585
|
-
|
|
585
|
+
bt(e, t), e.visibleStateKey = s;
|
|
586
586
|
return;
|
|
587
587
|
}
|
|
588
588
|
let c = 0, l = 0;
|
|
589
589
|
if (o.forEach(({ count: e, id: t }) => {
|
|
590
|
-
|
|
590
|
+
Ct(t, i, n) ? c += e * 3 : l += e * 3;
|
|
591
591
|
}), !c) {
|
|
592
|
-
|
|
592
|
+
bt(e, t), e.mesh.visible = !1, e.visibleStateKey = s;
|
|
593
593
|
return;
|
|
594
594
|
}
|
|
595
595
|
if (!l) {
|
|
596
|
-
|
|
596
|
+
bt(e, t), e.visibleStateKey = s;
|
|
597
597
|
return;
|
|
598
598
|
}
|
|
599
|
-
e.mesh.visible =
|
|
600
|
-
let u =
|
|
599
|
+
e.mesh.visible = yt(e, t);
|
|
600
|
+
let u = gt(a, c), d = 0;
|
|
601
601
|
for (let e = 0; e < o.length; e++) {
|
|
602
602
|
let { count: t, id: r, start: s } = o[e];
|
|
603
|
-
if (!
|
|
603
|
+
if (!Ct(r, i, n)) continue;
|
|
604
604
|
let c = s * 3, l = c + t * 3;
|
|
605
605
|
u.set(a.subarray(c, l), d), d += t * 3;
|
|
606
606
|
}
|
|
607
|
-
r || (e.originalBoundsTree = null),
|
|
607
|
+
r || (e.originalBoundsTree = null), vt(e, u), e.visibleStateKey = s;
|
|
608
608
|
}
|
|
609
609
|
function Ot(e, t) {
|
|
610
610
|
return e.isolatedIdsByModel ? e.isolatedIdsByModel.get(t.modelID) ?? /* @__PURE__ */ new Set() : e.isolatedIds;
|
|
@@ -615,21 +615,21 @@ function kt(e) {
|
|
|
615
615
|
e.forEach((e) => {
|
|
616
616
|
let t = n.elementIndex.get(e);
|
|
617
617
|
t && t.forEach(({ record: t }) => {
|
|
618
|
-
|
|
618
|
+
Tt(t, e, o);
|
|
619
619
|
});
|
|
620
|
-
}), o.forEach((e) =>
|
|
620
|
+
}), o.forEach((e) => Dt(e, n.ifcSpacesVisible, Ot(n, e), i)), Et(r, "hideByIds", t);
|
|
621
621
|
}, [
|
|
622
622
|
a,
|
|
623
623
|
i,
|
|
624
624
|
r
|
|
625
625
|
]), l = _(() => {
|
|
626
626
|
let e = Date.now(), o = a(), s = /* @__PURE__ */ new Set();
|
|
627
|
-
|
|
627
|
+
wt(t, (e, t) => {
|
|
628
628
|
let n = o.elementIndex.get(t);
|
|
629
629
|
n && n.forEach(({ record: n }) => {
|
|
630
|
-
n.modelID === e &&
|
|
630
|
+
n.modelID === e && Tt(n, t, s);
|
|
631
631
|
});
|
|
632
|
-
}), s.forEach((e) =>
|
|
632
|
+
}), s.forEach((e) => Dt(e, o.ifcSpacesVisible, Ot(o, e), i)), n(), Et(r, "hideSelected", e);
|
|
633
633
|
}, [
|
|
634
634
|
a,
|
|
635
635
|
i,
|
|
@@ -643,24 +643,24 @@ function kt(e) {
|
|
|
643
643
|
t && t.forEach(({ record: t }) => {
|
|
644
644
|
t.hiddenIds.delete(e) && o.add(t);
|
|
645
645
|
});
|
|
646
|
-
}), o.forEach((e) =>
|
|
646
|
+
}), o.forEach((e) => Dt(e, n.ifcSpacesVisible, Ot(n, e), i)), Et(r, "showByIds", t);
|
|
647
647
|
}, [
|
|
648
648
|
a,
|
|
649
649
|
i,
|
|
650
650
|
r
|
|
651
651
|
]), f = _((e) => {
|
|
652
652
|
let t = Date.now(), n = a();
|
|
653
|
-
n.isolatedIdsByModel = null, n.isolatedIds = new Set(e), n.records.forEach((e) =>
|
|
653
|
+
n.isolatedIdsByModel = null, n.isolatedIds = new Set(e), n.records.forEach((e) => Dt(e, n.ifcSpacesVisible, Ot(n, e), i)), Et(r, "isolateByIds", t);
|
|
654
654
|
}, [
|
|
655
655
|
a,
|
|
656
656
|
i,
|
|
657
657
|
r
|
|
658
658
|
]), p = _(() => {
|
|
659
659
|
let e = Date.now(), n = a(), o = /* @__PURE__ */ new Map();
|
|
660
|
-
|
|
660
|
+
wt(t, (e, t) => {
|
|
661
661
|
let n = o.get(e);
|
|
662
662
|
n || (n = /* @__PURE__ */ new Set(), o.set(e, n)), n.add(t);
|
|
663
|
-
}), n.isolatedIdsByModel = o, n.isolatedIds = null, n.records.forEach((e) =>
|
|
663
|
+
}), n.isolatedIdsByModel = o, n.isolatedIds = null, n.records.forEach((e) => Dt(e, n.ifcSpacesVisible, Ot(n, e), i)), Et(r, "isolateSelected", e);
|
|
664
664
|
}, [
|
|
665
665
|
a,
|
|
666
666
|
i,
|
|
@@ -668,7 +668,7 @@ function kt(e) {
|
|
|
668
668
|
r
|
|
669
669
|
]), m = _(() => {
|
|
670
670
|
let e = Date.now(), t = a();
|
|
671
|
-
t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) =>
|
|
671
|
+
t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => Dt(e, t.ifcSpacesVisible, Ot(t, e), i)), Et(r, "resetIsolation", e);
|
|
672
672
|
}, [
|
|
673
673
|
a,
|
|
674
674
|
i,
|
|
@@ -676,7 +676,7 @@ function kt(e) {
|
|
|
676
676
|
]), h = _((e) => {
|
|
677
677
|
let t = a();
|
|
678
678
|
t.ifcSpacesVisible !== e && (t.ifcSpacesVisible = e, t.records.forEach((e) => {
|
|
679
|
-
e.isIfcSpace &&
|
|
679
|
+
e.isIfcSpace && Dt(e, t.ifcSpacesVisible, Ot(t, e), i);
|
|
680
680
|
}));
|
|
681
681
|
}, [a, i]), g = _(() => {
|
|
682
682
|
h(!s());
|
|
@@ -694,8 +694,8 @@ function kt(e) {
|
|
|
694
694
|
showAll: _(() => {
|
|
695
695
|
let e = Date.now(), t = a();
|
|
696
696
|
t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => {
|
|
697
|
-
e.hiddenIds.clear(),
|
|
698
|
-
}),
|
|
697
|
+
e.hiddenIds.clear(), Dt(e, t.ifcSpacesVisible, Ot(t, e), i);
|
|
698
|
+
}), Et(r, "showAll", e);
|
|
699
699
|
}, [
|
|
700
700
|
a,
|
|
701
701
|
i,
|
|
@@ -729,15 +729,15 @@ function Gt(e) {
|
|
|
729
729
|
return e;
|
|
730
730
|
}
|
|
731
731
|
function Kt(e) {
|
|
732
|
-
return Math.abs(e.normal.y) < .9 ? new
|
|
732
|
+
return Math.abs(e.normal.y) < .9 ? new K(0, 1, 0) : new K(1, 0, 0);
|
|
733
733
|
}
|
|
734
734
|
function qt(e, t) {
|
|
735
735
|
return e.clone().addScaledVector(t.normal, -e.dot(t.normal));
|
|
736
736
|
}
|
|
737
737
|
function Jt(e, t) {
|
|
738
|
-
let n = t ? qt(t, e) : new
|
|
738
|
+
let n = t ? qt(t, e) : new K(), r = n.lengthSq() > Ht ? n.normalize() : Kt(e).cross(e.normal).normalize(), i = e.normal.clone().cross(r).normalize();
|
|
739
739
|
return {
|
|
740
|
-
origin: e.coplanarPoint(new
|
|
740
|
+
origin: e.coplanarPoint(new K()),
|
|
741
741
|
u: r,
|
|
742
742
|
v: i
|
|
743
743
|
};
|
|
@@ -769,11 +769,11 @@ function Qt(e) {
|
|
|
769
769
|
]) r.moveTo(e, t), r.lineTo(e + t, 0);
|
|
770
770
|
r.stroke();
|
|
771
771
|
}
|
|
772
|
-
let i = new
|
|
773
|
-
return i.anisotropy = Math.max(1, e), i.magFilter =
|
|
772
|
+
let i = new j(n);
|
|
773
|
+
return i.anisotropy = Math.max(1, e), i.magFilter = V, i.minFilter = re, i.wrapS = ue, i.wrapT = ue, i.needsUpdate = !0, i;
|
|
774
774
|
}
|
|
775
775
|
function $t(e, t) {
|
|
776
|
-
return new
|
|
776
|
+
return new k(t ? new Uint32Array(e) : new Uint8Array(e), 1);
|
|
777
777
|
}
|
|
778
778
|
var en = class {
|
|
779
779
|
active;
|
|
@@ -783,17 +783,17 @@ var en = class {
|
|
|
783
783
|
capTexture;
|
|
784
784
|
context;
|
|
785
785
|
root = new I();
|
|
786
|
-
box = new
|
|
787
|
-
meshBox = new
|
|
788
|
-
inverseMatrix = new
|
|
789
|
-
localPlane = new
|
|
790
|
-
tempLine = new
|
|
791
|
-
tempVector = new
|
|
792
|
-
tempVector1 = new
|
|
793
|
-
tempAxisX = new
|
|
794
|
-
tempAxisY = new
|
|
795
|
-
tempAxisZ = new
|
|
796
|
-
worldPoint = new
|
|
786
|
+
box = new D();
|
|
787
|
+
meshBox = new D();
|
|
788
|
+
inverseMatrix = new ae();
|
|
789
|
+
localPlane = new le();
|
|
790
|
+
tempLine = new R();
|
|
791
|
+
tempVector = new K();
|
|
792
|
+
tempVector1 = new K();
|
|
793
|
+
tempAxisX = new K();
|
|
794
|
+
tempAxisY = new K();
|
|
795
|
+
tempAxisZ = new K();
|
|
796
|
+
worldPoint = new K();
|
|
797
797
|
capClippingPlanesKey = "";
|
|
798
798
|
capShader = null;
|
|
799
799
|
closeGapTolerance = Mt;
|
|
@@ -804,18 +804,18 @@ var en = class {
|
|
|
804
804
|
colorIndex: [0],
|
|
805
805
|
ids: [0],
|
|
806
806
|
modelID: [0]
|
|
807
|
-
}, this.capMaterial.color.convertSRGBToLinear(), e.getUseWebGPU() ? this.setupWebGpuCapMaterial() : this.setupCapMaterialShader(), this.capMesh = new
|
|
807
|
+
}, this.capMaterial.color.convertSRGBToLinear(), e.getUseWebGPU() ? this.setupWebGpuCapMaterial() : this.setupCapMaterialShader(), this.capMesh = new H(new A(), this.capMaterial), this.capMesh.frustumCulled = !1, this.capMesh.renderOrder = Lt, this.root.add(this.capMesh), this.root.visible = this.active, this.root.name = "clipping-caps", this.root.renderOrder = Lt, this.context.getScene().add(this.root), this.context.caps.push(this), this.update();
|
|
808
808
|
}
|
|
809
809
|
createCapMaterial() {
|
|
810
810
|
return this.context.getUseWebGPU() ? new e({
|
|
811
811
|
color: At,
|
|
812
812
|
depthWrite: !1,
|
|
813
|
-
side:
|
|
814
|
-
}) : new
|
|
813
|
+
side: P
|
|
814
|
+
}) : new U({
|
|
815
815
|
color: At,
|
|
816
816
|
depthWrite: !1,
|
|
817
817
|
map: this.capTexture,
|
|
818
|
-
side:
|
|
818
|
+
side: P
|
|
819
819
|
});
|
|
820
820
|
}
|
|
821
821
|
dispose() {
|
|
@@ -853,7 +853,7 @@ var en = class {
|
|
|
853
853
|
this.capMesh.geometry.dispose(), this.capMesh.geometry = e, this.updateVisualState(), this.capMesh.visible = (e.getAttribute("position")?.count ?? 0) >= 3;
|
|
854
854
|
}
|
|
855
855
|
setupWebGpuCapMaterial() {
|
|
856
|
-
let e = l(s("colorIndex", "uint")), n = l(s("ids", "uint")), r = l(s("modelID", "uint")), i = t(new
|
|
856
|
+
let e = l(s("colorIndex", "uint")), n = l(s("ids", "uint")), r = l(s("modelID", "uint")), i = t(new M(this.context.getPreselectionColor())), o = t(new M(this.context.getSelectionColor())), d = t(-1), f = t(-1), p = a(this.capTexture, c()).rgb, m = e.greaterThan(.5), h = n.equal(d).and(r.equal(f)).and(u(e.sub(1)).greaterThan(.5));
|
|
857
857
|
this.capMaterial.colorNode = h.select(i, m.select(o, p)), this.capMaterial.userData.shader = { uniforms: {
|
|
858
858
|
capPreSelectionColor: i,
|
|
859
859
|
capSelectionColor: o,
|
|
@@ -863,12 +863,12 @@ var en = class {
|
|
|
863
863
|
}
|
|
864
864
|
setupCapMaterialShader() {
|
|
865
865
|
this.capMaterial.onBeforeCompile = (e) => {
|
|
866
|
-
e.uniforms.capPreSelectionColor = { value: new
|
|
866
|
+
e.uniforms.capPreSelectionColor = { value: new M(this.context.getPreselectionColor()) }, e.uniforms.capSelectionColor = { value: new M(this.context.getSelectionColor()) }, e.uniforms.capPreSelectionId = { value: -1 }, e.uniforms.capPreSelectionModelID = { value: -1 }, e.vertexShader = e.vertexShader.replace("#include <common>", "\n #include <common>\n attribute float colorIndex;\n attribute uint ids;\n attribute uint modelID;\n flat varying float vCapColorIndex;\n flat varying float vCapId;\n flat varying float vCapModelID;\n "), e.vertexShader = e.vertexShader.replace("#include <begin_vertex>", "\n #include <begin_vertex>\n vCapColorIndex = colorIndex;\n vCapId = float(ids);\n vCapModelID = float(modelID);\n "), e.fragmentShader = e.fragmentShader.replace("#include <common>", "\n #include <common>\n uniform vec3 capPreSelectionColor;\n uniform vec3 capSelectionColor;\n uniform float capPreSelectionId;\n uniform float capPreSelectionModelID;\n flat varying float vCapColorIndex;\n flat varying float vCapId;\n flat varying float vCapModelID;\n "), e.fragmentShader = e.fragmentShader.replace("#include <map_fragment>", "\n #include <map_fragment>\n if(\n capPreSelectionId == vCapId &&\n capPreSelectionModelID == vCapModelID &&\n abs(vCapColorIndex - 1.0) > 0.5\n ){\n diffuseColor.rgb = capPreSelectionColor;\n }\n else if(vCapColorIndex > 0.5){\n diffuseColor.rgb = capSelectionColor;\n }\n "), this.capShader = e, this.updateColorUniforms(), this.updatePreselectionUniforms();
|
|
867
867
|
};
|
|
868
868
|
}
|
|
869
869
|
updateColorUniform(e, t) {
|
|
870
870
|
let n = this.capShader?.uniforms[e];
|
|
871
|
-
n && (n.value instanceof
|
|
871
|
+
n && (n.value instanceof M ? n.value.set(t) : n.value = new M(t));
|
|
872
872
|
}
|
|
873
873
|
updateColorUniforms() {
|
|
874
874
|
this.updateColorUniform("capPreSelectionColor", this.context.getPreselectionColor()), this.updateColorUniform("capSelectionColor", this.context.getSelectionColor());
|
|
@@ -890,15 +890,15 @@ var en = class {
|
|
|
890
890
|
this.capMaterial.clippingPlanes = t, this.capMaterial.needsUpdate = !0;
|
|
891
891
|
}
|
|
892
892
|
createCapGeometry() {
|
|
893
|
-
let e = new
|
|
893
|
+
let e = new A(), t = this.getModelWorldBox();
|
|
894
894
|
if (!t) return e;
|
|
895
|
-
let n = t.getSize(new
|
|
895
|
+
let n = t.getSize(new K()).length();
|
|
896
896
|
this.tolerance = Math.max(Mt, n * Nt), this.closeGapTolerance = Math.max(this.tolerance * Ft, n * Pt);
|
|
897
897
|
let r = Jt(this.plane, this.getModelHatchReferenceDirection()), i = this.context.getEdgeSegmentsForPlane(this.plane), a = i ? this.getCapSegmentsFromEdgeSegments(i, r) : this.getCapSegments(r), o = this.getClosedContours(a), s = this.getHatchSpacing(n), { elementIDs: c, modelIDs: l, positions: u, uvs: d } = this.triangulateContours(o, r, s);
|
|
898
|
-
if (e.setAttribute("position", new F(u, 3)), e.setAttribute("uv", new F(d, 2)), e.setAttribute("ids", new
|
|
898
|
+
if (e.setAttribute("position", new F(u, 3)), e.setAttribute("uv", new F(d, 2)), e.setAttribute("ids", new _e(c, 1)), e.setAttribute("modelID", new _e(l, 1)), e.setAttribute("colorIndex", $t(c.length, this.context.getUseWebGPU())), c.length) {
|
|
899
899
|
let t = new Uint32Array(c.length);
|
|
900
900
|
for (let e = 0; e < t.length; e++) t[e] = e;
|
|
901
|
-
e.setIndex(new
|
|
901
|
+
e.setIndex(new _e(t, 1));
|
|
902
902
|
}
|
|
903
903
|
return u.length && (e.computeVertexNormals(), e.computeBoundingSphere()), e;
|
|
904
904
|
}
|
|
@@ -951,7 +951,7 @@ var en = class {
|
|
|
951
951
|
return this.tempLine.start.copy(e.a), this.tempLine.end.copy(e.b), n(this.localPlane.intersectLine(this.tempLine, this.tempVector)), this.tempLine.start.copy(e.b), this.tempLine.end.copy(e.c), n(this.localPlane.intersectLine(this.tempLine, this.tempVector)), this.tempLine.start.copy(e.c), this.tempLine.end.copy(e.a), n(this.localPlane.intersectLine(this.tempLine, this.tempVector)), t;
|
|
952
952
|
}
|
|
953
953
|
getPlanePoint(e, t) {
|
|
954
|
-
return this.worldPoint.copy(e).sub(t.origin), new
|
|
954
|
+
return this.worldPoint.copy(e).sub(t.origin), new G(this.worldPoint.dot(t.u), this.worldPoint.dot(t.v));
|
|
955
955
|
}
|
|
956
956
|
getClosedContours(e) {
|
|
957
957
|
let t = /* @__PURE__ */ new Map();
|
|
@@ -1064,7 +1064,7 @@ var en = class {
|
|
|
1064
1064
|
triangulateContours(e, t, n) {
|
|
1065
1065
|
let r = [], i = [], a = [], o = [];
|
|
1066
1066
|
return e.forEach(({ elementID: e, modelID: s, points: c }) => {
|
|
1067
|
-
|
|
1067
|
+
fe.triangulateShape(c, []).forEach(([l, u, d]) => {
|
|
1068
1068
|
this.pushContourVertex(a, r, i, o, c[l], t, n, e, s), this.pushContourVertex(a, r, i, o, c[u], t, n, e, s), this.pushContourVertex(a, r, i, o, c[d], t, n, e, s);
|
|
1069
1069
|
});
|
|
1070
1070
|
}), {
|
|
@@ -1099,16 +1099,16 @@ var en = class {
|
|
|
1099
1099
|
}
|
|
1100
1100
|
}, tn = 1024, nn = 1;
|
|
1101
1101
|
function rn(e) {
|
|
1102
|
-
let t = new
|
|
1103
|
-
return t.setUsage(
|
|
1102
|
+
let t = new k(new Float32Array(e * 3), 3, !1);
|
|
1103
|
+
return t.setUsage(te), t;
|
|
1104
1104
|
}
|
|
1105
1105
|
function an(e) {
|
|
1106
1106
|
return Math.max(1, Math.ceil((e.geometry.index?.count ?? 0) / 3));
|
|
1107
1107
|
}
|
|
1108
1108
|
function on(e, t) {
|
|
1109
|
-
let n = new
|
|
1109
|
+
let n = new A(), r = Math.ceil(Math.min(Math.max(tn, an(t) * .05), 32768));
|
|
1110
1110
|
n.setAttribute("position", rn(r)), n.setDrawRange(0, 0);
|
|
1111
|
-
let i = new
|
|
1111
|
+
let i = new ne(n, e);
|
|
1112
1112
|
return i.frustumCulled = !1, i.renderOrder = nn, i.visible = !1, i;
|
|
1113
1113
|
}
|
|
1114
1114
|
function sn(e, t) {
|
|
@@ -1126,13 +1126,13 @@ var ln = class {
|
|
|
1126
1126
|
plane;
|
|
1127
1127
|
context;
|
|
1128
1128
|
lines = /* @__PURE__ */ new Map();
|
|
1129
|
-
inverseMatrix = new
|
|
1130
|
-
localPlane = new
|
|
1131
|
-
tempLine = new
|
|
1132
|
-
tempVector = new
|
|
1133
|
-
tempVector1 = new
|
|
1134
|
-
tempVector2 = new
|
|
1135
|
-
tempVector3 = new
|
|
1129
|
+
inverseMatrix = new ae();
|
|
1130
|
+
localPlane = new le();
|
|
1131
|
+
tempLine = new R();
|
|
1132
|
+
tempVector = new K();
|
|
1133
|
+
tempVector1 = new K();
|
|
1134
|
+
tempVector2 = new K();
|
|
1135
|
+
tempVector3 = new K();
|
|
1136
1136
|
intersectionSegments = [];
|
|
1137
1137
|
constructor(e, t) {
|
|
1138
1138
|
this.context = e, this.plane = t, this.active = e.getActive() && e.getEdgesActive(), e.edges.forEach((e) => {
|
|
@@ -1140,7 +1140,7 @@ var ln = class {
|
|
|
1140
1140
|
e.plane === t || n.includes(t) || (e.material.clippingPlanes = [...n, t], e.material.needsUpdate = !0);
|
|
1141
1141
|
});
|
|
1142
1142
|
let n = e.planes.filter((e) => e !== t);
|
|
1143
|
-
this.material = new
|
|
1143
|
+
this.material = new z({
|
|
1144
1144
|
clippingPlanes: n,
|
|
1145
1145
|
color: "black",
|
|
1146
1146
|
depthTest: !0,
|
|
@@ -1221,13 +1221,13 @@ var ln = class {
|
|
|
1221
1221
|
}, un = "#0b2f5f", dn = "#0b2f5f", fn = 0, pn = "#1f7ae0", mn = .22, hn = .01, gn = .025, _n = .015, vn = .02, yn = 1e-7, bn = .25, xn = .15, Sn = .25, Cn = 1e-5, wn = .2, Tn = 1, Y = 1;
|
|
1222
1222
|
function En(e, t) {
|
|
1223
1223
|
let n = t.getBoundingClientRect();
|
|
1224
|
-
return new
|
|
1224
|
+
return new G((e.clientX - n.left) / n.width * 2 - 1, -((e.clientY - n.top) / n.height) * 2 + 1);
|
|
1225
1225
|
}
|
|
1226
1226
|
function Dn(e) {
|
|
1227
|
-
let t = e.getSize(new
|
|
1227
|
+
let t = e.getSize(new K());
|
|
1228
1228
|
return Math.max(Sn, t.length() * hn);
|
|
1229
1229
|
}
|
|
1230
|
-
var On = class extends
|
|
1230
|
+
var On = class extends W {
|
|
1231
1231
|
helper = new I();
|
|
1232
1232
|
borderMaterial;
|
|
1233
1233
|
material;
|
|
@@ -1236,25 +1236,25 @@ var On = class extends ce {
|
|
|
1236
1236
|
border;
|
|
1237
1237
|
context;
|
|
1238
1238
|
location;
|
|
1239
|
-
localHitPoint = new
|
|
1239
|
+
localHitPoint = new K();
|
|
1240
1240
|
normal;
|
|
1241
1241
|
planeMesh;
|
|
1242
|
-
pointer = new
|
|
1242
|
+
pointer = new G();
|
|
1243
1243
|
layout;
|
|
1244
1244
|
polygon = [];
|
|
1245
1245
|
dragState = null;
|
|
1246
1246
|
hovered = !1;
|
|
1247
1247
|
listenersActive = !1;
|
|
1248
1248
|
constructor(e, t, n, r) {
|
|
1249
|
-
super(), this.context = e, this.plane = t, this.location = n.clone(), this.normal = r.clone().normalize(), this.material = new
|
|
1249
|
+
super(), this.context = e, this.plane = t, this.location = n.clone(), this.normal = r.clone().normalize(), this.material = new U({
|
|
1250
1250
|
color: dn,
|
|
1251
1251
|
depthWrite: !1,
|
|
1252
1252
|
opacity: fn,
|
|
1253
|
-
side:
|
|
1253
|
+
side: P,
|
|
1254
1254
|
transparent: !0
|
|
1255
1255
|
}), this.helper.position.copy(this.location), this.applyPlaneOrientation(), this.layout = this.getHelperLayout();
|
|
1256
1256
|
let i = Math.max(bn, Math.min(this.layout.width, this.layout.height) * gn), a = Math.max(xn, Math.min(this.layout.width, this.layout.height) * _n);
|
|
1257
|
-
this.borderMaterial = new
|
|
1257
|
+
this.borderMaterial = new B({
|
|
1258
1258
|
color: un,
|
|
1259
1259
|
dashSize: i,
|
|
1260
1260
|
depthWrite: !1,
|
|
@@ -1329,7 +1329,7 @@ var On = class extends ce {
|
|
|
1329
1329
|
hasModelIntersection(e) {
|
|
1330
1330
|
return !!this.context.getCameraUtils().getIntersection(!0, {
|
|
1331
1331
|
event: e,
|
|
1332
|
-
filter: (e) => !(e.object instanceof
|
|
1332
|
+
filter: (e) => !(e.object instanceof H) || e.faceIndex === void 0 || e.faceIndex === null ? !1 : !!(e.object.geometry.index && e.object.geometry.attributes.ids),
|
|
1333
1333
|
object: this.context.getMeshes(),
|
|
1334
1334
|
recursive: !1
|
|
1335
1335
|
});
|
|
@@ -1365,7 +1365,7 @@ var On = class extends ce {
|
|
|
1365
1365
|
getPointerPointOnPlane(e, t) {
|
|
1366
1366
|
let n = this.context.getDomElement();
|
|
1367
1367
|
this.pointer.copy(En(e, n));
|
|
1368
|
-
let r = this.context.getRaycaster(), i = new
|
|
1368
|
+
let r = this.context.getRaycaster(), i = new K();
|
|
1369
1369
|
return r.setFromCamera(this.pointer, this.context.getCamera()), r.ray.intersectPlane(t, i);
|
|
1370
1370
|
}
|
|
1371
1371
|
onPointerDown = (e) => {
|
|
@@ -1373,9 +1373,9 @@ var On = class extends ce {
|
|
|
1373
1373
|
let t = this.getPointerIntersection(e);
|
|
1374
1374
|
if (!t) return;
|
|
1375
1375
|
this.stopHelperPriorityEvent(e), this.context.clearHelpersHover(this), this.setHovered(!0), this.context.setHelperDragActive(!0), this.context.setCapsDragActive(!0), this.context.requestCapsDragIdleUpdate(), this.context.setSelectionInteractionDisabled(!0);
|
|
1376
|
-
let n = new
|
|
1376
|
+
let n = new K();
|
|
1377
1377
|
this.context.getCamera().getWorldDirection(n), n.normalize();
|
|
1378
|
-
let r = new
|
|
1378
|
+
let r = new le().setFromNormalAndCoplanarPoint(n, t.point);
|
|
1379
1379
|
this.dragState = {
|
|
1380
1380
|
dragPlane: r,
|
|
1381
1381
|
helperStart: this.helper.position.clone(),
|
|
@@ -1420,18 +1420,18 @@ var On = class extends ce {
|
|
|
1420
1420
|
this.hovered = e, this.material.color.set(e ? pn : dn), this.material.opacity = e ? mn : fn, this.material.needsUpdate = !0;
|
|
1421
1421
|
}
|
|
1422
1422
|
createPlaneMesh() {
|
|
1423
|
-
let e = new
|
|
1423
|
+
let e = new H(new A(), this.material);
|
|
1424
1424
|
return e.renderOrder = 2, e;
|
|
1425
1425
|
}
|
|
1426
1426
|
createBorder() {
|
|
1427
|
-
let e = new
|
|
1427
|
+
let e = new ne(new A(), this.borderMaterial);
|
|
1428
1428
|
return e.renderOrder = 3, e;
|
|
1429
1429
|
}
|
|
1430
1430
|
replaceGeometry(e, t) {
|
|
1431
1431
|
e.geometry.dispose(), e.geometry = t;
|
|
1432
1432
|
}
|
|
1433
1433
|
createFillGeometry(e) {
|
|
1434
|
-
let t = new
|
|
1434
|
+
let t = new A(), n = [];
|
|
1435
1435
|
if (e.length >= 3) {
|
|
1436
1436
|
let t = e[0];
|
|
1437
1437
|
for (let r = 1; r < e.length - 1; r++) {
|
|
@@ -1442,7 +1442,7 @@ var On = class extends ce {
|
|
|
1442
1442
|
return t.setAttribute("position", new F(n, 3)), n.length && t.computeBoundingSphere(), t;
|
|
1443
1443
|
}
|
|
1444
1444
|
createBorderGeometry(e) {
|
|
1445
|
-
let t = new
|
|
1445
|
+
let t = new A(), n = [];
|
|
1446
1446
|
if (e.length >= 2) for (let t = 0; t < e.length; t++) {
|
|
1447
1447
|
let r = e[t], i = e[(t + 1) % e.length];
|
|
1448
1448
|
n.push(r.x, r.y, 0, i.x, i.y, 0);
|
|
@@ -1500,7 +1500,7 @@ var On = class extends ce {
|
|
|
1500
1500
|
minV: -Y / 2,
|
|
1501
1501
|
width: Y
|
|
1502
1502
|
};
|
|
1503
|
-
let t = this.getPlaneBasis(), n = this.helper.position, r = this.getBoxCorners(e), i = new
|
|
1503
|
+
let t = this.getPlaneBasis(), n = this.helper.position, r = this.getBoxCorners(e), i = new K(), a = new K(), o = Infinity, s = -Infinity, c = Infinity, l = -Infinity;
|
|
1504
1504
|
if (r.forEach((e) => {
|
|
1505
1505
|
this.plane.projectPoint(e, i), a.copy(i).sub(n);
|
|
1506
1506
|
let r = a.dot(t.u), u = a.dot(t.v);
|
|
@@ -1524,18 +1524,18 @@ var On = class extends ce {
|
|
|
1524
1524
|
};
|
|
1525
1525
|
}
|
|
1526
1526
|
getPlaneBasis() {
|
|
1527
|
-
let e = (Math.abs(this.normal.y) < .9 ? new
|
|
1527
|
+
let e = (Math.abs(this.normal.y) < .9 ? new K(0, 1, 0) : new K(1, 0, 0)).cross(this.normal).normalize();
|
|
1528
1528
|
return {
|
|
1529
1529
|
u: e,
|
|
1530
1530
|
v: this.normal.clone().cross(e).normalize()
|
|
1531
1531
|
};
|
|
1532
1532
|
}
|
|
1533
1533
|
applyPlaneOrientation() {
|
|
1534
|
-
let e = this.getPlaneBasis(), t = new
|
|
1534
|
+
let e = this.getPlaneBasis(), t = new ae().makeBasis(e.u, e.v, this.normal);
|
|
1535
1535
|
this.helper.quaternion.setFromRotationMatrix(t);
|
|
1536
1536
|
}
|
|
1537
1537
|
getModelWorldBox() {
|
|
1538
|
-
let e = new
|
|
1538
|
+
let e = new D(), t = new D();
|
|
1539
1539
|
return this.context.getMeshes().forEach((n) => {
|
|
1540
1540
|
n.updateWorldMatrix(!0, !1), n.geometry.boundingBox || n.geometry.computeBoundingBox(), n.geometry.boundingBox && (t.copy(n.geometry.boundingBox).applyMatrix4(n.matrixWorld), e.union(t));
|
|
1541
1541
|
}), this.context.helpers.forEach((t) => {
|
|
@@ -1544,14 +1544,14 @@ var On = class extends ce {
|
|
|
1544
1544
|
}
|
|
1545
1545
|
getBoxCorners(e) {
|
|
1546
1546
|
return [
|
|
1547
|
-
new
|
|
1548
|
-
new
|
|
1549
|
-
new
|
|
1550
|
-
new
|
|
1551
|
-
new
|
|
1552
|
-
new
|
|
1553
|
-
new
|
|
1554
|
-
new
|
|
1547
|
+
new K(e.min.x, e.min.y, e.min.z),
|
|
1548
|
+
new K(e.min.x, e.min.y, e.max.z),
|
|
1549
|
+
new K(e.min.x, e.max.y, e.min.z),
|
|
1550
|
+
new K(e.min.x, e.max.y, e.max.z),
|
|
1551
|
+
new K(e.max.x, e.min.y, e.min.z),
|
|
1552
|
+
new K(e.max.x, e.min.y, e.max.z),
|
|
1553
|
+
new K(e.max.x, e.max.y, e.min.z),
|
|
1554
|
+
new K(e.max.x, e.max.y, e.max.z)
|
|
1555
1555
|
];
|
|
1556
1556
|
}
|
|
1557
1557
|
}, kn = 250;
|
|
@@ -1567,7 +1567,7 @@ function An(e, t) {
|
|
|
1567
1567
|
function jn(e) {
|
|
1568
1568
|
let t = [];
|
|
1569
1569
|
return e?.traverse((e) => {
|
|
1570
|
-
e instanceof
|
|
1570
|
+
e instanceof H && (!e.geometry.index || !e.geometry.attributes.ids || t.push(e));
|
|
1571
1571
|
}), t;
|
|
1572
1572
|
}
|
|
1573
1573
|
function Mn(e) {
|
|
@@ -1713,13 +1713,13 @@ var Fn = class {
|
|
|
1713
1713
|
typeof this.helperHoverMoveState == "number" ? this.helperHoverMoveState += 1 : this.helperHoverMoveState === "start" && (this.helperHoverMoveState = 1);
|
|
1714
1714
|
};
|
|
1715
1715
|
getModelWorldBox() {
|
|
1716
|
-
let e = new
|
|
1716
|
+
let e = new D(), t = new D();
|
|
1717
1717
|
return this.getMeshes().forEach((n) => {
|
|
1718
1718
|
n.updateWorldMatrix(!0, !1), n.geometry.boundingBox || n.geometry.computeBoundingBox(), n.geometry.boundingBox && (t.copy(n.geometry.boundingBox).applyMatrix4(n.matrixWorld), e.union(t));
|
|
1719
1719
|
}), e.isEmpty() ? null : e;
|
|
1720
1720
|
}
|
|
1721
1721
|
getSelectedWorldBox() {
|
|
1722
|
-
let e = this.context.viewerStore.getState().selected, t = new
|
|
1722
|
+
let e = this.context.viewerStore.getState().selected, t = new D(), n = new K();
|
|
1723
1723
|
return this.getMeshes().forEach((r) => {
|
|
1724
1724
|
let i = e[Mn(r)];
|
|
1725
1725
|
if (!i?.size) return;
|
|
@@ -1761,40 +1761,40 @@ var Fn = class {
|
|
|
1761
1761
|
if (!n?.face) return null;
|
|
1762
1762
|
let r = n.point.clone(), i = Pn(n.object, n.face.normal);
|
|
1763
1763
|
r.add(i.clone().multiplyScalar(.001));
|
|
1764
|
-
let a = new
|
|
1764
|
+
let a = new le().setFromNormalAndCoplanarPoint(i.clone().negate(), r);
|
|
1765
1765
|
return this.addPlane(a, r, i), a.clone();
|
|
1766
1766
|
}
|
|
1767
1767
|
createClippingRectangle(e = !1) {
|
|
1768
1768
|
let t = e ? this.getSelectedWorldBox() : this.getModelWorldBox();
|
|
1769
1769
|
if (!t) return [];
|
|
1770
|
-
let n = Dn(t), r = t.min.clone().addScalar(-n), i = t.max.clone().addScalar(n), a = t.getCenter(new
|
|
1770
|
+
let n = Dn(t), r = t.min.clone().addScalar(-n), i = t.max.clone().addScalar(n), a = t.getCenter(new K()), o = [
|
|
1771
1771
|
{
|
|
1772
|
-
normal: new
|
|
1773
|
-
point: new
|
|
1772
|
+
normal: new K(1, 0, 0),
|
|
1773
|
+
point: new K(r.x, a.y, a.z)
|
|
1774
1774
|
},
|
|
1775
1775
|
{
|
|
1776
|
-
normal: new
|
|
1777
|
-
point: new
|
|
1776
|
+
normal: new K(-1, 0, 0),
|
|
1777
|
+
point: new K(i.x, a.y, a.z)
|
|
1778
1778
|
},
|
|
1779
1779
|
{
|
|
1780
|
-
normal: new
|
|
1781
|
-
point: new
|
|
1780
|
+
normal: new K(0, 1, 0),
|
|
1781
|
+
point: new K(a.x, r.y, a.z)
|
|
1782
1782
|
},
|
|
1783
1783
|
{
|
|
1784
|
-
normal: new
|
|
1785
|
-
point: new
|
|
1784
|
+
normal: new K(0, -1, 0),
|
|
1785
|
+
point: new K(a.x, i.y, a.z)
|
|
1786
1786
|
},
|
|
1787
1787
|
{
|
|
1788
|
-
normal: new
|
|
1789
|
-
point: new
|
|
1788
|
+
normal: new K(0, 0, 1),
|
|
1789
|
+
point: new K(a.x, a.y, r.z)
|
|
1790
1790
|
},
|
|
1791
1791
|
{
|
|
1792
|
-
normal: new
|
|
1793
|
-
point: new
|
|
1792
|
+
normal: new K(0, 0, -1),
|
|
1793
|
+
point: new K(a.x, a.y, i.z)
|
|
1794
1794
|
}
|
|
1795
1795
|
].map(({ normal: e, point: t }) => ({
|
|
1796
1796
|
normal: e,
|
|
1797
|
-
plane: new
|
|
1797
|
+
plane: new le().setFromNormalAndCoplanarPoint(e, t),
|
|
1798
1798
|
point: t
|
|
1799
1799
|
}));
|
|
1800
1800
|
return o.forEach(({ normal: e, plane: t, point: n }) => {
|
|
@@ -1859,7 +1859,7 @@ var Fn = class {
|
|
|
1859
1859
|
}
|
|
1860
1860
|
};
|
|
1861
1861
|
function In(e, t, n, i = !1) {
|
|
1862
|
-
let a =
|
|
1862
|
+
let a = T((e) => e.camera), o = T((e) => e.gl), s = T((e) => e.raycaster), c = T((e) => e.scene), l = r(), u = b(() => new Fn({
|
|
1863
1863
|
camera: a,
|
|
1864
1864
|
cameraUtils: n,
|
|
1865
1865
|
controlRef: t,
|
|
@@ -1942,7 +1942,7 @@ function In(e, t, n, i = !1) {
|
|
|
1942
1942
|
var Ln = 1e-6;
|
|
1943
1943
|
function Rn(e, t) {
|
|
1944
1944
|
let n = t.getBoundingClientRect();
|
|
1945
|
-
return n.width <= 0 || n.height <= 0 || e.clientX < n.left || e.clientX > n.right || e.clientY < n.top || e.clientY > n.bottom ? null : new
|
|
1945
|
+
return n.width <= 0 || n.height <= 0 || e.clientX < n.left || e.clientX > n.right || e.clientY < n.top || e.clientY > n.bottom ? null : new G((e.clientX - n.left) / n.width * 2 - 1, -((e.clientY - n.top) / n.height) * 2 + 1);
|
|
1946
1946
|
}
|
|
1947
1947
|
function zn(e, t) {
|
|
1948
1948
|
return t.every((t) => t.distanceToPoint(e) >= -Ln);
|
|
@@ -1956,7 +1956,7 @@ function Bn(e) {
|
|
|
1956
1956
|
return !0;
|
|
1957
1957
|
}
|
|
1958
1958
|
function Vn(e) {
|
|
1959
|
-
let t =
|
|
1959
|
+
let t = T((e) => e.camera), n = T((e) => e.gl), r = T((e) => e.raycaster), i = x(null), a = x(null), o = x(new G()), s = _((e) => {
|
|
1960
1960
|
i.current = e;
|
|
1961
1961
|
}, []), c = _(() => {
|
|
1962
1962
|
let e = i.current;
|
|
@@ -2011,7 +2011,7 @@ function Gn() {
|
|
|
2011
2011
|
return typeof window > "u" ? 1 : Math.min(window.devicePixelRatio || 1, 2);
|
|
2012
2012
|
}
|
|
2013
2013
|
function Kn(e, t) {
|
|
2014
|
-
return e instanceof
|
|
2014
|
+
return e instanceof se ? (e.top - e.bottom) / e.zoom : e instanceof ce ? 2 * Math.tan(e.fov * Math.PI / 360) * Math.max(t, .001) : Math.max(t, 1);
|
|
2015
2015
|
}
|
|
2016
2016
|
function qn(e) {
|
|
2017
2017
|
let t = Gn(), n = document.createElement("canvas"), r = n.getContext("2d");
|
|
@@ -2020,8 +2020,8 @@ function qn(e) {
|
|
|
2020
2020
|
r.font = i;
|
|
2021
2021
|
let a = r.measureText(e), o = a.actualBoundingBoxAscent || Hn * .8, s = a.actualBoundingBoxDescent || Hn * .2, c = Math.max(1, Math.ceil(a.width + Un * 2)), l = Math.max(1, Math.ceil(o + s + Wn * 2));
|
|
2022
2022
|
n.width = Math.ceil(c * t), n.height = Math.ceil(l * t), r.scale(t, t), r.clearRect(0, 0, c, l), r.fillStyle = "rgba(255, 255, 255, 0.86)", r.strokeStyle = "rgba(29, 39, 51, 0.22)", r.lineWidth = 1, r.beginPath(), r.roundRect(.5, .5, c - 1, l - 1, 4), r.fill(), r.stroke(), r.font = i, r.fillStyle = "#111827", r.textAlign = "center", r.textBaseline = "middle", r.fillText(e, c / 2, l / 2);
|
|
2023
|
-
let u = new
|
|
2024
|
-
return u.colorSpace =
|
|
2023
|
+
let u = new j(n);
|
|
2024
|
+
return u.colorSpace = de, u.generateMipmaps = !1, u.magFilter = V, u.minFilter = V, u.needsUpdate = !0, {
|
|
2025
2025
|
height: l,
|
|
2026
2026
|
texture: u,
|
|
2027
2027
|
width: c
|
|
@@ -2040,7 +2040,7 @@ var Jn = class e {
|
|
|
2040
2040
|
boundingMaterial;
|
|
2041
2041
|
endpointGeometry;
|
|
2042
2042
|
endpointMaterial;
|
|
2043
|
-
lineGeometry = new
|
|
2043
|
+
lineGeometry = new A();
|
|
2044
2044
|
lineMaterial;
|
|
2045
2045
|
ownerRoot;
|
|
2046
2046
|
endpointBaseScale;
|
|
@@ -2057,7 +2057,7 @@ var Jn = class e {
|
|
|
2057
2057
|
this.end.x,
|
|
2058
2058
|
this.end.y,
|
|
2059
2059
|
this.end.z
|
|
2060
|
-
], 3)), this.line = new
|
|
2060
|
+
], 3)), this.line = new L(this.lineGeometry, this.lineMaterial), this.line.renderOrder = 4, this.line.computeLineDistances(), this.root.add(this.line), this.addEndpointMeshes(), this.labelSprite = this.createLabelSprite(), this.root.add(this.labelSprite), this.updateLabel(), this.updatePositions(), this.ownerRoot.add(this.root);
|
|
2061
2061
|
}
|
|
2062
2062
|
get length() {
|
|
2063
2063
|
return this.start.distanceTo(this.end);
|
|
@@ -2099,11 +2099,11 @@ var Jn = class e {
|
|
|
2099
2099
|
this.addEndpointMesh(this.start, this.end), this.addEndpointMesh(this.end, this.start);
|
|
2100
2100
|
}
|
|
2101
2101
|
addEndpointMesh(e, t) {
|
|
2102
|
-
let n = new
|
|
2102
|
+
let n = new H(this.endpointGeometry, this.endpointMaterial);
|
|
2103
2103
|
n.position.copy(e), n.scale.copy(this.endpointBaseScale), n.lookAt(t), n.renderOrder = 4, this.endpointMeshes.push(n), this.root.add(n);
|
|
2104
2104
|
}
|
|
2105
2105
|
createLabelSprite() {
|
|
2106
|
-
let e = new
|
|
2106
|
+
let e = new he(new ge({
|
|
2107
2107
|
depthTest: !1,
|
|
2108
2108
|
depthWrite: !1,
|
|
2109
2109
|
transparent: !0
|
|
@@ -2111,7 +2111,7 @@ var Jn = class e {
|
|
|
2111
2111
|
return e.renderOrder = 5, e;
|
|
2112
2112
|
}
|
|
2113
2113
|
createBoundingBoxMesh() {
|
|
2114
|
-
let e = new
|
|
2114
|
+
let e = new H(new O(1, 1, Math.max(this.length, .001)), this.boundingMaterial);
|
|
2115
2115
|
return e.renderOrder = 3, e;
|
|
2116
2116
|
}
|
|
2117
2117
|
getTextContent() {
|
|
@@ -2130,7 +2130,7 @@ var Jn = class e {
|
|
|
2130
2130
|
e.setXYZ(0, this.start.x, this.start.y, this.start.z), e.setXYZ(1, this.end.x, this.end.y, this.end.z), e.needsUpdate = !0, this.lineGeometry.computeBoundingSphere(), this.line.computeLineDistances(), this.endpointMeshes[0]?.position.copy(this.start), this.endpointMeshes[1]?.position.copy(this.end), this.endpointMeshes[0]?.lookAt(this.end), this.endpointMeshes[1]?.lookAt(this.start), this.labelSprite.position.copy(this.center), this.updateLabel(), this.updateBoundingBox();
|
|
2131
2131
|
}
|
|
2132
2132
|
updateBoundingBox() {
|
|
2133
|
-
this.boundingMesh && (this.boundingMesh.position.copy(this.center), this.boundingMesh.lookAt(this.end), this.boundingMesh.geometry.dispose(), this.boundingMesh.geometry = new
|
|
2133
|
+
this.boundingMesh && (this.boundingMesh.position.copy(this.center), this.boundingMesh.lookAt(this.end), this.boundingMesh.geometry.dispose(), this.boundingMesh.geometry = new O(1, 1, Math.max(this.length, .001)));
|
|
2134
2134
|
}
|
|
2135
2135
|
rescaleMesh(t, n, r) {
|
|
2136
2136
|
let i = Kn(n, t.position.distanceTo(n.position)) / Math.max(1, r) * 12 * e.scaleFactor;
|
|
@@ -2149,7 +2149,7 @@ var Jn = class e {
|
|
|
2149
2149
|
function Qn(e) {
|
|
2150
2150
|
let t = [];
|
|
2151
2151
|
return e?.traverse((e) => {
|
|
2152
|
-
e instanceof
|
|
2152
|
+
e instanceof H && e.geometry.attributes.position && t.push(e);
|
|
2153
2153
|
}), t;
|
|
2154
2154
|
}
|
|
2155
2155
|
function $n(e, t, n) {
|
|
@@ -2163,7 +2163,7 @@ function er(e, t) {
|
|
|
2163
2163
|
var tr = class e {
|
|
2164
2164
|
active = !1;
|
|
2165
2165
|
axis = null;
|
|
2166
|
-
boundingMaterial = new
|
|
2166
|
+
boundingMaterial = new U({
|
|
2167
2167
|
color: 0,
|
|
2168
2168
|
depthTest: !1,
|
|
2169
2169
|
depthWrite: !1,
|
|
@@ -2174,13 +2174,13 @@ var tr = class e {
|
|
|
2174
2174
|
currentDimension = null;
|
|
2175
2175
|
dimensions = [];
|
|
2176
2176
|
endpointGeometry = e.createEndpointGeometry();
|
|
2177
|
-
endpointMaterial = new
|
|
2177
|
+
endpointMaterial = new U({
|
|
2178
2178
|
color: Yn,
|
|
2179
2179
|
depthTest: !1,
|
|
2180
2180
|
depthWrite: !1
|
|
2181
2181
|
});
|
|
2182
|
-
endpointScale = new
|
|
2183
|
-
lineMaterial = new
|
|
2182
|
+
endpointScale = new K(1, 1, 1);
|
|
2183
|
+
lineMaterial = new B({
|
|
2184
2184
|
color: Yn,
|
|
2185
2185
|
dashSize: .2,
|
|
2186
2186
|
depthTest: !1,
|
|
@@ -2189,14 +2189,14 @@ var tr = class e {
|
|
|
2189
2189
|
});
|
|
2190
2190
|
measureInProcess = !1;
|
|
2191
2191
|
moveState = "end";
|
|
2192
|
-
previewMarker = new
|
|
2192
|
+
previewMarker = new H(e.createPreviewGeometry(), new U({
|
|
2193
2193
|
color: 0,
|
|
2194
2194
|
depthTest: !1,
|
|
2195
2195
|
depthWrite: !1
|
|
2196
2196
|
}));
|
|
2197
2197
|
root = new I();
|
|
2198
2198
|
snapDistance = Xn;
|
|
2199
|
-
startPoint = new
|
|
2199
|
+
startPoint = new K();
|
|
2200
2200
|
unit = "m";
|
|
2201
2201
|
constructor(e) {
|
|
2202
2202
|
this.context = e, this.root.name = "BimatterDimensions", this.previewMarker.renderOrder = 5, this.previewMarker.visible = !1, this.root.add(this.previewMarker), this.context.scene.add(this.root);
|
|
@@ -2223,7 +2223,7 @@ var tr = class e {
|
|
|
2223
2223
|
this.setActive(!this.active);
|
|
2224
2224
|
}
|
|
2225
2225
|
setColor(e) {
|
|
2226
|
-
let t = e instanceof
|
|
2226
|
+
let t = e instanceof M ? e : new M(e);
|
|
2227
2227
|
this.endpointMaterial.color.copy(t), this.lineMaterial.color.copy(t), this.dimensions.forEach((e) => {
|
|
2228
2228
|
e.dimensionColor = t;
|
|
2229
2229
|
});
|
|
@@ -2335,7 +2335,7 @@ var tr = class e {
|
|
|
2335
2335
|
return this.dimensions.map((e) => e.boundingBox).filter((e) => !!e);
|
|
2336
2336
|
}
|
|
2337
2337
|
getClosestVertex(e) {
|
|
2338
|
-
if (!(e.object instanceof
|
|
2338
|
+
if (!(e.object instanceof H) || !e.face) return e.point.clone();
|
|
2339
2339
|
let t = e.object.geometry.attributes.position;
|
|
2340
2340
|
if (!t) return e.point.clone();
|
|
2341
2341
|
let n = this.context.cameraUtils.getActiveClippingPlanes(), r = [
|
|
@@ -2343,7 +2343,7 @@ var tr = class e {
|
|
|
2343
2343
|
e.face.b,
|
|
2344
2344
|
e.face.c
|
|
2345
2345
|
].map((n) => {
|
|
2346
|
-
let r = new
|
|
2346
|
+
let r = new K(t.getX(n), t.getY(n), t.getZ(n));
|
|
2347
2347
|
return e.object.localToWorld(r);
|
|
2348
2348
|
}).filter((t) => t.distanceTo(e.point) <= this.snapDistance && zn(t, n));
|
|
2349
2349
|
return r.length ? r.reduce((t, n) => n.distanceTo(e.point) < t.distanceTo(e.point) ? n : t) : e.point.clone();
|
|
@@ -2365,7 +2365,7 @@ var tr = class e {
|
|
|
2365
2365
|
return this.moveState !== "end" && this.moveState !== "start";
|
|
2366
2366
|
}
|
|
2367
2367
|
rescalePreviewMarker() {
|
|
2368
|
-
let { camera: e, viewportHeight: t } = this.context, n = this.previewMarker.position.distanceTo(e.position), r = e instanceof
|
|
2368
|
+
let { camera: e, viewportHeight: t } = this.context, n = this.previewMarker.position.distanceTo(e.position), r = e instanceof ce ? 2 * Math.tan(e.fov * Math.PI / 360) * Math.max(n, .001) * 6.667 / Math.max(1, t) : .08;
|
|
2369
2369
|
this.previewMarker.scale.setScalar(r);
|
|
2370
2370
|
}
|
|
2371
2371
|
setSelectionInteractionDisabled(e) {
|
|
@@ -2398,15 +2398,15 @@ var tr = class e {
|
|
|
2398
2398
|
this.active && (e.code === "Escape" && this.cancelDrawing(), e.code === "Tab" && this.measureInProcess && (e.preventDefault(), this.changeAxes()));
|
|
2399
2399
|
};
|
|
2400
2400
|
static createEndpointGeometry(e = .1, t = .03) {
|
|
2401
|
-
let n = new
|
|
2401
|
+
let n = new N(t, e);
|
|
2402
2402
|
return n.translate(0, -e / 2, 0), n.rotateX(-Math.PI / 2), n;
|
|
2403
2403
|
}
|
|
2404
2404
|
static createPreviewGeometry() {
|
|
2405
|
-
return new
|
|
2405
|
+
return new me(.5, 16, 12);
|
|
2406
2406
|
}
|
|
2407
2407
|
};
|
|
2408
2408
|
function nr(e, t, n, i) {
|
|
2409
|
-
let a =
|
|
2409
|
+
let a = T((e) => e.camera), o = T((e) => e.gl), s = T((e) => e.scene), c = T((e) => e.size), l = r(), u = b(() => new tr({
|
|
2410
2410
|
camera: a,
|
|
2411
2411
|
cameraUtils: n,
|
|
2412
2412
|
controlRef: t,
|
|
@@ -2450,7 +2450,7 @@ function nr(e, t, n, i) {
|
|
|
2450
2450
|
s,
|
|
2451
2451
|
c.height,
|
|
2452
2452
|
l
|
|
2453
|
-
]), v(() => () => u.dispose(), [u]),
|
|
2453
|
+
]), v(() => () => u.dispose(), [u]), w(() => {
|
|
2454
2454
|
u.updateFrame();
|
|
2455
2455
|
}), b(() => ({
|
|
2456
2456
|
cancelDrawing: () => u.cancelDrawing(),
|
|
@@ -2490,7 +2490,7 @@ function ir() {
|
|
|
2490
2490
|
}
|
|
2491
2491
|
//#endregion
|
|
2492
2492
|
//#region src/viewer/Selector/SelectionBox.ts
|
|
2493
|
-
var ar = new
|
|
2493
|
+
var ar = new K(), or = new K(), X = new G(), sr = new K(), cr = new K(), lr = new K(), ur = new K(), dr = new K(), fr = new K(), pr = new K();
|
|
2494
2494
|
function mr(e) {
|
|
2495
2495
|
let t = e;
|
|
2496
2496
|
for (; t;) {
|
|
@@ -2585,14 +2585,14 @@ function Dr(e, t, n, r) {
|
|
|
2585
2585
|
function Or(e, t, n) {
|
|
2586
2586
|
return Tr(e.x, e.y, t.x, t.y, n.minX, n.minY, n.maxX, n.minY) || Tr(e.x, e.y, t.x, t.y, n.maxX, n.minY, n.maxX, n.maxY) || Tr(e.x, e.y, t.x, t.y, n.maxX, n.maxY, n.minX, n.maxY) || Tr(e.x, e.y, t.x, t.y, n.minX, n.maxY, n.minX, n.minY);
|
|
2587
2587
|
}
|
|
2588
|
-
function kr(e, t, n, r, i = new
|
|
2588
|
+
function kr(e, t, n, r, i = new G()) {
|
|
2589
2589
|
let a = ar.copy(t).applyMatrix4(e.matrixWorld).project(n);
|
|
2590
2590
|
return i.set((a.x + 1) / 2 * r.width + r.left, (-a.y + 1) / 2 * r.height + r.top);
|
|
2591
2591
|
}
|
|
2592
2592
|
function Ar(e, t, n, r, i) {
|
|
2593
2593
|
let a = Infinity, o = -Infinity, s = Infinity, c = -Infinity, l = 0;
|
|
2594
2594
|
for (let u = 0; u < 2; u++) for (let d = 0; d < 2; d++) for (let f = 0; f < 2; f++) or.set(u ? t.max.x : t.min.x, d ? t.max.y : t.min.y, f ? t.max.z : t.min.z), kr(e, or, r, i, X), a = Math.min(a, X.x), o = Math.max(o, X.x), s = Math.min(s, X.y), c = Math.max(c, X.y), Sr(X, n) && (l += 1);
|
|
2595
|
-
return o < n.minX || a > n.maxX || c < n.minY || s > n.maxY ?
|
|
2595
|
+
return o < n.minX || a > n.maxX || c < n.minY || s > n.maxY ? xe : l === 8 ? ve : ye;
|
|
2596
2596
|
}
|
|
2597
2597
|
function jr(e, t, n, r) {
|
|
2598
2598
|
let i = Infinity, a = -Infinity, o = Infinity, s = -Infinity;
|
|
@@ -2629,7 +2629,7 @@ function Ir(e, t, n, r = []) {
|
|
|
2629
2629
|
r.length && (dr.fromBufferAttribute(s, a.getX(c)), fr.fromBufferAttribute(s, a.getX(c + 1)), pr.fromBufferAttribute(s, a.getX(c + 2)), !_r(e, dr, fr, pr, r)) || Pr(n, mr(e), o.getX(a.getX(c)));
|
|
2630
2630
|
}
|
|
2631
2631
|
function Lr({ model: e, camera: t, viewport: n, rect: r, candidateIdsByModel: i, clippingPlanes: a, profile: o }) {
|
|
2632
|
-
let s = performance.now(), c = /* @__PURE__ */ new Map(), l = new
|
|
2632
|
+
let s = performance.now(), c = /* @__PURE__ */ new Map(), l = new K();
|
|
2633
2633
|
e.traverse((e) => {
|
|
2634
2634
|
let s = e;
|
|
2635
2635
|
if (!s.isMesh || !hr(s)) return;
|
|
@@ -2780,7 +2780,7 @@ function Yr(e) {
|
|
|
2780
2780
|
}), t.join(":");
|
|
2781
2781
|
}
|
|
2782
2782
|
function Xr(e) {
|
|
2783
|
-
if (!Jr(e.object) || !(e.object instanceof
|
|
2783
|
+
if (!Jr(e.object) || !(e.object instanceof H) || e.faceIndex === void 0 || e.faceIndex === null) return !1;
|
|
2784
2784
|
let t = e.object.geometry;
|
|
2785
2785
|
return !!(t.index && t.attributes.ids);
|
|
2786
2786
|
}
|
|
@@ -2796,153 +2796,153 @@ function Zr(e) {
|
|
|
2796
2796
|
};
|
|
2797
2797
|
}
|
|
2798
2798
|
function Qr(e, t, n, i, a, o) {
|
|
2799
|
-
let s = x("end"), c = d((e) => e.selected), l = d((e) => e.setSelected), u = d((e) => e.addSelected), f = d((e) => e.removeSelected), p = d((e) => e.showStats), m = r(), h = x(null), g = x(null), _ = x(!1), y = x(!1), b = x("add"), S = x(null),
|
|
2799
|
+
let s = x("end"), c = d((e) => e.selected), l = d((e) => e.setSelected), u = d((e) => e.addSelected), f = d((e) => e.removeSelected), p = d((e) => e.showStats), m = r(), h = x(null), g = x(null), _ = x(!1), y = x(!1), b = x("add"), S = x(null), C = x(!1), w = x(0), E = x(null), ee = x(null), D = x(null), O = x({
|
|
2800
2800
|
meshesByModel: /* @__PURE__ */ new Map(),
|
|
2801
2801
|
root: null,
|
|
2802
2802
|
version: ""
|
|
2803
|
-
}),
|
|
2803
|
+
}), k = () => m.getState().selectionInteractionDisabled, A = (e) => {
|
|
2804
2804
|
if (i) {
|
|
2805
2805
|
i(e);
|
|
2806
2806
|
return;
|
|
2807
2807
|
}
|
|
2808
2808
|
let n = t.current;
|
|
2809
2809
|
n && (n.cancel(), n.setOrbitPoint(e.x, e.y, e.z));
|
|
2810
|
-
},
|
|
2811
|
-
let n = e.current, r = Yr(n), i =
|
|
2810
|
+
}, j = (t) => {
|
|
2811
|
+
let n = e.current, r = Yr(n), i = O.current;
|
|
2812
2812
|
if (i.root !== n || i.version !== r) {
|
|
2813
2813
|
let e = /* @__PURE__ */ new Map();
|
|
2814
2814
|
return n?.traverse((t) => {
|
|
2815
|
-
if (!(t instanceof
|
|
2815
|
+
if (!(t instanceof H) || !t.geometry.index || !t.geometry.attributes.ids) return;
|
|
2816
2816
|
let n = qr(t), r = e.get(n) ?? [];
|
|
2817
2817
|
r.push(t), e.set(n, r);
|
|
2818
|
-
}),
|
|
2818
|
+
}), O.current = {
|
|
2819
2819
|
meshesByModel: e,
|
|
2820
2820
|
root: n,
|
|
2821
2821
|
version: r
|
|
2822
2822
|
}, e.get(t) ?? [];
|
|
2823
2823
|
}
|
|
2824
2824
|
return i.meshesByModel.get(t) ?? [];
|
|
2825
|
-
},
|
|
2826
|
-
e &&
|
|
2825
|
+
}, M = (e) => {
|
|
2826
|
+
e && j(e.modelID).forEach((e) => {
|
|
2827
2827
|
e.preselected = !1, Gr(e.material, -1);
|
|
2828
2828
|
});
|
|
2829
|
-
},
|
|
2830
|
-
o?.(null),
|
|
2831
|
-
},
|
|
2832
|
-
let n =
|
|
2833
|
-
n?.modelID === e && n.elementID === t || (
|
|
2829
|
+
}, N = () => {
|
|
2830
|
+
o?.(null), M(D.current), D.current = null;
|
|
2831
|
+
}, P = (e, t) => {
|
|
2832
|
+
let n = D.current;
|
|
2833
|
+
n?.modelID === e && n.elementID === t || (M(n), o?.({
|
|
2834
2834
|
elementID: t,
|
|
2835
2835
|
modelID: e
|
|
2836
|
-
}),
|
|
2836
|
+
}), j(e).forEach((e) => {
|
|
2837
2837
|
e.preselected = !0, Gr(e.material, t);
|
|
2838
|
-
}),
|
|
2838
|
+
}), D.current = {
|
|
2839
2839
|
elementID: t,
|
|
2840
2840
|
modelID: e
|
|
2841
2841
|
});
|
|
2842
|
-
},
|
|
2842
|
+
}, te = () => {
|
|
2843
2843
|
h.current = null, _.current = !1, Hr(g), t.current && (t.current.enabled = !0);
|
|
2844
2844
|
}, F = (e) => {
|
|
2845
|
-
if (
|
|
2846
|
-
|
|
2845
|
+
if (k()) {
|
|
2846
|
+
N();
|
|
2847
2847
|
return;
|
|
2848
2848
|
}
|
|
2849
2849
|
if (h.current) {
|
|
2850
|
-
|
|
2850
|
+
N();
|
|
2851
2851
|
return;
|
|
2852
2852
|
}
|
|
2853
2853
|
if (s.current !== "end" && s.current !== "start") {
|
|
2854
|
-
|
|
2854
|
+
N();
|
|
2855
2855
|
return;
|
|
2856
2856
|
}
|
|
2857
|
-
let t =
|
|
2857
|
+
let t = ce(e);
|
|
2858
2858
|
if (!t) {
|
|
2859
|
-
|
|
2859
|
+
N();
|
|
2860
2860
|
return;
|
|
2861
2861
|
}
|
|
2862
|
-
|
|
2862
|
+
P(t.modelID, t.elementID);
|
|
2863
2863
|
};
|
|
2864
2864
|
function I() {
|
|
2865
2865
|
return performance.now();
|
|
2866
2866
|
}
|
|
2867
|
-
let
|
|
2868
|
-
if (
|
|
2869
|
-
|
|
2867
|
+
let L = (e) => {
|
|
2868
|
+
if (k()) {
|
|
2869
|
+
ee.current = null, E.current !== null && (window.clearTimeout(E.current), E.current = null), N();
|
|
2870
2870
|
return;
|
|
2871
2871
|
}
|
|
2872
|
-
if (
|
|
2873
|
-
let t = I() -
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
let e =
|
|
2877
|
-
|
|
2872
|
+
if (ee.current = e, E.current !== null) return;
|
|
2873
|
+
let t = I() - w.current, n = Math.max(0, Ur - t);
|
|
2874
|
+
E.current = window.setTimeout(() => {
|
|
2875
|
+
E.current = null;
|
|
2876
|
+
let e = ee.current;
|
|
2877
|
+
ee.current = null, e && (w.current = performance.now(), F(e));
|
|
2878
2878
|
}, n);
|
|
2879
|
-
},
|
|
2879
|
+
}, R = x(null);
|
|
2880
2880
|
v(() => {
|
|
2881
2881
|
let e = S.current;
|
|
2882
2882
|
if (e) {
|
|
2883
|
-
p &&
|
|
2883
|
+
p && R.current !== null && console.log(`selection ${e.action}:`, Date.now() - R.current, "ms"), S.current = null, R.current = null;
|
|
2884
2884
|
return;
|
|
2885
2885
|
}
|
|
2886
|
-
p &&
|
|
2886
|
+
p && R.current !== null && (console.log("selection spend:", Date.now() - R.current, "ms"), R.current = null);
|
|
2887
2887
|
}, [c, p]);
|
|
2888
|
-
let { camera:
|
|
2889
|
-
function
|
|
2888
|
+
let { camera: z, gl: B } = T();
|
|
2889
|
+
function ne() {
|
|
2890
2890
|
return Date.now();
|
|
2891
2891
|
}
|
|
2892
|
-
let
|
|
2893
|
-
let t =
|
|
2892
|
+
let V = (e) => {
|
|
2893
|
+
let t = B.domElement.getBoundingClientRect();
|
|
2894
2894
|
return e.clientX >= t.left && e.clientX <= t.right && e.clientY >= t.top && e.clientY <= t.bottom;
|
|
2895
|
-
},
|
|
2896
|
-
if (
|
|
2897
|
-
|
|
2895
|
+
}, re = (t) => {
|
|
2896
|
+
if (k()) {
|
|
2897
|
+
C.current = !1, y.current = !1, N();
|
|
2898
2898
|
return;
|
|
2899
2899
|
}
|
|
2900
|
-
if (!
|
|
2901
|
-
if (
|
|
2900
|
+
if (!C.current) return;
|
|
2901
|
+
if (C.current = !1, y.current) {
|
|
2902
2902
|
y.current = !1;
|
|
2903
2903
|
return;
|
|
2904
2904
|
}
|
|
2905
|
-
if (!
|
|
2906
|
-
if (
|
|
2905
|
+
if (!V(t)) return;
|
|
2906
|
+
if (R.current = ne(), s.current !== "end" && s.current !== "start" && s.current > 15) {
|
|
2907
2907
|
s.current = "end";
|
|
2908
2908
|
return;
|
|
2909
2909
|
}
|
|
2910
|
-
let n = t.shiftKey, r = t.ctrlKey, i =
|
|
2910
|
+
let n = t.shiftKey, r = t.ctrlKey, i = ce(t), a, o = Kr(e), d = null;
|
|
2911
2911
|
if (i && (o = i.modelID, d = i.hit.point, a = i.elementID), r) {
|
|
2912
2912
|
a !== void 0 && f(o, [a]);
|
|
2913
2913
|
return;
|
|
2914
2914
|
} else if (n) {
|
|
2915
|
-
a !== void 0 && (c[o]?.has(a) ?? !1 ? f(o, [a]) : (u(o, [a]), d &&
|
|
2915
|
+
a !== void 0 && (c[o]?.has(a) ?? !1 ? f(o, [a]) : (u(o, [a]), d && A(d)));
|
|
2916
2916
|
return;
|
|
2917
2917
|
}
|
|
2918
|
-
l(o, a === void 0 ? [] : [a], !0), d &&
|
|
2919
|
-
},
|
|
2920
|
-
|
|
2921
|
-
},
|
|
2922
|
-
if (
|
|
2923
|
-
|
|
2918
|
+
l(o, a === void 0 ? [] : [a], !0), d && A(d);
|
|
2919
|
+
}, ie = (e) => {
|
|
2920
|
+
k() || e.button !== 0 || !e.shiftKey && !e.ctrlKey || (h.current = new G(e.clientX, e.clientY), b.current = e.ctrlKey ? "remove" : "add", _.current = !1, t.current && (t.current.enabled = !1));
|
|
2921
|
+
}, ae = (e) => {
|
|
2922
|
+
if (k()) {
|
|
2923
|
+
te();
|
|
2924
2924
|
return;
|
|
2925
2925
|
}
|
|
2926
2926
|
if (!h.current) return;
|
|
2927
|
-
let t = new
|
|
2927
|
+
let t = new G(e.clientX, e.clientY), n = Math.abs(t.x - h.current.x), r = Math.abs(t.y - h.current.y);
|
|
2928
2928
|
n < 6 && r < 6 || (_.current ||= !0, e.preventDefault(), Vr(g, h.current, t));
|
|
2929
|
-
},
|
|
2930
|
-
if (
|
|
2931
|
-
|
|
2929
|
+
}, U = (r) => {
|
|
2930
|
+
if (k()) {
|
|
2931
|
+
te();
|
|
2932
2932
|
return;
|
|
2933
2933
|
}
|
|
2934
2934
|
if (!h.current) return;
|
|
2935
|
-
|
|
2936
|
-
let i = _.current, a = new
|
|
2935
|
+
R.current = ne();
|
|
2936
|
+
let i = _.current, a = new G(r.clientX, r.clientY), o = br(h.current, a), s = xr(h.current, a);
|
|
2937
2937
|
if (h.current = null, _.current = !1, Hr(g), t.current && setTimeout(() => {
|
|
2938
2938
|
t.current && (t.current.enabled = !0);
|
|
2939
2939
|
}, 100), !i) return;
|
|
2940
2940
|
y.current = !0, r.preventDefault();
|
|
2941
2941
|
let { ids: c, profile: l } = zr({
|
|
2942
2942
|
model: e.current,
|
|
2943
|
-
camera:
|
|
2943
|
+
camera: z,
|
|
2944
2944
|
clippingPlanes: n.getActiveClippingPlanes(),
|
|
2945
|
-
domElement:
|
|
2945
|
+
domElement: B.domElement,
|
|
2946
2946
|
rect: o,
|
|
2947
2947
|
mode: s
|
|
2948
2948
|
}), d = Array.from(c.values()).reduce((e, t) => e + t.size, 0), p = {
|
|
@@ -2954,7 +2954,7 @@ function Qr(e, t, n, i, a, o) {
|
|
|
2954
2954
|
let n = Array.from(e);
|
|
2955
2955
|
b.current === "remove" ? f(t, n) : u(t, n);
|
|
2956
2956
|
}));
|
|
2957
|
-
},
|
|
2957
|
+
}, oe = (e, t, r = !1) => {
|
|
2958
2958
|
let i = Array.isArray(t) ? t.filter((e) => e.visible) : t ? [t] : [];
|
|
2959
2959
|
return i.length ? n.getIntersection(!1, {
|
|
2960
2960
|
event: e,
|
|
@@ -2963,23 +2963,23 @@ function Qr(e, t, n, i, a, o) {
|
|
|
2963
2963
|
object: i,
|
|
2964
2964
|
recursive: !0
|
|
2965
2965
|
}) : [];
|
|
2966
|
-
},
|
|
2967
|
-
let n =
|
|
2966
|
+
}, W = () => a?.().filter((e) => e.visible) ?? [], se = (e, t) => {
|
|
2967
|
+
let n = oe(e, t, !0);
|
|
2968
2968
|
for (let e of n) {
|
|
2969
2969
|
let t = Zr(e);
|
|
2970
2970
|
if (t) return t;
|
|
2971
2971
|
}
|
|
2972
2972
|
return null;
|
|
2973
|
-
},
|
|
2973
|
+
}, ce = (t) => se(t, W()) || se(t, e.current);
|
|
2974
2974
|
v(() => {
|
|
2975
2975
|
let e = t.current;
|
|
2976
2976
|
if (!e) return;
|
|
2977
|
-
|
|
2977
|
+
B.domElement.addEventListener("pointerdown", ie), B.domElement.addEventListener("pointermove", ae), window.addEventListener("pointerup", U), window.addEventListener("pointerup", re), B.domElement.addEventListener("contextmenu", a), B.domElement.addEventListener("pointerup", i), B.domElement.addEventListener("pointermove", L), B.domElement.addEventListener("pointerleave", N), B.domElement.addEventListener("pointerdown", r), e.addEventListener("update", n);
|
|
2978
2978
|
function n() {
|
|
2979
2979
|
typeof s.current == "number" ? s.current += 1 : s.current === "start" && (s.current = 1);
|
|
2980
2980
|
}
|
|
2981
2981
|
function r(e) {
|
|
2982
|
-
|
|
2982
|
+
C.current = e.button === 0 || e.ctrlKey, s.current = "start";
|
|
2983
2983
|
}
|
|
2984
2984
|
function i() {
|
|
2985
2985
|
setTimeout(() => {
|
|
@@ -2990,20 +2990,20 @@ function Qr(e, t, n, i, a, o) {
|
|
|
2990
2990
|
e.ctrlKey && e.preventDefault();
|
|
2991
2991
|
}
|
|
2992
2992
|
return () => {
|
|
2993
|
-
Hr(g),
|
|
2993
|
+
Hr(g), E.current !== null && (window.clearTimeout(E.current), E.current = null), ee.current = null, N(), e.removeEventListener("update", n), B.domElement.removeEventListener("pointerdown", ie), B.domElement.removeEventListener("pointermove", ae), window.removeEventListener("pointerup", U), window.removeEventListener("pointerup", re), B.domElement.removeEventListener("contextmenu", a), B.domElement.removeEventListener("pointerup", i), B.domElement.removeEventListener("pointerdown", r), B.domElement.removeEventListener("pointermove", L), B.domElement.removeEventListener("pointerleave", N);
|
|
2994
2994
|
};
|
|
2995
2995
|
});
|
|
2996
2996
|
}
|
|
2997
2997
|
//#endregion
|
|
2998
2998
|
//#region src/viewer/Camera/useCameraFit.tsx
|
|
2999
|
-
var $r = new
|
|
2999
|
+
var $r = new K(1, 1, 1).normalize(), ei = 1.18;
|
|
3000
3000
|
function ti() {
|
|
3001
|
-
let { camera: e } =
|
|
3001
|
+
let { camera: e } = T();
|
|
3002
3002
|
return _((t, n, r) => {
|
|
3003
|
-
if (!t.current || !(e instanceof
|
|
3004
|
-
let i = new
|
|
3003
|
+
if (!t.current || !(e instanceof ce)) return;
|
|
3004
|
+
let i = new D().setFromObject(t.current);
|
|
3005
3005
|
if (i.isEmpty()) return;
|
|
3006
|
-
let a = i.getCenter(new
|
|
3006
|
+
let a = i.getCenter(new K()), o = i.getBoundingSphere(new pe()), s = ie.degToRad(e.fov), c = 2 * Math.atan(Math.tan(s / 2) * e.aspect), l = Math.min(s, c), u = o.radius / Math.sin(l / 2) * ei;
|
|
3007
3007
|
e.position.copy(a).addScaledVector($r, u), e.up.set(0, 1, 0), e.lookAt(a), e.updateProjectionMatrix();
|
|
3008
3008
|
let d = n.current;
|
|
3009
3009
|
d && (d.cancel(), d.setFocalOffset(0, 0, 0, !1), d.setLookAt(e.position.x, e.position.y, e.position.z, a.x, a.y, a.z, !1)), r.current && (r.current.position.copy(a).addScaledVector($r, u * .8), r.current.lookAt(a));
|
|
@@ -3013,7 +3013,7 @@ function ti() {
|
|
|
3013
3013
|
//#region src/viewer/store/ViewerStoreProvider.tsx
|
|
3014
3014
|
function ni({ children: e, store: t }) {
|
|
3015
3015
|
let [n] = S(() => t ?? o());
|
|
3016
|
-
return /* @__PURE__ */
|
|
3016
|
+
return /* @__PURE__ */ q(i.Provider, {
|
|
3017
3017
|
value: n,
|
|
3018
3018
|
children: e
|
|
3019
3019
|
});
|
|
@@ -3923,7 +3923,7 @@ var ba = "BMT", xa = 1, Sa = {
|
|
|
3923
3923
|
let t = /* @__PURE__ */ new Map();
|
|
3924
3924
|
return (Array.isArray(e) ? e : [e]).forEach((e) => {
|
|
3925
3925
|
e.traverse((e) => {
|
|
3926
|
-
if (!(e instanceof
|
|
3926
|
+
if (!(e instanceof H) || !this.isIfcSpaceObject(e)) return;
|
|
3927
3927
|
let n = this.getObjectModelID(e);
|
|
3928
3928
|
if (n === null) return;
|
|
3929
3929
|
let r = e.geometry.getAttribute("ids");
|
|
@@ -3937,7 +3937,7 @@ var ba = "BMT", xa = 1, Sa = {
|
|
|
3937
3937
|
addVisibleIdsFromObject3D(e, t) {
|
|
3938
3938
|
(Array.isArray(e) ? e : [e]).forEach((e) => {
|
|
3939
3939
|
e.traverse((e) => {
|
|
3940
|
-
if (!(e instanceof
|
|
3940
|
+
if (!(e instanceof H) || !this.isObjectVisible(e)) return;
|
|
3941
3941
|
let n = this.getObjectModelID(e);
|
|
3942
3942
|
if (n === null) return;
|
|
3943
3943
|
let r = e.geometry.getAttribute("ids");
|
|
@@ -3989,7 +3989,7 @@ var ba = "BMT", xa = 1, Sa = {
|
|
|
3989
3989
|
return this.deflateBytes(new Uint8Array(e.buffer, e.byteOffset, e.byteLength));
|
|
3990
3990
|
}
|
|
3991
3991
|
deflateBytes(e) {
|
|
3992
|
-
return
|
|
3992
|
+
return we.deflate(e);
|
|
3993
3993
|
}
|
|
3994
3994
|
encodeText(e) {
|
|
3995
3995
|
return this.textEncoder.encode(e);
|
|
@@ -4391,9 +4391,9 @@ var Ga = class {
|
|
|
4391
4391
|
}
|
|
4392
4392
|
}, Ka = class {
|
|
4393
4393
|
decodeBuffer(e) {
|
|
4394
|
-
return this.textDecoder.decode(
|
|
4394
|
+
return this.textDecoder.decode(we.inflate(e));
|
|
4395
4395
|
}
|
|
4396
|
-
decoder =
|
|
4396
|
+
decoder = we;
|
|
4397
4397
|
textDecoder = new TextDecoder("utf-8");
|
|
4398
4398
|
ChunkType = {
|
|
4399
4399
|
PROP: 1,
|
|
@@ -4969,7 +4969,7 @@ var Ro = new class {
|
|
|
4969
4969
|
}
|
|
4970
4970
|
return i;
|
|
4971
4971
|
}
|
|
4972
|
-
}(), zo = .5, Bo = .04, Z = .16, Vo = Z, Q = zo * 2 - Z * 2, Ho = zo - Bo / 2, Uo = zo - Z / 2, Wo = zo - Vo / 2, Go = .63, Ko = "#dfe6ec", qo = 260, Jo = 30, Yo = .3, Xo = 8, Zo = new
|
|
4972
|
+
}(), zo = .5, Bo = .04, Z = .16, Vo = Z, Q = zo * 2 - Z * 2, Ho = zo - Bo / 2, Uo = zo - Z / 2, Wo = zo - Vo / 2, Go = .63, Ko = "#dfe6ec", qo = 260, Jo = 30, Yo = .3, Xo = 8, Zo = new K(0, 1, 0), Qo = 1e-8, $o = new D(), es = new pe(), ts = [
|
|
4973
4973
|
{
|
|
4974
4974
|
direction: [
|
|
4975
4975
|
0,
|
|
@@ -5230,19 +5230,19 @@ function ss(e, t) {
|
|
|
5230
5230
|
r.font = i;
|
|
5231
5231
|
let a = r.measureText(e), o = a.actualBoundingBoxAscent || Jo * .8, s = a.actualBoundingBoxDescent || Jo * .2, c = Math.ceil(a.width + 36), l = Math.ceil(o + s + 20);
|
|
5232
5232
|
n.width = c, n.height = l, r.clearRect(0, 0, c, l), r.font = i, r.fillStyle = t, r.textAlign = "center", r.textBaseline = "alphabetic", r.fillText(e, c / 2, 10 + o);
|
|
5233
|
-
let u = new
|
|
5234
|
-
return u.colorSpace =
|
|
5233
|
+
let u = new j(n);
|
|
5234
|
+
return u.colorSpace = de, u.generateMipmaps = !1, u.magFilter = V, u.minFilter = V, u.anisotropy = Xo, u.needsUpdate = !0, {
|
|
5235
5235
|
aspect: c / l,
|
|
5236
5236
|
texture: u
|
|
5237
5237
|
};
|
|
5238
5238
|
}
|
|
5239
5239
|
function cs({ color: e, label: t, position: n, rotation: r }) {
|
|
5240
5240
|
let { aspect: i, texture: a } = b(() => ss(t, e), [e, t]);
|
|
5241
|
-
return v(() => () => a.dispose(), [a]), /* @__PURE__ */
|
|
5241
|
+
return v(() => () => a.dispose(), [a]), /* @__PURE__ */ J("mesh", {
|
|
5242
5242
|
position: n,
|
|
5243
5243
|
renderOrder: 2,
|
|
5244
5244
|
rotation: r,
|
|
5245
|
-
children: [/* @__PURE__ */
|
|
5245
|
+
children: [/* @__PURE__ */ q("planeGeometry", { args: [Yo * i, Yo] }), /* @__PURE__ */ q("meshBasicMaterial", {
|
|
5246
5246
|
alphaTest: .1,
|
|
5247
5247
|
depthWrite: !1,
|
|
5248
5248
|
map: a,
|
|
@@ -5252,14 +5252,14 @@ function cs({ color: e, label: t, position: n, rotation: r }) {
|
|
|
5252
5252
|
});
|
|
5253
5253
|
}
|
|
5254
5254
|
function ls(e) {
|
|
5255
|
-
return Math.abs(e.y) > .9 ? new
|
|
5255
|
+
return Math.abs(e.y) > .9 ? new K(0, 0, e.y > 0 ? -1 : 1) : new K(0, 1, 0);
|
|
5256
5256
|
}
|
|
5257
5257
|
function us(e, t) {
|
|
5258
5258
|
let n = e.current;
|
|
5259
5259
|
return !n || (n.updateWorldMatrix(!0, !0), $o.setFromObject(n), $o.isEmpty()) ? (es.center.copy(t), es.radius = 10, es) : ($o.getBoundingSphere(es), (!Number.isFinite(es.radius) || es.radius <= 0) && (es.radius = 10), es);
|
|
5260
5260
|
}
|
|
5261
5261
|
function ds(e) {
|
|
5262
|
-
return e.current?.getTarget(new
|
|
5262
|
+
return e.current?.getTarget(new K()) ?? new K();
|
|
5263
5263
|
}
|
|
5264
5264
|
function fs(e, t) {
|
|
5265
5265
|
if (e.up.distanceToSquared(Zo) <= Qo) return;
|
|
@@ -5267,7 +5267,7 @@ function fs(e, t) {
|
|
|
5267
5267
|
e.up.copy(Zo), n ? (n.updateCameraUp(), n.normalizeRotations(), n.setLookAt(r.x, r.y, r.z, i.x, i.y, i.z, !1), n.update(0)) : (e.lookAt(i), e.updateMatrixWorld());
|
|
5268
5268
|
}
|
|
5269
5269
|
function ps({ camera: e, controlRef: t, direction: n, modelRef: r, transitionRef: i }) {
|
|
5270
|
-
let a = ds(t), o = us(r, a), s = o.center.clone(), c = new
|
|
5270
|
+
let a = ds(t), o = us(r, a), s = o.center.clone(), c = new K(...n).normalize(), l = e.position.distanceTo(a), u = Number.isFinite(l) && l > o.radius * .5 ? l : o.radius * 2.4, d = s.clone().addScaledVector(c, u);
|
|
5271
5271
|
t.current?.cancel(), t.current?.setFocalOffset(0, 0, 0, !1), i.current = {
|
|
5272
5272
|
endPosition: d,
|
|
5273
5273
|
endTarget: s,
|
|
@@ -5280,7 +5280,7 @@ function ps({ camera: e, controlRef: t, direction: n, modelRef: r, transitionRef
|
|
|
5280
5280
|
}
|
|
5281
5281
|
function ms({ action: e, onPick: t }) {
|
|
5282
5282
|
let [n, r] = S(!1);
|
|
5283
|
-
return /* @__PURE__ */
|
|
5283
|
+
return /* @__PURE__ */ J("group", {
|
|
5284
5284
|
position: e.position,
|
|
5285
5285
|
onClick: is,
|
|
5286
5286
|
onPointerDown: (n) => {
|
|
@@ -5292,18 +5292,18 @@ function ms({ action: e, onPick: t }) {
|
|
|
5292
5292
|
onPointerLeave: (e) => {
|
|
5293
5293
|
is(e), r(!1);
|
|
5294
5294
|
},
|
|
5295
|
-
children: [/* @__PURE__ */
|
|
5295
|
+
children: [/* @__PURE__ */ J("mesh", {
|
|
5296
5296
|
scale: e.scale,
|
|
5297
|
-
children: [/* @__PURE__ */
|
|
5297
|
+
children: [/* @__PURE__ */ q("boxGeometry", { args: [
|
|
5298
5298
|
1,
|
|
5299
5299
|
1,
|
|
5300
5300
|
1
|
|
5301
|
-
] }), /* @__PURE__ */
|
|
5301
|
+
] }), /* @__PURE__ */ q("meshBasicMaterial", {
|
|
5302
5302
|
color: as(n),
|
|
5303
5303
|
opacity: os(n),
|
|
5304
5304
|
transparent: !0
|
|
5305
5305
|
})]
|
|
5306
|
-
}), e.label && /* @__PURE__ */
|
|
5306
|
+
}), e.label && /* @__PURE__ */ q(cs, {
|
|
5307
5307
|
color: n ? "#ffffff" : "#50606f",
|
|
5308
5308
|
label: e.label,
|
|
5309
5309
|
position: [
|
|
@@ -5331,7 +5331,7 @@ function hs({ active: e = !0, cameraRef: t, controlRef: n, modelRef: r }) {
|
|
|
5331
5331
|
return e.addEventListener("controlstart", r), () => {
|
|
5332
5332
|
e.removeEventListener("controlstart", r);
|
|
5333
5333
|
};
|
|
5334
|
-
}, [t, n]),
|
|
5334
|
+
}, [t, n]), w(() => {
|
|
5335
5335
|
if (!e) return;
|
|
5336
5336
|
let r = t.current;
|
|
5337
5337
|
if (!r) return;
|
|
@@ -5340,14 +5340,14 @@ function hs({ active: e = !0, cameraRef: t, controlRef: n, modelRef: r }) {
|
|
|
5340
5340
|
if (!o) return;
|
|
5341
5341
|
let s = performance.now() - o.startTime, c = Math.min(s / qo, 1), l = 1 - (1 - c) ** 3, u = n.current;
|
|
5342
5342
|
if (r.position.lerpVectors(o.startPosition, o.endPosition, l), r.up.lerpVectors(o.startUp, o.endUp, l), u) {
|
|
5343
|
-
let e = new
|
|
5343
|
+
let e = new K().lerpVectors(o.startTarget, o.endTarget, l);
|
|
5344
5344
|
u.setLookAt(r.position.x, r.position.y, r.position.z, e.x, e.y, e.z, !1);
|
|
5345
5345
|
} else r.lookAt(o.endTarget);
|
|
5346
5346
|
c >= 1 && (r.up.copy(o.endUp), u?.setLookAt(o.endPosition.x, o.endPosition.y, o.endPosition.z, o.endTarget.x, o.endTarget.y, o.endTarget.z, !1), a.current = null);
|
|
5347
|
-
}), e ? /* @__PURE__ */
|
|
5347
|
+
}), e ? /* @__PURE__ */ q("group", {
|
|
5348
5348
|
ref: i,
|
|
5349
5349
|
scale: Go,
|
|
5350
|
-
children: o.map((e) => /* @__PURE__ */
|
|
5350
|
+
children: o.map((e) => /* @__PURE__ */ q(ms, {
|
|
5351
5351
|
action: e,
|
|
5352
5352
|
onPick: (e) => {
|
|
5353
5353
|
let i = t.current;
|
|
@@ -5402,7 +5402,7 @@ var gs = class {
|
|
|
5402
5402
|
}, Ss = {
|
|
5403
5403
|
antialias: !1,
|
|
5404
5404
|
powerPreference: "high-performance"
|
|
5405
|
-
}, Cs = .1, ws = .02, Ts = 150, Es = .75, Ds = .6, Os = 1e3, ks = 50, As = 30, js = 2, Ms = 1.25, Ns = .08, Ps = 1.2, Fs = 2, Is = new
|
|
5405
|
+
}, Cs = .1, ws = .02, Ts = 150, Es = .75, Ds = .6, Os = 1e3, ks = 50, As = 30, js = 2, Ms = 1.25, Ns = .08, Ps = 1.2, Fs = 2, Is = new D(), Ls = new pe(), $ = new K(), Rs = new K(), zs = new K();
|
|
5406
5406
|
function Bs({ alpha: e = !0, performanceMode: t }) {
|
|
5407
5407
|
return async ({ canvas: n }) => {
|
|
5408
5408
|
let { WebGPURenderer: r } = await import("./three.webgpu-vPugBGTK.js").then((e) => e.i), i = new r({
|
|
@@ -5413,42 +5413,50 @@ function Bs({ alpha: e = !0, performanceMode: t }) {
|
|
|
5413
5413
|
return await i.init?.(), i.setClearColor(0, 0), i;
|
|
5414
5414
|
};
|
|
5415
5415
|
}
|
|
5416
|
-
function Vs(e
|
|
5416
|
+
function Vs(e = !1) {
|
|
5417
|
+
return {
|
|
5418
|
+
active: e,
|
|
5419
|
+
finalFitDone: !1,
|
|
5420
|
+
firstFitDone: !1,
|
|
5421
|
+
userInteractedAfterFirstFit: !1
|
|
5422
|
+
};
|
|
5423
|
+
}
|
|
5424
|
+
function Hs(e, t) {
|
|
5417
5425
|
return Array.isArray(e) ? [Math.min(e[0], t), Math.min(e[1], t)] : typeof e == "number" ? Math.min(e, t) : t;
|
|
5418
5426
|
}
|
|
5419
|
-
function
|
|
5427
|
+
function Us(e) {
|
|
5420
5428
|
return Array.isArray(e) ? [Math.max(e[0], js), Math.max(e[1], js)] : typeof e == "number" ? Math.max(e, js) : js;
|
|
5421
5429
|
}
|
|
5422
|
-
function
|
|
5430
|
+
function Ws() {
|
|
5423
5431
|
let e = navigator, t = navigator.userAgent.toLowerCase(), n = navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1, r = window.matchMedia?.("(pointer: coarse)").matches ?? !1;
|
|
5424
5432
|
return e.userAgentData?.mobile || n || /android|iphone|ipad|ipod|mobile|tablet/.test(t) || navigator.maxTouchPoints > 1 && r ? "mobile" : "pc";
|
|
5425
5433
|
}
|
|
5426
|
-
function
|
|
5427
|
-
let t =
|
|
5434
|
+
function Gs(e) {
|
|
5435
|
+
let t = Ks(e);
|
|
5428
5436
|
return t ? Math.max(t.radius * ws, Cs) : Cs;
|
|
5429
5437
|
}
|
|
5430
|
-
function
|
|
5438
|
+
function Ks(e) {
|
|
5431
5439
|
if (!e || (Is.setFromObject(e), Is.isEmpty())) return null;
|
|
5432
5440
|
let t = Is.getBoundingSphere(Ls);
|
|
5433
5441
|
return !Number.isFinite(t.radius) || t.radius <= 0 ? null : t;
|
|
5434
5442
|
}
|
|
5435
|
-
function Ks(e) {
|
|
5436
|
-
return e.type === "Group" && typeof e.userData.modelID == "number";
|
|
5437
|
-
}
|
|
5438
5443
|
function qs(e) {
|
|
5439
|
-
return e
|
|
5444
|
+
return e.type === "Group" && typeof e.userData.modelID == "number";
|
|
5440
5445
|
}
|
|
5441
|
-
function Js(e
|
|
5442
|
-
return
|
|
5446
|
+
function Js(e) {
|
|
5447
|
+
return e?.children.filter(qs) ?? [];
|
|
5443
5448
|
}
|
|
5444
5449
|
function Ys(e, t) {
|
|
5445
|
-
|
|
5450
|
+
return Js(e).find((e) => e.userData.modelID === t) ?? null;
|
|
5451
|
+
}
|
|
5452
|
+
function Xs(e, t) {
|
|
5453
|
+
let n = Ks(t);
|
|
5446
5454
|
if (!n) return;
|
|
5447
5455
|
let r = Math.max(Os, n.radius * ks, e.near + 1);
|
|
5448
5456
|
Math.abs(e.far - r) < 1 || (e.far = r, e.updateProjectionMatrix());
|
|
5449
5457
|
}
|
|
5450
|
-
function
|
|
5451
|
-
let n = new
|
|
5458
|
+
function Zs(e, t) {
|
|
5459
|
+
let n = new D();
|
|
5452
5460
|
return Object.entries(e).forEach(([e, r]) => {
|
|
5453
5461
|
let i = Number(e), a = t.elementBounds.get(i);
|
|
5454
5462
|
a && r.forEach((e) => {
|
|
@@ -5457,263 +5465,296 @@ function Xs(e, t) {
|
|
|
5457
5465
|
});
|
|
5458
5466
|
}), n.isEmpty() ? null : n;
|
|
5459
5467
|
}
|
|
5460
|
-
function
|
|
5468
|
+
function Qs(e) {
|
|
5461
5469
|
let t = e.getSize(zs), n = Math.max(t.x, t.y, t.z);
|
|
5462
5470
|
return Number.isFinite(n) && n > 0 ? n * Ns : Cs;
|
|
5463
5471
|
}
|
|
5464
|
-
function
|
|
5472
|
+
function $s(e, t, n) {
|
|
5465
5473
|
let r = Math.max(Cs, (Number.isFinite(n) ? n : Cs) * Ms), i = t.position.distanceTo(e);
|
|
5466
5474
|
return Number.isFinite(i) && i >= r ? e : ($.copy(e).sub(t.position), (!Number.isFinite($.x + $.y + $.z) || $.lengthSq() === 0) && t.getWorldDirection($), $.lengthSq() === 0 && $.set(0, 0, -1), $.normalize(), Rs.copy(t.position).addScaledVector($, r));
|
|
5467
5475
|
}
|
|
5468
|
-
function
|
|
5469
|
-
let
|
|
5470
|
-
if (
|
|
5476
|
+
function ec({ autoFitCamera: e, cameraRef: t, controlRef: r, fitToView: i, lightRef: a, materialMode: o, modelRef: s, modelsData: c, modelsLoading: l, onReady: u, onCameraDprModeChange: f, publicApi: p, setSceneApi: m, usePerformanceMoving: h, useWebGPU: g }) {
|
|
5477
|
+
let y = T((e) => e.camera), S = T((e) => e.gl), C = ht(s), w = kt(C), { colorPaletteTexture: D, colorUtils: O } = n(C), k = Vn(s), A = In(s, r, k, g), j = nr(s, r, k, A.getSelectableObjects), M = b(() => new Ea(), []), N = w.buildIndex, P = C.resetIndex, te = O.applyStoredColors, F = ti(), I = x(null), L = x(null), R = x(null), z = x(Vs()), B = x(l), ne = x(!1), V = d((e) => e.showStats), re = _((e) => {
|
|
5478
|
+
if (s.current = e, !e) return;
|
|
5471
5479
|
let t = e;
|
|
5472
|
-
t.isClippingGroup =
|
|
5473
|
-
}, [
|
|
5480
|
+
t.isClippingGroup = g, t.enabled = !1, t.clipIntersection = !1, t.clipShadows = !1, t.clippingPlanes = [];
|
|
5481
|
+
}, [s, g]);
|
|
5474
5482
|
v(() => {
|
|
5475
|
-
|
|
5483
|
+
s.current && A.updateMaterials();
|
|
5476
5484
|
}, [
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5485
|
+
A,
|
|
5486
|
+
s,
|
|
5487
|
+
g
|
|
5480
5488
|
]);
|
|
5481
|
-
let
|
|
5482
|
-
let e = Object.keys(
|
|
5489
|
+
let ie = b(() => {
|
|
5490
|
+
let e = Object.keys(c).sort((e, t) => Number(e) - Number(t));
|
|
5483
5491
|
for (let t of e) {
|
|
5484
|
-
let e =
|
|
5492
|
+
let e = it(c[Number(t)]);
|
|
5485
5493
|
if (e) return e;
|
|
5486
5494
|
}
|
|
5487
5495
|
return null;
|
|
5488
|
-
}, [
|
|
5489
|
-
r.current && (r.current.minDistance =
|
|
5490
|
-
}, [r,
|
|
5496
|
+
}, [c]), ae = b(() => nt(ie ?? void 0), [ie]), H = b(() => Object.entries(c).map(([e, t]) => [Number(e), t]), [c]), U = o !== "performance", oe = _(() => {
|
|
5497
|
+
r.current && (r.current.minDistance = Gs(s.current));
|
|
5498
|
+
}, [r, s]), W = _((e, t = !1) => {
|
|
5491
5499
|
let n = r.current;
|
|
5492
5500
|
if (!n) return !1;
|
|
5493
|
-
let i = t ?
|
|
5501
|
+
let i = t ? $s(e, y, n.minDistance) : e;
|
|
5494
5502
|
return n.cancel(), n.setOrbitPoint(i.x, i.y, i.z), !0;
|
|
5495
|
-
}, [
|
|
5496
|
-
|
|
5497
|
-
}, [
|
|
5498
|
-
|
|
5503
|
+
}, [y, r]), le = _((e) => {
|
|
5504
|
+
I.current = e.clone(), W(e, !0);
|
|
5505
|
+
}, [W]), ue = _(() => {
|
|
5506
|
+
I.current = null, F(s, r, a);
|
|
5499
5507
|
}, [
|
|
5500
5508
|
r,
|
|
5501
|
-
|
|
5509
|
+
F,
|
|
5510
|
+
a,
|
|
5511
|
+
s
|
|
5512
|
+
]), de = _((t) => {
|
|
5513
|
+
if (!t) return !1;
|
|
5514
|
+
if (!e || !i) return l || (z.current = Vs()), !1;
|
|
5515
|
+
let n = z.current;
|
|
5516
|
+
if (l) {
|
|
5517
|
+
n.active || (z.current = Vs(!0));
|
|
5518
|
+
let e = z.current;
|
|
5519
|
+
return e.firstFitDone ? !1 : (e.firstFitDone = !0, !0);
|
|
5520
|
+
}
|
|
5521
|
+
if (n.active) {
|
|
5522
|
+
if (n.finalFitDone) return !1;
|
|
5523
|
+
let e = !n.firstFitDone || !n.userInteractedAfterFirstFit;
|
|
5524
|
+
return z.current = Vs(), e;
|
|
5525
|
+
}
|
|
5526
|
+
return !0;
|
|
5527
|
+
}, [
|
|
5528
|
+
e,
|
|
5502
5529
|
i,
|
|
5503
|
-
|
|
5504
|
-
]),
|
|
5530
|
+
l
|
|
5531
|
+
]), fe = _((e, t = !1) => {
|
|
5505
5532
|
let n = r.current;
|
|
5506
5533
|
if (!n) return;
|
|
5507
|
-
let i =
|
|
5534
|
+
let i = Zs(e, C.buildIndex());
|
|
5508
5535
|
if (!i) return;
|
|
5509
|
-
let a = i.getCenter(new
|
|
5510
|
-
if (
|
|
5511
|
-
let e =
|
|
5536
|
+
let a = i.getCenter(new K());
|
|
5537
|
+
if (I.current = a.clone(), n.cancel(), t) {
|
|
5538
|
+
let e = Qs(i);
|
|
5512
5539
|
n.fitToBox(i, !0, {
|
|
5513
5540
|
paddingBottom: e,
|
|
5514
5541
|
paddingLeft: e,
|
|
5515
5542
|
paddingRight: e,
|
|
5516
5543
|
paddingTop: e
|
|
5517
5544
|
}).then(() => {
|
|
5518
|
-
let e =
|
|
5519
|
-
e &&
|
|
5545
|
+
let e = I.current;
|
|
5546
|
+
e && W(e, !0);
|
|
5520
5547
|
});
|
|
5521
5548
|
return;
|
|
5522
5549
|
}
|
|
5523
|
-
|
|
5550
|
+
W(a, !0);
|
|
5524
5551
|
}, [
|
|
5525
|
-
|
|
5552
|
+
W,
|
|
5526
5553
|
r,
|
|
5527
|
-
|
|
5528
|
-
]),
|
|
5554
|
+
C
|
|
5555
|
+
]), pe = b(() => {
|
|
5529
5556
|
let e = (e) => ({
|
|
5530
5557
|
...e,
|
|
5531
|
-
activeViewRoot:
|
|
5558
|
+
activeViewRoot: s.current
|
|
5532
5559
|
});
|
|
5533
5560
|
return {
|
|
5534
|
-
convertIfcFileToBmt: (e, t) =>
|
|
5535
|
-
convertToBmt: (t) =>
|
|
5561
|
+
convertIfcFileToBmt: (e, t) => M.ConvertIfcFileToBmt(e, t),
|
|
5562
|
+
convertToBmt: (t) => M.ConvertToBmt(c, e(t))
|
|
5536
5563
|
};
|
|
5537
5564
|
}, [
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5565
|
+
M,
|
|
5566
|
+
s,
|
|
5567
|
+
c
|
|
5541
5568
|
]);
|
|
5542
5569
|
return v(() => {
|
|
5543
5570
|
let e = () => {
|
|
5544
|
-
|
|
5571
|
+
L.current !== null && (window.clearTimeout(L.current), L.current = null);
|
|
5545
5572
|
}, t = () => {
|
|
5546
|
-
let e =
|
|
5547
|
-
e !== null && (
|
|
5573
|
+
let e = R.current;
|
|
5574
|
+
e !== null && (R.current = null, A.setEdgesActive(e));
|
|
5548
5575
|
};
|
|
5549
|
-
if (!
|
|
5550
|
-
e(), t(),
|
|
5576
|
+
if (!h) {
|
|
5577
|
+
e(), t(), f("sleep");
|
|
5551
5578
|
return;
|
|
5552
5579
|
}
|
|
5553
5580
|
let n = r.current;
|
|
5554
5581
|
if (!n) return;
|
|
5555
5582
|
let i = () => {
|
|
5556
|
-
e(),
|
|
5557
|
-
|
|
5583
|
+
e(), f("wake"), L.current = window.setTimeout(() => {
|
|
5584
|
+
L.current = null, f("move"), R.current === null && (R.current = A.getEdgesActive()), R.current && A.setEdgesActive(!1);
|
|
5558
5585
|
}, Ts);
|
|
5559
5586
|
}, a = () => {
|
|
5560
|
-
e(), t(),
|
|
5587
|
+
e(), t(), f("sleep");
|
|
5561
5588
|
};
|
|
5562
5589
|
return n.addEventListener("wake", i), n.addEventListener("sleep", a), () => {
|
|
5563
|
-
e(), n.removeEventListener("wake", i), n.removeEventListener("sleep", a), t(),
|
|
5590
|
+
e(), n.removeEventListener("wake", i), n.removeEventListener("sleep", a), t(), f("sleep");
|
|
5564
5591
|
};
|
|
5565
5592
|
}, [
|
|
5566
|
-
|
|
5593
|
+
A,
|
|
5567
5594
|
r,
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
]),
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
5595
|
+
f,
|
|
5596
|
+
h
|
|
5597
|
+
]), v(() => {
|
|
5598
|
+
l && !B.current && (z.current = Vs(!0)), B.current = l;
|
|
5599
|
+
}, [l]), v(() => {
|
|
5600
|
+
let e = r.current;
|
|
5601
|
+
if (!e) return;
|
|
5602
|
+
let t = () => {
|
|
5603
|
+
let e = z.current;
|
|
5604
|
+
!e.active || !e.firstFitDone || (e.userInteractedAfterFirstFit = !0);
|
|
5605
|
+
};
|
|
5606
|
+
return e.addEventListener("controlstart", t), e.addEventListener("control", t), () => {
|
|
5607
|
+
e.removeEventListener("controlstart", t), e.removeEventListener("control", t);
|
|
5608
|
+
};
|
|
5609
|
+
}, [r]), Qr(s, r, k, le, A.getSelectableObjects, A.setCapsPreselection), ir(), v(() => {
|
|
5610
|
+
let e = S.domElement, t = (e) => {
|
|
5611
|
+
let t = I.current;
|
|
5612
|
+
t && e.button === 0 && (e.ctrlKey || e.metaKey || e.shiftKey || W(t, !0));
|
|
5574
5613
|
};
|
|
5575
5614
|
return e.addEventListener("pointerdown", t, !0), () => {
|
|
5576
5615
|
e.removeEventListener("pointerdown", t, !0);
|
|
5577
5616
|
};
|
|
5578
|
-
}, [
|
|
5579
|
-
|
|
5580
|
-
}), [
|
|
5581
|
-
t.current ===
|
|
5582
|
-
}), [
|
|
5583
|
-
if (!
|
|
5617
|
+
}, [W, S]), v(() => (k.setClippingSource(A), () => {
|
|
5618
|
+
k.setClippingSource(null);
|
|
5619
|
+
}), [k, A]), v(() => (t.current = y, () => {
|
|
5620
|
+
t.current === y && (t.current = null);
|
|
5621
|
+
}), [y, t]), v(() => {
|
|
5622
|
+
if (!s.current) return;
|
|
5584
5623
|
let t = null, n = !1, r = (e) => {
|
|
5585
5624
|
t = requestAnimationFrame(e);
|
|
5586
5625
|
}, i = () => {
|
|
5587
5626
|
if (e) {
|
|
5588
|
-
if (!
|
|
5589
|
-
|
|
5627
|
+
if (!g) {
|
|
5628
|
+
ue();
|
|
5590
5629
|
return;
|
|
5591
5630
|
}
|
|
5592
5631
|
r(() => {
|
|
5593
|
-
n || !
|
|
5594
|
-
n || !
|
|
5632
|
+
n || !s.current || (s.current.updateMatrixWorld(!0), r(() => {
|
|
5633
|
+
n || !s.current || (s.current.updateMatrixWorld(!0), ue());
|
|
5595
5634
|
}));
|
|
5596
5635
|
});
|
|
5597
5636
|
}
|
|
5598
5637
|
}, a = (e) => {
|
|
5599
|
-
if (
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5638
|
+
if (n || !s.current) return;
|
|
5639
|
+
s.current.updateMatrixWorld(!0), (y instanceof ce || y instanceof se) && Xs(y, s.current), oe(), P();
|
|
5640
|
+
let r = N();
|
|
5641
|
+
if (!r.records.size && e > 0) {
|
|
5642
|
+
t = requestAnimationFrame(() => a(e - 1));
|
|
5643
|
+
return;
|
|
5605
5644
|
}
|
|
5645
|
+
te(), A.syncWithModel(), j.syncWithModel(), de(r.records.size > 0) && i();
|
|
5606
5646
|
};
|
|
5607
5647
|
return r(() => a(As)), () => {
|
|
5608
5648
|
n = !0, t !== null && cancelAnimationFrame(t);
|
|
5609
5649
|
};
|
|
5610
5650
|
}, [
|
|
5611
|
-
|
|
5651
|
+
te,
|
|
5612
5652
|
e,
|
|
5653
|
+
N,
|
|
5654
|
+
y,
|
|
5613
5655
|
A,
|
|
5614
|
-
h,
|
|
5615
|
-
D,
|
|
5616
5656
|
r,
|
|
5617
|
-
O,
|
|
5618
|
-
H,
|
|
5619
|
-
i,
|
|
5620
|
-
o,
|
|
5621
|
-
s,
|
|
5622
5657
|
j,
|
|
5658
|
+
ue,
|
|
5659
|
+
a,
|
|
5660
|
+
s,
|
|
5661
|
+
c,
|
|
5662
|
+
P,
|
|
5663
|
+
de,
|
|
5623
5664
|
oe,
|
|
5624
|
-
|
|
5665
|
+
g
|
|
5625
5666
|
]), v(() => {
|
|
5626
5667
|
let e = () => {
|
|
5627
|
-
|
|
5668
|
+
A.getActive() && A.syncWithModel();
|
|
5628
5669
|
}, t = (t) => {
|
|
5629
5670
|
t(), e();
|
|
5630
5671
|
};
|
|
5631
|
-
return
|
|
5672
|
+
return m({
|
|
5632
5673
|
camera: {
|
|
5633
|
-
fitCamera:
|
|
5634
|
-
getIntersection:
|
|
5674
|
+
fitCamera: ue,
|
|
5675
|
+
getIntersection: k.getIntersection
|
|
5635
5676
|
},
|
|
5636
5677
|
clipping: {
|
|
5637
|
-
createClippingRectangle:
|
|
5638
|
-
createPlane:
|
|
5639
|
-
deleteAllPlanes:
|
|
5640
|
-
getActive:
|
|
5641
|
-
getCapsActive:
|
|
5642
|
-
getEdgesActive:
|
|
5643
|
-
getHelpersActive:
|
|
5644
|
-
getPlanes:
|
|
5645
|
-
setActive:
|
|
5646
|
-
setCapsActive:
|
|
5647
|
-
setEdgesActive:
|
|
5648
|
-
setHelpersActive:
|
|
5649
|
-
toggle:
|
|
5650
|
-
updateEdges:
|
|
5651
|
-
updateMaterials:
|
|
5678
|
+
createClippingRectangle: A.createClippingRectangle,
|
|
5679
|
+
createPlane: A.createPlane,
|
|
5680
|
+
deleteAllPlanes: A.deleteAllPlanes,
|
|
5681
|
+
getActive: A.getActive,
|
|
5682
|
+
getCapsActive: A.getCapsActive,
|
|
5683
|
+
getEdgesActive: A.getEdgesActive,
|
|
5684
|
+
getHelpersActive: A.getHelpersActive,
|
|
5685
|
+
getPlanes: A.getPlanes,
|
|
5686
|
+
setActive: A.setActive,
|
|
5687
|
+
setCapsActive: A.setCapsActive,
|
|
5688
|
+
setEdgesActive: A.setEdgesActive,
|
|
5689
|
+
setHelpersActive: A.setHelpersActive,
|
|
5690
|
+
toggle: A.toggle,
|
|
5691
|
+
updateEdges: A.updateEdges,
|
|
5692
|
+
updateMaterials: A.updateMaterials
|
|
5652
5693
|
},
|
|
5653
5694
|
colors: {
|
|
5654
|
-
clearAllColors:
|
|
5655
|
-
clearColor:
|
|
5656
|
-
clearModelColors:
|
|
5657
|
-
rebuildByColors:
|
|
5658
|
-
rebuildModelByColors:
|
|
5659
|
-
setColor:
|
|
5695
|
+
clearAllColors: O.clearAllColors,
|
|
5696
|
+
clearColor: O.clearColor,
|
|
5697
|
+
clearModelColors: O.clearModelColors,
|
|
5698
|
+
rebuildByColors: O.rebuildByColors,
|
|
5699
|
+
rebuildModelByColors: O.rebuildModelByColors,
|
|
5700
|
+
setColor: O.setColor
|
|
5660
5701
|
},
|
|
5661
|
-
converter:
|
|
5702
|
+
converter: pe,
|
|
5662
5703
|
dimensions: {
|
|
5663
|
-
cancelDrawing:
|
|
5664
|
-
changeAxes:
|
|
5665
|
-
delete:
|
|
5666
|
-
deleteAll:
|
|
5667
|
-
getActive:
|
|
5668
|
-
getDimensions:
|
|
5669
|
-
getSnapDistance:
|
|
5670
|
-
getUnit:
|
|
5671
|
-
setActive:
|
|
5672
|
-
setColor:
|
|
5673
|
-
setEndpointScaleFactor:
|
|
5674
|
-
setSnapDistance:
|
|
5675
|
-
setUnit:
|
|
5676
|
-
setWidth:
|
|
5677
|
-
toggle:
|
|
5704
|
+
cancelDrawing: j.cancelDrawing,
|
|
5705
|
+
changeAxes: j.changeAxes,
|
|
5706
|
+
delete: j.delete,
|
|
5707
|
+
deleteAll: j.deleteAll,
|
|
5708
|
+
getActive: j.getActive,
|
|
5709
|
+
getDimensions: j.getDimensions,
|
|
5710
|
+
getSnapDistance: j.getSnapDistance,
|
|
5711
|
+
getUnit: j.getUnit,
|
|
5712
|
+
setActive: j.setActive,
|
|
5713
|
+
setColor: j.setColor,
|
|
5714
|
+
setEndpointScaleFactor: j.setEndpointScaleFactor,
|
|
5715
|
+
setSnapDistance: j.setSnapDistance,
|
|
5716
|
+
setUnit: j.setUnit,
|
|
5717
|
+
setWidth: j.setWidth,
|
|
5718
|
+
toggle: j.toggle
|
|
5678
5719
|
},
|
|
5679
5720
|
geometryUtils: {
|
|
5680
|
-
getAllIds:
|
|
5681
|
-
getIfcSpacesVisibility:
|
|
5682
|
-
getModelGeometry: (e) =>
|
|
5683
|
-
getModelsGeometry: () =>
|
|
5684
|
-
hideByIds: (e) => t(() =>
|
|
5685
|
-
hideSelected: () => t(
|
|
5686
|
-
isolateByIds: (e) => t(() =>
|
|
5687
|
-
isolateSelected: () => t(
|
|
5688
|
-
resetIsolation: () => t(
|
|
5689
|
-
setIfcSpacesVisibility: (e) => t(() =>
|
|
5690
|
-
showAll: () => t(
|
|
5691
|
-
showByIds: (e) => t(() =>
|
|
5692
|
-
toggleIIfcSpacesVisibility: () => t(
|
|
5721
|
+
getAllIds: w.getAllIds,
|
|
5722
|
+
getIfcSpacesVisibility: w.getIfcSpacesVisibility,
|
|
5723
|
+
getModelGeometry: (e) => Ys(s.current, e),
|
|
5724
|
+
getModelsGeometry: () => Js(s.current),
|
|
5725
|
+
hideByIds: (e) => t(() => w.hideByIds(e)),
|
|
5726
|
+
hideSelected: () => t(w.hideSelected),
|
|
5727
|
+
isolateByIds: (e) => t(() => w.isolateByIds(e)),
|
|
5728
|
+
isolateSelected: () => t(w.isolateSelected),
|
|
5729
|
+
resetIsolation: () => t(w.resetIsolation),
|
|
5730
|
+
setIfcSpacesVisibility: (e) => t(() => w.setIfcSpacesVisibility(e)),
|
|
5731
|
+
showAll: () => t(w.showAll),
|
|
5732
|
+
showByIds: (e) => t(() => w.showByIds(e)),
|
|
5733
|
+
toggleIIfcSpacesVisibility: () => t(w.toggleIIfcSpacesVisibility)
|
|
5693
5734
|
},
|
|
5694
|
-
selector: { setTargetToSelection:
|
|
5695
|
-
}), ne.current || (ne.current = !0,
|
|
5735
|
+
selector: { setTargetToSelection: fe }
|
|
5736
|
+
}), ne.current || (ne.current = !0, u?.(p)), () => m(null);
|
|
5696
5737
|
}, [
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
C,
|
|
5700
|
-
r,
|
|
5701
|
-
ce,
|
|
5738
|
+
A,
|
|
5739
|
+
k,
|
|
5702
5740
|
O,
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5741
|
+
r,
|
|
5742
|
+
pe,
|
|
5743
|
+
j,
|
|
5744
|
+
ue,
|
|
5745
|
+
w,
|
|
5746
|
+
a,
|
|
5747
|
+
s,
|
|
5708
5748
|
u,
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5749
|
+
p,
|
|
5750
|
+
m,
|
|
5751
|
+
fe
|
|
5752
|
+
]), /* @__PURE__ */ J(Ce, { children: [
|
|
5753
|
+
U && /* @__PURE__ */ J(Ce, { children: [/* @__PURE__ */ q("ambientLight", {
|
|
5713
5754
|
intensity: Ps,
|
|
5714
5755
|
color: "#ffffff"
|
|
5715
|
-
}), /* @__PURE__ */
|
|
5716
|
-
ref:
|
|
5756
|
+
}), /* @__PURE__ */ q("directionalLight", {
|
|
5757
|
+
ref: a,
|
|
5717
5758
|
position: [
|
|
5718
5759
|
10,
|
|
5719
5760
|
10,
|
|
@@ -5722,19 +5763,19 @@ function $s({ autoFitCamera: e, cameraRef: t, controlRef: r, lightRef: i, materi
|
|
|
5722
5763
|
color: "#ffffff",
|
|
5723
5764
|
intensity: Fs
|
|
5724
5765
|
})] }),
|
|
5725
|
-
|
|
5726
|
-
/* @__PURE__ */
|
|
5766
|
+
V && /* @__PURE__ */ q(ee, {}),
|
|
5767
|
+
/* @__PURE__ */ q("group", {
|
|
5727
5768
|
ref: re,
|
|
5728
|
-
children:
|
|
5729
|
-
colorPaletteTexture:
|
|
5730
|
-
coordinationMatrix:
|
|
5769
|
+
children: H.map(([e, t]) => /* @__PURE__ */ q(ot, {
|
|
5770
|
+
colorPaletteTexture: D,
|
|
5771
|
+
coordinationMatrix: ae,
|
|
5731
5772
|
data: t,
|
|
5732
|
-
materialMode:
|
|
5773
|
+
materialMode: o,
|
|
5733
5774
|
modelID: e,
|
|
5734
|
-
useWebGPU:
|
|
5775
|
+
useWebGPU: g
|
|
5735
5776
|
}, e))
|
|
5736
5777
|
}),
|
|
5737
|
-
/* @__PURE__ */
|
|
5778
|
+
/* @__PURE__ */ q(E, {
|
|
5738
5779
|
dollyToCursor: !0,
|
|
5739
5780
|
infinityDolly: !0,
|
|
5740
5781
|
minDistance: Cs,
|
|
@@ -5744,88 +5785,90 @@ function $s({ autoFitCamera: e, cameraRef: t, controlRef: r, lightRef: i, materi
|
|
|
5744
5785
|
})
|
|
5745
5786
|
] });
|
|
5746
5787
|
}
|
|
5747
|
-
function
|
|
5788
|
+
function tc({ autoFitCamera: e = !0, camera: t = {
|
|
5748
5789
|
position: [
|
|
5749
5790
|
10,
|
|
5750
5791
|
10,
|
|
5751
5792
|
10
|
|
5752
5793
|
],
|
|
5753
5794
|
fov: 50
|
|
5754
|
-
}, dpr: n = window.devicePixelRatio,
|
|
5755
|
-
let
|
|
5795
|
+
}, dpr: n = window.devicePixelRatio, fitToView: i, modelUrls: a, modelSources: o, modelsLoading: s = !1, modelsData: c, materialMode: l, onReady: u, performanceMode: f = !1, publicApi: p, setSceneApi: m, showNavCube: h, showStats: g, usePerformanceMoving: _ = !1, useWebGPU: y = !1 }) {
|
|
5796
|
+
let w = x(null), T = x(null), E = x(null), ee = x(null), [D, O] = S(), k = r(), A = d((e) => e.setModelNames), j = d((e) => e.setModelProps), M = d((e) => e.setModelStructure), N = d((e) => e.setShowNavCube), P = d((e) => e.setShowStats), te = d((e) => e.setUserDevice), F = d((e) => e.showNavCube), I = c ?? D, L = f ? Hs(n, 1) : n, R = Hs(L, f ? Ds : Es), z = l ?? (f ? "performance" : void 0), [B, ne] = S("sleep"), V = Us(L), re = b(() => y ? Bs({ performanceMode: f }) : f ? Ss : void 0, [f, y]), ie = f ? xs : bs;
|
|
5756
5797
|
return v(() => {
|
|
5757
|
-
|
|
5758
|
-
}, [
|
|
5759
|
-
|
|
5760
|
-
}, [
|
|
5761
|
-
|
|
5762
|
-
}, [
|
|
5798
|
+
te(Ws());
|
|
5799
|
+
}, [te]), v(() => {
|
|
5800
|
+
P(!!g);
|
|
5801
|
+
}, [P, g]), v(() => {
|
|
5802
|
+
h !== void 0 && N(h);
|
|
5803
|
+
}, [N, h]), v(() => {
|
|
5763
5804
|
let e = {}, t = {}, n = {};
|
|
5764
|
-
|
|
5805
|
+
I && Object.entries(I).forEach(([r, i]) => {
|
|
5765
5806
|
let a = Number(r);
|
|
5766
5807
|
i.name !== void 0 && (e[a] = i.name), i.props !== void 0 && (t[a] = i.props), i.structure !== void 0 && (n[a] = i.structure);
|
|
5767
|
-
}),
|
|
5808
|
+
}), A(e), j(t), M(n);
|
|
5768
5809
|
}, [
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
|
|
5810
|
+
I,
|
|
5811
|
+
A,
|
|
5812
|
+
j,
|
|
5813
|
+
M
|
|
5773
5814
|
]), v(() => {
|
|
5774
|
-
if (
|
|
5775
|
-
let e =
|
|
5815
|
+
if (c) return;
|
|
5816
|
+
let e = o ?? a;
|
|
5776
5817
|
if (!e?.length) return;
|
|
5777
5818
|
let t = !0;
|
|
5778
5819
|
return Ro.loadModel(e).then((e) => {
|
|
5779
|
-
t &&
|
|
5820
|
+
t && O(e);
|
|
5780
5821
|
}), () => {
|
|
5781
5822
|
t = !1;
|
|
5782
5823
|
};
|
|
5783
5824
|
}, [
|
|
5825
|
+
c,
|
|
5784
5826
|
o,
|
|
5785
|
-
a
|
|
5786
|
-
|
|
5787
|
-
]), P ? /* @__PURE__ */ K("div", {
|
|
5827
|
+
a
|
|
5828
|
+
]), I ? /* @__PURE__ */ J("div", {
|
|
5788
5829
|
style: vs,
|
|
5789
|
-
children: [/* @__PURE__ */
|
|
5830
|
+
children: [/* @__PURE__ */ q(C, {
|
|
5790
5831
|
camera: t,
|
|
5791
|
-
dpr:
|
|
5792
|
-
gl:
|
|
5793
|
-
children: /* @__PURE__ */
|
|
5794
|
-
store:
|
|
5795
|
-
children: /* @__PURE__ */
|
|
5832
|
+
dpr: _ && B === "move" ? R : L,
|
|
5833
|
+
gl: re,
|
|
5834
|
+
children: /* @__PURE__ */ q(ni, {
|
|
5835
|
+
store: k,
|
|
5836
|
+
children: /* @__PURE__ */ q(ec, {
|
|
5796
5837
|
autoFitCamera: e,
|
|
5797
|
-
cameraRef:
|
|
5798
|
-
controlRef:
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5838
|
+
cameraRef: w,
|
|
5839
|
+
controlRef: T,
|
|
5840
|
+
fitToView: i ?? e,
|
|
5841
|
+
lightRef: ee,
|
|
5842
|
+
materialMode: z,
|
|
5843
|
+
modelRef: E,
|
|
5844
|
+
modelsData: I,
|
|
5845
|
+
modelsLoading: s,
|
|
5846
|
+
onReady: u,
|
|
5847
|
+
onCameraDprModeChange: ne,
|
|
5848
|
+
publicApi: p,
|
|
5849
|
+
setSceneApi: m,
|
|
5850
|
+
usePerformanceMoving: _,
|
|
5851
|
+
useWebGPU: y
|
|
5809
5852
|
})
|
|
5810
5853
|
})
|
|
5811
|
-
},
|
|
5854
|
+
}, y ? "viewer-webgpu" : "viewer-webgl"), F && /* @__PURE__ */ q("div", {
|
|
5812
5855
|
style: _s,
|
|
5813
|
-
children: /* @__PURE__ */
|
|
5856
|
+
children: /* @__PURE__ */ q(C, {
|
|
5814
5857
|
camera: ys,
|
|
5815
|
-
dpr:
|
|
5816
|
-
gl:
|
|
5858
|
+
dpr: V,
|
|
5859
|
+
gl: ie,
|
|
5817
5860
|
orthographic: !0,
|
|
5818
|
-
children: /* @__PURE__ */
|
|
5861
|
+
children: /* @__PURE__ */ q(hs, {
|
|
5819
5862
|
active: !0,
|
|
5820
|
-
cameraRef:
|
|
5821
|
-
controlRef:
|
|
5822
|
-
modelRef:
|
|
5863
|
+
cameraRef: w,
|
|
5864
|
+
controlRef: T,
|
|
5865
|
+
modelRef: E
|
|
5823
5866
|
})
|
|
5824
5867
|
}, "nav-cube-webgl")
|
|
5825
5868
|
})]
|
|
5826
|
-
}) : /* @__PURE__ */
|
|
5869
|
+
}) : /* @__PURE__ */ q(Ce, {});
|
|
5827
5870
|
}
|
|
5828
|
-
var
|
|
5871
|
+
var nc = m(function(e, t) {
|
|
5829
5872
|
let [n] = S(o), r = x(!1), i = x(!1), a = b(() => new gs(), []), { defaultSelected: s, onSelectedChange: c, selected: l } = e, u = _((e) => {
|
|
5830
5873
|
a.set(e);
|
|
5831
5874
|
}, [a]), d = b(() => Wa(n, a.get), [a, n]);
|
|
@@ -5843,15 +5886,15 @@ var tc = m(function(e, t) {
|
|
|
5843
5886
|
if (c) return n.subscribe((e, t) => {
|
|
5844
5887
|
e.selected !== t.selected && (i.current || c(Ha(e.selected)));
|
|
5845
5888
|
});
|
|
5846
|
-
}, [c, n]), /* @__PURE__ */
|
|
5889
|
+
}, [c, n]), /* @__PURE__ */ q(ni, {
|
|
5847
5890
|
store: n,
|
|
5848
|
-
children: /* @__PURE__ */
|
|
5891
|
+
children: /* @__PURE__ */ q(tc, {
|
|
5849
5892
|
...e,
|
|
5850
5893
|
publicApi: d,
|
|
5851
5894
|
setSceneApi: u
|
|
5852
5895
|
})
|
|
5853
5896
|
});
|
|
5854
5897
|
});
|
|
5855
|
-
|
|
5898
|
+
nc.displayName = "Viewer";
|
|
5856
5899
|
//#endregion
|
|
5857
|
-
export { Ka as BMTLoader, Ea as BmtConverter, Oa as ConvertIfcFileToBmt, ka as ConvertToBmt, Jn as DimensionLine, tr as DimensionsUtils, Va as FilteredElementsCollector,
|
|
5900
|
+
export { Ka as BMTLoader, Ea as BmtConverter, Oa as ConvertIfcFileToBmt, ka as ConvertToBmt, Jn as DimensionLine, tr as DimensionsUtils, Va as FilteredElementsCollector, $e as ModelGrids, hs as NavigationCube, nc as Viewer, ni as ViewerStoreProvider, Da as bmtConverter, vo as convertIfcFilesToBmtInWorker, yo as createBmtConverterWorker, no as createBmtWorker, jo as createIfcWorker, o as createViewerStore, Gi as exportExcel, Hi as exportModelPropertiesToExcel, to as loadBmtModelsInWorker, Ao as loadIfcModelsInWorker, Ro as loader, nr as useDimensionsUtils, d as useViewerStore, r as useViewerStoreApi };
|