@arcgis/core 4.34.0-next.94 → 4.34.0-next.95

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 (735) hide show
  1. package/analysis/ElevationProfileAnalysis.js +1 -1
  2. package/analysis/VolumeMeasurementAnalysis.js +1 -1
  3. package/analysis/featureReferenceUtils.js +1 -1
  4. package/applications/Components/featureUtils.d.ts +1 -0
  5. package/applications/Components/featureUtils.js +1 -1
  6. package/applications/KnowledgeStudio/resourceSerializationUtils.js +1 -1
  7. package/assets/esri/core/workers/RemoteClient.js +1 -1
  8. package/assets/esri/core/workers/chunks/{57c08ccb75e3135978d1.js → 0086a09441627842d34a.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{35ca317490540fae437c.js → 04c30eec4387078cd38f.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{155dcbd957f8787a45c3.js → 05eee334d58a0b9f6316.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{0f37204f86d2997a2811.js → 06e60fc7715d08ede59d.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{94ddf029698991d853b9.js → 0811ac64d08454460fb1.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{6391ce002fbde9f27a77.js → 081a7082dc281ca7662a.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{3c3b1dc95f03082e4d5b.js → 083f1c2fd0b59a0bf4c3.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{9d9a639f7388a29e7c96.js → 08ee3a97d2b8adb44ea9.js} +1 -1
  16. package/assets/esri/core/workers/chunks/097e5deb51ee7e25e654.js +1 -0
  17. package/assets/esri/core/workers/chunks/{c86ca87959f04075e834.js → 0a7efed82d8e47290147.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{147f6e7b147beaa4ed29.js → 0d94a08769727875bf0e.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{e2fdc4dc1ab9decd731e.js → 135e270b4f03c4270870.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{c6cae8471c5d4ae40c65.js → 145c6a7cdcc9893efb27.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{0cfded1acf92f89a13cb.js → 14ace5dc4b8984212a57.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{39a5863355cccaabd2d6.js → 1762ff76350065750c75.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{a98b284b147258629947.js → 188272af9a6470ccfe31.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{ce8f56cf371812b57a46.js → 19699769deff862e29ce.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{bf9d09493fd849ea69fd.js → 1fd459234917a51b6ae1.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{0aaaf4d1c4a5d284216e.js → 22bb877b85ae250d7819.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{05072093e0209ef5db20.js → 24c14e4a1d2a2267097e.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{e5d974593043d5e2b502.js → 2795a2817ebe3298c350.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{71fef0a33b7ed9456e47.js → 28a5f8978817e0471a2a.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{07a7ca89ef2ca4fc090b.js → 2a30afa043e3f88655d9.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{41f275401e1cde7eee20.js → 2a8b75d2445680571759.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{6b208f5d423da64c8559.js → 2a900a632a1231deb713.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{0e5e565df6ec71445f2e.js → 2bbe8277578b033f92d4.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{48133effac2eacc2196e.js → 2bf29faeb23120dc1916.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{77e611724a499d36eacc.js → 2c72e185b780bbbb1c9f.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{38d874d7f815f5329420.js → 2ca8b0c1ca399fd5dc2f.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{c799f1c03cb22ef52f5f.js → 2d51e9c9b73301b6879c.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{cd0c222a36caa7f80860.js → 2e4dccee7ea387263f15.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{0856cd281efd71bfe3c4.js → 3116b35a92cc0afd9fd3.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{e153b61560a7a869db63.js → 319c3f46f2afb8f3e5a9.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{b8f55ee77ab6ea4c289e.js → 326a76a4e80269d4029d.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{28bb6896c5fd353ca5e9.js → 3367b8565226646decec.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{c38360d912f256519e06.js → 3496e025e48cf580250d.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{4753793daf0b7ff8b5ff.js → 35255e2b980f650490d8.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{d2df6e685d6cffc5f486.js → 37d05d9796917c3d4b7a.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{7b17f52019762aa21af8.js → 3815ffa13e7b439bca6e.js} +1 -1
  47. package/assets/esri/core/workers/chunks/3a2d4b78a48ebb181105.js +1 -0
  48. package/assets/esri/core/workers/chunks/{de34c21d3e6913befe5a.js → 3b65d6a78fbffca37fbd.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{c473b15d4d52f0a63d20.js → 3c78208a97c4cbd8d6d1.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{2698f656405876f4bd20.js → 3ccdce156b906574bd29.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{68f5a2d2666636c3f807.js → 40b81d1c2d53cf598b8e.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{f3284d4e0d41efb0b4a0.js → 441ead5bce80f639934e.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{97eb2cfc1f036feea9a9.js → 44c3b5a507814103f4b4.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{6f29951f5a2da068b257.js → 456161a323be7d640c61.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{b18887a6dc86f0c8324a.js → 48646f3d95a3f2b17e78.js} +1 -1
  56. package/assets/esri/core/workers/chunks/49571d6875de1f2e7e25.js +33 -0
  57. package/assets/esri/core/workers/chunks/{1bbc0dfad4cd72a1c42b.js → 4a2bf3c8da24abd8b9e2.js} +6 -6
  58. package/assets/esri/core/workers/chunks/4b13749b74059a7837d2.js +1 -0
  59. package/assets/esri/core/workers/chunks/{c8e4fe0e3b109eb80e8e.js → 4b83b45df0c4005d078d.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{896c7d137bfd7a8fa0bc.js → 4f01be74dd26e639330f.js} +1 -1
  61. package/assets/esri/core/workers/chunks/{b5c829e904bc9cb5347d.js → 50a5caa96c111dda5c60.js} +1 -1
  62. package/assets/esri/core/workers/chunks/{98381404f2d99a1f9341.js → 50e1c63d0b6196dd365e.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{899f493412acd5a5d91f.js → 5132ca68e8c7af111a47.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{d08b80583a23ba253c7e.js → 56916e56c20465428dd4.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{bbdadced49446c907361.js → 578789c040846ea3759b.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{f62717338075df626eda.js → 5a527a47285a5995cff9.js} +1 -1
  67. package/assets/esri/core/workers/chunks/5cb92abb1f0f38bd0eab.js +1 -0
  68. package/assets/esri/core/workers/chunks/{56edb55b53779e7fd31e.js → 5d2e5774768d8f290343.js} +1 -1
  69. package/assets/esri/core/workers/chunks/{6e5175b43220d6692263.js → 5d3661d1fe46dd29aae9.js} +1 -1
  70. package/assets/esri/core/workers/chunks/{0652d7e525d99e39c957.js → 5fb2ce028b371b3a8acb.js} +1 -1
  71. package/assets/esri/core/workers/chunks/63019a7eb5222dc5e420.js +1 -0
  72. package/assets/esri/core/workers/chunks/{71c6c0b26253c4ca1b68.js → 630efe10c871425b6a95.js} +1 -1
  73. package/assets/esri/core/workers/chunks/64629ddcf008349eaf41.js +1 -0
  74. package/assets/esri/core/workers/chunks/{61e8e159f1f336569b27.js → 65111858957f43eacd8c.js} +1 -1
  75. package/assets/esri/core/workers/chunks/{0427f66b56ec6601deb0.js → 6ac90d88e5f931b1a003.js} +1 -1
  76. package/assets/esri/core/workers/chunks/6c842b955fdd40b39914.js +1 -0
  77. package/assets/esri/core/workers/chunks/{08b0fc6bfe9640ee2525.js → 6cd379bb66dc4cf5d2bf.js} +1 -1
  78. package/assets/esri/core/workers/chunks/{1f2d13466c60a6b57717.js → 6e5b3bbee054d072b594.js} +1 -1
  79. package/assets/esri/core/workers/chunks/6ec77a8142fbfa805b5a.js +1 -0
  80. package/assets/esri/core/workers/chunks/{541bffd61006d0e36166.js → 6f4bd0ee85e7e5a74340.js} +1 -1
  81. package/assets/esri/core/workers/chunks/{648c91a9822bc9d6ee47.js → 701a1835684cf815bcb7.js} +1 -1
  82. package/assets/esri/core/workers/chunks/{f71b76c9506178124fa3.js → 70af1b5b3d2f3f395441.js} +1 -1
  83. package/assets/esri/core/workers/chunks/{d7adef4093ce19ad356d.js → 72846fb9c87c6642daf0.js} +1 -1
  84. package/assets/esri/core/workers/chunks/{f88fe2e8fbc763bdc940.js → 73c1d43070b4fe1e5c1e.js} +1 -1
  85. package/assets/esri/core/workers/chunks/{cab2a1382bdd32bb34d8.js → 7421f9575487cdc9e28e.js} +1 -1
  86. package/assets/esri/core/workers/chunks/{a845c68e76382a73da5e.js → 7633537dc0c65d655baf.js} +1 -1
  87. package/assets/esri/core/workers/chunks/{82e0d22619dc26920ca9.js → 7698f4f4471b6e1c12ef.js} +1 -1
  88. package/assets/esri/core/workers/chunks/{9a0b9d931c1a29e81475.js → 76e444bd625cf3d35877.js} +1 -1
  89. package/assets/esri/core/workers/chunks/{b265472ac3f949a7f40c.js → 773d76253588bcf14eaa.js} +1 -1
  90. package/assets/esri/core/workers/chunks/{77705d0c7c17bd46d81a.js → 7810f870d71f80ca4f41.js} +1 -1
  91. package/assets/esri/core/workers/chunks/{56de25a6fe659a5b5c2b.js → 78b35a19332e58c8c279.js} +1 -1
  92. package/assets/esri/core/workers/chunks/{e4833b718a813a8d125b.js → 79012b873d2b7786be77.js} +1 -1
  93. package/assets/esri/core/workers/chunks/7a6a96edc892d7060b7d.js +1 -0
  94. package/assets/esri/core/workers/chunks/7b3ff47cdbb6af38530d.js +1 -0
  95. package/assets/esri/core/workers/chunks/{04dbdaa63c950f32b8f0.js → 7e8f7fa884d6d41ebae2.js} +1 -1
  96. package/assets/esri/core/workers/chunks/81bbe5251ed13c0d91cc.js +1 -0
  97. package/assets/esri/core/workers/chunks/{0037abf0a82d1ed32e91.js → 8215015f11221a354273.js} +1 -1
  98. package/assets/esri/core/workers/chunks/{cb6a9b43406f4fbe10b2.js → 82f1cd3896401c85df35.js} +1 -1
  99. package/assets/esri/core/workers/chunks/{2bb61f80473b495163e3.js → 83ab8c8bc9e6990114a8.js} +1 -1
  100. package/assets/esri/core/workers/chunks/{03b455e9405a8b6fec68.js → 8659abd4b46f153b6902.js} +1 -1
  101. package/assets/esri/core/workers/chunks/{19bd0b56d82446dbb7c5.js → 868ee8f429e7caddc045.js} +1 -1
  102. package/assets/esri/core/workers/chunks/{1fc7df018c8f802565a6.js → 86b978a48b539e9fc5b8.js} +1 -1
  103. package/assets/esri/core/workers/chunks/{4dfcd03082be83600f3a.js → 88add09190569b04e824.js} +1 -1
  104. package/assets/esri/core/workers/chunks/{65e279516170ddbd4a65.js → 89027f6800e17fab8973.js} +1 -1
  105. package/assets/esri/core/workers/chunks/{3e11a893271caa11a881.js → 8ad8fe758c615fcf2185.js} +1 -1
  106. package/assets/esri/core/workers/chunks/{a6533bab3b2fbc1e2a47.js → 8b16aa50d879b92a5375.js} +1 -1
  107. package/assets/esri/core/workers/chunks/{edaf059c7ea18088c3dd.js → 91df8638b8b904e6d8c5.js} +1 -1
  108. package/assets/esri/core/workers/chunks/92c306d02569e7cd9af3.js +1 -0
  109. package/assets/esri/core/workers/chunks/{fdadf11f31384c09db9f.js → 94486f3fcba48fa93aa8.js} +1 -1
  110. package/assets/esri/core/workers/chunks/{8513c9282c44bb0a736e.js → 9834bc11586a2d8d6f35.js} +1 -1
  111. package/assets/esri/core/workers/chunks/{a0fab8cd791c33d3895d.js → 98dbafa4d45fdf790fff.js} +1 -1
  112. package/assets/esri/core/workers/chunks/{2b867cec6ada339f1c8f.js → 9958a3ed4aa787d19e00.js} +1 -1
  113. package/assets/esri/core/workers/chunks/9a723d739ac44b45432c.js +1 -0
  114. package/assets/esri/core/workers/chunks/{2b9c9a35a6e1f56920b5.js → 9b0ea5e50aeeea615592.js} +14 -14
  115. package/assets/esri/core/workers/chunks/9c6fc4fe2c46f40d63d9.js +1 -0
  116. package/assets/esri/core/workers/chunks/{c4641c2c130c7b8bcdee.js → a1c4509a3865139eb570.js} +1 -1
  117. package/assets/esri/core/workers/chunks/{176f56de787bf486be9f.js → a7bd294996e6c8b8354a.js} +1 -1
  118. package/assets/esri/core/workers/chunks/{80a155496deef2c02a3e.js → a878061845e594b2d72c.js} +1 -1
  119. package/assets/esri/core/workers/chunks/{8f426cb210a4250517d5.js → ad3e18c4c65aa2cd1ceb.js} +1 -1
  120. package/assets/esri/core/workers/chunks/{0328eaea66c1db98da1c.js → ae807912acc19a166264.js} +1 -1
  121. package/assets/esri/core/workers/chunks/{0a981061df08da19372c.js → ae8c387d59be87457567.js} +1 -1
  122. package/assets/esri/core/workers/chunks/{5caf49e679ed0c27e0bd.js → aea8553a2aa54cfd694b.js} +1 -1
  123. package/assets/esri/core/workers/chunks/{0ceb68ff73e5d39e837a.js → b13ccda702b714fe6161.js} +1 -1
  124. package/assets/esri/core/workers/chunks/b1f667006cba60ef4aa7.js +1 -0
  125. package/assets/esri/core/workers/chunks/{70c8f69eed14d55c5cf6.js → b2add7338258ca7c24dd.js} +1 -1
  126. package/assets/esri/core/workers/chunks/b2d9f4e057af26a538fb.js +1 -0
  127. package/assets/esri/core/workers/chunks/{26081b6486c623735657.js → b4ea675831627d9808dd.js} +1 -1
  128. package/assets/esri/core/workers/chunks/{ce2fcaa21d6efcdf4da5.js → b8339c1d60847a9eed3e.js} +1 -1
  129. package/assets/esri/core/workers/chunks/{b1ccbc2fef7f7e5e04f7.js → bae0dfe9a2f5aabae42c.js} +1 -1
  130. package/assets/esri/core/workers/chunks/{95bae3c275f1483eb7ed.js → bcff6178e9d16b1b6191.js} +1 -1
  131. package/assets/esri/core/workers/chunks/{2845a0810e9c00bf30f8.js → bf775fe489213cfc08b1.js} +1 -1
  132. package/assets/esri/core/workers/chunks/{4823e4522bd7379d858e.js → bfc1e8aec7aace3ff30e.js} +1 -1
  133. package/assets/esri/core/workers/chunks/{20003728a679479b14dc.js → c31583229a1100b66a18.js} +1 -1
  134. package/assets/esri/core/workers/chunks/{9346437b152b20bdcf8a.js → c941d15190fc08523d0d.js} +1 -1
  135. package/assets/esri/core/workers/chunks/{5746c4861af83c1d57a8.js → cf11b1dcc2cff30229b6.js} +1 -1
  136. package/assets/esri/core/workers/chunks/{fe1dcf9f81da4adbb1fe.js → cf13625a033f9903655f.js} +1 -1
  137. package/assets/esri/core/workers/chunks/d28ea91f7458daa67fae.js +1 -0
  138. package/assets/esri/core/workers/chunks/{1990162dcf73601d54f7.js → d3cd9c24edf7520d0824.js} +1 -1
  139. package/assets/esri/core/workers/chunks/{bec9ddd38c9ab9f2561b.js → d4f16c2b9297a479731e.js} +1 -1
  140. package/assets/esri/core/workers/chunks/{73db6c070b049fe05147.js → d57edb77c6deee36cce5.js} +1 -1
  141. package/assets/esri/core/workers/chunks/{6e4ec9fa931c69e4e4ba.js → da573ecc68e6aa8f6da9.js} +1 -1
  142. package/assets/esri/core/workers/chunks/{bdf0ab95401c6d8fbc7d.js → db559437b571462fb3db.js} +1 -1
  143. package/assets/esri/core/workers/chunks/{512dcd6e34e217029391.js → deb2854bb7d082a26f52.js} +1 -1
  144. package/assets/esri/core/workers/chunks/{5993427325d1add18ed9.js → dede989d59c4b416af68.js} +1 -1
  145. package/assets/esri/core/workers/chunks/{18e9cb71fa020e93d139.js → df5ecb3339d9301a6f5b.js} +1 -1
  146. package/assets/esri/core/workers/chunks/{e22b400636094fc7b6c0.js → dfbf2e17058aa876f96a.js} +1 -1
  147. package/assets/esri/core/workers/chunks/dfc37c2ce51e6a34fd87.js +1 -0
  148. package/assets/esri/core/workers/chunks/dff8e15958423e0212e5.js +1 -0
  149. package/assets/esri/core/workers/chunks/{c5c6a32a24005478c976.js → e032f3d2ee19790f8c79.js} +1 -1
  150. package/assets/esri/core/workers/chunks/{3d7923d25734d03a4d27.js → e1dba29f5fd1ee5fc999.js} +1 -1
  151. package/assets/esri/core/workers/chunks/{352511dbc67166face40.js → e2e32e2f04cce9e932fd.js} +1 -1
  152. package/assets/esri/core/workers/chunks/{bb0a1be03bb9d621432c.js → e7638b9ab6674bc8a18f.js} +1 -1
  153. package/assets/esri/core/workers/chunks/{edef1e2254c992459c63.js → eb1a7bb8b14e651bc241.js} +1 -1
  154. package/assets/esri/core/workers/chunks/{779ee975efebb838b5d6.js → f154336b4af011cd0c56.js} +1 -1
  155. package/assets/esri/core/workers/chunks/{3807d0b9b1894731174d.js → f1be3a177328a169128f.js} +1 -1
  156. package/assets/esri/core/workers/chunks/{0810dbbf348a927392e7.js → f59c782898d931810374.js} +1 -1
  157. package/assets/esri/core/workers/chunks/{c9159ebf930af3f336f3.js → f5d89b48f62fba78fd10.js} +1 -1
  158. package/assets/esri/core/workers/chunks/f7846523adacbfe5047e.js +1 -0
  159. package/assets/esri/core/workers/chunks/{b510c07dfd0d31683b08.js → f7a9d2da07196a0989ae.js} +1 -1
  160. package/assets/esri/core/workers/chunks/{143503f6eb270c4683f8.js → f7c99e9c8d19352af38d.js} +1 -1
  161. package/assets/esri/core/workers/chunks/{79ab06fb4c91ac8da323.js → f839b86bee15deaf84e4.js} +1 -1
  162. package/assets/esri/core/workers/chunks/{9adecee0ed2f1df3b0d2.js → f85e2b6a285fa8ad60aa.js} +1 -1
  163. package/assets/esri/core/workers/chunks/{024063fe2bbb27899094.js → fbbccca5b1bcffb31c4e.js} +1 -1
  164. package/assets/esri/core/workers/chunks/{009556f323e58271bc7a.js → fc4417d1260b717a9385.js} +1 -1
  165. package/assets/esri/core/workers/chunks/{6810ecdeccf4b7eae5e2.js → fdaf8fb5a3cc7abea44b.js} +1 -1
  166. package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
  167. package/assets/esri/themes/base/widgets/_Editor.scss +4 -0
  168. package/assets/esri/themes/dark/main.css +1 -1
  169. package/assets/esri/themes/light/main.css +1 -1
  170. package/assets/esri/themes/light/view.css +1 -1
  171. package/assets/esri/widgets/Editor/t9n/Editor.json +1 -1
  172. package/assets/esri/widgets/Editor/t9n/Editor_ar.json +1 -1
  173. package/assets/esri/widgets/Editor/t9n/Editor_bg.json +1 -1
  174. package/assets/esri/widgets/Editor/t9n/Editor_bs.json +1 -1
  175. package/assets/esri/widgets/Editor/t9n/Editor_ca.json +1 -1
  176. package/assets/esri/widgets/Editor/t9n/Editor_cs.json +1 -1
  177. package/assets/esri/widgets/Editor/t9n/Editor_da.json +1 -1
  178. package/assets/esri/widgets/Editor/t9n/Editor_de.json +1 -1
  179. package/assets/esri/widgets/Editor/t9n/Editor_el.json +1 -1
  180. package/assets/esri/widgets/Editor/t9n/Editor_en.json +1 -1
  181. package/assets/esri/widgets/Editor/t9n/Editor_es.json +1 -1
  182. package/assets/esri/widgets/Editor/t9n/Editor_et.json +1 -1
  183. package/assets/esri/widgets/Editor/t9n/Editor_fi.json +1 -1
  184. package/assets/esri/widgets/Editor/t9n/Editor_fr.json +1 -1
  185. package/assets/esri/widgets/Editor/t9n/Editor_he.json +1 -1
  186. package/assets/esri/widgets/Editor/t9n/Editor_hr.json +1 -1
  187. package/assets/esri/widgets/Editor/t9n/Editor_hu.json +1 -1
  188. package/assets/esri/widgets/Editor/t9n/Editor_id.json +1 -1
  189. package/assets/esri/widgets/Editor/t9n/Editor_it.json +1 -1
  190. package/assets/esri/widgets/Editor/t9n/Editor_ja.json +1 -1
  191. package/assets/esri/widgets/Editor/t9n/Editor_ko.json +1 -1
  192. package/assets/esri/widgets/Editor/t9n/Editor_lt.json +1 -1
  193. package/assets/esri/widgets/Editor/t9n/Editor_lv.json +1 -1
  194. package/assets/esri/widgets/Editor/t9n/Editor_nl.json +1 -1
  195. package/assets/esri/widgets/Editor/t9n/Editor_no.json +1 -1
  196. package/assets/esri/widgets/Editor/t9n/Editor_pl.json +1 -1
  197. package/assets/esri/widgets/Editor/t9n/Editor_pt-BR.json +1 -1
  198. package/assets/esri/widgets/Editor/t9n/Editor_pt-PT.json +1 -1
  199. package/assets/esri/widgets/Editor/t9n/Editor_ro.json +1 -1
  200. package/assets/esri/widgets/Editor/t9n/Editor_ru.json +1 -1
  201. package/assets/esri/widgets/Editor/t9n/Editor_sk.json +1 -1
  202. package/assets/esri/widgets/Editor/t9n/Editor_sl.json +1 -1
  203. package/assets/esri/widgets/Editor/t9n/Editor_sr.json +1 -1
  204. package/assets/esri/widgets/Editor/t9n/Editor_sv.json +1 -1
  205. package/assets/esri/widgets/Editor/t9n/Editor_th.json +1 -1
  206. package/assets/esri/widgets/Editor/t9n/Editor_tr.json +1 -1
  207. package/assets/esri/widgets/Editor/t9n/Editor_uk.json +1 -1
  208. package/assets/esri/widgets/Editor/t9n/Editor_vi.json +1 -1
  209. package/assets/esri/widgets/Editor/t9n/Editor_zh-CN.json +1 -1
  210. package/assets/esri/widgets/Editor/t9n/Editor_zh-HK.json +1 -1
  211. package/assets/esri/widgets/Editor/t9n/Editor_zh-TW.json +1 -1
  212. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer.json +1 -1
  213. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ar.json +1 -1
  214. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bg.json +1 -1
  215. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bs.json +1 -1
  216. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ca.json +1 -1
  217. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_cs.json +1 -1
  218. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_da.json +1 -1
  219. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_de.json +1 -1
  220. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_el.json +1 -1
  221. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_en.json +1 -1
  222. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_es.json +1 -1
  223. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_et.json +1 -1
  224. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fi.json +1 -1
  225. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fr.json +1 -1
  226. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_he.json +1 -1
  227. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hr.json +1 -1
  228. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hu.json +1 -1
  229. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_id.json +1 -1
  230. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_it.json +1 -1
  231. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ja.json +1 -1
  232. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ko.json +1 -1
  233. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lt.json +1 -1
  234. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lv.json +1 -1
  235. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_nl.json +1 -1
  236. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_no.json +1 -1
  237. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pl.json +1 -1
  238. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-BR.json +1 -1
  239. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-PT.json +1 -1
  240. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ro.json +1 -1
  241. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ru.json +1 -1
  242. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sk.json +1 -1
  243. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sl.json +1 -1
  244. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sr.json +1 -1
  245. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sv.json +1 -1
  246. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_th.json +1 -1
  247. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_tr.json +1 -1
  248. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_uk.json +1 -1
  249. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_vi.json +1 -1
  250. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-CN.json +1 -1
  251. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-HK.json +1 -1
  252. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-TW.json +1 -1
  253. package/assets/esri/widgets/Sketch/t9n/Sketch.json +1 -1
  254. package/assets/esri/widgets/Sketch/t9n/Sketch_ar.json +1 -1
  255. package/assets/esri/widgets/Sketch/t9n/Sketch_bg.json +1 -1
  256. package/assets/esri/widgets/Sketch/t9n/Sketch_bs.json +1 -1
  257. package/assets/esri/widgets/Sketch/t9n/Sketch_ca.json +1 -1
  258. package/assets/esri/widgets/Sketch/t9n/Sketch_cs.json +1 -1
  259. package/assets/esri/widgets/Sketch/t9n/Sketch_da.json +1 -1
  260. package/assets/esri/widgets/Sketch/t9n/Sketch_de.json +1 -1
  261. package/assets/esri/widgets/Sketch/t9n/Sketch_el.json +1 -1
  262. package/assets/esri/widgets/Sketch/t9n/Sketch_en.json +1 -1
  263. package/assets/esri/widgets/Sketch/t9n/Sketch_es.json +1 -1
  264. package/assets/esri/widgets/Sketch/t9n/Sketch_et.json +1 -1
  265. package/assets/esri/widgets/Sketch/t9n/Sketch_fi.json +1 -1
  266. package/assets/esri/widgets/Sketch/t9n/Sketch_fr.json +1 -1
  267. package/assets/esri/widgets/Sketch/t9n/Sketch_he.json +1 -1
  268. package/assets/esri/widgets/Sketch/t9n/Sketch_hr.json +1 -1
  269. package/assets/esri/widgets/Sketch/t9n/Sketch_hu.json +1 -1
  270. package/assets/esri/widgets/Sketch/t9n/Sketch_id.json +1 -1
  271. package/assets/esri/widgets/Sketch/t9n/Sketch_it.json +1 -1
  272. package/assets/esri/widgets/Sketch/t9n/Sketch_ja.json +1 -1
  273. package/assets/esri/widgets/Sketch/t9n/Sketch_ko.json +1 -1
  274. package/assets/esri/widgets/Sketch/t9n/Sketch_lt.json +1 -1
  275. package/assets/esri/widgets/Sketch/t9n/Sketch_lv.json +1 -1
  276. package/assets/esri/widgets/Sketch/t9n/Sketch_nl.json +1 -1
  277. package/assets/esri/widgets/Sketch/t9n/Sketch_no.json +1 -1
  278. package/assets/esri/widgets/Sketch/t9n/Sketch_pl.json +1 -1
  279. package/assets/esri/widgets/Sketch/t9n/Sketch_pt-BR.json +1 -1
  280. package/assets/esri/widgets/Sketch/t9n/Sketch_pt-PT.json +1 -1
  281. package/assets/esri/widgets/Sketch/t9n/Sketch_ro.json +1 -1
  282. package/assets/esri/widgets/Sketch/t9n/Sketch_ru.json +1 -1
  283. package/assets/esri/widgets/Sketch/t9n/Sketch_sk.json +1 -1
  284. package/assets/esri/widgets/Sketch/t9n/Sketch_sl.json +1 -1
  285. package/assets/esri/widgets/Sketch/t9n/Sketch_sr.json +1 -1
  286. package/assets/esri/widgets/Sketch/t9n/Sketch_sv.json +1 -1
  287. package/assets/esri/widgets/Sketch/t9n/Sketch_th.json +1 -1
  288. package/assets/esri/widgets/Sketch/t9n/Sketch_tr.json +1 -1
  289. package/assets/esri/widgets/Sketch/t9n/Sketch_uk.json +1 -1
  290. package/assets/esri/widgets/Sketch/t9n/Sketch_vi.json +1 -1
  291. package/assets/esri/widgets/Sketch/t9n/Sketch_zh-CN.json +1 -1
  292. package/assets/esri/widgets/Sketch/t9n/Sketch_zh-HK.json +1 -1
  293. package/assets/esri/widgets/Sketch/t9n/Sketch_zh-TW.json +1 -1
  294. package/chunks/Envelope.js +1 -1
  295. package/chunks/Fog.glsl.js +2 -2
  296. package/chunks/Geometry.js +1 -1
  297. package/chunks/GlowBlur.glsl.js +8 -9
  298. package/chunks/GlowComposition.glsl.js +15 -16
  299. package/chunks/Laserlines.glsl.js +12 -12
  300. package/chunks/MultiPathImpl.js +1 -1
  301. package/chunks/Point2D.js +1 -1
  302. package/chunks/PointRenderer.glsl.js +1 -1
  303. package/chunks/Precipitation.glsl.js +2 -2
  304. package/chunks/Terrain.glsl.js +1 -1
  305. package/chunks/boundedPlane.js +1 -1
  306. package/chunks/bundle.js +1 -1
  307. package/chunks/cameraUtilsPlanar.js +1 -1
  308. package/chunks/cameraUtilsSpherical.js +1 -1
  309. package/chunks/sphere.js +1 -1
  310. package/chunks/vec32.js +1 -1
  311. package/config.js +1 -1
  312. package/core/accessorSupport/extensions/serializableProperty/reader.js +1 -1
  313. package/core/accessorSupport/extensions/serializableProperty/utils.js +5 -0
  314. package/core/accessorSupport/extensions/serializableProperty.js +1 -1
  315. package/core/accessorSupport/read.js +1 -1
  316. package/core/accessorSupport/write.js +1 -1
  317. package/core/has.js +1 -1
  318. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  319. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  320. package/core/perspectiveUtils.js +1 -1
  321. package/core/workers/workerFactory.js +1 -1
  322. package/editing/geometry/lineUtils.js +1 -1
  323. package/geometry/Mesh.js +1 -1
  324. package/geometry/operators/support/jsonConverter.js +1 -1
  325. package/geometry/projection/localLinearScaleFactors.js +1 -1
  326. package/geometry/projection/projectDirection.js +1 -1
  327. package/geometry/projection/projectVec3Array.js +1 -1
  328. package/geometry/support/axisAngle.js +1 -1
  329. package/geometry/support/axisAngleDegrees.js +1 -1
  330. package/geometry/support/buffer/internals/Vec3.js +1 -1
  331. package/geometry/support/clipRay.js +1 -1
  332. package/geometry/support/coordinateSystem.js +1 -1
  333. package/geometry/support/frustum.js +1 -1
  334. package/geometry/support/lineSegment.js +1 -1
  335. package/geometry/support/meshUtils/centerAt.js +1 -1
  336. package/geometry/support/meshUtils/exporters/gltf/geometry.js +1 -1
  337. package/geometry/support/meshUtils/loadExternal.js +1 -1
  338. package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
  339. package/geometry/support/meshUtils/merge.js +1 -1
  340. package/geometry/support/meshUtils/rotate.js +1 -1
  341. package/geometry/support/meshUtils/scale.js +1 -1
  342. package/geometry/support/meshUtils/vertexSpaceConversion.js +1 -1
  343. package/geometry/support/plane.js +1 -1
  344. package/geometry/support/polygonUtils.js +1 -1
  345. package/geometry/support/ray.js +1 -1
  346. package/geometry/support/sphereUtils.js +1 -1
  347. package/geometry/support/triangle.js +1 -1
  348. package/geometry/support/vector.js +1 -1
  349. package/interfaces.d.ts +269 -145
  350. package/kernel.js +1 -1
  351. package/layers/FeatureLayer.js +1 -1
  352. package/layers/VoxelWasmPerSceneView.js +1 -1
  353. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  354. package/layers/graphics/sources/ParquetSource.js +1 -1
  355. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  356. package/layers/graphics/sources/support/QueryTask.js +1 -1
  357. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  358. package/layers/knowledgeGraph/layerUtils.js +1 -1
  359. package/layers/orientedImagery/core/coverageUtils.js +1 -1
  360. package/layers/orientedImagery/transformations/utils.js +1 -1
  361. package/layers/orientedImagery/transformations/worldToImage.js +1 -1
  362. package/layers/support/featurePopupQueryUtils.js +1 -1
  363. package/layers/support/layerUtils.js +1 -1
  364. package/layers/support/rasterDatasets/FunctionRaster.js +1 -1
  365. package/layers/support/tiles3DUtils.js +1 -1
  366. package/layers/video/VideoCameraSensorModel.js +1 -1
  367. package/layers/voxel/VoxelVolume.js +1 -1
  368. package/layers/voxel/voxelPlaneUtils.js +1 -1
  369. package/package.json +3 -3
  370. package/rest/knowledgeGraph/GraphApplyEdits.js +1 -1
  371. package/rest/query/executePivotQuery.js +5 -0
  372. package/rest/query/operations/query.js +1 -1
  373. package/rest/query/operations/queryPivot.js +5 -0
  374. package/rest/query/operations/queryUtils.js +5 -0
  375. package/rest/support/PivotDefinition.js +5 -0
  376. package/rest/support/PivotQuery.js +5 -0
  377. package/rest/support/UnPivotDefinition.js +5 -0
  378. package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
  379. package/smartMapping/support/adapters/support/utils.js +1 -1
  380. package/support/revision.js +1 -1
  381. package/views/2d/analysis/ElevationProfile/ElevationProfileInputVisualization2D.js +1 -1
  382. package/views/2d/analysis/ElevationProfileAnalysisView2D.js +1 -1
  383. package/views/2d/engine/flow/dataUtils.js +1 -1
  384. package/views/2d/engine/flow/utils.js +1 -1
  385. package/views/2d/engine/webgl/AFeatureTile.js +1 -1
  386. package/views/2d/engine/webgl/WorldExtentClipRenderer.js +1 -1
  387. package/views/2d/interactive/editingTools/TransformTool.js +1 -1
  388. package/views/2d/interactive/editingTools/manipulations/RotateManipulation.js +1 -1
  389. package/views/2d/interactive/editingTools/manipulations/ScaleManipulation.js +1 -1
  390. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  391. package/views/2d/layers/MapNotesLayerView2D.js +1 -1
  392. package/views/2d/layers/RouteLayerView2D.js +1 -1
  393. package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
  394. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  395. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  396. package/views/2d/navigation/actions/Pan.js +1 -1
  397. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementVisualization.js +1 -1
  398. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  399. package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
  400. package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
  401. package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
  402. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementVisualization.js +1 -1
  403. package/views/3d/analysis/ElevationProfile/ElevationProfileGeometryVisualization3D.js +5 -0
  404. package/views/3d/analysis/ElevationProfile/ElevationProfileLineSceneComputation.js +1 -1
  405. package/views/3d/analysis/ElevationProfile/ElevationProfileLineVisualization3D.js +1 -1
  406. package/views/3d/analysis/ElevationProfile/ElevationProfileVisualization3D.js +1 -1
  407. package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
  408. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  409. package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
  410. package/views/3d/analysis/LineOfSight/LineOfSightVisualization.js +1 -1
  411. package/views/3d/analysis/Slice/ShiftManipulator.js +1 -1
  412. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  413. package/views/3d/analysis/Slice/SliceVisualization.js +1 -1
  414. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  415. package/views/3d/analysis/Viewshed/ViewshedComputedData.js +1 -1
  416. package/views/3d/analysis/Viewshed/ViewshedFieldOfViewManipulation.js +1 -1
  417. package/views/3d/analysis/Viewshed/ViewshedScaleOrientManipulation.js +1 -1
  418. package/views/3d/analysis/Viewshed/ViewshedShapeVisualElement.js +1 -1
  419. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  420. package/views/3d/analysis/Viewshed/ViewshedSubVisualization.js +1 -1
  421. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  422. package/views/3d/analysis/Viewshed/viewshedToolUtils.js +1 -1
  423. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  424. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementConfiguration.js +1 -1
  425. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillComputation.js +1 -1
  426. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  427. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  428. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementError.js +1 -1
  429. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementShiftTool.js +1 -1
  430. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementTool.js +1 -1
  431. package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
  432. package/views/3d/analysis/support/measurementUtils.js +1 -1
  433. package/views/3d/animation/pointToPoint/Animation.js +1 -1
  434. package/views/3d/animation/pointToPoint/Camera.js +1 -1
  435. package/views/3d/camera/constraintUtils/altitude.js +1 -1
  436. package/views/3d/camera/constraintUtils/common.js +1 -1
  437. package/views/3d/camera/constraintUtils/distance.js +1 -1
  438. package/views/3d/camera/constraintUtils/surfaceCollision.js +1 -1
  439. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  440. package/views/3d/camera/intersectionUtils.js +1 -1
  441. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  442. package/views/3d/environment/CloudsParameters.js +1 -1
  443. package/views/3d/environment/EnvironmentManager.js +1 -1
  444. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  445. package/views/3d/environment/Fog.js +1 -1
  446. package/views/3d/environment/MarsAtmosphere.js +1 -1
  447. package/views/3d/glTF/loader.js +1 -1
  448. package/views/3d/interactive/Manipulator3D.js +1 -1
  449. package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
  450. package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
  451. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  452. package/views/3d/interactive/editingTools/lineObjectVisualElementUtils.js +1 -1
  453. package/views/3d/interactive/editingTools/manipulations/MoveXYAxisManipulation.js +1 -1
  454. package/views/3d/interactive/editingTools/manipulations/MoveXYDiscManipulation.js +1 -1
  455. package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
  456. package/views/3d/interactive/editingTools/media/MediaElementManipulator3D.js +1 -1
  457. package/views/3d/interactive/editingTools/originGeometryVisualElementUtils.js +1 -1
  458. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  459. package/views/3d/interactive/editingTools/reshape/edgeOffsetUtils.js +1 -1
  460. package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
  461. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentMove.js +1 -1
  462. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentRotate.js +1 -1
  463. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
  464. package/views/3d/interactive/editingTools/transform/extentTransform/extentUtils.js +1 -1
  465. package/views/3d/interactive/manipulatorUtils.js +1 -1
  466. package/views/3d/interactive/support/viewUtils.js +1 -1
  467. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  468. package/views/3d/interactive/visualElements/LabelVisualElement.js +1 -1
  469. package/views/3d/interactive/visualElements/LaserlineVisualElement.js +1 -1
  470. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  471. package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
  472. package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
  473. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  474. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  475. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  476. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  477. package/views/3d/interactive/visualElements/VerticesVisualElement.js +1 -1
  478. package/views/3d/interactive/visualElements/support/Segment.js +1 -1
  479. package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
  480. package/views/3d/layers/FlowSubView3D.js +1 -1
  481. package/views/3d/layers/I3SMeshView3D.js +1 -1
  482. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  483. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  484. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  485. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  486. package/views/3d/layers/VoxelLayerView3D.js +1 -1
  487. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  488. package/views/3d/layers/graphics/ElevationAligners.js +1 -1
  489. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  490. package/views/3d/layers/graphics/Graphics3DDrapedGraphicLayer.js +1 -1
  491. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  492. package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
  493. package/views/3d/layers/graphics/Graphics3DLodInstanceGraphicLayer.js +1 -1
  494. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  495. package/views/3d/layers/graphics/Graphics3DMeshObject3DGraphicLayer.js +1 -1
  496. package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
  497. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  498. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  499. package/views/3d/layers/graphics/LabelInfo.js +1 -1
  500. package/views/3d/layers/graphics/defaultSymbolComplexity.js +1 -1
  501. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  502. package/views/3d/layers/i3s/I3SGeometryUtil.js +1 -1
  503. package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
  504. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  505. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  506. package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
  507. package/views/3d/layers/i3s/LoDUtil.js +1 -1
  508. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  509. package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
  510. package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
  511. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  512. package/views/3d/layers/support/I3STreeDebugger.js +1 -1
  513. package/views/3d/layers/support/uvUtils.js +1 -1
  514. package/views/3d/state/Frustum.js +1 -1
  515. package/views/3d/state/NearFarHeuristic.js +1 -1
  516. package/views/3d/state/controllers/FovController.js +1 -1
  517. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  518. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  519. package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
  520. package/views/3d/state/controllers/RotateController.js +1 -1
  521. package/views/3d/state/controllers/ZoomControllerGlobal.js +1 -1
  522. package/views/3d/state/controllers/ZoomControllerLocal.js +1 -1
  523. package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
  524. package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
  525. package/views/3d/state/controllers/momentum/PanPlanarMomentumController.js +1 -1
  526. package/views/3d/state/controllers/momentum/PanSphericalMomentumController.js +1 -1
  527. package/views/3d/state/controllers/momentum/ZoomPlanarMomentumController.js +1 -1
  528. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  529. package/views/3d/state/utils/navigationUtils.js +1 -1
  530. package/views/3d/state/utils/viewUtils.js +1 -1
  531. package/views/3d/support/FrustumExtentIntersection.js +1 -1
  532. package/views/3d/support/RenderCoordsHelper.js +1 -1
  533. package/views/3d/support/cameraUtils.js +1 -1
  534. package/views/3d/support/cameraUtilsInternal.js +1 -1
  535. package/views/3d/support/dito.js +1 -1
  536. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  537. package/views/3d/support/flow/StreamlineResources3DOverlay.js +1 -1
  538. package/views/3d/support/flow/StreamlineResources3DShape.js +1 -1
  539. package/views/3d/support/flow/constants.js +1 -1
  540. package/views/3d/support/geometryUtils/ray.js +1 -1
  541. package/views/3d/support/intersectionUtils.js +1 -1
  542. package/views/3d/support/mathUtils.js +1 -1
  543. package/views/3d/support/orientedBoundingBox.js +1 -1
  544. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  545. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  546. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  547. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  548. package/views/3d/support/sunUtils.js +1 -1
  549. package/views/3d/support/viewpointUtils.js +1 -1
  550. package/views/3d/terrain/OverlayManager.js +1 -1
  551. package/views/3d/terrain/OverlayRenderer.js +1 -1
  552. package/views/3d/terrain/PatchGeometry.js +1 -1
  553. package/views/3d/terrain/PatchRenderData.js +1 -1
  554. package/views/3d/terrain/SphericalPatch.js +1 -1
  555. package/views/3d/terrain/TerrainRenderer.js +1 -1
  556. package/views/3d/terrain/TerrainSurface.js +1 -1
  557. package/views/3d/terrain/Tile.js +1 -1
  558. package/views/3d/webgl/RenderCamera.js +1 -1
  559. package/views/3d/webgl-engine/Stage.js +1 -1
  560. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  561. package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticBVH.js +1 -1
  562. package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticComponentGeometryBVH.js +1 -1
  563. package/views/3d/webgl-engine/collections/Component/DepthRange.js +1 -1
  564. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  565. package/views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepthToWriteShadowMap.glsl.js +1 -1
  566. package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
  567. package/views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js +2 -2
  568. package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +1 -1
  569. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateAmbientLighting.glsl.js +1 -1
  570. package/views/3d/webgl-engine/core/shaderLibrary/util/ScreenSizePerspective.glsl.js +1 -1
  571. package/views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js +1 -1
  572. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechnique.js +1 -1
  573. package/views/3d/webgl-engine/core/util/TwoVectorPosition.js +1 -1
  574. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +7 -7
  575. package/views/3d/webgl-engine/effects/glow/GlowCompositionTechnique.js +1 -1
  576. package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
  577. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  578. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  579. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  580. package/views/3d/webgl-engine/effects/laserlines/LaserlinePathData.js +1 -1
  581. package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
  582. package/views/3d/webgl-engine/lib/CompositingHelper.js +1 -1
  583. package/views/3d/webgl-engine/lib/CutFillColor.js +1 -1
  584. package/views/3d/webgl-engine/lib/CutFillDepth.js +1 -1
  585. package/views/3d/webgl-engine/lib/GPUPointOcclusionQuery.js +1 -1
  586. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  587. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  588. package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
  589. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  590. package/views/3d/webgl-engine/lib/IntersectorResult.js +1 -1
  591. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  592. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  593. package/views/3d/webgl-engine/lib/Path.js +1 -1
  594. package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
  595. package/views/3d/webgl-engine/lib/PathVertex.js +1 -1
  596. package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
  597. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  598. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  599. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  600. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  601. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  602. package/views/3d/webgl-engine/lib/WebGLLayer.js +1 -1
  603. package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
  604. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  605. package/views/3d/webgl-engine/lib/edgeRendering/edgeBufferWriters.js +1 -1
  606. package/views/3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js +1 -1
  607. package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
  608. package/views/3d/webgl-engine/lib/intersectorUtils.js +1 -1
  609. package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
  610. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  611. package/views/3d/webgl-engine/lib/pathGeometryUtils.js +1 -1
  612. package/views/3d/webgl-engine/lib/triangleIntersectionUtils.js +1 -1
  613. package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
  614. package/views/3d/webgl-engine/lighting/SceneLighting.js +1 -1
  615. package/views/3d/webgl-engine/lighting/SphericalHarmonics.js +1 -1
  616. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  617. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  618. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  619. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  620. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  621. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  622. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  623. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  624. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  625. package/views/3d/webgl-engine/shaders/CompositingTechnique.js +1 -1
  626. package/views/3d/webgl-engine/shaders/SphereDepthInterpolate.glsl.js +1 -1
  627. package/views/3d/webgl.js +1 -1
  628. package/views/DOMContainer.js +1 -1
  629. package/views/SceneView.js +1 -1
  630. package/views/View.js +1 -1
  631. package/views/View2D.js +1 -1
  632. package/views/analysis/ElevationProfile/ElevationProfileController.js +1 -1
  633. package/views/analysis/ElevationProfile/ElevationProfileError.d.ts +4 -0
  634. package/views/analysis/ElevationProfile/ElevationProfileError.js +5 -0
  635. package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
  636. package/views/analysis/ElevationProfile/elevationProfileErrors.js +5 -0
  637. package/views/analysis/ElevationProfile/elevationProfileGenerationUtils.js +1 -1
  638. package/views/analysis/ElevationProfile/elevationProfileGeometryUtils.js +1 -1
  639. package/views/analysis/ElevationProfile/elevationProfileInputVisualizationUtils.js +1 -1
  640. package/views/analysis/ExclusiveOperationManager.js +1 -1
  641. package/views/draw/support/Reshape.js +1 -1
  642. package/views/draw/support/createUtils.js +1 -1
  643. package/views/draw/support/helpMessageUtils3d.js +1 -1
  644. package/views/draw/support/surfaceCoordinateSystems.js +1 -1
  645. package/views/interactive/GraphicManipulator.js +1 -1
  646. package/views/interactive/coordinateHelper.js +1 -1
  647. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  648. package/views/interactive/editGeometry/support/editPlaneUtils.js +1 -1
  649. package/views/interactive/sketch/constraintUtils.js +1 -1
  650. package/views/interactive/sketch/constraints.js +1 -1
  651. package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
  652. package/views/interactive/snapping/RightAngleSnapper.js +1 -1
  653. package/views/interactive/snapping/candidates/ParallelLineSnappingCandidate.js +1 -1
  654. package/views/interactive/snapping/candidates/RightAngleTriangleSnappingCandidate.js +1 -1
  655. package/views/interactive/snapping/featureSources/featureServiceSource/tileUtils.js +1 -1
  656. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
  657. package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
  658. package/views/interactive/snapping/hints/LineSnappingHint.js +1 -1
  659. package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
  660. package/views/layers/FeatureLayerView.d.ts +1 -1
  661. package/views/layers/FeatureLayerView.js +1 -1
  662. package/views/layers/SceneLayerView.js +1 -1
  663. package/views/navigation/PanPlanarMomentumEstimator.js +1 -1
  664. package/views/navigation/PanSphericalMomentumEstimator.js +1 -1
  665. package/views/navigation/gamepadAndKeyboardUtils.js +1 -1
  666. package/views/popupAdapter.js +1 -1
  667. package/views/support/angularMeasurementUtils.js +1 -1
  668. package/views/support/euclideanAreaMeasurementUtils.js +1 -1
  669. package/views/support/euclideanLengthMeasurementUtils.js +1 -1
  670. package/views/support/geometry3dUtils.js +1 -1
  671. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  672. package/widgets/Editor/EditorViewModel.js +1 -1
  673. package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
  674. package/widgets/Editor/SplitFeatureWorkflowData.js +1 -1
  675. package/widgets/Editor/UpdateWorkflow.js +1 -1
  676. package/widgets/Editor/components/PendingFeatureList.js +1 -1
  677. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  678. package/widgets/Editor/components/UploadDetails.js +1 -1
  679. package/widgets/Editor/components/workflowAdapters/pendingFeatureList/CreateFeaturesWorkflowPendingFeatureListAdapter.ts.js +5 -0
  680. package/widgets/Editor/components/workflowAdapters/pendingFeatureList/SplitFeatureWorkflowPendingFeatureListAdapter.js +5 -0
  681. package/widgets/Editor/css.js +1 -1
  682. package/widgets/Editor/modelUploadUtils.js +1 -1
  683. package/widgets/Editor/support/splitFeatureUtils.js +1 -1
  684. package/widgets/Editor/workflowUtils.js +1 -1
  685. package/widgets/Editor.js +1 -1
  686. package/widgets/ElevationProfile/ElevationProfileLineView.js +1 -1
  687. package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
  688. package/widgets/FeatureTable/FieldColumn.js +1 -1
  689. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  690. package/widgets/FeatureTable/support/tableUtils.js +1 -1
  691. package/widgets/FeatureTable/support/templateUtils.js +1 -1
  692. package/widgets/Legend/LegendViewModel.js +1 -1
  693. package/widgets/Legend.js +1 -1
  694. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  695. package/widgets/OrientedImageryViewer/components/ImageLocationWidget.js +1 -1
  696. package/widgets/OrientedImageryViewer/components/ImageOverlays.js +1 -1
  697. package/widgets/OrientedImageryViewer/dataCaptureUtils.js +1 -1
  698. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  699. package/widgets/OrientedImageryViewer.js +1 -1
  700. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  701. package/widgets/PanoramicViewer/PanoramicZoomManager.js +5 -0
  702. package/widgets/PanoramicViewer/PanoramicZoomViewModel.js +1 -1
  703. package/widgets/PanoramicViewer/constants.js +1 -1
  704. package/widgets/PanoramicViewer/support/ClosestMap.js +5 -0
  705. package/widgets/PanoramicViewer/support/PanoramicMeshManager.js +1 -1
  706. package/widgets/PanoramicViewer/support/PanoramicMeshWorker.js +1 -1
  707. package/widgets/PanoramicViewer/support/PanoramicTileNode.js +5 -0
  708. package/widgets/PanoramicViewer/support/PanoramicTilePyramid.js +5 -0
  709. package/widgets/PanoramicViewer/support/importUtils.js +5 -0
  710. package/widgets/PanoramicViewer/utils.js +1 -1
  711. package/widgets/PanoramicViewer.js +1 -1
  712. package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
  713. package/widgets/support/forms/formUtils.js +1 -1
  714. package/analysis/ElevationProfile/ElevationProfileUnits.d.ts +0 -4
  715. package/assets/esri/core/workers/chunks/004b13c1db79c9e668b1.js +0 -1
  716. package/assets/esri/core/workers/chunks/06c389283ee5b60573f2.js +0 -1
  717. package/assets/esri/core/workers/chunks/0ca5060c81a1a05b8be3.js +0 -1
  718. package/assets/esri/core/workers/chunks/1214c126af0de25a4b4a.js +0 -1
  719. package/assets/esri/core/workers/chunks/23e600e368ac829680b5.js +0 -1
  720. package/assets/esri/core/workers/chunks/3d800fbc449bea18b1cd.js +0 -1
  721. package/assets/esri/core/workers/chunks/3dcdbba706a8034b6ba3.js +0 -1
  722. package/assets/esri/core/workers/chunks/503c81dda242e6077317.js +0 -1
  723. package/assets/esri/core/workers/chunks/52121179d4f9833008ec.js +0 -1
  724. package/assets/esri/core/workers/chunks/56b3bb68b61b77138186.js +0 -1
  725. package/assets/esri/core/workers/chunks/5aacd1c6b171c99b41f5.js +0 -1
  726. package/assets/esri/core/workers/chunks/633faa9cec8988ab06af.js +0 -33
  727. package/assets/esri/core/workers/chunks/801451fb572bc5f1f270.js +0 -1
  728. package/assets/esri/core/workers/chunks/8d63b42aea32ce2e5d09.js +0 -1
  729. package/assets/esri/core/workers/chunks/bf9031749d10e7d457b6.js +0 -1
  730. package/assets/esri/core/workers/chunks/c547692862df95d22818.js +0 -1
  731. package/assets/esri/core/workers/chunks/c84665db250b05e2829d.js +0 -1
  732. package/assets/esri/core/workers/chunks/ef75cad6570b14a42b62.js +0 -1
  733. package/assets/esri/core/workers/chunks/fb456e7425e09df17d8c.js +0 -1
  734. package/views/3d/analysis/ElevationProfile/ElevationProfileInputVisualization3D.js +0 -5
  735. package/views/analysis/ElevationProfile/ElevationProfileGenerationError.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as i}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{clamp as s,lerp as a}from"../../../../core/mathUtils.js";import{removeMaybe as n,abortMaybe as h,destroyMaybe as o,releaseMaybe as d}from"../../../../core/maybe.js";import{throwIfAborted as l}from"../../../../core/promiseUtils.js";import{watch as _,syncAndInitial as u,initial as p,sync as m}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{Milliseconds as g}from"../../../../core/time.js";import{property as f}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as b}from"../../../../core/accessorSupport/decorators/subclass.js";import{equals as P,invert as C,multiply as w}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as T,create as S}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as E}from"../../../../chunks/vec42.js";import{ZEROS as x}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{fromValues as A,ZEROS as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as D}from"../../../../geometry/support/Indices.js";import{RenderCategory as I,InternalRenderCategory as R}from"../../webgl.js";import{innerAtmosphereFadeStart as O}from"../../environment/atmosphereUtils.js";import{minNearDistanceInMeters as v}from"../../state/NearFarHeuristic.js";import{debugFlags as F}from"../../support/debugFlags.js";import{FBOCache as H,defaultWebGLFBO as M}from"../core/FBOCache.js";import{RenderPassManager as q}from"../core/renderPasses/RenderPassManager.js";import{isColorEmission as N,isColorOrColorEmission as G}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as L}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as V}from"../effects/RenderNodes.js";import{RenderPluginManager as U}from"../effects/RenderPluginManager.js";import{Blit as j}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as B,renderHighlightBuffer as k}from"../effects/highlight/Highlight.js";import{OITBlend as z}from"../effects/transparency/OITBlend.js";import{AnimationTimer as Q}from"./AnimationTimer.js";import{AnimationTimeStep as W}from"./AnimationTimeStep.js";import{BoundingInfo as Y}from"./BoundingInfo.js";import{DepthRange as Z}from"./DepthRange.js";import{depthRangeFromScene as J}from"./depthRangeUtils.js";import{hudFragmentOpacityParameters as K}from"./hudFragmentOpacityParameters.js";import{MainFramebuffer as X}from"./MainFramebuffer.js";import{RenderContext as $,defaultRenderOccludedMask as ee}from"./RenderContext.js";import{RendererBase as te}from"./RendererBase.js";import{setupFeatureDefaults as re}from"./RenderFeature.js";import{RenderPluginInput as ie}from"./RenderPluginInput.js";import{ShadowAccumulator as se}from"./ShadowAccumulator.js";import{ShadowMap as ae}from"./ShadowMap.js";import ne from"./SliceHelper.js";import{MergedRenderer as he}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as oe}from"../parts/renderUtils.js";import{RendererPerformanceInfo as de,PerformanceCategory as le}from"../statistics/RendererPerformanceInfo.js";import{PixelType as _e,ColorAttachment1 as ue,ColorAttachment2 as pe}from"../../../webgl/enums.js";let me=class extends te{constructor(e,t,r,s,a,n){super({stage:e}),this._techniques=r,this._rctx=s,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this.renderPassManager=new q,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=A(0,0,0,1),this._sliceHelper=new ne,this._blit=null,this._oitblend=null,this.sceneDepthRange=c(Z.Infinite),this._state=c(2),this._highQualityTransparencyEnabled=!0,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new W,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._lastFrameTime=g(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new ie,this._releaseNormals=e=>{e.some(({name:e})=>"normals"===e)&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this._fboCache=new H(s),this._renderStateFeatures=c(re(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._framebuffer=new X(this.fboCache),this._performanceInfo=new de(this._rctx),this._shadowMap=new ae(this.fboCache,e.viewingMode),this._shadowAccumulator=new se(this.fboCache,r,e,e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t},(t,r,i)=>{const s=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,r,i,!0,s),this._renderShadowCascades(4,t.shadowMap),t.shadowMap.finish(),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},n),this._renderContext=new $(this._rctx,this._shadowMap,r),this._nodes=new V(this._renderContext),this._plugins=new U({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this._plugins.add(this.renderPassManager),this.addHandles([_(()=>e.view.state.camera,()=>n(),u),_(()=>F.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},n()},p),_(()=>e.view.environment.background?.color,e=>{const t=e?i(e):y;E(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()},u),_(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=L,u),_(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},m),_(()=>this._bindParameters.clouds.data?.state,()=>n(),m),_(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,n()},p)])}destroy(){this._gpuTimerHandle=n(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=h(this._loadEdgeViewTask),this._edgeView=o(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this._fboCache.destroy(),this._fboCache=null,this._plugins.destroy(),this._plugins=null,this._pluginInput=null,this._blit=null,this._oitblend=null,this._compositingHelper=null,this._nodes=null,this._framebuffer=null,this._shadowMap=null,this._renderContext=null,this._performanceInfo=null,Y.prune(),he.prune(),D()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _framebufferSize(){return this._framebuffer.size}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=re(t,e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate(i=>i.set(t,e,r)),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(1)}get hasReflections(){return this._pluginsHas.water&&(this._ssrEnabled||this.isFeatureEnabled(5))}get _hasHighlights(){return this._plugins.produces(9,2,4,18,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(9,13,14)}get hasSSAO(){return(this.stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(4))&&!this._inGlobeView}get hasSMAA(){return this.stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(0)}get hasEmitters(){return this._plugins.hasEmitters&&this.stage.view.qualitySettings.physicallyBasedRenderingEnabled}get fullResolutionAtmosphere(){return this.stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(3)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=d(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=d(this._bindParameters.depth),this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility)}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.readyToRun||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");l(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:xe(this.stage.view.resourceController)});return this.addHandles(_(()=>r.updating,()=>this._requestRender(),m)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(r)),this._edgeViewCallbacks.length=0,r})),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&P(this._bindParameters.ssr.reprojectionMatrix,T)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),e.environment){void 0!==e.environment.weather&&(this._bindParameters.weather=e.environment.weather);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(0,...Ce),has.water=this._plugins.produces(3,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new Q(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?n(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r,i=!1){try{return this._isRendering=!0,this._render(e,t,r,i)}catch(s){console.error(`Exception during rendering: ${s}`)}finally{this._isRendering=!1}return new oe(this._pluginInput.get(I.FINAL),null)}_updateHUDOccludedFragmentOpacity(e,t){const{idleOpacity:r,navigatingOpacity:i,maxDelta:n,tiltFadeStart:h,tiltFadeEnd:o,altitudeStart:d,altitudeEnd:l}=K,_=this.stage.view,u=_.stateManager.camera,p=_.qualitySettings.fadeDuration,m=2===e?r:i,c=s((u.tilt-h)/(o-h),0,1),g=s(((u.position.z??0)-d)/(l-d),0,1),f=a(a(1,m,c),1,g),b=this._bindParameters.hudOccludedFragmentOpacity;if(p<=0||b===f||0===this._lastFrameTime||this._lastFrameTime>t)return this._bindParameters.hudOccludedFragmentOpacity=f,void(this._lastFrameTime=t);const P=t-this._lastFrameTime;this._lastFrameTime=t;const C=Math.max(1-r,Math.abs(r-i)),w=Math.min(C*P/p,n);w>=Math.abs(f-b)?this._bindParameters.hudOccludedFragmentOpacity=f:(this._bindParameters.hudOccludedFragmentOpacity=b+Math.sign(f-b)*w,this._requestRender())}_render(e,t,r,i){const s=0===r;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=s,this._disposeBindBuffers();const{camera:a,contentCamera:n,mode:h,alignPixelEnabled:o}=e;this._state.value=h;const d=this._nodes.produces("magnifier-color"),l=this._nodes.produces(I.FINAL),_=this.hasEmitters,u=_?1:0;this._renderContext.time=t,this._renderContext.output=u,this._bindParameters.oitPass=0,this._bindParameters.alignPixelEnabled=o,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null;const p=!i||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=p?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(R.VIEWSHED),this._bindParameters.cutFillEnabled=this._nodes.produces(R.CUTFILL_DEPTH),this._renderOverlay(),a.setGLViewport(this._rctx);const m=this._framebuffer,c=m.initialize(a.fullWidth,a.fullHeight,this._backgroundColor,_);this.hasReflections?(c?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=c):c?.release(),this._ensureBindParametersCamera(a,n),this._updateHUDOccludedFragmentOpacity(h,t),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!i;const g=this._highQualityTransparency&&this._hasTransparentTerrain,f=this._plugins.produces(0,...be);this._precompilePrepasses(),this.performanceInfo.advance(le.PREPARE);const b=this._computeShadowDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,b),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(b,a,n,!s),this._ensureBindParametersSSR(t),this._precompileShaders(g,f,u),this._renderContext.output=u,m.bind(),this._bindParameters.mainDepth=m.depth.attachment,this._renderOpaque(g),this._renderTransparent(f,g,u),this._shadowMap.disposeMainBuffer(),this._pluginInput.set(R.FOCUSAREA,this._renderFocusAreaGeometry()),this._pluginInput.set(R.CUTFILL_DEPTH,this._renderCutFillDepth()),m.update(e=>this._renderNodes(R.TRANSPARENT_ENVIRONMENT,e)),m.update(e=>this._renderNodes(R.VIEWSHED,e)),m.update(e=>this._renderNodes(R.LASERLINES,e)),m.update(e=>this._renderNodes(R.FOCUSAREA_COLOR,e)),this._pluginInput.release(R.FOCUSAREA),this._pluginInput.release(R.CUTFILL_DEPTH),m.update(e=>this._renderNodes(R.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass()),this._renderHighlightShadowMap(a,this._bindParameters.lighting.mainLight.direction,b);const P=2===r?this._renderObjectAndLayerIdColor():null;m.update(e=>this._renderNodes(I.COMPOSITE,e)),this._shadowMap.disposeOffscreenBuffers();const C=s&&!l&&!(d&&!i),w=this._pluginInput.get(I.COMPOSITE),T=C?M:this.fboCache.acquire(w.fbo.width,w.fbo.height,R.ANTIALIASING),S=this._nodes.produces(R.ANTIALIASING)?this._renderNodes(R.ANTIALIASING,T):this.blitFBO(w,T,!1);let E;this._pluginInput.set(R.ANTIALIASING,S),this._hasHUDHighlights?(this._renderHUD(1,S,u),E=this._renderNodes(R.HIGHLIGHTS,S)):(E=this._renderNodes(R.HIGHLIGHTS,S),this._renderHUD(1,E,u));const x=this._renderNodes(R.MAGNIFIER,E);return s&&d&&!i&&!l&&this.blitFBO(x),l?(x.attachDepth(m.depth),this.blitFBO(this._renderNodes(I.FINAL,x)),x.detachDepth()):this._pluginInput.set(I.FINAL,x),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),m.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),s||(this._releaseFBOs(),this._disposeOffscreenBuffers()),new oe(this._pluginInput.get(I.FINAL),P)}_precompileShaders(e,t,r){++this._plugins.context.techniques.precompiling,this._renderContext.output=r,this._precompileOpaqueGeometry(),this._nodes.precompile(R.OPAQUE_ENVIRONMENT),this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,this._renderContext.output=2,this._plugins.precompile(6),this._plugins.precompile(7),e&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=r,this._plugins.precompile(6),this._plugins.precompile(7),t&&(this._precompileTransparentGeometry(),this._hasTransparentTerrain&&(this._bindParameters.cullAboveTerrain=!1,this._precompileTransparentGeometry(),this._bindParameters.cullAboveTerrain=e)),this._nodes.precompile(R.FOCUSAREA),this._needsHUDVisibility&&this._plugins.precompile(12),this._plugins.precompile(15),this._precompileHUD(0),this._bindParameters.terrainDepthTest=!1,this._bindParameters.cullAboveTerrain=!1,this._nodes.precompile(R.VIEWSHED,R.CUTFILL_DEPTH,R.CUTFILL_COLOR,R.LASERLINES,R.FOCUSAREA_COLOR,R.OCCLUDED,R.ANTIALIASING,R.HIGHLIGHTS);const i=this._bindParameters;i.highlightMixTexture=i.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(1),this._hasHighlights&&(i.highlights.forEach((e,t)=>{i.highlightLevel=t,this._precompileAllGeometry(9)}),i.highlightLevel=null),i.highlightMixTexture=null,this._nodes.precompile(I.COMPOSITE,R.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(8),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(R.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(le.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._renderContext.output;++this._techniques.precompiling;const t=this._framebufferSize;let r=this.fboCache.acquire(t.width,t.height,"olid");return r.acquireDepth(13),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(le.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=0===e;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const s=Math.max(e,i);this._animationTimestep.frame(s,r)}}readMainDepth(e,t){const{mainDepth:r,camera:i}=this._bindParameters;if(!r)return;const s=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear depth");this._rctx.bindFramebuffer(s.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(y),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),s.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,_e.UNSIGNED_BYTE,t),s.release()}readHUDVisibility(e,t,r,i,s){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,i,6408,_e.UNSIGNED_BYTE,s)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._renderContext.output,i=this._framebufferSize,s=this.fboCache.acquire(i.width,i.height,"edges"),a=()=>t.render(this._bindParameters,e),n=this._bindParameters.geometryDepth;this.renderToTargets(a,s,n??this._framebuffer.depth,y),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,s.getTexture(),N(r)?1:0),s.release(),this.performanceInfo.advance(1===e?le.OPAQUE_EDGES:le.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(),this._bindParameters.overlay&&this.performanceInfo.advance(le.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const{contentCamera:i}=this._bindParameters,s=this._shadowMap;s.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(6,this._shadowMap),s.copySnapshot(1),this._renderShadowCascades(5,this._shadowMap)):this._renderShadowCascades(4),s.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,i),this.performanceInfo.advance(le.SHADOW_MAP)}_renderHighlightShadowMap(e,t,r){if(!this.shadowsEnabled||!this._needsShadowHighlight)return;const{contentCamera:i}=this._bindParameters,s=this._shadowMap;s.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._renderShadowCascades(5,this._shadowMap),s.moveSnapshot(0),s.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,i),this.performanceInfo.advance(le.SHADOW_MAP)}_renderCutFillDepth(){return this._nodes.produce(R.CUTFILL_DEPTH,this._pluginInput)}_precompileShadowCascades(e){for(const t of this._shadowMap.cascades)t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.camera),this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){t.bindFbo();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(2)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._shadowAccumulator.active||this._debugNeedsDepth}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");e?(this._pluginInput.set(R.SSAO,this._renderSSAO()),this._needsDepth?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(2),d(this._bindParameters.depth),this._bindParameters.depth=e.obtainDepthTexture(),this.performanceInfo.advance(le.DEPTH)):(e.detachDepth(),this._bindParameters.depth=d(this._bindParameters.depth)),this.hasSSAO&&this._pluginInput.release("normals")):this._renderAllGeometryDepth()}_renderAllGeometryDepth(){if(!this._needsDepth)return void(this._bindParameters.depth=d(this._bindParameters.depth));const e=this._framebufferSize,t=this.fboCache.acquire(e.width,e.height,"geometry depth",13);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(1280),this.renderAllGeometry(2),d(this._bindParameters.depth),this._bindParameters.depth=t.obtainDepthTexture(),t.release(),this.performanceInfo.advance(le.DEPTH)}_renderTerrainDepth(e){if(this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,!e)return void(this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth));const t=this._renderContext.output;this._renderContext.output=2;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"terrain depth",13);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(1280),this._renderTransparentTerrain(),d(this._bindParameters.terrainDepth),this._bindParameters.terrainDepth=i.obtainDepthTexture(),this._renderContext.output=t,i.release()}_renderGeometryDepth(e){if(!e)return void(this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth));const t=this._renderContext.output,{width:r,height:i}=this._framebufferSize,s=this.fboCache.acquire(r,i,"geometry depth",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this._renderOpaqueAndTransparentGeometry(2),this._renderContext.output=t,d(this._bindParameters.geometryDepth),this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsShadowDepthRange(){return this._shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return Z.Zero;const t=J(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=Z.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<O)return void(this.sceneDepthRange.value=Z.Infinite);const t=e.clone();t.near=v,t.far=1e10;const r=J(t,this._plugins.plugins,this.stage.layers,1);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(r)||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",I.FINAL,I.COMPOSITE,I.OPAQUE,I.TRANSPARENT,R.VIEWSHED,R.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(3),this._needsDepth&&this._precompileAllGeometry(2),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(5),this._precompileShadowCascades(6),this._precompileShadowCascades(5)):this._precompileShadowCascades(4)),this._shadowAccumulator.active&&this._precompileAllGeometry(4)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"normals",5);r.acquireDepth(13),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(y,!0,!0),this._renderGeometryWithNormals(3);const i=this._nodes.optional("normals",I.FINAL,I.COMPOSITE,I.OPAQUE,I.TRANSPARENT,R.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(le.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return;const t=this._nodes.produce(R.SSAO,this._pluginInput);return this._bindParameters.ssao=t,t&&this.performanceInfo.advance(le.SSAO),t}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(6),this._plugins.precompile(7),this._renderContext.output=t}renderAllGeometry(e){this._renderContext.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentTerrain()}precompileSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const r of t)this._renderContext.renderOccludedMask=r,this.precompileSlots(e,...Pe);this._renderContext.renderOccludedMask=ee}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(9),this.renderSlots(e,...Pe),this._renderContext.renderOccludedMask=ee}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(13)}precompileViewshedShadowMap(){this._precompileAllGeometry(7)}precompileCutFill(){const e=8,t=this._renderContext.output;this._renderContext.output=e,this._plugins.precompile(0,1,6),this._renderContext.output=t}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(7),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._renderContext.output=i}renderCutFillReferenceDepth(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._renderContext.output=8,this._plugins.render(0,1),this._plugins.render(6),this._ensureBindParametersCamera(t,r),t.setGLViewport(this._rctx),this._renderContext.output=i}_renderOpaqueAndTransparentGeometry(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithNormals(e){this._renderContext.output=e,this._plugins.render(...ce),this._renderTransparentTerrain()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(...ge)}_precompileOpaqueGeometry(){this._plugins.precompile(...fe),this._nodes.precompile("opaque-color")}_renderOpaqueGeometry(){this._plugins.render(...fe)}_renderTransparentGeometry(){this._plugins.render(...be)}get _hasTransparentTerrain(){return this._plugins.produces(0,6)}get _hasTransparentIntegratedMesh(){return this._plugins.produces(this._renderContext.output,7)}_renderTransparentTerrain(){const e=()=>this._plugins.render(6);if(!G(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent terrain");return this.renderToTargets(e,r,this._framebuffer.depth,y),r}_renderTransparentIntegratedMesh(){const e=()=>this._plugins.render(7);if(!G(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent integrated mesh");return this.renderToTargets(e,r,this._framebuffer.depth,y),r}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,12)}_renderHUDVisibility(){if(!this._needsHUDVisibility)return void(this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility));const{width:e,height:t}=this._framebufferSize;let r=this._bindParameters.hudVisibility;r?.fbo?.width===e&&r?.fbo?.height===t||(r?.release(),r=this.fboCache.acquire(e,t,"hud visibility",4),this._bindParameters.hudVisibility=r);const i=this._bindParameters.geometryDepth;r.attachDepth(i||this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(12),r.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(le.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,0===e){const e=()=>this._plugins.render(15),t=this._framebufferSize,r=this.fboCache.acquireDepth(12,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(15)}_precompileHUD(e){if(this._precompileHUDOutput(e),this._hasHighlights){const t=this._renderContext.output;this._renderContext.output=9,this._precompileHUDOutput(e),this._renderContext.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this._oitEnabled&&G(this._renderContext.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...Ce),this._bindParameters.oitPass=2,this._plugins.precompile(...Ce),this._bindParameters.oitPass=0):this._plugins.precompile(...Ce),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t,r){if(this._pluginsHas.hudElements){if(this._oitEnabled){const i=this._renderOIT(1,r,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,i.getTexture()),i.release()}else if(this._renderContext.output=r,0===e){const t=()=>this._renderHUDElements(e),r=this._framebufferSize,i=this.fboCache.acquireDepth(12,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(12),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(0===e?le.HUD_OCCLUDED:le.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ce)}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(5,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,i=this._framebufferSize,{highlights:s}=r,a=e.acquire(i.width,i.height,"highlights",s.length>B?3:1);a.acquireDepth(13),t.bindFramebuffer(a.fbo);const{gl:n}=t;return n.clearBufferuiv(n.COLOR,0,[0,0,0,0]),this._renderContext.output=9,t.bindFramebuffer(a.fbo),k(t,e,i,r,()=>this._renderHighlightGeometries()),this.performanceInfo.advance(le.HIGHLIGHTS),a}_renderHighlightGeometries(){this._plugins.render(...we),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t,r,i){this._shadowAccumulator.updateDepthRange(e),this._shadowAccumulator.accumulating&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,t,r,i)&&this.performanceInfo.advance(le.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this._oitEnabled&&G(this._renderContext.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...be),this._bindParameters.oitPass=2,this._plugins.precompile(...be),this._bindParameters.oitPass=0):this._plugins.precompile(...be)}_renderOIT(e,t,r=2){const i=1===e,s=this._framebufferSize,a=i?this.fboCache.acquire(s.width,s.height,"oit hud composite"):null,n=i?()=>this._renderHUDElements(r):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=this._renderContext.output;this._renderContext.output=t,h.oitPass=1;const d=a?"oit hud color+alpha":"oit color+alpha",l=this.fboCache.acquire(s.width,s.height,d,8),_=1===t;_&&l.acquireColor(ue,8,"oit emissive"),l.acquireColor(_?pe:ue,7),a||l.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(l.fbo),this._rctx.clearFramebuffer([0,0,0,1]),_&&this._rctx.clearBuffer(1,x),n(),l.detachDepth(),h.oitPass=2;const u=this.fboCache.acquire(s.width,s.height,a?"oit hud front":"oit front");return _&&u.acquireColor(ue,8,"oit emissive front"),a?u.acquireDepth(12):u.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(u.fbo),this._rctx.clearFramebuffer(y,!!a),n(),u.detachDepth(),h.oitPass=0,a?(this._rctx.bindFramebuffer(a.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):this._framebuffer.bind(),this._oitblend??=new z(this._techniques),this._oitblend.blend(this._rctx,l,u,h,_,!i),a?.detachDepth(),u.release(),l.release(),this._renderContext.output=o,a}_renderOpaque(e){const t=this.plugins.produces(0,...fe);if(t){this._plugins.render(0,1);const e=this._framebuffer;e.update(e=>this._renderNodes(R.CUTFILL_COLOR,e)),e.update(e=>this._renderNodes(R.OPAQUE_TERRAIN,e)),e.bind(),this._plugins.render(2,3)}const r=this._framebuffer;this._renderTerrainDepth(e),r.update(e=>this._renderNodes(I.OPAQUE,e,t)),this.fboCache.debugCallback?.(I.OPAQUE,r.color.fbo),r.update(e=>this._renderNodes(R.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(R.OPAQUE_ENVIRONMENT,r.color.fbo),this._renderEdges(1)}_renderTransparent(e,t,r){const i=this._framebuffer;i.bind(),this._renderPlugins(20,le.VOXEL),this._renderHiddenTransparentEdges(),e&&(this._oitEnabled?this._renderOIT(0,r):this._renderTransparentGeometry()),i.update(t=>this._renderNodes(I.TRANSPARENT,t,e)),this.fboCache.debugCallback?.(I.TRANSPARENT,i.color.fbo),this._renderGeometryDepth(t),this._renderHUDVisibility(),t||this._plugins.render(15),this._renderEdges(0);const s=this._hasTransparentTerrain?this._renderTransparentTerrain():null;s&&(this.performanceInfo.advance(le.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(t?this._renderLineCallouts(0):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,s.getTexture())),this._renderHUD(0,i.color,r))),this._bindParameters.cullAboveTerrain=!1,s&&(i.bind(),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,s.getTexture()),s.release(),t&&(this._renderEdges(1),e&&(this._oitEnabled?this._renderOIT(0,r):this._renderTransparentGeometry(),this.performanceInfo.advance(le.TRANSPARENT)),this._renderEdges(0)));const a=this._hasTransparentIntegratedMesh?this._renderTransparentIntegratedMesh():null;a&&(i.bind(),this._compositingHelper.composite(this._bindParameters,a.getTexture(),N(r)?1:0),a.release()),this._bindParameters.ssao=d(this._bindParameters.ssao),t&&this._renderLineCallouts(1),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(le.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(8),this.performanceInfo.advance(le.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),i}blitFBO(e,t=M,r=!0){return this._blit??=new j(this._techniques),this._blit.blit(this._rctx,e,t,this._bindParameters),this._pluginInput.set(e.name,t),r&&e.release(),t}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=T:(C(Se,this._bindParameters.camera.viewMatrix),C(Te,this._bindParameters.camera.projectionMatrix),w(Ee,Se,Te),w(Ee,this._renderContext.lastFrameCamera.viewMatrix,Ee),w(Ee,this._renderContext.lastFrameCamera.projectionMatrix,Ee),this._reprojectionMatrix=Ee);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=T,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,i){this._bindParameters.updateLighting(e,t,r,i),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,i,s=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(i,s,a),e(),t.detachDepth()}get test(){}};e([f({readOnly:!0})],me.prototype,"fullResolutionAtmosphere",null),e([f()],me.prototype,"_edgeView",void 0),e([f()],me.prototype,"updating",null),me=e([b("esri.views.3d.webgl-engine.lib.Renderer")],me);const ce=[0,1,2,4],ge=[3,5],fe=[0,1,2,3],be=[4,5],Pe=[2,4,8],Ce=[16,13,14],we=[4,5,2,3,6,0,1],Te=S(),Se=S(),Ee=S();function xe(e){return t=>e.immediate.schedule(t)}export{me as Renderer};
5
+ import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as i}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{clamp as s,lerp as a}from"../../../../core/mathUtils.js";import{removeMaybe as n,abortMaybe as h,destroyMaybe as o,releaseMaybe as d}from"../../../../core/maybe.js";import{throwIfAborted as l}from"../../../../core/promiseUtils.js";import{watch as _,syncAndInitial as u,initial as p,sync as m}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{Milliseconds as g}from"../../../../core/time.js";import{property as f}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as b}from"../../../../core/accessorSupport/decorators/subclass.js";import{equals as P,invert as C,multiply as w}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as T,create as S}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as E}from"../../../../chunks/vec42.js";import{ZEROS as x}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{fromValues as A,ZEROS as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as D}from"../../../../geometry/support/Indices.js";import{RenderCategory as I,InternalRenderCategory as R}from"../../webgl.js";import{innerAtmosphereFadeStart as O}from"../../environment/atmosphereUtils.js";import{minNearDistanceInMeters as v}from"../../state/NearFarHeuristic.js";import{debugFlags as F}from"../../support/debugFlags.js";import{FBOCache as H,defaultWebGLFBO as M}from"../core/FBOCache.js";import{RenderPassManager as q}from"../core/renderPasses/RenderPassManager.js";import{isColorEmission as N,isColorOrColorEmission as G}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as L}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as V}from"../effects/RenderNodes.js";import{RenderPluginManager as U}from"../effects/RenderPluginManager.js";import{Blit as j}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as B,renderHighlightBuffer as k}from"../effects/highlight/Highlight.js";import{OITBlend as z}from"../effects/transparency/OITBlend.js";import{AnimationTimer as Q}from"./AnimationTimer.js";import{AnimationTimeStep as W}from"./AnimationTimeStep.js";import{BoundingInfo as Y}from"./BoundingInfo.js";import{DepthRange as Z}from"./DepthRange.js";import{depthRangeFromScene as J}from"./depthRangeUtils.js";import{hudFragmentOpacityParameters as K}from"./hudFragmentOpacityParameters.js";import{MainFramebuffer as X}from"./MainFramebuffer.js";import{RenderContext as $,defaultRenderOccludedMask as ee}from"./RenderContext.js";import{RendererBase as te}from"./RendererBase.js";import{setupFeatureDefaults as re}from"./RenderFeature.js";import{RenderPluginInput as ie}from"./RenderPluginInput.js";import{ShadowAccumulator as se}from"./ShadowAccumulator.js";import{ShadowMap as ae}from"./ShadowMap.js";import ne from"./SliceHelper.js";import{MergedRenderer as he}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as oe}from"../parts/renderUtils.js";import{RendererPerformanceInfo as de,PerformanceCategory as le}from"../statistics/RendererPerformanceInfo.js";import{PixelType as _e,ColorAttachment1 as ue,ColorAttachment2 as pe}from"../../../webgl/enums.js";let me=class extends te{constructor(e,t,r,s,a,n){super({stage:e}),this._techniques=r,this._rctx=s,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this.renderPassManager=new q,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=A(0,0,0,1),this._sliceHelper=new ne,this._blit=null,this._oitblend=null,this.sceneDepthRange=c(Z.Infinite),this._state=c(2),this._highQualityTransparencyEnabled=!0,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new W,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._lastFrameTime=g(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new ie,this._releaseNormals=e=>{e.some(({name:e})=>"normals"===e)&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this._fboCache=new H(s),this._renderStateFeatures=c(re(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._framebuffer=new X(this.fboCache),this._performanceInfo=new de(this._rctx),this._shadowMap=new ae(this.fboCache,e.viewingMode),this._shadowAccumulator=new se(this.fboCache,r,e,e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t},(t,r,i)=>{const s=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,r,i,!0,s),this._renderShadowCascades(4,t.shadowMap),t.shadowMap.finish(),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},n),this._renderContext=new $(this._rctx,this._shadowMap,r),this._nodes=new V(this._renderContext),this._plugins=new U({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this._plugins.add(this.renderPassManager),this.addHandles([_(()=>e.view.state.camera,()=>n(),u),_(()=>F.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},n()},p),_(()=>e.view.environment.background?.color,e=>{const t=e?i(e):y;E(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()},u),_(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=L,u),_(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},m),_(()=>this._bindParameters.clouds.data?.state,()=>n(),m),_(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,n()},p)])}destroy(){this._gpuTimerHandle=n(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=h(this._loadEdgeViewTask),this._edgeView=o(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this._fboCache.destroy(),this._fboCache=null,this._plugins.destroy(),this._plugins=null,this._pluginInput=null,this._blit=null,this._oitblend=null,this._compositingHelper=null,this._nodes=null,this._framebuffer=null,this._shadowMap=null,this._renderContext=null,this._performanceInfo=null,Y.prune(),he.prune(),D()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _framebufferSize(){return this._framebuffer.size}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=re(t,e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate(i=>i.set(t,e,r)),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(1)}get hasReflections(){return this._pluginsHas.water&&(this._ssrEnabled||this.isFeatureEnabled(5))}get _hasHighlights(){return this._plugins.produces(9,2,4,18,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(9,13,14)}get hasSSAO(){return(this.stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(4))&&!this._inGlobeView}get hasSMAA(){return this.stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(0)}get hasEmitters(){return this._plugins.hasEmitters&&this.stage.view.qualitySettings.physicallyBasedRenderingEnabled}get fullResolutionAtmosphere(){return this.stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(3)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=d(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=d(this._bindParameters.depth),this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility)}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.readyToRun||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");l(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:xe(this.stage.view.resourceController)});return this.addHandles(_(()=>r.updating,()=>this._requestRender(),m)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(r)),this._edgeViewCallbacks.length=0,r})),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&P(this._bindParameters.ssr.reprojectionMatrix,T)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),e.environment){void 0!==e.environment.weather&&(this._bindParameters.weather=e.environment.weather);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(0,...Ce),has.water=this._plugins.produces(3,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new Q(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?n(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r,i=!1){try{return this._isRendering=!0,this._render(e,t,r,i)}catch(s){console.error(`Exception during rendering: ${s}`)}finally{this._isRendering=!1}return new oe(this._pluginInput.get(I.FINAL),null)}_updateHUDOccludedFragmentOpacity(e,t){const{idleOpacity:r,navigatingOpacity:i,maxDelta:n,tiltFadeStart:h,tiltFadeEnd:o,altitudeStart:d,altitudeEnd:l}=K,_=this.stage.view,u=_.stateManager.camera,p=_.qualitySettings.fadeDuration,m=2===e?r:i,c=s((u.tilt-h)/(o-h),0,1),g=s(((u.position.z??0)-d)/(l-d),0,1),f=a(a(1,m,c),1,g),b=this._bindParameters.hudOccludedFragmentOpacity;if(p<=0||b===f||0===this._lastFrameTime||this._lastFrameTime>t)return this._bindParameters.hudOccludedFragmentOpacity=f,void(this._lastFrameTime=t);const P=t-this._lastFrameTime;this._lastFrameTime=t;const C=Math.max(1-r,Math.abs(r-i)),w=Math.min(C*P/p,n);w>=Math.abs(f-b)?this._bindParameters.hudOccludedFragmentOpacity=f:(this._bindParameters.hudOccludedFragmentOpacity=b+Math.sign(f-b)*w,this._requestRender())}_render(e,t,r,i){const s=0===r;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=s,this._disposeBindBuffers();const{camera:a,contentCamera:n,mode:h,alignPixelEnabled:o}=e;this._state.value=h;const d=this._nodes.produces("magnifier-color"),l=this._nodes.produces(I.FINAL),_=this.hasEmitters,u=_?1:0;this._renderContext.time=t,this._renderContext.output=u,this._bindParameters.oitPass=0,this._bindParameters.alignPixelEnabled=o,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null;const p=!i||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=p?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(R.VIEWSHED),this._bindParameters.cutFillEnabled=this._nodes.produces(R.CUTFILL_DEPTH),this._renderOverlay(),a.setGLViewport(this._rctx);const m=this._framebuffer,c=m.initialize(a.fullWidth,a.fullHeight,this._backgroundColor,_);this.hasReflections?(c?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=c):c?.release(),this._ensureBindParametersCamera(a,n),this._updateHUDOccludedFragmentOpacity(h,t),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!i;const g=this._highQualityTransparency&&this._hasTransparentTerrain,f=this._plugins.produces(0,...be);this._precompilePrepasses(),this.performanceInfo.advance(le.PREPARE);const b=this._computeShadowDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,b),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(b,a,n,!s),this._ensureBindParametersSSR(t),this._precompileShaders(g,f,u),this._renderContext.output=u,m.bind(),this._bindParameters.mainDepth=m.depth.attachment,this._renderOpaque(g),this._renderTransparent(f,g,u),this._shadowMap.disposeMainBuffer(),this._pluginInput.set(R.FOCUSAREA,this._renderFocusAreaGeometry()),this._pluginInput.set(R.CUTFILL_DEPTH,this._renderCutFillDepth()),m.update(e=>this._renderNodes(R.TRANSPARENT_ENVIRONMENT,e)),m.update(e=>this._renderNodes(R.VIEWSHED,e)),m.update(e=>this._renderNodes(R.LASERLINES,e)),m.update(e=>this._renderNodes(R.FOCUSAREA_COLOR,e)),this._pluginInput.release(R.FOCUSAREA),this._pluginInput.release(R.CUTFILL_DEPTH),m.update(e=>this._renderNodes(R.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass()),this._renderHighlightShadowMap(a,this._bindParameters.lighting.mainLight.direction,b);const P=2===r?this._renderObjectAndLayerIdColor():null;m.update(e=>this._renderNodes(I.COMPOSITE,e)),this._shadowMap.disposeOffscreenBuffers();const C=s&&!l&&!(d&&!i),w=this._pluginInput.get(I.COMPOSITE),T=C?M:this.fboCache.acquire(w.fbo.width,w.fbo.height,R.ANTIALIASING),S=this._nodes.produces(R.ANTIALIASING)?this._renderNodes(R.ANTIALIASING,T):this.blitFBO(w,T,!1);let E;this._pluginInput.set(R.ANTIALIASING,S),this._hasHUDHighlights?(this._renderHUD(1,S,u),E=this._renderNodes(R.HIGHLIGHTS,S)):(E=this._renderNodes(R.HIGHLIGHTS,S),this._renderHUD(1,E,u));const x=this._renderNodes(R.MAGNIFIER,E);return s&&d&&!i&&!l&&this.blitFBO(x),l?(x.attachDepth(m.depth),this.blitFBO(this._renderNodes(I.FINAL,x)),x.detachDepth()):this._pluginInput.set(I.FINAL,x),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),m.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),s||(this._releaseFBOs(),this._disposeOffscreenBuffers()),new oe(this._pluginInput.get(I.FINAL),P)}_precompileShaders(e,t,r){++this._plugins.context.techniques.precompiling,this._renderContext.output=r,this._precompileOpaqueGeometry(),this._nodes.precompile(R.OPAQUE_ENVIRONMENT),this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,this._renderContext.output=2,this._plugins.precompile(6),this._plugins.precompile(7),e&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=r,this._plugins.precompile(6),this._plugins.precompile(7),t&&(this._precompileTransparentGeometry(),this._hasTransparentTerrain&&(this._bindParameters.cullAboveTerrain=!1,this._precompileTransparentGeometry(),this._bindParameters.cullAboveTerrain=e)),this._nodes.precompile(R.FOCUSAREA),this._needsHUDVisibility&&this._plugins.precompile(12),this._plugins.precompile(15),this._precompileHUD(0),this._bindParameters.terrainDepthTest=!1,this._bindParameters.cullAboveTerrain=!1,this._nodes.precompile(R.VIEWSHED,R.CUTFILL_DEPTH,R.CUTFILL_COLOR,R.LASERLINES,R.FOCUSAREA_COLOR,R.OCCLUDED,R.ANTIALIASING,R.HIGHLIGHTS);const i=this._bindParameters;i.highlightMixTexture=i.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(1),this._hasHighlights&&(i.highlights.forEach((e,t)=>{i.highlightLevel=t,this._precompileAllGeometry(9)}),i.highlightLevel=null),i.highlightMixTexture=null,this._nodes.precompile(I.COMPOSITE,R.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(8),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(R.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(le.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._renderContext.output;++this._techniques.precompiling;const t=this._framebufferSize;let r=this.fboCache.acquire(t.width,t.height,"olid");return r.acquireDepth(13),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(le.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=0===e;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const s=Math.max(e,i);this._animationTimestep.frame(s,r)}}readMainDepth(e,t){const{mainDepth:r,camera:i}=this._bindParameters;if(!r)return;const s=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear depth");this._rctx.bindFramebuffer(s.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(y),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),s.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,_e.UNSIGNED_BYTE,t),s.release()}readHUDVisibility(e,t,r,i,s){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,i,6408,_e.UNSIGNED_BYTE,s)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._renderContext.output,i=this._framebufferSize,s=this.fboCache.acquire(i.width,i.height,"edges"),a=()=>t.render(this._bindParameters,e),n=this._bindParameters.geometryDepth;this.renderToTargets(a,s,n??this._framebuffer.depth,y),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,s.getTexture(),N(r)?1:0),s.release(),this.performanceInfo.advance(1===e?le.OPAQUE_EDGES:le.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(),this._bindParameters.overlay&&this.performanceInfo.advance(le.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const{contentCamera:i}=this._bindParameters,s=this._shadowMap;s.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(6,this._shadowMap),s.copySnapshot(1),this._renderShadowCascades(5,this._shadowMap)):this._renderShadowCascades(4),s.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,i),this.performanceInfo.advance(le.SHADOW_MAP)}_renderHighlightShadowMap(e,t,r){if(!this.shadowsEnabled||!this._needsShadowHighlight)return;const{contentCamera:i}=this._bindParameters,s=this._shadowMap;s.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._renderShadowCascades(5,this._shadowMap),s.moveSnapshot(0),s.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,i),this.performanceInfo.advance(le.SHADOW_MAP)}_renderCutFillDepth(){return this._nodes.produce(R.CUTFILL_DEPTH,this._pluginInput)}_precompileShadowCascades(e){for(const t of this._shadowMap.cascades)t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.camera),this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){t.bindFbo();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(2)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._shadowAccumulator.active||this._debugNeedsDepth}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");e?(this._pluginInput.set(R.SSAO,this._renderSSAO()),this._needsDepth?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(2),d(this._bindParameters.depth),this._bindParameters.depth=e.obtainDepthTexture(),this.performanceInfo.advance(le.DEPTH)):(e.detachDepth(),this._bindParameters.depth=d(this._bindParameters.depth)),this.hasSSAO&&this._pluginInput.release("normals")):this._renderAllGeometryDepth()}_renderAllGeometryDepth(){if(!this._needsDepth)return void(this._bindParameters.depth=d(this._bindParameters.depth));const e=this._framebufferSize,t=this.fboCache.acquire(e.width,e.height,"geometry depth",13);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(1280),this.renderAllGeometry(2),d(this._bindParameters.depth),this._bindParameters.depth=t.obtainDepthTexture(),t.release(),this.performanceInfo.advance(le.DEPTH)}_renderTerrainDepth(e){if(this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,!e)return void(this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth));const t=this._renderContext.output;this._renderContext.output=2;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"terrain depth",13);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(1280),this._renderTransparentTerrain(),d(this._bindParameters.terrainDepth),this._bindParameters.terrainDepth=i.obtainDepthTexture(),this._renderContext.output=t,i.release()}_renderGeometryDepth(e){if(!e)return void(this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth));const t=this._renderContext.output,{width:r,height:i}=this._framebufferSize,s=this.fboCache.acquire(r,i,"geometry depth",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this._renderOpaqueAndTransparentGeometry(2),this._renderContext.output=t,d(this._bindParameters.geometryDepth),this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsShadowDepthRange(){return this._shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return Z.Zero;const t=J(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=Z.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<O)return void(this.sceneDepthRange.value=Z.Infinite);const t=e.clone();t.near=v,t.far=1e10;const r=J(t,this._plugins.plugins,this.stage.layers,1);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(r)||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",I.FINAL,I.COMPOSITE,I.OPAQUE,I.TRANSPARENT,R.VIEWSHED,R.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(3),this._needsDepth&&this._precompileAllGeometry(2),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(5),this._precompileShadowCascades(6),this._precompileShadowCascades(5)):this._precompileShadowCascades(4)),this._shadowAccumulator.active&&this._precompileAllGeometry(4)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"normals",5);r.acquireDepth(13),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(y,!0,!0),this._renderGeometryWithNormals(3);const i=this._nodes.optional("normals",I.FINAL,I.COMPOSITE,I.OPAQUE,I.TRANSPARENT,R.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(le.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return;const t=this._nodes.produce(R.SSAO,this._pluginInput);return this._bindParameters.ssao=t,t&&this.performanceInfo.advance(le.SSAO),t}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(6),this._plugins.precompile(7),this._renderContext.output=t}renderAllGeometry(e){this._renderContext.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentTerrain()}precompileSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const r of t)this._renderContext.renderOccludedMask=r,this.precompileSlots(e,...Pe);this._renderContext.renderOccludedMask=ee}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(9),this.renderSlots(e,...Pe),this._renderContext.renderOccludedMask=ee}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(13)}precompileViewshedShadowMap(){this._precompileAllGeometry(7)}precompileCutFill(){const e=8,t=this._renderContext.output;this._renderContext.output=e,this._plugins.precompile(0,1,6),this._renderContext.output=t}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(7),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._renderContext.output=i}renderCutFillReferenceDepth(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._renderContext.output=8,this._plugins.render(0,1),this._plugins.render(6),this._ensureBindParametersCamera(t,r),t.setGLViewport(this._rctx),this._renderContext.output=i}_renderOpaqueAndTransparentGeometry(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithNormals(e){this._renderContext.output=e,this._plugins.render(...ce),this._renderTransparentTerrain()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(...ge)}_precompileOpaqueGeometry(){this._plugins.precompile(...fe),this._nodes.precompile("opaque-color")}_renderOpaqueGeometry(){this._plugins.render(...fe)}_renderTransparentGeometry(){this._plugins.render(...be)}get _hasTransparentTerrain(){return this._plugins.produces(0,6)}get _hasTransparentIntegratedMesh(){return this._plugins.produces(this._renderContext.output,7)}_renderTransparentTerrain(){const e=()=>this._plugins.render(6);if(!G(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent terrain");return this.renderToTargets(e,r,this._framebuffer.depth,y),r}_renderTransparentIntegratedMesh(){const e=()=>this._plugins.render(7);if(!G(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent integrated mesh");return this.renderToTargets(e,r,this._framebuffer.depth,y),r}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,12)}_renderHUDVisibility(){if(!this._needsHUDVisibility)return void(this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility));const{width:e,height:t}=this._framebufferSize;let r=this._bindParameters.hudVisibility;r?.fbo?.width===e&&r?.fbo?.height===t||(r?.release(),r=this.fboCache.acquire(e,t,"hud visibility",4),this._bindParameters.hudVisibility=r);const i=this._bindParameters.geometryDepth;r.attachDepth(i||this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(12),r.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(le.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,0===e){const e=()=>this._plugins.render(15),t=this._framebufferSize,r=this.fboCache.acquireDepth(12,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(15)}_precompileHUD(e){if(this._precompileHUDOutput(e),this._hasHighlights){const t=this._renderContext.output;this._renderContext.output=9,this._precompileHUDOutput(e),this._renderContext.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this._oitEnabled&&G(this._renderContext.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...Ce),this._bindParameters.oitPass=2,this._plugins.precompile(...Ce),this._bindParameters.oitPass=0):this._plugins.precompile(...Ce),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t,r){if(this._pluginsHas.hudElements){if(this._oitEnabled){const i=this._renderOIT(1,r,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,i.getTexture(),0),i.release()}else if(this._renderContext.output=r,0===e){const t=()=>this._renderHUDElements(e),r=this._framebufferSize,i=this.fboCache.acquireDepth(12,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(12),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(0===e?le.HUD_OCCLUDED:le.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ce)}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(5,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,i=this._framebufferSize,{highlights:s}=r,a=e.acquire(i.width,i.height,"highlights",s.length>B?3:1);a.acquireDepth(13),t.bindFramebuffer(a.fbo);const{gl:n}=t;return n.clearBufferuiv(n.COLOR,0,[0,0,0,0]),this._renderContext.output=9,t.bindFramebuffer(a.fbo),k(t,e,i,r,()=>this._renderHighlightGeometries()),this.performanceInfo.advance(le.HIGHLIGHTS),a}_renderHighlightGeometries(){this._plugins.render(...we),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t,r,i){this._shadowAccumulator.updateDepthRange(e),this._shadowAccumulator.accumulating&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,t,r,i)&&this.performanceInfo.advance(le.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this._oitEnabled&&G(this._renderContext.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...be),this._bindParameters.oitPass=2,this._plugins.precompile(...be),this._bindParameters.oitPass=0):this._plugins.precompile(...be)}_renderOIT(e,t,r=2){const i=1===e,s=this._framebufferSize,a=i?this.fboCache.acquire(s.width,s.height,"oit hud composite"):null,n=i?()=>this._renderHUDElements(r):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=this._renderContext.output;this._renderContext.output=t,h.oitPass=1;const d=a?"oit hud color+alpha":"oit color+alpha",l=this.fboCache.acquire(s.width,s.height,d,8),_=1===t;_&&l.acquireColor(ue,8,"oit emissive"),l.acquireColor(_?pe:ue,7),a||l.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(l.fbo),this._rctx.clearFramebuffer([0,0,0,1]),_&&this._rctx.clearBuffer(1,x),n(),l.detachDepth(),h.oitPass=2;const u=this.fboCache.acquire(s.width,s.height,a?"oit hud front":"oit front");return _&&u.acquireColor(ue,8,"oit emissive front"),a?u.acquireDepth(12):u.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(u.fbo),this._rctx.clearFramebuffer(y,!!a),n(),u.detachDepth(),h.oitPass=0,a?(this._rctx.bindFramebuffer(a.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):this._framebuffer.bind(),this._oitblend??=new z(this._techniques),this._oitblend.blend(this._rctx,l,u,h,_,!i),a?.detachDepth(),u.release(),l.release(),this._renderContext.output=o,a}_renderOpaque(e){const t=this.plugins.produces(0,...fe);if(t){this._plugins.render(0,1);const e=this._framebuffer;e.update(e=>this._renderNodes(R.CUTFILL_COLOR,e)),e.update(e=>this._renderNodes(R.OPAQUE_TERRAIN,e)),e.bind(),this._plugins.render(2,3)}const r=this._framebuffer;this._renderTerrainDepth(e),r.update(e=>this._renderNodes(I.OPAQUE,e,t)),this.fboCache.debugCallback?.(I.OPAQUE,r.color.fbo),r.update(e=>this._renderNodes(R.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(R.OPAQUE_ENVIRONMENT,r.color.fbo),this._renderEdges(1)}_renderTransparent(e,t,r){const i=this._framebuffer;i.bind(),this._renderPlugins(20,le.VOXEL),this._renderHiddenTransparentEdges(),e&&(this._oitEnabled?this._renderOIT(0,r):this._renderTransparentGeometry()),i.update(t=>this._renderNodes(I.TRANSPARENT,t,e)),this.fboCache.debugCallback?.(I.TRANSPARENT,i.color.fbo),this._renderGeometryDepth(t),this._renderHUDVisibility(),t||this._plugins.render(15),this._renderEdges(0);const s=this._hasTransparentTerrain?this._renderTransparentTerrain():null;s&&(this.performanceInfo.advance(le.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(t?this._renderLineCallouts(0):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,s.getTexture())),this._renderHUD(0,i.color,r))),this._bindParameters.cullAboveTerrain=!1,s&&(i.bind(),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,s.getTexture(),N(r)?1:0),s.release(),t&&(this._renderEdges(1),e&&(this._oitEnabled?this._renderOIT(0,r):this._renderTransparentGeometry(),this.performanceInfo.advance(le.TRANSPARENT)),this._renderEdges(0)));const a=this._hasTransparentIntegratedMesh?this._renderTransparentIntegratedMesh():null;a&&(i.bind(),this._compositingHelper.composite(this._bindParameters,a.getTexture(),N(r)?1:0),a.release()),this._bindParameters.ssao=d(this._bindParameters.ssao),t&&this._renderLineCallouts(1),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(le.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(8),this.performanceInfo.advance(le.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),i}blitFBO(e,t=M,r=!0){return this._blit??=new j(this._techniques),this._blit.blit(this._rctx,e,t,this._bindParameters),this._pluginInput.set(e.name,t),r&&e.release(),t}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=T:(C(Se,this._bindParameters.camera.viewMatrix),C(Te,this._bindParameters.camera.projectionMatrix),w(Ee,Se,Te),w(Ee,this._renderContext.lastFrameCamera.viewMatrix,Ee),w(Ee,this._renderContext.lastFrameCamera.projectionMatrix,Ee),this._reprojectionMatrix=Ee);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=T,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,i){this._bindParameters.updateLighting(e,t,r,i),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,i,s=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(i,s,a),e(),t.detachDepth()}get test(){}};e([f({readOnly:!0})],me.prototype,"fullResolutionAtmosphere",null),e([f()],me.prototype,"_edgeView",void 0),e([f()],me.prototype,"updating",null),me=e([b("esri.views.3d.webgl-engine.lib.Renderer")],me);const ce=[0,1,2,4],ge=[3,5],fe=[0,1,2,3],be=[4,5],Pe=[2,4,8],Ce=[16,13,14],we=[4,5,2,3,6,0,1],Te=S(),Se=S(),Ee=S();function xe(e){return t=>e.immediate.schedule(t)}export{me as Renderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import e from"../../../../core/Accessor.js";import{sliceEquals as r}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{smoothstep as i}from"../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{watch as o,sync as a}from"../../../../core/reactiveUtils.js";import{signal as n}from"../../../../core/signal.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as u,G as l}from"../../../../chunks/vec32.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ReadShadowMapPassParameters as _}from"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{BindParameters as p}from"./BindParameters.js";import{DepthRange as d}from"./DepthRange.js";import{createQuadVAO as f}from"./glUtil3D.js";import{ShadowCastRenderer as g,shadowCastDisabledElevationThreshold as b,shadowCastDisableElevationMax as v,shadowCastDisableElevationMin as S}from"./ShadowCastRenderer.js";import{ShadowMap as w}from"./ShadowMap.js";import{S as y}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as F}from"../shaders/ShadowCastAccumulateTechnique.js";import{ShadowCastAccumulateTechniqueConfiguration as A}from"../shaders/ShadowCastAccumulateTechniqueConfiguration.js";import{ShadowCastClearTechnique as x}from"../shaders/ShadowCastClearTechnique.js";import{TaskPriority as R}from"../../../support/Scheduler.js";import{SizedPixelFormat as C,PixelType as j}from"../../../webgl/enums.js";import{FramebufferObject as P}from"../../../webgl/FramebufferObject.js";import{TextureDescriptor as q}from"../../../webgl/TextureDescriptor.js";let T=class extends e{updateDepthRange(t){this._depthRange.equals(t)||(this._depthRange=t)}constructor(t,e,r,i,s,n){super({}),this.fbos=t,this._techniques=e,this._stage=r,this._prepareForShadowMapPass=i,this._renderToShadowMap=s,this._requestRender=n,this._primarySet=new M(new A(0),()=>this._requestRenderIfEnabled()),this._contextSet=new M(new A(1),()=>this._requestRenderIfEnabled()),this._passParameters=new _,this._depthRange=d.Zero,this._previewing=!1,this._shadowAccumulatorKey=Symbol("shadowAccumulator"),this._rctx=t.rctx,this._bindParameters=new p(new w(t,r.viewingMode)),this._bindParameters.shadowMap.enabled=!0,this._vao=f(this._rctx),this._accumulationRenderer=new g(e,this._rctx,this,n);const h=this._stage.view.resourceController.scheduler;this.addHandles([h.registerTask(R.SHADOW_ACCUMULATOR,this),o(()=>this._previewing,()=>this._requestRenderIfEnabled(),a),o(()=>2===this._numActive,()=>this._numActiveChanged(),a),o(()=>this._depthRange,()=>this._invalidateAccumulationSets(),a)],this._shadowAccumulatorKey);for(const o of this._accumulationSets())o.precompile(e)}*_accumulationSets(){yield this._primarySet,yield this._contextSet}normalizeCtorArgs(){return{}}destroy(){this._disable(),this.removeHandles(this._shadowAccumulatorKey),this._accumulationRenderer=s(this._accumulationRenderer),this._bindParameters.shadowMap.dispose(),this._fbo=s(this._fbo),this._vao=s(this._vao);for(const t of this._accumulationSets())t.destroy();this._contextSet=null,this._primarySet=null,this._bindParameters.destroy()}get computedSamples(){return[this._primarySet.progress,this._contextSet.progress]}get shadowCastTexture(){return this._fbo?.colorTexture}get accumulating(){return this.active&&this._previewing||this._refining}get _refining(){return this.active&&!this._doneAccumulating&&!this._previewing}get active(){return null!=this._fbo&&[...this._accumulationSets()].some(t=>t.active)}get canAccumulate(){return null!=this._bindParameters.depth&&this._depthRange!==d.Zero&&this._opacityFromElevation>b}get _doneAccumulating(){return[...this._accumulationSets()].every(t=>t.doneAccumulating)}get _opacityFromElevation(){return this._accumulationRenderer.opacityFromElevation}set _opacityFromElevation(t){this._accumulationRenderer.opacityFromElevation=t}get _numActive(){return[...this._accumulationSets()].reduce((t,e)=>t+(e.active?1:0),0)}get _pixelFormat(){return 2===this._numActive?{pixelFormat:33319,internalFormat:C.RG8}:{pixelFormat:6403,internalFormat:C.R8}}get readyToRun(){return this._refining&&this.canAccumulate&&[...this._accumulationSets()].some(t=>t.running)}runTask(t){this._clearBuffersOnAccumulationStart(),this._prepareForShadowMapPass(this._bindParameters);let e=!1;for(const r of this._accumulationSets())this._runTaskForSet(r,t)&&(e=!0);e&&this._requestRender()}_runTaskForSet(t,e){let r=!1;for(;!e.done&&!t.doneAccumulating;)this._accumulateShadow(t),e.madeProgress(),r=!0;return r}renderAccumulation(t,e,r,i){return this._updateCamera(e),this._bindParameters.contentCamera=r,this._bindParameters.depth=t,this._passParameters.origin=this._bindParameters.camera.center,this.notifyChange("canAccumulate"),!(!this.accumulating||!this.canAccumulate)&&(this._previewing||i?(this._clearFramebuffer(),this._reset()):this._clearBuffersOnAccumulationStart(),this._accumulateSetsForRenderFrame(i))}_clearBuffersOnAccumulationStart(){if([...this._accumulationSets()].every(t=>0===t.progress))this._clearFramebuffer();else for(const t of this._accumulationSets())0===t.progress&&this._clearFramebufferForSet(this._fbo,t)}_accumulateSetsForRenderFrame(t){let e=!1;for(const r of this._accumulationSets())this._accumulateSetForRenderFrame(r,t)&&(e=!0);return e&&this._requestRender(),e}_accumulateSetForRenderFrame(t,e){let r=e?t.sampleCount:Math.min(D,t.sampleCount);r-=t.progress;for(let i=0;i<r;++i)this._accumulateShadow(t);return r>0}precompile(){this._accumulationRenderer.precompile()}render(t){this._accumulationRenderer.render(t)}setOptions(t){void 0!==t.previewing&&(this._previewing=t.previewing),void 0!==t.lightDirections&&(this._primarySet.lightDirections=t.lightDirections),void 0!==t.lightDirectionsContext&&(this._contextSet.lightDirections=t.lightDirectionsContext),!0===t.enabled?this._enable():!1===t.enabled&&this._disable(),this._accumulationRenderer.setOptions(t)}readAccumulatedShadow(t,e){const r=this._primarySet.progress;return!this.active||!this._fbo||r<1||t<0||t>=this._fbo.width||e<0||e>=this._fbo.height?0:(this._fbo.readPixels(t,e,1,1,6408,j.UNSIGNED_BYTE,E),E[0]/r)}_numActiveChanged(){if(!this._fbo)return;const t=2===this._numActive,e=this._createFBO();e.resize(this._fbo.width,this._fbo.height),t&&(this._clearFramebuffer(e),this._contextSet.reset()),this._fbo.width&&this._fbo.height&&this._rctx.blitFramebuffer(this._fbo,e),this._fbo.dispose(),this._fbo=e,this._requestRender()}_enable(){this._fbo||(this._fbo=this._createFBO(),this._invalidateAccumulationSets())}_createFBO(){const{pixelFormat:t,internalFormat:e}=this._pixelFormat,r=new q;return r.pixelFormat=t,r.internalFormat=e,r.wrapMode=33071,new P(this._rctx,r)}_invalidateAccumulationSets(){for(const t of this._accumulationSets())t.reset();this._requestRenderIfEnabled()}_disable(){this._fbo&&(this._fbo=s(this._fbo),this._requestRender())}_reset(){for(const t of this._accumulationSets())t.reset()}_clearFramebuffer(t=this._fbo){t&&t.width&&t.height&&(this._rctx.bindFramebuffer(t),this._rctx.setClearColor(0,0,0,0),this._rctx.clear(16384))}_clearFramebufferForSet(t,e){if(!t)return;const r=this._techniques.get(x,e.configuration);this._rctx.bindFramebuffer(t),this._rctx.bindTechnique(r,this._bindParameters,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(r.primitiveType,0,this._vao.vertexCount("geometry"))}_accumulateShadow(t){this._renderToShadowMap(this._bindParameters,t.lightDirections[t.progress++],this._depthRange);const e=this._techniques.get(F,t.configuration);this._rctx.bindFramebuffer(this._fbo),this._rctx.bindTechnique(e,this._bindParameters,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(e.primitiveType,0,this._vao.vertexCount("geometry"))}_updateCamera(t){const e=this._fbo;if(null==e)return;const r=this._bindParameters.camera;t.equals(r)||r.copyFrom(t),e.resize(t.fullWidth,t.fullHeight),this._opacityFromElevation=1-i(S,v,t.relativeElevation)}_requestRenderIfEnabled(){this._fbo&&this._requestRender()}get test(){}};t([h()],T.prototype,"_fbo",void 0),t([h()],T.prototype,"_depthRange",void 0),t([h()],T.prototype,"_previewing",void 0),t([h()],T.prototype,"_accumulationRenderer",void 0),t([h()],T.prototype,"_refining",null),t([h()],T.prototype,"active",null),t([h()],T.prototype,"canAccumulate",null),t([h()],T.prototype,"_doneAccumulating",null),t([h()],T.prototype,"_opacityFromElevation",null),t([h()],T.prototype,"_numActive",null),t([h()],T.prototype,"_pixelFormat",null),t([h()],T.prototype,"readyToRun",null),T=t([c("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],T);const D=6,E=new Uint8Array(4);class M{constructor(t,e){this.configuration=t,this._notifyChange=e,this._cachedLightDirections=[],this._progress=n(0),this._sampleCount=n(0)}get progress(){return this._progress.value}set progress(t){this._progress.value=t}get sampleCount(){return this._sampleCount.value}get doneAccumulating(){return this.progress>=this.sampleCount}get running(){return this.progress>0}get active(){return this.sampleCount>0}get lightDirections(){return this._cachedLightDirections}set lightDirections(t){const e=this._cachedLightDirections,i=Math.min(y,t.length);if(!r(e,0,e.length,t,0,i,l)){e.length=i,this._sampleCount.value=i;for(let r=0;r<i;++r)e[r]=u(e[r]??m(),t[r]);this.reset(),this._notifyChange()}}destroy(){this._cachedLightDirections.length=0,this._sampleCount.value=0}reset(){this.progress=0}precompile(t){t.precompile(F,this.configuration),t.precompile(x,this.configuration)}}export{T as ShadowAccumulator};
5
+ import{__decorate as t}from"tslib";import e from"../../../../core/Accessor.js";import{sliceEquals as r}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{smoothstep as i}from"../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{watch as o,sync as a}from"../../../../core/reactiveUtils.js";import{signal as n}from"../../../../core/signal.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{d as u,G as l}from"../../../../chunks/vec32.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ReadShadowMapPassParameters as _}from"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{BindParameters as p}from"./BindParameters.js";import{DepthRange as d}from"./DepthRange.js";import{createQuadVAO as f}from"./glUtil3D.js";import{ShadowCastRenderer as g,shadowCastDisabledElevationThreshold as b,shadowCastDisableElevationMax as v,shadowCastDisableElevationMin as S}from"./ShadowCastRenderer.js";import{ShadowMap as w}from"./ShadowMap.js";import{S as y}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as F}from"../shaders/ShadowCastAccumulateTechnique.js";import{ShadowCastAccumulateTechniqueConfiguration as A}from"../shaders/ShadowCastAccumulateTechniqueConfiguration.js";import{ShadowCastClearTechnique as x}from"../shaders/ShadowCastClearTechnique.js";import{TaskPriority as R}from"../../../support/Scheduler.js";import{SizedPixelFormat as C,PixelType as j}from"../../../webgl/enums.js";import{FramebufferObject as P}from"../../../webgl/FramebufferObject.js";import{TextureDescriptor as q}from"../../../webgl/TextureDescriptor.js";let T=class extends e{updateDepthRange(t){this._depthRange.equals(t)||(this._depthRange=t)}constructor(t,e,r,i,s,n){super({}),this.fbos=t,this._techniques=e,this._stage=r,this._prepareForShadowMapPass=i,this._renderToShadowMap=s,this._requestRender=n,this._primarySet=new M(new A(0),()=>this._requestRenderIfEnabled()),this._contextSet=new M(new A(1),()=>this._requestRenderIfEnabled()),this._passParameters=new _,this._depthRange=d.Zero,this._previewing=!1,this._shadowAccumulatorKey=Symbol("shadowAccumulator"),this._rctx=t.rctx,this._bindParameters=new p(new w(t,r.viewingMode)),this._bindParameters.shadowMap.enabled=!0,this._vao=f(this._rctx),this._accumulationRenderer=new g(e,this._rctx,this,n);const h=this._stage.view.resourceController.scheduler;this.addHandles([h.registerTask(R.SHADOW_ACCUMULATOR,this),o(()=>this._previewing,()=>this._requestRenderIfEnabled(),a),o(()=>2===this._numActive,()=>this._numActiveChanged(),a),o(()=>this._depthRange,()=>this._invalidateAccumulationSets(),a)],this._shadowAccumulatorKey);for(const o of this._accumulationSets())o.precompile(e)}*_accumulationSets(){yield this._primarySet,yield this._contextSet}normalizeCtorArgs(){return{}}destroy(){this._disable(),this.removeHandles(this._shadowAccumulatorKey),this._accumulationRenderer=s(this._accumulationRenderer),this._bindParameters.shadowMap.dispose(),this._fbo=s(this._fbo),this._vao=s(this._vao);for(const t of this._accumulationSets())t.destroy();this._contextSet=null,this._primarySet=null,this._bindParameters.destroy()}get computedSamples(){return[this._primarySet.progress,this._contextSet.progress]}get shadowCastTexture(){return this._fbo?.colorTexture}get accumulating(){return this.active&&this._previewing||this._refining}get _refining(){return this.active&&!this._doneAccumulating&&!this._previewing}get active(){return null!=this._fbo&&[...this._accumulationSets()].some(t=>t.active)}get canAccumulate(){return null!=this._bindParameters.depth&&this._depthRange!==d.Zero&&this._opacityFromElevation>b}get _doneAccumulating(){return[...this._accumulationSets()].every(t=>t.doneAccumulating)}get _opacityFromElevation(){return this._accumulationRenderer.opacityFromElevation}set _opacityFromElevation(t){this._accumulationRenderer.opacityFromElevation=t}get _numActive(){return[...this._accumulationSets()].reduce((t,e)=>t+(e.active?1:0),0)}get _pixelFormat(){return 2===this._numActive?{pixelFormat:33319,internalFormat:C.RG8}:{pixelFormat:6403,internalFormat:C.R8}}get readyToRun(){return this._refining&&this.canAccumulate&&[...this._accumulationSets()].some(t=>t.running)}runTask(t){this._clearBuffersOnAccumulationStart(),this._prepareForShadowMapPass(this._bindParameters);let e=!1;for(const r of this._accumulationSets())this._runTaskForSet(r,t)&&(e=!0);e&&this._requestRender()}_runTaskForSet(t,e){let r=!1;for(;!e.done&&!t.doneAccumulating;)this._accumulateShadow(t),e.madeProgress(),r=!0;return r}renderAccumulation(t,e,r,i){return this._updateCamera(e),this._bindParameters.contentCamera=r,this._bindParameters.depth=t,this._passParameters.origin=this._bindParameters.camera.center,this.notifyChange("canAccumulate"),!(!this.accumulating||!this.canAccumulate)&&(this._previewing||i?(this._clearFramebuffer(),this._reset()):this._clearBuffersOnAccumulationStart(),this._accumulateSetsForRenderFrame(i))}_clearBuffersOnAccumulationStart(){if([...this._accumulationSets()].every(t=>0===t.progress))this._clearFramebuffer();else for(const t of this._accumulationSets())0===t.progress&&this._clearFramebufferForSet(this._fbo,t)}_accumulateSetsForRenderFrame(t){let e=!1;for(const r of this._accumulationSets())this._accumulateSetForRenderFrame(r,t)&&(e=!0);return e&&this._requestRender(),e}_accumulateSetForRenderFrame(t,e){let r=e?t.sampleCount:Math.min(D,t.sampleCount);r-=t.progress;for(let i=0;i<r;++i)this._accumulateShadow(t);return r>0}precompile(){this._accumulationRenderer.precompile()}render(t){this._accumulationRenderer.render(t)}setOptions(t){void 0!==t.previewing&&(this._previewing=t.previewing),void 0!==t.lightDirections&&(this._primarySet.lightDirections=t.lightDirections),void 0!==t.lightDirectionsContext&&(this._contextSet.lightDirections=t.lightDirectionsContext),!0===t.enabled?this._enable():!1===t.enabled&&this._disable(),this._accumulationRenderer.setOptions(t)}readAccumulatedShadow(t,e){const r=this._primarySet.progress;return!this.active||!this._fbo||r<1||t<0||t>=this._fbo.width||e<0||e>=this._fbo.height?0:(this._fbo.readPixels(t,e,1,1,6408,j.UNSIGNED_BYTE,E),E[0]/r)}_numActiveChanged(){if(!this._fbo)return;const t=2===this._numActive,e=this._createFBO();e.resize(this._fbo.width,this._fbo.height),t&&(this._clearFramebuffer(e),this._contextSet.reset()),this._fbo.width&&this._fbo.height&&this._rctx.blitFramebuffer(this._fbo,e),this._fbo.dispose(),this._fbo=e,this._requestRender()}_enable(){this._fbo||(this._fbo=this._createFBO(),this._invalidateAccumulationSets())}_createFBO(){const{pixelFormat:t,internalFormat:e}=this._pixelFormat,r=new q;return r.pixelFormat=t,r.internalFormat=e,r.wrapMode=33071,new P(this._rctx,r)}_invalidateAccumulationSets(){for(const t of this._accumulationSets())t.reset();this._requestRenderIfEnabled()}_disable(){this._fbo&&(this._fbo=s(this._fbo),this._requestRender())}_reset(){for(const t of this._accumulationSets())t.reset()}_clearFramebuffer(t=this._fbo){t&&t.width&&t.height&&(this._rctx.bindFramebuffer(t),this._rctx.setClearColor(0,0,0,0),this._rctx.clear(16384))}_clearFramebufferForSet(t,e){if(!t)return;const r=this._techniques.get(x,e.configuration);this._rctx.bindFramebuffer(t),this._rctx.bindTechnique(r,this._bindParameters,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(r.primitiveType,0,this._vao.vertexCount("geometry"))}_accumulateShadow(t){this._renderToShadowMap(this._bindParameters,t.lightDirections[t.progress++],this._depthRange);const e=this._techniques.get(F,t.configuration);this._rctx.bindFramebuffer(this._fbo),this._rctx.bindTechnique(e,this._bindParameters,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(e.primitiveType,0,this._vao.vertexCount("geometry"))}_updateCamera(t){const e=this._fbo;if(null==e)return;const r=this._bindParameters.camera;t.equals(r)||r.copyFrom(t),e.resize(t.fullWidth,t.fullHeight),this._opacityFromElevation=1-i(S,v,t.relativeElevation)}_requestRenderIfEnabled(){this._fbo&&this._requestRender()}get test(){}};t([h()],T.prototype,"_fbo",void 0),t([h()],T.prototype,"_depthRange",void 0),t([h()],T.prototype,"_previewing",void 0),t([h()],T.prototype,"_accumulationRenderer",void 0),t([h()],T.prototype,"_refining",null),t([h()],T.prototype,"active",null),t([h()],T.prototype,"canAccumulate",null),t([h()],T.prototype,"_doneAccumulating",null),t([h()],T.prototype,"_opacityFromElevation",null),t([h()],T.prototype,"_numActive",null),t([h()],T.prototype,"_pixelFormat",null),t([h()],T.prototype,"readyToRun",null),T=t([c("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],T);const D=6,E=new Uint8Array(4);class M{constructor(t,e){this.configuration=t,this._notifyChange=e,this._cachedLightDirections=[],this._progress=n(0),this._sampleCount=n(0)}get progress(){return this._progress.value}set progress(t){this._progress.value=t}get sampleCount(){return this._sampleCount.value}get doneAccumulating(){return this.progress>=this.sampleCount}get running(){return this.progress>0}get active(){return this.sampleCount>0}get lightDirections(){return this._cachedLightDirections}set lightDirections(t){const e=this._cachedLightDirections,i=Math.min(y,t.length);if(!r(e,0,e.length,t,0,i,l)){e.length=i,this._sampleCount.value=i;for(let r=0;r<i;++r)e[r]=u(e[r]??m(),t[r]);this.reset(),this._notifyChange()}}destroy(){this._cachedLightDirections.length=0,this._sampleCount.value=0}reset(){this.progress=0}precompile(t){t.precompile(F,this.configuration),t.precompile(x,this.configuration)}}export{T as ShadowAccumulator};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{clamp as t,lerp as s,acosClamped as e}from"../../../../core/mathUtils.js";import{releaseMaybe as i}from"../../../../core/maybe.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{translate as r,multiply as h,invert as n,lookAt as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as c,create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as d,add as u,scale as m,lerp as _,squaredDistance as f,subtract as g,dot as p,negate as x,normalize as b,copy as w}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as M}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{q as C,c as j,u as y,t as v,i as S}from"../../../../chunks/vec32.js";import{create as H}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as O,t as D}from"../../../../chunks/vec42.js";import{create as F}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{CascadeCamera as T}from"./CascadeCamera.js";import{applyTextureResizeModulo as Q}from"./textureUtils.js";import{assert as B,logWithBase as L,verify as V,rayRay2D as N}from"./Util.js";import{DepthStencilAttachment as q}from"../../../webgl/enums.js";class R{constructor(){this.camera=new T,this.lightMat=l()}}class W{constructor(){this.maxNumCascadesHighQuality=4,this.maxNumCascadesLowQuality=4,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.splitSchemeLambda=0}}class z{constructor(t,s){this._fbos=t,this._viewingMode=s,this._snapshots=new Array,this._textureHeight=0,this._numCascades=1,this.settings=new W,this._projectionView=l(),this._projectionViewInverse=l(),this._modelViewLight=l(),this._cascadeDistances=[0,0,0,0,0],this._usedCascadeDistances=F(),this._cascades=[new R,new R,new R,new R],this._lastOrigin=null,this._enabled=!1,this._maxTextureWidth=Math.min(has("esri-mobile")?4096:16384,t.rctx.parameters.maxTextureSize)}dispose(){this.enabled=!1,this.disposeOffscreenBuffers()}get depthTexture(){return this._handle?.getTexture(q)}get _textureWidth(){return this._textureHeight*this._numCascades}get numCascades(){return this._numCascades}get cascadeDistances(){return O(this._usedCascadeDistances,this._cascadeDistances[0],this._numCascades>1?this._cascadeDistances[1]:1/0,this._numCascades>2?this._cascadeDistances[2]:1/0,this._numCascades>3?this._cascadeDistances[3]:1/0)}disposeMainBuffer(){this._handle=i(this._handle)}disposeOffscreenBuffers(){this.disposeMainBuffer(),this._discardSnapshots()}set maxCascades(s){this.settings.maxNumCascadesHighQuality=t(Math.floor(s),1,4)}get maxCascades(){return this.settings.maxNumCascadesHighQuality}set enabled(t){this._enabled=t,t||this.disposeOffscreenBuffers()}get enabled(){return this._enabled}get ready(){return this._enabled&&null!=this.depthTexture}get cascades(){for(let t=0;t<this._numCascades;++t)X[t]=this._cascades[t];return X.length=this._numCascades,X}start(t,s,e,i,a){B(this.enabled);const{near:r,far:h}=xt(e);this._computeCascadeDistances(r,h,i),this._textureHeight=this._computeTextureHeight(t,a,i),this._setupMatrices(t,s);const{viewMatrix:n,projectionMatrix:o}=t;for(let c=0;c<this._numCascades;++c)this._constructCascade(c,o,n,s);this._lastOrigin=null,this.clear()}finish(){B(this.enabled)}getShadowMapMatrices(t){if(!this._lastOrigin||!C(t,this._lastOrigin)){this._lastOrigin=this._lastOrigin||H(),j(this._lastOrigin,t);for(let s=0;s<this._numCascades;++s){r(Z,this._cascades[s].lightMat,t);for(let t=0;t<16;++t)$[16*s+t]=Z[t]}}return $}moveSnapshot(t){B(this.enabled),this._snapshots[t]?.release(),this._snapshots[t]=this._handle,this._handle?.setName(0===t?"shadow map highlight":"shadow map excluding highlight"),this._handle=null}copySnapshot(t){if(!this.enabled)return;const s=this._handle?.getTexture(q)?.descriptor;if(!s)return;this._snapshots[t]?.release();const e=0===t?"shadow map highlight":"shadow map excluding highlight",i=this._acquireFBO(e);this._snapshots[t]=i;const a=this._handle?.fbo;if(!a||!i?.fbo)return void console.error("No FBO");const{rctx:r}=this._fbos;r.blitFramebuffer(a,i.fbo,256)}getSnapshot(t){return this.enabled?this._snapshots[t]?.getTexture(q):null}clear(){this._ensureFbo(),this.bindFbo(),this._fbos.rctx.clear(256)}_computeTextureHeight({pixelRatio:t,fullWidth:s,fullHeight:e},i,a){const r=Math.min(window.devicePixelRatio,i)/t,h=a?this.settings.textureSizeModHighQuality:this.settings.textureSizeModLowQuality;return Q(Math.max(s,e)*r*h,this._maxTextureWidth/this._numCascades)}_ensureFbo(){this._handle?.fbo?.width===this._textureWidth&&this._handle?.fbo.height===this._textureHeight||(this._handle?.release(),this._handle=this._acquireFBO("shadow map"))}_acquireFBO(t){const s=this._fbos.acquire(this._textureWidth,this._textureHeight,t,12);return s.getTexture(q)?.setShadowFiltering(!0),s}_discardSnapshot(t){this._snapshots[t]=i(this._snapshots[t])}_discardSnapshots(){for(let t=0;t<this._snapshots.length;++t)this._discardSnapshot(t);this._snapshots.length=0}bindFbo(){this._fbos.rctx.bindFramebuffer(this._handle?.fbo)}_constructCascade(t,s,e,i){const a=this._cascades[t],n=-this._cascadeDistances[t],o=-this._cascadeDistances[t+1],c=(s[10]*n+s[14])/Math.abs(s[11]*n+s[15]),l=(s[10]*o+s[14])/Math.abs(s[11]*o+s[15]);B(c<l);for(let r=0;r<8;++r){O(I,r%4==0||r%4==3?-1:1,r%4==0||r%4==1?-1:1,r<4?c:l,1);const t=U[r];D(t,I,this._projectionViewInverse),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3]}y(K,U[0]),a.camera.viewMatrix=r(A,this._modelViewLight,K);for(let r=0;r<8;++r)v(U[r],U[r],a.camera.viewMatrix);let d=U[0][2],u=U[0][2];for(let r=1;r<8;++r)d=Math.min(d,U[r][2]),u=Math.max(u,U[r][2]);d-=200,u+=200,a.camera.near=-u,a.camera.far=-d,pt(e,i,d,u,a.camera),h(a.lightMat,a.camera.projectionMatrix,a.camera.viewMatrix);const m=this._textureHeight;a.camera.viewport=[t*m,0,m,m]}_setupMatrices(t,s){h(this._projectionView,t.projectionMatrix,t.viewMatrix),n(this._projectionViewInverse,this._projectionView);const e=1===this._viewingMode?t.eye:S(K,0,0,1);o(this._modelViewLight,[0,0,0],[-s[0],-s[1],-s[2]],e)}_computeCascadeDistances(t,e,i){const a=i?this.settings.maxNumCascadesHighQuality:this.settings.maxNumCascadesLowQuality;this._numCascades=Math.min(1+Math.floor(L(e/t,4)),a);const r=(e-t)/this._numCascades,h=(e/t)**(1/this._numCascades);let n=t,o=t;for(let c=0;c<this._numCascades+1;++c)this._cascadeDistances[c]=s(n,o,this.settings.splitSchemeLambda),n*=h,o+=r}get test(){}}const A=l(),I=F(),U=[];for(let bt=0;bt<8;++bt)U.push(F());const k=M(),P=M(),E=M(),G=M(),J=M(),K=H(),X=[];function Y(){X.length=0}const Z=l(),$=c.concat(c,c,c),tt=M(),st=M(),et=[M(),M(),M(),M()],it=M(),at=M(),rt=M(),ht=M(),nt=M(),ot=M(),ct=M();function lt(t,s,e,i,a,r,h,n){d(tt,0,0);for(let d=0;d<4;++d)u(tt,tt,t[d]);m(tt,tt,.25),d(st,0,0);for(let d=4;d<8;++d)u(st,st,t[d]);m(st,st,.25),_(et[0],t[4],t[5],.5),_(et[1],t[5],t[6],.5),_(et[2],t[6],t[7],.5),_(et[3],t[7],t[4],.5);let o=0,c=f(et[0],tt);for(let d=1;d<4;++d){const t=f(et[d],tt);t<c&&(c=t,o=d)}g(it,et[o],t[o+4]);const l=it[0];let M,C;it[0]=-it[1],it[1]=l,g(at,st,tt),p(at,it)<0&&x(it,it),_(it,it,at,e),b(it,it),M=C=p(g(rt,t[0],tt),it);for(let d=1;d<8;++d){const s=p(g(rt,t[d],tt),it);s<M?M=s:s>C&&(C=s)}w(i,tt),m(rt,it,M-s),u(i,i,rt);let j=-1,y=1,v=0,S=0;for(let d=0;d<8;++d){g(ht,t[d],i),b(ht,ht);const s=it[0]*ht[1]-it[1]*ht[0];s>0?s>j&&(j=s,v=d):s<y&&(y=s,S=d)}V(j>0,"leftArea"),V(y<0,"rightArea"),m(nt,it,M),u(nt,nt,tt),m(ot,it,C),u(ot,ot,tt),ct[0]=-it[1],ct[1]=it[0];const H=N(i,t[S],ot,u(rt,ot,ct),1,a),O=N(i,t[v],ot,rt,1,r),D=N(i,t[v],nt,u(rt,nt,ct),1,h),F=N(i,t[S],nt,rt,1,n);V(H,"rayRay"),V(O,"rayRay"),V(D,"rayRay"),V(F,"rayRay")}function dt(t,s){return 3*s+t}const ut=M();function mt(t,s){return d(ut,t[s],t[s+3]),ut}const _t=M(),ft=a();function gt(t,s,e,i,a){g(_t,e,i),m(_t,_t,.5),ft[0]=_t[0],ft[1]=_t[1],ft[2]=0,ft[3]=_t[1],ft[4]=-_t[0],ft[5]=0,ft[6]=_t[0]*_t[0]+_t[1]*_t[1],ft[7]=_t[0]*_t[1]-_t[1]*_t[0],ft[8]=1,ft[dt(0,2)]=-p(mt(ft,0),t),ft[dt(1,2)]=-p(mt(ft,1),t);let r=p(mt(ft,0),e)+ft[dt(0,2)],h=p(mt(ft,1),e)+ft[dt(1,2)],n=p(mt(ft,0),i)+ft[dt(0,2)],o=p(mt(ft,1),i)+ft[dt(1,2)];r=-(r+n)/(h+o),ft[dt(0,0)]+=ft[dt(1,0)]*r,ft[dt(0,1)]+=ft[dt(1,1)]*r,ft[dt(0,2)]+=ft[dt(1,2)]*r,r=1/(p(mt(ft,0),e)+ft[dt(0,2)]),h=1/(p(mt(ft,1),e)+ft[dt(1,2)]),ft[dt(0,0)]*=r,ft[dt(0,1)]*=r,ft[dt(0,2)]*=r,ft[dt(1,0)]*=h,ft[dt(1,1)]*=h,ft[dt(1,2)]*=h,ft[dt(2,0)]=ft[dt(1,0)],ft[dt(2,1)]=ft[dt(1,1)],ft[dt(2,2)]=ft[dt(1,2)],ft[dt(1,2)]+=1,r=p(mt(ft,1),s)+ft[dt(1,2)],h=p(mt(ft,2),s)+ft[dt(2,2)],n=p(mt(ft,1),e)+ft[dt(1,2)],o=p(mt(ft,2),e)+ft[dt(2,2)],r=-.5*(r/h+n/o),ft[dt(1,0)]+=ft[dt(2,0)]*r,ft[dt(1,1)]+=ft[dt(2,1)]*r,ft[dt(1,2)]+=ft[dt(2,2)]*r,r=p(mt(ft,1),s)+ft[dt(1,2)],h=p(mt(ft,2),s)+ft[dt(2,2)],n=-h/r,ft[dt(1,0)]*=n,ft[dt(1,1)]*=n,ft[dt(1,2)]*=n,a[0]=ft[0],a[1]=ft[1],a[2]=0,a[3]=ft[2],a[4]=ft[3],a[5]=ft[4],a[6]=0,a[7]=ft[5],a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=ft[6],a[13]=ft[7],a[14]=0,a[15]=ft[8]}function pt(t,s,i,a,r){const h=1/U[0][3],n=1/U[4][3];B(h<n);let o=h+Math.sqrt(h*n);const c=Math.sin(e(t[2]*s[0]+t[6]*s[1]+t[10]*s[2]));o/=c,lt(U,o,c,k,P,E,G,J),gt(k,P,G,J,r.projectionMatrix),r.projectionMatrix[10]=2/(i-a),r.projectionMatrix[14]=-(i+a)/(i-a)}function xt(t){let{near:s,far:e}=t;return s<2&&(s=2),e<2&&(e=2),s>=e&&(s=2,e=4),{near:s,far:e}}export{z as ShadowMap,Y as cleanupShadowmap};
5
+ import has from"../../../../core/has.js";import{clamp as t,lerp as s,acosClamped as e}from"../../../../core/mathUtils.js";import{releaseMaybe as i}from"../../../../core/maybe.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{translate as r,multiply as h,invert as n,lookAt as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as c,create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as d,add as u,scale as m,lerp as _,squaredDistance as f,subtract as g,dot as p,negate as x,normalize as b,copy as w}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as M}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{q as C,d as j,u as y,t as v,j as S}from"../../../../chunks/vec32.js";import{create as H}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as O,t as D}from"../../../../chunks/vec42.js";import{create as F}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{CascadeCamera as T}from"./CascadeCamera.js";import{applyTextureResizeModulo as Q}from"./textureUtils.js";import{assert as B,logWithBase as L,verify as V,rayRay2D as N}from"./Util.js";import{DepthStencilAttachment as q}from"../../../webgl/enums.js";class R{constructor(){this.camera=new T,this.lightMat=l()}}class W{constructor(){this.maxNumCascadesHighQuality=4,this.maxNumCascadesLowQuality=4,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.splitSchemeLambda=0}}class z{constructor(t,s){this._fbos=t,this._viewingMode=s,this._snapshots=new Array,this._textureHeight=0,this._numCascades=1,this.settings=new W,this._projectionView=l(),this._projectionViewInverse=l(),this._modelViewLight=l(),this._cascadeDistances=[0,0,0,0,0],this._usedCascadeDistances=F(),this._cascades=[new R,new R,new R,new R],this._lastOrigin=null,this._enabled=!1,this._maxTextureWidth=Math.min(has("esri-mobile")?4096:16384,t.rctx.parameters.maxTextureSize)}dispose(){this.enabled=!1,this.disposeOffscreenBuffers()}get depthTexture(){return this._handle?.getTexture(q)}get _textureWidth(){return this._textureHeight*this._numCascades}get numCascades(){return this._numCascades}get cascadeDistances(){return O(this._usedCascadeDistances,this._cascadeDistances[0],this._numCascades>1?this._cascadeDistances[1]:1/0,this._numCascades>2?this._cascadeDistances[2]:1/0,this._numCascades>3?this._cascadeDistances[3]:1/0)}disposeMainBuffer(){this._handle=i(this._handle)}disposeOffscreenBuffers(){this.disposeMainBuffer(),this._discardSnapshots()}set maxCascades(s){this.settings.maxNumCascadesHighQuality=t(Math.floor(s),1,4)}get maxCascades(){return this.settings.maxNumCascadesHighQuality}set enabled(t){this._enabled=t,t||this.disposeOffscreenBuffers()}get enabled(){return this._enabled}get ready(){return this._enabled&&null!=this.depthTexture}get cascades(){for(let t=0;t<this._numCascades;++t)X[t]=this._cascades[t];return X.length=this._numCascades,X}start(t,s,e,i,a){B(this.enabled);const{near:r,far:h}=xt(e);this._computeCascadeDistances(r,h,i),this._textureHeight=this._computeTextureHeight(t,a,i),this._setupMatrices(t,s);const{viewMatrix:n,projectionMatrix:o}=t;for(let c=0;c<this._numCascades;++c)this._constructCascade(c,o,n,s);this._lastOrigin=null,this.clear()}finish(){B(this.enabled)}getShadowMapMatrices(t){if(!this._lastOrigin||!C(t,this._lastOrigin)){this._lastOrigin=this._lastOrigin||H(),j(this._lastOrigin,t);for(let s=0;s<this._numCascades;++s){r(Z,this._cascades[s].lightMat,t);for(let t=0;t<16;++t)$[16*s+t]=Z[t]}}return $}moveSnapshot(t){B(this.enabled),this._snapshots[t]?.release(),this._snapshots[t]=this._handle,this._handle?.setName(0===t?"shadow map highlight":"shadow map excluding highlight"),this._handle=null}copySnapshot(t){if(!this.enabled)return;const s=this._handle?.getTexture(q)?.descriptor;if(!s)return;this._snapshots[t]?.release();const e=0===t?"shadow map highlight":"shadow map excluding highlight",i=this._acquireFBO(e);this._snapshots[t]=i;const a=this._handle?.fbo;if(!a||!i?.fbo)return void console.error("No FBO");const{rctx:r}=this._fbos;r.blitFramebuffer(a,i.fbo,256)}getSnapshot(t){return this.enabled?this._snapshots[t]?.getTexture(q):null}clear(){this._ensureFbo(),this.bindFbo(),this._fbos.rctx.clear(256)}_computeTextureHeight({pixelRatio:t,fullWidth:s,fullHeight:e},i,a){const r=Math.min(window.devicePixelRatio,i)/t,h=a?this.settings.textureSizeModHighQuality:this.settings.textureSizeModLowQuality;return Q(Math.max(s,e)*r*h,this._maxTextureWidth/this._numCascades)}_ensureFbo(){this._handle?.fbo?.width===this._textureWidth&&this._handle?.fbo.height===this._textureHeight||(this._handle?.release(),this._handle=this._acquireFBO("shadow map"))}_acquireFBO(t){const s=this._fbos.acquire(this._textureWidth,this._textureHeight,t,12);return s.getTexture(q)?.setShadowFiltering(!0),s}_discardSnapshot(t){this._snapshots[t]=i(this._snapshots[t])}_discardSnapshots(){for(let t=0;t<this._snapshots.length;++t)this._discardSnapshot(t);this._snapshots.length=0}bindFbo(){this._fbos.rctx.bindFramebuffer(this._handle?.fbo)}_constructCascade(t,s,e,i){const a=this._cascades[t],n=-this._cascadeDistances[t],o=-this._cascadeDistances[t+1],c=(s[10]*n+s[14])/Math.abs(s[11]*n+s[15]),l=(s[10]*o+s[14])/Math.abs(s[11]*o+s[15]);B(c<l);for(let r=0;r<8;++r){O(I,r%4==0||r%4==3?-1:1,r%4==0||r%4==1?-1:1,r<4?c:l,1);const t=U[r];D(t,I,this._projectionViewInverse),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3]}y(K,U[0]),a.camera.viewMatrix=r(A,this._modelViewLight,K);for(let r=0;r<8;++r)v(U[r],U[r],a.camera.viewMatrix);let d=U[0][2],u=U[0][2];for(let r=1;r<8;++r)d=Math.min(d,U[r][2]),u=Math.max(u,U[r][2]);d-=200,u+=200,a.camera.near=-u,a.camera.far=-d,pt(e,i,d,u,a.camera),h(a.lightMat,a.camera.projectionMatrix,a.camera.viewMatrix);const m=this._textureHeight;a.camera.viewport=[t*m,0,m,m]}_setupMatrices(t,s){h(this._projectionView,t.projectionMatrix,t.viewMatrix),n(this._projectionViewInverse,this._projectionView);const e=1===this._viewingMode?t.eye:S(K,0,0,1);o(this._modelViewLight,[0,0,0],[-s[0],-s[1],-s[2]],e)}_computeCascadeDistances(t,e,i){const a=i?this.settings.maxNumCascadesHighQuality:this.settings.maxNumCascadesLowQuality;this._numCascades=Math.min(1+Math.floor(L(e/t,4)),a);const r=(e-t)/this._numCascades,h=(e/t)**(1/this._numCascades);let n=t,o=t;for(let c=0;c<this._numCascades+1;++c)this._cascadeDistances[c]=s(n,o,this.settings.splitSchemeLambda),n*=h,o+=r}get test(){}}const A=l(),I=F(),U=[];for(let bt=0;bt<8;++bt)U.push(F());const k=M(),P=M(),E=M(),G=M(),J=M(),K=H(),X=[];function Y(){X.length=0}const Z=l(),$=c.concat(c,c,c),tt=M(),st=M(),et=[M(),M(),M(),M()],it=M(),at=M(),rt=M(),ht=M(),nt=M(),ot=M(),ct=M();function lt(t,s,e,i,a,r,h,n){d(tt,0,0);for(let d=0;d<4;++d)u(tt,tt,t[d]);m(tt,tt,.25),d(st,0,0);for(let d=4;d<8;++d)u(st,st,t[d]);m(st,st,.25),_(et[0],t[4],t[5],.5),_(et[1],t[5],t[6],.5),_(et[2],t[6],t[7],.5),_(et[3],t[7],t[4],.5);let o=0,c=f(et[0],tt);for(let d=1;d<4;++d){const t=f(et[d],tt);t<c&&(c=t,o=d)}g(it,et[o],t[o+4]);const l=it[0];let M,C;it[0]=-it[1],it[1]=l,g(at,st,tt),p(at,it)<0&&x(it,it),_(it,it,at,e),b(it,it),M=C=p(g(rt,t[0],tt),it);for(let d=1;d<8;++d){const s=p(g(rt,t[d],tt),it);s<M?M=s:s>C&&(C=s)}w(i,tt),m(rt,it,M-s),u(i,i,rt);let j=-1,y=1,v=0,S=0;for(let d=0;d<8;++d){g(ht,t[d],i),b(ht,ht);const s=it[0]*ht[1]-it[1]*ht[0];s>0?s>j&&(j=s,v=d):s<y&&(y=s,S=d)}V(j>0,"leftArea"),V(y<0,"rightArea"),m(nt,it,M),u(nt,nt,tt),m(ot,it,C),u(ot,ot,tt),ct[0]=-it[1],ct[1]=it[0];const H=N(i,t[S],ot,u(rt,ot,ct),1,a),O=N(i,t[v],ot,rt,1,r),D=N(i,t[v],nt,u(rt,nt,ct),1,h),F=N(i,t[S],nt,rt,1,n);V(H,"rayRay"),V(O,"rayRay"),V(D,"rayRay"),V(F,"rayRay")}function dt(t,s){return 3*s+t}const ut=M();function mt(t,s){return d(ut,t[s],t[s+3]),ut}const _t=M(),ft=a();function gt(t,s,e,i,a){g(_t,e,i),m(_t,_t,.5),ft[0]=_t[0],ft[1]=_t[1],ft[2]=0,ft[3]=_t[1],ft[4]=-_t[0],ft[5]=0,ft[6]=_t[0]*_t[0]+_t[1]*_t[1],ft[7]=_t[0]*_t[1]-_t[1]*_t[0],ft[8]=1,ft[dt(0,2)]=-p(mt(ft,0),t),ft[dt(1,2)]=-p(mt(ft,1),t);let r=p(mt(ft,0),e)+ft[dt(0,2)],h=p(mt(ft,1),e)+ft[dt(1,2)],n=p(mt(ft,0),i)+ft[dt(0,2)],o=p(mt(ft,1),i)+ft[dt(1,2)];r=-(r+n)/(h+o),ft[dt(0,0)]+=ft[dt(1,0)]*r,ft[dt(0,1)]+=ft[dt(1,1)]*r,ft[dt(0,2)]+=ft[dt(1,2)]*r,r=1/(p(mt(ft,0),e)+ft[dt(0,2)]),h=1/(p(mt(ft,1),e)+ft[dt(1,2)]),ft[dt(0,0)]*=r,ft[dt(0,1)]*=r,ft[dt(0,2)]*=r,ft[dt(1,0)]*=h,ft[dt(1,1)]*=h,ft[dt(1,2)]*=h,ft[dt(2,0)]=ft[dt(1,0)],ft[dt(2,1)]=ft[dt(1,1)],ft[dt(2,2)]=ft[dt(1,2)],ft[dt(1,2)]+=1,r=p(mt(ft,1),s)+ft[dt(1,2)],h=p(mt(ft,2),s)+ft[dt(2,2)],n=p(mt(ft,1),e)+ft[dt(1,2)],o=p(mt(ft,2),e)+ft[dt(2,2)],r=-.5*(r/h+n/o),ft[dt(1,0)]+=ft[dt(2,0)]*r,ft[dt(1,1)]+=ft[dt(2,1)]*r,ft[dt(1,2)]+=ft[dt(2,2)]*r,r=p(mt(ft,1),s)+ft[dt(1,2)],h=p(mt(ft,2),s)+ft[dt(2,2)],n=-h/r,ft[dt(1,0)]*=n,ft[dt(1,1)]*=n,ft[dt(1,2)]*=n,a[0]=ft[0],a[1]=ft[1],a[2]=0,a[3]=ft[2],a[4]=ft[3],a[5]=ft[4],a[6]=0,a[7]=ft[5],a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=ft[6],a[13]=ft[7],a[14]=0,a[15]=ft[8]}function pt(t,s,i,a,r){const h=1/U[0][3],n=1/U[4][3];B(h<n);let o=h+Math.sqrt(h*n);const c=Math.sin(e(t[2]*s[0]+t[6]*s[1]+t[10]*s[2]));o/=c,lt(U,o,c,k,P,E,G,J),gt(k,P,G,J,r.projectionMatrix),r.projectionMatrix[10]=2/(i-a),r.projectionMatrix[14]=-(i+a)/(i-a)}function xt(t){let{near:s,far:e}=t;return s<2&&(s=2),e<2&&(e=2),s>=e&&(s=2,e=4),{near:s,far:e}}export{z as ShadowMap,Y as cleanupShadowmap};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import s from"../../../../core/Collection.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../core/maybe.js";import{watch as i,when as o,initial as a,sync as n}from"../../../../core/reactiveUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{translate as c,fromTranslation as p,scale as w,mul as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{a as u,j as f}from"../../../../chunks/vec32.js";import{create as v,fromValues as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{j as V}from"../../../../chunks/sphere.js";import{InternalRenderCategory as g}from"../../webgl.js";import M from"../../webgl/RenderNode.js";import{ViewshedShadowMap as b}from"./ViewshedShadowMap.js";import{V as S}from"../../../../chunks/Viewshed.glsl.js";import{ViewshedTechnique as y}from"../shaders/ViewshedTechnique.js";let j=class extends M{get shadowMap(){return this._shadowMap}get hasViewsheds(){return this._viewsheds.length>0}get _contentPixelRatio(){return this.view.state.contentPixelRatio}get _viewshedsInView(){return this._viewsheds.items.filter(e=>x(this.view,e))}constructor(e){super(e),this.isDecoration=!1,this._passParameters=new S,this._viewsheds=new s,this._shadowMap=null,this.consumes={required:[g.VIEWSHED,"normals"]},this.produces=g.VIEWSHED,this.requireGeometryDepth=!0}initialize(){this._shadowMap=new b(this.fboCache),this.addHandles([i(()=>this.view.resolutionScale,e=>{const s=this._shadowMap;s&&(s.settings.textureSizeQuality=e)},a),o(()=>!this.hasViewsheds,()=>this._shadowMap?.dispose()),i(()=>this._viewshedsInView.map(e=>[e.observerRenderSpace,e.heading,e.tilt,e.farDistance,e.horizontalFieldOfView,e.verticalFieldOfView]),()=>this.requestRender(1),n)])}destroy(){this._shadowMap=r(this._shadowMap)}precompile(){if(this.hasViewsheds){this.techniques.precompile(y);for(const e of this._viewshedsInView)if(this._shadowMap?.isActive(e))return void this.view.stage.renderer.precompileViewshedShadowMap()}}render(e){const s=this.bindParameters,t=this.renderingContext,r=e.find(({name:e})=>e===g.VIEWSHED);if(!this.hasViewsheds||!s.depth||this.isDecoration&&!s.decorations)return r;this._passParameters.shadowMap=this._shadowMap??this._passParameters.shadowMap,this._passParameters.normals=e.find(({name:e})=>"normals"===e)?.getTexture();const i=this.techniques.get(y);if(!i?.compiled)return this.requestRender(1),r;const o=this.view.stage.renderer.isFeatureEnabled(7);for(const a of this._viewshedsInView){if(!this._renderShadowCubeMap(s,a,o)||!this._shadowMap?.ready)continue;const e=this._setupViewshedParameters(a,s.camera);t.bindTechnique(i,s,e),t.bindFramebuffer(r.fbo),t.screen.draw()}return this.shadowMap?.dispose(),r}updateViewsheds(e){const s=this._viewsheds,{removes:t,adds:r}=e;if(t&&(Array.isArray(t)?s.removeMany(t):s.remove(t)),r)if(Array.isArray(r)){const e=r.filter(e=>!s.includes(e));s.addMany(e)}else s.includes(r)||s.add(r)}_renderShadowCubeMap(e,s,t){const r=this._shadowMap;if(!r)return!1;const i=this.view.basemapTerrain.hasStencilEnabledExtents,o=r.start(e.camera,s,t,this._contentPixelRatio,i);return o&&r.faces.forEach(e=>this.view.stage.renderer.renderViewshedShadowMap(e)),r.finish(),o}_setupViewshedParameters(e,s){const r=this._shadowMap;if(!r)return this._passParameters;const i=this._passParameters,o=e.effectiveObserverRenderSpace;i.localOrigin=o,i.observerOffset=u(E,e.observerRenderSpace,e.effectiveObserverRenderSpace),i.fovs=[t(e.horizontalFieldOfView),t(e.verticalFieldOfView)],i.headingAndTilt=[t(e.heading),t(e.tiltParallelToSurface)],i.upVector=e.tiltedUpVector;const a=R(e.targetRenderSpace,o);i.targetVector=a;const n=new Array,h=new Array;for(let t=0;t<r.numActiveFaces;t++)c(I,r.viewshedViewMatrices[t],o),n.push(...I),P(r.viewshedProjectionMatrices[t],I,D),h.push(...D);return i.viewMatrices=n,i.projectionMatrices=h,i.volumeOffset=this.selectedViewshed?.()===e.viewshed?A(e,this.view,s.eye):0,i}get test(){return{viewsheds:this._viewsheds,shadowMap:this._shadowMap,viewshedsInView:this._viewshedsInView}}};function R(e,s){const t=v();return u(t,e,s)}function P(e,s,t){const r=_(.5,.5,.5);return p(t,r),w(t,t,r),l(t,t,e),l(t,t,s),t}function x(e,s){const t=V(s.observerRenderSpace,s.farDistanceRenderSpace);return!!e.ready&&e.frustum.intersectsSphere(t)}function A(e,s,t){if(null==e)return 0;const{observerRenderSpace:r,targetRenderSpace:i}=e,o=f(t,r)>f(t,i)?e.observer:e.target;return s.pixelSizeAt(o)}e([h()],j.prototype,"selectedViewshed",void 0),e([h()],j.prototype,"isDecoration",void 0),e([h()],j.prototype,"shadowMap",null),e([h()],j.prototype,"hasViewsheds",null),e([h()],j.prototype,"_contentPixelRatio",null),e([h()],j.prototype,"_viewshedsInView",null),e([h()],j.prototype,"consumes",void 0),e([h()],j.prototype,"produces",void 0),j=e([d("esri.views.3d.webgl-engine.lib.Viewshed")],j);const E=v(),I=m(),D=m();export{j as Viewshed,A as computeOffsetScale};
5
+ import{__decorate as e}from"tslib";import s from"../../../../core/Collection.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../core/maybe.js";import{watch as i,when as o,initial as a,sync as n}from"../../../../core/reactiveUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{translate as c,fromTranslation as p,scale as w,mul as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{a as u,k as f}from"../../../../chunks/vec32.js";import{create as v,fromValues as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{j as V}from"../../../../chunks/sphere.js";import{InternalRenderCategory as g}from"../../webgl.js";import M from"../../webgl/RenderNode.js";import{ViewshedShadowMap as b}from"./ViewshedShadowMap.js";import{V as S}from"../../../../chunks/Viewshed.glsl.js";import{ViewshedTechnique as y}from"../shaders/ViewshedTechnique.js";let j=class extends M{get shadowMap(){return this._shadowMap}get hasViewsheds(){return this._viewsheds.length>0}get _contentPixelRatio(){return this.view.state.contentPixelRatio}get _viewshedsInView(){return this._viewsheds.items.filter(e=>x(this.view,e))}constructor(e){super(e),this.isDecoration=!1,this._passParameters=new S,this._viewsheds=new s,this._shadowMap=null,this.consumes={required:[g.VIEWSHED,"normals"]},this.produces=g.VIEWSHED,this.requireGeometryDepth=!0}initialize(){this._shadowMap=new b(this.fboCache),this.addHandles([i(()=>this.view.resolutionScale,e=>{const s=this._shadowMap;s&&(s.settings.textureSizeQuality=e)},a),o(()=>!this.hasViewsheds,()=>this._shadowMap?.dispose()),i(()=>this._viewshedsInView.map(e=>[e.observerRenderSpace,e.heading,e.tilt,e.farDistance,e.horizontalFieldOfView,e.verticalFieldOfView]),()=>this.requestRender(1),n)])}destroy(){this._shadowMap=r(this._shadowMap)}precompile(){if(this.hasViewsheds){this.techniques.precompile(y);for(const e of this._viewshedsInView)if(this._shadowMap?.isActive(e))return void this.view.stage.renderer.precompileViewshedShadowMap()}}render(e){const s=this.bindParameters,t=this.renderingContext,r=e.find(({name:e})=>e===g.VIEWSHED);if(!this.hasViewsheds||!s.depth||this.isDecoration&&!s.decorations)return r;this._passParameters.shadowMap=this._shadowMap??this._passParameters.shadowMap,this._passParameters.normals=e.find(({name:e})=>"normals"===e)?.getTexture();const i=this.techniques.get(y);if(!i?.compiled)return this.requestRender(1),r;const o=this.view.stage.renderer.isFeatureEnabled(7);for(const a of this._viewshedsInView){if(!this._renderShadowCubeMap(s,a,o)||!this._shadowMap?.ready)continue;const e=this._setupViewshedParameters(a,s.camera);t.bindTechnique(i,s,e),t.bindFramebuffer(r.fbo),t.screen.draw()}return this.shadowMap?.dispose(),r}updateViewsheds(e){const s=this._viewsheds,{removes:t,adds:r}=e;if(t&&(Array.isArray(t)?s.removeMany(t):s.remove(t)),r)if(Array.isArray(r)){const e=r.filter(e=>!s.includes(e));s.addMany(e)}else s.includes(r)||s.add(r)}_renderShadowCubeMap(e,s,t){const r=this._shadowMap;if(!r)return!1;const i=this.view.basemapTerrain.hasStencilEnabledExtents,o=r.start(e.camera,s,t,this._contentPixelRatio,i);return o&&r.faces.forEach(e=>this.view.stage.renderer.renderViewshedShadowMap(e)),r.finish(),o}_setupViewshedParameters(e,s){const r=this._shadowMap;if(!r)return this._passParameters;const i=this._passParameters,o=e.effectiveObserverRenderSpace;i.localOrigin=o,i.observerOffset=u(E,e.observerRenderSpace,e.effectiveObserverRenderSpace),i.fovs=[t(e.horizontalFieldOfView),t(e.verticalFieldOfView)],i.headingAndTilt=[t(e.heading),t(e.tiltParallelToSurface)],i.upVector=e.tiltedUpVector;const a=R(e.targetRenderSpace,o);i.targetVector=a;const n=new Array,h=new Array;for(let t=0;t<r.numActiveFaces;t++)c(I,r.viewshedViewMatrices[t],o),n.push(...I),P(r.viewshedProjectionMatrices[t],I,D),h.push(...D);return i.viewMatrices=n,i.projectionMatrices=h,i.volumeOffset=this.selectedViewshed?.()===e.viewshed?A(e,this.view,s.eye):0,i}get test(){return{viewsheds:this._viewsheds,shadowMap:this._shadowMap,viewshedsInView:this._viewshedsInView}}};function R(e,s){const t=v();return u(t,e,s)}function P(e,s,t){const r=_(.5,.5,.5);return p(t,r),w(t,t,r),l(t,t,e),l(t,t,s),t}function x(e,s){const t=V(s.observerRenderSpace,s.farDistanceRenderSpace);return!!e.ready&&e.frustum.intersectsSphere(t)}function A(e,s,t){if(null==e)return 0;const{observerRenderSpace:r,targetRenderSpace:i}=e,o=f(t,r)>f(t,i)?e.observer:e.target;return s.pixelSizeAt(o)}e([h()],j.prototype,"selectedViewshed",void 0),e([h()],j.prototype,"isDecoration",void 0),e([h()],j.prototype,"shadowMap",null),e([h()],j.prototype,"hasViewsheds",null),e([h()],j.prototype,"_contentPixelRatio",null),e([h()],j.prototype,"_viewshedsInView",null),e([h()],j.prototype,"consumes",void 0),e([h()],j.prototype,"produces",void 0),j=e([d("esri.views.3d.webgl-engine.lib.Viewshed")],j);const E=v(),I=m(),D=m();export{j as Viewshed,A as computeOffsetScale};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{clamp as t}from"../../../../core/mathUtils.js";import{releaseMaybe as e}from"../../../../core/maybe.js";import{fromRotation as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{a as r,f as a,u as o,t as h}from"../../../../chunks/vec32.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{applyTextureResizeModulo as n}from"./textureUtils.js";import{ViewshedFaceCamera as l}from"./ViewshedFaceCamera.js";import{DepthStencilAttachment as u,SizedDepthFormat as m}from"../../../webgl/enums.js";import{isSizedDepthStencilFormat as f}from"../../../webgl/textureUtils.js";class d{constructor(){this.textureSizeQuality=1,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.textureSizeMultiple=128,this.toleranceSides=5,this.toleranceBottomTop=10}textureSizeModifier(t){const e=t?this.textureSizeModHighQuality:this.textureSizeModLowQuality;return this.textureSizeQuality*e}textureResizeModulo(t){return Math.ceil(t/this.textureSizeMultiple)*this.textureSizeMultiple}}const p=["front","left","right","back","top","bottom"];function g(t){return!["top","bottom"].includes(t)}class _{constructor(t){this._fbos=t,this._faces={},this._width=0,this._height=0,this.settings=new d,this._maxTextureSize=Math.min(has("esri-mobile")?4096:16384,t.rctx.parameters.maxTextureSize)}get depthTexture(){return this._handle?.getTexture(u)}get ready(){return null!=this.depthTexture&&0!==this._width&&0!==this._height}get nearFar(){const t=this.faces;return 0===t.length?null:t[0].nearFar}get numActiveFaces(){const t=this._faces;let e=0;return Object.keys(t).forEach(i=>{t[i]&&(e+=1)}),e}get faces(){const t=this._faces,e=[];for(const i of p){const s=t[i];s&&e.push(s)}return e}get atlasRegions(){return this.faces.map(t=>[t.x/this._width,(t.x+t.width)/this._width,t.y/this._height,(t.y+t.height)/this._height])}get viewshedProjectionMatrices(){return this.faces.map(t=>t.projectionMatrix)}get viewshedViewMatrices(){return this.faces.map(t=>t.viewMatrix)}_setupFaceCamera(e,n,u,m){const{effectiveObserverRenderSpace:f,tiltedUpVector:d,targetRenderSpace:p,farDistanceRenderSpace:_,horizontalFieldOfView:x,verticalFieldOfView:w}=n,b=c();r(b,p,f);const M=c(),S=c(),F=(t,e)=>{const r=c(),o=s();return i(o,t,e),h(r,b,o),a(r,f,r),r};let z,T=d;const v=Math.min(90,x),O=Math.min(90,Math.max(0,(x-90)/2));let j=-45,B=45,y=-45,k=45;if(g(e)){const e=e=>t(e,-45,45);y=e(-w/2)-this.settings.toleranceBottomTop,k=e(+w/2)+this.settings.toleranceBottomTop}switch(e){case"front":z=p,j=-v/2,B=v/2;break;case"left":z=F(Math.PI/2,d),j=45-O;break;case"right":z=F(-Math.PI/2,d),B=-45+O;break;case"top":z=a(M,f,d),T=o(S,b);break;case"bottom":z=r(M,f,d),T=b;break;case"back":z=F(Math.PI,d)}const V=new l({center:z,eye:f,up:T,far:_});V.sectionAnglesDeg=[j-this.settings.toleranceSides,B+this.settings.toleranceSides,y,k],V.fovY=Math.PI/2;const P=V.setViewport(u,m);return this._faces[e]=V,P}isActive(t){return this._computeActiveFaces(t).size>0}_computeActiveFaces(t){const e=new Set,{horizontalFieldOfView:i,verticalFieldOfView:s}=t,r=-s/2,a=s/2;return 0===i||0===s||(r<=45&&a>=-45&&e.add("front"),i>90&&(e.add("left"),e.add("right")),i>270&&e.add("back"),a>45-this.settings.toleranceBottomTop&&e.add("top"),r<-45+this.settings.toleranceBottomTop&&e.add("bottom")),e}_computeBaseTextureSize({pixelRatio:t,fullWidth:e,fullHeight:i},s,r,a){const o=s/t,h=this.settings.textureSizeModifier(r);return n(Math.max(e,i)*o*h,this._maxTextureSize/a)}_ensureFBO(t){const e=this._width,i=this._height,s=this._handle?.fbo;s&&s.width===e&&s.height===i&&t===f(s.depthStencilTexture?.descriptor?.internalFormat??m.DEPTH_COMPONENT16)||(this._handle?.release(),this._handle=this._allocateFBO(t))}_allocateFBO(t){const{_width:e,_height:i}=this,s=t?13:12,r=this._fbos.acquire(e,i,"viewshed shadow map",s);return r.getTexture(u)?.setShadowFiltering(!1),r}clearFBO(t){const e=this._fbos.rctx;this._ensureFBO(t),e.bindFramebuffer(this._handle?.fbo),e.setClearColor(1,1,1,1),e.clear(16640)}dispose(){this._debugFBO||(this._handle=e(this._handle))}start(t,e,i,s,r=!1){this._faces={};const a=this._computeActiveFaces(e),o=a.size;if(0===o)return!1;const h=this._computeBaseTextureSize(t,s,i,o);let c=0,n=0,l=0;return p.filter(t=>a.has(t)).forEach(t=>{const i=x(t,o);i>n&&(l=Math.max(l,c),c=0),n=i;const s=i*h;c+=this._setupFaceCamera(t,e,[c,s],h)}),l=Math.max(l,c),this._width=this.settings.textureResizeModulo(l),this._height=w(o)*h,this.clearFBO(r),!0}finish(){}get test(){}}function x(t,e){if(e<4)return 0;const i="front"===t||"left"===t;return 4===e?i?0:1:i||"right"===t?0:1}function w(t){return t<4?1:2}export{_ as ViewshedShadowMap};
5
+ import has from"../../../../core/has.js";import{clamp as t}from"../../../../core/mathUtils.js";import{releaseMaybe as e}from"../../../../core/maybe.js";import{fromRotation as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{a as r,g as a,u as o,t as h}from"../../../../chunks/vec32.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{applyTextureResizeModulo as n}from"./textureUtils.js";import{ViewshedFaceCamera as l}from"./ViewshedFaceCamera.js";import{DepthStencilAttachment as u,SizedDepthFormat as m}from"../../../webgl/enums.js";import{isSizedDepthStencilFormat as f}from"../../../webgl/textureUtils.js";class d{constructor(){this.textureSizeQuality=1,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.textureSizeMultiple=128,this.toleranceSides=5,this.toleranceBottomTop=10}textureSizeModifier(t){const e=t?this.textureSizeModHighQuality:this.textureSizeModLowQuality;return this.textureSizeQuality*e}textureResizeModulo(t){return Math.ceil(t/this.textureSizeMultiple)*this.textureSizeMultiple}}const p=["front","left","right","back","top","bottom"];function g(t){return!["top","bottom"].includes(t)}class _{constructor(t){this._fbos=t,this._faces={},this._width=0,this._height=0,this.settings=new d,this._maxTextureSize=Math.min(has("esri-mobile")?4096:16384,t.rctx.parameters.maxTextureSize)}get depthTexture(){return this._handle?.getTexture(u)}get ready(){return null!=this.depthTexture&&0!==this._width&&0!==this._height}get nearFar(){const t=this.faces;return 0===t.length?null:t[0].nearFar}get numActiveFaces(){const t=this._faces;let e=0;return Object.keys(t).forEach(i=>{t[i]&&(e+=1)}),e}get faces(){const t=this._faces,e=[];for(const i of p){const s=t[i];s&&e.push(s)}return e}get atlasRegions(){return this.faces.map(t=>[t.x/this._width,(t.x+t.width)/this._width,t.y/this._height,(t.y+t.height)/this._height])}get viewshedProjectionMatrices(){return this.faces.map(t=>t.projectionMatrix)}get viewshedViewMatrices(){return this.faces.map(t=>t.viewMatrix)}_setupFaceCamera(e,n,u,m){const{effectiveObserverRenderSpace:f,tiltedUpVector:d,targetRenderSpace:p,farDistanceRenderSpace:_,horizontalFieldOfView:x,verticalFieldOfView:w}=n,b=c();r(b,p,f);const M=c(),S=c(),F=(t,e)=>{const r=c(),o=s();return i(o,t,e),h(r,b,o),a(r,f,r),r};let z,T=d;const v=Math.min(90,x),O=Math.min(90,Math.max(0,(x-90)/2));let j=-45,B=45,y=-45,k=45;if(g(e)){const e=e=>t(e,-45,45);y=e(-w/2)-this.settings.toleranceBottomTop,k=e(+w/2)+this.settings.toleranceBottomTop}switch(e){case"front":z=p,j=-v/2,B=v/2;break;case"left":z=F(Math.PI/2,d),j=45-O;break;case"right":z=F(-Math.PI/2,d),B=-45+O;break;case"top":z=a(M,f,d),T=o(S,b);break;case"bottom":z=r(M,f,d),T=b;break;case"back":z=F(Math.PI,d)}const V=new l({center:z,eye:f,up:T,far:_});V.sectionAnglesDeg=[j-this.settings.toleranceSides,B+this.settings.toleranceSides,y,k],V.fovY=Math.PI/2;const P=V.setViewport(u,m);return this._faces[e]=V,P}isActive(t){return this._computeActiveFaces(t).size>0}_computeActiveFaces(t){const e=new Set,{horizontalFieldOfView:i,verticalFieldOfView:s}=t,r=-s/2,a=s/2;return 0===i||0===s||(r<=45&&a>=-45&&e.add("front"),i>90&&(e.add("left"),e.add("right")),i>270&&e.add("back"),a>45-this.settings.toleranceBottomTop&&e.add("top"),r<-45+this.settings.toleranceBottomTop&&e.add("bottom")),e}_computeBaseTextureSize({pixelRatio:t,fullWidth:e,fullHeight:i},s,r,a){const o=s/t,h=this.settings.textureSizeModifier(r);return n(Math.max(e,i)*o*h,this._maxTextureSize/a)}_ensureFBO(t){const e=this._width,i=this._height,s=this._handle?.fbo;s&&s.width===e&&s.height===i&&t===f(s.depthStencilTexture?.descriptor?.internalFormat??m.DEPTH_COMPONENT16)||(this._handle?.release(),this._handle=this._allocateFBO(t))}_allocateFBO(t){const{_width:e,_height:i}=this,s=t?13:12,r=this._fbos.acquire(e,i,"viewshed shadow map",s);return r.getTexture(u)?.setShadowFiltering(!1),r}clearFBO(t){const e=this._fbos.rctx;this._ensureFBO(t),e.bindFramebuffer(this._handle?.fbo),e.setClearColor(1,1,1,1),e.clear(16640)}dispose(){this._debugFBO||(this._handle=e(this._handle))}start(t,e,i,s,r=!1){this._faces={};const a=this._computeActiveFaces(e),o=a.size;if(0===o)return!1;const h=this._computeBaseTextureSize(t,s,i,o);let c=0,n=0,l=0;return p.filter(t=>a.has(t)).forEach(t=>{const i=x(t,o);i>n&&(l=Math.max(l,c),c=0),n=i;const s=i*h;c+=this._setupFaceCamera(t,e,[c,s],h)}),l=Math.max(l,c),this._width=this.settings.textureResizeModulo(l),this._height=w(o)*h,this.clearFBO(r),!0}finish(){}get test(){}}function x(t,e){if(e<4)return 0;const i="front"===t||"left"===t;return 4===e?i?0:1:i||"right"===t?0:1}function w(t){return t<4?1:2}export{_ as ViewshedShadowMap};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{removeUnordered as e}from"../../../../core/arrayUtils.js";import{toConst as t}from"../../../../core/compilerUtils.js";import{EventEmitter as s}from"../../../../core/Evented.js";import i from"../../../../core/Handles.js";import"../../../../core/has.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{generateUID as r}from"../../../../core/uid.js";import{DirtyEventNames as h}from"./DirtyEvents.js";import{Octree as c}from"./Octree.js";class d{constructor(e,t,o=""){this.stage=e,this.apiLayerViewUid=o,this.id=r(),this.events=new s,this.visible=!0,this.sliceable=!1,this._objectsAdded=new Array,this._handles=new i,this._objects=new Map,this._pickable=!0,this.visible=t?.visible??!0,this._pickable=t?.pickable??!0,this.updatePolicy=t?.updatePolicy??0,e.addLayer(this);for(const s of h)this._handles.add(this.events.on(s,t=>e.handleEvent(s,t)))}destroy(){this._handles.size&&(this._handles.destroy(),this.stage.removeLayer(this),this.invalidateSpatialQueryAccelerator())}get objects(){return this._objects}getObject(e){return t(this._objects.get(e))}set pickable(e){this._pickable=e}get pickable(){return this._pickable&&this.visible}add(e){this._objects.set(e.id,e),e.layer=this,this.events.emit("layerObjectAdded",e),null!=this._octree&&this._objectsAdded.push(e)}remove(t){this._objects.delete(t.id)&&(this.events.emit("layerObjectRemoved",t),t.layer=null,null!=this._octree&&(e(this._objectsAdded,t)||this._octree.remove([t])))}addMany(e){for(const t of e)this._objects.set(t.id,t),t.layer=this;this.events.emit("layerObjectsAdded",e),null!=this._octree&&this._objectsAdded.push(...e)}removeMany(t){const s=new Array;for(const e of t)this._objects.delete(e.id)&&s.push(e);if(0!==s.length&&(this.events.emit("layerObjectsRemoved",s),s.forEach(e=>e.layer=null),null!=this._octree)){for(let t=0;t<s.length;)e(this._objectsAdded,s[t])?(s[t]=s[s.length-1],s.length-=1):++t;this._octree.remove(s)}}sync(){1!==this.updatePolicy&&this.stage.syncLayer(this.id)}notifyObjectBBChanged(e,t){null==this._octree||this._objectsAdded.includes(e)||this._octree.update(e,t)}getSpatialQueryAccelerator(){return null==this._octree&&this._objects.size>50?(this._octree=new c(e=>e.boundingVolumeWorldSpace.bounds),this._octree.add(this._objects.values())):null!=this._octree&&this._objectsAdded.length>0&&(this._octree.add(this._objectsAdded),this._objectsAdded.length=0),this._octree}invalidateSpatialQueryAccelerator(){this._octree=o(this._octree),this._objectsAdded.length=0}get test(){}}export{d as WebGLLayer};
5
+ import{removeUnordered as e}from"../../../../core/arrayUtils.js";import{toConst as t}from"../../../../core/compilerUtils.js";import{EventEmitter as s}from"../../../../core/Evented.js";import i from"../../../../core/Handles.js";import"../../../../core/has.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{generateUID as r}from"../../../../core/uid.js";import{DirtyEventNames as h}from"./DirtyEvents.js";import{Octree as c}from"./Octree.js";class d{constructor(e,t,o=""){this.stage=e,this.apiLayerViewUid=o,this.id=r(),this.events=new s,this.visible=!0,this.sliceable=!1,this._objectsAdded=new Array,this._handles=new i,this._objects=new Map,this._pickable=!0,this.visible=t?.visible??!0,this._pickable=t?.pickable??!0,this.updatePolicy=t?.updatePolicy??0,e.addLayer(this);for(const s of h)this._handles.add(this.events.on(s,t=>e.handleEvent(s,t)))}destroy(){this._handles.size&&(this._handles.destroy(),this.stage.removeLayer(this),this.invalidateSpatialQueryAccelerator())}get objects(){return this._objects}getObject(e){return t(this._objects.get(e))}set pickable(e){this._pickable=e}get pickable(){return this._pickable&&this.visible}add(e){this._objects.set(e.id,e),e.layer=this,this.events.emit("layerObjectAdded",e),null!=this._octree&&this._objectsAdded.push(e)}remove(t){this._objects.delete(t.id)&&(this.events.emit("layerObjectRemoved",t),t.layer=null,null!=this._octree&&(e(this._objectsAdded,t)||this._octree.remove([t])))}addMany(e){for(const t of e)this._objects.set(t.id,t),t.layer=this;this.events.emit("layerObjectsAdded",e),null!=this._octree&&this._objectsAdded.push(...e)}removeMany(t){const s=new Array;for(const e of t)this._objects.delete(e.id)&&s.push(e);if(0!==s.length&&(this.events.emit("layerObjectsRemoved",s),s.forEach(e=>e.layer=null),null!=this._octree)){for(let t=0;t<s.length;)e(this._objectsAdded,s[t])?(s[t]=s[s.length-1],s.length-=1):++t;this._octree.remove(s)}}commit(){this.stage.commitLayer(this)}sync(){1!==this.updatePolicy&&this.stage.syncLayer(this.id)}notifyObjectBBChanged(e,t){null==this._octree||this._objectsAdded.includes(e)||this._octree.update(e,t)}getSpatialQueryAccelerator(){return null==this._octree&&this._objects.size>50?(this._octree=new c(e=>e.boundingVolumeWorldSpace.bounds),this._octree.add(this._objects.values())):null!=this._octree&&this._objectsAdded.length>0&&(this._octree.add(this._objectsAdded),this._objectsAdded.length=0),this._octree}invalidateSpatialQueryAccelerator(){this._octree=o(this._octree),this._objectsAdded.length=0}get test(){}}export{d as WebGLLayer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../core/PooledArray.js";import{transpose as r,invert as t}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{i}from"../../../../../chunks/vec32.js";import{debugFlags as a}from"../../../support/debugFlags.js";import{TwoVectorPosition as o}from"../../core/util/TwoVectorPosition.js";import{EdgeDrawParameters as n}from"./EdgeShaderParameters.js";import{EdgeShaderTechnique as l}from"./EdgeShaderTechnique.js";import{EdgeShaderTechniqueConfiguration as d}from"./EdgeShaderTechniqueConfiguration.js";import{PrimitiveType as h}from"../../../../webgl/enums.js";const c=8,m=128,_={type:0,hasSlicePlane:!1,strokesTexture:null,legacy:!0,spherical:!0};class g{constructor(r,t,s){this.rctx=r,this._techniques=t,this._configuration=new d,this.refCount=0,this._renderables=new Set,this._sortedRenderables={0:{0:new e,1:new e},1:{0:new e,1:new e}},this._renderablesDirty=!1,this._drawParameters=new n,this._settings={..._,...s},this.key=g.getKey(this._settings.type,this._settings.hasSlicePlane,this._settings.legacy);const i=this._settings.strokesTexture.variants;this.writerSettings={variants:i,reducedPrecision:a.TESTS_DISABLE_OPTIMIZATIONS},this._configuration.legacy=this._settings.legacy,this._configuration.type=this._settings.type,this._configuration.silhouette=!1,this._configuration.hasSlicePlane=this._settings.hasSlicePlane,this._configuration.spherical=s.spherical}addRenderable(e){this._renderables.add(e),this._renderablesDirty=!0}removeRenderable(e){this._renderables.delete(e),this._renderablesDirty=!0}setRenderablesDirty(){this._renderablesDirty=!0}forEachRenderable(e,r){this._renderablesDirty&&this._sortRenderables();const t=this._sortedRenderables[r];t[0].forAll(e),t[1].forAll(e)}acquireTechnique(e,r){return this._lastOriginId=null,this._configuration.terrainDepthTest=e.terrainDepthTest,this._configuration.cullAboveTerrain=e.cullAboveTerrain,this._configuration.silhouette=r,this._techniques.get(l,this._configuration)}renderRegularEdges(e,r,t,s,i){this._render(e,r,r.regular.vao,t,s,i)}renderSilhouetteEdges(e,r,t,s,i){this._render(e,r,r.silhouette.vao,t,s,i)}_render(e,r,t,s,i,a){a>0&&(this._bindDraw(e,r,s,i),this.rctx.bindVAO(t),this.rctx.drawArraysInstanced(h.TRIANGLE_FAN,0,4,a))}_bindDraw(e,s,a,n){this._drawParameters.componentDataTexture=s.components.buffer.textureBuffer.texture,this._drawParameters.strokesTexture=this._settings.strokesTexture;const l=s.transform.origin;if(l){const r=l.origin.id;this._lastOriginId!==r&&(e.setUniformMatrix4fv("localView",l.viewMatrix),this._lastOriginId=r),e.setUniformMatrix4fv("model",s.transform.modelMatrix),this._drawParameters.slicePlaneLocalOrigin=l.origin.vec3}else{const e=new o(s.transform.position),a=r(f,t(f,s.transform.rotationScale));this._drawParameters.transformWorldFromModelTL=e.low,this._drawParameters.transformWorldFromModelTH=e.high,this._drawParameters.transformWorldFromModelRS=s.transform.rotationScale,this._drawParameters.transformNormalGlobalFromModel=a;const l=n.camera.viewInverseTransposeMatrix;i(this._drawParameters.slicePlaneLocalOrigin,l[3],l[7],l[11])}e.bindDraw(n,a,this._drawParameters)}_sortRenderables(){this._renderablesDirty=!1,this._sortedRenderables[0][0].clear(),this._sortedRenderables[0][1].clear(),this._sortedRenderables[1][0].clear(),this._sortedRenderables[1][1].clear(),this._renderables.forEach(e=>this._sortedRenderables[e.objectTransparency][e.edgeTransparency].push(e));const e=(e,r)=>e.transform.origin?r.transform.origin?e.transform.origin.origin.id<r.transform.origin.origin.id?-1:e.transform.origin.origin.id>r.transform.origin.origin.id?1:0:1:0;this._sortedRenderables[0][0].sort(e),this._sortedRenderables[0][1].sort(e),this._sortedRenderables[1][0].sort(e),this._sortedRenderables[1][1].sort(e)}static getKey(e,r,t){return`edges-t:${e}:${r}:${t}`}}const f=s();export{g as EdgeRenderer,m as extensionLengthOffset,c as lineWidthFractionFactor};
5
+ import e from"../../../../../core/PooledArray.js";import{transpose as r,invert as t}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{j as i}from"../../../../../chunks/vec32.js";import{debugFlags as a}from"../../../support/debugFlags.js";import{TwoVectorPosition as o}from"../../core/util/TwoVectorPosition.js";import{EdgeDrawParameters as n}from"./EdgeShaderParameters.js";import{EdgeShaderTechnique as l}from"./EdgeShaderTechnique.js";import{EdgeShaderTechniqueConfiguration as d}from"./EdgeShaderTechniqueConfiguration.js";import{PrimitiveType as h}from"../../../../webgl/enums.js";const c=8,m=128,_={type:0,hasSlicePlane:!1,strokesTexture:null,legacy:!0,spherical:!0};class g{constructor(r,t,s){this.rctx=r,this._techniques=t,this._configuration=new d,this.refCount=0,this._renderables=new Set,this._sortedRenderables={0:{0:new e,1:new e},1:{0:new e,1:new e}},this._renderablesDirty=!1,this._drawParameters=new n,this._settings={..._,...s},this.key=g.getKey(this._settings.type,this._settings.hasSlicePlane,this._settings.legacy);const i=this._settings.strokesTexture.variants;this.writerSettings={variants:i,reducedPrecision:a.TESTS_DISABLE_OPTIMIZATIONS},this._configuration.legacy=this._settings.legacy,this._configuration.type=this._settings.type,this._configuration.silhouette=!1,this._configuration.hasSlicePlane=this._settings.hasSlicePlane,this._configuration.spherical=s.spherical}addRenderable(e){this._renderables.add(e),this._renderablesDirty=!0}removeRenderable(e){this._renderables.delete(e),this._renderablesDirty=!0}setRenderablesDirty(){this._renderablesDirty=!0}forEachRenderable(e,r){this._renderablesDirty&&this._sortRenderables();const t=this._sortedRenderables[r];t[0].forAll(e),t[1].forAll(e)}acquireTechnique(e,r){return this._lastOriginId=null,this._configuration.terrainDepthTest=e.terrainDepthTest,this._configuration.cullAboveTerrain=e.cullAboveTerrain,this._configuration.silhouette=r,this._techniques.get(l,this._configuration)}renderRegularEdges(e,r,t,s,i){this._render(e,r,r.regular.vao,t,s,i)}renderSilhouetteEdges(e,r,t,s,i){this._render(e,r,r.silhouette.vao,t,s,i)}_render(e,r,t,s,i,a){a>0&&(this._bindDraw(e,r,s,i),this.rctx.bindVAO(t),this.rctx.drawArraysInstanced(h.TRIANGLE_FAN,0,4,a))}_bindDraw(e,s,a,n){this._drawParameters.componentDataTexture=s.components.buffer.textureBuffer.texture,this._drawParameters.strokesTexture=this._settings.strokesTexture;const l=s.transform.origin;if(l){const r=l.origin.id;this._lastOriginId!==r&&(e.setUniformMatrix4fv("localView",l.viewMatrix),this._lastOriginId=r),e.setUniformMatrix4fv("model",s.transform.modelMatrix),this._drawParameters.slicePlaneLocalOrigin=l.origin.vec3}else{const e=new o(s.transform.position),a=r(f,t(f,s.transform.rotationScale));this._drawParameters.transformWorldFromModelTL=e.low,this._drawParameters.transformWorldFromModelTH=e.high,this._drawParameters.transformWorldFromModelRS=s.transform.rotationScale,this._drawParameters.transformNormalGlobalFromModel=a;const l=n.camera.viewInverseTransposeMatrix;i(this._drawParameters.slicePlaneLocalOrigin,l[3],l[7],l[11])}e.bindDraw(n,a,this._drawParameters)}_sortRenderables(){this._renderablesDirty=!1,this._sortedRenderables[0][0].clear(),this._sortedRenderables[0][1].clear(),this._sortedRenderables[1][0].clear(),this._sortedRenderables[1][1].clear(),this._renderables.forEach(e=>this._sortedRenderables[e.objectTransparency][e.edgeTransparency].push(e));const e=(e,r)=>e.transform.origin?r.transform.origin?e.transform.origin.origin.id<r.transform.origin.origin.id?-1:e.transform.origin.origin.id>r.transform.origin.origin.id?1:0:1:0;this._sortedRenderables[0][0].sort(e),this._sortedRenderables[0][1].sort(e),this._sortedRenderables[1][0].sort(e),this._sortedRenderables[1][1].sort(e)}static getKey(e,r,t){return`edges-t:${e}:${r}:${t}`}}const f=s();export{g as EdgeRenderer,m as extensionLengthOffset,c as lineWidthFractionFactor};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{equals as r,binaryIndexOf as s}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import n from"../../../../../core/Logger.js";import{clamp as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as o,destroyMaybe as a}from"../../../../../core/maybe.js";import{isAbortError as c,onAbortOrThrow as l}from"../../../../../core/promiseUtils.js";import{property as d}from"../../../../../core/accessorSupport/decorators/property.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as u,transpose as m,invert as g}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as p}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as _,c as b,a as y,e as j}from"../../../../../chunks/vec32.js";import{create as w,clone as O}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as E}from"../../../../../core/support/UpdatingHandles.js";import{n as x,g as v}from"../../../../../chunks/sphere.js";import{c as M}from"../../../../../chunks/vec33.js";import{encodeElevationOffset as R}from"../../collections/Component/Material/shader/ComponentData.glsl.js";import{TwoVectorPosition as T}from"../../core/util/TwoVectorPosition.js";import{Attribute as C}from"../Attribute.js";import{GridLocalOriginFactory as D}from"../GridLocalOriginFactory.js";import{applyToModelMatrix as A}from"../localOriginHelper.js";import{LocalOriginManager as P}from"../LocalOriginManager.js";import{Object3D as k}from"../Object3D.js";import{VertexArrayObject as U}from"../VertexArrayObject.js";import{VertexLayout as q,glVertexLayout as B,EdgeInputBufferLayout as H,RegularEdgeInstancesGLLayout as L,SilhouetteEdgeInstancesGLLayout as V}from"./bufferLayouts.js";import{EdgeRenderer as S,lineWidthFractionFactor as I,extensionLengthOffset as N}from"./EdgeRenderer.js";import{EdgePassParameters as z}from"./EdgeShaderParameters.js";import{EdgeWorkerHandle as F}from"./EdgeWorkerHandle.js";import{generateStrokesTexture as G}from"./strokes.js";import{determineRendererType as K,determineEdgeTransparency as W,determineObjectTransparency as J,fillComponentBufferIndices as Q}from"./util.js";import{BufferManager as X}from"../TextureBackedBuffer/BufferManager.js";import{VertexBuffer as Y}from"../../../../webgl/VertexBuffer.js";const Z=128;let $=class extends t{constructor(e){super(e),this._updatingHandles=new E,this._objectEntries=new Map,this._pendingDeletions=new Map,this._renderers=new Map,this._gpuMemoryUsage=0,this._workerAbort=new AbortController,this._tmpModelPosition=w(),this._localOrigins=new P(new D(e.renderSR));const t=q.createBuffer(4);for(let r=0;r<4;r++)t.sideness.set(r,0,0===r||3===r?0:1),t.sideness.set(r,1,0===r||1===r?0:1);this._vertexBuffer=new Y(e.rctx,B,t.buffer)}initialize(){this._workerHandle=new F(this.schedule),this._componentColorManager=new X(this.rctx,3)}destroy(){this.destroyed||(this._objectEntries.forEach(e=>this._discardObjectEntry(e)),this._objectEntries.clear(),this._pendingDeletions.forEach(e=>this._discardObjectEntry(e)),this._pendingDeletions.clear(),this._strokesTexture=o(this._strokesTexture),this._componentColorManager=a(this._componentColorManager),this._workerAbort.abort(),this._workerHandle.destroy(),this._vertexBuffer.dispose(),this._renderers.clear(),this._updatingHandles.destroy(),this._set("schedule",_e))}get updating(){return this._updatingHandles.updating}get usedMemory(){return this._gpuMemoryUsage}shouldRender(){return this._renderers.size>0}async addComponentObject(e,t,r,s,n,i,o){if(this.hasObject(e))return this._getObjectMemoryUsage(e);let a;const c=new re(null,new Promise(e=>a=e),e.obb.center,e.obb.radius);this._objectEntries.set(e,c);const l=await this._updatingHandles.addPromise(this._addComponentGeometry(e.transform,c,t,r,s,n,i,o));return this.setNeedsRender(),a(),l}async addOrUpdateObject3D(e,t,r,s){if(this.destroyed)return void n.getLogger(this).warn("Attempt to add an object to a destroyed instance");const i=new AbortController;let o;const a=e.boundingVolumeWorldSpace.bounds,l=new re(i,new Promise(e=>o=e),x(a,w()),v(a)),d=this._objectEntries.get(e);d&&(this._pendingDeletions.has(e)?this._discardObjectEntry(d):this._pendingDeletions.set(e,d)),this._objectEntries.set(e,l);try{const n=new Array;if(e.geometries.length>1&&te(e))n.push(this._addObjectMergedGeometries(e,l,t,r,s));else for(const i of e.geometries)i.material.supportsEdges&&n.push(this._addGeometry(e,l,i,t,r,s));await this._updatingHandles.addPromise(Promise.all(n)),this._removePendingDeletion(e)}catch(h){c(h)?this._discardObjectEntry(l):this._removePendingDeletion(e)}finally{this.setNeedsRender(),o()}}removeObject(e){const t=this._objectEntries.get(e);this._objectEntries.delete(e),this._discardObjectEntry(t),this._removePendingDeletion(e)}_removePendingDeletion(e){const t=this._pendingDeletions.get(e);this._pendingDeletions.delete(e),this._discardObjectEntry(t)}async _getObjectEntry(e){const t=this._objectEntries.get(e);if(!t)throw new Error("no object");return await t.loaded,null==t.loaded?null:t}fastUpdateObject3DEdgesTransform(e){if(this.destroyed)return!1;const t=this._objectEntries.get(e);if(!t)return!1;const{geometries:r}=e,{renderables:s}=t;if(0===r.length||0===s.length)return!0;if(s.length>1)return!1;const[n]=s,i=n.transform;if(!(i instanceof ie))return!1;const[o]=r;if(o.localOrigin!==i.origin.origin)return!1;const a=f(),c=this._computeModelTransformWithLocalOrigin(e,o,a);return n.transform=new ie(a,c),this.setNeedsRender(),!0}_discardObjectEntry(e){e&&(e.abort?.abort(),e.renderables.length&&(e.renderables.forEach(e=>this._removeRenderable(e)),this.setNeedsRender()),e.loaded=null)}hasObject(e){return this._objectEntries.has(e)}async updateAllComponentOpacities(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));if(null==r)return;const s=Array.isArray(t)?e=>t[e]:()=>t;r.renderables.forEach(e=>{const t=e.components.meta.length;for(let r=0;r<t;r++){const t=s(r),n=e.components.meta[r],i=n.index;n.material.opacity=t,e.components.buffer.textureBuffer.setDataElement(i,1,3,255*t)}this._updateTransparency(e)}),this.setNeedsRender()}async _getObjectMemoryUsage(e){const t=await this._getObjectEntry(e);return t?t.renderables.reduce((e,t)=>e+t.statistics.gpuMemoryUsage,0):0}async updateAllComponentMaterials(e,t,r,s){const n=e instanceof k,i=K(t),o=S.getKey(i,r,n),a=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=a&&(a.renderables.forEach(e=>{if(o!==e.rendererKey){const t=this._renderers.get(e.rendererKey),s=this._acquireRenderer(i,r,n);t.removeRenderable(e),--t.refCount,e.rendererKey=o,s.addRenderable(e)}if(Array.isArray(t))for(let r=0;r<t.length;r++)e.components.meta[r].material=t[r];else e.components.meta[0].material=t;s&&ce(e.components),this._updateTransparency(e)}),this.setNeedsRender())}async updateAllVerticalOffsets(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=r&&this._updateAllVerticalOffsets(r,t)}_updateAllVerticalOffsets(e,t){e.renderables.forEach(e=>{const r=e.components.meta;for(let s=0;s<r.length;s++)e.components.meta[s].verticalOffset=t?.[s]??0;ce(e.components)}),this.setNeedsRender()}async updateObjectVisibility(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));r&&(r.renderables.forEach(e=>e.visible=t),this.setNeedsRender())}render(e,t){if(null==this._componentColorManager)return;this._localOrigins.updateViewMatrices(e.camera.viewMatrix);const r=e.camera.viewInverseTransposeMatrix,s=w(),n=new T;let i=0,o=0;if(this._renderers.forEach(r=>{0!==r.refCount?(++this.techniques.precompiling,r.forEachRenderable(t=>{t.visible&&(i+=t.statistics.averageEdgeLength,o++,t.regular&&r.acquireTechnique(e,!1),t.silhouette&&r.acquireTechnique(e,!0))},t),--this.techniques.precompiling):this._renderers.delete(r.key)}),this._componentColorManager.garbageCollect(),this._componentColorManager.updateTextures(),0===o)return;const a=new z(40*i/o,t);_(s,r[3],r[7],r[11]),n.set(s),b(a.transformWorldFromViewTH,n.high),b(a.transformWorldFromViewTL,n.low),u(a.transformViewFromCameraRelativeRS,e.camera.viewMatrix),m(fe,a.transformViewFromCameraRelativeRS),g(a.transformNormalViewFromGlobal,fe),a.transformProjFromView=e.camera.projectionMatrix,this._updateObjectCameraDistances(e),this._renderers.forEach(t=>{le(t,e,a),de(t,e,a)})}_updateTransparency(e){const t=W(e.components.meta),r=J(e.components.meta);t===e.edgeTransparency&&r===e.objectTransparency||(e.edgeTransparency=t,e.objectTransparency=r,this._renderers.get(e.rendererKey).setRenderablesDirty())}_computeModelTransformWithLocalOrigin(e,t,r){e.getCombinedShaderTransformation(t,r);const s=null!=t.localOrigin?this._localOrigins.register(t.localOrigin):this._localOrigins.acquire(_(this._tmpModelPosition,r[12],r[13],r[14]));return t.localOrigin=s.origin,A(s.origin.vec3,r),s}_createComponentBuffers(e){if(null==this._componentColorManager)return null;const t=new Array,r=this._componentColorManager.getBuffer(e.length);for(let n=0;n<e.length;n++){const s=e[n],i=r.acquireIndex();t.push({index:i,verticalOffset:0,material:s})}const s=new se(r,t);return ce(s),s}_extractEdges(e,t,r,s,n,i,o=i.length){return o<Z&&(n=!0),this._workerHandle.process({data:r,indices:i,indicesLength:o,writerSettings:t,skipDeduplicate:s},e,n)}_createRenderable(e,t,r,s,n){const i=t=>new ne(new U(this.rctx,new Map([["vertices",this._vertexBuffer],["instances",0===t?new Y(this.rctx,L,e.regular.instancesData.buffer):new Y(this.rctx,V,e.silhouette.instancesData.buffer)]])),0===t?e.regular.lodInfo:e.silhouette.lodInfo),o=e.regular.lodInfo.lengths.length>0?i(0):null,a=e.silhouette.lodInfo.lengths.length>0?i(1):null,c=(o?.vao.usedMemory??0)+(a?.vao.usedMemory??0);return new oe(o,a,{gpuMemoryUsage:c,externalMemoryUsage:n,averageEdgeLength:e.averageEdgeLength},r,W(t.meta),J(t.meta),t,s)}async _addGeometry(e,t,r,s,n,i){if(r.edgeIndicesLength<=0)return;const o=r.attributes.get("position"),a=f(),c=this._computeModelTransformWithLocalOrigin(e,r,a),l=new pe(o,a,c);return this._addPositionData(t,l,r.edgeIndicesLength,s,n,i)}async _addPositionData(e,t,r,s,n,i=!1){if(null==e.loaded)return;const o=this._createComponentBuffers([s]);if(null==o)return;const a=this._acquireRenderer(s.type,n,!0),{modelTransform:c,origin:l}=t,d=t.position.indices,h=t.position,u=h.data.length/h.size,m=H.createBuffer(u);for(let f=0;f<u;f++)m.position.set(f,0,h.data[f*h.size]),m.position.set(f,1,h.data[f*h.size+1]),m.position.set(f,2,h.data[f*h.size+2]);Q(o.meta,[0,m.componentIndex.count],m.componentIndex);const g=await this._updatingHandles.addPromise(this._extractEdges(e.abort?.signal||this._workerAbort.signal,a.writerSettings,m,!1,i,d,r));if(null==e.loaded)return;const p=this._createRenderable(g,o,new ie(c,l),a.key,!1);e.renderables.push(p),a.addRenderable(p),this._gpuMemoryUsage+=p.statistics.gpuMemoryUsage}async _addComponentGeometry(e,t,r,s,n,i,o,a){if(null==t.loaded)return 0;const c=this._createComponentBuffers(i);if(null==c)return 0;const l=K(i),d=this._acquireRenderer(l,o||!1,!1),h=H.createBuffer(r.length/3);M(h.position.typedBuffer,r,h.position.typedBufferStride,3),Q(c.meta,n,h.componentIndex,s);const u=!0,m=d.writerSettings,g=await this._updatingHandles.addPromise(this._extractEdges(this._workerAbort.signal,m,h,u,!1,s));if(null==t.loaded)return 0;const p=this._createRenderable(g,c,e,d.key,!0);return t.renderables.push(p),d.addRenderable(p),this._updateAllVerticalOffsets(t,a),p.statistics.gpuMemoryUsage}async _addObjectMergedGeometries(e,t,r,s,n){const i=new Map;let o=0,a=0,c=null;const l=e.geometries.filter(e=>{if(e.edgeIndicesLength<=0||!e.material.supportsEdges)return!1;!c&&e.localOrigin&&(c=e);const t=e.positionAttribute;return a+=t.data.length/t.size,o+=e.edgeIndicesLength,!0});if(0===l.length)return;const d=a>=65536?Uint32Array:Uint16Array,h=o?new d(o):null,u=[];let m=0;l.forEach(e=>{const t=e.attributes.get("position"),r=t.indices;let s=i.get(t.data);if(null==s){s=u.length/3;for(let e=0;e<t.data.length;e+=t.size)u.push(t.data[e]),u.push(t.data[e+1]),u.push(t.data[e+2]);i.set(t.data,s)}for(let n=0;n<e.edgeIndicesLength;n++)h[m++]=s+r[n]});const g=c||e.geometries[0],p=f(),_=this._computeModelTransformWithLocalOrigin(e,g,p);for(let f=0;f<e.geometries.length;f++)e.geometries[f].localOrigin=_.origin;const b=new pe(new C(u,h,3),p,_);await this._updatingHandles.addPromise(this._addPositionData(t,b,h.length,r,s,n))}_acquireRenderer(e,t,r){const s=S.getKey(e,t,r);let n=this._renderers.get(s);return null==this._strokesTexture&&(this._strokesTexture=G(this.rctx)),n||(n=new S(this.rctx,this.techniques,{type:e,hasSlicePlane:t,strokesTexture:this._strokesTexture,legacy:r,spherical:1===this.viewingMode}),this._renderers.set(s,n)),++n.refCount,n}_removeRenderable(e){ee(e.regular),ee(e.silhouette);const t=this._renderers.get(e.rendererKey);if(t){t.removeRenderable(e),--t.refCount,this._localOrigins.release(e.transform.origin),this._gpuMemoryUsage-=e.statistics.externalMemoryUsage?0:e.statistics.gpuMemoryUsage;for(const t of e.components.meta)e.components.buffer.releaseIndex(t.index)}}_updateObjectCameraDistances(e){const t=e.camera.eye,r=e.camera.viewForward,s=w(),n=e=>{y(s,e.center,t);const n=j(s,r),i=e.radius,o=n<-i?1/0:n<i?0:n-i;e.renderables.forEach(e=>e.distanceToCamera=o)};this._objectEntries.forEach(n),this._pendingDeletions.forEach(n)}get test(){}};function ee(e){e?.vao&&(e.vao.buffer("instances")?.dispose(),e.vao.disposeVAOOnly(),e.vao=null)}function te(e){let t=null,s=null;for(const n of e.geometries){if(n.material.supportsEdges){if(t){if(!r(t,n.transformation))return!1}else t=n.transformation;if(s||null==n.localOrigin){if(null!=s?.localOrigin&&null!=n.localOrigin&&s.localOrigin.id!==n.localOrigin.id)return!1}else s=n}}return!0}e([d({constructOnly:!0})],$.prototype,"rctx",void 0),e([d({constructOnly:!0})],$.prototype,"renderSR",void 0),e([d({constructOnly:!0})],$.prototype,"viewingMode",void 0),e([d({constructOnly:!0})],$.prototype,"techniques",void 0),e([d({constructOnly:!0})],$.prototype,"setNeedsRender",void 0),e([d({constructOnly:!0})],$.prototype,"schedule",void 0),e([d({readOnly:!0})],$.prototype,"_updatingHandles",void 0),e([d({readOnly:!0})],$.prototype,"updating",null),$=e([h("esri.views.3d.webgl-engine.lib.edgeRendering.EdgeView")],$);class re{constructor(e,t,r,s){this.abort=e,this.radius=s,this.renderables=new Array;const n=e?l(e.signal,()=>e.abort()):null;this.loaded=t,this.loaded.then(()=>{null!=this.loaded&&(this.loaded=!0),this.abort=null,n?.remove()}),this.center=O(r)}}class se{constructor(e,t){this.buffer=e,this.meta=t}}class ne{constructor(e,t){this.vao=e,this.lod=t}}class ie{constructor(e,t){this.modelMatrix=e,this.origin=t}}class oe{constructor(e,t,r,s,n,i,o,a){this.regular=e,this.silhouette=t,this.statistics=r,this.transform=s,this.edgeTransparency=n,this.objectTransparency=i,this.components=o,this.rendererKey=a,this.distanceToCamera=0,this.visible=!0}}class ae extends oe{}function ce(e){const{meta:t,buffer:r}=e,s=new Uint8Array(4);for(let n=0;n<t.length;n++){const e=t[n].material,o=t[n].index,a=i(Math.round(e.size*I),0,255),c=i(e.extensionLength,-N,255-N)+N,l=255*e.opacity,d=e.color,h=255*d[0],u=255*d[1],m=255*d[2],g=255*d[3];r.textureBuffer.setData(o,0,h,u,m,g),r.textureBuffer.setData(o,1,a,c,e.type,l),R(t[n].verticalOffset,s),r.textureBuffer.setData(o,2,s[0],s[1],s[2],s[3])}}function le(e,t,r){let s,n;const i=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable(i=>{if(!he(i)||!i.visible)return;s??=e.acquireTechnique(t,!1),n??=e.rctx.bindTechnique(s,t,r);const a=ge(i.regular.lod.lengths,i.distanceToCamera,o);e.renderRegularEdges(n,i,r,t,a)},i)}function de(e,t,r){let s,n;const i=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable(i=>{if(!me(i)||!i.visible)return;s??=e.acquireTechnique(t,!0),n??=e.rctx.bindTechnique(s,t,r);const a=ge(i.silhouette.lod.lengths,i.distanceToCamera,o);e.renderSilhouetteEdges(n,i,r,t,a)},i)}function he(e){return null!=e.regular}class ue extends oe{}function me(e){return null!=e.silhouette}function ge(e,t,r){const n=t*r,i=s(e,n,!0);return-1===i?n<e[0]?e.length:0:e.length-i}class pe{constructor(e,t,r){this.position=e,this.modelTransform=t,this.origin=r}}const fe=p(),_e=()=>Promise.reject();export{$ as EdgeView,ie as LegacyTransform,ae as RegularRenderable,oe as Renderable,ue as SilhouetteRenderable};
5
+ import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{equals as r,binaryIndexOf as s}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import n from"../../../../../core/Logger.js";import{clamp as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as o,destroyMaybe as a}from"../../../../../core/maybe.js";import{isAbortError as c,onAbortOrThrow as l}from"../../../../../core/promiseUtils.js";import{property as d}from"../../../../../core/accessorSupport/decorators/property.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as u,transpose as m,invert as g}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as p}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{j as _,d as b,a as y,f as j}from"../../../../../chunks/vec32.js";import{create as w,clone as O}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as E}from"../../../../../core/support/UpdatingHandles.js";import{n as x,g as v}from"../../../../../chunks/sphere.js";import{c as M}from"../../../../../chunks/vec33.js";import{encodeElevationOffset as R}from"../../collections/Component/Material/shader/ComponentData.glsl.js";import{TwoVectorPosition as T}from"../../core/util/TwoVectorPosition.js";import{Attribute as C}from"../Attribute.js";import{GridLocalOriginFactory as D}from"../GridLocalOriginFactory.js";import{applyToModelMatrix as A}from"../localOriginHelper.js";import{LocalOriginManager as P}from"../LocalOriginManager.js";import{Object3D as k}from"../Object3D.js";import{VertexArrayObject as U}from"../VertexArrayObject.js";import{VertexLayout as q,glVertexLayout as B,EdgeInputBufferLayout as H,RegularEdgeInstancesGLLayout as L,SilhouetteEdgeInstancesGLLayout as V}from"./bufferLayouts.js";import{EdgeRenderer as S,lineWidthFractionFactor as I,extensionLengthOffset as N}from"./EdgeRenderer.js";import{EdgePassParameters as z}from"./EdgeShaderParameters.js";import{EdgeWorkerHandle as F}from"./EdgeWorkerHandle.js";import{generateStrokesTexture as G}from"./strokes.js";import{determineRendererType as K,determineEdgeTransparency as W,determineObjectTransparency as J,fillComponentBufferIndices as Q}from"./util.js";import{BufferManager as X}from"../TextureBackedBuffer/BufferManager.js";import{VertexBuffer as Y}from"../../../../webgl/VertexBuffer.js";const Z=128;let $=class extends t{constructor(e){super(e),this._updatingHandles=new E,this._objectEntries=new Map,this._pendingDeletions=new Map,this._renderers=new Map,this._gpuMemoryUsage=0,this._workerAbort=new AbortController,this._tmpModelPosition=w(),this._localOrigins=new P(new D(e.renderSR));const t=q.createBuffer(4);for(let r=0;r<4;r++)t.sideness.set(r,0,0===r||3===r?0:1),t.sideness.set(r,1,0===r||1===r?0:1);this._vertexBuffer=new Y(e.rctx,B,t.buffer)}initialize(){this._workerHandle=new F(this.schedule),this._componentColorManager=new X(this.rctx,3)}destroy(){this.destroyed||(this._objectEntries.forEach(e=>this._discardObjectEntry(e)),this._objectEntries.clear(),this._pendingDeletions.forEach(e=>this._discardObjectEntry(e)),this._pendingDeletions.clear(),this._strokesTexture=o(this._strokesTexture),this._componentColorManager=a(this._componentColorManager),this._workerAbort.abort(),this._workerHandle.destroy(),this._vertexBuffer.dispose(),this._renderers.clear(),this._updatingHandles.destroy(),this._set("schedule",_e))}get updating(){return this._updatingHandles.updating}get usedMemory(){return this._gpuMemoryUsage}shouldRender(){return this._renderers.size>0}async addComponentObject(e,t,r,s,n,i,o){if(this.hasObject(e))return this._getObjectMemoryUsage(e);let a;const c=new re(null,new Promise(e=>a=e),e.obb.center,e.obb.radius);this._objectEntries.set(e,c);const l=await this._updatingHandles.addPromise(this._addComponentGeometry(e.transform,c,t,r,s,n,i,o));return this.setNeedsRender(),a(),l}async addOrUpdateObject3D(e,t,r,s){if(this.destroyed)return void n.getLogger(this).warn("Attempt to add an object to a destroyed instance");const i=new AbortController;let o;const a=e.boundingVolumeWorldSpace.bounds,l=new re(i,new Promise(e=>o=e),x(a,w()),v(a)),d=this._objectEntries.get(e);d&&(this._pendingDeletions.has(e)?this._discardObjectEntry(d):this._pendingDeletions.set(e,d)),this._objectEntries.set(e,l);try{const n=new Array;if(e.geometries.length>1&&te(e))n.push(this._addObjectMergedGeometries(e,l,t,r,s));else for(const i of e.geometries)i.material.supportsEdges&&n.push(this._addGeometry(e,l,i,t,r,s));await this._updatingHandles.addPromise(Promise.all(n)),this._removePendingDeletion(e)}catch(h){c(h)?this._discardObjectEntry(l):this._removePendingDeletion(e)}finally{this.setNeedsRender(),o()}}removeObject(e){const t=this._objectEntries.get(e);this._objectEntries.delete(e),this._discardObjectEntry(t),this._removePendingDeletion(e)}_removePendingDeletion(e){const t=this._pendingDeletions.get(e);this._pendingDeletions.delete(e),this._discardObjectEntry(t)}async _getObjectEntry(e){const t=this._objectEntries.get(e);if(!t)throw new Error("no object");return await t.loaded,null==t.loaded?null:t}fastUpdateObject3DEdgesTransform(e){if(this.destroyed)return!1;const t=this._objectEntries.get(e);if(!t)return!1;const{geometries:r}=e,{renderables:s}=t;if(0===r.length||0===s.length)return!0;if(s.length>1)return!1;const[n]=s,i=n.transform;if(!(i instanceof ie))return!1;const[o]=r;if(o.localOrigin!==i.origin.origin)return!1;const a=f(),c=this._computeModelTransformWithLocalOrigin(e,o,a);return n.transform=new ie(a,c),this.setNeedsRender(),!0}_discardObjectEntry(e){e&&(e.abort?.abort(),e.renderables.length&&(e.renderables.forEach(e=>this._removeRenderable(e)),this.setNeedsRender()),e.loaded=null)}hasObject(e){return this._objectEntries.has(e)}async updateAllComponentOpacities(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));if(null==r)return;const s=Array.isArray(t)?e=>t[e]:()=>t;r.renderables.forEach(e=>{const t=e.components.meta.length;for(let r=0;r<t;r++){const t=s(r),n=e.components.meta[r],i=n.index;n.material.opacity=t,e.components.buffer.textureBuffer.setDataElement(i,1,3,255*t)}this._updateTransparency(e)}),this.setNeedsRender()}async _getObjectMemoryUsage(e){const t=await this._getObjectEntry(e);return t?t.renderables.reduce((e,t)=>e+t.statistics.gpuMemoryUsage,0):0}async updateAllComponentMaterials(e,t,r,s){const n=e instanceof k,i=K(t),o=S.getKey(i,r,n),a=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=a&&(a.renderables.forEach(e=>{if(o!==e.rendererKey){const t=this._renderers.get(e.rendererKey),s=this._acquireRenderer(i,r,n);t.removeRenderable(e),--t.refCount,e.rendererKey=o,s.addRenderable(e)}if(Array.isArray(t))for(let r=0;r<t.length;r++)e.components.meta[r].material=t[r];else e.components.meta[0].material=t;s&&ce(e.components),this._updateTransparency(e)}),this.setNeedsRender())}async updateAllVerticalOffsets(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=r&&this._updateAllVerticalOffsets(r,t)}_updateAllVerticalOffsets(e,t){e.renderables.forEach(e=>{const r=e.components.meta;for(let s=0;s<r.length;s++)e.components.meta[s].verticalOffset=t?.[s]??0;ce(e.components)}),this.setNeedsRender()}async updateObjectVisibility(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));r&&(r.renderables.forEach(e=>e.visible=t),this.setNeedsRender())}render(e,t){if(null==this._componentColorManager)return;this._localOrigins.updateViewMatrices(e.camera.viewMatrix);const r=e.camera.viewInverseTransposeMatrix,s=w(),n=new T;let i=0,o=0;if(this._renderers.forEach(r=>{0!==r.refCount?(++this.techniques.precompiling,r.forEachRenderable(t=>{t.visible&&(i+=t.statistics.averageEdgeLength,o++,t.regular&&r.acquireTechnique(e,!1),t.silhouette&&r.acquireTechnique(e,!0))},t),--this.techniques.precompiling):this._renderers.delete(r.key)}),this._componentColorManager.garbageCollect(),this._componentColorManager.updateTextures(),0===o)return;const a=new z(40*i/o,t);_(s,r[3],r[7],r[11]),n.set(s),b(a.transformWorldFromViewTH,n.high),b(a.transformWorldFromViewTL,n.low),u(a.transformViewFromCameraRelativeRS,e.camera.viewMatrix),m(fe,a.transformViewFromCameraRelativeRS),g(a.transformNormalViewFromGlobal,fe),a.transformProjFromView=e.camera.projectionMatrix,this._updateObjectCameraDistances(e),this._renderers.forEach(t=>{le(t,e,a),de(t,e,a)})}_updateTransparency(e){const t=W(e.components.meta),r=J(e.components.meta);t===e.edgeTransparency&&r===e.objectTransparency||(e.edgeTransparency=t,e.objectTransparency=r,this._renderers.get(e.rendererKey).setRenderablesDirty())}_computeModelTransformWithLocalOrigin(e,t,r){e.getCombinedShaderTransformation(t,r);const s=null!=t.localOrigin?this._localOrigins.register(t.localOrigin):this._localOrigins.acquire(_(this._tmpModelPosition,r[12],r[13],r[14]));return t.localOrigin=s.origin,A(s.origin.vec3,r),s}_createComponentBuffers(e){if(null==this._componentColorManager)return null;const t=new Array,r=this._componentColorManager.getBuffer(e.length);for(let n=0;n<e.length;n++){const s=e[n],i=r.acquireIndex();t.push({index:i,verticalOffset:0,material:s})}const s=new se(r,t);return ce(s),s}_extractEdges(e,t,r,s,n,i,o=i.length){return o<Z&&(n=!0),this._workerHandle.process({data:r,indices:i,indicesLength:o,writerSettings:t,skipDeduplicate:s},e,n)}_createRenderable(e,t,r,s,n){const i=t=>new ne(new U(this.rctx,new Map([["vertices",this._vertexBuffer],["instances",0===t?new Y(this.rctx,L,e.regular.instancesData.buffer):new Y(this.rctx,V,e.silhouette.instancesData.buffer)]])),0===t?e.regular.lodInfo:e.silhouette.lodInfo),o=e.regular.lodInfo.lengths.length>0?i(0):null,a=e.silhouette.lodInfo.lengths.length>0?i(1):null,c=(o?.vao.usedMemory??0)+(a?.vao.usedMemory??0);return new oe(o,a,{gpuMemoryUsage:c,externalMemoryUsage:n,averageEdgeLength:e.averageEdgeLength},r,W(t.meta),J(t.meta),t,s)}async _addGeometry(e,t,r,s,n,i){if(r.edgeIndicesLength<=0)return;const o=r.attributes.get("position"),a=f(),c=this._computeModelTransformWithLocalOrigin(e,r,a),l=new pe(o,a,c);return this._addPositionData(t,l,r.edgeIndicesLength,s,n,i)}async _addPositionData(e,t,r,s,n,i=!1){if(null==e.loaded)return;const o=this._createComponentBuffers([s]);if(null==o)return;const a=this._acquireRenderer(s.type,n,!0),{modelTransform:c,origin:l}=t,d=t.position.indices,h=t.position,u=h.data.length/h.size,m=H.createBuffer(u);for(let f=0;f<u;f++)m.position.set(f,0,h.data[f*h.size]),m.position.set(f,1,h.data[f*h.size+1]),m.position.set(f,2,h.data[f*h.size+2]);Q(o.meta,[0,m.componentIndex.count],m.componentIndex);const g=await this._updatingHandles.addPromise(this._extractEdges(e.abort?.signal||this._workerAbort.signal,a.writerSettings,m,!1,i,d,r));if(null==e.loaded)return;const p=this._createRenderable(g,o,new ie(c,l),a.key,!1);e.renderables.push(p),a.addRenderable(p),this._gpuMemoryUsage+=p.statistics.gpuMemoryUsage}async _addComponentGeometry(e,t,r,s,n,i,o,a){if(null==t.loaded)return 0;const c=this._createComponentBuffers(i);if(null==c)return 0;const l=K(i),d=this._acquireRenderer(l,o||!1,!1),h=H.createBuffer(r.length/3);M(h.position.typedBuffer,r,h.position.typedBufferStride,3),Q(c.meta,n,h.componentIndex,s);const u=!0,m=d.writerSettings,g=await this._updatingHandles.addPromise(this._extractEdges(this._workerAbort.signal,m,h,u,!1,s));if(null==t.loaded)return 0;const p=this._createRenderable(g,c,e,d.key,!0);return t.renderables.push(p),d.addRenderable(p),this._updateAllVerticalOffsets(t,a),p.statistics.gpuMemoryUsage}async _addObjectMergedGeometries(e,t,r,s,n){const i=new Map;let o=0,a=0,c=null;const l=e.geometries.filter(e=>{if(e.edgeIndicesLength<=0||!e.material.supportsEdges)return!1;!c&&e.localOrigin&&(c=e);const t=e.positionAttribute;return a+=t.data.length/t.size,o+=e.edgeIndicesLength,!0});if(0===l.length)return;const d=a>=65536?Uint32Array:Uint16Array,h=o?new d(o):null,u=[];let m=0;l.forEach(e=>{const t=e.attributes.get("position"),r=t.indices;let s=i.get(t.data);if(null==s){s=u.length/3;for(let e=0;e<t.data.length;e+=t.size)u.push(t.data[e]),u.push(t.data[e+1]),u.push(t.data[e+2]);i.set(t.data,s)}for(let n=0;n<e.edgeIndicesLength;n++)h[m++]=s+r[n]});const g=c||e.geometries[0],p=f(),_=this._computeModelTransformWithLocalOrigin(e,g,p);for(let f=0;f<e.geometries.length;f++)e.geometries[f].localOrigin=_.origin;const b=new pe(new C(u,h,3),p,_);await this._updatingHandles.addPromise(this._addPositionData(t,b,h.length,r,s,n))}_acquireRenderer(e,t,r){const s=S.getKey(e,t,r);let n=this._renderers.get(s);return null==this._strokesTexture&&(this._strokesTexture=G(this.rctx)),n||(n=new S(this.rctx,this.techniques,{type:e,hasSlicePlane:t,strokesTexture:this._strokesTexture,legacy:r,spherical:1===this.viewingMode}),this._renderers.set(s,n)),++n.refCount,n}_removeRenderable(e){ee(e.regular),ee(e.silhouette);const t=this._renderers.get(e.rendererKey);if(t){t.removeRenderable(e),--t.refCount,this._localOrigins.release(e.transform.origin),this._gpuMemoryUsage-=e.statistics.externalMemoryUsage?0:e.statistics.gpuMemoryUsage;for(const t of e.components.meta)e.components.buffer.releaseIndex(t.index)}}_updateObjectCameraDistances(e){const t=e.camera.eye,r=e.camera.viewForward,s=w(),n=e=>{y(s,e.center,t);const n=j(s,r),i=e.radius,o=n<-i?1/0:n<i?0:n-i;e.renderables.forEach(e=>e.distanceToCamera=o)};this._objectEntries.forEach(n),this._pendingDeletions.forEach(n)}get test(){}};function ee(e){e?.vao&&(e.vao.buffer("instances")?.dispose(),e.vao.disposeVAOOnly(),e.vao=null)}function te(e){let t=null,s=null;for(const n of e.geometries){if(n.material.supportsEdges){if(t){if(!r(t,n.transformation))return!1}else t=n.transformation;if(s||null==n.localOrigin){if(null!=s?.localOrigin&&null!=n.localOrigin&&s.localOrigin.id!==n.localOrigin.id)return!1}else s=n}}return!0}e([d({constructOnly:!0})],$.prototype,"rctx",void 0),e([d({constructOnly:!0})],$.prototype,"renderSR",void 0),e([d({constructOnly:!0})],$.prototype,"viewingMode",void 0),e([d({constructOnly:!0})],$.prototype,"techniques",void 0),e([d({constructOnly:!0})],$.prototype,"setNeedsRender",void 0),e([d({constructOnly:!0})],$.prototype,"schedule",void 0),e([d({readOnly:!0})],$.prototype,"_updatingHandles",void 0),e([d({readOnly:!0})],$.prototype,"updating",null),$=e([h("esri.views.3d.webgl-engine.lib.edgeRendering.EdgeView")],$);class re{constructor(e,t,r,s){this.abort=e,this.radius=s,this.renderables=new Array;const n=e?l(e.signal,()=>e.abort()):null;this.loaded=t,this.loaded.then(()=>{null!=this.loaded&&(this.loaded=!0),this.abort=null,n?.remove()}),this.center=O(r)}}class se{constructor(e,t){this.buffer=e,this.meta=t}}class ne{constructor(e,t){this.vao=e,this.lod=t}}class ie{constructor(e,t){this.modelMatrix=e,this.origin=t}}class oe{constructor(e,t,r,s,n,i,o,a){this.regular=e,this.silhouette=t,this.statistics=r,this.transform=s,this.edgeTransparency=n,this.objectTransparency=i,this.components=o,this.rendererKey=a,this.distanceToCamera=0,this.visible=!0}}class ae extends oe{}function ce(e){const{meta:t,buffer:r}=e,s=new Uint8Array(4);for(let n=0;n<t.length;n++){const e=t[n].material,o=t[n].index,a=i(Math.round(e.size*I),0,255),c=i(e.extensionLength,-N,255-N)+N,l=255*e.opacity,d=e.color,h=255*d[0],u=255*d[1],m=255*d[2],g=255*d[3];r.textureBuffer.setData(o,0,h,u,m,g),r.textureBuffer.setData(o,1,a,c,e.type,l),R(t[n].verticalOffset,s),r.textureBuffer.setData(o,2,s[0],s[1],s[2],s[3])}}function le(e,t,r){let s,n;const i=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable(i=>{if(!he(i)||!i.visible)return;s??=e.acquireTechnique(t,!1),n??=e.rctx.bindTechnique(s,t,r);const a=ge(i.regular.lod.lengths,i.distanceToCamera,o);e.renderRegularEdges(n,i,r,t,a)},i)}function de(e,t,r){let s,n;const i=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable(i=>{if(!me(i)||!i.visible)return;s??=e.acquireTechnique(t,!0),n??=e.rctx.bindTechnique(s,t,r);const a=ge(i.silhouette.lod.lengths,i.distanceToCamera,o);e.renderSilhouetteEdges(n,i,r,t,a)},i)}function he(e){return null!=e.regular}class ue extends oe{}function me(e){return null!=e.silhouette}function ge(e,t,r){const n=t*r,i=s(e,n,!0);return-1===i?n<e[0]?e.length:0:e.length-i}class pe{constructor(e,t,r){this.position=e,this.modelTransform=t,this.origin=r}}const fe=p(),_e=()=>Promise.reject();export{$ as EdgeView,ie as LegacyTransform,ae as RegularRenderable,oe as Renderable,ue as SilhouetteRenderable};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../../core/RandomLCG.js";import{f as e,n as o}from"../../../../../chunks/vec32.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{compressNormal as r}from"../Normals.js";import{RegularEdgeInstancesLayout as i,SilhouetteEdgeInstancesLayout as s}from"./bufferLayouts.js";const a=.7;class c{updateSettings(t){this.settings=t,this._edgeHashFunction=t.reducedPrecision?d:u}write(t,e,o){S.seed=this._edgeHashFunction(o);const n=S.getIntRange(0,255),r=S.getIntRange(0,this.settings.variants-1),i=S.getFloat(),s=255*(.5*g(-(1-Math.min(i/a,1))+Math.max(0,i-a)/(1-a),1.2)+.5);t.position0.setVec(e,o.position0),t.position1.setVec(e,o.position1),t.componentIndex.set(e,o.componentIndex),t.variantOffset.set(e,n),t.variantStroke.set(e,r),t.variantExtension.set(e,s)}}const f=new Float32Array(6),m=new Uint32Array(f.buffer),p=new Uint32Array(1);function u(t){return f[0]=t.position0[0],f[1]=t.position0[1],f[2]=t.position0[2],f[3]=t.position1[0],f[4]=t.position1[1],f[5]=t.position1[2],p[0]=31*(31*(31*(31*(31*(166811+m[0])+m[1])+m[2])+m[3])+m[4])+m[5],p[0]}function d(t){const e=f;e[0]=h(t.position0[0]),e[1]=h(t.position0[1]),e[2]=h(t.position0[2]),e[3]=h(t.position1[0]),e[4]=h(t.position1[1]),e[5]=h(t.position1[2]),p[0]=5381;for(let o=0;o<m.length;o++)p[0]=31*p[0]+m[o];return p[0]}const l=1e4;function h(t){return Math.round(t*l)/l}function g(t,e){return Math.abs(t)**e*Math.sign(t)}class w{constructor(){this._commonWriter=new c}updateSettings(t){this._commonWriter.updateSettings(t)}allocate(t){return i.createBuffer(t)}write(t,n,i){this._commonWriter.write(t,n,i),e(N,i.faceNormal0,i.faceNormal1),o(N,N);const{typedBuffer:s,typedBufferStride:a}=t.normalCompressed;r(s,n,N[0],N[1],N[2],a)}}class y{constructor(){this._commonWriter=new c}updateSettings(t){this._commonWriter.updateSettings(t)}allocate(t){return s.createBuffer(t)}write(t,e,o){this._commonWriter.write(t,e,o);{const{typedBuffer:n,typedBufferStride:i}=t.normalCompressed;r(n,e,o.faceNormal0[0],o.faceNormal0[1],o.faceNormal0[2],i)}{const{typedBuffer:n,typedBufferStride:i}=t.normal2Compressed;r(n,e,o.faceNormal1[0],o.faceNormal1[1],o.faceNormal1[2],i)}}}const N=n(),S=new t;export{w as RegularEdgeBufferWriter,y as SilhouetteEdgeBufferWriter};
5
+ import t from"../../../../../core/RandomLCG.js";import{g as e,n as o}from"../../../../../chunks/vec32.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{compressNormal as r}from"../Normals.js";import{RegularEdgeInstancesLayout as i,SilhouetteEdgeInstancesLayout as s}from"./bufferLayouts.js";const a=.7;class c{updateSettings(t){this.settings=t,this._edgeHashFunction=t.reducedPrecision?d:u}write(t,e,o){S.seed=this._edgeHashFunction(o);const n=S.getIntRange(0,255),r=S.getIntRange(0,this.settings.variants-1),i=S.getFloat(),s=255*(.5*g(-(1-Math.min(i/a,1))+Math.max(0,i-a)/(1-a),1.2)+.5);t.position0.setVec(e,o.position0),t.position1.setVec(e,o.position1),t.componentIndex.set(e,o.componentIndex),t.variantOffset.set(e,n),t.variantStroke.set(e,r),t.variantExtension.set(e,s)}}const m=new Float32Array(6),f=new Uint32Array(m.buffer),p=new Uint32Array(1);function u(t){return m[0]=t.position0[0],m[1]=t.position0[1],m[2]=t.position0[2],m[3]=t.position1[0],m[4]=t.position1[1],m[5]=t.position1[2],p[0]=31*(31*(31*(31*(31*(166811+f[0])+f[1])+f[2])+f[3])+f[4])+f[5],p[0]}function d(t){const e=m;e[0]=h(t.position0[0]),e[1]=h(t.position0[1]),e[2]=h(t.position0[2]),e[3]=h(t.position1[0]),e[4]=h(t.position1[1]),e[5]=h(t.position1[2]),p[0]=5381;for(let o=0;o<f.length;o++)p[0]=31*p[0]+f[o];return p[0]}const l=1e4;function h(t){return Math.round(t*l)/l}function g(t,e){return Math.abs(t)**e*Math.sign(t)}class w{constructor(){this._commonWriter=new c}updateSettings(t){this._commonWriter.updateSettings(t)}allocate(t){return i.createBuffer(t)}write(t,n,i){this._commonWriter.write(t,n,i),e(N,i.faceNormal0,i.faceNormal1),o(N,N);const{typedBuffer:s,typedBufferStride:a}=t.normalCompressed;r(s,n,N[0],N[1],N[2],a)}}class y{constructor(){this._commonWriter=new c}updateSettings(t){this._commonWriter.updateSettings(t)}allocate(t){return s.createBuffer(t)}write(t,e,o){this._commonWriter.write(t,e,o);{const{typedBuffer:n,typedBufferStride:i}=t.normalCompressed;r(n,e,o.faceNormal0[0],o.faceNormal0[1],o.faceNormal0[2],i)}{const{typedBuffer:n,typedBufferStride:i}=t.normal2Compressed;r(n,e,o.faceNormal1[0],o.faceNormal1[1],o.faceNormal1[2],i)}}}const N=n(),S=new t;export{w as RegularEdgeBufferWriter,y as SilhouetteEdgeBufferWriter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{acosClamped as e,deg2rad as t}from"../../../../../core/mathUtils.js";import n from"../../../../../core/PooledArray.js";import{j as o,i as s,c as a,e as r,d as c,h as l,n as i,E as h}from"../../../../../chunks/vec32.js";import{create as u}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Edge as g}from"./Edge.js";const p=-1;function d(e,t,n){const c=e.vertices.position,l=e.vertices.componentIndex,i=I.position0,h=I.position1,u=I.faceNormal0,g=I.faceNormal1,{edges:d,normals:v}=w(e),x=d.length/4,j=t.allocate(x);let y=0;const N=x,E=n?.allocate(N);let b=0,D=0,F=0;V.length=0;for(let s=0;s<x;++s){const e=4*s;c.getVec(d.data[e],i),c.getVec(d.data[e+1],h);const t=V.pushNew();t.index=4*s,t.length=o(i,h)}V.sort((e,t)=>t.length-e.length);const L=new Array,U=new Array;V.forAll(({length:e,index:o})=>{const w=d.data[o],x=d.data[o+1],V=d.data[o+2],N=d.data[o+3],q=N===p;if(c.getVec(w,i),c.getVec(x,h),q){const e=3*V;s(u,v.data[e],v.data[e+1],v.data[e+2]),a(g,u),I.componentIndex=l.get(w),I.cosAngle=r(u,g)}else{let e=3*V;if(s(u,v.data[e],v.data[e+1],v.data[e+2]),e=3*N,s(g,v.data[e],v.data[e+1],v.data[e+2]),I.componentIndex=l.get(w),I.cosAngle=r(u,g),m(I,k))return;I.cosAngle<-.9999&&a(g,u)}D+=e,F++,q||f(I,P)?(t.write(j,y++,I),L.push(e)):A(I,M)&&(E&&n&&n.write(E,b++,I),U.push(e))});const q=new Float32Array(L.reverse()),z=new Float32Array(U.reverse()),B=E&&n?{instancesData:E.slice(0,b),lodInfo:{lengths:z}}:void 0;return{regular:{instancesData:j.slice(0,y),lodInfo:{lengths:q}},silhouette:B,averageEdgeLength:D/F}}function f(e,t){return e.cosAngle<t}function m(e,t){return e.cosAngle>t}function A(t,n){const o=e(t.cosAngle);h(E,t.position1,t.position0);return o*(r(l(N,t.faceNormal0,t.faceNormal1),E)>0?-1:1)>n}function w(e){const t=e.faces.length/3,n=e.faces,o=e.neighbors,s=e.vertices.position;j.length=y.length=0;for(let a=0;a<t;a++){const e=3*a,t=o[e],r=o[e+1],h=o[e+2],u=n[e],g=n[e+1],d=n[e+2];s.getVec(u,b),s.getVec(g,D),s.getVec(d,F),c(D,D,b),c(F,F,b),l(b,D,F),i(b,b),y.pushArray(b),(t===p||u<g)&&(j.push(u),j.push(g),j.push(a),j.push(t)),(r===p||g<d)&&(j.push(g),j.push(d),j.push(a),j.push(r)),(h===p||d<u)&&(j.push(d),j.push(u),j.push(a),j.push(h))}return{edges:j,normals:y}}class v{constructor(){this.index=0,this.length=0}}function x(){V.prune(),j.prune(),y.prune()}const V=new n({allocator:e=>e||new v,deallocator:null}),j=new n({deallocator:null}),y=new n({deallocator:null}),I=new g,N=u(),E=u(),b=u(),D=u(),F=u(),M=t(4),k=Math.cos(M),L=t(35),P=Math.cos(L);export{x as cleanupEdgeProcessing,d as extractEdges};
5
+ import{acosClamped as e,deg2rad as t}from"../../../../../core/mathUtils.js";import n from"../../../../../core/PooledArray.js";import{k as o,j as s,d as a,f as r,e as c,i as l,n as i,E as u}from"../../../../../chunks/vec32.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Edge as g}from"./Edge.js";const p=-1;function d(e,t,n){const c=e.vertices.position,l=e.vertices.componentIndex,i=I.position0,u=I.position1,h=I.faceNormal0,g=I.faceNormal1,{edges:d,normals:v}=w(e),x=d.length/4,j=t.allocate(x);let y=0;const N=x,E=n?.allocate(N);let b=0,k=0,D=0;V.length=0;for(let s=0;s<x;++s){const e=4*s;c.getVec(d.data[e],i),c.getVec(d.data[e+1],u);const t=V.pushNew();t.index=4*s,t.length=o(i,u)}V.sort((e,t)=>t.length-e.length);const L=new Array,U=new Array;V.forAll(({length:e,index:o})=>{const w=d.data[o],x=d.data[o+1],V=d.data[o+2],N=d.data[o+3],q=N===p;if(c.getVec(w,i),c.getVec(x,u),q){const e=3*V;s(h,v.data[e],v.data[e+1],v.data[e+2]),a(g,h),I.componentIndex=l.get(w),I.cosAngle=r(h,g)}else{let e=3*V;if(s(h,v.data[e],v.data[e+1],v.data[e+2]),e=3*N,s(g,v.data[e],v.data[e+1],v.data[e+2]),I.componentIndex=l.get(w),I.cosAngle=r(h,g),m(I,M))return;I.cosAngle<-.9999&&a(g,h)}k+=e,D++,q||f(I,P)?(t.write(j,y++,I),L.push(e)):A(I,F)&&(E&&n&&n.write(E,b++,I),U.push(e))});const q=new Float32Array(L.reverse()),z=new Float32Array(U.reverse()),B=E&&n?{instancesData:E.slice(0,b),lodInfo:{lengths:z}}:void 0;return{regular:{instancesData:j.slice(0,y),lodInfo:{lengths:q}},silhouette:B,averageEdgeLength:k/D}}function f(e,t){return e.cosAngle<t}function m(e,t){return e.cosAngle>t}function A(t,n){const o=e(t.cosAngle);u(E,t.position1,t.position0);return o*(r(l(N,t.faceNormal0,t.faceNormal1),E)>0?-1:1)>n}function w(e){const t=e.faces.length/3,n=e.faces,o=e.neighbors,s=e.vertices.position;j.length=y.length=0;for(let a=0;a<t;a++){const e=3*a,t=o[e],r=o[e+1],u=o[e+2],h=n[e],g=n[e+1],d=n[e+2];s.getVec(h,b),s.getVec(g,k),s.getVec(d,D),c(k,k,b),c(D,D,b),l(b,k,D),i(b,b),y.pushArray(b),(t===p||h<g)&&(j.push(h),j.push(g),j.push(a),j.push(t)),(r===p||g<d)&&(j.push(g),j.push(d),j.push(a),j.push(r)),(u===p||d<h)&&(j.push(d),j.push(h),j.push(a),j.push(u))}return{edges:j,normals:y}}class v{constructor(){this.index=0,this.length=0}}function x(){V.prune(),j.prune(),y.prune()}const V=new n({allocator:e=>e||new v,deallocator:null}),j=new n({deallocator:null}),y=new n({deallocator:null}),I=new g,N=h(),E=h(),b=h(),k=h(),D=h(),F=t(4),M=Math.cos(F),L=t(35),P=Math.cos(L);export{x as cleanupEdgeProcessing,d as extractEdges};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{i as t,f as e,g as n,F as r}from"../../../../chunks/vec32.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{areaPoints3d as s}from"../../../../geometry/support/triangle.js";function i(r,o){if(!r)return!1;const{size:i,data:c,indices:f}=r;t(o,0,0,0),t(m,0,0,0);let g=0,d=0;for(let p=0;p<f.length-2;p+=3){const r=f[p]*i,h=f[p+1]*i,j=f[p+2]*i;t(a,c[r],c[r+1],c[r+2]),t(l,c[h],c[h+1],c[h+2]),t(u,c[j],c[j+1],c[j+2]);const z=s(a,l,u);z?(e(a,a,l),e(a,a,u),n(a,a,1/3*z),e(o,o,a),g+=z):(e(m,m,a),e(m,m,l),e(m,m,u),d+=3)}return(0!==d||0!==g)&&(0!==g?(n(o,o,1/g),!0):0!==d&&(n(o,m,1/d),!0))}function c(e,r){if(!e)return!1;const{size:o,data:s,indices:i}=e;t(r,0,0,0);let c=-1,f=0;for(let t=0;t<i.length;t++){const e=i[t]*o;c!==e&&(r[0]+=s[e],r[1]+=s[e+1],r[2]+=s[e+2],f++),c=e}return f>1&&n(r,r,1/f),f>0}function f(o,s,i){if(!o)return!1;t(i,0,0,0),t(m,0,0,0);let c=0,f=0;const{size:u,data:g,indices:d}=o,p=d.length-1,h=p+(s?2:0);for(let t=0;t<h;t+=2){const o=t<p?t+1:0,s=d[t<p?t:p]*u,h=d[o]*u;a[0]=g[s],a[1]=g[s+1],a[2]=g[s+2],l[0]=g[h],l[1]=g[h+1],l[2]=g[h+2],n(a,e(a,a,l),.5);const j=r(a,l);j>0?(e(i,i,n(a,a,j)),c+=j):0===c&&(e(m,m,a),f++)}return 0!==c?(n(i,i,1/c),!0):0!==f&&(n(i,m,1/f),!0)}const a=o(),l=o(),u=o(),m=o();export{f as computeAttachmentOriginLines,c as computeAttachmentOriginPoints,i as computeAttachmentOriginTriangles};
5
+ import{j as t,g as e,h as n,F as r}from"../../../../chunks/vec32.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{areaPoints3d as s}from"../../../../geometry/support/triangle.js";function i(r,o){if(!r)return!1;const{size:i,data:c,indices:f}=r;t(o,0,0,0),t(m,0,0,0);let g=0,d=0;for(let p=0;p<f.length-2;p+=3){const r=f[p]*i,h=f[p+1]*i,j=f[p+2]*i;t(a,c[r],c[r+1],c[r+2]),t(l,c[h],c[h+1],c[h+2]),t(u,c[j],c[j+1],c[j+2]);const z=s(a,l,u);z?(e(a,a,l),e(a,a,u),n(a,a,1/3*z),e(o,o,a),g+=z):(e(m,m,a),e(m,m,l),e(m,m,u),d+=3)}return(0!==d||0!==g)&&(0!==g?(n(o,o,1/g),!0):0!==d&&(n(o,m,1/d),!0))}function c(e,r){if(!e)return!1;const{size:o,data:s,indices:i}=e;t(r,0,0,0);let c=-1,f=0;for(let t=0;t<i.length;t++){const e=i[t]*o;c!==e&&(r[0]+=s[e],r[1]+=s[e+1],r[2]+=s[e+2],f++),c=e}return f>1&&n(r,r,1/f),f>0}function f(o,s,i){if(!o)return!1;t(i,0,0,0),t(m,0,0,0);let c=0,f=0;const{size:u,data:g,indices:d}=o,p=d.length-1,h=p+(s?2:0);for(let t=0;t<h;t+=2){const o=t<p?t+1:0,s=d[t<p?t:p]*u,h=d[o]*u;a[0]=g[s],a[1]=g[s+1],a[2]=g[s+2],l[0]=g[h],l[1]=g[h+1],l[2]=g[h+2],n(a,e(a,a,l),.5);const j=r(a,l);j>0?(e(i,i,n(a,a,j)),c+=j):0===c&&(e(m,m,a),f++)}return 0!==c?(n(i,i,1/c),!0):0!==f&&(n(i,m,1/f),!0)}const a=o(),l=o(),u=o(),m=o();export{f as computeAttachmentOriginLines,c as computeAttachmentOriginPoints,i as computeAttachmentOriginTriangles};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{m as o}from"../../../../chunks/vec32.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{e as s}from"../../../../chunks/boundedPlane.js";function e(r){return(e,c,m)=>!s(r,o(t,e,c,m))}const t=r();export{e as sliceFilterPredicate};
5
+ import{l as o}from"../../../../chunks/vec32.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{e as s}from"../../../../chunks/boundedPlane.js";function e(r){return(e,c,n)=>!s(r,o(t,e,c,n))}const t=r();export{e as sliceFilterPredicate};