@xeokit/xeokit-sdk 2.4.2-beta-30 → 2.4.2-beta-31
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 +101 -14
- package/dist/xeokit-sdk.es.js +101 -14
- package/dist/xeokit-sdk.es5.js +77 -5
- package/dist/xeokit-sdk.min.cjs.js +1 -1
- package/dist/xeokit-sdk.min.es.js +1 -1
- package/dist/xeokit-sdk.min.es5.js +1 -1
- package/package.json +1 -1
- package/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js +100 -13
- package/src/viewer/scene/scene/Scene.js +1 -1
- package/types/plugins/XKTLoaderPlugin/XKTLoaderPlugin.d.ts +235 -231
package/dist/xeokit-sdk.cjs.js
CHANGED
|
@@ -30235,7 +30235,7 @@ class Scene extends Component {
|
|
|
30235
30235
|
* - it runs maximum once per scene-tick
|
|
30236
30236
|
*
|
|
30237
30237
|
* @param {Function} cb The function to tickify
|
|
30238
|
-
* @returns {Function
|
|
30238
|
+
* @returns {Function}
|
|
30239
30239
|
*/
|
|
30240
30240
|
tickify(cb) {
|
|
30241
30241
|
const cbString = cb.toString();
|
|
@@ -122553,6 +122553,15 @@ parsers[ParserV10.version] = ParserV10;
|
|
|
122553
122553
|
* myViewer.scene.setObjectVisibilities("myModel1#0BTBFw6f90Nfh9rP1dlXrb", true);
|
|
122554
122554
|
*````
|
|
122555
122555
|
*
|
|
122556
|
+
* We can also provide an HTTP URL to the XKT file:
|
|
122557
|
+
*
|
|
122558
|
+
* ````javascript
|
|
122559
|
+
* const sceneModel = xktLoader.load({
|
|
122560
|
+
* manifestSrc: "https://xeokit.github.io/xeokit-sdk/assets/models/models/xkt/Schependomlaan.xkt",
|
|
122561
|
+
* id: "myModel",
|
|
122562
|
+
* });
|
|
122563
|
+
* ````
|
|
122564
|
+
*
|
|
122556
122565
|
* # Loading a model from a manifest of XKT files
|
|
122557
122566
|
*
|
|
122558
122567
|
* The `ifc2gltf` tool from Creoox, which converts IFC files into glTF geometry and JSON metadata files, has the option to
|
|
@@ -122639,6 +122648,65 @@ parsers[ParserV10.version] = ParserV10;
|
|
|
122639
122648
|
* They work much reliably (and faster) when processing smaller files (eg. 20MB) than when processing large files (eg. 500MB), where
|
|
122640
122649
|
* they have less trouble allocating the system memory they need for conversion and parsing.
|
|
122641
122650
|
*
|
|
122651
|
+
* We can also provide an HTTP URL to the manifest:
|
|
122652
|
+
*
|
|
122653
|
+
* ````javascript
|
|
122654
|
+
* const sceneModel = xktLoader.load({
|
|
122655
|
+
* manifestSrc: "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model.xkt.manifest.json",
|
|
122656
|
+
* id: "myModel",
|
|
122657
|
+
* });
|
|
122658
|
+
* ````
|
|
122659
|
+
*
|
|
122660
|
+
* We can also provide the manifest as parameter object:
|
|
122661
|
+
*
|
|
122662
|
+
* ````javascript
|
|
122663
|
+
* const sceneModel = xktLoader.load({
|
|
122664
|
+
* id: "myModel",
|
|
122665
|
+
* manifest: {
|
|
122666
|
+
* inputFile: "assets/models/gltf/Karhumaki/model.glb.manifest.json",
|
|
122667
|
+
* converterApplication: "convert2xkt",
|
|
122668
|
+
* converterApplicationVersion: "v1.1.10",
|
|
122669
|
+
* conversionDate": "09-11-2023- 18-29-01",
|
|
122670
|
+
* xktFiles: [
|
|
122671
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model.xkt",
|
|
122672
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_1.xkt",
|
|
122673
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_2.xkt",
|
|
122674
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_3.xkt",
|
|
122675
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_4.xkt",
|
|
122676
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_5.xkt",
|
|
122677
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_6.xkt",
|
|
122678
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_7.xkt",
|
|
122679
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_8.xkt"
|
|
122680
|
+
* ]
|
|
122681
|
+
* }
|
|
122682
|
+
* });
|
|
122683
|
+
* ````
|
|
122684
|
+
*
|
|
122685
|
+
* We can also provide the paths to the XKT files as HTTP URLs:
|
|
122686
|
+
*
|
|
122687
|
+
* ````javascript
|
|
122688
|
+
* const sceneModel = xktLoader.load({
|
|
122689
|
+
* id: "myModel",
|
|
122690
|
+
* manifest: {
|
|
122691
|
+
* inputFile: "assets/models/gltf/Karhumaki/model.glb.manifest.json",
|
|
122692
|
+
* converterApplication: "convert2xkt",
|
|
122693
|
+
* converterApplicationVersion: "v1.1.10",
|
|
122694
|
+
* conversionDate": "09-11-2023- 18-29-01",
|
|
122695
|
+
* xktFiles: [
|
|
122696
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model.xkt",
|
|
122697
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_1.xkt",
|
|
122698
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_2.xkt",
|
|
122699
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_3.xkt",
|
|
122700
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_4.xkt",
|
|
122701
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_5.xkt",
|
|
122702
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_6.xkt",
|
|
122703
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_7.xkt",
|
|
122704
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_8.xkt"
|
|
122705
|
+
* ]
|
|
122706
|
+
* }
|
|
122707
|
+
* });
|
|
122708
|
+
* ````
|
|
122709
|
+
*
|
|
122642
122710
|
* @class XKTLoaderPlugin
|
|
122643
122711
|
*/
|
|
122644
122712
|
class XKTLoaderPlugin extends Plugin {
|
|
@@ -122908,10 +122976,14 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
122908
122976
|
*
|
|
122909
122977
|
* @param {*} params Loading parameters.
|
|
122910
122978
|
* @param {String} [params.id] ID to assign to the root {@link Entity#id}, unique among all components in the Viewer's {@link Scene}, generated automatically by default.
|
|
122911
|
-
* @param {String} [params.src] Path to
|
|
122979
|
+
* @param {String} [params.src] Path or URL to an *````.xkt````* file, as an alternative to the ````xkt```` parameter.
|
|
122912
122980
|
* @param {ArrayBuffer} [params.xkt] The *````.xkt````* file data, as an alternative to the ````src```` parameter.
|
|
122913
|
-
* @param {String} [params.metaModelSrc] Path to an optional metadata file, as an alternative to the ````metaModelData```` parameter.
|
|
122981
|
+
* @param {String} [params.metaModelSrc] Path or URL to an optional metadata file, as an alternative to the ````metaModelData```` parameter.
|
|
122914
122982
|
* @param {*} [params.metaModelData] JSON model metadata, as an alternative to the ````metaModelSrc```` parameter.
|
|
122983
|
+
* @param {String} [params.manifestSrc] Path or URL to a JSON manifest file that provides paths to ````.xkt```` files to load as parts of the model. Use this option to load models that have been split into
|
|
122984
|
+
* multiple XKT files. See [tutorial](https://www.notion.so/xeokit/Automatically-Splitting-Large-Models-for-Better-Performance-165fc022e94742cf966ee50003572259) for more info.
|
|
122985
|
+
* @param {Object} [params.manifest] A JSON manifest object (as an alternative to a path or URL) that provides paths to ````.xkt```` files to load as parts of the model. Use this option to load models that have been split into
|
|
122986
|
+
* multiple XKT files. See [tutorial](https://www.notion.so/xeokit/Automatically-Splitting-Large-Models-for-Better-Performance-165fc022e94742cf966ee50003572259) for more info.
|
|
122915
122987
|
* @param {{String:Object}} [params.objectDefaults] Map of initial default states for each loaded {@link Entity} that represents an object. Default value is {@link IFCObjectDefaults}.
|
|
122916
122988
|
* @param {String[]} [params.includeTypes] When loading metadata, only loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
|
|
122917
122989
|
* @param {String[]} [params.excludeTypes] When loading metadata, never loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
|
|
@@ -122947,8 +123019,8 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
122947
123019
|
delete params.id;
|
|
122948
123020
|
}
|
|
122949
123021
|
|
|
122950
|
-
if (!params.src && !params.xkt && !params.manifestSrc) {
|
|
122951
|
-
this.error("load() param expected: src, xkt or
|
|
123022
|
+
if (!params.src && !params.xkt && !params.manifestSrc && !params.manifest) {
|
|
123023
|
+
this.error("load() param expected: src, xkt, manifestSrc or manifestData");
|
|
122952
123024
|
return sceneModel; // Return new empty model
|
|
122953
123025
|
}
|
|
122954
123026
|
|
|
@@ -123076,8 +123148,8 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
123076
123148
|
} else if (params.xkt) {
|
|
123077
123149
|
this._parseModel(params.xkt, params, options, sceneModel, metaModel, manifestCtx);
|
|
123078
123150
|
finish();
|
|
123079
|
-
} else if (params.manifestSrc) {
|
|
123080
|
-
const baseDir = getBaseDirectory(params.manifestSrc);
|
|
123151
|
+
} else if (params.manifestSrc || params.manifest) {
|
|
123152
|
+
const baseDir = params.manifestSrc ? getBaseDirectory(params.manifestSrc) : "";
|
|
123081
123153
|
const loadJSONs = (metaDataFiles, done, error) => {
|
|
123082
123154
|
let i = 0;
|
|
123083
123155
|
const loadNext = () => {
|
|
@@ -123097,7 +123169,6 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
123097
123169
|
};
|
|
123098
123170
|
loadNext();
|
|
123099
123171
|
};
|
|
123100
|
-
|
|
123101
123172
|
const loadXKTs = (xktFiles, done, error) => {
|
|
123102
123173
|
let i = 0;
|
|
123103
123174
|
const loadNext = () => {
|
|
@@ -123113,11 +123184,8 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
123113
123184
|
};
|
|
123114
123185
|
loadNext();
|
|
123115
123186
|
};
|
|
123116
|
-
|
|
123117
|
-
|
|
123118
|
-
if (sceneModel.destroyed) {
|
|
123119
|
-
return;
|
|
123120
|
-
}
|
|
123187
|
+
if (params.manifest) {
|
|
123188
|
+
const manifestData = params.manifest;
|
|
123121
123189
|
const xktFiles = manifestData.xktFiles;
|
|
123122
123190
|
if (!xktFiles || xktFiles.length === 0) {
|
|
123123
123191
|
error(`load(): Failed to load model manifest - manifest not valid`);
|
|
@@ -123131,7 +123199,26 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
123131
123199
|
} else {
|
|
123132
123200
|
loadXKTs(xktFiles, finish, error);
|
|
123133
123201
|
}
|
|
123134
|
-
}
|
|
123202
|
+
} else {
|
|
123203
|
+
this._dataSource.getManifest(params.manifestSrc, (manifestData) => {
|
|
123204
|
+
if (sceneModel.destroyed) {
|
|
123205
|
+
return;
|
|
123206
|
+
}
|
|
123207
|
+
const xktFiles = manifestData.xktFiles;
|
|
123208
|
+
if (!xktFiles || xktFiles.length === 0) {
|
|
123209
|
+
error(`load(): Failed to load model manifest - manifest not valid`);
|
|
123210
|
+
return;
|
|
123211
|
+
}
|
|
123212
|
+
const metaModelFiles = manifestData.metaModelFiles;
|
|
123213
|
+
if (metaModelFiles) {
|
|
123214
|
+
loadJSONs(metaModelFiles, () => {
|
|
123215
|
+
loadXKTs(xktFiles, finish, error);
|
|
123216
|
+
}, error);
|
|
123217
|
+
} else {
|
|
123218
|
+
loadXKTs(xktFiles, finish, error);
|
|
123219
|
+
}
|
|
123220
|
+
}, error);
|
|
123221
|
+
}
|
|
123135
123222
|
}
|
|
123136
123223
|
}
|
|
123137
123224
|
|
package/dist/xeokit-sdk.es.js
CHANGED
|
@@ -30231,7 +30231,7 @@ class Scene extends Component {
|
|
|
30231
30231
|
* - it runs maximum once per scene-tick
|
|
30232
30232
|
*
|
|
30233
30233
|
* @param {Function} cb The function to tickify
|
|
30234
|
-
* @returns {Function
|
|
30234
|
+
* @returns {Function}
|
|
30235
30235
|
*/
|
|
30236
30236
|
tickify(cb) {
|
|
30237
30237
|
const cbString = cb.toString();
|
|
@@ -122549,6 +122549,15 @@ parsers[ParserV10.version] = ParserV10;
|
|
|
122549
122549
|
* myViewer.scene.setObjectVisibilities("myModel1#0BTBFw6f90Nfh9rP1dlXrb", true);
|
|
122550
122550
|
*````
|
|
122551
122551
|
*
|
|
122552
|
+
* We can also provide an HTTP URL to the XKT file:
|
|
122553
|
+
*
|
|
122554
|
+
* ````javascript
|
|
122555
|
+
* const sceneModel = xktLoader.load({
|
|
122556
|
+
* manifestSrc: "https://xeokit.github.io/xeokit-sdk/assets/models/models/xkt/Schependomlaan.xkt",
|
|
122557
|
+
* id: "myModel",
|
|
122558
|
+
* });
|
|
122559
|
+
* ````
|
|
122560
|
+
*
|
|
122552
122561
|
* # Loading a model from a manifest of XKT files
|
|
122553
122562
|
*
|
|
122554
122563
|
* The `ifc2gltf` tool from Creoox, which converts IFC files into glTF geometry and JSON metadata files, has the option to
|
|
@@ -122635,6 +122644,65 @@ parsers[ParserV10.version] = ParserV10;
|
|
|
122635
122644
|
* They work much reliably (and faster) when processing smaller files (eg. 20MB) than when processing large files (eg. 500MB), where
|
|
122636
122645
|
* they have less trouble allocating the system memory they need for conversion and parsing.
|
|
122637
122646
|
*
|
|
122647
|
+
* We can also provide an HTTP URL to the manifest:
|
|
122648
|
+
*
|
|
122649
|
+
* ````javascript
|
|
122650
|
+
* const sceneModel = xktLoader.load({
|
|
122651
|
+
* manifestSrc: "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model.xkt.manifest.json",
|
|
122652
|
+
* id: "myModel",
|
|
122653
|
+
* });
|
|
122654
|
+
* ````
|
|
122655
|
+
*
|
|
122656
|
+
* We can also provide the manifest as parameter object:
|
|
122657
|
+
*
|
|
122658
|
+
* ````javascript
|
|
122659
|
+
* const sceneModel = xktLoader.load({
|
|
122660
|
+
* id: "myModel",
|
|
122661
|
+
* manifest: {
|
|
122662
|
+
* inputFile: "assets/models/gltf/Karhumaki/model.glb.manifest.json",
|
|
122663
|
+
* converterApplication: "convert2xkt",
|
|
122664
|
+
* converterApplicationVersion: "v1.1.10",
|
|
122665
|
+
* conversionDate": "09-11-2023- 18-29-01",
|
|
122666
|
+
* xktFiles: [
|
|
122667
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model.xkt",
|
|
122668
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_1.xkt",
|
|
122669
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_2.xkt",
|
|
122670
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_3.xkt",
|
|
122671
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_4.xkt",
|
|
122672
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_5.xkt",
|
|
122673
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_6.xkt",
|
|
122674
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_7.xkt",
|
|
122675
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_8.xkt"
|
|
122676
|
+
* ]
|
|
122677
|
+
* }
|
|
122678
|
+
* });
|
|
122679
|
+
* ````
|
|
122680
|
+
*
|
|
122681
|
+
* We can also provide the paths to the XKT files as HTTP URLs:
|
|
122682
|
+
*
|
|
122683
|
+
* ````javascript
|
|
122684
|
+
* const sceneModel = xktLoader.load({
|
|
122685
|
+
* id: "myModel",
|
|
122686
|
+
* manifest: {
|
|
122687
|
+
* inputFile: "assets/models/gltf/Karhumaki/model.glb.manifest.json",
|
|
122688
|
+
* converterApplication: "convert2xkt",
|
|
122689
|
+
* converterApplicationVersion: "v1.1.10",
|
|
122690
|
+
* conversionDate": "09-11-2023- 18-29-01",
|
|
122691
|
+
* xktFiles: [
|
|
122692
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model.xkt",
|
|
122693
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_1.xkt",
|
|
122694
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_2.xkt",
|
|
122695
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_3.xkt",
|
|
122696
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_4.xkt",
|
|
122697
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_5.xkt",
|
|
122698
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_6.xkt",
|
|
122699
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_7.xkt",
|
|
122700
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_8.xkt"
|
|
122701
|
+
* ]
|
|
122702
|
+
* }
|
|
122703
|
+
* });
|
|
122704
|
+
* ````
|
|
122705
|
+
*
|
|
122638
122706
|
* @class XKTLoaderPlugin
|
|
122639
122707
|
*/
|
|
122640
122708
|
class XKTLoaderPlugin extends Plugin {
|
|
@@ -122904,10 +122972,14 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
122904
122972
|
*
|
|
122905
122973
|
* @param {*} params Loading parameters.
|
|
122906
122974
|
* @param {String} [params.id] ID to assign to the root {@link Entity#id}, unique among all components in the Viewer's {@link Scene}, generated automatically by default.
|
|
122907
|
-
* @param {String} [params.src] Path to
|
|
122975
|
+
* @param {String} [params.src] Path or URL to an *````.xkt````* file, as an alternative to the ````xkt```` parameter.
|
|
122908
122976
|
* @param {ArrayBuffer} [params.xkt] The *````.xkt````* file data, as an alternative to the ````src```` parameter.
|
|
122909
|
-
* @param {String} [params.metaModelSrc] Path to an optional metadata file, as an alternative to the ````metaModelData```` parameter.
|
|
122977
|
+
* @param {String} [params.metaModelSrc] Path or URL to an optional metadata file, as an alternative to the ````metaModelData```` parameter.
|
|
122910
122978
|
* @param {*} [params.metaModelData] JSON model metadata, as an alternative to the ````metaModelSrc```` parameter.
|
|
122979
|
+
* @param {String} [params.manifestSrc] Path or URL to a JSON manifest file that provides paths to ````.xkt```` files to load as parts of the model. Use this option to load models that have been split into
|
|
122980
|
+
* multiple XKT files. See [tutorial](https://www.notion.so/xeokit/Automatically-Splitting-Large-Models-for-Better-Performance-165fc022e94742cf966ee50003572259) for more info.
|
|
122981
|
+
* @param {Object} [params.manifest] A JSON manifest object (as an alternative to a path or URL) that provides paths to ````.xkt```` files to load as parts of the model. Use this option to load models that have been split into
|
|
122982
|
+
* multiple XKT files. See [tutorial](https://www.notion.so/xeokit/Automatically-Splitting-Large-Models-for-Better-Performance-165fc022e94742cf966ee50003572259) for more info.
|
|
122911
122983
|
* @param {{String:Object}} [params.objectDefaults] Map of initial default states for each loaded {@link Entity} that represents an object. Default value is {@link IFCObjectDefaults}.
|
|
122912
122984
|
* @param {String[]} [params.includeTypes] When loading metadata, only loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
|
|
122913
122985
|
* @param {String[]} [params.excludeTypes] When loading metadata, never loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
|
|
@@ -122943,8 +123015,8 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
122943
123015
|
delete params.id;
|
|
122944
123016
|
}
|
|
122945
123017
|
|
|
122946
|
-
if (!params.src && !params.xkt && !params.manifestSrc) {
|
|
122947
|
-
this.error("load() param expected: src, xkt or
|
|
123018
|
+
if (!params.src && !params.xkt && !params.manifestSrc && !params.manifest) {
|
|
123019
|
+
this.error("load() param expected: src, xkt, manifestSrc or manifestData");
|
|
122948
123020
|
return sceneModel; // Return new empty model
|
|
122949
123021
|
}
|
|
122950
123022
|
|
|
@@ -123072,8 +123144,8 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
123072
123144
|
} else if (params.xkt) {
|
|
123073
123145
|
this._parseModel(params.xkt, params, options, sceneModel, metaModel, manifestCtx);
|
|
123074
123146
|
finish();
|
|
123075
|
-
} else if (params.manifestSrc) {
|
|
123076
|
-
const baseDir = getBaseDirectory(params.manifestSrc);
|
|
123147
|
+
} else if (params.manifestSrc || params.manifest) {
|
|
123148
|
+
const baseDir = params.manifestSrc ? getBaseDirectory(params.manifestSrc) : "";
|
|
123077
123149
|
const loadJSONs = (metaDataFiles, done, error) => {
|
|
123078
123150
|
let i = 0;
|
|
123079
123151
|
const loadNext = () => {
|
|
@@ -123093,7 +123165,6 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
123093
123165
|
};
|
|
123094
123166
|
loadNext();
|
|
123095
123167
|
};
|
|
123096
|
-
|
|
123097
123168
|
const loadXKTs = (xktFiles, done, error) => {
|
|
123098
123169
|
let i = 0;
|
|
123099
123170
|
const loadNext = () => {
|
|
@@ -123109,11 +123180,8 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
123109
123180
|
};
|
|
123110
123181
|
loadNext();
|
|
123111
123182
|
};
|
|
123112
|
-
|
|
123113
|
-
|
|
123114
|
-
if (sceneModel.destroyed) {
|
|
123115
|
-
return;
|
|
123116
|
-
}
|
|
123183
|
+
if (params.manifest) {
|
|
123184
|
+
const manifestData = params.manifest;
|
|
123117
123185
|
const xktFiles = manifestData.xktFiles;
|
|
123118
123186
|
if (!xktFiles || xktFiles.length === 0) {
|
|
123119
123187
|
error(`load(): Failed to load model manifest - manifest not valid`);
|
|
@@ -123127,7 +123195,26 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
123127
123195
|
} else {
|
|
123128
123196
|
loadXKTs(xktFiles, finish, error);
|
|
123129
123197
|
}
|
|
123130
|
-
}
|
|
123198
|
+
} else {
|
|
123199
|
+
this._dataSource.getManifest(params.manifestSrc, (manifestData) => {
|
|
123200
|
+
if (sceneModel.destroyed) {
|
|
123201
|
+
return;
|
|
123202
|
+
}
|
|
123203
|
+
const xktFiles = manifestData.xktFiles;
|
|
123204
|
+
if (!xktFiles || xktFiles.length === 0) {
|
|
123205
|
+
error(`load(): Failed to load model manifest - manifest not valid`);
|
|
123206
|
+
return;
|
|
123207
|
+
}
|
|
123208
|
+
const metaModelFiles = manifestData.metaModelFiles;
|
|
123209
|
+
if (metaModelFiles) {
|
|
123210
|
+
loadJSONs(metaModelFiles, () => {
|
|
123211
|
+
loadXKTs(xktFiles, finish, error);
|
|
123212
|
+
}, error);
|
|
123213
|
+
} else {
|
|
123214
|
+
loadXKTs(xktFiles, finish, error);
|
|
123215
|
+
}
|
|
123216
|
+
}, error);
|
|
123217
|
+
}
|
|
123131
123218
|
}
|
|
123132
123219
|
}
|
|
123133
123220
|
|
package/dist/xeokit-sdk.es5.js
CHANGED
|
@@ -9616,7 +9616,7 @@ return entity.aabb;}ids=[ids];// Must be an entity type
|
|
|
9616
9616
|
* - it runs maximum once per scene-tick
|
|
9617
9617
|
*
|
|
9618
9618
|
* @param {Function} cb The function to tickify
|
|
9619
|
-
* @returns {Function
|
|
9619
|
+
* @returns {Function}
|
|
9620
9620
|
*/},{key:"tickify",value:function tickify(cb){var cbString=cb.toString();/**
|
|
9621
9621
|
* Check if the function is already tickified, and if so return the cached one.
|
|
9622
9622
|
*/if(cbString in this._tickifiedFunctions){return this._tickifiedFunctions[cbString].wrapperFunc;}var alreadyRun=0;var needToRun=0;var lastArgs;/**
|
|
@@ -26658,6 +26658,15 @@ var _primitiveType4=eachGeometryPrimitiveType[_geometryIndex4];var primitiveName
|
|
|
26658
26658
|
* myViewer.scene.setObjectVisibilities("myModel1#0BTBFw6f90Nfh9rP1dlXrb", true);
|
|
26659
26659
|
*````
|
|
26660
26660
|
*
|
|
26661
|
+
* We can also provide an HTTP URL to the XKT file:
|
|
26662
|
+
*
|
|
26663
|
+
* ````javascript
|
|
26664
|
+
* const sceneModel = xktLoader.load({
|
|
26665
|
+
* manifestSrc: "https://xeokit.github.io/xeokit-sdk/assets/models/models/xkt/Schependomlaan.xkt",
|
|
26666
|
+
* id: "myModel",
|
|
26667
|
+
* });
|
|
26668
|
+
* ````
|
|
26669
|
+
*
|
|
26661
26670
|
* # Loading a model from a manifest of XKT files
|
|
26662
26671
|
*
|
|
26663
26672
|
* The `ifc2gltf` tool from Creoox, which converts IFC files into glTF geometry and JSON metadata files, has the option to
|
|
@@ -26744,6 +26753,65 @@ var _primitiveType4=eachGeometryPrimitiveType[_geometryIndex4];var primitiveName
|
|
|
26744
26753
|
* They work much reliably (and faster) when processing smaller files (eg. 20MB) than when processing large files (eg. 500MB), where
|
|
26745
26754
|
* they have less trouble allocating the system memory they need for conversion and parsing.
|
|
26746
26755
|
*
|
|
26756
|
+
* We can also provide an HTTP URL to the manifest:
|
|
26757
|
+
*
|
|
26758
|
+
* ````javascript
|
|
26759
|
+
* const sceneModel = xktLoader.load({
|
|
26760
|
+
* manifestSrc: "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model.xkt.manifest.json",
|
|
26761
|
+
* id: "myModel",
|
|
26762
|
+
* });
|
|
26763
|
+
* ````
|
|
26764
|
+
*
|
|
26765
|
+
* We can also provide the manifest as parameter object:
|
|
26766
|
+
*
|
|
26767
|
+
* ````javascript
|
|
26768
|
+
* const sceneModel = xktLoader.load({
|
|
26769
|
+
* id: "myModel",
|
|
26770
|
+
* manifest: {
|
|
26771
|
+
* inputFile: "assets/models/gltf/Karhumaki/model.glb.manifest.json",
|
|
26772
|
+
* converterApplication: "convert2xkt",
|
|
26773
|
+
* converterApplicationVersion: "v1.1.10",
|
|
26774
|
+
* conversionDate": "09-11-2023- 18-29-01",
|
|
26775
|
+
* xktFiles: [
|
|
26776
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model.xkt",
|
|
26777
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_1.xkt",
|
|
26778
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_2.xkt",
|
|
26779
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_3.xkt",
|
|
26780
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_4.xkt",
|
|
26781
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_5.xkt",
|
|
26782
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_6.xkt",
|
|
26783
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_7.xkt",
|
|
26784
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_8.xkt"
|
|
26785
|
+
* ]
|
|
26786
|
+
* }
|
|
26787
|
+
* });
|
|
26788
|
+
* ````
|
|
26789
|
+
*
|
|
26790
|
+
* We can also provide the paths to the XKT files as HTTP URLs:
|
|
26791
|
+
*
|
|
26792
|
+
* ````javascript
|
|
26793
|
+
* const sceneModel = xktLoader.load({
|
|
26794
|
+
* id: "myModel",
|
|
26795
|
+
* manifest: {
|
|
26796
|
+
* inputFile: "assets/models/gltf/Karhumaki/model.glb.manifest.json",
|
|
26797
|
+
* converterApplication: "convert2xkt",
|
|
26798
|
+
* converterApplicationVersion: "v1.1.10",
|
|
26799
|
+
* conversionDate": "09-11-2023- 18-29-01",
|
|
26800
|
+
* xktFiles: [
|
|
26801
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model.xkt",
|
|
26802
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_1.xkt",
|
|
26803
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_2.xkt",
|
|
26804
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_3.xkt",
|
|
26805
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_4.xkt",
|
|
26806
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_5.xkt",
|
|
26807
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_6.xkt",
|
|
26808
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_7.xkt",
|
|
26809
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_8.xkt"
|
|
26810
|
+
* ]
|
|
26811
|
+
* }
|
|
26812
|
+
* });
|
|
26813
|
+
* ````
|
|
26814
|
+
*
|
|
26747
26815
|
* @class XKTLoaderPlugin
|
|
26748
26816
|
*/var XKTLoaderPlugin=/*#__PURE__*/function(_Plugin17){_inherits(XKTLoaderPlugin,_Plugin17);var _super150=_createSuper(XKTLoaderPlugin);/**
|
|
26749
26817
|
* @constructor
|
|
@@ -26909,10 +26977,14 @@ var _primitiveType4=eachGeometryPrimitiveType[_geometryIndex4];var primitiveName
|
|
|
26909
26977
|
*
|
|
26910
26978
|
* @param {*} params Loading parameters.
|
|
26911
26979
|
* @param {String} [params.id] ID to assign to the root {@link Entity#id}, unique among all components in the Viewer's {@link Scene}, generated automatically by default.
|
|
26912
|
-
* @param {String} [params.src] Path to
|
|
26980
|
+
* @param {String} [params.src] Path or URL to an *````.xkt````* file, as an alternative to the ````xkt```` parameter.
|
|
26913
26981
|
* @param {ArrayBuffer} [params.xkt] The *````.xkt````* file data, as an alternative to the ````src```` parameter.
|
|
26914
|
-
* @param {String} [params.metaModelSrc] Path to an optional metadata file, as an alternative to the ````metaModelData```` parameter.
|
|
26982
|
+
* @param {String} [params.metaModelSrc] Path or URL to an optional metadata file, as an alternative to the ````metaModelData```` parameter.
|
|
26915
26983
|
* @param {*} [params.metaModelData] JSON model metadata, as an alternative to the ````metaModelSrc```` parameter.
|
|
26984
|
+
* @param {String} [params.manifestSrc] Path or URL to a JSON manifest file that provides paths to ````.xkt```` files to load as parts of the model. Use this option to load models that have been split into
|
|
26985
|
+
* multiple XKT files. See [tutorial](https://www.notion.so/xeokit/Automatically-Splitting-Large-Models-for-Better-Performance-165fc022e94742cf966ee50003572259) for more info.
|
|
26986
|
+
* @param {Object} [params.manifest] A JSON manifest object (as an alternative to a path or URL) that provides paths to ````.xkt```` files to load as parts of the model. Use this option to load models that have been split into
|
|
26987
|
+
* multiple XKT files. See [tutorial](https://www.notion.so/xeokit/Automatically-Splitting-Large-Models-for-Better-Performance-165fc022e94742cf966ee50003572259) for more info.
|
|
26916
26988
|
* @param {{String:Object}} [params.objectDefaults] Map of initial default states for each loaded {@link Entity} that represents an object. Default value is {@link IFCObjectDefaults}.
|
|
26917
26989
|
* @param {String[]} [params.includeTypes] When loading metadata, only loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
|
|
26918
26990
|
* @param {String[]} [params.excludeTypes] When loading metadata, never loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
|
|
@@ -26940,12 +27012,12 @@ var _primitiveType4=eachGeometryPrimitiveType[_geometryIndex4];var primitiveName
|
|
|
26940
27012
|
* to non-textured triangle meshes, and that VBOs are always used for meshes that have textures, line segments, or point
|
|
26941
27013
|
* primitives. Only works while {@link DTX#enabled} is also ````true````.
|
|
26942
27014
|
* @returns {Entity} Entity representing the model, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}.
|
|
26943
|
-
*/},{key:"load",value:function load(){var _this153=this;var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id&&this.viewer.scene.components[params.id]){this.error("Component with this ID already exists in viewer: "+params.id+" - will autogenerate this ID");delete params.id;}if(!params.src&&!params.xkt&&!params.manifestSrc){this.error("load() param expected: src, xkt or
|
|
27015
|
+
*/},{key:"load",value:function load(){var _this153=this;var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id&&this.viewer.scene.components[params.id]){this.error("Component with this ID already exists in viewer: "+params.id+" - will autogenerate this ID");delete params.id;}if(!params.src&&!params.xkt&&!params.manifestSrc&&!params.manifest){this.error("load() param expected: src, xkt, manifestSrc or manifestData");return sceneModel;// Return new empty model
|
|
26944
27016
|
}var options={};var includeTypes=params.includeTypes||this._includeTypes;var excludeTypes=params.excludeTypes||this._excludeTypes;var objectDefaults=params.objectDefaults||this._objectDefaults;options.reuseGeometries=params.reuseGeometries!==null&¶ms.reuseGeometries!==undefined?params.reuseGeometries:this._reuseGeometries!==false;if(includeTypes){options.includeTypesMap={};for(var _i536=0,len=includeTypes.length;_i536<len;_i536++){options.includeTypesMap[includeTypes[_i536]]=true;}}if(excludeTypes){options.excludeTypesMap={};for(var _i537=0,_len120=excludeTypes.length;_i537<_len120;_i537++){options.excludeTypesMap[excludeTypes[_i537]]=true;}}if(objectDefaults){options.objectDefaults=objectDefaults;}options.excludeUnclassifiedObjects=params.excludeUnclassifiedObjects!==undefined?!!params.excludeUnclassifiedObjects:this._excludeUnclassifiedObjects;options.globalizeObjectIds=params.globalizeObjectIds!==undefined&¶ms.globalizeObjectIds!==null?!!params.globalizeObjectIds:this._globalizeObjectIds;var sceneModel=new SceneModel(this.viewer.scene,utils.apply(params,{isModel:true,textureTranscoder:this._textureTranscoder,maxGeometryBatchSize:this._maxGeometryBatchSize,origin:params.origin,disableVertexWelding:params.disableVertexWelding||false,disableIndexRebucketing:params.disableIndexRebucketing||false,dtxEnabled:params.dtxEnabled}));var modelId=sceneModel.id;// In case ID was auto-generated
|
|
26945
27017
|
var metaModel=new MetaModel({metaScene:this.viewer.metaScene,id:modelId});this.viewer.scene.canvas.spinner.processes++;var finish=function finish(){// this._createDefaultMetaModelIfNeeded(sceneModel, params, options);
|
|
26946
27018
|
sceneModel.finalize();metaModel.finalize();_this153.viewer.scene.canvas.spinner.processes--;sceneModel.once("destroyed",function(){_this153.viewer.metaScene.destroyMetaModel(metaModel.id);});sceneModel.scene.once("tick",function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
|
|
26947
27019
|
sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
|
|
26948
|
-
});};var error=function error(errMsg){_this153.viewer.scene.canvas.spinner.processes--;_this153.error(errMsg);sceneModel.fire("error",errMsg);};var nextId=0;var manifestCtx={getNextId:function getNextId(){return"".concat(modelId,".").concat(nextId++);}};if(params.metaModelSrc||params.metaModelData){if(params.metaModelSrc){var metaModelSrc=params.metaModelSrc;this._dataSource.getMetaModel(metaModelSrc,function(metaModelData){if(sceneModel.destroyed){return;}metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){_this153._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{_this153._parseModel(params.xkt,params,options,sceneModel,null,manifestCtx);finish();}},function(errMsg){error("load(): Failed to load model metadata for model '".concat(modelId," from '").concat(metaModelSrc,"' - ").concat(errMsg));});}else if(params.metaModelData){metaModel.loadData(params.metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){this._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{this._parseModel(params.xkt,params,options,sceneModel,null,manifestCtx);finish();}}}else{if(params.src){this._loadModel(params.src,params,options,sceneModel,metaModel,manifestCtx,finish,error);}else if(params.xkt){this._parseModel(params.xkt,params,options,sceneModel,metaModel,manifestCtx);finish();}else if(params.manifestSrc){var baseDir=getBaseDirectory(params.manifestSrc);var loadJSONs=function loadJSONs(metaDataFiles,done,error){var i=0;var loadNext=function loadNext(){if(i>=metaDataFiles.length){done();}else{_this153._dataSource.getMetaModel("".concat(baseDir).concat(metaDataFiles[i]),function(metaModelData){metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});i++;loadNext();},error);}};loadNext();};var loadXKTs=function loadXKTs(xktFiles,done,error){var i=0;var loadNext=function loadNext(){if(i>=xktFiles.length){done();}else{_this153._dataSource.getXKT("".concat(baseDir).concat(xktFiles[i]),function(arrayBuffer){_this153._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx);i++;loadNext();},error);}};loadNext();};this._dataSource.getManifest(params.manifestSrc,function(manifestData){if(sceneModel.destroyed){return;}var xktFiles=manifestData.xktFiles;if(!xktFiles||xktFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXKTs(xktFiles,finish,error);},error);}else{loadXKTs(xktFiles,finish,error);}},error);}}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel,metaModel,manifestCtx,done,error){var _this154=this;this._dataSource.getXKT(params.src,function(arrayBuffer){_this154._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx);done();},error);}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx){if(sceneModel.destroyed){return;}var dataView=new DataView(arrayBuffer);var dataArray=new Uint8Array(arrayBuffer);var xktVersion=dataView.getUint32(0,true);var parser=parsers[xktVersion];if(!parser){this.error("Unsupported .XKT file version: "+xktVersion+" - this XKTLoaderPlugin supports versions "+Object.keys(parsers));return;}this.log("Loading .xkt V"+xktVersion);var numElements=dataView.getUint32(4,true);var elements=[];var byteOffset=(numElements+2)*4;for(var _i538=0;_i538<numElements;_i538++){var elementSize=dataView.getUint32((_i538+2)*4,true);elements.push(dataArray.subarray(byteOffset,byteOffset+elementSize));byteOffset+=elementSize;}parser.parse(this.viewer,options,elements,sceneModel,metaModel,manifestCtx);}// _createDefaultMetaModelIfNeeded(sceneModel, params, options) {
|
|
27020
|
+
});};var error=function error(errMsg){_this153.viewer.scene.canvas.spinner.processes--;_this153.error(errMsg);sceneModel.fire("error",errMsg);};var nextId=0;var manifestCtx={getNextId:function getNextId(){return"".concat(modelId,".").concat(nextId++);}};if(params.metaModelSrc||params.metaModelData){if(params.metaModelSrc){var metaModelSrc=params.metaModelSrc;this._dataSource.getMetaModel(metaModelSrc,function(metaModelData){if(sceneModel.destroyed){return;}metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){_this153._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{_this153._parseModel(params.xkt,params,options,sceneModel,null,manifestCtx);finish();}},function(errMsg){error("load(): Failed to load model metadata for model '".concat(modelId," from '").concat(metaModelSrc,"' - ").concat(errMsg));});}else if(params.metaModelData){metaModel.loadData(params.metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){this._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{this._parseModel(params.xkt,params,options,sceneModel,null,manifestCtx);finish();}}}else{if(params.src){this._loadModel(params.src,params,options,sceneModel,metaModel,manifestCtx,finish,error);}else if(params.xkt){this._parseModel(params.xkt,params,options,sceneModel,metaModel,manifestCtx);finish();}else if(params.manifestSrc||params.manifest){var baseDir=params.manifestSrc?getBaseDirectory(params.manifestSrc):"";var loadJSONs=function loadJSONs(metaDataFiles,done,error){var i=0;var loadNext=function loadNext(){if(i>=metaDataFiles.length){done();}else{_this153._dataSource.getMetaModel("".concat(baseDir).concat(metaDataFiles[i]),function(metaModelData){metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});i++;loadNext();},error);}};loadNext();};var loadXKTs=function loadXKTs(xktFiles,done,error){var i=0;var loadNext=function loadNext(){if(i>=xktFiles.length){done();}else{_this153._dataSource.getXKT("".concat(baseDir).concat(xktFiles[i]),function(arrayBuffer){_this153._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx);i++;loadNext();},error);}};loadNext();};if(params.manifest){var manifestData=params.manifest;var xktFiles=manifestData.xktFiles;if(!xktFiles||xktFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXKTs(xktFiles,finish,error);},error);}else{loadXKTs(xktFiles,finish,error);}}else{this._dataSource.getManifest(params.manifestSrc,function(manifestData){if(sceneModel.destroyed){return;}var xktFiles=manifestData.xktFiles;if(!xktFiles||xktFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXKTs(xktFiles,finish,error);},error);}else{loadXKTs(xktFiles,finish,error);}},error);}}}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel,metaModel,manifestCtx,done,error){var _this154=this;this._dataSource.getXKT(params.src,function(arrayBuffer){_this154._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx);done();},error);}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx){if(sceneModel.destroyed){return;}var dataView=new DataView(arrayBuffer);var dataArray=new Uint8Array(arrayBuffer);var xktVersion=dataView.getUint32(0,true);var parser=parsers[xktVersion];if(!parser){this.error("Unsupported .XKT file version: "+xktVersion+" - this XKTLoaderPlugin supports versions "+Object.keys(parsers));return;}this.log("Loading .xkt V"+xktVersion);var numElements=dataView.getUint32(4,true);var elements=[];var byteOffset=(numElements+2)*4;for(var _i538=0;_i538<numElements;_i538++){var elementSize=dataView.getUint32((_i538+2)*4,true);elements.push(dataArray.subarray(byteOffset,byteOffset+elementSize));byteOffset+=elementSize;}parser.parse(this.viewer,options,elements,sceneModel,metaModel,manifestCtx);}// _createDefaultMetaModelIfNeeded(sceneModel, params, options) {
|
|
26949
27021
|
//
|
|
26950
27022
|
// const metaModelId = sceneModel.id;
|
|
26951
27023
|
//
|