tangram-core 0.2.0__cp313-cp313-win_amd64.whl
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.
- tangram_core/App.vue +335 -0
- tangram_core/__init__.py +5 -0
- tangram_core/__main__.py +141 -0
- tangram_core/_core.cp313-win_amd64.pyd +0 -0
- tangram_core/_core.pyi +38 -0
- tangram_core/api.ts +456 -0
- tangram_core/backend.py +335 -0
- tangram_core/colour.ts +71 -0
- tangram_core/config.py +122 -0
- tangram_core/dist-frontend/aggregation-layers.js +521 -0
- tangram_core/dist-frontend/aggregation-layers.js.map +1 -0
- tangram_core/dist-frontend/assets/_commonjsHelpers-CqkleIqs.js +2 -0
- tangram_core/dist-frontend/assets/_commonjsHelpers-CqkleIqs.js.map +1 -0
- tangram_core/dist-frontend/assets/array-utils-flat-wyE8tIYR.js +11 -0
- tangram_core/dist-frontend/assets/array-utils-flat-wyE8tIYR.js.map +1 -0
- tangram_core/dist-frontend/assets/assert-hrfsarFU.js +3 -0
- tangram_core/dist-frontend/assets/assert-hrfsarFU.js.map +1 -0
- tangram_core/dist-frontend/assets/b612-latin-400-italic-DePNXA0a.woff +0 -0
- tangram_core/dist-frontend/assets/b612-latin-400-italic-a-4GLPtl.woff2 +0 -0
- tangram_core/dist-frontend/assets/b612-latin-400-normal-CC98FVm_.woff2 +0 -0
- tangram_core/dist-frontend/assets/b612-latin-400-normal-JbZ7xwUX.woff +0 -0
- tangram_core/dist-frontend/assets/b612-latin-700-normal-B_Snq1wd.woff +0 -0
- tangram_core/dist-frontend/assets/b612-latin-700-normal-BinQrnoB.woff2 +0 -0
- tangram_core/dist-frontend/assets/clip-extension-DTCP51Ak.js +26 -0
- tangram_core/dist-frontend/assets/clip-extension-DTCP51Ak.js.map +1 -0
- tangram_core/dist-frontend/assets/color-CUNNsFV-.js +17 -0
- tangram_core/dist-frontend/assets/color-CUNNsFV-.js.map +1 -0
- tangram_core/dist-frontend/assets/cube-geometry-CzJ_uBWa.js +2 -0
- tangram_core/dist-frontend/assets/cube-geometry-CzJ_uBWa.js.map +1 -0
- tangram_core/dist-frontend/assets/deep-equal-uriyKJca.js +2 -0
- tangram_core/dist-frontend/assets/deep-equal-uriyKJca.js.map +1 -0
- tangram_core/dist-frontend/assets/fly-to-interpolator-DlKiy9_S.js +2 -0
- tangram_core/dist-frontend/assets/fly-to-interpolator-DlKiy9_S.js.map +1 -0
- tangram_core/dist-frontend/assets/geojson-layer-CLhXLxdI.js +1010 -0
- tangram_core/dist-frontend/assets/geojson-layer-CLhXLxdI.js.map +1 -0
- tangram_core/dist-frontend/assets/globe-view-DKhftlA1.js +94 -0
- tangram_core/dist-frontend/assets/globe-view-DKhftlA1.js.map +1 -0
- tangram_core/dist-frontend/assets/globe-viewport-CPES4D4P.js +2 -0
- tangram_core/dist-frontend/assets/globe-viewport-CPES4D4P.js.map +1 -0
- tangram_core/dist-frontend/assets/image-loader-ClbNCMXW.js +2 -0
- tangram_core/dist-frontend/assets/image-loader-ClbNCMXW.js.map +1 -0
- tangram_core/dist-frontend/assets/inconsolata-latin-400-normal-DTZQ6lD6.woff2 +0 -0
- tangram_core/dist-frontend/assets/inconsolata-latin-400-normal-HYADljCo.woff +0 -0
- tangram_core/dist-frontend/assets/inconsolata-latin-700-normal-ByjKuJjN.woff2 +0 -0
- tangram_core/dist-frontend/assets/inconsolata-latin-700-normal-DzgUY3Rl.woff +0 -0
- tangram_core/dist-frontend/assets/inconsolata-latin-ext-400-normal-BaHVOdFB.woff2 +0 -0
- tangram_core/dist-frontend/assets/inconsolata-latin-ext-400-normal-yvPjCxxx.woff +0 -0
- tangram_core/dist-frontend/assets/inconsolata-latin-ext-700-normal-D0Kpgs_9.woff2 +0 -0
- tangram_core/dist-frontend/assets/inconsolata-latin-ext-700-normal-Dlt-daqV.woff +0 -0
- tangram_core/dist-frontend/assets/inconsolata-vietnamese-400-normal-ByiM2lek.woff +0 -0
- tangram_core/dist-frontend/assets/inconsolata-vietnamese-400-normal-DfC_iMic.woff2 +0 -0
- tangram_core/dist-frontend/assets/inconsolata-vietnamese-700-normal-DLCFFAUf.woff +0 -0
- tangram_core/dist-frontend/assets/inconsolata-vietnamese-700-normal-DuasYmn8.woff2 +0 -0
- tangram_core/dist-frontend/assets/index-UPPakSLR.css +1 -0
- tangram_core/dist-frontend/assets/index-r8T0kY2p.js +821 -0
- tangram_core/dist-frontend/assets/index-r8T0kY2p.js.map +1 -0
- tangram_core/dist-frontend/assets/layer-DO63TrsS.js +555 -0
- tangram_core/dist-frontend/assets/layer-DO63TrsS.js.map +1 -0
- tangram_core/dist-frontend/assets/layer-extension-CZ3zsHuN.js +2 -0
- tangram_core/dist-frontend/assets/layer-extension-CZ3zsHuN.js.map +1 -0
- tangram_core/dist-frontend/assets/mesh-layers-BSECKarm.js +1123 -0
- tangram_core/dist-frontend/assets/mesh-layers-BSECKarm.js.map +1 -0
- tangram_core/dist-frontend/assets/orthographic-viewport-CzZmHDEZ.js +2 -0
- tangram_core/dist-frontend/assets/orthographic-viewport-CzZmHDEZ.js.map +1 -0
- tangram_core/dist-frontend/assets/pick-layers-pass-xhWsgZtf.js +2 -0
- tangram_core/dist-frontend/assets/pick-layers-pass-xhWsgZtf.js.map +1 -0
- tangram_core/dist-frontend/assets/project-CrvReKGW.js +760 -0
- tangram_core/dist-frontend/assets/project-CrvReKGW.js.map +1 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-400-italic-4qS3_zkX.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-400-italic-CDK-EZBY.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-400-normal-Bgns473E.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-400-normal-_T2aQlWs.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-500-normal-CvEVpWxD.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-500-normal-s4PklZE0.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-700-normal-9RN-Z7cI.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-700-normal-BGMkBBYx.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-ext-400-italic-C7erd-g8.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-ext-400-italic-DR5R5TWx.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-ext-400-normal-DGo1Ayjq.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-ext-400-normal-WtM1l1qc.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-ext-500-normal-C8FNIdXm.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-ext-500-normal-TLDmfi3Q.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-ext-700-normal-CTXjXnze.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-ext-700-normal-CWPRiRXS.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-greek-400-italic-CR6qj4Z4.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-greek-400-italic-DHRaIs10.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-greek-400-normal-D5vBSIyg.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-greek-400-normal-FabMgVmk.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-greek-500-normal-BIN62cw9.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-greek-500-normal-Hsn-wDIp.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-greek-700-normal-89Up2Xly.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-greek-700-normal-DWMOA2VK.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-400-italic-D_BR-3LG.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-400-italic-om57GXsO.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-400-normal-BICmKrXV.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-400-normal-D2e7XwB1.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-500-normal-3p2daRJW.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-500-normal-Dc9bsamC.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-700-normal-BOl6B_hI.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-700-normal-DRbp0YnP.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-ext-400-italic-BXrkWnoY.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-ext-400-italic-Bhem1d5z.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-ext-400-normal-DT8nEsYA.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-ext-400-normal-OHaX69iP.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-ext-500-normal-CcSTXKtO.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-ext-500-normal-JgPl2bDS.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-ext-700-normal-B004qtqu.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-ext-700-normal-O6H_RRvN.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-vietnamese-400-italic-BwUYFJ2t.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-vietnamese-400-italic-DV8QogUk.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-vietnamese-400-normal-0o1laQ-g.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-vietnamese-400-normal-CPsdS8_S.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-vietnamese-500-normal-G9shSJ2z.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-vietnamese-500-normal-TFWhjk13.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-vietnamese-700-normal-BtNeb9D6.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-vietnamese-700-normal-D35V1G0s.woff2 +0 -0
- tangram_core/dist-frontend/assets/shader-BJmsOfPx.js +843 -0
- tangram_core/dist-frontend/assets/shader-BJmsOfPx.js.map +1 -0
- tangram_core/dist-frontend/assets/solid-polygon-layer-DiarVGxh.js +392 -0
- tangram_core/dist-frontend/assets/solid-polygon-layer-DiarVGxh.js.map +1 -0
- tangram_core/dist-frontend/assets/tesselator-49Dw9L5A.js +2 -0
- tangram_core/dist-frontend/assets/tesselator-49Dw9L5A.js.map +1 -0
- tangram_core/dist-frontend/assets/webgl-developer-tools-CZl8qVFg.js +7 -0
- tangram_core/dist-frontend/assets/webgl-developer-tools-CZl8qVFg.js.map +1 -0
- tangram_core/dist-frontend/assets/webgl-device-BY0-CUP6.js +3 -0
- tangram_core/dist-frontend/assets/webgl-device-BY0-CUP6.js.map +1 -0
- tangram_core/dist-frontend/assets/widget-BbOeHGj0.js +2 -0
- tangram_core/dist-frontend/assets/widget-BbOeHGj0.js.map +1 -0
- tangram_core/dist-frontend/core.js +60 -0
- tangram_core/dist-frontend/core.js.map +1 -0
- tangram_core/dist-frontend/extensions.js +609 -0
- tangram_core/dist-frontend/extensions.js.map +1 -0
- tangram_core/dist-frontend/favicon.ico +0 -0
- tangram_core/dist-frontend/favicon.png +0 -0
- tangram_core/dist-frontend/font-awesome.min.css +4 -0
- tangram_core/dist-frontend/fonts/FontAwesome.otf +0 -0
- tangram_core/dist-frontend/fonts/fontawesome-webfont.eot +0 -0
- tangram_core/dist-frontend/fonts/fontawesome-webfont.svg +2671 -0
- tangram_core/dist-frontend/fonts/fontawesome-webfont.ttf +0 -0
- tangram_core/dist-frontend/fonts/fontawesome-webfont.woff +0 -0
- tangram_core/dist-frontend/fonts/fontawesome-webfont.woff2 +0 -0
- tangram_core/dist-frontend/geo-layers.js +115 -0
- tangram_core/dist-frontend/geo-layers.js.map +1 -0
- tangram_core/dist-frontend/index.html +38 -0
- tangram_core/dist-frontend/json.js +3 -0
- tangram_core/dist-frontend/json.js.map +1 -0
- tangram_core/dist-frontend/layers.js +268 -0
- tangram_core/dist-frontend/layers.js.map +1 -0
- tangram_core/dist-frontend/lit-html.js +7 -0
- tangram_core/dist-frontend/lit-html.js.map +1 -0
- tangram_core/dist-frontend/mapbox.js +2 -0
- tangram_core/dist-frontend/mapbox.js.map +1 -0
- tangram_core/dist-frontend/maplibre-gl.js +59 -0
- tangram_core/dist-frontend/maplibre-gl.js.map +1 -0
- tangram_core/dist-frontend/mesh-layers.js +2 -0
- tangram_core/dist-frontend/mesh-layers.js.map +1 -0
- tangram_core/dist-frontend/rs1090_wasm.js +813 -0
- tangram_core/dist-frontend/rs1090_wasm_bg.wasm +0 -0
- tangram_core/dist-frontend/vue.esm-browser.prod.js +13 -0
- tangram_core/dist-frontend/widgets.js +3 -0
- tangram_core/dist-frontend/widgets.js.map +1 -0
- tangram_core/main.ts +16 -0
- tangram_core/plugin.py +70 -0
- tangram_core/plugin.ts +41 -0
- tangram_core/redis.py +89 -0
- tangram_core/user.css +114 -0
- tangram_core/vite-plugin-tangram.mjs +88 -0
- tangram_core-0.2.0.dist-info/METADATA +37 -0
- tangram_core-0.2.0.dist-info/RECORD +171 -0
- tangram_core-0.2.0.dist-info/WHEEL +4 -0
- tangram_core-0.2.0.dist-info/entry_points.txt +2 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mesh-layers-BSECKarm.js","sources":["../../../../../../node_modules/.pnpm/@loaders.gl+loader-utils@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/loader-utils/dist/loader-types.js","../../../../../../node_modules/.pnpm/@loaders.gl+loader-utils@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/loader-utils/dist/lib/module-utils/js-module-utils.js","../../../../../../node_modules/.pnpm/@loaders.gl+worker-utils@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/worker-utils/dist/lib/library-utils/library-utils.js","../../../../../../node_modules/.pnpm/@loaders.gl+loader-utils@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/loader-utils/dist/lib/binary-utils/get-first-characters.js","../../../../../../node_modules/.pnpm/@loaders.gl+loader-utils@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/loader-utils/dist/lib/parser-utils/parse-json.js","../../../../../../node_modules/.pnpm/@loaders.gl+loader-utils@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/loader-utils/dist/lib/binary-utils/memory-copy-utils.js","../../../../../../node_modules/.pnpm/@loaders.gl+schema@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/schema/dist/lib/table/simple-table/data-type.js","../../../../../../node_modules/.pnpm/@loaders.gl+schema@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/schema/dist/lib/mesh/mesh-utils.js","../../../../../../node_modules/.pnpm/@loaders.gl+schema@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/schema/dist/lib/mesh/deduce-mesh-schema.js","../../../../../../node_modules/.pnpm/@loaders.gl+images@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/images/dist/lib/category-api/image-format.js","../../../../../../node_modules/.pnpm/@math.gl+core@4.1.0/node_modules/@math.gl/core/dist/classes/vector4.js","../../../../../../node_modules/.pnpm/@math.gl+core@4.1.0/node_modules/@math.gl/core/dist/gl-matrix/mat3.js","../../../../../../node_modules/.pnpm/@math.gl+core@4.1.0/node_modules/@math.gl/core/dist/classes/matrix3.js","../../../../../../node_modules/.pnpm/@math.gl+core@4.1.0/node_modules/@math.gl/core/dist/gl-matrix/quat.js","../../../../../../node_modules/.pnpm/@math.gl+core@4.1.0/node_modules/@math.gl/core/dist/classes/quaternion.js","../../../../../../node_modules/.pnpm/@luma.gl+shadertools@9.2.4_@luma.gl+core@9.2.4/node_modules/@luma.gl/shadertools/dist/modules/lighting/pbr-material/pbr-material-glsl.js","../../../../../../node_modules/.pnpm/@luma.gl+shadertools@9.2.4_@luma.gl+core@9.2.4/node_modules/@luma.gl/shadertools/dist/modules/lighting/pbr-material/pbr-material-wgsl.js","../../../../../../node_modules/.pnpm/@luma.gl+shadertools@9.2.4_@luma.gl+core@9.2.4/node_modules/@luma.gl/shadertools/dist/modules/lighting/pbr-material/pbr-projection.js","../../../../../../node_modules/.pnpm/@luma.gl+shadertools@9.2.4_@luma.gl+core@9.2.4/node_modules/@luma.gl/shadertools/dist/modules/lighting/pbr-material/pbr-material.js","../../../../../../node_modules/.pnpm/@luma.gl+engine@9.2.4_@luma.gl+core@9.2.4_@luma.gl+shadertools@9.2.4_@luma.gl+core@9.2.4_/node_modules/@luma.gl/engine/dist/scenegraph/scenegraph-node.js","../../../../../../node_modules/.pnpm/@luma.gl+engine@9.2.4_@luma.gl+core@9.2.4_@luma.gl+shadertools@9.2.4_@luma.gl+core@9.2.4_/node_modules/@luma.gl/engine/dist/scenegraph/group-node.js","../../../../../../node_modules/.pnpm/@luma.gl+engine@9.2.4_@luma.gl+core@9.2.4_@luma.gl+shadertools@9.2.4_@luma.gl+core@9.2.4_/node_modules/@luma.gl/engine/dist/scenegraph/model-node.js","../../../../../../node_modules/.pnpm/@deck.gl+mesh-layers@9.2.2_@deck.gl+core@9.2.2_@loaders.gl+core@4.3.4_@luma.gl+core@9.2_0ff936c4a97c04ca2c286d691dfddb68/node_modules/@deck.gl/mesh-layers/dist/utils/matrix.js","../../../../../../node_modules/.pnpm/@deck.gl+mesh-layers@9.2.2_@deck.gl+core@9.2.2_@loaders.gl+core@4.3.4_@luma.gl+core@9.2_0ff936c4a97c04ca2c286d691dfddb68/node_modules/@deck.gl/mesh-layers/dist/simple-mesh-layer/simple-mesh-layer-uniforms.js","../../../../../../node_modules/.pnpm/@deck.gl+mesh-layers@9.2.2_@deck.gl+core@9.2.2_@loaders.gl+core@4.3.4_@luma.gl+core@9.2_0ff936c4a97c04ca2c286d691dfddb68/node_modules/@deck.gl/mesh-layers/dist/simple-mesh-layer/simple-mesh-layer-vertex.glsl.js","../../../../../../node_modules/.pnpm/@deck.gl+mesh-layers@9.2.2_@deck.gl+core@9.2.2_@loaders.gl+core@4.3.4_@luma.gl+core@9.2_0ff936c4a97c04ca2c286d691dfddb68/node_modules/@deck.gl/mesh-layers/dist/simple-mesh-layer/simple-mesh-layer-fragment.glsl.js","../../../../../../node_modules/.pnpm/@deck.gl+mesh-layers@9.2.2_@deck.gl+core@9.2.2_@loaders.gl+core@4.3.4_@luma.gl+core@9.2_0ff936c4a97c04ca2c286d691dfddb68/node_modules/@deck.gl/mesh-layers/dist/simple-mesh-layer/simple-mesh-layer.js","../../../../../../node_modules/.pnpm/@loaders.gl+textures@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/textures/dist/lib/utils/version.js","../../../../../../node_modules/.pnpm/@loaders.gl+textures@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/textures/dist/lib/parsers/basis-module-loader.js","../../../../../../node_modules/.pnpm/@loaders.gl+textures@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/textures/dist/lib/gl-extensions.js","../../../../../../node_modules/.pnpm/@loaders.gl+textures@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/textures/dist/lib/utils/texture-formats.js","../../../../../../node_modules/.pnpm/@loaders.gl+textures@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/textures/dist/lib/parsers/parse-ktx.js","../../../../../../node_modules/.pnpm/@loaders.gl+textures@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/textures/dist/lib/parsers/parse-basis.js","../../../../../../node_modules/.pnpm/@loaders.gl+textures@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/textures/dist/basis-loader.js","../../../../../../node_modules/.pnpm/@luma.gl+gltf@9.2.4_@luma.gl+constants@9.2.4_@luma.gl+core@9.2.4_@luma.gl+engine@9.2.4__9b8012f70b84b144036e672059766688/node_modules/@luma.gl/gltf/dist/webgl-to-webgpu/convert-webgl-sampler.js","../../../../../../node_modules/.pnpm/@luma.gl+gltf@9.2.4_@luma.gl+constants@9.2.4_@luma.gl+core@9.2.4_@luma.gl+engine@9.2.4__9b8012f70b84b144036e672059766688/node_modules/@luma.gl/gltf/dist/parsers/parse-pbr-material.js","../../../../../../node_modules/.pnpm/@luma.gl+gltf@9.2.4_@luma.gl+constants@9.2.4_@luma.gl+core@9.2.4_@luma.gl+engine@9.2.4__9b8012f70b84b144036e672059766688/node_modules/@luma.gl/gltf/dist/webgl-to-webgpu/convert-webgl-topology.js","../../../../../../node_modules/.pnpm/@luma.gl+gltf@9.2.4_@luma.gl+constants@9.2.4_@luma.gl+core@9.2.4_@luma.gl+engine@9.2.4__9b8012f70b84b144036e672059766688/node_modules/@luma.gl/gltf/dist/gltf/create-gltf-model.js","../../../../../../node_modules/.pnpm/@luma.gl+gltf@9.2.4_@luma.gl+constants@9.2.4_@luma.gl+core@9.2.4_@luma.gl+engine@9.2.4__9b8012f70b84b144036e672059766688/node_modules/@luma.gl/gltf/dist/parsers/parse-gltf.js","../../../../../../node_modules/.pnpm/@luma.gl+gltf@9.2.4_@luma.gl+constants@9.2.4_@luma.gl+core@9.2.4_@luma.gl+engine@9.2.4__9b8012f70b84b144036e672059766688/node_modules/@luma.gl/gltf/dist/gltf/animations/interpolate.js","../../../../../../node_modules/.pnpm/@luma.gl+gltf@9.2.4_@luma.gl+constants@9.2.4_@luma.gl+core@9.2.4_@luma.gl+engine@9.2.4__9b8012f70b84b144036e672059766688/node_modules/@luma.gl/gltf/dist/gltf/gltf-animator.js","../../../../../../node_modules/.pnpm/@luma.gl+gltf@9.2.4_@luma.gl+constants@9.2.4_@luma.gl+core@9.2.4_@luma.gl+engine@9.2.4__9b8012f70b84b144036e672059766688/node_modules/@luma.gl/gltf/dist/webgl-to-webgpu/convert-webgl-attribute.js","../../../../../../node_modules/.pnpm/@luma.gl+gltf@9.2.4_@luma.gl+constants@9.2.4_@luma.gl+core@9.2.4_@luma.gl+engine@9.2.4__9b8012f70b84b144036e672059766688/node_modules/@luma.gl/gltf/dist/parsers/parse-gltf-animations.js","../../../../../../node_modules/.pnpm/@luma.gl+gltf@9.2.4_@luma.gl+constants@9.2.4_@luma.gl+core@9.2.4_@luma.gl+engine@9.2.4__9b8012f70b84b144036e672059766688/node_modules/@luma.gl/gltf/dist/utils/deep-copy.js","../../../../../../node_modules/.pnpm/@luma.gl+gltf@9.2.4_@luma.gl+constants@9.2.4_@luma.gl+core@9.2.4_@luma.gl+engine@9.2.4__9b8012f70b84b144036e672059766688/node_modules/@luma.gl/gltf/dist/gltf/create-scenegraph-from-gltf.js","../../../../../../node_modules/.pnpm/@loaders.gl+gltf@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/gltf/dist/lib/utils/assert.js","../../../../../../node_modules/.pnpm/@loaders.gl+gltf@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/gltf/dist/lib/gltf-utils/gltf-constants.js","../../../../../../node_modules/.pnpm/@loaders.gl+gltf@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/gltf/dist/lib/gltf-utils/gltf-utils.js","../../../../../../node_modules/.pnpm/@loaders.gl+gltf@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/gltf/dist/lib/gltf-utils/get-typed-array.js","../../../../../../node_modules/.pnpm/@loaders.gl+gltf@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/gltf/dist/lib/api/gltf-scenegraph.js","../../../../../../node_modules/.pnpm/@loaders.gl+gltf@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/gltf/dist/lib/extensions/utils/3d-tiles-utils.js","../../../../../../node_modules/.pnpm/@loaders.gl+gltf@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/gltf/dist/lib/extensions/EXT_mesh_features.js","../../../../../../node_modules/.pnpm/@loaders.gl+gltf@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/gltf/dist/lib/extensions/EXT_structural_metadata.js","../../../../../../node_modules/.pnpm/@loaders.gl+gltf@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/gltf/dist/lib/extensions/deprecated/EXT_feature_metadata.js","../../../../../../node_modules/.pnpm/@loaders.gl+gltf@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/gltf/dist/lib/utils/version.js","../../../../../../node_modules/.pnpm/@loaders.gl+gltf@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/gltf/dist/lib/parsers/parse-glb.js","../../../../../../node_modules/.pnpm/@loaders.gl+gltf@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/gltf/dist/lib/gltf-utils/resolve-url.js","../../../../../../node_modules/.pnpm/@loaders.gl+gltf@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/gltf/dist/meshopt/meshopt-decoder.js","../../../../../../node_modules/.pnpm/@loaders.gl+gltf@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/gltf/dist/lib/extensions/EXT_meshopt_compression.js","../../../../../../node_modules/.pnpm/@loaders.gl+gltf@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/gltf/dist/lib/extensions/EXT_texture_webp.js","../../../../../../node_modules/.pnpm/@loaders.gl+gltf@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/gltf/dist/lib/extensions/KHR_texture_basisu.js","../../../../../../node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/lib/utils/version.js","../../../../../../node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/draco-loader.js","../../../../../../node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/lib/utils/get-draco-schema.js","../../../../../../node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/lib/draco-parser.js","../../../../../../node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/lib/draco-module-loader.js","../../../../../../node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/index.js","../../../../../../node_modules/.pnpm/@loaders.gl+gltf@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/gltf/dist/lib/gltf-utils/gltf-attribute-utils.js","../../../../../../node_modules/.pnpm/@loaders.gl+gltf@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/gltf/dist/lib/extensions/KHR_draco_mesh_compression.js","../../../../../../node_modules/.pnpm/@loaders.gl+gltf@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/gltf/dist/lib/extensions/KHR_texture_transform.js","../../../../../../node_modules/.pnpm/@loaders.gl+gltf@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/gltf/dist/lib/extensions/deprecated/KHR_lights_punctual.js","../../../../../../node_modules/.pnpm/@loaders.gl+gltf@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/gltf/dist/lib/extensions/deprecated/KHR_materials_unlit.js","../../../../../../node_modules/.pnpm/@loaders.gl+gltf@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/gltf/dist/lib/extensions/deprecated/KHR_techniques_webgl.js","../../../../../../node_modules/.pnpm/@loaders.gl+gltf@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/gltf/dist/lib/api/gltf-extensions.js","../../../../../../node_modules/.pnpm/@loaders.gl+gltf@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/gltf/dist/lib/extensions/KHR_binary_gltf.js","../../../../../../node_modules/.pnpm/@loaders.gl+gltf@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/gltf/dist/lib/api/normalize-gltf-v1.js","../../../../../../node_modules/.pnpm/@loaders.gl+gltf@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/gltf/dist/lib/parsers/parse-gltf.js","../../../../../../node_modules/.pnpm/@loaders.gl+gltf@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/gltf/dist/gltf-loader.js","../../../../../../node_modules/.pnpm/@loaders.gl+gltf@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/gltf/dist/lib/api/post-process-gltf.js","../../../../../../node_modules/.pnpm/@deck.gl+mesh-layers@9.2.2_@deck.gl+core@9.2.2_@loaders.gl+core@4.3.4_@luma.gl+core@9.2_0ff936c4a97c04ca2c286d691dfddb68/node_modules/@deck.gl/mesh-layers/dist/scenegraph-layer/gltf-utils.js","../../../../../../node_modules/.pnpm/@deck.gl+mesh-layers@9.2.2_@deck.gl+core@9.2.2_@loaders.gl+core@4.3.4_@luma.gl+core@9.2_0ff936c4a97c04ca2c286d691dfddb68/node_modules/@deck.gl/mesh-layers/dist/scenegraph-layer/scenegraph-layer-uniforms.js","../../../../../../node_modules/.pnpm/@deck.gl+mesh-layers@9.2.2_@deck.gl+core@9.2.2_@loaders.gl+core@4.3.4_@luma.gl+core@9.2_0ff936c4a97c04ca2c286d691dfddb68/node_modules/@deck.gl/mesh-layers/dist/scenegraph-layer/scenegraph-layer-vertex.glsl.js","../../../../../../node_modules/.pnpm/@deck.gl+mesh-layers@9.2.2_@deck.gl+core@9.2.2_@loaders.gl+core@4.3.4_@luma.gl+core@9.2_0ff936c4a97c04ca2c286d691dfddb68/node_modules/@deck.gl/mesh-layers/dist/scenegraph-layer/scenegraph-layer-fragment.glsl.js","../../../../../../node_modules/.pnpm/@deck.gl+mesh-layers@9.2.2_@deck.gl+core@9.2.2_@loaders.gl+core@4.3.4_@luma.gl+core@9.2_0ff936c4a97c04ca2c286d691dfddb68/node_modules/@deck.gl/mesh-layers/dist/scenegraph-layer/scenegraph-layer.js"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/**\n * Parses `data` using a specified loader\n * @param data\n * @param loaders\n * @param options\n * @param context\n */\n// implementation signature\nexport async function parseFromContext(data, loaders, options, context) {\n return context._parse(data, loaders, options, context);\n}\n/**\n * Parses `data` synchronously using the specified loader, parse function provided via the loader context\n */\nexport function parseSyncFromContext(data, loader, options, context) {\n if (!context._parseSync) {\n throw new Error('parseSync');\n }\n return context._parseSync(data, loader, options, context);\n}\n/**\n * Parses `data` synchronously using a specified loader, parse function provided via the loader context\n */\nexport async function parseInBatchesFromContext(data, loader, options, context) {\n if (!context._parseInBatches) {\n throw new Error('parseInBatches');\n }\n return context._parseInBatches(data, loader, options, context);\n}\n","// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { log } from \"../log-utils/log.js\";\n/**\n * Register application-imported modules\n * These modules are typically to big to bundle, or may have issues on some bundlers/environments\n */\nexport function registerJSModules(modules) {\n globalThis.loaders ||= {};\n globalThis.loaders.modules ||= {};\n Object.assign(globalThis.loaders.modules, modules);\n}\n/**\n * Get a pre-registered application-imported module, warn if not present\n */\nexport function checkJSModule(name, caller) {\n const module = globalThis.loaders?.modules?.[name];\n if (!module) {\n log.warn(`${caller}: ${name} library not installed`)();\n }\n}\n/**\n * Get a pre-registered application-imported module, throw if not present\n */\nexport function getJSModule(name, caller) {\n const module = globalThis.loaders?.modules?.[name];\n if (!module) {\n throw new Error(`${caller}: ${name} library not installed`);\n }\n return module;\n}\n/**\n * Get a pre-registered application-imported module, return null if not present\n */\nexport function getJSModuleOrNull(name) {\n const module = globalThis.loaders?.modules?.[name];\n return module || null;\n}\n","// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/* global importScripts */\nimport { isBrowser, isWorker } from \"../env-utils/globals.js\";\nimport { assert } from \"../env-utils/assert.js\";\nimport { VERSION } from \"../env-utils/version.js\";\nconst loadLibraryPromises = {}; // promises\n/**\n * Dynamically loads a library (\"module\")\n *\n * - wasm library: Array buffer is returned\n * - js library: Parse JS is returned\n *\n * Method depends on environment\n * - browser - script element is created and installed on document\n * - worker - eval is called on global context\n * - node - file is required\n *\n * @param libraryUrl\n * @param moduleName\n * @param options\n */\nexport async function loadLibrary(libraryUrl, moduleName = null, options = {}, libraryName = null) {\n if (moduleName) {\n libraryUrl = getLibraryUrl(libraryUrl, moduleName, options, libraryName);\n }\n // Ensure libraries are only loaded once\n loadLibraryPromises[libraryUrl] =\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n loadLibraryPromises[libraryUrl] || loadLibraryFromFile(libraryUrl);\n return await loadLibraryPromises[libraryUrl];\n}\n// TODO - sort out how to resolve paths for main/worker and dev/prod\nexport function getLibraryUrl(library, moduleName, options = {}, libraryName = null) {\n // Check if already a URL\n if (!options.useLocalLibraries && library.startsWith('http')) {\n return library;\n }\n libraryName = libraryName || library;\n // Allow application to import and supply libraries through `options.modules`\n // TODO - See js-module-utils in loader-utils\n const modules = options.modules || {};\n if (modules[libraryName]) {\n return modules[libraryName];\n }\n // Load from local files, not from CDN scripts in Node.js\n // TODO - needs to locate the modules directory when installed!\n if (!isBrowser) {\n return `modules/${moduleName}/dist/libs/${libraryName}`;\n }\n // In browser, load from external scripts\n if (options.CDN) {\n assert(options.CDN.startsWith('http'));\n return `${options.CDN}/${moduleName}@${VERSION}/dist/libs/${libraryName}`;\n }\n // TODO - loading inside workers requires paths relative to worker script location...\n if (isWorker) {\n return `../src/libs/${libraryName}`;\n }\n return `modules/${moduleName}/src/libs/${libraryName}`;\n}\nasync function loadLibraryFromFile(libraryUrl) {\n if (libraryUrl.endsWith('wasm')) {\n return await loadAsArrayBuffer(libraryUrl);\n }\n if (!isBrowser) {\n // TODO - Node doesn't yet support dynamic import from https URLs\n // try {\n // return await import(libraryUrl);\n // } catch (error) {\n // console.error(error);\n // }\n try {\n const { requireFromFile } = globalThis.loaders || {};\n return await requireFromFile?.(libraryUrl);\n }\n catch (error) {\n console.error(error); // eslint-disable-line no-console\n return null;\n }\n }\n if (isWorker) {\n return importScripts(libraryUrl);\n }\n // TODO - fix - should be more secure than string parsing since observes CORS\n // if (isBrowser) {\n // return await loadScriptFromFile(libraryUrl);\n // }\n const scriptSource = await loadAsText(libraryUrl);\n return loadLibraryFromString(scriptSource, libraryUrl);\n}\n/*\nasync function loadScriptFromFile(libraryUrl) {\n const script = document.createElement('script');\n script.src = libraryUrl;\n return await new Promise((resolve, reject) => {\n script.onload = data => {\n resolve(data);\n };\n script.onerror = reject;\n });\n}\n*/\n// TODO - Needs security audit...\n// - Raw eval call\n// - Potentially bypasses CORS\n// Upside is that this separates fetching and parsing\n// we could create a`LibraryLoader` or`ModuleLoader`\nfunction loadLibraryFromString(scriptSource, id) {\n if (!isBrowser) {\n const { requireFromString } = globalThis.loaders || {};\n return requireFromString?.(scriptSource, id);\n }\n if (isWorker) {\n // Use lvalue trick to make eval run in global scope\n eval.call(globalThis, scriptSource); // eslint-disable-line no-eval\n // https://stackoverflow.com/questions/9107240/1-evalthis-vs-evalthis-in-javascript\n // http://perfectionkills.com/global-eval-what-are-the-options/\n return null;\n }\n const script = document.createElement('script');\n script.id = id;\n // most browsers like a separate text node but some throw an error. The second method covers those.\n try {\n script.appendChild(document.createTextNode(scriptSource));\n }\n catch (e) {\n script.text = scriptSource;\n }\n document.body.appendChild(script);\n return null;\n}\n// TODO - technique for module injection into worker, from THREE.DracoLoader...\n/*\nfunction combineWorkerWithLibrary(worker, jsContent) {\n var fn = wWorker.toString();\n var body = [\n '// injected',\n jsContent,\n '',\n '// worker',\n fn.substring(fn.indexOf('{') + 1, fn.lastIndexOf('}'))\n ].join('\\n');\n this.workerSourceURL = URL.createObjectURL(new Blob([body]));\n}\n*/\nasync function loadAsArrayBuffer(url) {\n const { readFileAsArrayBuffer } = globalThis.loaders || {};\n if (isBrowser || !readFileAsArrayBuffer || url.startsWith('http')) {\n const response = await fetch(url);\n return await response.arrayBuffer();\n }\n return await readFileAsArrayBuffer(url);\n}\n/**\n * Load a file from local file system\n * @param filename\n * @returns\n */\nasync function loadAsText(url) {\n const { readFileAsText } = globalThis.loaders || {};\n if (isBrowser || !readFileAsText || url.startsWith('http')) {\n const response = await fetch(url);\n return await response.text();\n }\n return await readFileAsText(url);\n}\n","// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/**\n * Get the first characters from a binary file (interpret the first bytes as an ASCII string)\n * @param data\n * @param length\n * @returns\n */\nexport function getFirstCharacters(data, length = 5) {\n if (typeof data === 'string') {\n return data.slice(0, length);\n }\n else if (ArrayBuffer.isView(data)) {\n // Typed Arrays can have offsets into underlying buffer\n return getMagicString(data.buffer, data.byteOffset, length);\n }\n else if (data instanceof ArrayBuffer) {\n const byteOffset = 0;\n return getMagicString(data, byteOffset, length);\n }\n return '';\n}\n/**\n * Gets a magic string from a \"file\"\n * Typically used to check or detect file format\n * @param arrayBuffer\n * @param byteOffset\n * @param length\n * @returns\n */\nexport function getMagicString(arrayBuffer, byteOffset, length) {\n if (arrayBuffer.byteLength <= byteOffset + length) {\n return '';\n }\n const dataView = new DataView(arrayBuffer);\n let magic = '';\n for (let i = 0; i < length; i++) {\n magic += String.fromCharCode(dataView.getUint8(byteOffset + i));\n }\n return magic;\n}\n","import { getFirstCharacters } from \"../binary-utils/get-first-characters.js\";\n/**\n * Minimal JSON parser that throws more meaningful error messages\n */\nexport function parseJSON(string) {\n try {\n return JSON.parse(string);\n }\n catch (_) {\n throw new Error(`Failed to parse JSON from data starting with \"${getFirstCharacters(string)}\"`);\n }\n}\n","import { assert } from \"../env-utils/assert.js\";\n/**\n * Calculate new size of an arrayBuffer to be aligned to an n-byte boundary\n * This function increases `byteLength` by the minimum delta,\n * allowing the total length to be divided by `padding`\n * @param byteLength\n * @param padding\n */\nexport function padToNBytes(byteLength, padding) {\n assert(byteLength >= 0); // `Incorrect 'byteLength' value: ${byteLength}`\n assert(padding > 0); // `Incorrect 'padding' value: ${padding}`\n return (byteLength + (padding - 1)) & ~(padding - 1);\n}\n/**\n * Creates a new Uint8Array based on two different ArrayBuffers\n * @param targetBuffer The first buffer.\n * @param sourceBuffer The second buffer.\n * @return The new ArrayBuffer created out of the two.\n */\nexport function copyArrayBuffer(targetBuffer, sourceBuffer, byteOffset, byteLength = sourceBuffer.byteLength) {\n const targetArray = new Uint8Array(targetBuffer, byteOffset, byteLength);\n const sourceArray = new Uint8Array(sourceBuffer);\n targetArray.set(sourceArray);\n return targetBuffer;\n}\n/**\n * Copy from source to target at the targetOffset\n *\n * @param source - The data to copy\n * @param target - The destination to copy data into\n * @param targetOffset - The start offset into target to place the copied data\n * @returns the new offset taking into account proper padding\n */\nexport function copyToArray(source, target, targetOffset) {\n let sourceArray;\n if (source instanceof ArrayBuffer) {\n sourceArray = new Uint8Array(source);\n }\n else {\n // Pack buffer onto the big target array\n //\n // 'source.data.buffer' could be a view onto a larger buffer.\n // We MUST use this constructor to ensure the byteOffset and byteLength is\n // set to correct values from 'source.data' and not the underlying\n // buffer for target.set() to work properly.\n const srcByteOffset = source.byteOffset;\n const srcByteLength = source.byteLength;\n // In gltf parser it is set as \"arrayBuffer\" instead of \"buffer\"\n // https://github.com/visgl/loaders.gl/blob/1e3a82a0a65d7b6a67b1e60633453e5edda2960a/modules/gltf/src/lib/parse-gltf.js#L85\n sourceArray = new Uint8Array(source.buffer || source.arrayBuffer, srcByteOffset, srcByteLength);\n }\n // Pack buffer onto the big target array\n target.set(sourceArray, targetOffset);\n return targetOffset + padToNBytes(sourceArray.byteLength, 4);\n}\n","// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/** Deduce column types from values */\nexport function getDataTypeFromValue(value, defaultNumberType = 'float32') {\n if (value instanceof Date) {\n return 'date-millisecond';\n }\n if (value instanceof Number) {\n return defaultNumberType;\n }\n if (typeof value === 'string') {\n return 'utf8';\n }\n if (value === null || value === 'undefined') {\n return 'null';\n }\n return 'null';\n}\n/**\n * Deduces a simple data type \"descriptor from a typed array instance\n */\nexport function getDataTypeFromArray(array) {\n let type = getDataTypeFromTypedArray(array);\n if (type !== 'null') {\n return { type, nullable: false };\n }\n if (array.length > 0) {\n type = getDataTypeFromValue(array[0]);\n return { type, nullable: true };\n }\n return { type: 'null', nullable: true };\n}\n/**\n * Deduces a simple data type \"descriptor from a typed array instance\n */\nexport function getDataTypeFromTypedArray(array) {\n switch (array.constructor) {\n case Int8Array:\n return 'int8';\n case Uint8Array:\n case Uint8ClampedArray:\n return 'uint8';\n case Int16Array:\n return 'int16';\n case Uint16Array:\n return 'uint16';\n case Int32Array:\n return 'int32';\n case Uint32Array:\n return 'uint32';\n case Float32Array:\n return 'float32';\n case Float64Array:\n return 'float64';\n default:\n return 'null';\n }\n}\nexport function getArrayTypeFromDataType(type, nullable) {\n if (!nullable) {\n switch (type) {\n case 'int8':\n return Int8Array;\n case 'uint8':\n return Uint8Array;\n case 'int16':\n return Int16Array;\n case 'uint16':\n return Uint16Array;\n case 'int32':\n return Int32Array;\n case 'uint32':\n return Uint32Array;\n case 'float32':\n return Float32Array;\n case 'float64':\n return Float64Array;\n default:\n break;\n }\n }\n // if (typeof BigInt64Array !== 'undefined') {\n // TYPED_ARRAY_TO_TYPE.BigInt64Array = new Int64();\n // TYPED_ARRAY_TO_TYPE.BigUint64Array = new Uint64();\n // }\n return Array;\n}\n","/**\n * Get number of vertices in mesh\n * @param attributes\n */\nexport function getMeshSize(attributes) {\n let size = 0;\n for (const attributeName in attributes) {\n const attribute = attributes[attributeName];\n if (ArrayBuffer.isView(attribute)) {\n // @ts-ignore DataView doesn't have BYTES_PER_ELEMENT\n size += attribute.byteLength * attribute.BYTES_PER_ELEMENT;\n }\n }\n return size;\n}\n/**\n * Get the (axis aligned) bounding box of a mesh\n * @param attributes\n * @returns array of two vectors representing the axis aligned bounding box\n */\n// eslint-disable-next-line complexity\nexport function getMeshBoundingBox(attributes) {\n let minX = Infinity;\n let minY = Infinity;\n let minZ = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n let maxZ = -Infinity;\n const positions = attributes.POSITION ? attributes.POSITION.value : [];\n const len = positions && positions.length;\n for (let i = 0; i < len; i += 3) {\n const x = positions[i];\n const y = positions[i + 1];\n const z = positions[i + 2];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n minZ = z < minZ ? z : minZ;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n maxZ = z > maxZ ? z : maxZ;\n }\n return [\n [minX, minY, minZ],\n [maxX, maxY, maxZ]\n ];\n}\n","// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { getDataTypeFromTypedArray } from \"../table/simple-table/data-type.js\";\n/**\n * Create a schema for mesh attributes data\n * @param attributes\n * @param metadata\n * @returns\n */\nexport function deduceMeshSchema(attributes, metadata = {}) {\n const fields = deduceMeshFields(attributes);\n return { fields, metadata };\n}\n/**\n * Create arrow-like schema field for mesh attribute\n * @param attributeName\n * @param attribute\n * @param optionalMetadata\n * @returns\n */\nexport function deduceMeshField(name, attribute, optionalMetadata) {\n const type = getDataTypeFromTypedArray(attribute.value);\n const metadata = optionalMetadata ? optionalMetadata : makeMeshAttributeMetadata(attribute);\n return {\n name,\n type: { type: 'fixed-size-list', listSize: attribute.size, children: [{ name: 'value', type }] },\n nullable: false,\n metadata\n };\n}\n/**\n * Create fields array for mesh attributes\n * @param attributes\n * @returns\n */\nfunction deduceMeshFields(attributes) {\n const fields = [];\n for (const attributeName in attributes) {\n const attribute = attributes[attributeName];\n fields.push(deduceMeshField(attributeName, attribute));\n }\n return fields;\n}\n/**\n * Make metadata by mesh attribute properties\n * @param attribute\n * @returns\n */\nexport function makeMeshAttributeMetadata(attribute) {\n const result = {};\n if ('byteOffset' in attribute) {\n result.byteOffset = attribute.byteOffset.toString(10);\n }\n if ('byteStride' in attribute) {\n result.byteStride = attribute.byteStride.toString(10);\n }\n if ('normalized' in attribute) {\n result.normalized = attribute.normalized.toString();\n }\n return result;\n}\n","// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { isBrowser } from '@loaders.gl/loader-utils';\nconst MIME_TYPES = [\n 'image/png',\n 'image/jpeg',\n 'image/gif',\n 'image/webp',\n 'image/avif',\n 'image/tiff',\n // TODO - what is the correct type for SVG\n 'image/svg',\n 'image/svg+xml',\n 'image/bmp',\n 'image/vnd.microsoft.icon'\n];\n/** Only one round of tests is performed */\nconst mimeTypeSupportedPromise = null;\n/** Run-time browser detection of file formats requires async tests for most precise results */\nexport async function getSupportedImageFormats() {\n if (mimeTypeSupportedPromise) {\n return await mimeTypeSupportedPromise;\n }\n const supportedMimeTypes = new Set();\n for (const mimeType of MIME_TYPES) {\n const supported = isBrowser\n ? await checkBrowserImageFormatSupportAsync(mimeType)\n : checkNodeImageFormatSupport(mimeType);\n if (supported) {\n supportedMimeTypes.add(mimeType);\n }\n }\n return supportedMimeTypes;\n}\n/** Cache sync values for speed */\nconst mimeTypeSupportedSync = {};\n/**\n * Check if image MIME type is supported. Result is cached to avoid repeated tests.\n */\nexport function isImageFormatSupported(mimeType) {\n if (mimeTypeSupportedSync[mimeType] === undefined) {\n const supported = isBrowser\n ? checkBrowserImageFormatSupport(mimeType)\n : checkNodeImageFormatSupport(mimeType);\n mimeTypeSupportedSync[mimeType] = supported;\n }\n return mimeTypeSupportedSync[mimeType];\n}\n/**\n * Checks that polyfills are installed and that mimeType is supported by polyfills\n * @todo Ideally polyfills should declare what formats they support, instead of storing that data here.\n */\nfunction checkNodeImageFormatSupport(mimeType) {\n const NODE_FORMAT_SUPPORT = ['image/png', 'image/jpeg', 'image/gif'];\n const imageFormatsNode = globalThis.loaders?.imageFormatsNode || NODE_FORMAT_SUPPORT;\n const parseImageNode = globalThis.loaders?.parseImageNode;\n return Boolean(parseImageNode) && imageFormatsNode.includes(mimeType);\n}\n/** Checks image format support synchronously.\n * @note Unreliable, fails on AVIF\n */\nfunction checkBrowserImageFormatSupport(mimeType) {\n switch (mimeType) {\n case 'image/avif': // Will fail\n case 'image/webp':\n return testBrowserImageFormatSupport(mimeType);\n default:\n return true;\n }\n}\nconst TEST_IMAGE = {\n 'image/avif': 'data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=',\n // Lossy test image. Support for lossy images doesn't guarantee support for all WebP images.\n 'image/webp': 'data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA'\n};\n/** Checks WebP and AVIF support asynchronously */\nasync function checkBrowserImageFormatSupportAsync(mimeType) {\n const dataURL = TEST_IMAGE[mimeType];\n return dataURL ? await testBrowserImageFormatSupportAsync(dataURL) : true;\n}\n/**\n * Checks browser synchronously\n * Checks if toDataURL supports the mimeType.\n * @note Imperfect testOn Chrome this is true for WebP but not for AVIF\n */\nfunction testBrowserImageFormatSupport(mimeType) {\n try {\n const element = document.createElement('canvas');\n const dataURL = element.toDataURL(mimeType);\n return dataURL.indexOf(`data:${mimeType}`) === 0;\n }\n catch {\n // Probably Safari...\n return false;\n }\n}\n// Check WebPSupport asynchronously\nasync function testBrowserImageFormatSupportAsync(testImageDataURL) {\n return new Promise((resolve) => {\n const image = new Image();\n image.src = testImageDataURL;\n image.onload = () => resolve(image.height > 0);\n image.onerror = () => resolve(false);\n });\n}\n","// math.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Copyright (c) 2017 Uber Technologies, Inc.\n/* eslint-disable camelcase */\nimport { transformMat4 as vec4_transformMat4, transformQuat as vec4_transformQuat } from \"../gl-matrix/vec3.js\";\nimport { vec4_transformMat2, vec4_transformMat3 } from \"../lib/gl-matrix-extras.js\";\nimport { Vector } from \"./base/vector.js\";\nimport { config, isArray } from \"../lib/common.js\";\nimport { checkNumber } from \"../lib/validators.js\";\nlet ZERO;\n/**\n * Four-element vector class with common linear algebra operations.\n * Subclass of Array<number> meaning that it is highly compatible with other libraries\n */\nexport class Vector4 extends Vector {\n static get ZERO() {\n if (!ZERO) {\n ZERO = new Vector4(0, 0, 0, 0);\n Object.freeze(ZERO);\n }\n return ZERO;\n }\n constructor(x = 0, y = 0, z = 0, w = 0) {\n // PERF NOTE: initialize elements as double precision numbers\n super(-0, -0, -0, -0);\n if (isArray(x) && arguments.length === 1) {\n this.copy(x);\n }\n else {\n // this.set(x, y, z, w);\n if (config.debug) {\n checkNumber(x);\n checkNumber(y);\n checkNumber(z);\n checkNumber(w);\n }\n this[0] = x;\n this[1] = y;\n this[2] = z;\n this[3] = w;\n }\n }\n set(x, y, z, w) {\n this[0] = x;\n this[1] = y;\n this[2] = z;\n this[3] = w;\n return this.check();\n }\n copy(array) {\n this[0] = array[0];\n this[1] = array[1];\n this[2] = array[2];\n this[3] = array[3];\n return this.check();\n }\n fromObject(object) {\n if (config.debug) {\n checkNumber(object.x);\n checkNumber(object.y);\n checkNumber(object.z);\n checkNumber(object.w);\n }\n this[0] = object.x;\n this[1] = object.y;\n this[2] = object.z;\n this[3] = object.w;\n return this;\n }\n toObject(object) {\n object.x = this[0];\n object.y = this[1];\n object.z = this[2];\n object.w = this[3];\n return object;\n }\n // Getters/setters\n /* eslint-disable no-multi-spaces, brace-style, no-return-assign */\n get ELEMENTS() {\n return 4;\n }\n get z() {\n return this[2];\n }\n set z(value) {\n this[2] = checkNumber(value);\n }\n get w() {\n return this[3];\n }\n set w(value) {\n this[3] = checkNumber(value);\n }\n transform(matrix4) {\n vec4_transformMat4(this, this, matrix4);\n return this.check();\n }\n transformByMatrix3(matrix3) {\n vec4_transformMat3(this, this, matrix3);\n return this.check();\n }\n transformByMatrix2(matrix2) {\n vec4_transformMat2(this, this, matrix2);\n return this.check();\n }\n transformByQuaternion(quaternion) {\n vec4_transformQuat(this, this, quaternion);\n return this.check();\n }\n // three.js compatibility\n applyMatrix4(m) {\n m.transform(this, this);\n return this;\n }\n}\n//# sourceMappingURL=vector4.js.map","import * as glMatrix from './common.js';\n/**\n * 3x3 Matrix\n * @module mat3\n */\n/**\n * Creates a new identity mat3\n *\n * @returns {mat3} a new 3x3 matrix\n */\nexport function create() {\n const out = new glMatrix.ARRAY_TYPE(9);\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n }\n out[0] = 1;\n out[4] = 1;\n out[8] = 1;\n return out;\n}\n/**\n * Copies the upper-left 3x3 values into the given mat3.\n *\n * @param {mat3} out the receiving 3x3 matrix\n * @param {ReadonlyMat4} a the source 4x4 matrix\n * @returns {mat3} out\n */\nexport function fromMat4(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[4];\n out[4] = a[5];\n out[5] = a[6];\n out[6] = a[8];\n out[7] = a[9];\n out[8] = a[10];\n return out;\n}\n/**\n * Creates a new mat3 initialized with values from an existing matrix\n *\n * @param {ReadonlyMat3} a matrix to clone\n * @returns {mat3} a new 3x3 matrix\n */\nexport function clone(a) {\n const out = new glMatrix.ARRAY_TYPE(9);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n}\n/**\n * Copy the values from one mat3 to another\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the source matrix\n * @returns {mat3} out\n */\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n}\n/**\n * Create a new mat3 with the given values\n *\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\n * @param {Number} m10 Component in column 1, row 0 position (index 3)\n * @param {Number} m11 Component in column 1, row 1 position (index 4)\n * @param {Number} m12 Component in column 1, row 2 position (index 5)\n * @param {Number} m20 Component in column 2, row 0 position (index 6)\n * @param {Number} m21 Component in column 2, row 1 position (index 7)\n * @param {Number} m22 Component in column 2, row 2 position (index 8)\n * @returns {mat3} A new mat3\n */\nexport function fromValues(m00, m01, m02, m10, m11, m12, m20, m21, m22) {\n const out = new glMatrix.ARRAY_TYPE(9);\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m10;\n out[4] = m11;\n out[5] = m12;\n out[6] = m20;\n out[7] = m21;\n out[8] = m22;\n return out;\n}\n/**\n * Set the components of a mat3 to the given values\n *\n * @param {mat3} out the receiving matrix\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\n * @param {Number} m10 Component in column 1, row 0 position (index 3)\n * @param {Number} m11 Component in column 1, row 1 position (index 4)\n * @param {Number} m12 Component in column 1, row 2 position (index 5)\n * @param {Number} m20 Component in column 2, row 0 position (index 6)\n * @param {Number} m21 Component in column 2, row 1 position (index 7)\n * @param {Number} m22 Component in column 2, row 2 position (index 8)\n * @returns {mat3} out\n */\nexport function set(out, m00, m01, m02, m10, m11, m12, m20, m21, m22) {\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m10;\n out[4] = m11;\n out[5] = m12;\n out[6] = m20;\n out[7] = m21;\n out[8] = m22;\n return out;\n}\n/**\n * Set a mat3 to the identity matrix\n *\n * @param {mat3} out the receiving matrix\n * @returns {mat3} out\n */\nexport function identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n/**\n * Transpose the values of a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the source matrix\n * @returns {mat3} out\n */\nexport function transpose(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n const a01 = a[1];\n const a02 = a[2];\n const a12 = a[5];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a01;\n out[5] = a[7];\n out[6] = a02;\n out[7] = a12;\n }\n else {\n out[0] = a[0];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a[1];\n out[4] = a[4];\n out[5] = a[7];\n out[6] = a[2];\n out[7] = a[5];\n out[8] = a[8];\n }\n return out;\n}\n/**\n * Inverts a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the source matrix\n * @returns {mat3} out\n */\nexport function invert(out, a) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[3];\n const a11 = a[4];\n const a12 = a[5];\n const a20 = a[6];\n const a21 = a[7];\n const a22 = a[8];\n const b01 = a22 * a11 - a12 * a21;\n const b11 = -a22 * a10 + a12 * a20;\n const b21 = a21 * a10 - a11 * a20;\n // Calculate the determinant\n let det = a00 * b01 + a01 * b11 + a02 * b21;\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n out[0] = b01 * det;\n out[1] = (-a22 * a01 + a02 * a21) * det;\n out[2] = (a12 * a01 - a02 * a11) * det;\n out[3] = b11 * det;\n out[4] = (a22 * a00 - a02 * a20) * det;\n out[5] = (-a12 * a00 + a02 * a10) * det;\n out[6] = b21 * det;\n out[7] = (-a21 * a00 + a01 * a20) * det;\n out[8] = (a11 * a00 - a01 * a10) * det;\n return out;\n}\n/**\n * Calculates the adjugate of a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the source matrix\n * @returns {mat3} out\n */\nexport function adjoint(out, a) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[3];\n const a11 = a[4];\n const a12 = a[5];\n const a20 = a[6];\n const a21 = a[7];\n const a22 = a[8];\n out[0] = a11 * a22 - a12 * a21;\n out[1] = a02 * a21 - a01 * a22;\n out[2] = a01 * a12 - a02 * a11;\n out[3] = a12 * a20 - a10 * a22;\n out[4] = a00 * a22 - a02 * a20;\n out[5] = a02 * a10 - a00 * a12;\n out[6] = a10 * a21 - a11 * a20;\n out[7] = a01 * a20 - a00 * a21;\n out[8] = a00 * a11 - a01 * a10;\n return out;\n}\n/**\n * Calculates the determinant of a mat3\n *\n * @param {ReadonlyMat3} a the source matrix\n * @returns {Number} determinant of a\n */\nexport function determinant(a) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[3];\n const a11 = a[4];\n const a12 = a[5];\n const a20 = a[6];\n const a21 = a[7];\n const a22 = a[8];\n return (a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20));\n}\n/**\n * Multiplies two mat3's\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the first operand\n * @param {ReadonlyMat3} b the second operand\n * @returns {mat3} out\n */\nexport function multiply(out, a, b) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[3];\n const a11 = a[4];\n const a12 = a[5];\n const a20 = a[6];\n const a21 = a[7];\n const a22 = a[8];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b10 = b[3];\n const b11 = b[4];\n const b12 = b[5];\n const b20 = b[6];\n const b21 = b[7];\n const b22 = b[8];\n out[0] = b00 * a00 + b01 * a10 + b02 * a20;\n out[1] = b00 * a01 + b01 * a11 + b02 * a21;\n out[2] = b00 * a02 + b01 * a12 + b02 * a22;\n out[3] = b10 * a00 + b11 * a10 + b12 * a20;\n out[4] = b10 * a01 + b11 * a11 + b12 * a21;\n out[5] = b10 * a02 + b11 * a12 + b12 * a22;\n out[6] = b20 * a00 + b21 * a10 + b22 * a20;\n out[7] = b20 * a01 + b21 * a11 + b22 * a21;\n out[8] = b20 * a02 + b21 * a12 + b22 * a22;\n return out;\n}\n/**\n * Translate a mat3 by the given vector\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the matrix to translate\n * @param {ReadonlyVec2} v vector to translate by\n * @returns {mat3} out\n */\nexport function translate(out, a, v) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[3];\n const a11 = a[4];\n const a12 = a[5];\n const a20 = a[6];\n const a21 = a[7];\n const a22 = a[8];\n const x = v[0];\n const y = v[1];\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n out[3] = a10;\n out[4] = a11;\n out[5] = a12;\n out[6] = x * a00 + y * a10 + a20;\n out[7] = x * a01 + y * a11 + a21;\n out[8] = x * a02 + y * a12 + a22;\n return out;\n}\n/**\n * Rotates a mat3 by the given angle\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat3} out\n */\nexport function rotate(out, a, rad) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[3];\n const a11 = a[4];\n const a12 = a[5];\n const a20 = a[6];\n const a21 = a[7];\n const a22 = a[8];\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n out[0] = c * a00 + s * a10;\n out[1] = c * a01 + s * a11;\n out[2] = c * a02 + s * a12;\n out[3] = c * a10 - s * a00;\n out[4] = c * a11 - s * a01;\n out[5] = c * a12 - s * a02;\n out[6] = a20;\n out[7] = a21;\n out[8] = a22;\n return out;\n}\n/**\n * Scales the mat3 by the dimensions in the given vec2\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the matrix to scale\n * @param {ReadonlyVec2} v the vec2 to scale the matrix by\n * @returns {mat3} out\n **/\nexport function scale(out, a, v) {\n const x = v[0];\n const y = v[1];\n out[0] = x * a[0];\n out[1] = x * a[1];\n out[2] = x * a[2];\n out[3] = y * a[3];\n out[4] = y * a[4];\n out[5] = y * a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n}\n/**\n * Creates a matrix from a vector translation\n * This is equivalent to (but much faster than):\n *\n * mat3.identity(dest);\n * mat3.translate(dest, dest, vec);\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {ReadonlyVec2} v Translation vector\n * @returns {mat3} out\n */\nexport function fromTranslation(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = v[0];\n out[7] = v[1];\n out[8] = 1;\n return out;\n}\n/**\n * Creates a matrix from a given angle\n * This is equivalent to (but much faster than):\n *\n * mat3.identity(dest);\n * mat3.rotate(dest, dest, rad);\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat3} out\n */\nexport function fromRotation(out, rad) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = -s;\n out[4] = c;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n/**\n * Creates a matrix from a vector scaling\n * This is equivalent to (but much faster than):\n *\n * mat3.identity(dest);\n * mat3.scale(dest, dest, vec);\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {ReadonlyVec2} v Scaling vector\n * @returns {mat3} out\n */\nexport function fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = v[1];\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n/**\n * Copies the values from a mat2d into a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat2d} a the matrix to copy\n * @returns {mat3} out\n **/\nexport function fromMat2d(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = 0;\n out[3] = a[2];\n out[4] = a[3];\n out[5] = 0;\n out[6] = a[4];\n out[7] = a[5];\n out[8] = 1;\n return out;\n}\n/**\n * Calculates a 3x3 matrix from the given quaternion\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {ReadonlyQuat} q Quaternion to create matrix from\n *\n * @returns {mat3} out\n */\nexport function fromQuat(out, q) {\n const x = q[0];\n const y = q[1];\n const z = q[2];\n const w = q[3];\n const x2 = x + x;\n const y2 = y + y;\n const z2 = z + z;\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n out[0] = 1 - yy - zz;\n out[3] = yx - wz;\n out[6] = zx + wy;\n out[1] = yx + wz;\n out[4] = 1 - xx - zz;\n out[7] = zy - wx;\n out[2] = zx - wy;\n out[5] = zy + wx;\n out[8] = 1 - xx - yy;\n return out;\n}\n/**\n * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from\n *\n * @returns {mat3} out\n */\nexport function normalFromMat4(out, a) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[4];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n const a30 = a[12];\n const a31 = a[13];\n const a32 = a[14];\n const a33 = a[15];\n const b00 = a00 * a11 - a01 * a10;\n const b01 = a00 * a12 - a02 * a10;\n const b02 = a00 * a13 - a03 * a10;\n const b03 = a01 * a12 - a02 * a11;\n const b04 = a01 * a13 - a03 * a11;\n const b05 = a02 * a13 - a03 * a12;\n const b06 = a20 * a31 - a21 * a30;\n const b07 = a20 * a32 - a22 * a30;\n const b08 = a20 * a33 - a23 * a30;\n const b09 = a21 * a32 - a22 * a31;\n const b10 = a21 * a33 - a23 * a31;\n const b11 = a22 * a33 - a23 * a32;\n // Calculate the determinant\n let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n return out;\n}\n/**\n * Generates a 2D projection matrix with the given bounds\n *\n * @param {mat3} out mat3 frustum matrix will be written into\n * @param {number} width Width of your gl context\n * @param {number} height Height of gl context\n * @returns {mat3} out\n */\nexport function projection(out, width, height) {\n out[0] = 2 / width;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = -2 / height;\n out[5] = 0;\n out[6] = -1;\n out[7] = 1;\n out[8] = 1;\n return out;\n}\n/**\n * Returns a string representation of a mat3\n *\n * @param {ReadonlyMat3} a matrix to represent as a string\n * @returns {String} string representation of the matrix\n */\nexport function str(a) {\n return `mat3(${a[0]}, ${a[1]}, ${a[2]}, ${a[3]}, ${a[4]}, ${a[5]}, ${a[6]}, ${a[7]}, ${a[8]})`;\n}\n/**\n * Returns Frobenius norm of a mat3\n *\n * @param {ReadonlyMat3} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\nexport function frob(a) {\n return Math.sqrt(a[0] * a[0] +\n a[1] * a[1] +\n a[2] * a[2] +\n a[3] * a[3] +\n a[4] * a[4] +\n a[5] * a[5] +\n a[6] * a[6] +\n a[7] * a[7] +\n a[8] * a[8]);\n}\n/**\n * Adds two mat3's\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the first operand\n * @param {ReadonlyMat3} b the second operand\n * @returns {mat3} out\n */\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n out[8] = a[8] + b[8];\n return out;\n}\n/**\n * Subtracts matrix b from matrix a\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the first operand\n * @param {ReadonlyMat3} b the second operand\n * @returns {mat3} out\n */\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n out[6] = a[6] - b[6];\n out[7] = a[7] - b[7];\n out[8] = a[8] - b[8];\n return out;\n}\n/**\n * Multiply each element of the matrix by a scalar.\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the matrix to scale\n * @param {Number} b amount to scale the matrix's elements by\n * @returns {mat3} out\n */\nexport function multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n out[8] = a[8] * b;\n return out;\n}\n/**\n * Adds two mat3's after multiplying each element of the second operand by a scalar value.\n *\n * @param {mat3} out the receiving vector\n * @param {ReadonlyMat3} a the first operand\n * @param {ReadonlyMat3} b the second operand\n * @param {Number} scale the amount to scale b's elements by before adding\n * @returns {mat3} out\n */\nexport function multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n out[6] = a[6] + b[6] * scale;\n out[7] = a[7] + b[7] * scale;\n out[8] = a[8] + b[8] * scale;\n return out;\n}\n/**\n * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyMat3} a The first matrix.\n * @param {ReadonlyMat3} b The second matrix.\n * @returns {Boolean} True if the matrices are equal, false otherwise.\n */\nexport function exactEquals(a, b) {\n return (a[0] === b[0] &&\n a[1] === b[1] &&\n a[2] === b[2] &&\n a[3] === b[3] &&\n a[4] === b[4] &&\n a[5] === b[5] &&\n a[6] === b[6] &&\n a[7] === b[7] &&\n a[8] === b[8]);\n}\n/**\n * Returns whether or not the matrices have approximately the same elements in the same position.\n *\n * @param {ReadonlyMat3} a The first matrix.\n * @param {ReadonlyMat3} b The second matrix.\n * @returns {Boolean} True if the matrices are equal, false otherwise.\n */\nexport function equals(a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const a6 = a[6];\n const a7 = a[7];\n const a8 = a[8];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n const b4 = b[4];\n const b5 = b[5];\n const b6 = b[6];\n const b7 = b[7];\n const b8 = b[8];\n return (Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\n Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\n Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\n Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) &&\n Math.abs(a4 - b4) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) &&\n Math.abs(a5 - b5) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) &&\n Math.abs(a6 - b6) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) &&\n Math.abs(a7 - b7) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) &&\n Math.abs(a8 - b8) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8)));\n}\n/**\n * Alias for {@link mat3.multiply}\n * @function\n */\nexport const mul = multiply;\n/**\n * Alias for {@link mat3.subtract}\n * @function\n */\nexport const sub = subtract;\n//# sourceMappingURL=mat3.js.map","// math.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Copyright (c) 2017 Uber Technologies, Inc.\nimport { Matrix } from \"./base/matrix.js\";\nimport { checkVector } from \"../lib/validators.js\";\nimport { vec4_transformMat3 } from \"../lib/gl-matrix-extras.js\";\nimport { fromQuat as mat3_fromQuat, determinant as mat3_determinant, transpose as mat3_transpose, invert as mat3_invert, multiply as mat3_multiply, rotate as mat3_rotate, scale as mat3_scale, translate as mat3_translate } from \"../gl-matrix/mat3.js\";\nimport { transformMat3 as vec2_transformMat3 } from \"../gl-matrix/vec2.js\";\nimport { transformMat3 as vec3_transformMat3 } from \"../gl-matrix/vec3.js\";\n// eslint-disable-next-line no-shadow\nvar INDICES;\n(function (INDICES) {\n INDICES[INDICES[\"COL0ROW0\"] = 0] = \"COL0ROW0\";\n INDICES[INDICES[\"COL0ROW1\"] = 1] = \"COL0ROW1\";\n INDICES[INDICES[\"COL0ROW2\"] = 2] = \"COL0ROW2\";\n INDICES[INDICES[\"COL1ROW0\"] = 3] = \"COL1ROW0\";\n INDICES[INDICES[\"COL1ROW1\"] = 4] = \"COL1ROW1\";\n INDICES[INDICES[\"COL1ROW2\"] = 5] = \"COL1ROW2\";\n INDICES[INDICES[\"COL2ROW0\"] = 6] = \"COL2ROW0\";\n INDICES[INDICES[\"COL2ROW1\"] = 7] = \"COL2ROW1\";\n INDICES[INDICES[\"COL2ROW2\"] = 8] = \"COL2ROW2\";\n})(INDICES || (INDICES = {}));\nconst IDENTITY_MATRIX = Object.freeze([1, 0, 0, 0, 1, 0, 0, 0, 1]);\n/**\n * A 3x3 matrix with common linear algebra operations\n * Subclass of Array<number> meaning that it is highly compatible with other libraries\n */\nexport class Matrix3 extends Matrix {\n static get IDENTITY() {\n return getIdentityMatrix();\n }\n static get ZERO() {\n return getZeroMatrix();\n }\n get ELEMENTS() {\n return 9;\n }\n get RANK() {\n return 3;\n }\n get INDICES() {\n return INDICES;\n }\n constructor(array, ...args) {\n // PERF NOTE: initialize elements as double precision numbers\n super(-0, -0, -0, -0, -0, -0, -0, -0, -0);\n if (arguments.length === 1 && Array.isArray(array)) {\n this.copy(array);\n }\n else if (args.length > 0) {\n this.copy([array, ...args]);\n }\n else {\n this.identity();\n }\n }\n copy(array) {\n // Element wise copy for performance\n this[0] = array[0];\n this[1] = array[1];\n this[2] = array[2];\n this[3] = array[3];\n this[4] = array[4];\n this[5] = array[5];\n this[6] = array[6];\n this[7] = array[7];\n this[8] = array[8];\n return this.check();\n }\n // Constructors\n identity() {\n return this.copy(IDENTITY_MATRIX);\n }\n /**\n *\n * @param object\n * @returns self\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n fromObject(object) {\n return this.check();\n }\n /** Calculates a 3x3 matrix from the given quaternion\n * q quat Quaternion to create matrix from\n */\n fromQuaternion(q) {\n mat3_fromQuat(this, q);\n return this.check();\n }\n /**\n * accepts column major order, stores in column major order\n */\n // eslint-disable-next-line max-params\n set(m00, m10, m20, m01, m11, m21, m02, m12, m22) {\n this[0] = m00;\n this[1] = m10;\n this[2] = m20;\n this[3] = m01;\n this[4] = m11;\n this[5] = m21;\n this[6] = m02;\n this[7] = m12;\n this[8] = m22;\n return this.check();\n }\n /**\n * accepts row major order, stores as column major\n */\n // eslint-disable-next-line max-params\n setRowMajor(m00, m01, m02, m10, m11, m12, m20, m21, m22) {\n this[0] = m00;\n this[1] = m10;\n this[2] = m20;\n this[3] = m01;\n this[4] = m11;\n this[5] = m21;\n this[6] = m02;\n this[7] = m12;\n this[8] = m22;\n return this.check();\n }\n // Accessors\n determinant() {\n return mat3_determinant(this);\n }\n // Modifiers\n transpose() {\n mat3_transpose(this, this);\n return this.check();\n }\n /** Invert a matrix. Note that this can fail if the matrix is not invertible */\n invert() {\n mat3_invert(this, this);\n return this.check();\n }\n // Operations\n multiplyLeft(a) {\n mat3_multiply(this, a, this);\n return this.check();\n }\n multiplyRight(a) {\n mat3_multiply(this, this, a);\n return this.check();\n }\n rotate(radians) {\n mat3_rotate(this, this, radians);\n return this.check();\n }\n scale(factor) {\n if (Array.isArray(factor)) {\n mat3_scale(this, this, factor);\n }\n else {\n mat3_scale(this, this, [factor, factor]);\n }\n return this.check();\n }\n translate(vec) {\n mat3_translate(this, this, vec);\n return this.check();\n }\n // Transforms\n transform(vector, result) {\n let out;\n switch (vector.length) {\n case 2:\n out = vec2_transformMat3(result || [-0, -0], vector, this);\n break;\n case 3:\n out = vec3_transformMat3(result || [-0, -0, -0], vector, this);\n break;\n case 4:\n out = vec4_transformMat3(result || [-0, -0, -0, -0], vector, this);\n break;\n default:\n throw new Error('Illegal vector');\n }\n checkVector(out, vector.length);\n return out;\n }\n /** @deprecated */\n transformVector(vector, result) {\n return this.transform(vector, result);\n }\n /** @deprecated */\n transformVector2(vector, result) {\n return this.transform(vector, result);\n }\n /** @deprecated */\n transformVector3(vector, result) {\n return this.transform(vector, result);\n }\n}\nlet ZERO_MATRIX3;\nlet IDENTITY_MATRIX3 = null;\nfunction getZeroMatrix() {\n if (!ZERO_MATRIX3) {\n ZERO_MATRIX3 = new Matrix3([0, 0, 0, 0, 0, 0, 0, 0, 0]);\n Object.freeze(ZERO_MATRIX3);\n }\n return ZERO_MATRIX3;\n}\nfunction getIdentityMatrix() {\n if (!IDENTITY_MATRIX3) {\n IDENTITY_MATRIX3 = new Matrix3();\n Object.freeze(IDENTITY_MATRIX3);\n }\n return IDENTITY_MATRIX3;\n}\n//# sourceMappingURL=matrix3.js.map","// @eslint-disable\n// @ts-nocheck\nimport * as glMatrix from './common.js';\nimport * as mat3 from './mat3.js';\nimport * as vec3 from './vec3.js';\nimport * as vec4 from './vec4.js';\n// const glMatrix: {EPSILON = 0.000001};\n/**\n * Quaternion in the format XYZW\n * @module quat\n */\n/**\n * Creates a new identity quat\n *\n * @returns {quat} a new quaternion\n */\nexport function create() {\n const out = new glMatrix.ARRAY_TYPE(4);\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n }\n out[3] = 1;\n return out;\n}\n/**\n * Set a quat to the identity quaternion\n *\n * @param {quat} out the receiving quaternion\n * @returns {quat} out\n */\nexport function identity(out) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n}\n/**\n * Sets a quat from the given angle and rotation axis,\n * then returns it.\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyVec3} axis the axis around which to rotate\n * @param {Number} rad the angle in radians\n * @returns {quat} out\n **/\nexport function setAxisAngle(out, axis, rad) {\n rad = rad * 0.5;\n const s = Math.sin(rad);\n out[0] = s * axis[0];\n out[1] = s * axis[1];\n out[2] = s * axis[2];\n out[3] = Math.cos(rad);\n return out;\n}\n/**\n * Gets the rotation axis and angle for a given\n * quaternion. If a quaternion is created with\n * setAxisAngle, this method will return the same\n * values as providied in the original parameter list\n * OR functionally equivalent values.\n * Example: The quaternion formed by axis [0, 0, 1] and\n * angle -90 is the same as the quaternion formed by\n * [0, 0, 1] and 270. This method favors the latter.\n * @param {vec3} out_axis Vector receiving the axis of rotation\n * @param {ReadonlyQuat} q Quaternion to be decomposed\n * @return {Number} Angle, in radians, of the rotation\n */\nexport function getAxisAngle(out_axis, q) {\n const rad = Math.acos(q[3]) * 2.0;\n const s = Math.sin(rad / 2.0);\n if (s > glMatrix.EPSILON) {\n out_axis[0] = q[0] / s;\n out_axis[1] = q[1] / s;\n out_axis[2] = q[2] / s;\n }\n else {\n // If s is zero, return any axis (no rotation - axis does not matter)\n out_axis[0] = 1;\n out_axis[1] = 0;\n out_axis[2] = 0;\n }\n return rad;\n}\n/**\n * Gets the angular distance between two unit quaternions\n *\n * @param {ReadonlyQuat} a Origin unit quaternion\n * @param {ReadonlyQuat} b Destination unit quaternion\n * @return {Number} Angle, in radians, between the two quaternions\n */\nexport function getAngle(a, b) {\n const dotproduct = dot(a, b);\n return Math.acos(2 * dotproduct * dotproduct - 1);\n}\n/**\n * Multiplies two quat's\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a the first operand\n * @param {ReadonlyQuat} b the second operand\n * @returns {quat} out\n */\nexport function multiply(out, a, b) {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const bw = b[3];\n out[0] = ax * bw + aw * bx + ay * bz - az * by;\n out[1] = ay * bw + aw * by + az * bx - ax * bz;\n out[2] = az * bw + aw * bz + ax * by - ay * bx;\n out[3] = aw * bw - ax * bx - ay * by - az * bz;\n return out;\n}\n/**\n * Rotates a quaternion by the given angle about the X axis\n *\n * @param {quat} out quat receiving operation result\n * @param {ReadonlyQuat} a quat to rotate\n * @param {number} rad angle (in radians) to rotate\n * @returns {quat} out\n */\nexport function rotateX(out, a, rad) {\n rad *= 0.5;\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n const bx = Math.sin(rad);\n const bw = Math.cos(rad);\n out[0] = ax * bw + aw * bx;\n out[1] = ay * bw + az * bx;\n out[2] = az * bw - ay * bx;\n out[3] = aw * bw - ax * bx;\n return out;\n}\n/**\n * Rotates a quaternion by the given angle about the Y axis\n *\n * @param {quat} out quat receiving operation result\n * @param {ReadonlyQuat} a quat to rotate\n * @param {number} rad angle (in radians) to rotate\n * @returns {quat} out\n */\nexport function rotateY(out, a, rad) {\n rad *= 0.5;\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n const by = Math.sin(rad);\n const bw = Math.cos(rad);\n out[0] = ax * bw - az * by;\n out[1] = ay * bw + aw * by;\n out[2] = az * bw + ax * by;\n out[3] = aw * bw - ay * by;\n return out;\n}\n/**\n * Rotates a quaternion by the given angle about the Z axis\n *\n * @param {quat} out quat receiving operation result\n * @param {ReadonlyQuat} a quat to rotate\n * @param {number} rad angle (in radians) to rotate\n * @returns {quat} out\n */\nexport function rotateZ(out, a, rad) {\n rad *= 0.5;\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n const bz = Math.sin(rad);\n const bw = Math.cos(rad);\n out[0] = ax * bw + ay * bz;\n out[1] = ay * bw - ax * bz;\n out[2] = az * bw + aw * bz;\n out[3] = aw * bw - az * bz;\n return out;\n}\n/**\n * Calculates the W component of a quat from the X, Y, and Z components.\n * Assumes that quaternion is 1 unit in length.\n * Any existing W component will be ignored.\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a quat to calculate W component of\n * @returns {quat} out\n */\nexport function calculateW(out, a) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));\n return out;\n}\n/**\n * Calculate the exponential of a unit quaternion.\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a quat to calculate the exponential of\n * @returns {quat} out\n */\nexport function exp(out, a) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const w = a[3];\n const r = Math.sqrt(x * x + y * y + z * z);\n const et = Math.exp(w);\n const s = r > 0 ? (et * Math.sin(r)) / r : 0;\n out[0] = x * s;\n out[1] = y * s;\n out[2] = z * s;\n out[3] = et * Math.cos(r);\n return out;\n}\n/**\n * Calculate the natural logarithm of a unit quaternion.\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a quat to calculate the exponential of\n * @returns {quat} out\n */\nexport function ln(out, a) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const w = a[3];\n const r = Math.sqrt(x * x + y * y + z * z);\n const t = r > 0 ? Math.atan2(r, w) / r : 0;\n out[0] = x * t;\n out[1] = y * t;\n out[2] = z * t;\n out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w);\n return out;\n}\n/**\n * Calculate the scalar power of a unit quaternion.\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a quat to calculate the exponential of\n * @param {Number} b amount to scale the quaternion by\n * @returns {quat} out\n */\nexport function pow(out, a, b) {\n ln(out, a);\n scale(out, out, b);\n exp(out, out);\n return out;\n}\n/**\n * Performs a spherical linear interpolation between two quat\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a the first operand\n * @param {ReadonlyQuat} b the second operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {quat} out\n */\nexport function slerp(out, a, b, t) {\n // benchmarks:\n // http://jsperf.com/quaternion-slerp-implementations\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n let bx = b[0];\n let by = b[1];\n let bz = b[2];\n let bw = b[3];\n let cosom;\n let omega;\n let scale0;\n let scale1;\n let sinom;\n // calc cosine\n cosom = ax * bx + ay * by + az * bz + aw * bw;\n // adjust signs (if necessary)\n if (cosom < 0.0) {\n cosom = -cosom;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n }\n // calculate coefficients\n if (1.0 - cosom > glMatrix.EPSILON) {\n // standard case (slerp)\n omega = Math.acos(cosom);\n sinom = Math.sin(omega);\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\n scale1 = Math.sin(t * omega) / sinom;\n }\n else {\n // \"from\" and \"to\" quaternions are very close\n // ... so we can do a linear interpolation\n scale0 = 1.0 - t;\n scale1 = t;\n }\n // calculate final values\n out[0] = scale0 * ax + scale1 * bx;\n out[1] = scale0 * ay + scale1 * by;\n out[2] = scale0 * az + scale1 * bz;\n out[3] = scale0 * aw + scale1 * bw;\n return out;\n}\n/**\n * Generates a random unit quaternion\n *\n * @param {quat} out the receiving quaternion\n * @returns {quat} out\n */\n// export function random(out) {\n// // Implementation of http://planning.cs.uiuc.edu/node198.html\n// // TODO: Calling random 3 times is probably not the fastest solution\n// let u1 = glMatrix.RANDOM();\n// let u2 = glMatrix.RANDOM();\n// let u3 = glMatrix.RANDOM();\n// let sqrt1MinusU1 = Math.sqrt(1 - u1);\n// let sqrtU1 = Math.sqrt(u1);\n// out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2);\n// out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2);\n// out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3);\n// out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3);\n// return out;\n// }\n/**\n * Calculates the inverse of a quat\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a quat to calculate inverse of\n * @returns {quat} out\n */\nexport function invert(out, a) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\n const invDot = dot ? 1.0 / dot : 0;\n // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0\n out[0] = -a0 * invDot;\n out[1] = -a1 * invDot;\n out[2] = -a2 * invDot;\n out[3] = a3 * invDot;\n return out;\n}\n/**\n * Calculates the conjugate of a quat\n * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a quat to calculate conjugate of\n * @returns {quat} out\n */\nexport function conjugate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a[3];\n return out;\n}\n/**\n * Creates a quaternion from the given 3x3 rotation matrix.\n *\n * NOTE: The resultant quaternion is not normalized, so you should be sure\n * to renormalize the quaternion yourself where necessary.\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyMat3} m rotation matrix\n * @returns {quat} out\n * @function\n */\nexport function fromMat3(out, m) {\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n // article \"Quaternion Calculus and Fast Animation\".\n const fTrace = m[0] + m[4] + m[8];\n let fRoot;\n if (fTrace > 0.0) {\n // |w| > 1/2, may as well choose w > 1/2\n fRoot = Math.sqrt(fTrace + 1.0); // 2w\n out[3] = 0.5 * fRoot;\n fRoot = 0.5 / fRoot; // 1/(4w)\n out[0] = (m[5] - m[7]) * fRoot;\n out[1] = (m[6] - m[2]) * fRoot;\n out[2] = (m[1] - m[3]) * fRoot;\n }\n else {\n // |w| <= 1/2\n let i = 0;\n if (m[4] > m[0])\n i = 1;\n if (m[8] > m[i * 3 + i])\n i = 2;\n const j = (i + 1) % 3;\n const k = (i + 2) % 3;\n fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0);\n out[i] = 0.5 * fRoot;\n fRoot = 0.5 / fRoot;\n out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot;\n out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot;\n out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot;\n }\n return out;\n}\n/**\n * Creates a quaternion from the given euler angle x, y, z using the provided intrinsic order for the conversion.\n *\n * @param {quat} out the receiving quaternion\n * @param {Number} x Angle to rotate around X axis in degrees.\n * @param {Number} y Angle to rotate around Y axis in degrees.\n * @param {Number} z Angle to rotate around Z axis in degrees.\n * @param {'zyx'|'xyz'|'yxz'|'yzx'|'zxy'|'zyx'} order Intrinsic order for conversion, default is zyx.\n * @returns {quat} out\n * @function\n */\n// export function fromEuler(out, x, y, z, order = glMatrix.ANGLE_ORDER) {\n// let halfToRad = Math.PI / 360;\n// x *= halfToRad;\n// z *= halfToRad;\n// y *= halfToRad;\n// let sx = Math.sin(x);\n// let cx = Math.cos(x);\n// let sy = Math.sin(y);\n// let cy = Math.cos(y);\n// let sz = Math.sin(z);\n// let cz = Math.cos(z);\n// switch (order) {\n// case \"xyz\":\n// out[0] = sx * cy * cz + cx * sy * sz;\n// out[1] = cx * sy * cz - sx * cy * sz;\n// out[2] = cx * cy * sz + sx * sy * cz;\n// out[3] = cx * cy * cz - sx * sy * sz;\n// break;\n// case \"xzy\":\n// out[0] = sx * cy * cz - cx * sy * sz;\n// out[1] = cx * sy * cz - sx * cy * sz;\n// out[2] = cx * cy * sz + sx * sy * cz;\n// out[3] = cx * cy * cz + sx * sy * sz;\n// break;\n// case \"yxz\":\n// out[0] = sx * cy * cz + cx * sy * sz;\n// out[1] = cx * sy * cz - sx * cy * sz;\n// out[2] = cx * cy * sz - sx * sy * cz;\n// out[3] = cx * cy * cz + sx * sy * sz;\n// break;\n// case \"yzx\":\n// out[0] = sx * cy * cz + cx * sy * sz;\n// out[1] = cx * sy * cz + sx * cy * sz;\n// out[2] = cx * cy * sz - sx * sy * cz;\n// out[3] = cx * cy * cz - sx * sy * sz;\n// break;\n// case \"zxy\":\n// out[0] = sx * cy * cz - cx * sy * sz;\n// out[1] = cx * sy * cz + sx * cy * sz;\n// out[2] = cx * cy * sz + sx * sy * cz;\n// out[3] = cx * cy * cz - sx * sy * sz;\n// break;\n// case \"zyx\":\n// out[0] = sx * cy * cz - cx * sy * sz;\n// out[1] = cx * sy * cz + sx * cy * sz;\n// out[2] = cx * cy * sz - sx * sy * cz;\n// out[3] = cx * cy * cz + sx * sy * sz;\n// break;\n// default:\n// throw new Error('Unknown angle order ' + order);\n// }\n// return out;\n// }\n/**\n * Returns a string representation of a quaternion\n *\n * @param {ReadonlyQuat} a vector to represent as a string\n * @returns {String} string representation of the vector\n */\nexport function str(a) {\n return `quat(${a[0]}, ${a[1]}, ${a[2]}, ${a[3]})`;\n}\n/**\n * Creates a new quat initialized with values from an existing quaternion\n *\n * @param {ReadonlyQuat} a quaternion to clone\n * @returns {quat} a new quaternion\n * @function\n */\nexport const clone = vec4.clone;\n/**\n * Creates a new quat initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {quat} a new quaternion\n * @function\n */\nexport const fromValues = vec4.fromValues;\n/**\n * Copy the values from one quat to another\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a the source quaternion\n * @returns {quat} out\n * @function\n */\nexport const copy = vec4.copy;\n/**\n * Set the components of a quat to the given values\n *\n * @param {quat} out the receiving quaternion\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {quat} out\n * @function\n */\nexport const set = vec4.set;\n/**\n * Adds two quat's\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a the first operand\n * @param {ReadonlyQuat} b the second operand\n * @returns {quat} out\n * @function\n */\nexport const add = vec4.add;\n/**\n * Alias for {@link quat.multiply}\n * @function\n */\nexport const mul = multiply;\n/**\n * Scales a quat by a scalar number\n *\n * @param {quat} out the receiving vector\n * @param {ReadonlyQuat} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {quat} out\n * @function\n */\nexport const scale = vec4.scale;\n/**\n * Calculates the dot product of two quat's\n *\n * @param {ReadonlyQuat} a the first operand\n * @param {ReadonlyQuat} b the second operand\n * @returns {Number} dot product of a and b\n * @function\n */\nexport const dot = vec4.dot;\n/**\n * Performs a linear interpolation between two quat's\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a the first operand\n * @param {ReadonlyQuat} b the second operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {quat} out\n * @function\n */\nexport const lerp = vec4.lerp;\n/**\n * Calculates the length of a quat\n *\n * @param {ReadonlyQuat} a vector to calculate length of\n * @returns {Number} length of a\n */\nexport const length = vec4.length;\n/**\n * Alias for {@link quat.length}\n * @function\n */\nexport const len = length;\n/**\n * Calculates the squared length of a quat\n *\n * @param {ReadonlyQuat} a vector to calculate squared length of\n * @returns {Number} squared length of a\n * @function\n */\nexport const squaredLength = vec4.squaredLength;\n/**\n * Alias for {@link quat.squaredLength}\n * @function\n */\nexport const sqrLen = squaredLength;\n/**\n * Normalize a quat\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a quaternion to normalize\n * @returns {quat} out\n * @function\n */\nexport const normalize = vec4.normalize;\n/**\n * Returns whether or not the quaternions have exactly the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyQuat} a The first quaternion.\n * @param {ReadonlyQuat} b The second quaternion.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\nexport const exactEquals = vec4.exactEquals;\n/**\n * Returns whether or not the quaternions point approximately to the same direction.\n *\n * Both quaternions are assumed to be unit length.\n *\n * @param {ReadonlyQuat} a The first unit quaternion.\n * @param {ReadonlyQuat} b The second unit quaternion.\n * @returns {Boolean} True if the quaternions are equal, false otherwise.\n */\nexport function equals(a, b) {\n return Math.abs(vec4.dot(a, b)) >= 1 - glMatrix.EPSILON;\n}\n/**\n * Sets a quaternion to represent the shortest rotation from one\n * vector to another.\n *\n * Both vectors are assumed to be unit length.\n *\n * @param {quat} out the receiving quaternion.\n * @param {ReadonlyVec3} a the initial vector\n * @param {ReadonlyVec3} b the destination vector\n * @returns {quat} out\n */\nexport const rotationTo = (function () {\n const tmpvec3 = vec3.create();\n const xUnitVec3 = vec3.fromValues(1, 0, 0);\n const yUnitVec3 = vec3.fromValues(0, 1, 0);\n return function (out, a, b) {\n const dot = vec3.dot(a, b);\n if (dot < -0.999999) {\n vec3.cross(tmpvec3, xUnitVec3, a);\n if (vec3.len(tmpvec3) < 0.000001)\n vec3.cross(tmpvec3, yUnitVec3, a);\n vec3.normalize(tmpvec3, tmpvec3);\n setAxisAngle(out, tmpvec3, Math.PI);\n return out;\n }\n else if (dot > 0.999999) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n }\n vec3.cross(tmpvec3, a, b);\n out[0] = tmpvec3[0];\n out[1] = tmpvec3[1];\n out[2] = tmpvec3[2];\n out[3] = 1 + dot;\n return normalize(out, out);\n };\n})();\n/**\n * Performs a spherical linear interpolation with two control points\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a the first operand\n * @param {ReadonlyQuat} b the second operand\n * @param {ReadonlyQuat} c the third operand\n * @param {ReadonlyQuat} d the fourth operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {quat} out\n */\nexport const sqlerp = (function () {\n const temp1 = create();\n const temp2 = create();\n return function (out, a, b, c, d, t) {\n slerp(temp1, a, d, t);\n slerp(temp2, b, c, t);\n slerp(out, temp1, temp2, 2 * t * (1 - t));\n return out;\n };\n})();\n/**\n * Sets the specified quaternion with values corresponding to the given\n * axes. Each axis is a vec3 and is expected to be unit length and\n * perpendicular to all other specified axes.\n *\n * @param {ReadonlyVec3} view the vector representing the viewing direction\n * @param {ReadonlyVec3} right the vector representing the local \"right\" direction\n * @param {ReadonlyVec3} up the vector representing the local \"up\" direction\n * @returns {quat} out\n */\nexport const setAxes = (function () {\n const matr = mat3.create();\n return function (out, view, right, up) {\n matr[0] = right[0];\n matr[3] = right[1];\n matr[6] = right[2];\n matr[1] = up[0];\n matr[4] = up[1];\n matr[7] = up[2];\n matr[2] = -view[0];\n matr[5] = -view[1];\n matr[8] = -view[2];\n return normalize(out, fromMat3(out, matr));\n };\n})();\n//# sourceMappingURL=quat.js.map","// math.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Copyright (c) 2017 Uber Technologies, Inc.\nimport { MathArray } from \"./base/math-array.js\";\nimport { checkNumber, checkVector } from \"../lib/validators.js\";\nimport { Vector4 } from \"./vector4.js\";\n// @ts-ignore gl-matrix types...\nimport { fromMat3 as quat_fromMat3, setAxisAngle as quat_setAxisAngle, identity as quat_identity, length as quat_length, squaredLength as quat_squaredLength, dot as quat_dot, \n// getAxisAngle as quat_getAxisAngle,\nrotationTo as quat_rotationTo, add as quat_add, calculateW as quat_calculateW, conjugate as quat_conjugate, invert as quat_invert, lerp as quat_lerp, multiply as quat_multiply, rotateX as quat_rotateX, rotateY as quat_rotateY, rotateZ as quat_rotateZ, scale as quat_scale, slerp as quat_slerp } from \"../gl-matrix/quat.js\";\n// @ts-ignore gl-matrix types...\nimport { transformQuat as vec4_transformQuat } from \"../gl-matrix/vec4.js\";\nconst IDENTITY_QUATERNION = [0, 0, 0, 1];\nexport class Quaternion extends MathArray {\n constructor(x = 0, y = 0, z = 0, w = 1) {\n // PERF NOTE: initialize elements as double precision numbers\n super(-0, -0, -0, -0);\n // eslint-disable-next-line prefer-rest-params\n if (Array.isArray(x) && arguments.length === 1) {\n this.copy(x);\n }\n else {\n this.set(x, y, z, w);\n }\n }\n copy(array) {\n this[0] = array[0];\n this[1] = array[1];\n this[2] = array[2];\n this[3] = array[3];\n return this.check();\n }\n set(x, y, z, w) {\n this[0] = x;\n this[1] = y;\n this[2] = z;\n this[3] = w;\n return this.check();\n }\n fromObject(object) {\n this[0] = object.x;\n this[1] = object.y;\n this[2] = object.z;\n this[3] = object.w;\n return this.check();\n }\n /**\n * Creates a quaternion from the given 3x3 rotation matrix.\n * NOTE: The resultant quaternion is not normalized, so you should\n * be sure to renormalize the quaternion yourself where necessary.\n * @param m\n * @returns\n */\n fromMatrix3(m) {\n quat_fromMat3(this, m);\n return this.check();\n }\n fromAxisRotation(axis, rad) {\n quat_setAxisAngle(this, axis, rad);\n return this.check();\n }\n /** Set a quat to the identity quaternion */\n identity() {\n quat_identity(this);\n return this.check();\n }\n // Set the components of a quat to the given values\n // set(i, j, k, l) {\n // quat_set(this, i, j, k, l);\n // return this.check();\n // }\n // Sets a quat from the given angle and rotation axis, then returns it.\n setAxisAngle(axis, rad) {\n return this.fromAxisRotation(axis, rad);\n }\n // Getters/setters\n get ELEMENTS() {\n return 4;\n }\n get x() {\n return this[0];\n }\n set x(value) {\n this[0] = checkNumber(value);\n }\n get y() {\n return this[1];\n }\n set y(value) {\n this[1] = checkNumber(value);\n }\n get z() {\n return this[2];\n }\n set z(value) {\n this[2] = checkNumber(value);\n }\n get w() {\n return this[3];\n }\n set w(value) {\n this[3] = checkNumber(value);\n }\n // Calculates the length of a quat\n len() {\n return quat_length(this);\n }\n // Calculates the squared length of a quat\n lengthSquared() {\n return quat_squaredLength(this);\n }\n // Calculates the dot product of two quat's\n // @return {Number}\n dot(a) {\n return quat_dot(this, a);\n }\n // Gets the rotation axis and angle for a given quaternion.\n // If a quaternion is created with setAxisAngle, this method will\n // return the same values as providied in the original parameter\n // list OR functionally equivalent values.\n // Example: The quaternion formed by axis [0, 0, 1] and angle -90\n // is the same as the quaternion formed by [0, 0, 1] and 270.\n // This method favors the latter.\n // @return {{[x,y,z], Number}}\n // getAxisAngle() {\n // const axis = [];\n // // const angle = quat_getAxisAngle(axis, this);\n // return {axis, angle};\n // }\n // MODIFIERS\n // Sets a quaternion to represent the shortest rotation from one vector\n // to another. Both vectors are assumed to be unit length.\n rotationTo(vectorA, vectorB) {\n quat_rotationTo(this, vectorA, vectorB);\n return this.check();\n }\n // Sets the specified quaternion with values corresponding to the given axes.\n // Each axis is a vec3 and is expected to be unit length and perpendicular\n // to all other specified axes.\n // setAxes() {\n // Number\n // }\n // Performs a spherical linear interpolation with two control points\n // sqlerp() {\n // Number;\n // }\n // Adds two quat's\n add(a) {\n quat_add(this, this, a);\n return this.check();\n }\n // Calculates the W component of a quat from the X, Y, and Z components.\n // Any existing W component will be ignored.\n calculateW() {\n quat_calculateW(this, this);\n return this.check();\n }\n // Calculates the conjugate of a quat If the quaternion is normalized,\n // this function is faster than quat_invert and produces the same result.\n conjugate() {\n quat_conjugate(this, this);\n return this.check();\n }\n // Calculates the inverse of a quat\n invert() {\n quat_invert(this, this);\n return this.check();\n }\n // Performs a linear interpolation between two quat's\n lerp(a, b, t) {\n if (t === undefined) {\n return this.lerp(this, a, b);\n }\n quat_lerp(this, a, b, t);\n return this.check();\n }\n // Multiplies two quat's\n multiplyRight(a) {\n quat_multiply(this, this, a);\n return this.check();\n }\n multiplyLeft(a) {\n quat_multiply(this, a, this);\n return this.check();\n }\n // Normalize a quat\n normalize() {\n // Handle 0 case\n const length = this.len();\n const l = length > 0 ? 1 / length : 0;\n this[0] = this[0] * l;\n this[1] = this[1] * l;\n this[2] = this[2] * l;\n this[3] = this[3] * l;\n // Set to [0, 0, 0, 1] if length is 0\n if (length === 0) {\n this[3] = 1;\n }\n return this.check();\n }\n // Rotates a quaternion by the given angle about the X axis\n rotateX(rad) {\n quat_rotateX(this, this, rad);\n return this.check();\n }\n // Rotates a quaternion by the given angle about the Y axis\n rotateY(rad) {\n quat_rotateY(this, this, rad);\n return this.check();\n }\n // Rotates a quaternion by the given angle about the Z axis\n rotateZ(rad) {\n quat_rotateZ(this, this, rad);\n return this.check();\n }\n // Scales a quat by a scalar number\n scale(b) {\n quat_scale(this, this, b);\n return this.check();\n }\n // Performs a spherical linear interpolation between two quat\n slerp(arg0, arg1, arg2) {\n let start;\n let target;\n let ratio;\n // eslint-disable-next-line prefer-rest-params\n switch (arguments.length) {\n case 1: // Deprecated signature ({start, target, ratio})\n // eslint-disable-next-line prefer-rest-params\n ({\n start = IDENTITY_QUATERNION,\n target,\n ratio\n } = arg0);\n break;\n case 2: // THREE.js compatibility signature (target, ration)\n start = this; // eslint-disable-line\n target = arg0;\n ratio = arg1;\n break;\n default:\n // Default signature: (start, target, ratio)\n start = arg0;\n target = arg1;\n ratio = arg2;\n }\n quat_slerp(this, start, target, ratio);\n return this.check();\n }\n transformVector4(vector, result = new Vector4()) {\n vec4_transformQuat(result, vector, this);\n return checkVector(result, 4);\n }\n // THREE.js Math API compatibility\n lengthSq() {\n return this.lengthSquared();\n }\n setFromAxisAngle(axis, rad) {\n return this.setAxisAngle(axis, rad);\n }\n premultiply(a) {\n return this.multiplyLeft(a);\n }\n multiply(a) {\n return this.multiplyRight(a);\n }\n}\n//# sourceMappingURL=quaternion.js.map","// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Attribution:\n// MIT license, Copyright (c) 2016-2017 Mohamad Moneimne and Contributors\n// This fragment shader defines a reference implementation for Physically Based Shading of\n// a microfacet surface material defined by a glTF model.\n// TODO - better do the checks outside of shader\nexport const vs = /* glsl */ `\\\nout vec3 pbr_vPosition;\nout vec2 pbr_vUV;\n\n#ifdef HAS_NORMALS\n# ifdef HAS_TANGENTS\nout mat3 pbr_vTBN;\n# else\nout vec3 pbr_vNormal;\n# endif\n#endif\n\nvoid pbr_setPositionNormalTangentUV(vec4 position, vec4 normal, vec4 tangent, vec2 uv)\n{\n vec4 pos = pbrProjection.modelMatrix * position;\n pbr_vPosition = vec3(pos.xyz) / pos.w;\n\n#ifdef HAS_NORMALS\n#ifdef HAS_TANGENTS\n vec3 normalW = normalize(vec3(pbrProjection.normalMatrix * vec4(normal.xyz, 0.0)));\n vec3 tangentW = normalize(vec3(pbrProjection.modelMatrix * vec4(tangent.xyz, 0.0)));\n vec3 bitangentW = cross(normalW, tangentW) * tangent.w;\n pbr_vTBN = mat3(tangentW, bitangentW, normalW);\n#else // HAS_TANGENTS != 1\n pbr_vNormal = normalize(vec3(pbrProjection.modelMatrix * vec4(normal.xyz, 0.0)));\n#endif\n#endif\n\n#ifdef HAS_UV\n pbr_vUV = uv;\n#else\n pbr_vUV = vec2(0.,0.);\n#endif\n}\n`;\nexport const fs = /* glsl */ `\\\nprecision highp float;\n\nuniform pbrMaterialUniforms {\n // Material is unlit\n bool unlit;\n\n // Base color map\n bool baseColorMapEnabled;\n vec4 baseColorFactor;\n\n bool normalMapEnabled; \n float normalScale; // #ifdef HAS_NORMALMAP\n\n bool emissiveMapEnabled;\n vec3 emissiveFactor; // #ifdef HAS_EMISSIVEMAP\n\n vec2 metallicRoughnessValues;\n bool metallicRoughnessMapEnabled;\n\n bool occlusionMapEnabled;\n float occlusionStrength; // #ifdef HAS_OCCLUSIONMAP\n \n bool alphaCutoffEnabled;\n float alphaCutoff; // #ifdef ALPHA_CUTOFF\n \n // IBL\n bool IBLenabled;\n vec2 scaleIBLAmbient; // #ifdef USE_IBL\n \n // debugging flags used for shader output of intermediate PBR variables\n // #ifdef PBR_DEBUG\n vec4 scaleDiffBaseMR;\n vec4 scaleFGDSpec;\n // #endif\n} pbrMaterial;\n\n// Samplers\n#ifdef HAS_BASECOLORMAP\nuniform sampler2D pbr_baseColorSampler;\n#endif\n#ifdef HAS_NORMALMAP\nuniform sampler2D pbr_normalSampler;\n#endif\n#ifdef HAS_EMISSIVEMAP\nuniform sampler2D pbr_emissiveSampler;\n#endif\n#ifdef HAS_METALROUGHNESSMAP\nuniform sampler2D pbr_metallicRoughnessSampler;\n#endif\n#ifdef HAS_OCCLUSIONMAP\nuniform sampler2D pbr_occlusionSampler;\n#endif\n#ifdef USE_IBL\nuniform samplerCube pbr_diffuseEnvSampler;\nuniform samplerCube pbr_specularEnvSampler;\nuniform sampler2D pbr_brdfLUT;\n#endif\n\n// Inputs from vertex shader\n\nin vec3 pbr_vPosition;\nin vec2 pbr_vUV;\n\n#ifdef HAS_NORMALS\n#ifdef HAS_TANGENTS\nin mat3 pbr_vTBN;\n#else\nin vec3 pbr_vNormal;\n#endif\n#endif\n\n// Encapsulate the various inputs used by the various functions in the shading equation\n// We store values in this struct to simplify the integration of alternative implementations\n// of the shading terms, outlined in the Readme.MD Appendix.\nstruct PBRInfo {\n float NdotL; // cos angle between normal and light direction\n float NdotV; // cos angle between normal and view direction\n float NdotH; // cos angle between normal and half vector\n float LdotH; // cos angle between light direction and half vector\n float VdotH; // cos angle between view direction and half vector\n float perceptualRoughness; // roughness value, as authored by the model creator (input to shader)\n float metalness; // metallic value at the surface\n vec3 reflectance0; // full reflectance color (normal incidence angle)\n vec3 reflectance90; // reflectance color at grazing angle\n float alphaRoughness; // roughness mapped to a more linear change in the roughness (proposed by [2])\n vec3 diffuseColor; // color contribution from diffuse lighting\n vec3 specularColor; // color contribution from specular lighting\n vec3 n; // normal at surface point\n vec3 v; // vector from surface point to camera\n};\n\nconst float M_PI = 3.141592653589793;\nconst float c_MinRoughness = 0.04;\n\nvec4 SRGBtoLINEAR(vec4 srgbIn)\n{\n#ifdef MANUAL_SRGB\n#ifdef SRGB_FAST_APPROXIMATION\n vec3 linOut = pow(srgbIn.xyz,vec3(2.2));\n#else // SRGB_FAST_APPROXIMATION\n vec3 bLess = step(vec3(0.04045),srgbIn.xyz);\n vec3 linOut = mix( srgbIn.xyz/vec3(12.92), pow((srgbIn.xyz+vec3(0.055))/vec3(1.055),vec3(2.4)), bLess );\n#endif //SRGB_FAST_APPROXIMATION\n return vec4(linOut,srgbIn.w);;\n#else //MANUAL_SRGB\n return srgbIn;\n#endif //MANUAL_SRGB\n}\n\n// Find the normal for this fragment, pulling either from a predefined normal map\n// or from the interpolated mesh normal and tangent attributes.\nvec3 getNormal()\n{\n // Retrieve the tangent space matrix\n#ifndef HAS_TANGENTS\n vec3 pos_dx = dFdx(pbr_vPosition);\n vec3 pos_dy = dFdy(pbr_vPosition);\n vec3 tex_dx = dFdx(vec3(pbr_vUV, 0.0));\n vec3 tex_dy = dFdy(vec3(pbr_vUV, 0.0));\n vec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);\n\n#ifdef HAS_NORMALS\n vec3 ng = normalize(pbr_vNormal);\n#else\n vec3 ng = cross(pos_dx, pos_dy);\n#endif\n\n t = normalize(t - ng * dot(ng, t));\n vec3 b = normalize(cross(ng, t));\n mat3 tbn = mat3(t, b, ng);\n#else // HAS_TANGENTS\n mat3 tbn = pbr_vTBN;\n#endif\n\n#ifdef HAS_NORMALMAP\n vec3 n = texture(pbr_normalSampler, pbr_vUV).rgb;\n n = normalize(tbn * ((2.0 * n - 1.0) * vec3(pbrMaterial.normalScale, pbrMaterial.normalScale, 1.0)));\n#else\n // The tbn matrix is linearly interpolated, so we need to re-normalize\n vec3 n = normalize(tbn[2].xyz);\n#endif\n\n return n;\n}\n\n// Calculation of the lighting contribution from an optional Image Based Light source.\n// Precomputed Environment Maps are required uniform inputs and are computed as outlined in [1].\n// See our README.md on Environment Maps [3] for additional discussion.\n#ifdef USE_IBL\nvec3 getIBLContribution(PBRInfo pbrInfo, vec3 n, vec3 reflection)\n{\n float mipCount = 9.0; // resolution of 512x512\n float lod = (pbrInfo.perceptualRoughness * mipCount);\n // retrieve a scale and bias to F0. See [1], Figure 3\n vec3 brdf = SRGBtoLINEAR(texture(pbr_brdfLUT,\n vec2(pbrInfo.NdotV, 1.0 - pbrInfo.perceptualRoughness))).rgb;\n vec3 diffuseLight = SRGBtoLINEAR(texture(pbr_diffuseEnvSampler, n)).rgb;\n\n#ifdef USE_TEX_LOD\n vec3 specularLight = SRGBtoLINEAR(texture(pbr_specularEnvSampler, reflection, lod)).rgb;\n#else\n vec3 specularLight = SRGBtoLINEAR(texture(pbr_specularEnvSampler, reflection)).rgb;\n#endif\n\n vec3 diffuse = diffuseLight * pbrInfo.diffuseColor;\n vec3 specular = specularLight * (pbrInfo.specularColor * brdf.x + brdf.y);\n\n // For presentation, this allows us to disable IBL terms\n diffuse *= pbrMaterial.scaleIBLAmbient.x;\n specular *= pbrMaterial.scaleIBLAmbient.y;\n\n return diffuse + specular;\n}\n#endif\n\n// Basic Lambertian diffuse\n// Implementation from Lambert's Photometria https://archive.org/details/lambertsphotome00lambgoog\n// See also [1], Equation 1\nvec3 diffuse(PBRInfo pbrInfo)\n{\n return pbrInfo.diffuseColor / M_PI;\n}\n\n// The following equation models the Fresnel reflectance term of the spec equation (aka F())\n// Implementation of fresnel from [4], Equation 15\nvec3 specularReflection(PBRInfo pbrInfo)\n{\n return pbrInfo.reflectance0 +\n (pbrInfo.reflectance90 - pbrInfo.reflectance0) *\n pow(clamp(1.0 - pbrInfo.VdotH, 0.0, 1.0), 5.0);\n}\n\n// This calculates the specular geometric attenuation (aka G()),\n// where rougher material will reflect less light back to the viewer.\n// This implementation is based on [1] Equation 4, and we adopt their modifications to\n// alphaRoughness as input as originally proposed in [2].\nfloat geometricOcclusion(PBRInfo pbrInfo)\n{\n float NdotL = pbrInfo.NdotL;\n float NdotV = pbrInfo.NdotV;\n float r = pbrInfo.alphaRoughness;\n\n float attenuationL = 2.0 * NdotL / (NdotL + sqrt(r * r + (1.0 - r * r) * (NdotL * NdotL)));\n float attenuationV = 2.0 * NdotV / (NdotV + sqrt(r * r + (1.0 - r * r) * (NdotV * NdotV)));\n return attenuationL * attenuationV;\n}\n\n// The following equation(s) model the distribution of microfacet normals across\n// the area being drawn (aka D())\n// Implementation from \"Average Irregularity Representation of a Roughened Surface\n// for Ray Reflection\" by T. S. Trowbridge, and K. P. Reitz\n// Follows the distribution function recommended in the SIGGRAPH 2013 course notes\n// from EPIC Games [1], Equation 3.\nfloat microfacetDistribution(PBRInfo pbrInfo)\n{\n float roughnessSq = pbrInfo.alphaRoughness * pbrInfo.alphaRoughness;\n float f = (pbrInfo.NdotH * roughnessSq - pbrInfo.NdotH) * pbrInfo.NdotH + 1.0;\n return roughnessSq / (M_PI * f * f);\n}\n\nvoid PBRInfo_setAmbientLight(inout PBRInfo pbrInfo) {\n pbrInfo.NdotL = 1.0;\n pbrInfo.NdotH = 0.0;\n pbrInfo.LdotH = 0.0;\n pbrInfo.VdotH = 1.0;\n}\n\nvoid PBRInfo_setDirectionalLight(inout PBRInfo pbrInfo, vec3 lightDirection) {\n vec3 n = pbrInfo.n;\n vec3 v = pbrInfo.v;\n vec3 l = normalize(lightDirection); // Vector from surface point to light\n vec3 h = normalize(l+v); // Half vector between both l and v\n\n pbrInfo.NdotL = clamp(dot(n, l), 0.001, 1.0);\n pbrInfo.NdotH = clamp(dot(n, h), 0.0, 1.0);\n pbrInfo.LdotH = clamp(dot(l, h), 0.0, 1.0);\n pbrInfo.VdotH = clamp(dot(v, h), 0.0, 1.0);\n}\n\nvoid PBRInfo_setPointLight(inout PBRInfo pbrInfo, PointLight pointLight) {\n vec3 light_direction = normalize(pointLight.position - pbr_vPosition);\n PBRInfo_setDirectionalLight(pbrInfo, light_direction);\n}\n\nvec3 calculateFinalColor(PBRInfo pbrInfo, vec3 lightColor) {\n // Calculate the shading terms for the microfacet specular shading model\n vec3 F = specularReflection(pbrInfo);\n float G = geometricOcclusion(pbrInfo);\n float D = microfacetDistribution(pbrInfo);\n\n // Calculation of analytical lighting contribution\n vec3 diffuseContrib = (1.0 - F) * diffuse(pbrInfo);\n vec3 specContrib = F * G * D / (4.0 * pbrInfo.NdotL * pbrInfo.NdotV);\n // Obtain final intensity as reflectance (BRDF) scaled by the energy of the light (cosine law)\n return pbrInfo.NdotL * lightColor * (diffuseContrib + specContrib);\n}\n\nvec4 pbr_filterColor(vec4 colorUnused)\n{\n // The albedo may be defined from a base texture or a flat color\n#ifdef HAS_BASECOLORMAP\n vec4 baseColor = SRGBtoLINEAR(texture(pbr_baseColorSampler, pbr_vUV)) * pbrMaterial.baseColorFactor;\n#else\n vec4 baseColor = pbrMaterial.baseColorFactor;\n#endif\n\n#ifdef ALPHA_CUTOFF\n if (baseColor.a < pbrMaterial.alphaCutoff) {\n discard;\n }\n#endif\n\n vec3 color = vec3(0, 0, 0);\n\n if(pbrMaterial.unlit){\n color.rgb = baseColor.rgb;\n }\n else{\n // Metallic and Roughness material properties are packed together\n // In glTF, these factors can be specified by fixed scalar values\n // or from a metallic-roughness map\n float perceptualRoughness = pbrMaterial.metallicRoughnessValues.y;\n float metallic = pbrMaterial.metallicRoughnessValues.x;\n#ifdef HAS_METALROUGHNESSMAP\n // Roughness is stored in the 'g' channel, metallic is stored in the 'b' channel.\n // This layout intentionally reserves the 'r' channel for (optional) occlusion map data\n vec4 mrSample = texture(pbr_metallicRoughnessSampler, pbr_vUV);\n perceptualRoughness = mrSample.g * perceptualRoughness;\n metallic = mrSample.b * metallic;\n#endif\n perceptualRoughness = clamp(perceptualRoughness, c_MinRoughness, 1.0);\n metallic = clamp(metallic, 0.0, 1.0);\n // Roughness is authored as perceptual roughness; as is convention,\n // convert to material roughness by squaring the perceptual roughness [2].\n float alphaRoughness = perceptualRoughness * perceptualRoughness;\n\n vec3 f0 = vec3(0.04);\n vec3 diffuseColor = baseColor.rgb * (vec3(1.0) - f0);\n diffuseColor *= 1.0 - metallic;\n vec3 specularColor = mix(f0, baseColor.rgb, metallic);\n\n // Compute reflectance.\n float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);\n\n // For typical incident reflectance range (between 4% to 100%) set the grazing\n // reflectance to 100% for typical fresnel effect.\n // For very low reflectance range on highly diffuse objects (below 4%),\n // incrementally reduce grazing reflecance to 0%.\n float reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0);\n vec3 specularEnvironmentR0 = specularColor.rgb;\n vec3 specularEnvironmentR90 = vec3(1.0, 1.0, 1.0) * reflectance90;\n\n vec3 n = getNormal(); // normal at surface point\n vec3 v = normalize(pbrProjection.camera - pbr_vPosition); // Vector from surface point to camera\n\n float NdotV = clamp(abs(dot(n, v)), 0.001, 1.0);\n vec3 reflection = -normalize(reflect(v, n));\n\n PBRInfo pbrInfo = PBRInfo(\n 0.0, // NdotL\n NdotV,\n 0.0, // NdotH\n 0.0, // LdotH\n 0.0, // VdotH\n perceptualRoughness,\n metallic,\n specularEnvironmentR0,\n specularEnvironmentR90,\n alphaRoughness,\n diffuseColor,\n specularColor,\n n,\n v\n );\n\n\n#ifdef USE_LIGHTS\n // Apply ambient light\n PBRInfo_setAmbientLight(pbrInfo);\n color += calculateFinalColor(pbrInfo, lighting.ambientColor);\n\n // Apply directional light\n for(int i = 0; i < lighting.directionalLightCount; i++) {\n if (i < lighting.directionalLightCount) {\n PBRInfo_setDirectionalLight(pbrInfo, lighting_getDirectionalLight(i).direction);\n color += calculateFinalColor(pbrInfo, lighting_getDirectionalLight(i).color);\n }\n }\n\n // Apply point light\n for(int i = 0; i < lighting.pointLightCount; i++) {\n if (i < lighting.pointLightCount) {\n PBRInfo_setPointLight(pbrInfo, lighting_getPointLight(i));\n float attenuation = getPointLightAttenuation(lighting_getPointLight(i), distance(lighting_getPointLight(i).position, pbr_vPosition));\n color += calculateFinalColor(pbrInfo, lighting_getPointLight(i).color / attenuation);\n }\n }\n#endif\n\n // Calculate lighting contribution from image based lighting source (IBL)\n#ifdef USE_IBL\n if (pbrMaterial.IBLenabled) {\n color += getIBLContribution(pbrInfo, n, reflection);\n }\n#endif\n\n // Apply optional PBR terms for additional (optional) shading\n#ifdef HAS_OCCLUSIONMAP\n if (pbrMaterial.occlusionMapEnabled) {\n float ao = texture(pbr_occlusionSampler, pbr_vUV).r;\n color = mix(color, color * ao, pbrMaterial.occlusionStrength);\n }\n#endif\n\n#ifdef HAS_EMISSIVEMAP\n if (pbrMaterial.emissiveMapEnabled) {\n vec3 emissive = SRGBtoLINEAR(texture(pbr_emissiveSampler, pbr_vUV)).rgb * pbrMaterial.emissiveFactor;\n color += emissive;\n }\n#endif\n\n // This section uses mix to override final color for reference app visualization\n // of various parameters in the lighting equation.\n#ifdef PBR_DEBUG\n // TODO: Figure out how to debug multiple lights\n\n // color = mix(color, F, pbr_scaleFGDSpec.x);\n // color = mix(color, vec3(G), pbr_scaleFGDSpec.y);\n // color = mix(color, vec3(D), pbr_scaleFGDSpec.z);\n // color = mix(color, specContrib, pbr_scaleFGDSpec.w);\n\n // color = mix(color, diffuseContrib, pbr_scaleDiffBaseMR.x);\n color = mix(color, baseColor.rgb, pbrMaterial.scaleDiffBaseMR.y);\n color = mix(color, vec3(metallic), pbrMaterial.scaleDiffBaseMR.z);\n color = mix(color, vec3(perceptualRoughness), pbrMaterial.scaleDiffBaseMR.w);\n#endif\n\n }\n\n return vec4(pow(color,vec3(1.0/2.2)), baseColor.a);\n}\n`;\n//# sourceMappingURL=pbr-material-glsl.js.map","// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Attribution:\n// MIT license, Copyright (c) 2016-2017 Mohamad Moneimne and Contributors\n// This fragment shader defines a reference implementation for Physically Based Shading of\n// a microfacet surface material defined by a glTF model.\n// TODO - better do the checks outside of shader\nexport const pbrMaterialUniforms = /* wgsl */ `\\\nuniform Projection {\n // Projection\n vec3 u_Camera;\n};\n\nuniform pbrMaterialUniforms {\n // Material is unlit\n bool unlit;\n\n // Base color map\n bool baseColorMapEnabled;\n vec4 baseColorFactor;\n\n bool normalMapEnabled; \n float normalScale; // #ifdef HAS_NORMALMAP\n\n bool emissiveMapEnabled;\n vec3 emissiveFactor; // #ifdef HAS_EMISSIVEMAP\n\n vec2 metallicRoughnessValues;\n bool metallicRoughnessMapEnabled;\n\n bool occlusionMapEnabled;\n float occlusionStrength; // #ifdef HAS_OCCLUSIONMAP\n \n bool alphaCutoffEnabled;\n float alphaCutoff; // #ifdef ALPHA_CUTOFF\n \n // IBL\n bool IBLenabled;\n vec2 scaleIBLAmbient; // #ifdef USE_IBL\n \n // debugging flags used for shader output of intermediate PBR variables\n // #ifdef PBR_DEBUG\n vec4 scaleDiffBaseMR;\n vec4 scaleFGDSpec;\n // #endif\n};\n\n// Samplers\n#ifdef HAS_BASECOLORMAP\nuniform sampler2D u_BaseColorSampler;\n#endif\n#ifdef HAS_NORMALMAP\nuniform sampler2D u_NormalSampler;\n#endif\n#ifdef HAS_EMISSIVEMAP\nuniform sampler2D u_EmissiveSampler;\n#endif\n#ifdef HAS_METALROUGHNESSMAP\nuniform sampler2D u_MetallicRoughnessSampler;\n#endif\n#ifdef HAS_OCCLUSIONMAP\nuniform sampler2D u_OcclusionSampler;\n#endif\n#ifdef USE_IBL\nuniform samplerCube u_DiffuseEnvSampler;\nuniform samplerCube u_SpecularEnvSampler;\nuniform sampler2D u_brdfLUT;\n#endif\n\n`;\nexport const source = /* wgsl */ `\\\nstruct PBRFragmentInputs {\n pbr_vPosition: vec3f,\n pbr_vUV: vec2f,\n pbr_vTBN: mat3f,\n pbr_vNormal: vec3f\n};\n\nvar fragmentInputs: PBRFragmentInputs;\n\nfn pbr_setPositionNormalTangentUV(position: vec4f, normal: vec4f, tangent: vec4f, uv: vec2f)\n{\n var pos: vec4f = pbrProjection.modelMatrix * position;\n pbr_vPosition = vec3(pos.xyz) / pos.w;\n\n#ifdef HAS_NORMALS\n#ifdef HAS_TANGENTS\n let normalW: vec3f = normalize(vec3(pbrProjection.normalMatrix * vec4(normal.xyz, 0.0)));\n let tangentW: vec3f = normalize(vec3(pbrProjection.modelMatrix * vec4(tangent.xyz, 0.0)));\n let bitangentW: vec3f = cross(normalW, tangentW) * tangent.w;\n fragmentInputs,pbr_vTBN = mat3(tangentW, bitangentW, normalW);\n#else // HAS_TANGENTS != 1\n fragmentInputs.pbr_vNormal = normalize(vec3(pbrProjection.modelMatrix * vec4(normal.xyz, 0.0)));\n#endif\n#endif\n\n#ifdef HAS_UV\n pbr_vUV = uv;\n#else\n pbr_vUV = vec2(0.,0.);\n#endif\n}\n\nstruct pbrMaterialUniforms {\n // Material is unlit\n unlit: uint32,\n\n // Base color map\n baseColorMapEnabled: uint32,\n baseColorFactor: vec4f,\n\n normalMapEnabled : uint32,\n normalScale: f32, // #ifdef HAS_NORMALMAP\n\n emissiveMapEnabled: uint32,\n emissiveFactor: vec3f, // #ifdef HAS_EMISSIVEMAP\n\n metallicRoughnessValues: vec2f,\n metallicRoughnessMapEnabled: uint32,\n\n occlusionMapEnabled: i32,\n occlusionStrength: f32, // #ifdef HAS_OCCLUSIONMAP\n \n alphaCutoffEnabled: i32,\n alphaCutoff: f32, // #ifdef ALPHA_CUTOFF\n \n // IBL\n IBLenabled: i32,\n scaleIBLAmbient: vec2f, // #ifdef USE_IBL\n \n // debugging flags used for shader output of intermediate PBR variables\n // #ifdef PBR_DEBUG\n scaleDiffBaseMR: vec4f,\n scaleFGDSpec: vec4f\n // #endif\n} \n \n@binding(2) @group(0) var<uniform> material : pbrMaterialUniforms;\n\n// Samplers\n#ifdef HAS_BASECOLORMAP\nuniform sampler2D pbr_baseColorSampler;\n#endif\n#ifdef HAS_NORMALMAP\nuniform sampler2D pbr_normalSampler;\n#endif\n#ifdef HAS_EMISSIVEMAP\nuniform sampler2D pbr_emissiveSampler;\n#endif\n#ifdef HAS_METALROUGHNESSMAP\nuniform sampler2D pbr_metallicRoughnessSampler;\n#endif\n#ifdef HAS_OCCLUSIONMAP\nuniform sampler2D pbr_occlusionSampler;\n#endif\n#ifdef USE_IBL\nuniform samplerCube pbr_diffuseEnvSampler;\nuniform samplerCube pbr_specularEnvSampler;\nuniform sampler2D pbr_brdfLUT;\n#endif\n\n// Encapsulate the various inputs used by the various functions in the shading equation\n// We store values in this struct to simplify the integration of alternative implementations\n// of the shading terms, outlined in the Readme.MD Appendix.\nstruct PBRInfo {\n NdotL: f32, // cos angle between normal and light direction\n NdotV: f32, // cos angle between normal and view direction\n NdotH: f32, // cos angle between normal and half vector\n LdotH: f32, // cos angle between light direction and half vector\n VdotH: f32, // cos angle between view direction and half vector\n perceptualRoughness: f32, // roughness value, as authored by the model creator (input to shader)\n metalness: f32, // metallic value at the surface\n reflectance0: vec3f, // full reflectance color (normal incidence angle)\n reflectance90: vec3f, // reflectance color at grazing angle\n alphaRoughness: f32, // roughness mapped to a more linear change in the roughness (proposed by [2])\n diffuseColor: vec3f, // color contribution from diffuse lighting\n specularColor: vec3f, // color contribution from specular lighting\n n: vec3f, // normal at surface point\n v: vec3f, // vector from surface point to camera\n};\n\nconst M_PI = 3.141592653589793;\nconst c_MinRoughness = 0.04;\n\nfn SRGBtoLINEAR(srgbIn: vec4f ) -> vec4f\n{\n#ifdef MANUAL_SRGB\n#ifdef SRGB_FAST_APPROXIMATION\n var linOut: vec3f = pow(srgbIn.xyz,vec3(2.2));\n#else // SRGB_FAST_APPROXIMATION\n var bLess: vec3f = step(vec3(0.04045),srgbIn.xyz);\n var linOut: vec3f = mix( srgbIn.xyz/vec3(12.92), pow((srgbIn.xyz+vec3(0.055))/vec3(1.055),vec3(2.4)), bLess );\n#endif //SRGB_FAST_APPROXIMATION\n return vec4f(linOut,srgbIn.w);;\n#else //MANUAL_SRGB\n return srgbIn;\n#endif //MANUAL_SRGB\n}\n\n// Find the normal for this fragment, pulling either from a predefined normal map\n// or from the interpolated mesh normal and tangent attributes.\nfn getNormal() -> vec3f\n{\n // Retrieve the tangent space matrix\n#ifndef HAS_TANGENTS\n var pos_dx: vec3f = dFdx(pbr_vPosition);\n var pos_dy: vec3f = dFdy(pbr_vPosition);\n var tex_dx: vec3f = dFdx(vec3(pbr_vUV, 0.0));\n var tex_dy: vec3f = dFdy(vec3(pbr_vUV, 0.0));\n var t: vec3f = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);\n\n#ifdef HAS_NORMALS\n var ng: vec3f = normalize(pbr_vNormal);\n#else\n var ng: vec3f = cross(pos_dx, pos_dy);\n#endif\n\n t = normalize(t - ng * dot(ng, t));\n var b: vec3f = normalize(cross(ng, t));\n var tbn: mat3f = mat3f(t, b, ng);\n#else // HAS_TANGENTS\n var tbn: mat3f = pbr_vTBN;\n#endif\n\n#ifdef HAS_NORMALMAP\n vec3 n = texture(pbr_normalSampler, pbr_vUV).rgb;\n n = normalize(tbn * ((2.0 * n - 1.0) * vec3(pbrMaterial.normalScale, pbrMaterial.normalScale, 1.0)));\n#else\n // The tbn matrix is linearly interpolated, so we need to re-normalize\n vec3 n = normalize(tbn[2].xyz);\n#endif\n\n return n;\n}\n\n// Calculation of the lighting contribution from an optional Image Based Light source.\n// Precomputed Environment Maps are required uniform inputs and are computed as outlined in [1].\n// See our README.md on Environment Maps [3] for additional discussion.\n#ifdef USE_IBL\nfn getIBLContribution(PBRInfo pbrInfo, vec3 n, vec3 reflection) -> vec3f\n{\n float mipCount = 9.0; // resolution of 512x512\n float lod = (pbrInfo.perceptualRoughness * mipCount);\n // retrieve a scale and bias to F0. See [1], Figure 3\n vec3 brdf = SRGBtoLINEAR(texture(pbr_brdfLUT,\n vec2(pbrInfo.NdotV, 1.0 - pbrInfo.perceptualRoughness))).rgb;\n vec3 diffuseLight = SRGBtoLINEAR(texture(pbr_diffuseEnvSampler, n)).rgb;\n\n#ifdef USE_TEX_LOD\n vec3 specularLight = SRGBtoLINEAR(texture(pbr_specularEnvSampler, reflection, lod)).rgb;\n#else\n vec3 specularLight = SRGBtoLINEAR(texture(pbr_specularEnvSampler, reflection)).rgb;\n#endif\n\n vec3 diffuse = diffuseLight * pbrInfo.diffuseColor;\n vec3 specular = specularLight * (pbrInfo.specularColor * brdf.x + brdf.y);\n\n // For presentation, this allows us to disable IBL terms\n diffuse *= pbrMaterial.scaleIBLAmbient.x;\n specular *= pbrMaterial.scaleIBLAmbient.y;\n\n return diffuse + specular;\n}\n#endif\n\n// Basic Lambertian diffuse\n// Implementation from Lambert's Photometria https://archive.org/details/lambertsphotome00lambgoog\n// See also [1], Equation 1\nfn diffuse(pbrInfo: PBRInfo) -> vec3<f32> {\n return pbrInfo.diffuseColor / PI;\n}\n\n// The following equation models the Fresnel reflectance term of the spec equation (aka F())\n// Implementation of fresnel from [4], Equation 15\nfn specularReflection(pbrInfo: PBRInfo) -> vec3<f32> {\n return pbrInfo.reflectance0 +\n (pbrInfo.reflectance90 - pbrInfo.reflectance0) *\n pow(clamp(1.0 - pbrInfo.VdotH, 0.0, 1.0), 5.0);\n}\n\n// This calculates the specular geometric attenuation (aka G()),\n// where rougher material will reflect less light back to the viewer.\n// This implementation is based on [1] Equation 4, and we adopt their modifications to\n// alphaRoughness as input as originally proposed in [2].\nfn geometricOcclusion(pbrInfo: PBRInfo) -> f32 {\n let NdotL: f32 = pbrInfo.NdotL;\n let NdotV: f32 = pbrInfo.NdotV;\n let r: f32 = pbrInfo.alphaRoughness;\n\n let attenuationL = 2.0 * NdotL / (NdotL + sqrt(r * r + (1.0 - r * r) * (NdotL * NdotL)));\n let attenuationV = 2.0 * NdotV / (NdotV + sqrt(r * r + (1.0 - r * r) * (NdotV * NdotV)));\n return attenuationL * attenuationV;\n}\n\n// The following equation(s) model the distribution of microfacet normals across\n// the area being drawn (aka D())\n// Implementation from \"Average Irregularity Representation of a Roughened Surface\n// for Ray Reflection\" by T. S. Trowbridge, and K. P. Reitz\n// Follows the distribution function recommended in the SIGGRAPH 2013 course notes\n// from EPIC Games [1], Equation 3.\nfn microfacetDistribution(pbrInfo: PBRInfo) -> f32 {\n let roughnessSq = pbrInfo.alphaRoughness * pbrInfo.alphaRoughness;\n let f = (pbrInfo.NdotH * roughnessSq - pbrInfo.NdotH) * pbrInfo.NdotH + 1.0;\n return roughnessSq / (PI * f * f);\n}\n\nfn PBRInfo_setAmbientLight(pbrInfo: ptr<function, PBRInfo>) {\n (*pbrInfo).NdotL = 1.0;\n (*pbrInfo).NdotH = 0.0;\n (*pbrInfo).LdotH = 0.0;\n (*pbrInfo).VdotH = 1.0;\n}\n\nfn PBRInfo_setDirectionalLight(pbrInfo: ptr<function, PBRInfo>, lightDirection: vec3<f32>) {\n let n = (*pbrInfo).n;\n let v = (*pbrInfo).v;\n let l = normalize(lightDirection); // Vector from surface point to light\n let h = normalize(l + v); // Half vector between both l and v\n\n (*pbrInfo).NdotL = clamp(dot(n, l), 0.001, 1.0);\n (*pbrInfo).NdotH = clamp(dot(n, h), 0.0, 1.0);\n (*pbrInfo).LdotH = clamp(dot(l, h), 0.0, 1.0);\n (*pbrInfo).VdotH = clamp(dot(v, h), 0.0, 1.0);\n}\n\nfn PBRInfo_setPointLight(pbrInfo: ptr<function, PBRInfo>, pointLight: PointLight) {\n let light_direction = normalize(pointLight.position - pbr_vPosition);\n PBRInfo_setDirectionalLight(pbrInfo, light_direction);\n}\n\nfn calculateFinalColor(pbrInfo: PBRInfo, lightColor: vec3<f32>) -> vec3<f32> {\n // Calculate the shading terms for the microfacet specular shading model\n let F = specularReflection(pbrInfo);\n let G = geometricOcclusion(pbrInfo);\n let D = microfacetDistribution(pbrInfo);\n\n // Calculation of analytical lighting contribution\n let diffuseContrib = (1.0 - F) * diffuse(pbrInfo);\n let specContrib = F * G * D / (4.0 * pbrInfo.NdotL * pbrInfo.NdotV);\n // Obtain final intensity as reflectance (BRDF) scaled by the energy of the light (cosine law)\n return pbrInfo.NdotL * lightColor * (diffuseContrib + specContrib);\n}\n\nfn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {\n // The albedo may be defined from a base texture or a flat color\n var baseColor: vec4<f32>;\n #ifdef HAS_BASECOLORMAP\n baseColor = SRGBtoLINEAR(textureSample(pbr_baseColorSampler, pbr_baseColorSampler, pbr_vUV)) * pbrMaterial.baseColorFactor;\n #else\n baseColor = pbrMaterial.baseColorFactor;\n #endif\n\n #ifdef ALPHA_CUTOFF\n if (baseColor.a < pbrMaterial.alphaCutoff) {\n discard;\n }\n #endif\n\n var color = vec3<f32>(0.0, 0.0, 0.0);\n\n if (pbrMaterial.unlit) {\n color = baseColor.rgb;\n } else {\n // Metallic and Roughness material properties are packed together\n // In glTF, these factors can be specified by fixed scalar values\n // or from a metallic-roughness map\n var perceptualRoughness = pbrMaterial.metallicRoughnessValues.y;\n var metallic = pbrMaterial.metallicRoughnessValues.x;\n #ifdef HAS_METALROUGHNESSMAP\n // Roughness is stored in the 'g' channel, metallic is stored in the 'b' channel.\n // This layout intentionally reserves the 'r' channel for (optional) occlusion map data\n let mrSample = textureSample(pbr_metallicRoughnessSampler, pbr_metallicRoughnessSampler, pbr_vUV);\n perceptualRoughness = mrSample.g * perceptualRoughness;\n metallic = mrSample.b * metallic;\n #endif\n perceptualRoughness = clamp(perceptualRoughness, c_MinRoughness, 1.0);\n metallic = clamp(metallic, 0.0, 1.0);\n // Roughness is authored as perceptual roughness; as is convention,\n // convert to material roughness by squaring the perceptual roughness [2].\n let alphaRoughness = perceptualRoughness * perceptualRoughness;\n\n let f0 = vec3<f32>(0.04);\n var diffuseColor = baseColor.rgb * (vec3<f32>(1.0) - f0);\n diffuseColor *= 1.0 - metallic;\n let specularColor = mix(f0, baseColor.rgb, metallic);\n\n // Compute reflectance.\n let reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);\n\n // For typical incident reflectance range (between 4% to 100%) set the grazing\n // reflectance to 100% for typical fresnel effect.\n // For very low reflectance range on highly diffuse objects (below 4%),\n // incrementally reduce grazing reflectance to 0%.\n let reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0);\n let specularEnvironmentR0 = specularColor;\n let specularEnvironmentR90 = vec3<f32>(1.0, 1.0, 1.0) * reflectance90;\n\n let n = getNormal(); // normal at surface point\n let v = normalize(pbrProjection.camera - pbr_vPosition); // Vector from surface point to camera\n\n let NdotV = clamp(abs(dot(n, v)), 0.001, 1.0);\n let reflection = -normalize(reflect(v, n));\n\n var pbrInfo = PBRInfo(\n 0.0, // NdotL\n NdotV,\n 0.0, // NdotH\n 0.0, // LdotH\n 0.0, // VdotH\n perceptualRoughness,\n metallic,\n specularEnvironmentR0,\n specularEnvironmentR90,\n alphaRoughness,\n diffuseColor,\n specularColor,\n n,\n v\n );\n\n #ifdef USE_LIGHTS\n // Apply ambient light\n PBRInfo_setAmbientLight(&pbrInfo);\n color += calculateFinalColor(pbrInfo, lighting.ambientColor);\n\n // Apply directional light\n for (var i = 0; i < lighting.directionalLightCount; i++) {\n if (i < lighting.directionalLightCount) {\n PBRInfo_setDirectionalLight(&pbrInfo, lighting_getDirectionalLight(i).direction);\n color += calculateFinalColor(pbrInfo, lighting_getDirectionalLight(i).color);\n }\n }\n\n // Apply point light\n for (var i = 0; i < lighting.pointLightCount; i++) {\n if (i < lighting.pointLightCount) {\n PBRInfo_setPointLight(&pbrInfo, lighting_getPointLight(i));\n let attenuation = getPointLightAttenuation(lighting_getPointLight(i), distance(lighting_getPointLight(i).position, pbr_vPosition));\n color += calculateFinalColor(pbrInfo, lighting_getPointLight(i).color / attenuation);\n }\n }\n #endif\n\n // Calculate lighting contribution from image based lighting source (IBL)\n #ifdef USE_IBL\n if (pbrMaterial.IBLenabled) {\n color += getIBLContribution(pbrInfo, n, reflection);\n }\n #endif\n\n // Apply optional PBR terms for additional (optional) shading\n #ifdef HAS_OCCLUSIONMAP\n if (pbrMaterial.occlusionMapEnabled) {\n let ao = textureSample(pbr_occlusionSampler, pbr_occlusionSampler, pbr_vUV).r;\n color = mix(color, color * ao, pbrMaterial.occlusionStrength);\n }\n #endif\n\n #ifdef HAS_EMISSIVEMAP\n if (pbrMaterial.emissiveMapEnabled) {\n let emissive = SRGBtoLINEAR(textureSample(pbr_emissiveSampler, pbr_emissiveSampler, pbr_vUV)).rgb * pbrMaterial.emissiveFactor;\n color += emissive;\n }\n #endif\n\n // This section uses mix to override final color for reference app visualization\n // of various parameters in the lighting equation.\n #ifdef PBR_DEBUG\n // TODO: Figure out how to debug multiple lights\n\n // color = mix(color, F, pbr_scaleFGDSpec.x);\n // color = mix(color, vec3(G), pbr_scaleFGDSpec.y);\n // color = mix(color, vec3(D), pbr_scaleFGDSpec.z);\n // color = mix(color, specContrib, pbr_scaleFGDSpec.w);\n\n // color = mix(color, diffuseContrib, pbr_scaleDiffBaseMR.x);\n color = mix(color, baseColor.rgb, pbrMaterial.scaleDiffBaseMR.y);\n color = mix(color, vec3<f32>(metallic), pbrMaterial.scaleDiffBaseMR.z);\n color = mix(color, vec3<f32>(perceptualRoughness), pbrMaterial.scaleDiffBaseMR.w);\n #endif\n }\n\n return vec4<f32>(pow(color, vec3<f32>(1.0 / 2.2)), baseColor.a);\n}\n`;\n//# sourceMappingURL=pbr-material-wgsl.js.map","// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nconst uniformBlock = /* glsl */ `\\\nuniform pbrProjectionUniforms {\n mat4 modelViewProjectionMatrix;\n mat4 modelMatrix;\n mat4 normalMatrix;\n vec3 camera;\n} pbrProjection;\n`;\nexport const pbrProjection = {\n name: 'pbrProjection',\n vs: uniformBlock,\n fs: uniformBlock,\n // TODO why is this needed?\n getUniforms: props => props,\n uniformTypes: {\n modelViewProjectionMatrix: 'mat4x4<f32>',\n modelMatrix: 'mat4x4<f32>',\n normalMatrix: 'mat4x4<f32>',\n camera: 'vec3<i32>'\n }\n};\n//# sourceMappingURL=pbr-projection.js.map","// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { lighting } from \"../lights/lighting.js\";\nimport { vs, fs } from \"./pbr-material-glsl.js\";\nimport { source } from \"./pbr-material-wgsl.js\";\nimport { pbrProjection } from \"./pbr-projection.js\";\n/**\n * An implementation of PBR (Physically-Based Rendering).\n * Physically Based Shading of a microfacet surface defined by a glTF material.\n */\nexport const pbrMaterial = {\n props: {},\n uniforms: {},\n name: 'pbrMaterial',\n dependencies: [lighting, pbrProjection],\n source,\n vs,\n fs,\n defines: {\n LIGHTING_FRAGMENT: true,\n HAS_NORMALMAP: false,\n HAS_EMISSIVEMAP: false,\n HAS_OCCLUSIONMAP: false,\n HAS_BASECOLORMAP: false,\n HAS_METALROUGHNESSMAP: false,\n ALPHA_CUTOFF: false,\n USE_IBL: false,\n PBR_DEBUG: false\n },\n getUniforms: props => props,\n uniformTypes: {\n // Material is unlit\n unlit: 'i32',\n // Base color map\n baseColorMapEnabled: 'i32',\n baseColorFactor: 'vec4<f32>',\n normalMapEnabled: 'i32',\n normalScale: 'f32', // #ifdef HAS_NORMALMAP\n emissiveMapEnabled: 'i32',\n emissiveFactor: 'vec3<f32>', // #ifdef HAS_EMISSIVEMAP\n metallicRoughnessValues: 'vec2<f32>',\n metallicRoughnessMapEnabled: 'i32',\n occlusionMapEnabled: 'i32',\n occlusionStrength: 'f32', // #ifdef HAS_OCCLUSIONMAP\n alphaCutoffEnabled: 'i32',\n alphaCutoff: 'f32', // #ifdef ALPHA_CUTOFF\n // IBL\n IBLenabled: 'i32',\n scaleIBLAmbient: 'vec2<f32>', // #ifdef USE_IBL\n // debugging flags used for shader output of intermediate PBR variables\n // #ifdef PBR_DEBUG\n scaleDiffBaseMR: 'vec4<f32>',\n scaleFGDSpec: 'vec4<f32>'\n }\n};\n//# sourceMappingURL=pbr-material.js.map","// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Vector3, Matrix4 } from '@math.gl/core';\nimport { uid } from \"../utils/uid.js\";\nexport class ScenegraphNode {\n id;\n matrix = new Matrix4();\n display = true;\n position = new Vector3();\n rotation = new Vector3();\n scale = new Vector3(1, 1, 1);\n userData = {};\n props = {};\n constructor(props = {}) {\n const { id } = props;\n this.id = id || uid(this.constructor.name);\n this._setScenegraphNodeProps(props);\n }\n getBounds() {\n return null;\n }\n destroy() { }\n /** @deprecated use .destroy() */\n delete() {\n this.destroy();\n }\n setProps(props) {\n this._setScenegraphNodeProps(props);\n return this;\n }\n toString() {\n return `{type: ScenegraphNode, id: ${this.id})}`;\n }\n setPosition(position) {\n // assert(position.length === 3, 'setPosition requires vector argument');\n this.position = position;\n return this;\n }\n setRotation(rotation) {\n // assert(rotation.length === 3, 'setRotation requires vector argument');\n this.rotation = rotation;\n return this;\n }\n setScale(scale) {\n // assert(scale.length === 3, 'setScale requires vector argument');\n this.scale = scale;\n return this;\n }\n setMatrix(matrix, copyMatrix = true) {\n if (copyMatrix) {\n this.matrix.copy(matrix);\n }\n else {\n this.matrix = matrix;\n }\n }\n setMatrixComponents(components) {\n const { position, rotation, scale, update = true } = components;\n if (position) {\n this.setPosition(position);\n }\n if (rotation) {\n this.setRotation(rotation);\n }\n if (scale) {\n this.setScale(scale);\n }\n if (update) {\n this.updateMatrix();\n }\n return this;\n }\n updateMatrix() {\n const pos = this.position;\n const rot = this.rotation;\n const scale = this.scale;\n this.matrix.identity();\n this.matrix.translate(pos);\n this.matrix.rotateXYZ(rot);\n this.matrix.scale(scale);\n return this;\n }\n update(options = {}) {\n const { position, rotation, scale } = options;\n if (position) {\n this.setPosition(position);\n }\n if (rotation) {\n this.setRotation(rotation);\n }\n if (scale) {\n this.setScale(scale);\n }\n this.updateMatrix();\n return this;\n }\n getCoordinateUniforms(viewMatrix, modelMatrix) {\n // TODO - solve multiple class problem\n // assert(viewMatrix instanceof Matrix4);\n // assert(viewMatrix);\n modelMatrix = modelMatrix || this.matrix;\n const worldMatrix = new Matrix4(viewMatrix).multiplyRight(modelMatrix);\n const worldInverse = worldMatrix.invert();\n const worldInverseTranspose = worldInverse.transpose();\n return {\n viewMatrix,\n modelMatrix,\n objectMatrix: modelMatrix,\n worldMatrix,\n worldInverseMatrix: worldInverse,\n worldInverseTransposeMatrix: worldInverseTranspose\n };\n }\n // TODO - copied code, not yet vetted\n /*\n transform() {\n if (!this.parent) {\n this.endPosition.set(this.position);\n this.endRotation.set(this.rotation);\n this.endScale.set(this.scale);\n } else {\n const parent = this.parent;\n this.endPosition.set(this.position.add(parent.endPosition));\n this.endRotation.set(this.rotation.add(parent.endRotation));\n this.endScale.set(this.scale.add(parent.endScale));\n }\n \n const ch = this.children;\n for (let i = 0; i < ch.length; ++i) {\n ch[i].transform();\n }\n \n return this;\n }\n */\n _setScenegraphNodeProps(props) {\n // if ('display' in props) {\n // this.display = props.display;\n // }\n if ('position' in props) {\n this.setPosition(props.position);\n }\n if ('rotation' in props) {\n this.setRotation(props.rotation);\n }\n if ('scale' in props) {\n this.setScale(props.scale);\n }\n // Matrix overwrites other props\n if ('matrix' in props) {\n this.setMatrix(props.matrix);\n }\n Object.assign(this.props, props);\n }\n}\n//# sourceMappingURL=scenegraph-node.js.map","// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Matrix4, Vector3 } from '@math.gl/core';\nimport { log } from '@luma.gl/core';\nimport { ScenegraphNode } from \"./scenegraph-node.js\";\nexport class GroupNode extends ScenegraphNode {\n children;\n constructor(props = {}) {\n props = Array.isArray(props) ? { children: props } : props;\n const { children = [] } = props;\n log.assert(children.every(child => child instanceof ScenegraphNode), 'every child must an instance of ScenegraphNode');\n super(props);\n this.children = children;\n }\n getBounds() {\n const result = [\n [Infinity, Infinity, Infinity],\n [-Infinity, -Infinity, -Infinity]\n ];\n this.traverse((node, { worldMatrix }) => {\n const bounds = node.getBounds();\n if (!bounds) {\n return;\n }\n const [min, max] = bounds;\n const center = new Vector3(min).add(max).divide([2, 2, 2]);\n worldMatrix.transformAsPoint(center, center);\n const halfSize = new Vector3(max).subtract(min).divide([2, 2, 2]);\n worldMatrix.transformAsVector(halfSize, halfSize);\n for (let v = 0; v < 8; v++) {\n // Test all 8 corners of the box\n const position = new Vector3(v & 0b001 ? -1 : 1, v & 0b010 ? -1 : 1, v & 0b100 ? -1 : 1)\n .multiply(halfSize)\n .add(center);\n for (let i = 0; i < 3; i++) {\n result[0][i] = Math.min(result[0][i], position[i]);\n result[1][i] = Math.max(result[1][i], position[i]);\n }\n }\n });\n if (!Number.isFinite(result[0][0])) {\n return null;\n }\n return result;\n }\n destroy() {\n this.children.forEach(child => child.destroy());\n this.removeAll();\n super.destroy();\n }\n // Unpacks arrays and nested arrays of children\n add(...children) {\n for (const child of children) {\n if (Array.isArray(child)) {\n this.add(...child);\n }\n else {\n this.children.push(child);\n }\n }\n return this;\n }\n remove(child) {\n const children = this.children;\n const indexOf = children.indexOf(child);\n if (indexOf > -1) {\n children.splice(indexOf, 1);\n }\n return this;\n }\n removeAll() {\n this.children = [];\n return this;\n }\n traverse(visitor, { worldMatrix = new Matrix4() } = {}) {\n const modelMatrix = new Matrix4(worldMatrix).multiplyRight(this.matrix);\n for (const child of this.children) {\n if (child instanceof GroupNode) {\n child.traverse(visitor, { worldMatrix: modelMatrix });\n }\n else {\n visitor(child, { worldMatrix: modelMatrix });\n }\n }\n }\n}\n//# sourceMappingURL=group-node.js.map","// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { ScenegraphNode } from \"./scenegraph-node.js\";\nexport class ModelNode extends ScenegraphNode {\n model;\n bounds = null;\n managedResources;\n // TODO - is this used? override callbacks to make sure we call them with this\n // onBeforeRender = null;\n // onAfterRender = null;\n // AfterRender = null;\n constructor(props) {\n super(props);\n // Create new Model or used supplied Model\n this.model = props.model;\n this.managedResources = props.managedResources || [];\n this.bounds = props.bounds || null;\n this.setProps(props);\n }\n destroy() {\n if (this.model) {\n this.model.destroy();\n // @ts-expect-error\n this.model = null;\n }\n this.managedResources.forEach(resource => resource.destroy());\n this.managedResources = [];\n }\n getBounds() {\n return this.bounds;\n }\n // Expose model methods\n draw(renderPass) {\n // Return value indicates if something was actually drawn\n return this.model.draw(renderPass);\n }\n}\n//# sourceMappingURL=model-node.js.map","// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { COORDINATE_SYSTEM, createIterable } from '@deck.gl/core';\n/* eslint-disable max-statements, complexity, camelcase */\nconst RADIAN_PER_DEGREE = Math.PI / 180;\nconst modelMatrix = new Float32Array(16);\nconst valueArray = new Float32Array(12);\nfunction calculateTransformMatrix(targetMatrix, orientation, scale) {\n const pitch = orientation[0] * RADIAN_PER_DEGREE;\n const yaw = orientation[1] * RADIAN_PER_DEGREE;\n const roll = orientation[2] * RADIAN_PER_DEGREE;\n const sr = Math.sin(roll);\n const sp = Math.sin(pitch);\n const sw = Math.sin(yaw);\n const cr = Math.cos(roll);\n const cp = Math.cos(pitch);\n const cw = Math.cos(yaw);\n const scx = scale[0];\n const scy = scale[1];\n const scz = scale[2];\n targetMatrix[0] = scx * cw * cp; // 0,0\n targetMatrix[1] = scx * sw * cp; // 1,0\n targetMatrix[2] = scx * -sp; // 2,0\n targetMatrix[3] = scy * (-sw * cr + cw * sp * sr); // 0,1\n targetMatrix[4] = scy * (cw * cr + sw * sp * sr); // 1,1\n targetMatrix[5] = scy * cp * sr; // 2,1\n targetMatrix[6] = scz * (sw * sr + cw * sp * cr); // 0,2\n targetMatrix[7] = scz * (-cw * sr + sw * sp * cr); // 1,2\n targetMatrix[8] = scz * cp * cr; // 2,2\n}\nfunction getExtendedMat3FromMat4(mat4) {\n mat4[0] = mat4[0];\n mat4[1] = mat4[1];\n mat4[2] = mat4[2];\n mat4[3] = mat4[4];\n mat4[4] = mat4[5];\n mat4[5] = mat4[6];\n mat4[6] = mat4[8];\n mat4[7] = mat4[9];\n mat4[8] = mat4[10];\n mat4[9] = mat4[12];\n mat4[10] = mat4[13];\n mat4[11] = mat4[14];\n return mat4.subarray(0, 12);\n}\nexport const MATRIX_ATTRIBUTES = {\n size: 12,\n accessor: ['getOrientation', 'getScale', 'getTranslation', 'getTransformMatrix'],\n shaderAttributes: {\n instanceModelMatrixCol0: {\n size: 3,\n elementOffset: 0\n },\n instanceModelMatrixCol1: {\n size: 3,\n elementOffset: 3\n },\n instanceModelMatrixCol2: {\n size: 3,\n elementOffset: 6\n },\n instanceTranslation: {\n size: 3,\n elementOffset: 9\n }\n },\n update(attribute, { startRow, endRow }) {\n // @ts-expect-error: \"this\" will be bound to a layer when this function is called\n const { data, getOrientation, getScale, getTranslation, getTransformMatrix } = this.props;\n const arrayMatrix = Array.isArray(getTransformMatrix);\n const constantMatrix = arrayMatrix && getTransformMatrix.length === 16;\n const constantScale = Array.isArray(getScale);\n const constantOrientation = Array.isArray(getOrientation);\n const constantTranslation = Array.isArray(getTranslation);\n const hasMatrix = constantMatrix || (!arrayMatrix && Boolean(getTransformMatrix(data[0])));\n if (hasMatrix) {\n attribute.constant = constantMatrix;\n }\n else {\n attribute.constant = constantOrientation && constantScale && constantTranslation;\n }\n const instanceModelMatrixData = attribute.value;\n if (attribute.constant) {\n let matrix;\n if (hasMatrix) {\n modelMatrix.set(getTransformMatrix);\n matrix = getExtendedMat3FromMat4(modelMatrix);\n }\n else {\n matrix = valueArray;\n const orientation = getOrientation;\n const scale = getScale;\n calculateTransformMatrix(matrix, orientation, scale);\n matrix.set(getTranslation, 9);\n }\n attribute.value = new Float32Array(matrix);\n }\n else {\n let i = startRow * attribute.size;\n const { iterable, objectInfo } = createIterable(data, startRow, endRow);\n for (const object of iterable) {\n objectInfo.index++;\n let matrix;\n if (hasMatrix) {\n modelMatrix.set(constantMatrix ? getTransformMatrix : getTransformMatrix(object, objectInfo));\n matrix = getExtendedMat3FromMat4(modelMatrix);\n }\n else {\n matrix = valueArray;\n const orientation = constantOrientation\n ? getOrientation\n : getOrientation(object, objectInfo);\n const scale = constantScale ? getScale : getScale(object, objectInfo);\n calculateTransformMatrix(matrix, orientation, scale);\n matrix.set(constantTranslation ? getTranslation : getTranslation(object, objectInfo), 9);\n }\n instanceModelMatrixData[i++] = matrix[0];\n instanceModelMatrixData[i++] = matrix[1];\n instanceModelMatrixData[i++] = matrix[2];\n instanceModelMatrixData[i++] = matrix[3];\n instanceModelMatrixData[i++] = matrix[4];\n instanceModelMatrixData[i++] = matrix[5];\n instanceModelMatrixData[i++] = matrix[6];\n instanceModelMatrixData[i++] = matrix[7];\n instanceModelMatrixData[i++] = matrix[8];\n instanceModelMatrixData[i++] = matrix[9];\n instanceModelMatrixData[i++] = matrix[10];\n instanceModelMatrixData[i++] = matrix[11];\n }\n }\n }\n};\n// only apply composeModelMatrix when in cartesian or meter_offsets coordinate system\n// with `composeModelMatrix` enabled, the rotation part of the layer's modelMatrix will be composed to instance's transformations\n// since rotating latitude and longitude can not provide meaningful results, hence `composeModelMatrix` is disabled\n// when in LNGLAT and LNGLAT_OFFSET coordinates.\nexport function shouldComposeModelMatrix(viewport, coordinateSystem) {\n return (coordinateSystem === COORDINATE_SYSTEM.CARTESIAN ||\n coordinateSystem === COORDINATE_SYSTEM.METER_OFFSETS ||\n (coordinateSystem === COORDINATE_SYSTEM.DEFAULT && !viewport.isGeospatial));\n}\n//# sourceMappingURL=matrix.js.map","// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nconst uniformBlock = `\\\nuniform simpleMeshUniforms {\n float sizeScale;\n bool composeModelMatrix;\n bool hasTexture;\n bool flatShading;\n} simpleMesh;\n`;\nexport const simpleMeshUniforms = {\n name: 'simpleMesh',\n vs: uniformBlock,\n fs: uniformBlock,\n uniformTypes: {\n sizeScale: 'f32',\n composeModelMatrix: 'f32',\n hasTexture: 'f32',\n flatShading: 'f32'\n }\n};\n//# sourceMappingURL=simple-mesh-layer-uniforms.js.map","// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport default `#version 300 es\n#define SHADER_NAME simple-mesh-layer-vs\nin vec3 positions;\nin vec3 normals;\nin vec3 colors;\nin vec2 texCoords;\nin vec3 instancePositions;\nin vec3 instancePositions64Low;\nin vec4 instanceColors;\nin vec3 instancePickingColors;\nin vec3 instanceModelMatrixCol0;\nin vec3 instanceModelMatrixCol1;\nin vec3 instanceModelMatrixCol2;\nin vec3 instanceTranslation;\nout vec2 vTexCoord;\nout vec3 cameraPosition;\nout vec3 normals_commonspace;\nout vec4 position_commonspace;\nout vec4 vColor;\nvoid main(void) {\ngeometry.worldPosition = instancePositions;\ngeometry.uv = texCoords;\ngeometry.pickingColor = instancePickingColors;\nvTexCoord = texCoords;\ncameraPosition = project.cameraPosition;\nvColor = vec4(colors * instanceColors.rgb, instanceColors.a);\nmat3 instanceModelMatrix = mat3(instanceModelMatrixCol0, instanceModelMatrixCol1, instanceModelMatrixCol2);\nvec3 pos = (instanceModelMatrix * positions) * simpleMesh.sizeScale + instanceTranslation;\nif (simpleMesh.composeModelMatrix) {\nDECKGL_FILTER_SIZE(pos, geometry);\nnormals_commonspace = project_normal(instanceModelMatrix * normals);\ngeometry.worldPosition += pos;\ngl_Position = project_position_to_clipspace(pos + instancePositions, instancePositions64Low, vec3(0.0), position_commonspace);\ngeometry.position = position_commonspace;\n}\nelse {\npos = project_size(pos);\nDECKGL_FILTER_SIZE(pos, geometry);\ngl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, pos, position_commonspace);\ngeometry.position = position_commonspace;\nnormals_commonspace = project_normal(instanceModelMatrix * normals);\n}\ngeometry.normal = normals_commonspace;\nDECKGL_FILTER_GL_POSITION(gl_Position, geometry);\nDECKGL_FILTER_COLOR(vColor, geometry);\n}\n`;\n//# sourceMappingURL=simple-mesh-layer-vertex.glsl.js.map","// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport default `#version 300 es\n#define SHADER_NAME simple-mesh-layer-fs\nprecision highp float;\nuniform sampler2D sampler;\nin vec2 vTexCoord;\nin vec3 cameraPosition;\nin vec3 normals_commonspace;\nin vec4 position_commonspace;\nin vec4 vColor;\nout vec4 fragColor;\nvoid main(void) {\ngeometry.uv = vTexCoord;\nvec3 normal;\nif (simpleMesh.flatShading) {\nnormal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));\n} else {\nnormal = normals_commonspace;\n}\nvec4 color = simpleMesh.hasTexture ? texture(sampler, vTexCoord) : vColor;\nDECKGL_FILTER_COLOR(color, geometry);\nvec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal);\nfragColor = vec4(lightColor, color.a * layer.opacity);\n}\n`;\n//# sourceMappingURL=simple-mesh-layer-fragment.glsl.js.map","// Note: This file will either be moved back to deck.gl or reformatted to web-monorepo standards\n// Disabling lint temporarily to facilitate copying code in and out of this repo\n/* eslint-disable */\n// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Layer, project32, picking, log } from '@deck.gl/core';\nimport { Texture } from '@luma.gl/core';\nimport { Model, Geometry } from '@luma.gl/engine';\nimport { phongMaterial } from '@luma.gl/shadertools';\nimport { MATRIX_ATTRIBUTES, shouldComposeModelMatrix } from \"../utils/matrix.js\";\nimport { simpleMeshUniforms } from \"./simple-mesh-layer-uniforms.js\";\nimport vs from \"./simple-mesh-layer-vertex.glsl.js\";\nimport fs from \"./simple-mesh-layer-fragment.glsl.js\";\nimport { getMeshBoundingBox } from '@loaders.gl/schema';\nfunction normalizeGeometryAttributes(attributes) {\n const positionAttribute = attributes.positions || attributes.POSITION;\n log.assert(positionAttribute, 'no \"postions\" or \"POSITION\" attribute in mesh');\n const vertexCount = positionAttribute.value.length / positionAttribute.size;\n let colorAttribute = attributes.COLOR_0 || attributes.colors;\n if (!colorAttribute) {\n colorAttribute = { size: 3, value: new Float32Array(vertexCount * 3).fill(1) };\n }\n let normalAttribute = attributes.NORMAL || attributes.normals;\n if (!normalAttribute) {\n normalAttribute = { size: 3, value: new Float32Array(vertexCount * 3).fill(0) };\n }\n let texCoordAttribute = attributes.TEXCOORD_0 || attributes.texCoords;\n if (!texCoordAttribute) {\n texCoordAttribute = { size: 2, value: new Float32Array(vertexCount * 2).fill(0) };\n }\n return {\n positions: positionAttribute,\n colors: colorAttribute,\n normals: normalAttribute,\n texCoords: texCoordAttribute\n };\n}\n/*\n * Convert mesh data into geometry\n * @returns {Geometry} geometry\n */\nfunction getGeometry(data) {\n if (data instanceof Geometry) {\n // @ts-expect-error data.attributes is readonly\n data.attributes = normalizeGeometryAttributes(data.attributes);\n return data;\n }\n else if (data.attributes) {\n return new Geometry({\n ...data,\n topology: 'triangle-list',\n attributes: normalizeGeometryAttributes(data.attributes)\n });\n }\n else {\n return new Geometry({\n topology: 'triangle-list',\n attributes: normalizeGeometryAttributes(data)\n });\n }\n}\nconst DEFAULT_COLOR = [0, 0, 0, 255];\nconst defaultProps = {\n mesh: { type: 'object', value: null, async: true },\n texture: { type: 'image', value: null, async: true },\n sizeScale: { type: 'number', value: 1, min: 0 },\n // _instanced is a hack to use world position instead of meter offsets in mesh\n // TODO - formalize API\n _instanced: true,\n // NOTE(Tarek): Quick and dirty wireframe. Just draws\n // the same mesh with LINE_STRIPS. Won't follow edges\n // of the original mesh.\n wireframe: false,\n // Optional material for 'lighting' shader module\n material: true,\n getPosition: { type: 'accessor', value: (x) => x.position },\n getColor: { type: 'accessor', value: DEFAULT_COLOR },\n // yaw, pitch and roll are in degrees\n // https://en.wikipedia.org/wiki/Euler_angles\n // [pitch, yaw, roll]\n getOrientation: { type: 'accessor', value: [0, 0, 0] },\n getScale: { type: 'accessor', value: [1, 1, 1] },\n getTranslation: { type: 'accessor', value: [0, 0, 0] },\n // 4x4 matrix\n getTransformMatrix: { type: 'accessor', value: [] },\n textureParameters: { type: 'object', ignore: true, value: null }\n};\n/** Render a number of instances of an arbitrary 3D geometry. */\nclass SimpleMeshLayer extends Layer {\n getShaders() {\n return super.getShaders({\n vs,\n fs,\n modules: [project32, phongMaterial, picking, simpleMeshUniforms]\n });\n }\n getBounds() {\n if (this.props._instanced) {\n return super.getBounds();\n }\n let result = this.state.positionBounds;\n if (result) {\n return result;\n }\n const { mesh } = this.props;\n if (!mesh) {\n return null;\n }\n // @ts-ignore Detect if mesh is generated by loaders.gl\n result = mesh.header?.boundingBox;\n if (!result) {\n // Otherwise, calculate bounding box from positions\n const { attributes } = getGeometry(mesh);\n attributes.POSITION = attributes.POSITION || attributes.positions;\n //@ts-expect-error\n result = getMeshBoundingBox(attributes);\n }\n this.state.positionBounds = result;\n return result;\n }\n initializeState() {\n const attributeManager = this.getAttributeManager();\n // attributeManager is always defined in a primitive layer\n attributeManager.addInstanced({\n instancePositions: {\n transition: true,\n type: 'float64',\n fp64: this.use64bitPositions(),\n size: 3,\n accessor: 'getPosition'\n },\n instanceColors: {\n type: 'unorm8',\n transition: true,\n size: this.props.colorFormat.length,\n accessor: 'getColor',\n defaultValue: [0, 0, 0, 255]\n },\n instanceModelMatrix: MATRIX_ATTRIBUTES\n });\n this.setState({\n // Avoid luma.gl's missing uniform warning\n // TODO - add feature to luma.gl to specify ignored uniforms?\n emptyTexture: this.context.device.createTexture({\n data: new Uint8Array(4),\n width: 1,\n height: 1\n })\n });\n }\n updateState(params) {\n super.updateState(params);\n const { props, oldProps, changeFlags } = params;\n if (props.mesh !== oldProps.mesh || changeFlags.extensionsChanged) {\n this.state.positionBounds = null;\n this.state.model?.destroy();\n if (props.mesh) {\n this.state.model = this.getModel(props.mesh);\n const attributes = props.mesh.attributes || props.mesh;\n this.setState({\n hasNormals: Boolean(attributes.NORMAL || attributes.normals)\n });\n }\n // attributeManager is always defined in a primitive layer\n this.getAttributeManager().invalidateAll();\n }\n if (props.texture !== oldProps.texture && props.texture instanceof Texture) {\n this.setTexture(props.texture);\n }\n if (this.state.model) {\n this.state.model.setTopology(this.props.wireframe ? 'line-strip' : 'triangle-list');\n }\n }\n finalizeState(context) {\n super.finalizeState(context);\n this.state.emptyTexture.delete();\n }\n draw({ uniforms }) {\n const { model } = this.state;\n if (!model) {\n return;\n }\n const { viewport, renderPass } = this.context;\n const { sizeScale, coordinateSystem, _instanced } = this.props;\n const simpleMeshProps = {\n sizeScale,\n composeModelMatrix: !_instanced || shouldComposeModelMatrix(viewport, coordinateSystem),\n flatShading: !this.state.hasNormals\n };\n model.shaderInputs.setProps({ simpleMesh: simpleMeshProps });\n model.draw(renderPass);\n }\n get isLoaded() {\n return Boolean(this.state?.model && super.isLoaded);\n }\n getModel(mesh) {\n const model = new Model(this.context.device, {\n ...this.getShaders(),\n id: this.props.id,\n bufferLayout: this.getAttributeManager().getBufferLayouts(),\n geometry: getGeometry(mesh),\n isInstanced: true\n });\n const { texture } = this.props;\n const { emptyTexture } = this.state;\n const simpleMeshProps = {\n sampler: texture || emptyTexture,\n hasTexture: Boolean(texture)\n };\n model.shaderInputs.setProps({ simpleMesh: simpleMeshProps });\n return model;\n }\n setTexture(texture) {\n const { emptyTexture, model } = this.state;\n // props.mesh may not be ready at this time.\n // The sampler will be set when `getModel` is called\n if (model) {\n const simpleMeshProps = {\n sampler: texture || emptyTexture,\n hasTexture: Boolean(texture)\n };\n model.shaderInputs.setProps({ simpleMesh: simpleMeshProps });\n }\n }\n}\nSimpleMeshLayer.defaultProps = defaultProps;\nSimpleMeshLayer.layerName = 'SimpleMeshLayer';\nexport default SimpleMeshLayer;\n//# sourceMappingURL=simple-mesh-layer.js.map","// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Version constant cannot be imported, it needs to correspond to the build version of **this** module.\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nexport const VERSION = typeof \"4.3.3\" !== 'undefined' ? \"4.3.3\" : 'latest';\n","// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { registerJSModules, getJSModuleOrNull } from '@loaders.gl/loader-utils';\nimport { loadLibrary } from '@loaders.gl/worker-utils';\nexport const BASIS_EXTERNAL_LIBRARIES = {\n /** Basis transcoder, javascript wrapper part */\n TRANSCODER: 'basis_transcoder.js',\n /** Basis transcoder, compiled web assembly part */\n TRANSCODER_WASM: 'basis_transcoder.wasm',\n /** Basis encoder, javascript wrapper part */\n ENCODER: 'basis_encoder.js',\n /** Basis encoder, compiled web assembly part */\n ENCODER_WASM: 'basis_encoder.wasm'\n};\nlet loadBasisTranscoderPromise;\n/**\n * Loads wasm transcoder module\n * @param options\n * @returns {BasisFile} promise\n */\nexport async function loadBasisTranscoderModule(options) {\n registerJSModules(options.modules);\n const basis = getJSModuleOrNull('basis');\n if (basis) {\n return basis;\n }\n loadBasisTranscoderPromise ||= loadBasisTranscoder(options);\n return await loadBasisTranscoderPromise;\n}\n/**\n * Loads wasm transcoder module\n * @param options\n * @returns {BasisFile} promise\n */\nasync function loadBasisTranscoder(options) {\n let BASIS = null;\n let wasmBinary = null;\n [BASIS, wasmBinary] = await Promise.all([\n await loadLibrary(BASIS_EXTERNAL_LIBRARIES.TRANSCODER, 'textures', options),\n await loadLibrary(BASIS_EXTERNAL_LIBRARIES.TRANSCODER_WASM, 'textures', options)\n ]);\n // Depends on how import happened...\n // @ts-ignore TS2339: Property does not exist on type\n BASIS = BASIS || globalThis.BASIS;\n return await initializeBasisTranscoderModule(BASIS, wasmBinary);\n}\n/**\n * Initialize wasm transcoder module\n * @param BasisModule - js part of the module\n * @param wasmBinary - wasm part of the module\n * @returns {BasisFile} promise\n */\nfunction initializeBasisTranscoderModule(BasisModule, wasmBinary) {\n const options = {};\n if (wasmBinary) {\n options.wasmBinary = wasmBinary;\n }\n return new Promise((resolve) => {\n // if you try to return BasisModule the browser crashes!\n BasisModule(options).then((module) => {\n const { BasisFile, initializeBasis } = module;\n initializeBasis();\n resolve({ BasisFile });\n });\n });\n}\nlet loadBasisEncoderPromise;\n/**\n * Loads wasm encoder module\n * @param options\n * @returns {BasisFile, KTX2File} promise\n */\nexport async function loadBasisEncoderModule(options) {\n const modules = options.modules || {};\n if (modules.basisEncoder) {\n return modules.basisEncoder;\n }\n loadBasisEncoderPromise = loadBasisEncoderPromise || loadBasisEncoder(options);\n return await loadBasisEncoderPromise;\n}\n/**\n * Loads wasm encoder module\n * @param options\n * @returns {BasisFile, KTX2File} promise\n */\nasync function loadBasisEncoder(options) {\n let BASIS_ENCODER = null;\n let wasmBinary = null;\n [BASIS_ENCODER, wasmBinary] = await Promise.all([\n await loadLibrary(BASIS_EXTERNAL_LIBRARIES.ENCODER, 'textures', options),\n await loadLibrary(BASIS_EXTERNAL_LIBRARIES.ENCODER_WASM, 'textures', options)\n ]);\n // Depends on how import happened...\n // @ts-ignore TS2339: Property does not exist on type\n BASIS_ENCODER = BASIS_ENCODER || globalThis.BASIS;\n return await initializeBasisEncoderModule(BASIS_ENCODER, wasmBinary);\n}\n/**\n * Initialize wasm transcoder module\n * @param BasisEncoderModule - js part of the module\n * @param wasmBinary - wasm part of the module\n * @returns {BasisFile, KTX2File} promise\n */\nfunction initializeBasisEncoderModule(BasisEncoderModule, wasmBinary) {\n const options = {};\n if (wasmBinary) {\n options.wasmBinary = wasmBinary;\n }\n return new Promise((resolve) => {\n // if you try to return BasisModule the browser crashes!\n BasisEncoderModule(options).then((module) => {\n const { BasisFile, KTX2File, initializeBasis, BasisEncoder } = module;\n initializeBasis();\n resolve({ BasisFile, KTX2File, BasisEncoder });\n });\n });\n}\n","// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/* eslint-disable camelcase */\nexport const GL_EXTENSIONS_CONSTANTS = {\n // WEBGL_compressed_texture_s3tc\n COMPRESSED_RGB_S3TC_DXT1_EXT: 0x83f0,\n COMPRESSED_RGBA_S3TC_DXT1_EXT: 0x83f1,\n COMPRESSED_RGBA_S3TC_DXT3_EXT: 0x83f2,\n COMPRESSED_RGBA_S3TC_DXT5_EXT: 0x83f3,\n // WEBGL_compressed_texture_es3\n COMPRESSED_R11_EAC: 0x9270,\n COMPRESSED_SIGNED_R11_EAC: 0x9271,\n COMPRESSED_RG11_EAC: 0x9272,\n COMPRESSED_SIGNED_RG11_EAC: 0x9273,\n COMPRESSED_RGB8_ETC2: 0x9274,\n COMPRESSED_RGBA8_ETC2_EAC: 0x9275,\n COMPRESSED_SRGB8_ETC2: 0x9276,\n COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: 0x9277,\n COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: 0x9278,\n COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: 0x9279,\n // WEBGL_compressed_texture_pvrtc\n COMPRESSED_RGB_PVRTC_4BPPV1_IMG: 0x8c00,\n COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: 0x8c02,\n COMPRESSED_RGB_PVRTC_2BPPV1_IMG: 0x8c01,\n COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: 0x8c03,\n // WEBGL_compressed_texture_etc1\n COMPRESSED_RGB_ETC1_WEBGL: 0x8d64,\n // WEBGL_compressed_texture_atc\n COMPRESSED_RGB_ATC_WEBGL: 0x8c92,\n COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL: 0x8c93,\n COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL: 0x87ee,\n // WEBGL_compressed_texture_astc\n COMPRESSED_RGBA_ASTC_4X4_KHR: 0x93b0,\n COMPRESSED_RGBA_ASTC_5X4_KHR: 0x93b1,\n COMPRESSED_RGBA_ASTC_5X5_KHR: 0x93b2,\n COMPRESSED_RGBA_ASTC_6X5_KHR: 0x93b3,\n COMPRESSED_RGBA_ASTC_6X6_KHR: 0x93b4,\n COMPRESSED_RGBA_ASTC_8X5_KHR: 0x93b5,\n COMPRESSED_RGBA_ASTC_8X6_KHR: 0x93b6,\n COMPRESSED_RGBA_ASTC_8X8_KHR: 0x93b7,\n COMPRESSED_RGBA_ASTC_10X5_KHR: 0x93b8,\n COMPRESSED_RGBA_ASTC_10X6_KHR: 0x93b9,\n COMPRESSED_RGBA_ASTC_10X8_KHR: 0x93ba,\n COMPRESSED_RGBA_ASTC_10X10_KHR: 0x93bb,\n COMPRESSED_RGBA_ASTC_12X10_KHR: 0x93bc,\n COMPRESSED_RGBA_ASTC_12X12_KHR: 0x93bd,\n COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR: 0x93d0,\n COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR: 0x93d1,\n COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR: 0x93d2,\n COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR: 0x93d3,\n COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR: 0x93d4,\n COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR: 0x93d5,\n COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR: 0x93d6,\n COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR: 0x93d7,\n COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR: 0x93d8,\n COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR: 0x93d9,\n COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR: 0x93da,\n COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR: 0x93db,\n COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR: 0x93dc,\n COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR: 0x93dd,\n // EXT_texture_compression_rgtc\n COMPRESSED_RED_RGTC1_EXT: 0x8dbb,\n COMPRESSED_SIGNED_RED_RGTC1_EXT: 0x8dbc,\n COMPRESSED_RED_GREEN_RGTC2_EXT: 0x8dbd,\n COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: 0x8dbe,\n // WEBGL_compressed_texture_s3tc_srgb\n COMPRESSED_SRGB_S3TC_DXT1_EXT: 0x8c4c,\n COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: 0x8c4d,\n COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: 0x8c4e,\n COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: 0x8c4f\n};\n","// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nconst BROWSER_PREFIXES = ['', 'WEBKIT_', 'MOZ_'];\nconst WEBGL_EXTENSIONS = {\n /* eslint-disable camelcase */\n WEBGL_compressed_texture_s3tc: 'dxt',\n WEBGL_compressed_texture_s3tc_srgb: 'dxt-srgb',\n WEBGL_compressed_texture_etc1: 'etc1',\n WEBGL_compressed_texture_etc: 'etc2',\n WEBGL_compressed_texture_pvrtc: 'pvrtc',\n WEBGL_compressed_texture_atc: 'atc',\n WEBGL_compressed_texture_astc: 'astc',\n EXT_texture_compression_rgtc: 'rgtc'\n /* eslint-enable camelcase */\n};\nlet formats = null;\n/**\n * Returns a list of formats.\n * Creates a temporary WebGLRenderingContext if none is provided.\n *\n * @param gl - Optional context.\n */\nexport function getSupportedGPUTextureFormats(gl) {\n if (!formats) {\n gl = gl || getWebGLContext() || undefined;\n formats = new Set();\n for (const prefix of BROWSER_PREFIXES) {\n for (const extension in WEBGL_EXTENSIONS) {\n if (gl && gl.getExtension(`${prefix}${extension}`)) {\n const gpuTextureFormat = WEBGL_EXTENSIONS[extension];\n formats.add(gpuTextureFormat);\n }\n }\n }\n }\n return formats;\n}\n/**\n * @returns {WebGLRenderingContext?}\n */\nfunction getWebGLContext() {\n try {\n const canvas = document.createElement('canvas');\n return canvas.getContext('webgl');\n }\n catch (error) {\n return null;\n }\n}\n","// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { read } from 'ktx-parse';\nimport { extractMipmapImages } from \"../utils/extract-mipmap-images.js\";\nimport { mapVkFormatToWebGL } from \"../utils/ktx-format-helper.js\";\nconst KTX2_ID = [\n // '´', 'K', 'T', 'X', '2', '0', 'ª', '\\r', '\\n', '\\x1A', '\\n'\n 0xab, 0x4b, 0x54, 0x58, 0x20, 0x32, 0x30, 0xbb, 0x0d, 0x0a, 0x1a, 0x0a\n];\n// eslint-disable-next-line complexity\nexport function isKTX(data) {\n // const id = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);\n const id = new Uint8Array(data);\n const notKTX = id.byteLength < KTX2_ID.length ||\n id[0] !== KTX2_ID[0] || // '´'\n id[1] !== KTX2_ID[1] || // 'K'\n id[2] !== KTX2_ID[2] || // 'T'\n id[3] !== KTX2_ID[3] || // 'X'\n id[4] !== KTX2_ID[4] || // ' '\n id[5] !== KTX2_ID[5] || // '2'\n id[6] !== KTX2_ID[6] || // '0'\n id[7] !== KTX2_ID[7] || // 'ª'\n id[8] !== KTX2_ID[8] || // '\\r'\n id[9] !== KTX2_ID[9] || // '\\n'\n id[10] !== KTX2_ID[10] || // '\\x1A'\n id[11] !== KTX2_ID[11]; // '\\n'\n return !notKTX;\n}\nexport function parseKTX(arrayBuffer) {\n const uint8Array = new Uint8Array(arrayBuffer);\n const ktx = read(uint8Array);\n const mipMapLevels = Math.max(1, ktx.levels.length);\n const width = ktx.pixelWidth;\n const height = ktx.pixelHeight;\n const internalFormat = mapVkFormatToWebGL(ktx.vkFormat);\n return extractMipmapImages(ktx.levels, {\n mipMapLevels,\n width,\n height,\n sizeFunction: (level) => level.uncompressedByteLength,\n internalFormat\n });\n}\n","// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { loadBasisEncoderModule, loadBasisTranscoderModule } from \"./basis-module-loader.js\";\nimport { GL_EXTENSIONS_CONSTANTS } from \"../gl-extensions.js\";\nimport { getSupportedGPUTextureFormats } from \"../utils/texture-formats.js\";\nimport { isKTX } from \"./parse-ktx.js\";\nconst OutputFormat = {\n etc1: {\n basisFormat: 0,\n compressed: true,\n format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_ETC1_WEBGL\n },\n etc2: { basisFormat: 1, compressed: true },\n bc1: {\n basisFormat: 2,\n compressed: true,\n format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_S3TC_DXT1_EXT\n },\n bc3: {\n basisFormat: 3,\n compressed: true,\n format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT5_EXT\n },\n bc4: { basisFormat: 4, compressed: true },\n bc5: { basisFormat: 5, compressed: true },\n 'bc7-m6-opaque-only': { basisFormat: 6, compressed: true },\n 'bc7-m5': { basisFormat: 7, compressed: true },\n 'pvrtc1-4-rgb': {\n basisFormat: 8,\n compressed: true,\n format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_PVRTC_4BPPV1_IMG\n },\n 'pvrtc1-4-rgba': {\n basisFormat: 9,\n compressed: true,\n format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG\n },\n 'astc-4x4': {\n basisFormat: 10,\n compressed: true,\n format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_4X4_KHR\n },\n 'atc-rgb': { basisFormat: 11, compressed: true },\n 'atc-rgba-interpolated-alpha': { basisFormat: 12, compressed: true },\n rgba32: { basisFormat: 13, compressed: false },\n rgb565: { basisFormat: 14, compressed: false },\n bgr565: { basisFormat: 15, compressed: false },\n rgba4444: { basisFormat: 16, compressed: false }\n};\n/**\n * parse data with a Binomial Basis_Universal module\n * @param data\n * @param options\n * @returns compressed texture data\n */\nexport async function parseBasis(data, options) {\n if (options.basis.containerFormat === 'auto') {\n if (isKTX(data)) {\n const fileConstructors = await loadBasisEncoderModule(options);\n return parseKTX2File(fileConstructors.KTX2File, data, options);\n }\n const { BasisFile } = await loadBasisTranscoderModule(options);\n return parseBasisFile(BasisFile, data, options);\n }\n switch (options.basis.module) {\n case 'encoder':\n const fileConstructors = await loadBasisEncoderModule(options);\n switch (options.basis.containerFormat) {\n case 'ktx2':\n return parseKTX2File(fileConstructors.KTX2File, data, options);\n case 'basis':\n default:\n return parseBasisFile(fileConstructors.BasisFile, data, options);\n }\n case 'transcoder':\n default:\n const { BasisFile } = await loadBasisTranscoderModule(options);\n return parseBasisFile(BasisFile, data, options);\n }\n}\n/**\n * Parse *.basis file data\n * @param BasisFile - initialized transcoder module\n * @param data\n * @param options\n * @returns compressed texture data\n */\nfunction parseBasisFile(BasisFile, data, options) {\n const basisFile = new BasisFile(new Uint8Array(data));\n try {\n if (!basisFile.startTranscoding()) {\n throw new Error('Failed to start basis transcoding');\n }\n const imageCount = basisFile.getNumImages();\n const images = [];\n for (let imageIndex = 0; imageIndex < imageCount; imageIndex++) {\n const levelsCount = basisFile.getNumLevels(imageIndex);\n const levels = [];\n for (let levelIndex = 0; levelIndex < levelsCount; levelIndex++) {\n levels.push(transcodeImage(basisFile, imageIndex, levelIndex, options));\n }\n images.push(levels);\n }\n return images;\n }\n finally {\n basisFile.close();\n basisFile.delete();\n }\n}\n/**\n * Parse the particular level image of a basis file\n * @param basisFile\n * @param imageIndex\n * @param levelIndex\n * @param options\n * @returns compressed texture data\n */\nfunction transcodeImage(basisFile, imageIndex, levelIndex, options) {\n const width = basisFile.getImageWidth(imageIndex, levelIndex);\n const height = basisFile.getImageHeight(imageIndex, levelIndex);\n // See https://github.com/BinomialLLC/basis_universal/pull/83\n const hasAlpha = basisFile.getHasAlpha( /* imageIndex, levelIndex */);\n // Check options for output format etc\n const { compressed, format, basisFormat } = getBasisOptions(options, hasAlpha);\n const decodedSize = basisFile.getImageTranscodedSizeInBytes(imageIndex, levelIndex, basisFormat);\n const decodedData = new Uint8Array(decodedSize);\n if (!basisFile.transcodeImage(decodedData, imageIndex, levelIndex, basisFormat, 0, 0)) {\n throw new Error('failed to start Basis transcoding');\n }\n return {\n // standard loaders.gl image category payload\n width,\n height,\n data: decodedData,\n compressed,\n format,\n // Additional fields\n // Add levelSize field.\n hasAlpha\n };\n}\n/**\n * Parse *.ktx2 file data\n * @param KTX2File\n * @param data\n * @param options\n * @returns compressed texture data\n */\nfunction parseKTX2File(KTX2File, data, options) {\n const ktx2File = new KTX2File(new Uint8Array(data));\n try {\n if (!ktx2File.startTranscoding()) {\n throw new Error('failed to start KTX2 transcoding');\n }\n const levelsCount = ktx2File.getLevels();\n const levels = [];\n for (let levelIndex = 0; levelIndex < levelsCount; levelIndex++) {\n levels.push(transcodeKTX2Image(ktx2File, levelIndex, options));\n }\n return [levels];\n }\n finally {\n ktx2File.close();\n ktx2File.delete();\n }\n}\n/**\n * Parse the particular level image of a ktx2 file\n * @param ktx2File\n * @param levelIndex\n * @param options\n * @returns\n */\nfunction transcodeKTX2Image(ktx2File, levelIndex, options) {\n const { alphaFlag, height, width } = ktx2File.getImageLevelInfo(levelIndex, 0, 0);\n // Check options for output format etc\n const { compressed, format, basisFormat } = getBasisOptions(options, alphaFlag);\n const decodedSize = ktx2File.getImageTranscodedSizeInBytes(levelIndex, 0 /* layerIndex */, 0 /* faceIndex */, basisFormat);\n const decodedData = new Uint8Array(decodedSize);\n if (!ktx2File.transcodeImage(decodedData, levelIndex, 0 /* layerIndex */, 0 /* faceIndex */, basisFormat, 0, -1 /* channel0 */, -1 /* channel1 */)) {\n throw new Error('Failed to transcode KTX2 image');\n }\n return {\n // standard loaders.gl image category payload\n width,\n height,\n data: decodedData,\n compressed,\n // Additional fields\n levelSize: decodedSize,\n hasAlpha: alphaFlag,\n format\n };\n}\n/**\n * Get BasisFormat by loader format option\n * @param options\n * @param hasAlpha\n * @returns BasisFormat data\n */\nfunction getBasisOptions(options, hasAlpha) {\n let format = options && options.basis && options.basis.format;\n if (format === 'auto') {\n format = selectSupportedBasisFormat();\n }\n if (typeof format === 'object') {\n format = hasAlpha ? format.alpha : format.noAlpha;\n }\n format = format.toLowerCase();\n return OutputFormat[format];\n}\n/**\n * Select transcode format from the list of supported formats\n * @returns key for OutputFormat map\n */\nexport function selectSupportedBasisFormat() {\n const supportedFormats = getSupportedGPUTextureFormats();\n if (supportedFormats.has('astc')) {\n return 'astc-4x4';\n }\n else if (supportedFormats.has('dxt')) {\n return {\n alpha: 'bc3',\n noAlpha: 'bc1'\n };\n }\n else if (supportedFormats.has('pvrtc')) {\n return {\n alpha: 'pvrtc1-4-rgba',\n noAlpha: 'pvrtc1-4-rgb'\n };\n }\n else if (supportedFormats.has('etc1')) {\n return 'etc1';\n }\n else if (supportedFormats.has('etc2')) {\n return 'etc2';\n }\n return 'rgb565';\n}\n","// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { VERSION } from \"./lib/utils/version.js\";\nimport { parseBasis } from \"./lib/parsers/parse-basis.js\";\n/**\n * Worker loader for Basis super compressed textures\n */\nexport const BasisWorkerLoader = {\n dataType: null,\n batchType: null,\n name: 'Basis',\n id: 'basis',\n module: 'textures',\n version: VERSION,\n worker: true,\n extensions: ['basis', 'ktx2'],\n mimeTypes: ['application/octet-stream', 'image/ktx2'],\n tests: ['sB'],\n binary: true,\n options: {\n basis: {\n format: 'auto',\n libraryPath: 'libs/',\n containerFormat: 'auto',\n module: 'transcoder'\n }\n }\n};\n/**\n * Loader for Basis super compressed textures\n */\nexport const BasisLoader = {\n ...BasisWorkerLoader,\n parse: parseBasis\n};\n","// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { GL } from '@luma.gl/constants';\nexport function convertSampler(gltfSampler) {\n return {\n addressModeU: convertSamplerWrapMode(gltfSampler.wrapS),\n addressModeV: convertSamplerWrapMode(gltfSampler.wrapT),\n magFilter: convertSamplerMagFilter(gltfSampler.magFilter),\n ...convertSamplerMinFilter(gltfSampler.minFilter)\n };\n}\nfunction convertSamplerWrapMode(mode) {\n switch (mode) {\n case 33071:\n return 'clamp-to-edge';\n case 10497:\n return 'repeat';\n case 33648:\n return 'mirror-repeat';\n default:\n return undefined;\n }\n}\nfunction convertSamplerMagFilter(mode) {\n switch (mode) {\n case 9728:\n return 'nearest';\n case 9729:\n return 'linear';\n default:\n return undefined;\n }\n}\nfunction convertSamplerMinFilter(mode) {\n switch (mode) {\n case 9728:\n return { minFilter: 'nearest' };\n case 9729:\n return { minFilter: 'linear' };\n case 9984:\n return { minFilter: 'nearest', mipmapFilter: 'nearest' };\n case 9985:\n return { minFilter: 'linear', mipmapFilter: 'nearest' };\n case 9986:\n return { minFilter: 'nearest', mipmapFilter: 'linear' };\n case 9987:\n return { minFilter: 'linear', mipmapFilter: 'linear' };\n default:\n return {};\n }\n}\n//# sourceMappingURL=convert-webgl-sampler.js.map","// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { GL } from '@luma.gl/constants';\nimport { log } from '@luma.gl/core';\nimport { convertSampler } from \"../webgl-to-webgpu/convert-webgl-sampler.js\";\n/**\n * Parses a GLTF material definition into uniforms and parameters for the PBR shader module\n */\nexport function parsePBRMaterial(device, material, attributes, options) {\n const parsedMaterial = {\n defines: {\n // TODO: Use EXT_sRGB if available (Standard in WebGL 2.0)\n MANUAL_SRGB: true,\n SRGB_FAST_APPROXIMATION: true\n },\n bindings: {},\n uniforms: {\n // TODO: find better values?\n camera: [0, 0, 0], // Model should override\n metallicRoughnessValues: [1, 1] // Default is 1 and 1\n },\n parameters: {},\n glParameters: {},\n generatedTextures: []\n };\n // TODO - always available\n parsedMaterial.defines['USE_TEX_LOD'] = true;\n const { imageBasedLightingEnvironment } = options;\n if (imageBasedLightingEnvironment) {\n parsedMaterial.bindings.pbr_diffuseEnvSampler =\n imageBasedLightingEnvironment.diffuseEnvSampler.texture;\n parsedMaterial.bindings.pbr_specularEnvSampler =\n imageBasedLightingEnvironment.specularEnvSampler.texture;\n parsedMaterial.bindings.pbr_BrdfLUT = imageBasedLightingEnvironment.brdfLutTexture.texture;\n parsedMaterial.uniforms.scaleIBLAmbient = [1, 1];\n }\n if (options?.pbrDebug) {\n parsedMaterial.defines['PBR_DEBUG'] = true;\n // Override final color for reference app visualization of various parameters in the lighting equation.\n parsedMaterial.uniforms.scaleDiffBaseMR = [0, 0, 0, 0];\n parsedMaterial.uniforms.scaleFGDSpec = [0, 0, 0, 0];\n }\n if (attributes['NORMAL'])\n parsedMaterial.defines['HAS_NORMALS'] = true;\n if (attributes['TANGENT'] && options?.useTangents)\n parsedMaterial.defines['HAS_TANGENTS'] = true;\n if (attributes['TEXCOORD_0'])\n parsedMaterial.defines['HAS_UV'] = true;\n if (options?.imageBasedLightingEnvironment)\n parsedMaterial.defines['USE_IBL'] = true;\n if (options?.lights)\n parsedMaterial.defines['USE_LIGHTS'] = true;\n if (material) {\n parseMaterial(device, material, parsedMaterial);\n }\n return parsedMaterial;\n}\n/** Parse GLTF material record */\nfunction parseMaterial(device, material, parsedMaterial) {\n parsedMaterial.uniforms.unlit = Boolean(material.unlit);\n if (material.pbrMetallicRoughness) {\n parsePbrMetallicRoughness(device, material.pbrMetallicRoughness, parsedMaterial);\n }\n if (material.normalTexture) {\n addTexture(device, material.normalTexture, 'pbr_normalSampler', 'HAS_NORMALMAP', parsedMaterial);\n const { scale = 1 } = material.normalTexture;\n parsedMaterial.uniforms.normalScale = scale;\n }\n if (material.occlusionTexture) {\n addTexture(device, material.occlusionTexture, 'pbr_occlusionSampler', 'HAS_OCCLUSIONMAP', parsedMaterial);\n const { strength = 1 } = material.occlusionTexture;\n parsedMaterial.uniforms.occlusionStrength = strength;\n }\n if (material.emissiveTexture) {\n addTexture(device, material.emissiveTexture, 'pbr_emissiveSampler', 'HAS_EMISSIVEMAP', parsedMaterial);\n parsedMaterial.uniforms.emissiveFactor = material.emissiveFactor || [0, 0, 0];\n }\n switch (material.alphaMode || 'MASK') {\n case 'MASK':\n const { alphaCutoff = 0.5 } = material;\n parsedMaterial.defines['ALPHA_CUTOFF'] = true;\n parsedMaterial.uniforms.alphaCutoff = alphaCutoff;\n break;\n case 'BLEND':\n log.warn('glTF BLEND alphaMode might not work well because it requires mesh sorting')();\n // WebGPU style parameters\n parsedMaterial.parameters.blend = true;\n parsedMaterial.parameters.blendColorOperation = 'add';\n parsedMaterial.parameters.blendColorSrcFactor = 'src-alpha';\n parsedMaterial.parameters.blendColorDstFactor = 'one-minus-src-alpha';\n parsedMaterial.parameters.blendAlphaOperation = 'add';\n parsedMaterial.parameters.blendAlphaSrcFactor = 'one';\n parsedMaterial.parameters.blendAlphaDstFactor = 'one-minus-src-alpha';\n // GL parameters\n // TODO - remove in favor of parameters\n parsedMaterial.glParameters['blend'] = true;\n parsedMaterial.glParameters['blendEquation'] = 32774;\n parsedMaterial.glParameters['blendFunc'] = [\n 770,\n 771,\n 1,\n 771\n ];\n break;\n }\n}\n/** Parse GLTF material sub record */\nfunction parsePbrMetallicRoughness(device, pbrMetallicRoughness, parsedMaterial) {\n if (pbrMetallicRoughness.baseColorTexture) {\n addTexture(device, pbrMetallicRoughness.baseColorTexture, 'pbr_baseColorSampler', 'HAS_BASECOLORMAP', parsedMaterial);\n }\n parsedMaterial.uniforms.baseColorFactor = pbrMetallicRoughness.baseColorFactor || [1, 1, 1, 1];\n if (pbrMetallicRoughness.metallicRoughnessTexture) {\n addTexture(device, pbrMetallicRoughness.metallicRoughnessTexture, 'pbr_metallicRoughnessSampler', 'HAS_METALROUGHNESSMAP', parsedMaterial);\n }\n const { metallicFactor = 1, roughnessFactor = 1 } = pbrMetallicRoughness;\n parsedMaterial.uniforms.metallicRoughnessValues = [metallicFactor, roughnessFactor];\n}\n/** Create a texture from a glTF texture/sampler/image combo and add it to bindings */\nfunction addTexture(device, gltfTexture, uniformName, define, parsedMaterial) {\n const image = gltfTexture.texture.source.image;\n let textureOptions;\n if (image.compressed) {\n textureOptions = image;\n }\n else {\n // Texture2D accepts a promise that returns an image as data (Async Textures)\n textureOptions = { data: image };\n }\n const gltfSampler = {\n wrapS: 10497, // default REPEAT S (U) wrapping mode.\n wrapT: 10497, // default REPEAT T (V) wrapping mode.\n ...gltfTexture?.texture?.sampler\n };\n const texture = device.createTexture({\n id: gltfTexture.uniformName || gltfTexture.id,\n sampler: convertSampler(gltfSampler),\n ...textureOptions\n });\n parsedMaterial.bindings[uniformName] = texture;\n if (define)\n parsedMaterial.defines[define] = true;\n parsedMaterial.generatedTextures.push(texture);\n}\n/*\n/**\n * Parses a GLTF material definition into uniforms and parameters for the PBR shader module\n *\nexport class PBRMaterialParser {\n readonly device: Device;\n\n readonly defines: Record<string, boolean>;\n readonly bindings: Record<string, Binding>;\n readonly uniforms: Record<string, any>;\n readonly parameters: Record<string, any>;\n\n /** Hold on to generated textures, we destroy them in the destroy method *\n readonly generatedTextures: Texture[];\n\n constructor(device: Device, props: PBRMaterialParserProps) {\n const {attributes, material, pbrDebug, imageBasedLightingEnvironment, lights, useTangents} =\n props;\n this.device = device;\n\n this.defines = {\n // TODO: Use EXT_sRGB if available (Standard in WebGL 2.0)\n MANUAL_SRGB: true,\n SRGB_FAST_APPROXIMATION: true\n };\n\n if (this.device.features.has('glsl-texture-lod')) {\n this.defines.USE_TEX_LOD = true;\n }\n\n this.uniforms = {\n // TODO: find better values?\n camera: [0, 0, 0], // Model should override\n\n metallicRoughnessValues: [1, 1] // Default is 1 and 1\n };\n\n this.bindings = {};\n\n this.parameters = {};\n this.generatedTextures = [];\n\n if (imageBasedLightingEnvironment) {\n this.bindings.pbr_diffuseEnvSampler = imageBasedLightingEnvironment.getDiffuseEnvSampler();\n this.bindings.pbr_specularEnvSampler = imageBasedLightingEnvironment.getSpecularEnvSampler();\n this.bindings.pbr_BrdfLUT = imageBasedLightingEnvironment.getBrdfTexture();\n this.uniforms.scaleIBLAmbient = [1, 1];\n }\n\n if (pbrDebug) {\n // Override final color for reference app visualization\n // of various parameters in the lighting equation.\n this.uniforms.scaleDiffBaseMR = [0, 0, 0, 0];\n this.uniforms.scaleFGDSpec = [0, 0, 0, 0];\n }\n\n this.defineIfPresent(attributes.NORMAL, 'HAS_NORMALS');\n this.defineIfPresent(attributes.TANGENT && useTangents, 'HAS_TANGENTS');\n this.defineIfPresent(attributes.TEXCOORD_0, 'HAS_UV');\n\n this.defineIfPresent(imageBasedLightingEnvironment, 'USE_IBL');\n this.defineIfPresent(lights, 'USE_LIGHTS');\n this.defineIfPresent(pbrDebug, 'PBR_DEBUG');\n\n if (material) {\n this.parseMaterial(material);\n }\n }\n\n /**\n * Destroy all generated resources to release memory.\n *\n destroy(): void {\n this.generatedTextures.forEach(texture => texture.destroy());\n }\n\n /** Add a define if the the value is non-nullish *\n defineIfPresent(value: unknown, name: string): void {\n if (value) {\n this.defines[name] = 1;\n }\n }\n\n /** Parse GLTF material record *\n parseMaterial(material) {\n this.uniforms.unlit = Boolean(material.unlit);\n\n if (material.pbrMetallicRoughness) {\n this.parsePbrMetallicRoughness(material.pbrMetallicRoughness);\n }\n if (material.normalTexture) {\n this.addTexture(material.normalTexture, 'pbr_normalSampler', 'HAS_NORMALMAP');\n\n const {scale = 1} = material.normalTexture;\n this.uniforms.normalScale = scale;\n }\n if (material.occlusionTexture) {\n this.addTexture(material.occlusionTexture, 'pbr_occlusionSampler', 'HAS_OCCLUSIONMAP');\n\n const {strength = 1} = material.occlusionTexture;\n this.uniforms.occlusionStrength = strength;\n }\n if (material.emissiveTexture) {\n this.addTexture(material.emissiveTexture, 'pbr_emissiveSampler', 'HAS_EMISSIVEMAP');\n this.uniforms.emissiveFactor = material.emissiveFactor || [0, 0, 0];\n }\n if (material.alphaMode === 'MASK') {\n const {alphaCutoff = 0.5} = material;\n this.defines.ALPHA_CUTOFF = true;\n this.uniforms.u_AlphaCutoff = alphaCutoff;\n } else if (material.alphaMode === 'BLEND') {\n log.warn('BLEND alphaMode might not work well because it requires mesh sorting')();\n Object.assign(this.parameters, {\n blend: true,\n blendEquation: GL.FUNC_ADD,\n blendFunc: [GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA, GL.ONE, GL.ONE_MINUS_SRC_ALPHA]\n });\n }\n }\n\n /** Parse GLTF material sub record *\n parsePbrMetallicRoughness(pbrMetallicRoughness) {\n if (pbrMetallicRoughness.baseColorTexture) {\n this.addTexture(\n pbrMetallicRoughness.baseColorTexture,\n 'pbr_baseColorSampler',\n 'HAS_BASECOLORMAP'\n );\n }\n this.uniforms.baseColorFactor = pbrMetallicRoughness.baseColorFactor || [1, 1, 1, 1];\n\n if (pbrMetallicRoughness.metallicRoughnessTexture) {\n this.addTexture(\n pbrMetallicRoughness.metallicRoughnessTexture,\n 'pbr_metallicRoughnessSampler',\n 'HAS_METALROUGHNESSMAP'\n );\n }\n const {metallicFactor = 1, roughnessFactor = 1} = pbrMetallicRoughness;\n this.uniforms.metallicRoughnessValues = [metallicFactor, roughnessFactor];\n }\n\n /** Create a texture from a glTF texture/sampler/image combo and add it to bindings *\n addTexture(gltfTexture, name, define = null) {\n const parameters = gltfTexture?.texture?.sampler?.parameters || {};\n\n const image = gltfTexture.texture.source.image;\n let textureOptions;\n let specialTextureParameters = {};\n if (image.compressed) {\n textureOptions = image;\n specialTextureParameters = {\n [GL.TEXTURE_MIN_FILTER]: image.data.length > 1 ? GL.LINEAR_MIPMAP_NEAREST : GL.LINEAR\n };\n } else {\n // Texture2D accepts a promise that returns an image as data (Async Textures)\n textureOptions = {data: image};\n }\n\n const texture: Texture = this.device.createTexture({\n id: gltfTexture.name || gltfTexture.id,\n parameters: {\n ...parameters,\n ...specialTextureParameters\n },\n pixelStore: {\n [GL.UNPACK_FLIP_Y_WEBGL]: false\n },\n ...textureOptions\n });\n this.bindings[name] = texture;\n this.defineIfPresent(define, define);\n this.generatedTextures.push(texture);\n }\n}\n*/\n//# sourceMappingURL=parse-pbr-material.js.map","// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// NOTE: Modules other than `@luma.gl/webgl` should not import `GL` from\n// `@luma.gl/constants`. Locally we use `GLEnum` instead of `GL` to avoid\n// conflicts with the `babel-plugin-inline-webgl-constants` plugin.\n// eslint-disable-next-line no-shadow\nexport var GLEnum;\n(function (GLEnum) {\n GLEnum[GLEnum[\"POINTS\"] = 0] = \"POINTS\";\n GLEnum[GLEnum[\"LINES\"] = 1] = \"LINES\";\n GLEnum[GLEnum[\"LINE_LOOP\"] = 2] = \"LINE_LOOP\";\n GLEnum[GLEnum[\"LINE_STRIP\"] = 3] = \"LINE_STRIP\";\n GLEnum[GLEnum[\"TRIANGLES\"] = 4] = \"TRIANGLES\";\n GLEnum[GLEnum[\"TRIANGLE_STRIP\"] = 5] = \"TRIANGLE_STRIP\";\n GLEnum[GLEnum[\"TRIANGLE_FAN\"] = 6] = \"TRIANGLE_FAN\";\n})(GLEnum || (GLEnum = {}));\nexport function convertGLDrawModeToTopology(drawMode) {\n // prettier-ignore\n switch (drawMode) {\n case GLEnum.POINTS: return 'point-list';\n case GLEnum.LINES: return 'line-list';\n case GLEnum.LINE_STRIP: return 'line-strip';\n case GLEnum.TRIANGLES: return 'triangle-list';\n case GLEnum.TRIANGLE_STRIP: return 'triangle-strip';\n default: throw new Error(String(drawMode));\n }\n}\n//# sourceMappingURL=convert-webgl-topology.js.map","// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { log } from '@luma.gl/core';\nimport { pbrMaterial } from '@luma.gl/shadertools';\nimport { Model, ModelNode } from '@luma.gl/engine';\nconst SHADER = /* WGSL */ `\nlayout(0) positions: vec4; // in vec4 POSITION;\n\n #ifdef HAS_NORMALS\n in vec4 normals; // in vec4 NORMAL;\n #endif\n\n #ifdef HAS_TANGENTS\n in vec4 TANGENT;\n #endif\n\n #ifdef HAS_UV\n // in vec2 TEXCOORD_0;\n in vec2 texCoords;\n #endif\n\n@vertex\n void main(void) {\n vec4 _NORMAL = vec4(0.);\n vec4 _TANGENT = vec4(0.);\n vec2 _TEXCOORD_0 = vec2(0.);\n\n #ifdef HAS_NORMALS\n _NORMAL = normals;\n #endif\n\n #ifdef HAS_TANGENTS\n _TANGENT = TANGENT;\n #endif\n\n #ifdef HAS_UV\n _TEXCOORD_0 = texCoords;\n #endif\n\n pbr_setPositionNormalTangentUV(positions, _NORMAL, _TANGENT, _TEXCOORD_0);\n gl_Position = u_MVPMatrix * positions;\n }\n\n@fragment\n out vec4 fragmentColor;\n\n void main(void) {\n vec3 pos = pbr_vPosition;\n fragmentColor = pbr_filterColor(vec4(1.0));\n }\n`;\n// TODO rename attributes to POSITION/NORMAL etc\n// See gpu-geometry.ts: getAttributeBuffersFromGeometry()\nconst vs = /* glsl */ `\\\n#version 300 es\n\n // in vec4 POSITION;\n in vec4 positions;\n\n #ifdef HAS_NORMALS\n // in vec4 NORMAL;\n in vec4 normals;\n #endif\n\n #ifdef HAS_TANGENTS\n in vec4 TANGENT;\n #endif\n\n #ifdef HAS_UV\n // in vec2 TEXCOORD_0;\n in vec2 texCoords;\n #endif\n\n void main(void) {\n vec4 _NORMAL = vec4(0.);\n vec4 _TANGENT = vec4(0.);\n vec2 _TEXCOORD_0 = vec2(0.);\n\n #ifdef HAS_NORMALS\n _NORMAL = normals;\n #endif\n\n #ifdef HAS_TANGENTS\n _TANGENT = TANGENT;\n #endif\n\n #ifdef HAS_UV\n _TEXCOORD_0 = texCoords;\n #endif\n\n pbr_setPositionNormalTangentUV(positions, _NORMAL, _TANGENT, _TEXCOORD_0);\n gl_Position = pbrProjection.modelViewProjectionMatrix * positions;\n }\n`;\nconst fs = /* glsl */ `\\\n#version 300 es\n out vec4 fragmentColor;\n\n void main(void) {\n vec3 pos = pbr_vPosition;\n fragmentColor = pbr_filterColor(vec4(1.0));\n }\n`;\n/** Creates a luma.gl Model from GLTF data*/\nexport function createGLTFModel(device, options) {\n const { id, geometry, parsedPPBRMaterial, vertexCount, modelOptions = {} } = options;\n log.info(4, 'createGLTFModel defines: ', parsedPPBRMaterial.defines)();\n // Calculate managedResources\n // TODO: Implement resource management logic that will\n // not deallocate resources/textures/buffers that are shared\n const managedResources = [];\n // managedResources.push(...parsedMaterial.generatedTextures);\n // managedResources.push(...Object.values(attributes).map((attribute) => attribute.buffer));\n const parameters = {\n depthWriteEnabled: true,\n depthCompare: 'less',\n depthFormat: 'depth24plus',\n cullMode: 'back'\n };\n const modelProps = {\n id,\n source: SHADER,\n vs,\n fs,\n geometry,\n topology: geometry.topology,\n vertexCount,\n modules: [pbrMaterial],\n ...modelOptions,\n defines: { ...parsedPPBRMaterial.defines, ...modelOptions.defines },\n parameters: { ...parameters, ...parsedPPBRMaterial.parameters, ...modelOptions.parameters }\n };\n const model = new Model(device, modelProps);\n const { camera, ...pbrMaterialProps } = {\n ...parsedPPBRMaterial.uniforms,\n ...modelOptions.uniforms,\n ...parsedPPBRMaterial.bindings,\n ...modelOptions.bindings\n };\n model.shaderInputs.setProps({ pbrMaterial: pbrMaterialProps, pbrProjection: { camera } });\n return new ModelNode({ managedResources, model });\n}\n//# sourceMappingURL=create-gltf-model.js.map","// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Geometry, GroupNode } from '@luma.gl/engine';\nimport { Matrix4 } from '@math.gl/core';\nimport { convertGLDrawModeToTopology } from \"../webgl-to-webgpu/convert-webgl-topology.js\";\nimport { createGLTFModel } from \"../gltf/create-gltf-model.js\";\nimport { parsePBRMaterial } from \"./parse-pbr-material.js\";\nconst defaultOptions = {\n modelOptions: {},\n pbrDebug: false,\n imageBasedLightingEnvironment: undefined,\n lights: true,\n useTangents: false\n};\n/**\n * GLTF instantiator for luma.gl\n * Walks the parsed and resolved glTF structure and builds a luma.gl scenegraph\n */\nexport function parseGLTF(device, gltf, options_ = {}) {\n const options = { ...defaultOptions, ...options_ };\n const sceneNodes = gltf.scenes.map(gltfScene => createScene(device, gltfScene, gltf.nodes, options));\n return sceneNodes;\n}\nfunction createScene(device, gltfScene, gltfNodes, options) {\n const gltfSceneNodes = gltfScene.nodes || [];\n const nodes = gltfSceneNodes.map(node => createNode(device, node, gltfNodes, options));\n const sceneNode = new GroupNode({\n id: gltfScene.name || gltfScene.id,\n children: nodes\n });\n return sceneNode;\n}\nfunction createNode(device, gltfNode, gltfNodes, options) {\n if (!gltfNode._node) {\n const gltfChildren = gltfNode.children || [];\n const children = gltfChildren.map(child => createNode(device, child, gltfNodes, options));\n // Node can have children nodes and meshes at the same time\n if (gltfNode.mesh) {\n children.push(createMesh(device, gltfNode.mesh, options));\n }\n const node = new GroupNode({\n id: gltfNode.name || gltfNode.id,\n children\n });\n if (gltfNode.matrix) {\n node.setMatrix(gltfNode.matrix);\n }\n else {\n node.matrix.identity();\n if (gltfNode.translation) {\n node.matrix.translate(gltfNode.translation);\n }\n if (gltfNode.rotation) {\n const rotationMatrix = new Matrix4().fromQuaternion(gltfNode.rotation);\n node.matrix.multiplyRight(rotationMatrix);\n }\n if (gltfNode.scale) {\n node.matrix.scale(gltfNode.scale);\n }\n }\n gltfNode._node = node;\n }\n // Copy _node so that gltf-animator can access\n const topLevelNode = gltfNodes.find(node => node.id === gltfNode.id);\n topLevelNode._node = gltfNode._node;\n return gltfNode._node;\n}\nfunction createMesh(device, gltfMesh, options) {\n // TODO: avoid changing the gltf\n if (!gltfMesh._mesh) {\n const gltfPrimitives = gltfMesh.primitives || [];\n const primitives = gltfPrimitives.map((gltfPrimitive, i) => createPrimitive(device, gltfPrimitive, i, gltfMesh, options));\n const mesh = new GroupNode({\n id: gltfMesh.name || gltfMesh.id,\n children: primitives\n });\n gltfMesh._mesh = mesh;\n }\n return gltfMesh._mesh;\n}\nfunction createPrimitive(device, gltfPrimitive, i, gltfMesh, options) {\n const id = gltfPrimitive.name || `${gltfMesh.name || gltfMesh.id}-primitive-${i}`;\n const topology = convertGLDrawModeToTopology(gltfPrimitive.mode || 4);\n const vertexCount = gltfPrimitive.indices\n ? gltfPrimitive.indices.count\n : getVertexCount(gltfPrimitive.attributes);\n const geometry = createGeometry(id, gltfPrimitive, topology);\n const parsedPPBRMaterial = parsePBRMaterial(device, gltfPrimitive.material, geometry.attributes, options);\n const modelNode = createGLTFModel(device, {\n id,\n geometry: createGeometry(id, gltfPrimitive, topology),\n parsedPPBRMaterial,\n modelOptions: options.modelOptions,\n vertexCount\n });\n modelNode.bounds = [gltfPrimitive.attributes.POSITION.min, gltfPrimitive.attributes.POSITION.max];\n // TODO this holds on to all the CPU side texture and attribute data\n // modelNode.material = gltfPrimitive.material;\n return modelNode;\n}\nfunction getVertexCount(attributes) {\n throw new Error('getVertexCount not implemented');\n}\nfunction createGeometry(id, gltfPrimitive, topology) {\n const attributes = {};\n for (const [attributeName, attribute] of Object.entries(gltfPrimitive.attributes)) {\n const { components, size, value } = attribute;\n attributes[attributeName] = { size: size ?? components, value };\n }\n return new Geometry({\n id,\n topology,\n indices: gltfPrimitive.indices.value,\n attributes\n });\n}\n//# sourceMappingURL=parse-gltf.js.map","import { log } from '@luma.gl/core';\nimport { Quaternion } from '@math.gl/core';\nconst scratchQuaternion = new Quaternion();\nexport function interpolate(time, { input, interpolation, output }, target, path) {\n const maxTime = input[input.length - 1];\n const animationTime = time % maxTime;\n const nextIndex = input.findIndex(t => t >= animationTime);\n const previousIndex = Math.max(0, nextIndex - 1);\n if (!Array.isArray(target[path])) {\n switch (path) {\n case 'translation':\n target[path] = [0, 0, 0];\n break;\n case 'rotation':\n target[path] = [0, 0, 0, 1];\n break;\n case 'scale':\n target[path] = [1, 1, 1];\n break;\n default:\n log.warn(`Bad animation path ${path}`)();\n }\n }\n // assert(target[path].length === output[previousIndex].length);\n const previousTime = input[previousIndex];\n const nextTime = input[nextIndex];\n switch (interpolation) {\n case 'STEP':\n stepInterpolate(target, path, output[previousIndex]);\n break;\n case 'LINEAR':\n if (nextTime > previousTime) {\n const ratio = (animationTime - previousTime) / (nextTime - previousTime);\n linearInterpolate(target, path, output[previousIndex], output[nextIndex], ratio);\n }\n break;\n case 'CUBICSPLINE':\n if (nextTime > previousTime) {\n const ratio = (animationTime - previousTime) / (nextTime - previousTime);\n const tDiff = nextTime - previousTime;\n const p0 = output[3 * previousIndex + 1];\n const outTangent0 = output[3 * previousIndex + 2];\n const inTangent1 = output[3 * nextIndex + 0];\n const p1 = output[3 * nextIndex + 1];\n cubicsplineInterpolate(target, path, { p0, outTangent0, inTangent1, p1, tDiff, ratio });\n }\n break;\n default:\n log.warn(`Interpolation ${interpolation} not supported`)();\n break;\n }\n}\nfunction linearInterpolate(target, path, start, stop, ratio) {\n if (!target[path]) {\n throw new Error();\n }\n if (path === 'rotation') {\n // SLERP when path is rotation\n scratchQuaternion.slerp({ start, target: stop, ratio });\n for (let i = 0; i < scratchQuaternion.length; i++) {\n target[path][i] = scratchQuaternion[i];\n }\n }\n else {\n // regular interpolation\n for (let i = 0; i < start.length; i++) {\n target[path][i] = ratio * stop[i] + (1 - ratio) * start[i];\n }\n }\n}\nfunction cubicsplineInterpolate(target, path, { p0, outTangent0, inTangent1, p1, tDiff, ratio: t }) {\n if (!target[path]) {\n throw new Error();\n }\n // TODO: Quaternion might need normalization\n for (let i = 0; i < target[path].length; i++) {\n const m0 = outTangent0[i] * tDiff;\n const m1 = inTangent1[i] * tDiff;\n target[path][i] =\n (2 * Math.pow(t, 3) - 3 * Math.pow(t, 2) + 1) * p0[i] +\n (Math.pow(t, 3) - 2 * Math.pow(t, 2) + t) * m0 +\n (-2 * Math.pow(t, 3) + 3 * Math.pow(t, 2)) * p1[i] +\n (Math.pow(t, 3) - Math.pow(t, 2)) * m1;\n }\n}\nfunction stepInterpolate(target, path, value) {\n if (!target[path]) {\n throw new Error();\n }\n for (let i = 0; i < value.length; i++) {\n target[path][i] = value[i];\n }\n}\n//# sourceMappingURL=interpolate.js.map","// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { log } from '@luma.gl/core';\nimport { Matrix4 } from '@math.gl/core';\nimport { interpolate } from \"./animations/interpolate.js\";\nclass GLTFSingleAnimator {\n animation;\n startTime = 0;\n playing = true;\n speed = 1;\n constructor(props) {\n this.animation = props.animation;\n this.animation.name ||= 'unnamed';\n Object.assign(this, props);\n }\n setTime(timeMs) {\n if (!this.playing) {\n return;\n }\n const absTime = timeMs / 1000;\n const time = (absTime - this.startTime) * this.speed;\n this.animation.channels.forEach(({ sampler, target, path }) => {\n interpolate(time, sampler, target, path);\n applyTranslationRotationScale(target, target._node);\n });\n }\n}\nexport class GLTFAnimator {\n animations;\n constructor(props) {\n this.animations = props.animations.map((animation, index) => {\n const name = animation.name || `Animation-${index}`;\n return new GLTFSingleAnimator({\n animation: { name, channels: animation.channels }\n });\n });\n }\n /** @deprecated Use .setTime(). Will be removed (deck.gl is using this) */\n animate(time) {\n log.warn('GLTFAnimator#animate is deprecated. Use GLTFAnimator#setTime instead')();\n this.setTime(time);\n }\n setTime(time) {\n this.animations.forEach(animation => animation.setTime(time));\n }\n getAnimations() {\n return this.animations;\n }\n}\n// TODO: share with GLTFInstantiator\nconst scratchMatrix = new Matrix4();\nfunction applyTranslationRotationScale(gltfNode, node) {\n node.matrix.identity();\n if (gltfNode.translation) {\n node.matrix.translate(gltfNode.translation);\n }\n if (gltfNode.rotation) {\n const rotationMatrix = scratchMatrix.fromQuaternion(gltfNode.rotation);\n node.matrix.multiplyRight(rotationMatrix);\n }\n if (gltfNode.scale) {\n node.matrix.scale(gltfNode.scale);\n }\n}\n//# sourceMappingURL=gltf-animator.js.map","// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport const ATTRIBUTE_TYPE_TO_COMPONENTS = {\n SCALAR: 1,\n VEC2: 2,\n VEC3: 3,\n VEC4: 4,\n MAT2: 4,\n MAT3: 9,\n MAT4: 16\n};\nexport const ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY = {\n 5120: Int8Array,\n 5121: Uint8Array,\n 5122: Int16Array,\n 5123: Uint16Array,\n 5125: Uint32Array,\n 5126: Float32Array\n};\nexport function accessorToTypedArray(accessor) {\n const ArrayType = ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY[accessor.componentType];\n const components = ATTRIBUTE_TYPE_TO_COMPONENTS[accessor.type];\n const length = components * accessor.count;\n const { buffer, byteOffset = 0 } = accessor.bufferView?.data ?? {};\n const typedArray = new ArrayType(buffer, byteOffset + (accessor.byteOffset || 0), length);\n return { typedArray, components };\n}\n//# sourceMappingURL=convert-webgl-attribute.js.map","// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { accessorToTypedArray } from \"..//webgl-to-webgpu/convert-webgl-attribute.js\";\nexport function parseGLTFAnimations(gltf) {\n const gltfAnimations = gltf.animations || [];\n return gltfAnimations.map((animation, index) => {\n const name = animation.name || `Animation-${index}`;\n const samplers = animation.samplers.map(({ input, interpolation = 'LINEAR', output }) => ({\n input: accessorToJsArray(gltf.accessors[input]),\n interpolation,\n output: accessorToJsArray(gltf.accessors[output])\n }));\n const channels = animation.channels.map(({ sampler, target }) => ({\n sampler: samplers[sampler],\n target: gltf.nodes[target.node ?? 0],\n path: target.path\n }));\n return { name, channels };\n });\n}\n//\nfunction accessorToJsArray(accessor) {\n if (!accessor._animation) {\n const { typedArray: array, components } = accessorToTypedArray(accessor);\n if (components === 1) {\n accessor._animation = Array.from(array);\n }\n else {\n // Slice array\n const slicedArray = [];\n for (let i = 0; i < array.length; i += components) {\n slicedArray.push(Array.from(array.slice(i, i + components)));\n }\n accessor._animation = slicedArray;\n }\n }\n return accessor._animation;\n}\n//# sourceMappingURL=parse-gltf-animations.js.map","/** Deeply copies a JS data structure */\nexport function deepCopy(object) {\n // don't copy binary data\n if (ArrayBuffer.isView(object) ||\n object instanceof ArrayBuffer ||\n object instanceof ImageBitmap) {\n return object;\n }\n if (Array.isArray(object)) {\n return object.map(deepCopy);\n }\n if (object && typeof object === 'object') {\n const result = {};\n for (const key in object) {\n result[key] = deepCopy(object[key]);\n }\n return result;\n }\n return object;\n}\n//# sourceMappingURL=deep-copy.js.map","// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { parseGLTF } from \"../parsers/parse-gltf.js\";\nimport { GLTFAnimator } from \"./gltf-animator.js\";\nimport { parseGLTFAnimations } from \"../parsers/parse-gltf-animations.js\";\nimport { deepCopy } from \"../utils/deep-copy.js\";\nexport function createScenegraphsFromGLTF(device, gltf, options) {\n gltf = deepCopy(gltf);\n const scenes = parseGLTF(device, gltf, options);\n // Note: There is a nasty dependency on injected nodes in the glTF\n const animations = parseGLTFAnimations(gltf);\n const animator = new GLTFAnimator({ animations });\n return { scenes, animator };\n}\n//# sourceMappingURL=create-scenegraph-from-gltf.js.map","// Replacement for the external assert method to reduce bundle size\n// Note: We don't use the second \"message\" argument in calling code,\n// so no need to support it here\nexport function assert(condition, message) {\n if (!condition) {\n throw new Error(message || 'assert failed: gltf');\n }\n}\n","export const COMPONENTS = {\n SCALAR: 1,\n VEC2: 2,\n VEC3: 3,\n VEC4: 4,\n MAT2: 4,\n MAT3: 9,\n MAT4: 16\n};\nexport const BYTES = {\n 5120: 1, // BYTE\n 5121: 1, // UNSIGNED_BYTE\n 5122: 2, // SHORT\n 5123: 2, // UNSIGNED_SHORT\n 5125: 4, // UNSIGNED_INT\n 5126: 4 // FLOAT\n};\n// ENUM LOOKUP\nexport function getBytesFromComponentType(componentType) {\n return BYTES[componentType];\n}\nexport function getSizeFromAccessorType(type) {\n return COMPONENTS[type];\n}\nexport function getGLEnumFromSamplerParameter(parameter) {\n const GL_TEXTURE_MAG_FILTER = 0x2800;\n const GL_TEXTURE_MIN_FILTER = 0x2801;\n const GL_TEXTURE_WRAP_S = 0x2802;\n const GL_TEXTURE_WRAP_T = 0x2803;\n const PARAMETER_MAP = {\n magFilter: GL_TEXTURE_MAG_FILTER,\n minFilter: GL_TEXTURE_MIN_FILTER,\n wrapS: GL_TEXTURE_WRAP_S,\n wrapT: GL_TEXTURE_WRAP_T\n };\n return PARAMETER_MAP[parameter];\n}\n","import { assert } from \"../utils/assert.js\";\nimport { BYTES, COMPONENTS } from \"../gltf-utils/gltf-constants.js\";\n/**\n * Memory needed to store texture and all mipmap levels 1 + 1/4 + 1/16 + 1/64 + ...\n * Minimum 1.33, but due to GPU layout may be 1.5\n */\nconst MIPMAP_FACTOR = 1.33;\nconst TYPES = ['SCALAR', 'VEC2', 'VEC3', 'VEC4'];\nconst ARRAY_CONSTRUCTOR_TO_WEBGL_CONSTANT = [\n [Int8Array, 5120],\n [Uint8Array, 5121],\n [Int16Array, 5122],\n [Uint16Array, 5123],\n [Uint32Array, 5125],\n [Float32Array, 5126],\n [Float64Array, 5130]\n];\nconst ARRAY_TO_COMPONENT_TYPE = new Map(ARRAY_CONSTRUCTOR_TO_WEBGL_CONSTANT);\nconst ATTRIBUTE_TYPE_TO_COMPONENTS = {\n SCALAR: 1,\n VEC2: 2,\n VEC3: 3,\n VEC4: 4,\n MAT2: 4,\n MAT3: 9,\n MAT4: 16\n};\nconst ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE = {\n 5120: 1,\n 5121: 1,\n 5122: 2,\n 5123: 2,\n 5125: 4,\n 5126: 4\n};\nconst ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY = {\n 5120: Int8Array,\n 5121: Uint8Array,\n 5122: Int16Array,\n 5123: Uint16Array,\n 5125: Uint32Array,\n 5126: Float32Array\n};\nexport function getAccessorTypeFromSize(size) {\n const type = TYPES[size - 1];\n return type || TYPES[0];\n}\nexport function getComponentTypeFromArray(typedArray) {\n const componentType = ARRAY_TO_COMPONENT_TYPE.get(typedArray.constructor);\n if (!componentType) {\n throw new Error('Illegal typed array');\n }\n return componentType;\n}\nexport function getAccessorArrayTypeAndLength(accessor, bufferView) {\n const ArrayType = ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY[accessor.componentType];\n const components = ATTRIBUTE_TYPE_TO_COMPONENTS[accessor.type];\n const bytesPerComponent = ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE[accessor.componentType];\n const length = accessor.count * components;\n const byteLength = accessor.count * components * bytesPerComponent;\n assert(byteLength >= 0 && byteLength <= bufferView.byteLength);\n const componentByteSize = BYTES[accessor.componentType];\n const numberOfComponentsInElement = COMPONENTS[accessor.type];\n return { ArrayType, length, byteLength, componentByteSize, numberOfComponentsInElement };\n}\n/**\n * Calculate the GPU memory used by a GLTF tile, for both buffer and texture memory\n * @param gltf - the gltf content of a GLTF tile\n * @returns - total memory usage in bytes\n */\nexport function getMemoryUsageGLTF(gltf) {\n let { images, bufferViews } = gltf;\n images = images || [];\n bufferViews = bufferViews || [];\n const imageBufferViews = images.map((i) => i.bufferView);\n bufferViews = bufferViews.filter((view) => !imageBufferViews.includes(view));\n const bufferMemory = bufferViews.reduce((acc, view) => acc + view.byteLength, 0);\n // Assume each pixel of the texture is 4 channel with mimmaps (which add 33%)\n // TODO correctly handle compressed textures\n const pixelCount = images.reduce((acc, image) => {\n // @ts-ignore\n const { width, height } = image.image;\n return acc + width * height;\n }, 0);\n return bufferMemory + Math.ceil(4 * pixelCount * MIPMAP_FACTOR);\n}\n","// TODO - GLTFScenegraph should use these\nimport { assert } from \"../utils/assert.js\";\nimport { getAccessorArrayTypeAndLength } from \"./gltf-utils.js\";\n// accepts buffer view index or buffer view object\n// returns a `Uint8Array`\nexport function getTypedArrayForBufferView(json, buffers, bufferViewIndex) {\n const bufferView = json.bufferViews[bufferViewIndex];\n assert(bufferView);\n // Get hold of the arrayBuffer\n const bufferIndex = bufferView.buffer;\n const binChunk = buffers[bufferIndex];\n assert(binChunk);\n const byteOffset = (bufferView.byteOffset || 0) + binChunk.byteOffset;\n return new Uint8Array(binChunk.arrayBuffer, byteOffset, bufferView.byteLength);\n}\n// accepts accessor index or accessor object\n// returns a `Uint8Array`\nexport function getTypedArrayForImageData(json, buffers, imageIndex) {\n const image = json.images[imageIndex];\n const bufferViewIndex = json.bufferViews[image.bufferView];\n return getTypedArrayForBufferView(json, buffers, bufferViewIndex);\n}\n/**\n * Gets data pointed by the accessor.\n * @param json - json part of gltf content of a GLTF tile.\n * @param buffers - Array containing buffers of data.\n * @param accessor - accepts accessor index or accessor object.\n * @returns {TypedArray} Typed array with type matching the type of data poited by the accessor.\n */\n// eslint-disable-next-line complexity\nexport function getTypedArrayForAccessor(json, buffers, accessor) {\n const gltfAccessor = typeof accessor === 'number' ? json.accessors?.[accessor] : accessor;\n if (!gltfAccessor) {\n throw new Error(`No gltf accessor ${JSON.stringify(accessor)}`);\n }\n const bufferView = json.bufferViews?.[gltfAccessor.bufferView || 0];\n if (!bufferView) {\n throw new Error(`No gltf buffer view for accessor ${bufferView}`);\n }\n // Get `arrayBuffer` the `bufferView` looks at\n const { arrayBuffer, byteOffset: bufferByteOffset } = buffers[bufferView.buffer];\n // Resulting byteOffset is sum of the buffer, accessor and bufferView byte offsets\n const byteOffset = (bufferByteOffset || 0) + (gltfAccessor.byteOffset || 0) + (bufferView.byteOffset || 0);\n // Deduce TypedArray type and its length from `accessor` and `bufferView` data\n const { ArrayType, length, componentByteSize, numberOfComponentsInElement } = getAccessorArrayTypeAndLength(gltfAccessor, bufferView);\n // 'length' is a whole number of components of all elements in the buffer pointed by the accessor\n // Multiplier to calculate the address of the element in the arrayBuffer\n const elementByteSize = componentByteSize * numberOfComponentsInElement;\n const elementAddressScale = bufferView.byteStride || elementByteSize;\n // Creare an array of component's type where all components (not just elements) will reside\n if (typeof bufferView.byteStride === 'undefined' || bufferView.byteStride === elementByteSize) {\n // No iterleaving\n const result = new ArrayType(arrayBuffer, byteOffset, length);\n return result;\n }\n // Iterleaving\n const result = new ArrayType(length);\n for (let i = 0; i < gltfAccessor.count; i++) {\n const values = new ArrayType(arrayBuffer, byteOffset + i * elementAddressScale, numberOfComponentsInElement);\n result.set(values, i * numberOfComponentsInElement);\n }\n return result;\n}\n","// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { getBinaryImageMetadata } from '@loaders.gl/images';\nimport { padToNBytes, copyToArray } from '@loaders.gl/loader-utils';\nimport { assert } from \"../utils/assert.js\";\nimport { getAccessorTypeFromSize, getComponentTypeFromArray } from \"../gltf-utils/gltf-utils.js\";\nimport { getTypedArrayForAccessor as _getTypedArrayForAccessor } from \"../gltf-utils/get-typed-array.js\";\nfunction makeDefaultGLTFJson() {\n return {\n asset: {\n version: '2.0',\n generator: 'loaders.gl'\n },\n buffers: [],\n extensions: {},\n extensionsRequired: [],\n extensionsUsed: []\n };\n}\n/**\n * Class for structured access to GLTF data\n */\nexport class GLTFScenegraph {\n // internal\n gltf;\n sourceBuffers;\n byteLength;\n // TODO - why is this not GLTFWithBuffers - what happens to images?\n constructor(gltf) {\n // Declare locally so\n this.gltf = {\n json: gltf?.json || makeDefaultGLTFJson(),\n buffers: gltf?.buffers || [],\n images: gltf?.images || []\n };\n this.sourceBuffers = [];\n this.byteLength = 0;\n // Initialize buffers\n if (this.gltf.buffers && this.gltf.buffers[0]) {\n this.byteLength = this.gltf.buffers[0].byteLength;\n this.sourceBuffers = [this.gltf.buffers[0]];\n }\n }\n // Accessors\n get json() {\n return this.gltf.json;\n }\n getApplicationData(key) {\n // TODO - Data is already unpacked by GLBParser\n const data = this.json[key];\n return data;\n }\n getExtraData(key) {\n // TODO - Data is already unpacked by GLBParser\n const extras = (this.json.extras || {});\n return extras[key];\n }\n hasExtension(extensionName) {\n const isUsedExtension = this.getUsedExtensions().find((name) => name === extensionName);\n const isRequiredExtension = this.getRequiredExtensions().find((name) => name === extensionName);\n return typeof isUsedExtension === 'string' || typeof isRequiredExtension === 'string';\n }\n getExtension(extensionName) {\n const isExtension = this.getUsedExtensions().find((name) => name === extensionName);\n const extensions = this.json.extensions || {};\n return isExtension ? extensions[extensionName] : null;\n }\n getRequiredExtension(extensionName) {\n const isRequired = this.getRequiredExtensions().find((name) => name === extensionName);\n return isRequired ? this.getExtension(extensionName) : null;\n }\n getRequiredExtensions() {\n return this.json.extensionsRequired || [];\n }\n getUsedExtensions() {\n return this.json.extensionsUsed || [];\n }\n getRemovedExtensions() {\n return (this.json.extensionsRemoved || []);\n }\n getObjectExtension(object, extensionName) {\n const extensions = object.extensions || {};\n return extensions[extensionName];\n }\n getScene(index) {\n return this.getObject('scenes', index);\n }\n getNode(index) {\n return this.getObject('nodes', index);\n }\n getSkin(index) {\n return this.getObject('skins', index);\n }\n getMesh(index) {\n return this.getObject('meshes', index);\n }\n getMaterial(index) {\n return this.getObject('materials', index);\n }\n getAccessor(index) {\n return this.getObject('accessors', index);\n }\n // getCamera(index: number): object | null {\n // return null; // TODO: fix thi: object as null;\n // }\n getTexture(index) {\n return this.getObject('textures', index);\n }\n getSampler(index) {\n return this.getObject('samplers', index);\n }\n getImage(index) {\n return this.getObject('images', index);\n }\n getBufferView(index) {\n return this.getObject('bufferViews', index);\n }\n getBuffer(index) {\n return this.getObject('buffers', index);\n }\n getObject(array, index) {\n // check if already resolved\n if (typeof index === 'object') {\n return index;\n }\n const object = this.json[array] && this.json[array][index];\n if (!object) {\n throw new Error(`glTF file error: Could not find ${array}[${index}]`); // eslint-disable-line\n }\n return object;\n }\n /**\n * Accepts buffer view index or buffer view object\n * @returns a `Uint8Array`\n */\n getTypedArrayForBufferView(bufferView) {\n bufferView = this.getBufferView(bufferView);\n // @ts-ignore\n const bufferIndex = bufferView.buffer;\n // Get hold of the arrayBuffer\n // const buffer = this.getBuffer(bufferIndex);\n const binChunk = this.gltf.buffers[bufferIndex];\n assert(binChunk);\n // @ts-ignore\n const byteOffset = (bufferView.byteOffset || 0) + binChunk.byteOffset;\n // @ts-ignore\n return new Uint8Array(binChunk.arrayBuffer, byteOffset, bufferView.byteLength);\n }\n /** Accepts accessor index or accessor object\n * @returns a typed array with type that matches the types\n */\n getTypedArrayForAccessor(accessor) {\n // @ts-ignore\n const gltfAccessor = this.getAccessor(accessor);\n return _getTypedArrayForAccessor(this.gltf.json, this.gltf.buffers, gltfAccessor);\n }\n /** accepts accessor index or accessor object\n * returns a `Uint8Array`\n */\n getTypedArrayForImageData(image) {\n // @ts-ignore\n image = this.getAccessor(image);\n // @ts-ignore\n const bufferView = this.getBufferView(image.bufferView);\n const buffer = this.getBuffer(bufferView.buffer);\n // @ts-ignore\n const arrayBuffer = buffer.data;\n const byteOffset = bufferView.byteOffset || 0;\n return new Uint8Array(arrayBuffer, byteOffset, bufferView.byteLength);\n }\n // MODIFERS\n /**\n * Add an extra application-defined key to the top-level data structure\n */\n addApplicationData(key, data) {\n this.json[key] = data;\n return this;\n }\n /**\n * `extras` - Standard GLTF field for storing application specific data\n */\n addExtraData(key, data) {\n this.json.extras = this.json.extras || {};\n this.json.extras[key] = data;\n return this;\n }\n addObjectExtension(object, extensionName, data) {\n // @ts-ignore\n object.extensions = object.extensions || {};\n // TODO - clobber or merge?\n // @ts-ignore\n object.extensions[extensionName] = data;\n this.registerUsedExtension(extensionName);\n return this;\n }\n setObjectExtension(object, extensionName, data) {\n const extensions = object.extensions || {};\n extensions[extensionName] = data;\n // TODO - add to usedExtensions...\n }\n removeObjectExtension(object, extensionName) {\n const extensions = object?.extensions || {};\n if (extensions[extensionName]) {\n this.json.extensionsRemoved = this.json.extensionsRemoved || [];\n const extensionsRemoved = this.json.extensionsRemoved;\n if (!extensionsRemoved.includes(extensionName)) {\n extensionsRemoved.push(extensionName);\n }\n }\n delete extensions[extensionName];\n }\n /**\n * Add to standard GLTF top level extension object, mark as used\n */\n addExtension(extensionName, extensionData = {}) {\n assert(extensionData);\n this.json.extensions = this.json.extensions || {};\n this.json.extensions[extensionName] = extensionData;\n this.registerUsedExtension(extensionName);\n return extensionData;\n }\n /**\n * Standard GLTF top level extension object, mark as used and required\n */\n addRequiredExtension(extensionName, extensionData = {}) {\n assert(extensionData);\n this.addExtension(extensionName, extensionData);\n this.registerRequiredExtension(extensionName);\n return extensionData;\n }\n /**\n * Add extensionName to list of used extensions\n */\n registerUsedExtension(extensionName) {\n this.json.extensionsUsed = this.json.extensionsUsed || [];\n if (!this.json.extensionsUsed.find((ext) => ext === extensionName)) {\n this.json.extensionsUsed.push(extensionName);\n }\n }\n /**\n * Add extensionName to list of required extensions\n */\n registerRequiredExtension(extensionName) {\n this.registerUsedExtension(extensionName);\n this.json.extensionsRequired = this.json.extensionsRequired || [];\n if (!this.json.extensionsRequired.find((ext) => ext === extensionName)) {\n this.json.extensionsRequired.push(extensionName);\n }\n }\n /**\n * Removes an extension from the top-level list\n */\n removeExtension(extensionName) {\n if (this.json.extensions?.[extensionName]) {\n this.json.extensionsRemoved = this.json.extensionsRemoved || [];\n const extensionsRemoved = this.json.extensionsRemoved;\n if (!extensionsRemoved.includes(extensionName)) {\n extensionsRemoved.push(extensionName);\n }\n }\n if (this.json.extensions) {\n delete this.json.extensions[extensionName];\n }\n if (this.json.extensionsRequired) {\n this._removeStringFromArray(this.json.extensionsRequired, extensionName);\n }\n if (this.json.extensionsUsed) {\n this._removeStringFromArray(this.json.extensionsUsed, extensionName);\n }\n }\n /**\n * Set default scene which is to be displayed at load time\n */\n setDefaultScene(sceneIndex) {\n this.json.scene = sceneIndex;\n }\n /**\n * @todo: add more properties for scene initialization:\n * name`, `extensions`, `extras`\n * https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-scene\n */\n addScene(scene) {\n const { nodeIndices } = scene;\n this.json.scenes = this.json.scenes || [];\n this.json.scenes.push({ nodes: nodeIndices });\n return this.json.scenes.length - 1;\n }\n /**\n * @todo: add more properties for node initialization:\n * `name`, `extensions`, `extras`, `camera`, `children`, `skin`, `rotation`, `scale`, `translation`, `weights`\n * https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#node\n */\n addNode(node) {\n const { meshIndex, matrix } = node;\n this.json.nodes = this.json.nodes || [];\n const nodeData = { mesh: meshIndex };\n if (matrix) {\n // @ts-ignore\n nodeData.matrix = matrix;\n }\n this.json.nodes.push(nodeData);\n return this.json.nodes.length - 1;\n }\n /** Adds a mesh to the json part */\n addMesh(mesh) {\n const { attributes, indices, material, mode = 4 } = mesh;\n const accessors = this._addAttributes(attributes);\n const glTFMesh = {\n primitives: [\n {\n attributes: accessors,\n mode\n }\n ]\n };\n if (indices) {\n const indicesAccessor = this._addIndices(indices);\n // @ts-ignore\n glTFMesh.primitives[0].indices = indicesAccessor;\n }\n if (Number.isFinite(material)) {\n // @ts-ignore\n glTFMesh.primitives[0].material = material;\n }\n this.json.meshes = this.json.meshes || [];\n this.json.meshes.push(glTFMesh);\n return this.json.meshes.length - 1;\n }\n addPointCloud(attributes) {\n // @ts-ignore\n const accessorIndices = this._addAttributes(attributes);\n const glTFMesh = {\n primitives: [\n {\n attributes: accessorIndices,\n mode: 0 // GL.POINTS\n }\n ]\n };\n this.json.meshes = this.json.meshes || [];\n this.json.meshes.push(glTFMesh);\n return this.json.meshes.length - 1;\n }\n /**\n * Adds a binary image. Builds glTF \"JSON metadata\" and saves buffer reference\n * Buffer will be copied into BIN chunk during \"pack\"\n * Currently encodes as glTF image\n * @param imageData\n * @param mimeType\n */\n addImage(imageData, mimeTypeOpt) {\n // If image is referencing a bufferView instead of URI, mimeType must be defined:\n // https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#images\n // \"a reference to a bufferView; in that case mimeType must be defined.\"\n const metadata = getBinaryImageMetadata(imageData);\n const mimeType = mimeTypeOpt || metadata?.mimeType;\n const bufferViewIndex = this.addBufferView(imageData);\n const glTFImage = {\n bufferView: bufferViewIndex,\n mimeType\n };\n this.json.images = this.json.images || [];\n this.json.images.push(glTFImage);\n return this.json.images.length - 1;\n }\n /**\n * Add one untyped source buffer, create a matching glTF `bufferView`, and return its index\n * @param buffer\n */\n addBufferView(buffer, bufferIndex = 0, byteOffset = this.byteLength) {\n const byteLength = buffer.byteLength;\n assert(Number.isFinite(byteLength));\n // Add this buffer to the list of buffers to be written to the body.\n this.sourceBuffers = this.sourceBuffers || [];\n this.sourceBuffers.push(buffer);\n const glTFBufferView = {\n buffer: bufferIndex,\n // Write offset from the start of the binary body\n byteOffset,\n byteLength\n };\n // We've now added the contents to the body, so update the total length\n // Every sub-chunk needs to be 4-byte align ed\n this.byteLength += padToNBytes(byteLength, 4);\n // Add a bufferView indicating start and length of this binary sub-chunk\n this.json.bufferViews = this.json.bufferViews || [];\n this.json.bufferViews.push(glTFBufferView);\n return this.json.bufferViews.length - 1;\n }\n /**\n * Adds an accessor to a bufferView\n * @param bufferViewIndex\n * @param accessor\n */\n addAccessor(bufferViewIndex, accessor) {\n const glTFAccessor = {\n bufferView: bufferViewIndex,\n // @ts-ignore\n type: getAccessorTypeFromSize(accessor.size),\n // @ts-ignore\n componentType: accessor.componentType,\n // @ts-ignore\n count: accessor.count,\n // @ts-ignore\n max: accessor.max,\n // @ts-ignore\n min: accessor.min\n };\n this.json.accessors = this.json.accessors || [];\n this.json.accessors.push(glTFAccessor);\n return this.json.accessors.length - 1;\n }\n /**\n * Add a binary buffer. Builds glTF \"JSON metadata\" and saves buffer reference\n * Buffer will be copied into BIN chunk during \"pack\"\n * Currently encodes buffers as glTF accessors, but this could be optimized\n * @param sourceBuffer\n * @param accessor\n */\n addBinaryBuffer(sourceBuffer, accessor = { size: 3 }) {\n const bufferViewIndex = this.addBufferView(sourceBuffer);\n // @ts-ignore\n let minMax = { min: accessor.min, max: accessor.max };\n if (!minMax.min || !minMax.max) {\n // @ts-ignore\n minMax = this._getAccessorMinMax(sourceBuffer, accessor.size);\n }\n const accessorDefaults = {\n // @ts-ignore\n size: accessor.size,\n componentType: getComponentTypeFromArray(sourceBuffer),\n // @ts-ignore\n count: Math.round(sourceBuffer.length / accessor.size),\n min: minMax.min,\n max: minMax.max\n };\n return this.addAccessor(bufferViewIndex, Object.assign(accessorDefaults, accessor));\n }\n /**\n * Adds a texture to the json part\n * @todo: add more properties for texture initialization\n * `sampler`, `name`, `extensions`, `extras`\n * https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#texture\n */\n addTexture(texture) {\n const { imageIndex } = texture;\n const glTFTexture = {\n source: imageIndex\n };\n this.json.textures = this.json.textures || [];\n this.json.textures.push(glTFTexture);\n return this.json.textures.length - 1;\n }\n /** Adds a material to the json part */\n addMaterial(pbrMaterialInfo) {\n this.json.materials = this.json.materials || [];\n this.json.materials.push(pbrMaterialInfo);\n return this.json.materials.length - 1;\n }\n /** Pack the binary chunk */\n createBinaryChunk() {\n // Allocate total array\n const totalByteLength = this.byteLength;\n const arrayBuffer = new ArrayBuffer(totalByteLength);\n const targetArray = new Uint8Array(arrayBuffer);\n // Copy each array into\n let dstByteOffset = 0;\n for (const sourceBuffer of this.sourceBuffers || []) {\n dstByteOffset = copyToArray(sourceBuffer, targetArray, dstByteOffset);\n }\n // Update the glTF BIN CHUNK byte length\n if (this.json?.buffers?.[0]) {\n this.json.buffers[0].byteLength = totalByteLength;\n }\n else {\n this.json.buffers = [{ byteLength: totalByteLength }];\n }\n // Save generated arrayBuffer\n this.gltf.binary = arrayBuffer;\n // Put arrayBuffer to sourceBuffers for possible additional writing data in the chunk\n this.sourceBuffers = [arrayBuffer];\n this.gltf.buffers = [{ arrayBuffer, byteOffset: 0, byteLength: arrayBuffer.byteLength }];\n }\n // PRIVATE\n _removeStringFromArray(array, string) {\n let found = true;\n while (found) {\n const index = array.indexOf(string);\n if (index > -1) {\n array.splice(index, 1);\n }\n else {\n found = false;\n }\n }\n }\n /**\n * Add attributes to buffers and create `attributes` object which is part of `mesh`\n */\n _addAttributes(attributes = {}) {\n const result = {};\n for (const attributeKey in attributes) {\n const attributeData = attributes[attributeKey];\n const attrName = this._getGltfAttributeName(attributeKey);\n const accessor = this.addBinaryBuffer(attributeData.value, attributeData);\n result[attrName] = accessor;\n }\n return result;\n }\n /**\n * Add indices to buffers\n */\n _addIndices(indices) {\n return this.addBinaryBuffer(indices, { size: 1 });\n }\n /**\n * Deduce gltf specific attribue name from input attribute name\n */\n _getGltfAttributeName(attributeName) {\n switch (attributeName.toLowerCase()) {\n case 'position':\n case 'positions':\n case 'vertices':\n return 'POSITION';\n case 'normal':\n case 'normals':\n return 'NORMAL';\n case 'color':\n case 'colors':\n return 'COLOR_0';\n case 'texcoord':\n case 'texcoords':\n return 'TEXCOORD_0';\n default:\n return attributeName;\n }\n }\n /**\n * Calculate `min` and `max` arrays of accessor according to spec:\n * https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-accessor\n */\n _getAccessorMinMax(buffer, size) {\n const result = { min: null, max: null };\n if (buffer.length < size) {\n return result;\n }\n // @ts-ignore\n result.min = [];\n // @ts-ignore\n result.max = [];\n const initValues = buffer.subarray(0, size);\n for (const value of initValues) {\n // @ts-ignore\n result.min.push(value);\n // @ts-ignore\n result.max.push(value);\n }\n for (let index = size; index < buffer.length; index += size) {\n for (let componentIndex = 0; componentIndex < size; componentIndex++) {\n // @ts-ignore\n result.min[0 + componentIndex] = Math.min(\n // @ts-ignore\n result.min[0 + componentIndex], buffer[index + componentIndex]);\n // @ts-ignore\n result.max[0 + componentIndex] = Math.max(\n // @ts-ignore\n result.max[0 + componentIndex], buffer[index + componentIndex]);\n }\n }\n return result;\n }\n}\n","/**\n * loaders.gl, MIT license\n *\n * Shared code for 3DTiles extensions:\n * * EXT_feature_metadata\n * * EXT_mesh_features\n * * EXT_structural_metadata\n */\nimport { getComponentTypeFromArray } from \"../../gltf-utils/gltf-utils.js\";\nimport { getImageData } from '@loaders.gl/images';\nfunction emod(n) {\n return ((n % 1) + 1) % 1;\n}\nconst ATTRIBUTE_TYPE_TO_COMPONENTS = {\n SCALAR: 1,\n VEC2: 2,\n VEC3: 3,\n VEC4: 4,\n MAT2: 4,\n MAT3: 9,\n MAT4: 16,\n BOOLEAN: 1,\n STRING: 1,\n ENUM: 1\n};\nconst ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY = {\n INT8: Int8Array,\n UINT8: Uint8Array,\n INT16: Int16Array,\n UINT16: Uint16Array,\n INT32: Int32Array,\n UINT32: Uint32Array,\n INT64: BigInt64Array,\n UINT64: BigUint64Array,\n FLOAT32: Float32Array,\n FLOAT64: Float64Array\n};\nconst ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE = {\n INT8: 1,\n UINT8: 1,\n INT16: 2,\n UINT16: 2,\n INT32: 4,\n UINT32: 4,\n INT64: 8,\n UINT64: 8,\n FLOAT32: 4,\n FLOAT64: 8\n};\nexport function getArrayElementByteSize(attributeType, componentType) {\n return (ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE[componentType] *\n ATTRIBUTE_TYPE_TO_COMPONENTS[attributeType]);\n}\n/**\n * Gets offset array from `arrayOffsets` or `stringOffsets`.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param bufferViewIndex - Buffer view index\n * @param offsetType - The type of values in `arrayOffsets` or `stringOffsets`.\n * @param numberOfElements - The number of elements in each property array.\n * @returns Array of values offsets. The number of offsets in the array is equal to `numberOfElements` plus one.\n */\nexport function getOffsetsForProperty(scenegraph, bufferViewIndex, offsetType, numberOfElements) {\n if (offsetType !== 'UINT8' &&\n offsetType !== 'UINT16' &&\n offsetType !== 'UINT32' &&\n offsetType !== 'UINT64') {\n return null;\n }\n const arrayOffsetsBytes = scenegraph.getTypedArrayForBufferView(bufferViewIndex);\n const arrayOffsets = convertRawBufferToMetadataArray(arrayOffsetsBytes, 'SCALAR', // offsets consist of ONE component\n offsetType, numberOfElements + 1 // The number of offsets is equal to the property table `count` plus one.\n );\n // We don't support BigInt offsets at the moment. It requires additional logic and potential issues in Safari\n if (arrayOffsets instanceof BigInt64Array || arrayOffsets instanceof BigUint64Array) {\n return null;\n }\n return arrayOffsets;\n}\n/**\n * Converts raw bytes that are in the buffer to an array of the type defined by the schema.\n * @param data - Raw bytes in the buffer.\n * @param attributeType - SCALAR, VECN, MATN.\n * @param componentType - Type of the component in elements, e.g. 'UINT8' or 'FLOAT32'.\n * @param elementCount - Number of elements in the array. Default value is 1.\n * @returns Data array\n */\nexport function convertRawBufferToMetadataArray(data, attributeType, componentType, elementCount = 1) {\n const numberOfComponents = ATTRIBUTE_TYPE_TO_COMPONENTS[attributeType];\n const ArrayType = ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY[componentType];\n const size = ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE[componentType];\n const length = elementCount * numberOfComponents;\n const byteLength = length * size;\n let buffer = data.buffer;\n let offset = data.byteOffset;\n if (offset % size !== 0) {\n const bufferArray = new Uint8Array(buffer);\n buffer = bufferArray.slice(offset, offset + byteLength).buffer;\n offset = 0;\n }\n return new ArrayType(buffer, offset, length);\n}\n/**\n * Processes data encoded in the texture associated with the primitive.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param textureInfo - Reference to the texture where extension data are stored.\n * @param primitive - Primitive object in the mesh.\n * @returns Array of data taken. Null if data can't be taken from the texture.\n */\nexport function getPrimitiveTextureData(scenegraph, textureInfo, primitive) {\n /*\n texture.index is an index for the \"textures\" array.\n The texture object referenced by this index looks like this:\n {\n \"sampler\": 0,\n \"source\": 0\n }\n \"sampler\" is an index for the \"samplers\" array\n \"source\" is an index for the \"images\" array that contains data stored in rgba channels of the image.\n \n texture.texCoord is a number-suffix (like 1) for an attribute like \"TEXCOORD_1\" in meshes.primitives\n The value of \"TEXCOORD_1\" is an accessor that is used to get coordinates.\n These coordinates are being used to get data from the image.\n \n Default for texture.texCoord is 0\n @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/specification/2.0/schema/textureInfo.schema.json\n */\n const texCoordAccessorKey = `TEXCOORD_${textureInfo.texCoord || 0}`;\n const texCoordAccessorIndex = primitive.attributes[texCoordAccessorKey];\n const textureCoordinates = scenegraph.getTypedArrayForAccessor(texCoordAccessorIndex);\n const json = scenegraph.gltf.json;\n const textureIndex = textureInfo.index;\n const imageIndex = json.textures?.[textureIndex]?.source;\n if (typeof imageIndex !== 'undefined') {\n const mimeType = json.images?.[imageIndex]?.mimeType;\n const parsedImage = scenegraph.gltf.images?.[imageIndex];\n // Checking for width is to prevent handling Un-processed images (e.g. [analyze] stage, where loadImages option is set to false)\n if (parsedImage && typeof parsedImage.width !== 'undefined') {\n const textureData = [];\n for (let index = 0; index < textureCoordinates.length; index += 2) {\n const value = getImageValueByCoordinates(parsedImage, mimeType, textureCoordinates, index, textureInfo.channels);\n textureData.push(value);\n }\n return textureData;\n }\n }\n return [];\n}\n/**\n * Puts property data to attributes.\n * It creates corresponding buffer, bufferView and accessor\n * so the data can be accessed like regular data stored in buffers.\n * @param scenegraph - Scenegraph object.\n * @param attributeName - Name of the attribute.\n * @param propertyData - Property data to store.\n * @param featureTable - Array where unique data from the property data are being stored.\n * @param primitive - Primitive object.\n */\nexport function primitivePropertyDataToAttributes(scenegraph, attributeName, propertyData, featureTable, primitive) {\n // No reason to create an empty buffer if there is no property data to store.\n if (!propertyData?.length) {\n return;\n }\n /*\n featureTable will contain unique values, e.g.\n propertyData = [24, 35, 28, 24]\n featureTable = [24, 35, 28]\n featureIndices will contain indices that refer featureTextureTable, e.g.\n featureIndices = [0, 1, 2, 0]\n */\n const featureIndices = [];\n for (const texelData of propertyData) {\n let index = featureTable.findIndex((item) => item === texelData);\n if (index === -1) {\n index = featureTable.push(texelData) - 1;\n }\n featureIndices.push(index);\n }\n const typedArray = new Uint32Array(featureIndices);\n const bufferIndex = scenegraph.gltf.buffers.push({\n arrayBuffer: typedArray.buffer,\n byteOffset: typedArray.byteOffset,\n byteLength: typedArray.byteLength\n }) - 1;\n const bufferViewIndex = scenegraph.addBufferView(typedArray, bufferIndex, 0);\n const accessorIndex = scenegraph.addAccessor(bufferViewIndex, {\n size: 1,\n componentType: getComponentTypeFromArray(typedArray),\n count: typedArray.length\n });\n primitive.attributes[attributeName] = accessorIndex;\n}\n/**\n * Gets the value from the texture by coordinates provided.\n * @param parsedImage - Image where the data are stored.\n * @param mimeType - MIME type.\n * @param textureCoordinates - uv coordinates to access data in the image.\n * @param index - Index of uv coordinates in the array textureCoordinates.\n * @param channels - Image channels where data are stored.\n * Channels of an RGBA texture are numbered 0..3 respectively.\n * For Ext_mesh_features and EXT_strucural_metadata the channels default is [0]\n * @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_mesh_features/schema/featureIdTexture.schema.json\n * @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/propertyTexture.property.schema.json\n * @returns Value taken from the image.\n */\nfunction getImageValueByCoordinates(parsedImage, mimeType, textureCoordinates, index, channels = [0]) {\n const CHANNELS_MAP = {\n r: { offset: 0, shift: 0 },\n g: { offset: 1, shift: 8 },\n b: { offset: 2, shift: 16 },\n a: { offset: 3, shift: 24 }\n };\n const u = textureCoordinates[index];\n const v = textureCoordinates[index + 1];\n let components = 1;\n if (mimeType && (mimeType.indexOf('image/jpeg') !== -1 || mimeType.indexOf('image/png') !== -1))\n components = 4;\n const offset = coordinatesToOffset(u, v, parsedImage, components);\n let value = 0;\n for (const c of channels) {\n /*\n According to the EXT_feature_metadata extension specification:\n Channels are labeled by rgba and are swizzled with a string of 1-4 characters.\n According to the EXT_mesh_features extension specification:\n The channels array contains non-negative integer values corresponding to channels of the source texture that the feature ID consists of.\n Channels of an RGBA texture are numbered 0–3 respectively.\n Function getImageValueByCoordinates is used to process both extensions.\n So, there should be possible to get the element of CHANNELS_MAP by either index (0, 1, 2, 3) or key (r, g, b, a).\n */\n const map = typeof c === 'number' ? Object.values(CHANNELS_MAP)[c] : CHANNELS_MAP[c];\n const imageOffset = offset + map.offset;\n const imageData = getImageData(parsedImage);\n if (imageData.data.length <= imageOffset) {\n throw new Error(`${imageData.data.length} <= ${imageOffset}`);\n }\n const imageValue = imageData.data[imageOffset];\n value |= imageValue << map.shift;\n }\n return value;\n}\n/**\n * Retrieves the offset in the image where the data are stored.\n * @param u - u-coordinate.\n * @param v - v-coordinate.\n * @param parsedImage - Image where the data are stored.\n * @param componentsCount - Number of components the data consists of.\n * @returns Offset in the image where the data are stored.\n */\nfunction coordinatesToOffset(u, v, parsedImage, componentsCount = 1) {\n const w = parsedImage.width;\n const iX = emod(u) * (w - 1);\n const indX = Math.round(iX);\n const h = parsedImage.height;\n const iY = emod(v) * (h - 1);\n const indY = Math.round(iY);\n const components = parsedImage.components ? parsedImage.components : componentsCount;\n // components is a number of channels in the image\n const offset = (indY * w + indX) * components;\n return offset;\n}\n/**\n * Parses variable-length array data.\n * In this case every value of the property in the table will be an array\n * of arbitrary length.\n * @param valuesData - Values in a flat typed array.\n * @param numberOfElements - Number of rows in the property table.\n * @param arrayOffsets - Offsets of nested arrays in the flat values array.\n * @param valuesDataBytesLength - Data byte length.\n * @param valueSize - Value size in bytes.\n * @returns Array of typed arrays.\n */\nexport function parseVariableLengthArrayNumeric(valuesData, numberOfElements, arrayOffsets, valuesDataBytesLength, valueSize) {\n const attributeValueArray = [];\n for (let index = 0; index < numberOfElements; index++) {\n const arrayOffset = arrayOffsets[index];\n const arrayByteSize = arrayOffsets[index + 1] - arrayOffsets[index];\n if (arrayByteSize + arrayOffset > valuesDataBytesLength) {\n break;\n }\n const typedArrayOffset = arrayOffset / valueSize;\n const elementCount = arrayByteSize / valueSize;\n attributeValueArray.push(valuesData.slice(typedArrayOffset, typedArrayOffset + elementCount));\n }\n return attributeValueArray;\n}\n/**\n * Parses fixed-length array data.\n * In this case every value of the property in the table will be an array\n * of constant length equal to `arrayCount`.\n * @param valuesData - Values in a flat typed array.\n * @param numberOfElements - Number of rows in the property table.\n * @param arrayCount - Nested arrays length.\n * @returns Array of typed arrays.\n */\nexport function parseFixedLengthArrayNumeric(valuesData, numberOfElements, arrayCount) {\n const attributeValueArray = [];\n for (let index = 0; index < numberOfElements; index++) {\n const elementOffset = index * arrayCount;\n attributeValueArray.push(valuesData.slice(elementOffset, elementOffset + arrayCount));\n }\n return attributeValueArray;\n}\n/**\n * Decodes properties of string type from binary source.\n * @param numberOfElements - The number of elements in each property array that propertyTableProperty contains. It's a number of rows in the table.\n * @param valuesDataBytes - Data taken from values property of the property table property.\n * @param arrayOffsets - Offsets for variable-length arrays. It's null for fixed-length arrays or scalar types.\n * @param stringOffsets - Index of the buffer view containing offsets for strings. It should be available for string type.\n * @returns String property values\n */\nexport function getPropertyDataString(numberOfElements, valuesDataBytes, arrayOffsets, stringOffsets) {\n if (arrayOffsets) {\n // TODO: implement it as soon as we have the corresponding tileset\n throw new Error('Not implemented - arrayOffsets for strings is specified');\n }\n if (stringOffsets) {\n const stringsArray = [];\n const textDecoder = new TextDecoder('utf8');\n let stringOffset = 0;\n for (let index = 0; index < numberOfElements; index++) {\n const stringByteSize = stringOffsets[index + 1] - stringOffsets[index];\n if (stringByteSize + stringOffset <= valuesDataBytes.length) {\n const stringData = valuesDataBytes.subarray(stringOffset, stringByteSize + stringOffset);\n const stringAttribute = textDecoder.decode(stringData);\n stringsArray.push(stringAttribute);\n stringOffset += stringByteSize;\n }\n }\n return stringsArray;\n }\n return [];\n}\n","import { GLTFScenegraph } from \"../api/gltf-scenegraph.js\";\nimport { getPrimitiveTextureData } from \"./utils/3d-tiles-utils.js\";\nimport { getComponentTypeFromArray } from \"../gltf-utils/gltf-utils.js\";\nconst EXT_MESH_FEATURES_NAME = 'EXT_mesh_features';\nexport const name = EXT_MESH_FEATURES_NAME;\nexport async function decode(gltfData, options) {\n const scenegraph = new GLTFScenegraph(gltfData);\n decodeExtMeshFeatures(scenegraph, options);\n}\nexport function encode(gltfData, options) {\n const scenegraph = new GLTFScenegraph(gltfData);\n encodeExtMeshFeatures(scenegraph, options);\n scenegraph.createBinaryChunk();\n return scenegraph.gltf;\n}\n/**\n * Decodes feature metadata from extension.\n * @param {GLTFScenegraph} scenegraph - Instance of the class for structured access to GLTF data.\n * @param {GLTFLoaderOptions} options - GLTFLoader options.\n */\nfunction decodeExtMeshFeatures(scenegraph, options) {\n const json = scenegraph.gltf.json;\n if (!json.meshes) {\n return;\n }\n // Iterate through all meshes/primitives.\n for (const mesh of json.meshes) {\n for (const primitive of mesh.primitives) {\n processMeshPrimitiveFeatures(scenegraph, primitive, options);\n }\n }\n}\n/**\n * Takes data from EXT_mesh_features and store it in 'data' property of featureIds.\n * If combined with EXT_structural_metadata, corresponding data are taken from the property tables of that extension.\n * @param {GLTFScenegraph} scenegraph - Instance of the class for structured access to GLTF data.\n * @param {GLTFMeshPrimitive} primitive - Primitive that contains extensions.\n * @param {GLTFLoaderOptions} options - GLTFLoader options.\n */\nfunction processMeshPrimitiveFeatures(scenegraph, primitive, options) {\n // Processing of mesh primitive features requires buffers to be loaded.\n if (!options?.gltf?.loadBuffers) {\n return;\n }\n const extension = primitive.extensions?.[EXT_MESH_FEATURES_NAME];\n const featureIds = extension?.featureIds;\n if (!featureIds) {\n return;\n }\n for (const featureId of featureIds) {\n let featureIdData;\n // Process \"Feature ID by Vertex\"\n if (typeof featureId.attribute !== 'undefined') {\n const accessorKey = `_FEATURE_ID_${featureId.attribute}`;\n const accessorIndex = primitive.attributes[accessorKey];\n featureIdData = scenegraph.getTypedArrayForAccessor(accessorIndex);\n }\n // Process \"Feature ID by Texture Coordinates\"\n else if (typeof featureId.texture !== 'undefined' && options?.gltf?.loadImages) {\n featureIdData = getPrimitiveTextureData(scenegraph, featureId.texture, primitive);\n }\n // Process \"Feature ID by Index\"\n else {\n /*\n When both featureId.attribute and featureId.texture are undefined,\n then the feature ID value for each vertex is given implicitly, via the index of the vertex.\n In this case, the featureCount must match the number of vertices of the mesh primitive.\n */\n // TODO: At the moment of writing we don't have a tileset with the data of that kind. Implement it later.\n featureIdData = [];\n }\n featureId.data = featureIdData;\n }\n}\n/*\n Encoding data\n*/\nfunction encodeExtMeshFeatures(scenegraph, options) {\n const meshes = scenegraph.gltf.json.meshes;\n if (!meshes) {\n return;\n }\n // Iterate through all meshes/primitives.\n for (const mesh of meshes) {\n for (const primitive of mesh.primitives) {\n encodeExtMeshFeaturesForPrimitive(scenegraph, primitive);\n }\n }\n}\n/**\n * Creates ExtMeshFeatures, creates a featureId containing feature ids provided.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param primitive - target primitive instance that will contain the extension\n * @param featureIdArray - Array of feature id\n * @param propertyTableIndex - index of the property table created by the ExtStructuralMetadata (optional).\n */\nexport function createExtMeshFeatures(scenegraph, primitive, featureIdArray, propertyTableIndex) {\n if (!primitive.extensions) {\n primitive.extensions = {};\n }\n let extension = primitive.extensions[EXT_MESH_FEATURES_NAME];\n if (!extension) {\n extension = { featureIds: [] };\n primitive.extensions[EXT_MESH_FEATURES_NAME] = extension;\n }\n const { featureIds } = extension;\n const featureId = {\n featureCount: featureIdArray.length,\n propertyTable: propertyTableIndex,\n data: featureIdArray\n };\n featureIds.push(featureId);\n scenegraph.addObjectExtension(primitive, EXT_MESH_FEATURES_NAME, extension);\n}\n/**\n * Encodes a feature ID set to extension.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param primitive - Primitive that the data encoded belongs to.\n * @see https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_mesh_features\n */\nfunction encodeExtMeshFeaturesForPrimitive(scenegraph, primitive) {\n const extension = primitive.extensions?.[EXT_MESH_FEATURES_NAME];\n if (!extension) {\n return;\n }\n const featureIds = extension.featureIds;\n featureIds.forEach((featureId, elementIndex) => {\n if (featureId.data) {\n const { accessorKey, index } = createAccessorKey(primitive.attributes);\n const typedArray = new Uint32Array(featureId.data);\n // Clean up featureId object.\n // Everything that could come from the original extension in case of round-trip decode/encode operations should be deleted.\n // We need make sure the featureId object is clean.\n featureIds[elementIndex] = {\n featureCount: typedArray.length,\n propertyTable: featureId.propertyTable,\n attribute: index\n };\n scenegraph.gltf.buffers.push({\n arrayBuffer: typedArray.buffer,\n byteOffset: typedArray.byteOffset,\n byteLength: typedArray.byteLength\n });\n const bufferViewIndex = scenegraph.addBufferView(typedArray);\n const accessorIndex = scenegraph.addAccessor(bufferViewIndex, {\n size: 1,\n componentType: getComponentTypeFromArray(typedArray),\n count: typedArray.length\n });\n primitive.attributes[accessorKey] = accessorIndex;\n }\n });\n}\n/**\n * Creates an accessor key for the attribute array provided.\n * The generated key has a suffix (number) that is the next consequtive in the list of existing accessors.\n * @param attributes - attribute array\n * @returns accessor key and the key suffix (number) used in the key.\n */\nfunction createAccessorKey(attributes) {\n const prefix = '_FEATURE_ID_';\n // Search for all \"_FEATURE_ID_n\" attribures in the primitive provided if any.\n // If there are some, e.g. \"_FEATURE_ID_0\", \"_FEATURE_ID_1\",\n // we will add a new one with the name \"_FEATURE_ID_2\"\n const attrs = Object.keys(attributes).filter((item) => item.indexOf(prefix) === 0);\n let max = -1;\n for (const a of attrs) {\n const n = Number(a.substring(prefix.length));\n if (n > max) {\n max = n;\n }\n }\n max++;\n const accessorKey = `${prefix}${max}`;\n return { accessorKey, index: max };\n}\n","import { GLTFScenegraph } from \"../api/gltf-scenegraph.js\";\nimport { convertRawBufferToMetadataArray, getPrimitiveTextureData, primitivePropertyDataToAttributes, getArrayElementByteSize, getOffsetsForProperty, parseVariableLengthArrayNumeric, parseFixedLengthArrayNumeric, getPropertyDataString } from \"./utils/3d-tiles-utils.js\";\nconst EXT_STRUCTURAL_METADATA_NAME = 'EXT_structural_metadata';\nexport const name = EXT_STRUCTURAL_METADATA_NAME;\nexport async function decode(gltfData, options) {\n const scenegraph = new GLTFScenegraph(gltfData);\n decodeExtStructuralMetadata(scenegraph, options);\n}\nexport function encode(gltfData, options) {\n const scenegraph = new GLTFScenegraph(gltfData);\n encodeExtStructuralMetadata(scenegraph, options);\n scenegraph.createBinaryChunk();\n return scenegraph.gltf;\n}\n/*\n// Example of the extension.\n// See more info at https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata\nconst extensions = {\n \"extensions\": {\n \"EXT_structural_metadata\": {\n \"schema\": {\n \"classes\": {\n \"tree\": {\n \"name\": \"Tree\",\n \"description\": \"Woody, perennial plant.\",\n \"properties\": {\n \"species\": {\n \"description\": \"Type of tree.\",\n \"type\": \"ENUM\",\n \"enumType\": \"speciesEnum\",\n \"required\": true\n },\n \"age\": {\n \"description\": \"The age of the tree, in years\",\n \"type\": \"SCALAR\",\n \"componentType\": \"UINT8\",\n \"required\": true\n }\n }\n }\n },\n \"enums\": {\n \"speciesEnum\": {\n \"name\": \"Species\",\n \"description\": \"An example enum for tree species.\",\n // valueType is not defined here. Default is \"UINT16\"\n \"values\": [\n { \"name\": \"Unspecified\", \"value\": 0 },\n { \"name\": \"Oak\", \"value\": 1 }\n ]\n }\n }\n },\n \"propertyTables\": [{\n \"name\": \"tree_survey_2021-09-29\",\n \"class\": \"tree\",\n \"count\": 10, // The number of elements in each property array (in `species`, in `age`).\n \"properties\": {\n \"species\": {\n \"values\": 0, // It's an index of the buffer view containing property values.\n },\n \"age\": {\n \"values\": 1\n }\n }\n }]\n }\n }\n}\n*/\n/**\n * Decodes feature metadata from extension.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param options - GLTFLoader options.\n */\nfunction decodeExtStructuralMetadata(scenegraph, options) {\n // Decoding metadata involves buffers processing.\n // So, if buffers have not been loaded, there is no reason to process metadata.\n if (!options.gltf?.loadBuffers) {\n return;\n }\n const extension = scenegraph.getExtension(EXT_STRUCTURAL_METADATA_NAME);\n if (!extension) {\n return;\n }\n if (options.gltf?.loadImages) {\n decodePropertyTextures(scenegraph, extension);\n }\n decodePropertyTables(scenegraph, extension);\n}\n/**\n * Processes the data stored in the textures\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param extension - Top-level extension.\n */\nfunction decodePropertyTextures(scenegraph, extension) {\n const propertyTextures = extension.propertyTextures;\n const json = scenegraph.gltf.json;\n if (propertyTextures && json.meshes) {\n // Iterate through all meshes/primitives.\n for (const mesh of json.meshes) {\n for (const primitive of mesh.primitives) {\n processPrimitivePropertyTextures(scenegraph, propertyTextures, primitive, extension);\n }\n }\n }\n}\n/**\n * Processes the data stored in the property tables.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param extension - Top-level extension.\n */\nfunction decodePropertyTables(scenegraph, extension) {\n const schema = extension.schema;\n if (!schema) {\n return;\n }\n const schemaClasses = schema.classes;\n const propertyTables = extension.propertyTables;\n if (schemaClasses && propertyTables) {\n for (const schemaName in schemaClasses) {\n const propertyTable = findPropertyTableByClass(propertyTables, schemaName);\n if (propertyTable) {\n processPropertyTable(scenegraph, schema, propertyTable);\n }\n }\n }\n}\n/**\n * Finds the property table by class name.\n * @param propertyTables - propertyTable definition taken from the top-level extension.\n * @param schemaClassName - class name in the extension schema.\n */\nfunction findPropertyTableByClass(propertyTables, schemaClassName) {\n for (const propertyTable of propertyTables) {\n if (propertyTable.class === schemaClassName) {\n return propertyTable;\n }\n }\n return null;\n}\n/**\n * Takes data from property textures reffered by the primitive.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param propertyTextures - propertyTexture definition taken from the top-level extention.\n * @param primitive - Primitive object.\n * @param extension - Top-level extension.\n */\nfunction processPrimitivePropertyTextures(scenegraph, propertyTextures, primitive, extension) {\n if (!propertyTextures) {\n return;\n }\n const primitiveExtension = primitive.extensions?.[EXT_STRUCTURAL_METADATA_NAME];\n const primitivePropertyTextureIndices = primitiveExtension?.propertyTextures;\n if (!primitivePropertyTextureIndices) {\n return;\n }\n for (const primitivePropertyTextureIndex of primitivePropertyTextureIndices) {\n const propertyTexture = propertyTextures[primitivePropertyTextureIndex];\n processPrimitivePropertyTexture(scenegraph, propertyTexture, primitive, extension);\n }\n}\n/**\n * Takes property data from the texture pointed by the primitive and appends them to `exension.data`.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param propertyTexture - propertyTexture definition taken from the top-level extension.\n * @param primitive - Primitive object.\n * @param extension - Top-level extension.\n */\nfunction processPrimitivePropertyTexture(scenegraph, propertyTexture, primitive, extension) {\n if (!propertyTexture.properties) {\n return;\n }\n if (!extension.dataAttributeNames) {\n extension.dataAttributeNames = [];\n }\n /* Iterate through all properties defined in propertyTexture, e.g. \"speed\" and \"direction\":\n {\n \"class\": \"wind\",\n \"properties\": {\n \"speed\": {\n \"index\": 0,\n \"texCoord\": 0,\n \"channels\": [0]\n },\n \"direction\": {\n \"index\": 0,\n \"texCoord\": 0,\n \"channels\": [1, 2]\n }\n }\n }\n */\n const className = propertyTexture.class;\n for (const propertyName in propertyTexture.properties) {\n // propertyName has values like \"speed\", \"direction\"\n // Make attributeName as a combination of the class name and the propertyName like \"wind_speed\" or \"wind_direction\"\n const attributeName = `${className}_${propertyName}`;\n const textureInfoTopLevel = propertyTexture.properties?.[propertyName];\n if (!textureInfoTopLevel) {\n // eslint-disable-next-line no-continue\n continue;\n }\n // The data taken from all meshes/primitives (the same property, e.g. \"speed\" or \"direction\") will be combined into one array and saved in textureInfoTopLevel.data\n // Initially textureInfoTopLevel.data will be initialized with an empty array.\n if (!textureInfoTopLevel.data) {\n textureInfoTopLevel.data = [];\n }\n const featureTextureTable = textureInfoTopLevel.data;\n const propertyData = getPrimitiveTextureData(scenegraph, textureInfoTopLevel, primitive);\n if (propertyData === null) {\n // eslint-disable-next-line no-continue\n continue;\n }\n primitivePropertyDataToAttributes(scenegraph, attributeName, propertyData, featureTextureTable, primitive);\n textureInfoTopLevel.data = featureTextureTable;\n extension.dataAttributeNames.push(attributeName);\n }\n}\n/**\n * Navigates through all properies in the property table, gets properties data,\n * and put the data to `propertyTable.data` as an array.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param schema - schema object.\n * @param propertyTable - propertyTable definition taken from the top-level extension.\n */\nfunction processPropertyTable(scenegraph, schema, propertyTable) {\n const schemaClass = schema.classes?.[propertyTable.class];\n if (!schemaClass) {\n throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${propertyTable.class}`);\n }\n const numberOfElements = propertyTable.count; // `propertyTable.count` is a number of elements in each property array.\n for (const propertyName in schemaClass.properties) {\n const classProperty = schemaClass.properties[propertyName];\n const propertyTableProperty = propertyTable.properties?.[propertyName];\n if (propertyTableProperty) {\n // Getting all elements (`numberOfElements`) of the array in the `propertyTableProperty`\n const data = getPropertyDataFromBinarySource(scenegraph, schema, classProperty, numberOfElements, propertyTableProperty);\n propertyTableProperty.data = data;\n }\n }\n}\n/**\n * Decodes a propertyTable column from binary source based on property type.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param schema - Schema object.\n * @param classProperty - class property object.\n * @param numberOfElements - The number of elements in each property array that propertyTableProperty contains. It's a number of rows in the table.\n * @param propertyTableProperty - propertyTable's property metadata.\n * @returns {string[] | number[] | string[][] | number[][]}\n */\nfunction getPropertyDataFromBinarySource(scenegraph, schema, classProperty, numberOfElements, propertyTableProperty) {\n let data = [];\n const valuesBufferView = propertyTableProperty.values;\n const valuesDataBytes = scenegraph.getTypedArrayForBufferView(valuesBufferView);\n const arrayOffsets = getArrayOffsetsForProperty(scenegraph, classProperty, propertyTableProperty, numberOfElements);\n const stringOffsets = getStringOffsetsForProperty(scenegraph, propertyTableProperty, numberOfElements);\n switch (classProperty.type) {\n case 'SCALAR':\n case 'VEC2':\n case 'VEC3':\n case 'VEC4':\n case 'MAT2':\n case 'MAT3':\n case 'MAT4': {\n data = getPropertyDataNumeric(classProperty, numberOfElements, valuesDataBytes, arrayOffsets);\n break;\n }\n case 'BOOLEAN': {\n // TODO: implement it as soon as we have the corresponding tileset\n throw new Error(`Not implemented - classProperty.type=${classProperty.type}`);\n }\n case 'STRING': {\n data = getPropertyDataString(numberOfElements, valuesDataBytes, arrayOffsets, stringOffsets);\n break;\n }\n case 'ENUM': {\n data = getPropertyDataENUM(schema, classProperty, numberOfElements, valuesDataBytes, arrayOffsets);\n break;\n }\n default:\n throw new Error(`Unknown classProperty type ${classProperty.type}`);\n }\n return data;\n}\n/**\n * Parses propertyTable.property.arrayOffsets that are offsets of sub-arrays in a flatten array of values.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param classProperty - class property object.\n * @param propertyTableProperty - propertyTable's property metadata.\n * @param numberOfElements - The number of elements in each property array that propertyTableProperty contains. It's a number of rows in the table.\n * @returns Typed array with offset values.\n * @see https://github.com/CesiumGS/glTF/blob/2976f1183343a47a29e4059a70961371cd2fcee8/extensions/2.0/Vendor/EXT_structural_metadata/schema/propertyTable.property.schema.json#L21\n */\nfunction getArrayOffsetsForProperty(scenegraph, classProperty, propertyTableProperty, numberOfElements) {\n if (classProperty.array &&\n // `count` is a number of array elements. May only be defined when `array` is true.\n // If `count` is NOT defined, it's a VARIABLE-length array\n typeof classProperty.count === 'undefined' &&\n // `arrayOffsets` is an index of the buffer view containing offsets for variable-length arrays.\n typeof propertyTableProperty.arrayOffsets !== 'undefined') {\n // Data are in a VARIABLE-length array\n return getOffsetsForProperty(scenegraph, propertyTableProperty.arrayOffsets, propertyTableProperty.arrayOffsetType || 'UINT32', numberOfElements);\n }\n return null;\n}\n/**\n * Parses propertyTable.property.stringOffsets.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param propertyTableProperty - propertyTable's property metadata.\n * @param numberOfElements - The number of elements in each property array that propertyTableProperty contains. It's a number of rows in the table.\n * @returns Typed array with offset values.\n * @see https://github.com/CesiumGS/glTF/blob/2976f1183343a47a29e4059a70961371cd2fcee8/extensions/2.0/Vendor/EXT_structural_metadata/schema/propertyTable.property.schema.json#L29C10-L29C23\n */\nfunction getStringOffsetsForProperty(scenegraph, propertyTableProperty, numberOfElements) {\n if (typeof propertyTableProperty.stringOffsets !== 'undefined' // `stringOffsets` is an index of the buffer view containing offsets for strings.\n ) {\n // Data are in a FIXED-length array\n return getOffsetsForProperty(scenegraph, propertyTableProperty.stringOffsets, propertyTableProperty.stringOffsetType || 'UINT32', numberOfElements);\n }\n return null;\n}\n/**\n * Decodes properties of SCALAR, VEC-N, MAT-N types from binary sourse.\n * @param classProperty - class property object.\n * @param numberOfElements - The number of elements in each property array that propertyTableProperty contains. It's a number of rows in the table.\n * @param valuesDataBytes - Data taken from values property of the property table property.\n * @param arrayOffsets - Offsets for variable-length arrays. It's null for fixed-length arrays or scalar types.\n * @returns Property values in a typed array or in an array of typed arrays.\n */\nfunction getPropertyDataNumeric(classProperty, numberOfElements, valuesDataBytes, arrayOffsets) {\n const isArray = classProperty.array;\n const arrayCount = classProperty.count;\n const elementSize = getArrayElementByteSize(classProperty.type, classProperty.componentType);\n const elementCount = valuesDataBytes.byteLength / elementSize;\n let valuesData;\n if (classProperty.componentType) {\n valuesData = convertRawBufferToMetadataArray(valuesDataBytes, classProperty.type, \n // The datatype of the element's components. Only applicable to `SCALAR`, `VECN`, and `MATN` types.\n classProperty.componentType, elementCount);\n }\n else {\n // The spec doesn't provide any info what to do if componentType is not set.\n valuesData = valuesDataBytes;\n }\n if (isArray) {\n if (arrayOffsets) {\n // VARIABLE-length array\n return parseVariableLengthArrayNumeric(valuesData, numberOfElements, arrayOffsets, valuesDataBytes.length, elementSize);\n }\n if (arrayCount) {\n // FIXED-length array\n return parseFixedLengthArrayNumeric(valuesData, numberOfElements, arrayCount);\n }\n return [];\n }\n return valuesData;\n}\n/**\n * Decodes properties of enum type from binary source.\n * @param schema - Schema object.\n * @param classProperty - Class property object.\n * @param numberOfElements - The number of elements in each property array that propertyTableProperty contains. It's a number of rows in the table.\n * @param valuesDataBytes - Data taken from values property of the property table property.\n * @param arrayOffsets - Offsets for variable-length arrays. It's null for fixed-length arrays or scalar types.\n * @returns Strings array of nested strings array.\n */\nfunction getPropertyDataENUM(schema, classProperty, numberOfElements, valuesDataBytes, arrayOffsets) {\n const enumType = classProperty.enumType;\n // Enum ID as declared in the `enums` dictionary. Required when `type` is `ENUM`.\n if (!enumType) {\n throw new Error('Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM');\n }\n const enumEntry = schema.enums?.[enumType];\n if (!enumEntry) {\n throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${enumType}`);\n }\n const enumValueType = enumEntry.valueType || 'UINT16';\n const elementSize = getArrayElementByteSize(classProperty.type, enumValueType);\n const elementCount = valuesDataBytes.byteLength / elementSize;\n let valuesData = convertRawBufferToMetadataArray(valuesDataBytes, classProperty.type, enumValueType, elementCount);\n if (!valuesData) {\n valuesData = valuesDataBytes;\n }\n if (classProperty.array) {\n if (arrayOffsets) {\n // VARIABLE-length array\n return parseVariableLengthArrayENUM({\n valuesData,\n numberOfElements,\n arrayOffsets,\n valuesDataBytesLength: valuesDataBytes.length,\n elementSize,\n enumEntry\n });\n }\n const arrayCount = classProperty.count;\n if (arrayCount) {\n // FIXED-length array\n return parseFixedLengthArrayENUM(valuesData, numberOfElements, arrayCount, enumEntry);\n }\n return [];\n }\n // Single value (not an array)\n return getEnumsArray(valuesData, 0, numberOfElements, enumEntry);\n}\n/**\n * Parses variable length nested ENUM arrays.\n * @param params.valuesData - Values in a flat typed array.\n * @param params.numberOfElements - The number of elements in each property array that propertyTableProperty contains. It's a number of rows in the table.\n * @param params.arrayOffsets - Offsets for variable-length arrays. It's null for fixed-length arrays or scalar types.\n * @param params.valuesDataBytesLength - Byte length of values array.\n * @param params.elementSize - Single element byte size.\n * @param params.enumEntry - Enums dictionary.\n * @returns Nested strings array.\n */\nfunction parseVariableLengthArrayENUM(params) {\n const { valuesData, numberOfElements, arrayOffsets, valuesDataBytesLength, elementSize, enumEntry } = params;\n const attributeValueArray = [];\n for (let index = 0; index < numberOfElements; index++) {\n const arrayOffset = arrayOffsets[index];\n const arrayByteSize = arrayOffsets[index + 1] - arrayOffsets[index];\n if (arrayByteSize + arrayOffset > valuesDataBytesLength) {\n break;\n }\n const typedArrayOffset = arrayOffset / elementSize;\n const elementCount = arrayByteSize / elementSize;\n const array = getEnumsArray(valuesData, typedArrayOffset, elementCount, enumEntry);\n attributeValueArray.push(array);\n }\n return attributeValueArray;\n}\n/**\n * Parses fixed length ENUM arrays.\n * @param valuesData - Values in a flat typed array.\n * @param numberOfElements - The number of elements in each property array that propertyTableProperty contains. It's a number of rows in the table.\n * @param arrayCount - Nested arrays length.\n * @param enumEntry - Enums dictionary.\n * @returns Nested strings array.\n */\nfunction parseFixedLengthArrayENUM(valuesData, numberOfElements, arrayCount, enumEntry) {\n const attributeValueArray = [];\n for (let index = 0; index < numberOfElements; index++) {\n const elementOffset = arrayCount * index;\n const array = getEnumsArray(valuesData, elementOffset, arrayCount, enumEntry);\n attributeValueArray.push(array);\n }\n return attributeValueArray;\n}\n/**\n * Parses ENUM values into a string array.\n * @param valuesData - Values in a flat typed array.\n * @param offset - Offset to start parse from.\n * @param count - Values length to parse.\n * @param enumEntry - Enums dictionary.\n * @returns Array of strings with parsed ENUM names.\n */\nfunction getEnumsArray(valuesData, offset, count, enumEntry) {\n const array = [];\n for (let i = 0; i < count; i++) {\n // At the moment we don't support BigInt. It requires additional calculations logic\n // and might be an issue in Safari\n if (valuesData instanceof BigInt64Array || valuesData instanceof BigUint64Array) {\n array.push('');\n }\n else {\n const value = valuesData[offset + i];\n const enumObject = getEnumByValue(enumEntry, value);\n if (enumObject) {\n array.push(enumObject.name);\n }\n else {\n array.push('');\n }\n }\n }\n return array;\n}\n/**\n * Looks up ENUM whose `value` property matches the specified number in the parameter `value`.\n * @param {GLTF_EXT_structural_metadata_Enum} enumEntry - ENUM entry containing the array of possible enums.\n * @param {number} value - The value of the ENUM to locate.\n * @returns {GLTF_EXT_structural_metadata_EnumValue | null} ENUM matcihng the specified value or null of no ENUM object was found.\n */\nfunction getEnumByValue(enumEntry, value) {\n for (const enumValue of enumEntry.values) {\n if (enumValue.value === value) {\n return enumValue;\n }\n }\n return null;\n}\nconst SCHEMA_CLASS_ID_DEFAULT = 'schemaClassId';\nfunction encodeExtStructuralMetadata(scenegraph, options) {\n const extension = scenegraph.getExtension(EXT_STRUCTURAL_METADATA_NAME);\n if (!extension) {\n return;\n }\n if (extension.propertyTables) {\n for (const table of extension.propertyTables) {\n const classId = table.class;\n const schemaClass = extension.schema?.classes?.[classId];\n if (table.properties && schemaClass) {\n encodeProperties(table, schemaClass, scenegraph);\n }\n }\n }\n}\nfunction encodeProperties(table, schemaClass, scenegraph) {\n for (const propertyName in table.properties) {\n const data = table.properties[propertyName].data;\n if (data) {\n const classProperty = schemaClass.properties[propertyName];\n if (classProperty) {\n const tableProperty = createPropertyTableProperty(data, classProperty, scenegraph);\n // Override table property that came with \"data\"\n table.properties[propertyName] = tableProperty;\n }\n }\n }\n}\n/**\n * Creates ExtStructuralMetadata, creates the schema and creates a property table containing feature data provided.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param propertyAttributes - property attributes\n * @param classId - classId to use for encoding metadata.\n * @returns Index of the table created.\n */\nexport function createExtStructuralMetadata(scenegraph, propertyAttributes, classId = SCHEMA_CLASS_ID_DEFAULT) {\n let extension = scenegraph.getExtension(EXT_STRUCTURAL_METADATA_NAME);\n if (!extension) {\n extension = scenegraph.addExtension(EXT_STRUCTURAL_METADATA_NAME);\n }\n extension.schema = createSchema(propertyAttributes, classId, extension.schema);\n const table = createPropertyTable(propertyAttributes, classId, extension.schema);\n if (!extension.propertyTables) {\n extension.propertyTables = [];\n }\n return extension.propertyTables.push(table) - 1; // index of the table\n}\nfunction createSchema(propertyAttributes, classId, schemaToUpdate) {\n const schema = schemaToUpdate ?? {\n id: 'schema_id'\n };\n const schemaClass = {\n properties: {}\n };\n for (const attribute of propertyAttributes) {\n const classProperty = {\n type: attribute.elementType,\n componentType: attribute.componentType\n };\n schemaClass.properties[attribute.name] = classProperty;\n }\n schema.classes = {};\n schema.classes[classId] = schemaClass;\n return schema;\n}\nfunction createPropertyTable(propertyAttributes, classId, schema) {\n const table = {\n class: classId,\n count: 0\n };\n // count is a number of rows in the table\n let count = 0;\n const schemaClass = schema.classes?.[classId];\n for (const attribute of propertyAttributes) {\n if (count === 0) {\n count = attribute.values.length;\n }\n // The number of elements in all propertyAttributes must be the same\n if (count !== attribute.values.length && attribute.values.length) {\n throw new Error('Illegal values in attributes');\n }\n const classProperty = schemaClass?.properties[attribute.name];\n if (classProperty) {\n // const tableProperty = createPropertyTableProperty(attribute, classProperty, scenegraph);\n if (!table.properties) {\n table.properties = {};\n }\n // values is a required field. Its real value will be set while encoding data\n table.properties[attribute.name] = { values: 0, data: attribute.values };\n }\n }\n table.count = count;\n return table;\n}\nfunction createPropertyTableProperty(\n// attribute: PropertyAttribute,\nvalues, classProperty, scenegraph) {\n const prop = { values: 0 };\n if (classProperty.type === 'STRING') {\n const { stringData, stringOffsets } = createPropertyDataString(values);\n prop.stringOffsets = createBufferView(stringOffsets, scenegraph);\n prop.values = createBufferView(stringData, scenegraph);\n }\n else if (classProperty.type === 'SCALAR' && classProperty.componentType) {\n const data = createPropertyDataScalar(values, classProperty.componentType);\n prop.values = createBufferView(data, scenegraph);\n }\n return prop;\n}\nconst COMPONENT_TYPE_TO_ARRAY_CONSTRUCTOR = {\n INT8: Int8Array,\n UINT8: Uint8Array,\n INT16: Int16Array,\n UINT16: Uint16Array,\n INT32: Int32Array,\n UINT32: Uint32Array,\n INT64: Int32Array,\n UINT64: Uint32Array,\n FLOAT32: Float32Array,\n FLOAT64: Float64Array\n};\nfunction createPropertyDataScalar(array, componentType) {\n const numberArray = [];\n for (const value of array) {\n numberArray.push(Number(value));\n }\n const Construct = COMPONENT_TYPE_TO_ARRAY_CONSTRUCTOR[componentType];\n if (!Construct) {\n throw new Error('Illegal component type');\n }\n return new Construct(numberArray);\n}\nfunction createPropertyDataString(strings) {\n const utf8Encode = new TextEncoder();\n const arr = [];\n let len = 0;\n for (const str of strings) {\n const uint8Array = utf8Encode.encode(str);\n len += uint8Array.length;\n arr.push(uint8Array);\n }\n const strArray = new Uint8Array(len);\n const strOffsets = [];\n let offset = 0;\n for (const str of arr) {\n strArray.set(str, offset);\n strOffsets.push(offset);\n offset += str.length;\n }\n strOffsets.push(offset); // The last offset represents the byte offset after the last string.\n const stringOffsetsTypedArray = new Uint32Array(strOffsets); // Its length = len+1\n return { stringData: strArray, stringOffsets: stringOffsetsTypedArray };\n}\nfunction createBufferView(typedArray, scenegraph) {\n scenegraph.gltf.buffers.push({\n arrayBuffer: typedArray.buffer,\n byteOffset: typedArray.byteOffset,\n byteLength: typedArray.byteLength\n });\n return scenegraph.addBufferView(typedArray);\n}\n","import { GLTFScenegraph } from \"../../api/gltf-scenegraph.js\";\nimport { convertRawBufferToMetadataArray, getPrimitiveTextureData, primitivePropertyDataToAttributes, getArrayElementByteSize, getOffsetsForProperty, parseVariableLengthArrayNumeric, parseFixedLengthArrayNumeric, getPropertyDataString } from \"../utils/3d-tiles-utils.js\";\n/** Extension name */\nconst EXT_FEATURE_METADATA_NAME = 'EXT_feature_metadata';\nexport const name = EXT_FEATURE_METADATA_NAME;\nexport async function decode(gltfData, options) {\n const scenegraph = new GLTFScenegraph(gltfData);\n decodeExtFeatureMetadata(scenegraph, options);\n}\n/**\n * Decodes feature metadata from extension.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param options - GLTFLoader options.\n */\nfunction decodeExtFeatureMetadata(scenegraph, options) {\n // Decoding metadata involves buffers processing.\n // So, if buffers have not been loaded, there is no reason to process metadata.\n if (!options.gltf?.loadBuffers) {\n return;\n }\n const extension = scenegraph.getExtension(EXT_FEATURE_METADATA_NAME);\n if (!extension) {\n return;\n }\n if (options.gltf?.loadImages) {\n decodePropertyTextures(scenegraph, extension);\n }\n decodePropertyTables(scenegraph, extension);\n}\n/**\n * Processes the data stored in the textures\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param extension - Top-level extension.\n */\nfunction decodePropertyTextures(scenegraph, extension) {\n const schema = extension.schema;\n if (!schema) {\n return;\n }\n const schemaClasses = schema.classes;\n const { featureTextures } = extension;\n if (schemaClasses && featureTextures) {\n for (const schemaName in schemaClasses) {\n const schemaClass = schemaClasses[schemaName];\n const featureTexture = findFeatureTextureByClass(featureTextures, schemaName);\n if (featureTexture) {\n handleFeatureTextureProperties(scenegraph, featureTexture, schemaClass);\n }\n }\n }\n}\n/**\n * Processes the data stored in the property tables.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param extension - Top-level extension.\n */\nfunction decodePropertyTables(scenegraph, extension) {\n const schema = extension.schema;\n if (!schema) {\n return;\n }\n const schemaClasses = schema.classes;\n const propertyTables = extension.featureTables;\n if (schemaClasses && propertyTables) {\n for (const schemaName in schemaClasses) {\n const propertyTable = findPropertyTableByClass(propertyTables, schemaName);\n if (propertyTable) {\n processPropertyTable(scenegraph, schema, propertyTable);\n }\n }\n }\n}\n/**\n * Finds the property table by class name.\n * @param propertyTables - propertyTable definition taken from the top-level extension.\n * @param schemaClassName - class name in the extension schema.\n */\nfunction findPropertyTableByClass(propertyTables, schemaClassName) {\n for (const propertyTableName in propertyTables) {\n const propertyTable = propertyTables[propertyTableName];\n if (propertyTable.class === schemaClassName) {\n return propertyTable;\n }\n }\n return null;\n}\nfunction findFeatureTextureByClass(featureTextures, schemaClassName) {\n for (const featureTexturesName in featureTextures) {\n const featureTable = featureTextures[featureTexturesName];\n if (featureTable.class === schemaClassName) {\n return featureTable;\n }\n }\n return null;\n}\n/**\n * Navigates through all properies in the property table, gets properties data,\n * and put the data to `propertyTable.data` as an array.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param schema - schema object.\n * @param propertyTable - propertyTable definition taken from the top-level extension.\n */\nfunction processPropertyTable(scenegraph, schema, propertyTable) {\n // Though 'class' is not required by spec, it doesn't make any scence when it's not provided.\n // So, bale out here.\n if (!propertyTable.class) {\n return;\n }\n const schemaClass = schema.classes?.[propertyTable.class];\n if (!schemaClass) {\n throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${propertyTable.class}`);\n }\n const numberOfElements = propertyTable.count; // `propertyTable.count` is a number of elements in each property array.\n for (const propertyName in schemaClass.properties) {\n const classProperty = schemaClass.properties[propertyName];\n const propertyTableProperty = propertyTable.properties?.[propertyName];\n if (propertyTableProperty) {\n // Getting all elements (`numberOfElements`) of the array in the `propertyTableProperty`\n const data = getPropertyDataFromBinarySource(scenegraph, schema, classProperty, numberOfElements, propertyTableProperty);\n propertyTableProperty.data = data;\n }\n }\n}\n/**\n * Navigates through all properies in feature texture and gets properties data.\n * Data will be stored in featureTexture.properties[propertyName].data.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param featureTexture\n * @param schemaClass\n */\nfunction handleFeatureTextureProperties(scenegraph, featureTexture, schemaClass) {\n const attributeName = featureTexture.class;\n for (const propertyName in schemaClass.properties) {\n const featureTextureProperty = featureTexture?.properties?.[propertyName];\n if (featureTextureProperty) {\n const data = getPropertyDataFromTexture(scenegraph, featureTextureProperty, attributeName);\n featureTextureProperty.data = data;\n }\n }\n}\n/**\n * Decodes properties from binary sourse based on property type.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param schemaProperty\n * @param numberOfFeatures\n * @param featureTableProperty\n */\nfunction getPropertyDataFromBinarySource(scenegraph, schema, classProperty, numberOfFeatures, featureTableProperty) {\n let data = [];\n const bufferView = featureTableProperty.bufferView;\n const dataArray = scenegraph.getTypedArrayForBufferView(bufferView);\n const arrayOffsets = getArrayOffsetsForProperty(scenegraph, classProperty, featureTableProperty, numberOfFeatures);\n const stringOffsets = getStringOffsetsForProperty(scenegraph, classProperty, featureTableProperty, numberOfFeatures);\n if (classProperty.type === 'STRING' || classProperty.componentType === 'STRING') {\n data = getPropertyDataString(numberOfFeatures, dataArray, arrayOffsets, stringOffsets);\n }\n else if (isNumericProperty(classProperty)) {\n data = getPropertyDataNumeric(classProperty, numberOfFeatures, dataArray, arrayOffsets);\n }\n return data;\n}\n/**\n * Parses propertyTable.property.arrayOffsets that are offsets of sub-arrays in a flatten array of values.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param classProperty - class property object.\n * @param propertyTableProperty - propertyTable's property metadata.\n * @param numberOfElements - The number of elements in each property array that propertyTableProperty contains. It's a number of rows in the table.\n * @returns Typed array with offset values.\n * @see https://github.com/CesiumGS/glTF/blob/2976f1183343a47a29e4059a70961371cd2fcee8/extensions/2.0/Vendor/EXT_structural_metadata/schema/propertyTable.property.schema.json#L21\n */\nfunction getArrayOffsetsForProperty(scenegraph, classProperty, propertyTableProperty, numberOfElements) {\n /*\n If ARRAY is used, then componentType must also be specified.\n ARRAY is a fixed-length array when componentCount is defined, and variable-length otherwise.\n */\n if (classProperty.type === 'ARRAY' &&\n // `componentCount` is a number of fixed-length array elements.\n // If `componentCount` is NOT defined, it's a VARIABLE-length array\n typeof classProperty.componentCount === 'undefined' &&\n // `arrayOffsetBufferView` is an index of the buffer view containing offsets for variable-length arrays.\n typeof propertyTableProperty.arrayOffsetBufferView !== 'undefined') {\n // Data are in a VARIABLE-length array\n return getOffsetsForProperty(scenegraph, propertyTableProperty.arrayOffsetBufferView, propertyTableProperty.offsetType || 'UINT32', // offsetType is used both for stringOffsetBufferView and arrayOffsetBufferView\n numberOfElements);\n }\n return null;\n}\n/**\n * Parses featureTable.property.stringOffsetBufferView.\n * String offsets is an array of offsets of strings in the united array of characters.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param propertyTableProperty - propertyTable's property metadata.\n * @param numberOfElements - The number of elements in each property array that propertyTableProperty contains. It's a number of rows in the table.\n * @returns Typed array of offset values. The number of offsets in the array is equal to `numberOfElements` plus one.\n * @see https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/featureTable.property.schema.json#L50C10-L50C32\n */\nfunction getStringOffsetsForProperty(scenegraph, classProperty, propertyTableProperty, numberOfElements) {\n if (typeof propertyTableProperty.stringOffsetBufferView !== 'undefined' // `stringOffsetBufferView` is an index of the buffer view containing offsets for strings.\n ) {\n // Data are in a FIXED-length array\n return getOffsetsForProperty(scenegraph, propertyTableProperty.stringOffsetBufferView, propertyTableProperty.offsetType || 'UINT32', // offsetType is used both for stringOffsetBufferView and arrayOffsetBufferView\n numberOfElements);\n }\n return null;\n}\n/**\n * Checks if the feature table property is of numeric type.\n * @param schemaPropertyType - feature table property\n * @returns true if property is numeric, else - false\n */\nfunction isNumericProperty(schemaProperty) {\n const types = [\n 'UINT8',\n 'INT16',\n 'UINT16',\n 'INT32',\n 'UINT32',\n 'INT64',\n 'UINT64',\n 'FLOAT32',\n 'FLOAT64'\n ];\n return (types.includes(schemaProperty.type) ||\n (typeof schemaProperty.componentType !== 'undefined' &&\n types.includes(schemaProperty.componentType)));\n}\n/**\n * Decodes properties of numeric types from binary sourse.\n * @param classProperty - class property object.\n * @param numberOfElements - The number of elements in each property array that propertyTableProperty contains. It's a number of rows in the table.\n * @param valuesDataBytes - Data taken from values property of the property table property.\n * @param arrayOffsets - Offsets for variable-length arrays. It's null for fixed-length arrays or scalar types.\n * @returns Property values in a typed array or in an array of typed arrays.\n */\nfunction getPropertyDataNumeric(classProperty, numberOfElements, valuesDataBytes, arrayOffsets) {\n const isArray = classProperty.type === 'ARRAY';\n const arrayCount = classProperty.componentCount;\n /*\n We are getting Numeric data. So,\n the component type can be one of NumericComponentType,\n the attribute type should be 'SCALAR'\n */\n const attributeType = 'SCALAR';\n const componentType = classProperty.componentType || classProperty.type;\n const elementSize = getArrayElementByteSize(attributeType, componentType);\n const elementCount = valuesDataBytes.byteLength / elementSize;\n const valuesData = convertRawBufferToMetadataArray(valuesDataBytes, attributeType, componentType, elementCount);\n if (isArray) {\n if (arrayOffsets) {\n // VARIABLE-length array\n return parseVariableLengthArrayNumeric(valuesData, numberOfElements, arrayOffsets, valuesDataBytes.length, elementSize);\n }\n if (arrayCount) {\n // FIXED-length array\n return parseFixedLengthArrayNumeric(valuesData, numberOfElements, arrayCount);\n }\n return [];\n }\n return valuesData;\n}\n/**\n * Gets properties from texture associated with all mesh primitives.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param featureTextureProperty\n * @param attributeName\n * @returns Feature texture data\n */\nfunction getPropertyDataFromTexture(scenegraph, featureTextureProperty, attributeName) {\n const json = scenegraph.gltf.json;\n if (!json.meshes) {\n return [];\n }\n const featureTextureTable = [];\n for (const mesh of json.meshes) {\n for (const primitive of mesh.primitives) {\n processPrimitiveTextures(scenegraph, attributeName, featureTextureProperty, featureTextureTable, primitive);\n }\n }\n return featureTextureTable;\n}\n/**\n * Processes data encoded in the texture associated with the primitive. This data will be accessible through the attributes.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param attributeName\n * @param featureTextureProperty\n * @param featureTextureTable\n * @param primitive\n */\nfunction processPrimitiveTextures(scenegraph, attributeName, featureTextureProperty, featureTextureTable, primitive) {\n const textureInfoTopLevel = {\n channels: featureTextureProperty.channels,\n ...featureTextureProperty.texture\n };\n const propertyData = getPrimitiveTextureData(scenegraph, textureInfoTopLevel, primitive);\n if (!propertyData) {\n return;\n }\n primitivePropertyDataToAttributes(scenegraph, attributeName, propertyData, featureTextureTable, primitive);\n}\n","// Version constant cannot be imported, it needs to correspond to the build version of **this** module.\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nexport const VERSION = typeof \"4.3.3\" !== 'undefined' ? \"4.3.3\" : 'latest';\n","import { padToNBytes, assert } from '@loaders.gl/loader-utils';\n/** Binary GLTF is little endian. */\nconst LITTLE_ENDIAN = true;\n/** 'glTF' in Big-Endian ASCII */\nconst MAGIC_glTF = 0x676c5446;\nconst GLB_FILE_HEADER_SIZE = 12;\nconst GLB_CHUNK_HEADER_SIZE = 8;\nconst GLB_CHUNK_TYPE_JSON = 0x4e4f534a;\nconst GLB_CHUNK_TYPE_BIN = 0x004e4942;\nconst GLB_V1_CONTENT_FORMAT_JSON = 0x0;\n/** @deprecated - Backward compatibility for old xviz files */\nconst GLB_CHUNK_TYPE_JSON_XVIZ_DEPRECATED = 0;\n/** @deprecated - Backward compatibility for old xviz files */\nconst GLB_CHUNK_TYPE_BIX_XVIZ_DEPRECATED = 1;\nfunction getMagicString(dataView, byteOffset = 0) {\n return `\\\n${String.fromCharCode(dataView.getUint8(byteOffset + 0))}\\\n${String.fromCharCode(dataView.getUint8(byteOffset + 1))}\\\n${String.fromCharCode(dataView.getUint8(byteOffset + 2))}\\\n${String.fromCharCode(dataView.getUint8(byteOffset + 3))}`;\n}\n/** Check if the contents of an array buffer contains GLB byte markers */\nexport function isGLB(arrayBuffer, byteOffset = 0, options = {}) {\n const dataView = new DataView(arrayBuffer);\n // Check that GLB Header starts with the magic number\n const { magic = MAGIC_glTF } = options;\n const magic1 = dataView.getUint32(byteOffset, false);\n return magic1 === magic || magic1 === MAGIC_glTF;\n}\n/**\n * Synchronously parse a GLB\n * @param glb - Target, Output is stored there\n * @param arrayBuffer - Input data\n * @param byteOffset - Offset into arrayBuffer to start parsing from (for \"embedded\" GLBs, e.g. in 3D tiles)\n * @param options\n * @returns\n */\nexport function parseGLBSync(glb, arrayBuffer, byteOffset = 0, options = {}) {\n // Check that GLB Header starts with the magic number\n const dataView = new DataView(arrayBuffer);\n // Compare format with GLBLoader documentation\n const type = getMagicString(dataView, byteOffset + 0);\n const version = dataView.getUint32(byteOffset + 4, LITTLE_ENDIAN); // Version 2 of binary glTF container format\n const byteLength = dataView.getUint32(byteOffset + 8, LITTLE_ENDIAN); // Total byte length of binary file\n Object.assign(glb, {\n // Put less important stuff in a header, to avoid clutter\n header: {\n byteOffset, // Byte offset into the initial arrayBuffer\n byteLength,\n hasBinChunk: false\n },\n type,\n version,\n json: {},\n binChunks: []\n });\n byteOffset += GLB_FILE_HEADER_SIZE;\n switch (glb.version) {\n case 1:\n return parseGLBV1(glb, dataView, byteOffset);\n case 2:\n return parseGLBV2(glb, dataView, byteOffset, (options = {}));\n default:\n throw new Error(`Invalid GLB version ${glb.version}. Only supports version 1 and 2.`);\n }\n}\n/**\n * Parse a V1 GLB\n * @param glb - target, output is stored in this object\n * @param dataView - Input, memory to be parsed\n * @param byteOffset - Offset of first byte of GLB data in the data view\n * @returns Number of bytes parsed (there could be additional non-GLB data after the GLB)\n */\nfunction parseGLBV1(glb, dataView, byteOffset) {\n // Sanity: ensure file is big enough to hold at least the headers\n assert(glb.header.byteLength > GLB_FILE_HEADER_SIZE + GLB_CHUNK_HEADER_SIZE);\n // Explanation of GLB structure:\n // https://cloud.githubusercontent.com/assets/3479527/22600725/36b87122-ea55-11e6-9d40-6fd42819fcab.png\n const contentLength = dataView.getUint32(byteOffset + 0, LITTLE_ENDIAN); // Byte length of chunk\n const contentFormat = dataView.getUint32(byteOffset + 4, LITTLE_ENDIAN); // Chunk format as uint32\n byteOffset += GLB_CHUNK_HEADER_SIZE;\n // GLB v1 only supports a single chunk type\n assert(contentFormat === GLB_V1_CONTENT_FORMAT_JSON);\n parseJSONChunk(glb, dataView, byteOffset, contentLength);\n // No need to call the function padToBytes() from parseJSONChunk()\n byteOffset += contentLength;\n byteOffset += parseBINChunk(glb, dataView, byteOffset, glb.header.byteLength);\n return byteOffset;\n}\n/**\n * Parse a V2 GLB\n * @param glb - target, output is stored in this object\n * @param dataView - Input, memory to be parsed\n * @param byteOffset - Offset of first byte of GLB data in the data view\n * @returns Number of bytes parsed (there could be additional non-GLB data after the GLB)\n */\nfunction parseGLBV2(glb, dataView, byteOffset, options) {\n // Sanity: ensure file is big enough to hold at least the first chunk header\n assert(glb.header.byteLength > GLB_FILE_HEADER_SIZE + GLB_CHUNK_HEADER_SIZE);\n parseGLBChunksSync(glb, dataView, byteOffset, options);\n return byteOffset + glb.header.byteLength;\n}\n/** Iterate over GLB chunks and parse them */\nfunction parseGLBChunksSync(glb, dataView, byteOffset, options) {\n // Per spec we must iterate over chunks, ignoring all except JSON and BIN\n // Iterate as long as there is space left for another chunk header\n while (byteOffset + 8 <= glb.header.byteLength) {\n const chunkLength = dataView.getUint32(byteOffset + 0, LITTLE_ENDIAN); // Byte length of chunk\n const chunkFormat = dataView.getUint32(byteOffset + 4, LITTLE_ENDIAN); // Chunk format as uint32\n byteOffset += GLB_CHUNK_HEADER_SIZE;\n // Per spec we must iterate over chunks, ignoring all except JSON and BIN\n switch (chunkFormat) {\n case GLB_CHUNK_TYPE_JSON:\n parseJSONChunk(glb, dataView, byteOffset, chunkLength);\n break;\n case GLB_CHUNK_TYPE_BIN:\n parseBINChunk(glb, dataView, byteOffset, chunkLength);\n break;\n // Backward compatibility for very old xviz files\n case GLB_CHUNK_TYPE_JSON_XVIZ_DEPRECATED:\n if (!options.strict) {\n parseJSONChunk(glb, dataView, byteOffset, chunkLength);\n }\n break;\n case GLB_CHUNK_TYPE_BIX_XVIZ_DEPRECATED:\n if (!options.strict) {\n parseBINChunk(glb, dataView, byteOffset, chunkLength);\n }\n break;\n default:\n // Ignore, per spec\n // console.warn(`Unknown GLB chunk type`); // eslint-disable-line\n break;\n }\n byteOffset += padToNBytes(chunkLength, 4);\n }\n return byteOffset;\n}\n/* Parse a GLB JSON chunk */\nfunction parseJSONChunk(glb, dataView, byteOffset, chunkLength) {\n // 1. Create a \"view\" of the binary encoded JSON data inside the GLB\n const jsonChunk = new Uint8Array(dataView.buffer, byteOffset, chunkLength);\n // 2. Decode the JSON binary array into clear text\n const textDecoder = new TextDecoder('utf8');\n const jsonText = textDecoder.decode(jsonChunk);\n // 3. Parse the JSON text into a JavaScript data structure\n glb.json = JSON.parse(jsonText);\n return padToNBytes(chunkLength, 4);\n}\n/** Parse a GLB BIN chunk */\nfunction parseBINChunk(glb, dataView, byteOffset, chunkLength) {\n // Note: BIN chunk can be optional\n glb.header.hasBinChunk = true;\n glb.binChunks.push({\n byteOffset,\n byteLength: chunkLength,\n arrayBuffer: dataView.buffer\n // TODO - copy, or create typed array view?\n });\n return padToNBytes(chunkLength, 4);\n}\n","// Resolves a relative url against a baseUrl\n// If url is absolute, return it unchanged\nexport function resolveUrl(url, options) {\n // TODO: Use better logic to handle all protocols plus not delay on data\n const absolute = url.startsWith('data:') || url.startsWith('http:') || url.startsWith('https:');\n if (absolute) {\n return url;\n }\n const baseUrl = options.baseUri || options.uri;\n if (!baseUrl) {\n throw new Error(`'baseUri' must be provided to resolve relative url ${url}`);\n }\n return baseUrl.substr(0, baseUrl.lastIndexOf('/') + 1) + url;\n}\n","// This file is part of meshoptimizer library and is distributed under the terms of MIT License.\n// Copyright (C) 2016-2021, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)\n/* eslint-disable camelcase */\nconst isWebAssemblySupported = typeof WebAssembly !== 'object';\n// Built with clang version 11.0.0 (https://github.com/llvm/llvm-project.git 0160ad802e899c2922bc9b29564080c22eb0908c)\n// Built from meshoptimizer 0.16\nconst wasm_base = 'B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGB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JAID8dFAGDBIBDyF+t+J83EBALAVANDQNVi8ZcMpySQ8c8dfb8e8fHND8dBAGDBIBDyG+t+J83EBABCiJAND8dFAGDBIBDyE+t+J83EBABCAJRBAECIJHEAF9JQBMMM/3FGEaF978jUUUUBCoBlREGXAGCGrAF9sHIC98ZHL9FQBCBRGABRFEXAFAFDBBBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBAFCTJRFAGCIJHGAL9JQBMMGXALAI9PQBAEAICEZHGCGWHFqCBCoBAFl/8MBAEABALCGWJHLAF/8cBBGXAG9FQBAEAEDBIBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMIBMALAEAF/8cBBMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB';\n// Uses bulk-memory and simd extensions\nconst detector = new Uint8Array([\n 0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 3, 2, 0, 0, 5, 3, 1, 0, 1, 12, 1, 0, 10, 22, 2,\n 12, 0, 65, 0, 65, 0, 65, 0, 252, 10, 0, 0, 11, 7, 0, 65, 0, 253, 15, 26, 11\n]);\n// Used to unpack wasm\nconst wasmpack = new Uint8Array([\n 32, 0, 65, 253, 3, 1, 2, 34, 4, 106, 6, 5, 11, 8, 7, 20, 13, 33, 12, 16, 128, 9, 116, 64, 19, 113,\n 127, 15, 10, 21, 22, 14, 255, 66, 24, 54, 136, 107, 18, 23, 192, 26, 114, 118, 132, 17, 77, 101,\n 130, 144, 27, 87, 131, 44, 45, 74, 156, 154, 70, 167\n]);\nconst FILTERS = {\n // legacy index-based enums for glTF\n 0: '',\n 1: 'meshopt_decodeFilterOct',\n 2: 'meshopt_decodeFilterQuat',\n 3: 'meshopt_decodeFilterExp',\n // string-based enums for glTF\n NONE: '',\n OCTAHEDRAL: 'meshopt_decodeFilterOct',\n QUATERNION: 'meshopt_decodeFilterQuat',\n EXPONENTIAL: 'meshopt_decodeFilterExp'\n};\nconst DECODERS = {\n // legacy index-based enums for glTF\n 0: 'meshopt_decodeVertexBuffer',\n 1: 'meshopt_decodeIndexBuffer',\n 2: 'meshopt_decodeIndexSequence',\n // string-based enums for glTF\n ATTRIBUTES: 'meshopt_decodeVertexBuffer',\n TRIANGLES: 'meshopt_decodeIndexBuffer',\n INDICES: 'meshopt_decodeIndexSequence'\n};\nexport function isMeshoptSupported() {\n return isWebAssemblySupported;\n}\nexport async function meshoptDecodeVertexBuffer(target, count, size, source, filter = 'NONE') {\n const instance = await loadWasmInstance();\n decode(instance, instance.exports.meshopt_decodeVertexBuffer, target, count, size, source, instance.exports[FILTERS[filter]]);\n}\nexport async function meshoptDecodeIndexBuffer(target, count, size, source) {\n const instance = await loadWasmInstance();\n decode(instance, instance.exports.meshopt_decodeIndexBuffer, target, count, size, source);\n}\nexport async function meshoptDecodeIndexSequence(target, count, size, source) {\n const instance = await loadWasmInstance();\n decode(instance, instance.exports.meshopt_decodeIndexSequence, target, count, size, source);\n}\n// eslint-disable-next-line max-params\nexport async function meshoptDecodeGltfBuffer(target, count, size, source, mode, filter = 'NONE') {\n const instance = await loadWasmInstance();\n decode(instance, instance.exports[DECODERS[mode]], target, count, size, source, instance.exports[FILTERS[filter || 'NONE']]);\n}\nlet wasmPromise;\nasync function loadWasmInstance() {\n // eslint-disable-next-line\n if (!wasmPromise) {\n wasmPromise = loadWasmModule();\n }\n return wasmPromise;\n}\nasync function loadWasmModule() {\n let wasm = wasm_base;\n if (WebAssembly.validate(detector)) {\n wasm = wasm_simd;\n // eslint-disable-next-line no-console\n console.log('Warning: meshopt_decoder is using experimental SIMD support');\n }\n const result = await WebAssembly.instantiate(unpack(wasm), {});\n await result.instance.exports.__wasm_call_ctors();\n return result.instance;\n}\nfunction unpack(data) {\n const result = new Uint8Array(data.length);\n for (let i = 0; i < data.length; ++i) {\n const ch = data.charCodeAt(i);\n result[i] = ch > 96 ? ch - 71 : ch > 64 ? ch - 65 : ch > 47 ? ch + 4 : ch > 46 ? 63 : 62;\n }\n let write = 0;\n for (let i = 0; i < data.length; ++i) {\n result[write++] = result[i] < 60 ? wasmpack[result[i]] : (result[i] - 60) * 64 + result[++i];\n }\n return result.buffer.slice(0, write);\n}\n// eslint-disable-next-line max-params\nfunction decode(instance, fun, target, count, size, source, filter) {\n const sbrk = instance.exports.sbrk;\n const count4 = (count + 3) & ~3; // pad for SIMD filter\n const tp = sbrk(count4 * size);\n const sp = sbrk(source.length);\n const heap = new Uint8Array(instance.exports.memory.buffer);\n heap.set(source, sp);\n const res = fun(tp, count, size, sp, source.length);\n if (res === 0 && filter) {\n filter(tp, count4, size);\n }\n target.set(heap.subarray(tp, tp + count * size));\n sbrk(tp - sbrk(0));\n if (res !== 0) {\n throw new Error(`Malformed buffer data: ${res}`);\n }\n}\n","import { GLTFScenegraph } from \"../api/gltf-scenegraph.js\";\nimport { meshoptDecodeGltfBuffer } from \"../../meshopt/meshopt-decoder.js\";\n// @ts-ignore\n// eslint-disable-next-line\nconst DEFAULT_MESHOPT_OPTIONS = {\n byteOffset: 0,\n filter: 'NONE'\n};\n/** Extension name */\nconst EXT_MESHOPT_COMPRESSION = 'EXT_meshopt_compression';\nexport const name = EXT_MESHOPT_COMPRESSION;\nexport async function decode(gltfData, options) {\n const scenegraph = new GLTFScenegraph(gltfData);\n if (!options?.gltf?.decompressMeshes || !options.gltf?.loadBuffers) {\n return;\n }\n const promises = [];\n for (const bufferViewIndex of gltfData.json.bufferViews || []) {\n promises.push(decodeMeshoptBufferView(scenegraph, bufferViewIndex));\n }\n // Decompress meshes in parallel\n await Promise.all(promises);\n // We have now decompressed all primitives, so remove the top-level extension\n scenegraph.removeExtension(EXT_MESHOPT_COMPRESSION);\n}\n/** Decode one meshopt buffer view */\nasync function decodeMeshoptBufferView(scenegraph, bufferView) {\n const meshoptExtension = scenegraph.getObjectExtension(bufferView, EXT_MESHOPT_COMPRESSION);\n if (meshoptExtension) {\n const { byteOffset = 0, byteLength = 0, byteStride, count, mode, filter = 'NONE', buffer: bufferIndex } = meshoptExtension;\n const buffer = scenegraph.gltf.buffers[bufferIndex];\n const source = new Uint8Array(buffer.arrayBuffer, buffer.byteOffset + byteOffset, byteLength);\n const result = new Uint8Array(scenegraph.gltf.buffers[bufferView.buffer].arrayBuffer, bufferView.byteOffset, bufferView.byteLength);\n await meshoptDecodeGltfBuffer(result, count, byteStride, source, mode, filter);\n scenegraph.removeObjectExtension(bufferView, EXT_MESHOPT_COMPRESSION);\n }\n}\n","// GLTF EXTENSION: EXT_TEXTURE_WEBP\n// https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/EXT_TEXTURE_WEBP\n/* eslint-disable camelcase */\nimport { isImageFormatSupported } from '@loaders.gl/images';\nimport { GLTFScenegraph } from \"../api/gltf-scenegraph.js\";\nconst EXT_TEXTURE_WEBP = 'EXT_texture_webp';\n/** Extension name */\nexport const name = EXT_TEXTURE_WEBP;\n/**\n * Replaces a texture source reference with the extension texture\n * Done in preprocess() to prevent load of default image\n */\nexport function preprocess(gltfData, options) {\n const scenegraph = new GLTFScenegraph(gltfData);\n if (!isImageFormatSupported('image/webp')) {\n if (scenegraph.getRequiredExtensions().includes(EXT_TEXTURE_WEBP)) {\n throw new Error(`gltf: Required extension ${EXT_TEXTURE_WEBP} not supported by browser`);\n }\n return;\n }\n const { json } = scenegraph;\n for (const texture of json.textures || []) {\n const extension = scenegraph.getObjectExtension(texture, EXT_TEXTURE_WEBP);\n if (extension) {\n // TODO - if multiple texture extensions are present which one wins?\n texture.source = extension.source;\n }\n scenegraph.removeObjectExtension(texture, EXT_TEXTURE_WEBP);\n }\n // Remove the top-level extension\n scenegraph.removeExtension(EXT_TEXTURE_WEBP);\n}\n","// GLTF EXTENSION: KHR_texture_basisu\n// https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_texture_basisu\n/* eslint-disable camelcase */\nimport { GLTFScenegraph } from \"../api/gltf-scenegraph.js\";\nconst KHR_TEXTURE_BASISU = 'KHR_texture_basisu';\n/** Extension name */\nexport const name = KHR_TEXTURE_BASISU;\n/**\n * Replaces a texture source reference with the extension texture\n * Done in preprocess() to prevent load of default image\n */\nexport function preprocess(gltfData, options) {\n const scene = new GLTFScenegraph(gltfData);\n const { json } = scene;\n for (const texture of json.textures || []) {\n const extension = scene.getObjectExtension(texture, KHR_TEXTURE_BASISU);\n if (extension) {\n // TODO - if multiple texture extensions are present which one wins?\n texture.source = extension.source;\n scene.removeObjectExtension(texture, KHR_TEXTURE_BASISU);\n }\n }\n // Remove the top-level extension\n scene.removeExtension(KHR_TEXTURE_BASISU);\n}\n","// Version constant cannot be imported, it needs to correspond to the build version of **this** module.\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nexport const VERSION = typeof \"4.3.3\" !== 'undefined' ? \"4.3.3\" : 'latest';\n","// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { VERSION } from \"./lib/utils/version.js\";\n/**\n * Worker loader for Draco3D compressed geometries\n */\nexport const DracoLoader = {\n dataType: null,\n batchType: null,\n name: 'Draco',\n id: 'draco',\n module: 'draco',\n // shapes: ['mesh'],\n version: VERSION,\n worker: true,\n extensions: ['drc'],\n mimeTypes: ['application/octet-stream'],\n binary: true,\n tests: ['DRACO'],\n options: {\n draco: {\n decoderType: typeof WebAssembly === 'object' ? 'wasm' : 'js', // 'js' for IE11\n libraryPath: 'libs/',\n extraAttributes: {},\n attributeNameEntry: undefined\n }\n }\n};\n","import { deduceMeshField } from '@loaders.gl/schema';\n/** Extract an arrow-like schema from a Draco mesh */\nexport function getDracoSchema(attributes, loaderData, indices) {\n const metadata = makeMetadata(loaderData.metadata);\n const fields = [];\n const namedLoaderDataAttributes = transformAttributesLoaderData(loaderData.attributes);\n for (const attributeName in attributes) {\n const attribute = attributes[attributeName];\n const field = getArrowFieldFromAttribute(attributeName, attribute, namedLoaderDataAttributes[attributeName]);\n fields.push(field);\n }\n if (indices) {\n const indicesField = getArrowFieldFromAttribute('indices', indices);\n fields.push(indicesField);\n }\n return { fields, metadata };\n}\nfunction transformAttributesLoaderData(loaderData) {\n const result = {};\n for (const key in loaderData) {\n const dracoAttribute = loaderData[key];\n result[dracoAttribute.name || 'undefined'] = dracoAttribute;\n }\n return result;\n}\nfunction getArrowFieldFromAttribute(attributeName, attribute, loaderData) {\n const metadataMap = loaderData ? makeMetadata(loaderData.metadata) : undefined;\n const field = deduceMeshField(attributeName, attribute, metadataMap);\n return field;\n}\nfunction makeMetadata(metadata) {\n Object.entries(metadata);\n const serializedMetadata = {};\n for (const key in metadata) {\n serializedMetadata[`${key}.string`] = JSON.stringify(metadata[key]);\n }\n return serializedMetadata;\n}\n","/* eslint-disable camelcase */\nimport { getMeshBoundingBox } from '@loaders.gl/schema';\nimport { getDracoSchema } from \"./utils/get-draco-schema.js\";\n// @ts-ignore\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nconst GEOMETRY_TYPE = {\n TRIANGULAR_MESH: 0,\n POINT_CLOUD: 1\n};\n// Native Draco attribute names to GLTF attribute names.\nconst DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP = {\n POSITION: 'POSITION',\n NORMAL: 'NORMAL',\n COLOR: 'COLOR_0',\n TEX_COORD: 'TEXCOORD_0'\n};\nconst DRACO_DATA_TYPE_TO_TYPED_ARRAY_MAP = {\n 1: Int8Array,\n 2: Uint8Array,\n 3: Int16Array,\n 4: Uint16Array,\n 5: Int32Array,\n 6: Uint32Array,\n // 7: BigInt64Array,\n // 8: BigUint64Array,\n 9: Float32Array\n // 10: Float64Array\n // 11: BOOL - What array type do we use for this?\n};\nconst INDEX_ITEM_SIZE = 4;\nexport default class DracoParser {\n draco;\n decoder;\n metadataQuerier;\n // draco - the draco decoder, either import `draco3d` or load dynamically\n constructor(draco) {\n this.draco = draco;\n this.decoder = new this.draco.Decoder();\n this.metadataQuerier = new this.draco.MetadataQuerier();\n }\n /**\n * Destroy draco resources\n */\n destroy() {\n this.draco.destroy(this.decoder);\n this.draco.destroy(this.metadataQuerier);\n }\n /**\n * NOTE: caller must call `destroyGeometry` on the return value after using it\n * @param arrayBuffer\n * @param options\n */\n parseSync(arrayBuffer, options = {}) {\n const buffer = new this.draco.DecoderBuffer();\n buffer.Init(new Int8Array(arrayBuffer), arrayBuffer.byteLength);\n this._disableAttributeTransforms(options);\n const geometry_type = this.decoder.GetEncodedGeometryType(buffer);\n const dracoGeometry = geometry_type === this.draco.TRIANGULAR_MESH\n ? new this.draco.Mesh()\n : new this.draco.PointCloud();\n try {\n let dracoStatus;\n switch (geometry_type) {\n case this.draco.TRIANGULAR_MESH:\n dracoStatus = this.decoder.DecodeBufferToMesh(buffer, dracoGeometry);\n break;\n case this.draco.POINT_CLOUD:\n dracoStatus = this.decoder.DecodeBufferToPointCloud(buffer, dracoGeometry);\n break;\n default:\n throw new Error('DRACO: Unknown geometry type.');\n }\n if (!dracoStatus.ok() || !dracoGeometry.ptr) {\n const message = `DRACO decompression failed: ${dracoStatus.error_msg()}`;\n // console.error(message);\n throw new Error(message);\n }\n const loaderData = this._getDracoLoaderData(dracoGeometry, geometry_type, options);\n const geometry = this._getMeshData(dracoGeometry, loaderData, options);\n const boundingBox = getMeshBoundingBox(geometry.attributes);\n const schema = getDracoSchema(geometry.attributes, loaderData, geometry.indices);\n const data = {\n loader: 'draco',\n loaderData,\n header: {\n vertexCount: dracoGeometry.num_points(),\n boundingBox\n },\n ...geometry,\n schema\n };\n return data;\n }\n finally {\n this.draco.destroy(buffer);\n if (dracoGeometry) {\n this.draco.destroy(dracoGeometry);\n }\n }\n }\n // Draco specific \"loader data\"\n /**\n * Extract\n * @param dracoGeometry\n * @param geometry_type\n * @param options\n * @returns\n */\n _getDracoLoaderData(dracoGeometry, geometry_type, options) {\n const metadata = this._getTopLevelMetadata(dracoGeometry);\n const attributes = this._getDracoAttributes(dracoGeometry, options);\n return {\n geometry_type,\n num_attributes: dracoGeometry.num_attributes(),\n num_points: dracoGeometry.num_points(),\n num_faces: dracoGeometry instanceof this.draco.Mesh ? dracoGeometry.num_faces() : 0,\n metadata,\n attributes\n };\n }\n /**\n * Extract all draco provided information and metadata for each attribute\n * @param dracoGeometry\n * @param options\n * @returns\n */\n _getDracoAttributes(dracoGeometry, options) {\n const dracoAttributes = {};\n for (let attributeId = 0; attributeId < dracoGeometry.num_attributes(); attributeId++) {\n // Note: Draco docs do not seem clear on `GetAttribute` ids just being a zero-based index,\n // but it does seems to work this way\n const dracoAttribute = this.decoder.GetAttribute(dracoGeometry, attributeId);\n const metadata = this._getAttributeMetadata(dracoGeometry, attributeId);\n dracoAttributes[dracoAttribute.unique_id()] = {\n unique_id: dracoAttribute.unique_id(),\n attribute_type: dracoAttribute.attribute_type(),\n data_type: dracoAttribute.data_type(),\n num_components: dracoAttribute.num_components(),\n byte_offset: dracoAttribute.byte_offset(),\n byte_stride: dracoAttribute.byte_stride(),\n normalized: dracoAttribute.normalized(),\n attribute_index: attributeId,\n metadata\n };\n // Add transformation parameters for any attributes app wants untransformed\n const quantization = this._getQuantizationTransform(dracoAttribute, options);\n if (quantization) {\n dracoAttributes[dracoAttribute.unique_id()].quantization_transform = quantization;\n }\n const octahedron = this._getOctahedronTransform(dracoAttribute, options);\n if (octahedron) {\n dracoAttributes[dracoAttribute.unique_id()].octahedron_transform = octahedron;\n }\n }\n return dracoAttributes;\n }\n /**\n * Get standard loaders.gl mesh category data\n * Extracts the geometry from draco\n * @param dracoGeometry\n * @param options\n */\n _getMeshData(dracoGeometry, loaderData, options) {\n const attributes = this._getMeshAttributes(loaderData, dracoGeometry, options);\n const positionAttribute = attributes.POSITION;\n if (!positionAttribute) {\n throw new Error('DRACO: No position attribute found.');\n }\n // For meshes, we need indices to define the faces.\n if (dracoGeometry instanceof this.draco.Mesh) {\n switch (options.topology) {\n case 'triangle-strip':\n return {\n topology: 'triangle-strip',\n mode: 4, // GL.TRIANGLES\n attributes,\n indices: {\n value: this._getTriangleStripIndices(dracoGeometry),\n size: 1\n }\n };\n case 'triangle-list':\n default:\n return {\n topology: 'triangle-list',\n mode: 5, // GL.TRIANGLE_STRIP\n attributes,\n indices: {\n value: this._getTriangleListIndices(dracoGeometry),\n size: 1\n }\n };\n }\n }\n // PointCloud - must come last as Mesh inherits from PointCloud\n return {\n topology: 'point-list',\n mode: 0, // GL.POINTS\n attributes\n };\n }\n _getMeshAttributes(loaderData, dracoGeometry, options) {\n const attributes = {};\n for (const loaderAttribute of Object.values(loaderData.attributes)) {\n const attributeName = this._deduceAttributeName(loaderAttribute, options);\n loaderAttribute.name = attributeName;\n const values = this._getAttributeValues(dracoGeometry, loaderAttribute);\n if (values) {\n const { value, size } = values;\n attributes[attributeName] = {\n value,\n size,\n byteOffset: loaderAttribute.byte_offset,\n byteStride: loaderAttribute.byte_stride,\n normalized: loaderAttribute.normalized\n };\n }\n }\n return attributes;\n }\n // MESH INDICES EXTRACTION\n /**\n * For meshes, we need indices to define the faces.\n * @param dracoGeometry\n */\n _getTriangleListIndices(dracoGeometry) {\n // Example on how to retrieve mesh and attributes.\n const numFaces = dracoGeometry.num_faces();\n const numIndices = numFaces * 3;\n const byteLength = numIndices * INDEX_ITEM_SIZE;\n const ptr = this.draco._malloc(byteLength);\n try {\n this.decoder.GetTrianglesUInt32Array(dracoGeometry, byteLength, ptr);\n return new Uint32Array(this.draco.HEAPF32.buffer, ptr, numIndices).slice();\n }\n finally {\n this.draco._free(ptr);\n }\n }\n /**\n * For meshes, we need indices to define the faces.\n * @param dracoGeometry\n */\n _getTriangleStripIndices(dracoGeometry) {\n const dracoArray = new this.draco.DracoInt32Array();\n try {\n /* const numStrips = */ this.decoder.GetTriangleStripsFromMesh(dracoGeometry, dracoArray);\n return getUint32Array(dracoArray);\n }\n finally {\n this.draco.destroy(dracoArray);\n }\n }\n /**\n *\n * @param dracoGeometry\n * @param dracoAttribute\n * @param attributeName\n */\n _getAttributeValues(dracoGeometry, attribute) {\n const TypedArrayCtor = DRACO_DATA_TYPE_TO_TYPED_ARRAY_MAP[attribute.data_type];\n if (!TypedArrayCtor) {\n // eslint-disable-next-line no-console\n console.warn(`DRACO: Unsupported attribute type ${attribute.data_type}`);\n return null;\n }\n const numComponents = attribute.num_components;\n const numPoints = dracoGeometry.num_points();\n const numValues = numPoints * numComponents;\n const byteLength = numValues * TypedArrayCtor.BYTES_PER_ELEMENT;\n const dataType = getDracoDataType(this.draco, TypedArrayCtor);\n let value;\n const ptr = this.draco._malloc(byteLength);\n try {\n const dracoAttribute = this.decoder.GetAttribute(dracoGeometry, attribute.attribute_index);\n this.decoder.GetAttributeDataArrayForAllPoints(dracoGeometry, dracoAttribute, dataType, byteLength, ptr);\n value = new TypedArrayCtor(this.draco.HEAPF32.buffer, ptr, numValues).slice();\n }\n finally {\n this.draco._free(ptr);\n }\n return { value, size: numComponents };\n }\n // Attribute names\n /**\n * DRACO does not store attribute names - We need to deduce an attribute name\n * for each attribute\n _getAttributeNames(\n dracoGeometry: Mesh | PointCloud,\n options: DracoParseOptions\n ): {[unique_id: number]: string} {\n const attributeNames: {[unique_id: number]: string} = {};\n for (let attributeId = 0; attributeId < dracoGeometry.num_attributes(); attributeId++) {\n const dracoAttribute = this.decoder.GetAttribute(dracoGeometry, attributeId);\n const attributeName = this._deduceAttributeName(dracoAttribute, options);\n attributeNames[attributeName] = attributeName;\n }\n return attributeNames;\n }\n */\n /**\n * Deduce an attribute name.\n * @note DRACO does not save attribute names, just general type (POSITION, COLOR)\n * to help optimize compression. We generate GLTF compatible names for the Draco-recognized\n * types\n * @param attributeData\n */\n _deduceAttributeName(attribute, options) {\n // Deduce name based on application provided map\n const uniqueId = attribute.unique_id;\n for (const [attributeName, attributeUniqueId] of Object.entries(options.extraAttributes || {})) {\n if (attributeUniqueId === uniqueId) {\n return attributeName;\n }\n }\n // Deduce name based on attribute type\n const thisAttributeType = attribute.attribute_type;\n for (const dracoAttributeConstant in DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP) {\n const attributeType = this.draco[dracoAttributeConstant];\n if (attributeType === thisAttributeType) {\n // TODO - Return unique names if there multiple attributes per type\n // (e.g. multiple TEX_COORDS or COLORS)\n return DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP[dracoAttributeConstant];\n }\n }\n // Look up in metadata\n // TODO - shouldn't this have priority?\n const entryName = options.attributeNameEntry || 'name';\n if (attribute.metadata[entryName]) {\n return attribute.metadata[entryName].string;\n }\n // Attribute of \"GENERIC\" type, we need to assign some name\n return `CUSTOM_ATTRIBUTE_${uniqueId}`;\n }\n // METADATA EXTRACTION\n /** Get top level metadata */\n _getTopLevelMetadata(dracoGeometry) {\n const dracoMetadata = this.decoder.GetMetadata(dracoGeometry);\n return this._getDracoMetadata(dracoMetadata);\n }\n /** Get per attribute metadata */\n _getAttributeMetadata(dracoGeometry, attributeId) {\n const dracoMetadata = this.decoder.GetAttributeMetadata(dracoGeometry, attributeId);\n return this._getDracoMetadata(dracoMetadata);\n }\n /**\n * Extract metadata field values\n * @param dracoMetadata\n * @returns\n */\n _getDracoMetadata(dracoMetadata) {\n // The not so wonderful world of undocumented Draco APIs :(\n if (!dracoMetadata || !dracoMetadata.ptr) {\n return {};\n }\n const result = {};\n const numEntries = this.metadataQuerier.NumEntries(dracoMetadata);\n for (let entryIndex = 0; entryIndex < numEntries; entryIndex++) {\n const entryName = this.metadataQuerier.GetEntryName(dracoMetadata, entryIndex);\n result[entryName] = this._getDracoMetadataField(dracoMetadata, entryName);\n }\n return result;\n }\n /**\n * Extracts possible values for one metadata entry by name\n * @param dracoMetadata\n * @param entryName\n */\n _getDracoMetadataField(dracoMetadata, entryName) {\n const dracoArray = new this.draco.DracoInt32Array();\n try {\n // Draco metadata fields can hold int32 arrays\n this.metadataQuerier.GetIntEntryArray(dracoMetadata, entryName, dracoArray);\n const intArray = getInt32Array(dracoArray);\n return {\n int: this.metadataQuerier.GetIntEntry(dracoMetadata, entryName),\n string: this.metadataQuerier.GetStringEntry(dracoMetadata, entryName),\n double: this.metadataQuerier.GetDoubleEntry(dracoMetadata, entryName),\n intArray\n };\n }\n finally {\n this.draco.destroy(dracoArray);\n }\n }\n // QUANTIZED ATTRIBUTE SUPPORT (NO DECOMPRESSION)\n /** Skip transforms for specific attribute types */\n _disableAttributeTransforms(options) {\n const { quantizedAttributes = [], octahedronAttributes = [] } = options;\n const skipAttributes = [...quantizedAttributes, ...octahedronAttributes];\n for (const dracoAttributeName of skipAttributes) {\n this.decoder.SkipAttributeTransform(this.draco[dracoAttributeName]);\n }\n }\n /**\n * Extract (and apply?) Position Transform\n * @todo not used\n */\n _getQuantizationTransform(dracoAttribute, options) {\n const { quantizedAttributes = [] } = options;\n const attribute_type = dracoAttribute.attribute_type();\n const skip = quantizedAttributes.map((type) => this.decoder[type]).includes(attribute_type);\n if (skip) {\n const transform = new this.draco.AttributeQuantizationTransform();\n try {\n if (transform.InitFromAttribute(dracoAttribute)) {\n return {\n quantization_bits: transform.quantization_bits(),\n range: transform.range(),\n min_values: new Float32Array([1, 2, 3]).map((i) => transform.min_value(i))\n };\n }\n }\n finally {\n this.draco.destroy(transform);\n }\n }\n return null;\n }\n _getOctahedronTransform(dracoAttribute, options) {\n const { octahedronAttributes = [] } = options;\n const attribute_type = dracoAttribute.attribute_type();\n const octahedron = octahedronAttributes\n .map((type) => this.decoder[type])\n .includes(attribute_type);\n if (octahedron) {\n const transform = new this.draco.AttributeQuantizationTransform();\n try {\n if (transform.InitFromAttribute(dracoAttribute)) {\n return {\n quantization_bits: transform.quantization_bits()\n };\n }\n }\n finally {\n this.draco.destroy(transform);\n }\n }\n return null;\n }\n}\n/**\n * Get draco specific data type by TypedArray constructor type\n * @param attributeType\n * @returns draco specific data type\n */\nfunction getDracoDataType(draco, attributeType) {\n switch (attributeType) {\n case Float32Array:\n return draco.DT_FLOAT32;\n case Int8Array:\n return draco.DT_INT8;\n case Int16Array:\n return draco.DT_INT16;\n case Int32Array:\n return draco.DT_INT32;\n case Uint8Array:\n return draco.DT_UINT8;\n case Uint16Array:\n return draco.DT_UINT16;\n case Uint32Array:\n return draco.DT_UINT32;\n default:\n return draco.DT_INVALID;\n }\n}\n/**\n * Copy a Draco int32 array into a JS typed array\n */\nfunction getInt32Array(dracoArray) {\n const numValues = dracoArray.size();\n const intArray = new Int32Array(numValues);\n for (let i = 0; i < numValues; i++) {\n intArray[i] = dracoArray.GetValue(i);\n }\n return intArray;\n}\n/**\n * Copy a Draco int32 array into a JS typed array\n */\nfunction getUint32Array(dracoArray) {\n const numValues = dracoArray.size();\n const intArray = new Int32Array(numValues);\n for (let i = 0; i < numValues; i++) {\n intArray[i] = dracoArray.GetValue(i);\n }\n return intArray;\n}\n","// Dynamic DRACO module loading inspired by THREE.DRACOLoader\n// https://github.com/mrdoob/three.js/blob/398c4f39ebdb8b23eefd4a7a5ec49ec0c96c7462/examples/jsm/loaders/DRACOLoader.js\n// by Don McCurdy / https://www.donmccurdy.com / MIT license\nimport { loadLibrary } from '@loaders.gl/worker-utils';\nconst DRACO_DECODER_VERSION = '1.5.6';\nconst DRACO_ENCODER_VERSION = '1.4.1';\nconst STATIC_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_DECODER_VERSION}`;\nexport const DRACO_EXTERNAL_LIBRARIES = {\n /** The primary Draco3D encoder, javascript wrapper part */\n DECODER: 'draco_wasm_wrapper.js',\n /** The primary draco decoder, compiled web assembly part */\n DECODER_WASM: 'draco_decoder.wasm',\n /** Fallback decoder for non-webassebly environments. Very big bundle, lower performance */\n FALLBACK_DECODER: 'draco_decoder.js',\n /** Draco encoder */\n ENCODER: 'draco_encoder.js'\n};\nexport const DRACO_EXTERNAL_LIBRARY_URLS = {\n [DRACO_EXTERNAL_LIBRARIES.DECODER]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.DECODER}`,\n [DRACO_EXTERNAL_LIBRARIES.DECODER_WASM]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.DECODER_WASM}`,\n [DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER}`,\n [DRACO_EXTERNAL_LIBRARIES.ENCODER]: `https://raw.githubusercontent.com/google/draco/${DRACO_ENCODER_VERSION}/javascript/${DRACO_EXTERNAL_LIBRARIES.ENCODER}`\n};\nlet loadDecoderPromise;\nlet loadEncoderPromise;\nexport async function loadDracoDecoderModule(options) {\n const modules = options.modules || {};\n // Check if a bundled draco3d library has been supplied by application\n if (modules.draco3d) {\n loadDecoderPromise ||= modules.draco3d.createDecoderModule({}).then((draco) => {\n return { draco };\n });\n }\n else {\n // If not, dynamically load the WASM script from our CDN\n loadDecoderPromise ||= loadDracoDecoder(options);\n }\n return await loadDecoderPromise;\n}\nexport async function loadDracoEncoderModule(options) {\n const modules = options.modules || {};\n // Check if a bundled draco3d library has been supplied by application\n if (modules.draco3d) {\n loadEncoderPromise ||= modules.draco3d.createEncoderModule({}).then((draco) => {\n return { draco };\n });\n }\n else {\n // If not, dynamically load the WASM script from our CDN\n loadEncoderPromise ||= loadDracoEncoder(options);\n }\n return await loadEncoderPromise;\n}\n// DRACO DECODER LOADING\nasync function loadDracoDecoder(options) {\n let DracoDecoderModule;\n let wasmBinary;\n switch (options.draco && options.draco.decoderType) {\n case 'js':\n DracoDecoderModule = await loadLibrary(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER], 'draco', options, DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER);\n break;\n case 'wasm':\n default:\n [DracoDecoderModule, wasmBinary] = await Promise.all([\n await loadLibrary(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER], 'draco', options, DRACO_EXTERNAL_LIBRARIES.DECODER),\n await loadLibrary(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER_WASM], 'draco', options, DRACO_EXTERNAL_LIBRARIES.DECODER_WASM)\n ]);\n }\n // Depends on how import happened...\n // @ts-ignore\n DracoDecoderModule = DracoDecoderModule || globalThis.DracoDecoderModule;\n return await initializeDracoDecoder(DracoDecoderModule, wasmBinary);\n}\nfunction initializeDracoDecoder(DracoDecoderModule, wasmBinary) {\n const options = {};\n if (wasmBinary) {\n options.wasmBinary = wasmBinary;\n }\n return new Promise((resolve) => {\n DracoDecoderModule({\n ...options,\n onModuleLoaded: (draco) => resolve({ draco }) // Module is Promise-like. Wrap in object to avoid loop.\n });\n });\n}\n// ENCODER\nasync function loadDracoEncoder(options) {\n let DracoEncoderModule = await loadLibrary(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.ENCODER], 'draco', options, DRACO_EXTERNAL_LIBRARIES.ENCODER);\n // @ts-ignore\n DracoEncoderModule = DracoEncoderModule || globalThis.DracoEncoderModule;\n return new Promise((resolve) => {\n DracoEncoderModule({\n onModuleLoaded: (draco) => resolve({ draco }) // Module is Promise-like. Wrap in object to avoid loop.\n });\n });\n}\n","import { DracoLoader as DracoWorkerLoader } from \"./draco-loader.js\";\nimport DracoParser from \"./lib/draco-parser.js\";\nimport { loadDracoDecoderModule } from \"./lib/draco-module-loader.js\";\nimport { VERSION } from \"./lib/utils/version.js\";\n// Module constants\nexport { DRACO_EXTERNAL_LIBRARIES, DRACO_EXTERNAL_LIBRARY_URLS } from \"./lib/draco-module-loader.js\";\nexport { DracoWriter } from \"./draco-writer.js\";\n/**\n * Browser worker doesn't work because of issue during \"draco_encoder.js\" loading.\n * Refused to execute script from 'https://raw.githubusercontent.com/google/draco/1.4.1/javascript/draco_encoder.js' because its MIME type ('') is not executable.\n */\nexport const DracoWriterWorker = {\n id: 'draco-writer',\n name: 'Draco compressed geometry writer',\n module: 'draco',\n version: VERSION,\n worker: true,\n options: {\n draco: {},\n source: null\n }\n};\nexport { DracoWorkerLoader };\n/**\n * Loader for Draco3D compressed geometries\n */\nexport const DracoLoader = {\n ...DracoWorkerLoader,\n parse\n};\nasync function parse(arrayBuffer, options) {\n const { draco } = await loadDracoDecoderModule(options);\n const dracoParser = new DracoParser(draco);\n try {\n return dracoParser.parseSync(arrayBuffer, options?.draco);\n }\n finally {\n dracoParser.destroy();\n }\n}\n","// TODO - remove\nimport { getAccessorTypeFromSize, getComponentTypeFromArray } from \"./gltf-utils.js\";\n// Returns a fresh attributes object with glTF-standardized attributes names\n// Attributes that cannot be identified will not be included\n// Removes `indices` if present, as it should be stored separately from the attributes\nexport function getGLTFAccessors(attributes) {\n const accessors = {};\n for (const name in attributes) {\n const attribute = attributes[name];\n if (name !== 'indices') {\n const glTFAccessor = getGLTFAccessor(attribute);\n accessors[name] = glTFAccessor;\n }\n }\n return accessors;\n}\n// Fix up a single accessor.\n// Input: typed array or a partial accessor object\n// Return: accessor object\nexport function getGLTFAccessor(attribute) {\n const { buffer, size, count } = getAccessorData(attribute);\n const glTFAccessor = {\n // glTF Accessor values\n // TODO: Instead of a bufferView index we could have an actual buffer (typed array)\n // bufferView: null,\n // TODO: Deprecate `value` in favor of bufferView?\n // @ts-ignore\n value: buffer,\n size, // Decoded `type` (e.g. SCALAR)\n byteOffset: 0,\n count,\n type: getAccessorTypeFromSize(size),\n componentType: getComponentTypeFromArray(buffer)\n };\n return glTFAccessor;\n}\n// export function getGLTFAttribute(data, gltfAttributeName): GLTFAccessor {\n// return data.attributes[data.glTFAttributeMap[gltfAttributeName]];\n// }\nfunction getAccessorData(attribute) {\n let buffer = attribute;\n let size = 1;\n let count = 0;\n if (attribute && attribute.value) {\n buffer = attribute.value;\n size = attribute.size || 1;\n }\n if (buffer) {\n if (!ArrayBuffer.isView(buffer)) {\n buffer = toTypedArray(buffer, Float32Array);\n }\n count = buffer.length / size;\n }\n return { buffer, size, count };\n}\n// Convert non-typed arrays to arrays of specified format\nfunction toTypedArray(array, ArrayType, convertTypedArrays = false) {\n if (!array) {\n return null;\n }\n if (Array.isArray(array)) {\n return new ArrayType(array);\n }\n if (convertTypedArrays && !(array instanceof ArrayType)) {\n return new ArrayType(array);\n }\n return array;\n}\n","// https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression\n// Only TRIANGLES: 0x0004 and TRIANGLE_STRIP: 0x0005 are supported\n/* eslint-disable camelcase */\nimport { sliceArrayBuffer, parseFromContext } from '@loaders.gl/loader-utils';\nimport { DracoLoader } from '@loaders.gl/draco';\nimport { GLTFScenegraph } from \"../api/gltf-scenegraph.js\";\nimport { getGLTFAccessors, getGLTFAccessor } from \"../gltf-utils/gltf-attribute-utils.js\";\nconst KHR_DRACO_MESH_COMPRESSION = 'KHR_draco_mesh_compression';\n/** Extension name */\nexport const name = KHR_DRACO_MESH_COMPRESSION;\nexport function preprocess(gltfData, options, context) {\n const scenegraph = new GLTFScenegraph(gltfData);\n for (const primitive of makeMeshPrimitiveIterator(scenegraph)) {\n if (scenegraph.getObjectExtension(primitive, KHR_DRACO_MESH_COMPRESSION)) {\n // TODO - Remove fallback accessors to make sure we don't load unnecessary buffers\n }\n }\n}\nexport async function decode(gltfData, options, context) {\n if (!options?.gltf?.decompressMeshes) {\n return;\n }\n const scenegraph = new GLTFScenegraph(gltfData);\n const promises = [];\n for (const primitive of makeMeshPrimitiveIterator(scenegraph)) {\n if (scenegraph.getObjectExtension(primitive, KHR_DRACO_MESH_COMPRESSION)) {\n promises.push(decompressPrimitive(scenegraph, primitive, options, context));\n }\n }\n // Decompress meshes in parallel\n await Promise.all(promises);\n // We have now decompressed all primitives, so remove the top-level extension\n scenegraph.removeExtension(KHR_DRACO_MESH_COMPRESSION);\n}\nexport function encode(gltfData, options = {}) {\n const scenegraph = new GLTFScenegraph(gltfData);\n for (const mesh of scenegraph.json.meshes || []) {\n // eslint-disable-next-line camelcase\n // @ts-ignore\n compressMesh(mesh, options);\n // NOTE: Only add the extension if something was actually compressed\n scenegraph.addRequiredExtension(KHR_DRACO_MESH_COMPRESSION);\n }\n}\n// DECODE\n// Unpacks one mesh primitive and removes the extension from the primitive\n// DracoDecoder needs to be imported and registered by app\n// Returns: Promise that resolves when all pending draco decoder jobs for this mesh complete\n// TODO - Implement fallback behavior per KHR_DRACO_MESH_COMPRESSION spec\nasync function decompressPrimitive(scenegraph, primitive, options, context) {\n const dracoExtension = scenegraph.getObjectExtension(primitive, KHR_DRACO_MESH_COMPRESSION);\n if (!dracoExtension) {\n return;\n }\n const buffer = scenegraph.getTypedArrayForBufferView(dracoExtension.bufferView);\n // TODO - parse does not yet deal well with byte offsets embedded in typed arrays. Copy buffer\n // TODO - remove when `parse` is fixed to handle `byteOffset`s\n const bufferCopy = sliceArrayBuffer(buffer.buffer, buffer.byteOffset); // , buffer.byteLength);\n const dracoOptions = { ...options };\n // TODO - remove hack: The entire tileset might be included, too expensive to serialize\n delete dracoOptions['3d-tiles'];\n const decodedData = await parseFromContext(bufferCopy, DracoLoader, dracoOptions, context);\n const decodedAttributes = getGLTFAccessors(decodedData.attributes);\n // Restore min/max values\n for (const [attributeName, decodedAttribute] of Object.entries(decodedAttributes)) {\n if (attributeName in primitive.attributes) {\n const accessorIndex = primitive.attributes[attributeName];\n const accessor = scenegraph.getAccessor(accessorIndex);\n if (accessor?.min && accessor?.max) {\n decodedAttribute.min = accessor.min;\n decodedAttribute.max = accessor.max;\n }\n }\n }\n // @ts-ignore\n primitive.attributes = decodedAttributes;\n if (decodedData.indices) {\n // @ts-ignore\n primitive.indices = getGLTFAccessor(decodedData.indices);\n }\n // Extension has been processed, delete it\n scenegraph.removeObjectExtension(primitive, KHR_DRACO_MESH_COMPRESSION);\n checkPrimitive(primitive);\n}\n// ENCODE\n// eslint-disable-next-line max-len\n// Only TRIANGLES: 0x0004 and TRIANGLE_STRIP: 0x0005 are supported\nfunction compressMesh(attributes, indices, mode = 4, options, context) {\n if (!options.DracoWriter) {\n throw new Error('options.gltf.DracoWriter not provided');\n }\n // TODO - use DracoWriter using encode w/ registered DracoWriter...\n const compressedData = options.DracoWriter.encodeSync({ attributes });\n // Draco compression may change the order and number of vertices in a mesh.\n // To satisfy the requirement that accessors properties be correct for both\n // compressed and uncompressed data, generators should create uncompressed\n // attributes and indices using data that has been decompressed from the Draco buffer,\n // rather than the original source data.\n // @ts-ignore TODO this needs to be fixed\n const decodedData = context?.parseSync?.({ attributes });\n const fauxAccessors = options._addFauxAttributes(decodedData.attributes);\n const bufferViewIndex = options.addBufferView(compressedData);\n const glTFMesh = {\n primitives: [\n {\n attributes: fauxAccessors, // TODO - verify with spec\n mode, // GL.POINTS\n extensions: {\n [KHR_DRACO_MESH_COMPRESSION]: {\n bufferView: bufferViewIndex,\n attributes: fauxAccessors // TODO - verify with spec\n }\n }\n }\n ]\n };\n return glTFMesh;\n}\n// UTILS\nfunction checkPrimitive(primitive) {\n if (!primitive.attributes && Object.keys(primitive.attributes).length > 0) {\n throw new Error('glTF: Empty primitive detected: Draco decompression failure?');\n }\n}\nfunction* makeMeshPrimitiveIterator(scenegraph) {\n for (const mesh of scenegraph.json.meshes || []) {\n for (const primitive of mesh.primitives) {\n yield primitive;\n }\n }\n}\n","/**\n * https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_texture_transform/README.md\n */\nimport { Vector3, Matrix3 } from '@math.gl/core';\nimport { getAccessorArrayTypeAndLength } from \"../gltf-utils/gltf-utils.js\";\nimport { BYTES, COMPONENTS } from \"../gltf-utils/gltf-constants.js\";\nimport { GLTFScenegraph } from \"../api/gltf-scenegraph.js\";\n/** Extension name */\nconst KHR_TEXTURE_TRANSFORM = 'KHR_texture_transform';\nexport const name = KHR_TEXTURE_TRANSFORM;\nconst scratchVector = new Vector3();\nconst scratchRotationMatrix = new Matrix3();\nconst scratchScaleMatrix = new Matrix3();\n/**\n * The extension entry to process the transformation\n * @param gltfData gltf buffers and json\n * @param options GLTFLoader options\n */\nexport async function decode(gltfData, options) {\n const gltfScenegraph = new GLTFScenegraph(gltfData);\n const hasExtension = gltfScenegraph.hasExtension(KHR_TEXTURE_TRANSFORM);\n if (!hasExtension || !options.gltf?.loadBuffers) {\n return;\n }\n const materials = gltfData.json.materials || [];\n for (let i = 0; i < materials.length; i++) {\n transformTexCoords(i, gltfData);\n }\n}\n/**\n * Transform TEXCOORD by material\n * @param materialIndex processing material index\n * @param gltfData gltf buffers and json\n */\nfunction transformTexCoords(materialIndex, gltfData) {\n const material = gltfData.json.materials?.[materialIndex];\n const materialTextures = [\n material?.pbrMetallicRoughness?.baseColorTexture,\n material?.emissiveTexture,\n material?.normalTexture,\n material?.occlusionTexture,\n material?.pbrMetallicRoughness?.metallicRoughnessTexture\n ];\n // Save processed texCoords in order no to process the same twice\n const processedTexCoords = [];\n for (const textureInfo of materialTextures) {\n if (textureInfo && textureInfo?.extensions?.[KHR_TEXTURE_TRANSFORM]) {\n transformPrimitives(gltfData, materialIndex, textureInfo, processedTexCoords);\n }\n }\n}\n/**\n * Transform primitives of the particular material\n * @param gltfData gltf data\n * @param materialIndex primitives with this material will be transformed\n * @param texture texture object\n * @param processedTexCoords storage to save already processed texCoords\n */\nfunction transformPrimitives(gltfData, materialIndex, texture, processedTexCoords) {\n const transformParameters = getTransformParameters(texture, processedTexCoords);\n if (!transformParameters) {\n return;\n }\n const meshes = gltfData.json.meshes || [];\n for (const mesh of meshes) {\n for (const primitive of mesh.primitives) {\n const material = primitive.material;\n if (Number.isFinite(material) && materialIndex === material) {\n transformPrimitive(gltfData, primitive, transformParameters);\n }\n }\n }\n}\n/**\n * Get parameters for TEXCOORD transformation\n * @param texture texture object\n * @param processedTexCoords storage to save already processed texCoords\n * @returns texCoord couple and transformation matrix\n */\nfunction getTransformParameters(texture, processedTexCoords) {\n const textureInfo = texture.extensions?.[KHR_TEXTURE_TRANSFORM];\n const { texCoord: originalTexCoord = 0 } = texture;\n // If texCoord is not set in the extension, original attribute data will be replaced\n const { texCoord = originalTexCoord } = textureInfo;\n // Make sure that couple [originalTexCoord, extensionTexCoord] is not processed twice\n const isProcessed = processedTexCoords.findIndex(([original, newTexCoord]) => original === originalTexCoord && newTexCoord === texCoord) !== -1;\n if (!isProcessed) {\n const matrix = makeTransformationMatrix(textureInfo);\n if (originalTexCoord !== texCoord) {\n texture.texCoord = texCoord;\n }\n processedTexCoords.push([originalTexCoord, texCoord]);\n return { originalTexCoord, texCoord, matrix };\n }\n return null;\n}\n/**\n * Transform `TEXCOORD_0` attribute in the primitive\n * @param gltfData gltf data\n * @param primitive primitive object\n * @param transformParameters texCoord couple and transformation matrix\n */\nfunction transformPrimitive(gltfData, primitive, transformParameters) {\n const { originalTexCoord, texCoord, matrix } = transformParameters;\n const texCoordAccessor = primitive.attributes[`TEXCOORD_${originalTexCoord}`];\n if (Number.isFinite(texCoordAccessor)) {\n // Get accessor of the `TEXCOORD_0` attribute\n const accessor = gltfData.json.accessors?.[texCoordAccessor];\n if (accessor && accessor.bufferView) {\n // Get `bufferView` of the `accessor`\n const bufferView = gltfData.json.bufferViews?.[accessor.bufferView];\n if (bufferView) {\n // Get `arrayBuffer` the `bufferView` look at\n const { arrayBuffer, byteOffset: bufferByteOffset } = gltfData.buffers[bufferView.buffer];\n // Resulting byteOffset is sum of the buffer, accessor and bufferView byte offsets\n const byteOffset = (bufferByteOffset || 0) + (accessor.byteOffset || 0) + (bufferView.byteOffset || 0);\n // Deduce TypedArray type and its length from `accessor` and `bufferView` data\n const { ArrayType, length } = getAccessorArrayTypeAndLength(accessor, bufferView);\n // Number of bytes each component occupies\n const bytes = BYTES[accessor.componentType];\n // Number of components. For the `TEXCOORD_0` with `VEC2` type, it must return 2\n const components = COMPONENTS[accessor.type];\n // Multiplier to calculate the address of the `TEXCOORD_0` element in the arrayBuffer\n const elementAddressScale = bufferView.byteStride || bytes * components;\n // Data transform to Float32Array\n const result = new Float32Array(length);\n for (let i = 0; i < accessor.count; i++) {\n // Take [u, v] couple from the arrayBuffer\n const uv = new ArrayType(arrayBuffer, byteOffset + i * elementAddressScale, 2);\n // Set and transform Vector3 per https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_texture_transform#overview\n scratchVector.set(uv[0], uv[1], 1);\n scratchVector.transformByMatrix3(matrix);\n // Save result in Float32Array\n result.set([scratchVector[0], scratchVector[1]], i * components);\n }\n // If texCoord the same, replace gltf structural data\n if (originalTexCoord === texCoord) {\n updateGltf(accessor, bufferView, gltfData.buffers, result);\n }\n else {\n // If texCoord change, create new attribute\n createAttribute(texCoord, accessor, primitive, gltfData, result);\n }\n }\n }\n }\n}\n/**\n * Update GLTF structural objects with new data as we create new `Float32Array` for `TEXCOORD_0`.\n * @param accessor accessor to change\n * @param bufferView bufferView to change\n * @param buffers binary buffers\n * @param newTexcoordArray typed array with data after transformation\n */\nfunction updateGltf(accessor, bufferView, buffers, newTexCoordArray) {\n accessor.componentType = 5126;\n buffers.push({\n arrayBuffer: newTexCoordArray.buffer,\n byteOffset: 0,\n byteLength: newTexCoordArray.buffer.byteLength\n });\n bufferView.buffer = buffers.length - 1;\n bufferView.byteLength = newTexCoordArray.buffer.byteLength;\n bufferView.byteOffset = 0;\n delete bufferView.byteStride;\n}\n/**\n *\n * @param newTexCoord new `texCoord` value\n * @param originalAccessor original accessor object, that store data before transformation\n * @param primitive primitive object\n * @param gltfData gltf data\n * @param newTexCoordArray typed array with data after transformation\n * @returns\n */\nfunction createAttribute(newTexCoord, originalAccessor, primitive, gltfData, newTexCoordArray) {\n gltfData.buffers.push({\n arrayBuffer: newTexCoordArray.buffer,\n byteOffset: 0,\n byteLength: newTexCoordArray.buffer.byteLength\n });\n const bufferViews = gltfData.json.bufferViews;\n if (!bufferViews) {\n return;\n }\n bufferViews.push({\n buffer: gltfData.buffers.length - 1,\n byteLength: newTexCoordArray.buffer.byteLength,\n byteOffset: 0\n });\n const accessors = gltfData.json.accessors;\n if (!accessors) {\n return;\n }\n accessors.push({\n bufferView: bufferViews?.length - 1,\n byteOffset: 0,\n componentType: 5126,\n count: originalAccessor.count,\n type: 'VEC2'\n });\n primitive.attributes[`TEXCOORD_${newTexCoord}`] = accessors.length - 1;\n}\n/**\n * Construct transformation matrix from the extension data (transition, rotation, scale)\n * @param extensionData extension data\n * @returns transformation matrix\n */\nfunction makeTransformationMatrix(extensionData) {\n const { offset = [0, 0], rotation = 0, scale = [1, 1] } = extensionData;\n const translationMatrix = new Matrix3().set(1, 0, 0, 0, 1, 0, offset[0], offset[1], 1);\n const rotationMatrix = scratchRotationMatrix.set(Math.cos(rotation), Math.sin(rotation), 0, -Math.sin(rotation), Math.cos(rotation), 0, 0, 0, 1);\n const scaleMatrix = scratchScaleMatrix.set(scale[0], 0, 0, 0, scale[1], 0, 0, 0, 1);\n return translationMatrix.multiplyRight(rotationMatrix).multiplyRight(scaleMatrix);\n}\n","// GLTF EXTENSION: KHR_lights_punctual\n// https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_lights_punctual\nimport { assert } from \"../../utils/assert.js\";\nimport { GLTFScenegraph } from \"../../api/gltf-scenegraph.js\";\nconst KHR_LIGHTS_PUNCTUAL = 'KHR_lights_punctual';\nexport const name = KHR_LIGHTS_PUNCTUAL;\nexport async function decode(gltfData) {\n const gltfScenegraph = new GLTFScenegraph(gltfData);\n const { json } = gltfScenegraph;\n // Move the light array out of the extension and remove the extension\n const extension = gltfScenegraph.getExtension(KHR_LIGHTS_PUNCTUAL);\n if (extension) {\n // @ts-ignore\n gltfScenegraph.json.lights = extension.lights;\n gltfScenegraph.removeExtension(KHR_LIGHTS_PUNCTUAL);\n }\n // Any nodes that have the extension, add lights field pointing to light object\n // and remove the extension\n for (const node of json.nodes || []) {\n const nodeExtension = gltfScenegraph.getObjectExtension(node, KHR_LIGHTS_PUNCTUAL);\n if (nodeExtension) {\n // @ts-ignore\n node.light = nodeExtension.light;\n }\n gltfScenegraph.removeObjectExtension(node, KHR_LIGHTS_PUNCTUAL);\n }\n}\n// Move the light ar ray out of the extension and remove the extension\nexport async function encode(gltfData) {\n const gltfScenegraph = new GLTFScenegraph(gltfData);\n const { json } = gltfScenegraph;\n // @ts-ignore\n if (json.lights) {\n const extension = gltfScenegraph.addExtension(KHR_LIGHTS_PUNCTUAL);\n // @ts-ignore\n assert(!extension.lights);\n // @ts-ignore\n extension.lights = json.lights;\n // @ts-ignore\n delete json.lights;\n }\n // Any nodes that have lights field pointing to light object\n // add the extension\n // @ts-ignore\n if (gltfScenegraph.json.lights) {\n // @ts-ignore\n for (const light of gltfScenegraph.json.lights) {\n const node = light.node;\n gltfScenegraph.addObjectExtension(node, KHR_LIGHTS_PUNCTUAL, light);\n }\n // @ts-ignore\n delete gltfScenegraph.json.lights;\n }\n}\n","// GLTF EXTENSION: KHR_materials_unlit\n// https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit\nimport { GLTFScenegraph } from \"../../api/gltf-scenegraph.js\";\nconst KHR_MATERIALS_UNLIT = 'KHR_materials_unlit';\nexport const name = KHR_MATERIALS_UNLIT;\nexport async function decode(gltfData) {\n const gltfScenegraph = new GLTFScenegraph(gltfData);\n const { json } = gltfScenegraph;\n // Any nodes that have the extension, add lights field pointing to light object\n // and remove the extension\n for (const material of json.materials || []) {\n const extension = material.extensions && material.extensions.KHR_materials_unlit;\n if (extension) {\n // @ts-ignore TODO\n material.unlit = true;\n }\n gltfScenegraph.removeObjectExtension(material, KHR_MATERIALS_UNLIT);\n }\n // Remove the top-level extension\n gltfScenegraph.removeExtension(KHR_MATERIALS_UNLIT);\n}\nexport function encode(gltfData) {\n const gltfScenegraph = new GLTFScenegraph(gltfData);\n const { json } = gltfScenegraph;\n // Any nodes that have lights field pointing to light object\n // add the extension\n // @ts-ignore\n if (gltfScenegraph.materials) {\n for (const material of json.materials || []) {\n // @ts-ignore\n if (material.unlit) {\n // @ts-ignore\n delete material.unlit;\n gltfScenegraph.addObjectExtension(material, KHR_MATERIALS_UNLIT, {});\n gltfScenegraph.addExtension(KHR_MATERIALS_UNLIT);\n }\n }\n }\n}\n","// GLTF EXTENSION: KHR_techniques_webgl\n// https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_techniques_webgl\nimport { GLTFScenegraph } from \"../../api/gltf-scenegraph.js\";\nconst KHR_TECHNIQUES_WEBGL = 'KHR_techniques_webgl';\nexport const name = KHR_TECHNIQUES_WEBGL;\nexport async function decode(gltfData) {\n const gltfScenegraph = new GLTFScenegraph(gltfData);\n const { json } = gltfScenegraph;\n const extension = gltfScenegraph.getExtension(KHR_TECHNIQUES_WEBGL);\n if (extension) {\n const techniques = resolveTechniques(extension, gltfScenegraph);\n for (const material of json.materials || []) {\n const materialExtension = gltfScenegraph.getObjectExtension(material, KHR_TECHNIQUES_WEBGL);\n if (materialExtension) {\n // @ts-ignore TODO\n material.technique = Object.assign({}, materialExtension, \n // @ts-ignore\n techniques[materialExtension.technique]);\n // @ts-ignore TODO\n material.technique.values = resolveValues(material.technique, gltfScenegraph);\n }\n gltfScenegraph.removeObjectExtension(material, KHR_TECHNIQUES_WEBGL);\n }\n // Remove the top-level extension\n gltfScenegraph.removeExtension(KHR_TECHNIQUES_WEBGL);\n }\n}\n// eslint-disable-next-line\nexport async function encode(gltfData, options) {\n // TODO\n}\nfunction resolveTechniques(techniquesExtension, \n// programs: {[key: string]: any}[],\n// shaders: {[key: string]: any}[],\n// techniques: {[key: string]: any}[]\ngltfScenegraph) {\n const { programs = [], shaders = [], techniques = [] } = techniquesExtension;\n const textDecoder = new TextDecoder();\n shaders.forEach((shader) => {\n if (Number.isFinite(shader.bufferView)) {\n shader.code = textDecoder.decode(gltfScenegraph.getTypedArrayForBufferView(shader.bufferView));\n }\n else {\n // TODO: handle URI shader\n throw new Error('KHR_techniques_webgl: no shader code');\n }\n });\n programs.forEach((program) => {\n program.fragmentShader = shaders[program.fragmentShader];\n program.vertexShader = shaders[program.vertexShader];\n });\n techniques.forEach((technique) => {\n technique.program = programs[technique.program];\n });\n return techniques;\n}\nfunction resolveValues(technique, gltfScenegraph) {\n const values = Object.assign({}, technique.values);\n // merge values from uniforms\n Object.keys(technique.uniforms || {}).forEach((uniform) => {\n if (technique.uniforms[uniform].value && !(uniform in values)) {\n values[uniform] = technique.uniforms[uniform].value;\n }\n });\n // resolve textures\n Object.keys(values).forEach((uniform) => {\n if (typeof values[uniform] === 'object' && values[uniform].index !== undefined) {\n // Assume this is a texture\n // TODO: find if there are any other types that can be referenced\n values[uniform].texture = gltfScenegraph.getTexture(values[uniform].index);\n }\n });\n return values;\n}\n","// GLTF 1.0 extensions (decode only)\n// import * as KHR_binary_gltf from './KHR_draco_mesh_compression';\n// GLTF 2.0 Vendor extensions\nimport * as EXT_mesh_features from \"../extensions/EXT_mesh_features.js\";\nimport * as EXT_structural_metadata from \"../extensions/EXT_structural_metadata.js\";\n// GLTF 2.0 Khronos extensions (decode/encode)\nimport * as EXT_meshopt_compression from \"../extensions/EXT_meshopt_compression.js\";\nimport * as EXT_texture_webp from \"../extensions/EXT_texture_webp.js\";\nimport * as KHR_texture_basisu from \"../extensions/KHR_texture_basisu.js\";\nimport * as KHR_draco_mesh_compression from \"../extensions/KHR_draco_mesh_compression.js\";\nimport * as KHR_texture_transform from \"../extensions/KHR_texture_transform.js\";\n// Deprecated. These should be handled by rendering library (e.g. luma.gl), not the loader.\nimport * as KHR_lights_punctual from \"../extensions/deprecated/KHR_lights_punctual.js\";\nimport * as KHR_materials_unlit from \"../extensions/deprecated/KHR_materials_unlit.js\";\nimport * as KHR_techniques_webgl from \"../extensions/deprecated/KHR_techniques_webgl.js\";\nimport * as EXT_feature_metadata from \"../extensions/deprecated/EXT_feature_metadata.js\";\n/**\n * List of extensions processed by the GLTFLoader\n * Note that may extensions can only be handled on the rendering stage and are left out here\n * These are just extensions that can be handled fully or partially during loading.\n */\nexport const EXTENSIONS = [\n // 1.0\n // KHR_binary_gltf is handled separately - must be processed before other parsing starts\n // KHR_binary_gltf,\n // 2.0\n EXT_structural_metadata,\n EXT_mesh_features,\n EXT_meshopt_compression,\n EXT_texture_webp,\n // Basisu should come after webp, we want basisu to be preferred if both are provided\n KHR_texture_basisu,\n KHR_draco_mesh_compression,\n KHR_lights_punctual,\n KHR_materials_unlit,\n KHR_techniques_webgl,\n KHR_texture_transform,\n EXT_feature_metadata\n];\n/**\n * List of extensions processed by the GLTFWriter\n */\nconst EXTENSIONS_ENCODING = [EXT_structural_metadata, EXT_mesh_features];\n/** Call before any resource loading starts */\nexport function preprocessExtensions(gltf, options = {}, context) {\n const extensions = EXTENSIONS.filter((extension) => useExtension(extension.name, options));\n for (const extension of extensions) {\n extension.preprocess?.(gltf, options, context);\n }\n}\n/** Call after resource loading */\nexport async function decodeExtensions(gltf, options = {}, context) {\n const extensions = EXTENSIONS.filter((extension) => useExtension(extension.name, options));\n for (const extension of extensions) {\n // Note: We decode async extensions sequentially, this might not be necessary\n // Currently we only have Draco, but when we add Basis we may revisit\n await extension.decode?.(gltf, options, context);\n }\n}\n/** Call before resource writing */\nexport function encodeExtensions(gltf, options = {}) {\n for (const extension of EXTENSIONS_ENCODING) {\n gltf = extension.encode?.(gltf, options) ?? gltf;\n }\n return gltf;\n}\nfunction useExtension(extensionName, options) {\n const excludes = options?.gltf?.excludeExtensions || {};\n const exclude = extensionName in excludes && !excludes[extensionName];\n return !exclude;\n}\n","// GLTF 1.0 EXTENSION: KHR_binary_glTF\n// https://github.com/KhronosGroup/glTF/tree/master/extensions/1.0/Khronos/KHR_binary_glTF\n/* eslint-disable camelcase */\nimport { GLTFScenegraph } from \"../api/gltf-scenegraph.js\";\nconst KHR_BINARY_GLTF = 'KHR_binary_glTF';\n/** Extension name */\nexport const name = KHR_BINARY_GLTF;\nexport function preprocess(gltfData) {\n const gltfScenegraph = new GLTFScenegraph(gltfData);\n const { json } = gltfScenegraph;\n // Note: json.buffers.binary_glTF also needs to be replaced\n // This is currently done during gltf normalization\n // Image and shader nodes can have the extension\n // https://github.com/KhronosGroup/glTF/blob/master/extensions/1.0/Khronos/KHR_binary_glTF/schema/image.KHR_binary_glTF.schema.json\n for (const image of json.images || []) {\n const extension = gltfScenegraph.getObjectExtension(image, KHR_BINARY_GLTF);\n // The data in the extension is valid as glTF 2.0 data inside the object, so just copy it in\n if (extension) {\n Object.assign(image, extension);\n }\n gltfScenegraph.removeObjectExtension(image, KHR_BINARY_GLTF);\n }\n // TODO shaders - At least traverse and throw error if used?\n // https://github.com/KhronosGroup/glTF/blob/master/extensions/1.0/Khronos/KHR_binary_glTF/schema/shader.KHR_binary_glTF.schema.json\n // glTF v1 one files have a partially formed URI field that is not expected in (and causes problems in) 2.0\n if (json.buffers && json.buffers[0]) {\n delete json.buffers[0].uri;\n }\n // Remove the top-level extension as it has now been processed\n gltfScenegraph.removeExtension(KHR_BINARY_GLTF);\n}\n// KHR_binary_gltf is a 1.0 extension that is supported natively by 2.0\n// export function encode() {\n// throw new Error(KHR_BINARY_GLTF);\n// }\n","/* eslint-disable camelcase */\nimport * as KHR_binary_glTF from \"../extensions/KHR_binary_gltf.js\";\n// Binary format changes (mainly implemented by GLBLoader)\n// https://github.com/KhronosGroup/glTF/tree/master/extensions/1.0/Khronos/KHR_binary_glTF\n// JSON format changes:\n// https://github.com/khronosgroup/gltf/issues/605\n// - [x] Top-level JSON objects are arrays now\n// - [ ] Removed indirection from animation: sampler now refers directly to accessors, #712\n// - [ ] material.parameter.value and technique.parameter.value must be an array, #690\n// - [ ] Node can have only one mesh #821\n// - [ ] Added reqs on JSON encoding\n// - [ ] Added reqs on binary data alignment #802 (comment)\n// Additions:\n// - [ ] Added accessor.normalized, #691, #706\n// - [ ] Added glExtensionsUsed property and 5125 (UNSIGNED_INT) accessor.componentType value, #619\n// - [ ] Added extensionsRequired property, #720, #721\n// - [ ] Added \"STEP\" as valid animation.sampler.interpolation value, #712\n// Removals:\n// - [x] Removed buffer.type, #786, #629\n// - [ ] Removed revision number from profile.version, #709\n// - [ ] Removed technique.functions.scissor and removed 3089 (SCISSOR_TEST) as a valid value for technique.states.enable, #681\n// - [ ] Techniques, programs, and shaders were moved out to KHR_technique_webgl extension.\n// Other edits:\n// - [x] asset is now required, #642\n// - [ ] buffer.byteLength and bufferView.byteLength are now required, #560.\n// - [ ] accessor.min and accessor.max are now required, #593, and clarified that the JSON value and binary data must be the same, #628.\n// - [ ] Clarified animation.sampler and animation.channel restrictions, #712\n// - [ ] skin.inverseBindMatrices is now optional, #461.\n// - [ ] Attribute parameters can't have a value defined in the technique or parameter, #563 (comment).\n// - [ ] Only TEXCOORD and COLOR attribute semantics can be written in the form [semantic]_[set_index], #563 (comment).\n// - [ ] TEXCOORD and COLOR attribute semantics must be written in the form [semantic]_[set_index], e.g., just TEXCOORD should be TEXCOORD_0, and just COLOR should be COLOR_0, #649\n// - [ ] camera.perspective.aspectRatio and camera.perspective.yfov must now be > 0, not >= 0, #563 (comment).\n// - [ ] Application-specific parameter semantics must start with an underscore, e.g., _TEMPERATURE and _SIMULATION_TIME, #563 (comment).\n// - [ ] Properties in technique.parameters must be defined in technique.uniforms or technique.attributes,\n// #563 (comment).\n// - [ ] technique.parameter.count can only be defined when the semantic is JOINTMATRIX or an application-specific semantic is used. It can never be defined for attribute parameters; only uniforms, d2f6945\n// - [ ] technique.parameter.semantic is required when the parameter is an attribute, 28e113d\n// - [ ] Mesh-only models are allowed, e.g., without materials, #642\n// - [ ] Skeleton hierarchies (nodes containing jointName) must be separated from non-skeleton hierarchies., #647\n// - [ ] technique.states.functions.blendColor and technique.states.functions.depthRange parameters now must match WebGL function min/max, #707\nconst GLTF_ARRAYS = {\n accessors: 'accessor',\n animations: 'animation',\n buffers: 'buffer',\n bufferViews: 'bufferView',\n images: 'image',\n materials: 'material',\n meshes: 'mesh',\n nodes: 'node',\n samplers: 'sampler',\n scenes: 'scene',\n skins: 'skin',\n textures: 'texture'\n};\nconst GLTF_KEYS = {\n accessor: 'accessors',\n animations: 'animation',\n buffer: 'buffers',\n bufferView: 'bufferViews',\n image: 'images',\n material: 'materials',\n mesh: 'meshes',\n node: 'nodes',\n sampler: 'samplers',\n scene: 'scenes',\n skin: 'skins',\n texture: 'textures'\n};\n/**\n * Converts (normalizes) glTF v1 to v2\n */\nclass GLTFV1Normalizer {\n idToIndexMap = {\n animations: {},\n accessors: {},\n buffers: {},\n bufferViews: {},\n images: {},\n materials: {},\n meshes: {},\n nodes: {},\n samplers: {},\n scenes: {},\n skins: {},\n textures: {}\n };\n json;\n // constructor() {}\n /**\n * Convert (normalize) glTF < 2.0 to glTF 2.0\n * @param gltf - object with json and binChunks\n * @param options\n * @param options normalize Whether to actually normalize\n */\n normalize(gltf, options) {\n this.json = gltf.json;\n const json = gltf.json;\n // Check version\n switch (json.asset && json.asset.version) {\n // We are converting to v2 format. Return if there is nothing to do\n case '2.0':\n return;\n // This class is written to convert 1.0\n case undefined:\n case '1.0':\n break;\n default:\n // eslint-disable-next-line no-undef, no-console\n console.warn(`glTF: Unknown version ${json.asset.version}`);\n return;\n }\n if (!options.normalize) {\n // We are still missing a few conversion tricks, remove once addressed\n throw new Error('glTF v1 is not supported.');\n }\n // eslint-disable-next-line no-undef, no-console\n console.warn('Converting glTF v1 to glTF v2 format. This is experimental and may fail.');\n this._addAsset(json);\n // In glTF2 top-level fields are Arrays not Object maps\n this._convertTopLevelObjectsToArrays(json);\n // Extract bufferView indices for images\n // (this extension needs to be invoked early in the normalization process)\n // TODO can this be handled by standard extension processing instead of called explicitly?\n KHR_binary_glTF.preprocess(gltf);\n // Convert object references from ids to indices\n this._convertObjectIdsToArrayIndices(json);\n this._updateObjects(json);\n this._updateMaterial(json);\n }\n // asset is now required, #642 https://github.com/KhronosGroup/glTF/issues/639\n _addAsset(json) {\n json.asset = json.asset || {};\n // We are normalizing to glTF v2, so change version to \"2.0\"\n json.asset.version = '2.0';\n json.asset.generator = json.asset.generator || 'Normalized to glTF 2.0 by loaders.gl';\n }\n _convertTopLevelObjectsToArrays(json) {\n // TODO check that all arrays are covered\n for (const arrayName in GLTF_ARRAYS) {\n this._convertTopLevelObjectToArray(json, arrayName);\n }\n }\n /** Convert one top level object to array */\n _convertTopLevelObjectToArray(json, mapName) {\n const objectMap = json[mapName];\n if (!objectMap || Array.isArray(objectMap)) {\n return;\n }\n // Rewrite the top-level field as an array\n json[mapName] = [];\n // Copy the map key into object.id\n for (const id in objectMap) {\n const object = objectMap[id];\n object.id = object.id || id; // Mutates the loaded object\n const index = json[mapName].length;\n json[mapName].push(object);\n this.idToIndexMap[mapName][id] = index;\n }\n }\n /** Go through all objects in all top-level arrays and replace ids with indices */\n _convertObjectIdsToArrayIndices(json) {\n for (const arrayName in GLTF_ARRAYS) {\n this._convertIdsToIndices(json, arrayName);\n }\n if ('scene' in json) {\n json.scene = this._convertIdToIndex(json.scene, 'scene');\n }\n // Convert any index references that are not using array names\n // texture.source (image)\n for (const texture of json.textures) {\n this._convertTextureIds(texture);\n }\n for (const mesh of json.meshes) {\n this._convertMeshIds(mesh);\n }\n for (const node of json.nodes) {\n this._convertNodeIds(node);\n }\n for (const node of json.scenes) {\n this._convertSceneIds(node);\n }\n }\n _convertTextureIds(texture) {\n if (texture.source) {\n texture.source = this._convertIdToIndex(texture.source, 'image');\n }\n }\n _convertMeshIds(mesh) {\n for (const primitive of mesh.primitives) {\n const { attributes, indices, material } = primitive;\n for (const attributeName in attributes) {\n attributes[attributeName] = this._convertIdToIndex(attributes[attributeName], 'accessor');\n }\n if (indices) {\n primitive.indices = this._convertIdToIndex(indices, 'accessor');\n }\n if (material) {\n primitive.material = this._convertIdToIndex(material, 'material');\n }\n }\n }\n _convertNodeIds(node) {\n if (node.children) {\n node.children = node.children.map((child) => this._convertIdToIndex(child, 'node'));\n }\n if (node.meshes) {\n node.meshes = node.meshes.map((mesh) => this._convertIdToIndex(mesh, 'mesh'));\n }\n }\n _convertSceneIds(scene) {\n if (scene.nodes) {\n scene.nodes = scene.nodes.map((node) => this._convertIdToIndex(node, 'node'));\n }\n }\n /** Go through all objects in a top-level array and replace ids with indices */\n _convertIdsToIndices(json, topLevelArrayName) {\n if (!json[topLevelArrayName]) {\n console.warn(`gltf v1: json doesn't contain attribute ${topLevelArrayName}`); // eslint-disable-line no-console, no-undef\n json[topLevelArrayName] = [];\n }\n for (const object of json[topLevelArrayName]) {\n for (const key in object) {\n const id = object[key];\n const index = this._convertIdToIndex(id, key);\n object[key] = index;\n }\n }\n }\n _convertIdToIndex(id, key) {\n const arrayName = GLTF_KEYS[key];\n if (arrayName in this.idToIndexMap) {\n const index = this.idToIndexMap[arrayName][id];\n if (!Number.isFinite(index)) {\n throw new Error(`gltf v1: failed to resolve ${key} with id ${id}`);\n }\n return index;\n }\n return id;\n }\n /**\n *\n * @param {*} json\n */\n _updateObjects(json) {\n for (const buffer of this.json.buffers) {\n // - [x] Removed buffer.type, #786, #629\n delete buffer.type;\n }\n }\n /**\n * Update material (set pbrMetallicRoughness)\n * @param {*} json\n */\n _updateMaterial(json) {\n for (const material of json.materials) {\n material.pbrMetallicRoughness = {\n baseColorFactor: [1, 1, 1, 1],\n metallicFactor: 1,\n roughnessFactor: 1\n };\n const textureId = material.values?.tex || material.values?.texture2d_0 || material.values?.diffuseTex;\n const textureIndex = json.textures.findIndex((texture) => texture.id === textureId);\n if (textureIndex !== -1) {\n material.pbrMetallicRoughness.baseColorTexture = { index: textureIndex };\n }\n }\n }\n}\nexport function normalizeGLTFV1(gltf, options = {}) {\n return new GLTFV1Normalizer().normalize(gltf, options);\n}\n","import { parseJSON, sliceArrayBuffer, parseFromContext } from '@loaders.gl/loader-utils';\nimport { ImageLoader } from '@loaders.gl/images';\nimport { BasisLoader, selectSupportedBasisFormat } from '@loaders.gl/textures';\nimport { assert } from \"../utils/assert.js\";\nimport { isGLB, parseGLBSync } from \"./parse-glb.js\";\nimport { resolveUrl } from \"../gltf-utils/resolve-url.js\";\nimport { getTypedArrayForBufferView } from \"../gltf-utils/get-typed-array.js\";\nimport { preprocessExtensions, decodeExtensions } from \"../api/gltf-extensions.js\";\nimport { normalizeGLTFV1 } from \"../api/normalize-gltf-v1.js\";\n/** Check if an array buffer appears to contain GLTF data */\nexport function isGLTF(arrayBuffer, options) {\n const byteOffset = 0;\n return isGLB(arrayBuffer, byteOffset, options);\n}\nexport async function parseGLTF(gltf, arrayBufferOrString, byteOffset = 0, options, context) {\n parseGLTFContainerSync(gltf, arrayBufferOrString, byteOffset, options);\n normalizeGLTFV1(gltf, { normalize: options?.gltf?.normalize });\n preprocessExtensions(gltf, options, context);\n // Load linked buffers asynchronously and decodes base64 buffers in parallel\n if (options?.gltf?.loadBuffers && gltf.json.buffers) {\n await loadBuffers(gltf, options, context);\n }\n // loadImages and decodeExtensions should not be running in parallel, because\n // decodeExtensions uses data from images taken during the loadImages call.\n if (options?.gltf?.loadImages) {\n await loadImages(gltf, options, context);\n }\n await decodeExtensions(gltf, options, context);\n return gltf;\n}\n/**\n *\n * @param gltf\n * @param data - can be ArrayBuffer (GLB), ArrayBuffer (Binary JSON), String (JSON), or Object (parsed JSON)\n * @param byteOffset\n * @param options\n */\nfunction parseGLTFContainerSync(gltf, data, byteOffset, options) {\n // Initialize gltf container\n if (options.uri) {\n gltf.baseUri = options.uri;\n }\n // If data is binary and starting with magic bytes, assume binary JSON text, convert to string\n if (data instanceof ArrayBuffer && !isGLB(data, byteOffset, options)) {\n const textDecoder = new TextDecoder();\n data = textDecoder.decode(data);\n }\n if (typeof data === 'string') {\n // If string, try to parse as JSON\n gltf.json = parseJSON(data);\n }\n else if (data instanceof ArrayBuffer) {\n // If still ArrayBuffer, parse as GLB container\n const glb = {};\n byteOffset = parseGLBSync(glb, data, byteOffset, options.glb);\n assert(glb.type === 'glTF', `Invalid GLB magic string ${glb.type}`);\n gltf._glb = glb;\n gltf.json = glb.json;\n }\n else {\n assert(false, 'GLTF: must be ArrayBuffer or string');\n }\n // Populate buffers\n // Create an external buffers array to hold binary data\n const buffers = gltf.json.buffers || [];\n gltf.buffers = new Array(buffers.length).fill(null);\n // Populates JSON and some bin chunk info\n if (gltf._glb && gltf._glb.header.hasBinChunk) {\n const { binChunks } = gltf._glb;\n gltf.buffers[0] = {\n arrayBuffer: binChunks[0].arrayBuffer,\n byteOffset: binChunks[0].byteOffset,\n byteLength: binChunks[0].byteLength\n };\n // TODO - this modifies JSON and is a post processing thing\n // gltf.json.buffers[0].data = gltf.buffers[0].arrayBuffer;\n // gltf.json.buffers[0].byteOffset = gltf.buffers[0].byteOffset;\n }\n // Populate images\n const images = gltf.json.images || [];\n gltf.images = new Array(images.length).fill({});\n}\n/** Asynchronously fetch and parse buffers, store in buffers array outside of json\n * TODO - traverse gltf and determine which buffers are actually needed\n */\nasync function loadBuffers(gltf, options, context) {\n // TODO\n const buffers = gltf.json.buffers || [];\n for (let i = 0; i < buffers.length; ++i) {\n const buffer = buffers[i];\n if (buffer.uri) {\n const { fetch } = context;\n assert(fetch);\n const uri = resolveUrl(buffer.uri, options);\n const response = await context?.fetch?.(uri);\n const arrayBuffer = await response?.arrayBuffer?.();\n gltf.buffers[i] = {\n arrayBuffer,\n byteOffset: 0,\n byteLength: arrayBuffer.byteLength\n };\n delete buffer.uri;\n }\n else if (gltf.buffers[i] === null) {\n gltf.buffers[i] = {\n arrayBuffer: new ArrayBuffer(buffer.byteLength),\n byteOffset: 0,\n byteLength: buffer.byteLength\n };\n }\n }\n}\n/**\n * Loads all images\n * TODO - traverse gltf and determine which images are actually needed\n * @param gltf\n * @param options\n * @param context\n * @returns\n */\nasync function loadImages(gltf, options, context) {\n const imageIndices = getReferencesImageIndices(gltf);\n const images = gltf.json.images || [];\n const promises = [];\n for (const imageIndex of imageIndices) {\n promises.push(loadImage(gltf, images[imageIndex], imageIndex, options, context));\n }\n return await Promise.all(promises);\n}\n/** Make sure we only load images that are actually referenced by textures */\nfunction getReferencesImageIndices(gltf) {\n const imageIndices = new Set();\n const textures = gltf.json.textures || [];\n for (const texture of textures) {\n if (texture.source !== undefined) {\n imageIndices.add(texture.source);\n }\n }\n return Array.from(imageIndices).sort();\n}\n/** Asynchronously fetches and parses one image, store in images array outside of json */\nasync function loadImage(gltf, image, index, options, context) {\n let arrayBuffer;\n if (image.uri && !image.hasOwnProperty('bufferView')) {\n const uri = resolveUrl(image.uri, options);\n const { fetch } = context;\n const response = await fetch(uri);\n arrayBuffer = await response.arrayBuffer();\n image.bufferView = {\n data: arrayBuffer\n };\n }\n if (Number.isFinite(image.bufferView)) {\n const array = getTypedArrayForBufferView(gltf.json, gltf.buffers, image.bufferView);\n arrayBuffer = sliceArrayBuffer(array.buffer, array.byteOffset, array.byteLength);\n }\n assert(arrayBuffer, 'glTF image has no data');\n // Call `parse`\n let parsedImage = (await parseFromContext(arrayBuffer, [ImageLoader, BasisLoader], {\n ...options,\n mimeType: image.mimeType,\n basis: options.basis || { format: selectSupportedBasisFormat() }\n }, context));\n if (parsedImage && parsedImage[0]) {\n parsedImage = {\n compressed: true,\n // @ts-expect-error\n mipmaps: false,\n width: parsedImage[0].width,\n height: parsedImage[0].height,\n data: parsedImage[0]\n };\n }\n // TODO making sure ImageLoader is overridable by using array of loaders\n // const parsedImage = await parse(arrayBuffer, [ImageLoader]);\n // Store the loaded image\n gltf.images = gltf.images || [];\n // @ts-expect-error TODO - sort out image typing asap\n gltf.images[index] = parsedImage;\n}\n","import { VERSION } from \"./lib/utils/version.js\";\nimport { parseGLTF } from \"./lib/parsers/parse-gltf.js\";\n/**\n * GLTF loader\n */\nexport const GLTFLoader = {\n dataType: null,\n batchType: null,\n name: 'glTF',\n id: 'gltf',\n module: 'gltf',\n version: VERSION,\n extensions: ['gltf', 'glb'],\n mimeTypes: ['model/gltf+json', 'model/gltf-binary'],\n text: true,\n binary: true,\n tests: ['glTF'],\n parse,\n options: {\n gltf: {\n normalize: true, // Normalize glTF v1 to glTF v2 format (not yet stable)\n loadBuffers: true, // Fetch any linked .BIN buffers, decode base64\n loadImages: true, // Create image objects\n decompressMeshes: true // Decompress Draco encoded meshes\n },\n // common?\n log: console // eslint-disable-line\n }\n};\nexport async function parse(arrayBuffer, options = {}, context) {\n // Apps can call the parse method directly, we so apply default options here\n options = { ...GLTFLoader.options, ...options };\n // @ts-ignore\n options.gltf = { ...GLTFLoader.options.gltf, ...options.gltf };\n const { byteOffset = 0 } = options;\n const gltf = {};\n return await parseGLTF(gltf, arrayBuffer, byteOffset, options, context);\n}\n","// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { assert } from \"../utils/assert.js\";\nimport { getAccessorArrayTypeAndLength } from \"../gltf-utils/gltf-utils.js\";\n// This is a post processor for loaded glTF files\n// The goal is to make the loaded data easier to use in WebGL applications\n//\n// Functions:\n// * Resolve indexed arrays structure of glTF into a linked tree.\n// * Translate stringified enum keys and values into WebGL constants.\n// * Load images (optional)\n// ENUM LOOKUP\nconst COMPONENTS = {\n SCALAR: 1,\n VEC2: 2,\n VEC3: 3,\n VEC4: 4,\n MAT2: 4,\n MAT3: 9,\n MAT4: 16\n};\nconst BYTES = {\n 5120: 1, // BYTE\n 5121: 1, // UNSIGNED_BYTE\n 5122: 2, // SHORT\n 5123: 2, // UNSIGNED_SHORT\n 5125: 4, // UNSIGNED_INT\n 5126: 4 // FLOAT\n};\nconst GL_SAMPLER = {\n // Sampler parameters\n TEXTURE_MAG_FILTER: 0x2800,\n TEXTURE_MIN_FILTER: 0x2801,\n TEXTURE_WRAP_S: 0x2802,\n TEXTURE_WRAP_T: 0x2803,\n // Sampler default values\n REPEAT: 0x2901,\n LINEAR: 0x2601,\n NEAREST_MIPMAP_LINEAR: 0x2702\n};\nconst SAMPLER_PARAMETER_GLTF_TO_GL = {\n magFilter: GL_SAMPLER.TEXTURE_MAG_FILTER,\n minFilter: GL_SAMPLER.TEXTURE_MIN_FILTER,\n wrapS: GL_SAMPLER.TEXTURE_WRAP_S,\n wrapT: GL_SAMPLER.TEXTURE_WRAP_T\n};\n// When undefined, a sampler with repeat wrapping and auto filtering should be used.\n// https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#texture\nconst DEFAULT_SAMPLER_PARAMETERS = {\n [GL_SAMPLER.TEXTURE_MAG_FILTER]: GL_SAMPLER.LINEAR,\n [GL_SAMPLER.TEXTURE_MIN_FILTER]: GL_SAMPLER.NEAREST_MIPMAP_LINEAR,\n [GL_SAMPLER.TEXTURE_WRAP_S]: GL_SAMPLER.REPEAT,\n [GL_SAMPLER.TEXTURE_WRAP_T]: GL_SAMPLER.REPEAT\n};\nfunction makeDefaultSampler() {\n return {\n id: 'default-sampler',\n parameters: DEFAULT_SAMPLER_PARAMETERS\n };\n}\nfunction getBytesFromComponentType(componentType) {\n return BYTES[componentType];\n}\nfunction getSizeFromAccessorType(type) {\n return COMPONENTS[type];\n}\nclass GLTFPostProcessor {\n baseUri = '';\n // @ts-expect-error\n jsonUnprocessed;\n // @ts-expect-error\n json;\n buffers = [];\n images = [];\n postProcess(gltf, options = {}) {\n const { json, buffers = [], images = [] } = gltf;\n // @ts-expect-error\n const { baseUri = '' } = gltf;\n assert(json);\n this.baseUri = baseUri;\n this.buffers = buffers;\n this.images = images;\n this.jsonUnprocessed = json;\n this.json = this._resolveTree(gltf.json, options);\n return this.json;\n }\n // Convert indexed glTF structure into tree structure\n // cross-link index resolution, enum lookup, convenience calculations\n // eslint-disable-next-line complexity, max-statements\n _resolveTree(gltf, options = {}) {\n // @ts-expect-error\n const json = { ...gltf };\n this.json = json;\n if (gltf.bufferViews) {\n json.bufferViews = gltf.bufferViews.map((bufView, i) => this._resolveBufferView(bufView, i));\n }\n if (gltf.images) {\n json.images = gltf.images.map((image, i) => this._resolveImage(image, i));\n }\n if (gltf.samplers) {\n json.samplers = gltf.samplers.map((sampler, i) => this._resolveSampler(sampler, i));\n }\n if (gltf.textures) {\n json.textures = gltf.textures.map((texture, i) => this._resolveTexture(texture, i));\n }\n if (gltf.accessors) {\n json.accessors = gltf.accessors.map((accessor, i) => this._resolveAccessor(accessor, i));\n }\n if (gltf.materials) {\n json.materials = gltf.materials.map((material, i) => this._resolveMaterial(material, i));\n }\n if (gltf.meshes) {\n json.meshes = gltf.meshes.map((mesh, i) => this._resolveMesh(mesh, i));\n }\n if (gltf.nodes) {\n json.nodes = gltf.nodes.map((node, i) => this._resolveNode(node, i));\n json.nodes = json.nodes.map((node, i) => this._resolveNodeChildren(node));\n }\n if (gltf.skins) {\n json.skins = gltf.skins.map((skin, i) => this._resolveSkin(skin, i));\n }\n if (gltf.scenes) {\n json.scenes = gltf.scenes.map((scene, i) => this._resolveScene(scene, i));\n }\n if (typeof this.json.scene === 'number' && json.scenes) {\n json.scene = json.scenes[this.json.scene];\n }\n return json;\n }\n getScene(index) {\n return this._get(this.json.scenes, index);\n }\n getNode(index) {\n return this._get(this.json.nodes, index);\n }\n getSkin(index) {\n return this._get(this.json.skins, index);\n }\n getMesh(index) {\n return this._get(this.json.meshes, index);\n }\n getMaterial(index) {\n return this._get(this.json.materials, index);\n }\n getAccessor(index) {\n return this._get(this.json.accessors, index);\n }\n getCamera(index) {\n return this._get(this.json.cameras, index);\n }\n getTexture(index) {\n return this._get(this.json.textures, index);\n }\n getSampler(index) {\n return this._get(this.json.samplers, index);\n }\n getImage(index) {\n return this._get(this.json.images, index);\n }\n getBufferView(index) {\n return this._get(this.json.bufferViews, index);\n }\n getBuffer(index) {\n return this._get(this.json.buffers, index);\n }\n _get(array, index) {\n // check if already resolved\n if (typeof index === 'object') {\n return index;\n }\n const object = array && array[index];\n if (!object) {\n console.warn(`glTF file error: Could not find ${array}[${index}]`); // eslint-disable-line\n }\n return object;\n }\n // PARSING HELPERS\n _resolveScene(scene, index) {\n return {\n ...scene,\n // @ts-ignore\n id: scene.id || `scene-${index}`,\n nodes: (scene.nodes || []).map((node) => this.getNode(node))\n };\n }\n _resolveNode(gltfNode, index) {\n // @ts-expect-error\n const node = {\n ...gltfNode,\n // @ts-expect-error id could already be present, glTF standard does not prevent it\n id: gltfNode?.id || `node-${index}`\n };\n if (gltfNode.mesh !== undefined) {\n node.mesh = this.getMesh(gltfNode.mesh);\n }\n if (gltfNode.camera !== undefined) {\n node.camera = this.getCamera(gltfNode.camera);\n }\n if (gltfNode.skin !== undefined) {\n node.skin = this.getSkin(gltfNode.skin);\n }\n // TODO deprecated - Delete in v4.0?\n // @ts-expect-error node.meshes does not seem to be part of the GLTF standard\n if (gltfNode.meshes !== undefined && gltfNode.meshes.length) {\n // @ts-expect-error\n node.mesh = gltfNode.meshes.reduce((accum, meshIndex) => {\n const mesh = this.getMesh(meshIndex);\n accum.id = mesh.id;\n accum.primitives = accum.primitives.concat(mesh.primitives);\n return accum;\n }, { primitives: [] });\n }\n return node;\n }\n _resolveNodeChildren(node) {\n if (node.children) {\n // @ts-expect-error node.children are numbers at this stage\n node.children = node.children.map((child) => this.getNode(child));\n }\n return node;\n }\n _resolveSkin(gltfSkin, index) {\n const inverseBindMatrices = typeof gltfSkin.inverseBindMatrices === 'number'\n ? this.getAccessor(gltfSkin.inverseBindMatrices)\n : undefined;\n return {\n ...gltfSkin,\n id: gltfSkin.id || `skin-${index}`,\n inverseBindMatrices\n };\n }\n _resolveMesh(gltfMesh, index) {\n const mesh = {\n ...gltfMesh,\n id: gltfMesh.id || `mesh-${index}`,\n primitives: []\n };\n if (gltfMesh.primitives) {\n mesh.primitives = gltfMesh.primitives.map((gltfPrimitive) => {\n const primitive = {\n ...gltfPrimitive,\n attributes: {},\n indices: undefined,\n material: undefined\n };\n const attributes = gltfPrimitive.attributes;\n for (const attribute in attributes) {\n primitive.attributes[attribute] = this.getAccessor(attributes[attribute]);\n }\n if (gltfPrimitive.indices !== undefined) {\n primitive.indices = this.getAccessor(gltfPrimitive.indices);\n }\n if (gltfPrimitive.material !== undefined) {\n primitive.material = this.getMaterial(gltfPrimitive.material);\n }\n return primitive;\n });\n }\n return mesh;\n }\n _resolveMaterial(gltfMaterial, index) {\n // @ts-expect-error\n const material = {\n ...gltfMaterial,\n // @ts-expect-error\n id: gltfMaterial.id || `material-${index}`\n };\n if (material.normalTexture) {\n material.normalTexture = { ...material.normalTexture };\n material.normalTexture.texture = this.getTexture(material.normalTexture.index);\n }\n if (material.occlusionTexture) {\n material.occlusionTexture = { ...material.occlusionTexture };\n material.occlusionTexture.texture = this.getTexture(material.occlusionTexture.index);\n }\n if (material.emissiveTexture) {\n material.emissiveTexture = { ...material.emissiveTexture };\n material.emissiveTexture.texture = this.getTexture(material.emissiveTexture.index);\n }\n if (!material.emissiveFactor) {\n material.emissiveFactor = material.emissiveTexture ? [1, 1, 1] : [0, 0, 0];\n }\n if (material.pbrMetallicRoughness) {\n material.pbrMetallicRoughness = { ...material.pbrMetallicRoughness };\n const mr = material.pbrMetallicRoughness;\n if (mr.baseColorTexture) {\n mr.baseColorTexture = { ...mr.baseColorTexture };\n mr.baseColorTexture.texture = this.getTexture(mr.baseColorTexture.index);\n }\n if (mr.metallicRoughnessTexture) {\n mr.metallicRoughnessTexture = { ...mr.metallicRoughnessTexture };\n mr.metallicRoughnessTexture.texture = this.getTexture(mr.metallicRoughnessTexture.index);\n }\n }\n return material;\n }\n _resolveAccessor(gltfAccessor, index) {\n // Look up enums\n const bytesPerComponent = getBytesFromComponentType(gltfAccessor.componentType);\n const components = getSizeFromAccessorType(gltfAccessor.type);\n const bytesPerElement = bytesPerComponent * components;\n const accessor = {\n ...gltfAccessor,\n // @ts-expect-error\n id: gltfAccessor.id || `accessor-${index}`,\n bytesPerComponent,\n components,\n bytesPerElement,\n value: undefined,\n bufferView: undefined,\n sparse: undefined\n };\n if (gltfAccessor.bufferView !== undefined) {\n // Draco encoded meshes don't have bufferView\n accessor.bufferView = this.getBufferView(gltfAccessor.bufferView);\n }\n // Create TypedArray for the accessor\n // Note: The canonical way to instantiate is to ignore this array and create\n // WebGLBuffer's using the bufferViews.\n if (accessor.bufferView) {\n const buffer = accessor.bufferView.buffer;\n const { ArrayType, byteLength } = getAccessorArrayTypeAndLength(accessor, accessor.bufferView);\n const byteOffset = (accessor.bufferView.byteOffset || 0) + (accessor.byteOffset || 0) + buffer.byteOffset;\n let cutBuffer = buffer.arrayBuffer.slice(byteOffset, byteOffset + byteLength);\n if (accessor.bufferView.byteStride) {\n cutBuffer = this._getValueFromInterleavedBuffer(buffer, byteOffset, accessor.bufferView.byteStride, accessor.bytesPerElement, accessor.count);\n }\n accessor.value = new ArrayType(cutBuffer);\n }\n return accessor;\n }\n /**\n * Take values of particular accessor from interleaved buffer\n * various parts of the buffer\n * @param buffer\n * @param byteOffset\n * @param byteStride\n * @param bytesPerElement\n * @param count\n * @returns\n */\n _getValueFromInterleavedBuffer(buffer, byteOffset, byteStride, bytesPerElement, count) {\n const result = new Uint8Array(count * bytesPerElement);\n for (let i = 0; i < count; i++) {\n const elementOffset = byteOffset + i * byteStride;\n result.set(new Uint8Array(buffer.arrayBuffer.slice(elementOffset, elementOffset + bytesPerElement)), i * bytesPerElement);\n }\n return result.buffer;\n }\n _resolveTexture(gltfTexture, index) {\n return {\n ...gltfTexture,\n // @ts-expect-error id could already be present, glTF standard does not prevent it\n id: gltfTexture.id || `texture-${index}`,\n sampler: typeof gltfTexture.sampler === 'number'\n ? this.getSampler(gltfTexture.sampler)\n : makeDefaultSampler(),\n source: typeof gltfTexture.source === 'number' ? this.getImage(gltfTexture.source) : undefined\n };\n }\n _resolveSampler(gltfSampler, index) {\n const sampler = {\n // @ts-expect-error id could already be present, glTF standard does not prevent it\n id: gltfSampler.id || `sampler-${index}`,\n ...gltfSampler,\n parameters: {}\n };\n // Map textual parameters to GL parameter values\n for (const key in sampler) {\n const glEnum = this._enumSamplerParameter(key);\n if (glEnum !== undefined) {\n sampler.parameters[glEnum] = sampler[key];\n }\n }\n return sampler;\n }\n _enumSamplerParameter(key) {\n return SAMPLER_PARAMETER_GLTF_TO_GL[key];\n }\n _resolveImage(gltfImage, index) {\n const image = {\n ...gltfImage,\n // @ts-expect-error id could already be present, glTF standard does not prevent it\n id: gltfImage.id || `image-${index}`,\n image: null,\n bufferView: gltfImage.bufferView !== undefined ? this.getBufferView(gltfImage.bufferView) : undefined\n };\n // Check if image has been preloaded by the GLTFLoader\n // If so, link it into the JSON and drop the URI\n const preloadedImage = this.images[index];\n if (preloadedImage) {\n image.image = preloadedImage;\n }\n return image;\n }\n _resolveBufferView(gltfBufferView, index) {\n const bufferIndex = gltfBufferView.buffer;\n const arrayBuffer = this.buffers[bufferIndex].arrayBuffer;\n // Add offset of buffer, then offset of buffer view\n let byteOffset = this.buffers[bufferIndex].byteOffset || 0;\n if (gltfBufferView.byteOffset) {\n byteOffset += gltfBufferView.byteOffset;\n }\n const bufferView = {\n // // @ts-expect-error id could already be present, glTF standard does not prevent it\n id: `bufferView-${index}`,\n ...gltfBufferView,\n // ...this.buffers[bufferIndex],\n buffer: this.buffers[bufferIndex],\n data: new Uint8Array(arrayBuffer, byteOffset, gltfBufferView.byteLength)\n };\n return bufferView;\n }\n _resolveCamera(gltfCamera, index) {\n const camera = {\n ...gltfCamera,\n // @ts-expect-error id could already be present, glTF standard does not prevent it\n id: gltfCamera.id || `camera-${index}`\n };\n // TODO - create 4x4 matrices\n if (camera.perspective) {\n // camera.matrix = createPerspectiveMatrix(camera.perspective);\n }\n if (camera.orthographic) {\n // camera.matrix = createOrthographicMatrix(camera.orthographic);\n }\n return camera;\n }\n}\nexport function postProcessGLTF(gltf, options) {\n return new GLTFPostProcessor().postProcess(gltf, options);\n}\n","// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport async function waitForGLTFAssets(gltfObjects) {\n const remaining = [];\n gltfObjects.scenes.forEach(scene => {\n scene.traverse((modelNode) => {\n // Not really clear how we can access the uniforms?\n // TODO v9 getUnforms() was removed, hack it with props.uniforms\n // Object.values((modelNode as ModelNode).model.uniforms).forEach((uniform: any) => {\n // if (uniform.loaded === false) {\n // remaining.push(uniform);\n // }\n // });\n });\n });\n return await waitWhileCondition(() => remaining.some(uniform => !uniform.loaded));\n}\nasync function waitWhileCondition(condition) {\n while (condition()) {\n await new Promise(resolve => requestAnimationFrame(resolve));\n }\n}\n//# sourceMappingURL=gltf-utils.js.map","// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nconst uniformBlock = `\\\nuniform scenegraphUniforms {\n float sizeScale;\n float sizeMinPixels;\n float sizeMaxPixels;\n mat4 sceneModelMatrix;\n bool composeModelMatrix;\n} scenegraph;\n`;\nexport const scenegraphUniforms = {\n name: 'scenegraph',\n vs: uniformBlock,\n fs: uniformBlock,\n uniformTypes: {\n sizeScale: 'f32',\n sizeMinPixels: 'f32',\n sizeMaxPixels: 'f32',\n sceneModelMatrix: 'mat4x4<f32>',\n composeModelMatrix: 'f32'\n }\n};\n//# sourceMappingURL=scenegraph-layer-uniforms.js.map","// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport default `\\\n#version 300 es\n#define SHADER_NAME scenegraph-layer-vertex-shader\nin vec3 instancePositions;\nin vec3 instancePositions64Low;\nin vec4 instanceColors;\nin vec3 instancePickingColors;\nin vec3 instanceModelMatrixCol0;\nin vec3 instanceModelMatrixCol1;\nin vec3 instanceModelMatrixCol2;\nin vec3 instanceTranslation;\nin vec3 positions;\n#ifdef HAS_UV\nin vec2 texCoords;\n#endif\n#ifdef LIGHTING_PBR\n#ifdef HAS_NORMALS\nin vec3 normals;\n#endif\n#endif\nout vec4 vColor;\n#ifndef LIGHTING_PBR\n#ifdef HAS_UV\nout vec2 vTEXCOORD_0;\n#endif\n#endif\nvoid main(void) {\n#if defined(HAS_UV) && !defined(LIGHTING_PBR)\nvTEXCOORD_0 = texCoords;\ngeometry.uv = texCoords;\n#endif\ngeometry.worldPosition = instancePositions;\ngeometry.pickingColor = instancePickingColors;\nmat3 instanceModelMatrix = mat3(instanceModelMatrixCol0, instanceModelMatrixCol1, instanceModelMatrixCol2);\nvec3 normal = vec3(0.0, 0.0, 1.0);\n#ifdef LIGHTING_PBR\n#ifdef HAS_NORMALS\nnormal = instanceModelMatrix * (scenegraph.sceneModelMatrix * vec4(normals, 0.0)).xyz;\n#endif\n#endif\nfloat originalSize = project_size_to_pixel(scenegraph.sizeScale);\nfloat clampedSize = clamp(originalSize, scenegraph.sizeMinPixels, scenegraph.sizeMaxPixels);\nvec3 pos = (instanceModelMatrix * (scenegraph.sceneModelMatrix * vec4(positions, 1.0)).xyz) * scenegraph.sizeScale * (clampedSize / originalSize) + instanceTranslation;\nif(scenegraph.composeModelMatrix) {\nDECKGL_FILTER_SIZE(pos, geometry);\ngeometry.normal = project_normal(normal);\ngeometry.worldPosition += pos;\ngl_Position = project_position_to_clipspace(pos + instancePositions, instancePositions64Low, vec3(0.0), geometry.position);\n}\nelse {\npos = project_size(pos);\nDECKGL_FILTER_SIZE(pos, geometry);\ngl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, pos, geometry.position);\ngeometry.normal = project_normal(normal);\n}\nDECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n#ifdef LIGHTING_PBR\npbr_vPosition = geometry.position.xyz;\n#ifdef HAS_NORMALS\npbr_vNormal = geometry.normal;\n#endif\n#ifdef HAS_UV\npbr_vUV = texCoords;\n#else\npbr_vUV = vec2(0., 0.);\n#endif\ngeometry.uv = pbr_vUV;\n#endif\nvColor = instanceColors;\nDECKGL_FILTER_COLOR(vColor, geometry);\n}\n`;\n//# sourceMappingURL=scenegraph-layer-vertex.glsl.js.map","// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport default `\\\n#version 300 es\n#define SHADER_NAME scenegraph-layer-fragment-shader\nin vec4 vColor;\nout vec4 fragColor;\n#ifndef LIGHTING_PBR\n#if defined(HAS_UV) && defined(HAS_BASECOLORMAP)\nin vec2 vTEXCOORD_0;\nuniform sampler2D pbr_baseColorSampler;\n#endif\n#endif\nvoid main(void) {\n#ifdef LIGHTING_PBR\nfragColor = vColor * pbr_filterColor(vec4(0));\ngeometry.uv = pbr_vUV;\n#else\n#if defined(HAS_UV) && defined(HAS_BASECOLORMAP)\nfragColor = vColor * texture(pbr_baseColorSampler, vTEXCOORD_0);\ngeometry.uv = vTEXCOORD_0;\n#else\nfragColor = vColor;\n#endif\n#endif\nfragColor.a *= layer.opacity;\nDECKGL_FILTER_COLOR(fragColor, geometry);\n}\n`;\n//# sourceMappingURL=scenegraph-layer-fragment.glsl.js.map","// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Layer, project32, picking, log } from '@deck.gl/core';\nimport { pbrMaterial } from '@luma.gl/shadertools';\nimport { ScenegraphNode, GroupNode, ModelNode } from '@luma.gl/engine';\nimport { createScenegraphsFromGLTF } from '@luma.gl/gltf';\nimport { GLTFLoader, postProcessGLTF } from '@loaders.gl/gltf';\nimport { waitForGLTFAssets } from \"./gltf-utils.js\";\nimport { MATRIX_ATTRIBUTES, shouldComposeModelMatrix } from \"../utils/matrix.js\";\nimport { scenegraphUniforms } from \"./scenegraph-layer-uniforms.js\";\nimport vs from \"./scenegraph-layer-vertex.glsl.js\";\nimport fs from \"./scenegraph-layer-fragment.glsl.js\";\nconst DEFAULT_COLOR = [255, 255, 255, 255];\nconst defaultProps = {\n scenegraph: { type: 'object', value: null, async: true },\n getScene: gltf => {\n if (gltf && gltf.scenes) {\n // gltf post processor replaces `gltf.scene` number with the scene `object`\n return typeof gltf.scene === 'object' ? gltf.scene : gltf.scenes[gltf.scene || 0];\n }\n return gltf;\n },\n getAnimator: scenegraph => scenegraph && scenegraph.animator,\n _animations: null,\n sizeScale: { type: 'number', value: 1, min: 0 },\n sizeMinPixels: { type: 'number', min: 0, value: 0 },\n sizeMaxPixels: { type: 'number', min: 0, value: Number.MAX_SAFE_INTEGER },\n getPosition: { type: 'accessor', value: (x) => x.position },\n getColor: { type: 'accessor', value: DEFAULT_COLOR },\n // flat or pbr\n _lighting: 'flat',\n // _lighting must be pbr for this to work\n _imageBasedLightingEnvironment: undefined,\n // yaw, pitch and roll are in degrees\n // https://en.wikipedia.org/wiki/Euler_angles\n // [pitch, yaw, roll]\n getOrientation: { type: 'accessor', value: [0, 0, 0] },\n getScale: { type: 'accessor', value: [1, 1, 1] },\n getTranslation: { type: 'accessor', value: [0, 0, 0] },\n // 4x4 matrix\n getTransformMatrix: { type: 'accessor', value: [] },\n loaders: [GLTFLoader]\n};\n/** Render a number of instances of a complete glTF scenegraph. */\nclass ScenegraphLayer extends Layer {\n getShaders() {\n const defines = {};\n let pbr;\n if (this.props._lighting === 'pbr') {\n pbr = pbrMaterial;\n defines.LIGHTING_PBR = 1;\n }\n else {\n // Dummy shader module needed to handle\n // pbrMaterial.pbr_baseColorSampler binding\n pbr = { name: 'pbrMaterial' };\n }\n const modules = [project32, picking, scenegraphUniforms, pbr];\n return super.getShaders({ defines, vs, fs, modules });\n }\n initializeState() {\n const attributeManager = this.getAttributeManager();\n // attributeManager is always defined for primitive layers\n attributeManager.addInstanced({\n instancePositions: {\n size: 3,\n type: 'float64',\n fp64: this.use64bitPositions(),\n accessor: 'getPosition',\n transition: true\n },\n instanceColors: {\n type: 'unorm8',\n size: this.props.colorFormat.length,\n accessor: 'getColor',\n defaultValue: DEFAULT_COLOR,\n transition: true\n },\n instanceModelMatrix: MATRIX_ATTRIBUTES\n });\n }\n updateState(params) {\n super.updateState(params);\n const { props, oldProps } = params;\n if (props.scenegraph !== oldProps.scenegraph) {\n this._updateScenegraph();\n }\n else if (props._animations !== oldProps._animations) {\n this._applyAnimationsProp(this.state.animator, props._animations);\n }\n }\n finalizeState(context) {\n super.finalizeState(context);\n this.state.scenegraph?.destroy();\n }\n get isLoaded() {\n return Boolean(this.state?.scenegraph && super.isLoaded);\n }\n _updateScenegraph() {\n const props = this.props;\n const { device } = this.context;\n let scenegraphData = null;\n if (props.scenegraph instanceof ScenegraphNode) {\n // Signature 1: props.scenegraph is a proper luma.gl Scenegraph\n scenegraphData = { scenes: [props.scenegraph] };\n }\n else if (props.scenegraph && typeof props.scenegraph === 'object') {\n // Converts loaders.gl gltf to luma.gl scenegraph using the undocumented @luma.gl/experimental function\n const gltf = props.scenegraph;\n // Tiles3DLoader already processes GLTF\n const processedGLTF = gltf.json ? postProcessGLTF(gltf) : gltf;\n const gltfObjects = createScenegraphsFromGLTF(device, processedGLTF, this._getModelOptions());\n scenegraphData = { gltf: processedGLTF, ...gltfObjects };\n waitForGLTFAssets(gltfObjects)\n .then(() => {\n this.setNeedsRedraw();\n })\n .catch(ex => {\n this.raiseError(ex, 'loading glTF');\n });\n }\n const options = { layer: this, device: this.context.device };\n const scenegraph = props.getScene(scenegraphData, options);\n const animator = props.getAnimator(scenegraphData, options);\n if (scenegraph instanceof GroupNode) {\n this.state.scenegraph?.destroy();\n this._applyAnimationsProp(animator, props._animations);\n const models = [];\n scenegraph.traverse(node => {\n if (node instanceof ModelNode) {\n models.push(node.model);\n }\n });\n this.setState({ scenegraph, animator, models });\n this.getAttributeManager().invalidateAll();\n }\n else if (scenegraph !== null) {\n log.warn('invalid scenegraph:', scenegraph)();\n }\n }\n _applyAnimationsProp(animator, animationsProp) {\n if (!animator || !animationsProp) {\n return;\n }\n const animations = animator.getAnimations();\n // sort() to ensure '*' comes first so that other values can override\n Object.keys(animationsProp)\n .sort()\n .forEach(key => {\n // Key can be:\n // - number for index number\n // - name for animation name\n // - * to affect all animations\n const value = animationsProp[key];\n if (key === '*') {\n animations.forEach(animation => {\n Object.assign(animation, value);\n });\n }\n else if (Number.isFinite(Number(key))) {\n const number = Number(key);\n if (number >= 0 && number < animations.length) {\n Object.assign(animations[number], value);\n }\n else {\n log.warn(`animation ${key} not found`)();\n }\n }\n else {\n const findResult = animations.find(({ animation }) => animation.name === key);\n if (findResult) {\n Object.assign(findResult, value);\n }\n else {\n log.warn(`animation ${key} not found`)();\n }\n }\n });\n }\n _getModelOptions() {\n const { _imageBasedLightingEnvironment } = this.props;\n let env;\n if (_imageBasedLightingEnvironment) {\n if (typeof _imageBasedLightingEnvironment === 'function') {\n env = _imageBasedLightingEnvironment({ gl: this.context.gl, layer: this });\n }\n else {\n env = _imageBasedLightingEnvironment;\n }\n }\n return {\n imageBasedLightingEnvironment: env,\n modelOptions: {\n id: this.props.id,\n isInstanced: true,\n bufferLayout: this.getAttributeManager().getBufferLayouts(),\n ...this.getShaders()\n },\n // tangents are not supported\n useTangents: false\n };\n }\n draw({ context }) {\n if (!this.state.scenegraph)\n return;\n if (this.props._animations && this.state.animator) {\n this.state.animator.animate(context.timeline.getTime());\n this.setNeedsRedraw();\n }\n const { viewport, renderPass } = this.context;\n const { sizeScale, sizeMinPixels, sizeMaxPixels, coordinateSystem } = this.props;\n const pbrProjectionProps = {\n camera: viewport.cameraPosition\n };\n const numInstances = this.getNumInstances();\n this.state.scenegraph.traverse((node, { worldMatrix }) => {\n if (node instanceof ModelNode) {\n const { model } = node;\n model.setInstanceCount(numInstances);\n const scenegraphProps = {\n sizeScale,\n sizeMinPixels,\n sizeMaxPixels,\n composeModelMatrix: shouldComposeModelMatrix(viewport, coordinateSystem),\n sceneModelMatrix: worldMatrix\n };\n model.shaderInputs.setProps({\n pbrProjection: pbrProjectionProps,\n scenegraph: scenegraphProps\n });\n model.draw(renderPass);\n }\n });\n }\n}\nScenegraphLayer.defaultProps = defaultProps;\nScenegraphLayer.layerName = 'ScenegraphLayer';\nexport default ScenegraphLayer;\n//# sourceMappingURL=scenegraph-layer.js.map"],"names":["parseFromContext","data","loaders","options","context","registerJSModules","modules","getJSModuleOrNull","name","loadLibraryPromises","loadLibrary","libraryUrl","moduleName","libraryName","getLibraryUrl","loadLibraryFromFile","library","isBrowser","assert","VERSION","isWorker","loadAsArrayBuffer","requireFromFile","error","scriptSource","loadAsText","loadLibraryFromString","id","requireFromString","script","url","readFileAsArrayBuffer","readFileAsText","getFirstCharacters","length","getMagicString","arrayBuffer","byteOffset","dataView","magic","i","parseJSON","string","padToNBytes","byteLength","padding","copyToArray","source","target","targetOffset","sourceArray","srcByteOffset","srcByteLength","getDataTypeFromTypedArray","array","getMeshBoundingBox","attributes","minX","minY","minZ","maxX","maxY","maxZ","positions","len","x","y","z","deduceMeshField","attribute","optionalMetadata","type","metadata","makeMeshAttributeMetadata","result","mimeTypeSupportedSync","isImageFormatSupported","mimeType","supported","checkBrowserImageFormatSupport","checkNodeImageFormatSupport","NODE_FORMAT_SUPPORT","imageFormatsNode","testBrowserImageFormatSupport","ZERO","Vector4","Vector","w","isArray","config","checkNumber","object","value","matrix4","vec4_transformMat4","matrix3","vec4_transformMat3","matrix2","vec4_transformMat2","quaternion","vec4_transformQuat","m","create","out","glMatrix.ARRAY_TYPE","transpose","a","a01","a02","a12","invert","a00","a10","a11","a20","a21","a22","b01","b11","b21","det","determinant","multiply","b","b00","b02","b10","b12","b20","b22","translate","v","rotate","rad","s","c","scale","fromQuat","q","x2","y2","z2","xx","yx","yy","zx","zy","zz","wx","wy","wz","INDICES","IDENTITY_MATRIX","Matrix3","Matrix","getIdentityMatrix","getZeroMatrix","args","mat3_fromQuat","m00","m10","m20","m01","m11","m21","m02","m12","m22","mat3_determinant","mat3_transpose","mat3_invert","mat3_multiply","radians","mat3_rotate","factor","mat3_scale","vec","mat3_translate","vector","vec2_transformMat3","vec3_transformMat3","checkVector","ZERO_MATRIX3","IDENTITY_MATRIX3","identity","setAxisAngle","axis","ax","ay","az","aw","bx","by","bz","bw","rotateX","rotateY","rotateZ","calculateW","slerp","t","cosom","omega","scale0","scale1","sinom","glMatrix.EPSILON","a0","a1","a2","a3","dot","invDot","conjugate","fromMat3","fTrace","fRoot","j","k","add","vec4.add","vec4.scale","vec4.dot","lerp","vec4.lerp","vec4.length","squaredLength","vec4.squaredLength","normalize","vec4.normalize","rotationTo","tmpvec3","vec3.create","xUnitVec3","vec3.fromValues","yUnitVec3","vec3.dot","vec3.cross","vec3.len","vec3.normalize","temp1","temp2","d","matr","mat3.create","view","right","up","IDENTITY_QUATERNION","Quaternion","MathArray","quat_fromMat3","quat_setAxisAngle","quat_identity","quat_length","quat_squaredLength","quat_dot","vectorA","vectorB","quat_rotationTo","quat_add","quat_calculateW","quat_conjugate","quat_invert","quat_lerp","quat_multiply","l","quat_rotateX","quat_rotateY","quat_rotateZ","quat_scale","arg0","arg1","arg2","start","ratio","quat_slerp","vs","fs","uniformBlock","pbrProjection","props","pbrMaterial","lighting","ScenegraphNode","Matrix4","Vector3","uid","position","rotation","matrix","copyMatrix","components","update","pos","rot","viewMatrix","modelMatrix","worldMatrix","worldInverse","worldInverseTranspose","GroupNode","children","log","child","node","bounds","min","max","center","halfSize","indexOf","visitor","ModelNode","resource","renderPass","RADIAN_PER_DEGREE","valueArray","calculateTransformMatrix","targetMatrix","orientation","pitch","yaw","roll","sr","sp","sw","cr","cp","cw","scx","scy","scz","getExtendedMat3FromMat4","mat4","MATRIX_ATTRIBUTES","startRow","endRow","getOrientation","getScale","getTranslation","getTransformMatrix","arrayMatrix","constantMatrix","constantScale","constantOrientation","constantTranslation","hasMatrix","instanceModelMatrixData","iterable","objectInfo","createIterable","shouldComposeModelMatrix","viewport","coordinateSystem","COORDINATE_SYSTEM","simpleMeshUniforms","vs$2","fs$2","normalizeGeometryAttributes","positionAttribute","vertexCount","colorAttribute","normalAttribute","texCoordAttribute","getGeometry","Geometry","DEFAULT_COLOR","defaultProps","SimpleMeshLayer","Layer","project32","phongMaterial","picking","mesh","params","oldProps","changeFlags","Texture","uniforms","model","sizeScale","_instanced","simpleMeshProps","Model","texture","emptyTexture","BASIS_EXTERNAL_LIBRARIES","loadBasisTranscoderPromise","loadBasisTranscoderModule","basis","loadBasisTranscoder","BASIS","wasmBinary","initializeBasisTranscoderModule","BasisModule","resolve","module","BasisFile","initializeBasis","loadBasisEncoderPromise","loadBasisEncoderModule","loadBasisEncoder","BASIS_ENCODER","initializeBasisEncoderModule","BasisEncoderModule","KTX2File","BasisEncoder","GL_EXTENSIONS_CONSTANTS","BROWSER_PREFIXES","WEBGL_EXTENSIONS","formats","getSupportedGPUTextureFormats","gl","getWebGLContext","prefix","extension","gpuTextureFormat","KTX2_ID","isKTX","OutputFormat","parseBasis","fileConstructors","parseKTX2File","parseBasisFile","basisFile","imageCount","images","imageIndex","levelsCount","levels","levelIndex","transcodeImage","width","height","hasAlpha","compressed","format","basisFormat","getBasisOptions","decodedSize","decodedData","ktx2File","transcodeKTX2Image","alphaFlag","selectSupportedBasisFormat","supportedFormats","BasisWorkerLoader","BasisLoader","convertSampler","gltfSampler","convertSamplerWrapMode","convertSamplerMagFilter","convertSamplerMinFilter","mode","parsePBRMaterial","device","material","parsedMaterial","imageBasedLightingEnvironment","parseMaterial","parsePbrMetallicRoughness","addTexture","strength","alphaCutoff","pbrMetallicRoughness","metallicFactor","roughnessFactor","gltfTexture","uniformName","define","image","textureOptions","GLEnum","convertGLDrawModeToTopology","drawMode","SHADER","createGLTFModel","geometry","parsedPPBRMaterial","modelOptions","managedResources","parameters","modelProps","camera","pbrMaterialProps","defaultOptions","parseGLTF","gltf","options_","gltfScene","createScene","gltfNodes","nodes","createNode","gltfNode","createMesh","rotationMatrix","topLevelNode","gltfMesh","primitives","gltfPrimitive","createPrimitive","topology","getVertexCount","createGeometry","modelNode","attributeName","size","scratchQuaternion","interpolate","time","input","interpolation","output","path","maxTime","animationTime","nextIndex","previousIndex","previousTime","nextTime","stepInterpolate","linearInterpolate","tDiff","p0","outTangent0","inTangent1","p1","cubicsplineInterpolate","stop","m0","m1","GLTFSingleAnimator","timeMs","sampler","applyTranslationRotationScale","GLTFAnimator","animation","index","scratchMatrix","ATTRIBUTE_TYPE_TO_COMPONENTS","ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY","accessorToTypedArray","accessor","ArrayType","buffer","parseGLTFAnimations","samplers","accessorToJsArray","channels","slicedArray","deepCopy","key","createScenegraphsFromGLTF","scenes","animations","animator","condition","message","COMPONENTS","BYTES","MIPMAP_FACTOR","TYPES","ARRAY_CONSTRUCTOR_TO_WEBGL_CONSTANT","ARRAY_TO_COMPONENT_TYPE","ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE","getAccessorTypeFromSize","getComponentTypeFromArray","typedArray","componentType","getAccessorArrayTypeAndLength","bufferView","bytesPerComponent","componentByteSize","numberOfComponentsInElement","getMemoryUsageGLTF","bufferViews","imageBufferViews","bufferMemory","acc","pixelCount","getTypedArrayForBufferView","json","buffers","bufferViewIndex","bufferIndex","binChunk","getTypedArrayForAccessor","gltfAccessor","bufferByteOffset","elementByteSize","elementAddressScale","values","makeDefaultGLTFJson","GLTFScenegraph","extensionName","isUsedExtension","isRequiredExtension","isExtension","extensions","_getTypedArrayForAccessor","extensionsRemoved","extensionData","ext","sceneIndex","scene","nodeIndices","meshIndex","nodeData","indices","glTFMesh","indicesAccessor","imageData","mimeTypeOpt","getBinaryImageMetadata","glTFImage","glTFBufferView","glTFAccessor","sourceBuffer","minMax","accessorDefaults","glTFTexture","pbrMaterialInfo","totalByteLength","targetArray","dstByteOffset","found","attributeKey","attributeData","attrName","initValues","componentIndex","emod","n","getArrayElementByteSize","attributeType","getOffsetsForProperty","scenegraph","offsetType","numberOfElements","arrayOffsetsBytes","arrayOffsets","convertRawBufferToMetadataArray","elementCount","numberOfComponents","offset","getPrimitiveTextureData","textureInfo","primitive","texCoordAccessorKey","texCoordAccessorIndex","textureCoordinates","textureIndex","parsedImage","textureData","getImageValueByCoordinates","primitivePropertyDataToAttributes","propertyData","featureTable","featureIndices","texelData","item","accessorIndex","CHANNELS_MAP","u","coordinatesToOffset","map","imageOffset","getImageData","imageValue","componentsCount","iX","indX","h","iY","indY","parseVariableLengthArrayNumeric","valuesData","valuesDataBytesLength","valueSize","attributeValueArray","arrayOffset","arrayByteSize","typedArrayOffset","parseFixedLengthArrayNumeric","arrayCount","elementOffset","getPropertyDataString","valuesDataBytes","stringOffsets","stringsArray","textDecoder","stringOffset","stringByteSize","stringData","stringAttribute","EXT_MESH_FEATURES_NAME","decode","gltfData","decodeExtMeshFeatures","encode","encodeExtMeshFeatures","processMeshPrimitiveFeatures","featureIds","featureId","featureIdData","accessorKey","meshes","encodeExtMeshFeaturesForPrimitive","createExtMeshFeatures","featureIdArray","propertyTableIndex","elementIndex","createAccessorKey","attrs","EXT_STRUCTURAL_METADATA_NAME","decodeExtStructuralMetadata","encodeExtStructuralMetadata","decodePropertyTextures","decodePropertyTables","propertyTextures","processPrimitivePropertyTextures","schema","schemaClasses","propertyTables","schemaName","propertyTable","findPropertyTableByClass","processPropertyTable","schemaClassName","primitivePropertyTextureIndices","primitivePropertyTextureIndex","propertyTexture","processPrimitivePropertyTexture","className","propertyName","textureInfoTopLevel","featureTextureTable","schemaClass","classProperty","propertyTableProperty","getPropertyDataFromBinarySource","valuesBufferView","getArrayOffsetsForProperty","getStringOffsetsForProperty","getPropertyDataNumeric","getPropertyDataENUM","elementSize","enumType","enumEntry","enumValueType","parseVariableLengthArrayENUM","parseFixedLengthArrayENUM","getEnumsArray","count","enumObject","getEnumByValue","enumValue","SCHEMA_CLASS_ID_DEFAULT","table","classId","encodeProperties","tableProperty","createPropertyTableProperty","createExtStructuralMetadata","propertyAttributes","createSchema","createPropertyTable","schemaToUpdate","prop","createPropertyDataString","createBufferView","createPropertyDataScalar","COMPONENT_TYPE_TO_ARRAY_CONSTRUCTOR","numberArray","Construct","strings","utf8Encode","arr","str","uint8Array","strArray","strOffsets","stringOffsetsTypedArray","EXT_FEATURE_METADATA_NAME","decodeExtFeatureMetadata","featureTextures","featureTexture","findFeatureTextureByClass","handleFeatureTextureProperties","propertyTableName","featureTexturesName","featureTextureProperty","getPropertyDataFromTexture","numberOfFeatures","featureTableProperty","dataArray","isNumericProperty","schemaProperty","types","processPrimitiveTextures","LITTLE_ENDIAN","MAGIC_glTF","GLB_FILE_HEADER_SIZE","GLB_CHUNK_HEADER_SIZE","GLB_CHUNK_TYPE_JSON","GLB_CHUNK_TYPE_BIN","GLB_V1_CONTENT_FORMAT_JSON","GLB_CHUNK_TYPE_JSON_XVIZ_DEPRECATED","GLB_CHUNK_TYPE_BIX_XVIZ_DEPRECATED","isGLB","magic1","parseGLBSync","glb","version","parseGLBV1","parseGLBV2","contentLength","contentFormat","parseJSONChunk","parseBINChunk","parseGLBChunksSync","chunkLength","chunkFormat","jsonChunk","jsonText","resolveUrl","baseUrl","wasm_base","wasm_simd","detector","wasmpack","FILTERS","DECODERS","meshoptDecodeGltfBuffer","filter","instance","loadWasmInstance","wasmPromise","loadWasmModule","wasm","unpack","ch","write","fun","sbrk","count4","tp","heap","res","EXT_MESHOPT_COMPRESSION","promises","decodeMeshoptBufferView","meshoptExtension","byteStride","EXT_TEXTURE_WEBP","preprocess","KHR_TEXTURE_BASISU","DracoLoader","getDracoSchema","loaderData","makeMetadata","fields","namedLoaderDataAttributes","transformAttributesLoaderData","field","getArrowFieldFromAttribute","indicesField","dracoAttribute","metadataMap","serializedMetadata","DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP","DRACO_DATA_TYPE_TO_TYPED_ARRAY_MAP","INDEX_ITEM_SIZE","DracoParser","draco","geometry_type","dracoGeometry","dracoStatus","boundingBox","dracoAttributes","attributeId","quantization","octahedron","loaderAttribute","numIndices","ptr","dracoArray","getUint32Array","TypedArrayCtor","numComponents","numValues","dataType","getDracoDataType","uniqueId","attributeUniqueId","thisAttributeType","dracoAttributeConstant","entryName","dracoMetadata","numEntries","entryIndex","intArray","getInt32Array","quantizedAttributes","octahedronAttributes","skipAttributes","dracoAttributeName","attribute_type","transform","DRACO_DECODER_VERSION","DRACO_ENCODER_VERSION","STATIC_DECODER_URL","DRACO_EXTERNAL_LIBRARIES","DRACO_EXTERNAL_LIBRARY_URLS","loadDecoderPromise","loadDracoDecoderModule","loadDracoDecoder","DracoDecoderModule","initializeDracoDecoder","DracoWorkerLoader","parse","dracoParser","getGLTFAccessors","accessors","getGLTFAccessor","getAccessorData","toTypedArray","convertTypedArrays","KHR_DRACO_MESH_COMPRESSION","makeMeshPrimitiveIterator","decompressPrimitive","compressMesh","dracoExtension","bufferCopy","sliceArrayBuffer","dracoOptions","decodedAttributes","decodedAttribute","checkPrimitive","compressedData","fauxAccessors","KHR_TEXTURE_TRANSFORM","scratchVector","scratchRotationMatrix","scratchScaleMatrix","materials","transformTexCoords","materialIndex","materialTextures","processedTexCoords","transformPrimitives","transformParameters","getTransformParameters","transformPrimitive","originalTexCoord","texCoord","original","newTexCoord","makeTransformationMatrix","texCoordAccessor","bytes","uv","updateGltf","createAttribute","newTexCoordArray","originalAccessor","translationMatrix","scaleMatrix","KHR_LIGHTS_PUNCTUAL","gltfScenegraph","nodeExtension","light","KHR_MATERIALS_UNLIT","KHR_TECHNIQUES_WEBGL","techniques","resolveTechniques","materialExtension","resolveValues","techniquesExtension","programs","shaders","shader","program","technique","uniform","EXTENSIONS","EXT_structural_metadata","EXT_mesh_features","EXT_meshopt_compression","EXT_texture_webp","KHR_texture_basisu","KHR_draco_mesh_compression","KHR_lights_punctual","KHR_materials_unlit","KHR_techniques_webgl","KHR_texture_transform","EXT_feature_metadata","preprocessExtensions","useExtension","decodeExtensions","excludes","KHR_BINARY_GLTF","GLTF_ARRAYS","GLTF_KEYS","GLTFV1Normalizer","KHR_binary_glTF.preprocess","arrayName","mapName","objectMap","topLevelArrayName","textureId","normalizeGLTFV1","arrayBufferOrString","parseGLTFContainerSync","loadBuffers","loadImages","binChunks","fetch","uri","imageIndices","getReferencesImageIndices","loadImage","textures","ImageLoader","GLTFLoader","GL_SAMPLER","SAMPLER_PARAMETER_GLTF_TO_GL","DEFAULT_SAMPLER_PARAMETERS","makeDefaultSampler","getBytesFromComponentType","getSizeFromAccessorType","GLTFPostProcessor","baseUri","bufView","skin","accum","gltfSkin","inverseBindMatrices","gltfMaterial","mr","bytesPerElement","cutBuffer","glEnum","gltfImage","preloadedImage","gltfBufferView","gltfCamera","postProcessGLTF","waitForGLTFAssets","gltfObjects","remaining","waitWhileCondition","scenegraphUniforms","ScenegraphLayer","defines","pbr","scenegraphData","processedGLTF","ex","models","animationsProp","number","findResult","_imageBasedLightingEnvironment","env","sizeMinPixels","sizeMaxPixels","pbrProjectionProps","numInstances","scenegraphProps"],"mappings":"irBAWO,eAAeA,GAAiBC,EAAMC,EAASC,EAASC,EAAS,CACpE,OAAOA,EAAQ,OAAOH,EAAMC,EAASC,EAASC,CAAO,CACzD,CCLO,SAASC,GAAkBC,EAAS,CACvC,WAAW,UAAY,CAAA,EACvB,WAAW,QAAQ,UAAY,CAAA,EAC/B,OAAO,OAAO,WAAW,QAAQ,QAASA,CAAO,CACrD,CAuBO,SAASC,GAAkBC,EAAM,CAEpC,OADe,WAAW,SAAS,UAAUA,CAAI,GAChC,IACrB,CC/BA,MAAMC,GAAsB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AM,EAGzEC,EAAMD,GAGP,CACH,8BAA+BC,EAC/B,aAAc,CACV,GAAI,KAAK,MAAM,GACf,YAAa,GACb,aAAc,KAAK,oBAAmB,EAAG,iBAAgB,EACzD,GAAG,KAAK,WAAU,CAClC,EAEY,YAAa,EACzB,CACI,CACA,KAAK,CAAE,QAAAtiC,GAAW,CACd,GAAI,CAAC,KAAK,MAAM,WACZ,OACA,KAAK,MAAM,aAAe,KAAK,MAAM,WACrC,KAAK,MAAM,SAAS,QAAQA,EAAQ,SAAS,SAAS,EACtD,KAAK,eAAc,GAEvB,KAAM,CAAE,SAAA6V,EAAU,WAAAtC,CAAU,EAAK,KAAK,QAChC,CAAE,UAAAkE,EAAW,cAAA8qB,EAAe,cAAAC,EAAe,iBAAA1sB,CAAgB,EAAK,KAAK,MACrE2sB,EAAqB,CACvB,OAAQ5sB,EAAS,cAC7B,EACc6sB,EAAe,KAAK,gBAAe,EACzC,KAAK,MAAM,WAAW,SAAS,CAAC7vB,EAAM,CAAE,YAAAP,KAAkB,CACtD,GAAIO,aAAgBQ,GAAW,CAC3B,KAAM,CAAE,MAAAmE,CAAK,EAAK3E,EAClB2E,EAAM,iBAAiBkrB,CAAY,EACnC,MAAMC,EAAkB,CACpB,UAAAlrB,EACA,cAAA8qB,EACA,cAAAC,EACA,mBAAoB5sB,GAAyBC,EAAUC,CAAgB,EACvE,iBAAkBxD,CACtC,EACgBkF,EAAM,aAAa,SAAS,CACxB,cAAeirB,EACf,WAAYE,CAChC,CAAiB,EACDnrB,EAAM,KAAKjE,CAAU,CACzB,CACJ,CAAC,CACL,CACJ,CACAouB,GAAgB,aAAe/qB,GAC/B+qB,GAAgB,UAAY","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83]}
|