vim-web 0.6.0-dev.10 → 0.6.0-dev.11

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
@@ -53761,7 +53761,7 @@ let SectionBox$1 = class SectionBox {
53761
53761
  }
53762
53762
  };
53763
53763
  class Gizmos {
53764
- constructor(renderer, viewport, viewer, camera2) {
53764
+ constructor(renderer, viewport, viewer, camera2, settings2) {
53765
53765
  __publicField(this, "_viewport");
53766
53766
  __publicField(this, "_measure");
53767
53767
  /**
@@ -53788,9 +53788,9 @@ class Gizmos {
53788
53788
  renderer,
53789
53789
  camera2,
53790
53790
  viewer.inputs,
53791
- viewer.settings
53791
+ settings2
53792
53792
  );
53793
- this.axes = new GizmoAxes(camera2, viewport, viewer.settings.axes);
53793
+ this.axes = new GizmoAxes(camera2, viewport, settings2.axes);
53794
53794
  this.markers = new GizmoMarkers(renderer, viewer.selection);
53795
53795
  (_a3 = viewport.canvas.parentElement) == null ? void 0 : _a3.prepend(this.axes.canvas);
53796
53796
  }
@@ -54193,33 +54193,13 @@ function createGhostShader() {
54193
54193
  });
54194
54194
  }
54195
54195
  class OutlineMaterial {
54196
- constructor(options, onUpdate) {
54196
+ constructor(onUpdate) {
54197
54197
  __publicField(this, "three");
54198
- __publicField(this, "_camera");
54199
54198
  __publicField(this, "_resolution");
54200
- __publicField(this, "_precision", 1);
54201
54199
  __publicField(this, "_onUpdate");
54202
54200
  this.three = createOutlineMaterial();
54203
54201
  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);
54202
+ this._resolution = new Vector2(1, 1);
54223
54203
  }
54224
54204
  /**
54225
54205
  * Resolution of the outline. This should match the resolution of screen.
@@ -54230,29 +54210,15 @@ class OutlineMaterial {
54230
54210
  set resolution(value) {
54231
54211
  var _a3;
54232
54212
  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)
54213
+ value.x,
54214
+ value.y,
54215
+ 1 / value.x,
54216
+ 1 / value.y
54237
54217
  );
54238
54218
  this._resolution = value;
54239
54219
  this.three.uniformsNeedUpdate = true;
54240
54220
  (_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
54241
54221
  }
54242
- /**
54243
- * Camera used to render the outline.
54244
- */
54245
- get camera() {
54246
- return this._camera;
54247
- }
54248
- set camera(value) {
54249
- 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
54222
  /**
54257
54223
  * Thickness of the outline in pixels (of the outline render target).
54258
54224
  */
@@ -54265,18 +54231,6 @@ class OutlineMaterial {
54265
54231
  this.three.uniformsNeedUpdate = true;
54266
54232
  (_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
54267
54233
  }
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);
54277
- this.three.uniformsNeedUpdate = true;
54278
- (_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
54279
- }
54280
54234
  /**
54281
54235
  * Scene buffer used to render the outline.
54282
54236
  */
@@ -54289,18 +54243,6 @@ class OutlineMaterial {
54289
54243
  this.three.uniformsNeedUpdate = true;
54290
54244
  (_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
54291
54245
  }
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
54246
  /**
54305
54247
  * Dispose of the outline material.
54306
54248
  */
@@ -54314,17 +54256,8 @@ function createOutlineMaterial() {
54314
54256
  glslVersion: GLSL3,
54315
54257
  depthWrite: false,
54316
54258
  uniforms: {
54317
- // Input buffers
54318
54259
  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) },
54260
+ screenSize: { value: new Vector4(1, 1, 1, 1) },
54328
54261
  thickness: { value: 2 }
54329
54262
  },
54330
54263
  vertexShader: `
@@ -54646,7 +54579,7 @@ const _Materials = class _Materials {
54646
54579
  this._modelTransparent = modelTransparent ?? createModelTransparent(onUpdate);
54647
54580
  this._ghost = ghost2 ?? new GhostMaterial(void 0, onUpdate);
54648
54581
  this._mask = mask ?? createMaskMaterial();
54649
- this._outline = outline ?? new OutlineMaterial(void 0, onUpdate);
54582
+ this._outline = outline ?? new OutlineMaterial(onUpdate);
54650
54583
  this._merge = merge ?? new MergeMaterial(onUpdate);
54651
54584
  }
54652
54585
  static createInstance(instance) {
@@ -55547,33 +55480,6 @@ function getDefaultViewerSettings() {
55547
55480
  }
55548
55481
  },
55549
55482
  background: { color: new Color(16777215) },
55550
- skybox: {
55551
- enable: true,
55552
- skyColor: new Color(16777215),
55553
- // white
55554
- groundColor: new Color(16185078),
55555
- // less white
55556
- sharpness: 2
55557
- },
55558
- skylight: {
55559
- skyColor: new Color(16777215),
55560
- groundColor: new Color(16777215),
55561
- intensity: 0.8
55562
- },
55563
- sunlights: [
55564
- {
55565
- followCamera: true,
55566
- position: new Vector3(1e3, 1e3, 1e3),
55567
- color: new Color(16777215),
55568
- intensity: 0.8
55569
- },
55570
- {
55571
- followCamera: true,
55572
- position: new Vector3(-1e3, -1e3, -1e3),
55573
- color: new Color(16777215),
55574
- intensity: 0.2
55575
- }
55576
- ],
55577
55483
  materials: {
55578
55484
  useFastMaterials: false,
55579
55485
  standard: {
@@ -55763,11 +55669,11 @@ let Viewport$1 = class Viewport {
55763
55669
  this._unregisterResize = () => window.removeEventListener("resize", onResize);
55764
55670
  }
55765
55671
  };
55766
- function createInputHandler(viewer) {
55672
+ function createInputHandler(viewer, controls) {
55767
55673
  return new InputHandler(
55768
55674
  viewer.viewport.canvas,
55769
55675
  createAdapter$2(viewer),
55770
- viewer.settings.camera.controls
55676
+ controls
55771
55677
  );
55772
55678
  }
55773
55679
  function createAdapter$2(viewer) {
@@ -56279,24 +56185,17 @@ class RenderPass extends Pass {
56279
56185
  }
56280
56186
  }
56281
56187
  class OutlinePass extends Pass {
56282
- constructor(camera2, material) {
56188
+ constructor(material) {
56283
56189
  super();
56284
56190
  __publicField(this, "_fsQuad");
56285
56191
  __publicField(this, "material");
56286
- this.material = material ?? new OutlineMaterial();
56287
- this.material.camera = camera2;
56192
+ this.material = material;
56288
56193
  this._fsQuad = new FullScreenQuad(this.material.three);
56289
56194
  this.needsSwap = true;
56290
56195
  }
56291
56196
  setSize(width, height) {
56292
56197
  this.material.resolution = new Vector2(width, height);
56293
56198
  }
56294
- get camera() {
56295
- return this.material.camera;
56296
- }
56297
- set camera(value) {
56298
- this.material.camera = value;
56299
- }
56300
56199
  dispose() {
56301
56200
  this._fsQuad.dispose();
56302
56201
  this.material.dispose();
@@ -56304,7 +56203,6 @@ class OutlinePass extends Pass {
56304
56203
  render(renderer, writeBuffer, readBuffer) {
56305
56204
  const depthBufferValue = writeBuffer.depthBuffer;
56306
56205
  writeBuffer.depthBuffer = false;
56307
- this.material.depthBuffer = readBuffer.depthTexture;
56308
56206
  this.material.sceneBuffer = readBuffer.texture;
56309
56207
  if (this.renderToScreen) {
56310
56208
  renderer.setRenderTarget(null);
@@ -56481,8 +56379,7 @@ class RenderingComposer {
56481
56379
  outlineHeight,
56482
56380
  {
56483
56381
  format: RedFormat,
56484
- type: UnsignedByteType,
56485
- depthTexture: new DepthTexture(outlineWidth, outlineHeight)
56382
+ type: UnsignedByteType
56486
56383
  }
56487
56384
  );
56488
56385
  this._outlineTarget.texture.name = "selectionTarget";
@@ -56496,7 +56393,6 @@ class RenderingComposer {
56496
56393
  this._selectionRenderPass.clearAlpha = 0;
56497
56394
  this._composer.addPass(this._selectionRenderPass);
56498
56395
  this._outlinePass = new OutlinePass(
56499
- this._camera,
56500
56396
  this._materials.system.outline
56501
56397
  );
56502
56398
  this._composer.addPass(this._outlinePass);
@@ -56549,7 +56445,6 @@ class RenderingComposer {
56549
56445
  set camera(value) {
56550
56446
  this._renderPass.camera = value;
56551
56447
  this._selectionRenderPass.camera = value;
56552
- this._outlinePass.material.camera = value;
56553
56448
  this._camera = value;
56554
56449
  }
56555
56450
  /**
@@ -57593,16 +57488,12 @@ let LoadRequest$2 = class LoadRequest2 extends LoadRequest$3 {
57593
57488
  }
57594
57489
  };
57595
57490
  class WebglViewer {
57596
- constructor(settings2) {
57491
+ constructor(options) {
57597
57492
  /**
57598
57493
  * The type of the viewer, indicating it is a WebGL viewer.
57599
57494
  * Useful for distinguishing between different viewer types in a multi-viewer application.
57600
57495
  */
57601
57496
  __publicField(this, "type", "webgl");
57602
- /**
57603
- * The settings configuration used by the viewer.
57604
- */
57605
- __publicField(this, "settings");
57606
57497
  __publicField(this, "_renderer");
57607
57498
  __publicField(this, "_viewport");
57608
57499
  /**
@@ -57622,22 +57513,22 @@ class WebglViewer {
57622
57513
  __publicField(this, "vimCollection", new VimCollection());
57623
57514
  __publicField(this, "_onVimLoaded", new distExports$2.SignalDispatcher());
57624
57515
  __publicField(this, "_updateId");
57625
- this.settings = createViewerSettings(settings2);
57516
+ const settings2 = createViewerSettings(options);
57626
57517
  this._materials = Materials.getInstance();
57627
57518
  const scene = new RenderScene();
57628
- this._viewport = new Viewport$1(this.settings);
57629
- this._camera = new Camera$1(scene, this._viewport, this.settings);
57519
+ this._viewport = new Viewport$1(settings2);
57520
+ this._camera = new Camera$1(scene, this._viewport, settings2);
57630
57521
  this._renderer = new Renderer$1(
57631
57522
  scene,
57632
57523
  this._viewport,
57633
57524
  this._materials,
57634
57525
  this._camera,
57635
- this.settings
57526
+ settings2
57636
57527
  );
57637
57528
  this.selection = createSelection$1();
57638
- this._inputs = createInputHandler(this);
57639
- this._gizmos = new Gizmos(this._renderer, this._viewport, this, this._camera);
57640
- this.materials.applySettings(this.settings.materials);
57529
+ this._inputs = createInputHandler(this, settings2.camera.controls);
57530
+ this._gizmos = new Gizmos(this._renderer, this._viewport, this, this._camera, settings2);
57531
+ this.materials.applySettings(settings2.materials);
57641
57532
  const size = this._renderer.three.getSize(new Vector2());
57642
57533
  const gpuPicker = new GpuPicker(
57643
57534
  this._renderer.three,