viral-viewer-2 7.2.1 → 7.2.3
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-batched-mesh.d.ts +12 -0
- package/dist/components/custom-objects/viral-bim-world.d.ts +7 -0
- package/dist/components/custom-objects/viral-instanced-mesh-v2.d.ts +20 -1
- package/dist/components/loader/viral-revit.loader.d.ts +1 -2
- package/dist/components/post-processing/alpha-selection-outline-pass.d.ts +49 -0
- package/dist/components/post-processing/post-processing-renderer.d.ts +86 -0
- package/dist/components/post-processing/selection-outline-pass.d.ts +65 -0
- package/dist/components/post-processing/stencil-selection-outline-pass.d.ts +54 -0
- package/dist/components/visibility-manager/viral-visibility-manager.d.ts +74 -0
- package/dist/entities/data-tree.d.ts +6 -1
- package/dist/index.mjs +2404 -1744
- 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
|
}
|
|
@@ -2,6 +2,11 @@ import { Box3, BufferGeometry, type Color, type Material, Mesh, Vector3 } from "
|
|
|
2
2
|
import { type LineMaterial } from "three/examples/jsm/Addons";
|
|
3
3
|
import { type BufferElement } from "../..";
|
|
4
4
|
import type { WorkerThreadPool } from "../worker/base/worker-pool";
|
|
5
|
+
/**
|
|
6
|
+
* Special alpha value to mark selected vertices for fast outline detection.
|
|
7
|
+
* The AlphaSelectionOutlinePass detects this value with ZERO extra render passes.
|
|
8
|
+
*/
|
|
9
|
+
export declare const SELECTION_ALPHA = 0.99;
|
|
5
10
|
export declare class ViralBatchedMesh extends Mesh {
|
|
6
11
|
globalMaterialIndex: number;
|
|
7
12
|
private workerPool;
|
|
@@ -110,6 +115,13 @@ export declare class ViralBatchedMesh extends Mesh {
|
|
|
110
115
|
elementId: string;
|
|
111
116
|
}[];
|
|
112
117
|
unselect(): void;
|
|
118
|
+
/**
|
|
119
|
+
* Set alpha value for elements (used for selection marking)
|
|
120
|
+
* This is VERY fast - only updates alpha channel, no geometry copying
|
|
121
|
+
*
|
|
122
|
+
* When setting alpha to 1.0 (removing selection), respects hidden/isolated state
|
|
123
|
+
*/
|
|
124
|
+
private _setSelectionAlpha;
|
|
113
125
|
/**
|
|
114
126
|
* Hide elements by setting their alpha to 0 (GPU-accelerated)
|
|
115
127
|
* Hidden elements are discarded in fragment shader - no rendering cost
|
|
@@ -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,6 +1,11 @@
|
|
|
1
1
|
import { Box3, BufferGeometry, Color, InstancedMesh, type Material, Matrix4, Object3D, Vector3 } from "three";
|
|
2
2
|
import { type LineMaterial } from "three/examples/jsm/Addons";
|
|
3
3
|
import { type BufferElement } from "../..";
|
|
4
|
+
/**
|
|
5
|
+
* Special alpha value to mark selected instances for fast outline detection.
|
|
6
|
+
* Note: Instanced meshes use a separate instanceSelected attribute instead of alpha.
|
|
7
|
+
*/
|
|
8
|
+
export declare const SELECTION_ALPHA = 0.99;
|
|
4
9
|
export declare class ViralInstancedMeshV2 extends Object3D {
|
|
5
10
|
protected material?: Material | undefined;
|
|
6
11
|
globalMaterialIndex: number;
|
|
@@ -51,6 +56,12 @@ export declare class ViralInstancedMeshV2 extends Object3D {
|
|
|
51
56
|
};
|
|
52
57
|
}[]): void;
|
|
53
58
|
unselect(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Set instance selection state for fast outline detection
|
|
61
|
+
* @param elements - Elements to set selection for
|
|
62
|
+
* @param selected - 1.0 = selected, 0.0 = not selected
|
|
63
|
+
*/
|
|
64
|
+
private _setInstanceSelection;
|
|
54
65
|
/**
|
|
55
66
|
* Changes the color of multiple elements.
|
|
56
67
|
* @param elements - An array of elements, each containing `modelId` and `elementId`.
|
|
@@ -163,7 +174,10 @@ export declare class ViralInstancedMeshV2 extends Object3D {
|
|
|
163
174
|
*/
|
|
164
175
|
isElementVisible(modelId: string, elementId: string): boolean;
|
|
165
176
|
/**
|
|
166
|
-
* Inject per-instance opacity shader into material
|
|
177
|
+
* Inject per-instance opacity and selection shader into material
|
|
178
|
+
* Enables:
|
|
179
|
+
* - Per-instance opacity (ghosting, hiding)
|
|
180
|
+
* - Selection alpha marker (for fast outline detection via AlphaSelectionOutlinePass)
|
|
167
181
|
* Must be called after material is set and before rendering
|
|
168
182
|
*/
|
|
169
183
|
injectOpacityShader(): void;
|
|
@@ -171,6 +185,11 @@ export declare class ViralInstancedMeshV2 extends Object3D {
|
|
|
171
185
|
* Ensure all instanced meshes have opacity attribute
|
|
172
186
|
*/
|
|
173
187
|
private _ensureOpacityAttributes;
|
|
188
|
+
/**
|
|
189
|
+
* Ensure all instanced meshes have selection attribute
|
|
190
|
+
* Used for fast outline detection via AlphaSelectionOutlinePass
|
|
191
|
+
*/
|
|
192
|
+
private _ensureSelectionAttributes;
|
|
174
193
|
/**
|
|
175
194
|
* Update opacity for specific instances
|
|
176
195
|
*/
|
|
@@ -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;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { WebGLRenderer } from "three";
|
|
2
|
+
import { Color, type Vector2, type WebGLRenderTarget } from "three";
|
|
3
|
+
import { Pass } from "three/examples/jsm/postprocessing/Pass";
|
|
4
|
+
/**
|
|
5
|
+
* Alpha-Based Selection Outline Pass (FASTEST)
|
|
6
|
+
*
|
|
7
|
+
* This is the FASTEST possible selection outline implementation because:
|
|
8
|
+
* - ZERO extra render passes for selection mask
|
|
9
|
+
* - ZERO geometry copying
|
|
10
|
+
* - O(pixels) cost - same for 1 or 10,000 selected elements
|
|
11
|
+
*
|
|
12
|
+
* How it works:
|
|
13
|
+
* 1. Selected elements have their alpha set to a special value (SELECTION_ALPHA = 0.99)
|
|
14
|
+
* 2. This pass detects edges where alpha equals SELECTION_ALPHA
|
|
15
|
+
* 3. Applies outline effect at those edges
|
|
16
|
+
*
|
|
17
|
+
* Requirements:
|
|
18
|
+
* - ViralBatchedMesh/ViralInstancedMesh must set alpha = 0.99 for selected vertices
|
|
19
|
+
* - Must run after main render pass but before tone mapping
|
|
20
|
+
*/
|
|
21
|
+
export interface AlphaSelectionOutlineOptions {
|
|
22
|
+
/** Outline color (default: accent color) */
|
|
23
|
+
outlineColor: Color;
|
|
24
|
+
/** Outline opacity 0-1 (default: 1.0) */
|
|
25
|
+
outlineOpacity: number;
|
|
26
|
+
/** Outline thickness in pixels (default: 2.0) */
|
|
27
|
+
outlineThickness: number;
|
|
28
|
+
/** Alpha value that indicates selection (default: 0.99) */
|
|
29
|
+
selectionAlpha: number;
|
|
30
|
+
/** Tolerance for alpha detection (default: 0.005) */
|
|
31
|
+
alphaTolerance: number;
|
|
32
|
+
}
|
|
33
|
+
export declare const SELECTION_ALPHA = 0.99;
|
|
34
|
+
export declare class AlphaSelectionOutlinePass extends Pass {
|
|
35
|
+
private resolution;
|
|
36
|
+
private options;
|
|
37
|
+
private outlineMaterial;
|
|
38
|
+
private copyMaterial;
|
|
39
|
+
private fsQuad;
|
|
40
|
+
/** Fast bypass during camera movement */
|
|
41
|
+
bypass: boolean;
|
|
42
|
+
/** Whether there's any selection active */
|
|
43
|
+
hasSelection: boolean;
|
|
44
|
+
constructor(resolution: Vector2, options?: Partial<AlphaSelectionOutlineOptions>);
|
|
45
|
+
setOptions(options: Partial<AlphaSelectionOutlineOptions>): void;
|
|
46
|
+
render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget, _deltaTime?: number, _maskActive?: boolean): void;
|
|
47
|
+
setSize(width: number, height: number): void;
|
|
48
|
+
dispose(): void;
|
|
49
|
+
}
|
|
@@ -6,7 +6,9 @@ import { ShaderPass } from "three/examples/jsm/postprocessing/ShaderPass";
|
|
|
6
6
|
import { SMAAPass } from "three/examples/jsm/postprocessing/SMAAPass";
|
|
7
7
|
import { type ViralViewerApi } from "../..";
|
|
8
8
|
import { DevicePerformanceChecker } from "../../utils/device";
|
|
9
|
+
import { AlphaSelectionOutlinePass } from "./alpha-selection-outline-pass";
|
|
9
10
|
import { type ScreenSpaceEdgesOptions, ScreenSpaceEdgesPass } from "./screen-space-edges-pass";
|
|
11
|
+
import { type SelectionOutlineOptions, SelectionOutlinePass } from "./selection-outline-pass";
|
|
10
12
|
export declare class PostProcessingRenderer {
|
|
11
13
|
private renderer;
|
|
12
14
|
viralViewerApi: ViralViewerApi;
|
|
@@ -24,6 +26,8 @@ export declare class PostProcessingRenderer {
|
|
|
24
26
|
shadowRemovalPass: ShaderPass | null;
|
|
25
27
|
outlinePass: OutlinePass | null;
|
|
26
28
|
screenSpaceEdgesPass: ScreenSpaceEdgesPass | null;
|
|
29
|
+
selectionOutlinePass: SelectionOutlinePass | null;
|
|
30
|
+
alphaSelectionOutlinePass: AlphaSelectionOutlinePass | null;
|
|
27
31
|
n8aoPass: any;
|
|
28
32
|
perfChecker: DevicePerformanceChecker;
|
|
29
33
|
constructor(renderer: WebGLRenderer, viralViewerApi: ViralViewerApi);
|
|
@@ -113,4 +117,86 @@ export declare class PostProcessingRenderer {
|
|
|
113
117
|
initOutlinePass(scene: Scene, camera: Camera): void;
|
|
114
118
|
enableOutline(): void;
|
|
115
119
|
disableOutline(): void;
|
|
120
|
+
/**
|
|
121
|
+
* Initialize lightweight selection outline pass
|
|
122
|
+
* Renders selected geometry to mask, then applies Sobel edge detection
|
|
123
|
+
* Cost: 1 extra draw call + 1 fullscreen pass
|
|
124
|
+
*/
|
|
125
|
+
initSelectionOutlinePass(scene: Scene, camera: Camera): void;
|
|
126
|
+
/**
|
|
127
|
+
* Update selection outline geometry
|
|
128
|
+
* Call this when selection changes
|
|
129
|
+
* @param positions - Merged Float32Array of selected element positions, or null to clear
|
|
130
|
+
*/
|
|
131
|
+
updateSelectionOutline(positions: Float32Array | null): void;
|
|
132
|
+
/**
|
|
133
|
+
* Enable selection outline rendering
|
|
134
|
+
*/
|
|
135
|
+
enableSelectionOutline(): void;
|
|
136
|
+
/**
|
|
137
|
+
* Disable selection outline rendering
|
|
138
|
+
*/
|
|
139
|
+
disableSelectionOutline(): void;
|
|
140
|
+
/**
|
|
141
|
+
* 🔧 FAST: Bypass selection outline (instant, no mask render)
|
|
142
|
+
* Use this during camera movement for smooth performance
|
|
143
|
+
* The pass stays in the pipeline but just copies input to output
|
|
144
|
+
*/
|
|
145
|
+
bypassSelectionOutline(): void;
|
|
146
|
+
/**
|
|
147
|
+
* 🔧 FAST: Resume selection outline after bypassing
|
|
148
|
+
* Call this when camera stops moving
|
|
149
|
+
*/
|
|
150
|
+
resumeSelectionOutline(): void;
|
|
151
|
+
/**
|
|
152
|
+
* Configure selection outline options
|
|
153
|
+
*/
|
|
154
|
+
setSelectionOutlineOptions(options: Partial<SelectionOutlineOptions>): void;
|
|
155
|
+
/**
|
|
156
|
+
* Set selection outline color
|
|
157
|
+
*/
|
|
158
|
+
setSelectionOutlineColor(color: Color | number | string): void;
|
|
159
|
+
/**
|
|
160
|
+
* Set selection outline thickness in pixels
|
|
161
|
+
*/
|
|
162
|
+
setSelectionOutlineThickness(thickness: number): void;
|
|
163
|
+
/**
|
|
164
|
+
* Initialize alpha-based selection outline pass
|
|
165
|
+
* ZERO extra render passes - detects selection via alpha channel in main render
|
|
166
|
+
* Cost: 1 fullscreen pass only (no geometry re-render)
|
|
167
|
+
*
|
|
168
|
+
* This is MUCH faster than SelectionOutlinePass for large selections
|
|
169
|
+
* Works with both batched meshes (per-vertex alpha) and instanced meshes (per-instance alpha)
|
|
170
|
+
*/
|
|
171
|
+
initAlphaSelectionOutlinePass(): void;
|
|
172
|
+
/**
|
|
173
|
+
* Enable alpha selection outline rendering
|
|
174
|
+
*/
|
|
175
|
+
enableAlphaSelectionOutline(): void;
|
|
176
|
+
/**
|
|
177
|
+
* Disable alpha selection outline rendering
|
|
178
|
+
*/
|
|
179
|
+
disableAlphaSelectionOutline(): void;
|
|
180
|
+
/**
|
|
181
|
+
* Bypass alpha selection outline (instant, zero cost)
|
|
182
|
+
*/
|
|
183
|
+
bypassAlphaSelectionOutline(): void;
|
|
184
|
+
/**
|
|
185
|
+
* Resume alpha selection outline after bypassing
|
|
186
|
+
*/
|
|
187
|
+
resumeAlphaSelectionOutline(): void;
|
|
188
|
+
/**
|
|
189
|
+
* Set alpha selection outline color
|
|
190
|
+
*/
|
|
191
|
+
setAlphaSelectionOutlineColor(color: Color | number | string): void;
|
|
192
|
+
/**
|
|
193
|
+
* Set alpha selection outline thickness in pixels
|
|
194
|
+
*/
|
|
195
|
+
setAlphaSelectionOutlineThickness(thickness: number): void;
|
|
196
|
+
/**
|
|
197
|
+
* Update alpha selection outline state
|
|
198
|
+
* Call this when selection changes
|
|
199
|
+
* @param hasSelection - Whether there's any selection active
|
|
200
|
+
*/
|
|
201
|
+
updateAlphaSelectionOutline(hasSelection: boolean): void;
|
|
116
202
|
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { WebGLRenderer } from "three";
|
|
2
|
+
import { Color, type Vector2, type WebGLRenderTarget } from "three";
|
|
3
|
+
import { Pass } from "three/examples/jsm/postprocessing/Pass";
|
|
4
|
+
/**
|
|
5
|
+
* Stencil-Based Selection Outline Pass (FAST)
|
|
6
|
+
*
|
|
7
|
+
* This is a MUCH faster alternative to geometry-based selection outline.
|
|
8
|
+
* Instead of copying vertex data, it reads from a selection mask texture
|
|
9
|
+
* that's been written to during the main render pass.
|
|
10
|
+
*
|
|
11
|
+
* Performance: O(pixels) instead of O(selected_vertices)
|
|
12
|
+
* - 1000 selected elements = same cost as 1 selected element
|
|
13
|
+
* - No geometry copying
|
|
14
|
+
* - No extra mesh rendering
|
|
15
|
+
*
|
|
16
|
+
* Requirements:
|
|
17
|
+
* - Selection mask must be written by ViralBatchedMesh/ViralInstancedMesh during render
|
|
18
|
+
* - Main renderer must call updateSelectionMask() before this pass runs
|
|
19
|
+
*/
|
|
20
|
+
export interface StencilSelectionOutlineOptions {
|
|
21
|
+
/** Outline color (default: accent color) */
|
|
22
|
+
outlineColor: Color;
|
|
23
|
+
/** Outline opacity 0-1 (default: 1.0) */
|
|
24
|
+
outlineOpacity: number;
|
|
25
|
+
/** Outline thickness in pixels (default: 2.0) */
|
|
26
|
+
outlineThickness: number;
|
|
27
|
+
}
|
|
28
|
+
export declare class StencilSelectionOutlinePass extends Pass {
|
|
29
|
+
private resolution;
|
|
30
|
+
private options;
|
|
31
|
+
private selectionMaskTarget;
|
|
32
|
+
private outlineMaterial;
|
|
33
|
+
private copyMaterial;
|
|
34
|
+
private fsQuad;
|
|
35
|
+
bypass: boolean;
|
|
36
|
+
private hasSelection;
|
|
37
|
+
constructor(resolution: Vector2, options?: Partial<StencilSelectionOutlineOptions>);
|
|
38
|
+
/**
|
|
39
|
+
* Set the selection mask render target
|
|
40
|
+
* This should be called by the renderer after writing selection mask
|
|
41
|
+
*/
|
|
42
|
+
setSelectionMaskTarget(target: WebGLRenderTarget | null): void;
|
|
43
|
+
/**
|
|
44
|
+
* Set whether there's an active selection
|
|
45
|
+
*/
|
|
46
|
+
setHasSelection(value: boolean): void;
|
|
47
|
+
/**
|
|
48
|
+
* Update outline options
|
|
49
|
+
*/
|
|
50
|
+
setOptions(options: Partial<StencilSelectionOutlineOptions>): void;
|
|
51
|
+
render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget, _deltaTime?: number, _maskActive?: boolean): void;
|
|
52
|
+
setSize(width: number, height: number): void;
|
|
53
|
+
dispose(): void;
|
|
54
|
+
}
|
|
@@ -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,62 @@ 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;
|
|
187
|
+
/** Whether alpha selection outline is enabled (default: false, as it requires opt-in) */
|
|
188
|
+
private _alphaSelectionOutlineEnabled;
|
|
189
|
+
/**
|
|
190
|
+
* Update alpha selection outline state
|
|
191
|
+
* This is MUCH faster than updateSelectionOutline() - no geometry copying needed
|
|
192
|
+
*/
|
|
193
|
+
updateAlphaSelectionOutline(): void;
|
|
194
|
+
/**
|
|
195
|
+
* Enable alpha selection outline effect
|
|
196
|
+
* This is the FAST outline mode - constant cost regardless of selection size
|
|
197
|
+
*/
|
|
198
|
+
enableAlphaSelectionOutline(): void;
|
|
199
|
+
/**
|
|
200
|
+
* Disable alpha selection outline effect
|
|
201
|
+
*/
|
|
202
|
+
disableAlphaSelectionOutline(): void;
|
|
203
|
+
/**
|
|
204
|
+
* Set whether alpha selection outline mode is enabled
|
|
205
|
+
* This is the recommended mode for large selections (1000+ elements)
|
|
206
|
+
* @param enabled - true to enable, false to disable
|
|
207
|
+
*/
|
|
208
|
+
setAlphaSelectionOutlineMode(enabled: boolean): void;
|
|
209
|
+
/**
|
|
210
|
+
* Get whether alpha selection outline mode is enabled
|
|
211
|
+
*/
|
|
212
|
+
get alphaSelectionOutlineEnabled(): boolean;
|
|
213
|
+
/**
|
|
214
|
+
* Bypass alpha selection outline (fast, for camera movement)
|
|
215
|
+
*/
|
|
216
|
+
bypassAlphaSelectionOutline(): void;
|
|
217
|
+
/**
|
|
218
|
+
* Resume alpha selection outline after bypass
|
|
219
|
+
*/
|
|
220
|
+
resumeAlphaSelectionOutline(): void;
|
|
147
221
|
enableNight(): void;
|
|
148
222
|
disableNight(): void;
|
|
149
223
|
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
|
}>;
|