viral-viewer-2 7.2.0 → 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.
Files changed (74) hide show
  1. package/dist/batched-mesh-simplifier-D-o3ukyo.mjs +128 -0
  2. package/dist/components/animation/viral-animation.d.ts +1 -1
  3. package/dist/components/avatar-manager/viral-avatar-manager.d.ts +1 -1
  4. package/dist/components/camera/viral-camera.d.ts +9 -8
  5. package/dist/components/custom-objects/index.d.ts +2 -3
  6. package/dist/components/custom-objects/viral-avatar.d.ts +2 -2
  7. package/dist/components/custom-objects/viral-batched-mesh.d.ts +14 -4
  8. package/dist/components/custom-objects/{viral-merged-model.d.ts → viral-bim-world.d.ts} +14 -6
  9. package/dist/components/custom-objects/viral-bim.model.d.ts +11 -0
  10. package/dist/components/custom-objects/viral-instanced-mesh-v2.d.ts +14 -3
  11. package/dist/components/data-manager/viral-data-manager.d.ts +1 -1
  12. package/dist/components/duplication-analyzer/viral-duplication-analyzer.d.ts +1 -1
  13. package/dist/components/event-handler/keyboard/viral-keyboard.d.ts +1 -1
  14. package/dist/components/event-handler/mouse/viral-mouse.d.ts +1 -4
  15. package/dist/components/event-handler/viral-centralized-event-handler.d.ts +1 -10
  16. package/dist/components/event-handler/viral-lifecycle-event-handler.d.ts +2 -2
  17. package/dist/components/loader/viral-point-cloud.loader.d.ts +2 -2
  18. package/dist/components/loader/viral-revit.loader.d.ts +3 -4
  19. package/dist/components/loader/viral-three.loader.d.ts +2 -2
  20. package/dist/components/loader/viral.loader.d.ts +1 -1
  21. package/dist/components/material/viral-material-manager.d.ts +2 -2
  22. package/dist/components/post-processing/post-processing-renderer.d.ts +51 -6
  23. package/dist/components/post-processing/screen-space-edges-pass.d.ts +7 -1
  24. package/dist/components/post-processing/selection-outline-pass.d.ts +65 -0
  25. package/dist/components/renderer/viral-renderer.d.ts +1 -1
  26. package/dist/components/scene/viral-scene.d.ts +4 -7
  27. package/dist/components/section-box/viral-section-box.d.ts +66 -25
  28. package/dist/components/stats/viral-stats.d.ts +1 -1
  29. package/dist/components/visibility-manager/viral-visibility-manager.d.ts +44 -24
  30. package/dist/components/worker/bounding-box-intersect.worker.d.ts +1 -1
  31. package/dist/components/worker/bounding-box.worker.d.ts +1 -1
  32. package/dist/components/worker/graph-layout.worker.d.ts +1 -1
  33. package/dist/components/worker/{load-element-batch.worker.d.ts → load-batched-element.worker.d.ts} +3 -3
  34. package/dist/entities/archive-elements.d.ts +1 -1
  35. package/dist/entities/data-tree.d.ts +7 -2
  36. package/dist/entities/index.d.ts +9 -9
  37. package/dist/gui/batch-debug-panel/viral-batch-debug-panel.d.ts +1 -1
  38. package/dist/gui/context-menu/viral-context-menu.d.ts +1 -1
  39. package/dist/gui/draggable-modal/viral-draggable-modal.d.ts +1 -1
  40. package/dist/gui/instanced-debug-panel/viral-instanced-debug-panel.d.ts +1 -1
  41. package/dist/gui/navigation-cube/components/cube-camera.d.ts +2 -2
  42. package/dist/gui/navigation-cube/components/cube-renderer.d.ts +1 -1
  43. package/dist/gui/navigation-cube/components/cube-scene.d.ts +2 -2
  44. package/dist/gui/navigation-cube/components/cube.mouse.d.ts +1 -1
  45. package/dist/gui/navigation-cube/viral-navigation-cube.d.ts +2 -2
  46. package/dist/gui/pivot-point/viral-pivot-point.d.ts +1 -1
  47. package/dist/gui/render-debug-panel/viral-render-debug-panel.d.ts +1 -1
  48. package/dist/gui/spinner/viral-spinner.d.ts +1 -1
  49. package/dist/gui/tools/tools/viral-tool-ambient-occlusion.d.ts +2 -2
  50. package/dist/gui/tools/tools/viral-tool-avatar.d.ts +2 -2
  51. package/dist/gui/tools/tools/viral-tool-dark-mode.d.ts +2 -2
  52. package/dist/gui/tools/tools/viral-tool-elevation.d.ts +3 -3
  53. package/dist/gui/tools/tools/viral-tool-export-scene.d.ts +2 -2
  54. package/dist/gui/tools/tools/viral-tool-measure.d.ts +3 -3
  55. package/dist/gui/tools/tools/viral-tool-sunlight.d.ts +2 -2
  56. package/dist/gui/tools/viral-tools.d.ts +2 -2
  57. package/dist/index.d.ts +8 -8
  58. package/dist/index.mjs +10808 -35
  59. package/dist/utils/batched-mesh-simplifier.d.ts +2 -2
  60. package/dist/utils/geometry-simplifier.d.ts +1 -1
  61. package/dist/viral-viewer-api.d.ts +19 -21
  62. package/package.json +49 -42
  63. package/dist/batched-mesh-simplifier-Bqx1Evd9.mjs +0 -1076
  64. package/dist/components/custom-objects/viral-edge-mesh.d.ts +0 -133
  65. package/dist/components/custom-objects/viral-instanced-mesh-v3.d.ts +0 -123
  66. package/dist/components/custom-objects/viral-instanced-mesh.d.ts +0 -41
  67. package/dist/components/custom-objects/viral-main.model.d.ts +0 -16
  68. package/dist/components/custom-objects/viral-mesh.abstract.d.ts +0 -3
  69. package/dist/components/custom-objects/viral-mesh.d.ts +0 -13
  70. package/dist/components/custom-objects/viral-seperate-model.d.ts +0 -18
  71. package/dist/components/handler/geometry.handler.d.ts +0 -12
  72. package/dist/components/lod-generator/viral-lod-generator.d.ts +0 -116
  73. package/dist/index-DRYwg_CR.mjs +0 -326870
  74. /package/dist/components/worker-script/{load-element-batch.script.d.ts → load-batched-element.script.d.ts} +0 -0
@@ -0,0 +1,128 @@
1
+ import { BufferGeometry as $, BufferAttribute as S } from "three";
2
+ import { ViralBatchedMesh as B } from "./index.mjs";
3
+ import { MeshoptSimplifier as w } from "meshoptimizer";
4
+ let x = !1;
5
+ w.ready.then(() => {
6
+ x = !0, console.log("✅ MeshoptSimplifier ready");
7
+ }).catch((t) => {
8
+ console.error("❌ MeshoptSimplifier failed to load:", t);
9
+ });
10
+ async function A(t, a, e) {
11
+ if (x || await w.ready, t.length === 0 || a.length === 0)
12
+ throw new Error("Simplify: empty indices or positions array");
13
+ if (t.length % 3 !== 0)
14
+ throw new Error("Simplify: indices length must be a multiple of 3 (triangles)");
15
+ if (a.length % 3 !== 0)
16
+ throw new Error("Simplify: positions length must be a multiple of 3 (x,y,z)");
17
+ let i;
18
+ t instanceof Uint32Array ? i = t : t instanceof Uint16Array || t instanceof Uint8Array ? i = new Uint32Array(t) : i = new Uint32Array(t);
19
+ const s = a instanceof Float32Array ? a : new Float32Array(a), c = e.error ?? 0.01, n = e.ratio ?? 0.5, o = Math.floor(i.length / 3), d = Math.max(1, Math.floor(o * n)) * 3, g = [];
20
+ e.lockBorder && g.push("LockBorder"), e.sparse && g.push("Sparse"), e.errorAbsolute && g.push("ErrorAbsolute"), e.prune && g.push("Prune");
21
+ try {
22
+ const m = w.simplify(
23
+ i,
24
+ s,
25
+ 3,
26
+ // stride: 3 floats per vertex (x, y, z)
27
+ d,
28
+ c,
29
+ g.length > 0 ? g : void 0
30
+ ), r = m[0], f = m[1];
31
+ e.logAppearanceError && console.log(`Simplify: appearance error: ${f}`);
32
+ const u = ((1 - r.length / i.length) * 100).toFixed(
33
+ 1
34
+ );
35
+ r.length === i.length ? console.warn(
36
+ `Simplify: no reduction achieved (tried ratio=${n}, error=${c}). Consider increasing error tolerance or decreasing ratio.`
37
+ ) : console.log(
38
+ `✅ Simplification: ${i.length} → ${r.length} indices (${u}% reduction)`
39
+ );
40
+ const h = s.length / 3;
41
+ if (e.optimizeMemory && h <= 65535)
42
+ if (h <= 255) {
43
+ const y = new Uint8Array(r.length);
44
+ for (let l = 0; l < r.length; l++)
45
+ y[l] = r[l];
46
+ return [y, f];
47
+ } else {
48
+ const y = new Uint16Array(r.length);
49
+ for (let l = 0; l < r.length; l++)
50
+ y[l] = r[l];
51
+ return [y, f];
52
+ }
53
+ return [r, f];
54
+ } catch (m) {
55
+ throw console.error("Simplify failed:", m), m;
56
+ }
57
+ }
58
+ async function I(t, a) {
59
+ const e = t.buffer, i = e.length / 3;
60
+ if (i < 50)
61
+ return t;
62
+ const s = /* @__PURE__ */ new Map(), c = [], n = [], o = 1e-4;
63
+ for (let r = 0; r < i; r++) {
64
+ const f = e[r * 3], u = e[r * 3 + 1], h = e[r * 3 + 2], y = `${Math.round(f / o)},${Math.round(u / o)},${Math.round(h / o)}`;
65
+ let l = s.get(y);
66
+ l === void 0 && (l = c.length / 3, s.set(y, l), c.push(f, u, h)), n.push(l);
67
+ }
68
+ if (c.length / 3 >= i * 0.95)
69
+ return t;
70
+ const d = new Float32Array(c), g = new Uint32Array(n), m = {
71
+ ...a,
72
+ ratio: a.ratio ?? 0.5
73
+ };
74
+ try {
75
+ const [r] = await A(g, d, m);
76
+ if (r.length === 0 || r.length < 3)
77
+ return console.warn(
78
+ `Element ${t.elementId} simplified to ${r.length} indices (too small), keeping original`
79
+ ), t;
80
+ if (r.length === g.length)
81
+ return t;
82
+ const f = new Float32Array(r.length * 3);
83
+ for (let u = 0; u < r.length; u++) {
84
+ const h = r[u];
85
+ f[u * 3] = d[h * 3], f[u * 3 + 1] = d[h * 3 + 1], f[u * 3 + 2] = d[h * 3 + 2];
86
+ }
87
+ return {
88
+ ...t,
89
+ buffer: f
90
+ };
91
+ } catch (r) {
92
+ return console.warn(`Simplification failed for element ${t.elementId}:`, r), t;
93
+ }
94
+ }
95
+ async function C(t, a, e = 100) {
96
+ const i = [];
97
+ for (let s = 0; s < t.length; s += e) {
98
+ const n = t.slice(s, s + e).map((p) => !p.buffer || p.buffer.length < 9 ? Promise.resolve(p) : I(p, a).catch((d) => (console.warn(`Failed to simplify element ${p.elementId}:`, d), p))), o = await Promise.all(n);
99
+ if (i.push(...o), t.length > 1e3) {
100
+ const p = Math.min(100, (s + e) / t.length * 100);
101
+ console.log(`📊 Simplification progress: ${p.toFixed(1)}%`);
102
+ }
103
+ }
104
+ return i;
105
+ }
106
+ async function E(t, a) {
107
+ const e = t.geometry;
108
+ if (!e.index)
109
+ throw new Error("Batched mesh geometry must be indexed");
110
+ console.log(`🚀 Fast simplification: ${e.index.count} indices...`);
111
+ const i = e.index.array, s = e.attributes.position.array, [c] = await A(i, s, a);
112
+ console.log(
113
+ `✅ Fast simplification: ${i.length} → ${c.length} indices (${((1 - c.length / i.length) * 100).toFixed(1)}% reduction)`
114
+ );
115
+ const n = new $();
116
+ n.setAttribute("position", e.attributes.position.clone()), e.attributes.color && n.setAttribute("color", e.attributes.color.clone()), n.setIndex(new S(c, 1)), n.computeBoundingBox(), n.computeBoundingSphere();
117
+ const o = new B(
118
+ n,
119
+ Array.isArray(t.material) ? t.material[0] : t.material,
120
+ void 0
121
+ // Worker pool not needed for already-built geometry
122
+ );
123
+ return o.globalMaterialIndex = t.globalMaterialIndex, o.castShadow = t.castShadow, o.receiveShadow = t.receiveShadow, o.position.copy(t.position), o.rotation.copy(t.rotation), o.scale.copy(t.scale), o;
124
+ }
125
+ export {
126
+ E as simplifyBatchedMeshFast,
127
+ C as simplifyBufferElementsBatch
128
+ };
@@ -1,5 +1,5 @@
1
1
  import { Clock } from "three";
2
- import { ViralViewerApi } from "../../viral-viewer-api";
2
+ import type { ViralViewerApi } from "../../viral-viewer-api";
3
3
  export declare class ViralAnimation {
4
4
  viralViewerApi: ViralViewerApi;
5
5
  clock: Clock;
@@ -1,4 +1,4 @@
1
- import { ViralViewerApi } from "../..";
1
+ import type { ViralViewerApi } from "../..";
2
2
  import { ViralAvatar } from "../custom-objects/viral-avatar";
3
3
  export declare class ViralAvatarManager {
4
4
  private viralViewerApi;
@@ -1,7 +1,7 @@
1
1
  import CameraControls from "camera-controls";
2
- import { ViralViewerApi } from "../../viral-viewer-api";
3
- import { Vector3, Raycaster, PerspectiveCamera, Object3D, OrthographicCamera } from "three";
4
- import { ViralCameraEventType, ViralViewerState } from "../..";
2
+ import { type Object3D, OrthographicCamera, PerspectiveCamera, Raycaster, Vector3 } from "three";
3
+ import { ViralCameraEventType, type ViralutionCamera, type ViralViewerState } from "../..";
4
+ import type { ViralViewerApi } from "../../viral-viewer-api";
5
5
  export declare class ViralCamera {
6
6
  viralViewerApi: ViralViewerApi;
7
7
  raycaster: Raycaster;
@@ -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
  }
@@ -1,4 +1,3 @@
1
- import { ViralInstancedMesh } from "./viral-instanced-mesh";
2
1
  import { ViralBatchedMesh } from "./viral-batched-mesh";
3
- import { ViralMergedModel } from "./viral-merged-model";
4
- export { ViralInstancedMesh, ViralMergedModel, ViralBatchedMesh };
2
+ import { ViralBIMWorld } from "./viral-bim-world";
3
+ export { ViralBIMWorld, ViralBatchedMesh };
@@ -1,5 +1,5 @@
1
- import { Object3D, Vector3 } from "three";
2
- import { ViralViewerApi } from "../..";
1
+ import { type Object3D, Vector3 } from "three";
2
+ import { type ViralViewerApi } from "../..";
3
3
  export declare class ViralAvatar {
4
4
  private viralViewerApi;
5
5
  scaleRatio: number;
@@ -1,10 +1,11 @@
1
- import { Box3, BufferGeometry, Color, Material, Mesh, Vector3 } from "three";
2
- import { BufferElement } from "../..";
3
- import { LineMaterial } from "three/examples/jsm/Addons";
4
- import { WorkerThreadPool } from "../worker/base/worker-pool";
1
+ import { Box3, BufferGeometry, type Color, type Material, Mesh, Vector3 } from "three";
2
+ import { type LineMaterial } from "three/examples/jsm/Addons";
3
+ import { type BufferElement } from "../..";
4
+ import type { WorkerThreadPool } from "../worker/base/worker-pool";
5
5
  export declare class ViralBatchedMesh extends Mesh {
6
6
  globalMaterialIndex: number;
7
7
  private workerPool;
8
+ private _depthPrePassMesh;
8
9
  constructor(geometry?: BufferGeometry, material?: Material, workerPool?: WorkerThreadPool | null);
9
10
  /**
10
11
  * *for tracking and manage element visibility, for instance hide object
@@ -200,6 +201,15 @@ export declare class ViralBatchedMesh extends Mesh {
200
201
  modelId: string;
201
202
  elementId: string;
202
203
  }[], ghostOpacity?: number): void;
204
+ /**
205
+ * Create a depth-only pre-pass mesh that writes depth for focused elements.
206
+ * Shares the same geometry; uses alphaTest to discard ghost fragments.
207
+ */
208
+ private _createDepthPrePass;
209
+ /**
210
+ * Remove and dispose the depth pre-pass mesh
211
+ */
212
+ private _removeDepthPrePass;
203
213
  /**
204
214
  * Reset all element opacities to fully opaque and restore original colors
205
215
  */
@@ -1,15 +1,17 @@
1
1
  import { Box3, Mesh } from "three";
2
+ import { type BufferElement } from "../..";
3
+ import { WorkerThreadPool } from "../worker/base/worker-pool";
2
4
  import { ViralBatchedMesh } from "./viral-batched-mesh";
3
- import { BufferElement } from "../..";
5
+ import type { ViralBIMModel } from "./viral-bim.model";
4
6
  import { ViralInstancedMeshV2 } from "./viral-instanced-mesh-v2";
5
- import { WorkerThreadPool } from "../worker/base/worker-pool";
6
7
  /**
7
- * this class is a wrapper, it stand for a clone of bim model (optimize version to increase performance when render)
8
- * it merge geometries follow material.
8
+ * this class is a wrapper, it stand for a world of bim models
9
+ * it merge geometries follow material or using instanced mesh.
9
10
  *
10
11
  */
11
- export declare class ViralMergedModel extends Mesh {
12
+ export declare class ViralBIMWorld extends Mesh {
12
13
  workerPool: WorkerThreadPool | null;
14
+ bimModels: ViralBIMModel[];
13
15
  constructor();
14
16
  private _initializeWorkerPool;
15
17
  get bounds(): Box3;
@@ -24,7 +26,6 @@ export declare class ViralMergedModel extends Mesh {
24
26
  */
25
27
  getDiagnostics(): {
26
28
  totalChildren: number;
27
- edgeMeshes: number;
28
29
  batchedMeshesInChildren: number;
29
30
  batchedMeshesInArray: number;
30
31
  instancedMeshes: number;
@@ -90,6 +91,13 @@ export declare class ViralMergedModel extends Mesh {
90
91
  modelId: string;
91
92
  elementId: string;
92
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;
93
101
  /**
94
102
  * Changes the color of multiple elements in the merged mesh.
95
103
  * Works with RGBA color buffer (preserves existing alpha values)
@@ -0,0 +1,11 @@
1
+ import { Dictionary, type RenderMaterial, type ViralutionElement } from "../..";
2
+ /**
3
+ * this is a wrapper to manage whole BIM Model
4
+ */
5
+ export declare class ViralBIMModel {
6
+ modelId: number;
7
+ elements: ViralutionElement[];
8
+ materials: RenderMaterial[];
9
+ mapMaterialsToMaterialManager: Dictionary<number, number>;
10
+ dispose(): void;
11
+ }
@@ -1,9 +1,10 @@
1
- import { Box3, BufferGeometry, Color, Material, Vector3, Matrix4, InstancedMesh, Object3D } from "three";
2
- import { BufferElement } from "../..";
3
- import { LineMaterial } from "three/examples/jsm/Addons";
1
+ import { Box3, BufferGeometry, Color, InstancedMesh, type Material, Matrix4, Object3D, Vector3 } from "three";
2
+ import { type LineMaterial } from "three/examples/jsm/Addons";
3
+ import { type BufferElement } from "../..";
4
4
  export declare class ViralInstancedMeshV2 extends Object3D {
5
5
  protected material?: Material | undefined;
6
6
  globalMaterialIndex: number;
7
+ private _depthPrePassMeshes;
7
8
  constructor(material?: Material | undefined);
8
9
  protected _instancedMeshes: Map<string, InstancedMesh<BufferGeometry<import("three").NormalBufferAttributes, import("three").BufferGeometryEventMap>, Material | Material[], import("three").InstancedMeshEventMap>>;
9
10
  _bufferElements: BufferElement[];
@@ -208,6 +209,16 @@ export declare class ViralInstancedMeshV2 extends Object3D {
208
209
  modelId: string;
209
210
  elementId: string;
210
211
  }[], ghostOpacity?: number): void;
212
+ /**
213
+ * Create depth-only pre-pass instanced meshes that write depth for focused instances.
214
+ * Shares the same geometry (including instanceOpacity attribute); uses shader discard
215
+ * to skip ghost instances (opacity < 0.5).
216
+ */
217
+ private _createDepthPrePass;
218
+ /**
219
+ * Remove and dispose all depth pre-pass meshes
220
+ */
221
+ private _removeDepthPrePass;
211
222
  /**
212
223
  * Desaturate instance color (turn whitish)
213
224
  * @param modelId - Model ID
@@ -1,4 +1,4 @@
1
- import { CheckClashResult, CompareModelsResult, DataTree, GroupByResult, ViralutionInformation, ViralutionTrackingModel, ViralViewerApi } from "../..";
1
+ import { CheckClashResult, CompareModelsResult, DataTree, GroupByResult, type ViralutionInformation, type ViralutionTrackingModel, type ViralViewerApi } from "../..";
2
2
  export declare class ViralDataManager {
3
3
  viralViewerApi: ViralViewerApi;
4
4
  dataTree: DataTree[];
@@ -1,4 +1,4 @@
1
- import { ViralutionElement } from "../../..";
1
+ import type { ViralutionElement } from "../..";
2
2
  export interface DuplicationAnalysis {
3
3
  strategy: "BATCHING" | "INSTANCING" | "HYBRID";
4
4
  totalElements: number;
@@ -1,4 +1,4 @@
1
- import { ViralKeyboardEventType, ViralViewerApi } from "../../..";
1
+ import { ViralKeyboardEventType, type ViralViewerApi } from "../../..";
2
2
  export declare class ViralKeyboard {
3
3
  viralViewerApi: ViralViewerApi;
4
4
  constructor(viralViewerApi: ViralViewerApi);
@@ -1,6 +1,6 @@
1
1
  import { Vector2 } from "three";
2
- import { ViralViewerApi } from "../../../viral-viewer-api";
3
2
  import { ViralMouseEventType } from "../../..";
3
+ import type { ViralViewerApi } from "../../../viral-viewer-api";
4
4
  export declare class ViralMouse {
5
5
  viralViewerApi: ViralViewerApi;
6
6
  position: Vector2;
@@ -22,9 +22,6 @@ export declare class ViralMouse {
22
22
  addEventListener(type: ViralMouseEventType, key: string, resolve: (result: any) => void): void;
23
23
  removeEventListener(type: ViralMouseEventType, key: string): void;
24
24
  getAllEventListener(): void;
25
- private hoverMeshes;
26
- private hover;
27
- private reverseColor;
28
25
  private setupMouseDown;
29
26
  private handleClick;
30
27
  private setupMouseUp;
@@ -1,4 +1,4 @@
1
- import { ViralViewerApi } from "../../viral-viewer-api";
1
+ import type { ViralViewerApi } from "../../viral-viewer-api";
2
2
  export declare class ViralCentralizedEventHandler {
3
3
  viralViewerApi: ViralViewerApi;
4
4
  private _visibilityManager;
@@ -16,15 +16,6 @@ export declare class ViralCentralizedEventHandler {
16
16
  private resizeObserver;
17
17
  windowHandler(): void;
18
18
  disposeWindowHandler(): void;
19
- private _hoverElementEnable;
20
- hoverElementHandler(): void;
21
- enableHoverElement(value: boolean): void;
22
- private _selectElementEnable;
23
- /**
24
- * @deprecated use selectElementHandler2 instead
25
- */
26
- selectElementHandler(): void;
27
- enableSelectElement(value: boolean): void;
28
19
  selectElementHandler2(): void;
29
20
  doubleClickElementHandler(): void;
30
21
  isShiftPressed: boolean;
@@ -1,5 +1,5 @@
1
- import { ViewerOptions } from "../../..";
2
- import { ViralViewerApi } from "../../viral-viewer-api";
1
+ import { type ViewerOptions } from "../..";
2
+ import type { ViralViewerApi } from "../../viral-viewer-api";
3
3
  export declare class ViralLifecycleEventHandler {
4
4
  private viralViewerApi;
5
5
  options: ViewerOptions;
@@ -1,5 +1,5 @@
1
- import { Potree, PointCloudOctree } from "potree-core-viral";
2
- import { ViralViewerApi } from "../../viral-viewer-api";
1
+ import { type PointCloudOctree, Potree } from "potree-core-viral";
2
+ import type { ViralViewerApi } from "../../viral-viewer-api";
3
3
  export declare class ViralPointCloudLoader {
4
4
  viralViewerApi: ViralViewerApi;
5
5
  potree: Potree;
@@ -1,14 +1,13 @@
1
- import { ViralViewerApi } from "../../viral-viewer-api";
2
- import { ViralutionElement, ViralutionTrackingModel } from "../..";
1
+ import { type ViralutionElement } from "../..";
2
+ import type { ViralViewerApi } from "../../viral-viewer-api";
3
3
  export declare class ViralRevitLoader {
4
4
  viralViewerApi: ViralViewerApi;
5
5
  elements: ViralutionElement[];
6
- private _loadElementBatchWorker;
6
+ private _loadBatchedElementWorker;
7
7
  constructor(viralViewerApi: ViralViewerApi);
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;
@@ -1,6 +1,6 @@
1
1
  import { ObjectLoader } from "three";
2
- import { ViralViewerApi } from "../../viral-viewer-api";
3
- import { GLTF, GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader";
2
+ import { type GLTF, GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader";
3
+ import type { ViralViewerApi } from "../../viral-viewer-api";
4
4
  export declare class ViralThreeLoader {
5
5
  viralViewerApi: ViralViewerApi;
6
6
  objectLoader: ObjectLoader;
@@ -1,4 +1,4 @@
1
- import { ViralViewerApi } from "../../viral-viewer-api";
1
+ import type { ViralViewerApi } from "../../viral-viewer-api";
2
2
  import { ViralPointCloudLoader } from "./viral-point-cloud.loader";
3
3
  import { ViralRevitLoader } from "./viral-revit.loader";
4
4
  import { ViralThreeLoader } from "./viral-three.loader";
@@ -1,6 +1,6 @@
1
- import { Material, MeshPhongMaterial, MeshStandardMaterial } from "three";
2
- import { ViralViewerApi } from "../../viral-viewer-api";
1
+ import { type Material, MeshPhongMaterial, MeshStandardMaterial } from "three";
3
2
  import { LineMaterial } from "three/examples/jsm/lines/LineMaterial";
3
+ import type { ViralViewerApi } from "../../viral-viewer-api";
4
4
  export declare class ViralMaterialManager {
5
5
  private viralViewerApi;
6
6
  hoverMaterial: MeshPhongMaterial;
@@ -1,12 +1,13 @@
1
- import { Camera, Color, Scene, WebGLRenderer } from "three";
2
- import { EffectComposer } from "three/examples/jsm/postprocessing/EffectComposer";
3
- import { SMAAPass } from "three/examples/jsm/postprocessing/SMAAPass";
4
- import { ShaderPass } from "three/examples/jsm/postprocessing/ShaderPass";
1
+ import { type Camera, Color, type Scene, type WebGLRenderer } from "three";
5
2
  import { SAOPass, SSAARenderPass, SSAOPass, TAARenderPass } from "three/examples/jsm/Addons";
6
- import { ViralViewerApi } from "../..";
3
+ import { EffectComposer } from "three/examples/jsm/postprocessing/EffectComposer";
7
4
  import { OutlinePass } from "three/examples/jsm/postprocessing/OutlinePass";
5
+ import { ShaderPass } from "three/examples/jsm/postprocessing/ShaderPass";
6
+ import { SMAAPass } from "three/examples/jsm/postprocessing/SMAAPass";
7
+ import { type ViralViewerApi } from "../..";
8
8
  import { DevicePerformanceChecker } from "../../utils/device";
9
- import { ScreenSpaceEdgesPass, ScreenSpaceEdgesOptions } from "./screen-space-edges-pass";
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
  }
@@ -1,4 +1,4 @@
1
- import { Camera, Color, Scene, Vector2, WebGLRenderer, WebGLRenderTarget } from "three";
1
+ import { type Camera, Color, type Object3D, type Scene, Vector2, type WebGLRenderer, WebGLRenderTarget } from "three";
2
2
  import { Pass } from "three/examples/jsm/postprocessing/Pass";
3
3
  /**
4
4
  * Screen-Space Edge Detection Pass
@@ -45,6 +45,12 @@ export declare class ScreenSpaceEdgesPass extends Pass {
45
45
  private copyMaterial;
46
46
  private fsQuad;
47
47
  options: ScreenSpaceEdgesOptions;
48
+ /**
49
+ * Objects to exclude from edge detection.
50
+ * These objects will be temporarily hidden during the normal/depth render pass.
51
+ * Use this to exclude UI elements, section box visuals, helpers, etc.
52
+ */
53
+ excludeObjects: Object3D[];
48
54
  /**
49
55
  * 🔧 FAST TOGGLE: When true, skips geometry renders and just passes through the image
50
56
  * Use this instead of `enabled` for faster on/off during camera movement
@@ -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
+ }
@@ -1,5 +1,5 @@
1
1
  import { WebGLRenderer } from "three";
2
- import { ViralViewerApi } from "../../viral-viewer-api";
2
+ import type { ViralViewerApi } from "../../viral-viewer-api";
3
3
  import { PostProcessingRenderer } from "../post-processing/post-processing-renderer";
4
4
  export declare class ViralRenderer {
5
5
  viralViewerApi: ViralViewerApi;
@@ -1,16 +1,13 @@
1
- import { Scene, DirectionalLight, Mesh, Object3D, MeshBasicMaterial, Light, CameraHelper, Box3, OrthographicCamera, PerspectiveCamera } from "three";
2
- import { ViralViewerApi } from "../../viral-viewer-api";
3
- import { ViralMergedModel } from "../custom-objects/viral-merged-model";
4
- import { ViralMainModel } from "../custom-objects/viral-main.model";
1
+ import { type Box3, CameraHelper, DirectionalLight, type Light, Mesh, MeshBasicMaterial, type Object3D, type OrthographicCamera, type PerspectiveCamera, Scene } from "three";
5
2
  import { TransformControls } from "three/examples/jsm/controls/TransformControls";
3
+ import type { ViralViewerApi } from "../../viral-viewer-api";
4
+ import { ViralBIMWorld } from "../custom-objects/viral-bim-world";
6
5
  export declare class ViralScene {
7
6
  viralViewerApi: ViralViewerApi;
8
7
  scene: Scene;
9
8
  objects: Object3D[];
10
9
  models: Object3D[];
11
- mainModels: ViralMainModel[];
12
- isolateModel: Mesh;
13
- mergedModel: ViralMergedModel;
10
+ bimWorld: ViralBIMWorld;
14
11
  outlineModel: Mesh;
15
12
  hideables: Object3D[];
16
13
  selectables: Object3D[];