vim-web 0.6.0-dev.7 → 0.6.0-dev.9

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
@@ -54043,8 +54043,8 @@ function createMaskMaterial() {
54043
54043
  clipping: true,
54044
54044
  // Use GLSL ES 3.0 for WebGL 2
54045
54045
  glslVersion: GLSL3,
54046
- // Only write depth, not color (outline shader only reads depth)
54047
- colorWrite: false,
54046
+ // Writes 1.0 to color for selected, 0.0 for background (after clear).
54047
+ // Outline shader does edge detection on this binary mask.
54048
54048
  vertexShader: (
54049
54049
  /* glsl */
54050
54050
  `
@@ -54335,51 +54335,38 @@ function createOutlineMaterial() {
54335
54335
  }
54336
54336
  `,
54337
54337
  fragmentShader: `
54338
- #include <packing>
54339
-
54340
- uniform sampler2D depthBuffer;
54341
- uniform float cameraNear;
54342
- uniform float cameraFar;
54338
+ uniform sampler2D sceneBuffer;
54343
54339
  uniform vec4 screenSize;
54344
- uniform vec3 outlineColor;
54345
54340
  uniform float intensity;
54346
54341
 
54347
54342
  in vec2 vUv;
54348
54343
  out vec4 fragColor;
54349
54344
 
54350
- // Use texelFetch for faster indexed access (WebGL 2)
54351
- float getPixelDepth(int x, int y) {
54345
+ // Read binary selection mask: 1.0 = selected, 0.0 = background.
54346
+ // Clamp to texture bounds so edge pixels don't read out-of-bounds
54347
+ // (which returns 0 and creates false outlines at the screen border).
54348
+ float getMask(int x, int y) {
54352
54349
  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);
54356
- }
54357
-
54358
- float saturate(float num) {
54359
- return clamp(num, 0.0, 1.0);
54350
+ pixelCoord = clamp(pixelCoord, ivec2(0), ivec2(screenSize.xy) - 1);
54351
+ return texelFetch(sceneBuffer, pixelCoord, 0).x;
54360
54352
  }
54361
-
54362
- void main() {
54363
- float depth = getPixelDepth(0, 0);
54364
54353
 
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);
54354
+ void main() {
54355
+ // Skip non-selected pixels
54356
+ if (getMask(0, 0) < 0.5) {
54357
+ fragColor = vec4(0.0);
54368
54358
  return;
54369
54359
  }
54370
54360
 
54371
- // Cross edge detection: 4 neighbors at distance 1.
54372
- // step() converts depth diff to binary (edge or not).
54361
+ // Silhouette edge detection: outline where selected borders non-selected.
54373
54362
  // Thickness is controlled by outlineScale (render target resolution).
54374
54363
  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);
54364
+ outline += step(0.5, 1.0 - getMask( 0, -1));
54365
+ outline += step(0.5, 1.0 - getMask( 0, 1));
54366
+ outline += step(0.5, 1.0 - getMask(-1, 0));
54367
+ outline += step(0.5, 1.0 - getMask( 1, 0));
54368
+ outline = clamp(outline * 0.25 * intensity, 0.0, 1.0);
54380
54369
 
54381
- // Output outline intensity to R channel only (RedFormat texture)
54382
- // Merge pass will use this to blend outline color with scene
54383
54370
  fragColor = vec4(outline, 0.0, 0.0, 0.0);
54384
54371
  }
54385
54372
  `
@@ -55524,7 +55511,7 @@ function getDefaultViewerSettings() {
55524
55511
  opacityAlways: 0.1
55525
55512
  }
55526
55513
  },
55527
- background: { color: new Color(12698310) },
55514
+ background: { color: new Color(16777215) },
55528
55515
  skybox: {
55529
55516
  enable: true,
55530
55517
  skyColor: new Color(16777215),
@@ -55567,7 +55554,7 @@ function getDefaultViewerSettings() {
55567
55554
  strokeColor: new Color(16185078)
55568
55555
  },
55569
55556
  outline: {
55570
- intensity: 2,
55557
+ intensity: 3,
55571
55558
  color: new Color(65535),
55572
55559
  scale: 0.75
55573
55560
  }
@@ -56469,6 +56456,8 @@ class RenderingComposer {
56469
56456
  this._camera,
56470
56457
  this._materials.system.mask
56471
56458
  );
56459
+ this._selectionRenderPass.clearColor = new Color(0);
56460
+ this._selectionRenderPass.clearAlpha = 0;
56472
56461
  this._composer.addPass(this._selectionRenderPass);
56473
56462
  this._outlinePass = new OutlinePass(
56474
56463
  this._camera,
@@ -56566,7 +56555,10 @@ class RenderingComposer {
56566
56555
  delta,
56567
56556
  false
56568
56557
  );
56558
+ const bg = this._scene.threeScene.background;
56559
+ this._scene.threeScene.background = null;
56569
56560
  this._composer.render(delta);
56561
+ this._scene.threeScene.background = bg;
56570
56562
  }
56571
56563
  /**
56572
56564
  * Cleans up all resources used by the composer
@@ -57606,10 +57598,10 @@ class WebglViewer {
57606
57598
  this._camera,
57607
57599
  this.settings
57608
57600
  );
57601
+ this.selection = createSelection$1();
57609
57602
  this._inputs = createInputHandler(this);
57610
57603
  this._gizmos = new Gizmos(this._renderer, this._viewport, this, this._camera);
57611
57604
  this.materials.applySettings(this.settings.materials);
57612
- this.selection = createSelection$1();
57613
57605
  const size = this._renderer.three.getSize(new Vector2());
57614
57606
  const gpuPicker = new GpuPicker(
57615
57607
  this._renderer.three,
@@ -60206,6 +60198,7 @@ class SocketClient {
60206
60198
  const issues = await this._validateConnection();
60207
60199
  if (issues !== void 0) {
60208
60200
  this._disconnect(issues);
60201
+ this._connectPromise.resolve(false);
60209
60202
  return;
60210
60203
  }
60211
60204
  this._logger.log("Connected to: ", (_a3 = this._socket) == null ? void 0 : _a3.url);