@xeokit/xeokit-sdk 2.6.78-rc2-no-las → 2.6.78
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 +32532 -15213
- package/dist/xeokit-sdk.es.js +32531 -15214
- package/dist/xeokit-sdk.es5.js +29446 -30855
- 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/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/model/SceneModelEntity.js +26 -0
- package/src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js +44 -0
- package/src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js +58 -0
- 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.78
|
|
3
|
+
"version": "2.6.78",
|
|
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",
|
|
@@ -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";
|
|
@@ -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) {
|
|
@@ -785,6 +785,64 @@ export class VBOInstancingTrianglesLayer {
|
|
|
785
785
|
this._state.modelMatrixCol2Buf.setData(tempFloat32Vec4, offset);
|
|
786
786
|
}
|
|
787
787
|
|
|
788
|
+
readGeometryData(portionId) {
|
|
789
|
+
if (!this._finalized) {
|
|
790
|
+
throw "Not finalized";
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
const state = this._state;
|
|
794
|
+
const sceneModelMatrix = this.model.matrix;
|
|
795
|
+
|
|
796
|
+
const col0 = state.modelMatrixCol0Buf.getData(portionId, 1);
|
|
797
|
+
const col1 = state.modelMatrixCol1Buf.getData(portionId, 1);
|
|
798
|
+
const col2 = state.modelMatrixCol2Buf.getData(portionId, 1);
|
|
799
|
+
|
|
800
|
+
const portionMatrix = [
|
|
801
|
+
col0[0], col1[0], col2[0], 0,
|
|
802
|
+
col0[1], col1[1], col2[1], 0,
|
|
803
|
+
col0[2], col1[2], col2[2], 0,
|
|
804
|
+
col0[3], col1[3], col2[3], 1,
|
|
805
|
+
];
|
|
806
|
+
|
|
807
|
+
const positionsDecodeMatrix = state.positionsDecodeMatrix;
|
|
808
|
+
|
|
809
|
+
const origin = math.vec4();
|
|
810
|
+
origin.set(state.origin, 0);
|
|
811
|
+
origin[3] = 1;
|
|
812
|
+
math.mulMat4v4(sceneModelMatrix, origin, origin);
|
|
813
|
+
|
|
814
|
+
const indices = state.indicesBuf.getData();
|
|
815
|
+
|
|
816
|
+
const matrix = math.mulMat4(
|
|
817
|
+
portionMatrix,
|
|
818
|
+
positionsDecodeMatrix,
|
|
819
|
+
new Array(16)
|
|
820
|
+
);
|
|
821
|
+
|
|
822
|
+
math.mulMat4(
|
|
823
|
+
sceneModelMatrix,
|
|
824
|
+
matrix,
|
|
825
|
+
matrix
|
|
826
|
+
);
|
|
827
|
+
|
|
828
|
+
matrix[12] += origin[0];
|
|
829
|
+
matrix[13] += origin[1];
|
|
830
|
+
matrix[14] += origin[2];
|
|
831
|
+
|
|
832
|
+
const positionsQuantized = state.positionsBuf.getData();
|
|
833
|
+
|
|
834
|
+
const positions = math.transformPositions3(
|
|
835
|
+
matrix,
|
|
836
|
+
positionsQuantized,
|
|
837
|
+
new Array(positionsQuantized.length)
|
|
838
|
+
);
|
|
839
|
+
|
|
840
|
+
// const aabb = math.positions3ToAABB3(positions);
|
|
841
|
+
// console.log({aabbToniInstancing: aabb});
|
|
842
|
+
|
|
843
|
+
return { indices, positions };
|
|
844
|
+
}
|
|
845
|
+
|
|
788
846
|
// ---------------------- COLOR RENDERING -----------------------------------
|
|
789
847
|
|
|
790
848
|
drawColorOpaque(renderFlags, frameCtx) {
|