bimatter-viewer-react 1.0.0 → 1.0.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/Model.d.ts +3 -2
- package/lib/SelectableMesh.d.ts +7 -2
- package/lib/ViewerComponents/ViewerScene.d.ts +5 -1
- package/lib/WebGpuSelectableMesh.d.ts +1 -1
- package/lib/api/ViewerApi.d.ts +8 -1
- package/lib/api/loader.d.ts +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3474 -2614
- package/lib/sharedMeshMaterials.d.ts +24 -0
- package/lib/utils/ClippingUtils/ClippingUtils.d.ts +6 -0
- package/lib/utils/DimentionsUtils/DimentionsUtils.d.ts +5 -0
- package/lib/utils/DimentionsUtils/index.d.ts +1 -1
- package/lib/utils/GeometryUtils/ElementCreationPreview.d.ts +23 -0
- package/lib/utils/GeometryUtils/createElements.d.ts +79 -0
- package/lib/workers/WorkerErrors.d.ts +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { DataTexture, Material, Plane } from "three";
|
|
2
|
+
import type { BmtMaterialData } from "./Loaders/BmtLoader";
|
|
3
|
+
import type { ViewerMaterialMode } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* Materials shared by the meshes of one model that look the same. The cache
|
|
6
|
+
* must stay per model: preselection writes the element id into the material
|
|
7
|
+
* uniforms of every mesh of the preselected model, so a material shared
|
|
8
|
+
* between models would highlight the same id in all of them.
|
|
9
|
+
*
|
|
10
|
+
* Keys include everything a material is built from, so a cache can outlive
|
|
11
|
+
* palette or renderer changes without handing out a mismatched material.
|
|
12
|
+
*/
|
|
13
|
+
export declare class SharedMeshMaterials {
|
|
14
|
+
private readonly materials;
|
|
15
|
+
get<T extends Material>(key: string, create: () => T): T;
|
|
16
|
+
dispose(): void;
|
|
17
|
+
}
|
|
18
|
+
export declare function getSharedMeshMaterialKey(renderer: "webgl" | "webgpu", colorPaletteTexture: DataTexture, material: BmtMaterialData, materialMode: ViewerMaterialMode, useDoubleSideMaterial: boolean): string;
|
|
19
|
+
/**
|
|
20
|
+
* Gives a model material the current section planes before it is rendered,
|
|
21
|
+
* so a mesh added while clipping is active never shows up unclipped for a
|
|
22
|
+
* frame. It also compiles the shader with the planes right away.
|
|
23
|
+
*/
|
|
24
|
+
export declare function applyMaterialClippingPlanes(material: Material, planes: Plane[] | undefined): void;
|
|
@@ -112,6 +112,11 @@ export declare class ClippingUtils {
|
|
|
112
112
|
private getSelectedWorldBox;
|
|
113
113
|
setControlsEnabled(enabled: boolean): void;
|
|
114
114
|
setSelectionInteractionDisabled(disabled: boolean): void;
|
|
115
|
+
/**
|
|
116
|
+
* The plane array model materials reference: the live planes while
|
|
117
|
+
* clipping is active, so dragging a plane needs no material update.
|
|
118
|
+
*/
|
|
119
|
+
getMaterialPlanes(): Plane[];
|
|
115
120
|
updateMaterials(): void;
|
|
116
121
|
setActive(active: boolean): void;
|
|
117
122
|
toggle(): void;
|
|
@@ -140,6 +145,7 @@ export declare function useClippingUtils(modelRef: ViewerModelRef, controlRef: V
|
|
|
140
145
|
getPlanVisualObjects: () => Object3D[];
|
|
141
146
|
setCapsCameraMotionActive: (active: boolean) => void;
|
|
142
147
|
setEdgesCameraMotionActive: (active: boolean) => void;
|
|
148
|
+
getMaterialPlanes: () => Plane[];
|
|
143
149
|
setCapsPreselection: (preselection: ClippingPreselection) => void;
|
|
144
150
|
syncWithModel: () => void;
|
|
145
151
|
};
|
|
@@ -30,6 +30,7 @@ export type ViewerDimensionsApi = {
|
|
|
30
30
|
deleteAll: () => void;
|
|
31
31
|
getActive: () => boolean;
|
|
32
32
|
getDimensions: () => DimensionLine[];
|
|
33
|
+
getPointAtPointer: (event: PointerEvent, snapToNearestPoint?: boolean) => Vector3 | null;
|
|
33
34
|
getSnapDistance: () => number;
|
|
34
35
|
getUnit: () => DimensionUnit;
|
|
35
36
|
setActive: (active: boolean) => void;
|
|
@@ -40,6 +41,9 @@ export type ViewerDimensionsApi = {
|
|
|
40
41
|
setWidth: (width: number) => void;
|
|
41
42
|
toggle: () => void;
|
|
42
43
|
};
|
|
44
|
+
export type DimensionAxis = "x" | "y" | "z";
|
|
45
|
+
export declare function getAxisConstrainedPoint(start: Vector3, point: Vector3, axis: DimensionAxis): Vector3;
|
|
46
|
+
export declare function getDominantAxis(start: Vector3, point: Vector3): DimensionAxis;
|
|
43
47
|
export declare class DimensionsUtils {
|
|
44
48
|
private active;
|
|
45
49
|
private axis;
|
|
@@ -73,6 +77,7 @@ export declare class DimensionsUtils {
|
|
|
73
77
|
setContext(context: DimensionsContext): void;
|
|
74
78
|
getActive(): boolean;
|
|
75
79
|
getDimensions(): DimensionLine[];
|
|
80
|
+
getPointAtPointer(event: PointerEvent, snapToNearestPoint?: boolean): Vector3 | null;
|
|
76
81
|
getSnapDistance(): number;
|
|
77
82
|
getUnit(): DimensionUnit;
|
|
78
83
|
setActive(active: boolean): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { DimensionsUtils, useDimensionsUtils, type ViewerDimensionsApi, } from "./DimentionsUtils";
|
|
1
|
+
export { DimensionsUtils, getAxisConstrainedPoint, getDominantAxis, useDimensionsUtils, type DimensionAxis, type ViewerDimensionsApi, } from "./DimentionsUtils";
|
|
2
2
|
export { DimensionLine, type DimensionUnit } from "./DimentionLine";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Scene, Vector3, type Camera } from "three";
|
|
2
|
+
import { type IfcElementType } from "./createElements";
|
|
3
|
+
export type ElementCreationPreviewState = {
|
|
4
|
+
height: number;
|
|
5
|
+
points: Vector3[];
|
|
6
|
+
type: IfcElementType;
|
|
7
|
+
width: number;
|
|
8
|
+
};
|
|
9
|
+
export declare class ElementCreationPreview {
|
|
10
|
+
private readonly cursor;
|
|
11
|
+
private readonly lineMaterial;
|
|
12
|
+
private readonly outline;
|
|
13
|
+
private readonly previewGroup;
|
|
14
|
+
private readonly root;
|
|
15
|
+
private readonly wall;
|
|
16
|
+
private readonly wallOutline;
|
|
17
|
+
constructor(scene: Scene);
|
|
18
|
+
update(point: Vector3 | null, state: ElementCreationPreviewState, camera: Camera, viewportHeight: number): void;
|
|
19
|
+
hide(): void;
|
|
20
|
+
dispose(): void;
|
|
21
|
+
private updateWall;
|
|
22
|
+
private updateSlabOutline;
|
|
23
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { BufferGeometry } from "three";
|
|
2
|
+
import type { BmtElementProps, BmtGeomData, BmtModelData, BmtModelStructure, BmtModelStructureNode } from "../../Loaders/BmtLoader";
|
|
3
|
+
export type IfcElementType = "IfcWall" | "IfcSlab";
|
|
4
|
+
export type BmtElementType = IfcElementType | "IfcElementProxy";
|
|
5
|
+
export type IfcElementQuantities = Record<string, {
|
|
6
|
+
kind: "length" | "area" | "volume";
|
|
7
|
+
value: number;
|
|
8
|
+
}>;
|
|
9
|
+
export type CreatedBmtElement = {
|
|
10
|
+
geometry: BmtGeomData;
|
|
11
|
+
props: BmtElementProps;
|
|
12
|
+
structureNode: BmtModelStructureNode;
|
|
13
|
+
};
|
|
14
|
+
export type CreateIfcElementOptions = {
|
|
15
|
+
coordinationMatrix?: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
quantities?: IfcElementQuantities;
|
|
18
|
+
};
|
|
19
|
+
export declare function createIfcGuid(): string;
|
|
20
|
+
export declare function getNextElementID(models: Record<number, BmtModelData>): number;
|
|
21
|
+
export declare function createWallGeometry(start: {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
z: number;
|
|
25
|
+
}, end: {
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
z: number;
|
|
29
|
+
}, height: number, thickness?: number): {
|
|
30
|
+
geometry: BufferGeometry<import("three").NormalBufferAttributes, import("three").BufferGeometryEventMap>;
|
|
31
|
+
quantities: {
|
|
32
|
+
Length: {
|
|
33
|
+
kind: "length";
|
|
34
|
+
value: number;
|
|
35
|
+
};
|
|
36
|
+
Width: {
|
|
37
|
+
kind: "length";
|
|
38
|
+
value: number;
|
|
39
|
+
};
|
|
40
|
+
Height: {
|
|
41
|
+
kind: "length";
|
|
42
|
+
value: number;
|
|
43
|
+
};
|
|
44
|
+
GrossFootprintArea: {
|
|
45
|
+
kind: "area";
|
|
46
|
+
value: number;
|
|
47
|
+
};
|
|
48
|
+
NetFootprintArea: {
|
|
49
|
+
kind: "area";
|
|
50
|
+
value: number;
|
|
51
|
+
};
|
|
52
|
+
GrossSideArea: {
|
|
53
|
+
kind: "area";
|
|
54
|
+
value: number;
|
|
55
|
+
};
|
|
56
|
+
NetSideArea: {
|
|
57
|
+
kind: "area";
|
|
58
|
+
value: number;
|
|
59
|
+
};
|
|
60
|
+
GrossVolume: {
|
|
61
|
+
kind: "volume";
|
|
62
|
+
value: number;
|
|
63
|
+
};
|
|
64
|
+
NetVolume: {
|
|
65
|
+
kind: "volume";
|
|
66
|
+
value: number;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
export declare function createSlabGeometry(outline: Array<{
|
|
71
|
+
x: number;
|
|
72
|
+
y: number;
|
|
73
|
+
z: number;
|
|
74
|
+
}>, thickness: number): {
|
|
75
|
+
geometry: BufferGeometry<import("three").NormalBufferAttributes, import("three").BufferGeometryEventMap>;
|
|
76
|
+
quantities: IfcElementQuantities;
|
|
77
|
+
};
|
|
78
|
+
export declare function createBmtElement(sourceGeometry: BufferGeometry, type: BmtElementType, elementID: number, options?: CreateIfcElementOptions): CreatedBmtElement;
|
|
79
|
+
export declare function appendElementToStructure(structure: BmtModelStructure, element: BmtModelStructureNode): BmtModelStructure;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turns a worker "error" event into an Error with whatever the browser told
|
|
3
|
+
* us. Errors thrown inside a running task come back as messages instead, so
|
|
4
|
+
* an event without a message usually means the worker script never started.
|
|
5
|
+
*/
|
|
6
|
+
export declare function createWorkerEventError(workerName: string, event: ErrorEvent): Error;
|