viral-viewer-2 7.2.1 → 7.2.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/dist/components/camera/viral-camera.d.ts +7 -6
- package/dist/components/custom-objects/viral-bim-world.d.ts +7 -0
- package/dist/components/loader/viral-revit.loader.d.ts +1 -2
- package/dist/components/post-processing/post-processing-renderer.d.ts +45 -0
- package/dist/components/post-processing/selection-outline-pass.d.ts +65 -0
- package/dist/components/visibility-manager/viral-visibility-manager.d.ts +40 -0
- package/dist/entities/data-tree.d.ts +6 -1
- package/dist/index.mjs +1950 -1621
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import CameraControls from "camera-controls";
|
|
2
2
|
import { type Object3D, OrthographicCamera, PerspectiveCamera, Raycaster, Vector3 } from "three";
|
|
3
|
-
import { ViralCameraEventType, type ViralViewerState } from "../..";
|
|
3
|
+
import { ViralCameraEventType, type ViralutionCamera, type ViralViewerState } from "../..";
|
|
4
4
|
import type { ViralViewerApi } from "../../viral-viewer-api";
|
|
5
5
|
export declare class ViralCamera {
|
|
6
6
|
viralViewerApi: ViralViewerApi;
|
|
@@ -22,11 +22,6 @@ export declare class ViralCamera {
|
|
|
22
22
|
*/
|
|
23
23
|
resizeCanvas(): void;
|
|
24
24
|
resizeCanvas2(): void;
|
|
25
|
-
/**
|
|
26
|
-
* focuse model
|
|
27
|
-
* @param objectName :model name
|
|
28
|
-
*/
|
|
29
|
-
focusModelByName(objectName?: string): void;
|
|
30
25
|
getState(): ViralViewerState | null;
|
|
31
26
|
restoreState(state: ViralViewerState): void;
|
|
32
27
|
modelId: string;
|
|
@@ -53,4 +48,10 @@ export declare class ViralCamera {
|
|
|
53
48
|
addEventListener(type: ViralCameraEventType, key: string, resolve: () => void): void;
|
|
54
49
|
removeEventListener(type: ViralCameraEventType, key: string): void;
|
|
55
50
|
getAllEventListener(): void;
|
|
51
|
+
backHome(): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* This function focus camera on model by given ViralutionCamera
|
|
54
|
+
* @param camera
|
|
55
|
+
*/
|
|
56
|
+
focusCameraOnModel(camera: ViralutionCamera, transition?: boolean): Promise<void>;
|
|
56
57
|
}
|
|
@@ -91,6 +91,13 @@ export declare class ViralBIMWorld extends Mesh {
|
|
|
91
91
|
modelId: string;
|
|
92
92
|
elementId: string;
|
|
93
93
|
}[];
|
|
94
|
+
/**
|
|
95
|
+
* Get merged position buffer for selected elements (for outline rendering)
|
|
96
|
+
* Returns all vertex positions merged into a single Float32Array
|
|
97
|
+
* Handles both batched meshes (direct buffer) and instanced meshes (applies transforms)
|
|
98
|
+
* @returns Float32Array of positions or null if no selection
|
|
99
|
+
*/
|
|
100
|
+
getSelectedElementsPositions(): Float32Array | null;
|
|
94
101
|
/**
|
|
95
102
|
* Changes the color of multiple elements in the merged mesh.
|
|
96
103
|
* Works with RGBA color buffer (preserves existing alpha values)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ViralutionElement
|
|
1
|
+
import { type ViralutionElement } from "../..";
|
|
2
2
|
import type { ViralViewerApi } from "../../viral-viewer-api";
|
|
3
3
|
export declare class ViralRevitLoader {
|
|
4
4
|
viralViewerApi: ViralViewerApi;
|
|
@@ -8,7 +8,6 @@ export declare class ViralRevitLoader {
|
|
|
8
8
|
load(trackingUrl: string, dataUrl: string, informationUrl: string, callbackOnFinish?: () => void): Promise<void>;
|
|
9
9
|
getMaterials(dataUrl: string, byteRangeStart: number, byteRangeEnd: number): Promise<any>;
|
|
10
10
|
getElements(dataUrl: string, chunk: number[][], callbackOnSuccess?: (model: any, index: number) => void): Promise<void>;
|
|
11
|
-
focusCameraOnModel(trackingModel: ViralutionTrackingModel): Promise<void>;
|
|
12
11
|
getTranslation(translation: number[]): {
|
|
13
12
|
x: number;
|
|
14
13
|
y: number;
|
|
@@ -7,6 +7,7 @@ import { SMAAPass } from "three/examples/jsm/postprocessing/SMAAPass";
|
|
|
7
7
|
import { type ViralViewerApi } from "../..";
|
|
8
8
|
import { DevicePerformanceChecker } from "../../utils/device";
|
|
9
9
|
import { type ScreenSpaceEdgesOptions, ScreenSpaceEdgesPass } from "./screen-space-edges-pass";
|
|
10
|
+
import { type SelectionOutlineOptions, SelectionOutlinePass } from "./selection-outline-pass";
|
|
10
11
|
export declare class PostProcessingRenderer {
|
|
11
12
|
private renderer;
|
|
12
13
|
viralViewerApi: ViralViewerApi;
|
|
@@ -24,6 +25,7 @@ export declare class PostProcessingRenderer {
|
|
|
24
25
|
shadowRemovalPass: ShaderPass | null;
|
|
25
26
|
outlinePass: OutlinePass | null;
|
|
26
27
|
screenSpaceEdgesPass: ScreenSpaceEdgesPass | null;
|
|
28
|
+
selectionOutlinePass: SelectionOutlinePass | null;
|
|
27
29
|
n8aoPass: any;
|
|
28
30
|
perfChecker: DevicePerformanceChecker;
|
|
29
31
|
constructor(renderer: WebGLRenderer, viralViewerApi: ViralViewerApi);
|
|
@@ -113,4 +115,47 @@ export declare class PostProcessingRenderer {
|
|
|
113
115
|
initOutlinePass(scene: Scene, camera: Camera): void;
|
|
114
116
|
enableOutline(): void;
|
|
115
117
|
disableOutline(): void;
|
|
118
|
+
/**
|
|
119
|
+
* Initialize lightweight selection outline pass
|
|
120
|
+
* Renders selected geometry to mask, then applies Sobel edge detection
|
|
121
|
+
* Cost: 1 extra draw call + 1 fullscreen pass
|
|
122
|
+
*/
|
|
123
|
+
initSelectionOutlinePass(scene: Scene, camera: Camera): void;
|
|
124
|
+
/**
|
|
125
|
+
* Update selection outline geometry
|
|
126
|
+
* Call this when selection changes
|
|
127
|
+
* @param positions - Merged Float32Array of selected element positions, or null to clear
|
|
128
|
+
*/
|
|
129
|
+
updateSelectionOutline(positions: Float32Array | null): void;
|
|
130
|
+
/**
|
|
131
|
+
* Enable selection outline rendering
|
|
132
|
+
*/
|
|
133
|
+
enableSelectionOutline(): void;
|
|
134
|
+
/**
|
|
135
|
+
* Disable selection outline rendering
|
|
136
|
+
*/
|
|
137
|
+
disableSelectionOutline(): void;
|
|
138
|
+
/**
|
|
139
|
+
* 🔧 FAST: Bypass selection outline (instant, no mask render)
|
|
140
|
+
* Use this during camera movement for smooth performance
|
|
141
|
+
* The pass stays in the pipeline but just copies input to output
|
|
142
|
+
*/
|
|
143
|
+
bypassSelectionOutline(): void;
|
|
144
|
+
/**
|
|
145
|
+
* 🔧 FAST: Resume selection outline after bypassing
|
|
146
|
+
* Call this when camera stops moving
|
|
147
|
+
*/
|
|
148
|
+
resumeSelectionOutline(): void;
|
|
149
|
+
/**
|
|
150
|
+
* Configure selection outline options
|
|
151
|
+
*/
|
|
152
|
+
setSelectionOutlineOptions(options: Partial<SelectionOutlineOptions>): void;
|
|
153
|
+
/**
|
|
154
|
+
* Set selection outline color
|
|
155
|
+
*/
|
|
156
|
+
setSelectionOutlineColor(color: Color | number | string): void;
|
|
157
|
+
/**
|
|
158
|
+
* Set selection outline thickness in pixels
|
|
159
|
+
*/
|
|
160
|
+
setSelectionOutlineThickness(thickness: number): void;
|
|
116
161
|
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { Camera, WebGLRenderer } from "three";
|
|
2
|
+
import { Color, Scene, type Vector2, WebGLRenderTarget } from "three";
|
|
3
|
+
import { Pass } from "three/examples/jsm/postprocessing/Pass";
|
|
4
|
+
/**
|
|
5
|
+
* Selection Outline Pass
|
|
6
|
+
*
|
|
7
|
+
* Lightweight outline effect for selected elements in merged geometry.
|
|
8
|
+
* Cost: 1 extra draw call (for mask) + 1 fullscreen Sobel pass
|
|
9
|
+
*
|
|
10
|
+
* Process:
|
|
11
|
+
* 1. Render selected geometry to mask texture (white on black)
|
|
12
|
+
* 2. Sobel edge detection on mask
|
|
13
|
+
* 3. Composite colored edges over scene
|
|
14
|
+
*/
|
|
15
|
+
export interface SelectionOutlineOptions {
|
|
16
|
+
/** Outline color (default: accent color) */
|
|
17
|
+
outlineColor: Color;
|
|
18
|
+
/** Outline opacity 0-1 (default: 1.0) */
|
|
19
|
+
outlineOpacity: number;
|
|
20
|
+
/** Outline thickness in pixels (default: 2.0) */
|
|
21
|
+
outlineThickness: number;
|
|
22
|
+
/** Show outline for occluded parts (default: true) */
|
|
23
|
+
showOccluded: boolean;
|
|
24
|
+
/** Occluded outline opacity multiplier (default: 0.5) */
|
|
25
|
+
occludedOpacity: number;
|
|
26
|
+
}
|
|
27
|
+
export declare class SelectionOutlinePass extends Pass {
|
|
28
|
+
private camera;
|
|
29
|
+
private resolution;
|
|
30
|
+
private options;
|
|
31
|
+
private maskRenderTarget;
|
|
32
|
+
private maskDepthRenderTarget;
|
|
33
|
+
private maskMaterial;
|
|
34
|
+
private outlineMaterial;
|
|
35
|
+
private copyMaterial;
|
|
36
|
+
private maskScene;
|
|
37
|
+
private selectionMesh;
|
|
38
|
+
private selectionGeometry;
|
|
39
|
+
private fsQuad;
|
|
40
|
+
private hasSelection;
|
|
41
|
+
/**
|
|
42
|
+
* 🔧 FAST TOGGLE:
|
|
43
|
+
* - `bypass = false`: Full outline rendering (normal mode)
|
|
44
|
+
* - `bypass = true`: Pass runs but just copies input to output (very fast, no mask render)
|
|
45
|
+
*/
|
|
46
|
+
bypass: boolean;
|
|
47
|
+
constructor(_scene: Scene, camera: Camera, resolution: Vector2, options?: Partial<SelectionOutlineOptions>);
|
|
48
|
+
/**
|
|
49
|
+
* Update selection geometry from buffer elements
|
|
50
|
+
* Call this when selection changes
|
|
51
|
+
* @param positions - Merged Float32Array of all selected element positions
|
|
52
|
+
*/
|
|
53
|
+
updateSelectionGeometry(positions: Float32Array | null): void;
|
|
54
|
+
/**
|
|
55
|
+
* Get whether there's an active selection
|
|
56
|
+
*/
|
|
57
|
+
get hasActiveSelection(): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Update outline options
|
|
60
|
+
*/
|
|
61
|
+
setOptions(options: Partial<SelectionOutlineOptions>): void;
|
|
62
|
+
render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget, _deltaTime?: number, _maskActive?: boolean): void;
|
|
63
|
+
setSize(width: number, height: number): void;
|
|
64
|
+
dispose(): void;
|
|
65
|
+
}
|
|
@@ -3,8 +3,17 @@ import { type SunLightConfiguration } from "../..";
|
|
|
3
3
|
import type { ViralViewerApi } from "../../viral-viewer-api";
|
|
4
4
|
export declare class ViralVisibilityManager {
|
|
5
5
|
private viralViewerApi;
|
|
6
|
+
/** Whether selection outline is enabled (default: true) */
|
|
7
|
+
private _selectionOutlineEnabled;
|
|
6
8
|
constructor(viralViewerApi: ViralViewerApi);
|
|
9
|
+
/**
|
|
10
|
+
* show all elements and reset back to normal visualization
|
|
11
|
+
*/
|
|
7
12
|
showAll2(): void;
|
|
13
|
+
/**
|
|
14
|
+
* hide all elements and reset back to normal visualization
|
|
15
|
+
*/
|
|
16
|
+
hideAllElements(): void;
|
|
8
17
|
/**
|
|
9
18
|
*
|
|
10
19
|
* @param elements default will get selected elements or we can input specific elements
|
|
@@ -114,6 +123,15 @@ export declare class ViralVisibilityManager {
|
|
|
114
123
|
* 🔧 FAST: Resume screen-space edges after camera stops
|
|
115
124
|
*/
|
|
116
125
|
resumeScreenSpaceEdge(): void;
|
|
126
|
+
/**
|
|
127
|
+
* 🔧 FAST: Bypass selection outline during camera movement
|
|
128
|
+
* Much faster than disable - skips mask render but keeps pass in pipeline
|
|
129
|
+
*/
|
|
130
|
+
bypassSelectionOutline(): void;
|
|
131
|
+
/**
|
|
132
|
+
* 🔧 FAST: Resume selection outline after camera stops
|
|
133
|
+
*/
|
|
134
|
+
resumeSelectionOutline(): void;
|
|
117
135
|
/**
|
|
118
136
|
* Configure screen-space edge detection
|
|
119
137
|
*/
|
|
@@ -144,6 +162,28 @@ export declare class ViralVisibilityManager {
|
|
|
144
162
|
modelId: string;
|
|
145
163
|
elementId: string;
|
|
146
164
|
}[]): void;
|
|
165
|
+
/**
|
|
166
|
+
* Update selection outline pass with current selection
|
|
167
|
+
* Uses merged geometry for efficient rendering
|
|
168
|
+
*/
|
|
169
|
+
updateSelectionOutline(): void;
|
|
170
|
+
/**
|
|
171
|
+
* Enable selection outline effect
|
|
172
|
+
*/
|
|
173
|
+
enableSelectionOutline(): void;
|
|
174
|
+
/**
|
|
175
|
+
* Disable selection outline effect
|
|
176
|
+
*/
|
|
177
|
+
disableSelectionOutline(): void;
|
|
178
|
+
/**
|
|
179
|
+
* Set whether selection outline mode is enabled
|
|
180
|
+
* @param enabled - true to enable outline on selection, false to disable
|
|
181
|
+
*/
|
|
182
|
+
setSelectionOutlineMode(enabled: boolean): void;
|
|
183
|
+
/**
|
|
184
|
+
* Get whether selection outline mode is enabled
|
|
185
|
+
*/
|
|
186
|
+
get selectionOutlineEnabled(): boolean;
|
|
147
187
|
enableNight(): void;
|
|
148
188
|
disableNight(): void;
|
|
149
189
|
enableSectionBox(): void;
|
|
@@ -117,7 +117,12 @@ export declare class DataTree {
|
|
|
117
117
|
* @param layoutOptions Layout options
|
|
118
118
|
* @returns Promise that resolves with nodes and edges
|
|
119
119
|
*/
|
|
120
|
-
toGraphAsync(layoutOptions?: GraphLayoutOptions
|
|
120
|
+
toGraphAsync(layoutOptions?: GraphLayoutOptions, onProgress?: (progress: {
|
|
121
|
+
phase: string;
|
|
122
|
+
percent: number;
|
|
123
|
+
current: number;
|
|
124
|
+
total: number;
|
|
125
|
+
}) => void): Promise<{
|
|
121
126
|
nodes: GraphNode[];
|
|
122
127
|
edges: GraphEdge[];
|
|
123
128
|
}>;
|