@arcgis/core 5.1.0-next.101 → 5.1.0-next.103

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 (736) hide show
  1. package/applications/Components/imageryUtils.d.ts +22 -1
  2. package/applications/Components/imageryUtils.js +1 -1
  3. package/arcade/Dictionary.js +1 -1
  4. package/arcade/Feature.js +1 -1
  5. package/arcade/Pixel.js +1 -1
  6. package/arcade/Voxel.js +1 -1
  7. package/arcade/arcade.js +1 -1
  8. package/arcade/arcadeAsyncRuntime.js +1 -1
  9. package/arcade/arcadeCompiler.js +1 -1
  10. package/arcade/arcadeRuntime.js +1 -1
  11. package/arcade/containerUtils.js +1 -1
  12. package/arcade/debug.js +1 -1
  13. package/arcade/deepClone.js +1 -1
  14. package/arcade/featureSetUtils.js +1 -1
  15. package/arcade/featureset/actions/GroupBy.js +1 -1
  16. package/arcade/featureset/actions/OrderBy.js +1 -1
  17. package/arcade/functions/convertdirection.js +1 -1
  18. package/arcade/functions/date.js +1 -1
  19. package/arcade/functions/feature.js +1 -1
  20. package/arcade/functions/featuresetbase.js +1 -1
  21. package/arcade/functions/featuresetgeom.js +1 -1
  22. package/arcade/functions/featuresetstats.js +1 -1
  23. package/arcade/functions/featuresetstring.js +1 -1
  24. package/arcade/functions/fieldStats.js +1 -1
  25. package/arcade/functions/geomasync.js +1 -1
  26. package/arcade/functions/geometry.js +1 -1
  27. package/arcade/functions/geomsync.js +1 -1
  28. package/arcade/functions/knowledgegraph.js +1 -1
  29. package/arcade/functions/maths.js +1 -1
  30. package/arcade/functions/stats.js +1 -1
  31. package/arcade/functions/string.js +1 -1
  32. package/arcade/functions/track.js +1 -1
  33. package/arcade/geometry/constructors.js +1 -1
  34. package/arcade/geometry/functions.js +1 -1
  35. package/arcade/geometry/operators.js +1 -1
  36. package/arcade/languageUtils.js +1 -1
  37. package/arcgisGlobal.d.ts +1449 -0
  38. package/assets/esri/core/workers/RemoteClient.js +1 -1
  39. package/assets/esri/core/workers/chunks/{92e7067960549733f8e6.js → 037b36d415ae27e987f9.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{58579c53be1a44bd08d2.js → 054ae729e7cefa2c7778.js} +1 -1
  41. package/assets/esri/core/workers/chunks/069459519477bb3dc91b.js +1 -0
  42. package/assets/esri/core/workers/chunks/{4301cb9670fa7c907460.js → 0881929a4a457f94f317.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{abdf146b35e179b5b245.js → 0cb8bc6dbbbe3b212712.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{b811d62284be95f4beb6.js → 0cc74bc3772be51cabc1.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{0630ce1975c91ae362d9.js → 0e9804ece1fd2d59751b.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{545c38789267e3487dbd.js → 10491b5b106bc5ad0b2b.js} +1 -1
  47. package/assets/esri/core/workers/chunks/12053c1213465d07d2f6.js +1 -0
  48. package/assets/esri/core/workers/chunks/{ca6c128940ddbebcaaab.js → 14b7b55c42af65ffa024.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{702e8468836863abd81b.js → 15fa8b5b472131aaa68e.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{852f4cd514008fee5a55.js → 176e676879666f784599.js} +1 -1
  51. package/assets/esri/core/workers/chunks/18201119828664373165.js +1 -0
  52. package/assets/esri/core/workers/chunks/1a3426276dc82a8a80f2.js +1 -0
  53. package/assets/esri/core/workers/chunks/{ce3e51c799a80648e46d.js → 1c0e8808d14d8e6dde2c.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{bafe489e54f34d1841e6.js → 1c83e61fd9a4f8fc8372.js} +1 -1
  55. package/assets/esri/core/workers/chunks/1cb0c4fc315bbc2bd00b.js +1 -0
  56. package/assets/esri/core/workers/chunks/{5afee66e182f79a0fc46.js → 1ff61d8a8ea060e78b83.js} +1 -1
  57. package/assets/esri/core/workers/chunks/{19a9a555365a8363d34b.js → 23119a1b1310b7dab2aa.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{031ea31bbdb7f1be791e.js → 276cb6a1cdd26d0e1444.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{fdb7851e98e8d2ba48d3.js → 286bf3be9f524bde9529.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{53bf9b0c2b8da12820ea.js → 29b00d07d3e1d095c590.js} +2 -2
  61. package/assets/esri/core/workers/chunks/{9d8e7839772029d83c93.js → 29bbc0d6d847b065d10e.js} +1 -1
  62. package/assets/esri/core/workers/chunks/{156efa014b6edd9ccce9.js → 2a5f6a8d282f2c391591.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{15a65aa6969c1b383ce2.js → 2f903bd3a2611e7f0946.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{b803e7b0d489bb628d72.js → 2f925a424b60b4a5e8e5.js} +1 -1
  65. package/assets/esri/core/workers/chunks/30e191d36aa95823c018.js +1 -0
  66. package/assets/esri/core/workers/chunks/{4b19acf8bde5b2e80692.js → 313a89b334e3518d30a4.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{390717f079def83a0d9c.js → 31a8bc25aa1441c70caa.js} +1 -1
  68. package/assets/esri/core/workers/chunks/31c01885ee6d70a2bde2.js +1 -0
  69. package/assets/esri/core/workers/chunks/3292b3883f203637b5a7.js +1 -0
  70. package/assets/esri/core/workers/chunks/{9bb2251ba58932f85d13.js → 33329f5d88e60b4ec568.js} +1 -1
  71. package/assets/esri/core/workers/chunks/{8f9117d589de7caaa02d.js → 35bbd63319d8aa9f31cc.js} +1 -1
  72. package/assets/esri/core/workers/chunks/35fdd62277fd06468a29.js +2 -0
  73. package/assets/esri/core/workers/chunks/{3996149146dd1eca7cc5.js → 38d7430d2370b69334d7.js} +1 -1
  74. package/assets/esri/core/workers/chunks/3aebbed6d4fd1b993a35.js +1 -0
  75. package/assets/esri/core/workers/chunks/3f1d533efe4300d19e6a.js +1 -0
  76. package/assets/esri/core/workers/chunks/{7db09c5bf024242becfa.js → 40caf5e09e4382d81104.js} +5 -5
  77. package/assets/esri/core/workers/chunks/4213aa844900fcf95287.js +1 -0
  78. package/assets/esri/core/workers/chunks/{bc6a809a965355eb425f.js → 44636ef119c6a576470b.js} +1 -1
  79. package/assets/esri/core/workers/chunks/453c9e8d438d061e1736.js +1 -0
  80. package/assets/esri/core/workers/chunks/479e34b0abc10499bd3a.js +1 -0
  81. package/assets/esri/core/workers/chunks/{54dad475dc806a38c287.js → 48440a071a37590846ff.js} +1 -1
  82. package/assets/esri/core/workers/chunks/{38b1d2ffcc318ac0119d.js → 48fcc10768d93e95a04e.js} +1 -1
  83. package/assets/esri/core/workers/chunks/{fa9ab152ea785b5e97e0.js → 4a41f98210f1da3b5041.js} +1 -1
  84. package/assets/esri/core/workers/chunks/4a65bc9091d7ea7e80df.js +1 -0
  85. package/assets/esri/core/workers/chunks/4cdf80e2e60501dd4756.js +1 -0
  86. package/assets/esri/core/workers/chunks/51edfe21d4c6ee22c83d.js +1 -0
  87. package/assets/esri/core/workers/chunks/52219561c144e5cb4442.js +1 -0
  88. package/assets/esri/core/workers/chunks/{312036c89a6a09bb06c2.js → 5570d47533efab56c732.js} +1 -1
  89. package/assets/esri/core/workers/chunks/{5abe34bb0110694f7b42.js → 566c36032b456ec5b5d7.js} +1 -1
  90. package/assets/esri/core/workers/chunks/{34207774bc371e95ba3c.js → 56b6b68d9459b1edea43.js} +1 -1
  91. package/assets/esri/core/workers/chunks/593772bd8b19ac664b29.js +1 -0
  92. package/assets/esri/core/workers/chunks/{10ce083b38ccfa88f766.js → 594e1f633527749d92d7.js} +1 -1
  93. package/assets/esri/core/workers/chunks/{ad329226c8b579d0964c.js → 5a6523c903b11dea77d4.js} +1 -1
  94. package/assets/esri/core/workers/chunks/5c44638670e40e092ce3.js +1 -0
  95. package/assets/esri/core/workers/chunks/{af8bc56cf1404afc3028.js → 5d60253ea3d247cdb3d1.js} +1 -1
  96. package/assets/esri/core/workers/chunks/5dc86a3a40d16b576bb5.js +1 -0
  97. package/assets/esri/core/workers/chunks/601edefd8da4eb2eda28.js +1 -0
  98. package/assets/esri/core/workers/chunks/6182d39e2095d4460b88.js +1 -0
  99. package/assets/esri/core/workers/chunks/{c798a40418e7ff38042a.js → 63513e706fe55a1def15.js} +1 -1
  100. package/assets/esri/core/workers/chunks/{d8d338665fe00494c826.js → 660713adb5a845dfa2ef.js} +1 -1
  101. package/assets/esri/core/workers/chunks/694f9571e2723d3d4b02.js +1 -0
  102. package/assets/esri/core/workers/chunks/69ad5930ff6040c6c561.js +1 -0
  103. package/assets/esri/core/workers/chunks/{f563dd6cace047108b3c.js → 6b5d2df9123dfe7e00b3.js} +1 -1
  104. package/assets/esri/core/workers/chunks/{5217d676749bca59d90f.js → 6c79e8e840c1d027fbb2.js} +1 -1
  105. package/assets/esri/core/workers/chunks/{2ce845c990bb4d701362.js → 6ca81e34854ce7ec6f6e.js} +1 -1
  106. package/assets/esri/core/workers/chunks/{11a99ee68409a641810e.js → 6f02681bcaa9bef501fc.js} +1 -1
  107. package/assets/esri/core/workers/chunks/77ac243d4dcd901c2eec.js +1 -0
  108. package/assets/esri/core/workers/chunks/78af4b7a379c40f497a7.js +1 -0
  109. package/assets/esri/core/workers/chunks/{bf706a5d065a357de51b.js → 79b64a52ff57c40c7800.js} +1 -1
  110. package/assets/esri/core/workers/chunks/{475409026288f0981ce2.js → 7b3642195d6d3ea9b830.js} +1 -1
  111. package/assets/esri/core/workers/chunks/{82b2acc6f181927de89c.js → 7bc746ea17f4e336e0b0.js} +1 -1
  112. package/assets/esri/core/workers/chunks/{19fcc74d34cbbaa56a41.js → 7c86099ed17f420b0489.js} +1 -1
  113. package/assets/esri/core/workers/chunks/{00a25dd4b057cc9f2a7e.js → 7d571845292b1b7769c2.js} +1 -1
  114. package/assets/esri/core/workers/chunks/7dafe608c224b9d48ffa.js +1 -0
  115. package/assets/esri/core/workers/chunks/7e203e947846d40f897e.js +1 -0
  116. package/assets/esri/core/workers/chunks/855bf811cd79b97c169a.js +1 -0
  117. package/assets/esri/core/workers/chunks/{7601278ebced0c0c31cf.js → 85bba0db8a7a5fc1be44.js} +1 -1
  118. package/assets/esri/core/workers/chunks/{a318cf6bb900e0ee268c.js → 881234f25c7814de8753.js} +1 -1
  119. package/assets/esri/core/workers/chunks/895114ccd2603830960f.js +1 -0
  120. package/assets/esri/core/workers/chunks/8a68884d40f6f6de1d12.js +1 -0
  121. package/assets/esri/core/workers/chunks/{0d81409721d29d8bc276.js → 8a7682071941c35f05c1.js} +1 -1
  122. package/assets/esri/core/workers/chunks/8aac1155b8ac071cd2ad.js +1 -0
  123. package/assets/esri/core/workers/chunks/{3e2953ea62817e75d840.js → 8cbaaea72f4ca2f023be.js} +1 -1
  124. package/assets/esri/core/workers/chunks/{7bb17d0ab1cc2b89c035.js → 8e986167d4a393ee41ea.js} +1 -1
  125. package/assets/esri/core/workers/chunks/8fdd57e2a0af647f1e3e.js +1 -0
  126. package/assets/esri/core/workers/chunks/92db9a6d273ae2862883.js +1 -0
  127. package/assets/esri/core/workers/chunks/{9b23d999db902d25ba58.js → 9373daa677dc767d7cf0.js} +1 -1
  128. package/assets/esri/core/workers/chunks/{40ffb1aa17cbfae17b23.js → 9542ef3f6c2bc7c14d85.js} +1 -1
  129. package/assets/esri/core/workers/chunks/{657268b3fde6da2dd735.js → 95798e3de3419fdda6ac.js} +1 -1
  130. package/assets/esri/core/workers/chunks/{aad02c7417648d881129.js → 958617c3a9854ea04e06.js} +1 -1
  131. package/assets/esri/core/workers/chunks/{a28124bba6b43efd74cc.js → 95df6d2ebacc43ac5fa3.js} +1 -1
  132. package/assets/esri/core/workers/chunks/{f618ee43581e8de6ad0c.js → 970e91de5dfbbc247afb.js} +1 -1
  133. package/assets/esri/core/workers/chunks/978b7d10054e17161145.js +1 -0
  134. package/assets/esri/core/workers/chunks/{8a48a6760c33ed50b650.js → 98b4408e12684e37b395.js} +1 -1
  135. package/assets/esri/core/workers/chunks/9d70247d820085a2c190.js +1 -0
  136. package/assets/esri/core/workers/chunks/9da2f2b67837b491cfa3.js +1 -0
  137. package/assets/esri/core/workers/chunks/{edee616b6f1b5be8fd39.js → a0296e6d6c37b861c5fb.js} +1 -1
  138. package/assets/esri/core/workers/chunks/{c19e3f6027b6526de359.js → a02ebdcb802d128c8eee.js} +1 -1
  139. package/assets/esri/core/workers/chunks/a0aaf14c8f9a007d88ac.js +1 -0
  140. package/assets/esri/core/workers/chunks/{1523883460874c352e36.js → a29cd1f5c7bb4f6a5a4f.js} +1 -1
  141. package/assets/esri/core/workers/chunks/{cf826787ab8d4b27ad80.js → a53a3e5548fef65a2710.js} +1 -1
  142. package/assets/esri/core/workers/chunks/{91f9e0e3662d4bf9f163.js → a913a1c83a667ed0e711.js} +1 -1
  143. package/assets/esri/core/workers/chunks/{359465b9726edcc70c83.js → a9c9c00432ee41ec91ba.js} +1 -1
  144. package/assets/esri/core/workers/chunks/{a3a28c4887f802e8d96d.js → aa55923ca939a0d4606c.js} +1 -1
  145. package/assets/esri/core/workers/chunks/{d3b086eb9aa8c7d09048.js → aea8e0577fb48d5c9577.js} +1 -1
  146. package/assets/esri/core/workers/chunks/af45110f07e4b5162bae.js +1 -0
  147. package/assets/esri/core/workers/chunks/{76589434d573111a8fb4.js → b09ae8eb5e97fb27382f.js} +1 -1
  148. package/assets/esri/core/workers/chunks/b0c647af49c9d563b852.js +1 -0
  149. package/assets/esri/core/workers/chunks/{a320998f18922a35899f.js → b32a13972cb3de652339.js} +1 -1
  150. package/assets/esri/core/workers/chunks/b432a5a829e309837db6.js +1 -0
  151. package/assets/esri/core/workers/chunks/{9103eb0b9078019d3a26.js → b5d0898406c7d6e6a717.js} +1 -1
  152. package/assets/esri/core/workers/chunks/b640651c7d86cfe654bf.js +1 -0
  153. package/assets/esri/core/workers/chunks/{503439246250d9e1cbd5.js → b75e090a7e935ff870a3.js} +1 -1
  154. package/assets/esri/core/workers/chunks/{c321bcda8e8893577948.js → b8dda9e55caba0e2b4c2.js} +1 -1
  155. package/assets/esri/core/workers/chunks/{59a64d72eed8c40c63cf.js → bacf0c9d5d3e084dea61.js} +1 -1
  156. package/assets/esri/core/workers/chunks/{48a0e7a32ebd44045c8f.js → bb04aff0b4947408592c.js} +1 -1
  157. package/assets/esri/core/workers/chunks/{17de1c251242b692cf45.js → bff0c4094c14cb97b18f.js} +1 -1
  158. package/assets/esri/core/workers/chunks/{47dd2bfecc5c4b5f10f0.js → c0d7e4afbad0b20e2502.js} +1 -1
  159. package/assets/esri/core/workers/chunks/c13c532fe38ddc5d7ca6.js +1 -0
  160. package/assets/esri/core/workers/chunks/{cc62e5095e328bed3e01.js → c1ffb879e0283fb2815f.js} +1 -1
  161. package/assets/esri/core/workers/chunks/{22fa4aa2b76573bafe21.js → c476f4979048e558baa7.js} +89 -76
  162. package/assets/esri/core/workers/chunks/c8b96104641cb4afd4df.js +1 -0
  163. package/assets/esri/core/workers/chunks/{4faaf61d20e20fcf6c18.js → c91d4f1b42cfe474df52.js} +1 -1
  164. package/assets/esri/core/workers/chunks/{6ae2408ac075b974e887.js → cb26966cc205bd338c76.js} +1 -1
  165. package/assets/esri/core/workers/chunks/{c452c74ba9de218c3e57.js → cb3004998eff7c60930e.js} +1 -1
  166. package/assets/esri/core/workers/chunks/cc48354c54358777e996.js +1 -0
  167. package/assets/esri/core/workers/chunks/{b1b8a7c00ec4d998ab84.js → cc8d55d1830d7542c3f5.js} +1 -1
  168. package/assets/esri/core/workers/chunks/ce0c7070eeb723a718e7.js +1 -0
  169. package/assets/esri/core/workers/chunks/ce3b5b83237cf37ff523.js +1 -0
  170. package/assets/esri/core/workers/chunks/cf3c0bee919bb509cd4f.js +1 -0
  171. package/assets/esri/core/workers/chunks/cf9b0ba30a75c030ca92.js +1 -0
  172. package/assets/esri/core/workers/chunks/d00b9c1fd0865bf8f317.js +1 -0
  173. package/assets/esri/core/workers/chunks/{9a29b7f9e6281ee40c37.js → d4749eb8a47869477037.js} +1 -1
  174. package/assets/esri/core/workers/chunks/d5423df247be82fa085a.js +1 -0
  175. package/assets/esri/core/workers/chunks/d610f517fb3c6cb24365.js +1 -0
  176. package/assets/esri/core/workers/chunks/{47656ec12401e53f4bd3.js → d9d716bfd0aab30b6caf.js} +1 -1
  177. package/assets/esri/core/workers/chunks/da4f7d7099ba88f31f45.js +1 -0
  178. package/assets/esri/core/workers/chunks/dbb1ac41fd5da4fd849b.js +1 -0
  179. package/assets/esri/core/workers/chunks/{176dd195f77b98cb0b0f.js → dd58bc675b85b4d90afa.js} +1 -1
  180. package/assets/esri/core/workers/chunks/e2bb95d601789bbda73b.js +1 -0
  181. package/assets/esri/core/workers/chunks/{f018ad451ee072253a1e.js → e4b2120d7ee1c998b1fc.js} +1 -1
  182. package/assets/esri/core/workers/chunks/e4c350dc65aae121171d.js +1 -0
  183. package/assets/esri/core/workers/chunks/e8518bd3596543b387f8.js +1 -0
  184. package/assets/esri/core/workers/chunks/{f948e4a80a7dbda70f2e.js → e973cab79ec2541cb81b.js} +1 -1
  185. package/assets/esri/core/workers/chunks/{7d6299ab7b0db23ab961.js → eb1d6614eeac6d26bb9c.js} +1 -1
  186. package/assets/esri/core/workers/chunks/f1bb426400dac02880f1.js +1 -0
  187. package/assets/esri/core/workers/chunks/{ffcd4fca7f67e1f943f1.js → f239a8ecad8b692d5eaa.js} +1 -1
  188. package/assets/esri/core/workers/chunks/{de11ebcea2b8f9dfe65d.js → f3161c47a572194f6017.js} +1 -1
  189. package/assets/esri/core/workers/chunks/{f66262f8582909157f01.js → f37be7e517f0892014e3.js} +1 -1
  190. package/assets/esri/core/workers/chunks/{99f726f05cf80b0330ed.js → f3a9100518b044e79501.js} +1 -1
  191. package/assets/esri/core/workers/chunks/f3f984c62311c20a9db8.js +1 -0
  192. package/assets/esri/core/workers/chunks/f5bd0a4f82df5e942b70.js +1 -0
  193. package/assets/esri/core/workers/chunks/{85e65ced3312bf9cf162.js → f7e386ece75afb6e4be5.js} +1 -1
  194. package/assets/esri/core/workers/chunks/f8b884b529064df4a30a.js +1 -0
  195. package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +125 -0
  196. package/assets/esri/themes/base/widgets/_Directions.scss +5 -1
  197. package/assets/esri/themes/dark/main.css +1 -1
  198. package/assets/esri/themes/light/main.css +1 -1
  199. package/assets/esri/themes/light/view.css +1 -1
  200. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm.json +1 -1
  201. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ar.json +1 -1
  202. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bg.json +1 -1
  203. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bs.json +1 -1
  204. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ca.json +1 -1
  205. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_cs.json +1 -1
  206. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_da.json +1 -1
  207. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_de.json +1 -1
  208. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_el.json +1 -1
  209. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_en.json +1 -1
  210. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_es.json +1 -1
  211. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_et.json +1 -1
  212. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fi.json +1 -1
  213. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fr.json +1 -1
  214. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_he.json +1 -1
  215. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hr.json +1 -1
  216. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hu.json +1 -1
  217. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_id.json +1 -1
  218. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_it.json +1 -1
  219. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ja.json +1 -1
  220. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ko.json +1 -1
  221. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lt.json +1 -1
  222. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lv.json +1 -1
  223. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_nl.json +1 -1
  224. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_no.json +1 -1
  225. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pl.json +1 -1
  226. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-BR.json +1 -1
  227. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-PT.json +1 -1
  228. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ro.json +1 -1
  229. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ru.json +1 -1
  230. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sk.json +1 -1
  231. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sl.json +1 -1
  232. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sr.json +1 -1
  233. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sv.json +1 -1
  234. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_th.json +1 -1
  235. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_tr.json +1 -1
  236. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_uk.json +1 -1
  237. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_vi.json +1 -1
  238. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-CN.json +1 -1
  239. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-HK.json +1 -1
  240. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-TW.json +1 -1
  241. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer.json +1 -1
  242. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_en.json +1 -1
  243. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer.json +1 -1
  244. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_ar.json +1 -1
  245. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_bg.json +1 -1
  246. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_bs.json +1 -1
  247. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_ca.json +1 -1
  248. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_cs.json +1 -1
  249. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_da.json +1 -1
  250. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_de.json +1 -1
  251. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_el.json +1 -1
  252. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_es.json +1 -1
  253. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_et.json +1 -1
  254. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_fi.json +1 -1
  255. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_fr.json +1 -1
  256. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_he.json +1 -1
  257. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_hr.json +1 -1
  258. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_hu.json +1 -1
  259. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_id.json +1 -1
  260. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_it.json +1 -1
  261. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_ja.json +1 -1
  262. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_ko.json +1 -1
  263. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_lt.json +1 -1
  264. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_lv.json +1 -1
  265. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_nl.json +1 -1
  266. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_no.json +1 -1
  267. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_pl.json +1 -1
  268. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_pt-BR.json +1 -1
  269. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_pt-PT.json +1 -1
  270. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_ro.json +1 -1
  271. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_ru.json +1 -1
  272. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_sk.json +1 -1
  273. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_sl.json +1 -1
  274. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_sr.json +1 -1
  275. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_sv.json +1 -1
  276. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_th.json +1 -1
  277. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_tr.json +1 -1
  278. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_uk.json +1 -1
  279. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_vi.json +1 -1
  280. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_zh-CN.json +1 -1
  281. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_zh-HK.json +1 -1
  282. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_zh-TW.json +1 -1
  283. package/chunks/AtmosphereCompositing.glsl.js +1 -1
  284. package/chunks/Bufferer-Dw9Qi4T1.js +1 -1
  285. package/chunks/Centroid-DZi-eb9F.js +1 -1
  286. package/chunks/Clouds.glsl.js +1 -1
  287. package/chunks/Compositing.glsl.js +1 -1
  288. package/chunks/CutFillComposition.glsl.js +1 -1
  289. package/chunks/CutFillDepth.glsl.js +1 -1
  290. package/chunks/CutFillMask.glsl.js +1 -1
  291. package/chunks/CutFillReduction.glsl.js +1 -1
  292. package/chunks/CutFillTargetDepth.glsl.js +1 -1
  293. package/chunks/Distance2DCalculator-CXhBP-8I.js +1 -1
  294. package/chunks/Envelope.js +1 -1
  295. package/chunks/Envelope2D.js +1 -1
  296. package/chunks/FlatGeometry.js +1 -1
  297. package/chunks/FocusAreaColor.glsl.js +1 -1
  298. package/chunks/FocusAreaMask.glsl.js +1 -1
  299. package/chunks/Fog.glsl.js +1 -1
  300. package/chunks/GaussianSplat.glsl.js +1 -1
  301. package/chunks/GaussianSplatShadow.glsl.js +1 -1
  302. package/chunks/GeodeticDistanceCalculator-Ce-woMPw.js +1 -1
  303. package/chunks/GeodeticUtils.js +1 -1
  304. package/chunks/Geometry.js +1 -1
  305. package/chunks/GeometryCleaner-BEJM7I4l.js +1 -1
  306. package/chunks/GlobalIllumination.glsl.js +1 -1
  307. package/chunks/GlobalIlluminationBlur.glsl.js +1 -1
  308. package/chunks/GlobalIlluminationUpscale.glsl.js +80 -65
  309. package/chunks/GlowBlur.glsl.js +1 -1
  310. package/chunks/GlowComposition.glsl.js +1 -1
  311. package/chunks/HazeCompositing.glsl.js +1 -1
  312. package/chunks/HighlightBlur.glsl.js +1 -1
  313. package/chunks/HighlightDownsample.glsl.js +1 -1
  314. package/chunks/Magnifier.glsl.js +1 -1
  315. package/chunks/MultiPathImpl.js +1 -1
  316. package/chunks/NoiseTextureAtlas.glsl.js +1 -1
  317. package/chunks/OITBlend.glsl.js +2 -2
  318. package/chunks/OITBlendEmission.glsl.js +1 -1
  319. package/chunks/OITDimOpaque.glsl.js +1 -1
  320. package/chunks/OperatorClip.js +1 -1
  321. package/chunks/OperatorCrosses.js +1 -1
  322. package/chunks/OperatorCut.js +1 -1
  323. package/chunks/OperatorDensify.js +1 -1
  324. package/chunks/OperatorGeneralize.js +1 -1
  325. package/chunks/OperatorGeodesicBuffer.js +1 -1
  326. package/chunks/OperatorGeodeticArea.js +1 -1
  327. package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
  328. package/chunks/OperatorGeodeticDistance.js +1 -1
  329. package/chunks/OperatorGeodeticLength.js +1 -1
  330. package/chunks/OperatorIntegrate.js +1 -1
  331. package/chunks/OperatorIntersects.js +1 -1
  332. package/chunks/OperatorMultiPartToSinglePart.js +1 -1
  333. package/chunks/OperatorOverlaps.js +1 -1
  334. package/chunks/OperatorProject.js +1 -1
  335. package/chunks/OperatorProximity.js +1 -1
  336. package/chunks/OperatorProximityGeodesic.js +1 -1
  337. package/chunks/OperatorShapePreservingDensify.js +1 -1
  338. package/chunks/OperatorShapePreservingLength.js +1 -1
  339. package/chunks/OperatorShapePreservingProject.js +1 -1
  340. package/chunks/OperatorSimplifyOGC.js +1 -1
  341. package/chunks/OperatorTouches.js +1 -1
  342. package/chunks/OperatorWithin.js +1 -1
  343. package/chunks/OverlayCompositing.glsl.js +1 -1
  344. package/chunks/Point2D.js +1 -1
  345. package/chunks/PointRenderer.glsl.js +1 -1
  346. package/chunks/ProjectionTransformation.js +1 -1
  347. package/chunks/RasterColorizer.glsl.js +1 -1
  348. package/chunks/ShadowCastAccumulate.glsl.js +1 -1
  349. package/chunks/ShadowCastVisualize.glsl.js +2 -2
  350. package/chunks/SideCalculator2D-BNwb5gvz.js +1 -1
  351. package/chunks/SimpleAtmosphere.glsl.js +1 -1
  352. package/chunks/SpatialReference.js +1 -1
  353. package/chunks/Terrain.glsl.js +1 -1
  354. package/chunks/Texture.glsl.js +1 -1
  355. package/chunks/Transformation2D.js +1 -1
  356. package/chunks/Viewshed.glsl.js +1 -1
  357. package/chunks/aiServices.js +1 -1
  358. package/chunks/arcade.js +1 -1
  359. package/chunks/array.js +1 -1
  360. package/chunks/boundedPlane.js +1 -1
  361. package/chunks/constants.js +1 -1
  362. package/chunks/containsOperator.js +1 -1
  363. package/chunks/disjointOperator.js +1 -1
  364. package/chunks/distanceOperator.js +1 -1
  365. package/chunks/equalsOperator.js +1 -1
  366. package/chunks/languageUtils.js +1 -1
  367. package/chunks/pe.js +1 -1
  368. package/chunks/persistableUrlUtils.js +1 -1
  369. package/chunks/relateOperator.js +1 -1
  370. package/chunks/symmetricDifferenceOperator.js +1 -1
  371. package/chunks/unionOperator.js +1 -1
  372. package/chunks/vec2.js +1 -1
  373. package/chunks/vec3.js +1 -1
  374. package/chunks/vec4.js +1 -1
  375. package/config.js +1 -1
  376. package/core/accessorSupport/decorators/persistable.js +1 -1
  377. package/effects/FocusArea.js +1 -1
  378. package/form/elements/inputs/MultipleChoiceInput.d.ts +5 -5
  379. package/form/elements/inputs/MultipleChoiceInput.js +1 -1
  380. package/geometry/coordinateFormatter.js +1 -1
  381. package/geometry/operators/extendOperator.js +1 -1
  382. package/geometry/operators/gx/geodeticUtils.js +1 -1
  383. package/geometry/operators/gx/operatorAffineTransform.js +1 -1
  384. package/geometry/operators/gx/operatorAlphaShape.js +1 -1
  385. package/geometry/operators/gx/operatorAutoComplete.js +1 -1
  386. package/geometry/operators/gx/operatorBoundary.js +1 -1
  387. package/geometry/operators/gx/operatorBuffer.js +1 -1
  388. package/geometry/operators/gx/operatorConvexHull.js +1 -1
  389. package/geometry/operators/gx/operatorDifference.js +1 -1
  390. package/geometry/operators/gx/operatorGeodesicBuffer.js +1 -1
  391. package/geometry/operators/gx/operatorGeodeticArea.js +1 -1
  392. package/geometry/operators/gx/operatorGeodeticDensify.js +1 -1
  393. package/geometry/operators/gx/operatorGeodeticDistance.js +1 -1
  394. package/geometry/operators/gx/operatorGeodeticLength.js +1 -1
  395. package/geometry/operators/gx/operatorGraphicBuffer.js +1 -1
  396. package/geometry/operators/gx/operatorIntersection.js +1 -1
  397. package/geometry/operators/gx/operatorLabelPoint.js +1 -1
  398. package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
  399. package/geometry/operators/gx/operatorLocateBetween.js +1 -1
  400. package/geometry/operators/gx/operatorMinimumBoundingCircle.js +1 -1
  401. package/geometry/operators/gx/operatorOffset.js +1 -1
  402. package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
  403. package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
  404. package/geometry/operators/gx/operatorProject.js +1 -1
  405. package/geometry/operators/gx/operatorProximityGeodesic.js +1 -1
  406. package/geometry/operators/gx/operatorShapePreservingProject.js +1 -1
  407. package/geometry/operators/gx/operatorSimplify.js +1 -1
  408. package/geometry/operators/gx/operatorSinglePartToMultiPart.js +1 -1
  409. package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
  410. package/geometry/operators/gx/operatorUnion.js +1 -1
  411. package/geometry/operators/isNearOperator.js +1 -1
  412. package/geometry/operators/json/containsOperator.js +1 -1
  413. package/geometry/operators/json/disjointOperator.js +1 -1
  414. package/geometry/operators/locateBetweenOperator.js +1 -1
  415. package/geometry/operators/reshapeOperator.js +1 -1
  416. package/geometry/operators/support/apiConverter.js +1 -1
  417. package/geometry/operators/support/geographicTransformationUtils.js +1 -1
  418. package/geometry/operators/support/initNoPeFactory.js +1 -1
  419. package/geometry/operators/support/jsonConverter.js +1 -1
  420. package/geometry/operators/support/projectionTransformation.js +1 -1
  421. package/geometry/operators/symmetricDifferenceOperator.js +1 -1
  422. package/geometry/operators/unionOperator.js +1 -1
  423. package/geometry/pe.js +1 -1
  424. package/geometry/support/MeshTexture.js +1 -1
  425. package/geometry/support/boundedPlane.js +1 -1
  426. package/geometry/support/buffer/math/vec3.js +1 -1
  427. package/geometry/support/buffer/math/vec4.js +1 -1
  428. package/geometry/support/buffer/utils/vec2.js +1 -1
  429. package/geometry/support/coordinateSystem.js +1 -1
  430. package/geometry/support/meshUtils/extent.js +1 -1
  431. package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
  432. package/geometry/support/meshUtils/projection.js +1 -1
  433. package/geometry/support/meshUtils/vertexSpaceConversion.js +1 -1
  434. package/geometry/support/spatialReferenceUtils.js +1 -1
  435. package/geometry/support/vcsData.js +1 -1
  436. package/interfaces.d.ts +3 -0
  437. package/kernel.js +1 -1
  438. package/layers/FeatureLayer.d.ts +29 -39
  439. package/layers/ImageryTileLayer.js +1 -1
  440. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  441. package/layers/IntegratedMeshLayer.js +1 -1
  442. package/layers/KnowledgeGraphLayer.js +1 -1
  443. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  444. package/layers/OrientedImageryLayer.d.ts +233 -0
  445. package/layers/OrientedImageryLayer.js +1 -1
  446. package/layers/VideoLayer.d.ts +35 -9
  447. package/layers/VideoLayer.js +1 -1
  448. package/layers/catalog/CatalogFootprintLayer.d.ts +147 -0
  449. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  450. package/layers/knowledgeGraph/cypherUtils.js +1 -1
  451. package/layers/mixins/ArcGISImageService.js +1 -1
  452. package/layers/mixins/FeatureLayerBase.d.ts +12 -0
  453. package/layers/mixins/FeatureLayerBase.js +1 -1
  454. package/layers/orientedImagery/transformations/utils.js +1 -1
  455. package/layers/raster/datasets/ImageAuxRaster.js +1 -1
  456. package/layers/raster/formats/RasterCodec.js +1 -1
  457. package/layers/raster/functions/rasterProjectionHelper.js +1 -1
  458. package/layers/support/FeatureReductionBinning.d.ts +87 -9
  459. package/layers/support/FeatureReductionCluster.d.ts +87 -9
  460. package/layers/support/FieldConfiguration.d.ts +1 -1
  461. package/layers/support/ImageElement.js +1 -1
  462. package/layers/support/ParquetFilesData.js +1 -1
  463. package/layers/support/SceneFilter.js +1 -1
  464. package/layers/support/Sublayer.d.ts +25 -0
  465. package/layers/support/Sublayer.js +1 -1
  466. package/layers/support/SubtypeSublayer.d.ts +147 -0
  467. package/layers/support/TelemetryData.d.ts +5 -0
  468. package/layers/support/TelemetryData.js +1 -1
  469. package/layers/support/TelemetryDisplay.d.ts +10 -2
  470. package/layers/support/TelemetryDisplay.js +1 -1
  471. package/layers/video/VideoController.js +1 -1
  472. package/layers/video/types.d.ts +8 -1
  473. package/layers/video/videoUtils.js +1 -1
  474. package/linkChart/LinkChartProperties.js +1 -1
  475. package/linkChart/utils.js +1 -1
  476. package/package.json +2 -2
  477. package/portal/PortalItem.js +1 -1
  478. package/portal/jsonTypes.d.ts +7 -0
  479. package/renderers/UniqueValueRenderer.js +1 -1
  480. package/rest/knowledgeGraphService.js +1 -1
  481. package/rest/print.js +1 -1
  482. package/rest/support/PrintParameters.d.ts +8 -1
  483. package/rest/support/PrintParameters.js +1 -1
  484. package/support/arcadeUtils.js +1 -1
  485. package/support/persistableUrlUtils.js +1 -1
  486. package/support/revision.js +1 -1
  487. package/symbols/Symbol3D.js +1 -1
  488. package/symbols/support/IconSymbol3DLayerResource.js +1 -1
  489. package/symbols/support/urlUtils.js +1 -1
  490. package/symbols/support/webStyleSymbolUtils.js +1 -1
  491. package/third-party-notices.txt +188 -0
  492. package/views/2d/ViewStateManager.js +1 -1
  493. package/views/2d/engine/webgl/shaderGraph/graph/GlslGraphWriter.js +1 -1
  494. package/views/2d/engine/webgl/shaderGraph/graph/ShaderGraphContext.js +1 -1
  495. package/views/2d/engine/webgl/shaderGraph/graph/ShaderGraphNode.js +1 -1
  496. package/views/2d/engine/webgl/shaderGraph/graph/glsl.js +1 -1
  497. package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityPolygonShader.js +1 -1
  498. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BloomShader.js +1 -1
  499. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/AspectShader.js +1 -1
  500. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/CurvatureShader.js +1 -1
  501. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/MaskShader.js +1 -1
  502. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/RemapShader.js +1 -1
  503. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/SlopeShader.js +1 -1
  504. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/math.js +1 -1
  505. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/surface.js +1 -1
  506. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  507. package/views/2d/interactive/editingTools/TransformTool.js +1 -1
  508. package/views/2d/interactive/editingTools/manipulations/ScaleManipulation.js +1 -1
  509. package/views/2d/layers/VideoLayerView2D.js +1 -1
  510. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  511. package/views/3d/analysis/Slice/SliceController.js +1 -1
  512. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  513. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  514. package/views/3d/analysis/Viewshed/ViewshedFieldOfViewManipulation.js +1 -1
  515. package/views/3d/analysis/Viewshed/ViewshedScaleOrientManipulation.js +1 -1
  516. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  517. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  518. package/views/3d/focusAreaUtils.js +1 -1
  519. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentRotate.js +1 -1
  520. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
  521. package/views/3d/interactive/editingTools/transform/extentTransform/extentUtils.js +1 -1
  522. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  523. package/views/3d/layers/SceneLayerWorker.js +1 -1
  524. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  525. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  526. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  527. package/views/3d/layers/graphics/GraphicsDeconflictor.js +1 -1
  528. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  529. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  530. package/views/3d/layers/i3s/meshUtils.js +1 -1
  531. package/views/3d/state/ScreenSizePerspective.js +1 -1
  532. package/views/3d/support/ViewSlice.js +1 -1
  533. package/views/3d/terrain/OverlayRenderer.js +1 -1
  534. package/views/3d/terrain/RasterColorizer.glsl.js +1 -1
  535. package/views/3d/terrain/RasterTile.js +1 -1
  536. package/views/3d/terrain/TerrainRenderer.js +1 -1
  537. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  538. package/views/3d/webgl-engine/core/shaderLibrary/shading/GlobalIlluminationWeights.glsl.js +3 -5
  539. package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.js +1 -1
  540. package/views/3d/webgl-engine/effects/atmosphere/LocalAtmosphere.js +1 -1
  541. package/views/3d/webgl-engine/effects/atmosphere/MarsAtmosphere.js +1 -1
  542. package/views/3d/webgl-engine/effects/atmosphere/SimpleAtmosphere.glsl.js +1 -1
  543. package/views/3d/webgl-engine/effects/blit/Blit.js +1 -1
  544. package/views/3d/webgl-engine/effects/clouds/Clouds.glsl.js +1 -1
  545. package/views/3d/webgl-engine/effects/clouds/CloudsRenderer.js +1 -1
  546. package/views/3d/webgl-engine/effects/clouds/CloudsTechnique.js +1 -1
  547. package/views/3d/webgl-engine/effects/clouds/NoiseTextureAtlas.glsl.js +1 -1
  548. package/views/3d/webgl-engine/effects/clouds/NoiseTextureAtlas.js +1 -1
  549. package/views/3d/webgl-engine/effects/clouds/NoiseTextureAtlasTechnique.js +1 -1
  550. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColor.glsl.js +1 -1
  551. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
  552. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorTechnique.js +1 -1
  553. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMask.glsl.js +1 -1
  554. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  555. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskTechnique.js +1 -1
  556. package/views/3d/webgl-engine/effects/fog/Fog.glsl.js +1 -1
  557. package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
  558. package/views/3d/webgl-engine/effects/fog/FogTechnique.js +1 -1
  559. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +1 -1
  560. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  561. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationBlur.glsl.js +1 -1
  562. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationBlurTechnique.js +1 -1
  563. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechnique.js +1 -1
  564. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechniqueConfiguration.js +1 -1
  565. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationUpscale.glsl.js +1 -1
  566. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationUpscaleTechnique.js +1 -1
  567. package/views/3d/webgl-engine/effects/glow/Glow.js +1 -1
  568. package/views/3d/webgl-engine/effects/glow/GlowBlur.glsl.js +1 -1
  569. package/views/3d/webgl-engine/effects/glow/GlowBlurTechnique.js +1 -1
  570. package/views/3d/webgl-engine/effects/glow/GlowComposition.glsl.js +1 -1
  571. package/views/3d/webgl-engine/effects/glow/GlowCompositionTechnique.js +1 -1
  572. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  573. package/views/3d/webgl-engine/effects/haze/HazeCompositing.glsl.js +1 -1
  574. package/views/3d/webgl-engine/effects/haze/HazeCompositingTechnique.js +1 -1
  575. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  576. package/views/3d/webgl-engine/effects/highlight/HighlightBlur.glsl.js +1 -1
  577. package/views/3d/webgl-engine/effects/highlight/HighlightBlurTechnique.js +1 -1
  578. package/views/3d/webgl-engine/effects/highlight/HighlightDownsample.glsl.js +1 -1
  579. package/views/3d/webgl-engine/effects/highlight/HighlightDownsampleTechnique.js +1 -1
  580. package/views/3d/webgl-engine/effects/magnifier/Magnifier.glsl.js +1 -1
  581. package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
  582. package/views/3d/webgl-engine/effects/magnifier/MagnifierTechnique.js +1 -1
  583. package/views/3d/webgl-engine/effects/transparency/OITBlend.glsl.js +1 -1
  584. package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
  585. package/views/3d/webgl-engine/effects/transparency/OITBlendTechnique.js +1 -1
  586. package/views/3d/webgl-engine/effects/transparency/OITDimOpaque.glsl.js +1 -1
  587. package/views/3d/webgl-engine/effects/transparency/OITDimOpaqueTechnique.js +1 -1
  588. package/views/3d/webgl-engine/lib/Compositor.js +1 -1
  589. package/views/3d/webgl-engine/lib/CutFillComputationRenderNode.js +1 -1
  590. package/views/3d/webgl-engine/lib/CutFillVisualizationRenderNode.js +1 -1
  591. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  592. package/views/3d/webgl-engine/lib/GaussianSplatShadowRenderNode.js +1 -1
  593. package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
  594. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  595. package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
  596. package/views/3d/webgl-engine/lib/SliceHelper.js +1 -1
  597. package/views/3d/webgl-engine/lib/Texture.glsl.js +1 -1
  598. package/views/3d/webgl-engine/lib/TextureTechnique.js +1 -1
  599. package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
  600. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  601. package/views/3d/webgl-engine/lib/intersectorUtils.js +1 -1
  602. package/views/3d/webgl-engine/shaders/AtmosphereCompositing.glsl.js +1 -1
  603. package/views/3d/webgl-engine/shaders/AtmosphereCompositingTechnique.js +1 -1
  604. package/views/3d/webgl-engine/shaders/Compositing.glsl.js +1 -1
  605. package/views/3d/webgl-engine/shaders/CompositingTechnique.js +1 -1
  606. package/views/3d/webgl-engine/shaders/CutFillComposition.glsl.js +1 -1
  607. package/views/3d/webgl-engine/shaders/CutFillCompositionTechnique.js +1 -1
  608. package/views/3d/webgl-engine/shaders/CutFillDepth.glsl.js +1 -1
  609. package/views/3d/webgl-engine/shaders/CutFillDepthTechnique.js +1 -1
  610. package/views/3d/webgl-engine/shaders/CutFillMask.glsl.js +1 -1
  611. package/views/3d/webgl-engine/shaders/CutFillMaskTechnique.js +1 -1
  612. package/views/3d/webgl-engine/shaders/CutFillReduction.glsl.js +1 -1
  613. package/views/3d/webgl-engine/shaders/CutFillReductionTechnique.js +1 -1
  614. package/views/3d/webgl-engine/shaders/CutFillTargetDepth.glsl.js +1 -1
  615. package/views/3d/webgl-engine/shaders/CutFillTargetDepthTechnique.js +1 -1
  616. package/views/3d/webgl-engine/shaders/GaussianSplat.glsl.js +1 -1
  617. package/views/3d/webgl-engine/shaders/GaussianSplatShadow.glsl.js +1 -1
  618. package/views/3d/webgl-engine/shaders/GaussianSplatShadowTechnique.js +1 -1
  619. package/views/3d/webgl-engine/shaders/GaussianSplatTechnique.js +1 -1
  620. package/views/3d/webgl-engine/shaders/OverlayCompositing.glsl.js +1 -1
  621. package/views/3d/webgl-engine/shaders/OverlayCompositingTechnique.js +1 -1
  622. package/views/3d/webgl-engine/shaders/PointRenderer.glsl.js +1 -1
  623. package/views/3d/webgl-engine/shaders/PointRendererTechnique.js +1 -1
  624. package/views/3d/webgl-engine/shaders/ShadowCastAccumulate.glsl.js +1 -1
  625. package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechnique.js +1 -1
  626. package/views/3d/webgl-engine/shaders/ShadowCastMaskTechnique.js +1 -1
  627. package/views/3d/webgl-engine/shaders/ShadowCastVisualize.glsl.js +1 -1
  628. package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechnique.js +1 -1
  629. package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
  630. package/views/3d/webgl-engine/shaders/TerrainTechnique.js +1 -1
  631. package/views/3d/webgl-engine/shaders/Viewshed.glsl.js +1 -1
  632. package/views/3d/webgl-engine/shaders/ViewshedTechnique.js +1 -1
  633. package/views/Viewport2DBaseMixin.js +1 -1
  634. package/views/interactive/editGeometry/support/editPlaneUtils.js +1 -1
  635. package/views/interactive/snapping/featureSources/featureServiceSource/tileUtils.js +1 -1
  636. package/webdoc/support/webdocSaveUtils.js +1 -1
  637. package/widgets/Attachments/support/attachmentUtils.js +1 -1
  638. package/widgets/Attachments.d.ts +0 -1
  639. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.d.ts +8 -1
  640. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  641. package/widgets/BatchAttributeForm/attachmentUtils.js +2 -0
  642. package/widgets/BatchAttributeForm/css.js +1 -1
  643. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
  644. package/widgets/BatchAttributeForm/templates/RelationshipElementTemplate.js +1 -1
  645. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  646. package/widgets/BatchAttributeForm/templates/support/hashElementTemplate.js +1 -1
  647. package/widgets/BatchAttributeForm/types.d.ts +7 -0
  648. package/widgets/BatchAttributeForm.js +1 -1
  649. package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
  650. package/widgets/BuildingExplorer/BuildingLevelPicker/constants.js +1 -1
  651. package/widgets/FeatureForm/RelationshipInput.d.ts +1 -1
  652. package/widgets/FeatureTable.js +1 -1
  653. package/widgets/Features.d.ts +1 -1
  654. package/widgets/LayerList/LayerListItem.js +1 -1
  655. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  656. package/widgets/OrientedImageryViewer/components/OrientedImageryVideoViewModel.js +1 -1
  657. package/widgets/OrientedImageryViewer/constants.js +1 -1
  658. package/widgets/OrientedImageryViewer/services/SuperimposeService.js +1 -1
  659. package/widgets/OrientedImageryViewer/support/superimposeUtils.js +1 -1
  660. package/widgets/OrientedImageryViewer/types.js +1 -1
  661. package/widgets/OrientedImageryViewer/videoViewerUtils.js +1 -1
  662. package/widgets/OrientedImageryViewer.js +1 -1
  663. package/widgets/PanoramicViewer/PanoramicVideoViewerViewModel.js +1 -1
  664. package/widgets/Popup.d.ts +2 -24
  665. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  666. package/widgets/TableList/support/tableListUtils.js +1 -1
  667. package/widgets/TableList.js +1 -1
  668. package/widgets/VideoPlayer/VideoPlayerViewModel.d.ts +9 -0
  669. package/widgets/VideoPlayer/VideoPlayerViewModel.js +1 -1
  670. package/widgets/VideoPlayer/components/PlayerControlsGroup.js +1 -1
  671. package/widgets/support/ContingentValuesManager.js +1 -1
  672. package/widgets/support/forms/formUtils.js +1 -1
  673. package/assets/esri/core/workers/chunks/09630888267cde87654f.js +0 -1
  674. package/assets/esri/core/workers/chunks/0d9d33f29124d464a4cb.js +0 -1
  675. package/assets/esri/core/workers/chunks/0e333f1bce992508b68a.js +0 -1
  676. package/assets/esri/core/workers/chunks/0fa207c68dfd7ddee160.js +0 -1
  677. package/assets/esri/core/workers/chunks/13838b6c045425e73cf8.js +0 -1
  678. package/assets/esri/core/workers/chunks/177472a6a9beb1590934.js +0 -1
  679. package/assets/esri/core/workers/chunks/1d0f9f147bfa00b38d48.js +0 -1
  680. package/assets/esri/core/workers/chunks/1d54b71c43d9d6a5f713.js +0 -1
  681. package/assets/esri/core/workers/chunks/1f6b7626f333809837ef.js +0 -1
  682. package/assets/esri/core/workers/chunks/24646a1176ce34039155.js +0 -1
  683. package/assets/esri/core/workers/chunks/268ed861c882740c805b.js +0 -1
  684. package/assets/esri/core/workers/chunks/2b52c1c01cf568ba01fb.js +0 -1
  685. package/assets/esri/core/workers/chunks/3116a1c2b67a296ba86e.js +0 -1
  686. package/assets/esri/core/workers/chunks/32c17c299c7622ae0d71.js +0 -1
  687. package/assets/esri/core/workers/chunks/34f79355145c8e4c59dd.js +0 -1
  688. package/assets/esri/core/workers/chunks/3be111488365768fd917.js +0 -1
  689. package/assets/esri/core/workers/chunks/3f0483cbcd893acf240c.js +0 -1
  690. package/assets/esri/core/workers/chunks/40d251b6b42a41d68bd2.js +0 -1
  691. package/assets/esri/core/workers/chunks/43cc82373be791b7cb4c.js +0 -1
  692. package/assets/esri/core/workers/chunks/4a23b27bfbcfa08fd9a7.js +0 -1
  693. package/assets/esri/core/workers/chunks/4c54cb80c4dc9bbbd395.js +0 -1
  694. package/assets/esri/core/workers/chunks/598271956c46e21e5c09.js +0 -1
  695. package/assets/esri/core/workers/chunks/5b07f3253403fe25ce5b.js +0 -1
  696. package/assets/esri/core/workers/chunks/5b6f2bfdcdd207d8ae42.js +0 -1
  697. package/assets/esri/core/workers/chunks/5c7ba4b8a9ec2e2e02b5.js +0 -1
  698. package/assets/esri/core/workers/chunks/60915a3708a34da1977e.js +0 -1
  699. package/assets/esri/core/workers/chunks/61c523dd9d8027922465.js +0 -1
  700. package/assets/esri/core/workers/chunks/65520a443e3811255bea.js +0 -1
  701. package/assets/esri/core/workers/chunks/671826fe25105aedcce4.js +0 -1
  702. package/assets/esri/core/workers/chunks/6b79c254897ece95b7a3.js +0 -1
  703. package/assets/esri/core/workers/chunks/6c35583707f5c339ee99.js +0 -1
  704. package/assets/esri/core/workers/chunks/6cb467a9517f024be72f.js +0 -1
  705. package/assets/esri/core/workers/chunks/71119398ec91f1b209d7.js +0 -1
  706. package/assets/esri/core/workers/chunks/8ac8ef856ed9592c433b.js +0 -1
  707. package/assets/esri/core/workers/chunks/8fedb32055ac7f771419.js +0 -1
  708. package/assets/esri/core/workers/chunks/9482a6d7baa24bbf5693.js +0 -1
  709. package/assets/esri/core/workers/chunks/9c11e1fe785e1385fdb1.js +0 -1
  710. package/assets/esri/core/workers/chunks/a567d001fcfa1f1cdeea.js +0 -1
  711. package/assets/esri/core/workers/chunks/a58662698c69190a12d8.js +0 -2
  712. package/assets/esri/core/workers/chunks/afdc6fc453157528cf9b.js +0 -1
  713. package/assets/esri/core/workers/chunks/b5ced451d331ca1ffb68.js +0 -1
  714. package/assets/esri/core/workers/chunks/b7f5d51ac26f37837b3b.js +0 -1
  715. package/assets/esri/core/workers/chunks/ba7fe21a78ea37a02b7c.js +0 -1
  716. package/assets/esri/core/workers/chunks/bb3ab2453ccde2f2611c.js +0 -1
  717. package/assets/esri/core/workers/chunks/beba9f2213d8a850ddb6.js +0 -1
  718. package/assets/esri/core/workers/chunks/c1189316d24fb4cdb2a0.js +0 -1
  719. package/assets/esri/core/workers/chunks/c9461568e1002ebac534.js +0 -1
  720. package/assets/esri/core/workers/chunks/d30790c69724258dab2b.js +0 -1
  721. package/assets/esri/core/workers/chunks/d35c475f004367e333eb.js +0 -1
  722. package/assets/esri/core/workers/chunks/d8c4fb66c733ab2f66d3.js +0 -1
  723. package/assets/esri/core/workers/chunks/d95ffd990b3a7df69e1e.js +0 -1
  724. package/assets/esri/core/workers/chunks/dd6efa0afe879bd11a2e.js +0 -1
  725. package/assets/esri/core/workers/chunks/dec51409372764e7093d.js +0 -1
  726. package/assets/esri/core/workers/chunks/e133840540abf20262a4.js +0 -1
  727. package/assets/esri/core/workers/chunks/e63e24101e7e92c62d98.js +0 -1
  728. package/assets/esri/core/workers/chunks/e785f76c1a75cb1d1e1f.js +0 -1
  729. package/assets/esri/core/workers/chunks/f27397379c6c88bc6ef4.js +0 -1
  730. package/assets/esri/core/workers/chunks/f53805c7a84203305b2c.js +0 -1
  731. package/assets/esri/core/workers/chunks/f60292d97bcdbf19165b.js +0 -1
  732. package/assets/esri/core/workers/chunks/f6ebec8d2248c719b89f.js +0 -1
  733. package/assets/esri/core/workers/chunks/fd2afff07aaac8203c18.js +0 -1
  734. package/assets/esri/core/workers/chunks/ff7708aaa2de720e3a47.js +0 -1
  735. /package/assets/esri/core/workers/chunks/{53bf9b0c2b8da12820ea.js.LICENSE.txt → 29b00d07d3e1d095c590.js.LICENSE.txt} +0 -0
  736. /package/assets/esri/core/workers/chunks/{a58662698c69190a12d8.js.LICENSE.txt → 35fdd62277fd06468a29.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as i,removeMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{initial as o,watch as a,when as n}from"../../../core/reactiveUtils.js";import{schedule as l}from"../../../core/scheduling.js";import{property as c,subclass as d}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as h,invert as u}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as m,IDENTITY as p}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as b}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as f}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{normalize as g,sub as y,dot as _,set as v}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as w,freeze as x,clone as T,fromValues as j,ZEROS as C}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as O,clone as E,ONES as M}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMoon as R,isMars as V,getReferenceEllipsoid as S,SphericalECEFSpatialReferenceLike as U}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as H}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as D}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as P}from"../../../geometry/projection/projectVectorToVector.js";import{create as I}from"../../../geometry/support/aaBoundingRect.js";import{isCGCS2000 as k}from"../../../geometry/support/spatialReferenceUtils.js";import{BufferViewVec4f as L,BufferViewVec4u8 as A,BufferViewVec4u16 as F,BufferViewVec3f as G,BufferViewVec3u8 as B,BufferViewVec3u16 as z,BufferViewVec2f as N,BufferViewUint32 as W,BufferViewUint16 as q}from"../../../geometry/support/buffer/BufferView.js";import $ from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as X}from"../../../support/elevationInfoUtils.js";import{IntegratedMesh3DTilesLayerWorkerHandle as Z}from"./IntegratedMesh3DTilesLayerWorkerHandle.js";import{LayerView3D as J}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as Y}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as Q,removeLayerViewFromWasm as K,getLyr3DWasm as ee}from"./Lyr3DWasm.js";import{toWasmModification as te}from"./SceneLayerWorkerHandle.js";import{LayerElevationProvider as ie}from"./i3s/LayerElevationProvider.js";import{IntegratedMesh3DTilesLayerView3DSymbol as se}from"./support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{primTypeConversion as re,alphaModeConversion as oe,faceCullingConversion as ae,wrapModeConversion as ne}from"./support/lyr3dTypeConversions.js";import{makeScheduleFunction as le}from"./support/makeScheduleFunction.js";import{Tiles3DMeshIntersectionHandler as ce}from"./support/Tiles3DMeshIntersectionHandler.js";import{Frustum as de}from"../state/Frustum.js";import{ElevationRange as he}from"../support/ElevationRange.js";import{toBoundingRect as ue}from"../support/extentUtils.js";import{Obb as me}from"../support/orientedBoundingBox.js";import{glLayout as pe}from"../support/buffer/glUtil.js";import{ComponentGeometryParameters as be,SourceGeometry as fe}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as ge}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as ye}from"../webgl-engine/core/material/RenderTexture.js";import{ManagedTexture as _e}from"../webgl-engine/lib/ManagedTexture.js";import{compressNormals as ve}from"../webgl-engine/lib/Normals.js";import{advancedMRRFactors as we}from"../webgl-engine/materials/pbrUtils.js";import xe from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as Te,isInEffectiveScaleRange as je,validateScaleRange as Ce}from"../../support/layerViewUtils.js";import{TaskPriority as Oe}from"../../support/Scheduler.js";import{TextureCompressionTracker as Ee}from"../../support/TextureCompressionTracker.js";import{CompressedTextureFormat as Me,SizedPixelFormat as Re}from"../../webgl/enums.js";import{alphaCutoff as Ve}from"../../../webscene/support/AlphaCutoff.js";var Se;function Ue(e,t,i){if("image/vnd-ms.dds"===t)switch(i){case"Dxt1":return Me.COMPRESSED_RGB_S3TC_DXT1_EXT;case"Dxt5":return Me.COMPRESSED_RGBA_S3TC_DXT5_EXT;default:return null}if("image/ktx2"===t)return null;switch(e){case 33319:return Re.RG8;case 6407:return Re.RGB8;case 6408:return Re.RGBA8;case 6403:return Re.R8;default:return null}}let He=class extends(J(xe)){static{Se=se}constructor(e){super(e),this[Se]=!0,this.type="integrated-mesh-3dtiles",this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this.drapeTargetType=1,this._replacesTerrain=!1,this._isUsedAsGroundLayer=!1,this._applySSAO=!has("disable-feature:im-ssao"),this._imShading=!!has("enable-feature:im-shading"),this._imVertexNormals=!!has("enable-feature:im-vertex-normals"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._loadedObjects=new Set,this._compressionTracker=new Ee,this._dbgFlags=new Set;const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e)),this._replacesTerrain=e.layer.replacesTerrain,this._isUsedAsGroundLayer=e.layer.isUsedAsGroundLayer,this._frameTask=t.scheduler.registerTask(Oe.TILES3D,this),this._frustum=new de(e.view.renderCoordsHelper)}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{r(t);const i=this.layer.queryElevationCallback;this.layer=e,this.layer.queryElevationCallback=i}):null}canRecycleWith(e){return e.url===this.layer.url&&"integrated-mesh-3dtiles"===e.type&&e.replacesTerrain===this._replacesTerrain&&e.isUsedAsGroundLayer===this._isUsedAsGroundLayer}initialize(){this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._workerHandle=new Z(le(e.resourceController)),this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),o),!this._canProjectWithoutEngine())throw Te("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=Q(this).then(t=>{this._wasmLayerId=t,this._intersectionHandler=new ce(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged()),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),o),this._updatingHandles.add(()=>e.state.contentCamera,()=>this._cameraChanged(),o),this._elevationProvider=new ie({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler});const i=this._replacesTerrain?0:1;e.elevationProvider.register(i,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([a(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),n(()=>this.fullOpacity,()=>this._opacityChange()),a(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),o)])});this.layer.queryElevationCallback=(e,t)=>this._wasm.queryElevation(this,e,t),this.addResolvingPromise(t)}destroy(){this._dbg(2,"Tiles3DLayerView3D destroy() called"),this._workerHandle?.destroyContextAndSelf(this.uid),K(this),this.layer.queryElevationCallback=null,this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler.destroy(),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>this.forEachComponentObject(t=>e(t.obb))),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._loadedObjects.clear(),this._usedMemory=0,this._cacheMemory=0,this._memCache.destroy(),this._frameTask.remove(),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=s(this._visibleGeometryChangedSchedulerHandle)}get fullOpacity(){return this.layer.replacesTerrain?this.view.map.ground.opacity:1}get hasModifications(){return this._modifications&&this._modifications.length>0}_opacityChange(){const{fullOpacity:e}=this;this.forEachComponentObject(t=>this._collection.updateObjectOpacity(t,e))}_cameraChanged(){const e=this._frustum;e.update(this.view.state.contentCamera);const t=this._visibleObjects;let i=!1;this._loadedObjects.forEach(s=>{const r=s.obb?.intersectsFrustum(e)??!1;r!==s.isVisible&&(s.isVisible=r,r?t.add(s):t.delete(s),s.componentObjects.forEach(e=>this._collection.setObjectVisibility(e,r)),i||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(r,s.elevationRange))}),i&&this._setVisibleElevationRangeDirty()}intersect(e,t,i,s){this._intersectionHandler.intersect(e,t,i,s,null,!1)}get ready(){return!this.layer.replacesTerrain||!!this._wasm?.isTerrainReady}_modificationsChanged(){const e=this.layer.spatialReference,t=te(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=I();this._layerClippingArea=ue(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=l(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this.layer.replacesTerrain),this.forEachComponentObject(t=>t.updateMaterial({slicePlaneEnabled:e}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,X(e))}get _wasm(){return ee(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get visibleAtCurrentScale(){return this.layer.isUsedAsGroundLayer||je(this.layer.effectiveScaleRange,this.view.scale)}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&(this.layer.isUsedAsGroundLayer||Ce(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,i=0,s=0,r=0,o=0;return this._lyrHandleToObjects.forEach(a=>{a.isLoaded?(e+=a.textureMemoryUsage,t+=a.vboMemoryUsage,r++):(i+=a.textureMemoryUsage,s+=a.vboMemoryUsage,o++)}),new Y(this.usedMemory,r,o,Ie(t),Ie(e),Ie(s),Ie(i))}_canProjectWithoutEngine(){if(this.view.state.isLocal){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return X(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new he(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new he;0===this._visibleObjects.size?e.setElevationRangeValues(0,0):(e.setElevationRangeValues(1/0,-1/0),this._forEachRelevantVisibleTile(t=>e.expandElevationRange(t.elevationRange)),e.minElevation===1/0&&e.setElevationRangeValues(0,0));const t=this._get("visibleElevationRange");return t&&t.minElevation===e.minElevation&&t.maxElevation===e.maxElevation?t:e}_setVisibleElevationRangeDirty(){this.notifyChange("visibleElevationRange")}_forEachRelevantVisibleTile(e){const{view:t}=this,{spatialReference:i}=t,s=i.isWGS84||i.isWebMercator||k(i)||R(i)||V(i);if(this.view.state.isGlobal||!s)return this.forEachVisibleTile(e);const r=S(i).radius,{eye:o,viewForward:a,near:n}=t.state.camera,l=g(w(),a),c=500,d=Math.max(o[2],c),h=d+r,u=Math.sqrt(h**2-r**2),m=Math.abs(Math.atan2(u,r))*r,p=d>.5*r?.5*Math.PI*r:m,b=w();this.forEachVisibleTile(t=>{const{mbsRadius:i,mbsCenter:s}=t;if(i<0)return;y(b,s,o);const r=_(b,l);Math.abs(r)<p&&r+i>n&&r-i<p&&e(t)})}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachTile(e){for(const t of this._loadedObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const{componentObjects:i}of e)for(const e of i)t(e)}isUpdating(){const e=this._wasm;return this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}get readyToRun(){return!!this._frameTask?.readyToRun}runTask(e){this._frameTask.processQueue(e)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");const{meshData:t}=e;if(!Ge(t))throw new Error("meshData not valid");const i=new Map;let s;try{s=this._createPrimitiveTextureBundles(t,i)}catch(o){throw i.forEach(e=>this._stage.removeTexture(e)),o}let r=null;try{if(r=await this._createRenderableMain(t,s),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable aborted due to destroyed instance");const{tileObb:o,componentObjects:a,elevationRange:n}=r;let l=0,c=0,d=0;for(const e of a){const{texture:t,textureMetallicRoughness:i,textureEmissive:s,textureOcclusion:r,textureNormal:o}=e.renderable.drawParameters;l+=(t?.usedMemory??0)+(i?.usedMemory??0)+(s?.usedMemory??0)+(r?.usedMemory??0)+(o?.usedMemory??0),c+=this._collection.getObjectGPUMemoryUsage(e),d+=e.intersectionGeometry.usedMemory}const h=Array.from(i.values()),u=new Pe(e.handle,a,h,d,c,l,o,e.stableNodeId,e.nodeDepth,n);this._lyrHandleToObjects.set(e.handle,u),this._memCache.put(Le(u.handle),u);const{usedMemory:m}=u;return this._cacheMemory+=m,{memUsageBytes:m}}catch(o){throw s.forEach(e=>e.cleanup()),r?.componentObjects.forEach(e=>this._collection.destroyObject(e)),i.forEach(e=>this._stage.removeTexture(e)),o}}_createPrimitiveTextureBundles(e,t){const i=new Array,s=e.desc.prims.length;try{const r=e.desc;for(let o=0;o<s;o++){const s=r.prims[o].materialId,a=r.materials&&null!=s?r.materials[s]:null;let n=Promise.resolve(Ae),l=null,c=null,d=null,h=null,u=null;if(a){const i="Pbr"===a.lightingModel;l=this._getTexture(a.baseColorTex,e,t),c=i?this._getTexture(a.metalTex,e,t):null,d=i?this._getTexture(a.emissiveTex,e,t):null,h=i?this._getTexture(a.occlusionTex,e,t):null,u=i?this._getTexture(a.normalTex,e,t):null;const s=[l,c,d,h,u].map(e=>e?.loadPromise??null);n=Promise.all(s)}i.push(new Fe(n,l,c,d,h,u))}}catch(r){throw i.forEach(e=>e.cleanup()),r}return i}async _createRenderableMain(e,t){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain called after destroy");const i=new Array,s=e.desc,r=e.data.buffer,o=s.prims.length,a=x(...s.origin),n=this.view.basemapTerrain.spatialReference,l=this.view.state.isGlobal;let c=p;if(l){const e=b();H(U,a,e,n),c=h(m(),e)}if(null==s.obb)throw new Error("meshData.desc.obb undefined");const d=ke(s.obb),f=l?S(this.view.spatialReference).radius:0,g=new Array;try{for(let i=0;i<o;i++){const e=s.prims[i],o=t[i];this._dbgFlags.has(2)&&this._dbg(2,JSON.stringify(e));if(null==re[e.ptype]){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive."),o.cleanup();continue}const{positionView:a,normalsData:n,colorView:l,texCoord0Data:c,indicesView:d}=this.getBufferViews(e,r);if(null==a||null==d){o.cleanup();continue}const h=a.count,u=(e,t)=>null==e||e===h||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);u(null!=c?c.length/2:void 0,"numTexcoord")&&u(l?.count,"numColors")&&u(n?.length,"normals")?g.push({componentIndex:i,positionView:a,indicesView:d,texCoord0Data:c,colorView:l,normalsData:n}):o.cleanup()}const e=c!==p,h=e?u(m(),c)??p:p,{vertexProcessingOutputs:b,obbHalfSizeAccumulator:y,elevationRange:_}=await this._workerHandle.processTiles3DVertices(g,a,f,l,c,d,this._imVertexNormals);if(this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");const v=s.materials;if(await Promise.all(t.map(e=>e.materialPromise)),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");for(const r of b){const{componentIndex:o,positionView:l,indicesView:c,layout:u,textureCoordinateType:m,interleavedVertexData:p,indices:b}=r,f=s.prims[o],g=t[o],y=d.clone(),_=pe(u),x=new Uint32Array([0,c.typedBuffer.length]),T=new be(_,this._imShading?2:0,m,e?2:0,0),j=new fe({interleavedVertexData:p,vertexCount:p.byteLength/_[0].stride,indexData:b},{positions:l.typedBuffer,indices:c.typedBuffer},x,T),C=this.view.renderSpatialReference,E=w(),M=[1,1,1];D(a,C,M,n)||this._dbg(3,"Unsupported coordinate system for IM overlay"),P(a,C,E,n);const R=v&&null!=f.materialId?v[f.materialId]:null,V=this._createComponentMaterialInitParameters(R,g);V.baseColorTexture||this._dbg(3,"No colour texture 1");const S=this._collection.createObject({toMapSpace:O(E[0],E[1],M[0],M[1]),transform:new ge(a,h),obb:y,geometry:j,elevationAlignable:!1},V);i.push(S)}i.length>0&&d.setHalfSize(y[0],y[1],y[2]);const{fullExtent:x}=this.layer;return x?.hasZ&&x.zmax&&x.zmin&&(_.minElevation=Math.max(_.minElevation,x.zmin),_.maxElevation=Math.min(_.maxElevation,x.zmax)),{tileObb:d,componentObjects:i,elevationRange:_}}catch(y){throw i.forEach(e=>this._collection.destroyObject(e)),y}}_createComponentMaterialInitParameters(e,t){const i="Pbr"===(null!=e?e.lightingModel:"Unlit");let s=M,r=Ve,o=1,a=!1,n=2,l=j(0,0,0);const c=T(we),d=t.baseColorTexture,h=t.metallicRoughnessTexture,u=t.emissionTexture,m=t.occlusionTexture,p=t.normalTexture;return e&&(s=E(e.baseColorFactor),r=e.alphaCutoff??Ve,i&&(v(c,e.metallicFactor,e.roughnessFactor,0),e.emissiveFactor&&(l=e.emissiveFactor)),o=oe[e.alphaMode],a=e.isDoubleSided,n=ae[e.faceCulling??"NotSet"]),{isIntegratedMesh:!0,baseColor:s,textureAlphaCutoff:r,mrrFactors:c,baseColorTexture:d,metallicRoughnessTexture:h,normalTexture:p,occlusionTexture:m,emissionTexture:u,hasParametersFromSource:!1,sphereDepthInterpolate:this.layer.hasGoogleUrl,alphaDiscardMode:o,doubleSided:a,cullFace:n,isGround:this.layer.replacesTerrain,emissiveBaseColor:l,usePBR:i,slicePlaneEnabled:this.slicePlaneEnabled,opacity:this.fullOpacity,polygonOffset:0,ellipsoidMode:1,applySSAO:this._applySSAO}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t?(t.isLoaded?(this._loadedObjects.delete(t),this._visibleObjects.delete(t),this._intersectionHandler.removeTile(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e)):this._dbg(3,`freeRendedrable on non-existent renderable ${e}`)}freeObject(e){const t=Le(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){if(this.destroyed||this.destroying)return;const s=this._frustum,r=new Array;let o=!1,a=!1;for(let n=0;n<i;++n){if(!t[n])continue;const i=e[n],l=this._lyrHandleToObjects.get(i);if(l){if(l.isLoaded){this._dbg(3,`Already loaded object marked loaded again ${l.stableNodeId}`);continue}o=!0,l.isLoaded=!0,this._loadedObjects.add(l),this._intersectionHandler.addTile(l),this._usedMemory+=l.usedMemory,this._cacheMemory-=l.usedMemory;const e=l.obb?.intersectsFrustum(s)??!0;l.isVisible=e,e&&(this._visibleObjects.add(l),a||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(e,l.elevationRange)),e&&l.obb&&r.push(l.obb),l.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(Le(i))}else this._dbg(3,`Tried to mark Non existent object ${i} as loaded`)}for(let n=0;n<i;++n){const i=e[n];if(t[n])continue;const s=this._lyrHandleToObjects.get(i);if(s){if(!s.isLoaded){this._dbg(3,`Tried to unload not-loaded object ${s.stableNodeId}`);continue}const e=s.isVisible;this._visibleObjects.delete(s),s.isVisible=!1,s.isLoaded=!1,this._loadedObjects.delete(s),this._intersectionHandler.removeTile(s),e&&(this._visibleGeometryChanged(),a||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(!1,s.elevationRange)),this._usedMemory-=s.usedMemory,this._cacheMemory+=s.usedMemory,e&&s.obb&&r.push(s.obb),s.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,!1)}),this._memCache.put(Le(i),s)}else this._dbg(3,`Tried to mark Non existent object ${i} as not loaded`)}o&&this._visibleGeometryChanged(),this._elevationProvider.notifyObjectsChanged(r),a&&this._setVisibleElevationRangeDirty()}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_isVisibileElevationRangeModifiedByChangedTileVisbility(e,t){const{visibleElevationRange:i}=this,{minElevation:s,maxElevation:r}=t;return e?s<i.minElevation||r>i.maxElevation:s===i.minElevation||r===i.maxElevation}_getTexture(e,t,i){const s=e&&t.desc?.images?.[e.imageId];if(!s||!t.data?.buffer)return null;const r=i.get(s)??this._createTexture(e,t,i);return r?new ye(this._stage.renderView.textures,r.id):null}_createTexture(e,t,i){const s=e&&t.desc?.images?.[e.imageId];if(!s||!t.data?.buffer)return null;const r=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,o=!!s.mipCount||r>1,a=ne[e.wrapMode??"None"];let n=s.alpha?6408:6407;const l=new Uint8Array(t.data.buffer,s.data.byteOffset,s.data.byteCount);let c=null,d=null,h=null;switch(s.format){case"Raw":"R8"===s.pixelFormat?(c=l,n=6403,d=""):"Rg8"===s.pixelFormat||"Ga8"===s.pixelFormat?(c=l,n=33319,d=""):"Rgb8"===s.pixelFormat?(c=l,n=6407,d=""):"Rgba8"===s.pixelFormat&&(c=l,n=6408,d="");break;case"Dxt1":c=l,n=6407,d="image/vnd-ms.dds";break;case"Dxt5":c=l,n=6408,d="image/vnd-ms.dds";break;case"Basis":c=l,n=6407,d="image/ktx2";break;case"Png":d="image/png",h=document.createElement("img");break;case"Jpeg":d="image/jpeg",h=document.createElement("img");break;case"Etc2":d="image/ktx",h=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(h&&d){const e=new Blob([l],{type:d});h.src=URL.createObjectURL(e),c=h}if(c&&null!=d){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker}:void 0,t=Ue(n,d,s.format),l=new _e(c,{mipmap:o,maxAnisotropy:r,encoding:d,wrap:a,pixelFormat:n,internalFormat:t??void 0,immutable:null!=t,compressionOptions:e,noUnpackFlip:!0,width:s.mip0Width,height:s.mip0Height});return this._stage.addTexture(l),i.set(s,l),l}return null}getBufferViews(e,t){let i,s,r,o,a;for(let l=0;l<e.atrbs.length;l++){const a=e.atrbs[l],{view:c}=a,d=void 0,h=c.byteOffset+c.byteCount;try{switch(a.sem){case"Position":3!==c.ncomp||"F32"!==c.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+c+")"):i=new G(t,c.byteOffset,d,h);break;case"Normal":if(3!==c.ncomp||"F32"!==c.type)this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+c+")");else{const e=new G(t,c.byteOffset,d,h);o=new Uint32Array(e.count),ve(e.typedBuffer,new Int16Array(o.buffer,o.byteOffset,2*o.length))}break;case"TexCoord":2!==c.ncomp||"F32"!==c.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+c+")"):void 0===r&&(r=new N(t,c.byteOffset,d,h).typedBuffer);break;case"Color":4===c.ncomp?("F32"===c.type&&(s=new L(t,c.byteOffset,d,h)),"U8"===c.type&&(s=new A(t,c.byteOffset,d,h)),"U16"===c.type&&(s=new F(t,c.byteOffset,d,h))):3===c.ncomp&&("F32"===c.type&&(s=new G(t,c.byteOffset,d,h)),"U8"===c.type&&(s=new B(t,c.byteOffset,d,h)),"U16"===c.type&&(s=new z(t,c.byteOffset,d,h))),null==s&&this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+c+")");break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+a.sem+"). Skipping vertex attribute.")}}catch(n){this._dbg(2,"Error Creating buffer ("+n+"). Skipping vertex attribute.")}}if(e.index){const i=e.index.view,s=void 0,r=i.byteOffset+i.byteCount;switch(e.index.view.type){case"U16":a=new q(t,i.byteOffset,s,r);break;case"U32":a=new W(t,i.byteOffset,s,r);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==a&&null!=i){const e=i.count;a=a=e<65535?new q(new Uint16Array(e).buffer):new W(new Uint32Array(e).buffer);for(let t=0;t<e;t++)a.set(t,t)}return{positionView:i,colorView:s,texCoord0Data:r,indicesView:a,normalsData:o}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>{this._modifications=e.filter(e=>!(this.layer.isUsedAsGroundLayer&&"replace"!==e.type)).toArray(),this._modifications.length<e.length&&t.getLogger(this).info("Ground layers only support replace modifications. Other modification types have been ignored.")},o),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([c()],He.prototype,"fullOpacity",null),e([c({readOnly:!0})],He.prototype,"ready",null),e([c({type:[$]})],He.prototype,"_modifications",void 0),e([c()],He.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([c()],He.prototype,"layer",void 0),e([c({readOnly:!0})],He.prototype,"visibleAtCurrentScale",null),e([c({readOnly:!0})],He.prototype,"_collection",null),e([c()],He.prototype,"elevationOffset",null),e([c({readOnly:!0})],He.prototype,"visibleElevationRange",null),He=e([d("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],He);const De=He;class Pe{constructor(e,t,i,s,r,o,a,n,l,c){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=s,this.vboMemoryUsage=r,this.textureMemoryUsage=o,this.obb=a,this.stableNodeId=n,this.nodeDepth=l,this.elevationRange=c,this.bvhIntersectionGeneration=0,this.isLoaded=!1,this.isVisible=!1;const d=w();a?.getCenter(d),this._obbCenterX=d[0],this._obbCenterY=d[1],this._obbCenterZ=d[2];const h=a?.radius??-1;this._obbRadius=h,this._obbRadiusSquared=h*h;const u=a?.halfSize;this._obbShortestHalfsize=u?Math.min(u[0],u[1],u[2]):0,this._mbsCenter=a?T(a.center):C}get usedMemory(){return this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get mbsRadius(){return this._obbRadius}get mbsCenter(){return this._mbsCenter}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const{_obbCenterX:i,_obbCenterY:s,_obbCenterZ:r}=this,o=i-e[0],a=s-e[1],n=r-e[2],l=o*t[0]+a*t[1]+n*t[2];return o*o+a*a+n*n-l*l<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){const t=this._obbRadius;if(t<0)return!0;const i=e.center,s=e.radius,r=t+s,o=this._obbCenterX-i[0];if(o>r)return!1;const a=this._obbCenterY-i[1];if(a>r)return!1;const n=this._obbCenterZ-i[2];if(n>r)return!1;const l=o*o+a*a+n*n;if(l>r*r)return!1;if(l<=(this._obbShortestHalfsize+s)**2)return!0;return Math.sqrt(l)+t<=s||(this.obb?.intersectSphere(e)??!0)}}function Ie(e){return Math.round(e/1048.576)/1e3}function ke(e){return new me(e.center,e.halfSize,f(...e.quaternion))}function Le(e){return`${e}`}const Ae=new Array;class Fe{constructor(e,t,i,s,r,o){this.materialPromise=e,this.baseColorTexture=t,this.metallicRoughnessTexture=i,this.emissionTexture=s,this.occlusionTexture=r,this.normalTexture=o}cleanup(){this.baseColorTexture?.dispose(),this.metallicRoughnessTexture?.dispose(),this.emissionTexture?.dispose(),this.occlusionTexture?.dispose(),this.normalTexture?.dispose()}}function Ge(e){return null!=e.data&&("string"==typeof e.desc&&(e.desc=JSON.parse(e.desc)),null!=e.desc)}export{De as default};
2
+ import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as i,removeMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{initial as o,watch as a,when as n}from"../../../core/reactiveUtils.js";import{schedule as l}from"../../../core/scheduling.js";import{property as c,subclass as d}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as h,invert as u}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as m,IDENTITY as p}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as b}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as f}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{normalize as g,sub as y,dot as _,set as v}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as w,freeze as x,clone as T,fromValues as j,ZEROS as C}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as O,clone as E,ONES as M}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMoon as R,isMars as V,getReferenceEllipsoid as S,SphericalECEFSpatialReferenceLike as U}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as H}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as D}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as P}from"../../../geometry/projection/projectVectorToVector.js";import{create as I}from"../../../geometry/support/aaBoundingRect.js";import{isCGCS2000 as k}from"../../../geometry/support/spatialReferenceUtils.js";import{BufferViewVec4f as L,BufferViewVec4u8 as A,BufferViewVec4u16 as F,BufferViewVec3f as G,BufferViewVec3u8 as B,BufferViewVec3u16 as z,BufferViewVec2f as N,BufferViewUint32 as W,BufferViewUint16 as q}from"../../../geometry/support/buffer/BufferView.js";import $ from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as X}from"../../../support/elevationInfoUtils.js";import{IntegratedMesh3DTilesLayerWorkerHandle as Z}from"./IntegratedMesh3DTilesLayerWorkerHandle.js";import{LayerView3D as J}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as Y}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as Q,removeLayerViewFromWasm as K,getLyr3DWasm as ee}from"./Lyr3DWasm.js";import{toWasmModification as te}from"./SceneLayerWorkerHandle.js";import{LayerElevationProvider as ie}from"./i3s/LayerElevationProvider.js";import{IntegratedMesh3DTilesLayerView3DSymbol as se}from"./support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{primTypeConversion as re,alphaModeConversion as oe,faceCullingConversion as ae,wrapModeConversion as ne}from"./support/lyr3dTypeConversions.js";import{makeScheduleFunction as le}from"./support/makeScheduleFunction.js";import{Tiles3DMeshIntersectionHandler as ce}from"./support/Tiles3DMeshIntersectionHandler.js";import{Frustum as de}from"../state/Frustum.js";import{ElevationRange as he}from"../support/ElevationRange.js";import{toBoundingRect as ue}from"../support/extentUtils.js";import{Obb as me}from"../support/orientedBoundingBox.js";import{glLayout as pe}from"../support/buffer/glUtil.js";import{ComponentGeometryParameters as be,SourceGeometry as fe}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as ge}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as ye}from"../webgl-engine/core/material/RenderTexture.js";import{ManagedTexture as _e}from"../webgl-engine/lib/ManagedTexture.js";import{compressNormals as ve}from"../webgl-engine/lib/Normals.js";import{advancedMRRFactors as we}from"../webgl-engine/materials/pbrUtils.js";import xe from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as Te,isInEffectiveScaleRange as je,validateScaleRange as Ce}from"../../support/layerViewUtils.js";import{TaskPriority as Oe}from"../../support/Scheduler.js";import{TextureCompressionTracker as Ee}from"../../support/TextureCompressionTracker.js";import{CompressedTextureFormat as Me,SizedPixelFormat as Re}from"../../webgl/enums.js";import{alphaCutoff as Ve}from"../../../webscene/support/AlphaCutoff.js";var Se;function Ue(e,t,i){if("image/vnd-ms.dds"===t)switch(i){case"Dxt1":return Me.COMPRESSED_RGB_S3TC_DXT1_EXT;case"Dxt5":return Me.COMPRESSED_RGBA_S3TC_DXT5_EXT;default:return null}if("image/ktx2"===t)return null;switch(e){case 33319:return Re.RG8;case 6407:return Re.RGB8;case 6408:return Re.RGBA8;case 6403:return Re.R8;default:return null}}let He=class extends(J(xe)){static{Se=se}constructor(e){super(e),this[Se]=!0,this.type="integrated-mesh-3dtiles",this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this.drapeTargetType=1,this._replacesTerrain=!1,this._isUsedAsGroundLayer=!1,this._applySSAO=!has("disable-feature:im-ssao"),this._imShading=!!has("enable-feature:im-shading"),this._imVertexNormals=!!has("enable-feature:im-vertex-normals"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._loadedObjects=new Set,this._compressionTracker=new Ee,this._dbgFlags=new Set;const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e)),this._replacesTerrain=e.layer.replacesTerrain,this._isUsedAsGroundLayer=e.layer.isUsedAsGroundLayer,this._frameTask=t.scheduler.registerTask(Oe.TILES3D,this),this._frustum=new de(e.view.renderCoordsHelper)}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{r(t);const i=this.layer.queryElevationCallback;this.layer=e,this.layer.queryElevationCallback=i}):null}canRecycleWith(e){return e.url===this.layer.url&&"integrated-mesh-3dtiles"===e.type&&e.replacesTerrain===this._replacesTerrain&&e.isUsedAsGroundLayer===this._isUsedAsGroundLayer}initialize(){this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._workerHandle=new Z(le(e.resourceController)),this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),o),!this._canProjectWithoutEngine())throw Te("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=Q(this).then(t=>{this._wasmLayerId=t,this._intersectionHandler=new ce(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged()),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),o),this._updatingHandles.add(()=>e.state.contentCamera,()=>this._cameraChanged(),o),this._elevationProvider=new ie({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler});const i=this._replacesTerrain?0:1;e.elevationProvider.register(i,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([a(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),n(()=>this.fullOpacity,()=>this._opacityChange()),a(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),o)])});this.layer.queryElevationCallback=(e,t)=>this._wasm.queryElevation(this,e,t),this.addResolvingPromise(t)}destroy(){this._dbg(2,"Tiles3DLayerView3D destroy() called"),this._workerHandle?.destroyContextAndSelf(this.uid),K(this),this.layer.queryElevationCallback=null,this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler.destroy(),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>this.forEachComponentObject(t=>e(t.obb))),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._loadedObjects.clear(),this._usedMemory=0,this._cacheMemory=0,this._memCache.destroy(),this._frameTask.remove(),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=s(this._visibleGeometryChangedSchedulerHandle)}get fullOpacity(){return this.layer.replacesTerrain?this.view.map.ground.opacity:1}get hasModifications(){return this._modifications&&this._modifications.length>0}_opacityChange(){const{fullOpacity:e}=this;this.forEachComponentObject(t=>this._collection.updateObjectOpacity(t,e))}_cameraChanged(){const e=this._frustum;e.update(this.view.state.contentCamera);const t=this._visibleObjects;let i=!1;this._loadedObjects.forEach(s=>{const r=s.obb?.intersectsFrustum(e)??!1;r!==s.isVisible&&(s.isVisible=r,r?t.add(s):t.delete(s),s.componentObjects.forEach(e=>this._collection.setObjectVisibility(e,r)),i||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(r,s.elevationRange))}),i&&this._setVisibleElevationRangeDirty()}intersect(e,t,i,s){this._intersectionHandler.intersect(e,t,i,s,null,!1)}get ready(){return!this.layer.replacesTerrain||!!this._wasm?.isTerrainReady}_modificationsChanged(){const e=this.layer.spatialReference,t=te(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=I();this._layerClippingArea=ue(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=l(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this.layer.replacesTerrain),this.forEachComponentObject(t=>t.updateMaterial({slicePlaneEnabled:e}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,X(e))}get _wasm(){return ee(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get visibleAtCurrentScale(){return this.layer.isUsedAsGroundLayer||je(this.layer.effectiveScaleRange,this.view.scale)}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&(this.layer.isUsedAsGroundLayer||Ce(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,i=0,s=0,r=0,o=0;return this._lyrHandleToObjects.forEach(a=>{a.isLoaded?(e+=a.textureMemoryUsage,t+=a.vboMemoryUsage,r++):(i+=a.textureMemoryUsage,s+=a.vboMemoryUsage,o++)}),new Y(this.usedMemory,r,o,Ie(t),Ie(e),Ie(s),Ie(i))}_canProjectWithoutEngine(){if(this.view.state.isLocal){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return X(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new he(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new he;0===this._visibleObjects.size?e.setElevationRangeValues(0,0):(e.setElevationRangeValues(1/0,-1/0),this._forEachRelevantVisibleTile(t=>e.expandElevationRange(t.elevationRange)),e.minElevation===1/0&&e.setElevationRangeValues(0,0));const t=this._get("visibleElevationRange");return t&&t.minElevation===e.minElevation&&t.maxElevation===e.maxElevation?t:e}_setVisibleElevationRangeDirty(){this.notifyChange("visibleElevationRange")}_forEachRelevantVisibleTile(e){const{view:t}=this,{spatialReference:i}=t,s=i.isWGS84||i.isWebMercator||k(i)||R(i)||V(i);if(this.view.state.isGlobal||!s)return this.forEachVisibleTile(e);const r=S(i).radius,{eye:o,viewForward:a,near:n}=t.state.camera,l=g(w(),a),c=500,d=Math.max(o[2],c),h=d+r,u=Math.sqrt(h**2-r**2),m=Math.abs(Math.atan2(u,r))*r,p=d>.5*r?.5*Math.PI*r:m,b=w();this.forEachVisibleTile(t=>{const{mbsRadius:i,mbsCenter:s}=t;if(i<0)return;y(b,s,o);const r=_(b,l);Math.abs(r)<p&&r+i>n&&r-i<p&&e(t)})}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachTile(e){for(const t of this._loadedObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const{componentObjects:i}of e)for(const e of i)t(e)}isUpdating(){const e=this._wasm;return this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}get readyToRun(){return!!this._frameTask?.readyToRun}runTask(e){this._frameTask.processQueue(e)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");const{meshData:t}=e;if(!Ge(t))throw new Error("meshData not valid");const i=new Map;let s;try{s=this._createPrimitiveTextureBundles(t,i)}catch(o){throw i.forEach(e=>this._stage.removeTexture(e)),o}let r=null;try{if(r=await this._createRenderableMain(t,s),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable aborted due to destroyed instance");const{tileObb:o,componentObjects:a,elevationRange:n}=r;let l=0,c=0,d=0;for(const e of a){const{texture:t,textureMetallicRoughness:i,textureEmissive:s,textureOcclusion:r,textureNormal:o}=e.renderable.drawParameters;l+=(t?.usedMemory??0)+(i?.usedMemory??0)+(s?.usedMemory??0)+(r?.usedMemory??0)+(o?.usedMemory??0),c+=this._collection.getObjectGPUMemoryUsage(e),d+=e.intersectionGeometry.usedMemory}const h=Array.from(i.values()),u=new Pe(e.handle,a,h,d,c,l,o,e.stableNodeId,e.nodeDepth,n);this._lyrHandleToObjects.set(e.handle,u),this._memCache.put(Le(u.handle),u);const{usedMemory:m}=u;return this._cacheMemory+=m,{memUsageBytes:m}}catch(o){throw s.forEach(e=>e.cleanup()),r?.componentObjects.forEach(e=>this._collection.destroyObject(e)),i.forEach(e=>this._stage.removeTexture(e)),o}}_createPrimitiveTextureBundles(e,t){const i=new Array,s=e.desc.prims.length;try{const r=e.desc;for(let o=0;o<s;o++){const s=r.prims[o].materialId,a=r.materials&&null!=s?r.materials[s]:null;let n=Promise.resolve(Ae),l=null,c=null,d=null,h=null,u=null;if(a){const i="Pbr"===a.lightingModel;l=this._getTexture(a.baseColorTex,e,t),c=i?this._getTexture(a.metalTex,e,t):null,d=i?this._getTexture(a.emissiveTex,e,t):null,h=i?this._getTexture(a.occlusionTex,e,t):null,u=i?this._getTexture(a.normalTex,e,t):null;const s=[l,c,d,h,u].map(e=>e?.loadPromise??null);n=Promise.all(s)}i.push(new Fe(n,l,c,d,h,u))}}catch(r){throw i.forEach(e=>e.cleanup()),r}return i}async _createRenderableMain(e,t){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain called after destroy");const i=new Array,s=e.desc,r=e.data.buffer,o=s.prims.length,a=x(...s.origin),n=this.view.basemapTerrain.spatialReference,l=this.view.state.isGlobal;let c=p;if(l){const e=b();H(U,a,e,n),c=h(m(),e)}if(null==s.obb)throw new Error("meshData.desc.obb undefined");const d=ke(s.obb),f=l?S(this.view.spatialReference).radius:0,g=new Array;try{for(let i=0;i<o;i++){const e=s.prims[i],o=t[i];this._dbgFlags.has(2)&&this._dbg(2,JSON.stringify(e));if(null==re[e.ptype]){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive."),o.cleanup();continue}const{positionView:a,normalsData:n,colorView:l,texCoord0Data:c,indicesView:d}=this.getBufferViews(e,r);if(null==a||null==d){o.cleanup();continue}const h=a.count,u=(e,t)=>null==e||e===h||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);u(null!=c?c.length/2:void 0,"numTexcoord")&&u(l?.count,"numColors")&&u(n?.length,"normals")?g.push({componentIndex:i,positionView:a,indicesView:d,texCoord0Data:c,colorView:l,normalsData:n}):o.cleanup()}const e=c!==p,h=e?u(m(),c)??p:p,{vertexProcessingOutputs:b,obbHalfSizeAccumulator:y,elevationRange:_}=await this._workerHandle.processTiles3DVertices(g,a,f,l,c,d,this._imVertexNormals);if(this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");const v=s.materials;if(await Promise.all(t.map(e=>e.materialPromise)),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");for(const r of b){const{componentIndex:o,positionView:l,indicesView:c,layout:u,textureCoordinateType:m,interleavedVertexData:p,indices:b}=r,f=s.prims[o],g=t[o],y=d.clone(),_=pe(u),x=new Uint32Array([0,c.typedBuffer.length]),T=new be(_,this._imShading?2:0,m,e?2:0,0),j=new fe({interleavedVertexData:p,vertexCount:p.byteLength/_[0].stride,indexData:b},{positions:l.typedBuffer,indices:c.typedBuffer},x,T),C=this.view.renderSpatialReference,E=w(),M=[1,1,1];D(a,C,M,n)||this._dbg(3,"Unsupported coordinate system for IM overlay"),P(a,C,E,n);const R=v&&null!=f.materialId?v[f.materialId]:null,V=this._createComponentMaterialInitParameters(R,g);V.baseColorTexture||this._dbg(3,"No colour texture 1");const S=this._collection.createObject({toMapSpace:O(E[0],E[1],M[0],M[1]),transform:new ge(a,h),obb:y,geometry:j,elevationAlignable:!1},V);i.push(S)}i.length>0&&d.setHalfSize(y[0],y[1],y[2]);const{fullExtent:x}=this.layer;return x?.hasZ&&x.zmax&&x.zmin&&(_.minElevation=Math.max(_.minElevation,x.zmin),_.maxElevation=Math.min(_.maxElevation,x.zmax)),{tileObb:d,componentObjects:i,elevationRange:_}}catch(y){throw i.forEach(e=>this._collection.destroyObject(e)),y}}_createComponentMaterialInitParameters(e,t){const i="Pbr"===(null!=e?e.lightingModel:"Unlit");let s=M,r=Ve,o=1,a=!1,n=2,l=j(0,0,0);const c=T(we),d=t.baseColorTexture,h=t.metallicRoughnessTexture,u=t.emissionTexture,m=t.occlusionTexture,p=t.normalTexture;return e&&(s=E(e.baseColorFactor),r=e.alphaCutoff??Ve,i&&(v(c,e.metallicFactor,e.roughnessFactor,0),e.emissiveFactor&&(l=e.emissiveFactor)),o=oe[e.alphaMode],a=e.isDoubleSided,n=ae[e.faceCulling??"NotSet"]),{isIntegratedMesh:!0,baseColor:s,textureAlphaCutoff:r,mrrFactors:c,baseColorTexture:d,metallicRoughnessTexture:h,normalTexture:p,occlusionTexture:m,emissionTexture:u,hasParametersFromSource:!1,sphereDepthInterpolate:this.layer.hasGoogleUrl,alphaDiscardMode:o,doubleSided:a,cullFace:n,isGround:this.layer.replacesTerrain,emissiveBaseColor:l,usePBR:i,slicePlaneEnabled:this.slicePlaneEnabled,opacity:this.fullOpacity,polygonOffset:0,ellipsoidMode:1,applySSAO:this._applySSAO}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t?(t.isLoaded?(this._loadedObjects.delete(t),this._visibleObjects.delete(t),this._intersectionHandler.removeTile(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e)):this._dbg(3,`freeRendedrable on non-existent renderable ${e}`)}freeObject(e){const t=Le(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){if(this.destroyed||this.destroying)return;const s=this._frustum,r=new Array;let o=!1,a=!1;for(let n=0;n<i;++n){if(!t[n])continue;const i=e[n],l=this._lyrHandleToObjects.get(i);if(l){if(l.isLoaded){this._dbg(3,`Already loaded object marked loaded again ${l.stableNodeId}`);continue}o=!0,l.isLoaded=!0,this._loadedObjects.add(l),this._intersectionHandler.addTile(l),this._usedMemory+=l.usedMemory,this._cacheMemory-=l.usedMemory;const e=l.obb?.intersectsFrustum(s)??!0;l.isVisible=e,e&&(this._visibleObjects.add(l),a||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(e,l.elevationRange)),e&&l.obb&&r.push(l.obb),l.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(Le(i))}else this._dbg(3,`Tried to mark Non existent object ${i} as loaded`)}for(let n=0;n<i;++n){const i=e[n];if(t[n])continue;const s=this._lyrHandleToObjects.get(i);if(s){if(!s.isLoaded){this._dbg(3,`Tried to unload not-loaded object ${s.stableNodeId}`);continue}const e=s.isVisible;this._visibleObjects.delete(s),s.isVisible=!1,s.isLoaded=!1,this._loadedObjects.delete(s),this._intersectionHandler.removeTile(s),e&&(this._visibleGeometryChanged(),a||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(!1,s.elevationRange)),this._usedMemory-=s.usedMemory,this._cacheMemory+=s.usedMemory,e&&s.obb&&r.push(s.obb),s.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,!1)}),this._memCache.put(Le(i),s)}else this._dbg(3,`Tried to mark Non existent object ${i} as not loaded`)}o&&this._visibleGeometryChanged(),this._elevationProvider.notifyObjectsChanged(r),a&&this._setVisibleElevationRangeDirty()}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_isVisibileElevationRangeModifiedByChangedTileVisbility(e,t){const{visibleElevationRange:i}=this,{minElevation:s,maxElevation:r}=t;return e?s<i.minElevation||r>i.maxElevation:s===i.minElevation||r===i.maxElevation}_getTexture(e,t,i){const s=e&&t.desc?.images?.[e.imageId];if(!s||!t.data?.buffer)return null;const r=i.get(s)??this._createTexture(e,t,i);return r?new ye(this._stage.renderView.textures,r.id):null}_createTexture(e,t,i){const s=e&&t.desc?.images?.[e.imageId];if(!s||!t.data?.buffer)return null;const r=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,o=!!s.mipCount||r>1,a=ne[e.wrapMode??"None"];let n=s.alpha?6408:6407;const l=new Uint8Array(t.data.buffer,s.data.byteOffset,s.data.byteCount);let c=null,d=null,h=null;switch(s.format){case"Raw":"R8"===s.pixelFormat?(c=l,n=6403,d=""):"Rg8"===s.pixelFormat||"Ga8"===s.pixelFormat?(c=l,n=33319,d=""):"Rgb8"===s.pixelFormat?(c=l,n=6407,d=""):"Rgba8"===s.pixelFormat&&(c=l,n=6408,d="");break;case"Dxt1":c=l,n=6407,d="image/vnd-ms.dds";break;case"Dxt5":c=l,n=6408,d="image/vnd-ms.dds";break;case"Basis":c=l,n=6407,d="image/ktx2";break;case"Png":d="image/png",h=document.createElement("img");break;case"Jpeg":d="image/jpeg",h=document.createElement("img");break;case"Etc2":d="image/ktx",h=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(h&&d){const e=new Blob([l],{type:d});h.src=URL.createObjectURL(e),c=h}if(c&&null!=d){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker}:void 0,t=Ue(n,d,s.format),l=new _e(c,{mipmap:o,maxAnisotropy:r,encoding:d,wrap:a,pixelFormat:n,internalFormat:t??void 0,immutable:null!=t,compressionOptions:e,noUnpackFlip:!0,width:s.mip0Width,height:s.mip0Height});return this._stage.addTexture(l),i.set(s,l),l}return null}getBufferViews(e,t){let i,s,r,o,a;for(let l=0;l<e.atrbs.length;l++){const a=e.atrbs[l],{view:c}=a,d=void 0,h=c.byteOffset+c.byteCount;try{switch(a.sem){case"Position":3!==c.ncomp||"F32"!==c.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+c+")"):i=new G(t,c.byteOffset,d,h);break;case"Normal":if(3!==c.ncomp||"F32"!==c.type)this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+c+")");else{const e=new G(t,c.byteOffset,d,h);o=new Uint32Array(e.count),ve(e.typedBuffer,new Int16Array(o.buffer,o.byteOffset,2*o.length))}break;case"TexCoord":2!==c.ncomp||"F32"!==c.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+c+")"):void 0===r&&(r=new N(t,c.byteOffset,d,h).typedBuffer);break;case"Color":4===c.ncomp?("F32"===c.type&&(s=new L(t,c.byteOffset,d,h)),"U8"===c.type&&(s=new A(t,c.byteOffset,d,h)),"U16"===c.type&&(s=new F(t,c.byteOffset,d,h))):3===c.ncomp&&("F32"===c.type&&(s=new G(t,c.byteOffset,d,h)),"U8"===c.type&&(s=new B(t,c.byteOffset,d,h)),"U16"===c.type&&(s=new z(t,c.byteOffset,d,h))),null==s&&this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+c+")");break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+a.sem+"). Skipping vertex attribute.")}}catch(n){this._dbg(2,"Error Creating buffer ("+n+"). Skipping vertex attribute.")}}if(e.index){const i=e.index.view,s=void 0,r=i.byteOffset+i.byteCount;switch(e.index.view.type){case"U16":a=new q(t,i.byteOffset,s,r);break;case"U32":a=new W(t,i.byteOffset,s,r);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==a&&null!=i){const e=i.count;a=a=e<65535?new q(new Uint16Array(e).buffer):new W(new Uint32Array(e).buffer);for(let t=0;t<e;t++)a.set(t,t)}return{positionView:i,colorView:s,texCoord0Data:r,indicesView:a,normalsData:o}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>{this._modifications=e.filter(e=>!(this.layer.isUsedAsGroundLayer&&"replace"!==e.type)).toArray(),this._modifications.length<e.length&&t.getLogger(this).info("Ground layers only support replace modifications. Other modification types have been ignored.")},o),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([c()],He.prototype,"fullOpacity",null),e([c({readOnly:!0})],He.prototype,"ready",null),e([c({type:[$]})],He.prototype,"_modifications",void 0),e([c()],He.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([c()],He.prototype,"layer",void 0),e([c({readOnly:!0})],He.prototype,"visibleAtCurrentScale",null),e([c({readOnly:!0})],He.prototype,"_collection",null),e([c()],He.prototype,"elevationOffset",null),e([c({readOnly:!0})],He.prototype,"visibleElevationRange",null),He=e([d("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],He);const De=He;class Pe{constructor(e,t,i,s,r,o,a,n,l,c){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=s,this.vboMemoryUsage=r,this.textureMemoryUsage=o,this.obb=a,this.stableNodeId=n,this.nodeDepth=l,this.elevationRange=c,this.bvhIntersectionGeneration=0,this.isLoaded=!1,this.isVisible=!1;const d=w();a?.getCenter(d),this._obbCenterX=d[0],this._obbCenterY=d[1],this._obbCenterZ=d[2];const h=a?.radius??-1;this._obbRadius=h,this._obbRadiusSquared=h*h;const u=a?.halfSize;this._obbShortestHalfsize=u?Math.min(u[0],u[1],u[2]):0,this._mbsCenter=a?T(a.center):C}get usedMemory(){return this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get mbsRadius(){return this._obbRadius}get mbsCenter(){return this._mbsCenter}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const{_obbCenterX:i,_obbCenterY:s,_obbCenterZ:r}=this,o=i-e[0],a=s-e[1],n=r-e[2],l=o*t[0]+a*t[1]+n*t[2];return o*o+a*a+n*n-l*l<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){const t=this._obbRadius;if(t<0)return!0;const i=e.center,s=e.radius,r=t+s,o=this._obbCenterX-i[0];if(o>r)return!1;const a=this._obbCenterY-i[1];if(a>r)return!1;const n=this._obbCenterZ-i[2];if(n>r)return!1;const l=o*o+a*a+n*n;if(l>r*r)return!1;if(l<=(this._obbShortestHalfsize+s)**2)return!0;const c=s-t;return c>0&&l<=c*c||(this.obb?.intersectSphere(e)??!0)}}function Ie(e){return Math.round(e/1048.576)/1e3}function ke(e){return new me(e.center,e.halfSize,f(...e.quaternion))}function Le(e){return`${e}`}const Ae=new Array;class Fe{constructor(e,t,i,s,r,o){this.materialPromise=e,this.baseColorTexture=t,this.metallicRoughnessTexture=i,this.emissionTexture=s,this.occlusionTexture=r,this.normalTexture=o}cleanup(){this.baseColorTexture?.dispose(),this.metallicRoughnessTexture?.dispose(),this.emissionTexture?.dispose(),this.occlusionTexture?.dispose(),this.normalTexture?.dispose()}}function Ge(e){return null!=e.data&&("string"==typeof e.desc&&(e.desc=JSON.parse(e.desc)),null!=e.desc)}export{De as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{hasScaling as e}from"../../../core/mathUtils.js";import{fromMat4 as r}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as t}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import o from"../../../geometry/SpatialReference.js";import{ensurePackedMat4f64 as n,ensurePackedArray as s}from"../../../geometry/support/DoubleArray.js";import i from"../../../geometry/support/MeshGeoreferencedVertexSpace.js";import a from"../../../geometry/support/MeshLocalVertexSpace.js";import{b as f,n as c}from"../../../chunks/vec3.js";import{get as l,cleanup as u}from"../../../libs/i3s/I3SModule.js";import{processNormals as m}from"./IntegratedMeshNormals.js";import{TransformedGeometry as p,TransformedData as y}from"./SceneLayerWorkerHandle.js";async function d(e){E=await M();const r=[e.geometryBuffer];return{result:U(E,e,r),transferList:r}}async function h(e){E=await M();const r=[e.geometryBuffer],{geometryBuffer:t}=e,o=t.byteLength,n=E._malloc(o),s=new Uint8Array(E.HEAPU8.buffer,n,o);s.set(new Uint8Array(t));const i=E.dracoDecompressPointCloudData(n,s.byteLength);if(E._free(n),i.error.length>0)throw new Error(`i3s.wasm: ${i.error}`);const a=i.featureIds?.length>0?i.featureIds.slice():null,f=i.positions.slice();return a&&r.push(a.buffer),r.push(f.buffer),{result:{positions:f,featureIds:a},transferList:r}}async function g(e){await M(),P(e);const r={buffer:e.buffer};return{result:r,transferList:[r.buffer]}}async function b(e){await M(),S(e)}async function w(e){E=await M(),E.setLegacySchema(e.context,e.jsonSchema)}async function j(e){const{localMatrix:r,origin:t,positions:f,vertexSpace:c}=e,l=o.fromJSON(e.inSpatialReference),u=o.fromJSON(e.outSpatialReference),m=r?n(r):void 0,p=s(t);let y;const[{projectBuffer:d},{initializeProjection:h}]=await Promise.all([import("../../../geometry/projection/projectBuffer.js"),import("../../../geometry/projectionUtils.js")]);await h(l,u);const g=[0,0,0];if(!d(p,l,0,g,u,0))throw new Error("Failed to project");if("georeferenced"===c.type&&null==c.origin){if(y=new Float64Array(f.length),!d(f,l,0,y,u,0,y.length/3))throw new Error("Failed to project")}else{const e="georeferenced"===c.type?i.fromJSON(c):a.fromJSON(c),{projectMeshVertexPositions:r}=await import("../../../geometry/support/meshUtils/projectMeshVertexPositions.js"),t=r({vertexAttributes:{position:f},transform:m?{localMatrix:m}:void 0,vertexSpace:e,spatialReference:l},u);if(!t)throw new Error("Failed to project");y=t}const b=y.length,[w,j,A]=g;for(let o=0;o<b;o+=3)y[o]-=w,y[o+1]-=j,y[o+2]-=A;return{result:{projected:y,original:f,projectedOrigin:g},transferList:[y.buffer,f.buffer]}}async function A({normalMatrix:r,normals:t}){const o=new Float32Array(t.length);return f(o,t,r),e(r)&&c(o,o),{result:{transformed:o,original:t},transferList:[o.buffer,t.buffer]}}function x(e){_(e)}let L,E;function S(e){if(!E)return;const r=e.modifications,t=E._malloc(8*r.length),o=new Float64Array(E.HEAPU8.buffer,t,r.length);for(let n=0;n<r.length;++n)o[n]=r[n];E.setModifications(e.context,t,r.length,e.isGeodetic),E._free(t)}function U(e,o,n){const{context:s,globalTrafo:i,mbs:a,obbData:f,layouts:c,needNormals:l,computeNormals:u,elevationOffset:d,geometryBuffer:h,geometryDescriptor:g,indexToVertexProjector:b,vertexToRenderProjector:w,normalReferenceFrame:j}=o,A=e._malloc(h.byteLength),x=33,L=e._malloc(x*Float64Array.BYTES_PER_ELEMENT),E=new Uint8Array(e.HEAPU8.buffer,A,h.byteLength);E.set(new Uint8Array(h));const S=new Float64Array(e.HEAPU8.buffer,L,x);v(S,[NaN,NaN,NaN],0);let U=3;v(S,i,U),U+=16,v(S,a.center,U),U+=3,S[U++]=a.radius,f&&v(S,f,U++);const N={isDraco:!1,isLegacy:!1,color:c.some(e=>e.some(e=>"color"===e.name)),normal:l&&c.some(e=>e.some(e=>"normalCompressed"===e.name)),uv0:c.some(e=>e.some(e=>"uv0"===e.name)),uvRegion:c.some(e=>e.some(e=>"uvRegion"===e.name)),featureIndex:g.featureIndex},P=e.process(s,!!f,A,E.byteLength,g,N,L,d,b,w,j);if(e._free(L),e._free(A),P.error.length>0)throw new Error(`i3s.wasm: ${P.error}`);if(P.discarded)return null;const _=P.componentOffsets.length>0?P.componentOffsets.slice():null,I=P.featureIds.length>0?P.featureIds.slice():null,M=P.anchorIds.length>0?Array.from(P.anchorIds):null,F=P.anchors.length>0?Array.from(P.anchors):null,O=1===P.indicesType?new Uint16Array(P.indices.buffer,P.indices.byteOffset,P.indices.byteLength/2).slice():new Uint32Array(P.indices.buffer,P.indices.byteOffset,P.indices.byteLength/4).slice(),B=c[0].slice(),R=r(t(),i),T=m(P.interleavedVertedData,O,B,u&&!N.normal,R),D=P.positions.slice(),{buffer:H,byteOffset:V,byteLength:J}=P.positionIndices,C=1===P.positionIndicesType?new Uint16Array(H,V,J/2).slice():new Uint32Array(H,V,J/4).slice(),k=new p(B,T.data,T.indices,P.hasColors,P.hasModifications,{data:D,indices:C});return I&&n.push(I.buffer),_&&n.push(_.buffer),n.push(T.data),n.push(T.indices.buffer),n.push(D.buffer),n.push(C.buffer),new y(_,I,M,F,k,i,P.obb)}function N(e){return 0===e?0:1===e?1:2===e?2:3}function P(e){if(!E)return;const{context:r,buffer:t}=e,o=E._malloc(t.byteLength),n=t.byteLength/Float64Array.BYTES_PER_ELEMENT,s=new Float64Array(E.HEAPU8.buffer,o,n),i=new Float64Array(t);s.set(i),E.filterOBBs(r,o,n),i.set(s),E._free(o)}function _(e){0===E?.destroy(e)&&(E=null,L=null,u())}function v(e,r,t){for(let o=0;o<r.length;++o)e[o+t]=r[o]}async function I(){E||await M()}async function M(){return E||(E=await(L??=l())),E}const F={transform:(e,r)=>E&&U(E,e,r),destroy:_};export{x as destroyContext,h as dracoDecompressPointCloudData,g as filterObbsForModifications,P as filterObbsForModificationsSync,I as initialize,N as interpretObbModificationResults,d as process,j as project,w as setLegacySchema,b as setModifications,S as setModificationsSync,F as test,A as transformNormals};
2
+ import{hasScaling as e}from"../../../core/mathUtils.js";import{fromMat4 as r}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as t}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import o from"../../../geometry/SpatialReference.js";import{ensurePackedMat4f64 as n,ensurePackedArray as s}from"../../../geometry/support/DoubleArray.js";import i from"../../../geometry/support/MeshGeoreferencedVertexSpace.js";import a from"../../../geometry/support/MeshLocalVertexSpace.js";import{t as f,n as c}from"../../../chunks/vec3.js";import{get as l,cleanup as u}from"../../../libs/i3s/I3SModule.js";import{processNormals as m}from"./IntegratedMeshNormals.js";import{TransformedGeometry as p,TransformedData as y}from"./SceneLayerWorkerHandle.js";async function d(e){E=await M();const r=[e.geometryBuffer];return{result:U(E,e,r),transferList:r}}async function h(e){E=await M();const r=[e.geometryBuffer],{geometryBuffer:t}=e,o=t.byteLength,n=E._malloc(o),s=new Uint8Array(E.HEAPU8.buffer,n,o);s.set(new Uint8Array(t));const i=E.dracoDecompressPointCloudData(n,s.byteLength);if(E._free(n),i.error.length>0)throw new Error(`i3s.wasm: ${i.error}`);const a=i.featureIds?.length>0?i.featureIds.slice():null,f=i.positions.slice();return a&&r.push(a.buffer),r.push(f.buffer),{result:{positions:f,featureIds:a},transferList:r}}async function g(e){await M(),P(e);const r={buffer:e.buffer};return{result:r,transferList:[r.buffer]}}async function b(e){await M(),S(e)}async function w(e){E=await M(),E.setLegacySchema(e.context,e.jsonSchema)}async function j(e){const{localMatrix:r,origin:t,positions:f,vertexSpace:c}=e,l=o.fromJSON(e.inSpatialReference),u=o.fromJSON(e.outSpatialReference),m=r?n(r):void 0,p=s(t);let y;const[{projectBuffer:d},{initializeProjection:h}]=await Promise.all([import("../../../geometry/projection/projectBuffer.js"),import("../../../geometry/projectionUtils.js")]);await h(l,u);const g=[0,0,0];if(!d(p,l,0,g,u,0))throw new Error("Failed to project");if("georeferenced"===c.type&&null==c.origin){if(y=new Float64Array(f.length),!d(f,l,0,y,u,0,y.length/3))throw new Error("Failed to project")}else{const e="georeferenced"===c.type?i.fromJSON(c):a.fromJSON(c),{projectMeshVertexPositions:r}=await import("../../../geometry/support/meshUtils/projectMeshVertexPositions.js"),t=r({vertexAttributes:{position:f},transform:m?{localMatrix:m}:void 0,vertexSpace:e,spatialReference:l},u);if(!t)throw new Error("Failed to project");y=t}const b=y.length,[w,j,A]=g;for(let o=0;o<b;o+=3)y[o]-=w,y[o+1]-=j,y[o+2]-=A;return{result:{projected:y,original:f,projectedOrigin:g},transferList:[y.buffer,f.buffer]}}async function A({normalMatrix:r,normals:t}){const o=new Float32Array(t.length);return f(o,t,r),e(r)&&c(o,o),{result:{transformed:o,original:t},transferList:[o.buffer,t.buffer]}}function x(e){_(e)}let L,E;function S(e){if(!E)return;const r=e.modifications,t=E._malloc(8*r.length),o=new Float64Array(E.HEAPU8.buffer,t,r.length);for(let n=0;n<r.length;++n)o[n]=r[n];E.setModifications(e.context,t,r.length,e.isGeodetic),E._free(t)}function U(e,o,n){const{context:s,globalTrafo:i,mbs:a,obbData:f,layouts:c,needNormals:l,computeNormals:u,elevationOffset:d,geometryBuffer:h,geometryDescriptor:g,indexToVertexProjector:b,vertexToRenderProjector:w,normalReferenceFrame:j}=o,A=e._malloc(h.byteLength),x=33,L=e._malloc(x*Float64Array.BYTES_PER_ELEMENT),E=new Uint8Array(e.HEAPU8.buffer,A,h.byteLength);E.set(new Uint8Array(h));const S=new Float64Array(e.HEAPU8.buffer,L,x);v(S,[NaN,NaN,NaN],0);let U=3;v(S,i,U),U+=16,v(S,a.center,U),U+=3,S[U++]=a.radius,f&&v(S,f,U++);const N={isDraco:!1,isLegacy:!1,color:c.some(e=>e.some(e=>"color"===e.name)),normal:l&&c.some(e=>e.some(e=>"normalCompressed"===e.name)),uv0:c.some(e=>e.some(e=>"uv0"===e.name)),uvRegion:c.some(e=>e.some(e=>"uvRegion"===e.name)),featureIndex:g.featureIndex},P=e.process(s,!!f,A,E.byteLength,g,N,L,d,b,w,j);if(e._free(L),e._free(A),P.error.length>0)throw new Error(`i3s.wasm: ${P.error}`);if(P.discarded)return null;const _=P.componentOffsets.length>0?P.componentOffsets.slice():null,I=P.featureIds.length>0?P.featureIds.slice():null,M=P.anchorIds.length>0?Array.from(P.anchorIds):null,F=P.anchors.length>0?Array.from(P.anchors):null,O=1===P.indicesType?new Uint16Array(P.indices.buffer,P.indices.byteOffset,P.indices.byteLength/2).slice():new Uint32Array(P.indices.buffer,P.indices.byteOffset,P.indices.byteLength/4).slice(),B=c[0].slice(),R=r(t(),i),T=m(P.interleavedVertedData,O,B,u&&!N.normal,R),D=P.positions.slice(),{buffer:H,byteOffset:V,byteLength:J}=P.positionIndices,C=1===P.positionIndicesType?new Uint16Array(H,V,J/2).slice():new Uint32Array(H,V,J/4).slice(),k=new p(B,T.data,T.indices,P.hasColors,P.hasModifications,{data:D,indices:C});return I&&n.push(I.buffer),_&&n.push(_.buffer),n.push(T.data),n.push(T.indices.buffer),n.push(D.buffer),n.push(C.buffer),new y(_,I,M,F,k,i,P.obb)}function N(e){return 0===e?0:1===e?1:2===e?2:3}function P(e){if(!E)return;const{context:r,buffer:t}=e,o=E._malloc(t.byteLength),n=t.byteLength/Float64Array.BYTES_PER_ELEMENT,s=new Float64Array(E.HEAPU8.buffer,o,n),i=new Float64Array(t);s.set(i),E.filterOBBs(r,o,n),i.set(s),E._free(o)}function _(e){0===E?.destroy(e)&&(E=null,L=null,u())}function v(e,r,t){for(let o=0;o<r.length;++o)e[o+t]=r[o]}async function I(){E||await M()}async function M(){return E||(E=await(L??=l())),E}const F={transform:(e,r)=>E&&U(E,e,r),destroy:_};export{x as destroyContext,h as dracoDecompressPointCloudData,g as filterObbsForModifications,P as filterObbsForModificationsSync,I as initialize,N as interpretObbModificationResults,d as process,j as project,w as setLegacySchema,b as setModifications,S as setModificationsSync,F as test,A as transformNormals};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as i}from"tslib";import t from"../../../../core/Accessor.js";import{lerp as e}from"../../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{property as r,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{transpose as c}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{transformMat4 as l,scale as u,round as h,copy as d,set as p}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as _,create as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as f,transformMat4 as g,scale as m}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{create as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as b}from"../../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as O}from"../../../../geometry/ellipsoidUtils.js";import{create as w,empty as Q,copy as D,offset as G,width as I,height as j,expand as k}from"../../../../geometry/support/aaBoundingRect.js";import{e as P,d as C,c as S}from"../../../../chunks/boundedPlane.js";import{create as T}from"../../../../geometry/support/ray.js";import{Sphere as x,sphereCSO as M}from"../../../../geometry/support/sphere.js";import{InternalRenderCategory as U}from"../../webgl.js";import{DeconflictAABR as V}from"./DeconflictAABR.js";import{prepare as R,drawPoly as A}from"./deconflictorDebug.js";import{isSymbolLayerWithTransparencyMode as E}from"./transparencyUtils.js";import N from"../../webgl/RenderCamera.js";import{GPUPointOcclusionQuery as q}from"../../webgl-engine/lib/GPUPointOcclusionQuery.js";import{SeparateScreenSizePerspectiveEvaluators as H}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{HUDMaterial as W}from"../../webgl-engine/materials/HUDMaterial.js";import{Yield as z}from"../../../support/Yield.js";const F=y(),B=y(),L=v(),Y=v(),J=y(),K=n(),X=new x,Z=T(),$=y(),ii=w();class ti{constructor(i){this.id=i,this.aabr=w(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.culled=!1,this.visible=!1,this.priority=0}}function ei(i,t){const e=0!==i.distanceToOccluder&&i.distance>i.distanceToOccluder,s=0!==t.distanceToOccluder&&t.distance>t.distanceToOccluder;return e!==s?+e-+s:i.priority!==t.priority?t.priority-i.priority:i.distance!==t.distance?i.distance-t.distance:i.visible!==t.visible?+t.visible-+i.visible:i.id-t.id}class si{constructor(i,t){this.graphics3DGraphic=i,this.slicePlaneEnabled=t,this._info=null,this._labelInfo=null}ensureInfo(i){let t=this.getInfo(i);return t||(t=new ti(this.graphics3DGraphic.graphic.uid),this._setInfo(i,t)),t}getInfo(i){return 16===i?this._labelInfo:this._info}removeInfo(i){this._setInfo(i,null)}_setInfo(i,t){16===i?this._labelInfo=t:this._info=t}}class ri{constructor(){this.camera=new N,this.slicePlane=C(),this.slicePlaneEnabled=!1}copyFrom(i){this.camera.equals(i.camera)||this.camera.copyFrom(i.camera),S(i.slicePlane,this.slicePlane),this.slicePlaneEnabled=i.slicePlaneEnabled}}let oi=class extends t{get dirty(){return this._dirty}get state(){return this._state}constructor(i){super(i),this._dirty=!1,this._viewState=new ri,this._state=0,this._checkOcclusion=new Map,this._active=new Map,this._checkOcclusionIterator=null,this._activeIterator=null,this._occlusionQueryUids=new Array,this._updatingHandles=new b,this._deconflictor=new V((i,t)=>{i.visible=t,this._setGraphicVisibility(this._active.get(i.id),t)},(i,t)=>i.id!==t.id,ei),this._baseOccludedVisibility=10,this._altitudeFactor=2,this._minAltitudeDifference=100}initialize(){this._updatingHandles.add(()=>(this.view?.map?.ground?.opacity??0)>0,()=>this.setDirty()),this._updatingHandles.add(()=>this.view.ready,()=>{this._occlusionQuery=null,this._opaqueOcclusionQuery=null,this.setDirty()})}destroy(){this._occlusionQuery=null,this._opaqueOcclusionQuery=null,this._updatingHandles.destroy(),this._deconflictor.destroy(),this._checkOcclusion.clear(),this._active.clear()}setDirty(){!this._dirty&&(this._active.size>0||this._checkOcclusion.size>0)&&(this._dirty=!0,this.notifyChange("_readyToRun"))}setPriority(i,t){const e=this._active.get(i.graphic.uid)?.getInfo(this.visibilityGroup);e&&(e.priority=t)}get _readyToRun(){return 0!==this._state||this._dirty}get updating(){return this._readyToRun||this._updatingHandles.updating}get updatingProgress(){if(!this.updating)return 1;const i=this._state/5;return this._dirty?.5*i:i}get readyToRun(){return this.view.ready&&null!=this.view.state&&this._readyToRun}get usedMemory(){return this._occlusionQuery?.usedMemory??0+4*(this._occlusionQueryUids?.length??0)}runTask(i){switch(this._state){case 0:this._startUpdate(),i.madeProgress();case 1:if(this._state=1,!this._processCheckOcclusion(i))return;case 2:if(this._state=2,!(this._occlusionQuery?.done??1)||!(this._opaqueOcclusionQuery?.done??1))return z;this._readOcclusionQueryResult(),i.madeProgress();case 3:if(this._state=3,!this._collectActiveGraphics(i))return;case 4:if(this._state=4,this._deconflictor.run(i),!this._deconflictor.done)return;default:this._state=0,this.notifyChange("_readyToRun")}}setGraphicsActive(i,t){t?i.forEach(i=>this.addToActiveGraphics(i)):i.forEach(i=>this.removeFromActiveGraphics(i))}isSupportedLayer(i){if(null==i||!("hiddenIfDeconflicted"in i)||!i.hiddenIfDeconflicted)return!1;const t=i.stageObject;if(1!==(t?.geometries.length??0))return!1;const e=t?.geometries[0],s=e?.material;return s instanceof W}_startUpdate(){R(this.view),this._dirty=!1,this._viewState.copyFrom(this.viewState);const{fullWidth:i,fullHeight:t}=this._viewState.camera;if(this._deconflictor.reset(i,t),this._resetIterators(),this._occlusionQueryUids.length=0,!this._checkOcclusion.size)return this._occlusionQuery=s(this._occlusionQuery),void(this._opaqueOcclusionQuery=s(this._opaqueOcclusionQuery))}addToActiveGraphics(i){i.ensureInfo(this.visibilityGroup),this._active.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromActiveGraphics(i){this._active.get(i.graphics3DGraphic.graphic.uid)===i&&(ci(i,this.visibilityGroup),i.removeInfo(this.visibilityGroup),this._active.delete(i.graphics3DGraphic.graphic.uid),this.setDirty())}addToCheckOcclusion(i){this._checkOcclusion.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromCheckOcclusion(i){this._checkOcclusion.get(i.graphics3DGraphic.graphic.uid)===i&&this._checkOcclusion.delete(i.graphics3DGraphic.graphic.uid)}_processCheckOcclusion(i){if(0===this._checkOcclusion.size)return!0;const t=this._ensureCheckOcclusionIterator(),e=this._viewState.camera,r=c(K,e.viewInverseTransposeMatrix),o=this.view.map.ground.opacity>0,n="global"===this.view.viewingMode&&o&&e.relativeElevation>0?X:null;let a=0;null!=n&&(l(n.center,_,e.viewMatrix),n.radius=O(this.view.spatialReference).radius,a=M.distanceToSilhouette(n,_));const u=w();for(;;){if(i.done)return!1;i.madeProgress();const s=t.next();if(!0===s.done)break;const o=s.value,c=o.graphics3DGraphic;if(c.destroyed)continue;if(!c.isVisible(1,8))continue;const h=ui(c,this.visibilityGroup);let d=null,p=!0,_=!1;for(const i of h){if(!this.isSupportedLayer(i))continue;d=hi,this._projectHudLayer(i,e,d),Q(u);const t=i.stageObject.geometries[0].material;if(this._expandBoundingRect(u,e,i,t,d),d.isOutsideScreen){p=!1;break}if(this._isCulledBySlice(o,d.positionWorld)){p=!1;break}if(null!=n&&li(d,n,a)){p=!1;break}d.altitude=this.view.renderCoordsHelper.getAltitude(d.positionWorld);const s=o.ensureInfo(this.visibilityGroup);if(s.altitude=d.altitude,s.distance=d.distance,s.distanceToOccluder=d.distanceToOccluder,s.culled=!1,D(s.aabr,u),!i.occlusionCheck)break;l(B,d.positionView,r);const h=this._ensureOcclusionQuery(),y=this._ensureOpaqueOcclusionQuery();0===this._occlusionQueryUids.length&&(this._initOcclusionQuery(h),this._initOcclusionQuery(y));const f=h.addPosition(B),g=y.addPosition(B);if(f===this._occlusionQueryUids.length&&g===f){const t=i.adaptiveOcclusion;this._occlusionQueryUids.push(t?-c.graphic.uid:c.graphic.uid),_=!0}break}const y=this._active.has(c.graphic.uid);if(y||_){if(y&&(!p||!d)){const i=o.ensureInfo(this.visibilityGroup);i.visible=!d,i.culled=!0}}else this._setGraphicVisibility(o,p)}return this._checkOcclusionIterator=null,this._occlusionQueryUids.length||(this._occlusionQuery=s(this._occlusionQuery),this._opaqueOcclusionQuery=s(this._opaqueOcclusionQuery)),this._occlusionQuery?.start(),this._opaqueOcclusionQuery?.start(),!0}_readOcclusionQueryResult(){if(!this._occlusionQuery||!this._occlusionQueryUids.length)return;const i=this._viewState.camera,t=this.view.renderCoordsHelper.getAltitude(i.eye);for(let e=0;e<this._occlusionQueryUids.length;e++){const i=this._occlusionQueryUids[e],s=Math.abs(i),r=i<0,o=this._checkOcclusion.get(s);if(!o)continue;const c=this._occlusionQuery.getOcclusion(e)??-1,n=this._opaqueOcclusionQuery?.getOcclusion(e)??-1,a=o.getInfo(this.visibilityGroup);a&&(a.distanceToOccluder=c>0?a.distance-c:0);const l=0===n||n>0&&this._occludedVisibility(a?a.distance-n:0,a?.distance??n,a?.altitude??0,t,r),u=0===c||c>0&&this._occludedVisibility(a?.distanceToOccluder??0,a?.distance??c,a?.altitude??0,t,r),h=l||u;h&&this._setTransparentMode(o,l&&!u),this._active.has(s)?a&&(a.culled=!h,a.visible=h):this._setGraphicVisibility(o,h)}this._occlusionQueryUids.length=0}_collectActiveGraphics(i){const t=this._ensureActiveGraphicsIterator(),e=16===this.visibilityGroup;for(;!i.done;){i.madeProgress();const s=t.next();if(!0===s.done)return this._activeIterator=null,!0;const r=s.value,o=r.getInfo(this.visibilityGroup);if(!o)continue;const c=!e||r.graphics3DGraphic.isVisible();!c||o.culled?(A(o.aabr,!1,!0),this._setGraphicVisibility(r,c&&o.visible)):this._deconflictor.add(o)}return!1}_occludedVisibility(i,t,e,s,r=!0){const o=Math.max(this._minAltitudeDifference,Math.abs(e-s))-this._minAltitudeDifference,c=r?this._baseOccludedVisibility+this._altitudeFactor*o:0;return 0===i||t-i<=c}_resetIterators(){this._checkOcclusionIterator=null,this._activeIterator=null}_ensureCheckOcclusionIterator(){return this._checkOcclusionIterator??=this._checkOcclusion.values(),this._checkOcclusionIterator}_ensureActiveGraphicsIterator(){return this._activeIterator??=this._active.values(),this._activeIterator}_initOcclusionQuery(i){if(!i)return;const{camera:t}=this._viewState,e=2,s=Math.max(e,e+Math.round(Math.log2(Math.abs(t.relativeElevation))));u(F,this._viewState.camera.eye,2**-s),u(F,h(F,F),2**s),i.init(this._checkOcclusion.size,F)}_ensureOcclusionQuery(){return this._occlusionQuery??=new q({view:this.view}),this._occlusionQuery}_ensureOpaqueOcclusionQuery(){return this._opaqueOcclusionQuery??=new q({view:this.view,category:U.OPAQUE_OCCLUSION_QUERY}),this._opaqueOcclusionQuery}_getNumVisible(i){return[...this._checkOcclusion.values()].reduce((t,e)=>t+(e.getInfo(i)?.visible?1:0),0)}_projectHudLayer(i,t,e){const s=i.stageObject,r=s.geometries[0],o=r.material;d(B,s.boundingVolumeWorldSpace.bounds.center),l(F,B,t.viewMatrix);const c=r.attributes,n=c.get("normal").data,a=c.get("centerOffset")?.data??_,[h]=c.get("groundDistance").data;o.applyShaderOffsets(B,F,n,s.transformation,a,h,t,e.screenSizePerspectiveEvaluators),f(L,F[0],F[1],F[2],1),g(Y,L,t.projectionMatrix),u(e.positionNDC,Y,1/Y[3]),o.applyShaderOffsetsNDC(e.positionNDC,a,h,t,e.positionNDC,J),e.distanceWithoutPolygonOffset=t.depthNDCToWorld(J[2]),e.distance=J[2]===e.positionNDC[2]?e.distanceWithoutPolygonOffset:t.depthNDCToWorld(e.positionNDC[2]),f(Y,e.positionNDC[0],e.positionNDC[1],e.positionNDC[2],1),g(L,Y,t.inverseProjectionMatrix),m(L,L,1/L[3]),p(e.positionView,L[0],L[1],L[2]),d(e.positionWorld,B)}_isCulledBySlice(i,t){return i.slicePlaneEnabled&&this._viewState.slicePlaneEnabled&&P(this._viewState.slicePlane,t)}_expandBoundingRect(i,t,s,r,{positionNDC:o,screenSizePerspectiveEvaluators:c}){const n=s.getScreenSize(ni);c.evaluator.applyVec2(n,n),n[0]*=t.pixelRatio,n[1]*=t.pixelRatio;const a=G(r.calculateRelativeScreenBounds(n,c.alignmentEvaluator.apply(t.pixelRatio),ii),e(0,t.fullWidth,.5+.5*o[0]),e(0,t.fullHeight,.5+.5*o[1])),l=this.marginFactor;if(0!==l){const i=l*Math.min(I(a),j(a));a[0]-=i,a[1]-=i,a[2]+=i,a[3]+=i}k(i,a,i)}_setGraphicVisibility(i,t){const e=i?.graphics3DGraphic;e&&!e.destroyed&&(e.setVisibilityFlag(this.visibilityGroup,8,t),16===this.visibilityGroup&&this.view.labeler.setLabelGraphicVisibility(e,t))}_setTransparentMode(i,t){const e=i?.graphics3DGraphic;if(e&&!e.destroyed)for(const s of e.layers){if("object3d"!==s?.type)continue;const{graphics3DSymbolLayer:i}=s;E(i)&&i.updateTransparentMode(s,t)}}};function ci(i,t){const e=i.graphics3DGraphic;e.destroyed||e.setVisibilityFlag(t,8,!0)}i([r({constructOnly:!0})],oi.prototype,"view",void 0),i([r({type:Boolean,readOnly:!0})],oi.prototype,"_readyToRun",null),i([r({type:Boolean,readOnly:!0})],oi.prototype,"updating",null),i([r({readOnly:!0})],oi.prototype,"_updatingHandles",void 0),oi=i([o("esri.views.3d.layers.graphics.Deconflictor")],oi);const ni=a();class ai{constructor(){this.positionWorld=y(),this.positionView=y(),this.positionNDC=y(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.distanceWithoutPolygonOffset=0,this.screenSizePerspectiveEvaluators=new H}get isOutsideScreen(){const i=this.positionNDC;return i[0]<-1||i[1]<-1||i[2]<-1||i[0]>=1||i[1]>=1||i[2]>=1}}function li(i,t,e){return d(Z.direction,i.positionView),p(Z.origin,0,0,0),!!t.intersectRay(Z,$)&&i.distanceWithoutPolygonOffset>e}function ui(i,t){return 16===t?i.labelLayers:i.layers}const hi=new ai;export{oi as Deconflictor,si as DeconflictorGraphic,ri as DeconflictorViewState};
2
+ import{__decorate as i}from"tslib";import t from"../../../../core/Accessor.js";import{lerp as e}from"../../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{property as r,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{transpose as c}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{transformMat4 as l,scale as u,round as h,copy as d,set as p}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as _,create as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as f,transformMat4 as g,scale as m}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{create as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as b}from"../../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as O}from"../../../../geometry/ellipsoidUtils.js";import{create as w,empty as Q,copy as D,offset as G,width as I,height as j,expand as k}from"../../../../geometry/support/aaBoundingRect.js";import{o as P,i as C,g as S}from"../../../../chunks/boundedPlane.js";import{create as T}from"../../../../geometry/support/ray.js";import{Sphere as x,sphereCSO as M}from"../../../../geometry/support/sphere.js";import{InternalRenderCategory as U}from"../../webgl.js";import{DeconflictAABR as V}from"./DeconflictAABR.js";import{prepare as R,drawPoly as A}from"./deconflictorDebug.js";import{isSymbolLayerWithTransparencyMode as E}from"./transparencyUtils.js";import N from"../../webgl/RenderCamera.js";import{GPUPointOcclusionQuery as q}from"../../webgl-engine/lib/GPUPointOcclusionQuery.js";import{SeparateScreenSizePerspectiveEvaluators as H}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{HUDMaterial as W}from"../../webgl-engine/materials/HUDMaterial.js";import{Yield as z}from"../../../support/Yield.js";const F=y(),B=y(),L=v(),Y=v(),J=y(),K=n(),X=new x,Z=T(),$=y(),ii=w();class ti{constructor(i){this.id=i,this.aabr=w(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.culled=!1,this.visible=!1,this.priority=0}}function ei(i,t){const e=0!==i.distanceToOccluder&&i.distance>i.distanceToOccluder,s=0!==t.distanceToOccluder&&t.distance>t.distanceToOccluder;return e!==s?+e-+s:i.priority!==t.priority?t.priority-i.priority:i.distance!==t.distance?i.distance-t.distance:i.visible!==t.visible?+t.visible-+i.visible:i.id-t.id}class si{constructor(i,t){this.graphics3DGraphic=i,this.slicePlaneEnabled=t,this._info=null,this._labelInfo=null}ensureInfo(i){let t=this.getInfo(i);return t||(t=new ti(this.graphics3DGraphic.graphic.uid),this._setInfo(i,t)),t}getInfo(i){return 16===i?this._labelInfo:this._info}removeInfo(i){this._setInfo(i,null)}_setInfo(i,t){16===i?this._labelInfo=t:this._info=t}}class ri{constructor(){this.camera=new N,this.slicePlane=C(),this.slicePlaneEnabled=!1}copyFrom(i){this.camera.equals(i.camera)||this.camera.copyFrom(i.camera),S(i.slicePlane,this.slicePlane),this.slicePlaneEnabled=i.slicePlaneEnabled}}let oi=class extends t{get dirty(){return this._dirty}get state(){return this._state}constructor(i){super(i),this._dirty=!1,this._viewState=new ri,this._state=0,this._checkOcclusion=new Map,this._active=new Map,this._checkOcclusionIterator=null,this._activeIterator=null,this._occlusionQueryUids=new Array,this._updatingHandles=new b,this._deconflictor=new V((i,t)=>{i.visible=t,this._setGraphicVisibility(this._active.get(i.id),t)},(i,t)=>i.id!==t.id,ei),this._baseOccludedVisibility=10,this._altitudeFactor=2,this._minAltitudeDifference=100}initialize(){this._updatingHandles.add(()=>(this.view?.map?.ground?.opacity??0)>0,()=>this.setDirty()),this._updatingHandles.add(()=>this.view.ready,()=>{this._occlusionQuery=null,this._opaqueOcclusionQuery=null,this.setDirty()})}destroy(){this._occlusionQuery=null,this._opaqueOcclusionQuery=null,this._updatingHandles.destroy(),this._deconflictor.destroy(),this._checkOcclusion.clear(),this._active.clear()}setDirty(){!this._dirty&&(this._active.size>0||this._checkOcclusion.size>0)&&(this._dirty=!0,this.notifyChange("_readyToRun"))}setPriority(i,t){const e=this._active.get(i.graphic.uid)?.getInfo(this.visibilityGroup);e&&(e.priority=t)}get _readyToRun(){return 0!==this._state||this._dirty}get updating(){return this._readyToRun||this._updatingHandles.updating}get updatingProgress(){if(!this.updating)return 1;const i=this._state/5;return this._dirty?.5*i:i}get readyToRun(){return this.view.ready&&null!=this.view.state&&this._readyToRun}get usedMemory(){return this._occlusionQuery?.usedMemory??0+4*(this._occlusionQueryUids?.length??0)}runTask(i){switch(this._state){case 0:this._startUpdate(),i.madeProgress();case 1:if(this._state=1,!this._processCheckOcclusion(i))return;case 2:if(this._state=2,!(this._occlusionQuery?.done??1)||!(this._opaqueOcclusionQuery?.done??1))return z;this._readOcclusionQueryResult(),i.madeProgress();case 3:if(this._state=3,!this._collectActiveGraphics(i))return;case 4:if(this._state=4,this._deconflictor.run(i),!this._deconflictor.done)return;default:this._state=0,this.notifyChange("_readyToRun")}}setGraphicsActive(i,t){t?i.forEach(i=>this.addToActiveGraphics(i)):i.forEach(i=>this.removeFromActiveGraphics(i))}isSupportedLayer(i){if(null==i||!("hiddenIfDeconflicted"in i)||!i.hiddenIfDeconflicted)return!1;const t=i.stageObject;if(1!==(t?.geometries.length??0))return!1;const e=t?.geometries[0],s=e?.material;return s instanceof W}_startUpdate(){R(this.view),this._dirty=!1,this._viewState.copyFrom(this.viewState);const{fullWidth:i,fullHeight:t}=this._viewState.camera;if(this._deconflictor.reset(i,t),this._resetIterators(),this._occlusionQueryUids.length=0,!this._checkOcclusion.size)return this._occlusionQuery=s(this._occlusionQuery),void(this._opaqueOcclusionQuery=s(this._opaqueOcclusionQuery))}addToActiveGraphics(i){i.ensureInfo(this.visibilityGroup),this._active.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromActiveGraphics(i){this._active.get(i.graphics3DGraphic.graphic.uid)===i&&(ci(i,this.visibilityGroup),i.removeInfo(this.visibilityGroup),this._active.delete(i.graphics3DGraphic.graphic.uid),this.setDirty())}addToCheckOcclusion(i){this._checkOcclusion.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromCheckOcclusion(i){this._checkOcclusion.get(i.graphics3DGraphic.graphic.uid)===i&&this._checkOcclusion.delete(i.graphics3DGraphic.graphic.uid)}_processCheckOcclusion(i){if(0===this._checkOcclusion.size)return!0;const t=this._ensureCheckOcclusionIterator(),e=this._viewState.camera,r=c(K,e.viewInverseTransposeMatrix),o=this.view.map.ground.opacity>0,n="global"===this.view.viewingMode&&o&&e.relativeElevation>0?X:null;let a=0;null!=n&&(l(n.center,_,e.viewMatrix),n.radius=O(this.view.spatialReference).radius,a=M.distanceToSilhouette(n,_));const u=w();for(;;){if(i.done)return!1;i.madeProgress();const s=t.next();if(!0===s.done)break;const o=s.value,c=o.graphics3DGraphic;if(c.destroyed)continue;if(!c.isVisible(1,8))continue;const h=ui(c,this.visibilityGroup);let d=null,p=!0,_=!1;for(const i of h){if(!this.isSupportedLayer(i))continue;d=hi,this._projectHudLayer(i,e,d),Q(u);const t=i.stageObject.geometries[0].material;if(this._expandBoundingRect(u,e,i,t,d),d.isOutsideScreen){p=!1;break}if(this._isCulledBySlice(o,d.positionWorld)){p=!1;break}if(null!=n&&li(d,n,a)){p=!1;break}d.altitude=this.view.renderCoordsHelper.getAltitude(d.positionWorld);const s=o.ensureInfo(this.visibilityGroup);if(s.altitude=d.altitude,s.distance=d.distance,s.distanceToOccluder=d.distanceToOccluder,s.culled=!1,D(s.aabr,u),!i.occlusionCheck)break;l(B,d.positionView,r);const h=this._ensureOcclusionQuery(),y=this._ensureOpaqueOcclusionQuery();0===this._occlusionQueryUids.length&&(this._initOcclusionQuery(h),this._initOcclusionQuery(y));const f=h.addPosition(B),g=y.addPosition(B);if(f===this._occlusionQueryUids.length&&g===f){const t=i.adaptiveOcclusion;this._occlusionQueryUids.push(t?-c.graphic.uid:c.graphic.uid),_=!0}break}const y=this._active.has(c.graphic.uid);if(y||_){if(y&&(!p||!d)){const i=o.ensureInfo(this.visibilityGroup);i.visible=!d,i.culled=!0}}else this._setGraphicVisibility(o,p)}return this._checkOcclusionIterator=null,this._occlusionQueryUids.length||(this._occlusionQuery=s(this._occlusionQuery),this._opaqueOcclusionQuery=s(this._opaqueOcclusionQuery)),this._occlusionQuery?.start(),this._opaqueOcclusionQuery?.start(),!0}_readOcclusionQueryResult(){if(!this._occlusionQuery||!this._occlusionQueryUids.length)return;const i=this._viewState.camera,t=this.view.renderCoordsHelper.getAltitude(i.eye);for(let e=0;e<this._occlusionQueryUids.length;e++){const i=this._occlusionQueryUids[e],s=Math.abs(i),r=i<0,o=this._checkOcclusion.get(s);if(!o)continue;const c=this._occlusionQuery.getOcclusion(e)??-1,n=this._opaqueOcclusionQuery?.getOcclusion(e)??-1,a=o.getInfo(this.visibilityGroup);a&&(a.distanceToOccluder=c>0?a.distance-c:0);const l=0===n||n>0&&this._occludedVisibility(a?a.distance-n:0,a?.distance??n,a?.altitude??0,t,r),u=0===c||c>0&&this._occludedVisibility(a?.distanceToOccluder??0,a?.distance??c,a?.altitude??0,t,r),h=l||u;h&&this._setTransparentMode(o,l&&!u),this._active.has(s)?a&&(a.culled=!h,a.visible=h):this._setGraphicVisibility(o,h)}this._occlusionQueryUids.length=0}_collectActiveGraphics(i){const t=this._ensureActiveGraphicsIterator(),e=16===this.visibilityGroup;for(;!i.done;){i.madeProgress();const s=t.next();if(!0===s.done)return this._activeIterator=null,!0;const r=s.value,o=r.getInfo(this.visibilityGroup);if(!o)continue;const c=!e||r.graphics3DGraphic.isVisible();!c||o.culled?(A(o.aabr,!1,!0),this._setGraphicVisibility(r,c&&o.visible)):this._deconflictor.add(o)}return!1}_occludedVisibility(i,t,e,s,r=!0){const o=Math.max(this._minAltitudeDifference,Math.abs(e-s))-this._minAltitudeDifference,c=r?this._baseOccludedVisibility+this._altitudeFactor*o:0;return 0===i||t-i<=c}_resetIterators(){this._checkOcclusionIterator=null,this._activeIterator=null}_ensureCheckOcclusionIterator(){return this._checkOcclusionIterator??=this._checkOcclusion.values(),this._checkOcclusionIterator}_ensureActiveGraphicsIterator(){return this._activeIterator??=this._active.values(),this._activeIterator}_initOcclusionQuery(i){if(!i)return;const{camera:t}=this._viewState,e=2,s=Math.max(e,e+Math.round(Math.log2(Math.abs(t.relativeElevation))));u(F,this._viewState.camera.eye,2**-s),u(F,h(F,F),2**s),i.init(this._checkOcclusion.size,F)}_ensureOcclusionQuery(){return this._occlusionQuery??=new q({view:this.view}),this._occlusionQuery}_ensureOpaqueOcclusionQuery(){return this._opaqueOcclusionQuery??=new q({view:this.view,category:U.OPAQUE_OCCLUSION_QUERY}),this._opaqueOcclusionQuery}_getNumVisible(i){return[...this._checkOcclusion.values()].reduce((t,e)=>t+(e.getInfo(i)?.visible?1:0),0)}_projectHudLayer(i,t,e){const s=i.stageObject,r=s.geometries[0],o=r.material;d(B,s.boundingVolumeWorldSpace.bounds.center),l(F,B,t.viewMatrix);const c=r.attributes,n=c.get("normal").data,a=c.get("centerOffset")?.data??_,[h]=c.get("groundDistance").data;o.applyShaderOffsets(B,F,n,s.transformation,a,h,t,e.screenSizePerspectiveEvaluators),f(L,F[0],F[1],F[2],1),g(Y,L,t.projectionMatrix),u(e.positionNDC,Y,1/Y[3]),o.applyShaderOffsetsNDC(e.positionNDC,a,h,t,e.positionNDC,J),e.distanceWithoutPolygonOffset=t.depthNDCToWorld(J[2]),e.distance=J[2]===e.positionNDC[2]?e.distanceWithoutPolygonOffset:t.depthNDCToWorld(e.positionNDC[2]),f(Y,e.positionNDC[0],e.positionNDC[1],e.positionNDC[2],1),g(L,Y,t.inverseProjectionMatrix),m(L,L,1/L[3]),p(e.positionView,L[0],L[1],L[2]),d(e.positionWorld,B)}_isCulledBySlice(i,t){return i.slicePlaneEnabled&&this._viewState.slicePlaneEnabled&&P(this._viewState.slicePlane,t)}_expandBoundingRect(i,t,s,r,{positionNDC:o,screenSizePerspectiveEvaluators:c}){const n=s.getScreenSize(ni);c.evaluator.applyVec2(n,n),n[0]*=t.pixelRatio,n[1]*=t.pixelRatio;const a=G(r.calculateRelativeScreenBounds(n,c.alignmentEvaluator.apply(t.pixelRatio),ii),e(0,t.fullWidth,.5+.5*o[0]),e(0,t.fullHeight,.5+.5*o[1])),l=this.marginFactor;if(0!==l){const i=l*Math.min(I(a),j(a));a[0]-=i,a[1]-=i,a[2]+=i,a[3]+=i}k(i,a,i)}_setGraphicVisibility(i,t){const e=i?.graphics3DGraphic;e&&!e.destroyed&&(e.setVisibilityFlag(this.visibilityGroup,8,t),16===this.visibilityGroup&&this.view.labeler.setLabelGraphicVisibility(e,t))}_setTransparentMode(i,t){const e=i?.graphics3DGraphic;if(e&&!e.destroyed)for(const s of e.layers){if("object3d"!==s?.type)continue;const{graphics3DSymbolLayer:i}=s;E(i)&&i.updateTransparentMode(s,t)}}};function ci(i,t){const e=i.graphics3DGraphic;e.destroyed||e.setVisibilityFlag(t,8,!0)}i([r({constructOnly:!0})],oi.prototype,"view",void 0),i([r({type:Boolean,readOnly:!0})],oi.prototype,"_readyToRun",null),i([r({type:Boolean,readOnly:!0})],oi.prototype,"updating",null),i([r({readOnly:!0})],oi.prototype,"_updatingHandles",void 0),oi=i([o("esri.views.3d.layers.graphics.Deconflictor")],oi);const ni=a();class ai{constructor(){this.positionWorld=y(),this.positionView=y(),this.positionNDC=y(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.distanceWithoutPolygonOffset=0,this.screenSizePerspectiveEvaluators=new H}get isOutsideScreen(){const i=this.positionNDC;return i[0]<-1||i[1]<-1||i[2]<-1||i[0]>=1||i[1]>=1||i[2]>=1}}function li(i,t,e){return d(Z.direction,i.positionView),p(Z.origin,0,0,0),!!t.intersectRay(Z,$)&&i.distanceWithoutPolygonOffset>e}function ui(i,t){return 16===t?i.labelLayers:i.layers}const hi=new ai;export{oi as Deconflictor,si as DeconflictorGraphic,ri as DeconflictorViewState};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{clone as e}from"../../../../core/lang.js";import{getMetersPerVerticalUnitForSR as t}from"../../../../core/units.js";import{normalFromMat4 as r}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as s,invertOrIdentity as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as a,sub as l,cross as c,add as m,normalize as p,transformMat4 as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ONES as d,create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as g,ZEROS as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{computeTranslationToOriginAndRotation as f}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as b,fromBuffer as _,intersectsClippingArea as x}from"../../../../geometry/support/aaBoundingBox.js";import{getZeroIndexArray as v}from"../../../../geometry/support/Indices.js";import{t as w}from"../../../../chunks/vec3.js";import{SnappingCandidateVertex as C,SnappingCandidateEdge as S}from"../../../../layers/graphics/data/SnappingCandidate.js";import{getDriverAxisSizeValue as j}from"../../../../renderers/support/renderingInfoUtils.js";import{needsElevationUpdates3D as P,SampleElevationInfo as E}from"./elevationAlignmentUtils.js";import{extrudePolygon as I}from"./extrudeUtils.js";import{Object3DEdgeState as A,Graphics3DObject3DGraphicLayer as U}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as z}from"./Graphics3DSymbolLayer.js";import{computeCentroid as O}from"./graphicUtils.js";import{geometryAsPolygon as D}from"./polygonUtils.js";import{createMaterial as M}from"../support/edgeUtils.js";import{encodeNaNUInt8 as L}from"../support/symbolColorUtils.js";import{debugFlags as G}from"../../support/debugFlags.js";import{SamplePosition as V}from"../../support/ElevationProvider.js";import{loadTessellationUtils as B,preloadedPolygonToRenderInfoElevationAligned as R}from"../../support/renderInfoUtils/polygon.js";import{Attribute as F}from"../../webgl-engine/lib/Attribute.js";import{Geometry as T}from"../../webgl-engine/lib/Geometry.js";import{isGeometryWithMapPositions as N}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{compressNormals as H,compressNormal as q}from"../../webgl-engine/lib/Normals.js";import{Object3D as W}from"../../webgl-engine/lib/Object3D.js";import{DefaultMaterial as k}from"../../webgl-engine/materials/DefaultMaterial.js";const Z=["polygon","extent"];class J extends z{constructor(e,t,r,i){super(e,t,r,i,ee(t)),this.ensureDrapedStatus(!1)}async doLoad(){const e=this.symbolLayer,t=e?.material,r=this.symbolLayer.material?.color?.a,i=this._hasDrivenColorOrOpacity,s=this.needsDrivenTransparentPass||i&&null!=r&&r<1,o=t?.emissive,n=("color"===o?.source?o?.strength:void 0)??0,a=!i&&(null==r||0===r),l=i?g:this._materialColor?.toUnitRGBA()??y,c={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,useIndexing:!0,ambient:d,diffuse:d,externalColor:l,opacity:a?0:1,layerOpacity:this._getLayerOpacity(),drivenOpacity:s,hasSymbolColors:i,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:e.castShadows,emissiveStrengthFromSymbol:n,emissiveSource:1,offsetTransparentBackfaces:!0,normalType:1},m=new k(c,this._context),p=new k({...c,cullFace:2},this._context);this._materials[0]=m,this._materials[1]=p,this._updateTransparentDepedentMaterialParameters(),await B()}destroy(){super.destroy(),this._materials.length=0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,Z,this.symbolLayer.type))return null;const r=this._getDrivenUInt8ColorWithNaNSupport(e.renderingInfo,this._materialColor,!1);L(r,r);const i=this.createElevationContextForGraphic(t);return this._createAs3DShape(t,e.renderingInfo,r,i,t.uid)}layerOpacityChanged(e,t){const r=this._getLayerOpacity();this._materials[0]?.setParameters({layerOpacity:r}),this._materials[1]?.setParameters({layerOpacity:r}),this._updateTransparentDepedentMaterialParameters(),e?.forEach(e=>t(e)?.layerOpacityChanged(r,this._context.isAsync))}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,P)}slicePlaneEnabledChanged(e,t){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),e?.forEach(e=>{const r=t(e);null!=r&&r.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)}),!0}physicalBasedRenderingChanged(){const e={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0};return this._materials[0]?.setParameters(e),this._materials[1]?.setParameters(e),!0}_getExtrusionSize(e){let t;return t=e.size&&this._drivenProperties.size?j(e.size.output,2)??0:this._getSymbolSize(),t/=this._context.renderCoordsHelper.unitInMeters,t}applyRendererDiff(e,t){return this._drivenPropertiesChanged(t)?0:1}async queryForSnapping(r,i,s,o){const n=this._getExtrusionSize(s)*this._context.renderCoordsHelper.unitInMeters/t(i),{objectId:a,target:l}=r,c=e(l);switch(c.z=(c.z??0)+n,r.type){case"edge":{const{start:t,end:i}=r,s=e(t),o=e(i);return s.z=(s.z??0)+n,o.z=(o.z??0)+n,[new S(a,c,1/0,s,o)]}case"vertex":return[new C(a,c,1/0),new S(a,l,1/0,l,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(e,t,o,a,l){const c=D(e.geometry);if(null==c)return null;if(0===c.rings.length||!c.rings.some(e=>e.length>0))return this._logGeometryValidationWarnings(c.rings,"rings","ExtrudeSymbol3DLayer"),null;const m=R(c,this._context.elevationProvider,this._context.renderCoordsHelper,a,{outlineOutput:"tessellated-indices"});if(null==m)return;this._logGeometryCreationWarnings(m,c.rings,"rings","ExtrudeSymbol3DLayer");const p=O(c);if(null==p)return null;const h=new Array,d=new Array,g=b(),y=n(),v=u(),C=1===this._context.renderCoordsHelper.viewingMode;C||this._context.renderCoordsHelper.worldUpAtPosition(null,v),f(c.spatialReference,[p.x,p.y,0],y,this._context.renderCoordsHelper.spatialReference);const S=n();s(S,y);const j=i();r(j,S);const E=new Map,z=this._materials[0];if(this._context.clippingExtent&&(_(m.mapPositions,g),!x(g,this._context.clippingExtent)))return;if(0===m.polygonIndexCount)return;const L=this._getExtrusionSize(t),G=I(m,{height:L,worldUp:v,spherical:C,requireElevation:!0,requireNormals:!0,requireSizes:!0});if(null==G)return;w(G.vertices,G.vertices,S);const V=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:l,layerViewUid:this._context.layerViewUid}),B=new le(G.vertices,G.elevation,H(G.normals),G.sizes),F=K(z,G.indices,G.indices.length-G.bottomIndices.length,B,o,V),T=m.vertexCount,N=T,q=T,k=2*m.outlineSegmentCount,Z=m.polygonIndexCount/3,J=new ce(N,q,k,Z);if($(F,J,y),E.set(F,J),h.push(F,K(this._materials[1],G.bottomIndices,0,B,o,V)),d.push(B.heights),0===h.length)return null;const Q=new W({geometries:h,layerViewUid:this._context.layerViewUid,graphicUid:l,isElevationSource:!0});Q.transformation=y;const X=M(this.symbolLayer,{opacity:this._getLayerOpacity()}),ee=X?new A(this._materials[0],X,this._context.slicePlaneEnabled):null,te=new U(this,Q,null,(e,t,r,i,s)=>Y(e,t,r,i,s,d,E),a,ee);return te.alignedSampledElevation=m.sampledElevation,te.needsElevationUpdates=P(a.mode),te}get _materialColor(){return this.symbolLayer.material?.color}_updateTransparentDepedentMaterialParameters(){const e=this._materials[0];e&&e.setParameters({cullFace:e.transparent?0:2})}}function K(e,t,r,i,s,o){const{attributeIndices:n,drawIndices:a}=Q(t),l=[["position",new F(i.positions,n,3,!0)],["normalCompressed",new F(i.normals,n,2,!0)]];if(e.parameters.hasSymbolColors){const e=v(n.length);l.push(["symbolColor",new F(s,e,4,!0)])}return new T(e,l,i.elevation,0,o,r,null,a)}function Q(e){const t=new Array,r=new Map,i=new Array;for(let s=0;s<e.length;++s){const o=e[s];let n=r.get(o);null==n&&(n=t.length,t.push(o),r.set(o,n)),i.push(n)}return{attributeIndices:t,drawIndices:i}}const X=u();function Y(e,t,r,i,s,l,c){const m=e.stageObject,p=m.geometries,d=p.length,u="absolute-height"!==t.mode;let g=0;const y=m.transformation,f=o(n(),y);for(let o=0;o<d;o+=2){const e=p[o];if(!N(e))continue;const t=e.getMutableAttribute("position").data,n=l[o/2],d=new V(e.mapPositions),b=t.length/3;let _=!1,x=0;{let e=0;for(let o=0;o<b;o++){X[0]=t[e],X[1]=t[e+1],X[2]=t[e+2],i(d,ie),u&&(x+=ie.sampledElevation),G.ENABLE_OPTIMIZATIONS?(a(te,t[e],t[e+1],t[e+2]),h(te,te,y),s.setAltitude(te,ie.z+n[e/3]),h(te,te,f)):(a(te,d.array[d.offset],d.array[d.offset+1],ie.z+n[e/3]),null!=r&&s.toRenderCoords(te,r,te),h(te,te,f)),t[e]=te[0],t[e+1]=te[1],t[e+2]=te[2];const o=se/s.unitInMeters;(Math.abs(X[0]-t[e])>=o||Math.abs(X[1]-t[e+1])>=o||Math.abs(X[2]-t[e+2])>=o)&&(_=!0),d.offset+=3,e+=3}}if(_){const t=c.get(e);t&&$(e,t,y),m.geometryVertexAttributeUpdated(p[o],"normalCompressed"),e.invalidateBoundingInfo(),m.geometryVertexAttributeUpdated(p[o],"position"),p[o+1].invalidateBoundingInfo(),m.geometryVertexAttributeUpdated(p[o+1],"position")}g+=x/b}return g/d}function $(e,t,r){const i=e.getMutableAttribute("position"),s=e.getMutableAttribute("normalCompressed").data,o=i.data,n=e.primitivePositionIndices,{topVertexStart:d,topVertexCount:u,topFaceStart:g,topFaceCount:y}=t,f=g+y,b=d+u,_=oe,x=ne,v=ae,w=re,C=te;a(C,0,0,0);const S=(e,t)=>{const i=3*e;a(t,o[i+0],o[i+1],o[i+2]),h(t,t,r)};for(let a=g;a<f;++a){const e=3*a;S(n[e+0],_[0]),S(n[e+1],_[1]),S(n[e+2],_[2]),l(x,_[1],_[0]),l(v,_[2],_[0]),c(w,x,v),m(C,C,w)}p(C,C);for(let a=d;a<b;++a){const e=C[0],t=C[1],r=C[2];q(s,a,e,t,r)}}function ee(e){return 1===(e.material?.color?.a??0)}const te=u(),re=u(),ie=new E,se=.01,oe=[u(),u(),u()],ne=u(),ae=u();class le{constructor(e,t,r,i){this.positions=e,this.elevation=t,this.normals=r,this.heights=i}}class ce{constructor(e,t,r,i){this.topVertexStart=e,this.topVertexCount=t,this.topFaceStart=r,this.topFaceCount=i}}export{J as Graphics3DExtrudeSymbolLayer};
2
+ import{clone as e}from"../../../../core/lang.js";import{getMetersPerVerticalUnitForSR as t}from"../../../../core/units.js";import{normalFromMat4 as r}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as s,invertOrIdentity as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as a,sub as l,cross as c,add as m,normalize as p,transformMat4 as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ONES as d,create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as g,ZEROS as f}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{computeTranslationToOriginAndRotation as y}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as b,fromBuffer as _,intersectsClippingArea as x}from"../../../../geometry/support/aaBoundingBox.js";import{getZeroIndexArray as v}from"../../../../geometry/support/Indices.js";import{f as w}from"../../../../chunks/vec3.js";import{SnappingCandidateVertex as C,SnappingCandidateEdge as S}from"../../../../layers/graphics/data/SnappingCandidate.js";import{getDriverAxisSizeValue as j}from"../../../../renderers/support/renderingInfoUtils.js";import{needsElevationUpdates3D as P,SampleElevationInfo as E}from"./elevationAlignmentUtils.js";import{extrudePolygon as I}from"./extrudeUtils.js";import{Object3DEdgeState as A,Graphics3DObject3DGraphicLayer as U}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as z}from"./Graphics3DSymbolLayer.js";import{computeCentroid as O}from"./graphicUtils.js";import{geometryAsPolygon as D}from"./polygonUtils.js";import{createMaterial as M}from"../support/edgeUtils.js";import{encodeNaNUInt8 as L}from"../support/symbolColorUtils.js";import{debugFlags as G}from"../../support/debugFlags.js";import{SamplePosition as V}from"../../support/ElevationProvider.js";import{loadTessellationUtils as B,preloadedPolygonToRenderInfoElevationAligned as R}from"../../support/renderInfoUtils/polygon.js";import{Attribute as F}from"../../webgl-engine/lib/Attribute.js";import{Geometry as T}from"../../webgl-engine/lib/Geometry.js";import{isGeometryWithMapPositions as N}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{compressNormals as H,compressNormal as q}from"../../webgl-engine/lib/Normals.js";import{Object3D as W}from"../../webgl-engine/lib/Object3D.js";import{DefaultMaterial as k}from"../../webgl-engine/materials/DefaultMaterial.js";const Z=["polygon","extent"];class J extends z{constructor(e,t,r,i){super(e,t,r,i,ee(t)),this.ensureDrapedStatus(!1)}async doLoad(){const e=this.symbolLayer,t=e?.material,r=this.symbolLayer.material?.color?.a,i=this._hasDrivenColorOrOpacity,s=this.needsDrivenTransparentPass||i&&null!=r&&r<1,o=t?.emissive,n=("color"===o?.source?o?.strength:void 0)??0,a=!i&&(null==r||0===r),l=i?g:this._materialColor?.toUnitRGBA()??f,c={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,useIndexing:!0,ambient:d,diffuse:d,externalColor:l,opacity:a?0:1,layerOpacity:this._getLayerOpacity(),drivenOpacity:s,hasSymbolColors:i,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:e.castShadows,emissiveStrengthFromSymbol:n,emissiveSource:1,offsetTransparentBackfaces:!0,normalType:1},m=new k(c,this._context),p=new k({...c,cullFace:2},this._context);this._materials[0]=m,this._materials[1]=p,this._updateTransparentDepedentMaterialParameters(),await B()}destroy(){super.destroy(),this._materials.length=0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,Z,this.symbolLayer.type))return null;const r=this._getDrivenUInt8ColorWithNaNSupport(e.renderingInfo,this._materialColor,!1);L(r,r);const i=this.createElevationContextForGraphic(t);return this._createAs3DShape(t,e.renderingInfo,r,i,t.uid)}layerOpacityChanged(e,t){const r=this._getLayerOpacity();this._materials[0]?.setParameters({layerOpacity:r}),this._materials[1]?.setParameters({layerOpacity:r}),this._updateTransparentDepedentMaterialParameters(),e?.forEach(e=>t(e)?.layerOpacityChanged(r,this._context.isAsync))}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,P)}slicePlaneEnabledChanged(e,t){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),e?.forEach(e=>{const r=t(e);null!=r&&r.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)}),!0}physicalBasedRenderingChanged(){const e={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0};return this._materials[0]?.setParameters(e),this._materials[1]?.setParameters(e),!0}_getExtrusionSize(e){let t;return t=e.size&&this._drivenProperties.size?j(e.size.output,2)??0:this._getSymbolSize(),t/=this._context.renderCoordsHelper.unitInMeters,t}applyRendererDiff(e,t){return this._drivenPropertiesChanged(t)?0:1}async queryForSnapping(r,i,s,o){const n=this._getExtrusionSize(s)*this._context.renderCoordsHelper.unitInMeters/t(i),{objectId:a,target:l}=r,c=e(l);switch(c.z=(c.z??0)+n,r.type){case"edge":{const{start:t,end:i}=r,s=e(t),o=e(i);return s.z=(s.z??0)+n,o.z=(o.z??0)+n,[new S(a,c,1/0,s,o)]}case"vertex":return[new C(a,c,1/0),new S(a,l,1/0,l,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(e,t,o,a,l){const c=D(e.geometry);if(null==c)return null;if(0===c.rings.length||!c.rings.some(e=>e.length>0))return this._logGeometryValidationWarnings(c.rings,"rings","ExtrudeSymbol3DLayer"),null;const m=R(c,this._context.elevationProvider,this._context.renderCoordsHelper,a,{outlineOutput:"tessellated-indices"});if(null==m)return;this._logGeometryCreationWarnings(m,c.rings,"rings","ExtrudeSymbol3DLayer");const p=O(c);if(null==p)return null;const h=new Array,d=new Array,g=b(),f=n(),v=u(),C=1===this._context.renderCoordsHelper.viewingMode;C||this._context.renderCoordsHelper.worldUpAtPosition(null,v),y(c.spatialReference,[p.x,p.y,0],f,this._context.renderCoordsHelper.spatialReference);const S=n();s(S,f);const j=i();r(j,S);const E=new Map,z=this._materials[0];if(this._context.clippingExtent&&(_(m.mapPositions,g),!x(g,this._context.clippingExtent)))return;if(0===m.polygonIndexCount)return;const L=this._getExtrusionSize(t),G=I(m,{height:L,worldUp:v,spherical:C,requireElevation:!0,requireNormals:!0,requireSizes:!0});if(null==G)return;w(G.vertices,G.vertices,S);const V=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:l,layerViewUid:this._context.layerViewUid}),B=new le(G.vertices,G.elevation,H(G.normals),G.sizes),F=K(z,G.indices,G.indices.length-G.bottomIndices.length,B,o,V),T=m.vertexCount,N=T,q=T,k=2*m.outlineSegmentCount,Z=m.polygonIndexCount/3,J=new ce(N,q,k,Z);if($(F,J,f),E.set(F,J),h.push(F,K(this._materials[1],G.bottomIndices,0,B,o,V)),d.push(B.heights),0===h.length)return null;const Q=new W({geometries:h,layerViewUid:this._context.layerViewUid,graphicUid:l,isElevationSource:!0});Q.transformation=f;const X=M(this.symbolLayer,{opacity:this._getLayerOpacity()}),ee=X?new A(this._materials[0],X,this._context.slicePlaneEnabled):null,te=new U(this,Q,null,(e,t,r,i,s)=>Y(e,t,r,i,s,d,E),a,ee);return te.alignedSampledElevation=m.sampledElevation,te.needsElevationUpdates=P(a.mode),te}get _materialColor(){return this.symbolLayer.material?.color}_updateTransparentDepedentMaterialParameters(){const e=this._materials[0];e&&e.setParameters({cullFace:e.transparent?0:2})}}function K(e,t,r,i,s,o){const{attributeIndices:n,drawIndices:a}=Q(t),l=[["position",new F(i.positions,n,3,!0)],["normalCompressed",new F(i.normals,n,2,!0)]];if(e.parameters.hasSymbolColors){const e=v(n.length);l.push(["symbolColor",new F(s,e,4,!0)])}return new T(e,l,i.elevation,0,o,r,null,a)}function Q(e){const t=new Array,r=new Map,i=new Array;for(let s=0;s<e.length;++s){const o=e[s];let n=r.get(o);null==n&&(n=t.length,t.push(o),r.set(o,n)),i.push(n)}return{attributeIndices:t,drawIndices:i}}const X=u();function Y(e,t,r,i,s,l,c){const m=e.stageObject,p=m.geometries,d=p.length,u="absolute-height"!==t.mode;let g=0;const f=m.transformation,y=o(n(),f);for(let o=0;o<d;o+=2){const e=p[o];if(!N(e))continue;const t=e.getMutableAttribute("position").data,n=l[o/2],d=new V(e.mapPositions),b=t.length/3;let _=!1,x=0;{let e=0;for(let o=0;o<b;o++){X[0]=t[e],X[1]=t[e+1],X[2]=t[e+2],i(d,ie),u&&(x+=ie.sampledElevation),G.ENABLE_OPTIMIZATIONS?(a(te,t[e],t[e+1],t[e+2]),h(te,te,f),s.setAltitude(te,ie.z+n[e/3]),h(te,te,y)):(a(te,d.array[d.offset],d.array[d.offset+1],ie.z+n[e/3]),null!=r&&s.toRenderCoords(te,r,te),h(te,te,y)),t[e]=te[0],t[e+1]=te[1],t[e+2]=te[2];const o=se/s.unitInMeters;(Math.abs(X[0]-t[e])>=o||Math.abs(X[1]-t[e+1])>=o||Math.abs(X[2]-t[e+2])>=o)&&(_=!0),d.offset+=3,e+=3}}if(_){const t=c.get(e);t&&$(e,t,f),m.geometryVertexAttributeUpdated(p[o],"normalCompressed"),e.invalidateBoundingInfo(),m.geometryVertexAttributeUpdated(p[o],"position"),p[o+1].invalidateBoundingInfo(),m.geometryVertexAttributeUpdated(p[o+1],"position")}g+=x/b}return g/d}function $(e,t,r){const i=e.getMutableAttribute("position"),s=e.getMutableAttribute("normalCompressed").data,o=i.data,n=e.primitivePositionIndices,{topVertexStart:d,topVertexCount:u,topFaceStart:g,topFaceCount:f}=t,y=g+f,b=d+u,_=oe,x=ne,v=ae,w=re,C=te;a(C,0,0,0);const S=(e,t)=>{const i=3*e;a(t,o[i+0],o[i+1],o[i+2]),h(t,t,r)};for(let a=g;a<y;++a){const e=3*a;S(n[e+0],_[0]),S(n[e+1],_[1]),S(n[e+2],_[2]),l(x,_[1],_[0]),l(v,_[2],_[0]),c(w,x,v),m(C,C,w)}p(C,C);for(let a=d;a<b;++a){const e=C[0],t=C[1],r=C[2];q(s,a,e,t,r)}}function ee(e){return 1===(e.material?.color?.a??0)}const te=u(),re=u(),ie=new E,se=.01,oe=[u(),u(),u()],ne=u(),ae=u();class le{constructor(e,t,r,i){this.positions=e,this.elevation=t,this.normals=r,this.heights=i}}class ce{constructor(e,t,r,i){this.topVertexStart=e,this.topVertexCount=t,this.topFaceStart=r,this.topFaceCount=i}}export{J as Graphics3DExtrudeSymbolLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import e from"../../../../Color.js";import{linearize as t}from"../../../../colorUtils.js";import{deg2rad as r}from"../../../../core/mathUtils.js";import{releaseMaybe as o}from"../../../../core/maybe.js";import{isPromiseLike as n}from"../../../../core/promiseUtils.js";import{normalFromMat4 as s,fromMat4 as a}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromTranslation as l,multiply as c,invert as u,getTranslation as m}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as f,IDENTITY as p,clone as h}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as d}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as g,add as x,scale as _,transformMat4 as y,transformMat3 as T,normalize as b,scaleAndAdd as v,subtract as w,cross as C,dot as M}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as j,ONES as R,ZEROS as A,create as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as S}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{canProjectWithoutEngine as I}from"../../../../geometry/projectionUtils.js";import{computeTranslationToOriginAndRotation as B}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as U}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as E}from"../../../../geometry/projection/projectVectorToVector.js";import{fromBuffer as F,intersectsClippingArea as O,create as V}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as $}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as G,getContinuousIndexArray as D}from"../../../../geometry/support/Indices.js";import L from"../../../../geometry/support/MeshComponent.js";import N from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import H from"../../../../geometry/support/MeshTextureTransform.js";import{isRelativeVertexSpace as k,isAbsoluteVertexSpace as z}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{equals as q,isPlateCarree as W}from"../../../../geometry/support/spatialReferenceUtils.js";import{t as Y}from"../../../../chunks/vec3.js";import{transformNormal as K,transformVectorENUPlateCarree as J,transformVectorWMPlateCarree as Q,projectNormalToPCPF as X,transformTangent as Z,projectTangentToPCPF as ee}from"../../../../geometry/support/meshUtils/projection.js";import{projectMeshVertexPositions as te}from"../../../../geometry/support/meshUtils/projectMeshVertexPositions.js";import{getEmissiveMode as re}from"../../../../symbols/support/materialUtils.js";import{isEncodedMeshTexture as oe}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as ne}from"../../glTF/internal/TextureTransformUtils.js";import{defaultSymbolLayerMemoryComplexity as se}from"./defaultSymbolComplexity.js";import{perObjectElevationAligner as ae}from"./ElevationAligners.js";import{needsElevationUpdates3D as ie,evaluateElevationInfoAtPoint as le}from"./elevationAlignmentUtils.js";import{preparePatchEmissiveStrength as ce}from"./emissiveUtils.js";import{Graphics3DMeshObject3DGraphicLayer as ue}from"./Graphics3DMeshObject3DGraphicLayer.js";import{Object3DEdgeState as me}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as fe,nanFallbackColor as pe}from"./Graphics3DSymbolLayer.js";import{MaterialInfoCache as he,MeshFastUpdateProcessor as de}from"./MeshFastUpdateProcessor.js";import{SymbolComplexity as ge}from"./SymbolComplexity.js";import{hasEdges as xe,createMaterial as _e}from"../support/edgeUtils.js";import{debugFlags as ye}from"../../support/debugFlags.js";import{Attribute as Te}from"../../webgl-engine/lib/Attribute.js";import{Geometry as be}from"../../webgl-engine/lib/Geometry.js";import{ManagedTexture as ve}from"../../webgl-engine/lib/ManagedTexture.js";import{Object3D as we}from"../../webgl-engine/lib/Object3D.js";import{DefaultMaterial as Ce}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as Me}from"../../webgl-engine/materials/NativeLineMaterial.js";import{useSchematicPBR as je,advancedMRRFactors as Re,schematicMRRFactors as Ae}from"../../webgl-engine/materials/pbrUtils.js";const Pe=["mesh"];class Se extends fe{constructor(e,t,r,o){super(e,t,r,o,Ye(t)),this._materialInfoCache=new he,this._fastUpdateProcessor=new de,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){ye.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new Me({color:[1,0,1,1]}),this._debugTangentNormalMaterial=new Me({color:[1,.5,0,1]}),this._debugFaceNormalMaterial=new Me({color:[0,1,1,1]})),this.updateComplexity()}destroy(){super.destroy(),this._textures.forEach(e=>e.unload()),this._context.stage.removeTextures(Array.from(this._textures.values())),this._materialInfoCache.clear(),this._textures.clear(),this._fastUpdateProcessor.destroy()}get materials(){return this._materialInfoCache.materials}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,Pe,"fill on mesh-3d"))return null;const r=this.createElevationContextForGraphic(t),o=e.renderingInfo;return this._createAs3DShape(t,o,r,t.uid)}onRemoveGraphic(e){this._fastUpdateProcessor.onRemoveGraphic(e,this._materialInfoCache)}layerOpacityChanged(e,t){const r=this._getLayerOpacity();this._updateMaterialParameters(e=>{e.material.setParameters({layerOpacity:r});const t=e.material.parameters;this._setMaterialTextureAlphaMode(t,e)}),e?.forEach(e=>t(e)?.layerOpacityChanged(r,this._context.isAsync))}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,ie)}slicePlaneEnabledChanged(e,t){return this._updateMaterialParameters(({material:e})=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),e?.forEach(e=>t(e)?.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)),!0}physicalBasedRenderingChanged(){const e=this._usePBR();return this._updateMaterialParameters(({material:t})=>t.setParameters({usePBR:e})),!0}updateTransform(e,t,r,o){if(!e.fastTransformUpdatesAllowed)return!1;const n=e.fastTransformUpdatesEnabled;switch(o){case 0:if(n)return!0;break;case 1:if(!n)return!0;break;default:if(!n)return!!this.updateTransform(e,t,r,0)&&(e.autoDisableFastTransformUpdates(()=>this.updateTransform(e,t,r,1)),!0)}const s=this._context.renderCoordsHelper.spatialReference,a=rt,{origin:i,transform:l}=r;if(!B(t,g(Qe,i.x,i.y,i.z??0),a,s))return!1;switch(o){case 0:this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context);break;case 1:this._fastUpdateProcessor.disable(e,this._materialInfoCache)}e.updateFastLocalOrigin(a,l,this._context.localOriginFactory,!1);const{elevationContext:c}=e;c.centerInElevationSR=this._getCenterInElevationSR(a);const{elevationProvider:u,renderCoordsHelper:m}=this._context,f=(e,t)=>le(e,u,c,m,t);return e.alignedSampledElevation=ae(e,c,u.spatialReference,f,m,a),e.updateTransform(a,l,this._context.isAsync),e.updateAutoDisableFastTransformUpdates(()=>this.updateTransform(e,t,r,1)),!0}computeComplexity(){if(!this._textures||0===this._textures.size)return super.computeComplexity();let e=0;for(const o of this._textures.values())e+=o.usedMemory;const t={...se(this.symbol,this.symbolLayer),resourceBytes:e},r=xe(this.symbolLayer)?2:0;return new ge({drawCallsPerFeature:r,memory:t})}_requiresSymbolVertexColors(){return this._hasDrivenColorOrOpacity}_materialPropertiesDefault(e,t){const r=this._requiresSymbolVertexColors(),o=!!e.vertexAttributes.color,n=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:r,hasVertexColors:o,hasVertexTangents:n,uid:`vc:${o},vt:${n},vct${t},svc:${r}`}}_materialProperties(e,t,r){const o=this._materialPropertiesDefault(e,r);if(!t.material)return o;const{color:n,colorTexture:s,colorTextureTransform:a,normalTexture:i,normalTextureTransform:l,doubleSided:c,alphaCutoff:u,alphaMode:m}=t.material,f=ze(n),p=ze(s),h=qe(a),d=ze(i),g=qe(l);if(o.color=n,o.colorTexture=s,o.normalTexture=i,o.uid=`${o.uid},cmuid:${f},ctmuid:${p},cttuid:${h},ntmuid:${d},nttuid:${g},ds:${c},ac:${u},am:${m}`,t.material instanceof N){const{metallic:e,roughness:r,metallicRoughnessTexture:n,metallicRoughnessTextureTransform:s,emissiveColor:i,emissiveStrength:c,emissiveTexture:u,emissiveTextureTransform:m,occlusionTexture:f,occlusionTextureTransform:p}=t.material,h=ze(n),d=qe(s),g=ze(i),x=ze(u),_=qe(m),y=ze(f),T=qe(p);o.uid=[o.uid,`mrm:${e}`,`mrr:${r}`,`mrt:${h}`,`mrtt:${d}`,`emuid:${g}`,`ems:${c}`,`etmuid:${x}`,`ett:${_}`,`otmuid:${y}`,`ott:${T}`].join(","),o.metallic=e,o.roughness=r,o.metallicRoughnessTexture=n,o.emissiveColor=i,o.emissiveStrength=c,o.emissiveTexture=u,o.occlusionTexture=f,o.colorTextureTransform=Ge(a),o.normalTextureTransform=Ge(l),o.emissiveTextureTransform=Ge(m),o.occlusionTextureTransform=Ge(p),o.metallicRoughnessTextureTransform=Ge(s)}return o}_getInternalTexture(e,t=!1,r=1){const s=ke(e);if(!s)return null;const a=`${e.contentHash}/${r}`;let i=this._textures.get(a);if(i){const e=this._context.stage.renderView.textures;let t=null;const r=e.acquire(i.id);return null==r||n(r)||(i.events.on("unloaded",()=>t=o(t)),t=r),i}let l=null;const c=this._context.stage.renderView.renderingContext.parameters.maxMaxAnisotropy,u={wrap:De(e.wrap),noUnpackFlip:!0,maxAnisotropy:c,mipmap:c>1};return oe(s)?(l=s.data,u.preMultiplyAlpha=!1,u.encoding=s.encoding):(l=s,u.preMultiplyAlpha=1!==r,u.compressionOptions=t?{compressionTracker:this._context.compressionTracker,compressionCallback:()=>this.updateComplexity()}:void 0),i=new ve(l,u),this._textures.set(a,i),i.events.on("loaded",()=>this.updateComplexity()),i.load(this._context.stage.renderView.renderingContext),this._context.stage.addTexture(i),i.events.on("unloaded",()=>{this._textures.delete(a)}),i}_setInternalMaterialTextureParameters(e,r){if(null!=e.colorTexture){const t=1!==r.textureAlphaMode,o=this._getInternalTexture(e.colorTexture,t,r.textureAlphaMode);o?(r.textureId=o.id,r.textureAlphaPremultiplied=!!o.parameters.preMultiplyAlpha):r.textureId=void 0}if(e.normalTexture&&(r.normalTextureId=this._getInternalTexture(e.normalTexture)?.id),e.emissiveColor){const o=e.emissiveColor?.toUnitRGB();r.emissiveBaseColor=j(t(o[0]),t(o[1]),t(o[2]))}e.emissiveStrength&&(r.emissiveStrengthKHR=e.emissiveStrength),e.emissiveTexture&&(r.emissiveTextureId=this._getInternalTexture(e.emissiveTexture)?.id),e.occlusionTexture&&(r.occlusionTextureId=this._getInternalTexture(e.occlusionTexture,!0)?.id),e.metallicRoughnessTexture&&(r.metallicRoughnessTextureId=this._getInternalTexture(e.metallicRoughnessTexture,!0)?.id)}_setInternalMaterialParameters(e,t,r){null!=e.color&&He(e.color,t,r),this._setInternalMaterialTextureParameters(e,t),t.colorTextureTransformMatrix=ne(e.colorTextureTransform),t.normalTextureTransformMatrix=ne(e.normalTextureTransform);const o=null!=e.normalTextureTransform?.scale?e.normalTextureTransform?.scale:d;t.scale=[o[0],o[1]],t.occlusionTextureTransformMatrix=ne(e.occlusionTextureTransform),t.emissiveTextureTransformMatrix=ne(e.emissiveTextureTransform),t.metallicRoughnessTextureTransformMatrix=ne(e.metallicRoughnessTextureTransform)}_setExternalMaterialParameters(e,t=this._materialColor){const r=this._drivenProperties.color,o=this._drivenProperties.opacity;if(r)e.externalColor=S;else{const r=t??null;if(r){const t=r.toUnitRGBA();o&&(t[3]=1),e.externalColor=t}else e.externalColor=pe}e.colorMixMode=this.symbolLayer.material?.colorMixMode??"multiply",e.castShadows=!!this.symbolLayer.castShadows,e.emissiveStrengthFromSymbol=this.symbolLayer?.material?.emissive?.strength??1,e.emissiveSource=re(this.symbolLayer?.material?.emissive?.source??"emissive")}_getOrCreateMaterial(e,t){const r=t.material?.color,o=t.material?.colorTexture,n=t.material?.alphaMode,s="blend"===n,a=!("opaque"===n)&&(Ne(e)||null!=r&&r.a<1||o?.transparent||s),i=this._materialProperties(e,t,a),l=this._materialInfoCache.byUid(i.uid);if(l)return this._setInternalMaterialTextureParameters(i,l.material.parameters),l.material;const c={uid:i.uid,material:null,isComponentTransparent:a,alphaMode:t.material?t.material.alphaMode:"opaque"},u=je({normalTexture:i.normalTexture,metallicRoughnessTexture:i.metallicRoughnessTexture,metallicFactor:i.metallic,roughnessFactor:i.roughness,emissiveTexture:i.emissiveTexture,emissiveFactor:i.emissiveColor?.toUnitRGB(),occlusionTexture:i.occlusionTexture}),m={usePBR:this._usePBR(),isSchematic:u,hasVertexColors:i.hasVertexColors,hasSymbolColors:i.hasSymbolVertexColors,hasVertexTangents:i.hasVertexTangents,ambient:A,diffuse:R,opacity:1,doubleSided:!0,doubleSidedType:"winding-order",cullFace:0,layerOpacity:this._getLayerOpacity(),hasSlicePlane:this._context.slicePlaneEnabled,drivenOpacity:this.needsDrivenTransparentPass||c.isComponentTransparent};m.mrrFactors=u?Ae:[i.metallic,i.roughness,Re[2]],t.material&&(m.doubleSided=t.material.doubleSided,m.cullFace=t.material.doubleSided?0:2,m.textureAlphaCutoff=t.material.alphaCutoff),this._setExternalMaterialParameters(m),this._setMaterialTextureAlphaMode(m,c),this._setInternalMaterialParameters(i,m,c);const f=new Ce(m,this._context);return c.material=f,this._materialInfoCache.set(i.uid,c),f}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchColor(e,t),this._preparePatchEmissive(e,t)}_preparePatchColor(e,t){if(!t.material||"partial"!==t.material.type)return;const r=t.material.diff;if(!r.color||"complete"!==r.color.type||null==r.color.newValue||null==r.color.oldValue)return;const o=r.color.newValue;delete r.color,e.symbolLayerStatePatches.push(()=>{this._updateMaterialParameters(e=>{const t=e.material.parameters;this._setExternalMaterialParameters(t,o),this._setMaterialTextureAlphaMode(t,e),e.material.setParameters({externalColor:t.externalColor})})})}_preparePatchEmissive(e,t){return ce(e,t,e=>{this._updateMaterialParameters(t=>{t.material.setParameters({emissiveStrengthFromSymbol:e??1})})},this.view.stage.renderView.renderingContext.driverTest.floatBufferBlend.result)}_usePBR(){return this._context.physicalBasedRenderingEnabled}_setMaterialTextureAlphaMode(e,t){if("auto"===t.alphaMode){const r=this.needsDrivenTransparentPass||t.isComponentTransparent||(e.layerOpacity??1)<1||(e.opacity??1)<1||(e.externalColor?.[3]??1)<1;e.textureAlphaMode=r?3:1}else e.textureAlphaMode="opaque"===t.alphaMode?1:"mask"===t.alphaMode?2:0}_createFaceDebugNormals(e,t){const r=t.length,o=e.spatialReference.isGeographic?20015077/180:1,n=.1*Math.max(e.extent.width*o,e.extent.height*o,e.extent.zmax-e.extent.zmin),a=[],l=[],c=t[0].transformation,u=s(i(),c);for(let s=0;s<r;s++){const e=t[s].attributes.get("position");if(!e)continue;const r=e.data,o=e.indices;for(let t=0;t<o.length;t+=3)$e(r,o,t,et),Ve(r,o,t,Qe,Xe,Ze),x(Qe,Qe,Xe),x(Qe,Qe,Ze),_(Qe,Qe,1/3),y(Qe,Qe,c),a.push(...Qe),T(et,et,u),b(et,et),v(Qe,Qe,et,n),a.push(...Qe),l.push(l.length),l.push(l.length)}return a.length?new be(this._debugFaceNormalMaterial,[["position",new Te(a,l,3,!0)]],null,2):null}_createPerVertexDebugVectors(e,t,r,o,n){const l=t.length,c=e.spatialReference.isGeographic?20015077/180:1,u=.1*n*Math.max(e.extent.width*c,e.extent.height*c,e.extent.zmax-e.extent.zmin),m=[],f=[],p=t[0].transformation,h=s(i(),p);"tangent"===r&&a(h,p);for(let s=0;s<l;s++){const e=t[s],o=e.attributes.get("position"),n=e.attributes.get(r);if(!o||!n)continue;const a=o.data,i=o.indices,l=n.data,c=n.indices;for(let t=0;t<i.length;t++){const e=3*i[t],r=c[t]*n.stride;g(Qe,a[e+0],a[e+1],a[e+2]),y(Qe,Qe,p),m.push(...Qe),g(Xe,l[r+0],l[r+1],l[r+2]),T(Xe,Xe,h),b(Xe,Xe),v(Qe,Qe,Xe,u),m.push(...Qe),f.push(f.length),f.push(f.length)}}return m.length?new be(o,[["position",new Te(m,f,3,!0)]],null,2):null}_createAs3DShape(e,t,r,o){const n=e.geometry;if("mesh"!==n.type)return null;const s=this._createGeometryInfo(n,t,o);if(null==s)return null;const{geometries:a,objectTransformation:i}=s;if(ye.DRAW_MESH_GEOMETRY_NORMALS){const e=this._createPerVertexDebugVectors(n,a,"normal",this._debugVertexNormalMaterial,1),t=this._createPerVertexDebugVectors(n,a,"tangent",this._debugTangentNormalMaterial,.5),r=this._createFaceDebugNormals(n,a);e&&a.push(e),t&&a.push(t),r&&a.push(r)}const l=this._context.layerViewUid,c=new we({geometries:a,layerViewUid:l,graphicUid:o,isElevationSource:!0});c.transformation=i;const u=_e(this.symbolLayer,{opacity:this._getLayerOpacity()}),m=u?new me(a[0].material,u,this._context.slicePlaneEnabled):null,f=new ue(this,c,null,ae,r,m);this._fastUpdateProcessor.onAddGraphic(),f.needsElevationUpdates=ie(r.mode),f.useObjectOriginAsAttachmentOrigin=!0,f.fastTransformUpdatesAllowed=this._fastTransformUpdatesAllowed(n),r.centerInElevationSR=this._getCenterInElevationSR(c.transformation);const{elevationProvider:p,renderCoordsHelper:h}=this._context,d=(e,t)=>le(e,p,r,h,t);return f.alignedSampledElevation=ae(f,r,p.spatialReference,d,h),f}_fastTransformUpdatesAllowed(e){const{vertexSpace:t,spatialReference:r}=e;if(!k(t))return!1;const{type:o}=t,{view:n}=this._context.graphicsCoreOwner,{viewingMode:s}=n.state,a=n.spatialReference;return 1===s&&"local"===o||2===s&&q(a,r)&&"georeferenced"===o&&!r.isGeographic}_getElevationSR(){return this._context.elevationProvider.spatialReference??null}_getCenterInElevationSR(e){const t=P(),r=g(st,e[12],e[13],e[14]);return E(r,this._context.renderCoordsHelper.spatialReference,t,this._getElevationSR()),t}_passthroughReprojectionInfo(e){return 0===e.reprojection&&!!e.objectTransformation}_createPositionBuffer(e,t){const r=e.vertexAttributes.position;let o,n=r;if(0===t.reprojection)return{position:n,georeferencedPositionBuffer:o};const s=1===t.reprojection?t.transformBeforeProject:null;s&&(n=Y(new Float64Array(n.length),n,s));const{normal:a,tangent:i}=e.vertexAttributes;this._passthroughReprojectionInfo(t)||!a&&!i||(o=n);const l=n===r||n===o?new Float64Array(n.length):n;return U(n,e.spatialReference,0,l,this._context.renderCoordsHelper.spatialReference,0),{position:l,georeferencedPositionBuffer:o}}_createNormalBuffer(e,t,r,o){const n=e.vertexAttributes.normal;if(null==n)return null;let s=n;const a=1===o.reprojection?o.transformBeforeProject:null;a&&(s=K(s,new Float32Array(s.length),a));const i=this._context.graphicsCoreOwner.view.viewingMode;if(0===o.reprojection)return s;if("local"===i){if(!W(this._context.renderCoordsHelper.spatialReference))return s;if(null==r)return null;if(e.spatialReference.isGeographic){const e=s===n?new Float32Array(s.length):s;return J(s,0,r,e)}if(e.spatialReference.isWebMercator){const e=s===n?new Float32Array(s.length):s;return Q(s,0,r,e)}return s}if(null==r)return null;const l=s===n?new Float32Array(s.length):s,c=this._context.renderCoordsHelper.spatialReference;return X(s,r,e.spatialReference,t,c,l)}_createTangentBuffer(e,t,r,o){const n=e.vertexAttributes.tangent;if(null==n)return null;let s=n;const a=1===o.reprojection?o.transformBeforeProject:null;a&&(s=Z(s,new Float32Array(s.length),a));const i=this._context.graphicsCoreOwner.view.viewingMode;if(0===o.reprojection)return s;if("local"===i){if(!W(this._context.renderCoordsHelper.spatialReference))return s;if(null==r)return null;if(e.spatialReference.isGeographic){const e=s===n?new Float32Array(s.length):s;return J(s,1,r,e)}if(e.spatialReference.isWebMercator){const e=s===n?new Float32Array(s.length):s;return Q(s,1,r,e)}return s}if(null==r)return null;const l=s===n?new Float32Array(s.length):s,c=this._context.renderCoordsHelper.spatialReference;return ee(s,r,e.spatialReference,t,c,l)}_createSymbolColorBuffer(e){return this._requiresSymbolVertexColors()?new Uint8Array(this._getDrivenUInt8ColorWithNaNSupport(e,this._materialColor,!0)):null}_createBuffers(e,t){const r=e.vertexAttributes&&e.vertexAttributes.position;if(!r)return this.logger.warn("Mesh geometry must contain position vertex attributes"),null;const o=e.vertexAttributes.normal,n=e.vertexAttributes.uv,s=e.vertexAttributes.tangent;if(o&&o.length!==r.length)return this.logger.warn("Mesh normal vertex buffer must contain the same number of elements as the position buffer"),null;if(s&&s.length/4!=r.length/3)return this.logger.warn("Mesh tangent vertex buffer must contain the same number of elements as the position buffer"),null;if(n&&n.length/2!=r.length/3)return this.logger.warn("Mesh uv vertex buffer must contain the same number of elements as the position buffer"),null;const a=this._computeReprojectionInfo(e),{position:i,georeferencedPositionBuffer:l}=this._createPositionBuffer(e,a),c=We(e),u=this._createSymbolColorBuffer(t),m=this._createNormalBuffer(e,i,l,a),p=this._createTangentBuffer(e,i,l,a),h=n,{transformation:d,position:g,normal:x,tangent:_}=this._passthroughReprojectionInfo(a)?{transformation:a.objectTransformation,position:i,normal:m,tangent:p}:this._transformOriginLocal(e,i,m,p);return{positionBuffer:g,normalBuffer:x,tangentBuffer:_,uvBuffer:h,colorBuffer:c,symbolColorBuffer:u,objectTransformation:d,geometryTransformation:0===a.reprojection&&a.geometryTransformation?a.geometryTransformation:f()}}_computeReprojectionInfo(e){const{vertexSpace:t}=e,r="georeferenced"===t.type?q(this._context.renderCoordsHelper.spatialReference,e.spatialReference)?0:1:0;if(z(t))return{reprojection:r};const o=t.origin,n=f(),s=e.transform?.localMatrix??p;if(0===r){B(e.spatialReference,o,n,this._context.renderCoordsHelper.spatialReference);return{reprojection:r,objectTransformation:n,geometryTransformation:h(s)}}const a=l(f(),o);return c(a,a,s),{reprojection:r,transformBeforeProject:a}}_transformOriginLocal(e,t,r,o){const n=this._context.renderCoordsHelper.spatialReference,s=e.origin;Je[0]=s.x,Je[1]=s.y,Je[2]=s.z??0;const a=f();B(e.spatialReference,Je,a,n),u(tt,a);const{position:i,normal:l,tangent:c}=e.vertexAttributes,m=t===i?new Float64Array(t.length):t;Y(m,t,tt);const p=r?r===l?new Float32Array(r.length):r:null,h=o?o===c?new Float32Array(o.length):o:null;return r&&p&&K(r,p,tt),o&&h&&Z(o,h,tt),{transformation:a,position:m,normal:p,tangent:h}}_validateFaces(e,t){const r=e.vertexAttributes.position.length/3,o=t.faces;if(o){let e=-1;for(let t=0;t<o.length;t++){const r=o[t];r>e&&(e=r)}if(r<=e)return this.logger.warn(`Vertex index ${e} is out of bounds of the mesh position buffer`),!1}else if(r%3!=0)return this.logger.warn("Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)"),!1;return!0}_isOutsideClippingArea(e){if(!this._context.clippingExtent)return!1;const t=e.vertexAttributes?.position;if(!t)return!1;const r=this._context.elevationProvider.spatialReference,o=te(e,r??e.spatialReference);return!!o&&(F(o,ot),!O(ot,this._context.clippingExtent))}_createGeometryInfo(e,t,r){if(!I(e.spatialReference,this._context.renderCoordsHelper.spatialReference))return this.logger.warn("Geometry spatial reference is not compatible with the view"),null;if(!this._validateVertexSpace(e))return null;if(this._isOutsideClippingArea(e))return null;const o=this._createBuffers(e,t);if(null==o)return null;const{positionBuffer:n,uvBuffer:s,colorBuffer:a,symbolColorBuffer:i,normalBuffer:l,tangentBuffer:c,objectTransformation:u,geometryTransformation:f}=o,p=e.components??nt,h=new Array;let d=!1;const g=m(Qe,u),x=this._context.localOriginFactory.getOrigin(g);for(const m of p){if(!this._validateFaces(e,m))return null;const t=Be(e,m);if(0===t.length)continue;const o=Ue(n,l,m,t);o.didFlipNormals&&(d=!0);const u=[["position",new Te(n,t,3,!0)],["normal",new Te(o.normals,o.indices,3,!0)]];a&&u.push(["color",new Te(a,t,4,!0)]),i&&u.push(["symbolColor",new Te(i,G(t.length),4,!0)]),s&&u.push(["uv0",new Te(s,t,2,!0)]),c&&u.push(["tangent",new Te(c,t,4,!0)]);const p=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:r,layerViewUid:this._context.layerViewUid}),g=this._getOrCreateMaterial(e,m),_=new be(g,u,null,0,p);_.transformation=f,_.localOrigin=x,h.push(_)}return d&&this.logger.warn("Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals."),{geometries:h,objectTransformation:u}}_updateMaterialParameters(e){this._materialInfoCache.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachClonedMaterial((e,t)=>{t.setParameters(e.parameters)})}_validateVertexSpace(e){const{_context:{graphicsCoreOwner:{view:{state:{viewingMode:t}}}}}=this,{vertexSpace:r}=e;return 2!==t||"local"!==r.type||(this.logger.warn("Displaying a mesh with a local vertex space in a view in local viewing mode is not supported."),!1)}test(){return{...super.test(),materials:this._materialInfoCache.materials}}get _materialColor(){return this.symbolLayer.material?.color}}class Ie{constructor(e,t,r){this.normals=e,this.indices=t,this.didFlipNormals=r}}function Be(e,t){return t.faces??D(e.vertexAttributes.position.length/3)}function Ue(e,t,r,o){switch(r.shading||"flat"){default:case"source":return Fe(e,t,r,o);case"flat":return Ee(e,o);case"smooth":return Oe(e,o)}}function Ee(e,t){const r=$(t.length),o=new Array(3*t.length);for(let n=0;n<t.length;n+=3){const s=$e(e,t,n,et);for(let e=0;e<3;e++)r[n+e]=s[e],o[n+e]=n/3}return new Ie(r,o,!1)}function Fe(e,t,r,o){if(null==t)return Ee(e,o);let n=!1;if(!r.trustSourceNormals)for(let s=0;s<o.length;s+=3){$e(e,o,s,et);for(let e=0;e<3;e++){const r=3*o[s+e];Qe[0]=t[r],Qe[1]=t[r+1],Qe[2]=t[r+2],M(et,Qe)<0&&(t[r]=-t[r],t[r+1]=-t[r+1],t[r+2]=-t[r+2],n=!0)}}return new Ie(t,o,n)}function Oe(e,t){const r={};for(let s=0;s<t.length;s+=3){const o=$e(e,t,s,et);for(let e=0;e<3;e++){const n=t[s+e];let a=r[n];a||(a={normal:P(),count:0},r[n]=a),x(a.normal,a.normal,o),a.count++}}const o=$(3*t.length),n=new Array(3*t.length);for(let s=0;s<t.length;s++){const e=r[t[s]];1!==e.count&&(b(e.normal,e.normal),e.count=1);for(let t=0;t<3;t++)o[3*s+t]=e.normal[t];n[s]=s}return new Ie(o,n,!1)}function Ve(e,t,r,o,n,s){const a=3*t[r],i=3*t[r+1],l=3*t[r+2];o[0]=e[a],o[1]=e[a+1],o[2]=e[a+2],n[0]=e[i],n[1]=e[i+1],n[2]=e[i+2],s[0]=e[l],s[1]=e[l+1],s[2]=e[l+2]}function $e(e,t,r,o){return Ve(e,t,r,Qe,Xe,Ze),w(Xe,Xe,Qe),w(Ze,Ze,Qe),C(Qe,Xe,Ze),b(o,Qe),o}function Ge(e){if(!e)return null;const{scale:t,offset:o,rotation:n}=e;return{scale:t,offset:o,rotation:r(n)}}function De(e="repeat"){if("string"==typeof e){const t=Le(e);return{s:t,t}}return{s:Le(e.horizontal),t:Le(e.vertical)}}function Le(e){switch(e){case"clamp":return 33071;case"mirror":return 33648;default:return 10497}}function Ne(e){const t=e.vertexAttributes.color;if(null==t)return!1;for(let r=3;r<t.length;r+=4)if(255!==t[r])return!0;return!1}function He(e,t,r){t.diffuse=e.toUnitRGB(),t.opacity="opaque"===r.alphaMode?1:e.a}function ke(e){return e.data??e.url}function ze(t){return null==t?"-":t instanceof e?t.toHex():t.contentHash}function qe(e){const{offset:t,scale:r,rotation:o}=e??Ke;return`${t[0]},${t[1]},${o},${r[0]},${r[1]}`}function We(e){return e.vertexAttributes.color}function Ye(e){return 1===(e.material?.color?.a??0)}const Ke=new H,Je=P(),Qe=P(),Xe=P(),Ze=P(),et=P(),tt=f(),rt=f(),ot=V(),nt=[new L],st=P();export{Se as Graphics3DMeshFillSymbolLayer};
2
+ import e from"../../../../Color.js";import{linearize as t}from"../../../../colorUtils.js";import{deg2rad as r}from"../../../../core/mathUtils.js";import{releaseMaybe as o}from"../../../../core/maybe.js";import{isPromiseLike as n}from"../../../../core/promiseUtils.js";import{normalFromMat4 as s,fromMat4 as a}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromTranslation as l,multiply as c,invert as u,getTranslation as m}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as f,IDENTITY as p,clone as h}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as d}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as g,add as x,scale as _,transformMat4 as y,transformMat3 as T,normalize as b,scaleAndAdd as v,subtract as w,cross as C,dot as M}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as j,ONES as R,ZEROS as A,create as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as S}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{canProjectWithoutEngine as I}from"../../../../geometry/projectionUtils.js";import{computeTranslationToOriginAndRotation as B}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as U}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as E}from"../../../../geometry/projection/projectVectorToVector.js";import{fromBuffer as F,intersectsClippingArea as O,create as V}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as $}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as G,getContinuousIndexArray as D}from"../../../../geometry/support/Indices.js";import L from"../../../../geometry/support/MeshComponent.js";import N from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import H from"../../../../geometry/support/MeshTextureTransform.js";import{isRelativeVertexSpace as k,isAbsoluteVertexSpace as z}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{equals as q,isPlateCarree as W}from"../../../../geometry/support/spatialReferenceUtils.js";import{f as Y}from"../../../../chunks/vec3.js";import{transformNormal as K,transformVectorENUPlateCarree as J,transformVectorWMPlateCarree as Q,projectNormalToPCPF as X,transformTangent as Z,projectTangentToPCPF as ee}from"../../../../geometry/support/meshUtils/projection.js";import{projectMeshVertexPositions as te}from"../../../../geometry/support/meshUtils/projectMeshVertexPositions.js";import{getEmissiveMode as re}from"../../../../symbols/support/materialUtils.js";import{isEncodedMeshTexture as oe}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as ne}from"../../glTF/internal/TextureTransformUtils.js";import{defaultSymbolLayerMemoryComplexity as se}from"./defaultSymbolComplexity.js";import{perObjectElevationAligner as ae}from"./ElevationAligners.js";import{needsElevationUpdates3D as ie,evaluateElevationInfoAtPoint as le}from"./elevationAlignmentUtils.js";import{preparePatchEmissiveStrength as ce}from"./emissiveUtils.js";import{Graphics3DMeshObject3DGraphicLayer as ue}from"./Graphics3DMeshObject3DGraphicLayer.js";import{Object3DEdgeState as me}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as fe,nanFallbackColor as pe}from"./Graphics3DSymbolLayer.js";import{MaterialInfoCache as he,MeshFastUpdateProcessor as de}from"./MeshFastUpdateProcessor.js";import{SymbolComplexity as ge}from"./SymbolComplexity.js";import{hasEdges as xe,createMaterial as _e}from"../support/edgeUtils.js";import{debugFlags as ye}from"../../support/debugFlags.js";import{Attribute as Te}from"../../webgl-engine/lib/Attribute.js";import{Geometry as be}from"../../webgl-engine/lib/Geometry.js";import{ManagedTexture as ve}from"../../webgl-engine/lib/ManagedTexture.js";import{Object3D as we}from"../../webgl-engine/lib/Object3D.js";import{DefaultMaterial as Ce}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as Me}from"../../webgl-engine/materials/NativeLineMaterial.js";import{useSchematicPBR as je,advancedMRRFactors as Re,schematicMRRFactors as Ae}from"../../webgl-engine/materials/pbrUtils.js";const Pe=["mesh"];class Se extends fe{constructor(e,t,r,o){super(e,t,r,o,Ye(t)),this._materialInfoCache=new he,this._fastUpdateProcessor=new de,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){ye.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new Me({color:[1,0,1,1]}),this._debugTangentNormalMaterial=new Me({color:[1,.5,0,1]}),this._debugFaceNormalMaterial=new Me({color:[0,1,1,1]})),this.updateComplexity()}destroy(){super.destroy(),this._textures.forEach(e=>e.unload()),this._context.stage.removeTextures(Array.from(this._textures.values())),this._materialInfoCache.clear(),this._textures.clear(),this._fastUpdateProcessor.destroy()}get materials(){return this._materialInfoCache.materials}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,Pe,"fill on mesh-3d"))return null;const r=this.createElevationContextForGraphic(t),o=e.renderingInfo;return this._createAs3DShape(t,o,r,t.uid)}onRemoveGraphic(e){this._fastUpdateProcessor.onRemoveGraphic(e,this._materialInfoCache)}layerOpacityChanged(e,t){const r=this._getLayerOpacity();this._updateMaterialParameters(e=>{e.material.setParameters({layerOpacity:r});const t=e.material.parameters;this._setMaterialTextureAlphaMode(t,e)}),e?.forEach(e=>t(e)?.layerOpacityChanged(r,this._context.isAsync))}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,ie)}slicePlaneEnabledChanged(e,t){return this._updateMaterialParameters(({material:e})=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),e?.forEach(e=>t(e)?.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)),!0}physicalBasedRenderingChanged(){const e=this._usePBR();return this._updateMaterialParameters(({material:t})=>t.setParameters({usePBR:e})),!0}updateTransform(e,t,r,o){if(!e.fastTransformUpdatesAllowed)return!1;const n=e.fastTransformUpdatesEnabled;switch(o){case 0:if(n)return!0;break;case 1:if(!n)return!0;break;default:if(!n)return!!this.updateTransform(e,t,r,0)&&(e.autoDisableFastTransformUpdates(()=>this.updateTransform(e,t,r,1)),!0)}const s=this._context.renderCoordsHelper.spatialReference,a=rt,{origin:i,transform:l}=r;if(!B(t,g(Qe,i.x,i.y,i.z??0),a,s))return!1;switch(o){case 0:this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context);break;case 1:this._fastUpdateProcessor.disable(e,this._materialInfoCache)}e.updateFastLocalOrigin(a,l,this._context.localOriginFactory,!1);const{elevationContext:c}=e;c.centerInElevationSR=this._getCenterInElevationSR(a);const{elevationProvider:u,renderCoordsHelper:m}=this._context,f=(e,t)=>le(e,u,c,m,t);return e.alignedSampledElevation=ae(e,c,u.spatialReference,f,m,a),e.updateTransform(a,l,this._context.isAsync),e.updateAutoDisableFastTransformUpdates(()=>this.updateTransform(e,t,r,1)),!0}computeComplexity(){if(!this._textures||0===this._textures.size)return super.computeComplexity();let e=0;for(const o of this._textures.values())e+=o.usedMemory;const t={...se(this.symbol,this.symbolLayer),resourceBytes:e},r=xe(this.symbolLayer)?2:0;return new ge({drawCallsPerFeature:r,memory:t})}_requiresSymbolVertexColors(){return this._hasDrivenColorOrOpacity}_materialPropertiesDefault(e,t){const r=this._requiresSymbolVertexColors(),o=!!e.vertexAttributes.color,n=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:r,hasVertexColors:o,hasVertexTangents:n,uid:`vc:${o},vt:${n},vct${t},svc:${r}`}}_materialProperties(e,t,r){const o=this._materialPropertiesDefault(e,r);if(!t.material)return o;const{color:n,colorTexture:s,colorTextureTransform:a,normalTexture:i,normalTextureTransform:l,doubleSided:c,alphaCutoff:u,alphaMode:m}=t.material,f=ze(n),p=ze(s),h=qe(a),d=ze(i),g=qe(l);if(o.color=n,o.colorTexture=s,o.normalTexture=i,o.uid=`${o.uid},cmuid:${f},ctmuid:${p},cttuid:${h},ntmuid:${d},nttuid:${g},ds:${c},ac:${u},am:${m}`,t.material instanceof N){const{metallic:e,roughness:r,metallicRoughnessTexture:n,metallicRoughnessTextureTransform:s,emissiveColor:i,emissiveStrength:c,emissiveTexture:u,emissiveTextureTransform:m,occlusionTexture:f,occlusionTextureTransform:p}=t.material,h=ze(n),d=qe(s),g=ze(i),x=ze(u),_=qe(m),y=ze(f),T=qe(p);o.uid=[o.uid,`mrm:${e}`,`mrr:${r}`,`mrt:${h}`,`mrtt:${d}`,`emuid:${g}`,`ems:${c}`,`etmuid:${x}`,`ett:${_}`,`otmuid:${y}`,`ott:${T}`].join(","),o.metallic=e,o.roughness=r,o.metallicRoughnessTexture=n,o.emissiveColor=i,o.emissiveStrength=c,o.emissiveTexture=u,o.occlusionTexture=f,o.colorTextureTransform=Ge(a),o.normalTextureTransform=Ge(l),o.emissiveTextureTransform=Ge(m),o.occlusionTextureTransform=Ge(p),o.metallicRoughnessTextureTransform=Ge(s)}return o}_getInternalTexture(e,t=!1,r=1){const s=ke(e);if(!s)return null;const a=`${e.contentHash}/${r}`;let i=this._textures.get(a);if(i){const e=this._context.stage.renderView.textures;let t=null;const r=e.acquire(i.id);return null==r||n(r)||(i.events.on("unloaded",()=>t=o(t)),t=r),i}let l=null;const c=this._context.stage.renderView.renderingContext.parameters.maxMaxAnisotropy,u={wrap:De(e.wrap),noUnpackFlip:!0,maxAnisotropy:c,mipmap:c>1};return oe(s)?(l=s.data,u.preMultiplyAlpha=!1,u.encoding=s.encoding):(l=s,u.preMultiplyAlpha=1!==r,u.compressionOptions=t?{compressionTracker:this._context.compressionTracker,compressionCallback:()=>this.updateComplexity()}:void 0),i=new ve(l,u),this._textures.set(a,i),i.events.on("loaded",()=>this.updateComplexity()),i.load(this._context.stage.renderView.renderingContext),this._context.stage.addTexture(i),i.events.on("unloaded",()=>{this._textures.delete(a)}),i}_setInternalMaterialTextureParameters(e,r){if(null!=e.colorTexture){const t=1!==r.textureAlphaMode,o=this._getInternalTexture(e.colorTexture,t,r.textureAlphaMode);o?(r.textureId=o.id,r.textureAlphaPremultiplied=!!o.parameters.preMultiplyAlpha):r.textureId=void 0}if(e.normalTexture&&(r.normalTextureId=this._getInternalTexture(e.normalTexture)?.id),e.emissiveColor){const o=e.emissiveColor?.toUnitRGB();r.emissiveBaseColor=j(t(o[0]),t(o[1]),t(o[2]))}e.emissiveStrength&&(r.emissiveStrengthKHR=e.emissiveStrength),e.emissiveTexture&&(r.emissiveTextureId=this._getInternalTexture(e.emissiveTexture)?.id),e.occlusionTexture&&(r.occlusionTextureId=this._getInternalTexture(e.occlusionTexture,!0)?.id),e.metallicRoughnessTexture&&(r.metallicRoughnessTextureId=this._getInternalTexture(e.metallicRoughnessTexture,!0)?.id)}_setInternalMaterialParameters(e,t,r){null!=e.color&&He(e.color,t,r),this._setInternalMaterialTextureParameters(e,t),t.colorTextureTransformMatrix=ne(e.colorTextureTransform),t.normalTextureTransformMatrix=ne(e.normalTextureTransform);const o=null!=e.normalTextureTransform?.scale?e.normalTextureTransform?.scale:d;t.scale=[o[0],o[1]],t.occlusionTextureTransformMatrix=ne(e.occlusionTextureTransform),t.emissiveTextureTransformMatrix=ne(e.emissiveTextureTransform),t.metallicRoughnessTextureTransformMatrix=ne(e.metallicRoughnessTextureTransform)}_setExternalMaterialParameters(e,t=this._materialColor){const r=this._drivenProperties.color,o=this._drivenProperties.opacity;if(r)e.externalColor=S;else{const r=t??null;if(r){const t=r.toUnitRGBA();o&&(t[3]=1),e.externalColor=t}else e.externalColor=pe}e.colorMixMode=this.symbolLayer.material?.colorMixMode??"multiply",e.castShadows=!!this.symbolLayer.castShadows,e.emissiveStrengthFromSymbol=this.symbolLayer?.material?.emissive?.strength??1,e.emissiveSource=re(this.symbolLayer?.material?.emissive?.source??"emissive")}_getOrCreateMaterial(e,t){const r=t.material?.color,o=t.material?.colorTexture,n=t.material?.alphaMode,s="blend"===n,a=!("opaque"===n)&&(Ne(e)||null!=r&&r.a<1||o?.transparent||s),i=this._materialProperties(e,t,a),l=this._materialInfoCache.byUid(i.uid);if(l)return this._setInternalMaterialTextureParameters(i,l.material.parameters),l.material;const c={uid:i.uid,material:null,isComponentTransparent:a,alphaMode:t.material?t.material.alphaMode:"opaque"},u=je({normalTexture:i.normalTexture,metallicRoughnessTexture:i.metallicRoughnessTexture,metallicFactor:i.metallic,roughnessFactor:i.roughness,emissiveTexture:i.emissiveTexture,emissiveFactor:i.emissiveColor?.toUnitRGB(),occlusionTexture:i.occlusionTexture}),m={usePBR:this._usePBR(),isSchematic:u,hasVertexColors:i.hasVertexColors,hasSymbolColors:i.hasSymbolVertexColors,hasVertexTangents:i.hasVertexTangents,ambient:A,diffuse:R,opacity:1,doubleSided:!0,doubleSidedType:"winding-order",cullFace:0,layerOpacity:this._getLayerOpacity(),hasSlicePlane:this._context.slicePlaneEnabled,drivenOpacity:this.needsDrivenTransparentPass||c.isComponentTransparent};m.mrrFactors=u?Ae:[i.metallic,i.roughness,Re[2]],t.material&&(m.doubleSided=t.material.doubleSided,m.cullFace=t.material.doubleSided?0:2,m.textureAlphaCutoff=t.material.alphaCutoff),this._setExternalMaterialParameters(m),this._setMaterialTextureAlphaMode(m,c),this._setInternalMaterialParameters(i,m,c);const f=new Ce(m,this._context);return c.material=f,this._materialInfoCache.set(i.uid,c),f}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchColor(e,t),this._preparePatchEmissive(e,t)}_preparePatchColor(e,t){if(!t.material||"partial"!==t.material.type)return;const r=t.material.diff;if(!r.color||"complete"!==r.color.type||null==r.color.newValue||null==r.color.oldValue)return;const o=r.color.newValue;delete r.color,e.symbolLayerStatePatches.push(()=>{this._updateMaterialParameters(e=>{const t=e.material.parameters;this._setExternalMaterialParameters(t,o),this._setMaterialTextureAlphaMode(t,e),e.material.setParameters({externalColor:t.externalColor})})})}_preparePatchEmissive(e,t){return ce(e,t,e=>{this._updateMaterialParameters(t=>{t.material.setParameters({emissiveStrengthFromSymbol:e??1})})},this.view.stage.renderView.renderingContext.driverTest.floatBufferBlend.result)}_usePBR(){return this._context.physicalBasedRenderingEnabled}_setMaterialTextureAlphaMode(e,t){if("auto"===t.alphaMode){const r=this.needsDrivenTransparentPass||t.isComponentTransparent||(e.layerOpacity??1)<1||(e.opacity??1)<1||(e.externalColor?.[3]??1)<1;e.textureAlphaMode=r?3:1}else e.textureAlphaMode="opaque"===t.alphaMode?1:"mask"===t.alphaMode?2:0}_createFaceDebugNormals(e,t){const r=t.length,o=e.spatialReference.isGeographic?20015077/180:1,n=.1*Math.max(e.extent.width*o,e.extent.height*o,e.extent.zmax-e.extent.zmin),a=[],l=[],c=t[0].transformation,u=s(i(),c);for(let s=0;s<r;s++){const e=t[s].attributes.get("position");if(!e)continue;const r=e.data,o=e.indices;for(let t=0;t<o.length;t+=3)$e(r,o,t,et),Ve(r,o,t,Qe,Xe,Ze),x(Qe,Qe,Xe),x(Qe,Qe,Ze),_(Qe,Qe,1/3),y(Qe,Qe,c),a.push(...Qe),T(et,et,u),b(et,et),v(Qe,Qe,et,n),a.push(...Qe),l.push(l.length),l.push(l.length)}return a.length?new be(this._debugFaceNormalMaterial,[["position",new Te(a,l,3,!0)]],null,2):null}_createPerVertexDebugVectors(e,t,r,o,n){const l=t.length,c=e.spatialReference.isGeographic?20015077/180:1,u=.1*n*Math.max(e.extent.width*c,e.extent.height*c,e.extent.zmax-e.extent.zmin),m=[],f=[],p=t[0].transformation,h=s(i(),p);"tangent"===r&&a(h,p);for(let s=0;s<l;s++){const e=t[s],o=e.attributes.get("position"),n=e.attributes.get(r);if(!o||!n)continue;const a=o.data,i=o.indices,l=n.data,c=n.indices;for(let t=0;t<i.length;t++){const e=3*i[t],r=c[t]*n.stride;g(Qe,a[e+0],a[e+1],a[e+2]),y(Qe,Qe,p),m.push(...Qe),g(Xe,l[r+0],l[r+1],l[r+2]),T(Xe,Xe,h),b(Xe,Xe),v(Qe,Qe,Xe,u),m.push(...Qe),f.push(f.length),f.push(f.length)}}return m.length?new be(o,[["position",new Te(m,f,3,!0)]],null,2):null}_createAs3DShape(e,t,r,o){const n=e.geometry;if("mesh"!==n.type)return null;const s=this._createGeometryInfo(n,t,o);if(null==s)return null;const{geometries:a,objectTransformation:i}=s;if(ye.DRAW_MESH_GEOMETRY_NORMALS){const e=this._createPerVertexDebugVectors(n,a,"normal",this._debugVertexNormalMaterial,1),t=this._createPerVertexDebugVectors(n,a,"tangent",this._debugTangentNormalMaterial,.5),r=this._createFaceDebugNormals(n,a);e&&a.push(e),t&&a.push(t),r&&a.push(r)}const l=this._context.layerViewUid,c=new we({geometries:a,layerViewUid:l,graphicUid:o,isElevationSource:!0});c.transformation=i;const u=_e(this.symbolLayer,{opacity:this._getLayerOpacity()}),m=u?new me(a[0].material,u,this._context.slicePlaneEnabled):null,f=new ue(this,c,null,ae,r,m);this._fastUpdateProcessor.onAddGraphic(),f.needsElevationUpdates=ie(r.mode),f.useObjectOriginAsAttachmentOrigin=!0,f.fastTransformUpdatesAllowed=this._fastTransformUpdatesAllowed(n),r.centerInElevationSR=this._getCenterInElevationSR(c.transformation);const{elevationProvider:p,renderCoordsHelper:h}=this._context,d=(e,t)=>le(e,p,r,h,t);return f.alignedSampledElevation=ae(f,r,p.spatialReference,d,h),f}_fastTransformUpdatesAllowed(e){const{vertexSpace:t,spatialReference:r}=e;if(!k(t))return!1;const{type:o}=t,{view:n}=this._context.graphicsCoreOwner,{viewingMode:s}=n.state,a=n.spatialReference;return 1===s&&"local"===o||2===s&&q(a,r)&&"georeferenced"===o&&!r.isGeographic}_getElevationSR(){return this._context.elevationProvider.spatialReference??null}_getCenterInElevationSR(e){const t=P(),r=g(st,e[12],e[13],e[14]);return E(r,this._context.renderCoordsHelper.spatialReference,t,this._getElevationSR()),t}_passthroughReprojectionInfo(e){return 0===e.reprojection&&!!e.objectTransformation}_createPositionBuffer(e,t){const r=e.vertexAttributes.position;let o,n=r;if(0===t.reprojection)return{position:n,georeferencedPositionBuffer:o};const s=1===t.reprojection?t.transformBeforeProject:null;s&&(n=Y(new Float64Array(n.length),n,s));const{normal:a,tangent:i}=e.vertexAttributes;this._passthroughReprojectionInfo(t)||!a&&!i||(o=n);const l=n===r||n===o?new Float64Array(n.length):n;return U(n,e.spatialReference,0,l,this._context.renderCoordsHelper.spatialReference,0),{position:l,georeferencedPositionBuffer:o}}_createNormalBuffer(e,t,r,o){const n=e.vertexAttributes.normal;if(null==n)return null;let s=n;const a=1===o.reprojection?o.transformBeforeProject:null;a&&(s=K(s,new Float32Array(s.length),a));const i=this._context.graphicsCoreOwner.view.viewingMode;if(0===o.reprojection)return s;if("local"===i){if(!W(this._context.renderCoordsHelper.spatialReference))return s;if(null==r)return null;if(e.spatialReference.isGeographic){const e=s===n?new Float32Array(s.length):s;return J(s,0,r,e)}if(e.spatialReference.isWebMercator){const e=s===n?new Float32Array(s.length):s;return Q(s,0,r,e)}return s}if(null==r)return null;const l=s===n?new Float32Array(s.length):s,c=this._context.renderCoordsHelper.spatialReference;return X(s,r,e.spatialReference,t,c,l)}_createTangentBuffer(e,t,r,o){const n=e.vertexAttributes.tangent;if(null==n)return null;let s=n;const a=1===o.reprojection?o.transformBeforeProject:null;a&&(s=Z(s,new Float32Array(s.length),a));const i=this._context.graphicsCoreOwner.view.viewingMode;if(0===o.reprojection)return s;if("local"===i){if(!W(this._context.renderCoordsHelper.spatialReference))return s;if(null==r)return null;if(e.spatialReference.isGeographic){const e=s===n?new Float32Array(s.length):s;return J(s,1,r,e)}if(e.spatialReference.isWebMercator){const e=s===n?new Float32Array(s.length):s;return Q(s,1,r,e)}return s}if(null==r)return null;const l=s===n?new Float32Array(s.length):s,c=this._context.renderCoordsHelper.spatialReference;return ee(s,r,e.spatialReference,t,c,l)}_createSymbolColorBuffer(e){return this._requiresSymbolVertexColors()?new Uint8Array(this._getDrivenUInt8ColorWithNaNSupport(e,this._materialColor,!0)):null}_createBuffers(e,t){const r=e.vertexAttributes&&e.vertexAttributes.position;if(!r)return this.logger.warn("Mesh geometry must contain position vertex attributes"),null;const o=e.vertexAttributes.normal,n=e.vertexAttributes.uv,s=e.vertexAttributes.tangent;if(o&&o.length!==r.length)return this.logger.warn("Mesh normal vertex buffer must contain the same number of elements as the position buffer"),null;if(s&&s.length/4!=r.length/3)return this.logger.warn("Mesh tangent vertex buffer must contain the same number of elements as the position buffer"),null;if(n&&n.length/2!=r.length/3)return this.logger.warn("Mesh uv vertex buffer must contain the same number of elements as the position buffer"),null;const a=this._computeReprojectionInfo(e),{position:i,georeferencedPositionBuffer:l}=this._createPositionBuffer(e,a),c=We(e),u=this._createSymbolColorBuffer(t),m=this._createNormalBuffer(e,i,l,a),p=this._createTangentBuffer(e,i,l,a),h=n,{transformation:d,position:g,normal:x,tangent:_}=this._passthroughReprojectionInfo(a)?{transformation:a.objectTransformation,position:i,normal:m,tangent:p}:this._transformOriginLocal(e,i,m,p);return{positionBuffer:g,normalBuffer:x,tangentBuffer:_,uvBuffer:h,colorBuffer:c,symbolColorBuffer:u,objectTransformation:d,geometryTransformation:0===a.reprojection&&a.geometryTransformation?a.geometryTransformation:f()}}_computeReprojectionInfo(e){const{vertexSpace:t}=e,r="georeferenced"===t.type?q(this._context.renderCoordsHelper.spatialReference,e.spatialReference)?0:1:0;if(z(t))return{reprojection:r};const o=t.origin,n=f(),s=e.transform?.localMatrix??p;if(0===r){B(e.spatialReference,o,n,this._context.renderCoordsHelper.spatialReference);return{reprojection:r,objectTransformation:n,geometryTransformation:h(s)}}const a=l(f(),o);return c(a,a,s),{reprojection:r,transformBeforeProject:a}}_transformOriginLocal(e,t,r,o){const n=this._context.renderCoordsHelper.spatialReference,s=e.origin;Je[0]=s.x,Je[1]=s.y,Je[2]=s.z??0;const a=f();B(e.spatialReference,Je,a,n),u(tt,a);const{position:i,normal:l,tangent:c}=e.vertexAttributes,m=t===i?new Float64Array(t.length):t;Y(m,t,tt);const p=r?r===l?new Float32Array(r.length):r:null,h=o?o===c?new Float32Array(o.length):o:null;return r&&p&&K(r,p,tt),o&&h&&Z(o,h,tt),{transformation:a,position:m,normal:p,tangent:h}}_validateFaces(e,t){const r=e.vertexAttributes.position.length/3,o=t.faces;if(o){let e=-1;for(let t=0;t<o.length;t++){const r=o[t];r>e&&(e=r)}if(r<=e)return this.logger.warn(`Vertex index ${e} is out of bounds of the mesh position buffer`),!1}else if(r%3!=0)return this.logger.warn("Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)"),!1;return!0}_isOutsideClippingArea(e){if(!this._context.clippingExtent)return!1;const t=e.vertexAttributes?.position;if(!t)return!1;const r=this._context.elevationProvider.spatialReference,o=te(e,r??e.spatialReference);return!!o&&(F(o,ot),!O(ot,this._context.clippingExtent))}_createGeometryInfo(e,t,r){if(!I(e.spatialReference,this._context.renderCoordsHelper.spatialReference))return this.logger.warn("Geometry spatial reference is not compatible with the view"),null;if(!this._validateVertexSpace(e))return null;if(this._isOutsideClippingArea(e))return null;const o=this._createBuffers(e,t);if(null==o)return null;const{positionBuffer:n,uvBuffer:s,colorBuffer:a,symbolColorBuffer:i,normalBuffer:l,tangentBuffer:c,objectTransformation:u,geometryTransformation:f}=o,p=e.components??nt,h=new Array;let d=!1;const g=m(Qe,u),x=this._context.localOriginFactory.getOrigin(g);for(const m of p){if(!this._validateFaces(e,m))return null;const t=Be(e,m);if(0===t.length)continue;const o=Ue(n,l,m,t);o.didFlipNormals&&(d=!0);const u=[["position",new Te(n,t,3,!0)],["normal",new Te(o.normals,o.indices,3,!0)]];a&&u.push(["color",new Te(a,t,4,!0)]),i&&u.push(["symbolColor",new Te(i,G(t.length),4,!0)]),s&&u.push(["uv0",new Te(s,t,2,!0)]),c&&u.push(["tangent",new Te(c,t,4,!0)]);const p=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:r,layerViewUid:this._context.layerViewUid}),g=this._getOrCreateMaterial(e,m),_=new be(g,u,null,0,p);_.transformation=f,_.localOrigin=x,h.push(_)}return d&&this.logger.warn("Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals."),{geometries:h,objectTransformation:u}}_updateMaterialParameters(e){this._materialInfoCache.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachClonedMaterial((e,t)=>{t.setParameters(e.parameters)})}_validateVertexSpace(e){const{_context:{graphicsCoreOwner:{view:{state:{viewingMode:t}}}}}=this,{vertexSpace:r}=e;return 2!==t||"local"!==r.type||(this.logger.warn("Displaying a mesh with a local vertex space in a view in local viewing mode is not supported."),!1)}test(){return{...super.test(),materials:this._materialInfoCache.materials}}get _materialColor(){return this.symbolLayer.material?.color}}class Ie{constructor(e,t,r){this.normals=e,this.indices=t,this.didFlipNormals=r}}function Be(e,t){return t.faces??D(e.vertexAttributes.position.length/3)}function Ue(e,t,r,o){switch(r.shading||"flat"){default:case"source":return Fe(e,t,r,o);case"flat":return Ee(e,o);case"smooth":return Oe(e,o)}}function Ee(e,t){const r=$(t.length),o=new Array(3*t.length);for(let n=0;n<t.length;n+=3){const s=$e(e,t,n,et);for(let e=0;e<3;e++)r[n+e]=s[e],o[n+e]=n/3}return new Ie(r,o,!1)}function Fe(e,t,r,o){if(null==t)return Ee(e,o);let n=!1;if(!r.trustSourceNormals)for(let s=0;s<o.length;s+=3){$e(e,o,s,et);for(let e=0;e<3;e++){const r=3*o[s+e];Qe[0]=t[r],Qe[1]=t[r+1],Qe[2]=t[r+2],M(et,Qe)<0&&(t[r]=-t[r],t[r+1]=-t[r+1],t[r+2]=-t[r+2],n=!0)}}return new Ie(t,o,n)}function Oe(e,t){const r={};for(let s=0;s<t.length;s+=3){const o=$e(e,t,s,et);for(let e=0;e<3;e++){const n=t[s+e];let a=r[n];a||(a={normal:P(),count:0},r[n]=a),x(a.normal,a.normal,o),a.count++}}const o=$(3*t.length),n=new Array(3*t.length);for(let s=0;s<t.length;s++){const e=r[t[s]];1!==e.count&&(b(e.normal,e.normal),e.count=1);for(let t=0;t<3;t++)o[3*s+t]=e.normal[t];n[s]=s}return new Ie(o,n,!1)}function Ve(e,t,r,o,n,s){const a=3*t[r],i=3*t[r+1],l=3*t[r+2];o[0]=e[a],o[1]=e[a+1],o[2]=e[a+2],n[0]=e[i],n[1]=e[i+1],n[2]=e[i+2],s[0]=e[l],s[1]=e[l+1],s[2]=e[l+2]}function $e(e,t,r,o){return Ve(e,t,r,Qe,Xe,Ze),w(Xe,Xe,Qe),w(Ze,Ze,Qe),C(Qe,Xe,Ze),b(o,Qe),o}function Ge(e){if(!e)return null;const{scale:t,offset:o,rotation:n}=e;return{scale:t,offset:o,rotation:r(n)}}function De(e="repeat"){if("string"==typeof e){const t=Le(e);return{s:t,t}}return{s:Le(e.horizontal),t:Le(e.vertical)}}function Le(e){switch(e){case"clamp":return 33071;case"mirror":return 33648;default:return 10497}}function Ne(e){const t=e.vertexAttributes.color;if(null==t)return!1;for(let r=3;r<t.length;r+=4)if(255!==t[r])return!0;return!1}function He(e,t,r){t.diffuse=e.toUnitRGB(),t.opacity="opaque"===r.alphaMode?1:e.a}function ke(e){return e.data??e.url}function ze(t){return null==t?"-":t instanceof e?t.toHex():t.contentHash}function qe(e){const{offset:t,scale:r,rotation:o}=e??Ke;return`${t[0]},${t[1]},${o},${r[0]},${r[1]}`}function We(e){return e.vertexAttributes.color}function Ye(e){return 1===(e.material?.color?.a??0)}const Ke=new H,Je=P(),Qe=P(),Xe=P(),Ze=P(),et=P(),tt=f(),rt=f(),ot=V(),nt=[new L],st=P();export{Se as Graphics3DMeshFillSymbolLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{destroyMaybe as t,removeMaybe as i}from"../../../../core/maybe.js";import{initial as s,watch as a,sync as r}from"../../../../core/reactiveUtils.js";import{subclass as l}from"../../../../core/accessorSupport/decorators.js";import{c}from"../../../../chunks/boundedPlane.js";import{Deconflictor as h,DeconflictorGraphic as n}from"./Deconflictor.js";import{LabelDeconflictor as o}from"./LabelDeconflictor.js";import{TaskPriority as d}from"../../../support/Scheduler.js";let p=class extends h{constructor(){super(...arguments),this._contexts=new Map,this.visibilityGroup=1,this._marginFactor=-.1,this.test={overrideMarginFactor:e=>{this._marginFactor=e,this.setDirty()},getNumVisibleLabels:()=>this._getNumVisible(16),getNumVisibleGraphics:()=>this._getNumVisible(1)}}get labels(){return this._labels}get viewState(){return this._viewState}initialize(){this._updatingHandles.add(()=>this.view?.state?.camera,()=>{this._updateViewState(),this.setDirty()}),this._updatingHandles.add(()=>this.view?.slice?.plane,()=>{this._updateSlicePlane(),this._slicePlaneChanged(),this.setDirty()},s),this.addHandles(a(()=>this.view.basemapTerrain?.updating||this.view.graphicsView?.updating||this.view.allLayerViews.some(e=>e.updating),(e,t)=>{!e&&t&&this.setDirty()},r)),this._frameTask=this.view.resourceController.scheduler.registerTask(d.GRAPHICS_DECONFLICTOR,this),this._labels=new o({view:this.view,parent:this})}destroy(){this._labels=t(this._labels),this._frameTask=i(this._frameTask)}get marginFactor(){return this._marginFactor}get usedMemory(){return super.usedMemory+this._labels.usedMemory}setDirty(){this._contexts.size>0&&(super.setDirty(),this._labels.setDirty())}runTask(e){const t=super.runTask(e);return this.readyToRun||this._labels.setDirty(),t}_updateViewState(){this.view?.state&&(this._viewState.camera.copyFrom(this.view.state.camera),this._updateSlicePlane())}_updateSlicePlane(){const e=this.view?.slice?.plane;null!=e&&c(e,this._viewState.slicePlane),this._viewState.slicePlaneEnabled=null!=e}_slicePlaneChanged(){for(const e of this._contexts.keys())if(e.symbolCreationContext.slicePlaneEnabled)return void this.setDirty()}addGraphicsOwner(e){const t=this._getGraphicsContext(e);return{addGraphic:i=>this._addGraphic(e,t,i),removeGraphic:e=>this._removeGraphic(t,e),labelingInfoChange:()=>this._labelsEnabledChanged(e,t),featureReductionChange:()=>this._enabledChanged(e,t),slicePlaneEnabledChange:()=>this._slicePlaneEnabledChanged(e,t),screenSizePerspectiveEnabledChanged:()=>this._screenSizePerspectiveEnabledChange(),clear:()=>t.forEach(e=>this._removeGraphic(t,e.graphics3DGraphic)),remove:()=>this._removeGraphicsOwner(e),setDirty:()=>this.setDirty(),getState:e=>this._getDeconflictorState(e),setState:(e,t)=>this._setDeconflictorState(e,t)}}_getDeconflictorState(e){return(e.getVisibilityFlag(1,8)?1:0)|(e.getVisibilityFlag(16,8)?16:0)}_setDeconflictorState(e,t){const i=!!(1&t),s=!!(16&t);e.setVisibilityFlag(1,8,i),e.setVisibilityFlag(16,8,s),this.setDirty()}_removeGraphicsOwner(e){const t=this._contexts.get(e);t&&(t.forEach(e=>this._removeGraphic(t,e.graphics3DGraphic)),this._contexts.delete(e),this.setDirty())}_addGraphic(e,t,i){const s=i.graphic.uid,a=new n(i,e.symbolCreationContext.slicePlaneEnabled);t.set(s,a),this.addToCheckOcclusion(a),_(e)&&this.addToActiveGraphics(a),e.labelsEnabled&&(this._labels.addToCheckOcclusion(a),this._labels.addToActiveGraphics(a));const r=this._initialVisibility(e,i);i.setVisibilityFlag(1,8,r)}_removeGraphic(e,t){const i=t.graphic.uid,s=e.get(i);s&&(this.removeFromActiveGraphics(s),this.removeFromCheckOcclusion(s),this._labels.removeFromActiveGraphics(s),this._labels.removeFromCheckOcclusion(s),e.delete(i),this.setDirty())}_enabledChanged(e,t){_(e)?t.forEach(e=>this.addToActiveGraphics(e)):t.forEach(e=>this.removeFromActiveGraphics(e)),this.setDirty()}_labelsEnabledChanged(e,t){e.labelsEnabled?(t.forEach(e=>this._labels.addToCheckOcclusion(e)),t.forEach(e=>this._labels.addToActiveGraphics(e))):(t.forEach(e=>this._labels.removeFromCheckOcclusion(e)),t.forEach(e=>this._labels.removeFromActiveGraphics(e)))}_slicePlaneEnabledChanged(e,t){const i=e.symbolCreationContext.slicePlaneEnabled;t.forEach(e=>e.slicePlaneEnabled=i),this.setDirty()}_screenSizePerspectiveEnabledChange(){this.setDirty()}_initialVisibility(e,t){if(t.isDraped)return!1;const i=t.layers;if(!i?.length)return!1;let s=!1,a=!1;for(const r of i)this.isSupportedLayer(r)&&(s=!0,a||=r.occlusionCheck);return!(a||s&&_(e))}_getGraphicsContext(e){const t=this._contexts.get(e);if(t)return t;const i=new Map;return this._contexts.set(e,i),this.setDirty(),i}};function _(e){const t=e.layer;return!("selection"!==t?.featureReduction?.type)}p=e([l("esri.views.3d.layers.graphics.GraphicsDeconflictor")],p);export{p as GraphicsDeconflictor};
2
+ import{__decorate as e}from"tslib";import{destroyMaybe as t,removeMaybe as i}from"../../../../core/maybe.js";import{initial as s,watch as a,sync as r}from"../../../../core/reactiveUtils.js";import{subclass as l}from"../../../../core/accessorSupport/decorators.js";import{g as c}from"../../../../chunks/boundedPlane.js";import{Deconflictor as h,DeconflictorGraphic as n}from"./Deconflictor.js";import{LabelDeconflictor as o}from"./LabelDeconflictor.js";import{TaskPriority as d}from"../../../support/Scheduler.js";let p=class extends h{constructor(){super(...arguments),this._contexts=new Map,this.visibilityGroup=1,this._marginFactor=-.1,this.test={overrideMarginFactor:e=>{this._marginFactor=e,this.setDirty()},getNumVisibleLabels:()=>this._getNumVisible(16),getNumVisibleGraphics:()=>this._getNumVisible(1)}}get labels(){return this._labels}get viewState(){return this._viewState}initialize(){this._updatingHandles.add(()=>this.view?.state?.camera,()=>{this._updateViewState(),this.setDirty()}),this._updatingHandles.add(()=>this.view?.slice?.plane,()=>{this._updateSlicePlane(),this._slicePlaneChanged(),this.setDirty()},s),this.addHandles(a(()=>this.view.basemapTerrain?.updating||this.view.graphicsView?.updating||this.view.allLayerViews.some(e=>e.updating),(e,t)=>{!e&&t&&this.setDirty()},r)),this._frameTask=this.view.resourceController.scheduler.registerTask(d.GRAPHICS_DECONFLICTOR,this),this._labels=new o({view:this.view,parent:this})}destroy(){this._labels=t(this._labels),this._frameTask=i(this._frameTask)}get marginFactor(){return this._marginFactor}get usedMemory(){return super.usedMemory+this._labels.usedMemory}setDirty(){this._contexts.size>0&&(super.setDirty(),this._labels.setDirty())}runTask(e){const t=super.runTask(e);return this.readyToRun||this._labels.setDirty(),t}_updateViewState(){this.view?.state&&(this._viewState.camera.copyFrom(this.view.state.camera),this._updateSlicePlane())}_updateSlicePlane(){const e=this.view?.slice?.plane;null!=e&&c(e,this._viewState.slicePlane),this._viewState.slicePlaneEnabled=null!=e}_slicePlaneChanged(){for(const e of this._contexts.keys())if(e.symbolCreationContext.slicePlaneEnabled)return void this.setDirty()}addGraphicsOwner(e){const t=this._getGraphicsContext(e);return{addGraphic:i=>this._addGraphic(e,t,i),removeGraphic:e=>this._removeGraphic(t,e),labelingInfoChange:()=>this._labelsEnabledChanged(e,t),featureReductionChange:()=>this._enabledChanged(e,t),slicePlaneEnabledChange:()=>this._slicePlaneEnabledChanged(e,t),screenSizePerspectiveEnabledChanged:()=>this._screenSizePerspectiveEnabledChange(),clear:()=>t.forEach(e=>this._removeGraphic(t,e.graphics3DGraphic)),remove:()=>this._removeGraphicsOwner(e),setDirty:()=>this.setDirty(),getState:e=>this._getDeconflictorState(e),setState:(e,t)=>this._setDeconflictorState(e,t)}}_getDeconflictorState(e){return(e.getVisibilityFlag(1,8)?1:0)|(e.getVisibilityFlag(16,8)?16:0)}_setDeconflictorState(e,t){const i=!!(1&t),s=!!(16&t);e.setVisibilityFlag(1,8,i),e.setVisibilityFlag(16,8,s),this.setDirty()}_removeGraphicsOwner(e){const t=this._contexts.get(e);t&&(t.forEach(e=>this._removeGraphic(t,e.graphics3DGraphic)),this._contexts.delete(e),this.setDirty())}_addGraphic(e,t,i){const s=i.graphic.uid,a=new n(i,e.symbolCreationContext.slicePlaneEnabled);t.set(s,a),this.addToCheckOcclusion(a),_(e)&&this.addToActiveGraphics(a),e.labelsEnabled&&(this._labels.addToCheckOcclusion(a),this._labels.addToActiveGraphics(a));const r=this._initialVisibility(e,i);i.setVisibilityFlag(1,8,r)}_removeGraphic(e,t){const i=t.graphic.uid,s=e.get(i);s&&(this.removeFromActiveGraphics(s),this.removeFromCheckOcclusion(s),this._labels.removeFromActiveGraphics(s),this._labels.removeFromCheckOcclusion(s),e.delete(i),this.setDirty())}_enabledChanged(e,t){_(e)?t.forEach(e=>this.addToActiveGraphics(e)):t.forEach(e=>this.removeFromActiveGraphics(e)),this.setDirty()}_labelsEnabledChanged(e,t){e.labelsEnabled?(t.forEach(e=>this._labels.addToCheckOcclusion(e)),t.forEach(e=>this._labels.addToActiveGraphics(e))):(t.forEach(e=>this._labels.removeFromCheckOcclusion(e)),t.forEach(e=>this._labels.removeFromActiveGraphics(e)))}_slicePlaneEnabledChanged(e,t){const i=e.symbolCreationContext.slicePlaneEnabled;t.forEach(e=>e.slicePlaneEnabled=i),this.setDirty()}_screenSizePerspectiveEnabledChange(){this.setDirty()}_initialVisibility(e,t){if(t.isDraped)return!1;const i=t.layers;if(!i?.length)return!1;let s=!1,a=!1;for(const r of i)this.isSupportedLayer(r)&&(s=!0,a||=r.occlusionCheck);return!(a||s&&_(e))}_getGraphicsContext(e){const t=this._contexts.get(e);if(t)return t;const i=new Map;return this._contexts.set(e,i),this.setDirty(),i}};function _(e){const t=e.layer;return!("selection"!==t?.featureReduction?.type)}p=e([l("esri.views.3d.layers.graphics.GraphicsDeconflictor")],p);export{p as GraphicsDeconflictor};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{delinearize as e,colorGamma as r}from"../../../../colorUtils.js";import{adjustStaticAGOUrl as t}from"../../../../core/devEnvironmentUtils.js";import{hasScaling as o}from"../../../../core/mathUtils.js";import{normalFromMat4 as s,fromMat4 as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as u}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{transformMat4 as c,subtract as m,divide as f,length as d,normalize as p,lerp as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as x}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as T,expandWithVec3 as b}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as h}from"../../../../geometry/support/FloatArray.js";import{BufferViewVec3f as y,BufferViewVec4f as v,BufferViewVec4u8 as w,BufferViewVec4u16 as R,BufferViewVec3u8 as S,BufferViewVec3u16 as B}from"../../../../geometry/support/buffer/BufferView.js";import{t as j,b as M,n as F,f as E}from"../../../../chunks/vec3.js";import{t as A,b as C}from"../../../../chunks/vec4.js";import{a as I}from"../../../../chunks/vec2.js";import{DefaultLoadingContext as L}from"../../glTF/DefaultLoadingContext.js";import{convertPrimitiveToTriangles as P}from"../../glTF/internal/indexUtils.js";import{isEncodedMeshTexture as U}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as O}from"../../glTF/internal/TextureTransformUtils.js";import{ProcessedObjectResource as k}from"./ProcessedObjectResource.js";import{load as V,processLoadResult as _}from"./wosrLoader.js";import{Attribute as H}from"../../webgl-engine/lib/Attribute.js";import{Geometry as D}from"../../webgl-engine/lib/Geometry.js";import{ManagedTexture as K}from"../../webgl-engine/lib/ManagedTexture.js";import{DefaultMaterial as G}from"../../webgl-engine/materials/DefaultMaterial.js";import{useSchematicPBR as W,schematicMRRFactors as N,esriSymbologyMRRFactors as Q,advancedMRRFactors as $}from"../../webgl-engine/materials/pbrUtils.js";async function z(e,r){const o=q(t(e));if("wosr"===o.fileType){const e=await(r.cache?r.cache.loadWOSR(o.url,r):V(o.url,r)),{engineResources:t,referenceBoundingBox:s}=_(e,r);return{lods:t,referenceBoundingBox:s,isEsriSymbolResource:!1,isWosr:!0}}let s;if(r.cache)s=await r.cache.loadGLTF(o.url,r,!!r.usePBR,!!r.useEmissive);else{const{loadGLTF:e}=await import("../../glTF/loader.js");s=await e(new L,o.url,r,r.usePBR,r.useEmissive)}const{engineResources:i,referenceBoundingBox:n}=J(s,r,o.specifiedLodIndex);return{lods:i,referenceBoundingBox:n,isEsriSymbolResource:s.meta.isEsriSymbolResource,isWosr:!1}}function q(e){const r=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);if(r)return{fileType:"gltf",url:r[1],specifiedLodIndex:null!=r[4]?Number(r[4]):null};return e.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:e,specifiedLodIndex:null}:{fileType:"unknown",url:e,specifiedLodIndex:null}}function J(e,r,t){const o=e.model,s=e.meta,i=o.meta?.ESRI_proxyEllipsoid,n=s.isEsriSymbolResource&&null!=i&&"EsriRealisticTreesStyle"===s.ESRI_webstyle;n&&!e.customMeta.esriTreeRendering&&(e.customMeta.esriTreeRendering=!0,re(e,i));const l=!!r.usePBR,a=s.isEsriSymbolResource?{usePBR:l,isSchematic:!1,treeRendering:n,mrrFactors:Q}:{usePBR:l,isSchematic:!1,treeRendering:!1,mrrFactors:$},u={...r.materialParameters,treeRendering:n},c=new Array,m=new Map,f=new Map,d=o.lods.length,p=T();return o.lods.forEach((e,s)=>{const i=!0===r.skipHighLods&&(d>1&&0===s||d>3&&1===s)||!1===r.skipHighLods&&null!=t&&s!==t;if(i&&0!==s)return;const l=new k(e.name,e.lodThreshold,[0,0,0]);e.parts.forEach(e=>{const t=i?new G({},r):X(o,e,l,a,u,m,f,r,n),{geometry:c,vertexCount:d}=Y(e,t??new G({},r)),g=c.boundingInfo;null!=g&&0===s&&(b(p,g.bbMin),b(p,g.bbMax)),null!=t&&(l.stageResources.geometries.push(c),l.numberOfVertices+=d)}),i||c.push(l)}),{engineResources:c,referenceBoundingBox:p}}function X(r,t,o,s,i,n,l,a,c){const m=r.materials.get(t.material);if(null==m)return null;const{normal:f,color:d,texCoord0:p,tangent:g}=t.attributes,x=t.material+(f?"_normal":"")+(d?"_color":"")+(p?"_texCoord0":"")+(g?"_tangent":""),T=null!=t.attributes.texCoord0,b=null!=t.attributes.normal,h=ee(m.alphaMode);if(!n.has(x)){if(T){const e=(e,t=!1,o=!1)=>{if(null!=e&&!l.has(e)){const s=r.textures.get(e);if(s){const r=s.data,i=t&&!U(r)?a.compressionOptions:void 0;l.set(e,new K(U(r)?r.data:r,{...s.parameters,preMultiplyAlpha:!U(r)&&o,encoding:U(r)?r.encoding:void 0,compressionOptions:i}))}}},t=1!==h&&!c;e(m.colorTexture,t,1!==h),e(m.normalTexture),e(m.occlusionTexture,!0),e(m.emissiveTexture),e(m.metallicRoughnessTexture,!0)}const o=e(m.color[0]),f=e(m.color[1]),d=e(m.color[2]),p=null!=m.colorTexture&&T?l.get(m.colorTexture):null,g=W(m),y=null!=m.normalTextureTransform?.scale?m.normalTextureTransform?.scale:u;n.set(x,new G({...s,customDepthTest:1,textureAlphaMode:h,textureAlphaCutoff:m.alphaCutoff,diffuse:[o,f,d],ambient:[o,f,d],opacity:"OPAQUE"===m.alphaMode?1:m.opacity,doubleSided:m.doubleSided,doubleSidedType:"winding-order",cullFace:m.doubleSided?0:2,hasVertexColors:!!t.attributes.color,hasVertexTangents:!!t.attributes.tangent,normalType:b?0:2,castShadows:!0,receiveShadows:m.receiveShadows,receiveAmbientOcclusion:m.receiveAmbientOcclusion,textureId:null!=p?p.id:void 0,colorMixMode:m.colorMixMode,normalTextureId:null!=m.normalTexture&&T?l.get(m.normalTexture).id:void 0,textureAlphaPremultiplied:null!=p&&!!p.parameters.preMultiplyAlpha,occlusionTextureId:null!=m.occlusionTexture&&T?l.get(m.occlusionTexture).id:void 0,emissiveTextureId:null!=m.emissiveTexture&&T?l.get(m.emissiveTexture).id:void 0,metallicRoughnessTextureId:null!=m.metallicRoughnessTexture&&T?l.get(m.metallicRoughnessTexture).id:void 0,emissiveBaseColor:[m.emissiveFactor[0],m.emissiveFactor[1],m.emissiveFactor[2]],emissiveStrengthKHR:null!=m.emissiveStrengthKHR?m.emissiveStrengthKHR:1,emissiveStrengthFromSymbol:null!=i.emissiveStrengthFromSymbol?i.emissiveStrengthFromSymbol:void 0,mrrFactors:g?N:[m.metallicFactor,m.roughnessFactor,s.mrrFactors[2]],isSchematic:g,colorTextureTransformMatrix:O(m.colorTextureTransform),normalTextureTransformMatrix:O(m.normalTextureTransform),scale:[y[0],y[1]],occlusionTextureTransformMatrix:O(m.occlusionTextureTransform),emissiveTextureTransformMatrix:O(m.emissiveTextureTransform),metallicRoughnessTextureTransformMatrix:O(m.metallicRoughnessTextureTransform),...i},a))}const y=n.get(x);if(o.stageResources.materials.push(y),T){const e=e=>{null!=e&&o.stageResources.textures.push(l.get(e))};e(m.colorTexture),e(m.normalTexture),e(m.occlusionTexture),e(m.emissiveTexture),e(m.metallicRoughnessTexture)}return y}function Y(e,r){const t=e.attributes.position.count,n=P(e.indices||t,e.primitiveType),l=h(3*t),{typedBuffer:a,typedBufferStride:u}=e.attributes.position;j(l,a,e.transform,3,u);const c=[["position",new H(l,n,3,!0)]];if(null!=e.attributes.normal){const r=h(3*t),{typedBuffer:i,typedBufferStride:l}=e.attributes.normal;s(Z,e.transform),M(r,i,Z,3,l),o(Z)&&F(r,r),c.push(["normal",new H(r,n,3,!0)])}if(null!=e.attributes.tangent){const r=h(4*t),{typedBuffer:s,typedBufferStride:l}=e.attributes.tangent;i(Z,e.transform),A(r,s,Z,4,l),o(Z)&&F(r,r,4),c.push(["tangent",new H(r,n,4,!0)])}if(null!=e.attributes.texCoord0){const r=h(2*t),{typedBuffer:o,typedBufferStride:s}=e.attributes.texCoord0;I(r,o,2,s),c.push(["uv0",new H(r,n,2,!0)])}const m=e.attributes.color;if(null!=m){const r=new Uint8Array(4*t);4===m.elementCount?m instanceof v?C(r,m,1,255):(m instanceof w||m instanceof R)&&C(r,m,1/255,255):(r.fill(255),m instanceof y?E(r,m.typedBuffer,1,255,4,m.typedBufferStride):(e.attributes.color instanceof S||e.attributes.color instanceof B)&&E(r,m.typedBuffer,1/255,255,4,e.attributes.color.typedBufferStride)),c.push(["color",new H(r,n,4,!0)])}return{geometry:new D(r,c),vertexCount:t}}const Z=n();function ee(e){switch(e){case"BLEND":return 0;case"MASK":return 2;case"OPAQUE":case null:case void 0:return 1}}function re(e,t){for(let o=0;o<e.model.lods.length;++o){const s=e.model.lods[o];for(const i of s.parts){const s=i.attributes.normal;if(null==s)return;const n=i.attributes.position,u=n.count,T=x(),b=x(),h=x(),w=new Float32Array(4*u),R=new Float32Array(3*u),S=l(a(),i.transform);let B=0,j=0;for(let l=0;l<u;l++){n.getVec(l,b),s.getVec(l,T),c(b,b,i.transform),m(h,b,t.center),f(h,h,t.radius);const a=h[2],u=d(h),x=Math.min(.45+.55*u*u,1)**r;f(h,h,t.radius),null!==S&&c(h,h,S),p(h,h),o+1!==e.model.lods.length&&e.model.lods.length>1&&g(h,h,T,a>-1?.2:Math.min(-4*a-3.8,1)),R[B]=h[0],R[B+1]=h[1],R[B+2]=h[2],B+=3,w[j]=x,w[j+1]=x,w[j+2]=x,w[j+3]=1,j+=4}i.attributes.normal=new y(R.buffer),i.attributes.color=new v(w.buffer)}}}export{z as fetch,q as parseUrl};
2
+ import{delinearize as e,colorGamma as r}from"../../../../colorUtils.js";import{adjustStaticAGOUrl as t}from"../../../../core/devEnvironmentUtils.js";import{hasScaling as o}from"../../../../core/mathUtils.js";import{normalFromMat4 as s,fromMat4 as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as u}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{transformMat4 as c,subtract as m,divide as f,length as d,normalize as p,lerp as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as x}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as T,expandWithVec3 as h}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as b}from"../../../../geometry/support/FloatArray.js";import{BufferViewVec3f as y,BufferViewVec4f as v,BufferViewVec4u8 as w,BufferViewVec4u16 as R,BufferViewVec3u8 as S,BufferViewVec3u16 as B}from"../../../../geometry/support/buffer/BufferView.js";import{f as j,t as M,n as F,l as E}from"../../../../chunks/vec3.js";import{t as A,l as C}from"../../../../chunks/vec4.js";import{n as I}from"../../../../chunks/vec2.js";import{DefaultLoadingContext as L}from"../../glTF/DefaultLoadingContext.js";import{convertPrimitiveToTriangles as P}from"../../glTF/internal/indexUtils.js";import{isEncodedMeshTexture as U}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as O}from"../../glTF/internal/TextureTransformUtils.js";import{ProcessedObjectResource as k}from"./ProcessedObjectResource.js";import{load as V,processLoadResult as _}from"./wosrLoader.js";import{Attribute as H}from"../../webgl-engine/lib/Attribute.js";import{Geometry as D}from"../../webgl-engine/lib/Geometry.js";import{ManagedTexture as K}from"../../webgl-engine/lib/ManagedTexture.js";import{DefaultMaterial as G}from"../../webgl-engine/materials/DefaultMaterial.js";import{useSchematicPBR as W,schematicMRRFactors as N,esriSymbologyMRRFactors as Q,advancedMRRFactors as $}from"../../webgl-engine/materials/pbrUtils.js";async function z(e,r){const o=q(t(e));if("wosr"===o.fileType){const e=await(r.cache?r.cache.loadWOSR(o.url,r):V(o.url,r)),{engineResources:t,referenceBoundingBox:s}=_(e,r);return{lods:t,referenceBoundingBox:s,isEsriSymbolResource:!1,isWosr:!0}}let s;if(r.cache)s=await r.cache.loadGLTF(o.url,r,!!r.usePBR,!!r.useEmissive);else{const{loadGLTF:e}=await import("../../glTF/loader.js");s=await e(new L,o.url,r,r.usePBR,r.useEmissive)}const{engineResources:i,referenceBoundingBox:n}=J(s,r,o.specifiedLodIndex);return{lods:i,referenceBoundingBox:n,isEsriSymbolResource:s.meta.isEsriSymbolResource,isWosr:!1}}function q(e){const r=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);if(r)return{fileType:"gltf",url:r[1],specifiedLodIndex:null!=r[4]?Number(r[4]):null};return e.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:e,specifiedLodIndex:null}:{fileType:"unknown",url:e,specifiedLodIndex:null}}function J(e,r,t){const o=e.model,s=e.meta,i=o.meta?.ESRI_proxyEllipsoid,n=s.isEsriSymbolResource&&null!=i&&"EsriRealisticTreesStyle"===s.ESRI_webstyle;n&&!e.customMeta.esriTreeRendering&&(e.customMeta.esriTreeRendering=!0,re(e,i));const l=!!r.usePBR,a=s.isEsriSymbolResource?{usePBR:l,isSchematic:!1,treeRendering:n,mrrFactors:Q}:{usePBR:l,isSchematic:!1,treeRendering:!1,mrrFactors:$},u={...r.materialParameters,treeRendering:n},c=new Array,m=new Map,f=new Map,d=o.lods.length,p=T();return o.lods.forEach((e,s)=>{const i=!0===r.skipHighLods&&(d>1&&0===s||d>3&&1===s)||!1===r.skipHighLods&&null!=t&&s!==t;if(i&&0!==s)return;const l=new k(e.name,e.lodThreshold,[0,0,0]);e.parts.forEach(e=>{const t=i?new G({},r):X(o,e,l,a,u,m,f,r,n),{geometry:c,vertexCount:d}=Y(e,t??new G({},r)),g=c.boundingInfo;null!=g&&0===s&&(h(p,g.bbMin),h(p,g.bbMax)),null!=t&&(l.stageResources.geometries.push(c),l.numberOfVertices+=d)}),i||c.push(l)}),{engineResources:c,referenceBoundingBox:p}}function X(r,t,o,s,i,n,l,a,c){const m=r.materials.get(t.material);if(null==m)return null;const{normal:f,color:d,texCoord0:p,tangent:g}=t.attributes,x=t.material+(f?"_normal":"")+(d?"_color":"")+(p?"_texCoord0":"")+(g?"_tangent":""),T=null!=t.attributes.texCoord0,h=null!=t.attributes.normal,b=ee(m.alphaMode);if(!n.has(x)){if(T){const e=(e,t=!1,o=!1)=>{if(null!=e&&!l.has(e)){const s=r.textures.get(e);if(s){const r=s.data,i=t&&!U(r)?a.compressionOptions:void 0;l.set(e,new K(U(r)?r.data:r,{...s.parameters,preMultiplyAlpha:!U(r)&&o,encoding:U(r)?r.encoding:void 0,compressionOptions:i}))}}},t=1!==b&&!c;e(m.colorTexture,t,1!==b),e(m.normalTexture),e(m.occlusionTexture,!0),e(m.emissiveTexture),e(m.metallicRoughnessTexture,!0)}const o=e(m.color[0]),f=e(m.color[1]),d=e(m.color[2]),p=null!=m.colorTexture&&T?l.get(m.colorTexture):null,g=W(m),y=null!=m.normalTextureTransform?.scale?m.normalTextureTransform?.scale:u;n.set(x,new G({...s,customDepthTest:1,textureAlphaMode:b,textureAlphaCutoff:m.alphaCutoff,diffuse:[o,f,d],ambient:[o,f,d],opacity:"OPAQUE"===m.alphaMode?1:m.opacity,doubleSided:m.doubleSided,doubleSidedType:"winding-order",cullFace:m.doubleSided?0:2,hasVertexColors:!!t.attributes.color,hasVertexTangents:!!t.attributes.tangent,normalType:h?0:2,castShadows:!0,receiveShadows:m.receiveShadows,receiveAmbientOcclusion:m.receiveAmbientOcclusion,textureId:null!=p?p.id:void 0,colorMixMode:m.colorMixMode,normalTextureId:null!=m.normalTexture&&T?l.get(m.normalTexture).id:void 0,textureAlphaPremultiplied:null!=p&&!!p.parameters.preMultiplyAlpha,occlusionTextureId:null!=m.occlusionTexture&&T?l.get(m.occlusionTexture).id:void 0,emissiveTextureId:null!=m.emissiveTexture&&T?l.get(m.emissiveTexture).id:void 0,metallicRoughnessTextureId:null!=m.metallicRoughnessTexture&&T?l.get(m.metallicRoughnessTexture).id:void 0,emissiveBaseColor:[m.emissiveFactor[0],m.emissiveFactor[1],m.emissiveFactor[2]],emissiveStrengthKHR:null!=m.emissiveStrengthKHR?m.emissiveStrengthKHR:1,emissiveStrengthFromSymbol:null!=i.emissiveStrengthFromSymbol?i.emissiveStrengthFromSymbol:void 0,mrrFactors:g?N:[m.metallicFactor,m.roughnessFactor,s.mrrFactors[2]],isSchematic:g,colorTextureTransformMatrix:O(m.colorTextureTransform),normalTextureTransformMatrix:O(m.normalTextureTransform),scale:[y[0],y[1]],occlusionTextureTransformMatrix:O(m.occlusionTextureTransform),emissiveTextureTransformMatrix:O(m.emissiveTextureTransform),metallicRoughnessTextureTransformMatrix:O(m.metallicRoughnessTextureTransform),...i},a))}const y=n.get(x);if(o.stageResources.materials.push(y),T){const e=e=>{null!=e&&o.stageResources.textures.push(l.get(e))};e(m.colorTexture),e(m.normalTexture),e(m.occlusionTexture),e(m.emissiveTexture),e(m.metallicRoughnessTexture)}return y}function Y(e,r){const t=e.attributes.position.count,n=P(e.indices||t,e.primitiveType),l=b(3*t),{typedBuffer:a,typedBufferStride:u}=e.attributes.position;j(l,a,e.transform,3,u);const c=[["position",new H(l,n,3,!0)]];if(null!=e.attributes.normal){const r=b(3*t),{typedBuffer:i,typedBufferStride:l}=e.attributes.normal;s(Z,e.transform),M(r,i,Z,3,l),o(Z)&&F(r,r),c.push(["normal",new H(r,n,3,!0)])}if(null!=e.attributes.tangent){const r=b(4*t),{typedBuffer:s,typedBufferStride:l}=e.attributes.tangent;i(Z,e.transform),A(r,s,Z,4,l),o(Z)&&F(r,r,4),c.push(["tangent",new H(r,n,4,!0)])}if(null!=e.attributes.texCoord0){const r=b(2*t),{typedBuffer:o,typedBufferStride:s}=e.attributes.texCoord0;I(r,o,2,s),c.push(["uv0",new H(r,n,2,!0)])}const m=e.attributes.color;if(null!=m){const r=new Uint8Array(4*t);4===m.elementCount?m instanceof v?C(r,m,1,255):(m instanceof w||m instanceof R)&&C(r,m,1/255,255):(r.fill(255),m instanceof y?E(r,m.typedBuffer,1,255,4,m.typedBufferStride):(e.attributes.color instanceof S||e.attributes.color instanceof B)&&E(r,m.typedBuffer,1/255,255,4,e.attributes.color.typedBufferStride)),c.push(["color",new H(r,n,4,!0)])}return{geometry:new D(r,c),vertexCount:t}}const Z=n();function ee(e){switch(e){case"BLEND":return 0;case"MASK":return 2;case"OPAQUE":case null:case void 0:return 1}}function re(e,t){for(let o=0;o<e.model.lods.length;++o){const s=e.model.lods[o];for(const i of s.parts){const s=i.attributes.normal;if(null==s)return;const n=i.attributes.position,u=n.count,T=x(),h=x(),b=x(),w=new Float32Array(4*u),R=new Float32Array(3*u),S=l(a(),i.transform);let B=0,j=0;for(let l=0;l<u;l++){n.getVec(l,h),s.getVec(l,T),c(h,h,i.transform),m(b,h,t.center),f(b,b,t.radius);const a=b[2],u=d(b),x=Math.min(.45+.55*u*u,1)**r;f(b,b,t.radius),null!==S&&c(b,b,S),p(b,b),o+1!==e.model.lods.length&&e.model.lods.length>1&&g(b,b,T,a>-1?.2:Math.min(-4*a-3.8,1)),R[B]=b[0],R[B+1]=b[1],R[B+2]=b[2],B+=3,w[j]=x,w[j+1]=x,w[j+2]=x,w[j+3]=1,j+=4}i.attributes.normal=new y(R.buffer),i.attributes.color=new v(w.buffer)}}}export{z as fetch,q as parseUrl};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{disposeMaybe as s}from"../../../../core/maybe.js";import t from"../../../../core/PooledArray.js";import{property as i,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{subtract as n,length as o,scale as a,negate as h,dot as l,squaredLength as d}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as u}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{create as g,offset as p,contains as m,containsPoint as _,set as f,positiveInfinity as P,equals as x}from"../../../../geometry/support/aaBoundingBox.js";import{create as b}from"../../../../geometry/support/plane.js";import{fromPoints as S}from"../../../../geometry/support/ray.js";import{Sphere as R}from"../../../../geometry/support/sphere.js";import{PclTarget as w}from"./Intersector.js";import{PointCloudHighlights as z}from"./PointCloudHighlights.js";import{isColor as y,isHighlight as v,isDepth as j}from"../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as q}from"../../webgl-engine/effects/RenderPlugin.js";import{IntersectorResult as H}from"../../webgl-engine/lib/IntersectorResult.js";import{VertexArrayObject as O}from"../../webgl-engine/lib/VertexArrayObject.js";import{P as A,g as E}from"../../../../chunks/PointRenderer.glsl.js";import{PointRendererTechnique as F,positionsLayout as I,colorsLayout as B}from"../../webgl-engine/shaders/PointRendererTechnique.js";import{PointRendererTechniqueConfiguration as M}from"../../webgl-engine/shaders/PointRendererTechniqueConfiguration.js";import{PrimitiveType as N}from"../../../webgl/enums.js";import{VertexBuffer as V}from"../../../webgl/VertexBuffer.js";let T=class extends q{constructor(e){super(e),this.type=6,this.isGround=!1,this._passParameters=new A,this._highlights=new z({forEachNode:e=>this.forEachNode(e),addHighlights:(e,s,t)=>this._addHighlights(e,s,t),removeHighlight:(e,s)=>this._removeHighlight(e,s)}),this.produces=new Map([[2,e=>y(e)||v(e)&&!this._highlights.empty],[3,e=>j(e)]]),this.point=c(),this.intersectionRayDir=c(),this.intersectionPlane=b(),this.nodeOriginOffset=c(),this.nodeBoundingBox=g(),this.layerViewUid="",this._slicePlaneEnabled=!1,this._configuration=new M,this._nodes=new t,this._highlightsInOrder=null}destroy(){this._nodes.prune()}hasHighlight(e){return this._highlights.has(e)}initializeRenderContext(e){this._context=e,e.requestRender()}uninitializeRenderContext(){}intersect(e,s,t,i){const{point:r,intersectionRayDir:f,nodeOriginOffset:P,intersectionPlane:x,layerViewUid:b,nodeBoundingBox:z}=this,y=S(t,i),v=e.camera.perScreenPixelRatio/2,j=e.camera.near;n(f,i,t);const q=1/o(f);a(f,f,q);const O=c();h(O,f),u(x,f[0],f[1],f[2],-l(f,t));const A=new D,E=new D,F=new Array,I=g(this._passParameters.clipBox);p(I,-t[0],-t[1],-t[2],I),this._nodes.forAll(o=>{const{isLeaf:a,coordinates:h}=o,c=o.splatSize*this._passParameters.scaleFactor;let{min:u,max:g}=o.obb.signedDistanceRangePlane(x);u-=U(c,u+j,this._passParameters,v,a),g-=U(c,g+j,this._passParameters,v,a);const S=g<0,w=null!=A.dist&&null!=E.dist&&A.dist<u*q&&E.dist>g*q;if(S||w)return;const H=C(c,g+j,this._passParameters,v,a);if(!new R(o.obb.center,o.obb.radius+H).intersectRay(y))return;if(!o.obb.intersectRay(t,f,H))return;const B=H*H;o.obb.toAaBoundingBox(z),p(z,-t[0],-t[1],-t[2],z);const M=!m(I,z);n(P,o.origin,t);const N=h.length/3;for(let n=0;n<N;n++){const u=3*n;if(r[0]=P[0]+h[u],r[1]=P[1]+h[u+1],r[2]=P[2]+h[u+2],M&&!_(I,r))continue;const g=l(r,f),p=g*g,m=d(r)-p;if(m>B)continue;let x=g+j;const S=U(c,x,this._passParameters,v,a);if(g-S<0)continue;x-=S;const R=C(c,x,this._passParameters,v,a);if(m>R*R)continue;const w=(g-S)*q,z=e=>(e.point=e.point?W(o,n,e.point):W(o,n),e.dist=w,e.normal=O,e.node=o,e.pointId=n,e.layerViewUid=b,e);if((null==A.dist||w<A.dist)&&(null==s||s(t,i,w))&&z(A),0!==e.options.store&&(null==E.dist||w>E.dist)&&(null==s||s(t,i,w))&&z(E),2===e.options.store&&(null==s||s(t,i,w))){const e=new D;F.push(z(e))}}});const B=e=>{const{layerViewUid:s,node:t,pointId:i}=e;return new w(e.point,s,i,()=>this.createGraphic(t,i,e.point))},M=(e,s)=>{const t=B(s);e.set(this.type,t,s.dist,s.normal)};if(G(A)){const s=e.results.min;(null==s.distance||A.dist<s.distance)&&M(s,A)}if(G(E)&&0!==e.options.store){const s=e.results.max;(null==s.distance||E.dist>s.distance)&&M(s,E)}if(2===e.options.store)for(const n of F){const s=new H(y);M(s,n),e.results.all.push(s)}}acquireTechniques(e){const s=10===e.output;return 0!==this._nodes.length&&(y(e.output)||j(e.output)&&3===e.bind.slot||s)?(this._nodes.forAll(s=>this._initNode(e,s)),this._configuration.drawScreenSize=this._passParameters.drawScreenSpace,this._configuration.useFixedSizes=this._passParameters.useFixedSizes,this._configuration.hasSlicePlane=this._slicePlaneEnabled,this._configuration.hasOccludees=e.bind.hasOccludees,this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.hasHighlightMixTexture=s&&null!=e.bind.highlightMixTexture,this._configuration.output=e.output,this._configuration.hasEmission=e.bind.hasEmission&&y(e.output),this._context.techniques.get(F,this._configuration)):null}render(e,s){const{rctx:t,bind:i,output:r}=e,n=t.bindTechnique(s,i,this._passParameters),o=10===r,a=i.highlight?.name??null;o&&!a||(o&&i.highlights!==this._highlightsInOrder&&this._updateResolvedHighlights(i.highlights),this._nodes.forAll(s=>{const r=o?s.resolvedHighlightRanges.get(a):null;0===s.coordinates.length||null==s.vao||o&&null==r||(n.assertCompatibleVertexAttributeLocations(s.vao),n.bindDraw(i,this._passParameters,s),t.bindVAO(s.vao),o?this._renderHighlightFragments(e,r):t.drawArrays(N.POINTS,0,s.coordinates.length/3))}))}_renderHighlightFragments(e,s){const{rctx:t}=e;for(let i=0;i<s.length;i+=2)t.drawArrays(N.POINTS,s[i],s[i+1])}set useFixedSizes(e){this._passParameters.useFixedSizes!==e&&(this._passParameters.useFixedSizes=e,this._requestRender())}get useFixedSizes(){return this._passParameters.useFixedSizes}set scaleFactor(e){this._passParameters.scaleFactor!==e&&(this._passParameters.scaleFactor=e,this._requestRender())}get scaleFactor(){return this._passParameters.scaleFactor}set minSizePx(e){this._passParameters.minSizePx!==e&&(this._passParameters.minSizePx=e,this._requestRender())}get minSizePx(){return this._passParameters.minSizePx}set useRealWorldSymbolSizes(e){this._passParameters.useRealWorldSymbolSizes!==e&&(this._passParameters.useRealWorldSymbolSizes=e,this._requestRender())}get useRealWorldSymbolSizes(){return this._passParameters.useRealWorldSymbolSizes}set size(e){this._passParameters.size!==e&&(this._passParameters.size=e,this._requestRender())}get size(){return this._passParameters.size}set sizePx(e){this._passParameters.sizePx!==e&&(this._passParameters.sizePx=e,this._requestRender())}get sizePx(){return this._passParameters.sizePx}set clippingBox(e){f(this._passParameters.clipBox,e||P)}get _clippingEnabled(){return!x(this._passParameters.clipBox,P,(e,s)=>e===s)}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this._requestRender())}addNode(e){this._nodes.push(e),e.clearHighlights(),this._highlights.nodeAdded(e),this._requestRender()}removeNode(e){let t=null;return this._nodes.filterInPlace(i=>i.id!==e||(t=i,i.vao=s(i.vao),this._highlights.nodeRemoved(i),!1)),this._requestRender(),t}forEachNode(e){this._nodes.forEach(e)}removeAll(){this._nodes.forAll(e=>e.vao=s(e.vao)),this._highlights.removeAll(),this._nodes.clear(),this._requestRender()}highlight(e,s){return this._highlights.add(e,s)}_addHighlights(e,s,t){for(const i of s)e.addHighlight(i,t);this._highlightsInOrder&&e.updateResolvedHighlights(this._highlightsInOrder),this._requestRender()}_removeHighlight(e,s){e.removeHighlight(s),this._highlightsInOrder&&e.updateResolvedHighlights(this._highlightsInOrder),this._requestRender()}_initNode(e,s){s.vao??=new O(e.rctx,new Map([["positions",new V(e.rctx,I,s.coordinates)],["colors",new V(e.rctx,B,s.rgb)]]))}_requestRender(){this._context&&this._context.requestRender()}_updateResolvedHighlights(e){this._highlightsInOrder=e,this._nodes.forAll(s=>s.updateResolvedHighlights(e))}};function C(e,s,t,i,r){if(t.drawScreenSpace)return t.fixedSize*s*i;const n=E(r)*s*i;return t.useFixedSizes?Math.min(t.fixedSize/2,n):t.screenMinSize>0?Math.min(Math.max(t.screenMinSize*s*i,e/2),n):Math.min(e/2,n)}function U(e,s,t,i,r){return t.drawScreenSpace?0:C(e,s,t,i,r)}function W(e,s,t=c()){return t[0]=e.origin[0]+e.coordinates[3*s],t[1]=e.origin[1]+e.coordinates[3*s+1],t[2]=e.origin[2]+e.coordinates[3*s+2],t}e([i({constructOnly:!0})],T.prototype,"createGraphic",void 0),T=e([r("esri.views.3d.layers.i3s.PointCloudRenderer")],T);class D{constructor(){this.node=null,this.pointId=null,this.point=null,this.dist=null,this.normal=null,this.layerViewUid=""}}function G(e){return null!=e.dist&&null!=e.point&&null!=e.pointId&&null!=e.node}export{T as PointCloudRenderer};
2
+ import{__decorate as e}from"tslib";import{disposeMaybe as s}from"../../../../core/maybe.js";import t from"../../../../core/PooledArray.js";import{property as i,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{subtract as n,length as o,scale as a,negate as h,dot as l,squaredLength as d}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as u}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{create as g,offset as p,contains as m,containsPoint as _,set as f,positiveInfinity as P,equals as x}from"../../../../geometry/support/aaBoundingBox.js";import{create as b}from"../../../../geometry/support/plane.js";import{fromPoints as S}from"../../../../geometry/support/ray.js";import{Sphere as R}from"../../../../geometry/support/sphere.js";import{PclTarget as w}from"./Intersector.js";import{PointCloudHighlights as z}from"./PointCloudHighlights.js";import{isColor as y,isHighlight as v,isDepth as j}from"../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as q}from"../../webgl-engine/effects/RenderPlugin.js";import{IntersectorResult as H}from"../../webgl-engine/lib/IntersectorResult.js";import{VertexArrayObject as O}from"../../webgl-engine/lib/VertexArrayObject.js";import{b as A,g as E}from"../../../../chunks/PointRenderer.glsl.js";import{PointRendererTechnique as F,positionsLayout as I,colorsLayout as B}from"../../webgl-engine/shaders/PointRendererTechnique.js";import{PointRendererTechniqueConfiguration as M}from"../../webgl-engine/shaders/PointRendererTechniqueConfiguration.js";import{PrimitiveType as N}from"../../../webgl/enums.js";import{VertexBuffer as V}from"../../../webgl/VertexBuffer.js";let T=class extends q{constructor(e){super(e),this.type=6,this.isGround=!1,this._passParameters=new A,this._highlights=new z({forEachNode:e=>this.forEachNode(e),addHighlights:(e,s,t)=>this._addHighlights(e,s,t),removeHighlight:(e,s)=>this._removeHighlight(e,s)}),this.produces=new Map([[2,e=>y(e)||v(e)&&!this._highlights.empty],[3,e=>j(e)]]),this.point=c(),this.intersectionRayDir=c(),this.intersectionPlane=b(),this.nodeOriginOffset=c(),this.nodeBoundingBox=g(),this.layerViewUid="",this._slicePlaneEnabled=!1,this._configuration=new M,this._nodes=new t,this._highlightsInOrder=null}destroy(){this._nodes.prune()}hasHighlight(e){return this._highlights.has(e)}initializeRenderContext(e){this._context=e,e.requestRender()}uninitializeRenderContext(){}intersect(e,s,t,i){const{point:r,intersectionRayDir:f,nodeOriginOffset:P,intersectionPlane:x,layerViewUid:b,nodeBoundingBox:z}=this,y=S(t,i),v=e.camera.perScreenPixelRatio/2,j=e.camera.near;n(f,i,t);const q=1/o(f);a(f,f,q);const O=c();h(O,f),u(x,f[0],f[1],f[2],-l(f,t));const A=new D,E=new D,F=new Array,I=g(this._passParameters.clipBox);p(I,-t[0],-t[1],-t[2],I),this._nodes.forAll(o=>{const{isLeaf:a,coordinates:h}=o,c=o.splatSize*this._passParameters.scaleFactor;let{min:u,max:g}=o.obb.signedDistanceRangePlane(x);u-=U(c,u+j,this._passParameters,v,a),g-=U(c,g+j,this._passParameters,v,a);const S=g<0,w=null!=A.dist&&null!=E.dist&&A.dist<u*q&&E.dist>g*q;if(S||w)return;const H=C(c,g+j,this._passParameters,v,a);if(!new R(o.obb.center,o.obb.radius+H).intersectRay(y))return;if(!o.obb.intersectRay(t,f,H))return;const B=H*H;o.obb.toAaBoundingBox(z),p(z,-t[0],-t[1],-t[2],z);const M=!m(I,z);n(P,o.origin,t);const N=h.length/3;for(let n=0;n<N;n++){const u=3*n;if(r[0]=P[0]+h[u],r[1]=P[1]+h[u+1],r[2]=P[2]+h[u+2],M&&!_(I,r))continue;const g=l(r,f),p=g*g,m=d(r)-p;if(m>B)continue;let x=g+j;const S=U(c,x,this._passParameters,v,a);if(g-S<0)continue;x-=S;const R=C(c,x,this._passParameters,v,a);if(m>R*R)continue;const w=(g-S)*q,z=e=>(e.point=e.point?W(o,n,e.point):W(o,n),e.dist=w,e.normal=O,e.node=o,e.pointId=n,e.layerViewUid=b,e);if((null==A.dist||w<A.dist)&&(null==s||s(t,i,w))&&z(A),0!==e.options.store&&(null==E.dist||w>E.dist)&&(null==s||s(t,i,w))&&z(E),2===e.options.store&&(null==s||s(t,i,w))){const e=new D;F.push(z(e))}}});const B=e=>{const{layerViewUid:s,node:t,pointId:i}=e;return new w(e.point,s,i,()=>this.createGraphic(t,i,e.point))},M=(e,s)=>{const t=B(s);e.set(this.type,t,s.dist,s.normal)};if(G(A)){const s=e.results.min;(null==s.distance||A.dist<s.distance)&&M(s,A)}if(G(E)&&0!==e.options.store){const s=e.results.max;(null==s.distance||E.dist>s.distance)&&M(s,E)}if(2===e.options.store)for(const n of F){const s=new H(y);M(s,n),e.results.all.push(s)}}acquireTechniques(e){const s=10===e.output;return 0!==this._nodes.length&&(y(e.output)||j(e.output)&&3===e.bind.slot||s)?(this._nodes.forAll(s=>this._initNode(e,s)),this._configuration.drawScreenSize=this._passParameters.drawScreenSpace,this._configuration.useFixedSizes=this._passParameters.useFixedSizes,this._configuration.hasSlicePlane=this._slicePlaneEnabled,this._configuration.hasOccludees=e.bind.hasOccludees,this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.hasHighlightMixTexture=s&&null!=e.bind.highlightMixTexture,this._configuration.output=e.output,this._configuration.hasEmission=e.bind.hasEmission&&y(e.output),this._context.techniques.get(F,this._configuration)):null}render(e,s){const{rctx:t,bind:i,output:r}=e,n=t.bindTechnique(s,i,this._passParameters),o=10===r,a=i.highlight?.name??null;o&&!a||(o&&i.highlights!==this._highlightsInOrder&&this._updateResolvedHighlights(i.highlights),this._nodes.forAll(s=>{const r=o?s.resolvedHighlightRanges.get(a):null;0===s.coordinates.length||null==s.vao||o&&null==r||(n.assertCompatibleVertexAttributeLocations(s.vao),n.bindDraw(i,this._passParameters,s),t.bindVAO(s.vao),o?this._renderHighlightFragments(e,r):t.drawArrays(N.POINTS,0,s.coordinates.length/3))}))}_renderHighlightFragments(e,s){const{rctx:t}=e;for(let i=0;i<s.length;i+=2)t.drawArrays(N.POINTS,s[i],s[i+1])}set useFixedSizes(e){this._passParameters.useFixedSizes!==e&&(this._passParameters.useFixedSizes=e,this._requestRender())}get useFixedSizes(){return this._passParameters.useFixedSizes}set scaleFactor(e){this._passParameters.scaleFactor!==e&&(this._passParameters.scaleFactor=e,this._requestRender())}get scaleFactor(){return this._passParameters.scaleFactor}set minSizePx(e){this._passParameters.minSizePx!==e&&(this._passParameters.minSizePx=e,this._requestRender())}get minSizePx(){return this._passParameters.minSizePx}set useRealWorldSymbolSizes(e){this._passParameters.useRealWorldSymbolSizes!==e&&(this._passParameters.useRealWorldSymbolSizes=e,this._requestRender())}get useRealWorldSymbolSizes(){return this._passParameters.useRealWorldSymbolSizes}set size(e){this._passParameters.size!==e&&(this._passParameters.size=e,this._requestRender())}get size(){return this._passParameters.size}set sizePx(e){this._passParameters.sizePx!==e&&(this._passParameters.sizePx=e,this._requestRender())}get sizePx(){return this._passParameters.sizePx}set clippingBox(e){f(this._passParameters.clipBox,e||P)}get _clippingEnabled(){return!x(this._passParameters.clipBox,P,(e,s)=>e===s)}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this._requestRender())}addNode(e){this._nodes.push(e),e.clearHighlights(),this._highlights.nodeAdded(e),this._requestRender()}removeNode(e){let t=null;return this._nodes.filterInPlace(i=>i.id!==e||(t=i,i.vao=s(i.vao),this._highlights.nodeRemoved(i),!1)),this._requestRender(),t}forEachNode(e){this._nodes.forEach(e)}removeAll(){this._nodes.forAll(e=>e.vao=s(e.vao)),this._highlights.removeAll(),this._nodes.clear(),this._requestRender()}highlight(e,s){return this._highlights.add(e,s)}_addHighlights(e,s,t){for(const i of s)e.addHighlight(i,t);this._highlightsInOrder&&e.updateResolvedHighlights(this._highlightsInOrder),this._requestRender()}_removeHighlight(e,s){e.removeHighlight(s),this._highlightsInOrder&&e.updateResolvedHighlights(this._highlightsInOrder),this._requestRender()}_initNode(e,s){s.vao??=new O(e.rctx,new Map([["positions",new V(e.rctx,I,s.coordinates)],["colors",new V(e.rctx,B,s.rgb)]]))}_requestRender(){this._context&&this._context.requestRender()}_updateResolvedHighlights(e){this._highlightsInOrder=e,this._nodes.forAll(s=>s.updateResolvedHighlights(e))}};function C(e,s,t,i,r){if(t.drawScreenSpace)return t.fixedSize*s*i;const n=E(r)*s*i;return t.useFixedSizes?Math.min(t.fixedSize/2,n):t.screenMinSize>0?Math.min(Math.max(t.screenMinSize*s*i,e/2),n):Math.min(e/2,n)}function U(e,s,t,i,r){return t.drawScreenSpace?0:C(e,s,t,i,r)}function W(e,s,t=c()){return t[0]=e.origin[0]+e.coordinates[3*s],t[1]=e.origin[1]+e.coordinates[3*s+1],t[2]=e.origin[2]+e.coordinates[3*s+2],t}e([i({constructOnly:!0})],T.prototype,"createGraphic",void 0),T=e([r("esri.views.3d.layers.i3s.PointCloudRenderer")],T);class D{constructor(){this.node=null,this.pointId=null,this.point=null,this.dist=null,this.normal=null,this.layerViewUid=""}}function G(e){return null!=e.dist&&null!=e.point&&null!=e.pointId&&null!=e.node}export{T as PointCloudRenderer};