@arcgis/core 5.2.0-next.35 → 5.2.0-next.37

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 (294) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/02b043a3c5fa8bcb4c5b.js +1 -0
  3. package/assets/esri/core/workers/chunks/{acbc14395c31f6da509e.js → 03437a8ef35c200dbf17.js} +1 -1
  4. package/assets/esri/core/workers/chunks/034dd8ee5152a12412cd.js +1 -0
  5. package/assets/esri/core/workers/chunks/0a6e03263ab0906d8bcf.js +1 -0
  6. package/assets/esri/core/workers/chunks/0edd250159ec259601b3.js +1 -0
  7. package/assets/esri/core/workers/chunks/{401ee7fa500adad77db1.js → 1079914101d69a40b3eb.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{bbcb213d20693fcad5be.js → 1599dc5309a4e60017ce.js} +2 -2
  9. package/assets/esri/core/workers/chunks/181e98399732f425305d.js +1 -0
  10. package/assets/esri/core/workers/chunks/{47d88e1b003c4519b7b6.js → 18f4b2099299942aaf97.js} +1 -1
  11. package/assets/esri/core/workers/chunks/196e7515a43bd0026f49.js +1 -0
  12. package/assets/esri/core/workers/chunks/1aa7496a7dc95aae11ac.js +1 -0
  13. package/assets/esri/core/workers/chunks/1d524690c4b66289bd20.js +1 -0
  14. package/assets/esri/core/workers/chunks/{f72f38e7609756a7f8ea.js → 20fa2c3d4360afa5e136.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{03350a56f840cffe5459.js → 2757c4bf0280e27f3484.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{93ceb74ac88ef460fe5f.js → 278409028bc5af45b507.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{2c61bb25578f73ba49bc.js → 29a1d0659bbc5a039864.js} +1 -1
  18. package/assets/esri/core/workers/chunks/29df3f829006719b2680.js +1 -0
  19. package/assets/esri/core/workers/chunks/30cf84a47ebefd180bb7.js +1 -0
  20. package/assets/esri/core/workers/chunks/{71a593fa116770e58832.js → 37a95f097533bad1b338.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{7335a762412bc8c15a2f.js → 37e823202424c11076cb.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{ee446250a40e5d89bb5a.js → 3a76fffa2016c16d7989.js} +3 -3
  23. package/assets/esri/core/workers/chunks/{58ce4bcfb15f378b1b9f.js → 3d6d2b42ba2ad7086d5d.js} +1 -1
  24. package/assets/esri/core/workers/chunks/3ec91474658eae87b832.js +1 -0
  25. package/assets/esri/core/workers/chunks/448e0596005cba9a4225.js +1 -0
  26. package/assets/esri/core/workers/chunks/{f148666308071bdb185a.js → 45530a49fa1f09d1682e.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{155940ef3d1888272d73.js → 459e89d1b94a3b204d20.js} +2 -2
  28. package/assets/esri/core/workers/chunks/{f71f5778e03f68f27482.js → 45b2e58051f42ebd236e.js} +1 -1
  29. package/assets/esri/core/workers/chunks/4611cf051c3c396fdf96.js +1 -0
  30. package/assets/esri/core/workers/chunks/{efaa1d05705f6b450e8f.js → 46e3d33e44e5398221e2.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{866950e9ab96aebc6b32.js → 4a8201e09bc3ad5cc00b.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{110135b0562a3b5708b9.js → 4abe820bbe4f7ffccc09.js} +1 -1
  33. package/assets/esri/core/workers/chunks/4ad86d6b1be07c97b6f6.js +1 -0
  34. package/assets/esri/core/workers/chunks/{20ffeb09bb30400de110.js → 4e28f49d0be20ea50fd7.js} +1 -1
  35. package/assets/esri/core/workers/chunks/4f25aac84d9eb10cac83.js +1 -0
  36. package/assets/esri/core/workers/chunks/{0197e459fdb04dfb28ef.js → 51838d55d8ec4ce70398.js} +1 -1
  37. package/assets/esri/core/workers/chunks/542d8a6c415098b9857c.js +1 -0
  38. package/assets/esri/core/workers/chunks/57abf838fcff0f0e2c5e.js +1 -0
  39. package/assets/esri/core/workers/chunks/57dd017fed2943d24e3d.js +1 -0
  40. package/assets/esri/core/workers/chunks/59801b2ccaaf4b394e02.js +1 -0
  41. package/assets/esri/core/workers/chunks/5a62c9f64db4fcae5e52.js +1 -0
  42. package/assets/esri/core/workers/chunks/{e84c13ac59e5381b77e2.js → 5aebecb5c2b3e7887127.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{c19fe4f31e4ef84bbcf6.js → 5e68b74fd548c7cdba36.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{9dcb2cbf89dcb7558432.js → 5f360492560ae07083a6.js} +1 -1
  45. package/assets/esri/core/workers/chunks/6022f43ebd58e21c737a.js +1 -0
  46. package/assets/esri/core/workers/chunks/62b137a795e487fa06a1.js +1 -0
  47. package/assets/esri/core/workers/chunks/{007485862ce95928717a.js → 632de34ebd2f44b4423d.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{1ad5fcae6d6a9801cf58.js → 63ca17f569407c89bde1.js} +2 -2
  49. package/assets/esri/core/workers/chunks/6896a6dd36fa91a27151.js +1 -0
  50. package/assets/esri/core/workers/chunks/{e6263e1983e703befe48.js → 68bc674affe2f7269c40.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{759686b896f51f0fe6a9.js → 6a51499c6623ddce5f00.js} +1 -1
  52. package/assets/esri/core/workers/chunks/6cdf1db30793133294dd.js +1 -0
  53. package/assets/esri/core/workers/chunks/{b0e4af49fc968b0a910f.js → 6ff6783f89ecd3a5e752.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{857532de88f21e8c3466.js → 70763c7b68d8abe8d5fe.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{e67a9f9298d63026e7f6.js → 716b1f073e3cd807abd3.js} +1 -1
  56. package/assets/esri/core/workers/chunks/71a3f05cb86ae2920f8d.js +1 -0
  57. package/assets/esri/core/workers/chunks/723bb56de2324b41df4e.js +1 -0
  58. package/assets/esri/core/workers/chunks/73f61107cb7e6d30bf03.js +1 -0
  59. package/assets/esri/core/workers/chunks/752c34cee981862add89.js +1 -0
  60. package/assets/esri/core/workers/chunks/760dfd585b6c2c1937ce.js +1 -0
  61. package/assets/esri/core/workers/chunks/{595401947e74a0a67144.js → 76449e50222111ba0eb1.js} +1 -1
  62. package/assets/esri/core/workers/chunks/76bed5497f42f23a27ed.js +1 -0
  63. package/assets/esri/core/workers/chunks/832ecc1f7d45774c4726.js +1 -0
  64. package/assets/esri/core/workers/chunks/860a0f9d20f53db1caf4.js +1 -0
  65. package/assets/esri/core/workers/chunks/867e39bb444947c93586.js +1 -0
  66. package/assets/esri/core/workers/chunks/8a8b7ac6693bdfbebf07.js +1 -0
  67. package/assets/esri/core/workers/chunks/8fce15ce4cfdccf407f3.js +1 -0
  68. package/assets/esri/core/workers/chunks/{5260f623438bd84f2caa.js → 937cf55b3b9d324eea73.js} +1 -1
  69. package/assets/esri/core/workers/chunks/93df864c2e829f0fd5ce.js +1 -0
  70. package/assets/esri/core/workers/chunks/{3dd8145ef89f32920177.js → 966d002acec8c72be56a.js} +1 -1
  71. package/assets/esri/core/workers/chunks/{367a3031abbeff0c0090.js → 9aef0b87f471626abd66.js} +1 -1
  72. package/assets/esri/core/workers/chunks/{f1d211904d5a1de93cb3.js → 9ba9a3705623679bc305.js} +1 -1
  73. package/assets/esri/core/workers/chunks/{aec82b94787821153d2b.js → a188d0767825d322f96d.js} +1 -1
  74. package/assets/esri/core/workers/chunks/a638de0102c3990403d1.js +1 -0
  75. package/assets/esri/core/workers/chunks/b09935d0105d50a0971b.js +1 -0
  76. package/assets/esri/core/workers/chunks/b2c0262c4a76b8a86200.js +1 -0
  77. package/assets/esri/core/workers/chunks/{599bd80379423c99799d.js → b4323e69e624c6b51754.js} +1 -1
  78. package/assets/esri/core/workers/chunks/b5141f240ca79729686d.js +1 -0
  79. package/assets/esri/core/workers/chunks/b549a4d4b1a34bee8beb.js +1 -0
  80. package/assets/esri/core/workers/chunks/bb89b6fd93513c61b2d3.js +1 -0
  81. package/assets/esri/core/workers/chunks/{3bd32387af52fa48d747.js → bc553ecc8cbcc1b02717.js} +1 -1
  82. package/assets/esri/core/workers/chunks/bcba02f61cf0abcb5600.js +1 -0
  83. package/assets/esri/core/workers/chunks/bccc199af4e2e49f7acd.js +1 -0
  84. package/assets/esri/core/workers/chunks/{f63e7b01c70352538b1e.js → bd0f488e228a75fbefb3.js} +2 -2
  85. package/assets/esri/core/workers/chunks/c48dfda8dcb9551606fb.js +1 -0
  86. package/assets/esri/core/workers/chunks/c4e44fde4bc4ff89e2bc.js +1 -0
  87. package/assets/esri/core/workers/chunks/c93a68618674b38b932e.js +1 -0
  88. package/assets/esri/core/workers/chunks/d2745886ba5a86fd5c4c.js +680 -0
  89. package/assets/esri/core/workers/chunks/d4c341b15d9244276fb9.js +1 -0
  90. package/assets/esri/core/workers/chunks/d5faab9799891e5da5a8.js +1 -0
  91. package/assets/esri/core/workers/chunks/d811924acc9c0be95bba.js +1 -0
  92. package/assets/esri/core/workers/chunks/{4b96aa2dc5b88846bb53.js → e0a4d0288abd334b0673.js} +1 -1
  93. package/assets/esri/core/workers/chunks/{b22a1c98271c2e4d8808.js → e1ddb8e4977b317fd40c.js} +1 -1
  94. package/assets/esri/core/workers/chunks/e961c6140c39921816a8.js +1 -0
  95. package/assets/esri/core/workers/chunks/eb7daa0f6610983ff8db.js +1 -0
  96. package/assets/esri/core/workers/chunks/eb842cf470ce28a73187.js +1 -0
  97. package/assets/esri/core/workers/chunks/ed1d4ebf487c7dcd5c33.js +1 -0
  98. package/assets/esri/core/workers/chunks/f565e203d8fed2672112.js +1 -0
  99. package/assets/esri/core/workers/chunks/f80cadcc2a588da63b38.js +1 -0
  100. package/assets/esri/core/workers/chunks/f8bbb52b865a0a242140.js +1 -0
  101. package/assets/esri/core/workers/chunks/f9592bcdd9988199a7ea.js +1 -0
  102. package/assets/esri/core/workers/chunks/ff7e1eb2366d4301d288.js +1 -0
  103. package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
  104. package/chunks/NavigationDepth.glsl.js +18 -0
  105. package/chunks/Path.glsl.js +20 -16
  106. package/config.js +1 -1
  107. package/core/accessorSupport/diffUtils.js +1 -1
  108. package/core/has.js +1 -1
  109. package/geometry/FlatGeometry.js +1 -1
  110. package/geometry/support/Indices.js +1 -1
  111. package/geometry/support/ShortArray.js +1 -1
  112. package/geometry/support/UintArray.js +1 -1
  113. package/geometry/support/meshUtils/geographicUtils.js +1 -1
  114. package/kernel.js +1 -1
  115. package/layers/MapImageLayer.js +1 -1
  116. package/layers/mixins/PublishableLayer.js +1 -1
  117. package/layers/mixins/RefreshableLayer.js +1 -1
  118. package/layers/raster/functions/pixelUtils.js +1 -1
  119. package/layers/support/kustoUtils.js +1 -1
  120. package/layers/types.d.ts +9 -2
  121. package/package.json +1 -1
  122. package/popup/Feature.js +1 -1
  123. package/portal/support/resourceUtils.js +1 -1
  124. package/renderers/support/rasterTypeUtils.js +1 -1
  125. package/rest/query/operations/pbfFeatureSetUtils.js +1 -1
  126. package/support/revision.js +1 -1
  127. package/symbols/cim/utils.js +1 -1
  128. package/tables/support/tablesUtils.js +1 -1
  129. package/views/2d/engine/flow/utils.js +1 -1
  130. package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
  131. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AAnimatedShader.js +1 -1
  132. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedTechnique.js +1 -1
  133. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  134. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/AlignedVertexSpec.js +1 -1
  135. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  136. package/views/2d/layers/features/layerAdapters/labelingUtils.js +1 -1
  137. package/views/2d/layers/support/ExportStrategy.js +1 -1
  138. package/views/2d/layers/support/annodime/dimensionUtils.js +1 -1
  139. package/views/2d/layers/support/annodime/utils.js +1 -1
  140. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  141. package/views/3d/interactive/editingTools/reshape/ReshapeTool3D.js +1 -1
  142. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  143. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  144. package/views/3d/layers/Lyr3DWasm.js +1 -1
  145. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  146. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  147. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  148. package/views/3d/layers/i3s/PointCloudRendererUtil.js +1 -1
  149. package/views/3d/layers/i3s/PointCloudWorkerUtil.js +1 -1
  150. package/views/3d/layers/support/lyr3dTypeConversions.js +1 -1
  151. package/views/3d/state/utils/navigationUtils.js +1 -1
  152. package/views/3d/support/gaussianSplatting/GaussianSplatAtlasPages.js +1 -1
  153. package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
  154. package/views/3d/support/orientedBoundingBox.js +1 -1
  155. package/views/3d/terrain/Tile.js +1 -1
  156. package/views/3d/terrain/TileRenderer.js +1 -1
  157. package/views/3d/terrain/terrainUtils.js +1 -1
  158. package/views/3d/webgl-engine/core/material/MaterialBase.js +1 -1
  159. package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
  160. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +32 -16
  161. package/views/3d/webgl-engine/core/shaderLibrary/output/Emissions.glsl.js +1 -1
  162. package/views/3d/webgl-engine/core/shaderLibrary/shading/calculateUVZShadowFromDepth.glsl.js +2 -2
  163. package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
  164. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  165. package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
  166. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  167. package/views/3d/webgl-engine/lib/NavigationDepthCache.js +2 -0
  168. package/views/3d/webgl-engine/lib/PathEvaluator.js +1 -1
  169. package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
  170. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  171. package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
  172. package/views/3d/webgl-engine/lib/intersectorUtils.js +1 -1
  173. package/views/3d/webgl-engine/lib/lodRendering/LodComponentData.js +1 -1
  174. package/views/3d/webgl-engine/lib/lodRendering/LodLevel.js +1 -1
  175. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  176. package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
  177. package/views/3d/webgl-engine/lib/screenPolygonOverlapUtils.js +1 -1
  178. package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
  179. package/views/3d/webgl-engine/materials/Path.glsl.js +1 -1
  180. package/views/3d/webgl-engine/materials/PathLayouts.js +1 -1
  181. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  182. package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
  183. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  184. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  185. package/views/3d/webgl-engine/shaders/NavigationDepth.glsl.js +2 -0
  186. package/views/3d/webgl-engine/shaders/NavigationDepthTechnique.js +2 -0
  187. package/views/3d/webgl-engine/shaders/oitResolution.glsl.js +1 -1
  188. package/views/View2D.js +1 -1
  189. package/views/draw/support/Reshape.js +1 -1
  190. package/views/interactive/tooltip/fields/fields.js +1 -1
  191. package/views/interactive/tooltip/fields/parsingAndFormattingUtils.js +1 -1
  192. package/views/layers/CatalogDynamicGroupLayerView.js +1 -1
  193. package/views/support/euclideanLengthMeasurementUtils.js +1 -1
  194. package/views/support/selectionUtils.js +1 -1
  195. package/views/webgl/BufferObject.js +1 -1
  196. package/views/webgl/FramebufferObject.js +1 -1
  197. package/views/webgl/RenderingContext.js +1 -1
  198. package/views/webgl/Texture.js +1 -1
  199. package/views/webgl/VertexAttributeLayouts.js +1 -1
  200. package/webscene/spec-certification/utils.js +1 -1
  201. package/widgets/Editor/legacy/workflowUtils.js +1 -1
  202. package/widgets/Editor/workflowUtils.js +1 -1
  203. package/widgets/Editor.d.ts +6 -0
  204. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  205. package/widgets/OrientedImageryViewer/navigation/errors.js +1 -1
  206. package/widgets/OrientedImageryViewer/navigation/queries.js +1 -1
  207. package/widgets/OrientedImageryViewer/navigation/utils.js +1 -1
  208. package/widgets/OrientedImageryViewer/support/superimposeUtils.js +1 -1
  209. package/widgets/OrientedImageryViewer/utils.js +1 -1
  210. package/widgets/OrientedImageryViewer.js +1 -1
  211. package/widgets/PanoramicViewer/constants.js +1 -1
  212. package/widgets/PanoramicViewer/support/importUtils.js +1 -1
  213. package/widgets/PanoramicViewer/utils.js +1 -1
  214. package/widgets/support/dateUtils.js +1 -1
  215. package/assets/esri/core/workers/chunks/0a2f08298a3c932614f2.js +0 -1
  216. package/assets/esri/core/workers/chunks/0df978697328b6453c94.js +0 -1
  217. package/assets/esri/core/workers/chunks/168c15cf462f9abcbdd2.js +0 -1
  218. package/assets/esri/core/workers/chunks/22c447fcc9a28afeb6e3.js +0 -1
  219. package/assets/esri/core/workers/chunks/24aa98cb2021ddd789ce.js +0 -1
  220. package/assets/esri/core/workers/chunks/2509da565e5a2b43ac7f.js +0 -1
  221. package/assets/esri/core/workers/chunks/256cc116e3be4feee593.js +0 -1
  222. package/assets/esri/core/workers/chunks/2bb3494659609594c4ca.js +0 -1
  223. package/assets/esri/core/workers/chunks/2c017eae434254610c8e.js +0 -1
  224. package/assets/esri/core/workers/chunks/303e723e829ea7088d43.js +0 -1
  225. package/assets/esri/core/workers/chunks/368db1420b8520beae05.js +0 -1
  226. package/assets/esri/core/workers/chunks/38a6a7c56c592f336a12.js +0 -1
  227. package/assets/esri/core/workers/chunks/39ff5b2a05a90e1cb214.js +0 -1
  228. package/assets/esri/core/workers/chunks/3b914ca36e7e2b00cfe6.js +0 -1
  229. package/assets/esri/core/workers/chunks/3d1021f7ea9617a76ccf.js +0 -1
  230. package/assets/esri/core/workers/chunks/3e8fa2a7a36881234479.js +0 -1
  231. package/assets/esri/core/workers/chunks/451331f69d21c61ec93b.js +0 -1
  232. package/assets/esri/core/workers/chunks/4656a4bf430d7eed1465.js +0 -1
  233. package/assets/esri/core/workers/chunks/472ec242cd3070e6acfe.js +0 -1
  234. package/assets/esri/core/workers/chunks/51d7145f748b4865de7f.js +0 -1
  235. package/assets/esri/core/workers/chunks/54f54623532f633dc0e2.js +0 -1
  236. package/assets/esri/core/workers/chunks/570a4725b2a4a19c5148.js +0 -1
  237. package/assets/esri/core/workers/chunks/586ca90e46f5cbdfeece.js +0 -1
  238. package/assets/esri/core/workers/chunks/59c22bab85f9cdbb9948.js +0 -1
  239. package/assets/esri/core/workers/chunks/5dfeefee96659832398a.js +0 -1
  240. package/assets/esri/core/workers/chunks/6c746ac4bd2e57b8cb41.js +0 -1
  241. package/assets/esri/core/workers/chunks/6d72a1bdc2664df62c4c.js +0 -1
  242. package/assets/esri/core/workers/chunks/7085b4c655a19694da04.js +0 -1
  243. package/assets/esri/core/workers/chunks/777b16b76db406c99c69.js +0 -1
  244. package/assets/esri/core/workers/chunks/818a481ce579f519de1c.js +0 -1
  245. package/assets/esri/core/workers/chunks/85a280ee915010a8da3c.js +0 -1
  246. package/assets/esri/core/workers/chunks/86731e276b31453bc235.js +0 -1
  247. package/assets/esri/core/workers/chunks/87b86375f8557418dbe6.js +0 -1
  248. package/assets/esri/core/workers/chunks/8817d25c7f4cf0e6c6bd.js +0 -1
  249. package/assets/esri/core/workers/chunks/8a9b2efa0603e9fa4e8b.js +0 -1
  250. package/assets/esri/core/workers/chunks/8aa5bbf9a9b09815725a.js +0 -1
  251. package/assets/esri/core/workers/chunks/8b68a69ab8fb1679e7b2.js +0 -1
  252. package/assets/esri/core/workers/chunks/98685bd149dee1d6dc99.js +0 -1
  253. package/assets/esri/core/workers/chunks/9de673a04c70bd47047e.js +0 -1
  254. package/assets/esri/core/workers/chunks/9de9cec5c644bc452294.js +0 -1
  255. package/assets/esri/core/workers/chunks/9fb0431b0628dcb53004.js +0 -680
  256. package/assets/esri/core/workers/chunks/a2a688dd2ed4565e01ff.js +0 -1
  257. package/assets/esri/core/workers/chunks/a3ae7c41832c7a8b0570.js +0 -1
  258. package/assets/esri/core/workers/chunks/a3e86830460e52706a4d.js +0 -1
  259. package/assets/esri/core/workers/chunks/a58b8903ae17acf117d6.js +0 -1
  260. package/assets/esri/core/workers/chunks/a99ce2f12c8204ee542a.js +0 -1
  261. package/assets/esri/core/workers/chunks/ab3d1c00ef514b61ce0b.js +0 -1
  262. package/assets/esri/core/workers/chunks/ae5363956b4467208e04.js +0 -1
  263. package/assets/esri/core/workers/chunks/b24b7411a73d1da87c30.js +0 -1
  264. package/assets/esri/core/workers/chunks/b97b83159fec34f383af.js +0 -1
  265. package/assets/esri/core/workers/chunks/bec660ee2e7828f965e2.js +0 -1
  266. package/assets/esri/core/workers/chunks/c7316fd2bdb7ac9eada3.js +0 -1
  267. package/assets/esri/core/workers/chunks/ca7d4d76a6bf5a3046cd.js +0 -1
  268. package/assets/esri/core/workers/chunks/cffef41791f0cfa6c26c.js +0 -1
  269. package/assets/esri/core/workers/chunks/d26b1a9f47b4b2744c89.js +0 -1
  270. package/assets/esri/core/workers/chunks/d4a96f0402172787823a.js +0 -1
  271. package/assets/esri/core/workers/chunks/d9fcc63df008f687848a.js +0 -1
  272. package/assets/esri/core/workers/chunks/e3a4695c31d3f9d55213.js +0 -1
  273. package/assets/esri/core/workers/chunks/e65d291bab13f7f5323b.js +0 -1
  274. package/assets/esri/core/workers/chunks/eeee7421f64a52074ff4.js +0 -1
  275. package/assets/esri/core/workers/chunks/eef7e0bee19c4258ba55.js +0 -1
  276. package/assets/esri/core/workers/chunks/efaf998d18479a0380ae.js +0 -1
  277. package/assets/esri/core/workers/chunks/f0573db9a3d3e1499a7e.js +0 -1
  278. package/assets/esri/core/workers/chunks/f07722efd7fa2b75d4dd.js +0 -1
  279. package/assets/esri/core/workers/chunks/f137e544076482e348ad.js +0 -1
  280. package/assets/esri/core/workers/chunks/fd53ef66176ae164e221.js +0 -1
  281. package/assets/esri/core/workers/chunks/fd956a58787020d610af.js +0 -1
  282. package/rest/sharedTemplates/addSharedTemplates.js +0 -2
  283. package/support/featureFlags.js +0 -2
  284. package/views/2d/engine/webgl/ClippingInfo.js +0 -2
  285. package/views/2d/engine/webgl/Mesh2D.js +0 -2
  286. package/views/2d/engine/webgl/shaderGraph/GLSLShaderModule.js +0 -2
  287. package/views/2d/layers/features/ProcessorTileMessageQueue.js +0 -2
  288. package/views/3d/support/AsyncWorkerQueue.js +0 -2
  289. package/views/3d/webgl-engine/lib/PathGeometryData.js +0 -2
  290. package/widgets/BatchAttributeForm/templates/support/contingentValuesUtils.js +0 -2
  291. package/widgets/OrientedImageryViewer/components/NavigationAction.js +0 -2
  292. package/widgets/OrientedImageryViewer/components/NavigationActions.js +0 -2
  293. package/widgets/OrientedImageryViewer/support/NonPanoramicMediaCollection.js +0 -2
  294. package/widgets/PanoramicViewer/support/PanoramicMediaCollection.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as s}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as i,abortMaybe as r,destroyMaybe as a,releaseMaybe as n,releaseReferencedMaybe as h}from"../../../../core/maybe.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{watch as d,syncAndInitial as l,initial as u,sync as m}from"../../../../core/reactiveUtils.js";import{signal as _}from"../../../../core/signal.js";import{property as p,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{equals as f,invert as b,multiply as g,copy as P}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as w,create as E}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as I}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as A,ZEROS as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as T}from"../../../../geometry/support/Indices.js";import{RenderNodeOutput as O,InternalRenderCategory as R,AllRenderNodeOutputs as S,AllInternalRenderNodeOutputs as D}from"../../webgl.js";import{minNearDistanceInMeters as N}from"../../state/NearFarHeuristic.js";import{debugFlags as F}from"../../support/debugFlags.js";import{computeShadowsEnabled as G}from"../../support/sunUtils.js";import{FBOCache as H}from"../core/FBOCache.js";import{RenderPassManager as x}from"../core/renderPasses/RenderPassManager.js";import{isColor as y}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as M}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as v}from"../effects/RenderNodes.js";import{RenderPluginManager as L}from"../effects/RenderPluginManager.js";import{WeatherFader as q}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as U}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as j}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as B,renderHighlightBuffer as V}from"../effects/highlight/Highlight.js";import{OITBlend as k}from"../effects/transparency/OITBlend.js";import{AnimationTimer as W}from"./AnimationTimer.js";import{AnimationTimeStep as Q}from"./AnimationTimeStep.js";import{BoundingInfo as z}from"./BoundingInfo.js";import{Compositor as Y}from"./Compositor.js";import{DepthRange as J}from"./DepthRange.js";import{depthRangeFromScene as X}from"./depthRangeUtils.js";import{MainFramebuffer as $}from"./MainFramebuffer.js";import{blendingColorAlphaClear as K}from"./OrderIndependentTransparency.js";import{RenderContext as Z,defaultRenderOccludedMask as ee}from"./RenderContext.js";import{RendererBase as te}from"./RendererBase.js";import{setupFeatureDefaults as se}from"./RenderFeature.js";import{RenderPluginInput as ie}from"./RenderPluginInput.js";import{ShadowAccumulator as re}from"./ShadowAccumulator.js";import{ShadowMap as ae}from"./ShadowMap.js";import ne from"./SliceHelper.js";import{MergedRenderer as he}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as oe}from"../parts/renderUtils.js";import{RendererPerformanceInfo as de,PerformanceCategory as le}from"../statistics/RendererPerformanceInfo.js";import{ColorAttachment1 as ue,PixelType as me,ColorAttachment2 as _e,ColorAttachment0 as pe,DrawBufferNone as ce}from"../../../webgl/enums.js";let fe=class extends te{constructor(e,t,s,i,r){super({stage:e}),this._techniques=s,this._rctx=i,this._requestRender=r,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new x,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=A(0,0,0,1),this._sliceHelper=new ne,this.sceneDepthRange=_(J.Infinite),this._state=_(2),this._hasGlobalIlluminationFlag=!!has("global-illumination"),this._hasAnimations=!1,this._animationTimestep=new Q,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=_(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new ie,this._hasTransparentGeometry=!1,this._releaseNodeInputs=e=>{for(const t of Se)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new H(i),this._compositor=new Y(i,s),this._renderStateFeatures=_(se(e.view.qualityProfile));const a=new ae(this._fboCache,e.viewingMode);this._renderContext=new Z(this._rctx,a,s),this._framebuffer=new $(this._fboCache,this._bindParameters),this._performanceInfo=new de(this._rctx),this._blit=new j(s),this._shadowAccumulator=new re(this.fboCache,s,e,(t,s,i)=>{const r=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,s,i,!0,r),this._renderShadowCascades(5,t.shadowMap),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},r),this._nodes=new v(this._renderContext),this._plugins=new L({renderContext:this._renderContext,techniques:s,materials:t,requestRender:r,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new q({view:e.view,context:this._renderContext}),this.addHandles([d(()=>e.view.state.camera,()=>r(),l),d(()=>F.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},r()},u),d(()=>e.view.environment.background?.color,e=>{const t=e?e.toUnitRGBA():C;I(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),r()},l),d(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=M,l),d(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},m),d(()=>this._bindParameters.clouds.data?.state,()=>r(),m),d(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,r()},u),d(()=>"sun"===e.view.environment.lighting?.type,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},l)])}destroy(){this._gpuTimerHandle=i(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=r(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),this._fboCache.destroy(),this._fboCache=null,this._renderContext.destroy(),this._plugins.destroy(),this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._performanceInfo=null,z.prune(),he.prune(),T()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new k(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=se(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,s){this._renderStateFeatures.mutate(i=>i.set(t,e,s)),this._requestRender()}setTime(e){this._renderContext.time=e}get hasReflections(){return this._bindParameters.screenSpaceReflections.enabled=this._pluginsHas.water&&this.isFeatureEnabled(4),this._bindParameters.screenSpaceReflections.enabled}get _hasHighlights(){return this._plugins.produces(10,2,4,18,12,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,12,13,14)}get hasAmbientIllumination(){return this.isFeatureEnabled(3)&&!this._inGlobeView}get hasGlobalIllumination(){return this._hasGlobalIlluminationFlag&&this.hasAmbientIllumination}get hasGlobalIlluminationHighQuality(){return this.hasGlobalIllumination&&this.isFeatureEnabled(10)}get _keepGlobalIlluminationShadingAlive(){return this._hasGlobalIlluminationFlag&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get _emissions(){return this._plugins.emissions}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(9)}get highResolutionAtmosphere(){return this.isFeatureEnabled(2)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._bindParameters.globalIllumination=n(this._bindParameters.globalIllumination),this._bindParameters.reprojection.lastFrameDepth=n(this._bindParameters.reprojection.lastFrameDepth),this._bindParameters.reprojection.lastFrameEmission=n(this._bindParameters.reprojection.lastFrameEmission),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=s(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");o(e);const s=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:He(this.stage.view.resourceController)});return this.addHandles(d(()=>s.updating,()=>this._requestRender(),m)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(s)),this._edgeViewCallbacks.length=0,s})),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&f(this._bindParameters.reprojection.matrix,w)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}modifyShadowsEnabled(){const e=this.stage.view.environmentManager.referencePositionGeographic,t=null==e||G(e[2],this.stage.viewingMode),s=this.stage.view.environment.lighting.directShadowsEnabled&&t;this._bindParameters.shadowMap.enabled!==s&&(this._bindParameters.shadowMap.enabled=s,this._requestRender(1))}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){e.shadowCast&&this._shadowAccumulator.setParameters(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}addRenderer(e){this._plugins.add(e)}removeRenderer(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this._occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get _occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){const has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,13),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...Ae),has.water=this._plugins.produces(4,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new W(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const s=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==s&&(this._gpuTimerHandle=s?i(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,s=!1){try{return this._isRendering=!0,this._render(e,t,s)}catch(i){console.error(`Exception during rendering: ${i}:\n${i.stack}`)}finally{this._isRendering=!1}return new oe(this._pluginInput.get(O.FINAL),null)}_render(e,t,s){const i=0===t;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=i,this._disposeBindBuffers();const{camera:r,contentCamera:a,mode:o,alignPixelEnabled:d}=e;this._state.value=o,this._bindParameters.output=0,this._bindParameters.emissions=this._emissions,this._bindParameters.alignPixelEnabled=d,this._bindParameters.decorations=!s,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;const l=!s||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=l?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(R.VIEWSHED),this._bindParameters.cutFillComputationEnabled=this._nodes.produces(R.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(R.CUTFILL_COLOR),this._renderOverlay(),r.setGLViewport(this._rctx);const u=this._framebuffer,m=u.initialize(r.fullWidth,r.fullHeight,this._backgroundColor),_=this._needsLastFrameColor;_?(m?.retain(_-1),m?.setName("last frame color"),this._bindParameters.reprojection.lastFrameColor=m):m?.release(),this._ensureBindParameters(r,a),this._plugins.sortTestsTransparentOrderedSlots(Te),this._plugins.prepareRender(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!s,this._shadowAccumulator.fullyRecompute=!i,this._shadowAccumulator.updateCamera(r),this._hasTransparentGeometry=this._plugins.produces(0,...ge),this._precompilePrepasses(),this.performanceInfo.advance(le.PREPARE);const p=this._computeShadowDepthRange(r);this._pluginInput.set("normals",this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowMap(r,a,this._bindParameters.lighting.mainLight.direction,p),this._renderShadowAccumulation(p),u.bind(),this._bindParameters.mainDepth=u.depth.attachment,this._precompileShaders(i),this._bindParameters.output=0,this._renderOpaque(),this._renderPreTransparent(),this._renderTransparent(),this.hasReflections&&(this._bindParameters.depth=h(this._bindParameters.depth),this._bindParameters.reprojection.lastFrameColor=h(this._bindParameters.reprojection.lastFrameColor)),this._bindParameters.shadowMap.disposeOutput(5),u.update(e=>this._renderNodes(R.CUTFILL_COMPUTATION,e)),this._pluginInput.set(R.FOCUSAREA,this._renderFocusAreaGeometry()),u.update(e=>this._renderNodes(R.TRANSPARENT_ENVIRONMENT,e)),u.update(e=>this._renderNodes(R.VIEWSHED,e)),u.update(e=>this._renderNodes(R.LASERLINES,e)),this._nodes.requireGeometryDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),u.update(e=>this._renderNodes(R.FOCUSAREA_COLOR,e)),u.update(e=>this._renderNodes(R.CUTFILL_COLOR,e)),this._pluginInput.release(R.FOCUSAREA),this._pluginInput.release(R.GROUND_DEPTH),u.update(e=>this._renderNodes(R.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass());const c=2===t?this._renderObjectAndLayerIdColor():null;u.update(e=>this._renderNodes(O.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),this._bindParameters.shadowHighlight=n(this._bindParameters.shadowHighlight),u.update(e=>this._renderNodes(R.ANTIALIASING,e));const f=this._hasTransparentGeometry?2:1,b=this._bindParameters.emissions;let g;return this._bindParameters.emissions=0,this._hasHUDHighlights&&u.update(e=>this._renderHUD(f,e)),u.update(e=>this._renderNodes(R.HIGHLIGHT_COLOR,e)),this._hasHUDHighlights||u.update(e=>this._renderHUD(f,e)),this._bindParameters.emissions=b,u.update(e=>this._renderNodes(R.MAGNIFIER,e)),u.update(e=>this._renderNodes(O.FINAL,e)),i&&this._blit.toFramebuffer(u.color,this._bindParameters),this.hasGlobalIllumination&&(this._bindParameters.reprojection.lastFrameDepth=this._bindParameters.depth,0!==this._emissions&&(this._bindParameters.reprojection.lastFrameEmission=u.color.obtainAttachment(ue))),this._testsNeedsDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),this._releaseFBOs(),u.releaseDepth(),this._bindParameters.reprojection.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),i||(g=u.color,g.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new oe(g,c)}_precompileShaders(e){++this._plugins.context.techniques.precompiling;const t=this._bindParameters;t.output=0;const s=t.emissions;if(this._precompileOpaqueGeometry(),this._nodes.precompile(t.hasOpaqueEmission,R.OPAQUE_ENVIRONMENT,R.GAUSSIAN_SPLAT,R.OPAQUE_OCCLUSION_QUERY,R.VOXEL),this._precompileOpaqueGeometry(),t.output=3,this._plugins.precompile(...Pe),t.output=0,this._plugins.precompile(...Pe),this._hasTransparentGeometry){const e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(t,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(t,!1,1),this._precompileTransparentGeometry(),t.hasTransparentEmission&&(t.emissions=3)}this._nodes.precompile(t.hasOpaqueEmission,R.FOCUSAREA),this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,t),this._hasTransparentGeometry||this._plugins.precompile(15),this._nodes.precompile(t.hasOpaqueEmission,R.TRANSPARENT_ENVIRONMENT,R.VIEWSHED,R.CUTFILL_COMPUTATION,R.CUTFILL_COLOR,R.LASERLINES,R.FOCUSAREA_COLOR,R.OCCLUDED,R.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.emissions=0,this._precompileHUD(0),this._precompileHUD(1),t.emissions=s,this._hasHighlights&&(t.highlights.forEach((e,s)=>{t.highlightLevel=s,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(13,12)}),t.highlightLevel=null,this._nodes.precompile(t.hasOpaqueEmission,R.HIGHLIGHT_COLOR)),t.highlightMixTexture=null,this._nodes.precompile(t.hasOpaqueEmission,O.COMPOSITE,R.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(8),t.hasOpaqueEmission&&(t.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.precompile(8),t.transparentWithoutDepthEmissionDimmingPass=!1),e&&this._blit.precompile(),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(R.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(le.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces(R.OBJECT_AND_LAYER_ID_COLOR))return null;const e=this._bindParameters.output;++this._techniques.precompiling;const{width:t,height:s}=this._framebuffer.size;let i=this.fboCache.acquire(t,s,R.OBJECT_AND_LAYER_ID_COLOR).acquireDepth(14);return i=this._renderNodes(R.OBJECT_AND_LAYER_ID_COLOR,i),--this._techniques.precompiling,this._bindParameters.output=e,i}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,s=0===e;if(s||t){const e=s?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const r=Math.max(e,i);this._animationTimestep.frame(r,s)}}readMainDepth(e,t){const{mainDepth:s,camera:i}=this._bindParameters;if(!s)return;const r=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,"linear depth");this._rctx.bindFramebuffer(r.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(C),this._compositor.blitDepthToLinearDepth(this._bindParameters,s),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),r.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,me.UNSIGNED_BYTE,t),r.release()}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){const t=this._needsEdges;if(!t)return;const{width:s,height:i}=this._framebuffer.size,r=this.fboCache.acquire(s,i,"edges");r.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(C),t.render(this._bindParameters,e),r.detachDepth(),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,r.getTexture()),r.release(),this.performanceInfo.advance(1===e?le.OPAQUE_EDGES:le.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(le.OVERLAY)}_renderShadowMap(e,t,s,i){if(!this.shadowsEnabled)return;const r=this._bindParameters.shadowMap;if(r.start(e,s,i,this.isFeatureEnabled(5),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight){this._renderShadowCascades(6,r),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t);const s=this._bindParameters.output;this._bindParameters.output=0,this._bindParameters.shadowHighlight=this._nodes.produce(R.SHADOW_HIGHLIGHT,this._pluginInput),this._bindParameters.output=s,r.disposeOutput(6),r.clear(),this._renderShadowCascades(7,r)}else this._renderShadowCascades(5);e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this._needsShadowHighlight&&(this._bindParameters.depth=h(this._bindParameters.depth)),this.performanceInfo.advance(R.SHADOWMAP)}_precompileShadowCascades(e){0!==this._bindParameters.shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){const s=this._bindParameters.output,i=t===this._bindParameters.shadowMap&&6!==e;t.bindFramebuffer();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e),i&&this._renderShadowNodes();t.finish(e),this._bindParameters.output=s}_renderShadowNodes(){const e=this._bindParameters.shadowMap.renderTarget;e&&(this._renderNodes(R.SHADOWMAP,e),this._pluginInput.set(R.SHADOWMAP,null))}get _needsLastFrameColor(){return+this.hasReflections+ +this.hasGlobalIllumination}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this.hasGlobalIllumination+ +this._shadowAccumulator.requiresDepth+ +this._testsNeedsDepth+ +this._needsShadowHighlight}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements}_renderAmbientIlluminationAndDepth(){this._bindParameters.depth=n(this._bindParameters.depth);const e=this._pluginInput.get("normals");if(e){this._pluginInput.set(R.AMBIENT_ILLUMINATION,this._hasGlobalIlluminationFlag?this._renderGlobalIllumination():this._renderSSAO());const t=this._needsDepth;t?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(3),this._bindParameters.depth=e.obtainDepthTexture(),this._bindParameters.depth?.retain(t-1),this.performanceInfo.advance(le.DEPTH)):e.detachDepth(),this.hasAmbientIllumination&&this._pluginInput.release("normals")}else this._hasGlobalIlluminationFlag&&(this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIlluminationEnabled=this._keepGlobalIlluminationShadingAlive),this._renderAllGeometryDepth()}_renderAllGeometryDepth(){const e=this._needsDepth;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,i=this.fboCache.acquire(t,s,"geometry depth",14);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._bindParameters.depth=i.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),i.release(),this.performanceInfo.advance(le.DEPTH)}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return J.Zero;const t=X(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),this._bindParameters.shadowMap.enabled&&t.union(this._nodes.queryDepthRange(R.SHADOWMAP,e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=J.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<U)return void(this.sceneDepthRange.value=J.Infinite);const t=e.clone();t.near=N,t.far=1e10;const s=X(t,this._plugins.plugins,this.stage.layers,1);s.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(s)||(this.sceneDepthRange.value=s)}get _normalsRequired(){return this._nodes.require("normals",...S,R.VIEWSHED,R.LASERLINES)+(this.hasAmbientIllumination?1:0)}_precompilePrepasses(){this._normalsRequired?(this._precompilePlugins(4,we),this._needsDepth&&this._precompilePlugins(3,Ee)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._nodes.precompile(this._bindParameters.hasEmission,R.SHADOW_HIGHLIGHT),this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator.active&&(this._shadowAccumulator.precompilePrepass(),this._precompileAllGeometry(5)),this.hasAmbientIllumination&&this._normalsRequired&&this._nodes.precompile(this._bindParameters.hasEmission,R.AMBIENT_ILLUMINATION)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,i=this.fboCache.acquire(t,s,"normals",5);i.acquireDepth(14),this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(C,!0,!0),this._bindParameters.output=4,this._plugins.render(...we);const r=this._nodes.optional("normals",...S,R.VIEWSHED);return i.retain(e+r-1),this.performanceInfo.advance(le.NORMALS),i}_renderSSAO(){this._bindParameters.globalIlluminationEnabled=!1;const e=this._pluginInput.get("normals");return this.hasAmbientIllumination&&e?(this._bindParameters.ssao=this._nodes.produce(R.AMBIENT_ILLUMINATION,this._pluginInput),this._bindParameters.ssao&&this.performanceInfo.advance(le.AMBIENT_ILLUMINATION),this._bindParameters.ssao):null}_renderGlobalIllumination(){if(!this.hasGlobalIllumination)return this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIlluminationEnabled=this._keepGlobalIlluminationShadingAlive,null;const e=this._nodes.produce(R.AMBIENT_ILLUMINATION,this._pluginInput);return this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIllumination=e,this._bindParameters.globalIlluminationEnabled=!0,this.performanceInfo.advance(this.hasGlobalIlluminationHighQuality?le.AMBIENT_ILLUMINATION_HIGH_QUALITY:le.AMBIENT_ILLUMINATION),e}_releaseGlobalIlluminationBuffers(){const e=this._bindParameters;e.reprojection.lastFrameColor=h(e.reprojection.lastFrameColor),e.reprojection.lastFrameDepth=h(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=h(e.reprojection.lastFrameEmission),e.globalIllumination=h(e.globalIllumination),e.globalIlluminationEnabled=!1}_precompileAllGeometry(e){const t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...Pe),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const s of t)this._renderContext.renderOccludedMask=s,this.precompileSlots(e,...Ie);this._renderContext.renderOccludedMask=ee}renderSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(9),this.renderSlots(e,...Ie),this._renderContext.renderOccludedMask=ee}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Oe[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(16),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(14)}precompileViewshedShadowMap(){this._precompileAllGeometry(8)}precompileCutFillOrthographicReferenceDepth(){this._precompilePlugins(9,Re)}_precompilePlugins(e,t){const s=this._bindParameters.output;this._bindParameters.output=e,this._plugins.precompile(...t),this._bindParameters.output=s}renderViewshedShadowMap(e){const{camera:t,contentCamera:s}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._ensureBindParametersCamera(t,s),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=i}renderCutFillOrthographicReferenceDepth(e){const{camera:t,contentCamera:s}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...Re),this._ensureBindParametersCamera(t,s),t.setGLViewport(this._rctx),this._bindParameters.output=i}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;const{width:e,height:t}=this._framebuffer.size,s=this.fboCache.acquire(e,t,R.GROUND_DEPTH,14);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,s.fbo,256),this._framebuffer.bind(),s}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...Ee)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...be),this._nodes.precompile(this._bindParameters.hasEmission,"opaque-color"))}_renderOpaqueGeometry(){this._plugins.render(...be)}_renderTransparentGeometry(){this._plugins.render(...ge),this._hasTransparentGeometry&&this._plugins.render(15)}_renderTransparentGround(){this._plugins.render(...Pe)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;const t=this._bindParameters.output,s=this._bindParameters.hudRenderStyle,i=this._bindParameters.emissions;this._bindParameters.emissions=0,this._bindParameters.hudRenderStyle=e,this._bindParameters.output=1,this._plugins.precompile(...Ae),this._bindParameters.output=2,this._plugins.precompile(...Ae),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...Ae)),this._bindParameters.emissions=i,this._bindParameters.output=t,this._bindParameters.hudRenderStyle=s}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;const s=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);const i=!!t.getTexture(ue);return this._compositor.compositePreMultipliedAlpha(this._bindParameters,s.getTexture(),i),s.release(),this.performanceInfo.advance(0===e?le.HUD_OCCLUDED:le.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:s}=this,{width:i,height:r}=this._framebuffer.size,{highlights:a}=s,n=a.length>B?3:1,h=e.acquire(i,r,"highlights",n);h.acquireDepth(14);const o=this._plugins.produces(10,0);return o&&this._framebuffer.color.fbo&&h.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,h.fbo,1024),t.bindFramebuffer(h.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),o||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(h.fbo),V(t,e,i,r,s,()=>this._renderHighlightGeometries()),h.detachDepth(),this.performanceInfo.advance(le.HIGHLIGHTS),h.retain(this._nodes.require("highlights",...D)+this._nodes.optional("highlights",...D)-1),h}_renderHighlightGeometries(){this._plugins.render(...Ce),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e){this._shadowAccumulator.updateDepthRange(e);const t=this._shadowAccumulator.requiresDepth;this._bindParameters.output=0,this._shadowAccumulator.renderAccumulation(this._bindParameters)&&this.performanceInfo.advance(le.ACCUMULATED_SHADOWS),this._shadowAccumulator.updateMask(),t&&(this._bindParameters.depth=h(this._bindParameters.depth))}_precompileTransparentGeometry(){y(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...ge),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=2,this._plugins.precompile(...ge),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=0):this._plugins.precompile(...ge)}_renderOIT(e,t=2){const s=1===e,{width:i,height:r}=this._framebuffer.size,a=s?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=h.useFloatBlend.value?8:5,d=h.output;h.output=1;const l=s?"oit hud":"oit",u=this.fboCache.acquire(i,r,l,o).acquireColor(ue,this.hasFloatBlend?7:0,"oit alpha"),m=h.hasEmission&&(0===e||1!==t);m&&u.acquireColor(_e,o,"oit emissive"),s||u.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(u.fbo),this._rctx.clearFramebuffer(K),m&&this._rctx.clearBuffer(2,K),a(),u.detachDepth(),h.output=2;const _=this.fboCache.acquire(i,r,s?"oit front hud":"oit front");m&&_.acquireColor(ue,o,"oit front emissive"),s?_.acquireDepth(this._hudDepthFormat):_.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(_.fbo),this._rctx.clearFramebuffer(C,s),a(),_.detachDepth();const p=this._pluginsHas.occludedHudElements&&!s,c=p&&0!==h.emissions?_e:ue;let f;return h.hudOcclusion=n(this._bindParameters.hudOcclusion),h.output=0,s?(f=this.fboCache.acquire(i,r,"oit composite hud"),this._rctx.bindFramebuffer(f.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(0!==h.emissions&&this._framebuffer.ensureEmissionAttachment(),p&&(this._framebuffer.color.acquireColor(c,0,"hud occlusion"),this._rctx.clearBuffer(c-pe,C)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,u,_,h,p,e,this._fboCache.debugCallback),f?.detachDepth(),s||(m&&(this._bindParameters.emissions=3),p&&(h.hudOcclusion=this._framebuffer.color.obtainAttachment(c))),_.release(),u.release(),h.output=d,f}get _hudDepthFormat(){return this.isFeatureEnabled(7)?14:13}get _needsOpaquePass(){return this.plugins.produces(0,...be)||this.plugins.produces(5,...be)||this.plugins.produces(3,3)}_renderOpaque(){const e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._pluginInput.set(R.GROUND_DEPTH,this._blitGroundDepth()),this._plugins.render(2,3));const t=this._framebuffer;t.update(t=>this._renderNodes(O.OPAQUE,t,e)),this.fboCache.debugCallback?.(O.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(R.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(R.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderPreTransparent(){this._framebuffer.update(e=>this._renderNodes(R.GAUSSIAN_SPLAT,e)),this.fboCache.debugCallback?.(R.GAUSSIAN_SPLAT,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(R.OPAQUE_OCCLUSION_QUERY,e)),this.fboCache.debugCallback?.(R.OPAQUE_OCCLUSION_QUERY,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(R.VOXEL,e)),this.fboCache.debugCallback?.(R.VOXEL,this._framebuffer.color.fbo)}_renderTransparent(){const e=this._framebuffer;this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&this._renderOIT(0),e.update(e=>this._renderNodes(O.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(O.TRANSPARENT,e.color.fbo),this._hasTransparentGeometry||this._plugins.render(15),this._renderEdges(0),this._bindParameters.ssao=n(this._bindParameters.ssao),e.update(e=>this._renderNodes(R.TRANSPARENT_NO_DEPTH,e)),this.fboCache.debugCallback?.(R.TRANSPARENT_NO_DEPTH,e.color.fbo),this._renderTransparentMaterialWithoutDepth()}_renderTransparentMaterialWithoutDepth(){if(this._framebuffer.bind(),this._plugins.render(8),this._bindParameters.hasEmission){const e=this._rctx.setDrawBuffers([ce,ue]);this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.render(8),this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!1,this._rctx.setDrawBuffers(e)}this.performanceInfo.advance(le.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,s=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return s&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),this._fboCache.debugCallback?.(e,i.fbo),i}_ensureBindParameters(e,t){this._ensureBindParametersCamera(e,t),this._ensureBindParametersWeatherFader(),this._ensureBindParametersScreenSpaceReflections(),this._ensureBindParametersReprojection()}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(){1===this.stage.viewingMode&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,this.renderContext.time,this.stage.view.qualitySettings.fadeDuration),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersScreenSpaceReflections(){const{time:e}=this.renderContext,{screenSpaceReflections:t}=this._bindParameters;if(this.hasReflections){null==this._ssrEnableTime&&(this._ssrEnableTime=e);const s=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=s>0?Math.min(s,e-this._ssrEnableTime)/s:1,t.fadeFactor<1&&this._requestRender()}else this._ssrEnableTime=null}_ensureBindParametersReprojection(){if(!(this.hasReflections||this.hasGlobalIllumination))return void(this._reprojectionMatrix=w);const{reprojection:e,camera:t}=this._bindParameters,{lastFrameCamera:s}=e,i=!s.equals(t);if(i?(b(Ne,t.viewMatrix),b(De,t.projectionMatrix),g(Fe,Ne,De),g(Fe,s.viewMatrix,Fe),g(Fe,s.projectionMatrix,Fe),this._reprojectionMatrix=Fe):this._reprojectionMatrix=w,this.hasGlobalIllumination){const{viewMatrix:t}=e;i?(g(Ge,s.viewMatrix,Ne),P(t,Ge)):P(t,w)}}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,s,i){this._bindParameters.updateLighting(e,t,s,i),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}get test(){}};e([p()],fe.prototype,"_inGlobeView",void 0),e([p({readOnly:!0})],fe.prototype,"highResolutionAtmosphere",null),e([p()],fe.prototype,"_edgeView",void 0),e([p()],fe.prototype,"updating",null),fe=e([c("esri.views.3d.webgl-engine.lib.Renderer")],fe);const be=[0,1,2,3],ge=[7,6,4,5],Pe=[7,6],we=[0,1,2,4,...Pe],Ee=[3,5],Ie=[2,4,8],Ae=[16,12,14,13],Ce=[4,5,2,3,0,1,...Pe],Te=[4,8,5,11],Oe={0:[13],1:[12],2:[13,12],3:[13,12]},Re=[0,1,...Pe],Se=["normals","highlights"],De=E(),Ne=E(),Fe=E(),Ge=E();function He(e){return t=>e.immediate.schedule(t)}export{fe as Renderer};
2
+ import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as s}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as i,abortMaybe as r,destroyMaybe as a,releaseMaybe as n,releaseReferencedMaybe as h}from"../../../../core/maybe.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{watch as d,syncAndInitial as l,initial as u,sync as m}from"../../../../core/reactiveUtils.js";import{signal as _}from"../../../../core/signal.js";import{property as p,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{equals as f,invert as b,multiply as g,copy as P}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as w,create as E}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as I}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as A,ZEROS as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as T}from"../../../../geometry/support/Indices.js";import{RenderNodeOutput as O,InternalRenderCategory as R,AllRenderNodeOutputs as S,AllInternalRenderNodeOutputs as D}from"../../webgl.js";import{minNearDistanceInMeters as N}from"../../state/NearFarHeuristic.js";import{debugFlags as F}from"../../support/debugFlags.js";import{computeShadowsEnabled as G}from"../../support/sunUtils.js";import{FBOCache as x}from"../core/FBOCache.js";import{RenderPassManager as H}from"../core/renderPasses/RenderPassManager.js";import{isColor as y}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as v}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as M}from"../effects/RenderNodes.js";import{RenderPluginManager as L}from"../effects/RenderPluginManager.js";import{WeatherFader as q}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as j}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as U}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as B,renderHighlightBuffer as V}from"../effects/highlight/Highlight.js";import{OITBlend as k}from"../effects/transparency/OITBlend.js";import{AnimationTimer as W}from"./AnimationTimer.js";import{AnimationTimeStep as Q}from"./AnimationTimeStep.js";import{BoundingInfo as z}from"./BoundingInfo.js";import{Compositor as Y}from"./Compositor.js";import{DepthRange as J}from"./DepthRange.js";import{depthRangeFromScene as X}from"./depthRangeUtils.js";import{MainFramebuffer as $}from"./MainFramebuffer.js";import{NavigationDepthCache as K}from"./NavigationDepthCache.js";import{blendingColorAlphaClear as Z}from"./OrderIndependentTransparency.js";import{RenderContext as ee,defaultRenderOccludedMask as te}from"./RenderContext.js";import{RendererBase as se}from"./RendererBase.js";import{setupFeatureDefaults as ie}from"./RenderFeature.js";import{RenderPluginInput as re}from"./RenderPluginInput.js";import{ShadowAccumulator as ae}from"./ShadowAccumulator.js";import{ShadowMap as ne}from"./ShadowMap.js";import he from"./SliceHelper.js";import{MergedRenderer as oe}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as de}from"../parts/renderUtils.js";import{RendererPerformanceInfo as le,PerformanceCategory as ue}from"../statistics/RendererPerformanceInfo.js";import{ColorAttachment1 as me,PixelType as _e,ColorAttachment2 as pe,ColorAttachment0 as ce,DrawBufferNone as fe}from"../../../webgl/enums.js";const be=has("disable-feature:async-navigation-3d-depth-readback");let ge=class extends se{constructor(e,t,s,i,r){super({stage:e}),this._techniques=s,this._rctx=i,this._requestRender=r,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new H,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=A(0,0,0,1),this._sliceHelper=new he,this.sceneDepthRange=_(J.Infinite),this._state=_(2),this._hasGlobalIlluminationFlag=!!has("global-illumination"),this._hasAnimations=!1,this._animationTimestep=new Q,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=_(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new re,this._hasTransparentGeometry=!1,this._releaseNodeInputs=e=>{for(const t of Ne)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new x(i),this._compositor=new Y(i,s),this._renderStateFeatures=_(ie(e.view.qualityProfile));const a=new ne(this._fboCache,e.viewingMode);this._renderContext=new ee(this._rctx,a,s),this._framebuffer=new $(this._fboCache,this._bindParameters),this._performanceInfo=new le(this._rctx),this._blit=new U(s),this.navigationDepthCache=new K(this._rctx,this._fboCache,s,()=>this._requestRender(0)),this._shadowAccumulator=new ae(this.fboCache,s,e,(t,s,i)=>{const r=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,s,i,!0,r),this._renderShadowCascades(5,t.shadowMap),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},r),this._nodes=new M(this._renderContext),this._plugins=new L({renderContext:this._renderContext,techniques:s,materials:t,requestRender:r,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new q({view:e.view,context:this._renderContext}),this.addHandles([d(()=>e.view.state.camera,()=>r(),l),d(()=>F.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},r()},u),d(()=>e.view.environment.background?.color,e=>{const t=e?e.toUnitRGBA():C;I(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),r()},l),d(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=v,l),d(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},m),d(()=>this._bindParameters.clouds.data?.state,()=>r(),m),d(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,r()},u),d(()=>"sun"===e.view.environment.lighting?.type,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},l)])}destroy(){this._gpuTimerHandle=i(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=r(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.navigationDepthCache.destroy(),this._fboCache.destroy(),this._fboCache=null,this._renderContext.destroy(),this._plugins.destroy(),this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._performanceInfo=null,z.prune(),oe.prune(),T()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new k(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=ie(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,s){this._renderStateFeatures.mutate(i=>i.set(t,e,s)),this._requestRender()}setTime(e){this._renderContext.time=e}get hasReflections(){return this._bindParameters.screenSpaceReflections.enabled=this._pluginsHas.water&&this.isFeatureEnabled(4),this._bindParameters.screenSpaceReflections.enabled}get _hasHighlights(){return this._plugins.produces(10,2,4,18,12,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,12,13,14)}get hasAmbientIllumination(){return this.isFeatureEnabled(3)&&!this._inGlobeView}get hasGlobalIllumination(){return this._hasGlobalIlluminationFlag&&this.hasAmbientIllumination}get hasGlobalIlluminationHighQuality(){return this.hasGlobalIllumination&&this.isFeatureEnabled(10)}get _keepGlobalIlluminationShadingAlive(){return this._hasGlobalIlluminationFlag&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get _emissions(){return this._plugins.emissions}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(9)}get highResolutionAtmosphere(){return this.isFeatureEnabled(2)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._bindParameters.globalIllumination=n(this._bindParameters.globalIllumination),this._bindParameters.reprojection.lastFrameDepth=n(this._bindParameters.reprojection.lastFrameDepth),this._bindParameters.reprojection.lastFrameEmission=n(this._bindParameters.reprojection.lastFrameEmission),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=s(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");o(e);const s=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:ye(this.stage.view.resourceController)});return this.addHandles(d(()=>s.updating,()=>this._requestRender(),m)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(s)),this._edgeViewCallbacks.length=0,s})),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&f(this._bindParameters.reprojection.matrix,w)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}modifyShadowsEnabled(){const e=this.stage.view.environmentManager.referencePositionGeographic,t=null==e||G(e[2],this.stage.viewingMode),s=this.stage.view.environment.lighting.directShadowsEnabled&&t;this._bindParameters.shadowMap.enabled!==s&&(this._bindParameters.shadowMap.enabled=s,this._requestRender(1))}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){e.shadowCast&&this._shadowAccumulator.setParameters(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}addRenderer(e){this._plugins.add(e)}removeRenderer(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this._occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get _occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){const has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,13),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...Te),has.water=this._plugins.produces(4,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new W(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const s=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==s&&(this._gpuTimerHandle=s?i(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,s=!1){try{return this._isRendering=!0,this._render(e,t,s)}catch(i){console.error(`Exception during rendering: ${i}:\n${i.stack}`)}finally{this._isRendering=!1}return new de(this._pluginInput.get(O.FINAL),null)}_render(e,t,s){const i=0===t;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=i,this._disposeBindBuffers();const{camera:r,contentCamera:a,mode:o,alignPixelEnabled:d}=e;this._state.value=o,this._bindParameters.output=0,this._bindParameters.emissions=this._emissions,this._bindParameters.alignPixelEnabled=d,this._bindParameters.decorations=!s,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;const l=!s||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=l?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(R.VIEWSHED),this._bindParameters.cutFillComputationEnabled=this._nodes.produces(R.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(R.CUTFILL_COLOR),this._renderOverlay(),r.setGLViewport(this._rctx);const u=this._framebuffer,m=u.initialize(r.fullWidth,r.fullHeight,this._backgroundColor),_=this._needsLastFrameColor;_?(m?.retain(_-1),m?.setName("last frame color"),this._bindParameters.reprojection.lastFrameColor=m):m?.release(),this._ensureBindParameters(r,a),this._plugins.sortTestsTransparentOrderedSlots(Re),this._plugins.prepareRender(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!s,this._shadowAccumulator.fullyRecompute=!i,this._shadowAccumulator.updateCamera(r),this._hasTransparentGeometry=this._plugins.produces(0,...we),this._precompilePrepasses(),this.performanceInfo.advance(ue.PREPARE);const p=this._computeShadowDepthRange(r);this._pluginInput.set("normals",this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowMap(r,a,this._bindParameters.lighting.mainLight.direction,p),this._renderShadowAccumulation(p),u.bind(),this._bindParameters.mainDepth=u.depth.attachment,this._precompileShaders(i),this._bindParameters.output=0,this._renderOpaque(),this._renderPreTransparent(),this._renderTransparent(),this.hasReflections&&(this._bindParameters.depth=h(this._bindParameters.depth),this._bindParameters.reprojection.lastFrameColor=h(this._bindParameters.reprojection.lastFrameColor)),this._bindParameters.shadowMap.disposeOutput(5),u.update(e=>this._renderNodes(R.CUTFILL_COMPUTATION,e)),this._pluginInput.set(R.FOCUSAREA,this._renderFocusAreaGeometry()),u.update(e=>this._renderNodes(R.TRANSPARENT_ENVIRONMENT,e)),u.update(e=>this._renderNodes(R.VIEWSHED,e)),u.update(e=>this._renderNodes(R.LASERLINES,e)),this._nodes.requireGeometryDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),u.update(e=>this._renderNodes(R.FOCUSAREA_COLOR,e)),u.update(e=>this._renderNodes(R.CUTFILL_COLOR,e)),this._pluginInput.release(R.FOCUSAREA),this._pluginInput.release(R.GROUND_DEPTH),u.update(e=>this._renderNodes(R.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass());const c=2===t?this._renderObjectAndLayerIdColor():null;u.update(e=>this._renderNodes(O.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),this._bindParameters.shadowHighlight=n(this._bindParameters.shadowHighlight),u.update(e=>this._renderNodes(R.ANTIALIASING,e));const f=this._hasTransparentGeometry?2:1,b=this._bindParameters.emissions;let g;return this._bindParameters.emissions=0,this._hasHUDHighlights&&u.update(e=>this._renderHUD(f,e)),u.update(e=>this._renderNodes(R.HIGHLIGHT_COLOR,e)),this._hasHUDHighlights||u.update(e=>this._renderHUD(f,e)),this._bindParameters.emissions=b,u.update(e=>this._renderNodes(R.MAGNIFIER,e)),u.update(e=>this._renderNodes(O.FINAL,e)),i&&(this._blit.toFramebuffer(u.color,this._bindParameters),be||2!==o&&0!==o||this.navigationDepthCache.update(this._bindParameters,u.depth.attachment,this._renderContext.time)),this.hasGlobalIllumination&&(this._bindParameters.reprojection.lastFrameDepth=this._bindParameters.depth,0!==this._emissions&&(this._bindParameters.reprojection.lastFrameEmission=u.color.obtainAttachment(me))),this._testsNeedsDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),this._releaseFBOs(),u.releaseDepth(),this._bindParameters.reprojection.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),i||(g=u.color,g.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new de(g,c)}_precompileShaders(e){++this._plugins.context.techniques.precompiling;const t=this._bindParameters;t.output=0;const s=t.emissions;if(this._precompileOpaqueGeometry(),this._nodes.precompile(t.hasOpaqueEmission,R.OPAQUE_ENVIRONMENT,R.GAUSSIAN_SPLAT,R.OPAQUE_OCCLUSION_QUERY,R.VOXEL),this._precompileOpaqueGeometry(),t.output=3,this._plugins.precompile(...Ee),t.output=0,this._plugins.precompile(...Ee),this._hasTransparentGeometry){const e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(t,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(t,!1,1),this._precompileTransparentGeometry(),t.hasTransparentEmission&&(t.emissions=3)}this._nodes.precompile(t.hasOpaqueEmission,R.FOCUSAREA),this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,t),this._hasTransparentGeometry||this._plugins.precompile(15),this._nodes.precompile(t.hasOpaqueEmission,R.TRANSPARENT_ENVIRONMENT,R.VIEWSHED,R.CUTFILL_COMPUTATION,R.CUTFILL_COLOR,R.LASERLINES,R.FOCUSAREA_COLOR,R.OCCLUDED,R.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.emissions=0,this._precompileHUD(0),this._precompileHUD(1),t.emissions=s,this._hasHighlights&&(t.highlights.forEach((e,s)=>{t.highlightLevel=s,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(13,12)}),t.highlightLevel=null,this._nodes.precompile(t.hasOpaqueEmission,R.HIGHLIGHT_COLOR)),t.highlightMixTexture=null,this._nodes.precompile(t.hasOpaqueEmission,O.COMPOSITE,R.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(8),t.hasOpaqueEmission&&(t.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.precompile(8),t.transparentWithoutDepthEmissionDimmingPass=!1),e&&this._blit.precompile(),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(R.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(ue.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces(R.OBJECT_AND_LAYER_ID_COLOR))return null;const e=this._bindParameters.output;++this._techniques.precompiling;const{width:t,height:s}=this._framebuffer.size;let i=this.fboCache.acquire(t,s,R.OBJECT_AND_LAYER_ID_COLOR).acquireDepth(14);return i=this._renderNodes(R.OBJECT_AND_LAYER_ID_COLOR,i),--this._techniques.precompiling,this._bindParameters.output=e,i}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,s=0===e;if(s||t){const e=s?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const r=Math.max(e,i);this._animationTimestep.frame(r,s)}}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}readMainDepth(e,t){const{mainDepth:s,camera:i}=this._bindParameters;if(!s)return;const r=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,"linear depth");this._rctx.bindFramebuffer(r.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(C),this._compositor.blitDepthToLinearDepth(this._bindParameters,s),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),r.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,_e.UNSIGNED_BYTE,t),r.release()}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){const t=this._needsEdges;if(!t)return;const{width:s,height:i}=this._framebuffer.size,r=this.fboCache.acquire(s,i,"edges");r.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(C),t.render(this._bindParameters,e),r.detachDepth(),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,r.getTexture()),r.release(),this.performanceInfo.advance(1===e?ue.OPAQUE_EDGES:ue.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(ue.OVERLAY)}_renderShadowMap(e,t,s,i){if(!this.shadowsEnabled)return;const r=this._bindParameters.shadowMap;if(r.start(e,s,i,this.isFeatureEnabled(5),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight){this._renderShadowCascades(6,r),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t);const s=this._bindParameters.output;this._bindParameters.output=0,this._bindParameters.shadowHighlight=this._nodes.produce(R.SHADOW_HIGHLIGHT,this._pluginInput),this._bindParameters.output=s,r.disposeOutput(6),r.clear(),this._renderShadowCascades(7,r)}else this._renderShadowCascades(5);e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this._needsShadowHighlight&&(this._bindParameters.depth=h(this._bindParameters.depth)),this.performanceInfo.advance(R.SHADOWMAP)}_precompileShadowCascades(e){0!==this._bindParameters.shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){const s=this._bindParameters.output,i=t===this._bindParameters.shadowMap&&6!==e;t.bindFramebuffer();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e),i&&this._renderShadowNodes();t.finish(e),this._bindParameters.output=s}_renderShadowNodes(){const e=this._bindParameters.shadowMap.renderTarget;e&&(this._renderNodes(R.SHADOWMAP,e),this._pluginInput.set(R.SHADOWMAP,null))}get _needsLastFrameColor(){return+this.hasReflections+ +this.hasGlobalIllumination}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this.hasGlobalIllumination+ +this._shadowAccumulator.requiresDepth+ +this._testsNeedsDepth+ +this._needsShadowHighlight}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements}_renderAmbientIlluminationAndDepth(){this._bindParameters.depth=n(this._bindParameters.depth);const e=this._pluginInput.get("normals");if(e){this._pluginInput.set(R.AMBIENT_ILLUMINATION,this._hasGlobalIlluminationFlag?this._renderGlobalIllumination():this._renderSSAO());const t=this._needsDepth;t?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(3),this._bindParameters.depth=e.obtainDepthTexture(),this._bindParameters.depth?.retain(t-1),this.performanceInfo.advance(ue.DEPTH)):e.detachDepth(),this.hasAmbientIllumination&&this._pluginInput.release("normals")}else this._hasGlobalIlluminationFlag&&(this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIlluminationEnabled=this._keepGlobalIlluminationShadingAlive),this._renderAllGeometryDepth()}_renderAllGeometryDepth(){const e=this._needsDepth;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,i=this.fboCache.acquire(t,s,"geometry depth",14);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._bindParameters.depth=i.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),i.release(),this.performanceInfo.advance(ue.DEPTH)}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return J.Zero;const t=X(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),this._bindParameters.shadowMap.enabled&&t.union(this._nodes.queryDepthRange(R.SHADOWMAP,e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=J.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<j)return void(this.sceneDepthRange.value=J.Infinite);const t=e.clone();t.near=N,t.far=1e10;const s=X(t,this._plugins.plugins,this.stage.layers,1);s.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(s)||(this.sceneDepthRange.value=s)}get _normalsRequired(){return this._nodes.require("normals",...S,R.VIEWSHED,R.LASERLINES)+(this.hasAmbientIllumination?1:0)}_precompilePrepasses(){this._normalsRequired?(this._precompilePlugins(4,Ie),this._needsDepth&&this._precompilePlugins(3,Ae)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._nodes.precompile(this._bindParameters.hasEmission,R.SHADOW_HIGHLIGHT),this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator.active&&(this._shadowAccumulator.precompilePrepass(),this._precompileAllGeometry(5)),this.hasAmbientIllumination&&this._normalsRequired&&this._nodes.precompile(this._bindParameters.hasEmission,R.AMBIENT_ILLUMINATION)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,i=this.fboCache.acquire(t,s,"normals",5);i.acquireDepth(14),this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(C,!0,!0),this._bindParameters.output=4,this._plugins.render(...Ie);const r=this._nodes.optional("normals",...S,R.VIEWSHED);return i.retain(e+r-1),this.performanceInfo.advance(ue.NORMALS),i}_renderSSAO(){this._bindParameters.globalIlluminationEnabled=!1;const e=this._pluginInput.get("normals");return this.hasAmbientIllumination&&e?(this._bindParameters.ssao=this._nodes.produce(R.AMBIENT_ILLUMINATION,this._pluginInput),this._bindParameters.ssao&&this.performanceInfo.advance(ue.AMBIENT_ILLUMINATION),this._bindParameters.ssao):null}_renderGlobalIllumination(){if(!this.hasGlobalIllumination)return this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIlluminationEnabled=this._keepGlobalIlluminationShadingAlive,null;const e=this._nodes.produce(R.AMBIENT_ILLUMINATION,this._pluginInput);return this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIllumination=e,this._bindParameters.globalIlluminationEnabled=!0,this.performanceInfo.advance(this.hasGlobalIlluminationHighQuality?ue.AMBIENT_ILLUMINATION_HIGH_QUALITY:ue.AMBIENT_ILLUMINATION),e}_releaseGlobalIlluminationBuffers(){const e=this._bindParameters;e.reprojection.lastFrameColor=h(e.reprojection.lastFrameColor),e.reprojection.lastFrameDepth=h(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=h(e.reprojection.lastFrameEmission),e.globalIllumination=h(e.globalIllumination),e.globalIlluminationEnabled=!1}_precompileAllGeometry(e){const t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...Ee),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const s of t)this._renderContext.renderOccludedMask=s,this.precompileSlots(e,...Ce);this._renderContext.renderOccludedMask=te}renderSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(9),this.renderSlots(e,...Ce),this._renderContext.renderOccludedMask=te}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Se[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(16),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(14)}precompileViewshedShadowMap(){this._precompileAllGeometry(8)}precompileCutFillOrthographicReferenceDepth(){this._precompilePlugins(9,De)}_precompilePlugins(e,t){const s=this._bindParameters.output;this._bindParameters.output=e,this._plugins.precompile(...t),this._bindParameters.output=s}renderViewshedShadowMap(e){const{camera:t,contentCamera:s}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._ensureBindParametersCamera(t,s),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=i}renderCutFillOrthographicReferenceDepth(e){const{camera:t,contentCamera:s}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...De),this._ensureBindParametersCamera(t,s),t.setGLViewport(this._rctx),this._bindParameters.output=i}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;const{width:e,height:t}=this._framebuffer.size,s=this.fboCache.acquire(e,t,R.GROUND_DEPTH,14);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,s.fbo,256),this._framebuffer.bind(),s}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...Ae)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...Pe),this._nodes.precompile(this._bindParameters.hasEmission,"opaque-color"))}_renderOpaqueGeometry(){this._plugins.render(...Pe)}_renderTransparentGeometry(){this._plugins.render(...we),this._hasTransparentGeometry&&this._plugins.render(15)}_renderTransparentGround(){this._plugins.render(...Ee)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;const t=this._bindParameters.output,s=this._bindParameters.hudRenderStyle,i=this._bindParameters.emissions;this._bindParameters.emissions=0,this._bindParameters.hudRenderStyle=e,this._bindParameters.output=1,this._plugins.precompile(...Te),this._bindParameters.output=2,this._plugins.precompile(...Te),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...Te)),this._bindParameters.emissions=i,this._bindParameters.output=t,this._bindParameters.hudRenderStyle=s}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;const s=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);const i=!!t.getTexture(me);return this._compositor.compositePreMultipliedAlpha(this._bindParameters,s.getTexture(),i),s.release(),this.performanceInfo.advance(0===e?ue.HUD_OCCLUDED:ue.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:s}=this,{width:i,height:r}=this._framebuffer.size,{highlights:a}=s,n=a.length>B?3:1,h=e.acquire(i,r,"highlights",n);h.acquireDepth(14);const o=this._plugins.produces(10,0);return o&&this._framebuffer.color.fbo&&h.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,h.fbo,1024),t.bindFramebuffer(h.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),o||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(h.fbo),V(t,e,i,r,s,()=>this._renderHighlightGeometries()),h.detachDepth(),this.performanceInfo.advance(ue.HIGHLIGHTS),h.retain(this._nodes.require("highlights",...D)+this._nodes.optional("highlights",...D)-1),h}_renderHighlightGeometries(){this._plugins.render(...Oe),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e){this._shadowAccumulator.updateDepthRange(e);const t=this._shadowAccumulator.requiresDepth;this._bindParameters.output=0,this._shadowAccumulator.renderAccumulation(this._bindParameters)&&this.performanceInfo.advance(ue.ACCUMULATED_SHADOWS),this._shadowAccumulator.updateMask(),t&&(this._bindParameters.depth=h(this._bindParameters.depth))}_precompileTransparentGeometry(){y(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...we),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=2,this._plugins.precompile(...we),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=0):this._plugins.precompile(...we)}_renderOIT(e,t=2){const s=1===e,{width:i,height:r}=this._framebuffer.size,a=s?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=h.useFloatBlend.value?8:5,d=h.output;h.output=1;const l=s?"oit hud":"oit",u=this.fboCache.acquire(i,r,l,o).acquireColor(me,this.hasFloatBlend?7:0,"oit alpha"),m=h.hasEmission&&(0===e||1!==t);m&&u.acquireColor(pe,o,"oit emissive"),s||u.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(u.fbo),this._rctx.clearFramebuffer(Z),m&&this._rctx.clearBuffer(2,Z),a(),u.detachDepth(),h.output=2;const _=this.fboCache.acquire(i,r,s?"oit front hud":"oit front");m&&_.acquireColor(me,o,"oit front emissive"),s?_.acquireDepth(this._hudDepthFormat):_.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(_.fbo),this._rctx.clearFramebuffer(C,s),a(),_.detachDepth();const p=this._pluginsHas.occludedHudElements&&!s,c=p&&0!==h.emissions?pe:me;let f;return h.hudOcclusion=n(this._bindParameters.hudOcclusion),h.output=0,s?(f=this.fboCache.acquire(i,r,"oit composite hud"),this._rctx.bindFramebuffer(f.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(0!==h.emissions&&this._framebuffer.ensureEmissionAttachment(),p&&(this._framebuffer.color.acquireColor(c,0,"hud occlusion"),this._rctx.clearBuffer(c-ce,C)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,u,_,h,p,e,this._fboCache.debugCallback),f?.detachDepth(),s||(m&&(this._bindParameters.emissions=3),p&&(h.hudOcclusion=this._framebuffer.color.obtainAttachment(c))),_.release(),u.release(),h.output=d,f}get _hudDepthFormat(){return this.isFeatureEnabled(7)?14:13}get _needsOpaquePass(){return this.plugins.produces(0,...Pe)||this.plugins.produces(5,...Pe)||this.plugins.produces(3,3)}_renderOpaque(){const e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._pluginInput.set(R.GROUND_DEPTH,this._blitGroundDepth()),this._plugins.render(2,3));const t=this._framebuffer;t.update(t=>this._renderNodes(O.OPAQUE,t,e)),this.fboCache.debugCallback?.(O.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(R.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(R.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderPreTransparent(){this._framebuffer.update(e=>this._renderNodes(R.GAUSSIAN_SPLAT,e)),this.fboCache.debugCallback?.(R.GAUSSIAN_SPLAT,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(R.OPAQUE_OCCLUSION_QUERY,e)),this.fboCache.debugCallback?.(R.OPAQUE_OCCLUSION_QUERY,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(R.VOXEL,e)),this.fboCache.debugCallback?.(R.VOXEL,this._framebuffer.color.fbo)}_renderTransparent(){const e=this._framebuffer;this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&this._renderOIT(0),e.update(e=>this._renderNodes(O.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(O.TRANSPARENT,e.color.fbo),this._hasTransparentGeometry||this._plugins.render(15),this._renderEdges(0),this._bindParameters.ssao=n(this._bindParameters.ssao),e.update(e=>this._renderNodes(R.TRANSPARENT_NO_DEPTH,e)),this.fboCache.debugCallback?.(R.TRANSPARENT_NO_DEPTH,e.color.fbo),this._renderTransparentMaterialWithoutDepth()}_renderTransparentMaterialWithoutDepth(){if(this._framebuffer.bind(),this._plugins.render(8),this._bindParameters.hasEmission){const e=this._rctx.setDrawBuffers([fe,me]);this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.render(8),this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!1,this._rctx.setDrawBuffers(e)}this.performanceInfo.advance(ue.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,s=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return s&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),this._fboCache.debugCallback?.(e,i.fbo),i}_ensureBindParameters(e,t){this._ensureBindParametersCamera(e,t),this._ensureBindParametersWeatherFader(),this._ensureBindParametersScreenSpaceReflections(),this._ensureBindParametersReprojection()}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(){1===this.stage.viewingMode&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,this.renderContext.time,this.stage.view.qualitySettings.fadeDuration),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersScreenSpaceReflections(){const{time:e}=this.renderContext,{screenSpaceReflections:t}=this._bindParameters;if(this.hasReflections){null==this._ssrEnableTime&&(this._ssrEnableTime=e);const s=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=s>0?Math.min(s,e-this._ssrEnableTime)/s:1,t.fadeFactor<1&&this._requestRender()}else this._ssrEnableTime=null}_ensureBindParametersReprojection(){if(!(this.hasReflections||this.hasGlobalIllumination))return void(this._reprojectionMatrix=w);const{reprojection:e,camera:t}=this._bindParameters,{lastFrameCamera:s}=e,i=!s.equals(t);if(i?(b(Ge,t.viewMatrix),b(Fe,t.projectionMatrix),g(xe,Ge,Fe),g(xe,s.viewMatrix,xe),g(xe,s.projectionMatrix,xe),this._reprojectionMatrix=xe):this._reprojectionMatrix=w,this.hasGlobalIllumination){const{viewMatrix:t}=e;i?(g(He,s.viewMatrix,Ge),P(t,He)):P(t,w)}}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,s,i){this._bindParameters.updateLighting(e,t,s,i),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}get test(){}};e([p()],ge.prototype,"_inGlobeView",void 0),e([p({readOnly:!0})],ge.prototype,"highResolutionAtmosphere",null),e([p()],ge.prototype,"_edgeView",void 0),e([p()],ge.prototype,"updating",null),ge=e([c("esri.views.3d.webgl-engine.lib.Renderer")],ge);const Pe=[0,1,2,3],we=[7,6,4,5],Ee=[7,6],Ie=[0,1,2,4,...Ee],Ae=[3,5],Ce=[2,4,8],Te=[16,12,14,13],Oe=[4,5,2,3,0,1,...Ee],Re=[4,8,5,11],Se={0:[13],1:[12],2:[13,12],3:[13,12]},De=[0,1,...Ee],Ne=["normals","highlights"],Fe=E(),Ge=E(),xe=E(),He=E();function ye(e){return t=>e.immediate.schedule(t)}export{ge as Renderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{set as t,add as e,scale as r,dist as n}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{area3dFromValues as i}from"../../../../geometry/support/triangle.js";function s(n,o,s=o?.indices){if(!o||!s)return!1;const{size:c,data:f}=o;t(n,0,0,0),t(u,0,0,0);let g=0,d=0;for(let p=0;p<s.length-2;p+=3){const o=s[p]*c,h=s[p+1]*c,j=s[p+2]*c;t(l,f[o],f[o+1],f[o+2]),t(a,f[h],f[h+1],f[h+2]),t(m,f[j],f[j+1],f[j+2]);const x=i(l,a,m);x?(e(l,l,a),e(l,l,m),r(l,l,1/3*x),e(n,n,l),g+=x):(e(u,u,l),e(u,u,a),e(u,u,m),d+=3)}return(0!==d||0!==g)&&(0!==g?(r(n,n,1/g),!0):0!==d&&(r(n,u,1/d),!0))}function c(e,n,o=n?.indices){if(!n||!o)return!1;const{size:i,data:s}=n;t(e,0,0,0);let c=-1,f=0;for(let t=0;t<o.length;t++){const r=o[t]*i;c!==r&&(e[0]+=s[r],e[1]+=s[r+1],e[2]+=s[r+2],f++),c=r}return f>1&&r(e,e,1/f),f>0}function f(o,i,s,c=i?.indices){if(!i||!c)return!1;t(o,0,0,0),t(u,0,0,0);let f=0,m=0;const{size:g,data:d}=i,p=c.length-1,h=p+(s?2:0);for(let t=0;t<h;t+=2){const i=t<p?t+1:0,s=c[t<p?t:p]*g,h=c[i]*g;l[0]=d[s],l[1]=d[s+1],l[2]=d[s+2],a[0]=d[h],a[1]=d[h+1],a[2]=d[h+2],r(l,e(l,l,a),.5);const j=n(l,a);j>0?(e(o,o,r(l,l,j)),f+=j):0===f&&(e(u,u,l),m++)}return 0!==f?(r(o,o,1/f),!0):0!==m&&(r(o,u,1/m),!0)}const l=o(),a=o(),m=o(),u=o();export{f as computeAttachmentOriginLines,c as computeAttachmentOriginPoints,s as computeAttachmentOriginTriangles};
2
+ import{set as t,scale as r,add as e,dist as n}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{area3dFromValues as i}from"../../../../geometry/support/triangle.js";function s(r,e,n=e?.indices){if(!e||!n)return!1;const{size:o,data:i}=e,s=(r,e,s,c)=>{const f=3*c,l=n[f]*o,u=n[f+1]*o,a=n[f+2]*o;t(r,i[l],i[l+1],i[l+2]),t(e,i[u],i[u+1],i[u+2]),t(s,i[a],i[a+1],i[a+2])};return c(r,n.length/3,s)}function c(n,o,s){t(n,0,0,0),t(g,0,0,0);let c=0,f=0;for(let t=0;t<o;++t){s(u,a,m,t);const o=i(u,a,m);o?(e(u,u,a),e(u,u,m),r(u,u,1/3*o),e(n,n,u),c+=o):(e(g,g,u),e(g,g,a),e(g,g,m),f+=3)}return(0!==f||0!==c)&&(0!==c?(r(n,n,1/c),!0):0!==f&&(r(n,g,1/f),!0))}function f(e,n,o=n?.indices){if(!n||!o)return!1;const{size:i,data:s}=n;t(e,0,0,0);let c=-1,f=0;for(let t=0;t<o.length;t++){const r=o[t]*i;c!==r&&(e[0]+=s[r],e[1]+=s[r+1],e[2]+=s[r+2],f++),c=r}return f>1&&r(e,e,1/f),f>0}function l(o,i,s,c=i?.indices){if(!i||!c)return!1;t(o,0,0,0),t(g,0,0,0);let f=0,l=0;const{size:m,data:d}=i,p=c.length-1,h=p+(s?2:0);for(let t=0;t<h;t+=2){const i=t<p?t+1:0,s=c[t<p?t:p]*m,h=c[i]*m;u[0]=d[s],u[1]=d[s+1],u[2]=d[s+2],a[0]=d[h],a[1]=d[h+1],a[2]=d[h+2],r(u,e(u,u,a),.5);const j=n(u,a);j>0?(e(o,o,r(u,u,j)),f+=j):0===f&&(e(g,g,u),l++)}return 0!==f?(r(o,o,1/f),!0):0!==l&&(r(o,g,1/l),!0)}const u=o(),a=o(),m=o(),g=o();export{l as computeAttachmentOriginLines,f as computeAttachmentOriginPoints,s as computeAttachmentOriginTriangles,c as computeAttachmentOriginTrianglesReader};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{copy as i,lerp as s,squaredLength as t,dot as n}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{h as o}from"../../../../chunks/boundedPlane.js";import{clipPolygon as l,clipLineSegment as r,create as c,fromValues as a}from"../../../../geometry/support/plane.js";function u(i){return(t,n,e)=>!o(i,s(b,t,n,e))}class h{constructor(i,s){this.list=i,this.count=s}}class m{constructor(i){this._remainingA=g(),this._remainingB=g(),this._visible=g(),this._lineRemainingA=p(),this._lineRemainingB=p(),this._lineVisible=p(),this._slicedAwayHalfspaces=f(i)}*processTriangle(s,t){let n=new h(this._remainingA,3),e=new h(this._remainingB,0);i(n.list[0],t[0]),i(n.list[1],t[1]),i(n.list[2],t[2]);const o=new h(this._visible,0);for(const i of this._slicedAwayHalfspaces){if(o.count=l(i,n.list,n.count,o.list,!1),o.count>=3&&(s.list=o.list,s.count=o.count,yield s),e.count=l(i,n.list,n.count,e.list,!0),e.count<3)return;[e,n]=[n,e]}}*processLineSegment(s,t,n){let e=this._lineRemainingA,o=this._lineRemainingB;i(e[0],t),i(e[1],n);for(const l of this._slicedAwayHalfspaces){if(r(l,e[0],e[1],this._lineVisible[0],this._lineVisible[1],!1)&&(i(s[0],this._lineVisible[0]),i(s[1],this._lineVisible[1]),yield s),!r(l,e[0],e[1],o[0],o[1],!0))return;[o,e]=[e,o]}}}function f(i){const s=[c(i.plane),c(),c(),c(),c()];return _(i.basis1,i.origin,s[1],s[2]),_(i.basis2,i.origin,s[3],s[4]),s}function _(i,s,e,o){const l=t(i),r=n(i,s);a(i[0],i[1],i[2],-r+l,e),a(-i[0],-i[1],-i[2],r+l,o)}function g(){return Array.from({length:12},()=>e())}function p(){return[e(),e()]}const b=e();export{m as SliceScreenPolygonPrimitiveProcessor,u as sliceFilterPredicate};
2
+ import{copy as i,lerp as s,squaredLength as t,dot as n}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as l,h as o}from"../../../../chunks/boundedPlane.js";import{clipPolygon as r,clipLineSegment as c,create as a,fromValues as h}from"../../../../geometry/support/plane.js";function u(i){return(t,n,e)=>!o(i,s(d,t,n,e))}class m{constructor(i,s){this.list=i,this.count=s}}class f{constructor(i){this._remainingA=p(),this._remainingB=p(),this._visible=p(),this._lineRemainingA=b(),this._lineRemainingB=b(),this._lineVisible=b(),this._slicedAwayHalfspaces=_(i),this._slicePlane=l(i)}*processTriangle(s,t){let n=new m(this._remainingA,3),e=new m(this._remainingB,0);i(n.list[0],t[0]),i(n.list[1],t[1]),i(n.list[2],t[2]);const l=new m(this._visible,0);for(const i of this._slicedAwayHalfspaces){if(l.count=r(i,n.list,n.count,l.list,!1),l.count>=3&&(s.list=l.list,s.count=l.count,yield s),e.count=r(i,n.list,n.count,e.list,!0),e.count<3)return;[e,n]=[n,e]}}*processLineSegment(s,t,n){let e=this._lineRemainingA,l=this._lineRemainingB;i(e[0],t),i(e[1],n);for(const o of this._slicedAwayHalfspaces){if(c(o,e[0],e[1],this._lineVisible[0],this._lineVisible[1],!1)&&(i(s[0],this._lineVisible[0]),i(s[1],this._lineVisible[1]),yield s),!c(o,e[0],e[1],l[0],l[1],!0))return;[l,e]=[e,l]}}validatePoint(i){return!o(this._slicePlane,i)}}function _(i){const s=[a(i.plane),a(),a(),a(),a()];return g(i.basis1,i.origin,s[1],s[2]),g(i.basis2,i.origin,s[3],s[4]),s}function g(i,s,e,l){const o=t(i),r=n(i,s);h(i[0],i[1],i[2],-r+o,e),h(-i[0],-i[1],-i[2],r+o,l)}function p(){return Array.from({length:12},()=>e())}function b(){return[e(),e()]}const d=e();export{f as SliceScreenPolygonPrimitiveProcessor,u as sliceFilterPredicate};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{glLayout as e}from"../../../support/buffer/glUtil.js";import{GLMaterialLoader as t}from"../GLMaterialLoader.js";import{VertexArrayObject as r}from"../VertexArrayObject.js";import{VertexBuffer as s}from"../../../../webgl/VertexBuffer.js";class i{constructor(i,o){this.geometry=o;const n=i.renderContext.rctx,a=o.renderGeometry,{material:m,layout:u,buffer:l}=a;this._materials=i.materials,m.setParameters({instancedDoublePrecision:!0}),this.glMaterialLoader=new t(m,this._materials),this.vbo=new s(n,e(u),l),this.vao=new r(n,this.vbo)}destroy(){this.glMaterialLoader.dispose(),this.vbo.dispose(),this.vao.dispose()}get material(){return this.geometry.renderGeometry.material}get emissions(){return this.material.emissions}get layout(){return this.geometry.renderGeometry.layout}get boundingInfo(){return this.geometry.boundingInfo}get numTriangles(){return this.numVertices/3}get numVertices(){return this.geometry.renderGeometry.numVertices}get usedMemory(){return 128+this.vbo.usedMemory+this.vao.usedMemory}intersect(e,t,r,s,i,o,n,a){return this.geometry.intersect(e,t,r,s,i,o,n,a)}}export{i as LodComponentData};
2
+ import{glLayout as e}from"../../../support/buffer/glUtil.js";import{GLMaterialLoader as t}from"../GLMaterialLoader.js";import{VertexArrayObject as r}from"../VertexArrayObject.js";import{VertexBuffer as s}from"../../../../webgl/VertexBuffer.js";class o{constructor(o,i){this.geometry=i;const n=o.renderContext.rctx,m=i.renderGeometry,{material:a,layout:u,buffer:g}=m;this._materials=o.materials,a.setParameters({instancedDoublePrecision:!0}),this.glMaterialLoader=new t(a,this._materials),this.vbo=new s(n,e(u),g),this.vao=new r(n,this.vbo)}destroy(){this.glMaterialLoader.dispose(),this.vbo.dispose(),this.vao.dispose()}get material(){return this.geometry.renderGeometry.material}get emissions(){return this.material.emissions}get layout(){return this.geometry.renderGeometry.layout}get boundingInfo(){return this.geometry.boundingInfo}get numTriangles(){return this.numVertices/3}get numVertices(){return this.geometry.renderGeometry.numVertices}get usedMemory(){return 128+this.vbo.usedMemory+this.vao.usedMemory}intersect(e,t,r,s,o,i,n,m){return this.geometry.intersect(e,t,r,s,o,i,n,m)}intersectScreenPolygon(e,t,r,s,o,i){return this.geometry.intersectScreenPolygon(e,t,r,s,o,i)}}export{o as LodComponentData};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{isSome as o}from"../../../../../core/arrayUtils.js";import{isAborted as e,throwIfAborted as n}from"../../../../../core/promiseUtils.js";import{create as t}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as s,expandWithVec3 as i,center as r,diameter as c}from"../../../../../geometry/support/aaBoundingBox.js";import{getEmissions as u}from"../../effects/emissive/emissions.js";import{LodComponentData as a}from"./LodComponentData.js";class m{static async create(t,s,i){const r=await Promise.allSettled(s.components.map(o=>t.controller.schedule(()=>new a(t,o.geometry),i))),c=r.map(o=>"fulfilled"===o.status?o.value:null).filter(o);if(e(i)||c.length!==r.length){c.forEach(o=>o.destroy()),n(i);for(const o of r)if("rejected"===o.status)throw o.reason}return new m(s.minScreenSpaceRadius,c)}constructor(o,e){this.minScreenSpaceRadius=o,this.components=e}destroy(){this.components.forEach(o=>o.destroy())}intersect(o,e,n,t,s,i,r){this.components.forEach(c=>c.intersect(o,e,n,t,s,i,this.boundingSphere,r))}get boundingBox(){if(null==this._boundingBox){const o=s();this.components.forEach(e=>{null!=e.boundingInfo&&(i(o,e.boundingInfo.bbMin),i(o,e.boundingInfo.bbMax))}),this._boundingBox=o}return this._boundingBox}get boundingSphere(){if(null==this._boundingSphere){const o=this.boundingBox,e=t();r(o,e),this._boundingSphere={center:e,radius:.5*c(o)}}return this._boundingSphere}get triangleCount(){return this.components.reduce((o,e)=>o+e.numTriangles,0)}get emissions(){return u(this.components)}}export{m as LodLevel};
2
+ import{isSome as e}from"../../../../../core/arrayUtils.js";import{isAborted as o,throwIfAborted as n}from"../../../../../core/promiseUtils.js";import{create as t}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as s,expandWithVec3 as i,center as r,diameter as c}from"../../../../../geometry/support/aaBoundingBox.js";import{getEmissions as u}from"../../effects/emissive/emissions.js";import{LodComponentData as m}from"./LodComponentData.js";class a{static async create(t,s,i){const r=await Promise.allSettled(s.components.map(e=>t.controller.schedule(()=>new m(t,e.geometry),i))),c=r.map(e=>"fulfilled"===e.status?e.value:null).filter(e);if(o(i)||c.length!==r.length){c.forEach(e=>e.destroy()),n(i);for(const e of r)if("rejected"===e.status)throw e.reason}return new a(s.minScreenSpaceRadius,c)}constructor(e,o){this.minScreenSpaceRadius=e,this.components=o}destroy(){this.components.forEach(e=>e.destroy())}intersect(e,o,n,t,s,i,r){this.components.forEach(c=>c.intersect(e,o,n,t,s,i,this.boundingSphere,r))}*intersectScreenPolygon(e,o,n,t,s){for(const i of this.components)i.intersectScreenPolygon(e,o,n,t,this.boundingSphere,s),yield}get boundingBox(){if(null==this._boundingBox){const e=s();this.components.forEach(o=>{null!=o.boundingInfo&&(i(e,o.boundingInfo.bbMin),i(e,o.boundingInfo.bbMax))}),this._boundingBox=e}return this._boundingBox}get boundingSphere(){if(null==this._boundingSphere){const e=this.boundingBox,o=t();r(e,o),this._boundingSphere={center:o,radius:.5*c(e)}}return this._boundingSphere}get triangleCount(){return this.components.reduce((e,o)=>e+o.numTriangles,0)}get emissions(){return u(this.components)}}export{a as LodLevel};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{isSome as t}from"../../../../../core/arrayUtils.js";import r from"../../../../../core/Error.js";import{someMap as n,getOrCreateMapValue as s}from"../../../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{isAborted as i,throwIfAborted as o}from"../../../../../core/promiseUtils.js";import{property as l,subclass as c}from"../../../../../core/accessorSupport/decorators.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{subtract as d,dot as u,transformMat4 as m}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as _,freeze as p}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{debugFlags as g}from"../../../support/debugFlags.js";import{glLayout as y}from"../../../support/buffer/glUtil.js";import v from"../../../webgl/RenderCamera.js";import{isColor as b}from"../../core/shaderLibrary/ShaderOutput.js";import{AsyncRenderPlugin as I}from"../../effects/RenderPlugin.js";import{getEmissions as C}from"../../effects/emissive/emissions.js";import{DepthRange as D}from"../DepthRange.js";import{assert as R}from"../Util.js";import{InstanceData as E}from"./InstanceData.js";import{InstanceOctree as x}from"./InstanceOctree.js";import{LevelSelector as S}from"./LevelSelector.js";import{LodLevel as w}from"./LodLevel.js";import{getRenderInstanceDataLayout as L,RenderInstanceData as j}from"./RenderInstanceData.js";import{colorMixModes as U}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as O}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as T}from"../../shaders/DefaultMaterialTechnique.js";import{defaultHighlightName as A}from"../../../../support/HighlightDefaults.js";import{TaskPriority as M,noBudget as q}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as B}from"../../../../webgl/Util.js";import{fromLayout as F}from"../../../../webgl/VertexAttributeLocations.js";const V=e=>{const t=e.baseBoundingSphere.radius,r=e.levels.map(e=>e.minScreenSpaceRadius);return new S(t,r)};let H=class extends I{constructor(e,t){super(e),this.type=3,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=new Array,this._highlightRenderInstanceDatas=new Map,this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new v,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.produces=new Map([[2,e=>this._produces(e)],[4,e=>!!this._hasTransparentLevels()&&this._produces(e)]]),this._instanceData=new E({shaderTransformation:e.shaderTransformation},e.symbol.materialParameters),this.addHandles(t.registerTask(M.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=L(this.symbol.materialParameters),this._glInstanceBufferLayout=y(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",()=>this._requestUpdateCycle()),this._instanceData.events.on("instance-transform-changed",({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)}),this._instanceData.events.on("instance-visibility-changed",({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)}),this._instanceData.events.on("instance-highlight-changed",()=>this._requestUpdateCycle(!0))])}get _allRenderInstanceData(){return[this._defaultRenderInstanceData,...this._highlightRenderInstanceDatas.values()]}get _allRenderInstanceDataExceptHighlightShadow(){const e=[this._defaultRenderInstanceData];for(const t of this._highlightRenderInstanceDatas)t[0]!==A&&e.push(t[1]);return e}hasHighlight(e){return this._highlightRenderInstanceDatas.has(e)}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerViewUid(){return this.metadata.layerViewUid}get instanceData(){return this._instanceData}get emissions(){return C(this._levels)}get usedMemory(){return this._allRenderInstanceData.reduce((e,t)=>t.reduce((e,t)=>e+t.usedMemory,e),this._levels.reduce((e,t)=>e+t.components.reduce((e,t)=>e+t.usedMemory,0),0))}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach((e,r)=>{const n=this._allRenderInstanceData[0][r].size+this._allRenderInstanceData[1][r].size,s=e.triangleCount;t.push({renderedInstances:n,renderedTriangles:n*s,trianglesPerInstance:s})}),{totalInstances:e,renderedInstances:t.reduce((e,t)=>e+t.renderedInstances,0),renderedTriangles:t.reduce((e,t)=>e+t.renderedTriangles,0),levels:t}}_createRenderInstanceDataArray(){const{rctx:e}=this._context.renderContext;return this.symbol.levels.map(t=>new j(e,this._instanceBufferLayout))}async initializeRenderContext(e,r){this._context=e,this._defaultRenderInstanceData=this._createRenderInstanceDataArray();const n=await Promise.allSettled(this.symbol.levels.map(t=>w.create(e,t,r))),s=n.map(e=>"fulfilled"===e.status?e.value:null).filter(t);if(i(r)||s.length!==n.length){s.forEach(e=>e.destroy()),o(r);for(const e of n)if("rejected"===e.status)throw e.reason}this._levels=s,this._levelSelector=V(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach(e=>e.destroy()),this._defaultRenderInstanceData.forEach(e=>e.destroy()),this._highlightRenderInstanceDatas.forEach(e=>e.forEach(e=>e.destroy()))}_hasTransparentLevels(){return this._levels.some(e=>e.components.some(e=>{const t=e.material.produces.get(4);return t?.(0)}))}hasHighlights(){return n(this._highlightRenderInstanceDatas,e=>e.some(e=>e.size>0))}_produces(e){return(10!==e||this.hasHighlights())&&(6!==e||this.hasHighlight(A))}prepareRender(e){if(!g.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bind.contentCamera.equals(this._camera);this._camera.copyFrom(e.bind.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(q),this._needFullCycle=!1)}}acquireTechniques(e){if(!this.baseMaterial.visible||!this.baseMaterial.isVisibleForOutput(e.output))return null;const t=this._getInstanceDatas(e);if(!t)return null;const r=new Array,n=this.levels;return t.forEach(t=>n.forEach(({components:n},s)=>n.forEach(n=>r.push(this._beginComponent(e,t[s],n))))),r}render(e,t){const r=this._getInstanceDatas(e);if(!r||null==t)return;let n=0;const s=this.levels;r.forEach(r=>s.forEach(({components:s},a)=>s.forEach(s=>this._renderComponent(e,t[n++],r[a],s,a)))),e.rctx.unbindBuffer(34962),e.rctx.bindVAO(null)}_getInstanceDatas(e){const{output:t,bind:r}=e,n=10===t,s=6===t,a=7!==t;if(!n&&!s)return a?this._allRenderInstanceData:this._allRenderInstanceDataExceptHighlightShadow;const{_highlightRenderInstanceDatas:i}=this;if(a){if(n){const e=r.highlight?.name;if(!e)return null;const t=i.get(e);return t?[t]:null}const e=i.get(A);return s?e?[e]:null:Array.from(i.values())}return null}intersectRay(e,t,r,n){if(!this.baseMaterial.visible||null==this._octree)return;const s=f();d(s,n,r);const a=s=>{this._withIntersectableInstance(e,s,(a,i)=>{m(k,r,e.transform.inverse),m(Y,n,e.transform.inverse),a.intersect(e,t,k,Y,s,this.metadata,i)})};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(a):this._octree.forEachAlongRay(r,s,a)}_withIntersectableInstance(e,t,r){const n=this._instanceData.getState(t);if(!(4&n))return;const s=this._instanceData.getLodLevel(t),a=this._levels.length;R(!!(18&n),"invalid instance state"),R(s>=0&&s<a,"invaid lod level");const i=this._levels[s];null!=i&&(this._instanceData.getCombinedModelTransform(t,W),e.transform.set(W),r(i,a))}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(null==this._octreeCached){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new x(e,this.baseBoundingSphere);for(let r=0;r<e.capacity;++r)18&t.get(r)&&this._octreeCached.addInstance(r)}return this._octreeCached}_invalidateOctree(){this._octreeCached=a(this._octreeCached)}queryDepthRange(e){if(null==this._octree)return new D;const t=e.viewForward,r=this._octree.findClosest(t,1,e.frustum),n=this._octree.findClosest(t,-1,e.frustum);if(null==r||null==n)return new D;const s=e.eye,a=this._instanceData.view;a.boundingSphere.getVec(r,G),d(G,G,s);const i=u(G,t)-G[3];a.boundingSphere.getVec(n,G),d(G,G,s);const o=u(G,t)+G[3];return new D(i,o)}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._allRenderInstanceData.forEach(e=>e.forEach(e=>e.startUpdateCycle()))}get readyToRun(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:n,_levelSelector:a}=this;this._allRenderInstanceData.forEach(e=>e.forEach(e=>e.beginUpdate()));const i=this._instanceData,o=i.view;let l=i.size;const c=i.capacity;let h=this._instanceIndex;const d=Math.ceil(c/500),{_highlightRenderInstanceDatas:u}=this;for(let m=0;m<l&&!e.done;++m){h===this._cycleStartIndex&&this._startUpdateCycle();const m=o.state.get(h);let f=0;if(!(1&m)){h=h+1===c?0:h+1,l++;continue}const _=o.lodLevel.get(h);if(2&m&&this._defaultRenderInstanceData[_].freeTail(),16&m){const e=i.geHighlightOptionsPrev(h);if(e){const t=u.get(e);if(!t)throw new r("internal:lod-renderer","Internal error in lodRenderer");t[_].freeTail(),t.every(e=>e.isEmpty)&&(t.forEach(e=>e.destroy()),u.delete(e))}}if(32&m)i.freeInstance(h);else if(4&m){let e=0;if(t&&(o.modelOrigin.getVec(h,N),e=a.selectLevel(N,i.getCombinedMedianScaleFactor(h),n)),f=-83&m,e>=0)if(8&m){const t=i.getHighlightName(h);if(t){const n=()=>{const e=this._createRenderInstanceDataArray();return e.forEach(e=>e.beginUpdate()),e},a=s(u,t,n);if(e>=a.length)throw new r("internal:lod-renderer",`LodRenderer internal error - missing lodLevel ${e}`);P(a[e],o,h)}f|=16}else P(this._defaultRenderInstanceData[e],o,h),f|=2;o.state.set(h,f),o.lodLevel.set(h,e)}else f=-83&m,o.state.set(h,f);const p=!!(18&m),g=!!(18&f);null!=this._octreeCached&&(!p&&g?this._octreeCached.addInstance(h):p&&!g?this._octreeCached.removeInstance(h):p&&g&&64&m&&(this._octreeCached.removeInstance(h),this._octreeCached.addInstance(h))),h=h+1===c?0:h+1,h%d===0&&e.madeProgress(),p!==g&&this.metadata.notifyGraphicVisibilityChanged(h),g&&64&m&&this.metadata.notifyGraphicGeometryChanged(h)}this._instanceIndex=h,this._allRenderInstanceData.forEach(e=>e.forEach(e=>e.endUpdate())),this._context.requestRender()}_beginComponent(e,t,r){if(0===t.size)return null;const n=r.glMaterialLoader.load(e.rctx,e.bind.slot,e.output);return n?.beginSlot(e.bind)}_renderComponent(e,t,r,n,s){if(!t)return;const{bind:a,rctx:i}=e,o=i.bindTechnique(t,a,n.material.parameters,$),l=this._glInstanceBufferLayout;o.assertCompatibleVertexAttributeLocations(n.vao,F(l)),i.bindVAO(n.vao),g.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&b(e.output)&&(o.setUniform4fv("externalColor",Z[Math.min(s,Z.length-1)]),o.setUniform1i("symbolColorMixMode",U.replace));const c=r.capacity,h=r.headIndex,d=r.tailIndex,u=r.firstIndex,m=(e,s)=>{B(i,o.locations,r.buffer,e),i.drawArraysInstanced(t.primitiveType,0,n.numVertices,s-e)};n.material.transparent&&null!=u?h>d?(R(u>=d&&u<=h,"invalid firstIndex"),m(u,h),m(d,u)):h<d&&(u<=h?(R(u>=0&&u<=h,"invalid firstIndex"),m(u,h),m(d,c),m(0,u)):(R(u>=d&&u<=c,"invalid firstIndex"),m(u,c),m(0,h),m(d,u))):h>d?m(d,h):h<d&&(m(0,h),m(d,c))}};function P(e,t,r){const n=e.allocateHead();z(t,r,e.view,n)}function z(e,t,r,n){O(e.modelOrigin,t,r.modelOriginHi,r.modelOriginLo,n),r.model.copyFrom(n,e.model,t),r.modelNormal.copyFrom(n,e.modelNormal,t),e.color&&r.color&&r.color.copyFrom(n,e.color,t),e.olidColor&&r.olidColor&&r.olidColor.copyFrom(n,e.olidColor,t),e.featureAttribute&&r.featureAttribute&&r.featureAttribute.copyFrom(n,e.featureAttribute,t)}e([l({constructOnly:!0})],H.prototype,"symbol",void 0),e([l({constructOnly:!0})],H.prototype,"metadata",void 0),e([l({constructOnly:!0})],H.prototype,"shaderTransformation",void 0),e([l()],H.prototype,"_instanceData",void 0),e([l()],H.prototype,"_cycleStartIndex",void 0),e([l({readOnly:!0})],H.prototype,"_enableLevelSelection",null),e([l()],H.prototype,"_updateCyclesWithStaticCamera",void 0),e([l({readOnly:!0})],H.prototype,"readyToRun",null),H=e([c("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],H);const N=f(),G=_(),W=h(),k=f(),Y=f(),Z=[p(1,0,1,1),p(0,0,1,1),p(0,1,0,1),p(1,1,0,1),p(1,0,0,1)],$=new T;export{H as LodRenderer};
2
+ import{__decorate as e}from"tslib";import{isSome as t}from"../../../../../core/arrayUtils.js";import s from"../../../../../core/Error.js";import{someMap as n,getOrCreateMapValue as r}from"../../../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{isAborted as i,throwIfAborted as o}from"../../../../../core/promiseUtils.js";import{property as l,subclass as c}from"../../../../../core/accessorSupport/decorators.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{subtract as d,dot as u,transformMat4 as m}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as _,freeze as p}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{debugFlags as g}from"../../../support/debugFlags.js";import{glLayout as y}from"../../../support/buffer/glUtil.js";import v from"../../../webgl/RenderCamera.js";import{isColor as b}from"../../core/shaderLibrary/ShaderOutput.js";import{AsyncRenderPlugin as I}from"../../effects/RenderPlugin.js";import{getEmissions as C}from"../../effects/emissive/emissions.js";import{DepthRange as D}from"../DepthRange.js";import{assert as R}from"../Util.js";import{InstanceData as E}from"./InstanceData.js";import{InstanceOctree as S}from"./InstanceOctree.js";import{LevelSelector as x}from"./LevelSelector.js";import{LodLevel as w}from"./LodLevel.js";import{getRenderInstanceDataLayout as L,RenderInstanceData as j}from"./RenderInstanceData.js";import{colorMixModes as O}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as U}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as T}from"../../shaders/DefaultMaterialTechnique.js";import{defaultHighlightName as M}from"../../../../support/HighlightDefaults.js";import{TaskPriority as A,noBudget as P}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as F}from"../../../../webgl/Util.js";import{fromLayout as q}from"../../../../webgl/VertexAttributeLocations.js";const V=e=>{const t=e.baseBoundingSphere.radius,s=e.levels.map(e=>e.minScreenSpaceRadius);return new x(t,s)};let B=class extends I{constructor(e,t){super(e),this.type=3,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=new Array,this._highlightRenderInstanceDatas=new Map,this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new v,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.produces=new Map([[2,e=>this._produces(e)],[4,e=>!!this._hasTransparentLevels()&&this._produces(e)]]),this._instanceData=new E({shaderTransformation:e.shaderTransformation},e.symbol.materialParameters),this.addHandles(t.registerTask(A.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=L(this.symbol.materialParameters),this._glInstanceBufferLayout=y(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",()=>this._requestUpdateCycle()),this._instanceData.events.on("instance-transform-changed",({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)}),this._instanceData.events.on("instance-visibility-changed",({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)}),this._instanceData.events.on("instance-highlight-changed",()=>this._requestUpdateCycle(!0))])}get _allRenderInstanceData(){return[this._defaultRenderInstanceData,...this._highlightRenderInstanceDatas.values()]}get _allRenderInstanceDataExceptHighlightShadow(){const e=[this._defaultRenderInstanceData];for(const t of this._highlightRenderInstanceDatas)t[0]!==M&&e.push(t[1]);return e}hasHighlight(e){return this._highlightRenderInstanceDatas.has(e)}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerViewUid(){return this.metadata.layerViewUid}get instanceData(){return this._instanceData}get emissions(){return C(this._levels)}get usedMemory(){return this._allRenderInstanceData.reduce((e,t)=>t.reduce((e,t)=>e+t.usedMemory,e),this._levels.reduce((e,t)=>e+t.components.reduce((e,t)=>e+t.usedMemory,0),0))}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach((e,s)=>{const n=this._allRenderInstanceData[0][s].size+this._allRenderInstanceData[1][s].size,r=e.triangleCount;t.push({renderedInstances:n,renderedTriangles:n*r,trianglesPerInstance:r})}),{totalInstances:e,renderedInstances:t.reduce((e,t)=>e+t.renderedInstances,0),renderedTriangles:t.reduce((e,t)=>e+t.renderedTriangles,0),levels:t}}_createRenderInstanceDataArray(){const{rctx:e}=this._context.renderContext;return this.symbol.levels.map(t=>new j(e,this._instanceBufferLayout))}async initializeRenderContext(e,s){this._context=e,this._defaultRenderInstanceData=this._createRenderInstanceDataArray();const n=await Promise.allSettled(this.symbol.levels.map(t=>w.create(e,t,s))),r=n.map(e=>"fulfilled"===e.status?e.value:null).filter(t);if(i(s)||r.length!==n.length){r.forEach(e=>e.destroy()),o(s);for(const e of n)if("rejected"===e.status)throw e.reason}this._levels=r,this._levelSelector=V(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach(e=>e.destroy()),this._defaultRenderInstanceData.forEach(e=>e.destroy()),this._highlightRenderInstanceDatas.forEach(e=>e.forEach(e=>e.destroy()))}_hasTransparentLevels(){return this._levels.some(e=>e.components.some(e=>{const t=e.material.produces.get(4);return t?.(0)}))}hasHighlights(){return n(this._highlightRenderInstanceDatas,e=>e.some(e=>e.size>0))}_produces(e){return(10!==e||this.hasHighlights())&&(6!==e||this.hasHighlight(M))}prepareRender(e){if(!g.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bind.contentCamera.equals(this._camera);this._camera.copyFrom(e.bind.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(P),this._needFullCycle=!1)}}acquireTechniques(e){if(!this.baseMaterial.visible||!this.baseMaterial.isVisibleForOutput(e.output))return null;const t=this._getInstanceDatas(e);if(!t)return null;const s=new Array,n=this.levels;return t.forEach(t=>n.forEach(({components:n},r)=>n.forEach(n=>s.push(this._beginComponent(e,t[r],n))))),s}render(e,t){const s=this._getInstanceDatas(e);if(!s||null==t)return;let n=0;const r=this.levels;s.forEach(s=>r.forEach(({components:r},a)=>r.forEach(r=>this._renderComponent(e,t[n++],s[a],r,a)))),e.rctx.unbindBuffer(34962),e.rctx.bindVAO(null)}_getInstanceDatas(e){const{output:t,bind:s}=e,n=10===t,r=6===t,a=7!==t;if(!n&&!r)return a?this._allRenderInstanceData:this._allRenderInstanceDataExceptHighlightShadow;const{_highlightRenderInstanceDatas:i}=this;if(a){if(n){const e=s.highlight?.name;if(!e)return null;const t=i.get(e);return t?[t]:null}const e=i.get(M);return r?e?[e]:null:Array.from(i.values())}return null}intersectRay(e,t,s,n){if(!this.baseMaterial.visible||null==this._octree)return;const r=f();d(r,n,s);const a=r=>{const a=this._setupIntersectableInstance(e,r);a&&(m(k,s,e.transform.inverse),m(Y,n,e.transform.inverse),a.intersect(e,t,k,Y,r,this.metadata,this._levels.length))};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(a):this._octree.forEachAlongRay(s,r,a)}*intersectScreenPolygon(e,t){if(!this.baseMaterial.visible||null==this._octree)return;const s=this.baseMaterial.parameters.verticalOffset?this._octree.values():this._octree.intersectingFrustumValues(t.broadPhaseFrustum,e=>!!(4&this._instanceData.getState(e)));for(const n of s)yield*this._intersectScreenPolygonInstance(e,t,n)}*_intersectScreenPolygonInstance(e,t,s){const n=this._setupIntersectableInstance(e,s);n&&(yield*n.intersectScreenPolygon(e,t,s,this.metadata,this._levels.length))}_setupIntersectableInstance(e,t){const s=this._instanceData.getState(t);if(!(4&s))return null;const n=this._instanceData.getLodLevel(t),r=this._levels.length;R(!!(18&s),"invalid instance state"),R(n>=0&&n<r,"invaid lod level");const a=this._levels[n];return null==a?null:(this._instanceData.getCombinedModelTransform(t,W),e.transform.set(W),a)}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(null==this._octreeCached){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new S(e,this.baseBoundingSphere);for(let s=0;s<e.capacity;++s)18&t.get(s)&&this._octreeCached.addInstance(s)}return this._octreeCached}_invalidateOctree(){this._octreeCached=a(this._octreeCached)}queryDepthRange(e){if(null==this._octree)return new D;const t=e.viewForward,s=this._octree.findClosest(t,1,e.frustum),n=this._octree.findClosest(t,-1,e.frustum);if(null==s||null==n)return new D;const r=e.eye,a=this._instanceData.view;a.boundingSphere.getVec(s,G),d(G,G,r);const i=u(G,t)-G[3];a.boundingSphere.getVec(n,G),d(G,G,r);const o=u(G,t)+G[3];return new D(i,o)}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._allRenderInstanceData.forEach(e=>e.forEach(e=>e.startUpdateCycle()))}get readyToRun(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:n,_levelSelector:a}=this;this._allRenderInstanceData.forEach(e=>e.forEach(e=>e.beginUpdate()));const i=this._instanceData,o=i.view;let l=i.size;const c=i.capacity;let h=this._instanceIndex;const d=Math.ceil(c/500),{_highlightRenderInstanceDatas:u}=this;for(let m=0;m<l&&!e.done;++m){h===this._cycleStartIndex&&this._startUpdateCycle();const m=o.state.get(h);let f=0;if(!(1&m)){h=h+1===c?0:h+1,l++;continue}const _=o.lodLevel.get(h);if(2&m&&this._defaultRenderInstanceData[_].freeTail(),16&m){const e=i.geHighlightOptionsPrev(h);if(e){const t=u.get(e);if(!t)throw new s("internal:lod-renderer","Internal error in lodRenderer");t[_].freeTail(),t.every(e=>e.isEmpty)&&(t.forEach(e=>e.destroy()),u.delete(e))}}if(32&m)i.freeInstance(h);else if(4&m){let e=0;if(t&&(o.modelOrigin.getVec(h,N),e=a.selectLevel(N,i.getCombinedMedianScaleFactor(h),n)),f=-83&m,e>=0)if(8&m){const t=i.getHighlightName(h);if(t){const n=()=>{const e=this._createRenderInstanceDataArray();return e.forEach(e=>e.beginUpdate()),e},a=r(u,t,n);if(e>=a.length)throw new s("internal:lod-renderer",`LodRenderer internal error - missing lodLevel ${e}`);H(a[e],o,h)}f|=16}else H(this._defaultRenderInstanceData[e],o,h),f|=2;o.state.set(h,f),o.lodLevel.set(h,e)}else f=-83&m,o.state.set(h,f);const p=!!(18&m),g=!!(18&f);null!=this._octreeCached&&(!p&&g?this._octreeCached.addInstance(h):p&&!g?this._octreeCached.removeInstance(h):p&&g&&64&m&&(this._octreeCached.removeInstance(h),this._octreeCached.addInstance(h))),h=h+1===c?0:h+1,h%d===0&&e.madeProgress(),p!==g&&this.metadata.notifyGraphicVisibilityChanged(h),g&&64&m&&this.metadata.notifyGraphicGeometryChanged(h)}this._instanceIndex=h,this._allRenderInstanceData.forEach(e=>e.forEach(e=>e.endUpdate())),this._context.requestRender()}_beginComponent(e,t,s){if(0===t.size)return null;const n=s.glMaterialLoader.load(e.rctx,e.bind.slot,e.output);return n?.beginSlot(e.bind)}_renderComponent(e,t,s,n,r){if(!t)return;const{bind:a,rctx:i}=e,o=i.bindTechnique(t,a,n.material.parameters,$),l=this._glInstanceBufferLayout;o.assertCompatibleVertexAttributeLocations(n.vao,q(l)),i.bindVAO(n.vao),g.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&b(e.output)&&(o.setUniform4fv("externalColor",Z[Math.min(r,Z.length-1)]),o.setUniform1i("symbolColorMixMode",O.replace));const c=s.capacity,h=s.headIndex,d=s.tailIndex,u=s.firstIndex,m=(e,r)=>{F(i,o.locations,s.buffer,e),i.drawArraysInstanced(t.primitiveType,0,n.numVertices,r-e)};n.material.transparent&&null!=u?h>d?(R(u>=d&&u<=h,"invalid firstIndex"),m(u,h),m(d,u)):h<d&&(u<=h?(R(u>=0&&u<=h,"invalid firstIndex"),m(u,h),m(d,c),m(0,u)):(R(u>=d&&u<=c,"invalid firstIndex"),m(u,c),m(0,h),m(d,u))):h>d?m(d,h):h<d&&(m(0,h),m(d,c))}};function H(e,t,s){const n=e.allocateHead();z(t,s,e.view,n)}function z(e,t,s,n){U(e.modelOrigin,t,s.modelOriginHi,s.modelOriginLo,n),s.model.copyFrom(n,e.model,t),s.modelNormal.copyFrom(n,e.modelNormal,t),e.color&&s.color&&s.color.copyFrom(n,e.color,t),e.olidColor&&s.olidColor&&s.olidColor.copyFrom(n,e.olidColor,t),e.featureAttribute&&s.featureAttribute&&s.featureAttribute.copyFrom(n,e.featureAttribute,t)}e([l({constructOnly:!0})],B.prototype,"symbol",void 0),e([l({constructOnly:!0})],B.prototype,"metadata",void 0),e([l({constructOnly:!0})],B.prototype,"shaderTransformation",void 0),e([l()],B.prototype,"_instanceData",void 0),e([l()],B.prototype,"_cycleStartIndex",void 0),e([l({readOnly:!0})],B.prototype,"_enableLevelSelection",null),e([l()],B.prototype,"_updateCyclesWithStaticCamera",void 0),e([l({readOnly:!0})],B.prototype,"readyToRun",null),B=e([c("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],B);const N=f(),G=_(),W=h(),k=f(),Y=f(),Z=[p(1,0,1,1),p(0,0,1,1),p(0,1,0,1),p(1,1,0,1),p(1,0,0,1)],$=new T;export{B as LodRenderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{unique as e}from"../../../../../core/arrayUtils.js";import{estimateNumberArrayMemory as t,baseTypedArrayMemory as r}from"../../../../../core/memoryEstimations.js";import{IntersectorResult as s}from"../IntersectorResult.js";import{LodTarget as n}from"./Intersector.js";class i{constructor(e,t,r,s){this.material=e,this.buffer=t,this.numVertices=r,this.boundingInfo=s,this.bufferWriter=e.createBufferWriter()}get layout(){return this.bufferWriter.layout}get numTriangles(){return this.numVertices/3}computeUsedMemory(){return this.buffer.byteLength+r}get renderGeometry(){return this}}class o{constructor(e){this.engineGeometry=e;const t=this.material,r=this.engineGeometry,s=r.attributes,n=r.boundingInfo,o=t.createBufferWriter(),u=o.layout,m=o.elementCount(s),a=u.createBuffer(m);o.write(null,null,s,null,{buffer:a,offset:0}),this.renderGeometry=new i(t,a.buffer,m,n)}get material(){return this.engineGeometry.material}get numVertices(){return this.engineGeometry.indexCount}get numTriangles(){return this.numVertices/3}get boundingInfo(){return this.engineGeometry.boundingInfo}computeUsedMemory(){return Array.from(this.engineGeometry.attributes.values()).reduce((e,r)=>e+t(r.data,r.indices),0)}intersect(e,t,r,s,n,i,o,m){const a=this.engineGeometry;this.material.intersectRay(a,e.transform.transform,e,r,s,(r,s,a)=>u(r,s,a,e,t,i,o,n,m))}}function u(e,t,r,i,o,u,m,a,c){if(e<0)return;if(o&&!o(i.rayBegin,i.rayEnd,e))return;const l=new n(u.layerViewUid,u.graphicUid(a),r,m,c);if((null==i.results.min.distance||e<i.results.min.distance)&&i.results.min.set(3,l,e,t,i.transform.transform),(null==i.results.max.distance||e>i.results.max.distance)&&i.results.max.set(3,l,e,t,i.transform.transform),2===i.options.store){const r=new s(i.results.min.ray);r.set(3,l,e,t,i.transform.transform),i.results.all.push(r)}}class m{constructor(e,t=null){this.geometry=e,this.textures=t}get material(){return this.geometry.material}get numTriangles(){return this.geometry.numTriangles}}class a{constructor(t,r,s){this.components=t,this.minScreenSpaceRadius=r,this.pivotOffset=s;const n=e(this.components.map(e=>e.geometry));this.numVertices=n.reduce((e,t)=>e+t.numVertices,0)}}class c{constructor(e){this.levels=e,this.levels.sort((e,t)=>e.minScreenSpaceRadius===t.minScreenSpaceRadius?e.numVertices-t.numVertices:e.minScreenSpaceRadius-t.minScreenSpaceRadius)}get materialParameters(){return this.levels[0].components[0].geometry.material.parameters}getMaterials(){const t=[];return this.levels.forEach(e=>e.components.forEach(e=>t.push(e.geometry.material))),e(t)}getTextures(){const t=new Array;return this.levels.forEach(e=>e.components.forEach(e=>{null!=e.textures&&t.push(...e.textures)})),e(t)}getGeometries(){const t=new Array;return this.levels.forEach(e=>e.components.forEach(e=>{t.push(e.geometry)})),e(t)}getEngineGeometries(){return this.getGeometries().map(e=>e.engineGeometry).filter(e=>null!=e)}computeUsedMemory(){const e=this.getGeometries(),t=this.getTextures(),r=e.reduce((e,t)=>e+t.computeUsedMemory(),0);return t.reduce((e,t)=>e+t.usedMemory,0)+r}}export{o as LodComponentEngineGeometry,i as LodComponentRenderGeometry,m as LodComponentResources,a as LodLevelResources,c as LodResources};
2
+ import{unique as e}from"../../../../../core/arrayUtils.js";import{estimateNumberArrayMemory as t,baseTypedArrayMemory as r}from"../../../../../core/memoryEstimations.js";import{IntersectorResult as s}from"../IntersectorResult.js";import{LodTarget as n}from"./Intersector.js";class i{constructor(e,t,r,s){this.material=e,this.buffer=t,this.numVertices=r,this.boundingInfo=s,this.bufferWriter=e.createBufferWriter()}get layout(){return this.bufferWriter.layout}get numTriangles(){return this.numVertices/3}computeUsedMemory(){return this.buffer.byteLength+r}get renderGeometry(){return this}}class o{constructor(e){this.engineGeometry=e;const t=this.material,r=this.engineGeometry,s=r.attributes,n=r.boundingInfo,o=t.createBufferWriter(),a=o.layout,m=o.elementCount(s),u=a.createBuffer(m);o.write(null,null,s,null,{buffer:u,offset:0}),this.renderGeometry=new i(t,u.buffer,m,n)}get material(){return this.engineGeometry.material}get numVertices(){return this.engineGeometry.indexCount}get numTriangles(){return this.numVertices/3}get boundingInfo(){return this.engineGeometry.boundingInfo}computeUsedMemory(){return Array.from(this.engineGeometry.attributes.values()).reduce((e,r)=>e+t(r.data,r.indices),0)}intersect(e,t,r,s,n,i,o,m){const u=this.engineGeometry;this.material.intersectRay(u,e.transform.transform,e,r,s,(r,s,u)=>a(r,s,u,e,t,i,o,n,m))}intersectScreenPolygon(e,t,r,s,i,o){const a=this.engineGeometry,m=this.material.intersectScreenPolygon?.(a,e.transform.transform,e,t);m?.valid&&e.polygonResults.add(3,new n(s.layerViewUid,s.graphicUid(r),m.primitiveIndex,i,o),m.distance)}}function a(e,t,r,i,o,a,m,u,c){if(e<0)return;if(o&&!o(i.rayBegin,i.rayEnd,e))return;const l=new n(a.layerViewUid,a.graphicUid(u),r,m,c);if((null==i.results.min.distance||e<i.results.min.distance)&&i.results.min.set(3,l,e,t,i.transform.transform),(null==i.results.max.distance||e>i.results.max.distance)&&i.results.max.set(3,l,e,t,i.transform.transform),2===i.options.store){const r=new s(i.results.min.ray);r.set(3,l,e,t,i.transform.transform),i.results.all.push(r)}}class m{constructor(e,t=null){this.geometry=e,this.textures=t}get material(){return this.geometry.material}get numTriangles(){return this.geometry.numTriangles}}class u{constructor(t,r,s){this.components=t,this.minScreenSpaceRadius=r,this.pivotOffset=s;const n=e(this.components.map(e=>e.geometry));this.numVertices=n.reduce((e,t)=>e+t.numVertices,0)}}class c{constructor(e){this.levels=e,this.levels.sort((e,t)=>e.minScreenSpaceRadius===t.minScreenSpaceRadius?e.numVertices-t.numVertices:e.minScreenSpaceRadius-t.minScreenSpaceRadius)}get materialParameters(){return this.levels[0].components[0].geometry.material.parameters}getMaterials(){const t=[];return this.levels.forEach(e=>e.components.forEach(e=>t.push(e.geometry.material))),e(t)}getTextures(){const t=new Array;return this.levels.forEach(e=>e.components.forEach(e=>{null!=e.textures&&t.push(...e.textures)})),e(t)}getGeometries(){const t=new Array;return this.levels.forEach(e=>e.components.forEach(e=>{t.push(e.geometry)})),e(t)}getEngineGeometries(){return this.getGeometries().map(e=>e.engineGeometry).filter(e=>null!=e)}computeUsedMemory(){const e=this.getGeometries(),t=this.getTextures(),r=e.reduce((e,t)=>e+t.computeUsedMemory(),0);return t.reduce((e,t)=>e+t.usedMemory,0)+r}}export{o as LodComponentEngineGeometry,i as LodComponentRenderGeometry,m as LodComponentResources,u as LodLevelResources,c as LodResources};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{createScreenPointArray as t,createRenderScreenPointArray3 as n}from"../../../../core/screenUtils.js";import{transformMat4 as r,copy as e,distance as o,set as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as s,create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as u,expandPointInPlace as f,clone as a,intersects as p,containsPoint as l,create as m,fromValues as h}from"../../../../geometry/support/aaBoundingRect.js";import{fromPoints as d,create as g,distance2 as M}from"../../../../geometry/support/lineSegment.js";import{signedDistance as b,intersectLineSegment as j}from"../../../../geometry/support/plane.js";import{containsPoint2dFromValues as x}from"../../../../geometry/support/triangle.js";class I{constructor(t,n,r){this.bounds=t,this.nearestDistance=n,this.nearestPoint=r}}function N(t,n){return t.isRectangle?l(t.bounds,n):O(n,t.points)}function T(t,n){if(!p(t.bounds,n))return!1;if(t.isRectangle)return!0;for(const r of t.points)if(l(n,r))return!0;for(let r=0;r<4;r++)if(O(k(z,n,r),t.points))return!0;for(let r=0;r<t.points.length;r++){const e=t.points[r],o=r===t.points.length-1?t.points[0]:t.points[r+1];for(let t=0;t<4;t++){if(V(e,o,k(z,n,t),k(A,n,(t+1)%4)))return!0}}return!1}function S(t,n,r,e){const o=Math.min(n[0],r[0],e[0]),i=Math.min(n[1],r[1],e[1]),s=Math.max(n[0],r[0],e[0]),c=Math.max(n[1],r[1],e[1]);if(!T(t,h(o,i,s,c,q)))return!1;if(N(t,n)||N(t,r)||N(t,e))return!0;for(const u of t.points)if(x(n,r,e,u,nt))return!0;for(let u=0;u<t.points.length;u++){const o=t.points[u],i=t.points[(u+1)%t.points.length];if(V(n,r,o,i)||V(r,e,o,i)||V(e,n,o,i))return!0}return!1}function R(t,n,r,e){const o=Math.min(n[0],r[0])-e,i=Math.min(n[1],r[1])-e,s=Math.max(n[0],r[0])+e,c=Math.max(n[1],r[1])+e;if(!p(t.bounds,h(o,i,s,c,q)))return!1;if(N(t,n)||N(t,r))return!0;const u=e*e;for(const f of t.points)if(B(f,n,r)<=u)return!0;for(let f=0;f<t.points.length;f++){const e=t.points[f],o=t.points[(f+1)%t.points.length];if(V(n,r,e,o)||Y(n,r,e,o)<=u)return!0}return!1}function y(t,n,r){return _(t,n.bbMin,n.bbMax,r)}function _(t,n,o,i){const c=u(q);tt.reset(t.eye);let p=0;for(let s=0;s<2;s++)for(let u=0;u<2;u++)for(let a=0;a<2;a++)J[0]=0===s?n[0]:o[0],J[1]=0===u?n[1]:o[1],J[2]=0===a?n[2]:o[2],i&&r(J,J,i),e(X[p++],J),F(t,J)||(t.projectToScreen(J,z),f(c,z),tt.addNearestCandidate(J));return v(t,c,X,tt),tt.valid?new I(a(c),tt.distance,s(tt.point)):null}function v(t,n,r,e){for(let o=0;o<r.length;o++)for(const i of Z){const s=o|i;if(s===o)continue;E(t,r[o],r[s],K)&&(t.projectToScreen(K,z),f(n,z),e.addNearestCandidate(K))}}function C(t,n,r,o,i){e(K,n),e(L,r);const s=t.projectToRenderScreen(K,G),c=t.projectToRenderScreen(L,H);if(null==s||null==c)return!1;const u=F(t,K),f=F(t,L);if(u&&f)return!1;if(u!==f){const n=u?K:L,r=u?s:c;if(!w(t,n,u?L:K))return!1;if(!t.projectToRenderScreen(n,r))return!1}return o[0]=s[0],o[1]=s[1],o[2]=0,i[0]=c[0],i[1]=c[1],i[2]=0,!0}function F(t,n){return P(t,n)>0}function P(t,n){return b(t.frustum[4],n)}function w(t,n,r){return E(t,n,r,n)}function E(t,n,r,e){return j(t.frustum[4],d(n,r,W),e)}function O(t,n){let r=!1;for(let e=0,o=n.length-1;e<n.length;o=e++){const i=n[e],s=n[o];if(!(i[1]>t[1]!=s[1]>t[1]))continue;const c=(s[0]-i[0])*(t[1]-i[1])/(s[1]-i[1])+i[0];t[0]<c&&(r=!r)}return r}function V(t,n,r,e){const o=D(t,n,r),i=D(t,n,e),s=D(r,e,t),c=D(r,e,n);return o!==i&&s!==c||(0===o&&U(t,n,r)||0===i&&U(t,n,e)||0===s&&U(r,e,t)||0===c&&U(r,e,n))}function Y(t,n,r,e){return V(t,n,r,e)?0:Math.min(B(t,r,e),B(n,r,e),B(r,t,n),B(e,t,n))}function B(t,n,r){return M(d(i(K,n[0],n[1],0),i(L,r[0],r[1],0),W),i(Q,t[0],t[1],0))}function D(t,n,r){const e=(n[1]-t[1])*(r[0]-n[0])-(n[0]-t[0])*(r[1]-n[1]);return Math.abs(e)<=nt?0:Math.sign(e)}function U(t,n,r){return r[0]>=Math.min(t[0],n[0])-nt&&r[0]<=Math.max(t[0],n[0])+nt&&r[1]>=Math.min(t[1],n[1])-nt&&r[1]<=Math.max(t[1],n[1])+nt}function k(t,n,r){return t[0]=0===r||3===r?n[0]:n[2],t[1]=r<2?n[1]:n[3],t}const q=m(),z=t(),A=t(),G=n(),H=n(),J=c(),K=c(),L=c(),Q=c(),W=g(),X=[c(),c(),c(),c(),c(),c(),c(),c()],Z=[1,2,4];class ${constructor(){this._origin=c(),this.point=c(),this.distance=Number.POSITIVE_INFINITY}get valid(){return Number.isFinite(this.distance)}addNearestCandidate(t){const n=o(this._origin,t);n<this.distance&&(this.distance=n,e(this.point,t))}reset(t){this.distance=Number.POSITIVE_INFINITY,e(this._origin,t)}}const tt=new $,nt=1e-9;export{I as ProjectedScreenBounds,F as isBehindNearPlane,_ as projectAabbToScreenBounds,y as projectBoundingInfoToScreenBounds,C as projectWorldLineSegmentToRenderScreen,N as screenPolygonContainsPoint,T as screenPolygonIntersectsBounds,R as screenPolygonIntersectsBufferedSegment,S as screenPolygonIntersectsTriangle};
2
+ import{createScreenPointArray as t,createRenderScreenPointArray3 as n}from"../../../../core/screenUtils.js";import{transformMat4 as r,copy as e,distance as o,set as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as s,create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as c,expandPointInPlace as f,clone as a,intersects as p,containsPoint as l,create as h,fromValues as m}from"../../../../geometry/support/aaBoundingRect.js";import{fromPoints as d,create as g,distance2 as M}from"../../../../geometry/support/lineSegment.js";import{signedDistance as b,intersectLineSegment as j}from"../../../../geometry/support/plane.js";import{containsPoint2dFromValues as x}from"../../../../geometry/support/triangle.js";class I{constructor(t,n,r){this.bounds=t,this.nearestDistance=n,this.nearestPoint=r}}function N(t,n){return t.isRectangle?l(t.bounds,n):V(n,t.points)}function T(t,n,r){const e=n[0]-r,o=n[1]-r,i=n[0]+r,s=n[1]+r;if(!p(t.bounds,m(e,o,i,s,z)))return!1;if(N(t,n))return!0;const u=r*r;for(const c of t.points){const t=c[0]-n[0],r=c[1]-n[1];if(t*t+r*r<=u)return!0}for(let c=0;c<t.points.length;c++){if(D(n,t.points[c],t.points[(c+1)%t.points.length])<=u)return!0}return!1}function S(t,n){if(!p(t.bounds,n))return!1;if(t.isRectangle)return!0;for(const r of t.points)if(l(n,r))return!0;for(let r=0;r<4;r++)if(V(q(A,n,r),t.points))return!0;for(let r=0;r<t.points.length;r++){const e=t.points[r],o=r===t.points.length-1?t.points[0]:t.points[r+1];for(let t=0;t<4;t++){if(Y(e,o,q(A,n,t),q(G,n,(t+1)%4)))return!0}}return!1}function R(t,n,r,e){const o=Math.min(n[0],r[0],e[0]),i=Math.min(n[1],r[1],e[1]),s=Math.max(n[0],r[0],e[0]),u=Math.max(n[1],r[1],e[1]);if(!S(t,m(o,i,s,u,z)))return!1;if(N(t,n)||N(t,r)||N(t,e))return!0;for(const c of t.points)if(x(n,r,e,c,rt))return!0;for(let c=0;c<t.points.length;c++){const o=t.points[c],i=t.points[(c+1)%t.points.length];if(Y(n,r,o,i)||Y(r,e,o,i)||Y(e,n,o,i))return!0}return!1}function y(t,n,r,e){const o=Math.min(n[0],r[0])-e,i=Math.min(n[1],r[1])-e,s=Math.max(n[0],r[0])+e,u=Math.max(n[1],r[1])+e;if(!p(t.bounds,m(o,i,s,u,z)))return!1;if(N(t,n)||N(t,r))return!0;const c=e*e;for(const f of t.points)if(D(f,n,r)<=c)return!0;for(let f=0;f<t.points.length;f++){const e=t.points[f],o=t.points[(f+1)%t.points.length];if(Y(n,r,e,o)||B(n,r,e,o)<=c)return!0}return!1}function _(t,n,r){return v(t,n.bbMin,n.bbMax,r)}function v(t,n,o,i){const u=c(z);nt.reset(t.eye);let p=0;for(let s=0;s<2;s++)for(let c=0;c<2;c++)for(let a=0;a<2;a++)K[0]=0===s?n[0]:o[0],K[1]=0===c?n[1]:o[1],K[2]=0===a?n[2]:o[2],i&&r(K,K,i),e(Z[p++],K),P(t,K)||(t.projectToScreen(K,A),f(u,A),nt.addNearestCandidate(K));return C(t,u,Z,nt),nt.valid?new I(a(u),nt.distance,s(nt.point)):null}function C(t,n,r,e){for(let o=0;o<r.length;o++)for(const i of $){const s=o|i;if(s===o)continue;O(t,r[o],r[s],L)&&(t.projectToScreen(L,A),f(n,A),e.addNearestCandidate(L))}}function F(t,n,r,o,i){e(L,n),e(Q,r);const s=t.projectToRenderScreen(L,H),u=t.projectToRenderScreen(Q,J);if(null==s||null==u)return!1;const c=P(t,L),f=P(t,Q);if(c&&f)return!1;if(c!==f){const n=c?L:Q,r=c?s:u;if(!E(t,n,c?Q:L))return!1;if(!t.projectToRenderScreen(n,r))return!1}return o[0]=s[0],o[1]=s[1],o[2]=0,i[0]=u[0],i[1]=u[1],i[2]=0,!0}function P(t,n){return w(t,n)>0}function w(t,n){return b(t.frustum[4],n)}function E(t,n,r){return O(t,n,r,n)}function O(t,n,r,e){return j(t.frustum[4],d(n,r,X),e)}function V(t,n){let r=!1;for(let e=0,o=n.length-1;e<n.length;o=e++){const i=n[e],s=n[o];if(!(i[1]>t[1]!=s[1]>t[1]))continue;const u=(s[0]-i[0])*(t[1]-i[1])/(s[1]-i[1])+i[0];t[0]<u&&(r=!r)}return r}function Y(t,n,r,e){const o=U(t,n,r),i=U(t,n,e),s=U(r,e,t),u=U(r,e,n);return o!==i&&s!==u||(0===o&&k(t,n,r)||0===i&&k(t,n,e)||0===s&&k(r,e,t)||0===u&&k(r,e,n))}function B(t,n,r,e){return Y(t,n,r,e)?0:Math.min(D(t,r,e),D(n,r,e),D(r,t,n),D(e,t,n))}function D(t,n,r){return M(d(i(L,n[0],n[1],0),i(Q,r[0],r[1],0),X),i(W,t[0],t[1],0))}function U(t,n,r){const e=(n[1]-t[1])*(r[0]-n[0])-(n[0]-t[0])*(r[1]-n[1]);return Math.abs(e)<=rt?0:Math.sign(e)}function k(t,n,r){return r[0]>=Math.min(t[0],n[0])-rt&&r[0]<=Math.max(t[0],n[0])+rt&&r[1]>=Math.min(t[1],n[1])-rt&&r[1]<=Math.max(t[1],n[1])+rt}function q(t,n,r){return t[0]=0===r||3===r?n[0]:n[2],t[1]=r<2?n[1]:n[3],t}const z=h(),A=t(),G=t(),H=n(),J=n(),K=u(),L=u(),Q=u(),W=u(),X=g(),Z=[u(),u(),u(),u(),u(),u(),u(),u()],$=[1,2,4];class tt{constructor(){this._origin=u(),this.point=u(),this.distance=Number.POSITIVE_INFINITY}get valid(){return Number.isFinite(this.distance)}addNearestCandidate(t){const n=o(this._origin,t);n<this.distance&&(this.distance=n,e(this.point,t))}reset(t){this.distance=Number.POSITIVE_INFINITY,e(this._origin,t)}}const nt=new tt,rt=1e-9;export{I as ProjectedScreenBounds,P as isBehindNearPlane,v as projectAabbToScreenBounds,_ as projectBoundingInfoToScreenBounds,F as projectWorldLineSegmentToRenderScreen,N as screenPolygonContainsPoint,S as screenPolygonIntersectsBounds,y as screenPolygonIntersectsBufferedSegment,T as screenPolygonIntersectsCircle,R as screenPolygonIntersectsTriangle};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{createScreenPointArray as t}from"../../../../core/screenUtils.js";import{copy as e,set as n,transformMat4 as o,distance as r,squaredDistance as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as l,setMax as a,getMax as u,getMin as c,create as f}from"../../../../geometry/support/aaBoundingBox.js";import{clipPolygon as m}from"../../../../geometry/support/plane.js";import{normalFromValues as p,closestPointFromValues as d}from"../../../../geometry/support/triangle.js";import{boundingInfoSubdivisionThreshold as I}from"./intersectionConstants.js";import{projectAabbToScreenBounds as h,projectBoundingInfoToScreenBounds as g,screenPolygonIntersectsBounds as b,screenPolygonIntersectsTriangle as v}from"./screenPolygonOverlapUtils.js";class y{constructor(){this.distance=Number.POSITIVE_INFINITY,this.primitiveIndex=0,this.hasNormal=!1,this.point=s(),this.normal=s()}reset(){this.distance=Number.POSITIVE_INFINITY}update(t,n,o,r){this.distance=t,this.primitiveIndex=n,e(this.point,o),this.hasNormal=null!=r,null!=r&&e(this.normal,r)}updateIfCloserFromValues(t,e,n,o){t<this.distance&&this.update(t,e,n,o)}updateIfCloser(t){const{distance:e,primitiveIndex:n,point:o,normal:r}=t;this.updateIfCloserFromValues(e,n,o,t.hasNormal?r:null)}get valid(){return Number.isFinite(this.distance)}}function N(t,e,n,o,r){if(!t.visible||0!==t.type)return null;const i=new y;let s;if(t.boundingInfo)s=x(t.boundingInfo,e,n,o,r);else{const i=t.positionAttribute,l=t.primitivePositionIndices;s=j(e,n,o,0,l.length/3,l,i.data,i.stride,r,null,0)}for(const l of s)i.updateIfCloser(l);return i.valid?i:null}function T(t,e,n,o,r,i,s,l,a){const u=new y;for(const c of j(t,e,n,o,r,i,s,l,a,null,0))u.updateIfCloser(c);return u.valid?u:null}function*j(t,e,n,o,i,s,l,a,u,c=null,f=0){if(null==t.camera)return;const{camera:d,screenPolygonPrimitiveProcessor:I}=t;for(let h=o;h<i;++h){const t=(c?.[h]??h)+f,o=null==c?t:h,i=3*t;C(O[0],s,l,a,i+0,u,o,e),C(O[1],s,l,a,i+1,u,o,e),C(O[2],s,l,a,i+2,u,o,e);const g=Y;let b;B.reset();for(const{list:e,count:s}of I.processTriangle(M,O)){const o=m(d.frustum[4],e,s,S,!1);if(!(o<3)){for(let t=0;t<o;t++)d.projectToScreen(S[t],w[t]);P(n,w,o)&&(F(d.eye,S,o,E),null==b&&(b=p(Y,O[0],O[1],O[2])),B.updateIfCloserFromValues(r(d.eye,E),t,E,b?g:null))}}B.valid&&(yield B)}}function*x(t,e,n,o,r){const i=e.camera,s=null!=r?(l(V,t.bbMin),a(V,t.bbMax),r.applyToAabb(V),h(i,c(V,O[0]),u(V,O[1]),n)):g(i,t,n);if(null==s||!b(o,s.bounds))return;const{primitiveIndices:f,position:m}=t,p=f?f.length:m.indices.length/3;if(p>I){const i=t.getChildren();if(void 0!==i){for(const t of i)yield*x(t,e,n,o,r);return}}yield*j(e,n,o,0,p,m.indices,m.data,m.stride,r,f,0)}function C(t,e,r,i,s,l,a,u){const c=i*e[s],f=r[c+0],m=r[c+1],p=r[c+2];null!=l?l.applyToVertex(t,f,m,p,a):n(t,f,m,p),u&&o(t,t,u)}function P(t,e,n){for(let o=1;o<n-1;o++)if(v(t,e[0],e[o],e[o+1]))return!0;return!1}function F(t,n,o,r){let s=Number.POSITIVE_INFINITY;for(let l=1;l<o-1;l++){d(_,t,n[0],n[l],n[l+1]);const o=i(t,_);o<s&&(s=o,e(r,_))}}const V=f(),A=12,O=[s(),s(),s()],S=Array.from({length:A},()=>s()),w=Array.from({length:A},()=>t()),E=s(),Y=s(),_=s(),B=new y,M={list:[],count:0};export{y as Hit,j as forEachTriangleRangeScreenPolygonHit,N as intersectTriangleGeometryScreenPolygon,T as intersectTriangleRangeScreenPolygon};
2
+ import{createScreenPointArray as t}from"../../../../core/screenUtils.js";import{copy as e,distance as n,squaredDistance as o,set as r,transformMat4 as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as l,setMax as u,getMax as c,getMin as a,create as f}from"../../../../geometry/support/aaBoundingBox.js";import{clipPolygon as m}from"../../../../geometry/support/plane.js";import{normalFromValues as p,closestPointFromValues as d}from"../../../../geometry/support/triangle.js";import{boundingInfoSubdivisionThreshold as I}from"./intersectionConstants.js";import{projectAabbToScreenBounds as h,projectBoundingInfoToScreenBounds as g,screenPolygonIntersectsBounds as b,screenPolygonIntersectsTriangle as v}from"./screenPolygonOverlapUtils.js";class y{constructor(){this.distance=Number.POSITIVE_INFINITY,this.primitiveIndex=0,this.hasNormal=!1,this.point=s(),this.normal=s()}reset(){this.distance=Number.POSITIVE_INFINITY}update(t,n,o,r){this.distance=t,this.primitiveIndex=n,e(this.point,o),this.hasNormal=null!=r,null!=r&&e(this.normal,r)}updateIfCloserFromValues(t,e,n,o){t<this.distance&&this.update(t,e,n,o)}updateIfCloser(t){const{distance:e,primitiveIndex:n,point:o,normal:r}=t;this.updateIfCloserFromValues(e,n,o,t.hasNormal?r:null)}get valid(){return Number.isFinite(this.distance)}}function N(t,e,n,o,r){if(!t.visible||0!==t.type)return null;const i=new y;let s;if(t.boundingInfo)s=P(t.boundingInfo,e,n,o,r);else{const i=t.positionAttribute,l=t.primitivePositionIndices;s=x(e,n,o,0,l.length/3,l,i.data,i.stride,r,null,0)}for(const l of s)i.updateIfCloser(l);return i.valid?i:null}function T(t,e,n,o,r,i,s,l,u){const c=new y;for(const a of x(t,e,n,o,r,i,s,l,u,null,0))c.updateIfCloser(a);return c.valid?c:null}function j(t,e,n,o,r){const i=new y;for(const s of C(t,e,n,o,r))i.updateIfCloser(s);return i.valid?i:null}function*x(t,e,n,o,r,i,s,l,u,c=null,a=0){const f=(t,n,o,r)=>{const f=(c?.[r]??r)+a,m=null==c?f:r,p=3*f;return F(t,i,s,l,p+0,u,m,e),F(n,i,s,l,p+1,u,m,e),F(o,i,s,l,p+2,u,m,e),f};return yield*C(t,n,o,r,f)}function*C(t,e,o,r,i){if(null==t.camera)return;const{camera:s,screenPolygonPrimitiveProcessor:l}=t;for(let u=o;u<r;++u){const t=i(S[0],S[1],S[2],u),o=B;let r;U.reset();for(const{list:i,count:u}of l.processTriangle(k,S)){const l=m(s.frustum[4],i,u,E,!1);if(!(l<3)){for(let t=0;t<l;t++)s.projectToScreen(E[t],Y[t]);V(e,Y,l)&&(w(s.eye,E,l,_),null==r&&(r=p(B,S[0],S[1],S[2])),U.updateIfCloserFromValues(n(s.eye,_),t,_,r?o:null))}}U.valid&&(yield U)}}function*P(t,e,n,o,r){const i=e.camera,s=null!=r?(l(A,t.bbMin),u(A,t.bbMax),r.applyToAabb(A),h(i,a(A,S[0]),c(A,S[1]),n)):g(i,t,n);if(null==s||!b(o,s.bounds))return;const{primitiveIndices:f,position:m}=t,p=f?f.length:m.indices.length/3;if(p>I){const i=t.getChildren();if(void 0!==i){for(const t of i)yield*P(t,e,n,o,r);return}}yield*x(e,n,o,0,p,m.indices,m.data,m.stride,r,f,0)}function F(t,e,n,o,s,l,u,c){const a=o*e[s],f=n[a+0],m=n[a+1],p=n[a+2];null!=l?l.applyToVertex(t,f,m,p,u):r(t,f,m,p),c&&i(t,t,c)}function V(t,e,n){for(let o=1;o<n-1;o++)if(v(t,e[0],e[o],e[o+1]))return!0;return!1}function w(t,n,r,i){let s=Number.POSITIVE_INFINITY;for(let l=1;l<r-1;l++){d(M,t,n[0],n[l],n[l+1]);const r=o(t,M);r<s&&(s=r,e(i,M))}}const A=f(),O=12,S=[s(),s(),s()],E=Array.from({length:O},()=>s()),Y=Array.from({length:O},()=>t()),_=s(),B=s(),M=s(),U=new y,k={list:[],count:0};export{y as Hit,x as forEachTriangleRangeScreenPolygonHit,C as forEachTriangleReaderRangeScreenPolygonHit,N as intersectTriangleGeometryScreenPolygon,T as intersectTriangleRangeScreenPolygon,j as intersectTriangleReaderRangeScreenPolygon};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../core/shaderLibrary/ForwardLinearDepthToWriteShadowMap.glsl.js";import"../core/shaderLibrary/Offset.glsl.js";import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/Transform.glsl.js";import"../core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js";import"../core/shaderLibrary/attributes/PathVertexPosition.glsl.js";import"../core/shaderLibrary/output/OutputDepth.glsl.js";import"../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import"../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../core/shaderLibrary/shading/MainLighting.glsl.js";import"../core/shaderLibrary/shading/Normals.glsl.js";import"../core/shaderLibrary/shading/NormalUtils.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderLibrary/util/ColorConversion.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float3PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../effects/snowcover/SnowCover.glsl.js";import"../shaders/OutputColorHighlightOLID.glsl.js";import"../../../webgl/ShaderBuilder.js";export{b as build}from"../../../../chunks/Path.glsl.js";
2
+ import"../core/shaderLibrary/ForwardLinearDepthToWriteShadowMap.glsl.js";import"../core/shaderLibrary/Offset.glsl.js";import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/Transform.glsl.js";import"../core/shaderLibrary/attributes/PathVertexPosition.glsl.js";import"../core/shaderLibrary/output/OutputDepth.glsl.js";import"../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import"../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../core/shaderLibrary/shading/MainLighting.glsl.js";import"../core/shaderLibrary/shading/Normals.glsl.js";import"../core/shaderLibrary/shading/NormalUtils.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderLibrary/util/ColorConversion.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float3PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../effects/snowcover/SnowCover.glsl.js";import"../shaders/OutputColorHighlightOLID.glsl.js";import"../../../webgl/ShaderBuilder.js";export{b as build}from"../../../../chunks/Path.glsl.js";
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{newLayout as e}from"../../support/buffer/InterleavedLayout.js";import{olidEnabled as t}from"../effects/geometry/olidUtils.js";import{TextureBackedBufferLayout as r}from"../lib/TextureBackedBuffer/TextureBackedBufferLayout.js";function o(){const r=e().u32("pathVertexInfo",{integer:!0});return t()&&r.vec4u8("olidColor"),r.freeze()}function p(e){const t=[{type:"vec3f32",name:"position"},{type:"vec2snorm16",name:"profileRight"},{type:"vec2snorm16",name:"profileUp"}];return 1===e.upVectorAlignment&&t.push({type:"vec2snorm16",name:"pathRotationUp"}),e.hasVVSize&&t.push({type:"f32",name:"sizeFeatureAttribute"}),e.hasVVColor&&t.push({type:"f32",name:"colorFeatureAttribute"}),e.hasVVOpacity&&t.push({type:"f32",name:"opacityFeatureAttribute"}),t.push({type:"f16",name:"pathMaxStretchDistance"},{type:"snorm16",name:"profileRotation"}),new r(t)}export{o as getLayout,p as getTextureLayout};
2
+ import{newLayout as e}from"../../support/buffer/InterleavedLayout.js";import{olidEnabled as t}from"../effects/geometry/olidUtils.js";import{TextureBackedBufferLayout as o}from"../lib/TextureBackedBuffer/TextureBackedBufferLayout.js";function r(){return e().u32("pathVertexInfo",{integer:!0}).freeze()}function p(e){const r=[{type:"vec3f32",name:"position"},{type:"vec2snorm16",name:"profileRight"},{type:"vec2snorm16",name:"profileUp"}];return 1===e.upVectorAlignment&&r.push({type:"vec2snorm16",name:"pathRotationUp"}),e.hasVVSize&&r.push({type:"f32",name:"sizeFeatureAttribute"}),e.hasPathSize&&r.push({type:"vec2f32",name:"size"}),e.hasVVColor&&r.push({type:"f32",name:"colorFeatureAttribute"}),e.hasPathColor&&r.push({type:"vec4unorm8",name:"color"}),e.hasVVOpacity&&r.push({type:"f32",name:"opacityFeatureAttribute"}),t()&&r.push({type:"vec4unorm8",name:"olidColor"}),r.push({type:"f16",name:"pathMaxStretchDistance"},{type:"snorm16",name:"profileRotation"}),e.hasPathOpacity&&r.push({type:"unorm8",name:"opacity"}),new o(r)}export{r as getLayout,p as getTextureLayout};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{clamp as t}from"../../../../core/mathUtils.js";import{clone as e}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as r}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewUint32 as s,BufferViewVec3f as o,BufferViewVec2Snorm16 as a,BufferViewSnorm16 as n,BufferViewFloat16 as c,BufferViewFloat as h}from"../../../../geometry/support/buffer/BufferView.js";import{maxPathFrameIndex as u}from"../../layers/graphics/Graphics3DPathSymbolLayerConstants.js";import{isShadowLike as p,is3DGeometry as f,isColor as l}from"../core/shaderLibrary/ShaderOutput.js";import m from"../lib/GLMaterial.js";import{isPathGeometry as g}from"../lib/PathGeometry.js";import{offsetPathVertexInfoFrameIndex as b}from"../lib/PathVertexInfo.js";import{MeshIntersectionOptions as d,intersectAabbInvDir as _}from"../lib/RayIntersections.js";import{intersectTriangleRangeScreenPolygon as y}from"../lib/screenPolygonTriangleIntersections.js";import{assert as S}from"../lib/Util.js";import{applyPolygonOffsetToHit as x}from"./intersectWithPolygonOffset.js";import{getLayout as z,getTextureLayout as V}from"./PathLayouts.js";import{PathPassParameters as j,PathTechnique as w}from"./PathTechnique.js";import{PathTechniqueConfiguration as F}from"./PathTechniqueConfiguration.js";import{TriangleMaterial as v}from"./TriangleMaterial.js";import{writeAttributes as R,writePosition as P,writeBufferVec2 as M,writeBufferInt16 as C,writeBufferFloat16 as A,writeBufferFloat as B}from"./internal/bufferWriterUtils.js";import{hasShadowHighlights as O}from"../shaders/ReceiveShadowsConfiguration.js";import{alphaCutoff as T}from"../../../../webscene/support/AlphaCutoff.js";class I extends v{constructor(t,e){super(t,D),this.supportsEdges=!0,this._pp0=i(0,0,1),this._pp1=i(0,0,0),this.produces=new Map([[2,t=>(this.parameters.castShadows&&p(t)||f(t))&&!this.transparent],[4,t=>(this.parameters.castShadows&&p(t)||f(t))&&this.transparent]]),this._configuration=new F(e.spherical)}get emissions(){return this.parameters.emissiveStrength>0?this.transparent?2:1:0}updateConfiguration(t){super.updateConfiguration(t),this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.transparent,this._configuration.hasOccludees=t.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?0:this.parameters.cullFace,this._configuration.offsetBackfaces=this.transparent,l(t.output)?(this._configuration.receiveShadows=t.shadowMap.enabled,this._configuration.hasShadowHighlights=O(this._configuration,t),this._configuration.receiveAmbientOcclusion=null!=t.ssao):this._configuration.receiveShadows=this._configuration.hasShadowHighlights=this._configuration.receiveAmbientOcclusion=!1,this._configuration.pbrMode=this.parameters.usePBR?2:0,this._configuration.emissionSource=this.parameters.usePBR?1:0,this._configuration.snowCover=t.snowCover>0,this._configuration.upVectorAlignment=this.parameters.upVectorAlignment,this._configuration.pathCapType=this.parameters.pathCapType,this._configuration.pathProfileType=this.parameters.profile.type}isVisibleForOutput(t){return 5!==t&&7!==t&&6!==t||this.parameters.castShadows}get visible(){return this.parameters.opacity>=T}intersectRay(t,e,i,r,s,o){this._intersectRay(t,i,r,s,o)}intersectRayDraped(t,e,i,r){return this._pp0[0]=this._pp1[0]=i[0],this._pp0[1]=this._pp1[1]=i[1],this._intersectRay(t,e,this._pp0,this._pp1,r)}intersectScreenPolygon(t,e,i,r){const s=L(t);return null==s?null:x(q(s,this._computeSize(s),e,i,r),this._configuration,i.camera.eye)}_intersectRay(t,e,i,s,o){const a=L(t);if(null==a)return;const n=this._computeSize(a),c=new d(e.tolerance,!1,e.options.normalRequired),h=Math.max(n[0],n[1]),u=t.boundingInfo;if(null==u)return void k(a,n,i,s,c,o);const p=r(u.bbMin[0]-h,u.bbMin[1]-h,u.bbMin[2]-h,u.bbMax[0]+h,u.bbMax[1]+h,u.bbMax[2]+h),f=[s[0]-i[0],s[1]-i[1],s[2]-i[2]],l=Math.sqrt(f[0]*f[0]+f[1]*f[1]+f[2]*f[2]),m=[l/f[0],l/f[1],l/f[2]];_(p,i,m,e.tolerance)&&k(a,n,i,s,c,o)}_computeSize(i){const r=e(this.parameters.size);if(this.parameters.vvSize){const{offset:e,factor:s,minSize:o,maxSize:a,fallback:n}=this.parameters.vvSize,c=i.sizeAttributeValue;Number.isNaN(c)?(r[0]*=n[0],r[1]*=n[2]):(r[0]*=t(e[0]+c*s[0],o[0],a[0]),r[1]*=t(e[2]+c*s[2],o[2],a[2]))}return r}createBufferWriter(){return new G(z(),V(this.parameters))}createGLMaterial(t){return new U(t)}get transparent(){const{parameters:t}=this;return t.drivenOpacity||t.opacity<1}}class U extends m{beginSlot(t){return this.getTechnique(w,t)}}function k({baked:t},e,i,r,s,o){t.size&&t.size[0]===e[0]&&t.size[1]===e[1]||t.bake(e),t.intersect(i,r,s,o)}function q({baked:t},e,i,r,s){t.size&&t.size[0]===e[0]&&t.size[1]===e[1]||t.bake(e);const{vertexIndices:o}=t.builder;return y(r,i,s,0,o.length/3,o,t.positions,3,null)}function L(t){const e=t;return g(e)?e.path:null}class D extends j{constructor(){super(...arguments),this.polygonOffset=0,this.castShadows=!0,this.hasSlicePlane=!1,this.drivenOpacity=!1,this.usePBR=!1,this.upVectorAlignment=0,this.pathCapType=1,this.cullFace=2}}class G{constructor(t,e){this.layout=t,this.textureBufferLayout=e,this.maxTextureBufferItemIndex=u}elementCount(t){return t.get("pathVertexInfo")?.indices.length??0}elementCountTextureBuffer(t){return t.get("position")?.indices.length??0}write(t,e,i,r,u,p){S(null!=p,"Texture buffer is required for path material"),R(i,r,this.layout,t,e,u);const f=p.offset,l=p.textureBufferRange.from,m=u.buffer.getField("pathVertexInfo",s),g=i.get("pathVertexInfo");if(m&&g){S(1===g.size);const{data:t,stride:e,indices:i}=g;for(let r=0;r<i.length;++r){const s=t[e*i[r]];m.set(u.offset+r,b(s,l))}}const d=p.buffer.getField("position",o),_=i.get("position");d&&_&&(S(3===_.size),P(_,t,d,f));const y=p.buffer.getField("profileRight",a),x=i.get("profileRight");y&&x&&(S(2===x.size),M(x,y,f));const z=p.buffer.getField("profileUp",a),V=i.get("profileUp");z&&V&&(S(2===V.size),M(V,z,f));const j=p.buffer.getField("profileRotation",n),w=i.get("profileRotation");j&&w&&(S(1===w.size),C(w,j,f));const F=p.buffer.getField("pathRotationUp",a),v=i.get("pathRotationUp");F&&v&&(S(2===v.size),M(v,F,f));const O=p.buffer.getField("pathMaxStretchDistance",c),T=i.get("pathMaxStretchDistance");O&&T&&(S(1===T.size),A(T,O,f));const I=p.buffer.getField("sizeFeatureAttribute",h),U=i.get("sizeFeatureAttribute");I&&U&&B(U,I,f);const k=p.buffer.getField("opacityFeatureAttribute",h),q=i.get("opacityFeatureAttribute");k&&q&&B(q,k,f);const L=p.buffer.getField("colorFeatureAttribute",h),D=i.get("colorFeatureAttribute");L&&D&&B(D,L,f)}}export{D as Parameters,G as PathBufferWriter,I as PathMaterial};
2
+ import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as e}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewUint32 as i,BufferViewVec3f as r,BufferViewVec2Snorm16 as s,BufferViewSnorm16 as o,BufferViewFloat16 as a,BufferViewFloat as n,BufferViewVec2f as h,BufferViewVec4Unorm8 as c,BufferViewUnorm8 as p}from"../../../../geometry/support/buffer/BufferView.js";import{maxPathFrameIndex as u}from"../../layers/graphics/Graphics3DPathSymbolLayerConstants.js";import{isShadowLike as f,is3DGeometry as l,isColor as g}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as m}from"../effects/geometry/olidUtils.js";import d from"../lib/GLMaterial.js";import{isPathGeometry as b}from"../lib/PathGeometry.js";import{offsetPathVertexInfoFrameIndex as y}from"../lib/PathVertexInfo.js";import{MeshIntersectionOptions as _,intersectAabbInvDir as S}from"../lib/RayIntersections.js";import{assert as F}from"../lib/Util.js";import{applyPolygonOffsetToHit as P}from"./intersectWithPolygonOffset.js";import{getLayout as x,getTextureLayout as V}from"./PathLayouts.js";import{PathPassParameters as w,PathTechnique as R}from"./PathTechnique.js";import{PathTechniqueConfiguration as j}from"./PathTechniqueConfiguration.js";import{TriangleMaterial as C}from"./TriangleMaterial.js";import{writeAttributes as z,writePosition as M,writeBufferVec2 as O,writeBufferInt16 as v,writeBufferFloat16 as A,writeBufferFloat as B,writeColor as T,writeBufferUint8 as I,writeOlidColor as U}from"./internal/bufferWriterUtils.js";import{hasShadowHighlights as q}from"../shaders/ReceiveShadowsConfiguration.js";import{alphaCutoff as L}from"../../../../webscene/support/AlphaCutoff.js";class D extends C{constructor(e,i){super(e,W),this.supportsEdges=!0,this._pp0=t(0,0,1),this._pp1=t(0,0,0),this.produces=new Map([[2,t=>(this.parameters.castShadows&&f(t)||l(t))&&!this.transparent],[4,t=>(this.parameters.castShadows&&f(t)||l(t))&&this.transparent]]),this._configuration=new j(i.spherical)}get emissions(){return this.parameters.emissiveStrength>0?this.transparent?2:1:0}updateConfiguration(t){super.updateConfiguration(t),this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.transparent,this._configuration.hasOccludees=t.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?0:this.parameters.cullFace,this._configuration.offsetBackfaces=this.transparent,g(t.output)?(this._configuration.receiveShadows=t.shadowMap.enabled,this._configuration.hasShadowHighlights=q(this._configuration,t),this._configuration.receiveAmbientOcclusion=null!=t.ssao):this._configuration.receiveShadows=this._configuration.hasShadowHighlights=this._configuration.receiveAmbientOcclusion=!1,this._configuration.pbrMode=this.parameters.usePBR?2:0,this._configuration.emissionSource=this.parameters.usePBR?1:0,this._configuration.snowCover=t.snowCover>0,this._configuration.upVectorAlignment=this.parameters.upVectorAlignment,this._configuration.pathCapType=this.parameters.pathCapType,this._configuration.pathProfileType=this.parameters.profile.type,this._configuration.hasPathSize=this.parameters.hasPathSize,this._configuration.hasPathColor=this.parameters.hasPathColor,this._configuration.hasPathOpacity=this.parameters.hasPathOpacity}isVisibleForOutput(t){return 5!==t&&7!==t&&6!==t||this.parameters.castShadows}get visible(){return this.parameters.opacity>=L}intersectRay(t,e,i,r,s,o){this._intersectRay(t,i,r,s,o)}intersectRayDraped(t,e,i,r){return this._pp0[0]=this._pp1[0]=i[0],this._pp0[1]=this._pp1[1]=i[1],this._intersectRay(t,e,this._pp0,this._pp1,r)}intersectScreenPolygon(t,e,i,r){return b(t)?P(t.intersectScreenPolygon(i,e,r),this._configuration,i.camera.eye):null}_intersectRay(t,i,r,s,o){if(!b(t))return;const a=new _(i.tolerance,!1,i.options.normalRequired),n=t.boundingInfo;if(null==n)return void t.intersectRay(r,s,a,o);const h=e(n.bbMin[0],n.bbMin[1],n.bbMin[2],n.bbMax[0],n.bbMax[1],n.bbMax[2]),c=[s[0]-r[0],s[1]-r[1],s[2]-r[2]],p=Math.sqrt(c[0]*c[0]+c[1]*c[1]+c[2]*c[2]),u=[p/c[0],p/c[1],p/c[2]];S(h,r,u,i.tolerance)&&t.intersectRay(r,s,a,o)}createBufferWriter(){return new H(x(),V(this.parameters))}createGLMaterial(t){return new G(t)}get transparent(){const{parameters:t}=this;return t.drivenOpacity||t.opacity<1}}class G extends d{beginSlot(t){return this.getTechnique(R,t)}}class W extends w{constructor(){super(...arguments),this.polygonOffset=0,this.castShadows=!0,this.hasSlicePlane=!1,this.drivenOpacity=!1,this.usePBR=!1,this.upVectorAlignment=0,this.pathCapType=1,this.cullFace=2}}class H{constructor(t,e){this.layout=t,this.textureBufferLayout=e,this.maxTextureBufferItemIndex=u}elementCount(t){return t.get("pathVertexInfo")?.indices.length??0}elementCountTextureBuffer(t){return t.get("position")?.indices.length??0}write(t,e,u,f,l,g){F(null!=g,"Texture buffer is required for path material"),z(u,f,this.layout,t,e,l);const d=g.offset,b=g.textureBufferRange.from,_=l.buffer.getField("pathVertexInfo",i),S=u.get("pathVertexInfo");if(_&&S){F(1===S.size);const{data:t,stride:e,indices:i}=S;for(let r=0;r<i.length;++r){const s=t[e*i[r]];_.set(l.offset+r,y(s,b))}}const P=g.buffer.getField("position",r),x=u.get("position");P&&x&&(F(3===x.size),M(x,t,P,d));const V=g.buffer.getField("profileRight",s),w=u.get("profileRight");V&&w&&(F(2===w.size),O(w,V,d));const R=g.buffer.getField("profileUp",s),j=u.get("profileUp");R&&j&&(F(2===j.size),O(j,R,d));const C=g.buffer.getField("profileRotation",o),q=u.get("profileRotation");C&&q&&(F(1===q.size),v(q,C,d));const L=g.buffer.getField("pathRotationUp",s),D=u.get("pathRotationUp");L&&D&&(F(2===D.size),O(D,L,d));const G=g.buffer.getField("pathMaxStretchDistance",a),W=u.get("pathMaxStretchDistance");G&&W&&(F(1===W.size),A(W,G,d));const H=g.buffer.getField("sizeFeatureAttribute",n),k=u.get("sizeFeatureAttribute");H&&k&&B(k,H,d);const E=g.buffer.getField("size",h),J=u.get("size");E&&J&&(F(2===J.size),O(J,E,d));const K=g.buffer.getField("colorFeatureAttribute",n),N=u.get("colorFeatureAttribute");K&&N&&B(N,K,d);const Q=g.buffer.getField("color",c),X=u.get("color");Q&&X&&T(X,4,Q,d);const Y=g.buffer.getField("opacityFeatureAttribute",n),Z=u.get("opacityFeatureAttribute");Y&&Z&&B(Z,Y,d);const $=g.buffer.getField("opacity",p),tt=u.get("opacity");if($&&tt&&(F(1===tt.size),I(tt,$,d)),m()){const t=g.buffer.getField("olidColor",c),e=x?.indices.length??0;f&&t&&e&&U(f,t,e,d)}}}export{W as Parameters,H as PathBufferWriter,D as PathMaterial};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as o}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TriangleTechniqueConfiguration as e}from"./TriangleTechniqueConfiguration.js";class i extends e{constructor(o){super(),this.spherical=o,this.offsetBackfaces=!1,this.cullFace=0,this.pbrMode=0,this.emissionSource=0,this.upVectorAlignment=0,this.pathCapType=3,this.pathProfileType=0,this.receiveShadows=!1,this.hasShadowHighlights=!1,this.receiveAmbientOcclusion=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.hasVVOpacity=!1,this.hasOccludees=!1,this.snowCover=!1,this.receiveGlobalIllumination=!1,this.supportNaN=!0,this.textureCoordinateType=0,this.hasVVInstancing=!1,this.useCustomDTRExponentForWater=!1,this.useFillLights=!0,this.hasColorTexture=!1,this.hasMetallicRoughnessTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.draped=!1,this.overlayEnabled=!1,this.doubleSidedMode=0,this.renderOccluded=!1}}o([t()],i.prototype,"offsetBackfaces",void 0),o([t({count:3})],i.prototype,"cullFace",void 0),o([t({count:7})],i.prototype,"pbrMode",void 0),o([t({count:8})],i.prototype,"emissionSource",void 0),o([t({count:2})],i.prototype,"upVectorAlignment",void 0),o([t({count:4})],i.prototype,"pathCapType",void 0),o([t({count:2})],i.prototype,"pathProfileType",void 0),o([t()],i.prototype,"receiveShadows",void 0),o([t()],i.prototype,"hasShadowHighlights",void 0),o([t()],i.prototype,"receiveAmbientOcclusion",void 0),o([t()],i.prototype,"hasVVSize",void 0),o([t()],i.prototype,"hasVVColor",void 0),o([t()],i.prototype,"hasVVOpacity",void 0),o([t()],i.prototype,"hasOccludees",void 0),o([t()],i.prototype,"snowCover",void 0),o([t()],i.prototype,"receiveGlobalIllumination",void 0);export{i as PathTechniqueConfiguration};
2
+ import{__decorate as t}from"tslib";import{parameter as o}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TriangleTechniqueConfiguration as e}from"./TriangleTechniqueConfiguration.js";class i extends e{constructor(t){super(),this.spherical=t,this.offsetBackfaces=!1,this.cullFace=0,this.pbrMode=0,this.emissionSource=0,this.upVectorAlignment=0,this.pathCapType=3,this.pathProfileType=0,this.receiveShadows=!1,this.hasShadowHighlights=!1,this.receiveAmbientOcclusion=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.hasVVOpacity=!1,this.hasPathSize=!1,this.hasPathColor=!1,this.hasPathOpacity=!1,this.hasOccludees=!1,this.snowCover=!1,this.receiveGlobalIllumination=!1,this.supportNaN=!0,this.textureCoordinateType=0,this.hasVVInstancing=!1,this.useCustomDTRExponentForWater=!1,this.useFillLights=!0,this.hasColorTexture=!1,this.hasMetallicRoughnessTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.draped=!1,this.overlayEnabled=!1,this.doubleSidedMode=0,this.renderOccluded=!1}}t([o()],i.prototype,"offsetBackfaces",void 0),t([o({count:3})],i.prototype,"cullFace",void 0),t([o({count:7})],i.prototype,"pbrMode",void 0),t([o({count:8})],i.prototype,"emissionSource",void 0),t([o({count:2})],i.prototype,"upVectorAlignment",void 0),t([o({count:4})],i.prototype,"pathCapType",void 0),t([o({count:2})],i.prototype,"pathProfileType",void 0),t([o()],i.prototype,"receiveShadows",void 0),t([o()],i.prototype,"hasShadowHighlights",void 0),t([o()],i.prototype,"receiveAmbientOcclusion",void 0),t([o()],i.prototype,"hasVVSize",void 0),t([o()],i.prototype,"hasVVColor",void 0),t([o()],i.prototype,"hasVVOpacity",void 0),t([o()],i.prototype,"hasPathSize",void 0),t([o()],i.prototype,"hasPathColor",void 0),t([o()],i.prototype,"hasPathOpacity",void 0),t([o()],i.prototype,"hasOccludees",void 0),t([o()],i.prototype,"snowCover",void 0),t([o()],i.prototype,"receiveGlobalIllumination",void 0);export{i as PathTechniqueConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{subtract as e,length as t,scale as f}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isOrthoNormal as r,hasIdentityRotation as i}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{BufferViewVec4u8 as n,BufferViewVec4f as s,BufferViewFloat as c,BufferViewVec2i16 as l,BufferViewVec2f16 as d,BufferViewVec2f as u,BufferViewVec3f as a}from"../../../../../geometry/support/buffer/BufferView.js";import{assert as p}from"../../lib/Util.js";function g(e,t,f){const{data:o,indices:r}=e,i=t.typedBuffer,n=t.typedBufferStride,s=r.length;f*=n;for(let c=0;c<s;++c)i[f]=o[r[c]],f+=n}function y(e,t,f,o=1){const{data:r,indices:i}=e,n=t.typedBuffer,s=t.typedBufferStride,c=i.length;if(f*=s,1===o)for(let l=0;l<c;++l)n[f]=r[i[l]],f+=s;else for(let l=0;l<c;++l){const e=r[i[l]];for(let t=0;t<o;t++)n[f]=e,f+=s}}function B(e,t,f){const{data:o,indices:r}=e,i=t.typedBuffer,n=t.typedBufferStride,s=r.length;f*=n;for(let c=0;c<s;++c)i[f]=o[r[c]],f+=n}function b(e,t,f){const{data:o,stride:r,indices:i}=e,n=i.length;for(let s=0;s<n;++s)t.set(f+s,o[r*i[s]])}function h(e,t,f){const{data:o,indices:r}=e,i=t.typedBuffer,n=t.typedBufferStride,s=r.length;f*=n;for(let c=0;c<s;++c){const e=2*r[c];i[f]=o[e],i[f+1]=o[e+1],f+=n}}function m(e,t,f,o=1){const{data:r,indices:i}=e,n=t.typedBuffer,s=t.typedBufferStride,c=i.length;if(f*=s,1===o)for(let l=0;l<c;++l){const e=3*i[l];n[f]=r[e],n[f+1]=r[e+1],n[f+2]=r[e+2],f+=s}else for(let l=0;l<c;++l){const e=3*i[l];for(let t=0;t<o;++t)n[f]=r[e],n[f+1]=r[e+1],n[f+2]=r[e+2],f+=s}}function v(e,t,f,o=1){const{data:r,indices:i}=e,n=t.typedBuffer,s=t.typedBufferStride,c=i.length;if(f*=s,1===o)for(let l=0;l<c;++l){const e=4*i[l];n[f]=r[e],n[f+1]=r[e+1],n[f+2]=r[e+2],n[f+3]=r[e+3],f+=s}else for(let l=0;l<c;++l){const e=4*i[l];for(let t=0;t<o;++t)n[f]=r[e],n[f+1]=r[e+1],n[f+2]=r[e+2],n[f+3]=r[e+3],f+=s}}function S(e,t,f){const o=e.typedBuffer,r=e.typedBufferStride,i=e.elementCount;t*=r;for(let n=0;n<f;++n){for(let e=0;e<i;++e)o[t+e]=0;t+=r}}function F(e,t,f){const{data:o,indices:r}=e,i=t.typedBuffer,n=t.typedBufferStride,s=r.length;f*=n;for(let c=0;c<s;++c){const e=9*r[c];for(let t=0;t<9;++t)i[f+t]=o[e+t];f+=n}}function z(e,t,f){const{data:o,indices:r}=e,i=t.typedBuffer,n=t.typedBufferStride,s=r.length;f*=n;for(let c=0;c<s;++c){const e=16*r[c];for(let t=0;t<16;++t)i[f+t]=o[e+t];f+=n}}function w(e,t,f,o,r=1){if(!t)return void m(e,f,o,r);const{data:n,indices:s}=e,c=f.typedBuffer,l=f.typedBufferStride,d=s.length,u=t[0],a=t[1],p=t[2],g=t[4],y=t[5],B=t[6],b=t[8],h=t[9],v=t[10],S=t[12],F=t[13],z=t[14];o*=l;let w=0,k=0,N=0;const $=i(t)?e=>{w=n[e]+S,k=n[e+1]+F,N=n[e+2]+z}:e=>{const t=n[e],f=n[e+1],o=n[e+2];w=u*t+g*f+b*o+S,k=a*t+y*f+h*o+F,N=p*t+B*f+v*o+z};if(1===r)for(let i=0;i<d;++i)$(3*s[i]),c[o]=w,c[o+1]=k,c[o+2]=N,o+=l;else for(let i=0;i<d;++i){$(3*s[i]);for(let e=0;e<r;++e)c[o]=w,c[o+1]=k,c[o+2]=N,o+=l}}function k(e,t,f,o,n=1){if(!t)return void m(e,f,o,n);const{data:s,indices:c}=e,l=t,d=f.typedBuffer,u=f.typedBufferStride,a=c.length,p=l[0],g=l[1],y=l[2],B=l[4],b=l[5],h=l[6],v=l[8],S=l[9],F=l[10],z=!r(l),w=1e-6,k=1-w;o*=u;let N=0,$=0,x=0;const M=i(l)?e=>{N=s[e],$=s[e+1],x=s[e+2]}:e=>{const t=s[e],f=s[e+1],o=s[e+2];N=p*t+B*f+v*o,$=g*t+b*f+S*o,x=y*t+h*f+F*o};if(1===n)if(z)for(let r=0;r<a;++r){M(3*c[r]);const e=N*N+$*$+x*x;if(e<k&&e>w){const t=1/Math.sqrt(e);d[o]=N*t,d[o+1]=$*t,d[o+2]=x*t}else d[o]=N,d[o+1]=$,d[o+2]=x;o+=u}else for(let r=0;r<a;++r)M(3*c[r]),d[o]=N,d[o+1]=$,d[o+2]=x,o+=u;else for(let r=0;r<a;++r){if(M(3*c[r]),z){const e=N*N+$*$+x*x;if(e<k&&e>w){const t=1/Math.sqrt(e);N*=t,$*=t,x*=t}}for(let e=0;e<n;++e)d[o]=N,d[o+1]=$,d[o+2]=x,o+=u}}function N(e,t,f,o,i=1){if(!t)return void v(e,f,o,i);const{data:n,indices:s}=e,c=t,l=f.typedBuffer,d=f.typedBufferStride,u=s.length,a=c[0],p=c[1],g=c[2],y=c[4],B=c[5],b=c[6],h=c[8],m=c[9],S=c[10],F=!r(c),z=1e-6,w=1-z;if(o*=d,1===i)for(let r=0;r<u;++r){const e=4*s[r],t=n[e],f=n[e+1],i=n[e+2],c=n[e+3];let u=a*t+y*f+h*i,v=p*t+B*f+m*i,k=g*t+b*f+S*i;if(F){const e=u*u+v*v+k*k;if(e<w&&e>z){const t=1/Math.sqrt(e);u*=t,v*=t,k*=t}}l[o]=u,l[o+1]=v,l[o+2]=k,l[o+3]=c,o+=d}else for(let r=0;r<u;++r){const e=4*s[r],t=n[e],f=n[e+1],c=n[e+2],u=n[e+3];let v=a*t+y*f+h*c,k=p*t+B*f+m*c,N=g*t+b*f+S*c;if(F){const e=v*v+k*k+N*N;if(e<w&&e>z){const t=1/Math.sqrt(e);v*=t,k*=t,N*=t}}for(let r=0;r<i;++r)l[o]=v,l[o+1]=k,l[o+2]=N,l[o+3]=u,o+=d}}function $(e,t,f,o,r=1){const{data:i,indices:n}=e,s=f.typedBuffer,c=f.typedBufferStride,l=n.length;if(o*=c,t===i.length&&4===t){s[o]=i[0],s[o+1]=i[1],s[o+2]=i[2],s[o+3]=i[3];const e=new Uint32Array(f.typedBuffer.buffer,f.start),t=c/4,n=e[o/=4];o+=t;const d=l*r;for(let f=1;f<d;++f)e[o]=n,o+=t;return}if(1!==r)if(4!==t)for(let d=0;d<l;++d){const e=3*n[d];for(let t=0;t<r;++t)s[o]=i[e],s[o+1]=i[e+1],s[o+2]=i[e+2],s[o+3]=255,o+=c}else for(let d=0;d<l;++d){const e=4*n[d];for(let t=0;t<r;++t)s[o]=i[e],s[o+1]=i[e+1],s[o+2]=i[e+2],s[o+3]=i[e+3],o+=c}else{if(4===t){for(let e=0;e<l;++e){const t=4*n[e];s[o]=i[t],s[o+1]=i[t+1],s[o+2]=i[t+2],s[o+3]=i[t+3],o+=c}return}for(let e=0;e<l;++e){const t=3*n[e];s[o]=i[t],s[o+1]=i[t+1],s[o+2]=i[t+2],s[o+3]=255,o+=c}}}function x(e,t,f){const{data:o,indices:r}=e,i=t.typedBuffer,n=t.typedBufferStride,s=r.length,c=o[0];f*=n;for(let l=0;l<s;++l)i[f]=c,f+=n}function M(o,r,i,n){e(j,o,r);const s=Math.max(Math.sqrt(t(j)),1e-4);f(j,j,1/s),i[n++]=j[0],i[n++]=j[1],i[n++]=j[2],i[n++]=s}const j=o();function q(e,t,f,o,r=1){const i=t.typedBuffer,n=t.typedBufferStride;if(o*=n,1===r)for(let s=0;s<f;++s)i[o]=e[0],i[o+1]=e[1],i[o+2]=e[2],i[o+3]=e[3],o+=n;else for(let s=0;s<f;++s)for(let t=0;t<r;++t)i[o]=e[0],i[o+1]=e[1],i[o+2]=e[2],i[o+3]=e[3],o+=n}function A(e,t,f,o,r,i){const{buffer:s,offset:c}=i;for(const l of f.fields.keys()){const f=e.get(l),i=f?.indices;if(f&&i)C(l,f,o,r,s,c);else if("olidColor"===l&&null!=t){const f=e.get("position")?.indices;if(f){const e=f.length;q(t,s.getField(l,n),e,c)}}}}function C(e,t,f,o,r,i){switch(e){case"position":{p(3===t.size);const o=r.getField(e,a);p(!!o,`No buffer view for ${e}`),w(t,f,o,i);break}case"normal":{p(3===t.size);const f=r.getField(e,a);p(!!f,`No buffer view for ${e}`),k(t,o,f,i);break}case"normalCompressed":case"profileRight":case"profileUp":{p(2===t.size);const f=r.getField(e,l);p(!!f,`No buffer view for ${e}`),h(t,f,i);break}case"uv0":{p(2===t.size);const f=r.getField(e,d)??r.getField(e,u);p(!!f,`No buffer view for ${e}`),h(t,f,i);break}case"uvi":{p(2===t.size);const f=r.getField(e,l);p(!!f,`No buffer view for ${e}`),h(t,f,i);break}case"color":case"symbolColor":{const f=r.getField(e,n);p(!!f,`No buffer view for ${e}`),p(3===t.size||4===t.size),$(t,t.size,f,i);break}case"colorFeatureAttribute":case"opacityFeatureAttribute":case"sizeFeatureAttribute":{const f=r.getField(e,c)??r.getField(e,c);p(!!f,`No buffer view for ${e}`),p(1===t.size),x(t,f,i);break}case"tangent":{p(4===t.size);const o=r.getField(e,s);p(!!o,`No buffer view for ${e}`),N(t,f,o,i);break}}}function U(e,t,f,o){const{data:r,stride:i,size:n,indices:s}=e;p(1===n,"Index should be 1D");const c=s.length;for(let l=0;l<c;++l){const e=r[i*s[l]];t.set(f+l,o+e)}}function D(e,t,f,o){for(let r=0;r<o;++r)e.set(t+r,f)}export{C as writeAttribute,A as writeAttributes,y as writeBufferFloat,g as writeBufferFloat16,B as writeBufferInt16,F as writeBufferMat3f,z as writeBufferMat4f,b as writeBufferUint32,h as writeBufferVec2,m as writeBufferVec3,v as writeBufferVec4,S as writeBufferZeros,$ as writeColor,D as writeConstTextureElementIndex,M as writeDeltaF16Vector,k as writeNormal,q as writeOlidColor,w as writePosition,N as writeTangent,U as writeTextureElementIndex,x as writeVVFeatureAttribute};
2
+ import{subtract as e,length as t,scale as f}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isOrthoNormal as r,hasIdentityRotation as i}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{BufferViewVec4u8 as n,BufferViewVec4f as s,BufferViewFloat as c,BufferViewVec2i16 as l,BufferViewVec2f16 as d,BufferViewVec2f as u,BufferViewVec3f as a}from"../../../../../geometry/support/buffer/BufferView.js";import{assert as p}from"../../lib/Util.js";function g(e,t,f){const{data:o,indices:r}=e,i=t.typedBuffer,n=t.typedBufferStride,s=r.length;f*=n;for(let c=0;c<s;++c)i[f]=o[r[c]],f+=n}function y(e,t,f,o=1){const{data:r,indices:i}=e,n=t.typedBuffer,s=t.typedBufferStride,c=i.length;if(f*=s,1===o)for(let l=0;l<c;++l)n[f]=r[i[l]],f+=s;else for(let l=0;l<c;++l){const e=r[i[l]];for(let t=0;t<o;t++)n[f]=e,f+=s}}function B(e,t,f){const{data:o,indices:r}=e,i=t.typedBuffer,n=t.typedBufferStride,s=r.length;f*=n;for(let c=0;c<s;++c)i[f]=o[r[c]],f+=n}function h(e,t,f){const{data:o,stride:r,indices:i}=e,n=i.length;for(let s=0;s<n;++s)t.set(f+s,o[r*i[s]])}function b(e,t,f){const{data:o,stride:r,indices:i}=e,n=i.length;for(let s=0;s<n;++s)t.set(f+s,o[r*i[s]])}function m(e,t,f){const{data:o,indices:r}=e,i=t.typedBuffer,n=t.typedBufferStride,s=r.length;f*=n;for(let c=0;c<s;++c){const e=2*r[c];i[f]=o[e],i[f+1]=o[e+1],f+=n}}function v(e,t,f,o=1){const{data:r,indices:i}=e,n=t.typedBuffer,s=t.typedBufferStride,c=i.length;if(f*=s,1===o)for(let l=0;l<c;++l){const e=3*i[l];n[f]=r[e],n[f+1]=r[e+1],n[f+2]=r[e+2],f+=s}else for(let l=0;l<c;++l){const e=3*i[l];for(let t=0;t<o;++t)n[f]=r[e],n[f+1]=r[e+1],n[f+2]=r[e+2],f+=s}}function S(e,t,f,o=1){const{data:r,indices:i}=e,n=t.typedBuffer,s=t.typedBufferStride,c=i.length;if(f*=s,1===o)for(let l=0;l<c;++l){const e=4*i[l];n[f]=r[e],n[f+1]=r[e+1],n[f+2]=r[e+2],n[f+3]=r[e+3],f+=s}else for(let l=0;l<c;++l){const e=4*i[l];for(let t=0;t<o;++t)n[f]=r[e],n[f+1]=r[e+1],n[f+2]=r[e+2],n[f+3]=r[e+3],f+=s}}function F(e,t,f){const o=e.typedBuffer,r=e.typedBufferStride,i=e.elementCount;t*=r;for(let n=0;n<f;++n){for(let e=0;e<i;++e)o[t+e]=0;t+=r}}function z(e,t,f){const{data:o,indices:r}=e,i=t.typedBuffer,n=t.typedBufferStride,s=r.length;f*=n;for(let c=0;c<s;++c){const e=9*r[c];for(let t=0;t<9;++t)i[f+t]=o[e+t];f+=n}}function w(e,t,f){const{data:o,indices:r}=e,i=t.typedBuffer,n=t.typedBufferStride,s=r.length;f*=n;for(let c=0;c<s;++c){const e=16*r[c];for(let t=0;t<16;++t)i[f+t]=o[e+t];f+=n}}function k(e,t,f,o,r=1){if(!t)return void v(e,f,o,r);const{data:n,indices:s}=e,c=f.typedBuffer,l=f.typedBufferStride,d=s.length,u=t[0],a=t[1],p=t[2],g=t[4],y=t[5],B=t[6],h=t[8],b=t[9],m=t[10],S=t[12],F=t[13],z=t[14];o*=l;let w=0,k=0,N=0;const $=i(t)?e=>{w=n[e]+S,k=n[e+1]+F,N=n[e+2]+z}:e=>{const t=n[e],f=n[e+1],o=n[e+2];w=u*t+g*f+h*o+S,k=a*t+y*f+b*o+F,N=p*t+B*f+m*o+z};if(1===r)for(let i=0;i<d;++i)$(3*s[i]),c[o]=w,c[o+1]=k,c[o+2]=N,o+=l;else for(let i=0;i<d;++i){$(3*s[i]);for(let e=0;e<r;++e)c[o]=w,c[o+1]=k,c[o+2]=N,o+=l}}function N(e,t,f,o,n=1){if(!t)return void v(e,f,o,n);const{data:s,indices:c}=e,l=t,d=f.typedBuffer,u=f.typedBufferStride,a=c.length,p=l[0],g=l[1],y=l[2],B=l[4],h=l[5],b=l[6],m=l[8],S=l[9],F=l[10],z=!r(l),w=1e-6,k=1-w;o*=u;let N=0,$=0,x=0;const M=i(l)?e=>{N=s[e],$=s[e+1],x=s[e+2]}:e=>{const t=s[e],f=s[e+1],o=s[e+2];N=p*t+B*f+m*o,$=g*t+h*f+S*o,x=y*t+b*f+F*o};if(1===n)if(z)for(let r=0;r<a;++r){M(3*c[r]);const e=N*N+$*$+x*x;if(e<k&&e>w){const t=1/Math.sqrt(e);d[o]=N*t,d[o+1]=$*t,d[o+2]=x*t}else d[o]=N,d[o+1]=$,d[o+2]=x;o+=u}else for(let r=0;r<a;++r)M(3*c[r]),d[o]=N,d[o+1]=$,d[o+2]=x,o+=u;else for(let r=0;r<a;++r){if(M(3*c[r]),z){const e=N*N+$*$+x*x;if(e<k&&e>w){const t=1/Math.sqrt(e);N*=t,$*=t,x*=t}}for(let e=0;e<n;++e)d[o]=N,d[o+1]=$,d[o+2]=x,o+=u}}function $(e,t,f,o,i=1){if(!t)return void S(e,f,o,i);const{data:n,indices:s}=e,c=t,l=f.typedBuffer,d=f.typedBufferStride,u=s.length,a=c[0],p=c[1],g=c[2],y=c[4],B=c[5],h=c[6],b=c[8],m=c[9],v=c[10],F=!r(c),z=1e-6,w=1-z;if(o*=d,1===i)for(let r=0;r<u;++r){const e=4*s[r],t=n[e],f=n[e+1],i=n[e+2],c=n[e+3];let u=a*t+y*f+b*i,S=p*t+B*f+m*i,k=g*t+h*f+v*i;if(F){const e=u*u+S*S+k*k;if(e<w&&e>z){const t=1/Math.sqrt(e);u*=t,S*=t,k*=t}}l[o]=u,l[o+1]=S,l[o+2]=k,l[o+3]=c,o+=d}else for(let r=0;r<u;++r){const e=4*s[r],t=n[e],f=n[e+1],c=n[e+2],u=n[e+3];let S=a*t+y*f+b*c,k=p*t+B*f+m*c,N=g*t+h*f+v*c;if(F){const e=S*S+k*k+N*N;if(e<w&&e>z){const t=1/Math.sqrt(e);S*=t,k*=t,N*=t}}for(let r=0;r<i;++r)l[o]=S,l[o+1]=k,l[o+2]=N,l[o+3]=u,o+=d}}function x(e,t,f,o,r=1){const{data:i,indices:n}=e,s=f.typedBuffer,c=f.typedBufferStride,l=n.length;if(o*=c,t===i.length&&4===t){s[o]=i[0],s[o+1]=i[1],s[o+2]=i[2],s[o+3]=i[3];const e=new Uint32Array(f.typedBuffer.buffer,f.start),t=c/4,n=e[o/=4];o+=t;const d=l*r;for(let f=1;f<d;++f)e[o]=n,o+=t;return}if(1!==r)if(4!==t)for(let d=0;d<l;++d){const e=3*n[d];for(let t=0;t<r;++t)s[o]=i[e],s[o+1]=i[e+1],s[o+2]=i[e+2],s[o+3]=255,o+=c}else for(let d=0;d<l;++d){const e=4*n[d];for(let t=0;t<r;++t)s[o]=i[e],s[o+1]=i[e+1],s[o+2]=i[e+2],s[o+3]=i[e+3],o+=c}else{if(4===t){for(let e=0;e<l;++e){const t=4*n[e];s[o]=i[t],s[o+1]=i[t+1],s[o+2]=i[t+2],s[o+3]=i[t+3],o+=c}return}for(let e=0;e<l;++e){const t=3*n[e];s[o]=i[t],s[o+1]=i[t+1],s[o+2]=i[t+2],s[o+3]=255,o+=c}}}function M(e,t,f){const{data:o,indices:r}=e,i=t.typedBuffer,n=t.typedBufferStride,s=r.length,c=o[0];f*=n;for(let l=0;l<s;++l)i[f]=c,f+=n}function j(o,r,i,n){e(q,o,r);const s=Math.max(Math.sqrt(t(q)),1e-4);f(q,q,1/s),i[n++]=q[0],i[n++]=q[1],i[n++]=q[2],i[n++]=s}const q=o();function A(e,t,f,o,r=1){const i=t.typedBuffer,n=t.typedBufferStride;if(o*=n,1===r)for(let s=0;s<f;++s)i[o]=e[0],i[o+1]=e[1],i[o+2]=e[2],i[o+3]=e[3],o+=n;else for(let s=0;s<f;++s)for(let t=0;t<r;++t)i[o]=e[0],i[o+1]=e[1],i[o+2]=e[2],i[o+3]=e[3],o+=n}function C(e,t,f,o,r,i){const{buffer:s,offset:c}=i;for(const l of f.fields.keys()){const f=e.get(l),i=f?.indices;if(f&&i)U(l,f,o,r,s,c);else if("olidColor"===l&&null!=t){const f=e.get("position")?.indices;if(f){const e=f.length;A(t,s.getField(l,n),e,c)}}}}function U(e,t,f,o,r,i){switch(e){case"position":{p(3===t.size);const o=r.getField(e,a);p(!!o,`No buffer view for ${e}`),k(t,f,o,i);break}case"normal":{p(3===t.size);const f=r.getField(e,a);p(!!f,`No buffer view for ${e}`),N(t,o,f,i);break}case"normalCompressed":case"profileRight":case"profileUp":{p(2===t.size);const f=r.getField(e,l);p(!!f,`No buffer view for ${e}`),m(t,f,i);break}case"uv0":{p(2===t.size);const f=r.getField(e,d)??r.getField(e,u);p(!!f,`No buffer view for ${e}`),m(t,f,i);break}case"uvi":{p(2===t.size);const f=r.getField(e,l);p(!!f,`No buffer view for ${e}`),m(t,f,i);break}case"color":case"symbolColor":{const f=r.getField(e,n);p(!!f,`No buffer view for ${e}`),p(3===t.size||4===t.size),x(t,t.size,f,i);break}case"colorFeatureAttribute":case"opacityFeatureAttribute":case"sizeFeatureAttribute":{const f=r.getField(e,c)??r.getField(e,c);p(!!f,`No buffer view for ${e}`),p(1===t.size),M(t,f,i);break}case"tangent":{p(4===t.size);const o=r.getField(e,s);p(!!o,`No buffer view for ${e}`),$(t,f,o,i);break}}}function D(e,t,f,o){const{data:r,stride:i,size:n,indices:s}=e;p(1===n,"Index should be 1D");const c=s.length;for(let l=0;l<c;++l){const e=r[i*s[l]];t.set(f+l,o+e)}}function I(e,t,f,o){for(let r=0;r<o;++r)e.set(t+r,f)}export{U as writeAttribute,C as writeAttributes,y as writeBufferFloat,g as writeBufferFloat16,B as writeBufferInt16,z as writeBufferMat3f,w as writeBufferMat4f,h as writeBufferUint32,b as writeBufferUint8,m as writeBufferVec2,v as writeBufferVec3,S as writeBufferVec4,F as writeBufferZeros,x as writeColor,I as writeConstTextureElementIndex,j as writeDeltaF16Vector,N as writeNormal,A as writeOlidColor,k as writePosition,$ as writeTangent,D as writeTextureElementIndex,M as writeVVFeatureAttribute};