@arcgis/core 4.23.0-next.20220105 → 4.23.0-next.20220123
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/components/assets/calcite-date-picker/nls/bg.json +31 -0
- package/assets/components/assets/calcite-icon/centerAlign16.json +1 -0
- package/assets/components/assets/calcite-icon/centerAlign24.json +1 -0
- package/assets/components/assets/calcite-icon/centerAlign32.json +1 -0
- package/assets/components/assets/calcite-icon/checkSquareF16.json +1 -0
- package/assets/components/assets/calcite-icon/checkSquareF24.json +1 -0
- package/assets/components/assets/calcite-icon/checkSquareF32.json +1 -0
- package/assets/components/assets/calcite-icon/convert16.json +1 -0
- package/assets/components/assets/calcite-icon/convert24.json +1 -0
- package/assets/components/assets/calcite-icon/convert32.json +1 -0
- package/assets/components/assets/calcite-icon/explore16.json +1 -0
- package/assets/components/assets/calcite-icon/explore24.json +1 -0
- package/assets/components/assets/calcite-icon/explore32.json +1 -0
- package/assets/components/assets/calcite-icon/formDropdown16.json +1 -0
- package/assets/components/assets/calcite-icon/formDropdown24.json +1 -0
- package/assets/components/assets/calcite-icon/formDropdown32.json +1 -0
- package/assets/components/assets/calcite-icon/language16.json +1 -0
- package/assets/components/assets/calcite-icon/language24.json +1 -0
- package/assets/components/assets/calcite-icon/language32.json +1 -0
- package/assets/components/assets/calcite-icon/languageTranslate16.json +1 -0
- package/assets/components/assets/calcite-icon/languageTranslate24.json +1 -0
- package/assets/components/assets/calcite-icon/languageTranslate32.json +1 -0
- package/assets/components/assets/calcite-icon/leftAlign16.json +1 -0
- package/assets/components/assets/calcite-icon/leftAlign24.json +1 -0
- package/assets/components/assets/calcite-icon/leftAlign32.json +1 -0
- package/assets/components/assets/calcite-icon/lineSolid4.json +1 -0
- package/assets/components/assets/calcite-icon/partlyCloudy16.json +1 -0
- package/assets/components/assets/calcite-icon/partlyCloudy24.json +1 -0
- package/assets/components/assets/calcite-icon/partlyCloudy32.json +1 -0
- package/assets/components/assets/calcite-icon/rightAlign16.json +1 -0
- package/assets/components/assets/calcite-icon/rightAlign24.json +1 -0
- package/assets/components/assets/calcite-icon/rightAlign32.json +1 -0
- package/assets/components/assets/calcite-icon/screenshotMode16.json +1 -0
- package/assets/components/assets/calcite-icon/screenshotMode24.json +1 -0
- package/assets/components/assets/calcite-icon/screenshotMode32.json +1 -0
- package/assets/components/assets/calcite-icon/squareF16.json +1 -0
- package/assets/components/assets/calcite-icon/squareF24.json +1 -0
- package/assets/components/assets/calcite-icon/squareF32.json +1 -0
- package/assets/components/assets/calcite-icon/terminal16.json +1 -0
- package/assets/components/assets/calcite-icon/terminal24.json +1 -0
- package/assets/components/assets/calcite-icon/terminal32.json +1 -0
- package/assets/components/assets/calcite-icon/touch16.json +1 -0
- package/assets/components/assets/calcite-icon/touch24.json +1 -0
- package/assets/components/assets/calcite-icon/touch32.json +1 -0
- package/assets/components/assets/calcite-icon/xHexagon16.json +1 -0
- package/assets/components/assets/calcite-icon/xHexagon24.json +1 -0
- package/assets/components/assets/calcite-icon/xHexagon32.json +1 -0
- package/assets/components/assets/calcite-icon/xHexagonF16.json +1 -0
- package/assets/components/assets/calcite-icon/xHexagonF24.json +1 -0
- package/assets/components/assets/calcite-icon/xHexagonF32.json +1 -0
- package/assets/components/assets/calcite-icon/xOctagonF16.json +1 -0
- package/assets/components/assets/calcite-icon/xOctagonF24.json +1 -0
- package/assets/components/assets/calcite-icon/xOctagonF32.json +1 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/09da224052976e290828.js +1 -0
- package/assets/esri/core/workers/chunks/0bf079e752ab79468478.js +1 -0
- package/assets/esri/core/workers/chunks/{ce5ca5e95b2378ec55b9.js → 1305ef8717da6e902a55.js} +1 -1
- package/assets/esri/core/workers/chunks/199670a3a564ebe3bd79.js +1 -0
- package/assets/esri/core/workers/chunks/1e4d37c2b9dc83d20a11.js +1 -0
- package/assets/esri/core/workers/chunks/20411bb8e04703962ce6.js +1 -0
- package/assets/esri/core/workers/chunks/2416f8bf8bbd2ec786ab.js +1 -0
- package/assets/esri/core/workers/chunks/25a3e9bc0b4c7e0d3165.js +1 -0
- package/assets/esri/core/workers/chunks/{99f0d896c17dd09cd285.js → 2629adf79e7fd9f25f07.js} +1 -1
- package/assets/esri/core/workers/chunks/{9c417740bf3707a0d465.js → 2c607d30ff8ca1b61286.js} +1 -1
- package/assets/esri/core/workers/chunks/2e445a8735ea2adb641a.js +1 -0
- package/assets/esri/core/workers/chunks/37a7bd30352b1309b8f8.js +1 -0
- package/assets/esri/core/workers/chunks/390d9021169e65c10eb8.js +1 -0
- package/assets/esri/core/workers/chunks/{3d5169ea9810d10caf0d.js → 3a9740dccda6a733313c.js} +1 -1
- package/assets/esri/core/workers/chunks/{8a250ec51097f16feb66.js → 40a1e713f63ec77110c0.js} +1 -1
- package/assets/esri/core/workers/chunks/43cdff2418325e163420.js +1 -0
- package/assets/esri/core/workers/chunks/4c9084a04948b6924749.js +1 -0
- package/assets/esri/core/workers/chunks/{35961690afe9ea1f91b0.js → 5383a8f3e4ec1a8a4fcd.js} +1 -1
- package/assets/esri/core/workers/chunks/{4beba242e7540ee3182b.js → 5538639a49c7cc2eca63.js} +1 -1
- package/assets/esri/core/workers/chunks/57c67e260267a1dbc5e3.js +1 -0
- package/assets/esri/core/workers/chunks/5a4a5585ec8027079f32.js +1 -0
- package/assets/esri/core/workers/chunks/5ac4c1d54b94c7d87835.js +1 -0
- package/assets/esri/core/workers/chunks/60371c0f750cde87656d.js +1 -0
- package/assets/esri/core/workers/chunks/{ba6fdaed6c315dc13981.js → 625d2663daa8e0cf64b0.js} +1 -1
- package/assets/esri/core/workers/chunks/{3a2b2dc3e938d53faa30.js → 64276aacaafa4c8a15bd.js} +1 -1
- package/assets/esri/core/workers/chunks/{75466e0c8c8da499b150.js → 662d13f68cf3ec92439b.js} +1 -1
- package/assets/esri/core/workers/chunks/663ad15b86936eb06b69.js +1 -0
- package/assets/esri/core/workers/chunks/67162b3e2cc1b5dc6818.js +1 -0
- package/assets/esri/core/workers/chunks/68a59ce98177d8513337.js +1 -0
- package/assets/esri/core/workers/chunks/6cdfe175c965918b741b.js +1 -0
- package/assets/esri/core/workers/chunks/739e579150bf466d43ae.js +1 -0
- package/assets/esri/core/workers/chunks/74df1f3e1e2e524a89d2.js +1 -0
- package/assets/esri/core/workers/chunks/76eef4799f6c5fff7e2d.js +1 -0
- package/assets/esri/core/workers/chunks/{ea05f870dda27bca4fe8.js → 7a8764ae8a0041e1151d.js} +2 -2
- package/assets/esri/core/workers/chunks/{ea05f870dda27bca4fe8.js.LICENSE.txt → 7a8764ae8a0041e1151d.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/7baf6b1f3f050aa67ae4.js +1 -0
- package/assets/esri/core/workers/chunks/{f52b6d5037e4205b035c.js → 7bc5cc5dbf1b7b70ddac.js} +1 -1
- package/assets/esri/core/workers/chunks/85e27fd949475f9a6bbc.js +1 -0
- package/assets/esri/core/workers/chunks/8967288145f8fbd20e7d.js +1 -0
- package/assets/esri/core/workers/chunks/8cbb04a9065aa3756638.js +1 -0
- package/assets/esri/core/workers/chunks/8fa0a14165d43ffe87a5.js +1 -0
- package/assets/esri/core/workers/chunks/94b8dbf859df71858d1c.js +1 -0
- package/assets/esri/core/workers/chunks/96ab518eb6ba11333dee.js +1 -0
- package/assets/esri/core/workers/chunks/99a777693e4539f0b03b.js +1 -0
- package/assets/esri/core/workers/chunks/9cb2ae42a8e328b1d98d.js +1 -0
- package/assets/esri/core/workers/chunks/9d3c58a0ef634d95b7bd.js +1 -0
- package/assets/esri/core/workers/chunks/9d77467aa71d345fc1b6.js +1 -0
- package/assets/esri/core/workers/chunks/9f8b7b6b4e95f9a794fc.js +1 -0
- package/assets/esri/core/workers/chunks/a78757b9c7e8cbea08fa.js +1 -0
- package/assets/esri/core/workers/chunks/{9b7c51ff3d2b42aa62f5.js → a7b1b75643ed31489495.js} +1 -1
- package/assets/esri/core/workers/chunks/a8b13fb804bb775e4967.js +1 -0
- package/assets/esri/core/workers/chunks/a8c13529367c037cdd94.js +1 -0
- package/assets/esri/core/workers/chunks/a96afc176041f698c7a1.js +1 -0
- package/assets/esri/core/workers/chunks/aa861b8eae6c85f3dad4.js +1 -0
- package/assets/esri/core/workers/chunks/ac8dca61ade28c542ae2.js +1 -0
- package/assets/esri/core/workers/chunks/ad081d8e49e7f90c3c26.js +1 -0
- package/assets/esri/core/workers/chunks/afa6912454f2a5ffadce.js +1 -0
- package/assets/esri/core/workers/chunks/b0b036ad3ad3cd956747.js +1 -0
- package/assets/esri/core/workers/chunks/{2a39d520b192b8e552b5.js → b2ae5fc4f787ea568b88.js} +1 -1
- package/assets/esri/core/workers/chunks/b2beb6e1fd2ee6503830.js +1 -0
- package/assets/esri/core/workers/chunks/{b87bc1481a49b38109f4.js → b9c177524b3e7de1ffd1.js} +1 -1
- package/assets/esri/core/workers/chunks/ba615f118a3a8970ef25.js +1 -0
- package/assets/esri/core/workers/chunks/{7c1b9ae141112a63b446.js → ba6654a885be4b7a43f0.js} +1 -1
- package/assets/esri/core/workers/chunks/bab1cfd0a901181622af.js +1 -0
- package/assets/esri/core/workers/chunks/be2b7cce79fd41627931.js +1 -0
- package/assets/esri/core/workers/chunks/bf6dda4a2af14c4b7716.js +1 -0
- package/assets/esri/core/workers/chunks/{ed0297fc61014e848c18.js → c080114a69fa95b88d22.js} +1 -1
- package/assets/esri/core/workers/chunks/c13dfdd548dcb1bdb294.js +1 -0
- package/assets/esri/core/workers/chunks/c36f84daa7736878418d.js +1 -0
- package/assets/esri/core/workers/chunks/c6f94b92e866b881d9b9.js +1 -0
- package/assets/esri/core/workers/chunks/{573dc3064e84ca86844d.js → c959e0d1cf7dce0421b9.js} +1 -1
- package/assets/esri/core/workers/chunks/{1fd48459afb58a6cf14f.js → ca2f5faa01d99c21ec14.js} +1 -1
- package/assets/esri/core/workers/chunks/cbb291412fd1a5261aa9.js +1 -0
- package/assets/esri/core/workers/chunks/{7aa543a97f055cddea99.js → cc146c57bbdac8029fd8.js} +1 -1
- package/assets/esri/core/workers/chunks/cd7d83d127e085d52584.js +1 -0
- package/assets/esri/core/workers/chunks/cef4af64860ebbfc1c47.js +1 -0
- package/assets/esri/core/workers/chunks/d1454155ee1b8a421cbb.js +1 -0
- package/assets/esri/core/workers/chunks/{0cd583c3233573cb8468.js → d24c4fbc567486b1188f.js} +1 -1
- package/assets/esri/core/workers/chunks/d52108864136c5a8a618.js +1 -0
- package/assets/esri/core/workers/chunks/d72488db62fcf39447b6.js +1 -0
- package/assets/esri/core/workers/chunks/de03439ca2c9782bf325.js +1 -0
- package/assets/esri/core/workers/chunks/de6cff7b6cbbf99b20d1.js +981 -0
- package/assets/esri/core/workers/chunks/e079cb1d53aca15b7df2.js +1 -0
- package/assets/esri/core/workers/chunks/e59764ee8cf25d4f74e2.js +1 -0
- package/assets/esri/core/workers/chunks/e6df9839b551569fbc62.js +1 -0
- package/assets/esri/core/workers/chunks/e97e986120aaadad7d4c.js +1 -0
- package/assets/esri/core/workers/chunks/{2f66fcb8670b108af549.js → ed0bcc66fb1e0ee75a4b.js} +1 -1
- package/assets/esri/core/workers/chunks/f8e7755240a94b499e1f.js +1 -0
- package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
- package/assets/esri/themes/base/icons/fonts/CalciteWebCoreIcons.svg +1 -0
- package/assets/esri/themes/base/icons/fonts/CalciteWebCoreIcons.ttf +0 -0
- package/assets/esri/themes/base/icons/fonts/CalciteWebCoreIcons.woff +0 -0
- package/assets/esri/themes/base/icons/selection.json +1 -1
- package/assets/esri/themes/base/icons/style.css +4 -0
- package/assets/esri/themes/base/icons/style.scss +6 -0
- package/assets/esri/themes/base/icons/variables.scss +1 -0
- package/assets/esri/themes/base/widgets/_Weather.scss +1 -1
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/dark-blue/main.css +1 -1
- package/assets/esri/themes/dark-green/main.css +1 -1
- package/assets/esri/themes/dark-purple/main.css +1 -1
- package/assets/esri/themes/dark-red/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/themes/light-blue/main.css +1 -1
- package/assets/esri/themes/light-green/main.css +1 -1
- package/assets/esri/themes/light-purple/main.css +1 -1
- package/assets/esri/themes/light-red/main.css +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_ar.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_bg.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_bs.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_ca.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_cs.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_da.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_de.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_el.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_es.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_et.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_fi.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_fr.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_he.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_hr.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_hu.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_id.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_it.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_ja.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_ko.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_lt.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_lv.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_nb.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_nl.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_pl.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_pt-BR.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_pt-PT.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_ro.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_ru.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_sk.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_sl.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_sr.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_sv.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_th.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_tr.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_uk.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_vi.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_zh-CN.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_zh-HK.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_zh-TW.json +1 -1
- package/assets/esri/widgets/ElevationProfile/t9n/ElevationProfile_ja.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_ar.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_bg.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_bs.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_ca.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_cs.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_da.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_de.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_el.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_es.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_et.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_fi.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_fr.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_he.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_hr.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_hu.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_id.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_it.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_ja.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_ko.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_lt.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_lv.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_nb.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_nl.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_pl.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_pt-BR.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_pt-PT.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_ro.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_ru.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_sk.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_sl.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_sr.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_sv.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_th.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_tr.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_uk.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_vi.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_zh-CN.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_zh-HK.json +1 -1
- package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_zh-TW.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_cs.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_el.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_fr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_lv.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_ar.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_bg.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_bs.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_ca.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_cs.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_da.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_de.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_el.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_es.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_et.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_fi.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_fr.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_he.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_hr.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_hu.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_id.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_it.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_ja.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_ko.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_lt.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_lv.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_nb.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_nl.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_pl.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_pt-BR.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_pt-PT.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_ro.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_ru.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_sk.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_sl.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_sr.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_sv.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_th.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_tr.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_uk.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_vi.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_zh-CN.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_zh-HK.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_zh-TW.json +1 -1
- package/chunks/Clouds.glsl.js +14 -14
- package/chunks/CloudsComposition.glsl.js +4 -4
- package/chunks/DefaultMaterial.glsl.js +2 -2
- package/chunks/HUDMaterial.glsl.js +22 -21
- package/chunks/RibbonLine.glsl.js +10 -14
- package/chunks/persistableUrlUtils.js +1 -1
- package/chunks/vec32.js +1 -1
- package/chunks/vec42.js +1 -1
- package/chunks/vxlLayer.js +1 -1
- package/core/has.js +1 -1
- package/core/urlUtils.js +1 -1
- package/core/workers/workerFactory.js +1 -1
- package/form/elements/FieldElement.js +1 -1
- package/geometry/support/buffer/math/common.js +1 -1
- package/geometry/support/heightModelInfoUtils.js +1 -1
- package/interfaces.d.ts +372 -126
- package/layers/FeatureLayer.js +1 -1
- package/layers/RouteLayer.js +1 -1
- package/layers/SubtypeGroupLayer.js +1 -1
- package/layers/VectorTileLayer.js +1 -1
- package/layers/VoxelLayer.js +1 -1
- package/layers/VoxelWasmPerScene.js +1 -1
- package/layers/WMSLayer.js +1 -1
- package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
- package/layers/graphics/data/QueryEngineCapabilities.js +1 -1
- package/layers/graphics/sources/OGCFeatureSource.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/mixins/OperationalLayer.js +1 -1
- package/layers/ogc/crsUtils.js +5 -0
- package/layers/support/RasterFunction.js +1 -1
- package/layers/support/RasterWorker.js +1 -1
- package/layers/support/capabilities.js +1 -1
- package/layers/support/rasterDatasets/BaseRaster.js +1 -1
- package/layers/support/rasterDatasets/WCSRaster.js +1 -1
- package/layers/support/rasterDatasets/wcsCoverageParser.js +1 -1
- package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
- package/layers/support/vectorTileLayerLoader.js +1 -1
- package/layers/support/wmsUtils.js +1 -1
- package/layers/support/wmtsUtils.js +1 -1
- package/libs/vxl/enums.js +1 -1
- package/package.json +5 -5
- package/portal/schemas/buildingSceneLayerItem.js +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/portal/schemas/integratedMeshLayerItem.js +1 -1
- package/portal/schemas/pointCloudLayerItem.js +1 -1
- package/portal/schemas/sceneLayerItem.js +1 -1
- package/portal/schemas/webScene.js +1 -1
- package/rasterRenderers.js +1 -1
- package/renderers/support/RasterSymbolizer.js +1 -1
- package/request.js +1 -1
- package/rest/find.js +1 -1
- package/rest/geometryService/generalize.js +1 -1
- package/rest/geometryService/lengths.js +1 -1
- package/rest/geometryService/offset.js +1 -1
- package/rest/geometryService/relation.js +1 -1
- package/rest/geometryService/trimExtend.js +1 -1
- package/rest/identify.js +1 -1
- package/{tasks → rest}/operations/find.js +0 -0
- package/{tasks → rest}/operations/generalize.js +0 -0
- package/rest/operations/identify.js +5 -0
- package/{tasks → rest}/operations/lengths.js +0 -0
- package/{tasks → rest}/operations/offset.js +0 -0
- package/{tasks → rest}/operations/relation.js +0 -0
- package/{tasks → rest}/operations/trimExtend.js +0 -0
- package/{tasks → rest}/operations/urlUtils.js +0 -0
- package/rest/print.js +1 -1
- package/rest/query/operations/query.js +1 -1
- package/rest/query/operations/queryAttachments.js +1 -1
- package/rest/query/operations/queryRelatedRecords.js +1 -1
- package/rest/query/operations/queryTopFeatures.js +1 -1
- package/rest/route/utils.js +1 -1
- package/rest/support/ImageIdentifyParameters.js +1 -1
- package/rest/support/NetworkServiceDescription.js +1 -1
- package/rest/support/RouteInfo.js +1 -1
- package/rest/support/RouteParameters.js +1 -1
- package/rest/support/RouteSettings.js +5 -0
- package/rest/support/StatisticDefinition.js +1 -1
- package/rest/support/Stop.js +1 -1
- package/rest/support/networkEnums.js +1 -1
- package/smartMapping/renderers/univariateColorSize.js +1 -1
- package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
- package/support/featureFlags.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/ExtrudeSymbol3DLayer.js +1 -1
- package/symbols/Font.js +1 -1
- package/symbols/IconSymbol3DLayer.js +1 -1
- package/symbols/ObjectSymbol3DLayer.js +1 -1
- package/symbols/PathSymbol3DLayer.js +1 -1
- package/symbols/TextSymbol.js +1 -1
- package/symbols/TextSymbol3DLayer.js +1 -1
- package/symbols/cim/placements/PlacementAlongLineSameSize.js +1 -1
- package/symbols/support/Symbol3DHalo.js +1 -1
- package/symbols/support/Symbol3DMaterial.js +1 -1
- package/symbols/support/cimSymbolUtils.js +1 -1
- package/symbols/support/textUtils.js +5 -0
- package/symbols/support/utils.js +1 -1
- package/views/2d/engine/Stage.js +1 -1
- package/views/2d/engine/vectorTiles/TileHandler.js +1 -1
- package/views/2d/engine/vectorTiles/shaders/VTLMaterialManager.js +1 -1
- package/views/2d/engine/vectorTiles/style/VectorTileSource.js +1 -1
- package/views/2d/engine/vectorTiles/style/VectorTilesRequestManager.js +5 -0
- package/views/2d/engine/webgl/BitBlitRenderer.js +1 -1
- package/views/2d/engine/webgl/MaterialManager.js +1 -1
- package/views/2d/engine/webgl/alignmentUtils.js +1 -1
- package/views/2d/engine/webgl/effects/BlendEffect.js +1 -1
- package/views/2d/engine/webgl/materialKey/MaterialKey.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLLabelTemplate.js +1 -1
- package/views/2d/engine/webgl/shaders/BlendPrograms.js +1 -1
- package/views/2d/engine/webgl/shaders/MaterialPrograms.js +1 -1
- package/views/2d/layers/BaseLayerView2D.js +1 -1
- package/views/2d/layers/BaseLayerViewGL2D.js +1 -1
- package/views/2d/layers/GraphicsLayerView2D.js +1 -1
- package/views/2d/layers/ImageryLayerView2D.js +1 -1
- package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
- package/views/2d/layers/LayerView2D.js +1 -1
- package/views/2d/layers/MapNotesLayerView2D.js +1 -1
- package/views/2d/layers/RouteLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/VectorTileLayerView2D.js +1 -1
- package/views/2d/layers/WMSLayerView2D.js +1 -1
- package/views/2d/layers/WMTSLayerView2D.js +1 -1
- package/views/2d/layers/features/sources/BaseFeatureSource.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/graphics/GraphicBoundsRenderer.js +1 -1
- package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
- package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
- package/views/2d/support/engineHelpers.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/environment/CloudsComposition.glsl.js +1 -1
- package/views/3d/environment/CloudsComposition.js +1 -1
- package/views/3d/environment/CloudsGenerator.js +1 -1
- package/views/3d/environment/CloudyWeather.js +1 -1
- package/views/3d/environment/Fog.js +1 -1
- package/views/3d/environment/FoggyWeather.js +1 -1
- package/views/3d/environment/NoiseTextureAtlas.js +1 -1
- package/views/3d/environment/RainyWeather.js +1 -1
- package/views/3d/environment/Stars.js +1 -1
- package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
- package/views/3d/layers/DynamicLayerView3D.js +1 -1
- package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
- package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
- package/views/3d/layers/GraphicsLayerView3D.js +1 -1
- package/views/3d/layers/GraphicsView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/ImageryLayerView3D.js +1 -1
- package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
- package/views/3d/layers/MapImageLayerView3D.js +1 -1
- package/views/3d/layers/OGCFeatureLayerView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/SceneLayerView3D.js +1 -1
- package/views/3d/layers/VectorTileLayerView3D.js +1 -1
- package/views/3d/layers/VoxelLayerView3D.js +1 -1
- package/views/3d/layers/WMSLayerView3D.js +1 -1
- package/views/3d/layers/WMTSLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DDrapedGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +5 -0
- package/views/3d/layers/graphics/Graphics3DFrustumVisibility.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPointSymbol.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DScaleVisibility.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolCreationContext.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/GraphicsProcessor.js +5 -0
- package/views/3d/layers/graphics/IGraphics3DFeatureProcessor.js +4 -0
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/graphics/QueryEngine.js +1 -1
- package/views/3d/layers/support/FeatureTileTree3DDebugger.js +1 -1
- package/views/3d/state/controllers/RotateController.js +1 -1
- package/views/3d/state/controllers/global/PinchAndPanController.js +1 -1
- package/views/3d/state/controllers/global/ZoomController.js +1 -1
- package/views/3d/state/controllers/global/ZoomStepController.js +1 -1
- package/views/3d/state/controllers/local/PinchAndPanController.js +1 -1
- package/views/3d/state/controllers/local/ZoomStepController.js +1 -1
- package/views/3d/support/debugFlags.js +1 -1
- package/views/3d/support/sunUtils.js +1 -1
- package/views/3d/terrain/Overlay.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/Transform.glsl.js +7 -1
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +28 -24
- package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +19 -14
- package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +12 -14
- package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
- package/views/3d/webgl-engine/lib/InstanceParameters.js +5 -0
- package/views/3d/webgl-engine/lib/{localOrigin.js → LocalOriginFactory.js} +0 -0
- package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
- package/views/3d/webgl-engine/lib/Program.js +1 -1
- package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/RenderTargetHelper.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
- package/views/3d/webgl-engine/lib/SSAOHelper.js +1 -1
- package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
- package/views/3d/webgl-engine/lib/TextRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/RealisticTreeTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
- package/views/LayerViewManager.js +1 -1
- package/views/MapView.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
- package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
- package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
- package/views/layers/ImageryTileLayerView.js +1 -1
- package/views/layers/LayerView.js +1 -1
- package/views/layers/OGCFeatureLayerView.js +1 -1
- package/views/layers/RefreshableLayerView.js +1 -1
- package/views/overlay/ViewOverlay.js +1 -1
- package/views/support/DefaultsFromMap.js +1 -1
- package/views/support/WatchUpdatingTracking.js +1 -1
- package/views/support/imageReprojection.js +1 -1
- package/views/webgl/BufferObject.js +1 -1
- package/views/webgl/ContextState.js +1 -1
- package/views/webgl/FramebufferObject.js +1 -1
- package/views/webgl/Program.js +1 -1
- package/views/webgl/ProgramCache.js +1 -1
- package/views/webgl/ProgramTemplate.js +1 -1
- package/views/webgl/Renderbuffer.js +1 -1
- package/views/webgl/RenderingContext.js +1 -1
- package/views/webgl/ShaderTranspiler.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/views/webgl/UniformBufferLayout.js +5 -0
- package/views/webgl/UniformBufferObject.js +5 -0
- package/views/webgl/Util.js +1 -1
- package/views/webgl/enums.js +1 -1
- package/views/webgl/rasterUtils.js +1 -1
- package/views/webgl/storageLayouts.js +5 -0
- package/views/webgl/testDoublePrecisionArithmetic.js +1 -1
- package/views/webgl/testFloatBufferBlend.js +1 -1
- package/views/webgl/testSVGPremultipliedAlpha.js +1 -1
- package/views/webgl/testSamplerPrecision.js +1 -1
- package/views/webgl/tests/SimpleDraw.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/BuildingExplorer/BuildingDisciplinesViewModel.js +1 -1
- package/widgets/Editor/BatchCreateWorkflow.js +1 -1
- package/widgets/Editor/CreateWorkflow.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/ElevationProfile/components/SettingsButton.js +1 -1
- package/widgets/ElevationProfile.js +1 -1
- package/widgets/Feature/FeatureExpression/FeatureExpressionViewModel.js +1 -1
- package/widgets/Feature/FeatureExpression.js +1 -1
- package/widgets/Feature/FeatureMedia/FeatureMediaViewModel.js +1 -1
- package/widgets/Feature/FeatureMedia.js +1 -1
- package/widgets/Feature/FeatureViewModel.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm/InputField.js +1 -1
- package/widgets/FeatureForm/InputFieldGroup.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTemplates.js +1 -1
- package/widgets/FloorFilter.js +1 -1
- package/widgets/LayerList/LayerListViewModel.js +1 -1
- package/widgets/LayerList/ListItemPanel.js +1 -1
- package/widgets/LayerList/support/layerListUtils.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Popup.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/Search.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Weather/CoverageSlider.js +5 -0
- package/widgets/Weather/WeatherViewModel.js +1 -1
- package/widgets/Weather/css.js +1 -1
- package/widgets/Weather.js +1 -1
- package/widgets/support/geolocationUtils.js +1 -1
- package/assets/esri/core/workers/chunks/0881ce46b10362861f87.js +0 -1
- package/assets/esri/core/workers/chunks/0c0a02770eeeb3e28ea1.js +0 -1
- package/assets/esri/core/workers/chunks/0d2effbd84a9482eb639.js +0 -1
- package/assets/esri/core/workers/chunks/0f04246c1b591a3ac74d.js +0 -1
- package/assets/esri/core/workers/chunks/1ac6be0dc25e16c75d06.js +0 -1
- package/assets/esri/core/workers/chunks/1f8110ea12d65ca94b55.js +0 -1
- package/assets/esri/core/workers/chunks/2025d0fd61a64876c81b.js +0 -1
- package/assets/esri/core/workers/chunks/241859d74c0daac62e11.js +0 -1
- package/assets/esri/core/workers/chunks/2c9af2ebd72d9b55329b.js +0 -1
- package/assets/esri/core/workers/chunks/331be347c1b1ca0be2d2.js +0 -1
- package/assets/esri/core/workers/chunks/39af317388ecebb4387d.js +0 -1
- package/assets/esri/core/workers/chunks/39be2893a7dbdecfd65a.js +0 -1
- package/assets/esri/core/workers/chunks/3a20f66b0b7d08064e34.js +0 -1
- package/assets/esri/core/workers/chunks/445099d037affd139ed0.js +0 -1
- package/assets/esri/core/workers/chunks/45848fecec88ed2da33d.js +0 -1
- package/assets/esri/core/workers/chunks/48d3a3abc53abe6a4017.js +0 -1
- package/assets/esri/core/workers/chunks/5005b8c1fdd5cb9a4c19.js +0 -1
- package/assets/esri/core/workers/chunks/52e4c367c72ea7cc3457.js +0 -1
- package/assets/esri/core/workers/chunks/5d8170f6207dbeb4de1b.js +0 -1
- package/assets/esri/core/workers/chunks/615aa2d3ecafe30c80c0.js +0 -1
- package/assets/esri/core/workers/chunks/642c38ac00a962f35d44.js +0 -1
- package/assets/esri/core/workers/chunks/64459604505647e9c714.js +0 -1
- package/assets/esri/core/workers/chunks/653d1550dd1a4867a9fc.js +0 -1
- package/assets/esri/core/workers/chunks/65f73fbbc3c7c60c6d3d.js +0 -1
- package/assets/esri/core/workers/chunks/6db7081d344bea26ef64.js +0 -1
- package/assets/esri/core/workers/chunks/6deac533bb455be4004b.js +0 -1
- package/assets/esri/core/workers/chunks/6e13dab8ec43f7494297.js +0 -1
- package/assets/esri/core/workers/chunks/722a10c65456844d72b9.js +0 -1
- package/assets/esri/core/workers/chunks/7bd4c3ee43fb038b88d8.js +0 -1
- package/assets/esri/core/workers/chunks/803de5097a8a2c4b58a8.js +0 -1
- package/assets/esri/core/workers/chunks/8298231a0fd0129b0d5c.js +0 -1
- package/assets/esri/core/workers/chunks/8500c6c011400af1b7bd.js +0 -1
- package/assets/esri/core/workers/chunks/8b322a2a47dfdbb59b45.js +0 -1
- package/assets/esri/core/workers/chunks/8f83bebef9174c3f15da.js +0 -1
- package/assets/esri/core/workers/chunks/904332faa22bc0e876cb.js +0 -1
- package/assets/esri/core/workers/chunks/950565d1e682fc4072e1.js +0 -1
- package/assets/esri/core/workers/chunks/9846098704ee38bf6350.js +0 -1
- package/assets/esri/core/workers/chunks/a247ddd84245c81112c8.js +0 -1
- package/assets/esri/core/workers/chunks/a721342a32541717324d.js +0 -1
- package/assets/esri/core/workers/chunks/a9ffa806df20130ecfb6.js +0 -1
- package/assets/esri/core/workers/chunks/af13e534e4160636bd3d.js +0 -1
- package/assets/esri/core/workers/chunks/b2f62234ebb8b6158baa.js +0 -1
- package/assets/esri/core/workers/chunks/b51261a9a9ab62388839.js +0 -971
- package/assets/esri/core/workers/chunks/b58eba403bd517a7bb15.js +0 -1
- package/assets/esri/core/workers/chunks/b5bb7cfa26b1f0cec67a.js +0 -1
- package/assets/esri/core/workers/chunks/b8666d1a4e4fff7a4703.js +0 -1
- package/assets/esri/core/workers/chunks/bea1da9e3f878e0e2c83.js +0 -1
- package/assets/esri/core/workers/chunks/c1b6c31fa3ec1542f996.js +0 -1
- package/assets/esri/core/workers/chunks/c32a4fbdc87225f84019.js +0 -1
- package/assets/esri/core/workers/chunks/c67fea81f69a60c0eaef.js +0 -1
- package/assets/esri/core/workers/chunks/cb68db7169b9dfd1c3ff.js +0 -1
- package/assets/esri/core/workers/chunks/cc96608b2802fbfe7a08.js +0 -1
- package/assets/esri/core/workers/chunks/cd02fe27eb07681cb366.js +0 -1
- package/assets/esri/core/workers/chunks/d336afd5890dcdbf5341.js +0 -1
- package/assets/esri/core/workers/chunks/da69e3e5949fe1716e34.js +0 -1
- package/assets/esri/core/workers/chunks/daa9c450b2e2a5371249.js +0 -1
- package/assets/esri/core/workers/chunks/dd63ba77b7e4c3c9c594.js +0 -1
- package/assets/esri/core/workers/chunks/dfa57982d28c9aeb97b9.js +0 -1
- package/assets/esri/core/workers/chunks/e01812116b27874948f0.js +0 -1
- package/assets/esri/core/workers/chunks/e5c9d8482b913cf3580a.js +0 -1
- package/assets/esri/core/workers/chunks/eeadd92f0bede9fc8745.js +0 -1
- package/assets/esri/core/workers/chunks/fbb67cb6224aed2cce16.js +0 -1
- package/assets/esri/core/workers/chunks/feeaf61424336e9eac88.js +0 -1
- package/assets/esri/core/workers/chunks/ff02295329a8986d0568.js +0 -1
- package/tasks/operations/identify.js +0 -5
- package/views/2d/engine/webgl/mesh/templates/meshUtils.js +0 -5
- package/views/3d/layers/graphics/Graphics3DFeatureLikeLayerView.js +0 -5
- package/views/3d/layers/graphics/Graphics3DGraphicLikeLayerView.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import r from"../../core/Accessor.js";import t from"../../core/Evented.js";import{HandleOwnerMixin as s}from"../../core/HandleOwner.js";import{IdentifiableMixin as i}from"../../core/Identifiable.js";import o from"../../core/Logger.js";import{unwrapOr as l}from"../../core/maybe.js";import{EsriPromiseMixin as n}from"../../core/Promise.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";let d=class extends(s(i(n(t.EventedMixin(r))))){constructor(e){super(e),this.layer=null,this.parent=null}initialize(){this.when().catch((e=>{if("layerview:create-error"!==e.name){const r=this.layer&&this.layer.id||"no id",t=this.layer&&this.layer.title||"no title";throw o.getLogger(this.declaredClass).error("#resolve()",`Failed to resolve layer view (layer title: '${t}', id: '${r}')`,e),e}}))}get fullOpacity(){return l(this.get("layer.opacity"),1)*l(this.get("parent.fullOpacity"),1)}get suspended(){return!this.canResume()}get suspendInfo(){return this.getSuspendInfo()}get legendEnabled(){return!this.suspended&&!0===this.layer.legendEnabled}get updating(){var e;return!!(null!=(e=this.updatingHandles)&&e.updating||this.isUpdating())}get updatingProgress(){return this.updating?0:1}get visible(){var e;return!0===(null==(e=this.layer)?void 0:e.visible)}set visible(e){void 0!==e?this._override("visible",e):this._clearOverride("visible")}canResume(){return
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import r from"../../core/Accessor.js";import t from"../../core/Evented.js";import{HandleOwnerMixin as s}from"../../core/HandleOwner.js";import{IdentifiableMixin as i}from"../../core/Identifiable.js";import o from"../../core/Logger.js";import{unwrapOr as l}from"../../core/maybe.js";import{EsriPromiseMixin as n}from"../../core/Promise.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";let d=class extends(s(i(n(t.EventedMixin(r))))){constructor(e){super(e),this.layer=null,this.parent=null}initialize(){this.when().catch((e=>{if("layerview:create-error"!==e.name){const r=this.layer&&this.layer.id||"no id",t=this.layer&&this.layer.title||"no title";throw o.getLogger(this.declaredClass).error("#resolve()",`Failed to resolve layer view (layer title: '${t}', id: '${r}')`,e),e}}))}get fullOpacity(){return l(this.get("layer.opacity"),1)*l(this.get("parent.fullOpacity"),1)}get suspended(){return!this.canResume()}get suspendInfo(){return this.getSuspendInfo()}get legendEnabled(){return!this.suspended&&!0===this.layer.legendEnabled}get updating(){var e;return!!(null!=(e=this.updatingHandles)&&e.updating||this.isUpdating())}get updatingProgress(){return this.updating?0:1}get visible(){var e;return!0===(null==(e=this.layer)?void 0:e.visible)}set visible(e){void 0!==e?this._override("visible",e):this._clearOverride("visible")}canResume(){var e,r,t;return this.visible&&(null==(e=this.layer)?void 0:e.loaded)&&!(null!=(r=this.parent)&&r.suspended)&&(null==(t=this.view)?void 0:t.ready)||!1}getSuspendInfo(){const e=this.parent&&this.parent.suspended?this.parent.suspendInfo:{},r=this;return r.view&&r.view.ready||(e.viewNotReady=!0),this.layer&&this.layer.loaded||(e.layerNotLoaded=!0),this.visible||(e.layerInvisible=!0),e}isUpdating(){return!1}};e([a()],d.prototype,"fullOpacity",null),e([a()],d.prototype,"layer",void 0),e([a()],d.prototype,"parent",void 0),e([a({readOnly:!0})],d.prototype,"suspended",null),e([a({readOnly:!0})],d.prototype,"suspendInfo",null),e([a({readOnly:!0})],d.prototype,"legendEnabled",null),e([a({type:Boolean,readOnly:!0})],d.prototype,"updating",null),e([a({readOnly:!0})],d.prototype,"updatingProgress",null),e([a()],d.prototype,"visible",null),e([a()],d.prototype,"view",void 0),d=e([p("esri.views.layers.LayerView")],d);const u=d;export{u as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";const o=o=>{let t=class extends o{supportsSpatialReference(e){return this.layer.source.supportsSpatialReference(e)}get availableFields(){return this.layer.fieldsIndex.fields.map((e=>e.name))}};return e([r()],t.prototype,"layer",void 0),e([r({readOnly:!0})],t.prototype,"availableFields",null),t=e([s("esri.views.layers.OGCFeatureLayerView")],t),t};export{o as OGCFeatureLayerView,o as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as r}from"../../chunks/tslib.es6.js";import e from"../../core/Logger.js";import{isAbortError as s}from"../../core/promiseUtils.js";import{on as o}from"../../core/
|
|
5
|
+
import{_ as r}from"../../chunks/tslib.es6.js";import e from"../../core/Logger.js";import{isAbortError as s}from"../../core/promiseUtils.js";import{on as o}from"../../core/reactiveUtils.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";const i=i=>{let c=class extends i{initialize(){this.handles.add(o((()=>this.layer),"refresh",(r=>{this.doRefresh(r.dataChanged).catch((r=>{s(r)||e.getLogger(this.declaredClass).error(r)}))})),"RefreshableLayerView")}};return r([t()],c.prototype,"layer",void 0),c=r([a("esri.layers.mixins.RefreshableLayerView")],c),c};export{i as RefreshableLayerView,i as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import r from"../../core/Collection.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import"../../libs/maquette/projection.js";import{createProjector as i}from"../../libs/maquette/projector.js";import{WatchUpdatingTracking as a}from"../support/WatchUpdatingTracking.js";let c=class extends e{constructor(){super(...arguments),this.items=new r,this._watchUpdatingTracking=new a,this._callbacks=new Map,this._projector=i(),this._hiddenProjector=i()}get needsRender(){return this.items.length>0}initialize(){const t=document.createElement("div");t.className="esri-overlay-surface",this._set("surface",t),this._hiddenSurface=document.createElement("div"),this._hiddenSurface.setAttribute("style","visibility: hidden;"),t.appendChild(this._hiddenSurface),this._watchUpdatingTracking.addOnCollectionChange(this.items,(t=>{for(const e of t.added){const t=()=>e.render();this._callbacks.set(e,t),this._projector.append(this.surface,t)}for(const e of t.removed){const t=this._projector.detach(this._callbacks.get(e));this.surface.removeChild(t.domNode),this._callbacks.delete(e)}}))}addItem(t){this.items.add(t)}removeItem(t){this.items.remove(t)}destroy(){this.items.removeAll(),this._callbacks.forEach((t=>this._projector.detach(t))),this._callbacks=null,this._projector=null,this._watchUpdatingTracking.destroy()}render(){this._projector.renderNow()}computeBoundingRect(t){const e=this._hiddenSurface,r=this._hiddenProjector;let o=null;const s=()=>(o=t.render(),o);r.append(e,s),r.renderNow();const i={left:0,top:0,right:0,bottom:0};if(o&&o.domNode){const t=o.domNode.getBoundingClientRect();i.left=t.left,i.top=t.top,i.right=t.right,i.bottom=t.bottom}for(r.detach(s);e.firstChild;)e.removeChild(e.firstChild);return i}overlaps(t,e){const r=this.computeBoundingRect(t),o=this.computeBoundingRect(e);return Math.max(r.left,o.left)<=Math.min(r.right,o.right)&&Math.max(r.top,o.top)<=Math.min(r.bottom,o.bottom)}get hasVisibleItems(){return this.items.some((t=>t.visible))}renderCanvas(t){if(!this.items.some((t=>t.visible)))return;const e=t.getContext("2d");e.save(),e.font=`10px ${getComputedStyle(this.surface).fontFamily}`,this.items.forEach((t=>{e.save(),t.renderCanvas(e),e.restore()})),e.restore()}};t([o({readOnly:!0})],c.prototype,"surface",void 0),t([o({readOnly:!0})],c.prototype,"items",void 0),t([o({readOnly:!0})],c.prototype,"needsRender",null),t([o({readOnly:!0})],c.prototype,"_watchUpdatingTracking",void 0),t([o({readOnly:!0,aliasOf:"_watchUpdatingTracking.updating"})],c.prototype,"updating",void 0),c=t([s("esri.views.overlay.ViewOverlay")],c);const n=c;export{n as default};
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import r from"../../core/Collection.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import"../../libs/maquette/projection.js";import{createProjector as i}from"../../libs/maquette/projector.js";import{WatchUpdatingTracking as a}from"../support/WatchUpdatingTracking.js";let c=class extends e{constructor(){super(...arguments),this.items=new r,this._watchUpdatingTracking=new a,this._callbacks=new Map,this._projector=i(),this._hiddenProjector=i()}get needsRender(){return this.items.length>0}initialize(){const t=document.createElement("div");t.className="esri-overlay-surface",this._set("surface",t),this._hiddenSurface=document.createElement("div"),this._hiddenSurface.setAttribute("style","visibility: hidden;"),t.appendChild(this._hiddenSurface),this._watchUpdatingTracking.addOnCollectionChange((()=>this.items),(t=>{for(const e of t.added){const t=()=>e.render();this._callbacks.set(e,t),this._projector.append(this.surface,t)}for(const e of t.removed){const t=this._projector.detach(this._callbacks.get(e));this.surface.removeChild(t.domNode),this._callbacks.delete(e)}}))}addItem(t){this.items.add(t)}removeItem(t){this.items.remove(t)}destroy(){this.items.removeAll(),this._callbacks.forEach((t=>this._projector.detach(t))),this._callbacks=null,this._projector=null,this._watchUpdatingTracking.destroy()}render(){this._projector.renderNow()}computeBoundingRect(t){const e=this._hiddenSurface,r=this._hiddenProjector;let o=null;const s=()=>(o=t.render(),o);r.append(e,s),r.renderNow();const i={left:0,top:0,right:0,bottom:0};if(o&&o.domNode){const t=o.domNode.getBoundingClientRect();i.left=t.left,i.top=t.top,i.right=t.right,i.bottom=t.bottom}for(r.detach(s);e.firstChild;)e.removeChild(e.firstChild);return i}overlaps(t,e){const r=this.computeBoundingRect(t),o=this.computeBoundingRect(e);return Math.max(r.left,o.left)<=Math.min(r.right,o.right)&&Math.max(r.top,o.top)<=Math.min(r.bottom,o.bottom)}get hasVisibleItems(){return this.items.some((t=>t.visible))}renderCanvas(t){if(!this.items.some((t=>t.visible)))return;const e=t.getContext("2d");e.save(),e.font=`10px ${getComputedStyle(this.surface).fontFamily}`,this.items.forEach((t=>{e.save(),t.renderCanvas(e),e.restore()})),e.restore()}};t([o({readOnly:!0})],c.prototype,"surface",void 0),t([o({readOnly:!0})],c.prototype,"items",void 0),t([o({readOnly:!0})],c.prototype,"needsRender",null),t([o({readOnly:!0})],c.prototype,"_watchUpdatingTracking",void 0),t([o({readOnly:!0,aliasOf:"_watchUpdatingTracking.updating"})],c.prototype,"updating",void 0),c=t([s("esri.views.overlay.ViewOverlay")],c);const n=c;export{n as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import a from"../../core/Handles.js";import i from"../../core/Logger.js";import{destroyMaybe as n,abortMaybe as s,isSome as l,unwrap as r,isNone as o}from"../../core/maybe.js";import{createTask as p,whenOrAbort as d,isAborted as u}from"../../core/promiseUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import{project as h,canProjectWithoutEngine as g,isLoaded as y}from"../../geometry/projection.js";import{mayHaveHeightModelInfo as _,deriveHeightModelInfoFromLayer as k}from"../../geometry/support/heightModelInfoUtils.js";import{stringFromViewingMode as v}from"../ViewingMode.js";const R=10,m=i.getLogger("esri.views.support.DefaultsFromMap");m.level="info";let x=class extends t{constructor(e){super(e),this._handles=new a,this.required={tileInfo:!1,heightModelInfo:!1,extent:!1},this.defaultSpatialReference=null,this.userSpatialReference=null,this.priorityCollection=null,this.logDebugInformation=!1,this.suspended=!1,this._projectExtentTask={task:null,input:null,output:null,spatialReference:null}}destroy(){this._handles=n(this._handles),this._projectExtentTask.task&&(this._debug("Aborting project extent task"),this._projectExtentTask.task=s(this._projectExtentTask.task)),this._set("map",null)}get ready(){return!this._spatialReferenceTask.updating&&!this._tileInfoTask.updating&&!this._extentTask.updating}get heightModelInfoReady(){return!this._heightModelInfoTask.updating}get spatialReference(){return l(this.userSpatialReference)?this.userSpatialReference:r(this._spatialReferenceTask.spatialReference)}get extent(){return r(this._extentTask.extent)}get heightModelInfo(){return r(this._heightModelInfoTask.heightModelInfo)}get vcsWkid(){return r(this._heightModelInfoTask.vcsWkid)}get latestVcsWkid(){return r(this._heightModelInfoTask.latestVcsWkid)}get viewingMode(){return o(this.userSpatialReference)||this.userSpatialReference.equals(r(this._spatialReferenceTask.spatialReference))?r(this._spatialReferenceTask.viewingMode):null}get tileInfo(){return r(this._tileInfoTask.tileInfo)}get mapCollections(){var e,t,a,i;const n=null==(e=this.map)?void 0:e.call(this),s=[];return l(this.priorityCollection)&&s.push(this.priorityCollection),s.push({parent:null==n?void 0:n.basemap,layers:null==n||null==(t=n.basemap)?void 0:t.baseLayers},{layers:null==n?void 0:n.layers},{parent:null==n?void 0:n.ground,layers:null==n||null==(a=n.ground)?void 0:a.layers},{parent:null==n?void 0:n.basemap,layers:null==n||null==(i=n.basemap)?void 0:i.referenceLayers}),s}get _allLayers(){var e,t;const a=this._collectLayers(this.mapCollections);return this._debug("Collected",null!=(e=null==(t=a.layers)?void 0:t.length)?e:0,"layers, updating",a.updating),a}get _spatialReferenceTask(){var e,t;if(this.suspended)return null!=(t=this._get("_spatialReferenceTask"))?t:{updating:!1};const{layers:a,updating:i}=this._allLayers,n={candidates:null};for(const l of a)if(this._processSpatialReferenceCandidates(l,n),n.candidates&&1===n.candidates.length)break;if(1!==(null==(e=n.candidates)?void 0:e.length)&&i)return{updating:!0};const s=this._pickSpatialReferenceCandidate(n.candidates);return this._debug("Finished spatial reference",l(s)?`${s.spatialReference.wkid}:${l(s.viewingMode)?v(s.viewingMode):"global/local"}`:"none available"),{spatialReference:l(s)?s.spatialReference:null,viewingMode:l(s)?s.viewingMode:null,updating:!1}}get _tileInfoTask(){var e,t,a,i,n,s,l,r;if(!this.required.tileInfo)return null!=(r=this._get("_tileInfoTask"))?r:{updating:!1};if(!this.spatialReference)return{updating:this._spatialReferenceTask.updating};const{layers:o,updating:p}=this._collectLayers([{parent:null==(e=this.map)||null==(t=e.call(this))?void 0:t.basemap,layers:null==(a=this.map)||null==(i=a.call(this))||null==(n=i.basemap)?void 0:n.baseLayers},{layers:null==(s=this.map)||null==(l=s.call(this))?void 0:l.layers}]);if(o&&o.length>0&&"tileInfo"in o[0]){const e=o[0].tileInfo;return{tileInfo:e&&e.spatialReference.equals(this.spatialReference)?e:null,updating:!1}}return{updating:p}}get _heightModelInfoTask(){var e,t;if(!this.required.heightModelInfo||this.suspended&&null!=(e=this._get("_heightModelInfoTask"))&&e.heightModelInfo)return null!=(t=this._get("_heightModelInfoTask"))?t:{updating:!1};const{layers:a,updating:i}=this._allLayers;for(const o of a){var n,s;if(this._debug("Considering",null!=(n=null!=(s=o.title)?s:o.id)?n:o.declaredClass,"for height model info"),_(o)){const e=k(o);var l,r;if(e)return this._debug("Derived height model info",e),{heightModelInfo:e,vcsWkid:null==(l=o.spatialReference)?void 0:l.vcsWkid,latestVcsWkid:null==(r=o.spatialReference)?void 0:r.latestVcsWkid,updating:!1}}this._debug("Layer does not support height models")}return this._debug("No height model info found,","updating",i),{updating:i}}get _extentCandidatesTask(){var e;if(this.suspended||!this.required.extent)return null!=(e=this._get("_extentCandidatesTask"))?e:{updating:!1};if(!this.spatialReference)return{updating:this._spatialReferenceTask.updating};const t=this._allLayers,a=t.updating,i=[];for(const n of t.layers){const e="fullExtents"in n&&n.fullExtents||(l(n.fullExtent)?[n.fullExtent]:[]),t=e.find((e=>e.spatialReference.equals(this.spatialReference)));if(t)return{candidates:[{extent:t,layer:n}],updating:!1};if(this._getSupportedSpatialReferences(n).length>0)for(const a of e)i.push({extent:a,layer:n})}return{candidates:i,updating:a}}get _extentTask(){const{candidates:e,updating:t}=this._extentCandidatesTask;if(t)return{updating:t};if(o(e)||0===e.length)return{updating:!1};if(!this.spatialReference)return{updating:this._spatialReferenceTask.updating};const{candidate:a,requiresGeometryService:i}=this._pickExtentCandidate(e),n=this.spatialReference;if(a.extent.equals(this._projectExtentTask.input)&&n.equals(this._projectExtentTask.spatialReference))return{extent:this._projectExtentTask.output,updating:l(this._projectExtentTask.task)&&!this._projectExtentTask.task.finished};if(l(this._projectExtentTask.task)&&(this._debug("Aborting project extent task"),this._projectExtentTask.task=s(this._projectExtentTask.task)),!i){this._projectExtentTask={input:null,output:null,task:null,spatialReference:null};try{return{extent:h(a.extent,n),updating:!1}}catch{return{updating:!1}}}return this._debug("Starting project extent task for",a.extent),this._projectExtentTask={input:a.extent.clone(),output:null,spatialReference:n.clone(),task:p((async e=>{try{const t=await d(import("../../portal/support/geometryServiceUtils.js"),e),i=await t.projectGeometry(a.extent,n,a.layer.portalItem,e);this._debug("Project extent task finished",i),this._projectExtentTask={...this._projectExtentTask,task:null,output:i}}catch(t){if(u(e))return;this._projectExtentTask={...this._projectExtentTask,task:null}}}))},{updating:!0}}_processSpatialReferenceCandidates(e,t){var a;const i=this._getSupportedSpatialReferences(e);if(0!==i.length)if(this._debug("Spatial reference candidates from",null!=(a=e.title)?a:e.id,":",i.map((e=>`${e.spatialReference.wkid}:${l(e.viewingMode)?v(e.viewingMode):"global/local"}`)).join(", ")),t.candidates){const e=[],a=(e,t)=>o(e.viewingMode)?t.viewingMode:(o(t.viewingMode)||e.viewingMode===t.viewingMode)&&e.viewingMode;for(const n of t.candidates)for(const t of i){if(!n.spatialReference.equals(t.spatialReference))continue;const i=a(n,t);if(!1!==i){e.push({spatialReference:n.spatialReference,viewingMode:i});break}}e.length>0&&(t.candidates=e)}else t.candidates=i}_pickSpatialReferenceCandidate(e){const t=this.defaultSpatialReference;return!e||e.length<1?l(t)?{spatialReference:t,viewingMode:null}:null:l(t)&&e.length>1&&e.some((({spatialReference:e})=>e.equals(t)))?{spatialReference:t,viewingMode:null}:e[0]}_getSupportedSpatialReferences(e){const t="supportedSpatialReferences"in e&&e.supportedSpatialReferences||(e.spatialReference?[e.spatialReference]:[]);if(0===t.length)return[];const a=[];for(const i of t){const t=this.getSpatialReferenceSupport({spatialReference:i,layer:e});if(l(t)){const e=l(t.constraints)?t.constraints:[{spatialReference:i}];for(const{spatialReference:t,viewingMode:i}of e)(o(this.userSpatialReference)||t.equals(this.userSpatialReference))&&a.push({spatialReference:t,viewingMode:i})}}return a}_pickExtentCandidate(e){const t=this.spatialReference,a=e.find((({extent:e})=>g(e.spatialReference,t)||y()));return l(a)?{candidate:a,requiresGeometryService:!1}:{candidate:e[0],requiresGeometryService:!0}}_collectLayers(e){var t;if("loaded"!==this._loadMaybe(null==(t=this.map)?void 0:t.call(this)))return{layers:[],updating:!0};const a={layers:[],preloading:-1,updating:!1};for(const i of e)if(this._collectCollection(i,a),a.preloading===R)break;return{layers:a.layers,updating:a.updating}}_collectCollection(e,t){if(e.layers){switch(this._loadMaybe(e.parent)){case"loading":return t.updating=!0,void++t.preloading;case"failed":return}for(const n of e.layers){switch(this._loadMaybe(n)){case"failed":continue;case"loading":t.updating=!0,++t.preloading;break;case"loaded":var a,i;if(!t.updating)this._debug("Considering layer",null!=(a=null!=(i=n.title)?i:n.id)?a:n.declaredClass),t.layers.push(n);"layers"in n&&this._collectCollection({layers:n.layers},t)}if(t.preloading===R)break}}}_loadMaybe(e){return e&&"loadStatus"in e?"not-loaded"===e.loadStatus?(this._debug("Triggering load",null!=(t=null!=(a=e.title)?a:e.id)?t:e.declaredClass),e.load(),"loading"):e.loadStatus:"loaded";var t,a}_debug(...e){this.logDebugInformation&&m.info(...e)}};e([c()],x.prototype,"required",void 0),e([c({constructOnly:!0})],x.prototype,"map",void 0),e([c({constructOnly:!0})],x.prototype,"getSpatialReferenceSupport",void 0),e([c()],x.prototype,"defaultSpatialReference",void 0),e([c()],x.prototype,"userSpatialReference",void 0),e([c()],x.prototype,"priorityCollection",void 0),e([c()],x.prototype,"logDebugInformation",void 0),e([c()],x.prototype,"suspended",void 0),e([c({readOnly:!0})],x.prototype,"ready",null),e([c({readOnly:!0})],x.prototype,"heightModelInfoReady",null),e([c({readOnly:!0})],x.prototype,"spatialReference",null),e([c({readOnly:!0})],x.prototype,"extent",null),e([c({readOnly:!0})],x.prototype,"heightModelInfo",null),e([c({readOnly:!0})],x.prototype,"vcsWkid",null),e([c({readOnly:!0})],x.prototype,"latestVcsWkid",null),e([c({readOnly:!0})],x.prototype,"viewingMode",null),e([c({readOnly:!0})],x.prototype,"tileInfo",null),e([c({readOnly:!0})],x.prototype,"mapCollections",null),e([c({readOnly:!0})],x.prototype,"_allLayers",null),e([c({readOnly:!0})],x.prototype,"_spatialReferenceTask",null),e([c({readOnly:!0})],x.prototype,"_tileInfoTask",null),e([c({readOnly:!0})],x.prototype,"_heightModelInfoTask",null),e([c({readOnly:!0})],x.prototype,"_extentCandidatesTask",null),e([c()],x.prototype,"_extentTask",null),e([c()],x.prototype,"_projectExtentTask",void 0),x=e([f("esri.views.support.DefaultsFromMap")],x);const T=x;export{T as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import a from"../../core/Handles.js";import i from"../../core/Logger.js";import{destroyMaybe as n,abortMaybe as s,isSome as l,unwrap as r,isNone as o}from"../../core/maybe.js";import{createTask as p,whenOrAbort as d,isAborted as u}from"../../core/promiseUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import{project as h,canProjectWithoutEngine as g,isLoaded as y}from"../../geometry/projection.js";import{mayHaveHeightModelInfo as _,deriveHeightModelInfoFromLayer as k}from"../../geometry/support/heightModelInfoUtils.js";import{stringFromViewingMode as v,ViewingMode as R}from"../ViewingMode.js";const m=10,x=i.getLogger("esri.views.support.DefaultsFromMap");x.level="info";let T=class extends t{constructor(e){super(e),this._handles=new a,this.required={tileInfo:!1,heightModelInfo:!1,extent:!1},this.defaultSpatialReference=null,this.userSpatialReference=null,this.priorityCollection=null,this.logDebugInformation=!1,this.suspended=!1,this._projectExtentTask={task:null,input:null,output:null,spatialReference:null}}destroy(){this._handles=n(this._handles),this._projectExtentTask.task&&(this._debug("Aborting project extent task"),this._projectExtentTask.task=s(this._projectExtentTask.task)),this._set("map",null)}get ready(){return!this._spatialReferenceTask.updating&&!this._tileInfoTask.updating&&!this._extentTask.updating}get heightModelInfoReady(){return!this._heightModelInfoTask.updating}get spatialReference(){return l(this.userSpatialReference)?this.userSpatialReference:r(this._spatialReferenceTask.spatialReference)}get extent(){return r(this._extentTask.extent)}get heightModelInfo(){return r(this._heightModelInfoTask.heightModelInfo)}get vcsWkid(){return r(this._heightModelInfoTask.vcsWkid)}get latestVcsWkid(){return r(this._heightModelInfoTask.latestVcsWkid)}get viewingMode(){return o(this.userSpatialReference)||this.userSpatialReference.equals(r(this._spatialReferenceTask.spatialReference))?r(this._spatialReferenceTask.viewingMode):null}get tileInfo(){return r(this._tileInfoTask.tileInfo)}get mapCollections(){var e,t,a,i;const n=null==(e=this.map)?void 0:e.call(this),s=[];return l(this.priorityCollection)&&s.push(this.priorityCollection),s.push({parent:null==n?void 0:n.basemap,layers:null==n||null==(t=n.basemap)?void 0:t.baseLayers},{layers:null==n?void 0:n.layers},{parent:null==n?void 0:n.ground,layers:null==n||null==(a=n.ground)?void 0:a.layers},{parent:null==n?void 0:n.basemap,layers:null==n||null==(i=n.basemap)?void 0:i.referenceLayers}),s}get _allLayers(){var e,t;const a=this._collectLayers(this.mapCollections);return this._debug("Collected",null!=(e=null==(t=a.layers)?void 0:t.length)?e:0,"layers, updating",a.updating),a}get _spatialReferenceTask(){var e,t;if(this.suspended)return null!=(t=this._get("_spatialReferenceTask"))?t:{updating:!1};const{layers:a,updating:i}=this._allLayers,n={candidates:null};for(const l of a)if(this._processSpatialReferenceCandidates(l,n),n.candidates&&1===n.candidates.length)break;if(1!==(null==(e=n.candidates)?void 0:e.length)&&i)return{updating:!0};const s=this._pickSpatialReferenceCandidate(n.candidates);return this._debug("Finished spatial reference",l(s)?`${s.spatialReference.wkid}:${l(s.viewingMode)?v(s.viewingMode):"global/local"}`:"none available"),{spatialReference:l(s)?s.spatialReference:null,viewingMode:l(s)?s.viewingMode:null,updating:!1}}get _tileInfoTask(){var e,t,a,i,n,s,l,r;if(!this.required.tileInfo)return null!=(r=this._get("_tileInfoTask"))?r:{updating:!1};if(!this.spatialReference)return{updating:this._spatialReferenceTask.updating};const{layers:o,updating:p}=this._collectLayers([{parent:null==(e=this.map)||null==(t=e.call(this))?void 0:t.basemap,layers:null==(a=this.map)||null==(i=a.call(this))||null==(n=i.basemap)?void 0:n.baseLayers},{layers:null==(s=this.map)||null==(l=s.call(this))?void 0:l.layers}]);if(o&&o.length>0&&"tileInfo"in o[0]){const e=o[0].tileInfo;return{tileInfo:e&&e.spatialReference.equals(this.spatialReference)?e:null,updating:!1}}return{updating:p}}get _heightModelInfoTask(){var e,t;if(!this.required.heightModelInfo||this.suspended&&null!=(e=this._get("_heightModelInfoTask"))&&e.heightModelInfo)return null!=(t=this._get("_heightModelInfoTask"))?t:{updating:!1};const{layers:a,updating:i}=this._allLayers;for(const o of a){var n,s;if(this._debug("Considering",null!=(n=null!=(s=o.title)?s:o.id)?n:o.declaredClass,"for height model info"),_(o)){const e=k(o);var l,r;if(e)return this._debug("Derived height model info",e),{heightModelInfo:e,vcsWkid:null==(l=o.spatialReference)?void 0:l.vcsWkid,latestVcsWkid:null==(r=o.spatialReference)?void 0:r.latestVcsWkid,updating:!1}}this._debug("Layer does not support height models")}return this._debug("No height model info found,","updating",i),{updating:i}}get _extentCandidatesTask(){var e;if(this.suspended||!this.required.extent)return null!=(e=this._get("_extentCandidatesTask"))?e:{updating:!1};if(!this.spatialReference)return{updating:this._spatialReferenceTask.updating};const t=this._allLayers,a=t.updating,i=[];for(const n of t.layers){const e="fullExtents"in n&&n.fullExtents||(l(n.fullExtent)?[n.fullExtent]:[]),t=e.find((e=>e.spatialReference.equals(this.spatialReference)));if(t)return{candidates:[{extent:t,layer:n}],updating:!1};if(this._getSupportedSpatialReferences(n).length>0)for(const a of e)i.push({extent:a,layer:n})}return{candidates:i,updating:a}}get _extentTask(){const{candidates:e,updating:t}=this._extentCandidatesTask;if(t)return{updating:t};if(o(e)||0===e.length)return{updating:!1};if(!this.spatialReference)return{updating:this._spatialReferenceTask.updating};const{candidate:a,requiresGeometryService:i}=this._pickExtentCandidate(e),n=this.spatialReference;if(a.extent.equals(this._projectExtentTask.input)&&n.equals(this._projectExtentTask.spatialReference))return{extent:this._projectExtentTask.output,updating:l(this._projectExtentTask.task)&&!this._projectExtentTask.task.finished};if(l(this._projectExtentTask.task)&&(this._debug("Aborting project extent task"),this._projectExtentTask.task=s(this._projectExtentTask.task)),!i){this._projectExtentTask={input:null,output:null,task:null,spatialReference:null};try{return{extent:h(a.extent,n),updating:!1}}catch{return{updating:!1}}}return this._debug("Starting project extent task for",a.extent),this._projectExtentTask={input:a.extent.clone(),output:null,spatialReference:n.clone(),task:p((async e=>{try{const t=await d(import("../../portal/support/geometryServiceUtils.js"),e),i=await t.projectGeometry(a.extent,n,a.layer.portalItem,e);this._debug("Project extent task finished",i),this._projectExtentTask={...this._projectExtentTask,task:null,output:i}}catch(t){if(u(e))return;this._projectExtentTask={...this._projectExtentTask,task:null}}}))},{updating:!0}}_processSpatialReferenceCandidates(e,t){var a;const i=this._getSupportedSpatialReferences(e);if(0!==i.length)if(this._debug("Spatial reference candidates from",null!=(a=e.title)?a:e.id,":",i.map((e=>`${e.spatialReference.wkid}:${l(e.viewingMode)?v(e.viewingMode):"global/local"}`)).join(", ")),t.candidates){const e=[],a=(e,t)=>o(e.viewingMode)?t.viewingMode:(o(t.viewingMode)||e.viewingMode===t.viewingMode)&&e.viewingMode;for(const n of t.candidates)for(const t of i){if(!n.spatialReference.equals(t.spatialReference))continue;const i=a(n,t);if(!1!==i){e.push({spatialReference:n.spatialReference,viewingMode:i});break}}e.length>0&&(t.candidates=e)}else t.candidates=i}_pickSpatialReferenceCandidate(e){const t=this.defaultSpatialReference;return!e||e.length<1?l(t)?{spatialReference:t,viewingMode:null}:null:(l(t)&&e.length>1&&e.some((({spatialReference:e})=>e.equals(t)))&&(e=e.filter((({spatialReference:e})=>e.equals(t)))),e.length>1&&e.some((({viewingMode:e})=>e!==R.Local))&&(e=e.filter((({viewingMode:e})=>e!==R.Local))),e[0])}_getSupportedSpatialReferences(e){const t="supportedSpatialReferences"in e&&e.supportedSpatialReferences||(e.spatialReference?[e.spatialReference]:[]);if(0===t.length)return[];const a=[];for(const i of t){const t=this.getSpatialReferenceSupport({spatialReference:i,layer:e});if(l(t)){const e=l(t.constraints)?t.constraints:[{spatialReference:i}];for(const{spatialReference:t,viewingMode:i}of e)(o(this.userSpatialReference)||t.equals(this.userSpatialReference))&&a.push({spatialReference:t,viewingMode:i})}}return a}_pickExtentCandidate(e){const t=this.spatialReference,a=e.find((({extent:e})=>g(e.spatialReference,t)||y()));return l(a)?{candidate:a,requiresGeometryService:!1}:{candidate:e[0],requiresGeometryService:!0}}_collectLayers(e){var t;if("loaded"!==this._loadMaybe(null==(t=this.map)?void 0:t.call(this)))return{layers:[],updating:!0};const a={layers:[],preloading:-1,updating:!1};for(const i of e)if(this._collectCollection(i,a),a.preloading===m)break;return{layers:a.layers,updating:a.updating}}_collectCollection(e,t){if(e.layers){switch(this._loadMaybe(e.parent)){case"loading":return t.updating=!0,void++t.preloading;case"failed":return}for(const n of e.layers){switch(this._loadMaybe(n)){case"failed":continue;case"loading":t.updating=!0,++t.preloading;break;case"loaded":var a,i;if(!t.updating)this._debug("Considering layer",null!=(a=null!=(i=n.title)?i:n.id)?a:n.declaredClass),t.layers.push(n);"layers"in n&&this._collectCollection({layers:n.layers},t)}if(t.preloading===m)break}}}_loadMaybe(e){return e&&"loadStatus"in e?"not-loaded"===e.loadStatus?(this._debug("Triggering load",null!=(t=null!=(a=e.title)?a:e.id)?t:e.declaredClass),e.load(),"loading"):e.loadStatus:"loaded";var t,a}_debug(...e){this.logDebugInformation&&x.info(...e)}};e([c()],T.prototype,"required",void 0),e([c({constructOnly:!0})],T.prototype,"map",void 0),e([c({constructOnly:!0})],T.prototype,"getSpatialReferenceSupport",void 0),e([c()],T.prototype,"defaultSpatialReference",void 0),e([c()],T.prototype,"userSpatialReference",void 0),e([c()],T.prototype,"priorityCollection",void 0),e([c()],T.prototype,"logDebugInformation",void 0),e([c()],T.prototype,"suspended",void 0),e([c({readOnly:!0})],T.prototype,"ready",null),e([c({readOnly:!0})],T.prototype,"heightModelInfoReady",null),e([c({readOnly:!0})],T.prototype,"spatialReference",null),e([c({readOnly:!0})],T.prototype,"extent",null),e([c({readOnly:!0})],T.prototype,"heightModelInfo",null),e([c({readOnly:!0})],T.prototype,"vcsWkid",null),e([c({readOnly:!0})],T.prototype,"latestVcsWkid",null),e([c({readOnly:!0})],T.prototype,"viewingMode",null),e([c({readOnly:!0})],T.prototype,"tileInfo",null),e([c({readOnly:!0})],T.prototype,"mapCollections",null),e([c({readOnly:!0})],T.prototype,"_allLayers",null),e([c({readOnly:!0})],T.prototype,"_spatialReferenceTask",null),e([c({readOnly:!0})],T.prototype,"_tileInfoTask",null),e([c({readOnly:!0})],T.prototype,"_heightModelInfoTask",null),e([c({readOnly:!0})],T.prototype,"_extentCandidatesTask",null),e([c()],T.prototype,"_extentTask",null),e([c()],T.prototype,"_projectExtentTask",void 0),T=e([f("esri.views.support.DefaultsFromMap")],T);const M=T;export{M as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import s from"../../core/Accessor.js";import t from"../../core/Handles.js";import{isNone as
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import s from"../../core/Accessor.js";import t from"../../core/Handles.js";import{isNone as i}from"../../core/maybe.js";import{watch as n,on as d,sync as r}from"../../core/reactiveUtils.js";import{schedule as a}from"../../core/scheduling.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";let c=class extends s{constructor(){super(...arguments),this.updating=!1,this.handleId=0,this.handles=new t,this.scheduleHandleId=0,this.pendingPromises=new Set}destroy(){this.removeAll(),this.handles.destroy()}add(e,s,t={}){const i=++this.handleId;t.sync||this._installSyncUpdatingWatch(e,i);const d=n(e,s,t);return this.handles.add(d,i),{remove:()=>this.handles.remove(i)}}addOnCollectionChange(e,s,{initial:t=!1}={}){const i=++this.handleId;return this.handles.add([d(e,"after-changes",this._createSyncUpdatingCallback(),r),d(e,"change",s,{onListenerAdd:t?e=>s({added:e.items,removed:[],moved:[],target:e}):void 0})],i),{remove:()=>this.handles.remove(i)}}addPromise(e){if(i(e))return e;const s=++this.handleId;this.handles.add({remove:()=>{this.pendingPromises.delete(e)&&(0!==this.pendingPromises.size||this.handles.has(l)||this._set("updating",!1))}},s),this.pendingPromises.add(e),this._set("updating",!0);const t=()=>this.handles.remove(s);return e.then(t,t),e}removeAll(){this.pendingPromises.clear(),this.handles.removeAll(),this._set("updating",!1)}_installSyncUpdatingWatch(e,s){const t=this._createSyncUpdatingCallback(),i=n(e,t,{sync:!0,equals:()=>!1});return this.handles.add(i,s),i}_createSyncUpdatingCallback(){return()=>{this.handles.remove(l),++this.scheduleHandleId;const e=this.scheduleHandleId;this._get("updating")||this._set("updating",!0),this.handles.add(a((()=>{e===this.scheduleHandleId&&(this._set("updating",this.pendingPromises.size>0),this.handles.remove(l))})),l)}}};e([o({readOnly:!0})],c.prototype,"updating",void 0),c=e([h("esri.views.support.WatchUpdatingTracking")],c);const l=-42;var p;!function(e){e[e.NONE=0]="NONE",e[e.SYNC=1]="SYNC",e[e.INIT=2]="INIT"}(p||(p={}));export{p as WatchFlags,c as WatchUpdatingTracking};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../request.js";import e from"../../geometry/Point.js";import{project as r}from"../../geometry/projection.js";import{projectResolution as i,getProjectionOffsetGrid as a}from"../../layers/support/rasterFunctions/rasterProjectionHelper.js";import{isImageSource as s,rasterize as o}from"../2d/engine/Bitmap.js";import n from"../2d/engine/webgl/VertexStream.js";import{createProgramTemplate as m}from"../2d/engine/webgl/shaders/MaterialPrograms.js";import{PixelFormat as p,PixelType as h,TextureWrapMode as c,TextureSamplingMode as x,TargetType as d,DepthStencilTargetType as g,ColorAttachment as u}from"../webgl/enums.js";import{FramebufferObject as _}from"../webgl/FramebufferObject.js";import{
|
|
5
|
+
import t from"../../request.js";import e from"../../geometry/Point.js";import{project as r}from"../../geometry/projection.js";import{projectResolution as i,getProjectionOffsetGrid as a}from"../../layers/support/rasterFunctions/rasterProjectionHelper.js";import{isImageSource as s,rasterize as o}from"../2d/engine/Bitmap.js";import n from"../2d/engine/webgl/VertexStream.js";import{createProgramTemplate as m}from"../2d/engine/webgl/shaders/MaterialPrograms.js";import{PixelFormat as p,PixelType as h,TextureWrapMode as c,TextureSamplingMode as x,TargetType as d,DepthStencilTargetType as g,ColorAttachment as u}from"../webgl/enums.js";import{FramebufferObject as _}from"../webgl/FramebufferObject.js";import{createTransformTexture as f}from"../webgl/rasterUtils.js";import{RenderingContext as l}from"../webgl/RenderingContext.js";import{Texture as w}from"../webgl/Texture.js";class b{constructor(t){if(t)this._ownsRctx=!1,this._rctx=t;else{this._ownsRctx=!0;const t=document.createElement("canvas").getContext("webgl");t.getExtension("OES_texture_float"),this._rctx=new l(t,{})}const e={applyProjection:!0,bilinear:!1,bicubic:!1},r=m("raster/reproject","raster/reproject",new Map([["a_position",0]]),e);this._program=this._rctx.programCache.acquire(r.shaders.vertexShader,r.shaders.fragmentShader,r.attributes),this._rctx.useProgram(this._program),this._program.setUniform1f("u_opacity",1),this._program.setUniform1i("u_image",0),this._program.setUniform1i("u_flipY",0),this._program.setUniform1i("u_transformGrid",1),this._quad=new n(this._rctx,[0,0,1,0,0,1,1,1])}reprojectTexture(t,s,o=!1){const n=r(t.extent,s),m=new e({x:(t.extent.xmax-t.extent.xmin)/t.texture.descriptor.width,y:(t.extent.ymax-t.extent.ymin)/t.texture.descriptor.height,spatialReference:t.extent.spatialReference}),{x:l,y:b}=i(m,s,t.extent);let T=(l+b)/2;const j=Math.round((n.xmax-n.xmin)/T),D=Math.round((n.ymax-n.ymin)/T);T=(n.width/j+n.height/D)/2;const E=new e({x:T,y:T,spatialReference:n.spatialReference}),y=a({projectedExtent:n,srcBufferExtent:t.extent,pixelSize:E,hasWrapAround:!0,spacing:[16,16]}),R=f(this._rctx,y),M=new w(this._rctx,{width:j,height:D,pixelFormat:p.RGBA,dataType:h.UNSIGNED_BYTE,wrapMode:c.CLAMP_TO_EDGE,samplingMode:x.LINEAR,hasMipmap:!1}),A=new _(this._rctx,{colorTarget:d.TEXTURE,depthStencilTarget:g.NONE,width:j,height:D},M);if(this._rctx.bindFramebuffer(A),this._rctx.setViewport(0,0,j,D),this._rctx.useProgram(this._program),this._rctx.bindTexture(t.texture,0),this._rctx.bindTexture(R,1),this._quad.bind(),this._program.setUniform2f("u_srcImageSize",t.texture.descriptor.width,t.texture.descriptor.height),this._program.setUniform2fv("u_transformSpacing",y.spacing),this._program.setUniform2fv("u_transformGridSize",y.size),this._program.setUniform2f("u_targetImageSize",j,D),this._quad.draw(),this._quad.unbind(),this._rctx.useProgram(null),this._rctx.bindFramebuffer(null),R.dispose(),o){const t=new ImageData(A.descriptor.width,A.descriptor.height);return A.readPixels(0,0,A.descriptor.width,A.descriptor.height,p.RGBA,h.UNSIGNED_BYTE,t.data),A.detachColorTexture(u.COLOR_ATTACHMENT0),A.dispose(),{texture:M,extent:n,imageData:t}}return A.detachColorTexture(u.COLOR_ATTACHMENT0),A.dispose(),{texture:M,extent:n}}reprojectBitmapData(t,e){const r=s(t.bitmapData)?o(t.bitmapData):t.bitmapData,i=new w(this._rctx,{width:t.bitmapData.width,height:t.bitmapData.height,pixelFormat:p.RGBA,dataType:h.UNSIGNED_BYTE,wrapMode:c.CLAMP_TO_EDGE,samplingMode:x.LINEAR,hasMipmap:!1},r),a=this.reprojectTexture({texture:i,extent:t.extent},e,!0);a.texture.dispose();const n=document.createElement("canvas");n.width=a.imageData.width,n.height=a.imageData.height;return n.getContext("2d").putImageData(a.imageData,0,0),{bitmapData:n,extent:a.extent}}async loadAndReprojectBitmapData(e,r,i){const a=(await t(e,{responseType:"image"})).data,s=document.createElement("canvas");s.width=a.width,s.height=a.height;const o=s.getContext("2d");o.drawImage(a,0,0);const n=o.getImageData(0,0,s.width,s.height),m=this.reprojectBitmapData({bitmapData:n,extent:r},i);return{bitmapData:m.bitmapData,extent:m.extent}}destroy(){this._quad.dispose(),this._program.dispose(),this._ownsRctx&&this._rctx.dispose()}}export{b as ImageReprojector};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../core/Logger.js";import{isSome as e}from"../../core/maybe.js";import{isUint16Array as i,isUint32Array as s}from"../../core/typedArrayUtil.js";import{checkWebGLError as r}from"./checkWebGLError.js";import{BufferType as
|
|
5
|
+
import t from"../../core/Logger.js";import{isSome as e}from"../../core/maybe.js";import{isUint16Array as i,isUint32Array as s}from"../../core/typedArrayUtil.js";import{checkWebGLError as r}from"./checkWebGLError.js";import{ContextType as n}from"./context-util.js";import{BufferType as f,ResourceType as o,Usage as _,DataType as h}from"./enums.js";const a=t.getLogger("esri.views.webgl.BufferObject");class u{constructor(t,e,i,s){this._context=t,this.bufferType=e,this.usage=i,this._glName=null,this._size=-1,this._indexType=void 0,t.instanceCounter.increment(o.Buffer,this),this._glName=this._context.gl.createBuffer(),r(this._context.gl),s&&this.setData(s)}static createIndex(t,e,i){return new u(t,f.ELEMENT_ARRAY_BUFFER,e,i)}static createVertex(t,e,i){return new u(t,f.ARRAY_BUFFER,e,i)}static createUniform(t,e,i){return new u(t,f.UNIFORM_BUFFER,e,i)}static createPixelPack(t,e=_.STREAM_READ,i){const s=new u(t,f.PIXEL_PACK_BUFFER,e);return i&&s.setSize(i),s}static createPixelUnpack(t,e=_.STREAM_DRAW,i){return new u(t,f.PIXEL_UNPACK_BUFFER,e,i)}get glName(){return this._glName}get size(){return this._size}get indexType(){return this._indexType}get byteSize(){return this.bufferType===f.ELEMENT_ARRAY_BUFFER?this._indexType===h.UNSIGNED_INT?4*this._size:2*this._size:this._size}get _isVAOAware(){return this.bufferType===f.ELEMENT_ARRAY_BUFFER||this.bufferType===f.ARRAY_BUFFER}dispose(){var t;if(null!=(t=this._context)&&t.gl){if(this._glName){this._context.gl.deleteBuffer(this._glName),this._glName=null}this._context.instanceCounter.decrement(o.Buffer,this),this._context=null}else this._glName&&a.warn("Leaked WebGL buffer object")}setSize(t,i=null){if(t<=0&&a.error("Buffer size needs to be positive!"),this.bufferType===f.ELEMENT_ARRAY_BUFFER&&e(i))switch(this._indexType=i,i){case h.UNSIGNED_SHORT:t*=2;break;case h.UNSIGNED_INT:t*=4}this._setBufferData(t)}setData(t){if(!t)return;let e=t.byteLength;this.bufferType===f.ELEMENT_ARRAY_BUFFER&&(i(t)&&(e/=2,this._indexType=h.UNSIGNED_SHORT),s(t)&&(e/=4,this._indexType=h.UNSIGNED_INT)),this._setBufferData(e,t)}_setBufferData(t,i=null){this._size=t;const s=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const n=this._context.gl;e(i)?n.bufferData(this.bufferType,i,this.usage):n.bufferData(this.bufferType,t,this.usage),r(n),this._isVAOAware&&this._context.bindVAO(s)}setSubData(t,e=0,n=0,o=t.byteLength){if(!t)return;(e<0||e>=this._size)&&a.error("offset is out of range!");let _=e,h=n,u=o,c=t.byteLength;this.bufferType===f.ELEMENT_ARRAY_BUFFER&&(i(t)?(c/=2,_*=2,h*=2,u*=2):s(t)&&(c/=4,_*=4,h*=4,u*=4)),void 0===o&&(o=c-1),n>=o&&a.error("end must be bigger than start!"),e+n-o>this._size&&a.error("An attempt to write beyond the end of the buffer!");const b=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const E=this._context.gl,A=ArrayBuffer.isView(t)?t.buffer:t,l=0===h&&u===t.byteLength?A:A.slice(h,u);E.bufferSubData(this.bufferType,_,l),r(E),this._isVAOAware&&this._context.bindVAO(b)}setSubDataFromView(t,e,i,s){if(!t)return;(e<0||e>=this._size)&&a.error("offset is out of range!"),i>=s&&a.error("end must be bigger than start!"),e+i-s>this._size&&a.error("An attempt to write beyond the end of the buffer!");const f=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const o=this._context.gl;if(this._context.type===n.WEBGL2)o.bufferSubData(this.bufferType,e*t.BYTES_PER_ELEMENT,t,i,s-i);else{const r=0===i&&s===t.length?t:t.subarray(i,s);o.bufferSubData(this.bufferType,e*t.BYTES_PER_ELEMENT,r)}r(o),this._isVAOAware&&this._context.bindVAO(f)}getSubData(t,e=0,i,s){if(this._context.type!==n.WEBGL2)return void a.error("Get buffer subdata is only supported in WebGL2!");const r=this._context.gl;this._context.bindBuffer(this,f.COPY_READ_BUFFER),r.getBufferSubData(f.COPY_READ_BUFFER,e,t,i,s),this._context.unbindBuffer(f.COPY_READ_BUFFER)}async getSubDataAsync(t,e=0,i,s){this._context.type===n.WEBGL2?(await this._context.clientWaitAsync(),this.getSubData(t,e,i,s)):a.error("Get buffer subdata is only supported in WebGL2!")}}export{u as BufferObject};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{BlendFactor as t,BlendOperation as
|
|
5
|
+
import{BlendFactor as t,BlendOperation as i,Face as e,CullMode as s,CompareFunction as l,StencilOperation as r}from"./enums.js";class h{constructor(){this.blend=!1,this.blendColor={r:0,g:0,b:0,a:0},this.blendFunction={srcRGB:t.ONE,dstRGB:t.ZERO,srcAlpha:t.ONE,dstAlpha:t.ZERO},this.blendEquation={mode:i.ADD,modeAlpha:i.ADD},this.colorMask={r:!0,g:!0,b:!0,a:!0},this.faceCulling=!1,this.cullFace=e.BACK,this.frontFace=s.CCW,this.scissorTest=!1,this.scissorRect={x:0,y:0,width:0,height:0},this.depthTest=!1,this.depthFunction=l.LESS,this.clearDepth=1,this.depthWrite=!0,this.depthRange={zNear:0,zFar:1},this.viewport=null,this.stencilTest=!1,this.polygonOffsetFill=!1,this.polygonOffset=[0,0],this.stencilFunction={face:e.FRONT_AND_BACK,func:l.ALWAYS,ref:0,mask:1},this.clearStencil=0,this.stencilWriteMask=1,this.stencilOperation={face:e.FRONT_AND_BACK,fail:r.KEEP,zFail:r.KEEP,zPass:r.KEEP},this.clearColor={r:0,g:0,b:0,a:0},this.program=null,this.vertexBuffer=null,this.indexBuffer=null,this.uniformBuffer=null,this.pixelPackBuffer=null,this.pixelUnpackBuffer=null,this.copyReadBuffer=null,this.copyWriteBuffer=null,this.uniformBufferBindingPoints=new Array,this.readFramebuffer=null,this.drawFramebuffer=null,this.renderbuffer=null,this.activeTexture=0,this.textureUnitMap=new Array}}export{h as ContextState};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../core/Logger.js";import{isSome as e,isNone as i}from"../../core/maybe.js";import{webglValidateShadersEnabled as r}from"./checkWebGLError.js";import{ResourceType as s,ColorAttachment as h,TargetType as n,DepthStencilTargetType as o,TextureType as c,PixelFormat as _,PixelType as a,DepthStencilAttachment as l,RenderbufferFormat as T,TextureSamplingMode as E,TextureWrapMode as d}from"./enums.js";import{Renderbuffer as u}from"./Renderbuffer.js";import{Texture as f}from"./Texture.js";import{getGpuMemoryUsage as m}from"./Util.js";const R=t.getLogger("esri.views.webgl.FrameBufferObject");class A{constructor(t,i,r=null,c=null){if(this._context=t,this._glName=null,this._depthAttachment=null,this._stencilAttachment=null,this._colorAttachments=new Map,this._initialized=!1,this._desc={...i},t.instanceCounter.increment(s.Framebuffer,this),e(r)){Array.isArray(r)||(r=[r]);for(let e=0;e<r.length;++e){var _,a;const i=r[e];let s;p(i)?(s=i.descriptor,this._colorAttachments.set(h.COLOR_ATTACHMENT0+e,i)):(s=i,this._colorAttachments.set(h.COLOR_ATTACHMENT0+e,new f(t,i))),(null==(_=this._desc)?void 0:_.colorTarget)!==n.TEXTURE&&(null==(a=this._desc)?void 0:a.colorTarget)!==n.CUBEMAP&&console.error("Framebuffer is initialized with a texture however the descriptor indicates using a renderbuffer color attachment!"),this._validateColorAttachmentPoint(h.COLOR_ATTACHMENT0+e),this._validateTextureDimensions(s,this._desc)}}if(c instanceof u){var l;const t=null!=(l=this._desc.depthStencilTarget)?l:o.DEPTH_STENCIL_RENDER_BUFFER;t===o.STENCIL_RENDER_BUFFER?this._stencilAttachment=c:t===o.DEPTH_RENDER_BUFFER||t===o.DEPTH_STENCIL_RENDER_BUFFER?this._depthAttachment=c:console.error('If a Renderbuffer is provided, "depthStencilTarget" must be one of STENCIL_RENDER_BUFFER, DEPTH_RENDER_BUFFER or DEPTH_STENCIL_RENDER_BUFFER'),N(c.descriptor,this._desc)}else if(e(c)){let t;this._context.capabilities.depthTexture||console.error("Extension WEBGL_depth_texture isn't supported therefore it is no possible to set the depth/stencil texture as an attachment!"),p(c)?(this._depthStencilTexture=c,t=c.descriptor):this._depthStencilTexture=new f(this._context,c),this._validateTextureDimensions(t,this._desc)}}dispose(){if(!this._desc)return;const t=this._context.getBoundFramebufferObject();if(this._disposeColorAttachments(),this._disposeDepthStencilAttachments(),this._glName){this._context.gl.deleteFramebuffer(this._glName),this._glName=null}this._context.bindFramebuffer(t),this._context.instanceCounter.decrement(s.Framebuffer,this),this._desc=null}get glName(){return this._glName}get descriptor(){return this._desc}get colorTexture(){const t=this._colorAttachments.get(h.COLOR_ATTACHMENT0);return t&&p(t)?t:null}get colorAttachment(){return this._colorAttachments.get(h.COLOR_ATTACHMENT0)}get depthStencilAttachment(){return this._depthStencilTexture||this._depthAttachment||this._stencilAttachment}get depthStencilTexture(){return this._depthStencilTexture}get width(){return this._desc.width}get height(){return this._desc.height}get gpuMemoryUsage(){return m(this.colorAttachment)+m(this.depthStencilAttachment)}getColorTexture(t){const e=this._colorAttachments.get(t);return e&&p(e)?e:null}framebufferTexture2D(t,e,i=h.COLOR_ATTACHMENT0,r=c.TEXTURE_2D,s=0){e.framebufferTexture2D(e.FRAMEBUFFER,i,r,t,s)}attachColorTexture(t,e=h.COLOR_ATTACHMENT0){if(!t)return;this._validateColorAttachmentPoint(e);const i=t.descriptor;this._validateTextureDimensions(i,this._desc),this._disposeColorAttachments(),this._initialized&&(this._context.bindFramebuffer(this),this.framebufferTexture2D(t.glName,this._context.gl,e)),this._colorAttachments.set(e,t)}detachColorTexture(t=h.COLOR_ATTACHMENT0){const e=this._colorAttachments.get(t);if(p(e)){const i=e;return this._initialized&&(this._context.bindFramebuffer(this),this.framebufferTexture2D(null,this._context.gl,t)),this._colorAttachments.delete(t),i}}attachDepthStencilTexture(t){if(i(t))return;const e=t.descriptor;e.pixelFormat!==_.DEPTH_STENCIL&&console.error("Depth/Stencil texture must have a pixel type of DEPTH_STENCIL!"),e.dataType!==a.UNSIGNED_INT_24_8&&console.error("Depth/Stencil texture must have data type of UNSIGNED_INT_24_8!"),this._context.capabilities.depthTexture||console.error("Extension WEBGL_depth_texture isn't supported therefore it is no possible to set the depth/stencil texture!"),this._validateTextureDimensions(e,this._desc),this._desc.depthStencilTarget&&this._desc.depthStencilTarget!==o.DEPTH_STENCIL_TEXTURE&&(this._desc.depthStencilTarget=o.DEPTH_STENCIL_TEXTURE),this._disposeDepthStencilAttachments(),this._initialized&&(this._context.bindFramebuffer(this),this.framebufferTexture2D(t.glName,this._context.gl,l)),this._depthStencilTexture=t}detachDepthStencilTexture(){const t=this._depthStencilTexture;return t&&this._initialized&&(this._context.bindFramebuffer(this),this.framebufferTexture2D(null,this._context.gl,l)),this._depthStencilTexture=null,t}attachDepthStencilBuffer(t){if(i(t))return;const e=t.descriptor;if(e.internalFormat!==T.DEPTH_STENCIL&&e.internalFormat!==T.DEPTH_COMPONENT16&&console.error("Depth/Stencil buffer must have correct internalFormat"),N(e,this._desc),this._disposeDepthStencilAttachments(),this._desc.depthStencilTarget=e.internalFormat===T.DEPTH_STENCIL?o.DEPTH_STENCIL_RENDER_BUFFER:o.DEPTH_RENDER_BUFFER,this._initialized){this._context.bindFramebuffer(this);const e=this._context.gl,i=this._desc.depthStencilTarget===o.DEPTH_RENDER_BUFFER?e.DEPTH_ATTACHMENT:e.DEPTH_STENCIL_ATTACHMENT;e.framebufferRenderbuffer(e.FRAMEBUFFER,i,e.RENDERBUFFER,t.glName)}this._depthAttachment=t}detachDepthStencilBuffer(){const t=this._context.gl,e=this._depthAttachment;if(e&&this._initialized){this._context.bindFramebuffer(this);const e=this._desc.depthStencilTarget===o.DEPTH_RENDER_BUFFER?t.DEPTH_ATTACHMENT:t.DEPTH_STENCIL_ATTACHMENT;t.framebufferRenderbuffer(t.FRAMEBUFFER,e,t.RENDERBUFFER,null)}return this._depthAttachment=null,e}detachAll(){this.detachColorTexture(),this.detachDepthStencilBuffer(),this.detachDepthStencilTexture()}copyToTexture(t,e,i,r,s,h,n){(t<0||e<0||s<0||h<0)&&console.error("Offsets cannot be negative!"),(i<=0||r<=0)&&console.error("Copy width and height must be greater than zero!");const o=this._desc,_=n.descriptor;n.descriptor.target!==c.TEXTURE_2D&&console.error("Texture target must be TEXTURE_2D!"),(t+i>o.width||e+r>o.height||s+i>_.width||h+r>_.height)&&console.error("Bad dimensions, the current input values will attempt to read or copy out of bounds!");const a=this._context,l=a.bindTexture(n,f.TEXTURE_UNIT_FOR_UPDATES);a.bindFramebuffer(this),a.gl.copyTexSubImage2D(c.TEXTURE_2D,0,s,h,t,e,i,r),a.bindTexture(l,f.TEXTURE_UNIT_FOR_UPDATES)}readPixels(t,e,i,r,s,h,n){(i<=0||r<=0)&&console.error("Copy width and height must be greater than zero!"),n||console.error("Target memory is not initialized!"),this._context.bindFramebuffer(this);this._context.gl.readPixels(t,e,i,r,s,h,n)}resize(t,e){const i=this._desc;if(i.width!==t||i.height!==e){if(!this._initialized)return i.width=t,i.height=e,this._colorAttachments.forEach((i=>{i&&i.resize(t,e)})),void(this._depthStencilTexture&&this._depthStencilTexture.resize(t,e));i.width=t,i.height=e,this._colorAttachments.forEach((i=>{i&&i.resize(t,e)})),null!=this._depthStencilTexture?this._depthStencilTexture.resize(t,e):(this._depthAttachment||this._stencilAttachment)&&(this._depthAttachment&&this._depthAttachment.resize(t,e),this._stencilAttachment&&this._stencilAttachment.resize(t,e)),this._context.getBoundFramebufferObject()===this&&this._context.bindFramebuffer(null),this._initialized=!1}}initializeAndBind(t=c.TEXTURE_2D){var e,i,s,l;const m=this._context.gl;if(this._initialized)return void m.bindFramebuffer(m.FRAMEBUFFER,this.glName);this._glName&&m.deleteFramebuffer(this._glName);const R=this._context,A=m.createFramebuffer(),N=this._desc,g=null!=(e=N.colorTarget)?e:n.RENDER_BUFFER,x=null!=(i=N.width)?i:1,D=null!=(s=N.height)?s:1;if(m.bindFramebuffer(m.FRAMEBUFFER,A),0===this._colorAttachments.size)if(g===n.TEXTURE)this._colorAttachments.set(h.COLOR_ATTACHMENT0,F(R,N,this.descriptor.colorTarget===n.CUBEMAP?c.TEXTURE_CUBE_MAP:c.TEXTURE_2D));else{const t=new u(R,{internalFormat:T.RGBA4,width:x,height:D});this._colorAttachments.set(h.COLOR_ATTACHMENT0,t)}this._colorAttachments.forEach(((e,i)=>{e&&(p(e)?this.framebufferTexture2D(e.glName,m,i,t):m.framebufferRenderbuffer(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.RENDERBUFFER,e.glName))}));const b=null!=(l=N.depthStencilTarget)?l:o.NONE;switch(b){case o.DEPTH_RENDER_BUFFER:case o.DEPTH_STENCIL_RENDER_BUFFER:{this._depthAttachment||(this._depthAttachment=new u(R,{internalFormat:N.depthStencilTarget===o.DEPTH_RENDER_BUFFER?T.DEPTH_COMPONENT16:T.DEPTH_STENCIL,width:x,height:D}));const t=b===o.DEPTH_RENDER_BUFFER?m.DEPTH_ATTACHMENT:m.DEPTH_STENCIL_ATTACHMENT;m.framebufferRenderbuffer(m.FRAMEBUFFER,t,m.RENDERBUFFER,this._depthAttachment.glName);break}case o.STENCIL_RENDER_BUFFER:this._stencilAttachment||(this._stencilAttachment=new u(R,{internalFormat:T.STENCIL_INDEX8,width:x,height:D})),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.STENCIL_ATTACHMENT,m.RENDERBUFFER,this._stencilAttachment.glName);break;case o.DEPTH_STENCIL_TEXTURE:if(!this._depthStencilTexture){R.capabilities.depthTexture||console.error("Extension WEBGL_depth_texture isn't supported therefore it is no possible to set the depth/stencil texture as an attachment!");const t={target:c.TEXTURE_2D,pixelFormat:_.DEPTH_STENCIL,dataType:a.UNSIGNED_INT_24_8,samplingMode:E.NEAREST,wrapMode:d.CLAMP_TO_EDGE,width:x,height:D};this._depthStencilTexture=new f(R,t)}this.framebufferTexture2D(this._depthStencilTexture.glName,m,m.DEPTH_STENCIL_ATTACHMENT,t)}if(r()){m.checkFramebufferStatus(m.FRAMEBUFFER)!==m.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!")}this._glName=A,this._initialized=!0}_disposeColorAttachments(){this._colorAttachments.forEach(((t,e)=>{if(p(t))this._initialized&&(this._context.bindFramebuffer(this),this.framebufferTexture2D(null,this._context.gl,e)),t.dispose();else if(t instanceof WebGLRenderbuffer){const i=this._context.gl;this._initialized&&(this._context.bindFramebuffer(this),i.framebufferRenderbuffer(i.FRAMEBUFFER,e,i.RENDERBUFFER,null)),this._context.gl.deleteRenderbuffer(t)}})),this._colorAttachments.clear()}_disposeDepthStencilAttachments(){const t=this._context.gl;if(this._depthAttachment){if(this._initialized){this._context.bindFramebuffer(this);const e=this._desc.depthStencilTarget===o.DEPTH_RENDER_BUFFER?t.DEPTH_ATTACHMENT:t.DEPTH_STENCIL_ATTACHMENT;t.framebufferRenderbuffer(t.FRAMEBUFFER,e,t.RENDERBUFFER,null)}this._depthAttachment.dispose(),this._depthAttachment=null}this._stencilAttachment&&(this._initialized&&(this._context.bindFramebuffer(this),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.STENCIL_ATTACHMENT,t.RENDERBUFFER,null)),this._stencilAttachment.dispose(),this._stencilAttachment=null),this._depthStencilTexture&&(this._initialized&&(this._context.bindFramebuffer(this),this.framebufferTexture2D(null,t,t.DEPTH_STENCIL_ATTACHMENT)),this._depthStencilTexture.dispose(),this._depthStencilTexture=null)}_validateTextureDimensions(t,e){t.target!==c.TEXTURE_2D&&t.target!==c.TEXTURE_CUBE_MAP&&console.error("Texture type must be TEXTURE_2D or TEXTURE_CUBE_MAP!"),void 0!==e.width&&e.width>=0&&void 0!==e.height&&e.height>=0?e.width===t.width&&e.height===t.height||console.error("Color attachment texture must match the framebuffer's!"):(e.width=t.width,e.height=t.height)}_validateColorAttachmentPoint(t){if(-1===A._MAX_COLOR_ATTACHMENTS){const t=this._context.capabilities.drawBuffers;if(t){const e=this._context.gl;A._MAX_COLOR_ATTACHMENTS=e.getParameter(t.MAX_COLOR_ATTACHMENTS)}else A._MAX_COLOR_ATTACHMENTS=1}const e=t-h.COLOR_ATTACHMENT0;e+1>A._MAX_COLOR_ATTACHMENTS&&R.error("esri.FrameBufferObject",`illegal attachment point for color attachment: ${e+1}. Implementation supports up to ${A._MAX_COLOR_ATTACHMENTS} color attachments`)}}function p(t){return"type"in t&&"texture"===t.type}function F(t,e,i){return new f(t,{target:i,pixelFormat:_.RGBA,dataType:a.UNSIGNED_BYTE,samplingMode:E.NEAREST,wrapMode:d.CLAMP_TO_EDGE,width:e.width,height:e.height})}function N(t,e){void 0!==e.width&&e.width>=0&&void 0!==e.height&&e.height>=0?e.width===t.width&&e.height===t.height||console.error("Renderbuffer dimensions must match the framebuffer's!"):(e.width=t.width,e.height=t.height)}A._MAX_COLOR_ATTACHMENTS=-1;export{A as FramebufferObject};
|
|
5
|
+
import t from"../../core/Logger.js";import{isSome as e,isNone as i}from"../../core/maybe.js";import{BufferObject as r}from"./BufferObject.js";import{webglDebugEnabled as s,webglValidateShadersEnabled as h}from"./checkWebGLError.js";import{ContextType as n}from"./context-util.js";import{ResourceType as c,ColorAttachment as o,DepthStencilTargetType as _,PixelFormat as a,PixelType as l,DepthStencilAttachment as T,RenderbufferFormat as E,FramebufferTarget as d,TextureType as u,Usage as f,BufferType as m,TargetType as A,TextureSamplingMode as p,TextureWrapMode as R,SizedPixelFormat as N}from"./enums.js";import{Renderbuffer as g}from"./Renderbuffer.js";import{Texture as F}from"./Texture.js";import{getGpuMemoryUsage as x}from"./Util.js";const b=t.getLogger("esri.views.webgl.FrameBufferObject");class D{constructor(t,i,r=null,s=null){if(this._context=t,this._glName=null,this._depthAttachment=null,this._stencilAttachment=null,this._colorAttachments=new Map,this._initialized=!1,this._desc={...i},t.instanceCounter.increment(c.Framebuffer,this),e(r)){Array.isArray(r)||(r=[r]);for(let t=0;t<r.length;++t){const e=r[t],i=o.COLOR_ATTACHMENT0+t;let s;U(e)?(C(e)?(s=e.descriptor,this._colorAttachments.set(i,e)):(s=e,this._colorAttachments.set(i,new F(this._context,s))),P(s,this._desc)):(S(e)?(s=e.descriptor,this._colorAttachments.set(i,e)):(s=e,this._colorAttachments.set(i,new g(this._context,s))),B(s,this._desc)),this._validateColorAttachmentPoint(i)}}if(e(s)){let t,e;if(U(s))this._context.capabilities.depthTexture||console.error("Setting the depth/stencil texture as an attachment requires WEBGL_depth_texture or WebGL2"),C(s)?(e=s.descriptor,this._depthStencilTexture=s):(e=s,this._depthStencilTexture=new F(this._context,e)),P(e,this._desc);else{var h;S(s)?(e=s.descriptor,t=s):(e=s,t=new g(this._context,e));const i=null!=(h=this._desc.depthStencilTarget)?h:_.DEPTH_STENCIL_RENDER_BUFFER;i===_.STENCIL_RENDER_BUFFER?this._stencilAttachment=t:i===_.DEPTH_RENDER_BUFFER||i===_.DEPTH_STENCIL_RENDER_BUFFER?this._depthAttachment=t:console.error('If a Renderbuffer is provided, "depthStencilTarget" must be one of STENCIL_RENDER_BUFFER, DEPTH_RENDER_BUFFER or DEPTH_STENCIL_RENDER_BUFFER'),B(e,this._desc)}}}dispose(){if(!this._desc)return;const t=this._context.getBoundFramebufferObject();if(this._disposeColorAttachments(),this._disposeDepthStencilAttachments(),this._glName){this._context.gl.deleteFramebuffer(this._glName),this._glName=null}this._context.bindFramebuffer(t),this._context.instanceCounter.decrement(c.Framebuffer,this),this._desc=null}get glName(){return this._glName}get descriptor(){return this._desc}get colorTexture(){const t=this._colorAttachments.get(o.COLOR_ATTACHMENT0);return t&&C(t)?t:null}get colorAttachment(){return this._colorAttachments.get(o.COLOR_ATTACHMENT0)}get depthStencilAttachment(){return this._depthStencilTexture||this._depthAttachment||this._stencilAttachment}get depthStencilTexture(){return this._depthStencilTexture}get width(){return this._desc.width}get height(){return this._desc.height}get gpuMemoryUsage(){return[...this._colorAttachments].reduce(((t,[e,i])=>t+x(i)),0)+x(this.depthStencilAttachment)}getColorTexture(t){const e=this._colorAttachments.get(t);return e&&C(e)?e:null}attachColorTexture(t,e=o.COLOR_ATTACHMENT0){if(!t)return;this._validateColorAttachmentPoint(e);P(t.descriptor,this._desc),this._disposeColorAttachments(),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(t.glName,e)),this._colorAttachments.set(e,t)}detachColorTexture(t=o.COLOR_ATTACHMENT0){const e=this._colorAttachments.get(t);if(C(e)){const i=e;return this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,t)),this._colorAttachments.delete(t),i}}setColorTextureTarget(t,e=o.COLOR_ATTACHMENT0){const i=this._colorAttachments.get(e);C(i)&&this._framebufferTexture2D(i.glName,e,t)}attachDepthStencilTexture(t){if(i(t))return;const e=t.descriptor;e.pixelFormat!==a.DEPTH_STENCIL&&console.error("Depth/Stencil texture must have a pixel type of DEPTH_STENCIL!"),e.dataType!==l.UNSIGNED_INT_24_8&&console.error("Depth/Stencil texture must have data type of UNSIGNED_INT_24_8!"),this._context.capabilities.depthTexture||console.error("Extension WEBGL_depth_texture isn't supported therefore it is no possible to set the depth/stencil texture!"),P(e,this._desc),this._desc.depthStencilTarget&&this._desc.depthStencilTarget!==_.DEPTH_STENCIL_TEXTURE&&(this._desc.depthStencilTarget=_.DEPTH_STENCIL_TEXTURE),this._disposeDepthStencilAttachments(),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(t.glName,T)),this._depthStencilTexture=t}detachDepthStencilTexture(){const t=this._depthStencilTexture;return t&&this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,T)),this._depthStencilTexture=null,t}attachDepthStencilBuffer(t){if(i(t))return;const e=t.descriptor;if(e.internalFormat!==E.DEPTH_STENCIL&&e.internalFormat!==E.DEPTH_COMPONENT16&&console.error("Depth/Stencil buffer must have correct internalFormat"),B(e,this._desc),this._disposeDepthStencilAttachments(),this._desc.depthStencilTarget=e.internalFormat===E.DEPTH_STENCIL?_.DEPTH_STENCIL_RENDER_BUFFER:_.DEPTH_RENDER_BUFFER,this._initialized){this._context.bindFramebuffer(this);const e=this._context.gl,i=this._desc.depthStencilTarget===_.DEPTH_RENDER_BUFFER?e.DEPTH_ATTACHMENT:e.DEPTH_STENCIL_ATTACHMENT;e.framebufferRenderbuffer(d.FRAMEBUFFER,i,e.RENDERBUFFER,t.glName)}this._depthAttachment=t}detachDepthStencilBuffer(){const t=this._context.gl,e=this._depthAttachment;if(e&&this._initialized){this._context.bindFramebuffer(this);const e=this._desc.depthStencilTarget===_.DEPTH_RENDER_BUFFER?t.DEPTH_ATTACHMENT:t.DEPTH_STENCIL_ATTACHMENT;t.framebufferRenderbuffer(d.FRAMEBUFFER,e,t.RENDERBUFFER,null)}return this._depthAttachment=null,e}detachAll(){this._colorAttachments.forEach(((t,e)=>this._detachColorAttachment(e))),this.detachDepthStencilBuffer(),this.detachDepthStencilTexture()}copyToTexture(t,e,i,r,s,h,n){(t<0||e<0||s<0||h<0)&&console.error("Offsets cannot be negative!"),(i<=0||r<=0)&&console.error("Copy width and height must be greater than zero!");const c=this._desc,o=n.descriptor;n.descriptor.target!==u.TEXTURE_2D&&console.error("Texture target must be TEXTURE_2D!"),(t+i>c.width||e+r>c.height||s+i>o.width||h+r>o.height)&&console.error("Bad dimensions, the current input values will attempt to read or copy out of bounds!");const _=this._context,a=_.bindTexture(n,F.TEXTURE_UNIT_FOR_UPDATES);_.setActiveTexture(F.TEXTURE_UNIT_FOR_UPDATES),_.bindFramebuffer(this),_.gl.copyTexSubImage2D(u.TEXTURE_2D,0,s,h,t,e,i,r),_.bindTexture(a,F.TEXTURE_UNIT_FOR_UPDATES)}readPixels(t,e,i,r,s,h,n){(i<=0||r<=0)&&console.error("Copy width and height must be greater than zero!"),n||console.error("Target memory is not initialized!"),this._context.bindFramebuffer(this);this._context.gl.readPixels(t,e,i,r,s,h,n)}async readPixelsAsync(t,e,i,h,c,o,_){if(this._context.type!==n.WEBGL2)return s()&&console.warn("Attempting to read pixels using pixel buffer object without WebGL2"),void this.readPixels(t,e,i,h,c,o,_);const a=this._context.gl,l=r.createPixelPack(this._context,f.STREAM_READ,_.byteLength);this._context.bindBuffer(l),this._context.bindFramebuffer(this),a.readPixels(t,e,i,h,c,o,0),this._context.unbindBuffer(m.PIXEL_PACK_BUFFER),await l.getSubDataAsync(_),l.dispose()}resize(t,e){const i=this._desc;if(i.width!==t||i.height!==e){if(!this._initialized)return i.width=t,i.height=e,this._colorAttachments.forEach((i=>{i&&i.resize(t,e)})),void(this._depthStencilTexture&&this._depthStencilTexture.resize(t,e));i.width=t,i.height=e,this._colorAttachments.forEach((i=>{i&&i.resize(t,e)})),null!=this._depthStencilTexture?this._depthStencilTexture.resize(t,e):(this._depthAttachment||this._stencilAttachment)&&(this._depthAttachment&&this._depthAttachment.resize(t,e),this._stencilAttachment&&this._stencilAttachment.resize(t,e)),this._context.getBoundFramebufferObject()===this&&this._context.bindFramebuffer(null),this._initialized=!1}}initializeAndBind(t=d.FRAMEBUFFER){var e,i,r,s;const n=this._context.gl;if(this._initialized)return void n.bindFramebuffer(t,this.glName);this._glName&&n.deleteFramebuffer(this._glName);const c=this._context,T=n.createFramebuffer(),f=this._desc,m=null!=(e=f.colorTarget)?e:A.RENDER_BUFFER,x=null!=(i=f.width)?i:1,b=null!=(r=f.height)?r:1;if(n.bindFramebuffer(t,T),0===this._colorAttachments.size)if(m===A.TEXTURE||m===A.CUBEMAP)this._colorAttachments.set(o.COLOR_ATTACHMENT0,H(c,f,this.descriptor.colorTarget===A.CUBEMAP?u.TEXTURE_CUBE_MAP:u.TEXTURE_2D));else{const t=new g(c,{internalFormat:N.RGBA4,width:x,height:b});this._colorAttachments.set(o.COLOR_ATTACHMENT0,t)}this._colorAttachments.forEach(((e,i)=>{e&&(C(e)?this._framebufferTexture2D(e.glName,i,M(e),t):n.framebufferRenderbuffer(t,i,n.RENDERBUFFER,e.glName))}));const D=null!=(s=f.depthStencilTarget)?s:_.NONE;switch(D){case _.DEPTH_RENDER_BUFFER:case _.DEPTH_STENCIL_RENDER_BUFFER:{this._depthAttachment||(this._depthAttachment=new g(c,{internalFormat:f.depthStencilTarget===_.DEPTH_RENDER_BUFFER?E.DEPTH_COMPONENT16:E.DEPTH_STENCIL,width:x,height:b}));const e=D===_.DEPTH_RENDER_BUFFER?n.DEPTH_ATTACHMENT:n.DEPTH_STENCIL_ATTACHMENT;n.framebufferRenderbuffer(t,e,n.RENDERBUFFER,this._depthAttachment.glName);break}case _.STENCIL_RENDER_BUFFER:this._stencilAttachment||(this._stencilAttachment=new g(c,{internalFormat:E.STENCIL_INDEX8,width:x,height:b})),n.framebufferRenderbuffer(t,n.STENCIL_ATTACHMENT,n.RENDERBUFFER,this._stencilAttachment.glName);break;case _.DEPTH_STENCIL_TEXTURE:if(!this._depthStencilTexture){c.capabilities.depthTexture||console.error("Extension WEBGL_depth_texture isn't supported therefore it is no possible to set the depth/stencil texture as an attachment!");const t={target:u.TEXTURE_2D,pixelFormat:a.DEPTH_STENCIL,dataType:l.UNSIGNED_INT_24_8,samplingMode:p.NEAREST,wrapMode:R.CLAMP_TO_EDGE,width:x,height:b};this._depthStencilTexture=new F(c,t)}this._framebufferTexture2D(this._depthStencilTexture.glName,n.DEPTH_STENCIL_ATTACHMENT,M(this._depthStencilTexture),t)}if(h()){n.checkFramebufferStatus(t)!==n.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!")}this._glName=T,this._initialized=!0}_framebufferTexture2D(t,e=o.COLOR_ATTACHMENT0,i=u.TEXTURE_2D,r=d.FRAMEBUFFER,s=0){this._context.gl.framebufferTexture2D(r,e,i,t,s)}_detachColorAttachment(t){s()&&console.warn("Detaching an FBO attachment can be a slow due to invalidating framebuffer completeness!");const e=this._context.gl,i=this._colorAttachments.get(t);return C(i)?this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,t)):this._initialized&&(this._context.bindFramebuffer(this),e.framebufferRenderbuffer(d.FRAMEBUFFER,t,e.RENDERBUFFER,null)),this._colorAttachments.delete(t),i}_disposeColorAttachments(){this._colorAttachments.forEach(((t,e)=>{this._detachColorAttachment(e),t.dispose()})),this._colorAttachments.clear()}_disposeDepthStencilAttachments(){const t=this._context.gl;if(this._depthAttachment){if(this._initialized){this._context.bindFramebuffer(this);const e=this._desc.depthStencilTarget===_.DEPTH_RENDER_BUFFER?t.DEPTH_ATTACHMENT:t.DEPTH_STENCIL_ATTACHMENT;t.framebufferRenderbuffer(d.FRAMEBUFFER,e,t.RENDERBUFFER,null)}this._depthAttachment.dispose(),this._depthAttachment=null}this._stencilAttachment&&(this._initialized&&(this._context.bindFramebuffer(this),t.framebufferRenderbuffer(d.FRAMEBUFFER,t.STENCIL_ATTACHMENT,t.RENDERBUFFER,null)),this._stencilAttachment.dispose(),this._stencilAttachment=null),this._depthStencilTexture&&(this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,t.DEPTH_STENCIL_ATTACHMENT)),this._depthStencilTexture.dispose(),this._depthStencilTexture=null)}_validateColorAttachmentPoint(t){if(-1===D._MAX_COLOR_ATTACHMENTS){const t=this._context.capabilities.drawBuffers;if(t){const e=this._context.gl;D._MAX_COLOR_ATTACHMENTS=e.getParameter(t.MAX_COLOR_ATTACHMENTS)}else D._MAX_COLOR_ATTACHMENTS=1}const e=t-o.COLOR_ATTACHMENT0;e+1>D._MAX_COLOR_ATTACHMENTS&&b.error("esri.FrameBufferObject",`illegal attachment point for color attachment: ${e+1}. Implementation supports up to ${D._MAX_COLOR_ATTACHMENTS} color attachments`)}}function C(t){return"type"in t&&"texture"===t.type}function S(t){return"type"in t&&"renderbuffer"===t.type}function U(t){return C(t)||"pixelFormat"in t}function H(t,e,i){return new F(t,{target:i,pixelFormat:a.RGBA,dataType:l.UNSIGNED_BYTE,samplingMode:p.NEAREST,wrapMode:R.CLAMP_TO_EDGE,width:e.width,height:e.height})}function P(t,e){t.target!==u.TEXTURE_2D&&t.target!==u.TEXTURE_CUBE_MAP&&console.error("Texture type must be TEXTURE_2D or TEXTURE_CUBE_MAP!"),void 0!==e.width&&e.width>=0&&void 0!==e.height&&e.height>=0?e.width===t.width&&e.height===t.height||console.error("Color attachment texture must match the framebuffer's!"):(e.width=t.width,e.height=t.height)}function B(t,e){void 0!==e.width&&e.width>=0&&void 0!==e.height&&e.height>=0?e.width===t.width&&e.height===t.height||console.error("Renderbuffer dimensions must match the framebuffer's!"):(e.width=t.width,e.height=t.height)}function M(t){return t.descriptor.target===u.TEXTURE_CUBE_MAP?u.TEXTURE_CUBE_MAP_POSITIVE_X:u.TEXTURE_2D}D._MAX_COLOR_ATTACHMENTS=-1;export{D as FramebufferObject};
|
package/views/webgl/Program.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../core/has.js";import{isSome as t,isNone as o}from"../../core/maybe.js";import{webglValidateShadersEnabled as i}from"./checkWebGLError.js";import{ContextType as
|
|
5
|
+
import"../../core/has.js";import{isSome as t,isNone as o}from"../../core/maybe.js";import{webglValidateShadersEnabled as i}from"./checkWebGLError.js";import{ContextType as n}from"./context-util.js";import{ShaderType as r,ResourceType as e}from"./enums.js";import{transpileShader as s}from"./ShaderTranspiler.js";const m=4294967295;class a{constructor(t,o,m,a,f=new Map){this._context=t,this._locations=a,this._uniformBlockBindings=f,this._refCount=1,this._nameToUniformLocation={},this._nameToUniform1={},this._nameToUniform1v={},this._nameToUniform2={},this._nameToUniform3={},this._nameToUniform4={},this._nameToUniformMatrix3={},this._nameToUniformMatrix4={},t||console.error("RenderingContext isn't initialized!"),0===o.length&&console.error("Shaders source should not be empty!"),this._context.type===n.WEBGL2&&(o=s(o,r.VERTEX_SHADER),m=s(m,r.FRAGMENT_SHADER)),this._vShader=h(this._context,r.VERTEX_SHADER,o),this._fShader=h(this._context,r.FRAGMENT_SHADER,m),this._vShader&&this._fShader||console.error("Error loading shaders!"),this._context.instanceCounter.increment(e.Shader,this),i()&&(this.vertexShader=o,this.fragmentShader=m)}get glName(){if(t(this._glName))return this._glName;if(o(this._vShader))return null;const r=this._context.gl,s=r.createProgram();if(r.attachShader(s,this._vShader),r.attachShader(s,this._fShader),this._locations.forEach(((t,o)=>r.bindAttribLocation(s,t,o))),r.linkProgram(s),i()&&!r.getProgramParameter(s,r.LINK_STATUS)&&console.error(`Could not link shader\nvalidated: ${r.getProgramParameter(s,r.VALIDATE_STATUS)}, gl error ${r.getError()}, vertex: ${r.getShaderParameter(this._vShader,r.COMPILE_STATUS)}, fragment: ${r.getShaderParameter(this._fShader,r.COMPILE_STATUS)}, info log: ${r.getProgramInfoLog(s)}`),this._context.type===n.WEBGL2){const t=r;for(const[o,i]of this._uniformBlockBindings){const n=t.getUniformBlockIndex(s,o);n<m&&t.uniformBlockBinding(s,n,i)}}return this._glName=s,this._context.instanceCounter.increment(e.Program,this),s}get hasGLName(){return t(this._glName)}dispose(){if(--this._refCount>0)return;const t=this._context.gl;this._vShader&&(t.deleteShader(this._vShader),this._vShader=null,this._context.instanceCounter.decrement(e.Shader,this)),this._fShader&&(t.deleteShader(this._fShader),this._fShader=null),this._glName&&(t.deleteProgram(this._glName),this._glName=null,this._context.instanceCounter.decrement(e.Program,this))}ref(){++this._refCount}_getUniformLocation(t){return void 0===this._nameToUniformLocation[t]&&(this._nameToUniformLocation[t]=this._context.gl.getUniformLocation(this.glName,t),i()&&null===this._nameToUniformLocation[t]&&console.error(`Uniform ${t} not found in Program:\n${this.vertexShader}\n${this.fragmentShader} `)),this._nameToUniformLocation[t]}setUniform1i(t,o){const i=this._nameToUniform1[t];if(void 0===i||o!==i){this._context.gl.uniform1i(this._getUniformLocation(t),o),this._nameToUniform1[t]=o}}setUniform1iv(t,o){const i=this._nameToUniform1v[t];if(f(i,o)){this._context.gl.uniform1iv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform1v[t]=Array.from(o):g(o,i)}}setUniform2iv(t,o){const i=this._nameToUniform2[t];if(f(i,o)){this._context.gl.uniform2iv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform2[t]=Array.from(o):g(o,i)}}setUniform3iv(t,o){const i=this._nameToUniform3[t];if(f(i,o)){this._context.gl.uniform3iv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform3[t]=Array.from(o):g(o,i)}}setUniform4iv(t,o){const i=this._nameToUniform4[t];if(f(i,o)){this._context.gl.uniform4iv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform4[t]=Array.from(o):g(o,i)}}setUniform1f(t,o){const i=this._nameToUniform1[t];if(void 0===i||o!==i){this._context.gl.uniform1f(this._getUniformLocation(t),o),this._nameToUniform1[t]=o}}setUniform1fv(t,o){const i=this._nameToUniform1v[t];if(f(i,o)){this._context.gl.uniform1fv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform1v[t]=Array.from(o):g(o,i)}}setUniform2f(t,o,i){const n=this._nameToUniform2[t];if(void 0===n||o!==n[0]||i!==n[1]){this._context.gl.uniform2f(this._getUniformLocation(t),o,i),void 0===n?this._nameToUniform2[t]=[o,i]:(n[0]=o,n[1]=i)}}setUniform2fv(t,o){const i=this._nameToUniform2[t];if(f(i,o)){this._context.gl.uniform2fv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform2[t]=Array.from(o):g(o,i)}}setUniform3f(t,o,i,n){const r=this._nameToUniform3[t];if(void 0===r||o!==r[0]||i!==r[1]||n!==r[2]){this._context.gl.uniform3f(this._getUniformLocation(t),o,i,n),void 0===r?this._nameToUniform3[t]=[o,i,n]:(r[0]=o,r[1]=i,r[2]=n)}}setUniform3fv(t,o){const i=this._nameToUniform3[t];if(f(i,o)){this._context.gl.uniform3fv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform3[t]=Array.from(o):g(o,i)}}setUniform4f(t,o,i,n,r){const e=this._nameToUniform4[t];if(void 0===e||o!==e[0]||i!==e[1]||n!==e[2]||r!==e[3]){this._context.gl.uniform4f(this._getUniformLocation(t),o,i,n,r),void 0===e?this._nameToUniform4[t]=[o,i,n,r]:(e[0]=o,e[1]=i,e[2]=n,e[3]=r)}}setUniform4fv(t,o){const i=this._nameToUniform4[t];if(f(i,o)){this._context.gl.uniform4fv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform4[t]=Array.from(o):g(o,i)}}setUniformMatrix3fv(t,o,i=!1){const n=this._nameToUniformMatrix3[t];if(l(n,o)){this._context.gl.uniformMatrix3fv(this._getUniformLocation(t),i,o),void 0===n?this._nameToUniformMatrix3[t]=Array.from(o):g(o,n)}}setUniformMatrix4fv(t,o,i=!1){const n=this._nameToUniformMatrix4[t];if(U(n,o)){this._context.gl.uniformMatrix4fv(this._getUniformLocation(t),i,o),void 0===n?this._nameToUniformMatrix4[t]=Array.from(o):g(o,n)}}stop(){}}function f(t,i){if(o(t)||t.length!==i.length)return!0;for(let o=0;o<t.length;++o)if(t[o]!==i[o])return!0;return!1}function h(t,o,e){const s=t.gl,m=s.createShader(o);return s.shaderSource(m,e),s.compileShader(m),i()&&!s.getShaderParameter(m,s.COMPILE_STATUS)&&(console.error("Compile error in ".concat(o===r.VERTEX_SHADER?"vertex":"fragment"," shader")),console.error(s.getShaderInfoLog(m)),console.error(c(e)),t.type===n.WEBGL2&&(console.log("Shader source before transpilation:"),console.log(e))),m}function c(t){let o=2;return t.replace(/\n/g,(()=>"\n"+_(o++)+":"))}function _(t){return t>=1e3?t.toString():(" "+t).slice(-3)}function g(t,o){for(let i=0;i<t.length;++i)o[i]=t[i]}function l(t,i){return!!o(t)||(9!==t.length?f(t,i):9!==t.length||t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2]||t[3]!==i[3]||t[4]!==i[4]||t[5]!==i[5]||t[6]!==i[6]||t[7]!==i[7]||t[8]!==i[8])}function U(t,i){return!!o(t)||(16!==t.length?f(t,i):16!==t.length||t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2]||t[3]!==i[3]||t[4]!==i[4]||t[5]!==i[5]||t[6]!==i[6]||t[7]!==i[7]||t[8]!==i[8]||t[9]!==i[9]||t[10]!==i[10]||t[11]!==i[11]||t[12]!==i[12]||t[13]!==i[13]||t[14]!==i[14]||t[15]!==i[15])}export{a as Program};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{isSome as r}from"../../core/maybe.js";import{NestedMap as t}from"../../core/NestedMap.js";import{Program as e}from"./Program.js";class s{constructor(r){this._rctx=r,this._store=new t}dispose(){this._store.forEach((r=>r.forEach((r=>r.dispose())))),this._store.clear()}acquire(t,s,o,c){const i=this._store.get(t,s);if(r(i))return i.ref(),i;const h=new e(this._rctx,t,s,o,c);return h.ref(),this._store.set(t,s,h),h}get test(){let r=0;return this._store.forEach((t=>t.forEach((t=>r+=t.hasGLName?2:1)))),{cachedWebGLObjects:r}}}export{s as ProgramCache};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{Program as r}from"./Program.js";function e(e,t,
|
|
5
|
+
import{Program as r}from"./Program.js";function e(e,t,a=""){return new r(e,a+t.shaders.vertexShader,a+t.shaders.fragmentShader,t.attributes)}export{e as createProgram};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ResourceType as t}from"./enums.js";class
|
|
5
|
+
import{ContextType as e}from"./context-util.js";import{ResourceType as t}from"./enums.js";class r{constructor(r,s){this._context=r,this._desc=s,this.type="renderbuffer",this._context.instanceCounter.increment(t.Renderbuffer,this);const i=this._context.gl;this.glName=i.createRenderbuffer(),this._context.bindRenderbuffer(this);const{width:n,height:h,internalFormat:o,multisampled:a}=s;if(a){if(this._context.type!==e.WEBGL2)throw new Error("Multisampled renderbuffers are not supported in WebGL1!");i.renderbufferStorageMultisample(i.RENDERBUFFER,this.samples,o,n,h)}else i.renderbufferStorage(i.RENDERBUFFER,o,n,h)}get descriptor(){return this._desc}get samples(){const e=this._desc.samples,t=this._context.parameters.maxSamples;return e?Math.min(e,t):t}resize(e,t){const r=this._desc;if(r.width===e&&r.height===t)return;r.width=e,r.height=t;const s=this._context.gl;if(this._context.bindRenderbuffer(this),r.multisampled){s.renderbufferStorageMultisample(s.RENDERBUFFER,this.samples,r.internalFormat,r.width,r.height)}else s.renderbufferStorage(s.RENDERBUFFER,r.internalFormat,r.width,r.height)}dispose(){this._context&&(this._context.gl.deleteRenderbuffer(this.glName),this._context.instanceCounter.decrement(t.Renderbuffer,this),this._context=null)}}export{r as Renderbuffer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isSome as t,isNone as e}from"../../core/maybe.js";import{NestedMap as s}from"../../core/NestedMap.js";import{webglDebugEnabled as i}from"./checkWebGLError.js";import{ContextType as a}from"./context-util.js";import{ContextState as n}from"./ContextState.js";import{BufferType as r,Face as l,BASE_TEXTURE_UNIT as h,ClearBufferBit as o,TextureType as c,BlendFactor as _,BlendOperation as u,CullMode as d,CompareFunction as f,StencilOperation as g,PrimitiveType as p}from"./enums.js";import{InstanceCounter as b}from"./InstanceCounter.js";import{Program as T}from"./Program.js";import{StateTracker as E}from"./renderState.js";import{Texture as F}from"./Texture.js";import{WebGLDriverTest as m}from"./WebGLDriverTest.js";import{Capabilities as x}from"./capabilities/Capabilities.js";import R from"./capabilities/isWebGL2Context.js";class O{constructor(t,e){this.gl=t,this.instanceCounter=new b,this._state=new n,this._programCache=new s,this._numOfDrawCalls=0,this._numOfTriangles=0,this.type=R(t)?a.WEBGL2:a.WEBGL1,this._loadExtensions(),this.configure(e)}configure(t){this._capabilities=new x(this.gl,t),this._parameters=this._loadParameters(t);const e=this.gl.getParameter(this.gl.VIEWPORT);this._state=new n,this._state.viewport={x:e[0],y:e[1],width:e[2],height:e[3]},this._stateTracker=new E({setBlending:t=>{if(t){this.setBlendingEnabled(!0),this.setBlendEquationSeparate(t.opRgb,t.opAlpha),this.setBlendFunctionSeparate(t.srcRgb,t.dstRgb,t.srcAlpha,t.dstAlpha);const e=t.color;this.setBlendColor(e.r,e.g,e.b,e.a)}else this.setBlendingEnabled(!1)},setCulling:t=>{t?(this.setFaceCullingEnabled(!0),this.setCullFace(t.face),this.setFrontFace(t.mode)):this.setFaceCullingEnabled(!1)},setPolygonOffset:t=>{t?(this.setPolygonOffsetFillEnabled(!0),this.setPolygonOffset(t.factor,t.units)):this.setPolygonOffsetFillEnabled(!1)},setDepthTest:t=>{t?(this.setDepthTestEnabled(!0),this.setDepthFunction(t.func)):this.setDepthTestEnabled(!1)},setStencilTest:t=>{if(t){this.setStencilTestEnabled(!0);const e=t.function;this.setStencilFunction(e.func,e.ref,e.mask);const s=t.operation;this.setStencilOp(s.fail,s.zFail,s.zPass)}else this.setStencilTestEnabled(!1)},setDepthWrite:t=>{t?(this.setDepthWriteEnabled(!0),this.setDepthRange(t.zNear,t.zFar)):this.setDepthWriteEnabled(!1)},setColorWrite:t=>{t?this.setColorMask(t.r,t.g,t.b,t.a):this.setColorMask(!1,!1,!1,!1)},setStencilWrite:t=>{t?this.setStencilWriteMask(t.mask):this.setStencilWriteMask(0)}}),this.enforceState(),this._driverTest=new m(this)}get driverTest(){return this._driverTest}get contextAttributes(){return this.gl.getContextAttributes()}get parameters(){return this._parameters}dispose(){this._programCache.forEach((t=>t.forEach((t=>t.dispose())))),this._programCache.clear(),this.bindVAO(null),this.unbindBuffer(r.ARRAY_BUFFER),this.unbindBuffer(r.ELEMENT_ARRAY_BUFFER),this._state.textureUnitMap.length=0,i()&&this.instanceCounter.printResourceCount()}setPipelineState(t){this._stateTracker.setPipeline(t)}setBlendingEnabled(t){this._state.blend!==t&&(!0===t?this.gl.enable(this.gl.BLEND):this.gl.disable(this.gl.BLEND),this._state.blend=t,this._stateTracker.invalidateBlending())}externalProgramUpdate(){var t;null==(t=this._state.program)||t.stop(),this._state.program=null}externalTextureUnitUpdate(t,e){for(let s=0;s<t.length;++s)this._state.textureUnitMap[t[s]]=null;e>=0&&(this._state.activeTexture=e)}externalVertexArrayObjectUpdate(){const t=this.capabilities.vao;t&&(t.bindVertexArray(null),this._state.vertexArrayObject=null),this._state.vertexBuffer=null,this._state.indexBuffer=null}externalVertexBufferUpdate(){this._state.vertexBuffer=null}externalIndexBufferUpdate(){this._state.indexBuffer=null}setBlendColor(t,e,s,i){t===this._state.blendColor.r&&e===this._state.blendColor.g&&s===this._state.blendColor.b&&i===this._state.blendColor.a||(this.gl.blendColor(t,e,s,i),this._state.blendColor.r=t,this._state.blendColor.g=e,this._state.blendColor.b=s,this._state.blendColor.a=i,this._stateTracker.invalidateBlending())}setBlendFunction(t,e){t===this._state.blendFunction.srcRGB&&e===this._state.blendFunction.dstRGB||(this.gl.blendFunc(t,e),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=t,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=e,this._stateTracker.invalidateBlending())}setBlendFunctionSeparate(t,e,s,i){this._state.blendFunction.srcRGB===t&&this._state.blendFunction.srcAlpha===s&&this._state.blendFunction.dstRGB===e&&this._state.blendFunction.dstAlpha===i||(this.gl.blendFuncSeparate(t,e,s,i),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=s,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=i,this._stateTracker.invalidateBlending())}setBlendEquation(t){this._state.blendEquation.mode!==t&&(this.gl.blendEquation(t),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=t,this._stateTracker.invalidateBlending())}setBlendEquationSeparate(t,e){this._state.blendEquation.mode===t&&this._state.blendEquation.modeAlpha===e||(this.gl.blendEquationSeparate(t,e),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=e,this._stateTracker.invalidateBlending())}setColorMask(t,e,s,i){this._state.colorMask.r===t&&this._state.colorMask.g===e&&this._state.colorMask.b===s&&this._state.colorMask.a===i||(this.gl.colorMask(t,e,s,i),this._state.colorMask.r=t,this._state.colorMask.g=e,this._state.colorMask.b=s,this._state.colorMask.a=i,this._stateTracker.invalidateColorWrite())}setClearColor(t,e,s,i){this._state.clearColor.r===t&&this._state.clearColor.g===e&&this._state.clearColor.b===s&&this._state.clearColor.a===i||(this.gl.clearColor(t,e,s,i),this._state.clearColor.r=t,this._state.clearColor.g=e,this._state.clearColor.b=s,this._state.clearColor.a=i)}setFaceCullingEnabled(t){this._state.faceCulling!==t&&(!0===t?this.gl.enable(this.gl.CULL_FACE):this.gl.disable(this.gl.CULL_FACE),this._state.faceCulling=t,this._stateTracker.invalidateCulling())}setPolygonOffsetFillEnabled(t){this._state.polygonOffsetFill!==t&&(!0===t?this.gl.enable(this.gl.POLYGON_OFFSET_FILL):this.gl.disable(this.gl.POLYGON_OFFSET_FILL),this._state.polygonOffsetFill=t,this._stateTracker.invalidatePolygonOffset())}setPolygonOffset(t,e){this._state.polygonOffset[0]===t&&this._state.polygonOffset[1]===e||(this._state.polygonOffset[0]=t,this._state.polygonOffset[1]=e,this.gl.polygonOffset(t,e),this._stateTracker.invalidatePolygonOffset())}setCullFace(t){this._state.cullFace!==t&&(this.gl.cullFace(t),this._state.cullFace=t,this._stateTracker.invalidateCulling())}setFrontFace(t){this._state.frontFace!==t&&(this.gl.frontFace(t),this._state.frontFace=t,this._stateTracker.invalidateCulling())}setScissorTestEnabled(t){this._state.scissorTest!==t&&(!0===t?this.gl.enable(this.gl.SCISSOR_TEST):this.gl.disable(this.gl.SCISSOR_TEST),this._state.scissorTest=t)}setScissorRect(t,e,s,i){this._state.scissorRect.x===t&&this._state.scissorRect.y===e&&this._state.scissorRect.width===s&&this._state.scissorRect.height===i||(this.gl.scissor(t,e,s,i),this._state.scissorRect.x=t,this._state.scissorRect.y=e,this._state.scissorRect.width=s,this._state.scissorRect.height=i)}setDepthTestEnabled(t){this._state.depthTest!==t&&(!0===t?this.gl.enable(this.gl.DEPTH_TEST):this.gl.disable(this.gl.DEPTH_TEST),this._state.depthTest=t,this._stateTracker.invalidateDepthTest())}setClearDepth(t){this._state.clearDepth!==t&&(this.gl.clearDepth(t),this._state.clearDepth=t)}setDepthFunction(t){this._state.depthFunction!==t&&(this.gl.depthFunc(t),this._state.depthFunction=t,this._stateTracker.invalidateDepthTest())}setDepthWriteEnabled(t){this._state.depthWrite!==t&&(this.gl.depthMask(t),this._state.depthWrite=t,this._stateTracker.invalidateDepthWrite())}setDepthRange(t,e){this._state.depthRange.zNear===t&&this._state.depthRange.zFar===e||(this.gl.depthRange(t,e),this._state.depthRange.zNear=t,this._state.depthRange.zFar=e,this._stateTracker.invalidateDepthWrite())}setStencilTestEnabled(t){this._state.stencilTest!==t&&(!0===t?this.gl.enable(this.gl.STENCIL_TEST):this.gl.disable(this.gl.STENCIL_TEST),this._state.stencilTest=t,this._stateTracker.invalidateStencilTest())}setClearStencil(t){t!==this._state.clearStencil&&(this.gl.clearStencil(t),this._state.clearStencil=t)}setStencilFunction(t,e,s){this._state.stencilFunction.func===t&&this._state.stencilFunction.ref===e&&this._state.stencilFunction.mask===s||(this.gl.stencilFunc(t,e,s),this._state.stencilFunction.face=l.FRONT_AND_BACK,this._state.stencilFunction.func=t,this._state.stencilFunction.ref=e,this._state.stencilFunction.mask=s,this._stateTracker.invalidateStencilTest())}setStencilFunctionSeparate(t,e,s,i){this._state.stencilFunction.face===t&&this._state.stencilFunction.func===e&&this._state.stencilFunction.ref===s&&this._state.stencilFunction.mask===i||(this.gl.stencilFuncSeparate(t,e,s,i),this._state.stencilFunction.face=t,this._state.stencilFunction.func=e,this._state.stencilFunction.ref=s,this._state.stencilFunction.mask=i,this._stateTracker.invalidateStencilTest())}setStencilWriteMask(t){this._state.stencilWriteMask!==t&&(this.gl.stencilMask(t),this._state.stencilWriteMask=t,this._stateTracker.invalidateStencilWrite())}setStencilOp(t,e,s){this._state.stencilOperation.face===l.FRONT_AND_BACK&&this._state.stencilOperation.fail===t&&this._state.stencilOperation.zFail===e&&this._state.stencilOperation.zPass===s||(this.gl.stencilOp(t,e,s),this._state.stencilOperation.face=l.FRONT_AND_BACK,this._state.stencilOperation.fail=t,this._state.stencilOperation.zFail=e,this._state.stencilOperation.zPass=s,this._stateTracker.invalidateStencilTest())}setStencilOpSeparate(t,e,s,i){this._state.stencilOperation.face===t&&this._state.stencilOperation.fail===e&&this._state.stencilOperation.zFail===s&&this._state.stencilOperation.zPass===i||(this.gl.stencilOpSeparate(t,e,s,i),this._state.stencilOperation.face=t,this._state.stencilOperation.fail=e,this._state.stencilOperation.zFail=s,this._state.stencilOperation.zPass=i,this._stateTracker.invalidateStencilTest())}setActiveTexture(t,e=!1){const s=this._state.activeTexture;return t>=0&&(e||t!==this._state.activeTexture)&&(this.gl.activeTexture(h+t),this._state.activeTexture=t),s}clear(t){t&&this.gl.clear(t)}clearSafe(t,e=255){t&&(t&o.COLOR_BUFFER_BIT&&this.setColorMask(!0,!0,!0,!0),t&o.DEPTH_BUFFER_BIT&&this.setDepthWriteEnabled(!0),t&o.STENCIL_BUFFER_BIT&&this.setStencilWriteMask(e),this.gl.clear(t))}drawArrays(t,e,s){i()&&(this._numOfDrawCalls++,this._numOfTriangles+=S(t,s)),this.gl.drawArrays(t,e,s)}drawElements(t,e,s,a){i()&&(this._numOfDrawCalls++,this._numOfTriangles+=S(t,e)),this.gl.drawElements(t,e,s,a)}logIno(){i()&&console.log(`DrawCalls: ${this._numOfDrawCalls}, Triangles: ${this._numOfTriangles}`)}get capabilities(){return this._capabilities}setViewport(t,e,s,i){s=Math.max(Math.round(s),1),i=Math.max(Math.round(i),1);const a=this._state.viewport;a.x===t&&a.y===e&&a.width===s&&a.height===i||(a.x=t,a.y=e,a.width=s,a.height=i,this.gl.viewport(t,e,s,i))}getViewport(){return{x:this._state.viewport.x,y:this._state.viewport.y,width:this._state.viewport.width,height:this._state.viewport.height}}newProgram(e,s,i){const a=this._programCache.get(e,s);if(t(a))return a.ref(),a;const n=new T(this,e,s,i);return n.ref(),this._programCache.set(e,s,n),n}useProgram(t){var e,s;this._state.program!==t&&(null==(e=this._state.program)||e.stop(),this._state.program=t,this.gl.useProgram(null!=(s=null==t?void 0:t.glName)?s:null))}bindTexture(s,i,a=!1){(i>=this.parameters.maxTextureImageUnits||i<0)&&console.error("Input texture unit is out of range of available units!");const n=this._state.textureUnitMap[i];return e(s)||null==s.glName?(t(n)&&(this.setActiveTexture(i,a),this.gl.bindTexture(n.descriptor.target,null)),this._state.textureUnitMap[i]=null,n):a||n!==s?(this.setActiveTexture(i,a),this.gl.bindTexture(s.descriptor.target,s.glName),s.applyChanges(),this._state.textureUnitMap[i]=s,n):(s.isDirty&&(this.setActiveTexture(i,a),s.applyChanges()),n)}unbindTextureAllUnits(t){for(let e=0;e<this.parameters.maxTextureImageUnits;e++)this._state.textureUnitMap[e]===t&&(this.bindTexture(null,e),this._state.textureUnitMap[e]=null)}bindFramebuffer(t,s=!1,i=c.TEXTURE_2D){if(e(t))return this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null),void(this._state.framebuffer=null);(s||this._state.framebuffer!==t)&&(t.initializeAndBind(i),this._state.framebuffer=t)}bindBuffer(t){t&&(t.bufferType===r.ARRAY_BUFFER?this._state.vertexBuffer=C(this.gl,t,t.bufferType,this._state.vertexBuffer):this._state.indexBuffer=C(this.gl,t,t.bufferType,this._state.indexBuffer))}bindRenderbuffer(t){const e=this.gl;t||(e.bindRenderbuffer(e.RENDERBUFFER,null),this._state.renderbuffer=null),this._state.renderbuffer!==t&&(e.bindRenderbuffer(e.RENDERBUFFER,t.glName),this._state.renderbuffer=t)}unbindBuffer(t){t===r.ARRAY_BUFFER?this._state.vertexBuffer=C(this.gl,null,t,this._state.vertexBuffer):this._state.indexBuffer=C(this.gl,null,t,this._state.indexBuffer)}bindVAO(t=null){e(t)?this._state.vertexArrayObject&&(this._state.vertexArrayObject.unbind(),this._state.vertexArrayObject=null):this._state.vertexArrayObject!==t&&(t.bind(),this._state.vertexArrayObject=t)}getBoundFramebufferObject(){return this._state.framebuffer}getBoundVAO(){return this._state.vertexArrayObject}resetState(){this.useProgram(null),this.bindVAO(null),this.bindFramebuffer(null),this.unbindBuffer(r.ARRAY_BUFFER),this.unbindBuffer(r.ELEMENT_ARRAY_BUFFER);for(let t=0;t<this.parameters.maxTextureImageUnits;++t)this.bindTexture(null,t);this.setBlendingEnabled(!1),this.setBlendFunction(_.ONE,_.ZERO),this.setBlendEquation(u.ADD),this.setBlendColor(0,0,0,0),this.setFaceCullingEnabled(!1),this.setCullFace(l.BACK),this.setFrontFace(d.CCW),this.setPolygonOffsetFillEnabled(!1),this.setPolygonOffset(0,0),this.setScissorTestEnabled(!1),this.setScissorRect(0,0,this.gl.canvas.width,this.gl.canvas.height),this.setDepthTestEnabled(!1),this.setDepthFunction(f.LESS),this.setDepthRange(0,1),this.setStencilTestEnabled(!1),this.setStencilFunction(f.ALWAYS,0,0),this.setStencilOp(g.KEEP,g.KEEP,g.KEEP),this.setClearColor(0,0,0,0),this.setClearDepth(1),this.setClearStencil(0),this.setColorMask(!0,!0,!0,!0),this.setStencilWriteMask(4294967295),this.setDepthWriteEnabled(!0),this.setViewport(0,0,this.gl.canvas.width,this.gl.canvas.height)}enforceState(){var e,s,a,n;const l=this.gl,o=this.capabilities.vao;o&&o.bindVertexArray(null);for(let t=0;t<this.parameters.maxVertexAttributes;t++)l.disableVertexAttribArray(t);if(this._state.vertexBuffer?l.bindBuffer(this._state.vertexBuffer.bufferType,this._state.vertexBuffer.glName):l.bindBuffer(r.ARRAY_BUFFER,null),this._state.indexBuffer?l.bindBuffer(this._state.indexBuffer.bufferType,this._state.indexBuffer.glName):l.bindBuffer(r.ELEMENT_ARRAY_BUFFER,null),o&&this._state.vertexArrayObject){const t=this._state.vertexArrayObject;this._state.vertexArrayObject&&(this._state.vertexArrayObject.unbind(),this._state.vertexArrayObject=null),this.bindVAO(t)}l.bindFramebuffer(l.FRAMEBUFFER,null!=(e=null==(s=this._state.framebuffer)?void 0:s.glName)?e:null),l.useProgram(null!=(a=null==(n=this._state.program)?void 0:n.glName)?a:null),l.blendColor(this._state.blendColor.r,this._state.blendColor.g,this._state.blendColor.b,this._state.blendColor.a),l.bindRenderbuffer(l.RENDERBUFFER,this._state.renderbuffer?this._state.renderbuffer.glName:null),!0===this._state.blend?l.enable(this.gl.BLEND):l.disable(this.gl.BLEND),l.blendEquationSeparate(this._state.blendEquation.mode,this._state.blendEquation.modeAlpha),l.blendFuncSeparate(this._state.blendFunction.srcRGB,this._state.blendFunction.dstRGB,this._state.blendFunction.srcAlpha,this._state.blendFunction.dstAlpha),l.clearColor(this._state.clearColor.r,this._state.clearColor.g,this._state.clearColor.b,this._state.clearColor.a),l.clearDepth(this._state.clearDepth),l.clearStencil(this._state.clearStencil),l.colorMask(this._state.colorMask.r,this._state.colorMask.g,this._state.colorMask.b,this._state.colorMask.a),l.cullFace(this._state.cullFace),l.depthFunc(this._state.depthFunction),l.depthRange(this._state.depthRange.zNear,this._state.depthRange.zFar),!0===this._state.depthTest?l.enable(l.DEPTH_TEST):l.disable(l.DEPTH_TEST),l.depthMask(this._state.depthWrite),l.frontFace(this._state.frontFace),l.lineWidth(1),!0===this._state.faceCulling?l.enable(l.CULL_FACE):l.disable(l.CULL_FACE),l.polygonOffset(this._state.polygonOffset[0],this._state.polygonOffset[1]),!0===this._state.polygonOffsetFill?l.enable(l.POLYGON_OFFSET_FILL):l.disable(l.POLYGON_OFFSET_FILL),l.scissor(this._state.scissorRect.x,this._state.scissorRect.y,this._state.scissorRect.width,this._state.scissorRect.height),!0===this._state.scissorTest?l.enable(l.SCISSOR_TEST):l.disable(l.SCISSOR_TEST),l.stencilFunc(this._state.stencilFunction.func,this._state.stencilFunction.ref,this._state.stencilFunction.mask),l.stencilOpSeparate(this._state.stencilOperation.face,this._state.stencilOperation.fail,this._state.stencilOperation.zFail,this._state.stencilOperation.zPass),!0===this._state.stencilTest?l.enable(l.STENCIL_TEST):l.disable(l.STENCIL_TEST),l.stencilMask(this._state.stencilWriteMask);for(let i=0;i<this.parameters.maxTextureImageUnits;i++){l.activeTexture(h+i),l.bindTexture(c.TEXTURE_2D,null),l.bindTexture(c.TEXTURE_CUBE_MAP,null),R(l)&&l.bindTexture(c.TEXTURE_3D,null);const e=this._state.textureUnitMap[i];t(e)&&l.bindTexture(e.descriptor.target,e.glName)}l.activeTexture(h+this._state.activeTexture),l.viewport(this._state.viewport.x,this._state.viewport.y,this._state.viewport.width,this._state.viewport.height),i()&&(this._numOfDrawCalls=0,this._numOfTriangles=0)}_loadExtensions(){this.type===a.WEBGL1&&this.gl.getExtension("OES_element_index_uint"),this.gl.getExtension("KHR_parallel_shader_compile")}_loadParameters(t){var e;const s=this.capabilities.textureFilterAnisotropic,i=null!=(e=t.maxAnisotropy)?e:1/0,a={versionString:this.gl.getParameter(this.gl.VERSION),maxVertexTextureImageUnits:this.gl.getParameter(this.gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxVertexAttributes:this.gl.getParameter(this.gl.MAX_VERTEX_ATTRIBS),maxMaxAnisotropy:s?Math.min(this.gl.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY),i):1,maxTextureImageUnits:this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS),maxTextureSize:this.gl.getParameter(this.gl.MAX_TEXTURE_SIZE)};return F.TEXTURE_UNIT_FOR_UPDATES=a.maxTextureImageUnits-1,a}}function C(t,e,s,i){return e?i!==e&&t.bindBuffer(s,e.glName):t.bindBuffer(s,null),e}function S(t,e){switch(t){case p.POINTS:return 2*e;case p.TRIANGLES:return e/3;case p.TRIANGLE_STRIP:case p.TRIANGLE_FAN:return e-2;default:return 0}}export{O as RenderingContext};
|
|
5
|
+
import{isNone as t,isSome as e,unwrapOr as s}from"../../core/maybe.js";import{after as i}from"../../core/promiseUtils.js";import"./BufferObject.js";import"./FramebufferObject.js";import"../../core/has.js";import{webglDebugEnabled as a}from"./checkWebGLError.js";import{ContextType as r}from"./context-util.js";import{BufferType as n,Face as l,BASE_TEXTURE_UNIT as h,ClearBufferBit as f,FramebufferTarget as o,TextureSamplingMode as _,SyncCondition as u,ClientWaitSyncStatus as c,BlendFactor as d,BlendOperation as b,CullMode as F,CompareFunction as g,StencilOperation as p,TextureType as E,PrimitiveType as B}from"./enums.js";import"./ShaderTranspiler.js";import{ProgramCache as m}from"./ProgramCache.js";import{Texture as R}from"./Texture.js";import"./VertexArrayObject.js";import{ContextState as T}from"./ContextState.js";import{InstanceCounter as A}from"./InstanceCounter.js";import{StateTracker as x}from"./renderState.js";import{WebGLDriverTest as O}from"./WebGLDriverTest.js";import{Capabilities as U}from"./capabilities/Capabilities.js";import C from"./capabilities/isWebGL2Context.js";class S{constructor(t,e){this.gl=t,this.instanceCounter=new A,this.programCache=new m(this),this._state=new T,this._numOfDrawCalls=0,this._numOfTriangles=0,this.type=C(t)?r.WEBGL2:r.WEBGL1,this._loadExtensions(),this.configure(e)}configure(t){this._capabilities=new U(this.gl,t),this._parameters=this._loadParameters(t);const e=this.gl.getParameter(this.gl.VIEWPORT);this._state=new T,this._state.viewport={x:e[0],y:e[1],width:e[2],height:e[3]},this._stateTracker=new x({setBlending:t=>{if(t){this.setBlendingEnabled(!0),this.setBlendEquationSeparate(t.opRgb,t.opAlpha),this.setBlendFunctionSeparate(t.srcRgb,t.dstRgb,t.srcAlpha,t.dstAlpha);const e=t.color;this.setBlendColor(e.r,e.g,e.b,e.a)}else this.setBlendingEnabled(!1)},setCulling:t=>{t?(this.setFaceCullingEnabled(!0),this.setCullFace(t.face),this.setFrontFace(t.mode)):this.setFaceCullingEnabled(!1)},setPolygonOffset:t=>{t?(this.setPolygonOffsetFillEnabled(!0),this.setPolygonOffset(t.factor,t.units)):this.setPolygonOffsetFillEnabled(!1)},setDepthTest:t=>{t?(this.setDepthTestEnabled(!0),this.setDepthFunction(t.func)):this.setDepthTestEnabled(!1)},setStencilTest:t=>{if(t){this.setStencilTestEnabled(!0);const e=t.function;this.setStencilFunction(e.func,e.ref,e.mask);const s=t.operation;this.setStencilOp(s.fail,s.zFail,s.zPass)}else this.setStencilTestEnabled(!1)},setDepthWrite:t=>{t?(this.setDepthWriteEnabled(!0),this.setDepthRange(t.zNear,t.zFar)):this.setDepthWriteEnabled(!1)},setColorWrite:t=>{t?this.setColorMask(t.r,t.g,t.b,t.a):this.setColorMask(!1,!1,!1,!1)},setStencilWrite:t=>{t?this.setStencilWriteMask(t.mask):this.setStencilWriteMask(0)}}),this.enforceState(),this._driverTest=new O(this)}get driverTest(){return this._driverTest}get contextAttributes(){return this.gl.getContextAttributes()}get parameters(){return this._parameters}dispose(){this.programCache.dispose(),this.bindVAO(null),this.unbindBuffer(n.ARRAY_BUFFER),this.unbindBuffer(n.ELEMENT_ARRAY_BUFFER),C(this.gl)&&(this.unbindBuffer(n.UNIFORM_BUFFER),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(n.PIXEL_PACK_BUFFER),this.unbindBuffer(n.PIXEL_UNPACK_BUFFER),this.unbindBuffer(n.COPY_READ_BUFFER),this.unbindBuffer(n.COPY_WRITE_BUFFER)),this._state.textureUnitMap.length=0,a()&&this.instanceCounter.printResourceCount()}setPipelineState(t){this._stateTracker.setPipeline(t)}setBlendingEnabled(t){this._state.blend!==t&&(!0===t?this.gl.enable(this.gl.BLEND):this.gl.disable(this.gl.BLEND),this._state.blend=t,this._stateTracker.invalidateBlending())}externalProgramUpdate(){var t;null==(t=this._state.program)||t.stop(),this._state.program=null}externalTextureUnitUpdate(t,e){for(let s=0;s<t.length;++s)this._state.textureUnitMap[t[s]]=null;e>=0&&(this._state.activeTexture=e)}externalVertexArrayObjectUpdate(){const t=this.capabilities.vao;t&&(t.bindVertexArray(null),this._state.vertexArrayObject=null),this._state.vertexBuffer=null,this._state.indexBuffer=null}externalVertexBufferUpdate(){this._state.vertexBuffer=null}externalIndexBufferUpdate(){this._state.indexBuffer=null}setBlendColor(t,e,s,i){t===this._state.blendColor.r&&e===this._state.blendColor.g&&s===this._state.blendColor.b&&i===this._state.blendColor.a||(this.gl.blendColor(t,e,s,i),this._state.blendColor.r=t,this._state.blendColor.g=e,this._state.blendColor.b=s,this._state.blendColor.a=i,this._stateTracker.invalidateBlending())}setBlendFunction(t,e){t===this._state.blendFunction.srcRGB&&e===this._state.blendFunction.dstRGB||(this.gl.blendFunc(t,e),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=t,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=e,this._stateTracker.invalidateBlending())}setBlendFunctionSeparate(t,e,s,i){this._state.blendFunction.srcRGB===t&&this._state.blendFunction.srcAlpha===s&&this._state.blendFunction.dstRGB===e&&this._state.blendFunction.dstAlpha===i||(this.gl.blendFuncSeparate(t,e,s,i),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=s,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=i,this._stateTracker.invalidateBlending())}setBlendEquation(t){this._state.blendEquation.mode!==t&&(this.gl.blendEquation(t),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=t,this._stateTracker.invalidateBlending())}setBlendEquationSeparate(t,e){this._state.blendEquation.mode===t&&this._state.blendEquation.modeAlpha===e||(this.gl.blendEquationSeparate(t,e),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=e,this._stateTracker.invalidateBlending())}setColorMask(t,e,s,i){this._state.colorMask.r===t&&this._state.colorMask.g===e&&this._state.colorMask.b===s&&this._state.colorMask.a===i||(this.gl.colorMask(t,e,s,i),this._state.colorMask.r=t,this._state.colorMask.g=e,this._state.colorMask.b=s,this._state.colorMask.a=i,this._stateTracker.invalidateColorWrite())}setClearColor(t,e,s,i){this._state.clearColor.r===t&&this._state.clearColor.g===e&&this._state.clearColor.b===s&&this._state.clearColor.a===i||(this.gl.clearColor(t,e,s,i),this._state.clearColor.r=t,this._state.clearColor.g=e,this._state.clearColor.b=s,this._state.clearColor.a=i)}setFaceCullingEnabled(t){this._state.faceCulling!==t&&(!0===t?this.gl.enable(this.gl.CULL_FACE):this.gl.disable(this.gl.CULL_FACE),this._state.faceCulling=t,this._stateTracker.invalidateCulling())}setPolygonOffsetFillEnabled(t){this._state.polygonOffsetFill!==t&&(!0===t?this.gl.enable(this.gl.POLYGON_OFFSET_FILL):this.gl.disable(this.gl.POLYGON_OFFSET_FILL),this._state.polygonOffsetFill=t,this._stateTracker.invalidatePolygonOffset())}setPolygonOffset(t,e){this._state.polygonOffset[0]===t&&this._state.polygonOffset[1]===e||(this._state.polygonOffset[0]=t,this._state.polygonOffset[1]=e,this.gl.polygonOffset(t,e),this._stateTracker.invalidatePolygonOffset())}setCullFace(t){this._state.cullFace!==t&&(this.gl.cullFace(t),this._state.cullFace=t,this._stateTracker.invalidateCulling())}setFrontFace(t){this._state.frontFace!==t&&(this.gl.frontFace(t),this._state.frontFace=t,this._stateTracker.invalidateCulling())}setScissorTestEnabled(t){this._state.scissorTest!==t&&(!0===t?this.gl.enable(this.gl.SCISSOR_TEST):this.gl.disable(this.gl.SCISSOR_TEST),this._state.scissorTest=t)}setScissorRect(t,e,s,i){this._state.scissorRect.x===t&&this._state.scissorRect.y===e&&this._state.scissorRect.width===s&&this._state.scissorRect.height===i||(this.gl.scissor(t,e,s,i),this._state.scissorRect.x=t,this._state.scissorRect.y=e,this._state.scissorRect.width=s,this._state.scissorRect.height=i)}setDepthTestEnabled(t){this._state.depthTest!==t&&(!0===t?this.gl.enable(this.gl.DEPTH_TEST):this.gl.disable(this.gl.DEPTH_TEST),this._state.depthTest=t,this._stateTracker.invalidateDepthTest())}setClearDepth(t){this._state.clearDepth!==t&&(this.gl.clearDepth(t),this._state.clearDepth=t)}setDepthFunction(t){this._state.depthFunction!==t&&(this.gl.depthFunc(t),this._state.depthFunction=t,this._stateTracker.invalidateDepthTest())}setDepthWriteEnabled(t){this._state.depthWrite!==t&&(this.gl.depthMask(t),this._state.depthWrite=t,this._stateTracker.invalidateDepthWrite())}setDepthRange(t,e){this._state.depthRange.zNear===t&&this._state.depthRange.zFar===e||(this.gl.depthRange(t,e),this._state.depthRange.zNear=t,this._state.depthRange.zFar=e,this._stateTracker.invalidateDepthWrite())}setStencilTestEnabled(t){this._state.stencilTest!==t&&(!0===t?this.gl.enable(this.gl.STENCIL_TEST):this.gl.disable(this.gl.STENCIL_TEST),this._state.stencilTest=t,this._stateTracker.invalidateStencilTest())}setClearStencil(t){t!==this._state.clearStencil&&(this.gl.clearStencil(t),this._state.clearStencil=t)}setStencilFunction(t,e,s){this._state.stencilFunction.func===t&&this._state.stencilFunction.ref===e&&this._state.stencilFunction.mask===s||(this.gl.stencilFunc(t,e,s),this._state.stencilFunction.face=l.FRONT_AND_BACK,this._state.stencilFunction.func=t,this._state.stencilFunction.ref=e,this._state.stencilFunction.mask=s,this._stateTracker.invalidateStencilTest())}setStencilFunctionSeparate(t,e,s,i){this._state.stencilFunction.face===t&&this._state.stencilFunction.func===e&&this._state.stencilFunction.ref===s&&this._state.stencilFunction.mask===i||(this.gl.stencilFuncSeparate(t,e,s,i),this._state.stencilFunction.face=t,this._state.stencilFunction.func=e,this._state.stencilFunction.ref=s,this._state.stencilFunction.mask=i,this._stateTracker.invalidateStencilTest())}setStencilWriteMask(t){this._state.stencilWriteMask!==t&&(this.gl.stencilMask(t),this._state.stencilWriteMask=t,this._stateTracker.invalidateStencilWrite())}setStencilOp(t,e,s){this._state.stencilOperation.face===l.FRONT_AND_BACK&&this._state.stencilOperation.fail===t&&this._state.stencilOperation.zFail===e&&this._state.stencilOperation.zPass===s||(this.gl.stencilOp(t,e,s),this._state.stencilOperation.face=l.FRONT_AND_BACK,this._state.stencilOperation.fail=t,this._state.stencilOperation.zFail=e,this._state.stencilOperation.zPass=s,this._stateTracker.invalidateStencilTest())}setStencilOpSeparate(t,e,s,i){this._state.stencilOperation.face===t&&this._state.stencilOperation.fail===e&&this._state.stencilOperation.zFail===s&&this._state.stencilOperation.zPass===i||(this.gl.stencilOpSeparate(t,e,s,i),this._state.stencilOperation.face=t,this._state.stencilOperation.fail=e,this._state.stencilOperation.zFail=s,this._state.stencilOperation.zPass=i,this._stateTracker.invalidateStencilTest())}setActiveTexture(t,e=!1){const s=this._state.activeTexture;return t>=0&&(e||t!==this._state.activeTexture)&&(this.gl.activeTexture(h+t),this._state.activeTexture=t),s}clear(t){t&&this.gl.clear(t)}clearSafe(t,e=255){t&&(t&f.COLOR_BUFFER_BIT&&this.setColorMask(!0,!0,!0,!0),t&f.DEPTH_BUFFER_BIT&&this.setDepthWriteEnabled(!0),t&f.STENCIL_BUFFER_BIT&&this.setStencilWriteMask(e),this.gl.clear(t))}drawArrays(t,e,s){a()&&(this._numOfDrawCalls++,this._numOfTriangles+=M(t,s)),this.gl.drawArrays(t,e,s)}drawElements(t,e,s,i){a()&&(this._numOfDrawCalls++,this._numOfTriangles+=M(t,e)),this.gl.drawElements(t,e,s,i)}logIno(){a()&&console.log(`DrawCalls: ${this._numOfDrawCalls}, Triangles: ${this._numOfTriangles}`)}get capabilities(){return this._capabilities}setViewport(t,e,s,i){s=Math.max(Math.round(s),1),i=Math.max(Math.round(i),1);const a=this._state.viewport;a.x===t&&a.y===e&&a.width===s&&a.height===i||(a.x=t,a.y=e,a.width=s,a.height=i,this.gl.viewport(t,e,s,i))}getViewport(){return{x:this._state.viewport.x,y:this._state.viewport.y,width:this._state.viewport.width,height:this._state.viewport.height}}useProgram(t){var e,s;this._state.program!==t&&(null==(e=this._state.program)||e.stop(),this._state.program=t,this.gl.useProgram(null!=(s=null==t?void 0:t.glName)?s:null))}bindTexture(s,i,a=!1){(i>=this.parameters.maxTextureImageUnits||i<0)&&console.error("Input texture unit is out of range of available units!");const r=this._state.textureUnitMap[i];return t(s)||null==s.glName?(e(r)&&(this.setActiveTexture(i,a),this.gl.bindTexture(r.descriptor.target,null)),this._state.textureUnitMap[i]=null,r):a||r!==s?(this.setActiveTexture(i,a),this.gl.bindTexture(s.descriptor.target,s.glName),s.applyChanges(),this._state.textureUnitMap[i]=s,r):(s.isDirty&&(this.setActiveTexture(i,a),s.applyChanges()),r)}unbindTextureAllUnits(t){for(let e=0;e<this.parameters.maxTextureImageUnits;e++)this._state.textureUnitMap[e]===t&&(this.bindTexture(null,e),this._state.textureUnitMap[e]=null)}bindFramebuffer(e,s=!1){if(s||this._state.readFramebuffer!==e||this._state.drawFramebuffer!==e){if(t(e))return this.gl.bindFramebuffer(o.FRAMEBUFFER,null),this._state.readFramebuffer=null,void(this._state.drawFramebuffer=null);e.initializeAndBind(o.FRAMEBUFFER),this._state.readFramebuffer=e,this._state.drawFramebuffer=e}}bindFramebufferSeparate(e,i,a=!1){const r=i===o.READ_FRAMEBUFFER,n=r?this._state.readFramebuffer:this._state.drawFramebuffer;(a||n!==e)&&(t(e)?this.gl.bindFramebuffer(i,null):e.initializeAndBind(i),r?this._state.readFramebuffer=s(e,null):this._state.drawFramebuffer=s(e,null))}blitFramebuffer(t,e,s=0,i=0,a=t.width,r=t.height,n=0,l=0,h=e.width,u=e.height,c=f.COLOR_BUFFER_BIT,d=_.NEAREST){this.bindFramebufferSeparate(t,o.READ_FRAMEBUFFER),this.bindFramebufferSeparate(e,o.DRAW_FRAMEBUFFER);this.gl.blitFramebuffer(s,i,a,r,n,l,h,u,c,d)}bindBuffer(t,e){if(t)switch(null!=e||(e=t.bufferType),e){case n.ARRAY_BUFFER:this._state.vertexBuffer=P(this.gl,t,e,this._state.vertexBuffer);break;case n.ELEMENT_ARRAY_BUFFER:this._state.indexBuffer=P(this.gl,t,e,this._state.indexBuffer);break;case n.UNIFORM_BUFFER:this._state.uniformBuffer=P(this.gl,t,e,this._state.uniformBuffer);break;case n.PIXEL_PACK_BUFFER:this._state.pixelPackBuffer=P(this.gl,t,e,this._state.pixelPackBuffer);break;case n.PIXEL_UNPACK_BUFFER:this._state.pixelUnpackBuffer=P(this.gl,t,e,this._state.pixelUnpackBuffer);break;case n.COPY_READ_BUFFER:this._state.copyReadBuffer=P(this.gl,t,e,this._state.copyReadBuffer);break;case n.COPY_WRITE_BUFFER:this._state.copyWriteBuffer=P(this.gl,t,e,this._state.copyWriteBuffer)}}bindRenderbuffer(t){const e=this.gl;t||(e.bindRenderbuffer(e.RENDERBUFFER,null),this._state.renderbuffer=null),this._state.renderbuffer!==t&&(e.bindRenderbuffer(e.RENDERBUFFER,t.glName),this._state.renderbuffer=t)}_getBufferBinding(e,s){if(s>=this.parameters.maxUniformBufferBindings||s<0)return console.error("Uniform buffer binding point is out of range!"),null;const i=this._state.uniformBufferBindingPoints;let a=i[s];return t(a)&&(a={buffer:null,offset:0,size:0},i[s]=a),a}bindBufferBase(e,s,i){const a=this._getBufferBinding(e,s);if(t(a))return;if(a.buffer===i&&0===a.offset&&0===a.size)return;this.gl.bindBufferBase(e,s,i?i.glName:null),a.buffer=i,a.offset=0,a.size=0}bindBufferRange(e,s,i,a,r){const n=this._getBufferBinding(e,s);if(t(n))return;if(n.buffer===i&&n.offset===a&&n.size===r)return;if(a%this._parameters.uniformBufferOffsetAlignment!=0)return void console.error("Uniform buffer binding offset is not a multiple of the context offset alignment");this.gl.bindBufferRange(e,s,i.glName,a,r),n.buffer=i,n.offset=a,n.size=r}bindUBO(e,s,i,r){t(s)?this.bindBufferBase(n.UNIFORM_BUFFER,e,null):(a()&&(null!=r?r:s.byteLength)>this._parameters.maxUniformBlockSize&&console.error("Attempting to bind more data than the maximum uniform block size"),s.initialize(),void 0!==i&&void 0!==r?this.bindBufferRange(n.UNIFORM_BUFFER,e,s.buffer,i,r):this.bindBufferBase(n.UNIFORM_BUFFER,e,s.buffer))}unbindUBO(t){for(let s=0,i=this._state.uniformBufferBindingPoints.length;s<i;s++){const i=this._state.uniformBufferBindingPoints[s];e(i)&&i.buffer===t.buffer&&this.bindBufferBase(n.UNIFORM_BUFFER,s,null)}}unbindBuffer(t){switch(t){case n.ARRAY_BUFFER:this._state.vertexBuffer=P(this.gl,null,t,this._state.vertexBuffer);break;case n.ELEMENT_ARRAY_BUFFER:this._state.indexBuffer=P(this.gl,null,t,this._state.indexBuffer);break;case n.UNIFORM_BUFFER:this._state.uniformBuffer=P(this.gl,null,t,this._state.uniformBuffer);break;case n.PIXEL_PACK_BUFFER:this._state.pixelPackBuffer=P(this.gl,null,t,this._state.pixelPackBuffer);break;case n.PIXEL_UNPACK_BUFFER:this._state.pixelUnpackBuffer=P(this.gl,null,t,this._state.pixelUnpackBuffer);break;case n.COPY_READ_BUFFER:this._state.copyReadBuffer=P(this.gl,null,t,this._state.copyReadBuffer);break;case n.COPY_WRITE_BUFFER:this._state.copyWriteBuffer=P(this.gl,null,t,this._state.copyWriteBuffer)}}bindVAO(e=null){t(e)?this._state.vertexArrayObject&&(this._state.vertexArrayObject.unbind(),this._state.vertexArrayObject=null):this._state.vertexArrayObject!==e&&(e.bind(),this._state.vertexArrayObject=e)}async clientWaitAsync(t=0){const e=this.gl,s=e.fenceSync(u.SYNC_GPU_COMMANDS_COMPLETE,0);let a;e.flush();do{await i(t),a=e.clientWaitSync(s,0,0)}while(a===c.TIMEOUT_EXPIRED);if(e.deleteSync(s),a===c.WAIT_FAILED)throw new Error("Client wait failed")}getBoundFramebufferObject(t=o.FRAMEBUFFER){return t===o.READ_FRAMEBUFFER?this._state.readFramebuffer:this._state.drawFramebuffer}getBoundVAO(){return this._state.vertexArrayObject}resetState(){this.useProgram(null),this.bindVAO(null),this.bindFramebuffer(null,!0),this.unbindBuffer(n.ARRAY_BUFFER),this.unbindBuffer(n.ELEMENT_ARRAY_BUFFER),C(this.gl)&&(this.unbindBuffer(n.UNIFORM_BUFFER),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(n.PIXEL_PACK_BUFFER),this.unbindBuffer(n.PIXEL_UNPACK_BUFFER),this.unbindBuffer(n.COPY_READ_BUFFER),this.unbindBuffer(n.COPY_WRITE_BUFFER));for(let t=0;t<this.parameters.maxTextureImageUnits;++t)this.bindTexture(null,t);this.setBlendingEnabled(!1),this.setBlendFunction(d.ONE,d.ZERO),this.setBlendEquation(b.ADD),this.setBlendColor(0,0,0,0),this.setFaceCullingEnabled(!1),this.setCullFace(l.BACK),this.setFrontFace(F.CCW),this.setPolygonOffsetFillEnabled(!1),this.setPolygonOffset(0,0),this.setScissorTestEnabled(!1),this.setScissorRect(0,0,this.gl.canvas.width,this.gl.canvas.height),this.setDepthTestEnabled(!1),this.setDepthFunction(g.LESS),this.setDepthRange(0,1),this.setStencilTestEnabled(!1),this.setStencilFunction(g.ALWAYS,0,0),this.setStencilOp(p.KEEP,p.KEEP,p.KEEP),this.setClearColor(0,0,0,0),this.setClearDepth(1),this.setClearStencil(0),this.setColorMask(!0,!0,!0,!0),this.setStencilWriteMask(4294967295),this.setDepthWriteEnabled(!0),this.setViewport(0,0,this.gl.canvas.width,this.gl.canvas.height)}enforceState(){var t,s;const i=this.gl,r=this.capabilities.vao;r&&r.bindVertexArray(null);for(let e=0;e<this.parameters.maxVertexAttributes;e++)i.disableVertexAttribArray(e);if(this._state.vertexBuffer?i.bindBuffer(this._state.vertexBuffer.bufferType,this._state.vertexBuffer.glName):i.bindBuffer(n.ARRAY_BUFFER,null),this._state.indexBuffer?i.bindBuffer(this._state.indexBuffer.bufferType,this._state.indexBuffer.glName):i.bindBuffer(n.ELEMENT_ARRAY_BUFFER,null),C(i)){var l,f,_,u;this._state.uniformBuffer?i.bindBuffer(this._state.uniformBuffer.bufferType,this._state.uniformBuffer.glName):i.bindBuffer(n.UNIFORM_BUFFER,null);for(let t=0;t<this._parameters.maxUniformBufferBindings;t++){const s=this._state.uniformBufferBindingPoints[t];if(e(s)&&null!==s.buffer){const{buffer:e,offset:a,size:r}=s;0===a&&0===r?i.bindBufferBase(n.UNIFORM_BUFFER,t,e.glName):i.bindBufferRange(n.UNIFORM_BUFFER,t,e.glName,a,r)}else i.bindBufferBase(n.UNIFORM_BUFFER,t,null)}this._state.pixelPackBuffer?i.bindBuffer(this._state.pixelPackBuffer.bufferType,this._state.pixelPackBuffer.glName):i.bindBuffer(n.PIXEL_PACK_BUFFER,null),this._state.pixelUnpackBuffer?i.bindBuffer(this._state.pixelUnpackBuffer.bufferType,this._state.pixelUnpackBuffer.glName):i.bindBuffer(n.PIXEL_UNPACK_BUFFER,null),this._state.copyReadBuffer?i.bindBuffer(this._state.copyReadBuffer.bufferType,this._state.copyReadBuffer.glName):i.bindBuffer(n.COPY_READ_BUFFER,null),this._state.copyWriteBuffer?i.bindBuffer(this._state.copyWriteBuffer.bufferType,this._state.copyWriteBuffer.glName):i.bindBuffer(n.COPY_WRITE_BUFFER,null),i.bindFramebuffer(o.READ_FRAMEBUFFER,null!=(l=null==(f=this._state.readFramebuffer)?void 0:f.glName)?l:null),i.bindFramebuffer(o.DRAW_FRAMEBUFFER,null!=(_=null==(u=this._state.drawFramebuffer)?void 0:u.glName)?_:null)}else{var c,d;this._state.readFramebuffer=this._state.drawFramebuffer,i.bindFramebuffer(o.FRAMEBUFFER,null!=(c=null==(d=this._state.drawFramebuffer)?void 0:d.glName)?c:null)}if(r&&this._state.vertexArrayObject){const t=this._state.vertexArrayObject;this._state.vertexArrayObject&&(this._state.vertexArrayObject.unbind(),this._state.vertexArrayObject=null),this.bindVAO(t)}i.useProgram(null!=(t=null==(s=this._state.program)?void 0:s.glName)?t:null),i.blendColor(this._state.blendColor.r,this._state.blendColor.g,this._state.blendColor.b,this._state.blendColor.a),i.bindRenderbuffer(i.RENDERBUFFER,this._state.renderbuffer?this._state.renderbuffer.glName:null),!0===this._state.blend?i.enable(this.gl.BLEND):i.disable(this.gl.BLEND),i.blendEquationSeparate(this._state.blendEquation.mode,this._state.blendEquation.modeAlpha),i.blendFuncSeparate(this._state.blendFunction.srcRGB,this._state.blendFunction.dstRGB,this._state.blendFunction.srcAlpha,this._state.blendFunction.dstAlpha),i.clearColor(this._state.clearColor.r,this._state.clearColor.g,this._state.clearColor.b,this._state.clearColor.a),i.clearDepth(this._state.clearDepth),i.clearStencil(this._state.clearStencil),i.colorMask(this._state.colorMask.r,this._state.colorMask.g,this._state.colorMask.b,this._state.colorMask.a),i.cullFace(this._state.cullFace),i.depthFunc(this._state.depthFunction),i.depthRange(this._state.depthRange.zNear,this._state.depthRange.zFar),!0===this._state.depthTest?i.enable(i.DEPTH_TEST):i.disable(i.DEPTH_TEST),i.depthMask(this._state.depthWrite),i.frontFace(this._state.frontFace),i.lineWidth(1),!0===this._state.faceCulling?i.enable(i.CULL_FACE):i.disable(i.CULL_FACE),i.polygonOffset(this._state.polygonOffset[0],this._state.polygonOffset[1]),!0===this._state.polygonOffsetFill?i.enable(i.POLYGON_OFFSET_FILL):i.disable(i.POLYGON_OFFSET_FILL),i.scissor(this._state.scissorRect.x,this._state.scissorRect.y,this._state.scissorRect.width,this._state.scissorRect.height),!0===this._state.scissorTest?i.enable(i.SCISSOR_TEST):i.disable(i.SCISSOR_TEST),i.stencilFunc(this._state.stencilFunction.func,this._state.stencilFunction.ref,this._state.stencilFunction.mask),i.stencilOpSeparate(this._state.stencilOperation.face,this._state.stencilOperation.fail,this._state.stencilOperation.zFail,this._state.stencilOperation.zPass),!0===this._state.stencilTest?i.enable(i.STENCIL_TEST):i.disable(i.STENCIL_TEST),i.stencilMask(this._state.stencilWriteMask);for(let a=0;a<this.parameters.maxTextureImageUnits;a++){i.activeTexture(h+a),i.bindTexture(E.TEXTURE_2D,null),i.bindTexture(E.TEXTURE_CUBE_MAP,null),C(i)&&(i.bindTexture(E.TEXTURE_3D,null),i.bindTexture(E.TEXTURE_2D_ARRAY,null));const t=this._state.textureUnitMap[a];e(t)&&i.bindTexture(t.descriptor.target,t.glName)}i.activeTexture(h+this._state.activeTexture),i.viewport(this._state.viewport.x,this._state.viewport.y,this._state.viewport.width,this._state.viewport.height),a()&&(this._numOfDrawCalls=0,this._numOfTriangles=0)}_loadExtensions(){this.type===r.WEBGL1&&this.gl.getExtension("OES_element_index_uint"),this.gl.getExtension("KHR_parallel_shader_compile")}_loadParameters(t){var e;const s=this.capabilities.textureFilterAnisotropic,i=null!=(e=t.maxAnisotropy)?e:1/0,a=C(this.gl),r=this.gl,n={versionString:this.gl.getParameter(this.gl.VERSION),maxVertexTextureImageUnits:this.gl.getParameter(this.gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxVertexAttributes:this.gl.getParameter(this.gl.MAX_VERTEX_ATTRIBS),maxMaxAnisotropy:s?Math.min(this.gl.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY),i):1,maxTextureImageUnits:this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS),maxTextureSize:this.gl.getParameter(this.gl.MAX_TEXTURE_SIZE),maxUniformBufferBindings:a?r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS):0,maxVertexUniformBlocks:a?r.getParameter(r.MAX_VERTEX_UNIFORM_BLOCKS):0,maxFragmentUniformBlocks:a?r.getParameter(r.MAX_FRAGMENT_UNIFORM_BLOCKS):0,maxUniformBlockSize:a?r.getParameter(r.MAX_UNIFORM_BLOCK_SIZE):0,uniformBufferOffsetAlignment:a?r.getParameter(r.UNIFORM_BUFFER_OFFSET_ALIGNMENT):1,maxArrayTextureLayers:a?r.getParameter(r.MAX_ARRAY_TEXTURE_LAYERS):1,maxSamples:a?r.getParameter(r.MAX_SAMPLES):1};return R.TEXTURE_UNIT_FOR_UPDATES=n.maxTextureImageUnits-1,n}}function P(t,e,s,i){return e?i!==e&&t.bindBuffer(s,e.glName):t.bindBuffer(s,null),e}function M(t,e){switch(t){case B.POINTS:return 2*e;case B.TRIANGLES:return e/3;case B.TRIANGLE_STRIP:case B.TRIANGLE_FAN:return e-2;default:return 0}}export{S as RenderingContext};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isSome as e}from"../../core/maybe.js";import{ShaderType as t}from"./enums.js";import r from"./reservedWordsGLSL3.js";var a,o={exports:{}};void 0!==(a=["precision","highp","mediump","lowp","attribute","const","uniform","varying","break","continue","do","for","while","if","else","in","out","inout","float","int","void","bool","true","false","discard","return","mat2","mat3","mat4","vec2","vec3","vec4","ivec2","ivec3","ivec4","bvec2","bvec3","bvec4","sampler1D","sampler2D","sampler3D","samplerCube","sampler1DShadow","sampler2DShadow","struct","asm","class","union","enum","typedef","template","this","packed","goto","switch","default","inline","noinline","volatile","public","static","extern","external","interface","long","short","double","half","fixed","unsigned","input","output","hvec2","hvec3","hvec4","dvec2","dvec3","dvec4","fvec2","fvec3","fvec4","sampler2DRect","sampler3DRect","sampler2DRectShadow","sizeof","cast","namespace","using"])&&(o.exports=a);const n=o.exports;var i,l={exports:{}};i=l,function(e){var t=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"];void 0!==t&&(i.exports=t)}();const s=l.exports;var c={exports:{}};!function(e){!function(t){var r=function(){return["abs","acos","all","any","asin","atan","ceil","clamp","cos","cross","dFdx","dFdy","degrees","distance","dot","equal","exp","exp2","faceforward","floor","fract","gl_BackColor","gl_BackLightModelProduct","gl_BackLightProduct","gl_BackMaterial","gl_BackSecondaryColor","gl_ClipPlane","gl_ClipVertex","gl_Color","gl_DepthRange","gl_DepthRangeParameters","gl_EyePlaneQ","gl_EyePlaneR","gl_EyePlaneS","gl_EyePlaneT","gl_Fog","gl_FogCoord","gl_FogFragCoord","gl_FogParameters","gl_FragColor","gl_FragCoord","gl_FragData","gl_FragDepth","gl_FragDepthEXT","gl_FrontColor","gl_FrontFacing","gl_FrontLightModelProduct","gl_FrontLightProduct","gl_FrontMaterial","gl_FrontSecondaryColor","gl_LightModel","gl_LightModelParameters","gl_LightModelProducts","gl_LightProducts","gl_LightSource","gl_LightSourceParameters","gl_MaterialParameters","gl_MaxClipPlanes","gl_MaxCombinedTextureImageUnits","gl_MaxDrawBuffers","gl_MaxFragmentUniformComponents","gl_MaxLights","gl_MaxTextureCoords","gl_MaxTextureImageUnits","gl_MaxTextureUnits","gl_MaxVaryingFloats","gl_MaxVertexAttribs","gl_MaxVertexTextureImageUnits","gl_MaxVertexUniformComponents","gl_ModelViewMatrix","gl_ModelViewMatrixInverse","gl_ModelViewMatrixInverseTranspose","gl_ModelViewMatrixTranspose","gl_ModelViewProjectionMatrix","gl_ModelViewProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixTranspose","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_Normal","gl_NormalMatrix","gl_NormalScale","gl_ObjectPlaneQ","gl_ObjectPlaneR","gl_ObjectPlaneS","gl_ObjectPlaneT","gl_Point","gl_PointCoord","gl_PointParameters","gl_PointSize","gl_Position","gl_ProjectionMatrix","gl_ProjectionMatrixInverse","gl_ProjectionMatrixInverseTranspose","gl_ProjectionMatrixTranspose","gl_SecondaryColor","gl_TexCoord","gl_TextureEnvColor","gl_TextureMatrix","gl_TextureMatrixInverse","gl_TextureMatrixInverseTranspose","gl_TextureMatrixTranspose","gl_Vertex","greaterThan","greaterThanEqual","inversesqrt","length","lessThan","lessThanEqual","log","log2","matrixCompMult","max","min","mix","mod","normalize","not","notEqual","pow","radians","reflect","refract","sign","sin","smoothstep","sqrt","step","tan","texture2D","texture2DLod","texture2DProj","texture2DProjLod","textureCube","textureCubeLod","texture2DLodEXT","texture2DProjLodEXT","textureCubeLodEXT","texture2DGradEXT","texture2DProjGradEXT","textureCubeGradEXT"]}();void 0!==r&&(e.exports=r)}()}(c);const d=c.exports;var u=999,g=9999,p=0,f=1,_=2,h=3,x=4,m=5,y=6,w=7,M=8,v=9,T=10,b=11,E=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"];function P(){var e,t,r,a=0,o=0,i=u,l=[],c=[],P=1,C=0,k=0,D=!1,j=!1,F="";return function(e){return c=[],null!==e?S(e.replace?e.replace(/\r\n/g,"\n"):e):R()};function L(e){e.length&&c.push({type:E[i],data:e,position:k,line:P,column:C})}function S(t){var n;for(a=0,r=(F+=t).length;e=F[a],a<r;){switch(n=a,i){case p:a=I();break;case f:a=G();break;case _:a=A();break;case h:a=O();break;case x:a=H();break;case b:a=B();break;case m:a=N();break;case g:a=U();break;case v:a=X();break;case u:a=V()}if(n!==a)if("\n"===F[n])C=0,++P;else++C}return o+=a,F=F.slice(a),c}function R(e){return l.length&&L(l.join("")),i=T,L("(eof)"),c}function V(){return l=l.length?[]:l,"/"===t&&"*"===e?(k=o+a-1,i=p,t=e,a+1):"/"===t&&"/"===e?(k=o+a-1,i=f,t=e,a+1):"#"===e?(i=_,k=o+a,a):/\s/.test(e)?(i=v,k=o+a,a):(D=/\d/.test(e),j=/[^\w_]/.test(e),k=o+a,i=D?x:j?h:g,a)}function X(){return/[^\s]/g.test(e)?(L(l.join("")),i=u,a):(l.push(e),t=e,a+1)}function A(){return"\r"!==e&&"\n"!==e||"\\"===t?(l.push(e),t=e,a+1):(L(l.join("")),i=u,a)}function G(){return A()}function I(){return"/"===e&&"*"===t?(l.push(e),L(l.join("")),i=u,a+1):(l.push(e),t=e,a+1)}function O(){if("."===t&&/\d/.test(e))return i=m,a;if("/"===t&&"*"===e)return i=p,a;if("/"===t&&"/"===e)return i=f,a;if("."===e&&l.length){for(;q(l););return i=m,a}if(";"===e||")"===e||"("===e){if(l.length)for(;q(l););return L(e),i=u,a+1}var r=2===l.length&&"="!==e;if(/[\w_\d\s]/.test(e)||r){for(;q(l););return i=u,a}return l.push(e),t=e,a+1}function q(e){for(var t,r,a=0;;){if(t=s.indexOf(e.slice(0,e.length+a).join("")),r=s[t],-1===t){if(a--+e.length>0)continue;r=e.slice(0,1).join("")}return L(r),k+=r.length,(l=l.slice(r.length)).length}}function B(){return/[^a-fA-F0-9]/.test(e)?(L(l.join("")),i=u,a):(l.push(e),t=e,a+1)}function H(){return"."===e||/[eE]/.test(e)?(l.push(e),i=m,t=e,a+1):"x"===e&&1===l.length&&"0"===l[0]?(i=b,l.push(e),t=e,a+1):/[^\d]/.test(e)?(L(l.join("")),i=u,a):(l.push(e),t=e,a+1)}function N(){return"f"===e&&(l.push(e),t=e,a+=1),/[eE]/.test(e)||"-"===e&&/[eE]/.test(t)?(l.push(e),t=e,a+1):/[^\d]/.test(e)?(L(l.join("")),i=u,a):(l.push(e),t=e,a+1)}function U(){if(/[^\d\w_]/.test(e)){var r=l.join("");return i=n.indexOf(r)>-1?M:d.indexOf(r)>-1?w:y,L(l.join("")),i=u,a}return l.push(e),t=e,a+1}}function C(e){var t=P(),r=[];return r=(r=r.concat(t(e))).concat(t(null))}function k(e){return C(e)}function D(e){return e.map((e=>"eof"!==e.type?e.data:"")).join("")}const j=["GL_OES_standard_derivatives","GL_EXT_frag_depth","GL_EXT_draw_buffers","GL_EXT_shader_texture_lod"];function F(e,t="100",r="300 es"){const a=/^\s*\#version\s+([0-9]+(\s+[a-zA-Z]+)?)\s*/;for(const o of e)if("preprocessor"===o.type){const e=a.exec(o.data);if(e){const a=e[1].replace(/\s\s+/g," ");if(a===r)return a;if(a===t)return o.data="#version "+r,t;throw new Error("unknown glsl version: "+a)}}return e.splice(0,0,{type:"preprocessor",data:"#version "+r},{type:"whitespace",data:"\n"}),null}function L(e,t){for(let r=t-1;r>=0;r--){const t=e[r];if("whitespace"!==t.type&&"block-comment"!==t.type){if("keyword"!==t.type)break;if("attribute"===t.data||"in"===t.data)return!0}}return!1}function S(e,t,r,a){a=a||r;for(const o of e)if("ident"===o.type&&o.data===r){a in t?t[a]++:t[a]=0;return S(e,t,a+"_"+t[a],a)}return r}function R(e,t,r="afterVersion"){function a(e,t){for(let r=t;r<e.length;r++){const t=e[r];if("operator"===t.type&&";"===t.data)return r}return null}function o(e){let t=-1,o=0,n=-1;for(let i=0;i<e.length;i++){const l=e[i];if("preprocessor"===l.type&&(l.data.match(/\#(if|ifdef|ifndef)\s+.+/)?++o:l.data.match(/\#endif\s*.*/)&&--o),"afterVersion"!==r&&"afterPrecision"!==r||"preprocessor"===l.type&&/^#version/.test(l.data)&&(n=Math.max(n,i)),"afterPrecision"===r&&"keyword"===l.type&&"precision"===l.data){const t=a(e,i);if(null===t)throw new Error("precision statement not followed by any semicolons!");n=Math.max(n,t)}t<n&&0===o&&(t=i)}return t+1}const n={data:"\n",type:"whitespace"},i=t=>t<e.length&&/[^\r\n]$/.test(e[t].data);let l=o(e);i(l-1)&&e.splice(l++,0,n);for(const s of t)e.splice(l++,0,s);i(l-1)&&i(l)&&e.splice(l,0,n)}function V(e,t,r,a="lowp"){R(e,[{type:"keyword",data:"out"},{type:"whitespace",data:" "},{type:"keyword",data:a},{type:"whitespace",data:" "},{type:"keyword",data:r},{type:"whitespace",data:" "},{type:"ident",data:t},{type:"operator",data:";"}],"afterPrecision")}function X(e,t,r,a,o="lowp"){R(e,[{type:"keyword",data:"layout"},{type:"operator",data:"("},{type:"keyword",data:"location"},{type:"whitespace",data:" "},{type:"operator",data:"="},{type:"whitespace",data:" "},{type:"integer",data:a.toString()},{type:"operator",data:")"},{type:"whitespace",data:" "},{type:"keyword",data:"out"},{type:"whitespace",data:" "},{type:"keyword",data:o},{type:"whitespace",data:" "},{type:"keyword",data:r},{type:"whitespace",data:" "},{type:"ident",data:t},{type:"operator",data:";"}],"afterPrecision")}function A(e,t){let r,a,o=-1;for(let n=t;n<e.length;n++){const t=e[n];if("operator"===t.type&&("["===t.data&&(r=n),"]"===t.data)){a=n;break}"integer"===t.type&&(o=parseInt(t.data,10))}return r&&a&&e.splice(r,a-r+1),o}function G(a,o){const n=q(a);if(e(n))return n;const i=k(a);if("300 es"===F(i,"100","300 es"))throw new Error("shader is already glsl 300 es");let l=null,s=null;const c={},d={};for(let e=0;e<i.length;++e){const a=i[e];switch(a.type){case"keyword":o===t.VERTEX_SHADER&&"attribute"===a.data?a.data="in":"varying"===a.data&&(a.data=o===t.VERTEX_SHADER?"out":"in");break;case"builtin":if(/^texture(2D|Cube)(Proj)?(Lod|Grad)?(EXT)?$/.test(a.data.trim())&&(a.data=a.data.replace(/(2D|Cube|EXT)/g,"")),o===t.FRAGMENT_SHADER&&"gl_FragColor"===a.data&&(l||(l=S(i,c,"fragColor"),V(i,l,"vec4")),a.data=l),o===t.FRAGMENT_SHADER&&"gl_FragData"===a.data){const t=A(i,e+1),r=S(i,c,"fragData");X(i,r,"vec4",t,"mediump"),a.data=r}else o===t.FRAGMENT_SHADER&&"gl_FragDepthEXT"===a.data&&(s||(s=S(i,c,"gl_FragDepth")),a.data=s);break;case"ident":if(r.indexOf(a.data)>=0){if(o===t.VERTEX_SHADER&&L(i,e))throw new Error("attribute in vertex shader uses a name that is a reserved word in glsl 300 es");a.data in d||(d[a.data]=S(i,c,a.data)),a.data=d[a.data]}}}for(let e=i.length-1;e>=0;--e){const t=i[e];if("preprocessor"===t.type){const r=t.data.match(/\#extension\s+(.*)\:/);if(r&&r[1]&&j.indexOf(r[1].trim())>=0){const t=i[e+1];i.splice(e,t&&"whitespace"===t.type?2:1)}const a=t.data.match(/\#ifdef\s+(.*)/);a&&a[1]&&j.indexOf(a[1].trim())>=0&&(t.data="#if 1");const o=t.data.match(/\#ifndef\s+(.*)/);o&&o[1]&&j.indexOf(o[1].trim())>=0&&(t.data="#if 0")}}return B(a,D(i))}const I={enableCache:!1},O=new Map;function q(e){return I.enableCache?O.get(e):null}function B(e,t){return I.enableCache&&O.set(e,t),t}export{I as test,G as transpileShader};
|
|
5
|
+
import"../../core/has.js";import{isSome as e}from"../../core/maybe.js";import{ShaderType as t}from"./enums.js";import r from"./reservedWordsGLSL3.js";var a,o={exports:{}};void 0!==(a=["precision","highp","mediump","lowp","attribute","const","uniform","varying","break","continue","do","for","while","if","else","in","out","inout","float","int","void","bool","true","false","discard","return","mat2","mat3","mat4","vec2","vec3","vec4","ivec2","ivec3","ivec4","bvec2","bvec3","bvec4","sampler1D","sampler2D","sampler3D","samplerCube","sampler1DShadow","sampler2DShadow","struct","asm","class","union","enum","typedef","template","this","packed","goto","switch","default","inline","noinline","volatile","public","static","extern","external","interface","long","short","double","half","fixed","unsigned","input","output","hvec2","hvec3","hvec4","dvec2","dvec3","dvec4","fvec2","fvec3","fvec4","sampler2DRect","sampler3DRect","sampler2DRectShadow","sizeof","cast","namespace","using"])&&(o.exports=a);const n=o.exports;var i,l={exports:{}};i=l,function(e){var t=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"];void 0!==t&&(i.exports=t)}();const s=l.exports;var c={exports:{}};!function(e){!function(t){var r=function(){return["abs","acos","all","any","asin","atan","ceil","clamp","cos","cross","dFdx","dFdy","degrees","distance","dot","equal","exp","exp2","faceforward","floor","fract","gl_BackColor","gl_BackLightModelProduct","gl_BackLightProduct","gl_BackMaterial","gl_BackSecondaryColor","gl_ClipPlane","gl_ClipVertex","gl_Color","gl_DepthRange","gl_DepthRangeParameters","gl_EyePlaneQ","gl_EyePlaneR","gl_EyePlaneS","gl_EyePlaneT","gl_Fog","gl_FogCoord","gl_FogFragCoord","gl_FogParameters","gl_FragColor","gl_FragCoord","gl_FragData","gl_FragDepth","gl_FragDepthEXT","gl_FrontColor","gl_FrontFacing","gl_FrontLightModelProduct","gl_FrontLightProduct","gl_FrontMaterial","gl_FrontSecondaryColor","gl_LightModel","gl_LightModelParameters","gl_LightModelProducts","gl_LightProducts","gl_LightSource","gl_LightSourceParameters","gl_MaterialParameters","gl_MaxClipPlanes","gl_MaxCombinedTextureImageUnits","gl_MaxDrawBuffers","gl_MaxFragmentUniformComponents","gl_MaxLights","gl_MaxTextureCoords","gl_MaxTextureImageUnits","gl_MaxTextureUnits","gl_MaxVaryingFloats","gl_MaxVertexAttribs","gl_MaxVertexTextureImageUnits","gl_MaxVertexUniformComponents","gl_ModelViewMatrix","gl_ModelViewMatrixInverse","gl_ModelViewMatrixInverseTranspose","gl_ModelViewMatrixTranspose","gl_ModelViewProjectionMatrix","gl_ModelViewProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixTranspose","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_Normal","gl_NormalMatrix","gl_NormalScale","gl_ObjectPlaneQ","gl_ObjectPlaneR","gl_ObjectPlaneS","gl_ObjectPlaneT","gl_Point","gl_PointCoord","gl_PointParameters","gl_PointSize","gl_Position","gl_ProjectionMatrix","gl_ProjectionMatrixInverse","gl_ProjectionMatrixInverseTranspose","gl_ProjectionMatrixTranspose","gl_SecondaryColor","gl_TexCoord","gl_TextureEnvColor","gl_TextureMatrix","gl_TextureMatrixInverse","gl_TextureMatrixInverseTranspose","gl_TextureMatrixTranspose","gl_Vertex","greaterThan","greaterThanEqual","inversesqrt","length","lessThan","lessThanEqual","log","log2","matrixCompMult","max","min","mix","mod","normalize","not","notEqual","pow","radians","reflect","refract","sign","sin","smoothstep","sqrt","step","tan","texture2D","texture2DLod","texture2DProj","texture2DProjLod","textureCube","textureCubeLod","texture2DLodEXT","texture2DProjLodEXT","textureCubeLodEXT","texture2DGradEXT","texture2DProjGradEXT","textureCubeGradEXT"]}();void 0!==r&&(e.exports=r)}()}(c);const d=c.exports;var u=999,g=9999,p=0,f=1,_=2,h=3,x=4,m=5,y=6,w=7,M=8,v=9,T=10,b=11,P=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"];function E(){var e,t,r,a=0,o=0,i=u,l=[],c=[],E=1,C=0,k=0,D=!1,j=!1,F="";return function(e){return c=[],null!==e?S(e.replace?e.replace(/\r\n/g,"\n"):e):R()};function L(e){e.length&&c.push({type:P[i],data:e,position:k,line:E,column:C})}function S(t){var n;for(a=0,r=(F+=t).length;e=F[a],a<r;){switch(n=a,i){case p:a=I();break;case f:a=G();break;case _:a=A();break;case h:a=O();break;case x:a=H();break;case b:a=B();break;case m:a=N();break;case g:a=U();break;case v:a=X();break;case u:a=V()}if(n!==a)if("\n"===F[n])C=0,++E;else++C}return o+=a,F=F.slice(a),c}function R(e){return l.length&&L(l.join("")),i=T,L("(eof)"),c}function V(){return l=l.length?[]:l,"/"===t&&"*"===e?(k=o+a-1,i=p,t=e,a+1):"/"===t&&"/"===e?(k=o+a-1,i=f,t=e,a+1):"#"===e?(i=_,k=o+a,a):/\s/.test(e)?(i=v,k=o+a,a):(D=/\d/.test(e),j=/[^\w_]/.test(e),k=o+a,i=D?x:j?h:g,a)}function X(){return/[^\s]/g.test(e)?(L(l.join("")),i=u,a):(l.push(e),t=e,a+1)}function A(){return"\r"!==e&&"\n"!==e||"\\"===t?(l.push(e),t=e,a+1):(L(l.join("")),i=u,a)}function G(){return A()}function I(){return"/"===e&&"*"===t?(l.push(e),L(l.join("")),i=u,a+1):(l.push(e),t=e,a+1)}function O(){if("."===t&&/\d/.test(e))return i=m,a;if("/"===t&&"*"===e)return i=p,a;if("/"===t&&"/"===e)return i=f,a;if("."===e&&l.length){for(;q(l););return i=m,a}if(";"===e||")"===e||"("===e){if(l.length)for(;q(l););return L(e),i=u,a+1}var r=2===l.length&&"="!==e;if(/[\w_\d\s]/.test(e)||r){for(;q(l););return i=u,a}return l.push(e),t=e,a+1}function q(e){for(var t,r,a=0;;){if(t=s.indexOf(e.slice(0,e.length+a).join("")),r=s[t],-1===t){if(a--+e.length>0)continue;r=e.slice(0,1).join("")}return L(r),k+=r.length,(l=l.slice(r.length)).length}}function B(){return/[^a-fA-F0-9]/.test(e)?(L(l.join("")),i=u,a):(l.push(e),t=e,a+1)}function H(){return"."===e||/[eE]/.test(e)?(l.push(e),i=m,t=e,a+1):"x"===e&&1===l.length&&"0"===l[0]?(i=b,l.push(e),t=e,a+1):/[^\d]/.test(e)?(L(l.join("")),i=u,a):(l.push(e),t=e,a+1)}function N(){return"f"===e&&(l.push(e),t=e,a+=1),/[eE]/.test(e)||"-"===e&&/[eE]/.test(t)?(l.push(e),t=e,a+1):/[^\d]/.test(e)?(L(l.join("")),i=u,a):(l.push(e),t=e,a+1)}function U(){if(/[^\d\w_]/.test(e)){var r=l.join("");return i=n.indexOf(r)>-1?M:d.indexOf(r)>-1?w:y,L(l.join("")),i=u,a}return l.push(e),t=e,a+1}}function C(e){var t=E(),r=[];return r=(r=r.concat(t(e))).concat(t(null))}function k(e){return C(e)}function D(e){return e.map((e=>"eof"!==e.type?e.data:"")).join("")}const j=["GL_OES_standard_derivatives","GL_EXT_frag_depth","GL_EXT_draw_buffers","GL_EXT_shader_texture_lod"];function F(e,t="100",r="300 es"){const a=/^\s*\#version\s+([0-9]+(\s+[a-zA-Z]+)?)\s*/;for(const o of e)if("preprocessor"===o.type){const e=a.exec(o.data);if(e){const a=e[1].replace(/\s\s+/g," ");if(a===r)return a;if(a===t)return o.data="#version "+r,t;throw new Error("unknown glsl version: "+a)}}return e.splice(0,0,{type:"preprocessor",data:"#version "+r},{type:"whitespace",data:"\n"}),null}function L(e,t){for(let r=t-1;r>=0;r--){const t=e[r];if("whitespace"!==t.type&&"block-comment"!==t.type){if("keyword"!==t.type)break;if("attribute"===t.data||"in"===t.data)return!0}}return!1}function S(e,t,r,a){a=a||r;for(const o of e)if("ident"===o.type&&o.data===r){a in t?t[a]++:t[a]=0;return S(e,t,a+"_"+t[a],a)}return r}function R(e,t,r="afterVersion"){function a(e,t){for(let r=t;r<e.length;r++){const t=e[r];if("operator"===t.type&&";"===t.data)return r}return null}function o(e){let t=-1,o=0,n=-1;for(let i=0;i<e.length;i++){const l=e[i];if("preprocessor"===l.type&&(l.data.match(/\#(if|ifdef|ifndef)\s+.+/)?++o:l.data.match(/\#endif\s*.*/)&&--o),"afterVersion"!==r&&"afterPrecision"!==r||"preprocessor"===l.type&&/^#version/.test(l.data)&&(n=Math.max(n,i)),"afterPrecision"===r&&"keyword"===l.type&&"precision"===l.data){const t=a(e,i);if(null===t)throw new Error("precision statement not followed by any semicolons!");n=Math.max(n,t)}t<n&&0===o&&(t=i)}return t+1}const n={data:"\n",type:"whitespace"},i=t=>t<e.length&&/[^\r\n]$/.test(e[t].data);let l=o(e);i(l-1)&&e.splice(l++,0,n);for(const s of t)e.splice(l++,0,s);i(l-1)&&i(l)&&e.splice(l,0,n)}function V(e,t,r,a="lowp"){R(e,[{type:"keyword",data:"out"},{type:"whitespace",data:" "},{type:"keyword",data:a},{type:"whitespace",data:" "},{type:"keyword",data:r},{type:"whitespace",data:" "},{type:"ident",data:t},{type:"operator",data:";"}],"afterPrecision")}function X(e,t,r,a,o="lowp"){R(e,[{type:"keyword",data:"layout"},{type:"operator",data:"("},{type:"keyword",data:"location"},{type:"whitespace",data:" "},{type:"operator",data:"="},{type:"whitespace",data:" "},{type:"integer",data:a.toString()},{type:"operator",data:")"},{type:"whitespace",data:" "},{type:"keyword",data:"out"},{type:"whitespace",data:" "},{type:"keyword",data:o},{type:"whitespace",data:" "},{type:"keyword",data:r},{type:"whitespace",data:" "},{type:"ident",data:t},{type:"operator",data:";"}],"afterPrecision")}function A(e,t){let r,a,o=-1;for(let n=t;n<e.length;n++){const t=e[n];if("operator"===t.type&&("["===t.data&&(r=n),"]"===t.data)){a=n;break}"integer"===t.type&&(o=parseInt(t.data,10))}return r&&a&&e.splice(r,a-r+1),o}function G(a,o){const n=q(a);if(e(n))return n;const i=k(a);if("300 es"===F(i,"100","300 es"))return a;let l=null,s=null;const c={},d={};for(let e=0;e<i.length;++e){const a=i[e];switch(a.type){case"keyword":o===t.VERTEX_SHADER&&"attribute"===a.data?a.data="in":"varying"===a.data&&(a.data=o===t.VERTEX_SHADER?"out":"in");break;case"builtin":if(/^texture(2D|Cube)(Proj)?(Lod|Grad)?(EXT)?$/.test(a.data.trim())&&(a.data=a.data.replace(/(2D|Cube|EXT)/g,"")),o===t.FRAGMENT_SHADER&&"gl_FragColor"===a.data&&(l||(l=S(i,c,"fragColor"),V(i,l,"vec4")),a.data=l),o===t.FRAGMENT_SHADER&&"gl_FragData"===a.data){const t=A(i,e+1),r=S(i,c,"fragData");X(i,r,"vec4",t,"mediump"),a.data=r}else o===t.FRAGMENT_SHADER&&"gl_FragDepthEXT"===a.data&&(s||(s=S(i,c,"gl_FragDepth")),a.data=s);break;case"ident":if(r.indexOf(a.data)>=0){if(o===t.VERTEX_SHADER&&L(i,e))throw new Error("attribute in vertex shader uses a name that is a reserved word in glsl 300 es");a.data in d||(d[a.data]=S(i,c,a.data)),a.data=d[a.data]}}}for(let e=i.length-1;e>=0;--e){const t=i[e];if("preprocessor"===t.type){const r=t.data.match(/\#extension\s+(.*)\:/);if(r&&r[1]&&j.indexOf(r[1].trim())>=0){const t=i[e+1];i.splice(e,t&&"whitespace"===t.type?2:1)}const a=t.data.match(/\#ifdef\s+(.*)/);a&&a[1]&&j.indexOf(a[1].trim())>=0&&(t.data="#if 1");const o=t.data.match(/\#ifndef\s+(.*)/);o&&o[1]&&j.indexOf(o[1].trim())>=0&&(t.data="#if 0")}}return B(a,D(i))}const I={enableCache:!1},O=new Map;function q(e){return I.enableCache?O.get(e):null}function B(e,t){return I.enableCache&&O.set(e,t),t}export{I as test,G as transpileShader};
|