viral-viewer-2 7.2.6 → 7.2.8

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.
@@ -93,6 +93,7 @@ export declare class ViralBatchedMesh extends Mesh {
93
93
  private _isRGBAMode;
94
94
  private _elementOriginalColors;
95
95
  private _temporaryColors;
96
+ private _ghostColors;
96
97
  /**
97
98
  * Select elements (highlights them with accent color)
98
99
  */
@@ -191,28 +192,38 @@ export declare class ViralBatchedMesh extends Mesh {
191
192
  */
192
193
  getElementOpacity(modelId: string, elementId: string): number;
193
194
  /**
194
- * Ghost mode - semi-transparent with optional desaturation
195
+ * Ghost mode - semi-transparent with optional desaturation or custom color
195
196
  * Perfect for showing context while highlighting other elements
196
197
  *
197
198
  * @param elements - Elements to ghost
198
199
  * @param ghostOpacity - Opacity for ghost mode (default: 0.15)
199
- * @param desaturate - Whether to desaturate color (default: true)
200
+ * @param desaturate - Whether to desaturate color (default: true) - ignored if ghostColor is provided
201
+ * @param ghostColor - Optional custom color for ghosted elements (e.g., {r: 1, g: 1, b: 1} for white)
200
202
  */
201
203
  setElementGhost(elements: {
202
204
  modelId: string;
203
205
  elementId: string;
204
- }[], ghostOpacity?: number, desaturate?: boolean): void;
206
+ }[], ghostOpacity?: number, desaturate?: boolean, ghostColor?: {
207
+ r: number;
208
+ g: number;
209
+ b: number;
210
+ }): void;
205
211
  /**
206
212
  * Ghost all elements EXCEPT the specified ones
207
213
  * Focused elements remain fully opaque, everything else becomes ghosted
208
214
  *
209
215
  * @param focusElements - Elements to keep fully visible
210
216
  * @param ghostOpacity - Opacity for non-focused elements (default: 0.1)
217
+ * @param ghostColor - Optional custom color for ghosted elements (e.g., {r: 1, g: 1, b: 1} for white)
211
218
  */
212
219
  ghostExcept(focusElements: {
213
220
  modelId: string;
214
221
  elementId: string;
215
- }[], ghostOpacity?: number): void;
222
+ }[], ghostOpacity?: number, ghostColor?: {
223
+ r: number;
224
+ g: number;
225
+ b: number;
226
+ }): void;
216
227
  /**
217
228
  * Create a depth-only pre-pass mesh that writes depth for focused elements.
218
229
  * Shares the same geometry; uses alphaTest to discard ghost fragments.
@@ -135,20 +135,30 @@ export declare class ViralBIMWorld extends Mesh {
135
135
  * Set elements to "ghost" mode (semi-transparent)
136
136
  * @param elements - Elements to ghost
137
137
  * @param ghostOpacity - Opacity for ghosted elements (default 0.1)
138
+ * @param ghostColor - Optional custom color for ghosted elements (e.g., {r: 1, g: 1, b: 1} for white)
138
139
  */
139
140
  setElementGhost(elements: {
140
141
  modelId: string;
141
142
  elementId: string;
142
- }[], ghostOpacity?: number): void;
143
+ }[], ghostOpacity?: number, ghostColor?: {
144
+ r: number;
145
+ g: number;
146
+ b: number;
147
+ }): void;
143
148
  /**
144
149
  * Ghost all elements EXCEPT the specified ones
145
150
  * @param elements - Elements to keep fully opaque
146
151
  * @param ghostOpacity - Opacity for all other elements (default 0.1)
152
+ * @param ghostColor - Optional custom color for ghosted elements (e.g., {r: 1, g: 1, b: 1} for white)
147
153
  */
148
154
  ghostExcept(elements: {
149
155
  modelId: string;
150
156
  elementId: string;
151
- }[], ghostOpacity?: number): void;
157
+ }[], ghostOpacity?: number, ghostColor?: {
158
+ r: number;
159
+ g: number;
160
+ b: number;
161
+ }): void;
152
162
  /**
153
163
  * Reset all elements to full opacity
154
164
  */
@@ -22,6 +22,7 @@ export declare class ViralInstancedMeshV2 extends Object3D {
22
22
  private _originalTransforms;
23
23
  private _elementOpacity;
24
24
  private _temporaryColors;
25
+ private _ghostColors;
25
26
  private _selectedElements;
26
27
  private _hidingElements;
27
28
  protected _isolatingElements: {
@@ -214,20 +215,31 @@ export declare class ViralInstancedMeshV2 extends Object3D {
214
215
  * Set elements to "ghost" mode (semi-transparent)
215
216
  * @param elements - Elements to ghost
216
217
  * @param ghostOpacity - Opacity for ghosted elements (default 0.1)
218
+ * @param desaturate - Whether to desaturate color (default: true) - ignored if ghostColor is provided
219
+ * @param ghostColor - Optional custom color for ghosted elements (e.g., {r: 1, g: 1, b: 1} for white)
217
220
  */
218
221
  setElementGhost(elements: {
219
222
  modelId: string;
220
223
  elementId: string;
221
- }[], ghostOpacity?: number, desaturate?: boolean): void;
224
+ }[], ghostOpacity?: number, desaturate?: boolean, ghostColor?: {
225
+ r: number;
226
+ g: number;
227
+ b: number;
228
+ }): void;
222
229
  /**
223
230
  * Ghost all elements EXCEPT the specified ones
224
231
  * @param elements - Elements to keep fully opaque
225
232
  * @param ghostOpacity - Opacity for all other elements (default 0.1)
233
+ * @param ghostColor - Optional custom color for ghosted elements (e.g., {r: 1, g: 1, b: 1} for white)
226
234
  */
227
235
  ghostExcept(elements: {
228
236
  modelId: string;
229
237
  elementId: string;
230
- }[], ghostOpacity?: number): void;
238
+ }[], ghostOpacity?: number, ghostColor?: {
239
+ r: number;
240
+ g: number;
241
+ b: number;
242
+ }): void;
231
243
  /**
232
244
  * Create depth-only pre-pass instanced meshes that write depth for focused instances.
233
245
  * Shares the same geometry (including instanceOpacity attribute); uses shader discard
@@ -245,6 +257,13 @@ export declare class ViralInstancedMeshV2 extends Object3D {
245
257
  * @param desatFactor - Desaturation factor (0 = original, 1 = full white)
246
258
  */
247
259
  private _desaturateInstanceColor;
260
+ /**
261
+ * Set instance color to a specific color
262
+ * @param modelId - Model ID
263
+ * @param elementId - Element ID
264
+ * @param color - Target color {r, g, b} with values 0-1
265
+ */
266
+ private _setInstanceColor;
248
267
  /**
249
268
  * Restore instance color to original
250
269
  */
@@ -25,11 +25,16 @@ export declare class ViralVisibilityManager {
25
25
  /**
26
26
  *
27
27
  * @param elements default will get selected elements or we can input specific elements
28
+ * @param ghostColor optional ghost color to use for this isolate operation
28
29
  */
29
30
  isolate2(elements?: {
30
31
  modelId: string;
31
32
  elementId: string;
32
- }[]): void;
33
+ }[], ghostColor?: {
34
+ r: number;
35
+ g: number;
36
+ b: number;
37
+ }): void;
33
38
  /**
34
39
  *
35
40
  * @param elements default will get selected elements
@@ -251,7 +256,27 @@ export declare class ViralVisibilityManager {
251
256
  enableSampling(numberOfSampling?: number): void;
252
257
  disableSampling(): void;
253
258
  private ghostMode;
259
+ /** Default ghost color (optional - if not set, uses desaturation) */
260
+ private _ghostColor?;
254
261
  setGhostMode(value: boolean): void;
262
+ /**
263
+ * Set the default ghost color used by isolate2 and other ghost operations
264
+ * @param color - Color {r, g, b} with values 0-1 (e.g., {r: 1, g: 1, b: 1} for white)
265
+ * Pass undefined to use default desaturation
266
+ */
267
+ setGhostColor(color?: {
268
+ r: number;
269
+ g: number;
270
+ b: number;
271
+ }): void;
272
+ /**
273
+ * Get the current ghost color
274
+ */
275
+ getGhostColor(): {
276
+ r: number;
277
+ g: number;
278
+ b: number;
279
+ } | undefined;
255
280
  /**
256
281
  * Set opacity for specific elements
257
282
  * @param elements - Elements to set opacity for
@@ -265,20 +290,30 @@ export declare class ViralVisibilityManager {
265
290
  * Set elements to "ghost" mode (semi-transparent)
266
291
  * @param elements - Elements to ghost
267
292
  * @param ghostOpacity - Opacity for ghosted elements (default 0.1)
293
+ * @param ghostColor - Optional custom color for ghosted elements (e.g., {r: 1, g: 1, b: 1} for white)
268
294
  */
269
295
  setElementGhost(elements: {
270
296
  modelId: string;
271
297
  elementId: string;
272
- }[], ghostOpacity?: number): void;
298
+ }[], ghostOpacity?: number, ghostColor?: {
299
+ r: number;
300
+ g: number;
301
+ b: number;
302
+ }): void;
273
303
  /**
274
304
  * Ghost all elements EXCEPT the specified ones (highlight effect)
275
305
  * @param elements - Elements to keep fully opaque
276
306
  * @param ghostOpacity - Opacity for all other elements (default 0.1)
307
+ * @param ghostColor - Optional custom color for ghosted elements (e.g., {r: 1, g: 1, b: 1} for white)
277
308
  */
278
309
  ghostExcept(elements: {
279
310
  modelId: string;
280
311
  elementId: string;
281
- }[], ghostOpacity?: number): void;
312
+ }[], ghostOpacity?: number, ghostColor?: {
313
+ r: number;
314
+ g: number;
315
+ b: number;
316
+ }): void;
282
317
  /**
283
318
  * Reset all elements to full opacity
284
319
  */