@arcgis/core 4.25.0-next.20220920 → 4.25.0-next.20220921

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 (460) hide show
  1. package/AggregateGraphic.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{9f31ab2247c9defb882c.js → 01ac91fc0bc6b4d4e3c6.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{8588cbecb8e808f451fe.js → 249e32af1f2d433fae4c.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{5b16b30ac3166f33e81e.js → 26690f4ec1f3cb8099c2.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{be93b0cef85665446944.js → 274b4cdf6c8d77e8a2e6.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{d5650f455ce5ba15ad10.js → 2cae0ec5f60ab42a49aa.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{f436c86f86236ea7ea04.js → 4641e10e0e8e9d257521.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{7a45333de9ded92619c2.js → 466008f793c2e11e854c.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{c9d655675552dcf6cef7.js → 4a699b41072ee88f0956.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{14ea96e398f4842abe4e.js → 4fdd18f5cdaa0d82ebc1.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{9662da3e1e37f3445186.js → 562b9619b8ee13734813.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{8bab21bc6164a593278f.js → 771b92e524802de840ba.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{4969b64dc17378d7781f.js → 7ce250cc6fbe68aef50d.js} +3 -3
  15. package/assets/esri/core/workers/chunks/{2c4938512dd726a177dd.js → 7fab18074b130b71a648.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{f67357b3c6c591c9da5e.js → 872f1cb3596fb80e387f.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{31de71018575457155e5.js → 8ee3da8677255b8c8709.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{2e44aee22e70857b893c.js → 93631b10452b0e0189b3.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{cb2dc84d972469445da6.js → 95cd9edca50ea163d50f.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{d31bbb13af45ce8e45dc.js → acf9f753741b677afb44.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{1455944edeba1560eb07.js → afdafa77f5ca1b9e3acc.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{cf3e1ac63580bc495ea6.js → b4da35f1093f3731f9ac.js} +1 -1
  23. package/assets/esri/core/workers/chunks/bb0d86937faf0cd7d16d.js +1 -0
  24. package/assets/esri/core/workers/chunks/bf3e80023e156d5906c7.js +1 -0
  25. package/assets/esri/core/workers/chunks/{8ba83fee56dd4f306d87.js → c2a6ac7046134f725cf3.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{5d3fabe66e1bce1b30fb.js → cc7569489b572b8b3b53.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{fddd4ea487788e003fb1.js → d09f06eb4157a7c2c8ab.js} +1 -1
  28. package/assets/esri/core/workers/chunks/e064035f959d68e9603f.js +1 -0
  29. package/assets/esri/core/workers/chunks/{d92975e56a1290255252.js → e09df62cf35d636b0975.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{674fa5b93704ef08c9e8.js → e0c763e05feb1c2093ba.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{51289d2f5277af4023e9.js → ed33e019bc7775db2e50.js} +1 -1
  32. package/assets/esri/core/workers/chunks/ef95d6ab7b1c032ab4ad.js +1 -0
  33. package/assets/esri/core/workers/chunks/{169f4354a375db5de121.js → ffcbcb928b6cb8c596ad.js} +1 -1
  34. package/assets/esri/t9n/common_ar.json +1 -1
  35. package/assets/esri/t9n/common_bg.json +1 -1
  36. package/assets/esri/t9n/common_bs.json +1 -1
  37. package/assets/esri/t9n/common_ca.json +1 -1
  38. package/assets/esri/t9n/common_cs.json +1 -1
  39. package/assets/esri/t9n/common_da.json +1 -1
  40. package/assets/esri/t9n/common_de.json +1 -1
  41. package/assets/esri/t9n/common_el.json +1 -1
  42. package/assets/esri/t9n/common_es.json +1 -1
  43. package/assets/esri/t9n/common_et.json +1 -1
  44. package/assets/esri/t9n/common_fi.json +1 -1
  45. package/assets/esri/t9n/common_fr.json +1 -1
  46. package/assets/esri/t9n/common_he.json +1 -1
  47. package/assets/esri/t9n/common_hr.json +1 -1
  48. package/assets/esri/t9n/common_hu.json +1 -1
  49. package/assets/esri/t9n/common_id.json +1 -1
  50. package/assets/esri/t9n/common_it.json +1 -1
  51. package/assets/esri/t9n/common_ja.json +1 -1
  52. package/assets/esri/t9n/common_ko.json +1 -1
  53. package/assets/esri/t9n/common_lt.json +1 -1
  54. package/assets/esri/t9n/common_lv.json +1 -1
  55. package/assets/esri/t9n/common_nb.json +1 -1
  56. package/assets/esri/t9n/common_nl.json +1 -1
  57. package/assets/esri/t9n/common_pl.json +1 -1
  58. package/assets/esri/t9n/common_pt-BR.json +1 -1
  59. package/assets/esri/t9n/common_pt-PT.json +1 -1
  60. package/assets/esri/t9n/common_ro.json +1 -1
  61. package/assets/esri/t9n/common_ru.json +1 -1
  62. package/assets/esri/t9n/common_sk.json +1 -1
  63. package/assets/esri/t9n/common_sl.json +1 -1
  64. package/assets/esri/t9n/common_sr.json +1 -1
  65. package/assets/esri/t9n/common_sv.json +1 -1
  66. package/assets/esri/t9n/common_th.json +1 -1
  67. package/assets/esri/t9n/common_tr.json +1 -1
  68. package/assets/esri/t9n/common_uk.json +1 -1
  69. package/assets/esri/t9n/common_vi.json +1 -1
  70. package/assets/esri/t9n/common_zh-CN.json +1 -1
  71. package/assets/esri/t9n/common_zh-HK.json +1 -1
  72. package/assets/esri/t9n/common_zh-TW.json +1 -1
  73. package/assets/esri/widgets/Feature/t9n/Feature_ar.json +1 -1
  74. package/assets/esri/widgets/Feature/t9n/Feature_bg.json +1 -1
  75. package/assets/esri/widgets/Feature/t9n/Feature_bs.json +1 -1
  76. package/assets/esri/widgets/Feature/t9n/Feature_ca.json +1 -1
  77. package/assets/esri/widgets/Feature/t9n/Feature_cs.json +1 -1
  78. package/assets/esri/widgets/Feature/t9n/Feature_da.json +1 -1
  79. package/assets/esri/widgets/Feature/t9n/Feature_de.json +1 -1
  80. package/assets/esri/widgets/Feature/t9n/Feature_el.json +1 -1
  81. package/assets/esri/widgets/Feature/t9n/Feature_es.json +1 -1
  82. package/assets/esri/widgets/Feature/t9n/Feature_et.json +1 -1
  83. package/assets/esri/widgets/Feature/t9n/Feature_fi.json +1 -1
  84. package/assets/esri/widgets/Feature/t9n/Feature_fr.json +1 -1
  85. package/assets/esri/widgets/Feature/t9n/Feature_he.json +1 -1
  86. package/assets/esri/widgets/Feature/t9n/Feature_hr.json +1 -1
  87. package/assets/esri/widgets/Feature/t9n/Feature_hu.json +1 -1
  88. package/assets/esri/widgets/Feature/t9n/Feature_id.json +1 -1
  89. package/assets/esri/widgets/Feature/t9n/Feature_it.json +1 -1
  90. package/assets/esri/widgets/Feature/t9n/Feature_ja.json +1 -1
  91. package/assets/esri/widgets/Feature/t9n/Feature_ko.json +1 -1
  92. package/assets/esri/widgets/Feature/t9n/Feature_lt.json +1 -1
  93. package/assets/esri/widgets/Feature/t9n/Feature_lv.json +1 -1
  94. package/assets/esri/widgets/Feature/t9n/Feature_nb.json +1 -1
  95. package/assets/esri/widgets/Feature/t9n/Feature_nl.json +1 -1
  96. package/assets/esri/widgets/Feature/t9n/Feature_pl.json +1 -1
  97. package/assets/esri/widgets/Feature/t9n/Feature_pt-BR.json +1 -1
  98. package/assets/esri/widgets/Feature/t9n/Feature_pt-PT.json +1 -1
  99. package/assets/esri/widgets/Feature/t9n/Feature_ro.json +1 -1
  100. package/assets/esri/widgets/Feature/t9n/Feature_ru.json +1 -1
  101. package/assets/esri/widgets/Feature/t9n/Feature_sk.json +1 -1
  102. package/assets/esri/widgets/Feature/t9n/Feature_sl.json +1 -1
  103. package/assets/esri/widgets/Feature/t9n/Feature_sr.json +1 -1
  104. package/assets/esri/widgets/Feature/t9n/Feature_sv.json +1 -1
  105. package/assets/esri/widgets/Feature/t9n/Feature_th.json +1 -1
  106. package/assets/esri/widgets/Feature/t9n/Feature_tr.json +1 -1
  107. package/assets/esri/widgets/Feature/t9n/Feature_uk.json +1 -1
  108. package/assets/esri/widgets/Feature/t9n/Feature_vi.json +1 -1
  109. package/assets/esri/widgets/Feature/t9n/Feature_zh-CN.json +1 -1
  110. package/assets/esri/widgets/Feature/t9n/Feature_zh-HK.json +1 -1
  111. package/assets/esri/widgets/Feature/t9n/Feature_zh-TW.json +1 -1
  112. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ar.json +1 -1
  113. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bg.json +1 -1
  114. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bs.json +1 -1
  115. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ca.json +1 -1
  116. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_cs.json +1 -1
  117. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_da.json +1 -1
  118. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_de.json +1 -1
  119. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_el.json +1 -1
  120. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_es.json +1 -1
  121. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_et.json +1 -1
  122. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fi.json +1 -1
  123. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fr.json +1 -1
  124. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_he.json +1 -1
  125. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hr.json +1 -1
  126. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hu.json +1 -1
  127. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_id.json +1 -1
  128. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_it.json +1 -1
  129. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ja.json +1 -1
  130. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ko.json +1 -1
  131. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lt.json +1 -1
  132. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lv.json +1 -1
  133. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_nb.json +1 -1
  134. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_nl.json +1 -1
  135. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pl.json +1 -1
  136. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-BR.json +1 -1
  137. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-PT.json +1 -1
  138. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ro.json +1 -1
  139. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ru.json +1 -1
  140. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sk.json +1 -1
  141. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sl.json +1 -1
  142. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sr.json +1 -1
  143. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sv.json +1 -1
  144. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_th.json +1 -1
  145. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_tr.json +1 -1
  146. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_uk.json +1 -1
  147. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_vi.json +1 -1
  148. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-CN.json +1 -1
  149. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-HK.json +1 -1
  150. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-TW.json +1 -1
  151. package/assets/esri/widgets/Popup/t9n/Popup_ar.json +1 -1
  152. package/assets/esri/widgets/Popup/t9n/Popup_bg.json +1 -1
  153. package/assets/esri/widgets/Popup/t9n/Popup_bs.json +1 -1
  154. package/assets/esri/widgets/Popup/t9n/Popup_ca.json +1 -1
  155. package/assets/esri/widgets/Popup/t9n/Popup_cs.json +1 -1
  156. package/assets/esri/widgets/Popup/t9n/Popup_da.json +1 -1
  157. package/assets/esri/widgets/Popup/t9n/Popup_de.json +1 -1
  158. package/assets/esri/widgets/Popup/t9n/Popup_el.json +1 -1
  159. package/assets/esri/widgets/Popup/t9n/Popup_es.json +1 -1
  160. package/assets/esri/widgets/Popup/t9n/Popup_et.json +1 -1
  161. package/assets/esri/widgets/Popup/t9n/Popup_fi.json +1 -1
  162. package/assets/esri/widgets/Popup/t9n/Popup_fr.json +1 -1
  163. package/assets/esri/widgets/Popup/t9n/Popup_he.json +1 -1
  164. package/assets/esri/widgets/Popup/t9n/Popup_hr.json +1 -1
  165. package/assets/esri/widgets/Popup/t9n/Popup_hu.json +1 -1
  166. package/assets/esri/widgets/Popup/t9n/Popup_id.json +1 -1
  167. package/assets/esri/widgets/Popup/t9n/Popup_it.json +1 -1
  168. package/assets/esri/widgets/Popup/t9n/Popup_ja.json +1 -1
  169. package/assets/esri/widgets/Popup/t9n/Popup_ko.json +1 -1
  170. package/assets/esri/widgets/Popup/t9n/Popup_lt.json +1 -1
  171. package/assets/esri/widgets/Popup/t9n/Popup_lv.json +1 -1
  172. package/assets/esri/widgets/Popup/t9n/Popup_nb.json +1 -1
  173. package/assets/esri/widgets/Popup/t9n/Popup_nl.json +1 -1
  174. package/assets/esri/widgets/Popup/t9n/Popup_pl.json +1 -1
  175. package/assets/esri/widgets/Popup/t9n/Popup_pt-BR.json +1 -1
  176. package/assets/esri/widgets/Popup/t9n/Popup_pt-PT.json +1 -1
  177. package/assets/esri/widgets/Popup/t9n/Popup_ro.json +1 -1
  178. package/assets/esri/widgets/Popup/t9n/Popup_ru.json +1 -1
  179. package/assets/esri/widgets/Popup/t9n/Popup_sk.json +1 -1
  180. package/assets/esri/widgets/Popup/t9n/Popup_sl.json +1 -1
  181. package/assets/esri/widgets/Popup/t9n/Popup_sr.json +1 -1
  182. package/assets/esri/widgets/Popup/t9n/Popup_sv.json +1 -1
  183. package/assets/esri/widgets/Popup/t9n/Popup_th.json +1 -1
  184. package/assets/esri/widgets/Popup/t9n/Popup_tr.json +1 -1
  185. package/assets/esri/widgets/Popup/t9n/Popup_uk.json +1 -1
  186. package/assets/esri/widgets/Popup/t9n/Popup_vi.json +1 -1
  187. package/assets/esri/widgets/Popup/t9n/Popup_zh-CN.json +1 -1
  188. package/assets/esri/widgets/Popup/t9n/Popup_zh-HK.json +1 -1
  189. package/assets/esri/widgets/Popup/t9n/Popup_zh-TW.json +1 -1
  190. package/assets/esri/widgets/support/t9n/DatePicker_ar.json +1 -1
  191. package/assets/esri/widgets/support/t9n/DatePicker_bg.json +1 -1
  192. package/assets/esri/widgets/support/t9n/DatePicker_bs.json +1 -1
  193. package/assets/esri/widgets/support/t9n/DatePicker_ca.json +1 -1
  194. package/assets/esri/widgets/support/t9n/DatePicker_cs.json +1 -1
  195. package/assets/esri/widgets/support/t9n/DatePicker_da.json +1 -1
  196. package/assets/esri/widgets/support/t9n/DatePicker_de.json +1 -1
  197. package/assets/esri/widgets/support/t9n/DatePicker_el.json +1 -1
  198. package/assets/esri/widgets/support/t9n/DatePicker_es.json +1 -1
  199. package/assets/esri/widgets/support/t9n/DatePicker_et.json +1 -1
  200. package/assets/esri/widgets/support/t9n/DatePicker_fi.json +1 -1
  201. package/assets/esri/widgets/support/t9n/DatePicker_fr.json +1 -1
  202. package/assets/esri/widgets/support/t9n/DatePicker_he.json +1 -1
  203. package/assets/esri/widgets/support/t9n/DatePicker_hr.json +1 -1
  204. package/assets/esri/widgets/support/t9n/DatePicker_hu.json +1 -1
  205. package/assets/esri/widgets/support/t9n/DatePicker_id.json +1 -1
  206. package/assets/esri/widgets/support/t9n/DatePicker_it.json +1 -1
  207. package/assets/esri/widgets/support/t9n/DatePicker_ja.json +1 -1
  208. package/assets/esri/widgets/support/t9n/DatePicker_ko.json +1 -1
  209. package/assets/esri/widgets/support/t9n/DatePicker_lt.json +1 -1
  210. package/assets/esri/widgets/support/t9n/DatePicker_lv.json +1 -1
  211. package/assets/esri/widgets/support/t9n/DatePicker_nb.json +1 -1
  212. package/assets/esri/widgets/support/t9n/DatePicker_nl.json +1 -1
  213. package/assets/esri/widgets/support/t9n/DatePicker_pl.json +1 -1
  214. package/assets/esri/widgets/support/t9n/DatePicker_pt-BR.json +1 -1
  215. package/assets/esri/widgets/support/t9n/DatePicker_pt-PT.json +1 -1
  216. package/assets/esri/widgets/support/t9n/DatePicker_ro.json +1 -1
  217. package/assets/esri/widgets/support/t9n/DatePicker_ru.json +1 -1
  218. package/assets/esri/widgets/support/t9n/DatePicker_sk.json +1 -1
  219. package/assets/esri/widgets/support/t9n/DatePicker_sl.json +1 -1
  220. package/assets/esri/widgets/support/t9n/DatePicker_sr.json +1 -1
  221. package/assets/esri/widgets/support/t9n/DatePicker_sv.json +1 -1
  222. package/assets/esri/widgets/support/t9n/DatePicker_th.json +1 -1
  223. package/assets/esri/widgets/support/t9n/DatePicker_tr.json +1 -1
  224. package/assets/esri/widgets/support/t9n/DatePicker_uk.json +1 -1
  225. package/assets/esri/widgets/support/t9n/DatePicker_vi.json +1 -1
  226. package/assets/esri/widgets/support/t9n/DatePicker_zh-CN.json +1 -1
  227. package/assets/esri/widgets/support/t9n/DatePicker_zh-HK.json +1 -1
  228. package/assets/esri/widgets/support/t9n/DatePicker_zh-TW.json +1 -1
  229. package/assets/esri/widgets/support/t9n/TimePicker_ar.json +1 -1
  230. package/assets/esri/widgets/support/t9n/TimePicker_bg.json +1 -1
  231. package/assets/esri/widgets/support/t9n/TimePicker_bs.json +1 -1
  232. package/assets/esri/widgets/support/t9n/TimePicker_ca.json +1 -1
  233. package/assets/esri/widgets/support/t9n/TimePicker_cs.json +1 -1
  234. package/assets/esri/widgets/support/t9n/TimePicker_da.json +1 -1
  235. package/assets/esri/widgets/support/t9n/TimePicker_de.json +1 -1
  236. package/assets/esri/widgets/support/t9n/TimePicker_el.json +1 -1
  237. package/assets/esri/widgets/support/t9n/TimePicker_es.json +1 -1
  238. package/assets/esri/widgets/support/t9n/TimePicker_et.json +1 -1
  239. package/assets/esri/widgets/support/t9n/TimePicker_fi.json +1 -1
  240. package/assets/esri/widgets/support/t9n/TimePicker_fr.json +1 -1
  241. package/assets/esri/widgets/support/t9n/TimePicker_he.json +1 -1
  242. package/assets/esri/widgets/support/t9n/TimePicker_hr.json +1 -1
  243. package/assets/esri/widgets/support/t9n/TimePicker_hu.json +1 -1
  244. package/assets/esri/widgets/support/t9n/TimePicker_id.json +1 -1
  245. package/assets/esri/widgets/support/t9n/TimePicker_it.json +1 -1
  246. package/assets/esri/widgets/support/t9n/TimePicker_ja.json +1 -1
  247. package/assets/esri/widgets/support/t9n/TimePicker_ko.json +1 -1
  248. package/assets/esri/widgets/support/t9n/TimePicker_lt.json +1 -1
  249. package/assets/esri/widgets/support/t9n/TimePicker_lv.json +1 -1
  250. package/assets/esri/widgets/support/t9n/TimePicker_nb.json +1 -1
  251. package/assets/esri/widgets/support/t9n/TimePicker_nl.json +1 -1
  252. package/assets/esri/widgets/support/t9n/TimePicker_pl.json +1 -1
  253. package/assets/esri/widgets/support/t9n/TimePicker_pt-BR.json +1 -1
  254. package/assets/esri/widgets/support/t9n/TimePicker_pt-PT.json +1 -1
  255. package/assets/esri/widgets/support/t9n/TimePicker_ro.json +1 -1
  256. package/assets/esri/widgets/support/t9n/TimePicker_ru.json +1 -1
  257. package/assets/esri/widgets/support/t9n/TimePicker_sk.json +1 -1
  258. package/assets/esri/widgets/support/t9n/TimePicker_sl.json +1 -1
  259. package/assets/esri/widgets/support/t9n/TimePicker_sr.json +1 -1
  260. package/assets/esri/widgets/support/t9n/TimePicker_sv.json +1 -1
  261. package/assets/esri/widgets/support/t9n/TimePicker_th.json +1 -1
  262. package/assets/esri/widgets/support/t9n/TimePicker_tr.json +1 -1
  263. package/assets/esri/widgets/support/t9n/TimePicker_uk.json +1 -1
  264. package/assets/esri/widgets/support/t9n/TimePicker_vi.json +1 -1
  265. package/assets/esri/widgets/support/t9n/TimePicker_zh-CN.json +1 -1
  266. package/assets/esri/widgets/support/t9n/TimePicker_zh-HK.json +1 -1
  267. package/assets/esri/widgets/support/t9n/TimePicker_zh-TW.json +1 -1
  268. package/chunks/Compositing.glsl.js +4 -19
  269. package/chunks/HUDCompositing.glsl.js +7 -0
  270. package/chunks/Laserlines.glsl.js +5 -5
  271. package/chunks/OITCompositing.glsl.js +13 -0
  272. package/chunks/OverlayCompositing.glsl.js +8 -0
  273. package/chunks/Precipitation.glsl.js +1 -1
  274. package/chunks/ShadowHighlight.glsl.js +1 -1
  275. package/chunks/boundedPlane.js +1 -1
  276. package/chunks/cameraUtilsPlanar.js +1 -1
  277. package/chunks/cameraUtilsSpherical.js +1 -1
  278. package/chunks/mat3.js +1 -1
  279. package/chunks/quat.js +1 -1
  280. package/chunks/quat2.js +1 -1
  281. package/chunks/quatf64.js +1 -1
  282. package/chunks/sphere.js +1 -1
  283. package/chunks/vec3.js +1 -1
  284. package/chunks/vec3f32.js +1 -1
  285. package/chunks/vec4f64.js +1 -1
  286. package/core/VectorStack.js +1 -1
  287. package/core/libs/gl-matrix-2/factories/quatf64.js +1 -1
  288. package/core/libs/gl-matrix-2/factories/vec3f32.js +1 -1
  289. package/core/libs/gl-matrix-2/factories/vec4f64.js +1 -1
  290. package/core/libs/gl-matrix-2/math/mat3.js +1 -1
  291. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  292. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  293. package/core/perspectiveUtils.js +1 -1
  294. package/geohash/GeohashTree.js +1 -1
  295. package/geometry/support/MeshTransform.js +1 -1
  296. package/geometry/support/axisAngle.js +1 -1
  297. package/geometry/support/axisAngleDegrees.js +1 -1
  298. package/geometry/support/lineSegment.js +1 -1
  299. package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
  300. package/geometry/support/meshUtils/exporters/gltf/node.js +1 -1
  301. package/geometry/support/meshUtils/georeference.js +1 -1
  302. package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
  303. package/geometry/support/meshUtils/projection.js +1 -1
  304. package/geometry/support/meshUtils/rotate.js +1 -1
  305. package/geometry/support/plane.js +1 -1
  306. package/interfaces.d.ts +70 -0
  307. package/layers/buildingSublayers/BuildingComponentSublayer.js +1 -1
  308. package/layers/graphics/featureConversionUtils.js +1 -1
  309. package/layers/mixins/EditBusLayer.js +1 -1
  310. package/layers/support/AggregateField.js +1 -1
  311. package/layers/support/ControlPointsGeoreference.js +1 -1
  312. package/layers/support/OutStatistic.js +1 -1
  313. package/layers/support/VoxelVolume.js +1 -1
  314. package/layers/support/voxelPlaneUtils.js +1 -1
  315. package/package.json +1 -1
  316. package/rest/support/AggregateFeatureSet.js +5 -0
  317. package/support/revision.js +1 -1
  318. package/views/2d/ViewState.js +1 -1
  319. package/views/2d/engine/flow/FlowDisplayObject.js +1 -1
  320. package/views/2d/engine/imagery/RasterVFTile.js +1 -1
  321. package/views/2d/engine/vectorTiles/VectorTile.js +1 -1
  322. package/views/2d/engine/webgl/OverlayContainer.js +1 -1
  323. package/views/2d/engine/webgl/TiledDisplayObject.js +1 -1
  324. package/views/2d/engine/webgl/WGLTile.js +1 -1
  325. package/views/2d/engine/webgl/WorldExtentClipRenderer.js +1 -1
  326. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  327. package/views/2d/layers/features/controllers/FeatureController2D.js +1 -1
  328. package/views/2d/layers/features/schemaUtils.js +1 -1
  329. package/views/2d/layers/features/support/BinStore.js +1 -1
  330. package/views/2d/layers/features/support/ClusterStore.js +1 -1
  331. package/views/2d/layers/graphics/GraphicBoundsRenderer.js +1 -1
  332. package/views/2d/layers/support/DebugOverlay.js +1 -1
  333. package/views/2d/layers/support/FeatureLayerProxy.js +1 -1
  334. package/views/2d/layers/support/clusterUtils.js +1 -1
  335. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  336. package/views/3d/analysis/Dimensioning/LengthDimensionSubTool.js +1 -1
  337. package/views/3d/analysis/Dimensioning/LengthDimensionVisualization.js +1 -1
  338. package/views/3d/analysis/Dimensioning/lengthDimensionUtils.js +1 -1
  339. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  340. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  341. package/views/3d/analysis/Slice/sliceToolConfig.js +1 -1
  342. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  343. package/views/3d/camera/constraintUtils/distance.js +1 -1
  344. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  345. package/views/3d/environment/PanoramicAtmosphere.js +1 -1
  346. package/views/3d/environment/SceneViewEnvironmentManager.js +1 -1
  347. package/views/3d/environment/SimpleAtmosphere.js +1 -1
  348. package/views/3d/glTF/internal/Resource.js +1 -1
  349. package/views/3d/interactive/Manipulator3D.js +1 -1
  350. package/views/3d/interactive/editingTools/reshapeGraphic/edgeOffsetUtils.js +1 -1
  351. package/views/3d/interactive/editingTools/settings.js +1 -1
  352. package/views/3d/interactive/editingTools/transformGraphic/ExtentTransformTool.js +1 -1
  353. package/views/3d/interactive/editingTools/transformGraphic/GraphicScaleRotateTransform.js +1 -1
  354. package/views/3d/interactive/manipulatorUtils.js +1 -1
  355. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  356. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  357. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  358. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  359. package/views/3d/layers/I3SMeshView3D.js +1 -1
  360. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  361. package/views/3d/layers/PointCloudWorker.js +1 -1
  362. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  363. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  364. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  365. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  366. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  367. package/views/3d/layers/graphics/Graphics3DLodInstanceGraphicLayer.js +1 -1
  368. package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
  369. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  370. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  371. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  372. package/views/3d/layers/i3s/I3SElevationProvider.js +1 -1
  373. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  374. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  375. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  376. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  377. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  378. package/views/3d/layers/support/I3STreeDebugger.js +1 -1
  379. package/views/3d/layers/support/edgeUtils.js +1 -1
  380. package/views/3d/layers/support/uvUtils.js +1 -1
  381. package/views/3d/state/Frustum.js +1 -1
  382. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  383. package/views/3d/state/controllers/RotateController.js +1 -1
  384. package/views/3d/state/controllers/global/PinchAndPanController.js +1 -1
  385. package/views/3d/state/controllers/local/PinchAndPanController.js +1 -1
  386. package/views/3d/state/controllers/local/ZoomController.js +1 -1
  387. package/views/3d/state/controllers/momentum/ZoomPlanarMomentumController.js +1 -1
  388. package/views/3d/state/utils/navigationUtils.js +1 -1
  389. package/views/3d/support/FrustumExtentIntersection.js +1 -1
  390. package/views/3d/support/orientedBoundingBox.js +1 -1
  391. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  392. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  393. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  394. package/views/3d/support/sunUtils.js +1 -1
  395. package/views/3d/terrain/OverlayRenderer.js +1 -1
  396. package/views/3d/terrain/PatchRenderData.js +1 -1
  397. package/views/3d/terrain/TerrainSurface.js +1 -1
  398. package/views/3d/terrain/Tile.js +1 -1
  399. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  400. package/views/3d/webgl-engine/collections/Component/DepthRange.js +1 -1
  401. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  402. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  403. package/views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js +1 -1
  404. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +2 -2
  405. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueRepository.js +1 -1
  406. package/views/3d/webgl-engine/core/util/TwoVectorPosition.js +1 -1
  407. package/views/3d/webgl-engine/lib/Camera.js +1 -1
  408. package/views/3d/webgl-engine/lib/CompositingHelper.js +1 -1
  409. package/views/3d/webgl-engine/lib/GeometryRecord.js +1 -1
  410. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  411. package/views/3d/webgl-engine/lib/Highlight.js +1 -1
  412. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  413. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  414. package/views/3d/webgl-engine/lib/ObjectAndLayerIdRenderHelper.js +1 -1
  415. package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
  416. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  417. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  418. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  419. package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
  420. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  421. package/views/3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js +1 -1
  422. package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
  423. package/views/3d/webgl-engine/lib/lodRendering/InstanceOctree.js +1 -1
  424. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  425. package/views/3d/webgl-engine/lib/pathGeometryUtils.js +1 -1
  426. package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
  427. package/views/3d/webgl-engine/lighting/SphericalHarmonics.js +1 -1
  428. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  429. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  430. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  431. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  432. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  433. package/views/3d/webgl-engine/shaders/Compositing.glsl.js +1 -1
  434. package/views/3d/webgl-engine/shaders/CompositingTechnique.js +1 -1
  435. package/views/3d/webgl-engine/shaders/CompositingTechniqueConfiguration.js +1 -1
  436. package/views/3d/webgl-engine/shaders/HUDCompositing.glsl.js +5 -0
  437. package/views/3d/webgl-engine/shaders/HUDCompositingTechnique.js +5 -0
  438. package/views/3d/webgl-engine/shaders/OITCompositing.glsl.js +5 -0
  439. package/views/3d/webgl-engine/shaders/OITCompositingTechnique.js +5 -0
  440. package/views/3d/webgl-engine/shaders/OverlayCompositing.glsl.js +5 -0
  441. package/views/3d/webgl-engine/shaders/OverlayCompositingTechnique.js +5 -0
  442. package/views/draw/support/surfaceCoordinateSystems.js +1 -1
  443. package/views/interactive/coordinateHelper.js +1 -1
  444. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  445. package/views/interactive/editGeometry/support/editPlaneUtils.js +1 -1
  446. package/views/interactive/snapping/RightAngleSnapper.js +1 -1
  447. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
  448. package/views/layers/FeatureLayerView.js +1 -1
  449. package/views/navigation/PanSphericalMomentumEstimator.js +1 -1
  450. package/views/support/Scheduler.js +1 -1
  451. package/views/support/euclideanAreaMeasurementUtils.js +1 -1
  452. package/views/support/geometry3dUtils.js +1 -1
  453. package/widgets/ElevationProfile/support/ProfileLines3D.js +1 -1
  454. package/widgets/ElevationProfile/support/constants.js +1 -1
  455. package/widgets/Feature/FeatureRelationship/FeatureRelationshipViewModel.js +1 -1
  456. package/widgets/Feature/FeatureRelationship.js +1 -1
  457. package/assets/esri/core/workers/chunks/0059699bf824f851d51c.js +0 -1
  458. package/assets/esri/core/workers/chunks/36dd5654df5c7f00406d.js +0 -1
  459. package/assets/esri/core/workers/chunks/de128d8a643b4297940b.js +0 -1
  460. package/assets/esri/core/workers/chunks/e00327925ca82b63fded.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{unpackFloatRGBA as e}from"../../../../core/floatRGBA.js";import{isSome as t,isNone as r}from"../../../../core/maybe.js";import i from"../../../../core/PooledArray.js";import{m as n,c as s}from"../../../../chunks/mat4.js";import{c as a}from"../../../../chunks/mat4f64.js";import{m as o}from"../../../../chunks/vec3.js";import{l as h}from"../../../../chunks/vec4.js";import{c as f}from"../../../../chunks/vec4f64.js";import{intersectsSphere as _,create as c,copy as l}from"../../../../geometry/support/frustum.js";import{c as u}from"../../../../chunks/sphere.js";import{maxScale as d}from"../../support/mathUtils.js";import{empty as g,union as m,set as p}from"./depthRange.js";import b from"./Octree.js";import{assert as w}from"./Util.js";const R=1e4,B=100,v=500,j=500,C=.1;function A(t,r,i){return e(r,t)*(i[1]-i[0])+i[0]}function M(e,t,r){if(t.size<R)return K.compute(e,t);const i=g();return r.forAll((t=>{t.isVisible&&m(i,O(e,t))})),i}function O(e,r){if(!r.isVisible)return;const i=g(),n=r.getSpatialQueryAccelerator();return t(n)?T(i,e,n):D(i,e,r.objects),i}function T(e,t,r){const i=t.eye,n=t.viewForward,s=t.frustum,a=e=>e.isVisible,o=r.objectCount;if(o<v)p(W,t.near,Math.min(e.near,t.far)),r.forEachInDepthRange(i,n,b.DepthOrder.FRONT_TO_BACK,W,((r,i)=>{S(e,t,r),W.far=e.near,i.setRange(W)}),s,a),p(W,Math.max(e.far,t.near),t.far),r.forEachInDepthRange(i,n,b.DepthOrder.BACK_TO_FRONT,W,((r,i)=>{S(e,t,r),W.near=e.far,i.setRange(W)}),s,a);else{const i=Math.max(Math.min(o,j),Math.ceil(o*C)),h=r.findClosest(n,b.DepthOrder.FRONT_TO_BACK,s,a,i),f=r.findClosest(n,b.DepthOrder.BACK_TO_FRONT,s,a,i);h&&f&&(F(e,t,h.boundingVolumeWorldSpace.bounds),F(e,t,f.boundingVolumeWorldSpace.bounds))}}function D(e,t,r){k.clear(),r.forAll((e=>{e.isVisible&&0!==e.geometryRecords.length&&k.add(e)})),k.empty||(k.sort(t),p(W,t.near,Math.min(e.near,t.far)),k.forEachInDepthRange(W,b.DepthOrder.FRONT_TO_BACK,((r,i)=>{i<e.near&&S(e,t,r)})),p(W,Math.max(e.far,t.near),t.far),k.forEachInDepthRange(W,b.DepthOrder.BACK_TO_FRONT,((t,r,i)=>{e.far=Math.max(e.far,i)})))}function S(e,t,r){if(!r.isVisible)return;if(!_(t.frustum,r.boundingVolumeWorldSpace.bounds))return;const i=r.transformation,s=E;r.geometryRecords.forEach((r=>{n(s,i,r.getShaderTransformation());const a=d(s);y(e,t,r.geometry.boundingInfo,s,a)}))}function y(e,t,i,n,s){if(r(i))return;const a=t.eye,h=t.viewForward;o(V,i.center,n);const f=h[0]*(V[0]-a[0])+h[1]*(V[1]-a[1])+h[2]*(V[2]-a[2]);if(V[3]=i.radius*s,!(f-V[3]>e.near&&f+V[3]<e.far)&&_(t.frustum,V))if(i.radius>B&&i.getChildren()){const r=i.getChildren();for(let i=0;i<8;++i)r[i]&&y(e,t,r[i],n,s)}else U.unionDepthRangeWithAABB(e,t.viewProjectionMatrix,n,i.bbMin,i.bbMax)}function F(e,t,r){const i=t.eye,n=t.viewForward,s=(r[0]-i[0])*n[0]+(r[1]-i[1])*n[1]+(r[2]-i[2])*n[2];e.near=Math.min(e.near,s-r[3]),e.far=Math.max(e.far,s+r[3])}class I{constructor(){this._items=new i({allocator:e=>e||{obj:null,distance:0,near:0,far:0},deallocator:e=>(e.obj=null,e.distance=0,e.near=0,e.far=0,e)})}get length(){return this._items.length}get empty(){return 0===this._items.length}clear(){this._items.clear()}add(e){this._items.pushNew().obj=e}sort(e){const t=e.eye,r=e.viewForward;this._items.forAll((e=>{const i=e.obj.boundingVolumeWorldSpace.bounds,n=(i[0]-t[0])*r[0]+(i[1]-t[1])*r[1]+(i[2]-t[2])*r[2];e.distance=n,e.near=n-i[3],e.far=n+i[3]})),this._items.sort(((e,t)=>e.distance-t.distance))}forEachInDepthRange(e,t,r){if(t===b.DepthOrder.FRONT_TO_BACK)for(let i=0;i<this._items.length;++i){const t=this._items.data[i];t.far<e.near||t.near>e.far||r(t.obj,t.near,t.far)}else for(let i=this._items.length-1;i>=0;--i){const t=this._items.data[i];t.far<e.near||t.near>e.far||r(t.obj,t.near,t.far)}}}class P{constructor(){this._view=a(),this._viewProj=a(),this._frustum=c(),this._geometries=[],this._near=[],this._far=[],this._nearCandidates=[],this._farCandidates=[],this._range={near:0,far:0},this._looseRange={near:0,far:0}}compute(e,t){this._reset(),s(this._view,e.viewMatrix),n(this._viewProj,e.projectionMatrix,this._view),l(this._frustum,e.frustum);const r=this._view,i=r[2],a=r[6],o=r[10],h=r[14],f=this._range;let _=0;if(t.forEach((e=>{if(!e.instanceParameters.visible)return;if(!e.castShadow)return;let t;e.hasShaderTransformation?(e.computeBoundingSphere(e.getShaderTransformation(),V,1),t=V):t=e.boundingSphere;const r=i*t[0]+a*t[1]+o*t[2]+h,n=r-t[3],s=r+t[3];this._geometries[_]=e,this._near[_]=-s,this._far[_]=-n,++_})),0===this._geometries.length)return f;for(let n=0;n<this._geometries.length;++n)this._near[n]>f.far&&(f.far=this._near[n]),this._near[n]>2&&this._far[n]<f.near&&(f.near=this._far[n]);const c=this._looseRange;c.near=Math.max(.5*f.near,2),c.far=2*f.far;let u=0,d=0;for(let n=0;n<this._geometries.length;++n)this._near[n]<f.near&&(this._near[n]>=c.near?f.near=this._near[n]:this._nearCandidates[u++]=n),this._far[n]>f.far&&(this._far[n]<=c.far?f.far=this._far[n]:this._farCandidates[d++]=n);if(0===this._nearCandidates.length&&0===this._farCandidates.length)return f;this._nearCandidates.sort(((e,t)=>this._near[e]<this._near[t]?-1:this._near[e]>this._near[t]?1:0)),this._farCandidates.sort(((e,t)=>this._far[e]<this._far[t]?1:this._far[e]>this._far[t]?-1:0));for(let n=0;n<this._nearCandidates.length;++n){const e=this._nearCandidates[n];if(this._near[e]<f.near){const t=this._geometries[e],r=t.boundingInfo;this._includeNearBoundingInfoRec(r,t.getShaderTransformation())}}for(let n=0;n<this._farCandidates.length;++n){const e=this._farCandidates[n];if(this._far[e]>f.far){const t=this._geometries[e],r=t.boundingInfo;this._includeFarBoundingInfoRec(r,t.getShaderTransformation())}}return f}_reset(){this._geometries.length=0,this._near.length=0,this._far.length=0,this._nearCandidates.length=0,this._farCandidates.length=0,this._range.near=Number.MAX_VALUE,this._range.far=-Number.MAX_VALUE}_includeNearBoundingInfoRec(e,t){if(r(e))return;const i=e.getCenter();o(V,i,t);const n=d(t),s=V[0],a=V[1],h=V[2],f=e.getBSRadius()*n,_=this._frustum;if(_[0][0]*s+_[0][1]*a+_[0][2]*h+_[0][3]>f||_[1][0]*s+_[1][1]*a+_[1][2]*h+_[1][3]>f||_[2][0]*s+_[2][1]*a+_[2][2]*h+_[2][3]>f||_[3][0]*s+_[3][1]*a+_[3][2]*h+_[3][3]>f)return;const c=this._view[2]*s+this._view[6]*a+this._view[10]*h+this._view[14],l=c+f;if(!(-(c-f)<2||-l>=this._range.near))if(-l>this._looseRange.near)this._range.near=-l;else{if(f>B){const r=e.getChildren();if(void 0!==r){for(let e=0;e<8;++e)void 0!==r[e]&&this._includeNearBoundingInfoRec(r[e],t);return}}U.unionDepthRangeWithAABB(this._range,this._viewProj,t,e.getBBMin(),e.getBBMax())}}_includeFarBoundingInfoRec(e,t){if(r(e))return;let i=e.getBSRadius();const n=e.getCenter();o(V,n,t);const s=d(t),a=V[0],h=V[1],f=V[2];i*=s;const _=this._frustum;if(_[0][0]*a+_[0][1]*h+_[0][2]*f+_[0][3]>i||_[1][0]*a+_[1][1]*h+_[1][2]*f+_[1][3]>i||_[2][0]*a+_[2][1]*h+_[2][2]*f+_[2][3]>i||_[3][0]*a+_[3][1]*h+_[3][2]*f+_[3][3]>i)return;const c=this._view[2]*a+this._view[6]*h+this._view[10]*f+this._view[14]-i;if(!(-c<=this._range.far))if(-c<this._looseRange.far)this._range.far=-c;else{if(i>B){const r=e.getChildren();if(void 0!==r){for(let e=0;e<8;++e)void 0!==r[e]&&this._includeFarBoundingInfoRec(r[e],t);return}}U.unionDepthRangeWithAABB(this._range,this._viewProj,t,e.getBBMin(),e.getBBMax())}}}class x{constructor(){this._modelViewProj=a(),this._clipPosition=[f(),f(),f(),f(),f(),f(),f(),f()]}unionDepthRangeWithAABB(e,t,r,i,s){const a=this._modelViewProj;n(a,t,r);let o=!1;for(let n=0;n<8;++n){const e=this._clipPosition[n],t=0===n||3===n||4===n||7===n?i[0]:s[0],r=0===n||1===n||4===n||5===n?i[1]:s[1],o=n<4?i[2]:s[2];e[0]=a[0]*t+a[4]*r+a[8]*o+a[12],e[1]=a[1]*t+a[5]*r+a[9]*o+a[13],e[2]=a[2]*t+a[6]*r+a[10]*o+a[14],e[3]=a[3]*t+a[7]*r+a[11]*o+a[15]}for(let n=0;n<12;++n){const t=this._clipPosition[N[n][0]],r=this._clipPosition[N[n][1]],i=this._clipPosition[N[n][2]],s=this._clipTriangle(t,r,i);let a=!0;for(let e=0;e<s.length;++e){if(s[e][3]>=2){a=!1;break}}if(!a){o=!0;for(let t=0;t<s.length;++t){const r=s[t][3];r<e.near&&(e.near=r),r>e.far&&(e.far=r)}}}return o}_inside(e,t){return 0===t?e[0]>=-e[3]:1===t?e[1]>=-e[3]:2===t?e[0]<=e[3]:3===t?e[1]<=e[3]:void w(!1)}_intersect(e,t,r){let i=0;return 0===r?i=(-e[3]-e[0])/(t[0]-e[0]+t[3]-e[3]):1===r?i=(-e[3]-e[1])/(t[1]-e[1]+t[3]-e[3]):2===r?i=(e[3]-e[0])/(t[0]-e[0]-t[3]+e[3]):3===r&&(i=(e[3]-e[1])/(t[1]-e[1]-t[3]+e[3])),h(f(),e,t,i)}_clipTriangle(e,t,r){let i=[e,t,r];for(let n=0;n<4;++n){const e=i;i=[];for(let t=0;t<e.length;++t){const r=e[t],s=e[(t+1)%e.length];this._inside(s,n)?(this._inside(r,n)||i.push(this._intersect(r,s,n)),i.push(s)):this._inside(r,n)&&i.push(this._intersect(r,s,n))}}return i}}const N=[[0,1,3],[2,3,1],[1,5,2],[6,2,5],[5,4,6],[7,6,4],[4,0,7],[3,7,0],[3,2,7],[6,7,2],[4,5,0],[1,0,5]],V=u(),E=a(),W=g(),k=new I,K=new P,U=new x;export{P as DepthRangeFromRenderGeometries,O as depthRangeFromLayer,M as depthRangeFromScene,A as textureToDepth};
5
+ import{unpackFloatRGBA as e}from"../../../../core/floatRGBA.js";import{isSome as t,isNone as r}from"../../../../core/maybe.js";import i from"../../../../core/PooledArray.js";import{m as n,c as s}from"../../../../chunks/mat4.js";import{c as a}from"../../../../chunks/mat4f64.js";import{v as o}from"../../../../chunks/vec3.js";import{l as h}from"../../../../chunks/vec4.js";import{c as f}from"../../../../chunks/vec4f64.js";import{intersectsSphere as _,create as c,copy as l}from"../../../../geometry/support/frustum.js";import{c as u}from"../../../../chunks/sphere.js";import{maxScale as d}from"../../support/mathUtils.js";import{empty as g,union as m,set as p}from"./depthRange.js";import b from"./Octree.js";import{assert as w}from"./Util.js";const R=1e4,B=100,v=500,j=500,C=.1;function A(t,r,i){return e(r,t)*(i[1]-i[0])+i[0]}function M(e,t,r){if(t.size<R)return K.compute(e,t);const i=g();return r.forAll((t=>{t.isVisible&&m(i,O(e,t))})),i}function O(e,r){if(!r.isVisible)return;const i=g(),n=r.getSpatialQueryAccelerator();return t(n)?T(i,e,n):D(i,e,r.objects),i}function T(e,t,r){const i=t.eye,n=t.viewForward,s=t.frustum,a=e=>e.isVisible,o=r.objectCount;if(o<v)p(W,t.near,Math.min(e.near,t.far)),r.forEachInDepthRange(i,n,b.DepthOrder.FRONT_TO_BACK,W,((r,i)=>{S(e,t,r),W.far=e.near,i.setRange(W)}),s,a),p(W,Math.max(e.far,t.near),t.far),r.forEachInDepthRange(i,n,b.DepthOrder.BACK_TO_FRONT,W,((r,i)=>{S(e,t,r),W.near=e.far,i.setRange(W)}),s,a);else{const i=Math.max(Math.min(o,j),Math.ceil(o*C)),h=r.findClosest(n,b.DepthOrder.FRONT_TO_BACK,s,a,i),f=r.findClosest(n,b.DepthOrder.BACK_TO_FRONT,s,a,i);h&&f&&(F(e,t,h.boundingVolumeWorldSpace.bounds),F(e,t,f.boundingVolumeWorldSpace.bounds))}}function D(e,t,r){k.clear(),r.forAll((e=>{e.isVisible&&0!==e.geometryRecords.length&&k.add(e)})),k.empty||(k.sort(t),p(W,t.near,Math.min(e.near,t.far)),k.forEachInDepthRange(W,b.DepthOrder.FRONT_TO_BACK,((r,i)=>{i<e.near&&S(e,t,r)})),p(W,Math.max(e.far,t.near),t.far),k.forEachInDepthRange(W,b.DepthOrder.BACK_TO_FRONT,((t,r,i)=>{e.far=Math.max(e.far,i)})))}function S(e,t,r){if(!r.isVisible)return;if(!_(t.frustum,r.boundingVolumeWorldSpace.bounds))return;const i=r.transformation,s=E;r.geometryRecords.forEach((r=>{n(s,i,r.getShaderTransformation());const a=d(s);y(e,t,r.geometry.boundingInfo,s,a)}))}function y(e,t,i,n,s){if(r(i))return;const a=t.eye,h=t.viewForward;o(V,i.center,n);const f=h[0]*(V[0]-a[0])+h[1]*(V[1]-a[1])+h[2]*(V[2]-a[2]);if(V[3]=i.radius*s,!(f-V[3]>e.near&&f+V[3]<e.far)&&_(t.frustum,V))if(i.radius>B&&i.getChildren()){const r=i.getChildren();for(let i=0;i<8;++i)r[i]&&y(e,t,r[i],n,s)}else U.unionDepthRangeWithAABB(e,t.viewProjectionMatrix,n,i.bbMin,i.bbMax)}function F(e,t,r){const i=t.eye,n=t.viewForward,s=(r[0]-i[0])*n[0]+(r[1]-i[1])*n[1]+(r[2]-i[2])*n[2];e.near=Math.min(e.near,s-r[3]),e.far=Math.max(e.far,s+r[3])}class I{constructor(){this._items=new i({allocator:e=>e||{obj:null,distance:0,near:0,far:0},deallocator:e=>(e.obj=null,e.distance=0,e.near=0,e.far=0,e)})}get length(){return this._items.length}get empty(){return 0===this._items.length}clear(){this._items.clear()}add(e){this._items.pushNew().obj=e}sort(e){const t=e.eye,r=e.viewForward;this._items.forAll((e=>{const i=e.obj.boundingVolumeWorldSpace.bounds,n=(i[0]-t[0])*r[0]+(i[1]-t[1])*r[1]+(i[2]-t[2])*r[2];e.distance=n,e.near=n-i[3],e.far=n+i[3]})),this._items.sort(((e,t)=>e.distance-t.distance))}forEachInDepthRange(e,t,r){if(t===b.DepthOrder.FRONT_TO_BACK)for(let i=0;i<this._items.length;++i){const t=this._items.data[i];t.far<e.near||t.near>e.far||r(t.obj,t.near,t.far)}else for(let i=this._items.length-1;i>=0;--i){const t=this._items.data[i];t.far<e.near||t.near>e.far||r(t.obj,t.near,t.far)}}}class P{constructor(){this._view=a(),this._viewProj=a(),this._frustum=c(),this._geometries=[],this._near=[],this._far=[],this._nearCandidates=[],this._farCandidates=[],this._range={near:0,far:0},this._looseRange={near:0,far:0}}compute(e,t){this._reset(),s(this._view,e.viewMatrix),n(this._viewProj,e.projectionMatrix,this._view),l(this._frustum,e.frustum);const r=this._view,i=r[2],a=r[6],o=r[10],h=r[14],f=this._range;let _=0;if(t.forEach((e=>{if(!e.instanceParameters.visible)return;if(!e.castShadow)return;let t;e.hasShaderTransformation?(e.computeBoundingSphere(e.getShaderTransformation(),V,1),t=V):t=e.boundingSphere;const r=i*t[0]+a*t[1]+o*t[2]+h,n=r-t[3],s=r+t[3];this._geometries[_]=e,this._near[_]=-s,this._far[_]=-n,++_})),0===this._geometries.length)return f;for(let n=0;n<this._geometries.length;++n)this._near[n]>f.far&&(f.far=this._near[n]),this._near[n]>2&&this._far[n]<f.near&&(f.near=this._far[n]);const c=this._looseRange;c.near=Math.max(.5*f.near,2),c.far=2*f.far;let u=0,d=0;for(let n=0;n<this._geometries.length;++n)this._near[n]<f.near&&(this._near[n]>=c.near?f.near=this._near[n]:this._nearCandidates[u++]=n),this._far[n]>f.far&&(this._far[n]<=c.far?f.far=this._far[n]:this._farCandidates[d++]=n);if(0===this._nearCandidates.length&&0===this._farCandidates.length)return f;this._nearCandidates.sort(((e,t)=>this._near[e]<this._near[t]?-1:this._near[e]>this._near[t]?1:0)),this._farCandidates.sort(((e,t)=>this._far[e]<this._far[t]?1:this._far[e]>this._far[t]?-1:0));for(let n=0;n<this._nearCandidates.length;++n){const e=this._nearCandidates[n];if(this._near[e]<f.near){const t=this._geometries[e],r=t.boundingInfo;this._includeNearBoundingInfoRec(r,t.getShaderTransformation())}}for(let n=0;n<this._farCandidates.length;++n){const e=this._farCandidates[n];if(this._far[e]>f.far){const t=this._geometries[e],r=t.boundingInfo;this._includeFarBoundingInfoRec(r,t.getShaderTransformation())}}return f}_reset(){this._geometries.length=0,this._near.length=0,this._far.length=0,this._nearCandidates.length=0,this._farCandidates.length=0,this._range.near=Number.MAX_VALUE,this._range.far=-Number.MAX_VALUE}_includeNearBoundingInfoRec(e,t){if(r(e))return;const i=e.getCenter();o(V,i,t);const n=d(t),s=V[0],a=V[1],h=V[2],f=e.getBSRadius()*n,_=this._frustum;if(_[0][0]*s+_[0][1]*a+_[0][2]*h+_[0][3]>f||_[1][0]*s+_[1][1]*a+_[1][2]*h+_[1][3]>f||_[2][0]*s+_[2][1]*a+_[2][2]*h+_[2][3]>f||_[3][0]*s+_[3][1]*a+_[3][2]*h+_[3][3]>f)return;const c=this._view[2]*s+this._view[6]*a+this._view[10]*h+this._view[14],l=c+f;if(!(-(c-f)<2||-l>=this._range.near))if(-l>this._looseRange.near)this._range.near=-l;else{if(f>B){const r=e.getChildren();if(void 0!==r){for(let e=0;e<8;++e)void 0!==r[e]&&this._includeNearBoundingInfoRec(r[e],t);return}}U.unionDepthRangeWithAABB(this._range,this._viewProj,t,e.getBBMin(),e.getBBMax())}}_includeFarBoundingInfoRec(e,t){if(r(e))return;let i=e.getBSRadius();const n=e.getCenter();o(V,n,t);const s=d(t),a=V[0],h=V[1],f=V[2];i*=s;const _=this._frustum;if(_[0][0]*a+_[0][1]*h+_[0][2]*f+_[0][3]>i||_[1][0]*a+_[1][1]*h+_[1][2]*f+_[1][3]>i||_[2][0]*a+_[2][1]*h+_[2][2]*f+_[2][3]>i||_[3][0]*a+_[3][1]*h+_[3][2]*f+_[3][3]>i)return;const c=this._view[2]*a+this._view[6]*h+this._view[10]*f+this._view[14]-i;if(!(-c<=this._range.far))if(-c<this._looseRange.far)this._range.far=-c;else{if(i>B){const r=e.getChildren();if(void 0!==r){for(let e=0;e<8;++e)void 0!==r[e]&&this._includeFarBoundingInfoRec(r[e],t);return}}U.unionDepthRangeWithAABB(this._range,this._viewProj,t,e.getBBMin(),e.getBBMax())}}}class x{constructor(){this._modelViewProj=a(),this._clipPosition=[f(),f(),f(),f(),f(),f(),f(),f()]}unionDepthRangeWithAABB(e,t,r,i,s){const a=this._modelViewProj;n(a,t,r);let o=!1;for(let n=0;n<8;++n){const e=this._clipPosition[n],t=0===n||3===n||4===n||7===n?i[0]:s[0],r=0===n||1===n||4===n||5===n?i[1]:s[1],o=n<4?i[2]:s[2];e[0]=a[0]*t+a[4]*r+a[8]*o+a[12],e[1]=a[1]*t+a[5]*r+a[9]*o+a[13],e[2]=a[2]*t+a[6]*r+a[10]*o+a[14],e[3]=a[3]*t+a[7]*r+a[11]*o+a[15]}for(let n=0;n<12;++n){const t=this._clipPosition[N[n][0]],r=this._clipPosition[N[n][1]],i=this._clipPosition[N[n][2]],s=this._clipTriangle(t,r,i);let a=!0;for(let e=0;e<s.length;++e){if(s[e][3]>=2){a=!1;break}}if(!a){o=!0;for(let t=0;t<s.length;++t){const r=s[t][3];r<e.near&&(e.near=r),r>e.far&&(e.far=r)}}}return o}_inside(e,t){return 0===t?e[0]>=-e[3]:1===t?e[1]>=-e[3]:2===t?e[0]<=e[3]:3===t?e[1]<=e[3]:void w(!1)}_intersect(e,t,r){let i=0;return 0===r?i=(-e[3]-e[0])/(t[0]-e[0]+t[3]-e[3]):1===r?i=(-e[3]-e[1])/(t[1]-e[1]+t[3]-e[3]):2===r?i=(e[3]-e[0])/(t[0]-e[0]-t[3]+e[3]):3===r&&(i=(e[3]-e[1])/(t[1]-e[1]-t[3]+e[3])),h(f(),e,t,i)}_clipTriangle(e,t,r){let i=[e,t,r];for(let n=0;n<4;++n){const e=i;i=[];for(let t=0;t<e.length;++t){const r=e[t],s=e[(t+1)%e.length];this._inside(s,n)?(this._inside(r,n)||i.push(this._intersect(r,s,n)),i.push(s)):this._inside(r,n)&&i.push(this._intersect(r,s,n))}}return i}}const N=[[0,1,3],[2,3,1],[1,5,2],[6,2,5],[5,4,6],[7,6,4],[4,0,7],[3,7,0],[3,2,7],[6,7,2],[4,5,0],[1,0,5]],V=u(),E=a(),W=g(),k=new I,K=new P,U=new x;export{P as DepthRangeFromRenderGeometries,O as depthRangeFromLayer,M as depthRangeFromScene,A as textureToDepth};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{releaseMaybe as e}from"../../../../../core/maybe.js";import r from"../../../../../core/PooledArray.js";import{t,c as i}from"../../../../../chunks/mat3.js";import{c as s}from"../../../../../chunks/mat3f32.js";import{s as n}from"../../../../../chunks/vec3.js";import a from"../../../support/debugFlags.js";import{doublePrecisionRequiresObfuscation as o}from"../../core/shaderLibrary/util/DoublePrecision.glsl.js";import{TwoVectorPosition as d}from"../../core/util/TwoVectorPosition.js";import{EdgeDrawParameters as h}from"./EdgeShaderParameters.js";import{EdgeShaderTechnique as l}from"./EdgeShaderTechnique.js";import{EdgeShaderTechniqueConfiguration as c}from"./EdgeShaderTechniqueConfiguration.js";import{Transparency as u}from"./interfaces.js";import{EdgeUtilMode as _}from"../../shaders/sources/edgeRenderer/EdgeUtil.glsl.js";import{PrimitiveType as m}from"../../../../webgl/enums.js";const g=8,f=128,b={type:"uber",hasSlicePlane:!1,strokesTexture:null,legacy:!0,spherical:!0},T={solid:_.SOLID,sketch:_.SKETCH,uber:_.MIXED};class R{constructor(e,t,i){this._rctx=e,this._shaderTechniqueRepository=t,this._configuration=new c,this.refCount=0,this._renderables=new Set,this._sortedRenderables={[u.TRANSPARENT]:{[u.TRANSPARENT]:new r,[u.OPAQUE]:new r},[u.OPAQUE]:{[u.TRANSPARENT]:new r,[u.OPAQUE]:new r}},this._renderablesDirty=!1,this._drawParameters=new h,this._settings={...b,...i},this.key=R.getKey(this._settings.type,this._settings.hasSlicePlane,this._settings.legacy);const s=this._settings.strokesTexture.variants;this.writerSettings={variants:s,reducedPrecision:a.TESTS_DISABLE_OPTIMIZATIONS},this._configuration.legacy=this._settings.legacy,this._configuration.mode=T[this._settings.type],this._configuration.silhouette=!1,this._configuration.antialiasing=!!this._rctx.capabilities.blendMinMax,this._configuration.hasSlicePlane=this._settings.hasSlicePlane,this._configuration.doublePrecisionRequiresObfuscation=o(e),this._configuration.spherical=i.spherical}dispose(){this._technique=e(this._technique)}addRenderable(e){this._renderables.add(e),this._renderablesDirty=!0}removeRenderable(e){this._renderables.delete(e),this._renderablesDirty=!0}setRenderablesDirty(){this._renderablesDirty=!0}forEachRenderable(e,r){this._renderablesDirty&&this._sortRenderables(),this._sortedRenderables[r][u.TRANSPARENT].forAll(e),this._sortedRenderables[r][u.OPAQUE].forAll(e)}updateTechnique(e,r){return this._configuration.hasMultipassTerrain=!!e.multipassTerrain.enabled,this._configuration.cullAboveGround=!!e.multipassTerrain.cullAboveGround,this._configuration.silhouette=r,this._technique=this._shaderTechniqueRepository.releaseAndAcquire(l,this._configuration,this._technique),this._technique}bindRegularEdges(e,r){return this._lastOriginId=null,this._rctx.bindTechnique(this.updateTechnique(r,!1),e,r)}bindSilhouetteEdges(e,r){return this._lastOriginId=null,this._rctx.bindTechnique(this.updateTechnique(r,!0),e,r)}renderRegularEdges(e,r,t,i,s){this._render(e,r,r.regular.vao,t,i,s)}renderSilhouetteEdges(e,r,t,i,s){this._render(e,r,r.silhouette.vao,t,i,s)}_render(e,r,t,i,s,n){n>0&&(this._bindDraw(e,r,i,s),this._rctx.bindVAO(t),this._rctx.capabilities.instancing.drawArraysInstanced(m.TRIANGLE_FAN,0,4,n))}_bindDraw(e,r,s,a){if(this._drawParameters.componentDataTexture=r.components.buffer.textureBuffer.texture,this._drawParameters.strokesTexture=this._settings.strokesTexture,"origin"in r.transform)this._lastOriginId!==r.transform.origin.origin.id&&(e.setUniformMatrix4fv("localView",r.transform.origin.viewMatrix),this._lastOriginId=r.transform.origin.origin.id),e.setUniformMatrix4fv("model",r.transform.modelMatrix),this._drawParameters.slicePlaneLocalOrigin=r.transform.origin.origin.vec3;else{const e=new d(r.transform.position),s=t(A,i(A,r.transform.rotationScale));this._drawParameters.transformWorldFromModelTL=e.low,this._drawParameters.transformWorldFromModelTH=e.high,this._drawParameters.transformWorldFromModelRS=r.transform.rotationScale,this._drawParameters.transformNormalGlobalFromModel=s;const o=a.camera.viewInverseTransposeMatrix;n(this._drawParameters.slicePlaneLocalOrigin,o[3],o[7],o[11])}e.bindDraw(this._drawParameters,a,s)}_sortRenderables(){this._renderablesDirty=!1,this._sortedRenderables[u.TRANSPARENT][u.TRANSPARENT].clear(),this._sortedRenderables[u.TRANSPARENT][u.OPAQUE].clear(),this._sortedRenderables[u.OPAQUE][u.TRANSPARENT].clear(),this._sortedRenderables[u.OPAQUE][u.OPAQUE].clear(),this._renderables.forEach((e=>{e.objectTransparency!==u.INVISIBLE&&e.edgeTransparency!==u.INVISIBLE&&this._sortedRenderables[e.objectTransparency][e.edgeTransparency].push(e)}));const e=(e,r)=>"origin"in e.transform?"origin"in r.transform?e.transform.origin.origin.id<r.transform.origin.origin.id?-1:e.transform.origin.origin.id>r.transform.origin.origin.id?1:0:1:0;this._sortedRenderables[u.TRANSPARENT][u.TRANSPARENT].sort(e),this._sortedRenderables[u.TRANSPARENT][u.OPAQUE].sort(e),this._sortedRenderables[u.OPAQUE][u.TRANSPARENT].sort(e),this._sortedRenderables[u.OPAQUE][u.OPAQUE].sort(e)}static getKey(e,r,t){return`edges-t:${e}:${r}:${t}`}}const A=s();export{f as EXTENSION_LENGTH_OFFSET,R as EdgeRenderer,g as LINE_WIDTH_FRACTION_FACTOR};
5
+ import{releaseMaybe as e}from"../../../../../core/maybe.js";import r from"../../../../../core/PooledArray.js";import{t,e as i}from"../../../../../chunks/mat3.js";import{c as s}from"../../../../../chunks/mat3f32.js";import{s as n}from"../../../../../chunks/vec3.js";import a from"../../../support/debugFlags.js";import{doublePrecisionRequiresObfuscation as o}from"../../core/shaderLibrary/util/DoublePrecision.glsl.js";import{TwoVectorPosition as d}from"../../core/util/TwoVectorPosition.js";import{EdgeDrawParameters as h}from"./EdgeShaderParameters.js";import{EdgeShaderTechnique as l}from"./EdgeShaderTechnique.js";import{EdgeShaderTechniqueConfiguration as c}from"./EdgeShaderTechniqueConfiguration.js";import{Transparency as u}from"./interfaces.js";import{EdgeUtilMode as _}from"../../shaders/sources/edgeRenderer/EdgeUtil.glsl.js";import{PrimitiveType as m}from"../../../../webgl/enums.js";const g=8,f=128,b={type:"uber",hasSlicePlane:!1,strokesTexture:null,legacy:!0,spherical:!0},T={solid:_.SOLID,sketch:_.SKETCH,uber:_.MIXED};class R{constructor(e,t,i){this._rctx=e,this._shaderTechniqueRepository=t,this._configuration=new c,this.refCount=0,this._renderables=new Set,this._sortedRenderables={[u.TRANSPARENT]:{[u.TRANSPARENT]:new r,[u.OPAQUE]:new r},[u.OPAQUE]:{[u.TRANSPARENT]:new r,[u.OPAQUE]:new r}},this._renderablesDirty=!1,this._drawParameters=new h,this._settings={...b,...i},this.key=R.getKey(this._settings.type,this._settings.hasSlicePlane,this._settings.legacy);const s=this._settings.strokesTexture.variants;this.writerSettings={variants:s,reducedPrecision:a.TESTS_DISABLE_OPTIMIZATIONS},this._configuration.legacy=this._settings.legacy,this._configuration.mode=T[this._settings.type],this._configuration.silhouette=!1,this._configuration.antialiasing=!!this._rctx.capabilities.blendMinMax,this._configuration.hasSlicePlane=this._settings.hasSlicePlane,this._configuration.doublePrecisionRequiresObfuscation=o(e),this._configuration.spherical=i.spherical}dispose(){this._technique=e(this._technique)}addRenderable(e){this._renderables.add(e),this._renderablesDirty=!0}removeRenderable(e){this._renderables.delete(e),this._renderablesDirty=!0}setRenderablesDirty(){this._renderablesDirty=!0}forEachRenderable(e,r){this._renderablesDirty&&this._sortRenderables(),this._sortedRenderables[r][u.TRANSPARENT].forAll(e),this._sortedRenderables[r][u.OPAQUE].forAll(e)}updateTechnique(e,r){return this._configuration.hasMultipassTerrain=!!e.multipassTerrain.enabled,this._configuration.cullAboveGround=!!e.multipassTerrain.cullAboveGround,this._configuration.silhouette=r,this._technique=this._shaderTechniqueRepository.releaseAndAcquire(l,this._configuration,this._technique),this._technique}bindRegularEdges(e,r){return this._lastOriginId=null,this._rctx.bindTechnique(this.updateTechnique(r,!1),e,r)}bindSilhouetteEdges(e,r){return this._lastOriginId=null,this._rctx.bindTechnique(this.updateTechnique(r,!0),e,r)}renderRegularEdges(e,r,t,i,s){this._render(e,r,r.regular.vao,t,i,s)}renderSilhouetteEdges(e,r,t,i,s){this._render(e,r,r.silhouette.vao,t,i,s)}_render(e,r,t,i,s,n){n>0&&(this._bindDraw(e,r,i,s),this._rctx.bindVAO(t),this._rctx.capabilities.instancing.drawArraysInstanced(m.TRIANGLE_FAN,0,4,n))}_bindDraw(e,r,s,a){if(this._drawParameters.componentDataTexture=r.components.buffer.textureBuffer.texture,this._drawParameters.strokesTexture=this._settings.strokesTexture,"origin"in r.transform)this._lastOriginId!==r.transform.origin.origin.id&&(e.setUniformMatrix4fv("localView",r.transform.origin.viewMatrix),this._lastOriginId=r.transform.origin.origin.id),e.setUniformMatrix4fv("model",r.transform.modelMatrix),this._drawParameters.slicePlaneLocalOrigin=r.transform.origin.origin.vec3;else{const e=new d(r.transform.position),s=t(A,i(A,r.transform.rotationScale));this._drawParameters.transformWorldFromModelTL=e.low,this._drawParameters.transformWorldFromModelTH=e.high,this._drawParameters.transformWorldFromModelRS=r.transform.rotationScale,this._drawParameters.transformNormalGlobalFromModel=s;const o=a.camera.viewInverseTransposeMatrix;n(this._drawParameters.slicePlaneLocalOrigin,o[3],o[7],o[11])}e.bindDraw(this._drawParameters,a,s)}_sortRenderables(){this._renderablesDirty=!1,this._sortedRenderables[u.TRANSPARENT][u.TRANSPARENT].clear(),this._sortedRenderables[u.TRANSPARENT][u.OPAQUE].clear(),this._sortedRenderables[u.OPAQUE][u.TRANSPARENT].clear(),this._sortedRenderables[u.OPAQUE][u.OPAQUE].clear(),this._renderables.forEach((e=>{e.objectTransparency!==u.INVISIBLE&&e.edgeTransparency!==u.INVISIBLE&&this._sortedRenderables[e.objectTransparency][e.edgeTransparency].push(e)}));const e=(e,r)=>"origin"in e.transform?"origin"in r.transform?e.transform.origin.origin.id<r.transform.origin.origin.id?-1:e.transform.origin.origin.id>r.transform.origin.origin.id?1:0:1:0;this._sortedRenderables[u.TRANSPARENT][u.TRANSPARENT].sort(e),this._sortedRenderables[u.TRANSPARENT][u.OPAQUE].sort(e),this._sortedRenderables[u.OPAQUE][u.TRANSPARENT].sort(e),this._sortedRenderables[u.OPAQUE][u.OPAQUE].sort(e)}static getKey(e,r,t){return`edges-t:${e}:${r}:${t}`}}const A=s();export{f as EXTENSION_LENGTH_OFFSET,R as EdgeRenderer,g as LINE_WIDTH_FRACTION_FACTOR};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Accessor.js";import{equals as r,binaryIndexOf as s}from"../../../../../core/arrayUtils.js";import o from"../../../../../core/Logger.js";import{clamp as n}from"../../../../../core/mathUtils.js";import{disposeMaybe as i,destroyMaybe as a,isNone as c,isSome as d}from"../../../../../core/maybe.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{f as u,t as m,c as g}from"../../../../../chunks/mat3.js";import{c as p}from"../../../../../chunks/mat3f64.js";import{c as f}from"../../../../../chunks/mat4f64.js";import{s as _,c as b,y,e as j}from"../../../../../chunks/vec3.js";import{c as O}from"../../../../../chunks/vec3f64.js";import{WatchUpdatingTracking as w}from"../../../../../core/support/WatchUpdatingTracking.js";import{g as v,a as x}from"../../../../../chunks/sphere.js";import{c as R}from"../../../../../chunks/vec33.js";import{ViewingMode as E}from"../../../../ViewingMode.js";import{encodeElevationOffset as T}from"../../collections/Component/Material/shader/ComponentData.glsl.js";import{TwoVectorPosition as C}from"../../core/util/TwoVectorPosition.js";import{GridLocalOriginFactory as M}from"../GridLocalOriginFactory.js";import{applyToModelMatrix as D}from"../localOriginHelper.js";import{LocalOriginManager as P}from"../LocalOriginManager.js";import{Object3D as S}from"../Object3D.js";import{VertexArrayObject as A}from"../VertexArrayObject.js";import{VertexAttribute as B}from"../VertexAttribute.js";import{VertexLayout as k,EdgeShaderAttributeLocations as I,glVertexLayout as U,EdgeInputBufferLayout as L}from"./bufferLayouts.js";import{RegularEdgeBufferWriter as V,SilhouetteEdgeBufferWriter as H}from"./edgeBufferWriters.js";import{EdgeType as N}from"./edgePreprocessing.js";import{EdgeRenderer as z,LINE_WIDTH_FRACTION_FACTOR as W,EXTENSION_LENGTH_OFFSET as q}from"./EdgeRenderer.js";import{EdgePassParameters as G}from"./EdgeShaderParameters.js";import{EdgeWorkerHandle as K}from"./EdgeWorkerHandle.js";import{Transparency as F}from"./interfaces.js";import{generateStrokesTexture as Q}from"./strokes.js";import{determineRendererType as J,determineEdgeTransparency as X,determineObjectTransparency as Y,fillComponenBufferIndices as Z}from"./util.js";import{BufferManager as $}from"../TextureBackedBuffer/BufferManager.js";import{BufferObject as ee}from"../../../../webgl/BufferObject.js";import{Usage as te}from"../../../../webgl/enums.js";let re=class extends t{constructor(e){super(e),this._updatingHandles=new w,this._perObjectData=new Map,this._perObjectDataEvictionCache=new Set,this._renderers=new Map,this._gpuMemoryUsage=0,this._workerAbort=new AbortController,this._tmpModelPosition=O(),this._localOrigins=new P(new M(e.renderSR))}initialize(){this._worker=new K(this.schedule),this._componentColorManager=new $(this.rctx,3);const e=k.createBuffer(4);for(let t=0;t<4;t++)e.sideness.set(t,0,0===t||3===t?0:1),e.sideness.set(t,1,0===t||1===t?0:1);this._verticesBufferObject=ee.createVertex(this.rctx,te.STATIC_DRAW,e.buffer)}destroy(){this.destroyed||(this._perObjectData.forEach((e=>this._discardObjectEntry(e))),this._perObjectData.clear(),this._strokesTexture=i(this._strokesTexture),this._componentColorManager=a(this._componentColorManager),this._workerAbort.abort(),this._worker.destroy(),this._verticesBufferObject=i(this._verticesBufferObject),this._renderers.clear(),this._updatingHandles.destroy())}get updating(){return this._updatingHandles.updating}get usedMemory(){return this._gpuMemoryUsage}shouldRender(){return this._renderers.size>0}async addComponentObject(e,t,r,s,o,n,i,a){if(this.hasObject(e))return this.getObjectMemoryUsage(e);let c;const d=new ne(new Promise((e=>c=e)),r.center,r.radius);this._perObjectData.set(e,d);const l=await this._updatingHandles.addPromise(this._addComponentGeometry(t,d,s,o,n,i,a));return this.setNeedsRender(),c(),l}async addOrUpdateObject3D(e,t,r,s){if(this.destroyed)return void o.getLogger(this.declaredClass).warn("Attempt to add an object to a destroyed instance");const n=this._perObjectData.get(e);let i;n?.renderables.length>0&&this._perObjectDataEvictionCache.add(n);const a=e.boundingVolumeWorldSpace.bounds,c=new ne(new Promise((e=>i=e)),v(a),x(a));this._perObjectData.set(e,c);const d=new Array;if(r.mergeGeometries&&e.geometries.length>1&&oe(e))d.push(this._addObjectMergedGeometries(e,c,t,r,s));else for(let o=0;o<e.geometries.length;o++){const n=e.geometryRecords[o];if(!n.material.supportsEdges)continue;const i=e.geometries[o];d.push(this._addGeometry(e,c,i,n,t[0],r,s))}await this._updatingHandles.addPromise(Promise.all(d)),this._perObjectDataEvictionCache.delete(c),this._discardObjectEntry(n),this.setNeedsRender(),i()}_discardObjectEntry(e){e&&(e.renderables.length&&(e.renderables.forEach((e=>this._removeRenderable(e))),this.setNeedsRender()),e.loaded=null)}hasObject(e){return this._perObjectData.has(e)}async updateAllComponentOpacities(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));if(c(r))return;const s=t instanceof Array?e=>t[e]:()=>t;r.renderables.forEach((e=>{const t=e.components.meta.length;for(let r=0;r<t;r++){const t=s(r),o=e.components.meta[r],n=o.index;o.material.opacity=t,e.components.buffer.textureBuffer.setDataElement(n,1,3,255*t)}this._updateTransparency(e)})),this.setNeedsRender()}async getObjectMemoryUsage(e){const t=await this._getObjectEntry(e);return d(t)?t.renderables.reduce(((e,t)=>e+t.statistics.gpuMemoryUsage),0):0}async updateAllComponentMaterials(e,t,r,s){const o=e instanceof S,n=!!r.hasSlicePlane,i=J(t),a=z.getKey(i,n,o),d=await this._updatingHandles.addPromise(this._getObjectEntry(e));c(d)||(d.renderables.forEach((e=>{if(a!==e.rendererKey){const t=this._renderers.get(e.rendererKey),r=this._acquireRenderer(i,n,o);t.removeRenderable(e),--t.refCount,e.rendererKey=a,r.addRenderable(e)}for(let r=0;r<t.length;r++)e.components.meta[r].material=t[r];s&&this._updateComponentBuffer(e.components),this._updateTransparency(e)})),this.setNeedsRender())}async updateAllVerticalOffsets(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));c(r)||(r.renderables.forEach((e=>{const r=e.components.meta;for(let s=0;s<r.length;s++)e.components.meta[s].verticalOffset=t?.[s]??0;this._updateComponentBuffer(e.components)})),this.setNeedsRender())}async updateObjectVisibility(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));d(r)&&(r.renderables.forEach((e=>e.visible=t)),this.setNeedsRender())}removeObject(e){const t=this._perObjectData.get(e);t&&(this._perObjectData.delete(e),this._discardObjectEntry(t))}async _getObjectEntry(e){const t=this._perObjectData.get(e);if(!t)throw"no object";return await t.loaded,null==t.loaded?null:t}removeAll(){this._perObjectData.forEach(((e,t)=>this.removeObject(t)))}render(e,t){if(c(this._componentColorManager))return;this._localOrigins.updateViewMatrices(e.camera.viewMatrix);const r=e.camera.viewInverseTransposeMatrix,s=O(),o=new C;let n=0,i=0;if(this._renderers.forEach((r=>{if(0===r.refCount)this._renderers.delete(r.key),r.dispose();else{let s=!0,o=!0;r.forEachRenderable((t=>{t.visible&&(n+=t.statistics.averageEdgeLength,i++,s&&t.regular&&(r.updateTechnique(e,!1),s=!1),o&&t.silhouette&&(r.updateTechnique(e,!0),o=!1))}),t)}})),this._componentColorManager.garbageCollect(),this._componentColorManager.updateTextures(),0===i)return;const a=new G(40*n/i,t);_(s,r[3],r[7],r[11]),o.set(s),b(a.transformWorldFromViewTH,o.high),b(a.transformWorldFromViewTL,o.low),u(a.transformViewFromCameraRelativeRS,e.camera.viewMatrix),m(fe,a.transformViewFromCameraRelativeRS),g(a.transformNormalViewFromGlobal,fe),a.transformProjFromView=e.camera.projectionMatrix,this._updateObjectCameraDistances(e),this._renderers.forEach((t=>{this._renderRegularEdges(t,e,a),this._renderSilhouetteEdges(t,e,a)}))}_updateTransparency(e){const t=X(e.components.meta),r=Y(e.components.meta);t===e.edgeTransparency&&r===e.objectTransparency||(e.edgeTransparency=t,e.objectTransparency=r,this._renderers.get(e.rendererKey).setRenderablesDirty())}_computeModelTransformWithLocalOrigin(e,t,r){e.getCombinedStaticTransformation(t,r);const s=d(t.origin)?this._localOrigins.register(t.origin):this._localOrigins.acquire(_(this._tmpModelPosition,r[12],r[13],r[14]));return t.origin=s.origin,D(s.origin.vec3,r),s}_updateComponentBuffer(e){const{meta:t,buffer:r}=e,s=new Uint8Array(4);for(let o=0;o<t.length;o++){const e=t[o].material,i=t[o].index,a=n(Math.round(e.size*W),0,255),c=n(e.extensionLength,-q,255-q)+q,d="solid"===e.type?N.SOLID:N.SKETCH,l=255*e.opacity,h=e.color,u=255*h[0],m=255*h[1],g=255*h[2],p=255*h[3];r.textureBuffer.setData(i,0,u,m,g,p),r.textureBuffer.setData(i,1,a,c,d,l),T(t[o].verticalOffset,s),r.textureBuffer.setData(i,2,s[0],s[1],s[2],s[3])}}_createComponentBuffers(e){if(c(this._componentColorManager))return null;const t=new Array,r=this._componentColorManager.getBuffer(e.length);for(let o=0;o<e.length;o++){const s=e[o],n=r.acquireIndex();t.push({index:n,verticalOffset:0,material:s})}const s=new ie(r,t);return this._updateComponentBuffer(s),s}_extractEdges(e,t,r,s,o,n=o.length){return this._worker.process({data:t,indices:o,indicesLength:n,writerSettings:e,skipDeduplicate:r},this._workerAbort.signal,s)}_createRenderable(e,t,r,s,o){const n=d(this._verticesBufferObject)&&e.regular.lodInfo.lengths.length>0?new ae(new A(this.rctx,I,{vertices:U,instances:V.glLayout},{vertices:this._verticesBufferObject,instances:ee.createVertex(this.rctx,te.STATIC_DRAW,e.regular.instancesData.buffer)}),e.regular.lodInfo):null,i=d(this._verticesBufferObject)&&e.silhouette.lodInfo.lengths.length>0?new ae(new A(this.rctx,I,{vertices:U,instances:H.glLayout},{vertices:this._verticesBufferObject,instances:ee.createVertex(this.rctx,te.STATIC_DRAW,e.silhouette.instancesData.buffer)}),e.silhouette.lodInfo):null,a=(d(n)?n.vao.size:0)+(d(i)?i.vao.size:0);return new de(n,i,{gpuMemoryUsage:a,externalMemoryUsage:o,averageEdgeLength:e.averageEdgeLength},r,X(t.meta),Y(t.meta),t,s)}async _addGeometry(e,t,r,s,o,n,i){const a=r.vertexAttributes.get(B.POSITION),c=r.indices.get(B.POSITION),d=f(),l=this._computeModelTransformWithLocalOrigin(e,s,d),h=new pe(a,c,d,l);return this._addPositionData(t,h,r.edgeIndicesLength,o,n,i)}async _addPositionData(e,t,r,s,o,n=!1){if(null==e.loaded)return;const i=this._createComponentBuffers([s]);if(c(i)||r<=0)return;const a=this._acquireRenderer(s.type,!!o.hasSlicePlane,!0),{modelTransform:d,origin:l}=t,h=t.indices,u=t.position,m=u.data.length/u.size,g=L.createBuffer(m);for(let c=0;c<m;c++)g.position.set(c,0,u.data[c*u.size+0]),g.position.set(c,1,u.data[c*u.size+1]),g.position.set(c,2,u.data[c*u.size+2]);Z(i.meta,[0,g.componentIndex.count],g.componentIndex);const p=await this._updatingHandles.addPromise(this._extractEdges(a.writerSettings,g,!1,n,h,r));if(null==e.loaded)return;const f=this._createRenderable(p,i,new ce(d,l),a.key,!1);e.renderables.push(f),a.addRenderable(f),this._gpuMemoryUsage+=f.statistics.gpuMemoryUsage}async _addComponentGeometry(e,t,r,s,o,n,i){if(null==t.loaded)return 0;const a=this._createComponentBuffers(n);if(c(a))return 0;const d=J(n),l=this._acquireRenderer(d,i.hasSlicePlane||!1,!1),h=L.createBuffer(r.count);R(h.position,r),Z(a.meta,o,h.componentIndex,s);const u=!0,m=l.writerSettings,g=await this._updatingHandles.addPromise(this._extractEdges(m,h,u,!1,s));if(null==t.loaded)return 0;const p=this._createRenderable(g,a,e,l.key,!0);return t.renderables.push(p),l.addRenderable(p),p.statistics.gpuMemoryUsage}async _addObjectMergedGeometries(e,t,r,s,o){const n=new Map;let i=0,a=null,c=0;for(let f=0;f<e.geometries.length;f++){const t=e.geometries[f],r=e.geometryRecords[f];if(!r.material.supportsEdges)continue;!a&&r.origin&&(a=r);const s=t.vertexAttributes.get(B.POSITION);c+=s.data.length/s.size,i+=t.edgeIndicesLength}const d=c>=65536?Uint32Array:Uint16Array,l=i?new d(i):null,h=[];let u=0;for(let f=0;f<e.geometries.length;f++){const t=e.geometries[f];if(!e.geometryRecords[f].material.supportsEdges)continue;const r=t.vertexAttributes.get(B.POSITION),s=t.indices.get(B.POSITION);let o=n.get(r.data);if(null==o){o=h.length/3;for(let e=0;e<r.data.length;e+=r.size)h.push(r.data[e+0]),h.push(r.data[e+1]),h.push(r.data[e+2]);n.set(r.data,o)}if(s)for(let e=0;e<t.edgeIndicesLength;e++)l[u++]=o+s[e]}const m=a||e.geometryRecords[0],g=f(),p=this._computeModelTransformWithLocalOrigin(e,m,g);for(let f=0;f<e.geometryRecords.length;f++)e.geometryRecords[f].origin=p.origin;const _=new pe({data:h,size:3},l,g,p);await this._updatingHandles.addPromise(this._addPositionData(t,_,l.length,r[0],s,o))}_acquireRenderer(e,t,r){const s=z.getKey(e,t,r);let o=this._renderers.get(s);return c(this._strokesTexture)&&(this._strokesTexture=Q(this.rctx)),o||(o=new z(this.rctx,this.techniqueRepository,{type:e,hasSlicePlane:t,strokesTexture:this._strokesTexture,legacy:r,spherical:this.viewingMode===E.Global}),this._renderers.set(s,o)),++o.refCount,o}_removeRenderable(e){se(e);const t=this._renderers.get(e.rendererKey);if(t){t.removeRenderable(e),--t.refCount,"origin"in e.transform&&this._localOrigins.release(e.transform.origin),this._gpuMemoryUsage-=e.statistics.externalMemoryUsage?0:e.statistics.gpuMemoryUsage;for(const t of e.components.meta)e.components.buffer.releaseIndex(t.index)}}_updateObjectCameraDistances(e){const t=e.camera.eye,r=e.camera.viewForward,s=O(),o=e=>{y(s,e.center,t);const o=j(s,r),n=e.radius,i=o<-n?1/0:o<n?0:o-n;e.renderables.forEach((e=>e.distanceToCamera=i))};this._perObjectData.forEach(o),this._perObjectDataEvictionCache.forEach(o)}_renderRegularEdges(e,t,r){const s=e.bindRegularEdges(r,t),o=r.transparency,n=t.camera.perScreenPixelRatio;e.forEachRenderable((o=>{if(!he(o)||!o.visible)return;const i=ge(o.regular.lod.lengths,o.distanceToCamera,n);e.renderRegularEdges(s,o,r,t,i)}),o)}_renderSilhouetteEdges(e,t,r){const s=e.bindSilhouetteEdges(r,t),o=r.transparency,n=t.camera.perScreenPixelRatio;e.forEachRenderable((o=>{if(!me(o)||!o.visible)return;const i=ge(o.silhouette.lod.lengths,o.distanceToCamera,n);e.renderSilhouetteEdges(s,o,r,t,i)}),o)}get test(){return{hasRenderedPrimitives:e=>{let t=!1;const r=e.perScreenPixelRatio,s=(e,s)=>e.forEachRenderable((e=>{e.visible&&!t&&(he(e)&&(t=ge(e.regular.lod.lengths,e.distanceToCamera,r)>0),!t&&me(e)&&(t=ge(e.silhouette.lod.lengths,e.distanceToCamera,r)>0))}),s);return this._renderers.forEach((e=>{t||(s(e,F.OPAQUE),s(e,F.TRANSPARENT))})),t}}}};function se(e){d(e.regular)&&(e.regular.vao.vertexBuffers.instances.dispose(),e.regular.vao.dispose(!1),e.regular.vao=null),d(e.silhouette)&&(e.silhouette.vao.vertexBuffers.instances.dispose(),e.silhouette.vao.dispose(!1),e.silhouette.vao=null)}function oe(e){let t=null,s=null;for(let o=0;o<e.geometries.length;o++){const n=e.geometryRecords[o];if(n.material.supportsEdges){if(t){if(!r(t,n.transformation))return!1}else t=n.transformation;if(!s&&d(n.origin))s=n;else if(d(s?.origin)&&d(n.origin)&&s.origin.id!==n.origin.id)return!1}}return!0}e([l({constructOnly:!0})],re.prototype,"rctx",void 0),e([l({constructOnly:!0})],re.prototype,"renderSR",void 0),e([l({constructOnly:!0})],re.prototype,"viewingMode",void 0),e([l({constructOnly:!0})],re.prototype,"techniqueRepository",void 0),e([l({constructOnly:!0})],re.prototype,"setNeedsRender",void 0),e([l({constructOnly:!0})],re.prototype,"schedule",void 0),e([l({readOnly:!0})],re.prototype,"_updatingHandles",void 0),e([l({readOnly:!0})],re.prototype,"updating",null),re=e([h("esri.views.3d.webgl-engine.lib.edgeRendering.EdgeView")],re);class ne{constructor(e,t,r){this.center=t,this.radius=r,this.renderables=new Array,this.loaded=e,this.loaded.then((()=>{null!=this.loaded&&(this.loaded=!0)}))}}class ie{constructor(e,t){this.buffer=e,this.meta=t}}class ae{constructor(e,t){this.vao=e,this.lod=t}}class ce{constructor(e,t){this.modelMatrix=e,this.origin=t}}class de{constructor(e,t,r,s,o,n,i,a){this.regular=e,this.silhouette=t,this.statistics=r,this.transform=s,this.edgeTransparency=o,this.objectTransparency=n,this.components=i,this.rendererKey=a,this.distanceToCamera=0,this.visible=!0}}class le extends de{}function he(e){return d(e.regular)}class ue extends de{}function me(e){return d(e.silhouette)}function ge(e,t,r){const o=t*r,n=s(e,o,!0);return-1===n?o<e[0]?e.length:0:e.length-n}class pe{constructor(e,t,r,s){this.position=e,this.indices=t,this.modelTransform=r,this.origin=s}}const fe=p();export{re as EdgeView,ce as LegacyTransform,le as RegularRenderable,de as Renderable,ue as SilhouetteRenderable};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Accessor.js";import{equals as r,binaryIndexOf as s}from"../../../../../core/arrayUtils.js";import o from"../../../../../core/Logger.js";import{clamp as n}from"../../../../../core/mathUtils.js";import{disposeMaybe as i,destroyMaybe as a,isNone as c,isSome as d}from"../../../../../core/maybe.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{f as u,t as m,e as g}from"../../../../../chunks/mat3.js";import{c as p}from"../../../../../chunks/mat3f64.js";import{c as f}from"../../../../../chunks/mat4f64.js";import{s as _,c as b,p as y,e as j}from"../../../../../chunks/vec3.js";import{c as O}from"../../../../../chunks/vec3f64.js";import{WatchUpdatingTracking as w}from"../../../../../core/support/WatchUpdatingTracking.js";import{g as v,a as x}from"../../../../../chunks/sphere.js";import{c as R}from"../../../../../chunks/vec33.js";import{ViewingMode as E}from"../../../../ViewingMode.js";import{encodeElevationOffset as T}from"../../collections/Component/Material/shader/ComponentData.glsl.js";import{TwoVectorPosition as C}from"../../core/util/TwoVectorPosition.js";import{GridLocalOriginFactory as M}from"../GridLocalOriginFactory.js";import{applyToModelMatrix as D}from"../localOriginHelper.js";import{LocalOriginManager as P}from"../LocalOriginManager.js";import{Object3D as S}from"../Object3D.js";import{VertexArrayObject as A}from"../VertexArrayObject.js";import{VertexAttribute as B}from"../VertexAttribute.js";import{VertexLayout as k,EdgeShaderAttributeLocations as I,glVertexLayout as U,EdgeInputBufferLayout as L}from"./bufferLayouts.js";import{RegularEdgeBufferWriter as V,SilhouetteEdgeBufferWriter as H}from"./edgeBufferWriters.js";import{EdgeType as N}from"./edgePreprocessing.js";import{EdgeRenderer as z,LINE_WIDTH_FRACTION_FACTOR as W,EXTENSION_LENGTH_OFFSET as q}from"./EdgeRenderer.js";import{EdgePassParameters as G}from"./EdgeShaderParameters.js";import{EdgeWorkerHandle as K}from"./EdgeWorkerHandle.js";import{Transparency as F}from"./interfaces.js";import{generateStrokesTexture as Q}from"./strokes.js";import{determineRendererType as J,determineEdgeTransparency as X,determineObjectTransparency as Y,fillComponenBufferIndices as Z}from"./util.js";import{BufferManager as $}from"../TextureBackedBuffer/BufferManager.js";import{BufferObject as ee}from"../../../../webgl/BufferObject.js";import{Usage as te}from"../../../../webgl/enums.js";let re=class extends t{constructor(e){super(e),this._updatingHandles=new w,this._perObjectData=new Map,this._perObjectDataEvictionCache=new Set,this._renderers=new Map,this._gpuMemoryUsage=0,this._workerAbort=new AbortController,this._tmpModelPosition=O(),this._localOrigins=new P(new M(e.renderSR))}initialize(){this._worker=new K(this.schedule),this._componentColorManager=new $(this.rctx,3);const e=k.createBuffer(4);for(let t=0;t<4;t++)e.sideness.set(t,0,0===t||3===t?0:1),e.sideness.set(t,1,0===t||1===t?0:1);this._verticesBufferObject=ee.createVertex(this.rctx,te.STATIC_DRAW,e.buffer)}destroy(){this.destroyed||(this._perObjectData.forEach((e=>this._discardObjectEntry(e))),this._perObjectData.clear(),this._strokesTexture=i(this._strokesTexture),this._componentColorManager=a(this._componentColorManager),this._workerAbort.abort(),this._worker.destroy(),this._verticesBufferObject=i(this._verticesBufferObject),this._renderers.clear(),this._updatingHandles.destroy())}get updating(){return this._updatingHandles.updating}get usedMemory(){return this._gpuMemoryUsage}shouldRender(){return this._renderers.size>0}async addComponentObject(e,t,r,s,o,n,i,a){if(this.hasObject(e))return this.getObjectMemoryUsage(e);let c;const d=new ne(new Promise((e=>c=e)),r.center,r.radius);this._perObjectData.set(e,d);const l=await this._updatingHandles.addPromise(this._addComponentGeometry(t,d,s,o,n,i,a));return this.setNeedsRender(),c(),l}async addOrUpdateObject3D(e,t,r,s){if(this.destroyed)return void o.getLogger(this.declaredClass).warn("Attempt to add an object to a destroyed instance");const n=this._perObjectData.get(e);let i;n?.renderables.length>0&&this._perObjectDataEvictionCache.add(n);const a=e.boundingVolumeWorldSpace.bounds,c=new ne(new Promise((e=>i=e)),v(a),x(a));this._perObjectData.set(e,c);const d=new Array;if(r.mergeGeometries&&e.geometries.length>1&&oe(e))d.push(this._addObjectMergedGeometries(e,c,t,r,s));else for(let o=0;o<e.geometries.length;o++){const n=e.geometryRecords[o];if(!n.material.supportsEdges)continue;const i=e.geometries[o];d.push(this._addGeometry(e,c,i,n,t[0],r,s))}await this._updatingHandles.addPromise(Promise.all(d)),this._perObjectDataEvictionCache.delete(c),this._discardObjectEntry(n),this.setNeedsRender(),i()}_discardObjectEntry(e){e&&(e.renderables.length&&(e.renderables.forEach((e=>this._removeRenderable(e))),this.setNeedsRender()),e.loaded=null)}hasObject(e){return this._perObjectData.has(e)}async updateAllComponentOpacities(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));if(c(r))return;const s=t instanceof Array?e=>t[e]:()=>t;r.renderables.forEach((e=>{const t=e.components.meta.length;for(let r=0;r<t;r++){const t=s(r),o=e.components.meta[r],n=o.index;o.material.opacity=t,e.components.buffer.textureBuffer.setDataElement(n,1,3,255*t)}this._updateTransparency(e)})),this.setNeedsRender()}async getObjectMemoryUsage(e){const t=await this._getObjectEntry(e);return d(t)?t.renderables.reduce(((e,t)=>e+t.statistics.gpuMemoryUsage),0):0}async updateAllComponentMaterials(e,t,r,s){const o=e instanceof S,n=!!r.hasSlicePlane,i=J(t),a=z.getKey(i,n,o),d=await this._updatingHandles.addPromise(this._getObjectEntry(e));c(d)||(d.renderables.forEach((e=>{if(a!==e.rendererKey){const t=this._renderers.get(e.rendererKey),r=this._acquireRenderer(i,n,o);t.removeRenderable(e),--t.refCount,e.rendererKey=a,r.addRenderable(e)}for(let r=0;r<t.length;r++)e.components.meta[r].material=t[r];s&&this._updateComponentBuffer(e.components),this._updateTransparency(e)})),this.setNeedsRender())}async updateAllVerticalOffsets(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));c(r)||(r.renderables.forEach((e=>{const r=e.components.meta;for(let s=0;s<r.length;s++)e.components.meta[s].verticalOffset=t?.[s]??0;this._updateComponentBuffer(e.components)})),this.setNeedsRender())}async updateObjectVisibility(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));d(r)&&(r.renderables.forEach((e=>e.visible=t)),this.setNeedsRender())}removeObject(e){const t=this._perObjectData.get(e);t&&(this._perObjectData.delete(e),this._discardObjectEntry(t))}async _getObjectEntry(e){const t=this._perObjectData.get(e);if(!t)throw"no object";return await t.loaded,null==t.loaded?null:t}removeAll(){this._perObjectData.forEach(((e,t)=>this.removeObject(t)))}render(e,t){if(c(this._componentColorManager))return;this._localOrigins.updateViewMatrices(e.camera.viewMatrix);const r=e.camera.viewInverseTransposeMatrix,s=O(),o=new C;let n=0,i=0;if(this._renderers.forEach((r=>{if(0===r.refCount)this._renderers.delete(r.key),r.dispose();else{let s=!0,o=!0;r.forEachRenderable((t=>{t.visible&&(n+=t.statistics.averageEdgeLength,i++,s&&t.regular&&(r.updateTechnique(e,!1),s=!1),o&&t.silhouette&&(r.updateTechnique(e,!0),o=!1))}),t)}})),this._componentColorManager.garbageCollect(),this._componentColorManager.updateTextures(),0===i)return;const a=new G(40*n/i,t);_(s,r[3],r[7],r[11]),o.set(s),b(a.transformWorldFromViewTH,o.high),b(a.transformWorldFromViewTL,o.low),u(a.transformViewFromCameraRelativeRS,e.camera.viewMatrix),m(fe,a.transformViewFromCameraRelativeRS),g(a.transformNormalViewFromGlobal,fe),a.transformProjFromView=e.camera.projectionMatrix,this._updateObjectCameraDistances(e),this._renderers.forEach((t=>{this._renderRegularEdges(t,e,a),this._renderSilhouetteEdges(t,e,a)}))}_updateTransparency(e){const t=X(e.components.meta),r=Y(e.components.meta);t===e.edgeTransparency&&r===e.objectTransparency||(e.edgeTransparency=t,e.objectTransparency=r,this._renderers.get(e.rendererKey).setRenderablesDirty())}_computeModelTransformWithLocalOrigin(e,t,r){e.getCombinedStaticTransformation(t,r);const s=d(t.origin)?this._localOrigins.register(t.origin):this._localOrigins.acquire(_(this._tmpModelPosition,r[12],r[13],r[14]));return t.origin=s.origin,D(s.origin.vec3,r),s}_updateComponentBuffer(e){const{meta:t,buffer:r}=e,s=new Uint8Array(4);for(let o=0;o<t.length;o++){const e=t[o].material,i=t[o].index,a=n(Math.round(e.size*W),0,255),c=n(e.extensionLength,-q,255-q)+q,d="solid"===e.type?N.SOLID:N.SKETCH,l=255*e.opacity,h=e.color,u=255*h[0],m=255*h[1],g=255*h[2],p=255*h[3];r.textureBuffer.setData(i,0,u,m,g,p),r.textureBuffer.setData(i,1,a,c,d,l),T(t[o].verticalOffset,s),r.textureBuffer.setData(i,2,s[0],s[1],s[2],s[3])}}_createComponentBuffers(e){if(c(this._componentColorManager))return null;const t=new Array,r=this._componentColorManager.getBuffer(e.length);for(let o=0;o<e.length;o++){const s=e[o],n=r.acquireIndex();t.push({index:n,verticalOffset:0,material:s})}const s=new ie(r,t);return this._updateComponentBuffer(s),s}_extractEdges(e,t,r,s,o,n=o.length){return this._worker.process({data:t,indices:o,indicesLength:n,writerSettings:e,skipDeduplicate:r},this._workerAbort.signal,s)}_createRenderable(e,t,r,s,o){const n=d(this._verticesBufferObject)&&e.regular.lodInfo.lengths.length>0?new ae(new A(this.rctx,I,{vertices:U,instances:V.glLayout},{vertices:this._verticesBufferObject,instances:ee.createVertex(this.rctx,te.STATIC_DRAW,e.regular.instancesData.buffer)}),e.regular.lodInfo):null,i=d(this._verticesBufferObject)&&e.silhouette.lodInfo.lengths.length>0?new ae(new A(this.rctx,I,{vertices:U,instances:H.glLayout},{vertices:this._verticesBufferObject,instances:ee.createVertex(this.rctx,te.STATIC_DRAW,e.silhouette.instancesData.buffer)}),e.silhouette.lodInfo):null,a=(d(n)?n.vao.size:0)+(d(i)?i.vao.size:0);return new de(n,i,{gpuMemoryUsage:a,externalMemoryUsage:o,averageEdgeLength:e.averageEdgeLength},r,X(t.meta),Y(t.meta),t,s)}async _addGeometry(e,t,r,s,o,n,i){const a=r.vertexAttributes.get(B.POSITION),c=r.indices.get(B.POSITION),d=f(),l=this._computeModelTransformWithLocalOrigin(e,s,d),h=new pe(a,c,d,l);return this._addPositionData(t,h,r.edgeIndicesLength,o,n,i)}async _addPositionData(e,t,r,s,o,n=!1){if(null==e.loaded)return;const i=this._createComponentBuffers([s]);if(c(i)||r<=0)return;const a=this._acquireRenderer(s.type,!!o.hasSlicePlane,!0),{modelTransform:d,origin:l}=t,h=t.indices,u=t.position,m=u.data.length/u.size,g=L.createBuffer(m);for(let c=0;c<m;c++)g.position.set(c,0,u.data[c*u.size+0]),g.position.set(c,1,u.data[c*u.size+1]),g.position.set(c,2,u.data[c*u.size+2]);Z(i.meta,[0,g.componentIndex.count],g.componentIndex);const p=await this._updatingHandles.addPromise(this._extractEdges(a.writerSettings,g,!1,n,h,r));if(null==e.loaded)return;const f=this._createRenderable(p,i,new ce(d,l),a.key,!1);e.renderables.push(f),a.addRenderable(f),this._gpuMemoryUsage+=f.statistics.gpuMemoryUsage}async _addComponentGeometry(e,t,r,s,o,n,i){if(null==t.loaded)return 0;const a=this._createComponentBuffers(n);if(c(a))return 0;const d=J(n),l=this._acquireRenderer(d,i.hasSlicePlane||!1,!1),h=L.createBuffer(r.count);R(h.position,r),Z(a.meta,o,h.componentIndex,s);const u=!0,m=l.writerSettings,g=await this._updatingHandles.addPromise(this._extractEdges(m,h,u,!1,s));if(null==t.loaded)return 0;const p=this._createRenderable(g,a,e,l.key,!0);return t.renderables.push(p),l.addRenderable(p),p.statistics.gpuMemoryUsage}async _addObjectMergedGeometries(e,t,r,s,o){const n=new Map;let i=0,a=null,c=0;for(let f=0;f<e.geometries.length;f++){const t=e.geometries[f],r=e.geometryRecords[f];if(!r.material.supportsEdges)continue;!a&&r.origin&&(a=r);const s=t.vertexAttributes.get(B.POSITION);c+=s.data.length/s.size,i+=t.edgeIndicesLength}const d=c>=65536?Uint32Array:Uint16Array,l=i?new d(i):null,h=[];let u=0;for(let f=0;f<e.geometries.length;f++){const t=e.geometries[f];if(!e.geometryRecords[f].material.supportsEdges)continue;const r=t.vertexAttributes.get(B.POSITION),s=t.indices.get(B.POSITION);let o=n.get(r.data);if(null==o){o=h.length/3;for(let e=0;e<r.data.length;e+=r.size)h.push(r.data[e+0]),h.push(r.data[e+1]),h.push(r.data[e+2]);n.set(r.data,o)}if(s)for(let e=0;e<t.edgeIndicesLength;e++)l[u++]=o+s[e]}const m=a||e.geometryRecords[0],g=f(),p=this._computeModelTransformWithLocalOrigin(e,m,g);for(let f=0;f<e.geometryRecords.length;f++)e.geometryRecords[f].origin=p.origin;const _=new pe({data:h,size:3},l,g,p);await this._updatingHandles.addPromise(this._addPositionData(t,_,l.length,r[0],s,o))}_acquireRenderer(e,t,r){const s=z.getKey(e,t,r);let o=this._renderers.get(s);return c(this._strokesTexture)&&(this._strokesTexture=Q(this.rctx)),o||(o=new z(this.rctx,this.techniqueRepository,{type:e,hasSlicePlane:t,strokesTexture:this._strokesTexture,legacy:r,spherical:this.viewingMode===E.Global}),this._renderers.set(s,o)),++o.refCount,o}_removeRenderable(e){se(e);const t=this._renderers.get(e.rendererKey);if(t){t.removeRenderable(e),--t.refCount,"origin"in e.transform&&this._localOrigins.release(e.transform.origin),this._gpuMemoryUsage-=e.statistics.externalMemoryUsage?0:e.statistics.gpuMemoryUsage;for(const t of e.components.meta)e.components.buffer.releaseIndex(t.index)}}_updateObjectCameraDistances(e){const t=e.camera.eye,r=e.camera.viewForward,s=O(),o=e=>{y(s,e.center,t);const o=j(s,r),n=e.radius,i=o<-n?1/0:o<n?0:o-n;e.renderables.forEach((e=>e.distanceToCamera=i))};this._perObjectData.forEach(o),this._perObjectDataEvictionCache.forEach(o)}_renderRegularEdges(e,t,r){const s=e.bindRegularEdges(r,t),o=r.transparency,n=t.camera.perScreenPixelRatio;e.forEachRenderable((o=>{if(!he(o)||!o.visible)return;const i=ge(o.regular.lod.lengths,o.distanceToCamera,n);e.renderRegularEdges(s,o,r,t,i)}),o)}_renderSilhouetteEdges(e,t,r){const s=e.bindSilhouetteEdges(r,t),o=r.transparency,n=t.camera.perScreenPixelRatio;e.forEachRenderable((o=>{if(!me(o)||!o.visible)return;const i=ge(o.silhouette.lod.lengths,o.distanceToCamera,n);e.renderSilhouetteEdges(s,o,r,t,i)}),o)}get test(){return{hasRenderedPrimitives:e=>{let t=!1;const r=e.perScreenPixelRatio,s=(e,s)=>e.forEachRenderable((e=>{e.visible&&!t&&(he(e)&&(t=ge(e.regular.lod.lengths,e.distanceToCamera,r)>0),!t&&me(e)&&(t=ge(e.silhouette.lod.lengths,e.distanceToCamera,r)>0))}),s);return this._renderers.forEach((e=>{t||(s(e,F.OPAQUE),s(e,F.TRANSPARENT))})),t}}}};function se(e){d(e.regular)&&(e.regular.vao.vertexBuffers.instances.dispose(),e.regular.vao.dispose(!1),e.regular.vao=null),d(e.silhouette)&&(e.silhouette.vao.vertexBuffers.instances.dispose(),e.silhouette.vao.dispose(!1),e.silhouette.vao=null)}function oe(e){let t=null,s=null;for(let o=0;o<e.geometries.length;o++){const n=e.geometryRecords[o];if(n.material.supportsEdges){if(t){if(!r(t,n.transformation))return!1}else t=n.transformation;if(!s&&d(n.origin))s=n;else if(d(s?.origin)&&d(n.origin)&&s.origin.id!==n.origin.id)return!1}}return!0}e([l({constructOnly:!0})],re.prototype,"rctx",void 0),e([l({constructOnly:!0})],re.prototype,"renderSR",void 0),e([l({constructOnly:!0})],re.prototype,"viewingMode",void 0),e([l({constructOnly:!0})],re.prototype,"techniqueRepository",void 0),e([l({constructOnly:!0})],re.prototype,"setNeedsRender",void 0),e([l({constructOnly:!0})],re.prototype,"schedule",void 0),e([l({readOnly:!0})],re.prototype,"_updatingHandles",void 0),e([l({readOnly:!0})],re.prototype,"updating",null),re=e([h("esri.views.3d.webgl-engine.lib.edgeRendering.EdgeView")],re);class ne{constructor(e,t,r){this.center=t,this.radius=r,this.renderables=new Array,this.loaded=e,this.loaded.then((()=>{null!=this.loaded&&(this.loaded=!0)}))}}class ie{constructor(e,t){this.buffer=e,this.meta=t}}class ae{constructor(e,t){this.vao=e,this.lod=t}}class ce{constructor(e,t){this.modelMatrix=e,this.origin=t}}class de{constructor(e,t,r,s,o,n,i,a){this.regular=e,this.silhouette=t,this.statistics=r,this.transform=s,this.edgeTransparency=o,this.objectTransparency=n,this.components=i,this.rendererKey=a,this.distanceToCamera=0,this.visible=!0}}class le extends de{}function he(e){return d(e.regular)}class ue extends de{}function me(e){return d(e.silhouette)}function ge(e,t,r){const o=t*r,n=s(e,o,!0);return-1===n?o<e[0]?e.length:0:e.length-n}class pe{constructor(e,t,r,s){this.position=e,this.indices=t,this.modelTransform=r,this.origin=s}}const fe=p();export{re as EdgeView,ce as LegacyTransform,le as RegularRenderable,de as Renderable,ue as SilhouetteRenderable};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{range as e}from"../../../../../core/arrayUtils.js";import{deg2rad as t,acosClamped as n}from"../../../../../core/mathUtils.js";import{forEach as o}from"../../../../../core/typedArrayUtil.js";import{i as r,s,c,e as a,r as i,f as l,b as f,n as g}from"../../../../../chunks/vec3.js";import{c as m}from"../../../../../chunks/vec3f64.js";const p=-1;var u;function h(n,i,l,f=N){const g=n.vertices.position,m=n.vertices.componentIndex,u=t(f.anglePlanar),h=t(f.angleSignificantEdge),V=Math.cos(h),S=Math.cos(u),j=I.edge,x=j.position0,E=j.position1,D=j.faceNormal0,F=j.faceNormal1,L=y(n),U=w(n),b=U.length/4,k=i.allocate(b);let C=0;const H=b,K=l.allocate(H);let M=0,O=0,P=0;const T=e(0,b),q=new Float32Array(b);o(q,((e,t,n)=>{g.getVec(U[4*t+0],x),g.getVec(U[4*t+1],E),n[t]=r(x,E)})),T.sort(((e,t)=>q[t]-q[e]));const z=new Array,B=new Array;for(let e=0;e<b;e++){const t=T[e],n=q[t],o=U[4*t+0],r=U[4*t+1],f=U[4*t+2],h=U[4*t+3],w=h===p;if(g.getVec(o,x),g.getVec(r,E),w)s(D,L[3*f+0],L[3*f+1],L[3*f+2]),c(F,D),j.componentIndex=m.get(o),j.cosAngle=a(D,F);else{if(s(D,L[3*f+0],L[3*f+1],L[3*f+2]),s(F,L[3*h+0],L[3*h+1],L[3*h+2]),j.componentIndex=m.get(o),j.cosAngle=a(D,F),A(j,S))continue;j.cosAngle<-.9999&&c(F,D)}O+=n,P++,w||v(j,V)?(i.write(k,C++,j),z.push(n)):d(j,u)&&(l.write(K,M++,j),B.push(n))}const G=new Float32Array(z.reverse()),J=new Float32Array(B.reverse());return{regular:{instancesData:i.trim(k,C),lodInfo:{lengths:G}},silhouette:{instancesData:l.trim(K,M),lodInfo:{lengths:J}},averageEdgeLength:O/P}}function v(e,t){return e.cosAngle<t}function A(e,t){return e.cosAngle>t}function d(e,t){const o=n(e.cosAngle),r=I.fwd,s=I.ortho;i(r,e.position1,e.position0);return o*(a(l(s,e.faceNormal0,e.faceNormal1),r)>0?-1:1)>t}function w(e){const t=e.faces.length/3,n=e.faces,o=e.neighbors;let r=0;for(let a=0;a<t;a++){const e=o[3*a+0],t=o[3*a+1],s=o[3*a+2],c=n[3*a+0],i=n[3*a+1],l=n[3*a+2];r+=e===p||c<i?1:0,r+=t===p||i<l?1:0,r+=s===p||l<c?1:0}const s=new Int32Array(4*r);let c=0;for(let a=0;a<t;a++){const e=o[3*a+0],t=o[3*a+1],r=o[3*a+2],i=n[3*a+0],l=n[3*a+1],f=n[3*a+2];(e===p||i<l)&&(s[c++]=i,s[c++]=l,s[c++]=a,s[c++]=e),(t===p||l<f)&&(s[c++]=l,s[c++]=f,s[c++]=a,s[c++]=t),(r===p||f<i)&&(s[c++]=f,s[c++]=i,s[c++]=a,s[c++]=r)}return s}function y(e){const t=e.faces.length/3,n=e.vertices.position,o=e.faces,r=V.v0,s=V.v1,c=V.v2,a=new Float32Array(3*t);for(let i=0;i<t;i++){const e=o[3*i+0],t=o[3*i+1],m=o[3*i+2];n.getVec(e,r),n.getVec(t,s),n.getVec(m,c),f(s,s,r),f(c,c,r),l(r,s,c),g(r,r),a[3*i+0]=r[0],a[3*i+1]=r[1],a[3*i+2]=r[2]}return a}!function(e){e[e.SOLID=0]="SOLID",e[e.SKETCH=1]="SKETCH"}(u||(u={}));const I={edge:{position0:m(),position1:m(),faceNormal0:m(),faceNormal1:m(),componentIndex:0,cosAngle:0},ortho:m(),fwd:m()},V={v0:m(),v1:m(),v2:m()},N={anglePlanar:4,angleSignificantEdge:35};export{u as EdgeType,h as extractEdges};
5
+ import{range as e}from"../../../../../core/arrayUtils.js";import{deg2rad as t,acosClamped as n}from"../../../../../core/mathUtils.js";import{forEach as o}from"../../../../../core/typedArrayUtil.js";import{i as r,s,c,e as a,A as i,f as l,b as f,n as g}from"../../../../../chunks/vec3.js";import{c as m}from"../../../../../chunks/vec3f64.js";const p=-1;var u;function h(n,i,l,f=N){const g=n.vertices.position,m=n.vertices.componentIndex,u=t(f.anglePlanar),h=t(f.angleSignificantEdge),V=Math.cos(h),S=Math.cos(u),j=I.edge,x=j.position0,E=j.position1,D=j.faceNormal0,F=j.faceNormal1,L=y(n),U=w(n),b=U.length/4,k=i.allocate(b);let C=0;const H=b,K=l.allocate(H);let M=0,O=0,P=0;const T=e(0,b),q=new Float32Array(b);o(q,((e,t,n)=>{g.getVec(U[4*t+0],x),g.getVec(U[4*t+1],E),n[t]=r(x,E)})),T.sort(((e,t)=>q[t]-q[e]));const z=new Array,B=new Array;for(let e=0;e<b;e++){const t=T[e],n=q[t],o=U[4*t+0],r=U[4*t+1],f=U[4*t+2],h=U[4*t+3],w=h===p;if(g.getVec(o,x),g.getVec(r,E),w)s(D,L[3*f+0],L[3*f+1],L[3*f+2]),c(F,D),j.componentIndex=m.get(o),j.cosAngle=a(D,F);else{if(s(D,L[3*f+0],L[3*f+1],L[3*f+2]),s(F,L[3*h+0],L[3*h+1],L[3*h+2]),j.componentIndex=m.get(o),j.cosAngle=a(D,F),v(j,S))continue;j.cosAngle<-.9999&&c(F,D)}O+=n,P++,w||A(j,V)?(i.write(k,C++,j),z.push(n)):d(j,u)&&(l.write(K,M++,j),B.push(n))}const G=new Float32Array(z.reverse()),J=new Float32Array(B.reverse());return{regular:{instancesData:i.trim(k,C),lodInfo:{lengths:G}},silhouette:{instancesData:l.trim(K,M),lodInfo:{lengths:J}},averageEdgeLength:O/P}}function A(e,t){return e.cosAngle<t}function v(e,t){return e.cosAngle>t}function d(e,t){const o=n(e.cosAngle),r=I.fwd,s=I.ortho;i(r,e.position1,e.position0);return o*(a(l(s,e.faceNormal0,e.faceNormal1),r)>0?-1:1)>t}function w(e){const t=e.faces.length/3,n=e.faces,o=e.neighbors;let r=0;for(let a=0;a<t;a++){const e=o[3*a+0],t=o[3*a+1],s=o[3*a+2],c=n[3*a+0],i=n[3*a+1],l=n[3*a+2];r+=e===p||c<i?1:0,r+=t===p||i<l?1:0,r+=s===p||l<c?1:0}const s=new Int32Array(4*r);let c=0;for(let a=0;a<t;a++){const e=o[3*a+0],t=o[3*a+1],r=o[3*a+2],i=n[3*a+0],l=n[3*a+1],f=n[3*a+2];(e===p||i<l)&&(s[c++]=i,s[c++]=l,s[c++]=a,s[c++]=e),(t===p||l<f)&&(s[c++]=l,s[c++]=f,s[c++]=a,s[c++]=t),(r===p||f<i)&&(s[c++]=f,s[c++]=i,s[c++]=a,s[c++]=r)}return s}function y(e){const t=e.faces.length/3,n=e.vertices.position,o=e.faces,r=V.v0,s=V.v1,c=V.v2,a=new Float32Array(3*t);for(let i=0;i<t;i++){const e=o[3*i+0],t=o[3*i+1],m=o[3*i+2];n.getVec(e,r),n.getVec(t,s),n.getVec(m,c),f(s,s,r),f(c,c,r),l(r,s,c),g(r,r),a[3*i+0]=r[0],a[3*i+1]=r[1],a[3*i+2]=r[2]}return a}!function(e){e[e.SOLID=0]="SOLID",e[e.SKETCH=1]="SKETCH"}(u||(u={}));const I={edge:{position0:m(),position1:m(),faceNormal0:m(),faceNormal1:m(),componentIndex:0,cosAngle:0},ortho:m(),fwd:m()},V={v0:m(),v1:m(),v2:m()},N={anglePlanar:4,angleSignificantEdge:35};export{u as EdgeType,h as extractEdges};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../../core/Evented.js";import{f as e,c as s,t as i}from"../../../../../chunks/mat3.js";import{c as a}from"../../../../../chunks/mat3f64.js";import{m as r}from"../../../../../chunks/mat4.js";import{c as o}from"../../../../../chunks/mat4f64.js";import{s as n}from"../../../../../chunks/vec3.js";import{c as h}from"../../../../../chunks/vec3f64.js";import{BufferViewMat4f64 as l,BufferViewVec3f64 as c,BufferViewMat3f as f,BufferViewVec2f as m,BufferViewVec4f64 as g,BufferViewVec4f as d,BufferViewUint8 as _,BufferViewVec4u8 as T}from"../../../../../geometry/support/buffer/BufferView.js";import{scaleFromMatrix as u}from"../../../support/mathUtils.js";import{newLayout as L}from"../../../support/buffer/InterleavedLayout.js";import{assert as A}from"../Util.js";import{VertexAttribute as E}from"../VertexAttribute.js";var O;function F(t){let e=L().mat4f64(E.LOCALTRANSFORM).mat4f64(E.GLOBALTRANSFORM).vec4f64(E.BOUNDINGSPHERE).vec3f64(E.MODELORIGIN).mat3f(E.MODEL).mat3f(E.MODELNORMAL).vec2f(E.MODELSCALEFACTORS);return t.includes("color")&&(e=e.vec4f(E.COLOR)),t.includes("featureAttribute")&&(e=e.vec4f(E.FEATUREATTRIBUTE)),e=e.u8(E.STATE).u8(E.LODLEVEL),t.includes(E.OBJECTANDLAYERIDCOLOR)&&(e=e.vec4u8(E.OBJECTANDLAYERIDCOLOR)),e.alignTo(8),e}!function(t){t[t.ALLOCATED=1]="ALLOCATED",t[t.DEFAULT_ACTIVE=2]="DEFAULT_ACTIVE",t[t.VISIBLE=4]="VISIBLE",t[t.HIGHLIGHT=8]="HIGHLIGHT",t[t.HIGHLIGHT_ACTIVE=16]="HIGHLIGHT_ACTIVE",t[t.REMOVE=32]="REMOVE",t[t.TRANSFORM_CHANGED=64]="TRANSFORM_CHANGED",t[t.ACTIVE=18]="ACTIVE"}(O||(O={}));class v{constructor(t){this.localTransform=t.getField(E.LOCALTRANSFORM,l),this.globalTransform=t.getField(E.GLOBALTRANSFORM,l),this.modelOrigin=t.getField(E.MODELORIGIN,c),this.model=t.getField(E.MODEL,f),this.modelNormal=t.getField(E.MODELNORMAL,f),this.modelScaleFactors=t.getField(E.MODELSCALEFACTORS,m),this.boundingSphere=t.getField(E.BOUNDINGSPHERE,g),this.color=t.getField(E.COLOR,d),this.featureAttribute=t.getField(E.FEATUREATTRIBUTE,d),this.state=t.getField(E.STATE,_),this.lodLevel=t.getField(E.LODLEVEL,_),this.objectAndLayerIdColor=t.getField(E.OBJECTANDLAYERIDCOLOR,T)}}class M extends t{constructor(t,e){super(),this._capacity=0,this._size=0,this._next=0,this._buffer=null,this._view=null,this._layout=F(t),this._shaderTransformation=e}get capacity(){return this._capacity}get size(){return this._size}get buffer(){return this._buffer.buffer}get view(){return this._view}addInstance(){this._size+1>this._capacity&&this._grow();const t=this._findSlot();return this._view.state.set(t,O.ALLOCATED),this._size++,this.emit("instance-added",{index:t}),t}removeInstance(t){const e=this._view.state;A(t>=0&&t<this._capacity&&e.get(t)&O.ALLOCATED,"invalid instance handle"),this._getStateFlag(t,O.ACTIVE)?this._setStateFlags(t,O.REMOVE):this.freeInstance(t),this.emit("instance-removed",{index:t})}freeInstance(t){const e=this._view.state;A(t>=0&&t<this._capacity&&e.get(t)&O.ALLOCATED,"invalid instance handle"),e.set(t,0),this._size--}setLocalTransform(t,e,s=!0){this._view.localTransform.setMat(t,e),s&&this.updateModelTransform(t)}getLocalTransform(t,e){this._view.localTransform.getMat(t,e)}setGlobalTransform(t,e,s=!0){this._view.globalTransform.setMat(t,e),s&&this.updateModelTransform(t)}getGlobalTransform(t,e){this._view.globalTransform.getMat(t,e)}updateModelTransform(t){const a=this._view,o=C,h=b;a.localTransform.getMat(t,R),a.globalTransform.getMat(t,w);const l=r(w,w,R);n(o,l[12],l[13],l[14]),a.modelOrigin.setVec(t,o),e(h,l),a.model.setMat(t,h);const c=u(C,l);c.sort(),a.modelScaleFactors.set(t,0,c[1]),a.modelScaleFactors.set(t,1,c[2]),s(h,h),i(h,h),a.modelNormal.setMat(t,h),this._setStateFlags(t,O.TRANSFORM_CHANGED),this.emit("instance-transform-changed",{index:t})}getModelTransform(t,e){const s=this._view;s.model.getMat(t,b),s.modelOrigin.getVec(t,C),e[0]=b[0],e[1]=b[1],e[2]=b[2],e[3]=0,e[4]=b[3],e[5]=b[4],e[6]=b[5],e[7]=0,e[8]=b[6],e[9]=b[7],e[10]=b[8],e[11]=0,e[12]=C[0],e[13]=C[1],e[14]=C[2],e[15]=1}applyShaderTransformation(t,e){this._shaderTransformation&&this._shaderTransformation.applyTransform(this,t,e)}getCombinedModelTransform(t,e){return this.getModelTransform(t,e),this._shaderTransformation&&this._shaderTransformation.applyTransform(this,t,e),e}getCombinedLocalTransform(t,e){return this._view.localTransform.getMat(t,e),this._shaderTransformation&&this._shaderTransformation.applyTransform(this,t,e),e}getCombinedMaxScaleFactor(t){let e=this._view.modelScaleFactors.get(t,1);if(this._shaderTransformation){const s=this._shaderTransformation.scaleFactor(C,this,t);e*=Math.max(s[0],s[1],s[2])}return e}getCombinedMedianScaleFactor(t){let e=this._view.modelScaleFactors.get(t,0);if(this._shaderTransformation){const s=this._shaderTransformation.scaleFactor(C,this,t);e*=I(s[0],s[1],s[2])}return e}getModel(t,e){this._view.model.getMat(t,e)}setFeatureAttribute(t,e){this._view.featureAttribute.setVec(t,e)}getFeatureAttribute(t,e){this._view.featureAttribute.getVec(t,e)}setColor(t,e){this._view.color.setVec(t,e)}setObjectAndLayerIdColor(t,e){this._view.objectAndLayerIdColor.setVec(t,e)}getColor(t,e){this._view.color.getVec(t,e)}setVisible(t,e){e!==this.getVisible(t)&&(this._setStateFlag(t,O.VISIBLE,e),this.emit("instance-visibility-changed",{index:t}))}getVisible(t){return this._getStateFlag(t,O.VISIBLE)}setHighlight(t,e){e!==this.getHighlight(t)&&(this._setStateFlag(t,O.HIGHLIGHT,e),this.emit("instance-highlight-changed",{index:t}))}getHighlight(t){return this._getStateFlag(t,O.HIGHLIGHT)}getState(t){return this._view.state.get(t)}getLodLevel(t){return this._view.lodLevel.get(t)}countFlags(t){let e=0;for(let s=0;s<this._capacity;++s){this.getState(s)&t&&++e}return e}_setStateFlags(t,e){const s=this._view.state;e=s.get(t)|e,s.set(t,e)}_clearStateFlags(t,e){const s=this._view.state;e=s.get(t)&~e,s.set(t,e)}_setStateFlag(t,e,s){s?this._setStateFlags(t,e):this._clearStateFlags(t,e)}_getStateFlag(t,e){return!!(this._view.state.get(t)&e)}_grow(){const t=Math.max(S,Math.floor(this._capacity*p)),e=this._layout.createBuffer(t);if(this._buffer){const t=new Uint8Array(this._buffer.buffer);new Uint8Array(e.buffer).set(t)}this._capacity=t,this._buffer=e,this._view=new v(this._buffer)}_findSlot(){const t=this._view.state;let e=this._next;for(;t.get(e)&O.ALLOCATED;)e=e+1===this._capacity?0:e+1;return this._next=e+1===this._capacity?0:e+1,e}}function I(t,e,s){return Math.max(Math.min(t,e),Math.min(Math.max(t,e),s))}const S=1024,p=2,C=h(),b=a(),R=o(),w=o();export{M as InstanceData,v as InstanceDataView,O as StateFlags};
5
+ import t from"../../../../../core/Evented.js";import{f as e,e as s,t as i}from"../../../../../chunks/mat3.js";import{c as a}from"../../../../../chunks/mat3f64.js";import{m as r}from"../../../../../chunks/mat4.js";import{c as o}from"../../../../../chunks/mat4f64.js";import{s as n}from"../../../../../chunks/vec3.js";import{c as h}from"../../../../../chunks/vec3f64.js";import{BufferViewMat4f64 as l,BufferViewVec3f64 as c,BufferViewMat3f as f,BufferViewVec2f as m,BufferViewVec4f64 as g,BufferViewVec4f as d,BufferViewUint8 as _,BufferViewVec4u8 as T}from"../../../../../geometry/support/buffer/BufferView.js";import{scaleFromMatrix as u}from"../../../support/mathUtils.js";import{newLayout as L}from"../../../support/buffer/InterleavedLayout.js";import{assert as A}from"../Util.js";import{VertexAttribute as E}from"../VertexAttribute.js";var O;function F(t){let e=L().mat4f64(E.LOCALTRANSFORM).mat4f64(E.GLOBALTRANSFORM).vec4f64(E.BOUNDINGSPHERE).vec3f64(E.MODELORIGIN).mat3f(E.MODEL).mat3f(E.MODELNORMAL).vec2f(E.MODELSCALEFACTORS);return t.includes("color")&&(e=e.vec4f(E.COLOR)),t.includes("featureAttribute")&&(e=e.vec4f(E.FEATUREATTRIBUTE)),e=e.u8(E.STATE).u8(E.LODLEVEL),t.includes(E.OBJECTANDLAYERIDCOLOR)&&(e=e.vec4u8(E.OBJECTANDLAYERIDCOLOR)),e.alignTo(8),e}!function(t){t[t.ALLOCATED=1]="ALLOCATED",t[t.DEFAULT_ACTIVE=2]="DEFAULT_ACTIVE",t[t.VISIBLE=4]="VISIBLE",t[t.HIGHLIGHT=8]="HIGHLIGHT",t[t.HIGHLIGHT_ACTIVE=16]="HIGHLIGHT_ACTIVE",t[t.REMOVE=32]="REMOVE",t[t.TRANSFORM_CHANGED=64]="TRANSFORM_CHANGED",t[t.ACTIVE=18]="ACTIVE"}(O||(O={}));class v{constructor(t){this.localTransform=t.getField(E.LOCALTRANSFORM,l),this.globalTransform=t.getField(E.GLOBALTRANSFORM,l),this.modelOrigin=t.getField(E.MODELORIGIN,c),this.model=t.getField(E.MODEL,f),this.modelNormal=t.getField(E.MODELNORMAL,f),this.modelScaleFactors=t.getField(E.MODELSCALEFACTORS,m),this.boundingSphere=t.getField(E.BOUNDINGSPHERE,g),this.color=t.getField(E.COLOR,d),this.featureAttribute=t.getField(E.FEATUREATTRIBUTE,d),this.state=t.getField(E.STATE,_),this.lodLevel=t.getField(E.LODLEVEL,_),this.objectAndLayerIdColor=t.getField(E.OBJECTANDLAYERIDCOLOR,T)}}class M extends t{constructor(t,e){super(),this._capacity=0,this._size=0,this._next=0,this._buffer=null,this._view=null,this._layout=F(t),this._shaderTransformation=e}get capacity(){return this._capacity}get size(){return this._size}get buffer(){return this._buffer.buffer}get view(){return this._view}addInstance(){this._size+1>this._capacity&&this._grow();const t=this._findSlot();return this._view.state.set(t,O.ALLOCATED),this._size++,this.emit("instance-added",{index:t}),t}removeInstance(t){const e=this._view.state;A(t>=0&&t<this._capacity&&e.get(t)&O.ALLOCATED,"invalid instance handle"),this._getStateFlag(t,O.ACTIVE)?this._setStateFlags(t,O.REMOVE):this.freeInstance(t),this.emit("instance-removed",{index:t})}freeInstance(t){const e=this._view.state;A(t>=0&&t<this._capacity&&e.get(t)&O.ALLOCATED,"invalid instance handle"),e.set(t,0),this._size--}setLocalTransform(t,e,s=!0){this._view.localTransform.setMat(t,e),s&&this.updateModelTransform(t)}getLocalTransform(t,e){this._view.localTransform.getMat(t,e)}setGlobalTransform(t,e,s=!0){this._view.globalTransform.setMat(t,e),s&&this.updateModelTransform(t)}getGlobalTransform(t,e){this._view.globalTransform.getMat(t,e)}updateModelTransform(t){const a=this._view,o=C,h=b;a.localTransform.getMat(t,R),a.globalTransform.getMat(t,w);const l=r(w,w,R);n(o,l[12],l[13],l[14]),a.modelOrigin.setVec(t,o),e(h,l),a.model.setMat(t,h);const c=u(C,l);c.sort(),a.modelScaleFactors.set(t,0,c[1]),a.modelScaleFactors.set(t,1,c[2]),s(h,h),i(h,h),a.modelNormal.setMat(t,h),this._setStateFlags(t,O.TRANSFORM_CHANGED),this.emit("instance-transform-changed",{index:t})}getModelTransform(t,e){const s=this._view;s.model.getMat(t,b),s.modelOrigin.getVec(t,C),e[0]=b[0],e[1]=b[1],e[2]=b[2],e[3]=0,e[4]=b[3],e[5]=b[4],e[6]=b[5],e[7]=0,e[8]=b[6],e[9]=b[7],e[10]=b[8],e[11]=0,e[12]=C[0],e[13]=C[1],e[14]=C[2],e[15]=1}applyShaderTransformation(t,e){this._shaderTransformation&&this._shaderTransformation.applyTransform(this,t,e)}getCombinedModelTransform(t,e){return this.getModelTransform(t,e),this._shaderTransformation&&this._shaderTransformation.applyTransform(this,t,e),e}getCombinedLocalTransform(t,e){return this._view.localTransform.getMat(t,e),this._shaderTransformation&&this._shaderTransformation.applyTransform(this,t,e),e}getCombinedMaxScaleFactor(t){let e=this._view.modelScaleFactors.get(t,1);if(this._shaderTransformation){const s=this._shaderTransformation.scaleFactor(C,this,t);e*=Math.max(s[0],s[1],s[2])}return e}getCombinedMedianScaleFactor(t){let e=this._view.modelScaleFactors.get(t,0);if(this._shaderTransformation){const s=this._shaderTransformation.scaleFactor(C,this,t);e*=I(s[0],s[1],s[2])}return e}getModel(t,e){this._view.model.getMat(t,e)}setFeatureAttribute(t,e){this._view.featureAttribute.setVec(t,e)}getFeatureAttribute(t,e){this._view.featureAttribute.getVec(t,e)}setColor(t,e){this._view.color.setVec(t,e)}setObjectAndLayerIdColor(t,e){this._view.objectAndLayerIdColor.setVec(t,e)}getColor(t,e){this._view.color.getVec(t,e)}setVisible(t,e){e!==this.getVisible(t)&&(this._setStateFlag(t,O.VISIBLE,e),this.emit("instance-visibility-changed",{index:t}))}getVisible(t){return this._getStateFlag(t,O.VISIBLE)}setHighlight(t,e){e!==this.getHighlight(t)&&(this._setStateFlag(t,O.HIGHLIGHT,e),this.emit("instance-highlight-changed",{index:t}))}getHighlight(t){return this._getStateFlag(t,O.HIGHLIGHT)}getState(t){return this._view.state.get(t)}getLodLevel(t){return this._view.lodLevel.get(t)}countFlags(t){let e=0;for(let s=0;s<this._capacity;++s){this.getState(s)&t&&++e}return e}_setStateFlags(t,e){const s=this._view.state;e=s.get(t)|e,s.set(t,e)}_clearStateFlags(t,e){const s=this._view.state;e=s.get(t)&~e,s.set(t,e)}_setStateFlag(t,e,s){s?this._setStateFlags(t,e):this._clearStateFlags(t,e)}_getStateFlag(t,e){return!!(this._view.state.get(t)&e)}_grow(){const t=Math.max(S,Math.floor(this._capacity*p)),e=this._layout.createBuffer(t);if(this._buffer){const t=new Uint8Array(this._buffer.buffer);new Uint8Array(e.buffer).set(t)}this._capacity=t,this._buffer=e,this._view=new v(this._buffer)}_findSlot(){const t=this._view.state;let e=this._next;for(;t.get(e)&O.ALLOCATED;)e=e+1===this._capacity?0:e+1;return this._next=e+1===this._capacity?0:e+1,e}}function I(t,e,s){return Math.max(Math.min(t,e),Math.min(Math.max(t,e),s))}const S=1024,p=2,C=h(),b=a(),R=o(),w=o();export{M as InstanceData,v as InstanceDataView,O as StateFlags};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{c as t}from"../../../../../chunks/mat4f64.js";import{m as e}from"../../../../../chunks/vec3.js";import{w as s,c as i}from"../../../../../chunks/sphere.js";import{maxScale as r}from"../../../support/mathUtils.js";import h from"../Octree.js";class n extends h{constructor(e,r){super((t=>s(this._instanceData.view.boundingSphere.getVec(t,this._tmpSphere))),{maximumDepth:25}),this._tmpSphere=i(),this._tmpMat4=t(),this._instanceData=e,this._boundingSphere=r}addInstance(t){const s=this._instanceData.view.boundingSphere,i=this._instanceData.getCombinedModelTransform(t,this._tmpMat4);e(this._tmpSphere,this._boundingSphere.center,i),this._tmpSphere[3]=this._boundingSphere.radius*r(i),s.setVec(t,this._tmpSphere),this.add([t])}removeInstance(t){this.remove([t])}}export{n as InstanceOctree};
5
+ import{c as t}from"../../../../../chunks/mat4f64.js";import{v as e}from"../../../../../chunks/vec3.js";import{w as s,c as i}from"../../../../../chunks/sphere.js";import{maxScale as r}from"../../../support/mathUtils.js";import h from"../Octree.js";class n extends h{constructor(e,r){super((t=>s(this._instanceData.view.boundingSphere.getVec(t,this._tmpSphere))),{maximumDepth:25}),this._tmpSphere=i(),this._tmpMat4=t(),this._instanceData=e,this._boundingSphere=r}addInstance(t){const s=this._instanceData.view.boundingSphere,i=this._instanceData.getCombinedModelTransform(t,this._tmpMat4);e(this._tmpSphere,this._boundingSphere.center,i),this._tmpSphere[3]=this._boundingSphere.radius*r(i),s.setVec(t,this._tmpSphere),this.add([t])}removeInstance(t){this.remove([t])}}export{n as InstanceOctree};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{isNone as e,destroyMaybe as t,isSome as a}from"../../../../../core/maybe.js";import{isAborted as s,throwIfAborted as n}from"../../../../../core/promiseUtils.js";import{c as i}from"../../../../../chunks/mat4f64.js";import{b as r,e as o,m as l}from"../../../../../chunks/vec3.js";import{c}from"../../../../../chunks/vec3f64.js";import{c as h,f as d}from"../../../../../chunks/vec4f64.js";import u from"../../../support/debugFlags.js";import{glLayout as _}from"../../../support/buffer/glUtil.js";import{ShaderOutput as m}from"../../core/shaderLibrary/ShaderOutput.js";import{Camera as f}from"../Camera.js";import{Default3D as p}from"../DefaultVertexAttributeLocations.js";import{IntersectorType as g}from"../IntersectorInterfaces.js";import C from"../Octree.js";import{RenderSlot as I}from"../RenderSlot.js";import{assert as D}from"../Util.js";import{InstanceData as y,StateFlags as v}from"./InstanceData.js";import{InstanceOctree as b}from"./InstanceOctree.js";import{LevelSelector as R}from"./LevelSelector.js";import{LodLevel as E}from"./LodLevel.js";import{RenderInstanceData as A}from"./RenderInstanceData.js";import{getInstanceBufferLayout as T}from"../../materials/DefaultMaterial.js";import{colorMixModes as L}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as S}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as O}from"../../shaders/DefaultMaterialTechnique.js";import{bindVertexBufferLayout as U,unbindVertexBufferLayout as j}from"../../../../webgl/Util.js";const x=e=>{const t=e.baseBoundingSphere.radius,a=e.levels.map((e=>e.minScreenSpaceRadius));return new R(t,a)};class M{constructor(e,t,a,s){this.type=g.LOD,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=[],this._highlightRenderInstanceData=[],this._instanceIndex=0,this._slicePlane=!1,this._lastCamera=new f,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.slots=[I.OPAQUE_MATERIAL,I.TRANSPARENT_MATERIAL],this.canRender=!0,this._symbol=e,this._optionalFields=t,this._metadata=a,this._instanceBufferLayout=T({instancedDoublePrecision:!0,instanced:t}),this._glInstanceBufferLayout=_(this._instanceBufferLayout,1),this._instanceData=new y(this._optionalFields,s),this._instanceData.on("instance-added",(()=>this._requestUpdateCycle())),this._instanceData.on("instance-removed",(()=>this._requestUpdateCycle())),this._instanceData.on("instance-transform-changed",(e=>{this._requestUpdateCycle(),this._metadata.notifyGraphicGeometryChanged(e.index)})),this._instanceData.on("instance-visibility-changed",(e=>{this._requestUpdateCycle(!0),this._metadata.notifyGraphicVisibilityChanged(e.index)})),this._instanceData.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0))),this._enableLevelSelection=this._symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerUid(){return this._metadata.layerUid}get instanceData(){return this._instanceData}get memoryUsage(){const e={cpu:0,gpu:0};return this._defaultRenderInstanceData.forEach((t=>{const a=t.memoryUsage;e.cpu+=a.cpu,e.gpu+=a.gpu})),this._highlightRenderInstanceData.forEach((t=>{const a=t.memoryUsage;e.cpu+=a.cpu,e.gpu+=a.gpu})),e}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,a)=>{const s=this._defaultRenderInstanceData[a],n=this._highlightRenderInstanceData[a],i=s.size+n.size,r=e.triangleCount;t.push({renderedInstances:i,renderedTriangles:i*r,trianglesPerInstance:r})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}async initializeRenderContext(e,t){this._context=e;const a=e.renderContext.rctx,i=await Promise.allSettled(this._symbol.levels.map((s=>(this._defaultRenderInstanceData.push(new A(a,this._instanceBufferLayout)),this._highlightRenderInstanceData.push(new A(a,this._instanceBufferLayout)),E.create(e,s,t))))),r=i.map((e=>"fulfilled"===e.status?e.value:null)).filter((e=>e));if(s(t)||r.length!==i.length){r.forEach((e=>e.destroy())),n(t);for(const e of i)if("rejected"===e.status)throw e.reason}this._levels=r,this._levelSelector=x(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData.forEach((e=>e.destroy())),this._highlightRenderInstanceData.forEach((e=>e.destroy()))}get needsTransparentPass(){return this._levels.some((e=>e.components.some((e=>e.material.requiresSlot(I.TRANSPARENT_MATERIAL,m.Color)))))}get needsHighlight(){return this._highlightRenderInstanceData.some((e=>e.size>0))}prepareRender(e){if(u.LOD_INSTANCE_RENDERER_DISABLE_UPDATES)return;if(this._enableLevelSelection){const t=e.bindParameters.contentCamera.equals(this._lastCamera);this._lastCamera.copyFrom(e.bindParameters.contentCamera),t||this._requestUpdateCycle()}const t=this._needFullCycle?this._instanceData.size:2e3;this._needFullCycle=!1,this._updateInstances(e.bindParameters.contentCamera,t),this._needsUpdates&&this._context.requestRender()}render(e){if(!this.baseMaterial.isVisible()||!this.baseMaterial.isVisibleForOutput(e.output))return;e.rctx.bindVAO();e.output!==m.Highlight&&e.output!==m.ShadowHighlight&&this._renderComponents(e,this._defaultRenderInstanceData);e.output!==m.ShadowExludeHighlight&&this._renderComponents(e,this._highlightRenderInstanceData)}intersect(e,t,a,s){if(!this.baseMaterial.isVisible())return;const n=c();r(n,s,a);const i=n=>{this._instanceData.getCombinedModelTransform(n,q),e.transform.set(q),l(H,a,e.transform.inverse),l(B,s,e.transform.inverse);const i=this._instanceData.getState(n),r=this._instanceData.getLodLevel(n),o=this._levels.length;D(i&v.ACTIVE,"invalid instance state"),D(r>=0&&r<o,"invaid lod level"),this._levels[r].intersect(e,t,H,B,n,this._metadata,o)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(i):this._octree.forEachAlongRay(a,n,i)}queryDepthRange(e){return this._queryDepthRangeOctree(e)}notifyShaderTransformationChanged(){this._invalidateOctree()}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,e&&(this._needFullCycle=!0),this._needsUpdates&&this._context.requestRender()}get _needsUpdates(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}get _octree(){return e(this._octreeCached)&&(this._octreeCached=this._buildOctree()),this._octreeCached}_invalidateOctree(){this._octreeCached=t(this._octreeCached)}_buildOctree(){const e=new b(this._instanceData,this.baseBoundingSphere),t=this._instanceData,a=t.view?t.view.state:null;for(let s=0;s<this._instanceData.capacity;++s){a.get(s)&v.ACTIVE&&e.addInstance(s)}return e}_queryDepthRangeOctree(e){const t=e.eye,a=e.viewForward,s=this._octree.findClosest(a,C.DepthOrder.FRONT_TO_BACK,e.frustum),n=this._octree.findClosest(a,C.DepthOrder.BACK_TO_FRONT,e.frustum);if(null!=s&&null!=n){this._instanceData.view.boundingSphere.getVec(s,N),r(N,N,t);const i=o(N,a)-N[3];this._instanceData.view.boundingSphere.getVec(n,N),r(N,N,t);const l=o(N,a)+N[3];return{near:Math.max(e.near,i),far:Math.min(e.far,l)}}return{near:1/0,far:-1/0}}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._defaultRenderInstanceData.forEach((e=>{e.startUpdateCylce()})),this._highlightRenderInstanceData.forEach((e=>{e.startUpdateCylce()})),this._needsUpdates&&this._context.requestRender()}_updateInstances(e,t){const s=this._enableLevelSelection,n=this._levelSelector;n.updateCamera(e),this._defaultRenderInstanceData.forEach((e=>e.beginUpdate())),this._highlightRenderInstanceData.forEach((e=>e.beginUpdate()));const i=this._instanceData,r=this._instanceData.view,o=i.size,l=i.capacity;let c=this._instanceIndex;t=Math.min(o,t);for(let h=0;h<t;++h){0===c&&this._startUpdateCycle();const e=r.state.get(c);let o=0;if(!(e&v.ALLOCATED)){c=c+1===l?0:c+1,t++;continue}const h=r.lodLevel.get(c);if(e&v.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[h].freeTail(),e&v.HIGHLIGHT_ACTIVE&&this._highlightRenderInstanceData[h].freeTail(),e&v.REMOVE)i.freeInstance(c);else if(e&v.VISIBLE){let t=0;s&&(r.modelOrigin.getVec(c,w),t=n.selectLevel(w,i.getCombinedMedianScaleFactor(c))),o=e&~(v.ACTIVE|v.TRANSFORM_CHANGED),t>=0&&(e&v.HIGHLIGHT?(V(this._highlightRenderInstanceData[t],r,c),o|=v.HIGHLIGHT_ACTIVE):(V(this._defaultRenderInstanceData[t],r,c),o|=v.DEFAULT_ACTIVE)),r.state.set(c,o),r.lodLevel.set(c,t)}else o=e&~(v.ACTIVE|v.TRANSFORM_CHANGED),r.state.set(c,o);if(a(this._octreeCached)){const t=!!(e&v.ACTIVE),a=!!(o&v.ACTIVE);!t&&a?this._octreeCached.addInstance(c):t&&!a?this._octreeCached.removeInstance(c):t&&a&&e&v.TRANSFORM_CHANGED&&(this._octreeCached.removeInstance(c),this._octreeCached.addInstance(c))}c=c+1===l?0:c+1}this._instanceIndex=c,this._defaultRenderInstanceData.forEach((e=>e.endUpdate())),this._highlightRenderInstanceData.forEach((e=>e.endUpdate()))}_renderComponents(e,t){this.levels.forEach(((a,s)=>{a.components.forEach((a=>{this._renderComponent(e,t[s],a,s)}))}))}_renderComponent(t,a,s,n){const{bindParameters:i,rctx:r,output:o}=t;if(0===a.size||!s.material.requiresSlot(i.slot,t.output))return;const l=s.glMaterials.load(r,i.slot,o);if(e(l))return;const c=l.beginSlot(i),h=r.bindTechnique(c,s.material.parameters,i);r.bindVAO(s.vao),c.ensureAttributeLocations(s.vao),h.bindDraw(G,i,s.material.parameters),u.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&t.output===m.Color&&(h.setUniform4fv("externalColor",P[Math.min(n,P.length-1)]),h.setUniform1i("colorMixMode",L.replace));const d=r.capabilities.instancing,_=a.capacity,f=a.headIndex,g=a.tailIndex,C=a.firstIndex,I=this._glInstanceBufferLayout,y=(e,t)=>{U(r,p,a.buffer,I,e),d.drawArraysInstanced(c.primitiveType,0,s.vertexCount,t-e),j(r,p,a.buffer,I)};s.material.parameters.transparent&&null!=C?f>g?(D(C>=g&&C<=f,"invalid firstIndex"),y(C,f),y(g,C)):f<g&&(C<=f?(D(C>=0&&C<=f,"invalid firstIndex"),y(C,f),y(g,_),y(0,C)):(D(C>=g&&C<=_,"invalid firstIndex"),y(C,_),y(0,f),y(g,C))):f>g?y(g,f):f<g&&(y(0,f),y(g,_)),r.bindVAO(null)}}function V(e,t,a){const s=e.allocateHead();F(t,a,e.view,s)}function F(e,t,a,s){S(e.modelOrigin,t,a.modelOriginHi,a.modelOriginLo,s),a.model.copyFrom(s,e.model,t),a.modelNormal.copyFrom(s,e.modelNormal,t),e.color&&a.color&&a.color.copyFrom(s,e.color,t),e.objectAndLayerIdColor&&a.objectAndLayerIdColor&&a.objectAndLayerIdColor.copyFrom(s,e.objectAndLayerIdColor,t),e.featureAttribute&&a.featureAttribute&&a.featureAttribute.copyFrom(s,e.featureAttribute,t)}const w=c(),N=h(),q=i(),H=c(),B=c(),P=[d(1,0,1,1),d(0,0,1,1),d(0,1,0,1),d(1,1,0,1),d(1,0,0,1)],G=new O;export{M as LodRenderer};
5
+ import{isNone as e,destroyMaybe as t,isSome as a}from"../../../../../core/maybe.js";import{isAborted as s,throwIfAborted as n}from"../../../../../core/promiseUtils.js";import{c as i}from"../../../../../chunks/mat4f64.js";import{b as r,e as o,v as l}from"../../../../../chunks/vec3.js";import{c}from"../../../../../chunks/vec3f64.js";import{c as h,f as d}from"../../../../../chunks/vec4f64.js";import u from"../../../support/debugFlags.js";import{glLayout as _}from"../../../support/buffer/glUtil.js";import{ShaderOutput as m}from"../../core/shaderLibrary/ShaderOutput.js";import{Camera as f}from"../Camera.js";import{Default3D as p}from"../DefaultVertexAttributeLocations.js";import{IntersectorType as g}from"../IntersectorInterfaces.js";import C from"../Octree.js";import{RenderSlot as I}from"../RenderSlot.js";import{assert as D}from"../Util.js";import{InstanceData as y,StateFlags as v}from"./InstanceData.js";import{InstanceOctree as b}from"./InstanceOctree.js";import{LevelSelector as R}from"./LevelSelector.js";import{LodLevel as E}from"./LodLevel.js";import{RenderInstanceData as A}from"./RenderInstanceData.js";import{getInstanceBufferLayout as T}from"../../materials/DefaultMaterial.js";import{colorMixModes as L}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as S}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as O}from"../../shaders/DefaultMaterialTechnique.js";import{bindVertexBufferLayout as U,unbindVertexBufferLayout as j}from"../../../../webgl/Util.js";const x=e=>{const t=e.baseBoundingSphere.radius,a=e.levels.map((e=>e.minScreenSpaceRadius));return new R(t,a)};class M{constructor(e,t,a,s){this.type=g.LOD,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=[],this._highlightRenderInstanceData=[],this._instanceIndex=0,this._slicePlane=!1,this._lastCamera=new f,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.slots=[I.OPAQUE_MATERIAL,I.TRANSPARENT_MATERIAL],this.canRender=!0,this._symbol=e,this._optionalFields=t,this._metadata=a,this._instanceBufferLayout=T({instancedDoublePrecision:!0,instanced:t}),this._glInstanceBufferLayout=_(this._instanceBufferLayout,1),this._instanceData=new y(this._optionalFields,s),this._instanceData.on("instance-added",(()=>this._requestUpdateCycle())),this._instanceData.on("instance-removed",(()=>this._requestUpdateCycle())),this._instanceData.on("instance-transform-changed",(e=>{this._requestUpdateCycle(),this._metadata.notifyGraphicGeometryChanged(e.index)})),this._instanceData.on("instance-visibility-changed",(e=>{this._requestUpdateCycle(!0),this._metadata.notifyGraphicVisibilityChanged(e.index)})),this._instanceData.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0))),this._enableLevelSelection=this._symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerUid(){return this._metadata.layerUid}get instanceData(){return this._instanceData}get memoryUsage(){const e={cpu:0,gpu:0};return this._defaultRenderInstanceData.forEach((t=>{const a=t.memoryUsage;e.cpu+=a.cpu,e.gpu+=a.gpu})),this._highlightRenderInstanceData.forEach((t=>{const a=t.memoryUsage;e.cpu+=a.cpu,e.gpu+=a.gpu})),e}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,a)=>{const s=this._defaultRenderInstanceData[a],n=this._highlightRenderInstanceData[a],i=s.size+n.size,r=e.triangleCount;t.push({renderedInstances:i,renderedTriangles:i*r,trianglesPerInstance:r})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}async initializeRenderContext(e,t){this._context=e;const a=e.renderContext.rctx,i=await Promise.allSettled(this._symbol.levels.map((s=>(this._defaultRenderInstanceData.push(new A(a,this._instanceBufferLayout)),this._highlightRenderInstanceData.push(new A(a,this._instanceBufferLayout)),E.create(e,s,t))))),r=i.map((e=>"fulfilled"===e.status?e.value:null)).filter((e=>e));if(s(t)||r.length!==i.length){r.forEach((e=>e.destroy())),n(t);for(const e of i)if("rejected"===e.status)throw e.reason}this._levels=r,this._levelSelector=x(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData.forEach((e=>e.destroy())),this._highlightRenderInstanceData.forEach((e=>e.destroy()))}get needsTransparentPass(){return this._levels.some((e=>e.components.some((e=>e.material.requiresSlot(I.TRANSPARENT_MATERIAL,m.Color)))))}get needsHighlight(){return this._highlightRenderInstanceData.some((e=>e.size>0))}prepareRender(e){if(u.LOD_INSTANCE_RENDERER_DISABLE_UPDATES)return;if(this._enableLevelSelection){const t=e.bindParameters.contentCamera.equals(this._lastCamera);this._lastCamera.copyFrom(e.bindParameters.contentCamera),t||this._requestUpdateCycle()}const t=this._needFullCycle?this._instanceData.size:2e3;this._needFullCycle=!1,this._updateInstances(e.bindParameters.contentCamera,t),this._needsUpdates&&this._context.requestRender()}render(e){if(!this.baseMaterial.isVisible()||!this.baseMaterial.isVisibleForOutput(e.output))return;e.rctx.bindVAO();e.output!==m.Highlight&&e.output!==m.ShadowHighlight&&this._renderComponents(e,this._defaultRenderInstanceData);e.output!==m.ShadowExludeHighlight&&this._renderComponents(e,this._highlightRenderInstanceData)}intersect(e,t,a,s){if(!this.baseMaterial.isVisible())return;const n=c();r(n,s,a);const i=n=>{this._instanceData.getCombinedModelTransform(n,q),e.transform.set(q),l(H,a,e.transform.inverse),l(B,s,e.transform.inverse);const i=this._instanceData.getState(n),r=this._instanceData.getLodLevel(n),o=this._levels.length;D(i&v.ACTIVE,"invalid instance state"),D(r>=0&&r<o,"invaid lod level"),this._levels[r].intersect(e,t,H,B,n,this._metadata,o)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(i):this._octree.forEachAlongRay(a,n,i)}queryDepthRange(e){return this._queryDepthRangeOctree(e)}notifyShaderTransformationChanged(){this._invalidateOctree()}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,e&&(this._needFullCycle=!0),this._needsUpdates&&this._context.requestRender()}get _needsUpdates(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}get _octree(){return e(this._octreeCached)&&(this._octreeCached=this._buildOctree()),this._octreeCached}_invalidateOctree(){this._octreeCached=t(this._octreeCached)}_buildOctree(){const e=new b(this._instanceData,this.baseBoundingSphere),t=this._instanceData,a=t.view?t.view.state:null;for(let s=0;s<this._instanceData.capacity;++s){a.get(s)&v.ACTIVE&&e.addInstance(s)}return e}_queryDepthRangeOctree(e){const t=e.eye,a=e.viewForward,s=this._octree.findClosest(a,C.DepthOrder.FRONT_TO_BACK,e.frustum),n=this._octree.findClosest(a,C.DepthOrder.BACK_TO_FRONT,e.frustum);if(null!=s&&null!=n){this._instanceData.view.boundingSphere.getVec(s,N),r(N,N,t);const i=o(N,a)-N[3];this._instanceData.view.boundingSphere.getVec(n,N),r(N,N,t);const l=o(N,a)+N[3];return{near:Math.max(e.near,i),far:Math.min(e.far,l)}}return{near:1/0,far:-1/0}}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._defaultRenderInstanceData.forEach((e=>{e.startUpdateCylce()})),this._highlightRenderInstanceData.forEach((e=>{e.startUpdateCylce()})),this._needsUpdates&&this._context.requestRender()}_updateInstances(e,t){const s=this._enableLevelSelection,n=this._levelSelector;n.updateCamera(e),this._defaultRenderInstanceData.forEach((e=>e.beginUpdate())),this._highlightRenderInstanceData.forEach((e=>e.beginUpdate()));const i=this._instanceData,r=this._instanceData.view,o=i.size,l=i.capacity;let c=this._instanceIndex;t=Math.min(o,t);for(let h=0;h<t;++h){0===c&&this._startUpdateCycle();const e=r.state.get(c);let o=0;if(!(e&v.ALLOCATED)){c=c+1===l?0:c+1,t++;continue}const h=r.lodLevel.get(c);if(e&v.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[h].freeTail(),e&v.HIGHLIGHT_ACTIVE&&this._highlightRenderInstanceData[h].freeTail(),e&v.REMOVE)i.freeInstance(c);else if(e&v.VISIBLE){let t=0;s&&(r.modelOrigin.getVec(c,w),t=n.selectLevel(w,i.getCombinedMedianScaleFactor(c))),o=e&~(v.ACTIVE|v.TRANSFORM_CHANGED),t>=0&&(e&v.HIGHLIGHT?(V(this._highlightRenderInstanceData[t],r,c),o|=v.HIGHLIGHT_ACTIVE):(V(this._defaultRenderInstanceData[t],r,c),o|=v.DEFAULT_ACTIVE)),r.state.set(c,o),r.lodLevel.set(c,t)}else o=e&~(v.ACTIVE|v.TRANSFORM_CHANGED),r.state.set(c,o);if(a(this._octreeCached)){const t=!!(e&v.ACTIVE),a=!!(o&v.ACTIVE);!t&&a?this._octreeCached.addInstance(c):t&&!a?this._octreeCached.removeInstance(c):t&&a&&e&v.TRANSFORM_CHANGED&&(this._octreeCached.removeInstance(c),this._octreeCached.addInstance(c))}c=c+1===l?0:c+1}this._instanceIndex=c,this._defaultRenderInstanceData.forEach((e=>e.endUpdate())),this._highlightRenderInstanceData.forEach((e=>e.endUpdate()))}_renderComponents(e,t){this.levels.forEach(((a,s)=>{a.components.forEach((a=>{this._renderComponent(e,t[s],a,s)}))}))}_renderComponent(t,a,s,n){const{bindParameters:i,rctx:r,output:o}=t;if(0===a.size||!s.material.requiresSlot(i.slot,t.output))return;const l=s.glMaterials.load(r,i.slot,o);if(e(l))return;const c=l.beginSlot(i),h=r.bindTechnique(c,s.material.parameters,i);r.bindVAO(s.vao),c.ensureAttributeLocations(s.vao),h.bindDraw(G,i,s.material.parameters),u.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&t.output===m.Color&&(h.setUniform4fv("externalColor",P[Math.min(n,P.length-1)]),h.setUniform1i("colorMixMode",L.replace));const d=r.capabilities.instancing,_=a.capacity,f=a.headIndex,g=a.tailIndex,C=a.firstIndex,I=this._glInstanceBufferLayout,y=(e,t)=>{U(r,p,a.buffer,I,e),d.drawArraysInstanced(c.primitiveType,0,s.vertexCount,t-e),j(r,p,a.buffer,I)};s.material.parameters.transparent&&null!=C?f>g?(D(C>=g&&C<=f,"invalid firstIndex"),y(C,f),y(g,C)):f<g&&(C<=f?(D(C>=0&&C<=f,"invalid firstIndex"),y(C,f),y(g,_),y(0,C)):(D(C>=g&&C<=_,"invalid firstIndex"),y(C,_),y(0,f),y(g,C))):f>g?y(g,f):f<g&&(y(0,f),y(g,_)),r.bindVAO(null)}}function V(e,t,a){const s=e.allocateHead();F(t,a,e.view,s)}function F(e,t,a,s){S(e.modelOrigin,t,a.modelOriginHi,a.modelOriginLo,s),a.model.copyFrom(s,e.model,t),a.modelNormal.copyFrom(s,e.modelNormal,t),e.color&&a.color&&a.color.copyFrom(s,e.color,t),e.objectAndLayerIdColor&&a.objectAndLayerIdColor&&a.objectAndLayerIdColor.copyFrom(s,e.objectAndLayerIdColor,t),e.featureAttribute&&a.featureAttribute&&a.featureAttribute.copyFrom(s,e.featureAttribute,t)}const w=c(),N=h(),q=i(),H=c(),B=c(),P=[d(1,0,1,1),d(0,0,1,1),d(0,1,0,1),d(1,1,0,1),d(1,0,0,1)],G=new O;export{M as LodRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{acosClamped as t,reciprocalClamped as e}from"../../../../core/mathUtils.js";import{s as i}from"../../../../chunks/mat2.js";import{c as s}from"../../../../chunks/mat2f64.js";import{v as r,d as o}from"../../../../chunks/mat4.js";import{c as h}from"../../../../chunks/mat4f64.js";import{s as n,h as a,p as l,a as u,b as p,j as f,f as c,i as x}from"../../../../chunks/vec2.js";import{a as d,d as v,f as m}from"../../../../chunks/vec2f64.js";import{e as g,c as V,a as A,n as b,g as C,b as D,f as I,o as R,s as N,l as P,m as S}from"../../../../chunks/vec3.js";import{c as U}from"../../../../chunks/vec3f64.js";import{create as T,fromPositionAndNormal as y,intersectRay as L}from"../../../../geometry/support/plane.js";import{wrap as _}from"../../../../geometry/support/ray.js";import{makeOrthoBasisDirUpFallback as F}from"./GeometryUtil.js";import{VertexAttribute as M}from"./VertexAttribute.js";import{intersectTriangles as O}from"../materials/internal/MaterialUtil.js";function E(){return{up:U(),right:U()}}function k(t,e,i){S(t.up,e.up,i),S(t.right,e.right,i)}function w(t,e,i){t[0]=i[0]*e.right[0]+i[1]*e.up[0],t[1]=i[0]*e.right[1]+i[1]*e.up[1],t[2]=i[0]*e.right[2]+i[1]*e.up[2]}function G(t,e,i){n(t,g(i,e.right),g(i,e.up))}class B{constructor(){this.pos=U(),this.posES=U(),this.posGS=U(),this.vRight=U(),this.vLeft=U(),this.frame=E(),this.rotationFrame=E(),this.rotationRight=d(),this.rotationAngle=0,this.miterStretch=s()}setFrameFromUpVector(t){V(this.frame.up,t),A(at,this.vLeft,this.vRight),b(at,at),C(nt,this.frame.up,g(at,this.frame.up)),D(pt,at,nt),b(pt,pt),I(this.frame.right,pt,this.frame.up)}computeRotationAxisAndAngleFromUpVector(){V(this.rotationFrame.up,this.frame.up),V(this.rotationFrame.right,this.frame.right),n(this.rotationRight,1,0),C(nt,this.frame.up,g(this.frame.up,this.vLeft)),D(nt,this.vLeft,nt),R(nt,nt),b(nt,nt),C(at,this.frame.up,g(this.frame.up,this.vRight)),D(at,this.vRight,at),b(at,at),I(lt,this.rotationFrame.up,this.vLeft);const s=Math.sign(g(lt,this.vRight));if(this.rotationAngle=s*(Math.PI-t(g(nt,at))),Math.abs(this.rotationAngle)>0){const t=e(Math.cos(.5*this.rotationAngle));i(this.miterStretch,t-1+1,0,0,1)}const r=Math.PI-this.rotationAngle;this.maxStretchDistance=Math.abs(Math.min(this.vLeftLength,this.vRightLength)/Math.cos(.5*r))}}class j{constructor(){this.vertices=[],this.vertexIndices=[],this.vertexNormals=[],this.poles=[],this.poleIndices=[],this.uvs=null,this.uvIndices=null}addVertex(t,e){return this.vertices.push(v(t)),this.vertexNormals.push(v(e)),this.vertices.length-1}addUV(t){return this.uvs||(this.uvs=[],this.uvIndices=[]),this.uvs.push(t),this.uvs.length-1}addPole(t,e=null){return this.poles.push({position:v(t),normal:e?v(e):null}),this.poles.length-1}addSegment(t,e=null,i=null){this.vertexIndices.push(t.v0),this.vertexIndices.push(t.v1),e&&(this.uvIndices.push(e.v0),this.uvIndices.push(e.v1)),i&&(this.poleIndices.push(i.v0),this.poleIndices.push(i.v1))}get numSegments(){return this.vertexIndices.length/2}hasUV(){return null!=this.uvs}translate(t,e){for(const i of this.vertices)i[0]+=t,i[1]+=e;for(const i of this.poles)i.position[0]+=t,i.position[1]+=e}static circle(t=20){const e=.5,i=new j,s={v0:0,v1:0};i.addPole(m(0,0));for(let h=0;h<t;++h){const s=2*h*Math.PI/t,r=Math.cos(s),o=Math.sin(s),n=m(r*e,o*e),a=m(r,o);i.addVertex(n,a),i.addUV(h/t)}i.addUV(1);for(let h=0;h<t-1;++h){const t={v0:h,v1:h+1},e=t;i.addSegment(t,e,s)}const r={v0:t-1,v1:0},o={v0:t-1,v1:t};return i.addSegment(r,o,s),i}static rect(){const t=1,e=1,i=new j,s=m(.5*-t,.5*-e),r=m(.5*t,.5*-e),o=m(.5*t,.5*e),h=m(.5*-t,.5*e),n=m(0,-1),a=m(1,0),l=m(0,1),u=m(-1,0);i.addUV(0),i.addUV(1),i.addPole(m(0,.5*e),l),i.addPole(m(0,.5*e)),i.addPole(m(0,.5*-e)),i.addPole(m(0,.5*-e),n);const p={v0:0,v1:1};return i.addVertex(s,n),i.addVertex(r,n),i.addSegment({v0:0,v1:1},p,{v0:3,v1:3}),i.addVertex(r,a),i.addVertex(o,a),i.addSegment({v0:2,v1:3},p,{v0:2,v1:1}),i.addVertex(o,l),i.addVertex(h,l),i.addSegment({v0:4,v1:5},p,{v0:0,v1:0}),i.addVertex(h,u),i.addVertex(s,u),i.addSegment({v0:6,v1:7},p,{v0:1,v1:2}),i}}class z{constructor(t){this.vertices=[],this.offset=U(),this.xform=h(),this.vertices=t;const e=Math.floor((t.length-1)/2);V(this.offset,this.vertices[e].pos);for(const i of this.vertices)D(i.pos,i.pos,this.offset);r(this.xform,this.xform,this.offset),this.updatePathVertexInformation()}updatePathVertexInformation(){const t=this.vertices.length;let e=this.vertices[0];e.index=0,N(e.vLeft,0,0,0),e.vLeftLength=0,D(e.vRight,this.vertices[1].pos,e.pos),e.vRightLength=P(e.vRight),b(e.vRight,e.vRight);let i=e;for(let s=1;s<t;++s)e=this.vertices[s],e.index=s,V(e.vLeft,i.vRight),e.vLeftLength=i.vRightLength,s<t-1?(D(e.vRight,this.vertices[s+1].pos,e.pos),e.vRightLength=P(e.vRight),b(e.vRight,e.vRight)):(V(e.vRight,e.vLeft),e.vRightLength=e.vLeftLength),i=e}}function J(t,e){let i=null;const s=t.vertices.length,r=.99619469809,o=U(),h=U(),n=U(),a=U(),l=U(),u=U(),p=T();let f=t.vertices[0];V(h,e),N(o,0,1,0),F(f.vRight,h,o,o,n,h,r),V(f.frame.up,h),V(f.frame.right,n),i=f;for(let c=1;c<s;++c){f=t.vertices[c],A(l,f.vLeft,f.vRight);let e=P(l);e>0?(e=1/Math.sqrt(e),l[0]=l[0]*e,l[1]=l[1]*e,l[2]=l[2]*e):(l[0]=f.vRight[0],l[1]=f.vRight[1],l[2]=f.vRight[2]),A(u,i.pos,i.frame.up),y(f.pos,l,p);L(p,_(u,f.vLeft),a)?(D(a,a,f.pos),b(h,a),I(n,l,h),b(n,n)):F(l,i.frame.up,i.frame.right,o,n,h,r),V(f.frame.up,h),V(f.frame.right,n),i=f}}class H{}class X{numProfilesPerJoin(){return 1}extrude(t,e,i){for(let s=0;s<e.vertices.length;++s)i(t.index,t.frame,e.vertices[s],e.vertexNormals[s],!1)}}class q{constructor(t=.8*Math.PI,e=1){this.cutoffAngle=t,this.numBendSubdivisions=e}numProfilesPerJoin(){return this.numBendSubdivisions+1}extrude(t,e,i){const s=ft;if(Math.abs(t.rotationAngle)>=this.cutoffAngle)for(let r=0;r<this.numBendSubdivisions+1;++r){o(ct,.5*-t.rotationAngle+r*t.rotationAngle/this.numBendSubdivisions,t.rotationFrame.up),k(s,t.frame,ct);for(let r=0;r<e.vertices.length;++r){a(e.vertices[r],t.rotationRight)*t.rotationAngle>=0?i(t.index,s,e.vertices[r],e.vertexNormals[r],!1):(l(rt,e.vertices[r],t.miterStretch),i(t.index,t.frame,rt,e.vertexNormals[r],!0))}}else for(let r=0;r<this.numBendSubdivisions+1;++r)for(let s=0;s<e.vertices.length;++s){const r=a(e.vertices[s],t.rotationRight)*t.rotationAngle>=0;l(rt,e.vertices[s],t.miterStretch),i(t.index,t.frame,rt,e.vertexNormals[s],!r)}}}const K={generateUV:!1};class Q{rebuildConnectingProfileGeometry(t,e,i){for(let s=0;s<e.vertices.length;++s)i(t.index,t.frame,e.vertices[s],e.vertexNormals[s],0,0)}}class W extends Q{constructor(){super()}getNumVertices(){return 0}getNumIndices(){return 0}rebuildCapGeometry(){}buildTopology(){}}class Y extends Q{constructor(t,e=0,i=!1){super(),this.profile=t,this.profilePlaneOffset=e,this.flip=i}getNumVertices(){return this.profile.vertices.length}getNumIndices(){return 3*this.profile.numSegments}rebuildConnectingProfileGeometry(t,e,i){for(let s=0;s<e.vertices.length;++s)i(t.index,t.frame,e.vertices[s],e.vertexNormals[s],this.profilePlaneOffset,0)}rebuildCapGeometry(t,e){const i=ot;n(i,0,0);const s=this.flip?1:-1;for(let r=0;r<this.profile.vertices.length;++r)e(t.index,t.frame,this.profile.vertices[r],i,this.profilePlaneOffset,s)}buildTopology(t,e){const i=this.vertexBufferStart+this.profile.vertexIndices[0];for(let s=1;s<this.profile.numSegments;++s){const t=this.profile.vertexIndices[2*s+0],r=this.profile.vertexIndices[2*s+1],o=this.vertexBufferStart+t,h=this.vertexBufferStart+r;this.flip?e(h,o,i):e(i,o,h)}}}class Z extends Q{constructor(t){super(),this.flip=!1,this.sign=0,this.breakNormals=!1,this.numSegments=3,this.profile=t.profile,this.flip=t.flip,this.sign=this.flip?1:-1,this.breakNormals=t.breakNormals,this.numSegments=t.subdivisions}getNumVertices(){let t=0;return t=this.profile.vertices.length*(this.numSegments-1),this.breakNormals&&(t+=this.profile.vertices.length),t+=this.profile.poles.length,t}getNumIndices(){let t=0;t+=2*this.profile.numSegments*(this.numSegments-1);for(let e=0;e<this.profile.numSegments;++e){const i=this.profile.vertexIndices[2*e+0],s=this.profile.vertexIndices[2*e+1];this.profile.poleIndices[i]===this.profile.poleIndices[s]?t+=1:t+=2}return 3*t}rebuildCapGeometry(t,e){const i=t.frame,s=.5*this.sign,r=rt,o=ot;n(o,0,0);for(let h=0;h<this.profile.poles.length;++h){const r=this.profile.poles[h];r.normal?e(t.index,i,r.position,r.normal,s,0):e(t.index,i,r.position,o,s,this.sign)}if(this.breakNormals)for(let h=0;h<this.profile.vertices.length;++h)e(t.index,i,this.profile.vertices[h],this.profile.vertexNormals[h],0,0);for(let h=0;h<this.numSegments-1;++h){const n=(1-(h+1)/this.numSegments)*Math.PI*.5,a=Math.sin(n),l=Math.cos(n);for(let h=0;h<this.profile.vertices.length;++h){const n=this.profile.poles[this.profile.poleIndices[h]];u(r,this.profile.vertices[h],n.position),p(r,r,a),n.normal?(f(r,r,n.position),e(t.index,i,r,n.normal,s*l,0)):(c(o,r),p(o,o,a),f(r,r,n.position),e(t.index,i,r,o,s*l,this.sign*l))}}}buildTopology(t,e){const i=this.breakNormals?this.vertexBufferStart+this.profile.poles.length:this.firstProfileVertexIndex,s=this.breakNormals?this.vertexBufferStart+this.profile.poles.length+this.profile.vertices.length:this.vertexBufferStart+this.profile.poles.length;for(let r=0;r<this.profile.numSegments;++r){const t=this.profile.vertexIndices[2*r+0],o=this.profile.vertexIndices[2*r+1],h=this.vertexBufferStart+this.profile.poleIndices[t],n=this.vertexBufferStart+this.profile.poleIndices[o];let a=i+t,l=i+o;for(let i=0;i<this.numSegments-1;++i){const r=s+i*this.profile.vertices.length+t,h=s+i*this.profile.vertices.length+o;this.flip?(e(r,l,a),e(l,r,h)):(e(a,l,r),e(h,r,l)),a=r,l=h}this.flip?(e(h,l,a),h!==n&&e(h,n,l)):(e(a,l,h),h!==n&&e(l,n,h))}}}class ${constructor(t,e,i,s,r,o=K){this.options=o,this._extrusionVertexCount=0,this.numExtrusionProfiles=0,this.numVerticesTotal=0,this.numNormalsTotal=0,this.numUVTotal=0,this.profile=e,this.path=t,this.extruder=i,this.startCap=s,this.endCap=r;const h=this.path.vertices.length-2;this.numExtrusionProfiles=i.numProfilesPerJoin()*h+2,this.numVerticesTotal=e.vertices.length*this.numExtrusionProfiles,this.numNormalsTotal=this.numVerticesTotal,this.startCap.vertexBufferStart=this.numVerticesTotal;const n=this.startCap.getNumVertices();this.numVerticesTotal+=n,this.numNormalsTotal+=n,this.endCap.vertexBufferStart=this.numVerticesTotal;const a=this.endCap.getNumVertices();this.numVerticesTotal+=a,this.numNormalsTotal+=a,this.pathVertexData=new Float32Array(1*this.numVerticesTotal),this.profileRightAxisData=new Float32Array(4*this.numVerticesTotal),this.profileUpAxisData=new Float32Array(4*this.numVerticesTotal),this.profileVertexAndNormalData=new Float32Array(4*this.numVerticesTotal),this.profile.hasUV()&&this.options.generateUV&&(this.numUVTotal=this.profile.uvs.length,this.uvData=new Float32Array(2*this.numUVTotal)),this.originData=new Float32Array(3*this.path.vertices.length),this._rebuildGeometry(),this.buildTopology()}emitVertex(t,e,i,s,r){if(this.profileRightAxisData[4*this._extrusionVertexCount+0]=e.right[0],this.profileRightAxisData[4*this._extrusionVertexCount+1]=e.right[1],this.profileRightAxisData[4*this._extrusionVertexCount+2]=e.right[2],this.profileUpAxisData[4*this._extrusionVertexCount+0]=e.up[0],this.profileUpAxisData[4*this._extrusionVertexCount+1]=e.up[1],this.profileUpAxisData[4*this._extrusionVertexCount+2]=e.up[2],this.profileVertexAndNormalData[4*this._extrusionVertexCount+0]=i[0],this.profileVertexAndNormalData[4*this._extrusionVertexCount+1]=i[1],this.profileVertexAndNormalData[4*this._extrusionVertexCount+2]=s[0],this.profileVertexAndNormalData[4*this._extrusionVertexCount+3]=s[1],this.pathVertexData[this._extrusionVertexCount]=t,r){const e=this.path.vertices[t];this.profileRightAxisData[4*this._extrusionVertexCount+3]=e.rotationRight[0]*e.maxStretchDistance,this.profileUpAxisData[4*this._extrusionVertexCount+3]=e.rotationRight[1]*e.maxStretchDistance}else this.profileRightAxisData[4*this._extrusionVertexCount+3]=0,this.profileUpAxisData[4*this._extrusionVertexCount+3]=0;++this._extrusionVertexCount}emitCapVertex(t,e,i,s,r,o){this.profileRightAxisData[4*this._extrusionVertexCount+0]=e.right[0],this.profileRightAxisData[4*this._extrusionVertexCount+1]=e.right[1],this.profileRightAxisData[4*this._extrusionVertexCount+2]=e.right[2],this.profileUpAxisData[4*this._extrusionVertexCount+0]=e.up[0],this.profileUpAxisData[4*this._extrusionVertexCount+1]=e.up[1],this.profileUpAxisData[4*this._extrusionVertexCount+2]=e.up[2],this.profileVertexAndNormalData[4*this._extrusionVertexCount+0]=i[0],this.profileVertexAndNormalData[4*this._extrusionVertexCount+1]=i[1],this.profileVertexAndNormalData[4*this._extrusionVertexCount+2]=s[0],this.profileVertexAndNormalData[4*this._extrusionVertexCount+3]=s[1],this.pathVertexData[this._extrusionVertexCount]=t,this.profileRightAxisData[4*this._extrusionVertexCount+3]=r,this.profileUpAxisData[4*this._extrusionVertexCount+3]=o,++this._extrusionVertexCount}emitTriangle(t,e,i){this.vertexIndices.push(t),this.vertexIndices.push(e),this.vertexIndices.push(i),this.pathVertexIndices.push(this.pathVertexData[t]),this.pathVertexIndices.push(this.pathVertexData[e]),this.pathVertexIndices.push(this.pathVertexData[i]),this.normalIndices.push(t),this.normalIndices.push(e),this.normalIndices.push(i)}_rebuildGeometry(){const t=(t,e,i,s,r)=>this.emitVertex(t,e,i,s,r),e=(t,e,i,s,r,o)=>this.emitCapVertex(t,e,i,s,r,o);this._extrusionVertexCount=0;for(const i of this.path.vertices)this.originData[3*i.index+0]=i.pos[0],this.originData[3*i.index+1]=i.pos[1],this.originData[3*i.index+2]=i.pos[2];this.startCap.rebuildConnectingProfileGeometry(this.path.vertices[0],this.profile,e);for(let i=1;i<this.path.vertices.length-1;++i)this.extruder.extrude(this.path.vertices[i],this.profile,t);if(this.endCap.rebuildConnectingProfileGeometry(this.path.vertices[this.path.vertices.length-1],this.profile,e),this.startCap.rebuildCapGeometry(this.path.vertices[0],e),this.endCap.rebuildCapGeometry(this.path.vertices[this.path.vertices.length-1],e),this.profile.hasUV()&&this.options.generateUV)for(let i=0;i<this.profile.uvs.length;++i)this.uvData[2*i+0]=this.profile.uvs[i],this.uvData[2*i+1]=0}buildTopology(){const t=this.profile.vertices.length,e=this.profile.numSegments,i=this.numExtrusionProfiles-1;let s=3*(2*(e*i));this.startCap.indexBufferStart=s,this.startCap.firstProfileVertexIndex=0,s+=this.startCap.getNumIndices(),this.endCap.indexBufferStart=s,this.endCap.firstProfileVertexIndex=t*(this.numExtrusionProfiles-1),this.vertexIndices=new Array,this.normalIndices=new Array,this.pathVertexIndices=new Array,this.profile.hasUV()&&this.options.generateUV&&(this.uvIndices=new Array);for(let o=0;o<e;++o){const e=this.profile.vertexIndices[2*o],s=this.profile.vertexIndices[2*o+1];for(let r=0;r<i;++r){const i=r*t+e,o=(r+1)*t+e,h=(r+1)*t+s,n=r*t+s;this.emitTriangle(i,o,h),this.emitTriangle(i,h,n)}}const r=(t,e,i)=>this.emitTriangle(t,e,i);this.startCap.buildTopology(this.path.vertices[0],r),this.endCap.buildTopology(this.path.vertices[this.path.vertices.length-1],r)}onPathChanged(){this._rebuildGeometry()}}class tt{constructor(t){this.builder=t}get xform(){return this.builder.path.xform}onPathChanged(){this.builder.onPathChanged()}}class et extends tt{constructor(t){super(t),this.vertexAttributePosition=null,this.vertexAttributeNormal=null,this.vertexAttributeColor=null,this.vertexAttributePosition=new Float32Array(3*this.builder.numVerticesTotal),this.vertexAttributeNormal=new Float32Array(3*this.builder.numNormalsTotal),this.vertexAttributeColor=new Uint8Array(4),this.vertexAttributeColor[0]=255,this.vertexAttributeColor[1]=255,this.vertexAttributeColor[2]=255,this.vertexAttributeColor[3]=255}bakeVertexColors(t){this.vertexAttributeColor[0]=255*t[0],this.vertexAttributeColor[1]=255*t[1],this.vertexAttributeColor[2]=255*t[2],this.vertexAttributeColor[3]=255*(t.length>3?t[3]:1)}bake(t){this.size=t;for(let e=0;e<this.builder.numVerticesTotal;++e){let i=this.builder.pathVertexData[e];const s=0===i||i===this.builder.path.vertices.length-1;i*=3;const r=st;N(r,this.builder.originData[i++],this.builder.originData[i++],this.builder.originData[i]);const o=4*e,h=nt,l=rt,u=at,d=lt,v=ut;let m=0,g=0;if(N(d,this.builder.profileRightAxisData[o],this.builder.profileRightAxisData[o+1],this.builder.profileRightAxisData[o+2]),N(v,this.builder.profileUpAxisData[o],this.builder.profileUpAxisData[o+1],this.builder.profileUpAxisData[o+2]),n(l,this.builder.profileVertexAndNormalData[o]*t[0],this.builder.profileVertexAndNormalData[o+1]*t[1]),s)I(u,v,d),m=this.builder.profileRightAxisData[o+3]*t[0],g=this.builder.profileUpAxisData[o+3];else{const t=ot,e=ht;n(t,this.builder.profileRightAxisData[o+3],this.builder.profileUpAxisData[o+3]);const i=x(t);c(t,t);const s=a(l,t);if(Math.abs(s)>i){n(e,-t[1],t[0]);const r=a(l,e);p(t,t,i*Math.sign(s)),p(e,e,r),f(l,t,e)}N(u,0,0,0)}N(h,d[0]*l[0]+v[0]*l[1],d[1]*l[0]+v[1]*l[1],d[2]*l[0]+v[2]*l[1]),this.vertexAttributePosition[3*e+0]=r[0]+h[0]+u[0]*m,this.vertexAttributePosition[3*e+1]=r[1]+h[1]+u[1]*m,this.vertexAttributePosition[3*e+2]=r[2]+h[2]+u[2]*m;const V=rt;n(V,this.builder.profileVertexAndNormalData[o+2],this.builder.profileVertexAndNormalData[o+3]),this.vertexAttributeNormal[3*e+0]=d[0]*V[0]+v[0]*V[1]+u[0]*g,this.vertexAttributeNormal[3*e+1]=d[1]*V[0]+v[1]*V[1]+u[1]*g,this.vertexAttributeNormal[3*e+2]=d[2]*V[0]+v[2]*V[1]+u[2]*g}}createGeometryData(){const t=[[M.POSITION,this.builder.vertexIndices],[M.NORMAL,this.builder.normalIndices]],e=[[M.POSITION,{size:3,data:this.vertexAttributePosition,exclusive:!0}],[M.NORMAL,{size:3,data:this.vertexAttributeNormal,exclusive:!0}]];if(this.vertexAttributeColor){const i=this.builder.vertexIndices.length;t.push([M.COLOR,new Array(i).fill(0)]),e.push([M.COLOR,{size:4,data:this.vertexAttributeColor}])}return{vertexAttributes:e,indices:t}}onPathChanged(){super.onPathChanged(),this.bake(this.size)}intersect(t,e,i){const s=this.builder.vertexIndices,r={size:3,data:this.vertexAttributePosition},o=s.length/3;O(t,e,0,o,s,r,void 0,void 0,i)}}class it extends tt{constructor(t,e,i,s){super(t),this.sizeAttributeValue=e,this.colorAttributeValue=i,this.opacityAttributeValue=s,this.vvData=null,this.baked=new et(t),this.vvData=new Float32Array(4*this.builder.path.vertices.length);for(let r=0;r<this.builder.path.vertices.length;++r){this.vvData[4*r+0]=e,this.vvData[4*r+1]=i,this.vvData[4*r+2]=s;const t=0===r||r===this.builder.path.vertices.length-1;this.vvData[4*r+3]=t?1:0}}createGeometryData(){return{vertexAttributes:[[M.POSITION,{size:3,data:this.builder.originData,exclusive:!0}],[M.PROFILERIGHT,{size:4,data:this.builder.profileRightAxisData,exclusive:!0}],[M.PROFILEUP,{size:4,data:this.builder.profileUpAxisData,exclusive:!0}],[M.PROFILEVERTEXANDNORMAL,{size:4,data:this.builder.profileVertexAndNormalData,exclusive:!0}],[M.FEATUREVALUE,{size:4,data:this.vvData,exclusive:!0}]],indices:[[M.POSITION,this.builder.pathVertexIndices],[M.PROFILERIGHT,this.builder.vertexIndices],[M.PROFILEUP,this.builder.vertexIndices],[M.PROFILEVERTEXANDNORMAL,this.builder.vertexIndices],[M.FEATUREVALUE,this.builder.pathVertexIndices]]}}}const st=U(),rt=d(),ot=d(),ht=d(),nt=U(),at=U(),lt=U(),ut=U(),pt=U(),ft=E(),ct=h();export{$ as Builder,Q as CapBuilder,H as Extruder,it as FastUpdatePathGeometry,q as MiterExtruder,W as NoCapBuilder,z as Path,tt as PathGeometryData,B as PathVertex,j as Profile,Z as RoundCapBuilder,X as SimpleExtruder,et as StaticPathGeometry,Y as TriangulationCapBuilder,J as computeMinimumRotationTangentFrame,E as makeFrame,w as profileSpaceToVertexSpace,G as vertexSpaceToProfileSpace};
5
+ import{acosClamped as t,reciprocalClamped as e}from"../../../../core/mathUtils.js";import{s as i}from"../../../../chunks/mat2.js";import{c as s}from"../../../../chunks/mat2f64.js";import{v as r,d as o}from"../../../../chunks/mat4.js";import{c as h}from"../../../../chunks/mat4f64.js";import{s as n,h as a,p as l,a as u,b as p,j as f,f as c,i as x}from"../../../../chunks/vec2.js";import{a as d,d as v,f as m}from"../../../../chunks/vec2f64.js";import{e as g,c as V,a as A,n as b,g as C,b as D,f as I,x as R,s as N,l as P,v as S}from"../../../../chunks/vec3.js";import{c as U}from"../../../../chunks/vec3f64.js";import{create as T,fromPositionAndNormal as y,intersectRay as L}from"../../../../geometry/support/plane.js";import{wrap as _}from"../../../../geometry/support/ray.js";import{makeOrthoBasisDirUpFallback as F}from"./GeometryUtil.js";import{VertexAttribute as M}from"./VertexAttribute.js";import{intersectTriangles as O}from"../materials/internal/MaterialUtil.js";function E(){return{up:U(),right:U()}}function k(t,e,i){S(t.up,e.up,i),S(t.right,e.right,i)}function w(t,e,i){t[0]=i[0]*e.right[0]+i[1]*e.up[0],t[1]=i[0]*e.right[1]+i[1]*e.up[1],t[2]=i[0]*e.right[2]+i[1]*e.up[2]}function G(t,e,i){n(t,g(i,e.right),g(i,e.up))}class B{constructor(){this.pos=U(),this.posES=U(),this.posGS=U(),this.vRight=U(),this.vLeft=U(),this.frame=E(),this.rotationFrame=E(),this.rotationRight=d(),this.rotationAngle=0,this.miterStretch=s()}setFrameFromUpVector(t){V(this.frame.up,t),A(at,this.vLeft,this.vRight),b(at,at),C(nt,this.frame.up,g(at,this.frame.up)),D(pt,at,nt),b(pt,pt),I(this.frame.right,pt,this.frame.up)}computeRotationAxisAndAngleFromUpVector(){V(this.rotationFrame.up,this.frame.up),V(this.rotationFrame.right,this.frame.right),n(this.rotationRight,1,0),C(nt,this.frame.up,g(this.frame.up,this.vLeft)),D(nt,this.vLeft,nt),R(nt,nt),b(nt,nt),C(at,this.frame.up,g(this.frame.up,this.vRight)),D(at,this.vRight,at),b(at,at),I(lt,this.rotationFrame.up,this.vLeft);const s=Math.sign(g(lt,this.vRight));if(this.rotationAngle=s*(Math.PI-t(g(nt,at))),Math.abs(this.rotationAngle)>0){const t=e(Math.cos(.5*this.rotationAngle));i(this.miterStretch,t-1+1,0,0,1)}const r=Math.PI-this.rotationAngle;this.maxStretchDistance=Math.abs(Math.min(this.vLeftLength,this.vRightLength)/Math.cos(.5*r))}}class j{constructor(){this.vertices=[],this.vertexIndices=[],this.vertexNormals=[],this.poles=[],this.poleIndices=[],this.uvs=null,this.uvIndices=null}addVertex(t,e){return this.vertices.push(v(t)),this.vertexNormals.push(v(e)),this.vertices.length-1}addUV(t){return this.uvs||(this.uvs=[],this.uvIndices=[]),this.uvs.push(t),this.uvs.length-1}addPole(t,e=null){return this.poles.push({position:v(t),normal:e?v(e):null}),this.poles.length-1}addSegment(t,e=null,i=null){this.vertexIndices.push(t.v0),this.vertexIndices.push(t.v1),e&&(this.uvIndices.push(e.v0),this.uvIndices.push(e.v1)),i&&(this.poleIndices.push(i.v0),this.poleIndices.push(i.v1))}get numSegments(){return this.vertexIndices.length/2}hasUV(){return null!=this.uvs}translate(t,e){for(const i of this.vertices)i[0]+=t,i[1]+=e;for(const i of this.poles)i.position[0]+=t,i.position[1]+=e}static circle(t=20){const e=.5,i=new j,s={v0:0,v1:0};i.addPole(m(0,0));for(let h=0;h<t;++h){const s=2*h*Math.PI/t,r=Math.cos(s),o=Math.sin(s),n=m(r*e,o*e),a=m(r,o);i.addVertex(n,a),i.addUV(h/t)}i.addUV(1);for(let h=0;h<t-1;++h){const t={v0:h,v1:h+1},e=t;i.addSegment(t,e,s)}const r={v0:t-1,v1:0},o={v0:t-1,v1:t};return i.addSegment(r,o,s),i}static rect(){const t=1,e=1,i=new j,s=m(.5*-t,.5*-e),r=m(.5*t,.5*-e),o=m(.5*t,.5*e),h=m(.5*-t,.5*e),n=m(0,-1),a=m(1,0),l=m(0,1),u=m(-1,0);i.addUV(0),i.addUV(1),i.addPole(m(0,.5*e),l),i.addPole(m(0,.5*e)),i.addPole(m(0,.5*-e)),i.addPole(m(0,.5*-e),n);const p={v0:0,v1:1};return i.addVertex(s,n),i.addVertex(r,n),i.addSegment({v0:0,v1:1},p,{v0:3,v1:3}),i.addVertex(r,a),i.addVertex(o,a),i.addSegment({v0:2,v1:3},p,{v0:2,v1:1}),i.addVertex(o,l),i.addVertex(h,l),i.addSegment({v0:4,v1:5},p,{v0:0,v1:0}),i.addVertex(h,u),i.addVertex(s,u),i.addSegment({v0:6,v1:7},p,{v0:1,v1:2}),i}}class z{constructor(t){this.vertices=[],this.offset=U(),this.xform=h(),this.vertices=t;const e=Math.floor((t.length-1)/2);V(this.offset,this.vertices[e].pos);for(const i of this.vertices)D(i.pos,i.pos,this.offset);r(this.xform,this.xform,this.offset),this.updatePathVertexInformation()}updatePathVertexInformation(){const t=this.vertices.length;let e=this.vertices[0];e.index=0,N(e.vLeft,0,0,0),e.vLeftLength=0,D(e.vRight,this.vertices[1].pos,e.pos),e.vRightLength=P(e.vRight),b(e.vRight,e.vRight);let i=e;for(let s=1;s<t;++s)e=this.vertices[s],e.index=s,V(e.vLeft,i.vRight),e.vLeftLength=i.vRightLength,s<t-1?(D(e.vRight,this.vertices[s+1].pos,e.pos),e.vRightLength=P(e.vRight),b(e.vRight,e.vRight)):(V(e.vRight,e.vLeft),e.vRightLength=e.vLeftLength),i=e}}function J(t,e){let i=null;const s=t.vertices.length,r=.99619469809,o=U(),h=U(),n=U(),a=U(),l=U(),u=U(),p=T();let f=t.vertices[0];V(h,e),N(o,0,1,0),F(f.vRight,h,o,o,n,h,r),V(f.frame.up,h),V(f.frame.right,n),i=f;for(let c=1;c<s;++c){f=t.vertices[c],A(l,f.vLeft,f.vRight);let e=P(l);e>0?(e=1/Math.sqrt(e),l[0]=l[0]*e,l[1]=l[1]*e,l[2]=l[2]*e):(l[0]=f.vRight[0],l[1]=f.vRight[1],l[2]=f.vRight[2]),A(u,i.pos,i.frame.up),y(f.pos,l,p);L(p,_(u,f.vLeft),a)?(D(a,a,f.pos),b(h,a),I(n,l,h),b(n,n)):F(l,i.frame.up,i.frame.right,o,n,h,r),V(f.frame.up,h),V(f.frame.right,n),i=f}}class H{}class X{numProfilesPerJoin(){return 1}extrude(t,e,i){for(let s=0;s<e.vertices.length;++s)i(t.index,t.frame,e.vertices[s],e.vertexNormals[s],!1)}}class q{constructor(t=.8*Math.PI,e=1){this.cutoffAngle=t,this.numBendSubdivisions=e}numProfilesPerJoin(){return this.numBendSubdivisions+1}extrude(t,e,i){const s=ft;if(Math.abs(t.rotationAngle)>=this.cutoffAngle)for(let r=0;r<this.numBendSubdivisions+1;++r){o(ct,.5*-t.rotationAngle+r*t.rotationAngle/this.numBendSubdivisions,t.rotationFrame.up),k(s,t.frame,ct);for(let r=0;r<e.vertices.length;++r){a(e.vertices[r],t.rotationRight)*t.rotationAngle>=0?i(t.index,s,e.vertices[r],e.vertexNormals[r],!1):(l(rt,e.vertices[r],t.miterStretch),i(t.index,t.frame,rt,e.vertexNormals[r],!0))}}else for(let r=0;r<this.numBendSubdivisions+1;++r)for(let s=0;s<e.vertices.length;++s){const r=a(e.vertices[s],t.rotationRight)*t.rotationAngle>=0;l(rt,e.vertices[s],t.miterStretch),i(t.index,t.frame,rt,e.vertexNormals[s],!r)}}}const K={generateUV:!1};class Q{rebuildConnectingProfileGeometry(t,e,i){for(let s=0;s<e.vertices.length;++s)i(t.index,t.frame,e.vertices[s],e.vertexNormals[s],0,0)}}class W extends Q{constructor(){super()}getNumVertices(){return 0}getNumIndices(){return 0}rebuildCapGeometry(){}buildTopology(){}}class Y extends Q{constructor(t,e=0,i=!1){super(),this.profile=t,this.profilePlaneOffset=e,this.flip=i}getNumVertices(){return this.profile.vertices.length}getNumIndices(){return 3*this.profile.numSegments}rebuildConnectingProfileGeometry(t,e,i){for(let s=0;s<e.vertices.length;++s)i(t.index,t.frame,e.vertices[s],e.vertexNormals[s],this.profilePlaneOffset,0)}rebuildCapGeometry(t,e){const i=ot;n(i,0,0);const s=this.flip?1:-1;for(let r=0;r<this.profile.vertices.length;++r)e(t.index,t.frame,this.profile.vertices[r],i,this.profilePlaneOffset,s)}buildTopology(t,e){const i=this.vertexBufferStart+this.profile.vertexIndices[0];for(let s=1;s<this.profile.numSegments;++s){const t=this.profile.vertexIndices[2*s+0],r=this.profile.vertexIndices[2*s+1],o=this.vertexBufferStart+t,h=this.vertexBufferStart+r;this.flip?e(h,o,i):e(i,o,h)}}}class Z extends Q{constructor(t){super(),this.flip=!1,this.sign=0,this.breakNormals=!1,this.numSegments=3,this.profile=t.profile,this.flip=t.flip,this.sign=this.flip?1:-1,this.breakNormals=t.breakNormals,this.numSegments=t.subdivisions}getNumVertices(){let t=0;return t=this.profile.vertices.length*(this.numSegments-1),this.breakNormals&&(t+=this.profile.vertices.length),t+=this.profile.poles.length,t}getNumIndices(){let t=0;t+=2*this.profile.numSegments*(this.numSegments-1);for(let e=0;e<this.profile.numSegments;++e){const i=this.profile.vertexIndices[2*e+0],s=this.profile.vertexIndices[2*e+1];this.profile.poleIndices[i]===this.profile.poleIndices[s]?t+=1:t+=2}return 3*t}rebuildCapGeometry(t,e){const i=t.frame,s=.5*this.sign,r=rt,o=ot;n(o,0,0);for(let h=0;h<this.profile.poles.length;++h){const r=this.profile.poles[h];r.normal?e(t.index,i,r.position,r.normal,s,0):e(t.index,i,r.position,o,s,this.sign)}if(this.breakNormals)for(let h=0;h<this.profile.vertices.length;++h)e(t.index,i,this.profile.vertices[h],this.profile.vertexNormals[h],0,0);for(let h=0;h<this.numSegments-1;++h){const n=(1-(h+1)/this.numSegments)*Math.PI*.5,a=Math.sin(n),l=Math.cos(n);for(let h=0;h<this.profile.vertices.length;++h){const n=this.profile.poles[this.profile.poleIndices[h]];u(r,this.profile.vertices[h],n.position),p(r,r,a),n.normal?(f(r,r,n.position),e(t.index,i,r,n.normal,s*l,0)):(c(o,r),p(o,o,a),f(r,r,n.position),e(t.index,i,r,o,s*l,this.sign*l))}}}buildTopology(t,e){const i=this.breakNormals?this.vertexBufferStart+this.profile.poles.length:this.firstProfileVertexIndex,s=this.breakNormals?this.vertexBufferStart+this.profile.poles.length+this.profile.vertices.length:this.vertexBufferStart+this.profile.poles.length;for(let r=0;r<this.profile.numSegments;++r){const t=this.profile.vertexIndices[2*r+0],o=this.profile.vertexIndices[2*r+1],h=this.vertexBufferStart+this.profile.poleIndices[t],n=this.vertexBufferStart+this.profile.poleIndices[o];let a=i+t,l=i+o;for(let i=0;i<this.numSegments-1;++i){const r=s+i*this.profile.vertices.length+t,h=s+i*this.profile.vertices.length+o;this.flip?(e(r,l,a),e(l,r,h)):(e(a,l,r),e(h,r,l)),a=r,l=h}this.flip?(e(h,l,a),h!==n&&e(h,n,l)):(e(a,l,h),h!==n&&e(l,n,h))}}}class ${constructor(t,e,i,s,r,o=K){this.options=o,this._extrusionVertexCount=0,this.numExtrusionProfiles=0,this.numVerticesTotal=0,this.numNormalsTotal=0,this.numUVTotal=0,this.profile=e,this.path=t,this.extruder=i,this.startCap=s,this.endCap=r;const h=this.path.vertices.length-2;this.numExtrusionProfiles=i.numProfilesPerJoin()*h+2,this.numVerticesTotal=e.vertices.length*this.numExtrusionProfiles,this.numNormalsTotal=this.numVerticesTotal,this.startCap.vertexBufferStart=this.numVerticesTotal;const n=this.startCap.getNumVertices();this.numVerticesTotal+=n,this.numNormalsTotal+=n,this.endCap.vertexBufferStart=this.numVerticesTotal;const a=this.endCap.getNumVertices();this.numVerticesTotal+=a,this.numNormalsTotal+=a,this.pathVertexData=new Float32Array(1*this.numVerticesTotal),this.profileRightAxisData=new Float32Array(4*this.numVerticesTotal),this.profileUpAxisData=new Float32Array(4*this.numVerticesTotal),this.profileVertexAndNormalData=new Float32Array(4*this.numVerticesTotal),this.profile.hasUV()&&this.options.generateUV&&(this.numUVTotal=this.profile.uvs.length,this.uvData=new Float32Array(2*this.numUVTotal)),this.originData=new Float32Array(3*this.path.vertices.length),this._rebuildGeometry(),this.buildTopology()}emitVertex(t,e,i,s,r){if(this.profileRightAxisData[4*this._extrusionVertexCount+0]=e.right[0],this.profileRightAxisData[4*this._extrusionVertexCount+1]=e.right[1],this.profileRightAxisData[4*this._extrusionVertexCount+2]=e.right[2],this.profileUpAxisData[4*this._extrusionVertexCount+0]=e.up[0],this.profileUpAxisData[4*this._extrusionVertexCount+1]=e.up[1],this.profileUpAxisData[4*this._extrusionVertexCount+2]=e.up[2],this.profileVertexAndNormalData[4*this._extrusionVertexCount+0]=i[0],this.profileVertexAndNormalData[4*this._extrusionVertexCount+1]=i[1],this.profileVertexAndNormalData[4*this._extrusionVertexCount+2]=s[0],this.profileVertexAndNormalData[4*this._extrusionVertexCount+3]=s[1],this.pathVertexData[this._extrusionVertexCount]=t,r){const e=this.path.vertices[t];this.profileRightAxisData[4*this._extrusionVertexCount+3]=e.rotationRight[0]*e.maxStretchDistance,this.profileUpAxisData[4*this._extrusionVertexCount+3]=e.rotationRight[1]*e.maxStretchDistance}else this.profileRightAxisData[4*this._extrusionVertexCount+3]=0,this.profileUpAxisData[4*this._extrusionVertexCount+3]=0;++this._extrusionVertexCount}emitCapVertex(t,e,i,s,r,o){this.profileRightAxisData[4*this._extrusionVertexCount+0]=e.right[0],this.profileRightAxisData[4*this._extrusionVertexCount+1]=e.right[1],this.profileRightAxisData[4*this._extrusionVertexCount+2]=e.right[2],this.profileUpAxisData[4*this._extrusionVertexCount+0]=e.up[0],this.profileUpAxisData[4*this._extrusionVertexCount+1]=e.up[1],this.profileUpAxisData[4*this._extrusionVertexCount+2]=e.up[2],this.profileVertexAndNormalData[4*this._extrusionVertexCount+0]=i[0],this.profileVertexAndNormalData[4*this._extrusionVertexCount+1]=i[1],this.profileVertexAndNormalData[4*this._extrusionVertexCount+2]=s[0],this.profileVertexAndNormalData[4*this._extrusionVertexCount+3]=s[1],this.pathVertexData[this._extrusionVertexCount]=t,this.profileRightAxisData[4*this._extrusionVertexCount+3]=r,this.profileUpAxisData[4*this._extrusionVertexCount+3]=o,++this._extrusionVertexCount}emitTriangle(t,e,i){this.vertexIndices.push(t),this.vertexIndices.push(e),this.vertexIndices.push(i),this.pathVertexIndices.push(this.pathVertexData[t]),this.pathVertexIndices.push(this.pathVertexData[e]),this.pathVertexIndices.push(this.pathVertexData[i]),this.normalIndices.push(t),this.normalIndices.push(e),this.normalIndices.push(i)}_rebuildGeometry(){const t=(t,e,i,s,r)=>this.emitVertex(t,e,i,s,r),e=(t,e,i,s,r,o)=>this.emitCapVertex(t,e,i,s,r,o);this._extrusionVertexCount=0;for(const i of this.path.vertices)this.originData[3*i.index+0]=i.pos[0],this.originData[3*i.index+1]=i.pos[1],this.originData[3*i.index+2]=i.pos[2];this.startCap.rebuildConnectingProfileGeometry(this.path.vertices[0],this.profile,e);for(let i=1;i<this.path.vertices.length-1;++i)this.extruder.extrude(this.path.vertices[i],this.profile,t);if(this.endCap.rebuildConnectingProfileGeometry(this.path.vertices[this.path.vertices.length-1],this.profile,e),this.startCap.rebuildCapGeometry(this.path.vertices[0],e),this.endCap.rebuildCapGeometry(this.path.vertices[this.path.vertices.length-1],e),this.profile.hasUV()&&this.options.generateUV)for(let i=0;i<this.profile.uvs.length;++i)this.uvData[2*i+0]=this.profile.uvs[i],this.uvData[2*i+1]=0}buildTopology(){const t=this.profile.vertices.length,e=this.profile.numSegments,i=this.numExtrusionProfiles-1;let s=3*(2*(e*i));this.startCap.indexBufferStart=s,this.startCap.firstProfileVertexIndex=0,s+=this.startCap.getNumIndices(),this.endCap.indexBufferStart=s,this.endCap.firstProfileVertexIndex=t*(this.numExtrusionProfiles-1),this.vertexIndices=new Array,this.normalIndices=new Array,this.pathVertexIndices=new Array,this.profile.hasUV()&&this.options.generateUV&&(this.uvIndices=new Array);for(let o=0;o<e;++o){const e=this.profile.vertexIndices[2*o],s=this.profile.vertexIndices[2*o+1];for(let r=0;r<i;++r){const i=r*t+e,o=(r+1)*t+e,h=(r+1)*t+s,n=r*t+s;this.emitTriangle(i,o,h),this.emitTriangle(i,h,n)}}const r=(t,e,i)=>this.emitTriangle(t,e,i);this.startCap.buildTopology(this.path.vertices[0],r),this.endCap.buildTopology(this.path.vertices[this.path.vertices.length-1],r)}onPathChanged(){this._rebuildGeometry()}}class tt{constructor(t){this.builder=t}get xform(){return this.builder.path.xform}onPathChanged(){this.builder.onPathChanged()}}class et extends tt{constructor(t){super(t),this.vertexAttributePosition=null,this.vertexAttributeNormal=null,this.vertexAttributeColor=null,this.vertexAttributePosition=new Float32Array(3*this.builder.numVerticesTotal),this.vertexAttributeNormal=new Float32Array(3*this.builder.numNormalsTotal),this.vertexAttributeColor=new Uint8Array(4),this.vertexAttributeColor[0]=255,this.vertexAttributeColor[1]=255,this.vertexAttributeColor[2]=255,this.vertexAttributeColor[3]=255}bakeVertexColors(t){this.vertexAttributeColor[0]=255*t[0],this.vertexAttributeColor[1]=255*t[1],this.vertexAttributeColor[2]=255*t[2],this.vertexAttributeColor[3]=255*(t.length>3?t[3]:1)}bake(t){this.size=t;for(let e=0;e<this.builder.numVerticesTotal;++e){let i=this.builder.pathVertexData[e];const s=0===i||i===this.builder.path.vertices.length-1;i*=3;const r=st;N(r,this.builder.originData[i++],this.builder.originData[i++],this.builder.originData[i]);const o=4*e,h=nt,l=rt,u=at,d=lt,v=ut;let m=0,g=0;if(N(d,this.builder.profileRightAxisData[o],this.builder.profileRightAxisData[o+1],this.builder.profileRightAxisData[o+2]),N(v,this.builder.profileUpAxisData[o],this.builder.profileUpAxisData[o+1],this.builder.profileUpAxisData[o+2]),n(l,this.builder.profileVertexAndNormalData[o]*t[0],this.builder.profileVertexAndNormalData[o+1]*t[1]),s)I(u,v,d),m=this.builder.profileRightAxisData[o+3]*t[0],g=this.builder.profileUpAxisData[o+3];else{const t=ot,e=ht;n(t,this.builder.profileRightAxisData[o+3],this.builder.profileUpAxisData[o+3]);const i=x(t);c(t,t);const s=a(l,t);if(Math.abs(s)>i){n(e,-t[1],t[0]);const r=a(l,e);p(t,t,i*Math.sign(s)),p(e,e,r),f(l,t,e)}N(u,0,0,0)}N(h,d[0]*l[0]+v[0]*l[1],d[1]*l[0]+v[1]*l[1],d[2]*l[0]+v[2]*l[1]),this.vertexAttributePosition[3*e+0]=r[0]+h[0]+u[0]*m,this.vertexAttributePosition[3*e+1]=r[1]+h[1]+u[1]*m,this.vertexAttributePosition[3*e+2]=r[2]+h[2]+u[2]*m;const V=rt;n(V,this.builder.profileVertexAndNormalData[o+2],this.builder.profileVertexAndNormalData[o+3]),this.vertexAttributeNormal[3*e+0]=d[0]*V[0]+v[0]*V[1]+u[0]*g,this.vertexAttributeNormal[3*e+1]=d[1]*V[0]+v[1]*V[1]+u[1]*g,this.vertexAttributeNormal[3*e+2]=d[2]*V[0]+v[2]*V[1]+u[2]*g}}createGeometryData(){const t=[[M.POSITION,this.builder.vertexIndices],[M.NORMAL,this.builder.normalIndices]],e=[[M.POSITION,{size:3,data:this.vertexAttributePosition,exclusive:!0}],[M.NORMAL,{size:3,data:this.vertexAttributeNormal,exclusive:!0}]];if(this.vertexAttributeColor){const i=this.builder.vertexIndices.length;t.push([M.COLOR,new Array(i).fill(0)]),e.push([M.COLOR,{size:4,data:this.vertexAttributeColor}])}return{vertexAttributes:e,indices:t}}onPathChanged(){super.onPathChanged(),this.bake(this.size)}intersect(t,e,i){const s=this.builder.vertexIndices,r={size:3,data:this.vertexAttributePosition},o=s.length/3;O(t,e,0,o,s,r,void 0,void 0,i)}}class it extends tt{constructor(t,e,i,s){super(t),this.sizeAttributeValue=e,this.colorAttributeValue=i,this.opacityAttributeValue=s,this.vvData=null,this.baked=new et(t),this.vvData=new Float32Array(4*this.builder.path.vertices.length);for(let r=0;r<this.builder.path.vertices.length;++r){this.vvData[4*r+0]=e,this.vvData[4*r+1]=i,this.vvData[4*r+2]=s;const t=0===r||r===this.builder.path.vertices.length-1;this.vvData[4*r+3]=t?1:0}}createGeometryData(){return{vertexAttributes:[[M.POSITION,{size:3,data:this.builder.originData,exclusive:!0}],[M.PROFILERIGHT,{size:4,data:this.builder.profileRightAxisData,exclusive:!0}],[M.PROFILEUP,{size:4,data:this.builder.profileUpAxisData,exclusive:!0}],[M.PROFILEVERTEXANDNORMAL,{size:4,data:this.builder.profileVertexAndNormalData,exclusive:!0}],[M.FEATUREVALUE,{size:4,data:this.vvData,exclusive:!0}]],indices:[[M.POSITION,this.builder.pathVertexIndices],[M.PROFILERIGHT,this.builder.vertexIndices],[M.PROFILEUP,this.builder.vertexIndices],[M.PROFILEVERTEXANDNORMAL,this.builder.vertexIndices],[M.FEATUREVALUE,this.builder.pathVertexIndices]]}}}const st=U(),rt=d(),ot=d(),ht=d(),nt=U(),at=U(),lt=U(),ut=U(),pt=U(),ft=E(),ct=h();export{$ as Builder,Q as CapBuilder,H as Extruder,it as FastUpdatePathGeometry,q as MiterExtruder,W as NoCapBuilder,z as Path,tt as PathGeometryData,B as PathVertex,j as Profile,Z as RoundCapBuilder,X as SimpleExtruder,et as StaticPathGeometry,Y as TriangulationCapBuilder,J as computeMinimumRotationTangentFrame,E as makeFrame,w as profileSpaceToVertexSpace,G as vertexSpaceToProfileSpace};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as t}from"../../../../core/maybe.js";import{n as s}from"../../../../chunks/mat3.js";import{c as e}from"../../../../chunks/mat3f64.js";import{a as i,t as r,c as a,m as o}from"../../../../chunks/mat4.js";import{c as h}from"../../../../chunks/mat4f64.js";import{c as n}from"../../../../chunks/quat.js";import{a as f}from"../../../../chunks/quatf64.js";import{q as l,a as m,b as _}from"../../../../chunks/vec3.js";import{c as b}from"../../../../chunks/vec3f32.js";import{c}from"../../../../chunks/vec3f64.js";import{c as p}from"../../../../chunks/sphere.js";class u{constructor(){this._transform=h(),this._transformInverse=new M({value:this._transform},i,h),this._transformInverseTranspose=new M(this._transformInverse,r,h),this._transformTranspose=new M({value:this._transform},r,h),this._transformInverseRotation=new M({value:this._transform},s,e)}_invalidateLazyTransforms(){this._transformInverse.invalidate(),this._transformInverseTranspose.invalidate(),this._transformTranspose.invalidate(),this._transformInverseRotation.invalidate()}get transform(){return this._transform}get inverse(){return this._transformInverse.value}get inverseTranspose(){return this._transformInverseTranspose.value}get inverseRotation(){return this._transformInverseRotation.value}get transpose(){return this._transformTranspose.value}setTransformMatrix(t){a(this._transform,t)}multiplyTransform(t){o(this._transform,this._transform,t)}set(t){a(this._transform,t),this._invalidateLazyTransforms()}setAndInvalidateLazyTransforms(t,s){this.setTransformMatrix(t),this.multiplyTransform(s),this._invalidateLazyTransforms()}}class M{constructor(t,s,e){this._original=t,this._update=s,this._dirty=!0,this._transform=e()}invalidate(){this._dirty=!0}get value(){return this._dirty&&(this._update(this._transform,this._original.value),this._dirty=!1),this._transform}}class v{constructor(t=0){this.offset=t,this.tmpVertex=c()}applyToVertex(t,s,e){const i=t+this.localOrigin[0],r=s+this.localOrigin[1],a=e+this.localOrigin[2],o=this.offset/Math.sqrt(i*i+r*r+a*a);return this.tmpVertex[0]=t+i*o,this.tmpVertex[1]=s+r*o,this.tmpVertex[2]=e+a*o,this.tmpVertex}applyToAabb(t){for(let r=0;r<3;++r)O[r]=t[0+r]+this.localOrigin[r],z[r]=t[3+r]+this.localOrigin[r],T[r]=O[r];const s=this.applyToVertex(O[0],O[1],O[2]);for(let r=0;r<3;++r)t[r]=s[r],t[r+3]=s[r];const e=s=>{const e=this.applyToVertex(s[0],s[1],s[2]);for(let i=0;i<3;++i)t[i+0]=Math.min(t[i+0],e[i]),t[i+3]=Math.max(t[i+3],e[i])};for(let r=1;r<8;++r){for(let t=0;t<3;++t)T[t]=0==(r&1<<t)?O[t]:z[t];e(T)}let i=0;for(let r=0;r<3;++r){O[r]*z[r]<0&&(i|=1<<r)}if(0!==i&&7!==i)for(let r=0;r<8;++r)if(0==(i&r)){for(let t=0;t<3;++t)i[t]?T[t]=0:T[t]=0!=(r&1<<t)?O[t]:z[t];e(T)}for(let r=0;r<3;++r)t[r+0]-=this.localOrigin[r],t[r+3]-=this.localOrigin[r];return t}}const O=c(),z=c(),T=c();class g{constructor(t=0){this.componentLocalOriginLength=0,this._tmpVertex=c(),this._mbs=p(),this._obb={center:c(),halfSize:b(),quaternion:null},this._totalOffset=0,this._offset=0,this._resetOffset(t)}_resetOffset(t){this._offset=t,this._totalOffset=t}set offset(t){this._resetOffset(t)}get offset(){return this._offset}set componentOffset(t){this._totalOffset=this._offset+t}set localOrigin(t){this.componentLocalOriginLength=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2])}applyToVertex(t,s,e){const i=t,r=s,a=e+this.componentLocalOriginLength,o=this._totalOffset/Math.sqrt(i*i+r*r+a*a);return this._tmpVertex[0]=t+i*o,this._tmpVertex[1]=s+r*o,this._tmpVertex[2]=e+a*o,this._tmpVertex}applyToAabb(t){const s=t[0],e=t[1],i=t[2]+this.componentLocalOriginLength,r=t[3],a=t[4],o=t[5]+this.componentLocalOriginLength,h=s*r<0?0:Math.min(Math.abs(s),Math.abs(r)),n=e*a<0?0:Math.min(Math.abs(e),Math.abs(a)),f=i*o<0?0:Math.min(Math.abs(i),Math.abs(o)),l=Math.sqrt(h*h+n*n+f*f);if(l<this._totalOffset)return t[0]-=s<0?this._totalOffset:0,t[1]-=e<0?this._totalOffset:0,t[2]-=i<0?this._totalOffset:0,t[3]+=r>0?this._totalOffset:0,t[4]+=a>0?this._totalOffset:0,t[5]+=o>0?this._totalOffset:0,t;const m=Math.max(Math.abs(s),Math.abs(r)),_=Math.max(Math.abs(e),Math.abs(a)),b=Math.max(Math.abs(i),Math.abs(o)),c=Math.sqrt(m*m+_*_+b*b),p=this._totalOffset/c,u=this._totalOffset/l;return t[0]+=s*(s>0?p:u),t[1]+=e*(e>0?p:u),t[2]+=i*(i>0?p:u),t[3]+=r*(r<0?p:u),t[4]+=a*(a<0?p:u),t[5]+=o*(o<0?p:u),t}applyToMbs(t){const s=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]),e=this._totalOffset/s;return this._mbs[0]=t[0]+t[0]*e,this._mbs[1]=t[1]+t[1]*e,this._mbs[2]=t[2]+t[2]*e,this._mbs[3]=t[3]+t[3]*this._totalOffset/s,this._mbs}applyToObb(t){const s=t.center,e=this._totalOffset/Math.sqrt(s[0]*s[0]+s[1]*s[1]+s[2]*s[2]);this._obb.center[0]=s[0]+s[0]*e,this._obb.center[1]=s[1]+s[1]*e,this._obb.center[2]=s[2]+s[2]*e,l(this._obb.halfSize,t.halfSize,t.quaternion),m(this._obb.halfSize,this._obb.halfSize,t.center);const i=this._totalOffset/Math.sqrt(this._obb.halfSize[0]*this._obb.halfSize[0]+this._obb.halfSize[1]*this._obb.halfSize[1]+this._obb.halfSize[2]*this._obb.halfSize[2]);return this._obb.halfSize[0]+=this._obb.halfSize[0]*i,this._obb.halfSize[1]+=this._obb.halfSize[1]*i,this._obb.halfSize[2]+=this._obb.halfSize[2]*i,_(this._obb.halfSize,this._obb.halfSize,t.center),n(I,t.quaternion),l(this._obb.halfSize,this._obb.halfSize,I),this._obb.halfSize[0]*=this._obb.halfSize[0]<0?-1:1,this._obb.halfSize[1]*=this._obb.halfSize[1]<0?-1:1,this._obb.halfSize[2]*=this._obb.halfSize[2]<0?-1:1,this._obb.quaternion=t.quaternion,this._obb}}class x{constructor(t=0){this.offset=t,this.sphere=p(),this.tmpVertex=c()}applyToVertex(t,s,e){const i=this.objectTransform.transform;let r=i[0]*t+i[4]*s+i[8]*e+i[12],a=i[1]*t+i[5]*s+i[9]*e+i[13],o=i[2]*t+i[6]*s+i[10]*e+i[14];const h=this.offset/Math.sqrt(r*r+a*a+o*o);r+=r*h,a+=a*h,o+=o*h;const n=this.objectTransform.inverse;return this.tmpVertex[0]=n[0]*r+n[4]*a+n[8]*o+n[12],this.tmpVertex[1]=n[1]*r+n[5]*a+n[9]*o+n[13],this.tmpVertex[2]=n[2]*r+n[6]*a+n[10]*o+n[14],this.tmpVertex}applyToMinMax(t,s){const e=this.offset/Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]+=t[0]*e,t[1]+=t[1]*e,t[2]+=t[2]*e;const i=this.offset/Math.sqrt(s[0]*s[0]+s[1]*s[1]+s[2]*s[2]);s[0]+=s[0]*i,s[1]+=s[1]*i,s[2]+=s[2]*i}applyToAabb(t){const s=this.offset/Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]+=t[0]*s,t[1]+=t[1]*s,t[2]+=t[2]*s;const e=this.offset/Math.sqrt(t[3]*t[3]+t[4]*t[4]+t[5]*t[5]);return t[3]+=t[3]*e,t[4]+=t[4]*e,t[5]+=t[5]*e,t}applyToBoundingSphere(t){const s=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]),e=this.offset/s;return this.sphere[0]=t[0]+t[0]*e,this.sphere[1]=t[1]+t[1]*e,this.sphere[2]=t[2]+t[2]*e,this.sphere[3]=t[3]+t[3]*this.offset/s,this.sphere}}const S=new x;function y(s){return t(s)?(S.offset=s,S):null}const q=new g;function V(s){return t(s)?(q.offset=s,q):null}const d=new v;function L(s){return t(s)?(d.offset=s,d):null}const j="terrain",I=f();export{g as I3SVerticalOffsetGlobalViewingMode,u as IntersectorTransform,x as Object3DVerticalOffsetGlobalViewingMode,j as TERRAIN_ID,v as TerrainVerticalOffsetGlobalViewingMode,V as getVerticalOffsetI3S,y as getVerticalOffsetObject3D,L as getVerticalOffsetTerrain};
5
+ import{isSome as t}from"../../../../core/maybe.js";import{n as s}from"../../../../chunks/mat3.js";import{c as e}from"../../../../chunks/mat3f64.js";import{a as i,t as r,c as a,m as o}from"../../../../chunks/mat4.js";import{c as h}from"../../../../chunks/mat4f64.js";import{a as n}from"../../../../chunks/quat.js";import{c as f}from"../../../../chunks/quatf64.js";import{k as l,a as m,b as _}from"../../../../chunks/vec3.js";import{b}from"../../../../chunks/vec3f32.js";import{c}from"../../../../chunks/vec3f64.js";import{c as p}from"../../../../chunks/sphere.js";class u{constructor(){this._transform=h(),this._transformInverse=new M({value:this._transform},i,h),this._transformInverseTranspose=new M(this._transformInverse,r,h),this._transformTranspose=new M({value:this._transform},r,h),this._transformInverseRotation=new M({value:this._transform},s,e)}_invalidateLazyTransforms(){this._transformInverse.invalidate(),this._transformInverseTranspose.invalidate(),this._transformTranspose.invalidate(),this._transformInverseRotation.invalidate()}get transform(){return this._transform}get inverse(){return this._transformInverse.value}get inverseTranspose(){return this._transformInverseTranspose.value}get inverseRotation(){return this._transformInverseRotation.value}get transpose(){return this._transformTranspose.value}setTransformMatrix(t){a(this._transform,t)}multiplyTransform(t){o(this._transform,this._transform,t)}set(t){a(this._transform,t),this._invalidateLazyTransforms()}setAndInvalidateLazyTransforms(t,s){this.setTransformMatrix(t),this.multiplyTransform(s),this._invalidateLazyTransforms()}}class M{constructor(t,s,e){this._original=t,this._update=s,this._dirty=!0,this._transform=e()}invalidate(){this._dirty=!0}get value(){return this._dirty&&(this._update(this._transform,this._original.value),this._dirty=!1),this._transform}}class v{constructor(t=0){this.offset=t,this.tmpVertex=c()}applyToVertex(t,s,e){const i=t+this.localOrigin[0],r=s+this.localOrigin[1],a=e+this.localOrigin[2],o=this.offset/Math.sqrt(i*i+r*r+a*a);return this.tmpVertex[0]=t+i*o,this.tmpVertex[1]=s+r*o,this.tmpVertex[2]=e+a*o,this.tmpVertex}applyToAabb(t){for(let r=0;r<3;++r)O[r]=t[0+r]+this.localOrigin[r],z[r]=t[3+r]+this.localOrigin[r],T[r]=O[r];const s=this.applyToVertex(O[0],O[1],O[2]);for(let r=0;r<3;++r)t[r]=s[r],t[r+3]=s[r];const e=s=>{const e=this.applyToVertex(s[0],s[1],s[2]);for(let i=0;i<3;++i)t[i+0]=Math.min(t[i+0],e[i]),t[i+3]=Math.max(t[i+3],e[i])};for(let r=1;r<8;++r){for(let t=0;t<3;++t)T[t]=0==(r&1<<t)?O[t]:z[t];e(T)}let i=0;for(let r=0;r<3;++r){O[r]*z[r]<0&&(i|=1<<r)}if(0!==i&&7!==i)for(let r=0;r<8;++r)if(0==(i&r)){for(let t=0;t<3;++t)i[t]?T[t]=0:T[t]=0!=(r&1<<t)?O[t]:z[t];e(T)}for(let r=0;r<3;++r)t[r+0]-=this.localOrigin[r],t[r+3]-=this.localOrigin[r];return t}}const O=c(),z=c(),T=c();class g{constructor(t=0){this.componentLocalOriginLength=0,this._tmpVertex=c(),this._mbs=p(),this._obb={center:c(),halfSize:b(),quaternion:null},this._totalOffset=0,this._offset=0,this._resetOffset(t)}_resetOffset(t){this._offset=t,this._totalOffset=t}set offset(t){this._resetOffset(t)}get offset(){return this._offset}set componentOffset(t){this._totalOffset=this._offset+t}set localOrigin(t){this.componentLocalOriginLength=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2])}applyToVertex(t,s,e){const i=t,r=s,a=e+this.componentLocalOriginLength,o=this._totalOffset/Math.sqrt(i*i+r*r+a*a);return this._tmpVertex[0]=t+i*o,this._tmpVertex[1]=s+r*o,this._tmpVertex[2]=e+a*o,this._tmpVertex}applyToAabb(t){const s=t[0],e=t[1],i=t[2]+this.componentLocalOriginLength,r=t[3],a=t[4],o=t[5]+this.componentLocalOriginLength,h=s*r<0?0:Math.min(Math.abs(s),Math.abs(r)),n=e*a<0?0:Math.min(Math.abs(e),Math.abs(a)),f=i*o<0?0:Math.min(Math.abs(i),Math.abs(o)),l=Math.sqrt(h*h+n*n+f*f);if(l<this._totalOffset)return t[0]-=s<0?this._totalOffset:0,t[1]-=e<0?this._totalOffset:0,t[2]-=i<0?this._totalOffset:0,t[3]+=r>0?this._totalOffset:0,t[4]+=a>0?this._totalOffset:0,t[5]+=o>0?this._totalOffset:0,t;const m=Math.max(Math.abs(s),Math.abs(r)),_=Math.max(Math.abs(e),Math.abs(a)),b=Math.max(Math.abs(i),Math.abs(o)),c=Math.sqrt(m*m+_*_+b*b),p=this._totalOffset/c,u=this._totalOffset/l;return t[0]+=s*(s>0?p:u),t[1]+=e*(e>0?p:u),t[2]+=i*(i>0?p:u),t[3]+=r*(r<0?p:u),t[4]+=a*(a<0?p:u),t[5]+=o*(o<0?p:u),t}applyToMbs(t){const s=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]),e=this._totalOffset/s;return this._mbs[0]=t[0]+t[0]*e,this._mbs[1]=t[1]+t[1]*e,this._mbs[2]=t[2]+t[2]*e,this._mbs[3]=t[3]+t[3]*this._totalOffset/s,this._mbs}applyToObb(t){const s=t.center,e=this._totalOffset/Math.sqrt(s[0]*s[0]+s[1]*s[1]+s[2]*s[2]);this._obb.center[0]=s[0]+s[0]*e,this._obb.center[1]=s[1]+s[1]*e,this._obb.center[2]=s[2]+s[2]*e,l(this._obb.halfSize,t.halfSize,t.quaternion),m(this._obb.halfSize,this._obb.halfSize,t.center);const i=this._totalOffset/Math.sqrt(this._obb.halfSize[0]*this._obb.halfSize[0]+this._obb.halfSize[1]*this._obb.halfSize[1]+this._obb.halfSize[2]*this._obb.halfSize[2]);return this._obb.halfSize[0]+=this._obb.halfSize[0]*i,this._obb.halfSize[1]+=this._obb.halfSize[1]*i,this._obb.halfSize[2]+=this._obb.halfSize[2]*i,_(this._obb.halfSize,this._obb.halfSize,t.center),n(k,t.quaternion),l(this._obb.halfSize,this._obb.halfSize,k),this._obb.halfSize[0]*=this._obb.halfSize[0]<0?-1:1,this._obb.halfSize[1]*=this._obb.halfSize[1]<0?-1:1,this._obb.halfSize[2]*=this._obb.halfSize[2]<0?-1:1,this._obb.quaternion=t.quaternion,this._obb}}class x{constructor(t=0){this.offset=t,this.sphere=p(),this.tmpVertex=c()}applyToVertex(t,s,e){const i=this.objectTransform.transform;let r=i[0]*t+i[4]*s+i[8]*e+i[12],a=i[1]*t+i[5]*s+i[9]*e+i[13],o=i[2]*t+i[6]*s+i[10]*e+i[14];const h=this.offset/Math.sqrt(r*r+a*a+o*o);r+=r*h,a+=a*h,o+=o*h;const n=this.objectTransform.inverse;return this.tmpVertex[0]=n[0]*r+n[4]*a+n[8]*o+n[12],this.tmpVertex[1]=n[1]*r+n[5]*a+n[9]*o+n[13],this.tmpVertex[2]=n[2]*r+n[6]*a+n[10]*o+n[14],this.tmpVertex}applyToMinMax(t,s){const e=this.offset/Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]+=t[0]*e,t[1]+=t[1]*e,t[2]+=t[2]*e;const i=this.offset/Math.sqrt(s[0]*s[0]+s[1]*s[1]+s[2]*s[2]);s[0]+=s[0]*i,s[1]+=s[1]*i,s[2]+=s[2]*i}applyToAabb(t){const s=this.offset/Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]+=t[0]*s,t[1]+=t[1]*s,t[2]+=t[2]*s;const e=this.offset/Math.sqrt(t[3]*t[3]+t[4]*t[4]+t[5]*t[5]);return t[3]+=t[3]*e,t[4]+=t[4]*e,t[5]+=t[5]*e,t}applyToBoundingSphere(t){const s=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]),e=this.offset/s;return this.sphere[0]=t[0]+t[0]*e,this.sphere[1]=t[1]+t[1]*e,this.sphere[2]=t[2]+t[2]*e,this.sphere[3]=t[3]+t[3]*this.offset/s,this.sphere}}const S=new x;function y(s){return t(s)?(S.offset=s,S):null}const q=new g;function V(s){return t(s)?(q.offset=s,q):null}const d=new v;function L(s){return t(s)?(d.offset=s,d):null}const j="terrain",k=f();export{g as I3SVerticalOffsetGlobalViewingMode,u as IntersectorTransform,x as Object3DVerticalOffsetGlobalViewingMode,j as TERRAIN_ID,v as TerrainVerticalOffsetGlobalViewingMode,V as getVerticalOffsetI3S,y as getVerticalOffsetObject3D,L as getVerticalOffsetTerrain};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as t}from"../../../../core/mathUtils.js";import{o as n,s as o,c as r}from"../../../../chunks/vec3.js";import{c as e}from"../../../../chunks/vec3f64.js";import{elementwiseProduct as s,scalarProduct as i,add as c}from"../lib/LongVectorMath.js";import{MainLight as f,FillLight as h,AmbientLight as a,SphericalHarmonicsAmbientLight as g}from"./Lightsources.js";function u(t){return(t+1)*(t+1)}function l(n){return t(Math.floor(Math.sqrt(n)-1),0,2)}function m(t,n,o){const r=t[0],e=t[1],s=t[2],i=o||[];return i.length=u(n),n>=0&&(i[0]=.28209479177),n>=1&&(i[1]=.4886025119*r,i[2]=.4886025119*s,i[3]=.4886025119*e),n>=2&&(i[4]=1.09254843059*r*e,i[5]=1.09254843059*e*s,i[6]=.31539156525*(3*s*s-1),i[7]=1.09254843059*r*s,i[8]=.54627421529*(r*r-e*e)),i}function p(t,n){const o=u(t),r=n||{r:[],g:[],b:[]};r.r.length=r.g.length=r.b.length=o;for(let e=0;e<o;e++)r.r[e]=r.g[e]=r.b[e]=0;return r}function y(t,o){const r=l(o.r.length);for(const e of t)n(P,e.direction),m(P,r,v),s(v,k),i(v,e.intensity[0],I),c(o.r,I),i(v,e.intensity[1],I),c(o.g,I),i(v,e.intensity[2],I),c(o.b,I);return o}function b(t,n){m(P,0,v);for(const o of t)n.r[0]+=v[0]*k[0]*o.intensity[0]*4*Math.PI,n.g[0]+=v[0]*k[0]*o.intensity[1]*4*Math.PI,n.b[0]+=v[0]*k[0]*o.intensity[2]*4*Math.PI;return n}function M(t,n,e,s){p(n,s),o(e.intensity,0,0,0);let i=!1;const u=S,l=d,m=j;u.length=0,l.length=0,m.length=0;for(const o of t)o instanceof f&&!i?(r(e.direction,o.direction),r(e.intensity,o.intensity),e.specularStrength=o.specularStrength,e.environmentStrength=o.environmentStrength,e.castShadows=o.castShadows,i=!0):o instanceof f||o instanceof h?u.push(o):o instanceof a?l.push(o):o instanceof g&&m.push(o);y(u,s),b(l,s);for(const o of m)c(s.r,o.r),c(s.g,o.g),c(s.b,o.b)}const S=[],d=[],j=[],v=[0],I=[0],P=e(),k=[3.141593,2.094395,2.094395,2.094395,.785398,.785398,.785398,.785398,.785398];export{M as combineLights,m as computeCoefficients,p as initSHCoefficients,u as numberOfCoefficients,l as orderFromNumberOfCoefficients,b as projectAmbientLights,y as projectFillLights};
5
+ import{clamp as t}from"../../../../core/mathUtils.js";import{x as n,s as o,c as r}from"../../../../chunks/vec3.js";import{c as e}from"../../../../chunks/vec3f64.js";import{elementwiseProduct as s,scalarProduct as i,add as c}from"../lib/LongVectorMath.js";import{MainLight as f,FillLight as h,AmbientLight as a,SphericalHarmonicsAmbientLight as g}from"./Lightsources.js";function u(t){return(t+1)*(t+1)}function l(n){return t(Math.floor(Math.sqrt(n)-1),0,2)}function m(t,n,o){const r=t[0],e=t[1],s=t[2],i=o||[];return i.length=u(n),n>=0&&(i[0]=.28209479177),n>=1&&(i[1]=.4886025119*r,i[2]=.4886025119*s,i[3]=.4886025119*e),n>=2&&(i[4]=1.09254843059*r*e,i[5]=1.09254843059*e*s,i[6]=.31539156525*(3*s*s-1),i[7]=1.09254843059*r*s,i[8]=.54627421529*(r*r-e*e)),i}function p(t,n){const o=u(t),r=n||{r:[],g:[],b:[]};r.r.length=r.g.length=r.b.length=o;for(let e=0;e<o;e++)r.r[e]=r.g[e]=r.b[e]=0;return r}function y(t,o){const r=l(o.r.length);for(const e of t)n(P,e.direction),m(P,r,v),s(v,k),i(v,e.intensity[0],I),c(o.r,I),i(v,e.intensity[1],I),c(o.g,I),i(v,e.intensity[2],I),c(o.b,I);return o}function b(t,n){m(P,0,v);for(const o of t)n.r[0]+=v[0]*k[0]*o.intensity[0]*4*Math.PI,n.g[0]+=v[0]*k[0]*o.intensity[1]*4*Math.PI,n.b[0]+=v[0]*k[0]*o.intensity[2]*4*Math.PI;return n}function M(t,n,e,s){p(n,s),o(e.intensity,0,0,0);let i=!1;const u=S,l=d,m=j;u.length=0,l.length=0,m.length=0;for(const o of t)o instanceof f&&!i?(r(e.direction,o.direction),r(e.intensity,o.intensity),e.specularStrength=o.specularStrength,e.environmentStrength=o.environmentStrength,e.castShadows=o.castShadows,i=!0):o instanceof f||o instanceof h?u.push(o):o instanceof a?l.push(o):o instanceof g&&m.push(o);y(u,s),b(l,s);for(const o of m)c(s.r,o.r),c(s.g,o.g),c(s.b,o.b)}const S=[],d=[],j=[],v=[0],I=[0],P=e(),k=[3.141593,2.094395,2.094395,2.094395,.785398,.785398,.785398,.785398,.785398];export{M as combineLights,m as computeCoefficients,p as initSHCoefficients,u as numberOfCoefficients,l as orderFromNumberOfCoefficients,b as projectAmbientLights,y as projectFillLights};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{clamp as e}from"../../../../core/mathUtils.js";import{isSome as t,unwrapOr as r}from"../../../../core/maybe.js";import{f as s}from"../../../../chunks/mat3.js";import{c as i}from"../../../../chunks/mat3f64.js";import{a}from"../../../../chunks/mat4.js";import{c as n}from"../../../../chunks/mat4f64.js";import{c as o}from"../../../../chunks/vec2.js";import{a as c,f as l}from"../../../../chunks/vec2f64.js";import{s as f,m as u,n as h,b as p,g as d,c as m,l as g,i as O,t as S,e as v,a as A}from"../../../../chunks/vec3.js";import{c as b,f as P}from"../../../../chunks/vec3f64.js";import{c as x,f as y}from"../../../../chunks/vec4f64.js";import{isMat4 as I}from"../../../../core/libs/gl-matrix-2/types/mat4.js";import{create as _}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as C}from"../../../../geometry/support/buffer/BufferView.js";import{newLayout as T}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as j}from"../core/shaderLibrary/ShaderOutput.js";import{HUDSpace as z}from"../core/shaderLibrary/hud/HUD.glsl.js";import{computeAttachmentOriginPoints as L}from"../lib/geometryDataUtils.js";import{GLTextureMaterial as M,GLTextureMaterialBindParameters as D}from"../lib/GLTextureMaterial.js";import{Material as U,RenderOccludedFlag as E}from"../lib/Material.js";import{RenderSlot as w}from"../lib/RenderSlot.js";import{applyScaleFactor as R,applyPrecomputedScaleFactor as N,precomputeScaleFactor as V}from"../lib/screenSizePerspectiveUtils.js";import{assert as B}from"../lib/Util.js";import{VertexAttribute as G}from"../lib/VertexAttribute.js";import{writePosition as H,writeNormal as X,writeColor as k,writeBufferVec4 as F,writeObjectAndLayerIdColor as q}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as W}from"./internal/MaterialUtil.js";import{isInstanceHidden as Z}from"./renderers/utils.js";import{c as J}from"../../../../chunks/HUDMaterial.glsl.js";import{HUDMaterialTechnique as Y}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as K}from"../shaders/HUDMaterialTechniqueConfiguration.js";class Q extends U{constructor(e){super(e,new Ae),this._configuration=new K}getConfiguration(e,t){return this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits?z.Screen:z.World,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.isDraped=this.parameters.isDraped,this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.vvSize=!!this.parameters.vvSizeEnabled,this._configuration.vvColor=!!this.parameters.vvColorEnabled,this._configuration.occlusionPass=t.slot===w.OCCLUSION_PIXELS&&this.parameters.occlusionTest&&(e===j.Color||e===j.Alpha),e===j.Color&&(this._configuration.debugDrawLabelBorder=!!this.parameters.debugDrawLabelBorder),e===j.Highlight&&(this._configuration.binaryHighlightOcclusionEnabled=this.parameters.binaryHighlightOcclusion),this._configuration.depthEnabled=this.parameters.depthEnabled,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.hasMultipassGeometry=t.multipassGeometry.enabled,this._configuration.hasMultipassTerrain=t.multipassTerrain.enabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(e,r,s,i,a,n,o,c,l){t(l)?this._intersectDrapedHudGeometry(e,n,o,c,l):this._intersectHudGeometry(e,r,s,i,o,c)}_intersectDrapedHudGeometry(e,r,s,i,a){const n=e.vertexAttributes.get(G.POSITION),o=e.vertexAttributes.get(G.SIZE),c=this.parameters,l=J(c);let f=1,u=1;if(t(i)){const e=i(me);f=e[0],u=e[5]}f*=e.screenToWorldRatio,u*=e.screenToWorldRatio;const h=Oe*e.screenToWorldRatio;for(let t=0;t<n.data.length/n.size;t++){const i=t*n.size,p=n.data[i],d=n.data[i+1],m=t*o.size;let g;Se[0]=o.data[m]*f,Se[1]=o.data[m+1]*u,c.textureIsSignedDistanceField&&(g=c.outlineSize*e.screenToWorldRatio/2),re(r,p,d,Se,h,g,c,l)&&s(a.dist,a.normal,-1,!1)}}_intersectHudGeometry(e,r,i,n,o,c){if(!n.options.selectionMode||!n.options.hud||Z(r))return;const l=this.parameters;let S=1,v=1;if(s(fe,i),t(c)){const e=c(me);S=e[0],v=e[5],te(fe)}const A=e.vertexAttributes.get(G.POSITION),P=e.vertexAttributes.get(G.SIZE),x=e.vertexAttributes.get(G.NORMAL),y=e.vertexAttributes.get(G.AUXPOS1);B(A.size>=3);const I=n.point,_=n.camera,C=J(l);S*=_.pixelRatio,v*=_.pixelRatio;const T="screen"===this.parameters.centerOffsetUnits;for(let t=0;t<A.data.length/A.size;t++){const e=t*A.size;f(ae,A.data[e],A.data[e+1],A.data[e+2]),u(ae,ae,i);const r=t*P.size;Se[0]=P.data[r]*S,Se[1]=P.data[r+1]*v,u(ae,ae,_.viewMatrix);const s=t*y.size;if(f(pe,y.data[s+0],y.data[s+1],y.data[s+2]),!T&&(ae[0]+=pe[0],ae[1]+=pe[1],0!==pe[2])){const e=pe[2];h(pe,ae),p(ae,ae,d(pe,pe,e))}const c=t*x.size;if(f(ne,x.data[c],x.data[c+1],x.data[c+2]),this._normalAndViewAngle(ne,fe,_,de),this._applyVerticalOffsetTransformationView(ae,de,_,se),_.applyProjection(ae,oe),oe[0]>-1){oe[0]=Math.floor(oe[0]),oe[1]=Math.floor(oe[1]),T&&(pe[0]||pe[1])&&(oe[0]+=pe[0],0!==pe[1]&&(oe[1]+=R(pe[1],se.factorAlignment)),_.unapplyProjection(oe,ae)),oe[0]+=this.parameters.screenOffset[0],oe[1]+=this.parameters.screenOffset[1],N(Se,se.factor,Se);const e=ge*_.pixelRatio;let t;if(l.textureIsSignedDistanceField&&(t=l.outlineSize*_.pixelRatio/2),re(I,oe[0],oe[1],Se,e,t,l,C)){const e=n.ray;if(u(le,ae,a(he,_.viewMatrix)),oe[0]=I[0],oe[1]=I[1],_.unprojectFromRenderScreen(oe,ae)){const t=b();m(t,e.direction);const r=1/g(t);d(t,t,r);o(O(e.origin,ae)*r,t,-1,!0,1,le)}}}}}computeAttachmentOrigin(e,t){const r=e.vertexAttributes;if(!r)return!1;const s=r.get(G.POSITION),i=e.indices.get(G.POSITION);return L(s,i,t)}createBufferWriter(){return new xe(this)}_normalAndViewAngle(e,t,r,i){return I(t)&&(t=s(ue,t)),S(i.normal,e,t),u(i.normal,i.normal,r.viewInverseTransposeMatrix),i.cosAngle=v(ce,ve),i}_updateScaleInfo(e,r,s){const i=this.parameters;t(i.screenSizePerspective)?V(s,r,i.screenSizePerspective,e.factor):(e.factor.scale=1,e.factor.factor=0,e.factor.minPixelSize=0,e.factor.paddingPixels=0),t(i.screenSizePerspectiveAlignment)?V(s,r,i.screenSizePerspectiveAlignment,e.factorAlignment):(e.factorAlignment.factor=e.factor.factor,e.factorAlignment.scale=e.factor.scale,e.factorAlignment.minPixelSize=e.factor.minPixelSize,e.factorAlignment.paddingPixels=e.factor.paddingPixels)}applyShaderOffsetsView(e,t,r,s,i,a,n){const o=this._normalAndViewAngle(t,r,i,de);return this._applyVerticalGroundOffsetView(e,o,i,n),this._applyVerticalOffsetTransformationView(n,o,i,a),this._applyPolygonOffsetView(n,o,s[3],i,n),this._applyCenterOffsetView(n,s,n),n}applyShaderOffsetsNDC(e,r,s,i,a){return this._applyCenterOffsetNDC(e,r,s,i),t(a)&&m(a,i),this._applyPolygonOffsetNDC(i,r,s,i),i}_applyPolygonOffsetView(t,r,s,i,a){const n=i.aboveGround?1:-1;let o=Math.sign(s);0===o&&(o=n);const c=n*o;if(this.parameters.shaderPolygonOffset<=0)return m(a,t);const l=e(Math.abs(r.cosAngle),.01,1),f=1-Math.sqrt(1-l*l)/l/i.viewport[2];return d(a,t,c>0?f:1/f),a}_applyVerticalGroundOffsetView(e,t,r,s){const i=g(e),a=r.aboveGround?1:-1,n=.5*r.computeRenderPixelSizeAtDist(i),o=d(ae,t.normal,a*n);return A(s,e,o),s}_applyVerticalOffsetTransformationView(e,t,s,i){const a=this.parameters;if(!a.verticalOffset||!a.verticalOffset.screenLength){if(a.screenSizePerspective||a.screenSizePerspectiveAlignment){const r=g(e);this._updateScaleInfo(i,r,t.cosAngle)}else i.factor.scale=1,i.factorAlignment.scale=1;return e}const n=g(e),o=r(a.screenSizePerspectiveAlignment,a.screenSizePerspective),c=W(s,n,a.verticalOffset,t.cosAngle,o);return this._updateScaleInfo(i,n,t.cosAngle),d(t.normal,t.normal,c),A(e,e,t.normal)}_applyCenterOffsetView(e,t,r){const s="screen"!==this.parameters.centerOffsetUnits;return r!==e&&m(r,e),s&&(r[0]+=t[0],r[1]+=t[1],t[2]&&(h(ne,r),A(r,r,d(ne,ne,t[2])))),r}_applyCenterOffsetNDC(e,t,r,s){const i="screen"!==this.parameters.centerOffsetUnits;return s!==e&&m(s,e),i||(s[0]+=t[0]/r.fullWidth*2,s[1]+=t[1]/r.fullHeight*2),s}_applyPolygonOffsetNDC(e,t,r,s){const i=this.parameters.shaderPolygonOffset;if(e!==s&&m(s,e),i){const e=r.aboveGround?1:-1,a=e*Math.sign(t[3]);s[2]-=(a||e)*i}return s}requiresSlot(e,t){if(t===j.Color||t===j.Alpha||t===j.Highlight||t===j.ObjectAndLayerIdColor){if(e===w.DRAPED_MATERIAL)return!0;const{drawInSecondSlot:t,occlusionTest:r}=this.parameters;return e===(t?w.LABEL_MATERIAL:w.HUD_MATERIAL)||r&&e===w.OCCLUSION_PIXELS}return!1}createGLMaterial(e){return new $(e)}calculateRelativeScreenBounds(e,t,r=_()){return ee(this.parameters,e,t,r),r[2]=r[0]+e[0],r[3]=r[1]+e[1],r}}class $ extends M{constructor(e){super({...e,...e.material.parameters})}selectProgram(e){return this.ensureTechnique(Y,e)}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.selectProgram(e)}}function ee(e,t,r,s=ie){return o(s,e.anchorPosition),s[0]*=-t[0],s[1]*=-t[1],s[0]+=e.screenOffset[0]*r,s[1]+=e.screenOffset[1]*r,s}function te(e){const t=e[0],r=e[1],s=e[2],i=e[3],a=e[4],n=e[5],o=e[6],c=e[7],l=e[8],f=1/Math.sqrt(t*t+r*r+s*s),u=1/Math.sqrt(i*i+a*a+n*n),h=1/Math.sqrt(o*o+c*c+l*l);return e[0]=t*f,e[1]=r*f,e[2]=s*f,e[3]=i*u,e[4]=a*u,e[5]=n*u,e[6]=o*h,e[7]=c*h,e[8]=l*h,e}function re(e,r,s,i,a,n,o,c){let l=r-a-(c[0]>0?i[0]*c[0]:0),f=l+i[0]+2*a,u=s-a-(c[1]>0?i[1]*c[1]:0),h=u+i[1]+2*a;const p=o.distanceFieldBoundingBox;return o.textureIsSignedDistanceField&&t(p)&&(l+=i[0]*p[0],u+=i[1]*p[1],f-=i[0]*(1-p[2]),h-=i[1]*(1-p[3]),l-=n,f+=n,u-=n,h+=n),e[0]>l&&e[0]<f&&e[1]>u&&e[1]<h}const se={factor:{scale:0,factor:0,minPixelSize:0,paddingPixels:0},factorAlignment:{scale:0,factor:0,minPixelSize:0,paddingPixels:0}},ie=c(),ae=b(),ne=b(),oe=x(),ce=b(),le=b(),fe=i(),ue=i(),he=n(),pe=b(),de={normal:ce,cosAngle:0},me=n(),ge=1,Oe=2,Se=[0,0],ve=P(0,0,1);class Ae extends D{constructor(){super(...arguments),this.renderOccluded=E.Occlude,this.color=y(1,1,1,1),this.texCoordScale=[1,1],this.polygonOffset=!1,this.anchorPosition=l(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.outlineColor=y(1,1,1,1),this.outlineSize=0,this.vvSizeEnabled=!1,this.vvSizeMinSize=[1,1,1],this.vvSizeMaxSize=[100,100,100],this.vvSizeOffset=[0,0,0],this.vvSizeFactor=[1,1,1],this.vvColorEnabled=!1,this.vvColorValues=[0,0,0,0,0,0,0,0],this.vvColorColors=[1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0],this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.occlusionTest=!0,this.binaryHighlightOcclusion=!0,this.debugDrawLabelBorder=!1,this.centerOffsetUnits="world",this.drawInSecondSlot=!1,this.depthEnabled=!0,this.isDraped=!1}}const be=T().vec3f(G.POSITION).vec3f(G.NORMAL).vec2f(G.UV0).vec4u8(G.COLOR).vec2f(G.SIZE).vec4f(G.AUXPOS1).vec4f(G.AUXPOS2),Pe=be.clone().vec4u8(G.OBJECTANDLAYERIDCOLOR);class xe{constructor(e){this._material=e,this.vertexBufferLayout=has("enable-feature:objectAndLayerId-rendering")?Pe:be}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return 6*e.indices.get(G.POSITION).length}write(e,r,s,i){H(r.indices.get(G.POSITION),r.vertexAttributes.get(G.POSITION).data,e.transformation,s.position,i,6),X(r.indices.get(G.NORMAL),r.vertexAttributes.get(G.NORMAL).data,e.invTranspTransformation,s.normal,i,6);{const e=r.vertexAttributes.get(G.UV0).data;let t,a,n,o;if(null==e||e.length<4){const e=this._material.parameters;t=0,a=0,n=e.texCoordScale[0],o=e.texCoordScale[1]}else t=e[0],a=e[1],n=e[2],o=e[3];n=Math.min(1.99999,n+1),o=Math.min(1.99999,o+1);const c=r.indices.get(G.POSITION).length,l=s.uv0;let f=i;for(let r=0;r<c;++r)l.set(f,0,t),l.set(f,1,a),f+=1,l.set(f,0,n),l.set(f,1,a),f+=1,l.set(f,0,n),l.set(f,1,o),f+=1,l.set(f,0,n),l.set(f,1,o),f+=1,l.set(f,0,t),l.set(f,1,o),f+=1,l.set(f,0,t),l.set(f,1,a),f+=1}k(r.indices.get(G.COLOR),r.vertexAttributes.get(G.COLOR).data,4,s.color,i,6);{const e=r.indices.get(G.SIZE),t=r.vertexAttributes.get(G.SIZE).data,a=e.length,n=s.size;let o=i;for(let r=0;r<a;++r){const s=t[2*e[r]],i=t[2*e[r]+1];for(let e=0;e<6;++e)n.set(o,0,s),n.set(o,1,i),o+=1}}if(r.indices.get(G.AUXPOS1)&&r.vertexAttributes.get(G.AUXPOS1)&&F(r.indices.get(G.AUXPOS1),r.vertexAttributes.get(G.AUXPOS1).data,s.auxpos1,i,6),r.indices.get(G.AUXPOS2)&&r.vertexAttributes.get(G.AUXPOS2)&&F(r.indices.get(G.AUXPOS2),r.vertexAttributes.get(G.AUXPOS2).data,s.auxpos2,i,6),t(r.objectAndLayerIdColor)&&4===r.objectAndLayerIdColor.length){if(r.indices.get(G.POSITION)){const e=r.indices.get(G.POSITION).length,t=s.getField(G.OBJECTANDLAYERIDCOLOR,C);q(r.objectAndLayerIdColor,t,e,i,6)}}}}export{Q as HUDMaterial,Ae as Parameters};
5
+ import has from"../../../../core/has.js";import{clamp as e}from"../../../../core/mathUtils.js";import{isSome as t,unwrapOr as r}from"../../../../core/maybe.js";import{f as s}from"../../../../chunks/mat3.js";import{c as i}from"../../../../chunks/mat3f64.js";import{a}from"../../../../chunks/mat4.js";import{c as n}from"../../../../chunks/mat4f64.js";import{c as o}from"../../../../chunks/vec2.js";import{a as c,f as l}from"../../../../chunks/vec2f64.js";import{s as f,v as u,n as h,b as p,g as d,c as m,l as g,i as O,t as S,e as v,a as A}from"../../../../chunks/vec3.js";import{c as b,f as P}from"../../../../chunks/vec3f64.js";import{c as x,f as y}from"../../../../chunks/vec4f64.js";import{isMat4 as I}from"../../../../core/libs/gl-matrix-2/types/mat4.js";import{create as _}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as C}from"../../../../geometry/support/buffer/BufferView.js";import{newLayout as T}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as j}from"../core/shaderLibrary/ShaderOutput.js";import{HUDSpace as z}from"../core/shaderLibrary/hud/HUD.glsl.js";import{computeAttachmentOriginPoints as L}from"../lib/geometryDataUtils.js";import{GLTextureMaterial as M,GLTextureMaterialBindParameters as D}from"../lib/GLTextureMaterial.js";import{Material as U,RenderOccludedFlag as E}from"../lib/Material.js";import{RenderSlot as w}from"../lib/RenderSlot.js";import{applyScaleFactor as R,applyPrecomputedScaleFactor as N,precomputeScaleFactor as V}from"../lib/screenSizePerspectiveUtils.js";import{assert as B}from"../lib/Util.js";import{VertexAttribute as G}from"../lib/VertexAttribute.js";import{writePosition as H,writeNormal as X,writeColor as k,writeBufferVec4 as F,writeObjectAndLayerIdColor as q}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as W}from"./internal/MaterialUtil.js";import{isInstanceHidden as Z}from"./renderers/utils.js";import{c as J}from"../../../../chunks/HUDMaterial.glsl.js";import{HUDMaterialTechnique as Y}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as K}from"../shaders/HUDMaterialTechniqueConfiguration.js";class Q extends U{constructor(e){super(e,new Ae),this._configuration=new K}getConfiguration(e,t){return this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits?z.Screen:z.World,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.isDraped=this.parameters.isDraped,this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.vvSize=!!this.parameters.vvSizeEnabled,this._configuration.vvColor=!!this.parameters.vvColorEnabled,this._configuration.occlusionPass=t.slot===w.OCCLUSION_PIXELS&&this.parameters.occlusionTest&&(e===j.Color||e===j.Alpha),e===j.Color&&(this._configuration.debugDrawLabelBorder=!!this.parameters.debugDrawLabelBorder),e===j.Highlight&&(this._configuration.binaryHighlightOcclusionEnabled=this.parameters.binaryHighlightOcclusion),this._configuration.depthEnabled=this.parameters.depthEnabled,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.hasMultipassGeometry=t.multipassGeometry.enabled,this._configuration.hasMultipassTerrain=t.multipassTerrain.enabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(e,r,s,i,a,n,o,c,l){t(l)?this._intersectDrapedHudGeometry(e,n,o,c,l):this._intersectHudGeometry(e,r,s,i,o,c)}_intersectDrapedHudGeometry(e,r,s,i,a){const n=e.vertexAttributes.get(G.POSITION),o=e.vertexAttributes.get(G.SIZE),c=this.parameters,l=J(c);let f=1,u=1;if(t(i)){const e=i(me);f=e[0],u=e[5]}f*=e.screenToWorldRatio,u*=e.screenToWorldRatio;const h=Oe*e.screenToWorldRatio;for(let t=0;t<n.data.length/n.size;t++){const i=t*n.size,p=n.data[i],d=n.data[i+1],m=t*o.size;let g;Se[0]=o.data[m]*f,Se[1]=o.data[m+1]*u,c.textureIsSignedDistanceField&&(g=c.outlineSize*e.screenToWorldRatio/2),re(r,p,d,Se,h,g,c,l)&&s(a.dist,a.normal,-1,!1)}}_intersectHudGeometry(e,r,i,n,o,c){if(!n.options.selectionMode||!n.options.hud||Z(r))return;const l=this.parameters;let S=1,v=1;if(s(fe,i),t(c)){const e=c(me);S=e[0],v=e[5],te(fe)}const A=e.vertexAttributes.get(G.POSITION),P=e.vertexAttributes.get(G.SIZE),x=e.vertexAttributes.get(G.NORMAL),y=e.vertexAttributes.get(G.AUXPOS1);B(A.size>=3);const I=n.point,_=n.camera,C=J(l);S*=_.pixelRatio,v*=_.pixelRatio;const T="screen"===this.parameters.centerOffsetUnits;for(let t=0;t<A.data.length/A.size;t++){const e=t*A.size;f(ae,A.data[e],A.data[e+1],A.data[e+2]),u(ae,ae,i);const r=t*P.size;Se[0]=P.data[r]*S,Se[1]=P.data[r+1]*v,u(ae,ae,_.viewMatrix);const s=t*y.size;if(f(pe,y.data[s+0],y.data[s+1],y.data[s+2]),!T&&(ae[0]+=pe[0],ae[1]+=pe[1],0!==pe[2])){const e=pe[2];h(pe,ae),p(ae,ae,d(pe,pe,e))}const c=t*x.size;if(f(ne,x.data[c],x.data[c+1],x.data[c+2]),this._normalAndViewAngle(ne,fe,_,de),this._applyVerticalOffsetTransformationView(ae,de,_,se),_.applyProjection(ae,oe),oe[0]>-1){oe[0]=Math.floor(oe[0]),oe[1]=Math.floor(oe[1]),T&&(pe[0]||pe[1])&&(oe[0]+=pe[0],0!==pe[1]&&(oe[1]+=R(pe[1],se.factorAlignment)),_.unapplyProjection(oe,ae)),oe[0]+=this.parameters.screenOffset[0],oe[1]+=this.parameters.screenOffset[1],N(Se,se.factor,Se);const e=ge*_.pixelRatio;let t;if(l.textureIsSignedDistanceField&&(t=l.outlineSize*_.pixelRatio/2),re(I,oe[0],oe[1],Se,e,t,l,C)){const e=n.ray;if(u(le,ae,a(he,_.viewMatrix)),oe[0]=I[0],oe[1]=I[1],_.unprojectFromRenderScreen(oe,ae)){const t=b();m(t,e.direction);const r=1/g(t);d(t,t,r);o(O(e.origin,ae)*r,t,-1,!0,1,le)}}}}}computeAttachmentOrigin(e,t){const r=e.vertexAttributes;if(!r)return!1;const s=r.get(G.POSITION),i=e.indices.get(G.POSITION);return L(s,i,t)}createBufferWriter(){return new xe(this)}_normalAndViewAngle(e,t,r,i){return I(t)&&(t=s(ue,t)),S(i.normal,e,t),u(i.normal,i.normal,r.viewInverseTransposeMatrix),i.cosAngle=v(ce,ve),i}_updateScaleInfo(e,r,s){const i=this.parameters;t(i.screenSizePerspective)?V(s,r,i.screenSizePerspective,e.factor):(e.factor.scale=1,e.factor.factor=0,e.factor.minPixelSize=0,e.factor.paddingPixels=0),t(i.screenSizePerspectiveAlignment)?V(s,r,i.screenSizePerspectiveAlignment,e.factorAlignment):(e.factorAlignment.factor=e.factor.factor,e.factorAlignment.scale=e.factor.scale,e.factorAlignment.minPixelSize=e.factor.minPixelSize,e.factorAlignment.paddingPixels=e.factor.paddingPixels)}applyShaderOffsetsView(e,t,r,s,i,a,n){const o=this._normalAndViewAngle(t,r,i,de);return this._applyVerticalGroundOffsetView(e,o,i,n),this._applyVerticalOffsetTransformationView(n,o,i,a),this._applyPolygonOffsetView(n,o,s[3],i,n),this._applyCenterOffsetView(n,s,n),n}applyShaderOffsetsNDC(e,r,s,i,a){return this._applyCenterOffsetNDC(e,r,s,i),t(a)&&m(a,i),this._applyPolygonOffsetNDC(i,r,s,i),i}_applyPolygonOffsetView(t,r,s,i,a){const n=i.aboveGround?1:-1;let o=Math.sign(s);0===o&&(o=n);const c=n*o;if(this.parameters.shaderPolygonOffset<=0)return m(a,t);const l=e(Math.abs(r.cosAngle),.01,1),f=1-Math.sqrt(1-l*l)/l/i.viewport[2];return d(a,t,c>0?f:1/f),a}_applyVerticalGroundOffsetView(e,t,r,s){const i=g(e),a=r.aboveGround?1:-1,n=.5*r.computeRenderPixelSizeAtDist(i),o=d(ae,t.normal,a*n);return A(s,e,o),s}_applyVerticalOffsetTransformationView(e,t,s,i){const a=this.parameters;if(!a.verticalOffset||!a.verticalOffset.screenLength){if(a.screenSizePerspective||a.screenSizePerspectiveAlignment){const r=g(e);this._updateScaleInfo(i,r,t.cosAngle)}else i.factor.scale=1,i.factorAlignment.scale=1;return e}const n=g(e),o=r(a.screenSizePerspectiveAlignment,a.screenSizePerspective),c=W(s,n,a.verticalOffset,t.cosAngle,o);return this._updateScaleInfo(i,n,t.cosAngle),d(t.normal,t.normal,c),A(e,e,t.normal)}_applyCenterOffsetView(e,t,r){const s="screen"!==this.parameters.centerOffsetUnits;return r!==e&&m(r,e),s&&(r[0]+=t[0],r[1]+=t[1],t[2]&&(h(ne,r),A(r,r,d(ne,ne,t[2])))),r}_applyCenterOffsetNDC(e,t,r,s){const i="screen"!==this.parameters.centerOffsetUnits;return s!==e&&m(s,e),i||(s[0]+=t[0]/r.fullWidth*2,s[1]+=t[1]/r.fullHeight*2),s}_applyPolygonOffsetNDC(e,t,r,s){const i=this.parameters.shaderPolygonOffset;if(e!==s&&m(s,e),i){const e=r.aboveGround?1:-1,a=e*Math.sign(t[3]);s[2]-=(a||e)*i}return s}requiresSlot(e,t){if(t===j.Color||t===j.Alpha||t===j.Highlight||t===j.ObjectAndLayerIdColor){if(e===w.DRAPED_MATERIAL)return!0;const{drawInSecondSlot:t,occlusionTest:r}=this.parameters;return e===(t?w.LABEL_MATERIAL:w.HUD_MATERIAL)||r&&e===w.OCCLUSION_PIXELS}return!1}createGLMaterial(e){return new $(e)}calculateRelativeScreenBounds(e,t,r=_()){return ee(this.parameters,e,t,r),r[2]=r[0]+e[0],r[3]=r[1]+e[1],r}}class $ extends M{constructor(e){super({...e,...e.material.parameters})}selectProgram(e){return this.ensureTechnique(Y,e)}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.selectProgram(e)}}function ee(e,t,r,s=ie){return o(s,e.anchorPosition),s[0]*=-t[0],s[1]*=-t[1],s[0]+=e.screenOffset[0]*r,s[1]+=e.screenOffset[1]*r,s}function te(e){const t=e[0],r=e[1],s=e[2],i=e[3],a=e[4],n=e[5],o=e[6],c=e[7],l=e[8],f=1/Math.sqrt(t*t+r*r+s*s),u=1/Math.sqrt(i*i+a*a+n*n),h=1/Math.sqrt(o*o+c*c+l*l);return e[0]=t*f,e[1]=r*f,e[2]=s*f,e[3]=i*u,e[4]=a*u,e[5]=n*u,e[6]=o*h,e[7]=c*h,e[8]=l*h,e}function re(e,r,s,i,a,n,o,c){let l=r-a-(c[0]>0?i[0]*c[0]:0),f=l+i[0]+2*a,u=s-a-(c[1]>0?i[1]*c[1]:0),h=u+i[1]+2*a;const p=o.distanceFieldBoundingBox;return o.textureIsSignedDistanceField&&t(p)&&(l+=i[0]*p[0],u+=i[1]*p[1],f-=i[0]*(1-p[2]),h-=i[1]*(1-p[3]),l-=n,f+=n,u-=n,h+=n),e[0]>l&&e[0]<f&&e[1]>u&&e[1]<h}const se={factor:{scale:0,factor:0,minPixelSize:0,paddingPixels:0},factorAlignment:{scale:0,factor:0,minPixelSize:0,paddingPixels:0}},ie=c(),ae=b(),ne=b(),oe=x(),ce=b(),le=b(),fe=i(),ue=i(),he=n(),pe=b(),de={normal:ce,cosAngle:0},me=n(),ge=1,Oe=2,Se=[0,0],ve=P(0,0,1);class Ae extends D{constructor(){super(...arguments),this.renderOccluded=E.Occlude,this.color=y(1,1,1,1),this.texCoordScale=[1,1],this.polygonOffset=!1,this.anchorPosition=l(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.outlineColor=y(1,1,1,1),this.outlineSize=0,this.vvSizeEnabled=!1,this.vvSizeMinSize=[1,1,1],this.vvSizeMaxSize=[100,100,100],this.vvSizeOffset=[0,0,0],this.vvSizeFactor=[1,1,1],this.vvColorEnabled=!1,this.vvColorValues=[0,0,0,0,0,0,0,0],this.vvColorColors=[1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0],this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.occlusionTest=!0,this.binaryHighlightOcclusion=!0,this.debugDrawLabelBorder=!1,this.centerOffsetUnits="world",this.drawInSecondSlot=!1,this.depthEnabled=!0,this.isDraped=!1}}const be=T().vec3f(G.POSITION).vec3f(G.NORMAL).vec2f(G.UV0).vec4u8(G.COLOR).vec2f(G.SIZE).vec4f(G.AUXPOS1).vec4f(G.AUXPOS2),Pe=be.clone().vec4u8(G.OBJECTANDLAYERIDCOLOR);class xe{constructor(e){this._material=e,this.vertexBufferLayout=has("enable-feature:objectAndLayerId-rendering")?Pe:be}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return 6*e.indices.get(G.POSITION).length}write(e,r,s,i){H(r.indices.get(G.POSITION),r.vertexAttributes.get(G.POSITION).data,e.transformation,s.position,i,6),X(r.indices.get(G.NORMAL),r.vertexAttributes.get(G.NORMAL).data,e.invTranspTransformation,s.normal,i,6);{const e=r.vertexAttributes.get(G.UV0).data;let t,a,n,o;if(null==e||e.length<4){const e=this._material.parameters;t=0,a=0,n=e.texCoordScale[0],o=e.texCoordScale[1]}else t=e[0],a=e[1],n=e[2],o=e[3];n=Math.min(1.99999,n+1),o=Math.min(1.99999,o+1);const c=r.indices.get(G.POSITION).length,l=s.uv0;let f=i;for(let r=0;r<c;++r)l.set(f,0,t),l.set(f,1,a),f+=1,l.set(f,0,n),l.set(f,1,a),f+=1,l.set(f,0,n),l.set(f,1,o),f+=1,l.set(f,0,n),l.set(f,1,o),f+=1,l.set(f,0,t),l.set(f,1,o),f+=1,l.set(f,0,t),l.set(f,1,a),f+=1}k(r.indices.get(G.COLOR),r.vertexAttributes.get(G.COLOR).data,4,s.color,i,6);{const e=r.indices.get(G.SIZE),t=r.vertexAttributes.get(G.SIZE).data,a=e.length,n=s.size;let o=i;for(let r=0;r<a;++r){const s=t[2*e[r]],i=t[2*e[r]+1];for(let e=0;e<6;++e)n.set(o,0,s),n.set(o,1,i),o+=1}}if(r.indices.get(G.AUXPOS1)&&r.vertexAttributes.get(G.AUXPOS1)&&F(r.indices.get(G.AUXPOS1),r.vertexAttributes.get(G.AUXPOS1).data,s.auxpos1,i,6),r.indices.get(G.AUXPOS2)&&r.vertexAttributes.get(G.AUXPOS2)&&F(r.indices.get(G.AUXPOS2),r.vertexAttributes.get(G.AUXPOS2).data,s.auxpos2,i,6),t(r.objectAndLayerIdColor)&&4===r.objectAndLayerIdColor.length){if(r.indices.get(G.POSITION)){const e=r.indices.get(G.POSITION).length,t=s.getField(G.OBJECTANDLAYERIDCOLOR,C);q(r.objectAndLayerIdColor,t,e,i,6)}}}}export{Q as HUDMaterial,Ae as Parameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as e}from"../../../../core/maybe.js";import{s as t,F as r,m as a}from"../../../../chunks/vec3.js";import{c as s}from"../../../../chunks/vec3f64.js";import{newLayout as i}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as n}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as o}from"../lib/GLTextureMaterial.js";import{Material as c,RenderOccludedFlag as h}from"../lib/Material.js";import{RenderSlot as u}from"../lib/RenderSlot.js";import{VertexAttribute as l}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as p}from"./VisualVariablePassParameters.js";import{vertexAttributeLocations as m,LineMarkerTechnique as d}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as f,LineMarkerAnchor as E}from"../shaders/LineMarkerTechniqueConfiguration.js";import{CapType as A}from"../shaders/RibbonLineTechniqueConfiguration.js";class T extends c{constructor(e){super(e,new _),this._vertexAttributeLocations=m,this._configuration=new f,this._layout=this.createLayout()}dispose(){}getConfiguration(t,r){return this._configuration.output=t,this._configuration.draped=r.slot===u.DRAPED_MATERIAL,this._configuration.hasCap=this.parameters.cap!==A.BUTT,this._configuration.anchor=this.parameters.anchor,this._configuration.applyPerspective=e(this.parameters.perspectiveEffectSegmentLengthFraction),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvColor=this.parameters.vvColorEnabled,this._configuration.vvOpacity=this.parameters.vvOpacityEnabled,this._configuration.vvSize=this.parameters.vvSizeEnabled,this._configuration.occluder=this.parameters.renderOccluded===h.OccludeAndTransparentStencil,this._configuration.transparencyPassType=r.transparencyPassType,this._configuration.hasMultipassTerrain=r.multipassTerrain.enabled,this._configuration.cullAboveGround=r.multipassTerrain.cullAboveGround,this._configuration}intersect(){}createLayout(){const e=i().vec3f(l.POSITION).vec2f(l.UV0).vec3f(l.AUXPOS1);return this.parameters.vvSizeEnabled?e.f32(l.SIZEFEATUREATTRIBUTE):e.f32(l.SIZE),this.parameters.vvColorEnabled?e.f32(l.COLORFEATUREATTRIBUTE):e.vec4f(l.COLOR),this.parameters.vvOpacityEnabled&&e.f32(l.OPACITYFEATUREATTRIBUTE),e}createBufferWriter(){return new b(this._layout,this.parameters)}requiresSlot(e,t){if(t===n.Color||t===n.Alpha||t===n.Highlight||t===n.Depth){if(e===u.DRAPED_MATERIAL)return!0;if(this.parameters.renderOccluded===h.OccludeAndTransparentStencil)return e===u.OPAQUE_MATERIAL||e===u.OCCLUDER_MATERIAL||e===u.TRANSPARENT_OCCLUDER_MATERIAL;if(t===n.Color||t===n.Alpha){return e===(this.parameters.writeDepth?u.TRANSPARENT_MATERIAL:u.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL)}return e===u.OPAQUE_MATERIAL}return!1}createGLMaterial(e){return new v(e)}}class v extends o{_updateParameters(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(d,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output!==n.Color&&this._output!==n.Alpha||this._updateOccludeeState(e),this._updateParameters(e)}}class _ extends p{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.placement="end",this.cap=A.BUTT,this.anchor=E.Center,this.perspectiveEffectSegmentLengthFraction=null,this.writeDepth=!0,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.hasOccludees=!1}}class b{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(){return"begin-end"===this._parameters.placement?12:6}write(e,s,i,n){const o=s.vertexAttributes.get(l.POSITION).data,c=o.length/3;let h=1,u=0;this._parameters.vvSizeEnabled?u=s.vertexAttributes.get(l.SIZEFEATUREATTRIBUTE).data[0]:s.vertexAttributes.has(l.SIZE)&&(h=s.vertexAttributes.get(l.SIZE).data[0]);let p=[1,1,1,1],m=0;this._parameters.vvColorEnabled?m=s.vertexAttributes.get(l.COLORFEATUREATTRIBUTE).data[0]:s.vertexAttributes.has(l.COLOR)&&(p=s.vertexAttributes.get(l.COLOR).data);let d=0;this._parameters.vvOpacityEnabled&&(d=s.vertexAttributes.get(l.OPACITYFEATUREATTRIBUTE).data[0]);const f=e.transformation,E=new Float32Array(i.buffer);let A=n*(this.vertexBufferLayout.stride/4);const T=(e,t,r,a)=>{if(E[A++]=e[0],E[A++]=e[1],E[A++]=e[2],E[A++]=r[0],E[A++]=r[1],E[A++]=t[0],E[A++]=t[1],E[A++]=t[2],this._parameters.vvSizeEnabled?E[A++]=u:E[A++]=h,this._parameters.vvColorEnabled)E[A++]=m;else{const e=Math.min(4*a,p.length-4);E[A++]=p[e+0],E[A++]=p[e+1],E[A++]=p[e+2],E[A++]=p[e+3]}this._parameters.vvOpacityEnabled&&(E[A++]=d)};let v;!function(e){e[e.ASCENDING=1]="ASCENDING",e[e.DESCENDING=-1]="DESCENDING"}(v||(v={}));const _=(e,s)=>{const i=t(g,o[3*e],o[3*e+1],o[3*e+2]),n=O;let h=e+s;do{t(n,o[3*h],o[3*h+1],o[3*h+2]),h+=s}while(r(i,n)&&h>=0&&h<c);f&&(a(i,i,f),a(n,n,f)),T(i,n,[-1,-1],e),T(i,n,[1,-1],e),T(i,n,[1,1],e),T(i,n,[-1,-1],e),T(i,n,[1,1],e),T(i,n,[-1,1],e)},b=this._parameters.placement;"begin"!==b&&"begin-end"!==b||_(0,v.ASCENDING),"end"!==b&&"begin-end"!==b||_(c-1,v.DESCENDING)}}const g=s(),O=s();export{T as LineMarkerMaterial,_ as Parameters};
5
+ import{isSome as e}from"../../../../core/maybe.js";import{s as t,F as r,v as a}from"../../../../chunks/vec3.js";import{c as s}from"../../../../chunks/vec3f64.js";import{newLayout as i}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as n}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as o}from"../lib/GLTextureMaterial.js";import{Material as c,RenderOccludedFlag as h}from"../lib/Material.js";import{RenderSlot as u}from"../lib/RenderSlot.js";import{VertexAttribute as l}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as p}from"./VisualVariablePassParameters.js";import{vertexAttributeLocations as m,LineMarkerTechnique as d}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as f,LineMarkerAnchor as E}from"../shaders/LineMarkerTechniqueConfiguration.js";import{CapType as A}from"../shaders/RibbonLineTechniqueConfiguration.js";class T extends c{constructor(e){super(e,new _),this._vertexAttributeLocations=m,this._configuration=new f,this._layout=this.createLayout()}dispose(){}getConfiguration(t,r){return this._configuration.output=t,this._configuration.draped=r.slot===u.DRAPED_MATERIAL,this._configuration.hasCap=this.parameters.cap!==A.BUTT,this._configuration.anchor=this.parameters.anchor,this._configuration.applyPerspective=e(this.parameters.perspectiveEffectSegmentLengthFraction),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvColor=this.parameters.vvColorEnabled,this._configuration.vvOpacity=this.parameters.vvOpacityEnabled,this._configuration.vvSize=this.parameters.vvSizeEnabled,this._configuration.occluder=this.parameters.renderOccluded===h.OccludeAndTransparentStencil,this._configuration.transparencyPassType=r.transparencyPassType,this._configuration.hasMultipassTerrain=r.multipassTerrain.enabled,this._configuration.cullAboveGround=r.multipassTerrain.cullAboveGround,this._configuration}intersect(){}createLayout(){const e=i().vec3f(l.POSITION).vec2f(l.UV0).vec3f(l.AUXPOS1);return this.parameters.vvSizeEnabled?e.f32(l.SIZEFEATUREATTRIBUTE):e.f32(l.SIZE),this.parameters.vvColorEnabled?e.f32(l.COLORFEATUREATTRIBUTE):e.vec4f(l.COLOR),this.parameters.vvOpacityEnabled&&e.f32(l.OPACITYFEATUREATTRIBUTE),e}createBufferWriter(){return new b(this._layout,this.parameters)}requiresSlot(e,t){if(t===n.Color||t===n.Alpha||t===n.Highlight||t===n.Depth){if(e===u.DRAPED_MATERIAL)return!0;if(this.parameters.renderOccluded===h.OccludeAndTransparentStencil)return e===u.OPAQUE_MATERIAL||e===u.OCCLUDER_MATERIAL||e===u.TRANSPARENT_OCCLUDER_MATERIAL;if(t===n.Color||t===n.Alpha){return e===(this.parameters.writeDepth?u.TRANSPARENT_MATERIAL:u.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL)}return e===u.OPAQUE_MATERIAL}return!1}createGLMaterial(e){return new v(e)}}class v extends o{_updateParameters(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(d,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output!==n.Color&&this._output!==n.Alpha||this._updateOccludeeState(e),this._updateParameters(e)}}class _ extends p{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.placement="end",this.cap=A.BUTT,this.anchor=E.Center,this.perspectiveEffectSegmentLengthFraction=null,this.writeDepth=!0,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.hasOccludees=!1}}class b{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(){return"begin-end"===this._parameters.placement?12:6}write(e,s,i,n){const o=s.vertexAttributes.get(l.POSITION).data,c=o.length/3;let h=1,u=0;this._parameters.vvSizeEnabled?u=s.vertexAttributes.get(l.SIZEFEATUREATTRIBUTE).data[0]:s.vertexAttributes.has(l.SIZE)&&(h=s.vertexAttributes.get(l.SIZE).data[0]);let p=[1,1,1,1],m=0;this._parameters.vvColorEnabled?m=s.vertexAttributes.get(l.COLORFEATUREATTRIBUTE).data[0]:s.vertexAttributes.has(l.COLOR)&&(p=s.vertexAttributes.get(l.COLOR).data);let d=0;this._parameters.vvOpacityEnabled&&(d=s.vertexAttributes.get(l.OPACITYFEATUREATTRIBUTE).data[0]);const f=e.transformation,E=new Float32Array(i.buffer);let A=n*(this.vertexBufferLayout.stride/4);const T=(e,t,r,a)=>{if(E[A++]=e[0],E[A++]=e[1],E[A++]=e[2],E[A++]=r[0],E[A++]=r[1],E[A++]=t[0],E[A++]=t[1],E[A++]=t[2],this._parameters.vvSizeEnabled?E[A++]=u:E[A++]=h,this._parameters.vvColorEnabled)E[A++]=m;else{const e=Math.min(4*a,p.length-4);E[A++]=p[e+0],E[A++]=p[e+1],E[A++]=p[e+2],E[A++]=p[e+3]}this._parameters.vvOpacityEnabled&&(E[A++]=d)};let v;!function(e){e[e.ASCENDING=1]="ASCENDING",e[e.DESCENDING=-1]="DESCENDING"}(v||(v={}));const _=(e,s)=>{const i=t(g,o[3*e],o[3*e+1],o[3*e+2]),n=O;let h=e+s;do{t(n,o[3*h],o[3*h+1],o[3*h+2]),h+=s}while(r(i,n)&&h>=0&&h<c);f&&(a(i,i,f),a(n,n,f)),T(i,n,[-1,-1],e),T(i,n,[1,-1],e),T(i,n,[1,1],e),T(i,n,[-1,-1],e),T(i,n,[1,1],e),T(i,n,[-1,1],e)},b=this._parameters.placement;"begin"!==b&&"begin-end"!==b||_(0,v.ASCENDING),"end"!==b&&"begin-end"!==b||_(c-1,v.DESCENDING)}}const g=s(),O=s();export{T as LineMarkerMaterial,_ as Parameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{s as t,n as e,b as r,f as s,i as o,m as i}from"../../../../chunks/vec3.js";import{c as n}from"../../../../chunks/vec3f64.js";import{f as a}from"../../../../chunks/vec4f64.js";import{newLayout as c}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as u}from"../core/shaderLibrary/ShaderOutput.js";import f from"../lib/GLMaterial.js";import{Material as l,MaterialParameters as p}from"../lib/Material.js";import{RenderSlot as h}from"../lib/RenderSlot.js";import{VertexAttribute as m}from"../lib/VertexAttribute.js";import{MeasurementArrowTechniqueConfiguration as d,MeasurementArrowTechnique as g}from"../shaders/MeasurementArrowTechnique.js";class O extends l{constructor(t){super(t,new b),this._configuration=new d}getConfiguration(t,e){return this._configuration.polygonOffsetEnabled=this.parameters.polygonOffset,this._configuration.transparent=this.parameters.stripeEvenColor[3]<1||this.parameters.stripeOddColor[3]<1||this.parameters.outlineColor[3]<1,this._configuration.transparencyPassType=e.transparencyPassType,this._configuration}dispose(){}intersect(){}requiresSlot(t,e){return e===u.Color&&t===h.OPAQUE_MATERIAL}createGLMaterial(t){return new v(t)}createBufferWriter(){return new L}}class v extends f{beginSlot(t){return this.ensureTechnique(g,t)}}class b extends p{constructor(){super(...arguments),this.width=32,this.outlineSize=.2,this.outlineColor=a(1,.5,0,1),this.stripeEvenColor=a(1,1,1,1),this.stripeOddColor=a(1,.5,0,1),this.stripeLength=1,this.polygonOffset=!1}}const y=c().vec3f(m.POSITION).vec3f(m.NORMAL).vec2f(m.UV0).f32(m.AUXPOS1),A=n(),T=n(),j=n(),x=n(),I=n();class L{constructor(){this.vertexBufferLayout=y}allocate(t){return this.vertexBufferLayout.createBuffer(t)}elementCount(t){return 2*(t.indices.get(m.POSITION).length/2+1)}write(n,a,c,u){const f=a.vertexAttributes.get(m.POSITION).data,l=a.vertexAttributes.get(m.NORMAL).data,p=f.length/3,h=a&&a.indices&&a.indices.get(m.POSITION);h&&h.length!==2*(p-1)&&console.warn("MeasurementArrowMaterial does not support indices");const d=A,g=T,O=j,v=x,b=I,y=n.transformation,L=n.invTranspTransformation,S=c.position,w=c.normal,C=c.uv0;let M=0;for(let m=0;m<p;++m){const n=3*m;if(t(d,f[n],f[n+1],f[n+2]),m<p-1){const o=3*(m+1);t(g,f[o],f[o+1],f[o+2]),t(b,l[o],l[o+1],l[o+2]),e(b,b),r(O,g,d),e(O,O),s(v,b,O),e(v,v)}const a=o(d,g);y&&L&&(i(d,d,y),i(g,g,y),i(v,v,L));const c=u+2*m,h=c+1;S.setVec(c,d),S.setVec(h,d),w.setVec(c,v),w.setVec(h,v),C.set(c,0,M),C.set(c,1,-1),C.set(h,0,M),C.set(h,1,1),m<p-1&&(M+=a)}const P=c.auxpos1;for(let t=0;t<2*p;++t)P.set(u+t,M)}}export{O as MeasurementArrowMaterial,b as Parameters};
5
+ import{s as t,n as e,b as r,f as s,i as o,v as i}from"../../../../chunks/vec3.js";import{c as n}from"../../../../chunks/vec3f64.js";import{f as a}from"../../../../chunks/vec4f64.js";import{newLayout as c}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as u}from"../core/shaderLibrary/ShaderOutput.js";import f from"../lib/GLMaterial.js";import{Material as l,MaterialParameters as p}from"../lib/Material.js";import{RenderSlot as h}from"../lib/RenderSlot.js";import{VertexAttribute as m}from"../lib/VertexAttribute.js";import{MeasurementArrowTechniqueConfiguration as d,MeasurementArrowTechnique as g}from"../shaders/MeasurementArrowTechnique.js";class O extends l{constructor(t){super(t,new b),this._configuration=new d}getConfiguration(t,e){return this._configuration.polygonOffsetEnabled=this.parameters.polygonOffset,this._configuration.transparent=this.parameters.stripeEvenColor[3]<1||this.parameters.stripeOddColor[3]<1||this.parameters.outlineColor[3]<1,this._configuration.transparencyPassType=e.transparencyPassType,this._configuration}dispose(){}intersect(){}requiresSlot(t,e){return e===u.Color&&t===h.OPAQUE_MATERIAL}createGLMaterial(t){return new v(t)}createBufferWriter(){return new L}}class v extends f{beginSlot(t){return this.ensureTechnique(g,t)}}class b extends p{constructor(){super(...arguments),this.width=32,this.outlineSize=.2,this.outlineColor=a(1,.5,0,1),this.stripeEvenColor=a(1,1,1,1),this.stripeOddColor=a(1,.5,0,1),this.stripeLength=1,this.polygonOffset=!1}}const y=c().vec3f(m.POSITION).vec3f(m.NORMAL).vec2f(m.UV0).f32(m.AUXPOS1),A=n(),T=n(),j=n(),x=n(),I=n();class L{constructor(){this.vertexBufferLayout=y}allocate(t){return this.vertexBufferLayout.createBuffer(t)}elementCount(t){return 2*(t.indices.get(m.POSITION).length/2+1)}write(n,a,c,u){const f=a.vertexAttributes.get(m.POSITION).data,l=a.vertexAttributes.get(m.NORMAL).data,p=f.length/3,h=a&&a.indices&&a.indices.get(m.POSITION);h&&h.length!==2*(p-1)&&console.warn("MeasurementArrowMaterial does not support indices");const d=A,g=T,O=j,v=x,b=I,y=n.transformation,L=n.invTranspTransformation,S=c.position,w=c.normal,C=c.uv0;let M=0;for(let m=0;m<p;++m){const n=3*m;if(t(d,f[n],f[n+1],f[n+2]),m<p-1){const o=3*(m+1);t(g,f[o],f[o+1],f[o+2]),t(b,l[o],l[o+1],l[o+2]),e(b,b),r(O,g,d),e(O,O),s(v,b,O),e(v,v)}const a=o(d,g);y&&L&&(i(d,d,y),i(g,g,y),i(v,v,L));const c=u+2*m,h=c+1;S.setVec(c,d),S.setVec(h,d),w.setVec(c,v),w.setVec(h,v),C.set(c,0,M),C.set(c,1,-1),C.set(h,0,M),C.set(h,1,1),m<p-1&&(M+=a)}const P=c.auxpos1;for(let t=0;t<2*p;++t)P.set(u+t,M)}}export{O as MeasurementArrowMaterial,b as Parameters};