@arcgis/core 5.1.0-next.53 → 5.1.0-next.55

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 (477) hide show
  1. package/analysis/VolumeMeasurement/volumeMeasurementConfiguration.js +1 -1
  2. package/applications/Components/SketchTooltipControls.d.ts +3 -2
  3. package/applications/Components/SketchTooltipControls.js +1 -1
  4. package/applications/Components/navigationDuration.d.ts +15 -0
  5. package/applications/Components/navigationDuration.js +2 -0
  6. package/assets/esri/core/workers/RemoteClient.js +1 -1
  7. package/assets/esri/core/workers/chunks/05bc675c029ed311427f.js +1 -0
  8. package/assets/esri/core/workers/chunks/05d25a98c54679233902.js +1 -0
  9. package/assets/esri/core/workers/chunks/0b4a2361b9f9a6c0b8a7.js +1 -0
  10. package/assets/esri/core/workers/chunks/0e88e61d89f89994c4bf.js +1 -0
  11. package/assets/esri/core/workers/chunks/0f2ab57e4eb722b3b0c0.js +1 -0
  12. package/assets/esri/core/workers/chunks/{f4d31d96681b649ddc95.js → 0ff12fe9e358100668d9.js} +1 -1
  13. package/assets/esri/core/workers/chunks/1613123918e9b0f7cfdb.js +1 -0
  14. package/assets/esri/core/workers/chunks/1a198c9e17f7a058669e.js +1 -0
  15. package/assets/esri/core/workers/chunks/1f91280032aa42b1585b.js +1 -0
  16. package/assets/esri/core/workers/chunks/2327b368673a974dee8b.js +1 -0
  17. package/assets/esri/core/workers/chunks/23eb204d3cb818adea32.js +1 -0
  18. package/assets/esri/core/workers/chunks/254898b41cabe313b6ce.js +1 -0
  19. package/assets/esri/core/workers/chunks/26cafd20c8d03c274389.js +1 -0
  20. package/assets/esri/core/workers/chunks/{a69f1879735a031f62e9.js → 2a2d5f9ea42cb2eee9c6.js} +1 -1
  21. package/assets/esri/core/workers/chunks/2bc6edeb3156d241677b.js +1 -0
  22. package/assets/esri/core/workers/chunks/{d587b7842091affdaac3.js → 3158a3487d3e8a61b680.js} +1 -1
  23. package/assets/esri/core/workers/chunks/34acecd7a314fed12335.js +1 -0
  24. package/assets/esri/core/workers/chunks/{07e791530677f7e70f32.js → 3a2ecb883fdb5c598544.js} +2 -2
  25. package/assets/esri/core/workers/chunks/{cdeb6aec578a1c07d663.js → 3cb0f020f9bfc6653c5d.js} +1 -1
  26. package/assets/esri/core/workers/chunks/3e0752a81a7247c567ab.js +1 -0
  27. package/assets/esri/core/workers/chunks/3ef740d25dc17bef11b2.js +1 -0
  28. package/assets/esri/core/workers/chunks/42e084704dea6e4135b6.js +1 -0
  29. package/assets/esri/core/workers/chunks/{5b3bb636e3bec625e515.js → 4301cb9670fa7c907460.js} +1 -1
  30. package/assets/esri/core/workers/chunks/457bbf27e9bc18132464.js +1 -0
  31. package/assets/esri/core/workers/chunks/45eddf3918973fa8d751.js +1 -0
  32. package/assets/esri/core/workers/chunks/48eca6f51112ba80bd3b.js +1 -0
  33. package/assets/esri/core/workers/chunks/4a6186001323b47c23a4.js +1 -0
  34. package/assets/esri/core/workers/chunks/4b3622fc355fd2fd8678.js +1 -0
  35. package/assets/esri/core/workers/chunks/4e7bb224bde9e5039263.js +1 -0
  36. package/assets/esri/core/workers/chunks/4f847a426973bd350c11.js +1 -0
  37. package/assets/esri/core/workers/chunks/{193775b3b7de8f5dc578.js → 4fb718174c6e07d752e0.js} +1 -1
  38. package/assets/esri/core/workers/chunks/5143f74f1fe7533a6069.js +1 -0
  39. package/assets/esri/core/workers/chunks/{36425d29aaa5852cb41d.js → 522bc1d79dbe957301e4.js} +1 -1
  40. package/assets/esri/core/workers/chunks/52dbfd7519555028a8af.js +1 -0
  41. package/assets/esri/core/workers/chunks/55214e1d9f3d98fa7ed9.js +1 -0
  42. package/assets/esri/core/workers/chunks/56bce3a6701f8549606b.js +1 -0
  43. package/assets/esri/core/workers/chunks/572fcd33ae3648ed4f9c.js +1 -0
  44. package/assets/esri/core/workers/chunks/576a1784e93c5406e657.js +1 -0
  45. package/assets/esri/core/workers/chunks/59289867cce97da74e39.js +1 -0
  46. package/assets/esri/core/workers/chunks/{fdf8fe0f50a9ae548c16.js → 5a1d975b3e9e6b7eff67.js} +1 -1
  47. package/assets/esri/core/workers/chunks/5a83ea967ecde01d5622.js +1 -0
  48. package/assets/esri/core/workers/chunks/5a9620cb66c8e64e4668.js +1 -0
  49. package/assets/esri/core/workers/chunks/5aff2d6ae0d2a2d92ecc.js +1 -0
  50. package/assets/esri/core/workers/chunks/5eb9fdb076488de9cd83.js +1 -0
  51. package/assets/esri/core/workers/chunks/66fc3c4d6c54eee231b9.js +1 -0
  52. package/assets/esri/core/workers/chunks/{de359f89e03da18999fc.js → 691d0a60354b6458b9de.js} +1 -1
  53. package/assets/esri/core/workers/chunks/69644b8a6ce340ca1159.js +1 -0
  54. package/assets/esri/core/workers/chunks/6ab8ed12d162d79a8c55.js +1 -0
  55. package/assets/esri/core/workers/chunks/{d44217de4c73475f9c66.js → 73a045061e69a22b6869.js} +1 -1
  56. package/assets/esri/core/workers/chunks/76064c2c801da55cd844.js +1 -0
  57. package/assets/esri/core/workers/chunks/770880ad43f252962017.js +1 -0
  58. package/assets/esri/core/workers/chunks/78cb6b9ab32abdd1d530.js +1 -0
  59. package/assets/esri/core/workers/chunks/7b6e3cc086d13da770fa.js +1 -0
  60. package/assets/esri/core/workers/chunks/7ed2aa1092c0a2c839c0.js +1 -0
  61. package/assets/esri/core/workers/chunks/83113a9e284701d053b5.js +1 -0
  62. package/assets/esri/core/workers/chunks/8418ad9ad7b6481ebe82.js +1 -0
  63. package/assets/esri/core/workers/chunks/85c72d9fa533552a6e8a.js +1 -0
  64. package/assets/esri/core/workers/chunks/861a7d0e665add901e11.js +1 -0
  65. package/assets/esri/core/workers/chunks/87077f4cbca13e030411.js +1 -0
  66. package/assets/esri/core/workers/chunks/{199f70c0373f6008a545.js → 8df0c154bb0d79a905c0.js} +1 -1
  67. package/assets/esri/core/workers/chunks/9066f095f16448c0a04e.js +1 -0
  68. package/assets/esri/core/workers/chunks/91718795fc4ca6516ac7.js +1 -0
  69. package/assets/esri/core/workers/chunks/929b26999321519824b9.js +1 -0
  70. package/assets/esri/core/workers/chunks/9321f5ec514805307219.js +1 -0
  71. package/assets/esri/core/workers/chunks/932a0b39d85a76377d52.js +1 -0
  72. package/assets/esri/core/workers/chunks/93d1118f7a909d123b40.js +1 -0
  73. package/assets/esri/core/workers/chunks/94f80c46ccf5e19038b8.js +1 -0
  74. package/assets/esri/core/workers/chunks/979c2f52b6d6e1e8241b.js +1 -0
  75. package/assets/esri/core/workers/chunks/{617328964d480d4a3a45.js → 9806cc96414065ae0afe.js} +1 -1
  76. package/assets/esri/core/workers/chunks/{e6220c1fa887e21ffbbd.js → 9a235c92f21df2c17aa8.js} +1 -1
  77. package/assets/esri/core/workers/chunks/{f7fb121169b7e5a5adbc.js → 9d11e7972bc298cb94ce.js} +1 -1
  78. package/assets/esri/core/workers/chunks/a11f05ddd8314b648f76.js +1 -0
  79. package/assets/esri/core/workers/chunks/{15a45e26964c2eb381a6.js → a256edc8337e462f80f0.js} +1 -1
  80. package/assets/esri/core/workers/chunks/a41fabf8b2cf15b7d0c9.js +1 -0
  81. package/assets/esri/core/workers/chunks/{987dc23fdc0a8c7150b9.js → a5bf2718c02a0e645013.js} +1 -1
  82. package/assets/esri/core/workers/chunks/a7a553e245ba011d259f.js +1 -0
  83. package/assets/esri/core/workers/chunks/a8e111a5cfd6151d5dbb.js +1 -0
  84. package/assets/esri/core/workers/chunks/a9eb90b901e64e67b7a3.js +1 -0
  85. package/assets/esri/core/workers/chunks/{21decfc1e477fb769204.js → aa7aaeae31ddb259e55e.js} +1 -1
  86. package/assets/esri/core/workers/chunks/ad1946c084219bb678a0.js +1 -0
  87. package/assets/esri/core/workers/chunks/aed45f7e7eee154a21b8.js +1 -0
  88. package/assets/esri/core/workers/chunks/b056b4c79bcd542dd1d2.js +1 -0
  89. package/assets/esri/core/workers/chunks/b1a0a7cdaf50f98adb3e.js +1 -0
  90. package/assets/esri/core/workers/chunks/b20f4c82d0b44fdb4670.js +1 -0
  91. package/assets/esri/core/workers/chunks/b39b4db86a1049f0b901.js +1 -0
  92. package/assets/esri/core/workers/chunks/{1a1e57267306c07e5bdb.js → b3f0600729227b458a75.js} +1 -1
  93. package/assets/esri/core/workers/chunks/bacc343a79828e456de7.js +1 -0
  94. package/assets/esri/core/workers/chunks/bb047157f09471ecea53.js +1 -0
  95. package/assets/esri/core/workers/chunks/bc3b22dc08c147b8d425.js +1 -0
  96. package/assets/esri/core/workers/chunks/{29c91b5c9ddcea85f39a.js → c250799c131aa4ed2c35.js} +1 -1
  97. package/assets/esri/core/workers/chunks/{a495e60996a36ce19a32.js → c4da2ca1dee0c44051d0.js} +1 -1
  98. package/assets/esri/core/workers/chunks/c6149e0ac1c103e03baf.js +1 -0
  99. package/assets/esri/core/workers/chunks/c69fefe9d51ac7c2b0a6.js +1 -0
  100. package/assets/esri/core/workers/chunks/c86b15f6a18880f921cd.js +1 -0
  101. package/assets/esri/core/workers/chunks/c91d39e8e14be3d8bdf5.js +1 -0
  102. package/assets/esri/core/workers/chunks/c9c5e6996f36ec4b1558.js +1 -0
  103. package/assets/esri/core/workers/chunks/cd391415b8b8320e12e4.js +1 -0
  104. package/assets/esri/core/workers/chunks/d3b3e8c6d7096bc59489.js +1 -0
  105. package/assets/esri/core/workers/chunks/{81b830f0d620587966ca.js → d53c6fc10425adc2c0cf.js} +1 -1
  106. package/assets/esri/core/workers/chunks/d9444dd0d40aa8332b28.js +1 -0
  107. package/assets/esri/core/workers/chunks/da0a61f73d45ea9e71fc.js +1 -0
  108. package/assets/esri/core/workers/chunks/da2a10e72a315c3c1f82.js +1 -0
  109. package/assets/esri/core/workers/chunks/{9ae90a4b281d4103e8bb.js → dc07dc1cd30edc0c4193.js} +1 -1
  110. package/assets/esri/core/workers/chunks/de79645e559a2d1ffa67.js +1 -0
  111. package/assets/esri/core/workers/chunks/e2e3c39876bbe019c57a.js +1 -0
  112. package/assets/esri/core/workers/chunks/e543bb228f3f9d937d43.js +1 -0
  113. package/assets/esri/core/workers/chunks/e7e565e7c0ce1464c6b0.js +1 -0
  114. package/assets/esri/core/workers/chunks/e8a23ae30d586e3a973c.js +1 -0
  115. package/assets/esri/core/workers/chunks/{3c9e1ec94bbcbf494916.js → ea068f75397c3b3337ec.js} +3 -3
  116. package/assets/esri/core/workers/chunks/ec21311584e4fb13e510.js +1 -0
  117. package/assets/esri/core/workers/chunks/{c09bc36347e8eb9fff00.js → f09446b9ff937a84d6d3.js} +1 -1
  118. package/assets/esri/core/workers/chunks/{354b309c8225336bc1e5.js → f6d047358d14328f3622.js} +1 -1
  119. package/assets/esri/core/workers/chunks/f8ee1a99580a7da42cde.js +1 -0
  120. package/assets/esri/core/workers/chunks/{c6a0e770c1a89d3b5913.js → fb9a889ec9fd23739a14.js} +1 -1
  121. package/assets/esri/core/workers/chunks/{b2a67fe89f6505498bc3.js → fe1b67ab7748a3aef231.js} +1 -1
  122. package/assets/esri/core/workers/chunks/fe92f54e45fd21ccd75f.js +1 -0
  123. package/assets/esri/core/workers/chunks/ff0cb1eec14d34214f12.js +1 -0
  124. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core-simd.wasm +0 -0
  125. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core.wasm +0 -0
  126. package/assets/esri/themes/base/_Ui.scss +3 -3
  127. package/assets/esri/themes/base/_mixins.scss +2 -2
  128. package/assets/esri/themes/base/widgets/_Attachments.scss +3 -3
  129. package/assets/esri/themes/base/widgets/_BasemapGallery.scss +8 -8
  130. package/assets/esri/themes/base/widgets/_BasemapToggle.scss +1 -1
  131. package/assets/esri/themes/base/widgets/_BuildingExplorer.scss +1 -1
  132. package/assets/esri/themes/base/widgets/_BuildingLevelPicker.scss +4 -4
  133. package/assets/esri/themes/base/widgets/_BuildingPhasePicker.scss +1 -1
  134. package/assets/esri/themes/base/widgets/_CoordinateConversion.scss +2 -2
  135. package/assets/esri/themes/base/widgets/_DatePicker.scss +4 -4
  136. package/assets/esri/themes/base/widgets/_Daylight.scss +1 -1
  137. package/assets/esri/themes/base/widgets/_Editor.scss +2 -2
  138. package/assets/esri/themes/base/widgets/_ElevationProfile.scss +2 -2
  139. package/assets/esri/themes/base/widgets/_FeatureMedia.scss +1 -1
  140. package/assets/esri/themes/base/widgets/_FeatureTable.scss +1 -1
  141. package/assets/esri/themes/base/widgets/_FloorFilter.scss +2 -2
  142. package/assets/esri/themes/base/widgets/_Grid.scss +1 -1
  143. package/assets/esri/themes/base/widgets/_GridControls.scss +1 -1
  144. package/assets/esri/themes/base/widgets/_ItemList.scss +1 -1
  145. package/assets/esri/themes/base/widgets/_Legend.scss +1 -1
  146. package/assets/esri/themes/base/widgets/_LineOfSight.scss +1 -1
  147. package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +1 -1
  148. package/assets/esri/themes/base/widgets/_OrientedImageryViewerNavigationUI.scss +3 -3
  149. package/assets/esri/themes/base/widgets/_Popup.scss +1 -1
  150. package/assets/esri/themes/base/widgets/_Print.scss +3 -3
  151. package/assets/esri/themes/base/widgets/_Sketch.scss +1 -1
  152. package/assets/esri/themes/base/widgets/_Slice.scss +1 -1
  153. package/assets/esri/themes/base/widgets/_Slider.scss +3 -3
  154. package/assets/esri/themes/base/widgets/_SnappingControls.scss +2 -2
  155. package/assets/esri/themes/base/widgets/_Spinner.scss +2 -2
  156. package/assets/esri/themes/base/widgets/_Swipe.scss +2 -2
  157. package/assets/esri/themes/base/widgets/_Tooltip.scss +2 -2
  158. package/assets/esri/themes/base/widgets/_UtilityNetworkTrace.scss +1 -1
  159. package/assets/esri/themes/base/widgets/_VideoPlayer.scss +2 -2
  160. package/assets/esri/themes/base/widgets/_Widget.scss +8 -8
  161. package/assets/esri/themes/dark/main.css +1 -1
  162. package/assets/esri/themes/light/main.css +1 -1
  163. package/assets/esri/themes/light/view.css +1 -1
  164. package/chunks/CutFillComposition.glsl.js +10 -4
  165. package/chunks/OITBlend.glsl.js +2 -2
  166. package/chunks/RibbonLine.glsl.js +75 -63
  167. package/chunks/ShadowHighlight.glsl.js +1 -1
  168. package/chunks/Viewshed.glsl.js +2 -2
  169. package/chunks/Water.glsl.js +24 -16
  170. package/chunks/arcgis-knowledge-client-core-simd.js +1 -1
  171. package/chunks/arcgis-knowledge-client-core.js +1 -1
  172. package/config.js +1 -1
  173. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  174. package/geometry/SpatialReference.js +1 -1
  175. package/geometry/operators/offsetOperator.d.ts +1 -1
  176. package/geometry/operators/proximityOperator.d.ts +1 -1
  177. package/geometry/operators/support/apiConverter.js +1 -1
  178. package/geometry/support/aaBoundingBox.js +1 -1
  179. package/geometry/support/curves/bezierCurveUtils.js +1 -1
  180. package/geometry/support/curves/circularArcUtils.js +1 -1
  181. package/geometry/support/curves/ellipticArc4Utils.js +1 -1
  182. package/geometry/support/curves/ellipticArc7Utils.js +1 -1
  183. package/geometry/support/geometryUtils.js +1 -1
  184. package/geometry/support/zscale.js +1 -1
  185. package/interfaces.d.ts +7 -0
  186. package/kernel.js +1 -1
  187. package/layers/LinkChartLayer.js +1 -1
  188. package/layers/OrientedImageryLayer.d.ts +0 -152
  189. package/layers/OrientedImageryLayer.js +1 -1
  190. package/layers/support/layerUtils.js +1 -1
  191. package/package.json +1 -1
  192. package/portal/schemas/definitions.js +1 -1
  193. package/rest/knowledgeGraph/wasmInterface/knowledgeWasmAccess.js +1 -1
  194. package/support/revision.js +1 -1
  195. package/support/tests/serviceMockDependencies.js +1 -1
  196. package/views/2d/engine/flow/FlowContainer.js +1 -1
  197. package/views/2d/engine/flow/FlowStrategy.js +1 -1
  198. package/views/2d/engine/flow/FlowView2D.js +1 -1
  199. package/views/2d/engine/flow/dataUtils.js +1 -1
  200. package/views/2d/engine/flow/particleConstants.js +2 -0
  201. package/views/2d/engine/flow/styles/Imagery.js +1 -1
  202. package/views/2d/engine/flow/styles/Particles.js +1 -1
  203. package/views/2d/engine/flow/styles/Stack.js +1 -1
  204. package/views/2d/engine/flow/styles/Streamlines.js +1 -1
  205. package/views/2d/engine/flow/utils.js +1 -1
  206. package/views/2d/engine/imagery/RasterVFContainer.js +1 -1
  207. package/views/2d/engine/webgl/Painter.js +1 -1
  208. package/views/2d/engine/webgl/Profiler.js +1 -1
  209. package/views/2d/engine/webgl/WGLContainer.js +1 -1
  210. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  211. package/views/2d/engine/webgl/shaderGraph/techniques/TechniqueRegistry.js +1 -1
  212. package/views/2d/engine/webgl/shaderGraph/techniques/TestTechnique.js +1 -1
  213. package/views/2d/engine/webgl/shaderGraph/techniques/TextureStatisticsTechnique.js +1 -1
  214. package/views/2d/engine/webgl/shaderGraph/techniques/fill/FillTechnique.js +1 -1
  215. package/views/2d/engine/webgl/shaderGraph/techniques/fill/GradientFillTechnique.js +1 -1
  216. package/views/2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillTechnique.js +1 -1
  217. package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternFillTechnique.js +1 -1
  218. package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillTechnique.js +1 -1
  219. package/views/2d/engine/webgl/shaderGraph/techniques/flow/FlowTechnique.js +2 -0
  220. package/views/2d/engine/webgl/shaderGraph/techniques/grid/GridTechnique.js +1 -1
  221. package/views/2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapTechnique.js +1 -1
  222. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  223. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelTechnique.js +1 -1
  224. package/views/2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeTechnique.js +1 -1
  225. package/views/2d/engine/webgl/shaderGraph/techniques/line/LineTechnique.js +1 -1
  226. package/views/2d/engine/webgl/shaderGraph/techniques/line/TexturedLineTechnique.js +1 -1
  227. package/views/2d/engine/webgl/shaderGraph/techniques/magnifier/MagnifierTechnique.js +1 -1
  228. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerTechnique.js +1 -1
  229. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriterRegistry.js +1 -1
  230. package/views/2d/engine/webgl/shaderGraph/techniques/opacity/OpacityTechnique.js +1 -1
  231. package/views/2d/engine/webgl/shaderGraph/techniques/overlay/OverlayTechnique.js +1 -1
  232. package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartTechnique.js +1 -1
  233. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/flow/FlowImageryShader.js +2 -0
  234. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/flow/FlowParticlesShader.js +2 -0
  235. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/flow/FlowStreamlinesShader.js +2 -0
  236. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/flow/FlowUtils.js +2 -0
  237. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextTechnique.js +1 -1
  238. package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileDebugInfoTechnique.js +1 -1
  239. package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileStencilTechnique.js +1 -1
  240. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueBackground.js +1 -1
  241. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueCircle.js +1 -1
  242. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueFill.js +1 -1
  243. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueLine.js +1 -1
  244. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueSymbol.js +1 -1
  245. package/views/2d/engine/webgl/shaderGraph/techniques/videoScreenRenderer/VideoScreenTechnique.js +1 -1
  246. package/views/2d/engine/webgl/shaderGraph/typed/TypedShaderProgram.js +1 -1
  247. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  248. package/views/2d/interactive/editingTools/draw/DrawGraphicTool2D.js +1 -1
  249. package/views/2d/layers/features/FeatureContainer.js +1 -1
  250. package/views/2d/layers/features/RenderState.js +1 -1
  251. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  252. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementShiftTool.js +1 -1
  253. package/views/3d/interactive/manipulators/ShiftManipulator.js +1 -1
  254. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  255. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  256. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  257. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  258. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  259. package/views/3d/layers/graphics/lineUtils.js +1 -1
  260. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  261. package/views/3d/layers/support/Tiles3DBVH.js +1 -1
  262. package/views/3d/layers/support/Tiles3DMeshIntersectionHandler.js +1 -1
  263. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  264. package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +1 -1
  265. package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
  266. package/views/3d/support/gaussianSplatting/GaussianTile.js +1 -1
  267. package/views/3d/support/orientedBoundingBox.js +1 -1
  268. package/views/3d/terrain/TerrainRenderer.js +1 -1
  269. package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticBVH.js +1 -1
  270. package/views/3d/webgl-engine/collections/Component/ComponentObjectFixedBVH.js +1 -1
  271. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  272. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
  273. package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
  274. package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceReflections.glsl.js +1 -1
  275. package/views/3d/webgl-engine/core/shaderLibrary/shading/WaterColor.glsl.js +1 -1
  276. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueRepository.js +1 -1
  277. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  278. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  279. package/views/3d/webgl-engine/lib/CutFillComputationRenderNode.js +1 -1
  280. package/views/3d/webgl-engine/lib/CutFillVisualizationRenderNode.js +1 -1
  281. package/views/3d/webgl-engine/lib/GLMaterial.js +1 -1
  282. package/views/3d/webgl-engine/lib/GLMaterialLoader.js +2 -0
  283. package/views/3d/webgl-engine/lib/GLMaterialParameters.js +1 -1
  284. package/views/3d/webgl-engine/lib/GLMaterialRepository.js +1 -1
  285. package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
  286. package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
  287. package/views/3d/webgl-engine/lib/RenderContext.js +1 -1
  288. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  289. package/views/3d/webgl-engine/lib/ReprojectionUniforms.js +2 -0
  290. package/views/3d/webgl-engine/lib/ScreenSpaceReflectionsUniforms.js +2 -0
  291. package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
  292. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  293. package/views/3d/webgl-engine/lib/lodRendering/LodComponentData.js +1 -1
  294. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  295. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  296. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  297. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  298. package/views/3d/webgl-engine/materials/PolygonOffset.js +1 -1
  299. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  300. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  301. package/views/3d/webgl-engine/materials/TriangleMaterial.js +1 -1
  302. package/views/3d/webgl-engine/materials/Water.glsl.js +1 -1
  303. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  304. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  305. package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +1 -1
  306. package/views/3d/webgl-engine/shaders/CheckerBoardTechnique.js +1 -1
  307. package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
  308. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  309. package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
  310. package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
  311. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  312. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  313. package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechnique.js +1 -1
  314. package/views/3d/webgl-engine/shaders/Viewshed.glsl.js +1 -1
  315. package/views/3d/webgl.js +1 -1
  316. package/views/draw/DrawTool.js +1 -1
  317. package/views/draw/plugins/ShapePlugin.js +1 -1
  318. package/views/draw/plugins/TangentArcSegmentPlugin.js +2 -0
  319. package/views/draw/support/managers/GlobalStateManager.js +1 -1
  320. package/views/draw/support/types.d.ts +9 -0
  321. package/views/interactive/SegmentLabels.js +1 -1
  322. package/views/webgl/AllocationTracer.js +1 -1
  323. package/views/webgl/RenderingContext.js +1 -1
  324. package/views/webgl/checkWebGLError.js +1 -1
  325. package/widgets/Editor/components/Settings.js +1 -1
  326. package/widgets/Features/FeaturesViewModel.js +1 -1
  327. package/widgets/Features.js +1 -1
  328. package/widgets/Search/SearchViewModel.js +1 -1
  329. package/widgets/Search/support/layerSearchUtils.js +1 -1
  330. package/widgets/Search/support/locatorUtils.js +1 -1
  331. package/widgets/Sketch/support/PluginManager.js +1 -1
  332. package/widgets/Sketch.js +1 -1
  333. package/widgets/support/SketchTooltipControls.js +1 -1
  334. package/assets/esri/core/workers/chunks/001492854799c35b53bb.js +0 -1
  335. package/assets/esri/core/workers/chunks/004f991251f09b36fb09.js +0 -1
  336. package/assets/esri/core/workers/chunks/01dd849a2d335e9f3e16.js +0 -1
  337. package/assets/esri/core/workers/chunks/027d733a99f50cadcf22.js +0 -1
  338. package/assets/esri/core/workers/chunks/03d85a706669aaf24d49.js +0 -1
  339. package/assets/esri/core/workers/chunks/0450133e81bce4b48b84.js +0 -1
  340. package/assets/esri/core/workers/chunks/085778ecd39f46324a6b.js +0 -1
  341. package/assets/esri/core/workers/chunks/08dce0019b52042b01fa.js +0 -1
  342. package/assets/esri/core/workers/chunks/0d8294982853308225da.js +0 -1
  343. package/assets/esri/core/workers/chunks/156aecac067213642aae.js +0 -1
  344. package/assets/esri/core/workers/chunks/184e9147f7a2f0ae5915.js +0 -1
  345. package/assets/esri/core/workers/chunks/19f59a2a97c33ff92650.js +0 -1
  346. package/assets/esri/core/workers/chunks/1cce2f8837ad765acf44.js +0 -1
  347. package/assets/esri/core/workers/chunks/20f9f3470cad47d01803.js +0 -1
  348. package/assets/esri/core/workers/chunks/23a9070e9362b8439770.js +0 -1
  349. package/assets/esri/core/workers/chunks/28ac3a75130fe2b57ac7.js +0 -1
  350. package/assets/esri/core/workers/chunks/2b7d020367cb4ebb3c3d.js +0 -1
  351. package/assets/esri/core/workers/chunks/3104b10770903c265626.js +0 -1
  352. package/assets/esri/core/workers/chunks/33f00633131581e06328.js +0 -1
  353. package/assets/esri/core/workers/chunks/365ad1ffd496ed86637b.js +0 -1
  354. package/assets/esri/core/workers/chunks/36a0e48113ab59a4f21d.js +0 -1
  355. package/assets/esri/core/workers/chunks/3874362bf7d43adc41bb.js +0 -1
  356. package/assets/esri/core/workers/chunks/38dc1c4b8721efd4a165.js +0 -1
  357. package/assets/esri/core/workers/chunks/3e9700445518b8f9ae1b.js +0 -1
  358. package/assets/esri/core/workers/chunks/42f3fdad1728433b3510.js +0 -1
  359. package/assets/esri/core/workers/chunks/436941ec88439667022e.js +0 -1
  360. package/assets/esri/core/workers/chunks/440a650ed0867a16f559.js +0 -1
  361. package/assets/esri/core/workers/chunks/440f76c397a813b0dcf9.js +0 -1
  362. package/assets/esri/core/workers/chunks/4812482f28f7205b0938.js +0 -1
  363. package/assets/esri/core/workers/chunks/5317cbef0aac29761575.js +0 -1
  364. package/assets/esri/core/workers/chunks/5344919fc6e8050450f1.js +0 -1
  365. package/assets/esri/core/workers/chunks/54a9e17d6c0fef6a9146.js +0 -1
  366. package/assets/esri/core/workers/chunks/55985c9c48b8e1d1c634.js +0 -1
  367. package/assets/esri/core/workers/chunks/5e5b358e603b13b4d7d7.js +0 -1
  368. package/assets/esri/core/workers/chunks/5e9bd5ed6ecee5b15127.js +0 -1
  369. package/assets/esri/core/workers/chunks/63b9e4a7dad358605c38.js +0 -1
  370. package/assets/esri/core/workers/chunks/64845b1f53eca9db1229.js +0 -1
  371. package/assets/esri/core/workers/chunks/662932d2effd2b384b9e.js +0 -1
  372. package/assets/esri/core/workers/chunks/66d4cbb35d0c290150bf.js +0 -1
  373. package/assets/esri/core/workers/chunks/677d3674cb2c0c05fb7e.js +0 -1
  374. package/assets/esri/core/workers/chunks/6f58ec80abebb7bfbbb0.js +0 -1
  375. package/assets/esri/core/workers/chunks/7100c9038739121c2c4b.js +0 -1
  376. package/assets/esri/core/workers/chunks/7278cc37e85f0242f19b.js +0 -1
  377. package/assets/esri/core/workers/chunks/794f604d4267e374f7dd.js +0 -1
  378. package/assets/esri/core/workers/chunks/7ae8f73c8e2afae98ecb.js +0 -1
  379. package/assets/esri/core/workers/chunks/7d4af7e2cb2f234e12eb.js +0 -1
  380. package/assets/esri/core/workers/chunks/7d56b2ac5030dd8b748e.js +0 -1
  381. package/assets/esri/core/workers/chunks/807b12ace0099300b9b9.js +0 -1
  382. package/assets/esri/core/workers/chunks/816a4b03f2ea49238a6c.js +0 -1
  383. package/assets/esri/core/workers/chunks/842b442cc012d0797333.js +0 -1
  384. package/assets/esri/core/workers/chunks/8903ff28896bd6f34b0d.js +0 -1
  385. package/assets/esri/core/workers/chunks/89e9bc8789b100316136.js +0 -1
  386. package/assets/esri/core/workers/chunks/8afe32d3db9669f972bc.js +0 -1
  387. package/assets/esri/core/workers/chunks/91fd28f50477d16e294e.js +0 -1
  388. package/assets/esri/core/workers/chunks/953f671bdeb2ca9b9f37.js +0 -1
  389. package/assets/esri/core/workers/chunks/96e799ca97989a6ed448.js +0 -1
  390. package/assets/esri/core/workers/chunks/98011b93acf3d5f0b5a2.js +0 -1
  391. package/assets/esri/core/workers/chunks/9c7fd5db0813bdc38582.js +0 -1
  392. package/assets/esri/core/workers/chunks/9db2ff1d4cbb5d1b623e.js +0 -1
  393. package/assets/esri/core/workers/chunks/a2fee1611319665e6aed.js +0 -1
  394. package/assets/esri/core/workers/chunks/a644e30f65347ce846ed.js +0 -1
  395. package/assets/esri/core/workers/chunks/a64daa4945923a178fe5.js +0 -1
  396. package/assets/esri/core/workers/chunks/a84d67c1a1008bca2075.js +0 -1
  397. package/assets/esri/core/workers/chunks/a85575a8d1da09280cd7.js +0 -1
  398. package/assets/esri/core/workers/chunks/ab414a60808ea05a63e6.js +0 -1
  399. package/assets/esri/core/workers/chunks/ac4f7309a249132c22da.js +0 -1
  400. package/assets/esri/core/workers/chunks/aeb1900cfdd0e51cc5f8.js +0 -1
  401. package/assets/esri/core/workers/chunks/ba62f3aa811430787863.js +0 -1
  402. package/assets/esri/core/workers/chunks/c03d0091a6f385b9ce8d.js +0 -1
  403. package/assets/esri/core/workers/chunks/c20aaca8085ce897bd12.js +0 -1
  404. package/assets/esri/core/workers/chunks/c3e711dc608eedda2d14.js +0 -1
  405. package/assets/esri/core/workers/chunks/c4a9006cc6d2938570e0.js +0 -1
  406. package/assets/esri/core/workers/chunks/c692ea68509bddbf7b42.js +0 -1
  407. package/assets/esri/core/workers/chunks/cb8c17daec7055bf99cc.js +0 -1
  408. package/assets/esri/core/workers/chunks/d7439d357f68160844cb.js +0 -1
  409. package/assets/esri/core/workers/chunks/dd319d5fe89b275e93cf.js +0 -1
  410. package/assets/esri/core/workers/chunks/df3e79b56c37156e7895.js +0 -1
  411. package/assets/esri/core/workers/chunks/df8b80b17e371c9be4e6.js +0 -1
  412. package/assets/esri/core/workers/chunks/e77198f8ab47441423c5.js +0 -1
  413. package/assets/esri/core/workers/chunks/e786da40a1c87bed64ca.js +0 -1
  414. package/assets/esri/core/workers/chunks/e8aafef6342c50340a27.js +0 -1
  415. package/assets/esri/core/workers/chunks/ec00348d74e29f48613a.js +0 -1
  416. package/assets/esri/core/workers/chunks/ec65c9c72507ef9a9cf9.js +0 -1
  417. package/assets/esri/core/workers/chunks/eedeff8b344ff699b0b9.js +0 -1
  418. package/assets/esri/core/workers/chunks/f1767b8ba82fdd9bd947.js +0 -1
  419. package/assets/esri/core/workers/chunks/f4201e7dcae224d0caf0.js +0 -1
  420. package/assets/esri/core/workers/chunks/f7cc05fbfc97b4d36eba.js +0 -1
  421. package/assets/esri/core/workers/chunks/f9d369a4683f88ee9d76.js +0 -1
  422. package/assets/esri/core/workers/chunks/fc534c94d55331578195.js +0 -1
  423. package/assets/esri/themes/base/colors/css/brand_colors.css +0 -76
  424. package/assets/esri/themes/base/colors/css/calcite_core_colors.css +0 -169
  425. package/assets/esri/themes/base/colors/css/calcite_core_colors_dark.css +0 -169
  426. package/assets/esri/themes/base/colors/css/calcite_gray_colors.css +0 -43
  427. package/assets/esri/themes/base/colors/css/calcite_gray_colors_dark.css +0 -43
  428. package/assets/esri/themes/base/colors/css/calcite_highlight_colors.css +0 -43
  429. package/assets/esri/themes/base/colors/css/calcite_highlight_colors_dark.css +0 -43
  430. package/assets/esri/themes/base/colors/css/calcite_vibrant_colors.css +0 -67
  431. package/assets/esri/themes/base/colors/css/calcite_vibrant_colors_dark.css +0 -67
  432. package/assets/esri/themes/base/colors/css/complete.css +0 -610
  433. package/assets/esri/themes/base/colors/css/scss/brand_colors.scss +0 -128
  434. package/assets/esri/themes/base/colors/css/scss/calcite_core_colors.scss +0 -289
  435. package/assets/esri/themes/base/colors/css/scss/calcite_core_colors_dark.scss +0 -285
  436. package/assets/esri/themes/base/colors/css/scss/calcite_gray_colors.scss +0 -96
  437. package/assets/esri/themes/base/colors/css/scss/calcite_gray_colors_dark.scss +0 -91
  438. package/assets/esri/themes/base/colors/css/scss/calcite_highlight_colors.scss +0 -69
  439. package/assets/esri/themes/base/colors/css/scss/calcite_highlight_colors_dark.scss +0 -65
  440. package/assets/esri/themes/base/colors/css/scss/calcite_vibrant_colors.scss +0 -128
  441. package/assets/esri/themes/base/colors/css/scss/calcite_vibrant_colors_dark.scss +0 -124
  442. package/assets/esri/themes/base/colors/css/scss/complete.scss +0 -11
  443. package/assets/esri/themes/base/colors/patterns_json/brand_colors.css +0 -366
  444. package/assets/esri/themes/base/colors/patterns_json/calcite_core_colors.css +0 -687
  445. package/assets/esri/themes/base/colors/patterns_json/calcite_core_colors_dark.css +0 -673
  446. package/assets/esri/themes/base/colors/patterns_json/calcite_gray_colors.css +0 -177
  447. package/assets/esri/themes/base/colors/patterns_json/calcite_gray_colors_dark.css +0 -169
  448. package/assets/esri/themes/base/colors/patterns_json/calcite_highlight_colors.css +0 -178
  449. package/assets/esri/themes/base/colors/patterns_json/calcite_highlight_colors_dark.css +0 -169
  450. package/assets/esri/themes/base/colors/patterns_json/calcite_vibrant_colors.css +0 -273
  451. package/assets/esri/themes/base/colors/patterns_json/calcite_vibrant_colors_dark.css +0 -265
  452. package/assets/esri/themes/base/colors/patterns_json/complete.css +0 -2847
  453. package/assets/esri/themes/base/colors/patterns_json/scss/brand_colors.scss +0 -464
  454. package/assets/esri/themes/base/colors/patterns_json/scss/calcite_core_colors.scss +0 -967
  455. package/assets/esri/themes/base/colors/patterns_json/scss/calcite_core_colors_dark.scss +0 -964
  456. package/assets/esri/themes/base/colors/patterns_json/scss/calcite_gray_colors.scss +0 -265
  457. package/assets/esri/themes/base/colors/patterns_json/scss/calcite_gray_colors_dark.scss +0 -263
  458. package/assets/esri/themes/base/colors/patterns_json/scss/calcite_highlight_colors.scss +0 -237
  459. package/assets/esri/themes/base/colors/patterns_json/scss/calcite_highlight_colors_dark.scss +0 -235
  460. package/assets/esri/themes/base/colors/patterns_json/scss/calcite_vibrant_colors.scss +0 -376
  461. package/assets/esri/themes/base/colors/patterns_json/scss/calcite_vibrant_colors_dark.scss +0 -347
  462. package/assets/esri/themes/base/colors/patterns_json/scss/complete.scss +0 -12
  463. package/assets/esri/themes/base/icons/readme/download.png +0 -0
  464. package/assets/esri/themes/base/icons/readme/import-icons.png +0 -0
  465. package/assets/esri/themes/base/icons/readme/import.png +0 -0
  466. package/assets/esri/themes/base/icons/readme/load.png +0 -0
  467. package/assets/esri/themes/base/icons/selection.json +0 -1
  468. package/assets/esri/themes/base/icons/style.css +0 -774
  469. package/views/2d/engine/brushes.js +0 -2
  470. package/views/2d/engine/flow/BrushFlow.js +0 -2
  471. package/views/2d/engine/rasterBrushes.js +0 -2
  472. package/views/2d/engine/webgl/brushes/BrushClip.js +0 -2
  473. package/views/2d/engine/webgl/brushes/WGLBrush.js +0 -2
  474. package/views/2d/engine/webgl/painter/RenderPass.js +0 -2
  475. package/views/2d/engine/webgl/shaders/BackgroundPrograms.js +0 -2
  476. package/views/2d/engine/webgl/shaders/TileInfoPrograms.js +0 -2
  477. package/views/3d/webgl-engine/lib/GLMaterials.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import has from"../../../../core/has.js";import{pt2px as e}from"../../../../core/screenUtils.js";import{e as t}from"../../../../chunks/earcut.js";import{ZEROS as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromBuffer as i,intersectsClippingArea as s,empty as o,expandWithAABB as n,create as a}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as l}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as c,floatSubArray as p}from"../../../../geometry/support/FloatArray.js";import{elevationModeChangeUpdateType as h,needsElevationUpdates2D as u}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as m}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as d}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as _}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as g}from"./graphicUtils.js";import{parseCapType as y}from"./lineUtils.js";import{geometryAsPolygon as f,createIndices3D as v,createColorGeometry as b,PolygonCreationDataBase as S}from"./polygonUtils.js";import{initFastSymbolUpdatesState as x,updateFastSymbolUpdatesState as C,getAttributeValue as P,ConvertOptions as D}from"../support/FastSymbolUpdates.js";import{createMaterial as O,uvElevationAligner as U}from"../support/patternUtils.js";import{createMapSpaceUVCoords as j,createMapSpaceUVCoordsDraped as w}from"../support/uvUtils.js";import{createGeometry as G}from"../../support/engineContent/line.js";import{polygonToRenderInfo as A,polygonToRenderInfoDraped as E}from"../../support/renderInfoUtils/polygon.js";import{Object3D as L}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as M}from"../../webgl-engine/lib/RenderGeometry.js";import{isScreenSizePerspectiveEnabled as V}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{getStipplePatternForLinePattern as R}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as I}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as z}from"../../webgl-engine/materials/RibbonLineMaterial.js";const B=["polyline","polygon","extent"];class F extends _{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,q(t)),this._needsUV=!1,this._materials=[]}async doLoad(){this._fastUpdates=x(this._context.renderer,this._vvConvertOptions)}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){if(has("enable-feature:emissive-on-none-volumetrics")){const e=this.symbolLayer.material?.emissive;return("color"===e?.source?e?.strength:void 0)??0}return 0}_createMaterials(){if(this._materials.length>0)return;const t=this._materialColor,r=this._getCombinedOpacityAndColor(t);this._materials[0]=O(this.symbolLayer,{color:r,forceTransparentMode:this.needsDrivenTransparentPass,discardInvisibleFragments:!0,hasVertexColors:this._drivenProperties.color||this._drivenProperties.opacity,draped:this.draped,hasSlicePlane:this._context.slicePlaneEnabled,emissiveStrength:this._emissiveStrength,...this._fastUpdates?.materialParameters}),this._needsUV=this._materials[0]instanceof I;const i=this.symbolLayer.outline;if(W(i)){const t=R(i.pattern);this._materials[1]=new z({width:e(i.size),color:this._getOutlineColor(),polygonOffset:3,hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:t,cap:y(i.patternCap||"butt"),screenSizePerspective:this._outlineScreenSizePerspective},this.view.state.isGlobal)}}get _outlineScreenSizePerspective(){return!this.draped&&V(this._context.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,B,this.symbolLayer.type))return null;const r=this._getDrivenUInt8Color(e.renderingInfo,this._materialColor,!1),i=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===i.mode),this._createMaterials(),this.draped?this._createAsOverlay(e.renderingInfo,t,r):this._createAs3DShape(e.renderingInfo,t,r,i)}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!C(this._fastUpdates,t,this._vvConvertOptions))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}layerOpacityChanged(){if(null!=this._materials[0]){const e=this._materials[0].parameters.color,t=this._materialColor,r=this._getCombinedOpacity(t);this._materials[0].setParameters({color:[e[0],e[1],e[2],r],forceTransparentMode:this.needsDrivenTransparentPass})}if(null!=this._materials[1]){const e=this._materials[1].parameters.color;this._materials[1].setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerScreenSizePerspectiveChanged(){this._materials[1]?.setParameters({screenSizePerspective:this._outlineScreenSizePerspective})}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,s=h(F.elevationModeChangeTypes,r,i);if(1!==s)return s;const o=u(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>o)}slicePlaneEnabledChanged(){if(this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]){const e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[1].setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,r,i){const s=f(t.geometry);if(!s)return null;const o=A(s,this._context.elevationProvider,this._context.renderCoordsHelper,i),n=new H(o,r,this._context.layerViewUid,t.uid),a=n.renderData.position.length/3;if(this._needsUV&&(n.uvMapSpace=c(4*a,!0),n.boundingRect=l(9),j(n.uvMapSpace,n.boundingRect,n.renderData.position,this._context.renderCoordsHelper)),n.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),this._createAs3DShapeFill(e,n),this._materials[1]&&this._createAs3DShapeOutline(n),this._logGeometryCreationWarnings(n.renderData,s.rings,"rings","FillSymbol3DLayer"),0===n.outGeometries.length)return null;const p=new L({geometries:n.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:t.uid}),h=new d(this,p,null,U,i);return h.alignedSampledElevation=n.renderData.sampledElevation,h.needsElevationUpdates=u(i.mode),h}_createAs3DShapeFill(e,t){const r=t.renderData.polygons;for(const{position:o,mapPositions:n,holeIndices:a,index:l,count:c}of r){if(null!=this._context.clippingExtent&&(i(n,T),!s(T,this._context.clippingExtent)))continue;const r=v(n,a,this._context.elevationProvider.spatialReference);if(0===r.length)continue;const h=this._fastUpdates?.visualVariables.color,u=b({material:this._materials[0],indices:r,mapPositions:n,attributeData:{position:o,color:h?null:t.color,colorFeature:h?P(h,e.color):null,uvMapSpace:this._needsUV?p(t.uvMapSpace,4*l,4*c):null,boundingRect:this._needsUV?t.boundingRect:null,olidColor:t.olidColor}});t.outGeometries.push(u)}}_createAs3DShapeOutline(e){if(null==this._materials[1])return;const t=e.renderData.outlines;for(const{mapPositions:r,position:o}of t){if(null!=this._context.clippingExtent&&(i(r,T),!s(T,this._context.clippingExtent)))continue;const t=G(this._materials[1],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:r,attributeData:{position:o}},e.olidColor);e.outGeometries.push(t)}}_createAsOverlay(e,t,r){const i=f(t.geometry);if(null==i)return null;this._materials[0].renderPriority=this._renderPriority+this._renderPriorityStep/2,null!=this._materials[1]&&(this._materials[1].renderPriority=this._renderPriority);const s=E(i,this._context.overlaySR),n=new k(s,r,this._context.layerViewUid,t.uid),a=n.renderData.position.length/3;return this._needsUV&&(n.uvMapSpace=c(4*a,!0),w(n.uvMapSpace,n.renderData.position,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),n.outBoundingBox=o(),n.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),this._createAsOverlayFill(e,n),this._materials[1]&&this._createAsOverlayOutline(n),this._logGeometryCreationWarnings(n.renderData,i.rings,"rings","FillSymbol3DLayer"),0===n.outGeometries.length?null:new m(this,n.outGeometries,n.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,r){const o=r.renderData.polygons;for(const{position:a,holeIndices:l,index:c,count:h}of o){const o=i(a,T);if(!s(o,this._context.clippingExtent))continue;const u=t(a,l,3);if(0===u.length)continue;n(r.outBoundingBox,o);const m=this._fastUpdates?.visualVariables.color,d=b({material:this._materials[0],indices:u,attributeData:{position:a,color:m?null:r.color,colorFeature:m?P(m,e.color):null,uvMapSpace:this._needsUV?p(r.uvMapSpace,4*c,4*h):null,olidColor:r.olidColor}});r.outGeometries.push(new M(d,r))}}_createAsOverlayOutline(e){if(null==this._materials[1])return;const t=e.renderData.outlines;for(let r=0;r<t.length;++r){const{position:o}=t[r];if(i(o,T),!s(T,this._context.clippingExtent))continue;n(e.outBoundingBox,T);const a=G(this._materials[1],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:o}},e.olidColor);e.outGeometries.push(new M(a,e))}}_getOutlineOpacity(){const e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(null!=e?e.a:0)}_getOutlineColor(){const e=this.symbolLayer?.outline?.color,t=this._getOutlineOpacity();return g(e?.toUnitRGB(),t)}test(){return{...super.test(),createAsOverlay:(e,t,r)=>this._createAsOverlay(e,t,r),createAs3DShape:(e,t,r,i)=>this._createAs3DShape(e,t,r,i)}}get _vvConvertOptions(){return new D({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:this._materialColor?.toUnitRGBA()??r})}}const T=a();class H extends S{constructor(e,t,r,i){super(e,r,i),this.color=t}}class k extends S{constructor(e,t,r,i){super(e,r,i),this.color=t}}function W(e){return null!=e?.size&&e.size>0&&null!=e.color&&(null==e.pattern||"style"!==e.pattern.type||"none"!==e.pattern.style)}function q(e){return 1===(e.material?.color?.a??0)}export{F as Graphics3DPolygonFillSymbolLayer};
2
+ import has from"../../../../core/has.js";import{pt2px as e}from"../../../../core/screenUtils.js";import{e as t}from"../../../../chunks/earcut.js";import{ZEROS as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromBuffer as i,intersectsClippingArea as s,empty as o,expandWithAABB as n,create as a}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as l}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as c,floatSubArray as p}from"../../../../geometry/support/FloatArray.js";import{elevationModeChangeUpdateType as h,needsElevationUpdates2D as u}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as d}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as m}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as _}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as g}from"./graphicUtils.js";import{parseCapType as y,computeSymbolLayerIndex as f}from"./lineUtils.js";import{geometryAsPolygon as v,createIndices3D as b,createColorGeometry as S,PolygonCreationDataBase as x}from"./polygonUtils.js";import{initFastSymbolUpdatesState as C,updateFastSymbolUpdatesState as P,getAttributeValue as D,ConvertOptions as O}from"../support/FastSymbolUpdates.js";import{createMaterial as U,uvElevationAligner as j}from"../support/patternUtils.js";import{createMapSpaceUVCoords as w,createMapSpaceUVCoordsDraped as G}from"../support/uvUtils.js";import{createGeometry as A}from"../../support/engineContent/line.js";import{polygonToRenderInfo as E,polygonToRenderInfoDraped as L}from"../../support/renderInfoUtils/polygon.js";import{Object3D as M}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as V}from"../../webgl-engine/lib/RenderGeometry.js";import{isScreenSizePerspectiveEnabled as R}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{getStipplePatternForLinePattern as I}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as z}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as B}from"../../webgl-engine/materials/RibbonLineMaterial.js";const F=["polyline","polygon","extent"];class T extends _{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,J(t)),this._needsUV=!1,this._materials=[]}async doLoad(){this._fastUpdates=C(this._context.renderer,this._vvConvertOptions)}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){if(has("enable-feature:emissive-on-none-volumetrics")){const e=this.symbolLayer.material?.emissive;return("color"===e?.source?e?.strength:void 0)??0}return 0}_createMaterials(){if(this._materials.length>0)return;const t=this._materialColor,r=this._getCombinedOpacityAndColor(t);this._materials[0]=U(this.symbolLayer,{color:r,forceTransparentMode:this.needsDrivenTransparentPass,discardInvisibleFragments:!0,hasVertexColors:this._drivenProperties.color||this._drivenProperties.opacity,draped:this.draped,hasSlicePlane:this._context.slicePlaneEnabled,emissiveStrength:this._emissiveStrength,...this._fastUpdates?.materialParameters}),this._needsUV=this._materials[0]instanceof z;const i=this.symbolLayer.outline;if(q(i)){const t=I(i.pattern);this._materials[1]=new B({width:e(i.size),color:this._getOutlineColor(),polygonOffset:3,polygonOffsetIndex:f(this._renderPriority,this._renderPriorityStep),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:t,cap:y(i.patternCap||"butt"),screenSizePerspective:this._outlineScreenSizePerspective},this.view.state.isGlobal)}}get _outlineScreenSizePerspective(){return!this.draped&&R(this._context.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,F,this.symbolLayer.type))return null;const r=this._getDrivenUInt8Color(e.renderingInfo,this._materialColor,!1),i=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===i.mode),this._createMaterials(),this.draped?this._createAsOverlay(e.renderingInfo,t,r):this._createAs3DShape(e.renderingInfo,t,r,i)}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!P(this._fastUpdates,t,this._vvConvertOptions))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}layerOpacityChanged(){if(null!=this._materials[0]){const e=this._materials[0].parameters.color,t=this._materialColor,r=this._getCombinedOpacity(t);this._materials[0].setParameters({color:[e[0],e[1],e[2],r],forceTransparentMode:this.needsDrivenTransparentPass})}if(null!=this._materials[1]){const e=this._materials[1].parameters.color;this._materials[1].setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerScreenSizePerspectiveChanged(){this._materials[1]?.setParameters({screenSizePerspective:this._outlineScreenSizePerspective})}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,s=h(T.elevationModeChangeTypes,r,i);if(1!==s)return s;const o=u(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>o)}slicePlaneEnabledChanged(){if(this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]){const e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[1].setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,r,i){const s=v(t.geometry);if(!s)return null;const o=E(s,this._context.elevationProvider,this._context.renderCoordsHelper,i),n=new k(o,r,this._context.layerViewUid,t.uid),a=n.renderData.position.length/3;if(this._needsUV&&(n.uvMapSpace=c(4*a,!0),n.boundingRect=l(9),w(n.uvMapSpace,n.boundingRect,n.renderData.position,this._context.renderCoordsHelper)),n.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),this._createAs3DShapeFill(e,n),this._materials[1]&&this._createAs3DShapeOutline(n),this._logGeometryCreationWarnings(n.renderData,s.rings,"rings","FillSymbol3DLayer"),0===n.outGeometries.length)return null;const p=new M({geometries:n.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:t.uid}),h=new m(this,p,null,j,i);return h.alignedSampledElevation=n.renderData.sampledElevation,h.needsElevationUpdates=u(i.mode),h}_createAs3DShapeFill(e,t){const r=t.renderData.polygons;for(const{position:o,mapPositions:n,holeIndices:a,index:l,count:c}of r){if(null!=this._context.clippingExtent&&(i(n,H),!s(H,this._context.clippingExtent)))continue;const r=b(n,a,this._context.elevationProvider.spatialReference);if(0===r.length)continue;const h=this._fastUpdates?.visualVariables.color,u=S({material:this._materials[0],indices:r,mapPositions:n,attributeData:{position:o,color:h?null:t.color,colorFeature:h?D(h,e.color):null,uvMapSpace:this._needsUV?p(t.uvMapSpace,4*l,4*c):null,boundingRect:this._needsUV?t.boundingRect:null,olidColor:t.olidColor}});t.outGeometries.push(u)}}_createAs3DShapeOutline(e){if(null==this._materials[1])return;const t=e.renderData.outlines;for(const{mapPositions:r,position:o}of t){if(null!=this._context.clippingExtent&&(i(r,H),!s(H,this._context.clippingExtent)))continue;const t=A(this._materials[1],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:r,attributeData:{position:o}},e.olidColor);e.outGeometries.push(t)}}_createAsOverlay(e,t,r){const i=v(t.geometry);if(null==i)return null;this._materials[0].renderPriority=this._renderPriority+this._renderPriorityStep/2,null!=this._materials[1]&&(this._materials[1].renderPriority=this._renderPriority);const s=L(i,this._context.overlaySR),n=new W(s,r,this._context.layerViewUid,t.uid),a=n.renderData.position.length/3;return this._needsUV&&(n.uvMapSpace=c(4*a,!0),G(n.uvMapSpace,n.renderData.position,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),n.outBoundingBox=o(),n.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),this._createAsOverlayFill(e,n),this._materials[1]&&this._createAsOverlayOutline(n),this._logGeometryCreationWarnings(n.renderData,i.rings,"rings","FillSymbol3DLayer"),0===n.outGeometries.length?null:new d(this,n.outGeometries,n.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,r){const o=r.renderData.polygons;for(const{position:a,holeIndices:l,index:c,count:h}of o){const o=i(a,H);if(!s(o,this._context.clippingExtent))continue;const u=t(a,l,3);if(0===u.length)continue;n(r.outBoundingBox,o);const d=this._fastUpdates?.visualVariables.color,m=S({material:this._materials[0],indices:u,attributeData:{position:a,color:d?null:r.color,colorFeature:d?D(d,e.color):null,uvMapSpace:this._needsUV?p(r.uvMapSpace,4*c,4*h):null,olidColor:r.olidColor}});r.outGeometries.push(new V(m,r))}}_createAsOverlayOutline(e){if(null==this._materials[1])return;const t=e.renderData.outlines;for(let r=0;r<t.length;++r){const{position:o}=t[r];if(i(o,H),!s(H,this._context.clippingExtent))continue;n(e.outBoundingBox,H);const a=A(this._materials[1],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:o}},e.olidColor);e.outGeometries.push(new V(a,e))}}_getOutlineOpacity(){const e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(null!=e?e.a:0)}_getOutlineColor(){const e=this.symbolLayer?.outline?.color,t=this._getOutlineOpacity();return g(e?.toUnitRGB(),t)}test(){return{...super.test(),createAsOverlay:(e,t,r)=>this._createAsOverlay(e,t,r),createAs3DShape:(e,t,r,i)=>this._createAs3DShape(e,t,r,i)}}get _vvConvertOptions(){return new O({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:this._materialColor?.toUnitRGBA()??r})}}const H=a();class k extends x{constructor(e,t,r,i){super(e,r,i),this.color=t}}class W extends x{constructor(e,t,r,i){super(e,r,i),this.color=t}}function q(e){return null!=e?.size&&e.size>0&&null!=e.color&&(null==e.pattern||"style"!==e.pattern.type||"none"!==e.pattern.style)}function J(e){return 1===(e.material?.color?.a??0)}export{T as Graphics3DPolygonFillSymbolLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- function r(r){switch(r){case"butt":return 0;case"square":return 1;case"round":return 2;default:return null}}function t(r){return"diamond"===r?"kite":r}export{r as parseCapType,t as parseLineMarkerStyle};
2
+ import{clamp as n}from"../../../../core/mathUtils.js";import{POLYGON_OFFSET_INDEX_COUNT as r}from"../../webgl-engine/shaders/RibbonLineTechniqueConfiguration.js";function e(n){switch(n){case"butt":return 0;case"square":return 1;case"round":return 2;default:return null}}function t(n){return"diamond"===n?"kite":n}function u(e,t){return n(Math.round((1-e)/t-1),0,r-1)}export{u as computeSymbolLayerIndex,e as parseCapType,t as parseLineMarkerStyle};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../core/maybe.js";import s from"../../../../core/PooledArray.js";import{property as i,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{subtract as n,length as o,scale as a,negate as h,dot as l,squaredLength as c}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as u}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{create as m,offset as p,contains as g,containsPoint as _,set as f,positiveInfinity as P,equals as x}from"../../../../geometry/support/aaBoundingBox.js";import{create as b}from"../../../../geometry/support/plane.js";import{fromPoints as S}from"../../../../geometry/support/ray.js";import{Sphere as w}from"../../../../geometry/support/sphere.js";import{PclTarget as z}from"./Intersector.js";import{PointCloudHighlights as y}from"./PointCloudHighlights.js";import{isColor as R,isHighlight as v,isDepth as j}from"../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as q}from"../../webgl-engine/effects/RenderPlugin.js";import{IntersectorResult as E}from"../../webgl-engine/lib/IntersectorResult.js";import{VertexArrayObject as F}from"../../webgl-engine/lib/VertexArrayObject.js";import{P as A,g as B}from"../../../../chunks/PointRenderer.glsl.js";import{PointRendererTechnique as H,positionsLayout as M,colorsLayout as O}from"../../webgl-engine/shaders/PointRendererTechnique.js";import{PointRendererTechniqueConfiguration as I}from"../../webgl-engine/shaders/PointRendererTechniqueConfiguration.js";import{PrimitiveType as N}from"../../../webgl/enums.js";import{VertexBuffer as V}from"../../../webgl/VertexBuffer.js";let T=class extends q{constructor(e){super(e),this.type=6,this.isGround=!1,this._passParameters=new A,this._highlights=new y({forEachNode:e=>this.forEachNode(e),addHighlight:(e,t,s)=>this._addHighlight(e,t,s),removeHighlight:(e,t)=>this._removeHighlight(e,t)}),this.produces=new Map([[2,e=>R(e)||v(e)&&!this._highlights.empty],[3,e=>j(e)]]),this.point=d(),this.intersectionRayDir=d(),this.intersectionPlane=b(),this.nodeOriginOffset=d(),this.nodeBoundingBox=m(),this.layerViewUid="",this._slicePlaneEnabled=!1,this._configuration=new I,this._nodes=new s}destroy(){this._nodes.prune()}hasHighlight(e){return this._highlights.has(e)}initializeRenderContext(e){this._context=e,e.requestRender()}uninitializeRenderContext(){}intersect(e,t,s,i){const{point:r,intersectionRayDir:f,nodeOriginOffset:P,intersectionPlane:x,layerViewUid:b,nodeBoundingBox:y}=this,R=S(s,i),v=e.camera.perScreenPixelRatio/2,j=e.camera.near;n(f,i,s);const q=1/o(f);a(f,f,q);const F=d();h(F,f),u(x,f[0],f[1],f[2],-l(f,s));const A=new W,B=new W,H=new Array,M=m(this._passParameters.clipBox);p(M,-s[0],-s[1],-s[2],M),this._nodes.forAll(o=>{const{isLeaf:a,coordinates:h}=o,d=o.splatSize*this._passParameters.scaleFactor;let u=o.obb.minimumDistancePlane(x),m=o.obb.maximumDistancePlane(x);u-=D(d,u+j,this._passParameters,v,a),m-=D(d,m+j,this._passParameters,v,a);const S=m<0,z=null!=A.dist&&null!=B.dist&&A.dist<u*q&&B.dist>m*q;if(S||z)return;const E=C(d,m+j,this._passParameters,v,a);if(!new w(o.obb.center,o.obb.radius+E).intersectRay(R))return;if(!o.obb.intersectRay(s,f,E))return;const O=E*E;o.obb.toAaBoundingBox(y),p(y,-s[0],-s[1],-s[2],y);const I=!g(M,y);n(P,o.origin,s);const N=h.length/3;for(let n=0;n<N;n++){const u=3*n;if(r[0]=P[0]+h[u],r[1]=P[1]+h[u+1],r[2]=P[2]+h[u+2],I&&!_(M,r))continue;const m=l(r,f),p=m*m,g=c(r)-p;if(g>O)continue;let x=m+j;const S=D(d,x,this._passParameters,v,a);if(m-S<0)continue;x-=S;const w=C(d,x,this._passParameters,v,a);if(g>w*w)continue;const z=(m-S)*q,y=e=>(e.point=e.point?U(o,n,e.point):U(o,n),e.dist=z,e.normal=F,e.node=o,e.pointId=n,e.layerViewUid=b,e);if((null==A.dist||z<A.dist)&&(null==t||t(s,i,z))&&y(A),0!==e.options.store&&(null==B.dist||z>B.dist)&&(null==t||t(s,i,z))&&y(B),2===e.options.store&&(null==t||t(s,i,z))){const e=new W;H.push(y(e))}}});const O=e=>{const{layerViewUid:t,node:s,pointId:i}=e;return new z(e.point,t,i,()=>this.createGraphic(s,i,e.point))},I=(e,t)=>{const s=O(t);e.set(this.type,s,t.dist,t.normal)};if(L(A)){const t=e.results.min;(null==t.distance||A.dist<t.distance)&&I(t,A)}if(L(B)&&0!==e.options.store){const t=e.results.max;(null==t.distance||B.dist>t.distance)&&I(t,B)}if(2===e.options.store)for(const n of H){const t=new E(R);I(t,n),e.results.all.push(t)}}acquireTechniques(e){const t=10===e.output;return 0!==this._nodes.length&&(R(e.output)||j(e.output)&&3===e.bind.slot||t)?(this._nodes.forAll(t=>this._initNode(e,t)),this._configuration.drawScreenSize=this._passParameters.drawScreenSpace,this._configuration.useFixedSizes=this._passParameters.useFixedSizes,this._configuration.hasSlicePlane=this._slicePlaneEnabled,this._configuration.hasOccludees=e.bind.hasOccludees,this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.hasHighlightMixTexture=t&&null!=e.bind.highlightMixTexture,this._configuration.output=e.output,this._configuration.hasEmission=e.bind.hasEmission&&R(e.output),this._context.techniques.get(H,this._configuration)):null}render(e,t){const{rctx:s,bind:i,output:r}=e,n=s.bindTechnique(t,i,this._passParameters),o=10===r,a=i.highlight?.name??null;o&&!a||this._nodes.forAll(t=>{0===t.coordinates.length||null==t.vao||o&&!t.highlightMap.has(a)||(n.assertCompatibleVertexAttributeLocations(t.vao),n.bindDraw(i,this._passParameters,t),s.bindVAO(t.vao),o?this._renderHighlightFragments(e,t):s.drawArrays(N.POINTS,0,t.coordinates.length/3))})}_renderHighlightFragments(e,t){const{highlightMap:s}=t,{rctx:i,bind:r}=e,{highlight:n}=r;if(!n)return;const o=n.name,a=s.get(o);if(!a||0===a.length)return;const{highlightOrderMap:h,highlightLevel:l}=r;if(null==l)return;for(const g of s.keys())if(g!==o){const e=h.get(g);if(void 0!==e&&e>l)return}let c=0,d=a[0].componentIndex,u=d+1;const m=()=>{for(;c<a.length&&a[c].id.highlightName!==o;)d=a[c].componentIndex,++c;u=d+1};m();const p=(e,t)=>{const s=t-e;s>0&&i.drawArrays(N.POINTS,e,s)};for(;c<a.length;){const e=a[c];if(e.id.highlightName!==o){p(d,u),++c,m();continue}const t=e.componentIndex;t!==u&&(p(d,u),d=t),u=t+1,++c}p(d,u)}set useFixedSizes(e){this._passParameters.useFixedSizes!==e&&(this._passParameters.useFixedSizes=e,this._requestRender())}get useFixedSizes(){return this._passParameters.useFixedSizes}set scaleFactor(e){this._passParameters.scaleFactor!==e&&(this._passParameters.scaleFactor=e,this._requestRender())}get scaleFactor(){return this._passParameters.scaleFactor}set minSizePx(e){this._passParameters.minSizePx!==e&&(this._passParameters.minSizePx=e,this._requestRender())}get minSizePx(){return this._passParameters.minSizePx}set useRealWorldSymbolSizes(e){this._passParameters.useRealWorldSymbolSizes!==e&&(this._passParameters.useRealWorldSymbolSizes=e,this._requestRender())}get useRealWorldSymbolSizes(){return this._passParameters.useRealWorldSymbolSizes}set size(e){this._passParameters.size!==e&&(this._passParameters.size=e,this._requestRender())}get size(){return this._passParameters.size}set sizePx(e){this._passParameters.sizePx!==e&&(this._passParameters.sizePx=e,this._requestRender())}get sizePx(){return this._passParameters.sizePx}set clippingBox(e){f(this._passParameters.clipBox,e||P)}get _clippingEnabled(){return!x(this._passParameters.clipBox,P,(e,t)=>e===t)}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this._requestRender())}addNode(e){this._nodes.push(e),this._highlights.nodeAdded(e),this._requestRender()}removeNode(e){let s=null;return this._nodes.filterInPlace(i=>i.id!==e||(s=i,i.vao=t(i.vao),this._highlights.nodeRemoved(i),!1)),this._requestRender(),s}forEachNode(e){this._nodes.forEach(e)}removeAll(){this._nodes.forAll(e=>e.vao=t(e.vao)),this._highlights.removeAll(),this._nodes.clear(),this._requestRender()}highlight(e,t){return this._highlights.add(e,t)}_addHighlight(e,t,s){e.addHighlight(t,s),this._requestRender()}_removeHighlight(e,t){e.removeHighlight(t),this._requestRender()}_initNode(e,t){t.vao??=new F(e.rctx,new Map([["positions",new V(e.rctx,M,t.coordinates)],["colors",new V(e.rctx,O,t.rgb)]]))}_requestRender(){this._context&&this._context.requestRender()}};function C(e,t,s,i,r){if(s.drawScreenSpace)return s.fixedSize*t*i;const n=B(r)*t*i;return s.useFixedSizes?Math.min(s.fixedSize/2,n):s.screenMinSize>0?Math.min(Math.max(s.screenMinSize*t*i,e/2),n):Math.min(e/2,n)}function D(e,t,s,i,r){return s.drawScreenSpace?0:C(e,t,s,i,r)}function U(e,t,s=d()){return s[0]=e.origin[0]+e.coordinates[3*t],s[1]=e.origin[1]+e.coordinates[3*t+1],s[2]=e.origin[2]+e.coordinates[3*t+2],s}e([i({constructOnly:!0})],T.prototype,"createGraphic",void 0),T=e([r("esri.views.3d.layers.i3s.PointCloudRenderer")],T);class W{constructor(){this.node=null,this.pointId=null,this.point=null,this.dist=null,this.normal=null,this.layerViewUid=""}}function L(e){return null!=e.dist&&null!=e.point&&null!=e.pointId&&null!=e.node}export{T as PointCloudRenderer};
2
+ import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../core/maybe.js";import s from"../../../../core/PooledArray.js";import{property as i,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{subtract as n,length as o,scale as a,negate as h,dot as l,squaredLength as c}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as u}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{create as g,offset as m,contains as p,containsPoint as _,set as f,positiveInfinity as P,equals as x}from"../../../../geometry/support/aaBoundingBox.js";import{create as b}from"../../../../geometry/support/plane.js";import{fromPoints as S}from"../../../../geometry/support/ray.js";import{Sphere as w}from"../../../../geometry/support/sphere.js";import{PclTarget as z}from"./Intersector.js";import{PointCloudHighlights as R}from"./PointCloudHighlights.js";import{isColor as y,isHighlight as v,isDepth as j}from"../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as q}from"../../webgl-engine/effects/RenderPlugin.js";import{IntersectorResult as E}from"../../webgl-engine/lib/IntersectorResult.js";import{VertexArrayObject as F}from"../../webgl-engine/lib/VertexArrayObject.js";import{P as A,g as B}from"../../../../chunks/PointRenderer.glsl.js";import{PointRendererTechnique as H,positionsLayout as M,colorsLayout as O}from"../../webgl-engine/shaders/PointRendererTechnique.js";import{PointRendererTechniqueConfiguration as I}from"../../webgl-engine/shaders/PointRendererTechniqueConfiguration.js";import{PrimitiveType as N}from"../../../webgl/enums.js";import{VertexBuffer as V}from"../../../webgl/VertexBuffer.js";let T=class extends q{constructor(e){super(e),this.type=6,this.isGround=!1,this._passParameters=new A,this._highlights=new R({forEachNode:e=>this.forEachNode(e),addHighlight:(e,t,s)=>this._addHighlight(e,t,s),removeHighlight:(e,t)=>this._removeHighlight(e,t)}),this.produces=new Map([[2,e=>y(e)||v(e)&&!this._highlights.empty],[3,e=>j(e)]]),this.point=d(),this.intersectionRayDir=d(),this.intersectionPlane=b(),this.nodeOriginOffset=d(),this.nodeBoundingBox=g(),this.layerViewUid="",this._slicePlaneEnabled=!1,this._configuration=new I,this._nodes=new s}destroy(){this._nodes.prune()}hasHighlight(e){return this._highlights.has(e)}initializeRenderContext(e){this._context=e,e.requestRender()}uninitializeRenderContext(){}intersect(e,t,s,i){const{point:r,intersectionRayDir:f,nodeOriginOffset:P,intersectionPlane:x,layerViewUid:b,nodeBoundingBox:R}=this,y=S(s,i),v=e.camera.perScreenPixelRatio/2,j=e.camera.near;n(f,i,s);const q=1/o(f);a(f,f,q);const F=d();h(F,f),u(x,f[0],f[1],f[2],-l(f,s));const A=new D,B=new D,H=new Array,M=g(this._passParameters.clipBox);m(M,-s[0],-s[1],-s[2],M),this._nodes.forAll(o=>{const{isLeaf:a,coordinates:h}=o,d=o.splatSize*this._passParameters.scaleFactor;let{min:u,max:g}=o.obb.signedDistanceRangePlane(x);u-=U(d,u+j,this._passParameters,v,a),g-=U(d,g+j,this._passParameters,v,a);const S=g<0,z=null!=A.dist&&null!=B.dist&&A.dist<u*q&&B.dist>g*q;if(S||z)return;const E=C(d,g+j,this._passParameters,v,a);if(!new w(o.obb.center,o.obb.radius+E).intersectRay(y))return;if(!o.obb.intersectRay(s,f,E))return;const O=E*E;o.obb.toAaBoundingBox(R),m(R,-s[0],-s[1],-s[2],R);const I=!p(M,R);n(P,o.origin,s);const N=h.length/3;for(let n=0;n<N;n++){const u=3*n;if(r[0]=P[0]+h[u],r[1]=P[1]+h[u+1],r[2]=P[2]+h[u+2],I&&!_(M,r))continue;const g=l(r,f),m=g*g,p=c(r)-m;if(p>O)continue;let x=g+j;const S=U(d,x,this._passParameters,v,a);if(g-S<0)continue;x-=S;const w=C(d,x,this._passParameters,v,a);if(p>w*w)continue;const z=(g-S)*q,R=e=>(e.point=e.point?W(o,n,e.point):W(o,n),e.dist=z,e.normal=F,e.node=o,e.pointId=n,e.layerViewUid=b,e);if((null==A.dist||z<A.dist)&&(null==t||t(s,i,z))&&R(A),0!==e.options.store&&(null==B.dist||z>B.dist)&&(null==t||t(s,i,z))&&R(B),2===e.options.store&&(null==t||t(s,i,z))){const e=new D;H.push(R(e))}}});const O=e=>{const{layerViewUid:t,node:s,pointId:i}=e;return new z(e.point,t,i,()=>this.createGraphic(s,i,e.point))},I=(e,t)=>{const s=O(t);e.set(this.type,s,t.dist,t.normal)};if(L(A)){const t=e.results.min;(null==t.distance||A.dist<t.distance)&&I(t,A)}if(L(B)&&0!==e.options.store){const t=e.results.max;(null==t.distance||B.dist>t.distance)&&I(t,B)}if(2===e.options.store)for(const n of H){const t=new E(y);I(t,n),e.results.all.push(t)}}acquireTechniques(e){const t=10===e.output;return 0!==this._nodes.length&&(y(e.output)||j(e.output)&&3===e.bind.slot||t)?(this._nodes.forAll(t=>this._initNode(e,t)),this._configuration.drawScreenSize=this._passParameters.drawScreenSpace,this._configuration.useFixedSizes=this._passParameters.useFixedSizes,this._configuration.hasSlicePlane=this._slicePlaneEnabled,this._configuration.hasOccludees=e.bind.hasOccludees,this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.hasHighlightMixTexture=t&&null!=e.bind.highlightMixTexture,this._configuration.output=e.output,this._configuration.hasEmission=e.bind.hasEmission&&y(e.output),this._context.techniques.get(H,this._configuration)):null}render(e,t){const{rctx:s,bind:i,output:r}=e,n=s.bindTechnique(t,i,this._passParameters),o=10===r,a=i.highlight?.name??null;o&&!a||this._nodes.forAll(t=>{0===t.coordinates.length||null==t.vao||o&&!t.highlightMap.has(a)||(n.assertCompatibleVertexAttributeLocations(t.vao),n.bindDraw(i,this._passParameters,t),s.bindVAO(t.vao),o?this._renderHighlightFragments(e,t):s.drawArrays(N.POINTS,0,t.coordinates.length/3))})}_renderHighlightFragments(e,t){const{highlightMap:s}=t,{rctx:i,bind:r}=e,{highlight:n}=r;if(!n)return;const o=n.name,a=s.get(o);if(!a||0===a.length)return;const{highlightOrderMap:h,highlightLevel:l}=r;if(null==l)return;for(const p of s.keys())if(p!==o){const e=h.get(p);if(void 0!==e&&e>l)return}let c=0,d=a[0].componentIndex,u=d+1;const g=()=>{for(;c<a.length&&a[c].id.highlightName!==o;)d=a[c].componentIndex,++c;u=d+1};g();const m=(e,t)=>{const s=t-e;s>0&&i.drawArrays(N.POINTS,e,s)};for(;c<a.length;){const e=a[c];if(e.id.highlightName!==o){m(d,u),++c,g();continue}const t=e.componentIndex;t!==u&&(m(d,u),d=t),u=t+1,++c}m(d,u)}set useFixedSizes(e){this._passParameters.useFixedSizes!==e&&(this._passParameters.useFixedSizes=e,this._requestRender())}get useFixedSizes(){return this._passParameters.useFixedSizes}set scaleFactor(e){this._passParameters.scaleFactor!==e&&(this._passParameters.scaleFactor=e,this._requestRender())}get scaleFactor(){return this._passParameters.scaleFactor}set minSizePx(e){this._passParameters.minSizePx!==e&&(this._passParameters.minSizePx=e,this._requestRender())}get minSizePx(){return this._passParameters.minSizePx}set useRealWorldSymbolSizes(e){this._passParameters.useRealWorldSymbolSizes!==e&&(this._passParameters.useRealWorldSymbolSizes=e,this._requestRender())}get useRealWorldSymbolSizes(){return this._passParameters.useRealWorldSymbolSizes}set size(e){this._passParameters.size!==e&&(this._passParameters.size=e,this._requestRender())}get size(){return this._passParameters.size}set sizePx(e){this._passParameters.sizePx!==e&&(this._passParameters.sizePx=e,this._requestRender())}get sizePx(){return this._passParameters.sizePx}set clippingBox(e){f(this._passParameters.clipBox,e||P)}get _clippingEnabled(){return!x(this._passParameters.clipBox,P,(e,t)=>e===t)}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this._requestRender())}addNode(e){this._nodes.push(e),this._highlights.nodeAdded(e),this._requestRender()}removeNode(e){let s=null;return this._nodes.filterInPlace(i=>i.id!==e||(s=i,i.vao=t(i.vao),this._highlights.nodeRemoved(i),!1)),this._requestRender(),s}forEachNode(e){this._nodes.forEach(e)}removeAll(){this._nodes.forAll(e=>e.vao=t(e.vao)),this._highlights.removeAll(),this._nodes.clear(),this._requestRender()}highlight(e,t){return this._highlights.add(e,t)}_addHighlight(e,t,s){e.addHighlight(t,s),this._requestRender()}_removeHighlight(e,t){e.removeHighlight(t),this._requestRender()}_initNode(e,t){t.vao??=new F(e.rctx,new Map([["positions",new V(e.rctx,M,t.coordinates)],["colors",new V(e.rctx,O,t.rgb)]]))}_requestRender(){this._context&&this._context.requestRender()}};function C(e,t,s,i,r){if(s.drawScreenSpace)return s.fixedSize*t*i;const n=B(r)*t*i;return s.useFixedSizes?Math.min(s.fixedSize/2,n):s.screenMinSize>0?Math.min(Math.max(s.screenMinSize*t*i,e/2),n):Math.min(e/2,n)}function U(e,t,s,i,r){return s.drawScreenSpace?0:C(e,t,s,i,r)}function W(e,t,s=d()){return s[0]=e.origin[0]+e.coordinates[3*t],s[1]=e.origin[1]+e.coordinates[3*t+1],s[2]=e.origin[2]+e.coordinates[3*t+2],s}e([i({constructOnly:!0})],T.prototype,"createGraphic",void 0),T=e([r("esri.views.3d.layers.i3s.PointCloudRenderer")],T);class D{constructor(){this.node=null,this.pointId=null,this.point=null,this.dist=null,this.normal=null,this.layerViewUid=""}}function L(e){return null!=e.dist&&null!=e.point&&null!=e.pointId&&null!=e.node}export{T as PointCloudRenderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import e from"../../../../core/Logger.js";import{getOrCreateMapValue as t}from"../../../../core/MapUtils.js";import{sub as n,normalize as o,dot as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as r,create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as a,isEmpty as l,setEmpty as u,intersectsSphere as h,intersectsRay as c,copy as d,exactEquals as g}from"../../../../geometry/support/aaBoundingBox.js";import{fromValues as m}from"../../../../geometry/support/aaBoundingRect.js";import{earth as f}from"../../../../geometry/support/Ellipsoid.js";import{ElevationRange as p}from"../../support/ElevationRange.js";class w{static create(e,t){return"local"===e?new _(t):new b(t)}constructor(e,t){this.viewingMode=e,this.layerExtent=t,this._rootNode=null,this._intersectionGeneration=0,this._tileMap=new Map}destroy(){this._rootNode?.clear(),this._tileMap.clear()}_nextIntersectionGeneration(){return this._intersectionGeneration++,this._intersectionGeneration}addTile(e){const{mbsCenter:n,mbsRadius:o}=e,i=[this._ensureRootNode()],r=new Array,s=t(this._tileMap,e,()=>new Set),a=t=>{if(s.has(t))return;const n=t.addOwnTile(e);R(r,t.parent,n),s.add(t)};for(;i.length>0;){const t=i.pop();if(t.treeDepth>=H||e.mbsRadius>=.5*t.sideLength){a(t);continue}const{hPlane:r,vPlane:s}=t,l=V(n,o,r),u=V(n,o,s);0!==l||0!==u?M(t,l,u,(e,t)=>{i.push(this._ensureChild(e,t))}):a(t)}this._propagateSummaryUpdates(r)}removeTile(t){if(!this._rootNode)return void e.getLogger("Tiles3DBVH").error("Tiles3DBVH: Attempted to remove a tile that is not loaded (no root node)");const n=this._tileMap.get(t);if(!n||0===n.size)return void e.getLogger("Tiles3DBVH").error("Tiles3DBVH internal error: Attempted to remove a tile that is not loaded (not in tile map)");const o=new Array;this._tileMap.delete(t);for(const e of n){e.removeOwnTile(t);const n=e.updateOwnSummaries();R(o,e.parent,n)}this._propagateSummaryUpdates(o)}_propagateSummaryUpdates(e){if(0===e.length)return;e.sort((e,t)=>e.node.treeDepth-t.node.treeDepth);let t=new Map,n=-1;const o=()=>e.length>0?e[e.length-1].node.treeDepth:-1;for(;e.length>0||t.size>0;){const i=t.size>0?n:o(),r=t;for(t=new Map;e.length>0&&o()===i;){const{node:t,childrenUpdateKind:n}=e.pop();I(r,t,n)}for(const[e,n]of r){let o=0;for(let t=0;t<4;t++){const n=e.children[t];n&&n.isLeaf&&0===n.ownTiles.size&&(n.clear(),e.children[t]=null,o=3)}o|=e.updateSubtreeSummaries(n|o),I(t,e.parent,o)}t.size>0&&(n=i-1)}}forEachTileIntersectingRay(e,t,n,o){o?this._forEachTileIntersectingVerticalRay(e,t,n):this._forEachTileIntersectingRayGeneral(e,t,n)}_forEachTileIntersectingRayGeneral(e,t,i){const r=this._rootNode;if(!r)return;const s=this._nextIntersectionGeneration();n(j,t,e);const a=o(j,j),l=[{node:r,tRange:{tMin:0,tMax:Number.POSITIVE_INFINITY}}];for(;l.length>0;){const t=l.pop(),{node:n,tRange:o}=t,r=n.subtreeIntersectsRay(e,a,o);if(!r)continue;if(n.ownIntersectsRay(e,a,r))for(const l of n.ownTiles)l.bvhIntersectionGeneration!==s&&(l.bvhIntersectionGeneration=s,l.boundingVolumeIntersectsRay(e,a)&&i(l));const{hPlane:u,vPlane:h}=n;for(let i=0;i<4;i++){const t=n.children[i];if(null==t)continue;const r=0===i||1===i,s=y(e,a,y(e,a,o,h,!(0===i||2===i)),u,!r);s&&l.push({node:t,tRange:s})}}}_forEachTileIntersectingVerticalRay(e,t,i){if("global"!==this.viewingMode)return void this._forEachTileIntersectingRayGeneral(e,t,i);const r=this._rootNode;if(!r)return;const s=this._nextIntersectionGeneration();n(j,t,e);const a=o(j,j),l={tMin:0,tMax:Number.POSITIVE_INFINITY},u=(e,t)=>{const n=e.children[t];n&&h.push(n)},h=[r];for(;h.length>0;){const t=h.pop();if(!t.subtreeIntersectsRay(e,a,l))continue;if(null!=t.ownIntersectsRay(e,a,l))for(const n of t.ownTiles)n.bvhIntersectionGeneration!==s&&(n.bvhIntersectionGeneration=s,n.boundingVolumeIntersectsRay(e,a)&&i(n));if(t.isLeaf)continue;M(t,T(t.hPlane,e),T(t.vPlane,e),(t,n)=>{const o=t.children[n];o&&o.subtreeIntersectsRay(e,a,l)&&u(t,n)})}}getElevationRangeIntersectingSphere(e){const t=this._rootNode;if(!t||!t.subtreeIntersectsSphere(e))return null;const n=this._nextIntersectionGeneration();let o=null;const i=e=>{e.isEmpty||(o?o.expandElevationRange(e):o=new p(e.minElevation,e.maxElevation))},r=[t];for(;r.length>0;){const t=r.pop();if(!o?.contains(t.subtreeElevationRange))if(t.subtreeContainedBySphere(e))i(t.subtreeElevationRange);else{if(t.ownIntersectsSphere(e))for(const r of t.ownTiles){if(r.bvhIntersectionGeneration===n)continue;if(r.bvhIntersectionGeneration=n,!r.boundingVolumeIntersectsSphere(e))continue;const t=r.elevationRange;o?.contains(t)||i(t)}if(!t.isLeaf){M(t,V(e.center,e.radius,t.hPlane),V(e.center,e.radius,t.vPlane),(t,n)=>{const i=t.children[n];if(i&&i.subtreeIntersectsSphere(e)){if(o?.contains(i.subtreeElevationRange))return;r.push(i)}})}}}return o}}class _ extends w{constructor(e){super("local",e)}_ensureRootNode(){if(!this._rootNode){const e=this.layerExtent,t=Math.max(Math.abs(e[0]),Math.abs(e[1]),Math.abs(e[2]),Math.abs(e[3])),n=Math.log2(t),o=Math.ceil(n),i=2**Math.max(1,o),s=new v(null,0,m(-i,-i,i,i),new E(r(0,1,0),0),new E(r(1,0,0),0),2*i,a(-i,-i,-1/0,i,i,1/0));this._rootNode=s}return this._rootNode}_ensureChild(t,n){if(t.treeDepth>=H){const t="Internal error: attempted to create a child node for a node that is already at max depth";throw e.getLogger("Tiles3DBVH").error(t),new Error(t)}let o=t.children[n];if(null===o){const{extent:e,hPlane:i,vPlane:r,treeDepth:s,sideLength:l}=t,u=.5*(e[0]+e[2]),h=.5*(e[1]+e[3]),c=0===n||1===n,d=2===n||0===n,g=m(d?e[0]:u,c?e[1]:h,d?u:e[2],c?h:e[3]),f=new E(i.normal,-.5*(g[1]+g[3])),p=new E(r.normal,-.5*(g[0]+g[2]));o=new v(t,s+1,g,f,p,.5*l,a(g[0],g[1],-1/0,g[2],g[3],1/0)),t.children[n]=o}return o}}class b extends w{constructor(e){super("global",e)}_ensureRootNode(){if(!this._rootNode){const e=new v(null,0,m(-Math.PI,-Math.PI/2,Math.PI,Math.PI/2),new E(r(0,0,1),0),new E(r(1,0,0),0),Math.PI*f.radius,a(-1/0,-1/0,-1/0,1/0,1/0,1/0));this._rootNode=e}return this._rootNode}_ensureChild(t,n){if(t.treeDepth>=H){const t="Attempted to create a child node for a node that is already at max depth";throw e.getLogger("Tiles3DBVH").error(t),new Error(t)}let o=t.children[n];if(null===o){const{extent:e,treeDepth:i,sideLength:s}=t,a=.5*(e[0]+e[2]),l=.5*(e[1]+e[3]),u=0===n||1===n,h=2===n||0===n,c=m(h?e[0]:a,u?e[1]:l,h?a:e[2],u?l:e[3]),d=.5*(c[0]+c[2]),g=.5*(c[1]+c[3]),f=Math.cos(d),p=Math.sin(d),w=Math.cos(g),_=Math.sin(g),b=r(-_*f,-_*p,w),M=new E(b,0),R=new E(r(-p,f,0),0);o=new v(t,i+1,c,M,R,.5*s),t.children[n]=o}return o}}class v{constructor(e,t,n,o,i,r,s){this.parent=e,this._treeDepth=t,this.extent=n,this.hPlane=o,this.vPlane=i,this.sideLength=r,this.bounds=s,this._ownBoundingVolume=a(1/0,1/0,1/0,-1/0,-1/0,-1/0),this._subtreeBoundingVolume=a(1/0,1/0,1/0,-1/0,-1/0,-1/0),this._ownElevationRange=new p,this._subtreeElevationRange=new p,this.ownTiles=new Set,this.children=[null,null,null,null]}get ownBoundingVolume(){return this._ownBoundingVolume}get subtreeBoundingVolume(){return this._subtreeBoundingVolume}get subtreeElevationRange(){return this._subtreeElevationRange}subtreeContainedBySphere(e){const t=this._subtreeBoundingVolume;if(l(t))return!0;const{center:n,radius:o}=e,i=o**2;let r=0;for(let s=0;s<3;s++){if(r+=Math.max(Math.abs(t[s]-n[s]),Math.abs(t[s+3]-n[s]))**2,r>i)return!1}return!0}clear(){for(let e=0;e<4;e++)this.children[e]?.clear(),this.children[e]=null;this.ownTiles.clear(),u(this._ownBoundingVolume),u(this._subtreeBoundingVolume),this._ownElevationRange.initializeEmpty(),this._subtreeElevationRange.initializeEmpty()}get isLeaf(){return this.children.every(e=>null==e)}get treeDepth(){return this._treeDepth}subtreeIntersectsSphere(e){return h(this.subtreeBoundingVolume,e)}ownIntersectsSphere(e){return this.ownTiles.size>0&&h(this._ownBoundingVolume,e)}subtreeIntersectsRay(e,t,n){return c(this.subtreeBoundingVolume,e,t,n)}ownIntersectsRay(e,t,n){return this.ownTiles.size>0?c(this._ownBoundingVolume,e,t,n):null}addOwnTile(t){if(this.ownTiles.has(t)){const t="BVNode: Attempted to add a tile that is already in the node";return e.getLogger("Tiles3DBVH").error(t),0}this.ownTiles.add(t);return(x(this._ownBoundingVolume,t,this.bounds)&&B(this._subtreeBoundingVolume,this._ownBoundingVolume,this.bounds)?1:0)|(this._ownElevationRange.expandElevationRange(t.elevationRange)&&this._subtreeElevationRange.expandElevationRange(t.elevationRange)?2:0)}removeOwnTile(t){if(!this.ownTiles.has(t)){const t="BVNode: Attempted to remove a tile that is not in the node";return void e.getLogger("Tiles3DBVH").error(t)}this.ownTiles.delete(t)}updateOwnSummaries(){const e=(S(this._ownBoundingVolume,this.ownTiles,this.bounds)?1:0)|(D(this._ownElevationRange,this.ownTiles)?2:0);return this.updateSubtreeSummaries(e)}updateSubtreeSummaries(e){if(this.isLeaf&&0===this.ownTiles.size)return u(this._subtreeBoundingVolume),this._subtreeElevationRange.initializeEmpty(),3;let t=0;if(1&e){N(this._subtreeBoundingVolume,[this._ownBoundingVolume,...this.children.map(e=>e?.subtreeBoundingVolume).filter(e=>null!=e)],this.bounds)&&(t|=1)}if(2&e){P(this._subtreeElevationRange,[this._ownElevationRange,...this.children.filter(e=>null!=e).map(e=>e.subtreeElevationRange)])&&(t|=2)}return t}}function M(e,t,n,o){t<=0&&(n<=0&&o(e,0),n>=0&&o(e,1)),t>=0&&(n<=0&&o(e,2),n>=0&&o(e,3))}function R(e,t,n){null!=t&&0!==n&&e.push({node:t,childrenUpdateKind:n})}function I(e,t,n){if(null==t||0===n)return;const o=e.get(t)??0;e.set(t,o|n)}class E{constructor(e=[0,0,0],t=0){this.normal=e,this.distance=t}}function V(e,t,n){const o=i(n.normal,e)+n.distance;return o<0?Math.min(o+t,0):Math.max(o-t,0)}function T(e,t){return i(e.normal,t)+e.distance}function y(e,t,n,o,r){if(!n)return null;const s=1e-12,a=i(o.normal,t),l=T(o,e)+n.tMin*a;if(Math.abs(a)<s){return(r?l>=-s:l<=s)?n:null}const u=n.tMin-l/a,h=r===a>0?{tMin:Math.max(n.tMin,u),tMax:n.tMax}:{tMin:n.tMin,tMax:Math.min(n.tMax,u)};return h.tMin<=h.tMax?h:null}function x(e,t,n){const{mbsCenter:o,mbsRadius:i}=t;for(let r=0;r<3;r++)G[r]=o[r]-i,G[r+3]=o[r]+i;return B(e,G,n)}function B(e,t,n){if(l(t))return!1;let o=!1;for(let i=0;i<3;i++){const r=Math.max(n?.[i]??-1/0,t[i]),s=Math.min(n?.[i+3]??1/0,t[i+3]);r<e[i]&&(e[i]=r,o=!0),s>e[i+3]&&(e[i+3]=s,o=!0)}return o}function S(e,t,n){d(L,e),u(e);for(const o of t)x(e,o,n);return!g(e,L)}function N(e,t,n){d(L,e),u(e);for(const o of t)B(e,o,n);return!g(e,L)}function D(e,t){z.setElevationRange(e),e.initializeEmpty();for(const n of t)e.expandElevationRange(n.elevationRange);return!e.equals(z)}function P(e,t){z.setElevationRange(e),e.initializeEmpty();for(const n of t)e.expandElevationRange(n);return!e.equals(z)}const G=a(0,0,0,0,0,0),L=a(0,0,0,0,0,0),z=new p,j=s(),H=30;export{w as Tiles3DBVH};
2
+ import e from"../../../../core/Logger.js";import{getOrCreateMapValue as t}from"../../../../core/MapUtils.js";import{sub as n,normalize as i,len as r,dot as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as o,create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as l,isEmpty as h,containedBySphere as u,setEmpty as c,intersectsSphere as d,intersectsRay as p,copy as g,exactEquals as f}from"../../../../geometry/support/aaBoundingBox.js";import{fromValues as m}from"../../../../geometry/support/aaBoundingRect.js";import{earth as b}from"../../../../geometry/support/Ellipsoid.js";import{ElevationRange as _}from"../../support/ElevationRange.js";function w(e,t){return"local"===e?new B(t):new v(t)}class M{constructor(e,t){this.viewingMode=e,this.layerExtent=t,this._rootNode=null,this._intersectionGeneration=0,this._tileMap=new Map}destroy(){this._rootNode?.clear(),this._tileMap.clear()}_nextIntersectionGeneration(){return this._intersectionGeneration++,this._intersectionGeneration}addTile(e){const{obb:n}=e,i=[this._ensureRootNode()],r=new Array,s=t(this._tileMap,e,()=>new Set),o=t=>{if(s.has(t))return;const n=t.addOwnTile(e);A(r,t.parent,n),s.add(t)};for(;i.length>0;){const t=i.pop(),r=this._getSizeStopLength(t);if(t.treeDepth>=Y||S(e.obb)>=.5*r){o(t);continue}const{hPlane:s,vPlane:a}=t,l=n.signedDistancePlane(s.normal,s.distance),h=n.signedDistancePlane(a.normal,a.distance);0!==l||0!==h?R(t,l,h,(e,t)=>{i.push(this._ensureChild(e,t))}):o(t)}this._propagateSummaryUpdates(r)}removeTile(t){if(!this._rootNode)return void e.getLogger("Tiles3DBVH").error("Tiles3DBVH: Attempted to remove a tile that is not loaded (no root node)");const n=this._tileMap.get(t);if(!n||0===n.size)return void e.getLogger("Tiles3DBVH").error("Tiles3DBVH internal error: Attempted to remove a tile that is not loaded (not in tile map)");const i=new Array;this._tileMap.delete(t);for(const e of n){e.removeOwnTile(t);const n=e.updateOwnSummaries();A(i,e.parent,n)}this._propagateSummaryUpdates(i)}_propagateSummaryUpdates(e){if(0===e.length)return;e.sort((e,t)=>e.node.treeDepth-t.node.treeDepth);let t=new Map,n=-1;const i=()=>e.length>0?e[e.length-1].node.treeDepth:-1;for(;e.length>0||t.size>0;){const r=t.size>0?n:i(),s=t;for(t=new Map;e.length>0&&i()===r;){const{node:t,childrenUpdateKind:n}=e.pop();E(s,t,n)}for(const[e,n]of s){let i=0;for(let t=0;t<4;t++){const n=e.children[t];n&&n.isLeaf&&0===n.ownTiles.size&&(n.clear(),e.children[t]=null,i=3)}i|=e.updateSubtreeSummaries(n|i),E(t,e.parent,i)}t.size>0&&(n=r-1)}}forEachTileIntersectingRay(e,t,n,i){i?this._forEachTileIntersectingVerticalRay(e,t,n):this._forEachTileIntersectingRayGeneral(e,t,n)}_forEachTileIntersectingRayGeneral(e,t,r){const s=this._rootNode;if(!s)return;n(H,t,e);const o=i(H,H);if(!s.subtreeIntersectsRay(e,o,{tMin:0,tMax:Number.POSITIVE_INFINITY}))return;const a=this._nextIntersectionGeneration(),l=[s],h=U;h.length=0,h.push(0,Number.POSITIVE_INFINITY);const u={tMin:0,tMax:Number.POSITIVE_INFINITY};for(;l.length>0;){const t=l.pop();u.tMax=h.pop(),u.tMin=h.pop(),t.forEachOwnTileIntersectingRay(e,o,u,a,r);const{hPlane:n,vPlane:i}=t;for(let r=0;r<4;r++){const s=t.children[r];if(null==s)continue;const a=0===r||1===r,c=D(e,o,D(e,o,u,i,!(0===r||2===r)),n,!a);c&&(s.subtreeIntersectsRay(e,o,c)&&(l.push(s),h.push(c.tMin,c.tMax)))}}}_forEachTileIntersectingVerticalRay(e,t,s){const o=this._rootNode;if(!o)return;n(H,t,e);const a=i(H,H),l={tMin:0,tMax:"global"===this.viewingMode?r(e):Number.POSITIVE_INFINITY};if(!o.subtreeIntersectsRay(e,a,l))return;const h=this._nextIntersectionGeneration(),u=[o];for(;u.length>0;){const t=u.pop();if(t.forEachOwnTileIntersectingRay(e,a,l,h,s),t.isLeaf)continue;R(t,y(t.hPlane,e),y(t.vPlane,e),(t,n)=>{const i=t.children[n];i&&i.subtreeIntersectsRay(e,a,l)&&u.push(i)},1)}}getElevationRangeIntersectingSphere(e){const t=this._rootNode;if(!t||!t.subtreeIntersectsSphere(e))return null;const n=this._nextIntersectionGeneration(),i=new _,r=[t];for(;r.length>0;){const t=r.pop();if(!i.contains(t.subtreeElevationRange))if(t.subtreeContainedBySphere(e))i.expandElevationRange(t.subtreeElevationRange);else{if(t.ownIntersectsSphere(e))for(const r of t.ownTiles){if(r.bvhIntersectionGeneration===n)continue;if(r.bvhIntersectionGeneration=n,!(r.boundingVolumeIntersectsSphere?.(e)??r.obb.intersectSphere(e)))continue;const t=r.elevationRange;i.contains(t)||i.expandElevationRange(t)}if(!t.isLeaf){R(t,x(e.center,e.radius,t.hPlane),x(e.center,e.radius,t.vPlane),(t,n)=>{const s=t.children[n];if(s&&s.subtreeIntersectsSphere(e)){if(i.contains(s.subtreeElevationRange))return;r.push(s)}})}}}return i.isEmpty?null:i}}class B extends M{constructor(e){super("local",e)}_getSizeStopLength(e){return e.sideLength}_ensureRootNode(){if(!this._rootNode){const e=this.layerExtent,t=Math.max(Math.abs(e[0]),Math.abs(e[1]),Math.abs(e[2]),Math.abs(e[3])),n=Math.log2(t),i=Math.ceil(n),r=2**Math.max(1,i),s=new I(null,0,m(-r,-r,r,r),new T(o(0,1,0),0),new T(o(1,0,0),0),2*r,l(-r,-r,-1/0,r,r,1/0));this._rootNode=s}return this._rootNode}_ensureChild(t,n){if(t.treeDepth>=Y){const t="Internal error: attempted to create a child node for a node that is already at max depth";throw e.getLogger("Tiles3DBVH").error(t),new Error(t)}let i=t.children[n];if(null===i){const{extent:e,hPlane:r,vPlane:s,treeDepth:o,sideLength:a}=t,h=.5*(e[0]+e[2]),u=.5*(e[1]+e[3]),c=0===n||1===n,d=2===n||0===n,p=m(d?e[0]:h,c?e[1]:u,d?h:e[2],c?u:e[3]),g=new T(r.normal,-.5*(p[1]+p[3])),f=new T(s.normal,-.5*(p[0]+p[2]));i=new I(t,o+1,p,g,f,.5*a,l(p[0],p[1],-1/0,p[2],p[3],1/0)),t.children[n]=i}return i}}class v extends M{constructor(e){super("global",e)}_getSizeStopLength(e){return P(e.extent)}_ensureRootNode(){if(!this._rootNode){const e=new I(null,0,m(-Math.PI,-Math.PI/2,Math.PI,Math.PI/2),new T(o(0,0,1),0),new T(o(0,1,0),0),Math.PI*b.radius);this._rootNode=e}return this._rootNode}_ensureChild(t,n){if(t.treeDepth>=Y){const t="Attempted to create a child node for a node that is already at max depth";throw e.getLogger("Tiles3DBVH").error(t),new Error(t)}let i=t.children[n];if(null===i){const{extent:e,treeDepth:r}=t,s=.5*(e[0]+e[2]),a=.5*(e[1]+e[3]),l=0===n||1===n,h=2===n||0===n,u=m(h?e[0]:s,l?e[1]:a,h?s:e[2],l?a:e[3]),c=.5*(u[0]+u[2]),d=.5*(u[1]+u[3]),p=Math.cos(c),g=Math.sin(c),f=Math.cos(d),b=Math.sin(d),_=o(-b*p,-b*g,f),w=new T(_,0),M=new T(o(-g,p,0),0),B=N(u);i=new I(t,r+1,u,w,M,B),t.children[n]=i}return i}}class I{constructor(e,t,n,i,r,s,o){this.parent=e,this._treeDepth=t,this.extent=n,this.hPlane=i,this.vPlane=r,this.sideLength=s,this.bounds=o,this._ownAABB=l(1/0,1/0,1/0,-1/0,-1/0,-1/0),this._subtreeAABB=l(1/0,1/0,1/0,-1/0,-1/0,-1/0),this._ownElevationRange=new _,this._subtreeElevationRange=new _,this.ownTiles=new Set,this.children=[null,null,null,null]}get subtreeAABB(){return this._subtreeAABB}get subtreeElevationRange(){return this._subtreeElevationRange}subtreeContainedBySphere(e){const t=this._subtreeAABB;return!!h(t)||u(t,e)}clear(){for(let e=0;e<4;e++)this.children[e]?.clear(),this.children[e]=null;this.ownTiles.clear(),c(this._ownAABB),c(this._subtreeAABB),this._ownElevationRange.initializeEmpty(),this._subtreeElevationRange.initializeEmpty()}get isLeaf(){return this.children.every(e=>null==e)}get treeDepth(){return this._treeDepth}subtreeIntersectsSphere(e){return d(this.subtreeAABB,e)}ownIntersectsSphere(e){return this.ownTiles.size>0&&d(this._ownAABB,e)}subtreeIntersectsRay(e,t,n){return p(this._subtreeAABB,e,t,n)}ownIntersectsRay(e,t,n){return this.ownTiles.size>0?p(this._ownAABB,e,t,n):null}forEachOwnTileIntersectingRay(e,t,n,i,r){if(this.ownIntersectsRay(e,t,n))for(const s of this.ownTiles)s.bvhIntersectionGeneration!==i&&(s.bvhIntersectionGeneration=i,(s.boundingVolumeIntersectsRay?.(e,t)??s.obb.intersectRay(e,t))&&r(s))}addOwnTile(t){if(this.ownTiles.has(t))return e.getLogger("Tiles3DBVH").error("Tiles3DBVH: Attempted to add a tile that is already in the node"),0;this.ownTiles.add(t);return(V(this._ownAABB,t,this.bounds)&&z(this._subtreeAABB,this._ownAABB,this.bounds)?1:0)|(this._ownElevationRange.expandElevationRange(t.elevationRange)&&this._subtreeElevationRange.expandElevationRange(t.elevationRange)?2:0)}removeOwnTile(t){if(!this.ownTiles.has(t)){const t="BVNode: Attempted to remove a tile that is not in the node";return void e.getLogger("Tiles3DBVH").error(t)}this.ownTiles.delete(t)}updateOwnSummaries(){const e=(L(this._ownAABB,this.ownTiles,this.bounds)?1:0)|(G(this._ownElevationRange,this.ownTiles)?2:0);return this.updateSubtreeSummaries(e)}updateSubtreeSummaries(e){if(this.isLeaf&&0===this.ownTiles.size)return c(this._subtreeAABB),this._subtreeElevationRange.initializeEmpty(),3;let t=0;if(1&e){g(O,this._subtreeAABB),c(this._subtreeAABB),z(this._subtreeAABB,this._ownAABB,this.bounds);for(const e of this.children)e&&z(this._subtreeAABB,e.subtreeAABB,this.bounds);f(this._subtreeAABB,O)||(t|=1)}if(2&e){j.setElevationRange(this._subtreeElevationRange),this._subtreeElevationRange.initializeEmpty(),this._subtreeElevationRange.expandElevationRange(this._ownElevationRange);for(const e of this.children)e&&this._subtreeElevationRange.expandElevationRange(e.subtreeElevationRange);this._subtreeElevationRange.equals(j)||(t|=2)}return t}}function R(e,t,n,i,r=1e-12){t<=r&&(n<=r&&i(e,0),n>=-r&&i(e,1)),t>=-r&&(n<=r&&i(e,2),n>=-r&&i(e,3))}function A(e,t,n){null!=t&&0!==n&&e.push({node:t,childrenUpdateKind:n})}function E(e,t,n){if(null==t||0===n)return;const i=e.get(t)??0;e.set(t,i|n)}class T{constructor(e=[0,0,0],t=0){this.normal=e,this.distance=t}}function x(e,t,n){const i=s(n.normal,e)+n.distance;return i<0?Math.min(i+t,0):Math.max(i-t,0)}function y(e,t){return s(e.normal,t)+e.distance}function S(e){return 2*Math.max(e.halfSizeX,e.halfSizeY,e.halfSizeZ)}function N(e){const t=Math.abs(e[2]-e[0]),n=Math.abs(e[3]-e[1]),i=.5*(e[1]+e[3]),r=b.radius*Math.abs(Math.cos(i))*t,s=b.radius*n;return Math.max(r,s)}function P(e){const t=Math.abs(e[2]-e[0]),n=Math.abs(e[3]-e[1]),i=.5*(e[1]+e[3]),r=b.radius*Math.abs(Math.cos(i))*t,s=b.radius*n;return Math.min(r,s)}function D(e,t,n,i,r){if(!n)return null;const o=1e-12,a=s(i.normal,t),l=y(i,e)+n.tMin*a;if(Math.abs(a)<o){return(r?l>=-o:l<=o)?n:null}const h=n.tMin-l/a,u=r===a>0?{tMin:Math.max(n.tMin,h),tMax:n.tMax}:{tMin:n.tMin,tMax:Math.min(n.tMax,h)};return u.tMin<=u.tMax?u:null}function V(e,t,n){const{obb:i}=t,r=[o(1,0,0),o(0,1,0),o(0,0,1)],s=i.getCenter(C);let a=!1;for(let o=0;o<3;o++){const t=i.projectedRadius(r[o]),l=Math.max(n?.[o]??-1/0,s[o]-t),h=Math.min(n?.[o+3]??1/0,s[o]+t);l<e[o]&&(e[o]=l,a=!0),h>e[o+3]&&(e[o+3]=h,a=!0)}return a}function z(e,t,n){if(h(t))return!1;let i=!1;for(let r=0;r<3;r++){const s=Math.max(n?.[r]??-1/0,t[r]),o=Math.min(n?.[r+3]??1/0,t[r+3]);s<e[r]&&(e[r]=s,i=!0),o>e[r+3]&&(e[r+3]=o,i=!0)}return i}function L(e,t,n){g(O,e),c(e);for(const i of t)V(e,i,n);return!f(e,O)}function G(e,t){j.setElevationRange(e),e.initializeEmpty();for(const n of t)e.expandElevationRange(n.elevationRange);return!e.equals(j)}const O=l(0,0,0,0,0,0),j=new _,H=a(),C=a(),U=new Array,Y=30;export{w as createTileBVH};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{project as t}from"../../../../geometry/projectionUtils.js";import{fromExtent as i}from"../../../../geometry/support/aaBoundingRect.js";import{Tiles3DTarget as n}from"../i3s/Intersector.js";import{Tiles3DBVH as r}from"./Tiles3DBVH.js";import{ElevationRange as s}from"../../support/ElevationRange.js";import{IntersectorResult as o}from"../../webgl-engine/lib/IntersectorResult.js";import{MeshIntersectionOptions as l,computeInvDir as a,intersectAabbInvDir as c}from"../../webgl-engine/lib/RayIntersections.js";class d{constructor(e){this.layerView=e,this.type=8,this.slicePlaneEnabled=!1,this.isGround=!0,this.layerViewUid=e.uid;const n=e.view.viewingMode,s=e.layer.fullExtent,o=(s?t(s,e.view.renderSpatialReference):void 0)??e.view.extent,l=i(o);this._bvh=r.create(n,l)}destroy(){this._bvh.destroy()}addTile(e){this._bvh.addTile(e)}removeTile(e){this._bvh.removeTile(e)}intersect(e,t,i,r,s,d){if(e.options.filteredLayerViewUids.includes(this.layerView.uid))return;const{results:u,tolerance:h}=e,p=2===e.options.store,{componentObjectCollection:f}=this.layerView.view.stage.renderView,g=new l(h,d,e.options.normalRequired),v=a(i,r,m),w=(s,l,a)=>{if(l<0)return;if(null!=t&&!t(i,r,l))return;const c=e=>{const t=new n(this.layerView.uid);e.set(this.type,t,l,a)};if(this.isGround&&(null==u.ground.distance||l<u.ground.distance)&&c(u.ground),!e.options.isFiltered&&((null==u.min.distance||l<u.min.distance)&&c(u.min),(null==u.max.distance||l>u.max.distance)&&c(u.max),p)){const t=new o(e.ray);c(t),e.results.all.push(t)}};this._bvh.forEachTileIntersectingRay(i,r,e=>{const{componentObjects:t}=e;for(const n of t)c(n.aabbInWorldCoordinates,i,v,0)&&f.intersect(n,i,r,null,g,w)},d)}getElevationRange(e){return this._bvh.getElevationRangeIntersectingSphere(e)??new s(0,0)}}const m=e();export{d as Tiles3DMeshIntersectionHandler};
2
+ import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{project as t}from"../../../../geometry/projectionUtils.js";import{fromExtent as i}from"../../../../geometry/support/aaBoundingRect.js";import{Tiles3DTarget as n}from"../i3s/Intersector.js";import{createTileBVH as r}from"./Tiles3DBVH.js";import{ElevationRange as s}from"../../support/ElevationRange.js";import{IntersectorResult as o}from"../../webgl-engine/lib/IntersectorResult.js";import{MeshIntersectionOptions as l,computeInvDir as a,intersectAabbInvDir as c}from"../../webgl-engine/lib/RayIntersections.js";class d{constructor(e){this.layerView=e,this.type=8,this.slicePlaneEnabled=!1,this.isGround=!0,this.layerViewUid=e.uid;const n=e.view.viewingMode,s=e.layer.fullExtent,o=(s?t(s,e.view.renderSpatialReference):void 0)??e.view.extent,l=i(o);this._bvh=r(n,l)}destroy(){this._bvh.destroy()}addTile(e){this._bvh.addTile(e)}removeTile(e){this._bvh.removeTile(e)}intersect(e,t,i,r,s,d){if(e.options.filteredLayerViewUids.includes(this.layerView.uid))return;const{results:u,tolerance:h}=e,p=2===e.options.store,{componentObjectCollection:f}=this.layerView.view.stage.renderView,g=new l(h,d,e.options.normalRequired),v=a(i,r,m),w=(s,l,a)=>{if(l<0)return;if(null!=t&&!t(i,r,l))return;const c=e=>{const t=new n(this.layerView.uid);e.set(this.type,t,l,a)};if(this.isGround&&(null==u.ground.distance||l<u.ground.distance)&&c(u.ground),!e.options.isFiltered&&((null==u.min.distance||l<u.min.distance)&&c(u.min),(null==u.max.distance||l>u.max.distance)&&c(u.max),p)){const t=new o(e.ray);c(t),e.results.all.push(t)}};this._bvh.forEachTileIntersectingRay(i,r,e=>{const{componentObjects:t}=e;for(const n of t)c(n.aabbInWorldCoordinates,i,v,0)&&f.intersect(n,i,r,null,g,w)},d)}getElevationRange(e){return this._bvh.getElevationRangeIntersectingSphere(e)??new s(0,0)}}const m=e();export{d as Tiles3DMeshIntersectionHandler};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{reallocGrowthFactor as t}from"../../../../core/arrayUtils.js";import{abortMaybe as e}from"../../../../core/maybe.js";import{isAbortError as r}from"../../../../core/promiseUtils.js";import{signal as s}from"../../../../core/signal.js";import{Milliseconds as i,now as o}from"../../../../core/time.js";import{normalize as n}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{intersects as u}from"../../../../geometry/support/aaBoundingBox.js";import{intersectsSphere as l}from"../../../../geometry/support/frustum.js";import{Sphere as h}from"../../../../geometry/support/sphere.js";import{makeScheduleFunction as d}from"../../layers/support/makeScheduleFunction.js";import{GaussianSplatSortWorkerHandle as _}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatFadeTexture as c}from"./GaussianSplatFadeTexture.js";import{GaussianSplatOrderTexture as f}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as m}from"./GaussianSplatTextureAtlas.js";import{TaskPriority as p}from"../../../support/Scheduler.js";class S{constructor(t){this._updating=s(!1),this._useDeterministicSort=!1,this.visibleGaussians=0,this._visibleGaussianTiles=new Array,this._bufferCapacity=0,this._minimumBoundingSphere=new h,this._cameraDirectionNormalized=a(),this._frameTask=null,this._workerHandle=null,this._sortAbortController=null,this._isSorting=!1,this._pendingSortTask=!1,this._scheduledSortStartTimeout=null,this._lastSortStartTime=i(-1/0),this._sortInterval=i(80),this._renderer=t,this._orderTexture=new f(this._renderer.renderingContext),this._fadingTexture=new c(this._renderer.renderingContext),this._textureAtlas=new m(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache);const{resourceController:e}=this._renderer.view;this._workerHandle=new _(d(e)),this._frameTask=e.scheduler.registerTask(p.GAUSSIAN_SPLAT_SORTING)}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get fadingTexture(){return this._fadingTexture}get visibleGaussianTiles(){return this._visibleGaussianTiles}forEachTile(t){for(const e of this._visibleGaussianTiles)t(e)}updateGaussianVisibility(t){this._visibleGaussianTiles=t,this.requestSort()}get updating(){return this._updating.value}destroy(){this._sortAbortController=e(this._sortAbortController),this._pendingSortTask=!1,this._updating.value=!1,null!=this._scheduledSortStartTimeout&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._frameTask.remove(),this._workerHandle?.destroyWorkerAndSelf(),this._textureAtlas.destroy(),this._orderTexture.destroy(),this._fadingTexture.destroy()}requestSort(){return this._updating.value=!0,!this._pendingSortTask&&(this._pendingSortTask=!0,this._scheduleSortStart(),!0)}_scheduleSortStart(){if(this._isSorting)return;const t=o()-this._lastSortStartTime,e=this._sortInterval-t;e<=0?this._startSortIfRequired():null==this._scheduledSortStartTimeout&&(this._scheduledSortStartTimeout=setTimeout(()=>{this._scheduledSortStartTimeout=null,this._pendingSortTask&&!this._isSorting&&this._scheduleSortStart()},e))}_startSortIfRequired(){if(this._isSorting||!this._pendingSortTask)return;const t=new AbortController;this._sortAbortController=t,this._isSorting=!0,this._pendingSortTask=!1,this._lastSortStartTime=o(),this._sortOnWorker(t.signal).finally(()=>{this._sortAbortController===t&&(this._sortAbortController=null),this._handleSortComplete()})}_handleSortComplete(){this._isSorting=!1,this._pendingSortTask?this._scheduleSortStart():this._updating.value=!1}_clearBuffersAndTextures(){this._atlasIndicesBuffer=void 0,this._sortedAtlasIndicesBuffer=void 0,this._distancesBuffer=void 0,this._sortOrderBuffer=void 0,this._bufferCapacity=0,this._orderTexture.clear(),this._textureAtlas.clear()}_computeExpandedCapacity(e,r){let s=Math.max(1,e);for(;s<r;)s=Math.ceil(s*t);return s}_ensureSortBufferCapacities(t){if(this._bufferCapacity<t){const e=this._computeExpandedCapacity(this._bufferCapacity,t);this._atlasIndicesBuffer=new Uint32Array(e),this._distancesBuffer=new Float64Array(e),this._sortOrderBuffer=new Uint32Array(e),this._bufferCapacity=e}}_ensureSortedAtlasIndicesBufferCapacity(t){if(!(t<=0)&&(!this._sortedAtlasIndicesBuffer||this._sortedAtlasIndicesBuffer.length<t)){const e=this._sortedAtlasIndicesBuffer?.length??0,r=this._computeExpandedCapacity(e,t);this._sortedAtlasIndicesBuffer=new Uint32Array(r)}}_clearAllBuffersAndTextures(){this._clearBuffersAndTextures(),this._workerHandle?.clear()}async _sortOnWorker(t){try{if(0===this._visibleGaussianTiles.length)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),void this._renderer.requestRender(1);this._useDeterministicSort&&this._visibleGaussianTiles.sort((t,e)=>t.obb.centerX-e.obb.centerX||t.obb.centerY-e.obb.centerY||t.obb.centerZ-e.obb.centerZ);const e=this._visibleGaussianTiles,r=e.length;let s=0;for(let t=0;t<r;t++)s+=e[t].gaussianAtlasIndices.length;this._ensureSortBufferCapacities(s),this._textureAtlas.ensureTextureAtlas();const{frustum:i}=this._renderer.camera;n(this._cameraDirectionNormalized,this._renderer.camera.ray.direction);const o=this._cameraDirectionNormalized[0],a=this._cameraDirectionNormalized[1],h=this._cameraDirectionNormalized[2];let d=0;const _=1.5,c=this._atlasIndicesBuffer,f=this._distancesBuffer,m=this._sortOrderBuffer,p=this._minimumBoundingSphere,S=p.center,T=this._renderer.clippingBox;for(let t=0;t<r;t++){const r=e[t],{gaussianAtlasIndices:s,relativePositions:n,obb:m,maxScale:g}=r,b=s.length;if(null!=T&&null!=r.boundingBox&&!u(r.boundingBox,T))continue;const{centerX:A,centerY:x,centerZ:B}=m;if(S[0]=A,S[1]=x,S[2]=B,p.radius=(m.radius+g)*_,!l(i,p))continue;c.set(s,d);const y=o*A+a*x+h*B,v=d+b;for(let t=d,e=0;t<v;t++,e+=3){const r=n[e],s=n[e+1],i=n[e+2];f[t]=r*o+s*a+i*h+y}d=v}for(let t=0;t<d;t++)m[t]=t;if(0===d)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),void this._renderer.requestRender(1);const g={distances:this._distancesBuffer,sortOrderIndices:this._sortOrderBuffer,numGaussians:d,preciseSort:this._useDeterministicSort},b=await(this._workerHandle?.sort(g,t));if(t.aborted)return;b&&(this._distancesBuffer=b.distances,this._sortOrderBuffer=b.sortedOrderIndices);const A=async t=>{const{paddedSize:e}=this._orderTexture.ensureCapacity(d);this._ensureSortedAtlasIndicesBufferCapacity(e);const r=this._atlasIndicesBuffer,s=this._sortOrderBuffer,i=this._sortedAtlasIndicesBuffer;for(let o=0;o<d;o++)i[o]=r[s[o]];this._orderTexture.setData(i,d),this.visibleGaussians=d,this._renderer.requestRender(1),t.madeProgress()};await this._frameTask.schedule(A,t)}catch(e){if(r(e))return}}set useDeterministicSort(t){this._useDeterministicSort=t}}export{S as GaussianSplatDataStore};
2
+ import{reallocGrowthFactor as t}from"../../../../core/arrayUtils.js";import{abortMaybe as e}from"../../../../core/maybe.js";import{isAbortError as s}from"../../../../core/promiseUtils.js";import{signal as r}from"../../../../core/signal.js";import{Milliseconds as i,now as a}from"../../../../core/time.js";import{normalize as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{intersects as l}from"../../../../geometry/support/aaBoundingBox.js";import{makeScheduleFunction as h}from"../../layers/support/makeScheduleFunction.js";import{GaussianSplatSortWorkerHandle as d}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatFadeTexture as u}from"./GaussianSplatFadeTexture.js";import{GaussianSplatOrderTexture as _}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as c}from"./GaussianSplatTextureAtlas.js";import{TaskPriority as f}from"../../../support/Scheduler.js";class m{constructor(t,e){this._updating=r(!1),this._useDeterministicSort=!1,this.visibleGaussians=0,this._bufferCapacity=0,this._requestedLyr3dVisibilityChange=0,this._latestCompletedLyr3dVisibilityChange=0,this._latestUpdatedGaussianTiles=new Array,this._latestSortedGaussianTiles=new Array,this._nextCommittedVisibleGaussianTiles=new Array,this._cameraDirectionNormalized=n(),this._frameTask=null,this._workerHandle=null,this._sortAbortController=null,this._isSorting=!1,this._pendingSortTask=!1,this._scheduledSortStartTimeout=null,this._lastSortStartTime=i(-1/0),this._sortInterval=i(80),this._renderer=t,this._onSortComplete=e,this._orderTexture=new _(this._renderer.renderingContext),this._fadingTexture=new u(this._renderer.renderingContext),this._textureAtlas=new c(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache);const{resourceController:s}=this._renderer.view;this._workerHandle=new d(h(s)),this._frameTask=s.scheduler.registerTask(f.GAUSSIAN_SPLAT_SORTING)}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get fadingTexture(){return this._fadingTexture}forEachTile(t){for(const e of this._latestUpdatedGaussianTiles)t(e)}updateGaussianVisibility(t,e){this._latestUpdatedGaussianTiles=t,this._requestedLyr3dVisibilityChange=e,this.requestSort()}get updating(){return this._updating.value}destroy(){this._sortAbortController=e(this._sortAbortController),this._pendingSortTask=!1,this._updating.value=!1,null!=this._scheduledSortStartTimeout&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._frameTask.remove(),this._workerHandle?.destroyWorkerAndSelf(),this._textureAtlas.destroy(),this._orderTexture.destroy(),this._fadingTexture.destroy()}requestSort(){return this._updating.value=!0,!this._pendingSortTask&&(this._pendingSortTask=!0,this._scheduleSortStart(),!0)}_scheduleSortStart(){if(this._isSorting)return;const t=a()-this._lastSortStartTime,e=this._sortInterval-t;e<=0?this._startSortIfRequired():null==this._scheduledSortStartTimeout&&(this._scheduledSortStartTimeout=setTimeout(()=>{this._scheduledSortStartTimeout=null,this._pendingSortTask&&!this._isSorting&&this._scheduleSortStart()},e))}_startSortIfRequired(){if(this._isSorting||!this._pendingSortTask)return;const t=new AbortController;this._sortAbortController=t,this._isSorting=!0,this._pendingSortTask=!1,this._lastSortStartTime=a(),this._sortOnWorker(t.signal).finally(()=>{this._sortAbortController===t&&(this._sortAbortController=null),this._handleSortComplete()})}_handleSortComplete(){this._isSorting=!1,this._pendingSortTask?this._scheduleSortStart():this._updating.value=!1}_clearBuffersAndTextures(){this._atlasIndicesBuffer=void 0,this._sortedAtlasIndicesBuffer=void 0,this._distancesBuffer=void 0,this._sortOrderBuffer=void 0,this._bufferCapacity=0,this._orderTexture.clear(),this._textureAtlas.clear()}_computeExpandedCapacity(e,s){let r=Math.max(1,e);for(;r<s;)r=Math.ceil(r*t);return r}_ensureSortBufferCapacities(t){if(this._bufferCapacity<t){const e=this._computeExpandedCapacity(this._bufferCapacity,t);this._atlasIndicesBuffer=new Uint32Array(e),this._distancesBuffer=new Float64Array(e),this._sortOrderBuffer=new Uint32Array(e),this._bufferCapacity=e}}_ensureSortedAtlasIndicesBufferCapacity(t){if(!(t<=0)&&(!this._sortedAtlasIndicesBuffer||this._sortedAtlasIndicesBuffer.length<t)){const e=this._sortedAtlasIndicesBuffer?.length??0,s=this._computeExpandedCapacity(e,t);this._sortedAtlasIndicesBuffer=new Uint32Array(s)}}_clearAllBuffersAndTextures(){this._clearBuffersAndTextures(),this._latestSortedGaussianTiles.length=0,this._nextCommittedVisibleGaussianTiles.length=0,this._workerHandle?.clear()}async _sortOnWorker(t){try{if(0===this._latestUpdatedGaussianTiles.length)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=this._requestedLyr3dVisibilityChange,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);this._useDeterministicSort&&this._latestUpdatedGaussianTiles.sort((t,e)=>t.obb.centerX-e.obb.centerX||t.obb.centerY-e.obb.centerY||t.obb.centerZ-e.obb.centerZ);const e=this._latestUpdatedGaussianTiles,s=e.length,r=this._requestedLyr3dVisibilityChange;let i=0;for(let t=0;t<s;t++)i+=e[t].gaussianAtlasIndices.length;this._ensureSortBufferCapacities(i),this._textureAtlas.ensureTextureAtlas(),o(this._cameraDirectionNormalized,this._renderer.camera.ray.direction);const a=this._cameraDirectionNormalized[0],n=this._cameraDirectionNormalized[1],h=this._cameraDirectionNormalized[2];let d=0;const u=this._atlasIndicesBuffer,_=this._distancesBuffer,c=this._sortOrderBuffer,f=this._renderer.clippingBox,m=this._nextCommittedVisibleGaussianTiles;m.length=0;let p=0;for(let t=0;t<s;t++){const s=e[t],{gaussianAtlasIndices:r,relativePositions:i,obb:o}=s,c=r.length;if(null!=f&&null!=s.boundingBox&&!l(s.boundingBox,f))continue;const{centerX:S,centerY:g,centerZ:T}=o;u.set(r,d),m[p++]=s;const y=a*S+n*g+h*T,C=d+c;for(let t=d,e=0;t<C;t++,e+=3){const s=i[e],r=i[e+1],o=i[e+2];_[t]=s*a+r*n+o*h+y}d=C}m.length=p;for(let t=0;t<d;t++)c[t]=t;if(0===d)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=r,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);const S={distances:this._distancesBuffer,sortOrderIndices:this._sortOrderBuffer,numGaussians:d,preciseSort:this._useDeterministicSort},g=await(this._workerHandle?.sort(S,t));if(t.aborted)return;g&&(this._distancesBuffer=g.distances,this._sortOrderBuffer=g.sortedOrderIndices);const T=async t=>{const{paddedSize:e}=this._orderTexture.ensureCapacity(d);this._ensureSortedAtlasIndicesBufferCapacity(e);const s=this._atlasIndicesBuffer,i=this._sortOrderBuffer,a=this._sortedAtlasIndicesBuffer;for(let r=0;r<d;r++)a[r]=s[i[r]];this._orderTexture.setData(a,d);const o=this._latestSortedGaussianTiles;this._latestSortedGaussianTiles=m,this._nextCommittedVisibleGaussianTiles=o,this._latestCompletedLyr3dVisibilityChange=r,this.visibleGaussians=d,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1),t.madeProgress()};await this._frameTask.schedule(T,t)}catch(e){if(s(e))return}}set useDeterministicSort(t){this._useDeterministicSort=t}}export{m as GaussianSplatDataStore};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{signal as e}from"../../../../core/signal.js";class i{static{this.fadeInEase=e=>e*(2-e)}static{this.fadeOutEase=e=>e*e}constructor(i){this.layerView=i,this._numFadingTiles=e(0),this._tmpFullyFadedOutTiles=new Array}get numFadingTiles(){return this._numFadingTiles.value}fadeTile(e,i){const t=this._getTargetOpacity(i);if(e.fadeDirection=i,0===this.fadeDuration)return void this._instantTileFading(e,t);const a=e.opacityModifier;if(a!==t){const i=1-Math.abs(t-a);this._startTileFading(e,i)}else this._stopTileFading(e)}updateAllTileFading(e){const i=this._tmpFullyFadedOutTiles;i.length=0,this.layerView.tileHandles.forEach(t=>{this._updateTileFading(t,e)&&i.push(t)});i.length>0&&(this.layerView.updateGaussians(),this.layerView.notifyTileObbsChanged(i)),this._numFadingTiles.value>0&&this.layerView.view.stage?.renderView.requestRender(2)}onFadeDurationChanged(e){0===e&&this.numFadingTiles>0&&this._instantlyFullyFadeAllTiles()}isTileFadingOut(e){return null!=e.fadeProgress&&1===e.fadeDirection}onTileDiscarded(e){null!=e.fadeProgress&&this._numFadingTiles.value--}get updating(){return this._numFadingTiles.value>0}get fadeDuration(){return this.layerView.view.qualitySettings.fadeDuration}get fadingEnabled(){return 0!==this.fadeDuration}_startTileFading(e,i){null==e.fadeProgress&&this._numFadingTiles.value++,e.fadeProgress=i}_stopTileFading(e){null!=e.fadeProgress&&(1===e.fadeDirection&&this._onTileFullyFadedOut(e),this._numFadingTiles.value--,e.fadeProgress=null)}_updateTileFading(e,t){const{fadeProgress:a,fadeDirection:s}=e;if(null==a)return!1;const n=this._fadeDirectionToSign(s),l=n*this.fadeDuration,d=this._getTargetOpacity(s),r=t/Math.abs(l||1),u=Math.min(a+r,1),o=n*(1-(0===s?i.fadeInEase:i.fadeOutEase)(u)),g=1===u;if(e.opacityModifier=g?d:d-o,g){const i=1===s;return this._stopTileFading(e),this._updateOpacityModifier(e),i}return e.fadeProgress=u,this._updateOpacityModifier(e),!1}_updateOpacityModifier(e){const i=255*e.opacityModifier;for(let t=0;t<e.pageIds.length;t++){const a=e.pageIds[t];this.layerView.data.fadingTexture.updateBuffer(i,a)}}_instantTileFading(e,i){e.fadeProgress=null,e.opacityModifier=i,this._updateOpacityModifier(e),1===e.fadeDirection&&this._onTileFullyFadedOut(e)}_instantlyFullyFadeAllTiles(){const e=this._tmpFullyFadedOutTiles;e.length=0,this.layerView.tileHandles.forEach(i=>{if(null!=i.fadeProgress){const t=1===i.fadeDirection;this._instantTileFading(i,this._getTargetOpacity(i.fadeDirection)),t&&e.push(i)}});e.length>0&&(this.layerView.updateGaussians(),this.layerView.notifyTileObbsChanged(e)),this._numFadingTiles.value=0}_onTileFullyFadedOut(e){e.isVisible=!1,this.layerView.moveTileToCache(e)}_fadeDirectionToSign(e){return 0===e?1:-1}_getTargetOpacity(e){return 0===e?1:0}}export{i as GaussianSplatFadeHelper};
2
+ import{signal as e}from"../../../../core/signal.js";class i{static{this.fadeInEase=e=>e*(2-e)}static{this.fadeOutEase=e=>e*e}constructor(i){this.layerView=i,this._numFadingTiles=e(0),this._tmpFullyFadedOutTiles=new Array}get numFadingTiles(){return this._numFadingTiles.value}fadeTile(e,i){const t=this._getTargetOpacity(i);if(e.fadeDirection=i,0===this.fadeDuration)return void this._instantTileFading(e,t);const a=e.opacityModifier;if(a!==t){const i=1-Math.abs(t-a);this._startTileFading(e,i)}else this._stopTileFading(e)}updateAllTileFading(e){const i=this._tmpFullyFadedOutTiles;i.length=0,this.layerView.tileHandles.forEach(t=>{this._updateTileFading(t,e)&&i.push(t)});i.length>0&&(this.layerView.updateGaussians(),this.layerView.notifyTileObbsChanged(i)),this._numFadingTiles.value>0&&this.layerView.view.stage?.renderView.requestRender(2)}onFadeDurationChanged(e){0===e&&this.numFadingTiles>0&&this._instantlyFullyFadeAllTiles()}isTileFadingOut(e){return null!=e.fadeProgress&&1===e.fadeDirection}onTileDiscarded(e){null!=e.fadeProgress&&this._numFadingTiles.value--}get updating(){return this._numFadingTiles.value>0}get fadeDuration(){return this.layerView.view.qualitySettings.fadeDuration}get fadingEnabled(){return 0!==this.fadeDuration}_startTileFading(e,i){null==e.fadeProgress&&this._numFadingTiles.value++,e.fadeProgress=i}_stopTileFading(e){null!=e.fadeProgress&&(1===e.fadeDirection&&this._onTileFullyFadedOut(e),this._numFadingTiles.value--,e.fadeProgress=null)}_updateTileFading(e,t){const{fadeProgress:a,fadeDirection:s}=e;if(null==a)return!1;const n=this._fadeDirectionToSign(s),l=n*this.fadeDuration,d=this._getTargetOpacity(s),r=t/Math.abs(l||1),u=Math.min(a+r,1),o=n*(1-(0===s?i.fadeInEase:i.fadeOutEase)(u)),g=1===u;if(e.opacityModifier=g?d:d-o,g){const i=1===s;return this._stopTileFading(e),this._updateOpacityModifier(e),i}return e.fadeProgress=u,this._updateOpacityModifier(e),!1}_updateOpacityModifier(e){const i=255*e.opacityModifier;for(let t=0;t<e.pageIds.length;t++){const a=e.pageIds[t];this.layerView.data.fadingTexture.updateBuffer(i,a)}}_instantTileFading(e,i){e.fadeProgress=null,e.opacityModifier=i,this._updateOpacityModifier(e),1===e.fadeDirection&&this._onTileFullyFadedOut(e)}_instantlyFullyFadeAllTiles(){const e=this._tmpFullyFadedOutTiles;e.length=0,this.layerView.tileHandles.forEach(i=>{if(null!=i.fadeProgress){const t=1===i.fadeDirection;this._instantTileFading(i,this._getTargetOpacity(i.fadeDirection)),t&&e.push(i)}});e.length>0&&(this.layerView.updateGaussians(),this.layerView.notifyTileObbsChanged(e)),this._numFadingTiles.value=0}_onTileFullyFadedOut(e){e.lifecycleState=0,this.layerView.moveTileToCache(e)}_fadeDirectionToSign(e){return 0===e?1:-1}_getTargetOpacity(e){return 0===e?1:0}}export{i as GaussianSplatFadeHelper};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{subtract as t,length as i,scale as n,negate as e,dot as s,set as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as r,fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as a}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{intersects as c,contains as u}from"../../../../geometry/support/aaBoundingBox.js";import{create as d}from"../../../../geometry/support/plane.js";import{fromPoints as m}from"../../../../geometry/support/ray.js";import{GaussianSplatTarget as f}from"../../layers/i3s/Intersector.js";import{ElevationRange as p}from"../ElevationRange.js";import{IntersectorResult as h}from"../../webgl-engine/lib/IntersectorResult.js";class g{constructor(t){this.layerView=t,this.type=0,this.slicePlaneEnabled=!1,this.isGround=!1,this.intersectionNormal=r(),this.intersectionRayDir=r(),this.intersectionPlane=d(),this.layerViewUid=t.uid}intersect(r,d,p,g){const{intersectionRayDir:b,intersectionPlane:V,layerViewUid:x,intersectionNormal:j}=this,v=m(p,g);t(b,g,p);const R=1/i(b);n(b,b,R),e(j,b),a(V,b[0],b[1],b[2],-s(b,p));const E=new y,P=new y,I=r.options.store,U=2===I,B=0!==I,D=U?new Array:null,A=(t,i,n,e,s)=>(t.point=t.point?o(t.point,n,e,s):l(n,e,s),t.dist=i,t.normal=j,t.layerViewUid=x,t),N=p[0],S=p[1],T=p[2],q=b[0],G=b[1],X=b[2],Y=this.layerView.clippingBox;this.layerView.data.forEachTile(t=>{let i=!1;if(null!=Y){const n=t.boundingBox;if(null==n)return;if(!c(n,Y))return;i=!u(Y,n)}const n=t.obb.minimumDistancePlane(V),e=t.obb.maximumDistancePlane(V),s=e<0,o=!B&&null!=E.dist&&E.dist<n*R,r=null!=E.dist&&null!=P.dist&&E.dist<n*R&&P.dist>e*R;if(s||o||r)return;if(!t.boundingVolumeIntersectsRay(p,b))return;const{relativePositions:l,squaredScales:a,gaussianAtlasIndices:m,obb:f}=t,h=f.centerX,w=f.centerY,x=f.centerZ,j=N-h,v=S-w,I=T-x,Z=m.length;if(i)for(let c=0,u=0;c<Z;c++,u+=3){const t=l[u]+h,i=l[u+1]+w,n=l[u+2]+x;if(t<Y[0]||i<Y[1]||n<Y[2]||t>Y[3]||i>Y[4]||n>Y[5])continue;const e=t-N,s=i-S,o=n-T,r=e*q+s*G+o*X;if(r<0)continue;if(e*e+s*s+o*o-r*r>a[c])continue;const m=r*R;if((!d||d(p,g,m))&&((null==E.dist||m<E.dist)&&A(E,m,t,i,n),B&&(null==P.dist||m>P.dist)&&A(P,m,t,i,n),U)){const e=new y;D.push(A(e,m,t,i,n))}}else for(let c=0,u=0;c<Z;c++,u+=3){const t=l[u]-j,i=l[u+1]-v,n=l[u+2]-I,e=t*q+i*G+n*X;if(e<0)continue;if(t*t+i*i+n*n-e*e>a[c])continue;const s=e*R;if(!(!d||d(p,g,s)))continue;const o=t+N,r=i+S,m=n+T;if((null==E.dist||s<E.dist)&&A(E,s,o,r,m),B&&(null==P.dist||s>P.dist)&&A(P,s,o,r,m),U){const t=new y;D.push(A(t,s,o,r,m))}}});const Z=(t,i)=>{const{layerViewUid:n}=i,e=new f(i.point,n);t.set(0,e,i.dist,i.normal)};if(w(E)){const t=r.results.min;(null==t.distance||E.dist<t.distance)&&Z(t,E)}if(w(P)&&0!==r.options.store){const t=r.results.max;(null==t.distance||P.dist>t.distance)&&Z(t,P)}if(U&&D?.length)for(const t of D){const i=new h(v);Z(i,t),r.results.all.push(i)}}getElevationRange(t){let i=null;return this.layerView.data.forEachTile(n=>{i?.contains(n.elevationRange)||n.boundingVolumeIntersectsSphere(t)&&(i||(i=new p),i.expandElevationRange(n.elevationRange))}),i||(i=new p(0,0)),i}}function w(t){return null!=t.dist&&null!=t.point}class y{constructor(){this.point=null,this.dist=null,this.normal=null,this.layerViewUid=""}}export{g as GaussianSplatIntersectionHandler};
2
+ import{subtract as t,length as i,scale as n,negate as e,dot as s,set as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as r,fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as a}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{intersects as c,contains as u}from"../../../../geometry/support/aaBoundingBox.js";import{create as d}from"../../../../geometry/support/plane.js";import{fromPoints as m}from"../../../../geometry/support/ray.js";import{GaussianSplatTarget as f}from"../../layers/i3s/Intersector.js";import{ElevationRange as p}from"../ElevationRange.js";import{IntersectorResult as h}from"../../webgl-engine/lib/IntersectorResult.js";class g{constructor(t){this.layerView=t,this.type=0,this.slicePlaneEnabled=!1,this.isGround=!1,this.intersectionNormal=r(),this.intersectionRayDir=r(),this.intersectionPlane=d(),this.layerViewUid=t.uid}intersect(r,d,p,g){const{intersectionRayDir:b,intersectionPlane:V,layerViewUid:x,intersectionNormal:R}=this,j=m(p,g);t(b,g,p);const v=1/i(b);n(b,b,v),e(R,b),a(V,b[0],b[1],b[2],-s(b,p));const E=new y,I=new y,P=r.options.store,U=2===P,B=0!==P,D=U?new Array:null,A=(t,i,n,e,s)=>(t.point=t.point?o(t.point,n,e,s):l(n,e,s),t.dist=i,t.normal=R,t.layerViewUid=x,t),N=p[0],S=p[1],T=p[2],q=b[0],G=b[1],X=b[2],Y=this.layerView.clippingBox;this.layerView.data.forEachTile(t=>{let i=!1;if(null!=Y){const n=t.boundingBox;if(null==n)return;if(!c(n,Y))return;i=!u(Y,n)}const{min:n,max:e}=t.obb.signedDistanceRangePlane(V),s=e<0,o=!B&&null!=E.dist&&E.dist<n*v,r=null!=E.dist&&null!=I.dist&&E.dist<n*v&&I.dist>e*v;if(s||o||r)return;if(!t.boundingVolumeIntersectsRay(p,b))return;const{relativePositions:l,squaredScales:a,gaussianAtlasIndices:m,obb:f}=t,h=f.centerX,w=f.centerY,x=f.centerZ,R=N-h,j=S-w,P=T-x,Z=m.length;if(i)for(let c=0,u=0;c<Z;c++,u+=3){const t=l[u]+h,i=l[u+1]+w,n=l[u+2]+x;if(t<Y[0]||i<Y[1]||n<Y[2]||t>Y[3]||i>Y[4]||n>Y[5])continue;const e=t-N,s=i-S,o=n-T,r=e*q+s*G+o*X;if(r<0)continue;if(e*e+s*s+o*o-r*r>a[c])continue;const m=r*v;if((!d||d(p,g,m))&&((null==E.dist||m<E.dist)&&A(E,m,t,i,n),B&&(null==I.dist||m>I.dist)&&A(I,m,t,i,n),U)){const e=new y;D.push(A(e,m,t,i,n))}}else for(let c=0,u=0;c<Z;c++,u+=3){const t=l[u]-R,i=l[u+1]-j,n=l[u+2]-P,e=t*q+i*G+n*X;if(e<0)continue;if(t*t+i*i+n*n-e*e>a[c])continue;const s=e*v;if(!(!d||d(p,g,s)))continue;const o=t+N,r=i+S,m=n+T;if((null==E.dist||s<E.dist)&&A(E,s,o,r,m),B&&(null==I.dist||s>I.dist)&&A(I,s,o,r,m),U){const t=new y;D.push(A(t,s,o,r,m))}}});const Z=(t,i)=>{const{layerViewUid:n}=i,e=new f(i.point,n);t.set(0,e,i.dist,i.normal)};if(w(E)){const t=r.results.min;(null==t.distance||E.dist<t.distance)&&Z(t,E)}if(w(I)&&0!==r.options.store){const t=r.results.max;(null==t.distance||I.dist>t.distance)&&Z(t,I)}if(U&&D?.length)for(const t of D){const i=new h(j);Z(i,t),r.results.all.push(i)}}getElevationRange(t){let i=null;return this.layerView.data.forEachTile(n=>{i?.contains(n.elevationRange)||n.boundingVolumeIntersectsSphere(t)&&(i||(i=new p),i.expandElevationRange(n.elevationRange))}),i||(i=new p(0,0)),i}}function w(t){return null!=t.dist&&null!=t.point}class y{constructor(){this.point=null,this.dist=null,this.normal=null,this.layerViewUid=""}}export{g as GaussianSplatIntersectionHandler};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{estimateNumberArrayMemory as t}from"../../../../core/memoryEstimations.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as i}from"../../../../geometry/support/aaBoundingBox.js";import{splatPageSizeInU32 as e}from"./GaussianSplatAtlasPages.js";class o{constructor(o,r,n,a,b,h,u,c){this.handle=o,this.obb=r,this.gaussianAtlasIndices=n,this.pageIds=a,this.relativePositions=b,this.squaredScales=h,this.maxScale=u,this.elevationRange=c,this.isVisible=!1,this.fadeDirection=0,this.opacityModifier=0,this.boundingBox=null,this.usedMemory=t(this.gaussianAtlasIndices,this.relativePositions,this.squaredScales)+this.pageIds.length*e*4;const d=s();r.getCenter(d),this._obbCenterX=d[0],this._obbCenterY=d[1],this._obbCenterZ=d[2];const l=r.radius??-1;this._obbRadius=l;const f=l<0?-1:l*l;this._obbRadiusSquared=f;const m=r.halfSize;this._obbShortestHalfsize=m?Math.min(m[0],m[1],m[2]):0;const g=i();r.toAaBoundingBox(g),this.boundingBox=g}boundingVolumeIntersectsRay(t,s){if(!this.obb)return!0;const{_obbCenterX:i,_obbCenterY:e,_obbCenterZ:o}=this,r=i-t[0],n=e-t[1],a=o-t[2],b=r*s[0]+n*s[1]+a*s[2],h=r*r+n*n+a*a-b*b;return(this._obbRadiusSquared<0||h<=this._obbRadiusSquared)&&this.obb.intersectRay(t,s)}boundingVolumeIntersectsSphere(t){const s=this._obbRadius;if(s<0)return!0;const i=t.center,e=t.radius,o=s+e,r=this._obbCenterX-i[0];if(r>o)return!1;const n=this._obbCenterY-i[1];if(n>o)return!1;const a=this._obbCenterZ-i[2];if(a>o)return!1;const b=r*r+n*n+a*a;if(b>o*o)return!1;if(b<=(this._obbShortestHalfsize+e)**2)return!0;return Math.sqrt(b)+s<=e||(this.obb?.intersectSphere(t)??!0)}}export{o as GaussianTile};
2
+ import{estimateNumberArrayMemory as t}from"../../../../core/memoryEstimations.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as e}from"../../../../geometry/support/aaBoundingBox.js";import{splatPageSizeInU32 as i}from"./GaussianSplatAtlasPages.js";class o{constructor(o,r,n,a,b,h,u,c){this.handle=o,this.obb=r,this.gaussianAtlasIndices=n,this.pageIds=a,this.relativePositions=b,this.squaredScales=h,this.maxScale=u,this.elevationRange=c,this.lifecycleState=0,this.fadeDirection=0,this.opacityModifier=0,this.boundingBox=null,this.usedMemory=t(this.gaussianAtlasIndices,this.relativePositions,this.squaredScales)+this.pageIds.length*i*4;const d=s();r.getCenter(d),this._obbCenterX=d[0],this._obbCenterY=d[1],this._obbCenterZ=d[2];const l=r.radius??-1;this._obbRadius=l;const f=l<0?-1:l*l;this._obbRadiusSquared=f;const m=r.halfSize;this._obbShortestHalfsize=m?Math.min(m[0],m[1],m[2]):0;const g=e();r.toAaBoundingBox(g),this.boundingBox=g}boundingVolumeIntersectsRay(t,s){if(!this.obb)return!0;const{_obbCenterX:e,_obbCenterY:i,_obbCenterZ:o}=this,r=e-t[0],n=i-t[1],a=o-t[2],b=r*s[0]+n*s[1]+a*s[2],h=r*r+n*n+a*a-b*b;return(this._obbRadiusSquared<0||h<=this._obbRadiusSquared)&&this.obb.intersectRay(t,s)}boundingVolumeIntersectsSphere(t){const s=this._obbRadius;if(s<0)return!0;const e=t.center,i=t.radius,o=s+i,r=this._obbCenterX-e[0];if(r>o)return!1;const n=this._obbCenterY-e[1];if(n>o)return!1;const a=this._obbCenterZ-e[2];if(a>o)return!1;const b=r*r+n*n+a*a;if(b>o*o)return!1;if(b<=(this._obbShortestHalfsize+i)**2)return!0;return Math.sqrt(b)+s<=i||(this.obb?.intersectSphere(t)??!0)}}export{o as GaussianTile};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{fromQuat as t,scale as e}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as s}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as r,conjugate as i,multiply as n}from"../../../core/libs/gl-matrix-2/math/quat.js";import{IDENTITY as o,create as h}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{set as c,transformQuat as d,dot as f,cross as u,len as l,scale as m,transformMat3 as _,add as g,sub as p,abs as b,max as M,min as j,length as S,scaleAndAdd as z,sign as x,multiply as y}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as C,freeze as q,create as A,UNIT_Z as P}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transformMat4 as Q}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{create as R}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as v}from"../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as w}from"../../../geometry/spatialReferenceEllipsoidUtils.js";import{computeTranslationToOriginAndRotation as D}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as H}from"../../../geometry/projection/projectBuffer.js";import{getProjector as F}from"../../../geometry/projection/projectors.js";import{getNormal as k}from"../../../geometry/support/plane.js";import{isPlateCarree as B}from"../../../geometry/support/spatialReferenceUtils.js";import{sv3d as Z,sq4d as U}from"../../../geometry/support/vectorStacks.js";import{computeOBB as W}from"./dito.js";import{Vertices as X}from"../webgl-engine/lib/Attribute.js";class Y{constructor(t=C,e=pt,a=o){this._data=[t[0],t[1],t[2],e[0],e[1],e[2],a[0],a[1],a[2],a[3]]}clone(){return Y.fromData(this._data)}invalidate(){this._data[3]=-1}get isValid(){return this._data[3]>=0}static fromData(t){const e=new Y;return e._copyFromData(t),e}static fromJSON(t){return new Y(t.center,t.halfSize,t.quaternion)}copy(t){this._copyFromData(t.data)}_copyFromData(t){for(let e=0;e<10;++e)this._data[e]=t[e]}get center(){return c(Z.get(),this._data[0],this._data[1],this._data[2])}get centerX(){return this._data[0]}get centerY(){return this._data[1]}get centerZ(){return this._data[2]}getCenter(t){return t[0]=this._data[0],t[1]=this._data[1],t[2]=this._data[2],t}set center(t){this._data[0]=t[0],this._data[1]=t[1],this._data[2]=t[2]}setCenter(t,e,a){this._data[0]=t,this._data[1]=e,this._data[2]=a}get halfSize(){return c(Z.get(),this._data[3],this._data[4],this._data[5])}get halfSizeX(){return this._data[3]}get halfSizeY(){return this._data[4]}get halfSizeZ(){return this._data[5]}getHalfSize(t){return t[0]=this._data[3],t[1]=this._data[4],t[2]=this._data[5],t}set halfSize(t){this._data[3]=t[0],this._data[4]=t[1],this._data[5]=t[2]}get quaternion(){return r(U.get(),this._data[6],this._data[7],this._data[8],this._data[9])}get quaternionConjugate(){return r(U.get(),-this._data[6],-this._data[7],-this._data[8],this._data[9])}getQuaternion(t){return t[0]=this._data[6],t[1]=this._data[7],t[2]=this._data[8],t[3]=this._data[9],t}getQuaternionConjugate(t){return t[0]=-this._data[6],t[1]=-this._data[7],t[2]=-this._data[8],t[3]=this._data[9],t}set quaternion(t){this._data[6]=t[0],this._data[7]=t[1],this._data[8]=t[2],this._data[9]=t[3]}get data(){return this._data}getCorners(t){const e=this._data,a=r(G,e[6],e[7],e[8],e[9]);for(let s=0;s<8;++s){const r=t[s];r[0]=(1&s?-1:1)*e[3],r[1]=(2&s?-1:1)*e[4],r[2]=(4&s?-1:1)*e[5],d(r,r,a),r[0]+=e[0],r[1]+=e[1],r[2]+=e[2]}return t}getAxes(t){const e=this._data,a=r(G,e[6],e[7],e[8],e[9]);return d(t[0],[1,0,0],a),d(t[1],[0,1,0],a),d(t[2],[0,0,1],a),t}intersectsFrustum(t){const{centerX:e,centerY:a,centerZ:s}=this,r=t.planes;for(const f of r){const t=k(f),r=this.projectedRadius(t);if(e*t[0]+a*t[1]+s*t[2]+f[3]-r>0)return!1}const i=this.getAxes(lt),n=t.points,o=this.halfSize;for(let u=0;u<3;++u){const t=i[u],r=-t[0]*e-t[1]*a-t[2]*s,h=o[u];let c=!0,d=!0;for(const e of n){const a=f(e,t)+r;c&&=a>h,d&&=a<-h}if(c||d)return!1}if(this.getCorners(ut).some(e=>t.intersectsPoint(e)))return!0;const h=jt;for(let f=0;f<3;++f){const t=i[f];h[f]=t[0]*e+t[1]*a+t[2]*s}const c=t=>{for(let e=0;e<3;++e){const a=i[e],s=o[e],r=a[0]*t[0]+a[1]*t[1]+a[2]*t[2]-h[e];if(r>s||r<-s)return!1}return!0};if(t.points.some(t=>c(t)))return!0;const d=t.lines,_=Mt;for(let g=0;g<8;++g){const t=d[g].direction;for(const r of i){u(_,t,r);const i=l(_);if(!(i>0))continue;m(_,_,1/i);const o=this.projectedRadius(_),h=_[0]*e+_[1]*a+_[2]*s,c=h-o,d=h+o;let g=!1,p=!1,b=!0;for(const t of n){const e=f(_,t);if(e>d){if(p){b=!1;break}g=!0}else{if(!(e<c)){b=!1;break}if(g){b=!1;break}p=!0}}if(b)return!1}}return!0}intersectsFrustumConservativeApproximation(t){return this.intersectPlane(t[0])<=0&&this.intersectPlane(t[1])<=0&&this.intersectPlane(t[2])<=0&&this.intersectPlane(t[3])<=0&&this.intersectPlane(t[4])<=0&&this.intersectPlane(t[5])<=0}get radius(){const t=this._data[3],e=this._data[4],a=this._data[5];return Math.sqrt(t*t+e*e+a*a)}intersectsPoint(t){const e=this.getAxes(lt),a=this.halfSize,{center:s}=this;for(let r=0;r<3;++r){const i=e[r],n=a[r],o=f(i,t)-f(i,s);if(o>n||o<-n)return!1}return!0}intersectSphere(t){const{center:e,radius:a}=t,s=this._data,r=s[3],i=s[4],n=s[5],o=r+i+n+a,h=s[0]-e[0];if(Math.abs(h)>o)return!1;const c=s[1]-e[1];if(Math.abs(c)>o)return!1;const d=s[2]-e[2];if(Math.abs(d)>o)return!1;const f=-s[6],u=-s[7],l=-s[8],m=u*d-l*c,_=l*h-f*d,g=f*c-u*h,p=u*g-l*_,b=l*m-f*g,M=f*_-u*m,j=2*s[9],S=Math.abs(h+m*j+2*p),z=Math.abs(c+_*j+2*b),x=Math.abs(d+g*j+2*M),y=S-Math.min(S,r),C=z-Math.min(z,i),q=x-Math.min(x,n);return y*y+C*C+q*q<=a*a}intersectSphereWithMBS(t,e=this.radius){const a=this._data,{center:s,radius:r}=t,i=e+r,n=a[0]-s[0];if(n>i)return!1;const o=a[1]-s[1];if(o>i)return!1;const h=a[2]-s[2];if(h>i)return!1;if(n*n+o*o+h*h>i*i)return!1;const c=-a[6],d=-a[7],f=-a[8],u=d*h-f*o,l=f*n-c*h,m=c*o-d*n,_=d*m-f*l,g=f*u-c*m,p=c*l-d*u,b=2*a[9],M=Math.abs(n+u*b+2*_),j=Math.abs(o+l*b+2*g),S=Math.abs(h+m*b+2*p),z=M-Math.min(M,a[3]),x=j-Math.min(j,a[4]),y=S-Math.min(S,a[5]);return z*z+x*x+y*y<r*r}intersectPlane(t){const e=t[0]*this._data[0]+t[1]*this._data[1]+t[2]*this._data[2]+t[3],a=this.projectedRadius(k(t));return e>a?1:e<-a?-1:0}intersectRay(t,e,a=0){const s=this._data,r=G;r[0]=-s[6],r[1]=-s[7],r[2]=-s[8],r[3]=s[9],E[0]=t[0]-s[0],E[1]=t[1]-s[1],E[2]=t[2]-s[2];const i=d(E,E,G),n=d(I,e,G);let o=-1/0,h=1/0;const c=this.getHalfSize(ct);for(let d=0;d<3;d++){const t=i[d],e=n[d],s=c[d]+a;if(Math.abs(e)>1e-6){const a=(s-t)/e,r=(-s-t)/e;o=Math.max(o,Math.min(a,r)),h=Math.min(h,Math.max(a,r))}else if(t>s||t<-s)return!1}return o<=h}projectedArea(a,s,r,n){const o=this.getQuaternion(O);i(G,o),E[0]=a[0]-this._data[0],E[1]=a[1]-this._data[1],E[2]=a[2]-this._data[2],d(E,E,G);const h=this.getHalfSize(ct),f=E[0]<-h[0]?-1:E[0]>h[0]?1:0,u=E[1]<-h[1]?-1:E[1]>h[1]?1:0,l=E[2]<-h[2]?-1:E[2]>h[2]?1:0,m=Math.abs(f)+Math.abs(u)+Math.abs(l);if(0===m)return 1/0;const p=1===m?4:6,b=6*(f+3*u+9*l+13);t(dt,o),e(dt,dt,h);const M=this.getCenter(ot);for(let t=0;t<p;t++){const e=K[b+t];c(E,((1&e)<<1)-1,(2&e)-1,((4&e)>>1)-1),_(E,E,dt),g(J,M,E),J[3]=1,Q(J,J,s);const a=1/Math.max(1e-6,J[3]);V[2*t]=J[0]*a,V[2*t+1]=J[1]*a}const j=2*p-2;let S=V[0]*(V[3]-V[j+1])+V[j]*(V[1]-V[j-1]);for(let t=2;t<j;t+=2)S+=V[t]*(V[t+3]-V[t-1]);return Math.abs(S)*r*n*.125}projectedRadius(t){const e=this.getQuaternion(O);return i(G,e),d(E,t,G),Math.abs(E[0]*this._data[3])+Math.abs(E[1]*this._data[4])+Math.abs(E[2]*this._data[5])}minimumDistancePlane(t){return t[0]*this._data[0]+t[1]*this._data[1]+t[2]*this._data[2]+t[3]-this.projectedRadius(k(t))}maximumDistancePlane(t){return t[0]*this._data[0]+t[1]*this._data[1]+t[2]*this._data[2]+t[3]+this.projectedRadius(k(t))}toAaBoundingBox(e){const a=this.getQuaternion(O),s=t(dt,a),r=this._data[3]*Math.abs(s[0])+this._data[4]*Math.abs(s[3])+this._data[5]*Math.abs(s[6]),i=this._data[3]*Math.abs(s[1])+this._data[4]*Math.abs(s[4])+this._data[5]*Math.abs(s[7]),n=this._data[3]*Math.abs(s[2])+this._data[4]*Math.abs(s[5])+this._data[5]*Math.abs(s[8]);e[0]=this._data[0]-r,e[1]=this._data[1]-i,e[2]=this._data[2]-n,e[3]=this._data[0]+r,e[4]=this._data[1]+i,e[5]=this._data[2]+n}transform(t,e,a,s=0,r=w(a),i=w(e),n=F(e,i)){if(a===r)e.isGeographic?st(this,t,e,s,i):at(this,t,e,s,i,n);else if(e.isGeographic&&(a.isWebMercator||B(a)))$(e,this,a,t,s);else if(e.isWebMercator&&B(a))tt(e,this,a,t,s);else{const r=this.getCenter(ot);r[2]+=s,H(r,e,0,r,a,0),t.center=r,this!==t&&(t.quaternion=this.getQuaternion(O),t.halfSize=this.getHalfSize(ct))}}}const G=h(),O=h(),T=h(),E=A(),I=A(),J=R();function N(t,e=new Y){return W(t,e),e}const V=[.1,.2,.3,.4,.5,.6,.7,.8,.9,1,1.1,1.2],K=(()=>{const t=new Int8Array(162);let e=0;const a=a=>{for(let s=0;s<a.length;s++)t[e+s]=a[s];e+=6};return a([6,2,3,1,5,4]),a([0,2,3,1,5,4]),a([0,2,3,7,5,4]),a([0,1,3,2,6,4]),a([0,1,3,2,0,0]),a([0,1,5,7,3,2]),a([0,1,3,7,6,4]),a([0,1,3,7,6,2]),a([0,1,5,7,6,2]),a([0,1,5,4,6,2]),a([0,1,5,4,0,0]),a([0,1,3,7,5,4]),a([0,2,6,4,0,0]),a([0,0,0,0,0,0]),a([1,3,7,5,0,0]),a([2,3,7,6,4,0]),a([2,3,7,6,0,0]),a([2,3,1,5,7,6]),a([0,1,5,7,6,2]),a([0,1,5,7,6,4]),a([0,1,3,7,6,4]),a([4,5,7,6,2,0]),a([4,5,7,6,0,0]),a([4,5,1,3,7,6]),a([0,2,3,7,5,4]),a([6,2,3,7,5,4]),a([6,2,3,1,5,4]),t})();function L(t,e,a,s,r){const n=t.getQuaternion(O);r.quaternion=n,i(G,n);const o=t.getCenter(ot),h=t.getHalfSize(ct);if(1===s){d(mt,o,G),b(_t,mt),j(gt,_t,h),p(gt,_t,gt);const s=S(gt);g(gt,_t,h);const i=S(gt);if(s<a)r.center=o,c(mt,a,a,a),r.halfSize=g(mt,h,mt);else{const n=i>0?1+e/i:1,o=s>0?1+a/s:1,c=(o+n)/2,f=(o-n)/2;m(gt,_t,f),r.halfSize=z(gt,gt,h,c),m(gt,_t,c),z(gt,gt,h,f),x(mt,mt),y(mt,gt,mt);const u=t.getQuaternion(T);r.center=d(mt,mt,u)}}else{r.center=z(mt,o,P,(a+e)/2);const t=d(mt,P,G);b(t,t),r.halfSize=z(_t,h,t,(a-e)/2)}return r}function $(t,e,a,s,r){e.getCenter(ot),ot[2]+=r;const i=w(a);H(ot,t,0,ot,i,0),et(i,e,ot,a,s)}function tt(t,e,a,s,r){e.getCenter(ot),ot[2]+=r,et(t,e,ot,a,s)}function et(e,a,s,r,i){const n=a.getQuaternion(O),o=t(dt,n),h=a.getHalfSize(ct);for(let t=0;t<8;++t){for(let e=0;e<3;++e)nt[e]=h[e]*(t&1<<e?-1:1);for(let e=0;e<3;++e){let a=s[e];for(let t=0;t<3;++t)a+=nt[t]*o[3*t+e];rt[3*t+e]=a}}H(rt,e,0,rt,r,0,8),N(it,i)}function at(t,e,a,s,r=w(a),o=F(a,r)){t.getCorners(ut),t.getCenter(nt),nt[2]+=s,D(a,nt,ft,r),e.setCenter(ft[12],ft[13],ft[14]);const h=2*Math.sqrt(1+ft[0]+ft[5]+ft[10]);G[0]=(ft[6]-ft[9])/h,G[1]=(ft[8]-ft[2])/h,G[2]=(ft[1]-ft[4])/h,G[3]=.25*h;const f=t.getQuaternion(O);e.quaternion=n(G,G,f),i(G,G),c(_t,0,0,0);const u=e.getCenter(ht);for(const i of ut)i[2]+=s,o(i,0,i,0),p(mt,i,u),d(mt,mt,G),b(mt,mt),M(_t,_t,mt);e.halfSize=_t}function st(t,e,a,s,r=w(a)){const n=v(a),o=1+Math.max(0,s)/(n.radius+t.centerZ);t.getCenter(nt),nt[2]+=s,H(nt,a,0,nt,r,0),e.center=nt;const h=t.getQuaternion(O);e.quaternion=h,i(G,h),c(mt,0,0,1),d(mt,mt,G);const f=t.getHalfSize(ct);c(mt,f[0]*Math.abs(mt[0]),f[1]*Math.abs(mt[1]),f[2]*Math.abs(mt[2])),m(mt,mt,n.inverseFlattening),g(mt,f,mt),e.halfSize=m(mt,mt,o)}const rt=new Array(24),it=new X(rt,3),nt=A(),ot=A(),ht=A(),ct=A(),dt=a(),ft=s(),ut=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],lt=[A(),A(),A()],mt=A(),_t=A(),gt=A(),pt=q(-1,-1,-1);function bt(t){return Array.from(t)}const Mt=A(),jt=[0,0,0];export{Y as Obb,N as compute,L as computeOffsetObb,bt as ensurePackedObbData};
2
+ import{fromQuat as t,scale as e}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as s}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as r,conjugate as i,multiply as n}from"../../../core/libs/gl-matrix-2/math/quat.js";import{IDENTITY as o,create as h}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{set as c,transformQuat as f,dot as d,cross as u,len as l,scale as m,transformMat3 as _,add as g,transformQuatValues as p,sub as b,abs as M,max as j,min as S,length as z,scaleAndAdd as x,sign as y,multiply as C}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as q,freeze as A,create as P,UNIT_Z as R}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transformMat4 as Q}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{create as v}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as w}from"../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as D}from"../../../geometry/spatialReferenceEllipsoidUtils.js";import{computeTranslationToOriginAndRotation as H}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as F}from"../../../geometry/projection/projectBuffer.js";import{getProjector as k}from"../../../geometry/projection/projectors.js";import{getNormal as B}from"../../../geometry/support/plane.js";import{isPlateCarree as Z}from"../../../geometry/support/spatialReferenceUtils.js";import{sv3d as U,sq4d as W}from"../../../geometry/support/vectorStacks.js";import{computeOBB as X}from"./dito.js";import{Vertices as Y}from"../webgl-engine/lib/Attribute.js";class G{constructor(t=q,e=bt,a=o){this._data=[t[0],t[1],t[2],e[0],e[1],e[2],a[0],a[1],a[2],a[3]]}clone(){return G.fromData(this._data)}invalidate(){this._data[3]=-1}get isValid(){return this._data[3]>=0}static fromData(t){const e=new G;return e._copyFromData(t),e}static fromJSON(t){return new G(t.center,t.halfSize,t.quaternion)}copy(t){this._copyFromData(t.data)}_copyFromData(t){for(let e=0;e<10;++e)this._data[e]=t[e]}get center(){return c(U.get(),this._data[0],this._data[1],this._data[2])}get centerX(){return this._data[0]}get centerY(){return this._data[1]}get centerZ(){return this._data[2]}getCenter(t){return t[0]=this._data[0],t[1]=this._data[1],t[2]=this._data[2],t}set center(t){this._data[0]=t[0],this._data[1]=t[1],this._data[2]=t[2]}setCenter(t,e,a){this._data[0]=t,this._data[1]=e,this._data[2]=a}get halfSize(){return c(U.get(),this._data[3],this._data[4],this._data[5])}get halfSizeX(){return this._data[3]}get halfSizeY(){return this._data[4]}get halfSizeZ(){return this._data[5]}getHalfSize(t){return t[0]=this._data[3],t[1]=this._data[4],t[2]=this._data[5],t}set halfSize(t){this._data[3]=t[0],this._data[4]=t[1],this._data[5]=t[2]}get quaternion(){return r(W.get(),this._data[6],this._data[7],this._data[8],this._data[9])}get quaternionConjugate(){return r(W.get(),-this._data[6],-this._data[7],-this._data[8],this._data[9])}getQuaternion(t){return t[0]=this._data[6],t[1]=this._data[7],t[2]=this._data[8],t[3]=this._data[9],t}getQuaternionConjugate(t){return t[0]=-this._data[6],t[1]=-this._data[7],t[2]=-this._data[8],t[3]=this._data[9],t}set quaternion(t){this._data[6]=t[0],this._data[7]=t[1],this._data[8]=t[2],this._data[9]=t[3]}get data(){return this._data}getCorners(t){const e=this._data,a=r(O,e[6],e[7],e[8],e[9]);for(let s=0;s<8;++s){const r=t[s];r[0]=(1&s?-1:1)*e[3],r[1]=(2&s?-1:1)*e[4],r[2]=(4&s?-1:1)*e[5],f(r,r,a),r[0]+=e[0],r[1]+=e[1],r[2]+=e[2]}return t}getAxes(t){const e=this._data,a=r(O,e[6],e[7],e[8],e[9]);return f(t[0],[1,0,0],a),f(t[1],[0,1,0],a),f(t[2],[0,0,1],a),t}intersectsFrustum(t){const{centerX:e,centerY:a,centerZ:s}=this,r=t.planes;for(const d of r){const t=B(d),r=this.projectedRadius(t);if(e*t[0]+a*t[1]+s*t[2]+d[3]-r>0)return!1}const i=this.getAxes(mt),n=t.points,o=this.halfSize;for(let u=0;u<3;++u){const t=i[u],r=-t[0]*e-t[1]*a-t[2]*s,h=o[u];let c=!0,f=!0;for(const e of n){const a=d(e,t)+r;c&&=a>h,f&&=a<-h}if(c||f)return!1}if(this.getCorners(lt).some(e=>t.intersectsPoint(e)))return!0;const h=St;for(let d=0;d<3;++d){const t=i[d];h[d]=t[0]*e+t[1]*a+t[2]*s}const c=t=>{for(let e=0;e<3;++e){const a=i[e],s=o[e],r=a[0]*t[0]+a[1]*t[1]+a[2]*t[2]-h[e];if(r>s||r<-s)return!1}return!0};if(t.points.some(t=>c(t)))return!0;const f=t.lines,_=jt;for(let g=0;g<8;++g){const t=f[g].direction;for(const r of i){u(_,t,r);const i=l(_);if(!(i>0))continue;m(_,_,1/i);const o=this.projectedRadius(_),h=_[0]*e+_[1]*a+_[2]*s,c=h-o,f=h+o;let g=!1,p=!1,b=!0;for(const t of n){const e=d(_,t);if(e>f){if(p){b=!1;break}g=!0}else{if(!(e<c)){b=!1;break}if(g){b=!1;break}p=!0}}if(b)return!1}}return!0}intersectsFrustumConservativeApproximation(t){return this.intersectPlane(t[0])<=0&&this.intersectPlane(t[1])<=0&&this.intersectPlane(t[2])<=0&&this.intersectPlane(t[3])<=0&&this.intersectPlane(t[4])<=0&&this.intersectPlane(t[5])<=0}get radius(){const t=this._data[3],e=this._data[4],a=this._data[5];return Math.sqrt(t*t+e*e+a*a)}intersectsPoint(t){const e=this.getAxes(mt),a=this.halfSize,{center:s}=this;for(let r=0;r<3;++r){const i=e[r],n=a[r],o=d(i,t)-d(i,s);if(o>n||o<-n)return!1}return!0}intersectSphere(t){const{center:e,radius:a}=t,s=this._data,r=s[3],i=s[4],n=s[5],o=r+i+n+a,h=s[0]-e[0];if(Math.abs(h)>o)return!1;const c=s[1]-e[1];if(Math.abs(c)>o)return!1;const f=s[2]-e[2];if(Math.abs(f)>o)return!1;const d=-s[6],u=-s[7],l=-s[8],m=u*f-l*c,_=l*h-d*f,g=d*c-u*h,p=u*g-l*_,b=l*m-d*g,M=d*_-u*m,j=2*s[9],S=Math.abs(h+m*j+2*p),z=Math.abs(c+_*j+2*b),x=Math.abs(f+g*j+2*M),y=S-Math.min(S,r),C=z-Math.min(z,i),q=x-Math.min(x,n);return y*y+C*C+q*q<=a*a}intersectSphereWithMBS(t,e=this.radius){const a=this._data,{center:s,radius:r}=t,i=e+r,n=a[0]-s[0];if(n>i)return!1;const o=a[1]-s[1];if(o>i)return!1;const h=a[2]-s[2];if(h>i)return!1;if(n*n+o*o+h*h>i*i)return!1;const c=-a[6],f=-a[7],d=-a[8],u=f*h-d*o,l=d*n-c*h,m=c*o-f*n,_=f*m-d*l,g=d*u-c*m,p=c*l-f*u,b=2*a[9],M=Math.abs(n+u*b+2*_),j=Math.abs(o+l*b+2*g),S=Math.abs(h+m*b+2*p),z=M-Math.min(M,a[3]),x=j-Math.min(j,a[4]),y=S-Math.min(S,a[5]);return z*z+x*x+y*y<r*r}intersectPlane(t){const e=t[0]*this._data[0]+t[1]*this._data[1]+t[2]*this._data[2]+t[3],a=this.projectedRadius(B(t));return e>a?1:e<-a?-1:0}intersectRay(t,e,a=0){const s=this._data,r=O;r[0]=-s[6],r[1]=-s[7],r[2]=-s[8],r[3]=s[9],I[0]=t[0]-s[0],I[1]=t[1]-s[1],I[2]=t[2]-s[2];const i=f(I,I,O),n=f(J,e,O);let o=-1/0,h=1/0;const c=this.getHalfSize(ft);for(let f=0;f<3;f++){const t=i[f],e=n[f],s=c[f]+a;if(Math.abs(e)>1e-6){const a=(s-t)/e,r=(-s-t)/e;o=Math.max(o,Math.min(a,r)),h=Math.min(h,Math.max(a,r))}else if(t>s||t<-s)return!1}return o<=h}projectedArea(a,s,r,n){const o=this.getQuaternion(T);i(O,o),I[0]=a[0]-this._data[0],I[1]=a[1]-this._data[1],I[2]=a[2]-this._data[2],f(I,I,O);const h=this.getHalfSize(ft),d=I[0]<-h[0]?-1:I[0]>h[0]?1:0,u=I[1]<-h[1]?-1:I[1]>h[1]?1:0,l=I[2]<-h[2]?-1:I[2]>h[2]?1:0,m=Math.abs(d)+Math.abs(u)+Math.abs(l);if(0===m)return 1/0;const p=1===m?4:6,b=6*(d+3*u+9*l+13);t(dt,o),e(dt,dt,h);const M=this.getCenter(ht);for(let t=0;t<p;t++){const e=L[b+t];c(I,((1&e)<<1)-1,(2&e)-1,((4&e)>>1)-1),_(I,I,dt),g(N,M,I),N[3]=1,Q(N,N,s);const a=1/Math.max(1e-6,N[3]);K[2*t]=N[0]*a,K[2*t+1]=N[1]*a}const j=2*p-2;let S=K[0]*(K[3]-K[j+1])+K[j]*(K[1]-K[j-1]);for(let t=2;t<j;t+=2)S+=K[t]*(K[t+3]-K[t-1]);return Math.abs(S)*r*n*.125}projectedRadius(t){const e=this._data;return p(I,t,-e[6],-e[7],-e[8],e[9]),Math.abs(I[0]*e[3])+Math.abs(I[1]*e[4])+Math.abs(I[2]*e[5])}signedDistancePlane(t,e){const a=this._data,s=t[0]*a[0]+t[1]*a[1]+t[2]*a[2]+e,r=this.projectedRadius(t);return s>r?s-r:s<-r?s+r:0}signedDistanceRangePlane(t){const e=t[0]*this._data[0]+t[1]*this._data[1]+t[2]*this._data[2]+t[3],a=this.projectedRadius(B(t));return{min:e-a,max:e+a}}toAaBoundingBox(e){const a=this.getQuaternion(T),s=t(dt,a),r=this._data[3]*Math.abs(s[0])+this._data[4]*Math.abs(s[3])+this._data[5]*Math.abs(s[6]),i=this._data[3]*Math.abs(s[1])+this._data[4]*Math.abs(s[4])+this._data[5]*Math.abs(s[7]),n=this._data[3]*Math.abs(s[2])+this._data[4]*Math.abs(s[5])+this._data[5]*Math.abs(s[8]);e[0]=this._data[0]-r,e[1]=this._data[1]-i,e[2]=this._data[2]-n,e[3]=this._data[0]+r,e[4]=this._data[1]+i,e[5]=this._data[2]+n}transform(t,e,a,s=0,r=D(a),i=D(e),n=k(e,i)){if(a===r)e.isGeographic?rt(this,t,e,s,i):st(this,t,e,s,i,n);else if(e.isGeographic&&(a.isWebMercator||Z(a)))tt(e,this,a,t,s);else if(e.isWebMercator&&Z(a))et(e,this,a,t,s);else{const r=this.getCenter(ht);r[2]+=s,F(r,e,0,r,a,0),t.center=r,this!==t&&(t.quaternion=this.getQuaternion(T),t.halfSize=this.getHalfSize(ft))}}}const O=h(),T=h(),E=h(),I=P(),J=P(),N=v();function V(t,e=new G){return X(t,e),e}const K=[.1,.2,.3,.4,.5,.6,.7,.8,.9,1,1.1,1.2],L=(()=>{const t=new Int8Array(162);let e=0;const a=a=>{for(let s=0;s<a.length;s++)t[e+s]=a[s];e+=6};return a([6,2,3,1,5,4]),a([0,2,3,1,5,4]),a([0,2,3,7,5,4]),a([0,1,3,2,6,4]),a([0,1,3,2,0,0]),a([0,1,5,7,3,2]),a([0,1,3,7,6,4]),a([0,1,3,7,6,2]),a([0,1,5,7,6,2]),a([0,1,5,4,6,2]),a([0,1,5,4,0,0]),a([0,1,3,7,5,4]),a([0,2,6,4,0,0]),a([0,0,0,0,0,0]),a([1,3,7,5,0,0]),a([2,3,7,6,4,0]),a([2,3,7,6,0,0]),a([2,3,1,5,7,6]),a([0,1,5,7,6,2]),a([0,1,5,7,6,4]),a([0,1,3,7,6,4]),a([4,5,7,6,2,0]),a([4,5,7,6,0,0]),a([4,5,1,3,7,6]),a([0,2,3,7,5,4]),a([6,2,3,7,5,4]),a([6,2,3,1,5,4]),t})();function $(t,e,a,s,r){const n=t.getQuaternion(T);r.quaternion=n,i(O,n);const o=t.getCenter(ht),h=t.getHalfSize(ft);if(1===s){f(_t,o,O),M(gt,_t),S(pt,gt,h),b(pt,gt,pt);const s=z(pt);g(pt,gt,h);const i=z(pt);if(s<a)r.center=o,c(_t,a,a,a),r.halfSize=g(_t,h,_t);else{const n=i>0?1+e/i:1,o=s>0?1+a/s:1,c=(o+n)/2,d=(o-n)/2;m(pt,gt,d),r.halfSize=x(pt,pt,h,c),m(pt,gt,c),x(pt,pt,h,d),y(_t,_t),C(_t,pt,_t);const u=t.getQuaternion(E);r.center=f(_t,_t,u)}}else{r.center=x(_t,o,R,(a+e)/2);const t=f(_t,R,O);M(t,t),r.halfSize=x(gt,h,t,(a-e)/2)}return r}function tt(t,e,a,s,r){e.getCenter(ht),ht[2]+=r;const i=D(a);F(ht,t,0,ht,i,0),at(i,e,ht,a,s)}function et(t,e,a,s,r){e.getCenter(ht),ht[2]+=r,at(t,e,ht,a,s)}function at(e,a,s,r,i){const n=a.getQuaternion(T),o=t(dt,n),h=a.getHalfSize(ft);for(let t=0;t<8;++t){for(let e=0;e<3;++e)ot[e]=h[e]*(t&1<<e?-1:1);for(let e=0;e<3;++e){let a=s[e];for(let t=0;t<3;++t)a+=ot[t]*o[3*t+e];it[3*t+e]=a}}F(it,e,0,it,r,0,8),V(nt,i)}function st(t,e,a,s,r=D(a),o=k(a,r)){t.getCorners(lt),t.getCenter(ot),ot[2]+=s,H(a,ot,ut,r),e.setCenter(ut[12],ut[13],ut[14]);const h=2*Math.sqrt(1+ut[0]+ut[5]+ut[10]);O[0]=(ut[6]-ut[9])/h,O[1]=(ut[8]-ut[2])/h,O[2]=(ut[1]-ut[4])/h,O[3]=.25*h;const d=t.getQuaternion(T);e.quaternion=n(O,O,d),i(O,O),c(gt,0,0,0);const u=e.getCenter(ct);for(const i of lt)i[2]+=s,o(i,0,i,0),b(_t,i,u),f(_t,_t,O),M(_t,_t),j(gt,gt,_t);e.halfSize=gt}function rt(t,e,a,s,r=D(a)){const n=w(a),o=1+Math.max(0,s)/(n.radius+t.centerZ);t.getCenter(ot),ot[2]+=s,F(ot,a,0,ot,r,0),e.center=ot;const h=t.getQuaternion(T);e.quaternion=h,i(O,h),c(_t,0,0,1),f(_t,_t,O);const d=t.getHalfSize(ft);c(_t,d[0]*Math.abs(_t[0]),d[1]*Math.abs(_t[1]),d[2]*Math.abs(_t[2])),m(_t,_t,n.inverseFlattening),g(_t,d,_t),e.halfSize=m(_t,_t,o)}const it=new Array(24),nt=new Y(it,3),ot=P(),ht=P(),ct=P(),ft=P(),dt=a(),ut=s(),lt=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],mt=[P(),P(),P()],_t=P(),gt=P(),pt=P(),bt=A(-1,-1,-1);function Mt(t){return Array.from(t)}const jt=P(),St=[0,0,0];export{G as Obb,V as compute,$ as computeOffsetObb,Mt as ensurePackedObbData};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{MemCachePool as i}from"../../../core/MemCachePool.js";import r from"../../../core/ObjectPool.js";import{watch as s,sync as n}from"../../../core/reactiveUtils.js";import{property as a,subclass as l}from"../../../core/accessorSupport/decorators.js";import{subtract as o,set as c,dot as d}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as h,fromValues as u,create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as g,ZEROS as f}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as p,set as m}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as y}from"../../../geometry/support/buffer/BufferView.js";import{overlayRenderOccludedFlag as b}from"./OverlayRenderer.js";import{PatchRenderData as x}from"./PatchRenderData.js";import{TerrainAttributesCache as T}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as R}from"./terrainUtils.js";import{TileRenderer as v}from"./TileRenderer.js";import{IteratorPreorder as P,fallsWithinLayerView as O,sortTiles as w,compareTiles as D}from"./tileUtils.js";import{getOverlayContentForOutputTerrain as S}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{SyncRenderPlugin as B}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as E}from"../webgl-engine/lib/Attribute.js";import{IntersectorResult as F}from"../webgl-engine/lib/IntersectorResult.js";import{intersectAabbInvDirBefore as j,MeshIntersectionOptions as q,intersectTriangles as C}from"../webgl-engine/lib/RayIntersections.js";import{TriangleIntersectionData as A}from"../webgl-engine/lib/TriangleIntersectionData.js";import{terrainId as M,getVerticalOffsetTerrain as G}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as U}from"../webgl-engine/materials/DrawParameters.js";import{T as k}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as I}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as N}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as L}from"../../webgl/enums.js";const V=7,z=10,H=200,Q=p();let W=class extends B{get visibleTiles(){return Array.from(this._visiblePatchesByOrigin.values()).flat()}get _isGlobal(){return 1===this._stage.viewingMode}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}get renderOccludedFlags(){return this._overlayRenderer.renderOccludedFlags}constructor(e,t,s,n,a){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=s,this._compressionTracker=n,this.type=7,this.isGround=!0,this._passParameters=new k,this._drawParameters=new U,this._renderDataPool=new r(()=>new x),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new P,this._castShadows=!1,this._inViewshed=!1,this._cutFillEnabled=!1,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.produces=new Map([[1,()=>1===this._desiredSlot],[6,()=>6===this._desiredSlot],[8,()=>8===this._desiredSlot],[10,()=>this._produces()&&this.renderOccludedFlags===b]]),this._tileSize=256,this._configuration=new N(1===t.viewingMode),this._tileTextureCache=new i((e,t)=>a.newCache(e,t),"TileTexture"),this.tileGeometryCache=new T(a)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(s(()=>this._overlayRenderer.renderOccludedFlags,()=>this.setNeedsRender(),n))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy(),this._allTiles.prune(),this._tileRenderer=null}get _oitEnabled(){return this._stage.renderer.oitEnabled}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get layerViewUid(){return M}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,32)}reuseTextureFromParent(e){const{parent:t}=e;if(!this._canReuseTextureFromParent(t,e))return!1;const i=g(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,i)??!1}_canReuseTextureFromParent(e,t){if(!e)return!1;const{layerInfo:i,surface:r}=t;for(let s=0;s<i[1].length;s++){const i=r.layerViewByIndex(s,1);if(O(e,i)!==O(t,i))return!1}return!0}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,32===t?0:2),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[0])i.pendingUpdates&=-9;e.resetPendingUpdate(8);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=z-V,i=Math.max(0,Math.floor((e.level-t)/V)*V);if(this._isGlobal&&0===i)return h;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=1){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=1){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=1){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new v(this._rctx,this._tileSize,this._techniques,this._tileTextureCache,this._compressionTracker),this.updateTileBackground()}uninitializeRenderContext(){this._tileRenderer=t(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&0!==this.transparency)return;const s=Z,n=J;o(s,r,i),c(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,l=e.results.max,h=e.results.ground,u=0===e.options.store,_=!!e.results.ground.target,g=G(e.verticalOffset),f=e.tolerance;let p,b=u&&null!=a.distance?a.distance:1/0;const x=e.options,T=x.normalRequired||!x.backfacesTerrain,R=new q(f,!1,T),v=c=>{const _=c.renderData;if(!_?.vao)return;const v=_.geometry;m(Q,v.boundingBox);const P=_.localOrigin;null!=g&&(g.localOrigin=P,g.applyToAabb(Q));const O=Q;if(K[0]=i[0]-P[0],K[1]=i[1]-P[1],K[2]=i[2]-P[2],!j(O,K,n,f,b))return;const w=(e,t,i)=>{e.set(this.type,c,t,i),b=u&&null!=a.distance?a.distance:1/0},D=(n,o,c)=>{if((!T||null!=c)&&n>=0&&(x.backfacesTerrain||d(c,s)<0)&&(x.invisibleTerrain||!x.selectionMode||null==t||t(i,r,n))){if((null==h.distance||n<h.distance)&&w(h,n,c),x.isFiltered)return;2===x.store&&(null==p?(p=new F(e.ray),w(p,n,c),e.results.all.push(p)):n<p.distance&&w(p,n,c)),(null==a.distance||n<a.distance)&&w(a,n,c),0!==x.store&&(null==l.distance||n>l.distance)&&w(l,n,c)}},S=X;o(S,r,P);const{indices:B,indexCount:q}=v,M=v.vertexAttributes,G=M.getField("position",y),U=new E(G.typedBuffer,3,M.stride/4),k=q/3;if(!g&&k>H){const e=c.renderData;e.intersectionData??=new A(B,k,U),e.intersectionData.intersectRay(K,S,R,D)}else C(K,S,0,k,B,U,g,R,D)},P=this._rootTiles;if(null!=P){(()=>{const t=this._tileIterator;t.reset(P);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==g&&!e.intersectsRay(i,s,f,b)||_&&this._useStencilForTile(e)?t.skipSubtree():v(e)})()}}processScaleRangeQueries(e,t){if(!t.done&&e)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}get _desiredSlot(){if(!this._produces())return null;switch(this.transparency){case 0:return 1;case 1:case 2:return this._oitEnabled?8:6;case 3:case 4:return null}}acquireTechniques(e){const{shadowMap:t,viewshedEnabled:i,cutFillEnabled:r,slot:s,hasEmission:n,useFloatBlend:a}=e.bind,l=!!has("enable-feature:terrain-shadows")&&t.enabled;if(l!==this._castShadows&&(this._castShadows=l,this._patchesByOriginDirty=!0),this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),this._cutFillEnabled!==r&&(this._cutFillEnabled=r,this._patchesByOriginDirty=!0),3===this.transparency)return null;if(10===s){if(0===(e.renderOccludedMask&b))return null}else if(s!==this._desiredSlot)return null;const o=this._configuration;switch(o.screenSpaceReflections=o.cloudReflections=o.receiveShadows=o.receiveAmbientOcclusion=o.renderOccluded=o.hasHighlightMixTexture=o.hasEmission=!1,o.overlayMode=this._overlayRenderer.mode,o.useFloatBlend=a.value,e.output){case 0:case 1:case 2:{const{ssr:i,clouds:r,ssao:a}=e.bind;o.screenSpaceReflections=null!=i.lastFrameColor,o.cloudReflections=null!=r.data;const l=10===s;return o.receiveShadows=t.ready&&!l,o.renderOccluded=l,o.receiveAmbientOcclusion=!l&&null!=a,o.hasEmission=n,this._acquireTechnique(e.output)}case 5:case 7:return this._castShadows?this._acquireTechnique(5):null;case 8:return this._inViewshed?this._acquireTechnique(8):null;case 9:return this._cutFillEnabled?this._acquireTechnique(9):null;case 3:case 4:return this._acquireTechnique(e.output);case 11:return this._acquireTechnique(11);case 10:return o.hasHighlightMixTexture=null!=e.bind.highlightMixTexture,this._overlayRenderer.hasHighlights?this._acquireTechnique(10):null}return null}render(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,this._passParameters.overlayContent=S(e.output,e.bind),e.output){case 0:case 1:case 2:return this._renderMaterialPass(e,t);case 3:case 4:case 11:return this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);case 10:{const i=e.bind.highlight?.name;i&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(2)&&this._overlayRenderer.hasHighlight(i)&&this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);break}case 5:case 7:case 8:case 9:return this._renderAuxiliaryPass(e,t,this._allPatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const t=this._tileRenderer;let i;if(null!=e){const t=e.toUnitRGBA();i=u(t[0]||0,t[1]||0,t[2]||0)}t.setBackground(i),this._allTiles.forAll(e=>t.updateTileTexture(e,0)),this._configuration.tileBlendInput=t.backgroundIsGrid?2:null!=t.backgroundColor?1:0,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)w(i,t);e.sort((e,t)=>D(e[0],t[0])),this._visiblePatchesByOrigin=new Map(e.map(e=>[e[0].renderData.localOrigin,e])),this.notifyChange("visibleTiles"),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed||this._cutFillEnabled){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i){const{rctx:r,bind:s}=e;r.bindTechnique(t,s,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;i.forEach(i=>{this._drawParameters.origin=i[0].renderData.localOrigin,t.program.bindDraw(s,this._passParameters,this._drawParameters);for(let r=0;r<i.length;r++)this._renderPatch(e,t,i[r],L.TRIANGLES,n,null===this._passParameters.overlayContent)}),r.bindVAO(null)}_renderMaterialPass(e,t){const{rctx:i,bind:r}=e,s=i.bindTechnique(t,r,this._passParameters);this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const n=10===r.slot;n&&(s.bindTexture("tex",i.emptyTexture),s.setUniform3fv("textureOpacities",h),s.setUniform4fv("texOffsetAndScale",f));const a=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:h;1===this._configuration.tileBlendInput&&s.setUniform3fv("backgroundColor",a);const l=this._stencilEnabledLayerExtents.length>0,o=this.wireframe?L.LINES:L.TRIANGLES;this._configuration.textureFadingEnabled&&s.bindTexture("texNext",i.emptyTexture);const c=this._visiblePatchesByOrigin;for(const d of c.values()){const i=d[0].renderData.localOrigin;this._drawParameters.origin=i,t.program.bindDraw(r,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const r of d){const i=r.renderData,a=i.textureReference;if(null!=a){if(!n){s.setUniform4fv("texOffsetAndScale",a.offsetAndScale),s.bindTexture("tex",a.texture.texture);const e=i.textureFadeFactor,t=e<1?i.nextTextureReference:null;this._configuration.textureFadingEnabled&&t&&e<1?(s.setUniform1f("fadeFactor",e),s.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),s.setUniform3fv("nextTexOpacities",t.opacities),s.bindTexture("texNext",t.texture.texture)):s.setUniform1f("fadeFactor",1),i.textureIsFading&&this.setNeedsRender(2),s.setUniform3fv("textureOpacities",a.opacities)}this._renderPatch(e,t,r,o,l),r.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}i.bindVAO(null)}_renderPatch(e,t,i,r,s,n=!1){const a=i.renderData,l=a.vao,o=l?.indexBuffer;if(!l||null==o)return void(R&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const c=t.program;n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay);const{rctx:d,bind:h}=e;s&&(t.useStencil=this._useStencilForTile(i),d.setPipelineState(t.getPipeline(h)));const u=a.geometry.indexCount;d.bindVAO(l),c.assertCompatibleVertexAttributeLocations(l),d.drawElements(r,u,o.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(I,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([a({readOnly:!0})],W.prototype,"visibleTiles",null),e([a({readOnly:!0})],W.prototype,"_isGlobal",null),e([a()],W.prototype,"renderOccludedFlags",null),e([a({value:!1})],W.prototype,"renderingDisabled",null),e([a({value:!0})],W.prototype,"visible",null),e([a()],W.prototype,"renderPatchBorders",null),e([a()],W.prototype,"wireframe",null),W=e([l("esri.views.3d.terrain.TerrainRenderer")],W);const Z=_(),J=_(),K=_(),X=_();export{W as TerrainRenderer};
2
+ import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{MemCachePool as i}from"../../../core/MemCachePool.js";import r from"../../../core/ObjectPool.js";import{watch as s,sync as n}from"../../../core/reactiveUtils.js";import{property as a,subclass as l}from"../../../core/accessorSupport/decorators.js";import{subtract as o,set as c,dot as d}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as h,fromValues as u,create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as g,ZEROS as f}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as p,set as m}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as y}from"../../../geometry/support/buffer/BufferView.js";import{overlayRenderOccludedFlag as b}from"./OverlayRenderer.js";import{PatchRenderData as x}from"./PatchRenderData.js";import{TerrainAttributesCache as T}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as R}from"./terrainUtils.js";import{TileRenderer as v}from"./TileRenderer.js";import{IteratorPreorder as P,fallsWithinLayerView as O,sortTiles as w,compareTiles as S}from"./tileUtils.js";import{getOverlayContentForOutputTerrain as D}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{SyncRenderPlugin as B}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as E}from"../webgl-engine/lib/Attribute.js";import{IntersectorResult as F}from"../webgl-engine/lib/IntersectorResult.js";import{intersectAabbInvDirBefore as j,MeshIntersectionOptions as q,intersectTriangles as C}from"../webgl-engine/lib/RayIntersections.js";import{TriangleIntersectionData as A}from"../webgl-engine/lib/TriangleIntersectionData.js";import{terrainId as M,getVerticalOffsetTerrain as G}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as U}from"../webgl-engine/materials/DrawParameters.js";import{T as k}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as I}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as N}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as L}from"../../webgl/enums.js";const V=7,z=10,H=200,Q=p();let W=class extends B{get visibleTiles(){return Array.from(this._visiblePatchesByOrigin.values()).flat()}get _isGlobal(){return 1===this._stage.viewingMode}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}get renderOccludedFlags(){return this._overlayRenderer.renderOccludedFlags}constructor(e,t,s,n,a){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=s,this._compressionTracker=n,this.type=7,this.isGround=!0,this._passParameters=new k,this._drawParameters=new U,this._renderDataPool=new r(()=>new x),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new P,this._castShadows=!1,this._inViewshed=!1,this._cutFillEnabled=!1,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.produces=new Map([[1,()=>1===this._desiredSlot],[6,()=>6===this._desiredSlot],[8,()=>8===this._desiredSlot],[10,()=>this._produces()&&this.renderOccludedFlags===b]]),this._tileSize=256,this._configuration=new N(1===t.viewingMode),this._tileTextureCache=new i((e,t)=>a.newCache(e,t),"TileTexture"),this.tileGeometryCache=new T(a)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(s(()=>this._overlayRenderer.renderOccludedFlags,()=>this.setNeedsRender(),n))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy(),this._allTiles.prune(),this._tileRenderer=null}get _oitEnabled(){return this._stage.renderer.oitEnabled}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get layerViewUid(){return M}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,32)}reuseTextureFromParent(e){const{parent:t}=e;if(!this._canReuseTextureFromParent(t,e))return!1;const i=g(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,i)??!1}_canReuseTextureFromParent(e,t){if(!e)return!1;const{layerInfo:i,surface:r}=t;for(let s=0;s<i[1].length;s++){const i=r.layerViewByIndex(s,1);if(O(e,i)!==O(t,i))return!1}return!0}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,32===t?0:2),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[0])i.pendingUpdates&=-9;e.resetPendingUpdate(8);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=z-V,i=Math.max(0,Math.floor((e.level-t)/V)*V);if(this._isGlobal&&0===i)return h;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=1){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=1){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=1){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new v(this._rctx,this._tileSize,this._techniques,this._tileTextureCache,this._compressionTracker),this.updateTileBackground()}uninitializeRenderContext(){this._tileRenderer=t(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&0!==this.transparency)return;const s=Z,n=J;o(s,r,i),c(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,l=e.results.max,h=e.results.ground,u=0===e.options.store,_=!!e.results.ground.target,g=G(e.verticalOffset),f=e.tolerance;let p,b=u&&null!=a.distance?a.distance:1/0;const x=e.options,T=x.normalRequired||!x.backfacesTerrain,R=new q(f,!1,T),v=c=>{const _=c.renderData;if(!_?.vao)return;const v=_.geometry;m(Q,v.boundingBox);const P=_.localOrigin;null!=g&&(g.localOrigin=P,g.applyToAabb(Q));const O=Q;if(K[0]=i[0]-P[0],K[1]=i[1]-P[1],K[2]=i[2]-P[2],!j(O,K,n,f,b))return;const w=(e,t,i)=>{e.set(this.type,c,t,i),b=u&&null!=a.distance?a.distance:1/0},S=(n,o,c)=>{if((!T||null!=o)&&n>=0&&(x.backfacesTerrain||d(o,s)<0)&&(x.invisibleTerrain||!x.selectionMode||null==t||t(i,r,n))){if((null==h.distance||n<h.distance)&&w(h,n,o),x.isFiltered)return;2===x.store&&(null==p?(p=new F(e.ray),w(p,n,o),e.results.all.push(p)):n<p.distance&&w(p,n,o)),(null==a.distance||n<a.distance)&&w(a,n,o),0!==x.store&&(null==l.distance||n>l.distance)&&w(l,n,o)}},D=X;o(D,r,P);const{indices:B,indexCount:q}=v,M=v.vertexAttributes,G=M.getField("position",y),U=new E(G.typedBuffer,3,M.stride/4),k=q/3;if(!g&&k>H){const e=c.renderData;e.intersectionData??=new A(B,k,U),e.intersectionData.intersectRay(K,D,R,S)}else C(K,D,0,k,B,U,g,R,S)},P=this._rootTiles;if(null!=P){(()=>{const t=this._tileIterator;t.reset(P);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==g&&!e.intersectsRay(i,s,f,b)||_&&this._useStencilForTile(e)?t.skipSubtree():v(e)})()}}processScaleRangeQueries(e,t){if(!t.done&&e)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}get _desiredSlot(){if(!this._produces())return null;switch(this.transparency){case 0:return 1;case 1:case 2:return this._oitEnabled?8:6;case 3:case 4:return null}}acquireTechniques(e){const{shadowMap:t,viewshedEnabled:i,cutFillComputationEnabled:r,slot:s,hasEmission:n,useFloatBlend:a}=e.bind,l=!!has("enable-feature:terrain-shadows")&&t.enabled;if(l!==this._castShadows&&(this._castShadows=l,this._patchesByOriginDirty=!0),this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),this._cutFillEnabled!==r&&(this._cutFillEnabled=r,this._patchesByOriginDirty=!0),3===this.transparency)return null;if(10===s){if(0===(e.renderOccludedMask&b))return null}else if(s!==this._desiredSlot)return null;const o=this._configuration;switch(o.screenSpaceReflections=o.cloudReflections=o.receiveShadows=o.receiveAmbientOcclusion=o.renderOccluded=o.hasHighlightMixTexture=o.hasEmission=!1,o.overlayMode=this._overlayRenderer.mode,o.useFloatBlend=a.value,e.output){case 0:case 1:case 2:{const i=e.bind;o.screenSpaceReflections=i.hasScreenSpaceReflections,o.cloudReflections=null!=i.clouds.data;const r=10===s;return o.receiveShadows=t.ready&&!r,o.renderOccluded=r,o.receiveAmbientOcclusion=!r&&null!=i.ssao,o.hasEmission=n,this._acquireTechnique(e.output)}case 5:case 7:return this._castShadows?this._acquireTechnique(5):null;case 8:return this._inViewshed?this._acquireTechnique(8):null;case 9:return this._cutFillEnabled?this._acquireTechnique(9):null;case 3:case 4:return this._acquireTechnique(e.output);case 11:return this._acquireTechnique(11);case 10:return o.hasHighlightMixTexture=null!=e.bind.highlightMixTexture,this._overlayRenderer.hasHighlights?this._acquireTechnique(10):null}return null}render(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,this._passParameters.overlayContent=D(e.output,e.bind),e.output){case 0:case 1:case 2:return this._renderMaterialPass(e,t);case 3:case 4:case 11:return this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);case 10:{const i=e.bind.highlight?.name;i&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(2)&&this._overlayRenderer.hasHighlight(i)&&this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);break}case 5:case 7:case 8:case 9:return this._renderAuxiliaryPass(e,t,this._allPatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const t=this._tileRenderer;let i;if(null!=e){const t=e.toUnitRGBA();i=u(t[0]||0,t[1]||0,t[2]||0)}t.setBackground(i),this._allTiles.forAll(e=>t.updateTileTexture(e,0)),this._configuration.tileBlendInput=t.backgroundIsGrid?2:null!=t.backgroundColor?1:0,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)w(i,t);e.sort((e,t)=>S(e[0],t[0])),this._visiblePatchesByOrigin=new Map(e.map(e=>[e[0].renderData.localOrigin,e])),this.notifyChange("visibleTiles"),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed||this._cutFillEnabled){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i){const{rctx:r,bind:s}=e;r.bindTechnique(t,s,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;i.forEach(i=>{this._drawParameters.origin=i[0].renderData.localOrigin,t.program.bindDraw(s,this._passParameters,this._drawParameters);for(let r=0;r<i.length;r++)this._renderPatch(e,t,i[r],L.TRIANGLES,n,null===this._passParameters.overlayContent)}),r.bindVAO(null)}_renderMaterialPass(e,t){const{rctx:i,bind:r}=e,s=i.bindTechnique(t,r,this._passParameters);this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const n=10===r.slot;n&&(s.bindTexture("tex",i.emptyTexture),s.setUniform3fv("textureOpacities",h),s.setUniform4fv("texOffsetAndScale",f));const a=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:h;1===this._configuration.tileBlendInput&&s.setUniform3fv("backgroundColor",a);const l=this._stencilEnabledLayerExtents.length>0,o=this.wireframe?L.LINES:L.TRIANGLES;this._configuration.textureFadingEnabled&&s.bindTexture("texNext",i.emptyTexture);const c=this._visiblePatchesByOrigin;for(const d of c.values()){const i=d[0].renderData.localOrigin;this._drawParameters.origin=i,t.program.bindDraw(r,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const r of d){const i=r.renderData,a=i.textureReference;if(null!=a){if(!n){s.setUniform4fv("texOffsetAndScale",a.offsetAndScale),s.bindTexture("tex",a.texture.texture);const e=i.textureFadeFactor,t=e<1?i.nextTextureReference:null;this._configuration.textureFadingEnabled&&t&&e<1?(s.setUniform1f("fadeFactor",e),s.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),s.setUniform3fv("nextTexOpacities",t.opacities),s.bindTexture("texNext",t.texture.texture)):s.setUniform1f("fadeFactor",1),i.textureIsFading&&this.setNeedsRender(2),s.setUniform3fv("textureOpacities",a.opacities)}this._renderPatch(e,t,r,o,l),r.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}i.bindVAO(null)}_renderPatch(e,t,i,r,s,n=!1){const a=i.renderData,l=a.vao,o=l?.indexBuffer;if(!l||null==o)return void(R&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const c=t.program;n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay);const{rctx:d,bind:h}=e;s&&(t.useStencil=this._useStencilForTile(i),d.setPipelineState(t.getPipeline(h)));const u=a.geometry.indexCount;d.bindVAO(l),c.assertCompatibleVertexAttributeLocations(l),d.drawElements(r,u,o.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(I,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([a({readOnly:!0})],W.prototype,"visibleTiles",null),e([a({readOnly:!0})],W.prototype,"_isGlobal",null),e([a()],W.prototype,"renderOccludedFlags",null),e([a({value:!1})],W.prototype,"renderingDisabled",null),e([a({value:!0})],W.prototype,"visible",null),e([a()],W.prototype,"renderPatchBorders",null),e([a()],W.prototype,"wireframe",null),W=e([l("esri.views.3d.terrain.TerrainRenderer")],W);const Z=_(),J=_(),K=_(),X=_();export{W as TerrainRenderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{copy as t,sub as e}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as o}from"../../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as s}from"../../../../../geometry/support/DoubleArray.js";import{ComponentObjectElevationAgnosticComponentGeometryBVH as i,intersectTriangleRangeForComponent as a}from"./ComponentObjectElevationAgnosticComponentGeometryBVH.js";import{ElevationAgnosticBVH as r}from"./ElevationAgnosticBVH.js";import{MeshIntersectionOptions as c,computeInvDir as l,intersectAabbInvDir as m}from"../../lib/RayIntersections.js";import{elevationAlignVertexGlobal as h}from"../../lib/triangleIntersectionUtils.js";class p{constructor(t,e,o,s,i,a,c,l){this.vertexData=t,this.vertexStride=e,this.indexData=o,this._componentData=s,this._componentAabbs3D=i,this.geometryMinZ=a,this.planetCenterZ=c,this.localMode=l,this.maxBspNodeDepth=6,this.minElementCountForBVH=10,this.minBspNodeElementCount=3,this._ray0=u,this._ray1=D,this._invDir=n(),this._componentVerticalOffsets=null,this._verticalOffset=null,this._tolerance=0,this._intersectionOptions=y,this._callback=g,this.rayDirectionC=n(),this._componentIndexMap=null,this._bvh=new r(s.count,this),this.componentIntersectionData=new Array(s.count)}get numComponents(){return this._componentData.count}get minZGlobal(){return this.geometryMinZ-this.planetCenterZ}getAabbs2D(){return this.localMode?this.getAabbs2DLocal():this.getAabbs2DGlobal()}getAabbs2DGlobal(){const{numComponents:t,planetCenterZ:e,minZGlobal:n}=this,o=s(4*t),i=this._componentAabbs3D;for(let s=0;s<t;++s){const t=6*s,a=i[t+0],r=i[t+1],c=i[t+2],l=i[t+3],m=i[t+4],h=n/(c-e),p=n/(i[t+5]-e),b=Math.min(a*h,a*p),_=Math.min(r*h,r*p),f=Math.max(l*h,l*p),u=Math.max(m*h,m*p),D=4*s;o[D+0]=b,o[D+1]=_,o[D+2]=f,o[D+3]=u}return o}getAabbs2DLocal(){const{numComponents:t}=this,e=s(4*t),n=this._componentAabbs3D;for(let o=0;o<t;++o){const t=6*o,s=n[t+0],i=n[t+1],a=n[t+3],r=n[t+4],c=4*o;e[c+0]=s,e[c+1]=i,e[c+2]=a,e[c+3]=r}return e}intersectRay(t,e,n,o,s,i){const{isVerticalRay:a}=n;this._ray0=t,this._ray1=e,this._componentVerticalOffsets=s??null,this._verticalOffset=i??null,this._tolerance=n.tolerance,this._intersectionOptions=n,this._componentIndexMap=this._bvh.elementIndexMap,l(t,e,this._invDir),this._callback=o,this._bvh.intersectRay(t,e,a),this._callback=g}intersectRange(t,e){const n=this._componentIndexMap,o=this._componentData;for(let s=t;s<e;++s){const t=n?n[s]:s;o.isPickable(t)&&o.isVisible(t)&&this._intersectComponent(t)}}getComponentTriangleCount(t){const e=this._componentData.offsets,n=e[t]/3;return e[t+1]/3-n}getComponentAabb3D(t,e){const n=this._componentAabbs3D,o=6*t;return e[0]=n[o],e[1]=n[o+1],e[2]=n[o+2],e[3]=n[o+3],e[4]=n[o+4],e[5]=n[o+5],e}_intersectComponent(n){const o=this.getComponentAabb3D(n,b);let s=!1;const{localMode:r,_componentVerticalOffsets:c,_verticalOffset:l,_ray0:p,_ray1:u,_invDir:D,planetCenterZ:g,_tolerance:y,rayDirectionC:v,componentIntersectionData:x}=this,{isVerticalRay:A}=this._intersectionOptions,d=this._componentData.offsets,M=t(_,p),O=t(f,u),j=c?.[n]??0,V=j+(l?.offset??0);if(0!==V&&(r?(M[2]=p[2]-V,O[2]=u[2]-V,s=!0):(null!=l&&(l.componentOffset=j),A&&(h(M,-V,g,p),h(O,-V,g,u),s=!0))),null==l||s||0===V||l.applyToAabb(o),!m(o,M,D,y))return;e(v,O,M);const Z=d[n]/3,I=d[n+1]/3,R=I-Z,B=(t,e,o)=>{this._callback(t,e,n,o)},{vertexData:k,vertexStride:G,indexData:w,_intersectionOptions:E}=this,{normalRequired:H}=E;if(R>C){let t=x[n];null==t&&(t=new i(n,k,G,w,Z,I,this.geometryMinZ,g,r),x[n]=t),t.intersectRay(M,O,A,s?0:V,B,H)}else{a(M,v,Z,I,w,k,G,s?0:V,g,H,B)}}}const b=o(),_=n(),f=n(),u=n(),D=n(),g=()=>{},y=new c,C=40;export{p as ComponentObjectElevationAgnosticComponentBVH};
2
+ import{copy as t,sub as e}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as o}from"../../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as s}from"../../../../../geometry/support/DoubleArray.js";import{ComponentObjectElevationAgnosticComponentGeometryBVH as i,intersectTriangleRangeForComponent as a}from"./ComponentObjectElevationAgnosticComponentGeometryBVH.js";import{ElevationAgnosticBVH as r}from"./ElevationAgnosticBVH.js";import{MeshIntersectionOptions as c,computeInvDir as l,intersectAabbInvDir as m}from"../../lib/RayIntersections.js";import{elevationAlignVertexGlobal as h}from"../../lib/triangleIntersectionUtils.js";class p{constructor(t,e,o,s,i,a,c,l){this.vertexData=t,this.vertexStride=e,this.indexData=o,this._componentData=s,this._componentAabbs3D=i,this.geometryMinZ=a,this.planetCenterZ=c,this.localMode=l,this.maxBspNodeDepth=6,this.minElementCountForBVH=10,this.minBspNodeElementCount=3,this._ray0=u,this._ray1=D,this._invDir=n(),this._componentVerticalOffsets=null,this._verticalOffset=null,this._tolerance=0,this._intersectionOptions=y,this._callback=g,this.rayDirectionC=n(),this._componentIndexMap=null,this._bvh=new r(s.count,this),this.componentIntersectionData=new Array(s.count)}get numComponents(){return this._componentData.count}get minZGlobal(){return this.geometryMinZ-this.planetCenterZ}getAabbs2D(){return this.localMode?this.getAabbs2DLocal():this.getAabbs2DGlobal()}getAabbs2DGlobal(){const{numComponents:t,planetCenterZ:e,minZGlobal:n}=this,o=s(4*t),i=this._componentAabbs3D;for(let s=0;s<t;++s){const t=6*s,a=i[t+0],r=i[t+1],c=i[t+2],l=i[t+3],m=i[t+4],h=n/(c-e),p=n/(i[t+5]-e),b=Math.min(a*h,a*p),_=Math.min(r*h,r*p),f=Math.max(l*h,l*p),u=Math.max(m*h,m*p),D=4*s;o[D+0]=b,o[D+1]=_,o[D+2]=f,o[D+3]=u}return o}getAabbs2DLocal(){const{numComponents:t}=this,e=s(4*t),n=this._componentAabbs3D;for(let o=0;o<t;++o){const t=6*o,s=n[t+0],i=n[t+1],a=n[t+3],r=n[t+4],c=4*o;e[c+0]=s,e[c+1]=i,e[c+2]=a,e[c+3]=r}return e}intersectRay(t,e,n,o,s,i){const{isVerticalRay:a}=n;this._ray0=t,this._ray1=e,this._componentVerticalOffsets=s??null,this._verticalOffset=i??null,this._tolerance=n.tolerance,this._intersectionOptions=n,this._componentIndexMap=this._bvh.elementIndexMap,l(t,e,this._invDir),this._callback=o,this._bvh.intersectRay(t,e,a),this._callback=g}intersectRange(t,e){const n=this._componentIndexMap,o=this._componentData;for(let s=t;s<e;++s){const t=n?n[s]:s;o.isPickable(t)&&o.isVisible(t)&&this._intersectComponent(t)}}getComponentTriangleCount(t){const e=this._componentData.offsets,n=e[t]/3;return e[t+1]/3-n}getComponentAabb3D(t,e){const n=this._componentAabbs3D,o=6*t;return e[0]=n[o],e[1]=n[o+1],e[2]=n[o+2],e[3]=n[o+3],e[4]=n[o+4],e[5]=n[o+5],e}_intersectComponent(n){const o=this.getComponentAabb3D(n,b);let s=!1;const{localMode:r,_componentVerticalOffsets:c,_verticalOffset:l,_ray0:p,_ray1:u,_invDir:D,planetCenterZ:g,_tolerance:y,rayDirectionC:v,componentIntersectionData:x}=this,{isVerticalRay:A}=this._intersectionOptions,d=this._componentData.offsets,M=t(_,p),O=t(f,u),j=c?.[n]??0,V=j+(l?.offset??0);if(0!==V&&(r?(M[2]=p[2]-V,O[2]=u[2]-V,s=!0):(null!=l&&(l.componentOffset=j),A&&(h(M,-V,g,p),h(O,-V,g,u),s=!0))),null==l||s||0===V||l.applyToAabb(o),!m(o,M,D,y))return;e(v,O,M);const Z=d[n]/3,I=d[n+1]/3,R=I-Z,B=(t,e,o)=>this._callback(t,o,n,e),{vertexData:k,vertexStride:G,indexData:w,_intersectionOptions:E}=this,{normalRequired:H}=E;if(R>C){let t=x[n];null==t&&(t=new i(n,k,G,w,Z,I,this.geometryMinZ,g,r),x[n]=t),t.intersectRay(M,O,A,s?0:V,B,H)}else{a(M,v,Z,I,w,k,G,s?0:V,g,H,B)}}}const b=o(),_=n(),f=n(),u=n(),D=n(),g=()=>{},y=new c,C=40;export{p as ComponentObjectElevationAgnosticComponentBVH};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{Vertices as t}from"../../lib/Attribute.js";import{TriangleIntersectionData as n}from"../../lib/TriangleIntersectionData.js";class e{constructor(e,r,s,o,i){this._componentOffsets=i,this._intersectionData=new n(s,o,new t(e,3,r))}intersectRay(t,n,e,s){const o=(t,n,e)=>{const o=r(this._componentOffsets,n);s(t,n,o,e)};this._intersectionData.intersectRay(t,n,e,o)}}function r(t,n){const{length:e}=t;if(0===e||n<t[0])return-1;if(n>t[e-1])return e;let r=0,s=e-1;for(;s-r>1;){const e=Math.round(.5*(r+s));n<=t[e]?s=e:r=e}return r}export{e as ComponentObjectFixedBVH};
2
+ import{Vertices as t}from"../../lib/Attribute.js";import{TriangleIntersectionData as n}from"../../lib/TriangleIntersectionData.js";class e{constructor(e,r,s,o,i){this._componentOffsets=i,this._intersectionData=new n(s,o,new t(e,3,r))}intersectRay(t,n,e,s){const o=(t,n,e)=>{const o=r(this._componentOffsets,e);s(t,e,o,n)};this._intersectionData.intersectRay(t,n,e,o)}}function r(t,n){const{length:e}=t;if(0===e||n<t[0])return-1;if(n>t[e-1])return e;let r=0,s=e-1;for(;s-r>1;){const e=Math.round(.5*(r+s));n<=t[e]?s=e:r=e}return r}export{e as ComponentObjectFixedBVH};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{exactEquals as e}from"../../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as t}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ComponentTechnique as r}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as s}from"./ComponentTechniqueConfiguration.js";import{MaterialBase as i}from"../../../core/material/MaterialBase.js";import{isColor as o}from"../../../core/shaderLibrary/ShaderOutput.js";class a extends i{constructor(e,t,r,i,o){super(),this.parameters=e,this.key=o,this.usePBR=e.usePBR,this.hasParametersFromSource=e.hasParametersFromSource,this.isGround=e.isGround,this.slicePlaneEnabled=e.slicePlaneEnabled,this.isIntegratedMesh=e.isIntegratedMesh,this.applySSAO=e.applySSAO,this.hasEmissions=u(e,r,i),this.materialPass=n(e,r),this._configuration=new s(i),this._initializeMaterialConfiguration(e,t,r,i)}destroy(){}acquireTechnique(e,t,s,i){const o=this._updateConfiguration(t,s);return e.get(r,o,i.layout)}_initializeMaterialConfiguration(e,t,r,s){const i=this._configuration;i.hasMetallicRoughnessTexture=null!=e.metallicRoughnessTexture,i.hasOcclusionTexture=null!=e.occlusionTexture,i.hasNormalTexture=null!=e.normalTexture,i.sphereDepthInterpolate=e.sphereDepthInterpolate&&i.spherical,i.ellipsoidMode=e.ellipsoidMode,i.doubleSidedMode=e.doubleSided?1:0,i.hasColorTexture=null!=e.baseColorTexture,i.cullFace=e.cullFace,i.alphaDiscardMode=e.alphaDiscardMode,i.hasVertexColors=t.hasVertexColors,i.textureCoordinateType=t.textureCoordinateType,i.shadeNormals=t.shadeNormals,i.normalType=t.hasNormals?1:2,i.polygonOffset=e.polygonOffset,i.vertexPositionRotationType=t.vertexPositionRotationType,i.vertexNormalRotationType=t.vertexNormalRotationType,i.componentDataType=r.componentDataType,i.emissionSource=c(e,r,s)}_updateConfiguration(e,t){const r=this._configuration,{identifier:s}=e,i=0===s;r.output=t.output,r.enableOITOffset=t.enableOITOffset,r.hasEmission=t.hasEmission&&i,r.renderOccluded=10===t.slot,r.terrainDepthTest=i&&t.terrainDepthTest,r.cullAboveTerrain=!!i&&t.cullAboveTerrain;const a=this.isIntegratedMesh?d(t)?h(t)?3:2:1:0;r.integratedMeshMode=a,r.pbrMode=3===a?4:this.usePBR?this.hasParametersFromSource?0!==r.shadeNormals&&this.isIntegratedMesh?0:2:1:0,r.hasSlicePlane=null!=t.slicePlane&&this.slicePlaneEnabled,r.isGroundSlice=r.hasSlicePlane&&this.isGround;const{materialPass:n}=this;r.transparent=i&&(1===n||2===n&&e.transparent||4===n)||r.isGroundSlice,r.hasHighlightMixTexture=2===s&&null!=t.highlightMixTexture,r.snowCover=i&&t.snowCover>0,r.vertexDiscardMode=i&&2===n?e.transparent?2:1:0;const l=o(t.output);return r.receiveAmbientOcclusion=l&&this.applySSAO&&!r.renderOccluded&&null!=t.ssao?.getTexture(),r.hasOccludees=l&&t.hasOccludees,r.receiveShadows=l&&t.shadowMap.ready,r.screenSpaceReflections=l&&null!=t.ssr.lastFrameColor,r.cloudReflections=l&&null!=t.clouds.data?.cubeMap?.colorTexture,r}}function n(e,t){const{alphaDiscardMode:r,isIntegratedMesh:s,slicePlaneEnabled:i}=e,{transparent:o,opaqueOverride:a}=t,n=e.opacity<1,l=e.baseColor[3]<1;if(s)return n||i?4:3;if(n)return 1;if(0===a)return 0;if(l||0===r||3===r)return 1;switch(o){case 2:return 0;case 0:return 1;case 1:return 2}}function l(r){return null!=r.emissionTexture||!e(r.emissiveBaseColor,t)}function u(e,t,r){const s=l(e);return r.hasEmissionSupport&&2!==t.emissiveOverride&&(s||2!==t.emissiveSourceOverride)}function c(e,t,r){const s=null!=e.emissionTexture,{emissiveSourceOverride:i}=t,o=1===i,a=2===i,n=u(e,t,r),c=l(e);return n?c?a?s?4:2:o?s?5:7:6:o?7:6:0}function h(e){return null!=e.overlay?.getTexture(3)}function d(e){return null!=e.overlay?.getTexture(1)}export{a as ComponentMaterial,c as calculateEmissionSource,u as calculateHasEmissions,l as calculateHasEmissiveBase,n as computeMaterialPass};
2
+ import{exactEquals as e}from"../../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as t}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ComponentTechnique as r}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as s}from"./ComponentTechniqueConfiguration.js";import{MaterialBase as i}from"../../../core/material/MaterialBase.js";import{isColor as o}from"../../../core/shaderLibrary/ShaderOutput.js";class a extends i{constructor(e,t,r,i,o){super(),this.parameters=e,this.key=o,this.usePBR=e.usePBR,this.hasParametersFromSource=e.hasParametersFromSource,this.isGround=e.isGround,this.slicePlaneEnabled=e.slicePlaneEnabled,this.isIntegratedMesh=e.isIntegratedMesh,this.applySSAO=e.applySSAO,this.hasEmissions=u(e,r,i),this.materialPass=n(e,r),this._configuration=new s(i),this._initializeMaterialConfiguration(e,t,r,i)}destroy(){}acquireTechnique(e,t,s,i){const o=this._updateConfiguration(t,s);return e.get(r,o,i.layout)}_initializeMaterialConfiguration(e,t,r,s){const i=this._configuration;i.hasMetallicRoughnessTexture=null!=e.metallicRoughnessTexture,i.hasOcclusionTexture=null!=e.occlusionTexture,i.hasNormalTexture=null!=e.normalTexture,i.sphereDepthInterpolate=e.sphereDepthInterpolate&&i.spherical,i.ellipsoidMode=e.ellipsoidMode,i.doubleSidedMode=e.doubleSided?1:0,i.hasColorTexture=null!=e.baseColorTexture,i.cullFace=e.cullFace,i.alphaDiscardMode=e.alphaDiscardMode,i.hasVertexColors=t.hasVertexColors,i.textureCoordinateType=t.textureCoordinateType,i.shadeNormals=t.shadeNormals,i.normalType=t.hasNormals?1:2,i.polygonOffset=e.polygonOffset,i.vertexPositionRotationType=t.vertexPositionRotationType,i.vertexNormalRotationType=t.vertexNormalRotationType,i.componentDataType=r.componentDataType,i.emissionSource=c(e,r,s)}_updateConfiguration(e,t){const r=this._configuration,{identifier:s}=e,i=0===s;r.output=t.output,r.enableOITOffset=t.enableOITOffset,r.hasEmission=t.hasEmission&&i,r.renderOccluded=10===t.slot,r.terrainDepthTest=i&&t.terrainDepthTest,r.cullAboveTerrain=!!i&&t.cullAboveTerrain;const a=this.isIntegratedMesh?d(t)?h(t)?3:2:1:0;r.integratedMeshMode=a,r.pbrMode=3===a?4:this.usePBR?this.hasParametersFromSource?0!==r.shadeNormals&&this.isIntegratedMesh?0:2:1:0,r.hasSlicePlane=null!=t.slicePlane&&this.slicePlaneEnabled,r.isGroundSlice=r.hasSlicePlane&&this.isGround;const{materialPass:n}=this;r.transparent=i&&(1===n||2===n&&e.transparent||4===n)||r.isGroundSlice,r.hasHighlightMixTexture=2===s&&null!=t.highlightMixTexture,r.snowCover=i&&t.snowCover>0,r.vertexDiscardMode=i&&2===n?e.transparent?2:1:0;const l=o(t.output);return r.receiveAmbientOcclusion=l&&this.applySSAO&&!r.renderOccluded&&null!=t.ssao?.getTexture(),r.hasOccludees=l&&t.hasOccludees,r.receiveShadows=l&&t.shadowMap.ready,r.screenSpaceReflections=t.hasScreenSpaceReflections,r.cloudReflections=l&&null!=t.clouds.data?.cubeMap?.colorTexture,r}}function n(e,t){const{alphaDiscardMode:r,isIntegratedMesh:s,slicePlaneEnabled:i}=e,{transparent:o,opaqueOverride:a}=t,n=e.opacity<1,l=e.baseColor[3]<1;if(s)return n||i?4:3;if(n)return 1;if(0===a)return 0;if(l||0===r||3===r)return 1;switch(o){case 2:return 0;case 0:return 1;case 1:return 2}}function l(r){return null!=r.emissionTexture||!e(r.emissiveBaseColor,t)}function u(e,t,r){const s=l(e);return r.hasEmissionSupport&&2!==t.emissiveOverride&&(s||2!==t.emissiveSourceOverride)}function c(e,t,r){const s=null!=e.emissionTexture,{emissiveSourceOverride:i}=t,o=1===i,a=2===i,n=u(e,t,r),c=l(e);return n?c?a?s?4:2:o?s?5:7:6:o?7:6:0}function h(e){return null!=e.overlay?.getTexture(3)}function d(e){return null!=e.overlay?.getTexture(1)}export{a as ComponentMaterial,c as calculateEmissionSource,u as calculateHasEmissions,l as calculateHasEmissiveBase,n as computeMaterialPass};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../../core/accessorSupport/decorators.js";import{C as t}from"../../../../../../chunks/ComponentShader.glsl.js";import{isOITColor as i,isOITFrontFace as o}from"../../../core/shaderLibrary/ShaderOutput.js";import{ReloadableShader as n}from"../../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as l}from"../../../core/shaderTechnique/ShaderTechnique.js";import{depthTest as s,blending as a}from"../../../lib/OrderIndependentTransparency.js";import{stencilBaseAllZerosParams as p,stencilWriteMaskOn as d,replaceBitWhenDepthTestPasses as m}from"../../../lib/StencilUtils.js";import{IndexGlLayout as u}from"../../../materials/DefaultLayouts.js";import{oitPolygonOffset as c}from"../../../materials/PolygonOffset.js";import{makePipelineState as h,defaultColorWrite as f,defaultDepthWrite as g,premultipliedAlpha as b,cullingParams as j}from"../../../../../webgl/renderState.js";let P=class extends l{constructor(e,r,i){super(e,r,i.concat(u)),this.shader=new n(t,()=>import("./ComponentShader.glsl.js")),this.ignoreUnused=!0}getPipeline(e){return e.camera.aboveGround||null==this._belowGroundPipeline?super.getPipeline(e):this._belowGroundPipeline}initializePipeline(e){return this._belowGroundPipeline=0===e.integratedMeshMode?null:this._makePipeline(e,!0),this._makePipeline(e,!1)}_makePipeline(e,r){const{integratedMeshMode:t,output:n,transparent:l,cullFace:u,hasOccludees:P,renderOccluded:S}=e,w=0!==t,T=!i(n),O=o(n);let _=j(u);return r&&_&&(_={..._,mode:2304}),h({blending:S?b:l?a(n):null,culling:_,depthTest:S?null:s(n),depthWrite:S||!T&&!O?null:g,colorWrite:f,stencilWrite:!S&&w||P?d:null,stencilTest:w?m(1):P?p:null,polygonOffset:c(e)})}};P=e([r("esri.views.3d.webgl-engine.collections.Component.Material.ComponentTechnique")],P);export{P as ComponentTechnique};
2
+ import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../../core/accessorSupport/decorators.js";import{C as t}from"../../../../../../chunks/ComponentShader.glsl.js";import{isOITColor as i,isOITFrontFace as o}from"../../../core/shaderLibrary/ShaderOutput.js";import{ReloadableShader as n}from"../../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as l}from"../../../core/shaderTechnique/ShaderTechnique.js";import{depthTest as s,blending as a}from"../../../lib/OrderIndependentTransparency.js";import{stencilBaseAllZerosParams as p,stencilWriteMaskOn as d,replaceBitWhenDepthTestPasses as m}from"../../../lib/StencilUtils.js";import{IndexGlLayout as u}from"../../../materials/DefaultLayouts.js";import{polygonOffset as c}from"../../../materials/PolygonOffset.js";import{makePipelineState as h,defaultColorWrite as f,defaultDepthWrite as g,premultipliedAlpha as b,cullingParams as j}from"../../../../../webgl/renderState.js";let P=class extends l{constructor(e,r,i){super(e,r,i.concat(u)),this.shader=new n(t,()=>import("./ComponentShader.glsl.js")),this.ignoreUnused=!0}getPipeline(e){return e.camera.aboveGround||null==this._belowGroundPipeline?super.getPipeline(e):this._belowGroundPipeline}initializePipeline(e){return this._belowGroundPipeline=0===e.integratedMeshMode?null:this._makePipeline(e,!0),this._makePipeline(e,!1)}_makePipeline(e,r){const{integratedMeshMode:t,output:n,transparent:l,cullFace:u,hasOccludees:P,renderOccluded:S}=e,w=0!==t,T=!i(n),O=o(n);let _=j(u);return r&&_&&(_={..._,mode:2304}),h({blending:S?b:l?a(n):null,culling:_,depthTest:S?null:s(n),depthWrite:S||!T&&!O?null:g,colorWrite:f,stencilWrite:!S&&w||P?d:null,stencilTest:w?m(1):P?p:null,polygonOffset:c(e)})}};P=e([r("esri.views.3d.webgl-engine.collections.Component.Material.ComponentTechnique")],P);export{P as ComponentTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- function n(n){return 5===n||6===n||7===n}function r(r){return n(r)||8===r||9===r}function t(n){return b(n)||4===n}function u(n){return 10===n||11===n}function e(n){return i(n)||u(n)}function o(n){return 1===n}function c(n){return 2===n}function f(n){return o(n)||c(n)}function i(n){return 0===n||f(n)}function p(n){return 10===n}function x(n){return i(n)||11===n}function a(n){return i(n)||u(n)}function b(n){return a(n)||d(n)}function d(n){return 3===n}function g(n){return d(n)||r(n)}export{e as is2DGeometryOutput,t as is3DGeometryOutputMRT,i as isColor,b as isColorHighlightOLIDOrDepth,a as isColorHighlightOrOLID,x as isColorOrOLID,d as isDepth,g as isDepthOrShadowLike,p as isHighlight,u as isHighlightOrOLID,f as isOIT,o as isOITColor,c as isOITFrontFace,n as isShadow,r as isShadowLike};
2
+ function n(n){return 5===n||6===n||7===n}function r(r){return n(r)||8===r||9===r}function t(n){return d(n)||4===n}function u(n){return t(n)||r(n)}function e(n){return 10===n||11===n}function o(n){return p(n)||e(n)}function c(n){return 1===n}function f(n){return 2===n}function i(n){return c(n)||f(n)}function p(n){return 0===n||i(n)}function x(n){return 10===n}function a(n){return p(n)||11===n}function b(n){return p(n)||e(n)}function d(n){return b(n)||g(n)}function g(n){return 3===n}function h(n){return g(n)||r(n)}export{o as is2DGeometryOutput,t as is3DGeometry,u as is3DGeometryOrShadowLike,p as isColor,d as isColorHighlightOLIDOrDepth,b as isColorHighlightOrOLID,a as isColorOrOLID,g as isDepth,h as isDepthOrShadowLike,x as isHighlight,e as isHighlightOrOLID,i as isOIT,c as isOITColor,f as isOITFrontFace,n as isShadow,r as isShadowLike};
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{ReadDepth as e}from"../output/ReadDepth.glsl.js";import{Float2BindUniform as t}from"../../shaderModules/Float2BindUniform.js";import{FloatBindUniform as o}from"../../shaderModules/FloatBindUniform.js";import{glsl as r}from"../../shaderModules/glsl.js";import{Matrix4BindUniform as i}from"../../shaderModules/Matrix4BindUniform.js";import{Texture2DBindUniform as a}from"../../shaderModules/Texture2DBindUniform.js";function d(d,n){if(!n.screenSpaceReflections)return;const c=d.fragment;c.include(e),c.uniforms.add(new t("nearFar",e=>e.camera.nearFar),new a("depthMap",e=>e.depth?.attachment),new i("proj",e=>e.camera.projectionMatrix),new o("invResolutionHeight",e=>1/e.camera.height),new i("reprojectionMatrix",e=>e.ssr.reprojectionMatrix)).code.add(r`
2
+ import{ReadDepth as e}from"../output/ReadDepth.glsl.js";import{Float2BindUniform as t}from"../../shaderModules/Float2BindUniform.js";import{FloatBindUniform as o}from"../../shaderModules/FloatBindUniform.js";import{glsl as r}from"../../shaderModules/glsl.js";import{Matrix4BindUniform as i}from"../../shaderModules/Matrix4BindUniform.js";import{Texture2DBindUniform as a}from"../../shaderModules/Texture2DBindUniform.js";function d(d,n){if(!n.screenSpaceReflections)return;const c=d.fragment;c.include(e),c.uniforms.add(new t("nearFar",e=>e.camera.nearFar),new a("depthMap",e=>e.depth?.attachment),new i("proj",e=>e.camera.projectionMatrix),new o("invResolutionHeight",e=>1/e.camera.height),new i("reprojectionMatrix",e=>e.reprojection.matrix)).code.add(r`
3
3
  vec2 reprojectionCoordinate(vec3 projectionCoordinate)
4
4
  {
5
5
  vec4 zw = proj * vec4(0.0, 0.0, -projectionCoordinate.z, 1.0);
@@ -40,7 +40,7 @@ vec3 normalCorrectedClouds = mix(localUp, n, correctionViewingFactor);
40
40
  vec3 reflectedWorld = normalize(reflect(-v, normalCorrectedClouds));`),v.cloudReflections&&u.uniforms.add(new l("cloudsOpacity",e=>e.clouds.opacity)).code.add(d`vec4 cloudsColor = renderClouds(reflectedWorld, position);
41
41
  cloudsColor.a = 1.0 - cloudsColor.a;
42
42
  cloudsColor = pow(cloudsColor, vec4(GAMMA));
43
- cloudsColor *= clamp(fresnelModifier.y * cloudFresnelModifier[0] - cloudFresnelModifier[1], 0.0, 1.0) * cloudsOpacity;`),v.screenSpaceReflections?u.uniforms.add(new c("view",e=>e.camera.viewMatrix),new s("lastFrameColorTexture",e=>e.ssr.lastFrameColor?.getTexture()),new l("fadeFactorSSR",e=>e.ssr.fadeFactor)).code.add(d`vec3 viewDir = normalize(viewPosition);
43
+ cloudsColor *= clamp(fresnelModifier.y * cloudFresnelModifier[0] - cloudFresnelModifier[1], 0.0, 1.0) * cloudsOpacity;`),v.screenSpaceReflections?u.uniforms.add(new c("view",e=>e.camera.viewMatrix),new s("lastFrameColorTexture",e=>e.reprojection.lastFrameColor?.getTexture()),new l("fadeFactorSSR",e=>e.screenSpaceReflections.fadeFactor)).code.add(d`vec3 viewDir = normalize(viewPosition);
44
44
  vec4 viewNormalVectorCoordinate = view * vec4(n, 0.0);
45
45
  vec3 viewNormal = normalize(viewNormalVectorCoordinate.xyz);
46
46
  vec4 viewUp = view * vec4(localUp, 0.0);
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import e from"../../../../../core/Error.js";import"../../../../../core/has.js";import{NestedMap as t}from"../../../../../core/NestedMap.js";import{ShaderTechniqueConfiguration as o}from"./ShaderTechniqueConfiguration.js";class c{constructor(e){this._context=e,this._debug=null,this._precompiling=this._debug?0:1,this._cache=new t}get context(){return this._context}get precompiling(){return this._precompiling}set precompiling(e){this._precompiling=e,0===e&&this.context.rctx.gl.flush()}destroy(){this._cache.forAll(e=>e.destroy()),this._cache.clear(),this._context=null}precompile(e,t=i){++this.precompiling,this.get(e,t),--this.precompiling}get(t,o=i,c){const r=o.key.code;let s=this._cache.get(t,r);if(null==s){if(s=new t(this.context,o,c),this._debug){if(0===this._precompiling){let c=`Uncached shader compile in ${(new Error).stack}\n for configuration\n${o.decode()}`;const n=this._cache.getInner(t);throw n?.size&&(c+="\n\n cached configurations:\n",c+=Array.from(n.values()).map(e=>o.decode(e.key)).sort().join("\n\n")),console.log(c),new e("shader:uncached-compile",c)}this._debug.set(s,new n(o,(new Error).stack))}this._cache.set(t,r,s)}return s}getCompiled(e,t=i,o){const c=this.get(e,t,o);return c.compiled?c:null}frameUpdate(){this._debug&&this._cache.forAll(t=>{if(!t.unused||t.ignoreUnused)return;const o=this._debug?.get(t),c=`Unused shader technique for ${t.declaredClass}\n${o?.configuration.decode(t.key)} \nfrom\n${o?.stack}`;throw console.log(c),new e("shader:unused-precompile",c)})}async reloadAll(){const e=new Array;this._cache.forEach(t=>e.push(r(t))),await Promise.all(e)}}class n{constructor(e,t){this.configuration=e,this.stack=t}}async function r(e){let t=!0;e.forEach(async e=>{await e.reload(t),t=!1})}const i=new o;export{i as NoConfiguration,c as ShaderTechniqueRepository};
2
+ import e from"../../../../../core/Error.js";import"../../../../../core/has.js";import{NestedMap as t}from"../../../../../core/NestedMap.js";import{ShaderTechniqueConfiguration as i}from"./ShaderTechniqueConfiguration.js";class r{constructor(e){this._context=e,this._debug=null,this._precompiling=this._debug?0:1,this._cache=new t,this._frame=0,this._debug&&"stackTraceLimit"in Error&&(Error.stackTraceLimit=50)}destroy(){this._cache.forAll(([e])=>e.destroy()),this._cache.clear(),this._context=null}get context(){return this._context}get precompiling(){return this._precompiling}set precompiling(e){this._precompiling=e,0===e&&this.context.rctx.gl.flush()}precompile(e,t=s){++this.precompiling,this.get(e,t),--this.precompiling}get(t,i=s,r){const c=i.key.code;let n=this._cache.get(t,c)?.[0];if(null==n){if(n=new t(this.context,i,r),this._debug){if(0===this._precompiling){const r=`Uncached ${n.declaredClass} compile in ${(new Error).stack}\n for configuration\n${i.decode()}`+this._debugCachedConfigurations(i,t);throw console.log(r),new e("shader:uncached-compile",r)}this._debug.set(n,new o(i,(new Error).stack))}this._cache.set(t,c,[n,this._frame])}return n}getCompiled(e,t=s,i){++this.precompiling;const r=this.get(e,t,i);return--this.precompiling,r.compiled?r:null}frameUpdate(){this._debug&&(this._cache.forAll(([t])=>{if(!t.unused||t.ignoreUnused)return;const i=this._debug?.get(t),r=`Unused ${t.declaredClass} for\n${i?.configuration.decode(t.key)} \nfrom\n${i?.stack}`;throw console.log(r),new e("shader:unused-precompile",r)}),++this._frame)}async reloadAll(){const e=new Array;this._cache.forEach(t=>e.push(c(t))),await Promise.all(e)}_debugCachedConfigurations(e,t){const i=this._cache.getInner(t);if(i?.size){let t="\n\n cached configurations:\n";return t+=Array.from(i.values()).map(([t,i])=>`at frame ${i}: ${e.decode(t.key)}`).sort().join("\n\n"),t}return""}}class o{constructor(e,t){this.configuration=e,this.stack=t}}async function c(e){let t=!0;e.forEach(async([e])=>{await e.reload(t),t=!1})}const s=new i;export{s as NoConfiguration,r as ShaderTechniqueRepository};