@arcgis/core 4.23.0-next.20220106 → 4.23.0-next.20220118

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.
Files changed (522) hide show
  1. package/assets/components/assets/calcite-date-picker/nls/bg.json +31 -0
  2. package/assets/components/assets/calcite-icon/centerAlign16.json +1 -0
  3. package/assets/components/assets/calcite-icon/centerAlign24.json +1 -0
  4. package/assets/components/assets/calcite-icon/centerAlign32.json +1 -0
  5. package/assets/components/assets/calcite-icon/checkSquareF16.json +1 -0
  6. package/assets/components/assets/calcite-icon/checkSquareF24.json +1 -0
  7. package/assets/components/assets/calcite-icon/checkSquareF32.json +1 -0
  8. package/assets/components/assets/calcite-icon/convert16.json +1 -0
  9. package/assets/components/assets/calcite-icon/convert24.json +1 -0
  10. package/assets/components/assets/calcite-icon/convert32.json +1 -0
  11. package/assets/components/assets/calcite-icon/explore16.json +1 -0
  12. package/assets/components/assets/calcite-icon/explore24.json +1 -0
  13. package/assets/components/assets/calcite-icon/explore32.json +1 -0
  14. package/assets/components/assets/calcite-icon/formDropdown16.json +1 -0
  15. package/assets/components/assets/calcite-icon/formDropdown24.json +1 -0
  16. package/assets/components/assets/calcite-icon/formDropdown32.json +1 -0
  17. package/assets/components/assets/calcite-icon/language16.json +1 -0
  18. package/assets/components/assets/calcite-icon/language24.json +1 -0
  19. package/assets/components/assets/calcite-icon/language32.json +1 -0
  20. package/assets/components/assets/calcite-icon/languageTranslate16.json +1 -0
  21. package/assets/components/assets/calcite-icon/languageTranslate24.json +1 -0
  22. package/assets/components/assets/calcite-icon/languageTranslate32.json +1 -0
  23. package/assets/components/assets/calcite-icon/leftAlign16.json +1 -0
  24. package/assets/components/assets/calcite-icon/leftAlign24.json +1 -0
  25. package/assets/components/assets/calcite-icon/leftAlign32.json +1 -0
  26. package/assets/components/assets/calcite-icon/lineSolid4.json +1 -0
  27. package/assets/components/assets/calcite-icon/partlyCloudy16.json +1 -0
  28. package/assets/components/assets/calcite-icon/partlyCloudy24.json +1 -0
  29. package/assets/components/assets/calcite-icon/partlyCloudy32.json +1 -0
  30. package/assets/components/assets/calcite-icon/rightAlign16.json +1 -0
  31. package/assets/components/assets/calcite-icon/rightAlign24.json +1 -0
  32. package/assets/components/assets/calcite-icon/rightAlign32.json +1 -0
  33. package/assets/components/assets/calcite-icon/screenshotMode16.json +1 -0
  34. package/assets/components/assets/calcite-icon/screenshotMode24.json +1 -0
  35. package/assets/components/assets/calcite-icon/screenshotMode32.json +1 -0
  36. package/assets/components/assets/calcite-icon/squareF16.json +1 -0
  37. package/assets/components/assets/calcite-icon/squareF24.json +1 -0
  38. package/assets/components/assets/calcite-icon/squareF32.json +1 -0
  39. package/assets/components/assets/calcite-icon/terminal16.json +1 -0
  40. package/assets/components/assets/calcite-icon/terminal24.json +1 -0
  41. package/assets/components/assets/calcite-icon/terminal32.json +1 -0
  42. package/assets/components/assets/calcite-icon/touch16.json +1 -0
  43. package/assets/components/assets/calcite-icon/touch24.json +1 -0
  44. package/assets/components/assets/calcite-icon/touch32.json +1 -0
  45. package/assets/components/assets/calcite-icon/xHexagon16.json +1 -0
  46. package/assets/components/assets/calcite-icon/xHexagon24.json +1 -0
  47. package/assets/components/assets/calcite-icon/xHexagon32.json +1 -0
  48. package/assets/components/assets/calcite-icon/xHexagonF16.json +1 -0
  49. package/assets/components/assets/calcite-icon/xHexagonF24.json +1 -0
  50. package/assets/components/assets/calcite-icon/xHexagonF32.json +1 -0
  51. package/assets/components/assets/calcite-icon/xOctagonF16.json +1 -0
  52. package/assets/components/assets/calcite-icon/xOctagonF24.json +1 -0
  53. package/assets/components/assets/calcite-icon/xOctagonF32.json +1 -0
  54. package/assets/esri/core/workers/RemoteClient.js +1 -1
  55. package/assets/esri/core/workers/chunks/01ef8de7f76a8c61b464.js +1 -0
  56. package/assets/esri/core/workers/chunks/09da224052976e290828.js +1 -0
  57. package/assets/esri/core/workers/chunks/{2c9af2ebd72d9b55329b.js → 0f254c3e91e8fee55f28.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{ce5ca5e95b2378ec55b9.js → 1305ef8717da6e902a55.js} +1 -1
  59. package/assets/esri/core/workers/chunks/20411bb8e04703962ce6.js +1 -0
  60. package/assets/esri/core/workers/chunks/21a77eed1a4ef5b0ff08.js +1 -0
  61. package/assets/esri/core/workers/chunks/2416f8bf8bbd2ec786ab.js +1 -0
  62. package/assets/esri/core/workers/chunks/25a3e9bc0b4c7e0d3165.js +1 -0
  63. package/assets/esri/core/workers/chunks/{9c417740bf3707a0d465.js → 2c607d30ff8ca1b61286.js} +1 -1
  64. package/assets/esri/core/workers/chunks/2d947080a27db6ce0d75.js +1 -0
  65. package/assets/esri/core/workers/chunks/2e445a8735ea2adb641a.js +1 -0
  66. package/assets/esri/core/workers/chunks/3564e14010953def6df9.js +1 -0
  67. package/assets/esri/core/workers/chunks/37a7bd30352b1309b8f8.js +1 -0
  68. package/assets/esri/core/workers/chunks/390d9021169e65c10eb8.js +1 -0
  69. package/assets/esri/core/workers/chunks/{3d5169ea9810d10caf0d.js → 3a9740dccda6a733313c.js} +1 -1
  70. package/assets/esri/core/workers/chunks/403c7d64f12f00330d88.js +1 -0
  71. package/assets/esri/core/workers/chunks/4409d77c9734de4e82a7.js +1 -0
  72. package/assets/esri/core/workers/chunks/{f52b6d5037e4205b035c.js → 47395d225229d237f0ac.js} +1 -1
  73. package/assets/esri/core/workers/chunks/4b69129c0557852d9b3d.js +1 -0
  74. package/assets/esri/core/workers/chunks/4c301ca9c493b96df746.js +1 -0
  75. package/assets/esri/core/workers/chunks/57c67e260267a1dbc5e3.js +1 -0
  76. package/assets/esri/core/workers/chunks/5ac4c1d54b94c7d87835.js +1 -0
  77. package/assets/esri/core/workers/chunks/60371c0f750cde87656d.js +1 -0
  78. package/assets/esri/core/workers/chunks/631c5b514bb73782c570.js +1 -0
  79. package/assets/esri/core/workers/chunks/{3a2b2dc3e938d53faa30.js → 64276aacaafa4c8a15bd.js} +1 -1
  80. package/assets/esri/core/workers/chunks/{75466e0c8c8da499b150.js → 662d13f68cf3ec92439b.js} +1 -1
  81. package/assets/esri/core/workers/chunks/6c1e92ff4c732dfda756.js +1 -0
  82. package/assets/esri/core/workers/chunks/6cdfe175c965918b741b.js +1 -0
  83. package/assets/esri/core/workers/chunks/75d53b28afe732c459b2.js +1 -0
  84. package/assets/esri/core/workers/chunks/{ea05f870dda27bca4fe8.js → 7a8764ae8a0041e1151d.js} +2 -2
  85. package/assets/esri/core/workers/chunks/{ea05f870dda27bca4fe8.js.LICENSE.txt → 7a8764ae8a0041e1151d.js.LICENSE.txt} +1 -1
  86. package/assets/esri/core/workers/chunks/{b4ed7856cd9c98434477.js → 7c9d2638693d5f798b23.js} +1 -1
  87. package/assets/esri/core/workers/chunks/7e596478507466953e65.js +1 -0
  88. package/assets/esri/core/workers/chunks/85b34d91cf07567d6873.js +1 -0
  89. package/assets/esri/core/workers/chunks/85e27fd949475f9a6bbc.js +1 -0
  90. package/assets/esri/core/workers/chunks/8967288145f8fbd20e7d.js +1 -0
  91. package/assets/esri/core/workers/chunks/89de05207744149fb58b.js +1 -0
  92. package/assets/esri/core/workers/chunks/8cbb04a9065aa3756638.js +1 -0
  93. package/assets/esri/core/workers/chunks/{9846098704ee38bf6350.js → 8fdd5bca3716816d359b.js} +1 -1
  94. package/assets/esri/core/workers/chunks/96ab518eb6ba11333dee.js +1 -0
  95. package/assets/esri/core/workers/chunks/987182b3a578fc7de251.js +1 -0
  96. package/assets/esri/core/workers/chunks/99a777693e4539f0b03b.js +1 -0
  97. package/assets/esri/core/workers/chunks/9d77467aa71d345fc1b6.js +1 -0
  98. package/assets/esri/core/workers/chunks/{4beba242e7540ee3182b.js → 9d9dffc8884d66a258e4.js} +1 -1
  99. package/assets/esri/core/workers/chunks/9f8b7b6b4e95f9a794fc.js +1 -0
  100. package/assets/esri/core/workers/chunks/{a721342a32541717324d.js → a28b53c61bddefb6616e.js} +1 -1
  101. package/assets/esri/core/workers/chunks/{9b7c51ff3d2b42aa62f5.js → a7b1b75643ed31489495.js} +1 -1
  102. package/assets/esri/core/workers/chunks/a8b13fb804bb775e4967.js +1 -0
  103. package/assets/esri/core/workers/chunks/a8c13529367c037cdd94.js +1 -0
  104. package/assets/esri/core/workers/chunks/a960074644c3722be71e.js +1 -0
  105. package/assets/esri/core/workers/chunks/ac8dca61ade28c542ae2.js +1 -0
  106. package/assets/esri/core/workers/chunks/ad081d8e49e7f90c3c26.js +1 -0
  107. package/assets/esri/core/workers/chunks/b10fcbe1393c812fc219.js +1 -0
  108. package/assets/esri/core/workers/chunks/{2a39d520b192b8e552b5.js → b2ae5fc4f787ea568b88.js} +1 -1
  109. package/assets/esri/core/workers/chunks/{b51261a9a9ab62388839.js → b99e69302ea701fff0ea.js} +1 -1
  110. package/assets/esri/core/workers/chunks/{b87bc1481a49b38109f4.js → b9c177524b3e7de1ffd1.js} +1 -1
  111. package/assets/esri/core/workers/chunks/b9de831ac379cf1d2969.js +1 -0
  112. package/assets/esri/core/workers/chunks/ba615f118a3a8970ef25.js +1 -0
  113. package/assets/esri/core/workers/chunks/{7c1b9ae141112a63b446.js → ba6654a885be4b7a43f0.js} +1 -1
  114. package/assets/esri/core/workers/chunks/bc790b2f964144d10abe.js +1 -0
  115. package/assets/esri/core/workers/chunks/be2b7cce79fd41627931.js +1 -0
  116. package/assets/esri/core/workers/chunks/c13dfdd548dcb1bdb294.js +1 -0
  117. package/assets/esri/core/workers/chunks/c36f84daa7736878418d.js +1 -0
  118. package/assets/esri/core/workers/chunks/{b58eba403bd517a7bb15.js → c3eca92d02958732e141.js} +1 -1
  119. package/assets/esri/core/workers/chunks/c6f94b92e866b881d9b9.js +1 -0
  120. package/assets/esri/core/workers/chunks/cbb291412fd1a5261aa9.js +1 -0
  121. package/assets/esri/core/workers/chunks/d1454155ee1b8a421cbb.js +1 -0
  122. package/assets/esri/core/workers/chunks/{0cd583c3233573cb8468.js → d24c4fbc567486b1188f.js} +1 -1
  123. package/assets/esri/core/workers/chunks/d52108864136c5a8a618.js +1 -0
  124. package/assets/esri/core/workers/chunks/dd433c160f7a0c120b82.js +1 -0
  125. package/assets/esri/core/workers/chunks/de03439ca2c9782bf325.js +1 -0
  126. package/assets/esri/core/workers/chunks/e2d68bcd2f99a65387bf.js +1 -0
  127. package/assets/esri/core/workers/chunks/e59764ee8cf25d4f74e2.js +1 -0
  128. package/assets/esri/core/workers/chunks/{2f66fcb8670b108af549.js → ed0bcc66fb1e0ee75a4b.js} +1 -1
  129. package/assets/esri/core/workers/chunks/{6deac533bb455be4004b.js → ef8b75b92cf549e0507e.js} +1 -1
  130. package/assets/esri/core/workers/chunks/f7fc4c993536e62f7f3e.js +1 -0
  131. package/assets/esri/themes/base/icons/fonts/CalciteWebCoreIcons.svg +1 -0
  132. package/assets/esri/themes/base/icons/fonts/CalciteWebCoreIcons.ttf +0 -0
  133. package/assets/esri/themes/base/icons/fonts/CalciteWebCoreIcons.woff +0 -0
  134. package/assets/esri/themes/base/icons/selection.json +1 -1
  135. package/assets/esri/themes/base/icons/style.css +4 -0
  136. package/assets/esri/themes/base/icons/style.scss +6 -0
  137. package/assets/esri/themes/base/icons/variables.scss +1 -0
  138. package/assets/esri/themes/base/widgets/_Weather.scss +1 -1
  139. package/assets/esri/themes/dark/main.css +1 -1
  140. package/assets/esri/themes/dark-blue/main.css +1 -1
  141. package/assets/esri/themes/dark-green/main.css +1 -1
  142. package/assets/esri/themes/dark-purple/main.css +1 -1
  143. package/assets/esri/themes/dark-red/main.css +1 -1
  144. package/assets/esri/themes/light/main.css +1 -1
  145. package/assets/esri/themes/light/view.css +1 -1
  146. package/assets/esri/themes/light-blue/main.css +1 -1
  147. package/assets/esri/themes/light-green/main.css +1 -1
  148. package/assets/esri/themes/light-purple/main.css +1 -1
  149. package/assets/esri/themes/light-red/main.css +1 -1
  150. package/assets/esri/widgets/Editor/t9n/Editor_ar.json +1 -1
  151. package/assets/esri/widgets/Editor/t9n/Editor_bg.json +1 -1
  152. package/assets/esri/widgets/Editor/t9n/Editor_bs.json +1 -1
  153. package/assets/esri/widgets/Editor/t9n/Editor_ca.json +1 -1
  154. package/assets/esri/widgets/Editor/t9n/Editor_cs.json +1 -1
  155. package/assets/esri/widgets/Editor/t9n/Editor_da.json +1 -1
  156. package/assets/esri/widgets/Editor/t9n/Editor_de.json +1 -1
  157. package/assets/esri/widgets/Editor/t9n/Editor_el.json +1 -1
  158. package/assets/esri/widgets/Editor/t9n/Editor_es.json +1 -1
  159. package/assets/esri/widgets/Editor/t9n/Editor_et.json +1 -1
  160. package/assets/esri/widgets/Editor/t9n/Editor_fi.json +1 -1
  161. package/assets/esri/widgets/Editor/t9n/Editor_fr.json +1 -1
  162. package/assets/esri/widgets/Editor/t9n/Editor_he.json +1 -1
  163. package/assets/esri/widgets/Editor/t9n/Editor_hr.json +1 -1
  164. package/assets/esri/widgets/Editor/t9n/Editor_hu.json +1 -1
  165. package/assets/esri/widgets/Editor/t9n/Editor_id.json +1 -1
  166. package/assets/esri/widgets/Editor/t9n/Editor_it.json +1 -1
  167. package/assets/esri/widgets/Editor/t9n/Editor_ja.json +1 -1
  168. package/assets/esri/widgets/Editor/t9n/Editor_ko.json +1 -1
  169. package/assets/esri/widgets/Editor/t9n/Editor_lt.json +1 -1
  170. package/assets/esri/widgets/Editor/t9n/Editor_lv.json +1 -1
  171. package/assets/esri/widgets/Editor/t9n/Editor_nb.json +1 -1
  172. package/assets/esri/widgets/Editor/t9n/Editor_nl.json +1 -1
  173. package/assets/esri/widgets/Editor/t9n/Editor_pl.json +1 -1
  174. package/assets/esri/widgets/Editor/t9n/Editor_pt-BR.json +1 -1
  175. package/assets/esri/widgets/Editor/t9n/Editor_pt-PT.json +1 -1
  176. package/assets/esri/widgets/Editor/t9n/Editor_ro.json +1 -1
  177. package/assets/esri/widgets/Editor/t9n/Editor_ru.json +1 -1
  178. package/assets/esri/widgets/Editor/t9n/Editor_sk.json +1 -1
  179. package/assets/esri/widgets/Editor/t9n/Editor_sl.json +1 -1
  180. package/assets/esri/widgets/Editor/t9n/Editor_sr.json +1 -1
  181. package/assets/esri/widgets/Editor/t9n/Editor_sv.json +1 -1
  182. package/assets/esri/widgets/Editor/t9n/Editor_th.json +1 -1
  183. package/assets/esri/widgets/Editor/t9n/Editor_tr.json +1 -1
  184. package/assets/esri/widgets/Editor/t9n/Editor_uk.json +1 -1
  185. package/assets/esri/widgets/Editor/t9n/Editor_vi.json +1 -1
  186. package/assets/esri/widgets/Editor/t9n/Editor_zh-CN.json +1 -1
  187. package/assets/esri/widgets/Editor/t9n/Editor_zh-HK.json +1 -1
  188. package/assets/esri/widgets/Editor/t9n/Editor_zh-TW.json +1 -1
  189. package/assets/esri/widgets/ElevationProfile/t9n/ElevationProfile_ja.json +1 -1
  190. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_ar.json +1 -1
  191. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_bg.json +1 -1
  192. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_bs.json +1 -1
  193. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_ca.json +1 -1
  194. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_cs.json +1 -1
  195. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_da.json +1 -1
  196. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_de.json +1 -1
  197. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_el.json +1 -1
  198. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_es.json +1 -1
  199. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_et.json +1 -1
  200. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_fi.json +1 -1
  201. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_fr.json +1 -1
  202. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_he.json +1 -1
  203. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_hr.json +1 -1
  204. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_hu.json +1 -1
  205. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_id.json +1 -1
  206. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_it.json +1 -1
  207. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_ja.json +1 -1
  208. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_ko.json +1 -1
  209. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_lt.json +1 -1
  210. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_lv.json +1 -1
  211. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_nb.json +1 -1
  212. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_nl.json +1 -1
  213. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_pl.json +1 -1
  214. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_pt-BR.json +1 -1
  215. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_pt-PT.json +1 -1
  216. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_ro.json +1 -1
  217. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_ru.json +1 -1
  218. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_sk.json +1 -1
  219. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_sl.json +1 -1
  220. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_sr.json +1 -1
  221. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_sv.json +1 -1
  222. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_th.json +1 -1
  223. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_tr.json +1 -1
  224. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_uk.json +1 -1
  225. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_vi.json +1 -1
  226. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_zh-CN.json +1 -1
  227. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_zh-HK.json +1 -1
  228. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_zh-TW.json +1 -1
  229. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_cs.json +1 -1
  230. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_el.json +1 -1
  231. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_fr.json +1 -1
  232. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_lv.json +1 -1
  233. package/assets/esri/widgets/Weather/t9n/Weather_ar.json +1 -1
  234. package/assets/esri/widgets/Weather/t9n/Weather_bg.json +1 -1
  235. package/assets/esri/widgets/Weather/t9n/Weather_bs.json +1 -1
  236. package/assets/esri/widgets/Weather/t9n/Weather_ca.json +1 -1
  237. package/assets/esri/widgets/Weather/t9n/Weather_cs.json +1 -1
  238. package/assets/esri/widgets/Weather/t9n/Weather_da.json +1 -1
  239. package/assets/esri/widgets/Weather/t9n/Weather_de.json +1 -1
  240. package/assets/esri/widgets/Weather/t9n/Weather_el.json +1 -1
  241. package/assets/esri/widgets/Weather/t9n/Weather_es.json +1 -1
  242. package/assets/esri/widgets/Weather/t9n/Weather_et.json +1 -1
  243. package/assets/esri/widgets/Weather/t9n/Weather_fi.json +1 -1
  244. package/assets/esri/widgets/Weather/t9n/Weather_fr.json +1 -1
  245. package/assets/esri/widgets/Weather/t9n/Weather_he.json +1 -1
  246. package/assets/esri/widgets/Weather/t9n/Weather_hr.json +1 -1
  247. package/assets/esri/widgets/Weather/t9n/Weather_hu.json +1 -1
  248. package/assets/esri/widgets/Weather/t9n/Weather_id.json +1 -1
  249. package/assets/esri/widgets/Weather/t9n/Weather_it.json +1 -1
  250. package/assets/esri/widgets/Weather/t9n/Weather_ja.json +1 -1
  251. package/assets/esri/widgets/Weather/t9n/Weather_ko.json +1 -1
  252. package/assets/esri/widgets/Weather/t9n/Weather_lt.json +1 -1
  253. package/assets/esri/widgets/Weather/t9n/Weather_lv.json +1 -1
  254. package/assets/esri/widgets/Weather/t9n/Weather_nb.json +1 -1
  255. package/assets/esri/widgets/Weather/t9n/Weather_nl.json +1 -1
  256. package/assets/esri/widgets/Weather/t9n/Weather_pl.json +1 -1
  257. package/assets/esri/widgets/Weather/t9n/Weather_pt-BR.json +1 -1
  258. package/assets/esri/widgets/Weather/t9n/Weather_pt-PT.json +1 -1
  259. package/assets/esri/widgets/Weather/t9n/Weather_ro.json +1 -1
  260. package/assets/esri/widgets/Weather/t9n/Weather_ru.json +1 -1
  261. package/assets/esri/widgets/Weather/t9n/Weather_sk.json +1 -1
  262. package/assets/esri/widgets/Weather/t9n/Weather_sl.json +1 -1
  263. package/assets/esri/widgets/Weather/t9n/Weather_sr.json +1 -1
  264. package/assets/esri/widgets/Weather/t9n/Weather_sv.json +1 -1
  265. package/assets/esri/widgets/Weather/t9n/Weather_th.json +1 -1
  266. package/assets/esri/widgets/Weather/t9n/Weather_tr.json +1 -1
  267. package/assets/esri/widgets/Weather/t9n/Weather_uk.json +1 -1
  268. package/assets/esri/widgets/Weather/t9n/Weather_vi.json +1 -1
  269. package/assets/esri/widgets/Weather/t9n/Weather_zh-CN.json +1 -1
  270. package/assets/esri/widgets/Weather/t9n/Weather_zh-HK.json +1 -1
  271. package/assets/esri/widgets/Weather/t9n/Weather_zh-TW.json +1 -1
  272. package/chunks/Clouds.glsl.js +14 -14
  273. package/chunks/HUDMaterial.glsl.js +22 -21
  274. package/chunks/RibbonLine.glsl.js +10 -14
  275. package/chunks/persistableUrlUtils.js +1 -1
  276. package/chunks/vec32.js +1 -1
  277. package/chunks/vec42.js +1 -1
  278. package/core/typedArrayUtil.js +1 -1
  279. package/core/urlUtils.js +1 -1
  280. package/form/elements/FieldElement.js +1 -1
  281. package/geometry/support/buffer/math/common.js +1 -1
  282. package/interfaces.d.ts +99 -56
  283. package/layers/FeatureLayer.js +1 -1
  284. package/layers/SubtypeGroupLayer.js +1 -1
  285. package/layers/VectorTileLayer.js +1 -1
  286. package/layers/WMSLayer.js +1 -1
  287. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  288. package/layers/graphics/data/QueryEngineCapabilities.js +1 -1
  289. package/layers/graphics/sources/OGCFeatureSource.js +1 -1
  290. package/layers/mixins/ArcGISImageService.js +1 -1
  291. package/layers/ogc/crsUtils.js +5 -0
  292. package/layers/support/RasterFunction.js +1 -1
  293. package/layers/support/capabilities.js +1 -1
  294. package/layers/support/rasterDatasets/WCSRaster.js +1 -1
  295. package/layers/support/rasterDatasets/wcsCoverageParser.js +1 -1
  296. package/layers/support/vectorTileLayerLoader.js +1 -1
  297. package/layers/support/wmsUtils.js +1 -1
  298. package/layers/support/wmtsUtils.js +1 -1
  299. package/package.json +5 -5
  300. package/renderers/support/RasterSymbolizer.js +1 -1
  301. package/request.js +1 -1
  302. package/rest/print.js +1 -1
  303. package/rest/support/ImageIdentifyParameters.js +1 -1
  304. package/rest/support/StatisticDefinition.js +1 -1
  305. package/smartMapping/renderers/univariateColorSize.js +1 -1
  306. package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
  307. package/support/featureFlags.js +1 -1
  308. package/support/revision.js +1 -1
  309. package/symbols/ExtrudeSymbol3DLayer.js +1 -1
  310. package/symbols/Font.js +1 -1
  311. package/symbols/IconSymbol3DLayer.js +1 -1
  312. package/symbols/ObjectSymbol3DLayer.js +1 -1
  313. package/symbols/PathSymbol3DLayer.js +1 -1
  314. package/symbols/TextSymbol.js +1 -1
  315. package/symbols/TextSymbol3DLayer.js +1 -1
  316. package/symbols/support/Symbol3DHalo.js +1 -1
  317. package/symbols/support/Symbol3DMaterial.js +1 -1
  318. package/symbols/support/constants.js +5 -0
  319. package/symbols/support/utils.js +1 -1
  320. package/views/2d/engine/Stage.js +1 -1
  321. package/views/2d/engine/vectorTiles/TileHandler.js +1 -1
  322. package/views/2d/engine/vectorTiles/shaders/VTLMaterialManager.js +1 -1
  323. package/views/2d/engine/vectorTiles/style/VectorTileSource.js +1 -1
  324. package/views/2d/engine/vectorTiles/style/VectorTilesRequestManager.js +5 -0
  325. package/views/2d/engine/webgl/BitBlitRenderer.js +1 -1
  326. package/views/2d/engine/webgl/MaterialManager.js +1 -1
  327. package/views/2d/engine/webgl/alignmentUtils.js +1 -1
  328. package/views/2d/engine/webgl/effects/BlendEffect.js +1 -1
  329. package/views/2d/engine/webgl/materialKey/MaterialKey.js +1 -1
  330. package/views/2d/engine/webgl/mesh/templates/WGLLabelTemplate.js +1 -1
  331. package/views/2d/engine/webgl/shaders/BlendPrograms.js +1 -1
  332. package/views/2d/engine/webgl/shaders/MaterialPrograms.js +1 -1
  333. package/views/2d/layers/BaseLayerView2D.js +1 -1
  334. package/views/2d/layers/BaseLayerViewGL2D.js +1 -1
  335. package/views/2d/layers/GraphicsLayerView2D.js +1 -1
  336. package/views/2d/layers/ImageryLayerView2D.js +1 -1
  337. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  338. package/views/2d/layers/LayerView2D.js +1 -1
  339. package/views/2d/layers/MapNotesLayerView2D.js +1 -1
  340. package/views/2d/layers/RouteLayerView2D.js +1 -1
  341. package/views/2d/layers/TileLayerView2D.js +1 -1
  342. package/views/2d/layers/VectorTileLayerView2D.js +1 -1
  343. package/views/2d/layers/WMSLayerView2D.js +1 -1
  344. package/views/2d/layers/WMTSLayerView2D.js +1 -1
  345. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  346. package/views/2d/layers/graphics/GraphicBoundsRenderer.js +1 -1
  347. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  348. package/views/2d/support/engineHelpers.js +1 -1
  349. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  350. package/views/3d/environment/CloudyWeather.js +1 -1
  351. package/views/3d/environment/Fog.js +1 -1
  352. package/views/3d/environment/FoggyWeather.js +1 -1
  353. package/views/3d/environment/NoiseTextureAtlas.js +1 -1
  354. package/views/3d/environment/RainyWeather.js +1 -1
  355. package/views/3d/environment/Stars.js +1 -1
  356. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  357. package/views/3d/layers/DynamicLayerView3D.js +1 -1
  358. package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
  359. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  360. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  361. package/views/3d/layers/GraphicsView3D.js +1 -1
  362. package/views/3d/layers/I3SMeshView3D.js +1 -1
  363. package/views/3d/layers/ImageryLayerView3D.js +1 -1
  364. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  365. package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
  366. package/views/3d/layers/MapImageLayerView3D.js +1 -1
  367. package/views/3d/layers/OGCFeatureLayerView3D.js +1 -1
  368. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  369. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  370. package/views/3d/layers/SceneLayerView3D.js +1 -1
  371. package/views/3d/layers/VectorTileLayerView3D.js +1 -1
  372. package/views/3d/layers/WMSLayerView3D.js +1 -1
  373. package/views/3d/layers/WMTSLayerView3D.js +1 -1
  374. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  375. package/views/3d/layers/graphics/Graphics3DFeatureLikeLayerView.js +1 -1
  376. package/views/3d/layers/graphics/Graphics3DGraphicLikeLayerView.js +1 -1
  377. package/views/3d/layers/graphics/Graphics3DPointSymbol.js +1 -1
  378. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  379. package/views/3d/layers/graphics/Labeler.js +1 -1
  380. package/views/3d/layers/graphics/QueryEngine.js +1 -1
  381. package/views/3d/layers/support/FeatureTileTree3DDebugger.js +1 -1
  382. package/views/3d/state/controllers/RotateController.js +1 -1
  383. package/views/3d/state/controllers/global/PinchAndPanController.js +1 -1
  384. package/views/3d/state/controllers/global/ZoomController.js +1 -1
  385. package/views/3d/state/controllers/global/ZoomStepController.js +1 -1
  386. package/views/3d/state/controllers/local/PinchAndPanController.js +1 -1
  387. package/views/3d/state/controllers/local/ZoomStepController.js +1 -1
  388. package/views/3d/support/debugFlags.js +1 -1
  389. package/views/3d/support/sunUtils.js +1 -1
  390. package/views/3d/terrain/Overlay.js +1 -1
  391. package/views/3d/terrain/OverlayManager.js +1 -1
  392. package/views/3d/terrain/TerrainSurface.js +1 -1
  393. package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +19 -14
  394. package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
  395. package/views/3d/webgl-engine/lib/InstanceParameters.js +5 -0
  396. package/views/3d/webgl-engine/lib/{localOrigin.js → LocalOriginFactory.js} +0 -0
  397. package/views/3d/webgl-engine/lib/Program.js +1 -1
  398. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  399. package/views/3d/webgl-engine/lib/RenderTargetHelper.js +1 -1
  400. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  401. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  402. package/views/3d/webgl-engine/lib/SSAOHelper.js +1 -1
  403. package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
  404. package/views/3d/webgl-engine/lib/TextRenderer.js +1 -1
  405. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  406. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  407. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  408. package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
  409. package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
  410. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  411. package/views/LayerViewManager.js +1 -1
  412. package/views/MapView.js +1 -1
  413. package/views/SceneView.js +1 -1
  414. package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
  415. package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
  416. package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
  417. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
  418. package/views/layers/ImageryTileLayerView.js +1 -1
  419. package/views/layers/LayerView.js +1 -1
  420. package/views/layers/OGCFeatureLayerView.js +1 -1
  421. package/views/layers/RefreshableLayerView.js +1 -1
  422. package/views/overlay/ViewOverlay.js +1 -1
  423. package/views/support/WatchUpdatingTracking.js +1 -1
  424. package/views/support/imageReprojection.js +1 -1
  425. package/views/webgl/BufferObject.js +1 -1
  426. package/views/webgl/ContextState.js +1 -1
  427. package/views/webgl/FramebufferObject.js +1 -1
  428. package/views/webgl/Program.js +1 -1
  429. package/views/webgl/ProgramCache.js +1 -1
  430. package/views/webgl/ProgramTemplate.js +1 -1
  431. package/views/webgl/RenderingContext.js +1 -1
  432. package/views/webgl/ShaderTranspiler.js +1 -1
  433. package/views/webgl/UniformBufferLayout.js +5 -0
  434. package/views/webgl/UniformBufferObject.js +5 -0
  435. package/views/webgl/enums.js +1 -1
  436. package/views/webgl/rasterUtils.js +1 -1
  437. package/views/webgl/storageLayouts.js +5 -0
  438. package/views/webgl/testDoublePrecisionArithmetic.js +1 -1
  439. package/views/webgl/testFloatBufferBlend.js +1 -1
  440. package/views/webgl/testSVGPremultipliedAlpha.js +1 -1
  441. package/views/webgl/testSamplerPrecision.js +1 -1
  442. package/views/webgl/tests/SimpleDraw.js +1 -1
  443. package/widgets/BasemapLayerList.js +1 -1
  444. package/widgets/BuildingExplorer/BuildingDisciplinesViewModel.js +1 -1
  445. package/widgets/Editor/BatchCreateWorkflow.js +1 -1
  446. package/widgets/Editor/CreateWorkflow.js +1 -1
  447. package/widgets/Editor/UpdateWorkflow.js +1 -1
  448. package/widgets/ElevationProfile/components/SettingsButton.js +1 -1
  449. package/widgets/ElevationProfile.js +1 -1
  450. package/widgets/Feature/FeatureExpression/FeatureExpressionViewModel.js +1 -1
  451. package/widgets/Feature/FeatureMedia.js +1 -1
  452. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  453. package/widgets/FeatureForm/InputField.js +1 -1
  454. package/widgets/FeatureForm/InputFieldGroup.js +1 -1
  455. package/widgets/FeatureForm.js +1 -1
  456. package/widgets/FeatureTemplates.js +1 -1
  457. package/widgets/FloorFilter.js +1 -1
  458. package/widgets/LayerList/ListItemPanel.js +1 -1
  459. package/widgets/LayerList/support/layerListUtils.js +1 -1
  460. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  461. package/widgets/Popup.js +1 -1
  462. package/widgets/Print.js +1 -1
  463. package/widgets/Search.js +1 -1
  464. package/widgets/Sketch/SketchViewModel.js +1 -1
  465. package/widgets/Weather/CoverageSlider.js +5 -0
  466. package/widgets/Weather/WeatherViewModel.js +1 -1
  467. package/widgets/Weather/css.js +1 -1
  468. package/widgets/Weather.js +1 -1
  469. package/assets/esri/core/workers/chunks/0881ce46b10362861f87.js +0 -1
  470. package/assets/esri/core/workers/chunks/0c0a02770eeeb3e28ea1.js +0 -1
  471. package/assets/esri/core/workers/chunks/0d2effbd84a9482eb639.js +0 -1
  472. package/assets/esri/core/workers/chunks/0f04246c1b591a3ac74d.js +0 -1
  473. package/assets/esri/core/workers/chunks/1ac6be0dc25e16c75d06.js +0 -1
  474. package/assets/esri/core/workers/chunks/1f8110ea12d65ca94b55.js +0 -1
  475. package/assets/esri/core/workers/chunks/2025d0fd61a64876c81b.js +0 -1
  476. package/assets/esri/core/workers/chunks/241859d74c0daac62e11.js +0 -1
  477. package/assets/esri/core/workers/chunks/331be347c1b1ca0be2d2.js +0 -1
  478. package/assets/esri/core/workers/chunks/39af317388ecebb4387d.js +0 -1
  479. package/assets/esri/core/workers/chunks/39be2893a7dbdecfd65a.js +0 -1
  480. package/assets/esri/core/workers/chunks/3a20f66b0b7d08064e34.js +0 -1
  481. package/assets/esri/core/workers/chunks/445099d037affd139ed0.js +0 -1
  482. package/assets/esri/core/workers/chunks/45848fecec88ed2da33d.js +0 -1
  483. package/assets/esri/core/workers/chunks/48d3a3abc53abe6a4017.js +0 -1
  484. package/assets/esri/core/workers/chunks/5005b8c1fdd5cb9a4c19.js +0 -1
  485. package/assets/esri/core/workers/chunks/52e4c367c72ea7cc3457.js +0 -1
  486. package/assets/esri/core/workers/chunks/5d8170f6207dbeb4de1b.js +0 -1
  487. package/assets/esri/core/workers/chunks/642c38ac00a962f35d44.js +0 -1
  488. package/assets/esri/core/workers/chunks/64459604505647e9c714.js +0 -1
  489. package/assets/esri/core/workers/chunks/653d1550dd1a4867a9fc.js +0 -1
  490. package/assets/esri/core/workers/chunks/65f73fbbc3c7c60c6d3d.js +0 -1
  491. package/assets/esri/core/workers/chunks/6db7081d344bea26ef64.js +0 -1
  492. package/assets/esri/core/workers/chunks/6e13dab8ec43f7494297.js +0 -1
  493. package/assets/esri/core/workers/chunks/7bd4c3ee43fb038b88d8.js +0 -1
  494. package/assets/esri/core/workers/chunks/803de5097a8a2c4b58a8.js +0 -1
  495. package/assets/esri/core/workers/chunks/8298231a0fd0129b0d5c.js +0 -1
  496. package/assets/esri/core/workers/chunks/8500c6c011400af1b7bd.js +0 -1
  497. package/assets/esri/core/workers/chunks/8b322a2a47dfdbb59b45.js +0 -1
  498. package/assets/esri/core/workers/chunks/8f83bebef9174c3f15da.js +0 -1
  499. package/assets/esri/core/workers/chunks/904332faa22bc0e876cb.js +0 -1
  500. package/assets/esri/core/workers/chunks/950565d1e682fc4072e1.js +0 -1
  501. package/assets/esri/core/workers/chunks/a247ddd84245c81112c8.js +0 -1
  502. package/assets/esri/core/workers/chunks/a9ffa806df20130ecfb6.js +0 -1
  503. package/assets/esri/core/workers/chunks/af13e534e4160636bd3d.js +0 -1
  504. package/assets/esri/core/workers/chunks/b2f62234ebb8b6158baa.js +0 -1
  505. package/assets/esri/core/workers/chunks/b5bb7cfa26b1f0cec67a.js +0 -1
  506. package/assets/esri/core/workers/chunks/b8666d1a4e4fff7a4703.js +0 -1
  507. package/assets/esri/core/workers/chunks/bea1da9e3f878e0e2c83.js +0 -1
  508. package/assets/esri/core/workers/chunks/c1b6c31fa3ec1542f996.js +0 -1
  509. package/assets/esri/core/workers/chunks/c32a4fbdc87225f84019.js +0 -1
  510. package/assets/esri/core/workers/chunks/c67fea81f69a60c0eaef.js +0 -1
  511. package/assets/esri/core/workers/chunks/d336afd5890dcdbf5341.js +0 -1
  512. package/assets/esri/core/workers/chunks/da69e3e5949fe1716e34.js +0 -1
  513. package/assets/esri/core/workers/chunks/daa9c450b2e2a5371249.js +0 -1
  514. package/assets/esri/core/workers/chunks/dd63ba77b7e4c3c9c594.js +0 -1
  515. package/assets/esri/core/workers/chunks/dfa57982d28c9aeb97b9.js +0 -1
  516. package/assets/esri/core/workers/chunks/e01812116b27874948f0.js +0 -1
  517. package/assets/esri/core/workers/chunks/e5c9d8482b913cf3580a.js +0 -1
  518. package/assets/esri/core/workers/chunks/eeadd92f0bede9fc8745.js +0 -1
  519. package/assets/esri/core/workers/chunks/fbb67cb6224aed2cce16.js +0 -1
  520. package/assets/esri/core/workers/chunks/feeaf61424336e9eac88.js +0 -1
  521. package/assets/esri/core/workers/chunks/ff02295329a8986d0568.js +0 -1
  522. package/views/2d/engine/webgl/mesh/templates/meshUtils.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{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}from"../../core/maybe.js";import{after as s}from"../../core/promiseUtils.js";import"./BufferObject.js";import"./FramebufferObject.js";import"../../core/has.js";import{webglDebugEnabled as i}from"./checkWebGLError.js";import{ContextType as a}from"./context-util.js";import{BufferType as r,Face as n,BASE_TEXTURE_UNIT as l,ClearBufferBit as h,TextureType as o,SyncCondition as f,ClientWaitSyncStatus as _,BlendFactor as u,BlendOperation as c,CullMode as d,CompareFunction as g,StencilOperation as b,PrimitiveType as p}from"./enums.js";import"./ShaderTranspiler.js";import{ProgramCache as F}from"./ProgramCache.js";import{Texture as B}from"./Texture.js";import"./VertexArrayObject.js";import{ContextState as E}from"./ContextState.js";import{InstanceCounter as m}from"./InstanceCounter.js";import{StateTracker as T}from"./renderState.js";import{WebGLDriverTest as R}from"./WebGLDriverTest.js";import{Capabilities as O}from"./capabilities/Capabilities.js";import x from"./capabilities/isWebGL2Context.js";class U{constructor(t,e){this.gl=t,this.instanceCounter=new m,this.programCache=new F(this),this._state=new E,this._numOfDrawCalls=0,this._numOfTriangles=0,this.type=x(t)?a.WEBGL2:a.WEBGL1,this._loadExtensions(),this.configure(e)}configure(t){this._capabilities=new O(this.gl,t),this._parameters=this._loadParameters(t);const e=this.gl.getParameter(this.gl.VIEWPORT);this._state=new E,this._state.viewport={x:e[0],y:e[1],width:e[2],height:e[3]},this._stateTracker=new T({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 R(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(r.ARRAY_BUFFER),this.unbindBuffer(r.ELEMENT_ARRAY_BUFFER),x(this.gl)&&(this.unbindBuffer(r.UNIFORM_BUFFER),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(r.PIXEL_PACK_BUFFER),this.unbindBuffer(r.PIXEL_UNPACK_BUFFER),this.unbindBuffer(r.COPY_READ_BUFFER),this.unbindBuffer(r.COPY_WRITE_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=n.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===n.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=n.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(l+t),this._state.activeTexture=t),s}clear(t){t&&this.gl.clear(t)}clearSafe(t,e=255){t&&(t&h.COLOR_BUFFER_BIT&&this.setColorMask(!0,!0,!0,!0),t&h.DEPTH_BUFFER_BIT&&this.setDepthWriteEnabled(!0),t&h.STENCIL_BUFFER_BIT&&this.setStencilWriteMask(e),this.gl.clear(t))}drawArrays(t,e,s){i()&&(this._numOfDrawCalls++,this._numOfTriangles+=C(t,s)),this.gl.drawArrays(t,e,s)}drawElements(t,e,s,a){i()&&(this._numOfDrawCalls++,this._numOfTriangles+=C(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}}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,i=o.TEXTURE_2D){if(t(e))return this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null),void(this._state.framebuffer=null);(s||this._state.framebuffer!==e)&&(e.initializeAndBind(i),this._state.framebuffer=e)}bindBuffer(t,e){if(t)switch(null!=e||(e=t.bufferType),e){case r.ARRAY_BUFFER:this._state.vertexBuffer=A(this.gl,t,e,this._state.vertexBuffer);break;case r.ELEMENT_ARRAY_BUFFER:this._state.indexBuffer=A(this.gl,t,e,this._state.indexBuffer);break;case r.UNIFORM_BUFFER:this._state.uniformBuffer=A(this.gl,t,e,this._state.uniformBuffer);break;case r.PIXEL_PACK_BUFFER:this._state.pixelPackBuffer=A(this.gl,t,e,this._state.pixelPackBuffer);break;case r.PIXEL_UNPACK_BUFFER:this._state.pixelUnpackBuffer=A(this.gl,t,e,this._state.pixelUnpackBuffer);break;case r.COPY_READ_BUFFER:this._state.copyReadBuffer=A(this.gl,t,e,this._state.copyReadBuffer);break;case r.COPY_WRITE_BUFFER:this._state.copyWriteBuffer=A(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,a,n){t(s)?this.bindBufferBase(r.UNIFORM_BUFFER,e,null):(i()&&(null!=n?n:s.byteLength)>this._parameters.maxUniformBlockSize&&console.error("Attempting to bind more data than the maximum uniform block size"),s.initialize(),void 0!==a&&void 0!==n?this.bindBufferRange(r.UNIFORM_BUFFER,e,s.buffer,a,n):this.bindBufferBase(r.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(r.UNIFORM_BUFFER,s,null)}}unbindBuffer(t){switch(t){case r.ARRAY_BUFFER:this._state.vertexBuffer=A(this.gl,null,t,this._state.vertexBuffer);break;case r.ELEMENT_ARRAY_BUFFER:this._state.indexBuffer=A(this.gl,null,t,this._state.indexBuffer);break;case r.UNIFORM_BUFFER:this._state.uniformBuffer=A(this.gl,null,t,this._state.uniformBuffer);break;case r.PIXEL_PACK_BUFFER:this._state.pixelPackBuffer=A(this.gl,null,t,this._state.pixelPackBuffer);break;case r.PIXEL_UNPACK_BUFFER:this._state.pixelUnpackBuffer=A(this.gl,null,t,this._state.pixelUnpackBuffer);break;case r.COPY_READ_BUFFER:this._state.copyReadBuffer=A(this.gl,null,t,this._state.copyReadBuffer);break;case r.COPY_WRITE_BUFFER:this._state.copyWriteBuffer=A(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,i=e.fenceSync(f.SYNC_GPU_COMMANDS_COMPLETE,0);let a;e.flush();do{await s(t),a=e.clientWaitSync(i,0,0)}while(a===_.TIMEOUT_EXPIRED);if(e.deleteSync(i),a===_.WAIT_FAILED)throw new Error("Client wait failed")}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),x(this.gl)&&(this.unbindBuffer(r.UNIFORM_BUFFER),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(r.PIXEL_PACK_BUFFER),this.unbindBuffer(r.PIXEL_UNPACK_BUFFER),this.unbindBuffer(r.COPY_READ_BUFFER),this.unbindBuffer(r.COPY_WRITE_BUFFER));for(let t=0;t<this.parameters.maxTextureImageUnits;++t)this.bindTexture(null,t);this.setBlendingEnabled(!1),this.setBlendFunction(u.ONE,u.ZERO),this.setBlendEquation(c.ADD),this.setBlendColor(0,0,0,0),this.setFaceCullingEnabled(!1),this.setCullFace(n.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(g.LESS),this.setDepthRange(0,1),this.setStencilTestEnabled(!1),this.setStencilFunction(g.ALWAYS,0,0),this.setStencilOp(b.KEEP,b.KEEP,b.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,a,n;const h=this.gl,f=this.capabilities.vao;f&&f.bindVertexArray(null);for(let e=0;e<this.parameters.maxVertexAttributes;e++)h.disableVertexAttribArray(e);if(this._state.vertexBuffer?h.bindBuffer(this._state.vertexBuffer.bufferType,this._state.vertexBuffer.glName):h.bindBuffer(r.ARRAY_BUFFER,null),this._state.indexBuffer?h.bindBuffer(this._state.indexBuffer.bufferType,this._state.indexBuffer.glName):h.bindBuffer(r.ELEMENT_ARRAY_BUFFER,null),x(h)){this._state.uniformBuffer?h.bindBuffer(this._state.uniformBuffer.bufferType,this._state.uniformBuffer.glName):h.bindBuffer(r.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:i,size:a}=s;0===i&&0===a?h.bindBufferBase(r.UNIFORM_BUFFER,t,e.glName):h.bindBufferRange(r.UNIFORM_BUFFER,t,e.glName,i,a)}else h.bindBufferBase(r.UNIFORM_BUFFER,t,null)}this._state.pixelPackBuffer?h.bindBuffer(this._state.pixelPackBuffer.bufferType,this._state.pixelPackBuffer.glName):h.bindBuffer(r.PIXEL_PACK_BUFFER,null),this._state.pixelUnpackBuffer?h.bindBuffer(this._state.pixelUnpackBuffer.bufferType,this._state.pixelUnpackBuffer.glName):h.bindBuffer(r.PIXEL_UNPACK_BUFFER,null),this._state.copyReadBuffer?h.bindBuffer(this._state.copyReadBuffer.bufferType,this._state.copyReadBuffer.glName):h.bindBuffer(r.COPY_READ_BUFFER,null),this._state.copyWriteBuffer?h.bindBuffer(this._state.copyWriteBuffer.bufferType,this._state.copyWriteBuffer.glName):h.bindBuffer(r.COPY_WRITE_BUFFER,null)}if(f&&this._state.vertexArrayObject){const t=this._state.vertexArrayObject;this._state.vertexArrayObject&&(this._state.vertexArrayObject.unbind(),this._state.vertexArrayObject=null),this.bindVAO(t)}h.bindFramebuffer(h.FRAMEBUFFER,null!=(t=null==(s=this._state.framebuffer)?void 0:s.glName)?t:null),h.useProgram(null!=(a=null==(n=this._state.program)?void 0:n.glName)?a:null),h.blendColor(this._state.blendColor.r,this._state.blendColor.g,this._state.blendColor.b,this._state.blendColor.a),h.bindRenderbuffer(h.RENDERBUFFER,this._state.renderbuffer?this._state.renderbuffer.glName:null),!0===this._state.blend?h.enable(this.gl.BLEND):h.disable(this.gl.BLEND),h.blendEquationSeparate(this._state.blendEquation.mode,this._state.blendEquation.modeAlpha),h.blendFuncSeparate(this._state.blendFunction.srcRGB,this._state.blendFunction.dstRGB,this._state.blendFunction.srcAlpha,this._state.blendFunction.dstAlpha),h.clearColor(this._state.clearColor.r,this._state.clearColor.g,this._state.clearColor.b,this._state.clearColor.a),h.clearDepth(this._state.clearDepth),h.clearStencil(this._state.clearStencil),h.colorMask(this._state.colorMask.r,this._state.colorMask.g,this._state.colorMask.b,this._state.colorMask.a),h.cullFace(this._state.cullFace),h.depthFunc(this._state.depthFunction),h.depthRange(this._state.depthRange.zNear,this._state.depthRange.zFar),!0===this._state.depthTest?h.enable(h.DEPTH_TEST):h.disable(h.DEPTH_TEST),h.depthMask(this._state.depthWrite),h.frontFace(this._state.frontFace),h.lineWidth(1),!0===this._state.faceCulling?h.enable(h.CULL_FACE):h.disable(h.CULL_FACE),h.polygonOffset(this._state.polygonOffset[0],this._state.polygonOffset[1]),!0===this._state.polygonOffsetFill?h.enable(h.POLYGON_OFFSET_FILL):h.disable(h.POLYGON_OFFSET_FILL),h.scissor(this._state.scissorRect.x,this._state.scissorRect.y,this._state.scissorRect.width,this._state.scissorRect.height),!0===this._state.scissorTest?h.enable(h.SCISSOR_TEST):h.disable(h.SCISSOR_TEST),h.stencilFunc(this._state.stencilFunction.func,this._state.stencilFunction.ref,this._state.stencilFunction.mask),h.stencilOpSeparate(this._state.stencilOperation.face,this._state.stencilOperation.fail,this._state.stencilOperation.zFail,this._state.stencilOperation.zPass),!0===this._state.stencilTest?h.enable(h.STENCIL_TEST):h.disable(h.STENCIL_TEST),h.stencilMask(this._state.stencilWriteMask);for(let i=0;i<this.parameters.maxTextureImageUnits;i++){h.activeTexture(l+i),h.bindTexture(o.TEXTURE_2D,null),h.bindTexture(o.TEXTURE_CUBE_MAP,null),x(h)&&h.bindTexture(o.TEXTURE_3D,null);const t=this._state.textureUnitMap[i];e(t)&&h.bindTexture(t.descriptor.target,t.glName)}h.activeTexture(l+this._state.activeTexture),h.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=x(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};return B.TEXTURE_UNIT_FOR_UPDATES=n.maxTextureImageUnits-1,n}}function A(t,e,s,i){return e?i!==e&&t.bindBuffer(s,e.glName):t.bindBuffer(s,null),e}function C(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{U 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};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
+ */
5
+ import t from"../../core/Logger.js";import{STD140_LAYOUT as e}from"./storageLayouts.js";function a(t,e){return t+(e-t%e)%e}const r=(()=>{const t=new ArrayBuffer(2),e=new Uint8Array(t),a=new Uint16Array(t);return e[0]=170,e[1]=187,48042===a[0]})(),n=4,i=t.getLogger("esri.views.webgl.UniformBufferLayout");class s{constructor(t){this._layout=new Map,this.byteLength=this._buildLayout(t),this.array=new ArrayBuffer(this.byteLength),this.arrayView32=new Float32Array(this.array),this._dataView=new DataView(this.array)}setValues(t,e){for(const a in t)this.setValue(a,t[a],e)}setValue(t,a,r){if(!this._layout.has(t))return void i.warn("Trying to set an unrecognized layout array member!");let s=this.byteLength/n,o=0;const{type:h,offset:y,arrayLength:u}=this._layout.get(t),{numberType:l,elementLength:f,elementCount:g,arrayStride:m}=e[h],w="number"!=typeof a,c=u*g,_=c*f;if((w?"byteLength"in a?a.byteLength/n:a.length:1)!==_&&i.warn("Attempting to set layout array member value with the wrong length!"),w)for(let e=0;e<c;e++)for(let t=0;t<f;t++){const r=y+e*m+t*n,i=e*f+t;if(this._setData(r,a[i],l)){const t=r/n;s=Math.min(s,t),o=Math.max(o,t+1)}}else if(this._setData(y,a,l)){const t=y/n;s=Math.min(s,t),o=Math.max(o,t+1)}r&&(r.from=Math.min(s,r.from),r.to=Math.max(o,r.to))}_setData(t,e,a){switch(a){case"Int32":if(e!==this._dataView.getInt32(t,r))return this._dataView.setInt32(t,e,r),!0;break;case"Uint32":if(e!==this._dataView.getUint32(t,r))return this._dataView.setUint32(t,e,r),!0;break;case"Float32":if(e!==this._dataView.getFloat32(t,r))return this._dataView.setFloat32(t,e,r),!0}return!1}_buildLayout(t){let r=0;for(const{name:i,type:s,count:o}of t){const{elementLength:t,elementCount:h,elementAlignment:y,arrayStride:u,arrayAlignment:l}=e[s],f=null!=o?o:1,g=f*h,m=g>1,w=m?l:y,c=m?g*u:t*n;r=a(r,w),this._layout.set(i,{type:s,offset:r,arrayLength:f}),r+=c,m&&(r=a(r,w))}return a(r,4*n)}}export{s as UniformBufferLayout};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
+ */
5
+ import t from"../../core/Logger.js";import{disposeMaybe as i}from"../../core/maybe.js";import{BufferObject as e}from"./BufferObject.js";import{ContextType as r}from"./context-util.js";import{Usage as s}from"./enums.js";import{UniformBufferLayout as o}from"./UniformBufferLayout.js";const a=t.getLogger("esri.views.webgl.UniformBufferObject");class n{constructor(t,i,e=s.DYNAMIC_DRAW){this._context=t,this._usage=e,this._dirtyRange={from:1/0,to:-1},this._initialized=!1,this._context.type!==r.WEBGL2&&a.error("Attempting to create a uniform buffer without WebGL2!"),this._data=new o(i)}get byteLength(){return this._data.byteLength}initialize(){this._initialized||(this.buffer=e.createUniform(this._context,this._usage,this._data.array),this._resetDirtyRange(),this._initialized=!0)}dispose(){this._context.unbindUBO(this),this.buffer=i(this.buffer)}set(t){this._data.setValues(t,this._dirtyRange)}setUniform(t,i){this._data.setValue(t,i,this._dirtyRange)}upload(){this.initialize();const{from:t,to:i}=this._dirtyRange;i>-1&&t<i&&(this.buffer.setSubDataFromView(this._data.arrayView32,t,t,i),this._resetDirtyRange())}_resetDirtyRange(){this._dirtyRange.from=1/0,this._dirtyRange.to=-1}}export{n as UniformBufferObject};
@@ -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
- var E,_,T,R,A,C,N,S,O,P,L,I,M,D,U,H,B,G,F,n;!function(E){E[E.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",E[E.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",E[E.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT"}(E||(E={})),function(E){E[E.POINTS=0]="POINTS",E[E.LINES=1]="LINES",E[E.LINE_LOOP=2]="LINE_LOOP",E[E.LINE_STRIP=3]="LINE_STRIP",E[E.TRIANGLES=4]="TRIANGLES",E[E.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",E[E.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(_||(_={})),function(E){E[E.ZERO=0]="ZERO",E[E.ONE=1]="ONE",E[E.SRC_COLOR=768]="SRC_COLOR",E[E.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",E[E.SRC_ALPHA=770]="SRC_ALPHA",E[E.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",E[E.DST_ALPHA=772]="DST_ALPHA",E[E.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",E[E.DST_COLOR=774]="DST_COLOR",E[E.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",E[E.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",E[E.CONSTANT_COLOR=32769]="CONSTANT_COLOR",E[E.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",E[E.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",E[E.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA"}(T||(T={})),function(E){E[E.ADD=32774]="ADD",E[E.SUBTRACT=32778]="SUBTRACT",E[E.REVERSE_SUBTRACT=32779]="REVERSE_SUBTRACT"}(R||(R={})),function(E){E[E.ARRAY_BUFFER=34962]="ARRAY_BUFFER",E[E.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER"}(A||(A={})),function(E){E[E.FRONT=1028]="FRONT",E[E.BACK=1029]="BACK",E[E.FRONT_AND_BACK=1032]="FRONT_AND_BACK"}(C||(C={})),function(E){E[E.CW=2304]="CW",E[E.CCW=2305]="CCW"}(N||(N={})),function(E){E[E.BYTE=5120]="BYTE",E[E.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",E[E.SHORT=5122]="SHORT",E[E.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",E[E.INT=5124]="INT",E[E.UNSIGNED_INT=5125]="UNSIGNED_INT",E[E.FLOAT=5126]="FLOAT"}(S||(S={})),function(E){E[E.NEVER=512]="NEVER",E[E.LESS=513]="LESS",E[E.EQUAL=514]="EQUAL",E[E.LEQUAL=515]="LEQUAL",E[E.GREATER=516]="GREATER",E[E.NOTEQUAL=517]="NOTEQUAL",E[E.GEQUAL=518]="GEQUAL",E[E.ALWAYS=519]="ALWAYS"}(O||(O={})),function(E){E[E.ZERO=0]="ZERO",E[E.KEEP=7680]="KEEP",E[E.REPLACE=7681]="REPLACE",E[E.INCR=7682]="INCR",E[E.DECR=7683]="DECR",E[E.INVERT=5386]="INVERT",E[E.INCR_WRAP=34055]="INCR_WRAP",E[E.DECR_WRAP=34056]="DECR_WRAP"}(P||(P={})),function(E){E[E.NEAREST=9728]="NEAREST",E[E.LINEAR=9729]="LINEAR",E[E.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",E[E.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",E[E.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",E[E.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR"}(L||(L={})),function(E){E[E.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",E[E.REPEAT=10497]="REPEAT",E[E.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(I||(I={})),function(E){E[E.TEXTURE_2D=3553]="TEXTURE_2D",E[E.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",E[E.TEXTURE_3D=32879]="TEXTURE_3D",E[E.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",E[E.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",E[E.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",E[E.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",E[E.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",E[E.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"}(M||(M={})),function(E){E[E.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",E[E.ALPHA=6406]="ALPHA",E[E.RGB=6407]="RGB",E[E.RGBA=6408]="RGBA",E[E.LUMINANCE=6409]="LUMINANCE",E[E.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",E[E.RGBA4=32854]="RGBA4",E[E.DEPTH_STENCIL=34041]="DEPTH_STENCIL",E[E.R16F=33325]="R16F",E[E.RG16F=33327]="RG16F",E[E.RGB32F=34837]="RGB32F",E[E.RGBA16F=34842]="RGBA16F",E[E.R32F=33326]="R32F",E[E.RG32F=33328]="RG32F",E[E.RGBA32F=34836]="RGBA32F",E[E.R11F_G11F_B10F=35898]="R11F_G11F_B10F"}(D||(D={})),function(E){E[E.FLOAT=5126]="FLOAT",E[E.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",E[E.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",E[E.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",E[E.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",E[E.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5"}(U||(U={})),function(E){E[E.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",E[E.STENCIL_INDEX8=36168]="STENCIL_INDEX8",E[E.DEPTH_STENCIL=34041]="DEPTH_STENCIL",E[E.RGBA4=32854]="RGBA4"}(H||(H={})),function(E){E[E.STATIC_DRAW=35044]="STATIC_DRAW",E[E.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",E[E.STREAM_DRAW=35040]="STREAM_DRAW"}(B||(B={})),function(E){E[E.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",E[E.VERTEX_SHADER=35633]="VERTEX_SHADER"}(G||(G={})),function(E){E[E.TEXTURE=0]="TEXTURE",E[E.RENDER_BUFFER=1]="RENDER_BUFFER",E[E.CUBEMAP=2]="CUBEMAP"}(F||(F={})),function(E){E[E.NONE=0]="NONE",E[E.DEPTH_RENDER_BUFFER=1]="DEPTH_RENDER_BUFFER",E[E.STENCIL_RENDER_BUFFER=2]="STENCIL_RENDER_BUFFER",E[E.DEPTH_STENCIL_RENDER_BUFFER=3]="DEPTH_STENCIL_RENDER_BUFFER",E[E.DEPTH_STENCIL_TEXTURE=4]="DEPTH_STENCIL_TEXTURE"}(n||(n={}));const X=33984;var f,u;!function(E){E[E.Texture=0]="Texture",E[E.Buffer=1]="Buffer",E[E.VAO=2]="VAO",E[E.Shader=3]="Shader",E[E.Program=4]="Program",E[E.Framebuffer=5]="Framebuffer",E[E.Renderbuffer=6]="Renderbuffer",E[E.COUNT=7]="COUNT"}(f||(f={})),function(E){E[E.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",E[E.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",E[E.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",E[E.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",E[E.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",E[E.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",E[E.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",E[E.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",E[E.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",E[E.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",E[E.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",E[E.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",E[E.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",E[E.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",E[E.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",E[E.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15"}(u||(u={}));const o=33306;var t;!function(E){E[E.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",E[E.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",E[E.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",E[E.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",E[E.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",E[E.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",E[E.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",E[E.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",E[E.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",E[E.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",E[E.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",E[E.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",E[E.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",E[E.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC"}(t||(t={}));export{X as BASE_TEXTURE_UNIT,T as BlendFactor,R as BlendOperation,A as BufferType,E as ClearBufferBit,u as ColorAttachment,O as CompareFunction,t as CompressedTextureFormat,N as CullMode,S as DataType,o as DepthStencilAttachment,n as DepthStencilTargetType,C as Face,D as PixelFormat,U as PixelType,_ as PrimitiveType,H as RenderbufferFormat,f as ResourceType,G as ShaderType,P as StencilOperation,F as TargetType,L as TextureSamplingMode,M as TextureType,I as TextureWrapMode,B as Usage};
5
+ var E,_,T,A,R,N,C,S,O,I,L,D,M,P,U,F,B,G,H,n,Y;!function(E){E[E.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",E[E.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",E[E.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT"}(E||(E={})),function(E){E[E.POINTS=0]="POINTS",E[E.LINES=1]="LINES",E[E.LINE_LOOP=2]="LINE_LOOP",E[E.LINE_STRIP=3]="LINE_STRIP",E[E.TRIANGLES=4]="TRIANGLES",E[E.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",E[E.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(_||(_={})),function(E){E[E.ZERO=0]="ZERO",E[E.ONE=1]="ONE",E[E.SRC_COLOR=768]="SRC_COLOR",E[E.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",E[E.SRC_ALPHA=770]="SRC_ALPHA",E[E.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",E[E.DST_ALPHA=772]="DST_ALPHA",E[E.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",E[E.DST_COLOR=774]="DST_COLOR",E[E.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",E[E.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",E[E.CONSTANT_COLOR=32769]="CONSTANT_COLOR",E[E.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",E[E.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",E[E.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA"}(T||(T={})),function(E){E[E.ADD=32774]="ADD",E[E.SUBTRACT=32778]="SUBTRACT",E[E.REVERSE_SUBTRACT=32779]="REVERSE_SUBTRACT"}(A||(A={})),function(E){E[E.ARRAY_BUFFER=34962]="ARRAY_BUFFER",E[E.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",E[E.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",E[E.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",E[E.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",E[E.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",E[E.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER"}(R||(R={})),function(E){E[E.FRONT=1028]="FRONT",E[E.BACK=1029]="BACK",E[E.FRONT_AND_BACK=1032]="FRONT_AND_BACK"}(N||(N={})),function(E){E[E.CW=2304]="CW",E[E.CCW=2305]="CCW"}(C||(C={})),function(E){E[E.BYTE=5120]="BYTE",E[E.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",E[E.SHORT=5122]="SHORT",E[E.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",E[E.INT=5124]="INT",E[E.UNSIGNED_INT=5125]="UNSIGNED_INT",E[E.FLOAT=5126]="FLOAT"}(S||(S={})),function(E){E[E.NEVER=512]="NEVER",E[E.LESS=513]="LESS",E[E.EQUAL=514]="EQUAL",E[E.LEQUAL=515]="LEQUAL",E[E.GREATER=516]="GREATER",E[E.NOTEQUAL=517]="NOTEQUAL",E[E.GEQUAL=518]="GEQUAL",E[E.ALWAYS=519]="ALWAYS"}(O||(O={})),function(E){E[E.ZERO=0]="ZERO",E[E.KEEP=7680]="KEEP",E[E.REPLACE=7681]="REPLACE",E[E.INCR=7682]="INCR",E[E.DECR=7683]="DECR",E[E.INVERT=5386]="INVERT",E[E.INCR_WRAP=34055]="INCR_WRAP",E[E.DECR_WRAP=34056]="DECR_WRAP"}(I||(I={})),function(E){E[E.NEAREST=9728]="NEAREST",E[E.LINEAR=9729]="LINEAR",E[E.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",E[E.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",E[E.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",E[E.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR"}(L||(L={})),function(E){E[E.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",E[E.REPEAT=10497]="REPEAT",E[E.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(D||(D={})),function(E){E[E.TEXTURE_2D=3553]="TEXTURE_2D",E[E.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",E[E.TEXTURE_3D=32879]="TEXTURE_3D",E[E.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",E[E.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",E[E.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",E[E.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",E[E.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",E[E.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"}(M||(M={})),function(E){E[E.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",E[E.ALPHA=6406]="ALPHA",E[E.RGB=6407]="RGB",E[E.RGBA=6408]="RGBA",E[E.LUMINANCE=6409]="LUMINANCE",E[E.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",E[E.RGBA4=32854]="RGBA4",E[E.DEPTH_STENCIL=34041]="DEPTH_STENCIL",E[E.R16F=33325]="R16F",E[E.RG16F=33327]="RG16F",E[E.RGB32F=34837]="RGB32F",E[E.RGBA16F=34842]="RGBA16F",E[E.R32F=33326]="R32F",E[E.RG32F=33328]="RG32F",E[E.RGBA32F=34836]="RGBA32F",E[E.R11F_G11F_B10F=35898]="R11F_G11F_B10F"}(P||(P={})),function(E){E[E.FLOAT=5126]="FLOAT",E[E.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",E[E.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",E[E.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",E[E.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",E[E.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5"}(U||(U={})),function(E){E[E.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",E[E.STENCIL_INDEX8=36168]="STENCIL_INDEX8",E[E.DEPTH_STENCIL=34041]="DEPTH_STENCIL",E[E.RGBA4=32854]="RGBA4"}(F||(F={})),function(E){E[E.STATIC_DRAW=35044]="STATIC_DRAW",E[E.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",E[E.STREAM_DRAW=35040]="STREAM_DRAW",E[E.STATIC_READ=35045]="STATIC_READ",E[E.DYNAMIC_READ=35049]="DYNAMIC_READ",E[E.STREAM_READ=35041]="STREAM_READ",E[E.STATIC_COPY=35046]="STATIC_COPY",E[E.DYNAMIC_COPY=35050]="DYNAMIC_COPY",E[E.STREAM_COPY=35042]="STREAM_COPY"}(B||(B={})),function(E){E[E.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",E[E.VERTEX_SHADER=35633]="VERTEX_SHADER"}(G||(G={})),function(E){E[E.FRAMEBUFFER=36160]="FRAMEBUFFER",E[E.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",E[E.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER"}(H||(H={})),function(E){E[E.TEXTURE=0]="TEXTURE",E[E.RENDER_BUFFER=1]="RENDER_BUFFER",E[E.CUBEMAP=2]="CUBEMAP"}(n||(n={})),function(E){E[E.NONE=0]="NONE",E[E.DEPTH_RENDER_BUFFER=1]="DEPTH_RENDER_BUFFER",E[E.STENCIL_RENDER_BUFFER=2]="STENCIL_RENDER_BUFFER",E[E.DEPTH_STENCIL_RENDER_BUFFER=3]="DEPTH_STENCIL_RENDER_BUFFER",E[E.DEPTH_STENCIL_TEXTURE=4]="DEPTH_STENCIL_TEXTURE"}(Y||(Y={}));const X=33984;var V,f;!function(E){E[E.Texture=0]="Texture",E[E.Buffer=1]="Buffer",E[E.VAO=2]="VAO",E[E.Shader=3]="Shader",E[E.Program=4]="Program",E[E.Framebuffer=5]="Framebuffer",E[E.Renderbuffer=6]="Renderbuffer",E[E.COUNT=7]="COUNT"}(V||(V={})),function(E){E[E.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",E[E.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",E[E.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",E[E.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",E[E.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",E[E.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",E[E.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",E[E.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",E[E.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",E[E.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",E[E.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",E[E.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",E[E.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",E[E.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",E[E.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",E[E.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15"}(f||(f={}));const u=33306;var o,t,c,i,W,r,e;!function(E){E[E.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",E[E.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",E[E.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",E[E.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",E[E.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",E[E.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",E[E.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",E[E.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",E[E.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",E[E.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",E[E.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",E[E.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",E[E.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",E[E.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC"}(o||(o={})),function(E){E[E.FLOAT=5126]="FLOAT",E[E.FLOAT_VEC2=35664]="FLOAT_VEC2",E[E.FLOAT_VEC3=35665]="FLOAT_VEC3",E[E.FLOAT_VEC4=35666]="FLOAT_VEC4",E[E.INT=5124]="INT",E[E.INT_VEC2=35667]="INT_VEC2",E[E.INT_VEC3=35668]="INT_VEC3",E[E.INT_VEC4=35669]="INT_VEC4",E[E.BOOL=35670]="BOOL",E[E.BOOL_VEC2=35671]="BOOL_VEC2",E[E.BOOL_VEC3=35672]="BOOL_VEC3",E[E.BOOL_VEC4=35673]="BOOL_VEC4",E[E.FLOAT_MAT2=35674]="FLOAT_MAT2",E[E.FLOAT_MAT3=35675]="FLOAT_MAT3",E[E.FLOAT_MAT4=35676]="FLOAT_MAT4",E[E.SAMPLER_2D=35678]="SAMPLER_2D",E[E.SAMPLER_CUBE=35680]="SAMPLER_CUBE",E[E.UNSIGNED_INT=5125]="UNSIGNED_INT",E[E.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",E[E.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",E[E.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",E[E.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",E[E.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",E[E.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",E[E.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",E[E.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",E[E.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",E[E.SAMPLER_3D=35679]="SAMPLER_3D",E[E.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",E[E.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",E[E.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",E[E.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",E[E.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",E[E.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",E[E.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",E[E.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",E[E.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",E[E.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",E[E.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",E[E.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY"}(t||(t={})),function(E){E[E.OBJECT_TYPE=37138]="OBJECT_TYPE",E[E.SYNC_CONDITION=37139]="SYNC_CONDITION",E[E.SYNC_STATUS=37140]="SYNC_STATUS",E[E.SYNC_FLAGS=37141]="SYNC_FLAGS"}(c||(c={})),function(E){E[E.UNSIGNALED=37144]="UNSIGNALED",E[E.SIGNALED=37145]="SIGNALED"}(i||(i={})),function(E){E[E.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",E[E.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",E[E.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",E[E.WAIT_FAILED=37149]="WAIT_FAILED"}(W||(W={})),function(E){E[E.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE"}(r||(r={})),function(E){E[E.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT"}(e||(e={}));export{X as BASE_TEXTURE_UNIT,T as BlendFactor,A as BlendOperation,R as BufferType,E as ClearBufferBit,W as ClientWaitSyncStatus,f as ColorAttachment,O as CompareFunction,o as CompressedTextureFormat,C as CullMode,S as DataType,u as DepthStencilAttachment,Y as DepthStencilTargetType,N as Face,H as FramebufferTarget,P as PixelFormat,U as PixelType,_ as PrimitiveType,F as RenderbufferFormat,V as ResourceType,G as ShaderType,I as StencilOperation,r as SyncCondition,e as SyncFlag,c as SyncParameter,i as SyncStatus,n as TargetType,L as TextureSamplingMode,M as TextureType,D as TextureWrapMode,t as UniformType,B as Usage};
@@ -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{ContextType as e}from"./context-util.js";import{PixelType as t,TextureType as n,PixelFormat as a,TextureSamplingMode as i,TextureWrapMode as r,TargetType as o,DepthStencilTargetType as u}from"./enums.js";import{FramebufferObject as s}from"./FramebufferObject.js";import{Texture as _}from"./Texture.js";var f;function l(o,u,s="nearest",f=!1){var l;const T=!(f&&"u8"===u.pixelType),m=T?t.FLOAT:t.UNSIGNED_BYTE,E=null==u.pixels||0===u.pixels.length?null:T?u.getAsRGBAFloat():u.getAsRGBA(),c=null==(l=o.capabilities.textureFloat)?void 0:l.textureFloatLinear,A={width:u.width,height:u.height,target:n.TEXTURE_2D,pixelFormat:a.RGBA,internalFormat:o.type===e.WEBGL2&&T?a.RGBA32F:a.RGBA,samplingMode:!c||"bilinear"!==s&&"cubic"!==s?i.NEAREST:i.LINEAR,dataType:m,wrapMode:r.CLAMP_TO_EDGE,flipped:!1};return new _(o,A,E)}function T(e,f,l,T){const m=T?t.UNSIGNED_BYTE:t.FLOAT,E={width:f,height:l,target:n.TEXTURE_2D,pixelFormat:a.RGBA,internalFormat:a.RGBA,samplingMode:i.NEAREST,dataType:m,wrapMode:r.CLAMP_TO_EDGE,flipped:!1},c=new _(e,E);return new s(e,{colorTarget:o.TEXTURE,depthStencilTarget:u.DEPTH_STENCIL_RENDER_BUFFER,width:f,height:l},c)}function m(o,u){const s=4*u.size[0],f=u.size[1],l={width:s,height:f,target:n.TEXTURE_2D,pixelFormat:a.RGBA,internalFormat:o.type===e.WEBGL2?a.RGBA32F:a.RGBA,dataType:t.FLOAT,samplingMode:i.NEAREST,wrapMode:r.CLAMP_TO_EDGE,flipped:!1},T=new Float32Array(s*f*4);let m=0;for(let e=0;e<u.coefficients.length;e++)T[m++]=u.coefficients[e],e%3==2&&(T[m++]=1);return new _(o,l,T)}function E(e,o){const u={width:o.length/4,height:1,target:n.TEXTURE_2D,pixelFormat:a.RGBA,internalFormat:a.RGBA,dataType:t.UNSIGNED_BYTE,samplingMode:i.NEAREST,wrapMode:r.CLAMP_TO_EDGE,flipped:!1};return new _(e,u,o)}function c(e,t,n,a=1,i=!0,r=!1){return{u_flipY:i,u_isFloatTexture:r,u_applyTransform:!!e,u_opacity:a,u_transformSpacing:e?e.spacing:null,u_transformGridSize:e?e.size:null,u_targetImageSize:t,u_srcImageSize:n}}function A(e,t){return{u_colormapOffset:t||0,u_colormapMaxIndex:e?e.length/4-1:null}}function O(e,t){return{u_scale:e,u_offset:t}}function p(e){return{u_bandCount:e.bandCount,u_minOutput:e.outMin,u_maxOutput:e.outMax,u_minCutOff:e.minCutOff,u_maxCutOff:e.maxCutOff,u_factor:e.factor,u_useGamma:e.useGamma,u_gamma:e.gamma,u_gammaCorrection:e.gammaCorrection}}function L(e){return{u_hillshadeType:e.hillshadeType,u_sinZcosAs:e.sinZcosAs,u_sinZsinAs:e.sinZsinAs,u_cosZs:e.cosZs,u_weights:e.weights,u_factor:e.factor,u_minValue:e.minValue,u_maxValue:e.maxValue}}function g(e,t){const n=e.gl,a=t.glName,i=n.getProgramParameter(a,n.ACTIVE_UNIFORMS),r=new Map;let o;for(let u=0;u<i;u++)o=n.getActiveUniform(a,u),o&&r.set(o.name,{location:n.getUniformLocation(a,o.name),info:o});return r}function C(e,t,n){Object.keys(n).forEach((a=>{const i=t.get(a)||t.get(a+"[0]");i&&h(e,a,n[a],i)}))}function F(e,t,n,a){n.length===a.length&&(a.some((e=>null==e))||n.some((e=>null==e))||n.forEach(((n,i)=>{t.setUniform1i(n,i),e.bindTexture(a[i],i)})))}function h(e,t,n,a){if(null===a||null==n)return!1;const{info:i}=a;switch(i.type){case f.FLOAT:i.size>1?e.setUniform1fv(t,n):e.setUniform1f(t,n);break;case f.FLOAT_VEC2:e.setUniform2fv(t,n);break;case f.FLOAT_VEC3:e.setUniform3fv(t,n);break;case f.FLOAT_VEC4:e.setUniform4fv(t,n);break;case f.FLOAT_MAT3:e.setUniformMatrix3fv(t,n);break;case f.FLOAT_MAT4:e.setUniformMatrix4fv(t,n);break;case f.INT:i.size>1?e.setUniform1iv(t,n):e.setUniform1i(t,n);break;case f.BOOL:e.setUniform1i(t,n?1:0);break;case f.INT_VEC2:case f.BOOL_VEC2:e.setUniform2iv(t,n);break;case f.INT_VEC3:case f.BOOL_VEC3:e.setUniform3iv(t,n);break;case f.INT_VEC4:case f.BOOL_VEC4:e.setUniform4iv(t,n);break;default:return!1}return!0}!function(e){e[e.FLOAT=5126]="FLOAT",e[e.FLOAT_VEC2=35664]="FLOAT_VEC2",e[e.FLOAT_VEC3=35665]="FLOAT_VEC3",e[e.FLOAT_VEC4=35666]="FLOAT_VEC4",e[e.FLOAT_MAT3=35675]="FLOAT_MAT3",e[e.FLOAT_MAT4=35676]="FLOAT_MAT4",e[e.INT=5124]="INT",e[e.BOOL=35670]="BOOL",e[e.INT_VEC2=35667]="INT_VEC2",e[e.BOOL_VEC2=35671]="BOOL_VEC2",e[e.INT_VEC3=35668]="INT_VEC3",e[e.BOOL_VEC3=35672]="BOOL_VEC3",e[e.INT_VEC4=35669]="INT_VEC4",e[e.BOOL_VEC4=35673]="BOOL_VEC4",e[e.SAMPLER_2D=35678]="SAMPLER_2D"}(f||(f={}));export{E as createColormapTexture,T as createFrameBuffer,l as createRasterTexture,m as createTransformTexture,O as getBasicGridUniforms,A as getColormapUniforms,c as getCommonUniforms,L as getShadedReliefUniforms,p as getStretchUniforms,g as getUniformLocationInfos,F as setTextures,C as setUniforms};
5
+ import{ContextType as e}from"./context-util.js";import{PixelType as t,TextureType as n,PixelFormat as a,TextureSamplingMode as i,TextureWrapMode as r,TargetType as o,DepthStencilTargetType as u,UniformType as s}from"./enums.js";import{FramebufferObject as f}from"./FramebufferObject.js";import{Texture as l}from"./Texture.js";function m(o,u,s="nearest",f=!1){var m;const c=!(f&&"u8"===u.pixelType),_=c?t.FLOAT:t.UNSIGNED_BYTE,E=null==u.pixels||0===u.pixels.length?null:c?u.getAsRGBAFloat():u.getAsRGBA(),T=null==(m=o.capabilities.textureFloat)?void 0:m.textureFloatLinear,p={width:u.width,height:u.height,target:n.TEXTURE_2D,pixelFormat:a.RGBA,internalFormat:o.type===e.WEBGL2&&c?a.RGBA32F:a.RGBA,samplingMode:!T||"bilinear"!==s&&"cubic"!==s?i.NEAREST:i.LINEAR,dataType:_,wrapMode:r.CLAMP_TO_EDGE,flipped:!1};return new l(o,p,E)}function c(e,s,m,c){const _=c?t.UNSIGNED_BYTE:t.FLOAT,E={width:s,height:m,target:n.TEXTURE_2D,pixelFormat:a.RGBA,internalFormat:a.RGBA,samplingMode:i.NEAREST,dataType:_,wrapMode:r.CLAMP_TO_EDGE,flipped:!1},T=new l(e,E);return new f(e,{colorTarget:o.TEXTURE,depthStencilTarget:u.DEPTH_STENCIL_RENDER_BUFFER,width:s,height:m},T)}function _(o,u){const s=4*u.size[0],f=u.size[1],m={width:s,height:f,target:n.TEXTURE_2D,pixelFormat:a.RGBA,internalFormat:o.type===e.WEBGL2?a.RGBA32F:a.RGBA,dataType:t.FLOAT,samplingMode:i.NEAREST,wrapMode:r.CLAMP_TO_EDGE,flipped:!1},c=new Float32Array(s*f*4);let _=0;for(let e=0;e<u.coefficients.length;e++)c[_++]=u.coefficients[e],e%3==2&&(c[_++]=1);return new l(o,m,c)}function E(e,o){const u={width:o.length/4,height:1,target:n.TEXTURE_2D,pixelFormat:a.RGBA,internalFormat:a.RGBA,dataType:t.UNSIGNED_BYTE,samplingMode:i.NEAREST,wrapMode:r.CLAMP_TO_EDGE,flipped:!1};return new l(e,u,o)}function T(e,t,n,a=1,i=!0,r=!1){return{u_flipY:i,u_isFloatTexture:r,u_applyTransform:!!e,u_opacity:a,u_transformSpacing:e?e.spacing:null,u_transformGridSize:e?e.size:null,u_targetImageSize:t,u_srcImageSize:n}}function p(e,t){return{u_colormapOffset:t||0,u_colormapMaxIndex:e?e.length/4-1:null}}function g(e,t){return{u_scale:e,u_offset:t}}function A(e){return{u_bandCount:e.bandCount,u_minOutput:e.outMin,u_maxOutput:e.outMax,u_minCutOff:e.minCutOff,u_maxCutOff:e.maxCutOff,u_factor:e.factor,u_useGamma:e.useGamma,u_gamma:e.gamma,u_gammaCorrection:e.gammaCorrection}}function h(e){return{u_hillshadeType:e.hillshadeType,u_sinZcosAs:e.sinZcosAs,u_sinZsinAs:e.sinZsinAs,u_cosZs:e.cosZs,u_weights:e.weights,u_factor:e.factor,u_minValue:e.minValue,u_maxValue:e.maxValue}}function d(e,t){const n=e.gl,a=t.glName,i=n.getProgramParameter(a,n.ACTIVE_UNIFORMS),r=new Map;let o;for(let u=0;u<i;u++)o=n.getActiveUniform(a,u),o&&r.set(o.name,{location:n.getUniformLocation(a,o.name),info:o});return r}function O(e,t,n){Object.keys(n).forEach((a=>{const i=t.get(a)||t.get(a+"[0]");i&&R(e,a,n[a],i)}))}function F(e,t,n,a){n.length===a.length&&(a.some((e=>null==e))||n.some((e=>null==e))||n.forEach(((n,i)=>{t.setUniform1i(n,i),e.bindTexture(a[i],i)})))}function R(e,t,n,a){if(null===a||null==n)return!1;const{info:i}=a;switch(i.type){case s.FLOAT:i.size>1?e.setUniform1fv(t,n):e.setUniform1f(t,n);break;case s.FLOAT_VEC2:e.setUniform2fv(t,n);break;case s.FLOAT_VEC3:e.setUniform3fv(t,n);break;case s.FLOAT_VEC4:e.setUniform4fv(t,n);break;case s.FLOAT_MAT3:e.setUniformMatrix3fv(t,n);break;case s.FLOAT_MAT4:e.setUniformMatrix4fv(t,n);break;case s.INT:i.size>1?e.setUniform1iv(t,n):e.setUniform1i(t,n);break;case s.BOOL:e.setUniform1i(t,n?1:0);break;case s.INT_VEC2:case s.BOOL_VEC2:e.setUniform2iv(t,n);break;case s.INT_VEC3:case s.BOOL_VEC3:e.setUniform3iv(t,n);break;case s.INT_VEC4:case s.BOOL_VEC4:e.setUniform4iv(t,n);break;default:return!1}return!0}export{E as createColormapTexture,c as createFrameBuffer,m as createRasterTexture,_ as createTransformTexture,g as getBasicGridUniforms,p as getColormapUniforms,T as getCommonUniforms,h as getShadedReliefUniforms,A as getStretchUniforms,d as getUniformLocationInfos,F as setTextures,O as setUniforms};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
+ */
5
+ import{UniformType as e}from"./enums.js";const n={[e.FLOAT]:{elementLength:1,elementCount:1,elementAlignment:4,arrayStride:16,arrayAlignment:16,numberType:"Float32"},[e.INT]:{elementLength:1,elementCount:1,elementAlignment:4,arrayStride:16,arrayAlignment:16,numberType:"Int32"},[e.BOOL]:{elementLength:1,elementCount:1,elementAlignment:4,arrayStride:16,arrayAlignment:16,numberType:"Uint32"},[e.UNSIGNED_INT]:{elementLength:1,elementCount:1,elementAlignment:4,arrayStride:16,arrayAlignment:16,numberType:"Uint32"},[e.BOOL_VEC2]:{elementLength:2,elementCount:1,elementAlignment:8,arrayStride:16,arrayAlignment:16,numberType:"Uint32"},[e.FLOAT_VEC2]:{elementLength:2,elementCount:1,elementAlignment:8,arrayStride:16,arrayAlignment:16,numberType:"Float32"},[e.INT_VEC2]:{elementLength:2,elementCount:1,elementAlignment:8,arrayStride:16,arrayAlignment:16,numberType:"Int32"},[e.UNSIGNED_INT_VEC2]:{elementLength:2,elementCount:1,elementAlignment:8,arrayStride:16,arrayAlignment:16,numberType:"Uint32"},[e.BOOL_VEC3]:{elementLength:3,elementCount:1,elementAlignment:16,arrayStride:16,arrayAlignment:16,numberType:"Uint32"},[e.FLOAT_VEC3]:{elementLength:3,elementCount:1,elementAlignment:16,arrayStride:16,arrayAlignment:16,numberType:"Float32"},[e.INT_VEC3]:{elementLength:3,elementCount:1,elementAlignment:16,arrayStride:16,arrayAlignment:16,numberType:"Int32"},[e.UNSIGNED_INT_VEC3]:{elementLength:3,elementCount:1,elementAlignment:16,arrayStride:16,arrayAlignment:16,numberType:"Uint32"},[e.BOOL_VEC4]:{elementLength:4,elementCount:1,elementAlignment:16,arrayStride:16,arrayAlignment:16,numberType:"Uint32"},[e.FLOAT_VEC4]:{elementLength:4,elementCount:1,elementAlignment:16,arrayStride:16,arrayAlignment:16,numberType:"Float32"},[e.INT_VEC4]:{elementLength:4,elementCount:1,elementAlignment:16,arrayStride:16,arrayAlignment:16,numberType:"Int32"},[e.UNSIGNED_INT_VEC4]:{elementLength:4,elementCount:1,elementAlignment:16,arrayStride:16,arrayAlignment:16,numberType:"Uint32"},[e.FLOAT_MAT2]:{elementLength:2,elementCount:2,elementAlignment:16,arrayStride:16,arrayAlignment:16,numberType:"Float32"},[e.FLOAT_MAT2x3]:{elementLength:3,elementCount:2,elementAlignment:16,arrayStride:16,arrayAlignment:16,numberType:"Float32"},[e.FLOAT_MAT2x4]:{elementLength:4,elementCount:2,elementAlignment:16,arrayStride:16,arrayAlignment:16,numberType:"Float32"},[e.FLOAT_MAT3]:{elementLength:3,elementCount:3,elementAlignment:16,arrayStride:16,arrayAlignment:16,numberType:"Float32"},[e.FLOAT_MAT3x2]:{elementLength:2,elementCount:3,elementAlignment:16,arrayStride:16,arrayAlignment:16,numberType:"Float32"},[e.FLOAT_MAT3x4]:{elementLength:4,elementCount:3,elementAlignment:16,arrayStride:16,arrayAlignment:16,numberType:"Float32"},[e.FLOAT_MAT4]:{elementLength:4,elementCount:4,elementAlignment:16,arrayStride:16,arrayAlignment:16,numberType:"Float32"},[e.FLOAT_MAT4x2]:{elementLength:2,elementCount:4,elementAlignment:16,arrayStride:16,arrayAlignment:16,numberType:"Float32"},[e.FLOAT_MAT4x3]:{elementLength:3,elementCount:4,elementAlignment:16,arrayStride:16,arrayAlignment:16,numberType:"Float32"}},t={[e.FLOAT]:{elementLength:1,elementCount:1,elementAlignment:4,arrayStride:4,arrayAlignment:4,numberType:"Float32"},[e.INT]:{elementLength:1,elementCount:1,elementAlignment:4,arrayStride:4,arrayAlignment:4,numberType:"Int32"},[e.BOOL]:{elementLength:1,elementCount:1,elementAlignment:4,arrayStride:4,arrayAlignment:4,numberType:"Uint32"},[e.UNSIGNED_INT]:{elementLength:1,elementCount:1,elementAlignment:4,arrayStride:4,arrayAlignment:4,numberType:"Uint32"},[e.BOOL_VEC2]:{elementLength:2,elementCount:1,elementAlignment:8,arrayStride:8,arrayAlignment:8,numberType:"Uint32"},[e.FLOAT_VEC2]:{elementLength:2,elementCount:1,elementAlignment:8,arrayStride:8,arrayAlignment:8,numberType:"Float32"},[e.INT_VEC2]:{elementLength:2,elementCount:1,elementAlignment:8,arrayStride:8,arrayAlignment:8,numberType:"Int32"},[e.UNSIGNED_INT_VEC2]:{elementLength:2,elementCount:1,elementAlignment:8,arrayStride:8,arrayAlignment:8,numberType:"Uint32"},[e.BOOL_VEC3]:{elementLength:3,elementCount:1,elementAlignment:16,arrayStride:12,arrayAlignment:12,numberType:"Uint32"},[e.FLOAT_VEC3]:{elementLength:3,elementCount:1,elementAlignment:16,arrayStride:12,arrayAlignment:12,numberType:"Float32"},[e.INT_VEC3]:{elementLength:3,elementCount:1,elementAlignment:16,arrayStride:12,arrayAlignment:12,numberType:"Int32"},[e.UNSIGNED_INT_VEC3]:{elementLength:3,elementCount:1,elementAlignment:16,arrayStride:12,arrayAlignment:12,numberType:"Uint32"},[e.BOOL_VEC4]:{elementLength:4,elementCount:1,elementAlignment:16,arrayStride:16,arrayAlignment:16,numberType:"Uint32"},[e.FLOAT_VEC4]:{elementLength:4,elementCount:1,elementAlignment:16,arrayStride:16,arrayAlignment:16,numberType:"Float32"},[e.INT_VEC4]:{elementLength:4,elementCount:1,elementAlignment:16,arrayStride:16,arrayAlignment:16,numberType:"Int32"},[e.UNSIGNED_INT_VEC4]:{elementLength:4,elementCount:1,elementAlignment:16,arrayStride:16,arrayAlignment:16,numberType:"Uint32"},[e.FLOAT_MAT2]:{elementLength:2,elementCount:2,elementAlignment:8,arrayStride:8,arrayAlignment:8,numberType:"Float32"},[e.FLOAT_MAT2x3]:{elementLength:3,elementCount:2,elementAlignment:12,arrayStride:12,arrayAlignment:12,numberType:"Float32"},[e.FLOAT_MAT2x4]:{elementLength:4,elementCount:2,elementAlignment:16,arrayStride:16,arrayAlignment:16,numberType:"Float32"},[e.FLOAT_MAT3]:{elementLength:3,elementCount:3,elementAlignment:12,arrayStride:12,arrayAlignment:12,numberType:"Float32"},[e.FLOAT_MAT3x2]:{elementLength:2,elementCount:3,elementAlignment:8,arrayStride:8,arrayAlignment:8,numberType:"Float32"},[e.FLOAT_MAT3x4]:{elementLength:4,elementCount:3,elementAlignment:16,arrayStride:16,arrayAlignment:16,numberType:"Float32"},[e.FLOAT_MAT4]:{elementLength:4,elementCount:4,elementAlignment:16,arrayStride:16,arrayAlignment:16,numberType:"Float32"},[e.FLOAT_MAT4x2]:{elementLength:2,elementCount:4,elementAlignment:8,arrayStride:8,arrayAlignment:8,numberType:"Float32"},[e.FLOAT_MAT4x3]:{elementLength:3,elementCount:4,elementAlignment:12,arrayStride:12,arrayAlignment:12,numberType:"Float32"}};export{n as STD140_LAYOUT,t as STD430_LAYOUT};
@@ -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{unpackFloatRGBA as n}from"../../core/floatRGBA.js";import{f as e}from"../../chunks/vec3f64.js";import{BufferObject as o}from"./BufferObject.js";import{encodeDoubleArray as t}from"./doublePrecisionUtils.js";import{TargetType as r,DepthStencilTargetType as i,TextureType as a,TextureWrapMode as c,PixelFormat as s,PixelType as l,TextureSamplingMode as v,Usage as p,DataType as f,PrimitiveType as u}from"./enums.js";import{FramebufferObject as m}from"./FramebufferObject.js";import{VertexArrayObject as h}from"./VertexArrayObject.js";import{VertexElementDescriptor as d}from"./VertexElementDescriptor.js";function A(A,_){const g=new m(A,{colorTarget:r.TEXTURE,depthStencilTarget:i.NONE},{target:a.TEXTURE_2D,wrapMode:c.CLAMP_TO_EDGE,pixelFormat:s.RGBA,dataType:l.UNSIGNED_BYTE,samplingMode:v.NEAREST,width:1,height:1});function B(n,e){const o=`\n\n precision highp float;\n\n attribute vec2 position;\n\n uniform vec3 u_highA;\n uniform vec3 u_lowA;\n uniform vec3 u_highB;\n uniform vec3 u_lowB;\n\n varying vec4 v_color;\n\n ${_?"#define DOUBLE_PRECISION_REQUIRES_OBFUSCATION":""}\n\n #ifdef DOUBLE_PRECISION_REQUIRES_OBFUSCATION\n\n vec3 dpPlusFrc(vec3 a, vec3 b) {\n return mix(a, a + b, vec3(notEqual(b, vec3(0))));\n }\n\n vec3 dpMinusFrc(vec3 a, vec3 b) {\n return mix(vec3(0), a - b, vec3(notEqual(a, b)));\n }\n\n vec3 dpAdd(vec3 hiA, vec3 loA, vec3 hiB, vec3 loB) {\n vec3 t1 = dpPlusFrc(hiA, hiB);\n vec3 e = dpMinusFrc(t1, hiA);\n vec3 t2 = dpMinusFrc(hiB, e) + dpMinusFrc(hiA, dpMinusFrc(t1, e)) + loA + loB;\n return t1 + t2;\n }\n\n #else\n\n vec3 dpAdd(vec3 hiA, vec3 loA, vec3 hiB, vec3 loB) {\n vec3 t1 = hiA + hiB;\n vec3 e = t1 - hiA;\n vec3 t2 = ((hiB - e) + (hiA - (t1 - e))) + loA + loB;\n return t1 + t2;\n }\n\n #endif\n\n const float MAX_RGBA_FLOAT =\n 255.0 / 256.0 +\n 255.0 / 256.0 / 256.0 +\n 255.0 / 256.0 / 256.0 / 256.0 +\n 255.0 / 256.0 / 256.0 / 256.0 / 256.0;\n\n const vec4 FIXED_POINT_FACTORS = vec4(1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0);\n\n vec4 float2rgba(const float value) {\n // Make sure value is in the domain we can represent\n float valueInValidDomain = clamp(value, 0.0, MAX_RGBA_FLOAT);\n\n // Decompose value in 32bit fixed point parts represented as\n // uint8 rgba components. Decomposition uses the fractional part after multiplying\n // by a power of 256 (this removes the bits that are represented in the previous\n // component) and then converts the fractional part to 8bits.\n vec4 fixedPointU8 = floor(fract(valueInValidDomain * FIXED_POINT_FACTORS) * 256.0);\n\n // Convert uint8 values (from 0 to 255) to floating point representation for\n // the shader\n const float toU8AsFloat = 1.0 / 255.0;\n\n return fixedPointU8 * toU8AsFloat;\n }\n\n void main() {\n vec3 val = dpAdd(u_highA, u_lowA, -u_highB, -u_lowB);\n\n v_color = float2rgba(val.z / 25.0);\n\n gl_Position = vec4(position * 2.0 - 1.0, 0.0, 1.0);\n }\n `,r="\n precision highp float;\n\n varying vec4 v_color;\n\n void main() {\n gl_FragColor = v_color;\n }\n ",i=A.newProgram(o,r,new Map([["position",0]])),a=new Float32Array(6);t(n,a,3);const c=new Float32Array(6);return t(e,c,3),A.useProgram(i),i.setUniform3f("u_highA",a[0],a[2],a[4]),i.setUniform3f("u_lowA",a[1],a[3],a[5]),i.setUniform3f("u_highB",c[0],c[2],c[4]),i.setUniform3f("u_lowB",c[1],c[3],c[5]),i}const E=o.createVertex(A,p.STATIC_DRAW,new Uint16Array([0,0,1,0,0,1,1,1])),b=new h(A,new Map([["position",0]]),{geometry:[new d("position",2,f.UNSIGNED_SHORT,0,4)]},{geometry:E}),w=e(5633261.287538229,2626832.878767164,1434988.0495278358),F=e(5633271.46742708,2626873.6381334523,1434963.231608387),T=B(w,F),O=A.getBoundFramebufferObject(),{x:U,y:I,width:R,height:N}=A.getViewport();A.bindFramebuffer(g),A.setViewport(0,0,1,1),A.bindVAO(b),A.drawArrays(u.TRIANGLE_STRIP,0,4);const S=new Uint8Array(4);g.readPixels(0,0,1,1,s.RGBA,l.UNSIGNED_BYTE,S),T.dispose(),b.dispose(!1),E.dispose(),g.dispose(),A.setViewport(U,I,R,N),A.bindFramebuffer(O);const D=(w[2]-F[2])/25,P=n(S);return Math.abs(D-P)}export{A as testDoublePrecisionArithmetic};
5
+ import{unpackFloatRGBA as n}from"../../core/floatRGBA.js";import{f as e}from"../../chunks/vec3f64.js";import{BufferObject as o}from"./BufferObject.js";import{encodeDoubleArray as t}from"./doublePrecisionUtils.js";import{TargetType as r,DepthStencilTargetType as i,TextureType as a,TextureWrapMode as c,PixelFormat as s,PixelType as l,TextureSamplingMode as p,Usage as v,DataType as f,PrimitiveType as u}from"./enums.js";import{FramebufferObject as m}from"./FramebufferObject.js";import{VertexArrayObject as h}from"./VertexArrayObject.js";import{VertexElementDescriptor as d}from"./VertexElementDescriptor.js";function A(A,_){const g=new m(A,{colorTarget:r.TEXTURE,depthStencilTarget:i.NONE},{target:a.TEXTURE_2D,wrapMode:c.CLAMP_TO_EDGE,pixelFormat:s.RGBA,dataType:l.UNSIGNED_BYTE,samplingMode:p.NEAREST,width:1,height:1});function B(n,e){const o=`\n\n precision highp float;\n\n attribute vec2 position;\n\n uniform vec3 u_highA;\n uniform vec3 u_lowA;\n uniform vec3 u_highB;\n uniform vec3 u_lowB;\n\n varying vec4 v_color;\n\n ${_?"#define DOUBLE_PRECISION_REQUIRES_OBFUSCATION":""}\n\n #ifdef DOUBLE_PRECISION_REQUIRES_OBFUSCATION\n\n vec3 dpPlusFrc(vec3 a, vec3 b) {\n return mix(a, a + b, vec3(notEqual(b, vec3(0))));\n }\n\n vec3 dpMinusFrc(vec3 a, vec3 b) {\n return mix(vec3(0), a - b, vec3(notEqual(a, b)));\n }\n\n vec3 dpAdd(vec3 hiA, vec3 loA, vec3 hiB, vec3 loB) {\n vec3 t1 = dpPlusFrc(hiA, hiB);\n vec3 e = dpMinusFrc(t1, hiA);\n vec3 t2 = dpMinusFrc(hiB, e) + dpMinusFrc(hiA, dpMinusFrc(t1, e)) + loA + loB;\n return t1 + t2;\n }\n\n #else\n\n vec3 dpAdd(vec3 hiA, vec3 loA, vec3 hiB, vec3 loB) {\n vec3 t1 = hiA + hiB;\n vec3 e = t1 - hiA;\n vec3 t2 = ((hiB - e) + (hiA - (t1 - e))) + loA + loB;\n return t1 + t2;\n }\n\n #endif\n\n const float MAX_RGBA_FLOAT =\n 255.0 / 256.0 +\n 255.0 / 256.0 / 256.0 +\n 255.0 / 256.0 / 256.0 / 256.0 +\n 255.0 / 256.0 / 256.0 / 256.0 / 256.0;\n\n const vec4 FIXED_POINT_FACTORS = vec4(1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0);\n\n vec4 float2rgba(const float value) {\n // Make sure value is in the domain we can represent\n float valueInValidDomain = clamp(value, 0.0, MAX_RGBA_FLOAT);\n\n // Decompose value in 32bit fixed point parts represented as\n // uint8 rgba components. Decomposition uses the fractional part after multiplying\n // by a power of 256 (this removes the bits that are represented in the previous\n // component) and then converts the fractional part to 8bits.\n vec4 fixedPointU8 = floor(fract(valueInValidDomain * FIXED_POINT_FACTORS) * 256.0);\n\n // Convert uint8 values (from 0 to 255) to floating point representation for\n // the shader\n const float toU8AsFloat = 1.0 / 255.0;\n\n return fixedPointU8 * toU8AsFloat;\n }\n\n void main() {\n vec3 val = dpAdd(u_highA, u_lowA, -u_highB, -u_lowB);\n\n v_color = float2rgba(val.z / 25.0);\n\n gl_Position = vec4(position * 2.0 - 1.0, 0.0, 1.0);\n }\n `,r="\n precision highp float;\n\n varying vec4 v_color;\n\n void main() {\n gl_FragColor = v_color;\n }\n ",i=A.programCache.acquire(o,r,new Map([["position",0]])),a=new Float32Array(6);t(n,a,3);const c=new Float32Array(6);return t(e,c,3),A.useProgram(i),i.setUniform3f("u_highA",a[0],a[2],a[4]),i.setUniform3f("u_lowA",a[1],a[3],a[5]),i.setUniform3f("u_highB",c[0],c[2],c[4]),i.setUniform3f("u_lowB",c[1],c[3],c[5]),i}const E=o.createVertex(A,v.STATIC_DRAW,new Uint16Array([0,0,1,0,0,1,1,1])),b=new h(A,new Map([["position",0]]),{geometry:[new d("position",2,f.UNSIGNED_SHORT,0,4)]},{geometry:E}),F=e(5633261.287538229,2626832.878767164,1434988.0495278358),w=e(5633271.46742708,2626873.6381334523,1434963.231608387),T=B(F,w),O=A.getBoundFramebufferObject(),{x:U,y:I,width:R,height:N}=A.getViewport();A.bindFramebuffer(g),A.setViewport(0,0,1,1),A.bindVAO(b),A.drawArrays(u.TRIANGLE_STRIP,0,4);const S=new Uint8Array(4);g.readPixels(0,0,1,1,s.RGBA,l.UNSIGNED_BYTE,S),T.dispose(),b.dispose(!1),E.dispose(),g.dispose(),A.setViewport(U,I,R,N),A.bindFramebuffer(O);const D=(F[2]-w[2])/25,y=n(S);return Math.abs(D-y)}export{A as testDoublePrecisionArithmetic};
@@ -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{blendingAlpha as e}from"../3d/webgl-engine/lib/OrderIndependentTransparency.js";import{BufferObject as t}from"./BufferObject.js";import{ContextType as r}from"./context-util.js";import{TargetType as n,DepthStencilTargetType as o,TextureType as i,TextureWrapMode as a,PixelFormat as u,PixelType as f,TextureSamplingMode as l,Usage as c,DataType as s,PrimitiveType as d}from"./enums.js";import{FramebufferObject as g}from"./FramebufferObject.js";import{makePipelineState as b}from"./renderState.js";import{VertexArrayObject as E}from"./VertexArrayObject.js";import{VertexElementDescriptor as p}from"./VertexElementDescriptor.js";var m,T,_,v={exports:{}};function F(m){var T,_,F,x,A;if(!m.gl)return!1;if(m.type===r.WEBGL1)return(null==(x=m.capabilities.textureFloat)?void 0:x.textureFloat)&&(null==(A=m.capabilities.colorBufferFloat)?void 0:A.textureFloat);if(!((null==(T=m.capabilities.textureFloat)?void 0:T.textureFloat)&&(null==(_=m.capabilities.colorBufferFloat)?void 0:_.textureFloat)&&(null==(F=m.capabilities.colorBufferFloat)?void 0:F.floatBlend)))return!1;const R=new g(m,{colorTarget:n.TEXTURE,depthStencilTarget:o.NONE},{target:i.TEXTURE_2D,wrapMode:a.CLAMP_TO_EDGE,pixelFormat:u.RGBA,dataType:f.FLOAT,internalFormat:u.RGBA32F,samplingMode:l.NEAREST,width:1,height:1}),S=t.createVertex(m,c.STATIC_DRAW,new Uint16Array([0,0,1,0,0,1,1,1])),h=new E(m,new Map([["a_pos",0]]),{geometry:[new p("a_pos",2,s.UNSIGNED_SHORT,0,4)]},{geometry:S}),P="\n precision highp float;\n attribute vec2 a_pos;\n\n void main() {\n gl_Position = vec4(a_pos * 2.0 - 1.0, 0.0, 1.0);\n }\n ",L="\n precision highp float;\n\n void main() {\n gl_FragColor = vec4(0.5, 0.5, 0.5, 0.5);\n }\n ",B=m.newProgram(P,L,new Map([["a_pos",0]]));m.useProgram(B);const w=m.getBoundFramebufferObject(),{x:C,y:O,width:N,height:I}=m.getViewport();m.bindFramebuffer(R),m.setViewport(0,0,1,1),m.bindVAO(h),m.drawArrays(d.TRIANGLE_STRIP,0,4);const U=b({blending:e});m.setPipelineState(U),m.drawArrays(d.TRIANGLE_STRIP,0,4),v.exports.init(m);const y=m.gl.getError();return m.setViewport(C,O,N,I),m.bindFramebuffer(w),B.dispose(),h.dispose(!1),S.dispose(),R.dispose(),1282!==y||(console.warn("Device claims support for WebGL extension EXT_float_blend but does not support it. Using fall back."),!1)}m=v,T=function(){var e=function(e){window.console&&window.console.log&&window.console.log(e)},t=function(t){window.console&&window.console.error?window.console.error(t):e(t)},r={enable:{1:{0:!0}},disable:{1:{0:!0}},getParameter:{1:{0:!0}},drawArrays:{3:{0:!0}},drawElements:{4:{0:!0,2:!0}},createShader:{1:{0:!0}},getShaderParameter:{2:{1:!0}},getProgramParameter:{2:{1:!0}},getShaderPrecisionFormat:{2:{0:!0,1:!0}},getVertexAttrib:{2:{1:!0}},vertexAttribPointer:{6:{2:!0}},bindTexture:{2:{0:!0}},activeTexture:{1:{0:!0}},getTexParameter:{2:{0:!0,1:!0}},texParameterf:{3:{0:!0,1:!0}},texParameteri:{3:{0:!0,1:!0,2:!0}},texImage2D:{9:{0:!0,2:!0,6:!0,7:!0},6:{0:!0,2:!0,3:!0,4:!0}},texSubImage2D:{9:{0:!0,6:!0,7:!0},7:{0:!0,4:!0,5:!0}},copyTexImage2D:{8:{0:!0,2:!0}},copyTexSubImage2D:{8:{0:!0}},generateMipmap:{1:{0:!0}},compressedTexImage2D:{7:{0:!0,2:!0}},compressedTexSubImage2D:{8:{0:!0,6:!0}},bindBuffer:{2:{0:!0}},bufferData:{3:{0:!0,2:!0}},bufferSubData:{3:{0:!0}},getBufferParameter:{2:{0:!0,1:!0}},pixelStorei:{2:{0:!0,1:!0}},readPixels:{7:{4:!0,5:!0}},bindRenderbuffer:{2:{0:!0}},bindFramebuffer:{2:{0:!0}},checkFramebufferStatus:{1:{0:!0}},framebufferRenderbuffer:{4:{0:!0,1:!0,2:!0}},framebufferTexture2D:{5:{0:!0,1:!0,2:!0}},getFramebufferAttachmentParameter:{3:{0:!0,1:!0,2:!0}},getRenderbufferParameter:{2:{0:!0,1:!0}},renderbufferStorage:{4:{0:!0,1:!0}},clear:{1:{0:{enumBitwiseOr:["COLOR_BUFFER_BIT","DEPTH_BUFFER_BIT","STENCIL_BUFFER_BIT"]}}},depthFunc:{1:{0:!0}},blendFunc:{2:{0:!0,1:!0}},blendFuncSeparate:{4:{0:!0,1:!0,2:!0,3:!0}},blendEquation:{1:{0:!0}},blendEquationSeparate:{2:{0:!0,1:!0}},stencilFunc:{3:{0:!0}},stencilFuncSeparate:{4:{0:!0,1:!0}},stencilMaskSeparate:{2:{0:!0}},stencilOp:{3:{0:!0,1:!0,2:!0}},stencilOpSeparate:{4:{0:!0,1:!0,2:!0,3:!0}},cullFace:{1:{0:!0}},frontFace:{1:{0:!0}},drawArraysInstancedANGLE:{4:{0:!0}},drawElementsInstancedANGLE:{5:{0:!0,2:!0}},blendEquationEXT:{1:{0:!0}}},n=null,o=null;function i(e){if(null==n)for(var t in n={},o={},e)"number"==typeof e[t]&&(n[e[t]]=t,o[t]=e[t])}function a(){if(null==n)throw"WebGLDebugUtils.init(ctx) not called"}function u(e){return a(),void 0!==n[e]}function f(e){a();var t=n[e];return void 0!==t?"gl."+t:"/*UNKNOWN WebGL ENUM*/ 0x"+e.toString(16)}function l(e,t,n,i){var a;if(void 0!==(a=r[e])&&void 0!==(a=a[t])&&a[n]){if("object"==typeof a[n]&&void 0!==a[n].enumBitwiseOr){for(var u=a[n].enumBitwiseOr,l=0,c=[],s=0;s<u.length;++s){var d=o[u[s]];0!=(i&d)&&(l|=d,c.push(f(d)))}return l===i?c.join(" | "):f(i)}return f(i)}return null===i?"null":void 0===i?"undefined":i.toString()}function c(e,t){for(var r="",n=t.length,o=0;o<n;++o)r+=(0==o?"":", ")+l(e,n,o,t[o]);return r}function s(e,t,r){e.__defineGetter__(r,(function(){return t[r]})),e.__defineSetter__(r,(function(e){t[r]=e}))}function d(e,r,n,o){o=o||e,i(e),r=r||function(e,r,n){for(var o="",i=n.length,a=0;a<i;++a)o+=(0==a?"":", ")+l(r,i,a,n[a]);t("WebGL error "+f(e)+" in "+r+"("+o+")")};var a={};function u(e,t){return function(){n&&n(t,arguments);var i=e[t].apply(e,arguments),u=o.getError();return 0!=u&&(a[u]=!0,r(u,t,arguments)),i}}var c={};for(var g in e)if("function"==typeof e[g])if("getExtension"!=g)c[g]=u(e,g);else{var b=u(e,g);c[g]=function(){return d(b.apply(e,arguments),r,n,o)}}else s(c,e,g);return c.getError=function(){for(var t in a)if(a.hasOwnProperty(t)&&a[t])return a[t]=!1,t;return e.NO_ERROR},c}function g(e){var t=e.getParameter(e.MAX_VERTEX_ATTRIBS),r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r);for(var n=0;n<t;++n)e.disableVertexAttribArray(n),e.vertexAttribPointer(n,4,e.FLOAT,!1,0,0),e.vertexAttrib1f(n,0);e.deleteBuffer(r);var o=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);for(n=0;n<o;++n)e.activeTexture(e.TEXTURE0+n),e.bindTexture(e.TEXTURE_CUBE_MAP,null),e.bindTexture(e.TEXTURE_2D,null);for(e.activeTexture(e.TEXTURE0),e.useProgram(null),e.bindBuffer(e.ARRAY_BUFFER,null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindRenderbuffer(e.RENDERBUFFER,null),e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.DITHER),e.disable(e.SCISSOR_TEST),e.blendColor(0,0,0,0),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.clearColor(0,0,0,0),e.clearDepth(1),e.clearStencil(-1),e.colorMask(!0,!0,!0,!0),e.cullFace(e.BACK),e.depthFunc(e.LESS),e.depthMask(!0),e.depthRange(0,1),e.frontFace(e.CCW),e.hint(e.GENERATE_MIPMAP_HINT,e.DONT_CARE),e.lineWidth(1),e.pixelStorei(e.PACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.UNPACK_COLORSPACE_CONVERSION_WEBGL&&e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.BROWSER_DEFAULT_WEBGL),e.polygonOffset(0,0),e.sampleCoverage(1,!1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilMask(4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.viewport(0,0,e.canvas.width,e.canvas.height),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT);e.getError(););}function b(e){var t,r,n=[],o=[],i={},a=1,u=!1,f=[],l=0,c=0,d=!1,b=0,E={};function p(e){return"function"==typeof e?e:function(t){e.handleEvent(t)}}e.getContext=(r=e.getContext,function(){var n=r.apply(e,arguments);if(n instanceof WebGLRenderingContext){if(n!=t){if(t)throw"got different context";i=S(t=n)}return i}return n});var m=function(e){n.push(p(e))},T=function(e){o.push(p(e))};function _(e){var t=e.addEventListener;e.addEventListener=function(r,n,o){switch(r){case"webglcontextlost":m(n);break;case"webglcontextrestored":T(n);break;default:t.apply(e,arguments)}}}function v(){for(var e=Object.keys(E),t=0;t<e.length;++t)delete E[e]}function F(){++c,u||l==c&&e.loseContext()}function x(e,t){var r=e[t];return function(){if(F(),!u)return r.apply(e,arguments)}}function A(){for(var e=0;e<f.length;++e){var r=f[e];r instanceof WebGLBuffer?t.deleteBuffer(r):r instanceof WebGLFramebuffer?t.deleteFramebuffer(r):r instanceof WebGLProgram?t.deleteProgram(r):r instanceof WebGLRenderbuffer?t.deleteRenderbuffer(r):r instanceof WebGLShader?t.deleteShader(r):r instanceof WebGLTexture&&t.deleteTexture(r)}}function R(e){return{statusMessage:e,preventDefault:function(){d=!0}}}return _(e),e.loseContext=function(){if(!u){for(u=!0,l=0,++a;t.getError(););v(),E[t.CONTEXT_LOST_WEBGL]=!0;var r=R("context lost"),o=n.slice();setTimeout((function(){for(var t=0;t<o.length;++t)o[t](r);b>=0&&setTimeout((function(){e.restoreContext()}),b)}),0)}},e.restoreContext=function(){u&&o.length&&setTimeout((function(){if(!d)throw"can not restore. webglcontestlost listener did not call event.preventDefault";A(),g(t),u=!1,c=0,d=!1;for(var e=o.slice(),r=R("context restored"),n=0;n<e.length;++n)e[n](r)}),0)},e.loseContextInNCalls=function(e){if(u)throw"You can not ask a lost contet to be lost";l=c+e},e.getNumCalls=function(){return c},e.setRestoreTimeout=function(e){b=e},e;function S(e){for(var r in e)"function"==typeof e[r]?i[r]=x(e,r):s(i,e,r);i.getError=function(){if(F(),!u)for(;e=t.getError();)E[e]=!0;for(var e in E)if(E[e])return delete E[e],e;return i.NO_ERROR};for(var n=["createBuffer","createFramebuffer","createProgram","createRenderbuffer","createShader","createTexture"],o=0;o<n.length;++o){var l=n[o];i[l]=function(t){return function(){if(F(),u)return null;var r=t.apply(e,arguments);return r.__webglDebugContextLostId__=a,f.push(r),r}}(e[l])}var c=["getActiveAttrib","getActiveUniform","getBufferParameter","getContextAttributes","getAttachedShaders","getFramebufferAttachmentParameter","getParameter","getProgramParameter","getProgramInfoLog","getRenderbufferParameter","getShaderParameter","getShaderInfoLog","getShaderSource","getTexParameter","getUniform","getUniformLocation","getVertexAttrib"];for(o=0;o<c.length;++o)l=c[o],i[l]=function(t){return function(){return F(),u?null:t.apply(e,arguments)}}(i[l]);var d=["isBuffer","isEnabled","isFramebuffer","isProgram","isRenderbuffer","isShader","isTexture"];for(o=0;o<d.length;++o)l=d[o],i[l]=function(t){return function(){return F(),!u&&t.apply(e,arguments)}}(i[l]);return i.checkFramebufferStatus=function(t){return function(){return F(),u?i.FRAMEBUFFER_UNSUPPORTED:t.apply(e,arguments)}}(i.checkFramebufferStatus),i.getAttribLocation=function(t){return function(){return F(),u?-1:t.apply(e,arguments)}}(i.getAttribLocation),i.getVertexAttribOffset=function(t){return function(){return F(),u?0:t.apply(e,arguments)}}(i.getVertexAttribOffset),i.isContextLost=function(){return u},i}}return{init:i,mightBeEnum:u,glEnumToString:f,glFunctionArgToString:l,glFunctionArgsToString:c,makeDebugContext:d,makeLostContextSimulatingCanvas:b,resetToInitialState:g}},void 0!==(_=T())&&(m.exports=_);export{F as testFloatBufferBlend};
5
+ import{blendingAlpha as e}from"../3d/webgl-engine/lib/OrderIndependentTransparency.js";import{BufferObject as t}from"./BufferObject.js";import{ContextType as r}from"./context-util.js";import{TargetType as n,DepthStencilTargetType as o,TextureType as i,TextureWrapMode as a,PixelFormat as u,PixelType as f,TextureSamplingMode as l,Usage as c,DataType as s,PrimitiveType as d}from"./enums.js";import{FramebufferObject as g}from"./FramebufferObject.js";import{makePipelineState as b}from"./renderState.js";import{VertexArrayObject as E}from"./VertexArrayObject.js";import{VertexElementDescriptor as p}from"./VertexElementDescriptor.js";var m,T,_,v={exports:{}};function F(m){var T,_,F,x,A;if(!m.gl)return!1;if(m.type===r.WEBGL1)return(null==(x=m.capabilities.textureFloat)?void 0:x.textureFloat)&&(null==(A=m.capabilities.colorBufferFloat)?void 0:A.textureFloat);if(!((null==(T=m.capabilities.textureFloat)?void 0:T.textureFloat)&&(null==(_=m.capabilities.colorBufferFloat)?void 0:_.textureFloat)&&(null==(F=m.capabilities.colorBufferFloat)?void 0:F.floatBlend)))return!1;const R=new g(m,{colorTarget:n.TEXTURE,depthStencilTarget:o.NONE},{target:i.TEXTURE_2D,wrapMode:a.CLAMP_TO_EDGE,pixelFormat:u.RGBA,dataType:f.FLOAT,internalFormat:u.RGBA32F,samplingMode:l.NEAREST,width:1,height:1}),S=t.createVertex(m,c.STATIC_DRAW,new Uint16Array([0,0,1,0,0,1,1,1])),h=new E(m,new Map([["a_pos",0]]),{geometry:[new p("a_pos",2,s.UNSIGNED_SHORT,0,4)]},{geometry:S}),P="\n precision highp float;\n attribute vec2 a_pos;\n\n void main() {\n gl_Position = vec4(a_pos * 2.0 - 1.0, 0.0, 1.0);\n }\n ",L="\n precision highp float;\n\n void main() {\n gl_FragColor = vec4(0.5, 0.5, 0.5, 0.5);\n }\n ",B=m.programCache.acquire(P,L,new Map([["a_pos",0]]));m.useProgram(B);const C=m.getBoundFramebufferObject(),{x:w,y:O,width:N,height:I}=m.getViewport();m.bindFramebuffer(R),m.setViewport(0,0,1,1),m.bindVAO(h),m.drawArrays(d.TRIANGLE_STRIP,0,4);const U=b({blending:e});m.setPipelineState(U),m.drawArrays(d.TRIANGLE_STRIP,0,4),v.exports.init(m);const y=m.gl.getError();return m.setViewport(w,O,N,I),m.bindFramebuffer(C),B.dispose(),h.dispose(!1),S.dispose(),R.dispose(),1282!==y||(console.warn("Device claims support for WebGL extension EXT_float_blend but does not support it. Using fall back."),!1)}m=v,T=function(){var e=function(e){window.console&&window.console.log&&window.console.log(e)},t=function(t){window.console&&window.console.error?window.console.error(t):e(t)},r={enable:{1:{0:!0}},disable:{1:{0:!0}},getParameter:{1:{0:!0}},drawArrays:{3:{0:!0}},drawElements:{4:{0:!0,2:!0}},createShader:{1:{0:!0}},getShaderParameter:{2:{1:!0}},getProgramParameter:{2:{1:!0}},getShaderPrecisionFormat:{2:{0:!0,1:!0}},getVertexAttrib:{2:{1:!0}},vertexAttribPointer:{6:{2:!0}},bindTexture:{2:{0:!0}},activeTexture:{1:{0:!0}},getTexParameter:{2:{0:!0,1:!0}},texParameterf:{3:{0:!0,1:!0}},texParameteri:{3:{0:!0,1:!0,2:!0}},texImage2D:{9:{0:!0,2:!0,6:!0,7:!0},6:{0:!0,2:!0,3:!0,4:!0}},texSubImage2D:{9:{0:!0,6:!0,7:!0},7:{0:!0,4:!0,5:!0}},copyTexImage2D:{8:{0:!0,2:!0}},copyTexSubImage2D:{8:{0:!0}},generateMipmap:{1:{0:!0}},compressedTexImage2D:{7:{0:!0,2:!0}},compressedTexSubImage2D:{8:{0:!0,6:!0}},bindBuffer:{2:{0:!0}},bufferData:{3:{0:!0,2:!0}},bufferSubData:{3:{0:!0}},getBufferParameter:{2:{0:!0,1:!0}},pixelStorei:{2:{0:!0,1:!0}},readPixels:{7:{4:!0,5:!0}},bindRenderbuffer:{2:{0:!0}},bindFramebuffer:{2:{0:!0}},checkFramebufferStatus:{1:{0:!0}},framebufferRenderbuffer:{4:{0:!0,1:!0,2:!0}},framebufferTexture2D:{5:{0:!0,1:!0,2:!0}},getFramebufferAttachmentParameter:{3:{0:!0,1:!0,2:!0}},getRenderbufferParameter:{2:{0:!0,1:!0}},renderbufferStorage:{4:{0:!0,1:!0}},clear:{1:{0:{enumBitwiseOr:["COLOR_BUFFER_BIT","DEPTH_BUFFER_BIT","STENCIL_BUFFER_BIT"]}}},depthFunc:{1:{0:!0}},blendFunc:{2:{0:!0,1:!0}},blendFuncSeparate:{4:{0:!0,1:!0,2:!0,3:!0}},blendEquation:{1:{0:!0}},blendEquationSeparate:{2:{0:!0,1:!0}},stencilFunc:{3:{0:!0}},stencilFuncSeparate:{4:{0:!0,1:!0}},stencilMaskSeparate:{2:{0:!0}},stencilOp:{3:{0:!0,1:!0,2:!0}},stencilOpSeparate:{4:{0:!0,1:!0,2:!0,3:!0}},cullFace:{1:{0:!0}},frontFace:{1:{0:!0}},drawArraysInstancedANGLE:{4:{0:!0}},drawElementsInstancedANGLE:{5:{0:!0,2:!0}},blendEquationEXT:{1:{0:!0}}},n=null,o=null;function i(e){if(null==n)for(var t in n={},o={},e)"number"==typeof e[t]&&(n[e[t]]=t,o[t]=e[t])}function a(){if(null==n)throw"WebGLDebugUtils.init(ctx) not called"}function u(e){return a(),void 0!==n[e]}function f(e){a();var t=n[e];return void 0!==t?"gl."+t:"/*UNKNOWN WebGL ENUM*/ 0x"+e.toString(16)}function l(e,t,n,i){var a;if(void 0!==(a=r[e])&&void 0!==(a=a[t])&&a[n]){if("object"==typeof a[n]&&void 0!==a[n].enumBitwiseOr){for(var u=a[n].enumBitwiseOr,l=0,c=[],s=0;s<u.length;++s){var d=o[u[s]];0!=(i&d)&&(l|=d,c.push(f(d)))}return l===i?c.join(" | "):f(i)}return f(i)}return null===i?"null":void 0===i?"undefined":i.toString()}function c(e,t){for(var r="",n=t.length,o=0;o<n;++o)r+=(0==o?"":", ")+l(e,n,o,t[o]);return r}function s(e,t,r){e.__defineGetter__(r,(function(){return t[r]})),e.__defineSetter__(r,(function(e){t[r]=e}))}function d(e,r,n,o){o=o||e,i(e),r=r||function(e,r,n){for(var o="",i=n.length,a=0;a<i;++a)o+=(0==a?"":", ")+l(r,i,a,n[a]);t("WebGL error "+f(e)+" in "+r+"("+o+")")};var a={};function u(e,t){return function(){n&&n(t,arguments);var i=e[t].apply(e,arguments),u=o.getError();return 0!=u&&(a[u]=!0,r(u,t,arguments)),i}}var c={};for(var g in e)if("function"==typeof e[g])if("getExtension"!=g)c[g]=u(e,g);else{var b=u(e,g);c[g]=function(){return d(b.apply(e,arguments),r,n,o)}}else s(c,e,g);return c.getError=function(){for(var t in a)if(a.hasOwnProperty(t)&&a[t])return a[t]=!1,t;return e.NO_ERROR},c}function g(e){var t=e.getParameter(e.MAX_VERTEX_ATTRIBS),r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r);for(var n=0;n<t;++n)e.disableVertexAttribArray(n),e.vertexAttribPointer(n,4,e.FLOAT,!1,0,0),e.vertexAttrib1f(n,0);e.deleteBuffer(r);var o=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);for(n=0;n<o;++n)e.activeTexture(e.TEXTURE0+n),e.bindTexture(e.TEXTURE_CUBE_MAP,null),e.bindTexture(e.TEXTURE_2D,null);for(e.activeTexture(e.TEXTURE0),e.useProgram(null),e.bindBuffer(e.ARRAY_BUFFER,null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindRenderbuffer(e.RENDERBUFFER,null),e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.DITHER),e.disable(e.SCISSOR_TEST),e.blendColor(0,0,0,0),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.clearColor(0,0,0,0),e.clearDepth(1),e.clearStencil(-1),e.colorMask(!0,!0,!0,!0),e.cullFace(e.BACK),e.depthFunc(e.LESS),e.depthMask(!0),e.depthRange(0,1),e.frontFace(e.CCW),e.hint(e.GENERATE_MIPMAP_HINT,e.DONT_CARE),e.lineWidth(1),e.pixelStorei(e.PACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.UNPACK_COLORSPACE_CONVERSION_WEBGL&&e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.BROWSER_DEFAULT_WEBGL),e.polygonOffset(0,0),e.sampleCoverage(1,!1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilMask(4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.viewport(0,0,e.canvas.width,e.canvas.height),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT);e.getError(););}function b(e){var t,r,n=[],o=[],i={},a=1,u=!1,f=[],l=0,c=0,d=!1,b=0,E={};function p(e){return"function"==typeof e?e:function(t){e.handleEvent(t)}}e.getContext=(r=e.getContext,function(){var n=r.apply(e,arguments);if(n instanceof WebGLRenderingContext){if(n!=t){if(t)throw"got different context";i=S(t=n)}return i}return n});var m=function(e){n.push(p(e))},T=function(e){o.push(p(e))};function _(e){var t=e.addEventListener;e.addEventListener=function(r,n,o){switch(r){case"webglcontextlost":m(n);break;case"webglcontextrestored":T(n);break;default:t.apply(e,arguments)}}}function v(){for(var e=Object.keys(E),t=0;t<e.length;++t)delete E[e]}function F(){++c,u||l==c&&e.loseContext()}function x(e,t){var r=e[t];return function(){if(F(),!u)return r.apply(e,arguments)}}function A(){for(var e=0;e<f.length;++e){var r=f[e];r instanceof WebGLBuffer?t.deleteBuffer(r):r instanceof WebGLFramebuffer?t.deleteFramebuffer(r):r instanceof WebGLProgram?t.deleteProgram(r):r instanceof WebGLRenderbuffer?t.deleteRenderbuffer(r):r instanceof WebGLShader?t.deleteShader(r):r instanceof WebGLTexture&&t.deleteTexture(r)}}function R(e){return{statusMessage:e,preventDefault:function(){d=!0}}}return _(e),e.loseContext=function(){if(!u){for(u=!0,l=0,++a;t.getError(););v(),E[t.CONTEXT_LOST_WEBGL]=!0;var r=R("context lost"),o=n.slice();setTimeout((function(){for(var t=0;t<o.length;++t)o[t](r);b>=0&&setTimeout((function(){e.restoreContext()}),b)}),0)}},e.restoreContext=function(){u&&o.length&&setTimeout((function(){if(!d)throw"can not restore. webglcontestlost listener did not call event.preventDefault";A(),g(t),u=!1,c=0,d=!1;for(var e=o.slice(),r=R("context restored"),n=0;n<e.length;++n)e[n](r)}),0)},e.loseContextInNCalls=function(e){if(u)throw"You can not ask a lost contet to be lost";l=c+e},e.getNumCalls=function(){return c},e.setRestoreTimeout=function(e){b=e},e;function S(e){for(var r in e)"function"==typeof e[r]?i[r]=x(e,r):s(i,e,r);i.getError=function(){if(F(),!u)for(;e=t.getError();)E[e]=!0;for(var e in E)if(E[e])return delete E[e],e;return i.NO_ERROR};for(var n=["createBuffer","createFramebuffer","createProgram","createRenderbuffer","createShader","createTexture"],o=0;o<n.length;++o){var l=n[o];i[l]=function(t){return function(){if(F(),u)return null;var r=t.apply(e,arguments);return r.__webglDebugContextLostId__=a,f.push(r),r}}(e[l])}var c=["getActiveAttrib","getActiveUniform","getBufferParameter","getContextAttributes","getAttachedShaders","getFramebufferAttachmentParameter","getParameter","getProgramParameter","getProgramInfoLog","getRenderbufferParameter","getShaderParameter","getShaderInfoLog","getShaderSource","getTexParameter","getUniform","getUniformLocation","getVertexAttrib"];for(o=0;o<c.length;++o)l=c[o],i[l]=function(t){return function(){return F(),u?null:t.apply(e,arguments)}}(i[l]);var d=["isBuffer","isEnabled","isFramebuffer","isProgram","isRenderbuffer","isShader","isTexture"];for(o=0;o<d.length;++o)l=d[o],i[l]=function(t){return function(){return F(),!u&&t.apply(e,arguments)}}(i[l]);return i.checkFramebufferStatus=function(t){return function(){return F(),u?i.FRAMEBUFFER_UNSUPPORTED:t.apply(e,arguments)}}(i.checkFramebufferStatus),i.getAttribLocation=function(t){return function(){return F(),u?-1:t.apply(e,arguments)}}(i.getAttribLocation),i.getVertexAttribOffset=function(t){return function(){return F(),u?0:t.apply(e,arguments)}}(i.getVertexAttribOffset),i.isContextLost=function(){return u},i}}return{init:i,mightBeEnum:u,glEnumToString:f,glFunctionArgToString:l,glFunctionArgsToString:c,makeDebugContext:d,makeLostContextSimulatingCanvas:b,resetToInitialState:g}},void 0!==(_=T())&&(m.exports=_);export{F as testFloatBufferBlend};
@@ -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{Pos2us as e}from"../2d/engine/webgl/DefaultVertexAttributeLayouts.js";import{BufferObject as t}from"./BufferObject.js";import{TargetType as r,DepthStencilTargetType as i,TextureType as n,TextureWrapMode as o,PixelFormat as a,PixelType as s,TextureSamplingMode as p,Usage as g,ClearBufferBit as m,PrimitiveType as d}from"./enums.js";import{FramebufferObject as l}from"./FramebufferObject.js";import{Texture as u}from"./Texture.js";import{VertexArrayObject as c}from"./VertexArrayObject.js";async function f(f){const w=new Image;if(w.src="data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg width='5' height='5' version='1.1' viewBox='0 0 5 5' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='5' height='5' fill='%23f00' fill-opacity='.5'/%3E%3C/svg%3E%0A",w.width=5,w.height=5,await w.decode(),!f.gl)return!0;const _=new l(f,{colorTarget:r.TEXTURE,depthStencilTarget:i.NONE},{target:n.TEXTURE_2D,wrapMode:o.CLAMP_TO_EDGE,pixelFormat:a.RGBA,dataType:s.UNSIGNED_BYTE,samplingMode:p.NEAREST,width:1,height:1}),E=t.createVertex(f,g.STATIC_DRAW,new Uint16Array([0,0,1,0,0,1,1,1])),v=new c(f,new Map([["a_pos",0]]),e,{geometry:E}),h="\n precision highp float;\n\n attribute vec2 a_pos;\n varying vec2 v_uv;\n\n void main() {\n v_uv = a_pos;\n gl_Position = vec4(a_pos * 2.0 - 1.0, 0.0, 1.0);\n }\n ",T="\n precision highp float;\n\n varying vec2 v_uv;\n uniform sampler2D u_texture;\n\n void main() {\n gl_FragColor = texture2D(u_texture, v_uv);\n }\n ",x=f.newProgram(h,T,new Map([["a_pos",0]]));f.useProgram(x);const A=new u(f,{dataType:s.UNSIGNED_BYTE,pixelFormat:a.RGBA,preMultiplyAlpha:!1,wrapMode:o.CLAMP_TO_EDGE,samplingMode:p.LINEAR},w);f.bindTexture(A,0),x.setUniform1i("u_texture",0);const b=f.getBoundFramebufferObject(),{x:y,y:B,width:F,height:R}=f.getViewport();f.bindFramebuffer(_),f.setViewport(0,0,1,1),f.setClearColor(0,0,0,0),f.setBlendingEnabled(!1),f.clearSafe(m.COLOR_BUFFER_BIT),f.bindVAO(v),f.drawArrays(d.TRIANGLE_STRIP,0,4);const C=new Uint8Array(4);return _.readPixels(0,0,1,1,a.RGBA,s.UNSIGNED_BYTE,C),x.dispose(),v.dispose(!1),E.dispose(),_.dispose(),A.dispose(),f.setViewport(y,B,F,R),f.bindFramebuffer(b),w.src="",255===C[0]}export{f as testSVGPremultipliedAlpha};
5
+ import{Pos2us as e}from"../2d/engine/webgl/DefaultVertexAttributeLayouts.js";import{BufferObject as r}from"./BufferObject.js";import{TargetType as t,DepthStencilTargetType as i,TextureType as n,TextureWrapMode as o,PixelFormat as a,PixelType as s,TextureSamplingMode as p,Usage as g,ClearBufferBit as m,PrimitiveType as d}from"./enums.js";import{FramebufferObject as l}from"./FramebufferObject.js";import{Texture as u}from"./Texture.js";import{VertexArrayObject as c}from"./VertexArrayObject.js";async function f(f){const w=new Image;if(w.src="data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg width='5' height='5' version='1.1' viewBox='0 0 5 5' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='5' height='5' fill='%23f00' fill-opacity='.5'/%3E%3C/svg%3E%0A",w.width=5,w.height=5,await w.decode(),!f.gl)return!0;const _=new l(f,{colorTarget:t.TEXTURE,depthStencilTarget:i.NONE},{target:n.TEXTURE_2D,wrapMode:o.CLAMP_TO_EDGE,pixelFormat:a.RGBA,dataType:s.UNSIGNED_BYTE,samplingMode:p.NEAREST,width:1,height:1}),E=r.createVertex(f,g.STATIC_DRAW,new Uint16Array([0,0,1,0,0,1,1,1])),h=new c(f,new Map([["a_pos",0]]),e,{geometry:E}),v="\n precision highp float;\n\n attribute vec2 a_pos;\n varying vec2 v_uv;\n\n void main() {\n v_uv = a_pos;\n gl_Position = vec4(a_pos * 2.0 - 1.0, 0.0, 1.0);\n }\n ",T="\n precision highp float;\n\n varying vec2 v_uv;\n uniform sampler2D u_texture;\n\n void main() {\n gl_FragColor = texture2D(u_texture, v_uv);\n }\n ",x=f.programCache.acquire(v,T,new Map([["a_pos",0]]));f.useProgram(x);const A=new u(f,{dataType:s.UNSIGNED_BYTE,pixelFormat:a.RGBA,preMultiplyAlpha:!1,wrapMode:o.CLAMP_TO_EDGE,samplingMode:p.LINEAR},w);f.bindTexture(A,0),x.setUniform1i("u_texture",0);const b=f.getBoundFramebufferObject(),{x:y,y:B,width:C,height:F}=f.getViewport();f.bindFramebuffer(_),f.setViewport(0,0,1,1),f.setClearColor(0,0,0,0),f.setBlendingEnabled(!1),f.clearSafe(m.COLOR_BUFFER_BIT),f.bindVAO(h),f.drawArrays(d.TRIANGLE_STRIP,0,4);const R=new Uint8Array(4);return _.readPixels(0,0,1,1,a.RGBA,s.UNSIGNED_BYTE,R),x.dispose(),h.dispose(!1),E.dispose(),_.dispose(),A.dispose(),f.setViewport(y,B,C,F),f.bindFramebuffer(b),w.src="",255===R[0]}export{f as testSVGPremultipliedAlpha};
@@ -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 e from"../../core/Logger.js";import{BufferObject as r}from"./BufferObject.js";import{TargetType as t,DepthStencilTargetType as o,TextureType as i,TextureWrapMode as n,PixelFormat as a,PixelType as s,TextureSamplingMode as p,Usage as m,DataType as d,PrimitiveType as c}from"./enums.js";import{FramebufferObject as g}from"./FramebufferObject.js";import{Texture as l}from"./Texture.js";import{VertexArrayObject as u}from"./VertexArrayObject.js";import{VertexElementDescriptor as f}from"./VertexElementDescriptor.js";const w=e.getLogger("esri.views.WebGLDriverTest");function T(e){const T=new g(e,{colorTarget:t.TEXTURE,depthStencilTarget:o.NONE},{target:i.TEXTURE_2D,wrapMode:n.CLAMP_TO_EDGE,pixelFormat:a.RGBA,dataType:s.UNSIGNED_BYTE,samplingMode:p.NEAREST,width:1,height:1}),_="\nprecision highp float;\nattribute vec2 a_pos;\nuniform highp sampler2D u_texture;\nvarying vec4 v_color;\n\nfloat getBit(in float bitset, in int bitIndex) {\n float offset = pow(2.0, float(bitIndex));\n return mod(floor(bitset / offset), 2.0);\n}\n\nvoid main() {\n vec4 value = texture2D(u_texture, vec2(0.0));\n float bit = getBit(value.x * 255.0, 1);\n\n v_color = bit * vec4(1.0);\n gl_Position = vec4(a_pos * 2.0 - 1.0, 0.0, 1.0);\n}\n",h="\nprecision highp float;\nvarying vec4 v_color;\n\nvoid main() {\n gl_FragColor = v_color;\n}\n",v=new Uint8Array(4),b=r.createVertex(e,m.STATIC_DRAW,new Uint16Array([0,0,1,0,0,1,1,1])),E=new u(e,new Map([["a_position",0]]),{geometry:[new f("a_position",2,d.SHORT,0,4)]},{geometry:b}),A=e.newProgram(_,h,new Map([["a_pos",0]]));e.useProgram(A);const x=new l(e,{target:i.TEXTURE_2D,wrapMode:n.CLAMP_TO_EDGE,pixelFormat:a.RGBA,dataType:s.UNSIGNED_BYTE,samplingMode:p.NEAREST,width:1,height:1},new Uint8Array([2,255,0,0]));A.setUniform1i("u_texture",0),e.bindTexture(x,0);const y=e.getBoundFramebufferObject();e.bindFramebuffer(T),e.useProgram(A);const{x:D,y:R,width:j,height:N}=e.getViewport();e.setViewport(0,0,1,1),e.bindVAO(E),e.drawArrays(c.TRIANGLE_STRIP,0,4),e.setViewport(D,R,j,N),T.readPixels(0,0,1,1,a.RGBA,s.UNSIGNED_BYTE,v),A.dispose(),E.dispose(!1),b.dispose(),T.dispose();const B=255!==v[0]||255!==v[1]||255!==v[2]||255!==v[3];return B&&w.warn(`A problem was detected with your graphics driver. Your driver does not appear to honor sampler precision specifiers, which may result in rendering issues due to numerical instability. We recommend ensuring that your drivers have been updated to the latest version. Applying lowp sampler workaround. [${v[0]}.${v[1]}.${v[2]}.${v[3]}]`),e.bindFramebuffer(y),B}export{T as testSamplerPrecision};
5
+ import e from"../../core/Logger.js";import{BufferObject as r}from"./BufferObject.js";import{TargetType as t,DepthStencilTargetType as o,TextureType as i,TextureWrapMode as n,PixelFormat as a,PixelType as s,TextureSamplingMode as p,Usage as m,DataType as c,PrimitiveType as d}from"./enums.js";import{FramebufferObject as u}from"./FramebufferObject.js";import{Texture as g}from"./Texture.js";import{VertexArrayObject as l}from"./VertexArrayObject.js";import{VertexElementDescriptor as f}from"./VertexElementDescriptor.js";const w=e.getLogger("esri.views.WebGLDriverTest");function h(e){const h=new u(e,{colorTarget:t.TEXTURE,depthStencilTarget:o.NONE},{target:i.TEXTURE_2D,wrapMode:n.CLAMP_TO_EDGE,pixelFormat:a.RGBA,dataType:s.UNSIGNED_BYTE,samplingMode:p.NEAREST,width:1,height:1}),T="\nprecision highp float;\nattribute vec2 a_pos;\nuniform highp sampler2D u_texture;\nvarying vec4 v_color;\n\nfloat getBit(in float bitset, in int bitIndex) {\n float offset = pow(2.0, float(bitIndex));\n return mod(floor(bitset / offset), 2.0);\n}\n\nvoid main() {\n vec4 value = texture2D(u_texture, vec2(0.0));\n float bit = getBit(value.x * 255.0, 1);\n\n v_color = bit * vec4(1.0);\n gl_Position = vec4(a_pos * 2.0 - 1.0, 0.0, 1.0);\n}\n",_="\nprecision highp float;\nvarying vec4 v_color;\n\nvoid main() {\n gl_FragColor = v_color;\n}\n",v=new Uint8Array(4),b=r.createVertex(e,m.STATIC_DRAW,new Uint16Array([0,0,1,0,0,1,1,1])),E=new l(e,new Map([["a_position",0]]),{geometry:[new f("a_position",2,c.SHORT,0,4)]},{geometry:b}),A=e.programCache.acquire(T,_,new Map([["a_pos",0]]));e.useProgram(A);const x=new g(e,{target:i.TEXTURE_2D,wrapMode:n.CLAMP_TO_EDGE,pixelFormat:a.RGBA,dataType:s.UNSIGNED_BYTE,samplingMode:p.NEAREST,width:1,height:1},new Uint8Array([2,255,0,0]));A.setUniform1i("u_texture",0),e.bindTexture(x,0);const y=e.getBoundFramebufferObject();e.bindFramebuffer(h),e.useProgram(A);const{x:D,y:R,width:j,height:N}=e.getViewport();e.setViewport(0,0,1,1),e.bindVAO(E),e.drawArrays(d.TRIANGLE_STRIP,0,4),e.setViewport(D,R,j,N),h.readPixels(0,0,1,1,a.RGBA,s.UNSIGNED_BYTE,v),A.dispose(),E.dispose(!1),b.dispose(),h.dispose();const B=255!==v[0]||255!==v[1]||255!==v[2]||255!==v[3];return B&&w.warn(`A problem was detected with your graphics driver. Your driver does not appear to honor sampler precision specifiers, which may result in rendering issues due to numerical instability. We recommend ensuring that your drivers have been updated to the latest version. Applying lowp sampler workaround. [${v[0]}.${v[1]}.${v[2]}.${v[3]}]`),e.bindFramebuffer(y),B}export{h as testSamplerPrecision};
@@ -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{BufferObject as t}from"../BufferObject.js";import{BlendFactor as e,PrimitiveType as i,DataType as s,Usage as r,TextureType as o,PixelFormat as a,PixelType as h}from"../enums.js";import{Program as n}from"../Program.js";import{RenderingContext as _}from"../RenderingContext.js";import{Texture as c}from"../Texture.js";import{VertexArrayObject as m}from"../VertexArrayObject.js";import{VertexElementDescriptor as g}from"../VertexElementDescriptor.js";class d{constructor(t,e,i,s,r){this._vertexAttributeLocations=new Map([["position",0],["uv0",1]]),this._context=void 0,this._glslProgram=void 0,this._vertexAttributes=void 0,this._vertexArrayObject=void 0,this._texture=void 0,this._geometryData=void 0,this._initialized=!1,t||console.error("WebGL rendering context is not initialized!"),this._context=new _(t,{}),this._posX=e,this._posY=i,this._dx=.05*Math.random()*s*(Math.random()<.5?-1:1),this._dy=.05*Math.random()*r*(Math.random()<.5?-1:1),this._canvasWidth=s,this._canvasHieght=r}draw(){if(!this._initialize())return;this._updatePos();const t=this._context;t.setBlendingEnabled(!0),t.setBlendFunction(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),t.setClearColor(1,1,1,1),t.clear(t.gl.COLOR_BUFFER_BIT),t.bindVAO(this._vertexArrayObject),t.useProgram(this._glslProgram),t.bindTexture(this._texture,0),t.drawArrays(i.TRIANGLE_STRIP,0,4)}_updatePos(){this._posX+=this._dx,this._posY+=this._dy,(this._posX<0||this._posX>this._canvasWidth)&&(this._dx=-this._dx),(this._posY<0||this._posY>this._canvasHieght)&&(this._dy=-this._dy);const t=this._vertexArrayObject.vertexBuffers.geometry;t&&(this._populateBuffer(256),t.setData(this._geometryData))}_initialize(){if(this._initialized)return!0;const e="\n precision highp float;\n\n // geometry attributes\n attribute vec2 pos;\n attribute vec2 tex;\n\n varying vec2 v_tex;\n\n void main(void)\n {\n gl_Position = vec4(pos, 0.0, 1.0);\n v_tex = tex;\n }",i="\n precision highp float;\n uniform sampler2D u_texture;\n\n varying vec2 v_tex;\n void main(void)\n {\n vec4 color = texture2D(u_texture, v_tex);\n gl_FragColor = color;\n }";this._glslProgram=new n(this._context,e,i,this._vertexAttributeLocations),this._vertexAttributes={geometry:[new g("pos",2,s.FLOAT,0,16),new g("tex",2,s.FLOAT,8,16)]};const _=document.createElement("canvas"),d=256;_.width=d,_.height=d;const l=_.getContext("2d");l.clearRect(0,0,0,0);const x=_.width/2,v=_.height/2,p=_.height/2-15;l.beginPath(),l.arc(x,v,p,0,2*Math.PI,!1),l.fillStyle="green",l.fill(),l.lineWidth=5,l.strokeStyle="#003300",l.stroke(),this._populateBuffer(256);const y=t.createVertex(this._context,r.DYNAMIC_DRAW,this._geometryData);return this._vertexArrayObject=new m(this._context,this._vertexAttributeLocations,this._vertexAttributes,{geometry:y}),this._texture=new c(this._context,{target:o.TEXTURE_2D,pixelFormat:a.RGBA,dataType:h.UNSIGNED_BYTE,flipped:!0},_),this._initialized=!0,!1}_populateBuffer(t){const e=2*(this._posX/this._canvasWidth-.5),i=2*((this._canvasHieght-this._posY)/this._canvasHieght-.5),s=1*t/this._canvasWidth,r=1*t/this._canvasHieght;this._geometryData||(this._geometryData=new Float32Array(16)),this._geometryData[0]=e+s,this._geometryData[1]=i+r,this._geometryData[2]=1,this._geometryData[3]=1,this._geometryData[4]=e+s,this._geometryData[5]=i-r,this._geometryData[6]=1,this._geometryData[7]=0,this._geometryData[8]=e-s,this._geometryData[9]=i+r,this._geometryData[10]=0,this._geometryData[11]=1,this._geometryData[12]=e-s,this._geometryData[13]=i-r,this._geometryData[14]=0,this._geometryData[15]=0}}export{d as default};
5
+ import{BufferObject as t}from"../BufferObject.js";import{BlendFactor as e,PrimitiveType as i,DataType as s,Usage as r,TextureType as a,PixelFormat as o,PixelType as h}from"../enums.js";import{RenderingContext as n}from"../RenderingContext.js";import{Texture as _}from"../Texture.js";import{VertexArrayObject as c}from"../VertexArrayObject.js";import{VertexElementDescriptor as g}from"../VertexElementDescriptor.js";class m{constructor(t,e,i,s,r){this._vertexAttributeLocations=new Map([["position",0],["uv0",1]]),this._context=void 0,this._glslProgram=void 0,this._vertexAttributes=void 0,this._vertexArrayObject=void 0,this._texture=void 0,this._geometryData=void 0,this._initialized=!1,t||console.error("WebGL rendering context is not initialized!"),this._context=new n(t,{}),this._posX=e,this._posY=i,this._dx=.05*Math.random()*s*(Math.random()<.5?-1:1),this._dy=.05*Math.random()*r*(Math.random()<.5?-1:1),this._canvasWidth=s,this._canvasHieght=r}draw(){if(!this._initialize())return;this._updatePos();const t=this._context;t.setBlendingEnabled(!0),t.setBlendFunction(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),t.setClearColor(1,1,1,1),t.clear(t.gl.COLOR_BUFFER_BIT),t.bindVAO(this._vertexArrayObject),t.useProgram(this._glslProgram),t.bindTexture(this._texture,0),t.drawArrays(i.TRIANGLE_STRIP,0,4)}_updatePos(){this._posX+=this._dx,this._posY+=this._dy,(this._posX<0||this._posX>this._canvasWidth)&&(this._dx=-this._dx),(this._posY<0||this._posY>this._canvasHieght)&&(this._dy=-this._dy);const t=this._vertexArrayObject.vertexBuffers.geometry;t&&(this._populateBuffer(256),t.setData(this._geometryData))}_initialize(){if(this._initialized)return!0;const e="\n precision highp float;\n\n // geometry attributes\n attribute vec2 pos;\n attribute vec2 tex;\n\n varying vec2 v_tex;\n\n void main(void)\n {\n gl_Position = vec4(pos, 0.0, 1.0);\n v_tex = tex;\n }",i="\n precision highp float;\n uniform sampler2D u_texture;\n\n varying vec2 v_tex;\n void main(void)\n {\n vec4 color = texture2D(u_texture, v_tex);\n gl_FragColor = color;\n }";this._glslProgram=this._context.programCache.acquire(e,i,this._vertexAttributeLocations),this._vertexAttributes={geometry:[new g("pos",2,s.FLOAT,0,16),new g("tex",2,s.FLOAT,8,16)]};const n=document.createElement("canvas"),m=256;n.width=m,n.height=m;const d=n.getContext("2d");d.clearRect(0,0,0,0);const l=n.width/2,x=n.height/2,v=n.height/2-15;d.beginPath(),d.arc(l,x,v,0,2*Math.PI,!1),d.fillStyle="green",d.fill(),d.lineWidth=5,d.strokeStyle="#003300",d.stroke(),this._populateBuffer(256);const p=t.createVertex(this._context,r.DYNAMIC_DRAW,this._geometryData);return this._vertexArrayObject=new c(this._context,this._vertexAttributeLocations,this._vertexAttributes,{geometry:p}),this._texture=new _(this._context,{target:a.TEXTURE_2D,pixelFormat:o.RGBA,dataType:h.UNSIGNED_BYTE,flipped:!0},n),this._initialized=!0,!1}_populateBuffer(t){const e=2*(this._posX/this._canvasWidth-.5),i=2*((this._canvasHieght-this._posY)/this._canvasHieght-.5),s=1*t/this._canvasWidth,r=1*t/this._canvasHieght;this._geometryData||(this._geometryData=new Float32Array(16)),this._geometryData[0]=e+s,this._geometryData[1]=i+r,this._geometryData[2]=1,this._geometryData[3]=1,this._geometryData[4]=e+s,this._geometryData[5]=i-r,this._geometryData[6]=1,this._geometryData[7]=0,this._geometryData[8]=e-s,this._geometryData[9]=i+r,this._geometryData[10]=0,this._geometryData[11]=1,this._geometryData[12]=e-s,this._geometryData[13]=i-r,this._geometryData[14]=0,this._geometryData[15]=0}}export{m as default};