@arcgis/core 5.2.0-next.75 → 5.2.0-next.76

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 (355) hide show
  1. package/arcgisGlobal.d.ts +1 -0
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/013c9cc198736a72f7f2.js +1 -0
  4. package/assets/esri/core/workers/chunks/0194244a3f437ad74045.js +1 -0
  5. package/assets/esri/core/workers/chunks/{4dcd4a052b40047a9230.js → 08cac27df6c216ae1995.js} +1 -1
  6. package/assets/esri/core/workers/chunks/08ec5461af74356e7570.js +1 -0
  7. package/assets/esri/core/workers/chunks/0909816f13d25cacf250.js +1 -0
  8. package/assets/esri/core/workers/chunks/0933203eee15ea50e123.js +1 -0
  9. package/assets/esri/core/workers/chunks/{5e1d84e97de0e662aaa9.js → 1142f8e9c80207d6bdae.js} +1 -1
  10. package/assets/esri/core/workers/chunks/16929524565a677db4dc.js +1 -0
  11. package/assets/esri/core/workers/chunks/16a04fc184728d66e6e1.js +1 -0
  12. package/assets/esri/core/workers/chunks/177c3b23c1cbd4737049.js +1 -0
  13. package/assets/esri/core/workers/chunks/1a467da4c0b33f655199.js +1 -0
  14. package/assets/esri/core/workers/chunks/1ef28d4457c8c943ad19.js +1 -0
  15. package/assets/esri/core/workers/chunks/{2b93888e61ca638490cf.js → 20b54e7872d967f3be32.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{5f31b375971ab067121e.js → 21f763694a41968ac21a.js} +1 -1
  17. package/assets/esri/core/workers/chunks/230925079cee040a8d77.js +1 -0
  18. package/assets/esri/core/workers/chunks/257f1e8316877f611e11.js +1 -0
  19. package/assets/esri/core/workers/chunks/270ed3070d118edb3f37.js +1 -0
  20. package/assets/esri/core/workers/chunks/2e7c830b5b1fe406169f.js +1 -0
  21. package/assets/esri/core/workers/chunks/315031323e11a18154e3.js +1 -0
  22. package/assets/esri/core/workers/chunks/393f79843d5a78c1cc37.js +1 -0
  23. package/assets/esri/core/workers/chunks/3b5c5356353f1a2303a0.js +1 -0
  24. package/assets/esri/core/workers/chunks/{99e3aa4832ed87474ab4.js → 44857a76be2c0ac65bb9.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{3e2b4e734aa20a308f3e.js → 46e56fac44e0fd26ba1d.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{4491dc227c28e2ab4f8e.js → 484b251fbcbffcb58323.js} +1 -1
  27. package/assets/esri/core/workers/chunks/48e2d0bfb62e1f4f2ad9.js +1 -0
  28. package/assets/esri/core/workers/chunks/4945d6b0ca1812864185.js +1 -0
  29. package/assets/esri/core/workers/chunks/{7f2f2a92dce3f68e579b.js → 4b54444c04fbd6f42c18.js} +1 -1
  30. package/assets/esri/core/workers/chunks/4c82f5f23004f905a18f.js +1 -0
  31. package/assets/esri/core/workers/chunks/4f8ce5887102971bfa34.js +2 -0
  32. package/assets/esri/core/workers/chunks/{186bedc377cc97731ca2.js → 532e3a59888e4cc13bd3.js} +2 -2
  33. package/assets/esri/core/workers/chunks/53eed0941a39b56cc034.js +1 -0
  34. package/assets/esri/core/workers/chunks/56e6d8c4a9ed893ce951.js +1 -0
  35. package/assets/esri/core/workers/chunks/57159bcac86d660dcceb.js +1 -0
  36. package/assets/esri/core/workers/chunks/58026fc30d8a0ded4102.js +1 -0
  37. package/assets/esri/core/workers/chunks/59598023c0aea62a6297.js +1 -0
  38. package/assets/esri/core/workers/chunks/5bf2ce280ea35ea4c96b.js +1 -0
  39. package/assets/esri/core/workers/chunks/5fd2aa0be03dfb494efa.js +1 -0
  40. package/assets/esri/core/workers/chunks/619aa1381296172ff47b.js +1 -0
  41. package/assets/esri/core/workers/chunks/62f37d1075390a177ae9.js +1 -0
  42. package/assets/esri/core/workers/chunks/65d1e338612e59063eba.js +1 -0
  43. package/assets/esri/core/workers/chunks/680dd7b7638465eb33de.js +1 -0
  44. package/assets/esri/core/workers/chunks/6c740c411b085d2d08c4.js +1 -0
  45. package/assets/esri/core/workers/chunks/{b14961a9f1f40028f141.js → 6c982779d6d47ec99899.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{0eb35e09765fd74eb698.js → 6e45ecf359bce3417f5d.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{a52c88e2d837b525ff6c.js → 71ee7c51d2c60a180f1e.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{ad1d06a91121ebfe9162.js → 755b2d883fba90c4e688.js} +2 -2
  49. package/assets/esri/core/workers/chunks/{6b783f440c4a5d36e879.js → 75fc0b1db8e2e3fd2458.js} +1 -1
  50. package/assets/esri/core/workers/chunks/79429c8be5da85713200.js +1 -0
  51. package/assets/esri/core/workers/chunks/7b470d6ad182548b9e95.js +1 -0
  52. package/assets/esri/core/workers/chunks/7d8eb4dbea1916320f74.js +1 -0
  53. package/assets/esri/core/workers/chunks/83e54166ba634ec2bd89.js +1717 -0
  54. package/assets/esri/core/workers/chunks/87eaed6fdabd482d142e.js +1 -0
  55. package/assets/esri/core/workers/chunks/88d5541679e77117bf03.js +1 -0
  56. package/assets/esri/core/workers/chunks/894ebc64b698e5d7604b.js +1 -0
  57. package/assets/esri/core/workers/chunks/{67f54586156d1ab80257.js → 8b980c6b92cc4ea68ede.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{4046bd65d7d0677f4600.js → 8d9a7fa14489897780d3.js} +1 -1
  59. package/assets/esri/core/workers/chunks/8e225dd0319672103561.js +1 -0
  60. package/assets/esri/core/workers/chunks/9199300ffd225a1bbef1.js +1 -0
  61. package/assets/esri/core/workers/chunks/{5ba3a30b7cbfa9e3aa62.js → 94b9a61b4dbb83425a78.js} +1 -1
  62. package/assets/esri/core/workers/chunks/98613fded899c59f34a4.js +1 -0
  63. package/assets/esri/core/workers/chunks/{6743d726e45e7b660505.js → 9c3e6325dc60bcaf44d7.js} +1 -1
  64. package/assets/esri/core/workers/chunks/9e1392a0c608a13ab036.js +1 -0
  65. package/assets/esri/core/workers/chunks/{7a24cc0f3b4eff2bdb8e.js → 9e2e4d197a7a57c2a691.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{d03e7be74c57c3dbf003.js → a014c17fc210620da738.js} +2 -2
  67. package/assets/esri/core/workers/chunks/{8302bffd28cc6720e0fe.js → a19be304219808268039.js} +2 -2
  68. package/assets/esri/core/workers/chunks/{53d165b4f30fd64e5d8a.js → a4e4fa4dd1a122bbf7cd.js} +1 -1
  69. package/assets/esri/core/workers/chunks/a5240c8a47842138f31f.js +1 -0
  70. package/assets/esri/core/workers/chunks/a69c10bfd632a5546b34.js +1 -0
  71. package/assets/esri/core/workers/chunks/a7727a2377470d586ff9.js +1 -0
  72. package/assets/esri/core/workers/chunks/a91c1d782346a9c7e1ef.js +1 -0
  73. package/assets/esri/core/workers/chunks/{6cd6d0cfd313f0475d98.js → ac59218847e5ef4c4160.js} +1 -1
  74. package/assets/esri/core/workers/chunks/ac87be2210f868524996.js +1 -0
  75. package/assets/esri/core/workers/chunks/aed16c3e26652960ad3f.js +1 -0
  76. package/assets/esri/core/workers/chunks/{43713bc6f7eea07259d0.js → b084829a3fd709dc47a8.js} +1 -1
  77. package/assets/esri/core/workers/chunks/{05f6887805d92da03122.js → b24fc7eeda580ef020d2.js} +1 -1
  78. package/assets/esri/core/workers/chunks/b37a20c5c4a4686257d4.js +1 -0
  79. package/assets/esri/core/workers/chunks/{43a65cab888d43954564.js → b4abf82b8ac974a55ae1.js} +1 -1
  80. package/assets/esri/core/workers/chunks/b950ddafba8125c84a5b.js +1 -0
  81. package/assets/esri/core/workers/chunks/bab5f4b2424b487b87ac.js +1 -0
  82. package/assets/esri/core/workers/chunks/{0d3b2d9a19383bb63f0a.js → bad2c7219e95750906e1.js} +1 -1
  83. package/assets/esri/core/workers/chunks/bbc6b270d2032189107c.js +1 -0
  84. package/assets/esri/core/workers/chunks/bc6e488f5fbd50f9f3d0.js +1 -0
  85. package/assets/esri/core/workers/chunks/bd7d87d175ba933ab2ce.js +1 -0
  86. package/assets/esri/core/workers/chunks/{1c49c9472167a2e0c923.js → c17dda6fadb8bfad0d51.js} +1 -1
  87. package/assets/esri/core/workers/chunks/c1e5ffe9a251be5a0744.js +1 -0
  88. package/assets/esri/core/workers/chunks/ca6652c6304ad0e37e8f.js +1 -0
  89. package/assets/esri/core/workers/chunks/{762be5d3e6aeaea33f74.js → cef02ed3942c010da2e8.js} +1 -1
  90. package/assets/esri/core/workers/chunks/d520d407043bc52e5410.js +1 -0
  91. package/assets/esri/core/workers/chunks/da0ef984509057ec8507.js +1 -0
  92. package/assets/esri/core/workers/chunks/dbdd96e558936955acdb.js +1 -0
  93. package/assets/esri/core/workers/chunks/de927b1460bc384f5b87.js +1 -0
  94. package/assets/esri/core/workers/chunks/de9a1cce70581920f248.js +1 -0
  95. package/assets/esri/core/workers/chunks/dff932682d6386a861ce.js +1 -0
  96. package/assets/esri/core/workers/chunks/{2c31648a4b95275516ee.js → e227eb44cd139fe2bc1b.js} +1 -1
  97. package/assets/esri/core/workers/chunks/e4e5a171a4874c5af4a4.js +1 -0
  98. package/assets/esri/core/workers/chunks/{ddb92c815d17c67a45e6.js → e5d114f2b57d2b8e2f1c.js} +1 -1
  99. package/assets/esri/core/workers/chunks/e89e6eea380ca2c13b64.js +1 -0
  100. package/assets/esri/core/workers/chunks/e9d352d030dcad1619a6.js +1 -0
  101. package/assets/esri/core/workers/chunks/{3de6e54b6ed0feae1940.js → eae51e827f629ab37207.js} +1 -1
  102. package/assets/esri/core/workers/chunks/eee1fd629619021ea279.js +1 -0
  103. package/assets/esri/core/workers/chunks/{b6cd165d0e58598f28a5.js → ef47a5da641cb0d33fdf.js} +1 -1
  104. package/assets/esri/core/workers/chunks/f35e749bb5be39880cbe.js +1 -0
  105. package/assets/esri/core/workers/chunks/{3dff36f6de181d9dcdc5.js → f40e4433e7608d0962a6.js} +1 -1
  106. package/assets/esri/core/workers/chunks/{d1c7c877edc6948f3801.js → f4aa6e90200f61e623e5.js} +1 -1
  107. package/assets/esri/core/workers/chunks/{36ec5b84e551ab08b24a.js → ff578f0ca68d652fece5.js} +1 -1
  108. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  109. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  110. package/assets/esri/libs/text/pkg/bundle_bg.wasm +0 -0
  111. package/chunks/HeatmapDensity.glsl.js +5 -5
  112. package/chunks/bundle2.js +1 -1
  113. package/chunks/lyr3DMain.js +1 -1
  114. package/chunks/lyr3DWorker.js +1 -1
  115. package/config.js +1 -1
  116. package/geometry/geometryEngine.js +1 -1
  117. package/geometry/support/centroid.js +1 -1
  118. package/geometry/support/extentUtils.js +1 -1
  119. package/geometry/support/frustum.js +1 -1
  120. package/kernel.js +1 -1
  121. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  122. package/layers/graphics/data/QueryEngineResult.js +1 -1
  123. package/layers/graphics/data/projectionSupport.js +1 -1
  124. package/layers/graphics/sources/support/sourceUtils.js +1 -1
  125. package/package.json +2 -2
  126. package/support/revision.js +1 -1
  127. package/symbols/cim/animationUtils.js +1 -1
  128. package/symbols/cim/cimAnalyzer.js +1 -1
  129. package/symbols/cim/effects/EffectCircularSector.js +1 -1
  130. package/views/2d/engine/BitmapTile.js +1 -1
  131. package/views/2d/engine/flow/styles/Imagery.js +1 -1
  132. package/views/2d/engine/flow/styles/Particles.js +1 -1
  133. package/views/2d/engine/flow/styles/Streamlines.js +1 -1
  134. package/views/2d/engine/imagery/RasterTile.js +1 -1
  135. package/views/2d/engine/imagery/RasterVFTile.js +1 -1
  136. package/views/2d/engine/vectorTiles/SpriteMosaic.js +1 -1
  137. package/views/2d/engine/vectorTiles/TileHandler3D.js +1 -1
  138. package/views/2d/engine/vectorTiles/VTLPainter3D.js +1 -1
  139. package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
  140. package/views/2d/engine/vectorTiles/VectorTileRendererHelper3D.js +1 -1
  141. package/views/2d/engine/webgl/FeatureDisplayList.js +1 -1
  142. package/views/2d/engine/webgl/Painter.js +1 -1
  143. package/views/2d/engine/webgl/RenderingDevice.js +1 -1
  144. package/views/2d/engine/webgl/TileContainer.js +1 -1
  145. package/views/2d/engine/webgl/TiledDisplayObject.js +1 -1
  146. package/views/2d/engine/webgl/animations/infos.js +1 -1
  147. package/views/2d/engine/webgl/animations/instructions.js +1 -1
  148. package/views/2d/engine/webgl/normalizedTileUtils.js +1 -1
  149. package/views/2d/engine/webgl/shaderGraph/GraphShaderModule.js +1 -1
  150. package/views/2d/engine/webgl/shaderGraph/graph/ShaderGraphContext.js +1 -1
  151. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AAnimatedShader.js +1 -1
  152. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedFillShader.js +1 -1
  153. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedLineShader.js +1 -1
  154. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerShader.js +1 -1
  155. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedTechnique.js +1 -1
  156. package/views/2d/engine/webgl/shaderGraph/techniques/bitmap/BitmapTechnique.js +1 -1
  157. package/views/2d/engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js +1 -1
  158. package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityPointShader.js +1 -1
  159. package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityTechnique.js +1 -1
  160. package/views/2d/engine/webgl/shaderGraph/techniques/drop-shadow/DropShadowTechnique.js +1 -1
  161. package/views/2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js +1 -1
  162. package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexFillTechnique.js +1 -1
  163. package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillTechnique.js +1 -1
  164. package/views/2d/engine/webgl/shaderGraph/techniques/fill/FillTechnique.js +1 -1
  165. package/views/2d/engine/webgl/shaderGraph/techniques/fill/GradientFillTechnique.js +1 -1
  166. package/views/2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillTechnique.js +1 -1
  167. package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternFillTechnique.js +1 -1
  168. package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillTechnique.js +1 -1
  169. package/views/2d/engine/webgl/shaderGraph/techniques/flow/FlowTechnique.js +1 -1
  170. package/views/2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapTechnique.js +1 -1
  171. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelTechnique.js +1 -1
  172. package/views/2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeTechnique.js +1 -1
  173. package/views/2d/engine/webgl/shaderGraph/techniques/line/LineTechnique.js +1 -1
  174. package/views/2d/engine/webgl/shaderGraph/techniques/line/TexturedLineTechnique.js +1 -1
  175. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerShader.js +1 -1
  176. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerTechnique.js +1 -1
  177. package/views/2d/engine/webgl/shaderGraph/techniques/overlay/OverlayTechnique.js +1 -1
  178. package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartShader.js +1 -1
  179. package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartTechnique.js +1 -1
  180. package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterColorizerTechnique.js +1 -1
  181. package/views/2d/engine/webgl/shaderGraph/techniques/raster/VectorFieldTechnique.js +1 -1
  182. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/AFeatureShader.js +1 -1
  183. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BitmapShader.js +1 -1
  184. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BlendShader.js +1 -1
  185. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ComplexFillShader.js +1 -1
  186. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/FillShader.js +1 -1
  187. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/GradientFillShader.js +1 -1
  188. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/GradientStrokeShader.js +1 -1
  189. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/HeatmapAccumulateShader.js +1 -1
  190. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/LineShader.js +1 -1
  191. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/OutlineFillShader.js +1 -1
  192. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/PatternFillShader.js +1 -1
  193. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TexturedLineShader.js +1 -1
  194. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/Tile.js +1 -1
  195. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js +1 -1
  196. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TileInfo.js +1 -1
  197. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TileStencilShader.js +1 -1
  198. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ViewInfo.js +1 -1
  199. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/hittestUtils.js +1 -1
  200. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/BaseRasterColorizerShader.js +1 -1
  201. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/MagDirShader.js +1 -1
  202. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/ScalarShader.js +1 -1
  203. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderBackground.js +1 -1
  204. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderCircle.js +1 -1
  205. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderFill.js +1 -1
  206. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderIcon.js +1 -1
  207. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderLine.js +1 -1
  208. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderOutline.js +1 -1
  209. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderText.js +1 -1
  210. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  211. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextTechnique.js +1 -1
  212. package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileDebugInfoTechnique.js +1 -1
  213. package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileStencilTechnique.js +1 -1
  214. package/views/2d/engine/webgl/shaderGraph/techniques/utility/DebugOverlayTechnique.js +1 -1
  215. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueBackground.js +1 -1
  216. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueCircle.js +1 -1
  217. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueFill.js +1 -1
  218. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueLine.js +1 -1
  219. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueSymbol.js +1 -1
  220. package/views/2d/engine/webgl/shaderGraph/typed/TypedShaderProgram.js +1 -1
  221. package/views/2d/engine/webgl/shaderGraph/types.js +2 -0
  222. package/views/2d/engine/webgl/shaderGraph/uniformBufferUtils.js +2 -0
  223. package/views/2d/layers/MediaLayerView2D.js +1 -1
  224. package/views/2d/layers/TileLayerView2D.js +1 -1
  225. package/views/2d/layers/support/DisplayGL.js +1 -1
  226. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  227. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  228. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  229. package/views/3d/layers/MediaLayerView3D.js +1 -1
  230. package/views/3d/layers/VectorTileLayerView3D.js +1 -1
  231. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  232. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  233. package/views/3d/support/GaussianSplatSortWorker.js +1 -1
  234. package/views/3d/support/GaussianSplatWorkerHandle.js +1 -1
  235. package/views/3d/support/flow/geometryUtils.js +1 -1
  236. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  237. package/views/3d/support/renderInfoUtils/line.js +1 -1
  238. package/views/3d/support/renderInfoUtils/polygon.js +1 -1
  239. package/views/3d/terrain/DrapedZ.js +2 -0
  240. package/views/3d/terrain/OverlayRenderer.js +1 -1
  241. package/views/3d/terrain/TileCompositor.js +1 -1
  242. package/views/3d/webgl/RenderCamera.js +1 -1
  243. package/views/3d/webgl/RenderNode.js +1 -1
  244. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBuffer.glsl.js +2 -2
  245. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +2 -2
  246. package/views/3d/webgl-engine/lib/PositionReader.js +1 -1
  247. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBuffer.js +1 -1
  248. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFields.js +1 -1
  249. package/views/3d/webgl-engine/lib/screenPolygonOverlapUtils.js +1 -1
  250. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  251. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  252. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  253. package/views/3d/webgl-engine/shaders/HeatmapDensity.glsl.js +1 -1
  254. package/views/3d/webgl-engine/shaders/HeatmapDensityTechnique.js +1 -1
  255. package/views/VideoView.js +1 -1
  256. package/views/webgl/RenderingContext.js +1 -1
  257. package/views/webgl/UniformBufferLayout.js +1 -1
  258. package/views/webgl/UniformBufferObject.js +1 -1
  259. package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +20 -6
  260. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  261. package/widgets/BatchAttributeForm/inputs/support/MultipleChoiceController.d.ts +100 -0
  262. package/widgets/BatchAttributeForm/inputs/support/MultipleChoiceController.js +2 -0
  263. package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
  264. package/widgets/BatchAttributeForm/inputs/support/multipleChoiceInputUtils.js +1 -1
  265. package/widgets/BatchAttributeForm.js +1 -1
  266. package/widgets/OrientedImageryViewer.js +1 -1
  267. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  268. package/widgets/UtilityNetworkTrace/support/GeometryHandler.js +1 -1
  269. package/widgets/UtilityNetworkTrace/support/ResultAreaHandler.js +1 -1
  270. package/assets/esri/core/workers/chunks/02dd79beb13eff6be85e.js +0 -1
  271. package/assets/esri/core/workers/chunks/0823961e5d0bdedbf8cf.js +0 -2
  272. package/assets/esri/core/workers/chunks/0aedeb837399d3f92e4a.js +0 -1
  273. package/assets/esri/core/workers/chunks/0bf644f93c180a2bc2f8.js +0 -705
  274. package/assets/esri/core/workers/chunks/0daaa89de339e8ea4b81.js +0 -1
  275. package/assets/esri/core/workers/chunks/1119a33245138e7b3914.js +0 -1
  276. package/assets/esri/core/workers/chunks/12234a63d3fa4bc25e7e.js +0 -1
  277. package/assets/esri/core/workers/chunks/1cf8fb704c48ac3d3b15.js +0 -1
  278. package/assets/esri/core/workers/chunks/2435ef7d11f8dbb920b7.js +0 -256
  279. package/assets/esri/core/workers/chunks/2791f3fe16ca5ee2f39a.js +0 -1
  280. package/assets/esri/core/workers/chunks/27f574acf52f2c8bc2c9.js +0 -1
  281. package/assets/esri/core/workers/chunks/2d45daacec0d5ed38782.js +0 -1
  282. package/assets/esri/core/workers/chunks/2ea3ca68cfa4d34e8f3b.js +0 -1
  283. package/assets/esri/core/workers/chunks/2f81047790c4890ae625.js +0 -1
  284. package/assets/esri/core/workers/chunks/3235e14fedb19dd94807.js +0 -1
  285. package/assets/esri/core/workers/chunks/32f5112c848efec6c33b.js +0 -1
  286. package/assets/esri/core/workers/chunks/3bc2943035391b44d4cf.js +0 -29
  287. package/assets/esri/core/workers/chunks/3c32471785bc8570e41c.js +0 -1
  288. package/assets/esri/core/workers/chunks/4295822fa6ef743c76f1.js +0 -1
  289. package/assets/esri/core/workers/chunks/42d5ed44111bea77ec71.js +0 -1462
  290. package/assets/esri/core/workers/chunks/46873badbd6ce8ff4e1e.js +0 -1
  291. package/assets/esri/core/workers/chunks/4710f21b138a2c9a0345.js +0 -1
  292. package/assets/esri/core/workers/chunks/4b5bd0c9a55ea2998601.js +0 -1
  293. package/assets/esri/core/workers/chunks/4c2794687aea172775a0.js +0 -1
  294. package/assets/esri/core/workers/chunks/4d9bde9f66817a92ceca.js +0 -1
  295. package/assets/esri/core/workers/chunks/4fe2cca405180af23364.js +0 -1
  296. package/assets/esri/core/workers/chunks/519af918050b47f93516.js +0 -1
  297. package/assets/esri/core/workers/chunks/5600fc334d20c4f0c83d.js +0 -1
  298. package/assets/esri/core/workers/chunks/5627f562dea8bae2f346.js +0 -1
  299. package/assets/esri/core/workers/chunks/5bf4ab72b9634b06cc5d.js +0 -1
  300. package/assets/esri/core/workers/chunks/5e3d5347223f0111f40f.js +0 -1
  301. package/assets/esri/core/workers/chunks/6f58cb9dffe8016397a2.js +0 -1
  302. package/assets/esri/core/workers/chunks/6fc3553c52af6ace926d.js +0 -1
  303. package/assets/esri/core/workers/chunks/7aaa051b51a8e34bbfb0.js +0 -1
  304. package/assets/esri/core/workers/chunks/7dc5aedc964eacd1be5a.js +0 -1
  305. package/assets/esri/core/workers/chunks/7f91e45156bbe88f9a62.js +0 -1
  306. package/assets/esri/core/workers/chunks/8a48a6760c33ed50b650.js +0 -1
  307. package/assets/esri/core/workers/chunks/8d21e2dabc5165f1c8ca.js +0 -1
  308. package/assets/esri/core/workers/chunks/903e1cd8b76eff19ebdf.js +0 -1
  309. package/assets/esri/core/workers/chunks/917c11cb40a7742d7f98.js +0 -1
  310. package/assets/esri/core/workers/chunks/91d133c04ca764d74934.js +0 -1
  311. package/assets/esri/core/workers/chunks/92c4464b67fce6cea134.js +0 -1
  312. package/assets/esri/core/workers/chunks/947f1ea4dbc3e3419ecc.js +0 -1
  313. package/assets/esri/core/workers/chunks/9482a6d7baa24bbf5693.js +0 -1
  314. package/assets/esri/core/workers/chunks/96cec8a02ca96175d602.js +0 -1
  315. package/assets/esri/core/workers/chunks/9902fcd2070c8eb6d043.js +0 -1
  316. package/assets/esri/core/workers/chunks/9b76c8974424a1908e86.js +0 -1
  317. package/assets/esri/core/workers/chunks/9be6827e5756031a56c1.js +0 -1
  318. package/assets/esri/core/workers/chunks/9cff18e6f751d1b3085e.js +0 -1
  319. package/assets/esri/core/workers/chunks/a101152066dd56259619.js +0 -1
  320. package/assets/esri/core/workers/chunks/a2a2c7e274fb32fecffa.js +0 -1
  321. package/assets/esri/core/workers/chunks/a3bf8aa81ee398da5b52.js +0 -1
  322. package/assets/esri/core/workers/chunks/a7a7d3289d4ca95f545f.js +0 -1
  323. package/assets/esri/core/workers/chunks/abb6c76d5dba3559a68e.js +0 -1
  324. package/assets/esri/core/workers/chunks/afeeb11b39e140303b5a.js +0 -1
  325. package/assets/esri/core/workers/chunks/b1a175b3b2d1a7ddde8e.js +0 -1
  326. package/assets/esri/core/workers/chunks/b78f509fd8e95f728178.js +0 -1
  327. package/assets/esri/core/workers/chunks/b858adff7043683fe41c.js +0 -1
  328. package/assets/esri/core/workers/chunks/be1d2c3a61e6447fbbc7.js +0 -1
  329. package/assets/esri/core/workers/chunks/c02ae1d40c1fe95ae6c5.js +0 -1
  330. package/assets/esri/core/workers/chunks/c1189316d24fb4cdb2a0.js +0 -1
  331. package/assets/esri/core/workers/chunks/c53b2be005721591e29b.js +0 -1
  332. package/assets/esri/core/workers/chunks/c82ab4f0908290e70ee9.js +0 -1
  333. package/assets/esri/core/workers/chunks/cc5ec6e99aa09342c704.js +0 -1
  334. package/assets/esri/core/workers/chunks/cd892c9603710d6130a9.js +0 -1
  335. package/assets/esri/core/workers/chunks/d021775cf747556660a5.js +0 -1
  336. package/assets/esri/core/workers/chunks/d633e98b0dfa0490e4de.js +0 -1
  337. package/assets/esri/core/workers/chunks/d79ce047afbc034f6008.js +0 -1
  338. package/assets/esri/core/workers/chunks/d8eca13c127b443141b7.js +0 -1
  339. package/assets/esri/core/workers/chunks/dbc9249dae41096d750d.js +0 -1
  340. package/assets/esri/core/workers/chunks/eb1a86159dbc098f06fe.js +0 -1
  341. package/assets/esri/core/workers/chunks/ec1841e6e498d54012eb.js +0 -1
  342. package/assets/esri/core/workers/chunks/ed1de8b7406269e217b9.js +0 -29
  343. package/assets/esri/core/workers/chunks/ee9eb381e675d2d01260.js +0 -1
  344. package/assets/esri/core/workers/chunks/f2ab8e49c7f17f488aa8.js +0 -1
  345. package/assets/esri/core/workers/chunks/f43a0edf58941e2ac78e.js +0 -1
  346. package/assets/esri/core/workers/chunks/f78acff510ca615d42e4.js +0 -1
  347. package/assets/esri/core/workers/chunks/f7a5c4d22a24e1ac433c.js +0 -1
  348. package/chunks/geometryEngineBase.js +0 -2
  349. package/geometry/geometryAdapters/json.js +0 -2
  350. package/geometry/geometryEngineJSON.js +0 -2
  351. /package/assets/esri/core/workers/chunks/{0823961e5d0bdedbf8cf.js.LICENSE.txt → 4f8ce5887102971bfa34.js.LICENSE.txt} +0 -0
  352. /package/assets/esri/core/workers/chunks/{186bedc377cc97731ca2.js.LICENSE.txt → 532e3a59888e4cc13bd3.js.LICENSE.txt} +0 -0
  353. /package/assets/esri/core/workers/chunks/{ad1d06a91121ebfe9162.js.LICENSE.txt → 755b2d883fba90c4e688.js.LICENSE.txt} +0 -0
  354. /package/assets/esri/core/workers/chunks/{d03e7be74c57c3dbf003.js.LICENSE.txt → a014c17fc210620da738.js.LICENSE.txt} +0 -0
  355. /package/assets/esri/core/workers/chunks/{8302bffd28cc6720e0fe.js.LICENSE.txt → a19be304219808268039.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{abortMaybe as t}from"../../../../core/maybe.js";import{estimateNumberArrayMemory as s}from"../../../../core/memoryEstimations.js";import{isAbortError as i}from"../../../../core/promiseUtils.js";import{signal as r}from"../../../../core/signal.js";import{Milliseconds as a,now as o}from"../../../../core/time.js";import{exactEquals as n,copy as l,normalize as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as d,exactEquals as _,intersects as c,copy as p}from"../../../../geometry/support/aaBoundingBox.js";import{makeScheduleFunction as f}from"../../layers/support/makeScheduleFunction.js";import{GaussianSplatSortWorkerHandle as m}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatFadeTexture as g}from"./GaussianSplatFadeTexture.js";import{GaussianSplatHeaderTexture as T}from"./GaussianSplatHeaderTexture.js";import{GaussianSplatOrderTexture as b}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as S}from"./GaussianSplatTextureAtlas.js";import{DepthRange as y}from"../../webgl-engine/lib/DepthRange.js";import{TaskPriority as x}from"../../../support/Scheduler.js";class C{constructor(e,t,s){this._updating=r(!1),this._useDeterministicSort=!1,this._sortBufferMemory=0,this.visibleGaussians=0,this._visibleTileDepthRange=new y,this._previousVisibleTileDepthRangeEye=u(),this._previousVisibleTileDepthRangeViewForward=u(),this._previousVisibleTileDepthRangeClippingBox=d(),this._latestSortedGaussianTilesVersion=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._previousVisibleTileDepthRangeHasClippingBox=!1,this._bufferCapacity=0,this._requestedLyr3dVisibilityChange=0,this._latestCompletedLyr3dVisibilityChange=0,this._latestUpdatedGaussianTiles=new Array,this._latestSortedGaussianTiles=new Array,this._nextCommittedVisibleGaussianTiles=new Array,this._cameraDirectionNormalized=u(),this._frameTask=null,this._workerHandle=null,this._sortAbortController=null,this._isSorting=!1,this._pendingSortTask=!1,this._scheduledSortStartTimeout=null,this._lastSortStartTime=a(-1/0),this._sortInterval=a(80),this._renderer=e,this._onSortComplete=t,this._orderTexture=new b(this._renderer.renderingContext),this._fadingTexture=new g(this._renderer.renderingContext),this._headerTexture=new T(this._renderer.renderingContext),this._textureAtlas=new S(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache,s);const{resourceController:i}=this._renderer.view;this._workerHandle=new m(f(i)),this._frameTask=i.scheduler.registerTask(x.GAUSSIAN_SPLAT_SORTING)}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get fadingTexture(){return this._fadingTexture}get headerTexture(){return this._headerTexture}get textureAtlasMemory(){return this._textureAtlas.usedMemory}get orderTextureMemory(){return this._orderTexture.usedMemory}get fadingTextureMemory(){return this._fadingTexture.usedMemory}get headerTextureMemory(){return this._headerTexture.usedMemory}get sortBufferMemory(){return this._sortBufferMemory}get usedMemory(){return this.textureAtlasMemory+this.headerTextureMemory+this.orderTextureMemory+this.fadingTextureMemory+this.sortBufferMemory}queryVisibleTileDepthRange(e,t){if(0===this.visibleGaussians)return null;const{eye:s,viewForward:i}=e,r=s[0],a=s[1],o=s[2],h=i[0],u=i[1],d=i[2],f=this._visibleTileDepthRange;if(this._previousVisibleTileDepthRangeTilesVersion===this._latestSortedGaussianTilesVersion&&n(this._previousVisibleTileDepthRangeEye,s)&&n(this._previousVisibleTileDepthRangeViewForward,i)&&(null==t?!this._previousVisibleTileDepthRangeHasClippingBox:this._previousVisibleTileDepthRangeHasClippingBox&&_(this._previousVisibleTileDepthRangeClippingBox,t)))return f.near<=f.far?f:null;let m=1/0,g=-1/0;const T=this._latestSortedGaussianTiles;for(let n=0;n<T.length;n++){const e=T[n];if(null!=t){const s=e.boundingBox;if(!c(s,t))continue}const s=h*(e.obbCenterX-r)+u*(e.obbCenterY-a)+d*(e.obbCenterZ-o),i=e.paddedMbsRadius,l=s-i;l<m&&(m=l);const _=s+i;_>g&&(g=_)}const b=m<=g;return b?f.set(m,g):f.set(1/0,-1/0),this._previousVisibleTileDepthRangeTilesVersion=this._latestSortedGaussianTilesVersion,this._previousVisibleTileDepthRangeHasClippingBox=null!=t,l(this._previousVisibleTileDepthRangeEye,s),l(this._previousVisibleTileDepthRangeViewForward,i),null!=t&&p(this._previousVisibleTileDepthRangeClippingBox,t),b?f:null}updateGaussianVisibility(e,t){this._latestUpdatedGaussianTiles=e,this._requestedLyr3dVisibilityChange=t,this.requestSort()}get updating(){return this._updating.value}destroy(){this._sortAbortController=t(this._sortAbortController),this._pendingSortTask=!1,this._updating.value=!1,null!=this._scheduledSortStartTimeout&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._frameTask.remove(),this._workerHandle?.destroyWorkerAndSelf(),this._textureAtlas.destroy(),this._headerTexture.destroy(),this._orderTexture.destroy(),this._fadingTexture.destroy()}requestSort(){this._updating.value=!0,this._pendingSortTask||(this._pendingSortTask=!0,this._scheduleSortStart())}_scheduleSortStart(){if(this._isSorting)return;const e=o()-this._lastSortStartTime,t=this._sortInterval-e;t<=0?this._startSortIfRequired():null==this._scheduledSortStartTimeout&&(this._scheduledSortStartTimeout=setTimeout(()=>{this._scheduledSortStartTimeout=null,this._pendingSortTask&&!this._isSorting&&this._scheduleSortStart()},t))}_startSortIfRequired(){if(this._isSorting||!this._pendingSortTask)return;const e=new AbortController;this._sortAbortController=e,this._isSorting=!0,this._pendingSortTask=!1,this._lastSortStartTime=o(),this._sortOnWorker(e.signal).finally(()=>{this._sortAbortController===e&&(this._sortAbortController=null),this._handleSortComplete()})}_handleSortComplete(){this._isSorting=!1,this._pendingSortTask?this._scheduleSortStart():this._updating.value=!1}_clearBuffersAndTextures(){this._atlasIndicesBuffer=void 0,this._sortedAtlasIndicesBuffer=void 0,this._distancesBuffer=void 0,this._bufferCapacity=0,this._sortBufferMemory=0,this._orderTexture.clear(),this._textureAtlas.clear(),this._headerTexture.clear()}_computeExpandedCapacity(t,s){let i=Math.max(1,t);for(;i<s;)i=Math.ceil(i*e);return i}_ensureSortBufferCapacities(e){if(this._bufferCapacity<e){const t=this._computeExpandedCapacity(this._bufferCapacity,e);this._atlasIndicesBuffer=new Uint32Array(t),this._sortedAtlasIndicesBuffer=new Uint32Array(t),this._distancesBuffer=new Float64Array(t),this._bufferCapacity=t,this._sortBufferMemory=s(this._atlasIndicesBuffer,this._sortedAtlasIndicesBuffer,this._distancesBuffer)}}_clearAllBuffersAndTextures(){this._clearBuffersAndTextures(),this._latestSortedGaussianTiles.length=0,this._nextCommittedVisibleGaussianTiles.length=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._workerHandle?.clear()}async _sortOnWorker(e){try{if(0===this._latestUpdatedGaussianTiles.length)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=this._requestedLyr3dVisibilityChange,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);this._useDeterministicSort&&this._latestUpdatedGaussianTiles.sort((e,t)=>e.obb.centerX-t.obb.centerX||e.obb.centerY-t.obb.centerY||e.obb.centerZ-t.obb.centerZ);const t=this._latestUpdatedGaussianTiles,s=t.length,i=this._requestedLyr3dVisibilityChange;let r=0;for(let e=0;e<s;e++)r+=t[e].gaussianCount;this._ensureSortBufferCapacities(r),this._textureAtlas.ensureTextureAtlas(),this._headerTexture.ensureCapacity(this._textureAtlas.pageAllocator.pageCount);const a=this._renderer.camera;h(this._cameraDirectionNormalized,a.ray.direction);const o=this._cameraDirectionNormalized[0],n=this._cameraDirectionNormalized[1],l=this._cameraDirectionNormalized[2];let u=0;const d=this._atlasIndicesBuffer,_=this._distancesBuffer,p=this._renderer.clippingBox,f=this._nextCommittedVisibleGaussianTiles;f.length=0;let m=0;const{frustum:g}=a,T=this._renderer.tileCullingRevision,b=g[0],S=g[1],y=g[2],x=g[3],C=g[4],A=g[5];for(let e=0;e<s;e++){const s=t[e],{gaussianAtlasIndices:i,relativePositions:r,obbCenterX:a,obbCenterY:h,obbCenterZ:g,paddedMbsRadius:V}=s,v=s.gaussianCount;if(s.cullingRevision!==T){let e=null==p||c(s.boundingBox,p);if(e){const t=1.5*V;e=b[0]*a+b[1]*h+b[2]*g+b[3]<t&&S[0]*a+S[1]*h+S[2]*g+S[3]<t&&y[0]*a+y[1]*h+y[2]*g+y[3]<t&&x[0]*a+x[1]*h+x[2]*g+x[3]<t&&C[0]*a+C[1]*h+C[2]*g+C[3]<t&&A[0]*a+A[1]*h+A[2]*g+A[3]<t}s.cullingRevision=T,s.cullingVisible=e}if(!s.cullingVisible)continue;d.set(i,u),f[m++]=s;const B=o*a+n*h+l*g,G=u+v;for(let e=u,t=0;e<G;e++,t+=3){const s=r[t],i=r[t+1],a=r[t+2];_[e]=s*o+i*n+a*l+B}u=G}if(f.length=m,0===u)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=i,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);const V={distances:this._distancesBuffer,atlasIndices:this._atlasIndicesBuffer,sortedAtlasIndices:this._sortedAtlasIndicesBuffer,numGaussians:u,preciseSort:this._useDeterministicSort},v=await(this._workerHandle?.sort(V,e));if(e.aborted)return;v&&(this._distancesBuffer=v.distances,this._atlasIndicesBuffer=v.atlasIndices,this._sortedAtlasIndicesBuffer=v.sortedAtlasIndices);const B=async e=>{this._orderTexture.setData(this._sortedAtlasIndicesBuffer,u);const t=this._latestSortedGaussianTiles;this._latestSortedGaussianTiles=f,this._nextCommittedVisibleGaussianTiles=t,this._latestSortedGaussianTilesVersion++,this._latestCompletedLyr3dVisibilityChange=i,this.visibleGaussians=u,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1),e.madeProgress()};await this._frameTask.schedule(B,e)}catch(t){if(i(t))return}}set useDeterministicSort(e){this._useDeterministicSort=e}}export{C as GaussianSplatDataStore};
2
+ import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{abortMaybe as t}from"../../../../core/maybe.js";import{estimateNumberArrayMemory as s}from"../../../../core/memoryEstimations.js";import{isAbortError as i}from"../../../../core/promiseUtils.js";import{signal as r}from"../../../../core/signal.js";import{Milliseconds as o,now as n}from"../../../../core/time.js";import{exactEquals as a,copy as l,normalize as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as d,exactEquals as _,intersects as p,copy as c}from"../../../../geometry/support/aaBoundingBox.js";import{makeScheduleFunction as m}from"../../layers/support/makeScheduleFunction.js";import{SplatSortWorkerInput as g}from"../GaussianSplatSortWorker.js";import{GaussianSplatSortWorkerHandle as T}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatFadeTexture as f}from"./GaussianSplatFadeTexture.js";import{GaussianSplatHeaderTexture as b}from"./GaussianSplatHeaderTexture.js";import{GaussianSplatOrderTexture as S}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as y}from"./GaussianSplatTextureAtlas.js";import{DepthRange as C}from"../../webgl-engine/lib/DepthRange.js";import{TaskPriority as x}from"../../../support/Scheduler.js";class V{constructor(e,t,s){this._updating=r(!1),this._useDeterministicSort=!1,this._sortBufferMemory=0,this.visibleGaussians=0,this._visibleTileDepthRange=new C,this._previousVisibleTileDepthRangeEye=u(),this._previousVisibleTileDepthRangeViewForward=u(),this._previousVisibleTileDepthRangeClippingBox=d(),this._latestSortedGaussianTilesVersion=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._previousVisibleTileDepthRangeHasClippingBox=!1,this._sortBufferCapacity=0,this._requestedLyr3dVisibilityChange=0,this._latestCompletedLyr3dVisibilityChange=0,this._latestUpdatedGaussianTiles=new Array,this._latestSortedGaussianTiles=new Array,this._nextCommittedVisibleGaussianTiles=new Array,this._workerResidentTiles=new Map,this._cameraDirectionNormalized=u(),this._frameTask=null,this._workerHandle=null,this._sortAbortController=null,this._isSorting=!1,this._pendingSortTask=!1,this._scheduledSortStartTimeout=null,this._lastSortStartTime=o(-1/0),this._sortInterval=o(80),this._renderer=e,this._onSortComplete=t,this._orderTexture=new S(this._renderer.renderingContext),this._fadingTexture=new f(this._renderer.renderingContext),this._headerTexture=new b(this._renderer.renderingContext),this._textureAtlas=new y(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache,s);const{resourceController:i}=this._renderer.view;this._workerHandle=new T(m(i)),this._frameTask=i.scheduler.registerTask(x.GAUSSIAN_SPLAT_SORTING)}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get fadingTexture(){return this._fadingTexture}get headerTexture(){return this._headerTexture}get textureAtlasMemory(){return this._textureAtlas.usedMemory}get orderTextureMemory(){return this._orderTexture.usedMemory}get fadingTextureMemory(){return this._fadingTexture.usedMemory}get headerTextureMemory(){return this._headerTexture.usedMemory}get sortBufferMemory(){return this._sortBufferMemory}get usedMemory(){return this.textureAtlasMemory+this.headerTextureMemory+this.orderTextureMemory+this.fadingTextureMemory+this.sortBufferMemory}queryVisibleTileDepthRange(e,t){if(0===this.visibleGaussians)return null;const{eye:s,viewForward:i}=e,r=s[0],o=s[1],n=s[2],h=i[0],u=i[1],d=i[2],m=this._visibleTileDepthRange;if(this._previousVisibleTileDepthRangeTilesVersion===this._latestSortedGaussianTilesVersion&&a(this._previousVisibleTileDepthRangeEye,s)&&a(this._previousVisibleTileDepthRangeViewForward,i)&&(null==t?!this._previousVisibleTileDepthRangeHasClippingBox:this._previousVisibleTileDepthRangeHasClippingBox&&_(this._previousVisibleTileDepthRangeClippingBox,t)))return m.near<=m.far?m:null;let g=1/0,T=-1/0;const f=this._latestSortedGaussianTiles;for(let a=0;a<f.length;a++){const e=f[a];if(null!=t){const s=e.boundingBox;if(!p(s,t))continue}const s=h*(e.obbCenterX-r)+u*(e.obbCenterY-o)+d*(e.obbCenterZ-n),i=e.paddedMbsRadius,l=s-i;l<g&&(g=l);const _=s+i;_>T&&(T=_)}const b=g<=T;return b?m.set(g,T):m.set(1/0,-1/0),this._previousVisibleTileDepthRangeTilesVersion=this._latestSortedGaussianTilesVersion,this._previousVisibleTileDepthRangeHasClippingBox=null!=t,l(this._previousVisibleTileDepthRangeEye,s),l(this._previousVisibleTileDepthRangeViewForward,i),null!=t&&c(this._previousVisibleTileDepthRangeClippingBox,t),b?m:null}updateGaussianVisibility(e,t){this._latestUpdatedGaussianTiles=e,this._requestedLyr3dVisibilityChange=t,this.requestSort()}get updating(){return this._updating.value}destroy(){this._sortAbortController=t(this._sortAbortController),this._pendingSortTask=!1,this._updating.value=!1,null!=this._scheduledSortStartTimeout&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._frameTask.remove(),this._workerHandle?.destroyWorkerAndSelf(),this._textureAtlas.destroy(),this._headerTexture.destroy(),this._orderTexture.destroy(),this._fadingTexture.destroy()}requestSort(){this._updating.value=!0,this._pendingSortTask||(this._pendingSortTask=!0,this._scheduleSortStart())}_scheduleSortStart(){if(this._isSorting)return;const e=n()-this._lastSortStartTime,t=this._sortInterval-e;t<=0?this._startSortIfRequired():null==this._scheduledSortStartTimeout&&(this._scheduledSortStartTimeout=setTimeout(()=>{this._scheduledSortStartTimeout=null,this._pendingSortTask&&!this._isSorting&&this._scheduleSortStart()},t))}_startSortIfRequired(){if(this._isSorting||!this._pendingSortTask)return;const e=new AbortController;this._sortAbortController=e,this._isSorting=!0,this._pendingSortTask=!1,this._lastSortStartTime=n(),this._sortOnWorker(e.signal).finally(()=>{this._sortAbortController===e&&(this._sortAbortController=null),this._handleSortComplete()})}_handleSortComplete(){this._isSorting=!1,this._pendingSortTask?this._scheduleSortStart():this._updating.value=!1}_clearBuffersAndTextures(){this._sortedAtlasIndicesBuffer=void 0,this._sortBufferCapacity=0,this._sortBufferMemory=0,this._orderTexture.clear(),this._textureAtlas.clear(),this._headerTexture.clear()}_computeExpandedCapacity(t,s){let i=Math.max(1,t);for(;i<s;)i=Math.ceil(i*e);return i}_ensureSortBufferCapacity(e){if(this._sortBufferCapacity<e){const t=this._computeExpandedCapacity(this._sortBufferCapacity,e);this._sortedAtlasIndicesBuffer=new Uint32Array(t),this._sortBufferMemory=s(this._sortedAtlasIndicesBuffer),this._sortBufferCapacity=t}}_clearAllBuffersAndTextures(){this._clearBuffersAndTextures(),this._latestSortedGaussianTiles.length=0,this._nextCommittedVisibleGaussianTiles.length=0,this._workerResidentTiles.clear(),this._previousVisibleTileDepthRangeTilesVersion=-1,this._workerHandle?.clear()}async _sortOnWorker(e){try{if(0===this._latestUpdatedGaussianTiles.length)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=this._requestedLyr3dVisibilityChange,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);this._useDeterministicSort&&this._latestUpdatedGaussianTiles.sort((e,t)=>e.obb.centerX-t.obb.centerX||e.obb.centerY-t.obb.centerY||e.obb.centerZ-t.obb.centerZ);const t=this._latestUpdatedGaussianTiles,s=t.length,i=this._requestedLyr3dVisibilityChange;let r=0;for(let e=0;e<s;e++)r+=t[e].gaussianCount;this._ensureSortBufferCapacity(r),this._textureAtlas.ensureTextureAtlas(),this._headerTexture.ensureCapacity(this._textureAtlas.pageAllocator.pageCount);const o=this._renderer.camera;h(this._cameraDirectionNormalized,o.ray.direction);const n=this._cameraDirectionNormalized[0],a=this._cameraDirectionNormalized[1],l=this._cameraDirectionNormalized[2];let u=0;const d=this._renderer.clippingBox,_=this._nextCommittedVisibleGaussianTiles;_.length=0;let c=0;const{frustum:m}=o,T=this._renderer.tileCullingRevision,f=m[0],b=m[1],S=m[2],y=m[3],C=m[4],x=m[5];for(let e=0;e<s;e++){const s=t[e],{obbCenterX:i,obbCenterY:r,obbCenterZ:o,paddedMbsRadius:n}=s,a=s.gaussianCount;if(s.cullingRevision!==T){let e=null==d||p(s.boundingBox,d);if(e){const t=1.5*n;e=f[0]*i+f[1]*r+f[2]*o+f[3]<t&&b[0]*i+b[1]*r+b[2]*o+b[3]<t&&S[0]*i+S[1]*r+S[2]*o+S[3]<t&&y[0]*i+y[1]*r+y[2]*o+y[3]<t&&C[0]*i+C[1]*r+C[2]*o+C[3]<t&&x[0]*i+x[1]*r+x[2]*o+x[3]<t}s.cullingRevision=T,s.cullingVisible=e}s.cullingVisible&&(_[c++]=s,u+=a)}if(_.length=c,0===u)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=i,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);const V=new Map,A=[],v=new Uint32Array(c);for(let e=0;e<c;e++){const t=_[e],s=t.handle;V.set(s,t),v[e]=s,this._workerResidentTiles.get(s)!==t&&A.push({handle:s,relativePositions:t.relativePositions,atlasIndices:t.gaussianAtlasIndices,gaussianCount:t.gaussianCount,originX:t.obbCenterX,originY:t.obbCenterY,originZ:t.obbCenterZ})}const w=[];for(const e of this._workerResidentTiles.keys())V.has(e)||w.push(e);const R=new g(A,Uint32Array.from(w),v,this._sortedAtlasIndicesBuffer,u,n,a,l,this._useDeterministicSort),B=await(this._workerHandle?.sort(R,e));if(e.aborted)return;B&&(this._sortedAtlasIndicesBuffer=B.sortedAtlasIndices,this._workerResidentTiles=V);const G=async e=>{this._orderTexture.setData(this._sortedAtlasIndicesBuffer,u);const t=this._latestSortedGaussianTiles;this._latestSortedGaussianTiles=_,this._nextCommittedVisibleGaussianTiles=t,this._latestSortedGaussianTilesVersion++,this._latestCompletedLyr3dVisibilityChange=i,this.visibleGaussians=u,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1),e.madeProgress()};await this._frameTask.schedule(G,e)}catch(t){if(i(t))return}}set useDeterministicSort(e){this._useDeterministicSort=e}}export{V as GaussianSplatDataStore};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{projectBuffer as e}from"../../../../geometry/projection/projectBuffer.js";import{newDoubleArray as o,doubleSubArray as n}from"../../../../geometry/support/DoubleArray.js";import{applyPerVertexElevationAlignment as t}from"../../layers/graphics/elevationAlignmentUtils.js";import{ringsToOutlinedTessellationInfo as s}from"../../layers/graphics/tessellationUtils.js";import{drapedZ as r}from"../../terrain/OverlayRenderer.js";function i(e,n,r,i){const l="polygon"===e.type,a="polygon"===e.type?e.rings:e.paths,{positions:c,outlines:f}=s(a,{hasZ:!!e.hasZ,ccwRingsAsHoles:l,spatialReference:e.spatialReference}),u=o(c.length),g=t(c,e.spatialReference,0,u,0,c,0,c.length/3,n,r,i),m=null!=g;return{lines:m?p(f,c,u):[],projectionSuccess:m,sampledElevation:g}}function l(o,n){const t="polygon"===o.type,i="polygon"===o.type?o.rings:o.paths,{positions:l,outlines:a}=s(i,{hasZ:!1,ccwRingsAsHoles:t,spatialReference:o.spatialReference}),c=e(l,o.spatialReference,0,l,n,0);for(let e=2;e<l.length;e+=3)l[e]=r;return{lines:c?p(a,l):[],projectionSuccess:c}}function p(e,o,t=null){const s=new Array;for(const{index:r,count:i}of e){if(i<=1)continue;const e=3*r,l=3*i;s.push({position:n(o,3*r,3*i),mapPositions:null!=t?n(t,e,l):void 0})}return s}export{i as geometryToRenderInfo,l as geometryToRenderInfoDraped};
2
+ import{projectBuffer as e}from"../../../../geometry/projection/projectBuffer.js";import{newDoubleArray as o,doubleSubArray as n}from"../../../../geometry/support/DoubleArray.js";import{applyPerVertexElevationAlignment as t}from"../../layers/graphics/elevationAlignmentUtils.js";import{ringsToOutlinedTessellationInfo as s}from"../../layers/graphics/tessellationUtils.js";import{drapedZ as i}from"../../terrain/DrapedZ.js";function r(e,n,i,r){const l="polygon"===e.type,a="polygon"===e.type?e.rings:e.paths,{positions:c,outlines:f}=s(a,{hasZ:!!e.hasZ,ccwRingsAsHoles:l,spatialReference:e.spatialReference}),u=o(c.length),g=t(c,e.spatialReference,0,u,0,c,0,c.length/3,n,i,r),m=null!=g;return{lines:m?p(f,c,u):[],projectionSuccess:m,sampledElevation:g}}function l(o,n){const t="polygon"===o.type,r="polygon"===o.type?o.rings:o.paths,{positions:l,outlines:a}=s(r,{hasZ:!1,ccwRingsAsHoles:t,spatialReference:o.spatialReference}),c=e(l,o.spatialReference,0,l,n,0);for(let e=2;e<l.length;e+=3)l[e]=i;return{lines:c?p(a,l):[],projectionSuccess:c}}function p(e,o,t=null){const s=new Array;for(const{index:i,count:r}of e){if(r<=1)continue;const e=3*i,l=3*r;s.push({position:n(o,3*i,3*r),mapPositions:null!=t?n(t,e,l):void 0})}return s}export{r as geometryToRenderInfo,l as geometryToRenderInfoDraped};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{isPromiseLike as e}from"../../../../core/promiseUtils.js";import{projectBuffer as t}from"../../../../geometry/projection/projectBuffer.js";import{doubleSubArray as n,newDoubleArray as o}from"../../../../geometry/support/DoubleArray.js";import{applyPerVertexElevationAlignment as s}from"../../layers/graphics/elevationAlignmentUtils.js";import{axisFromRings as i,ringsToOutlinedTessellationInfo as r,tessellateOrLoad as l,load as u}from"../../layers/graphics/tessellationUtils.js";import{drapedZ as c}from"../../terrain/OverlayRenderer.js";async function a(){return u()}class p{constructor(e,t,n,o){this.positions=e,this.polygonIndices=t,this.outline=n,this.projectionSuccess=o,this.count=e.length/3}get vertexCount(){return this.positions.length/3}get polygonIndexCount(){return this.polygonIndices.length}get outlineIndexCount(){const{outline:e}=this;if("tessellated-indices"!==e.output)return 0;let t=0;for(let n=0;n<e.outlineIndices.length;n++)t+=A(e.outlineIndices[n]);return t}get outlineSegmentCount(){const{outline:e}=this;if("tessellated-indices"!==e.output)return 0;let t=0;for(let n=0;n<e.outlineIndices.length;n++){t+=A(e.outlineIndices[n])}return t}}class d extends p{}class f extends p{}class h extends p{constructor(e,t,n,o,s,i){super(e,n,o,s),this.mapPositions=t,this.sampledElevation=i}}function g(t,n){const o=v(t,n);return e(o)?null:o}function m(t,n,o,s,i){const r=w(t,n,o,s,i);return e(r)?null:r}function x(t,n){const o=R(t,n);return e(o)?null:o}function v(t,n){const{projectIfNearlyVertical:o=!1,outlineOutput:s="none",method:u,owner:c}=n??{},a="tessellated-indices"===s,p=i(t.rings,!!t.hasZ,t.spatialReference),d=r(t.rings,{hasZ:!!t.hasZ,ccwRingsAsHoles:!0,spatialReference:t.spatialReference,axis:p}),h=l(d,{projectionAxis:o?p:void 0,outlines:a?d.outlines:void 0,method:u,owner:c});if(e(h))return h;if(!h.succeeded)return null;let g={output:"none"};if("vertex-data"===s){const e=h.positions!==d.positions?d.positions:d.positions.slice();g={output:"vertex-data",outlines:y(d.outlines,e)}}else"tessellated-indices"===s&&(g=j(h));return new f(h.positions,h.indices,g,!0)}function R(n,o){const{drapedSpatialReference:s,projectIfNearlyVertical:u=!1,outlineOutput:a="none",method:p,owner:f}=o,h=i(n.rings,!1,n.spatialReference),g=r(n.rings,{hasZ:!1,ccwRingsAsHoles:!0,spatialReference:n.spatialReference,axis:h}),m="none"!==a,x=t(g.positions,n.spatialReference,0,g.positions,s,0),v=l(g,{projectionAxis:u?h:void 0,outlines:m?g.outlines:void 0,method:p,owner:f});if(e(v))return v;if(!v.succeeded)return null;const{positions:R,indices:w}=v;for(let e=2;e<R.length;e+=3)R[e]=c;let I={output:"none"};if("vertex-data"===a){if(R!==g.positions)for(let t=2;t<g.positions.length;t+=3)g.positions[t]=c;const e=R!==g.positions?g.positions:g.positions.slice();I={output:"vertex-data",outlines:y(g.outlines,e)}}else"tessellated-indices"===a&&(I=j(v));return new d(R,w,I,x)}function w(t,n,u,c,a){const{projectIfNearlyVertical:p=!1,outlineOutput:d="none",method:f,owner:g}=a??{},m="none"!==d,x=!!t.hasZ&&"on-the-ground"!==c.mode,v=i(t.rings,x,t.spatialReference),R=r(t.rings,{hasZ:x,ccwRingsAsHoles:!0,spatialReference:t.spatialReference,axis:v}),w=l(R,{projectionAxis:p?v:void 0,outlines:m?R.outlines:void 0,method:f,owner:g});if(e(w))return w;if(!w.succeeded)return null;const{positions:y,vertexCount:A}=w,Z=o(y.length),C=s(y,t.spatialReference,0,Z,0,y,0,A,n,u,c);let O={output:"none"};"vertex-data"===d?O={output:"vertex-data",outlines:I(w,Z)}:"tessellated-indices"===d&&(O=j(w));const B=null!=C;return new h(y,Z,w.indices,O,B,C)}function y(e,t,o=null){return e.values().filter(({count:e})=>e>1).map(({index:e,count:s})=>{const i=3*e,r=3*s;return null!=o?new C(e,s,n(t,i,r),n(o,i,r)):new Z(e,s,n(t,i,r))}).toArray()}function j(e){const{outlineIndexBuffer:t,outlineRingLengths:n}=e;if(null==t||null==n)return{output:"none"};const o=new Array(n.length);let s=0;for(let i=0;i<n.length;i++){const e=n[i],r=t.slice(s,s+e);o[i]=r,s+=e}return{output:"tessellated-indices",outlineIndices:o}}function I(e,t){const{outlineIndexBuffer:s,outlineRingLengths:i,positions:r}=e;if(null==s||null==i)return[];let l=0;for(let n=0;n<i.length;n++)l+=i[n]-1;const u=o(3*l),c=o(3*l),a=new Array;let p=0,d=0;for(let o=0;o<i.length;o++){const e=i[o],l=e-1;for(let n=0;n<l;n++){const e=3*s[p+n],o=3*(d+n);u[o]=r[e],u[o+1]=r[e+1],u[o+2]=r[e+2],c[o]=t[e],c[o+1]=t[e+1],c[o+2]=t[e+2]}a.push(new C(d,l,n(u,3*d,3*l),n(c,3*d,3*l))),p+=e,d+=l}return a}function A(e,t=0,n=e.length){return n>1&&e[t]===e[t+n-1]?n-1:n}class Z{constructor(e,t,n){this.index=e,this.count=t,this.position=n}}class C extends Z{constructor(e,t,n,o){super(e,t,n),this.mapPositions=o}}export{C as OutlineVertexData,Z as OutlineVertexDataDraped,p as PolygonRenderInfoBase,d as PolygonRenderInfoDraped,h as PolygonRenderInfoElevationAligned,f as PolygonRenderInfoNotElevationAligned,a as loadTessellationUtils,R as polygonToRenderInfoDraped,w as polygonToRenderInfoElevationAligned,v as polygonToRenderInfoNotElevationAligned,x as preloadedPolygonToRenderInfoDraped,m as preloadedPolygonToRenderInfoElevationAligned,g as preloadedPolygonToRenderInfoNotElevationAligned,j as splitOutlineIndexRings,I as tessellatedOutlineIndicesToVertexData};
2
+ import{isPromiseLike as e}from"../../../../core/promiseUtils.js";import{projectBuffer as t}from"../../../../geometry/projection/projectBuffer.js";import{doubleSubArray as n,newDoubleArray as o}from"../../../../geometry/support/DoubleArray.js";import{applyPerVertexElevationAlignment as s}from"../../layers/graphics/elevationAlignmentUtils.js";import{axisFromRings as i,ringsToOutlinedTessellationInfo as r,tessellateOrLoad as l,load as u}from"../../layers/graphics/tessellationUtils.js";import{drapedZ as c}from"../../terrain/DrapedZ.js";async function a(){return u()}class p{constructor(e,t,n,o){this.positions=e,this.polygonIndices=t,this.outline=n,this.projectionSuccess=o,this.count=e.length/3}get vertexCount(){return this.positions.length/3}get polygonIndexCount(){return this.polygonIndices.length}get outlineIndexCount(){const{outline:e}=this;if("tessellated-indices"!==e.output)return 0;let t=0;for(let n=0;n<e.outlineIndices.length;n++)t+=A(e.outlineIndices[n]);return t}get outlineSegmentCount(){const{outline:e}=this;if("tessellated-indices"!==e.output)return 0;let t=0;for(let n=0;n<e.outlineIndices.length;n++){t+=A(e.outlineIndices[n])}return t}}class d extends p{}class f extends p{}class h extends p{constructor(e,t,n,o,s,i){super(e,n,o,s),this.mapPositions=t,this.sampledElevation=i}}function g(t,n){const o=v(t,n);return e(o)?null:o}function m(t,n,o,s,i){const r=R(t,n,o,s,i);return e(r)?null:r}function x(t,n){const o=w(t,n);return e(o)?null:o}function v(t,n){const{projectIfNearlyVertical:o=!1,outlineOutput:s="none",method:u,owner:c}=n??{},a="tessellated-indices"===s,p=i(t.rings,!!t.hasZ,t.spatialReference),d=r(t.rings,{hasZ:!!t.hasZ,ccwRingsAsHoles:!0,spatialReference:t.spatialReference,axis:p}),h=l(d,{projectionAxis:o?p:void 0,outlines:a?d.outlines:void 0,method:u,owner:c});if(e(h))return h;if(!h.succeeded)return null;let g={output:"none"};if("vertex-data"===s){const e=h.positions!==d.positions?d.positions:d.positions.slice();g={output:"vertex-data",outlines:j(d.outlines,e)}}else"tessellated-indices"===s&&(g=y(h));return new f(h.positions,h.indices,g,!0)}function w(n,o){const{drapedSpatialReference:s,projectIfNearlyVertical:u=!1,outlineOutput:a="none",method:p,owner:f}=o,h=i(n.rings,!1,n.spatialReference),g=r(n.rings,{hasZ:!1,ccwRingsAsHoles:!0,spatialReference:n.spatialReference,axis:h}),m="none"!==a,x=t(g.positions,n.spatialReference,0,g.positions,s,0),v=l(g,{projectionAxis:u?h:void 0,outlines:m?g.outlines:void 0,method:p,owner:f});if(e(v))return v;if(!v.succeeded)return null;const{positions:w,indices:R}=v;for(let e=2;e<w.length;e+=3)w[e]=c;let I={output:"none"};if("vertex-data"===a){if(w!==g.positions)for(let t=2;t<g.positions.length;t+=3)g.positions[t]=c;const e=w!==g.positions?g.positions:g.positions.slice();I={output:"vertex-data",outlines:j(g.outlines,e)}}else"tessellated-indices"===a&&(I=y(v));return new d(w,R,I,x)}function R(t,n,u,c,a){const{projectIfNearlyVertical:p=!1,outlineOutput:d="none",method:f,owner:g}=a??{},m="none"!==d,x=!!t.hasZ&&"on-the-ground"!==c.mode,v=i(t.rings,x,t.spatialReference),w=r(t.rings,{hasZ:x,ccwRingsAsHoles:!0,spatialReference:t.spatialReference,axis:v}),R=l(w,{projectionAxis:p?v:void 0,outlines:m?w.outlines:void 0,method:f,owner:g});if(e(R))return R;if(!R.succeeded)return null;const{positions:j,vertexCount:A}=R,Z=o(j.length),C=s(j,t.spatialReference,0,Z,0,j,0,A,n,u,c);let B={output:"none"};"vertex-data"===d?B={output:"vertex-data",outlines:I(R,Z)}:"tessellated-indices"===d&&(B=y(R));const H=null!=C;return new h(j,Z,R.indices,B,H,C)}function j(e,t,o=null){return e.values().filter(({count:e})=>e>1).map(({index:e,count:s})=>{const i=3*e,r=3*s;return null!=o?new C(e,s,n(t,i,r),n(o,i,r)):new Z(e,s,n(t,i,r))}).toArray()}function y(e){const{outlineIndexBuffer:t,outlineRingLengths:n}=e;if(null==t||null==n)return{output:"none"};const o=new Array(n.length);let s=0;for(let i=0;i<n.length;i++){const e=n[i],r=t.slice(s,s+e);o[i]=r,s+=e}return{output:"tessellated-indices",outlineIndices:o}}function I(e,t){const{outlineIndexBuffer:s,outlineRingLengths:i,positions:r}=e;if(null==s||null==i)return[];let l=0;for(let n=0;n<i.length;n++)l+=i[n]-1;const u=o(3*l),c=o(3*l),a=new Array;let p=0,d=0;for(let o=0;o<i.length;o++){const e=i[o],l=e-1;for(let n=0;n<l;n++){const e=3*s[p+n],o=3*(d+n);u[o]=r[e],u[o+1]=r[e+1],u[o+2]=r[e+2],c[o]=t[e],c[o+1]=t[e+1],c[o+2]=t[e+2]}a.push(new C(d,l,n(u,3*d,3*l),n(c,3*d,3*l))),p+=e,d+=l}return a}function A(e,t=0,n=e.length){return n>1&&e[t]===e[t+n-1]?n-1:n}class Z{constructor(e,t,n){this.index=e,this.count=t,this.position=n}}class C extends Z{constructor(e,t,n,o){super(e,t,n),this.mapPositions=o}}export{C as OutlineVertexData,Z as OutlineVertexDataDraped,p as PolygonRenderInfoBase,d as PolygonRenderInfoDraped,h as PolygonRenderInfoElevationAligned,f as PolygonRenderInfoNotElevationAligned,a as loadTessellationUtils,w as polygonToRenderInfoDraped,R as polygonToRenderInfoElevationAligned,v as polygonToRenderInfoNotElevationAligned,x as preloadedPolygonToRenderInfoDraped,m as preloadedPolygonToRenderInfoElevationAligned,g as preloadedPolygonToRenderInfoNotElevationAligned,y as splitOutlineIndexRings,I as tessellatedOutlineIndicesToVertexData};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ const o=-2;export{o as drapedZ};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{unique as r}from"../../../core/arrayUtils.js";import{EventEmitter as t}from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as s,everyMap as i}from"../../../core/MapUtils.js";import{disposeMaybe as n}from"../../../core/maybe.js";import o from"../../../core/PooledArray.js";import{watch as a,syncAndInitial as h,on as d,initial as l}from"../../../core/reactiveUtils.js";import{someSet as c}from"../../../core/SetUtils.js";import{property as u,subclass as p}from"../../../core/accessorSupport/decorators.js";import{ortho as _,fromTranslation as g}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{set as m}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ones as y}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{debugFlags as f}from"../support/debugFlags.js";import{Overlay as R}from"./Overlay.js";import{OverlayRenderTargets as v}from"./OverlayRenderTargets.js";import w from"../webgl/RenderCamera.js";import{SyncRenderPlugin as x}from"../webgl-engine/effects/RenderPlugin.js";import{trackHighlightOptions as S,renderHighlightBuffer as T}from"../webgl-engine/effects/highlight/Highlight.js";import{GLMaterialRepository as b}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as D}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderContext as O,defaultRenderOccludedMask as C}from"../webgl-engine/lib/RenderContext.js";import{ShadowMap as P}from"../webgl-engine/lib/ShadowMap.js";import{T as j}from"../../../chunks/Texture.glsl.js";import{TextureTechnique as E}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as F}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{AmbientLight as M}from"../webgl-engine/lighting/Lightsources.js";import{O as W}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as V}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as q}from"../../support/Scheduler.js";import A from"../../webgl/Texture.js";import{TextureDescriptor as G}from"../../webgl/TextureDescriptor.js";let k=class extends x{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new W,this.hasHighlights=!1,this.renderOccludedFlags=1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new o,this._passParameters=new j,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new w,this.events=new t,this.longitudeCyclical=null,this.produces=new Map([[18,e=>10!==e||this.hasHighlights],[19,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1,this._hasDrapedFlowSource=!1;const{state:r,stage:s}=e.parent.view,i=s.renderer.fboCache,n=s.renderView.renderingContext,a=s.renderView.techniques;this._renderContext=new O(n,new P(i,r.viewingMode),a)}initialize(){const e=this._view,r=e.stage.renderView.waterTextures;this.addHandles([a(()=>r.updating,()=>this.events.emit("content-changed"),h),a(()=>this._spatialReference,e=>this._localOriginFactory=new D(e),h),d(()=>e.allLayerViews,"after-changes",()=>this._sortedDrapeSourceRenderersDirty=!0),a(()=>S(e.state.highlights),()=>this._sortedDrapeSourceRenderersDirty=!0,l),a(()=>e.state.highlights,e=>{this._bindParameters.highlights=e},l),e.resourceController.scheduler.registerTask(q.OVERLAY_RENDERER,this)]);const t=this._camera;t.near=1,t.far=1e4,t.relativeElevation=null,this._bindParameters.slot=18,this._bindParameters.camera=t,this._bindParameters.updateLighting(new M(y()),0,0,0)}destroy(){this._renderers.forEach(e=>e.destroy()),this._renderers.clear(),this._passParameters.texture=n(this._passParameters.texture),this.disposeOverlays(),this._renderContext.destroy(),this._sortedRenderers.prune()}get _bindParameters(){return this._renderContext.bind}get _rctx(){return this._stage.renderView.renderingContext}get _view(){return this.parent.view}get _stage(){return this.parent.view.stage}get _spatialReference(){return this.parent.spatialReference}get _techniques(){return this._stage.renderView.techniques}get rctx(){return this._rctx}get materials(){return this._pluginContext.materials}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}set time(e){this._renderContext.time=e}get pluginContext(){return this._pluginContext}initializeRenderContext(e){const r=new b(this._view.stage.renderView.textures,this._techniques,()=>{this._onMaterialOrContentChanged(),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")},()=>this.events.emit("content-changed"));this._pluginContext={...e,materials:r},this._techniques.precompile(V)}uninitializeRenderContext(){}acquireTechniques(){return[]}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||s(this._renderers,e=>e.updating||e.canCompact)}get hasOverlays(){return null!=this._overlays&&null!=this._renderTargets}getMaterialRenderer(e){for(const r of this._renderers.values()){const t=r.getMaterialRenderer(e);if(t)return t}return null}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),r(this._sortedRenderers.map(e=>e.drapeSource.layer).filter(e=>!!e))}registerDrapeSource(e,r){const t=this._renderers.get(e);null!=t&&t.destroy(),this._renderers.set(e,r),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(a(()=>e.fullOpacity,()=>this.events.emit("content-changed")),e)}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(e){this._renderTargets?.dispose(e)}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&c(e,e=>1===e.drapeTargetType)}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=c(e,e=>1===e.drapeSourceType),this._hasDrapedRasterSource=c(e,e=>0===e.drapeSourceType),this._hasDrapedFlowSource=c(e,e=>2===e.drapeSourceType)):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=this._hasDrapedFlowSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new v(this._stage.renderer.fboCache),this._overlays=[new R,new R]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets?.dispose(1),this._renderTargets=null,this.events.emit("textures-disposed")}_useOverlayColorInsteadOfColorNoRasterImage(e){return 1===e&&!this._needsColorWithoutRasterImage&&(this._hasDrapedFeatureSource||this._hasDrapedRasterSource)}getTexture(e){const r=this._useOverlayColorInsteadOfColorNoRasterImage(e);return this._renderTargets?.getTexture(r?0:e)}get readyToRun(){return this.updating}runTask(e){this._processDrapeSources(()=>!0,e)}_onMaterialOrContentChanged(){this.renderOccludedFlags=s(this._renderers,e=>e.hasOccluders)?H:1}_processDrapeSources(e,r){let t=!1;for(const[s,i]of this._renderers){if(r?.done)break;(s.destroyed||e(s))&&(i.commitChanges()&&(t=!0,r?.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,t=!0,this._updateSortedDrapeSourceRenderers(),r?.madeProgress()),r&&this.compact(r),t&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this._onMaterialOrContentChanged(),this.hasHighlights=s(this._renderers,e=>e.hasHighlights),this.events.emit("content-changed"))}compact(e){let r=!1;for(const t of this._renderers.values()){if(e.done)break;r=t.compact(e)||r}return r&&this.notifyChange("updating"),r}hasHighlight(e){return s(this._renderers,r=>r.hasHighlight(e))}processSyncDrapeSources(){this._processDrapeSources(e=>1===e.updatePolicy)}get isEmpty(){return!f.OVERLAY_DRAW_DEBUG_TEXTURE&&i(this._renderers,e=>e.isEmpty)}get hasWater(){const e=s(this._renderers,({hasWater:e})=>e);return e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water")),this._hasWater}renders(e){if(f.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==e&&2!==e)return!0;if(!this._overlays)return!1;const r=this._overlays[0];for(const i of this._overlays)i.setupGeometryViews(this.longitudeCyclical);if(!r.hasSomeSizedView())return!1;const t=this._setOutput(this._renderTargets?.targets.find(r=>r.content===e)?.output??0);++this._techniques.precompiling;const s=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._setOutput(t),s}_setOutput(e){const r=this._bindParameters.output;return this._bindParameters.output=e,this._bindParameters.slot=4===e?19:18,r}get mode(){return this.isEmpty?0:this.hasWater&&this.renders(3)?2:this._renderTargets?.getTexture(0)?1:0}updateAnimation(e){let r=!1;return this._renderers.forEach(t=>r=t.updateAnimation(e)||r),r&&this.parent.requestRender(0),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(!this._overlays||!this._renderTargets)return!1;const r=this._bindParameters;r.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(const t of this._renderTargets.targets){if(1===t.content&&!this._needsColorWithoutRasterImage)continue;const{output:e}=t;this._setOutput(e),10===e&&(r.highlightMixTexture=r.highlights.length>1?this._rctx.emptyTexture:null);const s=this._renderContext.renderOccludedMask;4===t.content&&(this._renderContext.renderOccludedMask=H),this._sortedRenderers.forAll(({drapeSource:e,renderer:r})=>{1===t.content&&0===e.drapeSourceType||4===t.content&&r.hasOnlyOccluders||r.precompile(this._renderContext)}),this._renderContext.renderOccludedMask=s,r.highlightMixTexture=null}return--this._techniques.precompiling,!0}drawOverlays(e,r){if(!this._overlays||!this._renderTargets)return;for(const s of this._overlays)s.setupGeometryViews(this.longitudeCyclical);this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;const t=this.allSourcesOccluders;for(const s of this._renderTargets.targets){if(!(0===s.content&&this._hasDrapedFlowSource)&&!s.handleRenderRequest(r)||1===s.content&&!this._needsColorWithoutRasterImage||4===s.content&&t)continue;const e=this._drawTarget(0,s),i=this._drawTarget(1,s);(e||i)&&s.fbo.generateMipMap()}}_drawTarget(e,r){const t=this._overlays[e],s=t.canvasGeometries;if(0===s.numViews)return!1;const i=this._view.state.contentPixelRatio;this._screenToWorldRatio=i*t.mapUnitsPerPixel/this._bindParameters.overlayStretch;const{output:n,content:o}=r;if(this.isEmpty||4===n&&!this.hasWater||!t.hasSomeSizedView())return!1;const{_rctx:a,_camera:h,_renderContext:d,_bindParameters:l}=this;if(h.pixelRatio=t.pixelRatio*i,this._setOutput(n),l.screenToWorldRatio=this._screenToWorldRatio,l.screenToPCSRatio=this._screenToWorldRatio*this.parent.worldToPCSRatio,4===o&&(d.renderOccludedMask=H),!this.renders(o))return d.renderOccludedMask=C,!1;const{resolution:c}=t,u=0===e,p=u?0:c;a.setViewport(p,0,c,c),this._bindTargetFBO(r),u&&(10===n?a.gl.clearBufferuiv(a.gl.COLOR,0,[0,0,0,0]):(a.setClearColor(0,0,0,0),a.clear(16384)));if(f.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==o&&2!==o){this._techniques.precompile(E,L);const r=this._techniques.get(E,L);for(let i=0;i<s.numViews;i++)this._setViewParameters(s.extents[i],t),this._ensureDebugPatternResources(t.resolution,U[e]),a.bindTechnique(r,l,this._passParameters),a.screen.draw()}if(10===n){const{fboCache:t}=this._stage.renderer,s=this._resolution;this._bindTargetFBO(r),T(a,t,s,s,l,()=>this._renderAllGeometry(e,r),p)}else this._renderAllGeometry(e,r);return a.bindFramebuffer(null),d.renderOccludedMask=C,!0}get allSourcesOccluders(){return i(this._renderers,e=>e.hasOnlyOccluders)}_renderAllGeometry(e,r){const t=this._overlays[e],s=t.canvasGeometries;this._sortedRenderers.forAll(({drapeSource:i,renderer:n})=>{if(1===r.content&&0===i.drapeSourceType)return;const{fullOpacity:o}=i,a=null!=o&&o<1&&0===r.output&&this._bindTemporaryFBO();for(let e=0;e<s.numViews;e++)this._setViewParameters(s.extents[e],t),n.render(this._renderContext);if(a){this._bindTargetFBO(r),this._overlayParameters.texture=a.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;const t=this._techniques.get(V);this._rctx.bindTechnique(t,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),a.release()}})}_bindTargetFBO(e){const r=this._resolution,t=2*r;e.fbo.ensureFramebuffer(t,r),e.fbo.bind(this._rctx)}_bindTemporaryFBO(){const e=this._resolution,r=2*e,t=this._stage.renderer.fboCache,s=t.acquire(r,e,"overlay tmp");return t.rctx.bindFramebuffer(s.fbo),t.rctx.clear(16384),s}get _resolution(){return this._overlays?.[0].resolution??0}notifyContentChanged(){this.events.emit("content-changed")}intersectRay(e,r,t,s){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(const{renderer:n}of this._sortedRenderers)i=n.intersectRay?.(e,r,t,s,i)??i}*intersectScreenPolygon(e,r,t){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let s=0;for(const{renderer:i}of this._sortedRenderers)s=yield*i.intersectScreenPolygon(e,r,t,s)}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this._view.map.allLayers.map(e=>e.uid),r=e.length;this._renderers.forEach((t,s)=>{const i=e.indexOf(s.layer?.uid),n=i>=0,o=s.renderGroup??(n?0:1),a=s.drapeSourcePriorityOffset??0,h=r*o+(n?i:0)+a;this._sortedRenderers.push(new I(s,t,h))}),this._sortedRenderers.sort((e,r)=>e.index-r.index)}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],_(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),g(t.viewMatrix,[-e[0],-e[1],0])}_ensureDebugPatternResources(e,r){if(m(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let n=0;n<e;n++)for(let r=0;r<e;r++){const i=Math.floor(r/10),o=Math.floor(n/10);i<2||o<2||10*i>e-20||10*o>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&o?1&r^1&n?0:255:1&i^1&o?0:128)}const i=new G(e);i.samplingMode=9728,this._passParameters.texture=new A(this._rctx,i,t)}get test(){}};e([u()],k.prototype,"hasHighlights",void 0),e([u()],k.prototype,"renderOccludedFlags",void 0),e([u()],k.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([u({constructOnly:!0})],k.prototype,"parent",void 0),e([u({readOnly:!0})],k.prototype,"_techniques",null),e([u({type:Boolean,readOnly:!0})],k.prototype,"updating",null),e([u()],k.prototype,"isEmpty",null),k=e([p("esri.views.3d.terrain.OverlayRenderer")],k);class I{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const U=[[1,.5,.5],[.5,.5,1]],B=-2,H=4,L=new F;L.hasAlpha=!0;export{k as OverlayRenderer,B as drapedZ,H as overlayRenderOccludedFlag};
2
+ import{__decorate as e}from"tslib";import{unique as r}from"../../../core/arrayUtils.js";import{EventEmitter as t}from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as s,everyMap as i}from"../../../core/MapUtils.js";import{disposeMaybe as n}from"../../../core/maybe.js";import o from"../../../core/PooledArray.js";import{watch as a,syncAndInitial as h,on as d,initial as l}from"../../../core/reactiveUtils.js";import{someSet as c}from"../../../core/SetUtils.js";import{property as u,subclass as p}from"../../../core/accessorSupport/decorators.js";import{ortho as _,fromTranslation as g}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{set as m}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ones as y}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{debugFlags as f}from"../support/debugFlags.js";import{Overlay as R}from"./Overlay.js";import{OverlayRenderTargets as v}from"./OverlayRenderTargets.js";import w from"../webgl/RenderCamera.js";import{SyncRenderPlugin as x}from"../webgl-engine/effects/RenderPlugin.js";import{trackHighlightOptions as S,renderHighlightBuffer as T}from"../webgl-engine/effects/highlight/Highlight.js";import{GLMaterialRepository as b}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as D}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderContext as O,defaultRenderOccludedMask as C}from"../webgl-engine/lib/RenderContext.js";import{ShadowMap as P}from"../webgl-engine/lib/ShadowMap.js";import{T as j}from"../../../chunks/Texture.glsl.js";import{TextureTechnique as E}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as F}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{AmbientLight as M}from"../webgl-engine/lighting/Lightsources.js";import{O as W}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as V}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as q}from"../../support/Scheduler.js";import A from"../../webgl/Texture.js";import{TextureDescriptor as G}from"../../webgl/TextureDescriptor.js";let k=class extends x{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new W,this.hasHighlights=!1,this.renderOccludedFlags=1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new o,this._passParameters=new j,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new w,this.events=new t,this.longitudeCyclical=null,this.produces=new Map([[18,e=>10!==e||this.hasHighlights],[19,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1,this._hasDrapedFlowSource=!1;const{state:r,stage:s}=e.parent.view,i=s.renderer.fboCache,n=s.renderView.renderingContext,a=s.renderView.techniques;this._renderContext=new O(n,new P(i,r.viewingMode),a)}initialize(){const e=this._view,r=e.stage.renderView.waterTextures;this.addHandles([a(()=>r.updating,()=>this.events.emit("content-changed"),h),a(()=>this._spatialReference,e=>this._localOriginFactory=new D(e),h),d(()=>e.allLayerViews,"after-changes",()=>this._sortedDrapeSourceRenderersDirty=!0),a(()=>S(e.state.highlights),()=>this._sortedDrapeSourceRenderersDirty=!0,l),a(()=>e.state.highlights,e=>{this._bindParameters.highlights=e},l),e.resourceController.scheduler.registerTask(q.OVERLAY_RENDERER,this)]);const t=this._camera;t.near=1,t.far=1e4,t.relativeElevation=null,this._bindParameters.slot=18,this._bindParameters.camera=t,this._bindParameters.updateLighting(new M(y()),0,0,0)}destroy(){this._renderers.forEach(e=>e.destroy()),this._renderers.clear(),this._passParameters.texture=n(this._passParameters.texture),this.disposeOverlays(),this._renderContext.destroy(),this._sortedRenderers.prune()}get _bindParameters(){return this._renderContext.bind}get _rctx(){return this._stage.renderView.renderingContext}get _view(){return this.parent.view}get _stage(){return this.parent.view.stage}get _spatialReference(){return this.parent.spatialReference}get _techniques(){return this._stage.renderView.techniques}get rctx(){return this._rctx}get materials(){return this._pluginContext.materials}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}set time(e){this._renderContext.time=e}get pluginContext(){return this._pluginContext}initializeRenderContext(e){const r=new b(this._view.stage.renderView.textures,this._techniques,()=>{this._onMaterialOrContentChanged(),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")},()=>this.events.emit("content-changed"));this._pluginContext={...e,materials:r},this._techniques.precompile(V)}uninitializeRenderContext(){}acquireTechniques(){return[]}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||s(this._renderers,e=>e.updating||e.canCompact)}get hasOverlays(){return null!=this._overlays&&null!=this._renderTargets}getMaterialRenderer(e){for(const r of this._renderers.values()){const t=r.getMaterialRenderer(e);if(t)return t}return null}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),r(this._sortedRenderers.map(e=>e.drapeSource.layer).filter(e=>!!e))}registerDrapeSource(e,r){const t=this._renderers.get(e);null!=t&&t.destroy(),this._renderers.set(e,r),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(a(()=>e.fullOpacity,()=>this.events.emit("content-changed")),e)}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(e){this._renderTargets?.dispose(e)}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&c(e,e=>1===e.drapeTargetType)}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=c(e,e=>1===e.drapeSourceType),this._hasDrapedRasterSource=c(e,e=>0===e.drapeSourceType),this._hasDrapedFlowSource=c(e,e=>2===e.drapeSourceType)):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=this._hasDrapedFlowSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new v(this._stage.renderer.fboCache),this._overlays=[new R,new R]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets?.dispose(1),this._renderTargets=null,this.events.emit("textures-disposed")}_useOverlayColorInsteadOfColorNoRasterImage(e){return 1===e&&!this._needsColorWithoutRasterImage&&(this._hasDrapedFeatureSource||this._hasDrapedRasterSource)}getTexture(e){const r=this._useOverlayColorInsteadOfColorNoRasterImage(e);return this._renderTargets?.getTexture(r?0:e)}get readyToRun(){return this.updating}runTask(e){this._processDrapeSources(()=>!0,e)}_onMaterialOrContentChanged(){this.renderOccludedFlags=s(this._renderers,e=>e.hasOccluders)?B:1}_processDrapeSources(e,r){let t=!1;for(const[s,i]of this._renderers){if(r?.done)break;(s.destroyed||e(s))&&(i.commitChanges()&&(t=!0,r?.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,t=!0,this._updateSortedDrapeSourceRenderers(),r?.madeProgress()),r&&this.compact(r),t&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this._onMaterialOrContentChanged(),this.hasHighlights=s(this._renderers,e=>e.hasHighlights),this.events.emit("content-changed"))}compact(e){let r=!1;for(const t of this._renderers.values()){if(e.done)break;r=t.compact(e)||r}return r&&this.notifyChange("updating"),r}hasHighlight(e){return s(this._renderers,r=>r.hasHighlight(e))}processSyncDrapeSources(){this._processDrapeSources(e=>1===e.updatePolicy)}get isEmpty(){return!f.OVERLAY_DRAW_DEBUG_TEXTURE&&i(this._renderers,e=>e.isEmpty)}get hasWater(){const e=s(this._renderers,({hasWater:e})=>e);return e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water")),this._hasWater}renders(e){if(f.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==e&&2!==e)return!0;if(!this._overlays)return!1;const r=this._overlays[0];for(const i of this._overlays)i.setupGeometryViews(this.longitudeCyclical);if(!r.hasSomeSizedView())return!1;const t=this._setOutput(this._renderTargets?.targets.find(r=>r.content===e)?.output??0);++this._techniques.precompiling;const s=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._setOutput(t),s}_setOutput(e){const r=this._bindParameters.output;return this._bindParameters.output=e,this._bindParameters.slot=4===e?19:18,r}get mode(){return this.isEmpty?0:this.hasWater&&this.renders(3)?2:this._renderTargets?.getTexture(0)?1:0}updateAnimation(e){let r=!1;return this._renderers.forEach(t=>r=t.updateAnimation(e)||r),r&&this.parent.requestRender(0),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(!this._overlays||!this._renderTargets)return!1;const r=this._bindParameters;r.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(const t of this._renderTargets.targets){if(1===t.content&&!this._needsColorWithoutRasterImage)continue;const{output:e}=t;this._setOutput(e),10===e&&(r.highlightMixTexture=r.highlights.length>1?this._rctx.emptyTexture:null);const s=this._renderContext.renderOccludedMask;4===t.content&&(this._renderContext.renderOccludedMask=B),this._sortedRenderers.forAll(({drapeSource:e,renderer:r})=>{1===t.content&&0===e.drapeSourceType||4===t.content&&r.hasOnlyOccluders||r.precompile(this._renderContext)}),this._renderContext.renderOccludedMask=s,r.highlightMixTexture=null}return--this._techniques.precompiling,!0}drawOverlays(e,r){if(!this._overlays||!this._renderTargets)return;for(const s of this._overlays)s.setupGeometryViews(this.longitudeCyclical);this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;const t=this.allSourcesOccluders;for(const s of this._renderTargets.targets){if(!(0===s.content&&this._hasDrapedFlowSource)&&!s.handleRenderRequest(r)||1===s.content&&!this._needsColorWithoutRasterImage||4===s.content&&t)continue;const e=this._drawTarget(0,s),i=this._drawTarget(1,s);(e||i)&&s.fbo.generateMipMap()}}_drawTarget(e,r){const t=this._overlays[e],s=t.canvasGeometries;if(0===s.numViews)return!1;const i=this._view.state.contentPixelRatio;this._screenToWorldRatio=i*t.mapUnitsPerPixel/this._bindParameters.overlayStretch;const{output:n,content:o}=r;if(this.isEmpty||4===n&&!this.hasWater||!t.hasSomeSizedView())return!1;const{_rctx:a,_camera:h,_renderContext:d,_bindParameters:l}=this;if(h.pixelRatio=t.pixelRatio*i,this._setOutput(n),l.screenToWorldRatio=this._screenToWorldRatio,l.screenToPCSRatio=this._screenToWorldRatio*this.parent.worldToPCSRatio,4===o&&(d.renderOccludedMask=B),!this.renders(o))return d.renderOccludedMask=C,!1;const{resolution:c}=t,u=0===e,p=u?0:c;a.setViewport(p,0,c,c),this._bindTargetFBO(r),u&&(10===n?a.gl.clearBufferuiv(a.gl.COLOR,0,[0,0,0,0]):(a.setClearColor(0,0,0,0),a.clear(16384)));if(f.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==o&&2!==o){this._techniques.precompile(E,H);const r=this._techniques.get(E,H);for(let i=0;i<s.numViews;i++)this._setViewParameters(s.extents[i],t),this._ensureDebugPatternResources(t.resolution,U[e]),a.bindTechnique(r,l,this._passParameters),a.screen.draw()}if(10===n){const{fboCache:t}=this._stage.renderer,s=this._resolution;this._bindTargetFBO(r),T(a,t,s,s,l,()=>this._renderAllGeometry(e,r),p)}else this._renderAllGeometry(e,r);return a.bindFramebuffer(null),d.renderOccludedMask=C,!0}get allSourcesOccluders(){return i(this._renderers,e=>e.hasOnlyOccluders)}_renderAllGeometry(e,r){const t=this._overlays[e],s=t.canvasGeometries;this._sortedRenderers.forAll(({drapeSource:i,renderer:n})=>{if(1===r.content&&0===i.drapeSourceType)return;const{fullOpacity:o}=i,a=null!=o&&o<1&&0===r.output&&this._bindTemporaryFBO();for(let e=0;e<s.numViews;e++)this._setViewParameters(s.extents[e],t),n.render(this._renderContext);if(a){this._bindTargetFBO(r),this._overlayParameters.texture=a.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;const t=this._techniques.get(V);this._rctx.bindTechnique(t,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),a.release()}})}_bindTargetFBO(e){const r=this._resolution,t=2*r;e.fbo.ensureFramebuffer(t,r),e.fbo.bind(this._rctx)}_bindTemporaryFBO(){const e=this._resolution,r=2*e,t=this._stage.renderer.fboCache,s=t.acquire(r,e,"overlay tmp");return t.rctx.bindFramebuffer(s.fbo),t.rctx.clear(16384),s}get _resolution(){return this._overlays?.[0].resolution??0}notifyContentChanged(){this.events.emit("content-changed")}intersectRay(e,r,t,s){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(const{renderer:n}of this._sortedRenderers)i=n.intersectRay?.(e,r,t,s,i)??i}*intersectScreenPolygon(e,r,t){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let s=0;for(const{renderer:i}of this._sortedRenderers)s=yield*i.intersectScreenPolygon(e,r,t,s)}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this._view.map.allLayers.map(e=>e.uid),r=e.length;this._renderers.forEach((t,s)=>{const i=e.indexOf(s.layer?.uid),n=i>=0,o=s.renderGroup??(n?0:1),a=s.drapeSourcePriorityOffset??0,h=r*o+(n?i:0)+a;this._sortedRenderers.push(new I(s,t,h))}),this._sortedRenderers.sort((e,r)=>e.index-r.index)}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],_(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),g(t.viewMatrix,[-e[0],-e[1],0])}_ensureDebugPatternResources(e,r){if(m(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let n=0;n<e;n++)for(let r=0;r<e;r++){const i=Math.floor(r/10),o=Math.floor(n/10);i<2||o<2||10*i>e-20||10*o>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&o?1&r^1&n?0:255:1&i^1&o?0:128)}const i=new G(e);i.samplingMode=9728,this._passParameters.texture=new A(this._rctx,i,t)}get test(){}};e([u()],k.prototype,"hasHighlights",void 0),e([u()],k.prototype,"renderOccludedFlags",void 0),e([u()],k.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([u({constructOnly:!0})],k.prototype,"parent",void 0),e([u({readOnly:!0})],k.prototype,"_techniques",null),e([u({type:Boolean,readOnly:!0})],k.prototype,"updating",null),e([u()],k.prototype,"isEmpty",null),k=e([p("esri.views.3d.terrain.OverlayRenderer")],k);class I{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const U=[[1,.5,.5],[.5,.5,1]],B=4,H=new F;H.hasAlpha=!0;export{k as OverlayRenderer,B as overlayRenderOccludedFlag};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../core/Logger.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{ZEROS as r}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{VectorTileRendererHelper3D as i}from"../../2d/engine/vectorTiles/VectorTileRendererHelper3D.js";import{BlendLayersTechnique as s}from"./BlendLayersTechnique.js";import{BlendLayersTechniqueConfiguration as n}from"./BlendLayersTechniqueConfiguration.js";import{RasterColorizerTechnique as o}from"./RasterColorizerTechnique.js";import{RasterColorizerTechniqueConfiguration as a}from"./RasterColorizerTechniqueConfiguration.js";import{MultiSizeFramebuffer as h}from"./support/MultiSizeFramebuffer.js";import{BindParameters as c}from"../webgl-engine/lib/BindParameters.js";import{createQuadVAO as l}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as u}from"../../webgl/enums.js";import d from"../../webgl/Texture.js";const _=()=>e.getLogger("esri.views.3d.terrain");class f{constructor(e,t){this._rctx=e,this._techniques=t,this._fbos=[],this._vectorTileHelper=new i,this._blendConfiguration=new n,this._current=0,this._lastUsedIds=new Array,this._lastCreatedBufferId=0,this._onHoldIds=new Array,this._vao=l(this._rctx,1),this._bindParameters=new c(e,null)}dispose(){this._bindParameters.destroy(),this._fbos.forEach(t),this._fbos=null,this._vtFBO=t(this._vtFBO),this._vao=t(this._vao),this._vectorTileHelper=t(this._vectorTileHelper)}updateHeading(e){this._vectorTileHelper?.updateHeading(e)}_acquireBlendTechnique(e,t,r,i=!1,n=0){return this._blendConfiguration.output=t,this._blendConfiguration.blendMode=e,this._blendConfiguration.applyBaseOpacity=r,this._blendConfiguration.premultipliedAlphaSource=i,this._blendConfiguration.background=n,this._techniques.precompile(s,this._blendConfiguration),this._techniques.get(s,this._blendConfiguration)}drawBackground(e,t){const r=this._acquireBlendTechnique(0,t?2:3,!1,!1,1),i=this._rctx.bindTechnique(r,this._bindParameters,e);this._render(i)}_render(e){this._rctx.bindVAO(this._vao),e.assertCompatibleVertexAttributeLocations(this._vao),this._rctx.drawArrays(u.TRIANGLE_STRIP,0,this._vao.vertexCount("geometry"))}drawGroup(e,t,r,i,s=!0){1===t&&(e.fboTexture=this._fbos[this.getLastOnHoldId()].get(r).colorTexture??this._rctx.emptyTexture),e.texture=this.currentFBO(r).colorTexture,this.closeGroup(r);const n=e.baseOpacity<1,o=this._acquireBlendTechnique(i,t,n,s),a=this._rctx.bindTechnique(o,this._bindParameters,e);this._render(a)}drawImageData(e,t,r,i,s=!1){if(null==e.texture)return;const n=e.baseOpacity<1;e.fboTexture=(4===t||0===i&&!n&&!s?null:this.switch(r).colorTexture)??this._rctx.emptyTexture;const o=this._acquireBlendTechnique(i,t,n,s),a=this._rctx.bindTechnique(o,this._bindParameters,e);this._render(a)}drawRasterData(e,t,r,i,s){const n=s.sourceLayerInfo.data;if(!n.source)return;if(s.tile.surface.layerViewByIndex(s.layerIndex,1).ensureSymbolizerParameters(n),!n.bind(this._rctx))return;const o=e.baseOpacity<1;e.fboTexture=(0!==i||o?this.switch(r).colorTexture:null)??this._rctx.emptyTexture;const a=this._acquireRasterTechnique(n,t,i,o);if(!a)return;n.opacity=e.opacity;const h=n.getUniforms(this._rctx);h.scale=s.scale,h.offset=s.offset,h.backgroundColor=e.backgroundColor,h.fboTexture=e.fboTexture,h.baseOpacity=e.baseOpacity;const c=this._rctx.bindTechnique(a,this._bindParameters,h);this._render(c)}_acquireRasterTechnique(e,t,r,i){if(!this._rctx.capabilities.colorBufferFloat)return null;const s=e.symbolizerParameters,n=["stretch","lut","hillshade"].indexOf(s.type);return this._rasterConfiguration??=new a,this._rasterConfiguration.output=t,this._rasterConfiguration.blendMode=r,this._rasterConfiguration.applyBaseOpacity=i,this._rasterConfiguration.colorizerType=n,this._rasterConfiguration.applyColormap=!!s.colormap,this._rasterConfiguration.requireBilinearWithNN=e.isBilinearWithStretchColorRamp,this._rasterConfiguration.stretchType=e.hasStretchTypeNone()?0:1,this._techniques.precompile(o,this._rasterConfiguration),this._techniques.get(o,this._rasterConfiguration)}drawVectorData(e,t,i,s,n,o,a,c){const l=this._rctx,u=n.sourceLayerInfo.data,d=n.tile.surface.layerViewByIndex(n.layerIndex,1),f=e.baseOpacity<1,p=f||e.opacity<1||0!==s||1!==t,b=p,m=this._acquireBlendTechnique(s,t,f,b);l.setPipelineState(m.getPipeline(this._bindParameters,e));let g=null,x=null;p?(x=this.currentFBO(i),null==this._vtFBO&&(this._vtFBO=new h(this._rctx)),g=this._vtFBO.get(i),l.bindFramebuffer(g),this._clearCurrentFBO()):c&&l.clear(256);try{this._vectorTileHelper.renderBackground(l,n.sourceLod,d.painter,d.layer.styleRepository,d.schemaHelper,Math.round(1/n.scale),n.offset,a,o,d.contentZoom),u&&this._vectorTileHelper.renderContent(l,n.sourceLod,u,n.vtlNeighborInfos,d.painter,d.layer.styleRepository,d.schemaHelper,Math.round(1/n.scale),n.offset,a,o,d.contentZoom)}catch(T){_().warnOnce("A render call containing vector tiles did not resolve correctly.",T)}return!g||(l.bindFramebuffer(x),e.texture=g.colorTexture,e.offset=r,e.scale=1,this.drawImageData(e,t,i,s,b),c)}copyFBOToTexture(e){const t=this._rctx,r=t.bindTexture(e.texture,d.TEXTURE_UNIT_FOR_UPDATES),i=e.descriptor;t.gl.copyTexImage2D(3553,0,i.pixelFormat,0,0,i.width,i.height,0),e.generateMipmap(),t.bindTexture(r,d.TEXTURE_UNIT_FOR_UPDATES)}_clearCurrentFBO(){this._rctx.setStencilWriteMask(255),this._rctx.setClearColor(0,0,0,0),this._rctx.setClearDepth(1),this._rctx.setClearStencil(0),this._rctx.clear(17664)}_initFBO(e,t,r){this._rctx.bindFramebuffer(e),r&&(this._rctx.setViewport(0,0,t,t),this._clearCurrentFBO())}ensureBuffer(e){this._lastUsedIds.length=0,this._lastUsedIds.push(1),this._lastCreatedBufferId=1,this._onHoldIds.length=0,this.bind(e)}bind(e,t=0,r=!0){if(this._current=t,t>=this._fbos.length)for(let i=this._fbos.length;i<=t;i++)this._fbos.push(new h(this._rctx));this._initFBO(this._fbos[t].get(e),e,r)}_bindNextFreeBuffer(e){this._lastUsedIds.length>0?this.bind(e,this._lastUsedIds.pop()):(this._lastCreatedBufferId++,this.bind(e,this._lastCreatedBufferId))}openGroup(e){this._onHoldIds.push(this._current),this._bindNextFreeBuffer(e)}switch(e){const t=this.currentFBO(e),r=this._current;return this._bindNextFreeBuffer(e),this._lastUsedIds.push(r),t}getLastOnHoldId(){return this._onHoldIds[this._onHoldIds.length-1]}closeGroup(e){const t=this._current;this._bindNextFreeBuffer(e),this._lastUsedIds.push(t),this._lastUsedIds.push(this._onHoldIds.pop())}unbind(){this._rctx.bindFramebuffer(null)}currentFBO(e){return this._fbos[this._current].get(e)}}export{f as TileCompositor};
2
+ import e from"../../../core/Logger.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{ZEROS as r}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{VectorTileRendererHelper3D as i}from"../../2d/engine/vectorTiles/VectorTileRendererHelper3D.js";import{updateUniformBufferObject as s}from"../../2d/engine/webgl/shaderGraph/uniformBufferUtils.js";import{tileInfoUniformBlockBinding as n,getTileInfoUniforms as o}from"../../2d/engine/webgl/shaderGraph/techniques/shaders/TileInfo.js";import{viewInfoUniformBlockBinding as a,getViewUniforms as h}from"../../2d/engine/webgl/shaderGraph/techniques/shaders/ViewInfo.js";import{BlendLayersTechnique as c}from"./BlendLayersTechnique.js";import{BlendLayersTechniqueConfiguration as l}from"./BlendLayersTechniqueConfiguration.js";import{RasterColorizerTechnique as u}from"./RasterColorizerTechnique.js";import{RasterColorizerTechniqueConfiguration as d}from"./RasterColorizerTechniqueConfiguration.js";import{MultiSizeFramebuffer as f}from"./support/MultiSizeFramebuffer.js";import{BindParameters as _}from"../webgl-engine/lib/BindParameters.js";import{createQuadVAO as p}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as b}from"../../webgl/enums.js";import m from"../../webgl/Texture.js";import{UniformBufferObject as g}from"../../webgl/UniformBufferObject.js";const x=()=>e.getLogger("esri.views.3d.terrain");class T{constructor(e,t){this._rctx=e,this._techniques=t,this._fbos=[],this._vectorTileHelper=new i,this._tileInfoUniformBufferObject=null,this._viewInfoUniformBufferObject=null,this._blendConfiguration=new l,this._current=0,this._lastUsedIds=new Array,this._lastCreatedBufferId=0,this._onHoldIds=new Array,this._vao=p(this._rctx,1),this._bindParameters=new _(e,null)}dispose(){this._bindParameters.destroy(),this._fbos.forEach(t),this._fbos=null,this._vtFBO=t(this._vtFBO),this._vao=t(this._vao),this._vectorTileHelper=t(this._vectorTileHelper),this._tileInfoUniformBufferObject?.dispose(),this._tileInfoUniformBufferObject=null,this._viewInfoUniformBufferObject?.dispose(),this._viewInfoUniformBufferObject=null}updateHeading(e){this._vectorTileHelper?.updateHeading(e)}_acquireBlendTechnique(e,t,r,i=!1,s=0){return this._blendConfiguration.output=t,this._blendConfiguration.blendMode=e,this._blendConfiguration.applyBaseOpacity=r,this._blendConfiguration.premultipliedAlphaSource=i,this._blendConfiguration.background=s,this._techniques.precompile(c,this._blendConfiguration),this._techniques.get(c,this._blendConfiguration)}drawBackground(e,t){const r=this._acquireBlendTechnique(0,t?2:3,!1,!1,1),i=this._rctx.bindTechnique(r,this._bindParameters,e);this._render(i)}_render(e){this._rctx.bindVAO(this._vao),e.assertCompatibleVertexAttributeLocations(this._vao),this._rctx.drawArrays(b.TRIANGLE_STRIP,0,this._vao.vertexCount("geometry"))}drawGroup(e,t,r,i,s=!0){1===t&&(e.fboTexture=this._fbos[this.getLastOnHoldId()].get(r).colorTexture??this._rctx.emptyTexture),e.texture=this.currentFBO(r).colorTexture,this.closeGroup(r);const n=e.baseOpacity<1,o=this._acquireBlendTechnique(i,t,n,s),a=this._rctx.bindTechnique(o,this._bindParameters,e);this._render(a)}drawImageData(e,t,r,i,s=!1){if(null==e.texture)return;const n=e.baseOpacity<1;e.fboTexture=(4===t||0===i&&!n&&!s?null:this.switch(r).colorTexture)??this._rctx.emptyTexture;const o=this._acquireBlendTechnique(i,t,n,s),a=this._rctx.bindTechnique(o,this._bindParameters,e);this._render(a)}drawRasterData(e,t,r,i,s){const n=s.sourceLayerInfo.data;if(!n.source)return;if(s.tile.surface.layerViewByIndex(s.layerIndex,1).ensureSymbolizerParameters(n),!n.bind(this._rctx))return;const o=e.baseOpacity<1;e.fboTexture=(0!==i||o?this.switch(r).colorTexture:null)??this._rctx.emptyTexture;const a=this._acquireRasterTechnique(n,t,i,o);if(!a)return;n.opacity=e.opacity;const h=n.getUniforms(this._rctx);h.scale=s.scale,h.offset=s.offset,h.backgroundColor=e.backgroundColor,h.fboTexture=e.fboTexture,h.baseOpacity=e.baseOpacity;const c=this._rctx.bindTechnique(a,this._bindParameters,h);this._render(c)}_acquireRasterTechnique(e,t,r,i){if(!this._rctx.capabilities.colorBufferFloat)return null;const s=e.symbolizerParameters,n=["stretch","lut","hillshade"].indexOf(s.type);return this._rasterConfiguration??=new d,this._rasterConfiguration.output=t,this._rasterConfiguration.blendMode=r,this._rasterConfiguration.applyBaseOpacity=i,this._rasterConfiguration.colorizerType=n,this._rasterConfiguration.applyColormap=!!s.colormap,this._rasterConfiguration.requireBilinearWithNN=e.isBilinearWithStretchColorRamp,this._rasterConfiguration.stretchType=e.hasStretchTypeNone()?0:1,this._techniques.precompile(u,this._rasterConfiguration),this._techniques.get(u,this._rasterConfiguration)}drawVectorData(e,t,i,s,n,o,a,h){const c=this._rctx,l=n.sourceLayerInfo.data,u=n.tile.surface.layerViewByIndex(n.layerIndex,1),d=u.painter,_=u.layer.styleRepository,p=u.schemaHelper,b=u.tilingScheme,m=Math.round(1/n.scale),g=u.contentZoom,T=e.baseOpacity<1,B=T||e.opacity<1||0!==s||1!==t,I=B,y=this._acquireBlendTechnique(s,t,T,I);c.setPipelineState(y.getPipeline(this._bindParameters,e));let w=null,O=null;B?(O=this.currentFBO(i),null==this._vtFBO&&(this._vtFBO=new f(this._rctx)),w=this._vtFBO.get(i),c.bindFramebuffer(w),this._clearCurrentFBO()):h&&c.clear(256);try{if(l||_.backgroundBucketIds.length>0){const e=this._vectorTileHelper.updateViewRenderParameters(c,n.sourceLod,l,d,p,b,m,a,o,g);this._vectorTileHelper.updateTileInfoRenderParameters(n.sourceLod,l,p,b,m,n.offset,a,g),this._updateViewInfo(e),this._updateTileInfo(e)}this._vectorTileHelper.renderBackground(c,n.sourceLod,l,d,_,p,b),l&&this._vectorTileHelper.renderContent(c,l,n.vtlNeighborInfos,d,_)}catch(C){x().warnOnce("A render call containing vector tiles did not resolve correctly.",C)}return!w||(c.bindFramebuffer(O),e.texture=w.colorTexture,e.offset=r,e.scale=1,this.drawImageData(e,t,i,s,I),h)}_updateTileInfo(e){const t=this._tileInfoUniformBufferObject??(this._tileInfoUniformBufferObject=new g(this._rctx,n.descriptor));s(t,n,o(e)),this._rctx.bindUBO(n.bindingPoint,t)}_updateViewInfo(e){const t=this._viewInfoUniformBufferObject??(this._viewInfoUniformBufferObject=new g(this._rctx,a.descriptor));s(t,a,h(e)),this._rctx.bindUBO(a.bindingPoint,t)}copyFBOToTexture(e){const t=this._rctx,r=t.bindTexture(e.texture,m.TEXTURE_UNIT_FOR_UPDATES),i=e.descriptor;t.gl.copyTexImage2D(3553,0,i.pixelFormat,0,0,i.width,i.height,0),e.generateMipmap(),t.bindTexture(r,m.TEXTURE_UNIT_FOR_UPDATES)}_clearCurrentFBO(){this._rctx.setStencilWriteMask(255),this._rctx.setClearColor(0,0,0,0),this._rctx.setClearDepth(1),this._rctx.setClearStencil(0),this._rctx.clear(17664)}_initFBO(e,t,r){this._rctx.bindFramebuffer(e),r&&(this._rctx.setViewport(0,0,t,t),this._clearCurrentFBO())}ensureBuffer(e){this._lastUsedIds.length=0,this._lastUsedIds.push(1),this._lastCreatedBufferId=1,this._onHoldIds.length=0,this.bind(e)}bind(e,t=0,r=!0){if(this._current=t,t>=this._fbos.length)for(let i=this._fbos.length;i<=t;i++)this._fbos.push(new f(this._rctx));this._initFBO(this._fbos[t].get(e),e,r)}_bindNextFreeBuffer(e){this._lastUsedIds.length>0?this.bind(e,this._lastUsedIds.pop()):(this._lastCreatedBufferId++,this.bind(e,this._lastCreatedBufferId))}openGroup(e){this._onHoldIds.push(this._current),this._bindNextFreeBuffer(e)}switch(e){const t=this.currentFBO(e),r=this._current;return this._bindNextFreeBuffer(e),this._lastUsedIds.push(r),t}getLastOnHoldId(){return this._onHoldIds[this._onHoldIds.length-1]}closeGroup(e){const t=this._current;this._bindNextFreeBuffer(e),this._lastUsedIds.push(t),this._lastUsedIds.push(this._onHoldIds.pop())}unbind(){this._rctx.bindFramebuffer(null)}currentFBO(e){return this._fbos[this._current].get(e)}}export{T as TileCompositor};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import i from"../../../core/Accessor.js";import e from"../../../core/Logger.js";import{lerp as r}from"../../../core/mathUtils.js";import{createScreenPointArray as s,createRenderScreenPointArray3 as o}from"../../../core/screenUtils.js";import{property as n,subclass as h}from"../../../core/accessorSupport/decorators.js";import{copy as a,invertOrIdentity as p,multiply as u,invert as l,transpose as _,frustum as v,exactEquals as c,lookAt as w}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as y}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as d,exactEquals as g}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as m}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{subtract as f,set as x,distance as M,copy as D,exactEquals as j,sub as R,dot as V,sqrLen as P,sqrDist as F,scale as C,length as b,cross as S,normalize as T,direction as I}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as E,UNIT_Z as A}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{scale as O,equals as U,exactEquals as z,copy as H,squaredDistance as q,transformMat4 as W}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as Y,create as k}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as L,copy as X,fromMatrix as G}from"../../../geometry/support/frustum.js";import{create as N}from"../../../geometry/support/ray.js";import{projectPointSignedLength as B}from"../../../geometry/support/vector.js";import{viewAngle as J}from"../state/utils/viewUtils.js";import{fovd2fovx as K,fovx2fovd as Q,fovd2fovy as Z,fovy2fovd as $}from"../webgl-engine/lib/fov.js";var tt;let it=tt=class extends i{constructor(t){super(t),this._ray=N(),this._viewport=Y(0,0,1,1),this._padding=Y(0,0,0,0),this._fov=55/180*Math.PI,this._nearFar=m(1,1e3),this._viewDirty=!0,this._viewMatrix=y(),this._viewProjectionDirty=!0,this._viewProjectionMatrix=y(),this._viewInverseTransposeMatrixDirty=!0,this._viewInverseTransposeMatrix=y(),this._frustumDirty=!0,this._frustum=L(),this._fullViewport=k(),this._fullViewportDirty=!0,this._pixelRatio=1,this.row=0,this.column=0,this._rows=1,this._columns=1,this._center=E(),this._up=E(),this.relativeElevation=0}get pixelRatio(){return this._pixelRatio}set pixelRatio(t){this._pixelRatio=t>0?t:1}get rows(){return this._rows}set rows(t){this._rows=Math.max(1,t)}get columns(){return this._columns}set columns(t){this._columns=Math.max(1,t)}get eye(){return this._ray.origin}set eye(t){this._compareAndSetView(t,this._ray.origin,"eye")}get center(){return this._center}set center(t){this._compareAndSetView(t,this._center,"_center")}get ray(){return f(this._ray.direction,this.center,this.eye),this._ray}get up(){return this._up}set up(t){this._compareAndSetView(t,this._up,"_up")}get viewMatrix(){return this._ensureViewClean(),this._viewMatrix}set viewMatrix(t){a(this._viewMatrix,t),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0}get inverseViewMatrix(){return p(y(),this.viewMatrix)||this._get("inverseViewMatrix")||y()}get viewForward(){return this._ensureViewClean(),x(E(),-this._viewMatrix[2],-this._viewMatrix[6],-this._viewMatrix[10])}get viewUp(){return this._ensureViewClean(),x(E(),this._viewMatrix[1],this._viewMatrix[5],this._viewMatrix[9])}get viewRight(){return this._ensureViewClean(),x(E(),this._viewMatrix[0],this._viewMatrix[4],this._viewMatrix[8])}get nearFar(){return this._nearFar}get near(){return this._nearFar[0]}set near(t){this._nearFar[0]!==t&&(this._nearFar[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get far(){return this._nearFar[1]}set far(t){this._nearFar[1]!==t&&(this._nearFar[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get viewport(){return this._viewport}set viewport(t){this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3]}get screenViewport(){if(1===this.pixelRatio)return this._viewport;const t=O(k(),this._viewport,1/this.pixelRatio),i=this._get("screenViewport");return i&&U(t,i)?i:t}get screenPadding(){if(1===this.pixelRatio)return this._padding;const t=O(k(),this._padding,1/this.pixelRatio),i=this._get("screenPadding");return i&&U(t,i)?i:t}get x(){return this._viewport[0]}set x(t){t+=this._padding[3],this._viewport[0]!==t&&(this._viewport[0]=t,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get y(){return this._viewport[1]}set y(t){t+=this._padding[2],this._viewport[1]!==t&&(this._viewport[1]=t,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get width(){return this._viewport[2]}set width(t){this._viewport[2]!==t&&(this._viewport[2]=t,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get height(){return this._viewport[3]}set height(t){this._viewport[3]!==t&&(this._viewport[3]=t,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get fullWidth(){return this._viewport[2]+this._padding[1]+this._padding[3]}set fullWidth(t){this.width=t-(this._padding[1]+this._padding[3])}get fullHeight(){return this._viewport[3]+this._padding[0]+this._padding[2]}set fullHeight(t){this.height=t-(this._padding[0]+this._padding[2])}get fullViewport(){return this._fullViewportDirty&&(this._fullViewport[0]=this._viewport[0]-this._padding[3],this._fullViewport[1]=this._viewport[1]-this._padding[2],this._fullViewport[2]=this._viewport[2]+this._padding[1]+this._padding[3],this._fullViewport[3]=this._viewport[3]+this._padding[0]+this._padding[2],this._fullViewportDirty=!1),this._fullViewport}get _aspect(){return this.width/this.height}get padding(){return this._padding}set padding(t){z(this._padding,t)||(this._viewport[0]+=t[3]-this._padding[3],this._viewport[1]+=t[2]-this._padding[2],this._viewport[2]-=t[1]+t[3]-(this._padding[1]+this._padding[3]),this._viewport[3]-=t[0]+t[2]-(this._padding[0]+this._padding[2]),H(this._padding,t),this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_padding"),this.notifyChange("_viewport"))}get viewProjectionMatrix(){return this._viewProjectionDirty&&(u(this._viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),this._viewProjectionDirty=!1),this._viewProjectionMatrix}get projectionMatrix(){return this._projectionMatrixInternal}get inverseProjectionMatrix(){return l(y(),this.projectionMatrix)||this._get("inverseProjectionMatrix")||y()}get fov(){return this._fov}set fov(t){this._fov=t,this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovX(){return K(this._fov,this.width,this.height)}set fovX(t){this._fov=Q(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovY(){return Z(this._fov,this.width,this.height)}set fovY(t){this._fov=$(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get distance(){return M(this.center,this.eye)}get frustum(){return this._recomputeFrustum(),this._frustum}get viewInverseTransposeMatrix(){return(this._viewInverseTransposeMatrixDirty||this._viewDirty)&&(l(this._viewInverseTransposeMatrix,this.viewMatrix),_(this._viewInverseTransposeMatrix,this._viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this._viewInverseTransposeMatrix}depthNDCToWorld(t){const{near:i,far:e}=this;return 2*i*e/(e+i-t*(e-i))}get perRenderPixelRatio(){return Math.tan(this.fovX/2)/(this.width/2)}get perScreenPixelRatio(){return this.perRenderPixelRatio*this.pixelRatio}get aboveGround(){return null!=this.relativeElevation&&this.relativeElevation>=0}get _projectionMatrixInternal(){const t=this.width,i=this.height,e=this.near*Math.tan(this.fovY/2)*2,r=e*this._aspect,s=e/this.rows,o=r/this.columns,n=-r/2+this.column*o,h=n+o,a=-e/2+this.row*s,p=a+s,u=v(y(),n*(1+2*this._padding[3]/t),h*(1+2*this._padding[1]/t),a*(1+2*this._padding[2]/i),p*(1+2*this._padding[0]/i),this.near,this.far),l=this._get("projectionMatrix");return l&&c(l,u)?l:u}copyFrom(t){D(this._ray.origin,t.eye),this.center=t.center,this.up=t.up,H(this._viewport,t.viewport),this.notifyChange("_viewport"),H(this._padding,t.padding),this.notifyChange("_padding"),this._fullViewportDirty=!0,d(this._nearFar,t.nearFar),this.notifyChange("_nearFar"),this._fov=t.fov,this.row=t.row,this.column=t.column,this.rows=t.rows,this.columns=t.columns,this.relativeElevation=t.relativeElevation;const i=t;return this._viewDirty=i._viewDirty,this._viewDirty||(a(this._viewMatrix,t.viewMatrix),this.notifyChange("_viewMatrix")),this._viewProjectionDirty=!0,this._frustumDirty=i._frustumDirty,this._frustumDirty||(X(this._frustum,t.frustum),this._frustumDirty=!1),i._viewInverseTransposeMatrixDirty?this._viewInverseTransposeMatrixDirty=!0:(a(this._viewInverseTransposeMatrix,t.viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this.pixelRatio=t.pixelRatio,this}copyViewFrom(t){this.eye=t.eye,this.center=t.center,this.up=t.up,this.fov=t.fov}clone(){return(new tt).copyFrom(this)}equals(t){return j(this.eye,t.eye)&&j(this.center,t.center)&&j(this.up,t.up)&&z(this._viewport,t.viewport)&&z(this._padding,t.padding)&&g(this.nearFar,t.nearFar)&&this._fov===t.fov&&this.pixelRatio===t.pixelRatio&&this.relativeElevation===t.relativeElevation&&this.row===t.row&&this.column===t.column&&this.rows===t.rows&&this.columns===t.columns}equalsView(t){return j(this.eye,t.eye)&&j(this.center,t.center)&&j(this.up,t.up)&&this._fov===t.fov}almostEquals(t){const i=Math.max(1,1/this.pixelRatio,1/t.pixelRatio);if(Math.abs(t.fov-this._fov)>=.001||q(t.screenPadding,this.screenPadding)>=i||q(this.screenViewport,t.screenViewport)>=i||this.row!==t.row||this.column!==t.column||this.rows!==t.rows||this.columns!==t.columns)return!1;R(ot,t.eye,t.center),R(nt,this.eye,this.center);const e=V(ot,nt),r=P(ot),s=P(nt),o=5e-4;return e*e>=(1-1e-10)*r*s&&F(t.eye,this.eye)<Math.max(r,s)*o*o}computeRenderPixelSizeAt(t){return this.computeRenderPixelSizeAtDist(this._viewDirectionDistance(t))}computeRenderPixelSizeAtDist(t){return t*this.perRenderPixelRatio}computeScreenPixelSizeAt(t){return this.computeScreenPixelSizeAtDist(this._viewDirectionDistance(t))}_viewDirectionDistance(t){return Math.abs(B(this.viewForward,f(ot,t,this.eye)))}computeScreenPixelSizeAtDist(t){return t*this.perScreenPixelRatio}computeDistanceFromRadius(t,i){return t/Math.tan(Math.min(this.fovX,this.fovY)/(2*(i||1)))}getScreenCenter(t=s()){return t[0]=(this.padding[3]+this.width/2)/this.pixelRatio,t[1]=(this.padding[0]+this.height/2)/this.pixelRatio,t}getRenderCenter(t,i=.5,e=.5){return t[0]=this.padding[3]+this.width*i,t[1]=this.padding[2]+this.height*e,t[2]=.5,t}setGLViewport(t){const i=this.viewport,e=this.padding;t.setViewport(i[0]-e[3],i[1]-e[2],i[2]+e[1]+e[3],i[3]+e[0]+e[2])}applyProjection(t,i){t!==rt&&D(rt,t),rt[3]=1,W(rt,rt,this.projectionMatrix);const e=Math.abs(rt[3]);C(rt,rt,1/e);const s=this.fullViewport;i[0]=r(0,s[0]+s[2],.5+.5*rt[0]),i[1]=r(0,s[1]+s[3],.5+.5*rt[1]),i[2]=.5*(rt[2]+1),i[3]=e}unapplyProjection(t,i){const e=this.fullViewport;rt[0]=(t[0]/(e[0]+e[2])*2-1)*t[3],rt[1]=(t[1]/(e[1]+e[3])*2-1)*t[3],rt[2]=(2*t[2]-1)*t[3],rt[3]=t[3],null!=this.inverseProjectionMatrix&&(W(rt,rt,this.inverseProjectionMatrix),i[0]=rt[0],i[1]=rt[1],i[2]=rt[2])}projectToScreen(t,i){return null==this.projectToRenderScreen(t,ht)?null:(this.renderToScreen(ht,i),i)}projectToRenderScreen(t,i){if(rt[0]=t[0],rt[1]=t[1],rt[2]=t[2],rt[3]=1,W(rt,rt,this.viewProjectionMatrix),0===rt[3])return null;const e=rt;C(e,e,1/Math.abs(rt[3]));const s=this.fullViewport,o=r(0,s[0]+s[2],.5+.5*e[0]),n=r(0,s[1]+s[3],.5+.5*e[1]);return"x"in i?(i.x=o,i.y=n):(i[0]=o,i[1]=n,i.length>2&&(i[2]=.5*(e[2]+1))),i}unprojectFromScreen(t,i){return this.unprojectFromRenderScreen(this.screenToRender(t,ht),i)}unprojectFromRenderScreen(t,i){if(u(st,this.projectionMatrix,this.viewMatrix),!l(st,st))return null;const e=this.fullViewport;return rt[0]=2*(t[0]-e[0])/e[2]-1,rt[1]=2*(t[1]-e[1])/e[3]-1,rt[2]=2*t[2]-1,rt[3]=1,W(rt,rt,st),0===rt[3]?null:(i[0]=rt[0]/rt[3],i[1]=rt[1]/rt[3],i[2]=rt[2]/rt[3],i)}constrainWindowSize(t,i,e,r){const s=t*this.pixelRatio,o=i*this.pixelRatio,n=Math.max(s-e/2,0),h=Math.max(this.fullHeight-o-r/2,0),a=-Math.min(s-e/2,0),p=-Math.min(this.fullHeight-o-r/2,0),u=e-a- -Math.min(this.fullWidth-s-e/2,0),l=r-p- -Math.min(o-r/2,0);return[Math.round(n),Math.round(h),Math.round(u),Math.round(l)]}computeUp(t){1===t?this._computeUpGlobal():this._computeUpLocal()}screenToRender(t,i){const e=t[0]*this.pixelRatio,r=this.fullHeight-t[1]*this.pixelRatio;return i[0]=e,i[1]=r,i}renderToScreen(t,i){const e=t[0]/this.pixelRatio,r=(this.fullHeight-t[1])/this.pixelRatio;i[0]=e,i[1]=r}sphereFrustumCoverage(t,i){const{center:e,eye:r,distance:s,fovY:o}=this,n=Math.abs(Math.PI/2-J(i,e,r));return t.frustumCoverage(n,s,o)}_computeUpGlobal(){f(ot,this.center,this.eye);const t=b(this.center);t<1?j(this._up,A)&&(D(this._up,A),this._markViewDirty(),this.notifyChange("_up")):Math.abs(V(ot,this.center))>.9999*b(ot)*t||(S(nt,ot,this.center),S(nt,nt,ot),T(nt,nt),j(this._up,nt)||(D(this._up,nt),this.notifyChange("_up"),this._markViewDirty()))}_computeUpLocal(){I(ot,this.eye,this.center),Math.abs(ot[2])<=.9999&&(C(ot,ot,ot[2]),x(ot,-ot[0],-ot[1],1-ot[2]),T(ot,ot),j(this._up,ot)||(D(this._up,ot),this.notifyChange("_up"),this._markViewDirty()))}_compareAndSetView(t,i,r){"number"==typeof t[0]&&isFinite(t[0])&&"number"==typeof t[1]&&isFinite(t[1])&&"number"==typeof t[2]&&isFinite(t[2])?j(t,i)||(D(i,t),this._markViewDirty(),this.notifyChange(r)):e.getLogger("esri.views.3d.webgl-engine.lib.RenderCamera").warn("RenderCamera vector contains invalid number, ignoring value")}_markViewDirty(){this._viewDirty=!0,this._frustumDirty=!0,this._viewProjectionDirty=!0}_recomputeFrustum(){this._frustumDirty&&(G(this.viewMatrix,this.projectionMatrix,this._frustum),this._frustumDirty=!1)}_ensureViewClean(){this._viewDirty&&(w(this._viewMatrix,this.eye,this.center,this.up),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0)}};t([n()],it.prototype,"_viewport",void 0),t([n()],it.prototype,"_padding",void 0),t([n()],it.prototype,"_fov",void 0),t([n()],it.prototype,"_nearFar",void 0),t([n()],it.prototype,"_viewDirty",void 0),t([n()],it.prototype,"_viewMatrix",void 0),t([n()],it.prototype,"_pixelRatio",void 0),t([n()],it.prototype,"pixelRatio",null),t([n()],it.prototype,"row",void 0),t([n()],it.prototype,"column",void 0),t([n()],it.prototype,"_rows",void 0),t([n()],it.prototype,"rows",null),t([n()],it.prototype,"_columns",void 0),t([n()],it.prototype,"columns",null),t([n()],it.prototype,"eye",null),t([n()],it.prototype,"center",null),t([n()],it.prototype,"_center",void 0),t([n()],it.prototype,"up",null),t([n()],it.prototype,"_up",void 0),t([n()],it.prototype,"viewMatrix",null),t([n({readOnly:!0})],it.prototype,"inverseViewMatrix",null),t([n({readOnly:!0})],it.prototype,"viewForward",null),t([n({readOnly:!0})],it.prototype,"viewUp",null),t([n({readOnly:!0})],it.prototype,"viewRight",null),t([n({readOnly:!0})],it.prototype,"nearFar",null),t([n()],it.prototype,"near",null),t([n()],it.prototype,"far",null),t([n()],it.prototype,"viewport",null),t([n({readOnly:!0})],it.prototype,"screenViewport",null),t([n({readOnly:!0})],it.prototype,"screenPadding",null),t([n()],it.prototype,"x",null),t([n()],it.prototype,"y",null),t([n()],it.prototype,"width",null),t([n()],it.prototype,"height",null),t([n()],it.prototype,"fullWidth",null),t([n()],it.prototype,"fullHeight",null),t([n({readOnly:!0})],it.prototype,"_aspect",null),t([n()],it.prototype,"padding",null),t([n({readOnly:!0})],it.prototype,"projectionMatrix",null),t([n({readOnly:!0})],it.prototype,"inverseProjectionMatrix",null),t([n()],it.prototype,"fov",null),t([n()],it.prototype,"fovX",null),t([n()],it.prototype,"fovY",null),t([n()],it.prototype,"viewInverseTransposeMatrix",null),t([n({readOnly:!0})],it.prototype,"_projectionMatrixInternal",null),t([n()],it.prototype,"relativeElevation",void 0),it=tt=t([h("esri.views.3d.webgl.RenderCamera")],it);const et=it,rt=k(),st=y(),ot=E(),nt=E(),ht=o();export{et as default};
2
+ import{__decorate as t}from"tslib";import i from"../../../core/Accessor.js";import e from"../../../core/Logger.js";import{lerp as r}from"../../../core/mathUtils.js";import{createScreenPointArray as s,createRenderScreenPointArray3 as o}from"../../../core/screenUtils.js";import{property as n,subclass as h}from"../../../core/accessorSupport/decorators.js";import{copy as a,invertOrIdentity as p,multiply as u,invert as l,transpose as _,frustum as v,exactEquals as c,lookAt as w}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as y}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as d,exactEquals as g}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as m}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{subtract as f,set as x,distance as M,copy as D,exactEquals as j,sub as R,dot as V,sqrLen as P,sqrDist as F,scale as C,length as b,cross as S,normalize as T,direction as I}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as E,UNIT_Z as A}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{scale as O,equals as U,exactEquals as z,copy as H,squaredDistance as q,transformMat4 as W}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as Y,create as k}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as L,copy as X,fromMatrix as G}from"../../../geometry/support/frustum.js";import{create as N}from"../../../geometry/support/ray.js";import{projectPointSignedLength as B}from"../../../geometry/support/vector.js";import{viewAngle as J}from"../state/utils/viewUtils.js";import{fovd2fovx as K,fovx2fovd as Q,fovd2fovy as Z,fovy2fovd as $}from"../webgl-engine/lib/fov.js";var tt;let it=tt=class extends i{constructor(t){super(t),this._ray=N(),this._viewport=Y(0,0,1,1),this._padding=Y(0,0,0,0),this._fov=55/180*Math.PI,this._nearFar=m(1,1e3),this._viewDirty=!0,this._viewMatrix=y(),this._viewProjectionDirty=!0,this._viewProjectionMatrix=y(),this._viewInverseTransposeMatrixDirty=!0,this._viewInverseTransposeMatrix=y(),this._frustumDirty=!0,this._frustum=L(),this._fullViewport=k(),this._fullViewportDirty=!0,this._pixelRatio=1,this.row=0,this.column=0,this._rows=1,this._columns=1,this._center=E(),this._up=E(),this.relativeElevation=0}get pixelRatio(){return this._pixelRatio}set pixelRatio(t){this._pixelRatio=t>0?t:1}get rows(){return this._rows}set rows(t){this._rows=Math.max(1,t)}get columns(){return this._columns}set columns(t){this._columns=Math.max(1,t)}get eye(){return this._ray.origin}set eye(t){this._compareAndSetView(t,this._ray.origin,"eye")}get center(){return this._center}set center(t){this._compareAndSetView(t,this._center,"_center")}get ray(){return f(this._ray.direction,this.center,this.eye),this._ray}get up(){return this._up}set up(t){this._compareAndSetView(t,this._up,"_up")}get viewMatrix(){return this._ensureViewClean(),this._viewMatrix}set viewMatrix(t){a(this._viewMatrix,t),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0}get inverseViewMatrix(){return p(y(),this.viewMatrix)||this._get("inverseViewMatrix")||y()}get viewForward(){return this._ensureViewClean(),x(E(),-this._viewMatrix[2],-this._viewMatrix[6],-this._viewMatrix[10])}get viewUp(){return this._ensureViewClean(),x(E(),this._viewMatrix[1],this._viewMatrix[5],this._viewMatrix[9])}get viewRight(){return this._ensureViewClean(),x(E(),this._viewMatrix[0],this._viewMatrix[4],this._viewMatrix[8])}get nearFar(){return this._nearFar}get near(){return this._nearFar[0]}set near(t){this._nearFar[0]!==t&&(this._nearFar[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get far(){return this._nearFar[1]}set far(t){this._nearFar[1]!==t&&(this._nearFar[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get viewport(){return this._viewport}set viewport(t){this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3]}get screenViewport(){if(1===this.pixelRatio)return this._viewport;const t=O(k(),this._viewport,1/this.pixelRatio),i=this._get("screenViewport");return i&&U(t,i)?i:t}get screenPadding(){if(1===this.pixelRatio)return this._padding;const t=O(k(),this._padding,1/this.pixelRatio),i=this._get("screenPadding");return i&&U(t,i)?i:t}get x(){return this._viewport[0]}set x(t){t+=this._padding[3],this._viewport[0]!==t&&(this._viewport[0]=t,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get y(){return this._viewport[1]}set y(t){t+=this._padding[2],this._viewport[1]!==t&&(this._viewport[1]=t,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get width(){return this._viewport[2]}set width(t){this._viewport[2]!==t&&(this._viewport[2]=t,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get height(){return this._viewport[3]}set height(t){this._viewport[3]!==t&&(this._viewport[3]=t,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get fullWidth(){return this._viewport[2]+this._padding[1]+this._padding[3]}set fullWidth(t){this.width=t-(this._padding[1]+this._padding[3])}get fullHeight(){return this._viewport[3]+this._padding[0]+this._padding[2]}set fullHeight(t){this.height=t-(this._padding[0]+this._padding[2])}get fullViewport(){return this._fullViewportDirty&&(this._fullViewport[0]=this._viewport[0]-this._padding[3],this._fullViewport[1]=this._viewport[1]-this._padding[2],this._fullViewport[2]=this._viewport[2]+this._padding[1]+this._padding[3],this._fullViewport[3]=this._viewport[3]+this._padding[0]+this._padding[2],this._fullViewportDirty=!1),this._fullViewport}get _aspect(){return this.width/this.height}get padding(){return this._padding}set padding(t){z(this._padding,t)||(this._viewport[0]+=t[3]-this._padding[3],this._viewport[1]+=t[2]-this._padding[2],this._viewport[2]-=t[1]+t[3]-(this._padding[1]+this._padding[3]),this._viewport[3]-=t[0]+t[2]-(this._padding[0]+this._padding[2]),H(this._padding,t),this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_padding"),this.notifyChange("_viewport"))}get viewProjectionMatrix(){return this._viewProjectionDirty&&(u(this._viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),this._viewProjectionDirty=!1),this._viewProjectionMatrix}get projectionMatrix(){return this._projectionMatrixInternal}get inverseProjectionMatrix(){return l(y(),this.projectionMatrix)||this._get("inverseProjectionMatrix")||y()}get fov(){return this._fov}set fov(t){this._fov=t,this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovX(){return K(this._fov,this.width,this.height)}set fovX(t){this._fov=Q(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovY(){return Z(this._fov,this.width,this.height)}set fovY(t){this._fov=$(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get distance(){return M(this.center,this.eye)}get frustum(){return this._recomputeFrustum(),this._frustum}get viewInverseTransposeMatrix(){return(this._viewInverseTransposeMatrixDirty||this._viewDirty)&&(l(this._viewInverseTransposeMatrix,this.viewMatrix),_(this._viewInverseTransposeMatrix,this._viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this._viewInverseTransposeMatrix}depthNDCToWorld(t){const{near:i,far:e}=this;return 2*i*e/(e+i-t*(e-i))}get perRenderPixelRatio(){return Math.tan(this.fovX/2)/(this.width/2)}get perScreenPixelRatio(){return this.perRenderPixelRatio*this.pixelRatio}get aboveGround(){return null!=this.relativeElevation&&this.relativeElevation>=0}get _projectionMatrixInternal(){const t=this.width,i=this.height,e=this.near*Math.tan(this.fovY/2)*2,r=e*this._aspect,s=e/this.rows,o=r/this.columns,n=-r/2+this.column*o,h=n+o,a=-e/2+this.row*s,p=a+s,u=v(y(),n*(1+2*this._padding[3]/t),h*(1+2*this._padding[1]/t),a*(1+2*this._padding[2]/i),p*(1+2*this._padding[0]/i),this.near,this.far),l=this._get("projectionMatrix");return l&&c(l,u)?l:u}copyFrom(t){D(this._ray.origin,t.eye),this.center=t.center,this.up=t.up,H(this._viewport,t.viewport),this.notifyChange("_viewport"),H(this._padding,t.padding),this.notifyChange("_padding"),this._fullViewportDirty=!0,d(this._nearFar,t.nearFar),this.notifyChange("_nearFar"),this._fov=t.fov,this.row=t.row,this.column=t.column,this.rows=t.rows,this.columns=t.columns,this.relativeElevation=t.relativeElevation;const i=t;return this._viewDirty=i._viewDirty,this._viewDirty||(a(this._viewMatrix,t.viewMatrix),this.notifyChange("_viewMatrix")),this._viewProjectionDirty=!0,this._frustumDirty=i._frustumDirty,this._frustumDirty||(X(this._frustum,t.frustum),this._frustumDirty=!1),i._viewInverseTransposeMatrixDirty?this._viewInverseTransposeMatrixDirty=!0:(a(this._viewInverseTransposeMatrix,t.viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this.pixelRatio=t.pixelRatio,this}copyViewFrom(t){this.eye=t.eye,this.center=t.center,this.up=t.up,this.fov=t.fov}clone(){return(new tt).copyFrom(this)}equals(t){return j(this.eye,t.eye)&&j(this.center,t.center)&&j(this.up,t.up)&&z(this._viewport,t.viewport)&&z(this._padding,t.padding)&&g(this.nearFar,t.nearFar)&&this._fov===t.fov&&this.pixelRatio===t.pixelRatio&&this.relativeElevation===t.relativeElevation&&this.row===t.row&&this.column===t.column&&this.rows===t.rows&&this.columns===t.columns}equalsView(t){return j(this.eye,t.eye)&&j(this.center,t.center)&&j(this.up,t.up)&&this._fov===t.fov}almostEquals(t){const i=Math.max(1,1/this.pixelRatio,1/t.pixelRatio);if(Math.abs(t.fov-this._fov)>=.001||q(t.screenPadding,this.screenPadding)>=i||q(this.screenViewport,t.screenViewport)>=i||this.row!==t.row||this.column!==t.column||this.rows!==t.rows||this.columns!==t.columns)return!1;R(st,t.eye,t.center),R(ot,this.eye,this.center);const e=V(st,ot),r=P(st),s=P(ot),o=5e-4;return e*e>=(1-1e-10)*r*s&&F(t.eye,this.eye)<Math.max(r,s)*o*o}computeRenderPixelSizeAt(t){return this.computeRenderPixelSizeAtDist(this._viewDirectionDistance(t))}computeRenderPixelSizeAtDist(t){return t*this.perRenderPixelRatio}computeScreenPixelSizeAt(t){return this.computeScreenPixelSizeAtDist(this._viewDirectionDistance(t))}_viewDirectionDistance(t){return Math.abs(B(this.viewForward,f(st,t,this.eye)))}computeScreenPixelSizeAtDist(t){return t*this.perScreenPixelRatio}computeDistanceFromRadius(t,i){return t/Math.tan(Math.min(this.fovX,this.fovY)/(2*(i||1)))}getScreenCenter(t=s()){return t[0]=(this.padding[3]+this.width/2)/this.pixelRatio,t[1]=(this.padding[0]+this.height/2)/this.pixelRatio,t}getRenderCenter(t,i=.5,e=.5){return t[0]=this.padding[3]+this.width*i,t[1]=this.padding[2]+this.height*e,t[2]=.5,t}setGLViewport(t){const i=this.viewport,e=this.padding;t.setViewport(i[0]-e[3],i[1]-e[2],i[2]+e[1]+e[3],i[3]+e[0]+e[2])}applyProjection(t,i){t!==et&&D(et,t),et[3]=1,W(et,et,this.projectionMatrix);const e=Math.abs(et[3]);C(et,et,1/e);const s=this.fullViewport;i[0]=r(0,s[0]+s[2],.5+.5*et[0]),i[1]=r(0,s[1]+s[3],.5+.5*et[1]),i[2]=.5*(et[2]+1),i[3]=e}unapplyProjection(t,i){const e=this.fullViewport;et[0]=(t[0]/(e[0]+e[2])*2-1)*t[3],et[1]=(t[1]/(e[1]+e[3])*2-1)*t[3],et[2]=(2*t[2]-1)*t[3],et[3]=t[3],null!=this.inverseProjectionMatrix&&(W(et,et,this.inverseProjectionMatrix),i[0]=et[0],i[1]=et[1],i[2]=et[2])}projectToScreen(t,i){return null==this.projectToRenderScreen(t,nt)?null:(this.renderToScreen(nt,i),i)}projectToRenderScreen(t,i){if(et[0]=t[0],et[1]=t[1],et[2]=t[2],et[3]=1,W(et,et,this.viewProjectionMatrix),0===et[3])return null;const e=et;C(e,e,1/Math.abs(et[3]));const s=this.fullViewport,o=r(0,s[0]+s[2],.5+.5*e[0]),n=r(0,s[1]+s[3],.5+.5*e[1]);return"x"in i?(i.x=o,i.y=n):(i[0]=o,i[1]=n,i.length>2&&(i[2]=.5*(e[2]+1))),i}unprojectFromScreen(t,i){return this.unprojectFromRenderScreen(this.screenToRender(t,nt),i)}unprojectFromRenderScreen(t,i){if(u(rt,this.projectionMatrix,this.viewMatrix),!l(rt,rt))return null;const e=this.fullViewport;return et[0]=2*(t[0]-e[0])/e[2]-1,et[1]=2*(t[1]-e[1])/e[3]-1,et[2]=2*t[2]-1,et[3]=1,W(et,et,rt),0===et[3]?null:(i[0]=et[0]/et[3],i[1]=et[1]/et[3],i[2]=et[2]/et[3],i)}constrainWindowSize(t,i,e,r){const s=t*this.pixelRatio,o=i*this.pixelRatio,n=Math.max(s-e/2,0),h=Math.max(this.fullHeight-o-r/2,0),a=-Math.min(s-e/2,0),p=-Math.min(this.fullHeight-o-r/2,0),u=e-a- -Math.min(this.fullWidth-s-e/2,0),l=r-p- -Math.min(o-r/2,0);return[Math.round(n),Math.round(h),Math.round(u),Math.round(l)]}computeUp(t){1===t?this._computeUpGlobal():this._computeUpLocal()}screenToRender(t,i){const e=t[0]*this.pixelRatio,r=this.fullHeight-t[1]*this.pixelRatio;return i[0]=e,i[1]=r,i}renderToScreen(t,i){const e=t[0]/this.pixelRatio,r=(this.fullHeight-t[1])/this.pixelRatio;i[0]=e,i[1]=r}sphereFrustumCoverage(t,i){const{center:e,eye:r,distance:s,fovY:o}=this,n=Math.abs(Math.PI/2-J(i,e,r));return t.frustumCoverage(n,s,o)}_computeUpGlobal(){f(st,this.center,this.eye);const t=b(this.center);t<1?j(this._up,A)&&(D(this._up,A),this._markViewDirty(),this.notifyChange("_up")):Math.abs(V(st,this.center))>.9999*b(st)*t||(S(ot,st,this.center),S(ot,ot,st),T(ot,ot),j(this._up,ot)||(D(this._up,ot),this.notifyChange("_up"),this._markViewDirty()))}_computeUpLocal(){I(st,this.eye,this.center),Math.abs(st[2])<=.9999&&(C(st,st,st[2]),x(st,-st[0],-st[1],1-st[2]),T(st,st),j(this._up,st)||(D(this._up,st),this.notifyChange("_up"),this._markViewDirty()))}_compareAndSetView(t,i,r){"number"==typeof t[0]&&isFinite(t[0])&&"number"==typeof t[1]&&isFinite(t[1])&&"number"==typeof t[2]&&isFinite(t[2])?j(t,i)||(D(i,t),this._markViewDirty(),this.notifyChange(r)):e.getLogger("esri.views.3d.webgl-engine.lib.RenderCamera").warn("RenderCamera vector contains invalid number, ignoring value")}_markViewDirty(){this._viewDirty=!0,this._frustumDirty=!0,this._viewProjectionDirty=!0}_recomputeFrustum(){this._frustumDirty&&(G(this.viewMatrix,this.projectionMatrix,this._frustum),this._frustumDirty=!1)}_ensureViewClean(){this._viewDirty&&(w(this._viewMatrix,this.eye,this.center,this.up),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0)}};t([n()],it.prototype,"_viewport",void 0),t([n()],it.prototype,"_padding",void 0),t([n()],it.prototype,"_fov",void 0),t([n()],it.prototype,"_nearFar",void 0),t([n()],it.prototype,"_viewDirty",void 0),t([n()],it.prototype,"_viewMatrix",void 0),t([n()],it.prototype,"_pixelRatio",void 0),t([n()],it.prototype,"pixelRatio",null),t([n()],it.prototype,"row",void 0),t([n()],it.prototype,"column",void 0),t([n()],it.prototype,"_rows",void 0),t([n()],it.prototype,"rows",null),t([n()],it.prototype,"_columns",void 0),t([n()],it.prototype,"columns",null),t([n()],it.prototype,"eye",null),t([n()],it.prototype,"center",null),t([n()],it.prototype,"_center",void 0),t([n()],it.prototype,"up",null),t([n()],it.prototype,"_up",void 0),t([n()],it.prototype,"viewMatrix",null),t([n({readOnly:!0})],it.prototype,"inverseViewMatrix",null),t([n({readOnly:!0})],it.prototype,"viewForward",null),t([n({readOnly:!0})],it.prototype,"viewUp",null),t([n({readOnly:!0})],it.prototype,"viewRight",null),t([n({readOnly:!0})],it.prototype,"nearFar",null),t([n()],it.prototype,"near",null),t([n()],it.prototype,"far",null),t([n()],it.prototype,"viewport",null),t([n({readOnly:!0})],it.prototype,"screenViewport",null),t([n({readOnly:!0})],it.prototype,"screenPadding",null),t([n()],it.prototype,"x",null),t([n()],it.prototype,"y",null),t([n()],it.prototype,"width",null),t([n()],it.prototype,"height",null),t([n()],it.prototype,"fullWidth",null),t([n()],it.prototype,"fullHeight",null),t([n({readOnly:!0})],it.prototype,"_aspect",null),t([n()],it.prototype,"padding",null),t([n({readOnly:!0})],it.prototype,"projectionMatrix",null),t([n({readOnly:!0})],it.prototype,"inverseProjectionMatrix",null),t([n()],it.prototype,"fov",null),t([n()],it.prototype,"fovX",null),t([n()],it.prototype,"fovY",null),t([n()],it.prototype,"viewInverseTransposeMatrix",null),t([n({readOnly:!0})],it.prototype,"_projectionMatrixInternal",null),t([n()],it.prototype,"relativeElevation",void 0),it=tt=t([h("esri.views.3d.webgl.RenderCamera")],it);const et=k(),rt=y(),st=E(),ot=E(),nt=o();export{it as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import r from"../../../core/Accessor.js";import t from"../../../core/Error.js";import{watch as i,initial as s}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{RenderNodeOutput as d}from"../webgl.js";import{getFramebufferDrawBuffers as a}from"../../webgl/RenderingContext.js";let u=class extends r{constructor(e){super(e),this.view=null,this.consumes={required:[]},this.produces=d.COMPOSITE,this._dirty=!0}initialize(){this.addHandles([i(()=>this.view.ready,e=>{e&&this.view.stage?.renderer.addRenderNode(this)},s)])}destroy(){this.view.stage?.renderer?.removeRenderNode(this)}precompile(){}render(){throw new t("RenderNode:render-function-not-implemented","render() is not implemented.")}get camera(){return this.view.state.camera.clone()}get sunLight(){return this.bindParameters.lighting.legacy}get gl(){return this.view.stage.renderView.renderingContext.gl}get techniques(){return this.view.stage.renderView.techniques}acquireOutputFramebuffer(){const e=this._frameBuffer?.getTexture()?.descriptor,r=this.view.stage.renderer.fboCache.acquire(e?.width??640,e?.height??480,this.produces);return this._bind(r),r}bindRenderTarget(){return this._bind(this._frameBuffer),this._frameBuffer}_bind({fbo:e}){e.initializeAndBind(),this.gl.drawBuffers(a(e))}requestRender(e){switch(e){case 2:this.view.state.fading=!0;case 1:this.view.stage?.renderView.requestRender(e);case 0:case void 0:this._dirty=!0}}resetWebGLState(){this.renderingContext.resetState(),this.renderingContext.bindFramebuffer(this._frameBuffer?.fbo)}get fboCache(){return this.view.stage.renderer.fboCache}get bindParameters(){return this.renderContext.bind}get renderingContext(){return this.view.stage.renderView.renderingContext}get renderContext(){return this.view.stage?.renderer.renderContext}updateAnimation(e){return!!this._dirty&&(this._dirty=!1,!0)}doRender(e){this._frameBuffer=e.find(({name:e})=>e===this.produces);try{return this.render(e)}finally{this._frameBuffer=null}}get requireGeometryDepth(){return!1}queryDepthRange(e){return null}get input(){return this._frameBuffer}};e([n({constructOnly:!0})],u.prototype,"view",void 0),e([n({constructOnly:!0})],u.prototype,"consumes",void 0),e([n()],u.prototype,"produces",void 0),e([n({readOnly:!0})],u.prototype,"techniques",null),u=e([o("esri.views.3d.webgl.RenderNode")],u);const h=u;export{h as default};
2
+ import{__decorate as e}from"tslib";import r from"../../../core/Accessor.js";import t from"../../../core/Error.js";import{watch as i,initial as s}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{RenderNodeOutput as d}from"../webgl.js";import{getFramebufferDrawBuffers as a}from"../../webgl/RenderingContext.js";let u=class extends r{constructor(e){super(e),this.view=null,this.consumes={required:[]},this.produces=d.COMPOSITE,this._dirty=!0}initialize(){this.addHandles([i(()=>this.view.ready,e=>{e&&this.view.stage?.renderer.addRenderNode(this)},s)])}destroy(){this.view.stage?.renderer?.removeRenderNode(this)}precompile(){}render(){throw new t("RenderNode:render-function-not-implemented","render() is not implemented.")}get camera(){return this.view.state.camera.clone()}get sunLight(){return this.bindParameters.lighting.legacy}get gl(){return this.view.stage.renderView.renderingContext.gl}get techniques(){return this.view.stage.renderView.techniques}acquireOutputFramebuffer(){const e=this._frameBuffer?.getTexture()?.descriptor,r=this.view.stage.renderer.fboCache.acquire(e?.width??640,e?.height??480,this.produces);return this._bind(r),r}bindRenderTarget(){return this._bind(this._frameBuffer),this._frameBuffer}_bind({fbo:e}){e.initializeAndBind(),this.gl.drawBuffers(a(e))}requestRender(e){switch(e){case 2:this.view.state.fading=!0;case 1:this.view.stage?.renderView.requestRender(e);case 0:case void 0:this._dirty=!0}}resetWebGLState(){this.renderingContext.resetState(),this.renderingContext.bindFramebuffer(this._frameBuffer?.fbo)}get fboCache(){return this.view.stage.renderer.fboCache}get bindParameters(){return this.renderContext.bind}get renderingContext(){return this.view.stage.renderView.renderingContext}get renderContext(){return this.view.stage?.renderer.renderContext}updateAnimation(e){return!!this._dirty&&(this._dirty=!1,!0)}doRender(e){this._frameBuffer=e.find(({name:e})=>e===this.produces);try{return this.render(e)}finally{this._frameBuffer=null}}get requireGeometryDepth(){return!1}queryDepthRange(e){return null}get input(){return this._frameBuffer}};e([n({constructOnly:!0})],u.prototype,"view",void 0),e([n({constructOnly:!0})],u.prototype,"consumes",void 0),e([n()],u.prototype,"produces",void 0),e([n({readOnly:!0})],u.prototype,"techniques",null),u=e([o("esri.views.3d.webgl.RenderNode")],u);export{u as default};
@@ -1,8 +1,8 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{generateUID as e}from"../../../../../core/uid.js";import{TextureBufferNaNSupportConfiguration as t,unpackFloat1x32 as r,unpackHalf as n,unpackInt1x16 as a,glslType as s,glslDecodeField as i}from"./TextureBackedBufferFields.glsl.js";import{glsl as d}from"../shaderModules/glsl.js";import{assert as o}from"../../lib/Util.js";import{Code as u}from"../../../../webgl/ShaderBuilder.js";const c=new t(!0),h=new t(!1);class l{constructor(e,t){this._shader=e,this._namespace=t,this._used=new Map}getItemSuffix(e){if(0===e)return"";return`${e<0?"Minus":"Plus"}${Math.abs(e)}`}getItemDataName(e=0){return`${this._namespace}ItemData${this.getItemSuffix(e)}`}getStructName(e=0){return`${this._namespace}TextureBackedBufferItemData${this.getItemSuffix(e)}`}getFetchName(e=0){return`${this._namespace}fetchTextureBackedBufferItemData${this.getItemSuffix(e)}`}getStrideName(){return`${this._namespace}tbbStride`}getTextureAttribute(e,t=0){const r=this._used,n=this.getItemDataName(t);let a=r.get(t);return null==a&&(a=new Set,r.set(t,a)),a.add(e),d`${n}.${e}`}generateVertexCode(e){const{_shader:t,_used:r}=this,n=new u(t.vertex);for(const a of r.keys())this._generateFetchFunction(a,n,e);return n.generateSource()}generateVertexMainCode(e){const{_shader:t,_used:r}=this,n=new u(t.vertex);for(const a of r.keys())this._generateFetchFunctionCall(a,n,e);return n.generateSource()}_generateFetchFunctionCall(e,t,r){const{itemIndexExpression:n}=r,a=this._used.get(e);if(null==a||0===a.size)return;const s=this.getItemDataName(e),i=this.getFetchName(e);t.add(d`${s} = ${i}(${n});`)}_getIndexOffset(e=0){if(0===e)return d``;return d`${e<0?"-":"+"}${d.uint(Math.abs(e))}`}_generateFetchFunction(e,t,r){const{bufferUniform:n,layout:a}=r,{texelFormatInfo:o}=a,u=this._used.get(e);if(null==u||0===u.size)return;const c=this.getStrideName(),h=this.getStructName(e),l=this.getItemDataName(e),m=this.getFetchName(e),x=this._getIndexOffset(e),$=new Array;for(const s of a.fields.values())u.has(s.name)&&$.push(s);if(0===$.length)return;const _=[];for(let s=0;s<a.texelStride;++s)_.push(!1);for(const s of $)for(let e=0;e<s.numTexels;++e)_[s.startTexel+e]=!0;t.add(d`
2
+ import{generateUID as e}from"../../../../../core/uid.js";import{unpackFloat1x32 as t,TextureBufferNaNSupportConfiguration as r,unpackHalf as n,unpackInt1x16 as a,glslType as s,glslDecodeField as i}from"./TextureBackedBufferFields.glsl.js";import{glsl as d}from"../shaderModules/glsl.js";import{assert as o}from"../../lib/Util.js";import{Code as u}from"../../../../webgl/ShaderBuilder.js";const c=new r(!0),h=new r(!1);class l{constructor(e,t){this._shader=e,this._namespace=t,this._used=new Map}getItemSuffix(e){if(0===e)return"";return`${e<0?"Minus":"Plus"}${Math.abs(e)}`}getItemDataName(e=0){return`${this._namespace}ItemData${this.getItemSuffix(e)}`}getStructName(e=0){return`${this._namespace}TextureBackedBufferItemData${this.getItemSuffix(e)}`}getFetchName(e=0){return`${this._namespace}fetchTextureBackedBufferItemData${this.getItemSuffix(e)}`}getStrideName(){return`${this._namespace}tbbStride`}getTextureAttribute(e,t=0){const r=this._used,n=this.getItemDataName(t);let a=r.get(t);return null==a&&(a=new Set,r.set(t,a)),a.add(e),d`${n}.${e}`}generateVertexCode(e){const{_shader:t,_used:r}=this,n=new u(t.vertex);for(const a of r.keys())this._generateFetchFunction(a,n,e);return n.generateSource()}generateVertexMainCode(e){const{_shader:t,_used:r}=this,n=new u(t.vertex);for(const a of r.keys())this._generateFetchFunctionCall(a,n,e);return n.generateSource()}_generateFetchFunctionCall(e,t,r){const{itemIndexExpression:n}=r,a=this._used.get(e);if(null==a||0===a.size)return;const s=this.getItemDataName(e),i=this.getFetchName(e);t.add(d`${s} = ${i}(${n});`)}_getIndexOffset(e=0){if(0===e)return d``;return d`${e<0?"-":"+"}${d.uint(Math.abs(e))}`}_generateFetchFunction(e,t,r){const{bufferUniform:n,layout:a}=r,{texelFormatInfo:o}=a,u=this._used.get(e);if(null==u||0===u.size)return;const c=this.getStrideName(),h=this.getStructName(e),l=this.getItemDataName(e),m=this.getFetchName(e),x=this._getIndexOffset(e),$=new Array;for(const s of a.fields.values())u.has(s.name)&&$.push(s);if(0===$.length)return;const _=[];for(let s=0;s<a.texelStride;++s)_.push(!1);for(const s of $)for(let e=0;e<s.numTexels;++e)_[s.startTexel+e]=!0;t.add(d`
3
3
  struct ${h} {`);for(const i of $)t.add(d`\t${s(i)} ${i.name};`);t.add(d`};`),t.add(d`\n${h} ${m}( highp uint baseIndex ) {
4
4
  ${h} itemData;
5
5
  highp uint index = (baseIndex${x}) * ${c};
6
6
  highp uint rowWidth = uint(textureSize(${n.name}, 0).x);
7
7
  int coordX = int(index % rowWidth);
8
- int coordY = int(index / rowWidth);\n`);const p=f[o.channels],I=g[o.channels];for(let s=0;s<_.length;++s)!1!==_[s]&&t.add(d`highp ${p} texel${d.int(s)} = texelFetch(${n.name}, ivec2(coordX + ${d.int(s)}, coordY), 0)${I};`);for(const s of $)t.add(d`itemData.${s.name} = ${i(s,o)};`);t.add(d`return itemData;\n}`),t.add(d`${h} ${l};`)}}class m{constructor(t){this._parameters=t,this.moduleId=e(),this.namespace=`_tbb_${this.moduleId}_`}createBuilder(e,t){let r=null;const n=e=>{r=this._buildTextureBackedBufferShaderCode(e)};return t?e.include(n,t):e.include(n),o(null!=r,"Valid builder expected."),r}_buildTextureBackedBufferShaderCode(e){const{namespace:t,_parameters:s}=this,{bufferUniform:i,layout:d}=s,u=s.enableNaNSupport?c:h,{vertex:m}=e,f=new l(e,t);m.include(r,u),m.include(n,u),m.include(a);const g=f.getStrideName(),x=f.getStructName(),$=f.getFetchName(),_=f.getItemDataName();for(const r of[g,x,$,_])o(r.length<1024,"Identifiers do not have a valid length");return m.constants.add(g,"uint",d.texelStride),m.uniforms.add(i),m.code.add(()=>f.generateVertexCode(s)),m.main.add(()=>f.generateVertexMainCode(s)),f}}const f={1:d`uint`,2:d`uvec2`,4:d`uvec4`},g={1:d`.x`,2:d`.xy`,4:""};export{m as TextureBackedBufferModule};
8
+ int coordY = int(index / rowWidth);\n`);const p=f[o.channels],I=g[o.channels];for(let s=0;s<_.length;++s)!1!==_[s]&&t.add(d`highp ${p} texel${d.int(s)} = texelFetch(${n.name}, ivec2(coordX + ${d.int(s)}, coordY), 0)${I};`);for(const s of $)t.add(d`itemData.${s.name} = ${i(s,o)};`);t.add(d`return itemData;\n}`),t.add(d`${h} ${l};`)}}class m{constructor(t){this._parameters=t,this.moduleId=e(),this.namespace=`_tbb_${this.moduleId}_`}createBuilder(e,t){let r=null;const n=e=>{r=this._buildTextureBackedBufferShaderCode(e)};return t?e.include(n,t):e.include(n),o(null!=r,"Valid builder expected."),r}_buildTextureBackedBufferShaderCode(e){const{namespace:r,_parameters:s}=this,{bufferUniform:i,layout:d}=s,u=s.enableNaNSupport?c:h,{vertex:m}=e,f=new l(e,r);m.include(t,u),m.include(n,u),m.include(a);const g=f.getStrideName(),x=f.getStructName(),$=f.getFetchName(),_=f.getItemDataName();for(const t of[g,x,$,_])o(t.length<1024,"Identifiers do not have a valid length");return m.constants.add(g,"uint",d.texelStride),m.uniforms.add(i),m.code.add(()=>f.generateVertexCode(s)),m.main.add(()=>f.generateVertexMainCode(s)),f}}const f={1:d`uint`,2:d`uvec2`,4:d`uvec4`},g={1:d`.x`,2:d`.xy`,4:""};export{m as TextureBackedBufferModule};
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{maxUint8 as n}from"../../../../../core/typedArrayUtil.js";import{hasNativeFloat16Array as e}from"../../../../../geometry/support/float16.js";import{FloatBindUniform as o}from"../shaderModules/FloatBindUniform.js";import{glsl as u,If as i}from"../shaderModules/glsl.js";import{parameter as a,ShaderTechniqueConfiguration as r}from"../shaderTechnique/ShaderTechniqueConfiguration.js";function s(t){switch(t.elementType){case"float":switch(t.elementCount){case 1:return u`float`;case 2:return u`vec2`;case 3:return u`vec3`;case 4:return u`vec4`;case 9:return u`mat3`;default:t.elementCount}break;case"int":switch(t.elementCount){case 1:return u`int`;case 2:return u`ivec2`;case 3:return u`ivec3`;case 4:return u`ivec4`;case 9:throw new Error("Invalid element count 9 for type int");default:t.elementCount}break;case"uint":switch(t.elementCount){case 1:return u`uint`;case 2:return u`uvec2`;case 3:return u`uvec3`;case 4:return u`uvec4`;case 9:throw new Error("Invalid element count 9 for type uint");default:t.elementCount}break;default:t.elementType}throw new Error("unsupported field")}const c=new o("constNaN",()=>NaN,{supportsNaN:!0});class p extends r{constructor(t){super(),this.supportNaN=t}}function f(t,n){const e=n?.supportNaN;e&&(t.uniforms.add(c),t.code.add(u`bool bitsEncodeFloat16NaN(highp uint bits) {
2
+ import{__decorate as t}from"tslib";import{maxUint8 as n}from"../../../../../core/typedArrayUtil.js";import{hasNativeFloat16Array as e}from"../../../../../geometry/support/float16.js";import{FloatBindUniform as o}from"../shaderModules/FloatBindUniform.js";import{glsl as u,If as i}from"../shaderModules/glsl.js";import{ShaderTechniqueConfiguration as a,parameter as r}from"../shaderTechnique/ShaderTechniqueConfiguration.js";function s(t){switch(t.elementType){case"float":switch(t.elementCount){case 1:return u`float`;case 2:return u`vec2`;case 3:return u`vec3`;case 4:return u`vec4`;case 9:return u`mat3`;default:t.elementCount}break;case"int":switch(t.elementCount){case 1:return u`int`;case 2:return u`ivec2`;case 3:return u`ivec3`;case 4:return u`ivec4`;case 9:throw new Error("Invalid element count 9 for type int");default:t.elementCount}break;case"uint":switch(t.elementCount){case 1:return u`uint`;case 2:return u`uvec2`;case 3:return u`uvec3`;case 4:return u`uvec4`;case 9:throw new Error("Invalid element count 9 for type uint");default:t.elementCount}break;default:t.elementType}throw new Error("unsupported field")}const c=new o("constNaN",()=>NaN,{supportsNaN:!0});class p extends a{constructor(t){super(),this.supportNaN=t}}function f(t,n){const e=n?.supportNaN;e&&(t.uniforms.add(c),t.code.add(u`bool bitsEncodeFloat16NaN(highp uint bits) {
3
3
  const highp uint nanExponent = 0x00007c00u;
4
4
  highp uint exponent = bits & nanExponent;
5
5
  highp uint mantissa = bits & 0x000003ffu;
@@ -38,4 +38,4 @@ return exponent == nanExponent && mantissa != 0u;
38
38
  }`)}function d(t){t.code.add(u`mediump int unpackInt1x16(highp uint bits) {
39
39
  highp uint signExtendedBits = (bits & 0x8000u) != 0u ? (bits | 0xffff0000u) : bits;
40
40
  return int(signExtendedBits);
41
- }`)}function h(t,n){const{fieldType:e}=t;return`${(0,g[e])(y(t,n))}`}function m(t,n){const e=[];for(const o of t){const t=u`unpackFloat1x32(${o})`;e.push(t)}return e.join(n)}t([a()],p.prototype,"supportNaN",void 0);const $=t=>u`${t[0]}`,x=t=>{const n=t[0],e=u`uvec4(${u.uint(k[0])}, ${u.uint(k[1])}, ${u.uint(k[2])}, ${u.uint(k[3])})`,o=u`uvec4(${u.hexuint(w[1])})`;return u`((uvec4(${n}) >> ${e}) & ${o})`},N=t=>u`(float(${$(t)})/${u.float(n)})`,b=t=>u`unpackFloat1x32(${t[0]})`,v=t=>u`vec4(${m(t,", ")})`,g={u8:$,u32:t=>u`${t[0]}`,vec4u32:t=>u`uvec4(${t.join(", ")})`,unorm8:N,vec4unorm8:t=>u`(vec4(${x(t)})/${u.float(n)})`,snorm16:t=>u`unpackSnorm2x16(${t[0]}).x`,vec2snorm16:t=>u`unpackSnorm2x16(${t[0]})`,f16:e?t=>u`unpackHalf1x16(${t[0]})`:b,vec4f16:e?t=>u`vec4(unpackHalf2x16NaNSupport(${t[0]}), unpackHalf2x16NaNSupport(${t[1]}))`:v,f32:b,vec4u8:x,vec2f32:t=>u`vec2(${m(t,", ")})`,vec3f32:t=>u`vec3(${m(t,", ")})`,vec4f32:v,mat3f32:t=>u`mat3(${m(t,",\n")})`};function y(t,n){const{byteOffset:e,byteSize:o}=t,i=n.channelByteStride,a=n.byteStride,r=Math.ceil(o/E),s=F[n.channels],c=new Array;for(let p=0;p<r;++p){const t=p*E,n=e+t,r=o-t,f=Math.min(r,E);let l=0;const d=new Array;for(;l<f;){const t=n+l,e=Math.floor(t/a),o=t%a,r=Math.floor(o/i),c=o%i,p=i-c,h=f-l,m=Math.min(p,h),$=u`texel${u.int(e)}${s[r]}`,x=4===m?"":u` & ${u.hexuint(w[m])}`,N=0===c?"":u` >> ${u.uint(k[c])}`,b=u`((${$}${N})${x})`,v=0===l?"":u` << ${u.uint(k[l])}`,g=u`(${b})${v}`;d.push(g),l+=m}c.push(u`(${d.join(" | ")})`)}return c}const E=4,k=[0,8,16,24],w=[0,255,65535,16777215,4294967295],F={1:[u``],2:[u`.x`,u`.y`],4:[u`.x`,u`.y`,u`.z`,u`.w`]};export{p as TextureBufferNaNSupportConfiguration,h as glslDecodeField,s as glslType,l as unpackFloat1x32,f as unpackHalf,d as unpackInt1x16};
41
+ }`)}function h(t,n){const{fieldType:e}=t;return`${(0,g[e])(y(t,n))}`}function m(t,n){const e=[];for(const o of t){const t=u`unpackFloat1x32(${o})`;e.push(t)}return e.join(n)}t([r()],p.prototype,"supportNaN",void 0);const $=t=>u`${t[0]}`,x=t=>{const n=t[0],e=u`uvec4(${u.uint(k[0])}, ${u.uint(k[1])}, ${u.uint(k[2])}, ${u.uint(k[3])})`,o=u`uvec4(${u.hexuint(w[1])})`;return u`((uvec4(${n}) >> ${e}) & ${o})`},N=t=>u`(float(${$(t)})/${u.float(n)})`,b=t=>u`unpackFloat1x32(${t[0]})`,v=t=>u`vec4(${m(t,", ")})`,g={u8:$,u32:t=>u`${t[0]}`,vec4u32:t=>u`uvec4(${t.join(", ")})`,unorm8:N,vec4unorm8:t=>u`(vec4(${x(t)})/${u.float(n)})`,snorm16:t=>u`unpackSnorm2x16(${t[0]}).x`,vec2snorm16:t=>u`unpackSnorm2x16(${t[0]})`,f16:e?t=>u`unpackHalf1x16(${t[0]})`:b,vec4f16:e?t=>u`vec4(unpackHalf2x16NaNSupport(${t[0]}), unpackHalf2x16NaNSupport(${t[1]}))`:v,f32:b,vec4u8:x,vec2f32:t=>u`vec2(${m(t,", ")})`,vec3f32:t=>u`vec3(${m(t,", ")})`,vec4f32:v,mat3f32:t=>u`mat3(${m(t,",\n")})`};function y(t,n){const{byteOffset:e,byteSize:o}=t,i=n.channelByteStride,a=n.byteStride,r=Math.ceil(o/E),s=F[n.channels],c=new Array;for(let p=0;p<r;++p){const t=p*E,n=e+t,r=o-t,f=Math.min(r,E);let l=0;const d=new Array;for(;l<f;){const t=n+l,e=Math.floor(t/a),o=t%a,r=Math.floor(o/i),c=o%i,p=i-c,h=f-l,m=Math.min(p,h),$=u`texel${u.int(e)}${s[r]}`,x=4===m?"":u` & ${u.hexuint(w[m])}`,N=0===c?"":u` >> ${u.uint(k[c])}`,b=u`((${$}${N})${x})`,v=0===l?"":u` << ${u.uint(k[l])}`,g=u`(${b})${v}`;d.push(g),l+=m}c.push(u`(${d.join(" | ")})`)}return c}const E=4,k=[0,8,16,24],w=[0,255,65535,16777215,4294967295],F={1:[u``],2:[u`.x`,u`.y`],4:[u`.x`,u`.y`,u`.z`,u`.w`]};export{p as TextureBufferNaNSupportConfiguration,h as glslDecodeField,s as glslType,l as unpackFloat1x32,f as unpackHalf,d as unpackInt1x16};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{assert as t}from"./Util.js";function n(n,o){const{data:e,indices:i,size:s,stride:u}=n;return t(3===s||4===s,"Position attribute must have 3 or 4 components"),null!=o?(t,n)=>{const r=i[o[n]]*u;return t[0]=e[r],t[1]=e[r+1],t[2]=e[r+2],t}:r(e,i,u)}function r(t,n,r){return(o,e)=>{const i=n[e]*r;return o[0]=t[i],o[1]=t[i+1],o[2]=t[i+2],o}}export{n as createPositionAttributeReader,r as createPositionReader};
2
+ import{drapedZ as t}from"../../terrain/DrapedZ.js";import{assert as r}from"./Util.js";function n(n,e){const{data:i,indices:s,size:u,stride:c}=n;return r(2===u||3===u||4===u,"Position attribute must have 2, 3 or 4 components"),2===u?null!=e?(r,n)=>{const o=s[e[n]]*c;return r[0]=i[o],r[1]=i[o+1],r[2]=t,r}:(r,n)=>{const o=s[n]*c;return r[0]=i[o],r[1]=i[o+1],r[2]=t,r}:null!=e?(t,r)=>{const n=s[e[r]]*c;return t[0]=i[n],t[1]=i[n+1],t[2]=i[n+2],t}:o(i,s,c)}function o(t,r,n){return(o,e)=>{const i=r[e]*n;return o[0]=t[i],o[1]=t[i+1],o[2]=t[i+2],o}}export{n as createPositionAttributeReader,o as createPositionReader};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{disposeMaybe as t}from"../../../../../core/maybe.js";import{Vec4Field as e,ScalarField as r}from"./TextureBackedBufferFields.js";import{getItemsRectangle as u}from"./TextureBackedBufferUtils.js";import{TextureBuffer as i}from"./TextureBuffer.js";class s{constructor(t,e){this._rctx=t,this._layout=e,this._nameToFieldMap=new Map,this._dirty=!0,this._textureData=e.createBuffer(0),this._setupFields(e)}get layout(){return this._layout}get usedMemory(){return this._textureData.usedMemory+(this._textureBuffer?.usedMemory??0)}get itemCount(){return this._textureData.count}dispose(){this._textureBuffer=t(this._textureBuffer),this._textureData=void 0}get test(){return{data:this._textureData}}getScalarField(t){const e=this._nameToFieldMap.get(t);return 1===e?.elementCount?e:null}getVec4Field(t){const e=this._nameToFieldMap.get(t);return 4===e?.elementCount?e:null}resizeToFit(t){const e=t+1;e>this._textureData.count&&this._resize(e)}updateTexture(){const e=this._textureBuffer,r=null==e||!e.texture.hasWebGLTextureObject;if(this._dirty||r){if(this._dirty=!1,0!==this._textureData.count)return r||e.itemCount<this._textureData.count?(this._textureBuffer=t(this._textureBuffer),void(this._textureBuffer=new i(this._rctx,this.layout,this._textureData.buffer))):void e.setSubData(this._textureData.buffer);this._textureBuffer=t(this._textureBuffer)}}get texture(){return this._textureBuffer?.texture}_resize(t){const{_layout:e}=this;if(0===t)return this._textureData=e.createBuffer(0),this._updateFields(),void(this._dirty=!0);const r=u(t).itemCount,i=e.createBuffer(r);i.texelElementBuffer.set(this._textureData.texelElementBuffer),this._textureData=i,this._updateFields(),this._dirty=!0}_setupFields(t){const u=this._textureData,i=()=>{this._dirty=!0},s=new Map;for(const[o,a]of t.fields){const t=u.getField(o,a.bufferViewConstructor);if(null==t)throw new Error(`Field ${o} does not exist in buffer`);s.set(o,4===t.elementCount?new e(t,a,i):new r(t,a,i))}this._nameToFieldMap=s}_updateFields(){const t=this._textureData;for(const[e,r]of this._nameToFieldMap){const u=t.getField(e,r.layoutField.bufferViewConstructor);if(null==u)throw new Error(`Field ${e} does not exist in buffer`);r.updateBufferView(u)}}}export{s as TextureBackedBuffer};
2
+ import{disposeMaybe as t}from"../../../../../core/maybe.js";import{Vec4Field as e,ScalarField as r}from"./TextureBackedBufferFields.js";import{getItemsRectangle as i}from"./TextureBackedBufferUtils.js";import{TextureBuffer as s}from"./TextureBuffer.js";class u{constructor(t,e){this._rctx=t,this._layout=e,this._nameToFieldMap=new Map,this._dirtyLow=1/0,this._dirtyHigh=-1/0,this._textureData=e.createBuffer(0),this._setupFields(e)}get layout(){return this._layout}get usedMemory(){return this._textureData.usedMemory+(this._textureBuffer?.usedMemory??0)}get itemCount(){return this._textureData.count}get _dirty(){return this._dirtyLow<=this._dirtyHigh}_setAllClean(){this._dirtyLow=1/0,this._dirtyHigh=-1/0}_setAllDirty(){this._dirtyLow=0,this._dirtyHigh=this._textureData.count-1}dispose(){this._textureBuffer=t(this._textureBuffer),this._textureData=void 0}get test(){return{data:this._textureData}}getScalarField(t){const e=this._nameToFieldMap.get(t);return 1===e?.elementCount?e:null}getVec4Field(t){const e=this._nameToFieldMap.get(t);return 4===e?.elementCount?e:null}resizeToFit(t){const e=t+1;e>this._textureData.count&&this._resize(e)}updateTexture(){const e=this._textureBuffer,r=null==e||!e.texture.hasWebGLTextureObject;if(!this._dirty&&!r)return;const i=this._dirtyLow,u=this._dirtyHigh-this._dirtyLow+1;if(this._setAllClean(),0===this._textureData.count)return void(this._textureBuffer=t(this._textureBuffer));if(r||e.itemCount<this._textureData.count)return this._textureBuffer=t(this._textureBuffer),void(this._textureBuffer=new s(this._rctx,this.layout,this._textureData.buffer));const o=i*this.layout.byteStride;e.setSubData(this._textureData.buffer,i,o,u)}get texture(){return this._textureBuffer?.texture}_resize(t){const{_layout:e}=this;if(0===t)return this._textureData=e.createBuffer(0),this._updateFields(),void this._setAllDirty();const r=i(t).itemCount,s=e.createBuffer(r);s.texelElementBuffer.set(this._textureData.texelElementBuffer),this._textureData=s,this._updateFields(),this._setAllDirty()}_setupFields(t){const i=this._textureData,s=t=>{this._dirtyLow=Math.min(this._dirtyLow,t),this._dirtyHigh=Math.max(this._dirtyHigh,t)},u=new Map;for(const[o,a]of t.fields){const t=i.getField(o,a.bufferViewConstructor);if(null==t)throw new Error(`Field ${o} does not exist in buffer`);u.set(o,4===t.elementCount?new e(t,a,s):new r(t,a,s))}this._nameToFieldMap=u}_updateFields(){const t=this._textureData;for(const[e,r]of this._nameToFieldMap){const i=t.getField(e,r.layoutField.bufferViewConstructor);if(null==i)throw new Error(`Field ${e} does not exist in buffer`);r.updateBufferView(i)}}}export{u as TextureBackedBuffer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- class e{constructor(e,t,s){this._bufferView=e,this.layoutField=t,this._makeDirty=s}get elementCount(){return this._bufferView.elementCount}updateBufferView(e){this._bufferView=e}}class t extends e{set(e,t){this._bufferView.set(e,t),this._makeDirty()}get(e){return this._bufferView.get(e)}}class s extends e{setArray(e,t){this._bufferView.set(e,0,t[0]),this._bufferView.set(e,1,t[1]),this._bufferView.set(e,2,t[2]),this._bufferView.set(e,3,t[3]),this._makeDirty()}setVec(e,t){this._bufferView.setVec(e,t),this._makeDirty()}setValues(e,t,s,i,r){this._bufferView.set(e,0,t),this._bufferView.set(e,1,s),this._bufferView.set(e,2,i),this._bufferView.set(e,3,r),this._makeDirty()}set(e,t,s){this._bufferView.set(e,t,s),this._makeDirty()}getVec(e,t){return this._bufferView.getVec(e,t)}get(e,t){return this._bufferView.get(e,t)}}export{e as Field,t as ScalarField,s as Vec4Field};
2
+ class e{constructor(e,t,s){this._bufferView=e,this.layoutField=t,this._makeDirty=s}get elementCount(){return this._bufferView.elementCount}updateBufferView(e){this._bufferView=e}}class t extends e{set(e,t){this._bufferView.set(e,t),this._makeDirty(e)}get(e){return this._bufferView.get(e)}}class s extends e{setArray(e,t){this._bufferView.set(e,0,t[0]),this._bufferView.set(e,1,t[1]),this._bufferView.set(e,2,t[2]),this._bufferView.set(e,3,t[3]),this._makeDirty(e)}setVec(e,t){this._bufferView.setVec(e,t),this._makeDirty(e)}setValues(e,t,s,i,r){this._bufferView.set(e,0,t),this._bufferView.set(e,1,s),this._bufferView.set(e,2,i),this._bufferView.set(e,3,r),this._makeDirty(e)}set(e,t,s){this._bufferView.set(e,t,s),this._makeDirty(e)}getVec(e,t){return this._bufferView.getVec(e,t)}get(e,t){return this._bufferView.get(e,t)}}export{e as Field,t as ScalarField,s as Vec4Field};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{createRenderScreenPointArray3 as t}from"../../../../core/screenUtils.js";import{copy as n,set as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as e,intersects as i,containsPoint as u,create as s,containsXY as f}from"../../../../geometry/support/aaBoundingRect.js";import{create as c,distance2 as p,fromPoints as m}from"../../../../geometry/support/lineSegment.js";import{signedDistance as a,intersectLineSegment as l}from"../../../../geometry/support/plane.js";import{containsPoint2dFromValues as h}from"../../../../geometry/support/triangle.js";function g(t,n){return t.isRectangle?u(t.bounds,n):v(n,t.points)}function M(t,n,r){const o=n[0]-r,u=n[1]-r,s=n[0]+r,f=n[1]+r;if(!i(t.bounds,e(o,u,s,f,F)))return!1;if(g(t,n))return!0;const c=r*r;for(const e of t.points){const t=e[0]-n[0],r=e[1]-n[1];if(t*t+r*r<=c)return!0}for(let e=0;e<t.points.length;e++){if(A(n,t.points[e],t.points[(e+1)%t.points.length])<=c)return!0}return!1}function j(t,n){if(!i(t.bounds,n))return!1;if(t.isRectangle)return!0;for(const r of t.points)if(u(n,r))return!0;if(U(n,t.points))return!0;for(let r=0;r<t.points.length;r++){if(k(t.points[r],r===t.points.length-1?t.points[0]:t.points[r+1],n))return!0}return!1}function x(t,n,r,o){const i=Math.min(n[0],r[0],o[0]),u=Math.min(n[1],r[1],o[1]),s=Math.max(n[0],r[0],o[0]),f=Math.max(n[1],r[1],o[1]);if(!j(t,e(i,u,s,f,F)))return!1;if(g(t,n)||g(t,r)||g(t,o))return!0;for(const e of t.points)if(h(n,r,o,e,N))return!0;for(let e=0;e<t.points.length;e++){const i=t.points[e],u=t.points[(e+1)%t.points.length];if(w(n,r,i,u)||w(r,o,i,u)||w(o,n,i,u))return!0}return!1}function d(t,n,r,o){const u=Math.min(n[0],r[0])-o,s=Math.min(n[1],r[1])-o,f=Math.max(n[0],r[0])+o,c=Math.max(n[1],r[1])+o;if(!i(t.bounds,e(u,s,f,c,F)))return!1;if(g(t,n)||g(t,r))return!0;const p=o*o;for(const e of t.points)if(A(e,n,r)<=p)return!0;for(let e=0;e<t.points.length;e++){const o=t.points[e],i=t.points[(e+1)%t.points.length];if(w(n,r,o,i)||z(n,r,o,i)<=p)return!0}return!1}function b(t,r,o,e,i){n(I,r),n(J,o);const u=t.projectToRenderScreen(I,G),s=t.projectToRenderScreen(J,H);if(null==u||null==s)return!1;const f=R(t,I),c=R(t,J);if(f&&c)return!1;if(f!==c){const n=f?I:J,r=f?u:s;if(!S(t,n,f?J:I))return!1;if(!t.projectToRenderScreen(n,r))return!1}return e[0]=u[0],e[1]=u[1],e[2]=0,i[0]=s[0],i[1]=s[1],i[2]=0,!0}function R(t,n){return y(t,n)>0}function y(t,n){return a(t.frustum[4],n)}function S(t,n,r){return T(t,n,r,n)}function T(t,n,r,o){return l(t.frustum[4],m(n,r,L),o)}function v(t,n){return B(t[0],t[1],n)}function B(t,n,r){let o=!1;for(let e=0,i=r.length-1;e<r.length;i=e++){const u=r[e],s=r[i];if(!(u[1]>n!=s[1]>n))continue;t<(s[0]-u[0])*(n-u[1])/(s[1]-u[1])+u[0]&&(o=!o)}return o}function U(t,n){const r=t[0],o=t[1],e=t[2],i=t[3];return B(r,o,n)||B(e,o,n)||B(e,i,n)||B(r,i,n)}function k(t,n,r){const o=r[0],e=r[1],i=r[2],u=r[3],s=t[0],c=t[1],p=n[0],m=n[1];return!(s<o&&p<o||s>i&&p>i||c<e&&m<e||c>u&&m>u)&&(!(!f(r,s,c)&&!f(r,p,m))||(q(t,n,o,e,i,e)||q(t,n,i,e,i,u)||q(t,n,i,u,o,u)||q(t,n,o,u,o,e)))}function q(t,n,r,o,e,i){const u=C(t[0],t[1],n[0],n[1],r,o),s=C(t[0],t[1],n[0],n[1],e,i),f=C(r,o,e,i,t[0],t[1]),c=C(r,o,e,i,n[0],n[1]);return u!==s&&f!==c||(0===u&&D(t,n,r,o)||0===s&&D(t,n,e,i)||0===f&&E(r,o,e,i,t[0],t[1])||0===c&&E(r,o,e,i,n[0],n[1]))}function w(t,n,r,o){return q(t,n,r[0],r[1],o[0],o[1])}function z(t,n,r,o){return w(t,n,r,o)?0:Math.min(A(t,r,o),A(n,r,o),A(r,t,n),A(o,t,n))}function A(t,n,o){return p(m(r(I,n[0],n[1],0),r(J,o[0],o[1],0),L),r(K,t[0],t[1],0))}function C(t,n,r,o,e,i){const u=(o-n)*(e-r)-(r-t)*(i-o);return Math.abs(u)<=N?0:Math.sign(u)}function D(t,n,r,o){return E(t[0],t[1],n[0],n[1],r,o)}function E(t,n,r,o,e,i){return e>=Math.min(t,r)-N&&e<=Math.max(t,r)+N&&i>=Math.min(n,o)-N&&i<=Math.max(n,o)+N}const F=s(),G=t(),H=t(),I=o(),J=o(),K=o(),L=c(),N=1e-9;export{R as isBehindNearPlane,b as projectWorldLineSegmentToRenderScreen,g as screenPolygonContainsPoint,j as screenPolygonIntersectsBounds,d as screenPolygonIntersectsBufferedSegment,M as screenPolygonIntersectsCircle,x as screenPolygonIntersectsTriangle};
2
+ import{createRenderScreenPointArray3 as t}from"../../../../core/screenUtils.js";import{copy as n,set as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as e,intersects as i,containsPoint as u,create as s,containsXY as f}from"../../../../geometry/support/aaBoundingRect.js";import{distance2 as c,fromPoints as p,create as m}from"../../../../geometry/support/lineSegment.js";import{signedDistance as a,intersectLineSegment as l}from"../../../../geometry/support/plane.js";import{containsPoint2dFromValues as h}from"../../../../geometry/support/triangle.js";function g(t,n){return t.isRectangle?u(t.bounds,n):v(n,t.points)}function M(t,n,r){const o=n[0]-r,u=n[1]-r,s=n[0]+r,f=n[1]+r;if(!i(t.bounds,e(o,u,s,f,F)))return!1;if(g(t,n))return!0;const c=r*r;for(const e of t.points){const t=e[0]-n[0],r=e[1]-n[1];if(t*t+r*r<=c)return!0}for(let e=0;e<t.points.length;e++){if(A(n,t.points[e],t.points[(e+1)%t.points.length])<=c)return!0}return!1}function j(t,n){if(!i(t.bounds,n))return!1;if(t.isRectangle)return!0;for(const r of t.points)if(u(n,r))return!0;if(U(n,t.points))return!0;for(let r=0;r<t.points.length;r++){if(k(t.points[r],r===t.points.length-1?t.points[0]:t.points[r+1],n))return!0}return!1}function x(t,n,r,o){const i=Math.min(n[0],r[0],o[0]),u=Math.min(n[1],r[1],o[1]),s=Math.max(n[0],r[0],o[0]),f=Math.max(n[1],r[1],o[1]);if(!j(t,e(i,u,s,f,F)))return!1;if(g(t,n)||g(t,r)||g(t,o))return!0;for(const e of t.points)if(h(n,r,o,e,N))return!0;for(let e=0;e<t.points.length;e++){const i=t.points[e],u=t.points[(e+1)%t.points.length];if(w(n,r,i,u)||w(r,o,i,u)||w(o,n,i,u))return!0}return!1}function d(t,n,r,o){const u=Math.min(n[0],r[0])-o,s=Math.min(n[1],r[1])-o,f=Math.max(n[0],r[0])+o,c=Math.max(n[1],r[1])+o;if(!i(t.bounds,e(u,s,f,c,F)))return!1;if(g(t,n)||g(t,r))return!0;const p=o*o;for(const e of t.points)if(A(e,n,r)<=p)return!0;for(let e=0;e<t.points.length;e++){const o=t.points[e],i=t.points[(e+1)%t.points.length];if(w(n,r,o,i)||z(n,r,o,i)<=p)return!0}return!1}function b(t,r,o,e,i){n(I,r),n(J,o);const u=t.projectToRenderScreen(I,G),s=t.projectToRenderScreen(J,H);if(null==u||null==s)return!1;const f=R(t,I),c=R(t,J);if(f&&c)return!1;if(f!==c){const n=f?I:J,r=f?u:s;if(!S(t,n,f?J:I))return!1;if(!t.projectToRenderScreen(n,r))return!1}return e[0]=u[0],e[1]=u[1],e[2]=0,i[0]=s[0],i[1]=s[1],i[2]=0,!0}function R(t,n){return y(t,n)>0}function y(t,n){return a(t.frustum[4],n)}function S(t,n,r){return T(t,n,r,n)}function T(t,n,r,o){return l(t.frustum[4],p(n,r,L),o)}function v(t,n){return B(t[0],t[1],n)}function B(t,n,r){let o=!1;for(let e=0,i=r.length-1;e<r.length;i=e++){const u=r[e],s=r[i];if(!(u[1]>n!=s[1]>n))continue;t<(s[0]-u[0])*(n-u[1])/(s[1]-u[1])+u[0]&&(o=!o)}return o}function U(t,n){const r=t[0],o=t[1],e=t[2],i=t[3];return B(r,o,n)||B(e,o,n)||B(e,i,n)||B(r,i,n)}function k(t,n,r){const o=r[0],e=r[1],i=r[2],u=r[3],s=t[0],c=t[1],p=n[0],m=n[1];return!(s<o&&p<o||s>i&&p>i||c<e&&m<e||c>u&&m>u)&&(!(!f(r,s,c)&&!f(r,p,m))||(q(t,n,o,e,i,e)||q(t,n,i,e,i,u)||q(t,n,i,u,o,u)||q(t,n,o,u,o,e)))}function q(t,n,r,o,e,i){const u=C(t[0],t[1],n[0],n[1],r,o),s=C(t[0],t[1],n[0],n[1],e,i),f=C(r,o,e,i,t[0],t[1]),c=C(r,o,e,i,n[0],n[1]);return u!==s&&f!==c||(0===u&&D(t,n,r,o)||0===s&&D(t,n,e,i)||0===f&&E(r,o,e,i,t[0],t[1])||0===c&&E(r,o,e,i,n[0],n[1]))}function w(t,n,r,o){return q(t,n,r[0],r[1],o[0],o[1])}function z(t,n,r,o){return w(t,n,r,o)?0:Math.min(A(t,r,o),A(n,r,o),A(r,t,n),A(o,t,n))}function A(t,n,o){return c(p(r(I,n[0],n[1],0),r(J,o[0],o[1],0),L),r(K,t[0],t[1],0))}function C(t,n,r,o,e,i){const u=(o-n)*(e-r)-(r-t)*(i-o);return Math.abs(u)<=N?0:Math.sign(u)}function D(t,n,r,o){return E(t[0],t[1],n[0],n[1],r,o)}function E(t,n,r,o,e,i){return e>=Math.min(t,r)-N&&e<=Math.max(t,r)+N&&i>=Math.min(n,o)-N&&i<=Math.max(n,o)+N}const F=s(),G=t(),H=t(),I=o(),J=o(),K=o(),L=m(),N=1e-9;export{R as isBehindNearPlane,b as projectWorldLineSegmentToRenderScreen,g as screenPolygonContainsPoint,j as screenPolygonIntersectsBounds,d as screenPolygonIntersectsBufferedSegment,M as screenPolygonIntersectsCircle,x as screenPolygonIntersectsTriangle};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{set as t,squaredDistance as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isColor as s}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{Material as n}from"../lib/Material.js";import{writePosition as a,writeBufferFloat as o}from"./internal/bufferWriterUtils.js";import{attributeDrivenInstanceLayout as u,instanceLayout as c,HeatmapDensityPassParameters as l,HeatmapDensityTechnique as f,baseLayout as p}from"../shaders/HeatmapDensityTechnique.js";import{HeatmapDensityTechniqueConfiguration as m}from"../shaders/HeatmapDensityTechniqueConfiguration.js";const h=2;class d extends l{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloats=!1}}class b extends n{constructor(t){super(t,d),this.visible=!0,this.produces=new Map([[18,t=>s(t)]]),this.intersectScreenPolygonDraped=void 0,this._configuration=new m}updateConfiguration(t){super.updateConfiguration(t),this._configuration.isAttributeDriven=this.parameters.isAttributeDriven,this._configuration.usesHalfFloat=this.parameters.usesHalfFloats}createGLMaterial(t){return new g(t)}intersectRay(){}intersectRayDraped(r,s,i,n,a){const o=r.attributes.get("position"),{parameters:u}=this,{searchRadius:c}=u,{screenToWorldRatio:l}=r,f=c*l+h*l,p=f*f,m=o.data.length/o.size;for(let h=0;h<m;h++){const r=h*o.size,s=t(y,o.data[r],o.data[r+1]);e(s,i)<p&&n(a.distance,a.renderDistance,a.normal,-1)}}intersectScreenPolygon(){return null}createBufferWriter(){return new v(this.parameters.isAttributeDriven?u:c)}}class g extends i{beginSlot(t){return this.getTechnique(f,t)}}class v{constructor(t){this.layout=t,this.baseInstanceLayout=p}elementCount(t){return t.get("position").indices.length}elementCountBaseInstance(){return 4}write(t,e,r,s,i){if(null==i)return;const{buffer:n,offset:u}=i;a(r.get("position"),t,n.position,u);const c="featureAttribute"in n?n.featureAttribute:null;c&&o(r.get("featureAttribute"),c,u)}writeBaseInstance(t,e){const r=e.uv0;r.setValues(0,-1,-1),r.setValues(1,-1,1),r.setValues(2,1,-1),r.setValues(3,1,1)}}const y=r();export{b as HeatmapDensityMaterial,d as Parameters};
2
+ import{set as t,squaredDistance as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isColor as s}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{Material as n}from"../lib/Material.js";import{writePosition2d as a,writeBufferFloat as o}from"./internal/bufferWriterUtils.js";import{attributeDrivenInstanceLayout as u,instanceLayout as c,HeatmapDensityPassParameters as l,HeatmapDensityTechnique as f,baseLayout as p}from"../shaders/HeatmapDensityTechnique.js";import{HeatmapDensityTechniqueConfiguration as m}from"../shaders/HeatmapDensityTechniqueConfiguration.js";const h=2;class d extends l{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloats=!1}}class b extends n{constructor(t){super(t,d),this.visible=!0,this.produces=new Map([[18,t=>s(t)]]),this.intersectScreenPolygonDraped=void 0,this._configuration=new m}updateConfiguration(t){super.updateConfiguration(t),this._configuration.isAttributeDriven=this.parameters.isAttributeDriven,this._configuration.usesHalfFloat=this.parameters.usesHalfFloats}createGLMaterial(t){return new g(t)}intersectRay(){}intersectRayDraped(r,s,i,n,a){const o=r.attributes.get("position"),{parameters:u}=this,{searchRadius:c}=u,{screenToWorldRatio:l}=r,f=c*l+h*l,p=f*f,m=o.data.length/o.size;for(let h=0;h<m;h++){const r=h*o.size,s=t(y,o.data[r],o.data[r+1]);e(s,i)<p&&n(a.distance,a.renderDistance,a.normal,-1)}}intersectScreenPolygon(){return null}createBufferWriter(){return new v(this.parameters.isAttributeDriven?u:c)}}class g extends i{beginSlot(t){return this.getTechnique(f,t)}}class v{constructor(t){this.layout=t,this.baseInstanceLayout=p}elementCount(t){return t.get("position").indices.length}elementCountBaseInstance(){return 4}write(t,e,r,s,i){if(null==i)return;const{buffer:n,offset:u}=i;a(r.get("position"),t,n.position,u);const c="featureAttribute"in n?n.featureAttribute:null;c&&o(r.get("featureAttribute"),c,u)}writeBaseInstance(t,e){const r=e.uv0;r.setValues(0,-1,-1),r.setValues(1,-1,1),r.setValues(2,1,-1),r.setValues(3,1,1)}}const y=r();export{b as HeatmapDensityMaterial,d as Parameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r,createScreenPointArray as i}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as s,Seconds as n}from"../../../../core/time.js";import{copy as o,set as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as c,subtract as p,dot as u,scale as m,add as h,copy as f,length as d,distance as g,lerp as _,transformMat4 as b,normalize as S}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as v}from"../../../../geometry/support/float16.js";import{create as w,fromPoints as E,distance2 as x,closestLineSegmentPoint as T,projectPoint as j,projectPointFraction as L}from"../../../../geometry/support/lineSegment.js";import{create as z,fromPoints as C,signedDistance as A,getNormal as M}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as R,BufferViewFloat as V,BufferViewVec4Unorm8 as F,BufferViewVec4f16 as O,BufferViewUint32 as B}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as U,isColor as I,isDepth as N,isColorHighlightOLIDOrDepth as W,is2DGeometryOutput as k}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as D}from"../effects/geometry/olidUtils.js";import Y from"../lib/GLMaterial.js";import{Material as J}from"../lib/Material.js";import{projectWorldLineSegmentToRenderScreen as q,screenPolygonIntersectsBufferedSegment as X}from"../lib/screenPolygonOverlapUtils.js";import{Hit as G,DrapedHit as H}from"../lib/screenPolygonTriangleIntersections.js";import{ScreenSizePerspectiveEvaluator as K}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as Q,assert as Z}from"../lib/Util.js";import{isImagePattern as $}from"./lineStippleUtils.js";import{VisualVariablePassParameters as ee}from"./VisualVariablePassParameters.js";import{writeOlidColor as te}from"./internal/bufferWriterUtils.js";import{r as re}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as ie,getTextureBufferLayout as se}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as ne}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as oe}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as ae}from"../../../../webscene/support/AlphaCutoff.js";class le extends J{constructor(e,t){super(e,pe),this.produces=new Map([[2,e=>U(e)||I(e)&&8===this.parameters.renderOccluded],[3,e=>N(e)],[10,e=>W(e)&&8===this.parameters.renderOccluded],[11,e=>W(e)&&8===this.parameters.renderOccluded],[4,e=>I(e)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[8,e=>I(e)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[18,e=>k(e)]]),this._configuration=new oe(t)}updateConfiguration(e){super.updateConfiguration(e);const t=18===e.slot,r=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==e.output,i=r&&t&&this.parameters.isImagePattern();this._configuration.draped=t,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=_e(this.parameters.join,r),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&ge(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.emissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!i,this._configuration.worldSizedImagePattern=i}get visible(){return this.parameters.color[3]>=ae||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>ae}get emissions(){return this.parameters.emissiveStrength>0?8!==this.parameters.renderOccluded?2:1:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectRayDraped({attributes:e,screenToWorldRatio:r},i,s,n,o){if(!i.options.selectionMode)return;const a=this._getLineSize(e,!0),l=s[0],c=s[1],p=fe(a,r);let u=Number.MAX_VALUE,m=0;for(const h of de(ye,ve,this.parameters,e)){const e=l-ye[0],r=c-ye[1],i=ve[0]-ye[0],s=ve[1]-ye[1],n=t((i*e+s*r)/(i*i+s*s),0,1),o=i*n-e,a=s*n-r,p=o*o+a*a;p<u&&(u=p,m=h)}u<p*p&&n(o.distance,o.renderDistance,o.normal,m)}intersectRay(t,r,i,s,n,a){const{options:l,camera:_,rayBegin:b,rayEnd:S}=i;if(!l.selectionMode||!t.visible||!_)return;if(!Q(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const P=t.attributes,y=P.get("position").data,v=this._getLineSize(P),w=Le;o(w,i.point);const j=v*_.pixelRatio,L=Je*_.pixelRatio,z=j/2+L;c(Ie[0],w[0]-z,w[1]+z,0),c(Ie[1],w[0]+z,w[1]+z,0),c(Ie[2],w[0]+z,w[1]-z,0),c(Ie[3],w[0]-z,w[1]-z,0);for(let e=0;e<4;e++)if(!_.unprojectFromRenderScreen(Ie[e],Ne[e]))return;C(_.eye,Ne[0],Ne[1],We),C(_.eye,Ne[1],Ne[2],ke),C(_.eye,Ne[2],Ne[3],De),C(_.eye,Ne[3],Ne[0],Ye);let R=Number.MAX_VALUE,V=0;for(const e of this._forEachTransformedLineSegment(Se,Pe,y,r,he(this.parameters,P))){if(A(We,Se)<0&&A(We,Pe)<0||A(ke,Se)<0&&A(ke,Pe)<0||A(De,Se)<0&&A(De,Pe)<0||A(Ye,Se)<0&&A(Ye,Pe)<0)continue;const t=_.projectToRenderScreen(Se,ze),r=_.projectToRenderScreen(Pe,Ce);if(null==t||null==r)continue;if(t[2]<0&&r[2]>0){p(Te,Se,Pe);const e=_.frustum,r=-A(e[4],Se)/u(Te,M(e[4]));if(m(Te,Te,r),h(Se,Se,Te),!_.projectToRenderScreen(Se,t))continue}else if(t[2]>0&&r[2]<0){p(Te,Pe,Se);const e=_.frustum,t=-A(e[4],Pe)/u(Te,M(e[4]));if(m(Te,Te,t),h(Pe,Pe,Te),!_.projectToRenderScreen(Pe,r))continue}else if(t[2]<0&&r[2]<0)continue;t[2]=0,r[2]=0;const i=E(t,r,Fe),s=x(i,w);if(!(s>=R)){if(this.parameters.screenSizePerspective){const e=this.computeScreenSizePerspectiveWidth(i,Se,Pe,w,_,v,L);if(s>=e*e)continue}R=s,f(Re,Se),f(Ve,Pe),V=e}}if(R<z*z){let e=Number.MAX_VALUE;if(T(E(Re,Ve,Fe),E(b,S,Oe),je)){p(je,je,b);const t=d(je);m(je,je,1/t),e=t/g(b,S)}a(e,e,je,V)}}intersectScreenPolygon(t,r,i,s){const{options:n,camera:o,screenPolygonPrimitiveProcessor:a}=i;if(!n.selectionMode||!t.visible)return null;if(!Q(r))return e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix"),null;const l=t.attributes,c=l.get("position").data,p=this._getLineSize(l),u=Je,m=u*o.pixelRatio,h=new G(4);for(const e of this._forEachTransformedLineSegment(Se,Pe,c,r,he(this.parameters,l)))for(const[t,r]of a.processLineSegment(qe,Se,Pe)){if(!q(o,t,r,ze,Ce))continue;const i=E(ze,Ce,Fe);let n=p/2+u;this.parameters.screenSizePerspective&&(_(Le,ze,Ce,.5),n=Math.max(n,this.computeScreenSizePerspectiveWidth(i,t,r,Le,o,p,m)/o.pixelRatio)),o.renderToScreen(ze,Ae),o.renderToScreen(Ce,Me),X(s,Ae,Me,n)&&(j(E(t,r,Oe),o.eye,we),h.updateIfCloserFromValues(g(o.eye,we),e,we,null))}return h}intersectScreenPolygonDraped({attributes:e,screenToWorldRatio:t},r,i,s){if(!i.options.selectionMode)return null;const n=fe(this._getLineSize(e,!0),t);for(const o of de(ye,ve,this.parameters,e,r))if(X(s,ye,ve,n))return new H(o);return null}createBufferWriter(){return new ue(ie(this.parameters),se(this.parameters),this.parameters)}createGLMaterial(e){return new ce(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:s(e.time)},!1),0!==e.dt)}computeScreenSizePerspectiveWidth(e,t,r,i,s,n,o){const a=L(e,i);_(we,t,r,a),b(Ee,we,s.viewMatrix);const l=d(Ee),c=this.computeCameraAbsCosAngle(we,s,this._configuration.spherical);be.update(c,l,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize);return be.apply(n)*s.pixelRatio/2+o}computeCameraAbsCosAngle(e,t,r){return r?S(je,e):c(je,0,0,1),p(xe,e,t.eye),S(xe,xe),Math.abs(u(je,xe))}_getLineSize(e,r=!1){let i=this.parameters.width;if(this.parameters.vvSize){const s=e.get("sizeFeatureAttribute").data[0];Number.isNaN(s)?r&&(i*=this.parameters.vvSize.fallback[0]):i*=t(this.parameters.vvSize.offset[0]+s*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else e.has("size")&&(i*=e.get("size").data[0]);return i}*_forEachTransformedLineSegment(e,t,r,i,s){const n=s?r.length-2:r.length-5;for(let o=0;o<n;o+=3){e[0]=r[o]+i[12],e[1]=r[o+1]+i[13],e[2]=r[o+2]+i[14];const s=(o+3)%r.length;t[0]=r[s]+i[12],t[1]=r[s+1]+i[13],t[2]=r[s+2]+i[14],yield o/3}}}class ce extends Y{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(ne,e)}}class pe extends ee{constructor(){super(...arguments),this._width=0,this.color=y,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=n(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=n(0),this.endTime=n(1/0),this.emissiveStrength=0}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return $(this.stipplePattern)&&null!=this.stippleTexture}}class ue{constructor(e,t,r){this.layout=e,this.textureBufferLayout=t,this._parameters=r,this.numJoinSubdivisions=_e(this._parameters.join,null!=this._parameters.stipplePattern)}_isClosed(e){return he(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCountTextureBuffer(e){return e.get("position").data.length/3+(this._isClosed(e)?3:2)}elementCount(e){const t=2,r=e.get("position").indices.length/2+1,i=this._isClosed(e);let s=i?2:2*t;return s+=((i?r:r-1)-(i?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,r,i,s,n,o){null!=o&&this._writeTextureBuffer(e,r,i,o),null!=s&&this._writeVertexBuffer(e,r,i,s,n)}_writeTextureBuffer(e,t,r,i){const s=t.get("position"),n=s.data.length/3,o=this._isClosed(t),{buffer:a,offset:l}=i,c=a.getField("position",R),p=a.getField("u0",V),u=a.getField("sizeFeatureAttribute",V),m=a.getField("size",V),h=a.getField("colorFeatureAttribute",V),d=a.getField("color",F),_=a.getField("olidColor",F),b=a.getField("timeStamps",O),S=a.getField("opacityFeatureAttribute",V),P=t.get("sizeFeatureAttribute")?.data,y=t.get("size")?.data,v=t.get("colorFeatureAttribute")?.data,w=t.get("color")?.data,E=t.get("opacityFeatureAttribute")?.data,x=t.get("distanceToStart")?.data,T=t.get("timeStamps");Z(null!==c,"Expected valid position field in texture buffer"),Z(null!==p,"Expected valid u0 field in texture buffer");let j=0;for(let L=0;L<n;++L){this._getTransformedPosition(Ue,s.data,L,e),L>0&&(null!=x?j=x[L]??j:j+=g(Be,Ue));const t=l+L+1;if(c.setVec(t,Ue),p.set(t,j),f(Be,Ue),u&&u.set(t,1===P?.length?P[0]:P?.[L]??0),m&&m.set(t,1===y?.length?y[0]:y?.[L]??1),h&&h.set(t,1===v?.length?v[0]:v?.[L]??0),d)if(null!=w){const e=Math.min(4*L,w.length-4);d.setValues(t,w[e],w[e+1],w[e+2],w[e+3])}else d.setValues(t,1,1,1,1);S&&S.set(t,1===E?.length?E[0]:E?.[L]??0)}if(null!=b&&null!=T){Z(4===T.size);const e=T.data;for(let t=0;t<n;++t){const r=4*t,i=l+t+1;b.set(i,0,e[r]),b.set(i,1,e[r+1]),b.set(i,2,e[r+2]),b.set(i,3,e[r+3])}}if(o){const e=l,t=l+1,r=l+2,i=l+n,s=i+1,o=i+2;a.copyItem(i,e),a.copyItem(t,s),a.copyItem(r,o),c.getVec(i,Be),c.getVec(t,Ue);const u=j+g(Be,Ue);p.set(s,u)}else{const e=l,t=l+1,r=l+n,i=r+1;a.copyItem(t,e),a.copyItem(r,i)}D()&&null!=r&&null!=_&&te(r,_,n+(o?3:2),l)}_writeVertexBuffer(e,t,r,i,s){const{buffer:n,offset:o}=i,{layout:a}=this,l=t.get("position"),c=l.indices,p=l.data.length/3,u=this._isClosed(t),m=p+(u?3:2);c&&c.length!==2*(p-1)&&console.warn("RibbonLineMaterial does not support indices");const h=n.getField("textureElementIndex",B);Z(null!=h,"Missing texture buffer index field"),Z(null!=s,"Using a texture layout, but the texture range for this instance was not provided");const f=s.from;Z(s.numElements===m,"Expected number of elements in TextureBuffer to equal number of points");const d=new Float32Array(n.buffer),g=v(n.buffer),_=new Uint32Array(n.buffer),b=a.stride/4;let S=o*b;const P=S,y=d.BYTES_PER_ELEMENT/g.BYTES_PER_ELEMENT,w=(e,t,r)=>{const i=r+1;_[S]=f+i,S++;let s=S*y;g[s++]=e,g[s++]=t,S=Math.ceil(s/y)};S+=b;let E=0,x=0;u?(E=0,x=p):(w(1,-4,0),w(1,4,0),E=1,x=p-1);for(let v=E;v<x;v++){w(0,-1,v),w(0,1,v);const e=this.numJoinSubdivisions;for(let t=0;t<e;++t){const r=(t+1)/(e+1);w(r,-1,v),w(r,1,v)}w(1,-2,v),w(1,2,v)}u?(w(0,-1,x),w(0,1,x)):(w(0,-5,x),w(0,5,x)),me(d,P+b,d,P,b);S=me(d,S-b,d,S,b),this._parameters.wireframe&&this._addWireframeVertices(n,P,S,b)}_getTransformedPosition(e,t,r,i){const s=3*r;c(e,t[s+0],t[s+1],t[s+2]),i&&b(e,e,i)}_addWireframeVertices(e,t,r,i){const s=new Uint8Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),n=new Uint8Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,(r-t)*Float32Array.BYTES_PER_ELEMENT),o=i*Float32Array.BYTES_PER_ELEMENT;let a=0;const l=e=>a=me(n,e,s,a,o);for(let c=0;c<=n.length-4*o;c+=2*o)l(c),l(c+2*o),l(c+1*o),l(c+2*o),l(c+1*o),l(c+3*o)}}function me(e,t,r,i,s){for(let n=0;n<s;n++)r[i++]=e[t++];return i}function he(e,t){if(!e.isClosed)return!1;return t.get("position").indices.length>2}function fe(e,t){return(e/2+Je)*t}function*de(e,t,r,i,s){const n=i.get("position").data,l=he(r,i)?n.length-2:n.length-5,c=s?.[0]??0,p=s?.[1]??0;a(e,n[0]+c,n[1]+p);for(let u=3;u<l+3;u+=3){const r=u%n.length;a(t,n[r]+c,n[r+1]+p),yield u/3,o(e,t)}}function ge(e){return 1===e.anchor&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}function _e(e,t){const r=t?1:0;switch(e){case"miter":case"bevel":return r;case"round":return re+r}}const be=new K,Se=P(),Pe=P(),ye=l(),ve=l(),we=P(),Ee=P(),xe=P(),Te=P(),je=P(),Le=P(),ze=r(),Ce=r(),Ae=i(),Me=i(),Re=P(),Ve=P(),Fe=w(),Oe=w(),Be=P(),Ue=P(),Ie=[r(),r(),r(),r()],Ne=[P(),P(),P(),P()],We=z(),ke=z(),De=z(),Ye=z(),Je=4,qe=[P(),P()];export{pe as Parameters,le as RibbonLineMaterial};
2
+ import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r,createScreenPointArray as i}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as s,Seconds as n}from"../../../../core/time.js";import{copy as o,set as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as c,subtract as p,dot as u,scale as m,add as h,copy as f,length as d,distance as g,lerp as _,transformMat4 as b,normalize as S}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as v}from"../../../../geometry/support/float16.js";import{fromPoints as w,distance2 as E,closestLineSegmentPoint as x,projectPoint as T,projectPointFraction as j,create as L}from"../../../../geometry/support/lineSegment.js";import{fromPoints as z,signedDistance as C,getNormal as A,create as M}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as R,BufferViewFloat as V,BufferViewVec4Unorm8 as F,BufferViewVec4f16 as O,BufferViewUint32 as B}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as U,isColor as I,isDepth as N,isColorHighlightOLIDOrDepth as W,is2DGeometryOutput as k}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as D}from"../effects/geometry/olidUtils.js";import Y from"../lib/GLMaterial.js";import{Material as J}from"../lib/Material.js";import{projectWorldLineSegmentToRenderScreen as q,screenPolygonIntersectsBufferedSegment as X}from"../lib/screenPolygonOverlapUtils.js";import{Hit as G,DrapedHit as H}from"../lib/screenPolygonTriangleIntersections.js";import{ScreenSizePerspectiveEvaluator as K}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as Q,assert as Z}from"../lib/Util.js";import{isImagePattern as $}from"./lineStippleUtils.js";import{VisualVariablePassParameters as ee}from"./VisualVariablePassParameters.js";import{writeOlidColor as te}from"./internal/bufferWriterUtils.js";import{r as re}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as ie,getTextureBufferLayout as se}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as ne}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as oe}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as ae}from"../../../../webscene/support/AlphaCutoff.js";class le extends J{constructor(e,t){super(e,pe),this.produces=new Map([[2,e=>U(e)||I(e)&&8===this.parameters.renderOccluded],[3,e=>N(e)],[10,e=>W(e)&&8===this.parameters.renderOccluded],[11,e=>W(e)&&8===this.parameters.renderOccluded],[4,e=>I(e)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[8,e=>I(e)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[18,e=>k(e)]]),this._configuration=new oe(t)}updateConfiguration(e){super.updateConfiguration(e);const t=18===e.slot,r=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==e.output,i=r&&t&&this.parameters.isImagePattern();this._configuration.draped=t,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=_e(this.parameters.join,r),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&ge(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.emissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!i,this._configuration.worldSizedImagePattern=i}get visible(){return this.parameters.color[3]>=ae||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>ae}get emissions(){return this.parameters.emissiveStrength>0?8!==this.parameters.renderOccluded?2:1:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectRayDraped({attributes:e,screenToWorldRatio:r},i,s,n,o){if(!i.options.selectionMode)return;const a=this._getLineSize(e,!0),l=s[0],c=s[1],p=fe(a,r);let u=Number.MAX_VALUE,m=0;for(const h of de(ye,ve,this.parameters,e)){const e=l-ye[0],r=c-ye[1],i=ve[0]-ye[0],s=ve[1]-ye[1],n=t((i*e+s*r)/(i*i+s*s),0,1),o=i*n-e,a=s*n-r,p=o*o+a*a;p<u&&(u=p,m=h)}u<p*p&&n(o.distance,o.renderDistance,o.normal,m)}intersectRay(t,r,i,s,n,a){const{options:l,camera:_,rayBegin:b,rayEnd:S}=i;if(!l.selectionMode||!t.visible||!_)return;if(!Q(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const P=t.attributes,y=P.get("position").data,v=this._getLineSize(P),T=Le;o(T,i.point);const j=v*_.pixelRatio,L=Je*_.pixelRatio,M=j/2+L;c(Ie[0],T[0]-M,T[1]+M,0),c(Ie[1],T[0]+M,T[1]+M,0),c(Ie[2],T[0]+M,T[1]-M,0),c(Ie[3],T[0]-M,T[1]-M,0);for(let e=0;e<4;e++)if(!_.unprojectFromRenderScreen(Ie[e],Ne[e]))return;z(_.eye,Ne[0],Ne[1],We),z(_.eye,Ne[1],Ne[2],ke),z(_.eye,Ne[2],Ne[3],De),z(_.eye,Ne[3],Ne[0],Ye);let R=Number.MAX_VALUE,V=0;for(const e of this._forEachTransformedLineSegment(Se,Pe,y,r,he(this.parameters,P))){if(C(We,Se)<0&&C(We,Pe)<0||C(ke,Se)<0&&C(ke,Pe)<0||C(De,Se)<0&&C(De,Pe)<0||C(Ye,Se)<0&&C(Ye,Pe)<0)continue;const t=_.projectToRenderScreen(Se,ze),r=_.projectToRenderScreen(Pe,Ce);if(null==t||null==r)continue;if(t[2]<0&&r[2]>0){p(Te,Se,Pe);const e=_.frustum,r=-C(e[4],Se)/u(Te,A(e[4]));if(m(Te,Te,r),h(Se,Se,Te),!_.projectToRenderScreen(Se,t))continue}else if(t[2]>0&&r[2]<0){p(Te,Pe,Se);const e=_.frustum,t=-C(e[4],Pe)/u(Te,A(e[4]));if(m(Te,Te,t),h(Pe,Pe,Te),!_.projectToRenderScreen(Pe,r))continue}else if(t[2]<0&&r[2]<0)continue;t[2]=0,r[2]=0;const i=w(t,r,Fe),s=E(i,T);if(!(s>=R)){if(this.parameters.screenSizePerspective){const e=this.computeScreenSizePerspectiveWidth(i,Se,Pe,T,_,v,L);if(s>=e*e)continue}R=s,f(Re,Se),f(Ve,Pe),V=e}}if(R<M*M){let e=Number.MAX_VALUE;if(x(w(Re,Ve,Fe),w(b,S,Oe),je)){p(je,je,b);const t=d(je);m(je,je,1/t),e=t/g(b,S)}a(e,e,je,V)}}intersectScreenPolygon(t,r,i,s){const{options:n,camera:o,screenPolygonPrimitiveProcessor:a}=i;if(!n.selectionMode||!t.visible)return null;if(!Q(r))return e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix"),null;const l=t.attributes,c=l.get("position").data,p=this._getLineSize(l),u=Je,m=u*o.pixelRatio,h=new G(4);for(const e of this._forEachTransformedLineSegment(Se,Pe,c,r,he(this.parameters,l)))for(const[t,r]of a.processLineSegment(qe,Se,Pe)){if(!q(o,t,r,ze,Ce))continue;const i=w(ze,Ce,Fe);let n=p/2+u;this.parameters.screenSizePerspective&&(_(Le,ze,Ce,.5),n=Math.max(n,this.computeScreenSizePerspectiveWidth(i,t,r,Le,o,p,m)/o.pixelRatio)),o.renderToScreen(ze,Ae),o.renderToScreen(Ce,Me),X(s,Ae,Me,n)&&(T(w(t,r,Oe),o.eye,we),h.updateIfCloserFromValues(g(o.eye,we),e,we,null))}return h}intersectScreenPolygonDraped({attributes:e,screenToWorldRatio:t},r,i,s){if(!i.options.selectionMode)return null;const n=fe(this._getLineSize(e,!0),t);for(const o of de(ye,ve,this.parameters,e,r))if(X(s,ye,ve,n))return new H(o);return null}createBufferWriter(){return new ue(ie(this.parameters),se(this.parameters),this.parameters)}createGLMaterial(e){return new ce(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:s(e.time)},!1),0!==e.dt)}computeScreenSizePerspectiveWidth(e,t,r,i,s,n,o){const a=j(e,i);_(we,t,r,a),b(Ee,we,s.viewMatrix);const l=d(Ee),c=this.computeCameraAbsCosAngle(we,s,this._configuration.spherical);be.update(c,l,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize);return be.apply(n)*s.pixelRatio/2+o}computeCameraAbsCosAngle(e,t,r){return r?S(je,e):c(je,0,0,1),p(xe,e,t.eye),S(xe,xe),Math.abs(u(je,xe))}_getLineSize(e,r=!1){let i=this.parameters.width;if(this.parameters.vvSize){const s=e.get("sizeFeatureAttribute").data[0];Number.isNaN(s)?r&&(i*=this.parameters.vvSize.fallback[0]):i*=t(this.parameters.vvSize.offset[0]+s*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else e.has("size")&&(i*=e.get("size").data[0]);return i}*_forEachTransformedLineSegment(e,t,r,i,s){const n=s?r.length-2:r.length-5;for(let o=0;o<n;o+=3){e[0]=r[o]+i[12],e[1]=r[o+1]+i[13],e[2]=r[o+2]+i[14];const s=(o+3)%r.length;t[0]=r[s]+i[12],t[1]=r[s+1]+i[13],t[2]=r[s+2]+i[14],yield o/3}}}class ce extends Y{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(ne,e)}}class pe extends ee{constructor(){super(...arguments),this._width=0,this.color=y,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=n(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=n(0),this.endTime=n(1/0),this.emissiveStrength=0}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return $(this.stipplePattern)&&null!=this.stippleTexture}}class ue{constructor(e,t,r){this.layout=e,this.textureBufferLayout=t,this._parameters=r,this.numJoinSubdivisions=_e(this._parameters.join,null!=this._parameters.stipplePattern)}_isClosed(e){return he(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCountTextureBuffer(e){return e.get("position").data.length/3+(this._isClosed(e)?3:2)}elementCount(e){const t=2,r=e.get("position").indices.length/2+1,i=this._isClosed(e);let s=i?2:2*t;return s+=((i?r:r-1)-(i?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,r,i,s,n,o){null!=o&&this._writeTextureBuffer(e,r,i,o),null!=s&&this._writeVertexBuffer(e,r,i,s,n)}_writeTextureBuffer(e,t,r,i){const s=t.get("position"),n=s.data.length/3,o=this._isClosed(t),{buffer:a,offset:l}=i,c=a.getField("position",R),p=a.getField("u0",V),u=a.getField("sizeFeatureAttribute",V),m=a.getField("size",V),h=a.getField("colorFeatureAttribute",V),d=a.getField("color",F),_=a.getField("olidColor",F),b=a.getField("timeStamps",O),S=a.getField("opacityFeatureAttribute",V),P=t.get("sizeFeatureAttribute")?.data,y=t.get("size")?.data,v=t.get("colorFeatureAttribute")?.data,w=t.get("color")?.data,E=t.get("opacityFeatureAttribute")?.data,x=t.get("distanceToStart")?.data,T=t.get("timeStamps");Z(null!==c,"Expected valid position field in texture buffer"),Z(null!==p,"Expected valid u0 field in texture buffer");let j=0;for(let L=0;L<n;++L){this._getTransformedPosition(Ue,s.data,L,e),L>0&&(null!=x?j=x[L]??j:j+=g(Be,Ue));const t=l+L+1;if(c.setVec(t,Ue),p.set(t,j),f(Be,Ue),u&&u.set(t,1===P?.length?P[0]:P?.[L]??0),m&&m.set(t,1===y?.length?y[0]:y?.[L]??1),h&&h.set(t,1===v?.length?v[0]:v?.[L]??0),d)if(null!=w){const e=Math.min(4*L,w.length-4);d.setValues(t,w[e],w[e+1],w[e+2],w[e+3])}else d.setValues(t,1,1,1,1);S&&S.set(t,1===E?.length?E[0]:E?.[L]??0)}if(null!=b&&null!=T){Z(4===T.size);const e=T.data;for(let t=0;t<n;++t){const r=4*t,i=l+t+1;b.set(i,0,e[r]),b.set(i,1,e[r+1]),b.set(i,2,e[r+2]),b.set(i,3,e[r+3])}}if(o){const e=l,t=l+1,r=l+2,i=l+n,s=i+1,o=i+2;a.copyItem(i,e),a.copyItem(t,s),a.copyItem(r,o),c.getVec(i,Be),c.getVec(t,Ue);const u=j+g(Be,Ue);p.set(s,u)}else{const e=l,t=l+1,r=l+n,i=r+1;a.copyItem(t,e),a.copyItem(r,i)}D()&&null!=r&&null!=_&&te(r,_,n+(o?3:2),l)}_writeVertexBuffer(e,t,r,i,s){const{buffer:n,offset:o}=i,{layout:a}=this,l=t.get("position"),c=l.indices,p=l.data.length/3,u=this._isClosed(t),m=p+(u?3:2);c&&c.length!==2*(p-1)&&console.warn("RibbonLineMaterial does not support indices");const h=n.getField("textureElementIndex",B);Z(null!=h,"Missing texture buffer index field"),Z(null!=s,"Using a texture layout, but the texture range for this instance was not provided");const f=s.from;Z(s.numElements===m,"Expected number of elements in TextureBuffer to equal number of points");const d=new Float32Array(n.buffer),g=v(n.buffer),_=new Uint32Array(n.buffer),b=a.stride/4;let S=o*b;const P=S,y=d.BYTES_PER_ELEMENT/g.BYTES_PER_ELEMENT,w=(e,t,r)=>{const i=r+1;_[S]=f+i,S++;let s=S*y;g[s++]=e,g[s++]=t,S=Math.ceil(s/y)};S+=b;let E=0,x=0;u?(E=0,x=p):(w(1,-4,0),w(1,4,0),E=1,x=p-1);for(let v=E;v<x;v++){w(0,-1,v),w(0,1,v);const e=this.numJoinSubdivisions;for(let t=0;t<e;++t){const r=(t+1)/(e+1);w(r,-1,v),w(r,1,v)}w(1,-2,v),w(1,2,v)}u?(w(0,-1,x),w(0,1,x)):(w(0,-5,x),w(0,5,x)),me(d,P+b,d,P,b);S=me(d,S-b,d,S,b),this._parameters.wireframe&&this._addWireframeVertices(n,P,S,b)}_getTransformedPosition(e,t,r,i){const s=3*r;c(e,t[s+0],t[s+1],t[s+2]),i&&b(e,e,i)}_addWireframeVertices(e,t,r,i){const s=new Uint8Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),n=new Uint8Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,(r-t)*Float32Array.BYTES_PER_ELEMENT),o=i*Float32Array.BYTES_PER_ELEMENT;let a=0;const l=e=>a=me(n,e,s,a,o);for(let c=0;c<=n.length-4*o;c+=2*o)l(c),l(c+2*o),l(c+1*o),l(c+2*o),l(c+1*o),l(c+3*o)}}function me(e,t,r,i,s){for(let n=0;n<s;n++)r[i++]=e[t++];return i}function he(e,t){if(!e.isClosed)return!1;return t.get("position").indices.length>2}function fe(e,t){return(e/2+Je)*t}function*de(e,t,r,i,s){const n=i.get("position").data,l=he(r,i)?n.length-2:n.length-5,c=s?.[0]??0,p=s?.[1]??0;a(e,n[0]+c,n[1]+p);for(let u=3;u<l+3;u+=3){const r=u%n.length;a(t,n[r]+c,n[r+1]+p),yield u/3,o(e,t)}}function ge(e){return 1===e.anchor&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}function _e(e,t){const r=t?1:0;switch(e){case"miter":case"bevel":return r;case"round":return re+r}}const be=new K,Se=P(),Pe=P(),ye=l(),ve=l(),we=P(),Ee=P(),xe=P(),Te=P(),je=P(),Le=P(),ze=r(),Ce=r(),Ae=i(),Me=i(),Re=P(),Ve=P(),Fe=L(),Oe=L(),Be=P(),Ue=P(),Ie=[r(),r(),r(),r()],Ne=[P(),P(),P(),P()],We=M(),ke=M(),De=M(),Ye=M(),Je=4,qe=[P(),P()];export{pe as Parameters,le as RibbonLineMaterial};