@arcgis/core 4.25.0-next.20220718 → 4.25.0-next.20220721

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 (284) hide show
  1. package/Camera.js +1 -1
  2. package/analysis/DimensioningAnalysis.js +1 -1
  3. package/analysis/LineOfSightAnalysis.js +1 -1
  4. package/analysis/SliceAnalysis.js +1 -1
  5. package/arcade/featureset/support/RecentlyUsedCache.js +1 -1
  6. package/arcade/functions/featuresetgeom.js +1 -1
  7. package/assets/esri/core/workers/RemoteClient.js +1 -1
  8. package/assets/esri/core/workers/chunks/1751de504354d98ac3fd.js +1 -0
  9. package/assets/esri/core/workers/chunks/1f4f1896880bfa6801c5.js +1 -0
  10. package/assets/esri/core/workers/chunks/290cd411d0d18b1d0efd.js +1 -0
  11. package/assets/esri/core/workers/chunks/{ab3bd5fecdb97f2d690e.js → 3b5be512567d9c1c6fe6.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{c3236a7058e64ea3b939.js → 3c9da9b88777700879aa.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{f96e8724ae3458f5e262.js → 4a7aa1b9de61eb013647.js} +1 -1
  14. package/assets/esri/core/workers/chunks/4cb64ccb5fba126f9a66.js +1 -0
  15. package/assets/esri/core/workers/chunks/{68f19e58aae01791944e.js → 579ba109718bc2554008.js} +1 -1
  16. package/assets/esri/core/workers/chunks/59845b02b07a8ed7ce81.js +1 -0
  17. package/assets/esri/core/workers/chunks/{c705f907ce60a646d9aa.js → 652d36523efbe5c9ebb2.js} +1 -1
  18. package/assets/esri/core/workers/chunks/888d8e4471c9a2cd5009.js +1 -0
  19. package/assets/esri/core/workers/chunks/9493a8e5d6001b6bf275.js +1 -0
  20. package/assets/esri/core/workers/chunks/9d824cdfbcdf3cb3246f.js +1 -0
  21. package/assets/esri/core/workers/chunks/bf348f6f52701fa6016e.js +987 -0
  22. package/assets/esri/core/workers/chunks/d02881954c0cc0d39dfb.js +1 -0
  23. package/assets/esri/core/workers/chunks/{1ecbf642debc2207b762.js → da54483123f377e9b3e1.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{61b71b8e028eda10ccab.js → e4ad2cf5d6bded02e392.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{3bfab05ae07ac18a75fe.js → f298a70f3b6f27675d53.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{d499cce61c1c5c367380.js → f40290cfad3fe6fb4ef9.js} +1 -1
  27. package/assets/esri/layers/support/rasterFormats/lerc-wasm.wasm +0 -0
  28. package/assets/esri/themes/base/widgets/_Tooltip.scss +1 -1
  29. package/assets/esri/themes/dark/main.css +1 -1
  30. package/assets/esri/themes/light/main.css +1 -1
  31. package/assets/esri/themes/light/view.css +1 -1
  32. package/chunks/ComponentShader.glsl.js +39 -33
  33. package/chunks/Laserlines.glsl.js +4 -4
  34. package/chunks/Precipitation.glsl.js +2 -2
  35. package/chunks/RibbonLine.glsl.js +46 -44
  36. package/chunks/Stars.glsl.js +2 -2
  37. package/chunks/Terrain.glsl.js +25 -17
  38. package/chunks/boundedPlane.js +1 -1
  39. package/chunks/lerc-wasm.js +1 -1
  40. package/chunks/mat2d.js +1 -1
  41. package/chunks/quatf32.js +1 -1
  42. package/core/BidiEngine.js +1 -1
  43. package/core/accessorSupport/watch.js +1 -1
  44. package/core/libs/gl-matrix-2/factories/quatf32.js +1 -1
  45. package/core/libs/gl-matrix-2/math/mat2d.js +1 -1
  46. package/core/perspectiveUtils.js +1 -1
  47. package/core/promiseUtils.js +1 -1
  48. package/core/reactiveUtils.js +1 -1
  49. package/core/unitUtils.js +1 -1
  50. package/geometry/projection.js +1 -1
  51. package/geometry/projectionEllipsoid.js +1 -1
  52. package/geometry/support/MeshTexture.js +1 -1
  53. package/geometry/support/axisAngleDegrees.js +1 -1
  54. package/geometry/support/coordinateSystem.js +1 -1
  55. package/geometry/support/geodesicUtils.js +1 -1
  56. package/geometry/support/meshUtils/exporters/gltf/index.js +1 -1
  57. package/geometry/support/meshUtils/loadExternal.js +1 -1
  58. package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
  59. package/geometry/support/scaleUtils.js +1 -1
  60. package/geometry/support/spatialReferenceUtils.js +1 -1
  61. package/identity/IdentityManagerBase.js +1 -1
  62. package/identity/IdentityModal.js +1 -1
  63. package/interfaces.d.ts +3 -33
  64. package/layers/FeatureLayer.js +1 -1
  65. package/layers/effects/parser.js +1 -1
  66. package/layers/graphics/hydratedFeatures.js +1 -1
  67. package/layers/graphics/sources/support/sourceUtils.js +1 -1
  68. package/layers/mixins/ArcGISImageService.js +1 -1
  69. package/layers/ogc/wfsUtils.js +1 -1
  70. package/layers/support/ContingentValue.js +1 -1
  71. package/layers/support/ElevationQuery.js +1 -1
  72. package/layers/support/PixelBlock.js +1 -1
  73. package/layers/support/kmlUtils.js +1 -1
  74. package/layers/support/rasterDatasets/CloudRaster.js +1 -1
  75. package/layers/support/rasterDatasets/EphemeralBlockCache.js +1 -1
  76. package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
  77. package/layers/support/rasterDatasets/multipartParser.js +1 -1
  78. package/layers/support/rasterFormats/ImageCanvasDecoder.js +1 -1
  79. package/layers/support/rasterFormats/JpgPlus.js +1 -1
  80. package/layers/support/rasterFormats/Lerc.js +1 -1
  81. package/layers/support/rasterFormats/RasterCodec.js +1 -1
  82. package/layers/support/rasterFormats/Raw.js +1 -1
  83. package/layers/support/rasterFormats/TiffTags.js +1 -1
  84. package/layers/support/rasterFunctions/vectorFieldUtils.js +1 -1
  85. package/layers/support/vectorTileLayerLoader.js +1 -1
  86. package/layers/support/wmtsUtils.js +1 -1
  87. package/package.json +1 -1
  88. package/renderers/RasterShadedReliefRenderer.js +1 -1
  89. package/renderers/RasterStretchRenderer.js +1 -1
  90. package/renderers/UniqueValueRenderer.js +1 -1
  91. package/renderers/support/AuthoringInfo.js +1 -1
  92. package/renderers/support/RasterSymbolizer.js +1 -1
  93. package/rest/query/operations/query.js +1 -1
  94. package/rest/query/operations/queryTopFeatures.js +1 -1
  95. package/rest/support/DirectionsFeatureSet.js +1 -1
  96. package/rest/support/ImageHistogramParameters.js +1 -1
  97. package/rest/support/ImageSampleParameters.js +1 -1
  98. package/smartMapping/labels/clusters.js +1 -1
  99. package/smartMapping/renderers/relationship.js +1 -1
  100. package/smartMapping/support/adapters/support/utils.js +1 -1
  101. package/support/basemapUtils.js +1 -1
  102. package/support/revision.js +1 -1
  103. package/symbols/LabelSymbol3D.js +1 -1
  104. package/symbols/PointSymbol3D.js +1 -1
  105. package/symbols/cim/CIMCursor.js +1 -1
  106. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  107. package/symbols/cim/CIMSymbolRasterizer.js +1 -1
  108. package/symbols/support/previewSymbol3D.js +1 -1
  109. package/symbols/support/webStyleSymbolUtils.js +1 -1
  110. package/views/2d/ViewState.js +1 -1
  111. package/views/2d/engine/vectorTiles/Feature.js +1 -1
  112. package/views/2d/engine/vectorTiles/style/StyleRepository.js +1 -1
  113. package/views/2d/engine/webgl/SDFConverter.js +1 -1
  114. package/views/2d/engine/webgl/TurboLine.js +1 -1
  115. package/views/2d/engine/webgl/brushes/BrushClip.js +1 -1
  116. package/views/2d/engine/webgl/brushes/BrushOverlay.js +1 -1
  117. package/views/2d/engine/webgl/brushes/WGLGeometryBrushLabel.js +1 -1
  118. package/views/2d/engine/webgl/brushes/WGLGeometryBrushLine.js +1 -1
  119. package/views/2d/engine/webgl/brushes/WGLGeometryBrushText.js +1 -1
  120. package/views/2d/engine/webgl/collisions/MetricReader.js +1 -1
  121. package/views/2d/engine/webgl/cpuMapped/DisplayRecordReader.js +1 -1
  122. package/views/2d/engine/webgl/cpuMapped/FreeList.js +1 -1
  123. package/views/2d/engine/webgl/mesh/heuristics.js +1 -1
  124. package/views/2d/engine/webgl/mesh/templates/WGLDynamicFillTemplate.js +1 -1
  125. package/views/2d/engine/webgl/mesh/templates/WGLDynamicLineTemplate.js +1 -1
  126. package/views/2d/engine/webgl/mesh/templates/WGLDynamicMarkerTemplate.js +1 -1
  127. package/views/2d/engine/webgl/mesh/templates/WGLDynamicTextTemplate.js +1 -1
  128. package/views/2d/engine/webgl/mesh/templates/WGLFillTemplate.js +1 -1
  129. package/views/2d/engine/webgl/mesh/templates/WGLLineTemplate.js +1 -1
  130. package/views/2d/engine/webgl/mesh/templates/WGLMarkerTemplate.js +1 -1
  131. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  132. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  133. package/views/2d/input/MapViewInputManager.js +1 -1
  134. package/views/2d/layers/features/createSymbolSchema.js +1 -1
  135. package/views/2d/viewpointUtils.js +1 -1
  136. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  137. package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
  138. package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
  139. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  140. package/views/3d/analysis/LineOfSight/LineOfSightVisualization.js +1 -1
  141. package/views/3d/analysis/LineOfSightAnalysisView3D.js +1 -1
  142. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  143. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  144. package/views/3d/camera/constraintUtils/distance.js +1 -1
  145. package/views/3d/environment/ChapmanAtmosphereTechniqueConfiguration.js +1 -1
  146. package/views/3d/environment/CloudsComposition.js +1 -1
  147. package/views/3d/environment/FogTechnique.js +1 -1
  148. package/views/3d/glTF/internal/Resource.js +1 -1
  149. package/views/3d/input/SceneInputManager.js +1 -1
  150. package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
  151. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  152. package/views/3d/interactive/editingTools/reshapeGraphic/edgeOffsetUtils.js +1 -1
  153. package/views/3d/interactive/editingTools/transformGraphic/GraphicScaleRotateTransform.js +1 -1
  154. package/views/3d/interactive/editingTools/transformGraphic/GraphicTransformTool.js +1 -1
  155. package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateObjectSymbol3DAdapter.js +1 -1
  156. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  157. package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
  158. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  159. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  160. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  161. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  162. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  163. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  164. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  165. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  166. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  167. package/views/3d/layers/graphics/lineUtils.js +1 -1
  168. package/views/3d/layers/i3s/I3SGeometryUtil.js +1 -1
  169. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  170. package/views/3d/layers/i3s/IDBCache.js +1 -1
  171. package/views/3d/layers/i3s/IDBMockCache.js +1 -1
  172. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  173. package/views/3d/layers/support/featureTileQuery3D.js +1 -1
  174. package/views/3d/state/ViewState.js +1 -1
  175. package/views/3d/support/cameraUtils.js +1 -1
  176. package/views/3d/support/orientedBoundingBox.js +1 -1
  177. package/views/3d/support/viewpointUtils.js +1 -1
  178. package/views/3d/terrain/Overlay.js +1 -1
  179. package/views/3d/terrain/OverlayRenderTarget.js +1 -1
  180. package/views/3d/terrain/OverlayRenderer.js +1 -1
  181. package/views/3d/terrain/TerrainRenderer.js +1 -1
  182. package/views/3d/terrain/TerrainSurface.js +1 -1
  183. package/views/3d/terrain/TilingSchemeLogic.js +1 -1
  184. package/views/3d/terrain/interfaces.js +1 -1
  185. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  186. package/views/3d/webgl-engine/collections/Component/DepthRange.js +1 -1
  187. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  188. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  189. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
  190. package/views/3d/webgl-engine/collections/Component/RenderGeometry.js +1 -1
  191. package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
  192. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  193. package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
  194. package/views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js +2 -2
  195. package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +2 -2
  196. package/views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js +9 -0
  197. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +18 -17
  198. package/views/3d/webgl-engine/lib/DefaultVertexAttributeLocations.js +1 -1
  199. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  200. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  201. package/views/3d/webgl-engine/lib/ObjectAndLayerIdRenderHelper.js +5 -0
  202. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  203. package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
  204. package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
  205. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  206. package/views/3d/webgl-engine/lib/TextureTechniqueConfiguration.js +1 -1
  207. package/views/3d/webgl-engine/lib/VertexAttribute.js +1 -1
  208. package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
  209. package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
  210. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  211. package/views/3d/webgl-engine/lib/lodRendering/RenderInstanceData.js +1 -1
  212. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  213. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  214. package/views/3d/webgl-engine/materials/PathMaterial.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/internal/bufferWriterUtils.js +1 -1
  218. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  219. package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
  220. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  221. package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
  222. package/views/3d/webgl-engine/shaders/LaserlinePathTechniqueConfiguration.js +1 -1
  223. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  224. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  225. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  226. package/views/DOMContainer.js +1 -1
  227. package/views/MapView.js +1 -1
  228. package/views/SceneView.js +1 -1
  229. package/views/View.js +1 -1
  230. package/views/analysis/analysisViewUtils.js +1 -1
  231. package/views/animation/pointToPoint/apex/planning.js +1 -1
  232. package/views/draw/PolygonDrawAction.js +1 -1
  233. package/views/draw/PolylineDrawAction.js +1 -1
  234. package/views/draw/support/createUtils.js +1 -1
  235. package/views/draw/support/surfaceCoordinateSystems.js +1 -1
  236. package/views/input/InputManager.js +1 -1
  237. package/views/input/handlers/LatestPointer.js +1 -1
  238. package/views/input/handlers/MultiTouch.js +5 -0
  239. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  240. package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
  241. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileCache.js +1 -1
  242. package/views/interactive/tooltip/Tooltip.js +1 -1
  243. package/views/interactive/tooltip/support/measurements.js +1 -1
  244. package/views/layers/GroupLayerView.js +1 -1
  245. package/views/navigation/FilteredFiniteDifference.js +1 -1
  246. package/views/navigation/MomentumEstimator.js +1 -1
  247. package/views/navigation/PanPlanarMomentumEstimator.js +1 -1
  248. package/views/navigation/PanSphericalMomentumEstimator.js +1 -1
  249. package/views/navigation/RotationMomentumEstimator.js +1 -1
  250. package/views/support/GroundViewElevationSampler.js +1 -1
  251. package/views/support/euclideanAreaMeasurementUtils.js +1 -1
  252. package/views/support/euclideanLengthMeasurementUtils.js +1 -1
  253. package/views/support/screenshotUtils.js +1 -1
  254. package/views/webgl/BufferObject.js +1 -1
  255. package/views/webgl/FramebufferObject.js +1 -1
  256. package/views/webgl/Texture.js +1 -1
  257. package/views/webgl/capabilities/Capabilities.js +1 -1
  258. package/views/webgl/capabilities.js +1 -1
  259. package/views/webgl/renderState.js +1 -1
  260. package/webscene/spec-certification/api.js +1 -1
  261. package/widgets/CoordinateConversion/support/formatUtils.js +1 -1
  262. package/widgets/ElevationProfile/ElevationProfileController.js +1 -1
  263. package/widgets/ElevationProfile/ElevationProfileLineInput.js +1 -1
  264. package/widgets/ElevationProfile/ElevationProfileLineView.js +1 -1
  265. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  266. package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
  267. package/widgets/Expand.js +1 -1
  268. package/widgets/Legend/support/sizeRampUtils.js +1 -1
  269. package/widgets/LineOfSight/LineOfSightViewModel.js +1 -1
  270. package/widgets/Popup/PopupViewModel.js +1 -1
  271. package/widgets/Popup/actionUtils.js +1 -1
  272. package/widgets/ScaleRangeSlider.js +1 -1
  273. package/widgets/Slider/SliderViewModel.js +1 -1
  274. package/widgets/Widget.js +1 -1
  275. package/assets/esri/core/workers/chunks/04ea469cb081e181ca82.js +0 -1
  276. package/assets/esri/core/workers/chunks/16c2626ca47132700519.js +0 -1
  277. package/assets/esri/core/workers/chunks/1e4e5d147263e98536bc.js +0 -1
  278. package/assets/esri/core/workers/chunks/35083def3c658d1ae9ff.js +0 -1
  279. package/assets/esri/core/workers/chunks/40032d2bf404a46b8f80.js +0 -1
  280. package/assets/esri/core/workers/chunks/613e82a3e13442685ac4.js +0 -1
  281. package/assets/esri/core/workers/chunks/64b4f1dbf61439cde801.js +0 -1
  282. package/assets/esri/core/workers/chunks/abd68b7ba3be4696611c.js +0 -1
  283. package/assets/esri/core/workers/chunks/b8a062c0c9c626acf61e.js +0 -982
  284. package/assets/esri/core/workers/chunks/e08686088be0aaca1a99.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{Geometry as t}from"./Geometry.js";class e extends t{constructor(t,e,r,i,n,s){super(t,e),this.path=r,this.geometrySR=i,this.upVectorAlignment=n,this.stencilWidth=s}}function r(t){return"upVectorAlignment"in t}export{e as PathGeometry,r as isPathGeometry};
5
+ import{PrimitiveType as t}from"./basicInterfaces.js";import{Geometry as e}from"./Geometry.js";class r extends e{constructor(e,r,i,s,n,o,c){super(e,r,t.Triangle,c),this.path=i,this.geometrySR=s,this.upVectorAlignment=n,this.stencilWidth=o}}function i(t){return"upVectorAlignment"in t}export{r as PathGeometry,i as isPathGeometry};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import{update as t}from"../../../../core/arrayUtils.js";import s from"../../../../core/Handles.js";import{someMap as i}from"../../../../core/MapUtils.js";import{destroyMaybe as n,disposeMaybe as a,isSome as h,isNone as o,applySome as d,unwrap as _}from"../../../../core/maybe.js";import{watch as l,syncAndInitial as c,initial as p,sync as m}from"../../../../core/reactiveUtils.js";import{Milliseconds as g}from"../../../../core/time.js";import{property as u}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as f}from"../../../../core/accessorSupport/decorators/subclass.js";import{j as T,a as R,m as b}from"../../../../chunks/mat4.js";import{I as P,c as E}from"../../../../chunks/mat4f64.js";import{a as w}from"../../../../chunks/boundedPlane.js";import{MAXIMUM_ANIMATION_LOAD as A,MINIMUM_IDLE_ANIMATION_MS as S}from"../../support/animationUtils.js";import C from"../../support/debugFlags.js";import{RenderPassManager as x}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as O}from"../core/shaderLibrary/ShaderOutput.js";import{HUDTransparentRenderStyle as y}from"../core/shaderLibrary/hud/HUDUniforms.js";import{Decorations as D,RenderRequestType as H,StencilBits as I}from"./basicInterfaces.js";import{BoundingInfo as M}from"./BoundingInfo.js";import{ZERO as L,union as v}from"./depthRange.js";import{depthRangeFromScene as N}from"./depthRangeUtils.js";import{createEmptyDepthTexture as U}from"./glUtil3D.js";import{Highlight as j}from"./Highlight.js";import{RenderOccludedFlag as q}from"./Material.js";import{OffscreenRendering as V}from"./OffscreenRendering.js";import{RenderContext as F}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as G}from"./rendererUtils.js";import{RenderPluginManager as B}from"./RenderPluginManager.js";import{RenderSlot as k}from"./RenderSlot.js";import{ShadowAccumulator as W}from"./ShadowAccumulator.js";import{ShadowHighlight as Q}from"./ShadowHighlight.js";import{ShadowMap as z,SnapshotSlot as X}from"./ShadowMap.js";import Y from"./SliceHelper.js";import{SmaaRenderPass as K}from"./SmaaRenderPass.js";import{SSAOHelper as J}from"./SSAOHelper.js";import{TransparencyPassType as Z}from"./TransparencyPassType.js";import{EdgeView as $}from"./edgeRendering/EdgeView.js";import{Transparency as ee}from"./edgeRendering/interfaces.js";import{MergedRenderer as re}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as te}from"../shaders/CompositingTechniqueConfiguration.js";import{RendererPerformanceInfo as se,Statistics as ie}from"../statistics/RendererPerformanceInfo.js";import{ClearBufferBit as ne,PixelFormat as ae,PixelType as he}from"../../../webgl/enums.js";const oe=.9;let de=class extends r{constructor(e,r,t,i,n,a,h,o,d){super({}),this._materialRepository=e,this._shaderTechniqueRepository=t,this._rctx=i,this._compositingHelper=n,this._magnifierHelper=a,this._requestRender=h,this._stage=d,this._materialRenderers=new Map,this._needsTransparentPass=!1,this._hasHUDElements=!1,this._hasHighlights=!1,this._hasWater=!1,this._hasOverlayWater=!1,this._content=new Map,this._isRendering=!1,this._fallbackDepthStencilTexture=null,this.performanceInfo=new se,this._antialiasing=!0,this._oitEnabled=!1,this._multipassTerrain=!0,this._transparentTerrain=!1,this._hasAnimations=!1,this._animationTimestep=g(0),this._handles=new s,this._renderHiddenTransparentEdges=()=>{},this._oitUsed=!1,this._smaaPass=new K(this._rctx,t),this._oitEnabled=this._hasOITSupport,this._requestRender(),this._offscreenRendering=new V(this._rctx,this._compositingHelper),this._sliceHelper=new Y,this._shadowMap=new z(this._rctx,d.viewingMode,2),this._ssaoHelper=new J(t,this._rctx,(()=>this._requestRender())),this._highlight=new j(t,this._rctx),this._shadowHighlight=new Q(this._rctx,d.viewingMode),this._shadowAccumulator=new W(this._rctx,t,d,(e=>{const r=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureCameraBindParameters(e.camera,e.contentCamera),this._renderPlugins.prepareRender(),this._shadowMap.enabled=r}),((e,r,t)=>{e.shadowMap.start(e.camera,r,t),this._renderShadowCascades(O.Shadow,e.shadowMap),e.camera.setGLViewport(this._rctx),this._ensureCameraBindParameters(e.camera,e.contentCamera)}),(()=>this._requestRender())),this._renderContext=new F(this._rctx,this._offscreenRendering,this._shadowMap,this._ssaoHelper,this._sliceHelper),this._renderPlugins=new B({renderContext:this._renderContext,shaderTechniqueRepository:t,textureRep:r,materialRep:this._materialRepository,requestRender:this._requestRender,schedule:o}),this.renderPassManager=new x(this._rctx,this._shaderTechniqueRepository),this._renderPlugins.add(this.renderPassManager.slots(),this.renderPassManager),this._handles.add([l((()=>this._stage.state.camera),(()=>this._requestRender()),c),l((()=>C.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(ee.TRANSPARENT):()=>{},this._requestRender()}),p)])}get _bindParameters(){return this._renderContext.bindParameters}get hasWater(){return this._hasWater||this._hasOverlayWater}get hasWaterReflection(){return this.hasWater&&this._waterReflectionEnabled}normalizeCtorArgs(){return{}}dispose(){this._handles.destroy(),this._smaaPass.dispose(),this._materialRenderers.forEach((e=>e.dispose())),this._materialRenderers.clear(),this._edgeView=n(this._edgeView),this._offscreenRendering.dispose(),this._fallbackDepthStencilTexture=a(this._fallbackDepthStencilTexture),this._shadowMap.enabled=!1,this._shadowMap.dispose(),this._ssaoHelper.enabled=!1,this._ssaoHelper.dispose(),this._highlight.dispose(),this._shadowHighlight.dispose(),this._shadowAccumulator.dispose(),M.prune(),this._content.clear()}disposeOffscreenBuffers(){this._offscreenRendering.dispose(),this._shadowMap.dispose(),this._smaaPass.disable(),this._ssaoHelper.disposeOffscreenBuffers()}get updating(){return this._antialiasing&&this._smaaPass.updating||h(this._edgeView)&&this._edgeView.updating||this._shadowAccumulator.running||!this.isCameraFinal}ensureEdgeView(){return o(this._edgeView)&&(this._edgeView=new $({rctx:this._rctx,renderSR:this._stage.renderSR,viewingMode:this._stage.viewingMode,techniqueRepository:this._shaderTechniqueRepository,setNeedsRender:()=>this._requestRender(),schedule:e=>this._stage.resourceController.schedule(e)}),this._handles.add(l((()=>d(this._edgeView,(e=>e.updating))),(()=>this._requestRender()),m)),this._requestRender()),this._edgeView}get edgeView(){return this._edgeView}get isCameraFinal(){return T(this._bindParameters.ssr.reprojectionMatrix,P)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this.notifyChange("isCameraFinal")}get shadowsEnabled(){return!!this._shadowMap?.enabled}setRenderParameters(e){const{_shadowMap:r,_ssaoHelper:t,_bindParameters:s}=this;if(void 0!==e.screenSpaceReflectionsEnabled&&s.ssr.enabled!==e.screenSpaceReflectionsEnabled&&(s.ssr.enabled=e.screenSpaceReflectionsEnabled,this._requestRender()),void 0!==e.shadowMap&&r.enabled!==e.shadowMap&&(r.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&r.maxCascades!==e.shadowMapMaxCascades&&(r.maxCascades=e.shadowMapMaxCascades,this._requestRender()),h(e.environment)){h(e.environment.weather)&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=e.weatherVisible,this._renderContext.bindParameters.weather=e.environment.weather,this._renderContext.bindParameters.weatherVisible=e.weatherVisible),void 0!==e.environment.lighting.ambientOcclusionEnabled&&t.enabled!==e.environment.lighting.ambientOcclusionEnabled&&(t.enabled=e.environment.lighting.ambientOcclusionEnabled,this._requestRender()),void 0!==e.environment.lighting.waterReflectionEnabled&&this._waterReflectionEnabled!==e.environment.lighting.waterReflectionEnabled&&(this._waterReflectionEnabled=e.environment.lighting.waterReflectionEnabled,this._requestRender());const r="virtual"!==e.environment.lighting.type;s.enableFillLights!==r&&(s.enableFillLights=r,this._requestRender())}e.background&&this._offscreenRendering.background!==e.background&&(this._offscreenRendering.background=e.background,this._requestRender()),void 0!==e.antialiasingEnabled&&this._antialiasing!==e.antialiasingEnabled&&(this._antialiasing=e.antialiasingEnabled,this._requestRender()),void 0!==e.highQualityTransparency&&this._multipassTerrain!==e.highQualityTransparency&&(this._multipassTerrain=e.highQualityTransparency,this._oitEnabled=e.highQualityTransparency&&this._hasOITSupport,this._requestRender()),void 0!==e.defaultHighlightOptions&&(this._highlight.setDefaultOptions(e.defaultHighlightOptions),this._shadowHighlight.setDefaultOptions(e.defaultHighlightOptions),this._requestRender()),void 0!==e.overlays&&this._bindParameters.overlays!==e.overlays&&(this._bindParameters.overlays=e.overlays,this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=_(e.slicePlane),this._requestRender()),void 0!==e.transparentTerrain&&this._transparentTerrain!==e.transparentTerrain&&(this._transparentTerrain=e.transparentTerrain,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.shadowCastOptions&&this._shadowAccumulator.setOptions(e.shadowCastOptions)}get hasSlicePlane(){return!!this._sliceHelper.plane}get renderPlugins(){return this._renderPlugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlendWorking}modify(e){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:r,removes:t,updates:s}=e;if(0===r.length&&0===t.length&&0===s.length)return;t.forAll((({id:e})=>this._content.delete(e))),r.forAll((e=>this._content.set(e.id,e)));const n=G(e);let a=!1;n.forEach(((e,r)=>{let t=this._materialRenderers.get(r);if(!t){if(!(e.adds.length>0))return;t=new re(this._rctx,this._materialRepository,r),this._materialRenderers.set(r,t)}t.modify(e),t.isEmpty&&(a=!0)})),a&&this._materialRenderers.forEach(((e,r)=>{e.isEmpty&&(this._materialRenderers.delete(r),e.dispose())})),this._hasHighlights=i(this._materialRenderers,(e=>e.hasHighlights)),this._bindParameters.hasOccludees=i(this._materialRenderers,(e=>e.hasOccludees)),this._hasWater=i(this._materialRenderers,(e=>e.hasWater)),this._needsTransparentPass=i(this._materialRenderers,(e=>e.requiresSlot(k.TRANSPARENT_MATERIAL,O.Color))),this._hasHUDElements=i(this._materialRenderers,(e=>e.requiresSlot(k.LINE_CALLOUTS_HUD_DEPTH,O.Color)||e.requiresSlot(k.HUD_MATERIAL,O.Color)||e.requiresSlot(k.LABEL_MATERIAL,O.Color))),this._requestRender()}updateAnimation(e){return this._hasAnimations=!1,this._materialRenderers.forEach((r=>this._hasAnimations=r.updateAnimation(e)||this._hasAnimations)),this._hasAnimations=this._renderPlugins.updateAnimation(e)||this._hasAnimations,this._hasAnimations}get animationTimestep(){return this._animationTimestep}updateLightSources(e,r,t){this._bindParameters.lighting.groundLightingFactor=r,this._bindParameters.lighting.globalFactor=t,this._bindParameters.lighting.set(e)}render(e,r,t,s){this._isRendering=!0,this.performanceInfo.prerender(this._rctx),this._bindParameters.transparencyPassType=Z.NONE;const i=this._offscreenRendering;i.needLastFrameColorTexture=this.hasWaterReflection,i.advanceCurrentRenderTarget();const n=w(this._sliceHelper.plane);s===D.OFF&&(this._sliceHelper.plane=null),this._rctx.bindFramebuffer(e),r.setGLViewport(this._rctx),this._ensureCameraBindParameters(r,t),this._renderPlugins.prepareRender(),this.performanceInfo.advance(ie.Prepare);const a=this._computeDepthRange(r);this._renderShadowMap(e,r,this._bindParameters.lighting.lightingMainDirection,a),this.performanceInfo.advance(ie.Shadowmap),i.initializeFrame(r),this._ensureBindParameters(r,t),this._renderLinearDepth(),this.performanceInfo.advance(ie.Lineardepth),this._accumulateShadows(a,r,t),this._renderNormal(),this.performanceInfo.advance(ie.Normals),this._ensureBindParametersSSR(),this._ssaoHelper.computeSSAO(this._bindParameters,i.linearDepthTexture,i.normalTexture),this.performanceInfo.advance(ie.SSAO),this._renderContext.output=O.Color,i.bindFramebuffer(),this._renderOpaqueGeometry(),this.performanceInfo.advance(ie.Opaque);const d=this._multipassTerrain&&this._transparentTerrain;this._renderTerrainLinearDepth(d),this._setMultipassEnabled(d),this._setTerrainCulling(d),this._renderEdges(ee.OPAQUE),this.performanceInfo.advance(ie.OpaqueEdges),this._offscreenRendering.bindTarget(this._offscreenRendering.currentColorTarget,this._offscreenRendering.mainDepth),this._renderSlot(k.VOXEL),this._renderHiddenTransparentEdges();const _=this._needsTransparentPass||this._renderPlugins.needsTransparentPass;_&&(this._oitEnabled?this._renderOrderIndependentTransparency((()=>this._renderTransparentGeometry()),!1):this._renderTransparentGeometry()),this.performanceInfo.advance(ie.Transparent),this._renderGeometryLinearDepth(d);const l=this._renderHUDVisibility();d||this._renderInternalSlot(k.LINE_CALLOUTS),this.performanceInfo.advance(ie.Hudvisibility),this._renderEdges(ee.TRANSPARENT,d),this.performanceInfo.advance(ie.TransparentEdges),this._renderTransparentTerrain(),this._transparentTerrain&&l&&(d?this._renderLineCallouts(y.Occluded):i.compositeTransparentTerrainOntoHUDVisibility(this._bindParameters),this._renderHUD(y.Occluded,i.framebuffer),this.performanceInfo.advance(ie.HudOccluded)),this.performanceInfo.advance(ie.TransparentTerrain),this._setTerrainCulling(!1),this._transparentTerrain&&(i.compositeTransparentTerrainOntoMain(this._bindParameters),d&&(this._renderEdges(ee.OPAQUE),this.performanceInfo.advance(ie.OpaqueEdges),_&&(this._oitEnabled?this._renderOrderIndependentTransparency((()=>this._renderTransparentGeometry()),!1):this._renderTransparentGeometry()),this.performanceInfo.advance(ie.Transparent),this._renderEdges(ee.TRANSPARENT),this.performanceInfo.advance(ie.TransparentEdges))),d&&this._renderLineCallouts(y.NotOccluded),this._setMultipassEnabled(!1),this._shadowAccumulator.render(this._bindParameters),i.renderToTargets((()=>{this._renderInternalSlot(k.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._renderSlot(k.POSTPROCESSING_ENVIRONMENT_TRANSPARENT),this._renderSlot(k.LASERLINES)}),i.currentColorTarget,i.mainDepth),this.performanceInfo.advance(ie.Atmosphere),this._renderPlugins.needsLaserlineWithContrastControl&&i.renderTmpAndCompositeToMain((()=>this._renderSlot(k.LASERLINES_CONTRAST_CONTROL)),this._bindParameters,te.PremultipliedAlpha),this.performanceInfo.advance(ie.Laserline),this._renderOccluded(),this.performanceInfo.advance(ie.Occluded);const c=s===D.ON&&this._magnifierHelper.enabled,p=c&&o(e)?this._offscreenRendering.getFramebuffer(this._offscreenRendering.tmpColor,this._offscreenRendering.tmpDepth):e;this._rctx.bindFramebuffer(p);const m=this._offscreenRendering.colorTexture;!this._renderAntiAliasing(m)&&h(m)&&this._compositingHelper.composite(this._bindParameters,m,te.None),this.performanceInfo.advance(ie.Antialiasing),this._renderHUD(y.NotOccluded,p),this.performanceInfo.advance(ie.HudNotoccluded),this._renderHighlights(p,this._bindParameters),this.performanceInfo.advance(ie.Highlights),c&&this._magnifierHelper.render(this._rctx,this._bindParameters),p!==e&&(this._rctx.bindFramebuffer(e),this._compositingHelper.composite(this._bindParameters,this._offscreenRendering.tmpColorTexture,te.None)),this._disposeOITBuffers(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=n,this._isRendering=!1,this.onPostRender&&this.onPostRender(),this.performanceInfo.postrender()}finish(e){if(this._hasAnimations||(this._animationTimestep=g(0)),e===H.BACKGROUND){this._rctx.gl.getError();const e=this.performanceInfo.elapsedTime/A;this._animationTimestep=g(Math.max(this._animationTimestep*oe+e*(1-oe),S))}}readDepthPixels(e,r,t){const s=this._offscreenRendering.bindTarget(this._offscreenRendering.linearDepth,this._offscreenRendering.tmpDepth);if(!this._needsLinearDepth){this._ensureBindParameters(e,e),this._bindParameters.camera.setGLViewport(this._rctx),this._rctx.setClearColor(0,0,0,0);const r=ne.COLOR_BUFFER_BIT|ne.DEPTH_BUFFER_BIT|ne.STENCIL_BUFFER_BIT;this._rctx.clearSafe(r),this._renderGeometryAndTransparentTerrainPass(O.Depth)}s.readPixels(r[0],r[1],r[2],r[3],ae.RGBA,he.UNSIGNED_BYTE,t)}readHUDVisibility(e,r,t,s,i){this._offscreenRendering.bindTarget(this._offscreenRendering.hudVisibility).readPixels(e,r,t,s,ae.RGBA,he.UNSIGNED_BYTE,i)}readAccumulatedShadow(e,r){return this._shadowAccumulator.readAccumulatedShadow(e,r)}_setMultipassEnabled(e){this._bindParameters.multipassTerrain.enabled=this._bindParameters.multipassGeometry.enabled=e}_setTerrainCulling(e){this._bindParameters.multipassTerrain.cullAboveGround=e}_renderSlot(e){this._bindParameters.slot=e,this._renderPlugins.render()}_renderEdges(e,r=!1){const t=this._edgeView;h(t)&&t.shouldRender()&&this._offscreenRendering.renderTmpAndCompositeToMain((()=>t.render(this._bindParameters,e)),this._bindParameters,te.Alpha,r)}_renderShadowMap(e,r,t,s){const i=this._shadowMap;i.enabled&&(i.start(r,t,s),this._shadowHighlight.updateParameters(r,t),this._needsShadowHighlight?(this._renderShadowCascades(O.ShadowHighlight,this._shadowMap,(e=>i.takeCascadeSnapshotTo(e,X.Highlight))),i.clear(),this._renderShadowCascades(O.ShadowExludeHighlight,this._shadowMap,(e=>{i.takeCascadeSnapshotTo(e,X.Default),this._renderGeometryAndTransparentTerrainPass(O.ShadowHighlight)}))):this._renderShadowCascades(O.Shadow),i.finish(e),r.setGLViewport(this._rctx))}_renderShadowCascades(e,r=this._shadowMap,t=(e=>{})){for(const s of r.getCascades())s.camera.setGLViewport(this._rctx),this._ensureCameraBindParameters(s.camera,s.camera),this._renderGeometryAndTransparentTerrainPass(e),t(s)}get _needsLinearDepth(){return this._ssaoHelper.enabled||this._renderPlugins.needsLinearDepth||this._hasWater&&this._waterReflectionEnabled||this._needsShadowHighlight||this._needsShadowCast}_renderLinearDepth(){this._needsLinearDepth?this._offscreenRendering.renderToTargets((()=>this._renderGeometryAndTransparentTerrainPass(O.Depth)),this._offscreenRendering.linearDepth,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0):this._offscreenRendering.disposeTarget(this._offscreenRendering.linearDepth),this._bindParameters.linearDepthTexture=this._offscreenRendering.linearDepthTexture}_renderTerrainLinearDepth(e){if(e){const e=this._renderContext.output;this._renderContext.output=O.Depth,this._offscreenRendering.renderToTargets((()=>this._renderTransparentTerrain()),this._offscreenRendering.terrainLinearDepth,this._offscreenRendering.tmpDepth,[-1e10,-1e10,-1e10,1],!0,!0),this._renderContext.output=e}else this._offscreenRendering.disposeTarget(this._offscreenRendering.terrainLinearDepth);this._bindParameters.multipassTerrain.linearDepthTexture=this._offscreenRendering.terrainLinearDepthTexture}_renderGeometryLinearDepth(e){if(e){const e=this._renderContext.output;this._offscreenRendering.renderToTargets((()=>this._renderGeometryPass(O.Depth)),this._offscreenRendering.geometryLinearDepth,this._offscreenRendering.tmpDepth,[1,1,1,1],!0,!0),this._renderContext.output=e}else this._offscreenRendering.disposeTarget(this._offscreenRendering.geometryLinearDepth);this._bindParameters.multipassGeometry.linearDepthTexture=this._offscreenRendering.geometryLinearDepthTexture}get _needsNormal(){return this._ssaoHelper.enabled}_renderNormal(){this._needsNormal?this._offscreenRendering.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(O.Normal)}),this._offscreenRendering.normal,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0):this._offscreenRendering.disposeTarget(this._offscreenRendering.normal)}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowCast}_computeDepthRange(e){if(!this._needsDepthRange)return L;const r=N(e,this._content,this._stage.layers);return v(r,this.renderPlugins.queryDepthRange(e)),r.near=Math.max(e.near,r.near),r.far=Math.min(e.far,r.far),r}_renderGeometryAndTransparentTerrainPass(e){this._renderContext.output=e,this._renderGeometryPass(e),this._renderTransparentTerrain()}_renderGeometryPass(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderOpaqueGeometry(){this._renderSlot(k.INTEGRATED_MESH),this._renderSlot(k.OPAQUE_TERRAIN),this._renderInternalSlot(k.OPAQUE_MATERIAL),this._renderSlot(k.OPAQUE_MATERIAL),this._renderSlot(k.POSTPROCESSING_ENVIRONMENT_OPAQUE)}_renderTransparentGeometry(){this._renderInternalSlot(k.TRANSPARENT_MATERIAL),this._renderSlot(k.TRANSPARENT_MATERIAL)}_renderTransparentTerrain(){this._renderSlot(k.TRANSPARENT_TERRAIN)}_renderHUDVisibility(){let e=!1;return this._renderContext.offscreenRenderingHelper&&this._renderContext.offscreenRenderingHelper.renderHUDVisibility((()=>{this._bindParameters.hudVisibilityTexture=this._renderContext.offscreenRenderingHelper.hudVisibilityTexture,e=this._renderInternalSlot(k.OCCLUSION_PIXELS)}),this._multipassTerrain&&this._transparentTerrain),e}_renderLineCallouts(e){this._bindParameters.renderTransparentlyOccludedHUD=e,e===y.Occluded?this._offscreenRendering.renderToTargets((()=>this._renderInternalSlot(k.LINE_CALLOUTS)),this._offscreenRendering.currentColorTarget,this._offscreenRendering.tmpDepth,void 0,!0,!0):this._renderInternalSlot(k.LINE_CALLOUTS)}_renderHUD(e,r){this._hasHUDElements&&(this._oitEnabled?(this._renderOrderIndependentTransparency((()=>this._renderHUDElements(e)),!0),this._rctx.bindFramebuffer(r),this._compositingHelper.composite(this._bindParameters,this._offscreenRendering.hudColorTexture,te.PremultipliedAlpha)):e===y.Occluded?this._offscreenRendering.renderToTargets((()=>this._renderHUDElements(y.Occluded)),this._offscreenRendering.currentColorTarget,this._offscreenRendering.tmpDepth,void 0,!0,!0):this._renderHUDElements(e))}_renderHUDElements(e){this._bindParameters.renderTransparentlyOccludedHUD=e,this._renderInternalSlot(k.LINE_CALLOUTS_HUD_DEPTH),this._renderInternalSlot(k.HUD_MATERIAL),this._renderInternalSlot(k.LABEL_MATERIAL)}get _needsHighlight(){return this._hasHighlights||this._renderPlugins.needsHighlight}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._shadowHighlight.isVisible&&this._needsHighlight}_renderHighlights(e,r){if(!this._needsHighlight)return void this._offscreenRendering.disposeTarget(this._offscreenRendering.highlight);const t=this._highlight,s=this._offscreenRendering.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(O.Highlight),this._rctx.clearSafe(ne.DEPTH_BUFFER_BIT),this._renderHUDElements(y.Both)}),this._offscreenRendering.highlight,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0);this._bindParameters.highlightColorTexture=s.colorTexture,this._needsShadowHighlight&&this._shadowHighlight.render(r,e),t.render(this._bindParameters,s,e)}get _needsShadowCast(){return this._shadowAccumulator.isAccumulating}_accumulateShadows(e,r,t){this._needsShadowCast&&this._shadowAccumulator.renderAccumulation(this._offscreenRendering.linearDepthTexture,e,r,t)}_renderOrderIndependentTransparency(e,r){const t=t=>{this._bindParameters.transparencyPassType=t,this._offscreenRendering.renderOITPass((()=>e()),t,r)},s=this._renderContext.output;this._renderContext.output=O.Alpha,t(Z.Alpha),this._renderContext.output=O.Color,t(Z.Color),t(Z.FrontFace),this._offscreenRendering.compositeTransparentOntoOpaque(this._bindParameters,r),this._bindParameters.transparencyPassType=Z.NONE,this._renderContext.output=s,this._oitUsed=!0}_disposeOITBuffers(){this._oitUsed||(this._offscreenRendering.disposeTarget(this._offscreenRendering.alphaFloatTarget),this._offscreenRendering.disposeTarget(this._offscreenRendering.colorFloatTarget),this._offscreenRendering.disposeTarget(this._offscreenRendering.frontFaceTarget)),this._oitUsed=!1}_renderOccluded(){let e=0;this._materialRenderers.forEach(((r,t)=>{t&&t.isVisible()&&t.renderOccluded===q.OccludeAndTransparentStencil&&(e|=t.renderOccluded,ce.push(t))}));const r=this._offscreenRendering,t=(t,s,i,n,a)=>{0!=(e&s)&&(r.renderToTargets(i,r.tmpColor,r.mainDepth,[0,0,0,0],n,a),r.compositeOccludedOntoMain(this._bindParameters,t))};0!==ce.length&&(this._renderInternalSlot(k.OCCLUDER_MATERIAL,ce),t(.5,q.OccludeAndTransparentStencil,(()=>this._renderInternalSlot(k.TRANSPARENT_OCCLUDER_MATERIAL,ce)),!1,!1),ce.length=0),this._materialRenderers.forEach(((r,t)=>{t&&t.isVisible()&&(t.renderOccluded===q.OccludeAndTransparent||t.renderOccluded===q.Transparent||t.renderOccluded===q.Opaque)&&(e|=t.renderOccluded,le.push(t))}));const s=this._renderPlugins.renderOccludedFlags;if(e|=s,!e)return;const i=e=>{this._renderContext.renderOccludedMask=e,s>q.Occlude&&this._renderSlot(k.OCCLUDED_TERRAIN),this._renderInternalSlot(k.OPAQUE_MATERIAL,le),this._renderInternalSlot(k.TRANSPARENT_MATERIAL,le),this._renderInternalSlot(k.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,le),this._renderContext.resetRenderOccludedMask()};this._renderContext.output=O.Color,t(.5,q.OccludeAndTransparent,(()=>i(q.OccludeAndTransparent)),!0,I.OutlineVisualElementMask),t(.5,q.Transparent,(()=>i(q.Transparent)),!0,I.OutlineVisualElementMask),t(1,q.Opaque,(()=>i(q.Opaque)),!0,I.OutlineVisualElementMask),le.length=0}_renderAntiAliasing(e){if(this._antialiasing){if(this._smaaPass.enable((()=>this._requestRender()))&&h(e))return this._smaaPass.render(e),!0}else this._smaaPass.disable();return!1}_ensureCameraBindParameters(e,r){this._bindParameters.camera=e,this._bindParameters.contentCamera=r}_ensureBindParameters(e,r){this._ensureCameraBindParameters(e,r);const t=this._renderContext.offscreenRenderingHelper;this._bindParameters.hudVisibilityTexture=t.hudVisibilityTexture,this._bindParameters.mainColorTexture=t.mainColorTexture,this._bindParameters.highlightDepthTexture=t.depthTexture??this._getFallbackDepthTexture()}_ensureBindParametersSSR(){this.hasWaterReflection?(this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=P:(R(me,this._bindParameters.camera.viewMatrix),R(pe,this._bindParameters.camera.projectionMatrix),b(ge,me,pe),b(ge,this._renderContext.lastFrameCamera.viewMatrix,ge),b(ge,this._renderContext.lastFrameCamera.projectionMatrix,ge),this._reprojectionMatrix=ge),this._bindParameters.ssr.lastFrameColorTexture=this._offscreenRendering.lastFrameColorTexture):this._bindParameters.ssr.lastFrameColorTexture=null,this._bindParameters.ssr.enabled=this.hasWaterReflection}_renderInternalSlot(e,r){let t=!1;return this._bindParameters.slot=e,h(r)?r.forEach((e=>{if(!e.shouldRender(this._renderContext))return;const r=this._materialRenderers.get(e);h(r)&&(t=r.render(this._renderContext.output,this._bindParameters)||t)})):this._materialRenderers.forEach(((e,r)=>{r.shouldRender(this._renderContext)&&e.render(this._renderContext.output,this._bindParameters)&&(t=!0)})),t}_getFallbackDepthTexture(){return this._fallbackDepthStencilTexture||(this._fallbackDepthStencilTexture=U(this._rctx)),this._fallbackDepthStencilTexture}get gpuMemoryUsage(){return{offscreen:this._offscreenRendering?.gpuMemoryUsage??0,highlights:(this._highlight?.gpuMemoryUsage??0)+(this._shadowHighlight?.gpuMemoryUsage??0),shadows:this._shadowMap?.gpuMemoryUsage??0,ssao:this._ssaoHelper?.gpuMemoryUsage??0}}get test(){const e=this;return{offscreen:this._offscreenRendering,shadowMap:this._shadowMap,ssao:this._ssaoHelper,highlight:this._highlight,lighting:this._bindParameters.lighting,materialRenderers:this._materialRenderers,shadowAccumulator:this._shadowAccumulator,getFramebufferTexture:r=>{switch(r){case _e.Color:return e._offscreenRendering.colorTexture;case _e.LinearDepth:return e._offscreenRendering.linearDepthTexture;case _e.Normals:return e._offscreenRendering.normalTexture;case _e.ShadowMap:return e._shadowMap.depthTexture;case _e.HudVisibility:return e._offscreenRendering.hudVisibilityTexture;case _e.Highlight:return e._offscreenRendering.highlightTexture}}}}};var _e;e([u()],de.prototype,"_shadowAccumulator",void 0),e([u()],de.prototype,"_smaaPass",void 0),e([u()],de.prototype,"_antialiasing",void 0),e([u()],de.prototype,"_edgeView",void 0),e([u()],de.prototype,"updating",null),e([u()],de.prototype,"isCameraFinal",null),de=e([f("esri.views.3d.webgl-engine.lib.Renderer")],de),function(e){e[e.Color=0]="Color",e[e.LinearDepth=1]="LinearDepth",e[e.Normals=2]="Normals",e[e.ShadowMap=3]="ShadowMap",e[e.HudVisibility=4]="HudVisibility",e[e.Highlight=5]="Highlight"}(_e||(_e={}));const le=[],ce=[],pe=E(),me=E(),ge=E();export{_e as FramebufferId,de as Renderer};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import{update as t}from"../../../../core/arrayUtils.js";import s from"../../../../core/Handles.js";import has from"../../../../core/has.js";import{someMap as i}from"../../../../core/MapUtils.js";import{destroyMaybe as n,disposeMaybe as a,isSome as h,isNone as d,applySome as o,unwrap as _}from"../../../../core/maybe.js";import{watch as l,syncAndInitial as c,initial as p,sync as m}from"../../../../core/reactiveUtils.js";import{Milliseconds as g}from"../../../../core/time.js";import{property as u}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as f}from"../../../../core/accessorSupport/decorators/subclass.js";import{j as T,a as R,m as b}from"../../../../chunks/mat4.js";import{I as P,c as E}from"../../../../chunks/mat4f64.js";import{a as A}from"../../../../chunks/boundedPlane.js";import{MAXIMUM_ANIMATION_LOAD as w,MINIMUM_IDLE_ANIMATION_MS as S}from"../../support/animationUtils.js";import C from"../../support/debugFlags.js";import{RenderPassManager as x}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as O}from"../core/shaderLibrary/ShaderOutput.js";import{HUDTransparentRenderStyle as y}from"../core/shaderLibrary/hud/HUDUniforms.js";import{Decorations as D,RenderRequestType as H,StencilBits as I}from"./basicInterfaces.js";import{BoundingInfo as M}from"./BoundingInfo.js";import{ZERO as L,union as v}from"./depthRange.js";import{depthRangeFromScene as N}from"./depthRangeUtils.js";import{createEmptyDepthTexture as U}from"./glUtil3D.js";import{Highlight as j}from"./Highlight.js";import{RenderOccludedFlag as q}from"./Material.js";import{OffscreenRendering as F}from"./OffscreenRendering.js";import{RenderContext as V}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as G}from"./rendererUtils.js";import{RenderPluginManager as B}from"./RenderPluginManager.js";import{RenderSlot as k}from"./RenderSlot.js";import{ShadowAccumulator as W}from"./ShadowAccumulator.js";import{ShadowHighlight as Q}from"./ShadowHighlight.js";import{ShadowMap as z,SnapshotSlot as X}from"./ShadowMap.js";import Y from"./SliceHelper.js";import{SmaaRenderPass as K}from"./SmaaRenderPass.js";import{SSAOHelper as J}from"./SSAOHelper.js";import{TransparencyPassType as Z}from"./TransparencyPassType.js";import{EdgeView as $}from"./edgeRendering/EdgeView.js";import{Transparency as ee}from"./edgeRendering/interfaces.js";import{MergedRenderer as re}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as te}from"../shaders/CompositingTechniqueConfiguration.js";import{RendererPerformanceInfo as se,Statistics as ie}from"../statistics/RendererPerformanceInfo.js";import{ClearBufferBit as ne,PixelFormat as ae,PixelType as he}from"../../../webgl/enums.js";const de=.9;let oe=class extends r{constructor(e,r,t,i,n,a,h,d,o){super({}),this._materialRepository=e,this._shaderTechniqueRepository=t,this._rctx=i,this._compositingHelper=n,this._magnifierHelper=a,this._requestRender=h,this._stage=o,this._materialRenderers=new Map,this._needsTransparentPass=!1,this._hasHUDElements=!1,this._hasHighlights=!1,this._hasWater=!1,this._hasOverlayWater=!1,this._content=new Map,this._isRendering=!1,this._fallbackDepthStencilTexture=null,this.performanceInfo=new se,this._antialiasing=!0,this._oitEnabled=!1,this._multipassTerrain=!0,this._transparentTerrain=!1,this._hasAnimations=!1,this._animationTimestep=g(0),this._handles=new s,this._renderHiddenTransparentEdges=()=>{},this._oitUsed=!1,this._smaaPass=new K(this._rctx,t),this._oitEnabled=this._hasOITSupport,this._requestRender(),this._offscreenRendering=new F(this._rctx,this._compositingHelper),this._sliceHelper=new Y,this._shadowMap=new z(this._rctx,o.viewingMode,2),this._ssaoHelper=new J(t,this._rctx,(()=>this._requestRender())),this._highlight=new j(t,this._rctx),this._shadowHighlight=new Q(this._rctx,o.viewingMode),this._shadowAccumulator=new W(this._rctx,t,o,(e=>{const r=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureCameraBindParameters(e.camera,e.contentCamera),this._renderPlugins.prepareRender(),this._shadowMap.enabled=r}),((e,r,t)=>{e.shadowMap.start(e.camera,r,t),this._renderShadowCascades(O.Shadow,e.shadowMap),e.camera.setGLViewport(this._rctx),this._ensureCameraBindParameters(e.camera,e.contentCamera)}),(()=>this._requestRender())),this._renderContext=new V(this._rctx,this._offscreenRendering,this._shadowMap,this._ssaoHelper,this._sliceHelper),this._renderPlugins=new B({renderContext:this._renderContext,shaderTechniqueRepository:t,textureRep:r,materialRep:this._materialRepository,requestRender:this._requestRender,schedule:d}),this.renderPassManager=new x(this._rctx,this._shaderTechniqueRepository),this._renderPlugins.add(this.renderPassManager.slots(),this.renderPassManager),this._handles.add([l((()=>this._stage.state.camera),(()=>this._requestRender()),c),l((()=>C.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(ee.TRANSPARENT):()=>{},this._requestRender()}),p)])}get _bindParameters(){return this._renderContext.bindParameters}get hasWater(){return this._hasWater||this._hasOverlayWater}get hasWaterReflection(){return this.hasWater&&this._waterReflectionEnabled}normalizeCtorArgs(){return{}}dispose(){this._handles.destroy(),this._smaaPass.dispose(),this._materialRenderers.forEach((e=>e.dispose())),this._materialRenderers.clear(),this._edgeView=n(this._edgeView),this._offscreenRendering.dispose(),this._fallbackDepthStencilTexture=a(this._fallbackDepthStencilTexture),this._shadowMap.enabled=!1,this._shadowMap.dispose(),this._ssaoHelper.enabled=!1,this._ssaoHelper.dispose(),this._highlight.dispose(),this._shadowHighlight.dispose(),this._shadowAccumulator.dispose(),M.prune(),this._content.clear()}disposeOffscreenBuffers(){this._offscreenRendering.dispose(),this._shadowMap.dispose(),this._smaaPass.disable(),this._ssaoHelper.disposeOffscreenBuffers()}get updating(){return this._antialiasing&&this._smaaPass.updating||h(this._edgeView)&&this._edgeView.updating||this._shadowAccumulator.running||!this.isCameraFinal}ensureEdgeView(){return d(this._edgeView)&&(this._edgeView=new $({rctx:this._rctx,renderSR:this._stage.renderSR,viewingMode:this._stage.viewingMode,techniqueRepository:this._shaderTechniqueRepository,setNeedsRender:()=>this._requestRender(),schedule:e=>this._stage.resourceController.schedule(e)}),this._handles.add(l((()=>o(this._edgeView,(e=>e.updating))),(()=>this._requestRender()),m)),this._requestRender()),this._edgeView}get edgeView(){return this._edgeView}get isCameraFinal(){return T(this._bindParameters.ssr.reprojectionMatrix,P)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this.notifyChange("isCameraFinal")}get shadowsEnabled(){return!!this._shadowMap?.enabled}setRenderParameters(e){const{_shadowMap:r,_ssaoHelper:t,_bindParameters:s}=this;if(void 0!==e.screenSpaceReflectionsEnabled&&s.ssr.enabled!==e.screenSpaceReflectionsEnabled&&(s.ssr.enabled=e.screenSpaceReflectionsEnabled,this._requestRender()),void 0!==e.shadowMap&&r.enabled!==e.shadowMap&&(r.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&r.maxCascades!==e.shadowMapMaxCascades&&(r.maxCascades=e.shadowMapMaxCascades,this._requestRender()),h(e.environment)){h(e.environment.weather)&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=e.weatherVisible,this._renderContext.bindParameters.weather=e.environment.weather,this._renderContext.bindParameters.weatherVisible=e.weatherVisible),void 0!==e.environment.lighting.ambientOcclusionEnabled&&t.enabled!==e.environment.lighting.ambientOcclusionEnabled&&(t.enabled=e.environment.lighting.ambientOcclusionEnabled,this._requestRender()),void 0!==e.environment.lighting.waterReflectionEnabled&&this._waterReflectionEnabled!==e.environment.lighting.waterReflectionEnabled&&(this._waterReflectionEnabled=e.environment.lighting.waterReflectionEnabled,this._requestRender());const r="virtual"!==e.environment.lighting.type;s.enableFillLights!==r&&(s.enableFillLights=r,this._requestRender())}e.background&&this._offscreenRendering.background!==e.background&&(this._offscreenRendering.background=e.background,this._requestRender()),void 0!==e.antialiasingEnabled&&this._antialiasing!==e.antialiasingEnabled&&(this._antialiasing=e.antialiasingEnabled,this._requestRender()),void 0!==e.highQualityTransparency&&this._multipassTerrain!==e.highQualityTransparency&&(this._multipassTerrain=e.highQualityTransparency,this._oitEnabled=e.highQualityTransparency&&this._hasOITSupport,this._requestRender()),void 0!==e.defaultHighlightOptions&&(this._highlight.setDefaultOptions(e.defaultHighlightOptions),this._shadowHighlight.setDefaultOptions(e.defaultHighlightOptions),this._requestRender()),void 0!==e.overlays&&this._bindParameters.overlays!==e.overlays&&(this._bindParameters.overlays=e.overlays,this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=_(e.slicePlane),this._requestRender()),void 0!==e.transparentTerrain&&this._transparentTerrain!==e.transparentTerrain&&(this._transparentTerrain=e.transparentTerrain,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.shadowCastOptions&&this._shadowAccumulator.setOptions(e.shadowCastOptions)}get hasSlicePlane(){return!!this._sliceHelper.plane}get renderPlugins(){return this._renderPlugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlendWorking}modify(e){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:r,removes:t,updates:s}=e;if(0===r.length&&0===t.length&&0===s.length)return;t.forAll((({id:e})=>this._content.delete(e))),r.forAll((e=>this._content.set(e.id,e)));const n=G(e);let a=!1;n.forEach(((e,r)=>{let t=this._materialRenderers.get(r);if(!t){if(!(e.adds.length>0))return;t=new re(this._rctx,this._materialRepository,r),this._materialRenderers.set(r,t)}t.modify(e),t.isEmpty&&(a=!0)})),a&&this._materialRenderers.forEach(((e,r)=>{e.isEmpty&&(this._materialRenderers.delete(r),e.dispose())})),this._hasHighlights=i(this._materialRenderers,(e=>e.hasHighlights)),this._bindParameters.hasOccludees=i(this._materialRenderers,(e=>e.hasOccludees)),this._hasWater=i(this._materialRenderers,(e=>e.hasWater)),this._needsTransparentPass=i(this._materialRenderers,(e=>e.requiresSlot(k.TRANSPARENT_MATERIAL,O.Color))),this._hasHUDElements=i(this._materialRenderers,(e=>e.requiresSlot(k.LINE_CALLOUTS_HUD_DEPTH,O.Color)||e.requiresSlot(k.HUD_MATERIAL,O.Color)||e.requiresSlot(k.LABEL_MATERIAL,O.Color))),this._requestRender()}updateAnimation(e){return this._hasAnimations=!1,this._materialRenderers.forEach((r=>this._hasAnimations=r.updateAnimation(e)||this._hasAnimations)),this._hasAnimations=this._renderPlugins.updateAnimation(e)||this._hasAnimations,this._hasAnimations}get animationTimestep(){return this._animationTimestep}updateLightSources(e,r,t){this._bindParameters.lighting.groundLightingFactor=r,this._bindParameters.lighting.globalFactor=t,this._bindParameters.lighting.set(e)}render(e,r,t,s,i){this._isRendering=!0,this.performanceInfo.prerender(this._rctx),this._bindParameters.transparencyPassType=Z.NONE;const n=this._offscreenRendering;n.needLastFrameColorTexture=this.hasWaterReflection,n.advanceCurrentRenderTarget();const a=A(this._sliceHelper.plane);i===D.OFF&&(this._sliceHelper.plane=null),this._rctx.bindFramebuffer(e),t.setGLViewport(this._rctx),this._ensureCameraBindParameters(t,s),this._renderPlugins.prepareRender(),this.performanceInfo.advance(ie.Prepare);const o=this._computeDepthRange(t);this._renderShadowMap(e,t,this._bindParameters.lighting.lightingMainDirection,o),this.performanceInfo.advance(ie.Shadowmap),n.initializeFrame(t),this._ensureBindParameters(t,s),this._renderLinearDepth(),this.performanceInfo.advance(ie.Lineardepth),this._accumulateShadows(o,t,s),this._renderNormal(),this.performanceInfo.advance(ie.Normals),this._renderObjectAndLayerIdColor(r),this._ensureBindParametersSSR(),this._ssaoHelper.computeSSAO(this._bindParameters,n.linearDepthTexture,n.normalTexture),this.performanceInfo.advance(ie.SSAO),this._renderContext.output=O.Color,n.bindFramebuffer(),this._renderOpaqueGeometry(),this.performanceInfo.advance(ie.Opaque);const _=this._multipassTerrain&&this._transparentTerrain;this._renderTerrainLinearDepth(_),this._setMultipassEnabled(_),this._setTerrainCulling(_),this._renderEdges(ee.OPAQUE),this.performanceInfo.advance(ie.OpaqueEdges),this._offscreenRendering.bindTarget(this._offscreenRendering.currentColorTarget,this._offscreenRendering.mainDepth),this._renderSlot(k.VOXEL),this._renderHiddenTransparentEdges();const l=this._needsTransparentPass||this._renderPlugins.needsTransparentPass;l&&(this._oitEnabled?this._renderOrderIndependentTransparency((()=>this._renderTransparentGeometry()),!1):this._renderTransparentGeometry()),this.performanceInfo.advance(ie.Transparent),this._renderGeometryLinearDepth(_);const c=this._renderHUDVisibility();_||this._renderInternalSlot(k.LINE_CALLOUTS),this.performanceInfo.advance(ie.Hudvisibility),this._renderEdges(ee.TRANSPARENT,_),this.performanceInfo.advance(ie.TransparentEdges),this._renderTransparentTerrain(),this._transparentTerrain&&c&&(_?this._renderLineCallouts(y.Occluded):n.compositeTransparentTerrainOntoHUDVisibility(this._bindParameters),this._renderHUD(y.Occluded,n.framebuffer),this.performanceInfo.advance(ie.HudOccluded)),this.performanceInfo.advance(ie.TransparentTerrain),this._setTerrainCulling(!1),this._transparentTerrain&&(n.compositeTransparentTerrainOntoMain(this._bindParameters),_&&(this._renderEdges(ee.OPAQUE),this.performanceInfo.advance(ie.OpaqueEdges),l&&(this._oitEnabled?this._renderOrderIndependentTransparency((()=>this._renderTransparentGeometry()),!1):this._renderTransparentGeometry()),this.performanceInfo.advance(ie.Transparent),this._renderEdges(ee.TRANSPARENT),this.performanceInfo.advance(ie.TransparentEdges))),_&&this._renderLineCallouts(y.NotOccluded),this._setMultipassEnabled(!1),this._shadowAccumulator.render(this._bindParameters),n.renderToTargets((()=>{this._renderInternalSlot(k.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._renderSlot(k.POSTPROCESSING_ENVIRONMENT_TRANSPARENT),this._renderSlot(k.LASERLINES)}),n.currentColorTarget,n.mainDepth),this.performanceInfo.advance(ie.Atmosphere),this._renderPlugins.needsLaserlineWithContrastControl&&n.renderTmpAndCompositeToMain((()=>this._renderSlot(k.LASERLINES_CONTRAST_CONTROL)),this._bindParameters,te.PremultipliedAlpha),this.performanceInfo.advance(ie.Laserline),this._renderOccluded(),this.performanceInfo.advance(ie.Occluded);const p=i===D.ON&&this._magnifierHelper.enabled,m=p&&d(e)?this._offscreenRendering.getFramebuffer(this._offscreenRendering.tmpColor,this._offscreenRendering.tmpDepth):e;this._rctx.bindFramebuffer(m);const g=this._offscreenRendering.colorTexture;!this._renderAntiAliasing(g)&&h(g)&&this._compositingHelper.composite(this._bindParameters,g,te.None),this.performanceInfo.advance(ie.Antialiasing),this._renderHUD(y.NotOccluded,m),this.performanceInfo.advance(ie.HudNotoccluded),this._renderHighlights(m,this._bindParameters),this.performanceInfo.advance(ie.Highlights),p&&this._magnifierHelper.render(this._rctx,this._bindParameters),m!==e&&(this._rctx.bindFramebuffer(e),this._compositingHelper.composite(this._bindParameters,this._offscreenRendering.tmpColorTexture,te.None)),this._disposeOITBuffers(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=a,this._isRendering=!1,this.onPostRender&&this.onPostRender(),this.performanceInfo.postrender()}_renderObjectAndLayerIdColor(e){h(e)&&has("enable-feature:objectAndLayerId-rendering")&&(this._rctx.bindFramebuffer(e),this._offscreenRendering.renderToFBO((()=>{this._renderGeometryAndTransparentTerrainPass(O.ObjectAndLayerIdColor)}),[0,0,0,0],!0,!0))}finish(e){if(this._hasAnimations||(this._animationTimestep=g(0)),e===H.BACKGROUND){this._rctx.gl.getError();const e=this.performanceInfo.elapsedTime/w;this._animationTimestep=g(Math.max(this._animationTimestep*de+e*(1-de),S))}}readDepthPixels(e,r,t){const s=this._offscreenRendering.bindTarget(this._offscreenRendering.linearDepth,this._offscreenRendering.tmpDepth);if(!this._needsLinearDepth){this._ensureBindParameters(e,e),this._bindParameters.camera.setGLViewport(this._rctx),this._rctx.setClearColor(0,0,0,0);const r=ne.COLOR_BUFFER_BIT|ne.DEPTH_BUFFER_BIT|ne.STENCIL_BUFFER_BIT;this._rctx.clearSafe(r),this._renderGeometryAndTransparentTerrainPass(O.Depth)}s.readPixels(r[0],r[1],r[2],r[3],ae.RGBA,he.UNSIGNED_BYTE,t)}readHUDVisibility(e,r,t,s,i){this._offscreenRendering.bindTarget(this._offscreenRendering.hudVisibility).readPixels(e,r,t,s,ae.RGBA,he.UNSIGNED_BYTE,i)}readAccumulatedShadow(e,r){return this._shadowAccumulator.readAccumulatedShadow(e,r)}_setMultipassEnabled(e){this._bindParameters.multipassTerrain.enabled=this._bindParameters.multipassGeometry.enabled=e}_setTerrainCulling(e){this._bindParameters.multipassTerrain.cullAboveGround=e}_renderSlot(e){this._bindParameters.slot=e,this._renderPlugins.render()}_renderEdges(e,r=!1){const t=this._edgeView;h(t)&&t.shouldRender()&&this._offscreenRendering.renderTmpAndCompositeToMain((()=>t.render(this._bindParameters,e)),this._bindParameters,te.Alpha,r)}_renderShadowMap(e,r,t,s){const i=this._shadowMap;i.enabled&&(i.start(r,t,s),this._shadowHighlight.updateParameters(r,t),this._needsShadowHighlight?(this._renderShadowCascades(O.ShadowHighlight,this._shadowMap,(e=>i.takeCascadeSnapshotTo(e,X.Highlight))),i.clear(),this._renderShadowCascades(O.ShadowExludeHighlight,this._shadowMap,(e=>{i.takeCascadeSnapshotTo(e,X.Default),this._renderGeometryAndTransparentTerrainPass(O.ShadowHighlight)}))):this._renderShadowCascades(O.Shadow),i.finish(e),r.setGLViewport(this._rctx))}_renderShadowCascades(e,r=this._shadowMap,t=(e=>{})){for(const s of r.getCascades())s.camera.setGLViewport(this._rctx),this._ensureCameraBindParameters(s.camera,s.camera),this._renderGeometryAndTransparentTerrainPass(e),t(s)}get _needsLinearDepth(){return this._ssaoHelper.enabled||this._renderPlugins.needsLinearDepth||this._hasWater&&this._waterReflectionEnabled||this._needsShadowHighlight||this._needsShadowCast}_renderLinearDepth(){this._needsLinearDepth?this._offscreenRendering.renderToTargets((()=>this._renderGeometryAndTransparentTerrainPass(O.Depth)),this._offscreenRendering.linearDepth,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0):this._offscreenRendering.disposeTarget(this._offscreenRendering.linearDepth),this._bindParameters.linearDepthTexture=this._offscreenRendering.linearDepthTexture}_renderTerrainLinearDepth(e){if(e){const e=this._renderContext.output;this._renderContext.output=O.Depth,this._offscreenRendering.renderToTargets((()=>this._renderTransparentTerrain()),this._offscreenRendering.terrainLinearDepth,this._offscreenRendering.tmpDepth,[-1e10,-1e10,-1e10,1],!0,!0),this._renderContext.output=e}else this._offscreenRendering.disposeTarget(this._offscreenRendering.terrainLinearDepth);this._bindParameters.multipassTerrain.linearDepthTexture=this._offscreenRendering.terrainLinearDepthTexture}_renderGeometryLinearDepth(e){if(e){const e=this._renderContext.output;this._offscreenRendering.renderToTargets((()=>this._renderGeometryPass(O.Depth)),this._offscreenRendering.geometryLinearDepth,this._offscreenRendering.tmpDepth,[1,1,1,1],!0,!0),this._renderContext.output=e}else this._offscreenRendering.disposeTarget(this._offscreenRendering.geometryLinearDepth);this._bindParameters.multipassGeometry.linearDepthTexture=this._offscreenRendering.geometryLinearDepthTexture}get _needsNormal(){return this._ssaoHelper.enabled}_renderNormal(){this._needsNormal?this._offscreenRendering.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(O.Normal)}),this._offscreenRendering.normal,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0):this._offscreenRendering.disposeTarget(this._offscreenRendering.normal)}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowCast}_computeDepthRange(e){if(!this._needsDepthRange)return L;const r=N(e,this._content,this._stage.layers);return v(r,this.renderPlugins.queryDepthRange(e)),r.near=Math.max(e.near,r.near),r.far=Math.min(e.far,r.far),r}_renderGeometryAndTransparentTerrainPass(e){this._renderContext.output=e,this._renderGeometryPass(e),this._renderTransparentTerrain()}_renderGeometryPass(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderOpaqueGeometry(){this._renderSlot(k.INTEGRATED_MESH),this._renderSlot(k.OPAQUE_TERRAIN),this._renderInternalSlot(k.OPAQUE_MATERIAL),this._renderSlot(k.OPAQUE_MATERIAL),this._renderSlot(k.POSTPROCESSING_ENVIRONMENT_OPAQUE)}_renderTransparentGeometry(){this._renderInternalSlot(k.TRANSPARENT_MATERIAL),this._renderSlot(k.TRANSPARENT_MATERIAL)}_renderTransparentTerrain(){this._renderSlot(k.TRANSPARENT_TERRAIN)}_renderHUDVisibility(){let e=!1;return this._renderContext.offscreenRenderingHelper&&this._renderContext.offscreenRenderingHelper.renderHUDVisibility((()=>{this._bindParameters.hudVisibilityTexture=this._renderContext.offscreenRenderingHelper.hudVisibilityTexture,e=this._renderInternalSlot(k.OCCLUSION_PIXELS)}),this._multipassTerrain&&this._transparentTerrain),e}_renderLineCallouts(e){this._bindParameters.renderTransparentlyOccludedHUD=e,e===y.Occluded?this._offscreenRendering.renderToTargets((()=>this._renderInternalSlot(k.LINE_CALLOUTS)),this._offscreenRendering.currentColorTarget,this._offscreenRendering.tmpDepth,void 0,!0,!0):this._renderInternalSlot(k.LINE_CALLOUTS)}_renderHUD(e,r){this._hasHUDElements&&(this._oitEnabled?(this._renderOrderIndependentTransparency((()=>this._renderHUDElements(e)),!0),this._rctx.bindFramebuffer(r),this._compositingHelper.composite(this._bindParameters,this._offscreenRendering.hudColorTexture,te.PremultipliedAlpha)):e===y.Occluded?this._offscreenRendering.renderToTargets((()=>this._renderHUDElements(y.Occluded)),this._offscreenRendering.currentColorTarget,this._offscreenRendering.tmpDepth,void 0,!0,!0):this._renderHUDElements(e))}_renderHUDElements(e){this._bindParameters.renderTransparentlyOccludedHUD=e,this._renderInternalSlot(k.LINE_CALLOUTS_HUD_DEPTH),this._renderInternalSlot(k.HUD_MATERIAL),this._renderInternalSlot(k.LABEL_MATERIAL)}get _needsHighlight(){return this._hasHighlights||this._renderPlugins.needsHighlight}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._shadowHighlight.isVisible&&this._needsHighlight}_renderHighlights(e,r){if(!this._needsHighlight)return void this._offscreenRendering.disposeTarget(this._offscreenRendering.highlight);const t=this._highlight,s=this._offscreenRendering.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(O.Highlight),this._rctx.clearSafe(ne.DEPTH_BUFFER_BIT),this._renderHUDElements(y.Both)}),this._offscreenRendering.highlight,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0);this._bindParameters.highlightColorTexture=s.colorTexture,this._needsShadowHighlight&&this._shadowHighlight.render(r,e),t.render(this._bindParameters,s,e)}get _needsShadowCast(){return this._shadowAccumulator.isAccumulating}_accumulateShadows(e,r,t){this._needsShadowCast&&this._shadowAccumulator.renderAccumulation(this._offscreenRendering.linearDepthTexture,e,r,t)}_renderOrderIndependentTransparency(e,r){const t=t=>{this._bindParameters.transparencyPassType=t,this._offscreenRendering.renderOITPass((()=>e()),t,r)},s=this._renderContext.output;this._renderContext.output=O.Alpha,t(Z.Alpha),this._renderContext.output=O.Color,t(Z.Color),t(Z.FrontFace),this._offscreenRendering.compositeTransparentOntoOpaque(this._bindParameters,r),this._bindParameters.transparencyPassType=Z.NONE,this._renderContext.output=s,this._oitUsed=!0}_disposeOITBuffers(){this._oitUsed||(this._offscreenRendering.disposeTarget(this._offscreenRendering.alphaFloatTarget),this._offscreenRendering.disposeTarget(this._offscreenRendering.colorFloatTarget),this._offscreenRendering.disposeTarget(this._offscreenRendering.frontFaceTarget)),this._oitUsed=!1}_renderOccluded(){let e=0;this._materialRenderers.forEach(((r,t)=>{t&&t.isVisible()&&t.renderOccluded===q.OccludeAndTransparentStencil&&(e|=t.renderOccluded,ce.push(t))}));const r=this._offscreenRendering,t=(t,s,i,n,a)=>{0!=(e&s)&&(r.renderToTargets(i,r.tmpColor,r.mainDepth,[0,0,0,0],n,a),r.compositeOccludedOntoMain(this._bindParameters,t))};0!==ce.length&&(this._renderInternalSlot(k.OCCLUDER_MATERIAL,ce),t(.5,q.OccludeAndTransparentStencil,(()=>this._renderInternalSlot(k.TRANSPARENT_OCCLUDER_MATERIAL,ce)),!1,!1),ce.length=0),this._materialRenderers.forEach(((r,t)=>{t&&t.isVisible()&&(t.renderOccluded===q.OccludeAndTransparent||t.renderOccluded===q.Transparent||t.renderOccluded===q.Opaque)&&(e|=t.renderOccluded,le.push(t))}));const s=this._renderPlugins.renderOccludedFlags;if(e|=s,!e)return;const i=e=>{this._renderContext.renderOccludedMask=e,s>q.Occlude&&this._renderSlot(k.OCCLUDED_TERRAIN),this._renderInternalSlot(k.OPAQUE_MATERIAL,le),this._renderInternalSlot(k.TRANSPARENT_MATERIAL,le),this._renderInternalSlot(k.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,le),this._renderContext.resetRenderOccludedMask()};this._renderContext.output=O.Color,t(.5,q.OccludeAndTransparent,(()=>i(q.OccludeAndTransparent)),!0,I.OutlineVisualElementMask),t(.5,q.Transparent,(()=>i(q.Transparent)),!0,I.OutlineVisualElementMask),t(1,q.Opaque,(()=>i(q.Opaque)),!0,I.OutlineVisualElementMask),le.length=0}_renderAntiAliasing(e){if(this._antialiasing){if(this._smaaPass.enable((()=>this._requestRender()))&&h(e))return this._smaaPass.render(e),!0}else this._smaaPass.disable();return!1}_ensureCameraBindParameters(e,r){this._bindParameters.camera=e,this._bindParameters.contentCamera=r}_ensureBindParameters(e,r){this._ensureCameraBindParameters(e,r);const t=this._renderContext.offscreenRenderingHelper;this._bindParameters.hudVisibilityTexture=t.hudVisibilityTexture,this._bindParameters.mainColorTexture=t.mainColorTexture,this._bindParameters.highlightDepthTexture=t.depthTexture??this._getFallbackDepthTexture()}_ensureBindParametersSSR(){this.hasWaterReflection?(this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=P:(R(me,this._bindParameters.camera.viewMatrix),R(pe,this._bindParameters.camera.projectionMatrix),b(ge,me,pe),b(ge,this._renderContext.lastFrameCamera.viewMatrix,ge),b(ge,this._renderContext.lastFrameCamera.projectionMatrix,ge),this._reprojectionMatrix=ge),this._bindParameters.ssr.lastFrameColorTexture=this._offscreenRendering.lastFrameColorTexture):this._bindParameters.ssr.lastFrameColorTexture=null,this._bindParameters.ssr.enabled=this.hasWaterReflection}_renderInternalSlot(e,r){let t=!1;return this._bindParameters.slot=e,h(r)?r.forEach((e=>{if(!e.shouldRender(this._renderContext))return;const r=this._materialRenderers.get(e);h(r)&&(t=r.render(this._renderContext.output,this._bindParameters)||t)})):this._materialRenderers.forEach(((e,r)=>{r.shouldRender(this._renderContext)&&e.render(this._renderContext.output,this._bindParameters)&&(t=!0)})),t}_getFallbackDepthTexture(){return this._fallbackDepthStencilTexture||(this._fallbackDepthStencilTexture=U(this._rctx)),this._fallbackDepthStencilTexture}get gpuMemoryUsage(){return{offscreen:this._offscreenRendering?.gpuMemoryUsage??0,highlights:(this._highlight?.gpuMemoryUsage??0)+(this._shadowHighlight?.gpuMemoryUsage??0),shadows:this._shadowMap?.gpuMemoryUsage??0,ssao:this._ssaoHelper?.gpuMemoryUsage??0}}get test(){const e=this;return{offscreen:this._offscreenRendering,shadowMap:this._shadowMap,ssao:this._ssaoHelper,highlight:this._highlight,lighting:this._bindParameters.lighting,materialRenderers:this._materialRenderers,shadowAccumulator:this._shadowAccumulator,getFramebufferTexture:r=>{switch(r){case _e.Color:return e._offscreenRendering.colorTexture;case _e.LinearDepth:return e._offscreenRendering.linearDepthTexture;case _e.Normals:return e._offscreenRendering.normalTexture;case _e.ShadowMap:return e._shadowMap.depthTexture;case _e.HudVisibility:return e._offscreenRendering.hudVisibilityTexture;case _e.Highlight:return e._offscreenRendering.highlightTexture}}}}};var _e;e([u()],oe.prototype,"_shadowAccumulator",void 0),e([u()],oe.prototype,"_smaaPass",void 0),e([u()],oe.prototype,"_antialiasing",void 0),e([u()],oe.prototype,"_edgeView",void 0),e([u()],oe.prototype,"updating",null),e([u()],oe.prototype,"isCameraFinal",null),oe=e([f("esri.views.3d.webgl-engine.lib.Renderer")],oe),function(e){e[e.Color=0]="Color",e[e.LinearDepth=1]="LinearDepth",e[e.Normals=2]="Normals",e[e.ShadowMap=3]="ShadowMap",e[e.HudVisibility=4]="HudVisibility",e[e.Highlight=5]="Highlight"}(_e||(_e={}));const le=[],ce=[],pe=E(),me=E(),ge=E();export{_e as FramebufferId,oe 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/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as s}from"../../../../chunks/tslib.es6.js";import{parameter as e,ShaderTechniqueConfiguration as o}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";class r extends o{constructor(){super(...arguments),this.hasAlpha=!1}}s([e()],r.prototype,"hasAlpha",void 0);export{r as TextureTechniqueConfiguration};
5
+ import{_ as s}from"../../../../chunks/tslib.es6.js";import{ShaderTechniqueConfiguration as e,parameter as o}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";class r extends e{constructor(){super(...arguments),this.hasAlpha=!1}}s([o()],r.prototype,"hasAlpha",void 0);export{r as TextureTechniqueConfiguration};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- var O;!function(O){O.POSITION="position",O.NORMAL="normal",O.UV0="uv0",O.AUXPOS1="auxpos1",O.AUXPOS2="auxpos2",O.MAPPOS="mapPos",O.COLOR="color",O.SYMBOLCOLOR="symbolColor",O.SIZE="size",O.TANGENT="tangent",O.OFFSET="offset",O.SUBDIVISIONFACTOR="subdivisionFactor",O.COLORFEATUREATTRIBUTE="colorFeatureAttribute",O.SIZEFEATUREATTRIBUTE="sizeFeatureAttribute",O.OPACITYFEATUREATTRIBUTE="opacityFeatureAttribute",O.DISTANCETOSTART="distanceToStart",O.UVMAPSPACE="uvMapSpace",O.BOUNDINGRECT="boundingRect",O.UVREGION="uvRegion",O.NORMALCOMPRESSED="normalCompressed",O.PROFILERIGHT="profileRight",O.PROFILEUP="profileUp",O.PROFILEVERTEXANDNORMAL="profileVertexAndNormal",O.FEATUREVALUE="featureValue",O.MODELORIGINHI="modelOriginHi",O.MODELORIGINLO="modelOriginLo",O.MODEL="model",O.MODELNORMAL="modelNormal",O.INSTANCECOLOR="instanceColor",O.INSTANCEFEATUREATTRIBUTE="instanceFeatureAttribute",O.LOCALTRANSFORM="localTransform",O.GLOBALTRANSFORM="globalTransform",O.BOUNDINGSPHERE="boundingSphere",O.MODELORIGIN="modelOrigin",O.MODELSCALEFACTORS="modelScaleFactors",O.FEATUREATTRIBUTE="featureAttribute",O.STATE="state",O.LODLEVEL="lodLevel",O.POSITION0="position0",O.POSITION1="position1",O.NORMALA="normalA",O.NORMALB="normalB",O.COMPONENTINDEX="componentIndex",O.VARIANTOFFSET="variantOffset",O.VARIANTSTROKE="variantStroke",O.VARIANTEXTENSION="variantExtension",O.U8PADDING="u8padding",O.U16PADDING="u16padding",O.SIDENESS="sideness",O.START="start",O.END="end",O.UP="up",O.EXTRUDE="extrude"}(O||(O={}));export{O as VertexAttribute};
5
+ var O;!function(O){O.POSITION="position",O.NORMAL="normal",O.UV0="uv0",O.AUXPOS1="auxpos1",O.AUXPOS2="auxpos2",O.MAPPOS="mapPos",O.COLOR="color",O.SYMBOLCOLOR="symbolColor",O.SIZE="size",O.TANGENT="tangent",O.OFFSET="offset",O.SUBDIVISIONFACTOR="subdivisionFactor",O.COLORFEATUREATTRIBUTE="colorFeatureAttribute",O.SIZEFEATUREATTRIBUTE="sizeFeatureAttribute",O.OPACITYFEATUREATTRIBUTE="opacityFeatureAttribute",O.DISTANCETOSTART="distanceToStart",O.UVMAPSPACE="uvMapSpace",O.BOUNDINGRECT="boundingRect",O.UVREGION="uvRegion",O.NORMALCOMPRESSED="normalCompressed",O.PROFILERIGHT="profileRight",O.PROFILEUP="profileUp",O.PROFILEVERTEXANDNORMAL="profileVertexAndNormal",O.FEATUREVALUE="featureValue",O.MODELORIGINHI="modelOriginHi",O.MODELORIGINLO="modelOriginLo",O.MODEL="model",O.MODELNORMAL="modelNormal",O.INSTANCECOLOR="instanceColor",O.INSTANCEFEATUREATTRIBUTE="instanceFeatureAttribute",O.LOCALTRANSFORM="localTransform",O.GLOBALTRANSFORM="globalTransform",O.BOUNDINGSPHERE="boundingSphere",O.MODELORIGIN="modelOrigin",O.MODELSCALEFACTORS="modelScaleFactors",O.FEATUREATTRIBUTE="featureAttribute",O.STATE="state",O.LODLEVEL="lodLevel",O.POSITION0="position0",O.POSITION1="position1",O.NORMALA="normalA",O.NORMALB="normalB",O.COMPONENTINDEX="componentIndex",O.VARIANTOFFSET="variantOffset",O.VARIANTSTROKE="variantStroke",O.VARIANTEXTENSION="variantExtension",O.U8PADDING="u8padding",O.U16PADDING="u16padding",O.SIDENESS="sideness",O.START="start",O.END="end",O.UP="up",O.EXTRUDE="extrude",O.OBJECTANDLAYERIDCOLOR="objectAndLayerIdColor",O.OBJECTANDLAYERIDCOLOR_INSTANCED="objectAndLayerIdColor_instanced"}(O||(O={}));export{O as VertexAttribute};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{s as t,a as n,g as r,j as e}from"../../../../chunks/vec3.js";import{c as o}from"../../../../chunks/vec3f64.js";import{areaPoints3d as i}from"../../../../geometry/support/triangle.js";let s=(()=>{const t=new Uint32Array(131072);for(let n=0;n<t.length;++n)t[n]=n;return t})();const f=new Uint16Array([0]),c=(()=>{const t=new Uint16Array(65536);for(let n=0;n<t.length;++n)t[n]=n;return t})();function l(t){if(1===t)return f;if(t<c.length)return new Uint16Array(c.buffer,0,t);if(t>s.length){const n=Math.max(2*s.length,t);s=new Uint32Array(n);for(let t=0;t<s.length;t++)s[t]=t}return new Uint32Array(s.buffer,0,t)}function a(t){if(1===t)return new Uint16Array(f);if(t<c.length)return new Uint16Array(c.slice(0,t));if(t>s.length){const n=new Uint32Array(t);for(let t=0;t<n.length;t++)n[t]=t;return n}return new Uint32Array(s.slice(0,t))}function u(e,o,s){if(!e)return!1;const{size:f,data:c}=e;t(s,0,0,0),t(U,0,0,0);let l=0,a=0;for(let u=0;u<o.length-2;u+=3){const e=o[u+0]*f,g=o[u+1]*f,h=o[u+2]*f;t(y,c[e+0],c[e+1],c[e+2]),t(w,c[g+0],c[g+1],c[g+2]),t(A,c[h+0],c[h+1],c[h+2]);const m=i(y,w,A);m?(n(y,y,w),n(y,y,A),r(y,y,1/3*m),n(s,s,y),l+=m):(n(U,U,y),n(U,U,w),n(U,U,A),a+=3)}return(0!==a||0!==l)&&(0!==l?(r(s,s,1/l),!0):0!==a&&(r(s,U,1/a),!0))}function g(n,e,o){if(!n||!e)return!1;const{size:i,data:s}=n;t(o,0,0,0);let f=-1,c=0;for(let t=0;t<e.length;t++){const n=e[t]*i;f!==n&&(o[0]+=s[n+0],o[1]+=s[n+1],o[2]+=s[n+2],c++),f=n}return c>1&&r(o,o,1/c),c>0}function h(o,i,s,f){if(!o)return!1;const{size:c,data:l}=o;t(f,0,0,0),t(U,0,0,0);let a=0,u=0;const g=i?i.length-1:l.length/c-1,h=g+(s?2:0);for(let t=0;t<h;t+=2){const o=t<g?t:g,s=t<g?t+1:0,h=(i?i[o]:o)*c,A=(i?i[s]:s)*c;y[0]=l[h+0],y[1]=l[h+1],y[2]=l[h+2],w[0]=l[A+0],w[1]=l[A+1],w[2]=l[A+2],r(y,n(y,y,w),.5);const m=e(y,w);m>0?(n(f,f,r(y,y,m)),a+=m):(n(U,U,y),u++)}return 0!==a?(r(f,f,1/a),!0):0!==u&&(r(f,U,1/u),!0)}const y=o(),w=o(),A=o(),U=o();export{h as computeAttachmentOriginLines,g as computeAttachmentOriginPoints,u as computeAttachmentOriginTriangles,l as generateDefaultIndexArray,a as generateIndexArray};
5
+ import{s as t,a as n,g as r,j as e}from"../../../../chunks/vec3.js";import{c as o}from"../../../../chunks/vec3f64.js";import{areaPoints3d as i}from"../../../../geometry/support/triangle.js";let s=(()=>{const t=new Uint32Array(131072);for(let n=0;n<t.length;++n)t[n]=n;return t})();const f=new Uint16Array([0]),c=(()=>{const t=new Uint16Array(65536);for(let n=0;n<t.length;++n)t[n]=n;return t})();function l(t){if(1===t)return f;if(t<c.length)return new Uint16Array(c.buffer,0,t);if(t>s.length){const n=Math.max(2*s.length,t);s=new Uint32Array(n);for(let t=0;t<s.length;t++)s[t]=t}return new Uint32Array(s.buffer,0,t)}function a(t){if(1===t)return new Uint16Array(f);if(t<c.length)return new Uint16Array(c.slice(0,t));if(t>s.length){const n=new Uint32Array(t);for(let t=0;t<n.length;t++)n[t]=t;return n}return new Uint32Array(s.slice(0,t))}function u(e,o,s){if(!e||!o)return!1;const{size:f,data:c}=e;t(s,0,0,0),t(U,0,0,0);let l=0,a=0;for(let u=0;u<o.length-2;u+=3){const e=o[u+0]*f,g=o[u+1]*f,h=o[u+2]*f;t(y,c[e+0],c[e+1],c[e+2]),t(w,c[g+0],c[g+1],c[g+2]),t(A,c[h+0],c[h+1],c[h+2]);const m=i(y,w,A);m?(n(y,y,w),n(y,y,A),r(y,y,1/3*m),n(s,s,y),l+=m):(n(U,U,y),n(U,U,w),n(U,U,A),a+=3)}return(0!==a||0!==l)&&(0!==l?(r(s,s,1/l),!0):0!==a&&(r(s,U,1/a),!0))}function g(n,e,o){if(!n||!e)return!1;const{size:i,data:s}=n;t(o,0,0,0);let f=-1,c=0;for(let t=0;t<e.length;t++){const n=e[t]*i;f!==n&&(o[0]+=s[n+0],o[1]+=s[n+1],o[2]+=s[n+2],c++),f=n}return c>1&&r(o,o,1/c),c>0}function h(o,i,s,f){if(!o)return!1;const{size:c,data:l}=o;t(f,0,0,0),t(U,0,0,0);let a=0,u=0;const g=i?i.length-1:l.length/c-1,h=g+(s?2:0);for(let t=0;t<h;t+=2){const o=t<g?t:g,s=t<g?t+1:0,h=(i?i[o]:o)*c,A=(i?i[s]:s)*c;y[0]=l[h+0],y[1]=l[h+1],y[2]=l[h+2],w[0]=l[A+0],w[1]=l[A+1],w[2]=l[A+2],r(y,n(y,y,w),.5);const m=e(y,w);m>0?(n(f,f,r(y,y,m)),a+=m):(n(U,U,y),u++)}return 0!==a?(r(f,f,1/a),!0):0!==u&&(r(f,U,1/u),!0)}const y=o(),w=o(),A=o(),U=o();export{h as computeAttachmentOriginLines,g as computeAttachmentOriginPoints,u as computeAttachmentOriginTriangles,l as generateDefaultIndexArray,a as generateIndexArray};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../../core/Evented.js";import{f as e,g as s,t as i}from"../../../../../chunks/mat3.js";import{c as a}from"../../../../../chunks/mat3f64.js";import{m as r}from"../../../../../chunks/mat4.js";import{c as o}from"../../../../../chunks/mat4f64.js";import{s as n}from"../../../../../chunks/vec3.js";import{c as h}from"../../../../../chunks/vec3f64.js";import{BufferViewMat4f64 as l,BufferViewVec3f64 as c,BufferViewMat3f as f,BufferViewVec2f as m,BufferViewVec4f64 as g,BufferViewVec4f as _,BufferViewUint8 as d}from"../../../../../geometry/support/buffer/BufferView.js";import{scaleFromMatrix as T}from"../../../support/mathUtils.js";import{newLayout as u}from"../../../support/buffer/InterleavedLayout.js";import{assert as L}from"../Util.js";import{VertexAttribute as A}from"../VertexAttribute.js";var E;function F(t){let e=u().mat4f64(A.LOCALTRANSFORM).mat4f64(A.GLOBALTRANSFORM).vec4f64(A.BOUNDINGSPHERE).vec3f64(A.MODELORIGIN).mat3f(A.MODEL).mat3f(A.MODELNORMAL).vec2f(A.MODELSCALEFACTORS);return t.includes("color")&&(e=e.vec4f(A.COLOR)),t.includes("featureAttribute")&&(e=e.vec4f(A.FEATUREATTRIBUTE)),e=e.u8(A.STATE).u8(A.LODLEVEL).alignTo(8),e}!function(t){t[t.ALLOCATED=1]="ALLOCATED",t[t.DEFAULT_ACTIVE=2]="DEFAULT_ACTIVE",t[t.VISIBLE=4]="VISIBLE",t[t.HIGHLIGHT=8]="HIGHLIGHT",t[t.HIGHLIGHT_ACTIVE=16]="HIGHLIGHT_ACTIVE",t[t.REMOVE=32]="REMOVE",t[t.TRANSFORM_CHANGED=64]="TRANSFORM_CHANGED",t[t.ACTIVE=18]="ACTIVE"}(E||(E={}));class O{constructor(t){this.localTransform=t.getField(A.LOCALTRANSFORM,l),this.globalTransform=t.getField(A.GLOBALTRANSFORM,l),this.modelOrigin=t.getField(A.MODELORIGIN,c),this.model=t.getField(A.MODEL,f),this.modelNormal=t.getField(A.MODELNORMAL,f),this.modelScaleFactors=t.getField(A.MODELSCALEFACTORS,m),this.boundingSphere=t.getField(A.BOUNDINGSPHERE,g),this.color=t.getField(A.COLOR,_),this.featureAttribute=t.getField(A.FEATUREATTRIBUTE,_),this.state=t.getField(A.STATE,d),this.lodLevel=t.getField(A.LODLEVEL,d)}}class S extends t{constructor(t,e){super(),this._capacity=0,this._size=0,this._next=0,this._layout=F(t),this._shaderTransformation=e}get capacity(){return this._capacity}get size(){return this._size}get buffer(){return this._buffer.buffer}get view(){return this._view}addInstance(){this._size+1>this._capacity&&this._grow();const t=this._findSlot();return this._view.state.set(t,E.ALLOCATED),this._size++,this.emit("instance-added",{index:t}),t}removeInstance(t){const e=this._view.state;L(t>=0&&t<this._capacity&&e.get(t)&E.ALLOCATED,"invalid instance handle"),this._getStateFlag(t,E.ACTIVE)?this._setStateFlags(t,E.REMOVE):this.freeInstance(t),this.emit("instance-removed",{index:t})}freeInstance(t){const e=this._view.state;L(t>=0&&t<this._capacity&&e.get(t)&E.ALLOCATED,"invalid instance handle"),e.set(t,0),this._size--}setLocalTransform(t,e,s=!0){this._view.localTransform.setMat(t,e),s&&this.updateModelTransform(t)}getLocalTransform(t,e){this._view.localTransform.getMat(t,e)}setGlobalTransform(t,e,s=!0){this._view.globalTransform.setMat(t,e),s&&this.updateModelTransform(t)}getGlobalTransform(t,e){this._view.globalTransform.getMat(t,e)}updateModelTransform(t){const a=this._view,o=M,h=I;a.localTransform.getMat(t,b),a.globalTransform.getMat(t,w);const l=r(w,w,b);n(o,l[12],l[13],l[14]),a.modelOrigin.setVec(t,o),e(h,l),a.model.setMat(t,h);const c=T(M,l);c.sort(),a.modelScaleFactors.set(t,0,c[1]),a.modelScaleFactors.set(t,1,c[2]),s(h,h),i(h,h),a.modelNormal.setMat(t,h),this._setStateFlags(t,E.TRANSFORM_CHANGED),this.emit("instance-transform-changed",{index:t})}getModelTransform(t,e){const s=this._view;s.model.getMat(t,I),s.modelOrigin.getVec(t,M),e[0]=I[0],e[1]=I[1],e[2]=I[2],e[3]=0,e[4]=I[3],e[5]=I[4],e[6]=I[5],e[7]=0,e[8]=I[6],e[9]=I[7],e[10]=I[8],e[11]=0,e[12]=M[0],e[13]=M[1],e[14]=M[2],e[15]=1}applyShaderTransformation(t,e){this._shaderTransformation&&this._shaderTransformation.applyTransform(this,t,e)}getCombinedModelTransform(t,e){return this.getModelTransform(t,e),this._shaderTransformation&&this._shaderTransformation.applyTransform(this,t,e),e}getCombinedLocalTransform(t,e){return this._view.localTransform.getMat(t,e),this._shaderTransformation&&this._shaderTransformation.applyTransform(this,t,e),e}getCombinedMaxScaleFactor(t){let e=this._view.modelScaleFactors.get(t,1);if(this._shaderTransformation){const s=this._shaderTransformation.scaleFactor(M,this,t);e*=Math.max(s[0],s[1],s[2])}return e}getCombinedMedianScaleFactor(t){let e=this._view.modelScaleFactors.get(t,0);if(this._shaderTransformation){const s=this._shaderTransformation.scaleFactor(M,this,t);s.sort(),e*=s[1]}return e}getModel(t,e){this._view.model.getMat(t,e)}setFeatureAttribute(t,e){this._view.featureAttribute.setVec(t,e)}getFeatureAttribute(t,e){this._view.featureAttribute.getVec(t,e)}setColor(t,e){this._view.color.setVec(t,e)}getColor(t,e){this._view.color.getVec(t,e)}setVisible(t,e){e!==this.getVisible(t)&&(this._setStateFlag(t,E.VISIBLE,e),this.emit("instance-visibility-changed",{index:t}))}getVisible(t){return this._getStateFlag(t,E.VISIBLE)}setHighlight(t,e){e!==this.getHighlight(t)&&(this._setStateFlag(t,E.HIGHLIGHT,e),this.emit("instance-highlight-changed",{index:t}))}getHighlight(t){return this._getStateFlag(t,E.HIGHLIGHT)}getState(t){return this._view.state.get(t)}getLodLevel(t){return this._view.lodLevel.get(t)}countFlags(t){let e=0;for(let s=0;s<this._capacity;++s){this.getState(s)&t&&++e}return e}_setStateFlags(t,e){const s=this._view.state;e=s.get(t)|e,s.set(t,e)}_clearStateFlags(t,e){const s=this._view.state;e=s.get(t)&~e,s.set(t,e)}_setStateFlag(t,e,s){s?this._setStateFlags(t,e):this._clearStateFlags(t,e)}_getStateFlag(t,e){return!!(this._view.state.get(t)&e)}_grow(){const t=Math.max(v,Math.floor(this._capacity*p)),e=this._layout.createBuffer(t);if(this._buffer){const t=new Uint8Array(this._buffer.buffer);new Uint8Array(e.buffer).set(t)}this._capacity=t,this._buffer=e,this._view=new O(this._buffer)}_findSlot(){const t=this._view.state;let e=this._next;for(;t.get(e)&E.ALLOCATED;)e=(e+1)%this._capacity;return this._next=(e+1)%this._capacity,e}}const v=1024,p=2,M=h(),I=a(),b=o(),w=o();export{S as InstanceData,O as InstanceDataView,E as StateFlags};
5
+ import t from"../../../../../core/Evented.js";import{f as e,g as s,t as i}from"../../../../../chunks/mat3.js";import{c as a}from"../../../../../chunks/mat3f64.js";import{m as r}from"../../../../../chunks/mat4.js";import{c as o}from"../../../../../chunks/mat4f64.js";import{s as n}from"../../../../../chunks/vec3.js";import{c as h}from"../../../../../chunks/vec3f64.js";import{BufferViewMat4f64 as l,BufferViewVec3f64 as c,BufferViewMat3f as f,BufferViewVec2f as m,BufferViewVec4f64 as g,BufferViewVec4f as d,BufferViewUint8 as _,BufferViewVec4u8 as T}from"../../../../../geometry/support/buffer/BufferView.js";import{scaleFromMatrix as u}from"../../../support/mathUtils.js";import{newLayout as L}from"../../../support/buffer/InterleavedLayout.js";import{assert as A}from"../Util.js";import{VertexAttribute as E}from"../VertexAttribute.js";var O;function F(t){let e=L().mat4f64(E.LOCALTRANSFORM).mat4f64(E.GLOBALTRANSFORM).vec4f64(E.BOUNDINGSPHERE).vec3f64(E.MODELORIGIN).mat3f(E.MODEL).mat3f(E.MODELNORMAL).vec2f(E.MODELSCALEFACTORS);return t.includes("color")&&(e=e.vec4f(E.COLOR)),t.includes("featureAttribute")&&(e=e.vec4f(E.FEATUREATTRIBUTE)),e=e.u8(E.STATE).u8(E.LODLEVEL),t.includes(E.OBJECTANDLAYERIDCOLOR)&&(e=e.vec4u8(E.OBJECTANDLAYERIDCOLOR)),e.alignTo(8),e}!function(t){t[t.ALLOCATED=1]="ALLOCATED",t[t.DEFAULT_ACTIVE=2]="DEFAULT_ACTIVE",t[t.VISIBLE=4]="VISIBLE",t[t.HIGHLIGHT=8]="HIGHLIGHT",t[t.HIGHLIGHT_ACTIVE=16]="HIGHLIGHT_ACTIVE",t[t.REMOVE=32]="REMOVE",t[t.TRANSFORM_CHANGED=64]="TRANSFORM_CHANGED",t[t.ACTIVE=18]="ACTIVE"}(O||(O={}));class v{constructor(t){this.localTransform=t.getField(E.LOCALTRANSFORM,l),this.globalTransform=t.getField(E.GLOBALTRANSFORM,l),this.modelOrigin=t.getField(E.MODELORIGIN,c),this.model=t.getField(E.MODEL,f),this.modelNormal=t.getField(E.MODELNORMAL,f),this.modelScaleFactors=t.getField(E.MODELSCALEFACTORS,m),this.boundingSphere=t.getField(E.BOUNDINGSPHERE,g),this.color=t.getField(E.COLOR,d),this.featureAttribute=t.getField(E.FEATUREATTRIBUTE,d),this.state=t.getField(E.STATE,_),this.lodLevel=t.getField(E.LODLEVEL,_),this.objectAndLayerIdColor=t.getField(E.OBJECTANDLAYERIDCOLOR,T)}}class I extends t{constructor(t,e){super(),this._capacity=0,this._size=0,this._next=0,this._buffer=null,this._view=null,this._layout=F(t),this._shaderTransformation=e}get capacity(){return this._capacity}get size(){return this._size}get buffer(){return this._buffer.buffer}get view(){return this._view}addInstance(){this._size+1>this._capacity&&this._grow();const t=this._findSlot();return this._view.state.set(t,O.ALLOCATED),this._size++,this.emit("instance-added",{index:t}),t}removeInstance(t){const e=this._view.state;A(t>=0&&t<this._capacity&&e.get(t)&O.ALLOCATED,"invalid instance handle"),this._getStateFlag(t,O.ACTIVE)?this._setStateFlags(t,O.REMOVE):this.freeInstance(t),this.emit("instance-removed",{index:t})}freeInstance(t){const e=this._view.state;A(t>=0&&t<this._capacity&&e.get(t)&O.ALLOCATED,"invalid instance handle"),e.set(t,0),this._size--}setLocalTransform(t,e,s=!0){this._view.localTransform.setMat(t,e),s&&this.updateModelTransform(t)}getLocalTransform(t,e){this._view.localTransform.getMat(t,e)}setGlobalTransform(t,e,s=!0){this._view.globalTransform.setMat(t,e),s&&this.updateModelTransform(t)}getGlobalTransform(t,e){this._view.globalTransform.getMat(t,e)}updateModelTransform(t){const a=this._view,o=M,h=C;a.localTransform.getMat(t,b),a.globalTransform.getMat(t,R);const l=r(R,R,b);n(o,l[12],l[13],l[14]),a.modelOrigin.setVec(t,o),e(h,l),a.model.setMat(t,h);const c=u(M,l);c.sort(),a.modelScaleFactors.set(t,0,c[1]),a.modelScaleFactors.set(t,1,c[2]),s(h,h),i(h,h),a.modelNormal.setMat(t,h),this._setStateFlags(t,O.TRANSFORM_CHANGED),this.emit("instance-transform-changed",{index:t})}getModelTransform(t,e){const s=this._view;s.model.getMat(t,C),s.modelOrigin.getVec(t,M),e[0]=C[0],e[1]=C[1],e[2]=C[2],e[3]=0,e[4]=C[3],e[5]=C[4],e[6]=C[5],e[7]=0,e[8]=C[6],e[9]=C[7],e[10]=C[8],e[11]=0,e[12]=M[0],e[13]=M[1],e[14]=M[2],e[15]=1}applyShaderTransformation(t,e){this._shaderTransformation&&this._shaderTransformation.applyTransform(this,t,e)}getCombinedModelTransform(t,e){return this.getModelTransform(t,e),this._shaderTransformation&&this._shaderTransformation.applyTransform(this,t,e),e}getCombinedLocalTransform(t,e){return this._view.localTransform.getMat(t,e),this._shaderTransformation&&this._shaderTransformation.applyTransform(this,t,e),e}getCombinedMaxScaleFactor(t){let e=this._view.modelScaleFactors.get(t,1);if(this._shaderTransformation){const s=this._shaderTransformation.scaleFactor(M,this,t);e*=Math.max(s[0],s[1],s[2])}return e}getCombinedMedianScaleFactor(t){let e=this._view.modelScaleFactors.get(t,0);if(this._shaderTransformation){const s=this._shaderTransformation.scaleFactor(M,this,t);s.sort(),e*=s[1]}return e}getModel(t,e){this._view.model.getMat(t,e)}setFeatureAttribute(t,e){this._view.featureAttribute.setVec(t,e)}getFeatureAttribute(t,e){this._view.featureAttribute.getVec(t,e)}setColor(t,e){this._view.color.setVec(t,e)}setObjectAndLayerIdColor(t,e){this._view.objectAndLayerIdColor.setVec(t,e)}getColor(t,e){this._view.color.getVec(t,e)}setVisible(t,e){e!==this.getVisible(t)&&(this._setStateFlag(t,O.VISIBLE,e),this.emit("instance-visibility-changed",{index:t}))}getVisible(t){return this._getStateFlag(t,O.VISIBLE)}setHighlight(t,e){e!==this.getHighlight(t)&&(this._setStateFlag(t,O.HIGHLIGHT,e),this.emit("instance-highlight-changed",{index:t}))}getHighlight(t){return this._getStateFlag(t,O.HIGHLIGHT)}getState(t){return this._view.state.get(t)}getLodLevel(t){return this._view.lodLevel.get(t)}countFlags(t){let e=0;for(let s=0;s<this._capacity;++s){this.getState(s)&t&&++e}return e}_setStateFlags(t,e){const s=this._view.state;e=s.get(t)|e,s.set(t,e)}_clearStateFlags(t,e){const s=this._view.state;e=s.get(t)&~e,s.set(t,e)}_setStateFlag(t,e,s){s?this._setStateFlags(t,e):this._clearStateFlags(t,e)}_getStateFlag(t,e){return!!(this._view.state.get(t)&e)}_grow(){const t=Math.max(S,Math.floor(this._capacity*p)),e=this._layout.createBuffer(t);if(this._buffer){const t=new Uint8Array(this._buffer.buffer);new Uint8Array(e.buffer).set(t)}this._capacity=t,this._buffer=e,this._view=new v(this._buffer)}_findSlot(){const t=this._view.state;let e=this._next;for(;t.get(e)&O.ALLOCATED;)e=(e+1)%this._capacity;return this._next=(e+1)%this._capacity,e}}const S=1024,p=2,M=h(),C=a(),b=o(),R=o();export{I as InstanceData,v as InstanceDataView,O as StateFlags};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{isNone as e}from"../../../../../core/maybe.js";import{isAborted as t,throwIfAborted as a}from"../../../../../core/promiseUtils.js";import{c as s}from"../../../../../chunks/mat4f64.js";import{b as n,e as i,m as r}from"../../../../../chunks/vec3.js";import{c as o}from"../../../../../chunks/vec3f64.js";import{c as l,f as c}from"../../../../../chunks/vec4f64.js";import h from"../../../support/debugFlags.js";import{glLayout as d}from"../../../support/buffer/glUtil.js";import{ShaderOutput as u}from"../../core/shaderLibrary/ShaderOutput.js";import{Camera as _}from"../Camera.js";import{Default3D as m}from"../DefaultVertexAttributeLocations.js";import{IntersectorType as f}from"../IntersectorInterfaces.js";import p from"../Octree.js";import{RenderSlot as g}from"../RenderSlot.js";import{assert as C}from"../Util.js";import{InstanceData as I,StateFlags as D}from"./InstanceData.js";import{InstanceOctree as v}from"./InstanceOctree.js";import{LevelSelector as y}from"./LevelSelector.js";import{LodLevel as R}from"./LodLevel.js";import{RenderInstanceData as b}from"./RenderInstanceData.js";import{getInstanceBufferLayout as E}from"../../materials/DefaultMaterial.js";import{colorMixModes as A}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as T}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as L}from"../../shaders/DefaultMaterialTechnique.js";import{bindVertexBufferLayout as S,unbindVertexBufferLayout as O}from"../../../../webgl/Util.js";let U=e=>{const t=e.baseBoundingSphere.radius,a=e.levels.map((e=>e.minScreenSpaceRadius));return new y(t,a)};function x(e){U=e}class j{constructor(e,t,a,s){this.type=f.LOD,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=[],this._highlightRenderInstanceData=[],this._instanceIndex=0,this._slicePlane=!1,this._enableLevelSelection=!0,this._lastCamera=new _,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.slots=[g.OPAQUE_MATERIAL,g.TRANSPARENT_MATERIAL],this.canRender=!0,this._symbol=e,this._optionalFields=t,this._metadata=a,this._instanceBufferLayout=E({instancedDoublePrecision:!0,instanced:t}),this._glInstanceBufferLayout=d(this._instanceBufferLayout,1),this._instanceData=new I(this._optionalFields,s),this._instanceData.on("instance-added",(()=>this._requestUpdateCycle())),this._instanceData.on("instance-removed",(()=>this._requestUpdateCycle())),this._instanceData.on("instance-transform-changed",(e=>{this._requestUpdateCycle(),this._metadata.notifyGraphicGeometryChanged(e.index)})),this._instanceData.on("instance-visibility-changed",(e=>{this._requestUpdateCycle(!0),this._metadata.notifyGraphicVisibilityChanged(e.index)})),this._instanceData.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0))),this._enableLevelSelection=this._symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerUid(){return this._metadata.layerUid}get instanceData(){return this._instanceData}get memoryUsage(){const e={cpu:0,gpu:0};return this._defaultRenderInstanceData.forEach((t=>{const a=t.memoryUsage;e.cpu+=a.cpu,e.gpu+=a.gpu})),this._highlightRenderInstanceData.forEach((t=>{const a=t.memoryUsage;e.cpu+=a.cpu,e.gpu+=a.gpu})),e}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,a)=>{const s=this._defaultRenderInstanceData[a],n=this._highlightRenderInstanceData[a],i=s.size+n.size,r=e.triangleCount;t.push({renderedInstances:i,renderedTriangles:i*r,trianglesPerInstance:r})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}async initializeRenderContext(e,s){this._context=e;const n=e.renderContext.rctx,i=await Promise.allSettled(this._symbol.levels.map((t=>(this._defaultRenderInstanceData.push(new b(n,this._instanceBufferLayout)),this._highlightRenderInstanceData.push(new b(n,this._instanceBufferLayout)),R.create(e,t,s))))),r=i.map((e=>"fulfilled"===e.status?e.value:null)).filter((e=>e));if(t(s)||r.length!==i.length){r.forEach((e=>e.destroy())),a(s);for(const e of i)if("rejected"===e.status)throw e.reason}this._levels=r,this._levelSelector=U(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData.forEach((e=>e.destroy())),this._highlightRenderInstanceData.forEach((e=>e.destroy()))}get needsTransparentPass(){return this._levels.some((e=>e.components.some((e=>e.material.requiresSlot(g.TRANSPARENT_MATERIAL,u.Color)))))}get needsHighlight(){return this._highlightRenderInstanceData.some((e=>e.size>0))}prepareRender(e){if(h.LOD_INSTANCE_RENDERER_DISABLE_UPDATES)return;if(this._enableLevelSelection){const t=e.bindParameters.contentCamera.equals(this._lastCamera);this._lastCamera.copyFrom(e.bindParameters.contentCamera),t||this._requestUpdateCycle()}const t=this._needFullCycle?this._instanceData.size:2e3;this._needFullCycle=!1,this._updateInstances(e.bindParameters.contentCamera,t),this._needsUpdates&&this._context.requestRender()}render(e){if(!this.baseMaterial.isVisible()||!this.baseMaterial.isVisibleForOutput(e.output))return;e.rctx.bindVAO();e.output!==u.Highlight&&e.output!==u.ShadowHighlight&&this._renderComponents(e,this._defaultRenderInstanceData);e.output!==u.ShadowExludeHighlight&&this._renderComponents(e,this._highlightRenderInstanceData)}intersect(e,t,a,s){if(!this.baseMaterial.isVisible())return;const i=o();n(i,s,a);const l=n=>{this._instanceData.getCombinedModelTransform(n,N),e.transform.set(N),r(H,a,e.transform.inverse),r(q,s,e.transform.inverse);const i=this._instanceData.getState(n),o=this._instanceData.getLodLevel(n),l=this._levels.length;C(i&D.ACTIVE,"invalid instance state"),C(o>=0&&o<l,"invaid lod level"),this._levels[o].intersect(e,t,H,q,n,this._metadata,l)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(l):this._octree.forEachAlongRay(a,i,l)}queryDepthRange(e){return this._queryDepthRangeOctree(e)}notifyShaderTransformationChanged(){this._invalidateOctree()}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,e&&(this._needFullCycle=!0),this._needsUpdates&&this._context.requestRender()}get _needsUpdates(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}get _octree(){return this._octreeCached||(this._octreeCached=this._buildOctree()),this._octreeCached}_invalidateOctree(){this._octreeCached&&(this._octreeCached.destroy(),this._octreeCached=null)}_buildOctree(){const e=new v(this._instanceData,this.baseBoundingSphere),t=this._instanceData,a=t.view?t.view.state:null;for(let s=0;s<this._instanceData.capacity;++s){a.get(s)&D.ACTIVE&&e.addInstance(s)}return e}_queryDepthRangeOctree(e){const t=e.eye,a=e.viewForward,s=this._octree.findClosest(a,p.DepthOrder.FRONT_TO_BACK,e.frustum),r=this._octree.findClosest(a,p.DepthOrder.BACK_TO_FRONT,e.frustum);if(null!=s&&null!=r){this._instanceData.view.boundingSphere.getVec(s,F),n(F,F,t);const o=i(F,a)-F[3];this._instanceData.view.boundingSphere.getVec(r,F),n(F,F,t);const l=i(F,a)+F[3];return{near:Math.max(e.near,o),far:Math.min(e.far,l)}}return{near:1/0,far:-1/0}}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._defaultRenderInstanceData.forEach((e=>{e.startUpdateCylce()})),this._highlightRenderInstanceData.forEach((e=>{e.startUpdateCylce()})),this._needsUpdates&&this._context.requestRender()}_updateInstances(e,t){const a=this._enableLevelSelection,s=this._levelSelector;s.updateCamera(e),this._defaultRenderInstanceData.forEach((e=>{e.beginUpdate()})),this._highlightRenderInstanceData.forEach((e=>{e.beginUpdate()}));const n=this._instanceData,i=this._instanceData.view,r=n.size,o=n.capacity;let l=this._instanceIndex;t=Math.min(r,t);for(let c=0;c<t;++c){0===l&&this._startUpdateCycle();const e=i.state.get(l);let r=0;if(!(e&D.ALLOCATED)){l=(l+1)%o,t++;continue}const c=i.lodLevel.get(l);if(e&D.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[c].freeTail(),e&D.HIGHLIGHT_ACTIVE&&this._highlightRenderInstanceData[c].freeTail(),e&D.REMOVE)n.freeInstance(l);else if(e&D.VISIBLE){let t=0;a&&(i.modelOrigin.getVec(l,w),t=s.selectLevel(w,n.getCombinedMedianScaleFactor(l))),r=e&~(D.ACTIVE|D.TRANSFORM_CHANGED),t>=0&&(e&D.HIGHLIGHT?(M(this._highlightRenderInstanceData[t],i,l),r|=D.HIGHLIGHT_ACTIVE):(M(this._defaultRenderInstanceData[t],i,l),r|=D.DEFAULT_ACTIVE)),i.state.set(l,r),i.lodLevel.set(l,t)}else r=e&~(D.ACTIVE|D.TRANSFORM_CHANGED),i.state.set(l,r);if(this._octreeCached){const t=!!(e&D.ACTIVE),a=!!(r&D.ACTIVE);!t&&a?this._octreeCached.addInstance(l):t&&!a?this._octreeCached.removeInstance(l):t&&a&&e&D.TRANSFORM_CHANGED&&(this._octreeCached.removeInstance(l),this._octreeCached.addInstance(l))}l=(l+1)%o}this._instanceIndex=l,this._defaultRenderInstanceData.forEach((e=>{e.endUpdate()})),this._highlightRenderInstanceData.forEach((e=>{e.endUpdate()}))}_renderComponents(e,t){this.levels.forEach(((a,s)=>{a.components.forEach((a=>{this._renderComponent(e,t[s],a,s)}))}))}_renderComponent(t,a,s,n){if(0===a.size)return;const{bindParameters:i,rctx:r,output:o}=t,l=s.glMaterials.load(r,i.slot,o);if(e(l))return;const c=l.beginSlot(i),d=r.bindTechnique(c,s.material.parameters,i);r.bindVAO(s.vao),c.ensureAttributeLocations(s.vao),d.bindDraw(P,i,s.material.parameters),h.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&t.output===u.Color&&(d.setUniform4fv("externalColor",B[Math.min(n,B.length-1)]),d.setUniform1i("colorMixMode",A.replace));const _=r.capabilities.instancing,f=a.capacity,p=a.headIndex,g=a.tailIndex,I=a.firstIndex,D=this._glInstanceBufferLayout,v=(e,t)=>{S(r,m,a.buffer,D,e),_.drawArraysInstanced(c.primitiveType,0,s.vertexCount,t-e),O(r,m,a.buffer,D)};s.material.parameters.transparent&&null!=I?p>g?(C(I>=g&&I<=p,"invalid firstIndex"),v(I,p),v(g,I)):p<g&&(I<=p?(C(I>=0&&I<=p,"invalid firstIndex"),v(I,p),v(g,f),v(0,I)):(C(I>=g&&I<=f,"invalid firstIndex"),v(I,f),v(0,p),v(g,I))):p>g?v(g,p):p<g&&(v(0,p),v(g,f)),r.bindVAO(null)}}function M(e,t,a){const s=e.allocateHead();V(t,a,e.view,s)}function V(e,t,a,s){T(e.modelOrigin,t,a.modelOriginHi,a.modelOriginLo,s),a.model.copyFrom(s,e.model,t),a.modelNormal.copyFrom(s,e.modelNormal,t),e.color&&a.color&&a.color.copyFrom(s,e.color,t),e.featureAttribute&&a.featureAttribute&&a.featureAttribute.copyFrom(s,e.featureAttribute,t)}const w=o(),F=l(),N=s(),H=o(),q=o(),B=[c(1,0,1,1),c(0,0,1,1),c(0,1,0,1),c(1,1,0,1),c(1,0,0,1)],P=new L;export{j as LodRenderer,x as setLevelSelectorFactory};
5
+ import{isNone as e}from"../../../../../core/maybe.js";import{isAborted as t,throwIfAborted as a}from"../../../../../core/promiseUtils.js";import{c as s}from"../../../../../chunks/mat4f64.js";import{b as n,e as i,m as r}from"../../../../../chunks/vec3.js";import{c as o}from"../../../../../chunks/vec3f64.js";import{c as l,f as c}from"../../../../../chunks/vec4f64.js";import h from"../../../support/debugFlags.js";import{glLayout as d}from"../../../support/buffer/glUtil.js";import{ShaderOutput as u}from"../../core/shaderLibrary/ShaderOutput.js";import{Camera as _}from"../Camera.js";import{Default3D as m}from"../DefaultVertexAttributeLocations.js";import{IntersectorType as f}from"../IntersectorInterfaces.js";import p from"../Octree.js";import{RenderSlot as g}from"../RenderSlot.js";import{assert as C}from"../Util.js";import{InstanceData as I,StateFlags as D}from"./InstanceData.js";import{InstanceOctree as y}from"./InstanceOctree.js";import{LevelSelector as v}from"./LevelSelector.js";import{LodLevel as b}from"./LodLevel.js";import{RenderInstanceData as R}from"./RenderInstanceData.js";import{getInstanceBufferLayout as E}from"../../materials/DefaultMaterial.js";import{colorMixModes as A}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as L}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as T}from"../../shaders/DefaultMaterialTechnique.js";import{bindVertexBufferLayout as S,unbindVertexBufferLayout as O}from"../../../../webgl/Util.js";let U=e=>{const t=e.baseBoundingSphere.radius,a=e.levels.map((e=>e.minScreenSpaceRadius));return new v(t,a)};function j(e){U=e}class x{constructor(e,t,a,s){this.type=f.LOD,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=[],this._highlightRenderInstanceData=[],this._instanceIndex=0,this._slicePlane=!1,this._enableLevelSelection=!0,this._lastCamera=new _,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.slots=[g.OPAQUE_MATERIAL,g.TRANSPARENT_MATERIAL],this.canRender=!0,this._symbol=e,this._optionalFields=t,this._metadata=a,this._instanceBufferLayout=E({instancedDoublePrecision:!0,instanced:t}),this._glInstanceBufferLayout=d(this._instanceBufferLayout,1),this._instanceData=new I(this._optionalFields,s),this._instanceData.on("instance-added",(()=>this._requestUpdateCycle())),this._instanceData.on("instance-removed",(()=>this._requestUpdateCycle())),this._instanceData.on("instance-transform-changed",(e=>{this._requestUpdateCycle(),this._metadata.notifyGraphicGeometryChanged(e.index)})),this._instanceData.on("instance-visibility-changed",(e=>{this._requestUpdateCycle(!0),this._metadata.notifyGraphicVisibilityChanged(e.index)})),this._instanceData.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0))),this._enableLevelSelection=this._symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerUid(){return this._metadata.layerUid}get instanceData(){return this._instanceData}get memoryUsage(){const e={cpu:0,gpu:0};return this._defaultRenderInstanceData.forEach((t=>{const a=t.memoryUsage;e.cpu+=a.cpu,e.gpu+=a.gpu})),this._highlightRenderInstanceData.forEach((t=>{const a=t.memoryUsage;e.cpu+=a.cpu,e.gpu+=a.gpu})),e}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,a)=>{const s=this._defaultRenderInstanceData[a],n=this._highlightRenderInstanceData[a],i=s.size+n.size,r=e.triangleCount;t.push({renderedInstances:i,renderedTriangles:i*r,trianglesPerInstance:r})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}async initializeRenderContext(e,s){this._context=e;const n=e.renderContext.rctx,i=await Promise.allSettled(this._symbol.levels.map((t=>(this._defaultRenderInstanceData.push(new R(n,this._instanceBufferLayout)),this._highlightRenderInstanceData.push(new R(n,this._instanceBufferLayout)),b.create(e,t,s))))),r=i.map((e=>"fulfilled"===e.status?e.value:null)).filter((e=>e));if(t(s)||r.length!==i.length){r.forEach((e=>e.destroy())),a(s);for(const e of i)if("rejected"===e.status)throw e.reason}this._levels=r,this._levelSelector=U(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData.forEach((e=>e.destroy())),this._highlightRenderInstanceData.forEach((e=>e.destroy()))}get needsTransparentPass(){return this._levels.some((e=>e.components.some((e=>e.material.requiresSlot(g.TRANSPARENT_MATERIAL,u.Color)))))}get needsHighlight(){return this._highlightRenderInstanceData.some((e=>e.size>0))}prepareRender(e){if(h.LOD_INSTANCE_RENDERER_DISABLE_UPDATES)return;if(this._enableLevelSelection){const t=e.bindParameters.contentCamera.equals(this._lastCamera);this._lastCamera.copyFrom(e.bindParameters.contentCamera),t||this._requestUpdateCycle()}const t=this._needFullCycle?this._instanceData.size:2e3;this._needFullCycle=!1,this._updateInstances(e.bindParameters.contentCamera,t),this._needsUpdates&&this._context.requestRender()}render(e){if(!this.baseMaterial.isVisible()||!this.baseMaterial.isVisibleForOutput(e.output))return;e.rctx.bindVAO();e.output!==u.Highlight&&e.output!==u.ShadowHighlight&&this._renderComponents(e,this._defaultRenderInstanceData);e.output!==u.ShadowExludeHighlight&&this._renderComponents(e,this._highlightRenderInstanceData)}intersect(e,t,a,s){if(!this.baseMaterial.isVisible())return;const i=o();n(i,s,a);const l=n=>{this._instanceData.getCombinedModelTransform(n,N),e.transform.set(N),r(q,a,e.transform.inverse),r(H,s,e.transform.inverse);const i=this._instanceData.getState(n),o=this._instanceData.getLodLevel(n),l=this._levels.length;C(i&D.ACTIVE,"invalid instance state"),C(o>=0&&o<l,"invaid lod level"),this._levels[o].intersect(e,t,q,H,n,this._metadata,l)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(l):this._octree.forEachAlongRay(a,i,l)}queryDepthRange(e){return this._queryDepthRangeOctree(e)}notifyShaderTransformationChanged(){this._invalidateOctree()}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,e&&(this._needFullCycle=!0),this._needsUpdates&&this._context.requestRender()}get _needsUpdates(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}get _octree(){return this._octreeCached||(this._octreeCached=this._buildOctree()),this._octreeCached}_invalidateOctree(){this._octreeCached&&(this._octreeCached.destroy(),this._octreeCached=null)}_buildOctree(){const e=new y(this._instanceData,this.baseBoundingSphere),t=this._instanceData,a=t.view?t.view.state:null;for(let s=0;s<this._instanceData.capacity;++s){a.get(s)&D.ACTIVE&&e.addInstance(s)}return e}_queryDepthRangeOctree(e){const t=e.eye,a=e.viewForward,s=this._octree.findClosest(a,p.DepthOrder.FRONT_TO_BACK,e.frustum),r=this._octree.findClosest(a,p.DepthOrder.BACK_TO_FRONT,e.frustum);if(null!=s&&null!=r){this._instanceData.view.boundingSphere.getVec(s,w),n(w,w,t);const o=i(w,a)-w[3];this._instanceData.view.boundingSphere.getVec(r,w),n(w,w,t);const l=i(w,a)+w[3];return{near:Math.max(e.near,o),far:Math.min(e.far,l)}}return{near:1/0,far:-1/0}}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._defaultRenderInstanceData.forEach((e=>{e.startUpdateCylce()})),this._highlightRenderInstanceData.forEach((e=>{e.startUpdateCylce()})),this._needsUpdates&&this._context.requestRender()}_updateInstances(e,t){const a=this._enableLevelSelection,s=this._levelSelector;s.updateCamera(e),this._defaultRenderInstanceData.forEach((e=>{e.beginUpdate()})),this._highlightRenderInstanceData.forEach((e=>{e.beginUpdate()}));const n=this._instanceData,i=this._instanceData.view,r=n.size,o=n.capacity;let l=this._instanceIndex;t=Math.min(r,t);for(let c=0;c<t;++c){0===l&&this._startUpdateCycle();const e=i.state.get(l);let r=0;if(!(e&D.ALLOCATED)){l=(l+1)%o,t++;continue}const c=i.lodLevel.get(l);if(e&D.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[c].freeTail(),e&D.HIGHLIGHT_ACTIVE&&this._highlightRenderInstanceData[c].freeTail(),e&D.REMOVE)n.freeInstance(l);else if(e&D.VISIBLE){let t=0;a&&(i.modelOrigin.getVec(l,F),t=s.selectLevel(F,n.getCombinedMedianScaleFactor(l))),r=e&~(D.ACTIVE|D.TRANSFORM_CHANGED),t>=0&&(e&D.HIGHLIGHT?(M(this._highlightRenderInstanceData[t],i,l),r|=D.HIGHLIGHT_ACTIVE):(M(this._defaultRenderInstanceData[t],i,l),r|=D.DEFAULT_ACTIVE)),i.state.set(l,r),i.lodLevel.set(l,t)}else r=e&~(D.ACTIVE|D.TRANSFORM_CHANGED),i.state.set(l,r);if(this._octreeCached){const t=!!(e&D.ACTIVE),a=!!(r&D.ACTIVE);!t&&a?this._octreeCached.addInstance(l):t&&!a?this._octreeCached.removeInstance(l):t&&a&&e&D.TRANSFORM_CHANGED&&(this._octreeCached.removeInstance(l),this._octreeCached.addInstance(l))}l=(l+1)%o}this._instanceIndex=l,this._defaultRenderInstanceData.forEach((e=>{e.endUpdate()})),this._highlightRenderInstanceData.forEach((e=>{e.endUpdate()}))}_renderComponents(e,t){this.levels.forEach(((a,s)=>{a.components.forEach((a=>{this._renderComponent(e,t[s],a,s)}))}))}_renderComponent(t,a,s,n){const{bindParameters:i,rctx:r,output:o}=t;if(0===a.size||!s.material.requiresSlot(i.slot,t.output))return;const l=s.glMaterials.load(r,i.slot,o);if(e(l))return;const c=l.beginSlot(i),d=r.bindTechnique(c,s.material.parameters,i);r.bindVAO(s.vao),c.ensureAttributeLocations(s.vao),d.bindDraw(P,i,s.material.parameters),h.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&t.output===u.Color&&(d.setUniform4fv("externalColor",B[Math.min(n,B.length-1)]),d.setUniform1i("colorMixMode",A.replace));const _=r.capabilities.instancing,f=a.capacity,p=a.headIndex,g=a.tailIndex,I=a.firstIndex,D=this._glInstanceBufferLayout,y=(e,t)=>{S(r,m,a.buffer,D,e),_.drawArraysInstanced(c.primitiveType,0,s.vertexCount,t-e),O(r,m,a.buffer,D)};s.material.parameters.transparent&&null!=I?p>g?(C(I>=g&&I<=p,"invalid firstIndex"),y(I,p),y(g,I)):p<g&&(I<=p?(C(I>=0&&I<=p,"invalid firstIndex"),y(I,p),y(g,f),y(0,I)):(C(I>=g&&I<=f,"invalid firstIndex"),y(I,f),y(0,p),y(g,I))):p>g?y(g,p):p<g&&(y(0,p),y(g,f)),r.bindVAO(null)}}function M(e,t,a){const s=e.allocateHead();V(t,a,e.view,s)}function V(e,t,a,s){L(e.modelOrigin,t,a.modelOriginHi,a.modelOriginLo,s),a.model.copyFrom(s,e.model,t),a.modelNormal.copyFrom(s,e.modelNormal,t),e.color&&a.color&&a.color.copyFrom(s,e.color,t),e.objectAndLayerIdColor&&a.objectAndLayerIdColor&&a.objectAndLayerIdColor.copyFrom(s,e.objectAndLayerIdColor,t),e.featureAttribute&&a.featureAttribute&&a.featureAttribute.copyFrom(s,e.featureAttribute,t)}const F=o(),w=l(),N=s(),q=o(),H=o(),B=[c(1,0,1,1),c(0,0,1,1),c(0,1,0,1),c(1,1,0,1),c(1,0,0,1)],P=new T;export{x as LodRenderer,j as setLevelSelectorFactory};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{BufferViewVec3f as t,BufferViewMat3f as i,BufferViewVec4f as e}from"../../../../../geometry/support/buffer/BufferView.js";import{assert as s}from"../Util.js";import{VertexAttribute as a}from"../VertexAttribute.js";import r from"./BackedBufferObject.js";class h{constructor(s){this.modelOriginHi=s.getField(a.MODELORIGINHI,t),this.modelOriginLo=s.getField(a.MODELORIGINLO,t),this.model=s.getField(a.MODEL,i),this.modelNormal=s.getField(a.MODELNORMAL,i),this.color=s.getField(a.INSTANCECOLOR,e),this.featureAttribute=s.getField(a.INSTANCEFEATUREATTRIBUTE,e)}}class n{constructor(t,i){this._headIndex=0,this._tailIndex=0,this._captureFirstIndex=!0,this._updating=!1,this._prevHeadIndex=0,this._resized=!1,this._rctx=t,this._instanceBufferLayout=i,this._elementSize=i.stride,this._capacity=1}destroy(){this._buffer&&this._buffer.destroy()}get buffer(){return this._buffer.buffer}get view(){return this._view}get capacity(){return this._capacity}get size(){const t=this._headIndex,i=this._tailIndex;return t>=i?t-i:t+this._capacity-i}get isEmpty(){return this._headIndex===this._tailIndex}get isFull(){return this._tailIndex===(this._headIndex+1)%this._capacity}get headIndex(){return this._headIndex}get tailIndex(){return this._tailIndex}get firstIndex(){return this._firstIndex}get memoryUsage(){return this._buffer?this._buffer.memoryUsage:{cpu:0,gpu:0}}reset(){this._headIndex=0,this._tailIndex=0,this._firstIndex=null}startUpdateCylce(){this._captureFirstIndex=!0}beginUpdate(){s(!this._updating,"already updating"),this._updating=!0,this._prevHeadIndex=this._headIndex}endUpdate(){s(this._updating,"not updating"),this.size<c*this.capacity&&this._shrink(),this._resized?(this._buffer.transferAll(),this._resized=!1):this._transferRange(this._prevHeadIndex,this._headIndex),this._updating=!1}allocateHead(){s(this._updating,"not updating"),this.isFull&&this._grow();const t=this.headIndex;return this._captureFirstIndex&&(this._firstIndex=t,this._captureFirstIndex=!1),this._incrementHead(),s(this._headIndex!==this._tailIndex,"invalid pointers"),t}freeTail(){s(this._updating,"not updating"),s(this.size>0,"invalid size");const t=this._tailIndex===this._firstIndex;this._incrementTail(),t&&(this._firstIndex=this._tailIndex)}_grow(){const t=Math.max(_,Math.floor(this._capacity*d));this._resize(t)}_shrink(){const t=Math.max(_,Math.floor(this._capacity*f));this._resize(t)}_resize(t){if(s(this._updating,"not updating"),t===this._capacity)return;const i=new r(this._rctx,this._elementSize,t);if(this._buffer){this._firstIndex&&(this._firstIndex=(this._firstIndex+this._capacity-this._tailIndex)%this._capacity);const t=this.size,e=this._compactInstances(i);s(e===t,"invalid compaction"),this._buffer.destroy(),this._tailIndex=0,this._headIndex=e,this._prevHeadIndex=0}this._resized=!0,this._capacity=t,this._buffer=i,this._view=new h(this._instanceBufferLayout.createView(this._buffer.array))}_compactInstances(t){const i=this._headIndex,e=this._tailIndex;return e<i?(this._buffer.copyRange(e,i,t),i-e):e>i?(this._buffer.copyRange(e,this._capacity,t),i>0&&this._buffer.copyRange(0,i,t,this._capacity-e),i+(this._capacity-e)):0}_incrementHead(t=1){this._headIndex=(this._headIndex+t)%this._capacity}_incrementTail(t=1){this._tailIndex=(this._tailIndex+t)%this._capacity}_transferRange(t,i){t<i?this._buffer.transferRange(t,i):t>i&&(i>0&&this._buffer.transferRange(0,i),this._buffer.transferRange(t,this._capacity))}}const _=1024,d=2,c=.3,f=.5;export{n as RenderInstanceData,h as RenderInstanceDataView};
5
+ import{BufferViewVec3f as t,BufferViewMat3f as i,BufferViewVec4f as e,BufferViewVec4u8 as s}from"../../../../../geometry/support/buffer/BufferView.js";import{assert as a}from"../Util.js";import{VertexAttribute as r}from"../VertexAttribute.js";import h from"./BackedBufferObject.js";class n{constructor(a){this.modelOriginHi=a.getField(r.MODELORIGINHI,t),this.modelOriginLo=a.getField(r.MODELORIGINLO,t),this.model=a.getField(r.MODEL,i),this.modelNormal=a.getField(r.MODELNORMAL,i),this.color=a.getField(r.INSTANCECOLOR,e),this.featureAttribute=a.getField(r.INSTANCEFEATUREATTRIBUTE,e),this.objectAndLayerIdColor=a.getField(r.OBJECTANDLAYERIDCOLOR_INSTANCED,s)}}class d{constructor(t,i){this._headIndex=0,this._tailIndex=0,this._captureFirstIndex=!0,this._updating=!1,this._prevHeadIndex=0,this._resized=!1,this._rctx=t,this._instanceBufferLayout=i,this._elementSize=i.stride,this._capacity=1}destroy(){this._buffer&&this._buffer.destroy()}get buffer(){return this._buffer.buffer}get view(){return this._view}get capacity(){return this._capacity}get size(){const t=this._headIndex,i=this._tailIndex;return t>=i?t-i:t+this._capacity-i}get isEmpty(){return this._headIndex===this._tailIndex}get isFull(){return this._tailIndex===(this._headIndex+1)%this._capacity}get headIndex(){return this._headIndex}get tailIndex(){return this._tailIndex}get firstIndex(){return this._firstIndex}get memoryUsage(){return this._buffer?this._buffer.memoryUsage:{cpu:0,gpu:0}}reset(){this._headIndex=0,this._tailIndex=0,this._firstIndex=null}startUpdateCylce(){this._captureFirstIndex=!0}beginUpdate(){a(!this._updating,"already updating"),this._updating=!0,this._prevHeadIndex=this._headIndex}endUpdate(){a(this._updating,"not updating"),this.size<f*this.capacity&&this._shrink(),this._resized?(this._buffer.transferAll(),this._resized=!1):this._transferRange(this._prevHeadIndex,this._headIndex),this._updating=!1}allocateHead(){a(this._updating,"not updating"),this.isFull&&this._grow();const t=this.headIndex;return this._captureFirstIndex&&(this._firstIndex=t,this._captureFirstIndex=!1),this._incrementHead(),a(this._headIndex!==this._tailIndex,"invalid pointers"),t}freeTail(){a(this._updating,"not updating"),a(this.size>0,"invalid size");const t=this._tailIndex===this._firstIndex;this._incrementTail(),t&&(this._firstIndex=this._tailIndex)}_grow(){const t=Math.max(_,Math.floor(this._capacity*c));this._resize(t)}_shrink(){const t=Math.max(_,Math.floor(this._capacity*u));this._resize(t)}_resize(t){if(a(this._updating,"not updating"),t===this._capacity)return;const i=new h(this._rctx,this._elementSize,t);if(this._buffer){this._firstIndex&&(this._firstIndex=(this._firstIndex+this._capacity-this._tailIndex)%this._capacity);const t=this.size,e=this._compactInstances(i);a(e===t,"invalid compaction"),this._buffer.destroy(),this._tailIndex=0,this._headIndex=e,this._prevHeadIndex=0}this._resized=!0,this._capacity=t,this._buffer=i,this._view=new n(this._instanceBufferLayout.createView(this._buffer.array))}_compactInstances(t){const i=this._headIndex,e=this._tailIndex;return e<i?(this._buffer.copyRange(e,i,t),i-e):e>i?(this._buffer.copyRange(e,this._capacity,t),i>0&&this._buffer.copyRange(0,i,t,this._capacity-e),i+(this._capacity-e)):0}_incrementHead(t=1){this._headIndex=(this._headIndex+t)%this._capacity}_incrementTail(t=1){this._tailIndex=(this._tailIndex+t)%this._capacity}_transferRange(t,i){t<i?this._buffer.transferRange(t,i):t>i&&(i>0&&this._buffer.transferRange(0,i),this._buffer.transferRange(t,this._capacity))}}const _=1024,c=2,f=.3,u=.5;export{d as RenderInstanceData,n as RenderInstanceDataView};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as e}from"../../../../core/maybe.js";import{s as t,c as r,n as a,b as s,l as i,g as o,e as n,t as h}from"../../../../chunks/vec3.js";import{c,f as l}from"../../../../chunks/vec3f64.js";import{ViewingMode as u}from"../../../ViewingMode.js";import{newLayout as m}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as p}from"../core/shaderLibrary/ShaderOutput.js";import{NormalAttributeType as d}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{NormalsDoubleSidedMode as f}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as g}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{CullFaceOptions as _}from"../lib/basicInterfaces.js";import{GLTextureMaterial as T}from"../lib/GLTextureMaterial.js";import{Material as v}from"../lib/Material.js";import{OITPolygonOffsetLimit as b}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as S}from"../lib/RenderSlot.js";import{VertexAttribute as O}from"../lib/VertexAttribute.js";import{getVerticalOffsetObject3D as x}from"../lib/verticalOffsetUtils.js";import{writeDefaultAttributes as w}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as A,intersectTriangleGeometry as M}from"./internal/MaterialUtil.js";import{DefaultMaterialTechnique as y,DefaultMaterialPassParameters as L}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as E}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as I}from"../shaders/RealisticTreeTechnique.js";class R extends v{constructor(e){super(e,D),this.supportsEdges=!0,this._configuration=new E,this._vertexBufferLayout=j(this.parameters),this._instanceBufferLayout=e.instanced?B(this.parameters):null}isVisibleForOutput(e){return e!==p.Shadow&&e!==p.ShadowExludeHighlight&&e!==p.ShadowHighlight||this.parameters.castShadows}isVisible(){const t=this.parameters;if(!super.isVisible()||0===t.layerOpacity)return!1;const{instanced:r,hasVertexColors:a,hasSymbolColors:s,vvColorEnabled:i}=t,o=e(r)&&r.includes("color"),n="replace"===t.colorMixMode,h=t.opacity>0,c=t.externalColor&&t.externalColor[3]>0;return a&&(o||i||s)?!!n||h:a?n?c:h:o||i||s?!!n||h:n?c:h}getConfiguration(t,r){return this._configuration.output=t,this._configuration.hasNormalTexture=!!this.parameters.normalTextureId,this._configuration.hasColorTexture=!!this.parameters.textureId,this._configuration.hasVertexTangents=this.parameters.hasVertexTangents,this._configuration.instanced=!!this.parameters.instanced,this._configuration.instancedDoublePrecision=this.parameters.instancedDoublePrecision,this._configuration.vvSize=this.parameters.vvSizeEnabled,this._configuration.hasVerticalOffset=e(this.parameters.verticalOffset),this._configuration.hasScreenSizePerspective=e(this.parameters.screenSizePerspective),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasSliceHighlight=this.parameters.hasSliceHighlight,this._configuration.alphaDiscardMode=this.parameters.textureAlphaMode,this._configuration.normalType="screenDerivative"===this.parameters.normals?d.ScreenDerivative:d.Attribute,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,e(this.parameters.customDepthTest)&&(this._configuration.customDepthTest=this.parameters.customDepthTest),this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?_.None:this.parameters.cullFace,this._configuration.hasMultipassTerrain=r.multipassTerrain.enabled,this._configuration.cullAboveGround=r.multipassTerrain.cullAboveGround,this._configuration.hasModelTransformation=e(this.parameters.modelTransformation),t!==p.Color&&t!==p.Alpha||(this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.hasSymbolColors=this.parameters.hasSymbolColors,this.parameters.treeRendering?this._configuration.doubleSidedMode=f.WindingOrder:this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?f.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?f.WindingOrder:f.None,this._configuration.instancedColor=e(this.parameters.instanced)&&this.parameters.instanced.includes("color"),this._configuration.receiveShadows=this.parameters.receiveShadows&&this.parameters.shadowMappingEnabled,this._configuration.receiveAmbientOcclusion=!!r.ssaoHelper.ready&&this.parameters.receiveSSAO,this._configuration.vvColor=this.parameters.vvColorEnabled,this._configuration.textureAlphaPremultiplied=!!this.parameters.textureAlphaPremultiplied,this._configuration.pbrMode=this.parameters.usePBR?this.parameters.isSchematic?g.Schematic:g.Normal:g.Disabled,this._configuration.hasMetalnessAndRoughnessTexture=!!this.parameters.metallicRoughnessTextureId,this._configuration.hasEmissionTexture=!!this.parameters.emissiveTextureId,this._configuration.hasOcclusionTexture=!!this.parameters.occlusionTextureId,this._configuration.offsetBackfaces=!(!this.parameters.transparent||!this.parameters.offsetTransparentBackfaces),this._configuration.transparencyPassType=r.transparencyPassType,this._configuration.enableOffset=r.camera.relativeElevation<b,this._configuration.snowCover=this.hasSnowCover(r)),this._configuration}hasSnowCover(t){return e(t.weather)&&t.weatherVisible&&"snowy"===t.weather.type&&"enabled"===t.weather.snowCover}intersect(c,l,m,p,d,f,g){if(e(this.parameters.verticalOffset)){const e=p.camera;t(k,m[12],m[13],m[14]);let c=null;switch(p.viewingMode){case u.Global:c=a(U,k);break;case u.Local:c=r(U,G)}let l=0;const g=s(q,k,e.eye),_=i(g),T=o(g,g,1/_);let v=null;this.parameters.screenSizePerspective&&(v=n(c,T)),l+=A(e,_,this.parameters.verticalOffset,v,this.parameters.screenSizePerspective),o(c,c,l),h(z,c,p.transform.inverseRotation),d=s(V,d,z),f=s(H,f,z)}M(c,l,p,d,f,x(p.verticalOffset),g)}requiresSlot(e,t){if(t===p.Color||t===p.Alpha||t===p.Depth||t===p.Normal||t===p.Shadow||t===p.ShadowHighlight||t===p.ShadowExludeHighlight||t===p.Highlight){return e===(this.parameters.transparent?this.parameters.writeDepth?S.TRANSPARENT_MATERIAL:S.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:S.OPAQUE_MATERIAL)||e===S.DRAPED_MATERIAL}return!1}createGLMaterial(e){return new C(e)}createBufferWriter(){return new N(this._vertexBufferLayout,this._instanceBufferLayout)}}class C extends T{constructor(e){super({...e,...e.material.parameters})}_updateParameters(e){const r=this._material.parameters;this.updateTexture(r.textureId);const a=e.camera.viewInverseTransposeMatrix;return t(r.origin,a[3],a[7],a[11]),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(r.treeRendering?I:y,e)}_updateShadowState(e){e.shadowMap.enabled!==this._material.parameters.shadowMappingEnabled&&this._material.setParameters({shadowMappingEnabled:e.shadowMap.enabled})}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output!==p.Color&&this._output!==p.Alpha||(this._updateShadowState(e),this._updateOccludeeState(e)),this._updateParameters(e)}}class P extends L{constructor(){super(...arguments),this.initTextureTransparent=!1,this.treeRendering=!1,this.hasVertexTangents=!1}}const D=new P;class N{constructor(e,t){this.vertexBufferLayout=e,this.instanceBufferLayout=t}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return e.indices.get(O.POSITION).length}write(e,t,r,a){w(t,this.vertexBufferLayout,e.transformation,e.invTranspTransformation,r,a)}}function j(e){const t=e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId,r=m().vec3f(O.POSITION).vec3f(O.NORMAL);return e.hasVertexTangents&&r.vec4f(O.TANGENT),t&&r.vec2f(O.UV0),e.hasVertexColors&&r.vec4u8(O.COLOR),e.hasSymbolColors&&r.vec4u8(O.SYMBOLCOLOR),r}function B(t){let r=m();return r=t.instancedDoublePrecision?r.vec3f(O.MODELORIGINHI).vec3f(O.MODELORIGINLO).mat3f(O.MODEL).mat3f(O.MODELNORMAL):r.mat4f(O.MODEL).mat4f(O.MODELNORMAL),e(t.instanced)&&t.instanced.includes("color")&&(r=r.vec4f(O.INSTANCECOLOR)),e(t.instanced)&&t.instanced.includes("featureAttribute")&&(r=r.vec4f(O.INSTANCEFEATUREATTRIBUTE)),r}const V=c(),H=c(),G=l(0,0,1),U=c(),z=c(),k=c(),q=c();export{C as DefaultGLMaterial,R as DefaultMaterial,P as DefaultMaterialParameters,B as getInstanceBufferLayout};
5
+ import has from"../../../../core/has.js";import{isSome as e}from"../../../../core/maybe.js";import{s as t,c as r,n as a,b as s,l as i,g as o,e as n,t as h}from"../../../../chunks/vec3.js";import{c,f as l}from"../../../../chunks/vec3f64.js";import{ViewingMode as u}from"../../../ViewingMode.js";import{newLayout as m}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as d}from"../core/shaderLibrary/ShaderOutput.js";import{NormalAttributeType as p}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{NormalsDoubleSidedMode as f}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as g}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{CullFaceOptions as T}from"../lib/basicInterfaces.js";import{GLTextureMaterial as _}from"../lib/GLTextureMaterial.js";import{Material as b}from"../lib/Material.js";import{OITPolygonOffsetLimit as v}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as O}from"../lib/RenderSlot.js";import{VertexAttribute as S}from"../lib/VertexAttribute.js";import{getVerticalOffsetObject3D as A}from"../lib/verticalOffsetUtils.js";import{writeDefaultAttributes as x}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as L,intersectTriangleGeometry as I}from"./internal/MaterialUtil.js";import{DefaultMaterialTechnique as w,DefaultMaterialPassParameters as y}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as E}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as C}from"../shaders/RealisticTreeTechnique.js";class M extends b{constructor(e){super(e,P),this.supportsEdges=!0,this._configuration=new E,this._vertexBufferLayout=N(this.parameters),this._instanceBufferLayout=e.instanced?B(this.parameters):null}isVisibleForOutput(e){return e!==d.Shadow&&e!==d.ShadowExludeHighlight&&e!==d.ShadowHighlight||this.parameters.castShadows}isVisible(){const t=this.parameters;if(!super.isVisible()||0===t.layerOpacity)return!1;const{instanced:r,hasVertexColors:a,hasSymbolColors:s,vvColorEnabled:i}=t,o=e(r)&&r.includes("color"),n="replace"===t.colorMixMode,h=t.opacity>0,c=t.externalColor&&t.externalColor[3]>0;return a&&(o||i||s)?!!n||h:a?n?c:h:o||i||s?!!n||h:n?c:h}getConfiguration(t,r){return this._configuration.output=t,this._configuration.hasNormalTexture=!!this.parameters.normalTextureId,this._configuration.hasColorTexture=!!this.parameters.textureId,this._configuration.hasVertexTangents=this.parameters.hasVertexTangents,this._configuration.instanced=!!this.parameters.instanced,this._configuration.instancedDoublePrecision=this.parameters.instancedDoublePrecision,this._configuration.vvSize=this.parameters.vvSizeEnabled,this._configuration.hasVerticalOffset=e(this.parameters.verticalOffset),this._configuration.hasScreenSizePerspective=e(this.parameters.screenSizePerspective),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasSliceHighlight=this.parameters.hasSliceHighlight,this._configuration.alphaDiscardMode=this.parameters.textureAlphaMode,this._configuration.normalType="screenDerivative"===this.parameters.normals?p.ScreenDerivative:p.Attribute,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,e(this.parameters.customDepthTest)&&(this._configuration.customDepthTest=this.parameters.customDepthTest),this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?T.None:this.parameters.cullFace,this._configuration.hasMultipassTerrain=r.multipassTerrain.enabled,this._configuration.cullAboveGround=r.multipassTerrain.cullAboveGround,this._configuration.hasModelTransformation=e(this.parameters.modelTransformation),t!==d.Color&&t!==d.Alpha||(this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.hasSymbolColors=this.parameters.hasSymbolColors,this.parameters.treeRendering?this._configuration.doubleSidedMode=f.WindingOrder:this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?f.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?f.WindingOrder:f.None,this._configuration.instancedColor=e(this.parameters.instanced)&&this.parameters.instanced.includes("color"),this._configuration.receiveShadows=this.parameters.receiveShadows&&this.parameters.shadowMappingEnabled,this._configuration.receiveAmbientOcclusion=!!r.ssaoHelper.ready&&this.parameters.receiveSSAO,this._configuration.vvColor=this.parameters.vvColorEnabled,this._configuration.textureAlphaPremultiplied=!!this.parameters.textureAlphaPremultiplied,this._configuration.pbrMode=this.parameters.usePBR?this.parameters.isSchematic?g.Schematic:g.Normal:g.Disabled,this._configuration.hasMetalnessAndRoughnessTexture=!!this.parameters.metallicRoughnessTextureId,this._configuration.hasEmissionTexture=!!this.parameters.emissiveTextureId,this._configuration.hasOcclusionTexture=!!this.parameters.occlusionTextureId,this._configuration.offsetBackfaces=!(!this.parameters.transparent||!this.parameters.offsetTransparentBackfaces),this._configuration.transparencyPassType=r.transparencyPassType,this._configuration.enableOffset=r.camera.relativeElevation<v,this._configuration.snowCover=this.hasSnowCover(r)),this._configuration}hasSnowCover(t){return e(t.weather)&&t.weatherVisible&&"snowy"===t.weather.type&&"enabled"===t.weather.snowCover}intersect(c,l,m,d,p,f,g){if(e(this.parameters.verticalOffset)){const e=d.camera;t(k,m[12],m[13],m[14]);let c=null;switch(d.viewingMode){case u.Global:c=a(U,k);break;case u.Local:c=r(U,G)}let l=0;const g=s(q,k,e.eye),T=i(g),_=o(g,g,1/T);let b=null;this.parameters.screenSizePerspective&&(b=n(c,_)),l+=L(e,T,this.parameters.verticalOffset,b,this.parameters.screenSizePerspective),o(c,c,l),h(z,c,d.transform.inverseRotation),p=s(V,p,z),f=s(H,f,z)}I(c,l,d,p,f,A(d.verticalOffset),g)}requiresSlot(e,t){if(t===d.Color||t===d.Alpha||t===d.Depth||t===d.Normal||t===d.Shadow||t===d.ShadowHighlight||t===d.ShadowExludeHighlight||t===d.Highlight||t===d.ObjectAndLayerIdColor){return e===(this.parameters.transparent?this.parameters.writeDepth?O.TRANSPARENT_MATERIAL:O.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:O.OPAQUE_MATERIAL)||e===O.DRAPED_MATERIAL||t===d.ObjectAndLayerIdColor&&this.parameters.writeObjectAndLayerId}return!1}createGLMaterial(e){return new R(e)}createBufferWriter(){return new j(this._vertexBufferLayout,this._instanceBufferLayout)}}class R extends _{constructor(e){super({...e,...e.material.parameters})}_updateParameters(e){const r=this._material.parameters;this.updateTexture(r.textureId);const a=e.camera.viewInverseTransposeMatrix;return t(r.origin,a[3],a[7],a[11]),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(r.treeRendering?C:w,e)}_updateShadowState(e){e.shadowMap.enabled!==this._material.parameters.shadowMappingEnabled&&this._material.setParameters({shadowMappingEnabled:e.shadowMap.enabled})}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output!==d.Color&&this._output!==d.Alpha||(this._updateShadowState(e),this._updateOccludeeState(e)),this._updateParameters(e)}}class D extends y{constructor(){super(...arguments),this.initTextureTransparent=!1,this.treeRendering=!1,this.writeObjectAndLayerId=!1,this.hasVertexTangents=!1}}const P=new D;class j{constructor(e,t){this.vertexBufferLayout=e,this.instanceBufferLayout=t}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return e.indices.get(S.POSITION).length}write(e,t,r,a){x(t,this.vertexBufferLayout,e.transformation,e.invTranspTransformation,r,a)}}function N(e){const t=e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId,r=m().vec3f(S.POSITION).vec3f(S.NORMAL);return e.hasVertexTangents&&r.vec4f(S.TANGENT),t&&r.vec2f(S.UV0),e.hasVertexColors&&r.vec4u8(S.COLOR),e.hasSymbolColors&&r.vec4u8(S.SYMBOLCOLOR),has("enable-feature:objectAndLayerId-rendering")&&r.vec4u8(S.OBJECTANDLAYERIDCOLOR),r}function B(t){let r=m();return r=t.instancedDoublePrecision?r.vec3f(S.MODELORIGINHI).vec3f(S.MODELORIGINLO).mat3f(S.MODEL).mat3f(S.MODELNORMAL):r.mat4f(S.MODEL).mat4f(S.MODELNORMAL),e(t.instanced)&&t.instanced.includes("color")&&(r=r.vec4f(S.INSTANCECOLOR)),e(t.instanced)&&t.instanced.includes("featureAttribute")&&(r=r.vec4f(S.INSTANCEFEATUREATTRIBUTE)),e(t.instanced)&&t.instanced.includes("objectAndLayerIdColor")&&(r=r.vec4u8(S.OBJECTANDLAYERIDCOLOR_INSTANCED)),r}const V=c(),H=c(),G=l(0,0,1),U=c(),z=c(),k=c(),q=c();export{R as DefaultGLMaterial,M as DefaultMaterial,D as DefaultMaterialParameters,B as getInstanceBufferLayout};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Logger.js";import{isSome as t,isNone as r}from"../../../../core/maybe.js";import{createRenderScreenPointArray3 as s}from"../../../../core/screenUtils.js";import{c as i}from"../../../../chunks/vec2.js";import{s as o,b as n,e as a,g as c,a as l,c as u,l as p,i as f,m}from"../../../../chunks/vec3.js";import{c as h}from"../../../../chunks/vec3f64.js";import{O as d}from"../../../../chunks/vec4f64.js";import{PlaneIndex as g}from"../../../../geometry/support/frustum.js";import{create as _,distance2 as A,fromPoints as O,closestLineSegmentPoint as T}from"../../../../geometry/support/lineSegment.js";import{create as S,fromPoints as P,signedDistance as j,normal as y}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as b,BufferViewVec2f as x}from"../../../../geometry/support/buffer/BufferView.js";import{ShaderOutput as v}from"../core/shaderLibrary/ShaderOutput.js";import{computeAttachmentOriginLines as R}from"../lib/geometryDataUtils.js";import N from"../lib/GLMaterial.js";import{Material as E,MaterialParameters as I}from"../lib/Material.js";import{RenderSlot as L}from"../lib/RenderSlot.js";import{isTranslationMatrix as w}from"../lib/Util.js";import{VertexAttribute as C}from"../lib/VertexAttribute.js";import{writeDefaultAttributes as U}from"./internal/bufferWriterUtils.js";import{PositionColorLayout as B,PositionLayout as V,DefaultBufferWriter as M}from"./internal/DefaultBufferWriter.js";import{intersectDrapedRenderLineGeometry as D}from"./internal/MaterialUtil.js";import{isInstanceHidden as k}from"./renderers/utils.js";import{NativeLineTechnique as q}from"../shaders/NativeLineTechnique.js";import{NativeLineTechniqueConfiguration as G}from"../shaders/NativeLineTechniqueConfiguration.js";var X;!function(e){e[e.START=0]="START",e[e.END=1]="END"}(X||(X={}));class F extends E{constructor(e){super(e,new Q),this._configuration=new G}getConfiguration(e,r){this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.transparent=this.parameters.color[3]<1||this.parameters.width<1,this._configuration.draped=r.slot===L.DRAPED_MATERIAL;const s=t(this.parameters.stipplePattern);return this._configuration.stippleEnabled=s,this._configuration.stippleOffColorEnabled=s&&t(this.parameters.stippleOffColor),this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.stipplePreferContinuous=this.parameters.stipplePreferContinuous,this._configuration}intersect(e,r,s,i,o,n,a,c,l){t(l)?D(e,i,l,n,1,a):this._intersectLineGeometry(e,r,s,i,a)}_intersectLineGeometry(t,r,s,m,h){if(!m.options.selectionMode||k(r))return;if(!w(s))return void e.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial").error("intersection assumes a translation-only matrix");const d=t.vertexAttributes.get(C.POSITION).data,_=m.camera,S=ie;i(S,m.point);const b=2;o(oe[0],S[0]-b,S[1]+b,0),o(oe[1],S[0]+b,S[1]+b,0),o(oe[2],S[0]+b,S[1]-b,0),o(oe[3],S[0]-b,S[1]-b,0);for(let e=0;e<4;e++)if(!_.unprojectFromRenderScreen(oe[e],ne[e]))return;P(_.eye,ne[0],ne[1],ae),P(_.eye,ne[1],ne[2],ce),P(_.eye,ne[2],ne[3],le),P(_.eye,ne[3],ne[0],ue);let x=Number.MAX_VALUE,v=0;for(let e=0;e<d.length-5;e+=3){if(z[0]=d[e]+s[12],z[1]=d[e+1]+s[13],z[2]=d[e+2]+s[14],J[0]=d[e+3]+s[12],J[1]=d[e+4]+s[13],J[2]=d[e+5]+s[14],j(ae,z)<0&&j(ae,J)<0||j(ce,z)<0&&j(ce,J)<0||j(le,z)<0&&j(le,J)<0||j(ue,z)<0&&j(ue,J)<0)continue;if(_.projectToRenderScreen(z,Z),_.projectToRenderScreen(J,$),Z[2]<0&&$[2]>0){n(K,z,J);const e=_.frustum,t=-j(e[g.NEAR],z)/a(K,y(e[g.NEAR]));c(K,K,t),l(z,z,K),_.projectToRenderScreen(z,Z)}else if(Z[2]>0&&$[2]<0){n(K,J,z);const e=_.frustum,t=-j(e[g.NEAR],J)/a(K,y(e[g.NEAR]));c(K,K,t),l(J,J,K),_.projectToRenderScreen(J,$)}else if(Z[2]<0&&$[2]<0)continue;Z[2]=0,$[2]=0;const t=A(O(Z,$,re),S);t<x&&(x=t,u(ee,z),u(te,J),v=e/3)}const R=m.rayBegin,N=m.rayEnd;if(x<b*b){let e=Number.MAX_VALUE;if(T(O(ee,te,re),O(R,N,se),Y)){n(Y,Y,R);const t=p(Y);c(Y,Y,1/t),e=t/f(R,N)}h(e,Y,v,!1)}}computeAttachmentOrigin(e,t){const r=e.vertexAttributes;if(!r)return!1;const s=r.get(C.POSITION);return R(s,null,!1,t)}requiresSlot(e,t){return!(t!==v.Color&&t!==v.Highlight||e!==L.OPAQUE_MATERIAL&&e!==L.DRAPED_MATERIAL)}createGLMaterial(e){return new W(e)}createBufferWriter(){const e=this.parameters.hasVertexColors?B:V;return r(this.parameters.stipplePattern)?new M(e):new H(e.clone().vec3f(C.AUXPOS1).vec2f(C.UV0))}}class W extends N{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextureRepository.release(this._stipplePattern),this._stipplePattern=null}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){this._output===v.Color&&this._updateOccludeeState(e);const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters(this._stippleTextureRepository.swap(this._stipplePattern,t)),this._stipplePattern=t),this.ensureTechnique(q,e)}}class H{constructor(e){this.vertexBufferLayout=e}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return e.indices.get(C.POSITION).length}write(e,t,r,s){U(t,this.vertexBufferLayout,e.transformation,e.invTranspTransformation,r,s),this._writeAuxpos1(e,t,r,s),this._writeUV0(e,t,r,s)}_writeAuxpos1(e,t,r,s){const i=r.getField(C.AUXPOS1,b),o=t.indices.get(C.POSITION),n=t.vertexAttributes.get(C.POSITION).data,a=e.transformation,c=i.typedBufferStride,l=i.typedBuffer;s*=c;for(let u=0;u<o.length-1;u+=2)for(const e of[1,0]){const t=3*o[u+e],r=n[t],i=n[t+1],p=n[t+2],f=a[0]*r+a[4]*i+a[8]*p+a[12],m=a[1]*r+a[5]*i+a[9]*p+a[13],h=a[2]*r+a[6]*i+a[10]*p+a[14];l[s]=f,l[s+1]=m,l[s+2]=h,s+=c}}_writeUV0(e,t,r,s){const i=r.getField(C.UV0,x),n=t.indices.get(C.POSITION),a=t.vertexAttributes.get(C.POSITION).data,c=t.vertexAttributes.get(C.DISTANCETOSTART)?.data,l=e.transformation,p=i.typedBufferStride,h=i.typedBuffer;let d=0;h[s*=p]=X.START,h[s+1]=d,s+=p;const g=3*n[0],_=o(z,a[g],a[g+1],a[g+2]);l&&m(_,_,l);const A=J,O=n.length-1;let T=1;const S=c?(e,t,r)=>d=c[r]:(e,t,r)=>d+=f(e,t);for(let f=1;f<O;f+=2){const e=3*n[f];o(A,a[e],a[e+1],a[e+2]),l&&m(A,A,l),S(_,A,T++);for(let t=0;t<2;++t)h[s]=1-t,h[s+1]=d,s+=p;u(_,A)}const P=3*n[O];o(A,a[P],a[P+1],a[P+2]),l&&m(A,A,l),S(_,A,T),h[s]=X.END,h[s+1]=d}}class Q extends I{constructor(){super(...arguments),this.color=d,this.hasVertexColors=!1,this.hasSlicePlane=!1,this.width=1,this.stipplePreferContinuous=!0,this.hasOccludees=!1,this.stippleTexture=null}}const z=h(),J=h(),K=h(),Y=h(),Z=s(),$=s(),ee=h(),te=h(),re=_(),se=_(),ie=h(),oe=[s(),s(),s(),s()],ne=[h(),h(),h(),h()],ae=S(),ce=S(),le=S(),ue=S();export{F as NativeLineMaterial,Q as Parameters};
5
+ import e from"../../../../core/Logger.js";import{isSome as t,isNone as r}from"../../../../core/maybe.js";import{createRenderScreenPointArray3 as s}from"../../../../core/screenUtils.js";import{c as i}from"../../../../chunks/vec2.js";import{s as o,b as n,e as a,g as c,a as l,c as u,l as p,i as f,m}from"../../../../chunks/vec3.js";import{c as h}from"../../../../chunks/vec3f64.js";import{O as d}from"../../../../chunks/vec4f64.js";import{PlaneIndex as g}from"../../../../geometry/support/frustum.js";import{create as _,distance2 as A,fromPoints as O,closestLineSegmentPoint as T}from"../../../../geometry/support/lineSegment.js";import{create as S,fromPoints as j,signedDistance as P,normal as y}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as b,BufferViewVec2f as x}from"../../../../geometry/support/buffer/BufferView.js";import{ShaderOutput as v}from"../core/shaderLibrary/ShaderOutput.js";import{computeAttachmentOriginLines as R}from"../lib/geometryDataUtils.js";import N from"../lib/GLMaterial.js";import{Material as E,MaterialParameters as I}from"../lib/Material.js";import{RenderSlot as L}from"../lib/RenderSlot.js";import{isTranslationMatrix as w}from"../lib/Util.js";import{VertexAttribute as C}from"../lib/VertexAttribute.js";import{writeDefaultAttributes as U}from"./internal/bufferWriterUtils.js";import{PositionColorLayout as B,PositionLayout as V,DefaultBufferWriter as M}from"./internal/DefaultBufferWriter.js";import{intersectDrapedRenderLineGeometry as D}from"./internal/MaterialUtil.js";import{isInstanceHidden as k}from"./renderers/utils.js";import{NativeLineTechnique as q}from"../shaders/NativeLineTechnique.js";import{NativeLineTechniqueConfiguration as G}from"../shaders/NativeLineTechniqueConfiguration.js";var X;!function(e){e[e.START=0]="START",e[e.END=1]="END"}(X||(X={}));class F extends E{constructor(e){super(e,new Q),this._configuration=new G}getConfiguration(e,r){this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.transparent=this.parameters.color[3]<1||this.parameters.width<1,this._configuration.draped=r.slot===L.DRAPED_MATERIAL;const s=t(this.parameters.stipplePattern);return this._configuration.stippleEnabled=s,this._configuration.stippleOffColorEnabled=s&&t(this.parameters.stippleOffColor),this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.stipplePreferContinuous=this.parameters.stipplePreferContinuous,this._configuration}intersect(e,r,s,i,o,n,a,c,l){t(l)?D(e,i,l,n,1,a):this._intersectLineGeometry(e,r,s,i,a)}_intersectLineGeometry(t,r,s,m,h){if(!m.options.selectionMode||k(r))return;if(!w(s))return void e.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial").error("intersection assumes a translation-only matrix");const d=t.vertexAttributes.get(C.POSITION).data,_=m.camera,S=ie;i(S,m.point);const b=2;o(oe[0],S[0]-b,S[1]+b,0),o(oe[1],S[0]+b,S[1]+b,0),o(oe[2],S[0]+b,S[1]-b,0),o(oe[3],S[0]-b,S[1]-b,0);for(let e=0;e<4;e++)if(!_.unprojectFromRenderScreen(oe[e],ne[e]))return;j(_.eye,ne[0],ne[1],ae),j(_.eye,ne[1],ne[2],ce),j(_.eye,ne[2],ne[3],le),j(_.eye,ne[3],ne[0],ue);let x=Number.MAX_VALUE,v=0;for(let e=0;e<d.length-5;e+=3){if(z[0]=d[e]+s[12],z[1]=d[e+1]+s[13],z[2]=d[e+2]+s[14],J[0]=d[e+3]+s[12],J[1]=d[e+4]+s[13],J[2]=d[e+5]+s[14],P(ae,z)<0&&P(ae,J)<0||P(ce,z)<0&&P(ce,J)<0||P(le,z)<0&&P(le,J)<0||P(ue,z)<0&&P(ue,J)<0)continue;if(_.projectToRenderScreen(z,Z),_.projectToRenderScreen(J,$),Z[2]<0&&$[2]>0){n(K,z,J);const e=_.frustum,t=-P(e[g.NEAR],z)/a(K,y(e[g.NEAR]));c(K,K,t),l(z,z,K),_.projectToRenderScreen(z,Z)}else if(Z[2]>0&&$[2]<0){n(K,J,z);const e=_.frustum,t=-P(e[g.NEAR],J)/a(K,y(e[g.NEAR]));c(K,K,t),l(J,J,K),_.projectToRenderScreen(J,$)}else if(Z[2]<0&&$[2]<0)continue;Z[2]=0,$[2]=0;const t=A(O(Z,$,re),S);t<x&&(x=t,u(ee,z),u(te,J),v=e/3)}const R=m.rayBegin,N=m.rayEnd;if(x<b*b){let e=Number.MAX_VALUE;if(T(O(ee,te,re),O(R,N,se),Y)){n(Y,Y,R);const t=p(Y);c(Y,Y,1/t),e=t/f(R,N)}h(e,Y,v,!1)}}computeAttachmentOrigin(e,t){const r=e.vertexAttributes;if(!r)return!1;const s=r.get(C.POSITION);return R(s,null,!1,t)}requiresSlot(e,t){return!(t!==v.Color&&t!==v.Highlight&&t!==v.ObjectAndLayerIdColor||e!==L.OPAQUE_MATERIAL&&e!==L.DRAPED_MATERIAL)}createGLMaterial(e){return new W(e)}createBufferWriter(){const e=this.parameters.hasVertexColors?B:V;return r(this.parameters.stipplePattern)?new M(e):new H(e.clone().vec3f(C.AUXPOS1).vec2f(C.UV0))}}class W extends N{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextureRepository.release(this._stipplePattern),this._stipplePattern=null}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){this._output===v.Color&&this._updateOccludeeState(e);const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters(this._stippleTextureRepository.swap(this._stipplePattern,t)),this._stipplePattern=t),this.ensureTechnique(q,e)}}class H{constructor(e){this.vertexBufferLayout=e}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return e.indices.get(C.POSITION).length}write(e,t,r,s){U(t,this.vertexBufferLayout,e.transformation,e.invTranspTransformation,r,s),this._writeAuxpos1(e,t,r,s),this._writeUV0(e,t,r,s)}_writeAuxpos1(e,t,r,s){const i=r.getField(C.AUXPOS1,b),o=t.indices.get(C.POSITION),n=t.vertexAttributes.get(C.POSITION).data,a=e.transformation,c=i.typedBufferStride,l=i.typedBuffer;s*=c;for(let u=0;u<o.length-1;u+=2)for(const e of[1,0]){const t=3*o[u+e],r=n[t],i=n[t+1],p=n[t+2],f=a[0]*r+a[4]*i+a[8]*p+a[12],m=a[1]*r+a[5]*i+a[9]*p+a[13],h=a[2]*r+a[6]*i+a[10]*p+a[14];l[s]=f,l[s+1]=m,l[s+2]=h,s+=c}}_writeUV0(e,t,r,s){const i=r.getField(C.UV0,x),n=t.indices.get(C.POSITION),a=t.vertexAttributes.get(C.POSITION).data,c=t.vertexAttributes.get(C.DISTANCETOSTART)?.data,l=e.transformation,p=i.typedBufferStride,h=i.typedBuffer;let d=0;h[s*=p]=X.START,h[s+1]=d,s+=p;const g=3*n[0],_=o(z,a[g],a[g+1],a[g+2]);l&&m(_,_,l);const A=J,O=n.length-1;let T=1;const S=c?(e,t,r)=>d=c[r]:(e,t,r)=>d+=f(e,t);for(let f=1;f<O;f+=2){const e=3*n[f];o(A,a[e],a[e+1],a[e+2]),l&&m(A,A,l),S(_,A,T++);for(let t=0;t<2;++t)h[s]=1-t,h[s+1]=d,s+=p;u(_,A)}const j=3*n[O];o(A,a[j],a[j+1],a[j+2]),l&&m(A,A,l),S(_,A,T),h[s]=X.END,h[s+1]=d}}class Q extends I{constructor(){super(...arguments),this.color=d,this.hasVertexColors=!1,this.hasSlicePlane=!1,this.width=1,this.stipplePreferContinuous=!0,this.hasOccludees=!1,this.stippleTexture=null}}const z=h(),J=h(),K=h(),Y=h(),Z=s(),$=s(),ee=h(),te=h(),re=_(),se=_(),ie=h(),oe=[s(),s(),s(),s()],ne=[h(),h(),h(),h()],ae=S(),ce=S(),le=S(),ue=S();export{F as NativeLineMaterial,Q 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/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as e}from"../../../../core/mathUtils.js";import{isNone as t}from"../../../../core/maybe.js";import{fromValues as r}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec4f as i}from"../../../../geometry/support/buffer/BufferView.js";import{newLayout as a}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as s}from"../core/shaderLibrary/ShaderOutput.js";import{NormalsDoubleSidedMode as o}from"../core/shaderLibrary/shading/Normals.glsl.js";import{computeAttachmentOriginLines as n}from"../lib/geometryDataUtils.js";import h from"../lib/GLMaterial.js";import{Material as u}from"../lib/Material.js";import{isPathGeometry as c}from"../lib/PathGeometry.js";import{RenderSlot as l}from"../lib/RenderSlot.js";import{assert as d}from"../lib/Util.js";import{VertexAttribute as p}from"../lib/VertexAttribute.js";import{vertexAttributeLocations as m,PathTechniqueConfiguration as f,PathTechnique as b,PathPassParameters as v}from"./PathTechnique.js";import{writeDefaultAttributes as S,writeBufferVec4 as g}from"./internal/bufferWriterUtils.js";import{intersectAabbInvDir as E}from"./internal/MaterialUtil.js";class A extends u{constructor(e){super(e,new _),this.supportsEdges=!0,this._vertexAttributeLocations=m,this._configuration=new f,this._vertexBufferLayout=A.getVertexBufferLayout(this.parameters)}getConfiguration(e,t){return this._configuration.output=e,this._configuration.vvSize=this.parameters.vvSizeEnabled,this._configuration.vvColor=this.parameters.vvColorEnabled,this._configuration.vvOpacity=this.parameters.vvOpacityEnabled,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.hasOccludees=this.parameters.hasOccludees,e!==s.Color&&e!==s.Alpha||(this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?o.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?o.WindingOrder:o.None,this._configuration.receiveShadows=this.parameters.receiveShadows,this._configuration.receiveAmbientOcclusion=!!t.ssaoHelper.ready&&this.parameters.receiveSSAO),this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.hasMultipassTerrain=t.multipassTerrain.enabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}isVisibleForOutput(e){return e!==s.Shadow&&e!==s.ShadowExludeHighlight&&e!==s.ShadowHighlight||this.parameters.castShadows}isVisible(){return super.isVisible()&&this.parameters.opacity>0}intersect(i,a,s,o,n,h,u){const l=i;if(!c(l))return;const d=l.path,p=[this.parameters.size[0],this.parameters.size[1]];if(this.parameters.vvSizeEnabled){const t=this.parameters.vvSizeOffset,r=this.parameters.vvSizeFactor,i=this.parameters.vvSizeMinSize,a=this.parameters.vvSizeMaxSize,s=d.sizeAttributeValue;p[0]*=e(t[0]+s*r[0],i[0],a[0]),p[1]*=e(t[2]+s*r[2],i[2],a[2])}const m=Math.max(p[0],p[1]),f=i.boundingInfo;if(t(f))return void this._intersectTriangles(d,p,n,h,u);const b=r(f.bbMin[0]-m,f.bbMin[1]-m,f.bbMin[2]-m,f.bbMax[0]+m,f.bbMax[1]+m,f.bbMax[2]+m),v=[h[0]-n[0],h[1]-n[1],h[2]-n[2]],S=Math.sqrt(v[0]*v[0]+v[1]*v[1]+v[2]*v[2]),g=[S/v[0],S/v[1],S/v[2]];E(b,n,g,o.tolerance)&&this._intersectTriangles(d,p,n,h,u)}_intersectTriangles(e,t,r,i,a){e.baked.size&&e.baked.size[0]===t[0]&&e.baked.size[1]===t[1]||e.baked.bake(t),e.baked.intersect(r,i,a)}computeAttachmentOrigin(e,t){const r=e.vertexAttributes;if(!r)return null;const i=r.get(p.POSITION);return n(i,null,!1,t)}createBufferWriter(){return new w(this._vertexBufferLayout)}requiresSlot(e,t){switch(t){case s.Shadow:case s.ShadowHighlight:case s.ShadowExludeHighlight:if(!this.parameters.castShadows)return!1;case s.Color:case s.Alpha:case s.Depth:case s.Normal:case s.Highlight:return e===(this.parameters.transparent?l.TRANSPARENT_MATERIAL:l.OPAQUE_MATERIAL)||e===l.DRAPED_MATERIAL;default:return!1}}createGLMaterial(e){return new O(e)}static getVertexBufferLayout(e){let t=a().vec3f(p.POSITION).vec4f(p.PROFILERIGHT).vec4f(p.PROFILEUP).vec4f(p.PROFILEVERTEXANDNORMAL);return(e.vvColorEnabled||e.vvSizeEnabled||e.vvOpacityEnabled)&&(t=t.vec4f(p.FEATUREVALUE)),t}}class O extends h{_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}_updateShadowState(e){(t(this.technique)||e.shadowMap.enabled!==this.technique.configuration.receiveShadows)&&this._material.setParameters({receiveShadows:e.shadowMap.enabled})}beginSlot(e){return this._output!==s.Color&&this._output!==s.Alpha||(this._updateShadowState(e),this._updateOccludeeState(e)),this.ensureTechnique(b,e)}}class _ extends v{constructor(){super(...arguments),this.doubleSided=!1,this.doubleSidedType="normal",this.receiveSSAO=!0,this.receiveShadows=!1,this.castShadows=!0,this.hasSlicePlane=!1,this.transparent=!1,this.hasOccludees=!1}}class w{constructor(e){this.vertexBufferLayout=e}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return e.indices.get(p.POSITION).length}write(e,t,r,a){const s=e=>{if(t.vertexAttributes.has(e)){const s=t.vertexAttributes.get(e),o=t.indices.get(e);d(4===s.size);const n=r.getField(e,i);if(!n)throw new Error("unable to acquire view for "+e);g(o,s.data,n,a)}};s(p.PROFILERIGHT),s(p.PROFILEUP),s(p.PROFILEVERTEXANDNORMAL),this.vertexBufferLayout.hasField(p.FEATUREVALUE)&&s(p.FEATUREVALUE),S(t,this.vertexBufferLayout,e.transformation,e.invTranspTransformation,r,a)}}export{A as PathMaterial,_ as PathMaterialParameters};
5
+ import{clamp as e}from"../../../../core/mathUtils.js";import{isNone as t}from"../../../../core/maybe.js";import{fromValues as r}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec4f as i}from"../../../../geometry/support/buffer/BufferView.js";import{newLayout as a}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as s}from"../core/shaderLibrary/ShaderOutput.js";import{NormalsDoubleSidedMode as o}from"../core/shaderLibrary/shading/Normals.glsl.js";import{computeAttachmentOriginLines as n}from"../lib/geometryDataUtils.js";import h from"../lib/GLMaterial.js";import{Material as u}from"../lib/Material.js";import{isPathGeometry as c}from"../lib/PathGeometry.js";import{RenderSlot as l}from"../lib/RenderSlot.js";import{assert as d}from"../lib/Util.js";import{VertexAttribute as p}from"../lib/VertexAttribute.js";import{vertexAttributeLocations as m,PathTechniqueConfiguration as f,PathTechnique as b,PathPassParameters as v}from"./PathTechnique.js";import{writeDefaultAttributes as S,writeBufferVec4 as g}from"./internal/bufferWriterUtils.js";import{intersectAabbInvDir as A}from"./internal/MaterialUtil.js";class E extends u{constructor(e){super(e,new _),this.supportsEdges=!0,this._vertexAttributeLocations=m,this._configuration=new f,this._vertexBufferLayout=E.getVertexBufferLayout(this.parameters)}getConfiguration(e,t){return this._configuration.output=e,this._configuration.vvSize=this.parameters.vvSizeEnabled,this._configuration.vvColor=this.parameters.vvColorEnabled,this._configuration.vvOpacity=this.parameters.vvOpacityEnabled,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.hasOccludees=this.parameters.hasOccludees,e!==s.Color&&e!==s.Alpha||(this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?o.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?o.WindingOrder:o.None,this._configuration.receiveShadows=this.parameters.receiveShadows,this._configuration.receiveAmbientOcclusion=!!t.ssaoHelper.ready&&this.parameters.receiveSSAO),this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.hasMultipassTerrain=t.multipassTerrain.enabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}isVisibleForOutput(e){return e!==s.Shadow&&e!==s.ShadowExludeHighlight&&e!==s.ShadowHighlight||this.parameters.castShadows}isVisible(){return super.isVisible()&&this.parameters.opacity>0}intersect(i,a,s,o,n,h,u){const l=i;if(!c(l))return;const d=l.path,p=[this.parameters.size[0],this.parameters.size[1]];if(this.parameters.vvSizeEnabled){const t=this.parameters.vvSizeOffset,r=this.parameters.vvSizeFactor,i=this.parameters.vvSizeMinSize,a=this.parameters.vvSizeMaxSize,s=d.sizeAttributeValue;p[0]*=e(t[0]+s*r[0],i[0],a[0]),p[1]*=e(t[2]+s*r[2],i[2],a[2])}const m=Math.max(p[0],p[1]),f=i.boundingInfo;if(t(f))return void this._intersectTriangles(d,p,n,h,u);const b=r(f.bbMin[0]-m,f.bbMin[1]-m,f.bbMin[2]-m,f.bbMax[0]+m,f.bbMax[1]+m,f.bbMax[2]+m),v=[h[0]-n[0],h[1]-n[1],h[2]-n[2]],S=Math.sqrt(v[0]*v[0]+v[1]*v[1]+v[2]*v[2]),g=[S/v[0],S/v[1],S/v[2]];A(b,n,g,o.tolerance)&&this._intersectTriangles(d,p,n,h,u)}_intersectTriangles(e,t,r,i,a){e.baked.size&&e.baked.size[0]===t[0]&&e.baked.size[1]===t[1]||e.baked.bake(t),e.baked.intersect(r,i,a)}computeAttachmentOrigin(e,t){const r=e.vertexAttributes;if(!r)return null;const i=r.get(p.POSITION);return n(i,null,!1,t)}createBufferWriter(){return new w(this._vertexBufferLayout)}requiresSlot(e,t){switch(t){case s.Shadow:case s.ShadowHighlight:case s.ShadowExludeHighlight:if(!this.parameters.castShadows)return!1;case s.Color:case s.Alpha:case s.Depth:case s.Normal:case s.Highlight:case s.ObjectAndLayerIdColor:return e===(this.parameters.transparent?l.TRANSPARENT_MATERIAL:l.OPAQUE_MATERIAL)||e===l.DRAPED_MATERIAL;default:return!1}}createGLMaterial(e){return new O(e)}static getVertexBufferLayout(e){let t=a().vec3f(p.POSITION).vec4f(p.PROFILERIGHT).vec4f(p.PROFILEUP).vec4f(p.PROFILEVERTEXANDNORMAL);return(e.vvColorEnabled||e.vvSizeEnabled||e.vvOpacityEnabled)&&(t=t.vec4f(p.FEATUREVALUE)),t}}class O extends h{_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}_updateShadowState(e){(t(this.technique)||e.shadowMap.enabled!==this.technique.configuration.receiveShadows)&&this._material.setParameters({receiveShadows:e.shadowMap.enabled})}beginSlot(e){return this._output!==s.Color&&this._output!==s.Alpha||(this._updateShadowState(e),this._updateOccludeeState(e)),this.ensureTechnique(b,e)}}class _ extends v{constructor(){super(...arguments),this.doubleSided=!1,this.doubleSidedType="normal",this.receiveSSAO=!0,this.receiveShadows=!1,this.castShadows=!0,this.hasSlicePlane=!1,this.transparent=!1,this.hasOccludees=!1}}class w{constructor(e){this.vertexBufferLayout=e}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return e.indices.get(p.POSITION).length}write(e,t,r,a){const s=e=>{if(t.vertexAttributes.has(e)){const s=t.vertexAttributes.get(e),o=t.indices.get(e);d(4===s.size);const n=r.getField(e,i);if(!n)throw new Error("unable to acquire view for "+e);g(o,s.data,n,a)}};s(p.PROFILERIGHT),s(p.PROFILEUP),s(p.PROFILEVERTEXANDNORMAL),this.vertexBufferLayout.hasField(p.FEATUREVALUE)&&s(p.FEATUREVALUE),S(t,this.vertexBufferLayout,e.transformation,e.invTranspTransformation,r,a)}}export{E as PathMaterial,_ as PathMaterialParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{isSome as r}from"../../../../core/maybe.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{c as s}from"../../../../chunks/vec2.js";import{s as a,b as n,e as o,g as l,a as c,c as h,l as p,i as u,m}from"../../../../chunks/vec3.js";import{c as f}from"../../../../chunks/vec3f64.js";import{O as T}from"../../../../chunks/vec4f64.js";import{PlaneIndex as _}from"../../../../geometry/support/frustum.js";import{create as d,distance2 as E,fromPoints as A,closestLineSegmentPoint as v}from"../../../../geometry/support/lineSegment.js";import{create as R,fromPoints as S,signedDistance as I,normal as O}from"../../../../geometry/support/plane.js";import{newLayout as g}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as b}from"../core/shaderLibrary/ShaderOutput.js";import{computeAttachmentOriginLines as P}from"../lib/geometryDataUtils.js";import L from"../lib/GLMaterial.js";import{Material as N,RenderOccludedFlag as C}from"../lib/Material.js";import{RenderSlot as y}from"../lib/RenderSlot.js";import{isTranslationMatrix as D}from"../lib/Util.js";import{VertexAttribute as j}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as U}from"./VisualVariablePassParameters.js";import{isInstanceHidden as x}from"./renderers/utils.js";import{N as F}from"../../../../chunks/RibbonLine.glsl.js";import{vertexAttributeLocations as M,RibbonLineTechnique as w}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as G,CapType as J}from"../shaders/RibbonLineTechniqueConfiguration.js";var z;!function(e){e[e.LEFT_JOIN_START=-2]="LEFT_JOIN_START",e[e.LEFT_JOIN_END=-1]="LEFT_JOIN_END",e[e.LEFT_CAP_START=-4]="LEFT_CAP_START",e[e.LEFT_CAP_END=-5]="LEFT_CAP_END",e[e.RIGHT_JOIN_START=2]="RIGHT_JOIN_START",e[e.RIGHT_JOIN_END=1]="RIGHT_JOIN_END",e[e.RIGHT_CAP_START=4]="RIGHT_CAP_START",e[e.RIGHT_CAP_END=5]="RIGHT_CAP_END"}(z||(z={}));class B extends N{constructor(e){super(e,new W),this._configuration=new G,this._vertexAttributeLocations=M,this._layout=this.createLayout()}isClosed(e,t){return X(this.parameters,e,t)}getConfiguration(e,t){this._configuration.output=e,this._configuration.draped=t.slot===y.DRAPED_MATERIAL;const i=r(this.parameters.stipplePattern)&&e!==b.Highlight;return this._configuration.stippleEnabled=i,this._configuration.stippleOffColorEnabled=i&&r(this.parameters.stippleOffColor),this._configuration.stippleScaleWithLineWidth=i&&this.parameters.stippleScaleWithLineWidth,this._configuration.stipplePreferContinuous=i&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.hasPolygonOffset=this.parameters.hasPolygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvColor=this.parameters.vvColorEnabled,this._configuration.vvOpacity=this.parameters.vvOpacityEnabled,this._configuration.vvSize=this.parameters.vvSizeEnabled,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&r(this.parameters.innerColor),this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.occluder=this.parameters.renderOccluded===C.OccludeAndTransparentStencil,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.hasMultipassTerrain=t.multipassTerrain.enabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration.wireframe=this.parameters.wireframe,this._configuration}intersect(e,t,i,s,a,n,o,l,c){r(c)?this._intersectDrapedLineGeometry(e,s,c,n,o):this._intersectLineGeometry(e,t,i,s,o)}_intersectDrapedLineGeometry(e,r,i,s,a){if(!r.options.selectionMode)return;const n=e.vertexAttributes.get(j.POSITION).data,o=e.vertexAttributes.get(j.SIZE);let l=this.parameters.width;if(this.parameters.vvSizeEnabled){const r=e.vertexAttributes.get(j.SIZEFEATUREATTRIBUTE).data[0];l*=t(this.parameters.vvSizeOffset[0]+r*this.parameters.vvSizeFactor[0],this.parameters.vvSizeMinSize[0],this.parameters.vvSizeMaxSize[0])}else o&&(l*=o.data[0]);const c=s[0],h=s[1],p=(l/2+4)*e.screenToWorldRatio;let u=Number.MAX_VALUE,m=0;for(let f=0;f<n.length-5;f+=3){const e=n[f],r=n[f+1],i=c-e,s=h-r,a=n[f+3]-e,o=n[f+4]-r,l=t((a*i+o*s)/(a*a+o*o),0,1),p=a*l-i,T=o*l-s,_=p*p+T*T;_<u&&(u=_,m=f/3)}u<p*p&&a(i.dist,i.normal,m,!1)}_intersectLineGeometry(r,i,m,f,T){if(!f.options.selectionMode||x(i))return;if(!D(m))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const d=r.vertexAttributes,R=d.get(j.POSITION).data;let g=this.parameters.width;if(this.parameters.vvSizeEnabled){const e=d.get(j.SIZEFEATUREATTRIBUTE).data[0];g*=t(this.parameters.vvSizeOffset[0]+e*this.parameters.vvSizeFactor[0],this.parameters.vvSizeMinSize[0],this.parameters.vvSizeMaxSize[0])}else d.has(j.SIZE)&&(g*=d.get(j.SIZE).data[0]);const b=f.camera,P=$;s(P,f.point);const L=g*b.pixelRatio/2+4*b.pixelRatio;a(ce[0],P[0]-L,P[1]+L,0),a(ce[1],P[0]+L,P[1]+L,0),a(ce[2],P[0]+L,P[1]-L,0),a(ce[3],P[0]-L,P[1]-L,0);for(let e=0;e<4;e++)if(!b.unprojectFromRenderScreen(ce[e],he[e]))return;S(b.eye,he[0],he[1],pe),S(b.eye,he[1],he[2],ue),S(b.eye,he[2],he[3],me),S(b.eye,he[3],he[0],fe);let N=Number.MAX_VALUE,C=0;const y=k(this.parameters,d,r.indices)?R.length-2:R.length-5;for(let e=0;e<y;e+=3){q[0]=R[e]+m[12],q[1]=R[e+1]+m[13],q[2]=R[e+2]+m[14];const t=(e+3)%R.length;if(Y[0]=R[t]+m[12],Y[1]=R[t+1]+m[13],Y[2]=R[t+2]+m[14],I(pe,q)<0&&I(pe,Y)<0||I(ue,q)<0&&I(ue,Y)<0||I(me,q)<0&&I(me,Y)<0||I(fe,q)<0&&I(fe,Y)<0)continue;if(b.projectToRenderScreen(q,ee),b.projectToRenderScreen(Y,te),ee[2]<0&&te[2]>0){n(Q,q,Y);const e=b.frustum,t=-I(e[_.NEAR],q)/o(Q,O(e[_.NEAR]));l(Q,Q,t),c(q,q,Q),b.projectToRenderScreen(q,ee)}else if(ee[2]>0&&te[2]<0){n(Q,Y,q);const e=b.frustum,t=-I(e[_.NEAR],Y)/o(Q,O(e[_.NEAR]));l(Q,Q,t),c(Y,Y,Q),b.projectToRenderScreen(Y,te)}else if(ee[2]<0&&te[2]<0)continue;ee[2]=0,te[2]=0;const r=E(A(ee,te,se),P);r<N&&(N=r,h(re,q),h(ie,Y),C=e/3)}const U=f.rayBegin,F=f.rayEnd;if(N<L*L){let e=Number.MAX_VALUE;if(v(A(re,ie,se),A(U,F,ae),K)){n(K,K,U);const t=p(K);l(K,K,1/t),e=t/u(U,F)}T(e,K,C,!1)}}computeAttachmentOrigin(e,t){const r=e.vertexAttributes;if(!r)return!1;const i=e.indices,s=r.get(j.POSITION);return P(s,i?i.get(j.POSITION):null,i&&k(this.parameters,r,i),t)}createLayout(){const e=g().vec3f(j.POSITION).f32(j.SUBDIVISIONFACTOR).vec2f(j.UV0).vec3f(j.AUXPOS1).vec3f(j.AUXPOS2);return this.parameters.vvSizeEnabled?e.f32(j.SIZEFEATUREATTRIBUTE):e.f32(j.SIZE),this.parameters.vvColorEnabled?e.f32(j.COLORFEATUREATTRIBUTE):e.vec4f(j.COLOR),this.parameters.vvOpacityEnabled&&e.f32(j.OPACITYFEATUREATTRIBUTE),e}createBufferWriter(){return new V(this._layout,this.parameters)}requiresSlot(e,t){if(t===b.Color||t===b.Alpha||t===b.Highlight||t===b.Depth){if(e===y.DRAPED_MATERIAL)return!0;if(this.parameters.renderOccluded===C.OccludeAndTransparentStencil)return e===y.OPAQUE_MATERIAL||e===y.OCCLUDER_MATERIAL||e===y.TRANSPARENT_OCCLUDER_MATERIAL;if(t===b.Color||t===b.Alpha){return e===(this.parameters.writeDepth?y.TRANSPARENT_MATERIAL:y.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL)}return e===y.OPAQUE_MATERIAL}return!1}createGLMaterial(e){return new H(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0)}}class H extends L{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextureRepository.release(this._stipplePattern),this._stipplePattern=null}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){this._output!==b.Color&&this._output!==b.Alpha||this._updateOccludeeState(e);const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters(this._stippleTextureRepository.swap(this._stipplePattern,t)),this._stipplePattern=t),this.ensureTechnique(w,e)}}class W extends U{constructor(){super(...arguments),this.width=0,this.color=T,this.join="miter",this.cap=J.BUTT,this.miterLimit=5,this.writeDepth=!0,this.hasPolygonOffset=!1,this.stippleTexture=null,this.stippleScaleWithLineWidth=!1,this.stipplePreferContinuous=!0,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.hasOccludees=!1,this.wireframe=!1}}class V{constructor(e,t){this._parameters=t,this.numJoinSubdivisions=0,this.vertexBufferLayout=e;const r=t.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=r;break;case"round":this.numJoinSubdivisions=F+r}}_isClosed(e){return k(this._parameters,e.vertexAttributes,e.indices)}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){const t=2,r=e.indices.get(j.POSITION).length/2+1,i=this._isClosed(e);let s=i?2:2*t;return s+=((i?r:r-1)-(i?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,r,i){const s=ne,n=oe,o=le,l=t.vertexAttributes.get(j.POSITION).data,c=t.indices&&t.indices.get(j.POSITION),p=t.vertexAttributes.get(j.DISTANCETOSTART)?.data;c&&c.length!==2*(l.length/3-1)&&console.warn("RibbonLineMaterial does not support indices");let f=1,T=0;this._parameters.vvSizeEnabled?T=t.vertexAttributes.get(j.SIZEFEATUREATTRIBUTE).data[0]:t.vertexAttributes.has(j.SIZE)&&(f=t.vertexAttributes.get(j.SIZE).data[0]);let _=[1,1,1,1],d=0;this._parameters.vvColorEnabled?d=t.vertexAttributes.get(j.COLORFEATUREATTRIBUTE).data[0]:t.vertexAttributes.has(j.COLOR)&&(_=t.vertexAttributes.get(j.COLOR).data);let E=0;this._parameters.vvOpacityEnabled&&(E=t.vertexAttributes.get(j.OPACITYFEATUREATTRIBUTE).data[0]);const A=l.length/3,v=e.transformation,R=new Float32Array(r.buffer),S=this.vertexBufferLayout.stride/4;let I=i*S;const O=I;let g=0;const b=p?(e,t,r)=>g=p[r]:(e,t,r)=>g+=u(e,t),P=(e,t,r,i,s,a,n)=>{if(R[I++]=t[0],R[I++]=t[1],R[I++]=t[2],R[I++]=i,R[I++]=n,R[I++]=s,R[I++]=e[0],R[I++]=e[1],R[I++]=e[2],R[I++]=r[0],R[I++]=r[1],R[I++]=r[2],this._parameters.vvSizeEnabled?R[I++]=T:R[I++]=f,this._parameters.vvColorEnabled)R[I++]=d;else{const e=Math.min(4*a,_.length-4);R[I++]=_[e+0],R[I++]=_[e+1],R[I++]=_[e+2],R[I++]=_[e+3]}this._parameters.vvOpacityEnabled&&(R[I++]=E)};I+=S,a(n,l[0],l[1],l[2]),v&&m(n,n,v);const L=this._isClosed(t);if(L){const e=l.length-3;a(s,l[e],l[e+1],l[e+2]),v&&m(s,s,v)}else a(o,l[3],l[4],l[5]),v&&m(o,o,v),P(n,n,o,1,z.LEFT_CAP_START,0,0),P(n,n,o,1,z.RIGHT_CAP_START,0,0),h(s,n),h(n,o);const N=L?0:1,C=L?A:A-1;for(let u=N;u<C;u++){const e=(u+1)%A*3;a(o,l[e+0],l[e+1],l[e+2]),v&&m(o,o,v),b(s,n,u),P(s,n,o,0,z.LEFT_JOIN_END,u,g),P(s,n,o,0,z.RIGHT_JOIN_END,u,g);const t=this.numJoinSubdivisions;for(let r=0;r<t;++r){const e=(r+1)/(t+1);P(s,n,o,e,z.LEFT_JOIN_END,u,g),P(s,n,o,e,z.RIGHT_JOIN_END,u,g)}P(s,n,o,1,z.LEFT_JOIN_START,u,g),P(s,n,o,1,z.RIGHT_JOIN_START,u,g),h(s,n),h(n,o)}L?(a(o,l[3],l[4],l[5]),v&&m(o,o,v),g=b(s,n,C),P(s,n,o,0,z.LEFT_JOIN_END,N,g),P(s,n,o,0,z.RIGHT_JOIN_END,N,g)):(g=b(s,n,C),P(s,n,n,0,z.LEFT_CAP_END,C,g),P(s,n,n,0,z.RIGHT_CAP_END,C,g)),Z(R,O+S,R,O,S);I=Z(R,I-S,R,I,S),this._parameters.wireframe&&this._addWireframeVertices(r,O,I,S)}_addWireframeVertices(e,t,r,i){const s=new Float32Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,r-t);let n=0;const o=e=>n=Z(a,e,s,n,i);for(let l=0;l<a.length-1;l+=2*i)o(l),o(l+2*i),o(l+1*i),o(l+2*i),o(l+1*i),o(l+3*i)}}function Z(e,t,r,i,s){for(let a=0;a<s;a++)r[i++]=e[t++];return i}function k(e,t,r){return X(e,t.get(j.POSITION).data,r?r.get(j.POSITION):null)}function X(e,t,r){return!!e.isClosed&&(r?r.length>2:t.length>6)}const q=f(),Y=f(),Q=f(),K=f(),$=f(),ee=i(),te=i(),re=f(),ie=f(),se=d(),ae=d(),ne=f(),oe=f(),le=f(),ce=[i(),i(),i(),i()],he=[f(),f(),f(),f()],pe=R(),ue=R(),me=R(),fe=R();export{W as Parameters,B as RibbonLineMaterial};
5
+ import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{isSome as r}from"../../../../core/maybe.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{c as s}from"../../../../chunks/vec2.js";import{s as a,b as n,e as o,g as l,a as c,c as h,l as u,i as p,m}from"../../../../chunks/vec3.js";import{c as f}from"../../../../chunks/vec3f64.js";import{O as T}from"../../../../chunks/vec4f64.js";import{PlaneIndex as d}from"../../../../geometry/support/frustum.js";import{create as _,distance2 as A,fromPoints as E,closestLineSegmentPoint as v}from"../../../../geometry/support/lineSegment.js";import{create as I,fromPoints as R,signedDistance as O,normal as S}from"../../../../geometry/support/plane.js";import{newLayout as g}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as b}from"../core/shaderLibrary/ShaderOutput.js";import{computeAttachmentOriginLines as L}from"../lib/geometryDataUtils.js";import P from"../lib/GLMaterial.js";import{Material as N,RenderOccludedFlag as C}from"../lib/Material.js";import{RenderSlot as y}from"../lib/RenderSlot.js";import{isTranslationMatrix as j}from"../lib/Util.js";import{VertexAttribute as D}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as U}from"./VisualVariablePassParameters.js";import{isInstanceHidden as x}from"./renderers/utils.js";import{N as F}from"../../../../chunks/RibbonLine.glsl.js";import{vertexAttributeLocations as w,RibbonLineTechnique as M}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as J,CapType as G}from"../shaders/RibbonLineTechniqueConfiguration.js";var B;!function(e){e[e.LEFT_JOIN_START=-2]="LEFT_JOIN_START",e[e.LEFT_JOIN_END=-1]="LEFT_JOIN_END",e[e.LEFT_CAP_START=-4]="LEFT_CAP_START",e[e.LEFT_CAP_END=-5]="LEFT_CAP_END",e[e.RIGHT_JOIN_START=2]="RIGHT_JOIN_START",e[e.RIGHT_JOIN_END=1]="RIGHT_JOIN_END",e[e.RIGHT_CAP_START=4]="RIGHT_CAP_START",e[e.RIGHT_CAP_END=5]="RIGHT_CAP_END"}(B||(B={}));class z extends N{constructor(e){super(e,new W),this._configuration=new J,this._vertexAttributeLocations=w,this._layout=this.createLayout()}isClosed(e,t){return X(this.parameters,e,t)}getConfiguration(e,t){this._configuration.output=e,this._configuration.draped=t.slot===y.DRAPED_MATERIAL;const i=r(this.parameters.stipplePattern)&&e!==b.Highlight;return this._configuration.stippleEnabled=i,this._configuration.stippleOffColorEnabled=i&&r(this.parameters.stippleOffColor),this._configuration.stippleScaleWithLineWidth=i&&this.parameters.stippleScaleWithLineWidth,this._configuration.stipplePreferContinuous=i&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.hasPolygonOffset=this.parameters.hasPolygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvColor=this.parameters.vvColorEnabled,this._configuration.vvOpacity=this.parameters.vvOpacityEnabled,this._configuration.vvSize=this.parameters.vvSizeEnabled,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&r(this.parameters.innerColor),this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.occluder=this.parameters.renderOccluded===C.OccludeAndTransparentStencil,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.hasMultipassTerrain=t.multipassTerrain.enabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration.wireframe=this.parameters.wireframe,this._configuration}intersect(e,t,i,s,a,n,o,l,c){r(c)?this._intersectDrapedLineGeometry(e,s,c,n,o):this._intersectLineGeometry(e,t,i,s,o)}_intersectDrapedLineGeometry(e,r,i,s,a){if(!r.options.selectionMode)return;const n=e.vertexAttributes.get(D.POSITION).data,o=e.vertexAttributes.get(D.SIZE);let l=this.parameters.width;if(this.parameters.vvSizeEnabled){const r=e.vertexAttributes.get(D.SIZEFEATUREATTRIBUTE).data[0];l*=t(this.parameters.vvSizeOffset[0]+r*this.parameters.vvSizeFactor[0],this.parameters.vvSizeMinSize[0],this.parameters.vvSizeMaxSize[0])}else o&&(l*=o.data[0]);const c=s[0],h=s[1],u=(l/2+4)*e.screenToWorldRatio;let p=Number.MAX_VALUE,m=0;for(let f=0;f<n.length-5;f+=3){const e=n[f],r=n[f+1],i=c-e,s=h-r,a=n[f+3]-e,o=n[f+4]-r,l=t((a*i+o*s)/(a*a+o*o),0,1),u=a*l-i,T=o*l-s,d=u*u+T*T;d<p&&(p=d,m=f/3)}p<u*u&&a(i.dist,i.normal,m,!1)}_intersectLineGeometry(r,i,m,f,T){if(!f.options.selectionMode||x(i))return;if(!j(m))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const _=r.vertexAttributes,I=_.get(D.POSITION).data;let g=this.parameters.width;if(this.parameters.vvSizeEnabled){const e=_.get(D.SIZEFEATUREATTRIBUTE).data[0];g*=t(this.parameters.vvSizeOffset[0]+e*this.parameters.vvSizeFactor[0],this.parameters.vvSizeMinSize[0],this.parameters.vvSizeMaxSize[0])}else _.has(D.SIZE)&&(g*=_.get(D.SIZE).data[0]);const b=f.camera,L=$;s(L,f.point);const P=g*b.pixelRatio/2+4*b.pixelRatio;a(ce[0],L[0]-P,L[1]+P,0),a(ce[1],L[0]+P,L[1]+P,0),a(ce[2],L[0]+P,L[1]-P,0),a(ce[3],L[0]-P,L[1]-P,0);for(let e=0;e<4;e++)if(!b.unprojectFromRenderScreen(ce[e],he[e]))return;R(b.eye,he[0],he[1],ue),R(b.eye,he[1],he[2],pe),R(b.eye,he[2],he[3],me),R(b.eye,he[3],he[0],fe);let N=Number.MAX_VALUE,C=0;const y=k(this.parameters,_,r.indices)?I.length-2:I.length-5;for(let e=0;e<y;e+=3){Y[0]=I[e]+m[12],Y[1]=I[e+1]+m[13],Y[2]=I[e+2]+m[14];const t=(e+3)%I.length;if(q[0]=I[t]+m[12],q[1]=I[t+1]+m[13],q[2]=I[t+2]+m[14],O(ue,Y)<0&&O(ue,q)<0||O(pe,Y)<0&&O(pe,q)<0||O(me,Y)<0&&O(me,q)<0||O(fe,Y)<0&&O(fe,q)<0)continue;if(b.projectToRenderScreen(Y,ee),b.projectToRenderScreen(q,te),ee[2]<0&&te[2]>0){n(Q,Y,q);const e=b.frustum,t=-O(e[d.NEAR],Y)/o(Q,S(e[d.NEAR]));l(Q,Q,t),c(Y,Y,Q),b.projectToRenderScreen(Y,ee)}else if(ee[2]>0&&te[2]<0){n(Q,q,Y);const e=b.frustum,t=-O(e[d.NEAR],q)/o(Q,S(e[d.NEAR]));l(Q,Q,t),c(q,q,Q),b.projectToRenderScreen(q,te)}else if(ee[2]<0&&te[2]<0)continue;ee[2]=0,te[2]=0;const r=A(E(ee,te,se),L);r<N&&(N=r,h(re,Y),h(ie,q),C=e/3)}const U=f.rayBegin,F=f.rayEnd;if(N<P*P){let e=Number.MAX_VALUE;if(v(E(re,ie,se),E(U,F,ae),K)){n(K,K,U);const t=u(K);l(K,K,1/t),e=t/p(U,F)}T(e,K,C,!1)}}computeAttachmentOrigin(e,t){const r=e.vertexAttributes;if(!r)return!1;const i=e.indices,s=r.get(D.POSITION);return L(s,i?i.get(D.POSITION):null,i&&k(this.parameters,r,i),t)}createLayout(){const e=g().vec3f(D.POSITION).f32(D.SUBDIVISIONFACTOR).vec2f(D.UV0).vec3f(D.AUXPOS1).vec3f(D.AUXPOS2);return this.parameters.vvSizeEnabled?e.f32(D.SIZEFEATUREATTRIBUTE):e.f32(D.SIZE),this.parameters.vvColorEnabled?e.f32(D.COLORFEATUREATTRIBUTE):e.vec4f(D.COLOR),this.parameters.vvOpacityEnabled&&e.f32(D.OPACITYFEATUREATTRIBUTE),has("enable-feature:objectAndLayerId-rendering")&&e.vec4u8(D.OBJECTANDLAYERIDCOLOR),e}createBufferWriter(){return new V(this._layout,this.parameters)}requiresSlot(e,t){if(t===b.Color||t===b.Alpha||t===b.Highlight||t===b.Depth||t===b.ObjectAndLayerIdColor){if(e===y.DRAPED_MATERIAL)return!0;if(this.parameters.renderOccluded===C.OccludeAndTransparentStencil)return e===y.OPAQUE_MATERIAL||e===y.OCCLUDER_MATERIAL||e===y.TRANSPARENT_OCCLUDER_MATERIAL;if(t===b.Color||t===b.Alpha){return e===(this.parameters.writeDepth?y.TRANSPARENT_MATERIAL:y.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL)}return e===y.OPAQUE_MATERIAL}return!1}createGLMaterial(e){return new H(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0)}}class H extends P{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextureRepository.release(this._stipplePattern),this._stipplePattern=null}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){this._output!==b.Color&&this._output!==b.Alpha||this._updateOccludeeState(e);const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters(this._stippleTextureRepository.swap(this._stipplePattern,t)),this._stipplePattern=t),this.ensureTechnique(M,e)}}class W extends U{constructor(){super(...arguments),this.width=0,this.color=T,this.join="miter",this.cap=G.BUTT,this.miterLimit=5,this.writeDepth=!0,this.hasPolygonOffset=!1,this.stippleTexture=null,this.stippleScaleWithLineWidth=!1,this.stipplePreferContinuous=!0,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.hasOccludees=!1,this.wireframe=!1}}class V{constructor(e,t){this._parameters=t,this.numJoinSubdivisions=0,this.vertexBufferLayout=e;const r=t.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=r;break;case"round":this.numJoinSubdivisions=F+r}}_isClosed(e){return k(this._parameters,e.vertexAttributes,e.indices)}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){const t=2,r=e.indices.get(D.POSITION).length/2+1,i=this._isClosed(e);let s=i?2:2*t;return s+=((i?r:r-1)-(i?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,i,s){const n=ne,o=oe,l=le,c=t.vertexAttributes.get(D.POSITION).data,u=t.indices&&t.indices.get(D.POSITION),f=t.vertexAttributes.get(D.DISTANCETOSTART)?.data;u&&u.length!==2*(c.length/3-1)&&console.warn("RibbonLineMaterial does not support indices");let T=1,d=0;this._parameters.vvSizeEnabled?d=t.vertexAttributes.get(D.SIZEFEATUREATTRIBUTE).data[0]:t.vertexAttributes.has(D.SIZE)&&(T=t.vertexAttributes.get(D.SIZE).data[0]);let _=[1,1,1,1],A=0;this._parameters.vvColorEnabled?A=t.vertexAttributes.get(D.COLORFEATUREATTRIBUTE).data[0]:t.vertexAttributes.has(D.COLOR)&&(_=t.vertexAttributes.get(D.COLOR).data);let E=null;has("enable-feature:objectAndLayerId-rendering")&&(E=t.objectAndLayerIdColor);let v=0;this._parameters.vvOpacityEnabled&&(v=t.vertexAttributes.get(D.OPACITYFEATUREATTRIBUTE).data[0]);const I=c.length/3,R=e.transformation,O=new Float32Array(i.buffer),S=has("enable-feature:objectAndLayerId-rendering")?new Uint8Array(i.buffer):null,g=this.vertexBufferLayout.stride/4;let b=s*g;const L=b;let P=0;const N=f?(e,t,r)=>P=f[r]:(e,t,r)=>P+=p(e,t),C=(e,t,i,s,a,n,o)=>{if(O[b++]=t[0],O[b++]=t[1],O[b++]=t[2],O[b++]=s,O[b++]=o,O[b++]=a,O[b++]=e[0],O[b++]=e[1],O[b++]=e[2],O[b++]=i[0],O[b++]=i[1],O[b++]=i[2],this._parameters.vvSizeEnabled?O[b++]=d:O[b++]=T,this._parameters.vvColorEnabled)O[b++]=A;else{const e=Math.min(4*n,_.length-4);O[b++]=_[e+0],O[b++]=_[e+1],O[b++]=_[e+2],O[b++]=_[e+3]}this._parameters.vvOpacityEnabled&&(O[b++]=v),has("enable-feature:objectAndLayerId-rendering")&&(r(E)&&(S[4*b+0]=E[0],S[4*b+1]=E[1],S[4*b+2]=E[2],S[4*b+3]=E[3]),b++)};b+=g,a(o,c[0],c[1],c[2]),R&&m(o,o,R);const y=this._isClosed(t);if(y){const e=c.length-3;a(n,c[e],c[e+1],c[e+2]),R&&m(n,n,R)}else a(l,c[3],c[4],c[5]),R&&m(l,l,R),C(o,o,l,1,B.LEFT_CAP_START,0,0),C(o,o,l,1,B.RIGHT_CAP_START,0,0),h(n,o),h(o,l);const j=y?0:1,U=y?I:I-1;for(let r=j;r<U;r++){const e=(r+1)%I*3;a(l,c[e+0],c[e+1],c[e+2]),R&&m(l,l,R),N(n,o,r),C(n,o,l,0,B.LEFT_JOIN_END,r,P),C(n,o,l,0,B.RIGHT_JOIN_END,r,P);const t=this.numJoinSubdivisions;for(let i=0;i<t;++i){const e=(i+1)/(t+1);C(n,o,l,e,B.LEFT_JOIN_END,r,P),C(n,o,l,e,B.RIGHT_JOIN_END,r,P)}C(n,o,l,1,B.LEFT_JOIN_START,r,P),C(n,o,l,1,B.RIGHT_JOIN_START,r,P),h(n,o),h(o,l)}y?(a(l,c[3],c[4],c[5]),R&&m(l,l,R),P=N(n,o,U),C(n,o,l,0,B.LEFT_JOIN_END,j,P),C(n,o,l,0,B.RIGHT_JOIN_END,j,P)):(P=N(n,o,U),C(n,o,o,0,B.LEFT_CAP_END,U,P),C(n,o,o,0,B.RIGHT_CAP_END,U,P)),Z(O,L+g,O,L,g);b=Z(O,b-g,O,b,g),this._parameters.wireframe&&this._addWireframeVertices(i,L,b,g)}_addWireframeVertices(e,t,r,i){const s=new Float32Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,r-t);let n=0;const o=e=>n=Z(a,e,s,n,i);for(let l=0;l<a.length-1;l+=2*i)o(l),o(l+2*i),o(l+1*i),o(l+2*i),o(l+1*i),o(l+3*i)}}function Z(e,t,r,i,s){for(let a=0;a<s;a++)r[i++]=e[t++];return i}function k(e,t,r){return X(e,t.get(D.POSITION).data,r?r.get(D.POSITION):null)}function X(e,t,r){return!!e.isClosed&&(r?r.length>2:t.length>6)}const Y=f(),q=f(),Q=f(),K=f(),$=f(),ee=i(),te=i(),re=f(),ie=f(),se=_(),ae=_(),ne=f(),oe=f(),le=f(),ce=[i(),i(),i(),i()],he=[f(),f(),f(),f()],ue=I(),pe=I(),me=I(),fe=I();export{W as Parameters,z as RibbonLineMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{n as e,s as t,g as r,a as i}from"../../../../chunks/vec3.js";import{c as s}from"../../../../chunks/vec3f64.js";import{f as a}from"../../../../chunks/vec4f64.js";import{center as n,scale as o}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as c}from"../../../../geometry/support/buffer/BufferView.js";import{newLayout as u}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as l}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as h}from"../lib/basicInterfaces.js";import f from"../lib/GLMaterial.js";import{Material as p,MaterialParameters as m}from"../lib/Material.js";import{RenderSlot as d}from"../lib/RenderSlot.js";import{assert as S}from"../lib/Util.js";import{VertexAttribute as b}from"../lib/VertexAttribute.js";import{writeDefaultAttributes as E,writePosition as T}from"./internal/bufferWriterUtils.js";import{intersectTriangleGeometry as g}from"./internal/MaterialUtil.js";import{ShadedColorMaterialTechniqueConfiguration as A,vertexAttributeLocations as v,ShadedColorMaterialTechnique as _}from"../shaders/ShadedColorMaterialTechnique.js";class F extends p{constructor(e){super(e,new j),this.supportsEdges=!0,this._configuration=new A,this._vertexAttributeLocations=v}getConfiguration(e,t){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.screenSizeEnabled=this.parameters.screenSizeEnabled,this._configuration.shadingEnabled=this.parameters.shadingEnabled,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.hasMultipassTerrain=t.multipassTerrain.enabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(e,s,a,c,u,l,h){if(this.parameters.screenSizeEnabled){const a=e.vertexAttributes.get(b.OFFSET),f={applyToVertex:(e,s,n,o)=>{const u=t(w,a.data[3*o+0],a.data[3*o+1],a.data[3*o+2]),l=t(z,e,s,n);return r(u,u,this.parameters.screenSizeScale*c.camera.computeRenderPixelSizeAt(u)),i(l,l,u),[l[0],l[1],l[2]]},applyToAabb:e=>{const t=n(e,w);return o(e,this.parameters.screenSizeScale*c.camera.computeRenderPixelSizeAt(t))}};g(e,s,c,u,l,f,h)}else g(e,s,c,u,l,void 0,h)}requiresSlot(e,t){if(t===l.Highlight)return e===d.OPAQUE_MATERIAL;if(t===l.Color||t===l.Alpha){let t=d.OPAQUE_MATERIAL;return this.parameters.transparent&&(t=this.parameters.writeDepth?d.TRANSPARENT_MATERIAL:d.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),e===t||e===d.DRAPED_MATERIAL}return!1}createGLMaterial(e){return new x(e)}createBufferWriter(){return new O(this.parameters.screenSizeEnabled)}}class x extends f{beginSlot(e){return this.ensureTechnique(_,e)}}class j extends m{constructor(){super(...arguments),this.color=a(1,1,1,1),this.shadingTint=a(0,0,0,.25),this.shadingDirection=e(s(),[.5,-.5,-.5]),this.screenSizeScale=14,this.transparent=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=h.None,this.screenSizeEnabled=!1,this.shadingEnabled=!0}}class O{constructor(e){this.screenSizeEnabled=e;const t=u().vec3f(b.POSITION).vec3f(b.NORMAL);this.screenSizeEnabled&&t.vec3f(b.OFFSET),this.vertexBufferLayout=t}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return e.indices.get(b.POSITION).length}write(e,t,r,i){if(E(t,this.vertexBufferLayout,e.transformation,e.invTranspTransformation,r,i),this.screenSizeEnabled){if(!t.vertexAttributes.has(b.OFFSET))throw new Error(`${b.OFFSET} vertex attribute required for screenSizeEnabled ShadedColorMaterial`);{const s=t.vertexAttributes.get(b.OFFSET),a=t.indices.get(b.OFFSET);S(3===s.size);const n=r.getField(b.OFFSET,c);if(!n)throw new Error("unable to acquire view for "+b.OFFSET);T(a,s.data,e.invTranspTransformation,n,i)}}}}const w=s(),z=s();export{F as ShadedColorMaterial,j as ShadedColorMaterialParameters};
5
+ import{n as e,s as t,g as r,a as i}from"../../../../chunks/vec3.js";import{c as s}from"../../../../chunks/vec3f64.js";import{f as a}from"../../../../chunks/vec4f64.js";import{center as n,scale as o}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as c}from"../../../../geometry/support/buffer/BufferView.js";import{newLayout as l}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as u}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as h}from"../lib/basicInterfaces.js";import f from"../lib/GLMaterial.js";import{Material as p,MaterialParameters as m}from"../lib/Material.js";import{RenderSlot as d}from"../lib/RenderSlot.js";import{assert as S}from"../lib/Util.js";import{VertexAttribute as b}from"../lib/VertexAttribute.js";import{writeDefaultAttributes as E,writePosition as T}from"./internal/bufferWriterUtils.js";import{intersectTriangleGeometry as g}from"./internal/MaterialUtil.js";import{ShadedColorMaterialTechniqueConfiguration as A,vertexAttributeLocations as v,ShadedColorMaterialTechnique as _}from"../shaders/ShadedColorMaterialTechnique.js";class F extends p{constructor(e){super(e,new x),this.supportsEdges=!0,this._configuration=new A,this._vertexAttributeLocations=v}getConfiguration(e,t){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.screenSizeEnabled=this.parameters.screenSizeEnabled,this._configuration.shadingEnabled=this.parameters.shadingEnabled,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.hasMultipassTerrain=t.multipassTerrain.enabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(e,s,a,c,l,u,h){if(this.parameters.screenSizeEnabled){const a=e.vertexAttributes.get(b.OFFSET),f={applyToVertex:(e,s,n,o)=>{const l=t(L,a.data[3*o+0],a.data[3*o+1],a.data[3*o+2]),u=t(w,e,s,n);return r(l,l,this.parameters.screenSizeScale*c.camera.computeRenderPixelSizeAt(l)),i(u,u,l),[u[0],u[1],u[2]]},applyToAabb:e=>{const t=n(e,L);return o(e,this.parameters.screenSizeScale*c.camera.computeRenderPixelSizeAt(t))}};g(e,s,c,l,u,f,h)}else g(e,s,c,l,u,void 0,h)}requiresSlot(e,t){if(t===u.Highlight)return e===d.OPAQUE_MATERIAL;if(t===u.Color||t===u.Alpha||t===u.ObjectAndLayerIdColor){let t=d.OPAQUE_MATERIAL;return this.parameters.transparent&&(t=this.parameters.writeDepth?d.TRANSPARENT_MATERIAL:d.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),e===t||e===d.DRAPED_MATERIAL}return!1}createGLMaterial(e){return new j(e)}createBufferWriter(){return new O(this.parameters.screenSizeEnabled)}}class j extends f{beginSlot(e){return this.ensureTechnique(_,e)}}class x extends m{constructor(){super(...arguments),this.color=a(1,1,1,1),this.shadingTint=a(0,0,0,.25),this.shadingDirection=e(s(),[.5,-.5,-.5]),this.screenSizeScale=14,this.transparent=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=h.None,this.screenSizeEnabled=!1,this.shadingEnabled=!0}}class O{constructor(e){this.screenSizeEnabled=e;const t=l().vec3f(b.POSITION).vec3f(b.NORMAL);this.screenSizeEnabled&&t.vec3f(b.OFFSET),this.vertexBufferLayout=t}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return e.indices.get(b.POSITION).length}write(e,t,r,i){if(E(t,this.vertexBufferLayout,e.transformation,e.invTranspTransformation,r,i),this.screenSizeEnabled){if(!t.vertexAttributes.has(b.OFFSET))throw new Error(`${b.OFFSET} vertex attribute required for screenSizeEnabled ShadedColorMaterial`);{const s=t.vertexAttributes.get(b.OFFSET),a=t.indices.get(b.OFFSET);S(3===s.size);const n=r.getField(b.OFFSET,c);if(!n)throw new Error("unable to acquire view for "+b.OFFSET);T(a,s.data,e.invTranspTransformation,n,i)}}}}const L=s(),w=s();export{F as ShadedColorMaterial,x as ShadedColorMaterialParameters};