vim-web 0.6.0-dev.8 → 1.0.0-alpha.0

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/vim-web.js CHANGED
@@ -47528,25 +47528,6 @@ const _CameraMovementSnap = class _CameraMovementSnap extends CameraMovement$1 {
47528
47528
  };
47529
47529
  __publicField(_CameraMovementSnap, "_ZERO", new Vector3());
47530
47530
  let CameraMovementSnap = _CameraMovementSnap;
47531
- function createOpaque() {
47532
- return new StandardMaterial(createBasicOpaque());
47533
- }
47534
- function createTransparent() {
47535
- return new StandardMaterial(createBasicTransparent());
47536
- }
47537
- function createBasicOpaque() {
47538
- return new MeshLambertMaterial({
47539
- color: 13421772,
47540
- flatShading: true,
47541
- side: DoubleSide
47542
- });
47543
- }
47544
- function createBasicTransparent() {
47545
- const mat = createBasicOpaque();
47546
- mat.transparent = true;
47547
- mat.opacity = 0.25;
47548
- return mat;
47549
- }
47550
47531
  class StandardMaterial {
47551
47532
  constructor(material) {
47552
47533
  __publicField(this, "three");
@@ -53761,7 +53742,7 @@ let SectionBox$1 = class SectionBox {
53761
53742
  }
53762
53743
  };
53763
53744
  class Gizmos {
53764
- constructor(renderer, viewport, viewer, camera2) {
53745
+ constructor(renderer, viewport, viewer, camera2, settings2) {
53765
53746
  __publicField(this, "_viewport");
53766
53747
  __publicField(this, "_measure");
53767
53748
  /**
@@ -53788,9 +53769,9 @@ class Gizmos {
53788
53769
  renderer,
53789
53770
  camera2,
53790
53771
  viewer.inputs,
53791
- viewer.settings
53772
+ settings2
53792
53773
  );
53793
- this.axes = new GizmoAxes(camera2, viewport, viewer.settings.axes);
53774
+ this.axes = new GizmoAxes(camera2, viewport, settings2.axes);
53794
53775
  this.markers = new GizmoMarkers(renderer, viewer.selection);
53795
53776
  (_a3 = viewport.canvas.parentElement) == null ? void 0 : _a3.prepend(this.axes.canvas);
53796
53777
  }
@@ -54043,8 +54024,8 @@ function createMaskMaterial() {
54043
54024
  clipping: true,
54044
54025
  // Use GLSL ES 3.0 for WebGL 2
54045
54026
  glslVersion: GLSL3,
54046
- // Only write depth, not color (outline shader only reads depth)
54047
- colorWrite: false,
54027
+ // Writes 1.0 to color for selected, 0.0 for background (after clear).
54028
+ // Outline shader does edge detection on this binary mask.
54048
54029
  vertexShader: (
54049
54030
  /* glsl */
54050
54031
  `
@@ -54193,33 +54174,13 @@ function createGhostShader() {
54193
54174
  });
54194
54175
  }
54195
54176
  class OutlineMaterial {
54196
- constructor(options, onUpdate) {
54177
+ constructor(onUpdate) {
54197
54178
  __publicField(this, "three");
54198
- __publicField(this, "_camera");
54199
54179
  __publicField(this, "_resolution");
54200
- __publicField(this, "_precision", 1);
54201
54180
  __publicField(this, "_onUpdate");
54202
54181
  this.three = createOutlineMaterial();
54203
54182
  this._onUpdate = onUpdate;
54204
- this._precision = (options == null ? void 0 : options.precision) ?? 1;
54205
- this._resolution = (options == null ? void 0 : options.resolution) ?? new Vector2(1, 1);
54206
- this.resolution = this._resolution;
54207
- if (options == null ? void 0 : options.sceneBuffer) {
54208
- this.sceneBuffer = options.sceneBuffer;
54209
- }
54210
- this.camera = options == null ? void 0 : options.camera;
54211
- }
54212
- /**
54213
- * Precision of the outline. This is used to scale the resolution of the outline.
54214
- */
54215
- get precision() {
54216
- return this._precision;
54217
- }
54218
- set precision(value) {
54219
- var _a3;
54220
- this._precision = value;
54221
- this.resolution = this._resolution;
54222
- (_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
54183
+ this._resolution = new Vector2(1, 1);
54223
54184
  }
54224
54185
  /**
54225
54186
  * Resolution of the outline. This should match the resolution of screen.
@@ -54230,50 +54191,24 @@ class OutlineMaterial {
54230
54191
  set resolution(value) {
54231
54192
  var _a3;
54232
54193
  this.three.uniforms.screenSize.value.set(
54233
- value.x * this._precision,
54234
- value.y * this._precision,
54235
- 1 / (value.x * this._precision),
54236
- 1 / (value.y * this._precision)
54194
+ value.x,
54195
+ value.y,
54196
+ 1 / value.x,
54197
+ 1 / value.y
54237
54198
  );
54238
54199
  this._resolution = value;
54239
54200
  this.three.uniformsNeedUpdate = true;
54240
54201
  (_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
54241
54202
  }
54242
54203
  /**
54243
- * Camera used to render the outline.
54204
+ * Thickness of the outline in pixels (of the outline render target).
54244
54205
  */
54245
- get camera() {
54246
- return this._camera;
54206
+ get thickness() {
54207
+ return this.three.uniforms.thickness.value;
54247
54208
  }
54248
- set camera(value) {
54209
+ set thickness(value) {
54249
54210
  var _a3;
54250
- this._camera = value;
54251
- this.three.uniforms.cameraNear.value = (value == null ? void 0 : value.near) ?? 1;
54252
- this.three.uniforms.cameraFar.value = (value == null ? void 0 : value.far) ?? 1e3;
54253
- this.three.uniformsNeedUpdate = true;
54254
- (_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
54255
- }
54256
- /**
54257
- * Intensity of the outline. Controls the strength of the edge detection.
54258
- */
54259
- get intensity() {
54260
- return this.three.uniforms.intensity.value;
54261
- }
54262
- set intensity(value) {
54263
- var _a3;
54264
- this.three.uniforms.intensity.value = value;
54265
- this.three.uniformsNeedUpdate = true;
54266
- (_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
54267
- }
54268
- /**
54269
- * Color of the outline.
54270
- */
54271
- get color() {
54272
- return this.three.uniforms.outlineColor.value;
54273
- }
54274
- set color(value) {
54275
- var _a3;
54276
- this.three.uniforms.outlineColor.value.set(value);
54211
+ this.three.uniforms.thickness.value = Math.max(1, Math.round(value));
54277
54212
  this.three.uniformsNeedUpdate = true;
54278
54213
  (_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
54279
54214
  }
@@ -54289,18 +54224,6 @@ class OutlineMaterial {
54289
54224
  this.three.uniformsNeedUpdate = true;
54290
54225
  (_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
54291
54226
  }
54292
- /**
54293
- * Depth buffer used to render the outline.
54294
- */
54295
- get depthBuffer() {
54296
- return this.three.uniforms.depthBuffer.value;
54297
- }
54298
- set depthBuffer(value) {
54299
- var _a3;
54300
- this.three.uniforms.depthBuffer.value = value;
54301
- this.three.uniformsNeedUpdate = true;
54302
- (_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
54303
- }
54304
54227
  /**
54305
54228
  * Dispose of the outline material.
54306
54229
  */
@@ -54314,18 +54237,9 @@ function createOutlineMaterial() {
54314
54237
  glslVersion: GLSL3,
54315
54238
  depthWrite: false,
54316
54239
  uniforms: {
54317
- // Input buffers
54318
54240
  sceneBuffer: { value: null },
54319
- depthBuffer: { value: null },
54320
- // Input parameters
54321
- cameraNear: { value: 1 },
54322
- cameraFar: { value: 1e3 },
54323
- screenSize: {
54324
- value: new Vector4(1, 1, 1, 1)
54325
- },
54326
- // Options
54327
- outlineColor: { value: new Color(16777215) },
54328
- intensity: { value: 2 }
54241
+ screenSize: { value: new Vector4(1, 1, 1, 1) },
54242
+ thickness: { value: 2 }
54329
54243
  },
54330
54244
  vertexShader: `
54331
54245
  out vec2 vUv;
@@ -54335,52 +54249,55 @@ function createOutlineMaterial() {
54335
54249
  }
54336
54250
  `,
54337
54251
  fragmentShader: `
54338
- #include <packing>
54339
-
54340
- uniform sampler2D depthBuffer;
54341
- uniform float cameraNear;
54342
- uniform float cameraFar;
54252
+ uniform sampler2D sceneBuffer;
54343
54253
  uniform vec4 screenSize;
54344
- uniform vec3 outlineColor;
54345
- uniform float intensity;
54254
+ uniform float thickness;
54346
54255
 
54347
54256
  in vec2 vUv;
54348
54257
  out vec4 fragColor;
54349
54258
 
54350
- // Use texelFetch for faster indexed access (WebGL 2)
54351
- float getPixelDepth(int x, int y) {
54259
+ // Read binary selection mask (1.0 = selected, 0.0 = background).
54260
+ // Clamped to texture bounds to avoid false outlines at screen edges.
54261
+ float getMask(int x, int y) {
54352
54262
  ivec2 pixelCoord = ivec2(vUv * screenSize.xy) + ivec2(x, y);
54353
- float fragCoordZ = texelFetch(depthBuffer, pixelCoord, 0).x;
54354
- float viewZ = perspectiveDepthToViewZ(fragCoordZ, cameraNear, cameraFar);
54355
- return viewZToOrthographicDepth(viewZ, cameraNear, cameraFar);
54263
+ pixelCoord = clamp(pixelCoord, ivec2(0), ivec2(screenSize.xy) - 1);
54264
+ return texelFetch(sceneBuffer, pixelCoord, 0).x;
54356
54265
  }
54357
-
54358
- float saturate(float num) {
54359
- return clamp(num, 0.0, 1.0);
54266
+
54267
+ // Check the full grid ring at Chebyshev distance d.
54268
+ // Called with literal constants so the compiler inlines and unrolls.
54269
+ bool checkRing(int d) {
54270
+ // Top and bottom rows (full width)
54271
+ for (int x = -d; x <= d; x++) {
54272
+ if (getMask(x, -d) < 0.5) return true;
54273
+ if (getMask(x, d) < 0.5) return true;
54274
+ }
54275
+ // Left and right columns (excluding corners)
54276
+ for (int y = -d + 1; y < d; y++) {
54277
+ if (getMask(-d, y) < 0.5) return true;
54278
+ if (getMask( d, y) < 0.5) return true;
54279
+ }
54280
+ return false;
54360
54281
  }
54361
-
54362
- void main() {
54363
- float depth = getPixelDepth(0, 0);
54364
54282
 
54365
- // Early-out: skip for background pixels (no geometry)
54366
- if (depth >= 0.99) {
54367
- fragColor = vec4(0.0, 0.0, 0.0, 0.0);
54283
+ void main() {
54284
+ // Skip non-selected pixels
54285
+ if (getMask(0, 0) < 0.5) {
54286
+ fragColor = vec4(0.0);
54368
54287
  return;
54369
54288
  }
54370
54289
 
54371
- // Cross edge detection: 4 neighbors at distance 1.
54372
- // step() converts depth diff to binary (edge or not).
54373
- // Thickness is controlled by outlineScale (render target resolution).
54374
- float outline = 0.0;
54375
- outline += step(0.001, abs(depth - getPixelDepth( 0, -1)));
54376
- outline += step(0.001, abs(depth - getPixelDepth( 0, 1)));
54377
- outline += step(0.001, abs(depth - getPixelDepth(-1, 0)));
54378
- outline += step(0.001, abs(depth - getPixelDepth( 1, 0)));
54379
- outline = saturate(outline * 0.25 * intensity);
54290
+ // Full grid search ring by ring (3x3, 5x5, 7x7 ... up to 11x11).
54291
+ // Each ring checks all pixels at that Chebyshev distance.
54292
+ // Early-exit between rings once an edge is found.
54293
+ bool edge = checkRing(1);
54294
+
54295
+ if (!edge && thickness >= 2.0) edge = checkRing(2);
54296
+ if (!edge && thickness >= 3.0) edge = checkRing(3);
54297
+ if (!edge && thickness >= 4.0) edge = checkRing(4);
54298
+ if (!edge && thickness >= 5.0) edge = checkRing(5);
54380
54299
 
54381
- // Output outline intensity to R channel only (RedFormat texture)
54382
- // Merge pass will use this to blend outline color with scene
54383
- fragColor = vec4(outline, 0.0, 0.0, 0.0);
54300
+ fragColor = vec4(edge ? 1.0 : 0.0, 0.0, 0.0, 0.0);
54384
54301
  }
54385
54302
  `
54386
54303
  });
@@ -54401,6 +54318,15 @@ class MergeMaterial {
54401
54318
  this.three.uniformsNeedUpdate = true;
54402
54319
  (_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
54403
54320
  }
54321
+ get opacity() {
54322
+ return this.three.uniforms.opacity.value;
54323
+ }
54324
+ set opacity(value) {
54325
+ var _a3;
54326
+ this.three.uniforms.opacity.value = Math.max(0, Math.min(1, value));
54327
+ this.three.uniformsNeedUpdate = true;
54328
+ (_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
54329
+ }
54404
54330
  get sourceA() {
54405
54331
  return this.three.uniforms.sourceA.value;
54406
54332
  }
@@ -54426,7 +54352,8 @@ function createMergeMaterial() {
54426
54352
  uniforms: {
54427
54353
  sourceA: { value: null },
54428
54354
  sourceB: { value: null },
54429
- color: { value: new Color(16777215) }
54355
+ color: { value: new Color(16777215) },
54356
+ opacity: { value: 1 }
54430
54357
  },
54431
54358
  vertexShader: (
54432
54359
  /* glsl */
@@ -54442,25 +54369,26 @@ function createMergeMaterial() {
54442
54369
  /* glsl */
54443
54370
  `
54444
54371
  uniform vec3 color;
54372
+ uniform float opacity;
54445
54373
  uniform sampler2D sourceA;
54446
54374
  uniform sampler2D sourceB;
54447
54375
  in vec2 vUv;
54448
54376
  out vec4 fragColor;
54449
54377
 
54450
54378
  void main() {
54451
- // Fetch outline intensity first (cheaper to check)
54379
+ // Fetch outline mask first (cheaper to check)
54452
54380
  // Use texture() for proper handling of different resolutions
54453
- vec4 B = texture(sourceB, vUv);
54381
+ float edge = texture(sourceB, vUv).x;
54454
54382
 
54455
54383
  // Early-out: if no outline, just copy scene directly
54456
- if (B.x < 0.01) {
54384
+ if (edge < 0.01) {
54457
54385
  fragColor = texture(sourceA, vUv);
54458
54386
  return;
54459
54387
  }
54460
54388
 
54461
- // Fetch scene and blend with outline color
54389
+ // Fetch scene and blend with outline color using opacity
54462
54390
  vec4 A = texture(sourceA, vUv);
54463
- fragColor = vec4(mix(A.xyz, color, B.x), 1.0);
54391
+ fragColor = vec4(mix(A.xyz, color, edge * opacity), 1.0);
54464
54392
  }
54465
54393
  `
54466
54394
  )
@@ -54608,9 +54536,7 @@ function applyMaterial(mesh, value) {
54608
54536
  mesh.visible = true;
54609
54537
  }
54610
54538
  const _Materials = class _Materials {
54611
- constructor(opaque, transparent, modelOpaque, modelTransparent, ghost2, mask, outline, merge) {
54612
- __publicField(this, "_opaque");
54613
- __publicField(this, "_transparent");
54539
+ constructor(modelOpaque, modelTransparent, ghost2, mask, outline, merge) {
54614
54540
  __publicField(this, "_modelOpaque");
54615
54541
  __publicField(this, "_modelTransparent");
54616
54542
  __publicField(this, "_ghost");
@@ -54619,20 +54545,15 @@ const _Materials = class _Materials {
54619
54545
  __publicField(this, "_outline");
54620
54546
  __publicField(this, "_merge");
54621
54547
  __publicField(this, "_clippingPlanes");
54622
- __publicField(this, "_sectionStrokeWidth", 0.01);
54623
- __publicField(this, "_sectionStrokeFalloff", 0.75);
54624
- __publicField(this, "_sectionStrokeColor", new Color(16185078));
54625
54548
  __publicField(this, "_onUpdate", new distExports$2.SignalDispatcher());
54626
54549
  // Shared color palette texture for all scene materials
54627
54550
  __publicField(this, "_colorPaletteTexture");
54628
- this._opaque = opaque ?? createOpaque();
54629
- this._transparent = transparent ?? createTransparent();
54630
54551
  const onUpdate = () => this._onUpdate.dispatch();
54631
54552
  this._modelOpaque = modelOpaque ?? createModelOpaque(onUpdate);
54632
54553
  this._modelTransparent = modelTransparent ?? createModelTransparent(onUpdate);
54633
54554
  this._ghost = ghost2 ?? new GhostMaterial(void 0, onUpdate);
54634
54555
  this._mask = mask ?? createMaskMaterial();
54635
- this._outline = outline ?? new OutlineMaterial(void 0, onUpdate);
54556
+ this._outline = outline ?? new OutlineMaterial(onUpdate);
54636
54557
  this._merge = merge ?? new MergeMaterial(onUpdate);
54637
54558
  }
54638
54559
  static createInstance(instance) {
@@ -54678,34 +54599,29 @@ const _Materials = class _Materials {
54678
54599
  * Updates material settings based on the provided configuration.
54679
54600
  */
54680
54601
  applySettings(settings2) {
54681
- this.modelColor = settings2.standard.color;
54682
54602
  this._ghost.opacity = settings2.ghost.opacity;
54683
54603
  this._ghost.color = settings2.ghost.color;
54684
- this.sectionStrokeWidth = settings2.section.strokeWidth;
54685
- this.sectionStrokeFalloff = settings2.section.strokeFalloff;
54686
- this.sectionStrokeColor = settings2.section.strokeColor;
54687
- this.outlineIntensity = settings2.outline.intensity;
54604
+ this.outlineOpacity = settings2.outline.opacity;
54688
54605
  this.outlineColor = settings2.outline.color;
54606
+ this.outlineThickness = settings2.outline.thickness;
54689
54607
  }
54690
54608
  /** @internal Signal dispatched whenever a material is modified. */
54691
54609
  get onUpdate() {
54692
54610
  return this._onUpdate.asEvent();
54693
54611
  }
54694
- /** Base color tint applied to opaque and transparent model materials. */
54695
- get modelColor() {
54696
- return this._opaque.color;
54612
+ /** Opacity of the selection outline (0 = invisible, 1 = fully opaque). */
54613
+ get outlineOpacity() {
54614
+ return this._merge.opacity;
54697
54615
  }
54698
- set modelColor(color) {
54699
- this._opaque.color = color;
54700
- this._transparent.color = color;
54701
- this._onUpdate.dispatch();
54616
+ set outlineOpacity(value) {
54617
+ this._merge.opacity = value;
54702
54618
  }
54703
- /** Intensity of the selection outline post-process effect. */
54704
- get outlineIntensity() {
54705
- return this._outline.intensity;
54619
+ /** Thickness of the selection outline in pixels (of the outline render target). */
54620
+ get outlineThickness() {
54621
+ return this._outline.thickness;
54706
54622
  }
54707
- set outlineIntensity(value) {
54708
- this._outline.intensity = value;
54623
+ set outlineThickness(value) {
54624
+ this._outline.thickness = value;
54709
54625
  }
54710
54626
  /** Color of the selection outline post-process effect. */
54711
54627
  get outlineColor() {
@@ -54722,45 +54638,10 @@ const _Materials = class _Materials {
54722
54638
  this._clippingPlanes = value;
54723
54639
  this._modelOpaque.clippingPlanes = value ?? null;
54724
54640
  this._modelTransparent.clippingPlanes = value ?? null;
54725
- this._opaque.clippingPlanes = value ?? null;
54726
- this._transparent.clippingPlanes = value ?? null;
54727
54641
  this._ghost.clippingPlanes = value ?? null;
54728
54642
  this._mask.clippingPlanes = value ?? null;
54729
54643
  this._onUpdate.dispatch();
54730
54644
  }
54731
- /** Width of the stroke rendered where the section box intersects the model. */
54732
- get sectionStrokeWidth() {
54733
- return this._sectionStrokeWidth;
54734
- }
54735
- set sectionStrokeWidth(value) {
54736
- if (this._sectionStrokeWidth === value) return;
54737
- this._sectionStrokeWidth = value;
54738
- this._opaque.sectionStrokeWidth = value;
54739
- this._transparent.sectionStrokeWidth = value;
54740
- this._onUpdate.dispatch();
54741
- }
54742
- /** Gradient falloff of the section box intersection stroke. */
54743
- get sectionStrokeFalloff() {
54744
- return this._sectionStrokeFalloff;
54745
- }
54746
- set sectionStrokeFalloff(value) {
54747
- if (this._sectionStrokeFalloff === value) return;
54748
- this._sectionStrokeFalloff = value;
54749
- this._opaque.sectionStrokeFalloff = value;
54750
- this._transparent.sectionStrokeFalloff = value;
54751
- this._onUpdate.dispatch();
54752
- }
54753
- /** Color of the section box intersection stroke. */
54754
- get sectionStrokeColor() {
54755
- return this._sectionStrokeColor;
54756
- }
54757
- set sectionStrokeColor(value) {
54758
- if (this._sectionStrokeColor === value) return;
54759
- this._sectionStrokeColor = value;
54760
- this._opaque.sectionStrokeColor = value;
54761
- this._transparent.sectionStrokeColor = value;
54762
- this._onUpdate.dispatch();
54763
- }
54764
54645
  /**
54765
54646
  * Creates the fixed quantized color palette texture if it doesn't exist.
54766
54647
  * The palette is deterministic (25³ = 15,625 quantized colors in 128×128 texture)
@@ -54770,6 +54651,8 @@ const _Materials = class _Materials {
54770
54651
  if (this._colorPaletteTexture) return;
54771
54652
  const textureData = buildPaletteTexture();
54772
54653
  this._colorPaletteTexture = new DataTexture(
54654
+ // Cast: TS 5.7 narrows Uint8Array.buffer to ArrayBufferLike (includes SharedArrayBuffer),
54655
+ // but Three.js expects BufferSource (ArrayBuffer only). Safe — Uint8Array always backs ArrayBuffer.
54773
54656
  textureData,
54774
54657
  128,
54775
54658
  128,
@@ -54779,8 +54662,6 @@ const _Materials = class _Materials {
54779
54662
  this._colorPaletteTexture.needsUpdate = true;
54780
54663
  this._colorPaletteTexture.minFilter = NearestFilter;
54781
54664
  this._colorPaletteTexture.magFilter = NearestFilter;
54782
- this._opaque.setColorPaletteTexture(this._colorPaletteTexture);
54783
- this._transparent.setColorPaletteTexture(this._colorPaletteTexture);
54784
54665
  this._modelOpaque.setColorPaletteTexture(this._colorPaletteTexture);
54785
54666
  this._modelTransparent.setColorPaletteTexture(this._colorPaletteTexture);
54786
54667
  this._onUpdate.dispatch();
@@ -54791,8 +54672,6 @@ const _Materials = class _Materials {
54791
54672
  this._colorPaletteTexture.dispose();
54792
54673
  this._colorPaletteTexture = void 0;
54793
54674
  }
54794
- this._opaque.dispose();
54795
- this._transparent.dispose();
54796
54675
  this._modelOpaque.dispose();
54797
54676
  this._modelTransparent.dispose();
54798
54677
  this._ghost.dispose();
@@ -55524,52 +55403,17 @@ function getDefaultViewerSettings() {
55524
55403
  opacityAlways: 0.1
55525
55404
  }
55526
55405
  },
55527
- background: { color: new Color(12698310) },
55528
- skybox: {
55529
- enable: true,
55530
- skyColor: new Color(16777215),
55531
- // white
55532
- groundColor: new Color(16185078),
55533
- // less white
55534
- sharpness: 2
55535
- },
55536
- skylight: {
55537
- skyColor: new Color(16777215),
55538
- groundColor: new Color(16777215),
55539
- intensity: 0.8
55540
- },
55541
- sunlights: [
55542
- {
55543
- followCamera: true,
55544
- position: new Vector3(1e3, 1e3, 1e3),
55545
- color: new Color(16777215),
55546
- intensity: 0.8
55547
- },
55548
- {
55549
- followCamera: true,
55550
- position: new Vector3(-1e3, -1e3, -1e3),
55551
- color: new Color(16777215),
55552
- intensity: 0.2
55553
- }
55554
- ],
55406
+ background: { color: new Color(16777215) },
55555
55407
  materials: {
55556
- useFastMaterials: false,
55557
- standard: {
55558
- color: new Color(13421772)
55559
- },
55560
55408
  ghost: {
55561
55409
  color: new Color(921102),
55562
55410
  opacity: 7 / 255
55563
55411
  },
55564
- section: {
55565
- strokeWidth: 0.01,
55566
- strokeFalloff: 0.75,
55567
- strokeColor: new Color(16185078)
55568
- },
55569
55412
  outline: {
55570
- intensity: 2,
55413
+ opacity: 0.85,
55571
55414
  color: new Color(65535),
55572
- scale: 0.75
55415
+ scale: 0.75,
55416
+ thickness: 2
55573
55417
  }
55574
55418
  },
55575
55419
  axes: getDefaultAxesSettings(),
@@ -55740,11 +55584,11 @@ let Viewport$1 = class Viewport {
55740
55584
  this._unregisterResize = () => window.removeEventListener("resize", onResize);
55741
55585
  }
55742
55586
  };
55743
- function createInputHandler(viewer) {
55587
+ function createInputHandler(viewer, controls) {
55744
55588
  return new InputHandler(
55745
55589
  viewer.viewport.canvas,
55746
55590
  createAdapter$2(viewer),
55747
- viewer.settings.camera.controls
55591
+ controls
55748
55592
  );
55749
55593
  }
55750
55594
  function createAdapter$2(viewer) {
@@ -56256,24 +56100,17 @@ class RenderPass extends Pass {
56256
56100
  }
56257
56101
  }
56258
56102
  class OutlinePass extends Pass {
56259
- constructor(camera2, material) {
56103
+ constructor(material) {
56260
56104
  super();
56261
56105
  __publicField(this, "_fsQuad");
56262
56106
  __publicField(this, "material");
56263
- this.material = material ?? new OutlineMaterial();
56264
- this.material.camera = camera2;
56107
+ this.material = material;
56265
56108
  this._fsQuad = new FullScreenQuad(this.material.three);
56266
56109
  this.needsSwap = true;
56267
56110
  }
56268
56111
  setSize(width, height) {
56269
56112
  this.material.resolution = new Vector2(width, height);
56270
56113
  }
56271
- get camera() {
56272
- return this.material.camera;
56273
- }
56274
- set camera(value) {
56275
- this.material.camera = value;
56276
- }
56277
56114
  dispose() {
56278
56115
  this._fsQuad.dispose();
56279
56116
  this.material.dispose();
@@ -56281,7 +56118,6 @@ class OutlinePass extends Pass {
56281
56118
  render(renderer, writeBuffer, readBuffer) {
56282
56119
  const depthBufferValue = writeBuffer.depthBuffer;
56283
56120
  writeBuffer.depthBuffer = false;
56284
- this.material.depthBuffer = readBuffer.depthTexture;
56285
56121
  this.material.sceneBuffer = readBuffer.texture;
56286
56122
  if (this.renderToScreen) {
56287
56123
  renderer.setRenderTarget(null);
@@ -56458,8 +56294,7 @@ class RenderingComposer {
56458
56294
  outlineHeight,
56459
56295
  {
56460
56296
  format: RedFormat,
56461
- type: UnsignedByteType,
56462
- depthTexture: new DepthTexture(outlineWidth, outlineHeight)
56297
+ type: UnsignedByteType
56463
56298
  }
56464
56299
  );
56465
56300
  this._outlineTarget.texture.name = "selectionTarget";
@@ -56469,9 +56304,10 @@ class RenderingComposer {
56469
56304
  this._camera,
56470
56305
  this._materials.system.mask
56471
56306
  );
56307
+ this._selectionRenderPass.clearColor = new Color(0);
56308
+ this._selectionRenderPass.clearAlpha = 0;
56472
56309
  this._composer.addPass(this._selectionRenderPass);
56473
56310
  this._outlinePass = new OutlinePass(
56474
- this._camera,
56475
56311
  this._materials.system.outline
56476
56312
  );
56477
56313
  this._composer.addPass(this._outlinePass);
@@ -56524,7 +56360,6 @@ class RenderingComposer {
56524
56360
  set camera(value) {
56525
56361
  this._renderPass.camera = value;
56526
56362
  this._selectionRenderPass.camera = value;
56527
- this._outlinePass.material.camera = value;
56528
56363
  this._camera = value;
56529
56364
  }
56530
56365
  /**
@@ -56566,7 +56401,10 @@ class RenderingComposer {
56566
56401
  delta,
56567
56402
  false
56568
56403
  );
56404
+ const bg = this._scene.threeScene.background;
56405
+ this._scene.threeScene.background = null;
56569
56406
  this._composer.render(delta);
56407
+ this._scene.threeScene.background = bg;
56570
56408
  }
56571
56409
  /**
56572
56410
  * Cleans up all resources used by the composer
@@ -57565,16 +57403,12 @@ let LoadRequest$2 = class LoadRequest2 extends LoadRequest$3 {
57565
57403
  }
57566
57404
  };
57567
57405
  class WebglViewer {
57568
- constructor(settings2) {
57406
+ constructor(options) {
57569
57407
  /**
57570
57408
  * The type of the viewer, indicating it is a WebGL viewer.
57571
57409
  * Useful for distinguishing between different viewer types in a multi-viewer application.
57572
57410
  */
57573
57411
  __publicField(this, "type", "webgl");
57574
- /**
57575
- * The settings configuration used by the viewer.
57576
- */
57577
- __publicField(this, "settings");
57578
57412
  __publicField(this, "_renderer");
57579
57413
  __publicField(this, "_viewport");
57580
57414
  /**
@@ -57594,22 +57428,22 @@ class WebglViewer {
57594
57428
  __publicField(this, "vimCollection", new VimCollection());
57595
57429
  __publicField(this, "_onVimLoaded", new distExports$2.SignalDispatcher());
57596
57430
  __publicField(this, "_updateId");
57597
- this.settings = createViewerSettings(settings2);
57431
+ const settings2 = createViewerSettings(options);
57598
57432
  this._materials = Materials.getInstance();
57599
57433
  const scene = new RenderScene();
57600
- this._viewport = new Viewport$1(this.settings);
57601
- this._camera = new Camera$1(scene, this._viewport, this.settings);
57434
+ this._viewport = new Viewport$1(settings2);
57435
+ this._camera = new Camera$1(scene, this._viewport, settings2);
57602
57436
  this._renderer = new Renderer$1(
57603
57437
  scene,
57604
57438
  this._viewport,
57605
57439
  this._materials,
57606
57440
  this._camera,
57607
- this.settings
57441
+ settings2
57608
57442
  );
57609
57443
  this.selection = createSelection$1();
57610
- this._inputs = createInputHandler(this);
57611
- this._gizmos = new Gizmos(this._renderer, this._viewport, this, this._camera);
57612
- this.materials.applySettings(this.settings.materials);
57444
+ this._inputs = createInputHandler(this, settings2.camera.controls);
57445
+ this._gizmos = new Gizmos(this._renderer, this._viewport, this, this._camera, settings2);
57446
+ this.materials.applySettings(settings2.materials);
57613
57447
  const size = this._renderer.three.getSize(new Vector2());
57614
57448
  const gpuPicker = new GpuPicker(
57615
57449
  this._renderer.three,
@@ -60201,7 +60035,6 @@ class SocketClient {
60201
60035
  */
60202
60036
  async _onOpen(_) {
60203
60037
  var _a3;
60204
- console.log("WebSocket connection opened to ", this.url);
60205
60038
  clearTimeout(this._connectionTimeout);
60206
60039
  this.updateState({ status: "validating" });
60207
60040
  const issues = await this._validateConnection();