@xeokit/xeokit-sdk 2.6.75 → 2.6.77-slim-rc2

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.
Files changed (33) hide show
  1. package/dist/xeokit-sdk.cjs.js +28 -21
  2. package/dist/xeokit-sdk.es.js +28 -21
  3. package/dist/xeokit-sdk.es5.js +9 -9
  4. package/dist/xeokit-sdk.min.cjs.js +8 -8
  5. package/dist/xeokit-sdk.min.es.js +8 -8
  6. package/dist/xeokit-sdk.min.es5.js +7 -7
  7. package/package.json +2 -3
  8. package/src/extras/Skybox/Skybox.js +139 -0
  9. package/src/extras/index.js +2 -1
  10. package/src/plugins/CxConverterIFCLoaderPlugin/CxConverterIFCLoaderPlugin.js +81 -81
  11. package/src/plugins/CxConverterIFCLoaderPlugin/index.js +1 -1
  12. package/src/plugins/FastNavPlugin/FastNavPlugin.js +0 -18
  13. package/src/plugins/SectionPlanesPlugin/Control.js +1 -1
  14. package/src/plugins/index.js +0 -1
  15. package/src/viewer/scene/camera/CameraFlightAnimation.js +2 -2
  16. package/src/viewer/scene/canvas/Canvas.js +7 -4
  17. package/src/viewer/scene/index.js +0 -1
  18. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js +5 -0
  19. package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorRenderer.js +5 -0
  20. package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesFlatColorRenderer.js +5 -0
  21. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesColorRenderer.js +5 -0
  22. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesFlatColorRenderer.js +5 -0
  23. package/types/plugins/FastNavPlugin/FastNavPlugin.d.ts +5 -0
  24. package/types/plugins/index.d.ts +0 -1
  25. package/types/viewer/scene/index.d.ts +0 -1
  26. package/src/plugins/SkyboxesPlugin/SkyboxesPlugin.js +0 -109
  27. package/src/plugins/SkyboxesPlugin/index.js +0 -1
  28. package/src/viewer/scene/skybox/Skybox.js +0 -224
  29. package/types/plugins/SkyboxesPlugin/SkyboxesPlugin.d.ts +0 -48
  30. package/types/plugins/SkyboxesPlugin/index.d.ts +0 -1
  31. package/types/viewer/scene/skybox/Skybox.d.ts +0 -59
  32. package/types/viewer/scene/skybox/index.d.ts +0 -1
  33. /package/src/{viewer/scene/skybox → extras/Skybox}/index.js +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xeokit/xeokit-sdk",
3
- "version": "2.6.75",
3
+ "version": "2.6.77-slim-rc2",
4
4
  "description": "3D BIM IFC Viewer SDK for AEC engineering applications. Open Source JavaScript Toolkit based on pure WebGL for top performance, real-world coordinates and full double precision",
5
5
  "module": "./dist/xeokit-sdk.es.js",
6
6
  "main": "./dist/xeokit-sdk.cjs.js",
@@ -10,7 +10,6 @@
10
10
  "dev-build": "rollup --config rollup.dev.config.js",
11
11
  "docs": "rm -Rf ./docs/*; ./node_modules/.bin/esdoc",
12
12
  "typedocs": "rm -Rf ./docs/*; typedoc --tsconfig tsconfig.json",
13
- "publish": "npm publish --access public",
14
13
  "changelog": "git fetch; auto-changelog --commit-limit false --package --template changelog-template.hbs",
15
14
  "test": "npx percy exec -- npx playwright test"
16
15
  },
@@ -53,10 +52,10 @@
53
52
  },
54
53
  "homepage": "https://xeokit.io",
55
54
  "dependencies": {
56
- "@creooxag/cx-converter": "^0.0.12-alpha",
57
55
  "@loaders.gl/core": "^4.3.3",
58
56
  "@loaders.gl/gltf": "^4.3.3",
59
57
  "@loaders.gl/las": "^4.3.3",
58
+ "@rollup/plugin-replace": "^6.0.2",
60
59
  "html2canvas": "^1.4.1"
61
60
  },
62
61
  "devDependencies": {
@@ -0,0 +1,139 @@
1
+ import {
2
+ ClampToEdgeWrapping,
3
+ LinearEncoding,
4
+ Mesh,
5
+ PhongMaterial,
6
+ ReadableGeometry,
7
+ Texture
8
+ } from "../../viewer/index.js";
9
+
10
+ /**
11
+ * @param {Component} scene
12
+ * @param {*} [cfg] Texture configuration
13
+ * @param {String[]} [cfg.src=null] Path to 6 images
14
+ * @param {Number} [cfg.encoding=LinearEncoding] Texture encoding format. See the {@link Texture#encoding} property for more info.
15
+ */
16
+
17
+ export async function createCombinedTexture(scene, cfg) {
18
+ if(!cfg.src || !Array.isArray(cfg.src) || cfg.src.length !== 6)
19
+ throw new Error("src requires path to 6 images");
20
+ const [
21
+ posX,
22
+ negX,
23
+ posY,
24
+ negY,
25
+ posZ,
26
+ negZ
27
+ ] = cfg.src;
28
+
29
+ if (!posX || !negX || !posY || !negY || !posZ || !negZ) {
30
+ throw new Error("All six images must be provided");
31
+ }
32
+
33
+ const canvas = document.createElement('canvas');
34
+ const ctx = canvas.getContext('2d');
35
+
36
+ const loadImage = src => {
37
+ return new Promise((resolve, reject) => {
38
+ const img = new Image();
39
+ img.crossOrigin = "anonymous";
40
+ img.onload = () => resolve(img);
41
+ img.onerror = () => reject(new Error(`Failed to load image: ${src}`));
42
+ img.src = src;
43
+ });
44
+ };
45
+
46
+ try {
47
+ const [imgPosX, imgNegX, imgPosY, imgNegY, imgPosZ, imgNegZ] = await Promise.all([
48
+ loadImage(posX),
49
+ loadImage(negX),
50
+ loadImage(posY),
51
+ loadImage(negY),
52
+ loadImage(posZ),
53
+ loadImage(negZ)
54
+ ]);
55
+
56
+ const imageSize = imgPosX.width;
57
+ if (
58
+ imgNegX.width !== imageSize || imgPosY.width !== imageSize ||
59
+ imgNegY.width !== imageSize || imgPosZ.width !== imageSize ||
60
+ imgNegZ.width !== imageSize
61
+ ) {
62
+ throw new Error("All skybox textures must have the same dimensions");
63
+ }
64
+
65
+ // Set canvas size for the Christ cross layout (3×4 grid)
66
+ canvas.width = imageSize * 4;
67
+ canvas.height = imageSize * 3;
68
+
69
+ ctx.fillStyle = 'black';
70
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
71
+
72
+ ctx.drawImage(imgNegX, imageSize * 0, imageSize * 1, imageSize, imageSize); // -X (left)
73
+ ctx.drawImage(imgPosX, imageSize * 2, imageSize * 1, imageSize, imageSize); // +X (right)
74
+ ctx.drawImage(imgPosY, imageSize * 1, imageSize * 0, imageSize, imageSize); // +Y (top)
75
+ ctx.drawImage(imgNegY, imageSize * 1, imageSize * 2, imageSize, imageSize); // -Y (bottom)
76
+ ctx.drawImage(imgPosZ, imageSize * 1, imageSize * 1, imageSize, imageSize); // +Z (front)
77
+ ctx.drawImage(imgNegZ, imageSize * 3, imageSize * 1, imageSize, imageSize); // -Z (back)
78
+
79
+ const combinedTexture = new Texture(scene, {
80
+ image: canvas,
81
+ flipY: true,
82
+ wrapS: ClampToEdgeWrapping,
83
+ wrapT: ClampToEdgeWrapping,
84
+ encoding: cfg.encoding || LinearEncoding
85
+ });
86
+
87
+ return combinedTexture;
88
+ } catch (error) {
89
+ console.error("Error creating combined skybox texture:", error);
90
+ throw error;
91
+ }
92
+ }
93
+
94
+ /**
95
+ * @param {Component} scene
96
+ * @param {Texture} [texture] Texture to be used on the skybox mesh
97
+ */
98
+
99
+ export function createSkyboxMesh(scene, texture) {
100
+
101
+ return new Mesh(scene, {
102
+
103
+ geometry: new ReadableGeometry(scene, { // Box-shaped geometry
104
+ primitive: "triangles",
105
+ positions: [
106
+ 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, // v0-v1-v2-v3 front
107
+ 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, // v0-v3-v4-v5 right
108
+ 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, // v0-v5-v6-v1 top
109
+ -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, // v1-v6-v7-v2 left
110
+ -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, // v7-v4-v3-v2 bottom
111
+ 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1 // v4-v7-v6-v5 back
112
+ ],
113
+ uv: [
114
+ 0.5, 0.6666, 0.25, 0.6666, 0.25, 0.3333, 0.5, 0.3333, 0.5, 0.6666, 0.5, 0.3333, 0.75, 0.3333, 0.75, 0.6666,
115
+ 0.5, 0.6666, 0.5, 1, 0.25, 1, 0.25, 0.6666, 0.25, 0.6666, 0.0, 0.6666, 0.0, 0.3333, 0.25, 0.3333,
116
+ 0.25, 0, 0.50, 0, 0.50, 0.3333, 0.25, 0.3333, 0.75, 0.3333, 1.0, 0.3333, 1.0, 0.6666, 0.75, 0.6666
117
+ ],
118
+ indices: [
119
+ 0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, 8, 9, 10, 8, 10, 11,
120
+ 12, 13, 14, 12, 14, 15, 16, 17, 18, 16, 18, 19, 20, 21, 22, 20, 22, 23
121
+ ]
122
+ }),
123
+ background: true,
124
+ scale: [1000, 1000, 1000],
125
+ rotation: [0, -90, 0],
126
+ material: new PhongMaterial(scene, {
127
+ ambient: [0, 0, 0],
128
+ diffuse: [0, 0, 0],
129
+ specular: [0, 0, 0],
130
+ emissive: [1, 1, 1],
131
+ emissiveMap: texture,
132
+ backfaces: true // Show interior faces of our skybox geometry
133
+ }),
134
+ visible: true,
135
+ pickable: false,
136
+ clippable: false,
137
+ collidable: false
138
+ });
139
+ }
@@ -2,4 +2,5 @@ export * from "./ContextMenu/index.js";
2
2
  export * from "./PointerLens/index.js";
3
3
  export * from "./collision/index.js";
4
4
  export * from "./MarqueePicker/index.js";
5
- export * from "./PointerCircle/index.js";
5
+ export * from "./PointerCircle/index.js";
6
+ export * from "./Skybox/index.js";
@@ -1,86 +1,86 @@
1
- import { Plugin } from "../../viewer/Plugin.js";
2
- import { GLTFLoaderPlugin } from "../GLTFLoaderPlugin/GLTFLoaderPlugin.js";
3
- import { ifc2gltf } from "@creooxag/cx-converter";
1
+ // import { Plugin } from "../../viewer/Plugin.js";
2
+ // import { GLTFLoaderPlugin } from "../GLTFLoaderPlugin/GLTFLoaderPlugin.js";
3
+ // import { ifc2gltf } from "@creooxag/cx-converter";
4
4
 
5
- /**
6
- * Fetches a file from the given URL and returns its contents as text.
7
- *
8
- * @param {string} url - The URL to fetch the file from.
9
- * @returns {Promise<string>} A promise that resolves to the file contents.
10
- * @private
11
- */
12
- async function fetchFile(url) {
13
- try {
14
- const response = await fetch(url);
15
- if (!response.ok) {
16
- throw new Error(`HTTP error! Status: ${response.status}`);
17
- }
18
- return response.text();
19
- } catch (error) {
20
- console.error('Error fetching file:', error);
21
- }
22
- }
5
+ // /**
6
+ // * Fetches a file from the given URL and returns its contents as text.
7
+ // *
8
+ // * @param {string} url - The URL to fetch the file from.
9
+ // * @returns {Promise<string>} A promise that resolves to the file contents.
10
+ // * @private
11
+ // */
12
+ // async function fetchFile(url) {
13
+ // try {
14
+ // const response = await fetch(url);
15
+ // if (!response.ok) {
16
+ // throw new Error(`HTTP error! Status: ${response.status}`);
17
+ // }
18
+ // return response.text();
19
+ // } catch (error) {
20
+ // console.error('Error fetching file:', error);
21
+ // }
22
+ // }
23
23
 
24
- /**
25
- * {@link Viewer} plugin that uses [CxConverter](https://github.com/Creoox/cxconverter) to load BIM models directly from IFC files, using its WebAssembly buid from [npm package](https://www.npmjs.com/package/@creooxag/cx-converter).
26
- *
27
- * ## Overview
28
- * The WebAssembly build of CxConverter is still in alfa stage, so it may not work as expected. This documentation will be updated as the library and the plugin evolve. The example below shows how to use the plugin:
29
- * ````javascript
30
- * import { CxConverterIFCLoaderPlugin, Viewer } from "../../dist/xeokit-sdk.es.js";
31
- * const cxConverterIFCLoaderPlugin = new CxConverterIFCLoaderPlugin(viewer);
32
- *
33
- * const sceneModel = await cxConverterIFCLoaderPlugin.load({
34
- * src: "../../assets/models/ifc/Duplex.ifc"
35
- * });
36
- * ````
37
- See the code in action [here](https://xeokit.github.io/xeokit-sdk/examples/buildings/#cxConverterIFC_vbo_Duplex).
38
- */
24
+ // /**
25
+ // * {@link Viewer} plugin that uses [CxConverter](https://github.com/Creoox/cxconverter) to load BIM models directly from IFC files, using its WebAssembly buid from [npm package](https://www.npmjs.com/package/@creooxag/cx-converter).
26
+ // *
27
+ // * ## Overview
28
+ // * The WebAssembly build of CxConverter is still in alfa stage, so it may not work as expected. This documentation will be updated as the library and the plugin evolve. The example below shows how to use the plugin:
29
+ // * ````javascript
30
+ // * import { CxConverterIFCLoaderPlugin, Viewer } from "../../dist/xeokit-sdk.es.js";
31
+ // * const cxConverterIFCLoaderPlugin = new CxConverterIFCLoaderPlugin(viewer);
32
+ // *
33
+ // * const sceneModel = await cxConverterIFCLoaderPlugin.load({
34
+ // * src: "../../assets/models/ifc/Duplex.ifc"
35
+ // * });
36
+ // * ````
37
+ // See the code in action [here](https://xeokit.github.io/xeokit-sdk/examples/buildings/#cxConverterIFC_vbo_Duplex).
38
+ // */
39
39
 
40
- class CxConverterIFCLoaderPlugin extends Plugin {
41
- /**
42
- * @constructor
43
- * @param {Viewer} viewer The Viewer.
44
- * @param {Object} [cfg={}] Plugin configuration.
45
- */
46
- constructor(viewer, cfg = {}) {
47
- super("ifcLoader", viewer, cfg);
40
+ // class CxConverterIFCLoaderPlugin extends Plugin {
41
+ // /**
42
+ // * @constructor
43
+ // * @param {Viewer} viewer The Viewer.
44
+ // * @param {Object} [cfg={}] Plugin configuration.
45
+ // */
46
+ // constructor(viewer, cfg = {}) {
47
+ // super("ifcLoader", viewer, cfg);
48
48
 
49
- /**
50
- * The GLTFLoaderPlugin used internally to load the converted GLTF.
51
- * @type {GLTFLoaderPlugin}
52
- */
53
- this.gltfLoader = new GLTFLoaderPlugin(this.viewer);
54
- }
49
+ // /**
50
+ // * The GLTFLoaderPlugin used internally to load the converted GLTF.
51
+ // * @type {GLTFLoaderPlugin}
52
+ // */
53
+ // this.gltfLoader = new GLTFLoaderPlugin(this.viewer);
54
+ // }
55
55
 
56
- /**
57
- * Loads an IFC model from the given source.
58
- *
59
- * @param {Object} [params={}] Loading parameters.
60
- * @param {string} params.src Path to an IFC file.
61
- * @param {Function} [params.progressCallback] Callback to track loading progress.
62
- * @param {Function} [params.progressTextCallback] Callback to track loading progress with text updates.
63
- * @returns {Promise<SceneModel>} A promise that resolves to the loaded SceneModel.
64
- */
65
- async load(params = {}) {
66
- if (!params.src) {
67
- this.error("load() param expected: src");
68
- }
69
- const data = await fetchFile(params.src);
70
- const { gltf, metaData } = await ifc2gltf(
71
- data,
72
- {
73
- remote: true,
74
- progressCallback: params.progressCallback,
75
- progressTextCallback: params.progressTextCallback
76
- }
77
- );
78
- const sceneModel = this.gltfLoader.load({
79
- id: "myModel",
80
- gltf: gltf,
81
- metaModelJSON: metaData
82
- });
83
- return sceneModel;
84
- }
85
- }
86
- export { CxConverterIFCLoaderPlugin };
56
+ // /**
57
+ // * Loads an IFC model from the given source.
58
+ // *
59
+ // * @param {Object} [params={}] Loading parameters.
60
+ // * @param {string} params.src Path to an IFC file.
61
+ // * @param {Function} [params.progressCallback] Callback to track loading progress.
62
+ // * @param {Function} [params.progressTextCallback] Callback to track loading progress with text updates.
63
+ // * @returns {Promise<SceneModel>} A promise that resolves to the loaded SceneModel.
64
+ // */
65
+ // async load(params = {}) {
66
+ // if (!params.src) {
67
+ // this.error("load() param expected: src");
68
+ // }
69
+ // const data = await fetchFile(params.src);
70
+ // const { gltf, metaData } = await ifc2gltf(
71
+ // data,
72
+ // {
73
+ // remote: true,
74
+ // progressCallback: params.progressCallback,
75
+ // progressTextCallback: params.progressTextCallback
76
+ // }
77
+ // );
78
+ // const sceneModel = this.gltfLoader.load({
79
+ // id: "myModel",
80
+ // gltf: gltf,
81
+ // metaModelJSON: metaData
82
+ // });
83
+ // return sceneModel;
84
+ // }
85
+ // }
86
+ // export { CxConverterIFCLoaderPlugin };
@@ -1 +1 @@
1
- export * from "./CxConverterIFCLoaderPlugin.js";
1
+ // export * from "./CxConverterIFCLoaderPlugin.js";
@@ -165,7 +165,6 @@ class FastNavPlugin extends Plugin {
165
165
  fastMode = false;
166
166
  };
167
167
 
168
- this._onCanvasBoundary = viewer.scene.canvas.on("boundary", switchToLowQuality);
169
168
  this._onCameraMatrix = viewer.scene.camera.on("matrix", switchToLowQuality);
170
169
 
171
170
  this._onSceneTick = viewer.scene.on("tick", (tickEvent) => {
@@ -177,23 +176,6 @@ class FastNavPlugin extends Plugin {
177
176
  switchToHighQuality();
178
177
  }
179
178
  });
180
-
181
- let down = false;
182
-
183
- this._onSceneMouseDown = viewer.scene.input.on("mousedown", () => {
184
- down = true;
185
- });
186
-
187
- this._onSceneMouseUp = viewer.scene.input.on("mouseup", () => {
188
- down = false;
189
- });
190
-
191
- this._onSceneMouseMove = viewer.scene.input.on("mousemove", () => {
192
- if (!down) {
193
- return;
194
- }
195
- switchToLowQuality();
196
- });
197
179
  }
198
180
 
199
181
  /**
@@ -460,7 +460,7 @@ class Control {
460
460
 
461
461
  { // Keep gizmo screen size constant
462
462
  let lastDist = -1;
463
- const setRootNodeScale = size => rootNode.scale = [size, size, size];
463
+ const setRootNodeScale = size => { if (size !== rootNode.scale[0]) { rootNode.scale = [size, size, size]; } };
464
464
  const onSceneTick = scene.on("tick", () => {
465
465
  const dist = Math.abs(math.distVec3(camera.eye, pos));
466
466
  if (camera.projection === "perspective") {
@@ -10,7 +10,6 @@ export * from "./OBJLoaderPlugin/index.js";
10
10
  export * from "./SectionPlanesPlugin/index.js";
11
11
  export * from "./StoreyViewsPlugin/index.js";
12
12
  export * from "./FaceAlignedSectionPlanesPlugin/index.js";
13
- export * from "./SkyboxesPlugin/index.js";
14
13
  export * from "./STLLoaderPlugin/index.js";
15
14
  export * from "./TreeViewPlugin/index.js";
16
15
  export * from "./ViewCullPlugin/index.js";
@@ -330,7 +330,7 @@ class CameraFlightAnimation extends Component {
330
330
  this.fire("started", params, true);
331
331
 
332
332
  this._time1 = Date.now();
333
- this._time2 = this._time1 + (params.duration ? params.duration * 1000 : this._duration);
333
+ this._time2 = this._time1 + (Number.isFinite(params.duration) ? params.duration * 1000 : this._duration);
334
334
 
335
335
  this._flying = true; // False as soon as we stop
336
336
 
@@ -566,7 +566,7 @@ class CameraFlightAnimation extends Component {
566
566
  * @param {Number} value New duration value.
567
567
  */
568
568
  set duration(value) {
569
- this._duration = value ? (value * 1000.0) : 500;
569
+ this._duration = Number.isFinite(value) ? (value * 1000.0) : 500;
570
570
  this.stop();
571
571
  }
572
572
 
@@ -1,7 +1,7 @@
1
1
 
2
- import {math} from '../math/math.js';
3
- import {Component} from '../Component.js';
4
- import {Spinner} from './Spinner.js';
2
+ import { Component } from '../Component.js';
3
+ import { math } from '../math/math.js';
4
+ import { Spinner } from './Spinner.js';
5
5
 
6
6
  const WEBGL_CONTEXT_NAMES = [
7
7
  "webgl2",
@@ -482,9 +482,12 @@ class Canvas extends Component {
482
482
  // Memory leak avoidance
483
483
  this.canvas.removeEventListener("webglcontextlost", this._webglcontextlostListener);
484
484
  this.canvas.removeEventListener("webglcontextrestored", this._webglcontextrestoredListener);
485
+
486
+ this.gl.getExtension("WEBGL_lose_context").loseContext();
485
487
  this.gl = null;
488
+
486
489
  super.destroy();
487
490
  }
488
491
  }
489
492
 
490
- export {Canvas};
493
+ export { Canvas };
@@ -13,7 +13,6 @@ export * from "./nodes/index.js";
13
13
  export * from "./paths/index.js";
14
14
  export * from "./model/index.js";
15
15
  export * from "./sectionPlane/index.js";
16
- export * from "./skybox/index.js";
17
16
  export * from "./utils/index.js";
18
17
  export * from "./Component.js";
19
18
  export * from "./utils.js";
@@ -601,6 +601,11 @@ export class DTXTrianglesColorRenderer {
601
601
  if (scene.logarithmicDepthBufferEnabled) {
602
602
  src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
603
603
  //src.push(" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;");
604
+ } else {
605
+ src.push(" float dx = dFdx(gl_FragCoord.z);")
606
+ src.push(" float dy = dFdy(gl_FragCoord.z);")
607
+ src.push(" float diff = sqrt(dx*dx+dy*dy);");
608
+ src.push(" gl_FragDepth = gl_FragCoord.z + diff;");
604
609
  }
605
610
 
606
611
  if (this._withSAO) {
@@ -225,6 +225,11 @@ export class TrianglesColorRenderer extends TrianglesBatchingRenderer {
225
225
  src.push(" float dy = dFdy(vFragDepth);")
226
226
  src.push(" float diff = sqrt(dx*dx+dy*dy);");
227
227
  src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;");
228
+ } else {
229
+ src.push(" float dx = dFdx(gl_FragCoord.z);")
230
+ src.push(" float dy = dFdy(gl_FragCoord.z);")
231
+ src.push(" float diff = sqrt(dx*dx+dy*dy);");
232
+ src.push(" gl_FragDepth = gl_FragCoord.z + diff;");
228
233
  }
229
234
 
230
235
  if (this._withSAO) {
@@ -233,6 +233,11 @@ export class TrianglesFlatColorRenderer extends TrianglesBatchingRenderer {
233
233
 
234
234
  if (scene.logarithmicDepthBufferEnabled) {
235
235
  src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
236
+ } else {
237
+ src.push(" float dx = dFdx(gl_FragCoord.z);")
238
+ src.push(" float dy = dFdy(gl_FragCoord.z);")
239
+ src.push(" float diff = sqrt(dx*dx+dy*dy);");
240
+ src.push(" gl_FragDepth = gl_FragCoord.z + diff;");
236
241
  }
237
242
 
238
243
  src.push("}");
@@ -238,6 +238,11 @@ class TrianglesColorRenderer extends TrianglesInstancingRenderer {
238
238
  src.push(" float dy = dFdy(vFragDepth);")
239
239
  src.push(" float diff = sqrt(dx*dx+dy*dy);");
240
240
  src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;");
241
+ } else {
242
+ src.push(" float dx = dFdx(gl_FragCoord.z);")
243
+ src.push(" float dy = dFdy(gl_FragCoord.z);")
244
+ src.push(" float diff = sqrt(dx*dx+dy*dy);");
245
+ src.push(" gl_FragDepth = gl_FragCoord.z + diff;");
241
246
  }
242
247
 
243
248
  // Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
@@ -242,6 +242,11 @@ export class TrianglesFlatColorRenderer extends TrianglesInstancingRenderer {
242
242
 
243
243
  if (scene.logarithmicDepthBufferEnabled) {
244
244
  src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
245
+ } else {
246
+ src.push(" float dx = dFdx(gl_FragCoord.z);")
247
+ src.push(" float dy = dFdy(gl_FragCoord.z);")
248
+ src.push(" float diff = sqrt(dx*dx+dy*dy);");
249
+ src.push(" gl_FragDepth = gl_FragCoord.z + diff;");
245
250
  }
246
251
 
247
252
  src.push("}");
@@ -1,6 +1,9 @@
1
1
  import { Plugin } from "../../viewer/Plugin";
2
2
  import { Viewer } from "../../viewer/Viewer";
3
3
 
4
+ type OnStopped = () => void;
5
+ type OnMoved = () => OnStopped;
6
+
4
7
  export declare type FastNavPluginConfiguration = {
5
8
  /** Optional ID for this plugin, so that we can find it within {@link Viewer.plugins}. */
6
9
  id?: string;
@@ -22,6 +25,8 @@ export declare type FastNavPluginConfiguration = {
22
25
  delayBeforeRestore?: boolean;
23
26
  /** Delay in seconds before restoring normal rendering after we stop interacting with the Viewer. */
24
27
  delayBeforeRestoreSeconds?: number;
28
+ /** Optional callback function fired during moving mode, should return the callback function that will be fired when the interaction stops. */
29
+ onMoved?: OnMoved;
25
30
  };
26
31
 
27
32
  /**
@@ -12,7 +12,6 @@ export * from "./LASLoaderPlugin";
12
12
  export * from "./NavCubePlugin";
13
13
  export * from "./OBJLoaderPlugin";
14
14
  export * from "./SectionPlanesPlugin";
15
- export * from "./SkyboxesPlugin";
16
15
  export * from "./STLLoaderPlugin";
17
16
  export * from "./StoreyViewsPlugin";
18
17
  export * from "./TreeViewPlugin";
@@ -16,7 +16,6 @@ export * from './paths';
16
16
  export * from "./models";
17
17
  export * from "./scene/Scene";
18
18
  export * from "./sectionPlane";
19
- export * from './skybox';
20
19
  export * from "./stats";
21
20
  export * from "./viewport";
22
21
  export * from "./webgl";