viral-viewer-2 7.2.4 → 7.2.5
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/custom-objects/viral-bim-world.d.ts +0 -6
- package/dist/components/post-processing/post-processing-renderer.d.ts +5 -0
- package/dist/components/post-processing/selection-outline-pass.d.ts +21 -16
- package/dist/components/visibility-manager/viral-visibility-manager.d.ts +4 -7
- package/dist/index.mjs +996 -1013
- package/package.json +1 -1
- package/dist/components/worker/merge-positions.worker.d.ts +0 -19
- package/dist/components/worker-script/merge-positions.script.d.ts +0 -1
|
@@ -11,7 +11,6 @@ import { ViralInstancedMeshV2 } from "./viral-instanced-mesh-v2";
|
|
|
11
11
|
*/
|
|
12
12
|
export declare class ViralBIMWorld extends Mesh {
|
|
13
13
|
workerPool: WorkerThreadPool | null;
|
|
14
|
-
private _mergePositionsWorker;
|
|
15
14
|
bimModels: ViralBIMModel[];
|
|
16
15
|
constructor();
|
|
17
16
|
private _initializeWorkerPool;
|
|
@@ -99,11 +98,6 @@ export declare class ViralBIMWorld extends Mesh {
|
|
|
99
98
|
* @returns Float32Array of positions or null if no selection
|
|
100
99
|
*/
|
|
101
100
|
getSelectedElementsPositions(): Float32Array | null;
|
|
102
|
-
/**
|
|
103
|
-
* Async version — offloads vertex merging to a Web Worker so the main thread stays unblocked.
|
|
104
|
-
* Automatically cancels any in-flight request when called again.
|
|
105
|
-
*/
|
|
106
|
-
getSelectedElementsPositionsAsync(): Promise<Float32Array | null>;
|
|
107
101
|
/**
|
|
108
102
|
* Changes the color of multiple elements in the merged mesh.
|
|
109
103
|
* Works with RGBA color buffer (preserves existing alpha values)
|
|
@@ -127,6 +127,11 @@ export declare class PostProcessingRenderer {
|
|
|
127
127
|
* @param positions - Merged Float32Array of selected element positions, or null to clear
|
|
128
128
|
*/
|
|
129
129
|
updateSelectionOutline(positions: Float32Array | null): void;
|
|
130
|
+
/**
|
|
131
|
+
* Notify the outline pass whether elements are currently selected.
|
|
132
|
+
* The GPU reads selection state directly from vertex colors — no data transfer needed.
|
|
133
|
+
*/
|
|
134
|
+
setSelectionOutlineActive(hasSelection: boolean): void;
|
|
130
135
|
/**
|
|
131
136
|
* Enable selection outline rendering
|
|
132
137
|
*/
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import type { Camera, WebGLRenderer } from "three";
|
|
2
|
-
import { Color,
|
|
1
|
+
import type { Camera, Vector2, WebGLRenderer } from "three";
|
|
2
|
+
import { Color, type Scene, WebGLRenderTarget } from "three";
|
|
3
3
|
import { Pass } from "three/examples/jsm/postprocessing/Pass";
|
|
4
4
|
/**
|
|
5
5
|
* Selection Outline Pass
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* GPU-based outline effect for selected elements.
|
|
8
|
+
* Renders the scene with a filter shader that outputs white only for
|
|
9
|
+
* fragments matching the selection color — zero CPU vertex work.
|
|
10
|
+
*
|
|
11
|
+
* Cost: 1-2 extra draw calls (mask render with overrideMaterial) + 1 fullscreen Sobel pass
|
|
9
12
|
*
|
|
10
13
|
* Process:
|
|
11
|
-
* 1. Render
|
|
14
|
+
* 1. Render entire scene with overrideMaterial that filters by SELECT_COLOR
|
|
12
15
|
* 2. Sobel edge detection on mask
|
|
13
16
|
* 3. Composite colored edges over scene
|
|
14
17
|
*/
|
|
@@ -25,32 +28,33 @@ export interface SelectionOutlineOptions {
|
|
|
25
28
|
occludedOpacity: number;
|
|
26
29
|
}
|
|
27
30
|
export declare class SelectionOutlinePass extends Pass {
|
|
31
|
+
private scene;
|
|
28
32
|
private camera;
|
|
29
33
|
private resolution;
|
|
30
34
|
private options;
|
|
31
35
|
private maskRenderTarget;
|
|
32
36
|
private maskDepthRenderTarget;
|
|
33
|
-
private
|
|
37
|
+
private selectionFilterMaterial;
|
|
38
|
+
private selectionFilterMaterialDepth;
|
|
34
39
|
private outlineMaterial;
|
|
35
40
|
private copyMaterial;
|
|
36
|
-
private maskScene;
|
|
37
|
-
private selectionMesh;
|
|
38
|
-
private selectionGeometry;
|
|
39
|
-
private selectionBuffer;
|
|
40
|
-
private selectionAttribute;
|
|
41
41
|
private fsQuad;
|
|
42
42
|
private hasSelection;
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
44
|
+
* FAST TOGGLE:
|
|
45
45
|
* - `bypass = false`: Full outline rendering (normal mode)
|
|
46
46
|
* - `bypass = true`: Pass runs but just copies input to output (very fast, no mask render)
|
|
47
47
|
*/
|
|
48
48
|
bypass: boolean;
|
|
49
|
-
constructor(
|
|
49
|
+
constructor(scene: Scene, camera: Camera, resolution: Vector2, options?: Partial<SelectionOutlineOptions>);
|
|
50
|
+
/**
|
|
51
|
+
* Notify the pass whether there is an active selection.
|
|
52
|
+
* No data transfer needed — the GPU reads selection state from vertex colors.
|
|
53
|
+
*/
|
|
54
|
+
setHasSelection(hasSelection: boolean): void;
|
|
50
55
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* @param positions - Merged Float32Array of all selected element positions
|
|
56
|
+
* Legacy method — kept for backward compatibility.
|
|
57
|
+
* With the GPU-based approach, this just toggles hasSelection.
|
|
54
58
|
*/
|
|
55
59
|
updateSelectionGeometry(positions: Float32Array | null): void;
|
|
56
60
|
/**
|
|
@@ -62,6 +66,7 @@ export declare class SelectionOutlinePass extends Pass {
|
|
|
62
66
|
*/
|
|
63
67
|
setOptions(options: Partial<SelectionOutlineOptions>): void;
|
|
64
68
|
render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget, _deltaTime?: number, _maskActive?: boolean): void;
|
|
69
|
+
private _renderCopyPass;
|
|
65
70
|
setSize(width: number, height: number): void;
|
|
66
71
|
dispose(): void;
|
|
67
72
|
}
|
|
@@ -5,15 +5,13 @@ export declare class ViralVisibilityManager {
|
|
|
5
5
|
private viralViewerApi;
|
|
6
6
|
/** Whether selection outline is enabled (default: true) */
|
|
7
7
|
private _selectionOutlineEnabled;
|
|
8
|
-
/** Whether an outline update is already scheduled for the next frame */
|
|
9
|
-
private _outlineUpdateScheduled;
|
|
10
8
|
constructor(viralViewerApi: ViralViewerApi);
|
|
11
9
|
/**
|
|
12
10
|
* show all elements and reset back to normal visualization
|
|
13
11
|
*/
|
|
14
12
|
showAll2(): void;
|
|
15
13
|
/**
|
|
16
|
-
*
|
|
14
|
+
* Hide all elements (sets all meshes invisible)
|
|
17
15
|
*/
|
|
18
16
|
hideAllElements(): void;
|
|
19
17
|
/**
|
|
@@ -170,11 +168,10 @@ export declare class ViralVisibilityManager {
|
|
|
170
168
|
*/
|
|
171
169
|
updateSelectionOutline(): void;
|
|
172
170
|
/**
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
* Uses Web Worker to avoid blocking the main thread.
|
|
171
|
+
* Notify the outline pass whether there is an active selection.
|
|
172
|
+
* The GPU reads selection state directly from vertex colors — no CPU work needed.
|
|
176
173
|
*/
|
|
177
|
-
private
|
|
174
|
+
private notifySelectionOutline;
|
|
178
175
|
/**
|
|
179
176
|
* Enable selection outline effect
|
|
180
177
|
*/
|