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.d.ts CHANGED
@@ -316,27 +316,6 @@ type ViewerSettings = {
316
316
  */
317
317
  color: THREE.Color;
318
318
  };
319
- /**
320
- * Skybox options
321
- */
322
- skybox: {
323
- /**
324
- * Enables/Disables skybox.
325
- */
326
- enable: boolean;
327
- /**
328
- * Color for the lower part of the skybox.
329
- */
330
- groundColor: THREE.Color;
331
- /**
332
- * Color for the upper part of the skybox.
333
- */
334
- skyColor: THREE.Color;
335
- /**
336
- * Controls the gradient transition between the sky and the ground.
337
- */
338
- sharpness: number;
339
- };
340
319
  /**
341
320
  * Material options
342
321
  */
@@ -345,39 +324,6 @@ type ViewerSettings = {
345
324
  * Axes gizmo options
346
325
  */
347
326
  axes: Partial<AxesSettings>;
348
- /**
349
- * Skylight (hemisphere light) options
350
- */
351
- skylight: {
352
- /**
353
- * Skylight sky Color.
354
- * Default: THREE.Color(153, 204, 255)
355
- */
356
- skyColor: THREE.Color;
357
- /**
358
- * Skylight ground color.
359
- * Default: THREE.Color(242, 213, 181)
360
- */
361
- groundColor: THREE.Color;
362
- /**
363
- * Skylight intensity.
364
- * Default: 0.8
365
- */
366
- intensity: number;
367
- };
368
- /**
369
- * Sunlight (directional light) options
370
- * Two Blue-Green lights at odd angles. See defaultViewerSettings.
371
- */
372
- sunlights: {
373
- followCamera: boolean;
374
- /** Light position. */
375
- position: THREE.Vector3;
376
- /** Light color. */
377
- color: THREE.Color;
378
- /** Light intensity. */
379
- intensity: number;
380
- }[];
381
327
  rendering: {
382
328
  /**
383
329
  * When true, only renders when changes are detected. When false, renders every frame.
@@ -1659,7 +1605,6 @@ interface IWebglRenderer {
1659
1605
  */
1660
1606
  interface IWebglViewer {
1661
1607
  readonly type: 'webgl';
1662
- readonly settings: ViewerSettings;
1663
1608
  readonly renderer: IWebglRenderer;
1664
1609
  readonly viewport: IWebglViewport;
1665
1610
  readonly selection: IWebglSelection;
@@ -53777,7 +53777,7 @@ void main() {
53777
53777
  }
53778
53778
  };
53779
53779
  class Gizmos {
53780
- constructor(renderer, viewport, viewer, camera2) {
53780
+ constructor(renderer, viewport, viewer, camera2, settings2) {
53781
53781
  __publicField(this, "_viewport");
53782
53782
  __publicField(this, "_measure");
53783
53783
  /**
@@ -53804,9 +53804,9 @@ void main() {
53804
53804
  renderer,
53805
53805
  camera2,
53806
53806
  viewer.inputs,
53807
- viewer.settings
53807
+ settings2
53808
53808
  );
53809
- this.axes = new GizmoAxes(camera2, viewport, viewer.settings.axes);
53809
+ this.axes = new GizmoAxes(camera2, viewport, settings2.axes);
53810
53810
  this.markers = new GizmoMarkers(renderer, viewer.selection);
53811
53811
  (_a3 = viewport.canvas.parentElement) == null ? void 0 : _a3.prepend(this.axes.canvas);
53812
53812
  }
@@ -54209,33 +54209,13 @@ void main() {
54209
54209
  });
54210
54210
  }
54211
54211
  class OutlineMaterial {
54212
- constructor(options, onUpdate) {
54212
+ constructor(onUpdate) {
54213
54213
  __publicField(this, "three");
54214
- __publicField(this, "_camera");
54215
54214
  __publicField(this, "_resolution");
54216
- __publicField(this, "_precision", 1);
54217
54215
  __publicField(this, "_onUpdate");
54218
54216
  this.three = createOutlineMaterial();
54219
54217
  this._onUpdate = onUpdate;
54220
- this._precision = (options == null ? void 0 : options.precision) ?? 1;
54221
- this._resolution = (options == null ? void 0 : options.resolution) ?? new Vector2(1, 1);
54222
- this.resolution = this._resolution;
54223
- if (options == null ? void 0 : options.sceneBuffer) {
54224
- this.sceneBuffer = options.sceneBuffer;
54225
- }
54226
- this.camera = options == null ? void 0 : options.camera;
54227
- }
54228
- /**
54229
- * Precision of the outline. This is used to scale the resolution of the outline.
54230
- */
54231
- get precision() {
54232
- return this._precision;
54233
- }
54234
- set precision(value) {
54235
- var _a3;
54236
- this._precision = value;
54237
- this.resolution = this._resolution;
54238
- (_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
54218
+ this._resolution = new Vector2(1, 1);
54239
54219
  }
54240
54220
  /**
54241
54221
  * Resolution of the outline. This should match the resolution of screen.
@@ -54246,29 +54226,15 @@ void main() {
54246
54226
  set resolution(value) {
54247
54227
  var _a3;
54248
54228
  this.three.uniforms.screenSize.value.set(
54249
- value.x * this._precision,
54250
- value.y * this._precision,
54251
- 1 / (value.x * this._precision),
54252
- 1 / (value.y * this._precision)
54229
+ value.x,
54230
+ value.y,
54231
+ 1 / value.x,
54232
+ 1 / value.y
54253
54233
  );
54254
54234
  this._resolution = value;
54255
54235
  this.three.uniformsNeedUpdate = true;
54256
54236
  (_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
54257
54237
  }
54258
- /**
54259
- * Camera used to render the outline.
54260
- */
54261
- get camera() {
54262
- return this._camera;
54263
- }
54264
- set camera(value) {
54265
- var _a3;
54266
- this._camera = value;
54267
- this.three.uniforms.cameraNear.value = (value == null ? void 0 : value.near) ?? 1;
54268
- this.three.uniforms.cameraFar.value = (value == null ? void 0 : value.far) ?? 1e3;
54269
- this.three.uniformsNeedUpdate = true;
54270
- (_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
54271
- }
54272
54238
  /**
54273
54239
  * Thickness of the outline in pixels (of the outline render target).
54274
54240
  */
@@ -54281,18 +54247,6 @@ void main() {
54281
54247
  this.three.uniformsNeedUpdate = true;
54282
54248
  (_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
54283
54249
  }
54284
- /**
54285
- * Color of the outline.
54286
- */
54287
- get color() {
54288
- return this.three.uniforms.outlineColor.value;
54289
- }
54290
- set color(value) {
54291
- var _a3;
54292
- this.three.uniforms.outlineColor.value.set(value);
54293
- this.three.uniformsNeedUpdate = true;
54294
- (_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
54295
- }
54296
54250
  /**
54297
54251
  * Scene buffer used to render the outline.
54298
54252
  */
@@ -54305,18 +54259,6 @@ void main() {
54305
54259
  this.three.uniformsNeedUpdate = true;
54306
54260
  (_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
54307
54261
  }
54308
- /**
54309
- * Depth buffer used to render the outline.
54310
- */
54311
- get depthBuffer() {
54312
- return this.three.uniforms.depthBuffer.value;
54313
- }
54314
- set depthBuffer(value) {
54315
- var _a3;
54316
- this.three.uniforms.depthBuffer.value = value;
54317
- this.three.uniformsNeedUpdate = true;
54318
- (_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
54319
- }
54320
54262
  /**
54321
54263
  * Dispose of the outline material.
54322
54264
  */
@@ -54330,17 +54272,8 @@ void main() {
54330
54272
  glslVersion: GLSL3,
54331
54273
  depthWrite: false,
54332
54274
  uniforms: {
54333
- // Input buffers
54334
54275
  sceneBuffer: { value: null },
54335
- depthBuffer: { value: null },
54336
- // Input parameters
54337
- cameraNear: { value: 1 },
54338
- cameraFar: { value: 1e3 },
54339
- screenSize: {
54340
- value: new Vector4(1, 1, 1, 1)
54341
- },
54342
- // Options
54343
- outlineColor: { value: new Color(16777215) },
54276
+ screenSize: { value: new Vector4(1, 1, 1, 1) },
54344
54277
  thickness: { value: 2 }
54345
54278
  },
54346
54279
  vertexShader: `
@@ -54662,7 +54595,7 @@ void main() {
54662
54595
  this._modelTransparent = modelTransparent ?? createModelTransparent(onUpdate);
54663
54596
  this._ghost = ghost2 ?? new GhostMaterial(void 0, onUpdate);
54664
54597
  this._mask = mask ?? createMaskMaterial();
54665
- this._outline = outline ?? new OutlineMaterial(void 0, onUpdate);
54598
+ this._outline = outline ?? new OutlineMaterial(onUpdate);
54666
54599
  this._merge = merge ?? new MergeMaterial(onUpdate);
54667
54600
  }
54668
54601
  static createInstance(instance) {
@@ -55563,33 +55496,6 @@ void main() {
55563
55496
  }
55564
55497
  },
55565
55498
  background: { color: new Color(16777215) },
55566
- skybox: {
55567
- enable: true,
55568
- skyColor: new Color(16777215),
55569
- // white
55570
- groundColor: new Color(16185078),
55571
- // less white
55572
- sharpness: 2
55573
- },
55574
- skylight: {
55575
- skyColor: new Color(16777215),
55576
- groundColor: new Color(16777215),
55577
- intensity: 0.8
55578
- },
55579
- sunlights: [
55580
- {
55581
- followCamera: true,
55582
- position: new Vector3(1e3, 1e3, 1e3),
55583
- color: new Color(16777215),
55584
- intensity: 0.8
55585
- },
55586
- {
55587
- followCamera: true,
55588
- position: new Vector3(-1e3, -1e3, -1e3),
55589
- color: new Color(16777215),
55590
- intensity: 0.2
55591
- }
55592
- ],
55593
55499
  materials: {
55594
55500
  useFastMaterials: false,
55595
55501
  standard: {
@@ -55779,11 +55685,11 @@ void main() {
55779
55685
  this._unregisterResize = () => window.removeEventListener("resize", onResize);
55780
55686
  }
55781
55687
  };
55782
- function createInputHandler(viewer) {
55688
+ function createInputHandler(viewer, controls) {
55783
55689
  return new InputHandler(
55784
55690
  viewer.viewport.canvas,
55785
55691
  createAdapter$2(viewer),
55786
- viewer.settings.camera.controls
55692
+ controls
55787
55693
  );
55788
55694
  }
55789
55695
  function createAdapter$2(viewer) {
@@ -56295,24 +56201,17 @@ void main() {
56295
56201
  }
56296
56202
  }
56297
56203
  class OutlinePass extends Pass {
56298
- constructor(camera2, material) {
56204
+ constructor(material) {
56299
56205
  super();
56300
56206
  __publicField(this, "_fsQuad");
56301
56207
  __publicField(this, "material");
56302
- this.material = material ?? new OutlineMaterial();
56303
- this.material.camera = camera2;
56208
+ this.material = material;
56304
56209
  this._fsQuad = new FullScreenQuad(this.material.three);
56305
56210
  this.needsSwap = true;
56306
56211
  }
56307
56212
  setSize(width, height) {
56308
56213
  this.material.resolution = new Vector2(width, height);
56309
56214
  }
56310
- get camera() {
56311
- return this.material.camera;
56312
- }
56313
- set camera(value) {
56314
- this.material.camera = value;
56315
- }
56316
56215
  dispose() {
56317
56216
  this._fsQuad.dispose();
56318
56217
  this.material.dispose();
@@ -56320,7 +56219,6 @@ void main() {
56320
56219
  render(renderer, writeBuffer, readBuffer) {
56321
56220
  const depthBufferValue = writeBuffer.depthBuffer;
56322
56221
  writeBuffer.depthBuffer = false;
56323
- this.material.depthBuffer = readBuffer.depthTexture;
56324
56222
  this.material.sceneBuffer = readBuffer.texture;
56325
56223
  if (this.renderToScreen) {
56326
56224
  renderer.setRenderTarget(null);
@@ -56497,8 +56395,7 @@ void main() {
56497
56395
  outlineHeight,
56498
56396
  {
56499
56397
  format: RedFormat,
56500
- type: UnsignedByteType,
56501
- depthTexture: new DepthTexture(outlineWidth, outlineHeight)
56398
+ type: UnsignedByteType
56502
56399
  }
56503
56400
  );
56504
56401
  this._outlineTarget.texture.name = "selectionTarget";
@@ -56512,7 +56409,6 @@ void main() {
56512
56409
  this._selectionRenderPass.clearAlpha = 0;
56513
56410
  this._composer.addPass(this._selectionRenderPass);
56514
56411
  this._outlinePass = new OutlinePass(
56515
- this._camera,
56516
56412
  this._materials.system.outline
56517
56413
  );
56518
56414
  this._composer.addPass(this._outlinePass);
@@ -56565,7 +56461,6 @@ void main() {
56565
56461
  set camera(value) {
56566
56462
  this._renderPass.camera = value;
56567
56463
  this._selectionRenderPass.camera = value;
56568
- this._outlinePass.material.camera = value;
56569
56464
  this._camera = value;
56570
56465
  }
56571
56466
  /**
@@ -57609,16 +57504,12 @@ void main() {
57609
57504
  }
57610
57505
  };
57611
57506
  class WebglViewer {
57612
- constructor(settings2) {
57507
+ constructor(options) {
57613
57508
  /**
57614
57509
  * The type of the viewer, indicating it is a WebGL viewer.
57615
57510
  * Useful for distinguishing between different viewer types in a multi-viewer application.
57616
57511
  */
57617
57512
  __publicField(this, "type", "webgl");
57618
- /**
57619
- * The settings configuration used by the viewer.
57620
- */
57621
- __publicField(this, "settings");
57622
57513
  __publicField(this, "_renderer");
57623
57514
  __publicField(this, "_viewport");
57624
57515
  /**
@@ -57638,22 +57529,22 @@ void main() {
57638
57529
  __publicField(this, "vimCollection", new VimCollection());
57639
57530
  __publicField(this, "_onVimLoaded", new distExports$2.SignalDispatcher());
57640
57531
  __publicField(this, "_updateId");
57641
- this.settings = createViewerSettings(settings2);
57532
+ const settings2 = createViewerSettings(options);
57642
57533
  this._materials = Materials.getInstance();
57643
57534
  const scene = new RenderScene();
57644
- this._viewport = new Viewport$1(this.settings);
57645
- this._camera = new Camera$1(scene, this._viewport, this.settings);
57535
+ this._viewport = new Viewport$1(settings2);
57536
+ this._camera = new Camera$1(scene, this._viewport, settings2);
57646
57537
  this._renderer = new Renderer$1(
57647
57538
  scene,
57648
57539
  this._viewport,
57649
57540
  this._materials,
57650
57541
  this._camera,
57651
- this.settings
57542
+ settings2
57652
57543
  );
57653
57544
  this.selection = createSelection$1();
57654
- this._inputs = createInputHandler(this);
57655
- this._gizmos = new Gizmos(this._renderer, this._viewport, this, this._camera);
57656
- this.materials.applySettings(this.settings.materials);
57545
+ this._inputs = createInputHandler(this, settings2.camera.controls);
57546
+ this._gizmos = new Gizmos(this._renderer, this._viewport, this, this._camera, settings2);
57547
+ this.materials.applySettings(settings2.materials);
57657
57548
  const size = this._renderer.three.getSize(new Vector2());
57658
57549
  const gpuPicker = new GpuPicker(
57659
57550
  this._renderer.three,