@loaders.gl/gltf 3.2.12 → 3.3.0-alpha.10
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/dist.min.js +1499 -45
- package/dist/es5/bundle.js +0 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/glb-loader.js +2 -13
- package/dist/es5/glb-loader.js.map +1 -1
- package/dist/es5/glb-writer.js +3 -6
- package/dist/es5/glb-writer.js.map +1 -1
- package/dist/es5/gltf-loader.js +11 -23
- package/dist/es5/gltf-loader.js.map +1 -1
- package/dist/es5/gltf-writer.js +2 -5
- package/dist/es5/gltf-writer.js.map +1 -1
- package/dist/es5/index.js +10 -17
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/api/gltf-extensions.js +16 -46
- package/dist/es5/lib/api/gltf-extensions.js.map +1 -1
- package/dist/es5/lib/api/gltf-scenegraph.js +128 -96
- package/dist/es5/lib/api/gltf-scenegraph.js.map +1 -1
- package/dist/es5/lib/api/normalize-gltf-v1.js +32 -70
- package/dist/es5/lib/api/normalize-gltf-v1.js.map +1 -1
- package/dist/es5/lib/api/post-process-gltf.js +26 -89
- package/dist/es5/lib/api/post-process-gltf.js.map +1 -1
- package/dist/es5/lib/encoders/encode-glb.js +10 -8
- package/dist/es5/lib/encoders/encode-glb.js.map +1 -1
- package/dist/es5/lib/encoders/encode-gltf.js +3 -6
- package/dist/es5/lib/encoders/encode-gltf.js.map +1 -1
- package/dist/es5/lib/extensions/EXT_meshopt_compression.js +2 -28
- package/dist/es5/lib/extensions/EXT_meshopt_compression.js.map +1 -1
- package/dist/es5/lib/extensions/EXT_texture_webp.js +5 -18
- package/dist/es5/lib/extensions/EXT_texture_webp.js.map +1 -1
- package/dist/es5/lib/extensions/KHR_binary_gltf.js +5 -12
- package/dist/es5/lib/extensions/KHR_binary_gltf.js.map +1 -1
- package/dist/es5/lib/extensions/KHR_draco_mesh_compression.js +11 -79
- package/dist/es5/lib/extensions/KHR_draco_mesh_compression.js.map +1 -1
- package/dist/es5/lib/extensions/KHR_texture_basisu.js +5 -14
- package/dist/es5/lib/extensions/KHR_texture_basisu.js.map +1 -1
- package/dist/es5/lib/extensions/KHR_texture_transform.js +238 -0
- package/dist/es5/lib/extensions/KHR_texture_transform.js.map +1 -0
- package/dist/es5/lib/extensions/deprecated/EXT_feature_metadata.js +110 -0
- package/dist/es5/lib/extensions/deprecated/EXT_feature_metadata.js.map +1 -0
- package/dist/es5/lib/extensions/deprecated/KHR_lights_punctual.js +0 -24
- package/dist/es5/lib/extensions/deprecated/KHR_lights_punctual.js.map +1 -1
- package/dist/es5/lib/extensions/deprecated/KHR_materials_unlit.js +3 -20
- package/dist/es5/lib/extensions/deprecated/KHR_materials_unlit.js.map +1 -1
- package/dist/es5/lib/extensions/deprecated/KHR_techniques_webgl.js +12 -29
- package/dist/es5/lib/extensions/deprecated/KHR_techniques_webgl.js.map +1 -1
- package/dist/es5/lib/gltf-utils/get-typed-array.js +1 -1
- package/dist/es5/lib/gltf-utils/get-typed-array.js.map +1 -1
- package/dist/es5/lib/gltf-utils/gltf-attribute-utils.js +5 -17
- package/dist/es5/lib/gltf-utils/gltf-attribute-utils.js.map +1 -1
- package/dist/es5/lib/gltf-utils/gltf-constants.js +5 -3
- package/dist/es5/lib/gltf-utils/gltf-constants.js.map +1 -1
- package/dist/es5/lib/gltf-utils/gltf-utils.js +1 -8
- package/dist/es5/lib/gltf-utils/gltf-utils.js.map +1 -1
- package/dist/es5/lib/gltf-utils/resolve-url.js +0 -5
- package/dist/es5/lib/gltf-utils/resolve-url.js.map +1 -1
- package/dist/es5/lib/parsers/parse-glb.js +11 -17
- package/dist/es5/lib/parsers/parse-glb.js.map +1 -1
- package/dist/es5/lib/parsers/parse-gltf.js +20 -78
- package/dist/es5/lib/parsers/parse-gltf.js.map +1 -1
- package/dist/es5/lib/types/glb-types.js.map +1 -1
- package/dist/es5/lib/types/gltf-json-schema.js.map +1 -1
- package/dist/es5/lib/types/gltf-postprocessed-schema.js.map +1 -1
- package/dist/es5/lib/types/gltf-types.js.map +1 -1
- package/dist/es5/lib/utils/assert.js +0 -1
- package/dist/es5/lib/utils/assert.js.map +1 -1
- package/dist/es5/lib/utils/version.js +1 -1
- package/dist/es5/lib/utils/version.js.map +1 -1
- package/dist/es5/meshopt/meshopt-decoder.js +10 -47
- package/dist/es5/meshopt/meshopt-decoder.js.map +1 -1
- package/dist/es5/webp/webp.js +3 -19
- package/dist/es5/webp/webp.js.map +1 -1
- package/dist/esm/bundle.js +1 -1
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/glb-loader.js +0 -1
- package/dist/esm/glb-loader.js.map +1 -1
- package/dist/esm/glb-writer.js +3 -1
- package/dist/esm/glb-writer.js.map +1 -1
- package/dist/esm/gltf-loader.js +9 -3
- package/dist/esm/gltf-loader.js.map +1 -1
- package/dist/esm/gltf-writer.js +3 -2
- package/dist/esm/gltf-writer.js.map +1 -1
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/api/gltf-extensions.js +18 -9
- package/dist/esm/lib/api/gltf-extensions.js.map +1 -1
- package/dist/esm/lib/api/gltf-scenegraph.js +40 -68
- package/dist/esm/lib/api/gltf-scenegraph.js.map +1 -1
- package/dist/esm/lib/api/normalize-gltf-v1.js +3 -34
- package/dist/esm/lib/api/normalize-gltf-v1.js.map +1 -1
- package/dist/esm/lib/api/post-process-gltf.js +26 -93
- package/dist/esm/lib/api/post-process-gltf.js.map +1 -1
- package/dist/esm/lib/encoders/encode-glb.js +9 -2
- package/dist/esm/lib/encoders/encode-glb.js.map +1 -1
- package/dist/esm/lib/encoders/encode-gltf.js +6 -4
- package/dist/esm/lib/encoders/encode-gltf.js.map +1 -1
- package/dist/esm/lib/extensions/EXT_meshopt_compression.js +5 -6
- package/dist/esm/lib/extensions/EXT_meshopt_compression.js.map +1 -1
- package/dist/esm/lib/extensions/EXT_texture_webp.js +4 -6
- package/dist/esm/lib/extensions/EXT_texture_webp.js.map +1 -1
- package/dist/esm/lib/extensions/KHR_binary_gltf.js +3 -2
- package/dist/esm/lib/extensions/KHR_binary_gltf.js.map +1 -1
- package/dist/esm/lib/extensions/KHR_draco_mesh_compression.js +18 -17
- package/dist/esm/lib/extensions/KHR_draco_mesh_compression.js.map +1 -1
- package/dist/esm/lib/extensions/KHR_texture_basisu.js +4 -3
- package/dist/esm/lib/extensions/KHR_texture_basisu.js.map +1 -1
- package/dist/esm/lib/extensions/KHR_texture_transform.js +192 -0
- package/dist/esm/lib/extensions/KHR_texture_transform.js.map +1 -0
- package/dist/esm/lib/extensions/deprecated/EXT_feature_metadata.js +84 -0
- package/dist/esm/lib/extensions/deprecated/EXT_feature_metadata.js.map +1 -0
- package/dist/esm/lib/extensions/deprecated/KHR_lights_punctual.js +4 -4
- package/dist/esm/lib/extensions/deprecated/KHR_lights_punctual.js.map +1 -1
- package/dist/esm/lib/extensions/deprecated/KHR_materials_unlit.js +4 -3
- package/dist/esm/lib/extensions/deprecated/KHR_materials_unlit.js.map +1 -1
- package/dist/esm/lib/extensions/deprecated/KHR_techniques_webgl.js +10 -9
- package/dist/esm/lib/extensions/deprecated/KHR_techniques_webgl.js.map +1 -1
- package/dist/esm/lib/gltf-utils/get-typed-array.js +4 -0
- package/dist/esm/lib/gltf-utils/get-typed-array.js.map +1 -1
- package/dist/esm/lib/gltf-utils/gltf-attribute-utils.js +7 -11
- package/dist/esm/lib/gltf-utils/gltf-attribute-utils.js.map +1 -1
- package/dist/esm/lib/gltf-utils/gltf-constants.js +3 -2
- package/dist/esm/lib/gltf-utils/gltf-constants.js.map +1 -1
- package/dist/esm/lib/gltf-utils/gltf-utils.js +0 -2
- package/dist/esm/lib/gltf-utils/gltf-utils.js.map +1 -1
- package/dist/esm/lib/gltf-utils/resolve-url.js +1 -4
- package/dist/esm/lib/gltf-utils/resolve-url.js.map +1 -1
- package/dist/esm/lib/parsers/parse-glb.js +19 -16
- package/dist/esm/lib/parsers/parse-glb.js.map +1 -1
- package/dist/esm/lib/parsers/parse-gltf.js +14 -16
- package/dist/esm/lib/parsers/parse-gltf.js.map +1 -1
- package/dist/esm/lib/types/glb-types.js.map +1 -1
- package/dist/esm/lib/types/gltf-json-schema.js.map +1 -1
- package/dist/esm/lib/types/gltf-postprocessed-schema.js.map +1 -1
- package/dist/esm/lib/types/gltf-types.js.map +1 -1
- package/dist/esm/lib/utils/assert.js +1 -0
- package/dist/esm/lib/utils/assert.js.map +1 -1
- package/dist/esm/lib/utils/version.js +2 -1
- package/dist/esm/lib/utils/version.js.map +1 -1
- package/dist/esm/meshopt/meshopt-decoder.js +11 -15
- package/dist/esm/meshopt/meshopt-decoder.js.map +1 -1
- package/dist/esm/webp/webp.js +3 -5
- package/dist/esm/webp/webp.js.map +1 -1
- package/dist/glb-loader.d.ts +1 -1
- package/dist/glb-loader.d.ts.map +1 -1
- package/dist/gltf-loader.d.ts +1 -1
- package/dist/gltf-loader.d.ts.map +1 -1
- package/dist/gltf-writer.d.ts +1 -1
- package/dist/gltf-writer.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/api/gltf-extensions.d.ts +6 -1
- package/dist/lib/api/gltf-extensions.d.ts.map +1 -1
- package/dist/lib/api/gltf-extensions.js +10 -2
- package/dist/lib/api/gltf-scenegraph.d.ts +5 -11
- package/dist/lib/api/gltf-scenegraph.d.ts.map +1 -1
- package/dist/lib/api/gltf-scenegraph.js +13 -0
- package/dist/lib/api/normalize-gltf-v1.js +5 -1
- package/dist/lib/extensions/EXT_meshopt_compression.js +1 -1
- package/dist/lib/extensions/EXT_texture_webp.d.ts.map +1 -1
- package/dist/lib/extensions/EXT_texture_webp.js +1 -0
- package/dist/lib/extensions/KHR_binary_gltf.js +1 -1
- package/dist/lib/extensions/KHR_draco_mesh_compression.js +1 -1
- package/dist/lib/extensions/KHR_texture_basisu.d.ts.map +1 -1
- package/dist/lib/extensions/KHR_texture_basisu.js +1 -0
- package/dist/lib/extensions/KHR_texture_transform.d.ts +13 -0
- package/dist/lib/extensions/KHR_texture_transform.d.ts.map +1 -0
- package/dist/lib/extensions/KHR_texture_transform.js +230 -0
- package/dist/lib/extensions/deprecated/EXT_feature_metadata.d.ts +6 -0
- package/dist/lib/extensions/deprecated/EXT_feature_metadata.d.ts.map +1 -0
- package/dist/lib/extensions/deprecated/EXT_feature_metadata.js +118 -0
- package/dist/lib/extensions/deprecated/KHR_materials_unlit.js +2 -2
- package/dist/lib/extensions/deprecated/KHR_techniques_webgl.d.ts.map +1 -1
- package/dist/lib/extensions/deprecated/KHR_techniques_webgl.js +1 -0
- package/dist/lib/gltf-utils/gltf-constants.d.ts +17 -0
- package/dist/lib/gltf-utils/gltf-constants.d.ts.map +1 -1
- package/dist/lib/gltf-utils/gltf-constants.js +5 -5
- package/dist/lib/parsers/parse-glb.d.ts +1 -1
- package/dist/lib/parsers/parse-glb.d.ts.map +1 -1
- package/dist/lib/parsers/parse-gltf.d.ts +1 -1
- package/dist/lib/parsers/parse-gltf.d.ts.map +1 -1
- package/dist/lib/parsers/parse-gltf.js +8 -1
- package/dist/lib/types/glb-types.d.ts +2 -2
- package/dist/lib/types/glb-types.d.ts.map +1 -1
- package/dist/lib/types/gltf-json-schema.d.ts +396 -11
- package/dist/lib/types/gltf-json-schema.d.ts.map +1 -1
- package/dist/lib/types/gltf-postprocessed-schema.d.ts +1 -1
- package/dist/lib/types/gltf-postprocessed-schema.d.ts.map +1 -1
- package/dist/lib/types/gltf-types.d.ts +8 -5
- package/dist/lib/types/gltf-types.d.ts.map +1 -1
- package/dist/webp/webp.d.ts +1 -1
- package/dist/webp/webp.d.ts.map +1 -1
- package/package.json +7 -6
- package/src/index.ts +7 -1
- package/src/lib/api/gltf-extensions.ts +13 -2
- package/src/lib/api/gltf-scenegraph.ts +21 -12
- package/src/lib/extensions/EXT_meshopt_compression.ts +1 -1
- package/src/lib/extensions/EXT_texture_webp.ts +1 -0
- package/src/lib/extensions/KHR_binary_gltf.ts +1 -1
- package/src/lib/extensions/KHR_draco_mesh_compression.ts +1 -1
- package/src/lib/extensions/KHR_texture_basisu.ts +1 -0
- package/src/lib/extensions/KHR_texture_transform.ts +305 -0
- package/src/lib/extensions/deprecated/EXT_feature_metadata.ts +163 -0
- package/src/lib/extensions/deprecated/KHR_materials_unlit.ts +3 -3
- package/src/lib/extensions/deprecated/KHR_techniques_webgl.ts +1 -0
- package/src/lib/gltf-utils/gltf-constants.ts +2 -2
- package/src/lib/parsers/parse-gltf.ts +3 -0
- package/src/lib/types/gltf-json-schema.ts +434 -5
- package/src/lib/types/gltf-types.ts +9 -2
package/dist/dist.min.js
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
};
|
|
15
15
|
var __export = (target, all) => {
|
|
16
16
|
__markAsModule(target);
|
|
17
|
-
for (var
|
|
18
|
-
__defProp(target,
|
|
17
|
+
for (var name10 in all)
|
|
18
|
+
__defProp(target, name10, { get: all[name10], enumerable: true });
|
|
19
19
|
};
|
|
20
20
|
var __reExport = (target, module, desc) => {
|
|
21
21
|
if (module && typeof module === "object" || typeof module === "function") {
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
var DEFAULT_VERSION, VERSION2;
|
|
73
73
|
var init_version2 = __esm({
|
|
74
74
|
"../worker-utils/src/lib/env-utils/version.ts"() {
|
|
75
|
-
DEFAULT_VERSION = "
|
|
75
|
+
DEFAULT_VERSION = "beta";
|
|
76
76
|
VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : DEFAULT_VERSION;
|
|
77
77
|
if (typeof __VERSION__ === "undefined") {
|
|
78
78
|
console.error("loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.");
|
|
@@ -191,7 +191,7 @@
|
|
|
191
191
|
node = __toModule(require_require_utils());
|
|
192
192
|
init_assert2();
|
|
193
193
|
init_version2();
|
|
194
|
-
LATEST = "
|
|
194
|
+
LATEST = "beta";
|
|
195
195
|
VERSION3 = typeof VERSION2 !== "undefined" ? VERSION2 : LATEST;
|
|
196
196
|
loadLibraryPromises = {};
|
|
197
197
|
}
|
|
@@ -200,6 +200,7 @@
|
|
|
200
200
|
// ../worker-utils/src/index.ts
|
|
201
201
|
var init_src = __esm({
|
|
202
202
|
"../worker-utils/src/index.ts"() {
|
|
203
|
+
init_globals2();
|
|
203
204
|
init_library_utils();
|
|
204
205
|
}
|
|
205
206
|
});
|
|
@@ -324,7 +325,7 @@
|
|
|
324
325
|
var VERSION4;
|
|
325
326
|
var init_version3 = __esm({
|
|
326
327
|
"../textures/src/lib/utils/version.ts"() {
|
|
327
|
-
VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "
|
|
328
|
+
VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
|
|
328
329
|
}
|
|
329
330
|
});
|
|
330
331
|
|
|
@@ -753,11 +754,12 @@
|
|
|
753
754
|
var BasisWorkerLoader, BasisLoader;
|
|
754
755
|
var init_basis_loader = __esm({
|
|
755
756
|
"../textures/src/basis-loader.ts"() {
|
|
757
|
+
init_src();
|
|
756
758
|
init_version3();
|
|
757
759
|
init_parse_basis();
|
|
758
760
|
BasisWorkerLoader = {
|
|
759
761
|
name: "Basis",
|
|
760
|
-
id: "basis",
|
|
762
|
+
id: isBrowser2 ? "basis" : "basis-nodejs",
|
|
761
763
|
module: "textures",
|
|
762
764
|
version: VERSION4,
|
|
763
765
|
worker: true,
|
|
@@ -1396,12 +1398,12 @@
|
|
|
1396
1398
|
return extras[key];
|
|
1397
1399
|
}
|
|
1398
1400
|
getExtension(extensionName) {
|
|
1399
|
-
const isExtension = this.getUsedExtensions().find((
|
|
1401
|
+
const isExtension = this.getUsedExtensions().find((name10) => name10 === extensionName);
|
|
1400
1402
|
const extensions = this.json.extensions || {};
|
|
1401
1403
|
return isExtension ? extensions[extensionName] || true : null;
|
|
1402
1404
|
}
|
|
1403
1405
|
getRequiredExtension(extensionName) {
|
|
1404
|
-
const isRequired = this.getRequiredExtensions().find((
|
|
1406
|
+
const isRequired = this.getRequiredExtensions().find((name10) => name10 === extensionName);
|
|
1405
1407
|
return isRequired ? this.getExtension(extensionName) : null;
|
|
1406
1408
|
}
|
|
1407
1409
|
getRequiredExtensions() {
|
|
@@ -1410,6 +1412,9 @@
|
|
|
1410
1412
|
getUsedExtensions() {
|
|
1411
1413
|
return this.json.extensionsUsed || [];
|
|
1412
1414
|
}
|
|
1415
|
+
getRemovedExtensions() {
|
|
1416
|
+
return this.json.extensionsRemoved || [];
|
|
1417
|
+
}
|
|
1413
1418
|
getObjectExtension(object, extensionName) {
|
|
1414
1419
|
const extensions = object.extensions || {};
|
|
1415
1420
|
return extensions[extensionName];
|
|
@@ -1534,6 +1539,9 @@
|
|
|
1534
1539
|
}
|
|
1535
1540
|
}
|
|
1536
1541
|
removeExtension(extensionName) {
|
|
1542
|
+
if (!this.getExtension(extensionName)) {
|
|
1543
|
+
return;
|
|
1544
|
+
}
|
|
1537
1545
|
if (this.json.extensionsRequired) {
|
|
1538
1546
|
this._removeStringFromArray(this.json.extensionsRequired, extensionName);
|
|
1539
1547
|
}
|
|
@@ -1543,6 +1551,13 @@
|
|
|
1543
1551
|
if (this.json.extensions) {
|
|
1544
1552
|
delete this.json.extensions[extensionName];
|
|
1545
1553
|
}
|
|
1554
|
+
if (!Array.isArray(this.json.extensionsRemoved)) {
|
|
1555
|
+
this.json.extensionsRemoved = [];
|
|
1556
|
+
}
|
|
1557
|
+
const extensionsRemoved = this.json.extensionsRemoved;
|
|
1558
|
+
if (!extensionsRemoved.includes(extensionName)) {
|
|
1559
|
+
extensionsRemoved.push(extensionName);
|
|
1560
|
+
}
|
|
1546
1561
|
}
|
|
1547
1562
|
setDefaultScene(sceneIndex) {
|
|
1548
1563
|
this.json.scene = sceneIndex;
|
|
@@ -2064,6 +2079,7 @@
|
|
|
2064
2079
|
var DEFAULT_DRACO_OPTIONS, DracoLoader;
|
|
2065
2080
|
var init_draco_loader = __esm({
|
|
2066
2081
|
"../draco/src/draco-loader.ts"() {
|
|
2082
|
+
init_src();
|
|
2067
2083
|
init_version5();
|
|
2068
2084
|
DEFAULT_DRACO_OPTIONS = {
|
|
2069
2085
|
draco: {
|
|
@@ -2075,7 +2091,7 @@
|
|
|
2075
2091
|
};
|
|
2076
2092
|
DracoLoader = {
|
|
2077
2093
|
name: "Draco",
|
|
2078
|
-
id: "draco",
|
|
2094
|
+
id: isBrowser2 ? "draco" : "draco-nodejs",
|
|
2079
2095
|
module: "draco",
|
|
2080
2096
|
shapes: ["mesh"],
|
|
2081
2097
|
version: VERSION7,
|
|
@@ -2171,8 +2187,8 @@
|
|
|
2171
2187
|
}
|
|
2172
2188
|
select(...columnNames) {
|
|
2173
2189
|
const nameMap = Object.create(null);
|
|
2174
|
-
for (const
|
|
2175
|
-
nameMap[
|
|
2190
|
+
for (const name10 of columnNames) {
|
|
2191
|
+
nameMap[name10] = true;
|
|
2176
2192
|
}
|
|
2177
2193
|
const selectedFields = this.fields.filter((field) => nameMap[field.name]);
|
|
2178
2194
|
return new Schema(selectedFields, this.metadata);
|
|
@@ -2210,8 +2226,8 @@
|
|
|
2210
2226
|
var init_field = __esm({
|
|
2211
2227
|
"../schema/src/lib/schema/impl/field.ts"() {
|
|
2212
2228
|
Field = class {
|
|
2213
|
-
constructor(
|
|
2214
|
-
this.name =
|
|
2229
|
+
constructor(name10, type, nullable = false, metadata = new Map()) {
|
|
2230
|
+
this.name = name10;
|
|
2215
2231
|
this.type = type;
|
|
2216
2232
|
this.nullable = nullable;
|
|
2217
2233
|
this.metadata = metadata;
|
|
@@ -3096,15 +3112,17 @@
|
|
|
3096
3112
|
});
|
|
3097
3113
|
});
|
|
3098
3114
|
}
|
|
3099
|
-
var
|
|
3115
|
+
var DRACO_DECODER_VERSION, DRACO_ENCODER_VERSION, STATIC_DECODER_URL, DRACO_JS_DECODER_URL, DRACO_WASM_WRAPPER_URL, DRACO_WASM_DECODER_URL, DRACO_ENCODER_URL, loadDecoderPromise;
|
|
3100
3116
|
var init_draco_module_loader = __esm({
|
|
3101
3117
|
"../draco/src/lib/draco-module-loader.ts"() {
|
|
3102
3118
|
init_src();
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3119
|
+
DRACO_DECODER_VERSION = "1.5.5";
|
|
3120
|
+
DRACO_ENCODER_VERSION = "1.4.1";
|
|
3121
|
+
STATIC_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_DECODER_VERSION}`;
|
|
3122
|
+
DRACO_JS_DECODER_URL = `${STATIC_DECODER_URL}/draco_decoder.js`;
|
|
3123
|
+
DRACO_WASM_WRAPPER_URL = `${STATIC_DECODER_URL}/draco_wasm_wrapper.js`;
|
|
3124
|
+
DRACO_WASM_DECODER_URL = `${STATIC_DECODER_URL}/draco_decoder.wasm`;
|
|
3125
|
+
DRACO_ENCODER_URL = `https://raw.githubusercontent.com/google/draco/${DRACO_ENCODER_VERSION}/javascript/draco_encoder.js`;
|
|
3108
3126
|
}
|
|
3109
3127
|
});
|
|
3110
3128
|
|
|
@@ -3134,11 +3152,11 @@
|
|
|
3134
3152
|
// src/lib/gltf-utils/gltf-attribute-utils.ts
|
|
3135
3153
|
function getGLTFAccessors(attributes) {
|
|
3136
3154
|
const accessors = {};
|
|
3137
|
-
for (const
|
|
3138
|
-
const attribute = attributes[
|
|
3139
|
-
if (
|
|
3155
|
+
for (const name10 in attributes) {
|
|
3156
|
+
const attribute = attributes[name10];
|
|
3157
|
+
if (name10 !== "indices") {
|
|
3140
3158
|
const glTFAccessor = getGLTFAccessor(attribute);
|
|
3141
|
-
accessors[
|
|
3159
|
+
accessors[name10] = glTFAccessor;
|
|
3142
3160
|
}
|
|
3143
3161
|
}
|
|
3144
3162
|
return accessors;
|
|
@@ -3301,14 +3319,1358 @@
|
|
|
3301
3319
|
}
|
|
3302
3320
|
});
|
|
3303
3321
|
|
|
3322
|
+
// ../../node_modules/@math.gl/core/dist/esm/lib/assert.js
|
|
3323
|
+
function assert5(condition, message) {
|
|
3324
|
+
if (!condition) {
|
|
3325
|
+
throw new Error("math.gl assertion ".concat(message));
|
|
3326
|
+
}
|
|
3327
|
+
}
|
|
3328
|
+
var init_assert5 = __esm({
|
|
3329
|
+
"../../node_modules/@math.gl/core/dist/esm/lib/assert.js"() {
|
|
3330
|
+
}
|
|
3331
|
+
});
|
|
3332
|
+
|
|
3333
|
+
// ../../node_modules/@math.gl/core/dist/esm/lib/common.js
|
|
3334
|
+
function formatValue(value, {
|
|
3335
|
+
precision = config.precision
|
|
3336
|
+
} = {}) {
|
|
3337
|
+
value = round(value);
|
|
3338
|
+
return "".concat(parseFloat(value.toPrecision(precision)));
|
|
3339
|
+
}
|
|
3340
|
+
function isArray(value) {
|
|
3341
|
+
return Array.isArray(value) || ArrayBuffer.isView(value) && !(value instanceof DataView);
|
|
3342
|
+
}
|
|
3343
|
+
function equals(a2, b, epsilon) {
|
|
3344
|
+
const oldEpsilon = config.EPSILON;
|
|
3345
|
+
if (epsilon) {
|
|
3346
|
+
config.EPSILON = epsilon;
|
|
3347
|
+
}
|
|
3348
|
+
try {
|
|
3349
|
+
if (a2 === b) {
|
|
3350
|
+
return true;
|
|
3351
|
+
}
|
|
3352
|
+
if (isArray(a2) && isArray(b)) {
|
|
3353
|
+
if (a2.length !== b.length) {
|
|
3354
|
+
return false;
|
|
3355
|
+
}
|
|
3356
|
+
for (let i2 = 0; i2 < a2.length; ++i2) {
|
|
3357
|
+
if (!equals(a2[i2], b[i2])) {
|
|
3358
|
+
return false;
|
|
3359
|
+
}
|
|
3360
|
+
}
|
|
3361
|
+
return true;
|
|
3362
|
+
}
|
|
3363
|
+
if (a2 && a2.equals) {
|
|
3364
|
+
return a2.equals(b);
|
|
3365
|
+
}
|
|
3366
|
+
if (b && b.equals) {
|
|
3367
|
+
return b.equals(a2);
|
|
3368
|
+
}
|
|
3369
|
+
if (typeof a2 === "number" && typeof b === "number") {
|
|
3370
|
+
return Math.abs(a2 - b) <= config.EPSILON * Math.max(1, Math.abs(a2), Math.abs(b));
|
|
3371
|
+
}
|
|
3372
|
+
return false;
|
|
3373
|
+
} finally {
|
|
3374
|
+
config.EPSILON = oldEpsilon;
|
|
3375
|
+
}
|
|
3376
|
+
}
|
|
3377
|
+
function round(value) {
|
|
3378
|
+
return Math.round(value / config.EPSILON) * config.EPSILON;
|
|
3379
|
+
}
|
|
3380
|
+
var RADIANS_TO_DEGREES, DEGREES_TO_RADIANS, config;
|
|
3381
|
+
var init_common = __esm({
|
|
3382
|
+
"../../node_modules/@math.gl/core/dist/esm/lib/common.js"() {
|
|
3383
|
+
RADIANS_TO_DEGREES = 1 / Math.PI * 180;
|
|
3384
|
+
DEGREES_TO_RADIANS = 1 / 180 * Math.PI;
|
|
3385
|
+
config = {
|
|
3386
|
+
EPSILON: 1e-12,
|
|
3387
|
+
debug: false,
|
|
3388
|
+
precision: 4,
|
|
3389
|
+
printTypes: false,
|
|
3390
|
+
printDegrees: false,
|
|
3391
|
+
printRowMajor: true
|
|
3392
|
+
};
|
|
3393
|
+
}
|
|
3394
|
+
});
|
|
3395
|
+
|
|
3396
|
+
// ../../node_modules/@math.gl/core/dist/esm/classes/base/math-array.js
|
|
3397
|
+
function _extendableBuiltin(cls) {
|
|
3398
|
+
function ExtendableBuiltin() {
|
|
3399
|
+
var instance = Reflect.construct(cls, Array.from(arguments));
|
|
3400
|
+
Object.setPrototypeOf(instance, Object.getPrototypeOf(this));
|
|
3401
|
+
return instance;
|
|
3402
|
+
}
|
|
3403
|
+
ExtendableBuiltin.prototype = Object.create(cls.prototype, {
|
|
3404
|
+
constructor: {
|
|
3405
|
+
value: cls,
|
|
3406
|
+
enumerable: false,
|
|
3407
|
+
writable: true,
|
|
3408
|
+
configurable: true
|
|
3409
|
+
}
|
|
3410
|
+
});
|
|
3411
|
+
if (Object.setPrototypeOf) {
|
|
3412
|
+
Object.setPrototypeOf(ExtendableBuiltin, cls);
|
|
3413
|
+
} else {
|
|
3414
|
+
ExtendableBuiltin.__proto__ = cls;
|
|
3415
|
+
}
|
|
3416
|
+
return ExtendableBuiltin;
|
|
3417
|
+
}
|
|
3418
|
+
var MathArray;
|
|
3419
|
+
var init_math_array = __esm({
|
|
3420
|
+
"../../node_modules/@math.gl/core/dist/esm/classes/base/math-array.js"() {
|
|
3421
|
+
init_common();
|
|
3422
|
+
MathArray = class extends _extendableBuiltin(Array) {
|
|
3423
|
+
clone() {
|
|
3424
|
+
return new this.constructor().copy(this);
|
|
3425
|
+
}
|
|
3426
|
+
fromArray(array, offset = 0) {
|
|
3427
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3428
|
+
this[i2] = array[i2 + offset];
|
|
3429
|
+
}
|
|
3430
|
+
return this.check();
|
|
3431
|
+
}
|
|
3432
|
+
toArray(targetArray = [], offset = 0) {
|
|
3433
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3434
|
+
targetArray[offset + i2] = this[i2];
|
|
3435
|
+
}
|
|
3436
|
+
return targetArray;
|
|
3437
|
+
}
|
|
3438
|
+
from(arrayOrObject) {
|
|
3439
|
+
return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : this.fromObject(arrayOrObject);
|
|
3440
|
+
}
|
|
3441
|
+
to(arrayOrObject) {
|
|
3442
|
+
if (arrayOrObject === this) {
|
|
3443
|
+
return this;
|
|
3444
|
+
}
|
|
3445
|
+
return isArray(arrayOrObject) ? this.toArray(arrayOrObject) : this.toObject(arrayOrObject);
|
|
3446
|
+
}
|
|
3447
|
+
toTarget(target) {
|
|
3448
|
+
return target ? this.to(target) : this;
|
|
3449
|
+
}
|
|
3450
|
+
toFloat32Array() {
|
|
3451
|
+
return new Float32Array(this);
|
|
3452
|
+
}
|
|
3453
|
+
toString() {
|
|
3454
|
+
return this.formatString(config);
|
|
3455
|
+
}
|
|
3456
|
+
formatString(opts) {
|
|
3457
|
+
let string = "";
|
|
3458
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3459
|
+
string += (i2 > 0 ? ", " : "") + formatValue(this[i2], opts);
|
|
3460
|
+
}
|
|
3461
|
+
return "".concat(opts.printTypes ? this.constructor.name : "", "[").concat(string, "]");
|
|
3462
|
+
}
|
|
3463
|
+
equals(array) {
|
|
3464
|
+
if (!array || this.length !== array.length) {
|
|
3465
|
+
return false;
|
|
3466
|
+
}
|
|
3467
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3468
|
+
if (!equals(this[i2], array[i2])) {
|
|
3469
|
+
return false;
|
|
3470
|
+
}
|
|
3471
|
+
}
|
|
3472
|
+
return true;
|
|
3473
|
+
}
|
|
3474
|
+
exactEquals(array) {
|
|
3475
|
+
if (!array || this.length !== array.length) {
|
|
3476
|
+
return false;
|
|
3477
|
+
}
|
|
3478
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3479
|
+
if (this[i2] !== array[i2]) {
|
|
3480
|
+
return false;
|
|
3481
|
+
}
|
|
3482
|
+
}
|
|
3483
|
+
return true;
|
|
3484
|
+
}
|
|
3485
|
+
negate() {
|
|
3486
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3487
|
+
this[i2] = -this[i2];
|
|
3488
|
+
}
|
|
3489
|
+
return this.check();
|
|
3490
|
+
}
|
|
3491
|
+
lerp(a2, b, t2) {
|
|
3492
|
+
if (t2 === void 0) {
|
|
3493
|
+
return this.lerp(this, a2, b);
|
|
3494
|
+
}
|
|
3495
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3496
|
+
const ai = a2[i2];
|
|
3497
|
+
this[i2] = ai + t2 * (b[i2] - ai);
|
|
3498
|
+
}
|
|
3499
|
+
return this.check();
|
|
3500
|
+
}
|
|
3501
|
+
min(vector) {
|
|
3502
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3503
|
+
this[i2] = Math.min(vector[i2], this[i2]);
|
|
3504
|
+
}
|
|
3505
|
+
return this.check();
|
|
3506
|
+
}
|
|
3507
|
+
max(vector) {
|
|
3508
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3509
|
+
this[i2] = Math.max(vector[i2], this[i2]);
|
|
3510
|
+
}
|
|
3511
|
+
return this.check();
|
|
3512
|
+
}
|
|
3513
|
+
clamp(minVector, maxVector) {
|
|
3514
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3515
|
+
this[i2] = Math.min(Math.max(this[i2], minVector[i2]), maxVector[i2]);
|
|
3516
|
+
}
|
|
3517
|
+
return this.check();
|
|
3518
|
+
}
|
|
3519
|
+
add(...vectors) {
|
|
3520
|
+
for (const vector of vectors) {
|
|
3521
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3522
|
+
this[i2] += vector[i2];
|
|
3523
|
+
}
|
|
3524
|
+
}
|
|
3525
|
+
return this.check();
|
|
3526
|
+
}
|
|
3527
|
+
subtract(...vectors) {
|
|
3528
|
+
for (const vector of vectors) {
|
|
3529
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3530
|
+
this[i2] -= vector[i2];
|
|
3531
|
+
}
|
|
3532
|
+
}
|
|
3533
|
+
return this.check();
|
|
3534
|
+
}
|
|
3535
|
+
scale(scale2) {
|
|
3536
|
+
if (typeof scale2 === "number") {
|
|
3537
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3538
|
+
this[i2] *= scale2;
|
|
3539
|
+
}
|
|
3540
|
+
} else {
|
|
3541
|
+
for (let i2 = 0; i2 < this.ELEMENTS && i2 < scale2.length; ++i2) {
|
|
3542
|
+
this[i2] *= scale2[i2];
|
|
3543
|
+
}
|
|
3544
|
+
}
|
|
3545
|
+
return this.check();
|
|
3546
|
+
}
|
|
3547
|
+
multiplyByScalar(scalar) {
|
|
3548
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3549
|
+
this[i2] *= scalar;
|
|
3550
|
+
}
|
|
3551
|
+
return this.check();
|
|
3552
|
+
}
|
|
3553
|
+
check() {
|
|
3554
|
+
if (config.debug && !this.validate()) {
|
|
3555
|
+
throw new Error("math.gl: ".concat(this.constructor.name, " some fields set to invalid numbers'"));
|
|
3556
|
+
}
|
|
3557
|
+
return this;
|
|
3558
|
+
}
|
|
3559
|
+
validate() {
|
|
3560
|
+
let valid = this.length === this.ELEMENTS;
|
|
3561
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3562
|
+
valid = valid && Number.isFinite(this[i2]);
|
|
3563
|
+
}
|
|
3564
|
+
return valid;
|
|
3565
|
+
}
|
|
3566
|
+
sub(a2) {
|
|
3567
|
+
return this.subtract(a2);
|
|
3568
|
+
}
|
|
3569
|
+
setScalar(a2) {
|
|
3570
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3571
|
+
this[i2] = a2;
|
|
3572
|
+
}
|
|
3573
|
+
return this.check();
|
|
3574
|
+
}
|
|
3575
|
+
addScalar(a2) {
|
|
3576
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3577
|
+
this[i2] += a2;
|
|
3578
|
+
}
|
|
3579
|
+
return this.check();
|
|
3580
|
+
}
|
|
3581
|
+
subScalar(a2) {
|
|
3582
|
+
return this.addScalar(-a2);
|
|
3583
|
+
}
|
|
3584
|
+
multiplyScalar(scalar) {
|
|
3585
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3586
|
+
this[i2] *= scalar;
|
|
3587
|
+
}
|
|
3588
|
+
return this.check();
|
|
3589
|
+
}
|
|
3590
|
+
divideScalar(a2) {
|
|
3591
|
+
return this.multiplyByScalar(1 / a2);
|
|
3592
|
+
}
|
|
3593
|
+
clampScalar(min, max) {
|
|
3594
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3595
|
+
this[i2] = Math.min(Math.max(this[i2], min), max);
|
|
3596
|
+
}
|
|
3597
|
+
return this.check();
|
|
3598
|
+
}
|
|
3599
|
+
get elements() {
|
|
3600
|
+
return this;
|
|
3601
|
+
}
|
|
3602
|
+
};
|
|
3603
|
+
}
|
|
3604
|
+
});
|
|
3605
|
+
|
|
3606
|
+
// ../../node_modules/@math.gl/core/dist/esm/lib/validators.js
|
|
3607
|
+
function validateVector(v, length) {
|
|
3608
|
+
if (v.length !== length) {
|
|
3609
|
+
return false;
|
|
3610
|
+
}
|
|
3611
|
+
for (let i2 = 0; i2 < v.length; ++i2) {
|
|
3612
|
+
if (!Number.isFinite(v[i2])) {
|
|
3613
|
+
return false;
|
|
3614
|
+
}
|
|
3615
|
+
}
|
|
3616
|
+
return true;
|
|
3617
|
+
}
|
|
3618
|
+
function checkNumber(value) {
|
|
3619
|
+
if (!Number.isFinite(value)) {
|
|
3620
|
+
throw new Error("Invalid number ".concat(value));
|
|
3621
|
+
}
|
|
3622
|
+
return value;
|
|
3623
|
+
}
|
|
3624
|
+
function checkVector(v, length, callerName = "") {
|
|
3625
|
+
if (config.debug && !validateVector(v, length)) {
|
|
3626
|
+
throw new Error("math.gl: ".concat(callerName, " some fields set to invalid numbers'"));
|
|
3627
|
+
}
|
|
3628
|
+
return v;
|
|
3629
|
+
}
|
|
3630
|
+
var init_validators = __esm({
|
|
3631
|
+
"../../node_modules/@math.gl/core/dist/esm/lib/validators.js"() {
|
|
3632
|
+
init_common();
|
|
3633
|
+
}
|
|
3634
|
+
});
|
|
3635
|
+
|
|
3636
|
+
// ../../node_modules/@math.gl/core/dist/esm/classes/base/vector.js
|
|
3637
|
+
var Vector;
|
|
3638
|
+
var init_vector = __esm({
|
|
3639
|
+
"../../node_modules/@math.gl/core/dist/esm/classes/base/vector.js"() {
|
|
3640
|
+
init_math_array();
|
|
3641
|
+
init_validators();
|
|
3642
|
+
init_assert5();
|
|
3643
|
+
Vector = class extends MathArray {
|
|
3644
|
+
get x() {
|
|
3645
|
+
return this[0];
|
|
3646
|
+
}
|
|
3647
|
+
set x(value) {
|
|
3648
|
+
this[0] = checkNumber(value);
|
|
3649
|
+
}
|
|
3650
|
+
get y() {
|
|
3651
|
+
return this[1];
|
|
3652
|
+
}
|
|
3653
|
+
set y(value) {
|
|
3654
|
+
this[1] = checkNumber(value);
|
|
3655
|
+
}
|
|
3656
|
+
len() {
|
|
3657
|
+
return Math.sqrt(this.lengthSquared());
|
|
3658
|
+
}
|
|
3659
|
+
magnitude() {
|
|
3660
|
+
return this.len();
|
|
3661
|
+
}
|
|
3662
|
+
lengthSquared() {
|
|
3663
|
+
let length = 0;
|
|
3664
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3665
|
+
length += this[i2] * this[i2];
|
|
3666
|
+
}
|
|
3667
|
+
return length;
|
|
3668
|
+
}
|
|
3669
|
+
magnitudeSquared() {
|
|
3670
|
+
return this.lengthSquared();
|
|
3671
|
+
}
|
|
3672
|
+
distance(mathArray) {
|
|
3673
|
+
return Math.sqrt(this.distanceSquared(mathArray));
|
|
3674
|
+
}
|
|
3675
|
+
distanceSquared(mathArray) {
|
|
3676
|
+
let length = 0;
|
|
3677
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3678
|
+
const dist = this[i2] - mathArray[i2];
|
|
3679
|
+
length += dist * dist;
|
|
3680
|
+
}
|
|
3681
|
+
return checkNumber(length);
|
|
3682
|
+
}
|
|
3683
|
+
dot(mathArray) {
|
|
3684
|
+
let product = 0;
|
|
3685
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3686
|
+
product += this[i2] * mathArray[i2];
|
|
3687
|
+
}
|
|
3688
|
+
return checkNumber(product);
|
|
3689
|
+
}
|
|
3690
|
+
normalize() {
|
|
3691
|
+
const length = this.magnitude();
|
|
3692
|
+
if (length !== 0) {
|
|
3693
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3694
|
+
this[i2] /= length;
|
|
3695
|
+
}
|
|
3696
|
+
}
|
|
3697
|
+
return this.check();
|
|
3698
|
+
}
|
|
3699
|
+
multiply(...vectors) {
|
|
3700
|
+
for (const vector of vectors) {
|
|
3701
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3702
|
+
this[i2] *= vector[i2];
|
|
3703
|
+
}
|
|
3704
|
+
}
|
|
3705
|
+
return this.check();
|
|
3706
|
+
}
|
|
3707
|
+
divide(...vectors) {
|
|
3708
|
+
for (const vector of vectors) {
|
|
3709
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3710
|
+
this[i2] /= vector[i2];
|
|
3711
|
+
}
|
|
3712
|
+
}
|
|
3713
|
+
return this.check();
|
|
3714
|
+
}
|
|
3715
|
+
lengthSq() {
|
|
3716
|
+
return this.lengthSquared();
|
|
3717
|
+
}
|
|
3718
|
+
distanceTo(vector) {
|
|
3719
|
+
return this.distance(vector);
|
|
3720
|
+
}
|
|
3721
|
+
distanceToSquared(vector) {
|
|
3722
|
+
return this.distanceSquared(vector);
|
|
3723
|
+
}
|
|
3724
|
+
getComponent(i2) {
|
|
3725
|
+
assert5(i2 >= 0 && i2 < this.ELEMENTS, "index is out of range");
|
|
3726
|
+
return checkNumber(this[i2]);
|
|
3727
|
+
}
|
|
3728
|
+
setComponent(i2, value) {
|
|
3729
|
+
assert5(i2 >= 0 && i2 < this.ELEMENTS, "index is out of range");
|
|
3730
|
+
this[i2] = value;
|
|
3731
|
+
return this.check();
|
|
3732
|
+
}
|
|
3733
|
+
addVectors(a2, b) {
|
|
3734
|
+
return this.copy(a2).add(b);
|
|
3735
|
+
}
|
|
3736
|
+
subVectors(a2, b) {
|
|
3737
|
+
return this.copy(a2).subtract(b);
|
|
3738
|
+
}
|
|
3739
|
+
multiplyVectors(a2, b) {
|
|
3740
|
+
return this.copy(a2).multiply(b);
|
|
3741
|
+
}
|
|
3742
|
+
addScaledVector(a2, b) {
|
|
3743
|
+
return this.add(new this.constructor(a2).multiplyScalar(b));
|
|
3744
|
+
}
|
|
3745
|
+
};
|
|
3746
|
+
}
|
|
3747
|
+
});
|
|
3748
|
+
|
|
3749
|
+
// ../../node_modules/gl-matrix/esm/common.js
|
|
3750
|
+
var ARRAY_TYPE, degree;
|
|
3751
|
+
var init_common2 = __esm({
|
|
3752
|
+
"../../node_modules/gl-matrix/esm/common.js"() {
|
|
3753
|
+
ARRAY_TYPE = typeof Float32Array !== "undefined" ? Float32Array : Array;
|
|
3754
|
+
degree = Math.PI / 180;
|
|
3755
|
+
if (!Math.hypot)
|
|
3756
|
+
Math.hypot = function() {
|
|
3757
|
+
var y = 0, i2 = arguments.length;
|
|
3758
|
+
while (i2--) {
|
|
3759
|
+
y += arguments[i2] * arguments[i2];
|
|
3760
|
+
}
|
|
3761
|
+
return Math.sqrt(y);
|
|
3762
|
+
};
|
|
3763
|
+
}
|
|
3764
|
+
});
|
|
3765
|
+
|
|
3766
|
+
// ../../node_modules/gl-matrix/esm/vec2.js
|
|
3767
|
+
function create() {
|
|
3768
|
+
var out = new ARRAY_TYPE(2);
|
|
3769
|
+
if (ARRAY_TYPE != Float32Array) {
|
|
3770
|
+
out[0] = 0;
|
|
3771
|
+
out[1] = 0;
|
|
3772
|
+
}
|
|
3773
|
+
return out;
|
|
3774
|
+
}
|
|
3775
|
+
function transformMat3(out, a2, m) {
|
|
3776
|
+
var x = a2[0], y = a2[1];
|
|
3777
|
+
out[0] = m[0] * x + m[3] * y + m[6];
|
|
3778
|
+
out[1] = m[1] * x + m[4] * y + m[7];
|
|
3779
|
+
return out;
|
|
3780
|
+
}
|
|
3781
|
+
var forEach;
|
|
3782
|
+
var init_vec2 = __esm({
|
|
3783
|
+
"../../node_modules/gl-matrix/esm/vec2.js"() {
|
|
3784
|
+
init_common2();
|
|
3785
|
+
forEach = function() {
|
|
3786
|
+
var vec = create();
|
|
3787
|
+
return function(a2, stride, offset, count, fn, arg) {
|
|
3788
|
+
var i2, l2;
|
|
3789
|
+
if (!stride) {
|
|
3790
|
+
stride = 2;
|
|
3791
|
+
}
|
|
3792
|
+
if (!offset) {
|
|
3793
|
+
offset = 0;
|
|
3794
|
+
}
|
|
3795
|
+
if (count) {
|
|
3796
|
+
l2 = Math.min(count * stride + offset, a2.length);
|
|
3797
|
+
} else {
|
|
3798
|
+
l2 = a2.length;
|
|
3799
|
+
}
|
|
3800
|
+
for (i2 = offset; i2 < l2; i2 += stride) {
|
|
3801
|
+
vec[0] = a2[i2];
|
|
3802
|
+
vec[1] = a2[i2 + 1];
|
|
3803
|
+
fn(vec, vec, arg);
|
|
3804
|
+
a2[i2] = vec[0];
|
|
3805
|
+
a2[i2 + 1] = vec[1];
|
|
3806
|
+
}
|
|
3807
|
+
return a2;
|
|
3808
|
+
};
|
|
3809
|
+
}();
|
|
3810
|
+
}
|
|
3811
|
+
});
|
|
3812
|
+
|
|
3813
|
+
// ../../node_modules/@math.gl/core/dist/esm/lib/gl-matrix-extras.js
|
|
3814
|
+
function vec3_transformMat4AsVector(out, a2, m) {
|
|
3815
|
+
const x = a2[0];
|
|
3816
|
+
const y = a2[1];
|
|
3817
|
+
const z = a2[2];
|
|
3818
|
+
const w = m[3] * x + m[7] * y + m[11] * z || 1;
|
|
3819
|
+
out[0] = (m[0] * x + m[4] * y + m[8] * z) / w;
|
|
3820
|
+
out[1] = (m[1] * x + m[5] * y + m[9] * z) / w;
|
|
3821
|
+
out[2] = (m[2] * x + m[6] * y + m[10] * z) / w;
|
|
3822
|
+
return out;
|
|
3823
|
+
}
|
|
3824
|
+
function vec3_transformMat2(out, a2, m) {
|
|
3825
|
+
const x = a2[0];
|
|
3826
|
+
const y = a2[1];
|
|
3827
|
+
out[0] = m[0] * x + m[2] * y;
|
|
3828
|
+
out[1] = m[1] * x + m[3] * y;
|
|
3829
|
+
out[2] = a2[2];
|
|
3830
|
+
return out;
|
|
3831
|
+
}
|
|
3832
|
+
function vec4_transformMat3(out, a2, m) {
|
|
3833
|
+
const x = a2[0];
|
|
3834
|
+
const y = a2[1];
|
|
3835
|
+
const z = a2[2];
|
|
3836
|
+
out[0] = m[0] * x + m[3] * y + m[6] * z;
|
|
3837
|
+
out[1] = m[1] * x + m[4] * y + m[7] * z;
|
|
3838
|
+
out[2] = m[2] * x + m[5] * y + m[8] * z;
|
|
3839
|
+
out[3] = a2[3];
|
|
3840
|
+
return out;
|
|
3841
|
+
}
|
|
3842
|
+
var init_gl_matrix_extras = __esm({
|
|
3843
|
+
"../../node_modules/@math.gl/core/dist/esm/lib/gl-matrix-extras.js"() {
|
|
3844
|
+
}
|
|
3845
|
+
});
|
|
3846
|
+
|
|
3847
|
+
// ../../node_modules/gl-matrix/esm/vec3.js
|
|
3848
|
+
function create2() {
|
|
3849
|
+
var out = new ARRAY_TYPE(3);
|
|
3850
|
+
if (ARRAY_TYPE != Float32Array) {
|
|
3851
|
+
out[0] = 0;
|
|
3852
|
+
out[1] = 0;
|
|
3853
|
+
out[2] = 0;
|
|
3854
|
+
}
|
|
3855
|
+
return out;
|
|
3856
|
+
}
|
|
3857
|
+
function dot(a2, b) {
|
|
3858
|
+
return a2[0] * b[0] + a2[1] * b[1] + a2[2] * b[2];
|
|
3859
|
+
}
|
|
3860
|
+
function cross(out, a2, b) {
|
|
3861
|
+
var ax = a2[0], ay = a2[1], az = a2[2];
|
|
3862
|
+
var bx = b[0], by = b[1], bz = b[2];
|
|
3863
|
+
out[0] = ay * bz - az * by;
|
|
3864
|
+
out[1] = az * bx - ax * bz;
|
|
3865
|
+
out[2] = ax * by - ay * bx;
|
|
3866
|
+
return out;
|
|
3867
|
+
}
|
|
3868
|
+
function transformMat4(out, a2, m) {
|
|
3869
|
+
var x = a2[0], y = a2[1], z = a2[2];
|
|
3870
|
+
var w = m[3] * x + m[7] * y + m[11] * z + m[15];
|
|
3871
|
+
w = w || 1;
|
|
3872
|
+
out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;
|
|
3873
|
+
out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;
|
|
3874
|
+
out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;
|
|
3875
|
+
return out;
|
|
3876
|
+
}
|
|
3877
|
+
function transformMat32(out, a2, m) {
|
|
3878
|
+
var x = a2[0], y = a2[1], z = a2[2];
|
|
3879
|
+
out[0] = x * m[0] + y * m[3] + z * m[6];
|
|
3880
|
+
out[1] = x * m[1] + y * m[4] + z * m[7];
|
|
3881
|
+
out[2] = x * m[2] + y * m[5] + z * m[8];
|
|
3882
|
+
return out;
|
|
3883
|
+
}
|
|
3884
|
+
function transformQuat(out, a2, q) {
|
|
3885
|
+
var qx = q[0], qy = q[1], qz = q[2], qw = q[3];
|
|
3886
|
+
var x = a2[0], y = a2[1], z = a2[2];
|
|
3887
|
+
var uvx = qy * z - qz * y, uvy = qz * x - qx * z, uvz = qx * y - qy * x;
|
|
3888
|
+
var uuvx = qy * uvz - qz * uvy, uuvy = qz * uvx - qx * uvz, uuvz = qx * uvy - qy * uvx;
|
|
3889
|
+
var w2 = qw * 2;
|
|
3890
|
+
uvx *= w2;
|
|
3891
|
+
uvy *= w2;
|
|
3892
|
+
uvz *= w2;
|
|
3893
|
+
uuvx *= 2;
|
|
3894
|
+
uuvy *= 2;
|
|
3895
|
+
uuvz *= 2;
|
|
3896
|
+
out[0] = x + uvx + uuvx;
|
|
3897
|
+
out[1] = y + uvy + uuvy;
|
|
3898
|
+
out[2] = z + uvz + uuvz;
|
|
3899
|
+
return out;
|
|
3900
|
+
}
|
|
3901
|
+
function rotateX(out, a2, b, rad) {
|
|
3902
|
+
var p2 = [], r2 = [];
|
|
3903
|
+
p2[0] = a2[0] - b[0];
|
|
3904
|
+
p2[1] = a2[1] - b[1];
|
|
3905
|
+
p2[2] = a2[2] - b[2];
|
|
3906
|
+
r2[0] = p2[0];
|
|
3907
|
+
r2[1] = p2[1] * Math.cos(rad) - p2[2] * Math.sin(rad);
|
|
3908
|
+
r2[2] = p2[1] * Math.sin(rad) + p2[2] * Math.cos(rad);
|
|
3909
|
+
out[0] = r2[0] + b[0];
|
|
3910
|
+
out[1] = r2[1] + b[1];
|
|
3911
|
+
out[2] = r2[2] + b[2];
|
|
3912
|
+
return out;
|
|
3913
|
+
}
|
|
3914
|
+
function rotateY(out, a2, b, rad) {
|
|
3915
|
+
var p2 = [], r2 = [];
|
|
3916
|
+
p2[0] = a2[0] - b[0];
|
|
3917
|
+
p2[1] = a2[1] - b[1];
|
|
3918
|
+
p2[2] = a2[2] - b[2];
|
|
3919
|
+
r2[0] = p2[2] * Math.sin(rad) + p2[0] * Math.cos(rad);
|
|
3920
|
+
r2[1] = p2[1];
|
|
3921
|
+
r2[2] = p2[2] * Math.cos(rad) - p2[0] * Math.sin(rad);
|
|
3922
|
+
out[0] = r2[0] + b[0];
|
|
3923
|
+
out[1] = r2[1] + b[1];
|
|
3924
|
+
out[2] = r2[2] + b[2];
|
|
3925
|
+
return out;
|
|
3926
|
+
}
|
|
3927
|
+
function rotateZ(out, a2, b, rad) {
|
|
3928
|
+
var p2 = [], r2 = [];
|
|
3929
|
+
p2[0] = a2[0] - b[0];
|
|
3930
|
+
p2[1] = a2[1] - b[1];
|
|
3931
|
+
p2[2] = a2[2] - b[2];
|
|
3932
|
+
r2[0] = p2[0] * Math.cos(rad) - p2[1] * Math.sin(rad);
|
|
3933
|
+
r2[1] = p2[0] * Math.sin(rad) + p2[1] * Math.cos(rad);
|
|
3934
|
+
r2[2] = p2[2];
|
|
3935
|
+
out[0] = r2[0] + b[0];
|
|
3936
|
+
out[1] = r2[1] + b[1];
|
|
3937
|
+
out[2] = r2[2] + b[2];
|
|
3938
|
+
return out;
|
|
3939
|
+
}
|
|
3940
|
+
function angle(a2, b) {
|
|
3941
|
+
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;
|
|
3942
|
+
return Math.acos(Math.min(Math.max(cosine, -1), 1));
|
|
3943
|
+
}
|
|
3944
|
+
var forEach2;
|
|
3945
|
+
var init_vec3 = __esm({
|
|
3946
|
+
"../../node_modules/gl-matrix/esm/vec3.js"() {
|
|
3947
|
+
init_common2();
|
|
3948
|
+
forEach2 = function() {
|
|
3949
|
+
var vec = create2();
|
|
3950
|
+
return function(a2, stride, offset, count, fn, arg) {
|
|
3951
|
+
var i2, l2;
|
|
3952
|
+
if (!stride) {
|
|
3953
|
+
stride = 3;
|
|
3954
|
+
}
|
|
3955
|
+
if (!offset) {
|
|
3956
|
+
offset = 0;
|
|
3957
|
+
}
|
|
3958
|
+
if (count) {
|
|
3959
|
+
l2 = Math.min(count * stride + offset, a2.length);
|
|
3960
|
+
} else {
|
|
3961
|
+
l2 = a2.length;
|
|
3962
|
+
}
|
|
3963
|
+
for (i2 = offset; i2 < l2; i2 += stride) {
|
|
3964
|
+
vec[0] = a2[i2];
|
|
3965
|
+
vec[1] = a2[i2 + 1];
|
|
3966
|
+
vec[2] = a2[i2 + 2];
|
|
3967
|
+
fn(vec, vec, arg);
|
|
3968
|
+
a2[i2] = vec[0];
|
|
3969
|
+
a2[i2 + 1] = vec[1];
|
|
3970
|
+
a2[i2 + 2] = vec[2];
|
|
3971
|
+
}
|
|
3972
|
+
return a2;
|
|
3973
|
+
};
|
|
3974
|
+
}();
|
|
3975
|
+
}
|
|
3976
|
+
});
|
|
3977
|
+
|
|
3978
|
+
// ../../node_modules/@math.gl/core/dist/esm/classes/vector3.js
|
|
3979
|
+
var ORIGIN, ZERO, Vector3;
|
|
3980
|
+
var init_vector3 = __esm({
|
|
3981
|
+
"../../node_modules/@math.gl/core/dist/esm/classes/vector3.js"() {
|
|
3982
|
+
init_vector();
|
|
3983
|
+
init_common();
|
|
3984
|
+
init_validators();
|
|
3985
|
+
init_vec3();
|
|
3986
|
+
init_gl_matrix_extras();
|
|
3987
|
+
ORIGIN = [0, 0, 0];
|
|
3988
|
+
Vector3 = class extends Vector {
|
|
3989
|
+
static get ZERO() {
|
|
3990
|
+
if (!ZERO) {
|
|
3991
|
+
ZERO = new Vector3(0, 0, 0);
|
|
3992
|
+
Object.freeze(ZERO);
|
|
3993
|
+
}
|
|
3994
|
+
return ZERO;
|
|
3995
|
+
}
|
|
3996
|
+
constructor(x = 0, y = 0, z = 0) {
|
|
3997
|
+
super(-0, -0, -0);
|
|
3998
|
+
if (arguments.length === 1 && isArray(x)) {
|
|
3999
|
+
this.copy(x);
|
|
4000
|
+
} else {
|
|
4001
|
+
if (config.debug) {
|
|
4002
|
+
checkNumber(x);
|
|
4003
|
+
checkNumber(y);
|
|
4004
|
+
checkNumber(z);
|
|
4005
|
+
}
|
|
4006
|
+
this[0] = x;
|
|
4007
|
+
this[1] = y;
|
|
4008
|
+
this[2] = z;
|
|
4009
|
+
}
|
|
4010
|
+
}
|
|
4011
|
+
set(x, y, z) {
|
|
4012
|
+
this[0] = x;
|
|
4013
|
+
this[1] = y;
|
|
4014
|
+
this[2] = z;
|
|
4015
|
+
return this.check();
|
|
4016
|
+
}
|
|
4017
|
+
copy(array) {
|
|
4018
|
+
this[0] = array[0];
|
|
4019
|
+
this[1] = array[1];
|
|
4020
|
+
this[2] = array[2];
|
|
4021
|
+
return this.check();
|
|
4022
|
+
}
|
|
4023
|
+
fromObject(object) {
|
|
4024
|
+
if (config.debug) {
|
|
4025
|
+
checkNumber(object.x);
|
|
4026
|
+
checkNumber(object.y);
|
|
4027
|
+
checkNumber(object.z);
|
|
4028
|
+
}
|
|
4029
|
+
this[0] = object.x;
|
|
4030
|
+
this[1] = object.y;
|
|
4031
|
+
this[2] = object.z;
|
|
4032
|
+
return this.check();
|
|
4033
|
+
}
|
|
4034
|
+
toObject(object) {
|
|
4035
|
+
object.x = this[0];
|
|
4036
|
+
object.y = this[1];
|
|
4037
|
+
object.z = this[2];
|
|
4038
|
+
return object;
|
|
4039
|
+
}
|
|
4040
|
+
get ELEMENTS() {
|
|
4041
|
+
return 3;
|
|
4042
|
+
}
|
|
4043
|
+
get z() {
|
|
4044
|
+
return this[2];
|
|
4045
|
+
}
|
|
4046
|
+
set z(value) {
|
|
4047
|
+
this[2] = checkNumber(value);
|
|
4048
|
+
}
|
|
4049
|
+
angle(vector) {
|
|
4050
|
+
return angle(this, vector);
|
|
4051
|
+
}
|
|
4052
|
+
cross(vector) {
|
|
4053
|
+
cross(this, this, vector);
|
|
4054
|
+
return this.check();
|
|
4055
|
+
}
|
|
4056
|
+
rotateX({
|
|
4057
|
+
radians,
|
|
4058
|
+
origin = ORIGIN
|
|
4059
|
+
}) {
|
|
4060
|
+
rotateX(this, this, origin, radians);
|
|
4061
|
+
return this.check();
|
|
4062
|
+
}
|
|
4063
|
+
rotateY({
|
|
4064
|
+
radians,
|
|
4065
|
+
origin = ORIGIN
|
|
4066
|
+
}) {
|
|
4067
|
+
rotateY(this, this, origin, radians);
|
|
4068
|
+
return this.check();
|
|
4069
|
+
}
|
|
4070
|
+
rotateZ({
|
|
4071
|
+
radians,
|
|
4072
|
+
origin = ORIGIN
|
|
4073
|
+
}) {
|
|
4074
|
+
rotateZ(this, this, origin, radians);
|
|
4075
|
+
return this.check();
|
|
4076
|
+
}
|
|
4077
|
+
transform(matrix4) {
|
|
4078
|
+
return this.transformAsPoint(matrix4);
|
|
4079
|
+
}
|
|
4080
|
+
transformAsPoint(matrix4) {
|
|
4081
|
+
transformMat4(this, this, matrix4);
|
|
4082
|
+
return this.check();
|
|
4083
|
+
}
|
|
4084
|
+
transformAsVector(matrix4) {
|
|
4085
|
+
vec3_transformMat4AsVector(this, this, matrix4);
|
|
4086
|
+
return this.check();
|
|
4087
|
+
}
|
|
4088
|
+
transformByMatrix3(matrix3) {
|
|
4089
|
+
transformMat32(this, this, matrix3);
|
|
4090
|
+
return this.check();
|
|
4091
|
+
}
|
|
4092
|
+
transformByMatrix2(matrix2) {
|
|
4093
|
+
vec3_transformMat2(this, this, matrix2);
|
|
4094
|
+
return this.check();
|
|
4095
|
+
}
|
|
4096
|
+
transformByQuaternion(quaternion) {
|
|
4097
|
+
transformQuat(this, this, quaternion);
|
|
4098
|
+
return this.check();
|
|
4099
|
+
}
|
|
4100
|
+
};
|
|
4101
|
+
}
|
|
4102
|
+
});
|
|
4103
|
+
|
|
4104
|
+
// ../../node_modules/@math.gl/core/dist/esm/classes/base/matrix.js
|
|
4105
|
+
var Matrix;
|
|
4106
|
+
var init_matrix = __esm({
|
|
4107
|
+
"../../node_modules/@math.gl/core/dist/esm/classes/base/matrix.js"() {
|
|
4108
|
+
init_math_array();
|
|
4109
|
+
init_validators();
|
|
4110
|
+
init_common();
|
|
4111
|
+
Matrix = class extends MathArray {
|
|
4112
|
+
toString() {
|
|
4113
|
+
let string = "[";
|
|
4114
|
+
if (config.printRowMajor) {
|
|
4115
|
+
string += "row-major:";
|
|
4116
|
+
for (let row = 0; row < this.RANK; ++row) {
|
|
4117
|
+
for (let col = 0; col < this.RANK; ++col) {
|
|
4118
|
+
string += " ".concat(this[col * this.RANK + row]);
|
|
4119
|
+
}
|
|
4120
|
+
}
|
|
4121
|
+
} else {
|
|
4122
|
+
string += "column-major:";
|
|
4123
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
4124
|
+
string += " ".concat(this[i2]);
|
|
4125
|
+
}
|
|
4126
|
+
}
|
|
4127
|
+
string += "]";
|
|
4128
|
+
return string;
|
|
4129
|
+
}
|
|
4130
|
+
getElementIndex(row, col) {
|
|
4131
|
+
return col * this.RANK + row;
|
|
4132
|
+
}
|
|
4133
|
+
getElement(row, col) {
|
|
4134
|
+
return this[col * this.RANK + row];
|
|
4135
|
+
}
|
|
4136
|
+
setElement(row, col, value) {
|
|
4137
|
+
this[col * this.RANK + row] = checkNumber(value);
|
|
4138
|
+
return this;
|
|
4139
|
+
}
|
|
4140
|
+
getColumn(columnIndex, result = new Array(this.RANK).fill(-0)) {
|
|
4141
|
+
const firstIndex = columnIndex * this.RANK;
|
|
4142
|
+
for (let i2 = 0; i2 < this.RANK; ++i2) {
|
|
4143
|
+
result[i2] = this[firstIndex + i2];
|
|
4144
|
+
}
|
|
4145
|
+
return result;
|
|
4146
|
+
}
|
|
4147
|
+
setColumn(columnIndex, columnVector) {
|
|
4148
|
+
const firstIndex = columnIndex * this.RANK;
|
|
4149
|
+
for (let i2 = 0; i2 < this.RANK; ++i2) {
|
|
4150
|
+
this[firstIndex + i2] = columnVector[i2];
|
|
4151
|
+
}
|
|
4152
|
+
return this;
|
|
4153
|
+
}
|
|
4154
|
+
};
|
|
4155
|
+
}
|
|
4156
|
+
});
|
|
4157
|
+
|
|
4158
|
+
// ../../node_modules/gl-matrix/esm/mat3.js
|
|
4159
|
+
function transpose(out, a2) {
|
|
4160
|
+
if (out === a2) {
|
|
4161
|
+
var a01 = a2[1], a02 = a2[2], a12 = a2[5];
|
|
4162
|
+
out[1] = a2[3];
|
|
4163
|
+
out[2] = a2[6];
|
|
4164
|
+
out[3] = a01;
|
|
4165
|
+
out[5] = a2[7];
|
|
4166
|
+
out[6] = a02;
|
|
4167
|
+
out[7] = a12;
|
|
4168
|
+
} else {
|
|
4169
|
+
out[0] = a2[0];
|
|
4170
|
+
out[1] = a2[3];
|
|
4171
|
+
out[2] = a2[6];
|
|
4172
|
+
out[3] = a2[1];
|
|
4173
|
+
out[4] = a2[4];
|
|
4174
|
+
out[5] = a2[7];
|
|
4175
|
+
out[6] = a2[2];
|
|
4176
|
+
out[7] = a2[5];
|
|
4177
|
+
out[8] = a2[8];
|
|
4178
|
+
}
|
|
4179
|
+
return out;
|
|
4180
|
+
}
|
|
4181
|
+
function invert(out, a2) {
|
|
4182
|
+
var a00 = a2[0], a01 = a2[1], a02 = a2[2];
|
|
4183
|
+
var a10 = a2[3], a11 = a2[4], a12 = a2[5];
|
|
4184
|
+
var a20 = a2[6], a21 = a2[7], a22 = a2[8];
|
|
4185
|
+
var b01 = a22 * a11 - a12 * a21;
|
|
4186
|
+
var b11 = -a22 * a10 + a12 * a20;
|
|
4187
|
+
var b21 = a21 * a10 - a11 * a20;
|
|
4188
|
+
var det = a00 * b01 + a01 * b11 + a02 * b21;
|
|
4189
|
+
if (!det) {
|
|
4190
|
+
return null;
|
|
4191
|
+
}
|
|
4192
|
+
det = 1 / det;
|
|
4193
|
+
out[0] = b01 * det;
|
|
4194
|
+
out[1] = (-a22 * a01 + a02 * a21) * det;
|
|
4195
|
+
out[2] = (a12 * a01 - a02 * a11) * det;
|
|
4196
|
+
out[3] = b11 * det;
|
|
4197
|
+
out[4] = (a22 * a00 - a02 * a20) * det;
|
|
4198
|
+
out[5] = (-a12 * a00 + a02 * a10) * det;
|
|
4199
|
+
out[6] = b21 * det;
|
|
4200
|
+
out[7] = (-a21 * a00 + a01 * a20) * det;
|
|
4201
|
+
out[8] = (a11 * a00 - a01 * a10) * det;
|
|
4202
|
+
return out;
|
|
4203
|
+
}
|
|
4204
|
+
function determinant(a2) {
|
|
4205
|
+
var a00 = a2[0], a01 = a2[1], a02 = a2[2];
|
|
4206
|
+
var a10 = a2[3], a11 = a2[4], a12 = a2[5];
|
|
4207
|
+
var a20 = a2[6], a21 = a2[7], a22 = a2[8];
|
|
4208
|
+
return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20);
|
|
4209
|
+
}
|
|
4210
|
+
function multiply(out, a2, b) {
|
|
4211
|
+
var a00 = a2[0], a01 = a2[1], a02 = a2[2];
|
|
4212
|
+
var a10 = a2[3], a11 = a2[4], a12 = a2[5];
|
|
4213
|
+
var a20 = a2[6], a21 = a2[7], a22 = a2[8];
|
|
4214
|
+
var b00 = b[0], b01 = b[1], b02 = b[2];
|
|
4215
|
+
var b10 = b[3], b11 = b[4], b12 = b[5];
|
|
4216
|
+
var b20 = b[6], b21 = b[7], b22 = b[8];
|
|
4217
|
+
out[0] = b00 * a00 + b01 * a10 + b02 * a20;
|
|
4218
|
+
out[1] = b00 * a01 + b01 * a11 + b02 * a21;
|
|
4219
|
+
out[2] = b00 * a02 + b01 * a12 + b02 * a22;
|
|
4220
|
+
out[3] = b10 * a00 + b11 * a10 + b12 * a20;
|
|
4221
|
+
out[4] = b10 * a01 + b11 * a11 + b12 * a21;
|
|
4222
|
+
out[5] = b10 * a02 + b11 * a12 + b12 * a22;
|
|
4223
|
+
out[6] = b20 * a00 + b21 * a10 + b22 * a20;
|
|
4224
|
+
out[7] = b20 * a01 + b21 * a11 + b22 * a21;
|
|
4225
|
+
out[8] = b20 * a02 + b21 * a12 + b22 * a22;
|
|
4226
|
+
return out;
|
|
4227
|
+
}
|
|
4228
|
+
function translate(out, a2, v) {
|
|
4229
|
+
var a00 = a2[0], a01 = a2[1], a02 = a2[2], a10 = a2[3], a11 = a2[4], a12 = a2[5], a20 = a2[6], a21 = a2[7], a22 = a2[8], x = v[0], y = v[1];
|
|
4230
|
+
out[0] = a00;
|
|
4231
|
+
out[1] = a01;
|
|
4232
|
+
out[2] = a02;
|
|
4233
|
+
out[3] = a10;
|
|
4234
|
+
out[4] = a11;
|
|
4235
|
+
out[5] = a12;
|
|
4236
|
+
out[6] = x * a00 + y * a10 + a20;
|
|
4237
|
+
out[7] = x * a01 + y * a11 + a21;
|
|
4238
|
+
out[8] = x * a02 + y * a12 + a22;
|
|
4239
|
+
return out;
|
|
4240
|
+
}
|
|
4241
|
+
function rotate(out, a2, rad) {
|
|
4242
|
+
var a00 = a2[0], a01 = a2[1], a02 = a2[2], a10 = a2[3], a11 = a2[4], a12 = a2[5], a20 = a2[6], a21 = a2[7], a22 = a2[8], s2 = Math.sin(rad), c = Math.cos(rad);
|
|
4243
|
+
out[0] = c * a00 + s2 * a10;
|
|
4244
|
+
out[1] = c * a01 + s2 * a11;
|
|
4245
|
+
out[2] = c * a02 + s2 * a12;
|
|
4246
|
+
out[3] = c * a10 - s2 * a00;
|
|
4247
|
+
out[4] = c * a11 - s2 * a01;
|
|
4248
|
+
out[5] = c * a12 - s2 * a02;
|
|
4249
|
+
out[6] = a20;
|
|
4250
|
+
out[7] = a21;
|
|
4251
|
+
out[8] = a22;
|
|
4252
|
+
return out;
|
|
4253
|
+
}
|
|
4254
|
+
function scale(out, a2, v) {
|
|
4255
|
+
var x = v[0], y = v[1];
|
|
4256
|
+
out[0] = x * a2[0];
|
|
4257
|
+
out[1] = x * a2[1];
|
|
4258
|
+
out[2] = x * a2[2];
|
|
4259
|
+
out[3] = y * a2[3];
|
|
4260
|
+
out[4] = y * a2[4];
|
|
4261
|
+
out[5] = y * a2[5];
|
|
4262
|
+
out[6] = a2[6];
|
|
4263
|
+
out[7] = a2[7];
|
|
4264
|
+
out[8] = a2[8];
|
|
4265
|
+
return out;
|
|
4266
|
+
}
|
|
4267
|
+
function fromQuat(out, q) {
|
|
4268
|
+
var x = q[0], y = q[1], z = q[2], w = q[3];
|
|
4269
|
+
var x2 = x + x;
|
|
4270
|
+
var y2 = y + y;
|
|
4271
|
+
var z2 = z + z;
|
|
4272
|
+
var xx = x * x2;
|
|
4273
|
+
var yx = y * x2;
|
|
4274
|
+
var yy = y * y2;
|
|
4275
|
+
var zx = z * x2;
|
|
4276
|
+
var zy = z * y2;
|
|
4277
|
+
var zz = z * z2;
|
|
4278
|
+
var wx = w * x2;
|
|
4279
|
+
var wy = w * y2;
|
|
4280
|
+
var wz = w * z2;
|
|
4281
|
+
out[0] = 1 - yy - zz;
|
|
4282
|
+
out[3] = yx - wz;
|
|
4283
|
+
out[6] = zx + wy;
|
|
4284
|
+
out[1] = yx + wz;
|
|
4285
|
+
out[4] = 1 - xx - zz;
|
|
4286
|
+
out[7] = zy - wx;
|
|
4287
|
+
out[2] = zx - wy;
|
|
4288
|
+
out[5] = zy + wx;
|
|
4289
|
+
out[8] = 1 - xx - yy;
|
|
4290
|
+
return out;
|
|
4291
|
+
}
|
|
4292
|
+
var init_mat3 = __esm({
|
|
4293
|
+
"../../node_modules/gl-matrix/esm/mat3.js"() {
|
|
4294
|
+
}
|
|
4295
|
+
});
|
|
4296
|
+
|
|
4297
|
+
// ../../node_modules/@math.gl/core/dist/esm/classes/matrix3.js
|
|
4298
|
+
function getZeroMatrix() {
|
|
4299
|
+
if (!ZERO_MATRIX3) {
|
|
4300
|
+
ZERO_MATRIX3 = new Matrix3([0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
|
4301
|
+
Object.freeze(ZERO_MATRIX3);
|
|
4302
|
+
}
|
|
4303
|
+
return ZERO_MATRIX3;
|
|
4304
|
+
}
|
|
4305
|
+
function getIdentityMatrix() {
|
|
4306
|
+
if (!IDENTITY_MATRIX3) {
|
|
4307
|
+
IDENTITY_MATRIX3 = new Matrix3();
|
|
4308
|
+
Object.freeze(IDENTITY_MATRIX3);
|
|
4309
|
+
}
|
|
4310
|
+
return IDENTITY_MATRIX3;
|
|
4311
|
+
}
|
|
4312
|
+
var INDICES, IDENTITY_MATRIX, Matrix3, ZERO_MATRIX3, IDENTITY_MATRIX3;
|
|
4313
|
+
var init_matrix3 = __esm({
|
|
4314
|
+
"../../node_modules/@math.gl/core/dist/esm/classes/matrix3.js"() {
|
|
4315
|
+
init_matrix();
|
|
4316
|
+
init_validators();
|
|
4317
|
+
init_gl_matrix_extras();
|
|
4318
|
+
init_mat3();
|
|
4319
|
+
init_vec2();
|
|
4320
|
+
init_vec3();
|
|
4321
|
+
(function(INDICES2) {
|
|
4322
|
+
INDICES2[INDICES2["COL0ROW0"] = 0] = "COL0ROW0";
|
|
4323
|
+
INDICES2[INDICES2["COL0ROW1"] = 1] = "COL0ROW1";
|
|
4324
|
+
INDICES2[INDICES2["COL0ROW2"] = 2] = "COL0ROW2";
|
|
4325
|
+
INDICES2[INDICES2["COL1ROW0"] = 3] = "COL1ROW0";
|
|
4326
|
+
INDICES2[INDICES2["COL1ROW1"] = 4] = "COL1ROW1";
|
|
4327
|
+
INDICES2[INDICES2["COL1ROW2"] = 5] = "COL1ROW2";
|
|
4328
|
+
INDICES2[INDICES2["COL2ROW0"] = 6] = "COL2ROW0";
|
|
4329
|
+
INDICES2[INDICES2["COL2ROW1"] = 7] = "COL2ROW1";
|
|
4330
|
+
INDICES2[INDICES2["COL2ROW2"] = 8] = "COL2ROW2";
|
|
4331
|
+
})(INDICES || (INDICES = {}));
|
|
4332
|
+
IDENTITY_MATRIX = Object.freeze([1, 0, 0, 0, 1, 0, 0, 0, 1]);
|
|
4333
|
+
Matrix3 = class extends Matrix {
|
|
4334
|
+
static get IDENTITY() {
|
|
4335
|
+
return getIdentityMatrix();
|
|
4336
|
+
}
|
|
4337
|
+
static get ZERO() {
|
|
4338
|
+
return getZeroMatrix();
|
|
4339
|
+
}
|
|
4340
|
+
get ELEMENTS() {
|
|
4341
|
+
return 9;
|
|
4342
|
+
}
|
|
4343
|
+
get RANK() {
|
|
4344
|
+
return 3;
|
|
4345
|
+
}
|
|
4346
|
+
get INDICES() {
|
|
4347
|
+
return INDICES;
|
|
4348
|
+
}
|
|
4349
|
+
constructor(array, ...args) {
|
|
4350
|
+
super(-0, -0, -0, -0, -0, -0, -0, -0, -0);
|
|
4351
|
+
if (arguments.length === 1 && Array.isArray(array)) {
|
|
4352
|
+
this.copy(array);
|
|
4353
|
+
} else if (args.length > 0) {
|
|
4354
|
+
this.copy([array, ...args]);
|
|
4355
|
+
} else {
|
|
4356
|
+
this.identity();
|
|
4357
|
+
}
|
|
4358
|
+
}
|
|
4359
|
+
copy(array) {
|
|
4360
|
+
this[0] = array[0];
|
|
4361
|
+
this[1] = array[1];
|
|
4362
|
+
this[2] = array[2];
|
|
4363
|
+
this[3] = array[3];
|
|
4364
|
+
this[4] = array[4];
|
|
4365
|
+
this[5] = array[5];
|
|
4366
|
+
this[6] = array[6];
|
|
4367
|
+
this[7] = array[7];
|
|
4368
|
+
this[8] = array[8];
|
|
4369
|
+
return this.check();
|
|
4370
|
+
}
|
|
4371
|
+
identity() {
|
|
4372
|
+
return this.copy(IDENTITY_MATRIX);
|
|
4373
|
+
}
|
|
4374
|
+
fromObject(object) {
|
|
4375
|
+
return this.check();
|
|
4376
|
+
}
|
|
4377
|
+
fromQuaternion(q) {
|
|
4378
|
+
fromQuat(this, q);
|
|
4379
|
+
return this.check();
|
|
4380
|
+
}
|
|
4381
|
+
set(m00, m10, m20, m01, m11, m21, m02, m12, m22) {
|
|
4382
|
+
this[0] = m00;
|
|
4383
|
+
this[1] = m10;
|
|
4384
|
+
this[2] = m20;
|
|
4385
|
+
this[3] = m01;
|
|
4386
|
+
this[4] = m11;
|
|
4387
|
+
this[5] = m21;
|
|
4388
|
+
this[6] = m02;
|
|
4389
|
+
this[7] = m12;
|
|
4390
|
+
this[8] = m22;
|
|
4391
|
+
return this.check();
|
|
4392
|
+
}
|
|
4393
|
+
setRowMajor(m00, m01, m02, m10, m11, m12, m20, m21, m22) {
|
|
4394
|
+
this[0] = m00;
|
|
4395
|
+
this[1] = m10;
|
|
4396
|
+
this[2] = m20;
|
|
4397
|
+
this[3] = m01;
|
|
4398
|
+
this[4] = m11;
|
|
4399
|
+
this[5] = m21;
|
|
4400
|
+
this[6] = m02;
|
|
4401
|
+
this[7] = m12;
|
|
4402
|
+
this[8] = m22;
|
|
4403
|
+
return this.check();
|
|
4404
|
+
}
|
|
4405
|
+
determinant() {
|
|
4406
|
+
return determinant(this);
|
|
4407
|
+
}
|
|
4408
|
+
transpose() {
|
|
4409
|
+
transpose(this, this);
|
|
4410
|
+
return this.check();
|
|
4411
|
+
}
|
|
4412
|
+
invert() {
|
|
4413
|
+
invert(this, this);
|
|
4414
|
+
return this.check();
|
|
4415
|
+
}
|
|
4416
|
+
multiplyLeft(a2) {
|
|
4417
|
+
multiply(this, a2, this);
|
|
4418
|
+
return this.check();
|
|
4419
|
+
}
|
|
4420
|
+
multiplyRight(a2) {
|
|
4421
|
+
multiply(this, this, a2);
|
|
4422
|
+
return this.check();
|
|
4423
|
+
}
|
|
4424
|
+
rotate(radians) {
|
|
4425
|
+
rotate(this, this, radians);
|
|
4426
|
+
return this.check();
|
|
4427
|
+
}
|
|
4428
|
+
scale(factor) {
|
|
4429
|
+
if (Array.isArray(factor)) {
|
|
4430
|
+
scale(this, this, factor);
|
|
4431
|
+
} else {
|
|
4432
|
+
scale(this, this, [factor, factor]);
|
|
4433
|
+
}
|
|
4434
|
+
return this.check();
|
|
4435
|
+
}
|
|
4436
|
+
translate(vec) {
|
|
4437
|
+
translate(this, this, vec);
|
|
4438
|
+
return this.check();
|
|
4439
|
+
}
|
|
4440
|
+
transform(vector, result) {
|
|
4441
|
+
let out;
|
|
4442
|
+
switch (vector.length) {
|
|
4443
|
+
case 2:
|
|
4444
|
+
out = transformMat3(result || [-0, -0], vector, this);
|
|
4445
|
+
break;
|
|
4446
|
+
case 3:
|
|
4447
|
+
out = transformMat32(result || [-0, -0, -0], vector, this);
|
|
4448
|
+
break;
|
|
4449
|
+
case 4:
|
|
4450
|
+
out = vec4_transformMat3(result || [-0, -0, -0, -0], vector, this);
|
|
4451
|
+
break;
|
|
4452
|
+
default:
|
|
4453
|
+
throw new Error("Illegal vector");
|
|
4454
|
+
}
|
|
4455
|
+
checkVector(out, vector.length);
|
|
4456
|
+
return out;
|
|
4457
|
+
}
|
|
4458
|
+
transformVector(vector, result) {
|
|
4459
|
+
return this.transform(vector, result);
|
|
4460
|
+
}
|
|
4461
|
+
transformVector2(vector, result) {
|
|
4462
|
+
return this.transform(vector, result);
|
|
4463
|
+
}
|
|
4464
|
+
transformVector3(vector, result) {
|
|
4465
|
+
return this.transform(vector, result);
|
|
4466
|
+
}
|
|
4467
|
+
};
|
|
4468
|
+
}
|
|
4469
|
+
});
|
|
4470
|
+
|
|
4471
|
+
// ../../node_modules/@math.gl/core/dist/esm/index.js
|
|
4472
|
+
var init_esm = __esm({
|
|
4473
|
+
"../../node_modules/@math.gl/core/dist/esm/index.js"() {
|
|
4474
|
+
init_vector3();
|
|
4475
|
+
init_matrix3();
|
|
4476
|
+
}
|
|
4477
|
+
});
|
|
4478
|
+
|
|
4479
|
+
// src/lib/gltf-utils/gltf-constants.ts
|
|
4480
|
+
var COMPONENTS, BYTES;
|
|
4481
|
+
var init_gltf_constants = __esm({
|
|
4482
|
+
"src/lib/gltf-utils/gltf-constants.ts"() {
|
|
4483
|
+
COMPONENTS = {
|
|
4484
|
+
SCALAR: 1,
|
|
4485
|
+
VEC2: 2,
|
|
4486
|
+
VEC3: 3,
|
|
4487
|
+
VEC4: 4,
|
|
4488
|
+
MAT2: 4,
|
|
4489
|
+
MAT3: 9,
|
|
4490
|
+
MAT4: 16
|
|
4491
|
+
};
|
|
4492
|
+
BYTES = {
|
|
4493
|
+
5120: 1,
|
|
4494
|
+
5121: 1,
|
|
4495
|
+
5122: 2,
|
|
4496
|
+
5123: 2,
|
|
4497
|
+
5125: 4,
|
|
4498
|
+
5126: 4
|
|
4499
|
+
};
|
|
4500
|
+
}
|
|
4501
|
+
});
|
|
4502
|
+
|
|
4503
|
+
// src/lib/extensions/KHR_texture_transform.ts
|
|
4504
|
+
var KHR_texture_transform_exports = {};
|
|
4505
|
+
__export(KHR_texture_transform_exports, {
|
|
4506
|
+
decode: () => decode4,
|
|
4507
|
+
name: () => name5
|
|
4508
|
+
});
|
|
4509
|
+
async function decode4(gltfData, options) {
|
|
4510
|
+
const gltfScenegraph = new GLTFScenegraph(gltfData);
|
|
4511
|
+
const extension = gltfScenegraph.getExtension(EXT_MESHOPT_TRANSFORM);
|
|
4512
|
+
if (!extension) {
|
|
4513
|
+
return;
|
|
4514
|
+
}
|
|
4515
|
+
const materials = gltfData.json.materials || [];
|
|
4516
|
+
for (let i2 = 0; i2 < materials.length; i2++) {
|
|
4517
|
+
transformTexCoords(i2, gltfData);
|
|
4518
|
+
}
|
|
4519
|
+
}
|
|
4520
|
+
function transformTexCoords(materialIndex, gltfData) {
|
|
4521
|
+
const processedTexCoords = [];
|
|
4522
|
+
const material = gltfData.json.materials?.[materialIndex];
|
|
4523
|
+
const baseColorTexture = material?.pbrMetallicRoughness?.baseColorTexture;
|
|
4524
|
+
if (baseColorTexture) {
|
|
4525
|
+
transformPrimitives(gltfData, materialIndex, baseColorTexture, processedTexCoords);
|
|
4526
|
+
}
|
|
4527
|
+
const emisiveTexture = material?.emissiveTexture;
|
|
4528
|
+
if (emisiveTexture) {
|
|
4529
|
+
transformPrimitives(gltfData, materialIndex, emisiveTexture, processedTexCoords);
|
|
4530
|
+
}
|
|
4531
|
+
const normalTexture = material?.normalTexture;
|
|
4532
|
+
if (normalTexture) {
|
|
4533
|
+
transformPrimitives(gltfData, materialIndex, normalTexture, processedTexCoords);
|
|
4534
|
+
}
|
|
4535
|
+
const occlusionTexture = material?.occlusionTexture;
|
|
4536
|
+
if (occlusionTexture) {
|
|
4537
|
+
transformPrimitives(gltfData, materialIndex, occlusionTexture, processedTexCoords);
|
|
4538
|
+
}
|
|
4539
|
+
const metallicRoughnessTexture = material?.pbrMetallicRoughness?.metallicRoughnessTexture;
|
|
4540
|
+
if (metallicRoughnessTexture) {
|
|
4541
|
+
transformPrimitives(gltfData, materialIndex, metallicRoughnessTexture, processedTexCoords);
|
|
4542
|
+
}
|
|
4543
|
+
}
|
|
4544
|
+
function transformPrimitives(gltfData, materialIndex, texture, processedTexCoords) {
|
|
4545
|
+
const transformParameters = getTransformParameters(texture, processedTexCoords);
|
|
4546
|
+
if (!transformParameters) {
|
|
4547
|
+
return;
|
|
4548
|
+
}
|
|
4549
|
+
const meshes = gltfData.json.meshes || [];
|
|
4550
|
+
for (const mesh of meshes) {
|
|
4551
|
+
for (const primitive of mesh.primitives) {
|
|
4552
|
+
const material = primitive.material;
|
|
4553
|
+
if (Number.isFinite(material) && materialIndex === material) {
|
|
4554
|
+
transformPrimitive(gltfData, primitive, transformParameters);
|
|
4555
|
+
}
|
|
4556
|
+
}
|
|
4557
|
+
}
|
|
4558
|
+
}
|
|
4559
|
+
function getTransformParameters(texture, processedTexCoords) {
|
|
4560
|
+
const textureInfo = texture.extensions?.[EXT_MESHOPT_TRANSFORM];
|
|
4561
|
+
const { texCoord: originalTexCoord = 0 } = texture;
|
|
4562
|
+
const { texCoord = originalTexCoord } = textureInfo;
|
|
4563
|
+
const isProcessed = processedTexCoords.findIndex(([original, newTexCoord]) => original === originalTexCoord && newTexCoord === texCoord) !== -1;
|
|
4564
|
+
if (!isProcessed) {
|
|
4565
|
+
const matrix = makeTransformationMatrix(textureInfo);
|
|
4566
|
+
if (originalTexCoord !== texCoord) {
|
|
4567
|
+
texture.texCoord = texCoord;
|
|
4568
|
+
}
|
|
4569
|
+
processedTexCoords.push([originalTexCoord, texCoord]);
|
|
4570
|
+
return { originalTexCoord, texCoord, matrix };
|
|
4571
|
+
}
|
|
4572
|
+
return null;
|
|
4573
|
+
}
|
|
4574
|
+
function transformPrimitive(gltfData, primitive, transformParameters) {
|
|
4575
|
+
const { originalTexCoord, texCoord, matrix } = transformParameters;
|
|
4576
|
+
const texCoordAccessor = primitive.attributes[`TEXCOORD_${originalTexCoord}`];
|
|
4577
|
+
if (Number.isFinite(texCoordAccessor)) {
|
|
4578
|
+
const accessor = gltfData.json.accessors?.[texCoordAccessor];
|
|
4579
|
+
if (accessor && accessor.bufferView) {
|
|
4580
|
+
const bufferView = gltfData.json.bufferViews?.[accessor.bufferView];
|
|
4581
|
+
if (bufferView) {
|
|
4582
|
+
const { arrayBuffer, byteOffset: bufferByteOffset } = gltfData.buffers[bufferView.buffer];
|
|
4583
|
+
const byteOffset = (bufferByteOffset || 0) + (accessor.byteOffset || 0) + (bufferView.byteOffset || 0);
|
|
4584
|
+
const { ArrayType, length } = getAccessorArrayTypeAndLength(accessor, bufferView);
|
|
4585
|
+
const bytes = BYTES[accessor.componentType];
|
|
4586
|
+
const components = COMPONENTS[accessor.type];
|
|
4587
|
+
const elementAddressScale = bufferView.byteStride || bytes * components;
|
|
4588
|
+
const result = new Float32Array(length);
|
|
4589
|
+
for (let i2 = 0; i2 < accessor.count; i2++) {
|
|
4590
|
+
const uv = new ArrayType(arrayBuffer, byteOffset + i2 * elementAddressScale, 2);
|
|
4591
|
+
scratchVector.set(uv[0], uv[1], 1);
|
|
4592
|
+
scratchVector.transformByMatrix3(matrix);
|
|
4593
|
+
result.set([scratchVector[0], scratchVector[1]], i2 * components);
|
|
4594
|
+
}
|
|
4595
|
+
if (originalTexCoord === texCoord) {
|
|
4596
|
+
updateGltf(accessor, bufferView, gltfData.buffers, result);
|
|
4597
|
+
} else {
|
|
4598
|
+
createAttribute(texCoord, accessor, primitive, gltfData, result);
|
|
4599
|
+
}
|
|
4600
|
+
}
|
|
4601
|
+
}
|
|
4602
|
+
}
|
|
4603
|
+
}
|
|
4604
|
+
function updateGltf(accessor, bufferView, buffers, newTexCoordArray) {
|
|
4605
|
+
accessor.componentType = 5126;
|
|
4606
|
+
buffers.push({
|
|
4607
|
+
arrayBuffer: newTexCoordArray.buffer,
|
|
4608
|
+
byteOffset: 0,
|
|
4609
|
+
byteLength: newTexCoordArray.buffer.byteLength
|
|
4610
|
+
});
|
|
4611
|
+
bufferView.buffer = buffers.length - 1;
|
|
4612
|
+
bufferView.byteLength = newTexCoordArray.buffer.byteLength;
|
|
4613
|
+
bufferView.byteOffset = 0;
|
|
4614
|
+
delete bufferView.byteStride;
|
|
4615
|
+
}
|
|
4616
|
+
function createAttribute(newTexCoord, originalAccessor, primitive, gltfData, newTexCoordArray) {
|
|
4617
|
+
gltfData.buffers.push({
|
|
4618
|
+
arrayBuffer: newTexCoordArray.buffer,
|
|
4619
|
+
byteOffset: 0,
|
|
4620
|
+
byteLength: newTexCoordArray.buffer.byteLength
|
|
4621
|
+
});
|
|
4622
|
+
const bufferViews = gltfData.json.bufferViews;
|
|
4623
|
+
if (!bufferViews) {
|
|
4624
|
+
return;
|
|
4625
|
+
}
|
|
4626
|
+
bufferViews.push({
|
|
4627
|
+
buffer: gltfData.buffers.length - 1,
|
|
4628
|
+
byteLength: newTexCoordArray.buffer.byteLength,
|
|
4629
|
+
byteOffset: 0
|
|
4630
|
+
});
|
|
4631
|
+
const accessors = gltfData.json.accessors;
|
|
4632
|
+
if (!accessors) {
|
|
4633
|
+
return;
|
|
4634
|
+
}
|
|
4635
|
+
accessors.push({
|
|
4636
|
+
bufferView: bufferViews?.length - 1,
|
|
4637
|
+
byteOffset: 0,
|
|
4638
|
+
componentType: 5126,
|
|
4639
|
+
count: originalAccessor.count,
|
|
4640
|
+
type: "VEC2"
|
|
4641
|
+
});
|
|
4642
|
+
primitive.attributes[`TEXCOORD_${newTexCoord}`] = accessors.length - 1;
|
|
4643
|
+
}
|
|
4644
|
+
function makeTransformationMatrix(extensionData) {
|
|
4645
|
+
const { offset = [0, 0], rotation = 0, scale: scale2 = [1, 1] } = extensionData;
|
|
4646
|
+
const translationMatirx = new Matrix3().set(1, 0, 0, 0, 1, 0, offset[0], offset[1], 1);
|
|
4647
|
+
const rotationMatirx = scratchRotationMatrix.set(Math.cos(rotation), Math.sin(rotation), 0, -Math.sin(rotation), Math.cos(rotation), 0, 0, 0, 1);
|
|
4648
|
+
const scaleMatrix = scratchScaleMatrix.set(scale2[0], 0, 0, 0, scale2[1], 0, 0, 0, 1);
|
|
4649
|
+
return translationMatirx.multiplyRight(rotationMatirx).multiplyRight(scaleMatrix);
|
|
4650
|
+
}
|
|
4651
|
+
var EXT_MESHOPT_TRANSFORM, name5, scratchVector, scratchRotationMatrix, scratchScaleMatrix;
|
|
4652
|
+
var init_KHR_texture_transform = __esm({
|
|
4653
|
+
"src/lib/extensions/KHR_texture_transform.ts"() {
|
|
4654
|
+
init_esm();
|
|
4655
|
+
init_gltf_utils();
|
|
4656
|
+
init_gltf_constants();
|
|
4657
|
+
init_gltf_scenegraph();
|
|
4658
|
+
EXT_MESHOPT_TRANSFORM = "KHR_texture_transform";
|
|
4659
|
+
name5 = EXT_MESHOPT_TRANSFORM;
|
|
4660
|
+
scratchVector = new Vector3();
|
|
4661
|
+
scratchRotationMatrix = new Matrix3();
|
|
4662
|
+
scratchScaleMatrix = new Matrix3();
|
|
4663
|
+
}
|
|
4664
|
+
});
|
|
4665
|
+
|
|
3304
4666
|
// src/lib/extensions/deprecated/KHR_lights_punctual.ts
|
|
3305
4667
|
var KHR_lights_punctual_exports = {};
|
|
3306
4668
|
__export(KHR_lights_punctual_exports, {
|
|
3307
|
-
decode: () =>
|
|
4669
|
+
decode: () => decode5,
|
|
3308
4670
|
encode: () => encode2,
|
|
3309
|
-
name: () =>
|
|
4671
|
+
name: () => name6
|
|
3310
4672
|
});
|
|
3311
|
-
async function
|
|
4673
|
+
async function decode5(gltfData) {
|
|
3312
4674
|
const gltfScenegraph = new GLTFScenegraph(gltfData);
|
|
3313
4675
|
const { json } = gltfScenegraph;
|
|
3314
4676
|
const extension = gltfScenegraph.getExtension(KHR_LIGHTS_PUNCTUAL);
|
|
@@ -3341,27 +4703,26 @@
|
|
|
3341
4703
|
delete gltfScenegraph.json.lights;
|
|
3342
4704
|
}
|
|
3343
4705
|
}
|
|
3344
|
-
var KHR_LIGHTS_PUNCTUAL,
|
|
4706
|
+
var KHR_LIGHTS_PUNCTUAL, name6;
|
|
3345
4707
|
var init_KHR_lights_punctual = __esm({
|
|
3346
4708
|
"src/lib/extensions/deprecated/KHR_lights_punctual.ts"() {
|
|
3347
4709
|
init_assert3();
|
|
3348
4710
|
init_gltf_scenegraph();
|
|
3349
4711
|
KHR_LIGHTS_PUNCTUAL = "KHR_lights_punctual";
|
|
3350
|
-
|
|
4712
|
+
name6 = KHR_LIGHTS_PUNCTUAL;
|
|
3351
4713
|
}
|
|
3352
4714
|
});
|
|
3353
4715
|
|
|
3354
4716
|
// src/lib/extensions/deprecated/KHR_materials_unlit.ts
|
|
3355
4717
|
var KHR_materials_unlit_exports = {};
|
|
3356
4718
|
__export(KHR_materials_unlit_exports, {
|
|
3357
|
-
decode: () =>
|
|
4719
|
+
decode: () => decode6,
|
|
3358
4720
|
encode: () => encode3,
|
|
3359
|
-
name: () =>
|
|
4721
|
+
name: () => name7
|
|
3360
4722
|
});
|
|
3361
|
-
async function
|
|
4723
|
+
async function decode6(gltfData) {
|
|
3362
4724
|
const gltfScenegraph = new GLTFScenegraph(gltfData);
|
|
3363
4725
|
const { json } = gltfScenegraph;
|
|
3364
|
-
gltfScenegraph.removeExtension(KHR_MATERIALS_UNLIT);
|
|
3365
4726
|
for (const material of json.materials || []) {
|
|
3366
4727
|
const extension = material.extensions && material.extensions.KHR_materials_unlit;
|
|
3367
4728
|
if (extension) {
|
|
@@ -3369,6 +4730,7 @@
|
|
|
3369
4730
|
}
|
|
3370
4731
|
gltfScenegraph.removeObjectExtension(material, KHR_MATERIALS_UNLIT);
|
|
3371
4732
|
}
|
|
4733
|
+
gltfScenegraph.removeExtension(KHR_MATERIALS_UNLIT);
|
|
3372
4734
|
}
|
|
3373
4735
|
function encode3(gltfData) {
|
|
3374
4736
|
const gltfScenegraph = new GLTFScenegraph(gltfData);
|
|
@@ -3383,23 +4745,23 @@
|
|
|
3383
4745
|
}
|
|
3384
4746
|
}
|
|
3385
4747
|
}
|
|
3386
|
-
var KHR_MATERIALS_UNLIT,
|
|
4748
|
+
var KHR_MATERIALS_UNLIT, name7;
|
|
3387
4749
|
var init_KHR_materials_unlit = __esm({
|
|
3388
4750
|
"src/lib/extensions/deprecated/KHR_materials_unlit.ts"() {
|
|
3389
4751
|
init_gltf_scenegraph();
|
|
3390
4752
|
KHR_MATERIALS_UNLIT = "KHR_materials_unlit";
|
|
3391
|
-
|
|
4753
|
+
name7 = KHR_MATERIALS_UNLIT;
|
|
3392
4754
|
}
|
|
3393
4755
|
});
|
|
3394
4756
|
|
|
3395
4757
|
// src/lib/extensions/deprecated/KHR_techniques_webgl.ts
|
|
3396
4758
|
var KHR_techniques_webgl_exports = {};
|
|
3397
4759
|
__export(KHR_techniques_webgl_exports, {
|
|
3398
|
-
decode: () =>
|
|
4760
|
+
decode: () => decode7,
|
|
3399
4761
|
encode: () => encode4,
|
|
3400
|
-
name: () =>
|
|
4762
|
+
name: () => name8
|
|
3401
4763
|
});
|
|
3402
|
-
async function
|
|
4764
|
+
async function decode7(gltfData) {
|
|
3403
4765
|
const gltfScenegraph = new GLTFScenegraph(gltfData);
|
|
3404
4766
|
const { json } = gltfScenegraph;
|
|
3405
4767
|
const extension = gltfScenegraph.getExtension(KHR_TECHNIQUES_WEBGL);
|
|
@@ -3451,12 +4813,97 @@
|
|
|
3451
4813
|
});
|
|
3452
4814
|
return values;
|
|
3453
4815
|
}
|
|
3454
|
-
var KHR_TECHNIQUES_WEBGL,
|
|
4816
|
+
var KHR_TECHNIQUES_WEBGL, name8;
|
|
3455
4817
|
var init_KHR_techniques_webgl = __esm({
|
|
3456
4818
|
"src/lib/extensions/deprecated/KHR_techniques_webgl.ts"() {
|
|
3457
4819
|
init_gltf_scenegraph();
|
|
3458
4820
|
KHR_TECHNIQUES_WEBGL = "KHR_techniques_webgl";
|
|
3459
|
-
|
|
4821
|
+
name8 = KHR_TECHNIQUES_WEBGL;
|
|
4822
|
+
}
|
|
4823
|
+
});
|
|
4824
|
+
|
|
4825
|
+
// src/lib/extensions/deprecated/EXT_feature_metadata.ts
|
|
4826
|
+
var EXT_feature_metadata_exports = {};
|
|
4827
|
+
__export(EXT_feature_metadata_exports, {
|
|
4828
|
+
decode: () => decode8,
|
|
4829
|
+
name: () => name9
|
|
4830
|
+
});
|
|
4831
|
+
async function decode8(gltfData) {
|
|
4832
|
+
const scenegraph = new GLTFScenegraph(gltfData);
|
|
4833
|
+
decodeExtFeatureMetadata(scenegraph);
|
|
4834
|
+
}
|
|
4835
|
+
function decodeExtFeatureMetadata(scenegraph) {
|
|
4836
|
+
const extension = scenegraph.getExtension(EXT_FEATURE_METADATA);
|
|
4837
|
+
const schemaClasses = extension?.schema?.classes;
|
|
4838
|
+
const featureTables = extension?.featureTables;
|
|
4839
|
+
const featureTextures = extension?.featureTextures;
|
|
4840
|
+
if (featureTextures) {
|
|
4841
|
+
console.warn('featureTextures is not yet supported in the "EXT_feature_metadata" extension.');
|
|
4842
|
+
}
|
|
4843
|
+
if (schemaClasses && featureTables) {
|
|
4844
|
+
for (const schemaName in schemaClasses) {
|
|
4845
|
+
const schemaClass = schemaClasses[schemaName];
|
|
4846
|
+
const featureTable = findFeatureTableByName(featureTables, schemaName);
|
|
4847
|
+
if (featureTable) {
|
|
4848
|
+
handleFeatureTableProperties(scenegraph, featureTable, schemaClass);
|
|
4849
|
+
}
|
|
4850
|
+
}
|
|
4851
|
+
}
|
|
4852
|
+
}
|
|
4853
|
+
function handleFeatureTableProperties(scenegraph, featureTable, schemaClass) {
|
|
4854
|
+
for (const propertyName in schemaClass.properties) {
|
|
4855
|
+
const schemaProperty = schemaClass.properties[propertyName];
|
|
4856
|
+
const featureTableProperty = featureTable?.properties?.[propertyName];
|
|
4857
|
+
const numberOfFeatures = featureTable.count;
|
|
4858
|
+
if (featureTableProperty) {
|
|
4859
|
+
const data = getPropertyDataFromBinarySource(scenegraph, schemaProperty, numberOfFeatures, featureTableProperty);
|
|
4860
|
+
featureTableProperty.data = data;
|
|
4861
|
+
}
|
|
4862
|
+
}
|
|
4863
|
+
}
|
|
4864
|
+
function getPropertyDataFromBinarySource(scenegraph, schemaProperty, numberOfFeatures, featureTableProperty) {
|
|
4865
|
+
const bufferView = featureTableProperty.bufferView;
|
|
4866
|
+
let data = scenegraph.getTypedArrayForBufferView(bufferView);
|
|
4867
|
+
switch (schemaProperty.type) {
|
|
4868
|
+
case "STRING": {
|
|
4869
|
+
const stringOffsetBufferView = featureTableProperty.stringOffsetBufferView;
|
|
4870
|
+
const offsetsData = scenegraph.getTypedArrayForBufferView(stringOffsetBufferView);
|
|
4871
|
+
data = getStringAttributes(data, offsetsData, numberOfFeatures);
|
|
4872
|
+
break;
|
|
4873
|
+
}
|
|
4874
|
+
default:
|
|
4875
|
+
}
|
|
4876
|
+
return data;
|
|
4877
|
+
}
|
|
4878
|
+
function findFeatureTableByName(featureTables, schemaClassName) {
|
|
4879
|
+
for (const featureTableName in featureTables) {
|
|
4880
|
+
const featureTable = featureTables[featureTableName];
|
|
4881
|
+
if (featureTable.class === schemaClassName) {
|
|
4882
|
+
return featureTable;
|
|
4883
|
+
}
|
|
4884
|
+
}
|
|
4885
|
+
return null;
|
|
4886
|
+
}
|
|
4887
|
+
function getStringAttributes(data, offsetsData, stringsCount) {
|
|
4888
|
+
const stringsArray = [];
|
|
4889
|
+
const textDecoder = new TextDecoder("utf8");
|
|
4890
|
+
let stringOffset = 0;
|
|
4891
|
+
const bytesPerStringSize = 4;
|
|
4892
|
+
for (let index = 0; index < stringsCount; index++) {
|
|
4893
|
+
const stringByteSize = offsetsData[(index + 1) * bytesPerStringSize] - offsetsData[index * bytesPerStringSize];
|
|
4894
|
+
const stringData = data.subarray(stringOffset, stringByteSize + stringOffset);
|
|
4895
|
+
const stringAttribute = textDecoder.decode(stringData);
|
|
4896
|
+
stringsArray.push(stringAttribute);
|
|
4897
|
+
stringOffset += stringByteSize;
|
|
4898
|
+
}
|
|
4899
|
+
return stringsArray;
|
|
4900
|
+
}
|
|
4901
|
+
var EXT_FEATURE_METADATA, name9;
|
|
4902
|
+
var init_EXT_feature_metadata = __esm({
|
|
4903
|
+
"src/lib/extensions/deprecated/EXT_feature_metadata.ts"() {
|
|
4904
|
+
init_gltf_scenegraph();
|
|
4905
|
+
EXT_FEATURE_METADATA = "EXT_feature_metadata";
|
|
4906
|
+
name9 = EXT_FEATURE_METADATA;
|
|
3460
4907
|
}
|
|
3461
4908
|
});
|
|
3462
4909
|
|
|
@@ -3485,9 +4932,11 @@
|
|
|
3485
4932
|
init_EXT_texture_webp();
|
|
3486
4933
|
init_KHR_texture_basisu();
|
|
3487
4934
|
init_KHR_draco_mesh_compression();
|
|
4935
|
+
init_KHR_texture_transform();
|
|
3488
4936
|
init_KHR_lights_punctual();
|
|
3489
4937
|
init_KHR_materials_unlit();
|
|
3490
4938
|
init_KHR_techniques_webgl();
|
|
4939
|
+
init_EXT_feature_metadata();
|
|
3491
4940
|
EXTENSIONS2 = [
|
|
3492
4941
|
EXT_meshopt_compression_exports,
|
|
3493
4942
|
EXT_texture_webp_exports,
|
|
@@ -3495,7 +4944,9 @@
|
|
|
3495
4944
|
KHR_draco_mesh_compression_exports,
|
|
3496
4945
|
KHR_lights_punctual_exports,
|
|
3497
4946
|
KHR_materials_unlit_exports,
|
|
3498
|
-
KHR_techniques_webgl_exports
|
|
4947
|
+
KHR_techniques_webgl_exports,
|
|
4948
|
+
KHR_texture_transform_exports,
|
|
4949
|
+
EXT_feature_metadata_exports
|
|
3499
4950
|
];
|
|
3500
4951
|
}
|
|
3501
4952
|
});
|
|
@@ -3726,20 +5177,20 @@
|
|
|
3726
5177
|
|
|
3727
5178
|
// src/lib/api/post-process-gltf.ts
|
|
3728
5179
|
function getBytesFromComponentType(componentType) {
|
|
3729
|
-
return
|
|
5180
|
+
return BYTES2[componentType];
|
|
3730
5181
|
}
|
|
3731
5182
|
function getSizeFromAccessorType(type) {
|
|
3732
|
-
return
|
|
5183
|
+
return COMPONENTS2[type];
|
|
3733
5184
|
}
|
|
3734
5185
|
function postProcessGLTF(gltf, options) {
|
|
3735
5186
|
return new GLTFPostProcessor().postProcess(gltf, options);
|
|
3736
5187
|
}
|
|
3737
|
-
var
|
|
5188
|
+
var COMPONENTS2, BYTES2, GL_SAMPLER, SAMPLER_PARAMETER_GLTF_TO_GL, DEFAULT_SAMPLER, GLTFPostProcessor;
|
|
3738
5189
|
var init_post_process_gltf = __esm({
|
|
3739
5190
|
"src/lib/api/post-process-gltf.ts"() {
|
|
3740
5191
|
init_assert3();
|
|
3741
5192
|
init_gltf_utils();
|
|
3742
|
-
|
|
5193
|
+
COMPONENTS2 = {
|
|
3743
5194
|
SCALAR: 1,
|
|
3744
5195
|
VEC2: 2,
|
|
3745
5196
|
VEC3: 3,
|
|
@@ -3748,7 +5199,7 @@
|
|
|
3748
5199
|
MAT3: 9,
|
|
3749
5200
|
MAT4: 16
|
|
3750
5201
|
};
|
|
3751
|
-
|
|
5202
|
+
BYTES2 = {
|
|
3752
5203
|
5120: 1,
|
|
3753
5204
|
5121: 1,
|
|
3754
5205
|
5122: 2,
|
|
@@ -4260,6 +5711,9 @@
|
|
|
4260
5711
|
const uri = resolveUrl(image.uri, options);
|
|
4261
5712
|
const response = await fetch2(uri);
|
|
4262
5713
|
arrayBuffer = await response.arrayBuffer();
|
|
5714
|
+
image.bufferView = {
|
|
5715
|
+
data: arrayBuffer
|
|
5716
|
+
};
|
|
4263
5717
|
}
|
|
4264
5718
|
if (Number.isFinite(image.bufferView)) {
|
|
4265
5719
|
const array = getTypedArrayForBufferView(gltf.json, gltf.buffers, image.bufferView);
|