@arcgis/core 5.0.0-next.36 → 5.0.0-next.38

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 (270) hide show
  1. package/WebLinkChart.js +1 -1
  2. package/analysis/ShadowCast/types.d.ts +2 -0
  3. package/applications/Components/analysisUtils.d.ts +1 -0
  4. package/applications/Components/analysisUtils.js +1 -1
  5. package/applications/Components/testUtils.d.ts +4 -0
  6. package/applications/Components/testUtils.js +5 -0
  7. package/arcade/arcadeAsyncRuntime.js +1 -1
  8. package/arcade/arcadeCompiler.js +1 -1
  9. package/arcade/featureSetUtils.js +1 -1
  10. package/arcade/featureset/actions/Adapted.js +1 -1
  11. package/arcade/featureset/actions/AttributeFilter.js +1 -1
  12. package/arcade/featureset/actions/GroupBy.js +1 -1
  13. package/arcade/featureset/actions/SpatialFilter.js +1 -1
  14. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  15. package/arcade/featureset/sources/FeatureLayerMemory.js +1 -1
  16. package/arcade/featureset/sources/FeatureLayerOGC.js +1 -1
  17. package/arcade/featureset/sources/FeatureLayerRelated.js +1 -1
  18. package/arcade/featureset/support/FeatureSet.js +1 -1
  19. package/arcade/featureset/support/FeatureSetIterator.js +1 -1
  20. package/assets/esri/core/workers/RemoteClient.js +1 -1
  21. package/assets/esri/core/workers/chunks/014dbe6fa93a277b08f7.js +1 -0
  22. package/assets/esri/core/workers/chunks/{51355866a0dcf41cfded.js → 0a5427127634738aa239.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{c7c721de93bc8688e13c.js → 1d4ea8db272655c0608c.js} +1 -1
  24. package/assets/esri/core/workers/chunks/1d566539ff6fb6ac798c.js +1 -0
  25. package/assets/esri/core/workers/chunks/1de216d9850c39c1735d.js +1 -0
  26. package/assets/esri/core/workers/chunks/262232437d37a7460b11.js +1 -0
  27. package/assets/esri/core/workers/chunks/2795e491f803654413d2.js +1 -0
  28. package/assets/esri/core/workers/chunks/2f9129003f77bfeab2f9.js +1 -0
  29. package/assets/esri/core/workers/chunks/{1817cf11e85afca947d3.js → 328106e181e5957ceaa5.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{d3db7244fac7398cc700.js → 4b6a44c6265c8959abd8.js} +1 -1
  31. package/assets/esri/core/workers/chunks/50ffb22c48fadd36c748.js +1 -0
  32. package/assets/esri/core/workers/chunks/{f1ac1c8b1331ec79e898.js → 59ce992d3a5e7c32b9fb.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{8a946cbc816f373c136b.js → 5e30acfda04f7fc2b676.js} +1 -1
  34. package/assets/esri/core/workers/chunks/6330d8767ba1d5329daa.js +1 -0
  35. package/assets/esri/core/workers/chunks/{3f03165487c1c2340fff.js → 690a40d2eef52bfc149f.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{dd34d56caafa38d4b8e4.js → 7aa730e5ac7b268e3c98.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{b451dc416eebd0931ef8.js → 7ab237d19b84d89ff483.js} +7 -7
  38. package/assets/esri/core/workers/chunks/{1fa55d4c4b092a98bdd7.js → b56c07c0b43cb1999070.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{bfb9cbe59d36d18f9157.js → cda5c95fd49b8901f7d4.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{c9e7cc5d853908ab5b2f.js → ce99abfdcd71ff9e4e36.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{726a797f5df7eeee0b3d.js → d786b17cc9062b1450ac.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{52c8687b473c9953c2f2.js → d9958654c6438f28237b.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{2e76fbd3c874300fc4a7.js → de3da4d31a7529761565.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{eb6218634a492667506a.js → e501d68a1464805c4b4e.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{33431e8131f6017de2f9.js → e7f4d135ef9665de1468.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{d8623f5f13a084e439c2.js → e9bc3c6482ba778c9349.js} +37 -37
  47. package/assets/esri/core/workers/chunks/{7420fa18ba12014b22ea.js → ee67c8a7c1f8b482cd99.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{abb05a903440d97a6a74.js → f441fc74451330384fb0.js} +1 -1
  49. package/assets/esri/core/workers/chunks/f609b256df9eb3803464.js +1 -0
  50. package/assets/esri/core/workers/chunks/f97a7cb367634353177d.js +1 -0
  51. package/chunks/CloudsComposition.glsl.js +1 -1
  52. package/chunks/ComponentShader.glsl.js +2 -2
  53. package/chunks/DefaultMaterial.glsl.js +1 -1
  54. package/chunks/GaussianSplat.glsl.js +2 -2
  55. package/chunks/Laserlines.glsl.js +1 -1
  56. package/chunks/Path.glsl.js +1 -1
  57. package/chunks/RealisticTree.glsl.js +1 -1
  58. package/chunks/Terrain.glsl.js +34 -36
  59. package/chunks/WaterSurface.glsl.js +1 -1
  60. package/chunks/boundedPlane.js +1 -1
  61. package/chunks/cameraUtilsSpherical.js +1 -1
  62. package/chunks/vec32.js +1 -1
  63. package/config.js +1 -1
  64. package/core/has.js +1 -1
  65. package/core/iteratorUtils.js +1 -1
  66. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  67. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  68. package/geometry/support/buffer/BufferView.js +1 -1
  69. package/geometry/support/curves/densifyCurvedGeometry.js +1 -1
  70. package/geometry/support/lineSegment.js +1 -1
  71. package/geometry/support/meshUtils/merge.js +1 -1
  72. package/geometry/support/sphere.js +1 -1
  73. package/interfaces.d.ts +59 -5
  74. package/kernel.js +1 -1
  75. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  76. package/layers/VoxelWasmPerSceneView.js +1 -1
  77. package/layers/knowledgeGraph/layerUtils.js +1 -1
  78. package/layers/orientedImagery/transformations/worldToImage.js +1 -1
  79. package/layers/support/csvUtils.js +1 -1
  80. package/layers/video/VideoController.js +1 -1
  81. package/layers/voxel/VoxelVolume.js +1 -1
  82. package/package.json +5 -5
  83. package/support/revision.js +1 -1
  84. package/support/tests/meshUtils.js +5 -0
  85. package/support/tests/serviceMockDependencies.js +5 -0
  86. package/support/tests/setupServiceMocksMesh.js +5 -0
  87. package/views/2d/analysis/ElevationProfile/ElevationProfileLineVisualization2D.js +1 -1
  88. package/views/2d/interactive/SegmentLabels2D.js +1 -1
  89. package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
  90. package/views/3d/FocusAreasView.js +1 -1
  91. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  92. package/views/3d/analysis/Dimension/DimensionTool.js +1 -1
  93. package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
  94. package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
  95. package/views/3d/analysis/ElevationProfile/ElevationProfileLineVisualization3D.js +1 -1
  96. package/views/3d/analysis/ElevationProfile/ElevationProfileVisualization3D.js +1 -1
  97. package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
  98. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  99. package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
  100. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  101. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  102. package/views/3d/analysis/Viewshed/ViewshedScaleOrientManipulation.js +1 -1
  103. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  104. package/views/3d/analysis/Viewshed/ViewshedSubVisualization.js +1 -1
  105. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  106. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  107. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementShiftTool.js +1 -1
  108. package/views/3d/animation/pointToPoint/Camera.js +1 -1
  109. package/views/3d/camera/constraintUtils/distance.js +1 -1
  110. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  111. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  112. package/views/3d/environment/CloudsParameters.js +1 -1
  113. package/views/3d/environment/EnvironmentManager.js +1 -1
  114. package/views/3d/environment/MarsAtmosphere.js +1 -1
  115. package/views/3d/interactive/SegmentLabels3D.js +1 -1
  116. package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
  117. package/views/3d/interactive/editingTools/media/MediaElementManipulator3D.js +1 -1
  118. package/views/3d/interactive/editingTools/reshape/edgeOffsetUtils.js +1 -1
  119. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  120. package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
  121. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  122. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  123. package/views/3d/layers/FlowSubView3D.js +1 -1
  124. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  125. package/views/3d/layers/I3SMeshView3D.js +1 -1
  126. package/views/3d/layers/ImagerySubView3D.js +1 -1
  127. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  128. package/views/3d/layers/PointCloudWorker.js +1 -1
  129. package/views/3d/layers/RouteLayerView3D.js +1 -1
  130. package/views/3d/layers/graphics/Graphics3DGraphicsPipeline.js +1 -1
  131. package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
  132. package/views/3d/layers/graphics/Graphics3DScaleVisibility.js +1 -1
  133. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  134. package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
  135. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  136. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  137. package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
  138. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  139. package/views/3d/state/Frustum.js +1 -1
  140. package/views/3d/state/ViewStateManager.js +1 -1
  141. package/views/3d/state/controllers/FovController.js +1 -1
  142. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  143. package/views/3d/state/controllers/momentum/ZoomPlanarMomentumController.js +1 -1
  144. package/views/3d/support/FrustumExtentIntersection.js +1 -1
  145. package/views/3d/support/cameraUtils.js +1 -1
  146. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  147. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  148. package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +1 -1
  149. package/views/3d/support/intersectionUtils.js +1 -1
  150. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  151. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  152. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  153. package/views/3d/support/viewpointUtils.js +1 -1
  154. package/views/3d/terrain/OverlayManager.js +1 -1
  155. package/views/3d/terrain/OverlayRenderer.js +1 -1
  156. package/views/3d/terrain/PatchRenderData.js +1 -1
  157. package/views/3d/terrain/SphericalPatch.js +1 -1
  158. package/views/3d/terrain/TerrainRenderer.js +1 -1
  159. package/views/3d/terrain/TerrainSurface.js +1 -1
  160. package/views/3d/terrain/Tile.js +1 -1
  161. package/views/3d/terrain/TileCompositor.js +1 -1
  162. package/views/3d/webgl/RenderCamera.js +1 -1
  163. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  164. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
  165. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  166. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  167. package/views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js +4 -7
  168. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBuffer.glsl.js +4 -4
  169. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +1 -1
  170. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +6 -6
  171. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateAmbientLighting.glsl.js +4 -4
  172. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +19 -15
  173. package/views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js +2 -2
  174. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +1 -1
  175. package/views/3d/webgl-engine/core/shaderLibrary/terrain/TerrainTexture.glsl.js +5 -5
  176. package/views/3d/webgl-engine/core/shaderLibrary/terrain/TileBackground.glsl.js +14 -14
  177. package/views/3d/webgl-engine/core/shaderLibrary/util/BlendModes.glsl.js +16 -37
  178. package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatUnpacking.glsl.js +8 -8
  179. package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
  180. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  181. package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
  182. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  183. package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
  184. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  185. package/views/3d/webgl-engine/lib/CutFillColor.js +1 -1
  186. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  187. package/views/3d/webgl-engine/lib/Normals.js +1 -1
  188. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  189. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  190. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  191. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  192. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  193. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBuffer.js +1 -1
  194. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFieldCreation.js +5 -0
  195. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFields.js +1 -1
  196. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferLayout.js +1 -1
  197. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferLayoutField.js +5 -0
  198. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBufferView.js +5 -0
  199. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  200. package/views/3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js +1 -1
  201. package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
  202. package/views/3d/webgl-engine/lib/triangleIntersectionUtils.js +1 -1
  203. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  204. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  205. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  206. package/views/3d/webgl-engine/materials/DefaultTechniqueConfiguration.js +1 -1
  207. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  208. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  209. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  210. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  211. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  212. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  213. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  214. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  215. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  216. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  217. package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
  218. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  219. package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +1 -1
  220. package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
  221. package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
  222. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  223. package/views/3d/webgl-engine/shaders/GaussianSplat.glsl.js +1 -1
  224. package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
  225. package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
  226. package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
  227. package/views/3d/webgl-engine/shaders/NativeLineTechnique.js +1 -1
  228. package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +9 -10
  229. package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
  230. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  231. package/views/3d/webgl-engine/shaders/SphereDepthInterpolate.glsl.js +1 -1
  232. package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
  233. package/views/3d/webgl-engine/shaders/TerrainTechnique.js +1 -1
  234. package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
  235. package/views/BreakpointsOwner.js +1 -1
  236. package/views/GroundView.js +1 -1
  237. package/views/SceneView.js +1 -1
  238. package/views/ToolViewManager.js +1 -1
  239. package/views/analysis/ElevationProfile/elevationProfileVisualizationUtils.js +1 -1
  240. package/views/interactive/GraphicManipulator.js +1 -1
  241. package/views/interactive/InteractiveToolBase.js +1 -1
  242. package/views/interactive/ToolViewManagerManipulatorState.js +1 -1
  243. package/views/interactive/coordinateHelper.js +1 -1
  244. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  245. package/views/interactive/sketch/constraints.js +1 -1
  246. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
  247. package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
  248. package/views/interactive/snapping/hints/LineSnappingHint.js +1 -1
  249. package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
  250. package/views/layers/LayerView.js +1 -1
  251. package/views/navigation/PanSphericalMomentumEstimator.js +1 -1
  252. package/views/support/LayerViewManager.js +1 -1
  253. package/views/support/euclideanAreaMeasurementUtils.js +1 -1
  254. package/views/support/euclideanLengthMeasurementUtils.js +1 -1
  255. package/views/support/geodesicLengthMeasurementUtils.js +1 -1
  256. package/views/support/geometry3dUtils.js +1 -1
  257. package/webmap/utils.js +1 -1
  258. package/widgets/Sketch/SketchViewModel.js +1 -1
  259. package/widgets/Slider.js +1 -1
  260. package/assets/esri/core/workers/chunks/11687718c8635eb7bf37.js +0 -1
  261. package/assets/esri/core/workers/chunks/15c1a48e8cd2a8882d85.js +0 -1
  262. package/assets/esri/core/workers/chunks/1b9e7d416c9f00e020bb.js +0 -1
  263. package/assets/esri/core/workers/chunks/24a3c6f0154787968724.js +0 -1
  264. package/assets/esri/core/workers/chunks/5000a37fba27464d10ca.js +0 -1
  265. package/assets/esri/core/workers/chunks/951a3442d4342539f2ea.js +0 -1
  266. package/assets/esri/core/workers/chunks/b075d3714fab0591d67c.js +0 -1
  267. package/assets/esri/core/workers/chunks/d8975dd7b85b5d065ee4.js +0 -1
  268. package/assets/esri/core/workers/chunks/e0a74250d22fa1d7dc18.js +0 -1
  269. package/assets/esri/core/workers/chunks/f43e1e1a1b2eb737e00c.js +0 -1
  270. package/views/3d/webgl-engine/core/shaderLibrary/util/FastApproximateTrigonometry.glsl.js +0 -26
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as i}from"../../../../core/colorUtils.js";import"../../../../core/has.js";import{clamp as s,lerp as a}from"../../../../core/mathUtils.js";import{removeMaybe as n,abortMaybe as h,destroyMaybe as o,releaseMaybe as d}from"../../../../core/maybe.js";import{throwIfAborted as _}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as u,initial as p,sync as m}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{Milliseconds as f}from"../../../../core/time.js";import{property as g,subclass as b}from"../../../../core/accessorSupport/decorators.js";import{equals as P,invert as C,multiply as w}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as T,create as S}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{c as x}from"../../../../chunks/vec42.js";import{ZEROS as E}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{fromValues as A,ZEROS as D}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as I}from"../../../../geometry/support/Indices.js";import{RenderCategory as R,InternalRenderCategory as y}from"../../webgl.js";import{innerAtmosphereFadeStart as O}from"../../environment/atmosphereUtils.js";import{minNearDistanceInMeters as F}from"../../state/NearFarHeuristic.js";import{debugFlags as v}from"../../support/debugFlags.js";import{FBOCache as H,defaultWebGLFBO as M}from"../core/FBOCache.js";import{RenderPassManager as N}from"../core/renderPasses/RenderPassManager.js";import{isColor as q}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as G}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as L}from"../effects/RenderNodes.js";import{RenderPluginManager as U}from"../effects/RenderPluginManager.js";import{Blit as V}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as j,renderHighlightBuffer as B}from"../effects/highlight/Highlight.js";import{OITBlend as k}from"../effects/transparency/OITBlend.js";import{AnimationTimer as z}from"./AnimationTimer.js";import{AnimationTimeStep as W}from"./AnimationTimeStep.js";import{BoundingInfo as Q}from"./BoundingInfo.js";import{DepthRange as Y}from"./DepthRange.js";import{depthRangeFromScene as Z}from"./depthRangeUtils.js";import{hudFragmentOpacityParameters as J}from"./hudFragmentOpacityParameters.js";import{MainFramebuffer as K}from"./MainFramebuffer.js";import{RenderContext as X,defaultRenderOccludedMask as $}from"./RenderContext.js";import{RendererBase as ee}from"./RendererBase.js";import{setupFeatureDefaults as te}from"./RenderFeature.js";import{RenderPluginInput as re}from"./RenderPluginInput.js";import{ShadowAccumulator as ie}from"./ShadowAccumulator.js";import{ShadowMap as se}from"./ShadowMap.js";import ae from"./SliceHelper.js";import{MergedRenderer as ne}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as he}from"../parts/renderUtils.js";import{RendererPerformanceInfo as oe,PerformanceCategory as de}from"../statistics/RendererPerformanceInfo.js";import{PixelType as _e,ColorAttachment1 as le,ColorAttachment2 as ue}from"../../../webgl/enums.js";let pe=class extends ee{constructor(e,t,r,s,a,n){super({stage:e}),this._techniques=r,this._rctx=s,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this.renderPassManager=new N,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=A(0,0,0,1),this._sliceHelper=new ae,this._blit=null,this._oitblend=null,this.sceneDepthRange=c(Y.Infinite),this._state=c(2),this._hasAnimations=!1,this._animationTimestep=new W,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._lastFrameTime=f(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new re,this._releaseNormals=e=>{e.some(({name:e})=>"normals"===e)&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this._fboCache=new H(s),this._renderStateFeatures=c(te(e.view.qualityProfile)),this._framebuffer=new K(this.fboCache),this._performanceInfo=new oe(this._rctx),this._shadowMap=new se(this.fboCache,e.viewingMode),this._shadowAccumulator=new ie(this.fboCache,r,e,e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t},(t,r,i)=>{const s=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,r,i,!0,s),this._renderShadowCascades(3,t.shadowMap),t.shadowMap.finish(),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},n),this._renderContext=new X(this._rctx,this._shadowMap,r),this._nodes=new L(this._renderContext),this._plugins=new U({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this._plugins.add(this.renderPassManager),this.addHandles([l(()=>e.view.state.camera,()=>n(),u),l(()=>v.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},n()},p),l(()=>e.view.environment.background?.color,e=>{const t=e?i(e):D;x(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()},u),l(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=G,u),l(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},m),l(()=>this._bindParameters.clouds.data?.state,()=>n(),m),l(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,n()},p)])}destroy(){this._gpuTimerHandle=n(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=h(this._loadEdgeViewTask),this._edgeView=o(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this._fboCache.destroy(),this._fboCache=null,this._plugins.destroy(),this._plugins=null,this._pluginInput=null,this._blit=null,this._oitblend=null,this._compositingHelper=null,this._nodes=null,this._framebuffer=null,this._shadowMap=null,this._renderContext=null,this._performanceInfo=null,Q.prune(),ne.prune(),I()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _framebufferSize(){return this._framebuffer.size}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=te(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate(i=>i.set(t,e,r)),this._requestRender()}get _highQualityTransparency(){return this.isFeatureEnabled(1)}get hasReflections(){return this._pluginsHas.water&&this.isFeatureEnabled(5)}get _hasHighlights(){return this._plugins.produces(8,2,4,18,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(8,13,14)}get hasSSAO(){return this.isFeatureEnabled(4)&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get hasEmitters(){return this._plugins.hasEmitters&&this.stage.view.qualitySettings.physicallyBasedRenderingEnabled}get highResolutionAtmosphere(){return this.isFeatureEnabled(3)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=d(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=d(this._bindParameters.depth),this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility)}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.readyToRun||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");_(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:xe(this.stage.view.resourceController)});return this.addHandles(l(()=>r.updating,()=>this._requestRender(),m)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(r)),this._edgeViewCallbacks.length=0,r})),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&P(this._bindParameters.ssr.reprojectionMatrix,T)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),e.environment){void 0!==e.environment.weather&&(this._bindParameters.weather=e.environment.weather);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(0,...Pe),has.water=this._plugins.produces(2,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new z(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?n(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r,i=!1){try{return this._isRendering=!0,this._render(e,t,r,i)}catch(s){console.error(`Exception during rendering: ${s}`)}finally{this._isRendering=!1}return new he(this._pluginInput.get(R.FINAL),null)}_updateHUDOccludedFragmentOpacity(e,t){const{idleOpacity:r,navigatingOpacity:i,maxDelta:n,tiltFadeStart:h,tiltFadeEnd:o,altitudeStart:d,altitudeEnd:_}=J,l=this.stage.view,u=l.stateManager.camera,p=l.qualitySettings.fadeDuration,m=2===e?r:i,c=s((u.tilt-h)/(o-h),0,1),f=s(((u.position.z??0)-d)/(_-d),0,1),g=a(a(1,m,c),1,f),b=this._bindParameters.hudOccludedFragmentOpacity;if(p<=0||b===g||0===this._lastFrameTime||this._lastFrameTime>t)return this._bindParameters.hudOccludedFragmentOpacity=g,void(this._lastFrameTime=t);const P=t-this._lastFrameTime;this._lastFrameTime=t;const C=Math.max(1-r,Math.abs(r-i)),w=Math.min(C*P/p,n);w>=Math.abs(g-b)?this._bindParameters.hudOccludedFragmentOpacity=g:(this._bindParameters.hudOccludedFragmentOpacity=b+Math.sign(g-b)*w,this._requestRender())}_render(e,t,r,i){const s=0===r;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=s,this._disposeBindBuffers();const{camera:a,contentCamera:n,mode:h,alignPixelEnabled:o}=e;this._state.value=h;const d=this._nodes.produces("magnifier-color"),_=this._nodes.produces(R.FINAL);this._renderContext.time=t,this._renderContext.output=0,this._bindParameters.hasEmission=this.hasEmitters,this._bindParameters.oitPass=0,this._bindParameters.alignPixelEnabled=o,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null;const l=!i||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=l?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(y.VIEWSHED),this._bindParameters.cutFillEnabled=this._nodes.produces(y.CUTFILL_DEPTH),this._renderOverlay(),a.setGLViewport(this._rctx);const u=this._framebuffer,p=u.initialize(a.fullWidth,a.fullHeight,this._backgroundColor,this._bindParameters.hasEmission);this.hasReflections?(p?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=p):p?.release(),this._ensureBindParametersCamera(a,n),this._updateHUDOccludedFragmentOpacity(h,t),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!i;const m=this._highQualityTransparency&&this._hasTransparentTerrain,c=this._plugins.produces(0,...ge);this._precompilePrepasses(),this.performanceInfo.advance(de.PREPARE);const f=this._computeShadowDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,f),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(f,a,n,!s),this._ensureBindParametersSSR(t),this._precompileShaders(m,c),this._renderContext.output=0,u.bind(),this._bindParameters.mainDepth=u.depth.attachment,this._renderOpaque(m),this._renderTransparent(c,m),this._shadowMap.disposeMainBuffer(),this._pluginInput.set(y.FOCUSAREA,this._renderFocusAreaGeometry()),this._pluginInput.set(y.CUTFILL_DEPTH,this._renderCutFillDepth()),u.update(e=>this._renderNodes(y.TRANSPARENT_ENVIRONMENT,e)),u.update(e=>this._renderNodes(y.VIEWSHED,e)),u.update(e=>this._renderNodes(y.LASERLINES,e)),u.update(e=>this._renderNodes(y.FOCUSAREA_COLOR,e)),this._pluginInput.release(y.FOCUSAREA),this._pluginInput.release(y.CUTFILL_DEPTH),u.update(e=>this._renderNodes(y.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass()),this._renderHighlightShadowMap(a,this._bindParameters.lighting.mainLight.direction,f);const g=2===r?this._renderObjectAndLayerIdColor():null;u.update(e=>this._renderNodes(R.COMPOSITE,e)),this._shadowMap.disposeOffscreenBuffers();const b=s&&!_&&!(d&&!i),P=this._pluginInput.get(R.COMPOSITE),C=b?M:this.fboCache.acquire(P.fbo.width,P.fbo.height,y.ANTIALIASING),w=this._nodes.produces(y.ANTIALIASING)?this._renderNodes(y.ANTIALIASING,C):this.blitFBO(P,C,!1);let T;this._pluginInput.set(y.ANTIALIASING,w),this._hasHUDHighlights?(this._renderHUD(1,w),T=this._renderNodes(y.HIGHLIGHTS,w)):(T=this._renderNodes(y.HIGHLIGHTS,w),this._renderHUD(1,T));const S=this._renderNodes(y.MAGNIFIER,T);return s&&d&&!i&&!_&&this.blitFBO(S),_?(S.attachDepth(u.depth),this.blitFBO(this._renderNodes(R.FINAL,S)),S.detachDepth()):this._pluginInput.set(R.FINAL,S),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),u.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),s||(this._releaseFBOs(),this._disposeOffscreenBuffers()),new he(this._pluginInput.get(R.FINAL),g)}_precompileShaders(e,t){++this._plugins.context.techniques.precompiling,this._renderContext.output=0,this._precompileOpaqueGeometry(),this._nodes.precompile(y.OPAQUE_ENVIRONMENT),this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,this._renderContext.output=1,this._plugins.precompile(6),this._plugins.precompile(7),e&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=0,this._plugins.precompile(6),this._plugins.precompile(7),t&&(this._precompileTransparentGeometry(),this._hasTransparentTerrain&&(this._bindParameters.cullAboveTerrain=!1,this._precompileTransparentGeometry(),this._bindParameters.cullAboveTerrain=e)),this._nodes.precompile(y.FOCUSAREA),this._needsHUDVisibility&&this._plugins.precompile(12),this._plugins.precompile(15),this._precompileHUD(0),this._bindParameters.terrainDepthTest=!1,this._bindParameters.cullAboveTerrain=!1,this._nodes.precompile(y.VIEWSHED,y.CUTFILL_DEPTH,y.CUTFILL_COLOR,y.LASERLINES,y.FOCUSAREA_COLOR,y.OCCLUDED,y.ANTIALIASING,y.HIGHLIGHTS);const r=this._bindParameters;r.highlightMixTexture=r.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(1),this._hasHighlights&&(r.highlights.forEach((e,t)=>{r.highlightLevel=t,this._precompileAllGeometry(8)}),r.highlightLevel=null),r.highlightMixTexture=null,this._nodes.precompile(R.COMPOSITE,y.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(8),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(y.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(de.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._renderContext.output;++this._techniques.precompiling;const t=this._framebufferSize;let r=this.fboCache.acquire(t.width,t.height,"olid");return r.acquireDepth(13),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(de.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=0===e;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const s=Math.max(e,i);this._animationTimestep.frame(s,r)}}readMainDepth(e,t){const{mainDepth:r,camera:i}=this._bindParameters;if(!r)return;const s=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear depth");this._rctx.bindFramebuffer(s.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(D),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),s.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,_e.UNSIGNED_BYTE,t),s.release()}readHUDVisibility(e,t,r,i,s){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,i,6408,_e.UNSIGNED_BYTE,s)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"edges"),s=this._bindParameters.geometryDepth,a=()=>t.render(this._bindParameters,e);this.renderToTargets(a,i,s??this._framebuffer.depth,D),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(1===e?de.OPAQUE_EDGES:de.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(),this._bindParameters.overlay&&this.performanceInfo.advance(de.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const i=this._shadowMap;i.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(5,this._shadowMap),i.copySnapshot(1),this._renderShadowCascades(4,this._shadowMap)):this._renderShadowCascades(3),i.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this.performanceInfo.advance(de.SHADOW_MAP)}_renderHighlightShadowMap(e,t,r){if(!this.shadowsEnabled||!this._needsShadowHighlight)return;const i=this._shadowMap;i.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._renderShadowCascades(4,this._shadowMap),i.moveSnapshot(0),i.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this.performanceInfo.advance(de.SHADOW_MAP)}_renderCutFillDepth(){return this._nodes.produce(y.CUTFILL_DEPTH,this._pluginInput)}_precompileShadowCascades(e){0!==this._shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){t.bindFbo();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(1)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._shadowAccumulator.active||this._debugNeedsDepth}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");e?(this._pluginInput.set(y.SSAO,this._renderSSAO()),this._needsDepth?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(1),d(this._bindParameters.depth),this._bindParameters.depth=e.obtainDepthTexture(),this.performanceInfo.advance(de.DEPTH)):(e.detachDepth(),this._bindParameters.depth=d(this._bindParameters.depth)),this.hasSSAO&&this._pluginInput.release("normals")):this._renderAllGeometryDepth()}_renderAllGeometryDepth(){if(!this._needsDepth)return void(this._bindParameters.depth=d(this._bindParameters.depth));const e=this._framebufferSize,t=this.fboCache.acquire(e.width,e.height,"geometry depth",13);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(1280),this.renderAllGeometry(1),d(this._bindParameters.depth),this._bindParameters.depth=t.obtainDepthTexture(),t.release(),this.performanceInfo.advance(de.DEPTH)}_renderTerrainDepth(e){if(this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,!e)return;const t=this._renderContext.output;this._renderContext.output=1;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"terrain depth",13);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(1280),this._renderTransparentTerrain(),this._bindParameters.terrainDepth=i.obtainDepthTexture(),i.release(),this._renderContext.output=t}_renderGeometryDepth(e){if(!e)return void(this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth));const t=this._renderContext.output,{width:r,height:i}=this._framebufferSize,s=this.fboCache.acquire(r,i,"geometry depth",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this._renderOpaqueAndTransparentGeometry(1),this._renderContext.output=t,d(this._bindParameters.geometryDepth),this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsShadowDepthRange(){return this._shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return Y.Zero;const t=Z(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=Y.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<O)return void(this.sceneDepthRange.value=Y.Infinite);const t=e.clone();t.near=F,t.far=1e10;const r=Z(t,this._plugins.plugins,this.stage.layers,1);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(r)||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",R.FINAL,R.COMPOSITE,R.OPAQUE,R.TRANSPARENT,y.VIEWSHED,y.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(2),this._needsDepth&&this._precompileAllGeometry(1),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(4),this._precompileShadowCascades(5)):this._precompileShadowCascades(3)),this._shadowAccumulator.active&&this._precompileAllGeometry(3)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"normals",5);r.acquireDepth(13),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(D,!0,!0),this._renderGeometryWithNormals(2);const i=this._nodes.optional("normals",R.FINAL,R.COMPOSITE,R.OPAQUE,R.TRANSPARENT,y.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(de.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return;const t=this._nodes.produce(y.SSAO,this._pluginInput);return this._bindParameters.ssao=t,t&&this.performanceInfo.advance(de.SSAO),t}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(6),this._plugins.precompile(7),this._renderContext.output=t}renderAllGeometry(e){this._renderContext.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentTerrain()}precompileSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const r of t)this._renderContext.renderOccludedMask=r,this.precompileSlots(e,...be);this._renderContext.renderOccludedMask=$}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(9),this.renderSlots(e,...be),this._renderContext.renderOccludedMask=$}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(13)}precompileViewshedShadowMap(){this._precompileAllGeometry(6)}precompileCutFill(){const e=7,t=this._renderContext.output;this._renderContext.output=e,this._plugins.precompile(0,1,6),this._renderContext.output=t}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(6),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._renderContext.output=i}renderCutFillReferenceDepth(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._renderContext.output=7,this._plugins.render(0,1),this._plugins.render(6),this._ensureBindParametersCamera(t,r),t.setGLViewport(this._rctx),this._renderContext.output=i}_renderOpaqueAndTransparentGeometry(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithNormals(e){this._renderContext.output=e,this._plugins.render(...me),this._renderTransparentTerrain()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(...ce)}_precompileOpaqueGeometry(){this._plugins.precompile(...fe),this._nodes.precompile("opaque-color")}_renderOpaqueGeometry(){this._plugins.render(...fe)}_renderTransparentGeometry(){this._plugins.render(...ge)}get _hasTransparentTerrain(){return this._plugins.produces(0,6)}get _hasTransparentIntegratedMesh(){return this._plugins.produces(this._renderContext.output,7)}_renderTransparentTerrain(){const e=()=>this._plugins.render(6);if(!q(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent terrain");return this.renderToTargets(e,r,this._framebuffer.depth,D),r}_renderTransparentIntegratedMesh(){const e=()=>this._plugins.render(7);if(!q(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent integrated mesh");return this.renderToTargets(e,r,this._framebuffer.depth,D),r}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,12)}_renderHUDVisibility(){if(!this._needsHUDVisibility)return void(this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility));const{width:e,height:t}=this._framebufferSize;let r=this._bindParameters.hudVisibility;r?.fbo?.width===e&&r?.fbo?.height===t||(r?.release(),r=this.fboCache.acquire(e,t,"hud visibility",4),this._bindParameters.hudVisibility=r);const i=this._bindParameters.geometryDepth;r.attachDepth(i||this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(12),r.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(de.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,0===e){const e=()=>this._plugins.render(15),t=this._framebufferSize,r=this.fboCache.acquireDepth(12,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(15)}_precompileHUD(e){if(this._precompileHUDOutput(e),this._hasHighlights){const t=this._renderContext.output;this._renderContext.output=8,this._precompileHUDOutput(e),this._renderContext.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this._oitEnabled&&q(this._renderContext.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...Pe),this._bindParameters.oitPass=2,this._plugins.precompile(...Pe),this._bindParameters.oitPass=0):this._plugins.precompile(...Pe),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t){if(this._pluginsHas.hudElements){if(this._oitEnabled){const r=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,r.getTexture(),!1),r.release()}else if(this._renderContext.output=0,0===e){const t=()=>this._renderHUDElements(e),r=this._framebufferSize,i=this.fboCache.acquireDepth(12,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(12),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(0===e?de.HUD_OCCLUDED:de.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Pe)}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(4,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,i=this._framebufferSize,{highlights:s}=r,a=e.acquire(i.width,i.height,"highlights",s.length>j?3:1);a.acquireDepth(13);const n=this._plugins.produces(8,0);return n&&this._framebuffer.color.fbo&&a.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,a.fbo,1024),t.bindFramebuffer(a.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),n||t.clear(1024),this._renderContext.output=8,t.bindFramebuffer(a.fbo),B(t,e,i,r,()=>this._renderHighlightGeometries()),a.detachDepth(),this.performanceInfo.advance(de.HIGHLIGHTS),a}_renderHighlightGeometries(){this._plugins.render(...Ce),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t,r,i){this._shadowAccumulator.updateDepthRange(e),this._shadowAccumulator.accumulating&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,t,r,i)&&this.performanceInfo.advance(de.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this._oitEnabled&&q(this._renderContext.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...ge),this._bindParameters.oitPass=2,this._plugins.precompile(...ge),this._bindParameters.oitPass=0):this._plugins.precompile(...ge)}_renderOIT(e,t=2){const r=1===e,i=this._framebufferSize,s=r?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),a=this._bindParameters,n=this._renderContext.output;this._renderContext.output=0,a.oitPass=1;const h=r?"oit hud":"oit",o=this.fboCache.acquire(i.width,i.height,h,8),d=this._bindParameters.hasEmission;d&&o.acquireColor(le,8,"oit emissive"),o.acquireColor(d?ue:le,7,"oit alpha"),r||o.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(o.fbo),this._rctx.clearFramebuffer([0,0,0,1]),d&&this._rctx.clearBuffer(1,E),s(),o.detachDepth(),a.oitPass=2;const _=this.fboCache.acquire(i.width,i.height,r?"oit hud front":"oit front");let l;return d&&_.acquireColor(le,8,"oit emissive front"),r?_.acquireDepth(12):_.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(_.fbo),this._rctx.clearFramebuffer(D,r),s(),_.detachDepth(),a.oitPass=0,r?(l=this.fboCache.acquire(i.width,i.height,"oit hud composite"),this._rctx.bindFramebuffer(l.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):this._framebuffer.bind(),this._oitblend??=new k(this._techniques),this._oitblend.blend(this._rctx,o,_,a,d,!r),l?.detachDepth(),_.release(),o.release(),this._renderContext.output=n,l}_renderOpaque(e){const t=this.plugins.produces(0,...fe);if(t){this._plugins.render(0,1);const e=this._framebuffer;e.update(e=>this._renderNodes(y.CUTFILL_COLOR,e)),e.update(e=>this._renderNodes(y.OPAQUE_TERRAIN,e)),e.bind(),this._plugins.render(2,3)}const r=this._framebuffer;this._renderTerrainDepth(e),r.update(e=>this._renderNodes(R.OPAQUE,e,t)),this.fboCache.debugCallback?.(R.OPAQUE,r.color.fbo),r.update(e=>this._renderNodes(y.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(y.OPAQUE_ENVIRONMENT,r.color.fbo),this._renderEdges(1)}_renderTransparent(e,t){const r=this._framebuffer;r.bind(),this._renderPlugins(20,de.VOXEL),this._renderHiddenTransparentEdges(),e&&(this._oitEnabled?this._renderOIT(0):this._renderTransparentGeometry()),r.update(t=>this._renderNodes(R.TRANSPARENT,t,e)),this.fboCache.debugCallback?.(R.TRANSPARENT,r.color.fbo),this._renderGeometryDepth(t),this._renderHUDVisibility(),t||this._plugins.render(15),this._renderEdges(0);const i=this._hasTransparentTerrain?this._renderTransparentTerrain():null;i&&(this.performanceInfo.advance(de.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(t?this._renderLineCallouts(0):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,i.getTexture())),this._renderHUD(0,r.color))),this._bindParameters.cullAboveTerrain=!1,i&&(r.bind(),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,i.getTexture()),i.release(),t&&(this._renderEdges(1),e&&(this._oitEnabled?this._renderOIT(0):this._renderTransparentGeometry(),this.performanceInfo.advance(de.TRANSPARENT)),this._renderEdges(0)));const s=this._hasTransparentIntegratedMesh?this._renderTransparentIntegratedMesh():null;s&&(r.bind(),this._compositingHelper.composite(this._bindParameters,s.getTexture()),s.release()),this._bindParameters.ssao=d(this._bindParameters.ssao),t&&this._renderLineCallouts(1),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(de.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(8),this.performanceInfo.advance(de.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),i}blitFBO(e,t=M,r=!0){return this._blit??=new V(this._techniques),this._blit.blit(this._rctx,e,t,this._bindParameters),this._pluginInput.set(e.name,t),r&&e.release(),t}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=T:(C(Te,this._bindParameters.camera.viewMatrix),C(we,this._bindParameters.camera.projectionMatrix),w(Se,Te,we),w(Se,this._renderContext.lastFrameCamera.viewMatrix,Se),w(Se,this._renderContext.lastFrameCamera.projectionMatrix,Se),this._reprojectionMatrix=Se);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=T,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,i){this._bindParameters.updateLighting(e,t,r,i),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,i,s=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(i,s,a),e(),t.detachDepth()}get test(){}};e([g({readOnly:!0})],pe.prototype,"highResolutionAtmosphere",null),e([g()],pe.prototype,"_edgeView",void 0),e([g()],pe.prototype,"updating",null),pe=e([b("esri.views.3d.webgl-engine.lib.Renderer")],pe);const me=[0,1,2,4],ce=[3,5],fe=[0,1,2,3],ge=[4,5],be=[2,4,8],Pe=[16,13,14],Ce=[4,5,2,3,6,0,1],we=S(),Te=S(),Se=S();function xe(e){return t=>e.immediate.schedule(t)}export{pe as Renderer};
5
+ import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as i}from"../../../../core/colorUtils.js";import"../../../../core/has.js";import{clamp as s,lerp as a}from"../../../../core/mathUtils.js";import{removeMaybe as n,abortMaybe as h,destroyMaybe as o,releaseMaybe as d}from"../../../../core/maybe.js";import{throwIfAborted as _}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as u,initial as p,sync as m}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{Milliseconds as f}from"../../../../core/time.js";import{property as g,subclass as b}from"../../../../core/accessorSupport/decorators.js";import{equals as P,invert as C,multiply as T}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as w,create as S}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{c as E}from"../../../../chunks/vec42.js";import{ZEROS as x}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{fromValues as A,ZEROS as D}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as I}from"../../../../geometry/support/Indices.js";import{RenderCategory as R,InternalRenderCategory as y}from"../../webgl.js";import{innerAtmosphereFadeStart as O}from"../../environment/atmosphereUtils.js";import{minNearDistanceInMeters as F}from"../../state/NearFarHeuristic.js";import{debugFlags as v}from"../../support/debugFlags.js";import{FBOCache as H,defaultWebGLFBO as M}from"../core/FBOCache.js";import{RenderPassManager as N}from"../core/renderPasses/RenderPassManager.js";import{isColor as q}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as G}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as L}from"../effects/RenderNodes.js";import{RenderPluginManager as U}from"../effects/RenderPluginManager.js";import{Blit as V}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as j,renderHighlightBuffer as B}from"../effects/highlight/Highlight.js";import{OITBlend as k}from"../effects/transparency/OITBlend.js";import{AnimationTimer as z}from"./AnimationTimer.js";import{AnimationTimeStep as W}from"./AnimationTimeStep.js";import{BoundingInfo as Q}from"./BoundingInfo.js";import{DepthRange as Y}from"./DepthRange.js";import{depthRangeFromScene as Z}from"./depthRangeUtils.js";import{hudFragmentOpacityParameters as J}from"./hudFragmentOpacityParameters.js";import{MainFramebuffer as K}from"./MainFramebuffer.js";import{RenderContext as X,defaultRenderOccludedMask as $}from"./RenderContext.js";import{RendererBase as ee}from"./RendererBase.js";import{setupFeatureDefaults as te}from"./RenderFeature.js";import{RenderPluginInput as re}from"./RenderPluginInput.js";import{ShadowAccumulator as ie}from"./ShadowAccumulator.js";import{ShadowMap as se}from"./ShadowMap.js";import ae from"./SliceHelper.js";import{MergedRenderer as ne}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as he}from"../parts/renderUtils.js";import{RendererPerformanceInfo as oe,PerformanceCategory as de}from"../statistics/RendererPerformanceInfo.js";import{PixelType as _e,ColorAttachment1 as le,ColorAttachment2 as ue}from"../../../webgl/enums.js";let pe=class extends ee{constructor(e,t,r,s,a,n){super({stage:e}),this._techniques=r,this._rctx=s,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this.renderPassManager=new N,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=A(0,0,0,1),this._sliceHelper=new ae,this._blit=null,this._oitblend=null,this.sceneDepthRange=c(Y.Infinite),this._state=c(2),this._hasAnimations=!1,this._animationTimestep=new W,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._lastFrameTime=f(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new re,this._releaseNormals=e=>{e.some(({name:e})=>"normals"===e)&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this._fboCache=new H(s),this._renderStateFeatures=c(te(e.view.qualityProfile)),this._framebuffer=new K(this.fboCache),this._performanceInfo=new oe(this._rctx),this._shadowMap=new se(this.fboCache,e.viewingMode),this._shadowAccumulator=new ie(this.fboCache,r,e,e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t},(t,r,i)=>{const s=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,r,i,!0,s),this._renderShadowCascades(3,t.shadowMap),t.shadowMap.finish(),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},n),this._renderContext=new X(this._rctx,this._shadowMap,r),this._nodes=new L(this._renderContext),this._plugins=new U({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this._plugins.add(this.renderPassManager),this.addHandles([l(()=>e.view.state.camera,()=>n(),u),l(()=>v.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},n()},p),l(()=>e.view.environment.background?.color,e=>{const t=e?i(e):D;E(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()},u),l(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=G,u),l(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},m),l(()=>this._bindParameters.clouds.data?.state,()=>n(),m),l(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,n()},p)])}destroy(){this._gpuTimerHandle=n(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=h(this._loadEdgeViewTask),this._edgeView=o(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this._fboCache.destroy(),this._fboCache=null,this._plugins.destroy(),this._plugins=null,this._pluginInput=null,this._blit=null,this._oitblend=null,this._compositingHelper=null,this._nodes=null,this._framebuffer=null,this._shadowMap=null,this._renderContext=null,this._performanceInfo=null,Q.prune(),ne.prune(),I()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _framebufferSize(){return this._framebuffer.size}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=te(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate(i=>i.set(t,e,r)),this._requestRender()}get _highQualityTransparency(){return this.isFeatureEnabled(1)}get hasReflections(){return this._pluginsHas.water&&this.isFeatureEnabled(5)}get _hasHighlights(){return this._plugins.produces(8,2,4,19,14,15)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(8,14,15)}get hasSSAO(){return this.isFeatureEnabled(4)&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get hasEmitters(){return this._plugins.hasEmitters&&this.stage.view.qualitySettings.physicallyBasedRenderingEnabled}get highResolutionAtmosphere(){return this.isFeatureEnabled(3)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=d(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=d(this._bindParameters.depth),this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility)}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.readyToRun||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");_(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:xe(this.stage.view.resourceController)});return this.addHandles(l(()=>r.updating,()=>this._requestRender(),m)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(r)),this._edgeViewCallbacks.length=0,r})),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&P(this._bindParameters.ssr.reprojectionMatrix,w)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),e.environment){void 0!==e.environment.weather&&(this._bindParameters.weather=e.environment.weather);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,10)}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(0,...Ce),has.water=this._plugins.produces(2,20),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new z(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?n(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r,i=!1){try{return this._isRendering=!0,this._render(e,t,r,i)}catch(s){console.error(`Exception during rendering: ${s}`)}finally{this._isRendering=!1}return new he(this._pluginInput.get(R.FINAL),null)}_render(e,t,r,i){const s=0===r;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=s,this._disposeBindBuffers();const{camera:a,contentCamera:n,mode:h,alignPixelEnabled:o}=e;this._state.value=h;const d=this._nodes.produces("magnifier-color"),_=this._nodes.produces(R.FINAL);this._renderContext.time=t,this._renderContext.output=0,this._bindParameters.hasEmission=this.hasEmitters,this._bindParameters.oitPass=0,this._bindParameters.alignPixelEnabled=o,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null;const l=!i||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=l?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(y.VIEWSHED),this._bindParameters.cutFillEnabled=this._nodes.produces(y.CUTFILL_DEPTH),this._renderOverlay(),a.setGLViewport(this._rctx);const u=this._framebuffer,p=u.initialize(a.fullWidth,a.fullHeight,this._backgroundColor,this._bindParameters.hasEmission);this.hasReflections?(p?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=p):p?.release(),this._ensureBindParametersCamera(a,n),this._updateHUDOccludedFragmentOpacity(h,t),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!i;const m=this._plugins.produces(0,...ce);this._precompilePrepasses(),this.performanceInfo.advance(de.PREPARE);const c=this._computeShadowDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,c),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(c,a,n,!s),this._ensureBindParametersSSR(t),this._precompileShaders(m),this._renderContext.output=0,u.bind(),this._bindParameters.mainDepth=u.depth.attachment,this._renderOpaque(),this._renderTransparent(m),this._shadowMap.disposeMainBuffer(),this._pluginInput.set(y.FOCUSAREA,this._renderFocusAreaGeometry()),this._pluginInput.set(y.CUTFILL_DEPTH,this._renderCutFillDepth()),u.update(e=>this._renderNodes(y.TRANSPARENT_ENVIRONMENT,e)),u.update(e=>this._renderNodes(y.VIEWSHED,e)),u.update(e=>this._renderNodes(y.LASERLINES,e)),u.update(e=>this._renderNodes(y.FOCUSAREA_COLOR,e)),this._pluginInput.release(y.FOCUSAREA),this._pluginInput.release(y.CUTFILL_DEPTH),u.update(e=>this._renderNodes(y.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass()),this._renderHighlightShadowMap(a,this._bindParameters.lighting.mainLight.direction,c);const f=2===r?this._renderObjectAndLayerIdColor():null;u.update(e=>this._renderNodes(R.COMPOSITE,e)),this._shadowMap.disposeOffscreenBuffers();const g=s&&!_&&!(d&&!i),b=this._pluginInput.get(R.COMPOSITE),P=g?M:this.fboCache.acquire(b.fbo.width,b.fbo.height,y.ANTIALIASING),C=this._nodes.produces(y.ANTIALIASING)?this._renderNodes(y.ANTIALIASING,P):this.blitFBO(b,P,!1);let T;this._pluginInput.set(y.ANTIALIASING,C),this._hasHUDHighlights?(this._renderHUD(1,C),T=this._renderNodes(y.HIGHLIGHTS,C)):(T=this._renderNodes(y.HIGHLIGHTS,C),this._renderHUD(1,T));const w=this._renderNodes(y.MAGNIFIER,T);return s&&d&&!i&&!_&&this.blitFBO(w),_?(w.attachDepth(u.depth),this.blitFBO(this._renderNodes(R.FINAL,w)),w.detachDepth()):this._pluginInput.set(R.FINAL,w),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),u.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),s||(this._releaseFBOs(),this._disposeOffscreenBuffers()),new he(this._pluginInput.get(R.FINAL),f)}_precompileShaders(e){++this._plugins.context.techniques.precompiling,this._renderContext.output=0,this._precompileOpaqueGeometry(),this._nodes.precompile(y.OPAQUE_ENVIRONMENT),this._bindParameters.terrainDepthTest=this._bindParameters.cullAboveTerrain=this._needsTerrainDepthTest,this._renderContext.output=1,this._plugins.precompile(...fe),this._needsTerrainDepthTest&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=0,this._plugins.precompile(...fe),e&&(this._precompileTransparentGeometry(),this._hasPhotoshopTerrain&&(this._bindParameters.cullAboveTerrain=!1,this._precompileTransparentGeometry(),this._bindParameters.cullAboveTerrain=this._needsTerrainDepthTest)),this._nodes.precompile(y.FOCUSAREA),this._needsHUDVisibility&&this._plugins.precompile(13),this._plugins.precompile(16),this._precompileHUD(0),this._bindParameters.terrainDepthTest=!1,this._bindParameters.cullAboveTerrain=!1,this._nodes.precompile(y.VIEWSHED,y.CUTFILL_DEPTH,y.CUTFILL_COLOR,y.LASERLINES,y.FOCUSAREA_COLOR,y.OCCLUDED,y.ANTIALIASING,y.HIGHLIGHTS);const t=this._bindParameters;t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(1),this._hasHighlights&&(t.highlights.forEach((e,r)=>{t.highlightLevel=r,this._precompileAllGeometry(8)}),t.highlightLevel=null),t.highlightMixTexture=null,this._nodes.precompile(R.COMPOSITE,y.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(9),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(y.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(de.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._renderContext.output;++this._techniques.precompiling;const t=this._framebufferSize;let r=this.fboCache.acquire(t.width,t.height,"olid");return r.acquireDepth(13),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(de.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=0===e;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const s=Math.max(e,i);this._animationTimestep.frame(s,r)}}readMainDepth(e,t){const{mainDepth:r,camera:i}=this._bindParameters;if(!r)return;const s=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear depth");this._rctx.bindFramebuffer(s.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(D),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),s.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,_e.UNSIGNED_BYTE,t),s.release()}readHUDVisibility(e,t,r,i,s){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,i,6408,_e.UNSIGNED_BYTE,s)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"edges"),s=this._bindParameters.geometryDepth,a=()=>t.render(this._bindParameters,e);this.renderToTargets(a,i,s??this._framebuffer.depth,D),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(1===e?de.OPAQUE_EDGES:de.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(),this._bindParameters.overlay&&this.performanceInfo.advance(de.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const i=this._shadowMap;i.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(5,this._shadowMap),i.copySnapshot(1),this._renderShadowCascades(4,this._shadowMap)):this._renderShadowCascades(3),i.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this.performanceInfo.advance(de.SHADOW_MAP)}_renderHighlightShadowMap(e,t,r){if(!this.shadowsEnabled||!this._needsShadowHighlight)return;const i=this._shadowMap;i.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._renderShadowCascades(4,this._shadowMap),i.moveSnapshot(0),i.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this.performanceInfo.advance(de.SHADOW_MAP)}_renderCutFillDepth(){return this._nodes.produce(y.CUTFILL_DEPTH,this._pluginInput)}_precompileShadowCascades(e){0!==this._shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){t.bindFbo();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(1)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._shadowAccumulator.active||this._debugNeedsDepth}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");e?(this._pluginInput.set(y.SSAO,this._renderSSAO()),this._needsDepth?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(1),d(this._bindParameters.depth),this._bindParameters.depth=e.obtainDepthTexture(),this.performanceInfo.advance(de.DEPTH)):(e.detachDepth(),this._bindParameters.depth=d(this._bindParameters.depth)),this.hasSSAO&&this._pluginInput.release("normals")):this._renderAllGeometryDepth()}_renderAllGeometryDepth(){if(!this._needsDepth)return void(this._bindParameters.depth=d(this._bindParameters.depth));const e=this._framebufferSize,t=this.fboCache.acquire(e.width,e.height,"geometry depth",13);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(1280),this.renderAllGeometry(1),d(this._bindParameters.depth),this._bindParameters.depth=t.obtainDepthTexture(),t.release(),this.performanceInfo.advance(de.DEPTH)}_renderTerrainDepth(){if(this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.terrainDepthTest=this._bindParameters.cullAboveTerrain=this._needsTerrainDepthTest,!this._needsTerrainDepthTest)return;const e=this._renderContext.output;this._renderContext.output=1;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"terrain depth",13);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this._renderTransparentGround(),this._bindParameters.terrainDepth=r.obtainDepthTexture(),r.release(),this._renderContext.output=e}_renderGeometryDepth(){if(!this._needsTerrainDepthTest)return void(this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth));const e=this._renderContext.output,{width:t,height:r}=this._framebufferSize,i=this.fboCache.acquire(t,r,"geometry depth",13);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(1280),this._renderOpaqueAndTransparentGeometry(1),this._renderContext.output=e,d(this._bindParameters.geometryDepth),this._bindParameters.geometryDepth=i.obtainDepthTexture(),i.release()}get _needsShadowDepthRange(){return this._shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return Y.Zero;const t=Z(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=Y.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<O)return void(this.sceneDepthRange.value=Y.Infinite);const t=e.clone();t.near=F,t.far=1e10;const r=Z(t,this._plugins.plugins,this.stage.layers,1);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(r)||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",R.FINAL,R.COMPOSITE,R.OPAQUE,R.TRANSPARENT,y.VIEWSHED,y.LASERLINES);return(this.hasSSAO?1:0)+e}_updateHUDOccludedFragmentOpacity(e,t){const{idleOpacity:r,navigatingOpacity:i,maxDelta:n,tiltFadeStart:h,tiltFadeEnd:o,altitudeStart:d,altitudeEnd:_}=J,l=this.stage.view,u=l.stateManager.camera,p=l.qualitySettings.fadeDuration,m=2===e?r:i,c=s((u.tilt-h)/(o-h),0,1),f=s(((u.position.z??0)-d)/(_-d),0,1),g=a(a(1,m,c),1,f),b=this._bindParameters.hudOccludedFragmentOpacity;if(p<=0||b===g||0===this._lastFrameTime||this._lastFrameTime>t)return this._bindParameters.hudOccludedFragmentOpacity=g,void(this._lastFrameTime=t);const P=t-this._lastFrameTime;this._lastFrameTime=t;const C=Math.max(1-r,Math.abs(r-i)),T=Math.min(C*P/p,n);T>=Math.abs(g-b)?this._bindParameters.hudOccludedFragmentOpacity=g:(this._bindParameters.hudOccludedFragmentOpacity=b+Math.sign(g-b)*T,this._requestRender())}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(2),this._needsDepth&&this._precompileAllGeometry(1),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(4),this._precompileShadowCascades(5)):this._precompileShadowCascades(3)),this._shadowAccumulator.active&&this._precompileAllGeometry(3)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"normals",5);r.acquireDepth(13),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(D,!0,!0),this._renderContext.output=2,this._plugins.render(...ge);const i=this._nodes.optional("normals",R.FINAL,R.COMPOSITE,R.OPAQUE,R.TRANSPARENT,y.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(de.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return;const t=this._nodes.produce(y.SSAO,this._pluginInput);return this._bindParameters.ssao=t,t&&this.performanceInfo.advance(de.SSAO),t}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...fe),this._renderContext.output=t}renderAllGeometry(e){this._renderContext.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const r of t)this._renderContext.renderOccludedMask=r,this.precompileSlots(e,...Pe);this._renderContext.renderOccludedMask=$}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(10),this.renderSlots(e,...Pe),this._renderContext.renderOccludedMask=$}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(14)}precompileViewshedShadowMap(){this._precompileAllGeometry(6)}precompileCutFill(){const e=7,t=this._renderContext.output;this._renderContext.output=e,this._plugins.precompile(0,1,...fe),this._renderContext.output=t}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(6),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._renderContext.output=i}renderCutFillReferenceDepth(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._renderContext.output=7,this._plugins.render(0,1,...fe),this._ensureBindParametersCamera(t,r),t.setGLViewport(this._rctx),this._renderContext.output=i}_renderOpaqueAndTransparentGeometry(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(...be)}_precompileOpaqueGeometry(){this._plugins.precompile(...me),this._nodes.precompile("opaque-color")}_renderOpaqueGeometry(){this._plugins.render(...me)}_renderTransparentGeometry(){this._plugins.render(...ce)}get _hasPhotoshopTerrain(){return this._plugins.produces(0,6)}get _needsTerrainDepthTest(){return this._highQualityTransparency&&this._hasPhotoshopTerrain}_renderPhotoshopTerrain(){if(!this._hasPhotoshopTerrain)return null;const e=this._framebufferSize,t=this.fboCache.acquire(e.width,e.height,"transparent terrain");return this.renderToTargets(()=>this._plugins.render(6),t,this._framebuffer.depth,D),this.performanceInfo.advance(de.TRANSPARENT_TERRAIN),t}_renderTransparentGround(){this._plugins.render(...fe)}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,13)}_renderHUDVisibility(){if(!this._needsHUDVisibility)return void(this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility));const{width:e,height:t}=this._framebufferSize;let r=this._bindParameters.hudVisibility;r?.fbo?.width===e&&r?.fbo?.height===t||(r?.release(),r=this.fboCache.acquire(e,t,"hud visibility",4),this._bindParameters.hudVisibility=r);const i=this._bindParameters.geometryDepth;r.attachDepth(i||this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(13),r.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(de.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,0===e){const e=()=>this._plugins.render(16),t=this._framebufferSize,r=this.fboCache.acquireDepth(12,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(16)}_precompileHUD(e){if(this._precompileHUDOutput(e),this._hasHighlights){const t=this._renderContext.output;this._renderContext.output=8,this._precompileHUDOutput(e),this._renderContext.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this._oitEnabled&&q(this._renderContext.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...Ce),this._bindParameters.oitPass=2,this._plugins.precompile(...Ce),this._bindParameters.oitPass=0):this._plugins.precompile(...Ce),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t){if(this._pluginsHas.hudElements){if(this._oitEnabled){const r=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,r.getTexture(),!1),r.release()}else if(this._renderContext.output=0,0===e){const t=()=>this._renderHUDElements(e),r=this._framebufferSize,i=this.fboCache.acquireDepth(12,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(12),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(0===e?de.HUD_OCCLUDED:de.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ce)}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(4,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,i=this._framebufferSize,{highlights:s}=r,a=e.acquire(i.width,i.height,"highlights",s.length>j?3:1);a.acquireDepth(13);const n=this._plugins.produces(8,0);return n&&this._framebuffer.color.fbo&&a.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,a.fbo,1024),t.bindFramebuffer(a.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),n||t.clear(1024),this._renderContext.output=8,t.bindFramebuffer(a.fbo),B(t,e,i,r,()=>this._renderHighlightGeometries()),a.detachDepth(),this.performanceInfo.advance(de.HIGHLIGHTS),a}_renderHighlightGeometries(){this._plugins.render(...Te),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t,r,i){this._shadowAccumulator.updateDepthRange(e),this._shadowAccumulator.accumulating&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,t,r,i)&&this.performanceInfo.advance(de.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this._oitEnabled&&q(this._renderContext.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...ce),this._bindParameters.oitPass=2,this._plugins.precompile(...ce),this._bindParameters.oitPass=0):this._plugins.precompile(...ce)}_renderOIT(e,t=2){const r=1===e,i=this._framebufferSize,s=r?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),a=this._bindParameters,n=this._renderContext.output;this._renderContext.output=0,a.oitPass=1;const h=r?"oit hud":"oit",o=this.fboCache.acquire(i.width,i.height,h,8),d=this._bindParameters.hasEmission;d&&o.acquireColor(le,8,"oit emissive"),o.acquireColor(d?ue:le,7,"oit alpha"),r||o.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(o.fbo),this._rctx.clearFramebuffer([0,0,0,1]),d&&this._rctx.clearBuffer(1,x),s(),o.detachDepth(),a.oitPass=2;const _=this.fboCache.acquire(i.width,i.height,r?"oit hud front":"oit front");let l;return d&&_.acquireColor(le,8,"oit emissive front"),r?_.acquireDepth(12):_.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(_.fbo),this._rctx.clearFramebuffer(D,r),s(),_.detachDepth(),a.oitPass=0,r?(l=this.fboCache.acquire(i.width,i.height,"oit hud composite"),this._rctx.bindFramebuffer(l.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):this._framebuffer.bind(),this._oitblend??=new k(this._techniques),this._oitblend.blend(this._rctx,o,_,a,d,!r),l?.detachDepth(),_.release(),o.release(),this._renderContext.output=n,l}_renderOpaque(){const e=this.plugins.produces(0,...me);if(e){this._plugins.render(0,1);const e=this._framebuffer;e.update(e=>this._renderNodes(y.CUTFILL_COLOR,e)),e.update(e=>this._renderNodes(y.OPAQUE_TERRAIN,e)),e.bind(),this._plugins.render(2,3)}const t=this._framebuffer;this._renderTerrainDepth(),t.update(t=>this._renderNodes(R.OPAQUE,t,e)),this.fboCache.debugCallback?.(R.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(y.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(y.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderTransparent(e){const t=this._framebuffer;t.bind(),this._renderPlugins(21,de.VOXEL),this._renderHiddenTransparentEdges(),e&&(this._oitEnabled?this._renderOIT(0):this._renderTransparentGeometry()),t.update(t=>this._renderNodes(R.TRANSPARENT,t,e)),this.fboCache.debugCallback?.(R.TRANSPARENT,t.color.fbo),this._renderGeometryDepth(),this._renderHUDVisibility(),this._needsTerrainDepthTest||this._plugins.render(16),this._renderEdges(0);const r=this._renderPhotoshopTerrain(),i=r?.getTexture();i&&this._bindParameters.hudVisibility&&(this._needsTerrainDepthTest?this._renderLineCallouts(0):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,i)),this._renderHUD(0,t.color)),this._bindParameters.cullAboveTerrain=!1,i&&(t.bind(),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,i),r?.release(),this._needsTerrainDepthTest&&(this._renderEdges(1),e&&(this._oitEnabled?this._renderOIT(0):this._renderTransparentGeometry(),this.performanceInfo.advance(de.TRANSPARENT)),this._renderEdges(0))),this._bindParameters.ssao=d(this._bindParameters.ssao),this._needsTerrainDepthTest&&this._renderLineCallouts(1),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(de.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(9),this.performanceInfo.advance(de.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),i}blitFBO(e,t=M,r=!0){return this._blit??=new V(this._techniques),this._blit.blit(this._rctx,e,t,this._bindParameters),this._pluginInput.set(e.name,t),r&&e.release(),t}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=w:(C(Se,this._bindParameters.camera.viewMatrix),C(we,this._bindParameters.camera.projectionMatrix),T(Ee,Se,we),T(Ee,this._renderContext.lastFrameCamera.viewMatrix,Ee),T(Ee,this._renderContext.lastFrameCamera.projectionMatrix,Ee),this._reprojectionMatrix=Ee);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=w,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,i){this._bindParameters.updateLighting(e,t,r,i),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,i,s=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(i,s,a),e(),t.detachDepth()}get test(){}};e([g({readOnly:!0})],pe.prototype,"highResolutionAtmosphere",null),e([g()],pe.prototype,"_edgeView",void 0),e([g()],pe.prototype,"updating",null),pe=e([b("esri.views.3d.webgl-engine.lib.Renderer")],pe);const me=[0,1,2,3],ce=[7,8,4,5],fe=[6,7,8],ge=[0,1,2,4,...fe],be=[3,5],Pe=[2,4,9],Ce=[17,14,15],Te=[4,5,2,3,0,1,...fe],we=S(),Se=S(),Ee=S();function xe(e){return t=>e.immediate.schedule(t)}export{pe as Renderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{ScreenSpaceGeometry as e}from"../effects/ScreenSpaceGeometry.js";import{createEmptyTexture as s}from"./glUtil3D.js";import{VaoCache as r}from"../materials/renderers/VaoCache.js";import{AppleAmdDriverHelper as t}from"../../../webgl/AppleAmdDriverHelper.js";import{RenderingContext as i}from"../../../webgl/RenderingContext.js";class a extends i{constructor(r,t){super(r,t),this.emptyTexture=s(this),this._vaoCaches=new Map,this.debugBoundTechnique="",this._appleAmdDriverHelper=null,this._refCount=1,this._newCache=t.newCache,this._screen=new e(this)}configure(e){super.configure(e),this._newCache=e.newCache}destroy(){this._vaoCaches.forEach(e=>e.dispose()),this._vaoCaches.clear(),--this._refCount>0||this.dispose()}ref(){++this._refCount}get refCount(){return this._refCount}dispose(){this.emptyTexture.dispose(),this._screen.destroy(),this._screen=null,super.dispose(),this._appleAmdDriverHelper?.dispose(),this._vaoCaches.forEach(e=>e.dispose()),this._vaoCaches.clear()}get newCache(){return this._newCache}get screen(){return this._screen}getVaoCache(e){const s=JSON.stringify(e),t=this._vaoCaches.get(s);if(t)return t;const i=new r(this,e);return this._vaoCaches.set(s,i),i}bindTechnique(e,s,r,t){return this.debugBoundTechnique=e.declaredClass,this.useProgram(e.program),this.setPipelineState(e.getPipeline()),e.program.bind(s),r&&(e.program.bindPass(r,s),t&&e.program.bindDraw(s,r,t)),e.program}runAppleAmdDriverHelper(){this.driverTest.drawArraysRequiresIndicesTypeReset.result&&(this._appleAmdDriverHelper??=new t(this),this._appleAmdDriverHelper.run())}get isAssumedMetalDriver(){if(null==this._isAssumedMetalDriver&&(this._isAssumedMetalDriver=!!has("ios")||!!has("safari"),!this._isAssumedMetalDriver&&has("mac")&&has("chrome"))){const e=this.capabilities.rendererInfo?.getUnmaskedRenderer().toLowerCase(),s=e?.includes("apple")&&e?.includes("angle")&&e?.includes("metal");this._isAssumedMetalDriver=s??!0}return this._isAssumedMetalDriver}get test(){}}export{a as RenderingContext};
5
+ import has from"../../../../core/has.js";import{ScreenSpaceGeometry as e}from"../effects/ScreenSpaceGeometry.js";import{createEmptyTexture as s}from"./glUtil3D.js";import{VaoCache as r}from"../materials/renderers/VaoCache.js";import{AppleAmdDriverHelper as t}from"../../../webgl/AppleAmdDriverHelper.js";import{RenderingContext as i}from"../../../webgl/RenderingContext.js";class a extends i{constructor(r,t){super(r,t),this.emptyTexture=s(this),this._vaoCaches=new Map,this.debugBoundTechnique="",this._appleAmdDriverHelper=null,this._refCount=1,this._newCache=t.newCache,this._screen=new e(this)}configure(e){super.configure(e),this._newCache=e.newCache}destroy(){this._vaoCaches.forEach(e=>e.dispose()),this._vaoCaches.clear(),--this._refCount>0||this.dispose()}ref(){++this._refCount}get refCount(){return this._refCount}dispose(){this.emptyTexture.dispose(),this._screen.destroy(),this._screen=null,super.dispose(),this._appleAmdDriverHelper?.dispose(),this._vaoCaches.forEach(e=>e.dispose()),this._vaoCaches.clear()}get newCache(){return this._newCache}get screen(){return this._screen}getVaoCache(e){const s=JSON.stringify(e),t=this._vaoCaches.get(s);if(t)return t;const i=new r(this,e);return this._vaoCaches.set(s,i),i}bindTechnique(e,s,r,t){return this.debugBoundTechnique=e.declaredClass,this.useProgram(e.program),this.setPipelineState(e.getPipeline(s)),e.program.bind(s),r&&(e.program.bindPass(r,s),t&&e.program.bindDraw(s,r,t)),e.program}runAppleAmdDriverHelper(){this.driverTest.drawArraysRequiresIndicesTypeReset.result&&(this._appleAmdDriverHelper??=new t(this),this._appleAmdDriverHelper.run())}get isAssumedMetalDriver(){if(null==this._isAssumedMetalDriver&&(this._isAssumedMetalDriver=!!has("ios")||!!has("safari"),!this._isAssumedMetalDriver&&has("mac")&&has("chrome"))){const e=this.capabilities.rendererInfo?.getUnmaskedRenderer().toLowerCase(),s=e?.includes("apple")&&e?.includes("angle")&&e?.includes("metal");this._isAssumedMetalDriver=s??!0}return this._isAssumedMetalDriver}get test(){}}export{a as RenderingContext};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import e from"../../../../core/Accessor.js";import{sliceEquals as r}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{smoothstep as i}from"../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{watch as o,sync as a}from"../../../../core/reactiveUtils.js";import{signal as n}from"../../../../core/signal.js";import{property as h,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{d as u,G as l}from"../../../../chunks/vec32.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ReadShadowMapPassParameters as _}from"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{BindParameters as p}from"./BindParameters.js";import{DepthRange as d}from"./DepthRange.js";import{createQuadVAO as f}from"./glUtil3D.js";import{ShadowCastRenderer as g,shadowCastDisabledElevationThreshold as b,shadowCastDisableElevationMax as v,shadowCastDisableElevationMin as S}from"./ShadowCastRenderer.js";import{ShadowMap as w}from"./ShadowMap.js";import{S as y}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as F}from"../shaders/ShadowCastAccumulateTechnique.js";import{ShadowCastAccumulateTechniqueConfiguration as A}from"../shaders/ShadowCastAccumulateTechniqueConfiguration.js";import{ShadowCastClearTechnique as x}from"../shaders/ShadowCastClearTechnique.js";import{TaskPriority as R}from"../../../support/Scheduler.js";import{SizedPixelFormat as C,PixelType as j}from"../../../webgl/enums.js";import{FramebufferObject as P}from"../../../webgl/FramebufferObject.js";import{TextureDescriptor as q}from"../../../webgl/TextureDescriptor.js";let T=class extends e{updateDepthRange(t){this._depthRange.equals(t)||(this._depthRange=t)}constructor(t,e,r,i,s,n){super({}),this.fbos=t,this._techniques=e,this._stage=r,this._prepareForShadowMapPass=i,this._renderToShadowMap=s,this._requestRender=n,this._primarySet=new M(new A(0),()=>this._requestRenderIfEnabled()),this._contextSet=new M(new A(1),()=>this._requestRenderIfEnabled()),this._passParameters=new _,this._depthRange=d.Zero,this._previewing=!1,this._shadowAccumulatorKey=Symbol("shadowAccumulator"),this._rctx=t.rctx,this._bindParameters=new p(new w(t,r.viewingMode)),this._bindParameters.shadowMap.enabled=!0,this._vao=f(this._rctx),this._accumulationRenderer=new g(e,this._rctx,this,n);const h=this._stage.view.resourceController.scheduler;this.addHandles([h.registerTask(R.SHADOW_ACCUMULATOR,this),o(()=>this._previewing,()=>this._requestRenderIfEnabled(),a),o(()=>2===this._numActive,()=>this._numActiveChanged(),a),o(()=>this._depthRange,()=>this._invalidateAccumulationSets(),a)],this._shadowAccumulatorKey);for(const o of this._accumulationSets())o.precompile(e)}*_accumulationSets(){yield this._primarySet,yield this._contextSet}normalizeCtorArgs(){return{}}destroy(){this._disable(),this.removeHandles(this._shadowAccumulatorKey),this._accumulationRenderer=s(this._accumulationRenderer),this._bindParameters.shadowMap.dispose(),this._fbo=s(this._fbo),this._vao=s(this._vao);for(const t of this._accumulationSets())t.destroy();this._contextSet=null,this._primarySet=null,this._bindParameters.destroy()}get computedSamples(){return[this._primarySet.progress,this._contextSet.progress]}get shadowCastTexture(){return this._fbo?.colorTexture}get accumulating(){return this.active&&this._previewing||this._refining}get _refining(){return this.active&&!this._doneAccumulating&&!this._previewing}get active(){return null!=this._fbo&&[...this._accumulationSets()].some(t=>t.active)}get canAccumulate(){return null!=this._bindParameters.depth&&this._depthRange!==d.Zero&&this._opacityFromElevation>b}get _doneAccumulating(){return[...this._accumulationSets()].every(t=>t.doneAccumulating)}get _opacityFromElevation(){return this._accumulationRenderer.opacityFromElevation}set _opacityFromElevation(t){this._accumulationRenderer.opacityFromElevation=t}get _numActive(){return[...this._accumulationSets()].reduce((t,e)=>t+(e.active?1:0),0)}get _pixelFormat(){return 2===this._numActive?{pixelFormat:33319,internalFormat:C.RG8}:{pixelFormat:6403,internalFormat:C.R8}}get readyToRun(){return this._refining&&this.canAccumulate&&[...this._accumulationSets()].some(t=>t.running)}runTask(t){this._clearBuffersOnAccumulationStart(),this._prepareForShadowMapPass(this._bindParameters);let e=!1;for(const r of this._accumulationSets())this._runTaskForSet(r,t)&&(e=!0);e&&this._requestRender()}_runTaskForSet(t,e){let r=!1;for(;!e.done&&!t.doneAccumulating;)this._accumulateShadow(t),e.madeProgress(),r=!0;return r}renderAccumulation(t,e,r,i){return this._updateCamera(e),this._bindParameters.contentCamera=r,this._bindParameters.depth=t,this._passParameters.origin=this._bindParameters.camera.center,this.notifyChange("canAccumulate"),!(!this.accumulating||!this.canAccumulate)&&(this._previewing||i?(this._clearFramebuffer(),this._reset()):this._clearBuffersOnAccumulationStart(),this._accumulateSetsForRenderFrame(i))}_clearBuffersOnAccumulationStart(){if([...this._accumulationSets()].every(t=>0===t.progress))this._clearFramebuffer();else for(const t of this._accumulationSets())0===t.progress&&this._clearFramebufferForSet(this._fbo,t)}_accumulateSetsForRenderFrame(t){let e=!1;for(const r of this._accumulationSets())this._accumulateSetForRenderFrame(r,t)&&(e=!0);return e&&this._requestRender(),e}_accumulateSetForRenderFrame(t,e){let r=e?t.sampleCount:Math.min(D,t.sampleCount);r-=t.progress;for(let i=0;i<r;++i)this._accumulateShadow(t);return r>0}precompile(){this._accumulationRenderer.precompile()}render(t){this._accumulationRenderer.render(t)}setOptions(t){void 0!==t.previewing&&(this._previewing=t.previewing),void 0!==t.lightDirections&&(this._primarySet.lightDirections=t.lightDirections),void 0!==t.lightDirectionsContext&&(this._contextSet.lightDirections=t.lightDirectionsContext),!0===t.enabled?this._enable():!1===t.enabled&&this._disable(),this._accumulationRenderer.setOptions(t)}readAccumulatedShadow(t,e){const r=this._primarySet.progress;return!this.active||!this._fbo||r<1||t<0||t>=this._fbo.width||e<0||e>=this._fbo.height?0:(this._fbo.readPixels(t,e,1,1,6408,j.UNSIGNED_BYTE,E),E[0]/r)}_numActiveChanged(){if(!this._fbo)return;const t=2===this._numActive,e=this._createFBO();e.resize(this._fbo.width,this._fbo.height),t&&(this._clearFramebuffer(e),this._contextSet.reset()),this._fbo.width&&this._fbo.height&&this._rctx.blitFramebuffer(this._fbo,e),this._fbo.dispose(),this._fbo=e,this._requestRender()}_enable(){this._fbo||(this._fbo=this._createFBO(),this._invalidateAccumulationSets())}_createFBO(){const{pixelFormat:t,internalFormat:e}=this._pixelFormat,r=new q;return r.pixelFormat=t,r.internalFormat=e,r.wrapMode=33071,new P(this._rctx,r)}_invalidateAccumulationSets(){for(const t of this._accumulationSets())t.reset();this._requestRenderIfEnabled()}_disable(){this._fbo&&(this._fbo=s(this._fbo),this._requestRender())}_reset(){for(const t of this._accumulationSets())t.reset()}_clearFramebuffer(t=this._fbo){t&&t.width&&t.height&&(this._rctx.bindFramebuffer(t),this._rctx.setClearColor(0,0,0,0),this._rctx.clear(16384))}_clearFramebufferForSet(t,e){if(!t)return;const r=this._techniques.get(x,e.configuration);this._rctx.bindFramebuffer(t),this._rctx.bindTechnique(r,this._bindParameters,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(r.primitiveType,0,this._vao.vertexCount("geometry"))}_accumulateShadow(t){this._renderToShadowMap(this._bindParameters,t.lightDirections[t.progress++],this._depthRange);const e=this._techniques.get(F,t.configuration);this._rctx.bindFramebuffer(this._fbo),this._rctx.bindTechnique(e,this._bindParameters,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(e.primitiveType,0,this._vao.vertexCount("geometry"))}_updateCamera(t){const e=this._fbo;if(null==e)return;const r=this._bindParameters.camera;t.equals(r)||r.copyFrom(t),e.resize(t.fullWidth,t.fullHeight),this._opacityFromElevation=1-i(S,v,t.relativeElevation)}_requestRenderIfEnabled(){this._fbo&&this._requestRender()}get test(){}};t([h()],T.prototype,"_fbo",void 0),t([h()],T.prototype,"_depthRange",void 0),t([h()],T.prototype,"_previewing",void 0),t([h()],T.prototype,"_accumulationRenderer",void 0),t([h()],T.prototype,"_refining",null),t([h()],T.prototype,"active",null),t([h()],T.prototype,"canAccumulate",null),t([h()],T.prototype,"_doneAccumulating",null),t([h()],T.prototype,"_opacityFromElevation",null),t([h()],T.prototype,"_numActive",null),t([h()],T.prototype,"_pixelFormat",null),t([h()],T.prototype,"readyToRun",null),T=t([c("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],T);const D=6,E=new Uint8Array(4);class M{constructor(t,e){this.configuration=t,this._notifyChange=e,this._cachedLightDirections=[],this._progress=n(0),this._sampleCount=n(0)}get progress(){return this._progress.value}set progress(t){this._progress.value=t}get sampleCount(){return this._sampleCount.value}get doneAccumulating(){return this.progress>=this.sampleCount}get running(){return this.progress>0}get active(){return this.sampleCount>0}get lightDirections(){return this._cachedLightDirections}set lightDirections(t){const e=this._cachedLightDirections,i=Math.min(y,t.length);if(!r(e,0,e.length,t,0,i,l)){e.length=i,this._sampleCount.value=i;for(let r=0;r<i;++r)e[r]=u(e[r]??m(),t[r]);this.reset(),this._notifyChange()}}destroy(){this._cachedLightDirections.length=0,this._sampleCount.value=0}reset(){this.progress=0}precompile(t){t.precompile(F,this.configuration),t.precompile(x,this.configuration)}}export{T as ShadowAccumulator};
5
+ import{__decorate as t}from"tslib";import e from"../../../../core/Accessor.js";import{sliceEquals as r}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{smoothstep as i}from"../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{watch as o,sync as a}from"../../../../core/reactiveUtils.js";import{signal as n}from"../../../../core/signal.js";import{property as h,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{d as u,F as l}from"../../../../chunks/vec32.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ReadShadowMapPassParameters as _}from"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{BindParameters as p}from"./BindParameters.js";import{DepthRange as d}from"./DepthRange.js";import{createQuadVAO as f}from"./glUtil3D.js";import{ShadowCastRenderer as g,shadowCastDisabledElevationThreshold as b,shadowCastDisableElevationMax as v,shadowCastDisableElevationMin as S}from"./ShadowCastRenderer.js";import{ShadowMap as w}from"./ShadowMap.js";import{S as y}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as F}from"../shaders/ShadowCastAccumulateTechnique.js";import{ShadowCastAccumulateTechniqueConfiguration as A}from"../shaders/ShadowCastAccumulateTechniqueConfiguration.js";import{ShadowCastClearTechnique as x}from"../shaders/ShadowCastClearTechnique.js";import{TaskPriority as R}from"../../../support/Scheduler.js";import{SizedPixelFormat as C,PixelType as j}from"../../../webgl/enums.js";import{FramebufferObject as P}from"../../../webgl/FramebufferObject.js";import{TextureDescriptor as q}from"../../../webgl/TextureDescriptor.js";let T=class extends e{updateDepthRange(t){this._depthRange.equals(t)||(this._depthRange=t)}constructor(t,e,r,i,s,n){super({}),this.fbos=t,this._techniques=e,this._stage=r,this._prepareForShadowMapPass=i,this._renderToShadowMap=s,this._requestRender=n,this._primarySet=new M(new A(0),()=>this._requestRenderIfEnabled()),this._contextSet=new M(new A(1),()=>this._requestRenderIfEnabled()),this._passParameters=new _,this._depthRange=d.Zero,this._previewing=!1,this._shadowAccumulatorKey=Symbol("shadowAccumulator"),this._rctx=t.rctx,this._bindParameters=new p(new w(t,r.viewingMode)),this._bindParameters.shadowMap.enabled=!0,this._vao=f(this._rctx),this._accumulationRenderer=new g(e,this._rctx,this,n);const h=this._stage.view.resourceController.scheduler;this.addHandles([h.registerTask(R.SHADOW_ACCUMULATOR,this),o(()=>this._previewing,()=>this._requestRenderIfEnabled(),a),o(()=>2===this._numActive,()=>this._numActiveChanged(),a),o(()=>this._depthRange,()=>this._invalidateAccumulationSets(),a)],this._shadowAccumulatorKey);for(const o of this._accumulationSets())o.precompile(e)}*_accumulationSets(){yield this._primarySet,yield this._contextSet}normalizeCtorArgs(){return{}}destroy(){this._disable(),this.removeHandles(this._shadowAccumulatorKey),this._accumulationRenderer=s(this._accumulationRenderer),this._bindParameters.shadowMap.dispose(),this._fbo=s(this._fbo),this._vao=s(this._vao);for(const t of this._accumulationSets())t.destroy();this._contextSet=null,this._primarySet=null,this._bindParameters.destroy()}get computedSamples(){return[this._primarySet.progress,this._contextSet.progress]}get shadowCastTexture(){return this._fbo?.colorTexture}get accumulating(){return this.active&&this._previewing||this._refining}get _refining(){return this.active&&!this._doneAccumulating&&!this._previewing}get active(){return null!=this._fbo&&[...this._accumulationSets()].some(t=>t.active)}get canAccumulate(){return null!=this._bindParameters.depth&&this._depthRange!==d.Zero&&this._opacityFromElevation>b}get _doneAccumulating(){return[...this._accumulationSets()].every(t=>t.doneAccumulating)}get _opacityFromElevation(){return this._accumulationRenderer.opacityFromElevation}set _opacityFromElevation(t){this._accumulationRenderer.opacityFromElevation=t}get _numActive(){return[...this._accumulationSets()].reduce((t,e)=>t+(e.active?1:0),0)}get _pixelFormat(){return 2===this._numActive?{pixelFormat:33319,internalFormat:C.RG8}:{pixelFormat:6403,internalFormat:C.R8}}get readyToRun(){return this._refining&&this.canAccumulate&&[...this._accumulationSets()].some(t=>t.running)}runTask(t){this._clearBuffersOnAccumulationStart(),this._prepareForShadowMapPass(this._bindParameters);let e=!1;for(const r of this._accumulationSets())this._runTaskForSet(r,t)&&(e=!0);e&&this._requestRender()}_runTaskForSet(t,e){let r=!1;for(;!e.done&&!t.doneAccumulating;)this._accumulateShadow(t),e.madeProgress(),r=!0;return r}renderAccumulation(t,e,r,i){return this._updateCamera(e),this._bindParameters.contentCamera=r,this._bindParameters.depth=t,this._passParameters.origin=this._bindParameters.camera.center,this.notifyChange("canAccumulate"),!(!this.accumulating||!this.canAccumulate)&&(this._previewing||i?(this._clearFramebuffer(),this._reset()):this._clearBuffersOnAccumulationStart(),this._accumulateSetsForRenderFrame(i))}_clearBuffersOnAccumulationStart(){if([...this._accumulationSets()].every(t=>0===t.progress))this._clearFramebuffer();else for(const t of this._accumulationSets())0===t.progress&&this._clearFramebufferForSet(this._fbo,t)}_accumulateSetsForRenderFrame(t){let e=!1;for(const r of this._accumulationSets())this._accumulateSetForRenderFrame(r,t)&&(e=!0);return e&&this._requestRender(),e}_accumulateSetForRenderFrame(t,e){let r=e?t.sampleCount:Math.min(D,t.sampleCount);r-=t.progress;for(let i=0;i<r;++i)this._accumulateShadow(t);return r>0}precompile(){this._accumulationRenderer.precompile()}render(t){this._accumulationRenderer.render(t)}setOptions(t){void 0!==t.previewing&&(this._previewing=t.previewing),void 0!==t.lightDirections&&(this._primarySet.lightDirections=t.lightDirections),void 0!==t.lightDirectionsContext&&(this._contextSet.lightDirections=t.lightDirectionsContext),!0===t.enabled?this._enable():!1===t.enabled&&this._disable(),this._accumulationRenderer.setOptions(t)}readAccumulatedShadow(t,e){const r=this._primarySet.progress;return!this.active||!this._fbo||r<1||t<0||t>=this._fbo.width||e<0||e>=this._fbo.height?0:(this._fbo.readPixels(t,e,1,1,6408,j.UNSIGNED_BYTE,E),E[0]/r)}_numActiveChanged(){if(!this._fbo)return;const t=2===this._numActive,e=this._createFBO();e.resize(this._fbo.width,this._fbo.height),t&&(this._clearFramebuffer(e),this._contextSet.reset()),this._fbo.width&&this._fbo.height&&this._rctx.blitFramebuffer(this._fbo,e),this._fbo.dispose(),this._fbo=e,this._requestRender()}_enable(){this._fbo||(this._fbo=this._createFBO(),this._invalidateAccumulationSets())}_createFBO(){const{pixelFormat:t,internalFormat:e}=this._pixelFormat,r=new q;return r.pixelFormat=t,r.internalFormat=e,r.wrapMode=33071,new P(this._rctx,r)}_invalidateAccumulationSets(){for(const t of this._accumulationSets())t.reset();this._requestRenderIfEnabled()}_disable(){this._fbo&&(this._fbo=s(this._fbo),this._requestRender())}_reset(){for(const t of this._accumulationSets())t.reset()}_clearFramebuffer(t=this._fbo){t&&t.width&&t.height&&(this._rctx.bindFramebuffer(t),this._rctx.setClearColor(0,0,0,0),this._rctx.clear(16384))}_clearFramebufferForSet(t,e){if(!t)return;const r=this._techniques.get(x,e.configuration);this._rctx.bindFramebuffer(t),this._rctx.bindTechnique(r,this._bindParameters,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(r.primitiveType,0,this._vao.vertexCount("geometry"))}_accumulateShadow(t){this._renderToShadowMap(this._bindParameters,t.lightDirections[t.progress++],this._depthRange);const e=this._techniques.get(F,t.configuration);this._rctx.bindFramebuffer(this._fbo),this._rctx.bindTechnique(e,this._bindParameters,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(e.primitiveType,0,this._vao.vertexCount("geometry"))}_updateCamera(t){const e=this._fbo;if(null==e)return;const r=this._bindParameters.camera;t.equals(r)||r.copyFrom(t),e.resize(t.fullWidth,t.fullHeight),this._opacityFromElevation=1-i(S,v,t.relativeElevation)}_requestRenderIfEnabled(){this._fbo&&this._requestRender()}get test(){}};t([h()],T.prototype,"_fbo",void 0),t([h()],T.prototype,"_depthRange",void 0),t([h()],T.prototype,"_previewing",void 0),t([h()],T.prototype,"_accumulationRenderer",void 0),t([h()],T.prototype,"_refining",null),t([h()],T.prototype,"active",null),t([h()],T.prototype,"canAccumulate",null),t([h()],T.prototype,"_doneAccumulating",null),t([h()],T.prototype,"_opacityFromElevation",null),t([h()],T.prototype,"_numActive",null),t([h()],T.prototype,"_pixelFormat",null),t([h()],T.prototype,"readyToRun",null),T=t([c("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],T);const D=6,E=new Uint8Array(4);class M{constructor(t,e){this.configuration=t,this._notifyChange=e,this._cachedLightDirections=[],this._progress=n(0),this._sampleCount=n(0)}get progress(){return this._progress.value}set progress(t){this._progress.value=t}get sampleCount(){return this._sampleCount.value}get doneAccumulating(){return this.progress>=this.sampleCount}get running(){return this.progress>0}get active(){return this.sampleCount>0}get lightDirections(){return this._cachedLightDirections}set lightDirections(t){const e=this._cachedLightDirections,i=Math.min(y,t.length);if(!r(e,0,e.length,t,0,i,l)){e.length=i,this._sampleCount.value=i;for(let r=0;r<i;++r)e[r]=u(e[r]??m(),t[r]);this.reset(),this._notifyChange()}}destroy(){this._cachedLightDirections.length=0,this._sampleCount.value=0}reset(){this.progress=0}precompile(t){t.precompile(F,this.configuration),t.precompile(x,this.configuration)}}export{T as ShadowAccumulator};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{addMany as r,filterInPlace as t}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{someMap as s,everyMap as i}from"../../../../core/MapUtils.js";import n from"../../../../core/PooledArray.js";import{property as o,subclass as d}from"../../../../core/accessorSupport/decorators.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{OverlayTarget as h}from"../../terrain/Intersector.js";import{ChangeSet as c,RenderGeometryUpdate as l}from"./ChangeSet.js";import{IntersectorResult as p}from"./IntersectorResult.js";import{RendererBase as u}from"./RendererBase.js";import{noBudget as g}from"../../../support/Scheduler.js";let m=class extends u{constructor(e){super(e),this._pending=new y,this._changes=new c,this._sortedRenderers=new n,this._geometries=new Map,this._hasHighlights=!1,this._hasWater=!1}destroy(){this.destroyed||(this._changes.prune(),this._sortedRenderers.prune(),this._geometries.clear(),this._pending.clear())}get updating(){return!this._pending.empty||this._changes.updates.length>0}get rctx(){return this.rendererContext.rctx}get _localOriginFactory(){return this.rendererContext.localOriginFactory}get hasHighlights(){return this._hasHighlights}hasHighlight(e){return s(this.renderers,r=>r.hasHighlight(e))}get hasWater(){return this._hasWater}get hasOccluders(){return this.renderers&&s(this.renderers,e=>e.hasOnlyOccluders)}get hasOnlyOccluders(){return i(this.renderers,e=>e.hasOnlyOccluders)}get isEmpty(){return!this.updating&&0===this.renderers.size&&0===this._geometries.size}get sortedRenderers(){return this._sortedRenderers}commitChanges(){return!!this.updating&&(this._processAddsRemoves(),this.commit(this._changes,g,this.rendererContext.pluginContext)&&(this._updateSortedMaterialRenderers(),this._hasHighlights=s(this.renderers,e=>{const r=e.produces.get(18);return!!r&&r(8)}),this._hasWater=s(this.renderers,e=>{const r=e.produces.get(19);return!!r&&r(2)})),this.notifyChange("updating"),!0)}rendererAdded(){this._sortedRenderers.clear()}rendererRemoved(){this._sortedRenderers.clear()}addGeometries(e,r){if(0===e.length)return;const t=this._validateRenderGeometries(e);for(const i of t)this._geometries.set(i.id,i);const s=this._pending.empty;for(const i of t)this._pending.adds.add(i);switch(s&&this.notifyChange("updating"),r){case 0:this._notifyGraphicVisibilityChanged(e);break;case 1:this._notifyGraphicGeometryChanged(e)}}removeGeometries(e,r){if(this.destroyed)return;const t=this._pending.empty,s=this._pending.adds;for(const i of e)s.has(i)?(this._pending.removed.add(i),s.delete(i)):this._pending.removed.has(i)||this._pending.removes.add(i),this._geometries.delete(i.id);t&&!this._pending.empty&&this.notifyChange("updating"),1===r&&this._notifyGraphicGeometryChanged(e)}modifyGeometries(e,r){const t=0===this._changes.updates.length;for(const s of e){const e=new l;this._changes.updates.push(e),e.renderGeometry=this._ensureValidRenderGeometry(s),e.updateType=r}switch(t&&this._changes.updates.length>0&&this.notifyChange("updating"),r){case 4:case 2:return this._notifyGraphicGeometryChanged(e);case 1:return this._notifyGraphicVisibilityChanged(e)}}updateAnimation(e){let r=!1;return this._sortedRenderers.forAll(t=>r=!!t.updateAnimation&&t.updateAnimation(e)||r),r}precompile(e){return this._sortedRenderers.reduce((r,t)=>t.precompile(e)||r,!1)}render(e){this._sortedRenderers.forAll(r=>{const t=r.acquireTechniques(e);t&&r.render(e,t)})}intersect(e,r,t,s,i){for(const n of this._geometries.values()){if(!s(n))continue;this._intersectRenderGeometry(n,t,r,0,e,i);const o=this.rendererContext.longitudeCyclical;o&&(n.boundingSphere.center[0]-n.boundingSphere.radius<o.min&&this._intersectRenderGeometry(n,t,r,o.range,e,i),n.boundingSphere.center[0]+n.boundingSphere.radius>o.max&&this._intersectRenderGeometry(n,t,r,-o.range,e,i)),i++}return i}_updateSortedMaterialRenderers(){if(!(this._sortedRenderers.length>0)){for(const e of this.renderers.values())this._sortedRenderers.push(e);this._sortedRenderers.sort((e,r)=>r.material?.renderPriority===e.material?.renderPriority?e.drapedPriority-r.drapedPriority:(r.material?.renderPriority||0)-(e.material?.renderPriority||0))}}_processAddsRemoves(){this._changes.adds.length=0,this._changes.removes.length=0,r(this._changes.adds,Array.from(this._pending.adds)),r(this._changes.removes,Array.from(this._pending.removes)),t(this._changes.updates,({renderGeometry:e})=>!this._pending.has(e)),this._pending.clear()}_intersectRenderGeometry(e,r,t,s,i,n){if(!e.visible||!e.material.visible||!e.material.intersectDraped)return;let o=0;s+=e.transformation[12],o=e.transformation[13],f[0]=t[0]-s,f[1]=t[1]-o,e.screenToWorldRatio=this.rendererContext.screenToWorldRatio,e.material.intersectDraped(e,i,f,(t,s,o)=>{_(r,o,n,e.material.renderPriority,i,e.layerViewUid,e.graphicUid)},r)}_notifyGraphicGeometryChanged(e){if(null==this.drapeSource.notifyGraphicGeometryChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicGeometryChanged(t),r=t)}_notifyGraphicVisibilityChanged(e){if(null==this.drapeSource.notifyGraphicVisibilityChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicVisibilityChanged(t),r=t)}_validateRenderGeometries(e){for(const r of e)this._ensureValidRenderGeometry(r);return e}_ensureValidRenderGeometry(e){return null==e.localOrigin&&(e.localOrigin=this._localOriginFactory.getOrigin(e.boundingSphere.center)),e}get test(){}};e([o({constructOnly:!0})],m.prototype,"drapeSource",void 0),e([o({constructOnly:!0})],m.prototype,"rendererContext",void 0),e([o()],m.prototype,"updating",null),e([o()],m.prototype,"rctx",null),e([o()],m.prototype,"_localOriginFactory",null),e([o({readOnly:!0})],m.prototype,"isEmpty",null),e([o()],m.prototype,"_geometries",void 0),m=e([d("esri.views.3d.webgl-engine.lib.SortedRenderGeometryRenderer")],m);class y{constructor(){this.adds=new Set,this.removes=new Set,this.removed=new Set}get empty(){return 0===this.adds.size&&0===this.removes.size&&0===this.removed.size}has(e){return this.adds.has(e)||this.removes.has(e)||this.removed.has(e)}clear(){this.adds.clear(),this.removes.clear(),this.removed.clear()}}function _(e,r,t,s,i,n,o){const d=new h(n,o,r),a=r=>{r.set(5,d,e.distance,e.normal,e.transformation,t,s)};if((null==i.results.min.drapedLayerOrder||t>=i.results.min.drapedLayerOrder)&&(null==i.results.min.distance||i.results.ground.distance<=i.results.min.distance)&&a(i.results.min),0!==i.options.store&&(null==i.results.max.drapedLayerOrder||t<i.results.max.drapedLayerOrder)&&(null==i.results.max.distance||i.results.ground.distance>i.results.max.distance)&&a(i.results.max),2===i.options.store){const e=new p(i.ray);a(e),i.results.all.push(e)}}const f=a();export{m as SortedRenderGeometryRenderer};
5
+ import{__decorate as e}from"tslib";import{addMany as r,filterInPlace as t}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{someMap as s,everyMap as i}from"../../../../core/MapUtils.js";import n from"../../../../core/PooledArray.js";import{property as o,subclass as d}from"../../../../core/accessorSupport/decorators.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{OverlayTarget as h}from"../../terrain/Intersector.js";import{ChangeSet as c,RenderGeometryUpdate as l}from"./ChangeSet.js";import{IntersectorResult as p}from"./IntersectorResult.js";import{RendererBase as u}from"./RendererBase.js";import{noBudget as g}from"../../../support/Scheduler.js";let m=class extends u{constructor(e){super(e),this._pending=new y,this._changes=new c,this._sortedRenderers=new n,this._geometries=new Map,this._hasHighlights=!1,this._hasWater=!1}destroy(){this.destroyed||(this._changes.prune(),this._sortedRenderers.prune(),this._geometries.clear(),this._pending.clear())}get updating(){return!this._pending.empty||this._changes.updates.length>0}get rctx(){return this.rendererContext.rctx}get _localOriginFactory(){return this.rendererContext.localOriginFactory}get hasHighlights(){return this._hasHighlights}hasHighlight(e){return s(this.renderers,r=>r.hasHighlight(e))}get hasWater(){return this._hasWater}get hasOccluders(){return this.renderers&&s(this.renderers,e=>e.hasOnlyOccluders)}get hasOnlyOccluders(){return i(this.renderers,e=>e.hasOnlyOccluders)}get isEmpty(){return!this.updating&&0===this.renderers.size&&0===this._geometries.size}get sortedRenderers(){return this._sortedRenderers}commitChanges(){return!!this.updating&&(this._processAddsRemoves(),this.commit(this._changes,g,this.rendererContext.pluginContext)&&(this._updateSortedMaterialRenderers(),this._hasHighlights=s(this.renderers,e=>{const r=e.produces.get(19);return!!r&&r(8)}),this._hasWater=s(this.renderers,e=>{const r=e.produces.get(20);return!!r&&r(2)})),this.notifyChange("updating"),!0)}rendererAdded(){this._sortedRenderers.clear()}rendererRemoved(){this._sortedRenderers.clear()}addGeometries(e,r){if(0===e.length)return;const t=this._validateRenderGeometries(e);for(const i of t)this._geometries.set(i.id,i);const s=this._pending.empty;for(const i of t)this._pending.adds.add(i);switch(s&&this.notifyChange("updating"),r){case 0:this._notifyGraphicVisibilityChanged(e);break;case 1:this._notifyGraphicGeometryChanged(e)}}removeGeometries(e,r){if(this.destroyed)return;const t=this._pending.empty,s=this._pending.adds;for(const i of e)s.has(i)?(this._pending.removed.add(i),s.delete(i)):this._pending.removed.has(i)||this._pending.removes.add(i),this._geometries.delete(i.id);t&&!this._pending.empty&&this.notifyChange("updating"),1===r&&this._notifyGraphicGeometryChanged(e)}modifyGeometries(e,r){const t=0===this._changes.updates.length;for(const s of e){const e=new l;this._changes.updates.push(e),e.renderGeometry=this._ensureValidRenderGeometry(s),e.updateType=r}switch(t&&this._changes.updates.length>0&&this.notifyChange("updating"),r){case 4:case 2:return this._notifyGraphicGeometryChanged(e);case 1:return this._notifyGraphicVisibilityChanged(e)}}updateAnimation(e){let r=!1;return this._sortedRenderers.forAll(t=>r=!!t.updateAnimation&&t.updateAnimation(e)||r),r}precompile(e){return this._sortedRenderers.reduce((r,t)=>t.precompile(e)||r,!1)}render(e){this._sortedRenderers.forAll(r=>{const t=r.acquireTechniques(e);t&&r.render(e,t)})}intersect(e,r,t,s,i){for(const n of this._geometries.values()){if(!s(n))continue;this._intersectRenderGeometry(n,t,r,0,e,i);const o=this.rendererContext.longitudeCyclical;o&&(n.boundingSphere.center[0]-n.boundingSphere.radius<o.min&&this._intersectRenderGeometry(n,t,r,o.range,e,i),n.boundingSphere.center[0]+n.boundingSphere.radius>o.max&&this._intersectRenderGeometry(n,t,r,-o.range,e,i)),i++}return i}_updateSortedMaterialRenderers(){if(!(this._sortedRenderers.length>0)){for(const e of this.renderers.values())this._sortedRenderers.push(e);this._sortedRenderers.sort((e,r)=>r.material?.renderPriority===e.material?.renderPriority?e.drapedPriority-r.drapedPriority:(r.material?.renderPriority||0)-(e.material?.renderPriority||0))}}_processAddsRemoves(){this._changes.adds.length=0,this._changes.removes.length=0,r(this._changes.adds,Array.from(this._pending.adds)),r(this._changes.removes,Array.from(this._pending.removes)),t(this._changes.updates,({renderGeometry:e})=>!this._pending.has(e)),this._pending.clear()}_intersectRenderGeometry(e,r,t,s,i,n){if(!e.visible||!e.material.visible||!e.material.intersectDraped)return;let o=0;s+=e.transformation[12],o=e.transformation[13],f[0]=t[0]-s,f[1]=t[1]-o,e.screenToWorldRatio=this.rendererContext.screenToWorldRatio,e.material.intersectDraped(e,i,f,(t,s,o)=>{_(r,o,n,e.material.renderPriority,i,e.layerViewUid,e.graphicUid)},r)}_notifyGraphicGeometryChanged(e){if(null==this.drapeSource.notifyGraphicGeometryChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicGeometryChanged(t),r=t)}_notifyGraphicVisibilityChanged(e){if(null==this.drapeSource.notifyGraphicVisibilityChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicVisibilityChanged(t),r=t)}_validateRenderGeometries(e){for(const r of e)this._ensureValidRenderGeometry(r);return e}_ensureValidRenderGeometry(e){return null==e.localOrigin&&(e.localOrigin=this._localOriginFactory.getOrigin(e.boundingSphere.center)),e}get test(){}};e([o({constructOnly:!0})],m.prototype,"drapeSource",void 0),e([o({constructOnly:!0})],m.prototype,"rendererContext",void 0),e([o()],m.prototype,"updating",null),e([o()],m.prototype,"rctx",null),e([o()],m.prototype,"_localOriginFactory",null),e([o({readOnly:!0})],m.prototype,"isEmpty",null),e([o()],m.prototype,"_geometries",void 0),m=e([d("esri.views.3d.webgl-engine.lib.SortedRenderGeometryRenderer")],m);class y{constructor(){this.adds=new Set,this.removes=new Set,this.removed=new Set}get empty(){return 0===this.adds.size&&0===this.removes.size&&0===this.removed.size}has(e){return this.adds.has(e)||this.removes.has(e)||this.removed.has(e)}clear(){this.adds.clear(),this.removes.clear(),this.removed.clear()}}function _(e,r,t,s,i,n,o){const d=new h(n,o,r),a=r=>{r.set(5,d,e.distance,e.normal,e.transformation,t,s)};if((null==i.results.min.drapedLayerOrder||t>=i.results.min.drapedLayerOrder)&&(null==i.results.min.distance||i.results.ground.distance<=i.results.min.distance)&&a(i.results.min),0!==i.options.store&&(null==i.results.max.drapedLayerOrder||t<i.results.max.drapedLayerOrder)&&(null==i.results.max.distance||i.results.ground.distance>i.results.max.distance)&&a(i.results.max),2===i.options.store){const e=new p(i.ray);a(e),i.results.all.push(e)}}const f=a();export{m as SortedRenderGeometryRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{disposeMaybe as t}from"../../../../../core/maybe.js";import{SizedPixelFormat as e,PixelType as i}from"../../../../webgl/enums.js";import{Texture as r}from"../../../../webgl/Texture.js";import{TextureDescriptor as s}from"../../../../webgl/TextureDescriptor.js";class u{constructor(t,e){this._rctx=t,this._fields=[],this._nameToFieldMap=new Map,this._textureData=new Uint8Array(new ArrayBuffer),this._textureWidth=0,this._textureHeight=0,this._texture=null,this._dirty=!0,this._layout=e,this._setupFields(e)}get layout(){return this._layout}dispose(){this._texture=t(this._texture),this._texture=void 0,this._textureData=void 0}get test(){return{data:this._textureData,fields:this._fields}}getScalarField(t){const e=this._nameToFieldMap.get(t);return 1===e?.elementCount?e:null}getVec4Field(t){const e=this._nameToFieldMap.get(t);return 4===e?.elementCount?e:null}resizeToFit(t){const e=t+1;e>this._textureData.length/this._layout.byteStride&&this._resize(e)}updateTexture(){if(!this._dirty)return;const{_textureWidth:e,_textureHeight:i}=this;if(0===i||0===i)return this._texture=t(this._texture),void(this._dirty=!1);const r=this._texture?.descriptor.width,s=this._texture?.descriptor.height;null!=this._texture&&r===e&&s===i||(this._texture=t(this.texture),this._texture=this._allocateTexture()),this._texture.setData(this._textureData),this._dirty=!1}get texture(){return this._texture}_resize(t){const{_fields:e,_layout:i}=this,r=i.byteStride;if(0===t){const t=new ArrayBuffer;this._textureData=new Uint8Array(t);for(const i of e)i.updateBuffer(t);return void(this._dirty=!0)}const s=Math.ceil(Math.sqrt(t)),u=Math.ceil(t/s),a=s*r,h=Math.ceil(a/4),_=new ArrayBuffer(a*u);for(const n of e)n.updateBuffer(_);const o=new Uint8Array(_);o.set(this._textureData),this._textureData=o,this._textureWidth=h,this._textureHeight=u,this._dirty=!0}_setupFields(t){const e=this._textureData.buffer;this._fields=t.fields.map(t=>{const i=t.createField(()=>this._dirty=!0);return i.updateBuffer(e),this._nameToFieldMap.set(i.name,i),i})}_allocateTexture(){const t=new s(this._textureWidth,this._textureHeight);return t.samplingMode=9728,t.wrapMode=33071,t.internalFormat=e.RGBA8UI,t.pixelFormat=36249,t.dataType=i.UNSIGNED_BYTE,t.isImmutable=!0,t.hasMipmap=!1,new r(this._rctx,t)}}export{u as TextureBackedBuffer};
5
+ import{disposeMaybe as t}from"../../../../../core/maybe.js";import{Vec4Field as e,ScalarField as i}from"./TextureBackedBufferFields.js";import{SizedPixelFormat as r,PixelType as s}from"../../../../webgl/enums.js";import{Texture as u}from"../../../../webgl/Texture.js";import{TextureDescriptor as o}from"../../../../webgl/TextureDescriptor.js";class a{constructor(t,e){this._rctx=t,this._layout=e,this._nameToFieldMap=new Map,this._textureWidth=0,this._textureHeight=0,this._texture=null,this._dirty=!0,this._textureData=e.createBuffer(0),this._setupFields(e)}get layout(){return this._layout}dispose(){this._texture=t(this._texture),this._textureData=void 0}get test(){return{data:this._textureData}}getScalarField(t){const e=this._nameToFieldMap.get(t);return 1===e?.elementCount?e:null}getVec4Field(t){const e=this._nameToFieldMap.get(t);return 4===e?.elementCount?e:null}resizeToFit(t){const e=t+1;e>this._textureData.count&&this._resize(e)}updateTexture(){if(!this._dirty)return;const{_textureWidth:e,_textureHeight:i}=this;if(0===i||0===i)return this._texture=t(this._texture),void(this._dirty=!1);const r=this._texture?.descriptor.width,s=this._texture?.descriptor.height;null!=this._texture&&r===e&&s===i||(this._texture=t(this.texture),this._texture=this._allocateTexture()),this._texture.setData(this._textureData.texelElementBuffer),this._dirty=!1}get texture(){return this._texture}_resize(t){const{_layout:e}=this;if(0===t)return this._textureData=e.createBuffer(0),this._updateFields(),void(this._dirty=!0);const i=Math.ceil(Math.sqrt(t)),r=Math.ceil(t/i),s=i*r,{texelStride:u}=e,o=i*u,a=r,h=e.createBuffer(s);h.texelElementBuffer.set(this._textureData.texelElementBuffer),this._textureData=h,this._updateFields(),this._textureWidth=o,this._textureHeight=a,this._dirty=!0}_setupFields(t){const r=this._textureData,s=()=>{this._dirty=!0},u=new Map;for(const[o,a]of t.fields){const t=r.getField(o,a.bufferViewConstructor);if(null==t)throw new Error(`Field ${o} does not exist in buffer`);u.set(o,4===t.elementCount?new e(t,a,s):new i(t,a,s))}this._nameToFieldMap=u}_updateFields(){const t=this._textureData;for(const[e,i]of this._nameToFieldMap){const r=t.getField(e,i.layoutField.bufferViewConstructor);if(null==r)throw new Error(`Field ${e} does not exist in buffer`);i.updateBufferView(r)}}_allocateTexture(){const t=new o(this._textureWidth,this._textureHeight);return t.samplingMode=9728,t.wrapMode=33071,t.internalFormat=r.RGBA8UI,t.pixelFormat=36249,t.dataType=s.UNSIGNED_BYTE,t.isImmutable=!0,t.hasMipmap=!1,new u(this._rctx,t)}}export{a as TextureBackedBuffer};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
+ */
5
+ import{hasNativeFloat16Array as e}from"../../../../../geometry/support/float16.js";import{BufferViewFloat as t,BufferViewFloat16 as o,BufferViewVec4Unorm8 as r,BufferViewUnorm8 as n,BufferViewVec4u8 as f,BufferViewUint8 as u}from"../../../../../geometry/support/buffer/BufferView.js";import{elementTypeSize as s}from"../../../../../geometry/support/buffer/types.js";class m{constructor(e,t,o){this.elementCount=e,this.elementType=t,this.bufferViewConstructor=o,this.byteSize=i(o)}}function i(e){return s(e.ElementType)*e.ElementCount}const p={u8:new m(1,"uint",u),vec4u8:new m(4,"uint",f),unorm8:new m(1,"float",n),vec4unorm8:new m(4,"float",r),f16:new m(1,"float",e?o:t),f32:new m(1,"float",t)};export{m as FieldCreationInfo,p as typeToCreationInfoMap};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{hasNativeFloat16Array as e}from"../../../../../geometry/support/float16.js";import{BufferViewFloat as t,BufferViewFloat16 as s,BufferViewVec4u8 as r,BufferViewUint8 as i}from"../../../../../geometry/support/buffer/BufferView.js";import{elementTypeSize as f}from"../../../../../geometry/support/buffer/types.js";class u{constructor(e,t,s,r){this.name=e,this.byteOffset=t,this.byteStride=s,this.makeDirty=r}}class n extends u{constructor(e,t,s,r){super(e,t,s,r),this.elementCount=1}}class o extends n{constructor(e,t,s,r,i){super(e,s,r,i),this._bufferViewConstructor=t}updateBuffer(e){const{byteOffset:t,byteStride:s,_bufferViewConstructor:r}=this;this._bufferView=new r(e,t,s),this.makeDirty()}set(e,t){this._bufferView.set(e,t),this.makeDirty()}}class m extends n{constructor(e,t,s,r,i){super(e,s,r,i),this._bufferViewConstructor=t}updateBuffer(e){const{byteOffset:t,byteStride:s,_bufferViewConstructor:r}=this;this._bufferView=new r(e,t,s),this.makeDirty()}set(e,t){this._bufferView.set(e,255*t),this.makeDirty()}}class a extends u{constructor(e,t,s,r){super(e,t,s,r),this.elementCount=4}}class b extends a{constructor(e,t,s,r,i){super(e,s,r,i),this._bufferViewConstructor=t}updateBuffer(e){const{byteOffset:t,byteStride:s,_bufferViewConstructor:r}=this;this._bufferView=new r(e,t,s),this.makeDirty()}setValues(e,t,s,r,i){this._bufferView.set(e,0,t),this._bufferView.set(e,1,s),this._bufferView.set(e,2,r),this._bufferView.set(e,3,i),this.makeDirty()}setElement(e,t,s){this._bufferView.set(e,t,s),this.makeDirty()}getElement(e,t){return this._bufferView.get(e,t)}setArray(e,t){this.setValues(e,t[0],t[1],t[2],t[3])}}class h extends a{constructor(e,t,s,r,i){super(e,s,r,i),this._bufferViewConstructor=t}updateBuffer(e){const{byteOffset:t,byteStride:s,_bufferViewConstructor:r}=this;this._bufferView=new r(e,t,s),this.makeDirty()}setValues(e,t,s,r,i){this._bufferView.set(e,0,255*t),this._bufferView.set(e,1,255*s),this._bufferView.set(e,2,255*r),this._bufferView.set(e,3,255*i),this.makeDirty()}setElement(e,t,s){this._bufferView.set(e,t,255*s),this.makeDirty()}getElement(e,t){return this._bufferView.get(e,t)/255}setArray(e,t){this.setValues(e,t[0],t[1],t[2],t[3])}}function c(e){return f(e.ElementType)*e.ElementCount}const l={u8:{elementCount:1,elementType:"uint",byteSize:c(i),createField:(e,t,s,r)=>new o(e.name,i,t,s,r)},vec4u8:{elementCount:4,elementType:"uint",byteSize:c(r),createField:(e,t,s,i)=>new b(e.name,r,t,s,i)},unorm8:{elementCount:1,elementType:"float",byteSize:c(i),createField:(e,t,s,r)=>new m(e.name,i,t,s,r)},vec4unorm8:{elementCount:4,elementType:"float",byteSize:c(r),createField:(e,t,s,i)=>new h(e.name,r,t,s,i)},f16:{elementCount:1,elementType:"float",byteSize:c(e?s:t),createField:(r,i,f,u)=>new o(r.name,e?s:t,i,f,u)},f32:{elementCount:1,elementType:"float",byteSize:c(t),createField:(e,s,r,i)=>new o(e.name,t,s,r,i)}};export{u as Field,n as ScalarField,o as SimpleScalarField,b as SimpleVec4Field,m as Unorm8ScalarField,h as Unorm8Vec4Field,a as Vec4Field,l as typeToCreationInfoMap};
5
+ class e{constructor(e,t,s){this._bufferView=e,this.layoutField=t,this._makeDirty=s}get elementCount(){return this._bufferView.elementCount}updateBufferView(e){this._bufferView=e}}class t extends e{set(e,t){this._bufferView.set(e,t),this._makeDirty()}get(e){return this._bufferView.get(e)}}class s extends e{setArray(e,t){this._bufferView.set(e,0,t[0]),this._bufferView.set(e,1,t[1]),this._bufferView.set(e,2,t[2]),this._bufferView.set(e,3,t[3]),this._makeDirty()}setVec(e,t){this._bufferView.setVec(e,t),this._makeDirty()}setValues(e,t,s,i,r){this._bufferView.set(e,0,t),this._bufferView.set(e,1,s),this._bufferView.set(e,2,i),this._bufferView.set(e,3,r),this._makeDirty()}set(e,t,s){this._bufferView.set(e,t,s),this._makeDirty()}getVec(e,t){return this._bufferView.getVec(e,t)}get(e,t){return this._bufferView.get(e,t)}}export{e as Field,t as ScalarField,s as Vec4Field};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{typeToCreationInfoMap as t}from"./TextureBackedBufferFields.js";class e{constructor(t,e,n,r){this._declaration=t,this._byteOffset=e,this._byteStride=n,this._creationInfo=r,this._startTexel=Math.floor(e/4);const s=this.byteSize;this._numTexels=Math.ceil((e+s)/4)-this._startTexel;let i=this._startTexel,o=e%4;const l=[],a=["x","y","z","w"];for(let c=0;c<s;++c){const t=`texel${i}.${a[o]}`;l.push(t),++o,o>=4&&(o=0,++i)}this._glslDecodeArgumentString=l.join(", ")}get name(){return this._declaration.name}get declaration(){return this._declaration}get byteOffset(){return this._byteOffset}get byteSize(){return this._creationInfo.byteSize}get startTexel(){return this._startTexel}get numTexels(){return this._numTexels}get elementType(){return this._creationInfo.elementType}get elementCount(){return this._creationInfo.elementCount}get glslDecodeArgumentString(){return this._glslDecodeArgumentString}createField(t){const{_declaration:e,_byteOffset:n,_byteStride:r,_creationInfo:s}=this;return s.createField(e,n,r,t)}}function n(t){return t+3&-4}class r{constructor(r){this.byteStride=0,this.numTexels=0;let s=0;const i=[];for(let e=0;e<r.length;++e){const n=r[e],{type:o}=n,l=t[o];i.push({declaration:n,byteOffset:s,creationInfo:l}),s+=l.byteSize}s=n(s);const o=s,l=i.map(({declaration:t,byteOffset:n,creationInfo:r})=>new e(t,n,o,r));this.fields=l,this.byteStride=o,this.numTexels=Math.ceil(o/4)}}export{e as LayoutField,r as TextureBackedBufferLayout};
5
+ import{typeToCreationInfoMap as e}from"./TextureBackedBufferFieldCreation.js";import{LayoutField as t}from"./TextureBackedBufferLayoutField.js";import{TextureBufferView as r}from"./TextureBufferView.js";const i=4,n=Uint8Array;class o{constructor(r){this._fields=new Map;let n=0;const o=[];for(let t=0;t<r.length;++t){const i=r[t],{type:s}=i,f=e[s];o.push({declaration:i,byteOffset:n,creationInfo:f}),n+=f.byteSize}n=s(n);const f=n,c=this._fields;for(const{declaration:e,byteOffset:s,creationInfo:a}of o)c.set(e.name,new t(e,s,i,a));this.byteStride=f,this.texelStride=Math.ceil(f/i)}get fields(){return this._fields}createBuffer(e){return new r(this,e,n)}createView(e){return new r(this,e,n)}}function s(e){return e+3&-4}export{o as TextureBackedBufferLayout};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
+ */
5
+ class e{constructor(e,t,r,n){this._declaration=e,this._byteOffset=t,this._creationInfo=n,this._startTexel=Math.floor(t/r);const s=n.byteSize;this._numTexels=Math.ceil((t+s)/r)-this._startTexel;let i=this._startTexel,o=t%r;const l=[],u=["x","y","z","w"];for(let a=0;a<s;++a){const e=`texel${i}.${u[o]}`;l.push(e),++o,o>=r&&(o=0,++i)}this._glslDecodeArgumentString=l.join(", ")}get name(){return this._declaration.name}get fieldType(){return this._declaration.type}get byteOffset(){return this._byteOffset}get startTexel(){return this._startTexel}get numTexels(){return this._numTexels}get elementType(){return this._creationInfo.elementType}get elementCount(){return this._creationInfo.elementCount}get glslDecodeArgumentString(){return this._glslDecodeArgumentString}get bufferViewConstructor(){return this._creationInfo.bufferViewConstructor}}export{e as LayoutField};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
+ */
5
+ class e{constructor(e,t,r){this.layout=e,this._bufferViews=new Map,this.buffer="number"==typeof t?new ArrayBuffer(t*e.byteStride):t,this.texelElementBuffer=new r(this.buffer,0);const s=this._bufferViews;for(const[n,u]of this.layout.fields)s.set(n,new u.bufferViewConstructor(this.buffer,u.byteOffset,this.layout.byteStride))}get stride(){return this.layout.byteStride}get count(){return this.buffer.byteLength/this.stride}get byteLength(){return this.buffer.byteLength}getField(e,t){const r=this._bufferViews.get(e);return null!=r&&r.elementCount===t.ElementCount&&r.elementType===t.ElementType?r:null}get usedMemory(){return this.byteLength}}export{e as TextureBufferView};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import s from"../../../../core/Collection.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../core/maybe.js";import{watch as i,when as o,initial as a,sync as n}from"../../../../core/reactiveUtils.js";import{property as h,subclass as d}from"../../../../core/accessorSupport/decorators.js";import{translate as c,fromTranslation as p,scale as w,mul as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{a as u,D as f}from"../../../../chunks/vec32.js";import{create as v,fromValues as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Sphere as V}from"../../../../geometry/support/sphere.js";import{InternalRenderCategory as g}from"../../webgl.js";import M from"../../webgl/RenderNode.js";import{ViewshedShadowMap as b}from"./ViewshedShadowMap.js";import{V as y}from"../../../../chunks/Viewshed.glsl.js";import{ViewshedTechnique as S}from"../shaders/ViewshedTechnique.js";let j=class extends M{get shadowMap(){return this._shadowMap}get hasViewsheds(){return this._viewsheds.length>0}get _contentPixelRatio(){return this.view.state.contentPixelRatio}get _viewshedsInView(){return this._viewsheds.items.filter(e=>x(this.view,e))}constructor(e){super(e),this.isDecoration=!1,this._passParameters=new y,this._viewsheds=new s,this._shadowMap=null,this.consumes={required:[g.VIEWSHED,"normals"]},this.produces=g.VIEWSHED,this.requireGeometryDepth=!0}initialize(){this._shadowMap=new b(this.fboCache),this.addHandles([i(()=>this.view.resolutionScale,e=>{const s=this._shadowMap;s&&(s.settings.textureSizeQuality=e)},a),o(()=>!this.hasViewsheds,()=>this._shadowMap?.dispose()),i(()=>this._viewshedsInView.map(e=>[e.observerRenderSpace,e.heading,e.tilt,e.farDistance,e.horizontalFieldOfView,e.verticalFieldOfView]),()=>this.requestRender(1),n)])}destroy(){this._shadowMap=r(this._shadowMap)}precompile(){if(this.hasViewsheds){this.techniques.precompile(S);for(const e of this._viewshedsInView)if(this._shadowMap?.isActive(e))return void this.view.stage.renderer.precompileViewshedShadowMap()}}render(e){const s=this.bindParameters,t=this.renderingContext,r=e.find(({name:e})=>e===g.VIEWSHED);if(!this.hasViewsheds||!s.depth||this.isDecoration&&!s.decorations)return r;this._passParameters.shadowMap=this._shadowMap??this._passParameters.shadowMap,this._passParameters.normals=e.find(({name:e})=>"normals"===e)?.getTexture();const i=this.techniques.get(S);if(!i?.compiled)return this.requestRender(1),r;const o=this.view.stage.renderer.isFeatureEnabled(7);for(const a of this._viewshedsInView){if(!this._renderShadowCubeMap(s,a,o)||!this._shadowMap?.ready)continue;const e=this._setupViewshedParameters(a,s.camera);t.bindTechnique(i,s,e),t.bindFramebuffer(r.fbo),t.screen.draw()}return this.shadowMap?.dispose(),r}updateViewsheds(e){const s=this._viewsheds,{removes:t,adds:r}=e;if(t&&(Array.isArray(t)?s.removeMany(t):s.remove(t)),r)if(Array.isArray(r)){const e=r.filter(e=>!s.includes(e));s.addMany(e)}else s.includes(r)||s.add(r)}_renderShadowCubeMap(e,s,t){const r=this._shadowMap;if(!r)return!1;const i=this.view.basemapTerrain.hasStencilEnabledExtents,o=r.start(e.camera,s,t,this._contentPixelRatio,i);return o&&r.faces.forEach(e=>this.view.stage.renderer.renderViewshedShadowMap(e)),r.finish(),o}_setupViewshedParameters(e,s){const r=this._shadowMap;if(!r)return this._passParameters;const i=this._passParameters,o=e.effectiveObserverRenderSpace;i.localOrigin=o,i.observerOffset=u(D,e.observerRenderSpace,e.effectiveObserverRenderSpace),i.fovs=[t(e.horizontalFieldOfView),t(e.verticalFieldOfView)],i.headingAndTilt=[t(e.heading),t(e.tiltParallelToSurface)],i.upVector=e.tiltedUpVector;const a=R(e.targetRenderSpace,o);i.targetVector=a;const n=new Array,h=new Array;for(let t=0;t<r.numActiveFaces;t++)c(E,r.viewshedViewMatrices[t],o),n.push(...E),P(r.viewshedProjectionMatrices[t],E,I),h.push(...I);return i.viewMatrices=n,i.projectionMatrices=h,i.volumeOffset=this.selectedViewshed?.()===e.viewshed?A(e,this.view,s.eye):0,i}get test(){return{viewsheds:this._viewsheds,shadowMap:this._shadowMap,viewshedsInView:this._viewshedsInView}}};function R(e,s){const t=v();return u(t,e,s)}function P(e,s,t){const r=_(.5,.5,.5);return p(t,r),w(t,t,r),l(t,t,e),l(t,t,s),t}function x(e,s){const t=new V(s.observerRenderSpace,s.farDistanceRenderSpace);return!!e.ready&&e.frustum.intersectsSphere(t)}function A(e,s,t){if(null==e)return 0;const{observerRenderSpace:r,targetRenderSpace:i}=e,o=f(t,r)>f(t,i)?e.observer:e.target;return s.pixelSizeAt(o)}e([h()],j.prototype,"selectedViewshed",void 0),e([h()],j.prototype,"isDecoration",void 0),e([h()],j.prototype,"shadowMap",null),e([h()],j.prototype,"hasViewsheds",null),e([h()],j.prototype,"_contentPixelRatio",null),e([h()],j.prototype,"_viewshedsInView",null),e([h()],j.prototype,"consumes",void 0),e([h()],j.prototype,"produces",void 0),j=e([d("esri.views.3d.webgl-engine.lib.Viewshed")],j);const D=v(),E=m(),I=m();export{j as Viewshed,A as computeOffsetScale};
5
+ import{__decorate as e}from"tslib";import s from"../../../../core/Collection.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../core/maybe.js";import{watch as i,when as o,initial as a,sync as n}from"../../../../core/reactiveUtils.js";import{property as h,subclass as d}from"../../../../core/accessorSupport/decorators.js";import{translate as c,fromTranslation as p,scale as w,mul as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{a as u,C as f}from"../../../../chunks/vec32.js";import{create as v,fromValues as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Sphere as V}from"../../../../geometry/support/sphere.js";import{InternalRenderCategory as g}from"../../webgl.js";import M from"../../webgl/RenderNode.js";import{ViewshedShadowMap as b}from"./ViewshedShadowMap.js";import{V as y}from"../../../../chunks/Viewshed.glsl.js";import{ViewshedTechnique as S}from"../shaders/ViewshedTechnique.js";let j=class extends M{get shadowMap(){return this._shadowMap}get hasViewsheds(){return this._viewsheds.length>0}get _contentPixelRatio(){return this.view.state.contentPixelRatio}get _viewshedsInView(){return this._viewsheds.items.filter(e=>x(this.view,e))}constructor(e){super(e),this.isDecoration=!1,this._passParameters=new y,this._viewsheds=new s,this._shadowMap=null,this.consumes={required:[g.VIEWSHED,"normals"]},this.produces=g.VIEWSHED,this.requireGeometryDepth=!0}initialize(){this._shadowMap=new b(this.fboCache),this.addHandles([i(()=>this.view.resolutionScale,e=>{const s=this._shadowMap;s&&(s.settings.textureSizeQuality=e)},a),o(()=>!this.hasViewsheds,()=>this._shadowMap?.dispose()),i(()=>this._viewshedsInView.map(e=>[e.observerRenderSpace,e.heading,e.tilt,e.farDistance,e.horizontalFieldOfView,e.verticalFieldOfView]),()=>this.requestRender(1),n)])}destroy(){this._shadowMap=r(this._shadowMap)}precompile(){if(this.hasViewsheds){this.techniques.precompile(S);for(const e of this._viewshedsInView)if(this._shadowMap?.isActive(e))return void this.view.stage.renderer.precompileViewshedShadowMap()}}render(e){const s=this.bindParameters,t=this.renderingContext,r=e.find(({name:e})=>e===g.VIEWSHED);if(!this.hasViewsheds||!s.depth||this.isDecoration&&!s.decorations)return r;this._passParameters.shadowMap=this._shadowMap??this._passParameters.shadowMap,this._passParameters.normals=e.find(({name:e})=>"normals"===e)?.getTexture();const i=this.techniques.get(S);if(!i?.compiled)return this.requestRender(1),r;const o=this.view.stage.renderer.isFeatureEnabled(7);for(const a of this._viewshedsInView){if(!this._renderShadowCubeMap(s,a,o)||!this._shadowMap?.ready)continue;const e=this._setupViewshedParameters(a,s.camera);t.bindTechnique(i,s,e),t.bindFramebuffer(r.fbo),t.screen.draw()}return this.shadowMap?.dispose(),r}updateViewsheds(e){const s=this._viewsheds,{removes:t,adds:r}=e;if(t&&(Array.isArray(t)?s.removeMany(t):s.remove(t)),r)if(Array.isArray(r)){const e=r.filter(e=>!s.includes(e));s.addMany(e)}else s.includes(r)||s.add(r)}_renderShadowCubeMap(e,s,t){const r=this._shadowMap;if(!r)return!1;const i=this.view.basemapTerrain.hasStencilEnabledExtents,o=r.start(e.camera,s,t,this._contentPixelRatio,i);return o&&r.faces.forEach(e=>this.view.stage.renderer.renderViewshedShadowMap(e)),r.finish(),o}_setupViewshedParameters(e,s){const r=this._shadowMap;if(!r)return this._passParameters;const i=this._passParameters,o=e.effectiveObserverRenderSpace;i.localOrigin=o,i.observerOffset=u(E,e.observerRenderSpace,e.effectiveObserverRenderSpace),i.fovs=[t(e.horizontalFieldOfView),t(e.verticalFieldOfView)],i.headingAndTilt=[t(e.heading),t(e.tiltParallelToSurface)],i.upVector=e.tiltedUpVector;const a=R(e.targetRenderSpace,o);i.targetVector=a;const n=new Array,h=new Array;for(let t=0;t<r.numActiveFaces;t++)c(I,r.viewshedViewMatrices[t],o),n.push(...I),P(r.viewshedProjectionMatrices[t],I,D),h.push(...D);return i.viewMatrices=n,i.projectionMatrices=h,i.volumeOffset=this.selectedViewshed?.()===e.viewshed?A(e,this.view,s.eye):0,i}get test(){return{viewsheds:this._viewsheds,shadowMap:this._shadowMap,viewshedsInView:this._viewshedsInView}}};function R(e,s){const t=v();return u(t,e,s)}function P(e,s,t){const r=_(.5,.5,.5);return p(t,r),w(t,t,r),l(t,t,e),l(t,t,s),t}function x(e,s){const t=new V(s.observerRenderSpace,s.farDistanceRenderSpace);return!!e.ready&&e.frustum.intersectsSphere(t)}function A(e,s,t){if(null==e)return 0;const{observerRenderSpace:r,targetRenderSpace:i}=e,o=f(t,r)>f(t,i)?e.observer:e.target;return s.pixelSizeAt(o)}e([h()],j.prototype,"selectedViewshed",void 0),e([h()],j.prototype,"isDecoration",void 0),e([h()],j.prototype,"shadowMap",null),e([h()],j.prototype,"hasViewsheds",null),e([h()],j.prototype,"_contentPixelRatio",null),e([h()],j.prototype,"_viewshedsInView",null),e([h()],j.prototype,"consumes",void 0),e([h()],j.prototype,"produces",void 0),j=e([d("esri.views.3d.webgl-engine.lib.Viewshed")],j);const E=v(),I=m(),D=m();export{j as Viewshed,A as computeOffsetScale};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{acosClamped as e,deg2rad as t}from"../../../../../core/mathUtils.js";import n from"../../../../../core/PooledArray.js";import{D as o,h as s,d as a,g as r,e as c,f as l,n as i,E as h}from"../../../../../chunks/vec32.js";import{create as u}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Edge as g}from"./Edge.js";const p=-1;function d(e,t,n){const c=e.vertices.position,l=e.vertices.componentIndex,i=I.position0,h=I.position1,u=I.faceNormal0,g=I.faceNormal1,{edges:d,normals:v}=w(e),x=d.length/4,y=t.allocate(x);let j=0;const N=x,D=n?.allocate(N);let E=0,b=0,F=0;V.length=0;for(let s=0;s<x;++s){const e=4*s;c.getVec(d.data[e],i),c.getVec(d.data[e+1],h);const t=V.pushNew();t.index=4*s,t.length=o(i,h)}V.sort((e,t)=>t.length-e.length);const L=new Array,U=new Array;V.forAll(({length:e,index:o})=>{const w=d.data[o],x=d.data[o+1],V=d.data[o+2],N=d.data[o+3],q=N===p;if(c.getVec(w,i),c.getVec(x,h),q){const e=3*V;s(u,v.data[e],v.data[e+1],v.data[e+2]),a(g,u),I.componentIndex=l.get(w),I.cosAngle=r(u,g)}else{let e=3*V;if(s(u,v.data[e],v.data[e+1],v.data[e+2]),e=3*N,s(g,v.data[e],v.data[e+1],v.data[e+2]),I.componentIndex=l.get(w),I.cosAngle=r(u,g),m(I,k))return;I.cosAngle<-.9999&&a(g,u)}b+=e,F++,q||f(I,P)?(t.write(y,j++,I),L.push(e)):A(I,M)&&(D&&n&&n.write(D,E++,I),U.push(e))});const q=new Float32Array(L.reverse()),z=new Float32Array(U.reverse()),B=D&&n?{instancesData:D.slice(0,E),lodInfo:{lengths:z}}:void 0;return{regular:{instancesData:y.slice(0,j),lodInfo:{lengths:q}},silhouette:B,averageEdgeLength:b/F}}function f(e,t){return e.cosAngle<t}function m(e,t){return e.cosAngle>t}function A(t,n){const o=e(t.cosAngle);h(D,t.position1,t.position0);return o*(r(l(N,t.faceNormal0,t.faceNormal1),D)>0?-1:1)>n}function w(e){const t=e.faces.length/3,n=e.faces,o=e.neighbors,s=e.vertices.position;y.length=j.length=0;for(let a=0;a<t;a++){const e=3*a,t=o[e],r=o[e+1],h=o[e+2],u=n[e],g=n[e+1],d=n[e+2];s.getVec(u,E),s.getVec(g,b),s.getVec(d,F),c(b,b,E),c(F,F,E),l(E,b,F),i(E,E),j.pushArray(E),(t===p||u<g)&&(y.push(u),y.push(g),y.push(a),y.push(t)),(r===p||g<d)&&(y.push(g),y.push(d),y.push(a),y.push(r)),(h===p||d<u)&&(y.push(d),y.push(u),y.push(a),y.push(h))}return{edges:y,normals:j}}class v{constructor(){this.index=0,this.length=0}}function x(){V.prune(),y.prune(),j.prune()}const V=new n({allocator:e=>e||new v,deallocator:null}),y=new n({deallocator:null}),j=new n({deallocator:null}),I=new g,N=u(),D=u(),E=u(),b=u(),F=u(),M=t(4),k=Math.cos(M),L=t(35),P=Math.cos(L);export{x as cleanupEdgeProcessing,d as extractEdges};
5
+ import{acosClamped as e,deg2rad as t}from"../../../../../core/mathUtils.js";import n from"../../../../../core/PooledArray.js";import{C as o,h as s,d as a,g as r,e as c,f as l,n as i,D as h}from"../../../../../chunks/vec32.js";import{create as u}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Edge as g}from"./Edge.js";const p=-1;function d(e,t,n){const c=e.vertices.position,l=e.vertices.componentIndex,i=I.position0,h=I.position1,u=I.faceNormal0,g=I.faceNormal1,{edges:d,normals:v}=w(e),x=d.length/4,y=t.allocate(x);let j=0;const N=x,D=n?.allocate(N);let b=0,E=0,F=0;V.length=0;for(let s=0;s<x;++s){const e=4*s;c.getVec(d.data[e],i),c.getVec(d.data[e+1],h);const t=V.pushNew();t.index=4*s,t.length=o(i,h)}V.sort((e,t)=>t.length-e.length);const C=new Array,P=new Array;V.forAll(({length:e,index:o})=>{const w=d.data[o],x=d.data[o+1],V=d.data[o+2],N=d.data[o+3],U=N===p;if(c.getVec(w,i),c.getVec(x,h),U){const e=3*V;s(u,v.data[e],v.data[e+1],v.data[e+2]),a(g,u),I.componentIndex=l.get(w),I.cosAngle=r(u,g)}else{let e=3*V;if(s(u,v.data[e],v.data[e+1],v.data[e+2]),e=3*N,s(g,v.data[e],v.data[e+1],v.data[e+2]),I.componentIndex=l.get(w),I.cosAngle=r(u,g),m(I,k))return;I.cosAngle<-.9999&&a(g,u)}E+=e,F++,U||f(I,L)?(t.write(y,j++,I),C.push(e)):A(I,M)&&(D&&n&&n.write(D,b++,I),P.push(e))});const U=new Float32Array(C.reverse()),q=new Float32Array(P.reverse()),z=D&&n?{instancesData:D.slice(0,b),lodInfo:{lengths:q}}:void 0;return{regular:{instancesData:y.slice(0,j),lodInfo:{lengths:U}},silhouette:z,averageEdgeLength:E/F}}function f(e,t){return e.cosAngle<t}function m(e,t){return e.cosAngle>t}function A(t,n){const o=e(t.cosAngle);h(D,t.position1,t.position0);return o*(r(l(N,t.faceNormal0,t.faceNormal1),D)>0?-1:1)>n}function w(e){const t=e.faces.length/3,n=e.faces,o=e.neighbors,s=e.vertices.position;y.length=j.length=0;for(let a=0;a<t;a++){const e=3*a,t=o[e],r=o[e+1],h=o[e+2],u=n[e],g=n[e+1],d=n[e+2];s.getVec(u,b),s.getVec(g,E),s.getVec(d,F),c(E,E,b),c(F,F,b),l(b,E,F),i(b,b),j.pushArray(b),(t===p||u<g)&&(y.push(u),y.push(g),y.push(a),y.push(t)),(r===p||g<d)&&(y.push(g),y.push(d),y.push(a),y.push(r)),(h===p||d<u)&&(y.push(d),y.push(u),y.push(a),y.push(h))}return{edges:y,normals:j}}class v{constructor(){this.index=0,this.length=0}}function x(){V.prune(),y.prune(),j.prune()}const V=new n({allocator:e=>e||new v,deallocator:null}),y=new n({deallocator:null}),j=new n({deallocator:null}),I=new g,N=u(),D=u(),b=u(),E=u(),F=u(),M=t(4),k=Math.cos(M),C=t(35),L=Math.cos(C);export{x as cleanupEdgeProcessing,d as extractEdges};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{h as t,i as e,j as n,H as r}from"../../../../chunks/vec32.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{areaPoints3d as s}from"../../../../geometry/support/triangle.js";function i(r,o){if(!r)return!1;const{size:i,data:c,indices:f}=r;t(o,0,0,0),t(m,0,0,0);let d=0,g=0;for(let p=0;p<f.length-2;p+=3){const r=f[p]*i,h=f[p+1]*i,j=f[p+2]*i;t(a,c[r],c[r+1],c[r+2]),t(l,c[h],c[h+1],c[h+2]),t(u,c[j],c[j+1],c[j+2]);const z=s(a,l,u);z?(e(a,a,l),e(a,a,u),n(a,a,1/3*z),e(o,o,a),d+=z):(e(m,m,a),e(m,m,l),e(m,m,u),g+=3)}return(0!==g||0!==d)&&(0!==d?(n(o,o,1/d),!0):0!==g&&(n(o,m,1/g),!0))}function c(e,r){if(!e)return!1;const{size:o,data:s,indices:i}=e;t(r,0,0,0);let c=-1,f=0;for(let t=0;t<i.length;t++){const e=i[t]*o;c!==e&&(r[0]+=s[e],r[1]+=s[e+1],r[2]+=s[e+2],f++),c=e}return f>1&&n(r,r,1/f),f>0}function f(o,s,i){if(!o)return!1;t(i,0,0,0),t(m,0,0,0);let c=0,f=0;const{size:u,data:d,indices:g}=o,p=g.length-1,h=p+(s?2:0);for(let t=0;t<h;t+=2){const o=t<p?t+1:0,s=g[t<p?t:p]*u,h=g[o]*u;a[0]=d[s],a[1]=d[s+1],a[2]=d[s+2],l[0]=d[h],l[1]=d[h+1],l[2]=d[h+2],n(a,e(a,a,l),.5);const j=r(a,l);j>0?(e(i,i,n(a,a,j)),c+=j):0===c&&(e(m,m,a),f++)}return 0!==c?(n(i,i,1/c),!0):0!==f&&(n(i,m,1/f),!0)}const a=o(),l=o(),u=o(),m=o();export{f as computeAttachmentOriginLines,c as computeAttachmentOriginPoints,i as computeAttachmentOriginTriangles};
5
+ import{h as t,i as e,j as n,G as r}from"../../../../chunks/vec32.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{areaPoints3d as s}from"../../../../geometry/support/triangle.js";function i(r,o){if(!r)return!1;const{size:i,data:c,indices:f}=r;t(o,0,0,0),t(m,0,0,0);let d=0,g=0;for(let p=0;p<f.length-2;p+=3){const r=f[p]*i,h=f[p+1]*i,j=f[p+2]*i;t(a,c[r],c[r+1],c[r+2]),t(l,c[h],c[h+1],c[h+2]),t(u,c[j],c[j+1],c[j+2]);const z=s(a,l,u);z?(e(a,a,l),e(a,a,u),n(a,a,1/3*z),e(o,o,a),d+=z):(e(m,m,a),e(m,m,l),e(m,m,u),g+=3)}return(0!==g||0!==d)&&(0!==d?(n(o,o,1/d),!0):0!==g&&(n(o,m,1/g),!0))}function c(e,r){if(!e)return!1;const{size:o,data:s,indices:i}=e;t(r,0,0,0);let c=-1,f=0;for(let t=0;t<i.length;t++){const e=i[t]*o;c!==e&&(r[0]+=s[e],r[1]+=s[e+1],r[2]+=s[e+2],f++),c=e}return f>1&&n(r,r,1/f),f>0}function f(o,s,i){if(!o)return!1;t(i,0,0,0),t(m,0,0,0);let c=0,f=0;const{size:u,data:d,indices:g}=o,p=g.length-1,h=p+(s?2:0);for(let t=0;t<h;t+=2){const o=t<p?t+1:0,s=g[t<p?t:p]*u,h=g[o]*u;a[0]=d[s],a[1]=d[s+1],a[2]=d[s+2],l[0]=d[h],l[1]=d[h+1],l[2]=d[h+2],n(a,e(a,a,l),.5);const j=r(a,l);j>0?(e(i,i,n(a,a,j)),c+=j):0===c&&(e(m,m,a),f++)}return 0!==c?(n(i,i,1/c),!0):0!==f&&(n(i,m,1/f),!0)}const a=o(),l=o(),u=o(),m=o();export{f as computeAttachmentOriginLines,c as computeAttachmentOriginPoints,i as computeAttachmentOriginTriangles};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{g as n,a as t,f as r,n as o,c,H as s,B as u}from"../../../../chunks/vec32.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";function i(t,r,o){const c=n(t,r)-o;return Math.abs(c)<=1e-5}function a(n,c,s){const u=e(),i=e();t(i,c,n);const a=e();return t(a,s,n),r(u,i,a),o(u,u),u}function f(r,s,u,f){const m=[s,u,f],h=a(s,u,f);if(!i(r,h,n(m[0],h)))return!1;for(let i=0;i<3;++i){const r=m[i],s=m[(i+1)%3],u=m[(i+2)%3],a=e();t(a,s,r),o(a,a);const f=e();t(f,u,r);const h=n(f,a),l=e();c(l,r,a,h);const M=e();t(M,u,l),o(M,M);const x=n(r,M);if(!(n(M,l)-x>=-1e-4))return!1}return!0}function m(n){const c=e();t(c,n[1],n[0]),o(c,c);const s=e();t(s,n[2],n[0]),o(s,s);const u=e();return r(u,c,s),o(u,u),u}function h(r,s,u){const i=e();t(i,u,s),o(i,i);const a=e();t(a,r,s);const f=n(a,i),m=e();return c(m,s,i,f),m}function l(n,t,r){const o=h(n,t,r);return s(o,n)}function M(r,i,a){const f=e();t(f,a,i);const m=u(f);o(f,f);const h=e();t(h,r,i);const l=n(h,f);if(l<0)return s(i,r);if(l>m)return s(a,r);const M=e();c(M,i,f,l);return s(M,r)}function x(t,r,o){return n(t,r)-o}function y(c,s,u){const i=e(),a=e();t(a,s,c);const f=e();t(f,u,c),r(i,a,f),o(i,i);return{normal:i,d:n(i,c)}}function A(n,t,r,o){const{normal:s,d:u}=y(t,r,o),i=x(n,s,u),a=e();return c(a,n,s,-i),f(a,t,r,o)?i:Math.min(M(n,t,r),M(n,r,o),M(n,o,t))}function g(r,o,s){const u=e();t(u,o,r);const i=m(s),a=n(i,s[0]),h=n(i,r)-a,l=n(i,o)-a;if(h*l>0)return 1/0;const M=e();return c(M,r,u,(0-h)/(l-h)),f(M,s[0],s[1],s[2])?0:A(M,s[0],s[1],s[2])}function p(n,t){const r=n.length;if(0===r)return 0;if(t<n[0])return-1;if(t>=n[r-1])return r;let o=0,c=r-1;for(;c-o>1;){const r=Math.floor(.5*(c+o));t>=n[r]?o=r:c=r}return o}function w(n,t,r,o,c,s,u){const e=s-u,i=t-n,a=new Float64Array(4*i);for(let f=0;f<i;++f){const t=3*(f+n),s=c*r[t+0],i=o[s+0],m=o[s+1],h=e/(o[s+2]-u),l=i*h,M=m*h,x=c*r[t+1],y=o[x+0],A=o[x+1],g=e/(o[x+2]-u),p=y*g,w=A*g,U=c*r[t+2],b=o[U+0],d=o[U+1],j=e/(o[U+2]-u),v=b*j,F=d*j,k=4*f;a[k+0]=Math.min(l,p,v),a[k+1]=Math.min(M,w,F),a[k+2]=Math.max(l,p,v),a[k+3]=Math.max(M,w,F)}return a}function U(n,t,r,o,c){const s=t-n,u=new Float64Array(4*s);for(let e=0;e<s;++e){const t=3*(e+n),s=c*r[t+0],i=o[s+0],a=o[s+1],f=c*r[t+1],m=o[f+0],h=o[f+1],l=c*r[t+2],M=o[l+0],x=o[l+1],y=4*e;u[y+0]=Math.min(i,m,M),u[y+1]=Math.min(a,h,x),u[y+2]=Math.max(i,m,M),u[y+3]=Math.max(a,h,x)}return u}function b(n,t){return new(d(n))(t)}function d(n){return n<128?Uint8Array:n<32768?Uint16Array:n<1<<31?Uint32Array:Array}function j(n,t){n[2]+=t}function v(n,t,r,o){const[c,s,u]=o??n,e=u-r,i=t/Math.sqrt(c*c+s*s+e*e);n[0]+=c*i,n[1]+=s*i,n[2]+=e*i}export{p as binarySearchSortedArray,m as calculateNormalFromVertices,b as createUintArray,l as distancePointLine,x as distancePointPlane,M as distancePointSegment,A as distancePointTriangle,v as elevationAlignVertexGlobal,j as elevationAlignVertexLocal,w as generateTriangleAabbsGlobal,U as generateTriangleAabbsLocal,d as getConstructorForValueCount,h as getNearestPointOnLine,g as getRayTriangleIntersectionDistance,a as getTriangleNormal,y as getTrianglePlane,i as isPointInPlane,f as isPointInTriangle};
5
+ import{g as n,a as t,f as r,n as o,c,G as s,H as u}from"../../../../chunks/vec32.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";function i(t,r,o){const c=n(t,r)-o;return Math.abs(c)<=1e-5}function a(n,c,s){const u=e(),i=e();t(i,c,n);const a=e();return t(a,s,n),r(u,i,a),o(u,u),u}function f(r,s,u,f){const m=[s,u,f],h=a(s,u,f);if(!i(r,h,n(m[0],h)))return!1;for(let i=0;i<3;++i){const r=m[i],s=m[(i+1)%3],u=m[(i+2)%3],a=e();t(a,s,r),o(a,a);const f=e();t(f,u,r);const h=n(f,a),l=e();c(l,r,a,h);const M=e();t(M,u,l),o(M,M);const x=n(r,M);if(!(n(M,l)-x>=-1e-4))return!1}return!0}function m(n){const c=e();t(c,n[1],n[0]),o(c,c);const s=e();t(s,n[2],n[0]),o(s,s);const u=e();return r(u,c,s),o(u,u),u}function h(r,s,u){const i=e();t(i,u,s),o(i,i);const a=e();t(a,r,s);const f=n(a,i),m=e();return c(m,s,i,f),m}function l(n,t,r){const o=h(n,t,r);return s(o,n)}function M(r,i,a){const f=e();t(f,a,i);const m=u(f);o(f,f);const h=e();t(h,r,i);const l=n(h,f);if(l<0)return s(i,r);if(l>m)return s(a,r);const M=e();c(M,i,f,l);return s(M,r)}function x(t,r,o){return n(t,r)-o}function y(c,s,u){const i=e(),a=e();t(a,s,c);const f=e();t(f,u,c),r(i,a,f),o(i,i);return{normal:i,d:n(i,c)}}function A(n,t,r,o){const{normal:s,d:u}=y(t,r,o),i=x(n,s,u),a=e();return c(a,n,s,-i),f(a,t,r,o)?i:Math.min(M(n,t,r),M(n,r,o),M(n,o,t))}function g(r,o,s){const u=e();t(u,o,r);const i=m(s),a=n(i,s[0]),h=n(i,r)-a,l=n(i,o)-a;if(h*l>0)return 1/0;const M=e();return c(M,r,u,(0-h)/(l-h)),f(M,s[0],s[1],s[2])?0:A(M,s[0],s[1],s[2])}function p(n,t){const r=n.length;if(0===r)return 0;if(t<n[0])return-1;if(t>=n[r-1])return r;let o=0,c=r-1;for(;c-o>1;){const r=Math.floor(.5*(c+o));t>=n[r]?o=r:c=r}return o}function w(n,t,r,o,c,s,u){const e=s-u,i=t-n,a=new Float64Array(4*i);for(let f=0;f<i;++f){const t=3*(f+n),s=c*r[t+0],i=o[s+0],m=o[s+1],h=e/(o[s+2]-u),l=i*h,M=m*h,x=c*r[t+1],y=o[x+0],A=o[x+1],g=e/(o[x+2]-u),p=y*g,w=A*g,U=c*r[t+2],b=o[U+0],d=o[U+1],j=e/(o[U+2]-u),v=b*j,F=d*j,k=4*f;a[k+0]=Math.min(l,p,v),a[k+1]=Math.min(M,w,F),a[k+2]=Math.max(l,p,v),a[k+3]=Math.max(M,w,F)}return a}function U(n,t,r,o,c){const s=t-n,u=new Float64Array(4*s);for(let e=0;e<s;++e){const t=3*(e+n),s=c*r[t+0],i=o[s+0],a=o[s+1],f=c*r[t+1],m=o[f+0],h=o[f+1],l=c*r[t+2],M=o[l+0],x=o[l+1],y=4*e;u[y+0]=Math.min(i,m,M),u[y+1]=Math.min(a,h,x),u[y+2]=Math.max(i,m,M),u[y+3]=Math.max(a,h,x)}return u}function b(n,t){return new(d(n))(t)}function d(n){return n<128?Uint8Array:n<32768?Uint16Array:n<1<<31?Uint32Array:Array}function j(n,t){n[2]+=t}function v(n,t,r,o){const[c,s,u]=o??n,e=u-r,i=t/Math.sqrt(c*c+s*s+e*e);n[0]+=c*i,n[1]+=s*i,n[2]+=e*i}export{p as binarySearchSortedArray,m as calculateNormalFromVertices,b as createUintArray,l as distancePointLine,x as distancePointPlane,M as distancePointSegment,A as distancePointTriangle,v as elevationAlignVertexGlobal,j as elevationAlignVertexLocal,w as generateTriangleAabbsGlobal,U as generateTriangleAabbsLocal,d as getConstructorForValueCount,h as getNearestPointOnLine,g as getRayTriangleIntersectionDistance,a as getTriangleNormal,y as getTrianglePlane,i as isPointInPlane,f as isPointInTriangle};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as e}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{MaterialParameters as s}from"../lib/Material.js";import{DefaultBufferWriter as o}from"./DefaultBufferWriter.js";import{PositionUvLayout as a}from"./DefaultLayouts.js";import{TriangleMaterial as n}from"./TriangleMaterial.js";import{CheckerBoardTechnique as h}from"../shaders/CheckerBoardTechnique.js";import{CheckerBoardTechniqueConfiguration as p}from"../shaders/CheckerBoardTechniqueConfiguration.js";import{alphaCutoff as f}from"../../../../webscene/support/AlphaCutoff.js";class c extends n{constructor(r){super(r,l),this._configuration=new p,this.produces=new Map([[2,r=>e(r)&&!this.transparent],[4,r=>e(r)&&this.transparent&&this.parameters.writeDepth],[8,r=>e(r)&&this.transparent&&!this.parameters.writeDepth]])}getConfiguration(r,t){return super.getConfiguration(r,t,this._configuration),this._configuration.transparent=this.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}get visible(){return this.parameters.color1[3]>=f||this.parameters.color2[3]>=f}get transparent(){return this.parameters.color1[3]<1||this.parameters.color2[3]<1}createGLMaterial(r){return new u(r)}createBufferWriter(){return new o(a)}}class u extends i{beginSlot(r){return this.getTechnique(h,r)}}class l extends s{constructor(){super(...arguments),this.size=r(1,1),this.color1=t(.75,.75,.75,1),this.color2=t(.5,.5,.5,1),this.writeDepth=!0,this.polygonOffset=!1}}export{c as CheckerBoardMaterial,l as Parameters};
5
+ import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as e}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{MaterialParameters as s}from"../lib/Material.js";import{DefaultBufferWriter as o}from"./DefaultBufferWriter.js";import{PositionUvLayout as a}from"./DefaultLayouts.js";import{TriangleMaterial as n}from"./TriangleMaterial.js";import{CheckerBoardTechnique as h}from"../shaders/CheckerBoardTechnique.js";import{CheckerBoardTechniqueConfiguration as p}from"../shaders/CheckerBoardTechniqueConfiguration.js";import{alphaCutoff as f}from"../../../../webscene/support/AlphaCutoff.js";class c extends n{constructor(r){super(r,l),this._configuration=new p,this.produces=new Map([[2,r=>e(r)&&!this.transparent],[4,r=>e(r)&&this.transparent&&this.parameters.writeDepth],[9,r=>e(r)&&this.transparent&&!this.parameters.writeDepth]])}getConfiguration(r,t){return super.getConfiguration(r,t,this._configuration),this._configuration.transparent=this.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}get visible(){return this.parameters.color1[3]>=f||this.parameters.color2[3]>=f}get transparent(){return this.parameters.color1[3]<1||this.parameters.color2[3]<1}createGLMaterial(r){return new u(r)}createBufferWriter(){return new o(a)}}class u extends i{beginSlot(r){return this.getTechnique(h,r)}}class l extends s{constructor(){super(...arguments),this.size=r(1,1),this.color1=t(.75,.75,.75,1),this.color2=t(.5,.5,.5,1),this.writeDepth=!0,this.polygonOffset=!1}}export{c as CheckerBoardMaterial,l as Parameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColorOrOID as r,isDepth as e,is2DGeometryOutput as s,isColor as i}from"../core/shaderLibrary/ShaderOutput.js";import a from"../lib/GLMaterial.js";import{DefaultBufferWriter as o}from"./DefaultBufferWriter.js";import{TriangleMaterial as n}from"./TriangleMaterial.js";import{VisualVariablePassParameters as h}from"./VisualVariablePassParameters.js";import{getLayout as p,ColorMaterialTechnique as u}from"../shaders/ColorMaterialTechnique.js";import{ColorMaterialTechniqueConfiguration as c}from"../shaders/ColorMaterialTechniqueConfiguration.js";import{alphaCutoff as l}from"../../../../webscene/support/AlphaCutoff.js";class f extends n{constructor(t){super(t,g),this._configuration=new c,this.supportsEdges=!0,this.produces=new Map([[2,t=>this._isOpaqueMaterialPass(t)],[3,t=>this._isOpaqueNoSSAODepthPass(t)],[4,t=>r(t)&&this._transparent&&this.parameters.writeDepth],[5,t=>e(t)&&this._transparent&&this.parameters.writeDepth],[8,t=>r(t)&&this._transparent&&!this.parameters.writeDepth],[18,t=>s(t)]])}getConfiguration(t,r){return super.getConfiguration(t,r,this._configuration),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this._transparent,this._configuration.discardInvisibleFragments=this._transparent&&!this._isOpaquePass(t)&&this.parameters.discardInvisibleFragments,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=r.hasOccludees,this._configuration.oitPass=r.oitPass,this._configuration.enableOffset=r.enableOffset,this._configuration.terrainDepthTest=r.terrainDepthTest&&i(t),this._configuration.cullAboveTerrain=r.cullAboveTerrain,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration.draped=this.parameters.draped,this._configuration}get visible(){return this.parameters.color[3]>=l}get _transparent(){return this.parameters.color[3]<1||this.parameters.forceTransparentMode}_isOpaquePass(t){return this._isOpaqueMaterialPass(t)||this._isOpaqueNoSSAODepthPass(t)}_isOpaqueMaterialPass(t){return 8===t||r(t)&&!this._transparent}_isOpaqueNoSSAODepthPass(t){return e(t)&&this.parameters.writeDepth&&!this._transparent}createGLMaterial(t){return new m(t)}createBufferWriter(){return new o(p(this.parameters))}}class m extends a{beginSlot(t){return this.getTechnique(u,t)}}class g extends h{constructor(){super(...arguments),this.color=t,this.forceTransparentMode=!1,this.writeDepth=!0,this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=0,this.draped=!1,this.discardInvisibleFragments=!1}}export{f as ColorMaterial,g as Parameters};
5
+ import{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColorOrOID as r,isDepth as e,is2DGeometryOutput as s,isColor as i}from"../core/shaderLibrary/ShaderOutput.js";import a from"../lib/GLMaterial.js";import{DefaultBufferWriter as o}from"./DefaultBufferWriter.js";import{TriangleMaterial as n}from"./TriangleMaterial.js";import{VisualVariablePassParameters as h}from"./VisualVariablePassParameters.js";import{getLayout as p,ColorMaterialTechnique as u}from"../shaders/ColorMaterialTechnique.js";import{ColorMaterialTechniqueConfiguration as c}from"../shaders/ColorMaterialTechniqueConfiguration.js";import{alphaCutoff as l}from"../../../../webscene/support/AlphaCutoff.js";class f extends n{constructor(t){super(t,g),this._configuration=new c,this.supportsEdges=!0,this.produces=new Map([[2,t=>this._isOpaqueMaterialPass(t)],[3,t=>this._isOpaqueNoSSAODepthPass(t)],[4,t=>r(t)&&this._transparent&&this.parameters.writeDepth],[5,t=>e(t)&&this._transparent&&this.parameters.writeDepth],[9,t=>r(t)&&this._transparent&&!this.parameters.writeDepth],[19,t=>s(t)]])}getConfiguration(t,r){return super.getConfiguration(t,r,this._configuration),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this._transparent,this._configuration.discardInvisibleFragments=this._transparent&&!this._isOpaquePass(t)&&this.parameters.discardInvisibleFragments,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=r.hasOccludees,this._configuration.oitPass=r.oitPass,this._configuration.enableOffset=r.enableOffset,this._configuration.terrainDepthTest=r.terrainDepthTest&&i(t),this._configuration.cullAboveTerrain=r.cullAboveTerrain,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration.draped=this.parameters.draped,this._configuration}get visible(){return this.parameters.color[3]>=l}get _transparent(){return this.parameters.color[3]<1||this.parameters.forceTransparentMode}_isOpaquePass(t){return this._isOpaqueMaterialPass(t)||this._isOpaqueNoSSAODepthPass(t)}_isOpaqueMaterialPass(t){return 8===t||r(t)&&!this._transparent}_isOpaqueNoSSAODepthPass(t){return e(t)&&this.parameters.writeDepth&&!this._transparent}createGLMaterial(t){return new m(t)}createBufferWriter(){return new o(p(this.parameters))}}class m extends a{beginSlot(t){return this.getTechnique(u,t)}}class g extends h{constructor(){super(...arguments),this.color=t,this.forceTransparentMode=!1,this.writeDepth=!0,this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=0,this.draped=!1,this.discardInvisibleFragments=!1}}export{f as ColorMaterial,g as Parameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{m as e,h as r,d as t,n as s,e as a,b as i,j as o,g as n,t as l}from"../../../../chunks/vec32.js";import{ZEROS as u,create as c,fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{is3DGeometryOutputMRT as m,isShadowLikeOutput as p,isColor as d}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as f}from"../lib/GLTextureMaterial.js";import{Material as T}from"../lib/Material.js";import{intersectTriangleGeometry as x}from"../lib/RayIntersections.js";import{getVerticalOffsetObject3D as g}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as v}from"./DefaultBufferWriter.js";import{verticalOffsetAtDistance as S}from"./internal/MaterialUtil.js";import{getLayout as b,DefaultMaterialPassParameters as M,DefaultMaterialTechnique as O}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as C}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as w}from"../shaders/RealisticTreeTechnique.js";import{alphaCutoff as R}from"../../../../webscene/support/AlphaCutoff.js";class y extends T{constructor(e,r){super(e,D),this.materialType="default",this.supportsEdges=!0,this.intersectDraped=void 0,this.produces=new Map([[2,e=>(m(e)||p(e))&&!this.transparent],[4,e=>(m(e)||p(e))&&this.transparent&&this.parameters.writeDepth],[8,e=>(m(e)||p(e))&&this.transparent&&!this.parameters.writeDepth]]),this._layout=b(this.parameters),this._configuration=new C(r.spherical)}isVisibleForOutput(e){return 3!==e&&5!==e&&4!==e||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:r,opacity:t,externalColor:s}=this.parameters;return e*("replace"===r?1:t)*("ignore"===r||isNaN(s[3])?1:s[3])>=R}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveBaseColor,u)}get hasEmissions(){return this.parameters.emissiveStrength>0&&(0===this.parameters.emissiveSource&&this._hasEmissiveBase||1===this.parameters.emissiveSource)}getConfiguration(e,r){const{parameters:t,_configuration:s}=this,{treeRendering:a,doubleSided:i,doubleSidedType:o}=t;return super.getConfiguration(e,r,this._configuration),s.hasNormalTexture=t.hasNormalTexture,s.hasColorTexture=t.hasColorTexture,s.hasMetallicRoughnessTexture=t.hasMetallicRoughnessTexture,s.hasOcclusionTexture=t.hasOcclusionTexture,s.hasVertexTangents=!a&&t.hasVertexTangents,s.instanced=t.instanced,s.instancedDoublePrecision=t.instancedDoublePrecision,s.hasVVColor=!!t.vvColor,s.hasVVSize=!!t.vvSize,s.hasVerticalOffset=null!=t.verticalOffset,s.hasScreenSizePerspective=null!=t.screenSizePerspective,s.hasSlicePlane=t.hasSlicePlane,s.alphaDiscardMode=t.textureAlphaMode,s.normalType=a?0:t.normalType,s.transparent=this.transparent,s.writeDepth=t.writeDepth,s.customDepthTest=t.customDepthTest??0,s.hasOccludees=r.hasOccludees,s.cullFace=t.hasSlicePlane?0:t.cullFace,s.cullAboveTerrain=r.cullAboveTerrain,s.hasModelTransformation=!a&&null!=t.modelTransformation,s.hasVertexColors=t.hasVertexColors,s.hasSymbolColors=t.hasSymbolColors,s.doubleSidedMode=a?2:i&&"normal"===o?1:i&&"winding-order"===o?2:0,s.instancedFeatureAttribute=t.instancedFeatureAttribute,s.instancedColor=t.instancedColor,d(e)?(s.terrainDepthTest=r.terrainDepthTest,s.receiveShadows=t.receiveShadows,s.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&null!=r.ssao):(s.terrainDepthTest=!1,s.receiveShadows=s.receiveAmbientOcclusion=!1),s.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,s.pbrMode=t.usePBR?t.isSchematic?2:1:0,s.emissionSource=t.emissionSource,s.offsetBackfaces=!(!this.transparent||!t.offsetTransparentBackfaces),s.oitPass=r.oitPass,s.enableOffset=r.enableOffset,s.snowCover=r.snowCover>0,s.hasColorTextureTransform=!!t.colorTextureTransformMatrix,s.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,s.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,s.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,s.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix,s}intersect(e,u,c,h,m,p){if(null!=this.parameters.verticalOffset){const e=c.camera;r(N,u[12],u[13],u[14]);let p=null;switch(c.viewingMode){case 1:p=s(I,N);break;case 2:p=t(I,B)}let d=0;const f=a(z,N,e.eye),T=i(f),x=o(f,f,1/T);let g=null;this.parameters.screenSizePerspective&&(g=n(p,x)),d+=S(e,T,this.parameters.verticalOffset,g??0,this.parameters.screenSizePerspective,null),o(p,p,d),l(_,p,c.transform.inverseRotation),h=a(A,h,_),m=a(V,m,_)}x(e,c,h,m,g(c.verticalOffset),p)}createGLMaterial(e){return new P(e)}createBufferWriter(){return new v(this._layout)}get transparent(){return j(this.parameters)}}class P extends f{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const t=this._material.parameters;this.updateTexture(t.textureId);const s=e.camera.viewInverseTransposeMatrix;return r(t.origin,s[3],s[7],s[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?w:O,e)}}class D extends M{constructor(){super(...arguments),this.treeRendering=!1,this.hasVertexTangents=!1}get hasNormalTexture(){return!this.treeRendering&&!!this.normalTextureId}get hasColorTexture(){return!!this.textureId}get hasMetallicRoughnessTexture(){return!this.treeRendering&&!!this.metallicRoughnessTextureId}get hasOcclusionTexture(){return!this.treeRendering&&!!this.occlusionTextureId}get emissionSource(){return this.treeRendering?0:null!=this.emissiveTextureId&&0===this.emissiveSource?3:this.usePBR?0===this.emissiveSource?2:1:0}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}}function j(e){const{drivenOpacity:r,opacity:t,externalColor:s,layerOpacity:a,texture:i,textureId:o,textureAlphaMode:n,colorMixMode:l}=e,u=s[3];return r||t<1&&"replace"!==l||u<1&&"ignore"!==l||a<1||(null!=i||null!=o)&&1!==n&&2!==n&&"replace"!==l}const A=c(),V=c(),B=h(0,0,1),I=c(),_=c(),N=c(),z=c();export{P as DefaultGLMaterial,y as DefaultMaterial,D as DefaultMaterialParameters,j as isTransparent};
5
+ import{m as e,h as r,d as t,n as s,e as a,b as i,j as o,g as n,t as l}from"../../../../chunks/vec32.js";import{ZEROS as u,create as c,fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{is3DGeometryOutputMRT as m,isShadowLikeOutput as p,isColor as d}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as f}from"../lib/GLTextureMaterial.js";import{Material as T}from"../lib/Material.js";import{intersectTriangleGeometry as x}from"../lib/RayIntersections.js";import{getVerticalOffsetObject3D as g}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as v}from"./DefaultBufferWriter.js";import{verticalOffsetAtDistance as S}from"./internal/MaterialUtil.js";import{getLayout as b,DefaultMaterialPassParameters as M,DefaultMaterialTechnique as O}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as C}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as w}from"../shaders/RealisticTreeTechnique.js";import{alphaCutoff as R}from"../../../../webscene/support/AlphaCutoff.js";class y extends T{constructor(e,r){super(e,D),this.materialType="default",this.supportsEdges=!0,this.intersectDraped=void 0,this.produces=new Map([[2,e=>(m(e)||p(e))&&!this.transparent],[4,e=>(m(e)||p(e))&&this.transparent&&this.parameters.writeDepth],[9,e=>(m(e)||p(e))&&this.transparent&&!this.parameters.writeDepth]]),this._layout=b(this.parameters),this._configuration=new C(r.spherical)}isVisibleForOutput(e){return 3!==e&&5!==e&&4!==e||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:r,opacity:t,externalColor:s}=this.parameters;return e*("replace"===r?1:t)*("ignore"===r||isNaN(s[3])?1:s[3])>=R}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveBaseColor,u)}get hasEmissions(){return this.parameters.emissiveStrength>0&&(0===this.parameters.emissiveSource&&this._hasEmissiveBase||1===this.parameters.emissiveSource)}getConfiguration(e,r){const{parameters:t,_configuration:s}=this,{treeRendering:a,doubleSided:i,doubleSidedType:o}=t;return super.getConfiguration(e,r,this._configuration),s.hasNormalTexture=t.hasNormalTexture,s.hasColorTexture=t.hasColorTexture,s.hasMetallicRoughnessTexture=t.hasMetallicRoughnessTexture,s.hasOcclusionTexture=t.hasOcclusionTexture,s.hasVertexTangents=!a&&t.hasVertexTangents,s.instanced=t.instanced,s.instancedDoublePrecision=t.instancedDoublePrecision,s.hasVVColor=!!t.vvColor,s.hasVVSize=!!t.vvSize,s.hasVerticalOffset=null!=t.verticalOffset,s.hasScreenSizePerspective=null!=t.screenSizePerspective,s.hasSlicePlane=t.hasSlicePlane,s.alphaDiscardMode=t.textureAlphaMode,s.normalType=a?0:t.normalType,s.transparent=this.transparent,s.writeDepth=t.writeDepth,s.customDepthTest=t.customDepthTest??0,s.hasOccludees=r.hasOccludees,s.cullFace=t.hasSlicePlane?0:t.cullFace,s.cullAboveTerrain=r.cullAboveTerrain,s.hasModelTransformation=!a&&null!=t.modelTransformation,s.hasVertexColors=t.hasVertexColors,s.hasSymbolColors=t.hasSymbolColors,s.doubleSidedMode=a?2:i&&"normal"===o?1:i&&"winding-order"===o?2:0,s.instancedFeatureAttribute=t.instancedFeatureAttribute,s.instancedColor=t.instancedColor,d(e)?(s.terrainDepthTest=r.terrainDepthTest,s.receiveShadows=t.receiveShadows,s.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&null!=r.ssao):(s.terrainDepthTest=!1,s.receiveShadows=s.receiveAmbientOcclusion=!1),s.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,s.pbrMode=t.usePBR?t.isSchematic?2:1:0,s.emissionSource=t.emissionSource,s.offsetBackfaces=!(!this.transparent||!t.offsetTransparentBackfaces),s.oitPass=r.oitPass,s.enableOffset=r.enableOffset,s.snowCover=r.snowCover>0,s.hasColorTextureTransform=!!t.colorTextureTransformMatrix,s.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,s.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,s.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,s.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix,s}intersect(e,u,c,h,m,p){if(null!=this.parameters.verticalOffset){const e=c.camera;r(N,u[12],u[13],u[14]);let p=null;switch(c.viewingMode){case 1:p=s(I,N);break;case 2:p=t(I,B)}let d=0;const f=a(z,N,e.eye),T=i(f),x=o(f,f,1/T);let g=null;this.parameters.screenSizePerspective&&(g=n(p,x)),d+=S(e,T,this.parameters.verticalOffset,g??0,this.parameters.screenSizePerspective,null),o(p,p,d),l(_,p,c.transform.inverseRotation),h=a(A,h,_),m=a(V,m,_)}x(e,c,h,m,g(c.verticalOffset),p)}createGLMaterial(e){return new P(e)}createBufferWriter(){return new v(this._layout)}get transparent(){return j(this.parameters)}}class P extends f{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const t=this._material.parameters;this.updateTexture(t.textureId);const s=e.camera.viewInverseTransposeMatrix;return r(t.origin,s[3],s[7],s[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?w:O,e)}}class D extends M{constructor(){super(...arguments),this.treeRendering=!1,this.hasVertexTangents=!1}get hasNormalTexture(){return!this.treeRendering&&!!this.normalTextureId}get hasColorTexture(){return!!this.textureId}get hasMetallicRoughnessTexture(){return!this.treeRendering&&!!this.metallicRoughnessTextureId}get hasOcclusionTexture(){return!this.treeRendering&&!!this.occlusionTextureId}get emissionSource(){return this.treeRendering?0:null!=this.emissiveTextureId&&0===this.emissiveSource?3:this.usePBR?0===this.emissiveSource?2:1:0}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}}function j(e){const{drivenOpacity:r,opacity:t,externalColor:s,layerOpacity:a,texture:i,textureId:o,textureAlphaMode:n,colorMixMode:l}=e,u=s[3];return r||t<1&&"replace"!==l||u<1&&"ignore"!==l||a<1||(null!=i||null!=o)&&1!==n&&2!==n&&"replace"!==l}const A=c(),V=c(),B=h(0,0,1),I=c(),_=c(),N=c(),z=c();export{P as DefaultGLMaterial,y as DefaultMaterial,D as DefaultMaterialParameters,j as isTransparent};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{InstancedDoubleConfiguration as i}from"../core/shaderLibrary/attributes/InstancedDoubleConfiguration.js";import{parameter as e}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";class o extends i{constructor(){super(...arguments),this.oitPass=0,this.hasSlicePlane=!1,this.hasHighlightMixTexture=!1,this.bindType=1,this.instanced=!1,this.writeDepth=!0}}t([e({count:3})],o.prototype,"oitPass",void 0),t([e()],o.prototype,"hasSlicePlane",void 0),t([e()],o.prototype,"hasHighlightMixTexture",void 0);export{o as DefaultTechniqueConfiguration};
5
+ import{__decorate as t}from"tslib";import{InstancedDoubleConfiguration as i}from"../core/shaderLibrary/attributes/InstancedDoubleConfiguration.js";import{parameter as e}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";class o extends i{constructor(){super(...arguments),this.oitPass=0,this.hasSlicePlane=!1,this.hasHighlightMixTexture=!1,this.bindType=1,this.instanced=!1,this.writeDepth=!0,this.oitPremultipliedAlpha=!1}}t([e({count:3})],o.prototype,"oitPass",void 0),t([e()],o.prototype,"hasSlicePlane",void 0),t([e()],o.prototype,"hasHighlightMixTexture",void 0);export{o as DefaultTechniqueConfiguration};