bimatter-viewer-react 0.6.6 → 0.6.7
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/Camera/useCameraUtils.d.ts +1 -0
- package/lib/Model.d.ts +2 -1
- package/lib/SelectableMesh.d.ts +1 -2
- package/lib/Viewer.d.ts +1 -0
- package/lib/WebGpuSelectableMesh-CLA7yFhR.js +107 -0
- package/lib/WebGpuSelectableMesh.d.ts +3 -0
- package/lib/index.js +1608 -1732
- package/lib/three.tsl-BarIGkA_.js +293 -0
- package/lib/three.webgpu-vPugBGTK.js +24748 -0
- package/lib/utils/ClippingUtils/ClippingCaps.d.ts +2 -0
- package/lib/utils/ClippingUtils/ClippingUtils.d.ts +3 -1
- package/lib/utils/GeometryUtils/useGeometryIndex.d.ts +2 -1
- package/package.json +1 -1
- /package/lib/{IFCLoader-Cjkb3xMA.js → IFCLoader-BDuxDvU1.js} +0 -0
|
@@ -8,6 +8,7 @@ export type CameraClippingSource = {
|
|
|
8
8
|
export type CameraIntersectionOptions = {
|
|
9
9
|
event?: MouseEvent | PointerEvent;
|
|
10
10
|
filter?: (intersection: Intersection<Object3D>) => boolean;
|
|
11
|
+
firstHitOnly?: boolean;
|
|
11
12
|
object?: Object3D | Object3D[] | null;
|
|
12
13
|
recursive?: boolean;
|
|
13
14
|
respectClipping?: boolean;
|
package/lib/Model.d.ts
CHANGED
|
@@ -7,10 +7,11 @@ type ModelProps = {
|
|
|
7
7
|
modelID: number;
|
|
8
8
|
data: BmtModelData;
|
|
9
9
|
materialMode?: ViewerMaterialMode;
|
|
10
|
+
useWebGPU?: boolean;
|
|
10
11
|
};
|
|
11
12
|
export declare function parseModelMatrix(matrix?: string): Matrix4 | null;
|
|
12
13
|
export declare function getModelCoordinationMatrix(data: BmtModelData): Matrix4 | null;
|
|
13
14
|
export declare function getModelCoordinationMatrixSource(data: BmtModelData): string | undefined;
|
|
14
|
-
declare function Model({ colorPaletteTexture, coordinationMatrix, modelID, data, materialMode: materialModeOverride, }: ModelProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
declare function Model({ colorPaletteTexture, coordinationMatrix, modelID, data, materialMode: materialModeOverride, useWebGPU, }: ModelProps): import("react/jsx-runtime").JSX.Element;
|
|
15
16
|
declare const _default: import("react").MemoExoticComponent<typeof Model>;
|
|
16
17
|
export default _default;
|
package/lib/SelectableMesh.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { Matrix4, type DataTexture } from "three";
|
|
3
3
|
import type { BmtGeomData, BmtMaterialData } from "./Loaders/BmtLoader";
|
|
4
4
|
import type { ViewerMaterialMode } from "./types";
|
|
5
|
-
type SelectableMeshProps = {
|
|
5
|
+
export type SelectableMeshProps = {
|
|
6
6
|
colorPaletteTexture: DataTexture;
|
|
7
7
|
data: BmtGeomData;
|
|
8
8
|
isIfcSpace?: boolean;
|
|
@@ -12,4 +12,3 @@ type SelectableMeshProps = {
|
|
|
12
12
|
useDoubleSideMaterial?: boolean;
|
|
13
13
|
};
|
|
14
14
|
export declare const SelectableMesh: React.MemoExoticComponent<({ colorPaletteTexture, material, materialMode, data, isIfcSpace, meshMatrix, useDoubleSideMaterial, }: SelectableMeshProps) => import("react/jsx-runtime").JSX.Element>;
|
|
15
|
-
export {};
|
package/lib/Viewer.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export type ViewerProps = {
|
|
|
22
22
|
showNavCube?: boolean;
|
|
23
23
|
showStats?: boolean;
|
|
24
24
|
usePerformanceMoving?: boolean;
|
|
25
|
+
useWebGPU?: boolean;
|
|
25
26
|
};
|
|
26
27
|
declare const Viewer: import("react").ForwardRefExoticComponent<ViewerProps & import("react").RefAttributes<ViewerApi>>;
|
|
27
28
|
export default Viewer;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { n as e, t } from "./three.webgpu-vPugBGTK.js";
|
|
2
|
+
import { a as n, i as r, n as i, r as a, s as o, t as s, u as c } from "./three.tsl-BarIGkA_.js";
|
|
3
|
+
import l, { useEffect as u, useMemo as d, useRef as f } from "react";
|
|
4
|
+
import { Color as p, DoubleSide as m } from "three";
|
|
5
|
+
import { MeshBVH as h } from "three-mesh-bvh";
|
|
6
|
+
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
7
|
+
//#region src/viewer/WebGpuSelectableMesh.tsx
|
|
8
|
+
var v = 1 / 1.5;
|
|
9
|
+
function y({ colorPaletteTexture: c, material: l, materialMode: u, preselectionColor: d, selectionColor: f, useDoubleSideMaterial: h }) {
|
|
10
|
+
let g = new p(l.r, l.g, l.b);
|
|
11
|
+
u === "performance" && g.multiplyScalar(v);
|
|
12
|
+
let _ = l.opacity ?? 1, y = {
|
|
13
|
+
color: g.clone(),
|
|
14
|
+
opacity: _,
|
|
15
|
+
transparent: !!(_ && _ !== 1)
|
|
16
|
+
}, b = h ? {
|
|
17
|
+
...y,
|
|
18
|
+
side: m
|
|
19
|
+
} : y, x = u === "performance" ? new t(b) : new e(b);
|
|
20
|
+
x.defaultAttributeValues = {
|
|
21
|
+
...x.defaultAttributeValues,
|
|
22
|
+
colorIndex: [0],
|
|
23
|
+
ids: [0]
|
|
24
|
+
};
|
|
25
|
+
let S = a(i("colorIndex", "uint")), C = a(i("ids", "uint")), w = n(-1), T = n(new p(d)), E = n(new p(f)), D = n(g.clone()), O = n(_), k = r(c, o(S.add(.5).div(256), .5)).rgb, A = S.greaterThan(.5), j = s(S.sub(1)), M = j.lessThan(.5), N = j.greaterThan(.5), P = C.equal(w).and(N);
|
|
26
|
+
return x.colorNode = P.select(T, M.select(E, A.select(k, D))), x.opacityNode = P.select(a(1), M.select(a(1), A.select(a(1), O))), x.userData.shader = { uniforms: {
|
|
27
|
+
elementColorPalette: { value: c },
|
|
28
|
+
preSelectionColor: T,
|
|
29
|
+
preSelectionId: w,
|
|
30
|
+
selectionColor: E
|
|
31
|
+
} }, x;
|
|
32
|
+
}
|
|
33
|
+
var b = l.memo(function({ colorPaletteTexture: e, material: t, materialMode: n = "quality", data: r, isIfcSpace: i = !1, meshMatrix: a, useDoubleSideMaterial: o = !1 }) {
|
|
34
|
+
let s = f(null), l = d(() => new Uint32Array(r.ids.length), [r.ids]), m = c((e) => e.preselectionColor), v = c((e) => e.selectionColor), b = f(m);
|
|
35
|
+
b.current = m;
|
|
36
|
+
let x = f(v);
|
|
37
|
+
x.current = v;
|
|
38
|
+
let S = d(() => y({
|
|
39
|
+
colorPaletteTexture: e,
|
|
40
|
+
material: t,
|
|
41
|
+
materialMode: n,
|
|
42
|
+
preselectionColor: b.current,
|
|
43
|
+
selectionColor: x.current,
|
|
44
|
+
useDoubleSideMaterial: o
|
|
45
|
+
}), [
|
|
46
|
+
e,
|
|
47
|
+
t,
|
|
48
|
+
n,
|
|
49
|
+
o
|
|
50
|
+
]);
|
|
51
|
+
return u(() => {
|
|
52
|
+
let e = S.userData.shader, t = (t, n) => {
|
|
53
|
+
let r = e?.uniforms?.[t];
|
|
54
|
+
r && (r.value instanceof p ? r.value.set(n) : r.value = new p(n));
|
|
55
|
+
};
|
|
56
|
+
t("preSelectionColor", m), t("selectionColor", v);
|
|
57
|
+
}, [
|
|
58
|
+
S,
|
|
59
|
+
m,
|
|
60
|
+
v
|
|
61
|
+
]), u(() => {
|
|
62
|
+
if (!s.current) return;
|
|
63
|
+
let e = s.current.geometry, t = new h(e, { indirect: !0 });
|
|
64
|
+
return Object.assign(e, { boundsTree: t }), () => {
|
|
65
|
+
S.dispose(), Object.assign(e, { boundsTree: null });
|
|
66
|
+
};
|
|
67
|
+
}, [S]), /* @__PURE__ */ _("mesh", {
|
|
68
|
+
frustumCulled: !0,
|
|
69
|
+
matrix: a,
|
|
70
|
+
matrixAutoUpdate: !1,
|
|
71
|
+
name: i ? "space" : void 0,
|
|
72
|
+
ref: s,
|
|
73
|
+
userData: {
|
|
74
|
+
isIfcSpace: i,
|
|
75
|
+
keepColorIndexAttribute: !0,
|
|
76
|
+
useUint32ColorIndex: !0
|
|
77
|
+
},
|
|
78
|
+
onPointerLeave: (e) => {
|
|
79
|
+
let t = e.object;
|
|
80
|
+
t.preselected &&= !1;
|
|
81
|
+
},
|
|
82
|
+
children: [/* @__PURE__ */ _("bufferGeometry", { children: [
|
|
83
|
+
/* @__PURE__ */ g("bufferAttribute", {
|
|
84
|
+
attach: "attributes-position",
|
|
85
|
+
args: [r.pos, 3]
|
|
86
|
+
}),
|
|
87
|
+
r.norm && /* @__PURE__ */ g("bufferAttribute", {
|
|
88
|
+
attach: "attributes-normal",
|
|
89
|
+
args: [r.norm, 3]
|
|
90
|
+
}),
|
|
91
|
+
/* @__PURE__ */ g("bufferAttribute", {
|
|
92
|
+
attach: "attributes-ids",
|
|
93
|
+
args: [r.ids, 1]
|
|
94
|
+
}),
|
|
95
|
+
/* @__PURE__ */ g("bufferAttribute", {
|
|
96
|
+
attach: "attributes-colorIndex",
|
|
97
|
+
args: [l, 1]
|
|
98
|
+
}),
|
|
99
|
+
/* @__PURE__ */ g("bufferAttribute", {
|
|
100
|
+
attach: "index",
|
|
101
|
+
args: [r.ind, 1]
|
|
102
|
+
})
|
|
103
|
+
] }), /* @__PURE__ */ g("primitive", { object: S })]
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
//#endregion
|
|
107
|
+
export { b as WebGpuSelectableMesh };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { SelectableMeshProps } from "./SelectableMesh";
|
|
3
|
+
export declare const WebGpuSelectableMesh: React.MemoExoticComponent<({ colorPaletteTexture, material, materialMode, data, isIfcSpace, meshMatrix, useDoubleSideMaterial, }: SelectableMeshProps) => import("react/jsx-runtime").JSX.Element>;
|