@loaders.gl/i3s 4.0.0-alpha.1 → 4.0.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/arcgis-webscene-loader.d.ts +7 -0
- package/dist/arcgis-webscene-loader.d.ts.map +1 -0
- package/dist/arcgis-webscene-loader.js +28 -0
- package/dist/bundle.d.ts +2 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +2 -2
- package/dist/dist.min.js +15501 -0
- package/dist/es5/arcgis-webscene-loader.js +40 -0
- package/dist/es5/arcgis-webscene-loader.js.map +1 -0
- package/dist/es5/bundle.js +6 -0
- package/dist/es5/bundle.js.map +1 -0
- package/dist/es5/i3s-attribute-loader.js +195 -0
- package/dist/es5/i3s-attribute-loader.js.map +1 -0
- package/dist/es5/i3s-building-scene-layer-loader.js +46 -0
- package/dist/es5/i3s-building-scene-layer-loader.js.map +1 -0
- package/dist/es5/i3s-content-loader.js +56 -0
- package/dist/es5/i3s-content-loader.js.map +1 -0
- package/dist/es5/i3s-loader.js +193 -0
- package/dist/es5/i3s-loader.js.map +1 -0
- package/dist/es5/i3s-node-page-loader.js +39 -0
- package/dist/es5/i3s-node-page-loader.js.map +1 -0
- package/dist/es5/i3s-slpk-loader.js +20 -0
- package/dist/es5/i3s-slpk-loader.js.map +1 -0
- package/dist/es5/index.js +82 -0
- package/dist/es5/index.js.map +1 -0
- package/dist/es5/lib/helpers/i3s-nodepages-tiles.js +312 -0
- package/dist/es5/lib/helpers/i3s-nodepages-tiles.js.map +1 -0
- package/dist/es5/lib/parsers/constants.js +72 -0
- package/dist/es5/lib/parsers/constants.js.map +1 -0
- package/dist/es5/lib/parsers/parse-arcgis-webscene.js +158 -0
- package/dist/es5/lib/parsers/parse-arcgis-webscene.js.map +1 -0
- package/dist/es5/lib/parsers/parse-i3s-attribute.js +76 -0
- package/dist/es5/lib/parsers/parse-i3s-attribute.js.map +1 -0
- package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js +65 -0
- package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -0
- package/dist/es5/lib/parsers/parse-i3s-tile-content.js +510 -0
- package/dist/es5/lib/parsers/parse-i3s-tile-content.js.map +1 -0
- package/dist/es5/lib/parsers/parse-i3s.js +116 -0
- package/dist/es5/lib/parsers/parse-i3s.js.map +1 -0
- package/dist/es5/lib/parsers/parse-slpk/parse-slpk.js +107 -0
- package/dist/es5/lib/parsers/parse-slpk/parse-slpk.js.map +1 -0
- package/dist/es5/lib/parsers/parse-slpk/slpk-archieve.js +258 -0
- package/dist/es5/lib/parsers/parse-slpk/slpk-archieve.js.map +1 -0
- package/dist/es5/lib/parsers/parse-zip/buffer-file-provider.js +46 -0
- package/dist/es5/lib/parsers/parse-zip/buffer-file-provider.js.map +1 -0
- package/dist/es5/lib/parsers/parse-zip/cd-file-header.js +84 -0
- package/dist/es5/lib/parsers/parse-zip/cd-file-header.js.map +1 -0
- package/dist/es5/lib/parsers/parse-zip/file-provider.js +2 -0
- package/dist/es5/lib/parsers/parse-zip/file-provider.js.map +1 -0
- package/dist/es5/lib/parsers/parse-zip/local-file-header.js +72 -0
- package/dist/es5/lib/parsers/parse-zip/local-file-header.js.map +1 -0
- package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js +17 -0
- package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -0
- package/dist/es5/lib/utils/customize-/321/201olors.js +184 -0
- package/dist/es5/lib/utils/customize-/321/201olors.js.map +1 -0
- package/dist/es5/lib/utils/url-utils.js +33 -0
- package/dist/es5/lib/utils/url-utils.js.map +1 -0
- package/dist/es5/types.js +26 -0
- package/dist/es5/types.js.map +1 -0
- package/dist/es5/workers/i3s-content-worker-node.js +7 -0
- package/dist/es5/workers/i3s-content-worker-node.js.map +1 -0
- package/dist/es5/workers/i3s-content-worker.js +6 -0
- package/dist/es5/workers/i3s-content-worker.js.map +1 -0
- package/dist/esm/arcgis-webscene-loader.js +16 -0
- package/dist/esm/arcgis-webscene-loader.js.map +1 -0
- package/dist/esm/bundle.js +4 -0
- package/dist/esm/bundle.js.map +1 -0
- package/dist/esm/i3s-attribute-loader.js +119 -0
- package/dist/esm/i3s-attribute-loader.js.map +1 -0
- package/dist/esm/i3s-building-scene-layer-loader.js +19 -0
- package/dist/esm/i3s-building-scene-layer-loader.js.map +1 -0
- package/dist/esm/i3s-content-loader.js +30 -0
- package/dist/esm/i3s-content-loader.js.map +1 -0
- package/dist/esm/i3s-loader.js +87 -0
- package/dist/esm/i3s-loader.js.map +1 -0
- package/dist/esm/i3s-node-page-loader.js +15 -0
- package/dist/esm/i3s-node-page-loader.js.map +1 -0
- package/dist/esm/i3s-slpk-loader.js +13 -0
- package/dist/esm/i3s-slpk-loader.js.map +1 -0
- package/dist/esm/index.js +11 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/lib/helpers/i3s-nodepages-tiles.js +198 -0
- package/dist/esm/lib/helpers/i3s-nodepages-tiles.js.map +1 -0
- package/dist/esm/lib/parsers/constants.js +57 -0
- package/dist/esm/lib/parsers/constants.js.map +1 -0
- package/dist/esm/lib/parsers/parse-arcgis-webscene.js +70 -0
- package/dist/esm/lib/parsers/parse-arcgis-webscene.js.map +1 -0
- package/dist/esm/lib/parsers/parse-i3s-attribute.js +60 -0
- package/dist/esm/lib/parsers/parse-i3s-attribute.js.map +1 -0
- package/dist/esm/lib/parsers/parse-i3s-building-scene-layer.js +39 -0
- package/dist/esm/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -0
- package/dist/esm/lib/parsers/parse-i3s-tile-content.js +435 -0
- package/dist/esm/lib/parsers/parse-i3s-tile-content.js.map +1 -0
- package/dist/esm/lib/parsers/parse-i3s.js +83 -0
- package/dist/esm/lib/parsers/parse-i3s.js.map +1 -0
- package/dist/esm/lib/parsers/parse-slpk/parse-slpk.js +41 -0
- package/dist/esm/lib/parsers/parse-slpk/parse-slpk.js.map +1 -0
- package/dist/esm/lib/parsers/parse-slpk/slpk-archieve.js +107 -0
- package/dist/esm/lib/parsers/parse-slpk/slpk-archieve.js.map +1 -0
- package/dist/esm/lib/parsers/parse-zip/buffer-file-provider.js +23 -0
- package/dist/esm/lib/parsers/parse-zip/buffer-file-provider.js.map +1 -0
- package/dist/esm/lib/parsers/parse-zip/cd-file-header.js +37 -0
- package/dist/esm/lib/parsers/parse-zip/cd-file-header.js.map +1 -0
- package/dist/esm/lib/parsers/parse-zip/file-provider.js +2 -0
- package/dist/esm/lib/parsers/parse-zip/file-provider.js.map +1 -0
- package/dist/esm/lib/parsers/parse-zip/local-file-header.js +25 -0
- package/dist/esm/lib/parsers/parse-zip/local-file-header.js.map +1 -0
- package/dist/esm/lib/utils/convert-i3s-obb-to-mbs.js +9 -0
- package/dist/esm/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -0
- package/dist/esm/lib/utils/customize-/321/201olors.js +98 -0
- package/dist/esm/lib/utils/customize-/321/201olors.js.map +1 -0
- package/dist/esm/lib/utils/url-utils.js +28 -0
- package/dist/esm/lib/utils/url-utils.js.map +1 -0
- package/dist/esm/types.js +18 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/workers/i3s-content-worker-node.js +5 -0
- package/dist/esm/workers/i3s-content-worker-node.js.map +1 -0
- package/dist/esm/workers/i3s-content-worker.js +4 -0
- package/dist/esm/workers/i3s-content-worker.js.map +1 -0
- package/dist/i3s-attribute-loader.d.ts +21 -0
- package/dist/i3s-attribute-loader.d.ts.map +1 -0
- package/dist/i3s-attribute-loader.js +155 -132
- package/dist/i3s-building-scene-layer-loader.d.ts +6 -0
- package/dist/i3s-building-scene-layer-loader.d.ts.map +1 -0
- package/dist/i3s-building-scene-layer-loader.js +23 -18
- package/dist/i3s-content-loader.d.ts +6 -0
- package/dist/i3s-content-loader.d.ts.map +1 -0
- package/dist/i3s-content-loader.js +29 -22
- package/dist/i3s-content-worker-node.js +197 -0
- package/dist/i3s-content-worker-node.js.map +7 -0
- package/dist/i3s-content-worker.js +2308 -1376
- package/dist/i3s-loader.d.ts +11 -0
- package/dist/i3s-loader.d.ts.map +1 -0
- package/dist/i3s-loader.js +88 -81
- package/dist/i3s-node-page-loader.d.ts +7 -0
- package/dist/i3s-node-page-loader.d.ts.map +1 -0
- package/dist/i3s-node-page-loader.js +20 -20
- package/dist/i3s-slpk-loader.d.ts +13 -0
- package/dist/i3s-slpk-loader.d.ts.map +1 -0
- package/dist/i3s-slpk-loader.js +20 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -5
- package/dist/lib/helpers/i3s-nodepages-tiles.d.ts +74 -0
- package/dist/lib/helpers/i3s-nodepages-tiles.d.ts.map +1 -0
- package/dist/lib/helpers/i3s-nodepages-tiles.js +232 -219
- package/dist/lib/parsers/constants.d.ts +40 -0
- package/dist/lib/parsers/constants.d.ts.map +1 -0
- package/dist/lib/parsers/constants.js +87 -42
- package/dist/lib/parsers/parse-arcgis-webscene.d.ts +7 -0
- package/dist/lib/parsers/parse-arcgis-webscene.d.ts.map +1 -0
- package/dist/lib/parsers/parse-arcgis-webscene.js +88 -0
- package/dist/lib/parsers/parse-i3s-attribute.d.ts +12 -0
- package/dist/lib/parsers/parse-i3s-attribute.d.ts.map +1 -0
- package/dist/lib/parsers/parse-i3s-attribute.js +87 -62
- package/dist/lib/parsers/parse-i3s-building-scene-layer.d.ts +9 -0
- package/dist/lib/parsers/parse-i3s-building-scene-layer.d.ts.map +1 -0
- package/dist/lib/parsers/parse-i3s-building-scene-layer.js +41 -38
- package/dist/lib/parsers/parse-i3s-tile-content.d.ts +4 -0
- package/dist/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -0
- package/dist/lib/parsers/parse-i3s-tile-content.js +460 -415
- package/dist/lib/parsers/parse-i3s.d.ts +6 -0
- package/dist/lib/parsers/parse-i3s.d.ts.map +1 -0
- package/dist/lib/parsers/parse-i3s.js +92 -73
- package/dist/lib/parsers/parse-slpk/parse-slpk.d.ts +4 -0
- package/dist/lib/parsers/parse-slpk/parse-slpk.d.ts.map +1 -0
- package/dist/lib/parsers/parse-slpk/parse-slpk.js +54 -0
- package/dist/lib/parsers/parse-slpk/slpk-archieve.d.ts +38 -0
- package/dist/lib/parsers/parse-slpk/slpk-archieve.d.ts.map +1 -0
- package/dist/lib/parsers/parse-slpk/slpk-archieve.js +142 -0
- package/dist/lib/parsers/parse-zip/buffer-file-provider.d.ts +37 -0
- package/dist/lib/parsers/parse-zip/buffer-file-provider.d.ts.map +1 -0
- package/dist/lib/parsers/parse-zip/buffer-file-provider.js +47 -0
- package/dist/lib/parsers/parse-zip/cd-file-header.d.ts +27 -0
- package/dist/lib/parsers/parse-zip/cd-file-header.d.ts.map +1 -0
- package/dist/lib/parsers/parse-zip/cd-file-header.js +48 -0
- package/dist/lib/parsers/parse-zip/file-provider.d.ts +31 -0
- package/dist/lib/parsers/parse-zip/file-provider.d.ts.map +1 -0
- package/dist/lib/parsers/parse-zip/file-provider.js +2 -0
- package/dist/lib/parsers/parse-zip/local-file-header.d.ts +25 -0
- package/dist/lib/parsers/parse-zip/local-file-header.d.ts.map +1 -0
- package/dist/lib/parsers/parse-zip/local-file-header.js +34 -0
- package/dist/lib/utils/convert-i3s-obb-to-mbs.d.ts +2 -0
- package/dist/lib/utils/convert-i3s-obb-to-mbs.d.ts.map +1 -0
- package/dist/lib/utils/convert-i3s-obb-to-mbs.js +19 -8
- package/dist/lib/utils/customize-/321/201olors.d.ts +14 -0
- package/dist/lib/utils/customize-/321/201olors.d.ts.map +1 -0
- package/dist/lib/utils/customize-/321/201olors.js +104 -0
- package/dist/lib/utils/url-utils.d.ts +22 -0
- package/dist/lib/utils/url-utils.d.ts.map +1 -0
- package/dist/lib/utils/url-utils.js +41 -29
- package/dist/types.d.ts +1065 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +20 -2
- package/dist/workers/i3s-content-worker-node.d.ts +2 -0
- package/dist/workers/i3s-content-worker-node.d.ts.map +1 -0
- package/dist/workers/i3s-content-worker-node.js +7 -0
- package/dist/workers/i3s-content-worker.d.ts +2 -0
- package/dist/workers/i3s-content-worker.d.ts.map +1 -0
- package/dist/workers/i3s-content-worker.js +5 -4
- package/package.json +18 -16
- package/src/arcgis-webscene-loader.ts +31 -0
- package/src/i3s-attribute-loader.ts +9 -9
- package/src/i3s-content-loader.ts +17 -5
- package/src/i3s-loader.ts +24 -13
- package/src/i3s-node-page-loader.ts +6 -10
- package/src/i3s-slpk-loader.ts +27 -0
- package/src/index.ts +28 -7
- package/src/lib/helpers/i3s-nodepages-tiles.ts +84 -57
- package/src/lib/parsers/constants.ts +71 -37
- package/src/lib/parsers/parse-arcgis-webscene.ts +102 -0
- package/src/lib/parsers/parse-i3s-attribute.ts +21 -14
- package/src/lib/parsers/parse-i3s-building-scene-layer.ts +2 -1
- package/src/lib/parsers/parse-i3s-tile-content.ts +278 -194
- package/src/lib/parsers/parse-i3s.ts +55 -39
- package/src/lib/parsers/parse-slpk/parse-slpk.ts +72 -0
- package/src/lib/parsers/parse-slpk/slpk-archieve.ts +173 -0
- package/src/lib/parsers/parse-zip/buffer-file-provider.ts +55 -0
- package/src/lib/parsers/parse-zip/cd-file-header.ts +86 -0
- package/src/lib/parsers/parse-zip/file-provider.ts +34 -0
- package/src/lib/parsers/parse-zip/local-file-header.ts +65 -0
- package/src/lib/utils/customize-/321/201olors.ts +144 -0
- package/src/lib/utils/url-utils.ts +7 -7
- package/src/types.ts +875 -86
- package/src/workers/i3s-content-worker-node.ts +6 -0
- package/dist/bundle.js.map +0 -1
- package/dist/i3s-attribute-loader.js.map +0 -1
- package/dist/i3s-building-scene-layer-loader.js.map +0 -1
- package/dist/i3s-content-loader.js.map +0 -1
- package/dist/i3s-loader.js.map +0 -1
- package/dist/i3s-node-page-loader.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/helpers/i3s-nodepages-tiles.js.map +0 -1
- package/dist/lib/parsers/constants.js.map +0 -1
- package/dist/lib/parsers/parse-i3s-attribute.js.map +0 -1
- package/dist/lib/parsers/parse-i3s-building-scene-layer.js.map +0 -1
- package/dist/lib/parsers/parse-i3s-tile-content.js.map +0 -1
- package/dist/lib/parsers/parse-i3s.js.map +0 -1
- package/dist/lib/utils/convert-i3s-obb-to-mbs.js.map +0 -1
- package/dist/lib/utils/url-utils.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/workers/i3s-content-worker.js.map +0 -1
|
@@ -1,11 +1,36 @@
|
|
|
1
1
|
(() => {
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
3
8
|
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
9
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
10
|
+
return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
|
+
};
|
|
4
12
|
var __export = (target, all) => {
|
|
5
13
|
__markAsModule(target);
|
|
6
14
|
for (var name in all)
|
|
7
15
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
16
|
};
|
|
17
|
+
var __reExport = (target, module, desc) => {
|
|
18
|
+
if (module && typeof module === "object" || typeof module === "function") {
|
|
19
|
+
for (let key of __getOwnPropNames(module))
|
|
20
|
+
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
21
|
+
__defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });
|
|
22
|
+
}
|
|
23
|
+
return target;
|
|
24
|
+
};
|
|
25
|
+
var __toModule = (module) => {
|
|
26
|
+
return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? { get: () => module.default, enumerable: true } : { value: module, enumerable: true })), module);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// (disabled):../worker-utils/src/lib/node/require-utils.node
|
|
30
|
+
var require_require_utils = __commonJS({
|
|
31
|
+
"(disabled):../worker-utils/src/lib/node/require-utils.node"() {
|
|
32
|
+
}
|
|
33
|
+
});
|
|
9
34
|
|
|
10
35
|
// ../loader-utils/src/lib/env-utils/assert.ts
|
|
11
36
|
function assert(condition, message) {
|
|
@@ -30,9 +55,8 @@
|
|
|
30
55
|
var nodeVersion = matches && parseFloat(matches[1]) || 0;
|
|
31
56
|
|
|
32
57
|
// ../worker-utils/src/lib/env-utils/version.ts
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
if (typeof __VERSION__ === "undefined") {
|
|
58
|
+
var VERSION = true ? "4.0.0-alpha.11" : DEFAULT_VERSION;
|
|
59
|
+
if (false) {
|
|
36
60
|
console.error("loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.");
|
|
37
61
|
}
|
|
38
62
|
|
|
@@ -63,15 +87,15 @@
|
|
|
63
87
|
// ../worker-utils/src/lib/worker-farm/worker-job.ts
|
|
64
88
|
var WorkerJob = class {
|
|
65
89
|
constructor(jobName, workerThread) {
|
|
66
|
-
this.name = jobName;
|
|
67
|
-
this.workerThread = workerThread;
|
|
68
90
|
this.isRunning = true;
|
|
69
91
|
this._resolve = () => {
|
|
70
92
|
};
|
|
71
93
|
this._reject = () => {
|
|
72
94
|
};
|
|
73
|
-
this.
|
|
74
|
-
|
|
95
|
+
this.name = jobName;
|
|
96
|
+
this.workerThread = workerThread;
|
|
97
|
+
this.result = new Promise((resolve2, reject) => {
|
|
98
|
+
this._resolve = resolve2;
|
|
75
99
|
this._reject = reject;
|
|
76
100
|
});
|
|
77
101
|
}
|
|
@@ -94,6 +118,12 @@
|
|
|
94
118
|
}
|
|
95
119
|
};
|
|
96
120
|
|
|
121
|
+
// ../worker-utils/src/lib/node/worker_threads-browser.ts
|
|
122
|
+
var Worker2 = class {
|
|
123
|
+
terminate() {
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
97
127
|
// ../worker-utils/src/lib/worker-utils/get-loadable-worker-url.ts
|
|
98
128
|
var workerURLCache = new Map();
|
|
99
129
|
function getLoadableWorkerURL(props) {
|
|
@@ -181,10 +211,10 @@
|
|
|
181
211
|
this.url = url;
|
|
182
212
|
this.onMessage = NOOP;
|
|
183
213
|
this.onError = (error) => console.log(error);
|
|
184
|
-
this.worker = this._createBrowserWorker();
|
|
214
|
+
this.worker = isBrowser2 ? this._createBrowserWorker() : this._createNodeWorker();
|
|
185
215
|
}
|
|
186
216
|
static isSupported() {
|
|
187
|
-
return typeof Worker !== "undefined";
|
|
217
|
+
return typeof Worker !== "undefined" && isBrowser2 || typeof Worker2 !== "undefined" && !isBrowser2;
|
|
188
218
|
}
|
|
189
219
|
destroy() {
|
|
190
220
|
this.onMessage = NOOP;
|
|
@@ -227,6 +257,27 @@
|
|
|
227
257
|
worker.onmessageerror = (event) => console.error(event);
|
|
228
258
|
return worker;
|
|
229
259
|
}
|
|
260
|
+
_createNodeWorker() {
|
|
261
|
+
let worker;
|
|
262
|
+
if (this.url) {
|
|
263
|
+
const absolute = this.url.includes(":/") || this.url.startsWith("/");
|
|
264
|
+
const url = absolute ? this.url : `./${this.url}`;
|
|
265
|
+
worker = new Worker2(url, { eval: false });
|
|
266
|
+
} else if (this.source) {
|
|
267
|
+
worker = new Worker2(this.source, { eval: true });
|
|
268
|
+
} else {
|
|
269
|
+
throw new Error("no worker");
|
|
270
|
+
}
|
|
271
|
+
worker.on("message", (data) => {
|
|
272
|
+
this.onMessage(data);
|
|
273
|
+
});
|
|
274
|
+
worker.on("error", (error) => {
|
|
275
|
+
this.onError(error);
|
|
276
|
+
});
|
|
277
|
+
worker.on("exit", (code) => {
|
|
278
|
+
});
|
|
279
|
+
return worker;
|
|
280
|
+
}
|
|
230
281
|
};
|
|
231
282
|
|
|
232
283
|
// ../worker-utils/src/lib/worker-farm/worker-pool.ts
|
|
@@ -247,6 +298,9 @@
|
|
|
247
298
|
this.url = props.url;
|
|
248
299
|
this.setProps(props);
|
|
249
300
|
}
|
|
301
|
+
static isSupported() {
|
|
302
|
+
return WorkerThread.isSupported();
|
|
303
|
+
}
|
|
250
304
|
destroy() {
|
|
251
305
|
this.idleQueue.forEach((worker) => worker.destroy());
|
|
252
306
|
this.isDestroyed = true;
|
|
@@ -305,7 +359,7 @@
|
|
|
305
359
|
}
|
|
306
360
|
}
|
|
307
361
|
returnWorkerToQueue(worker) {
|
|
308
|
-
const shouldDestroyWorker = this.isDestroyed || !this.reuseWorkers || this.count > this._getMaxConcurrency();
|
|
362
|
+
const shouldDestroyWorker = !isBrowser2 || this.isDestroyed || !this.reuseWorkers || this.count > this._getMaxConcurrency();
|
|
309
363
|
if (shouldDestroyWorker) {
|
|
310
364
|
worker.destroy();
|
|
311
365
|
this.count--;
|
|
@@ -336,9 +390,9 @@
|
|
|
336
390
|
var DEFAULT_PROPS = {
|
|
337
391
|
maxConcurrency: 3,
|
|
338
392
|
maxMobileConcurrency: 1,
|
|
393
|
+
reuseWorkers: true,
|
|
339
394
|
onDebug: () => {
|
|
340
|
-
}
|
|
341
|
-
reuseWorkers: true
|
|
395
|
+
}
|
|
342
396
|
};
|
|
343
397
|
var WorkerFarm = class {
|
|
344
398
|
constructor(props) {
|
|
@@ -359,6 +413,7 @@
|
|
|
359
413
|
for (const workerPool of this.workerPools.values()) {
|
|
360
414
|
workerPool.destroy();
|
|
361
415
|
}
|
|
416
|
+
this.workerPools = new Map();
|
|
362
417
|
}
|
|
363
418
|
setProps(props) {
|
|
364
419
|
this.props = { ...this.props, ...props };
|
|
@@ -391,16 +446,33 @@
|
|
|
391
446
|
};
|
|
392
447
|
|
|
393
448
|
// ../worker-utils/src/lib/worker-farm/worker-body.ts
|
|
449
|
+
function getParentPort() {
|
|
450
|
+
let parentPort;
|
|
451
|
+
try {
|
|
452
|
+
eval("globalThis.parentPort = require('worker_threads').parentPort");
|
|
453
|
+
parentPort = globalThis.parentPort;
|
|
454
|
+
} catch {
|
|
455
|
+
}
|
|
456
|
+
return parentPort;
|
|
457
|
+
}
|
|
394
458
|
var onMessageWrapperMap = new Map();
|
|
395
459
|
var WorkerBody = class {
|
|
460
|
+
static inWorkerThread() {
|
|
461
|
+
return typeof self !== "undefined" || Boolean(getParentPort());
|
|
462
|
+
}
|
|
396
463
|
static set onmessage(onMessage2) {
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
}
|
|
401
|
-
const { type, payload } = message.data;
|
|
464
|
+
function handleMessage(message) {
|
|
465
|
+
const parentPort3 = getParentPort();
|
|
466
|
+
const { type, payload } = parentPort3 ? message : message.data;
|
|
402
467
|
onMessage2(type, payload);
|
|
403
|
-
}
|
|
468
|
+
}
|
|
469
|
+
const parentPort2 = getParentPort();
|
|
470
|
+
if (parentPort2) {
|
|
471
|
+
parentPort2.on("message", handleMessage);
|
|
472
|
+
parentPort2.on("exit", () => console.debug("Node worker closing"));
|
|
473
|
+
} else {
|
|
474
|
+
globalThis.onmessage = handleMessage;
|
|
475
|
+
}
|
|
404
476
|
}
|
|
405
477
|
static addEventListener(onMessage2) {
|
|
406
478
|
let onMessageWrapper = onMessageWrapperMap.get(onMessage2);
|
|
@@ -409,22 +481,36 @@
|
|
|
409
481
|
if (!isKnownMessage(message)) {
|
|
410
482
|
return;
|
|
411
483
|
}
|
|
412
|
-
const
|
|
484
|
+
const parentPort3 = getParentPort();
|
|
485
|
+
const { type, payload } = parentPort3 ? message : message.data;
|
|
413
486
|
onMessage2(type, payload);
|
|
414
487
|
};
|
|
415
488
|
}
|
|
416
|
-
|
|
489
|
+
const parentPort2 = getParentPort();
|
|
490
|
+
if (parentPort2) {
|
|
491
|
+
console.error("not implemented");
|
|
492
|
+
} else {
|
|
493
|
+
globalThis.addEventListener("message", onMessageWrapper);
|
|
494
|
+
}
|
|
417
495
|
}
|
|
418
496
|
static removeEventListener(onMessage2) {
|
|
419
497
|
const onMessageWrapper = onMessageWrapperMap.get(onMessage2);
|
|
420
498
|
onMessageWrapperMap.delete(onMessage2);
|
|
421
|
-
|
|
499
|
+
const parentPort2 = getParentPort();
|
|
500
|
+
if (parentPort2) {
|
|
501
|
+
console.error("not implemented");
|
|
502
|
+
} else {
|
|
503
|
+
globalThis.removeEventListener("message", onMessageWrapper);
|
|
504
|
+
}
|
|
422
505
|
}
|
|
423
506
|
static postMessage(type, payload) {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
507
|
+
const data = { source: "loaders.gl", type, payload };
|
|
508
|
+
const transferList = getTransferList(payload);
|
|
509
|
+
const parentPort2 = getParentPort();
|
|
510
|
+
if (parentPort2) {
|
|
511
|
+
parentPort2.postMessage(data, transferList);
|
|
512
|
+
} else {
|
|
513
|
+
globalThis.postMessage(data, transferList);
|
|
428
514
|
}
|
|
429
515
|
}
|
|
430
516
|
};
|
|
@@ -437,8 +523,11 @@
|
|
|
437
523
|
var NPM_TAG = "beta";
|
|
438
524
|
function getWorkerURL(worker, options = {}) {
|
|
439
525
|
const workerOptions = options[worker.id] || {};
|
|
440
|
-
const workerFile = `${worker.id}-worker.js`;
|
|
526
|
+
const workerFile = isBrowser2 ? `${worker.id}-worker.js` : `${worker.id}-worker-node.js`;
|
|
441
527
|
let url = workerOptions.workerUrl;
|
|
528
|
+
if (!url && worker.id === "compression") {
|
|
529
|
+
url = options.workerUrl;
|
|
530
|
+
}
|
|
442
531
|
if (options._workerType === "test") {
|
|
443
532
|
url = `modules/${worker.module}/dist/${workerFile}`;
|
|
444
533
|
}
|
|
@@ -465,6 +554,7 @@
|
|
|
465
554
|
}
|
|
466
555
|
|
|
467
556
|
// ../worker-utils/src/lib/library-utils/library-utils.ts
|
|
557
|
+
var node = __toModule(require_require_utils());
|
|
468
558
|
var LATEST = "beta";
|
|
469
559
|
var VERSION2 = typeof VERSION !== "undefined" ? VERSION : LATEST;
|
|
470
560
|
var loadLibraryPromises = {};
|
|
@@ -501,7 +591,11 @@
|
|
|
501
591
|
return await response2.arrayBuffer();
|
|
502
592
|
}
|
|
503
593
|
if (!isBrowser2) {
|
|
504
|
-
|
|
594
|
+
try {
|
|
595
|
+
return node && node.requireFromFile && await node.requireFromFile(libraryUrl);
|
|
596
|
+
} catch {
|
|
597
|
+
return null;
|
|
598
|
+
}
|
|
505
599
|
}
|
|
506
600
|
if (isWorker) {
|
|
507
601
|
return importScripts(libraryUrl);
|
|
@@ -532,19 +626,20 @@
|
|
|
532
626
|
// ../loader-utils/src/lib/worker-loader-utils/create-loader-worker.ts
|
|
533
627
|
var requestId = 0;
|
|
534
628
|
function createLoaderWorker(loader) {
|
|
535
|
-
if (
|
|
629
|
+
if (!WorkerBody.inWorkerThread()) {
|
|
536
630
|
return;
|
|
537
631
|
}
|
|
538
632
|
WorkerBody.onmessage = async (type, payload) => {
|
|
539
633
|
switch (type) {
|
|
540
634
|
case "process":
|
|
541
635
|
try {
|
|
542
|
-
const { input, options = {} } = payload;
|
|
636
|
+
const { input, options = {}, context = {} } = payload;
|
|
543
637
|
const result = await parseData({
|
|
544
638
|
loader,
|
|
545
639
|
arrayBuffer: input,
|
|
546
640
|
options,
|
|
547
641
|
context: {
|
|
642
|
+
...context,
|
|
548
643
|
parse: parseOnMainThread
|
|
549
644
|
}
|
|
550
645
|
});
|
|
@@ -559,7 +654,7 @@
|
|
|
559
654
|
};
|
|
560
655
|
}
|
|
561
656
|
function parseOnMainThread(arrayBuffer, options) {
|
|
562
|
-
return new Promise((
|
|
657
|
+
return new Promise((resolve2, reject) => {
|
|
563
658
|
const id = requestId++;
|
|
564
659
|
const onMessage2 = (type, payload2) => {
|
|
565
660
|
if (payload2.id !== id) {
|
|
@@ -568,7 +663,7 @@
|
|
|
568
663
|
switch (type) {
|
|
569
664
|
case "done":
|
|
570
665
|
WorkerBody.removeEventListener(onMessage2);
|
|
571
|
-
|
|
666
|
+
resolve2(payload2.result);
|
|
572
667
|
break;
|
|
573
668
|
case "error":
|
|
574
669
|
WorkerBody.removeEventListener(onMessage2);
|
|
@@ -608,6 +703,9 @@
|
|
|
608
703
|
if (!WorkerFarm.isSupported()) {
|
|
609
704
|
return false;
|
|
610
705
|
}
|
|
706
|
+
if (!isBrowser2 && !options?._nodeWorkers) {
|
|
707
|
+
return false;
|
|
708
|
+
}
|
|
611
709
|
return loader.worker && options?.worker;
|
|
612
710
|
}
|
|
613
711
|
async function parseWithWorker(loader, data, options, context, parseOnMainThread2) {
|
|
@@ -616,10 +714,12 @@
|
|
|
616
714
|
const workerFarm = WorkerFarm.getWorkerFarm(options);
|
|
617
715
|
const workerPool = workerFarm.getWorkerPool({ name, url });
|
|
618
716
|
options = JSON.parse(JSON.stringify(options));
|
|
717
|
+
context = JSON.parse(JSON.stringify(context || {}));
|
|
619
718
|
const job = await workerPool.startJob("process-on-worker", onMessage.bind(null, parseOnMainThread2));
|
|
620
719
|
job.postMessage("process", {
|
|
621
720
|
input: data,
|
|
622
|
-
options
|
|
721
|
+
options,
|
|
722
|
+
context
|
|
623
723
|
});
|
|
624
724
|
const result = await job.result;
|
|
625
725
|
return await result.result;
|
|
@@ -647,42 +747,7 @@
|
|
|
647
747
|
}
|
|
648
748
|
}
|
|
649
749
|
|
|
650
|
-
// ../loader-utils/src/lib/binary-utils/buffer-utils.ts
|
|
651
|
-
function isBuffer(value) {
|
|
652
|
-
return value && typeof value === "object" && value.isBuffer;
|
|
653
|
-
}
|
|
654
|
-
function bufferToArrayBuffer(buffer) {
|
|
655
|
-
if (isBuffer(buffer)) {
|
|
656
|
-
const typedArray = new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.length);
|
|
657
|
-
return typedArray.slice().buffer;
|
|
658
|
-
}
|
|
659
|
-
return buffer;
|
|
660
|
-
}
|
|
661
|
-
|
|
662
750
|
// ../loader-utils/src/lib/binary-utils/array-buffer-utils.ts
|
|
663
|
-
function toArrayBuffer(data) {
|
|
664
|
-
if (isBuffer(data)) {
|
|
665
|
-
return bufferToArrayBuffer(data);
|
|
666
|
-
}
|
|
667
|
-
if (data instanceof ArrayBuffer) {
|
|
668
|
-
return data;
|
|
669
|
-
}
|
|
670
|
-
if (ArrayBuffer.isView(data)) {
|
|
671
|
-
if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {
|
|
672
|
-
return data.buffer;
|
|
673
|
-
}
|
|
674
|
-
return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
|
|
675
|
-
}
|
|
676
|
-
if (typeof data === "string") {
|
|
677
|
-
const text = data;
|
|
678
|
-
const uint8Array = new TextEncoder().encode(text);
|
|
679
|
-
return uint8Array.buffer;
|
|
680
|
-
}
|
|
681
|
-
if (data && typeof data === "object" && data._toArrayBuffer) {
|
|
682
|
-
return data._toArrayBuffer();
|
|
683
|
-
}
|
|
684
|
-
throw new Error("toArrayBuffer");
|
|
685
|
-
}
|
|
686
751
|
function compareArrayBuffers(arrayBuffer1, arrayBuffer2, byteLength) {
|
|
687
752
|
byteLength = byteLength || arrayBuffer1.byteLength;
|
|
688
753
|
if (arrayBuffer1.byteLength < byteLength || arrayBuffer2.byteLength < byteLength) {
|
|
@@ -699,7 +764,7 @@
|
|
|
699
764
|
}
|
|
700
765
|
function concatenateArrayBuffers(...sources) {
|
|
701
766
|
const sourceArrays = sources.map((source2) => source2 instanceof ArrayBuffer ? new Uint8Array(source2) : source2);
|
|
702
|
-
const byteLength = sourceArrays.reduce((
|
|
767
|
+
const byteLength = sourceArrays.reduce((length2, typedArray) => length2 + typedArray.byteLength, 0);
|
|
703
768
|
const result = new Uint8Array(byteLength);
|
|
704
769
|
let offset = 0;
|
|
705
770
|
for (const sourceArray of sourceArrays) {
|
|
@@ -718,6 +783,52 @@
|
|
|
718
783
|
return concatenateArrayBuffers(...arrayBuffers);
|
|
719
784
|
}
|
|
720
785
|
|
|
786
|
+
// ../../node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
787
|
+
function _typeof(obj) {
|
|
788
|
+
"@babel/helpers - typeof";
|
|
789
|
+
return _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) {
|
|
790
|
+
return typeof obj2;
|
|
791
|
+
} : function(obj2) {
|
|
792
|
+
return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
793
|
+
}, _typeof(obj);
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
// ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
|
|
797
|
+
function _toPrimitive(input, hint) {
|
|
798
|
+
if (_typeof(input) !== "object" || input === null)
|
|
799
|
+
return input;
|
|
800
|
+
var prim = input[Symbol.toPrimitive];
|
|
801
|
+
if (prim !== void 0) {
|
|
802
|
+
var res = prim.call(input, hint || "default");
|
|
803
|
+
if (_typeof(res) !== "object")
|
|
804
|
+
return res;
|
|
805
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
806
|
+
}
|
|
807
|
+
return (hint === "string" ? String : Number)(input);
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
// ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
|
|
811
|
+
function _toPropertyKey(arg) {
|
|
812
|
+
var key = _toPrimitive(arg, "string");
|
|
813
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
// ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
817
|
+
function _defineProperty(obj, key, value) {
|
|
818
|
+
key = _toPropertyKey(key);
|
|
819
|
+
if (key in obj) {
|
|
820
|
+
Object.defineProperty(obj, key, {
|
|
821
|
+
value,
|
|
822
|
+
enumerable: true,
|
|
823
|
+
configurable: true,
|
|
824
|
+
writable: true
|
|
825
|
+
});
|
|
826
|
+
} else {
|
|
827
|
+
obj[key] = value;
|
|
828
|
+
}
|
|
829
|
+
return obj;
|
|
830
|
+
}
|
|
831
|
+
|
|
721
832
|
// ../loader-utils/src/lib/path-utils/file-aliases.ts
|
|
722
833
|
var pathPrefix = "";
|
|
723
834
|
var fileAliases = {};
|
|
@@ -734,19 +845,64 @@
|
|
|
734
845
|
return filename2;
|
|
735
846
|
}
|
|
736
847
|
|
|
848
|
+
// ../loader-utils/src/lib/node/buffer.browser.ts
|
|
849
|
+
function toArrayBuffer(buffer) {
|
|
850
|
+
return buffer;
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
// ../loader-utils/src/lib/binary-utils/memory-conversion-utils.ts
|
|
854
|
+
function isBuffer(value) {
|
|
855
|
+
return value && typeof value === "object" && value.isBuffer;
|
|
856
|
+
}
|
|
857
|
+
function toArrayBuffer2(data) {
|
|
858
|
+
if (isBuffer(data)) {
|
|
859
|
+
return toArrayBuffer(data);
|
|
860
|
+
}
|
|
861
|
+
if (data instanceof ArrayBuffer) {
|
|
862
|
+
return data;
|
|
863
|
+
}
|
|
864
|
+
if (ArrayBuffer.isView(data)) {
|
|
865
|
+
if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {
|
|
866
|
+
return data.buffer;
|
|
867
|
+
}
|
|
868
|
+
return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
|
|
869
|
+
}
|
|
870
|
+
if (typeof data === "string") {
|
|
871
|
+
const text = data;
|
|
872
|
+
const uint8Array = new TextEncoder().encode(text);
|
|
873
|
+
return uint8Array.buffer;
|
|
874
|
+
}
|
|
875
|
+
if (data && typeof data === "object" && data._toArrayBuffer) {
|
|
876
|
+
return data._toArrayBuffer();
|
|
877
|
+
}
|
|
878
|
+
throw new Error("toArrayBuffer");
|
|
879
|
+
}
|
|
880
|
+
|
|
737
881
|
// ../loader-utils/src/lib/path-utils/path.ts
|
|
738
882
|
var path_exports = {};
|
|
739
883
|
__export(path_exports, {
|
|
740
884
|
dirname: () => dirname,
|
|
741
885
|
filename: () => filename,
|
|
742
|
-
join: () => join
|
|
886
|
+
join: () => join,
|
|
887
|
+
resolve: () => resolve
|
|
743
888
|
});
|
|
889
|
+
|
|
890
|
+
// ../loader-utils/src/lib/path-utils/get-cwd.ts
|
|
891
|
+
function getCWD() {
|
|
892
|
+
if (typeof process !== "undefined" && typeof process.cwd !== "undefined") {
|
|
893
|
+
return process.cwd();
|
|
894
|
+
}
|
|
895
|
+
const pathname = window.location?.pathname;
|
|
896
|
+
return pathname?.slice(0, pathname.lastIndexOf("/") + 1) || "";
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
// ../loader-utils/src/lib/path-utils/path.ts
|
|
744
900
|
function filename(url) {
|
|
745
|
-
const slashIndex = url
|
|
901
|
+
const slashIndex = url ? url.lastIndexOf("/") : -1;
|
|
746
902
|
return slashIndex >= 0 ? url.substr(slashIndex + 1) : "";
|
|
747
903
|
}
|
|
748
904
|
function dirname(url) {
|
|
749
|
-
const slashIndex = url
|
|
905
|
+
const slashIndex = url ? url.lastIndexOf("/") : -1;
|
|
750
906
|
return slashIndex >= 0 ? url.substr(0, slashIndex) : "";
|
|
751
907
|
}
|
|
752
908
|
function join(...parts) {
|
|
@@ -762,6 +918,108 @@
|
|
|
762
918
|
});
|
|
763
919
|
return parts.join(separator);
|
|
764
920
|
}
|
|
921
|
+
function resolve(...components) {
|
|
922
|
+
const paths = [];
|
|
923
|
+
for (let _i = 0; _i < components.length; _i++) {
|
|
924
|
+
paths[_i] = components[_i];
|
|
925
|
+
}
|
|
926
|
+
let resolvedPath = "";
|
|
927
|
+
let resolvedAbsolute = false;
|
|
928
|
+
let cwd;
|
|
929
|
+
for (let i2 = paths.length - 1; i2 >= -1 && !resolvedAbsolute; i2--) {
|
|
930
|
+
let path;
|
|
931
|
+
if (i2 >= 0) {
|
|
932
|
+
path = paths[i2];
|
|
933
|
+
} else {
|
|
934
|
+
if (cwd === void 0) {
|
|
935
|
+
cwd = getCWD();
|
|
936
|
+
}
|
|
937
|
+
path = cwd;
|
|
938
|
+
}
|
|
939
|
+
if (path.length === 0) {
|
|
940
|
+
continue;
|
|
941
|
+
}
|
|
942
|
+
resolvedPath = `${path}/${resolvedPath}`;
|
|
943
|
+
resolvedAbsolute = path.charCodeAt(0) === SLASH;
|
|
944
|
+
}
|
|
945
|
+
resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);
|
|
946
|
+
if (resolvedAbsolute) {
|
|
947
|
+
return `/${resolvedPath}`;
|
|
948
|
+
} else if (resolvedPath.length > 0) {
|
|
949
|
+
return resolvedPath;
|
|
950
|
+
}
|
|
951
|
+
return ".";
|
|
952
|
+
}
|
|
953
|
+
var SLASH = 47;
|
|
954
|
+
var DOT = 46;
|
|
955
|
+
function normalizeStringPosix(path, allowAboveRoot) {
|
|
956
|
+
let res = "";
|
|
957
|
+
let lastSlash = -1;
|
|
958
|
+
let dots = 0;
|
|
959
|
+
let code;
|
|
960
|
+
let isAboveRoot = false;
|
|
961
|
+
for (let i2 = 0; i2 <= path.length; ++i2) {
|
|
962
|
+
if (i2 < path.length) {
|
|
963
|
+
code = path.charCodeAt(i2);
|
|
964
|
+
} else if (code === SLASH) {
|
|
965
|
+
break;
|
|
966
|
+
} else {
|
|
967
|
+
code = SLASH;
|
|
968
|
+
}
|
|
969
|
+
if (code === SLASH) {
|
|
970
|
+
if (lastSlash === i2 - 1 || dots === 1) {
|
|
971
|
+
} else if (lastSlash !== i2 - 1 && dots === 2) {
|
|
972
|
+
if (res.length < 2 || !isAboveRoot || res.charCodeAt(res.length - 1) !== DOT || res.charCodeAt(res.length - 2) !== DOT) {
|
|
973
|
+
if (res.length > 2) {
|
|
974
|
+
const start = res.length - 1;
|
|
975
|
+
let j = start;
|
|
976
|
+
for (; j >= 0; --j) {
|
|
977
|
+
if (res.charCodeAt(j) === SLASH) {
|
|
978
|
+
break;
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
if (j !== start) {
|
|
982
|
+
res = j === -1 ? "" : res.slice(0, j);
|
|
983
|
+
lastSlash = i2;
|
|
984
|
+
dots = 0;
|
|
985
|
+
isAboveRoot = false;
|
|
986
|
+
continue;
|
|
987
|
+
}
|
|
988
|
+
} else if (res.length === 2 || res.length === 1) {
|
|
989
|
+
res = "";
|
|
990
|
+
lastSlash = i2;
|
|
991
|
+
dots = 0;
|
|
992
|
+
isAboveRoot = false;
|
|
993
|
+
continue;
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
if (allowAboveRoot) {
|
|
997
|
+
if (res.length > 0) {
|
|
998
|
+
res += "/..";
|
|
999
|
+
} else {
|
|
1000
|
+
res = "..";
|
|
1001
|
+
}
|
|
1002
|
+
isAboveRoot = true;
|
|
1003
|
+
}
|
|
1004
|
+
} else {
|
|
1005
|
+
const slice = path.slice(lastSlash + 1, i2);
|
|
1006
|
+
if (res.length > 0) {
|
|
1007
|
+
res += `/${slice}`;
|
|
1008
|
+
} else {
|
|
1009
|
+
res = slice;
|
|
1010
|
+
}
|
|
1011
|
+
isAboveRoot = false;
|
|
1012
|
+
}
|
|
1013
|
+
lastSlash = i2;
|
|
1014
|
+
dots = 0;
|
|
1015
|
+
} else if (code === DOT && dots !== -1) {
|
|
1016
|
+
++dots;
|
|
1017
|
+
} else {
|
|
1018
|
+
dots = -1;
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
return res;
|
|
1022
|
+
}
|
|
765
1023
|
|
|
766
1024
|
// ../core/src/javascript-utils/is-type.ts
|
|
767
1025
|
var isBoolean = (x) => typeof x === "boolean";
|
|
@@ -795,40 +1053,55 @@
|
|
|
795
1053
|
return "";
|
|
796
1054
|
}
|
|
797
1055
|
|
|
798
|
-
// ../core/src/lib/utils/
|
|
1056
|
+
// ../core/src/lib/utils/url-utils.ts
|
|
799
1057
|
var QUERY_STRING_PATTERN = /\?.*/;
|
|
800
|
-
function
|
|
1058
|
+
function extractQueryString(url) {
|
|
1059
|
+
const matches3 = url.match(QUERY_STRING_PATTERN);
|
|
1060
|
+
return matches3 && matches3[0];
|
|
1061
|
+
}
|
|
1062
|
+
function stripQueryString(url) {
|
|
1063
|
+
return url.replace(QUERY_STRING_PATTERN, "");
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
// ../core/src/lib/utils/resource-utils.ts
|
|
1067
|
+
function getResourceUrl(resource) {
|
|
801
1068
|
if (isResponse(resource)) {
|
|
802
|
-
const
|
|
803
|
-
|
|
804
|
-
return {
|
|
805
|
-
url,
|
|
806
|
-
type: parseMIMEType(contentTypeHeader) || parseMIMETypeFromURL(url)
|
|
807
|
-
};
|
|
1069
|
+
const response = resource;
|
|
1070
|
+
return response.url;
|
|
808
1071
|
}
|
|
809
1072
|
if (isBlob(resource)) {
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
type: resource.type || ""
|
|
813
|
-
};
|
|
1073
|
+
const blob = resource;
|
|
1074
|
+
return blob.name || "";
|
|
814
1075
|
}
|
|
815
1076
|
if (typeof resource === "string") {
|
|
816
|
-
return
|
|
817
|
-
url: stripQueryString(resource),
|
|
818
|
-
type: parseMIMETypeFromURL(resource)
|
|
819
|
-
};
|
|
1077
|
+
return resource;
|
|
820
1078
|
}
|
|
821
|
-
return
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
1079
|
+
return "";
|
|
1080
|
+
}
|
|
1081
|
+
function getResourceMIMEType(resource) {
|
|
1082
|
+
if (isResponse(resource)) {
|
|
1083
|
+
const response = resource;
|
|
1084
|
+
const contentTypeHeader = response.headers.get("content-type") || "";
|
|
1085
|
+
const noQueryUrl = stripQueryString(response.url);
|
|
1086
|
+
return parseMIMEType(contentTypeHeader) || parseMIMETypeFromURL(noQueryUrl);
|
|
1087
|
+
}
|
|
1088
|
+
if (isBlob(resource)) {
|
|
1089
|
+
const blob = resource;
|
|
1090
|
+
return blob.type || "";
|
|
1091
|
+
}
|
|
1092
|
+
if (typeof resource === "string") {
|
|
1093
|
+
return parseMIMETypeFromURL(resource);
|
|
1094
|
+
}
|
|
1095
|
+
return "";
|
|
825
1096
|
}
|
|
826
1097
|
function getResourceContentLength(resource) {
|
|
827
1098
|
if (isResponse(resource)) {
|
|
828
|
-
|
|
1099
|
+
const response = resource;
|
|
1100
|
+
return response.headers["content-length"] || -1;
|
|
829
1101
|
}
|
|
830
1102
|
if (isBlob(resource)) {
|
|
831
|
-
|
|
1103
|
+
const blob = resource;
|
|
1104
|
+
return blob.size;
|
|
832
1105
|
}
|
|
833
1106
|
if (typeof resource === "string") {
|
|
834
1107
|
return resource.length;
|
|
@@ -841,9 +1114,6 @@
|
|
|
841
1114
|
}
|
|
842
1115
|
return -1;
|
|
843
1116
|
}
|
|
844
|
-
function stripQueryString(url) {
|
|
845
|
-
return url.replace(QUERY_STRING_PATTERN, "");
|
|
846
|
-
}
|
|
847
1117
|
|
|
848
1118
|
// ../core/src/lib/utils/response-utils.ts
|
|
849
1119
|
async function makeResponse(resource) {
|
|
@@ -855,7 +1125,8 @@
|
|
|
855
1125
|
if (contentLength >= 0) {
|
|
856
1126
|
headers["content-length"] = String(contentLength);
|
|
857
1127
|
}
|
|
858
|
-
const
|
|
1128
|
+
const url = getResourceUrl(resource);
|
|
1129
|
+
const type = getResourceMIMEType(resource);
|
|
859
1130
|
if (type) {
|
|
860
1131
|
headers["content-type"] = type;
|
|
861
1132
|
}
|
|
@@ -885,7 +1156,7 @@
|
|
|
885
1156
|
text += ` ${await response.text()}`;
|
|
886
1157
|
}
|
|
887
1158
|
message += text;
|
|
888
|
-
message = message.length > 60 ? `${message.slice(60)}...` : message;
|
|
1159
|
+
message = message.length > 60 ? `${message.slice(0, 60)}...` : message;
|
|
889
1160
|
} catch (error) {
|
|
890
1161
|
}
|
|
891
1162
|
return message;
|
|
@@ -897,9 +1168,9 @@
|
|
|
897
1168
|
}
|
|
898
1169
|
if (resource instanceof Blob) {
|
|
899
1170
|
const blobSlice = resource.slice(0, 5);
|
|
900
|
-
return await new Promise((
|
|
1171
|
+
return await new Promise((resolve2) => {
|
|
901
1172
|
const reader = new FileReader();
|
|
902
|
-
reader.onload = (event) =>
|
|
1173
|
+
reader.onload = (event) => resolve2(event?.target?.result);
|
|
903
1174
|
reader.readAsDataURL(blobSlice);
|
|
904
1175
|
});
|
|
905
1176
|
}
|
|
@@ -932,12 +1203,12 @@
|
|
|
932
1203
|
return await makeResponse(url);
|
|
933
1204
|
}
|
|
934
1205
|
|
|
935
|
-
// ../../node_modules/probe.gl/dist/
|
|
1206
|
+
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/is-electron.js
|
|
936
1207
|
function isElectron(mockUserAgent) {
|
|
937
1208
|
if (typeof window !== "undefined" && typeof window.process === "object" && window.process.type === "renderer") {
|
|
938
1209
|
return true;
|
|
939
1210
|
}
|
|
940
|
-
if (typeof process !== "undefined" && typeof process.versions === "object" && Boolean(process.versions
|
|
1211
|
+
if (typeof process !== "undefined" && typeof process.versions === "object" && Boolean(process.versions["electron"])) {
|
|
941
1212
|
return true;
|
|
942
1213
|
}
|
|
943
1214
|
const realUserAgent = typeof navigator === "object" && typeof navigator.userAgent === "string" && navigator.userAgent;
|
|
@@ -948,31 +1219,25 @@
|
|
|
948
1219
|
return false;
|
|
949
1220
|
}
|
|
950
1221
|
|
|
951
|
-
// ../../node_modules/probe.gl/dist/
|
|
1222
|
+
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/is-browser.js
|
|
952
1223
|
function isBrowser3() {
|
|
953
1224
|
const isNode = typeof process === "object" && String(process) === "[object process]" && !process.browser;
|
|
954
1225
|
return !isNode || isElectron();
|
|
955
1226
|
}
|
|
956
1227
|
|
|
957
|
-
// ../../node_modules/probe.gl/dist/
|
|
958
|
-
var
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
var
|
|
967
|
-
var global_3 = globals3.global || globals3.self || globals3.window;
|
|
968
|
-
var document_3 = globals3.document || {};
|
|
969
|
-
var process_ = globals3.process || {};
|
|
970
|
-
|
|
971
|
-
// ../../node_modules/probe.gl/dist/esm/utils/globals.js
|
|
972
|
-
var VERSION3 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "untranspiled source";
|
|
1228
|
+
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/globals.js
|
|
1229
|
+
var self_3 = globalThis.self || globalThis.window || globalThis.global;
|
|
1230
|
+
var window_3 = globalThis.window || globalThis.self || globalThis.global;
|
|
1231
|
+
var document_3 = globalThis.document || {};
|
|
1232
|
+
var process_ = globalThis.process || {};
|
|
1233
|
+
var console_ = globalThis.console;
|
|
1234
|
+
var navigator_ = globalThis.navigator || {};
|
|
1235
|
+
|
|
1236
|
+
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/utils/globals.js
|
|
1237
|
+
var VERSION3 = true ? "4.0.0-alpha.11" : "untranspiled source";
|
|
973
1238
|
var isBrowser4 = isBrowser3();
|
|
974
1239
|
|
|
975
|
-
// ../../node_modules
|
|
1240
|
+
// ../../node_modules/@probe.gl/log/dist/utils/local-storage.js
|
|
976
1241
|
function getStorage(type) {
|
|
977
1242
|
try {
|
|
978
1243
|
const storage = window[type];
|
|
@@ -985,27 +1250,25 @@
|
|
|
985
1250
|
}
|
|
986
1251
|
}
|
|
987
1252
|
var LocalStorage = class {
|
|
988
|
-
constructor(id,
|
|
1253
|
+
constructor(id, defaultConfig) {
|
|
1254
|
+
let type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "sessionStorage";
|
|
1255
|
+
_defineProperty(this, "storage", void 0);
|
|
1256
|
+
_defineProperty(this, "id", void 0);
|
|
1257
|
+
_defineProperty(this, "config", void 0);
|
|
989
1258
|
this.storage = getStorage(type);
|
|
990
1259
|
this.id = id;
|
|
991
|
-
this.config =
|
|
992
|
-
Object.assign(this.config, defaultSettings);
|
|
1260
|
+
this.config = defaultConfig;
|
|
993
1261
|
this._loadConfiguration();
|
|
994
1262
|
}
|
|
995
1263
|
getConfiguration() {
|
|
996
1264
|
return this.config;
|
|
997
1265
|
}
|
|
998
1266
|
setConfiguration(configuration) {
|
|
999
|
-
this.config = {};
|
|
1000
|
-
return this.updateConfiguration(configuration);
|
|
1001
|
-
}
|
|
1002
|
-
updateConfiguration(configuration) {
|
|
1003
1267
|
Object.assign(this.config, configuration);
|
|
1004
1268
|
if (this.storage) {
|
|
1005
1269
|
const serialized = JSON.stringify(this.config);
|
|
1006
1270
|
this.storage.setItem(this.id, serialized);
|
|
1007
1271
|
}
|
|
1008
|
-
return this;
|
|
1009
1272
|
}
|
|
1010
1273
|
_loadConfiguration() {
|
|
1011
1274
|
let configuration = {};
|
|
@@ -1018,7 +1281,7 @@
|
|
|
1018
1281
|
}
|
|
1019
1282
|
};
|
|
1020
1283
|
|
|
1021
|
-
// ../../node_modules
|
|
1284
|
+
// ../../node_modules/@probe.gl/log/dist/utils/formatters.js
|
|
1022
1285
|
function formatTime(ms) {
|
|
1023
1286
|
let formatted;
|
|
1024
1287
|
if (ms < 10) {
|
|
@@ -1032,11 +1295,13 @@
|
|
|
1032
1295
|
}
|
|
1033
1296
|
return formatted;
|
|
1034
1297
|
}
|
|
1035
|
-
function leftPad(string
|
|
1036
|
-
|
|
1298
|
+
function leftPad(string) {
|
|
1299
|
+
let length2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 8;
|
|
1300
|
+
const padLength = Math.max(length2 - string.length, 0);
|
|
1037
1301
|
return "".concat(" ".repeat(padLength)).concat(string);
|
|
1038
1302
|
}
|
|
1039
|
-
function formatImage(image, message, scale2
|
|
1303
|
+
function formatImage(image, message, scale2) {
|
|
1304
|
+
let maxWidth = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 600;
|
|
1040
1305
|
const imageUrl = image.src.replace(/\(/g, "%28").replace(/\)/g, "%29");
|
|
1041
1306
|
if (image.width > maxWidth) {
|
|
1042
1307
|
scale2 = Math.min(scale2, maxWidth / image.width);
|
|
@@ -1047,69 +1312,80 @@
|
|
|
1047
1312
|
return ["".concat(message, " %c+"), style];
|
|
1048
1313
|
}
|
|
1049
1314
|
|
|
1050
|
-
// ../../node_modules
|
|
1051
|
-
var COLOR
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1315
|
+
// ../../node_modules/@probe.gl/log/dist/utils/color.js
|
|
1316
|
+
var COLOR;
|
|
1317
|
+
(function(COLOR2) {
|
|
1318
|
+
COLOR2[COLOR2["BLACK"] = 30] = "BLACK";
|
|
1319
|
+
COLOR2[COLOR2["RED"] = 31] = "RED";
|
|
1320
|
+
COLOR2[COLOR2["GREEN"] = 32] = "GREEN";
|
|
1321
|
+
COLOR2[COLOR2["YELLOW"] = 33] = "YELLOW";
|
|
1322
|
+
COLOR2[COLOR2["BLUE"] = 34] = "BLUE";
|
|
1323
|
+
COLOR2[COLOR2["MAGENTA"] = 35] = "MAGENTA";
|
|
1324
|
+
COLOR2[COLOR2["CYAN"] = 36] = "CYAN";
|
|
1325
|
+
COLOR2[COLOR2["WHITE"] = 37] = "WHITE";
|
|
1326
|
+
COLOR2[COLOR2["BRIGHT_BLACK"] = 90] = "BRIGHT_BLACK";
|
|
1327
|
+
COLOR2[COLOR2["BRIGHT_RED"] = 91] = "BRIGHT_RED";
|
|
1328
|
+
COLOR2[COLOR2["BRIGHT_GREEN"] = 92] = "BRIGHT_GREEN";
|
|
1329
|
+
COLOR2[COLOR2["BRIGHT_YELLOW"] = 93] = "BRIGHT_YELLOW";
|
|
1330
|
+
COLOR2[COLOR2["BRIGHT_BLUE"] = 94] = "BRIGHT_BLUE";
|
|
1331
|
+
COLOR2[COLOR2["BRIGHT_MAGENTA"] = 95] = "BRIGHT_MAGENTA";
|
|
1332
|
+
COLOR2[COLOR2["BRIGHT_CYAN"] = 96] = "BRIGHT_CYAN";
|
|
1333
|
+
COLOR2[COLOR2["BRIGHT_WHITE"] = 97] = "BRIGHT_WHITE";
|
|
1334
|
+
})(COLOR || (COLOR = {}));
|
|
1335
|
+
var BACKGROUND_INCREMENT = 10;
|
|
1069
1336
|
function getColor(color) {
|
|
1070
|
-
|
|
1337
|
+
if (typeof color !== "string") {
|
|
1338
|
+
return color;
|
|
1339
|
+
}
|
|
1340
|
+
color = color.toUpperCase();
|
|
1341
|
+
return COLOR[color] || COLOR.WHITE;
|
|
1071
1342
|
}
|
|
1072
1343
|
function addColor(string, color, background) {
|
|
1073
|
-
if (!
|
|
1344
|
+
if (!isBrowser3 && typeof string === "string") {
|
|
1074
1345
|
if (color) {
|
|
1075
|
-
|
|
1076
|
-
string = "[".concat(
|
|
1346
|
+
const colorCode = getColor(color);
|
|
1347
|
+
string = "[".concat(colorCode, "m").concat(string, "[39m");
|
|
1077
1348
|
}
|
|
1078
1349
|
if (background) {
|
|
1079
|
-
|
|
1080
|
-
string = "[".concat(
|
|
1350
|
+
const colorCode = getColor(background);
|
|
1351
|
+
string = "[".concat(colorCode + BACKGROUND_INCREMENT, "m").concat(string, "[49m");
|
|
1081
1352
|
}
|
|
1082
1353
|
}
|
|
1083
1354
|
return string;
|
|
1084
1355
|
}
|
|
1085
1356
|
|
|
1086
|
-
// ../../node_modules
|
|
1087
|
-
function autobind(obj
|
|
1357
|
+
// ../../node_modules/@probe.gl/log/dist/utils/autobind.js
|
|
1358
|
+
function autobind(obj) {
|
|
1359
|
+
let predefined = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ["constructor"];
|
|
1088
1360
|
const proto = Object.getPrototypeOf(obj);
|
|
1089
1361
|
const propNames = Object.getOwnPropertyNames(proto);
|
|
1362
|
+
const object = obj;
|
|
1090
1363
|
for (const key of propNames) {
|
|
1091
|
-
|
|
1364
|
+
const value = object[key];
|
|
1365
|
+
if (typeof value === "function") {
|
|
1092
1366
|
if (!predefined.find((name) => key === name)) {
|
|
1093
|
-
|
|
1367
|
+
object[key] = value.bind(obj);
|
|
1094
1368
|
}
|
|
1095
1369
|
}
|
|
1096
1370
|
}
|
|
1097
1371
|
}
|
|
1098
1372
|
|
|
1099
|
-
// ../../node_modules
|
|
1373
|
+
// ../../node_modules/@probe.gl/log/dist/utils/assert.js
|
|
1100
1374
|
function assert3(condition, message) {
|
|
1101
1375
|
if (!condition) {
|
|
1102
1376
|
throw new Error(message || "Assertion failed");
|
|
1103
1377
|
}
|
|
1104
1378
|
}
|
|
1105
1379
|
|
|
1106
|
-
// ../../node_modules
|
|
1107
|
-
function
|
|
1380
|
+
// ../../node_modules/@probe.gl/log/dist/utils/hi-res-timestamp.js
|
|
1381
|
+
function getHiResTimestamp() {
|
|
1108
1382
|
let timestamp;
|
|
1109
|
-
if (
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1383
|
+
if (isBrowser3() && window_3.performance) {
|
|
1384
|
+
var _window$performance, _window$performance$n;
|
|
1385
|
+
timestamp = window_3 === null || window_3 === void 0 ? void 0 : (_window$performance = window_3.performance) === null || _window$performance === void 0 ? void 0 : (_window$performance$n = _window$performance.now) === null || _window$performance$n === void 0 ? void 0 : _window$performance$n.call(_window$performance);
|
|
1386
|
+
} else if ("hrtime" in process_) {
|
|
1387
|
+
var _process$hrtime;
|
|
1388
|
+
const timeParts = process_ === null || process_ === void 0 ? void 0 : (_process$hrtime = process_.hrtime) === null || _process$hrtime === void 0 ? void 0 : _process$hrtime.call(process_);
|
|
1113
1389
|
timestamp = timeParts[0] * 1e3 + timeParts[1] / 1e6;
|
|
1114
1390
|
} else {
|
|
1115
1391
|
timestamp = Date.now();
|
|
@@ -1117,15 +1393,15 @@
|
|
|
1117
1393
|
return timestamp;
|
|
1118
1394
|
}
|
|
1119
1395
|
|
|
1120
|
-
// ../../node_modules
|
|
1396
|
+
// ../../node_modules/@probe.gl/log/dist/log.js
|
|
1121
1397
|
var originalConsole = {
|
|
1122
|
-
debug:
|
|
1398
|
+
debug: isBrowser3() ? console.debug || console.log : console.log,
|
|
1123
1399
|
log: console.log,
|
|
1124
1400
|
info: console.info,
|
|
1125
1401
|
warn: console.warn,
|
|
1126
1402
|
error: console.error
|
|
1127
1403
|
};
|
|
1128
|
-
var
|
|
1404
|
+
var DEFAULT_LOG_CONFIGURATION = {
|
|
1129
1405
|
enabled: true,
|
|
1130
1406
|
level: 0
|
|
1131
1407
|
};
|
|
@@ -1135,27 +1411,23 @@
|
|
|
1135
1411
|
var ONCE = {
|
|
1136
1412
|
once: true
|
|
1137
1413
|
};
|
|
1138
|
-
function getTableHeader(table) {
|
|
1139
|
-
for (const key in table) {
|
|
1140
|
-
for (const title in table[key]) {
|
|
1141
|
-
return title || "untitled";
|
|
1142
|
-
}
|
|
1143
|
-
}
|
|
1144
|
-
return "empty";
|
|
1145
|
-
}
|
|
1146
1414
|
var Log = class {
|
|
1147
|
-
constructor({
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1415
|
+
constructor() {
|
|
1416
|
+
let {
|
|
1417
|
+
id
|
|
1418
|
+
} = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
|
|
1419
|
+
id: ""
|
|
1420
|
+
};
|
|
1421
|
+
_defineProperty(this, "id", void 0);
|
|
1422
|
+
_defineProperty(this, "VERSION", VERSION3);
|
|
1423
|
+
_defineProperty(this, "_startTs", getHiResTimestamp());
|
|
1424
|
+
_defineProperty(this, "_deltaTs", getHiResTimestamp());
|
|
1425
|
+
_defineProperty(this, "_storage", void 0);
|
|
1426
|
+
_defineProperty(this, "userData", {});
|
|
1427
|
+
_defineProperty(this, "LOG_THROTTLE_TIMEOUT", 0);
|
|
1152
1428
|
this.id = id;
|
|
1153
|
-
this.VERSION = VERSION3;
|
|
1154
|
-
this._startTs = getHiResTimestamp2();
|
|
1155
|
-
this._deltaTs = getHiResTimestamp2();
|
|
1156
|
-
this.LOG_THROTTLE_TIMEOUT = 0;
|
|
1157
|
-
this._storage = new LocalStorage("__probe-".concat(this.id, "__"), DEFAULT_SETTINGS);
|
|
1158
1429
|
this.userData = {};
|
|
1430
|
+
this._storage = new LocalStorage("__probe-".concat(this.id, "__"), DEFAULT_LOG_CONFIGURATION);
|
|
1159
1431
|
this.timeStamp("".concat(this.id, " started"));
|
|
1160
1432
|
autobind(this);
|
|
1161
1433
|
Object.seal(this);
|
|
@@ -1173,10 +1445,10 @@
|
|
|
1173
1445
|
return this._storage.config.level;
|
|
1174
1446
|
}
|
|
1175
1447
|
getTotal() {
|
|
1176
|
-
return Number((
|
|
1448
|
+
return Number((getHiResTimestamp() - this._startTs).toPrecision(10));
|
|
1177
1449
|
}
|
|
1178
1450
|
getDelta() {
|
|
1179
|
-
return Number((
|
|
1451
|
+
return Number((getHiResTimestamp() - this._deltaTs).toPrecision(10));
|
|
1180
1452
|
}
|
|
1181
1453
|
set priority(newPriority) {
|
|
1182
1454
|
this.level = newPriority;
|
|
@@ -1187,18 +1459,34 @@
|
|
|
1187
1459
|
getPriority() {
|
|
1188
1460
|
return this.level;
|
|
1189
1461
|
}
|
|
1190
|
-
enable(
|
|
1191
|
-
|
|
1462
|
+
enable() {
|
|
1463
|
+
let enabled = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
1464
|
+
this._storage.setConfiguration({
|
|
1192
1465
|
enabled
|
|
1193
1466
|
});
|
|
1194
1467
|
return this;
|
|
1195
1468
|
}
|
|
1196
1469
|
setLevel(level) {
|
|
1197
|
-
this._storage.
|
|
1470
|
+
this._storage.setConfiguration({
|
|
1198
1471
|
level
|
|
1199
1472
|
});
|
|
1200
1473
|
return this;
|
|
1201
1474
|
}
|
|
1475
|
+
get(setting) {
|
|
1476
|
+
return this._storage.config[setting];
|
|
1477
|
+
}
|
|
1478
|
+
set(setting, value) {
|
|
1479
|
+
this._storage.setConfiguration({
|
|
1480
|
+
[setting]: value
|
|
1481
|
+
});
|
|
1482
|
+
}
|
|
1483
|
+
settings() {
|
|
1484
|
+
if (console.table) {
|
|
1485
|
+
console.table(this._storage.config);
|
|
1486
|
+
} else {
|
|
1487
|
+
console.log(this._storage.config);
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1202
1490
|
assert(condition, message) {
|
|
1203
1491
|
assert3(condition, message);
|
|
1204
1492
|
}
|
|
@@ -1237,17 +1525,18 @@
|
|
|
1237
1525
|
}
|
|
1238
1526
|
return noop;
|
|
1239
1527
|
}
|
|
1240
|
-
image({
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1528
|
+
image(_ref) {
|
|
1529
|
+
let {
|
|
1530
|
+
logLevel,
|
|
1531
|
+
priority,
|
|
1532
|
+
image,
|
|
1533
|
+
message = "",
|
|
1534
|
+
scale: scale2 = 1
|
|
1535
|
+
} = _ref;
|
|
1247
1536
|
if (!this._shouldLog(logLevel || priority)) {
|
|
1248
1537
|
return noop;
|
|
1249
1538
|
}
|
|
1250
|
-
return
|
|
1539
|
+
return isBrowser3() ? logImageInBrowser({
|
|
1251
1540
|
image,
|
|
1252
1541
|
message,
|
|
1253
1542
|
scale: scale2
|
|
@@ -1257,21 +1546,6 @@
|
|
|
1257
1546
|
scale: scale2
|
|
1258
1547
|
});
|
|
1259
1548
|
}
|
|
1260
|
-
settings() {
|
|
1261
|
-
if (console.table) {
|
|
1262
|
-
console.table(this._storage.config);
|
|
1263
|
-
} else {
|
|
1264
|
-
console.log(this._storage.config);
|
|
1265
|
-
}
|
|
1266
|
-
}
|
|
1267
|
-
get(setting) {
|
|
1268
|
-
return this._storage.config[setting];
|
|
1269
|
-
}
|
|
1270
|
-
set(setting, value) {
|
|
1271
|
-
this._storage.updateConfiguration({
|
|
1272
|
-
[setting]: value
|
|
1273
|
-
});
|
|
1274
|
-
}
|
|
1275
1549
|
time(logLevel, message) {
|
|
1276
1550
|
return this._getLogFunction(logLevel, message, console.time ? console.time : console.info);
|
|
1277
1551
|
}
|
|
@@ -1281,10 +1555,11 @@
|
|
|
1281
1555
|
timeStamp(logLevel, message) {
|
|
1282
1556
|
return this._getLogFunction(logLevel, message, console.timeStamp || noop);
|
|
1283
1557
|
}
|
|
1284
|
-
group(logLevel, message
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1558
|
+
group(logLevel, message) {
|
|
1559
|
+
let opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
|
|
1560
|
+
collapsed: false
|
|
1561
|
+
};
|
|
1562
|
+
const options = normalizeArguments({
|
|
1288
1563
|
logLevel,
|
|
1289
1564
|
message,
|
|
1290
1565
|
opts
|
|
@@ -1292,10 +1567,11 @@
|
|
|
1292
1567
|
const {
|
|
1293
1568
|
collapsed
|
|
1294
1569
|
} = opts;
|
|
1295
|
-
|
|
1296
|
-
return this._getLogFunction(
|
|
1570
|
+
options.method = (collapsed ? console.groupCollapsed : console.group) || console.info;
|
|
1571
|
+
return this._getLogFunction(options);
|
|
1297
1572
|
}
|
|
1298
|
-
groupCollapsed(logLevel, message
|
|
1573
|
+
groupCollapsed(logLevel, message) {
|
|
1574
|
+
let opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
1299
1575
|
return this.group(logLevel, message, Object.assign({}, opts, {
|
|
1300
1576
|
collapsed: true
|
|
1301
1577
|
}));
|
|
@@ -1319,7 +1595,7 @@
|
|
|
1319
1595
|
_shouldLog(logLevel) {
|
|
1320
1596
|
return this.isEnabled() && this.getLevel() >= normalizeLogLevel(logLevel);
|
|
1321
1597
|
}
|
|
1322
|
-
_getLogFunction(logLevel, message, method, args
|
|
1598
|
+
_getLogFunction(logLevel, message, method, args, opts) {
|
|
1323
1599
|
if (this._shouldLog(logLevel)) {
|
|
1324
1600
|
opts = normalizeArguments({
|
|
1325
1601
|
logLevel,
|
|
@@ -1331,11 +1607,11 @@
|
|
|
1331
1607
|
assert3(method);
|
|
1332
1608
|
opts.total = this.getTotal();
|
|
1333
1609
|
opts.delta = this.getDelta();
|
|
1334
|
-
this._deltaTs =
|
|
1610
|
+
this._deltaTs = getHiResTimestamp();
|
|
1335
1611
|
const tag = opts.tag || opts.message;
|
|
1336
|
-
if (opts.once) {
|
|
1612
|
+
if (opts.once && tag) {
|
|
1337
1613
|
if (!cache[tag]) {
|
|
1338
|
-
cache[tag] =
|
|
1614
|
+
cache[tag] = getHiResTimestamp();
|
|
1339
1615
|
} else {
|
|
1340
1616
|
return noop;
|
|
1341
1617
|
}
|
|
@@ -1346,7 +1622,7 @@
|
|
|
1346
1622
|
return noop;
|
|
1347
1623
|
}
|
|
1348
1624
|
};
|
|
1349
|
-
Log
|
|
1625
|
+
_defineProperty(Log, "VERSION", VERSION3);
|
|
1350
1626
|
function normalizeLogLevel(logLevel) {
|
|
1351
1627
|
if (!logLevel) {
|
|
1352
1628
|
return 0;
|
|
@@ -1374,7 +1650,6 @@
|
|
|
1374
1650
|
const args = opts.args ? Array.from(opts.args) : [];
|
|
1375
1651
|
while (args.length && args.shift() !== message) {
|
|
1376
1652
|
}
|
|
1377
|
-
opts.args = args;
|
|
1378
1653
|
switch (typeof logLevel) {
|
|
1379
1654
|
case "string":
|
|
1380
1655
|
case "function":
|
|
@@ -1393,7 +1668,9 @@
|
|
|
1393
1668
|
}
|
|
1394
1669
|
const messageType = typeof opts.message;
|
|
1395
1670
|
assert3(messageType === "string" || messageType === "object");
|
|
1396
|
-
return Object.assign(opts,
|
|
1671
|
+
return Object.assign(opts, {
|
|
1672
|
+
args
|
|
1673
|
+
}, opts.opts);
|
|
1397
1674
|
}
|
|
1398
1675
|
function decorateMessage(id, message, opts) {
|
|
1399
1676
|
if (typeof message === "string") {
|
|
@@ -1403,29 +1680,21 @@
|
|
|
1403
1680
|
}
|
|
1404
1681
|
return message;
|
|
1405
1682
|
}
|
|
1406
|
-
function logImageInNode({
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
asciify = module.require("asciify-image");
|
|
1414
|
-
} catch (error) {
|
|
1415
|
-
}
|
|
1416
|
-
if (asciify) {
|
|
1417
|
-
return () => asciify(image, {
|
|
1418
|
-
fit: "box",
|
|
1419
|
-
width: "".concat(Math.round(80 * scale2), "%")
|
|
1420
|
-
}).then((data) => console.log(data));
|
|
1421
|
-
}
|
|
1683
|
+
function logImageInNode(_ref2) {
|
|
1684
|
+
let {
|
|
1685
|
+
image,
|
|
1686
|
+
message = "",
|
|
1687
|
+
scale: scale2 = 1
|
|
1688
|
+
} = _ref2;
|
|
1689
|
+
console.warn("removed");
|
|
1422
1690
|
return noop;
|
|
1423
1691
|
}
|
|
1424
|
-
function logImageInBrowser({
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1692
|
+
function logImageInBrowser(_ref3) {
|
|
1693
|
+
let {
|
|
1694
|
+
image,
|
|
1695
|
+
message = "",
|
|
1696
|
+
scale: scale2 = 1
|
|
1697
|
+
} = _ref3;
|
|
1429
1698
|
if (typeof image === "string") {
|
|
1430
1699
|
const img = new Image();
|
|
1431
1700
|
img.onload = () => {
|
|
@@ -1448,10 +1717,18 @@
|
|
|
1448
1717
|
}
|
|
1449
1718
|
return noop;
|
|
1450
1719
|
}
|
|
1720
|
+
function getTableHeader(table) {
|
|
1721
|
+
for (const key in table) {
|
|
1722
|
+
for (const title in table[key]) {
|
|
1723
|
+
return title || "untitled";
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
return "empty";
|
|
1727
|
+
}
|
|
1451
1728
|
|
|
1452
|
-
// ../../node_modules
|
|
1453
|
-
var
|
|
1454
|
-
id: "probe.gl"
|
|
1729
|
+
// ../../node_modules/@probe.gl/log/dist/index.js
|
|
1730
|
+
var dist_default = new Log({
|
|
1731
|
+
id: "@probe.gl/log"
|
|
1455
1732
|
});
|
|
1456
1733
|
|
|
1457
1734
|
// ../core/src/lib/loader-utils/loggers.ts
|
|
@@ -1502,7 +1779,8 @@
|
|
|
1502
1779
|
worker: true,
|
|
1503
1780
|
maxConcurrency: 3,
|
|
1504
1781
|
maxMobileConcurrency: 1,
|
|
1505
|
-
reuseWorkers:
|
|
1782
|
+
reuseWorkers: isBrowser,
|
|
1783
|
+
_nodeWorkers: false,
|
|
1506
1784
|
_workerType: "",
|
|
1507
1785
|
limit: 0,
|
|
1508
1786
|
_limitMB: 0,
|
|
@@ -1547,20 +1825,6 @@
|
|
|
1547
1825
|
validateOptions(options, loaders);
|
|
1548
1826
|
return normalizeOptionsInternal(loader, options, url);
|
|
1549
1827
|
}
|
|
1550
|
-
function getFetchFunction(options, context) {
|
|
1551
|
-
const globalOptions = getGlobalLoaderOptions();
|
|
1552
|
-
const fetchOptions = options || globalOptions;
|
|
1553
|
-
if (typeof fetchOptions.fetch === "function") {
|
|
1554
|
-
return fetchOptions.fetch;
|
|
1555
|
-
}
|
|
1556
|
-
if (isObject(fetchOptions.fetch)) {
|
|
1557
|
-
return (url) => fetchFile(url, fetchOptions);
|
|
1558
|
-
}
|
|
1559
|
-
if (context?.fetch) {
|
|
1560
|
-
return context?.fetch;
|
|
1561
|
-
}
|
|
1562
|
-
return fetchFile;
|
|
1563
|
-
}
|
|
1564
1828
|
function validateOptions(options, loaders) {
|
|
1565
1829
|
validateOptionsObject(options, null, DEFAULT_LOADER_OPTIONS, REMOVED_LOADER_OPTIONS, loaders);
|
|
1566
1830
|
for (const loader of loaders) {
|
|
@@ -1678,6 +1942,9 @@
|
|
|
1678
1942
|
return getGlobalLoaderRegistry();
|
|
1679
1943
|
}
|
|
1680
1944
|
|
|
1945
|
+
// ../core/src/lib/utils/log.ts
|
|
1946
|
+
var log = new Log({ id: "loaders.gl" });
|
|
1947
|
+
|
|
1681
1948
|
// ../core/src/lib/api/select-loader.ts
|
|
1682
1949
|
var EXT_PATTERN = /\.([^.]+)$/;
|
|
1683
1950
|
async function selectLoader(data, loaders = [], options, context) {
|
|
@@ -1719,16 +1986,26 @@
|
|
|
1719
1986
|
return loader;
|
|
1720
1987
|
}
|
|
1721
1988
|
function selectLoaderInternal(data, loaders, options, context) {
|
|
1722
|
-
const
|
|
1723
|
-
const
|
|
1989
|
+
const url = getResourceUrl(data);
|
|
1990
|
+
const type = getResourceMIMEType(data);
|
|
1991
|
+
const testUrl = stripQueryString(url) || context?.url;
|
|
1724
1992
|
let loader = null;
|
|
1993
|
+
let reason = "";
|
|
1725
1994
|
if (options?.mimeType) {
|
|
1726
1995
|
loader = findLoaderByMIMEType(loaders, options?.mimeType);
|
|
1996
|
+
reason = `match forced by supplied MIME type ${options?.mimeType}`;
|
|
1727
1997
|
}
|
|
1728
1998
|
loader = loader || findLoaderByUrl(loaders, testUrl);
|
|
1999
|
+
reason = reason || (loader ? `matched url ${testUrl}` : "");
|
|
1729
2000
|
loader = loader || findLoaderByMIMEType(loaders, type);
|
|
2001
|
+
reason = reason || (loader ? `matched MIME type ${type}` : "");
|
|
1730
2002
|
loader = loader || findLoaderByInitialBytes(loaders, data);
|
|
2003
|
+
reason = reason || (loader ? `matched initial data ${getFirstCharacters(data)}` : "");
|
|
1731
2004
|
loader = loader || findLoaderByMIMEType(loaders, options?.fallbackMimeType);
|
|
2005
|
+
reason = reason || (loader ? `matched fallback MIME type ${type}` : "");
|
|
2006
|
+
if (reason) {
|
|
2007
|
+
log.log(1, `selectLoader selected ${loader?.name}: ${reason}.`);
|
|
2008
|
+
}
|
|
1732
2009
|
return loader;
|
|
1733
2010
|
}
|
|
1734
2011
|
function validHTTPResponse(data) {
|
|
@@ -1740,7 +2017,8 @@
|
|
|
1740
2017
|
return true;
|
|
1741
2018
|
}
|
|
1742
2019
|
function getNoValidLoaderMessage(data) {
|
|
1743
|
-
const
|
|
2020
|
+
const url = getResourceUrl(data);
|
|
2021
|
+
const type = getResourceMIMEType(data);
|
|
1744
2022
|
let message = "No valid loader found (";
|
|
1745
2023
|
message += url ? `${path_exports.filename(url)}, ` : "no url provided, ";
|
|
1746
2024
|
message += `MIME type: ${type ? `"${type}"` : "not provided"}, `;
|
|
@@ -1828,24 +2106,24 @@
|
|
|
1828
2106
|
return false;
|
|
1829
2107
|
}
|
|
1830
2108
|
}
|
|
1831
|
-
function getFirstCharacters(data,
|
|
2109
|
+
function getFirstCharacters(data, length2 = 5) {
|
|
1832
2110
|
if (typeof data === "string") {
|
|
1833
|
-
return data.slice(0,
|
|
2111
|
+
return data.slice(0, length2);
|
|
1834
2112
|
} else if (ArrayBuffer.isView(data)) {
|
|
1835
|
-
return getMagicString(data.buffer, data.byteOffset,
|
|
2113
|
+
return getMagicString(data.buffer, data.byteOffset, length2);
|
|
1836
2114
|
} else if (data instanceof ArrayBuffer) {
|
|
1837
2115
|
const byteOffset = 0;
|
|
1838
|
-
return getMagicString(data, byteOffset,
|
|
2116
|
+
return getMagicString(data, byteOffset, length2);
|
|
1839
2117
|
}
|
|
1840
2118
|
return "";
|
|
1841
2119
|
}
|
|
1842
|
-
function getMagicString(arrayBuffer, byteOffset,
|
|
1843
|
-
if (arrayBuffer.byteLength < byteOffset +
|
|
2120
|
+
function getMagicString(arrayBuffer, byteOffset, length2) {
|
|
2121
|
+
if (arrayBuffer.byteLength < byteOffset + length2) {
|
|
1844
2122
|
return "";
|
|
1845
2123
|
}
|
|
1846
2124
|
const dataView = new DataView(arrayBuffer);
|
|
1847
2125
|
let magic = "";
|
|
1848
|
-
for (let i2 = 0; i2 <
|
|
2126
|
+
for (let i2 = 0; i2 < length2; i2++) {
|
|
1849
2127
|
magic += String.fromCharCode(dataView.getUint8(byteOffset + i2));
|
|
1850
2128
|
}
|
|
1851
2129
|
return magic;
|
|
@@ -1911,7 +2189,7 @@
|
|
|
1911
2189
|
if (done) {
|
|
1912
2190
|
return;
|
|
1913
2191
|
}
|
|
1914
|
-
yield
|
|
2192
|
+
yield toArrayBuffer2(value);
|
|
1915
2193
|
}
|
|
1916
2194
|
} catch (error) {
|
|
1917
2195
|
reader.releaseLock();
|
|
@@ -1919,7 +2197,7 @@
|
|
|
1919
2197
|
}
|
|
1920
2198
|
async function* makeNodeStreamIterator(stream, options) {
|
|
1921
2199
|
for await (const chunk of stream) {
|
|
1922
|
-
yield
|
|
2200
|
+
yield toArrayBuffer2(chunk);
|
|
1923
2201
|
}
|
|
1924
2202
|
}
|
|
1925
2203
|
|
|
@@ -1997,19 +2275,42 @@
|
|
|
1997
2275
|
throw new Error(ERR_DATA);
|
|
1998
2276
|
}
|
|
1999
2277
|
|
|
2278
|
+
// ../core/src/lib/loader-utils/get-fetch-function.ts
|
|
2279
|
+
function getFetchFunction(options, context) {
|
|
2280
|
+
const globalOptions = getGlobalLoaderOptions();
|
|
2281
|
+
const fetchOptions = options || globalOptions;
|
|
2282
|
+
if (typeof fetchOptions.fetch === "function") {
|
|
2283
|
+
return fetchOptions.fetch;
|
|
2284
|
+
}
|
|
2285
|
+
if (isObject(fetchOptions.fetch)) {
|
|
2286
|
+
return (url) => fetchFile(url, fetchOptions);
|
|
2287
|
+
}
|
|
2288
|
+
if (context?.fetch) {
|
|
2289
|
+
return context?.fetch;
|
|
2290
|
+
}
|
|
2291
|
+
return fetchFile;
|
|
2292
|
+
}
|
|
2293
|
+
|
|
2000
2294
|
// ../core/src/lib/loader-utils/loader-context.ts
|
|
2001
|
-
function getLoaderContext(context, options,
|
|
2002
|
-
if (
|
|
2003
|
-
return
|
|
2295
|
+
function getLoaderContext(context, options, parentContext) {
|
|
2296
|
+
if (parentContext) {
|
|
2297
|
+
return parentContext;
|
|
2004
2298
|
}
|
|
2005
|
-
const
|
|
2299
|
+
const newContext = {
|
|
2006
2300
|
fetch: getFetchFunction(options, context),
|
|
2007
2301
|
...context
|
|
2008
2302
|
};
|
|
2009
|
-
if (
|
|
2010
|
-
|
|
2303
|
+
if (newContext.url) {
|
|
2304
|
+
const baseUrl = stripQueryString(newContext.url);
|
|
2305
|
+
newContext.baseUrl = baseUrl;
|
|
2306
|
+
newContext.queryString = extractQueryString(newContext.url);
|
|
2307
|
+
newContext.filename = path_exports.filename(baseUrl);
|
|
2308
|
+
newContext.baseUrl = path_exports.dirname(baseUrl);
|
|
2011
2309
|
}
|
|
2012
|
-
|
|
2310
|
+
if (!Array.isArray(newContext.loaders)) {
|
|
2311
|
+
newContext.loaders = null;
|
|
2312
|
+
}
|
|
2313
|
+
return newContext;
|
|
2013
2314
|
}
|
|
2014
2315
|
function getLoadersFromContext(loaders, context) {
|
|
2015
2316
|
if (!context && loaders && !Array.isArray(loaders)) {
|
|
@@ -2036,7 +2337,7 @@
|
|
|
2036
2337
|
}
|
|
2037
2338
|
data = await data;
|
|
2038
2339
|
options = options || {};
|
|
2039
|
-
const
|
|
2340
|
+
const url = getResourceUrl(data);
|
|
2040
2341
|
const typedLoaders = loaders;
|
|
2041
2342
|
const candidateLoaders = getLoadersFromContext(typedLoaders, context);
|
|
2042
2343
|
const loader = await selectLoader(data, candidateLoaders, options);
|
|
@@ -2044,11 +2345,17 @@
|
|
|
2044
2345
|
return null;
|
|
2045
2346
|
}
|
|
2046
2347
|
options = normalizeOptions(options, loader, candidateLoaders, url);
|
|
2047
|
-
context = getLoaderContext({ url, parse, loaders: candidateLoaders }, options, context);
|
|
2348
|
+
context = getLoaderContext({ url, parse, loaders: candidateLoaders }, options, context || null);
|
|
2048
2349
|
return await parseWithLoader(loader, data, options, context);
|
|
2049
2350
|
}
|
|
2050
2351
|
async function parseWithLoader(loader, data, options, context) {
|
|
2051
2352
|
validateWorkerVersion(loader);
|
|
2353
|
+
if (isResponse(data)) {
|
|
2354
|
+
const response = data;
|
|
2355
|
+
const { ok, redirected, status, statusText, type, url } = response;
|
|
2356
|
+
const headers = Object.fromEntries(response.headers.entries());
|
|
2357
|
+
context.response = { headers, ok, redirected, status, statusText, type, url };
|
|
2358
|
+
}
|
|
2052
2359
|
data = await getArrayBufferOrStringFromData(data, loader, options);
|
|
2053
2360
|
if (loader.parseTextSync && typeof data === "string") {
|
|
2054
2361
|
options.dataType = "text";
|
|
@@ -2069,12 +2376,17 @@
|
|
|
2069
2376
|
|
|
2070
2377
|
// ../core/src/lib/api/load.ts
|
|
2071
2378
|
async function load(url, loaders, options, context) {
|
|
2379
|
+
let resolvedLoaders;
|
|
2380
|
+
let resolvedOptions;
|
|
2072
2381
|
if (!Array.isArray(loaders) && !isLoaderObject(loaders)) {
|
|
2382
|
+
resolvedLoaders = [];
|
|
2383
|
+
resolvedOptions = loaders;
|
|
2073
2384
|
context = void 0;
|
|
2074
|
-
|
|
2075
|
-
|
|
2385
|
+
} else {
|
|
2386
|
+
resolvedLoaders = loaders;
|
|
2387
|
+
resolvedOptions = options;
|
|
2076
2388
|
}
|
|
2077
|
-
const fetch2 = getFetchFunction(
|
|
2389
|
+
const fetch2 = getFetchFunction(resolvedOptions);
|
|
2078
2390
|
let data = url;
|
|
2079
2391
|
if (typeof url === "string") {
|
|
2080
2392
|
data = await fetch2(url);
|
|
@@ -2082,7 +2394,7 @@
|
|
|
2082
2394
|
if (isBlob(url)) {
|
|
2083
2395
|
data = await fetch2(url);
|
|
2084
2396
|
}
|
|
2085
|
-
return await parse(data,
|
|
2397
|
+
return Array.isArray(resolvedLoaders) ? await parse(data, resolvedLoaders, resolvedOptions) : await parse(data, resolvedLoaders, resolvedOptions);
|
|
2086
2398
|
}
|
|
2087
2399
|
|
|
2088
2400
|
// ../../node_modules/@math.gl/core/dist/esm/lib/assert.js
|
|
@@ -2095,18 +2407,16 @@
|
|
|
2095
2407
|
// ../../node_modules/@math.gl/core/dist/esm/lib/common.js
|
|
2096
2408
|
var RADIANS_TO_DEGREES = 1 / Math.PI * 180;
|
|
2097
2409
|
var DEGREES_TO_RADIANS = 1 / 180 * Math.PI;
|
|
2098
|
-
var config = {
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
return Math.round(value / config.EPSILON) * config.EPSILON;
|
|
2107
|
-
}
|
|
2410
|
+
var config = {
|
|
2411
|
+
EPSILON: 1e-12,
|
|
2412
|
+
debug: false,
|
|
2413
|
+
precision: 4,
|
|
2414
|
+
printTypes: false,
|
|
2415
|
+
printDegrees: false,
|
|
2416
|
+
printRowMajor: true
|
|
2417
|
+
};
|
|
2108
2418
|
function formatValue(value, {
|
|
2109
|
-
precision = config.precision
|
|
2419
|
+
precision = config.precision
|
|
2110
2420
|
} = {}) {
|
|
2111
2421
|
value = round(value);
|
|
2112
2422
|
return "".concat(parseFloat(value.toPrecision(precision)));
|
|
@@ -2114,6 +2424,18 @@
|
|
|
2114
2424
|
function isArray(value) {
|
|
2115
2425
|
return Array.isArray(value) || ArrayBuffer.isView(value) && !(value instanceof DataView);
|
|
2116
2426
|
}
|
|
2427
|
+
function toRadians(degrees2) {
|
|
2428
|
+
return radians(degrees2);
|
|
2429
|
+
}
|
|
2430
|
+
function toDegrees(radians2) {
|
|
2431
|
+
return degrees(radians2);
|
|
2432
|
+
}
|
|
2433
|
+
function radians(degrees2, result) {
|
|
2434
|
+
return map(degrees2, (degrees3) => degrees3 * DEGREES_TO_RADIANS, result);
|
|
2435
|
+
}
|
|
2436
|
+
function degrees(radians2, result) {
|
|
2437
|
+
return map(radians2, (radians3) => radians3 * RADIANS_TO_DEGREES, result);
|
|
2438
|
+
}
|
|
2117
2439
|
function equals(a2, b, epsilon) {
|
|
2118
2440
|
const oldEpsilon = config.EPSILON;
|
|
2119
2441
|
if (epsilon) {
|
|
@@ -2140,7 +2462,7 @@
|
|
|
2140
2462
|
if (b && b.equals) {
|
|
2141
2463
|
return b.equals(a2);
|
|
2142
2464
|
}
|
|
2143
|
-
if (
|
|
2465
|
+
if (typeof a2 === "number" && typeof b === "number") {
|
|
2144
2466
|
return Math.abs(a2 - b) <= config.EPSILON * Math.max(1, Math.abs(a2), Math.abs(b));
|
|
2145
2467
|
}
|
|
2146
2468
|
return false;
|
|
@@ -2148,6 +2470,23 @@
|
|
|
2148
2470
|
config.EPSILON = oldEpsilon;
|
|
2149
2471
|
}
|
|
2150
2472
|
}
|
|
2473
|
+
function round(value) {
|
|
2474
|
+
return Math.round(value / config.EPSILON) * config.EPSILON;
|
|
2475
|
+
}
|
|
2476
|
+
function duplicateArray(array) {
|
|
2477
|
+
return array.clone ? array.clone() : new Array(array.length);
|
|
2478
|
+
}
|
|
2479
|
+
function map(value, func, result) {
|
|
2480
|
+
if (isArray(value)) {
|
|
2481
|
+
const array = value;
|
|
2482
|
+
result = result || duplicateArray(array);
|
|
2483
|
+
for (let i2 = 0; i2 < result.length && i2 < array.length; ++i2) {
|
|
2484
|
+
result[i2] = func(value[i2], i2, result);
|
|
2485
|
+
}
|
|
2486
|
+
return result;
|
|
2487
|
+
}
|
|
2488
|
+
return func(value);
|
|
2489
|
+
}
|
|
2151
2490
|
|
|
2152
2491
|
// ../../node_modules/@math.gl/core/dist/esm/classes/base/math-array.js
|
|
2153
2492
|
function _extendableBuiltin(cls) {
|
|
@@ -2172,22 +2511,24 @@
|
|
|
2172
2511
|
return ExtendableBuiltin;
|
|
2173
2512
|
}
|
|
2174
2513
|
var MathArray = class extends _extendableBuiltin(Array) {
|
|
2175
|
-
get ELEMENTS() {
|
|
2176
|
-
assert4(false);
|
|
2177
|
-
return 0;
|
|
2178
|
-
}
|
|
2179
2514
|
clone() {
|
|
2180
2515
|
return new this.constructor().copy(this);
|
|
2181
2516
|
}
|
|
2182
|
-
from(arrayOrObject) {
|
|
2183
|
-
return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : this.fromObject(arrayOrObject);
|
|
2184
|
-
}
|
|
2185
2517
|
fromArray(array, offset = 0) {
|
|
2186
2518
|
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
2187
2519
|
this[i2] = array[i2 + offset];
|
|
2188
2520
|
}
|
|
2189
2521
|
return this.check();
|
|
2190
2522
|
}
|
|
2523
|
+
toArray(targetArray = [], offset = 0) {
|
|
2524
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
2525
|
+
targetArray[offset + i2] = this[i2];
|
|
2526
|
+
}
|
|
2527
|
+
return targetArray;
|
|
2528
|
+
}
|
|
2529
|
+
from(arrayOrObject) {
|
|
2530
|
+
return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : this.fromObject(arrayOrObject);
|
|
2531
|
+
}
|
|
2191
2532
|
to(arrayOrObject) {
|
|
2192
2533
|
if (arrayOrObject === this) {
|
|
2193
2534
|
return this;
|
|
@@ -2197,12 +2538,6 @@
|
|
|
2197
2538
|
toTarget(target) {
|
|
2198
2539
|
return target ? this.to(target) : this;
|
|
2199
2540
|
}
|
|
2200
|
-
toArray(array = [], offset = 0) {
|
|
2201
|
-
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
2202
|
-
array[offset + i2] = this[i2];
|
|
2203
|
-
}
|
|
2204
|
-
return array;
|
|
2205
|
-
}
|
|
2206
2541
|
toFloat32Array() {
|
|
2207
2542
|
return new Float32Array(this);
|
|
2208
2543
|
}
|
|
@@ -2246,9 +2581,7 @@
|
|
|
2246
2581
|
}
|
|
2247
2582
|
lerp(a2, b, t2) {
|
|
2248
2583
|
if (t2 === void 0) {
|
|
2249
|
-
|
|
2250
|
-
b = a2;
|
|
2251
|
-
a2 = this;
|
|
2584
|
+
return this.lerp(this, a2, b);
|
|
2252
2585
|
}
|
|
2253
2586
|
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
2254
2587
|
const ai = a2[i2];
|
|
@@ -2291,14 +2624,36 @@
|
|
|
2291
2624
|
return this.check();
|
|
2292
2625
|
}
|
|
2293
2626
|
scale(scale2) {
|
|
2294
|
-
if (
|
|
2295
|
-
|
|
2627
|
+
if (typeof scale2 === "number") {
|
|
2628
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
2629
|
+
this[i2] *= scale2;
|
|
2630
|
+
}
|
|
2631
|
+
} else {
|
|
2632
|
+
for (let i2 = 0; i2 < this.ELEMENTS && i2 < scale2.length; ++i2) {
|
|
2633
|
+
this[i2] *= scale2[i2];
|
|
2634
|
+
}
|
|
2296
2635
|
}
|
|
2636
|
+
return this.check();
|
|
2637
|
+
}
|
|
2638
|
+
multiplyByScalar(scalar) {
|
|
2297
2639
|
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
2298
|
-
this[i2] *=
|
|
2640
|
+
this[i2] *= scalar;
|
|
2299
2641
|
}
|
|
2300
2642
|
return this.check();
|
|
2301
2643
|
}
|
|
2644
|
+
check() {
|
|
2645
|
+
if (config.debug && !this.validate()) {
|
|
2646
|
+
throw new Error("math.gl: ".concat(this.constructor.name, " some fields set to invalid numbers'"));
|
|
2647
|
+
}
|
|
2648
|
+
return this;
|
|
2649
|
+
}
|
|
2650
|
+
validate() {
|
|
2651
|
+
let valid = this.length === this.ELEMENTS;
|
|
2652
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
2653
|
+
valid = valid && Number.isFinite(this[i2]);
|
|
2654
|
+
}
|
|
2655
|
+
return valid;
|
|
2656
|
+
}
|
|
2302
2657
|
sub(a2) {
|
|
2303
2658
|
return this.subtract(a2);
|
|
2304
2659
|
}
|
|
@@ -2324,7 +2679,7 @@
|
|
|
2324
2679
|
return this.check();
|
|
2325
2680
|
}
|
|
2326
2681
|
divideScalar(a2) {
|
|
2327
|
-
return this.
|
|
2682
|
+
return this.multiplyByScalar(1 / a2);
|
|
2328
2683
|
}
|
|
2329
2684
|
clampScalar(min, max) {
|
|
2330
2685
|
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
@@ -2332,30 +2687,14 @@
|
|
|
2332
2687
|
}
|
|
2333
2688
|
return this.check();
|
|
2334
2689
|
}
|
|
2335
|
-
multiplyByScalar(scalar) {
|
|
2336
|
-
return this.scale(scalar);
|
|
2337
|
-
}
|
|
2338
2690
|
get elements() {
|
|
2339
2691
|
return this;
|
|
2340
2692
|
}
|
|
2341
|
-
check() {
|
|
2342
|
-
if (config.debug && !this.validate()) {
|
|
2343
|
-
throw new Error("math.gl: ".concat(this.constructor.name, " some fields set to invalid numbers'"));
|
|
2344
|
-
}
|
|
2345
|
-
return this;
|
|
2346
|
-
}
|
|
2347
|
-
validate() {
|
|
2348
|
-
let valid = this.length === this.ELEMENTS;
|
|
2349
|
-
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
2350
|
-
valid = valid && Number.isFinite(this[i2]);
|
|
2351
|
-
}
|
|
2352
|
-
return valid;
|
|
2353
|
-
}
|
|
2354
2693
|
};
|
|
2355
2694
|
|
|
2356
2695
|
// ../../node_modules/@math.gl/core/dist/esm/lib/validators.js
|
|
2357
|
-
function validateVector(v,
|
|
2358
|
-
if (v.length !==
|
|
2696
|
+
function validateVector(v, length2) {
|
|
2697
|
+
if (v.length !== length2) {
|
|
2359
2698
|
return false;
|
|
2360
2699
|
}
|
|
2361
2700
|
for (let i2 = 0; i2 < v.length; ++i2) {
|
|
@@ -2371,19 +2710,117 @@
|
|
|
2371
2710
|
}
|
|
2372
2711
|
return value;
|
|
2373
2712
|
}
|
|
2374
|
-
function checkVector(v,
|
|
2375
|
-
if (config.debug && !validateVector(v,
|
|
2713
|
+
function checkVector(v, length2, callerName = "") {
|
|
2714
|
+
if (config.debug && !validateVector(v, length2)) {
|
|
2376
2715
|
throw new Error("math.gl: ".concat(callerName, " some fields set to invalid numbers'"));
|
|
2377
2716
|
}
|
|
2378
2717
|
return v;
|
|
2379
2718
|
}
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2719
|
+
|
|
2720
|
+
// ../../node_modules/@math.gl/core/dist/esm/classes/base/vector.js
|
|
2721
|
+
var Vector = class extends MathArray {
|
|
2722
|
+
get x() {
|
|
2723
|
+
return this[0];
|
|
2385
2724
|
}
|
|
2386
|
-
|
|
2725
|
+
set x(value) {
|
|
2726
|
+
this[0] = checkNumber(value);
|
|
2727
|
+
}
|
|
2728
|
+
get y() {
|
|
2729
|
+
return this[1];
|
|
2730
|
+
}
|
|
2731
|
+
set y(value) {
|
|
2732
|
+
this[1] = checkNumber(value);
|
|
2733
|
+
}
|
|
2734
|
+
len() {
|
|
2735
|
+
return Math.sqrt(this.lengthSquared());
|
|
2736
|
+
}
|
|
2737
|
+
magnitude() {
|
|
2738
|
+
return this.len();
|
|
2739
|
+
}
|
|
2740
|
+
lengthSquared() {
|
|
2741
|
+
let length2 = 0;
|
|
2742
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
2743
|
+
length2 += this[i2] * this[i2];
|
|
2744
|
+
}
|
|
2745
|
+
return length2;
|
|
2746
|
+
}
|
|
2747
|
+
magnitudeSquared() {
|
|
2748
|
+
return this.lengthSquared();
|
|
2749
|
+
}
|
|
2750
|
+
distance(mathArray) {
|
|
2751
|
+
return Math.sqrt(this.distanceSquared(mathArray));
|
|
2752
|
+
}
|
|
2753
|
+
distanceSquared(mathArray) {
|
|
2754
|
+
let length2 = 0;
|
|
2755
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
2756
|
+
const dist = this[i2] - mathArray[i2];
|
|
2757
|
+
length2 += dist * dist;
|
|
2758
|
+
}
|
|
2759
|
+
return checkNumber(length2);
|
|
2760
|
+
}
|
|
2761
|
+
dot(mathArray) {
|
|
2762
|
+
let product = 0;
|
|
2763
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
2764
|
+
product += this[i2] * mathArray[i2];
|
|
2765
|
+
}
|
|
2766
|
+
return checkNumber(product);
|
|
2767
|
+
}
|
|
2768
|
+
normalize() {
|
|
2769
|
+
const length2 = this.magnitude();
|
|
2770
|
+
if (length2 !== 0) {
|
|
2771
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
2772
|
+
this[i2] /= length2;
|
|
2773
|
+
}
|
|
2774
|
+
}
|
|
2775
|
+
return this.check();
|
|
2776
|
+
}
|
|
2777
|
+
multiply(...vectors) {
|
|
2778
|
+
for (const vector of vectors) {
|
|
2779
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
2780
|
+
this[i2] *= vector[i2];
|
|
2781
|
+
}
|
|
2782
|
+
}
|
|
2783
|
+
return this.check();
|
|
2784
|
+
}
|
|
2785
|
+
divide(...vectors) {
|
|
2786
|
+
for (const vector of vectors) {
|
|
2787
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
2788
|
+
this[i2] /= vector[i2];
|
|
2789
|
+
}
|
|
2790
|
+
}
|
|
2791
|
+
return this.check();
|
|
2792
|
+
}
|
|
2793
|
+
lengthSq() {
|
|
2794
|
+
return this.lengthSquared();
|
|
2795
|
+
}
|
|
2796
|
+
distanceTo(vector) {
|
|
2797
|
+
return this.distance(vector);
|
|
2798
|
+
}
|
|
2799
|
+
distanceToSquared(vector) {
|
|
2800
|
+
return this.distanceSquared(vector);
|
|
2801
|
+
}
|
|
2802
|
+
getComponent(i2) {
|
|
2803
|
+
assert4(i2 >= 0 && i2 < this.ELEMENTS, "index is out of range");
|
|
2804
|
+
return checkNumber(this[i2]);
|
|
2805
|
+
}
|
|
2806
|
+
setComponent(i2, value) {
|
|
2807
|
+
assert4(i2 >= 0 && i2 < this.ELEMENTS, "index is out of range");
|
|
2808
|
+
this[i2] = value;
|
|
2809
|
+
return this.check();
|
|
2810
|
+
}
|
|
2811
|
+
addVectors(a2, b) {
|
|
2812
|
+
return this.copy(a2).add(b);
|
|
2813
|
+
}
|
|
2814
|
+
subVectors(a2, b) {
|
|
2815
|
+
return this.copy(a2).subtract(b);
|
|
2816
|
+
}
|
|
2817
|
+
multiplyVectors(a2, b) {
|
|
2818
|
+
return this.copy(a2).multiply(b);
|
|
2819
|
+
}
|
|
2820
|
+
addScaledVector(a2, b) {
|
|
2821
|
+
return this.add(new this.constructor(a2).multiplyScalar(b));
|
|
2822
|
+
}
|
|
2823
|
+
};
|
|
2387
2824
|
|
|
2388
2825
|
// ../../node_modules/gl-matrix/esm/common.js
|
|
2389
2826
|
var EPSILON = 1e-6;
|
|
@@ -2459,6 +2896,14 @@
|
|
|
2459
2896
|
out[2] = (m[2] * x + m[6] * y + m[10] * z) / w;
|
|
2460
2897
|
return out;
|
|
2461
2898
|
}
|
|
2899
|
+
function vec3_transformMat2(out, a2, m) {
|
|
2900
|
+
const x = a2[0];
|
|
2901
|
+
const y = a2[1];
|
|
2902
|
+
out[0] = m[0] * x + m[2] * y;
|
|
2903
|
+
out[1] = m[1] * x + m[3] * y;
|
|
2904
|
+
out[2] = a2[2];
|
|
2905
|
+
return out;
|
|
2906
|
+
}
|
|
2462
2907
|
|
|
2463
2908
|
// ../../node_modules/gl-matrix/esm/vec3.js
|
|
2464
2909
|
function create2() {
|
|
@@ -2470,6 +2915,23 @@
|
|
|
2470
2915
|
}
|
|
2471
2916
|
return out;
|
|
2472
2917
|
}
|
|
2918
|
+
function length(a2) {
|
|
2919
|
+
var x = a2[0];
|
|
2920
|
+
var y = a2[1];
|
|
2921
|
+
var z = a2[2];
|
|
2922
|
+
return Math.hypot(x, y, z);
|
|
2923
|
+
}
|
|
2924
|
+
function dot(a2, b) {
|
|
2925
|
+
return a2[0] * b[0] + a2[1] * b[1] + a2[2] * b[2];
|
|
2926
|
+
}
|
|
2927
|
+
function cross(out, a2, b) {
|
|
2928
|
+
var ax = a2[0], ay = a2[1], az = a2[2];
|
|
2929
|
+
var bx = b[0], by = b[1], bz = b[2];
|
|
2930
|
+
out[0] = ay * bz - az * by;
|
|
2931
|
+
out[1] = az * bx - ax * bz;
|
|
2932
|
+
out[2] = ax * by - ay * bx;
|
|
2933
|
+
return out;
|
|
2934
|
+
}
|
|
2473
2935
|
function transformMat42(out, a2, m) {
|
|
2474
2936
|
var x = a2[0], y = a2[1], z = a2[2];
|
|
2475
2937
|
var w = m[3] * x + m[7] * y + m[11] * z + m[15];
|
|
@@ -2479,6 +2941,73 @@
|
|
|
2479
2941
|
out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;
|
|
2480
2942
|
return out;
|
|
2481
2943
|
}
|
|
2944
|
+
function transformMat3(out, a2, m) {
|
|
2945
|
+
var x = a2[0], y = a2[1], z = a2[2];
|
|
2946
|
+
out[0] = x * m[0] + y * m[3] + z * m[6];
|
|
2947
|
+
out[1] = x * m[1] + y * m[4] + z * m[7];
|
|
2948
|
+
out[2] = x * m[2] + y * m[5] + z * m[8];
|
|
2949
|
+
return out;
|
|
2950
|
+
}
|
|
2951
|
+
function transformQuat(out, a2, q) {
|
|
2952
|
+
var qx = q[0], qy = q[1], qz = q[2], qw = q[3];
|
|
2953
|
+
var x = a2[0], y = a2[1], z = a2[2];
|
|
2954
|
+
var uvx = qy * z - qz * y, uvy = qz * x - qx * z, uvz = qx * y - qy * x;
|
|
2955
|
+
var uuvx = qy * uvz - qz * uvy, uuvy = qz * uvx - qx * uvz, uuvz = qx * uvy - qy * uvx;
|
|
2956
|
+
var w2 = qw * 2;
|
|
2957
|
+
uvx *= w2;
|
|
2958
|
+
uvy *= w2;
|
|
2959
|
+
uvz *= w2;
|
|
2960
|
+
uuvx *= 2;
|
|
2961
|
+
uuvy *= 2;
|
|
2962
|
+
uuvz *= 2;
|
|
2963
|
+
out[0] = x + uvx + uuvx;
|
|
2964
|
+
out[1] = y + uvy + uuvy;
|
|
2965
|
+
out[2] = z + uvz + uuvz;
|
|
2966
|
+
return out;
|
|
2967
|
+
}
|
|
2968
|
+
function rotateX(out, a2, b, rad) {
|
|
2969
|
+
var p2 = [], r2 = [];
|
|
2970
|
+
p2[0] = a2[0] - b[0];
|
|
2971
|
+
p2[1] = a2[1] - b[1];
|
|
2972
|
+
p2[2] = a2[2] - b[2];
|
|
2973
|
+
r2[0] = p2[0];
|
|
2974
|
+
r2[1] = p2[1] * Math.cos(rad) - p2[2] * Math.sin(rad);
|
|
2975
|
+
r2[2] = p2[1] * Math.sin(rad) + p2[2] * Math.cos(rad);
|
|
2976
|
+
out[0] = r2[0] + b[0];
|
|
2977
|
+
out[1] = r2[1] + b[1];
|
|
2978
|
+
out[2] = r2[2] + b[2];
|
|
2979
|
+
return out;
|
|
2980
|
+
}
|
|
2981
|
+
function rotateY(out, a2, b, rad) {
|
|
2982
|
+
var p2 = [], r2 = [];
|
|
2983
|
+
p2[0] = a2[0] - b[0];
|
|
2984
|
+
p2[1] = a2[1] - b[1];
|
|
2985
|
+
p2[2] = a2[2] - b[2];
|
|
2986
|
+
r2[0] = p2[2] * Math.sin(rad) + p2[0] * Math.cos(rad);
|
|
2987
|
+
r2[1] = p2[1];
|
|
2988
|
+
r2[2] = p2[2] * Math.cos(rad) - p2[0] * Math.sin(rad);
|
|
2989
|
+
out[0] = r2[0] + b[0];
|
|
2990
|
+
out[1] = r2[1] + b[1];
|
|
2991
|
+
out[2] = r2[2] + b[2];
|
|
2992
|
+
return out;
|
|
2993
|
+
}
|
|
2994
|
+
function rotateZ(out, a2, b, rad) {
|
|
2995
|
+
var p2 = [], r2 = [];
|
|
2996
|
+
p2[0] = a2[0] - b[0];
|
|
2997
|
+
p2[1] = a2[1] - b[1];
|
|
2998
|
+
p2[2] = a2[2] - b[2];
|
|
2999
|
+
r2[0] = p2[0] * Math.cos(rad) - p2[1] * Math.sin(rad);
|
|
3000
|
+
r2[1] = p2[0] * Math.sin(rad) + p2[1] * Math.cos(rad);
|
|
3001
|
+
r2[2] = p2[2];
|
|
3002
|
+
out[0] = r2[0] + b[0];
|
|
3003
|
+
out[1] = r2[1] + b[1];
|
|
3004
|
+
out[2] = r2[2] + b[2];
|
|
3005
|
+
return out;
|
|
3006
|
+
}
|
|
3007
|
+
function angle(a2, b) {
|
|
3008
|
+
var ax = a2[0], ay = a2[1], az = a2[2], bx = b[0], by = b[1], bz = b[2], mag1 = Math.sqrt(ax * ax + ay * ay + az * az), mag2 = Math.sqrt(bx * bx + by * by + bz * bz), mag = mag1 * mag2, cosine = mag && dot(a2, b) / mag;
|
|
3009
|
+
return Math.acos(Math.min(Math.max(cosine, -1), 1));
|
|
3010
|
+
}
|
|
2482
3011
|
var forEach3 = function() {
|
|
2483
3012
|
var vec = create2();
|
|
2484
3013
|
return function(a2, stride, offset, count, fn, arg) {
|
|
@@ -2507,16 +3036,125 @@
|
|
|
2507
3036
|
};
|
|
2508
3037
|
}();
|
|
2509
3038
|
|
|
2510
|
-
// ../../node_modules/@math.gl/core/dist/esm/classes/
|
|
2511
|
-
var
|
|
3039
|
+
// ../../node_modules/@math.gl/core/dist/esm/classes/vector3.js
|
|
3040
|
+
var ORIGIN = [0, 0, 0];
|
|
3041
|
+
var ZERO;
|
|
3042
|
+
var Vector3 = class extends Vector {
|
|
3043
|
+
static get ZERO() {
|
|
3044
|
+
if (!ZERO) {
|
|
3045
|
+
ZERO = new Vector3(0, 0, 0);
|
|
3046
|
+
Object.freeze(ZERO);
|
|
3047
|
+
}
|
|
3048
|
+
return ZERO;
|
|
3049
|
+
}
|
|
3050
|
+
constructor(x = 0, y = 0, z = 0) {
|
|
3051
|
+
super(-0, -0, -0);
|
|
3052
|
+
if (arguments.length === 1 && isArray(x)) {
|
|
3053
|
+
this.copy(x);
|
|
3054
|
+
} else {
|
|
3055
|
+
if (config.debug) {
|
|
3056
|
+
checkNumber(x);
|
|
3057
|
+
checkNumber(y);
|
|
3058
|
+
checkNumber(z);
|
|
3059
|
+
}
|
|
3060
|
+
this[0] = x;
|
|
3061
|
+
this[1] = y;
|
|
3062
|
+
this[2] = z;
|
|
3063
|
+
}
|
|
3064
|
+
}
|
|
3065
|
+
set(x, y, z) {
|
|
3066
|
+
this[0] = x;
|
|
3067
|
+
this[1] = y;
|
|
3068
|
+
this[2] = z;
|
|
3069
|
+
return this.check();
|
|
3070
|
+
}
|
|
3071
|
+
copy(array) {
|
|
3072
|
+
this[0] = array[0];
|
|
3073
|
+
this[1] = array[1];
|
|
3074
|
+
this[2] = array[2];
|
|
3075
|
+
return this.check();
|
|
3076
|
+
}
|
|
3077
|
+
fromObject(object) {
|
|
3078
|
+
if (config.debug) {
|
|
3079
|
+
checkNumber(object.x);
|
|
3080
|
+
checkNumber(object.y);
|
|
3081
|
+
checkNumber(object.z);
|
|
3082
|
+
}
|
|
3083
|
+
this[0] = object.x;
|
|
3084
|
+
this[1] = object.y;
|
|
3085
|
+
this[2] = object.z;
|
|
3086
|
+
return this.check();
|
|
3087
|
+
}
|
|
3088
|
+
toObject(object) {
|
|
3089
|
+
object.x = this[0];
|
|
3090
|
+
object.y = this[1];
|
|
3091
|
+
object.z = this[2];
|
|
3092
|
+
return object;
|
|
3093
|
+
}
|
|
2512
3094
|
get ELEMENTS() {
|
|
2513
|
-
|
|
2514
|
-
return 0;
|
|
3095
|
+
return 3;
|
|
2515
3096
|
}
|
|
2516
|
-
get
|
|
2517
|
-
|
|
2518
|
-
|
|
3097
|
+
get z() {
|
|
3098
|
+
return this[2];
|
|
3099
|
+
}
|
|
3100
|
+
set z(value) {
|
|
3101
|
+
this[2] = checkNumber(value);
|
|
2519
3102
|
}
|
|
3103
|
+
angle(vector) {
|
|
3104
|
+
return angle(this, vector);
|
|
3105
|
+
}
|
|
3106
|
+
cross(vector) {
|
|
3107
|
+
cross(this, this, vector);
|
|
3108
|
+
return this.check();
|
|
3109
|
+
}
|
|
3110
|
+
rotateX({
|
|
3111
|
+
radians: radians2,
|
|
3112
|
+
origin = ORIGIN
|
|
3113
|
+
}) {
|
|
3114
|
+
rotateX(this, this, origin, radians2);
|
|
3115
|
+
return this.check();
|
|
3116
|
+
}
|
|
3117
|
+
rotateY({
|
|
3118
|
+
radians: radians2,
|
|
3119
|
+
origin = ORIGIN
|
|
3120
|
+
}) {
|
|
3121
|
+
rotateY(this, this, origin, radians2);
|
|
3122
|
+
return this.check();
|
|
3123
|
+
}
|
|
3124
|
+
rotateZ({
|
|
3125
|
+
radians: radians2,
|
|
3126
|
+
origin = ORIGIN
|
|
3127
|
+
}) {
|
|
3128
|
+
rotateZ(this, this, origin, radians2);
|
|
3129
|
+
return this.check();
|
|
3130
|
+
}
|
|
3131
|
+
transform(matrix4) {
|
|
3132
|
+
return this.transformAsPoint(matrix4);
|
|
3133
|
+
}
|
|
3134
|
+
transformAsPoint(matrix4) {
|
|
3135
|
+
transformMat42(this, this, matrix4);
|
|
3136
|
+
return this.check();
|
|
3137
|
+
}
|
|
3138
|
+
transformAsVector(matrix4) {
|
|
3139
|
+
vec3_transformMat4AsVector(this, this, matrix4);
|
|
3140
|
+
return this.check();
|
|
3141
|
+
}
|
|
3142
|
+
transformByMatrix3(matrix3) {
|
|
3143
|
+
transformMat3(this, this, matrix3);
|
|
3144
|
+
return this.check();
|
|
3145
|
+
}
|
|
3146
|
+
transformByMatrix2(matrix2) {
|
|
3147
|
+
vec3_transformMat2(this, this, matrix2);
|
|
3148
|
+
return this.check();
|
|
3149
|
+
}
|
|
3150
|
+
transformByQuaternion(quaternion) {
|
|
3151
|
+
transformQuat(this, this, quaternion);
|
|
3152
|
+
return this.check();
|
|
3153
|
+
}
|
|
3154
|
+
};
|
|
3155
|
+
|
|
3156
|
+
// ../../node_modules/@math.gl/core/dist/esm/classes/base/matrix.js
|
|
3157
|
+
var Matrix = class extends MathArray {
|
|
2520
3158
|
toString() {
|
|
2521
3159
|
let string = "[";
|
|
2522
3160
|
if (config.printRowMajor) {
|
|
@@ -2836,7 +3474,7 @@
|
|
|
2836
3474
|
}
|
|
2837
3475
|
return out;
|
|
2838
3476
|
}
|
|
2839
|
-
function
|
|
3477
|
+
function rotateX2(out, a2, rad) {
|
|
2840
3478
|
var s2 = Math.sin(rad);
|
|
2841
3479
|
var c2 = Math.cos(rad);
|
|
2842
3480
|
var a10 = a2[4];
|
|
@@ -2867,7 +3505,7 @@
|
|
|
2867
3505
|
out[11] = a23 * c2 - a13 * s2;
|
|
2868
3506
|
return out;
|
|
2869
3507
|
}
|
|
2870
|
-
function
|
|
3508
|
+
function rotateY2(out, a2, rad) {
|
|
2871
3509
|
var s2 = Math.sin(rad);
|
|
2872
3510
|
var c2 = Math.cos(rad);
|
|
2873
3511
|
var a00 = a2[0];
|
|
@@ -2898,7 +3536,7 @@
|
|
|
2898
3536
|
out[11] = a03 * s2 + a23 * c2;
|
|
2899
3537
|
return out;
|
|
2900
3538
|
}
|
|
2901
|
-
function
|
|
3539
|
+
function rotateZ2(out, a2, rad) {
|
|
2902
3540
|
var s2 = Math.sin(rad);
|
|
2903
3541
|
var c2 = Math.cos(rad);
|
|
2904
3542
|
var a00 = a2[0];
|
|
@@ -2983,7 +3621,7 @@
|
|
|
2983
3621
|
out[15] = 0;
|
|
2984
3622
|
return out;
|
|
2985
3623
|
}
|
|
2986
|
-
function
|
|
3624
|
+
function perspectiveNO(out, fovy, aspect, near, far) {
|
|
2987
3625
|
var f2 = 1 / Math.tan(fovy / 2), nf;
|
|
2988
3626
|
out[0] = f2 / aspect;
|
|
2989
3627
|
out[1] = 0;
|
|
@@ -3009,7 +3647,8 @@
|
|
|
3009
3647
|
}
|
|
3010
3648
|
return out;
|
|
3011
3649
|
}
|
|
3012
|
-
|
|
3650
|
+
var perspective = perspectiveNO;
|
|
3651
|
+
function orthoNO(out, left, right, bottom, top, near, far) {
|
|
3013
3652
|
var lr = 1 / (left - right);
|
|
3014
3653
|
var bt = 1 / (bottom - top);
|
|
3015
3654
|
var nf = 1 / (near - far);
|
|
@@ -3031,6 +3670,7 @@
|
|
|
3031
3670
|
out[15] = 1;
|
|
3032
3671
|
return out;
|
|
3033
3672
|
}
|
|
3673
|
+
var ortho = orthoNO;
|
|
3034
3674
|
function lookAt(out, eye, center, up) {
|
|
3035
3675
|
var x0, x1, x2, y0, y1, y2, z0, z1, z2, len;
|
|
3036
3676
|
var eyex = eye[0];
|
|
@@ -3149,38 +3789,36 @@
|
|
|
3149
3789
|
}();
|
|
3150
3790
|
|
|
3151
3791
|
// ../../node_modules/@math.gl/core/dist/esm/classes/matrix4.js
|
|
3152
|
-
var
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
var
|
|
3792
|
+
var INDICES;
|
|
3793
|
+
(function(INDICES2) {
|
|
3794
|
+
INDICES2[INDICES2["COL0ROW0"] = 0] = "COL0ROW0";
|
|
3795
|
+
INDICES2[INDICES2["COL0ROW1"] = 1] = "COL0ROW1";
|
|
3796
|
+
INDICES2[INDICES2["COL0ROW2"] = 2] = "COL0ROW2";
|
|
3797
|
+
INDICES2[INDICES2["COL0ROW3"] = 3] = "COL0ROW3";
|
|
3798
|
+
INDICES2[INDICES2["COL1ROW0"] = 4] = "COL1ROW0";
|
|
3799
|
+
INDICES2[INDICES2["COL1ROW1"] = 5] = "COL1ROW1";
|
|
3800
|
+
INDICES2[INDICES2["COL1ROW2"] = 6] = "COL1ROW2";
|
|
3801
|
+
INDICES2[INDICES2["COL1ROW3"] = 7] = "COL1ROW3";
|
|
3802
|
+
INDICES2[INDICES2["COL2ROW0"] = 8] = "COL2ROW0";
|
|
3803
|
+
INDICES2[INDICES2["COL2ROW1"] = 9] = "COL2ROW1";
|
|
3804
|
+
INDICES2[INDICES2["COL2ROW2"] = 10] = "COL2ROW2";
|
|
3805
|
+
INDICES2[INDICES2["COL2ROW3"] = 11] = "COL2ROW3";
|
|
3806
|
+
INDICES2[INDICES2["COL3ROW0"] = 12] = "COL3ROW0";
|
|
3807
|
+
INDICES2[INDICES2["COL3ROW1"] = 13] = "COL3ROW1";
|
|
3808
|
+
INDICES2[INDICES2["COL3ROW2"] = 14] = "COL3ROW2";
|
|
3809
|
+
INDICES2[INDICES2["COL3ROW3"] = 15] = "COL3ROW3";
|
|
3810
|
+
})(INDICES || (INDICES = {}));
|
|
3811
|
+
var DEFAULT_FOVY = 45 * Math.PI / 180;
|
|
3812
|
+
var DEFAULT_ASPECT = 1;
|
|
3813
|
+
var DEFAULT_NEAR = 0.1;
|
|
3814
|
+
var DEFAULT_FAR = 500;
|
|
3815
|
+
var IDENTITY_MATRIX = Object.freeze([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
|
|
3173
3816
|
var Matrix4 = class extends Matrix {
|
|
3174
3817
|
static get IDENTITY() {
|
|
3175
|
-
|
|
3176
|
-
return constants.IDENTITY;
|
|
3818
|
+
return getIdentityMatrix();
|
|
3177
3819
|
}
|
|
3178
3820
|
static get ZERO() {
|
|
3179
|
-
|
|
3180
|
-
return constants.ZERO;
|
|
3181
|
-
}
|
|
3182
|
-
get INDICES() {
|
|
3183
|
-
return INDICES;
|
|
3821
|
+
return getZeroMatrix();
|
|
3184
3822
|
}
|
|
3185
3823
|
get ELEMENTS() {
|
|
3186
3824
|
return 16;
|
|
@@ -3188,6 +3826,9 @@
|
|
|
3188
3826
|
get RANK() {
|
|
3189
3827
|
return 4;
|
|
3190
3828
|
}
|
|
3829
|
+
get INDICES() {
|
|
3830
|
+
return INDICES;
|
|
3831
|
+
}
|
|
3191
3832
|
constructor(array) {
|
|
3192
3833
|
super(-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0);
|
|
3193
3834
|
if (arguments.length === 1 && Array.isArray(array)) {
|
|
@@ -3273,91 +3914,65 @@
|
|
|
3273
3914
|
return result;
|
|
3274
3915
|
}
|
|
3275
3916
|
identity() {
|
|
3276
|
-
return this.copy(
|
|
3917
|
+
return this.copy(IDENTITY_MATRIX);
|
|
3277
3918
|
}
|
|
3278
|
-
|
|
3279
|
-
fromQuat(this, q);
|
|
3919
|
+
fromObject(object) {
|
|
3280
3920
|
return this.check();
|
|
3281
3921
|
}
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3922
|
+
fromQuaternion(quaternion) {
|
|
3923
|
+
fromQuat(this, quaternion);
|
|
3924
|
+
return this.check();
|
|
3925
|
+
}
|
|
3926
|
+
frustum(view) {
|
|
3927
|
+
const {
|
|
3928
|
+
left,
|
|
3929
|
+
right,
|
|
3930
|
+
bottom,
|
|
3931
|
+
top,
|
|
3932
|
+
near = DEFAULT_NEAR,
|
|
3933
|
+
far = DEFAULT_FAR
|
|
3934
|
+
} = view;
|
|
3290
3935
|
if (far === Infinity) {
|
|
3291
|
-
|
|
3936
|
+
computeInfinitePerspectiveOffCenter(this, left, right, bottom, top, near);
|
|
3292
3937
|
} else {
|
|
3293
3938
|
frustum(this, left, right, bottom, top, near, far);
|
|
3294
3939
|
}
|
|
3295
3940
|
return this.check();
|
|
3296
3941
|
}
|
|
3297
|
-
|
|
3298
|
-
const
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
const column2Row3 = -1;
|
|
3304
|
-
const column3Row2 = -2 * near;
|
|
3305
|
-
result[0] = column0Row0;
|
|
3306
|
-
result[1] = 0;
|
|
3307
|
-
result[2] = 0;
|
|
3308
|
-
result[3] = 0;
|
|
3309
|
-
result[4] = 0;
|
|
3310
|
-
result[5] = column1Row1;
|
|
3311
|
-
result[6] = 0;
|
|
3312
|
-
result[7] = 0;
|
|
3313
|
-
result[8] = column2Row0;
|
|
3314
|
-
result[9] = column2Row1;
|
|
3315
|
-
result[10] = column2Row2;
|
|
3316
|
-
result[11] = column2Row3;
|
|
3317
|
-
result[12] = 0;
|
|
3318
|
-
result[13] = 0;
|
|
3319
|
-
result[14] = column3Row2;
|
|
3320
|
-
result[15] = 0;
|
|
3321
|
-
return result;
|
|
3322
|
-
}
|
|
3323
|
-
lookAt(eye, center, up) {
|
|
3324
|
-
if (arguments.length === 1) {
|
|
3325
|
-
({
|
|
3326
|
-
eye,
|
|
3327
|
-
center,
|
|
3328
|
-
up
|
|
3329
|
-
} = eye);
|
|
3330
|
-
}
|
|
3331
|
-
center = center || [0, 0, 0];
|
|
3332
|
-
up = up || [0, 1, 0];
|
|
3942
|
+
lookAt(view) {
|
|
3943
|
+
const {
|
|
3944
|
+
eye,
|
|
3945
|
+
center = [0, 0, 0],
|
|
3946
|
+
up = [0, 1, 0]
|
|
3947
|
+
} = view;
|
|
3333
3948
|
lookAt(this, eye, center, up);
|
|
3334
3949
|
return this.check();
|
|
3335
3950
|
}
|
|
3336
|
-
ortho({
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3951
|
+
ortho(view) {
|
|
3952
|
+
const {
|
|
3953
|
+
left,
|
|
3954
|
+
right,
|
|
3955
|
+
bottom,
|
|
3956
|
+
top,
|
|
3957
|
+
near = DEFAULT_NEAR,
|
|
3958
|
+
far = DEFAULT_FAR
|
|
3959
|
+
} = view;
|
|
3344
3960
|
ortho(this, left, right, bottom, top, near, far);
|
|
3345
3961
|
return this.check();
|
|
3346
3962
|
}
|
|
3347
|
-
orthographic({
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
}
|
|
3963
|
+
orthographic(view) {
|
|
3964
|
+
const {
|
|
3965
|
+
fovy = DEFAULT_FOVY,
|
|
3966
|
+
aspect = DEFAULT_ASPECT,
|
|
3967
|
+
focalDistance = 1,
|
|
3968
|
+
near = DEFAULT_NEAR,
|
|
3969
|
+
far = DEFAULT_FAR
|
|
3970
|
+
} = view;
|
|
3971
|
+
checkRadians(fovy);
|
|
3357
3972
|
const halfY = fovy / 2;
|
|
3358
3973
|
const top = focalDistance * Math.tan(halfY);
|
|
3359
3974
|
const right = top * aspect;
|
|
3360
|
-
return
|
|
3975
|
+
return this.ortho({
|
|
3361
3976
|
left: -right,
|
|
3362
3977
|
right,
|
|
3363
3978
|
bottom: -top,
|
|
@@ -3366,17 +3981,14 @@
|
|
|
3366
3981
|
far
|
|
3367
3982
|
});
|
|
3368
3983
|
}
|
|
3369
|
-
perspective({
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
fovy
|
|
3377
|
-
if (fovy > Math.PI * 2) {
|
|
3378
|
-
throw Error("radians");
|
|
3379
|
-
}
|
|
3984
|
+
perspective(view) {
|
|
3985
|
+
const {
|
|
3986
|
+
fovy = 45 * Math.PI / 180,
|
|
3987
|
+
aspect = 1,
|
|
3988
|
+
near = 0.1,
|
|
3989
|
+
far = 500
|
|
3990
|
+
} = view;
|
|
3991
|
+
checkRadians(fovy);
|
|
3380
3992
|
perspective(this, fovy, aspect, near, far);
|
|
3381
3993
|
return this.check();
|
|
3382
3994
|
}
|
|
@@ -3395,8 +4007,10 @@
|
|
|
3395
4007
|
result[2] = this[14];
|
|
3396
4008
|
return result;
|
|
3397
4009
|
}
|
|
3398
|
-
getRotation(result
|
|
3399
|
-
|
|
4010
|
+
getRotation(result, scaleResult) {
|
|
4011
|
+
result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0];
|
|
4012
|
+
scaleResult = scaleResult || [-0, -0, -0];
|
|
4013
|
+
const scale2 = this.getScale(scaleResult);
|
|
3400
4014
|
const inverseScale0 = 1 / scale2[0];
|
|
3401
4015
|
const inverseScale1 = 1 / scale2[1];
|
|
3402
4016
|
const inverseScale2 = 1 / scale2[2];
|
|
@@ -3418,8 +4032,10 @@
|
|
|
3418
4032
|
result[15] = 1;
|
|
3419
4033
|
return result;
|
|
3420
4034
|
}
|
|
3421
|
-
getRotationMatrix3(result
|
|
3422
|
-
|
|
4035
|
+
getRotationMatrix3(result, scaleResult) {
|
|
4036
|
+
result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0];
|
|
4037
|
+
scaleResult = scaleResult || [-0, -0, -0];
|
|
4038
|
+
const scale2 = this.getScale(scaleResult);
|
|
3423
4039
|
const inverseScale0 = 1 / scale2[0];
|
|
3424
4040
|
const inverseScale1 = 1 / scale2[1];
|
|
3425
4041
|
const inverseScale2 = 1 / scale2[2];
|
|
@@ -3450,35 +4066,31 @@
|
|
|
3450
4066
|
multiply(this, this, a2);
|
|
3451
4067
|
return this.check();
|
|
3452
4068
|
}
|
|
3453
|
-
rotateX(
|
|
3454
|
-
|
|
4069
|
+
rotateX(radians2) {
|
|
4070
|
+
rotateX2(this, this, radians2);
|
|
3455
4071
|
return this.check();
|
|
3456
4072
|
}
|
|
3457
|
-
rotateY(
|
|
3458
|
-
|
|
4073
|
+
rotateY(radians2) {
|
|
4074
|
+
rotateY2(this, this, radians2);
|
|
3459
4075
|
return this.check();
|
|
3460
4076
|
}
|
|
3461
|
-
rotateZ(
|
|
3462
|
-
|
|
4077
|
+
rotateZ(radians2) {
|
|
4078
|
+
rotateZ2(this, this, radians2);
|
|
3463
4079
|
return this.check();
|
|
3464
4080
|
}
|
|
3465
|
-
rotateXYZ(
|
|
3466
|
-
return this.rotateX(
|
|
4081
|
+
rotateXYZ(angleXYZ) {
|
|
4082
|
+
return this.rotateX(angleXYZ[0]).rotateY(angleXYZ[1]).rotateZ(angleXYZ[2]);
|
|
3467
4083
|
}
|
|
3468
|
-
rotateAxis(
|
|
3469
|
-
rotate(this, this,
|
|
4084
|
+
rotateAxis(radians2, axis) {
|
|
4085
|
+
rotate(this, this, radians2, axis);
|
|
3470
4086
|
return this.check();
|
|
3471
4087
|
}
|
|
3472
4088
|
scale(factor) {
|
|
3473
|
-
|
|
3474
|
-
scale(this, this, factor);
|
|
3475
|
-
} else {
|
|
3476
|
-
scale(this, this, [factor, factor, factor]);
|
|
3477
|
-
}
|
|
4089
|
+
scale(this, this, Array.isArray(factor) ? factor : [factor, factor, factor]);
|
|
3478
4090
|
return this.check();
|
|
3479
4091
|
}
|
|
3480
|
-
translate(
|
|
3481
|
-
translate(this, this,
|
|
4092
|
+
translate(vector) {
|
|
4093
|
+
translate(this, this, vector);
|
|
3482
4094
|
return this.check();
|
|
3483
4095
|
}
|
|
3484
4096
|
transform(vector, result) {
|
|
@@ -3491,68 +4103,486 @@
|
|
|
3491
4103
|
}
|
|
3492
4104
|
transformAsPoint(vector, result) {
|
|
3493
4105
|
const {
|
|
3494
|
-
length
|
|
4106
|
+
length: length2
|
|
3495
4107
|
} = vector;
|
|
3496
|
-
|
|
4108
|
+
let out;
|
|
4109
|
+
switch (length2) {
|
|
3497
4110
|
case 2:
|
|
3498
|
-
|
|
4111
|
+
out = transformMat4(result || [-0, -0], vector, this);
|
|
3499
4112
|
break;
|
|
3500
4113
|
case 3:
|
|
3501
|
-
|
|
4114
|
+
out = transformMat42(result || [-0, -0, -0], vector, this);
|
|
3502
4115
|
break;
|
|
3503
4116
|
default:
|
|
3504
4117
|
throw new Error("Illegal vector");
|
|
3505
4118
|
}
|
|
3506
|
-
checkVector(
|
|
3507
|
-
return
|
|
4119
|
+
checkVector(out, vector.length);
|
|
4120
|
+
return out;
|
|
3508
4121
|
}
|
|
3509
4122
|
transformAsVector(vector, result) {
|
|
4123
|
+
let out;
|
|
3510
4124
|
switch (vector.length) {
|
|
3511
4125
|
case 2:
|
|
3512
|
-
|
|
4126
|
+
out = vec2_transformMat4AsVector(result || [-0, -0], vector, this);
|
|
3513
4127
|
break;
|
|
3514
4128
|
case 3:
|
|
3515
|
-
|
|
4129
|
+
out = vec3_transformMat4AsVector(result || [-0, -0, -0], vector, this);
|
|
3516
4130
|
break;
|
|
3517
4131
|
default:
|
|
3518
4132
|
throw new Error("Illegal vector");
|
|
3519
4133
|
}
|
|
3520
|
-
checkVector(
|
|
3521
|
-
return
|
|
3522
|
-
}
|
|
3523
|
-
makeRotationX(radians) {
|
|
3524
|
-
return this.identity().rotateX(radians);
|
|
3525
|
-
}
|
|
3526
|
-
makeTranslation(x, y, z) {
|
|
3527
|
-
return this.identity().translate([x, y, z]);
|
|
4134
|
+
checkVector(out, vector.length);
|
|
4135
|
+
return out;
|
|
3528
4136
|
}
|
|
3529
4137
|
transformPoint(vector, result) {
|
|
3530
|
-
deprecated("Matrix4.transformPoint", "3.0");
|
|
3531
4138
|
return this.transformAsPoint(vector, result);
|
|
3532
4139
|
}
|
|
3533
4140
|
transformVector(vector, result) {
|
|
3534
|
-
deprecated("Matrix4.transformVector", "3.0");
|
|
3535
4141
|
return this.transformAsPoint(vector, result);
|
|
3536
4142
|
}
|
|
3537
4143
|
transformDirection(vector, result) {
|
|
3538
|
-
deprecated("Matrix4.transformDirection", "3.0");
|
|
3539
4144
|
return this.transformAsVector(vector, result);
|
|
3540
4145
|
}
|
|
4146
|
+
makeRotationX(radians2) {
|
|
4147
|
+
return this.identity().rotateX(radians2);
|
|
4148
|
+
}
|
|
4149
|
+
makeTranslation(x, y, z) {
|
|
4150
|
+
return this.identity().translate([x, y, z]);
|
|
4151
|
+
}
|
|
3541
4152
|
};
|
|
4153
|
+
var ZERO2;
|
|
4154
|
+
var IDENTITY;
|
|
4155
|
+
function getZeroMatrix() {
|
|
4156
|
+
if (!ZERO2) {
|
|
4157
|
+
ZERO2 = new Matrix4([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
|
4158
|
+
Object.freeze(ZERO2);
|
|
4159
|
+
}
|
|
4160
|
+
return ZERO2;
|
|
4161
|
+
}
|
|
4162
|
+
function getIdentityMatrix() {
|
|
4163
|
+
if (!IDENTITY) {
|
|
4164
|
+
IDENTITY = new Matrix4();
|
|
4165
|
+
Object.freeze(IDENTITY);
|
|
4166
|
+
}
|
|
4167
|
+
return IDENTITY;
|
|
4168
|
+
}
|
|
4169
|
+
function checkRadians(possiblyDegrees) {
|
|
4170
|
+
if (possiblyDegrees > Math.PI * 2) {
|
|
4171
|
+
throw Error("expected radians");
|
|
4172
|
+
}
|
|
4173
|
+
}
|
|
4174
|
+
function computeInfinitePerspectiveOffCenter(result, left, right, bottom, top, near) {
|
|
4175
|
+
const column0Row0 = 2 * near / (right - left);
|
|
4176
|
+
const column1Row1 = 2 * near / (top - bottom);
|
|
4177
|
+
const column2Row0 = (right + left) / (right - left);
|
|
4178
|
+
const column2Row1 = (top + bottom) / (top - bottom);
|
|
4179
|
+
const column2Row2 = -1;
|
|
4180
|
+
const column2Row3 = -1;
|
|
4181
|
+
const column3Row2 = -2 * near;
|
|
4182
|
+
result[0] = column0Row0;
|
|
4183
|
+
result[1] = 0;
|
|
4184
|
+
result[2] = 0;
|
|
4185
|
+
result[3] = 0;
|
|
4186
|
+
result[4] = 0;
|
|
4187
|
+
result[5] = column1Row1;
|
|
4188
|
+
result[6] = 0;
|
|
4189
|
+
result[7] = 0;
|
|
4190
|
+
result[8] = column2Row0;
|
|
4191
|
+
result[9] = column2Row1;
|
|
4192
|
+
result[10] = column2Row2;
|
|
4193
|
+
result[11] = column2Row3;
|
|
4194
|
+
result[12] = 0;
|
|
4195
|
+
result[13] = 0;
|
|
4196
|
+
result[14] = column3Row2;
|
|
4197
|
+
result[15] = 0;
|
|
4198
|
+
return result;
|
|
4199
|
+
}
|
|
3542
4200
|
|
|
3543
|
-
// ../../node_modules/@math.gl/core/dist/esm/
|
|
3544
|
-
var
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
4201
|
+
// ../../node_modules/@math.gl/core/dist/esm/lib/math-utils.js
|
|
4202
|
+
var math_utils_default = {
|
|
4203
|
+
EPSILON1: 0.1,
|
|
4204
|
+
EPSILON2: 0.01,
|
|
4205
|
+
EPSILON3: 1e-3,
|
|
4206
|
+
EPSILON4: 1e-4,
|
|
4207
|
+
EPSILON5: 1e-5,
|
|
4208
|
+
EPSILON6: 1e-6,
|
|
4209
|
+
EPSILON7: 1e-7,
|
|
4210
|
+
EPSILON8: 1e-8,
|
|
4211
|
+
EPSILON9: 1e-9,
|
|
4212
|
+
EPSILON10: 1e-10,
|
|
4213
|
+
EPSILON11: 1e-11,
|
|
4214
|
+
EPSILON12: 1e-12,
|
|
4215
|
+
EPSILON13: 1e-13,
|
|
4216
|
+
EPSILON14: 1e-14,
|
|
4217
|
+
EPSILON15: 1e-15,
|
|
4218
|
+
EPSILON16: 1e-16,
|
|
4219
|
+
EPSILON17: 1e-17,
|
|
4220
|
+
EPSILON18: 1e-18,
|
|
4221
|
+
EPSILON19: 1e-19,
|
|
4222
|
+
EPSILON20: 1e-20,
|
|
4223
|
+
PI_OVER_TWO: Math.PI / 2,
|
|
4224
|
+
PI_OVER_FOUR: Math.PI / 4,
|
|
4225
|
+
PI_OVER_SIX: Math.PI / 6,
|
|
4226
|
+
TWO_PI: Math.PI * 2
|
|
3548
4227
|
};
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
4228
|
+
|
|
4229
|
+
// ../../node_modules/@math.gl/geospatial/dist/esm/constants.js
|
|
4230
|
+
var WGS84_RADIUS_X = 6378137;
|
|
4231
|
+
var WGS84_RADIUS_Y = 6378137;
|
|
4232
|
+
var WGS84_RADIUS_Z = 6356752314245179e-9;
|
|
4233
|
+
var WGS84_CONSTANTS = {
|
|
4234
|
+
radii: [WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z],
|
|
4235
|
+
radiiSquared: [WGS84_RADIUS_X * WGS84_RADIUS_X, WGS84_RADIUS_Y * WGS84_RADIUS_Y, WGS84_RADIUS_Z * WGS84_RADIUS_Z],
|
|
4236
|
+
oneOverRadii: [1 / WGS84_RADIUS_X, 1 / WGS84_RADIUS_Y, 1 / WGS84_RADIUS_Z],
|
|
4237
|
+
oneOverRadiiSquared: [1 / (WGS84_RADIUS_X * WGS84_RADIUS_X), 1 / (WGS84_RADIUS_Y * WGS84_RADIUS_Y), 1 / (WGS84_RADIUS_Z * WGS84_RADIUS_Z)],
|
|
4238
|
+
maximumRadius: Math.max(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z),
|
|
4239
|
+
centerToleranceSquared: 0.1
|
|
3552
4240
|
};
|
|
3553
4241
|
|
|
4242
|
+
// ../../node_modules/@math.gl/geospatial/dist/esm/type-utils.js
|
|
4243
|
+
function identity2(x) {
|
|
4244
|
+
return x;
|
|
4245
|
+
}
|
|
4246
|
+
var scratchVector = new Vector3();
|
|
4247
|
+
function fromCartographic(cartographic, result = [], map2 = identity2) {
|
|
4248
|
+
if ("longitude" in cartographic) {
|
|
4249
|
+
result[0] = map2(cartographic.longitude);
|
|
4250
|
+
result[1] = map2(cartographic.latitude);
|
|
4251
|
+
result[2] = cartographic.height;
|
|
4252
|
+
} else if ("x" in cartographic) {
|
|
4253
|
+
result[0] = map2(cartographic.x);
|
|
4254
|
+
result[1] = map2(cartographic.y);
|
|
4255
|
+
result[2] = cartographic.z;
|
|
4256
|
+
} else {
|
|
4257
|
+
result[0] = map2(cartographic[0]);
|
|
4258
|
+
result[1] = map2(cartographic[1]);
|
|
4259
|
+
result[2] = cartographic[2];
|
|
4260
|
+
}
|
|
4261
|
+
return result;
|
|
4262
|
+
}
|
|
4263
|
+
function fromCartographicToRadians(cartographic, vector = []) {
|
|
4264
|
+
return fromCartographic(cartographic, vector, config._cartographicRadians ? identity2 : toRadians);
|
|
4265
|
+
}
|
|
4266
|
+
function toCartographic(vector, cartographic, map2 = identity2) {
|
|
4267
|
+
if ("longitude" in cartographic) {
|
|
4268
|
+
cartographic.longitude = map2(vector[0]);
|
|
4269
|
+
cartographic.latitude = map2(vector[1]);
|
|
4270
|
+
cartographic.height = vector[2];
|
|
4271
|
+
} else if ("x" in cartographic) {
|
|
4272
|
+
cartographic.x = map2(vector[0]);
|
|
4273
|
+
cartographic.y = map2(vector[1]);
|
|
4274
|
+
cartographic.z = vector[2];
|
|
4275
|
+
} else {
|
|
4276
|
+
cartographic[0] = map2(vector[0]);
|
|
4277
|
+
cartographic[1] = map2(vector[1]);
|
|
4278
|
+
cartographic[2] = vector[2];
|
|
4279
|
+
}
|
|
4280
|
+
return cartographic;
|
|
4281
|
+
}
|
|
4282
|
+
function toCartographicFromRadians(vector, cartographic) {
|
|
4283
|
+
return toCartographic(vector, cartographic, config._cartographicRadians ? identity2 : toDegrees);
|
|
4284
|
+
}
|
|
4285
|
+
|
|
4286
|
+
// ../../node_modules/@math.gl/geospatial/dist/esm/ellipsoid/helpers/scale-to-geodetic-surface.js
|
|
4287
|
+
var scratchVector2 = new Vector3();
|
|
4288
|
+
var scaleToGeodeticSurfaceIntersection = new Vector3();
|
|
4289
|
+
var scaleToGeodeticSurfaceGradient = new Vector3();
|
|
4290
|
+
function scaleToGeodeticSurface(cartesian, ellipsoid, result = []) {
|
|
4291
|
+
const {
|
|
4292
|
+
oneOverRadii,
|
|
4293
|
+
oneOverRadiiSquared,
|
|
4294
|
+
centerToleranceSquared
|
|
4295
|
+
} = ellipsoid;
|
|
4296
|
+
scratchVector2.from(cartesian);
|
|
4297
|
+
const positionX = scratchVector2.x;
|
|
4298
|
+
const positionY = scratchVector2.y;
|
|
4299
|
+
const positionZ = scratchVector2.z;
|
|
4300
|
+
const oneOverRadiiX = oneOverRadii.x;
|
|
4301
|
+
const oneOverRadiiY = oneOverRadii.y;
|
|
4302
|
+
const oneOverRadiiZ = oneOverRadii.z;
|
|
4303
|
+
const x2 = positionX * positionX * oneOverRadiiX * oneOverRadiiX;
|
|
4304
|
+
const y2 = positionY * positionY * oneOverRadiiY * oneOverRadiiY;
|
|
4305
|
+
const z2 = positionZ * positionZ * oneOverRadiiZ * oneOverRadiiZ;
|
|
4306
|
+
const squaredNorm = x2 + y2 + z2;
|
|
4307
|
+
const ratio = Math.sqrt(1 / squaredNorm);
|
|
4308
|
+
if (!Number.isFinite(ratio)) {
|
|
4309
|
+
return void 0;
|
|
4310
|
+
}
|
|
4311
|
+
const intersection = scaleToGeodeticSurfaceIntersection;
|
|
4312
|
+
intersection.copy(cartesian).scale(ratio);
|
|
4313
|
+
if (squaredNorm < centerToleranceSquared) {
|
|
4314
|
+
return intersection.to(result);
|
|
4315
|
+
}
|
|
4316
|
+
const oneOverRadiiSquaredX = oneOverRadiiSquared.x;
|
|
4317
|
+
const oneOverRadiiSquaredY = oneOverRadiiSquared.y;
|
|
4318
|
+
const oneOverRadiiSquaredZ = oneOverRadiiSquared.z;
|
|
4319
|
+
const gradient = scaleToGeodeticSurfaceGradient;
|
|
4320
|
+
gradient.set(intersection.x * oneOverRadiiSquaredX * 2, intersection.y * oneOverRadiiSquaredY * 2, intersection.z * oneOverRadiiSquaredZ * 2);
|
|
4321
|
+
let lambda = (1 - ratio) * scratchVector2.len() / (0.5 * gradient.len());
|
|
4322
|
+
let correction = 0;
|
|
4323
|
+
let xMultiplier;
|
|
4324
|
+
let yMultiplier;
|
|
4325
|
+
let zMultiplier;
|
|
4326
|
+
let func;
|
|
4327
|
+
do {
|
|
4328
|
+
lambda -= correction;
|
|
4329
|
+
xMultiplier = 1 / (1 + lambda * oneOverRadiiSquaredX);
|
|
4330
|
+
yMultiplier = 1 / (1 + lambda * oneOverRadiiSquaredY);
|
|
4331
|
+
zMultiplier = 1 / (1 + lambda * oneOverRadiiSquaredZ);
|
|
4332
|
+
const xMultiplier2 = xMultiplier * xMultiplier;
|
|
4333
|
+
const yMultiplier2 = yMultiplier * yMultiplier;
|
|
4334
|
+
const zMultiplier2 = zMultiplier * zMultiplier;
|
|
4335
|
+
const xMultiplier3 = xMultiplier2 * xMultiplier;
|
|
4336
|
+
const yMultiplier3 = yMultiplier2 * yMultiplier;
|
|
4337
|
+
const zMultiplier3 = zMultiplier2 * zMultiplier;
|
|
4338
|
+
func = x2 * xMultiplier2 + y2 * yMultiplier2 + z2 * zMultiplier2 - 1;
|
|
4339
|
+
const denominator = x2 * xMultiplier3 * oneOverRadiiSquaredX + y2 * yMultiplier3 * oneOverRadiiSquaredY + z2 * zMultiplier3 * oneOverRadiiSquaredZ;
|
|
4340
|
+
const derivative = -2 * denominator;
|
|
4341
|
+
correction = func / derivative;
|
|
4342
|
+
} while (Math.abs(func) > math_utils_default.EPSILON12);
|
|
4343
|
+
return scratchVector2.scale([xMultiplier, yMultiplier, zMultiplier]).to(result);
|
|
4344
|
+
}
|
|
4345
|
+
|
|
4346
|
+
// ../../node_modules/@math.gl/geospatial/dist/esm/ellipsoid/helpers/ellipsoid-transform.js
|
|
4347
|
+
var EPSILON14 = 1e-14;
|
|
4348
|
+
var scratchOrigin = new Vector3();
|
|
4349
|
+
var VECTOR_PRODUCT_LOCAL_FRAME = {
|
|
4350
|
+
up: {
|
|
4351
|
+
south: "east",
|
|
4352
|
+
north: "west",
|
|
4353
|
+
west: "south",
|
|
4354
|
+
east: "north"
|
|
4355
|
+
},
|
|
4356
|
+
down: {
|
|
4357
|
+
south: "west",
|
|
4358
|
+
north: "east",
|
|
4359
|
+
west: "north",
|
|
4360
|
+
east: "south"
|
|
4361
|
+
},
|
|
4362
|
+
south: {
|
|
4363
|
+
up: "west",
|
|
4364
|
+
down: "east",
|
|
4365
|
+
west: "down",
|
|
4366
|
+
east: "up"
|
|
4367
|
+
},
|
|
4368
|
+
north: {
|
|
4369
|
+
up: "east",
|
|
4370
|
+
down: "west",
|
|
4371
|
+
west: "up",
|
|
4372
|
+
east: "down"
|
|
4373
|
+
},
|
|
4374
|
+
west: {
|
|
4375
|
+
up: "north",
|
|
4376
|
+
down: "south",
|
|
4377
|
+
north: "down",
|
|
4378
|
+
south: "up"
|
|
4379
|
+
},
|
|
4380
|
+
east: {
|
|
4381
|
+
up: "south",
|
|
4382
|
+
down: "north",
|
|
4383
|
+
north: "up",
|
|
4384
|
+
south: "down"
|
|
4385
|
+
}
|
|
4386
|
+
};
|
|
4387
|
+
var degeneratePositionLocalFrame = {
|
|
4388
|
+
north: [-1, 0, 0],
|
|
4389
|
+
east: [0, 1, 0],
|
|
4390
|
+
up: [0, 0, 1],
|
|
4391
|
+
south: [1, 0, 0],
|
|
4392
|
+
west: [0, -1, 0],
|
|
4393
|
+
down: [0, 0, -1]
|
|
4394
|
+
};
|
|
4395
|
+
var scratchAxisVectors = {
|
|
4396
|
+
east: new Vector3(),
|
|
4397
|
+
north: new Vector3(),
|
|
4398
|
+
up: new Vector3(),
|
|
4399
|
+
west: new Vector3(),
|
|
4400
|
+
south: new Vector3(),
|
|
4401
|
+
down: new Vector3()
|
|
4402
|
+
};
|
|
4403
|
+
var scratchVector1 = new Vector3();
|
|
4404
|
+
var scratchVector22 = new Vector3();
|
|
4405
|
+
var scratchVector3 = new Vector3();
|
|
4406
|
+
function localFrameToFixedFrame(ellipsoid, firstAxis, secondAxis, thirdAxis, cartesianOrigin, result) {
|
|
4407
|
+
const thirdAxisInferred = VECTOR_PRODUCT_LOCAL_FRAME[firstAxis] && VECTOR_PRODUCT_LOCAL_FRAME[firstAxis][secondAxis];
|
|
4408
|
+
assert4(thirdAxisInferred && (!thirdAxis || thirdAxis === thirdAxisInferred));
|
|
4409
|
+
let firstAxisVector;
|
|
4410
|
+
let secondAxisVector;
|
|
4411
|
+
let thirdAxisVector;
|
|
4412
|
+
const origin = scratchOrigin.copy(cartesianOrigin);
|
|
4413
|
+
const atPole = equals(origin.x, 0, EPSILON14) && equals(origin.y, 0, EPSILON14);
|
|
4414
|
+
if (atPole) {
|
|
4415
|
+
const sign = Math.sign(origin.z);
|
|
4416
|
+
firstAxisVector = scratchVector1.fromArray(degeneratePositionLocalFrame[firstAxis]);
|
|
4417
|
+
if (firstAxis !== "east" && firstAxis !== "west") {
|
|
4418
|
+
firstAxisVector.scale(sign);
|
|
4419
|
+
}
|
|
4420
|
+
secondAxisVector = scratchVector22.fromArray(degeneratePositionLocalFrame[secondAxis]);
|
|
4421
|
+
if (secondAxis !== "east" && secondAxis !== "west") {
|
|
4422
|
+
secondAxisVector.scale(sign);
|
|
4423
|
+
}
|
|
4424
|
+
thirdAxisVector = scratchVector3.fromArray(degeneratePositionLocalFrame[thirdAxis]);
|
|
4425
|
+
if (thirdAxis !== "east" && thirdAxis !== "west") {
|
|
4426
|
+
thirdAxisVector.scale(sign);
|
|
4427
|
+
}
|
|
4428
|
+
} else {
|
|
4429
|
+
const {
|
|
4430
|
+
up,
|
|
4431
|
+
east,
|
|
4432
|
+
north
|
|
4433
|
+
} = scratchAxisVectors;
|
|
4434
|
+
east.set(-origin.y, origin.x, 0).normalize();
|
|
4435
|
+
ellipsoid.geodeticSurfaceNormal(origin, up);
|
|
4436
|
+
north.copy(up).cross(east);
|
|
4437
|
+
const {
|
|
4438
|
+
down,
|
|
4439
|
+
west,
|
|
4440
|
+
south
|
|
4441
|
+
} = scratchAxisVectors;
|
|
4442
|
+
down.copy(up).scale(-1);
|
|
4443
|
+
west.copy(east).scale(-1);
|
|
4444
|
+
south.copy(north).scale(-1);
|
|
4445
|
+
firstAxisVector = scratchAxisVectors[firstAxis];
|
|
4446
|
+
secondAxisVector = scratchAxisVectors[secondAxis];
|
|
4447
|
+
thirdAxisVector = scratchAxisVectors[thirdAxis];
|
|
4448
|
+
}
|
|
4449
|
+
result[0] = firstAxisVector.x;
|
|
4450
|
+
result[1] = firstAxisVector.y;
|
|
4451
|
+
result[2] = firstAxisVector.z;
|
|
4452
|
+
result[3] = 0;
|
|
4453
|
+
result[4] = secondAxisVector.x;
|
|
4454
|
+
result[5] = secondAxisVector.y;
|
|
4455
|
+
result[6] = secondAxisVector.z;
|
|
4456
|
+
result[7] = 0;
|
|
4457
|
+
result[8] = thirdAxisVector.x;
|
|
4458
|
+
result[9] = thirdAxisVector.y;
|
|
4459
|
+
result[10] = thirdAxisVector.z;
|
|
4460
|
+
result[11] = 0;
|
|
4461
|
+
result[12] = origin.x;
|
|
4462
|
+
result[13] = origin.y;
|
|
4463
|
+
result[14] = origin.z;
|
|
4464
|
+
result[15] = 1;
|
|
4465
|
+
return result;
|
|
4466
|
+
}
|
|
4467
|
+
|
|
4468
|
+
// ../../node_modules/@math.gl/geospatial/dist/esm/ellipsoid/ellipsoid.js
|
|
4469
|
+
var scratchVector4 = new Vector3();
|
|
4470
|
+
var scratchNormal = new Vector3();
|
|
4471
|
+
var scratchK = new Vector3();
|
|
4472
|
+
var scratchPosition = new Vector3();
|
|
4473
|
+
var scratchHeight = new Vector3();
|
|
4474
|
+
var scratchCartesian = new Vector3();
|
|
4475
|
+
var Ellipsoid = class {
|
|
4476
|
+
constructor(x = 0, y = 0, z = 0) {
|
|
4477
|
+
_defineProperty(this, "radii", void 0);
|
|
4478
|
+
_defineProperty(this, "radiiSquared", void 0);
|
|
4479
|
+
_defineProperty(this, "radiiToTheFourth", void 0);
|
|
4480
|
+
_defineProperty(this, "oneOverRadii", void 0);
|
|
4481
|
+
_defineProperty(this, "oneOverRadiiSquared", void 0);
|
|
4482
|
+
_defineProperty(this, "minimumRadius", void 0);
|
|
4483
|
+
_defineProperty(this, "maximumRadius", void 0);
|
|
4484
|
+
_defineProperty(this, "centerToleranceSquared", math_utils_default.EPSILON1);
|
|
4485
|
+
_defineProperty(this, "squaredXOverSquaredZ", void 0);
|
|
4486
|
+
assert4(x >= 0);
|
|
4487
|
+
assert4(y >= 0);
|
|
4488
|
+
assert4(z >= 0);
|
|
4489
|
+
this.radii = new Vector3(x, y, z);
|
|
4490
|
+
this.radiiSquared = new Vector3(x * x, y * y, z * z);
|
|
4491
|
+
this.radiiToTheFourth = new Vector3(x * x * x * x, y * y * y * y, z * z * z * z);
|
|
4492
|
+
this.oneOverRadii = new Vector3(x === 0 ? 0 : 1 / x, y === 0 ? 0 : 1 / y, z === 0 ? 0 : 1 / z);
|
|
4493
|
+
this.oneOverRadiiSquared = new Vector3(x === 0 ? 0 : 1 / (x * x), y === 0 ? 0 : 1 / (y * y), z === 0 ? 0 : 1 / (z * z));
|
|
4494
|
+
this.minimumRadius = Math.min(x, y, z);
|
|
4495
|
+
this.maximumRadius = Math.max(x, y, z);
|
|
4496
|
+
if (this.radiiSquared.z !== 0) {
|
|
4497
|
+
this.squaredXOverSquaredZ = this.radiiSquared.x / this.radiiSquared.z;
|
|
4498
|
+
}
|
|
4499
|
+
Object.freeze(this);
|
|
4500
|
+
}
|
|
4501
|
+
equals(right) {
|
|
4502
|
+
return this === right || Boolean(right && this.radii.equals(right.radii));
|
|
4503
|
+
}
|
|
4504
|
+
toString() {
|
|
4505
|
+
return this.radii.toString();
|
|
4506
|
+
}
|
|
4507
|
+
cartographicToCartesian(cartographic, result = [0, 0, 0]) {
|
|
4508
|
+
const normal = scratchNormal;
|
|
4509
|
+
const k = scratchK;
|
|
4510
|
+
const [, , height] = cartographic;
|
|
4511
|
+
this.geodeticSurfaceNormalCartographic(cartographic, normal);
|
|
4512
|
+
k.copy(this.radiiSquared).scale(normal);
|
|
4513
|
+
const gamma = Math.sqrt(normal.dot(k));
|
|
4514
|
+
k.scale(1 / gamma);
|
|
4515
|
+
normal.scale(height);
|
|
4516
|
+
k.add(normal);
|
|
4517
|
+
return k.to(result);
|
|
4518
|
+
}
|
|
4519
|
+
cartesianToCartographic(cartesian, result = [0, 0, 0]) {
|
|
4520
|
+
scratchCartesian.from(cartesian);
|
|
4521
|
+
const point = this.scaleToGeodeticSurface(scratchCartesian, scratchPosition);
|
|
4522
|
+
if (!point) {
|
|
4523
|
+
return void 0;
|
|
4524
|
+
}
|
|
4525
|
+
const normal = this.geodeticSurfaceNormal(point, scratchNormal);
|
|
4526
|
+
const h = scratchHeight;
|
|
4527
|
+
h.copy(scratchCartesian).subtract(point);
|
|
4528
|
+
const longitude = Math.atan2(normal.y, normal.x);
|
|
4529
|
+
const latitude = Math.asin(normal.z);
|
|
4530
|
+
const height = Math.sign(dot(h, scratchCartesian)) * length(h);
|
|
4531
|
+
return toCartographicFromRadians([longitude, latitude, height], result);
|
|
4532
|
+
}
|
|
4533
|
+
eastNorthUpToFixedFrame(origin, result = new Matrix4()) {
|
|
4534
|
+
return localFrameToFixedFrame(this, "east", "north", "up", origin, result);
|
|
4535
|
+
}
|
|
4536
|
+
localFrameToFixedFrame(firstAxis, secondAxis, thirdAxis, origin, result = new Matrix4()) {
|
|
4537
|
+
return localFrameToFixedFrame(this, firstAxis, secondAxis, thirdAxis, origin, result);
|
|
4538
|
+
}
|
|
4539
|
+
geocentricSurfaceNormal(cartesian, result = [0, 0, 0]) {
|
|
4540
|
+
return scratchVector4.from(cartesian).normalize().to(result);
|
|
4541
|
+
}
|
|
4542
|
+
geodeticSurfaceNormalCartographic(cartographic, result = [0, 0, 0]) {
|
|
4543
|
+
const cartographicVectorRadians = fromCartographicToRadians(cartographic);
|
|
4544
|
+
const longitude = cartographicVectorRadians[0];
|
|
4545
|
+
const latitude = cartographicVectorRadians[1];
|
|
4546
|
+
const cosLatitude = Math.cos(latitude);
|
|
4547
|
+
scratchVector4.set(cosLatitude * Math.cos(longitude), cosLatitude * Math.sin(longitude), Math.sin(latitude)).normalize();
|
|
4548
|
+
return scratchVector4.to(result);
|
|
4549
|
+
}
|
|
4550
|
+
geodeticSurfaceNormal(cartesian, result = [0, 0, 0]) {
|
|
4551
|
+
return scratchVector4.from(cartesian).scale(this.oneOverRadiiSquared).normalize().to(result);
|
|
4552
|
+
}
|
|
4553
|
+
scaleToGeodeticSurface(cartesian, result) {
|
|
4554
|
+
return scaleToGeodeticSurface(cartesian, this, result);
|
|
4555
|
+
}
|
|
4556
|
+
scaleToGeocentricSurface(cartesian, result = [0, 0, 0]) {
|
|
4557
|
+
scratchPosition.from(cartesian);
|
|
4558
|
+
const positionX = scratchPosition.x;
|
|
4559
|
+
const positionY = scratchPosition.y;
|
|
4560
|
+
const positionZ = scratchPosition.z;
|
|
4561
|
+
const oneOverRadiiSquared = this.oneOverRadiiSquared;
|
|
4562
|
+
const beta = 1 / Math.sqrt(positionX * positionX * oneOverRadiiSquared.x + positionY * positionY * oneOverRadiiSquared.y + positionZ * positionZ * oneOverRadiiSquared.z);
|
|
4563
|
+
return scratchPosition.multiplyScalar(beta).to(result);
|
|
4564
|
+
}
|
|
4565
|
+
transformPositionToScaledSpace(position, result = [0, 0, 0]) {
|
|
4566
|
+
return scratchPosition.from(position).scale(this.oneOverRadii).to(result);
|
|
4567
|
+
}
|
|
4568
|
+
transformPositionFromScaledSpace(position, result = [0, 0, 0]) {
|
|
4569
|
+
return scratchPosition.from(position).scale(this.radii).to(result);
|
|
4570
|
+
}
|
|
4571
|
+
getSurfaceNormalIntersectionWithZAxis(position, buffer = 0, result = [0, 0, 0]) {
|
|
4572
|
+
assert4(equals(this.radii.x, this.radii.y, math_utils_default.EPSILON15));
|
|
4573
|
+
assert4(this.radii.z > 0);
|
|
4574
|
+
scratchPosition.from(position);
|
|
4575
|
+
const z = scratchPosition.z * (1 - this.squaredXOverSquaredZ);
|
|
4576
|
+
if (Math.abs(z) >= this.radii.z - buffer) {
|
|
4577
|
+
return void 0;
|
|
4578
|
+
}
|
|
4579
|
+
return scratchPosition.set(0, 0, z).to(result);
|
|
4580
|
+
}
|
|
4581
|
+
};
|
|
4582
|
+
_defineProperty(Ellipsoid, "WGS84", new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z));
|
|
4583
|
+
|
|
3554
4584
|
// ../images/src/lib/utils/version.ts
|
|
3555
|
-
var VERSION4 =
|
|
4585
|
+
var VERSION4 = true ? "4.0.0-alpha.11" : "latest";
|
|
3556
4586
|
|
|
3557
4587
|
// ../images/src/lib/category-api/image-type.ts
|
|
3558
4588
|
var { _parseImageNode } = globalThis;
|
|
@@ -3676,9 +4706,9 @@
|
|
|
3676
4706
|
await image.decode();
|
|
3677
4707
|
return image;
|
|
3678
4708
|
}
|
|
3679
|
-
return await new Promise((
|
|
4709
|
+
return await new Promise((resolve2, reject) => {
|
|
3680
4710
|
try {
|
|
3681
|
-
image.onload = () =>
|
|
4711
|
+
image.onload = () => resolve2(image);
|
|
3682
4712
|
image.onerror = (err) => reject(new Error(`Could not load image ${url}: ${err}`));
|
|
3683
4713
|
} catch (error) {
|
|
3684
4714
|
reject(error);
|
|
@@ -3721,12 +4751,60 @@
|
|
|
3721
4751
|
return true;
|
|
3722
4752
|
}
|
|
3723
4753
|
|
|
4754
|
+
// ../images/src/lib/category-api/parse-isobmff-binary.ts
|
|
4755
|
+
function getISOBMFFMediaType(buffer) {
|
|
4756
|
+
if (!checkString(buffer, "ftyp", 4)) {
|
|
4757
|
+
return null;
|
|
4758
|
+
}
|
|
4759
|
+
if ((buffer[8] & 96) === 0) {
|
|
4760
|
+
return null;
|
|
4761
|
+
}
|
|
4762
|
+
return decodeMajorBrand(buffer);
|
|
4763
|
+
}
|
|
4764
|
+
function decodeMajorBrand(buffer) {
|
|
4765
|
+
const brandMajor = getUTF8String(buffer, 8, 12).replace("\0", " ").trim();
|
|
4766
|
+
switch (brandMajor) {
|
|
4767
|
+
case "avif":
|
|
4768
|
+
case "avis":
|
|
4769
|
+
return { extension: "avif", mimeType: "image/avif" };
|
|
4770
|
+
default:
|
|
4771
|
+
return null;
|
|
4772
|
+
}
|
|
4773
|
+
}
|
|
4774
|
+
function getUTF8String(array, start, end) {
|
|
4775
|
+
return String.fromCharCode(...array.slice(start, end));
|
|
4776
|
+
}
|
|
4777
|
+
function stringToBytes(string) {
|
|
4778
|
+
return [...string].map((character) => character.charCodeAt(0));
|
|
4779
|
+
}
|
|
4780
|
+
function checkString(buffer, header, offset = 0) {
|
|
4781
|
+
const headerBytes = stringToBytes(header);
|
|
4782
|
+
for (let i2 = 0; i2 < headerBytes.length; ++i2) {
|
|
4783
|
+
if (headerBytes[i2] !== buffer[i2 + offset]) {
|
|
4784
|
+
return false;
|
|
4785
|
+
}
|
|
4786
|
+
}
|
|
4787
|
+
return true;
|
|
4788
|
+
}
|
|
4789
|
+
|
|
3724
4790
|
// ../images/src/lib/category-api/binary-image-api.ts
|
|
3725
4791
|
var BIG_ENDIAN = false;
|
|
3726
4792
|
var LITTLE_ENDIAN = true;
|
|
3727
4793
|
function getBinaryImageMetadata(binaryData) {
|
|
3728
4794
|
const dataView = toDataView(binaryData);
|
|
3729
|
-
return getPngMetadata(dataView) || getJpegMetadata(dataView) || getGifMetadata(dataView) || getBmpMetadata(dataView);
|
|
4795
|
+
return getPngMetadata(dataView) || getJpegMetadata(dataView) || getGifMetadata(dataView) || getBmpMetadata(dataView) || getISOBMFFMetadata(dataView);
|
|
4796
|
+
}
|
|
4797
|
+
function getISOBMFFMetadata(binaryData) {
|
|
4798
|
+
const buffer = new Uint8Array(binaryData instanceof DataView ? binaryData.buffer : binaryData);
|
|
4799
|
+
const mediaType = getISOBMFFMediaType(buffer);
|
|
4800
|
+
if (!mediaType) {
|
|
4801
|
+
return null;
|
|
4802
|
+
}
|
|
4803
|
+
return {
|
|
4804
|
+
mimeType: mediaType.mimeType,
|
|
4805
|
+
width: 0,
|
|
4806
|
+
height: 0
|
|
4807
|
+
};
|
|
3730
4808
|
}
|
|
3731
4809
|
function getPngMetadata(binaryData) {
|
|
3732
4810
|
const dataView = toDataView(binaryData);
|
|
@@ -3871,581 +4949,140 @@
|
|
|
3871
4949
|
}
|
|
3872
4950
|
|
|
3873
4951
|
// ../images/src/image-loader.ts
|
|
3874
|
-
var EXTENSIONS = ["png", "jpg", "jpeg", "gif", "webp", "bmp", "ico", "svg"];
|
|
4952
|
+
var EXTENSIONS = ["png", "jpg", "jpeg", "gif", "webp", "bmp", "ico", "svg", "avif"];
|
|
3875
4953
|
var MIME_TYPES = [
|
|
3876
4954
|
"image/png",
|
|
3877
4955
|
"image/jpeg",
|
|
3878
4956
|
"image/gif",
|
|
3879
4957
|
"image/webp",
|
|
4958
|
+
"image/avif",
|
|
3880
4959
|
"image/bmp",
|
|
3881
4960
|
"image/vnd.microsoft.icon",
|
|
3882
4961
|
"image/svg+xml"
|
|
3883
4962
|
];
|
|
3884
|
-
var DEFAULT_IMAGE_LOADER_OPTIONS = {
|
|
3885
|
-
image: {
|
|
3886
|
-
type: "auto",
|
|
3887
|
-
decode: true
|
|
3888
|
-
}
|
|
3889
|
-
};
|
|
3890
|
-
var ImageLoader = {
|
|
3891
|
-
id: "image",
|
|
3892
|
-
module: "images",
|
|
3893
|
-
name: "Images",
|
|
3894
|
-
version: VERSION4,
|
|
3895
|
-
mimeTypes: MIME_TYPES,
|
|
3896
|
-
extensions: EXTENSIONS,
|
|
3897
|
-
parse: parseImage,
|
|
3898
|
-
tests: [(arrayBuffer) => Boolean(getBinaryImageMetadata(new DataView(arrayBuffer)))],
|
|
3899
|
-
options: DEFAULT_IMAGE_LOADER_OPTIONS
|
|
3900
|
-
};
|
|
3901
|
-
|
|
3902
|
-
// ../draco/src/lib/utils/version.ts
|
|
3903
|
-
var VERSION5 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
3904
|
-
|
|
3905
|
-
// ../draco/src/draco-loader.ts
|
|
3906
|
-
var DEFAULT_DRACO_OPTIONS = {
|
|
3907
|
-
draco: {
|
|
3908
|
-
decoderType: typeof WebAssembly === "object" ? "wasm" : "js",
|
|
3909
|
-
libraryPath: "libs/",
|
|
3910
|
-
extraAttributes: {},
|
|
3911
|
-
attributeNameEntry: void 0
|
|
3912
|
-
}
|
|
3913
|
-
};
|
|
3914
|
-
var DracoLoader = {
|
|
3915
|
-
name: "Draco",
|
|
3916
|
-
id: "draco",
|
|
3917
|
-
module: "draco",
|
|
3918
|
-
shapes: ["mesh"],
|
|
3919
|
-
version: VERSION5,
|
|
3920
|
-
worker: true,
|
|
3921
|
-
extensions: ["drc"],
|
|
3922
|
-
mimeTypes: ["application/octet-stream"],
|
|
3923
|
-
binary: true,
|
|
3924
|
-
tests: ["DRACO"],
|
|
3925
|
-
options: DEFAULT_DRACO_OPTIONS
|
|
3926
|
-
};
|
|
3927
|
-
|
|
3928
|
-
// ../schema/src/category/mesh/mesh-utils.ts
|
|
3929
|
-
function getMeshBoundingBox(attributes) {
|
|
3930
|
-
let minX = Infinity;
|
|
3931
|
-
let minY = Infinity;
|
|
3932
|
-
let minZ = Infinity;
|
|
3933
|
-
let maxX = -Infinity;
|
|
3934
|
-
let maxY = -Infinity;
|
|
3935
|
-
let maxZ = -Infinity;
|
|
3936
|
-
const positions = attributes.POSITION ? attributes.POSITION.value : [];
|
|
3937
|
-
const len = positions && positions.length;
|
|
3938
|
-
for (let i2 = 0; i2 < len; i2 += 3) {
|
|
3939
|
-
const x = positions[i2];
|
|
3940
|
-
const y = positions[i2 + 1];
|
|
3941
|
-
const z = positions[i2 + 2];
|
|
3942
|
-
minX = x < minX ? x : minX;
|
|
3943
|
-
minY = y < minY ? y : minY;
|
|
3944
|
-
minZ = z < minZ ? z : minZ;
|
|
3945
|
-
maxX = x > maxX ? x : maxX;
|
|
3946
|
-
maxY = y > maxY ? y : maxY;
|
|
3947
|
-
maxZ = z > maxZ ? z : maxZ;
|
|
3948
|
-
}
|
|
3949
|
-
return [
|
|
3950
|
-
[minX, minY, minZ],
|
|
3951
|
-
[maxX, maxY, maxZ]
|
|
3952
|
-
];
|
|
3953
|
-
}
|
|
3954
|
-
|
|
3955
|
-
// ../schema/src/lib/utils/assert.ts
|
|
3956
|
-
function assert5(condition, message) {
|
|
3957
|
-
if (!condition) {
|
|
3958
|
-
throw new Error(message || "loader assertion failed.");
|
|
3959
|
-
}
|
|
3960
|
-
}
|
|
3961
|
-
|
|
3962
|
-
// ../schema/src/lib/schema/impl/schema.ts
|
|
3963
|
-
var Schema = class {
|
|
3964
|
-
constructor(fields, metadata) {
|
|
3965
|
-
assert5(Array.isArray(fields));
|
|
3966
|
-
checkNames(fields);
|
|
3967
|
-
this.fields = fields;
|
|
3968
|
-
this.metadata = metadata || new Map();
|
|
3969
|
-
}
|
|
3970
|
-
compareTo(other) {
|
|
3971
|
-
if (this.metadata !== other.metadata) {
|
|
3972
|
-
return false;
|
|
3973
|
-
}
|
|
3974
|
-
if (this.fields.length !== other.fields.length) {
|
|
3975
|
-
return false;
|
|
3976
|
-
}
|
|
3977
|
-
for (let i2 = 0; i2 < this.fields.length; ++i2) {
|
|
3978
|
-
if (!this.fields[i2].compareTo(other.fields[i2])) {
|
|
3979
|
-
return false;
|
|
3980
|
-
}
|
|
3981
|
-
}
|
|
3982
|
-
return true;
|
|
3983
|
-
}
|
|
3984
|
-
select(...columnNames) {
|
|
3985
|
-
const nameMap = Object.create(null);
|
|
3986
|
-
for (const name of columnNames) {
|
|
3987
|
-
nameMap[name] = true;
|
|
3988
|
-
}
|
|
3989
|
-
const selectedFields = this.fields.filter((field) => nameMap[field.name]);
|
|
3990
|
-
return new Schema(selectedFields, this.metadata);
|
|
3991
|
-
}
|
|
3992
|
-
selectAt(...columnIndices) {
|
|
3993
|
-
const selectedFields = columnIndices.map((index) => this.fields[index]).filter(Boolean);
|
|
3994
|
-
return new Schema(selectedFields, this.metadata);
|
|
3995
|
-
}
|
|
3996
|
-
assign(schemaOrFields) {
|
|
3997
|
-
let fields;
|
|
3998
|
-
let metadata = this.metadata;
|
|
3999
|
-
if (schemaOrFields instanceof Schema) {
|
|
4000
|
-
const otherSchema = schemaOrFields;
|
|
4001
|
-
fields = otherSchema.fields;
|
|
4002
|
-
metadata = mergeMaps(mergeMaps(new Map(), this.metadata), otherSchema.metadata);
|
|
4003
|
-
} else {
|
|
4004
|
-
fields = schemaOrFields;
|
|
4005
|
-
}
|
|
4006
|
-
const fieldMap = Object.create(null);
|
|
4007
|
-
for (const field of this.fields) {
|
|
4008
|
-
fieldMap[field.name] = field;
|
|
4009
|
-
}
|
|
4010
|
-
for (const field of fields) {
|
|
4011
|
-
fieldMap[field.name] = field;
|
|
4012
|
-
}
|
|
4013
|
-
const mergedFields = Object.values(fieldMap);
|
|
4014
|
-
return new Schema(mergedFields, metadata);
|
|
4015
|
-
}
|
|
4016
|
-
};
|
|
4017
|
-
function checkNames(fields) {
|
|
4018
|
-
const usedNames = {};
|
|
4019
|
-
for (const field of fields) {
|
|
4020
|
-
if (usedNames[field.name]) {
|
|
4021
|
-
console.warn("Schema: duplicated field name", field.name, field);
|
|
4022
|
-
}
|
|
4023
|
-
usedNames[field.name] = true;
|
|
4024
|
-
}
|
|
4025
|
-
}
|
|
4026
|
-
function mergeMaps(m1, m2) {
|
|
4027
|
-
return new Map([...m1 || new Map(), ...m2 || new Map()]);
|
|
4028
|
-
}
|
|
4029
|
-
|
|
4030
|
-
// ../schema/src/lib/schema/impl/field.ts
|
|
4031
|
-
var Field = class {
|
|
4032
|
-
constructor(name, type, nullable = false, metadata = new Map()) {
|
|
4033
|
-
this.name = name;
|
|
4034
|
-
this.type = type;
|
|
4035
|
-
this.nullable = nullable;
|
|
4036
|
-
this.metadata = metadata;
|
|
4037
|
-
}
|
|
4038
|
-
get typeId() {
|
|
4039
|
-
return this.type && this.type.typeId;
|
|
4040
|
-
}
|
|
4041
|
-
clone() {
|
|
4042
|
-
return new Field(this.name, this.type, this.nullable, this.metadata);
|
|
4043
|
-
}
|
|
4044
|
-
compareTo(other) {
|
|
4045
|
-
return this.name === other.name && this.type === other.type && this.nullable === other.nullable && this.metadata === other.metadata;
|
|
4046
|
-
}
|
|
4047
|
-
toString() {
|
|
4048
|
-
return `${this.type}${this.nullable ? ", nullable" : ""}${this.metadata ? `, metadata: ${this.metadata}` : ""}`;
|
|
4049
|
-
}
|
|
4050
|
-
};
|
|
4051
|
-
|
|
4052
|
-
// ../schema/src/lib/schema/impl/enum.ts
|
|
4053
|
-
var Type;
|
|
4054
|
-
(function(Type2) {
|
|
4055
|
-
Type2[Type2["NONE"] = 0] = "NONE";
|
|
4056
|
-
Type2[Type2["Null"] = 1] = "Null";
|
|
4057
|
-
Type2[Type2["Int"] = 2] = "Int";
|
|
4058
|
-
Type2[Type2["Float"] = 3] = "Float";
|
|
4059
|
-
Type2[Type2["Binary"] = 4] = "Binary";
|
|
4060
|
-
Type2[Type2["Utf8"] = 5] = "Utf8";
|
|
4061
|
-
Type2[Type2["Bool"] = 6] = "Bool";
|
|
4062
|
-
Type2[Type2["Decimal"] = 7] = "Decimal";
|
|
4063
|
-
Type2[Type2["Date"] = 8] = "Date";
|
|
4064
|
-
Type2[Type2["Time"] = 9] = "Time";
|
|
4065
|
-
Type2[Type2["Timestamp"] = 10] = "Timestamp";
|
|
4066
|
-
Type2[Type2["Interval"] = 11] = "Interval";
|
|
4067
|
-
Type2[Type2["List"] = 12] = "List";
|
|
4068
|
-
Type2[Type2["Struct"] = 13] = "Struct";
|
|
4069
|
-
Type2[Type2["Union"] = 14] = "Union";
|
|
4070
|
-
Type2[Type2["FixedSizeBinary"] = 15] = "FixedSizeBinary";
|
|
4071
|
-
Type2[Type2["FixedSizeList"] = 16] = "FixedSizeList";
|
|
4072
|
-
Type2[Type2["Map"] = 17] = "Map";
|
|
4073
|
-
Type2[Type2["Dictionary"] = -1] = "Dictionary";
|
|
4074
|
-
Type2[Type2["Int8"] = -2] = "Int8";
|
|
4075
|
-
Type2[Type2["Int16"] = -3] = "Int16";
|
|
4076
|
-
Type2[Type2["Int32"] = -4] = "Int32";
|
|
4077
|
-
Type2[Type2["Int64"] = -5] = "Int64";
|
|
4078
|
-
Type2[Type2["Uint8"] = -6] = "Uint8";
|
|
4079
|
-
Type2[Type2["Uint16"] = -7] = "Uint16";
|
|
4080
|
-
Type2[Type2["Uint32"] = -8] = "Uint32";
|
|
4081
|
-
Type2[Type2["Uint64"] = -9] = "Uint64";
|
|
4082
|
-
Type2[Type2["Float16"] = -10] = "Float16";
|
|
4083
|
-
Type2[Type2["Float32"] = -11] = "Float32";
|
|
4084
|
-
Type2[Type2["Float64"] = -12] = "Float64";
|
|
4085
|
-
Type2[Type2["DateDay"] = -13] = "DateDay";
|
|
4086
|
-
Type2[Type2["DateMillisecond"] = -14] = "DateMillisecond";
|
|
4087
|
-
Type2[Type2["TimestampSecond"] = -15] = "TimestampSecond";
|
|
4088
|
-
Type2[Type2["TimestampMillisecond"] = -16] = "TimestampMillisecond";
|
|
4089
|
-
Type2[Type2["TimestampMicrosecond"] = -17] = "TimestampMicrosecond";
|
|
4090
|
-
Type2[Type2["TimestampNanosecond"] = -18] = "TimestampNanosecond";
|
|
4091
|
-
Type2[Type2["TimeSecond"] = -19] = "TimeSecond";
|
|
4092
|
-
Type2[Type2["TimeMillisecond"] = -20] = "TimeMillisecond";
|
|
4093
|
-
Type2[Type2["TimeMicrosecond"] = -21] = "TimeMicrosecond";
|
|
4094
|
-
Type2[Type2["TimeNanosecond"] = -22] = "TimeNanosecond";
|
|
4095
|
-
Type2[Type2["DenseUnion"] = -23] = "DenseUnion";
|
|
4096
|
-
Type2[Type2["SparseUnion"] = -24] = "SparseUnion";
|
|
4097
|
-
Type2[Type2["IntervalDayTime"] = -25] = "IntervalDayTime";
|
|
4098
|
-
Type2[Type2["IntervalYearMonth"] = -26] = "IntervalYearMonth";
|
|
4099
|
-
})(Type || (Type = {}));
|
|
4100
|
-
|
|
4101
|
-
// ../schema/src/lib/schema/impl/type.ts
|
|
4102
|
-
var DataType = class {
|
|
4103
|
-
static isNull(x) {
|
|
4104
|
-
return x && x.typeId === Type.Null;
|
|
4105
|
-
}
|
|
4106
|
-
static isInt(x) {
|
|
4107
|
-
return x && x.typeId === Type.Int;
|
|
4108
|
-
}
|
|
4109
|
-
static isFloat(x) {
|
|
4110
|
-
return x && x.typeId === Type.Float;
|
|
4111
|
-
}
|
|
4112
|
-
static isBinary(x) {
|
|
4113
|
-
return x && x.typeId === Type.Binary;
|
|
4114
|
-
}
|
|
4115
|
-
static isUtf8(x) {
|
|
4116
|
-
return x && x.typeId === Type.Utf8;
|
|
4117
|
-
}
|
|
4118
|
-
static isBool(x) {
|
|
4119
|
-
return x && x.typeId === Type.Bool;
|
|
4120
|
-
}
|
|
4121
|
-
static isDecimal(x) {
|
|
4122
|
-
return x && x.typeId === Type.Decimal;
|
|
4123
|
-
}
|
|
4124
|
-
static isDate(x) {
|
|
4125
|
-
return x && x.typeId === Type.Date;
|
|
4126
|
-
}
|
|
4127
|
-
static isTime(x) {
|
|
4128
|
-
return x && x.typeId === Type.Time;
|
|
4129
|
-
}
|
|
4130
|
-
static isTimestamp(x) {
|
|
4131
|
-
return x && x.typeId === Type.Timestamp;
|
|
4132
|
-
}
|
|
4133
|
-
static isInterval(x) {
|
|
4134
|
-
return x && x.typeId === Type.Interval;
|
|
4135
|
-
}
|
|
4136
|
-
static isList(x) {
|
|
4137
|
-
return x && x.typeId === Type.List;
|
|
4138
|
-
}
|
|
4139
|
-
static isStruct(x) {
|
|
4140
|
-
return x && x.typeId === Type.Struct;
|
|
4141
|
-
}
|
|
4142
|
-
static isUnion(x) {
|
|
4143
|
-
return x && x.typeId === Type.Union;
|
|
4144
|
-
}
|
|
4145
|
-
static isFixedSizeBinary(x) {
|
|
4146
|
-
return x && x.typeId === Type.FixedSizeBinary;
|
|
4147
|
-
}
|
|
4148
|
-
static isFixedSizeList(x) {
|
|
4149
|
-
return x && x.typeId === Type.FixedSizeList;
|
|
4150
|
-
}
|
|
4151
|
-
static isMap(x) {
|
|
4152
|
-
return x && x.typeId === Type.Map;
|
|
4153
|
-
}
|
|
4154
|
-
static isDictionary(x) {
|
|
4155
|
-
return x && x.typeId === Type.Dictionary;
|
|
4156
|
-
}
|
|
4157
|
-
get typeId() {
|
|
4158
|
-
return Type.NONE;
|
|
4159
|
-
}
|
|
4160
|
-
compareTo(other) {
|
|
4161
|
-
return this === other;
|
|
4162
|
-
}
|
|
4163
|
-
};
|
|
4164
|
-
var Null = class extends DataType {
|
|
4165
|
-
get typeId() {
|
|
4166
|
-
return Type.Null;
|
|
4167
|
-
}
|
|
4168
|
-
get [Symbol.toStringTag]() {
|
|
4169
|
-
return "Null";
|
|
4170
|
-
}
|
|
4171
|
-
toString() {
|
|
4172
|
-
return "Null";
|
|
4173
|
-
}
|
|
4174
|
-
};
|
|
4175
|
-
var Bool = class extends DataType {
|
|
4176
|
-
get typeId() {
|
|
4177
|
-
return Type.Bool;
|
|
4178
|
-
}
|
|
4179
|
-
get [Symbol.toStringTag]() {
|
|
4180
|
-
return "Bool";
|
|
4181
|
-
}
|
|
4182
|
-
toString() {
|
|
4183
|
-
return "Bool";
|
|
4184
|
-
}
|
|
4185
|
-
};
|
|
4186
|
-
var Int = class extends DataType {
|
|
4187
|
-
constructor(isSigned, bitWidth) {
|
|
4188
|
-
super();
|
|
4189
|
-
this.isSigned = isSigned;
|
|
4190
|
-
this.bitWidth = bitWidth;
|
|
4191
|
-
}
|
|
4192
|
-
get typeId() {
|
|
4193
|
-
return Type.Int;
|
|
4194
|
-
}
|
|
4195
|
-
get [Symbol.toStringTag]() {
|
|
4196
|
-
return "Int";
|
|
4197
|
-
}
|
|
4198
|
-
toString() {
|
|
4199
|
-
return `${this.isSigned ? "I" : "Ui"}nt${this.bitWidth}`;
|
|
4200
|
-
}
|
|
4201
|
-
};
|
|
4202
|
-
var Int8 = class extends Int {
|
|
4203
|
-
constructor() {
|
|
4204
|
-
super(true, 8);
|
|
4205
|
-
}
|
|
4206
|
-
};
|
|
4207
|
-
var Int16 = class extends Int {
|
|
4208
|
-
constructor() {
|
|
4209
|
-
super(true, 16);
|
|
4210
|
-
}
|
|
4211
|
-
};
|
|
4212
|
-
var Int32 = class extends Int {
|
|
4213
|
-
constructor() {
|
|
4214
|
-
super(true, 32);
|
|
4215
|
-
}
|
|
4216
|
-
};
|
|
4217
|
-
var Uint8 = class extends Int {
|
|
4218
|
-
constructor() {
|
|
4219
|
-
super(false, 8);
|
|
4220
|
-
}
|
|
4221
|
-
};
|
|
4222
|
-
var Uint16 = class extends Int {
|
|
4223
|
-
constructor() {
|
|
4224
|
-
super(false, 16);
|
|
4225
|
-
}
|
|
4226
|
-
};
|
|
4227
|
-
var Uint32 = class extends Int {
|
|
4228
|
-
constructor() {
|
|
4229
|
-
super(false, 32);
|
|
4230
|
-
}
|
|
4231
|
-
};
|
|
4232
|
-
var Precision = {
|
|
4233
|
-
HALF: 16,
|
|
4234
|
-
SINGLE: 32,
|
|
4235
|
-
DOUBLE: 64
|
|
4236
|
-
};
|
|
4237
|
-
var Float = class extends DataType {
|
|
4238
|
-
constructor(precision) {
|
|
4239
|
-
super();
|
|
4240
|
-
this.precision = precision;
|
|
4241
|
-
}
|
|
4242
|
-
get typeId() {
|
|
4243
|
-
return Type.Float;
|
|
4244
|
-
}
|
|
4245
|
-
get [Symbol.toStringTag]() {
|
|
4246
|
-
return "Float";
|
|
4247
|
-
}
|
|
4248
|
-
toString() {
|
|
4249
|
-
return `Float${this.precision}`;
|
|
4250
|
-
}
|
|
4251
|
-
};
|
|
4252
|
-
var Float32 = class extends Float {
|
|
4253
|
-
constructor() {
|
|
4254
|
-
super(Precision.SINGLE);
|
|
4255
|
-
}
|
|
4256
|
-
};
|
|
4257
|
-
var Float64 = class extends Float {
|
|
4258
|
-
constructor() {
|
|
4259
|
-
super(Precision.DOUBLE);
|
|
4260
|
-
}
|
|
4261
|
-
};
|
|
4262
|
-
var Binary = class extends DataType {
|
|
4263
|
-
constructor() {
|
|
4264
|
-
super();
|
|
4265
|
-
}
|
|
4266
|
-
get typeId() {
|
|
4267
|
-
return Type.Binary;
|
|
4268
|
-
}
|
|
4269
|
-
toString() {
|
|
4270
|
-
return "Binary";
|
|
4271
|
-
}
|
|
4272
|
-
get [Symbol.toStringTag]() {
|
|
4273
|
-
return "Binary";
|
|
4274
|
-
}
|
|
4275
|
-
};
|
|
4276
|
-
var Utf8 = class extends DataType {
|
|
4277
|
-
get typeId() {
|
|
4278
|
-
return Type.Utf8;
|
|
4279
|
-
}
|
|
4280
|
-
get [Symbol.toStringTag]() {
|
|
4281
|
-
return "Utf8";
|
|
4282
|
-
}
|
|
4283
|
-
toString() {
|
|
4284
|
-
return "Utf8";
|
|
4285
|
-
}
|
|
4286
|
-
};
|
|
4287
|
-
var DateUnit = {
|
|
4288
|
-
DAY: 0,
|
|
4289
|
-
MILLISECOND: 1
|
|
4290
|
-
};
|
|
4291
|
-
var Date2 = class extends DataType {
|
|
4292
|
-
constructor(unit) {
|
|
4293
|
-
super();
|
|
4294
|
-
this.unit = unit;
|
|
4295
|
-
}
|
|
4296
|
-
get typeId() {
|
|
4297
|
-
return Type.Date;
|
|
4298
|
-
}
|
|
4299
|
-
get [Symbol.toStringTag]() {
|
|
4300
|
-
return "Date";
|
|
4301
|
-
}
|
|
4302
|
-
toString() {
|
|
4303
|
-
return `Date${(this.unit + 1) * 32}<${DateUnit[this.unit]}>`;
|
|
4304
|
-
}
|
|
4305
|
-
};
|
|
4306
|
-
var TimeUnit = {
|
|
4307
|
-
SECOND: 1,
|
|
4308
|
-
MILLISECOND: 1e3,
|
|
4309
|
-
MICROSECOND: 1e6,
|
|
4310
|
-
NANOSECOND: 1e9
|
|
4311
|
-
};
|
|
4312
|
-
var Time = class extends DataType {
|
|
4313
|
-
constructor(unit, bitWidth) {
|
|
4314
|
-
super();
|
|
4315
|
-
this.unit = unit;
|
|
4316
|
-
this.bitWidth = bitWidth;
|
|
4317
|
-
}
|
|
4318
|
-
get typeId() {
|
|
4319
|
-
return Type.Time;
|
|
4320
|
-
}
|
|
4321
|
-
toString() {
|
|
4322
|
-
return `Time${this.bitWidth}<${TimeUnit[this.unit]}>`;
|
|
4323
|
-
}
|
|
4324
|
-
get [Symbol.toStringTag]() {
|
|
4325
|
-
return "Time";
|
|
4326
|
-
}
|
|
4327
|
-
};
|
|
4328
|
-
var Timestamp = class extends DataType {
|
|
4329
|
-
constructor(unit, timezone = null) {
|
|
4330
|
-
super();
|
|
4331
|
-
this.unit = unit;
|
|
4332
|
-
this.timezone = timezone;
|
|
4333
|
-
}
|
|
4334
|
-
get typeId() {
|
|
4335
|
-
return Type.Timestamp;
|
|
4336
|
-
}
|
|
4337
|
-
get [Symbol.toStringTag]() {
|
|
4338
|
-
return "Timestamp";
|
|
4339
|
-
}
|
|
4340
|
-
toString() {
|
|
4341
|
-
return `Timestamp<${TimeUnit[this.unit]}${this.timezone ? `, ${this.timezone}` : ""}>`;
|
|
4342
|
-
}
|
|
4343
|
-
};
|
|
4344
|
-
var IntervalUnit = {
|
|
4345
|
-
DAY_TIME: 0,
|
|
4346
|
-
YEAR_MONTH: 1
|
|
4347
|
-
};
|
|
4348
|
-
var Interval = class extends DataType {
|
|
4349
|
-
constructor(unit) {
|
|
4350
|
-
super();
|
|
4351
|
-
this.unit = unit;
|
|
4352
|
-
}
|
|
4353
|
-
get typeId() {
|
|
4354
|
-
return Type.Interval;
|
|
4355
|
-
}
|
|
4356
|
-
get [Symbol.toStringTag]() {
|
|
4357
|
-
return "Interval";
|
|
4358
|
-
}
|
|
4359
|
-
toString() {
|
|
4360
|
-
return `Interval<${IntervalUnit[this.unit]}>`;
|
|
4963
|
+
var DEFAULT_IMAGE_LOADER_OPTIONS = {
|
|
4964
|
+
image: {
|
|
4965
|
+
type: "auto",
|
|
4966
|
+
decode: true
|
|
4361
4967
|
}
|
|
4362
4968
|
};
|
|
4363
|
-
var
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
return this.children[0].type;
|
|
4374
|
-
}
|
|
4375
|
-
get valueField() {
|
|
4376
|
-
return this.children[0];
|
|
4377
|
-
}
|
|
4378
|
-
get [Symbol.toStringTag]() {
|
|
4379
|
-
return "FixedSizeList";
|
|
4380
|
-
}
|
|
4381
|
-
toString() {
|
|
4382
|
-
return `FixedSizeList[${this.listSize}]<${this.valueType}>`;
|
|
4383
|
-
}
|
|
4969
|
+
var ImageLoader = {
|
|
4970
|
+
id: "image",
|
|
4971
|
+
module: "images",
|
|
4972
|
+
name: "Images",
|
|
4973
|
+
version: VERSION4,
|
|
4974
|
+
mimeTypes: MIME_TYPES,
|
|
4975
|
+
extensions: EXTENSIONS,
|
|
4976
|
+
parse: parseImage,
|
|
4977
|
+
tests: [(arrayBuffer) => Boolean(getBinaryImageMetadata(new DataView(arrayBuffer)))],
|
|
4978
|
+
options: DEFAULT_IMAGE_LOADER_OPTIONS
|
|
4384
4979
|
};
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
get [Symbol.toStringTag]() {
|
|
4397
|
-
return "Struct";
|
|
4980
|
+
|
|
4981
|
+
// ../draco/src/lib/utils/version.ts
|
|
4982
|
+
var VERSION5 = true ? "4.0.0-alpha.11" : "latest";
|
|
4983
|
+
|
|
4984
|
+
// ../draco/src/draco-loader.ts
|
|
4985
|
+
var DEFAULT_DRACO_OPTIONS = {
|
|
4986
|
+
draco: {
|
|
4987
|
+
decoderType: typeof WebAssembly === "object" ? "wasm" : "js",
|
|
4988
|
+
libraryPath: "libs/",
|
|
4989
|
+
extraAttributes: {},
|
|
4990
|
+
attributeNameEntry: void 0
|
|
4398
4991
|
}
|
|
4399
4992
|
};
|
|
4993
|
+
var DracoLoader = {
|
|
4994
|
+
name: "Draco",
|
|
4995
|
+
id: "draco",
|
|
4996
|
+
module: "draco",
|
|
4997
|
+
version: VERSION5,
|
|
4998
|
+
worker: true,
|
|
4999
|
+
extensions: ["drc"],
|
|
5000
|
+
mimeTypes: ["application/octet-stream"],
|
|
5001
|
+
binary: true,
|
|
5002
|
+
tests: ["DRACO"],
|
|
5003
|
+
options: DEFAULT_DRACO_OPTIONS
|
|
5004
|
+
};
|
|
4400
5005
|
|
|
4401
|
-
// ../schema/src/lib/
|
|
4402
|
-
function
|
|
5006
|
+
// ../schema/src/lib/table/simple-table/data-type.ts
|
|
5007
|
+
function getDataTypeFromTypedArray(array) {
|
|
4403
5008
|
switch (array.constructor) {
|
|
4404
5009
|
case Int8Array:
|
|
4405
|
-
return
|
|
5010
|
+
return "int8";
|
|
4406
5011
|
case Uint8Array:
|
|
4407
|
-
|
|
5012
|
+
case Uint8ClampedArray:
|
|
5013
|
+
return "uint8";
|
|
4408
5014
|
case Int16Array:
|
|
4409
|
-
return
|
|
5015
|
+
return "int16";
|
|
4410
5016
|
case Uint16Array:
|
|
4411
|
-
return
|
|
5017
|
+
return "uint16";
|
|
4412
5018
|
case Int32Array:
|
|
4413
|
-
return
|
|
5019
|
+
return "int32";
|
|
4414
5020
|
case Uint32Array:
|
|
4415
|
-
return
|
|
5021
|
+
return "uint32";
|
|
4416
5022
|
case Float32Array:
|
|
4417
|
-
return
|
|
5023
|
+
return "float32";
|
|
4418
5024
|
case Float64Array:
|
|
4419
|
-
return
|
|
5025
|
+
return "float64";
|
|
4420
5026
|
default:
|
|
4421
|
-
|
|
5027
|
+
return "null";
|
|
5028
|
+
}
|
|
5029
|
+
}
|
|
5030
|
+
|
|
5031
|
+
// ../schema/src/lib/mesh/mesh-utils.ts
|
|
5032
|
+
function getMeshBoundingBox(attributes) {
|
|
5033
|
+
let minX = Infinity;
|
|
5034
|
+
let minY = Infinity;
|
|
5035
|
+
let minZ = Infinity;
|
|
5036
|
+
let maxX = -Infinity;
|
|
5037
|
+
let maxY = -Infinity;
|
|
5038
|
+
let maxZ = -Infinity;
|
|
5039
|
+
const positions = attributes.POSITION ? attributes.POSITION.value : [];
|
|
5040
|
+
const len = positions && positions.length;
|
|
5041
|
+
for (let i2 = 0; i2 < len; i2 += 3) {
|
|
5042
|
+
const x = positions[i2];
|
|
5043
|
+
const y = positions[i2 + 1];
|
|
5044
|
+
const z = positions[i2 + 2];
|
|
5045
|
+
minX = x < minX ? x : minX;
|
|
5046
|
+
minY = y < minY ? y : minY;
|
|
5047
|
+
minZ = z < minZ ? z : minZ;
|
|
5048
|
+
maxX = x > maxX ? x : maxX;
|
|
5049
|
+
maxY = y > maxY ? y : maxY;
|
|
5050
|
+
maxZ = z > maxZ ? z : maxZ;
|
|
4422
5051
|
}
|
|
5052
|
+
return [
|
|
5053
|
+
[minX, minY, minZ],
|
|
5054
|
+
[maxX, maxY, maxZ]
|
|
5055
|
+
];
|
|
4423
5056
|
}
|
|
4424
5057
|
|
|
4425
|
-
// ../schema/src/
|
|
4426
|
-
function deduceMeshField(
|
|
4427
|
-
const type =
|
|
5058
|
+
// ../schema/src/lib/mesh/deduce-mesh-schema.ts
|
|
5059
|
+
function deduceMeshField(name, attribute, optionalMetadata) {
|
|
5060
|
+
const type = getDataTypeFromTypedArray(attribute.value);
|
|
4428
5061
|
const metadata = optionalMetadata ? optionalMetadata : makeMeshAttributeMetadata(attribute);
|
|
4429
|
-
|
|
4430
|
-
|
|
5062
|
+
return {
|
|
5063
|
+
name,
|
|
5064
|
+
type: { type: "fixed-size-list", listSize: attribute.size, children: [{ name: "value", type }] },
|
|
5065
|
+
nullable: false,
|
|
5066
|
+
metadata
|
|
5067
|
+
};
|
|
4431
5068
|
}
|
|
4432
5069
|
function makeMeshAttributeMetadata(attribute) {
|
|
4433
|
-
const result =
|
|
5070
|
+
const result = {};
|
|
4434
5071
|
if ("byteOffset" in attribute) {
|
|
4435
|
-
result.
|
|
5072
|
+
result.byteOffset = attribute.byteOffset.toString(10);
|
|
4436
5073
|
}
|
|
4437
5074
|
if ("byteStride" in attribute) {
|
|
4438
|
-
result.
|
|
5075
|
+
result.byteStride = attribute.byteStride.toString(10);
|
|
4439
5076
|
}
|
|
4440
5077
|
if ("normalized" in attribute) {
|
|
4441
|
-
result.
|
|
5078
|
+
result.normalized = attribute.normalized.toString();
|
|
4442
5079
|
}
|
|
4443
5080
|
return result;
|
|
4444
5081
|
}
|
|
4445
5082
|
|
|
4446
5083
|
// ../draco/src/lib/utils/get-draco-schema.ts
|
|
4447
5084
|
function getDracoSchema(attributes, loaderData, indices) {
|
|
4448
|
-
const
|
|
5085
|
+
const metadata = makeMetadata(loaderData.metadata);
|
|
4449
5086
|
const fields = [];
|
|
4450
5087
|
const namedLoaderDataAttributes = transformAttributesLoaderData(loaderData.attributes);
|
|
4451
5088
|
for (const attributeName in attributes) {
|
|
@@ -4457,7 +5094,7 @@
|
|
|
4457
5094
|
const indicesField = getArrowFieldFromAttribute("indices", indices);
|
|
4458
5095
|
fields.push(indicesField);
|
|
4459
5096
|
}
|
|
4460
|
-
return
|
|
5097
|
+
return { fields, metadata };
|
|
4461
5098
|
}
|
|
4462
5099
|
function transformAttributesLoaderData(loaderData) {
|
|
4463
5100
|
const result = {};
|
|
@@ -4473,11 +5110,12 @@
|
|
|
4473
5110
|
return field;
|
|
4474
5111
|
}
|
|
4475
5112
|
function makeMetadata(metadata) {
|
|
4476
|
-
|
|
5113
|
+
Object.entries(metadata);
|
|
5114
|
+
const serializedMetadata = {};
|
|
4477
5115
|
for (const key in metadata) {
|
|
4478
|
-
|
|
5116
|
+
serializedMetadata[`${key}.string`] = JSON.stringify(metadata[key]);
|
|
4479
5117
|
}
|
|
4480
|
-
return
|
|
5118
|
+
return serializedMetadata;
|
|
4481
5119
|
}
|
|
4482
5120
|
|
|
4483
5121
|
// ../draco/src/lib/draco-parser.ts
|
|
@@ -4821,11 +5459,13 @@
|
|
|
4821
5459
|
}
|
|
4822
5460
|
|
|
4823
5461
|
// ../draco/src/lib/draco-module-loader.ts
|
|
4824
|
-
var
|
|
4825
|
-
var
|
|
4826
|
-
var
|
|
4827
|
-
var
|
|
4828
|
-
var
|
|
5462
|
+
var DRACO_DECODER_VERSION = "1.5.5";
|
|
5463
|
+
var DRACO_ENCODER_VERSION = "1.4.1";
|
|
5464
|
+
var STATIC_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_DECODER_VERSION}`;
|
|
5465
|
+
var DRACO_JS_DECODER_URL = `${STATIC_DECODER_URL}/draco_decoder.js`;
|
|
5466
|
+
var DRACO_WASM_WRAPPER_URL = `${STATIC_DECODER_URL}/draco_wasm_wrapper.js`;
|
|
5467
|
+
var DRACO_WASM_DECODER_URL = `${STATIC_DECODER_URL}/draco_decoder.wasm`;
|
|
5468
|
+
var DRACO_ENCODER_URL = `https://raw.githubusercontent.com/google/draco/${DRACO_ENCODER_VERSION}/javascript/draco_encoder.js`;
|
|
4829
5469
|
var loadDecoderPromise;
|
|
4830
5470
|
async function loadDracoDecoderModule(options) {
|
|
4831
5471
|
const modules = options.modules || {};
|
|
@@ -4860,10 +5500,10 @@
|
|
|
4860
5500
|
if (wasmBinary) {
|
|
4861
5501
|
options.wasmBinary = wasmBinary;
|
|
4862
5502
|
}
|
|
4863
|
-
return new Promise((
|
|
5503
|
+
return new Promise((resolve2) => {
|
|
4864
5504
|
DracoDecoderModule({
|
|
4865
5505
|
...options,
|
|
4866
|
-
onModuleLoaded: (draco) =>
|
|
5506
|
+
onModuleLoaded: (draco) => resolve2({ draco })
|
|
4867
5507
|
});
|
|
4868
5508
|
});
|
|
4869
5509
|
}
|
|
@@ -4884,10 +5524,10 @@
|
|
|
4884
5524
|
}
|
|
4885
5525
|
|
|
4886
5526
|
// ../textures/src/lib/utils/version.ts
|
|
4887
|
-
var VERSION6 =
|
|
5527
|
+
var VERSION6 = true ? "4.0.0-alpha.11" : "beta";
|
|
4888
5528
|
|
|
4889
5529
|
// ../textures/src/lib/parsers/basis-module-loader.ts
|
|
4890
|
-
var VERSION7 =
|
|
5530
|
+
var VERSION7 = true ? "4.0.0-alpha.11" : "beta";
|
|
4891
5531
|
var BASIS_CDN_ENCODER_WASM = `https://unpkg.com/@loaders.gl/textures@${VERSION7}/dist/libs/basis_encoder.wasm`;
|
|
4892
5532
|
var BASIS_CDN_ENCODER_JS = `https://unpkg.com/@loaders.gl/textures@${VERSION7}/dist/libs/basis_encoder.js`;
|
|
4893
5533
|
var loadBasisTranscoderPromise;
|
|
@@ -4914,11 +5554,11 @@
|
|
|
4914
5554
|
if (wasmBinary) {
|
|
4915
5555
|
options.wasmBinary = wasmBinary;
|
|
4916
5556
|
}
|
|
4917
|
-
return new Promise((
|
|
4918
|
-
BasisModule(options).then((
|
|
4919
|
-
const { BasisFile, initializeBasis } =
|
|
5557
|
+
return new Promise((resolve2) => {
|
|
5558
|
+
BasisModule(options).then((module) => {
|
|
5559
|
+
const { BasisFile, initializeBasis } = module;
|
|
4920
5560
|
initializeBasis();
|
|
4921
|
-
|
|
5561
|
+
resolve2({ BasisFile });
|
|
4922
5562
|
});
|
|
4923
5563
|
});
|
|
4924
5564
|
}
|
|
@@ -4946,17 +5586,17 @@
|
|
|
4946
5586
|
if (wasmBinary) {
|
|
4947
5587
|
options.wasmBinary = wasmBinary;
|
|
4948
5588
|
}
|
|
4949
|
-
return new Promise((
|
|
4950
|
-
BasisEncoderModule(options).then((
|
|
4951
|
-
const { BasisFile, KTX2File, initializeBasis, BasisEncoder } =
|
|
5589
|
+
return new Promise((resolve2) => {
|
|
5590
|
+
BasisEncoderModule(options).then((module) => {
|
|
5591
|
+
const { BasisFile, KTX2File, initializeBasis, BasisEncoder } = module;
|
|
4952
5592
|
initializeBasis();
|
|
4953
|
-
|
|
5593
|
+
resolve2({ BasisFile, KTX2File, BasisEncoder });
|
|
4954
5594
|
});
|
|
4955
5595
|
});
|
|
4956
5596
|
}
|
|
4957
5597
|
|
|
4958
|
-
// ../textures/src/lib/gl-
|
|
4959
|
-
var
|
|
5598
|
+
// ../textures/src/lib/gl-extensions.ts
|
|
5599
|
+
var GL_EXTENSIONS_CONSTANTS = {
|
|
4960
5600
|
COMPRESSED_RGB_S3TC_DXT1_EXT: 33776,
|
|
4961
5601
|
COMPRESSED_RGBA_S3TC_DXT1_EXT: 33777,
|
|
4962
5602
|
COMPRESSED_RGBA_S3TC_DXT3_EXT: 33778,
|
|
@@ -5017,6 +5657,43 @@
|
|
|
5017
5657
|
COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: 35919
|
|
5018
5658
|
};
|
|
5019
5659
|
|
|
5660
|
+
// ../textures/src/lib/utils/texture-formats.ts
|
|
5661
|
+
var BROWSER_PREFIXES = ["", "WEBKIT_", "MOZ_"];
|
|
5662
|
+
var WEBGL_EXTENSIONS = {
|
|
5663
|
+
WEBGL_compressed_texture_s3tc: "dxt",
|
|
5664
|
+
WEBGL_compressed_texture_s3tc_srgb: "dxt-srgb",
|
|
5665
|
+
WEBGL_compressed_texture_etc1: "etc1",
|
|
5666
|
+
WEBGL_compressed_texture_etc: "etc2",
|
|
5667
|
+
WEBGL_compressed_texture_pvrtc: "pvrtc",
|
|
5668
|
+
WEBGL_compressed_texture_atc: "atc",
|
|
5669
|
+
WEBGL_compressed_texture_astc: "astc",
|
|
5670
|
+
EXT_texture_compression_rgtc: "rgtc"
|
|
5671
|
+
};
|
|
5672
|
+
var formats = null;
|
|
5673
|
+
function getSupportedGPUTextureFormats(gl) {
|
|
5674
|
+
if (!formats) {
|
|
5675
|
+
gl = gl || getWebGLContext() || void 0;
|
|
5676
|
+
formats = new Set();
|
|
5677
|
+
for (const prefix of BROWSER_PREFIXES) {
|
|
5678
|
+
for (const extension in WEBGL_EXTENSIONS) {
|
|
5679
|
+
if (gl && gl.getExtension(`${prefix}${extension}`)) {
|
|
5680
|
+
const gpuTextureFormat = WEBGL_EXTENSIONS[extension];
|
|
5681
|
+
formats.add(gpuTextureFormat);
|
|
5682
|
+
}
|
|
5683
|
+
}
|
|
5684
|
+
}
|
|
5685
|
+
}
|
|
5686
|
+
return formats;
|
|
5687
|
+
}
|
|
5688
|
+
function getWebGLContext() {
|
|
5689
|
+
try {
|
|
5690
|
+
const canvas = document.createElement("canvas");
|
|
5691
|
+
return canvas.getContext("webgl");
|
|
5692
|
+
} catch (error) {
|
|
5693
|
+
return null;
|
|
5694
|
+
}
|
|
5695
|
+
}
|
|
5696
|
+
|
|
5020
5697
|
// ../../node_modules/ktx-parse/dist/ktx-parse.modern.js
|
|
5021
5698
|
var t = new Uint8Array([0]);
|
|
5022
5699
|
var e = [171, 75, 84, 88, 32, 50, 48, 187, 13, 10, 26, 10];
|
|
@@ -5151,72 +5828,72 @@
|
|
|
5151
5828
|
|
|
5152
5829
|
// ../textures/src/lib/utils/ktx-format-helper.ts
|
|
5153
5830
|
var VULKAN_TO_WEBGL_FORMAT_MAP = {
|
|
5154
|
-
131:
|
|
5155
|
-
132:
|
|
5156
|
-
133:
|
|
5157
|
-
134:
|
|
5158
|
-
135:
|
|
5159
|
-
136:
|
|
5160
|
-
137:
|
|
5161
|
-
138:
|
|
5162
|
-
139:
|
|
5163
|
-
140:
|
|
5164
|
-
141:
|
|
5165
|
-
142:
|
|
5166
|
-
147:
|
|
5167
|
-
148:
|
|
5168
|
-
149:
|
|
5169
|
-
150:
|
|
5170
|
-
151:
|
|
5171
|
-
152:
|
|
5172
|
-
153:
|
|
5173
|
-
154:
|
|
5174
|
-
155:
|
|
5175
|
-
156:
|
|
5176
|
-
157:
|
|
5177
|
-
158:
|
|
5178
|
-
159:
|
|
5179
|
-
160:
|
|
5180
|
-
161:
|
|
5181
|
-
162:
|
|
5182
|
-
163:
|
|
5183
|
-
164:
|
|
5184
|
-
165:
|
|
5185
|
-
166:
|
|
5186
|
-
167:
|
|
5187
|
-
168:
|
|
5188
|
-
169:
|
|
5189
|
-
170:
|
|
5190
|
-
171:
|
|
5191
|
-
172:
|
|
5192
|
-
173:
|
|
5193
|
-
174:
|
|
5194
|
-
175:
|
|
5195
|
-
176:
|
|
5196
|
-
177:
|
|
5197
|
-
178:
|
|
5198
|
-
179:
|
|
5199
|
-
180:
|
|
5200
|
-
181:
|
|
5201
|
-
182:
|
|
5202
|
-
183:
|
|
5203
|
-
184:
|
|
5204
|
-
1000054e3:
|
|
5205
|
-
1000054001:
|
|
5206
|
-
1000066e3:
|
|
5207
|
-
1000066001:
|
|
5208
|
-
1000066002:
|
|
5209
|
-
1000066003:
|
|
5210
|
-
1000066004:
|
|
5211
|
-
1000066005:
|
|
5212
|
-
1000066006:
|
|
5213
|
-
1000066007:
|
|
5214
|
-
1000066008:
|
|
5215
|
-
1000066009:
|
|
5216
|
-
1000066010:
|
|
5217
|
-
1000066011:
|
|
5218
|
-
1000066012:
|
|
5219
|
-
1000066013:
|
|
5831
|
+
131: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_S3TC_DXT1_EXT,
|
|
5832
|
+
132: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB_S3TC_DXT1_EXT,
|
|
5833
|
+
133: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT1_EXT,
|
|
5834
|
+
134: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
|
|
5835
|
+
135: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT3_EXT,
|
|
5836
|
+
136: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
|
|
5837
|
+
137: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT5_EXT,
|
|
5838
|
+
138: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,
|
|
5839
|
+
139: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RED_RGTC1_EXT,
|
|
5840
|
+
140: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SIGNED_RED_RGTC1_EXT,
|
|
5841
|
+
141: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RED_GREEN_RGTC2_EXT,
|
|
5842
|
+
142: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,
|
|
5843
|
+
147: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB8_ETC2,
|
|
5844
|
+
148: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ETC2,
|
|
5845
|
+
149: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
|
|
5846
|
+
150: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
|
|
5847
|
+
151: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA8_ETC2_EAC,
|
|
5848
|
+
152: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
|
|
5849
|
+
153: GL_EXTENSIONS_CONSTANTS.COMPRESSED_R11_EAC,
|
|
5850
|
+
154: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SIGNED_R11_EAC,
|
|
5851
|
+
155: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RG11_EAC,
|
|
5852
|
+
156: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SIGNED_RG11_EAC,
|
|
5853
|
+
157: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_4x4_KHR,
|
|
5854
|
+
158: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
|
|
5855
|
+
159: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x4_KHR,
|
|
5856
|
+
160: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR,
|
|
5857
|
+
161: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x5_KHR,
|
|
5858
|
+
162: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
|
|
5859
|
+
163: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x5_KHR,
|
|
5860
|
+
164: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
|
|
5861
|
+
165: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x6_KHR,
|
|
5862
|
+
166: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
|
|
5863
|
+
167: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x5_KHR,
|
|
5864
|
+
168: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
|
|
5865
|
+
169: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x6_KHR,
|
|
5866
|
+
170: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
|
|
5867
|
+
171: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x8_KHR,
|
|
5868
|
+
172: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
|
|
5869
|
+
173: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x5_KHR,
|
|
5870
|
+
174: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
|
|
5871
|
+
175: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x6_KHR,
|
|
5872
|
+
176: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
|
|
5873
|
+
177: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x8_KHR,
|
|
5874
|
+
178: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
|
|
5875
|
+
179: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x10_KHR,
|
|
5876
|
+
180: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
|
|
5877
|
+
181: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x10_KHR,
|
|
5878
|
+
182: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
|
|
5879
|
+
183: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x12_KHR,
|
|
5880
|
+
184: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
|
|
5881
|
+
1000054e3: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,
|
|
5882
|
+
1000054001: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
|
|
5883
|
+
1000066e3: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_4x4_KHR,
|
|
5884
|
+
1000066001: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x4_KHR,
|
|
5885
|
+
1000066002: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x5_KHR,
|
|
5886
|
+
1000066003: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x5_KHR,
|
|
5887
|
+
1000066004: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x6_KHR,
|
|
5888
|
+
1000066005: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x5_KHR,
|
|
5889
|
+
1000066006: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x6_KHR,
|
|
5890
|
+
1000066007: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x8_KHR,
|
|
5891
|
+
1000066008: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x5_KHR,
|
|
5892
|
+
1000066009: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x6_KHR,
|
|
5893
|
+
1000066010: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x8_KHR,
|
|
5894
|
+
1000066011: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x10_KHR,
|
|
5895
|
+
1000066012: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x10_KHR,
|
|
5896
|
+
1000066013: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x12_KHR
|
|
5220
5897
|
};
|
|
5221
5898
|
function mapVkFormatToWebGL(vkFormat) {
|
|
5222
5899
|
return VULKAN_TO_WEBGL_FORMAT_MAP[vkFormat];
|
|
@@ -5258,19 +5935,43 @@
|
|
|
5258
5935
|
});
|
|
5259
5936
|
}
|
|
5260
5937
|
|
|
5261
|
-
// ../textures/src/lib/parsers/parse-basis.
|
|
5938
|
+
// ../textures/src/lib/parsers/parse-basis.ts
|
|
5262
5939
|
var OutputFormat = {
|
|
5263
|
-
etc1: {
|
|
5940
|
+
etc1: {
|
|
5941
|
+
basisFormat: 0,
|
|
5942
|
+
compressed: true,
|
|
5943
|
+
format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_ETC1_WEBGL
|
|
5944
|
+
},
|
|
5264
5945
|
etc2: { basisFormat: 1, compressed: true },
|
|
5265
|
-
bc1: {
|
|
5266
|
-
|
|
5946
|
+
bc1: {
|
|
5947
|
+
basisFormat: 2,
|
|
5948
|
+
compressed: true,
|
|
5949
|
+
format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_S3TC_DXT1_EXT
|
|
5950
|
+
},
|
|
5951
|
+
bc3: {
|
|
5952
|
+
basisFormat: 3,
|
|
5953
|
+
compressed: true,
|
|
5954
|
+
format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT5_EXT
|
|
5955
|
+
},
|
|
5267
5956
|
bc4: { basisFormat: 4, compressed: true },
|
|
5268
5957
|
bc5: { basisFormat: 5, compressed: true },
|
|
5269
5958
|
"bc7-m6-opaque-only": { basisFormat: 6, compressed: true },
|
|
5270
5959
|
"bc7-m5": { basisFormat: 7, compressed: true },
|
|
5271
|
-
"pvrtc1-4-rgb": {
|
|
5272
|
-
|
|
5273
|
-
|
|
5960
|
+
"pvrtc1-4-rgb": {
|
|
5961
|
+
basisFormat: 8,
|
|
5962
|
+
compressed: true,
|
|
5963
|
+
format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_PVRTC_4BPPV1_IMG
|
|
5964
|
+
},
|
|
5965
|
+
"pvrtc1-4-rgba": {
|
|
5966
|
+
basisFormat: 9,
|
|
5967
|
+
compressed: true,
|
|
5968
|
+
format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG
|
|
5969
|
+
},
|
|
5970
|
+
"astc-4x4": {
|
|
5971
|
+
basisFormat: 10,
|
|
5972
|
+
compressed: true,
|
|
5973
|
+
format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_4X4_KHR
|
|
5974
|
+
},
|
|
5274
5975
|
"atc-rgb": { basisFormat: 11, compressed: true },
|
|
5275
5976
|
"atc-rgba-interpolated-alpha": { basisFormat: 12, compressed: true },
|
|
5276
5977
|
rgba32: { basisFormat: 13, compressed: false },
|
|
@@ -5307,7 +6008,7 @@
|
|
|
5307
6008
|
const basisFile = new BasisFile(new Uint8Array(data));
|
|
5308
6009
|
try {
|
|
5309
6010
|
if (!basisFile.startTranscoding()) {
|
|
5310
|
-
|
|
6011
|
+
throw new Error("Failed to start basis transcoding");
|
|
5311
6012
|
}
|
|
5312
6013
|
const imageCount = basisFile.getNumImages();
|
|
5313
6014
|
const images = [];
|
|
@@ -5333,22 +6034,22 @@
|
|
|
5333
6034
|
const decodedSize = basisFile.getImageTranscodedSizeInBytes(imageIndex, levelIndex, basisFormat);
|
|
5334
6035
|
const decodedData = new Uint8Array(decodedSize);
|
|
5335
6036
|
if (!basisFile.transcodeImage(decodedData, imageIndex, levelIndex, basisFormat, 0, 0)) {
|
|
5336
|
-
|
|
6037
|
+
throw new Error("failed to start Basis transcoding");
|
|
5337
6038
|
}
|
|
5338
6039
|
return {
|
|
5339
6040
|
width,
|
|
5340
6041
|
height,
|
|
5341
6042
|
data: decodedData,
|
|
5342
6043
|
compressed,
|
|
5343
|
-
|
|
5344
|
-
|
|
6044
|
+
format,
|
|
6045
|
+
hasAlpha
|
|
5345
6046
|
};
|
|
5346
6047
|
}
|
|
5347
6048
|
function parseKTX2File(KTX2File, data, options) {
|
|
5348
6049
|
const ktx2File = new KTX2File(new Uint8Array(data));
|
|
5349
6050
|
try {
|
|
5350
6051
|
if (!ktx2File.startTranscoding()) {
|
|
5351
|
-
|
|
6052
|
+
throw new Error("failed to start KTX2 transcoding");
|
|
5352
6053
|
}
|
|
5353
6054
|
const levelsCount = ktx2File.getLevels();
|
|
5354
6055
|
const levels = [];
|
|
@@ -5356,7 +6057,7 @@
|
|
|
5356
6057
|
levels.push(transcodeKTX2Image(ktx2File, levelIndex, options));
|
|
5357
6058
|
break;
|
|
5358
6059
|
}
|
|
5359
|
-
return levels;
|
|
6060
|
+
return [levels];
|
|
5360
6061
|
} finally {
|
|
5361
6062
|
ktx2File.close();
|
|
5362
6063
|
ktx2File.delete();
|
|
@@ -5368,14 +6069,15 @@
|
|
|
5368
6069
|
const decodedSize = ktx2File.getImageTranscodedSizeInBytes(levelIndex, 0, 0, basisFormat);
|
|
5369
6070
|
const decodedData = new Uint8Array(decodedSize);
|
|
5370
6071
|
if (!ktx2File.transcodeImage(decodedData, levelIndex, 0, 0, basisFormat, 0, -1, -1)) {
|
|
5371
|
-
|
|
6072
|
+
throw new Error("Failed to transcode KTX2 image");
|
|
5372
6073
|
}
|
|
5373
6074
|
return {
|
|
5374
6075
|
width,
|
|
5375
6076
|
height,
|
|
5376
6077
|
data: decodedData,
|
|
5377
6078
|
compressed,
|
|
5378
|
-
|
|
6079
|
+
levelSize: decodedSize,
|
|
6080
|
+
hasAlpha: alphaFlag,
|
|
5379
6081
|
format
|
|
5380
6082
|
};
|
|
5381
6083
|
}
|
|
@@ -5453,12 +6155,12 @@
|
|
|
5453
6155
|
DDPF_FOURCC: 4
|
|
5454
6156
|
};
|
|
5455
6157
|
var DDS_PIXEL_FORMATS = {
|
|
5456
|
-
DXT1:
|
|
5457
|
-
DXT3:
|
|
5458
|
-
DXT5:
|
|
5459
|
-
"ATC ":
|
|
5460
|
-
ATCA:
|
|
5461
|
-
ATCI:
|
|
6158
|
+
DXT1: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_S3TC_DXT1_EXT,
|
|
6159
|
+
DXT3: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT3_EXT,
|
|
6160
|
+
DXT5: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT5_EXT,
|
|
6161
|
+
"ATC ": GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_ATC_WEBGL,
|
|
6162
|
+
ATCA: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,
|
|
6163
|
+
ATCI: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL
|
|
5462
6164
|
};
|
|
5463
6165
|
var getATCLevelSize = getDxt1LevelSize;
|
|
5464
6166
|
var getATCALevelSize = getDxtXLevelSize;
|
|
@@ -5525,33 +6227,75 @@
|
|
|
5525
6227
|
METADATA_SIZE_INDEX: 12
|
|
5526
6228
|
};
|
|
5527
6229
|
var PVR_PIXEL_FORMATS = {
|
|
5528
|
-
0: [
|
|
5529
|
-
1: [
|
|
5530
|
-
2: [
|
|
5531
|
-
3: [
|
|
5532
|
-
6: [
|
|
5533
|
-
7: [
|
|
5534
|
-
9: [
|
|
5535
|
-
11: [
|
|
5536
|
-
22: [
|
|
5537
|
-
23: [
|
|
5538
|
-
24: [
|
|
5539
|
-
25: [
|
|
5540
|
-
26: [
|
|
5541
|
-
27: [
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
6230
|
+
0: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_PVRTC_2BPPV1_IMG],
|
|
6231
|
+
1: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG],
|
|
6232
|
+
2: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_PVRTC_4BPPV1_IMG],
|
|
6233
|
+
3: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG],
|
|
6234
|
+
6: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_ETC1_WEBGL],
|
|
6235
|
+
7: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_S3TC_DXT1_EXT],
|
|
6236
|
+
9: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT3_EXT],
|
|
6237
|
+
11: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT5_EXT],
|
|
6238
|
+
22: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB8_ETC2],
|
|
6239
|
+
23: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA8_ETC2_EAC],
|
|
6240
|
+
24: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2],
|
|
6241
|
+
25: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_R11_EAC],
|
|
6242
|
+
26: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RG11_EAC],
|
|
6243
|
+
27: [
|
|
6244
|
+
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_4X4_KHR,
|
|
6245
|
+
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR
|
|
6246
|
+
],
|
|
6247
|
+
28: [
|
|
6248
|
+
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5X4_KHR,
|
|
6249
|
+
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR
|
|
6250
|
+
],
|
|
6251
|
+
29: [
|
|
6252
|
+
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5X5_KHR,
|
|
6253
|
+
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR
|
|
6254
|
+
],
|
|
6255
|
+
30: [
|
|
6256
|
+
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6X5_KHR,
|
|
6257
|
+
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR
|
|
6258
|
+
],
|
|
6259
|
+
31: [
|
|
6260
|
+
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6X6_KHR,
|
|
6261
|
+
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR
|
|
6262
|
+
],
|
|
6263
|
+
32: [
|
|
6264
|
+
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8X5_KHR,
|
|
6265
|
+
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR
|
|
6266
|
+
],
|
|
6267
|
+
33: [
|
|
6268
|
+
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8X6_KHR,
|
|
6269
|
+
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR
|
|
6270
|
+
],
|
|
6271
|
+
34: [
|
|
6272
|
+
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8X8_KHR,
|
|
6273
|
+
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR
|
|
6274
|
+
],
|
|
6275
|
+
35: [
|
|
6276
|
+
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10X5_KHR,
|
|
6277
|
+
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR
|
|
6278
|
+
],
|
|
6279
|
+
36: [
|
|
6280
|
+
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10X6_KHR,
|
|
6281
|
+
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR
|
|
6282
|
+
],
|
|
6283
|
+
37: [
|
|
6284
|
+
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10X8_KHR,
|
|
6285
|
+
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR
|
|
6286
|
+
],
|
|
6287
|
+
38: [
|
|
6288
|
+
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10X10_KHR,
|
|
6289
|
+
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR
|
|
6290
|
+
],
|
|
6291
|
+
39: [
|
|
6292
|
+
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12X10_KHR,
|
|
6293
|
+
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR
|
|
6294
|
+
],
|
|
6295
|
+
40: [
|
|
6296
|
+
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12X12_KHR,
|
|
6297
|
+
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR
|
|
6298
|
+
]
|
|
5555
6299
|
};
|
|
5556
6300
|
var PVR_SIZE_FUNCTIONS = {
|
|
5557
6301
|
0: pvrtc2bppSize,
|
|
@@ -5719,48 +6463,30 @@
|
|
|
5719
6463
|
containerFormat: "ktx2",
|
|
5720
6464
|
module: "encoder"
|
|
5721
6465
|
};
|
|
5722
|
-
return await parseBasis(arrayBuffer, options);
|
|
6466
|
+
return (await parseBasis(arrayBuffer, options))[0];
|
|
5723
6467
|
}
|
|
5724
6468
|
return parseCompressedTexture(arrayBuffer);
|
|
5725
6469
|
}
|
|
5726
6470
|
};
|
|
5727
6471
|
|
|
5728
|
-
//
|
|
5729
|
-
var
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
for (const extension in WEBGL_EXTENSIONS) {
|
|
5747
|
-
if (gl && gl.getExtension(`${prefix}${extension}`)) {
|
|
5748
|
-
const gpuTextureFormat = WEBGL_EXTENSIONS[extension];
|
|
5749
|
-
formats.add(gpuTextureFormat);
|
|
5750
|
-
}
|
|
5751
|
-
}
|
|
5752
|
-
}
|
|
5753
|
-
}
|
|
5754
|
-
return formats;
|
|
5755
|
-
}
|
|
5756
|
-
function getWebGLContext() {
|
|
5757
|
-
try {
|
|
5758
|
-
const canvas = document.createElement("canvas");
|
|
5759
|
-
return canvas.getContext("webgl");
|
|
5760
|
-
} catch (error) {
|
|
5761
|
-
return null;
|
|
5762
|
-
}
|
|
5763
|
-
}
|
|
6472
|
+
// src/types.ts
|
|
6473
|
+
var DATA_TYPE;
|
|
6474
|
+
(function(DATA_TYPE2) {
|
|
6475
|
+
DATA_TYPE2["UInt8"] = "UInt8";
|
|
6476
|
+
DATA_TYPE2["UInt16"] = "UInt16";
|
|
6477
|
+
DATA_TYPE2["UInt32"] = "UInt32";
|
|
6478
|
+
DATA_TYPE2["UInt64"] = "UInt64";
|
|
6479
|
+
DATA_TYPE2["Int16"] = "Int16";
|
|
6480
|
+
DATA_TYPE2["Int32"] = "Int32";
|
|
6481
|
+
DATA_TYPE2["Int64"] = "Int64";
|
|
6482
|
+
DATA_TYPE2["Float32"] = "Float32";
|
|
6483
|
+
DATA_TYPE2["Float64"] = "Float64";
|
|
6484
|
+
})(DATA_TYPE || (DATA_TYPE = {}));
|
|
6485
|
+
var HeaderAttributeProperty;
|
|
6486
|
+
(function(HeaderAttributeProperty2) {
|
|
6487
|
+
HeaderAttributeProperty2["vertexCount"] = "vertexCount";
|
|
6488
|
+
HeaderAttributeProperty2["featureCount"] = "featureCount";
|
|
6489
|
+
})(HeaderAttributeProperty || (HeaderAttributeProperty = {}));
|
|
5764
6490
|
|
|
5765
6491
|
// src/lib/utils/url-utils.ts
|
|
5766
6492
|
function getUrlWithToken(url, token = null) {
|
|
@@ -5768,7 +6494,7 @@
|
|
|
5768
6494
|
}
|
|
5769
6495
|
|
|
5770
6496
|
// ../../node_modules/@luma.gl/constants/dist/esm/index.js
|
|
5771
|
-
var
|
|
6497
|
+
var esm_default = {
|
|
5772
6498
|
DEPTH_BUFFER_BIT: 256,
|
|
5773
6499
|
STENCIL_BUFFER_BIT: 1024,
|
|
5774
6500
|
COLOR_BUFFER_BIT: 16384,
|
|
@@ -6386,72 +7112,252 @@
|
|
|
6386
7112
|
};
|
|
6387
7113
|
|
|
6388
7114
|
// src/lib/parsers/constants.ts
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
7115
|
+
function getConstructorForDataFormat(dataType) {
|
|
7116
|
+
switch (dataType) {
|
|
7117
|
+
case DATA_TYPE.UInt8:
|
|
7118
|
+
return Uint8Array;
|
|
7119
|
+
case DATA_TYPE.UInt16:
|
|
7120
|
+
return Uint16Array;
|
|
7121
|
+
case DATA_TYPE.UInt32:
|
|
7122
|
+
return Uint32Array;
|
|
7123
|
+
case DATA_TYPE.Float32:
|
|
7124
|
+
return Float32Array;
|
|
7125
|
+
case DATA_TYPE.UInt64:
|
|
7126
|
+
return Float64Array;
|
|
7127
|
+
default:
|
|
7128
|
+
throw new Error(`parse i3s tile content: unknown type of data: ${dataType}`);
|
|
7129
|
+
}
|
|
7130
|
+
}
|
|
6396
7131
|
var GL_TYPE_MAP = {
|
|
6397
|
-
UInt8:
|
|
6398
|
-
UInt16:
|
|
6399
|
-
Float32:
|
|
6400
|
-
UInt32:
|
|
6401
|
-
UInt64:
|
|
6402
|
-
};
|
|
6403
|
-
var I3S_NAMED_VERTEX_ATTRIBUTES = {
|
|
6404
|
-
position: "position",
|
|
6405
|
-
normal: "normal",
|
|
6406
|
-
uv0: "uv0",
|
|
6407
|
-
color: "color",
|
|
6408
|
-
region: "region"
|
|
6409
|
-
};
|
|
6410
|
-
var I3S_NAMED_GEOMETRY_ATTRIBUTES = {
|
|
6411
|
-
vertexAttributes: "vertexAttributes",
|
|
6412
|
-
featureAttributeOrder: "featureAttributeOrder",
|
|
6413
|
-
featureAttributes: "featureAttributes"
|
|
7132
|
+
UInt8: esm_default.UNSIGNED_BYTE,
|
|
7133
|
+
UInt16: esm_default.UNSIGNED_SHORT,
|
|
7134
|
+
Float32: esm_default.FLOAT,
|
|
7135
|
+
UInt32: esm_default.UNSIGNED_INT,
|
|
7136
|
+
UInt64: esm_default.DOUBLE
|
|
6414
7137
|
};
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
7138
|
+
function sizeOf(dataType) {
|
|
7139
|
+
switch (dataType) {
|
|
7140
|
+
case DATA_TYPE.UInt8:
|
|
7141
|
+
return 1;
|
|
7142
|
+
case DATA_TYPE.UInt16:
|
|
7143
|
+
case DATA_TYPE.Int16:
|
|
7144
|
+
return 2;
|
|
7145
|
+
case DATA_TYPE.UInt32:
|
|
7146
|
+
case DATA_TYPE.Int32:
|
|
7147
|
+
case DATA_TYPE.Float32:
|
|
7148
|
+
return 4;
|
|
7149
|
+
case DATA_TYPE.UInt64:
|
|
7150
|
+
case DATA_TYPE.Int64:
|
|
7151
|
+
case DATA_TYPE.Float64:
|
|
7152
|
+
return 8;
|
|
7153
|
+
default:
|
|
7154
|
+
throw new Error(`parse i3s tile content: unknown size of data: ${dataType}`);
|
|
7155
|
+
}
|
|
7156
|
+
}
|
|
7157
|
+
var STRING_ATTRIBUTE_TYPE = "String";
|
|
7158
|
+
var OBJECT_ID_ATTRIBUTE_TYPE = "Oid32";
|
|
7159
|
+
var FLOAT_64_TYPE = "Float64";
|
|
7160
|
+
var INT_16_ATTRIBUTE_TYPE = "Int16";
|
|
7161
|
+
var COORDINATE_SYSTEM;
|
|
7162
|
+
(function(COORDINATE_SYSTEM2) {
|
|
7163
|
+
COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["DEFAULT"] = -1] = "DEFAULT";
|
|
7164
|
+
COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["LNGLAT"] = 1] = "LNGLAT";
|
|
7165
|
+
COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["METER_OFFSETS"] = 2] = "METER_OFFSETS";
|
|
7166
|
+
COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["LNGLAT_OFFSETS"] = 3] = "LNGLAT_OFFSETS";
|
|
7167
|
+
COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["CARTESIAN"] = 0] = "CARTESIAN";
|
|
7168
|
+
})(COORDINATE_SYSTEM || (COORDINATE_SYSTEM = {}));
|
|
7169
|
+
|
|
7170
|
+
// src/lib/parsers/parse-i3s-attribute.ts
|
|
7171
|
+
function parseI3STileAttribute(arrayBuffer, options) {
|
|
7172
|
+
const { attributeName, attributeType } = options;
|
|
7173
|
+
if (!attributeName) {
|
|
7174
|
+
return {};
|
|
7175
|
+
}
|
|
7176
|
+
return {
|
|
7177
|
+
[attributeName]: attributeType ? parseAttribute(attributeType, arrayBuffer) : null
|
|
7178
|
+
};
|
|
7179
|
+
}
|
|
7180
|
+
function parseAttribute(attributeType, arrayBuffer) {
|
|
7181
|
+
switch (attributeType) {
|
|
7182
|
+
case STRING_ATTRIBUTE_TYPE:
|
|
7183
|
+
return parseStringsAttribute(arrayBuffer);
|
|
7184
|
+
case OBJECT_ID_ATTRIBUTE_TYPE:
|
|
7185
|
+
return parseShortNumberAttribute(arrayBuffer);
|
|
7186
|
+
case FLOAT_64_TYPE:
|
|
7187
|
+
return parseFloatAttribute(arrayBuffer);
|
|
7188
|
+
case INT_16_ATTRIBUTE_TYPE:
|
|
7189
|
+
return parseInt16ShortNumberAttribute(arrayBuffer);
|
|
7190
|
+
default:
|
|
7191
|
+
return parseShortNumberAttribute(arrayBuffer);
|
|
7192
|
+
}
|
|
7193
|
+
}
|
|
7194
|
+
function parseShortNumberAttribute(arrayBuffer) {
|
|
7195
|
+
const countOffset = 4;
|
|
7196
|
+
return new Uint32Array(arrayBuffer, countOffset);
|
|
7197
|
+
}
|
|
7198
|
+
function parseInt16ShortNumberAttribute(arrayBuffer) {
|
|
7199
|
+
const countOffset = 4;
|
|
7200
|
+
return new Int16Array(arrayBuffer, countOffset);
|
|
7201
|
+
}
|
|
7202
|
+
function parseFloatAttribute(arrayBuffer) {
|
|
7203
|
+
const countOffset = 8;
|
|
7204
|
+
return new Float64Array(arrayBuffer, countOffset);
|
|
7205
|
+
}
|
|
7206
|
+
function parseStringsAttribute(arrayBuffer) {
|
|
7207
|
+
const stringsCountOffset = 0;
|
|
7208
|
+
const dataOffset = 8;
|
|
7209
|
+
const bytesPerStringSize = 4;
|
|
7210
|
+
const stringsArray = [];
|
|
7211
|
+
try {
|
|
7212
|
+
const stringsCount = new DataView(arrayBuffer, stringsCountOffset, bytesPerStringSize).getUint32(stringsCountOffset, true);
|
|
7213
|
+
const stringSizes = new Uint32Array(arrayBuffer, dataOffset, stringsCount);
|
|
7214
|
+
let stringOffset = dataOffset + stringsCount * bytesPerStringSize;
|
|
7215
|
+
for (const stringByteSize of stringSizes) {
|
|
7216
|
+
const textDecoder = new TextDecoder("utf-8");
|
|
7217
|
+
const stringAttribute = new Uint8Array(arrayBuffer, stringOffset, stringByteSize);
|
|
7218
|
+
stringsArray.push(textDecoder.decode(stringAttribute));
|
|
7219
|
+
stringOffset += stringByteSize;
|
|
7220
|
+
}
|
|
7221
|
+
} catch (error) {
|
|
7222
|
+
console.error("Parse string attribute error: ", error.message);
|
|
7223
|
+
}
|
|
7224
|
+
return stringsArray;
|
|
7225
|
+
}
|
|
7226
|
+
|
|
7227
|
+
// src/i3s-attribute-loader.ts
|
|
7228
|
+
var VERSION8 = true ? "4.0.0-alpha.11" : "latest";
|
|
7229
|
+
var I3SAttributeLoader = {
|
|
7230
|
+
name: "I3S Attribute",
|
|
7231
|
+
id: "i3s-attribute",
|
|
7232
|
+
module: "i3s",
|
|
7233
|
+
version: VERSION8,
|
|
7234
|
+
mimeTypes: ["application/binary"],
|
|
7235
|
+
parse: async (arrayBuffer, options) => parseI3STileAttribute(arrayBuffer, options),
|
|
7236
|
+
extensions: ["bin"],
|
|
7237
|
+
options: {},
|
|
7238
|
+
binary: true
|
|
6426
7239
|
};
|
|
7240
|
+
function getAttributeValueType(attribute) {
|
|
7241
|
+
if (attribute.hasOwnProperty("objectIds")) {
|
|
7242
|
+
return "Oid32";
|
|
7243
|
+
} else if (attribute.hasOwnProperty("attributeValues")) {
|
|
7244
|
+
return attribute.attributeValues.valueType;
|
|
7245
|
+
}
|
|
7246
|
+
return "";
|
|
7247
|
+
}
|
|
7248
|
+
|
|
7249
|
+
// src/lib/utils/customize-сolors.ts
|
|
7250
|
+
async function customizeColors(colors, featureIds, tileOptions, tilesetOptions, options) {
|
|
7251
|
+
if (!options?.i3s?.colorsByAttribute) {
|
|
7252
|
+
return colors;
|
|
7253
|
+
}
|
|
7254
|
+
const colorizeAttributeField = tilesetOptions.fields.find(({ name }) => name === options?.i3s?.colorsByAttribute?.attributeName);
|
|
7255
|
+
if (!colorizeAttributeField || !["esriFieldTypeDouble", "esriFieldTypeInteger", "esriFieldTypeSmallInteger"].includes(colorizeAttributeField.type)) {
|
|
7256
|
+
return colors;
|
|
7257
|
+
}
|
|
7258
|
+
const colorizeAttributeData = await loadFeatureAttributeData(colorizeAttributeField.name, tileOptions, tilesetOptions, options);
|
|
7259
|
+
if (!colorizeAttributeData) {
|
|
7260
|
+
return colors;
|
|
7261
|
+
}
|
|
7262
|
+
const objectIdField = tilesetOptions.fields.find(({ type }) => type === "esriFieldTypeOID");
|
|
7263
|
+
if (!objectIdField) {
|
|
7264
|
+
return colors;
|
|
7265
|
+
}
|
|
7266
|
+
const objectIdAttributeData = await loadFeatureAttributeData(objectIdField.name, tileOptions, tilesetOptions, options);
|
|
7267
|
+
if (!objectIdAttributeData) {
|
|
7268
|
+
return colors;
|
|
7269
|
+
}
|
|
7270
|
+
const attributeValuesMap = {};
|
|
7271
|
+
for (let i2 = 0; i2 < objectIdAttributeData[objectIdField.name].length; i2++) {
|
|
7272
|
+
attributeValuesMap[objectIdAttributeData[objectIdField.name][i2]] = calculateColorForAttribute(colorizeAttributeData[colorizeAttributeField.name][i2], options);
|
|
7273
|
+
}
|
|
7274
|
+
for (let i2 = 0; i2 < featureIds.value.length; i2++) {
|
|
7275
|
+
const color = attributeValuesMap[featureIds.value[i2]];
|
|
7276
|
+
if (!color) {
|
|
7277
|
+
continue;
|
|
7278
|
+
}
|
|
7279
|
+
if (options.i3s.colorsByAttribute.mode === "multiply") {
|
|
7280
|
+
color.forEach((colorItem, index) => {
|
|
7281
|
+
colors.value[i2 * 4 + index] = colors.value[i2 * 4 + index] * colorItem / 255;
|
|
7282
|
+
});
|
|
7283
|
+
} else {
|
|
7284
|
+
colors.value.set(color, i2 * 4);
|
|
7285
|
+
}
|
|
7286
|
+
}
|
|
7287
|
+
return colors;
|
|
7288
|
+
}
|
|
7289
|
+
function calculateColorForAttribute(attributeValue, options) {
|
|
7290
|
+
if (!options?.i3s?.colorsByAttribute) {
|
|
7291
|
+
return [255, 255, 255, 255];
|
|
7292
|
+
}
|
|
7293
|
+
const { minValue, maxValue, minColor, maxColor } = options.i3s.colorsByAttribute;
|
|
7294
|
+
const rate = (attributeValue - minValue) / (maxValue - minValue);
|
|
7295
|
+
const color = [255, 255, 255, 255];
|
|
7296
|
+
for (let i2 = 0; i2 < minColor.length; i2++) {
|
|
7297
|
+
color[i2] = Math.round((maxColor[i2] - minColor[i2]) * rate + minColor[i2]);
|
|
7298
|
+
}
|
|
7299
|
+
return color;
|
|
7300
|
+
}
|
|
7301
|
+
async function loadFeatureAttributeData(attributeName, { attributeUrls }, { attributeStorageInfo }, options) {
|
|
7302
|
+
const attributeIndex = attributeStorageInfo.findIndex(({ name }) => attributeName === name);
|
|
7303
|
+
if (attributeIndex === -1) {
|
|
7304
|
+
return null;
|
|
7305
|
+
}
|
|
7306
|
+
const objectIdAttributeUrl = getUrlWithToken(attributeUrls[attributeIndex], options?.i3s?.token);
|
|
7307
|
+
const attributeType = getAttributeValueType(attributeStorageInfo[attributeIndex]);
|
|
7308
|
+
const objectIdAttributeData = await load(objectIdAttributeUrl, I3SAttributeLoader, {
|
|
7309
|
+
attributeName,
|
|
7310
|
+
attributeType
|
|
7311
|
+
});
|
|
7312
|
+
return objectIdAttributeData;
|
|
7313
|
+
}
|
|
6427
7314
|
|
|
6428
7315
|
// src/lib/parsers/parse-i3s-tile-content.ts
|
|
6429
|
-
var
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
7316
|
+
var scratchVector5 = new Vector3([0, 0, 0]);
|
|
7317
|
+
function getLoaderForTextureFormat(textureFormat) {
|
|
7318
|
+
switch (textureFormat) {
|
|
7319
|
+
case "ktx-etc2":
|
|
7320
|
+
case "dds":
|
|
7321
|
+
return CompressedTextureLoader;
|
|
7322
|
+
case "ktx2":
|
|
7323
|
+
return BasisLoader;
|
|
7324
|
+
case "jpg":
|
|
7325
|
+
case "png":
|
|
7326
|
+
default:
|
|
7327
|
+
return ImageLoader;
|
|
7328
|
+
}
|
|
7329
|
+
}
|
|
6437
7330
|
var I3S_ATTRIBUTE_TYPE = "i3s-attribute-type";
|
|
6438
|
-
async function parseI3STileContent(arrayBuffer,
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
|
|
7331
|
+
async function parseI3STileContent(arrayBuffer, tileOptions, tilesetOptions, options, context) {
|
|
7332
|
+
const content = {
|
|
7333
|
+
attributes: {},
|
|
7334
|
+
indices: null,
|
|
7335
|
+
featureIds: [],
|
|
7336
|
+
vertexCount: 0,
|
|
7337
|
+
modelMatrix: new Matrix4(),
|
|
7338
|
+
coordinateSystem: 0,
|
|
7339
|
+
byteLength: 0,
|
|
7340
|
+
texture: null
|
|
7341
|
+
};
|
|
7342
|
+
if (tileOptions.textureUrl) {
|
|
7343
|
+
const url = getUrlWithToken(tileOptions.textureUrl, options?.i3s?.token);
|
|
7344
|
+
const loader = getLoaderForTextureFormat(tileOptions.textureFormat);
|
|
7345
|
+
const response = await fetch(url, options?.fetch);
|
|
6447
7346
|
const arrayBuffer2 = await response.arrayBuffer();
|
|
6448
7347
|
if (options?.i3s.decodeTextures) {
|
|
6449
7348
|
if (loader === ImageLoader) {
|
|
6450
|
-
const options2 = { ...
|
|
6451
|
-
|
|
7349
|
+
const options2 = { ...tileOptions.textureLoaderOptions, image: { type: "data" } };
|
|
7350
|
+
try {
|
|
7351
|
+
content.texture = await context.parse(arrayBuffer2, options2);
|
|
7352
|
+
} catch (e2) {
|
|
7353
|
+
content.texture = await parse(arrayBuffer2, loader, options2);
|
|
7354
|
+
}
|
|
6452
7355
|
} else if (loader === CompressedTextureLoader || loader === BasisLoader) {
|
|
6453
|
-
|
|
6454
|
-
|
|
7356
|
+
let texture = await load(arrayBuffer2, loader, tileOptions.textureLoaderOptions);
|
|
7357
|
+
if (loader === BasisLoader) {
|
|
7358
|
+
texture = texture[0];
|
|
7359
|
+
}
|
|
7360
|
+
content.texture = {
|
|
6455
7361
|
compressed: true,
|
|
6456
7362
|
mipmaps: false,
|
|
6457
7363
|
width: texture[0].width,
|
|
@@ -6460,32 +7366,30 @@
|
|
|
6460
7366
|
};
|
|
6461
7367
|
}
|
|
6462
7368
|
} else {
|
|
6463
|
-
|
|
7369
|
+
content.texture = arrayBuffer2;
|
|
6464
7370
|
}
|
|
6465
7371
|
}
|
|
6466
|
-
|
|
6467
|
-
if (
|
|
6468
|
-
|
|
7372
|
+
content.material = makePbrMaterial(tileOptions.materialDefinition, content.texture);
|
|
7373
|
+
if (content.material) {
|
|
7374
|
+
content.texture = null;
|
|
6469
7375
|
}
|
|
6470
|
-
return await parseI3SNodeGeometry(arrayBuffer,
|
|
7376
|
+
return await parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOptions, options);
|
|
6471
7377
|
}
|
|
6472
|
-
async function parseI3SNodeGeometry(arrayBuffer,
|
|
6473
|
-
|
|
6474
|
-
return tile;
|
|
6475
|
-
}
|
|
6476
|
-
const content = tile.content;
|
|
7378
|
+
async function parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOptions, options) {
|
|
7379
|
+
const contentByteLength = arrayBuffer.byteLength;
|
|
6477
7380
|
let attributes;
|
|
6478
7381
|
let vertexCount;
|
|
6479
7382
|
let byteOffset = 0;
|
|
6480
7383
|
let featureCount = 0;
|
|
6481
|
-
|
|
7384
|
+
let indices;
|
|
7385
|
+
if (tileOptions.isDracoGeometry) {
|
|
6482
7386
|
const decompressedGeometry = await parse(arrayBuffer, DracoLoader2, {
|
|
6483
7387
|
draco: {
|
|
6484
7388
|
attributeNameEntry: I3S_ATTRIBUTE_TYPE
|
|
6485
7389
|
}
|
|
6486
7390
|
});
|
|
6487
7391
|
vertexCount = decompressedGeometry.header.vertexCount;
|
|
6488
|
-
|
|
7392
|
+
indices = decompressedGeometry.indices?.value;
|
|
6489
7393
|
const {
|
|
6490
7394
|
POSITION,
|
|
6491
7395
|
NORMAL,
|
|
@@ -6500,8 +7404,7 @@
|
|
|
6500
7404
|
color: COLOR_0,
|
|
6501
7405
|
uv0: TEXCOORD_0,
|
|
6502
7406
|
uvRegion,
|
|
6503
|
-
id: featureIndex
|
|
6504
|
-
indices
|
|
7407
|
+
id: featureIndex
|
|
6505
7408
|
};
|
|
6506
7409
|
updateAttributesMetadata(attributes, decompressedGeometry);
|
|
6507
7410
|
const featureIds = getFeatureIdsFromFeatureIndexMetadata(featureIndex);
|
|
@@ -6509,8 +7412,13 @@
|
|
|
6509
7412
|
flattenFeatureIdsByFeatureIndices(attributes, featureIds);
|
|
6510
7413
|
}
|
|
6511
7414
|
} else {
|
|
6512
|
-
const {
|
|
6513
|
-
|
|
7415
|
+
const {
|
|
7416
|
+
vertexAttributes,
|
|
7417
|
+
ordering: attributesOrder,
|
|
7418
|
+
featureAttributes,
|
|
7419
|
+
featureAttributeOrder
|
|
7420
|
+
} = tilesetOptions.store.defaultGeometrySchema;
|
|
7421
|
+
const headers = parseHeaders(arrayBuffer, tilesetOptions);
|
|
6514
7422
|
byteOffset = headers.byteOffset;
|
|
6515
7423
|
vertexCount = headers.vertexCount;
|
|
6516
7424
|
featureCount = headers.featureCount;
|
|
@@ -6519,16 +7427,25 @@
|
|
|
6519
7427
|
flattenFeatureIdsByFaceRanges(normalizedFeatureAttributes);
|
|
6520
7428
|
attributes = concatAttributes(normalizedVertexAttributes, normalizedFeatureAttributes);
|
|
6521
7429
|
}
|
|
7430
|
+
if (!options?.i3s?.coordinateSystem || options.i3s.coordinateSystem === COORDINATE_SYSTEM.METER_OFFSETS) {
|
|
7431
|
+
const enuMatrix = parsePositions(attributes.position, tileOptions);
|
|
7432
|
+
content.modelMatrix = enuMatrix.invert();
|
|
7433
|
+
content.coordinateSystem = COORDINATE_SYSTEM.METER_OFFSETS;
|
|
7434
|
+
} else {
|
|
7435
|
+
content.modelMatrix = getModelMatrix(attributes.position);
|
|
7436
|
+
content.coordinateSystem = COORDINATE_SYSTEM.LNGLAT_OFFSETS;
|
|
7437
|
+
}
|
|
7438
|
+
attributes.color = await customizeColors(attributes.color, attributes.id, tileOptions, tilesetOptions, options);
|
|
6522
7439
|
content.attributes = {
|
|
6523
7440
|
positions: attributes.position,
|
|
6524
7441
|
normals: attributes.normal,
|
|
6525
7442
|
colors: normalizeAttribute(attributes.color),
|
|
6526
7443
|
texCoords: attributes.uv0,
|
|
6527
|
-
uvRegions: normalizeAttribute(attributes.uvRegion)
|
|
7444
|
+
uvRegions: normalizeAttribute(attributes.uvRegion || attributes.region)
|
|
6528
7445
|
};
|
|
6529
|
-
content.indices =
|
|
7446
|
+
content.indices = indices || null;
|
|
6530
7447
|
if (attributes.id && attributes.id.value) {
|
|
6531
|
-
|
|
7448
|
+
content.featureIds = attributes.id.value;
|
|
6532
7449
|
}
|
|
6533
7450
|
for (const attributeIndex in content.attributes) {
|
|
6534
7451
|
if (!content.attributes[attributeIndex]) {
|
|
@@ -6536,10 +7453,8 @@
|
|
|
6536
7453
|
}
|
|
6537
7454
|
}
|
|
6538
7455
|
content.vertexCount = vertexCount;
|
|
6539
|
-
content.
|
|
6540
|
-
content
|
|
6541
|
-
content.byteLength = arrayBuffer.byteLength;
|
|
6542
|
-
return tile;
|
|
7456
|
+
content.byteLength = contentByteLength;
|
|
7457
|
+
return content;
|
|
6543
7458
|
}
|
|
6544
7459
|
function updateAttributesMetadata(attributes, decompressedGeometry) {
|
|
6545
7460
|
for (const key in decompressedGeometry.loaderData.attributes) {
|
|
@@ -6566,41 +7481,23 @@
|
|
|
6566
7481
|
attribute.normalized = true;
|
|
6567
7482
|
return attribute;
|
|
6568
7483
|
}
|
|
6569
|
-
function
|
|
6570
|
-
const defaultGeometrySchema = tileset.store.defaultGeometrySchema;
|
|
6571
|
-
const featureData = defaultGeometrySchema;
|
|
6572
|
-
for (const geometryAttribute in I3S_NAMED_GEOMETRY_ATTRIBUTES) {
|
|
6573
|
-
for (const namedAttribute in I3S_NAMED_VERTEX_ATTRIBUTES) {
|
|
6574
|
-
const attribute = defaultGeometrySchema[geometryAttribute][namedAttribute];
|
|
6575
|
-
if (attribute) {
|
|
6576
|
-
const { byteOffset = 0, count = 0, valueType, valuesPerElement } = attribute;
|
|
6577
|
-
featureData[geometryAttribute][namedAttribute] = {
|
|
6578
|
-
valueType,
|
|
6579
|
-
valuesPerElement,
|
|
6580
|
-
byteOffset,
|
|
6581
|
-
count
|
|
6582
|
-
};
|
|
6583
|
-
}
|
|
6584
|
-
}
|
|
6585
|
-
}
|
|
6586
|
-
featureData.attributesOrder = defaultGeometrySchema.ordering;
|
|
6587
|
-
return featureData;
|
|
6588
|
-
}
|
|
6589
|
-
function parseHeaders(content, buffer) {
|
|
7484
|
+
function parseHeaders(arrayBuffer, options) {
|
|
6590
7485
|
let byteOffset = 0;
|
|
6591
7486
|
let vertexCount = 0;
|
|
6592
7487
|
let featureCount = 0;
|
|
6593
|
-
const
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
7488
|
+
for (const { property, type } of options.store.defaultGeometrySchema.header) {
|
|
7489
|
+
const TypedArrayTypeHeader = getConstructorForDataFormat(type);
|
|
7490
|
+
switch (property) {
|
|
7491
|
+
case HeaderAttributeProperty.vertexCount:
|
|
7492
|
+
vertexCount = new TypedArrayTypeHeader(arrayBuffer, 0, 4)[0];
|
|
7493
|
+
byteOffset += sizeOf(type);
|
|
7494
|
+
break;
|
|
7495
|
+
case HeaderAttributeProperty.featureCount:
|
|
7496
|
+
featureCount = new TypedArrayTypeHeader(arrayBuffer, 4, 4)[0];
|
|
7497
|
+
byteOffset += sizeOf(type);
|
|
7498
|
+
break;
|
|
7499
|
+
default:
|
|
7500
|
+
break;
|
|
6604
7501
|
}
|
|
6605
7502
|
}
|
|
6606
7503
|
return {
|
|
@@ -6609,38 +7506,38 @@
|
|
|
6609
7506
|
byteOffset
|
|
6610
7507
|
};
|
|
6611
7508
|
}
|
|
6612
|
-
function normalizeAttributes(arrayBuffer, byteOffset, vertexAttributes,
|
|
7509
|
+
function normalizeAttributes(arrayBuffer, byteOffset, vertexAttributes, attributeCount, attributesOrder) {
|
|
6613
7510
|
const attributes = {};
|
|
6614
7511
|
for (const attribute of attributesOrder) {
|
|
6615
7512
|
if (vertexAttributes[attribute]) {
|
|
6616
7513
|
const { valueType, valuesPerElement } = vertexAttributes[attribute];
|
|
6617
|
-
|
|
6618
|
-
|
|
7514
|
+
if (byteOffset + attributeCount * valuesPerElement * sizeOf(valueType) <= arrayBuffer.byteLength) {
|
|
7515
|
+
const buffer = arrayBuffer.slice(byteOffset);
|
|
7516
|
+
let value;
|
|
7517
|
+
if (valueType === "UInt64") {
|
|
7518
|
+
value = parseUint64Values(buffer, attributeCount * valuesPerElement, sizeOf(valueType));
|
|
7519
|
+
} else {
|
|
7520
|
+
const TypedArrayType = getConstructorForDataFormat(valueType);
|
|
7521
|
+
value = new TypedArrayType(buffer, 0, attributeCount * valuesPerElement);
|
|
7522
|
+
}
|
|
7523
|
+
attributes[attribute] = {
|
|
7524
|
+
value,
|
|
7525
|
+
type: GL_TYPE_MAP[valueType],
|
|
7526
|
+
size: valuesPerElement
|
|
7527
|
+
};
|
|
7528
|
+
switch (attribute) {
|
|
7529
|
+
case "color":
|
|
7530
|
+
attributes.color.normalized = true;
|
|
7531
|
+
break;
|
|
7532
|
+
case "position":
|
|
7533
|
+
case "region":
|
|
7534
|
+
case "normal":
|
|
7535
|
+
default:
|
|
7536
|
+
}
|
|
7537
|
+
byteOffset = byteOffset + attributeCount * valuesPerElement * sizeOf(valueType);
|
|
7538
|
+
} else if (attribute !== "uv0") {
|
|
6619
7539
|
break;
|
|
6620
7540
|
}
|
|
6621
|
-
const buffer = arrayBuffer.slice(byteOffset);
|
|
6622
|
-
let value = [];
|
|
6623
|
-
if (valueType === "UInt64") {
|
|
6624
|
-
value = parseUint64Values(buffer, count * valuesPerElement, SIZEOF[valueType]);
|
|
6625
|
-
} else {
|
|
6626
|
-
const TypedArrayType = TYPE_ARRAY_MAP[valueType];
|
|
6627
|
-
value = new TypedArrayType(buffer, 0, count * valuesPerElement);
|
|
6628
|
-
}
|
|
6629
|
-
attributes[attribute] = {
|
|
6630
|
-
value,
|
|
6631
|
-
type: GL_TYPE_MAP[valueType],
|
|
6632
|
-
size: valuesPerElement
|
|
6633
|
-
};
|
|
6634
|
-
switch (attribute) {
|
|
6635
|
-
case "color":
|
|
6636
|
-
attributes.color.normalized = true;
|
|
6637
|
-
break;
|
|
6638
|
-
case "position":
|
|
6639
|
-
case "region":
|
|
6640
|
-
case "normal":
|
|
6641
|
-
default:
|
|
6642
|
-
}
|
|
6643
|
-
byteOffset = byteOffset + count * valuesPerElement * SIZEOF[valueType];
|
|
6644
7541
|
}
|
|
6645
7542
|
}
|
|
6646
7543
|
return { attributes, byteOffset };
|
|
@@ -6656,7 +7553,36 @@
|
|
|
6656
7553
|
values.push(value);
|
|
6657
7554
|
offset += attributeSize;
|
|
6658
7555
|
}
|
|
6659
|
-
return values;
|
|
7556
|
+
return new Uint32Array(values);
|
|
7557
|
+
}
|
|
7558
|
+
function parsePositions(attribute, options) {
|
|
7559
|
+
const mbs = options.mbs;
|
|
7560
|
+
const value = attribute.value;
|
|
7561
|
+
const metadata = attribute.metadata;
|
|
7562
|
+
const enuMatrix = new Matrix4();
|
|
7563
|
+
const cartographicOrigin = new Vector3(mbs[0], mbs[1], mbs[2]);
|
|
7564
|
+
const cartesianOrigin = new Vector3();
|
|
7565
|
+
Ellipsoid.WGS84.cartographicToCartesian(cartographicOrigin, cartesianOrigin);
|
|
7566
|
+
Ellipsoid.WGS84.eastNorthUpToFixedFrame(cartesianOrigin, enuMatrix);
|
|
7567
|
+
attribute.value = offsetsToCartesians(value, metadata, cartographicOrigin);
|
|
7568
|
+
return enuMatrix;
|
|
7569
|
+
}
|
|
7570
|
+
function offsetsToCartesians(vertices, metadata = {}, cartographicOrigin) {
|
|
7571
|
+
const positions = new Float64Array(vertices.length);
|
|
7572
|
+
const scaleX = metadata["i3s-scale_x"] && metadata["i3s-scale_x"].double || 1;
|
|
7573
|
+
const scaleY = metadata["i3s-scale_y"] && metadata["i3s-scale_y"].double || 1;
|
|
7574
|
+
for (let i2 = 0; i2 < positions.length; i2 += 3) {
|
|
7575
|
+
positions[i2] = vertices[i2] * scaleX + cartographicOrigin.x;
|
|
7576
|
+
positions[i2 + 1] = vertices[i2 + 1] * scaleY + cartographicOrigin.y;
|
|
7577
|
+
positions[i2 + 2] = vertices[i2 + 2] + cartographicOrigin.z;
|
|
7578
|
+
}
|
|
7579
|
+
for (let i2 = 0; i2 < positions.length; i2 += 3) {
|
|
7580
|
+
Ellipsoid.WGS84.cartographicToCartesian(positions.subarray(i2, i2 + 3), scratchVector5);
|
|
7581
|
+
positions[i2] = scratchVector5.x;
|
|
7582
|
+
positions[i2 + 1] = scratchVector5.y;
|
|
7583
|
+
positions[i2 + 2] = scratchVector5.z;
|
|
7584
|
+
}
|
|
7585
|
+
return positions;
|
|
6660
7586
|
}
|
|
6661
7587
|
function getModelMatrix(positions) {
|
|
6662
7588
|
const metadata = positions.metadata;
|
|
@@ -6694,7 +7620,9 @@
|
|
|
6694
7620
|
if (pbrMaterial.pbrMetallicRoughness && pbrMaterial.pbrMetallicRoughness.baseColorFactor) {
|
|
6695
7621
|
pbrMaterial.pbrMetallicRoughness.baseColorFactor = convertColorFormat(pbrMaterial.pbrMetallicRoughness.baseColorFactor);
|
|
6696
7622
|
}
|
|
6697
|
-
|
|
7623
|
+
if (texture) {
|
|
7624
|
+
setMaterialTexture(pbrMaterial, texture);
|
|
7625
|
+
}
|
|
6698
7626
|
return pbrMaterial;
|
|
6699
7627
|
}
|
|
6700
7628
|
function convertColorFormat(colorFactor) {
|
|
@@ -6756,17 +7684,17 @@
|
|
|
6756
7684
|
attributes.id.value = result;
|
|
6757
7685
|
}
|
|
6758
7686
|
function getFeatureIdsFromFeatureIndexMetadata(featureIndex) {
|
|
6759
|
-
return featureIndex
|
|
7687
|
+
return featureIndex?.metadata?.["i3s-feature-ids"]?.intArray;
|
|
6760
7688
|
}
|
|
6761
7689
|
|
|
6762
7690
|
// src/i3s-content-loader.ts
|
|
6763
|
-
var
|
|
7691
|
+
var VERSION9 = true ? "4.0.0-alpha.11" : "beta";
|
|
6764
7692
|
var I3SContentLoader = {
|
|
6765
7693
|
name: "I3S Content (Indexed Scene Layers)",
|
|
6766
7694
|
id: "i3s-content",
|
|
6767
7695
|
module: "i3s",
|
|
6768
7696
|
worker: true,
|
|
6769
|
-
version:
|
|
7697
|
+
version: VERSION9,
|
|
6770
7698
|
mimeTypes: ["application/octet-stream"],
|
|
6771
7699
|
parse: parse3,
|
|
6772
7700
|
extensions: ["bin"],
|
|
@@ -6775,9 +7703,13 @@
|
|
|
6775
7703
|
}
|
|
6776
7704
|
};
|
|
6777
7705
|
async function parse3(data, options, context) {
|
|
6778
|
-
const { tile, tileset } = options?.i3s || {};
|
|
6779
|
-
|
|
6780
|
-
|
|
7706
|
+
const { tile, _tileOptions, tileset, _tilesetOptions } = options?.i3s || {};
|
|
7707
|
+
const tileOptions = _tileOptions || tile;
|
|
7708
|
+
const tilesetOptions = _tilesetOptions || tileset;
|
|
7709
|
+
if (!tileOptions || !tilesetOptions) {
|
|
7710
|
+
return null;
|
|
7711
|
+
}
|
|
7712
|
+
return await parseI3STileContent(data, tileOptions, tilesetOptions, options, context);
|
|
6781
7713
|
}
|
|
6782
7714
|
|
|
6783
7715
|
// src/workers/i3s-content-worker.ts
|