bimatter-viewer-react 0.8.0 → 0.8.2
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/GTAONode-B9L8H-RN.js +104 -0
- package/lib/api/ViewerApi.d.ts +14 -1
- package/lib/api/ViewerPlansApi.d.ts +24 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +22299 -2182
- package/lib/store/ViewerStore.d.ts +5 -0
- package/lib/three.tsl-Ck6_SEjz.js +5 -0
- package/lib/three.tsl-wAjT0cCG.js +2 -0
- package/lib/{three.webgpu-7Fqpf016.js → three.webgpu-BEgrFZ10.js} +5111 -5740
- package/lib/three.webgpu-_3HLr1Wm.js +2 -0
- package/lib/utils/Hotkeys/useHotkeysUtils.d.ts +1 -1
- package/package.json +1 -1
- package/lib/GTAONode-qFlUqZrx.js +0 -104
- package/lib/rolldown-runtime-CAFD8bLK.js +0 -11
- package/lib/three.tsl-Dfou2CS1.js +0 -638
- /package/lib/{IFCLoader-DTb3WbP_.js → IFCLoader-BNUvkKpp.js} +0 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { Gt as e, Mn as t, Rl as n, Ul as r, Vl as i, ar as a, dd as o, pa as s, ud as c, xn as l } from "./three.webgpu-BEgrFZ10.js";
|
|
2
|
+
import { $r as u, El as d, Fl as f, Gr as p, H as m, In as h, Jr as g, K as _, Ka as v, O as y, Or as b, Qi as x, Qu as S, Sc as C, Vn as w, Vu as T, W as E, Ys as D, Za as O, _ as k, ad as A, bn as j, bs as M, bu as N, fu as P, g as F, hd as I, hl as L, id as R, mr as z, od as B, p as V, po as H, pr as U, ss as W, ta as G, uc as K, vi as q, x as J } from "./three.tsl-Ck6_SEjz.js";
|
|
3
|
+
//#region node_modules/three/examples/jsm/tsl/display/GTAONode.js
|
|
4
|
+
var Y = /* @__PURE__ */ new l(), X = /* @__PURE__ */ new c(), Z = [
|
|
5
|
+
60,
|
|
6
|
+
300,
|
|
7
|
+
180,
|
|
8
|
+
240,
|
|
9
|
+
120,
|
|
10
|
+
0
|
|
11
|
+
], Q, $ = class extends a {
|
|
12
|
+
static get type() {
|
|
13
|
+
return "GTAONode";
|
|
14
|
+
}
|
|
15
|
+
constructor(t, r, a) {
|
|
16
|
+
super("float"), this.depthNode = t, this.normalNode = r, this.resolutionScale = 1, this.updateBeforeType = J.FRAME, this._aoRenderTarget = new i(1, 1, {
|
|
17
|
+
depthBuffer: !1,
|
|
18
|
+
format: n
|
|
19
|
+
}), this._aoRenderTarget.texture.name = "GTAONode.AO", this.radius = T(.25), this.resolution = T(new c()), this.thickness = T(1), this.distanceExponent = T(1), this.distanceFallOff = T(1), this.scale = T(1), this.samples = T(16), this.useTemporalFiltering = !1, this._noiseNode = P(ee()), this._cameraProjectionMatrix = T(a.projectionMatrix), this._cameraProjectionMatrixInverse = T(a.projectionMatrixInverse), this._cameraNear = C("near", "float", a), this._cameraFar = C("far", "float", a), this._temporalDirection = T(0), this._material = new e(), this._material.name = "GTAO", this._textureNode = D(this, this._aoRenderTarget.texture);
|
|
20
|
+
}
|
|
21
|
+
getTextureNode() {
|
|
22
|
+
return this._textureNode;
|
|
23
|
+
}
|
|
24
|
+
setSize(e, t) {
|
|
25
|
+
e = Math.round(this.resolutionScale * e), t = Math.round(this.resolutionScale * t), this.resolution.value.set(e, t), this._aoRenderTarget.setSize(e, t);
|
|
26
|
+
}
|
|
27
|
+
updateBefore(e) {
|
|
28
|
+
let { renderer: n } = e;
|
|
29
|
+
if (Q = t.resetRendererState(n, Q), this.useTemporalFiltering === !0) {
|
|
30
|
+
let t = e.frameId;
|
|
31
|
+
this._temporalDirection.value = Z[t % 6] / 360;
|
|
32
|
+
} else this._temporalDirection.value = 0;
|
|
33
|
+
let r = n.getDrawingBufferSize(X);
|
|
34
|
+
this.setSize(r.width, r.height), Y.material = this._material, Y.name = "AO", n.setClearColor(16777215, 1), n.setRenderTarget(this._aoRenderTarget), Y.render(n), t.restoreRendererState(n, Q);
|
|
35
|
+
}
|
|
36
|
+
setup(e) {
|
|
37
|
+
let t = S(), n = (t) => {
|
|
38
|
+
let n = this.depthNode.sample(t).r;
|
|
39
|
+
return e.renderer.logarithmicDepthBuffer === !0 ? I(x(n, this._cameraNear, this._cameraFar), this._cameraNear, this._cameraFar) : n;
|
|
40
|
+
}, r = (e) => this._noiseNode.sample(e), i = (e) => this.normalNode === null ? p(e, this.depthNode.value, this._cameraProjectionMatrixInverse) : this.normalNode.sample(e).rgb.normalize(), a = V(() => {
|
|
41
|
+
let e = n(t).toVar();
|
|
42
|
+
e.greaterThanEqual(1).discard();
|
|
43
|
+
let a = u(t, e, this._cameraProjectionMatrixInverse).toVar(), o = i(t).toVar(), s = this.radius, c = N(this._noiseNode, 0), l = R(t.x, t.y.oneMinus());
|
|
44
|
+
l = l.mul(this.resolution.div(c));
|
|
45
|
+
let p = r(l), x = A(p.xyz.mul(2).sub(1).xy, 0).normalize(), S = G(x, A(x.y.mul(-1), x.x, 0), A(0, 0, 1)), C = this.samples.lessThan(30).select(3, 5).toVar(), T = _(this.samples, C.sub(1)).div(C).toVar(), D = b(0).toVar();
|
|
46
|
+
return k({
|
|
47
|
+
start: q(0),
|
|
48
|
+
end: C,
|
|
49
|
+
type: "int",
|
|
50
|
+
condition: "<"
|
|
51
|
+
}, ({ i: e }) => {
|
|
52
|
+
let t = b(e).div(b(C)).mul(y).add(this._temporalDirection).toVar(), r = B(h(t), L(t), 0, _(.5, H(.5, p.w)));
|
|
53
|
+
r.xyz = M(S.mul(r.xyz));
|
|
54
|
+
let i = M(a.xyz.negate()).toVar(), c = M(w(r.xyz, i)).toVar(), l = w(c, i), x = M(o.sub(c.mul(z(o, c)))), A = w(x, c).toVar(), j = R(z(i, A), z(i, A.negate())).toVar();
|
|
55
|
+
k({
|
|
56
|
+
end: T,
|
|
57
|
+
type: "int",
|
|
58
|
+
name: "j",
|
|
59
|
+
condition: "<"
|
|
60
|
+
}, ({ j: e }) => {
|
|
61
|
+
let t = r.xyz.mul(s).mul(r.w).mul(K(U(b(e).add(1), b(T)), this.distanceExponent)), o = g(a.add(t), this._cameraProjectionMatrix).toVar(), c = u(o, n(o).toVar(), this._cameraProjectionMatrixInverse).toVar().sub(a).toVar();
|
|
62
|
+
F(m(c.z).lessThan(this.thickness), () => {
|
|
63
|
+
let t = z(i, M(c));
|
|
64
|
+
j.x.addAssign(v(0, H(t.sub(j.x), O(1, b(2).div(b(e).add(2)), this.distanceFallOff))));
|
|
65
|
+
});
|
|
66
|
+
let l = g(a.sub(t), this._cameraProjectionMatrix).toVar(), d = u(l, n(l).toVar(), this._cameraProjectionMatrixInverse).toVar().sub(a).toVar();
|
|
67
|
+
F(m(d.z).lessThan(this.thickness), () => {
|
|
68
|
+
let t = z(i, M(d));
|
|
69
|
+
j.y.addAssign(v(0, H(t.sub(j.y), O(1, b(2).div(b(e).add(2)), this.distanceFallOff))));
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
let N = d(f(1, j.mul(j))).toVar(), P = z(x, l), I = z(x, i), V = H(.5, E(j.y).sub(E(j.x)).add(N.x.mul(j.x).sub(N.y.mul(j.y)))), W = H(.5, f(2, j.x.mul(j.x)).sub(j.y.mul(j.y))), G = P.mul(V).add(I.mul(W));
|
|
73
|
+
D.addAssign(G);
|
|
74
|
+
}), D.assign(j(D.div(C), 0, 1)), D.assign(K(D, this.scale)), D;
|
|
75
|
+
});
|
|
76
|
+
return this._material.fragmentNode = a().context(e.getSharedContext()), this._material.needsUpdate = !0, this._textureNode;
|
|
77
|
+
}
|
|
78
|
+
dispose() {
|
|
79
|
+
this._aoRenderTarget.dispose(), this._material.dispose();
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
function ee(e = 5) {
|
|
83
|
+
let t = Math.floor(e) % 2 == 0 ? Math.floor(e) + 1 : Math.floor(e), n = te(t), i = n.length, a = new Uint8Array(i * 4);
|
|
84
|
+
for (let e = 0; e < i; ++e) {
|
|
85
|
+
let t = n[e], r = 2 * Math.PI * t / i, s = new o(Math.cos(r), Math.sin(r), 0).normalize();
|
|
86
|
+
a[e * 4] = (s.x * .5 + .5) * 255, a[e * 4 + 1] = (s.y * .5 + .5) * 255, a[e * 4 + 2] = 127, a[e * 4 + 3] = 255;
|
|
87
|
+
}
|
|
88
|
+
let c = new s(a, t, t);
|
|
89
|
+
return c.wrapS = r, c.wrapT = r, c.needsUpdate = !0, c;
|
|
90
|
+
}
|
|
91
|
+
function te(e) {
|
|
92
|
+
let t = Math.floor(e) % 2 == 0 ? Math.floor(e) + 1 : Math.floor(e), n = t * t, r = Array(n).fill(0), i = Math.floor(t / 2), a = t - 1;
|
|
93
|
+
for (let e = 1; e <= n;) {
|
|
94
|
+
if (i === -1 && a === t ? (a = t - 2, i = 0) : (a === t && (a = 0), i < 0 && (i = t - 1)), r[i * t + a] !== 0) {
|
|
95
|
+
a -= 2, i++;
|
|
96
|
+
continue;
|
|
97
|
+
} else r[i * t + a] = e++;
|
|
98
|
+
a++, i--;
|
|
99
|
+
}
|
|
100
|
+
return r;
|
|
101
|
+
}
|
|
102
|
+
var ne = (e, t, n) => new $(W(e), W(t), n);
|
|
103
|
+
//#endregion
|
|
104
|
+
export { ne as ao, $ as default };
|
package/lib/api/ViewerApi.d.ts
CHANGED
|
@@ -10,11 +10,13 @@ import type { BmtConversionResult, BmtConverterOptions, BmtConverterSource } fro
|
|
|
10
10
|
import { FilteredElementsCollector } from "../Selector/FilteredElementsCollector";
|
|
11
11
|
import type { ViewerLoadedModels, ViewerLoadModelOptions, ViewerModelSource } from "./loader";
|
|
12
12
|
import type { WorkerProgressEvent } from "../workers";
|
|
13
|
+
import { type ViewerPlansApi, type ViewerPlansContainerFactory, type ViewerPlansSceneApi } from "./ViewerPlansApi";
|
|
13
14
|
export type { ViewerClippingApi, ViewerClippingVector3Input, } from "../utils/ClippingUtils";
|
|
14
15
|
export type { ViewerColorConfigByModel, ViewerModelColorConfig, } from "../utils/ColorsUtils/useElementColors";
|
|
15
16
|
export type { ViewerDimensionsApi } from "../utils/DimentionsUtils";
|
|
16
17
|
export type { ViewerCameraGetIntersection } from "../Camera/useCameraUtils";
|
|
17
18
|
export type { ViewerCameraProjection } from "../types";
|
|
19
|
+
export type { ViewerPlanHandle, ViewerPlansApi, ViewerPlanVector3Input, } from "./ViewerPlansApi";
|
|
18
20
|
export type ViewerSelection = Record<number, number[]>;
|
|
19
21
|
export type ViewerGeometryUtilsApi = {
|
|
20
22
|
getAllIds: () => number[];
|
|
@@ -34,14 +36,17 @@ export type ViewerGeometryUtilsApi = {
|
|
|
34
36
|
export type ViewerSelectorApi = {
|
|
35
37
|
addSelected: (modelID: number, ids: number[], setTarget?: boolean, fitTarget?: boolean) => void;
|
|
36
38
|
collector: () => FilteredElementsCollector;
|
|
39
|
+
getPreselectionEnabled: () => boolean;
|
|
37
40
|
getPreselectionColor: () => ColorRepresentation;
|
|
38
41
|
getSelectionColor: () => ColorRepresentation;
|
|
39
42
|
getSelected: () => ViewerSelection;
|
|
40
43
|
removeSelected: (modelID: number, ids: number[]) => void;
|
|
41
44
|
resetSelection: (modelID?: number) => void;
|
|
42
45
|
setPreselectionColor: (color: ColorRepresentation) => void;
|
|
46
|
+
setPreselectionEnabled: (enabled: boolean) => void;
|
|
43
47
|
setSelectionColor: (color: ColorRepresentation) => void;
|
|
44
48
|
setSelected: (modelID: number, ids: number[], reset?: boolean, setTarget?: boolean, fitTarget?: boolean) => void;
|
|
49
|
+
togglePreselection: () => void;
|
|
45
50
|
};
|
|
46
51
|
export type ViewerSceneSelectorApi = {
|
|
47
52
|
setTargetToSelection: (selection: ViewerSelection, fitTarget?: boolean) => void;
|
|
@@ -57,14 +62,20 @@ export type ViewerColorsApi = {
|
|
|
57
62
|
export type ViewerUtilsApi = {
|
|
58
63
|
getDefaultHotkeysEnabled: () => boolean;
|
|
59
64
|
getGridAxesVisibility: () => ViewerGridAxesVisibility;
|
|
65
|
+
getPreselectionEnabled: () => boolean;
|
|
60
66
|
getShowNavCube: () => boolean;
|
|
61
67
|
getShowGridAxes: () => boolean;
|
|
62
68
|
getShowStats: () => boolean;
|
|
69
|
+
getPerformanceMovingFactor: () => number;
|
|
63
70
|
getUserDevice: () => UserDevice;
|
|
64
71
|
setGridAxesVisibility: (gridAxesVisibility: Partial<ViewerGridAxesVisibility>) => void;
|
|
65
72
|
setDefaultHotkeysEnabled: (enabled: boolean) => void;
|
|
66
73
|
setGridAxisVisibility: (side: ViewerGridAxisSide, visible: boolean) => void;
|
|
74
|
+
setPerformaneMovingFactor: (factor: number) => void;
|
|
75
|
+
setPerformanceMovingFactor: (factor: number) => void;
|
|
76
|
+
setPreselectionEnabled: (enabled: boolean) => void;
|
|
67
77
|
toggleDefaultHotkeys: () => void;
|
|
78
|
+
togglePreselection: () => void;
|
|
68
79
|
setShowNavCube: (showNavCube: boolean) => void;
|
|
69
80
|
setShowGridAxes: (showGridAxes: boolean) => void;
|
|
70
81
|
setShowStats: (showStats: boolean) => void;
|
|
@@ -121,6 +132,7 @@ export type ViewerApi = {
|
|
|
121
132
|
dimensions: ViewerDimensionsApi;
|
|
122
133
|
geometryUtils: ViewerGeometryUtilsApi;
|
|
123
134
|
models: ViewerModelsApi;
|
|
135
|
+
plans: ViewerPlansApi;
|
|
124
136
|
postproduction: ViewerPostproductionApi;
|
|
125
137
|
properties: ViewerPropertiesApi;
|
|
126
138
|
selector: ViewerSelectorApi;
|
|
@@ -133,8 +145,9 @@ export type ViewerSceneApi = {
|
|
|
133
145
|
converter: ViewerConverterApi;
|
|
134
146
|
dimensions: ViewerDimensionsApi;
|
|
135
147
|
geometryUtils: ViewerGeometryUtilsApi;
|
|
148
|
+
plans: ViewerPlansSceneApi;
|
|
136
149
|
selector: ViewerSceneSelectorApi;
|
|
137
150
|
};
|
|
138
151
|
export declare function serializeSelected(selected: SelectedStore): ViewerSelection;
|
|
139
152
|
export declare function createSelectedStore(selection: ViewerSelection): SelectedStore;
|
|
140
|
-
export declare function createPublicViewerApi(viewerStore: ViewerStoreApi, getSceneApi: () => ViewerSceneApi | null, getModelsApi: () => ViewerModelsApi | null): ViewerApi;
|
|
153
|
+
export declare function createPublicViewerApi(viewerStore: ViewerStoreApi, getSceneApi: () => ViewerSceneApi | null, getModelsApi: () => ViewerModelsApi | null, getPlansContainerFactory?: () => ViewerPlansContainerFactory | null): ViewerApi;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Plane, Vector3 } from "three";
|
|
2
|
+
import type { ViewerApi, ViewerSceneApi } from "./ViewerApi";
|
|
3
|
+
export type ViewerPlanVector3Input = Vector3 | [number, number, number] | {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
z: number;
|
|
7
|
+
};
|
|
8
|
+
export type ViewerPlanHandle = {
|
|
9
|
+
container?: HTMLElement;
|
|
10
|
+
dispose: () => void;
|
|
11
|
+
plane: Plane;
|
|
12
|
+
viewer?: ViewerApi | null;
|
|
13
|
+
};
|
|
14
|
+
export type ViewerPlansSceneApi = {
|
|
15
|
+
createPlan: (plane: Plane) => ViewerPlanHandle | null;
|
|
16
|
+
};
|
|
17
|
+
export type ViewerPlansContainerFactory = (plane: Plane, container: HTMLElement) => ViewerPlanHandle | null;
|
|
18
|
+
export type ViewerPlansApi = {
|
|
19
|
+
createPlan: ((plane: Plane, container?: HTMLElement) => ViewerPlanHandle | null) & ((point: ViewerPlanVector3Input, normal: ViewerPlanVector3Input, container?: HTMLElement) => ViewerPlanHandle | null) & ((zCord: number, normal: ViewerPlanVector3Input, container?: HTMLElement) => ViewerPlanHandle | null);
|
|
20
|
+
};
|
|
21
|
+
export declare function createViewerPlanPlane(plane: Plane): Plane;
|
|
22
|
+
export declare function createViewerPlanPlane(point: ViewerPlanVector3Input, normal: ViewerPlanVector3Input): Plane;
|
|
23
|
+
export declare function createViewerPlanPlane(zCord: number, normal: ViewerPlanVector3Input): Plane;
|
|
24
|
+
export declare function createViewerPlansApi(getSceneApi: () => ViewerSceneApi | null, getContainerFactory?: () => ViewerPlansContainerFactory | null): ViewerPlansApi;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { default as Viewer } from "./Viewer";
|
|
2
2
|
export type { ViewerModelsData, ViewerProps } from "./Viewer";
|
|
3
3
|
export type { ViewerCameraProjection, ViewerMaterialMode, ViewerPostproductionPassType, ViewerUploadMode, } from "./types";
|
|
4
|
-
export type { ViewerApi, ViewerCameraApi, ViewerCameraGetIntersection, ViewerClippingApi, ViewerClippingVector3Input, ViewerColorsApi, ViewerBmtConverterOptions, ViewerConverterApi, ViewerDimensionsApi, ViewerGeometryUtilsApi, ViewerLoadModelsOptions, ViewerModelsApi, ViewerPostproductionApi, ViewerSelection, ViewerSelectorApi, ViewerUtilsApi, } from "./api/ViewerApi";
|
|
4
|
+
export type { ViewerApi, ViewerCameraApi, ViewerCameraGetIntersection, ViewerClippingApi, ViewerClippingVector3Input, ViewerColorsApi, ViewerBmtConverterOptions, ViewerConverterApi, ViewerDimensionsApi, ViewerGeometryUtilsApi, ViewerLoadModelsOptions, ViewerModelsApi, ViewerPlanHandle, ViewerPlansApi, ViewerPlanVector3Input, ViewerPostproductionApi, ViewerSelection, ViewerSelectorApi, ViewerUtilsApi, } from "./api/ViewerApi";
|
|
5
5
|
export type { ViewerModelLevel, ViewerModelLevelsByModel, ViewerPropertiesApi, ViewerPropertiesExcelOptions, } from "./api/ViewerPropertiesApi";
|
|
6
6
|
export { BMTLoader } from "./Loaders/BmtLoader";
|
|
7
7
|
export type { BmtGeometryChunkData, BmtParseCallbacks, BmtParseProgressData, BmtModelGeometryData, BmtGeomData, BmtIndexArray, BmtMaterialData, BmtElementProps, BmtModelData, BmtModelProps, BmtModelStructure, BmtModelStructureNode, BmtPropertyRecord, BmtPropertySet, BmtPropertyValue, } from "./Loaders/BmtLoader";
|