@arcgis/core 4.23.0-next.20220127 → 4.23.0-next.20220128

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 (312) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/0463ba46df855a92b9c0.js +1 -0
  3. package/assets/esri/core/workers/chunks/{e657ba0cab29f05d02da.js → 0cd0a6eef51fc5b9ea61.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{e4896cf85fb2da8a9cc7.js → 17de7a324dfa7f57ad5d.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{c36f84daa7736878418d.js → 197ec52641aed20029c6.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{0317f37b6c8705b363fd.js → 1c733b7db092a2a88ef3.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{9387db408f496e7dd003.js → 214910032945dd2d86b0.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{d835b2a683fcd8aeeed8.js → 27474b007988855bea9d.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{8001b0e514bfffe9d7f8.js → 357033117dfe61eb81ea.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{5948923e07bd1662c24a.js → 37c03cfc19086ce631c6.js} +1 -1
  11. package/assets/esri/core/workers/chunks/3c673495e5f507c4a9e5.js +1 -0
  12. package/assets/esri/core/workers/chunks/44f0c3663b293afbd172.js +1 -0
  13. package/assets/esri/core/workers/chunks/483d5d8593d96d0f0b15.js +1 -0
  14. package/assets/esri/core/workers/chunks/49a1a633bb0d93764aae.js +1 -0
  15. package/assets/esri/core/workers/chunks/{5f1dcb6556820cd0aa31.js → 4be35af7d6babbfe9d84.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{f9ff3eaf4eb324429fbd.js → 5457962a70bd3c557a75.js} +1 -1
  17. package/assets/esri/core/workers/chunks/57856b4a9b8784a69844.js +1 -0
  18. package/assets/esri/core/workers/chunks/{56274b37ff74ca0d68a6.js → 5d11b97b667921d67ae7.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{ba5eb394f098968c22d2.js → 655b55ac0cd533d7e9d7.js} +1 -1
  20. package/assets/esri/core/workers/chunks/7903a3e2e0faff0f86c0.js +1 -0
  21. package/assets/esri/core/workers/chunks/918bb7a7d901544a7367.js +1 -0
  22. package/assets/esri/core/workers/chunks/949b2269457302ffc64b.js +1 -0
  23. package/assets/esri/core/workers/chunks/{601e697dc7414bda128a.js → 952980635afc7ec81804.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{e8741bf421f80213f1d3.js → 9876a1bae350795fab36.js} +1 -1
  25. package/assets/esri/core/workers/chunks/99619fcb772807c74f3b.js +1 -0
  26. package/assets/esri/core/workers/chunks/{3f343f792fd9f44d6f25.js → b3f5e91116112b0b612a.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{4c76146014dc15143ba3.js → be588873c16770ceb9ef.js} +1 -1
  28. package/assets/esri/core/workers/chunks/d1fe53b597351dc58305.js +1 -0
  29. package/assets/esri/core/workers/chunks/{b62e3dccd9f662c0afeb.js → db3c729ce0c0b2690dc9.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{199670a3a564ebe3bd79.js → e218bde41ffbcc5194f5.js} +1 -1
  31. package/assets/esri/core/workers/chunks/e21b211913aefde47e30.js +1 -0
  32. package/assets/esri/core/workers/chunks/{c9cbf8135e95f0f42cd9.js → e287f49184d076af17e2.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{bde1d5b0a7717350986e.js → e4019b63a1fe74e2c842.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{6e6a3c5866e8d8820457.js → eb82ff10cef2bde6e57f.js} +1 -1
  35. package/assets/esri/core/workers/chunks/ebc6f4764b82d4104c65.js +1 -0
  36. package/assets/esri/core/workers/chunks/{842db82733635dbf25cb.js → ee6e0db58dc64410e687.js} +1 -1
  37. package/assets/esri/core/workers/chunks/f0a9f161805fc7a30fc5.js +1 -0
  38. package/assets/esri/core/workers/chunks/ff6abdc72076f3994659.js +981 -0
  39. package/chunks/BlendLayers.glsl.js +2 -2
  40. package/chunks/ChapmanAtmosphere.glsl.js +17 -17
  41. package/chunks/CheckerBoard.glsl.js +3 -3
  42. package/chunks/Clouds.glsl.js +2 -2
  43. package/chunks/CloudsComposition.glsl.js +1 -1
  44. package/chunks/ColorMaterial.glsl.js +12 -12
  45. package/chunks/ComponentShader.glsl.js +3 -3
  46. package/chunks/Compositing.glsl.js +1 -1
  47. package/chunks/DefaultMaterial.glsl.js +33 -33
  48. package/chunks/EdgeShaderProgram.glsl.js +7 -7
  49. package/chunks/Fog.glsl.js +10 -12
  50. package/chunks/HUDMaterial.glsl.js +2 -2
  51. package/chunks/HighlightComposition.glsl.js +5 -5
  52. package/chunks/ImageMaterial.glsl.js +6 -6
  53. package/chunks/LaserlinePath.glsl.js +8 -8
  54. package/chunks/LineCallout.glsl.js +6 -6
  55. package/chunks/MeasurementArrow.glsl.js +1 -1
  56. package/chunks/NativeLine.glsl.js +1 -1
  57. package/chunks/Path.glsl.js +5 -5
  58. package/chunks/Pattern.glsl.js +9 -9
  59. package/chunks/PointRenderer.glsl.js +14 -14
  60. package/chunks/Precipitation.glsl.js +2 -2
  61. package/chunks/RealisticTree.glsl.js +21 -21
  62. package/chunks/RibbonLine.glsl.js +11 -11
  63. package/chunks/SMAA.glsl.js +40 -40
  64. package/chunks/ShadedColorMaterial.glsl.js +12 -12
  65. package/chunks/ShadowCast.glsl.js +6 -6
  66. package/chunks/ShadowHighlight.glsl.js +4 -4
  67. package/chunks/SimpleAtmosphere.glsl.js +3 -3
  68. package/chunks/SlicePlaneMaterial.glsl.js +3 -3
  69. package/chunks/Stars.glsl.js +3 -3
  70. package/chunks/Terrain.glsl.js +11 -11
  71. package/chunks/TextureOnly.glsl.js +2 -2
  72. package/chunks/WaterSurface.glsl.js +5 -5
  73. package/chunks/boundedPlane.js +1 -1
  74. package/core/accessorSupport/watch.js +1 -1
  75. package/core/loadAll.js +1 -1
  76. package/geometry/support/frustum.js +1 -1
  77. package/geometry/support/plane.js +1 -1
  78. package/interfaces.d.ts +204 -10
  79. package/layers/VectorTileLayer.js +1 -1
  80. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  81. package/layers/graphics/featureConversionUtils.js +1 -1
  82. package/layers/support/LayerContingentValuesCache.js +1 -1
  83. package/layers/support/TileInfo.js +1 -1
  84. package/package.json +1 -1
  85. package/smartMapping/statistics/support/predominanceUtils.d.ts +4 -0
  86. package/support/revision.js +1 -1
  87. package/symbols/FillSymbol3DLayer.js +1 -1
  88. package/symbols/IconSymbol3DLayer.js +1 -1
  89. package/symbols/ObjectSymbol3DLayer.js +1 -1
  90. package/symbols/Symbol3D.js +1 -1
  91. package/symbols/WebStyleSymbol.js +1 -1
  92. package/symbols/cim/CIMSymbolRasterizer.js +1 -1
  93. package/symbols/support/IconSymbol3DLayerResource.js +1 -1
  94. package/symbols/support/ObjectSymbol3DLayerResource.js +1 -1
  95. package/symbols/support/Symbol3DAnchorPosition2D.js +1 -1
  96. package/symbols/support/Symbol3DAnchorPosition3D.js +1 -1
  97. package/symbols/support/Symbol3DFillMaterial.js +1 -1
  98. package/symbols/support/Symbol3DIconOutline.js +1 -1
  99. package/symbols/support/Symbol3DOutline.js +1 -1
  100. package/symbols/support/Thumbnail.js +1 -1
  101. package/symbols/support/webStyleSymbolUtils.js +1 -1
  102. package/views/2d/engine/vectorTiles/SchemaHelper.js +1 -1
  103. package/views/3d/environment/ChapmanAtmosphere.glsl.js +1 -1
  104. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  105. package/views/3d/environment/CloudsComposition.glsl.js +1 -1
  106. package/views/3d/environment/CloudsGenerator.js +1 -1
  107. package/views/3d/environment/Fog.glsl.js +1 -1
  108. package/views/3d/environment/Fog.js +1 -1
  109. package/views/3d/environment/PanoramicAtmosphere.js +1 -1
  110. package/views/3d/environment/Precipitation.glsl.js +1 -1
  111. package/views/3d/environment/Precipitation.js +1 -1
  112. package/views/3d/environment/PrecipitationTechnique.js +1 -1
  113. package/views/3d/environment/SimpleAtmosphere.glsl.js +1 -1
  114. package/views/3d/environment/SimpleAtmosphere.js +1 -1
  115. package/views/3d/environment/Stars.glsl.js +1 -1
  116. package/views/3d/environment/Stars.js +1 -1
  117. package/views/3d/interactive/analysisTools/slice/sliceToolUtils.js +1 -1
  118. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  119. package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
  120. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  121. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  122. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  123. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  124. package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
  125. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  126. package/views/3d/layers/I3SMeshView3D.js +1 -1
  127. package/views/3d/layers/VectorTileLayerView3D.js +1 -1
  128. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  129. package/views/3d/layers/graphics/ElevationAligners.js +1 -1
  130. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  131. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  132. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  133. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  134. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  135. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  136. package/views/3d/layers/graphics/graphicUtils.js +1 -1
  137. package/views/3d/layers/graphics/lineUtils.js +1 -1
  138. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  139. package/views/3d/layers/graphics/polygonUtils.js +1 -1
  140. package/views/3d/layers/graphics/symbolComplexity.js +1 -1
  141. package/views/3d/layers/i3s/I3SBinaryReader.js +1 -1
  142. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  143. package/views/3d/layers/support/HeatmapFeatureProcessor.js +5 -0
  144. package/views/3d/layers/support/overlayImageUtils.js +1 -1
  145. package/views/3d/layers/support/patternUtils.js +1 -1
  146. package/views/3d/state/controllers/local/PinchAndPanController.js +1 -1
  147. package/views/3d/support/FrustumExtentIntersection.js +1 -1
  148. package/views/3d/support/LaserLineRenderer.js +1 -1
  149. package/views/3d/support/LaserlinePathData.js +1 -1
  150. package/views/3d/terrain/OverlayRenderer.js +1 -1
  151. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  152. package/views/3d/terrain/TerrainRenderer.js +1 -1
  153. package/views/3d/terrain/TerrainSurface.js +1 -1
  154. package/views/3d/terrain/Tile.js +1 -1
  155. package/views/3d/terrain/terrainUtils.js +1 -1
  156. package/views/3d/terrain/tileUtils.js +1 -1
  157. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  158. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  159. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
  160. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +10 -10
  161. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
  162. package/views/3d/webgl-engine/collections/Component/SourceGeometry.js +1 -1
  163. package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
  164. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  165. package/views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js +2 -2
  166. package/views/3d/webgl-engine/core/shaderLibrary/ScreenSizeScaling.glsl.js +2 -2
  167. package/views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.js +2 -2
  168. package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +2 -2
  169. package/views/3d/webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js +4 -4
  170. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +1 -1
  171. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PositionAttribute.glsl.js +1 -1
  172. package/views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js +1 -1
  173. package/views/3d/webgl-engine/core/shaderLibrary/attributes/SymbolColor.glsl.js +1 -1
  174. package/views/3d/webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js +3 -3
  175. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexColor.glsl.js +1 -1
  176. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexNormal.glsl.js +6 -6
  177. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +12 -12
  178. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexTextureCoordinates.glsl.js +4 -4
  179. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js +1 -1
  180. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +16 -16
  181. package/views/3d/webgl-engine/core/shaderLibrary/default/RealisticTree.glsl.js +1 -1
  182. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +5 -5
  183. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUDOcclusionPass.glsl.js +3 -3
  184. package/views/3d/webgl-engine/core/shaderLibrary/raster/BasicGrid.glsl.js +2 -2
  185. package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeMaterialColor.glsl.js +6 -6
  186. package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeNormalTexture.glsl.js +2 -2
  187. package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeShadingNormal.glsl.js +10 -11
  188. package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +2 -2
  189. package/views/3d/webgl-engine/core/shaderLibrary/shading/MultipassGeometryTest.glsl.js +2 -2
  190. package/views/3d/webgl-engine/core/shaderLibrary/shading/MultipassTerrainTest.glsl.js +2 -2
  191. package/views/3d/webgl-engine/core/shaderLibrary/shading/Normals.glsl.js +6 -6
  192. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadBaseColorTexture.glsl.js +4 -4
  193. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +6 -6
  194. package/views/3d/webgl-engine/core/shaderLibrary/shading/Reprojection.glsl.js +4 -4
  195. package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceReflections.glsl.js +5 -5
  196. package/views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js +1 -1
  197. package/views/3d/webgl-engine/core/shaderLibrary/shading/Water.glsl.js +10 -10
  198. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Terrain.glsl.js +1 -1
  199. package/views/3d/webgl-engine/core/shaderLibrary/util/BlendLayers.glsl.js +1 -1
  200. package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +4 -4
  201. package/views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js +1 -1
  202. package/views/3d/webgl-engine/lib/Camera.js +1 -1
  203. package/views/3d/webgl-engine/lib/DefaultVertexAttributeLocations.js +1 -1
  204. package/views/3d/webgl-engine/lib/DefaultVertexBufferLayouts.js +1 -1
  205. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  206. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  207. package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
  208. package/views/3d/webgl-engine/lib/MagnifierHelper.js +1 -1
  209. package/views/3d/webgl-engine/lib/Material.js +1 -1
  210. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  211. package/views/3d/webgl-engine/lib/SSAOHelper.js +1 -1
  212. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  213. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  214. package/views/3d/webgl-engine/lib/SmaaRenderPass.js +1 -1
  215. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  216. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  217. package/views/3d/webgl-engine/lib/TextureUniformName.js +4 -0
  218. package/views/3d/webgl-engine/lib/UniformName.js +4 -0
  219. package/views/3d/webgl-engine/lib/VertexAttribute.js +5 -0
  220. package/views/3d/webgl-engine/lib/basicInterfaces.js +1 -1
  221. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  222. package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
  223. package/views/3d/webgl-engine/lib/edgeRendering/EdgeShaderTechnique.js +1 -1
  224. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  225. package/views/3d/webgl-engine/lib/edgeRendering/bufferLayouts.js +1 -1
  226. package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
  227. package/views/3d/webgl-engine/lib/lodRendering/RenderInstanceData.js +1 -1
  228. package/views/3d/webgl-engine/lib/pathGeometryUtils.js +1 -1
  229. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  230. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  231. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  232. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  233. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  234. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  235. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  236. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  237. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  238. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  239. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  240. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  241. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  242. package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
  243. package/views/3d/webgl-engine/materials/VisualVariableMaterialParameters.js +1 -1
  244. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  245. package/views/3d/webgl-engine/materials/internal/DefaultBufferWriter.js +1 -1
  246. package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
  247. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  248. package/views/3d/webgl-engine/materials/internal/waterMaterialUtils.js +1 -1
  249. package/views/3d/webgl-engine/shaders/CheckerBoard.glsl.js +1 -1
  250. package/views/3d/webgl-engine/shaders/CheckerBoardTechnique.js +1 -1
  251. package/views/3d/webgl-engine/shaders/ColorMaterial.glsl.js +1 -1
  252. package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
  253. package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
  254. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  255. package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
  256. package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
  257. package/views/3d/webgl-engine/shaders/HighlightComposition.glsl.js +1 -1
  258. package/views/3d/webgl-engine/shaders/HighlightTechnique.js +1 -1
  259. package/views/3d/webgl-engine/shaders/ImageMaterial.glsl.js +1 -1
  260. package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
  261. package/views/3d/webgl-engine/shaders/LaserlinePath.glsl.js +1 -1
  262. package/views/3d/webgl-engine/shaders/LaserlinePathTechnique.js +1 -1
  263. package/views/3d/webgl-engine/shaders/LineCallout.glsl.js +1 -1
  264. package/views/3d/webgl-engine/shaders/LineCalloutTechnique.js +1 -1
  265. package/views/3d/webgl-engine/shaders/Magnifier.glsl.js +1 -1
  266. package/views/3d/webgl-engine/shaders/MeasurementArrow.glsl.js +1 -1
  267. package/views/3d/webgl-engine/shaders/NativeLine.glsl.js +1 -1
  268. package/views/3d/webgl-engine/shaders/Pattern.glsl.js +1 -1
  269. package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
  270. package/views/3d/webgl-engine/shaders/PointRenderer.glsl.js +1 -1
  271. package/views/3d/webgl-engine/shaders/RealisticTreeTechnique.js +1 -1
  272. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  273. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  274. package/views/3d/webgl-engine/shaders/SMAA.glsl.js +1 -1
  275. package/views/3d/webgl-engine/shaders/ShadedColorMaterial.glsl.js +1 -1
  276. package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechnique.js +1 -1
  277. package/views/3d/webgl-engine/shaders/ShadowCastTechnique.js +1 -1
  278. package/views/3d/webgl-engine/shaders/ShadowHighlightTechnique.js +1 -1
  279. package/views/3d/webgl-engine/shaders/SlicePlaneMaterial.glsl.js +1 -1
  280. package/views/3d/webgl-engine/shaders/WaterSurface.glsl.js +1 -1
  281. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/AdjustProjectedPosition.glsl.js +10 -10
  282. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/DiscardShortEdges.glsl.js +1 -1
  283. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeShaderProgram.glsl.js +1 -1
  284. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeUtil.glsl.js +21 -21
  285. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/LineAmplitude.glsl.js +6 -6
  286. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/LineOffset.glsl.js +13 -13
  287. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/UnpackAttributes.glsl.js +6 -6
  288. package/views/SceneView.js +1 -1
  289. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  290. package/views/support/WatchUpdatingTracking.js +1 -1
  291. package/views/webgl/BufferObject.js +1 -1
  292. package/views/webgl/InstanceCounter.js +1 -1
  293. package/views/webgl/Program.js +1 -1
  294. package/widgets/BasemapGallery/support/basemapCompatibilityUtils.js +1 -1
  295. package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
  296. package/widgets/Search/support/locatorUtils.js +1 -1
  297. package/widgets/Search.js +1 -1
  298. package/assets/esri/core/workers/chunks/12c0cabb6c59e65d8546.js +0 -1
  299. package/assets/esri/core/workers/chunks/322d917e8cb398816a93.js +0 -1
  300. package/assets/esri/core/workers/chunks/392b6382e06652dd4c80.js +0 -1
  301. package/assets/esri/core/workers/chunks/3aa73119b055e05bbbeb.js +0 -1
  302. package/assets/esri/core/workers/chunks/52ea678ba1da0e349919.js +0 -1
  303. package/assets/esri/core/workers/chunks/5ee497d5d7b0e580526a.js +0 -1
  304. package/assets/esri/core/workers/chunks/663ad15b86936eb06b69.js +0 -1
  305. package/assets/esri/core/workers/chunks/83b8fec1650e061aaa56.js +0 -1
  306. package/assets/esri/core/workers/chunks/9796d54ff12b6429164a.js +0 -1
  307. package/assets/esri/core/workers/chunks/d07440469fe7d181c4fd.js +0 -1
  308. package/assets/esri/core/workers/chunks/dbf192b4ce7e608610f6.js +0 -1
  309. package/assets/esri/core/workers/chunks/de6cff7b6cbbf99b20d1.js +0 -981
  310. package/assets/esri/core/workers/chunks/dee9929d95e9fe26929c.js +0 -1
  311. package/assets/esri/core/workers/chunks/e12d91ef44d6f879a02a.js +0 -1
  312. package/assets/esri/core/workers/chunks/e59764ee8cf25d4f74e2.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{f as t,c as e,n,a as r,b as a,d as o,s,g as l,m as i}from"../../../../chunks/vec3.js";import{f as c,c as u,a as h}from"../../../../chunks/vec3f32.js";import{c as f}from"../../../../chunks/vec3f64.js";import{create as O,fromPositionAndNormal as A,intersectRay as y}from"../../../../geometry/support/plane.js";import{wrap as I}from"../../../../geometry/support/ray.js";import{VertexAttribute as g,PrimitiveType as M}from"./basicInterfaces.js";import{Vec3Compact as d}from"./BufferVectorMath.js";import{Geometry as m}from"./Geometry.js";import{generateDefaultIndexArray as w}from"./geometryDataUtils.js";import{assert as N}from"./Util.js";const P=d;var U,S,p,z;!function(t){const e=.5,n=[[-e,-e,e],[e,-e,e],[e,e,e],[-e,e,e],[-e,-e,-e],[e,-e,-e],[e,e,-e],[-e,e,-e]],r=[0,0,1,-1,0,0,1,0,0,0,-1,0,0,1,0,0,0,-1],a=[0,0,1,0,1,1,0,1],o=new Uint16Array([0,1,2,2,3,0,4,0,3,3,7,4,1,5,6,6,2,1,1,0,4,4,5,1,3,2,6,6,7,3,5,4,7,7,6,5]),s=new Uint16Array(36);for(let c=0;c<6;c++)for(let t=0;t<6;t++)s[6*c+t]=c;const l=new Uint16Array(36);for(let c=0;c<6;c++)l[6*c+0]=0,l[6*c+1]=1,l[6*c+2]=2,l[6*c+3]=2,l[6*c+4]=3,l[6*c+5]=0;function i(t){Array.isArray(t)||(t=[t,t,t]);const e=new Array(24);for(let r=0;r<8;r++)e[3*r]=n[r][0]*t[0],e[3*r+1]=n[r][1]*t[1],e[3*r+2]=n[r][2]*t[2];return new m([[g.POSITION,{size:3,data:e,exclusive:!0}],[g.NORMAL,{size:3,data:r}],[g.UV0,{size:2,data:a}]],[[g.POSITION,o],[g.NORMAL,s],[g.UV0,l]])}t.createGeometry=i}(U||(U={})),function(t){const e=.5,n=[[-e,0,-e],[e,0,-e],[e,0,e],[-e,0,e],[0,-e,0],[0,e,0]],r=[0,1,-1,1,1,0,0,1,1,-1,1,0,0,-1,-1,1,-1,0,0,-1,1,-1,-1,0],a=new Uint16Array([5,1,0,5,2,1,5,3,2,5,0,3,4,0,1,4,1,2,4,2,3,4,3,0]),o=new Uint16Array([0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7]);function s(t){Array.isArray(t)||(t=[t,t,t]);const e=new Array(18);for(let r=0;r<6;r++)e[3*r]=n[r][0]*t[0],e[3*r+1]=n[r][1]*t[1],e[3*r+2]=n[r][2]*t[2];return new m([[g.POSITION,{size:3,data:e,exclusive:!0}],[g.NORMAL,{size:3,data:r}]],[[g.POSITION,a],[g.NORMAL,o]])}t.createGeometry=s}(S||(S={})),function(r){const a=.5,o=0,s=c(-a,o,-a),l=c(a,o,-a),i=c(0,o,a),h=c(0,o+a,0),f=u(),O=u(),A=u(),y=u(),I=u();t(f,s,h),t(O,s,l),e(A,f,O),n(A,A),t(f,l,h),t(O,l,i),e(y,f,O),n(y,y),t(f,i,h),t(O,i,s),e(I,f,O),n(I,I);const M=[s,l,i,h],d=[0,-1,0,A[0],A[1],A[2],y[0],y[1],y[2],I[0],I[1],I[2]],w=[0,1,2,3,1,0,3,2,1,3,0,2],N=[0,0,0,1,1,1,2,2,2,3,3,3];function P(t){Array.isArray(t)||(t=[t,t,t]);const e=new Array(12);for(let n=0;n<4;n++)e[3*n]=M[n][0]*t[0],e[3*n+1]=M[n][1]*t[1],e[3*n+2]=M[n][2]*t[2];return new m([[g.POSITION,{size:3,data:e,exclusive:!0}],[g.NORMAL,{size:3,data:d}]],[[g.POSITION,new Uint16Array(w)],[g.NORMAL,new Uint16Array(N)]])}r.createGeometry=P}(p||(p={})),function(d){function z(t,e,n,r={uv:!0}){const a=-Math.PI,o=2*Math.PI,s=-Math.PI/2,l=Math.PI,i=Math.max(3,Math.floor(e)),c=Math.max(2,Math.floor(n)),u=(i+1)*(c+1),h=new Float32Array(3*u),f=new Float32Array(3*u),O=new Float32Array(2*u),A=[];let y=0;for(let g=0;g<=c;g++){const e=[],n=g/c,r=s+n*l,u=Math.cos(r);for(let s=0;s<=i;s++){const l=s/i,c=a+l*o,A=Math.cos(c)*u,I=Math.sin(r),g=-Math.sin(c)*u;h[3*y]=A*t,h[3*y+1]=I*t,h[3*y+2]=g*t,f[3*y]=A,f[3*y+1]=I,f[3*y+2]=g,O[2*y]=l,O[2*y+1]=n,e.push(y),++y}A.push(e)}const I=new Uint32Array(2*i*(c-1)*3);y=0;for(let g=0;g<c;g++)for(let t=0;t<i;t++){const e=A[g][t],n=A[g][t+1],r=A[g+1][t+1],a=A[g+1][t];0===g?(I[y++]=e,I[y++]=r,I[y++]=a):g===c-1?(I[y++]=e,I[y++]=n,I[y++]=r):(I[y++]=e,I[y++]=n,I[y++]=r,I[y++]=r,I[y++]=a,I[y++]=e)}const M=[[g.POSITION,I],[g.NORMAL,I]],d=[[g.POSITION,{size:3,data:h,exclusive:!0}],[g.NORMAL,{size:3,data:f,exclusive:!0}]];return r.uv&&(d.push([g.UV0,{size:2,data:O,exclusive:!0}]),M.push([g.UV0,I])),r.offset&&(M[0][0]=g.OFFSET,d[0][0]=g.OFFSET,M.push([g.POSITION,new Uint32Array(I.length)]),d.push([g.POSITION,{size:3,data:Float64Array.from(r.offset),exclusive:!0}])),new m(d,M)}function T(t,e,n){const r=t;let a,o;if(n)a=[0,-1,0,1,0,0,0,0,1,-1,0,0,0,0,-1,0,1,0],o=new Uint32Array([0,1,2,0,2,3,0,3,4,0,4,1,1,5,2,2,5,3,3,5,4,4,5,1]);else{const t=r*(1+Math.sqrt(5))/2;a=[-r,t,0,r,t,0,-r,-t,0,r,-t,0,0,-r,t,0,r,t,0,-r,-t,0,r,-t,t,0,-r,t,0,r,-t,0,-r,-t,0,r],o=new Uint32Array([0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1])}for(let h=0;h<a.length;h+=3)P.scale(a,h,t/P.length(a,h));let s={};function l(e,n){e>n&&([e,n]=[n,e]);const r=e.toString()+"."+n.toString();if(s[r])return s[r];let o=a.length;return a.length+=3,P.add(a,3*e,a,3*n,a,o),P.scale(a,o,t/P.length(a,o)),o/=3,s[r]=o,o}for(let h=0;h<e;h++){const t=o.length,e=new Uint32Array(4*t);for(let n=0;n<t;n+=3){const t=o[n],r=o[n+1],a=o[n+2],s=l(t,r),i=l(r,a),c=l(a,t),u=4*n;e[u]=t,e[u+1]=s,e[u+2]=c,e[u+3]=r,e[u+4]=i,e[u+5]=s,e[u+6]=a,e[u+7]=c,e[u+8]=i,e[u+9]=s,e[u+10]=i,e[u+11]=c}o=e,s={}}const i=new Float32Array(a);for(let h=0;h<i.length;h+=3)P.normalize(i,h);const c=[[g.POSITION,o],[g.NORMAL,o]],u=[[g.POSITION,{size:3,data:new Float32Array(a),exclusive:!0}],[g.NORMAL,{size:3,data:i,exclusive:!0}]];return new m(u,c)}function L(t,e,n,r,a,o,s){const l=e?[e[0],e[1],e[2]]:[0,0,0],i=t?[t[0],t[1],t[2]]:[0,0,1];o=o||[0,0];const c=n?[255*n[0],255*n[1],255*n[2],n.length>3?255*n[3]:255]:[255,255,255,255],u=null!=r&&2===r.length?r:[1,1],h=[[g.POSITION,{size:3,data:l,exclusive:!0}],[g.NORMAL,{size:3,data:i,exclusive:!0}],[g.UV0,{size:o.length,data:o}],[g.COLOR,{size:4,data:c,exclusive:!0}],[g.SIZE,{size:2,data:u}]];if(null!=a){const t=new Float32Array([a[0],a[1],a[2],a[3]]);h.push([g.AUXPOS1,{size:4,data:t}])}if(null!=s){const t=new Float32Array([s[0],s[1],s[2],s[3]]);h.push([g.AUXPOS2,{size:4,data:t}])}return new m(h,null,M.Point)}function R(t,e,n,r,a,o,s,l){if(null!=t){const{data:e}=l.getMutableAttribute(g.NORMAL);e[0]=t[0],e[1]=t[1],e[2]=t[2]}if(null!=e){const{data:t}=l.getMutableAttribute(g.POSITION);t[0]=e[0],t[1]=e[1],t[2]=e[2]}if(null!=n){const{data:t}=l.getMutableAttribute(g.COLOR);t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3]}if(null!=r){const{data:t}=l.getMutableAttribute(g.SIZE);t[0]=r[0],t[1]=r[1]}if(null!=a){const{data:t}=l.getMutableAttribute(g.AUXPOS1);t[0]=a[0],t[1]=a[1],t[2]=a[2],t[3]=a[3]}if(null!=o){const{data:t}=l.getMutableAttribute(g.UV0);t[0]=o[0],t[1]=o[1]}if(null!=s){const{data:t}=l.getMutableAttribute(g.AUXPOS2);t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3]}}function b(t,e){const n=new Float32Array(3*t.length),r=new Float32Array(e?3*t.length:3),a=new Uint32Array(t.length),o=new Uint32Array(t.length);for(let c=0;c<t.length;c++)n[3*c]=t[c][0],n[3*c+1]=t[c][1],n[3*c+2]=t[c][2],e&&(r[3*c]=e[c][0],r[3*c+1]=e[c][1],r[3*c+2]=e[c][2]),a[c]=c,o[c]=0;e||(r[0]=0,r[1]=1,r[2]=0);const s=[0,0],l=[[g.POSITION,a],[g.NORMAL,e?a:o],[g.UV0,o]],i=[[g.POSITION,{size:3,data:n,exclusive:!0}],[g.NORMAL,{size:3,data:r,exclusive:!0}],[g.UV0,{size:2,data:s,exclusive:!0}]];return new m(i,l,M.Point)}function G(){const t=[0,0,0,0,0,100,100,0,0],e=new Uint16Array([0,1,2]),n=[0,1,0],r=new Uint16Array([0,0,0]),a=[0,0],o=new Uint16Array([0,0,0]),s=[[g.POSITION,e],[g.NORMAL,r],[g.UV0,o]],l=[[g.POSITION,{size:3,data:t,exclusive:!0}],[g.NORMAL,{size:3,data:n,exclusive:!0}],[g.UV0,{size:2,data:a,exclusive:!0}]];return new m(l,s)}d.createBoxGeometry=U.createGeometry,d.createDiamondGeometry=S.createGeometry,d.createTetrahedronGeometry=p.createGeometry,d.createSphereGeometry=z,d.createPolySphereGeometry=T,d.createPointGeometry=L,d.updatePointGeometry=R,d.createPointArrayGeometry=b,d.createTriangleGeometry=G;const F=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0]];function V(t=F){const e=new Array(12);for(let c=0;c<4;c++)for(let n=0;n<3;n++)e[3*c+n]=t[c][n];const n=new Uint32Array([0,1,2,2,3,0]),r=[0,0,1],a=new Uint32Array([0,0,0,0,0,0]),o=[0,0,1,0,1,1,0,1],s=[255,255,255,255],l=[[g.POSITION,n],[g.NORMAL,a],[g.UV0,n],[g.COLOR,a]],i=[[g.POSITION,{size:3,data:e,exclusive:!0}],[g.NORMAL,{size:3,data:r,exclusive:!0}],[g.UV0,{size:2,data:o,exclusive:!0}],[g.COLOR,{size:4,data:s,exclusive:!0}]];return new m(i,l)}function j(t,e,n,r,a=!0,o=!0){let s=0;const l=e,i=t;let u=c(0,s,0),h=c(0,s+i,0),f=c(0,-1,0),O=c(0,1,0);r&&(s=i,h=c(0,0,0),u=c(0,s,0),f=c(0,1,0),O=c(0,-1,0));const A=[h,u],y=[f,O],I=n+2,M=Math.sqrt(i*i+l*l);if(r)for(let g=n-1;g>=0;g--){const t=g*(2*Math.PI/n),e=c(Math.cos(t)*l,s,Math.sin(t)*l);A.push(e);const r=c(i*Math.cos(t)/M,-l/M,i*Math.sin(t)/M);y.push(r)}else for(let g=0;g<n;g++){const t=g*(2*Math.PI/n),e=c(Math.cos(t)*l,s,Math.sin(t)*l);A.push(e);const r=c(i*Math.cos(t)/M,l/M,i*Math.sin(t)/M);y.push(r)}const d=new Uint32Array(2*(n+2)*3),w=new Uint32Array(2*(n+2)*3);let N=0,P=0;if(a){for(let t=3;t<A.length;t++)d[N++]=1,d[N++]=t-1,d[N++]=t,w[P++]=0,w[P++]=0,w[P++]=0;d[N++]=A.length-1,d[N++]=2,d[N++]=1,w[P++]=0,w[P++]=0,w[P++]=0}if(o){for(let t=3;t<A.length;t++)d[N++]=t,d[N++]=t-1,d[N++]=0,w[P++]=t,w[P++]=t-1,w[P++]=1;d[N++]=0,d[N++]=2,d[N++]=A.length-1,w[P++]=1,w[P++]=2,w[P++]=y.length-1}const U=new Float32Array(3*I);for(let c=0;c<I;c++)U[3*c]=A[c][0],U[3*c+1]=A[c][1],U[3*c+2]=A[c][2];const S=new Float32Array(3*I);for(let c=0;c<I;c++)S[3*c]=y[c][0],S[3*c+1]=y[c][1],S[3*c+2]=y[c][2];const p=[[g.POSITION,d],[g.NORMAL,w]],z=[[g.POSITION,{size:3,data:U,exclusive:!0}],[g.NORMAL,{size:3,data:S,exclusive:!0}]];return new m(z,p)}function C(t,l,i,f,O,A){const y=f?h(f):c(1,0,0),I=O?h(O):c(0,0,0);A=null==A||A;const M=u();n(M,y);const d=u();r(d,M,Math.abs(t));const w=u();r(w,d,-.5),a(w,w,I);const N=c(0,1,0);Math.abs(1-o(M,N))<.2&&s(N,0,0,1);const P=u();e(P,M,N),n(P,P),e(N,P,M);const U=2*i+(A?2:0),S=i+(A?2:0),p=new Float32Array(3*U),z=new Float32Array(3*S),x=new Float32Array(2*U),v=new Uint32Array(3*i*(A?4:2)),T=new Uint32Array(3*i*(A?4:2));A&&(p[3*(U-2)+0]=w[0],p[3*(U-2)+1]=w[1],p[3*(U-2)+2]=w[2],x[2*(U-2)]=0,x[2*(U-2)+1]=0,p[3*(U-1)+0]=p[3*(U-2)+0]+d[0],p[3*(U-1)+1]=p[3*(U-2)+1]+d[1],p[3*(U-1)+2]=p[3*(U-2)+2]+d[2],x[2*(U-1)]=1,x[2*(U-1)+1]=1,z[3*(S-2)+0]=-M[0],z[3*(S-2)+1]=-M[1],z[3*(S-2)+2]=-M[2],z[3*(S-1)+0]=M[0],z[3*(S-1)+1]=M[1],z[3*(S-1)+2]=M[2]);const L=function(t,e,n){v[t]=e,T[t]=n};let R=0;const b=u(),G=u();for(let e=0;e<i;e++){const t=e*(2*Math.PI/i);r(b,N,Math.sin(t)),r(G,P,Math.cos(t)),a(b,b,G),z[3*e+0]=b[0],z[3*e+1]=b[1],z[3*e+2]=b[2],r(b,b,l),a(b,b,w),p[3*e+0]=b[0],p[3*e+1]=b[1],p[3*e+2]=b[2],x[2*e+0]=e/i,x[2*e+1]=0,p[3*(e+i)+0]=p[3*e+0]+d[0],p[3*(e+i)+1]=p[3*e+1]+d[1],p[3*(e+i)+2]=p[3*e+2]+d[2],x[2*(e+i)+0]=e/i,x[2*e+1]=1;const n=(e+1)%i;L(R++,e,e),L(R++,e+i,e),L(R++,n,n),L(R++,n,n),L(R++,e+i,e),L(R++,n+i,n)}if(A){for(let t=0;t<i;t++){const e=(t+1)%i;L(R++,U-2,S-2),L(R++,t,S-2),L(R++,e,S-2)}for(let t=0;t<i;t++){const e=(t+1)%i;L(R++,t+i,S-1),L(R++,U-1,S-1),L(R++,e+i,S-1)}}const F=[[g.POSITION,v],[g.NORMAL,T],[g.UV0,v]],V=[[g.POSITION,{size:3,data:p,exclusive:!0}],[g.NORMAL,{size:3,data:z,exclusive:!0}],[g.UV0,{size:2,data:x,exclusive:!0}]];return new m(V,F)}function E(t,e,n,r,a){n=n||10,r=null==r||r,N(t.length>1);const o=[[0,0,0]],s=[],l=[];for(let i=0;i<n;i++){s.push([0,-i-1,-(i+1)%n-1]);const t=i/n*2*Math.PI;l.push([Math.cos(t)*e,Math.sin(t)*e])}return d.createPathExtrusionGeometry(l,t,o,s,r,a)}function k(o,i,h,M,d,w=c(0,0,0)){const N=o.length,P=new Float32Array(i.length*N*3+(6*h.length||0)),U=new Float32Array(i.length*N*3+(h?6:0)),S=(i.length-1)*N*6+3*M.length*2,p=new Uint32Array(S),z=new Uint32Array(S);let v=0,T=0,L=0,R=0;const b=u(),G=u(),F=u(),V=u(),j=u(),C=u(),E=u(),k=f(),B=u(),D=u(),X=u(),q=u(),Z=u(),J=O();s(B,0,1,0),t(G,i[1],i[0]),n(G,G),d?(a(k,i[0],w),n(F,k)):s(F,0,0,1),H(G,F,B,B,j,F,x),l(V,F),l(q,j);for(let t=0;t<h.length;t++)r(C,j,h[t][0]),r(k,F,h[t][2]),a(C,C,k),a(C,C,i[0]),P[v++]=C[0],P[v++]=C[1],P[v++]=C[2];U[T++]=-G[0],U[T++]=-G[1],U[T++]=-G[2];for(let t=0;t<M.length;t++)p[L++]=M[t][0]>0?M[t][0]:-M[t][0]-1+h.length,p[L++]=M[t][1]>0?M[t][1]:-M[t][1]-1+h.length,p[L++]=M[t][2]>0?M[t][2]:-M[t][2]-1+h.length,z[R++]=0,z[R++]=0,z[R++]=0;let K=h.length;const Q=h.length-1;for(let s=0;s<i.length;s++){let c=!1;if(s>0){l(b,G),s<i.length-1?(t(G,i[s+1],i[s]),n(G,G)):c=!0,a(D,b,G),n(D,D),a(X,i[s-1],V),A(i[s],D,J);y(J,I(X,b),k)?(t(k,k,i[s]),n(F,k),e(j,D,F),n(j,j)):H(D,V,q,B,j,F,x),l(V,F),l(q,j)}d&&(a(k,i[s],w),n(Z,k));for(let t=0;t<N;t++)if(r(C,j,o[t][0]),r(k,F,o[t][1]),a(C,C,k),n(E,C),U[T++]=E[0],U[T++]=E[1],U[T++]=E[2],a(C,C,i[s]),P[v++]=C[0],P[v++]=C[1],P[v++]=C[2],!c){const e=(t+1)%N;p[L++]=K+t,p[L++]=K+N+t,p[L++]=K+e,p[L++]=K+e,p[L++]=K+N+t,p[L++]=K+N+e;for(let t=0;t<6;t++)z[R++]=p[L-6+t]-Q}K+=N}const W=i[i.length-1];for(let t=0;t<h.length;t++)r(C,j,h[t][0]),r(k,F,h[t][1]),a(C,C,k),a(C,C,W),P[v++]=C[0],P[v++]=C[1],P[v++]=C[2];const Y=T/3;U[T++]=G[0],U[T++]=G[1],U[T++]=G[2];const $=K-N;for(let t=0;t<M.length;t++)p[L++]=M[t][0]>=0?K+M[t][0]:-M[t][0]-1+$,p[L++]=M[t][2]>=0?K+M[t][2]:-M[t][2]-1+$,p[L++]=M[t][1]>=0?K+M[t][1]:-M[t][1]-1+$,z[R++]=Y,z[R++]=Y,z[R++]=Y;const _=[[g.POSITION,p],[g.NORMAL,z]],tt=[[g.POSITION,{size:3,data:P,exclusive:!0}],[g.NORMAL,{size:3,data:U,exclusive:!0}]];return new m(tt,_)}function B(t,e,n){N(t.length>1,"createPolylineGeometry(): polyline needs at least 2 points"),N(3===t[0].length,"createPolylineGeometry(): malformed vertex"),N(null==e||e.length===t.length,"createPolylineGeometry: need same number of points and normals"),N(null==e||3===e[0].length,"createPolylineGeometry(): malformed normal");const r=new Float64Array(3*t.length),a=new Uint32Array(2*(t.length-1));let o=0,s=0;for(let c=0;c<t.length;c++){for(let e=0;e<3;e++)r[o++]=t[c][e];c>0&&(a[s++]=c-1,a[s++]=c)}const l=[],i=[];if(l.push([g.POSITION,a]),i.push([g.POSITION,{size:3,data:r,exclusive:!0}]),e){const n=new Float32Array(3*e.length);let r=0;for(let a=0;a<t.length;a++)for(let t=0;t<3;t++)n[r++]=e[a][t];l.push([g.NORMAL,a]),i.push([g.NORMAL,{size:3,data:n,exclusive:!0}])}return n&&(i.push([g.COLOR,{size:4,data:n}]),l.push([g.COLOR,w(n.length/4)])),new m(i,l,M.Line)}function D(t,e,n,r,a=0){const o=new Array(18),s=[[-e,a,r/2],[n,a,r/2],[0,t+a,r/2],[-e,a,-r/2],[n,a,-r/2],[0,t+a,-r/2]],l=new Uint16Array([0,1,2,3,0,2,2,5,3,1,4,5,5,2,1,1,0,3,3,4,1,4,3,5]);for(let i=0;i<6;i++)o[3*i]=s[i][0],o[3*i+1]=s[i][1],o[3*i+2]=s[i][2];return new m([[g.POSITION,{size:3,data:o,exclusive:!0}]],[[g.POSITION,l]])}function X(t,e){const n=t.getMutableAttribute(g.POSITION).data;for(let r=0;r<n.length;r+=3){const t=n[r],a=n[r+1],o=n[r+2];s(v,t,a,o),i(v,v,e),n[r]=v[0],n[r+1]=v[1],n[r+2]=v[2]}}function q(t,e=t){const n=t.vertexAttributes,r=n.get(g.POSITION).data,a=n.get(g.NORMAL).data;if(a){const t=e.getMutableAttribute(g.NORMAL).data;for(let e=0;e<a.length;e+=3){const n=a[e+1];t[e+1]=-a[e+2],t[e+2]=n}}if(r){const t=e.getMutableAttribute(g.POSITION).data;for(let e=0;e<r.length;e+=3){const n=r[e+1];t[e+1]=-r[e+2],t[e+2]=n}}return e}function Z(t,r,a,s,l){return!(Math.abs(o(r,t))>l)&&(e(a,t,r),n(a,a),e(s,a,t),n(s,s),!0)}function H(t,e,n,r,a,o,s){return Z(t,e,a,o,s)||Z(t,n,a,o,s)||Z(t,r,a,o,s)}d.createSquareGeometry=V,d.createConeGeometry=j,d.createCylinderGeometry=C,d.createTubeGeometry=E,d.createPathExtrusionGeometry=k,d.createPolylineGeometry=B,d.createExtrudedTriangle=D,d.transformInPlace=X,d.cgToGIS=q,d.makeOrthoBasisDirUp=Z,d.makeOrthoBasisDirUpFallback=H}(z||(z={}));const x=.99619469809,v=u(),T=z;export{T as default};
5
+ import{f as t,c as e,n,a as r,b as a,d as o,s,g as l,m as i}from"../../../../chunks/vec3.js";import{f as c,c as u,a as f}from"../../../../chunks/vec3f32.js";import{c as h}from"../../../../chunks/vec3f64.js";import{create as O,fromPositionAndNormal as A,intersectRay as y}from"../../../../geometry/support/plane.js";import{wrap as I}from"../../../../geometry/support/ray.js";import{PrimitiveType as g}from"./basicInterfaces.js";import{Vec3Compact as M}from"./BufferVectorMath.js";import{Geometry as m}from"./Geometry.js";import{generateDefaultIndexArray as d}from"./geometryDataUtils.js";import{assert as w}from"./Util.js";import{VertexAttribute as N}from"./VertexAttribute.js";const P=M;var U,S,p,x;!function(t){const e=.5,n=[[-e,-e,e],[e,-e,e],[e,e,e],[-e,e,e],[-e,-e,-e],[e,-e,-e],[e,e,-e],[-e,e,-e]],r=[0,0,1,-1,0,0,1,0,0,0,-1,0,0,1,0,0,0,-1],a=[0,0,1,0,1,1,0,1],o=new Uint16Array([0,1,2,2,3,0,4,0,3,3,7,4,1,5,6,6,2,1,1,0,4,4,5,1,3,2,6,6,7,3,5,4,7,7,6,5]),s=new Uint16Array(36);for(let c=0;c<6;c++)for(let t=0;t<6;t++)s[6*c+t]=c;const l=new Uint16Array(36);for(let c=0;c<6;c++)l[6*c+0]=0,l[6*c+1]=1,l[6*c+2]=2,l[6*c+3]=2,l[6*c+4]=3,l[6*c+5]=0;function i(t){Array.isArray(t)||(t=[t,t,t]);const e=new Array(24);for(let r=0;r<8;r++)e[3*r]=n[r][0]*t[0],e[3*r+1]=n[r][1]*t[1],e[3*r+2]=n[r][2]*t[2];return new m([[N.POSITION,{size:3,data:e,exclusive:!0}],[N.NORMAL,{size:3,data:r}],[N.UV0,{size:2,data:a}]],[[N.POSITION,o],[N.NORMAL,s],[N.UV0,l]])}t.createGeometry=i}(U||(U={})),function(t){const e=.5,n=[[-e,0,-e],[e,0,-e],[e,0,e],[-e,0,e],[0,-e,0],[0,e,0]],r=[0,1,-1,1,1,0,0,1,1,-1,1,0,0,-1,-1,1,-1,0,0,-1,1,-1,-1,0],a=new Uint16Array([5,1,0,5,2,1,5,3,2,5,0,3,4,0,1,4,1,2,4,2,3,4,3,0]),o=new Uint16Array([0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7]);function s(t){Array.isArray(t)||(t=[t,t,t]);const e=new Array(18);for(let r=0;r<6;r++)e[3*r]=n[r][0]*t[0],e[3*r+1]=n[r][1]*t[1],e[3*r+2]=n[r][2]*t[2];return new m([[N.POSITION,{size:3,data:e,exclusive:!0}],[N.NORMAL,{size:3,data:r}]],[[N.POSITION,a],[N.NORMAL,o]])}t.createGeometry=s}(S||(S={})),function(r){const a=.5,o=0,s=c(-a,o,-a),l=c(a,o,-a),i=c(0,o,a),f=c(0,o+a,0),h=u(),O=u(),A=u(),y=u(),I=u();t(h,s,f),t(O,s,l),e(A,h,O),n(A,A),t(h,l,f),t(O,l,i),e(y,h,O),n(y,y),t(h,i,f),t(O,i,s),e(I,h,O),n(I,I);const g=[s,l,i,f],M=[0,-1,0,A[0],A[1],A[2],y[0],y[1],y[2],I[0],I[1],I[2]],d=[0,1,2,3,1,0,3,2,1,3,0,2],w=[0,0,0,1,1,1,2,2,2,3,3,3];function P(t){Array.isArray(t)||(t=[t,t,t]);const e=new Array(12);for(let n=0;n<4;n++)e[3*n]=g[n][0]*t[0],e[3*n+1]=g[n][1]*t[1],e[3*n+2]=g[n][2]*t[2];return new m([[N.POSITION,{size:3,data:e,exclusive:!0}],[N.NORMAL,{size:3,data:M}]],[[N.POSITION,new Uint16Array(d)],[N.NORMAL,new Uint16Array(w)]])}r.createGeometry=P}(p||(p={})),function(M){function x(t,e,n,r={uv:!0}){const a=-Math.PI,o=2*Math.PI,s=-Math.PI/2,l=Math.PI,i=Math.max(3,Math.floor(e)),c=Math.max(2,Math.floor(n)),u=(i+1)*(c+1),f=new Float32Array(3*u),h=new Float32Array(3*u),O=new Float32Array(2*u),A=[];let y=0;for(let m=0;m<=c;m++){const e=[],n=m/c,r=s+n*l,u=Math.cos(r);for(let s=0;s<=i;s++){const l=s/i,c=a+l*o,A=Math.cos(c)*u,I=Math.sin(r),g=-Math.sin(c)*u;f[3*y]=A*t,f[3*y+1]=I*t,f[3*y+2]=g*t,h[3*y]=A,h[3*y+1]=I,h[3*y+2]=g,O[2*y]=l,O[2*y+1]=n,e.push(y),++y}A.push(e)}const I=new Uint32Array(2*i*(c-1)*3);y=0;for(let m=0;m<c;m++)for(let t=0;t<i;t++){const e=A[m][t],n=A[m][t+1],r=A[m+1][t+1],a=A[m+1][t];0===m?(I[y++]=e,I[y++]=r,I[y++]=a):m===c-1?(I[y++]=e,I[y++]=n,I[y++]=r):(I[y++]=e,I[y++]=n,I[y++]=r,I[y++]=r,I[y++]=a,I[y++]=e)}const g=[[N.POSITION,I],[N.NORMAL,I]],M=[[N.POSITION,{size:3,data:f,exclusive:!0}],[N.NORMAL,{size:3,data:h,exclusive:!0}]];return r.uv&&(M.push([N.UV0,{size:2,data:O,exclusive:!0}]),g.push([N.UV0,I])),r.offset&&(g[0][0]=N.OFFSET,M[0][0]=N.OFFSET,g.push([N.POSITION,new Uint32Array(I.length)]),M.push([N.POSITION,{size:3,data:Float64Array.from(r.offset),exclusive:!0}])),new m(M,g)}function T(t,e,n){const r=t;let a,o;if(n)a=[0,-1,0,1,0,0,0,0,1,-1,0,0,0,0,-1,0,1,0],o=new Uint32Array([0,1,2,0,2,3,0,3,4,0,4,1,1,5,2,2,5,3,3,5,4,4,5,1]);else{const t=r*(1+Math.sqrt(5))/2;a=[-r,t,0,r,t,0,-r,-t,0,r,-t,0,0,-r,t,0,r,t,0,-r,-t,0,r,-t,t,0,-r,t,0,r,-t,0,-r,-t,0,r],o=new Uint32Array([0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1])}for(let f=0;f<a.length;f+=3)P.scale(a,f,t/P.length(a,f));let s={};function l(e,n){e>n&&([e,n]=[n,e]);const r=e.toString()+"."+n.toString();if(s[r])return s[r];let o=a.length;return a.length+=3,P.add(a,3*e,a,3*n,a,o),P.scale(a,o,t/P.length(a,o)),o/=3,s[r]=o,o}for(let f=0;f<e;f++){const t=o.length,e=new Uint32Array(4*t);for(let n=0;n<t;n+=3){const t=o[n],r=o[n+1],a=o[n+2],s=l(t,r),i=l(r,a),c=l(a,t),u=4*n;e[u]=t,e[u+1]=s,e[u+2]=c,e[u+3]=r,e[u+4]=i,e[u+5]=s,e[u+6]=a,e[u+7]=c,e[u+8]=i,e[u+9]=s,e[u+10]=i,e[u+11]=c}o=e,s={}}const i=new Float32Array(a);for(let f=0;f<i.length;f+=3)P.normalize(i,f);const c=[[N.POSITION,o],[N.NORMAL,o]],u=[[N.POSITION,{size:3,data:new Float32Array(a),exclusive:!0}],[N.NORMAL,{size:3,data:i,exclusive:!0}]];return new m(u,c)}function L(t,e,n,r,a,o,s){const l=e?[e[0],e[1],e[2]]:[0,0,0],i=t?[t[0],t[1],t[2]]:[0,0,1];o=o||[0,0];const c=n?[255*n[0],255*n[1],255*n[2],n.length>3?255*n[3]:255]:[255,255,255,255],u=null!=r&&2===r.length?r:[1,1],f=[[N.POSITION,{size:3,data:l,exclusive:!0}],[N.NORMAL,{size:3,data:i,exclusive:!0}],[N.UV0,{size:o.length,data:o}],[N.COLOR,{size:4,data:c,exclusive:!0}],[N.SIZE,{size:2,data:u}]];if(null!=a){const t=new Float32Array([a[0],a[1],a[2],a[3]]);f.push([N.AUXPOS1,{size:4,data:t}])}if(null!=s){const t=new Float32Array([s[0],s[1],s[2],s[3]]);f.push([N.AUXPOS2,{size:4,data:t}])}return new m(f,null,g.Point)}function R(t,e,n,r,a,o,s,l){if(null!=t){const{data:e}=l.getMutableAttribute(N.NORMAL);e[0]=t[0],e[1]=t[1],e[2]=t[2]}if(null!=e){const{data:t}=l.getMutableAttribute(N.POSITION);t[0]=e[0],t[1]=e[1],t[2]=e[2]}if(null!=n){const{data:t}=l.getMutableAttribute(N.COLOR);t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3]}if(null!=r){const{data:t}=l.getMutableAttribute(N.SIZE);t[0]=r[0],t[1]=r[1]}if(null!=a){const{data:t}=l.getMutableAttribute(N.AUXPOS1);t[0]=a[0],t[1]=a[1],t[2]=a[2],t[3]=a[3]}if(null!=o){const{data:t}=l.getMutableAttribute(N.UV0);t[0]=o[0],t[1]=o[1]}if(null!=s){const{data:t}=l.getMutableAttribute(N.AUXPOS2);t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3]}}function b(t,e){const n=new Float32Array(3*t.length),r=new Float32Array(e?3*t.length:3),a=new Uint32Array(t.length),o=new Uint32Array(t.length);for(let c=0;c<t.length;c++)n[3*c]=t[c][0],n[3*c+1]=t[c][1],n[3*c+2]=t[c][2],e&&(r[3*c]=e[c][0],r[3*c+1]=e[c][1],r[3*c+2]=e[c][2]),a[c]=c,o[c]=0;e||(r[0]=0,r[1]=1,r[2]=0);const s=[0,0],l=[[N.POSITION,a],[N.NORMAL,e?a:o],[N.UV0,o]],i=[[N.POSITION,{size:3,data:n,exclusive:!0}],[N.NORMAL,{size:3,data:r,exclusive:!0}],[N.UV0,{size:2,data:s,exclusive:!0}]];return new m(i,l,g.Point)}function G(){const t=[0,0,0,0,0,100,100,0,0],e=new Uint16Array([0,1,2]),n=[0,1,0],r=new Uint16Array([0,0,0]),a=[0,0],o=new Uint16Array([0,0,0]),s=[[N.POSITION,e],[N.NORMAL,r],[N.UV0,o]],l=[[N.POSITION,{size:3,data:t,exclusive:!0}],[N.NORMAL,{size:3,data:n,exclusive:!0}],[N.UV0,{size:2,data:a,exclusive:!0}]];return new m(l,s)}M.createBoxGeometry=U.createGeometry,M.createDiamondGeometry=S.createGeometry,M.createTetrahedronGeometry=p.createGeometry,M.createSphereGeometry=x,M.createPolySphereGeometry=T,M.createPointGeometry=L,M.updatePointGeometry=R,M.createPointArrayGeometry=b,M.createTriangleGeometry=G;const F=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0]];function V(t=F){const e=new Array(12);for(let c=0;c<4;c++)for(let n=0;n<3;n++)e[3*c+n]=t[c][n];const n=new Uint32Array([0,1,2,2,3,0]),r=[0,0,1],a=new Uint32Array([0,0,0,0,0,0]),o=[0,0,1,0,1,1,0,1],s=[255,255,255,255],l=[[N.POSITION,n],[N.NORMAL,a],[N.UV0,n],[N.COLOR,a]],i=[[N.POSITION,{size:3,data:e,exclusive:!0}],[N.NORMAL,{size:3,data:r,exclusive:!0}],[N.UV0,{size:2,data:o,exclusive:!0}],[N.COLOR,{size:4,data:s,exclusive:!0}]];return new m(i,l)}function j(t,e,n,r,a=!0,o=!0){let s=0;const l=e,i=t;let u=c(0,s,0),f=c(0,s+i,0),h=c(0,-1,0),O=c(0,1,0);r&&(s=i,f=c(0,0,0),u=c(0,s,0),h=c(0,1,0),O=c(0,-1,0));const A=[f,u],y=[h,O],I=n+2,g=Math.sqrt(i*i+l*l);if(r)for(let m=n-1;m>=0;m--){const t=m*(2*Math.PI/n),e=c(Math.cos(t)*l,s,Math.sin(t)*l);A.push(e);const r=c(i*Math.cos(t)/g,-l/g,i*Math.sin(t)/g);y.push(r)}else for(let m=0;m<n;m++){const t=m*(2*Math.PI/n),e=c(Math.cos(t)*l,s,Math.sin(t)*l);A.push(e);const r=c(i*Math.cos(t)/g,l/g,i*Math.sin(t)/g);y.push(r)}const M=new Uint32Array(2*(n+2)*3),d=new Uint32Array(2*(n+2)*3);let w=0,P=0;if(a){for(let t=3;t<A.length;t++)M[w++]=1,M[w++]=t-1,M[w++]=t,d[P++]=0,d[P++]=0,d[P++]=0;M[w++]=A.length-1,M[w++]=2,M[w++]=1,d[P++]=0,d[P++]=0,d[P++]=0}if(o){for(let t=3;t<A.length;t++)M[w++]=t,M[w++]=t-1,M[w++]=0,d[P++]=t,d[P++]=t-1,d[P++]=1;M[w++]=0,M[w++]=2,M[w++]=A.length-1,d[P++]=1,d[P++]=2,d[P++]=y.length-1}const U=new Float32Array(3*I);for(let c=0;c<I;c++)U[3*c]=A[c][0],U[3*c+1]=A[c][1],U[3*c+2]=A[c][2];const S=new Float32Array(3*I);for(let c=0;c<I;c++)S[3*c]=y[c][0],S[3*c+1]=y[c][1],S[3*c+2]=y[c][2];const p=[[N.POSITION,M],[N.NORMAL,d]],x=[[N.POSITION,{size:3,data:U,exclusive:!0}],[N.NORMAL,{size:3,data:S,exclusive:!0}]];return new m(x,p)}function C(t,l,i,h,O,A){const y=h?f(h):c(1,0,0),I=O?f(O):c(0,0,0);A=null==A||A;const g=u();n(g,y);const M=u();r(M,g,Math.abs(t));const d=u();r(d,M,-.5),a(d,d,I);const w=c(0,1,0);Math.abs(1-o(g,w))<.2&&s(w,0,0,1);const P=u();e(P,g,w),n(P,P),e(w,P,g);const U=2*i+(A?2:0),S=i+(A?2:0),p=new Float32Array(3*U),x=new Float32Array(3*S),z=new Float32Array(2*U),v=new Uint32Array(3*i*(A?4:2)),T=new Uint32Array(3*i*(A?4:2));A&&(p[3*(U-2)+0]=d[0],p[3*(U-2)+1]=d[1],p[3*(U-2)+2]=d[2],z[2*(U-2)]=0,z[2*(U-2)+1]=0,p[3*(U-1)+0]=p[3*(U-2)+0]+M[0],p[3*(U-1)+1]=p[3*(U-2)+1]+M[1],p[3*(U-1)+2]=p[3*(U-2)+2]+M[2],z[2*(U-1)]=1,z[2*(U-1)+1]=1,x[3*(S-2)+0]=-g[0],x[3*(S-2)+1]=-g[1],x[3*(S-2)+2]=-g[2],x[3*(S-1)+0]=g[0],x[3*(S-1)+1]=g[1],x[3*(S-1)+2]=g[2]);const L=function(t,e,n){v[t]=e,T[t]=n};let R=0;const b=u(),G=u();for(let e=0;e<i;e++){const t=e*(2*Math.PI/i);r(b,w,Math.sin(t)),r(G,P,Math.cos(t)),a(b,b,G),x[3*e+0]=b[0],x[3*e+1]=b[1],x[3*e+2]=b[2],r(b,b,l),a(b,b,d),p[3*e+0]=b[0],p[3*e+1]=b[1],p[3*e+2]=b[2],z[2*e+0]=e/i,z[2*e+1]=0,p[3*(e+i)+0]=p[3*e+0]+M[0],p[3*(e+i)+1]=p[3*e+1]+M[1],p[3*(e+i)+2]=p[3*e+2]+M[2],z[2*(e+i)+0]=e/i,z[2*e+1]=1;const n=(e+1)%i;L(R++,e,e),L(R++,e+i,e),L(R++,n,n),L(R++,n,n),L(R++,e+i,e),L(R++,n+i,n)}if(A){for(let t=0;t<i;t++){const e=(t+1)%i;L(R++,U-2,S-2),L(R++,t,S-2),L(R++,e,S-2)}for(let t=0;t<i;t++){const e=(t+1)%i;L(R++,t+i,S-1),L(R++,U-1,S-1),L(R++,e+i,S-1)}}const F=[[N.POSITION,v],[N.NORMAL,T],[N.UV0,v]],V=[[N.POSITION,{size:3,data:p,exclusive:!0}],[N.NORMAL,{size:3,data:x,exclusive:!0}],[N.UV0,{size:2,data:z,exclusive:!0}]];return new m(V,F)}function E(t,e,n,r,a){n=n||10,r=null==r||r,w(t.length>1);const o=[[0,0,0]],s=[],l=[];for(let i=0;i<n;i++){s.push([0,-i-1,-(i+1)%n-1]);const t=i/n*2*Math.PI;l.push([Math.cos(t)*e,Math.sin(t)*e])}return M.createPathExtrusionGeometry(l,t,o,s,r,a)}function k(o,i,f,g,M,d=c(0,0,0)){const w=o.length,P=new Float32Array(i.length*w*3+(6*f.length||0)),U=new Float32Array(i.length*w*3+(f?6:0)),S=(i.length-1)*w*6+3*g.length*2,p=new Uint32Array(S),x=new Uint32Array(S);let v=0,T=0,L=0,R=0;const b=u(),G=u(),F=u(),V=u(),j=u(),C=u(),E=u(),k=h(),B=u(),D=u(),X=u(),q=u(),Z=u(),J=O();s(B,0,1,0),t(G,i[1],i[0]),n(G,G),M?(a(k,i[0],d),n(F,k)):s(F,0,0,1),H(G,F,B,B,j,F,z),l(V,F),l(q,j);for(let t=0;t<f.length;t++)r(C,j,f[t][0]),r(k,F,f[t][2]),a(C,C,k),a(C,C,i[0]),P[v++]=C[0],P[v++]=C[1],P[v++]=C[2];U[T++]=-G[0],U[T++]=-G[1],U[T++]=-G[2];for(let t=0;t<g.length;t++)p[L++]=g[t][0]>0?g[t][0]:-g[t][0]-1+f.length,p[L++]=g[t][1]>0?g[t][1]:-g[t][1]-1+f.length,p[L++]=g[t][2]>0?g[t][2]:-g[t][2]-1+f.length,x[R++]=0,x[R++]=0,x[R++]=0;let K=f.length;const Q=f.length-1;for(let s=0;s<i.length;s++){let c=!1;if(s>0){l(b,G),s<i.length-1?(t(G,i[s+1],i[s]),n(G,G)):c=!0,a(D,b,G),n(D,D),a(X,i[s-1],V),A(i[s],D,J);y(J,I(X,b),k)?(t(k,k,i[s]),n(F,k),e(j,D,F),n(j,j)):H(D,V,q,B,j,F,z),l(V,F),l(q,j)}M&&(a(k,i[s],d),n(Z,k));for(let t=0;t<w;t++)if(r(C,j,o[t][0]),r(k,F,o[t][1]),a(C,C,k),n(E,C),U[T++]=E[0],U[T++]=E[1],U[T++]=E[2],a(C,C,i[s]),P[v++]=C[0],P[v++]=C[1],P[v++]=C[2],!c){const e=(t+1)%w;p[L++]=K+t,p[L++]=K+w+t,p[L++]=K+e,p[L++]=K+e,p[L++]=K+w+t,p[L++]=K+w+e;for(let t=0;t<6;t++)x[R++]=p[L-6+t]-Q}K+=w}const W=i[i.length-1];for(let t=0;t<f.length;t++)r(C,j,f[t][0]),r(k,F,f[t][1]),a(C,C,k),a(C,C,W),P[v++]=C[0],P[v++]=C[1],P[v++]=C[2];const Y=T/3;U[T++]=G[0],U[T++]=G[1],U[T++]=G[2];const $=K-w;for(let t=0;t<g.length;t++)p[L++]=g[t][0]>=0?K+g[t][0]:-g[t][0]-1+$,p[L++]=g[t][2]>=0?K+g[t][2]:-g[t][2]-1+$,p[L++]=g[t][1]>=0?K+g[t][1]:-g[t][1]-1+$,x[R++]=Y,x[R++]=Y,x[R++]=Y;const _=[[N.POSITION,p],[N.NORMAL,x]],tt=[[N.POSITION,{size:3,data:P,exclusive:!0}],[N.NORMAL,{size:3,data:U,exclusive:!0}]];return new m(tt,_)}function B(t,e,n){w(t.length>1,"createPolylineGeometry(): polyline needs at least 2 points"),w(3===t[0].length,"createPolylineGeometry(): malformed vertex"),w(null==e||e.length===t.length,"createPolylineGeometry: need same number of points and normals"),w(null==e||3===e[0].length,"createPolylineGeometry(): malformed normal");const r=new Float64Array(3*t.length),a=new Uint32Array(2*(t.length-1));let o=0,s=0;for(let c=0;c<t.length;c++){for(let e=0;e<3;e++)r[o++]=t[c][e];c>0&&(a[s++]=c-1,a[s++]=c)}const l=[],i=[];if(l.push([N.POSITION,a]),i.push([N.POSITION,{size:3,data:r,exclusive:!0}]),e){const n=new Float32Array(3*e.length);let r=0;for(let a=0;a<t.length;a++)for(let t=0;t<3;t++)n[r++]=e[a][t];l.push([N.NORMAL,a]),i.push([N.NORMAL,{size:3,data:n,exclusive:!0}])}return n&&(i.push([N.COLOR,{size:4,data:n}]),l.push([N.COLOR,d(n.length/4)])),new m(i,l,g.Line)}function D(t,e,n,r,a=0){const o=new Array(18),s=[[-e,a,r/2],[n,a,r/2],[0,t+a,r/2],[-e,a,-r/2],[n,a,-r/2],[0,t+a,-r/2]],l=new Uint16Array([0,1,2,3,0,2,2,5,3,1,4,5,5,2,1,1,0,3,3,4,1,4,3,5]);for(let i=0;i<6;i++)o[3*i]=s[i][0],o[3*i+1]=s[i][1],o[3*i+2]=s[i][2];return new m([[N.POSITION,{size:3,data:o,exclusive:!0}]],[[N.POSITION,l]])}function X(t,e){const n=t.getMutableAttribute(N.POSITION).data;for(let r=0;r<n.length;r+=3){const t=n[r],a=n[r+1],o=n[r+2];s(v,t,a,o),i(v,v,e),n[r]=v[0],n[r+1]=v[1],n[r+2]=v[2]}}function q(t,e=t){const n=t.vertexAttributes,r=n.get(N.POSITION).data,a=n.get(N.NORMAL).data;if(a){const t=e.getMutableAttribute(N.NORMAL).data;for(let e=0;e<a.length;e+=3){const n=a[e+1];t[e+1]=-a[e+2],t[e+2]=n}}if(r){const t=e.getMutableAttribute(N.POSITION).data;for(let e=0;e<r.length;e+=3){const n=r[e+1];t[e+1]=-r[e+2],t[e+2]=n}}return e}function Z(t,r,a,s,l){return!(Math.abs(o(r,t))>l)&&(e(a,t,r),n(a,a),e(s,a,t),n(s,s),!0)}function H(t,e,n,r,a,o,s){return Z(t,e,a,o,s)||Z(t,n,a,o,s)||Z(t,r,a,o,s)}M.createSquareGeometry=V,M.createConeGeometry=j,M.createCylinderGeometry=C,M.createTubeGeometry=E,M.createPathExtrusionGeometry=k,M.createPolylineGeometry=B,M.createExtrudedTriangle=D,M.transformInPlace=X,M.cgToGIS=q,M.makeOrthoBasisDirUp=Z,M.makeOrthoBasisDirUpFallback=H}(x||(x={}));const z=.99619469809,v=u(),T=x;export{T as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as t}from"../../../../core/maybe.js";import{generateUID as i}from"../../../../core/uid.js";import{I as r}from"../../../../chunks/mat4f64.js";import{f as o}from"../../../../chunks/vec3.js";import{c as s}from"../../../../chunks/vec3f64.js";import{projectBuffer as e}from"../../../../geometry/projection.js";import{VertexAttribute as a,PrimitiveType as n}from"./basicInterfaces.js";import{Geometry as h}from"./Geometry.js";import{fromValues as c}from"./LocalOriginFactory.js";import{Object3D as m}from"./Object3D.js";import{WebGLLayer as d}from"./WebGLLayer.js";import{RibbonLineMaterial as g}from"../materials/RibbonLineMaterial.js";class f{constructor(t,r=125e4){this._originSR=t,this._gridSize=r,this._origins=new Map,this._objects=new Map,this._rootOriginId="root/"+i()}getOrigin(i){const r=this._origins.get(this._rootOriginId);if(null==r){if(t(_))return this._origins.set(this._rootOriginId,c(_[0],_[1],_[2],this._rootOriginId)),this.getOrigin(i);const r=c(i[0]+Math.random()-.5,i[1]+Math.random()-.5,i[2]+Math.random()-.5,this._rootOriginId);return this._origins.set(this._rootOriginId,r),r}const s=this._gridSize,e=Math.round(i[0]/s),a=Math.round(i[1]/s),n=Math.round(i[2]/s),h=`${e}/${a}/${n}`;let m=this._origins.get(h);const d=.5*s;if(o(j,i,r.vec3),j[0]=Math.abs(j[0]),j[1]=Math.abs(j[1]),j[2]=Math.abs(j[2]),j[0]<d&&j[1]<d&&j[2]<d){if(m){const t=Math.max(...j);o(j,i,m.vec3),j[0]=Math.abs(j[0]),j[1]=Math.abs(j[1]),j[2]=Math.abs(j[2]);if(Math.max(...j)<t)return m}return r}return m||(m=c(e*s,a*s,n*s,h),this._origins.set(h,m)),m}_drawOriginBox(t,i=[1,1,0,1]){const o=window.view,s=o._stage,c=i.toString();if(!this._objects.has(c)){this._material=new g({width:2,color:i}),s.add(this._material);const t=new d({isPickable:!1}),r=new m({castShadow:!1});s.add(r),t.add(r),s.add(t),this._objects.set(c,r)}const f=this._objects.get(c),_=[0,1,5,4,0,2,1,7,6,2,0,1,3,7,5,4,6,2,0],l=_.length,j=new Array(3*l),u=new Uint16Array(2*(l-1)),b=.5*this._gridSize;for(let r=0;r<l;r++)j[3*r+0]=t[0]+(1&_[r]?b:-b),j[3*r+1]=t[1]+(2&_[r]?b:-b),j[3*r+2]=t[2]+(4&_[r]?b:-b),r>0&&(u[2*r+0]=r-1,u[2*r+1]=r);e(j,this._originSR,0,j,o.renderSpatialReference,0,l);const p=new h([[a.POSITION,{size:3,data:j,exclusive:!0}]],[[a.POSITION,u]],n.Line);s.add(p),f.addGeometry(p,this._material,r)}}let _=null;function l(t){_=t}const j=s();export{f as GridLocalOriginFactory,l as default,l as setTestRootOrigin};
5
+ import{isSome as t}from"../../../../core/maybe.js";import{generateUID as i}from"../../../../core/uid.js";import{I as r}from"../../../../chunks/mat4f64.js";import{f as o}from"../../../../chunks/vec3.js";import{c as s}from"../../../../chunks/vec3f64.js";import{projectBuffer as e}from"../../../../geometry/projection.js";import{PrimitiveType as a}from"./basicInterfaces.js";import{Geometry as n}from"./Geometry.js";import{fromValues as h}from"./LocalOriginFactory.js";import{Object3D as m}from"./Object3D.js";import{VertexAttribute as c}from"./VertexAttribute.js";import{WebGLLayer as d}from"./WebGLLayer.js";import{RibbonLineMaterial as g}from"../materials/RibbonLineMaterial.js";class f{constructor(t,r=125e4){this._originSR=t,this._gridSize=r,this._origins=new Map,this._objects=new Map,this._rootOriginId="root/"+i()}getOrigin(i){const r=this._origins.get(this._rootOriginId);if(null==r){if(t(_))return this._origins.set(this._rootOriginId,h(_[0],_[1],_[2],this._rootOriginId)),this.getOrigin(i);const r=h(i[0]+Math.random()-.5,i[1]+Math.random()-.5,i[2]+Math.random()-.5,this._rootOriginId);return this._origins.set(this._rootOriginId,r),r}const s=this._gridSize,e=Math.round(i[0]/s),a=Math.round(i[1]/s),n=Math.round(i[2]/s),m=`${e}/${a}/${n}`;let c=this._origins.get(m);const d=.5*s;if(o(j,i,r.vec3),j[0]=Math.abs(j[0]),j[1]=Math.abs(j[1]),j[2]=Math.abs(j[2]),j[0]<d&&j[1]<d&&j[2]<d){if(c){const t=Math.max(...j);o(j,i,c.vec3),j[0]=Math.abs(j[0]),j[1]=Math.abs(j[1]),j[2]=Math.abs(j[2]);if(Math.max(...j)<t)return c}return r}return c||(c=h(e*s,a*s,n*s,m),this._origins.set(m,c)),c}_drawOriginBox(t,i=[1,1,0,1]){const o=window.view,s=o._stage,h=i.toString();if(!this._objects.has(h)){this._material=new g({width:2,color:i}),s.add(this._material);const t=new d({isPickable:!1}),r=new m({castShadow:!1});s.add(r),t.add(r),s.add(t),this._objects.set(h,r)}const f=this._objects.get(h),_=[0,1,5,4,0,2,1,7,6,2,0,1,3,7,5,4,6,2,0],l=_.length,j=new Array(3*l),u=new Uint16Array(2*(l-1)),b=.5*this._gridSize;for(let r=0;r<l;r++)j[3*r+0]=t[0]+(1&_[r]?b:-b),j[3*r+1]=t[1]+(2&_[r]?b:-b),j[3*r+2]=t[2]+(4&_[r]?b:-b),r>0&&(u[2*r+0]=r-1,u[2*r+1]=r);e(j,this._originSR,0,j,o.renderSpatialReference,0,l);const p=new n([[c.POSITION,{size:3,data:j,exclusive:!0}]],[[c.POSITION,u]],a.Line);s.add(p),f.addGeometry(p,this._material,r)}}let _=null;function l(t){_=t}const j=s();export{f as GridLocalOriginFactory,l as default,l as setTestRootOrigin};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import s from"../../../../core/Accessor.js";import r from"../../../../core/Evented.js";import t from"../../../../core/Handles.js";import{clamp as i}from"../../../../core/mathUtils.js";import{isNone as o,isSome as a}from"../../../../core/maybe.js";import{createTask as n}from"../../../../core/promiseUtils.js";import{createScreenPointArray as m,createRenderScreenPointArray as u,screenPointObjectToArray as l}from"../../../../core/screenUtils.js";import{isSVG as c}from"../../../../core/urlUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../../../core/accessorSupport/decorators/subclass.js";import{requestImage as d}from"../../../../support/requestImageUtils.js";import{VertexAttribute as _}from"./basicInterfaces.js";import{Pos2 as g}from"./DefaultVertexBufferLayouts.js";import{createQuadVAO as f}from"./glUtil3D.js";import{Program as T}from"./Program.js";import{build as v}from"../shaders/Magnifier.glsl.js";import{loadMagnifierResources as y}from"../../../magnifier/resources.js";import{PrimitiveType as k,BlendFactor as R,TextureType as L,PixelFormat as S,PixelType as x,TextureWrapMode as E,TextureSamplingMode as b}from"../../../webgl/enums.js";import{makePipelineState as j,simpleBlendingParams as A,defaultColorWriteParams as w}from"../../../webgl/renderState.js";import{Texture as M}from"../../../webgl/Texture.js";let U=class extends s{constructor(){super(...arguments),this._handles=new t,this._magnifier=null,this._imageSources=null,this._imageLoadTask=null,this._resources=null,this.events=new r,this.attributeLocations=new Map([[_.POSITION,0]]),this.tmpScreenPoint=m(),this.tmpRenderPoint=u()}get updating(){return o(this._imageSources)&&a(this._imageLoadTask)&&!this._imageLoadTask.task.finished}get magnifier(){return this._magnifier}set magnifier(e){if(e===this._magnifier)return;this._handles.removeAll(),this._magnifier=e;const s=()=>{this._updateResourceLoading(),this.events.emit("request-render")};a(this._magnifier)&&this._handles.add(this._magnifier.watch("version",s)),s()}get enabled(){return a(this._validMagnifier)}get _validMagnifier(){return a(this._magnifier)&&this._magnifier.visible&&a(this._magnifier.position)&&this._magnifier.size>0?this._magnifier:null}get factor(){return a(this._magnifier)&&this._magnifier.factor||1}dispose(){this._magnifier=null,this._handles.destroy(),a(this._imageLoadTask)&&(this._imageLoadTask.task.abort(),this._imageLoadTask=null),this._disposeResources()}render(e,s){const r=this._validMagnifier;if(o(r))return;const t=s.camera.pixelRatio,a=Math.ceil(t*r.size);if(this._updateResources(e,a),o(this._resources))return;const n=this._resources.program;e.useProgram(n);const m=this._resources.textures,u=Math.ceil(1/this.factor*a);m.input.resize(u,u);const c=s.camera.fullWidth,h=s.camera.fullHeight;l(r.position,this.tmpScreenPoint);const p=s.camera.screenToRender(this.tmpScreenPoint,this.tmpRenderPoint),d=.5*u,_=.5*u;p[0]=i(p[0],d,c-d-1),p[1]=i(p[1],_,h-_-1);const g=Math.floor(p[0]-d),f=Math.floor(p[1]-_);n.bindTexture(m.input,"textureInput"),e.gl.copyTexImage2D(m.input.descriptor.target,0,m.input.descriptor.pixelFormat,g,f,u,u,0);const T=r.offset.x*t,v=r.offset.y*t,y=(p[0]+T)/c*2-1,R=(p[1]-v)/h*2-1,L=a/c*2,S=a/h*2;e.bindVAO(this._resources.vao),n.bindTexture(m.overlay,"textureOverlay"),n.bindTexture(m.mask,"textureMask"),n.setUniform4f("drawPosition",y,R,L,S),n.setUniform1i("maskEnabled",r.maskEnabled?1:0),n.setUniform1i("overlayEnabled",r.overlayEnabled?1:0),e.setPipelineState(this._resources.pipelineState),e.drawArrays(k.TRIANGLE_STRIP,0,4)}_updateResourceLoading(){const e=this._validMagnifier;if(o(e))return;const s=e.maskUrl,r=e.overlayUrl;!a(this._imageLoadTask)||this._imageLoadTask.maskUrl===s&&this._imageLoadTask.overlayUrl===r||(this._imageLoadTask.task.abort(),this._imageLoadTask=null,this._imageSources=null),a(this._imageSources)||a(this._imageLoadTask)||(this._imageLoadTask={maskUrl:s,overlayUrl:r,task:n((async e=>{const t=o(s)||o(r)?y(e):null,i=a(s)?d(s,{signal:e}):t.then((e=>e.mask)),n=a(r)?d(r,{signal:e}):t.then((e=>e.overlay));this._imageSources={mask:await i,overlay:await n},this._disposeResources(),this.events.emit("request-render")}))},this._imageLoadTask.task.promise.then((()=>this.notifyChange("updating")),(()=>this.notifyChange("updating"))))}_updateResources(e,s){if(!this.enabled)return void this._disposeResources();if(a(this._resources)){if(this._resources.textures.size!==s){const r=this._createTextureResources(e,s);if(o(r))return void this._disposeResources();this._disposeTextureResources(this._resources.textures),this._resources.textures=r}return}const r=this._createTextureResources(e,s);o(r)||(this._resources={textures:r,program:this._createProgram(e),vao:f(e,g,this.attributeLocations,0,1),pipelineState:j({blending:A(R.ONE,R.ONE_MINUS_SRC_ALPHA),depthTest:null,depthWrite:null,colorWrite:w})})}_disposeResources(){o(this._resources)||(this._disposeTextureResources(this._resources.textures),this._resources.program.dispose(),this._resources.vao.dispose(),this._resources=null)}_disposeTextureResources(e){e.mask.dispose(),e.overlay.dispose(),e.input.dispose()}_createTextureResources(e,s){if(o(this._imageSources))return null;this._imageSources.overlay.width=s,this._imageSources.overlay.height=s,this._imageSources.mask.width=s,this._imageSources.mask.height=s;const r=new M(e,{target:L.TEXTURE_2D,pixelFormat:S.RGBA,internalFormat:S.RGBA,dataType:x.UNSIGNED_BYTE,wrapMode:E.CLAMP_TO_EDGE,samplingMode:b.LINEAR,flipped:!0,preMultiplyAlpha:!c(this._imageSources.overlay.src)||!e.driverTest.svgAlwaysPremultipliesAlpha},this._imageSources.overlay),t=new M(e,{target:L.TEXTURE_2D,pixelFormat:S.ALPHA,internalFormat:S.ALPHA,dataType:x.UNSIGNED_BYTE,wrapMode:E.CLAMP_TO_EDGE,samplingMode:b.LINEAR,flipped:!0},this._imageSources.mask);return{input:new M(e,{target:L.TEXTURE_2D,pixelFormat:S.RGBA,internalFormat:S.RGBA,dataType:x.UNSIGNED_BYTE,wrapMode:E.CLAMP_TO_EDGE,samplingMode:b.LINEAR,flipped:!1}),mask:t,overlay:r,size:s}}_createProgram(e){const s=v();return new T(e,s,this.attributeLocations)}};e([h()],U.prototype,"_imageSources",void 0),e([h()],U.prototype,"_imageLoadTask",void 0),e([h({readOnly:!0})],U.prototype,"updating",null),U=e([p("esri/views/3d/webgl-engine/lib/MagnifierHelper")],U);export{U as MagnifierHelper};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import s from"../../../../core/Accessor.js";import t from"../../../../core/Evented.js";import r from"../../../../core/Handles.js";import{clamp as i}from"../../../../core/mathUtils.js";import{isNone as o,isSome as a}from"../../../../core/maybe.js";import{createTask as n}from"../../../../core/promiseUtils.js";import{createScreenPointArray as m,createRenderScreenPointArray as u,screenPointObjectToArray as l}from"../../../../core/screenUtils.js";import{isSVG as h}from"../../../../core/urlUtils.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{requestImage as d}from"../../../../support/requestImageUtils.js";import{Pos2 as _}from"./DefaultVertexBufferLayouts.js";import{createQuadVAO as g}from"./glUtil3D.js";import{Program as f}from"./Program.js";import{VertexAttribute as T}from"./VertexAttribute.js";import{build as v}from"../shaders/Magnifier.glsl.js";import{loadMagnifierResources as y}from"../../../magnifier/resources.js";import{PrimitiveType as k,BlendFactor as R,TextureType as L,PixelFormat as S,PixelType as x,TextureWrapMode as E,TextureSamplingMode as b}from"../../../webgl/enums.js";import{makePipelineState as A,simpleBlendingParams as j,defaultColorWriteParams as w}from"../../../webgl/renderState.js";import{Texture as M}from"../../../webgl/Texture.js";let U=class extends s{constructor(){super(...arguments),this._handles=new r,this._magnifier=null,this._imageSources=null,this._imageLoadTask=null,this._resources=null,this.events=new t,this.attributeLocations=new Map([[T.POSITION,0]]),this.tmpScreenPoint=m(),this.tmpRenderPoint=u()}get updating(){return o(this._imageSources)&&a(this._imageLoadTask)&&!this._imageLoadTask.task.finished}get magnifier(){return this._magnifier}set magnifier(e){if(e===this._magnifier)return;this._handles.removeAll(),this._magnifier=e;const s=()=>{this._updateResourceLoading(),this.events.emit("request-render")};a(this._magnifier)&&this._handles.add(this._magnifier.watch("version",s)),s()}get enabled(){return a(this._validMagnifier)}get _validMagnifier(){return a(this._magnifier)&&this._magnifier.visible&&a(this._magnifier.position)&&this._magnifier.size>0?this._magnifier:null}get factor(){return a(this._magnifier)&&this._magnifier.factor||1}dispose(){this._magnifier=null,this._handles.destroy(),a(this._imageLoadTask)&&(this._imageLoadTask.task.abort(),this._imageLoadTask=null),this._disposeResources()}render(e,s){const t=this._validMagnifier;if(o(t))return;const r=s.camera.pixelRatio,a=Math.ceil(r*t.size);if(this._updateResources(e,a),o(this._resources))return;const n=this._resources.program;e.useProgram(n);const m=this._resources.textures,u=Math.ceil(1/this.factor*a);m.input.resize(u,u);const h=s.camera.fullWidth,p=s.camera.fullHeight;l(t.position,this.tmpScreenPoint);const c=s.camera.screenToRender(this.tmpScreenPoint,this.tmpRenderPoint),d=.5*u,_=.5*u;c[0]=i(c[0],d,h-d-1),c[1]=i(c[1],_,p-_-1);const g=Math.floor(c[0]-d),f=Math.floor(c[1]-_);n.bindTexture(m.input,"textureInput"),e.gl.copyTexImage2D(m.input.descriptor.target,0,m.input.descriptor.pixelFormat,g,f,u,u,0);const T=t.offset.x*r,v=t.offset.y*r,y=(c[0]+T)/h*2-1,R=(c[1]-v)/p*2-1,L=a/h*2,S=a/p*2;e.bindVAO(this._resources.vao),n.bindTexture(m.overlay,"textureOverlay"),n.bindTexture(m.mask,"textureMask"),n.setUniform4f("drawPosition",y,R,L,S),n.setUniform1i("maskEnabled",t.maskEnabled?1:0),n.setUniform1i("overlayEnabled",t.overlayEnabled?1:0),e.setPipelineState(this._resources.pipelineState),e.drawArrays(k.TRIANGLE_STRIP,0,4)}_updateResourceLoading(){const e=this._validMagnifier;if(o(e))return;const s=e.maskUrl,t=e.overlayUrl;!a(this._imageLoadTask)||this._imageLoadTask.maskUrl===s&&this._imageLoadTask.overlayUrl===t||(this._imageLoadTask.task.abort(),this._imageLoadTask=null,this._imageSources=null),a(this._imageSources)||a(this._imageLoadTask)||(this._imageLoadTask={maskUrl:s,overlayUrl:t,task:n((async e=>{const r=o(s)||o(t)?y(e):null,i=a(s)?d(s,{signal:e}):r.then((e=>e.mask)),n=a(t)?d(t,{signal:e}):r.then((e=>e.overlay));this._imageSources={mask:await i,overlay:await n},this._disposeResources(),this.events.emit("request-render")}))},this._imageLoadTask.task.promise.then((()=>this.notifyChange("updating")),(()=>this.notifyChange("updating"))))}_updateResources(e,s){if(!this.enabled)return void this._disposeResources();if(a(this._resources)){if(this._resources.textures.size!==s){const t=this._createTextureResources(e,s);if(o(t))return void this._disposeResources();this._disposeTextureResources(this._resources.textures),this._resources.textures=t}return}const t=this._createTextureResources(e,s);o(t)||(this._resources={textures:t,program:this._createProgram(e),vao:g(e,_,this.attributeLocations,0,1),pipelineState:A({blending:j(R.ONE,R.ONE_MINUS_SRC_ALPHA),depthTest:null,depthWrite:null,colorWrite:w})})}_disposeResources(){o(this._resources)||(this._disposeTextureResources(this._resources.textures),this._resources.program.dispose(),this._resources.vao.dispose(),this._resources=null)}_disposeTextureResources(e){e.mask.dispose(),e.overlay.dispose(),e.input.dispose()}_createTextureResources(e,s){if(o(this._imageSources))return null;this._imageSources.overlay.width=s,this._imageSources.overlay.height=s,this._imageSources.mask.width=s,this._imageSources.mask.height=s;const t=new M(e,{target:L.TEXTURE_2D,pixelFormat:S.RGBA,internalFormat:S.RGBA,dataType:x.UNSIGNED_BYTE,wrapMode:E.CLAMP_TO_EDGE,samplingMode:b.LINEAR,flipped:!0,preMultiplyAlpha:!h(this._imageSources.overlay.src)||!e.driverTest.svgAlwaysPremultipliesAlpha},this._imageSources.overlay),r=new M(e,{target:L.TEXTURE_2D,pixelFormat:S.ALPHA,internalFormat:S.ALPHA,dataType:x.UNSIGNED_BYTE,wrapMode:E.CLAMP_TO_EDGE,samplingMode:b.LINEAR,flipped:!0},this._imageSources.mask);return{input:new M(e,{target:L.TEXTURE_2D,pixelFormat:S.RGBA,internalFormat:S.RGBA,dataType:x.UNSIGNED_BYTE,wrapMode:E.CLAMP_TO_EDGE,samplingMode:b.LINEAR,flipped:!1}),mask:r,overlay:t,size:s}}_createProgram(e){const s=v();return new f(e,s,this.attributeLocations)}};e([p()],U.prototype,"_imageSources",void 0),e([p()],U.prototype,"_imageLoadTask",void 0),e([p({readOnly:!0})],U.prototype,"updating",null),U=e([c("esri/views/3d/webgl-engine/lib/MagnifierHelper")],U);export{U as MagnifierHelper};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as e}from"../../../../core/maybe.js";import{ContentObject as r}from"./ContentObject.js";import{ContentObjectType as t}from"./ContentObjectType.js";import{Default3D as s}from"./DefaultVertexAttributeLocations.js";import{copyParameters as i,updateParameters as a}from"../materials/internal/MaterialUtil.js";class n extends r{constructor(e,r){super(),this.type=t.Material,this.supportsEdges=!1,this._visible=!0,this._renderPriority=0,this._insertOrder=0,this._vertexAttributeLocations=s,this._parameters=i(e,r),this.validateParameters(this._parameters)}dispose(){}get parameters(){return this._parameters}update(e){return!1}setParameters(e){a(this._parameters,e)&&(this.validateParameters(this._parameters),this.parametersChanged())}validateParameters(e){}get visible(){return this._visible}set visible(e){e!==this._visible&&(this._visible=e,this.parametersChanged())}shouldRender(e){return this.isVisible()&&this.isVisibleInPass(e.pass)&&0!=(this.renderOccluded&e.renderOccludedMask)}isVisibleInPass(e){return!0}get renderOccluded(){return this.parameters.renderOccluded}get renderPriority(){return this._renderPriority}set renderPriority(e){e!==this._renderPriority&&(this._renderPriority=e,this.parametersChanged())}get insertOrder(){return this._insertOrder}set insertOrder(e){e!==this._insertOrder&&(this._insertOrder=e,this.parametersChanged())}get vertexAttributeLocations(){return this._vertexAttributeLocations}isVisible(){return this._visible}parametersChanged(){e(this.repository)&&this.repository.materialChanged(this)}}var d;!function(e){e[e.Occlude=1]="Occlude",e[e.Transparent=2]="Transparent",e[e.OccludeAndTransparent=4]="OccludeAndTransparent",e[e.OccludeAndTransparentStencil=8]="OccludeAndTransparentStencil",e[e.Opaque=16]="Opaque"}(d||(d={}));const h={renderOccluded:d.Occlude};export{n as Material,d as RenderOccludedFlag,h as materialParametersDefaults};
5
+ import{isSome as e}from"../../../../core/maybe.js";import{ContentObject as r}from"./ContentObject.js";import{ContentObjectType as t}from"./ContentObjectType.js";import{Default3D as s}from"./DefaultVertexAttributeLocations.js";import{copyParameters as i,updateParameters as a}from"../materials/internal/MaterialUtil.js";class n extends r{constructor(e,r){super(),this.type=t.Material,this.supportsEdges=!1,this._visible=!0,this._renderPriority=0,this._insertOrder=0,this._vertexAttributeLocations=s,this._parameters=i(e,r),this.validateParameters(this._parameters)}dispose(){}get parameters(){return this._parameters}update(e){return!1}setParameters(e){a(this._parameters,e)&&(this.validateParameters(this._parameters),this.parametersChanged())}validateParameters(e){}get visible(){return this._visible}set visible(e){e!==this._visible&&(this._visible=e,this.parametersChanged())}shouldRender(e){return this.isVisible()&&this.isVisibleInPass(e.pass)&&0!=(this.renderOccluded&e.renderOccludedMask)}isVisibleInPass(e){return!0}get renderOccluded(){return this.parameters.renderOccluded}get renderPriority(){return this._renderPriority}set renderPriority(e){e!==this._renderPriority&&(this._renderPriority=e,this.parametersChanged())}get insertOrder(){return this._insertOrder}set insertOrder(e){e!==this._insertOrder&&(this._insertOrder=e,this.parametersChanged())}get vertexAttributeLocations(){return this._vertexAttributeLocations}isVisible(){return this._visible}parametersChanged(){e(this.repository)&&this.repository.materialChanged(this)}}var d;!function(e){e[e.Occlude=1]="Occlude",e[e.Transparent=2]="Transparent",e[e.OccludeAndTransparent=4]="OccludeAndTransparent",e[e.OccludeAndTransparentStencil=8]="OccludeAndTransparentStencil",e[e.Opaque=16]="Opaque"}(d||(d={}));const h={renderOccluded:d.Occlude};export{h as DefaultMaterialParameters,n as Material,d as RenderOccludedFlag};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{unwrapOr as t,isNone as r,isSome as i}from"../../../../core/maybe.js";import{generateUID as s}from"../../../../core/uid.js";import{c as a}from"../../../../chunks/mat4.js";import{c as n,I as e}from"../../../../chunks/mat4f64.js";import{m as o}from"../../../../chunks/vec3.js";import{c as h}from"../../../../chunks/vec4f64.js";import{maxScale as m}from"../../support/mathUtils.js";import{VertexAttribute as c,Object3DState as d}from"./basicInterfaces.js";import{computeAttachmentOriginTriangles as f}from"./geometryDataUtils.js";import{InstanceParameters as u}from"./InstanceParameters.js";import{Object3DStateID as g}from"./Object3DStateID.js";import{addObject3DStateID as l,removeObject3DStateID as p}from"../materials/renderers/utils.js";class T{constructor(r,i,a={}){this.data=r,this.material=i,this.boundingSphere=h(),this.instanceParameters=new u,this._transformation=n(),this._shaderTransformationDirty=!0,this.layerUid=t(a.layerUid,null),this.graphicUid=t(a.graphicUid,null),this.id=a.id?a.id:s(),this.boundingInfo=t(a.boundingInfo,null),this.calculateShaderTransformation=t(this.calculateShaderTransformation,null),this.castShadow=!!a.castShadow&&a.castShadow}get transformation(){return this._transformation}updateTransformation(t){t(this._transformation),this._shaderTransformationDirty=!0,this.computeBoundingSphere(this._transformation,this.boundingSphere)}shaderTransformationChanged(){this._shaderTransformationDirty=!0}computeBoundingSphere(t,i,s=m(t)){r(this.boundingInfo)||(o(i,this.boundingInfo.getCenter(),t),i[3]=this.boundingInfo.getBSRadius()*s)}get hasShaderTransformation(){return i(this.calculateShaderTransformation)}get primitiveType(){return this.data.primitiveType}getShaderTransformation(){return r(this.calculateShaderTransformation)?t(this.transformation,e):(this._shaderTransformationDirty&&(this._shaderTransformation||(this._shaderTransformation=n()),a(this._shaderTransformation,this.calculateShaderTransformation(t(this.transformation,e))),this._shaderTransformationDirty=!1),this._shaderTransformation)}computeAttachmentOrigin(t){if(this.material.computeAttachmentOrigin)return!!this.material.computeAttachmentOrigin(this,t)&&(i(this._transformation)&&o(t,t,this._transformation),!0);const r=this.indices.get(c.POSITION),s=this.vertexAttributes.get(c.POSITION);return!!f(s,r,t)&&(i(this._transformation)&&o(t,t,this._transformation),!0)}get indices(){return this.data.indices}get vertexAttributes(){return this.data.vertexAttributes}addHighlight(){const t=new g(d.Highlight),r=this.instanceParameters;return r.highlights=l(r.highlights,t),t}removeHighlight(t){const r=this.instanceParameters;r.highlights=p(r.highlights,t)}}class S extends T{}export{T as RenderGeometry,S as ValidatedRenderGeometry};
5
+ import{unwrapOr as t,isNone as r,isSome as i}from"../../../../core/maybe.js";import{generateUID as s}from"../../../../core/uid.js";import{c as a}from"../../../../chunks/mat4.js";import{c as n,I as e}from"../../../../chunks/mat4f64.js";import{m as o}from"../../../../chunks/vec3.js";import{c as h}from"../../../../chunks/vec4f64.js";import{maxScale as m}from"../../support/mathUtils.js";import{Object3DState as c}from"./basicInterfaces.js";import{computeAttachmentOriginTriangles as d}from"./geometryDataUtils.js";import{InstanceParameters as f}from"./InstanceParameters.js";import{Object3DStateID as u}from"./Object3DStateID.js";import{VertexAttribute as g}from"./VertexAttribute.js";import{addObject3DStateID as l,removeObject3DStateID as p}from"../materials/renderers/utils.js";class T{constructor(r,i,a={}){this.data=r,this.material=i,this.boundingSphere=h(),this.instanceParameters=new f,this._transformation=n(),this._shaderTransformationDirty=!0,this.layerUid=t(a.layerUid,null),this.graphicUid=t(a.graphicUid,null),this.id=a.id?a.id:s(),this.boundingInfo=t(a.boundingInfo,null),this.calculateShaderTransformation=t(this.calculateShaderTransformation,null),this.castShadow=!!a.castShadow&&a.castShadow}get transformation(){return this._transformation}updateTransformation(t){t(this._transformation),this._shaderTransformationDirty=!0,this.computeBoundingSphere(this._transformation,this.boundingSphere)}shaderTransformationChanged(){this._shaderTransformationDirty=!0}computeBoundingSphere(t,i,s=m(t)){r(this.boundingInfo)||(o(i,this.boundingInfo.getCenter(),t),i[3]=this.boundingInfo.getBSRadius()*s)}get hasShaderTransformation(){return i(this.calculateShaderTransformation)}get primitiveType(){return this.data.primitiveType}getShaderTransformation(){return r(this.calculateShaderTransformation)?t(this.transformation,e):(this._shaderTransformationDirty&&(this._shaderTransformation||(this._shaderTransformation=n()),a(this._shaderTransformation,this.calculateShaderTransformation(t(this.transformation,e))),this._shaderTransformationDirty=!1),this._shaderTransformation)}computeAttachmentOrigin(t){if(this.material.computeAttachmentOrigin)return!!this.material.computeAttachmentOrigin(this,t)&&(i(this._transformation)&&o(t,t,this._transformation),!0);const r=this.indices.get(g.POSITION),s=this.vertexAttributes.get(g.POSITION);return!!d(s,r,t)&&(i(this._transformation)&&o(t,t,this._transformation),!0)}get indices(){return this.data.indices}get vertexAttributes(){return this.data.vertexAttributes}addHighlight(){const t=new u(c.Highlight),r=this.instanceParameters;return r.highlights=l(r.highlights,t),t}removeHighlight(t){const r=this.instanceParameters;r.highlights=p(r.highlights,t)}}class S extends T{}export{T as RenderGeometry,S as ValidatedRenderGeometry};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{disposeMaybe as e,applySome as t,isSome as s,isNone as i}from"../../../../core/maybe.js";import{a as r}from"../../../../chunks/vec2f64.js";import{i as h}from"../../../../chunks/vec3.js";import{c as o}from"../../../../chunks/vec4f64.js";import{requestImage as a}from"../../../../support/requestImageUtils.js";import{createQuadVAO as n}from"./glUtil3D.js";import{SSAOTechniqueConfiguration as u,SSAOTechnique as l}from"./SSAOTechnique.js";import{inverseProjectionInfo as _}from"./Util.js";import{S as b}from"../../../../chunks/SSAO.glsl.js";import{PrimitiveType as m,TextureType as f,PixelFormat as d,PixelType as c,TextureSamplingMode as p,TextureWrapMode as O,TargetType as T,DepthStencilTargetType as x}from"../../../webgl/enums.js";import{FramebufferObject as F}from"../../../webgl/FramebufferObject.js";import{Texture as B}from"../../../webgl/Texture.js";import{vertexCount as g}from"../../../webgl/Util.js";class S{constructor(e,t,s){this._techniqueRep=e,this._rctx=t,this._requestRender=s,this._enabled=!1,this._ssaoTechniqueConfig=new u,this.quadVAO=null,this._blurSizePx=2,this._attenuation=.5}dispose(){this.quadVAO=e(this.quadVAO)}disposeOffscreenBuffers(){t(this._ssaoFBO,(e=>e.resize(0,0))),t(this._blur0FBO,(e=>e.resize(0,0))),t(this._blur1FBO,(e=>e.resize(0,0)))}set enabled(e){e?this._enable():this._disable()}get enabled(){return this._enabled}get ready(){return this.enabled&&s(this._noiseTexture)&&s(this._ssaoFBO)&&s(this._blur0FBO)&&s(this._blur1FBO)}computeSSAO(e,t,s){if(!this.enabled||i(t)||i(s)||i(this._noiseTexture)||i(this._ssaoFBO)||i(this._blur0FBO)||i(this._blur1FBO))return;const r=this._rctx,o=e.fullViewport,a=o[2],u=o[3],l=a/this._blurSizePx,b=u/this._blurSizePx;this._ssaoFBO.resize(a,u),this._blur0FBO.resize(l,b),this._blur1FBO.resize(l,b);const f=1,d=1,c=a*f,p=u*d;r.bindFramebuffer(this._ssaoFBO),r.setViewport(0,0,a,u);const O=this._ssaoTechnique.program;r.useProgram(O),this._ssaoTechnique.bindPipelineState(r),O.setUniform2f("rnmScale",a/this._noiseTexture.descriptor.width,u/this._noiseTexture.descriptor.height),_(e.projectionMatrix,e.fullWidth,e.fullHeight,q,A),O.setUniform4fv("projInfo",q),O.setUniform2fv("zScale",A),O.setUniform2f("nearFar",e.near,e.far);let T=1/e.computeRenderPixelSizeAtDist(1);O.setUniform1f("projScale",T*f),O.setUniform2f("screenDimensions",c,p);const x=h(e.eye,e.center);let F=20*e.computeRenderPixelSizeAtDist(x);F=Math.max(.1,F),O.setUniform1f("radius",F),O.setUniform1f("intensity",4*this._attenuation/F**6),O.bindTexture(this._noiseTexture,"rnm"),O.bindTexture(s,"normalMap"),O.bindTexture(t,"depthMap"),i(this.quadVAO)&&(this.quadVAO=n(this._rctx)),r.bindVAO(this.quadVAO),r.drawArrays(m.TRIANGLE_STRIP,0,g(this.quadVAO,"geometry"));const B=this._blurTechnique.program;r.useProgram(B),B.bindTexture(this._ssaoFBO.colorTexture,"tex"),B.bindTexture(s,"normalMap"),B.bindTexture(t,"depthMap"),r.setViewport(0,0,c/this._blurSizePx,p/this._blurSizePx),r.bindFramebuffer(this._blur0FBO),B.setUniform2f("screenDimensions",c,p),B.setUniform2f("blurSize",0,this._blurSizePx*f/p),B.setUniform2f("nearFar",e.near,e.far),x>5e4&&(T=Math.max(0,T-(x-5e4))),B.setUniform1f("projScale",T),r.drawArrays(m.TRIANGLE_STRIP,0,g(this.quadVAO,"geometry")),B.setUniform2f("blurSize",this._blurSizePx*d/c,0),r.bindFramebuffer(this._blur1FBO),B.bindTexture(this._blur0FBO.colorTexture,"tex"),r.drawArrays(m.TRIANGLE_STRIP,0,g(this.quadVAO,"geometry")),r.setViewport(o[0],o[1],o[2],o[3])}bind(e,t){this.enabled&&s(this._blur1FBO)&&s(this._ssaoFBO)?(e.bindTexture(this._blur1FBO.colorTexture,"ssaoTex"),e.setUniform4f("viewportPixelSz",t.fullViewport[0],t.fullViewport[1],1/this._ssaoFBO.width,1/this._ssaoFBO.height)):e.setUniform4f("viewportPixelSz",-1,-1,-1,-1)}_selectPrograms(){this._ssaoTechniqueConfig.output=b.SSAO,this._ssaoTechnique=this._techniqueRep.releaseAndAcquire(l,this._ssaoTechniqueConfig,this._ssaoTechnique),this._ssaoTechniqueConfig.output=b.Blur,this._blurTechnique=this._techniqueRep.releaseAndAcquire(l,this._ssaoTechniqueConfig,this._blurTechnique)}_enable(){this.enabled||(this._enabled=!0,this._loadResources((()=>{this._enabled&&this._initialize()})))}_loadResources(e){this._data?e():import("./SSAOHelperData.js").then((t=>{this._data=t,e()}))}_initialize(){const e={target:f.TEXTURE_2D,pixelFormat:d.RGBA,dataType:c.UNSIGNED_BYTE,samplingMode:p.LINEAR,wrapMode:O.CLAMP_TO_EDGE,width:0,height:0},t={colorTarget:T.TEXTURE,depthStencilTarget:x.NONE};a(this._data.noiseTexture).then((s=>{this._enabled&&(this._ssaoFBO=new F(this._rctx,t,e),this._blur0FBO=new F(this._rctx,t,e),this._blur1FBO=new F(this._rctx,t,e),this._noiseTexture=new B(this._rctx,{target:f.TEXTURE_2D,pixelFormat:d.RGBA,dataType:c.UNSIGNED_BYTE,hasMipmap:!0,width:s.width,height:s.height},s),this._requestRender())})),this._selectPrograms()}_disable(){this._enabled=!1,this._noiseTexture=e(this._noiseTexture),this._blur1FBO=e(this._blur1FBO),this._blur0FBO=e(this._blur0FBO),this._ssaoFBO=e(this._ssaoFBO)}get gpuMemoryUsage(){return(s(this._blur0FBO)?this._blur0FBO.gpuMemoryUsage:0)+(s(this._blur1FBO)?this._blur1FBO.gpuMemoryUsage:0)+(s(this._ssaoFBO)?this._ssaoFBO.gpuMemoryUsage:0)}get test(){return{ssao:this._ssaoFBO,blur:this._blur1FBO}}}const A=r(),q=o();export{S as SSAOHelper};
5
+ import{disposeMaybe as e,applySome as t,isSome as s,isNone as i}from"../../../../core/maybe.js";import{a as r}from"../../../../chunks/vec2f64.js";import{i as h}from"../../../../chunks/vec3.js";import{c as o}from"../../../../chunks/vec4f64.js";import{requestImage as a}from"../../../../support/requestImageUtils.js";import{createQuadVAO as n}from"./glUtil3D.js";import{SSAOTechniqueConfiguration as u,SSAOTechnique as l}from"./SSAOTechnique.js";import{inverseProjectionInfo as _}from"./Util.js";import{S as b}from"../../../../chunks/SSAO.glsl.js";import{PrimitiveType as m,TextureType as d,PixelFormat as f,PixelType as c,TextureSamplingMode as p,TextureWrapMode as O,TargetType as T,DepthStencilTargetType as F}from"../../../webgl/enums.js";import{FramebufferObject as x}from"../../../webgl/FramebufferObject.js";import{Texture as B}from"../../../webgl/Texture.js";import{vertexCount as g}from"../../../webgl/Util.js";class S{constructor(e,t,s){this._techniqueRep=e,this._rctx=t,this._requestRender=s,this._enabled=!1,this._ssaoTechniqueConfig=new u,this.quadVAO=null,this._blurSizePx=2,this._attenuation=.5}dispose(){this.quadVAO=e(this.quadVAO)}disposeOffscreenBuffers(){t(this._ssaoFBO,(e=>e.resize(0,0))),t(this._blur0FBO,(e=>e.resize(0,0))),t(this._blur1FBO,(e=>e.resize(0,0)))}set enabled(e){e?this._enable():this._disable()}get enabled(){return this._enabled}get ready(){return this.enabled&&s(this._noiseTexture)&&s(this._ssaoFBO)&&s(this._blur0FBO)&&s(this._blur1FBO)}computeSSAO(e,t,s){if(!this.enabled||i(t)||i(s)||i(this._noiseTexture)||i(this._ssaoFBO)||i(this._blur0FBO)||i(this._blur1FBO))return;const r=this._rctx,o=e.fullViewport,a=o[2],u=o[3],l=a/this._blurSizePx,b=u/this._blurSizePx;this._ssaoFBO.resize(a,u),this._blur0FBO.resize(l,b),this._blur1FBO.resize(l,b);const d=1,f=1,c=a*d,p=u*f;r.bindFramebuffer(this._ssaoFBO),r.setViewport(0,0,a,u);const O=this._ssaoTechnique.program;r.useProgram(O),this._ssaoTechnique.bindPipelineState(r),O.setUniform2f("rnmScale",a/this._noiseTexture.descriptor.width,u/this._noiseTexture.descriptor.height),_(e.projectionMatrix,e.fullWidth,e.fullHeight,q,A),O.setUniform4fv("projInfo",q),O.setUniform2fv("zScale",A),O.setUniform2fv("nearFar",e.nearFar);let T=1/e.computeRenderPixelSizeAtDist(1);O.setUniform1f("projScale",T*d),O.setUniform2f("screenDimensions",c,p);const F=h(e.eye,e.center);let x=20*e.computeRenderPixelSizeAtDist(F);x=Math.max(.1,x),O.setUniform1f("radius",x),O.setUniform1f("intensity",4*this._attenuation/x**6),O.bindTexture(this._noiseTexture,"rnm"),O.bindTexture(s,"normalMap"),O.bindTexture(t,"depthMap"),i(this.quadVAO)&&(this.quadVAO=n(this._rctx)),r.bindVAO(this.quadVAO),r.drawArrays(m.TRIANGLE_STRIP,0,g(this.quadVAO,"geometry"));const B=this._blurTechnique.program;r.useProgram(B),B.bindTexture(this._ssaoFBO.colorTexture,"tex"),B.bindTexture(s,"normalMap"),B.bindTexture(t,"depthMap"),r.setViewport(0,0,c/this._blurSizePx,p/this._blurSizePx),r.bindFramebuffer(this._blur0FBO),B.setUniform2f("screenDimensions",c,p),B.setUniform2f("blurSize",0,this._blurSizePx*d/p),B.setUniform2fv("nearFar",e.nearFar),F>5e4&&(T=Math.max(0,T-(F-5e4))),B.setUniform1f("projScale",T),r.drawArrays(m.TRIANGLE_STRIP,0,g(this.quadVAO,"geometry")),B.setUniform2f("blurSize",this._blurSizePx*f/c,0),r.bindFramebuffer(this._blur1FBO),B.bindTexture(this._blur0FBO.colorTexture,"tex"),r.drawArrays(m.TRIANGLE_STRIP,0,g(this.quadVAO,"geometry")),r.setViewport(o[0],o[1],o[2],o[3])}bind(e,t){this.enabled&&s(this._blur1FBO)&&s(this._ssaoFBO)?(e.bindTexture(this._blur1FBO.colorTexture,"ssaoTex"),e.setUniform4f("viewportPixelSz",t.fullViewport[0],t.fullViewport[1],1/this._ssaoFBO.width,1/this._ssaoFBO.height)):e.setUniform4f("viewportPixelSz",-1,-1,-1,-1)}_selectPrograms(){this._ssaoTechniqueConfig.output=b.SSAO,this._ssaoTechnique=this._techniqueRep.releaseAndAcquire(l,this._ssaoTechniqueConfig,this._ssaoTechnique),this._ssaoTechniqueConfig.output=b.Blur,this._blurTechnique=this._techniqueRep.releaseAndAcquire(l,this._ssaoTechniqueConfig,this._blurTechnique)}_enable(){this.enabled||(this._enabled=!0,this._loadResources((()=>{this._enabled&&this._initialize()})))}_loadResources(e){this._data?e():import("./SSAOHelperData.js").then((t=>{this._data=t,e()}))}_initialize(){const e={target:d.TEXTURE_2D,pixelFormat:f.RGBA,dataType:c.UNSIGNED_BYTE,samplingMode:p.LINEAR,wrapMode:O.CLAMP_TO_EDGE,width:0,height:0},t={colorTarget:T.TEXTURE,depthStencilTarget:F.NONE};a(this._data.noiseTexture).then((s=>{this._enabled&&(this._ssaoFBO=new x(this._rctx,t,e),this._blur0FBO=new x(this._rctx,t,e),this._blur1FBO=new x(this._rctx,t,e),this._noiseTexture=new B(this._rctx,{target:d.TEXTURE_2D,pixelFormat:f.RGBA,dataType:c.UNSIGNED_BYTE,hasMipmap:!0,width:s.width,height:s.height},s),this._requestRender())})),this._selectPrograms()}_disable(){this._enabled=!1,this._noiseTexture=e(this._noiseTexture),this._blur1FBO=e(this._blur1FBO),this._blur0FBO=e(this._blur0FBO),this._ssaoFBO=e(this._ssaoFBO)}get gpuMemoryUsage(){return(s(this._blur0FBO)?this._blur0FBO.gpuMemoryUsage:0)+(s(this._blur1FBO)?this._blur1FBO.gpuMemoryUsage:0)+(s(this._ssaoFBO)?this._ssaoFBO.gpuMemoryUsage:0)}get test(){return{ssao:this._ssaoFBO,blur:this._blur1FBO}}}const A=r(),q=o();export{S as SSAOHelper};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{equals as i}from"../../../../core/arrayUtils.js";import s from"../../../../core/Handles.js";import{smoothstep as r}from"../../../../core/mathUtils.js";import{isNone as a,disposeMaybe as o}from"../../../../core/maybe.js";import{watch as n,syncAndInitial as h}from"../../../../core/reactiveUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../../core/accessorSupport/decorators/subclass.js";import{j as u,a as l}from"../../../../chunks/mat4.js";import{c as m}from"../../../../chunks/mat4f64.js";import{a as p}from"../../../../chunks/vec2f64.js";import{y as d,g}from"../../../../chunks/vec3.js";import{c as f}from"../../../../chunks/vec3f64.js";import{c as w}from"../../../../chunks/vec4f64.js";import v from"./Camera.js";import{ZERO as b}from"./depthRange.js";import{createQuadVAO as S}from"./glUtil3D.js";import{ShadowCastRenderer as j,shadowCastDisabledElevationThreshold as y,shadowCastDisableElevationMax as A,shadowCastDisableElevationMin as C}from"./ShadowCastRenderer.js";import R from"./ShadowMap.js";import{inverseProjectionInfo as T}from"./Util.js";import{S as D,s as F}from"../../../../chunks/ShadowCast.glsl.js";import{ShadowCastTechniqueConfiguration as E,ShadowCastTechnique as x}from"../shaders/ShadowCastTechnique.js";import{TaskPriority as M}from"../../../support/Scheduler.js";import{TargetType as P,DepthStencilTargetType as q,TextureType as U,PixelFormat as V,PixelType as I,TextureSamplingMode as k,TextureWrapMode as L,ClearBufferBit as O}from"../../../webgl/enums.js";import{FramebufferObject as N}from"../../../webgl/FramebufferObject.js";import{vertexCount as z}from"../../../webgl/Util.js";var B;let H=B=class extends t{constructor(e,t,i,r,o,c){super({}),this._rctx=e,this._stage=i,this._prepareForShadowMapPass=r,this._renderToShadowMap=o,this._requestRender=c,this._progress=0,this._sampleCount=0,this._cachedCamera=new v,this._contentCamera=new v,this._enabled=!1,this._cachedLightDirections=[],this._depthRange=b,this._previewing=!1,this._handles=new s,this._cameraForcedForScreenshot=!1,this._shadowMap=new R(e,i.viewingMode),this._shadowMap.enabled=!0,this._vao=S(e);const _={colorTarget:P.TEXTURE,depthStencilTarget:q.NONE,width:0,height:0},u={target:U.TEXTURE_2D,pixelFormat:V.RGBA,dataType:I.UNSIGNED_BYTE,samplingMode:k.LINEAR,wrapMode:L.CLAMP_TO_EDGE,width:0,height:0};this._fbo=new N(e,_,u),this._accumulationParams={camera:this._cachedCamera,linearDepthTexture:null,shadowMap:this._shadowMap,inverseView:m(),projInfo:w(),zScale:p()},this._accumulationRenderer=new j(t,e,this,c);const l=this._stage.resourceController.scheduler;this._handles.add(l.registerTask(M.SHADOW_ACCUMULATOR,this)),this._handles.add(n((()=>i.renderView),(e=>{this._handles.remove(B.renderViewHandleKey),a(e)||this._handles.add(e.events.on("force-camera-for-screenshot",(()=>this._cameraForcedForScreenshot=!0)),B.renderViewHandleKey)}),h))}normalizeCtorArgs(){return{}}get computedSamples(){return this._progress}get shadowCastTexture(){return this._fbo.colorTexture}get isAccumulating(){return this._isPreviewing||this._isRefining}get accumulationTechnique(){if(a(this._accumulationTechnique)){const e={rctx:this._rctx,viewingMode:this._stage.viewingMode},t=new E;t.pass=D.Accumulate,this._accumulationTechnique=new x(e,t)}return this._accumulationTechnique}get _isRefining(){return this._isActive&&!this._isDoneAccumulating&&!this._previewing}get _isPreviewing(){return this._isActive&&this._previewing}get _isActive(){return this._enabled&&this._sampleCount>0}get _canAccumulate(){return null!==this._accumulationParams.linearDepthTexture&&this._depthRange!==b&&this._opacityFromElevation>y}get _isDoneAccumulating(){return this._progress>=this._sampleCount}get _lightDirections(){return this._cachedLightDirections}set _lightDirections(e){const t=this._cachedLightDirections;if(i(t,e,d))return;const s=e.length;t.length=s,this._sampleCount=Math.min(F,s);for(let i=0;i<s;++i){const s=e[i],r=t[i]||f();g(r,s),t[i]=r}this._invalidate()}get _projInfo(){return this._accumulationParams.projInfo}get _zScale(){return this._accumulationParams.zScale}get _inverseView(){return this._accumulationParams.inverseView}get _opacityFromElevation(){return this._accumulationRenderer.opacityFromElevation}set _opacityFromElevation(e){this._accumulationRenderer.opacityFromElevation=e}get running(){return this._isRefining&&this._canAccumulate&&this._progress>0}runTask(e){for(this._prepareForShadowMapPass(this._cachedCamera,this._contentCamera);!e.done&&!this._isDoneAccumulating;)this._accumulateShadow(),e.madeProgress();this._requestRender()}accumulateFixedSamples(){if(!this.isAccumulating||!this._canAccumulate)return;(this._previewing||0===this._progress||this._cameraForcedForScreenshot)&&this._clear();const e=this._cameraForcedForScreenshot?this._sampleCount:Math.min(B.previewSamples,this._sampleCount-this._progress);for(let t=0;t<e;++t)this._accumulateShadow();this._cameraForcedForScreenshot=!1}render(){this._accumulationRenderer.render()}dispose(){this._stop(),this._handles.destroy(),this._accumulationRenderer=o(this._accumulationRenderer),this._shadowMap=o(this._shadowMap),this._fbo=o(this._fbo),this._vao=o(this._vao),this._accumulationTechnique=o(this._accumulationTechnique),this._cachedLightDirections.length=0,this._sampleCount=0}setOptions(e){void 0!==e.enabled&&this._setEnabled(e.enabled),void 0!==e.previewing&&this.setPreviewing(e.previewing),void 0!==e.lightDirections&&this.setLightDirections(e.lightDirections),this._accumulationRenderer.setOptions(e)}setPreviewing(e){this._previewing!==e&&(this._previewing=e,this._requestRenderIfEnabled())}setLightDirections(e){this._lightDirections=e}setAccumulationDependencies(e,t,i,s){this._accumulationParams.linearDepthTexture=e,this._depthRange=t,this._updateCamera(i),this._contentCamera=s,this.notifyChange("_canAccumulate")}readAccumulatedShadow(e,t){if(!this._isActive||this._progress<1||e<0||e>this._fbo.width||t<0||t>this._fbo.height)return 0;const i=G;return this._fbo.readPixels(e,t,1,1,V.RGBA,I.UNSIGNED_BYTE,i),i[0]/this._progress}_start(){this._progress=0,this._enabled=!0}_stop(){this._enabled=!1}_invalidate(){this._progress=0,this._requestRenderIfEnabled()}_clear(){this._rctx.bindFramebuffer(this._fbo),this._rctx.setClearColor(0,0,0,0),this._rctx.clearSafe(O.COLOR_BUFFER_BIT),this._progress=0}_accumulateShadow(){const e=this._lightDirections[this._progress],t=this._cachedCamera;this._renderToShadowMap(this._shadowMap,e,t,this._depthRange),this._rctx.bindFramebuffer(this._fbo);const i=this.accumulationTechnique;this._rctx.useProgram(i.program),i.bindPipelineState(this._rctx),i.bindPass(this._accumulationParams),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(i.primitiveType,0,z(this._vao,"geometry")),this._progress++}_updateCamera(e){if(e.equals(this._cachedCamera))return;const{fullWidth:t,fullHeight:i,projectionMatrix:s,viewMatrix:a,center:o}=e;this._cachedCamera.copyFrom(e),this._fbo.resize(t,i),T(s,t,i,this._projInfo,this._zScale),u(this._inverseView,a,o),l(this._inverseView,this._inverseView),this._opacityFromElevation=1-r(C,A,e.relativeElevation)}_setEnabled(e){e!==this._enabled&&(e?this._start():this._stop())}_requestRenderIfEnabled(){this._enabled&&this._requestRender()}get test(){return{lightDirections:this._lightDirections,isDone:()=>this._isDoneAccumulating,isActive:()=>this._isActive}}};H.previewSamples=6,H.renderViewHandleKey="renderView",e([c()],H.prototype,"_progress",void 0),e([c()],H.prototype,"_sampleCount",void 0),e([c()],H.prototype,"_enabled",void 0),e([c()],H.prototype,"_depthRange",void 0),e([c()],H.prototype,"_previewing",void 0),e([c()],H.prototype,"_accumulationRenderer",void 0),e([c()],H.prototype,"_isRefining",null),e([c()],H.prototype,"_isActive",null),e([c()],H.prototype,"_canAccumulate",null),e([c()],H.prototype,"_isDoneAccumulating",null),e([c()],H.prototype,"_opacityFromElevation",null),e([c()],H.prototype,"running",null),H=B=e([_("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],H);const G=new Uint8Array(4);export{H as ShadowAccumulator};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{equals as i}from"../../../../core/arrayUtils.js";import s from"../../../../core/Handles.js";import{smoothstep as r}from"../../../../core/mathUtils.js";import{isNone as a,disposeMaybe as o}from"../../../../core/maybe.js";import{watch as n,syncAndInitial as h}from"../../../../core/reactiveUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../../core/accessorSupport/decorators/subclass.js";import{j as u,a as l}from"../../../../chunks/mat4.js";import{c as m}from"../../../../chunks/mat4f64.js";import{a as p}from"../../../../chunks/vec2f64.js";import{y as d,g}from"../../../../chunks/vec3.js";import{c as f}from"../../../../chunks/vec3f64.js";import{c as w}from"../../../../chunks/vec4f64.js";import v from"./Camera.js";import{ZERO as b}from"./depthRange.js";import{createQuadVAO as S}from"./glUtil3D.js";import{ShadowCastRenderer as j,shadowCastDisabledElevationThreshold as y,shadowCastDisableElevationMax as A,shadowCastDisableElevationMin as C}from"./ShadowCastRenderer.js";import R from"./ShadowMap.js";import{inverseProjectionInfo as T}from"./Util.js";import{S as D,s as F}from"../../../../chunks/ShadowCast.glsl.js";import{ShadowCastTechniqueConfiguration as E,ShadowCastTechnique as x}from"../shaders/ShadowCastTechnique.js";import{TaskPriority as M}from"../../../support/Scheduler.js";import{TargetType as P,DepthStencilTargetType as q,TextureType as U,PixelFormat as V,PixelType as I,TextureSamplingMode as k,TextureWrapMode as L,ClearBufferBit as O}from"../../../webgl/enums.js";import{FramebufferObject as N}from"../../../webgl/FramebufferObject.js";import{vertexCount as z}from"../../../webgl/Util.js";var B;let H=B=class extends t{constructor(e,t,i,r,o,c){super({}),this._rctx=e,this._stage=i,this._prepareForShadowMapPass=r,this._renderToShadowMap=o,this._requestRender=c,this._progress=0,this._sampleCount=0,this._cachedCamera=new v,this._contentCamera=new v,this._enabled=!1,this._cachedLightDirections=[],this._depthRange=b,this._previewing=!1,this._handles=new s,this._cameraForcedForScreenshot=!1,this._shadowMap=new R(e,i.viewingMode),this._shadowMap.enabled=!0,this._vao=S(e);const _={colorTarget:P.TEXTURE,depthStencilTarget:q.NONE,width:0,height:0},u={target:U.TEXTURE_2D,pixelFormat:V.RGBA,dataType:I.UNSIGNED_BYTE,samplingMode:k.LINEAR,wrapMode:L.CLAMP_TO_EDGE,width:0,height:0};this._fbo=new N(e,_,u),this._accumulationParams={camera:this._cachedCamera,linearDepthTexture:null,shadowMap:this._shadowMap,inverseViewMatrix:m(),projInfo:w(),zScale:p()},this._accumulationRenderer=new j(t,e,this,c);const l=this._stage.resourceController.scheduler;this._handles.add(l.registerTask(M.SHADOW_ACCUMULATOR,this)),this._handles.add(n((()=>i.renderView),(e=>{this._handles.remove(B.renderViewHandleKey),a(e)||this._handles.add(e.events.on("force-camera-for-screenshot",(()=>this._cameraForcedForScreenshot=!0)),B.renderViewHandleKey)}),h))}normalizeCtorArgs(){return{}}get computedSamples(){return this._progress}get shadowCastTexture(){return this._fbo.colorTexture}get isAccumulating(){return this._isPreviewing||this._isRefining}get accumulationTechnique(){if(a(this._accumulationTechnique)){const e={rctx:this._rctx,viewingMode:this._stage.viewingMode},t=new E;t.pass=D.Accumulate,this._accumulationTechnique=new x(e,t)}return this._accumulationTechnique}get _isRefining(){return this._isActive&&!this._isDoneAccumulating&&!this._previewing}get _isPreviewing(){return this._isActive&&this._previewing}get _isActive(){return this._enabled&&this._sampleCount>0}get _canAccumulate(){return null!==this._accumulationParams.linearDepthTexture&&this._depthRange!==b&&this._opacityFromElevation>y}get _isDoneAccumulating(){return this._progress>=this._sampleCount}get _lightDirections(){return this._cachedLightDirections}set _lightDirections(e){const t=this._cachedLightDirections;if(i(t,e,d))return;const s=e.length;t.length=s,this._sampleCount=Math.min(F,s);for(let i=0;i<s;++i){const s=e[i],r=t[i]||f();g(r,s),t[i]=r}this._invalidate()}get _projInfo(){return this._accumulationParams.projInfo}get _zScale(){return this._accumulationParams.zScale}get _inverseView(){return this._accumulationParams.inverseViewMatrix}get _opacityFromElevation(){return this._accumulationRenderer.opacityFromElevation}set _opacityFromElevation(e){this._accumulationRenderer.opacityFromElevation=e}get running(){return this._isRefining&&this._canAccumulate&&this._progress>0}runTask(e){for(this._prepareForShadowMapPass(this._cachedCamera,this._contentCamera);!e.done&&!this._isDoneAccumulating;)this._accumulateShadow(),e.madeProgress();this._requestRender()}accumulateFixedSamples(){if(!this.isAccumulating||!this._canAccumulate)return;(this._previewing||0===this._progress||this._cameraForcedForScreenshot)&&this._clear();const e=this._cameraForcedForScreenshot?this._sampleCount:Math.min(B.previewSamples,this._sampleCount-this._progress);for(let t=0;t<e;++t)this._accumulateShadow();this._cameraForcedForScreenshot=!1}render(){this._accumulationRenderer.render()}dispose(){this._stop(),this._handles.destroy(),this._accumulationRenderer=o(this._accumulationRenderer),this._shadowMap=o(this._shadowMap),this._fbo=o(this._fbo),this._vao=o(this._vao),this._accumulationTechnique=o(this._accumulationTechnique),this._cachedLightDirections.length=0,this._sampleCount=0}setOptions(e){void 0!==e.enabled&&this._setEnabled(e.enabled),void 0!==e.previewing&&this.setPreviewing(e.previewing),void 0!==e.lightDirections&&this.setLightDirections(e.lightDirections),this._accumulationRenderer.setOptions(e)}setPreviewing(e){this._previewing!==e&&(this._previewing=e,this._requestRenderIfEnabled())}setLightDirections(e){this._lightDirections=e}setAccumulationDependencies(e,t,i,s){this._accumulationParams.linearDepthTexture=e,this._depthRange=t,this._updateCamera(i),this._contentCamera=s,this.notifyChange("_canAccumulate")}readAccumulatedShadow(e,t){if(!this._isActive||this._progress<1||e<0||e>this._fbo.width||t<0||t>this._fbo.height)return 0;const i=G;return this._fbo.readPixels(e,t,1,1,V.RGBA,I.UNSIGNED_BYTE,i),i[0]/this._progress}_start(){this._progress=0,this._enabled=!0}_stop(){this._enabled=!1}_invalidate(){this._progress=0,this._requestRenderIfEnabled()}_clear(){this._rctx.bindFramebuffer(this._fbo),this._rctx.setClearColor(0,0,0,0),this._rctx.clearSafe(O.COLOR_BUFFER_BIT),this._progress=0}_accumulateShadow(){const e=this._lightDirections[this._progress],t=this._cachedCamera;this._renderToShadowMap(this._shadowMap,e,t,this._depthRange),this._rctx.bindFramebuffer(this._fbo);const i=this.accumulationTechnique;this._rctx.useProgram(i.program),i.bindPipelineState(this._rctx),i.bindPass(this._accumulationParams),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(i.primitiveType,0,z(this._vao,"geometry")),this._progress++}_updateCamera(e){if(e.equals(this._cachedCamera))return;const{fullWidth:t,fullHeight:i,projectionMatrix:s,viewMatrix:a,center:o}=e;this._cachedCamera.copyFrom(e),this._fbo.resize(t,i),T(s,t,i,this._projInfo,this._zScale),u(this._inverseView,a,o),l(this._inverseView,this._inverseView),this._opacityFromElevation=1-r(C,A,e.relativeElevation)}_setEnabled(e){e!==this._enabled&&(e?this._start():this._stop())}_requestRenderIfEnabled(){this._enabled&&this._requestRender()}get test(){return{lightDirections:this._lightDirections,isDone:()=>this._isDoneAccumulating,isActive:()=>this._isActive}}};H.previewSamples=6,H.renderViewHandleKey="renderView",e([c()],H.prototype,"_progress",void 0),e([c()],H.prototype,"_sampleCount",void 0),e([c()],H.prototype,"_enabled",void 0),e([c()],H.prototype,"_depthRange",void 0),e([c()],H.prototype,"_previewing",void 0),e([c()],H.prototype,"_accumulationRenderer",void 0),e([c()],H.prototype,"_isRefining",null),e([c()],H.prototype,"_isActive",null),e([c()],H.prototype,"_canAccumulate",null),e([c()],H.prototype,"_isDoneAccumulating",null),e([c()],H.prototype,"_opacityFromElevation",null),e([c()],H.prototype,"running",null),H=B=e([_("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],H);const G=new Uint8Array(4);export{H as ShadowAccumulator};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as t,acosClamped as s,lerp as e}from"../../../../core/mathUtils.js";import{isSome as a,disposeMaybe as i}from"../../../../core/maybe.js";import{c as r}from"../../../../chunks/mat3f64.js";import{j as h,m as o,q as n,a as c,n as u}from"../../../../chunks/mat4.js";import{c as m}from"../../../../chunks/mat4f64.js";import{s as d,m as p,g as l,o as f,a as x,f as _,k as T,n as S,i as g,c as b}from"../../../../chunks/vec2.js";import{a as M}from"../../../../chunks/vec2f64.js";import{g as w,o as C,m as E,s as D}from"../../../../chunks/vec3.js";import{c as j}from"../../../../chunks/vec3f64.js";import{s as U,t as v}from"../../../../chunks/vec4.js";import{c as z}from"../../../../chunks/vec4f64.js";import{ViewingMode as R}from"../../../ViewingMode.js";import F from"./Camera.js";import{assert as N,logWithBase as y,verify as A,rayRay2D as O}from"./Util.js";import{TextureType as P,ClearBufferBit as k,PixelFormat as L,PixelType as B,TextureWrapMode as G,TextureSamplingMode as I,TargetType as X,DepthStencilTargetType as H}from"../../../webgl/enums.js";import{FramebufferObject as q}from"../../../webgl/FramebufferObject.js";import{Texture as V}from"../../../webgl/Texture.js";import{getGpuMemoryUsage as Y}from"../../../webgl/Util.js";class W{constructor(){this.camera=new F,this.lightMat=m()}}class J{constructor(t,s,e=0){this.rctx=t,this.viewingMode=s,this._enabled=!1,this._snapshots=new Array,this.textureSize=0,this.maxTextureSize=0,this.numCascades=1,this.maxNumCascades=4,this.splitSchemeLambda=0,this.warp=!0,this.cascadeDistances=[0,0,0,0,0],this.cascades=[],this.maxTextureSize=this.rctx.parameters.maxTextureSize;for(let a=0;a<4;++a)this.cascades.push(new W);this.snapshotCount=e}dispose(){this._discardDepthTexture(),this._discardAllSnapshots()}set maxCascades(s){this.maxNumCascades=t(Math.floor(s),1,4)}get maxCascades(){return this.maxNumCascades}set enabled(t){this._enabled=t,t||(this._discardDepthTexture(),this._discardAllSnapshots())}get enabled(){return this._enabled}get snapshotCount(){return this._snapshots.length}set snapshotCount(t){const s=this._snapshots.length;if(t>s){const e=t-s;this._snapshots.length=t;for(let t=0;t<e;++t)this._snapshots[s+t]=null}else if(t<this.snapshotCount){const e=s-t;for(let s=0;s<e;++s)this._discardSnapshot(t+s);this._snapshots.length=t}}getSnapshot(t){return this.enabled?this._snapshots[t]:null}getCascades(){for(let t=0;t<this.numCascades;++t)ut[t]=this.cascades[t];return ut.length=this.numCascades,ut}start(t,s,e){N(this.enabled),this.textureSize=this._computeTextureSize(t.fullWidth,t.fullHeight),this._ensureDepthTexture();const{near:a,far:i}=this._clampNearFar(e);this._computeCascadeDistances(i,a),this._setupMatrices(t,s);const r=t.viewMatrix,h=t.projectionMatrix;for(let o=0;o<this.numCascades;++o)this._constructCascade(o,h,r,s);this.lastOrigin=null,this.clear()}finish(t){N(this.enabled),this.rctx.bindFramebuffer(t)}bind(t){this.enabled?(this._depthTextureUnit=t.bindTexture(this._depthTexture,"uShadowMapTex"),t.setUniform1f("uDepthHalfPixelSz",.5/this.textureSize),t.setUniform1i("uShadowMapNum",this.numCascades),t.setUniform4f("uShadowMapDistance",this.cascadeDistances[0],this.numCascades>1?this.cascadeDistances[1]:1/0,this.numCascades>2?this.cascadeDistances[2]:1/0,this.numCascades>3?this.cascadeDistances[3]:1/0)):t.setUniform1f("uDepthHalfPixelSz",-1)}bindView(t,s){if(!this.enabled)return;const e=this.lastOrigin;if(!(e&&e[0]===s[0]&&e[1]===s[1]&&e[2]===s[2])){this.lastOrigin=this.lastOrigin||j(),w(this.lastOrigin,s);for(let t=0;t<this.numCascades;++t){h(mt,this.cascades[t].lightMat,s);for(let s=0;s<16;++s)dt[16*t+s]=mt[s]}}t.setUniformMatrix4fv("uShadowMapMatrix",dt)}takeCascadeSnapshotTo(t,s){N(this.enabled),this._ensureSnapshot(s),this._bindFbo();const e=this.rctx,a=e.bindTexture(this._snapshots[s],V.TEXTURE_UNIT_FOR_UPDATES);e.gl.copyTexSubImage2D(P.TEXTURE_2D,0,t.camera.viewport[0],t.camera.viewport[1],t.camera.viewport[0],t.camera.viewport[1],t.camera.viewport[2],t.camera.viewport[3]),e.bindTexture(a,V.TEXTURE_UNIT_FOR_UPDATES)}clear(){const t=this.rctx;this._bindFbo(),t.setClearColor(1,1,1,1),t.clearSafe(k.COLOR_BUFFER_BIT|k.DEPTH_BUFFER_BIT)}_computeTextureSize(t,s){const e=.5*Math.log(t*t+s*s)*Math.LOG2E,a=.35,i=2**Math.round(e+a);return Math.min(this.maxTextureSize,2*i)}_ensureDepthTexture(){if(null!=this._depthTexture&&this._depthTexture.descriptor.width===this.textureSize)return;this._discardDepthTexture();const t={target:P.TEXTURE_2D,pixelFormat:L.RGBA,dataType:B.UNSIGNED_BYTE,wrapMode:G.CLAMP_TO_EDGE,samplingMode:I.NEAREST,flipped:!0,width:this.textureSize,height:this.textureSize};this._depthTexture=new V(this.rctx,t),this.fbo=new q(this.rctx,{colorTarget:X.TEXTURE,depthStencilTarget:H.DEPTH_RENDER_BUFFER,width:this.textureSize,height:this.textureSize},this._depthTexture)}_ensureSnapshot(t){const s=this._snapshots[t];if(a(s)&&s.descriptor.width===this.textureSize)return;this._discardSnapshot(t);const e={target:P.TEXTURE_2D,pixelFormat:L.RGBA,dataType:B.UNSIGNED_BYTE,wrapMode:G.CLAMP_TO_EDGE,samplingMode:I.NEAREST,flipped:!0,width:this.textureSize,height:this.textureSize};this._snapshots[t]=new V(this.rctx,e)}_discardDepthTexture(){this.fbo=i(this.fbo),this._depthTexture=i(this._depthTexture)}_discardSnapshot(t){this._snapshots[t]=i(this._snapshots[t])}_discardAllSnapshots(){for(let t=0;t<this.snapshotCount;++t)this._discardSnapshot(t)}_bindFbo(){const t=this.rctx;a(this._depthTextureUnit)&&(t.bindTexture(null,this._depthTextureUnit),this._depthTextureUnit=null),t.bindFramebuffer(this.fbo)}_constructCascade(t,s,e,a){const i=this.cascades[t],r=-this.cascadeDistances[t],n=-this.cascadeDistances[t+1],c=(s[10]*r+s[14])/Math.abs(s[11]*r+s[15]),u=(s[10]*n+s[14])/Math.abs(s[11]*n+s[15]);N(c<u);for(let h=0;h<8;++h){U($,h%4==0||h%4==3?-1:1,h%4==0||h%4==1?-1:1,h<4?c:u,1),v(tt[h],$,Z);for(let t=0;t<3;++t)tt[h][t]/=tt[h][3]}C(ct,tt[0]),h(K,nt,ct),i.camera.viewMatrix=K;for(let h=0;h<8;++h)E(tt[h],tt[h],i.camera.viewMatrix);w(st,tt[0]),w(et,tt[0]);for(let h=1;h<8;++h)for(let t=0;t<3;++t)st[t]=Math.min(st[t],tt[h][t]),et[t]=Math.max(et[t],tt[h][t]);st[2]-=200,et[2]+=200,i.camera.near=-et[2],i.camera.far=-st[2],this.warp?this._constructTrapezoidalProjection(e,a,i):this._constructOrthogonalProjection(i),o(i.lightMat,i.camera.projectionMatrix,i.camera.viewMatrix);const m=this.textureSize/2;i.camera.viewport[0]=t%2==0?0:m,i.camera.viewport[1]=0===Math.floor(t/2)?0:m,i.camera.viewport[2]=m,i.camera.viewport[3]=m}_constructOrthogonalProjection(t){n(t.camera.projectionMatrix,st[0],et[0],st[1],et[1],t.camera.near,t.camera.far)}_constructTrapezoidalProjection(t,e,a){const i=1/tt[0][3],r=1/tt[4][3];N(i<r);let h=i+Math.sqrt(i*r);const o=Math.sin(s(t[2]*e[0]+t[6]*e[1]+t[10]*e[2]));h/=o,wt(tt,h,o,at,it,rt,ht,ot),vt(at,it,ht,ot,a.camera.projectionMatrix),a.camera.projectionMatrix[10]=2/(st[2]-et[2]),a.camera.projectionMatrix[14]=-(st[2]+et[2])/(st[2]-et[2])}_setupMatrices(t,s){o(Q,t.projectionMatrix,t.viewMatrix),c(Z,Q);const e=this.viewingMode===R.Global?t.eye:D(ct,0,0,1);u(nt,[0,0,0],[-s[0],-s[1],-s[2]],e)}_clampNearFar(t){let{near:s,far:e}=t;return s<2&&(s=2),e<2&&(e=2),s>=e&&(s=2,e=4),{near:s,far:e}}_computeCascadeDistances(t,s){this.numCascades=Math.min(1+Math.floor(y(t/s,4)),this.maxNumCascades);const a=(t-s)/this.numCascades,i=(t/s)**(1/this.numCascades);let r=s,h=s;for(let o=0;o<this.numCascades+1;++o)this.cascadeDistances[o]=e(r,h,this.splitSchemeLambda),r*=i,h+=a}get gpuMemoryUsage(){var t,s;return this._snapshots.reduce(((t,s)=>t+Y(s)),null!=(t=null==(s=this.fbo)?void 0:s.gpuMemoryUsage)?t:0)}get test(){const t=this;return{maxNumCascades:this.maxNumCascades,cascades:this.cascades,textureSize:this.textureSize,depthTexture:this._depthTexture,set splitSchemeLambda(s){t.splitSchemeLambda=s},get splitSchemeLambda(){return t.splitSchemeLambda},set warp(s){t.warp=s},get warp(){return t.warp}}}}const K=m(),Q=m(),Z=m(),$=z(),tt=[];for(let zt=0;zt<8;++zt)tt.push(z());const st=j(),et=j(),at=M(),it=M(),rt=M(),ht=M(),ot=M(),nt=m(),ct=j(),ut=[],mt=m(),dt=new Float32Array(64),pt=M(),lt=M(),ft=[M(),M(),M(),M()],xt=M(),_t=M(),Tt=M(),St=M(),gt=M(),bt=M(),Mt=M();function wt(t,s,e,a,i,r,h,o){d(pt,0,0);for(let d=0;d<4;++d)p(pt,pt,t[d]);l(pt,pt,.25),d(lt,0,0);for(let d=4;d<8;++d)p(lt,lt,t[d]);l(lt,lt,.25),f(ft[0],t[4],t[5],.5),f(ft[1],t[5],t[6],.5),f(ft[2],t[6],t[7],.5),f(ft[3],t[7],t[4],.5);let n=0,c=x(ft[0],pt);for(let d=1;d<4;++d){const t=x(ft[d],pt);t<c&&(c=t,n=d)}_(xt,ft[n],t[n+4]);const u=xt[0];let m,M;xt[0]=-xt[1],xt[1]=u,_(_t,lt,pt),T(_t,xt)<0&&S(xt,xt),f(xt,xt,_t,e),g(xt,xt),m=M=T(_(Tt,t[0],pt),xt);for(let d=1;d<8;++d){const s=T(_(Tt,t[d],pt),xt);s<m?m=s:s>M&&(M=s)}b(a,pt),l(Tt,xt,m-s),p(a,a,Tt);let w=-1,C=1,E=0,D=0;for(let d=0;d<8;++d){_(St,t[d],a),g(St,St);const s=xt[0]*St[1]-xt[1]*St[0];s>0?s>w&&(w=s,E=d):s<C&&(C=s,D=d)}A(w>0,"leftArea"),A(C<0,"rightArea"),l(gt,xt,m),p(gt,gt,pt),l(bt,xt,M),p(bt,bt,pt),Mt[0]=-xt[1],Mt[1]=xt[0];const j=O(a,t[D],bt,p(Tt,bt,Mt),1,i),U=O(a,t[E],bt,Tt,1,r),v=O(a,t[E],gt,p(Tt,gt,Mt),1,h),z=O(a,t[D],gt,Tt,1,o);A(j,"rayRay"),A(U,"rayRay"),A(v,"rayRay"),A(z,"rayRay")}function Ct(t,s){return 3*s+t}const Et=M();function Dt(t,s){return d(Et,t[s],t[s+3]),Et}const jt=M(),Ut=r();function vt(t,s,e,a,i){_(jt,e,a),l(jt,jt,.5),Ut[0]=jt[0],Ut[1]=jt[1],Ut[2]=0,Ut[3]=jt[1],Ut[4]=-jt[0],Ut[5]=0,Ut[6]=jt[0]*jt[0]+jt[1]*jt[1],Ut[7]=jt[0]*jt[1]-jt[1]*jt[0],Ut[8]=1,Ut[Ct(0,2)]=-T(Dt(Ut,0),t),Ut[Ct(1,2)]=-T(Dt(Ut,1),t);let r=T(Dt(Ut,0),e)+Ut[Ct(0,2)],h=T(Dt(Ut,1),e)+Ut[Ct(1,2)],o=T(Dt(Ut,0),a)+Ut[Ct(0,2)],n=T(Dt(Ut,1),a)+Ut[Ct(1,2)];r=-(r+o)/(h+n),Ut[Ct(0,0)]+=Ut[Ct(1,0)]*r,Ut[Ct(0,1)]+=Ut[Ct(1,1)]*r,Ut[Ct(0,2)]+=Ut[Ct(1,2)]*r,r=1/(T(Dt(Ut,0),e)+Ut[Ct(0,2)]),h=1/(T(Dt(Ut,1),e)+Ut[Ct(1,2)]),Ut[Ct(0,0)]*=r,Ut[Ct(0,1)]*=r,Ut[Ct(0,2)]*=r,Ut[Ct(1,0)]*=h,Ut[Ct(1,1)]*=h,Ut[Ct(1,2)]*=h,Ut[Ct(2,0)]=Ut[Ct(1,0)],Ut[Ct(2,1)]=Ut[Ct(1,1)],Ut[Ct(2,2)]=Ut[Ct(1,2)],Ut[Ct(1,2)]+=1,r=T(Dt(Ut,1),s)+Ut[Ct(1,2)],h=T(Dt(Ut,2),s)+Ut[Ct(2,2)],o=T(Dt(Ut,1),e)+Ut[Ct(1,2)],n=T(Dt(Ut,2),e)+Ut[Ct(2,2)],r=-.5*(r/h+o/n),Ut[Ct(1,0)]+=Ut[Ct(2,0)]*r,Ut[Ct(1,1)]+=Ut[Ct(2,1)]*r,Ut[Ct(1,2)]+=Ut[Ct(2,2)]*r,r=T(Dt(Ut,1),s)+Ut[Ct(1,2)],h=T(Dt(Ut,2),s)+Ut[Ct(2,2)],o=-h/r,Ut[Ct(1,0)]*=o,Ut[Ct(1,1)]*=o,Ut[Ct(1,2)]*=o,i[0]=Ut[0],i[1]=Ut[1],i[2]=0,i[3]=Ut[2],i[4]=Ut[3],i[5]=Ut[4],i[6]=0,i[7]=Ut[5],i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=Ut[6],i[13]=Ut[7],i[14]=0,i[15]=Ut[8]}export{J as default};
5
+ import{clamp as t,acosClamped as s,lerp as e}from"../../../../core/mathUtils.js";import{isSome as a,disposeMaybe as i}from"../../../../core/maybe.js";import{c as r}from"../../../../chunks/mat3f64.js";import{j as h,m as o,q as c,a as n,n as m}from"../../../../chunks/mat4.js";import{c as d}from"../../../../chunks/mat4f64.js";import{s as u,m as p,g as l,o as f,a as x,f as _,k as T,n as g,i as b,c as S}from"../../../../chunks/vec2.js";import{a as M}from"../../../../chunks/vec2f64.js";import{g as w,o as C,m as E,s as j}from"../../../../chunks/vec3.js";import{c as D}from"../../../../chunks/vec3f64.js";import{s as U,t as v}from"../../../../chunks/vec4.js";import{c as z}from"../../../../chunks/vec4f64.js";import{ViewingMode as R}from"../../../ViewingMode.js";import F from"./Camera.js";import{assert as y,logWithBase as N,verify as A,rayRay2D as O}from"./Util.js";import{TextureType as P,ClearBufferBit as k,PixelFormat as L,PixelType as B,TextureWrapMode as G,TextureSamplingMode as I,TargetType as X,DepthStencilTargetType as H}from"../../../webgl/enums.js";import{FramebufferObject as q}from"../../../webgl/FramebufferObject.js";import{Texture as V}from"../../../webgl/Texture.js";import{getGpuMemoryUsage as Y}from"../../../webgl/Util.js";class W{constructor(){this.camera=new F,this.lightMat=d()}}class J{constructor(t,s,e=0){this.rctx=t,this.viewingMode=s,this._enabled=!1,this._snapshots=new Array,this.textureSize=0,this.maxTextureSize=0,this.numCascades=1,this.maxNumCascades=4,this.splitSchemeLambda=0,this.warp=!0,this.cascadeDistances=[0,0,0,0,0],this.cascades=[],this.maxTextureSize=this.rctx.parameters.maxTextureSize;for(let a=0;a<4;++a)this.cascades.push(new W);this.snapshotCount=e}dispose(){this._discardDepthTexture(),this._discardAllSnapshots()}set maxCascades(s){this.maxNumCascades=t(Math.floor(s),1,4)}get maxCascades(){return this.maxNumCascades}set enabled(t){this._enabled=t,t||(this._discardDepthTexture(),this._discardAllSnapshots())}get enabled(){return this._enabled}get snapshotCount(){return this._snapshots.length}set snapshotCount(t){const s=this._snapshots.length;if(t>s){const e=t-s;this._snapshots.length=t;for(let t=0;t<e;++t)this._snapshots[s+t]=null}else if(t<this.snapshotCount){const e=s-t;for(let s=0;s<e;++s)this._discardSnapshot(t+s);this._snapshots.length=t}}getSnapshot(t){return this.enabled?this._snapshots[t]:null}getCascades(){for(let t=0;t<this.numCascades;++t)mt[t]=this.cascades[t];return mt.length=this.numCascades,mt}start(t,s,e){y(this.enabled),this.textureSize=this._computeTextureSize(t.fullWidth,t.fullHeight),this._ensureDepthTexture();const{near:a,far:i}=this._clampNearFar(e);this._computeCascadeDistances(i,a),this._setupMatrices(t,s);const r=t.viewMatrix,h=t.projectionMatrix;for(let o=0;o<this.numCascades;++o)this._constructCascade(o,h,r,s);this.lastOrigin=null,this.clear()}finish(t){y(this.enabled),this.rctx.bindFramebuffer(t)}bind(t){this.enabled?(this._depthTextureUnit=t.bindTexture(this._depthTexture,"shadowMapTex"),t.setUniform1f("depthHalfPixelSz",.5/this.textureSize),t.setUniform1i("numCascades",this.numCascades),t.setUniform4f("cascadeDistances",this.cascadeDistances[0],this.numCascades>1?this.cascadeDistances[1]:1/0,this.numCascades>2?this.cascadeDistances[2]:1/0,this.numCascades>3?this.cascadeDistances[3]:1/0)):t.setUniform1f("depthHalfPixelSz",-1)}bindView(t,s){if(!this.enabled)return;const e=this.lastOrigin;if(!(e&&e[0]===s[0]&&e[1]===s[1]&&e[2]===s[2])){this.lastOrigin=this.lastOrigin||D(),w(this.lastOrigin,s);for(let t=0;t<this.numCascades;++t){h(dt,this.cascades[t].lightMat,s);for(let s=0;s<16;++s)ut[16*t+s]=dt[s]}}t.setUniformMatrix4fv("shadowMapMatrix",ut)}takeCascadeSnapshotTo(t,s){y(this.enabled),this._ensureSnapshot(s),this._bindFbo();const e=this.rctx,a=e.bindTexture(this._snapshots[s],V.TEXTURE_UNIT_FOR_UPDATES);e.gl.copyTexSubImage2D(P.TEXTURE_2D,0,t.camera.viewport[0],t.camera.viewport[1],t.camera.viewport[0],t.camera.viewport[1],t.camera.viewport[2],t.camera.viewport[3]),e.bindTexture(a,V.TEXTURE_UNIT_FOR_UPDATES)}clear(){const t=this.rctx;this._bindFbo(),t.setClearColor(1,1,1,1),t.clearSafe(k.COLOR_BUFFER_BIT|k.DEPTH_BUFFER_BIT)}_computeTextureSize(t,s){const e=.5*Math.log(t*t+s*s)*Math.LOG2E,a=.35,i=2**Math.round(e+a);return Math.min(this.maxTextureSize,2*i)}_ensureDepthTexture(){if(null!=this._depthTexture&&this._depthTexture.descriptor.width===this.textureSize)return;this._discardDepthTexture();const t={target:P.TEXTURE_2D,pixelFormat:L.RGBA,dataType:B.UNSIGNED_BYTE,wrapMode:G.CLAMP_TO_EDGE,samplingMode:I.NEAREST,flipped:!0,width:this.textureSize,height:this.textureSize};this._depthTexture=new V(this.rctx,t),this.fbo=new q(this.rctx,{colorTarget:X.TEXTURE,depthStencilTarget:H.DEPTH_RENDER_BUFFER,width:this.textureSize,height:this.textureSize},this._depthTexture)}_ensureSnapshot(t){const s=this._snapshots[t];if(a(s)&&s.descriptor.width===this.textureSize)return;this._discardSnapshot(t);const e={target:P.TEXTURE_2D,pixelFormat:L.RGBA,dataType:B.UNSIGNED_BYTE,wrapMode:G.CLAMP_TO_EDGE,samplingMode:I.NEAREST,flipped:!0,width:this.textureSize,height:this.textureSize};this._snapshots[t]=new V(this.rctx,e)}_discardDepthTexture(){this.fbo=i(this.fbo),this._depthTexture=i(this._depthTexture)}_discardSnapshot(t){this._snapshots[t]=i(this._snapshots[t])}_discardAllSnapshots(){for(let t=0;t<this.snapshotCount;++t)this._discardSnapshot(t)}_bindFbo(){const t=this.rctx;a(this._depthTextureUnit)&&(t.bindTexture(null,this._depthTextureUnit),this._depthTextureUnit=null),t.bindFramebuffer(this.fbo)}_constructCascade(t,s,e,a){const i=this.cascades[t],r=-this.cascadeDistances[t],c=-this.cascadeDistances[t+1],n=(s[10]*r+s[14])/Math.abs(s[11]*r+s[15]),m=(s[10]*c+s[14])/Math.abs(s[11]*c+s[15]);y(n<m);for(let h=0;h<8;++h){U($,h%4==0||h%4==3?-1:1,h%4==0||h%4==1?-1:1,h<4?n:m,1),v(tt[h],$,Z);for(let t=0;t<3;++t)tt[h][t]/=tt[h][3]}C(nt,tt[0]),h(K,ct,nt),i.camera.viewMatrix=K;for(let h=0;h<8;++h)E(tt[h],tt[h],i.camera.viewMatrix);w(st,tt[0]),w(et,tt[0]);for(let h=1;h<8;++h)for(let t=0;t<3;++t)st[t]=Math.min(st[t],tt[h][t]),et[t]=Math.max(et[t],tt[h][t]);st[2]-=200,et[2]+=200,i.camera.near=-et[2],i.camera.far=-st[2],this.warp?this._constructTrapezoidalProjection(e,a,i):this._constructOrthogonalProjection(i),o(i.lightMat,i.camera.projectionMatrix,i.camera.viewMatrix);const d=this.textureSize/2;i.camera.viewport[0]=t%2==0?0:d,i.camera.viewport[1]=0===Math.floor(t/2)?0:d,i.camera.viewport[2]=d,i.camera.viewport[3]=d}_constructOrthogonalProjection(t){c(t.camera.projectionMatrix,st[0],et[0],st[1],et[1],t.camera.near,t.camera.far)}_constructTrapezoidalProjection(t,e,a){const i=1/tt[0][3],r=1/tt[4][3];y(i<r);let h=i+Math.sqrt(i*r);const o=Math.sin(s(t[2]*e[0]+t[6]*e[1]+t[10]*e[2]));h/=o,wt(tt,h,o,at,it,rt,ht,ot),vt(at,it,ht,ot,a.camera.projectionMatrix),a.camera.projectionMatrix[10]=2/(st[2]-et[2]),a.camera.projectionMatrix[14]=-(st[2]+et[2])/(st[2]-et[2])}_setupMatrices(t,s){o(Q,t.projectionMatrix,t.viewMatrix),n(Z,Q);const e=this.viewingMode===R.Global?t.eye:j(nt,0,0,1);m(ct,[0,0,0],[-s[0],-s[1],-s[2]],e)}_clampNearFar(t){let{near:s,far:e}=t;return s<2&&(s=2),e<2&&(e=2),s>=e&&(s=2,e=4),{near:s,far:e}}_computeCascadeDistances(t,s){this.numCascades=Math.min(1+Math.floor(N(t/s,4)),this.maxNumCascades);const a=(t-s)/this.numCascades,i=(t/s)**(1/this.numCascades);let r=s,h=s;for(let o=0;o<this.numCascades+1;++o)this.cascadeDistances[o]=e(r,h,this.splitSchemeLambda),r*=i,h+=a}get gpuMemoryUsage(){var t,s;return this._snapshots.reduce(((t,s)=>t+Y(s)),null!=(t=null==(s=this.fbo)?void 0:s.gpuMemoryUsage)?t:0)}get test(){const t=this;return{maxNumCascades:this.maxNumCascades,cascades:this.cascades,textureSize:this.textureSize,depthTexture:this._depthTexture,set splitSchemeLambda(s){t.splitSchemeLambda=s},get splitSchemeLambda(){return t.splitSchemeLambda},set warp(s){t.warp=s},get warp(){return t.warp}}}}const K=d(),Q=d(),Z=d(),$=z(),tt=[];for(let zt=0;zt<8;++zt)tt.push(z());const st=D(),et=D(),at=M(),it=M(),rt=M(),ht=M(),ot=M(),ct=d(),nt=D(),mt=[],dt=d(),ut=new Float32Array(64),pt=M(),lt=M(),ft=[M(),M(),M(),M()],xt=M(),_t=M(),Tt=M(),gt=M(),bt=M(),St=M(),Mt=M();function wt(t,s,e,a,i,r,h,o){u(pt,0,0);for(let u=0;u<4;++u)p(pt,pt,t[u]);l(pt,pt,.25),u(lt,0,0);for(let u=4;u<8;++u)p(lt,lt,t[u]);l(lt,lt,.25),f(ft[0],t[4],t[5],.5),f(ft[1],t[5],t[6],.5),f(ft[2],t[6],t[7],.5),f(ft[3],t[7],t[4],.5);let c=0,n=x(ft[0],pt);for(let u=1;u<4;++u){const t=x(ft[u],pt);t<n&&(n=t,c=u)}_(xt,ft[c],t[c+4]);const m=xt[0];let d,M;xt[0]=-xt[1],xt[1]=m,_(_t,lt,pt),T(_t,xt)<0&&g(xt,xt),f(xt,xt,_t,e),b(xt,xt),d=M=T(_(Tt,t[0],pt),xt);for(let u=1;u<8;++u){const s=T(_(Tt,t[u],pt),xt);s<d?d=s:s>M&&(M=s)}S(a,pt),l(Tt,xt,d-s),p(a,a,Tt);let w=-1,C=1,E=0,j=0;for(let u=0;u<8;++u){_(gt,t[u],a),b(gt,gt);const s=xt[0]*gt[1]-xt[1]*gt[0];s>0?s>w&&(w=s,E=u):s<C&&(C=s,j=u)}A(w>0,"leftArea"),A(C<0,"rightArea"),l(bt,xt,d),p(bt,bt,pt),l(St,xt,M),p(St,St,pt),Mt[0]=-xt[1],Mt[1]=xt[0];const D=O(a,t[j],St,p(Tt,St,Mt),1,i),U=O(a,t[E],St,Tt,1,r),v=O(a,t[E],bt,p(Tt,bt,Mt),1,h),z=O(a,t[j],bt,Tt,1,o);A(D,"rayRay"),A(U,"rayRay"),A(v,"rayRay"),A(z,"rayRay")}function Ct(t,s){return 3*s+t}const Et=M();function jt(t,s){return u(Et,t[s],t[s+3]),Et}const Dt=M(),Ut=r();function vt(t,s,e,a,i){_(Dt,e,a),l(Dt,Dt,.5),Ut[0]=Dt[0],Ut[1]=Dt[1],Ut[2]=0,Ut[3]=Dt[1],Ut[4]=-Dt[0],Ut[5]=0,Ut[6]=Dt[0]*Dt[0]+Dt[1]*Dt[1],Ut[7]=Dt[0]*Dt[1]-Dt[1]*Dt[0],Ut[8]=1,Ut[Ct(0,2)]=-T(jt(Ut,0),t),Ut[Ct(1,2)]=-T(jt(Ut,1),t);let r=T(jt(Ut,0),e)+Ut[Ct(0,2)],h=T(jt(Ut,1),e)+Ut[Ct(1,2)],o=T(jt(Ut,0),a)+Ut[Ct(0,2)],c=T(jt(Ut,1),a)+Ut[Ct(1,2)];r=-(r+o)/(h+c),Ut[Ct(0,0)]+=Ut[Ct(1,0)]*r,Ut[Ct(0,1)]+=Ut[Ct(1,1)]*r,Ut[Ct(0,2)]+=Ut[Ct(1,2)]*r,r=1/(T(jt(Ut,0),e)+Ut[Ct(0,2)]),h=1/(T(jt(Ut,1),e)+Ut[Ct(1,2)]),Ut[Ct(0,0)]*=r,Ut[Ct(0,1)]*=r,Ut[Ct(0,2)]*=r,Ut[Ct(1,0)]*=h,Ut[Ct(1,1)]*=h,Ut[Ct(1,2)]*=h,Ut[Ct(2,0)]=Ut[Ct(1,0)],Ut[Ct(2,1)]=Ut[Ct(1,1)],Ut[Ct(2,2)]=Ut[Ct(1,2)],Ut[Ct(1,2)]+=1,r=T(jt(Ut,1),s)+Ut[Ct(1,2)],h=T(jt(Ut,2),s)+Ut[Ct(2,2)],o=T(jt(Ut,1),e)+Ut[Ct(1,2)],c=T(jt(Ut,2),e)+Ut[Ct(2,2)],r=-.5*(r/h+o/c),Ut[Ct(1,0)]+=Ut[Ct(2,0)]*r,Ut[Ct(1,1)]+=Ut[Ct(2,1)]*r,Ut[Ct(1,2)]+=Ut[Ct(2,2)]*r,r=T(jt(Ut,1),s)+Ut[Ct(1,2)],h=T(jt(Ut,2),s)+Ut[Ct(2,2)],o=-h/r,Ut[Ct(1,0)]*=o,Ut[Ct(1,1)]*=o,Ut[Ct(1,2)]*=o,i[0]=Ut[0],i[1]=Ut[1],i[2]=0,i[3]=Ut[2],i[4]=Ut[3],i[5]=Ut[4],i[6]=0,i[7]=Ut[5],i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=Ut[6],i[13]=Ut[7],i[14]=0,i[15]=Ut[8]}export{J as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{abortMaybe as r,isSome as s,disposeMaybe as i}from"../../../../core/maybe.js";import{throwIfAborted as o,isAborted as h}from"../../../../core/promiseUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{requestImage as n}from"../../../../support/requestImageUtils.js";import{createScreenSizeTriangleVAO as d}from"./glUtil3D.js";import{SMAATechniqueConfiguration as u,SMAATechnique as _}from"./SMAATechnique.js";import{S as g}from"../../../../chunks/SMAA.glsl.js";import{TextureSamplingMode as c,PixelFormat as p,TargetType as m,DepthStencilTargetType as b,TextureType as T,PixelType as E,TextureWrapMode as x,ClearBufferBit as f,PrimitiveType as w}from"../../../webgl/enums.js";import{FramebufferObject as R}from"../../../webgl/FramebufferObject.js";import{Texture as A}from"../../../webgl/Texture.js";let C=class extends t{constructor(e,t){super({}),this.rctx=e,this._techniqueRep=t,this._isEnabled=!1}normalizeCtorArgs(){return{}}dispose(){this._abortController=r(this._abortController),this.disable()}_loadResources(e){if(s(this._abortController))return!1;if(s(this._searchTexture))return!0;this._abortController=new AbortController;const t=this._abortController.signal;return import("./SmaaRenderPassData.js").then((e=>this._loadTextures(e,t))).then((()=>e())).finally((()=>this._abortController=null)),!1}_loadTextures(e,t){return o(t),Promise.all([this._loadTextureFromBase64(e.areaTexture,c.LINEAR,p.RGB),this._loadTextureFromBase64(e.searchTexure,c.NEAREST,p.LUMINANCE)]).then((([e,r])=>{h(t)?(e.dispose(),r.dispose(),o(t)):(this._areaTexture=e,this._searchTexture=r)}))}get updating(){return s(this._abortController)}enable(e){if(this._isEnabled)return!0;if(!this._edgeDetectTechnique||!this._blendWeights||!this._blur){const e=new u,t=(e,t)=>this._techniqueRep.releaseAndAcquire(_,e,t);e.output=g.EdgeDetector,this._edgeDetectTechnique=t(e,this._edgeDetectTechnique),e.output=g.BlendWeight,this._blendWeights=t(e,this._blendWeights),e.output=g.Blur,this._blur=t(e,this._blur)}return!!this._loadResources(e)&&(this._vao=d(this.rctx),this._edges=new R(this.rctx,{colorTarget:m.TEXTURE,depthStencilTarget:b.NONE},{target:T.TEXTURE_2D,pixelFormat:p.RGB,dataType:E.UNSIGNED_BYTE,samplingMode:c.LINEAR,wrapMode:x.CLAMP_TO_EDGE,width:4,height:4}),this._blend=new R(this.rctx,{colorTarget:m.TEXTURE,depthStencilTarget:b.NONE},{target:T.TEXTURE_2D,pixelFormat:p.RGBA,dataType:E.UNSIGNED_BYTE,samplingMode:c.LINEAR,wrapMode:x.CLAMP_TO_EDGE,width:4,height:4}),this._isEnabled=!0,!0)}disable(){this._isEnabled&&(this._vao=i(this._vao),this._areaTexture=i(this._areaTexture),this._searchTexture=i(this._searchTexture),this._blend=i(this._blend),this._edges=i(this._edges),this._isEnabled=!1)}render(e){if(!this._isEnabled)return;const t=this.rctx,r=t.getBoundFramebufferObject(),s={x:0,y:0,width:e.descriptor.width,height:e.descriptor.height};t.bindVAO(this._vao),this._edgeDetectTechnique.bindPipelineState(t),t.setViewport(s.x,s.y,s.width,s.height),this._edges.resize(s.width,s.height),t.bindFramebuffer(this._edges),t.setClearColor(0,0,0,1),t.clear(f.COLOR_BUFFER_BIT),t.useProgram(this._edgeDetectTechnique.program),this._edgeDetectTechnique.program.bindTexture(e,"tColor"),this._edgeDetectTechnique.program.setUniform4f("uResolution",1/s.width,1/s.height,s.width,s.height),t.drawArrays(w.TRIANGLES,0,3),this._blend.resize(s.width,s.height),t.bindFramebuffer(this._blend),t.setClearColor(0,0,1,1),t.clear(f.COLOR_BUFFER_BIT),t.useProgram(this._blendWeights.program),this._blendWeights.program.setUniform4f("uResolution",1/s.width,1/s.height,s.width,s.height),this._blendWeights.program.bindTexture(this._searchTexture,"tSearch"),this._blendWeights.program.bindTexture(this._areaTexture,"tArea"),this._blendWeights.program.bindTexture(this._edges.colorTexture,"tEdges"),t.drawArrays(w.TRIANGLES,0,3),t.bindFramebuffer(r),t.setClearColor(0,1,0,1),t.clear(f.COLOR_BUFFER_BIT),t.useProgram(this._blur.program),this._blur.program.setUniform4f("uResolution",1/s.width,1/s.height,s.width,s.height),this._blur.program.bindTexture(e,"tColor"),this._blur.program.bindTexture(this._blend.colorTexture,"tBlendWeights"),t.drawArrays(w.TRIANGLES,0,3)}_loadTextureFromBase64(e,t,r){const s=new A(this.rctx,{pixelFormat:r,dataType:E.UNSIGNED_BYTE,wrapMode:x.CLAMP_TO_EDGE,samplingMode:t},null);return n(e).then((e=>(s.resize(e.width,e.height),s.setData(e),s)))}};e([a()],C.prototype,"_abortController",void 0),e([a({readOnly:!0})],C.prototype,"updating",null),C=e([l("esri.views.3d.webgl-engine.lib.SmaaRenderPass")],C);export{C as SmaaRenderPass};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{abortMaybe as r,isSome as s,disposeMaybe as i}from"../../../../core/maybe.js";import{throwIfAborted as o,isAborted as h}from"../../../../core/promiseUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{requestImage as n}from"../../../../support/requestImageUtils.js";import{createScreenSizeTriangleVAO as d}from"./glUtil3D.js";import{SMAATechniqueConfiguration as u,SMAATechnique as _}from"./SMAATechnique.js";import{S as g}from"../../../../chunks/SMAA.glsl.js";import{TextureSamplingMode as c,PixelFormat as p,TargetType as m,DepthStencilTargetType as b,TextureType as T,PixelType as E,TextureWrapMode as x,ClearBufferBit as f,PrimitiveType as w}from"../../../webgl/enums.js";import{FramebufferObject as A}from"../../../webgl/FramebufferObject.js";import{Texture as R}from"../../../webgl/Texture.js";let C=class extends t{constructor(e,t){super({}),this.rctx=e,this._techniqueRep=t,this._isEnabled=!1}normalizeCtorArgs(){return{}}dispose(){this._abortController=r(this._abortController),this.disable()}_loadResources(e){if(s(this._abortController))return!1;if(s(this._searchTexture))return!0;this._abortController=new AbortController;const t=this._abortController.signal;return import("./SmaaRenderPassData.js").then((e=>this._loadTextures(e,t))).then((()=>e())).finally((()=>this._abortController=null)),!1}_loadTextures(e,t){return o(t),Promise.all([this._loadTextureFromBase64(e.areaTexture,c.LINEAR,p.RGB),this._loadTextureFromBase64(e.searchTexure,c.NEAREST,p.LUMINANCE)]).then((([e,r])=>{h(t)?(e.dispose(),r.dispose(),o(t)):(this._areaTexture=e,this._searchTexture=r)}))}get updating(){return s(this._abortController)}enable(e){if(this._isEnabled)return!0;if(!this._edgeDetectTechnique||!this._blendWeights||!this._blur){const e=new u,t=(e,t)=>this._techniqueRep.releaseAndAcquire(_,e,t);e.output=g.EdgeDetector,this._edgeDetectTechnique=t(e,this._edgeDetectTechnique),e.output=g.BlendWeight,this._blendWeights=t(e,this._blendWeights),e.output=g.Blur,this._blur=t(e,this._blur)}return!!this._loadResources(e)&&(this._vao=d(this.rctx),this._edges=new A(this.rctx,{colorTarget:m.TEXTURE,depthStencilTarget:b.NONE},{target:T.TEXTURE_2D,pixelFormat:p.RGB,dataType:E.UNSIGNED_BYTE,samplingMode:c.LINEAR,wrapMode:x.CLAMP_TO_EDGE,width:4,height:4}),this._blend=new A(this.rctx,{colorTarget:m.TEXTURE,depthStencilTarget:b.NONE},{target:T.TEXTURE_2D,pixelFormat:p.RGBA,dataType:E.UNSIGNED_BYTE,samplingMode:c.LINEAR,wrapMode:x.CLAMP_TO_EDGE,width:4,height:4}),this._isEnabled=!0,!0)}disable(){this._isEnabled&&(this._vao=i(this._vao),this._areaTexture=i(this._areaTexture),this._searchTexture=i(this._searchTexture),this._blend=i(this._blend),this._edges=i(this._edges),this._isEnabled=!1)}render(e){if(!this._isEnabled)return;const t=this.rctx,r=t.getBoundFramebufferObject(),s={x:0,y:0,width:e.descriptor.width,height:e.descriptor.height};t.bindVAO(this._vao),this._edgeDetectTechnique.bindPipelineState(t),t.setViewport(s.x,s.y,s.width,s.height),this._edges.resize(s.width,s.height),t.bindFramebuffer(this._edges),t.setClearColor(0,0,0,1),t.clear(f.COLOR_BUFFER_BIT),t.useProgram(this._edgeDetectTechnique.program),this._edgeDetectTechnique.program.bindTexture(e,"tColor"),this._edgeDetectTechnique.program.setUniform4f("resolution",1/s.width,1/s.height,s.width,s.height),t.drawArrays(w.TRIANGLES,0,3),this._blend.resize(s.width,s.height),t.bindFramebuffer(this._blend),t.setClearColor(0,0,1,1),t.clear(f.COLOR_BUFFER_BIT),t.useProgram(this._blendWeights.program),this._blendWeights.program.setUniform4f("resolution",1/s.width,1/s.height,s.width,s.height),this._blendWeights.program.bindTexture(this._searchTexture,"tSearch"),this._blendWeights.program.bindTexture(this._areaTexture,"tArea"),this._blendWeights.program.bindTexture(this._edges.colorTexture,"tEdges"),t.drawArrays(w.TRIANGLES,0,3),t.bindFramebuffer(r),t.setClearColor(0,1,0,1),t.clear(f.COLOR_BUFFER_BIT),t.useProgram(this._blur.program),this._blur.program.setUniform4f("resolution",1/s.width,1/s.height,s.width,s.height),this._blur.program.bindTexture(e,"tColor"),this._blur.program.bindTexture(this._blend.colorTexture,"tBlendWeights"),t.drawArrays(w.TRIANGLES,0,3)}_loadTextureFromBase64(e,t,r){const s=new R(this.rctx,{pixelFormat:r,dataType:E.UNSIGNED_BYTE,wrapMode:x.CLAMP_TO_EDGE,samplingMode:t},null);return n(e).then((e=>(s.resize(e.width,e.height),s.setData(e),s)))}};e([a()],C.prototype,"_abortController",void 0),e([a({readOnly:!0})],C.prototype,"updating",null),C=e([l("esri.views.3d.webgl-engine.lib.SmaaRenderPass")],C);export{C as SmaaRenderPass};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import s from"../../../../core/Evented.js";import{someMap as i}from"../../../../core/MapUtils.js";import{nextHighestPowerOfTwo as r}from"../../../../core/mathUtils.js";import{disposeMaybe as a,isSome as n,removeMaybe as h}from"../../../../core/maybe.js";import{generateUID as o}from"../../../../core/uid.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{VertexAttribute as c}from"./basicInterfaces.js";import{ContentObjectType as m}from"./ContentObjectType.js";import{TaskPriority as p,noBudget as g}from"../../../support/Scheduler.js";import{TextureType as u,PixelFormat as x,PixelType as T,TextureWrapMode as _,TextureSamplingMode as A}from"../../../webgl/enums.js";import{Texture as f}from"../../../webgl/Texture.js";var y;const v=512,R=4096,z=.85,w=.95;let b=y=class extends t{constructor(e){super(e),this.type=m.Texture,this.id=o(),this.events=new s,this._glTexture=null,this.needsClear=!1,this.elementsToAddOrUpdate=new Map,this.elementsToRemove=new Map,this.elementsToRender=new Map,this.elements=new Map,this.stageObjects=new Map,this.updating=!1}initialize(){this.stage=this.view._stage,this.canvas=this._create2DCanvas(),this.ctx=this.canvas.getContext("2d"),this.stage.add(this);const e=this._computeAtlasResolution(this.view.width,this.view.height);this._createAtlasRegion(e),this._update2DCanvasSize(),this._resetAtlasCursor()}unload(){this._glTexture=a(this._glTexture),this.updating=!1,this.events.emit("unloaded")}get width(){return this.atlas.size.width}get height(){return this.atlas.size.height}get requiresFrameUpdates(){return!1}_createDescriptor(e){return{target:u.TEXTURE_2D,pixelFormat:x.RGBA,dataType:T.UNSIGNED_BYTE,wrapMode:_.CLAMP_TO_EDGE,flipped:!0,samplingMode:A.LINEAR_MIPMAP_LINEAR,hasMipmap:!0,preMultiplyAlpha:!0,maxAnisotropy:e.parameters.maxMaxAnisotropy}}get glTexture(){return this._glTexture}load(e){return n(this._glTexture)||(this._glTexture=new f(e,this._createDescriptor(e),this.canvas),this.frameWorker=this.view.resourceController.scheduler.registerTask(p.TEXT_TEXTURE_ATLAS,this),this.setDirty()),this._glTexture}dispose(){this.elements=null,this.elementsToAddOrUpdate=null,this.elementsToRemove=null,this.elementsToRender=null,this.frameWorker=h(this.frameWorker),this._glTexture&&(this.stage.remove(this),this._glTexture=a(this._glTexture)),this.canvas.width=0,this.canvas.height=0,this.canvas=null,this.ctx=null}_create2DCanvas(){const e=document.createElement("canvas");return e.setAttribute("id","canvas2d"),e.setAttribute("style","display:none"),e.setAttribute("width",v.toString()),e.setAttribute("height",v.toString()),e}_update2DCanvasSize(){this.canvas.setAttribute("width",this.atlas.size.width.toString()),this.canvas.setAttribute("height",this.atlas.size.height.toString())}_createAtlasRegion(e=v){this.atlas={size:{width:e,height:e},cursor:{x:0,y:0},lineHeight:0}}_computeAtlasResolution(e,t){let s=Math.max(e,t);return s+=256,s=r(s),s=Math.min(s,R),s}_resizeAtlas(e,t){t=t||e;const s=this.atlas;s.size.width=e,s.size.height=t,n(this._glTexture)&&this._glTexture.resize(e,t),this._update2DCanvasSize()}_resetAtlasCursor(){const e=this.atlas;e.cursor.x=O,e.cursor.y=O+j,e.lineHeight=0,this.needsClear=!0}_getAtlasUsage(){const e=this.atlas;return(e.cursor.x+e.cursor.y*e.size.width)/(e.size.width*e.size.height)}_getExpectedAtlasUsage(){const e=this.elementsToRemove.size,t=this.elementsToAddOrUpdate.size,s=this.elements.size;return this._getAtlasUsage()/s*(s+t-e)}_addAtlasElement(e,t,s,i){const r=this.atlas,{renderedWidth:a,renderedHeight:n,displayWidth:h,displayHeight:o}=e.textRenderer;e.placement.offset.x=r.cursor.x,e.placement.offset.y=r.cursor.y,e.placement.size.width=a,e.placement.size.height=n,e.placement.size.displayWidth=h,e.placement.size.displayHeight=o,e.placement.uvMinMax=[e.placement.offset.x/r.size.width,1-(e.placement.offset.y+n)/r.size.height,(e.placement.offset.x+a)/r.size.width,1-e.placement.offset.y/r.size.height],r.cursor.x+=s,r.lineHeight=Math.max(r.lineHeight,i),this.elements.set(t,e)}_removeAtlasElement(e){if(e&&this.elements.has(e.textId)){const t=e.placement.offset,s=e.placement.size;this.ctx.clearRect(t.x,t.y,s.width,s.height),this.elements.delete(e.textId)}}_ensureStageObjects(e){const t=this.stageObjects.get(e);if(t)return t;const s=new Set;return this.stageObjects.set(e,s),s}_addStageObject(e,t){this._ensureStageObjects(e).add(t)}_removeStageObject(e,t){const s=this.stageObjects.get(e);s&&s.delete(t)&&(t.geometries[0].vertexAttributes.get(c.SIZE).data=[0,0],t.geometryVertexAttrsUpdated(t.geometryRecords[0]))}_processAddition(e,t){const s=this.atlas,i=e.textId,r=e.textRenderer.renderedWidth,a=e.textRenderer.renderedHeight,n=r+O,h=a+O+j;if(s.cursor.x+n<s.size.width&&s.cursor.y+h<s.size.height)this._addAtlasElement(e,i,n,h),this.elementsToRender.set(i,e),this.elementsToAddOrUpdate.delete(i);else{if(!(s.cursor.y+h+s.lineHeight<s.size.height)){const e=this._getExpectedAtlasUsage(),i=e>z&&s.size.width<R;return i&&this._resizeAtlas(2*s.size.width,2*s.size.height),!t||!i&&e>w&&s.size.width===R?(this._processRemovals(),E.OK):(this._repack(),E.REPACK)}s.cursor.x=O,s.cursor.y+=s.lineHeight,s.lineHeight=0,this._addAtlasElement(e,i,n,h),this.elementsToRender.set(i,e),this.elementsToAddOrUpdate.delete(i)}return E.OK}_processRemovals(){this.elementsToRemove.forEach(((e,t)=>{const s=this.stageObjects.get(t);s&&0!==s.size||this._removeAtlasElement(e),s&&0===s.size&&this.stageObjects.delete(t)})),this.elementsToRemove.clear()}_repack(){this._processRemovals(),this.elements.forEach(((e,t)=>{e.rendered=!1,this.elementsToAddOrUpdate.set(t,e)})),this.elements.clear(),this._resetAtlasCursor(),this.elementsToRender.clear()}_processRenderingRequest(e){this.ctx.clearRect(e.placement.offset.x,e.placement.offset.y,e.placement.size.width,e.placement.size.height),e.textRenderer.render(this.ctx,e.placement.offset.x,e.placement.offset.y);const t=this.stageObjects.get(e.textId);t&&t.forEach((t=>{t.geometries[0].vertexAttributes.get(c.UV0).data=new Float32Array(e.placement.uvMinMax),t.geometries[0].vertexAttributes.get(c.SIZE).data=[e.placement.size.displayWidth,e.placement.size.displayHeight],t.geometryVertexAttrsUpdated(t.geometryRecords[0])})),e.rendered=!0}get running(){return this.updating}runTask(e,t=!0){if(!this._glTexture)return;let s=!1;if(i(this.elementsToAddOrUpdate,((e,i)=>{const r=this.elements.get(i);if(r&&r.rendered){const e=this.stageObjects.get(i);return e&&e.forEach((e=>{const t=e.geometries[0].vertexAttributes,s=this.elements.get(i);t.get(c.UV0).data=new Float32Array(s.placement.uvMinMax),t.get(c.SIZE).data=new Float32Array([s.placement.size.displayWidth,s.placement.size.displayHeight]),e.geometryVertexAttrsUpdated(e.geometryRecords[0])})),this.elementsToAddOrUpdate.delete(i),!1}return this._processAddition(this.elementsToAddOrUpdate.get(i),t)===E.REPACK&&(s=!0,!0)})),s)return void this.runTask(g,!1);let r=!1;this.elementsToRender.size>0&&this.needsClear&&(this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.needsClear=!1),i(this.elementsToRender,((t,s)=>(this._processRenderingRequest(t),this.elementsToRender.delete(s),r=!0,e.madeProgress(),e.done))),r&&n(this._glTexture)&&this._glTexture.setData(this.canvas),this.updating=this.elementsToRender.size>0,!this.updating&&y.test.orderedRepackingEnabled&&this.repackOrdered()}addTextTexture(e,t){const s=e.key;this.elementsToAddOrUpdate.has(s)||this.elementsToAddOrUpdate.set(s,{textId:s,placement:{offset:{x:0,y:0},size:{width:0,height:0,displayWidth:0,displayHeight:0},uvMinMax:[]},textRenderer:e,rendered:!1}),this._addStageObject(s,t),this.elementsToRemove.delete(s),this.setDirty()}removeTextTexture(e,t){const s=e.key;this.elementsToRemove.set(s,this.elements.get(s)),this._removeStageObject(s,t)}setDirty(){this._glTexture&&(this.updating=!0)}repackOrdered(){if(0===this.elements.size)return;const e=[];this.elements.forEach(((t,s)=>e.push({element:t,key:s})));let t=!0;for(let s=0;s<e.length-1;s++)if(e[s].key.localeCompare(e[s+1].key)>0){t=!1;break}if(!t||this.elementsToRemove.size){e.sort(((e,t)=>e.key.localeCompare(t.key))),this.elements.clear();for(const{element:t,key:s}of e)this.elements.set(s,t);this._repack(),this.setDirty()}}get test(){const{elements:e,stageObjects:t,elementsToRemove:s,atlas:i}=this,r=this;return{elements:e,stageObjects:t,elementsToRemove:s,atlas:i,_resizeAtlas:(e,t)=>r._resizeAtlas(e,t),run:(e,t)=>r.runTask(e,t)}}};b.test={orderedRepackingEnabled:!1},e([l({constructOnly:!0})],b.prototype,"view",void 0),e([l({type:Boolean})],b.prototype,"updating",void 0),b=y=e([d("esri.views.3d.webgl-engine.lib.TextTextureAtlas")],b);const O=2,j=2;var E;!function(e){e[e.OK=0]="OK",e[e.REPACK=1]="REPACK"}(E||(E={}));const U=b;export{b as TextTextureAtlas,U as default};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import s from"../../../../core/Evented.js";import{someMap as i}from"../../../../core/MapUtils.js";import{nextHighestPowerOfTwo as r}from"../../../../core/mathUtils.js";import{disposeMaybe as a,isSome as n,removeMaybe as h}from"../../../../core/maybe.js";import{generateUID as o}from"../../../../core/uid.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{ContentObjectType as c}from"./ContentObjectType.js";import{VertexAttribute as m}from"./VertexAttribute.js";import{TaskPriority as p,noBudget as g}from"../../../support/Scheduler.js";import{TextureType as u,PixelFormat as x,PixelType as T,TextureWrapMode as _,TextureSamplingMode as A}from"../../../webgl/enums.js";import{Texture as f}from"../../../webgl/Texture.js";var y;const v=512,R=4096,z=.85,w=.95;let b=y=class extends t{constructor(e){super(e),this.type=c.Texture,this.id=o(),this.events=new s,this._glTexture=null,this.needsClear=!1,this.elementsToAddOrUpdate=new Map,this.elementsToRemove=new Map,this.elementsToRender=new Map,this.elements=new Map,this.stageObjects=new Map,this.updating=!1}initialize(){this.stage=this.view._stage,this.canvas=this._create2DCanvas(),this.ctx=this.canvas.getContext("2d"),this.stage.add(this);const e=this._computeAtlasResolution(this.view.width,this.view.height);this._createAtlasRegion(e),this._update2DCanvasSize(),this._resetAtlasCursor()}unload(){this._glTexture=a(this._glTexture),this.updating=!1,this.events.emit("unloaded")}get width(){return this.atlas.size.width}get height(){return this.atlas.size.height}get requiresFrameUpdates(){return!1}_createDescriptor(e){return{target:u.TEXTURE_2D,pixelFormat:x.RGBA,dataType:T.UNSIGNED_BYTE,wrapMode:_.CLAMP_TO_EDGE,flipped:!0,samplingMode:A.LINEAR_MIPMAP_LINEAR,hasMipmap:!0,preMultiplyAlpha:!0,maxAnisotropy:e.parameters.maxMaxAnisotropy}}get glTexture(){return this._glTexture}load(e){return n(this._glTexture)||(this._glTexture=new f(e,this._createDescriptor(e),this.canvas),this.frameWorker=this.view.resourceController.scheduler.registerTask(p.TEXT_TEXTURE_ATLAS,this),this.setDirty()),this._glTexture}dispose(){this.elements=null,this.elementsToAddOrUpdate=null,this.elementsToRemove=null,this.elementsToRender=null,this.frameWorker=h(this.frameWorker),this._glTexture&&(this.stage.remove(this),this._glTexture=a(this._glTexture)),this.canvas.width=0,this.canvas.height=0,this.canvas=null,this.ctx=null}_create2DCanvas(){const e=document.createElement("canvas");return e.setAttribute("id","canvas2d"),e.setAttribute("style","display:none"),e.setAttribute("width",v.toString()),e.setAttribute("height",v.toString()),e}_update2DCanvasSize(){this.canvas.setAttribute("width",this.atlas.size.width.toString()),this.canvas.setAttribute("height",this.atlas.size.height.toString())}_createAtlasRegion(e=v){this.atlas={size:{width:e,height:e},cursor:{x:0,y:0},lineHeight:0}}_computeAtlasResolution(e,t){let s=Math.max(e,t);return s+=256,s=r(s),s=Math.min(s,R),s}_resizeAtlas(e,t){t=t||e;const s=this.atlas;s.size.width=e,s.size.height=t,n(this._glTexture)&&this._glTexture.resize(e,t),this._update2DCanvasSize()}_resetAtlasCursor(){const e=this.atlas;e.cursor.x=O,e.cursor.y=O+j,e.lineHeight=0,this.needsClear=!0}_getAtlasUsage(){const e=this.atlas;return(e.cursor.x+e.cursor.y*e.size.width)/(e.size.width*e.size.height)}_getExpectedAtlasUsage(){const e=this.elementsToRemove.size,t=this.elementsToAddOrUpdate.size,s=this.elements.size;return this._getAtlasUsage()/s*(s+t-e)}_addAtlasElement(e,t,s,i){const r=this.atlas,{renderedWidth:a,renderedHeight:n,displayWidth:h,displayHeight:o}=e.textRenderer;e.placement.offset.x=r.cursor.x,e.placement.offset.y=r.cursor.y,e.placement.size.width=a,e.placement.size.height=n,e.placement.size.displayWidth=h,e.placement.size.displayHeight=o,e.placement.uvMinMax=[e.placement.offset.x/r.size.width,1-(e.placement.offset.y+n)/r.size.height,(e.placement.offset.x+a)/r.size.width,1-e.placement.offset.y/r.size.height],r.cursor.x+=s,r.lineHeight=Math.max(r.lineHeight,i),this.elements.set(t,e)}_removeAtlasElement(e){if(e&&this.elements.has(e.textId)){const t=e.placement.offset,s=e.placement.size;this.ctx.clearRect(t.x,t.y,s.width,s.height),this.elements.delete(e.textId)}}_ensureStageObjects(e){const t=this.stageObjects.get(e);if(t)return t;const s=new Set;return this.stageObjects.set(e,s),s}_addStageObject(e,t){this._ensureStageObjects(e).add(t)}_removeStageObject(e,t){const s=this.stageObjects.get(e);s&&s.delete(t)&&(t.geometries[0].vertexAttributes.get(m.SIZE).data=[0,0],t.geometryVertexAttrsUpdated(t.geometryRecords[0]))}_processAddition(e,t){const s=this.atlas,i=e.textId,r=e.textRenderer.renderedWidth,a=e.textRenderer.renderedHeight,n=r+O,h=a+O+j;if(s.cursor.x+n<s.size.width&&s.cursor.y+h<s.size.height)this._addAtlasElement(e,i,n,h),this.elementsToRender.set(i,e),this.elementsToAddOrUpdate.delete(i);else{if(!(s.cursor.y+h+s.lineHeight<s.size.height)){const e=this._getExpectedAtlasUsage(),i=e>z&&s.size.width<R;return i&&this._resizeAtlas(2*s.size.width,2*s.size.height),!t||!i&&e>w&&s.size.width===R?(this._processRemovals(),E.OK):(this._repack(),E.REPACK)}s.cursor.x=O,s.cursor.y+=s.lineHeight,s.lineHeight=0,this._addAtlasElement(e,i,n,h),this.elementsToRender.set(i,e),this.elementsToAddOrUpdate.delete(i)}return E.OK}_processRemovals(){this.elementsToRemove.forEach(((e,t)=>{const s=this.stageObjects.get(t);s&&0!==s.size||this._removeAtlasElement(e),s&&0===s.size&&this.stageObjects.delete(t)})),this.elementsToRemove.clear()}_repack(){this._processRemovals(),this.elements.forEach(((e,t)=>{e.rendered=!1,this.elementsToAddOrUpdate.set(t,e)})),this.elements.clear(),this._resetAtlasCursor(),this.elementsToRender.clear()}_processRenderingRequest(e){this.ctx.clearRect(e.placement.offset.x,e.placement.offset.y,e.placement.size.width,e.placement.size.height),e.textRenderer.render(this.ctx,e.placement.offset.x,e.placement.offset.y);const t=this.stageObjects.get(e.textId);t&&t.forEach((t=>{t.geometries[0].vertexAttributes.get(m.UV0).data=new Float32Array(e.placement.uvMinMax),t.geometries[0].vertexAttributes.get(m.SIZE).data=[e.placement.size.displayWidth,e.placement.size.displayHeight],t.geometryVertexAttrsUpdated(t.geometryRecords[0])})),e.rendered=!0}get running(){return this.updating}runTask(e,t=!0){if(!this._glTexture)return;let s=!1;if(i(this.elementsToAddOrUpdate,((e,i)=>{const r=this.elements.get(i);if(r&&r.rendered){const e=this.stageObjects.get(i);return e&&e.forEach((e=>{const t=e.geometries[0].vertexAttributes,s=this.elements.get(i);t.get(m.UV0).data=new Float32Array(s.placement.uvMinMax),t.get(m.SIZE).data=new Float32Array([s.placement.size.displayWidth,s.placement.size.displayHeight]),e.geometryVertexAttrsUpdated(e.geometryRecords[0])})),this.elementsToAddOrUpdate.delete(i),!1}return this._processAddition(this.elementsToAddOrUpdate.get(i),t)===E.REPACK&&(s=!0,!0)})),s)return void this.runTask(g,!1);let r=!1;this.elementsToRender.size>0&&this.needsClear&&(this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.needsClear=!1),i(this.elementsToRender,((t,s)=>(this._processRenderingRequest(t),this.elementsToRender.delete(s),r=!0,e.madeProgress(),e.done))),r&&n(this._glTexture)&&this._glTexture.setData(this.canvas),this.updating=this.elementsToRender.size>0,!this.updating&&y.test.orderedRepackingEnabled&&this.repackOrdered()}addTextTexture(e,t){const s=e.key;this.elementsToAddOrUpdate.has(s)||this.elementsToAddOrUpdate.set(s,{textId:s,placement:{offset:{x:0,y:0},size:{width:0,height:0,displayWidth:0,displayHeight:0},uvMinMax:[]},textRenderer:e,rendered:!1}),this._addStageObject(s,t),this.elementsToRemove.delete(s),this.setDirty()}removeTextTexture(e,t){const s=e.key;this.elementsToRemove.set(s,this.elements.get(s)),this._removeStageObject(s,t)}setDirty(){this._glTexture&&(this.updating=!0)}repackOrdered(){if(0===this.elements.size)return;const e=[];this.elements.forEach(((t,s)=>e.push({element:t,key:s})));let t=!0;for(let s=0;s<e.length-1;s++)if(e[s].key.localeCompare(e[s+1].key)>0){t=!1;break}if(!t||this.elementsToRemove.size){e.sort(((e,t)=>e.key.localeCompare(t.key))),this.elements.clear();for(const{element:t,key:s}of e)this.elements.set(s,t);this._repack(),this.setDirty()}}get test(){const{elements:e,stageObjects:t,elementsToRemove:s,atlas:i}=this,r=this;return{elements:e,stageObjects:t,elementsToRemove:s,atlas:i,_resizeAtlas:(e,t)=>r._resizeAtlas(e,t),run:(e,t)=>r.runTask(e,t)}}};b.test={orderedRepackingEnabled:!1},e([l({constructOnly:!0})],b.prototype,"view",void 0),e([l({type:Boolean})],b.prototype,"updating",void 0),b=y=e([d("esri.views.3d.webgl-engine.lib.TextTextureAtlas")],b);const O=2,j=2;var E;!function(e){e[e.OK=0]="OK",e[e.REPACK=1]="REPACK"}(E||(E={}));const U=b;export{b as TextTextureAtlas,U as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{neverReached as t}from"../../../../core/compilerUtils.js";import e from"../../../../core/Error.js";import r from"../../../../core/Evented.js";import{isPowerOfTwo as i,nextHighestPowerOfTwo as s}from"../../../../core/mathUtils.js";import{isNone as a,isSome as o,removeMaybe as n}from"../../../../core/maybe.js";import{throwIfAborted as m,onAbort as h,createAbortError as l}from"../../../../core/promiseUtils.js";import{isArrayBuffer as p,isUint8Array as d}from"../../../../core/typedArrayUtil.js";import{isBlobProtocol as _,isDataProtocol as c}from"../../../../core/urlUtils.js";import{requestImage as u}from"../../../../support/requestImageUtils.js";import{loadImageAsync as T}from"../../../../support/requestUtils.js";import{PowerOfTwoResizeMode as g}from"./basicInterfaces.js";import{estimateMemoryKTX2 as f,estimateMemoryBasis as w,createTextureKTX2 as E,createTextureBasis as A}from"./BasisUtil.js";import{ContentObject as x}from"./ContentObject.js";import{ContentObjectType as D}from"./ContentObjectType.js";import{createDDSTexture as I}from"./DDSUtil.js";import{createQuadVAO as M}from"./glUtil3D.js";import{assert as F}from"./Util.js";import{TextureWrapMode as O,TextureType as N,PixelFormat as y,PixelType as R,TextureSamplingMode as U,TargetType as b,DepthStencilTargetType as C,PrimitiveType as P}from"../../../webgl/enums.js";import{FramebufferObject as S}from"../../../webgl/FramebufferObject.js";import{Texture as H}from"../../../webgl/Texture.js";import{vertexCount as V}from"../../../webgl/Util.js";import j from"../../../webgl/capabilities/isWebGL2Context.js";class L extends x{constructor(t,e){super(),this.data=t,this.type=D.Texture,this._glTexture=null,this._powerOfTwoStretchInfo=null,this._loadingPromise=null,this._loadingController=null,this.events=new r,this.params=e||{},this.params.mipmap=!1!==this.params.mipmap,this.params.noUnpackFlip=this.params.noUnpackFlip||!1,this.params.preMultiplyAlpha=this.params.preMultiplyAlpha||!1,this.params.wrap=this.params.wrap||{s:O.REPEAT,t:O.REPEAT},this.params.powerOfTwoResizeMode=this.params.powerOfTwoResizeMode||g.STRETCH,this.estimatedTexMemRequired=L._estimateTexMemRequired(this.data,this.params),this._startPreload()}_startPreload(){const t=this.data;a(t)||(t instanceof HTMLVideoElement?this._startPreloadVideoElement(t):t instanceof HTMLImageElement&&this._startPreloadImageElement(t))}_startPreloadVideoElement(t){_(t.src)||"auto"===t.preload&&t.crossOrigin||(t.preload="auto",t.crossOrigin="anonymous",t.src=t.src)}_startPreloadImageElement(t){c(t.src)||_(t.src)||t.crossOrigin||(t.crossOrigin="anonymous",t.src=t.src)}static _getDataDimensions(t){return t instanceof HTMLVideoElement?{width:t.videoWidth,height:t.videoHeight}:t}static _estimateTexMemRequired(t,e){if(a(t))return 0;if(p(t)||d(t))return e.encoding===L.KTX2_ENCODING?f(t,e.mipmap):e.encoding===L.BASIS_ENCODING?w(t,e.mipmap):t.byteLength;const{width:r,height:i}=t instanceof Image||t instanceof ImageData||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement?L._getDataDimensions(t):e;return(e.mipmap?4/3:1)*r*i*(e.components||4)||0}dispose(){this.data=void 0}get width(){return this.params.width}get height(){return this.params.height}_createDescriptor(t){var e;return{target:N.TEXTURE_2D,pixelFormat:y.RGBA,dataType:R.UNSIGNED_BYTE,wrapMode:this.params.wrap,flipped:!this.params.noUnpackFlip,samplingMode:this.params.mipmap?U.LINEAR_MIPMAP_LINEAR:U.LINEAR,hasMipmap:this.params.mipmap,preMultiplyAlpha:this.params.preMultiplyAlpha,maxAnisotropy:null!=(e=this.params.maxAnisotropy)?e:this.params.mipmap?t.parameters.maxMaxAnisotropy:1}}get glTexture(){return this._glTexture}load(t,e){if(o(this._glTexture))return this._glTexture;if(o(this._loadingPromise))return this._loadingPromise;const r=this.data;return a(r)?(this._glTexture=new H(t,this._createDescriptor(t),null),this._glTexture):"string"==typeof r?this._loadFromURL(t,e,r):r instanceof Image?this._loadFromImageElement(t,e,r):r instanceof HTMLVideoElement?this._loadFromVideoElement(t,e,r):r instanceof ImageData||r instanceof HTMLCanvasElement?this._loadFromImage(t,r,e):(p(r)||d(r))&&this.params.encoding===L.DDS_ENCODING?this._loadFromDDSData(t,r):(p(r)||d(r))&&this.params.encoding===L.KTX2_ENCODING?this._loadFromKTX2(t,r):(p(r)||d(r))&&this.params.encoding===L.BASIS_ENCODING?this._loadFromBasis(t,r):d(r)?this._loadFromPixelData(t,r):p(r)?this._loadFromPixelData(t,new Uint8Array(r)):null}get requiresFrameUpdates(){return this.data instanceof HTMLVideoElement}frameUpdate(t,e,r){if(!(this.data instanceof HTMLVideoElement)||a(this._glTexture))return r;if(this.data.readyState<G.HAVE_CURRENT_DATA||r===this.data.currentTime)return r;if(o(this._powerOfTwoStretchInfo)){const{framebuffer:r,vao:i,sourceTexture:s}=this._powerOfTwoStretchInfo;s.setData(this.data),this._drawStretchedTexture(t,e,r,i,s,this._glTexture)}else{const{width:t,height:e}=this.data,{width:r,height:i}=this._glTexture.descriptor;t!==r||e!==i?this._glTexture.updateData(0,0,0,Math.min(t,r),Math.min(e,i),this.data):this._glTexture.setData(this.data)}return this._glTexture.descriptor.hasMipmap&&this._glTexture.generateMipmap(),this.data.currentTime}_loadFromDDSData(t,e){return this._glTexture=I(t,this._createDescriptor(t),e),this._glTexture}_loadFromKTX2(t,e){return this._loadAsync((()=>E(t,this._createDescriptor(t),e).then((t=>(this._glTexture=t,t)))))}_loadFromBasis(t,e){return this._loadAsync((()=>A(t,this._createDescriptor(t),e).then((t=>(this._glTexture=t,t)))))}_loadFromPixelData(t,e){F(this.params.width>0&&this.params.height>0);const r=this._createDescriptor(t);return r.pixelFormat=1===this.params.components?y.LUMINANCE:3===this.params.components?y.RGB:y.RGBA,r.width=this.params.width,r.height=this.params.height,this._glTexture=new H(t,r,e),this._glTexture}_loadFromURL(t,e,r){return this._loadAsync((async i=>{const s=await u(r,{signal:i});return m(i),this._loadFromImage(t,s,e)}))}_loadFromImageElement(t,e,r){return r.complete?this._loadFromImage(t,r,e):this._loadAsync((async i=>{const s=await T(r,r.src,!1,i);return m(i),this._loadFromImage(t,s,e)}))}_loadFromVideoElement(t,e,r){return r.readyState>=G.HAVE_CURRENT_DATA?this._loadFromImage(t,r,e):this._loadFromVideoElementAsync(t,e,r)}_loadFromVideoElementAsync(t,r,i){return this._loadAsync((s=>new Promise(((a,o)=>{const m=()=>{i.removeEventListener("loadeddata",p),i.removeEventListener("error",d),n(_)},p=()=>{i.readyState>=G.HAVE_CURRENT_DATA&&(m(),a(this._loadFromImage(t,i,r)))},d=t=>{m(),o(t||new e("Failed to load video"))};i.addEventListener("loadeddata",p),i.addEventListener("error",d);const _=h(s,(()=>d(l())))}))))}_loadFromImage(t,e,r){const s=L._getDataDimensions(e);this.params.width=s.width,this.params.height=s.height;const a=this._createDescriptor(t);return a.pixelFormat=3===this.params.components?y.RGB:y.RGBA,!this._requiresPowerOfTwo(t,a)||i(s.width)&&i(s.height)?(a.width=s.width,a.height=s.height,this._glTexture=new H(t,a,e),this._glTexture):(this._glTexture=this._makePowerOfTwoTexture(t,e,s,a,r),this._glTexture)}_loadAsync(t){const e=new AbortController;this._loadingController=e;const r=t(e.signal);this._loadingPromise=r;const i=()=>{this._loadingController===e&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null)};return r.then(i,i),r}_requiresPowerOfTwo(t,e){const r=O.CLAMP_TO_EDGE,i="number"==typeof e.wrapMode?e.wrapMode===r:e.wrapMode.s===r&&e.wrapMode.t===r;return!j(t.gl)&&(e.hasMipmap||!i)}_makePowerOfTwoTexture(e,r,i,a,o){const{width:n,height:m}=i,h=s(n),l=s(m);let p;switch(a.width=h,a.height=l,this.params.powerOfTwoResizeMode){case g.PAD:a.textureCoordinateScaleFactor=[n/h,m/l],p=new H(e,a),p.updateData(0,0,0,n,m,r);break;case g.STRETCH:case null:case void 0:p=this._stretchToPowerOfTwo(e,r,a,o());break;default:t(this.params.powerOfTwoResizeMode)}return a.hasMipmap&&p.generateMipmap(),p}_stretchToPowerOfTwo(t,e,r,i){const s=new H(t,r),a=new S(t,{colorTarget:b.TEXTURE,depthStencilTarget:C.NONE},s),o=new H(t,{target:N.TEXTURE_2D,pixelFormat:r.pixelFormat,dataType:R.UNSIGNED_BYTE,wrapMode:O.CLAMP_TO_EDGE,samplingMode:U.LINEAR,flipped:!!r.flipped,maxAnisotropy:8,preMultiplyAlpha:r.preMultiplyAlpha},e),n=M(t),m=t.getBoundFramebufferObject();return this._drawStretchedTexture(t,i,a,n,o,s),this.requiresFrameUpdates?this._powerOfTwoStretchInfo={vao:n,sourceTexture:o,framebuffer:a}:(n.dispose(!0),o.dispose(),a.detachColorTexture(),a.dispose()),t.bindFramebuffer(m),s}_drawStretchedTexture(t,e,r,i,s,a){t.bindFramebuffer(r);const o=t.getViewport();t.setViewport(0,0,a.descriptor.width,a.descriptor.height);const n=e.program;t.useProgram(n),n.setUniform4f("color",1,1,1,1),n.bindTexture(s,"tex"),t.bindVAO(i),e.bindPipelineState(t),t.drawArrays(P.TRIANGLE_STRIP,0,V(i,"geometry")),t.bindFramebuffer(null),t.setViewport(o.x,o.y,o.width,o.height)}unload(){if(o(this._powerOfTwoStretchInfo)){const{framebuffer:t,vao:e,sourceTexture:r}=this._powerOfTwoStretchInfo;e.dispose(!0),r.dispose(),t.dispose(),this._glTexture=null,this._powerOfTwoStretchInfo=null}if(o(this._glTexture)&&(this._glTexture.dispose(),this._glTexture=null),o(this._loadingController)){const t=this._loadingController;this._loadingController=null,this._loadingPromise=null,t.abort()}this.events.emit("unloaded")}}var G;L.DDS_ENCODING="image/vnd-ms.dds",L.KTX2_ENCODING="image/ktx2",L.BASIS_ENCODING="image/x.basis",function(t){t[t.HAVE_NOTHING=0]="HAVE_NOTHING",t[t.HAVE_METADATA=1]="HAVE_METADATA",t[t.HAVE_CURRENT_DATA=2]="HAVE_CURRENT_DATA",t[t.HAVE_FUTURE_DATA=3]="HAVE_FUTURE_DATA",t[t.HAVE_ENOUGH_DATA=4]="HAVE_ENOUGH_DATA"}(G||(G={}));export{L as Texture};
5
+ import{neverReached as t}from"../../../../core/compilerUtils.js";import e from"../../../../core/Error.js";import r from"../../../../core/Evented.js";import{isPowerOfTwo as i,nextHighestPowerOfTwo as s}from"../../../../core/mathUtils.js";import{isNone as a,isSome as o,removeMaybe as n}from"../../../../core/maybe.js";import{throwIfAborted as m,onAbort as h,createAbortError as l}from"../../../../core/promiseUtils.js";import{isArrayBuffer as p,isUint8Array as d}from"../../../../core/typedArrayUtil.js";import{isBlobProtocol as _,isDataProtocol as c}from"../../../../core/urlUtils.js";import{requestImage as u}from"../../../../support/requestImageUtils.js";import{loadImageAsync as T}from"../../../../support/requestUtils.js";import{PowerOfTwoResizeMode as g}from"./basicInterfaces.js";import{estimateMemoryKTX2 as f,estimateMemoryBasis as w,createTextureKTX2 as E,createTextureBasis as A}from"./BasisUtil.js";import{ContentObject as x}from"./ContentObject.js";import{ContentObjectType as D}from"./ContentObjectType.js";import{createDDSTexture as I}from"./DDSUtil.js";import{createQuadVAO as M}from"./glUtil3D.js";import{assert as F}from"./Util.js";import{TextureWrapMode as O,TextureType as N,PixelFormat as y,PixelType as R,TextureSamplingMode as U,TargetType as b,DepthStencilTargetType as C,PrimitiveType as P}from"../../../webgl/enums.js";import{FramebufferObject as S}from"../../../webgl/FramebufferObject.js";import{Texture as H}from"../../../webgl/Texture.js";import{vertexCount as V}from"../../../webgl/Util.js";import j from"../../../webgl/capabilities/isWebGL2Context.js";class L extends x{constructor(t,e){super(),this.data=t,this.type=D.Texture,this._glTexture=null,this._powerOfTwoStretchInfo=null,this._loadingPromise=null,this._loadingController=null,this.events=new r,this.params=e||{},this.params.mipmap=!1!==this.params.mipmap,this.params.noUnpackFlip=this.params.noUnpackFlip||!1,this.params.preMultiplyAlpha=this.params.preMultiplyAlpha||!1,this.params.wrap=this.params.wrap||{s:O.REPEAT,t:O.REPEAT},this.params.powerOfTwoResizeMode=this.params.powerOfTwoResizeMode||g.STRETCH,this.estimatedTexMemRequired=L._estimateTexMemRequired(this.data,this.params),this._startPreload()}_startPreload(){const t=this.data;a(t)||(t instanceof HTMLVideoElement?this._startPreloadVideoElement(t):t instanceof HTMLImageElement&&this._startPreloadImageElement(t))}_startPreloadVideoElement(t){_(t.src)||"auto"===t.preload&&t.crossOrigin||(t.preload="auto",t.crossOrigin="anonymous",t.src=t.src)}_startPreloadImageElement(t){c(t.src)||_(t.src)||t.crossOrigin||(t.crossOrigin="anonymous",t.src=t.src)}static _getDataDimensions(t){return t instanceof HTMLVideoElement?{width:t.videoWidth,height:t.videoHeight}:t}static _estimateTexMemRequired(t,e){if(a(t))return 0;if(p(t)||d(t))return e.encoding===L.KTX2_ENCODING?f(t,e.mipmap):e.encoding===L.BASIS_ENCODING?w(t,e.mipmap):t.byteLength;const{width:r,height:i}=t instanceof Image||t instanceof ImageData||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement?L._getDataDimensions(t):e;return(e.mipmap?4/3:1)*r*i*(e.components||4)||0}dispose(){this.data=void 0}get width(){return this.params.width}get height(){return this.params.height}_createDescriptor(t){var e;return{target:N.TEXTURE_2D,pixelFormat:y.RGBA,dataType:R.UNSIGNED_BYTE,wrapMode:this.params.wrap,flipped:!this.params.noUnpackFlip,samplingMode:this.params.mipmap?U.LINEAR_MIPMAP_LINEAR:U.LINEAR,hasMipmap:this.params.mipmap,preMultiplyAlpha:this.params.preMultiplyAlpha,maxAnisotropy:null!=(e=this.params.maxAnisotropy)?e:this.params.mipmap?t.parameters.maxMaxAnisotropy:1}}get glTexture(){return this._glTexture}load(t,e){if(o(this._glTexture))return this._glTexture;if(o(this._loadingPromise))return this._loadingPromise;const r=this.data;return a(r)?(this._glTexture=new H(t,this._createDescriptor(t),null),this._glTexture):"string"==typeof r?this._loadFromURL(t,e,r):r instanceof Image?this._loadFromImageElement(t,e,r):r instanceof HTMLVideoElement?this._loadFromVideoElement(t,e,r):r instanceof ImageData||r instanceof HTMLCanvasElement?this._loadFromImage(t,r,e):(p(r)||d(r))&&this.params.encoding===L.DDS_ENCODING?this._loadFromDDSData(t,r):(p(r)||d(r))&&this.params.encoding===L.KTX2_ENCODING?this._loadFromKTX2(t,r):(p(r)||d(r))&&this.params.encoding===L.BASIS_ENCODING?this._loadFromBasis(t,r):d(r)?this._loadFromPixelData(t,r):p(r)?this._loadFromPixelData(t,new Uint8Array(r)):null}get requiresFrameUpdates(){return this.data instanceof HTMLVideoElement}frameUpdate(t,e,r){if(!(this.data instanceof HTMLVideoElement)||a(this._glTexture))return r;if(this.data.readyState<G.HAVE_CURRENT_DATA||r===this.data.currentTime)return r;if(o(this._powerOfTwoStretchInfo)){const{framebuffer:r,vao:i,sourceTexture:s}=this._powerOfTwoStretchInfo;s.setData(this.data),this._drawStretchedTexture(t,e,r,i,s,this._glTexture)}else{const{width:t,height:e}=this.data,{width:r,height:i}=this._glTexture.descriptor;t!==r||e!==i?this._glTexture.updateData(0,0,0,Math.min(t,r),Math.min(e,i),this.data):this._glTexture.setData(this.data)}return this._glTexture.descriptor.hasMipmap&&this._glTexture.generateMipmap(),this.data.currentTime}_loadFromDDSData(t,e){return this._glTexture=I(t,this._createDescriptor(t),e),this._glTexture}_loadFromKTX2(t,e){return this._loadAsync((()=>E(t,this._createDescriptor(t),e).then((t=>(this._glTexture=t,t)))))}_loadFromBasis(t,e){return this._loadAsync((()=>A(t,this._createDescriptor(t),e).then((t=>(this._glTexture=t,t)))))}_loadFromPixelData(t,e){F(this.params.width>0&&this.params.height>0);const r=this._createDescriptor(t);return r.pixelFormat=1===this.params.components?y.LUMINANCE:3===this.params.components?y.RGB:y.RGBA,r.width=this.params.width,r.height=this.params.height,this._glTexture=new H(t,r,e),this._glTexture}_loadFromURL(t,e,r){return this._loadAsync((async i=>{const s=await u(r,{signal:i});return m(i),this._loadFromImage(t,s,e)}))}_loadFromImageElement(t,e,r){return r.complete?this._loadFromImage(t,r,e):this._loadAsync((async i=>{const s=await T(r,r.src,!1,i);return m(i),this._loadFromImage(t,s,e)}))}_loadFromVideoElement(t,e,r){return r.readyState>=G.HAVE_CURRENT_DATA?this._loadFromImage(t,r,e):this._loadFromVideoElementAsync(t,e,r)}_loadFromVideoElementAsync(t,r,i){return this._loadAsync((s=>new Promise(((a,o)=>{const m=()=>{i.removeEventListener("loadeddata",p),i.removeEventListener("error",d),n(_)},p=()=>{i.readyState>=G.HAVE_CURRENT_DATA&&(m(),a(this._loadFromImage(t,i,r)))},d=t=>{m(),o(t||new e("Failed to load video"))};i.addEventListener("loadeddata",p),i.addEventListener("error",d);const _=h(s,(()=>d(l())))}))))}_loadFromImage(t,e,r){const s=L._getDataDimensions(e);this.params.width=s.width,this.params.height=s.height;const a=this._createDescriptor(t);return a.pixelFormat=3===this.params.components?y.RGB:y.RGBA,!this._requiresPowerOfTwo(t,a)||i(s.width)&&i(s.height)?(a.width=s.width,a.height=s.height,this._glTexture=new H(t,a,e),this._glTexture):(this._glTexture=this._makePowerOfTwoTexture(t,e,s,a,r),this._glTexture)}_loadAsync(t){const e=new AbortController;this._loadingController=e;const r=t(e.signal);this._loadingPromise=r;const i=()=>{this._loadingController===e&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null)};return r.then(i,i),r}_requiresPowerOfTwo(t,e){const r=O.CLAMP_TO_EDGE,i="number"==typeof e.wrapMode?e.wrapMode===r:e.wrapMode.s===r&&e.wrapMode.t===r;return!j(t.gl)&&(e.hasMipmap||!i)}_makePowerOfTwoTexture(e,r,i,a,o){const{width:n,height:m}=i,h=s(n),l=s(m);let p;switch(a.width=h,a.height=l,this.params.powerOfTwoResizeMode){case g.PAD:a.textureCoordinateScaleFactor=[n/h,m/l],p=new H(e,a),p.updateData(0,0,0,n,m,r);break;case g.STRETCH:case null:case void 0:p=this._stretchToPowerOfTwo(e,r,a,o());break;default:t(this.params.powerOfTwoResizeMode)}return a.hasMipmap&&p.generateMipmap(),p}_stretchToPowerOfTwo(t,e,r,i){const s=new H(t,r),a=new S(t,{colorTarget:b.TEXTURE,depthStencilTarget:C.NONE},s),o=new H(t,{target:N.TEXTURE_2D,pixelFormat:r.pixelFormat,dataType:R.UNSIGNED_BYTE,wrapMode:O.CLAMP_TO_EDGE,samplingMode:U.LINEAR,flipped:!!r.flipped,maxAnisotropy:8,preMultiplyAlpha:r.preMultiplyAlpha},e),n=M(t),m=t.getBoundFramebufferObject();return this._drawStretchedTexture(t,i,a,n,o,s),this.requiresFrameUpdates?this._powerOfTwoStretchInfo={vao:n,sourceTexture:o,framebuffer:a}:(n.dispose(!0),o.dispose(),a.detachColorTexture(),a.dispose()),t.bindFramebuffer(m),s}_drawStretchedTexture(t,e,r,i,s,a){t.bindFramebuffer(r);const o=t.getViewport();t.setViewport(0,0,a.descriptor.width,a.descriptor.height);const n=e.program;t.useProgram(n),n.setUniform4f("uColor",1,1,1,1),n.bindTexture(s,"tex"),t.bindVAO(i),e.bindPipelineState(t),t.drawArrays(P.TRIANGLE_STRIP,0,V(i,"geometry")),t.bindFramebuffer(null),t.setViewport(o.x,o.y,o.width,o.height)}unload(){if(o(this._powerOfTwoStretchInfo)){const{framebuffer:t,vao:e,sourceTexture:r}=this._powerOfTwoStretchInfo;e.dispose(!0),r.dispose(),t.dispose(),this._glTexture=null,this._powerOfTwoStretchInfo=null}if(o(this._glTexture)&&(this._glTexture.dispose(),this._glTexture=null),o(this._loadingController)){const t=this._loadingController;this._loadingController=null,this._loadingPromise=null,t.abort()}this.events.emit("unloaded")}}var G;L.DDS_ENCODING="image/vnd-ms.dds",L.KTX2_ENCODING="image/ktx2",L.BASIS_ENCODING="image/x.basis",function(t){t[t.HAVE_NOTHING=0]="HAVE_NOTHING",t[t.HAVE_METADATA=1]="HAVE_METADATA",t[t.HAVE_CURRENT_DATA=2]="HAVE_CURRENT_DATA",t[t.HAVE_FUTURE_DATA=3]="HAVE_FUTURE_DATA",t[t.HAVE_ENOUGH_DATA=4]="HAVE_ENOUGH_DATA"}(G||(G={}));export{L as Texture};
@@ -0,0 +1,4 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
+ */
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
+ */
5
+ var O;!function(O){O.POSITION="position",O.NORMAL="normal",O.UV0="uv0",O.AUXPOS1="auxpos1",O.AUXPOS2="auxpos2",O.MAPPOS="mapPos",O.COLOR="color",O.SYMBOLCOLOR="symbolColor",O.SIZE="size",O.TANGENT="tangent",O.OFFSET="offset",O.SUBDIVISIONFACTOR="subdivisionFactor",O.COLORFEATUREATTRIBUTE="colorFeatureAttribute",O.SIZEFEATUREATTRIBUTE="sizeFeatureAttribute",O.OPACITYFEATUREATTRIBUTE="opacityFeatureAttribute",O.DISTANCETOSTART="distanceToStart",O.UVMAPSPACE="uvMapSpace",O.BOUNDINGRECT="boundingRect",O.UVREGION="uvRegion",O.NORMALCOMPRESSED="normalCompressed",O.PROFILERIGHT="profileRight",O.PROFILEUP="profileUp",O.PROFILEVERTEXANDNORMAL="profileVertexAndNormal",O.FEATUREVALUE="featureValue",O.MODELORIGINHI="modelOriginHi",O.MODELORIGINLO="modelOriginLo",O.MODEL="model",O.MODELNORMAL="modelNormal",O.INSTANCECOLOR="instanceColor",O.INSTANCEFEATUREATTRIBUTE="instanceFeatureAttribute",O.LOCALTRANSFORM="localTransform",O.GLOBALTRANSFORM="globalTransform",O.BOUNDINGSPHERE="boundingSphere",O.MODELORIGIN="modelOrigin",O.MODELSCALEFACTORS="modelScaleFactors",O.FEATUREATTRIBUTE="featureAttribute",O.STATE="state",O.LODLEVEL="lodLevel",O.POSITION0="position0",O.POSITION1="position1",O.NORMALA="normalA",O.NORMALB="normalB",O.COMPONENTINDEX="componentIndex",O.VARIANTOFFSET="variantOffset",O.VARIANTSTROKE="variantStroke",O.VARIANTEXTENSION="variantExtension",O.U8PADDING="u8padding",O.U16PADDING="u16padding",O.SIDENESS="sideness",O.START="start",O.END="end",O.UP="up",O.EXTRUDE="extrude"}(O||(O={}));export{O as VertexAttribute};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- var O,e,n,t,o,A,E,N,T,i,a,r,R,l;!function(O){O.POSITION="position",O.NORMAL="normal",O.UV0="uv0",O.AUXPOS1="auxpos1",O.AUXPOS2="auxpos2",O.MAPPOS="mapPos",O.COLOR="color",O.SYMBOLCOLOR="symbolColor",O.SIZE="size",O.TANGENT="tangent",O.OFFSET="offset",O.SUBDIVISIONFACTOR="subdivisionFactor",O.COLORFEATUREATTRIBUTE="colorFeatureAttribute",O.SIZEFEATUREATTRIBUTE="sizeFeatureAttribute",O.OPACITYFEATUREATTRIBUTE="opacityFeatureAttribute",O.DISTANCETOSTART="distanceToStart",O.UVMAPSPACE="uvMapSpace",O.BOUNDINGRECT="boundingRect",O.UVREGION="uvRegion",O.NORMALCOMPRESSED="normalCompressed",O.PROFILERIGHT="profileRight",O.PROFILEUP="profileUp",O.PROFILEVERTEXANDNORMAL="profileVertexAndNormal",O.FEATUREVALUE="featureValue",O.MODELORIGINHI="modelOriginHi",O.MODELORIGINLO="modelOriginLo",O.MODEL="model",O.MODELNORMAL="modelNormal",O.INSTANCECOLOR="instanceColor",O.INSTANCEFEATUREATTRIBUTE="instanceFeatureAttribute",O.LOCALTRANSFORM="localTransform",O.GLOBALTRANSFORM="globalTransform",O.BOUNDINGSPHERE="boundingSphere",O.MODELORIGIN="modelOrigin",O.MODELSCALEFACTORS="modelScaleFactors",O.FEATUREATTRIBUTE="featureAttribute",O.STATE="state",O.LODLEVEL="lodLevel",O.POSITION0="position0",O.POSITION1="position1",O.NORMALA="normalA",O.NORMALB="normalB",O.COMPONENTINDEX="componentIndex",O.VARIANTOFFSET="variantOffset",O.VARIANTSTROKE="variantStroke",O.VARIANTEXTENSION="variantExtension",O.U8PADDING="u8padding",O.U16PADDING="u16padding",O.SIDENESS="sideness",O.START="start",O.END="end",O.UP="up",O.EXTRUDE="extrude"}(O||(O={})),function(O){O[O.None=0]="None",O[O.Front=1]="Front",O[O.Back=2]="Back",O[O.COUNT=3]="COUNT"}(e||(e={})),function(O){O[O.NONE=0]="NONE",O[O.SMAA=1]="SMAA"}(n||(n={})),function(O){O[O.Color=0]="Color",O[O.Alpha=1]="Alpha",O[O.FrontFace=2]="FrontFace",O[O.NONE=3]="NONE",O[O.COUNT=4]="COUNT"}(t||(t={})),function(O){O[O.BACKGROUND=0]="BACKGROUND",O[O.UPDATE=1]="UPDATE"}(o||(o={})),function(O){O[O.NOT_LOADED=0]="NOT_LOADED",O[O.LOADING=1]="LOADING",O[O.LOADED=2]="LOADED"}(A||(A={})),function(O){O[O.IntegratedMeshMaskExcluded=1]="IntegratedMeshMaskExcluded",O[O.OutlineVisualElementMask=2]="OutlineVisualElementMask"}(E||(E={})),function(O){O[O.ASYNC=0]="ASYNC",O[O.SYNC=1]="SYNC"}(N||(N={})),function(O){O[O.Highlight=0]="Highlight",O[O.MaskOccludee=1]="MaskOccludee",O[O.COUNT=2]="COUNT"}(T||(T={})),function(O){O[O.Triangle=0]="Triangle",O[O.Point=1]="Point",O[O.Line=2]="Line"}(i||(i={})),function(O){O[O.STRETCH=1]="STRETCH",O[O.PAD=2]="PAD"}(a||(a={})),function(O){O[O.CHANGED=0]="CHANGED",O[O.UNCHANGED=1]="UNCHANGED"}(r||(r={})),function(O){O[O.Blend=0]="Blend",O[O.Opaque=1]="Opaque",O[O.Mask=2]="Mask",O[O.MaskBlend=3]="MaskBlend",O[O.COUNT=4]="COUNT"}(R||(R={})),function(O){O[O.OFF=0]="OFF",O[O.ON=1]="ON"}(l||(l={}));export{R as AlphaDiscardMode,n as AntiAliasingMode,e as CullFaceOptions,l as Decorations,T as Object3DState,a as PowerOfTwoResizeMode,i as PrimitiveType,o as RenderRequestType,A as ResourceState,E as StencilBits,t as TransparencyPassType,N as UpdatePolicy,r as ValidationState,O as VertexAttribute};
5
+ var n,N,e,O,t,i,o,a,A,c,u,l,C;!function(n){n[n.None=0]="None",n[n.Front=1]="Front",n[n.Back=2]="Back",n[n.COUNT=3]="COUNT"}(n||(n={})),function(n){n[n.NONE=0]="NONE",n[n.SMAA=1]="SMAA"}(N||(N={})),function(n){n[n.Color=0]="Color",n[n.Alpha=1]="Alpha",n[n.FrontFace=2]="FrontFace",n[n.NONE=3]="NONE",n[n.COUNT=4]="COUNT"}(e||(e={})),function(n){n[n.BACKGROUND=0]="BACKGROUND",n[n.UPDATE=1]="UPDATE"}(O||(O={})),function(n){n[n.NOT_LOADED=0]="NOT_LOADED",n[n.LOADING=1]="LOADING",n[n.LOADED=2]="LOADED"}(t||(t={})),function(n){n[n.IntegratedMeshMaskExcluded=1]="IntegratedMeshMaskExcluded",n[n.OutlineVisualElementMask=2]="OutlineVisualElementMask"}(i||(i={})),function(n){n[n.ASYNC=0]="ASYNC",n[n.SYNC=1]="SYNC"}(o||(o={})),function(n){n[n.Highlight=0]="Highlight",n[n.MaskOccludee=1]="MaskOccludee",n[n.COUNT=2]="COUNT"}(a||(a={})),function(n){n[n.Triangle=0]="Triangle",n[n.Point=1]="Point",n[n.Line=2]="Line"}(A||(A={})),function(n){n[n.STRETCH=1]="STRETCH",n[n.PAD=2]="PAD"}(c||(c={})),function(n){n[n.CHANGED=0]="CHANGED",n[n.UNCHANGED=1]="UNCHANGED"}(u||(u={})),function(n){n[n.Blend=0]="Blend",n[n.Opaque=1]="Opaque",n[n.Mask=2]="Mask",n[n.MaskBlend=3]="MaskBlend",n[n.COUNT=4]="COUNT"}(l||(l={})),function(n){n[n.OFF=0]="OFF",n[n.ON=1]="ON"}(C||(C={}));export{l as AlphaDiscardMode,N as AntiAliasingMode,n as CullFaceOptions,C as Decorations,a as Object3DState,c as PowerOfTwoResizeMode,A as PrimitiveType,O as RenderRequestType,t as ResourceState,i as StencilBits,e as TransparencyPassType,o as UpdatePolicy,u as ValidationState};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{unpackFloatRGBA as e}from"../../../../core/floatRGBA.js";import{isSome as t,isNone as r}from"../../../../core/maybe.js";import i from"../../../../core/PooledArray.js";import{m as n,c as s}from"../../../../chunks/mat4.js";import{c as a}from"../../../../chunks/mat4f64.js";import{m as o}from"../../../../chunks/vec3.js";import{l as h}from"../../../../chunks/vec4.js";import{c as f}from"../../../../chunks/vec4f64.js";import{intersectsSphere as c,create as l,copy as u}from"../../../../geometry/support/frustum.js";import{c as d}from"../../../../chunks/sphere.js";import{maxScale as g}from"../../support/mathUtils.js";import{empty as m,union as p,set as _}from"./depthRange.js";import{DepthOrder as b}from"./Octree.js";import{assert as w}from"./Util.js";const R=1e4,B=100,v=500,j=500,C=.1;function A(t,r,i){return e(r,t)*(i[1]-i[0])+i[0]}function M(e,t,r){if(t.size<R)return K.compute(e,t);const i=m();return r.forAll((t=>{t.isVisible&&p(i,T(e,t))})),i}function T(e,r){if(!r.isVisible)return;const i=m(),n=r.getSpatialQueryAccelerator();return t(n)?O(i,e,n):S(i,e,r.objects),i}function O(e,t,r){const i=t.eye,n=t.viewForward,s=t.frustum,a=e=>e.isVisible,o=r.objectCount;if(o<v)_(W,t.near,Math.min(e.near,t.far)),r.forEachInDepthRange(i,n,b.FRONT_TO_BACK,W,((r,i)=>{y(e,t,r),W.far=e.near,i.setRange(W)}),s,a),_(W,Math.max(e.far,t.near),t.far),r.forEachInDepthRange(i,n,b.BACK_TO_FRONT,W,((r,i)=>{y(e,t,r),W.near=e.far,i.setRange(W)}),s,a);else{const i=Math.max(Math.min(o,j),Math.ceil(o*C)),h=r.findClosest(n,b.FRONT_TO_BACK,s,a,i),f=r.findClosest(n,b.BACK_TO_FRONT,s,a,i);h&&f&&(I(e,t,h.boundingVolumeWorldSpace.bounds),I(e,t,f.boundingVolumeWorldSpace.bounds))}}function S(e,t,r){k.clear(),r.forAll((e=>{e.isVisible&&0!==e.geometryRecords.length&&k.add(e)})),k.empty||(k.sort(t),_(W,t.near,Math.min(e.near,t.far)),k.forEachInDepthRange(W,b.FRONT_TO_BACK,((r,i)=>{i<e.near&&y(e,t,r)})),_(W,Math.max(e.far,t.near),t.far),k.forEachInDepthRange(W,b.BACK_TO_FRONT,((t,r,i)=>{e.far=Math.max(e.far,i)})))}function y(e,t,r){if(!r.isVisible)return;if(!c(t.frustum,r.boundingVolumeWorldSpace.bounds))return;const i=r.transformation,s=E;r.geometryRecords.forEach((r=>{n(s,i,r.getShaderTransformation());const a=g(s);F(e,t,r.geometry.boundingInfo,s,a)}))}function F(e,t,i,n,s){if(r(i))return;const a=t.eye,h=t.viewForward;o(D,i.center,n);const f=h[0]*(D[0]-a[0])+h[1]*(D[1]-a[1])+h[2]*(D[2]-a[2]);if(D[3]=i.radius*s,!(f-D[3]>e.near&&f+D[3]<e.far)&&c(t.frustum,D))if(i.radius>B&&i.getChildren()){const r=i.getChildren();for(let i=0;i<8;++i)r[i]&&F(e,t,r[i],n,s)}else U.unionDepthRangeWithAABB(e,t.viewProjectionMatrix,n,i.bbMin,i.bbMax)}function I(e,t,r){const i=t.eye,n=t.viewForward,s=(r[0]-i[0])*n[0]+(r[1]-i[1])*n[1]+(r[2]-i[2])*n[2];e.near=Math.min(e.near,s-r[3]),e.far=Math.max(e.far,s+r[3])}class P{constructor(){this._items=new i({allocator:e=>e||{obj:null,distance:0,near:0,far:0},deallocator:e=>(e.obj=null,e.distance=0,e.near=0,e.far=0,e)})}get length(){return this._items.length}get empty(){return 0===this._items.length}clear(){this._items.clear()}add(e){this._items.pushNew().obj=e}sort(e){const t=e.eye,r=e.viewForward;this._items.forAll((e=>{const i=e.obj.boundingVolumeWorldSpace.bounds,n=(i[0]-t[0])*r[0]+(i[1]-t[1])*r[1]+(i[2]-t[2])*r[2];e.distance=n,e.near=n-i[3],e.far=n+i[3]})),this._items.sort(((e,t)=>e.distance-t.distance))}forEachInDepthRange(e,t,r){if(t===b.FRONT_TO_BACK)for(let i=0;i<this._items.length;++i){const t=this._items.data[i];t.far<e.near||t.near>e.far||r(t.obj,t.near,t.far)}else for(let i=this._items.length-1;i>=0;--i){const t=this._items.data[i];t.far<e.near||t.near>e.far||r(t.obj,t.near,t.far)}}}class x{constructor(){this.view=a(),this.viewProj=a(),this.frustum=l(),this.geometries=[],this.near=[],this.far=[],this.nearCandidates=[],this.farCandidates=[],this.range={near:0,far:0},this.looseRange={near:0,far:0}}compute(e,t){this._reset(),s(this.view,e.viewMatrix),n(this.viewProj,e.projectionMatrix,this.view),u(e.frustum,this.frustum);const r=this.view,i=r[2],a=r[6],o=r[10],h=r[14],f=this.range;let c=0;if(t.forEach((e=>{if(!e.instanceParameters.visible)return;if(!e.castShadow)return;let t;e.hasShaderTransformation?(e.computeBoundingSphere(e.getShaderTransformation(),D,1),t=D):t=e.boundingSphere;const r=i*t[0]+a*t[1]+o*t[2]+h,n=r-t[3],s=r+t[3];this.geometries[c]=e,this.near[c]=-s,this.far[c]=-n,++c})),0===this.geometries.length)return f;for(let n=0;n<this.geometries.length;++n)this.near[n]>f.far&&(f.far=this.near[n]),this.near[n]>2&&this.far[n]<f.near&&(f.near=this.far[n]);const l=this.looseRange;l.near=Math.max(.5*f.near,2),l.far=2*f.far;let d=0,g=0;for(let n=0;n<this.geometries.length;++n)this.near[n]<f.near&&(this.near[n]>=l.near?f.near=this.near[n]:this.nearCandidates[d++]=n),this.far[n]>f.far&&(this.far[n]<=l.far?f.far=this.far[n]:this.farCandidates[g++]=n);if(0===this.nearCandidates.length&&0===this.farCandidates.length)return f;this.nearCandidates.sort(((e,t)=>this.near[e]<this.near[t]?-1:this.near[e]>this.near[t]?1:0)),this.farCandidates.sort(((e,t)=>this.far[e]<this.far[t]?1:this.far[e]>this.far[t]?-1:0));for(let n=0;n<this.nearCandidates.length;++n){const e=this.nearCandidates[n];if(this.near[e]<f.near){const t=this.geometries[e],r=t.boundingInfo;this._includeNearBoundingInfoRec(r,t.getShaderTransformation())}}for(let n=0;n<this.farCandidates.length;++n){const e=this.farCandidates[n];if(this.far[e]>f.far){const t=this.geometries[e],r=t.boundingInfo;this._includeFarBoundingInfoRec(r,t.getShaderTransformation())}}return f}_reset(){this.geometries.length=0,this.near.length=0,this.far.length=0,this.nearCandidates.length=0,this.farCandidates.length=0,this.range.near=Number.MAX_VALUE,this.range.far=-Number.MAX_VALUE}_includeNearBoundingInfoRec(e,t){if(r(e))return;const i=e.getCenter();o(D,i,t);const n=g(t),s=D[0],a=D[1],h=D[2],f=e.getBSRadius()*n,c=this.frustum;if(c[0][0]*s+c[0][1]*a+c[0][2]*h+c[0][3]>f||c[1][0]*s+c[1][1]*a+c[1][2]*h+c[1][3]>f||c[2][0]*s+c[2][1]*a+c[2][2]*h+c[2][3]>f||c[3][0]*s+c[3][1]*a+c[3][2]*h+c[3][3]>f)return;const l=this.view[2]*s+this.view[6]*a+this.view[10]*h+this.view[14],u=l+f;if(!(-(l-f)<2||-u>=this.range.near))if(-u>this.looseRange.near)this.range.near=-u;else{if(f>B){const r=e.getChildren();if(void 0!==r){for(let e=0;e<8;++e)void 0!==r[e]&&this._includeNearBoundingInfoRec(r[e],t);return}}U.unionDepthRangeWithAABB(this.range,this.viewProj,t,e.getBBMin(),e.getBBMax())}}_includeFarBoundingInfoRec(e,t){if(r(e))return;let i=e.getBSRadius();const n=e.getCenter();o(D,n,t);const s=g(t),a=D[0],h=D[1],f=D[2];i*=s;const c=this.frustum;if(c[0][0]*a+c[0][1]*h+c[0][2]*f+c[0][3]>i||c[1][0]*a+c[1][1]*h+c[1][2]*f+c[1][3]>i||c[2][0]*a+c[2][1]*h+c[2][2]*f+c[2][3]>i||c[3][0]*a+c[3][1]*h+c[3][2]*f+c[3][3]>i)return;const l=this.view[2]*a+this.view[6]*h+this.view[10]*f+this.view[14]-i;if(!(-l<=this.range.far))if(-l<this.looseRange.far)this.range.far=-l;else{if(i>B){const r=e.getChildren();if(void 0!==r){for(let e=0;e<8;++e)void 0!==r[e]&&this._includeFarBoundingInfoRec(r[e],t);return}}U.unionDepthRangeWithAABB(this.range,this.viewProj,t,e.getBBMin(),e.getBBMax())}}}class N{constructor(){this.modelViewProj=a(),this.clipPosition=[f(),f(),f(),f(),f(),f(),f(),f()]}unionDepthRangeWithAABB(e,t,r,i,s){const a=this.modelViewProj;n(a,t,r);let o=!1;for(let n=0;n<8;++n){const e=this.clipPosition[n],t=0===n||3===n||4===n||7===n?i[0]:s[0],r=0===n||1===n||4===n||5===n?i[1]:s[1],o=n<4?i[2]:s[2];e[0]=a[0]*t+a[4]*r+a[8]*o+a[12],e[1]=a[1]*t+a[5]*r+a[9]*o+a[13],e[2]=a[2]*t+a[6]*r+a[10]*o+a[14],e[3]=a[3]*t+a[7]*r+a[11]*o+a[15]}for(let n=0;n<12;++n){const t=this.clipPosition[V[n][0]],r=this.clipPosition[V[n][1]],i=this.clipPosition[V[n][2]],s=this._clipTriangle(t,r,i);let a=!0;for(let e=0;e<s.length;++e){if(s[e][3]>=2){a=!1;break}}if(!a){o=!0;for(let t=0;t<s.length;++t){const r=s[t][3];r<e.near&&(e.near=r),r>e.far&&(e.far=r)}}}return o}_inside(e,t){return 0===t?e[0]>=-e[3]:1===t?e[1]>=-e[3]:2===t?e[0]<=e[3]:3===t?e[1]<=e[3]:void w(!1)}_intersect(e,t,r){let i=0;return 0===r?i=(-e[3]-e[0])/(t[0]-e[0]+t[3]-e[3]):1===r?i=(-e[3]-e[1])/(t[1]-e[1]+t[3]-e[3]):2===r?i=(e[3]-e[0])/(t[0]-e[0]-t[3]+e[3]):3===r&&(i=(e[3]-e[1])/(t[1]-e[1]-t[3]+e[3])),h(f(),e,t,i)}_clipTriangle(e,t,r){let i=[e,t,r];for(let n=0;n<4;++n){const e=i;i=[];for(let t=0;t<e.length;++t){const r=e[t],s=e[(t+1)%e.length];this._inside(s,n)?(this._inside(r,n)||i.push(this._intersect(r,s,n)),i.push(s)):this._inside(r,n)&&i.push(this._intersect(r,s,n))}}return i}}const V=[[0,1,3],[2,3,1],[1,5,2],[6,2,5],[5,4,6],[7,6,4],[4,0,7],[3,7,0],[3,2,7],[6,7,2],[4,5,0],[1,0,5]],D=d(),E=a(),W=m(),k=new P,K=new x,U=new N;export{x as DepthRangeFromRenderGeometries,T as depthRangeFromLayer,M as depthRangeFromScene,A as textureToDepth};
5
+ import{unpackFloatRGBA as e}from"../../../../core/floatRGBA.js";import{isSome as t,isNone as r}from"../../../../core/maybe.js";import i from"../../../../core/PooledArray.js";import{m as n,c as s}from"../../../../chunks/mat4.js";import{c as a}from"../../../../chunks/mat4f64.js";import{m as o}from"../../../../chunks/vec3.js";import{l as h}from"../../../../chunks/vec4.js";import{c as f}from"../../../../chunks/vec4f64.js";import{intersectsSphere as c,create as l,copy as u}from"../../../../geometry/support/frustum.js";import{c as d}from"../../../../chunks/sphere.js";import{maxScale as g}from"../../support/mathUtils.js";import{empty as m,union as p,set as _}from"./depthRange.js";import{DepthOrder as b}from"./Octree.js";import{assert as w}from"./Util.js";const R=1e4,B=100,v=500,j=500,C=.1;function A(t,r,i){return e(r,t)*(i[1]-i[0])+i[0]}function M(e,t,r){if(t.size<R)return K.compute(e,t);const i=m();return r.forAll((t=>{t.isVisible&&p(i,T(e,t))})),i}function T(e,r){if(!r.isVisible)return;const i=m(),n=r.getSpatialQueryAccelerator();return t(n)?O(i,e,n):S(i,e,r.objects),i}function O(e,t,r){const i=t.eye,n=t.viewForward,s=t.frustum,a=e=>e.isVisible,o=r.objectCount;if(o<v)_(W,t.near,Math.min(e.near,t.far)),r.forEachInDepthRange(i,n,b.FRONT_TO_BACK,W,((r,i)=>{y(e,t,r),W.far=e.near,i.setRange(W)}),s,a),_(W,Math.max(e.far,t.near),t.far),r.forEachInDepthRange(i,n,b.BACK_TO_FRONT,W,((r,i)=>{y(e,t,r),W.near=e.far,i.setRange(W)}),s,a);else{const i=Math.max(Math.min(o,j),Math.ceil(o*C)),h=r.findClosest(n,b.FRONT_TO_BACK,s,a,i),f=r.findClosest(n,b.BACK_TO_FRONT,s,a,i);h&&f&&(I(e,t,h.boundingVolumeWorldSpace.bounds),I(e,t,f.boundingVolumeWorldSpace.bounds))}}function S(e,t,r){k.clear(),r.forAll((e=>{e.isVisible&&0!==e.geometryRecords.length&&k.add(e)})),k.empty||(k.sort(t),_(W,t.near,Math.min(e.near,t.far)),k.forEachInDepthRange(W,b.FRONT_TO_BACK,((r,i)=>{i<e.near&&y(e,t,r)})),_(W,Math.max(e.far,t.near),t.far),k.forEachInDepthRange(W,b.BACK_TO_FRONT,((t,r,i)=>{e.far=Math.max(e.far,i)})))}function y(e,t,r){if(!r.isVisible)return;if(!c(t.frustum,r.boundingVolumeWorldSpace.bounds))return;const i=r.transformation,s=E;r.geometryRecords.forEach((r=>{n(s,i,r.getShaderTransformation());const a=g(s);F(e,t,r.geometry.boundingInfo,s,a)}))}function F(e,t,i,n,s){if(r(i))return;const a=t.eye,h=t.viewForward;o(D,i.center,n);const f=h[0]*(D[0]-a[0])+h[1]*(D[1]-a[1])+h[2]*(D[2]-a[2]);if(D[3]=i.radius*s,!(f-D[3]>e.near&&f+D[3]<e.far)&&c(t.frustum,D))if(i.radius>B&&i.getChildren()){const r=i.getChildren();for(let i=0;i<8;++i)r[i]&&F(e,t,r[i],n,s)}else U.unionDepthRangeWithAABB(e,t.viewProjectionMatrix,n,i.bbMin,i.bbMax)}function I(e,t,r){const i=t.eye,n=t.viewForward,s=(r[0]-i[0])*n[0]+(r[1]-i[1])*n[1]+(r[2]-i[2])*n[2];e.near=Math.min(e.near,s-r[3]),e.far=Math.max(e.far,s+r[3])}class P{constructor(){this._items=new i({allocator:e=>e||{obj:null,distance:0,near:0,far:0},deallocator:e=>(e.obj=null,e.distance=0,e.near=0,e.far=0,e)})}get length(){return this._items.length}get empty(){return 0===this._items.length}clear(){this._items.clear()}add(e){this._items.pushNew().obj=e}sort(e){const t=e.eye,r=e.viewForward;this._items.forAll((e=>{const i=e.obj.boundingVolumeWorldSpace.bounds,n=(i[0]-t[0])*r[0]+(i[1]-t[1])*r[1]+(i[2]-t[2])*r[2];e.distance=n,e.near=n-i[3],e.far=n+i[3]})),this._items.sort(((e,t)=>e.distance-t.distance))}forEachInDepthRange(e,t,r){if(t===b.FRONT_TO_BACK)for(let i=0;i<this._items.length;++i){const t=this._items.data[i];t.far<e.near||t.near>e.far||r(t.obj,t.near,t.far)}else for(let i=this._items.length-1;i>=0;--i){const t=this._items.data[i];t.far<e.near||t.near>e.far||r(t.obj,t.near,t.far)}}}class x{constructor(){this.view=a(),this.viewProj=a(),this.frustum=l(),this.geometries=[],this.near=[],this.far=[],this.nearCandidates=[],this.farCandidates=[],this.range={near:0,far:0},this.looseRange={near:0,far:0}}compute(e,t){this._reset(),s(this.view,e.viewMatrix),n(this.viewProj,e.projectionMatrix,this.view),u(this.frustum,e.frustum);const r=this.view,i=r[2],a=r[6],o=r[10],h=r[14],f=this.range;let c=0;if(t.forEach((e=>{if(!e.instanceParameters.visible)return;if(!e.castShadow)return;let t;e.hasShaderTransformation?(e.computeBoundingSphere(e.getShaderTransformation(),D,1),t=D):t=e.boundingSphere;const r=i*t[0]+a*t[1]+o*t[2]+h,n=r-t[3],s=r+t[3];this.geometries[c]=e,this.near[c]=-s,this.far[c]=-n,++c})),0===this.geometries.length)return f;for(let n=0;n<this.geometries.length;++n)this.near[n]>f.far&&(f.far=this.near[n]),this.near[n]>2&&this.far[n]<f.near&&(f.near=this.far[n]);const l=this.looseRange;l.near=Math.max(.5*f.near,2),l.far=2*f.far;let d=0,g=0;for(let n=0;n<this.geometries.length;++n)this.near[n]<f.near&&(this.near[n]>=l.near?f.near=this.near[n]:this.nearCandidates[d++]=n),this.far[n]>f.far&&(this.far[n]<=l.far?f.far=this.far[n]:this.farCandidates[g++]=n);if(0===this.nearCandidates.length&&0===this.farCandidates.length)return f;this.nearCandidates.sort(((e,t)=>this.near[e]<this.near[t]?-1:this.near[e]>this.near[t]?1:0)),this.farCandidates.sort(((e,t)=>this.far[e]<this.far[t]?1:this.far[e]>this.far[t]?-1:0));for(let n=0;n<this.nearCandidates.length;++n){const e=this.nearCandidates[n];if(this.near[e]<f.near){const t=this.geometries[e],r=t.boundingInfo;this._includeNearBoundingInfoRec(r,t.getShaderTransformation())}}for(let n=0;n<this.farCandidates.length;++n){const e=this.farCandidates[n];if(this.far[e]>f.far){const t=this.geometries[e],r=t.boundingInfo;this._includeFarBoundingInfoRec(r,t.getShaderTransformation())}}return f}_reset(){this.geometries.length=0,this.near.length=0,this.far.length=0,this.nearCandidates.length=0,this.farCandidates.length=0,this.range.near=Number.MAX_VALUE,this.range.far=-Number.MAX_VALUE}_includeNearBoundingInfoRec(e,t){if(r(e))return;const i=e.getCenter();o(D,i,t);const n=g(t),s=D[0],a=D[1],h=D[2],f=e.getBSRadius()*n,c=this.frustum;if(c[0][0]*s+c[0][1]*a+c[0][2]*h+c[0][3]>f||c[1][0]*s+c[1][1]*a+c[1][2]*h+c[1][3]>f||c[2][0]*s+c[2][1]*a+c[2][2]*h+c[2][3]>f||c[3][0]*s+c[3][1]*a+c[3][2]*h+c[3][3]>f)return;const l=this.view[2]*s+this.view[6]*a+this.view[10]*h+this.view[14],u=l+f;if(!(-(l-f)<2||-u>=this.range.near))if(-u>this.looseRange.near)this.range.near=-u;else{if(f>B){const r=e.getChildren();if(void 0!==r){for(let e=0;e<8;++e)void 0!==r[e]&&this._includeNearBoundingInfoRec(r[e],t);return}}U.unionDepthRangeWithAABB(this.range,this.viewProj,t,e.getBBMin(),e.getBBMax())}}_includeFarBoundingInfoRec(e,t){if(r(e))return;let i=e.getBSRadius();const n=e.getCenter();o(D,n,t);const s=g(t),a=D[0],h=D[1],f=D[2];i*=s;const c=this.frustum;if(c[0][0]*a+c[0][1]*h+c[0][2]*f+c[0][3]>i||c[1][0]*a+c[1][1]*h+c[1][2]*f+c[1][3]>i||c[2][0]*a+c[2][1]*h+c[2][2]*f+c[2][3]>i||c[3][0]*a+c[3][1]*h+c[3][2]*f+c[3][3]>i)return;const l=this.view[2]*a+this.view[6]*h+this.view[10]*f+this.view[14]-i;if(!(-l<=this.range.far))if(-l<this.looseRange.far)this.range.far=-l;else{if(i>B){const r=e.getChildren();if(void 0!==r){for(let e=0;e<8;++e)void 0!==r[e]&&this._includeFarBoundingInfoRec(r[e],t);return}}U.unionDepthRangeWithAABB(this.range,this.viewProj,t,e.getBBMin(),e.getBBMax())}}}class N{constructor(){this.modelViewProj=a(),this.clipPosition=[f(),f(),f(),f(),f(),f(),f(),f()]}unionDepthRangeWithAABB(e,t,r,i,s){const a=this.modelViewProj;n(a,t,r);let o=!1;for(let n=0;n<8;++n){const e=this.clipPosition[n],t=0===n||3===n||4===n||7===n?i[0]:s[0],r=0===n||1===n||4===n||5===n?i[1]:s[1],o=n<4?i[2]:s[2];e[0]=a[0]*t+a[4]*r+a[8]*o+a[12],e[1]=a[1]*t+a[5]*r+a[9]*o+a[13],e[2]=a[2]*t+a[6]*r+a[10]*o+a[14],e[3]=a[3]*t+a[7]*r+a[11]*o+a[15]}for(let n=0;n<12;++n){const t=this.clipPosition[V[n][0]],r=this.clipPosition[V[n][1]],i=this.clipPosition[V[n][2]],s=this._clipTriangle(t,r,i);let a=!0;for(let e=0;e<s.length;++e){if(s[e][3]>=2){a=!1;break}}if(!a){o=!0;for(let t=0;t<s.length;++t){const r=s[t][3];r<e.near&&(e.near=r),r>e.far&&(e.far=r)}}}return o}_inside(e,t){return 0===t?e[0]>=-e[3]:1===t?e[1]>=-e[3]:2===t?e[0]<=e[3]:3===t?e[1]<=e[3]:void w(!1)}_intersect(e,t,r){let i=0;return 0===r?i=(-e[3]-e[0])/(t[0]-e[0]+t[3]-e[3]):1===r?i=(-e[3]-e[1])/(t[1]-e[1]+t[3]-e[3]):2===r?i=(e[3]-e[0])/(t[0]-e[0]-t[3]+e[3]):3===r&&(i=(e[3]-e[1])/(t[1]-e[1]-t[3]+e[3])),h(f(),e,t,i)}_clipTriangle(e,t,r){let i=[e,t,r];for(let n=0;n<4;++n){const e=i;i=[];for(let t=0;t<e.length;++t){const r=e[t],s=e[(t+1)%e.length];this._inside(s,n)?(this._inside(r,n)||i.push(this._intersect(r,s,n)),i.push(s)):this._inside(r,n)&&i.push(this._intersect(r,s,n))}}return i}}const V=[[0,1,3],[2,3,1],[1,5,2],[6,2,5],[5,4,6],[7,6,4],[4,0,7],[3,7,0],[3,2,7],[6,7,2],[4,5,0],[1,0,5]],D=d(),E=a(),W=m(),k=new P,K=new x,U=new N;export{x as DepthRangeFromRenderGeometries,T as depthRangeFromLayer,M as depthRangeFromScene,A as textureToDepth};