bimatter-viewer-react 0.7.0 → 0.7.1
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 +2 -1
- package/lib/ModelUploadQueue.d.ts +2 -1
- package/lib/index.js +1542 -1391
- package/lib/utils/ClippingUtils/ClippingCaps.d.ts +4 -7
- package/lib/utils/ClippingUtils/ClippingUtils.d.ts +13 -4
- package/lib/utils/DimentionsUtils/DimentionsUtils.d.ts +5 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BufferGeometry, Mesh, Plane } from "three";
|
|
1
|
+
import { BufferGeometry, Mesh, Plane, Vector3 } from "three";
|
|
2
2
|
import type { ClippingUtils } from "./ClippingUtils";
|
|
3
3
|
type CapPreselection = {
|
|
4
4
|
elementID: number;
|
|
@@ -9,7 +9,6 @@ export declare class ClippingCaps {
|
|
|
9
9
|
readonly plane: Plane;
|
|
10
10
|
private readonly capMaterial;
|
|
11
11
|
private readonly capMesh;
|
|
12
|
-
private readonly capTexture;
|
|
13
12
|
private readonly context;
|
|
14
13
|
private readonly root;
|
|
15
14
|
private readonly box;
|
|
@@ -19,9 +18,6 @@ export declare class ClippingCaps {
|
|
|
19
18
|
private readonly tempLine;
|
|
20
19
|
private readonly tempVector;
|
|
21
20
|
private readonly tempVector1;
|
|
22
|
-
private readonly tempAxisX;
|
|
23
|
-
private readonly tempAxisY;
|
|
24
|
-
private readonly tempAxisZ;
|
|
25
21
|
private readonly worldPoint;
|
|
26
22
|
private capClippingPlanesKey;
|
|
27
23
|
private capShader;
|
|
@@ -34,11 +30,14 @@ export declare class ClippingCaps {
|
|
|
34
30
|
setVisible(visible: boolean): void;
|
|
35
31
|
syncMeshes(): void;
|
|
36
32
|
getSelectableObject(): Mesh<BufferGeometry<import("three").NormalBufferAttributes, import("three").BufferGeometryEventMap>, import("three").Material<import("three").MaterialEventMap> | import("three").Material<import("three").MaterialEventMap>[], import("three").Object3DEventMap>;
|
|
33
|
+
getSnapPoints(point: Vector3, distance: number): Vector3[];
|
|
37
34
|
setPreselection(preselection: CapPreselection): void;
|
|
35
|
+
updateColors(): void;
|
|
38
36
|
updateVisualState(): void;
|
|
39
37
|
update(): void;
|
|
40
38
|
private setupWebGpuCapMaterial;
|
|
41
39
|
private setupCapMaterialShader;
|
|
40
|
+
private updateBaseMaterialColor;
|
|
42
41
|
private updateColorUniform;
|
|
43
42
|
private updateColorUniforms;
|
|
44
43
|
private updatePreselectionUniforms;
|
|
@@ -56,8 +55,6 @@ export declare class ClippingCaps {
|
|
|
56
55
|
private cleanContour;
|
|
57
56
|
private triangulateContours;
|
|
58
57
|
private pushContourVertex;
|
|
59
|
-
private getHatchSpacing;
|
|
60
|
-
private getModelHatchReferenceDirection;
|
|
61
58
|
private getModelWorldBox;
|
|
62
59
|
}
|
|
63
60
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Camera, Material, Mesh, Object3D, Plane, Raycaster, Scene, Vector3, WebGLRenderer } from "three";
|
|
1
|
+
import { Camera, type ColorRepresentation, Material, Mesh, Object3D, Plane, Raycaster, Scene, Vector3, WebGLRenderer } from "three";
|
|
2
2
|
import type { CameraUtilsApi } from "../../Camera/useCameraUtils";
|
|
3
3
|
import type { ViewerStoreApi } from "../../store/ViewerStore";
|
|
4
4
|
import type { ViewerControlsRef, ViewerModelRef } from "../../types";
|
|
@@ -27,12 +27,14 @@ export type ViewerClippingApi = {
|
|
|
27
27
|
createPlane: (event?: MouseEvent | PointerEvent) => Plane | null;
|
|
28
28
|
deleteAllPlanes: () => void;
|
|
29
29
|
getCapsActive: () => boolean;
|
|
30
|
+
getCapsColor: () => ColorRepresentation;
|
|
30
31
|
getEdgesActive: () => boolean;
|
|
31
32
|
getHelpersActive: () => boolean;
|
|
32
33
|
getPlanes: () => Plane[];
|
|
33
34
|
getActive: () => boolean;
|
|
34
35
|
setActive: (active: boolean) => void;
|
|
35
36
|
setCapsActive: (active: boolean) => void;
|
|
37
|
+
setCapsColor: (color: ColorRepresentation) => void;
|
|
36
38
|
setEdgesActive: (active: boolean) => void;
|
|
37
39
|
setHelpersActive: (active: boolean) => void;
|
|
38
40
|
toggle: () => void;
|
|
@@ -46,6 +48,8 @@ export declare class ClippingUtils {
|
|
|
46
48
|
helpers: PlaneHelper[];
|
|
47
49
|
private active;
|
|
48
50
|
private capsActive;
|
|
51
|
+
private capsCameraMotionActive;
|
|
52
|
+
private capsColor;
|
|
49
53
|
private context;
|
|
50
54
|
private edgesActive;
|
|
51
55
|
private helperDragActive;
|
|
@@ -60,6 +64,7 @@ export declare class ClippingUtils {
|
|
|
60
64
|
getActive(): boolean;
|
|
61
65
|
getEdgesActive(): boolean;
|
|
62
66
|
getCapsActive(): boolean;
|
|
67
|
+
getCapsColor(): ColorRepresentation;
|
|
63
68
|
getHelpersActive(): boolean;
|
|
64
69
|
getPlanes(): Plane[];
|
|
65
70
|
getScene(): Scene<import("three").Object3DEventMap>;
|
|
@@ -68,20 +73,21 @@ export declare class ClippingUtils {
|
|
|
68
73
|
getDomElement(): HTMLCanvasElement;
|
|
69
74
|
getRaycaster(): Raycaster;
|
|
70
75
|
getUseWebGPU(): boolean;
|
|
71
|
-
getMaxTextureAnisotropy(): number;
|
|
72
76
|
getControlRef(): ViewerControlsRef;
|
|
73
77
|
getMeshes(): Mesh<import("three").BufferGeometry<import("three").NormalBufferAttributes, import("three").BufferGeometryEventMap>, Material<import("three").MaterialEventMap> | Material<import("three").MaterialEventMap>[], import("three").Object3DEventMap>[];
|
|
74
78
|
getObjectModelID(object: Object3D): number;
|
|
75
79
|
getEdgeSegmentsForPlane(plane: Plane): readonly ClippingIntersectionSegment[] | null;
|
|
76
80
|
getSelectableObjects(): Mesh<import("three").BufferGeometry<import("three").NormalBufferAttributes, import("three").BufferGeometryEventMap>, Material<import("three").MaterialEventMap> | Material<import("three").MaterialEventMap>[], import("three").Object3DEventMap>[];
|
|
81
|
+
getSnapPoints(point: Vector3, distance: number): Vector3[];
|
|
77
82
|
getSelected(): import("../..").SelectedStore;
|
|
78
|
-
getPreselectionColor():
|
|
79
|
-
getSelectionColor():
|
|
83
|
+
getPreselectionColor(): ColorRepresentation;
|
|
84
|
+
getSelectionColor(): ColorRepresentation;
|
|
80
85
|
setCapsPreselection(preselection: ClippingPreselection): void;
|
|
81
86
|
updateCapsVisualState(): void;
|
|
82
87
|
getHelperHoverIsMoving(): boolean;
|
|
83
88
|
getHelperDragActive(): boolean;
|
|
84
89
|
setHelperDragActive(active: boolean): void;
|
|
90
|
+
setCapsCameraMotionActive(active: boolean): void;
|
|
85
91
|
setCapsDragActive(active: boolean): void;
|
|
86
92
|
requestCapsDragIdleUpdate(): void;
|
|
87
93
|
private clearCapsDragIdleTimeout;
|
|
@@ -102,6 +108,7 @@ export declare class ClippingUtils {
|
|
|
102
108
|
deleteAllPlanes(): void;
|
|
103
109
|
setHelpersActive(active: boolean): void;
|
|
104
110
|
setCapsActive(active: boolean): void;
|
|
111
|
+
setCapsColor(color: ColorRepresentation): void;
|
|
105
112
|
setEdgesActive(active: boolean): void;
|
|
106
113
|
updateEdges(): void;
|
|
107
114
|
flushEdgesUpdate(): void;
|
|
@@ -114,6 +121,8 @@ export declare class ClippingUtils {
|
|
|
114
121
|
}
|
|
115
122
|
export declare function useClippingUtils(modelRef: ViewerModelRef, controlRef: ViewerControlsRef, cameraUtils: CameraUtilsApi, useWebGPU?: boolean): ViewerClippingApi & {
|
|
116
123
|
getSelectableObjects: () => Object3D[];
|
|
124
|
+
getSnapPoints: (point: Vector3, distance: number) => Vector3[];
|
|
125
|
+
setCapsCameraMotionActive: (active: boolean) => void;
|
|
117
126
|
setCapsPreselection: (preselection: ClippingPreselection) => void;
|
|
118
127
|
syncWithModel: () => void;
|
|
119
128
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Color, ConeGeometry, Object3D, SphereGeometry, type Camera, type Scene } from "three";
|
|
1
|
+
import { Color, ConeGeometry, Object3D, SphereGeometry, Vector3, type Camera, type Scene } from "three";
|
|
2
2
|
import { type CameraUtilsApi } from "../../Camera/useCameraUtils";
|
|
3
3
|
import type { ViewerStoreApi } from "../../store/ViewerStore";
|
|
4
4
|
import type { ViewerControlsRef, ViewerModelRef } from "../../types";
|
|
@@ -9,6 +9,7 @@ type DimensionsContext = {
|
|
|
9
9
|
controlRef: ViewerControlsRef;
|
|
10
10
|
domElement: HTMLCanvasElement;
|
|
11
11
|
getExtraSnapObjects?: () => Object3D[];
|
|
12
|
+
getExtraSnapPoints?: (point: Vector3, distance: number) => Vector3[];
|
|
12
13
|
modelRef: ViewerModelRef;
|
|
13
14
|
scene: Scene;
|
|
14
15
|
viewerStore: ViewerStoreApi;
|
|
@@ -78,6 +79,8 @@ export declare class DimensionsUtils {
|
|
|
78
79
|
private getSnapObjects;
|
|
79
80
|
private getModelHit;
|
|
80
81
|
private getBoundingBoxes;
|
|
82
|
+
private getExtraSnapPoints;
|
|
83
|
+
private getClosestPoint;
|
|
81
84
|
private getClosestVertex;
|
|
82
85
|
private getPreviewEndPoint;
|
|
83
86
|
private getNextAxis;
|
|
@@ -93,7 +96,7 @@ export declare class DimensionsUtils {
|
|
|
93
96
|
static createEndpointGeometry(height?: number, radius?: number): ConeGeometry;
|
|
94
97
|
static createPreviewGeometry(): SphereGeometry;
|
|
95
98
|
}
|
|
96
|
-
export declare function useDimensionsUtils(modelRef: ViewerModelRef, controlRef: ViewerControlsRef, cameraUtils: CameraUtilsApi, getExtraSnapObjects?: () => Object3D[]): ViewerDimensionsApi & {
|
|
99
|
+
export declare function useDimensionsUtils(modelRef: ViewerModelRef, controlRef: ViewerControlsRef, cameraUtils: CameraUtilsApi, getExtraSnapObjects?: () => Object3D[], getExtraSnapPoints?: (point: Vector3, distance: number) => Vector3[]): ViewerDimensionsApi & {
|
|
97
100
|
syncWithModel: () => void;
|
|
98
101
|
};
|
|
99
102
|
export {};
|