@xeokit/xeokit-sdk 2.6.78-rc2-no-las → 2.6.80
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/xeokit-sdk.cjs.js +32541 -15222
- package/dist/xeokit-sdk.es.js +32540 -15223
- package/dist/xeokit-sdk.es5.js +29444 -30853
- package/dist/xeokit-sdk.min.cjs.js +8 -8
- package/dist/xeokit-sdk.min.es.js +8 -8
- package/dist/xeokit-sdk.min.es5.js +33 -34
- package/package.json +4 -7
- package/src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js +4 -4
- package/src/plugins/CxConverterIFCLoaderPlugin/CxConverterIFCLoaderPlugin.js +68 -68
- package/src/plugins/CxConverterIFCLoaderPlugin/index.js +1 -1
- package/src/plugins/LASLoaderPlugin/index.js +1 -1
- package/src/plugins/XKTLoaderPlugin/parsers/ParserV1.js +5 -5
- package/src/plugins/XKTLoaderPlugin/parsers/ParserV10.js +5 -5
- package/src/plugins/XKTLoaderPlugin/parsers/ParserV12.js +9 -9
- package/src/plugins/XKTLoaderPlugin/parsers/ParserV2.js +5 -5
- package/src/plugins/XKTLoaderPlugin/parsers/ParserV3.js +5 -5
- package/src/plugins/XKTLoaderPlugin/parsers/ParserV4.js +5 -5
- package/src/plugins/XKTLoaderPlugin/parsers/ParserV5.js +5 -5
- package/src/plugins/XKTLoaderPlugin/parsers/ParserV6.js +5 -5
- package/src/plugins/XKTLoaderPlugin/parsers/ParserV7.js +5 -5
- package/src/plugins/XKTLoaderPlugin/parsers/ParserV8.js +5 -5
- package/src/plugins/XKTLoaderPlugin/parsers/ParserV9.js +5 -5
- package/src/plugins/index.js +2 -2
- package/src/viewer/scene/Entity.js +6 -0
- package/src/viewer/scene/canvas/Canvas.js +1 -1
- package/src/viewer/scene/model/SceneModelEntity.js +26 -0
- package/src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js +44 -0
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorTextureRenderer.js +1 -1
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesFlatColorRenderer.js +1 -1
- package/src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js +58 -0
- package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesColorTextureRenderer.js +1 -1
- package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesFlatColorRenderer.js +1 -1
- package/src/viewer/scene/nodes/Node.js +1 -1
- package/src/viewer/scene/sectionCaps/SectionCaps.js +33 -27
- package/src/viewer/scene/webgl/ArrayBuf.js +20 -0
- package/types/plugins/AngleMeasurementsPlugin/AngleMeasurement.d.ts +108 -26
- package/types/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.d.ts +14 -3
- package/types/plugins/DotBIMLoaderPlugin/DotBIMLoaderPlugin.d.ts +23 -5
- package/types/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.d.ts +25 -5
- package/types/plugins/LASLoaderPlugin/LASLoaderPlugin.d.ts +100 -20
- package/types/plugins/STLLoaderPlugin/STLLoaderPlugin.d.ts +14 -3
- package/types/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.d.ts +83 -18
- package/types/plugins/XKTLoaderPlugin/XKTLoaderPlugin.d.ts +106 -21
- package/types/viewer/Configs.d.ts +24 -6
- package/types/viewer/scene/CameraControl/CameraControl.d.ts +445 -66
- package/types/viewer/scene/Component.d.ts +1 -1
- package/types/viewer/scene/Entity.d.ts +191 -40
- package/types/viewer/scene/camera/Camera.d.ts +170 -50
- package/types/viewer/scene/camera/CameraFlightAnimation.d.ts +57 -8
- package/types/viewer/scene/camera/CameraPath.d.ts +13 -8
- package/types/viewer/scene/camera/CameraPathAnimation.d.ts +22 -4
- package/types/viewer/scene/camera/CustomProjection.d.ts +21 -6
- package/types/viewer/scene/camera/Frustum.d.ts +90 -18
- package/types/viewer/scene/camera/Ortho.d.ts +54 -14
- package/types/viewer/scene/camera/Perspective.d.ts +70 -16
- package/types/viewer/scene/geometry/ReadableGeometry.d.ts +25 -21
- package/types/viewer/scene/geometry/VBOGeometry.d.ts +7 -7
- package/types/viewer/scene/lights/AmbientLight.d.ts +26 -4
- package/types/viewer/scene/lights/DirLight.d.ts +52 -8
- package/types/viewer/scene/lights/PointLight.d.ts +93 -14
- package/types/viewer/scene/materials/EdgeMaterial.d.ts +37 -12
- package/types/viewer/scene/materials/EmphasisMaterial.d.ts +119 -22
- package/types/viewer/scene/materials/Fresnel.d.ts +50 -10
- package/types/viewer/scene/materials/LambertMaterial.d.ts +90 -16
- package/types/viewer/scene/materials/LinesMaterial.d.ts +25 -7
- package/types/viewer/scene/materials/MetallicMaterial.d.ts +127 -40
- package/types/viewer/scene/materials/PhongMaterial.d.ts +185 -52
- package/types/viewer/scene/materials/PointsMaterial.d.ts +101 -20
- package/types/viewer/scene/materials/SpecularMaterial.d.ts +117 -41
- package/types/viewer/scene/materials/Texture.d.ts +62 -22
- package/types/viewer/scene/models/SceneModel.d.ts +233 -76
- package/types/viewer/scene/models/SceneModelEntity.d.ts +217 -51
- package/types/viewer/scene/models/SceneModelMesh.d.ts +4 -4
- package/types/viewer/scene/models/SceneModelTransform.d.ts +59 -14
- package/types/viewer/scene/paths/CubicBezierCurve.d.ts +73 -12
- package/types/viewer/scene/paths/Curve.d.ts +19 -6
- package/types/viewer/scene/paths/Path.d.ts +57 -10
- package/types/viewer/scene/paths/QuadraticBezierCurve.d.ts +57 -10
- package/types/viewer/scene/paths/SplineCurve.d.ts +32 -6
- package/types/viewer/scene/scene/Scene.d.ts +196 -94
- package/types/viewer/scene/sectionPlane/SectionPlane.d.ts +69 -12
- package/types/viewer/scene/viewport/Viewport.d.ts +14 -4
- package/types/viewer/scene/webgl/PickResult.d.ts +28 -13
- package/dist/xeokit-sdk.es5.js.map +0 -1
- package/dist/xeokit-sdk.min.es5.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xeokit/xeokit-sdk",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.80",
|
|
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",
|
|
7
7
|
"types": "./types/index.d.ts",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"build": "rollup --config rollup.config.js",
|
|
9
|
+
"build": "rollup --config rollup.config.js; rollup --config rollup.minified.config.js",
|
|
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",
|
|
13
14
|
"changelog": "git fetch; auto-changelog --commit-limit false --package --template changelog-template.hbs",
|
|
14
15
|
"test": "npx percy exec -- npx playwright test"
|
|
15
16
|
},
|
|
@@ -56,10 +57,7 @@
|
|
|
56
57
|
"@loaders.gl/core": "^4.3.3",
|
|
57
58
|
"@loaders.gl/gltf": "^4.3.3",
|
|
58
59
|
"@loaders.gl/las": "^4.3.3",
|
|
59
|
-
"
|
|
60
|
-
"core-js": "^3.42.0",
|
|
61
|
-
"html2canvas": "^1.4.1",
|
|
62
|
-
"pako": "^2.1.0"
|
|
60
|
+
"html2canvas": "^1.4.1"
|
|
63
61
|
},
|
|
64
62
|
"devDependencies": {
|
|
65
63
|
"@babel/core": "^7.18.6",
|
|
@@ -68,7 +66,6 @@
|
|
|
68
66
|
"@percy/playwright": "^1.0.7",
|
|
69
67
|
"@playwright/test": "^1.49.1",
|
|
70
68
|
"@rollup/plugin-babel": "^5.3.1",
|
|
71
|
-
"@rollup/plugin-commonjs": "^28.0.3",
|
|
72
69
|
"@rollup/plugin-node-resolve": "^13.2.1",
|
|
73
70
|
"@types/node": "^22.10.6",
|
|
74
71
|
"auto-changelog": "^2.4.0",
|
|
@@ -796,7 +796,7 @@ class BCFViewpointsPlugin extends Plugin {
|
|
|
796
796
|
let alphaDefined = false;
|
|
797
797
|
|
|
798
798
|
if (color.length === 8) {
|
|
799
|
-
alpha = parseInt(color.substring(0, 2), 16) /
|
|
799
|
+
alpha = parseInt(color.substring(0, 2), 16) / 255;
|
|
800
800
|
if (alpha <= 1.0 && alpha >= 0.95) {
|
|
801
801
|
alpha = 1.0;
|
|
802
802
|
}
|
|
@@ -805,9 +805,9 @@ class BCFViewpointsPlugin extends Plugin {
|
|
|
805
805
|
}
|
|
806
806
|
|
|
807
807
|
const colorize = [
|
|
808
|
-
parseInt(color.substring(0, 2), 16) /
|
|
809
|
-
parseInt(color.substring(2, 4), 16) /
|
|
810
|
-
parseInt(color.substring(4, 6), 16) /
|
|
808
|
+
parseInt(color.substring(0, 2), 16) / 255,
|
|
809
|
+
parseInt(color.substring(2, 4), 16) / 255,
|
|
810
|
+
parseInt(color.substring(4, 6), 16) / 255
|
|
811
811
|
];
|
|
812
812
|
|
|
813
813
|
coloring.components.map(component =>
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { Plugin } from "../../viewer/Plugin.js";
|
|
2
|
+
import { GLTFLoaderPlugin } from "../GLTFLoaderPlugin/GLTFLoaderPlugin.js";
|
|
3
|
+
import { ifc2gltf } from "@creooxag/cxconverter";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
24
|
/**
|
|
25
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/cxconverter).
|
|
@@ -29,58 +29,58 @@
|
|
|
29
29
|
* ````javascript
|
|
30
30
|
* import { CxConverterIFCLoaderPlugin, Viewer } from "../../dist/xeokit-sdk.es.js";
|
|
31
31
|
* const cxConverterIFCLoaderPlugin = new CxConverterIFCLoaderPlugin(viewer);
|
|
32
|
-
*
|
|
32
|
+
*
|
|
33
33
|
* const sceneModel = await cxConverterIFCLoaderPlugin.load({
|
|
34
34
|
* src: "../../assets/models/ifc/Duplex.ifc"
|
|
35
|
-
* });
|
|
35
|
+
* });
|
|
36
36
|
* ````
|
|
37
37
|
See the code in action [here](https://xeokit.github.io/xeokit-sdk/examples/buildings/#cxConverterIFC_vbo_Duplex).
|
|
38
38
|
*/
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
-
|
|
1
|
+
export * from "./CxConverterIFCLoaderPlugin.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export * from "./LASLoaderPlugin.js";
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import {utils} from "../../../viewer/scene/utils.js";
|
|
12
|
-
import
|
|
12
|
+
import * as p from "./lib/pako.js";
|
|
13
13
|
import {math} from "../../../viewer/scene/math/math.js";
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
let pako = window.pako || p;
|
|
16
|
+
if (!pako.inflate) { // See https://github.com/nodeca/pako/issues/97
|
|
17
|
+
pako = pako.default;
|
|
18
|
+
}
|
|
19
19
|
|
|
20
20
|
const decompressColor = (function () {
|
|
21
21
|
const color2 = new Float32Array(3);
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import {utils} from "../../../viewer/scene/utils.js";
|
|
6
|
-
import
|
|
6
|
+
import * as p from "./lib/pako.js";
|
|
7
7
|
import {math} from "../../../viewer/scene/math/math.js";
|
|
8
8
|
import {geometryCompressionUtils} from "../../../viewer/scene/math/geometryCompressionUtils.js";
|
|
9
9
|
import {JPEGMediaType, PNGMediaType} from "../../../viewer/scene/constants/constants.js";
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
let pako = window.pako || p;
|
|
12
|
+
if (!pako.inflate) { // See https://github.com/nodeca/pako/issues/97
|
|
13
|
+
pako = pako.default;
|
|
14
|
+
}
|
|
15
15
|
|
|
16
16
|
const tempVec4a = math.vec4();
|
|
17
17
|
const tempVec4b = math.vec4();
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import {utils} from "../../../viewer/scene/utils.js";
|
|
6
|
-
import
|
|
6
|
+
import * as p from "./lib/pako.js";
|
|
7
7
|
import {math} from "../../../viewer/scene/math/math.js";
|
|
8
8
|
import {geometryCompressionUtils} from "../../../viewer/scene/math/geometryCompressionUtils.js";
|
|
9
9
|
import {JPEGMediaType, PNGMediaType} from "../../../viewer/scene/constants/constants.js";
|
|
10
10
|
import { buildVectorTextGeometry } from "../../../viewer/index.js";
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
let pako = window.pako || p;
|
|
13
|
+
if (!pako.inflate) { // See https://github.com/nodeca/pako/issues/97
|
|
14
|
+
pako = pako.default;
|
|
15
|
+
}
|
|
16
16
|
|
|
17
17
|
const tempVec4a = math.vec4();
|
|
18
18
|
const tempVec4b = math.vec4();
|
|
@@ -526,11 +526,11 @@ function load(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx)
|
|
|
526
526
|
text: axisLabel,
|
|
527
527
|
size: 2
|
|
528
528
|
});
|
|
529
|
-
|
|
529
|
+
|
|
530
530
|
geometryArrays.decompressedPositions = ifcLabel.positions;
|
|
531
531
|
geometryArrays.geometryIndices = ifcLabel.indices;
|
|
532
532
|
geometryArrays.geometryPositions = null;
|
|
533
|
-
|
|
533
|
+
|
|
534
534
|
geometryValid = (geometryArrays.decompressedPositions.length > 0 && geometryArrays.geometryIndices.length > 0);
|
|
535
535
|
break;
|
|
536
536
|
default:
|
|
@@ -564,7 +564,7 @@ function load(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx)
|
|
|
564
564
|
}
|
|
565
565
|
geometryArrays.geometryPositions = null;
|
|
566
566
|
}
|
|
567
|
-
|
|
567
|
+
|
|
568
568
|
geometryArraysCache[geometryId] = geometryArrays;
|
|
569
569
|
}
|
|
570
570
|
}
|
|
@@ -723,7 +723,7 @@ function load(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx)
|
|
|
723
723
|
text: axisLabel,
|
|
724
724
|
size: 2
|
|
725
725
|
});
|
|
726
|
-
|
|
726
|
+
|
|
727
727
|
geometryPositions = ifcLabel.positions;
|
|
728
728
|
geometryIndices = ifcLabel.indices;
|
|
729
729
|
|
|
@@ -9,13 +9,13 @@ DEPRECATED
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import {utils} from "../../../viewer/scene/utils.js";
|
|
12
|
-
import
|
|
12
|
+
import * as p from "./lib/pako.js";
|
|
13
13
|
import {math} from "../../../viewer/scene/math/math.js";
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
let pako = window.pako || p;
|
|
16
|
+
if (!pako.inflate) { // See https://github.com/nodeca/pako/issues/97
|
|
17
|
+
pako = pako.default;
|
|
18
|
+
}
|
|
19
19
|
|
|
20
20
|
function extract(elements) {
|
|
21
21
|
return {
|
|
@@ -7,13 +7,13 @@ Parser for .XKT Format V3
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import {utils} from "../../../viewer/scene/utils.js";
|
|
10
|
-
import
|
|
10
|
+
import * as p from "./lib/pako.js";
|
|
11
11
|
import {math} from "../../../viewer/scene/math/math.js";
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
let pako = window.pako || p;
|
|
14
|
+
if (!pako.inflate) { // See https://github.com/nodeca/pako/issues/97
|
|
15
|
+
pako = pako.default;
|
|
16
|
+
}
|
|
17
17
|
|
|
18
18
|
function extract(elements) {
|
|
19
19
|
return {
|
|
@@ -7,12 +7,12 @@ Parser for .XKT Format V4
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import {utils} from "../../../viewer/scene/utils.js";
|
|
10
|
-
import
|
|
10
|
+
import * as p from "./lib/pako.js";
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
let pako = window.pako || p;
|
|
13
|
+
if (!pako.inflate) { // See https://github.com/nodeca/pako/issues/97
|
|
14
|
+
pako = pako.default;
|
|
15
|
+
}
|
|
16
16
|
|
|
17
17
|
function extract(elements) {
|
|
18
18
|
return {
|
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import {utils} from "../../../viewer/scene/utils.js";
|
|
10
|
-
import
|
|
10
|
+
import * as p from "./lib/pako.js";
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
let pako = window.pako || p;
|
|
13
|
+
if (!pako.inflate) { // See https://github.com/nodeca/pako/issues/97
|
|
14
|
+
pako = pako.default;
|
|
15
|
+
}
|
|
16
16
|
|
|
17
17
|
function extract(elements) {
|
|
18
18
|
return {
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {utils} from "../../../viewer/scene/utils.js";
|
|
8
|
-
import
|
|
8
|
+
import * as p from "./lib/pako.js";
|
|
9
9
|
import {math} from "../../../viewer/scene/math/math.js";
|
|
10
10
|
import {geometryCompressionUtils} from "../../../viewer/scene/math/geometryCompressionUtils.js";
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
let pako = window.pako || p;
|
|
13
|
+
if (!pako.inflate) { // See https://github.com/nodeca/pako/issues/97
|
|
14
|
+
pako = pako.default;
|
|
15
|
+
}
|
|
16
16
|
|
|
17
17
|
function extract(elements) {
|
|
18
18
|
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {utils} from "../../../viewer/scene/utils.js";
|
|
8
|
-
import
|
|
8
|
+
import * as p from "./lib/pako.js";
|
|
9
9
|
import {math} from "../../../viewer/scene/math/math.js";
|
|
10
10
|
import {geometryCompressionUtils} from "../../../viewer/scene/math/geometryCompressionUtils.js";
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
let pako = window.pako || p;
|
|
13
|
+
if (!pako.inflate) { // See https://github.com/nodeca/pako/issues/97
|
|
14
|
+
pako = pako.default;
|
|
15
|
+
}
|
|
16
16
|
|
|
17
17
|
function extract(elements) {
|
|
18
18
|
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {utils} from "../../../viewer/scene/utils.js";
|
|
8
|
-
import
|
|
8
|
+
import * as p from "./lib/pako.js";
|
|
9
9
|
import {math} from "../../../viewer/scene/math/math.js";
|
|
10
10
|
import {geometryCompressionUtils} from "../../../viewer/scene/math/geometryCompressionUtils.js";
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
let pako = window.pako || p;
|
|
13
|
+
if (!pako.inflate) { // See https://github.com/nodeca/pako/issues/97
|
|
14
|
+
pako = pako.default;
|
|
15
|
+
}
|
|
16
16
|
|
|
17
17
|
const tempVec4a = math.vec4();
|
|
18
18
|
const tempVec4b = math.vec4();
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {utils} from "../../../viewer/scene/utils.js";
|
|
8
|
-
import
|
|
8
|
+
import * as p from "./lib/pako.js";
|
|
9
9
|
import {math} from "../../../viewer/scene/math/math.js";
|
|
10
10
|
import {geometryCompressionUtils} from "../../../viewer/scene/math/geometryCompressionUtils.js";
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
let pako = window.pako || p;
|
|
13
|
+
if (!pako.inflate) { // See https://github.com/nodeca/pako/issues/97
|
|
14
|
+
pako = pako.default;
|
|
15
|
+
}
|
|
16
16
|
|
|
17
17
|
const tempVec4a = math.vec4();
|
|
18
18
|
const tempVec4b = math.vec4();
|
package/src/plugins/index.js
CHANGED
|
@@ -17,8 +17,8 @@ export * from "./ViewCullPlugin/index.js";
|
|
|
17
17
|
export * from "./XKTLoaderPlugin/index.js";
|
|
18
18
|
export * from "./XML3DLoaderPlugin/index.js";
|
|
19
19
|
export * from "./WebIFCLoaderPlugin/index.js";
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
export * from "./CxConverterIFCLoaderPlugin/index.js";
|
|
21
|
+
export * from "./LASLoaderPlugin/index.js";
|
|
22
22
|
export * from "./CityJSONLoaderPlugin/index.js";
|
|
23
23
|
export * from "./DotBIMLoaderPlugin/index.js";
|
|
24
24
|
export * from "./ZonesPlugin/index.js";
|
|
@@ -483,7 +483,7 @@ class Canvas extends Component {
|
|
|
483
483
|
this.canvas.removeEventListener("webglcontextlost", this._webglcontextlostListener);
|
|
484
484
|
this.canvas.removeEventListener("webglcontextrestored", this._webglcontextrestoredListener);
|
|
485
485
|
|
|
486
|
-
this.gl.getExtension("WEBGL_lose_context").loseContext();
|
|
486
|
+
// this.gl.getExtension("WEBGL_lose_context").loseContext(); // disabled because of XCD-306 and XEOK-295
|
|
487
487
|
this.gl = null;
|
|
488
488
|
|
|
489
489
|
super.destroy();
|
|
@@ -687,6 +687,32 @@ export class SceneModelEntity {
|
|
|
687
687
|
}
|
|
688
688
|
}
|
|
689
689
|
|
|
690
|
+
getGeometryData() {
|
|
691
|
+
let positionsBase = 0;
|
|
692
|
+
const positions = [];
|
|
693
|
+
const indices = [];
|
|
694
|
+
|
|
695
|
+
for (let i = 0, len = this.meshes.length; i < len; i++) {
|
|
696
|
+
const mesh = this.meshes[i];
|
|
697
|
+
|
|
698
|
+
if (mesh.layer.readGeometryData) {
|
|
699
|
+
const meshGeom = mesh.layer.readGeometryData(mesh.portionId);
|
|
700
|
+
|
|
701
|
+
for (let j = 0, len = meshGeom.indices.length; j < len; j++) {
|
|
702
|
+
indices.push(meshGeom.indices[j]+positionsBase);
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
for (let j = 0, len = meshGeom.positions.length; j < len; j++) {
|
|
706
|
+
positions.push(meshGeom.positions[j]);
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
positionsBase += meshGeom.positions.length / 3;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
return { indices, positions };
|
|
714
|
+
}
|
|
715
|
+
|
|
690
716
|
/**
|
|
691
717
|
* Returns the volume of this SceneModelEntity.
|
|
692
718
|
*
|
|
@@ -869,6 +869,50 @@ export class VBOBatchingTrianglesLayer {
|
|
|
869
869
|
return {count, offset}
|
|
870
870
|
}
|
|
871
871
|
|
|
872
|
+
readGeometryData(portionId) {
|
|
873
|
+
if (!this._finalized) {
|
|
874
|
+
throw "Not finalized";
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
const portion = this._portions[portionId];
|
|
878
|
+
const state = this._state;
|
|
879
|
+
const sceneModelMatrix = this.model.matrix;
|
|
880
|
+
const positionsDecodeMatrix = state.positionsDecodeMatrix;
|
|
881
|
+
|
|
882
|
+
const origin = math.vec4();
|
|
883
|
+
origin.set(state.origin, 0); origin[3] = 1;
|
|
884
|
+
math.mulMat4v4(sceneModelMatrix, origin, origin);
|
|
885
|
+
|
|
886
|
+
const indices = state.indicesBuf.getData(
|
|
887
|
+
portion.indicesBaseIndex, portion.numIndices
|
|
888
|
+
).map(i => i - portion.vertsBaseIndex);
|
|
889
|
+
|
|
890
|
+
const matrix = math.mulMat4(
|
|
891
|
+
sceneModelMatrix,
|
|
892
|
+
positionsDecodeMatrix,
|
|
893
|
+
new Array(16)
|
|
894
|
+
);
|
|
895
|
+
|
|
896
|
+
matrix[12] += origin[0];
|
|
897
|
+
matrix[13] += origin[1];
|
|
898
|
+
matrix[14] += origin[2];
|
|
899
|
+
|
|
900
|
+
const positionsQuantized = state.positionsBuf.getData(
|
|
901
|
+
portion.vertsBaseIndex, portion.numVerts
|
|
902
|
+
);
|
|
903
|
+
|
|
904
|
+
const positions = math.transformPositions3(
|
|
905
|
+
matrix,
|
|
906
|
+
positionsQuantized,
|
|
907
|
+
new Array(positionsQuantized.length)
|
|
908
|
+
);
|
|
909
|
+
|
|
910
|
+
// const aabb = math.positions3ToAABB3(positions);
|
|
911
|
+
// console.log({aabbToniBatching: aabb});
|
|
912
|
+
|
|
913
|
+
return { indices, positions };
|
|
914
|
+
}
|
|
915
|
+
|
|
872
916
|
// ---------------------- COLOR RENDERING -----------------------------------
|
|
873
917
|
|
|
874
918
|
drawColorOpaque(renderFlags, frameCtx) {
|
package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorTextureRenderer.js
CHANGED
|
@@ -229,7 +229,7 @@ export class TrianglesColorTextureRenderer extends TrianglesBatchingRenderer {
|
|
|
229
229
|
}
|
|
230
230
|
} else if (light.type === "point") {
|
|
231
231
|
if (light.space === "view") {
|
|
232
|
-
src.push("viewLightDir = -normalize(lightPos" + i + " -
|
|
232
|
+
src.push("viewLightDir = -normalize(lightPos" + i + " - vViewPosition.xyz);");
|
|
233
233
|
} else {
|
|
234
234
|
src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos" + i + ", 0.0)).xyz);");
|
|
235
235
|
}
|
package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesFlatColorRenderer.js
CHANGED
|
@@ -197,7 +197,7 @@ export class TrianglesFlatColorRenderer extends TrianglesBatchingRenderer {
|
|
|
197
197
|
}
|
|
198
198
|
} else if (light.type === "point") {
|
|
199
199
|
if (light.space === "view") {
|
|
200
|
-
src.push("viewLightDir = -normalize(lightPos" + i + " -
|
|
200
|
+
src.push("viewLightDir = -normalize(lightPos" + i + " - vViewPosition.xyz);");
|
|
201
201
|
} else {
|
|
202
202
|
src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos" + i + ", 0.0)).xyz);");
|
|
203
203
|
}
|