@arcgis/core 4.33.0-next.20250422 → 4.33.0-next.20250424
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.
- package/Graphic.js +1 -1
- package/WebScene.js +1 -1
- package/analysis/Analysis.d.ts +4 -0
- package/analysis/Analysis.js +1 -1
- package/analysis/SliceAnalysis.js +1 -1
- package/analysis/SlicePlane.js +1 -1
- package/analysis/support/AnalysisOriginWebScene.d.ts +4 -0
- package/analysis/support/AnalysisOriginWebScene.js +5 -0
- package/analysis/support/SliceAnalysisExcludedLayer.js +5 -0
- package/arcade/geometry/constructors.js +1 -1
- package/assets/components/assets/icon/mosaicMethodBlend16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodBlend24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodBlend32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodByAttribute16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodByAttribute24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodByAttribute32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodClosestToCenter16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodClosestToCenter24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodClosestToCenter32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodClosestToNadir16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodClosestToNadir24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodClosestToNadir32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodFirst16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodFirst24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodFirst32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodLast16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodLast24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodLast32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodLockRaster16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodLockRaster24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodLockRaster32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodMaximum16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodMaximum24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodMaximum32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodMean16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodMean24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodMean32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodMinimum16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodMinimum24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodMinimum32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodNone16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodNone24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodNone32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodNorthWest16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodNorthWest24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodNorthWest32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodSeamline16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodSeamline24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodSeamline32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodSum16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodSum24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodSum32.json +1 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{b2f9f0767dadf185120c.js → 00612d6e05b1c8647668.js} +1 -1
- package/assets/esri/core/workers/chunks/{d4d011eea16a89a5aad9.js → 0219c3f9408d3fa3c9a0.js} +1 -1
- package/assets/esri/core/workers/chunks/{f54546c155fba2fd3a7e.js → 05d7d8ff3e4cbad32580.js} +1 -1
- package/assets/esri/core/workers/chunks/{b1e275607d9754079f60.js → 079434fe765c53d304f2.js} +1 -1
- package/assets/esri/core/workers/chunks/{4f8782b3b6ad414409e8.js → 0a48b9734ab4c64a6f4f.js} +1 -1
- package/assets/esri/core/workers/chunks/{0eed612e82a279ac8d1e.js → 11b55e7e76e50fe11bbe.js} +1 -1
- package/assets/esri/core/workers/chunks/{ccc50f28f217e50cc2c3.js → 1427e7953c3d8c87c5e8.js} +1 -1
- package/assets/esri/core/workers/chunks/{184d7c8ea818bec5c462.js → 146b3699a9e8b1f2dcc2.js} +1 -1
- package/assets/esri/core/workers/chunks/{8ba7d44eff348004f084.js → 1a6d2d090b643a87408a.js} +1 -1
- package/assets/esri/core/workers/chunks/1b8cc83aa1179245b2dc.js +1 -0
- package/assets/esri/core/workers/chunks/{5e5225623977e61fd0ef.js → 213adc87c843d627c5d6.js} +1 -1
- package/assets/esri/core/workers/chunks/235efd948ae470a6f238.js +1 -0
- package/assets/esri/core/workers/chunks/{60d3b329e69f3cddb7f4.js → 265f69d153b7b6f07e42.js} +1 -1
- package/assets/esri/core/workers/chunks/{769b66cca8347f0f84db.js → 279bbd61b32577693a4a.js} +1 -1
- package/assets/esri/core/workers/chunks/290b065b377f9d2ee058.js +1 -0
- package/assets/esri/core/workers/chunks/29d3245261a7223124ed.js +1 -0
- package/assets/esri/core/workers/chunks/{0c6f2808c57ff820bfdd.js → 30551c1d3e4fa7be86c1.js} +2 -2
- package/assets/esri/core/workers/chunks/{0c6f2808c57ff820bfdd.js.LICENSE.txt → 30551c1d3e4fa7be86c1.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/335b539893569e3d7b82.js +1 -0
- package/assets/esri/core/workers/chunks/{78242f2bf742b33d99fa.js → 3795793643f4db64af0e.js} +1 -1
- package/assets/esri/core/workers/chunks/{38f9ede26098eb03ca2d.js → 3cf001abca8ad933bccf.js} +2 -2
- package/assets/esri/core/workers/chunks/{38f9ede26098eb03ca2d.js.LICENSE.txt → 3cf001abca8ad933bccf.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{dbaa4b8d37aab40d7bd1.js → 543eb46b55cacd6e1dbc.js} +2 -2
- package/assets/esri/core/workers/chunks/{dbaa4b8d37aab40d7bd1.js.LICENSE.txt → 543eb46b55cacd6e1dbc.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{93f792f5b94f3745b57d.js → 577f24923fa4d08360e4.js} +2 -2
- package/assets/esri/core/workers/chunks/{93f792f5b94f3745b57d.js.LICENSE.txt → 577f24923fa4d08360e4.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/5958af341014e13475d2.js +1 -0
- package/assets/esri/core/workers/chunks/{f46c4a69ef2f763e905b.js → 5d63dfa5a60c88e03b28.js} +1 -1
- package/assets/esri/core/workers/chunks/60f7cd05e88701f43d3f.js +1 -0
- package/assets/esri/core/workers/chunks/{26e0a0a13060cd3e4291.js → 626ba3a7dee952308566.js} +1 -1
- package/assets/esri/core/workers/chunks/7bfa18dd8771d4932533.js +1 -0
- package/assets/esri/core/workers/chunks/7cd32b10ed0e18e44ef2.js +1 -0
- package/assets/esri/core/workers/chunks/7ffa68d69c138db1295d.js +1 -0
- package/assets/esri/core/workers/chunks/8dd26b12c625d20196ed.js +319 -0
- package/assets/esri/core/workers/chunks/91f8547a13f0461045ef.js +1 -0
- package/assets/esri/core/workers/chunks/9661ee8569ee208e6237.js +1 -0
- package/assets/esri/core/workers/chunks/{c2f38c66fae2cdb57445.js → 96e5d192c8d23c1e324f.js} +1 -1
- package/assets/esri/core/workers/chunks/974742af7beb000c4b4a.js +1 -0
- package/assets/esri/core/workers/chunks/{e27fa1e84f16b7f19a90.js → 9850ff14bd9c7da81c65.js} +1 -1
- package/assets/esri/core/workers/chunks/{796cf1c2ca9955595836.js → 9b2ab27159500315fbc1.js} +1 -1
- package/assets/esri/core/workers/chunks/{a276980c06d5d311a37e.js → 9f416cc5673665f8c37c.js} +1 -1
- package/assets/esri/core/workers/chunks/a0c51c4c30a5f749dfc6.js +1 -0
- package/assets/esri/core/workers/chunks/a79511b926a2830bb160.js +1 -0
- package/assets/esri/core/workers/chunks/{fdcbd28f38bc485ac5e3.js → ab6ecd8eeec5ff761b34.js} +1 -1
- package/assets/esri/core/workers/chunks/{814d72abbfdd4552e4ec.js → ac9c6779771ec855da79.js} +2 -2
- package/assets/esri/core/workers/chunks/{814d72abbfdd4552e4ec.js.LICENSE.txt → ac9c6779771ec855da79.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{ef6e805c49e1afdf966b.js → c054198c6438cb57f188.js} +1 -1
- package/assets/esri/core/workers/chunks/c5d786166a5609b85276.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{5bdd5ae2d2f23ef6b331.js → c87e2a63b96e0da77dfe.js} +1 -1
- package/assets/esri/core/workers/chunks/{601fc99426f0213b0769.js → cbec01223d51cdb9ee79.js} +1 -1
- package/assets/esri/core/workers/chunks/cc4dd739c4c7e3ccea3f.js +1 -0
- package/assets/esri/core/workers/chunks/{90c893959145827961ac.js → cd9343c78a7c3acdbbcd.js} +1 -1
- package/assets/esri/core/workers/chunks/d3a74087e076a3ae76ca.js +1 -0
- package/assets/esri/core/workers/chunks/{26fcbe053194bd78fcc3.js → d8474dca270b25705699.js} +1 -1
- package/assets/esri/core/workers/chunks/{5db336767959507c07e5.js → d8dc922f7466300b668f.js} +2 -2
- package/assets/esri/core/workers/chunks/{5db336767959507c07e5.js.LICENSE.txt → d8dc922f7466300b668f.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{96cddbbeef61a4f33f29.js → db5913824d5e5a2a8365.js} +1 -1
- package/assets/esri/core/workers/chunks/{48a1bb1e171dd06a7c6e.js → dd94585508f49863dc15.js} +1 -1
- package/assets/esri/core/workers/chunks/e524462c63834fae7e01.js +2 -0
- package/assets/esri/core/workers/chunks/{02176f84d6d57f1bc1c8.js.LICENSE.txt → e524462c63834fae7e01.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{e7e987558cf017c62458.js → ebfa4a0334401f5e004a.js} +1 -1
- package/assets/esri/core/workers/chunks/{736a11e64e5f03e3936b.js → f2cef954b58c6604642c.js} +64 -64
- package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/BloomBlur.glsl.js +7 -7
- package/chunks/BloomComposition.glsl.js +24 -25
- package/chunks/Bufferer-CicaNej1.js +1 -1
- package/chunks/Envelope.js +1 -1
- package/chunks/GeodeticDistanceCalculator-CcF1gMZX.js +1 -1
- package/chunks/Geometry.js +1 -1
- package/chunks/OperatorGeodesicBuffer.js +1 -1
- package/chunks/OperatorGeodeticArea.js +1 -1
- package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
- package/chunks/OperatorGeodeticLength.js +1 -1
- package/chunks/OperatorMultiPartToSinglePart.js +1 -1
- package/chunks/OperatorProximityGeodesic.js +1 -1
- package/chunks/OperatorShapePreservingLength.js +1 -1
- package/chunks/OperatorShapePreservingProject.js +1 -1
- package/chunks/OperatorSimplifyOGC.js +5 -0
- package/chunks/Point2D.js +1 -1
- package/chunks/ProjectionTransformation.js +1 -1
- package/chunks/QuadraticBezier.js +1 -1
- package/chunks/cameraUtilsSpherical.js +1 -1
- package/chunks/languageUtils.js +1 -1
- package/chunks/relateOperator.js +1 -1
- package/chunks/sphere.js +1 -1
- package/chunks/vxlLayer.js +1 -1
- package/core/Collection.js +1 -1
- package/core/JSONSupport.js +1 -1
- package/core/SetUtils.js +1 -1
- package/{views/webgl/GLObjectType.js → core/support/jsonUtils.js} +1 -1
- package/core/urlUtils.js +1 -1
- package/geometry/Mesh.js +1 -1
- package/geometry/operators/extendOperator.js +1 -1
- package/geometry/operators/gx/operatorAlphaShape.js +1 -1
- package/geometry/operators/gx/operatorAutoComplete.js +1 -1
- package/geometry/operators/gx/operatorLabelPoint.js +1 -1
- package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
- package/geometry/operators/gx/operatorLocateBetween.js +1 -1
- package/geometry/operators/gx/operatorMinimumBoundingCircle.js +1 -1
- package/geometry/operators/gx/operatorSimplifyOGC.js +5 -0
- package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
- package/geometry/operators/reshapeOperator.js +1 -1
- package/geometry/operators/simplifyOGCOperator.d.ts +6 -0
- package/geometry/operators/simplifyOGCOperator.js +5 -0
- package/geometry/operators/support/jsonConverter.js +1 -1
- package/geometry/support/normalizeUtilsSync.js +1 -1
- package/geometry/support/sphere.js +1 -1
- package/interfaces.d.ts +442 -113
- package/layers/DimensionLayer.js +1 -1
- package/layers/RouteLayer.js +1 -1
- package/layers/SubtypeGroupLayer.js +1 -1
- package/layers/ViewshedLayer.js +1 -1
- package/layers/graphics/data/QueryEngine.js +1 -1
- package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
- package/layers/orientedImagery/transformations/utils.js +1 -1
- package/layers/support/FieldsIndex.js +1 -1
- package/layers/support/VideoElement.js +1 -1
- package/layers/support/rasterDatasets/FunctionRaster.js +1 -1
- package/layers/support/rasterDatasets/TIFFRaster.js +1 -1
- package/layers/support/rasterFormats/TiffDecoder.js +1 -1
- package/layers/support/rasterFormats/{TiffTags.js → tiffTag.js} +1 -1
- package/layers/support/rasterFunctions/BandArithmeticFunction.js +1 -1
- package/layers/support/rasterFunctions/BaseRasterFunction.js +1 -1
- package/layers/support/rasterFunctions/ExtractBandFunction.js +1 -1
- package/layers/support/rasterFunctions/NDVIFunction.js +1 -1
- package/layers/support/rasterFunctions/RemapFunction.js +1 -1
- package/layers/support/rasterFunctions/rasterFunctionHelper.js +1 -1
- package/layers/support/videoUtils.js +5 -0
- package/package.json +2 -2
- package/portal/schemas/definitions.js +1 -1
- package/renderers/UniqueValueRenderer.js +1 -1
- package/renderers/support/colorRampUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/IconSymbol3DLayer.js +1 -1
- package/symbols/cim/effects/EffectTaperedPolygon.js +1 -1
- package/versionManagement/utils.js +1 -1
- package/views/2d/engine/webgl/meshing/Mesh.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/typed/TypedShaderProgram.js +1 -1
- package/views/2d/engine/webgl/textureUtils.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/support/DebugOverlay.js +1 -1
- package/views/3d/analysis/LineOfSightAnalysisView3D.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/analysis/Slice/SliceVisualization.js +1 -1
- package/views/3d/analysis/SliceAnalysisView3D.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedAnalysisVisualization.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedVisualization.js +1 -1
- package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
- package/views/3d/camera/constraintUtils/distance.js +1 -1
- package/views/3d/camera/intersectionUtils.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/atmosphereUtils.js +1 -1
- package/views/3d/interactive/visualElements/DrapedVisualElementResources.js +1 -1
- package/views/3d/interactive/visualElements/EngineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/LabelVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/LaserlineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/MarkerVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/SlicePlaneVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/VerticesVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ViewshedShapeVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/VisualElement.js +1 -1
- package/views/3d/interactive/visualElements/VisualElementResources.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/LineOfSightLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
- package/views/3d/layers/graphics/pipeline/PipelineCommand.js +1 -1
- package/views/3d/layers/graphics/pipeline/Tile3DManager.js +1 -1
- package/views/3d/layers/graphics/pipeline/TileActionSynchronizer.js +5 -0
- package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
- package/views/3d/state/ConstraintsManager.js +1 -1
- package/views/3d/state/NearFarHeuristic.js +1 -1
- package/views/3d/state/ViewState.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/support/cameraUtilsSpherical.js +1 -1
- package/views/3d/support/geometryUtils/sphere.js +1 -1
- package/views/3d/terrain/OverlayRenderTargets.js +1 -1
- package/views/3d/webgl/ManagedDepthTexture.js +1 -1
- package/views/3d/webgl/ManagedFBO.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/FBOCacheFormats.js +5 -0
- package/views/3d/webgl-engine/core/shaderLibrary/Laserline.glsl.js +12 -14
- package/views/3d/webgl-engine/core/shaderLibrary/output/Emissions.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
- package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/lib/DepthRange.js +1 -1
- package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/Texture.js +1 -1
- package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/VideoView.js +1 -1
- package/views/interactive/Tooltip.js +1 -1
- package/views/interactive/tooltip/content/TooltipContent.js +1 -1
- package/views/layers/LineOfSightLayerView.d.ts +4 -0
- package/views/layers/LineOfSightLayerView.js +5 -0
- package/views/webgl/FBOAttachmentType.js +5 -0
- package/views/webgl/FramebufferObject.js +1 -1
- package/views/webgl/Renderbuffer.js +1 -1
- package/views/webgl/RenderbufferDescriptor.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/views/webgl/TextureDescriptor.js +1 -1
- package/webscene/InitialViewProperties.js +1 -1
- package/webscene/Presentation.js +1 -1
- package/webscene/Slide.js +1 -1
- package/webscene/SlideLegendInfo.js +1 -1
- package/webscene/background/ColorBackground.js +1 -1
- package/webscene/spec-certification/api.js +1 -1
- package/webscene/spec-certification/compare.js +1 -1
- package/webscene/spec-certification/index.js +1 -1
- package/webscene/spec-certification/spec.js +1 -1
- package/webscene/spec-certification/utils.js +1 -1
- package/webscene/support/Description.js +1 -1
- package/webscene/support/SlideElements.js +1 -1
- package/webscene/support/SlideEnvironment.js +1 -1
- package/webscene/support/SlideGround.js +1 -1
- package/webscene/support/SlideVisibleLayer.js +1 -1
- package/webscene/support/Title.js +1 -1
- package/webscene/support/analysisUtils.js +5 -0
- package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Editor/support/SketchController.js +5 -0
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Feature/FeatureUtilityNetworkAssociationList.js +1 -1
- package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/LayerList/LayerListItem.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/Widget.js +1 -1
- package/widgets/support/SelectionList.js +1 -1
- package/widgets/support/SnappingControls.js +1 -1
- package/assets/esri/core/workers/chunks/02176f84d6d57f1bc1c8.js +0 -2
- package/assets/esri/core/workers/chunks/244d2196bac5ef279436.js +0 -1
- package/assets/esri/core/workers/chunks/32f2e0c88046b39916cc.js +0 -1
- package/assets/esri/core/workers/chunks/388a763da712ca71ccf4.js +0 -1
- package/assets/esri/core/workers/chunks/5ffc3ca6c6a4d32e1282.js +0 -1
- package/assets/esri/core/workers/chunks/642a595353a86f3717e3.js +0 -1
- package/assets/esri/core/workers/chunks/82353e59ac6d909dcf41.js +0 -1
- package/assets/esri/core/workers/chunks/873327fc41edd3830afa.js +0 -319
- package/assets/esri/core/workers/chunks/93e9dfd1ba8f393c6c47.js +0 -1
- package/assets/esri/core/workers/chunks/95379fdd6917c8a84c71.js +0 -1
- package/assets/esri/core/workers/chunks/9b21dc4659922cc577cb.js +0 -1
- package/assets/esri/core/workers/chunks/a197c86d42cc9ce21924.js +0 -1
- package/assets/esri/core/workers/chunks/d81bebbb6fe000200d35.js +0 -1
- package/assets/esri/core/workers/chunks/daa54c8a317c27881763.js +0 -1
- package/assets/esri/core/workers/chunks/dd8e72d6784a8ebc115d.js +0 -1
- package/assets/esri/core/workers/chunks/e15c612caadf7bac4ab9.js +0 -1
- package/assets/esri/core/workers/chunks/e9fba86036b8fe700a41.js +0 -1
- package/views/3d/webgl/formats.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as t}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ZEROS as o}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderCategory as n}from"../../../webgl.js";import
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as t}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ZEROS as o}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderCategory as n}from"../../../webgl.js";import i from"../../../webgl/RenderNode.js";import{ColorFormat as c}from"../../core/FBOCacheFormats.js";import{If as s,glsl as a}from"../../core/shaderModules/glsl.js";import{Default3D as l}from"../../lib/DefaultVertexAttributeLocations.js";import{FramebufferBit as u,ColorAttachment0 as p,BlendFactor as h,SizedPixelFormat as f,PixelFormat as d,DataType as m}from"../../../../webgl/enums.js";import{alphaCutoff as v}from"../../../../../webscene/support/AlphaCutoff.js";let g=class extends i{constructor(e){super(e),this.destroyedCB=null,this.produces=n.FINAL,this.consumes={required:[n.FINAL]},this.clearColor=o,this._focusedFBOType=0,this._program=new Map}destroy(){this._program.forEach((e=>e.dispose())),this._program.clear(),this.destroyedCB()}render(e){const r=e.find((({name:e})=>e===n.FINAL));if(!this._focusedFBO)return r;const t=this.renderingContext;t.bindFramebuffer(r.fbo),t.setClearColor(0,0,0,0),t.clear(u.COLOR);const o=this._focusedFBO.getTexture(),i=[F(o)],c=this._ensureShader(t,!1,i);return t.useProgram(c),t.bindTexture(o,0),c.setUniform1i("colorTex",0),c.setUniform1i("inputType",this._focusedFBOType),3===this._focusedFBOType&&c.setUniform2fv("nearFar",this.camera.nearFar),t.screen.draw(),r}getDownscaledFBO(e,r,t,o,n,i){t===x.ON&&(n=e.width,i=e.height);const s=[];for(let c=0;c<Math.min(r,e.colorAttachments.length);++c){const r=e.getColorTexture(p+c);r&&s.push(F(r))}const a=this.renderingContext,{colorTexture:l,depthStencilTexture:d}=e,m=l?.descriptor,v=this._ensureShader(a,null!=d,s),g=this.fboCache.acquire(n,i,"fbo visualizer");let T=!1;l&&(T="float"===s[0]&&!l.descriptor.hasMipmap,T&&e.colorTexture?.generateMipmap()),a.useProgram(v),a.bindFramebuffer(g.fbo);let R=0;const b=[p],C=null!=d;if(a.bindTexture(l,R),v.setUniform1i("colorTex",R),d){R++,a.bindTexture(d,R),v.setUniform1i("depthTex",R);const e=p+R;g.acquireColor(e,c.RGBA8UNORM,"depth to color"),b.push(e)}for(let u=1;u<r;++u){R++;const r=p+R,t=C?1:0;a.bindTexture(e.getColorTexture(r-t),R);const o="colorTex"+(R-t);v.setUniform1i(o,R),g.acquireColor(r,c.RGBA8UNORM),b.push(r)}a.gl.drawBuffers(b);const B=a.getViewport();a.setViewport(0,0,n,i),a.setClearColor(0,0,0,0),a.clear(u.COLOR),a.setBlendingEnabled(!0),a.setBlendFunction(h.ONE,h.ONE_MINUS_SRC_ALPHA);const A="linear-depth"===o||o.includes("shadow"),O="overlay highlight"===o||"highlights"===o||"highlight mix"===o,y="highlight coverage"===o,I=m?.internalFormat,_=A?3:O?5:y?6:I===f.R16F||I===f.R32F||I===f.R8?1:I===f.RG8?2:I===f.RGBA16F?4:I===f.RG8UI?7:0;return v.setUniform1i("inputType",_),A&&v.setUniform2fv("nearFar",this.camera.nearFar),a.screen.draw(),a.bindFramebuffer(null),a.setViewport(B.x,B.y,B.width,B.height),t===x.ON&&(this._focusedFBO=g,this._focusedFBOType=_),T&&e.colorTexture?.clearMipmap(),g}clearFocusedFBO(){this._focusedFBO=null}getPreviewContent(e,r,t,o){if(!t)return null;const n=this.renderingContext,i=this.fboCache.acquire(e,r,"fbo visualizer");n.bindFramebuffer(i?.fbo),n.setClearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),n.clear(u.COLOR),n.setBlendingEnabled(!0),n.setBlendFunction(h.ONE,h.ONE_MINUS_SRC_ALPHA);const c=t.getColorTexture(o);n.setViewport(0,0,e,r);const s=this._ensureShader(n,!1,[F(c)]);n.useProgram(s),n.bindTexture(c,0),s.setUniform1i("colorTex",0),s.setUniform1i("inputType",0),n.screen.draw();const a=new ImageData(new Uint8ClampedArray(e*r*4),e,r);return n.gl.readPixels(0,0,e,r,d.RGBA,m.UNSIGNED_BYTE,new Uint8Array(a.data.buffer)),n.bindFramebuffer(null),i?.release(),a}_ensureShader(e,r,t){const o=R({hasDepthAttachment:r,colorAttachmentTypes:t}),n=this._program.get(o);if(n)return n;const i="#version 300 es\n in vec2 position;\n out vec2 uv;\n\n void main() {\n gl_Position = vec4(position, 0.0, 1.0);\n uv = position * 0.5 + vec2(0.5);\n }",c=(e,r)=>{let t="";const o=e?1:0;for(let n=1;n<r.length;++n){const e=r[n];t+=`layout(location = ${a.int(o+n)}) out vec4 fragColor${a.int(n)};\n uniform ${T(e)} colorTex${a.int(n)};`}return t},u=e=>{let r="";for(let t=1;t<e.length;++t){const o=e[t],n=`texture(colorTex${a.int(t)}, uv)`,i="float"===o?n:`vec4( vec2(${n}), 0.0, 1.0)`;r+=`fragColor${a.int(t)} = ${i};`}return r},p=`#version 300 es\n precision highp float;\n precision highp usampler2D;\n\n in vec2 uv;\n uniform ${T(t[0])} colorTex;\n layout(location = 0) out vec4 fragColor;\n ${s(r,"layout(location = 1) out vec4 fragDepth;\n uniform sampler2D depthTex;")}\n ${c(r,t)}\n uniform int inputType;\n uniform vec2 nearFar;\n\n // Factors to convert rgba back to float\n const vec4 RGBA_2_FLOAT_FACTORS = vec4(\n 255.0 / (256.0),\n 255.0 / (256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0 * 256.0)\n );\n\n\n float rgbaTofloat(vec4 rgba) {\n // Convert components from 0->1 back to 0->255 and then add the components together with their corresponding\n // fixed point factors, i.e. (256^1, 256^2, 256^3, 256^4)\n return dot(rgba, RGBA_2_FLOAT_FACTORS);\n }\n\n float linearDepthFromFloat(float depth) {\n depth = pow(depth, 0.2);\n return -(depth * (nearFar[1] - nearFar[0]) + nearFar[0]);\n }\n\n float linearDepthFromRGBA(vec4 depth) {\n return linearDepthFromFloat(rgbaTofloat(depth));\n }\n\n ${"float"===t[0]?"float linearDepthFromTexture(sampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(texelFetch(depthTex, iuv, 0));\n }":"float linearDepthFromTexture(usampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(vec4(texelFetch(depthTex, iuv, 0)) * 255.0);\n }"}\n\n void main() {\n vec4 color;\n if (inputType == 1) {\n color = vec4(vec3(texture(colorTex, uv).r), 1.0);\n } else if (inputType == 2) {\n color = vec4(texture(colorTex, uv).rg, 0.0, 1.0);\n } else if (inputType == 3) {\n float depth = 1.0 - ((-linearDepthFromTexture(colorTex, uv) - nearFar[0]) / (nearFar[1] - nearFar[0]));\n color = vec4(vec3(depth), depth >= 0.999 ? 0.0 : 1.0);\n } else if (inputType == 4) {\n color = vec4(texture(colorTex, uv));\n color = vec4(color.rgb / color.a, color.a);\n } else if (inputType == 5) {\n color = vec4(texture(colorTex, uv)) * 255.0;\n color = vec4(color.rgb / color.a, color.a);\n } else if(inputType == 6) {\n vec2 texDim = vec2(textureSize(colorTex, 0));\n ivec2 iuv = ivec2(uv*texDim);\n uvec2 hh = uvec2(texelFetch(colorTex,iuv,0).rg);\n color = vec4(\n ((hh & uvec2(0x55u)) != uvec2(0u)) ? 1.0 : 0.0,\n ((hh & uvec2(0xaau)) != uvec2(0u)) ? 1.0 : 0.0,\n 0.0,\n 1.0);\n } else {\n color = vec4(texture(colorTex, uv));\n }\n\n\n if(color.a < ${a.float(v)})\n discard;\n else {\n fragColor = color;\n ${s(r,"float depth = 1.0 - pow(texture(depthTex, uv).r, 10.0);\n fragDepth = vec4(vec3(depth), depth < 0.000001 ? 0.0 : 1.0);")}\n ${s(t.length>1,u(t))}\n }\n }`,h=e.programCache.acquire(i,p,l);return this._program.set(o,h),h}};var x;function T(e){switch(e){case"float":return"sampler2D";case"uint":return"usampler2D";case"int":return"isampler2D"}}function F(e){if(!e)return"float";const{internalFormat:r}=e.descriptor;switch(r){case f.R8I:case f.R16I:case f.R32I:case f.RG8I:case f.RG16I:case f.RG32I:case f.RGB8I:case f.RGB16I:case f.RGB32I:case f.RGBA8I:case f.RGBA16I:case f.RGBA32I:return"int";case f.R8UI:case f.R16UI:case f.R32UI:case f.RG8UI:case f.RG16UI:case f.RG32UI:case f.RGB8UI:case f.RGB16UI:case f.RGB32UI:case f.RGBA8UI:case f.RGBA16UI:case f.RGBA32UI:return"uint";default:return"float"}}function R(e){const{hasDepthAttachment:r,colorAttachmentTypes:t}=e;return`${r?"Depth":""}${t.reduceRight(((e,r)=>e+`|C${r}`),"")}`}e([r()],g.prototype,"destroyedCB",void 0),e([r()],g.prototype,"produces",void 0),e([r()],g.prototype,"consumes",void 0),e([r()],g.prototype,"clearColor",void 0),g=e([t("esri.views.3d.webgl-engine.effects.debug.RenderNodeVisualizerNode")],g),function(e){e[e.ON=0]="ON",e[e.OFF=1]="OFF"}(x||(x={}));export{x as FocusState,g as RenderNodeVisualizerNode};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{property as t}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{InternalRenderCategory as r,RenderCategory as o}from"../../../webgl.js";import
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{property as t}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{InternalRenderCategory as r,RenderCategory as o}from"../../../webgl.js";import i from"../../../webgl/RenderNode.js";import{ColorFormat as n}from"../../core/FBOCacheFormats.js";import{FocusAreaMaskTechnique as a}from"./FocusAreaMaskTechnique.js";import{Default3D as c}from"../../lib/DefaultVertexAttributeLocations.js";import{Pos3 as h}from"../../lib/DefaultVertexBufferLayouts.js";import{VertexArrayObject as p}from"../../lib/VertexArrayObject.js";import{F as u}from"../../../../../chunks/FocusAreaMask.glsl.js";import{BufferObject as l}from"../../../../webgl/BufferObject.js";import{DepthStencilAttachment as m,FramebufferBit as d,Face as f,StencilOperation as A,CompareFunction as g,PrimitiveType as E,Usage as b}from"../../../../webgl/enums.js";import{noParameters as R}from"../../../../webgl/NoParameters.js";let _=class extends i{constructor(e){super({...e,view:e.focusAreas.view}),this.consumes={required:[r.FOCUSAREA,o.TRANSPARENT]},this.produces=r.FOCUSAREA,this._vaos=new Array,this._counts=new Array,this._origins=new Array,this._maskParameters=new u}initialize(){this.updateGeometries()}destroy(){this._vaos.forEach((e=>e.dispose())),this._vaos.length=this._counts.length=this._origins.length=0}precompile(){this.techniques.precompile(a)}render(e){const t=this.techniques.get(a),s=this.bindParameters,i=s.camera,c=i.fullViewport[2],h=i.fullViewport[3],p=this.fboCache.acquire(c,h,r.FOCUSAREA,n.RGBA8UNORM);if(!t.compiled||!this._vaos)return this.requestRender(),p;const u=e.find((({name:e})=>e===o.TRANSPARENT)),l=this.renderingContext;p.attachDepth(u.getAttachment(m)),l.bindFramebuffer(p.fbo),l.clear(d.COLOR|d.STENCIL),l.setViewport(0,0,c,h),l.clear(d.STENCIL,0);const b=l.bindTechnique(t,s);l.setFaceCullingEnabled(!1),l.setStencilTestEnabled(!0),l.setStencilOpSeparate(f.FRONT,A.KEEP,A.INCR_WRAP,A.KEEP),l.setStencilOpSeparate(f.BACK,A.KEEP,A.DECR_WRAP,A.KEEP),l.setDepthWriteEnabled(!1);for(let r=0;r<this._vaos.length;r++){const e=this._vaos[r],t=this._counts[r];this._maskParameters.origin=this._origins[r],b.bindDraw(s,R,this._maskParameters),l.bindVAO(e),l.setDepthTestEnabled(!0),l.setStencilWriteMask(255),l.setStencilFunction(g.ALWAYS,0,255),l.setColorMask(!1,!1,!1,!1),l.drawArrays(E.TRIANGLES,0,t),l.setDepthTestEnabled(!1),l.setStencilWriteMask(0),l.setStencilFunction(g.NOTEQUAL,0,255),l.setColorMask(!0,!0,!0,!0),l.drawArrays(E.TRIANGLES,0,t)}return p}updateGeometries(){if(!this.view.stage)return;this._vaos.forEach((e=>e.dispose())),this._vaos.length=this._counts.length=this._origins.length=0;const e=this.focusAreas.geometries;for(const t of e){const e=new Array,s=t.indicesBottom;for(let n=0;n<s.length;n++)e.push(t.positions[3*(s[n]-1)]),e.push(t.positions[3*(s[n]-1)+1]),e.push(t.positions[3*(s[n]-1)+2]);const r=t.indicesExtruded;for(let n=0;n<r.length;n++)e.push(t.positions[3*r[n]]),e.push(t.positions[3*r[n]+1]),e.push(t.positions[3*r[n]+2]);const o=new Float32Array(e),i=new p(this.renderingContext,c,new Map([["geometry",h]]),new Map([["geometry",l.createVertex(this.renderingContext,b.STATIC_DRAW,o)]]));this._vaos.push(i),this._counts.push(s.length+r.length),this._origins.push(t.origin)}this.requestRender()}};e([t()],_.prototype,"consumes",void 0),e([t()],_.prototype,"produces",void 0),e([t({constructOnly:!0})],_.prototype,"focusAreas",void 0),_=e([s("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaMaskNode")],_);class w{constructor(e,t,s,r,o,i){this.positions=e,this.indicesBottom=t,this.indicesExtruded=s,this.height=r,this.origin=o,this.color=i}}var S;!function(e){e[e.NONE=0]="NONE",e[e.BRIGHT=1]="BRIGHT",e[e.DARK=2]="DARK"}(S||(S={}));export{S as FocusAreaEffect,w as FocusAreaGeometry,_ as FocusAreaMaskNode};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import r from"../../../../../core/PooledArray.js";import{property as t}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ZEROS as o}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{InternalRenderCategory as n}from"../../../webgl.js";import i from"../../../webgl/RenderNode.js";import{
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import r from"../../../../../core/PooledArray.js";import{property as t}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ZEROS as o}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{InternalRenderCategory as n}from"../../../webgl.js";import i from"../../../webgl/RenderNode.js";import{DepthTextureFormat as c}from"../../core/FBOCacheFormats.js";import{Blit as a}from"../blit/Blit.js";import{StencilBits as l}from"../../lib/basicInterfaces.js";import{RenderOccludedFlag as d}from"../../lib/Material.js";import{RenderSlot as p}from"../../lib/RenderSlot.js";import{BlitMode as u}from"../../shaders/CompositingTechniqueConfiguration.js";import{DepthStencilAttachment as m}from"../../../../webgl/enums.js";let f=class extends i{constructor(e){super(e),this.consumes={required:[n.OCCLUDED]},this.produces=n.OCCLUDED,this._blit=new a(e.view.stage.renderView.techniques,u.PremultipliedAlpha)}precompile(){const e=this.view.stage.renderer;e.plugins.plugins.forAll((r=>{e.precompileSlots(r,p.OCCLUDED_TERRAIN,p.TRANSPARENT_OCCLUDER_MATERIAL),r.material&&e.precompileOccludedSlots(r,g)}))}render(e){const r=e.find((({name:e})=>e===this.produces)),t=this.view.stage.renderer;let s=0;if(h.clear(),t.plugins.plugins.forAll((e=>{if(!e.material)return;e.queryRenderOccludedState(d.OccludeAndTransparentStencil)&&(s|=d.OccludeAndTransparentStencil,h.push(e))})),h.length>0&&(t.renderSlots(h,p.OCCLUDER_MATERIAL),s&d.OccludeAndTransparentStencil&&this._renderAndComposite(r,.5,(()=>t.renderSlots(h,p.TRANSPARENT_OCCLUDER_MATERIAL)),!1,!1)),h.clear(),t.plugins.plugins.forAll((e=>{if(!e.material)return;const r=e.queryRenderOccludedState(d.OccludeAndTransparent),t=e.queryRenderOccludedState(d.Transparent),o=e.queryRenderOccludedState(d.Opaque);(r||t||o)&&(s|=r?d.OccludeAndTransparent:t?d.Transparent:d.Opaque,h.push(e))})),s|=t.plugins.renderOccludedFlags,!s)return r;for(const o of g)s&o&&this._renderAndComposite(r,o===d.Opaque?1:.5,(()=>t.renderOccludedSlots(h,o)),!0,l.OutlineVisualElementMask);return h.clear(),r}_renderAndComposite(e,r,t,s,n){const i=this.renderingContext,{width:a,height:l}=e.fbo,d=this.fboCache.acquire(a,l,"tmp color"),p=s?this.fboCache.acquireDepth(c.DEPTH24_STENCIL8,a,l,"tmp depth"):e.getAttachment(m);d.attachDepth(p),i.bindFramebuffer(d.fbo),i.clearFramebuffer(o,s,n),t(),d.detachDepth(),this._blit.blend(i,d,e,this.bindParameters,r),s&&p.release(),d.release()}};e([t()],f.prototype,"consumes",void 0),e([t()],f.prototype,"produces",void 0),f=e([s("esri.views.3d.webgl-engine.effects.geometry.RenderOccludedRenderNode")],f);const h=new r,g=[d.OccludeAndTransparent,d.Transparent,d.Opaque];export{f as RenderOccludedRenderNode};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{lerp as t,clamp as s,smoothstep as r}from"../../../../../core/mathUtils.js";import{disposeMaybe as i}from"../../../../../core/maybe.js";import{watch as o,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as m}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{l as h,k as c}from"../../../../../chunks/vec32.js";import{s as p}from"../../../../../chunks/vec42.js";import{earth as u}from"../../../../../geometry/support/Ellipsoid.js";import{InternalRenderCategory as d}from"../../../webgl.js";import{ColorFormat as l}from"
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{lerp as t,clamp as s,smoothstep as r}from"../../../../../core/mathUtils.js";import{disposeMaybe as i}from"../../../../../core/maybe.js";import{watch as o,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as m}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{l as h,k as c}from"../../../../../chunks/vec32.js";import{s as p}from"../../../../../chunks/vec42.js";import{earth as u}from"../../../../../geometry/support/Ellipsoid.js";import{InternalRenderCategory as d}from"../../../webgl.js";import{ColorFormat as l}from"../../core/FBOCacheFormats.js";import{TransparentEnvironment as f}from"../TransparentEnvironment.js";import{H as _}from"../../../../../chunks/HazeCompositing.glsl.js";import{HazeCompositingTechnique as g}from"./HazeCompositingTechnique.js";import{HazePassParameters as b,HazeTechnique as w}from"./HazeTechnique.js";import{HazeTechniqueConfiguration as P}from"./HazeTechniqueConfiguration.js";import{createQuadVAO as j,Layout as v}from"../../lib/glUtil3D.js";import{applyTextureResizeModulo as A}from"../../lib/textureUtils.js";import{DepthStencilAttachment as C,PrimitiveType as T}from"../../../../webgl/enums.js";let x=class extends f{constructor(e){super(e),this._compositingPassParameters=new _,this._passParameters=new b,this._hazeConfiguration=new P,this._vao=null,this.requireGeometryDepth=!0,this._oldAmount=1,this._newAmount=1,this._amount=this._newAmount;const t=e.view.stage.renderView.techniques;t.precompile(w,new P);const s=new P;s.reduced=!0,t.precompile(w,s),t.precompile(g)}initialize(){this.addHandles([o((()=>this.view.environment.atmosphereEnabled),(e=>e?this._enable():this._disable()),a),o((()=>this.view.stage?.renderer.renderContext.bind.clouds.fadeFactor??1),(e=>this._fade(e)),a),o((()=>this.view.environment.weather.type),(e=>this._newAmount="rainy"===e?0:1),a),o((()=>this.view.stage.renderer?.fullResolutionAtmosphere),(e=>this._hazeConfiguration.reduced=!e),a)])}_fade(e){e>=1?(this._amount=this._newAmount,this._oldAmount=this._newAmount):this._amount=e<=0?this._oldAmount:t(this._oldAmount,this._newAmount,e)}destroy(){this._vao=i(this._vao)}render(e){const s=e.find((({name:e})=>e===d.TRANSPARENT_ENVIRONMENT));if(!this.bindParameters.mainDepth)return s;const r=this.renderingContext;this._vao??=j(r,v.Pos2Tex);const i=this.techniques.get(w,this._hazeConfiguration);if(!i.compiled)return s;const o=s.getAttachment(C);if(this._update(),!this._hazeConfiguration.reduced)return s.detachDepth(),r.bindFramebuffer(s.fbo),r.bindTechnique(i,this.bindParameters,this._passParameters),this._renderCommon(r),s.attachDepth(o),s;const a=this.techniques.get(g);if(!a.compiled)return s;const n=r.getViewport(),m=this.camera,c=h(m.eye)-u.radius;let p;const f=u.atmosphereHeight;if(c<f){const e=Math.min(1,Math.max(0,c/f));p=t(.4,.5,e)}else{const e=Math.min(1,Math.max(0,(c-f)/(15*f)));p=t(.5,1,e)}const _=this.renderingContext.parameters.maxTextureSize,b=A(Math.round(p*m.fullViewport[2]),_),P=A(Math.round(p*m.fullViewport[3]),_);r.setViewport(0,0,b,P);const T=this.fboCache.acquire(b,P,"haze",l.RGBA8UNORM);return r.bindFramebuffer(T.fbo),r.clearFramebuffer([0,0,0,1],!0,!0),r.bindTechnique(i,this.bindParameters,this._passParameters),this._renderCommon(r),r.setViewport(n.x,n.y,n.width,n.height),this._compositingPassParameters.color=T.getTexture(),s.detachDepth(),r.bindFramebuffer(s.fbo),r.bindTechnique(a,this.bindParameters,this._compositingPassParameters),r.screen.draw(),s.attachDepth(o),T.release(),s}_renderCommon(e){null!=this._vao&&(e.bindVAO(this._vao),e.drawArrays(T.TRIANGLE_STRIP,0,4))}_update(){const e=this.bindParameters.camera,i=c(e.eye),o=Math.sqrt(i),a=i-this._passParameters.radii[1]*this._passParameters.radii[1],n=s((o-this._passParameters.radii[0])/u.atmosphereHeight,0,1);p(this._passParameters.heightParameters,o,i,a,n);const h=this.view.basemapTerrain?.getLowerBoundRadius()??0;m(this._passParameters.radii,h,h+u.atmosphereHeight),this._passParameters.hazeStrength=t(t(.6,1,r(9500,10500,o-u.radius)),1,this._amount)}};x=e([n("esri.views.3d.webgl-engine.effects.haze.Haze")],x);export{x as Haze};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../core/has.js";import{releaseMaybe as t,disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as i,initial as s}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{InternalRenderCategory as l}from"../../../webgl.js";import
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../core/has.js";import{releaseMaybe as t,disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as i,initial as s}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{InternalRenderCategory as l}from"../../../webgl.js";import a from"../../../webgl/RenderNode.js";import{ColorFormat as g}from"../../core/FBOCacheFormats.js";import{HighlightApplyTechnique as c}from"./HighlightApplyTechnique.js";import{HighlightBlurTechnique as u}from"./HighlightBlurTechnique.js";import{HighlightDownsampleTechnique as m}from"./HighlightDownsampleTechnique.js";import{HighlightPassParameters as p}from"./HighlightPassParameters.js";import{HighlightToSingleTechnique as d}from"./HighlightToSingleTechnique.js";import{RenderRequestType as f}from"../../lib/basicInterfaces.js";import{Default3D as T}from"../../lib/DefaultVertexAttributeLocations.js";import{NoVertex as b}from"../../lib/DefaultVertexBufferLayouts.js";import{VertexArrayObject as w}from"../../lib/VertexArrayObject.js";import{H as x}from"../../../../../chunks/HighlightBlur.glsl.js";import{H as C,g as v}from"../../../../../chunks/HighlightDownsample.glsl.js";import{BufferObject as _}from"../../../../webgl/BufferObject.js";import{PixelFormat as j,TextureSamplingMode as O,FramebufferBit as R,Usage as H,TextureType as P,PrimitiveType as q,DataType as D}from"../../../../webgl/enums.js";import{Texture as I}from"../../../../webgl/Texture.js";import{TextureDescriptor as U}from"../../../../webgl/TextureDescriptor.js";let y=class extends a{constructor(){super(...arguments),this.produces=l.HIGHLIGHTS,this.consumes={required:[l.HIGHLIGHTS,"highlights"]},this._downsampleDrawParameters=new C,this._passParameters=new p,this._highlightBlurDrawParameters=new x,this._grid=new A}initialize(){this.addHandles([i((()=>this._updateOptionsTexture()),(()=>{}),s)])}destroy(){this._grid.coverage=t(this._grid.coverage),this._grid.vao=r(this._grid.vao),this._passParameters.highlightOptionsTexture=t(this._passParameters.highlightOptionsTexture)}_updateOptionsTexture(){if(null==this._passParameters.highlightOptionsTexture){const e=new U(16,2);e.internalFormat=j.RGBA,e.samplingMode=O.NEAREST,this._passParameters.highlightOptionsTexture=new I(this.renderingContext,e,null)}this._passParameters.highlightOptionsTexture.setData(E(this.view.state.highlights)),this.requestRender(f.UPDATE)}precompile(){this.techniques.precompile(m),this.techniques.precompile(d),this.techniques.precompile(u),this.techniques.precompile(c)}render(e){const t=e.find((({name:e})=>e===l.HIGHLIGHTS)),{techniques:r,bindParameters:i,_passParameters:s,renderingContext:o}=this;if(!i.decorations)return t;const h=r.get(m);if(!h.compiled)return this.requestRender(f.UPDATE),t;const n=e.find((({name:e})=>"highlights"===e)).getTexture();s.highlightTexture=n;const a=()=>{this._gridUpdateResources(n);const e=this._gridComputeCoverage(h,n,i),{horizontalCellCount:t,verticalCellCount:r}=e;return s.horizontalCellCount=t,s.verticalCellCount=r,s.coverageTexture=e.coverage?.getTexture(),e},g=e=>{const t=e.verticalCellCount*e.horizontalCellCount;o.bindVAO(e.vao),o.drawElementsInstanced(q.TRIANGLES,6,D.UNSIGNED_BYTE,0,t)},{camera:c}=i,u=()=>{o.bindFramebuffer(t.fbo),o.setViewport4fv(c.fullViewport)};return this._renderHighlightPostprocess(n,a,g,u),s.highlightTexture=null,s.coverageTexture=null,t}_renderHighlightPostprocess(e,t,r,i){const{fboCache:s,techniques:o,bindParameters:h,_passParameters:l,renderingContext:a}=this,m=o.get(d),p=o.get(u),T=o.get(c);if(!T.compiled||!p.compiled||!m.compiled)return void this.requestRender(f.UPDATE);l.highlightTexture=e;const b=t(),{width:w,height:x}=e.descriptor;l.highlightTexture=e;const{camera:C}=h,{fullWidth:v,fullHeight:_,pixelRatio:j}=C,O=Math.ceil(v/j),H=Math.ceil(_/j),{_highlightBlurDrawParameters:P}=this,q=this.view.stage.renderView.renderer,{highlights:D}=h;for(let c=0;c<D.length;++c){const{name:e}=D[c];if(!q.hasHighlight(e))continue;l.highlightLevel=c,a.setClearColor(0,0,0,0);const t=s.acquire(w,x,"single highlight",g.RG8UNORM);a.bindFramebuffer(t.fbo),a.setViewport(0,0,w,x),a.clear(R.COLOR),a.bindTechnique(m,h,l),r(b),P.blurInput=t.getTexture(),n(P.blurSize,1/O,0);const o=s.acquire(O,H,"single highlight blur h",g.RG8UNORM);a.unbindTexture(o.fbo?.colorTexture),a.bindFramebuffer(o.fbo),a.setViewport(0,0,O,H),a.clear(R.COLOR),a.bindTechnique(p,h,l,P),r(b),t.release(),n(P.blurSize,0,1/H),l.highlightBlurTexture=o.getTexture(),i(),a.bindTechnique(T,h,l,P),r(b),o.release()}}_gridUpdateResources(e){const t=this._grid,{width:r,height:i}=e.descriptor;if(t.horizontalCellCount=Math.ceil(r/v),t.verticalCellCount=Math.ceil(i/v),t.vao)return;const s=this.renderingContext,o=_.createIndex(s,H.STATIC_DRAW,L);t.vao=new w(s,T,new Map([["geometry",b]]),new Map([["geometry",_.createVertex(s,H.STATIC_DRAW)]]),o)}_gridComputeCoverage(e,t,r){const i=this.renderingContext,s=this._grid,o=t.descriptor,h=Math.ceil(o.width/v),n=Math.ceil(o.height/v);this._downsampleDrawParameters.input=t;const{highlights:l}=r;s.coverage?.release();const a=this.fboCache.acquire(h,n,"highlight coverage",l.length>B?g.RG8UINT:g.R8UINT);return s.coverage=a,i.bindFramebuffer(a.fbo),i.bindTechnique(e,r,this._passParameters,this._downsampleDrawParameters),i.setViewport(0,0,h,n),i.screen.draw(),s}get test(){}};e([o()],y.prototype,"produces",void 0),e([o()],y.prototype,"consumes",void 0),y=e([h("esri.views.3d.webgl-engine.effects.highlight.Highlight")],y);class A{constructor(){this.coverage=null,this.vao=null,this.verticalCellCount=0,this.horizontalCellCount=0,this.viewportWidth=0,this.viewportHeight=0}}function E(e){const t=new Uint8Array(128);let r=0;for(const i of e){const e=4*r,s=4*r+64;++r;const{color:o}=i,h=i.haloColor??o;t[e+0]=o.r,t[e+1]=o.g,t[e+2]=o.b,t[e+3]=i.fillOpacity*o.a*255,t[s+0]=h.r,t[s+1]=h.g,t[s+2]=h.b,t[s+3]=i.haloOpacity*h.a*255}return t}let S=0;function G(e){let t=0;for(const i of e){const{name:e}=i;t+=e.length;const{color:r,fillOpacity:s,haloColor:o,haloOpacity:h}=i;t+=r.r+r.g+r.b+r.a+s,t+=o?o.r+o.g+o.b+o.a+h:0}const r=e.at(0);if(r){const{shadowOpacity:e,shadowDifference:i,shadowColor:s}=r;t+=e+i+s.r+s.g+s.b+s.a}return S+++(t>=0?0:1)}const L=new Uint8Array([0,1,2,2,1,3]);function M(e,t,r,i,s,o=0){const{highlights:h}=i,l=h.length>1?t.acquire(r.width,r.height,"highlight mix",h.length>B?g.RG8UINT:g.R8UINT):null,{gl:a}=e;if(l){const t=e.getBoundFramebufferObject();e.bindFramebuffer(l.fbo),a.clearBufferuiv(a.COLOR,0,[0,0,0,0]),e.bindFramebuffer(t)}const c=l?.getTexture();i.highlightMixTexture=c,n(i.highlightMixOrigin,o,0),h.forEach(((t,h)=>{if(h>0){const t=I.TEXTURE_UNIT_FOR_UPDATES;e.bindTexture(c,t),e.setActiveTexture(t),a.copyTexSubImage2D(P.TEXTURE_2D,0,0,0,o,0,r.width,r.height),e.bindTexture(null,t)}e.clear(R.DEPTH),i.highlightLevel=h,s()})),i.highlightLevel=null,i.highlightMixTexture=null,l?.release()}const B=4;export{y as Highlight,B as maxHighlightsPerChannel,M as renderHighlightBuffer,G as trackHighlightOptions};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../core/has.js";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{property as i}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators/subclass.js";import{c as s,g as r}from"../../../../../chunks/vec32.js";import{create as a,fromRay as o,getStart as l,getEnd as h}from"../../../../../geometry/support/clipRay.js";import{intersectClipRay as c}from"../../../../../geometry/support/frustum.js";import{copy as d}from"../../../../../geometry/support/lineSegment.js";import{wrap as p}from"../../../../../geometry/support/ray.js";import{ViewingMode as u}from"../../../../ViewingMode.js";import{InternalRenderCategory as m}from"../../../webgl.js";import g from"../../../webgl/RenderNode.js";import{Blit as _}from"../blit/Blit.js";import{LaserlinePathData as P}from"./LaserlinePathData.js";import{LaserlinePathPassParameters as b,LaserlinePathTechnique as f}from"./LaserlinePathTechnique.js";import{LaserlinePathTechniqueConfiguration as E}from"./LaserlinePathTechniqueConfiguration.js";import{LaserlineTechnique as D}from"./LaserlineTechnique.js";import{LaserlineTechniqueConfiguration as q}from"./LaserlineTechniqueConfiguration.js";import{RenderRequestType as T}from"../../lib/basicInterfaces.js";import{updateParameters as L}from"../../materials/internal/MaterialUtil.js";import{BlitMode as V}from"../../shaders/CompositingTechniqueConfiguration.js";import{FramebufferBit as C}from"../../../../webgl/enums.js";let j=class extends g{constructor(e){super(e),this.produces=m.LASERLINES,this.consumes={required:[m.LASERLINES,"normals"]},this.requireGeometryDepth=!0,this._configuration=new q,this._pathTechniqueConfiguration=new E,this._heightManifoldEnabled=!1,this._pointDistanceEnabled=!1,this._lineVerticalPlaneEnabled=!1,this._intersectsLineEnabled=!1,this._intersectsLineInfinite=!1,this._pathVerticalPlaneEnabled=!1,this._passParameters=new b;const t=e.view.stage.renderView.techniques,i=new E;i.contrastControlEnabled=e.contrastControlEnabled,t.precompile(f,i)}initialize(){this._passParameters.renderCoordsHelper=this.view.renderCoordsHelper,this._pathTechniqueConfiguration.spherical=this.view.state.viewingMode===u.Global,this._pathTechniqueConfiguration.contrastControlEnabled=this.contrastControlEnabled,this._techniques.precompile(f,this._pathTechniqueConfiguration),this._blit=new _(this._techniques,V.PremultipliedAlpha)}destroy(){this._pathVerticalPlaneData=t(this._pathVerticalPlaneData),this._blit=null}get _techniques(){return this.view.stage.renderView.techniques}get heightManifoldEnabled(){return this._heightManifoldEnabled}set heightManifoldEnabled(e){this._heightManifoldEnabled!==e&&(this._heightManifoldEnabled=e,this.requestRender(T.UPDATE))}get heightManifoldTarget(){return this._passParameters.heightManifoldTarget}set heightManifoldTarget(e){s(this._passParameters.heightManifoldTarget,e),this.requestRender(T.UPDATE)}get pointDistanceEnabled(){return this._pointDistanceEnabled}set pointDistanceEnabled(e){e!==this._pointDistanceEnabled&&(this._pointDistanceEnabled=e,this.requestRender(T.UPDATE))}get pointDistanceTarget(){return this._passParameters.pointDistanceTarget}set pointDistanceTarget(e){s(this._passParameters.pointDistanceTarget,e),this.requestRender(T.UPDATE)}get pointDistanceOrigin(){return this._passParameters.pointDistanceOrigin}set pointDistanceOrigin(e){s(this._passParameters.pointDistanceOrigin,e),this.requestRender(T.UPDATE)}get lineVerticalPlaneEnabled(){return this._lineVerticalPlaneEnabled}set lineVerticalPlaneEnabled(e){e!==this._lineVerticalPlaneEnabled&&(this._lineVerticalPlaneEnabled=e,this.requestRender(T.UPDATE))}get lineVerticalPlaneSegment(){return this._passParameters.lineVerticalPlaneSegment}set lineVerticalPlaneSegment(e){d(e,this._passParameters.lineVerticalPlaneSegment),this.requestRender(T.UPDATE)}get intersectsLineEnabled(){return this._intersectsLineEnabled}set intersectsLineEnabled(e){e!==this._intersectsLineEnabled&&(this._intersectsLineEnabled=e,this.requestRender(T.UPDATE))}get intersectsLineSegment(){return this._passParameters.intersectsLineSegment}set intersectsLineSegment(e){d(e,this._passParameters.intersectsLineSegment),this.requestRender(T.UPDATE)}get intersectsLineInfinite(){return this._intersectsLineInfinite}set intersectsLineInfinite(e){e!==this._intersectsLineInfinite&&(this._intersectsLineInfinite=e,this.requestRender(T.UPDATE))}get pathVerticalPlaneEnabled(){return this._pathVerticalPlaneEnabled}set pathVerticalPlaneEnabled(e){e!==this._pathVerticalPlaneEnabled&&(this._pathVerticalPlaneEnabled=e,null!=this._pathVerticalPlaneData&&this.requestRender(T.UPDATE))}set pathVerticalPlaneVertices(e){null==this._pathVerticalPlaneData&&(this._pathVerticalPlaneData=new P(this._passParameters.renderCoordsHelper)),this._pathVerticalPlaneData.vertices=e,this.pathVerticalPlaneEnabled&&this.requestRender(T.UPDATE)}set pathVerticalPlaneBuffers(e){null==this._pathVerticalPlaneData&&(this._pathVerticalPlaneData=new P(this._passParameters.renderCoordsHelper)),this._pathVerticalPlaneData.buffers=e,this.pathVerticalPlaneEnabled&&this.requestRender(T.UPDATE)}setParameters(e){L(this._passParameters,e)&&this.requestRender(T.UPDATE)}precompile(){this._acquireTechnique()}render(e){const t=e.find((({name:e})=>e===this.produces));if(
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../core/has.js";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{property as i}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators/subclass.js";import{c as s,g as r}from"../../../../../chunks/vec32.js";import{create as a,fromRay as o,getStart as l,getEnd as h}from"../../../../../geometry/support/clipRay.js";import{intersectClipRay as c}from"../../../../../geometry/support/frustum.js";import{copy as d}from"../../../../../geometry/support/lineSegment.js";import{wrap as p}from"../../../../../geometry/support/ray.js";import{ViewingMode as u}from"../../../../ViewingMode.js";import{InternalRenderCategory as m}from"../../../webgl.js";import g from"../../../webgl/RenderNode.js";import{Blit as _}from"../blit/Blit.js";import{LaserlinePathData as P}from"./LaserlinePathData.js";import{LaserlinePathPassParameters as b,LaserlinePathTechnique as f}from"./LaserlinePathTechnique.js";import{LaserlinePathTechniqueConfiguration as E}from"./LaserlinePathTechniqueConfiguration.js";import{LaserlineTechnique as D}from"./LaserlineTechnique.js";import{LaserlineTechniqueConfiguration as q}from"./LaserlineTechniqueConfiguration.js";import{RenderRequestType as T}from"../../lib/basicInterfaces.js";import{updateParameters as L}from"../../materials/internal/MaterialUtil.js";import{BlitMode as V}from"../../shaders/CompositingTechniqueConfiguration.js";import{FramebufferBit as C}from"../../../../webgl/enums.js";let j=class extends g{constructor(e){super(e),this.isDecoration=!0,this.produces=m.LASERLINES,this.consumes={required:[m.LASERLINES,"normals"]},this.requireGeometryDepth=!0,this._configuration=new q,this._pathTechniqueConfiguration=new E,this._heightManifoldEnabled=!1,this._pointDistanceEnabled=!1,this._lineVerticalPlaneEnabled=!1,this._intersectsLineEnabled=!1,this._intersectsLineInfinite=!1,this._pathVerticalPlaneEnabled=!1,this._passParameters=new b;const t=e.view.stage.renderView.techniques,i=new E;i.contrastControlEnabled=e.contrastControlEnabled,t.precompile(f,i)}initialize(){this._passParameters.renderCoordsHelper=this.view.renderCoordsHelper,this._pathTechniqueConfiguration.spherical=this.view.state.viewingMode===u.Global,this._pathTechniqueConfiguration.contrastControlEnabled=this.contrastControlEnabled,this._techniques.precompile(f,this._pathTechniqueConfiguration),this._blit=new _(this._techniques,V.PremultipliedAlpha)}destroy(){this._pathVerticalPlaneData=t(this._pathVerticalPlaneData),this._blit=null}get _techniques(){return this.view.stage.renderView.techniques}get heightManifoldEnabled(){return this._heightManifoldEnabled}set heightManifoldEnabled(e){this._heightManifoldEnabled!==e&&(this._heightManifoldEnabled=e,this.requestRender(T.UPDATE))}get heightManifoldTarget(){return this._passParameters.heightManifoldTarget}set heightManifoldTarget(e){s(this._passParameters.heightManifoldTarget,e),this.requestRender(T.UPDATE)}get pointDistanceEnabled(){return this._pointDistanceEnabled}set pointDistanceEnabled(e){e!==this._pointDistanceEnabled&&(this._pointDistanceEnabled=e,this.requestRender(T.UPDATE))}get pointDistanceTarget(){return this._passParameters.pointDistanceTarget}set pointDistanceTarget(e){s(this._passParameters.pointDistanceTarget,e),this.requestRender(T.UPDATE)}get pointDistanceOrigin(){return this._passParameters.pointDistanceOrigin}set pointDistanceOrigin(e){s(this._passParameters.pointDistanceOrigin,e),this.requestRender(T.UPDATE)}get lineVerticalPlaneEnabled(){return this._lineVerticalPlaneEnabled}set lineVerticalPlaneEnabled(e){e!==this._lineVerticalPlaneEnabled&&(this._lineVerticalPlaneEnabled=e,this.requestRender(T.UPDATE))}get lineVerticalPlaneSegment(){return this._passParameters.lineVerticalPlaneSegment}set lineVerticalPlaneSegment(e){d(e,this._passParameters.lineVerticalPlaneSegment),this.requestRender(T.UPDATE)}get intersectsLineEnabled(){return this._intersectsLineEnabled}set intersectsLineEnabled(e){e!==this._intersectsLineEnabled&&(this._intersectsLineEnabled=e,this.requestRender(T.UPDATE))}get intersectsLineSegment(){return this._passParameters.intersectsLineSegment}set intersectsLineSegment(e){d(e,this._passParameters.intersectsLineSegment),this.requestRender(T.UPDATE)}get intersectsLineInfinite(){return this._intersectsLineInfinite}set intersectsLineInfinite(e){e!==this._intersectsLineInfinite&&(this._intersectsLineInfinite=e,this.requestRender(T.UPDATE))}get pathVerticalPlaneEnabled(){return this._pathVerticalPlaneEnabled}set pathVerticalPlaneEnabled(e){e!==this._pathVerticalPlaneEnabled&&(this._pathVerticalPlaneEnabled=e,null!=this._pathVerticalPlaneData&&this.requestRender(T.UPDATE))}set pathVerticalPlaneVertices(e){null==this._pathVerticalPlaneData&&(this._pathVerticalPlaneData=new P(this._passParameters.renderCoordsHelper)),this._pathVerticalPlaneData.vertices=e,this.pathVerticalPlaneEnabled&&this.requestRender(T.UPDATE)}set pathVerticalPlaneBuffers(e){null==this._pathVerticalPlaneData&&(this._pathVerticalPlaneData=new P(this._passParameters.renderCoordsHelper)),this._pathVerticalPlaneData.buffers=e,this.pathVerticalPlaneEnabled&&this.requestRender(T.UPDATE)}setParameters(e){L(this._passParameters,e)&&this.requestRender(T.UPDATE)}precompile(){this._acquireTechnique()}render(e){const t=e.find((({name:e})=>e===this.produces));if(this.isDecoration&&!this.bindParameters.decorations||null==this._blit)return t;const i=this.renderingContext,n=e.find((({name:e})=>"normals"===e));this._passParameters.normals=n?.getTexture();const s=()=>{(this.heightManifoldEnabled||this.pointDistanceEnabled||this.lineVerticalPlaneSegment||this.intersectsLineEnabled)&&this._renderUnified(),this.pathVerticalPlaneEnabled&&this._renderPath()};if(!this.contrastControlEnabled)return i.bindFramebuffer(t.fbo),s(),t;this._passParameters.colors=t.getTexture();const r=this.fboCache.acquire(t.fbo.width,t.fbo.height,"laser lines");return i.bindFramebuffer(r.fbo),i.setClearColor(0,0,0,0),i.clear(C.COLOR|C.DEPTH),s(),i.unbindTexture(t.getTexture()),this._blit.blend(i,r,t,this.bindParameters)||this.requestRender(T.UPDATE),r.release(),t}_acquireTechnique(){return this._configuration.heightManifoldEnabled=this.heightManifoldEnabled,this._configuration.lineVerticalPlaneEnabled=this.lineVerticalPlaneEnabled,this._configuration.pointDistanceEnabled=this.pointDistanceEnabled,this._configuration.intersectsLineEnabled=this.intersectsLineEnabled,this._configuration.contrastControlEnabled=this.contrastControlEnabled,this._configuration.spherical=this.view.state.viewingMode===u.Global,this._techniques.get(D,this._configuration)}_renderUnified(){if(!this._updatePassParameters())return;const e=this._acquireTechnique();if(e.compiled){const t=this.renderingContext;t.bindTechnique(e,this.bindParameters,this._passParameters),t.screen.draw()}else this.requestRender(T.UPDATE)}_renderPath(){if(null==this._pathVerticalPlaneData)return;const e=this._techniques.get(f,this._pathTechniqueConfiguration);if(e.compiled){const t=this.renderingContext;this._passParameters.origin=this._pathVerticalPlaneData.origin,t.bindTechnique(e,this.bindParameters,this._passParameters),this._pathVerticalPlaneData.draw(t)}else this.requestRender(T.UPDATE)}_updatePassParameters(){if(!this._intersectsLineEnabled)return!0;const e=this.bindParameters.camera,t=this._passParameters;if(this._intersectsLineInfinite){if(o(p(t.intersectsLineSegment.origin,t.intersectsLineSegment.vector),w),w.c0=-Number.MAX_VALUE,!c(e.frustum,w))return!1;l(w,t.lineStartWorld),h(w,t.lineEndWorld)}else s(t.lineStartWorld,t.intersectsLineSegment.origin),r(t.lineEndWorld,t.intersectsLineSegment.origin,t.intersectsLineSegment.vector);return!0}get test(){}};e([i({constructOnly:!0})],j.prototype,"contrastControlEnabled",void 0),e([i()],j.prototype,"isDecoration",void 0),e([i()],j.prototype,"produces",void 0),e([i()],j.prototype,"consumes",void 0),j=e([n("esri.views.3d.webgl-engine.effects.laserlines.LaserLineRenderer")],j);const w=a();export{j as LaserLineRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{throwIfAborted as t}from"../../../../../core/promiseUtils.js";import{watch as s,syncAndInitial as i}from"../../../../../core/reactiveUtils.js";import{property as a}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{requestImage as n}from"../../../../../support/requestImageUtils.js";import{InternalRenderCategory as c,RenderCategory as h}from"../../../webgl.js";import
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{throwIfAborted as t}from"../../../../../core/promiseUtils.js";import{watch as s,syncAndInitial as i}from"../../../../../core/reactiveUtils.js";import{property as a}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{requestImage as n}from"../../../../../support/requestImageUtils.js";import{InternalRenderCategory as c,RenderCategory as h}from"../../../webgl.js";import m from"../../../webgl/RenderNode.js";import{ColorFormat as u}from"../../core/FBOCacheFormats.js";import{SMAABlendWeightsTechnique as l}from"./SMAABlendWeightsTechnique.js";import{SMAABlurTechnique as p}from"./SMAABlurTechnique.js";import{SMAAEdgeDetectTechnique as d}from"./SMAAEdgeDetectTechnique.js";import{SMAAPassParameters as f}from"./SMAAPassParameters.js";import{RenderRequestType as T}from"../../lib/basicInterfaces.js";import{PixelFormat as b,TextureSamplingMode as x,FramebufferBit as _,TextureWrapMode as A}from"../../../../webgl/enums.js";import{Texture as g}from"../../../../webgl/Texture.js";import{TextureDescriptor as C}from"../../../../webgl/TextureDescriptor.js";let j=class extends m{constructor(e){super(e),this.produces="disabled",this.consumes={required:[c.ANTIALIASING],optional:[h.COMPOSITE]},this._areaTexture=null,this._searchTexture=null,this._smaaParameters=new f}initialize(){this.addHandles([s((()=>this.isEnabled()),(e=>e?this.enable():this.disable()),i)])}async enable(){if(this.produces=c.ANTIALIASING,this._abortController||this._areaTexture&&this._searchTexture)return;this._abortController=new AbortController;const e=this._abortController.signal;try{const r=await import("./SMAAData.js");await this._loadTextures(r,e),this.requestRender(T.UPDATE)}catch{}this._abortController=null}async _loadTextures(e,r){t(r);const[s,i]=await Promise.allSettled([n(e.areaTexture,{signal:r}),n(e.searchTexure,{signal:r})]);if(t(r),"fulfilled"!==s.status||"fulfilled"!==i.status)return;const a=this.renderingContext;this._areaTexture=w(a,x.LINEAR,b.RGB,s.value),this._searchTexture=w(a,x.NEAREST,b.LUMINANCE,i.value)}disable(){this.produces="disabled"}destroy(){this._searchTexture=r(this._searchTexture),this._areaTexture=r(this._areaTexture)}precompile(){this.techniques.precompile(d),this.techniques.precompile(l),this.techniques.precompile(p)}render(e){const r=e.find((({name:e})=>e===c.ANTIALIASING));if(!this._areaTexture||!this._searchTexture)return this.requestRender(T.UPDATE),r;const t=this.techniques.get(d),s=this.techniques.get(l),i=this.techniques.get(p);if(!t.compiled||!s.compiled||!i.compiled)return this.requestRender(T.UPDATE),r;const a=e.find((({name:e})=>e===h.COMPOSITE));if(!a)return r;const o=a.fbo.width,n=a.fbo.height,m=this.renderingContext;m.setViewport(0,0,o,n);const f=this.fboCache.acquire(o,n,"smaa edges",u.RG8UNORM);m.bindFramebuffer(f.fbo),m.setClearColor(0,0,0,1),m.clear(_.COLOR),this._smaaParameters.color=a.getTexture();const b=this.bindParameters;m.bindTechnique(t,b,this._smaaParameters),m.screen.draw();const x=this.fboCache.acquire(o,n,"smaa blend");return m.bindFramebuffer(x.fbo),m.setClearColor(0,0,1,1),m.clear(_.COLOR),this._smaaParameters.inputTexture=f.getTexture(),this._smaaParameters.areaTexture=this._areaTexture,this._smaaParameters.searchTexture=this._searchTexture,m.bindTechnique(s,b,this._smaaParameters),m.screen.draw(),f.release(),m.bindFramebuffer(r.fbo),m.setClearColor(0,1,0,1),m.clear(_.COLOR),this._smaaParameters.inputTexture=x.getTexture(),m.bindTechnique(i,b,this._smaaParameters),m.screen.draw(),x.release(),r}};function w(e,r,t,s){const i=new C;return i.pixelFormat=t,i.wrapMode=A.CLAMP_TO_EDGE,i.width=s.width,i.height=s.height,i.samplingMode=r,new g(e,i,s)}e([a()],j.prototype,"produces",void 0),e([a()],j.prototype,"consumes",void 0),e([a({constructOnly:!0})],j.prototype,"isEnabled",void 0),e([a()],j.prototype,"_abortController",void 0),j=e([o("esri.views.3d.webgl-engine.effects.smaa.SMAA")],j);export{j as SMAA};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{clamp as r}from"../../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../../core/maybe.js";import{watch as t}from"../../../../../core/reactiveUtils.js";import{Milliseconds as i}from"../../../../../core/time.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as m}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{InternalRenderCategory as n}from"../../../webgl.js";import
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{clamp as r}from"../../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../../core/maybe.js";import{watch as t}from"../../../../../core/reactiveUtils.js";import{Milliseconds as i}from"../../../../../core/time.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as m}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{InternalRenderCategory as n}from"../../../webgl.js";import c from"../../../webgl/RenderNode.js";import{ColorFormat as p}from"../../core/FBOCacheFormats.js";import{distanceFadeEnd as h,distanceFadeStart as u}from"../../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{SSAOBlurTechnique as l}from"./SSAOBlurTechnique.js";import{noiseData as d}from"./SSAONoiseData.js";import{SSAOPassParameters as f,BlurDrawParameters as b}from"./SSAOParameters.js";import{SSAOTechnique as w}from"./SSAOTechnique.js";import{RenderRequestType as T}from"../../lib/basicInterfaces.js";import{g as S}from"../../../../../chunks/SSAO.glsl.js";import{TextureWrapMode as _,PixelFormat as P,DepthStencilAttachment as j,FramebufferBit as g}from"../../../../webgl/enums.js";import{Texture as x}from"../../../../webgl/Texture.js";import{TextureDescriptor as O}from"../../../../webgl/TextureDescriptor.js";const q=2;let A=class extends c{constructor(e){super(e),this.consumes={required:["normals"]},this.produces=n.SSAO,this.isEnabled=()=>!1,this._enableTime=i(0),this._passParameters=new f,this._drawParameters=new b}initialize(){const e=Uint8Array.from(atob(d),(e=>e.charCodeAt(0))),r=new O;r.wrapMode=_.CLAMP_TO_EDGE,r.pixelFormat=P.RGB,r.wrapMode=_.REPEAT,r.hasMipmap=!0,r.width=32,r.height=32,this._passParameters.noiseTexture=new x(this.renderingContext,r,e),this.techniques.precompile(w),this.techniques.precompile(l),this.addHandles(t((()=>this.isEnabled()),(()=>this._enableTime=i(0))))}destroy(){this._passParameters.noiseTexture=s(this._passParameters.noiseTexture)}render(e){const s=this.bindParameters,t=e.find((({name:e})=>"normals"===e)),o=t?.getTexture(),a=t?.getTexture(j),c=this.fboCache,d=s.camera,f=d.fullViewport[2],b=d.fullViewport[3],_=Math.round(f/q),P=Math.round(b/q),x=this.techniques.get(w),O=this.techniques.get(l);if(!x.compiled||!O.compiled)return this._enableTime=i(performance.now()),this.requestRender(T.UPDATE),c.acquire(_,P,n.SSAO,p.R8UNORM);0===this._enableTime&&(this._enableTime=i(performance.now()));const A=this.renderingContext,y=this.view.qualitySettings.fadeDuration,C=d.relativeElevation,M=r((h-C)/(h-u),0,1),v=y>0?Math.min(y,performance.now()-this._enableTime)/y:1,E=v*M;this._passParameters.normalTexture=o,this._passParameters.depthTexture=a,this._passParameters.projScale=1/d.computeScreenPixelSizeAtDist(1),this._passParameters.intensity=4*R/S(d)**6*E;const U=c.acquire(f,b,"ssao input",p.RG8UNORM);A.bindFramebuffer(U.fbo),A.setViewport(0,0,f,b),A.bindTechnique(x,s,this._passParameters,this._drawParameters),A.screen.draw();const V=c.acquire(_,P,"ssao blur",p.R8UNORM);A.bindFramebuffer(V.fbo),this._drawParameters.colorTexture=U.getTexture(),m(this._drawParameters.blurSize,0,q/b),A.bindTechnique(O,s,this._passParameters,this._drawParameters),A.setViewport(0,0,_,P),A.screen.draw(),U.release();const D=c.acquire(_,P,n.SSAO,p.R8UNORM);return A.bindFramebuffer(D.fbo),A.setViewport(0,0,f,b),A.setClearColor(1,1,1,0),A.clear(g.COLOR),this._drawParameters.colorTexture=V.getTexture(),m(this._drawParameters.blurSize,q/f,0),A.bindTechnique(O,s,this._passParameters,this._drawParameters),A.setViewport(0,0,_,P),A.screen.draw(),A.setViewport4fv(d.fullViewport),V.release(),v<1&&this.requestRender(T.UPDATE),D}};e([o()],A.prototype,"consumes",void 0),e([o()],A.prototype,"produces",void 0),e([o({constructOnly:!0})],A.prototype,"isEnabled",void 0),A=e([a("esri.views.3d.webgl-engine.effects.ssao.SSAO")],A);const R=.5;export{A as SSAO,q as blurSizePixels};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
class t{constructor(t=1/0,
|
|
5
|
+
class t{constructor(t=1/0,i=-1/0){this.near=t,this.far=i}set(t,i){this.near=t,this.far=i}union(t){null!=t&&(this.near=Math.min(this.near,t.near),this.far=Math.max(this.far,t.far))}within(t){return this.near<=t&&t<=this.far}static{this.zero=new t(0,0)}static{this.infinite=new t}}export{t as DepthRange};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{releaseMaybe as e}from"../../../../core/maybe.js";import{c as t}from"../../../../chunks/vec42.js";import{ZEROS as i}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ColorFormat as r}from"
|
|
5
|
+
import{releaseMaybe as e}from"../../../../core/maybe.js";import{c as t}from"../../../../chunks/vec42.js";import{ZEROS as i}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ColorFormat as r,DepthTextureFormat as o}from"../core/FBOCacheFormats.js";import{ViewportSize as h}from"./BindParameters.js";import{FramebufferBit as c,ColorAttachment1 as l}from"../../../webgl/enums.js";import{ensureAttachmentMaxSize as _}from"../../../webgl/FramebufferObject.js";class a{constructor(e){this._fbos=e,this._requiresEmission=!1,this._size=new h(0,0),this._clearColor=s()}dispose(){this._color=e(this._color),this.releaseDepth()}initialize(e,i,s,r){this._size.width=e,this._size.height=i,_(this._size,this._fbos.rctx.parameters.maxTextureSize);const o=this._color;return this._color=null,this.releaseDepth(),this._requiresEmission=r,t(this._clearColor,s),o}releaseDepth(){this._color?.detachDepth(),this._depth=e(this._depth)}update(e){const t=this._ensureColor();t.attachDepth(this.depth),this._color=e(t)}bind(){const{rctx:e}=this._fbos,t=null==this._color;this.color.attachDepth(this.depth),e.bindFramebuffer(this.color.fbo),t&&(e.setClearStencil(0),e.setClearColor(this._clearColor[0],this._clearColor[1],this._clearColor[2],this._clearColor[3]),e.clear(c.COLOR|c.DEPTH|c.STENCIL),this._requiresEmission&&e.clearBuffer(1,i))}_acquireColor(){return this._requiresEmission?this._fbos.acquire(this._size.width,this._size.height,"acquired-color").acquireColor(l,r.RGBA16FLOAT,"emissive"):this._fbos.acquire(this._size.width,this._size.height,"acquired-color")}_acquireDepth(){return this._fbos.acquireDepth(o.DEPTH24_STENCIL8,this._size.width,this._size.height,"depth")}get size(){return this._size}get color(){return this._ensureColor()}get depth(){return this._depth??=this._acquireDepth(),this._depth}_ensureColor(){return this._color??=this._acquireColor(),this._color}}export{a as MainFramebuffer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as i}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{clamp as s,lerp as a}from"../../../../core/mathUtils.js";import{removeMaybe as n,abortMaybe as h,destroyMaybe as o,releaseMaybe as d}from"../../../../core/maybe.js";import{throwIfAborted as _}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as p,initial as u,sync as m}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{Milliseconds as g}from"../../../../core/time.js";import{property as f}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as b}from"../../../../core/accessorSupport/decorators/subclass.js";import{equals as A,invert as T,multiply as E}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as P,create as R}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as S}from"../../../../chunks/vec42.js";import{ZEROS as I}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{fromValues as C,ZEROS as w}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as O}from"../../../../geometry/support/Indices.js";import{RenderCategory as N,InternalRenderCategory as D}from"../../webgl.js";import{debugFlags as y}from"../../support/debugFlags.js";import{ColorFormat as x,DepthRenderbuffer16f as H}from"../../webgl/formats.js";import{FBOCache as M,defaultWebGLFBO as L}from"../core/FBOCache.js";import{RenderPassManager as F}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as U,isColorOrColorEmission as v}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as G}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{distanceFadeEnd as q}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as V}from"../effects/RenderNodes.js";import{RenderPluginManager as j}from"../effects/RenderPluginManager.js";import{Blit as B}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as Q,renderHighlightBuffer as W}from"../effects/highlight/Highlight.js";import{OITBlend as k}from"../effects/transparency/OITBlend.js";import{AnimationTimer as z}from"./AnimationTimer.js";import{AnimationTimeStep as Y}from"./AnimationTimeStep.js";import{RenderRequestType as X}from"./basicInterfaces.js";import{BoundingInfo as K}from"./BoundingInfo.js";import{DepthRange as J}from"./DepthRange.js";import{depthRangeFromScene as Z}from"./depthRangeUtils.js";import{hudFragmentOpacityParameters as $}from"./hudFragmentOpacityParameters.js";import{MainFramebuffer as ee}from"./MainFramebuffer.js";import{RenderOccludedFlag as te}from"./Material.js";import{OITPass as re}from"./OITPass.js";import{RenderContext as ie,defaultRenderOccludedMask as se}from"./RenderContext.js";import{RendererBase as ae}from"./RendererBase.js";import{RendererTarget as ne}from"./rendererUtils.js";import{setupFeatureDefaults as he,RenderFeature as oe}from"./RenderFeature.js";import{RenderPluginInput as de}from"./RenderPluginInput.js";import{RenderSlot as _e}from"./RenderSlot.js";import{ShadowAccumulator as le}from"./ShadowAccumulator.js";import{ShadowMap as pe,SnapshotSlot as ue}from"./ShadowMap.js";import me from"./SliceHelper.js";import{Transparency as ce}from"./edgeRendering/interfaces.js";import{MergedRenderer as ge}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as fe}from"../parts/renderUtils.js";import{RendererPerformanceInfo as be,PerformanceCategory as Ae}from"../statistics/RendererPerformanceInfo.js";import{RenderState as Te}from"../../../support/RenderState.js";import{DepthStencilAttachment as Ee,PixelFormat as Pe,PixelType as Re,FramebufferBit as Se,ColorAttachment1 as Ie,ColorAttachment2 as Ce}from"../../../webgl/enums.js";let we=class extends ae{constructor(e,t,r,s,a,n){super({stage:e}),this._techniques=r,this._rctx=s,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this.renderPassManager=new F,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=C(0,0,0,1),this._sliceHelper=new me,this._blit=null,this._oitblend=null,this._state=c(Te.IDLE),this._highQualityTransparencyEnabled=!0,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new Y,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._lastFrameTime=g(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new de,this._releaseNormals=e=>{e.some((({name:e})=>"normals"===e))&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this.fboCache=new M(s),this._renderStateFeatures=c(he(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._framebuffer=new ee(this.fboCache),this.performanceInfo=new be(this._rctx),this._shadowMap=new pe(this.fboCache,e.viewingMode),this._shadowAccumulator=new le(this.fboCache,r,e,(e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t}),((t,r,i)=>{const s=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,r,i,!0,s),this._renderShadowCascades(U.Shadow,t.shadowMap),t.shadowMap.finish(),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)}),n),this._renderContext=new ie(this._rctx,this._shadowMap,r),this._nodes=new V(this._renderContext),this._plugins=new j({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this._plugins.add(this.renderPassManager),this.addHandles([l((()=>e.view.state.camera),(()=>n()),p),l((()=>y.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(ce.TRANSPARENT):()=>{},n()}),u),l((()=>e.view.environment.background?.color),(e=>{const t=e?i(e):w;S(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()}),p),l((()=>e.view.state.camera.relativeElevation),(e=>this._inGlobeView=(e??1/0)>=q),p),l((()=>this._bindParameters.clouds.fadeFactor),(()=>this._bindParameters.fadeLighting()),m),l((()=>this._bindParameters.clouds.data?.state),(()=>n()),m),l((()=>e.view.state.highlights),(e=>{this._bindParameters.highlights=e,n()}),u)])}destroy(){this._gpuTimerHandle=n(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.dispose(),this._loadEdgeViewTask=h(this._loadEdgeViewTask),this._edgeView=o(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),this._plugins.destroy(),this._blit=null,this._oitblend=null,K.prune(),ge.prune(),O()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _framebufferSize(){return this._framebuffer.size}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=he(t,e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate((i=>i.set(t,e,r))),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(oe.HighQualityTransparency)}get hasReflections(){return this._pluginsHas.water&&(this._ssrEnabled||this.isFeatureEnabled(oe.WaterReflection))}get _hasHighlights(){return this._plugins.produces(U.Highlight,_e.OPAQUE_MATERIAL,_e.TRANSPARENT_MATERIAL,_e.DRAPED_MATERIAL,_e.HUD_MATERIAL,_e.LABEL_MATERIAL)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(U.Highlight,_e.HUD_MATERIAL,_e.LABEL_MATERIAL)}get hasSSAO(){return(this.stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(oe.SSAO))&&!this._inGlobeView}get hasSMAA(){return this.stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(oe.Antialiasing)}get fullResolutionAtmosphere(){return this.stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(oe.HighResolutionAtmosphere)}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=d(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=d(this._bindParameters.depth),this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility)}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.running||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r((async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");_(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:Ge(this.stage.view.resourceController)});return this.addHandles(l((()=>r.updating),(()=>this._requestRender()),m)),this._requestRender(),this._edgeViewCallbacks.forEach((e=>e(r))),this._edgeViewCallbacks.length=0,r}))),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&A(this._bindParameters.ssr.reprojectionMatrix,P)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){null!=e.environment.weather&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}set slicePlane(e){this._sliceHelper.plane!==e&&(this._sliceHelper.plane=e,this._requestRender())}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(U.Color,...Me),has.water=this._plugins.produces(U.Normal,_e.DRAPED_WATER),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new z(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?n(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r=ne.Default,i=!1){try{return this._isRendering=!0,this._render(e,t,r,i)}catch(s){console.error(`Exception during rendering: ${s}`)}finally{this._isRendering=!1}return new fe(this._pluginInput.get(N.FINAL),null)}_updateHUDOccludedFragmentOpacity(e,t){const{idleOpacity:r,navigatingOpacity:i,maxDelta:n,tiltFadeStart:h,tiltFadeEnd:o,altitudeStart:d,altitudeEnd:_}=$,l=this.stage.view,p=l.stateManager.camera,u=l.qualitySettings.fadeDuration,m=e===Te.IDLE?r:i,c=s((p.tilt-h)/(o-h),0,1),g=s(((p.position.z??0)-d)/(_-d),0,1),f=a(a(1,m,c),1,g),b=this._bindParameters.hudOccludedFragmentOpacity;if(u<=0||b===f||0===this._lastFrameTime||this._lastFrameTime>t)return this._bindParameters.hudOccludedFragmentOpacity=f,void(this._lastFrameTime=t);const A=t-this._lastFrameTime;this._lastFrameTime=t;const T=Math.max(1-r,Math.abs(r-i)),E=Math.min(T*A/u,n);E>=Math.abs(f-b)?this._bindParameters.hudOccludedFragmentOpacity=f:(this._bindParameters.hudOccludedFragmentOpacity=b+Math.sign(f-b)*E,this._requestRender())}_render(e,t,r=ne.Default,i){this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r===ne.Default,this._disposeBindBuffers();const{camera:s,contentCamera:a,mode:n,alignPixelEnabled:h}=e;this._state.value=n;const o=this._nodes.produces("magnifier-color"),_=this._nodes.produces(N.FINAL),l=this._nodes.require("emissive",D.TRANSPARENT_ENVIRONMENT,N.COMPOSITE,N.FINAL)>0&&this._plugins.hasEmissions,p=l?U.ColorEmission:U.Color;this._renderContext.time=t,this._renderContext.output=p,this._bindParameters.oitPass=re.NONE,this._bindParameters.alignPixelEnabled=h,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null,this._bindParameters.slicePlane=this._sliceHelper.plane,this._bindParameters.viewshedEnabled=this._nodes.produces(D.VIEWSHED),this._renderOverlay(t),s.setGLViewport(this._rctx);const u=this._framebuffer,m=u.initialize(s.fullWidth,s.fullHeight,this._backgroundColor,l);this.hasReflections?(m?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=m):m?.release(),this._ensureBindParametersCamera(s,a),this._updateHUDOccludedFragmentOpacity(n,t),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!i;const c=this._highQualityTransparency&&this._hasTransparentTerrain,g=this._plugins.produces(U.Color,...xe);this._precompilePrepasses(),this.performanceInfo.advance(Ae.PREPARE);const f=this._computeDepthRange(s);this._renderShadowMap(s,this._bindParameters.lighting.mainLight.direction,f),this._ensureBindParametersCamera(s,a),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(f,s,a),this._ensureBindParametersSSR(t),this._precompileShaders(c,g,p),this._renderContext.output=p,u.bind(),this._bindParameters.mainDepth=u.depth.attachment;const b=this.plugins.produces(U.Color,...ye);b&&this._renderOpaqueGeometry(),u.update((e=>this._renderNodes(N.OPAQUE,e,b))),this.fboCache.debugCallback?.(N.OPAQUE,u.color.fbo),u.update((e=>this._renderNodes(D.OPAQUE_ENVIRONMENT,e))),this.fboCache.debugCallback?.(D.OPAQUE_ENVIRONMENT,u.color.fbo),this._renderTerrainDepth(c),this._renderEdges(ce.OPAQUE),u.bind(),this._renderPlugins(_e.VOXEL,Ae.VOXEL),this._renderHiddenTransparentEdges(),g&&(this._oitEnabled?this._renderOIT(Oe.Geometry,p):this._renderTransparentGeometry()),u.update((e=>this._renderNodes(N.TRANSPARENT,e,g))),this.fboCache.debugCallback?.(N.TRANSPARENT,u.color.fbo),this._renderGeometryDepth(c),this._renderHUDVisibility(),c||this._plugins.render(this._pluginInput,_e.LINE_CALLOUTS),this._renderEdges(ce.TRANSPARENT);const A=this._hasTransparentTerrain?this._renderTransparentTerrain():null;A&&(this.performanceInfo.advance(Ae.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(c?this._renderLineCallouts(G.Occluded):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,A.getTexture())),this._renderHUD(G.Occluded,u.color,p))),this._bindParameters.cullAboveTerrain=!1,A&&(u.bind(),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,A.getTexture()),A.release(),c&&(this._renderEdges(ce.OPAQUE),g&&(this._oitEnabled?this._renderOIT(Oe.Geometry,p):this._renderTransparentGeometry(),this.performanceInfo.advance(Ae.TRANSPARENT)),this._renderEdges(ce.TRANSPARENT))),this._bindParameters.ssao=d(this._bindParameters.ssao),c&&this._renderLineCallouts(G.NotOccluded),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment(),this._pluginInput.set(D.FOCUSAREA,this._renderFocusAreaGeometry()),u.update((e=>this._renderNodes(D.TRANSPARENT_ENVIRONMENT,e))),u.update((e=>this._renderNodes(D.VIEWSHED,e))),u.update((e=>this._renderNodes(D.LASERLINES,e))),u.update((e=>this._renderNodes(D.FOCUSAREA_COLOR,e))),u.update((e=>this._renderNodes(D.OCCLUDED,e))),this._pluginInput.set("highlights",this._renderHighlightPrepass());const T=r===ne.ObjectAndLayerID?this._renderObjectAndLayerIdColor():null;u.update((e=>this._renderNodes(N.COMPOSITE,e))),this._pluginInput.release(D.FOCUSAREA);const E=!(r!==ne.Default||_||o&&!i),P=this._pluginInput.get(N.COMPOSITE),R=E?L:this.fboCache.acquire(P.fbo.width,P.fbo.height,D.ANTIALIASING),S=this._nodes.produces(D.ANTIALIASING)?this._renderNodes(D.ANTIALIASING,R):this._blitFBO(P,R,!1);let I;this._pluginInput.set(D.ANTIALIASING,S),this._hasHUDHighlights?(this._renderHUD(G.NotOccluded,S,p),I=this._renderNodes(D.HIGHLIGHTS,S)):(I=this._renderNodes(D.HIGHLIGHTS,S),this._renderHUD(G.NotOccluded,I,p));const C=this._renderNodes(D.MAGNIFIER,I);return o&&!i&&r===ne.Default&&!_&&this._blitFBO(C),_?(C.attachDepth(u.depth),this._blitFBO(this._renderNodes(N.FINAL,C)),C.detachDepth()):this._pluginInput.set(N.FINAL,C),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),u.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),r!==ne.Default&&(this._releaseFBOs(),this._disposeOffscreenBuffers()),new fe(this._pluginInput.get(N.FINAL),T)}_precompileShaders(e,t,r){++this._plugins.context.techniques.precompiling,this._renderContext.output=r,this._precompileOpaqueGeometry(),this._nodes.precompile(D.OPAQUE_ENVIRONMENT),this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,this._renderContext.output=U.Depth,this._plugins.precompile(_e.TRANSPARENT_TERRAIN),e&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=r,this._plugins.precompile(_e.TRANSPARENT_TERRAIN),t&&(this._precompileTransparentGeometry(),this._hasTransparentTerrain&&(this._bindParameters.cullAboveTerrain=!1,this._precompileTransparentGeometry(),this._bindParameters.cullAboveTerrain=e)),this._nodes.precompile(D.FOCUSAREA),this._needsHUDVisibility&&this._plugins.precompile(_e.OCCLUSION_PIXELS),this._plugins.precompile(_e.LINE_CALLOUTS),this._precompileHUD(G.Occluded),this._bindParameters.terrainDepthTest=!1,this._bindParameters.cullAboveTerrain=!1,this._nodes.precompile(D.VIEWSHED,D.LASERLINES,D.FOCUSAREA_COLOR,D.OCCLUDED,D.ANTIALIASING,D.HIGHLIGHTS);const i=this._bindParameters;i.highlightMixTexture=i.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(G.NotOccluded),this._hasHighlights&&(i.highlights.forEach(((e,t)=>{i.highlightLevel=t,this._precompileAllGeometry(U.Highlight)})),i.highlightLevel=null),i.highlightMixTexture=null,this._nodes.precompile(N.COMPOSITE,D.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(_e.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){if(!this._nodes.produces(D.FOCUSAREA))return null;const{width:e,height:t}=this._framebufferSize;let r=this.fboCache.acquire(e,t,D.FOCUSAREA);return r=this._nodes.render(r,this._pluginInput),this.performanceInfo.advance(Ae.FOCUS_AREA_MASK),r}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._renderContext.output;++this._techniques.precompiling;const t=this._framebufferSize;let r=this.fboCache.acquire(t.width,t.height,"olid");return r.acquireDepth(Ee),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(Ae.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=e===X.BACKGROUND;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const s=Math.max(e,i);this._animationTimestep.frame(s,r)}}readMainDepth(e,t){const{mainDepth:r,camera:i}=this._bindParameters;if(!r)return;const s=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear-depth");this._rctx.bindFramebuffer(s.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(w),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),s.fbo?.readPixels(e[0],e[1],e[2],e[3],Pe.RGBA,Re.UNSIGNED_BYTE,t),s.release()}readHUDVisibility(e,t,r,i,s){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,i,Pe.RGBA,Re.UNSIGNED_BYTE,s)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"edges"),s=()=>t.render(this._bindParameters,e),a=this._bindParameters.geometryDepth;this.renderToTargets(s,i,a??this._framebuffer.depth,w),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(e===ce.OPAQUE?Ae.OPAQUE_EDGES:Ae.TRANSPARENT_EDGES)}_renderOverlay(e){this._bindParameters.overlay=this.overlay?.render(e),this._bindParameters.overlay&&this.performanceInfo.advance(Ae.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const i=this._shadowMap;i.start(e,t,r,this.isFeatureEnabled(oe.HighResolutionShadows),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(U.ShadowHighlight,this._shadowMap),i.moveSnapshot(ue.Highlight),this._renderShadowCascades(U.ShadowExcludeHighlight,this._shadowMap),i.copySnapshot(ue.ExcludeHighlight),this._renderShadowCascades(U.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(U.Shadow),i.finish(),e.setGLViewport(this._rctx),this.performanceInfo.advance(Ae.SHADOW_MAP)}_precompileShadowCascades(e){for(const t of this._shadowMap.cascades)t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.camera),this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(U.Depth)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._needsShadowAccumulation||this._debugNeedsDepth}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");if(e){const t=this._needsDepth?e.getAttachment(Ee):null;t?.retain(),this._pluginInput.set(D.SSAO,this._renderSSAO()),this._renderGeometryWithoutNormalsDepth(t)}else this._renderAllGeometryDepth()}_renderGeometryWithoutNormalsDepth(e){if(!this._needsDepth||!e)return void(this._bindParameters.depth=d(this._bindParameters.depth));const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"depth");r.attachDepth(e),e.release(),this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(Se.STENCIL),this._renderGeometryWithoutNormals(U.Depth),d(this._bindParameters.depth),this._bindParameters.depth=r.obtainDepthTexture(),r.release(),this.performanceInfo.advance(Ae.DEPTH)}_renderAllGeometryDepth(){if(!this._needsDepth)return void(this._bindParameters.depth=d(this._bindParameters.depth));const e=this._framebufferSize,t=this.fboCache.acquire(e.width,e.height,"depth").acquireDepth(Ee);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(Se.DEPTH|Se.STENCIL),this.renderAllGeometry(U.Depth),d(this._bindParameters.depth),this._bindParameters.depth=t.obtainDepthTexture(),t.release(),this.performanceInfo.advance(Ae.DEPTH)}_renderTerrainDepth(e){if(this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,!e)return void(this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth));const t=this._renderContext.output;this._renderContext.output=U.Depth;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"terrain depth").acquireDepth(Ee);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(Se.DEPTH|Se.STENCIL),this._renderTransparentTerrain(),d(this._bindParameters.terrainDepth),this._bindParameters.terrainDepth=i.obtainDepthTexture(),this._renderContext.output=t,i.release()}_renderGeometryDepth(e){if(!e)return void(this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth));const t=this._renderContext.output,{width:r,height:i}=this._framebufferSize,s=this.fboCache.acquire(r,i,"geometry depth").acquireDepth(Ee);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(Se.DEPTH|Se.STENCIL),this._renderOpaqueAndTransparentGeometry(U.Depth),this._renderContext.output=t,d(this._bindParameters.geometryDepth),this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowAccumulation}_computeDepthRange(e){if(!this._needsDepthRange)return J.zero;const t=Z(e,this._plugins.plugins,this.stage.layers);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}get _normalsRequired(){const e=this._nodes.require("normals",N.FINAL,N.COMPOSITE,N.OPAQUE,N.TRANSPARENT,D.VIEWSHED,D.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(U.Normal),this._needsDepth&&this._precompileAllGeometry(U.Depth),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(U.ShadowHighlight),this._precompileShadowCascades(U.ShadowExcludeHighlight),this._precompileShadowCascades(U.ShadowHighlight)):this._precompileShadowCascades(U.Shadow)),this._needsShadowAccumulation&&this._precompileAllGeometry(U.Shadow)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"normals",x.RGBA8);r.acquireDepth(Ee),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(w,!0,!0),this._renderGeometryWithNormals(U.Normal);const i=this._nodes.optional("normals",N.FINAL,N.COMPOSITE,N.OPAQUE,N.TRANSPARENT,D.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(Ae.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return void e?.detachDepth();L.setName(D.SSAO);const t=this._nodes.render(L,this._pluginInput);return this._bindParameters.ssao=t,e.detachDepth(),this._pluginInput.release("normals"),this.performanceInfo.advance(Ae.SSAO),t}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(_e.TRANSPARENT_TERRAIN),this._renderContext.output=t}renderAllGeometry(e){this._renderContext.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentTerrain()}precompileSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const r of t)this._renderContext.renderOccludedMask=r,this.precompileSlots(e,...He);this._renderContext.renderOccludedMask=se}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.forAll((e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t,this._pluginInput)}))}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>te.Occlude&&this._plugins.render(this._pluginInput,_e.OCCLUDED_TERRAIN),this.renderSlots(e,...He),this._renderContext.renderOccludedMask=se}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(this._pluginInput,_e.HUD_MATERIAL)}precompileViewshedShadowMap(){this._precompileAllGeometry(U.ViewshedShadow)}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(U.ViewshedShadow),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._renderContext.output=i}_renderOpaqueAndTransparentGeometry(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithNormals(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,...Ne),this._renderTransparentTerrain()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,...De)}_precompileOpaqueGeometry(){this._plugins.precompile(...ye)}_renderOpaqueGeometry(){this._plugins.render(this._pluginInput,...ye)}_renderTransparentGeometry(){this._plugins.render(this._pluginInput,...xe)}get _hasTransparentTerrain(){return this._plugins.produces(U.Color,_e.TRANSPARENT_TERRAIN)}_renderTransparentTerrain(){const e=()=>this._plugins.render(this._pluginInput,_e.TRANSPARENT_TERRAIN);if(!v(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent terrain");return this.renderToTargets(e,r,this._framebuffer.depth,w),r}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,_e.OCCLUSION_PIXELS)}_renderHUDVisibility(){if(!this._needsHUDVisibility)return void(this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility));const{width:e,height:t}=this._framebufferSize;let r=this._bindParameters.hudVisibility;r?.fbo?.width===e&&r?.fbo?.height===t||(r?.release(),r=this.fboCache.acquire(e,t,"hud visibility",x.RGBA4),this._bindParameters.hudVisibility=r);const i=this._bindParameters.geometryDepth;r.attachDepth(i||this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(this._pluginInput,_e.OCCLUSION_PIXELS),r.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(Ae.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===G.Occluded){const e=()=>this._plugins.render(this._pluginInput,_e.LINE_CALLOUTS),t=this._framebufferSize,r=this.fboCache.acquireDepth(H,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(this._pluginInput,_e.LINE_CALLOUTS)}_precompileHUD(e){if(this._precompileHUDOutput(e),this._hasHighlights){const t=this._renderContext.output;this._renderContext.output=U.Highlight,this._precompileHUDOutput(e),this._renderContext.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this._oitEnabled&&v(this._renderContext.output)?(this._bindParameters.oitPass=re.ColorAlpha,this._plugins.precompile(...Me),this._bindParameters.oitPass=re.FrontFace,this._plugins.precompile(...Me),this._bindParameters.oitPass=re.NONE):this._plugins.precompile(...Me),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t,r){if(this._pluginsHas.hudElements){if(this._oitEnabled){const i=this._renderOIT(Oe.HUD,r,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,i.getTexture()),i.release()}else if(this._renderContext.output=r,e===G.Occluded){const t=()=>this._renderHUDElements(e),r=this._framebufferSize,i=this.fboCache.acquireDepth(H,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(H),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(e===G.Occluded?Ae.HUD_OCCLUDED:Ae.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(this._pluginInput,...Me)}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(U.ShadowHighlight,_e.OPAQUE_MATERIAL)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,i=this._framebufferSize,{highlights:s}=r,a=e.acquire(i.width,i.height,"highlights",s.length>Q?x.RG8UI:x.R8UI);a.acquireDepth(Ee),t.bindFramebuffer(a.fbo);const{gl:n}=t;return n.clearBufferuiv(n.COLOR,0,[0,0,0,0]),this._renderContext.output=U.Highlight,t.bindFramebuffer(a.fbo),W(t,e,i,r,(()=>this._renderHighlightGeometries())),this.performanceInfo.advance(Ae.HIGHLIGHTS),a}_renderHighlightGeometries(){this._plugins.render(this._pluginInput,...Le),this._rctx.clear(Se.DEPTH),this._renderHUDElements(G.Both)}get _needsShadowAccumulation(){return this._shadowAccumulator.accumulating}_renderShadowAccumulation(e,t,r){this._needsShadowAccumulation&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,e,t,r)&&this.performanceInfo.advance(Ae.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this._oitEnabled&&v(this._renderContext.output)?(this._bindParameters.oitPass=re.ColorAlpha,this._plugins.precompile(...xe),this._bindParameters.oitPass=re.FrontFace,this._plugins.precompile(...xe),this._bindParameters.oitPass=re.NONE):this._plugins.precompile(...xe)}_renderOIT(e,t,r=G.Both){const i=e===Oe.HUD,s=this._framebufferSize,a=i?this.fboCache.acquire(s.width,s.height,"oit hud composite"):null,n=i?()=>this._renderHUDElements(r):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=this._renderContext.output;this._renderContext.output=t,h.oitPass=re.ColorAlpha;const d=a?"oit hud color+alpha":"oit color+alpha",_=t===U.ColorEmission,l=this.fboCache.acquire(s.width,s.height,d,_?x.RGBA16F:x.RGBA16F_NEAREST);_&&l.acquireColor(Ie,x.RGBA16F,"emissive"),l.acquireColor(_?Ce:Ie,x.R16F),a||l.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(l.fbo),this._rctx.clearFramebuffer([0,0,0,1]),_&&this._rctx.clearBuffer(1,I),n(),l.detachDepth(),h.oitPass=re.FrontFace;const p=this.fboCache.acquire(s.width,s.height,a?"oit hud front":"oit front");return _&&p.acquireColor(Ie,x.RGBA16F,"emissive"),a?p.acquireDepth(H):p.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(p.fbo),this._rctx.clearFramebuffer(w,!!a),n(),p.detachDepth(),h.oitPass=re.NONE,a?(this._rctx.bindFramebuffer(a.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(Se.COLOR)):this._framebuffer.bind(),this._oitblend??=new k(this._techniques),this._oitblend.blend(this._rctx,l,p,h,_),a?.detachDepth(),p.release(),l.release(),this._renderContext.output=o,a}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(Ae.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(this._pluginInput,_e.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),this.performanceInfo.advance(Ae.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(this._pluginInput,e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),i}_blitFBO(e,t=L,r=!0){return this._blit??=new B(this._techniques),this._blit.blit(this._rctx,e,t,this._bindParameters),this._pluginInput.set(e.name,t),r&&e.release(),t}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=P:(T(Ue,this._bindParameters.camera.viewMatrix),T(Fe,this._bindParameters.camera.projectionMatrix),E(ve,Ue,Fe),E(ve,this._renderContext.lastFrameCamera.viewMatrix,ve),E(ve,this._renderContext.lastFrameCamera.projectionMatrix,ve),this._reprojectionMatrix=ve);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=P,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,i){this._bindParameters.updateLighting(e,t,r,i),this._requestRender(X.UPDATE)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,i,s=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(i,s,a),e(),t.detachDepth()}get test(){}};var Oe;e([f({readOnly:!0})],we.prototype,"fullResolutionAtmosphere",null),e([f()],we.prototype,"_edgeView",void 0),e([f()],we.prototype,"updating",null),we=e([b("esri.views.3d.webgl-engine.lib.Renderer")],we),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(Oe||(Oe={}));const Ne=[_e.INTEGRATED_MESH,_e.OPAQUE_TERRAIN,_e.OPAQUE_MATERIAL,_e.TRANSPARENT_MATERIAL],De=[_e.OPAQUE_MATERIAL_WITHOUT_NORMALS,_e.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],ye=[_e.INTEGRATED_MESH,_e.OPAQUE_TERRAIN,_e.OPAQUE_MATERIAL,_e.OPAQUE_MATERIAL_WITHOUT_NORMALS],xe=[_e.TRANSPARENT_MATERIAL,_e.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],He=[_e.OPAQUE_MATERIAL,_e.TRANSPARENT_MATERIAL,_e.TRANSPARENT_MATERIAL_WITHOUT_DEPTH],Me=[_e.LINE_CALLOUTS_HUD_DEPTH,_e.HUD_MATERIAL,_e.LABEL_MATERIAL],Le=[_e.TRANSPARENT_MATERIAL,_e.TRANSPARENT_MATERIAL_WITHOUT_NORMALS,_e.OPAQUE_MATERIAL,_e.OPAQUE_MATERIAL_WITHOUT_NORMALS,_e.TRANSPARENT_TERRAIN,_e.INTEGRATED_MESH,_e.OPAQUE_TERRAIN],Fe=R(),Ue=R(),ve=R();function Ge(e){return t=>e.immediate.schedule(t)}export{we as Renderer};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as i}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{clamp as s,lerp as a}from"../../../../core/mathUtils.js";import{removeMaybe as n,abortMaybe as h,destroyMaybe as o,releaseMaybe as d}from"../../../../core/maybe.js";import{throwIfAborted as l}from"../../../../core/promiseUtils.js";import{watch as _,syncAndInitial as p,initial as u,sync as m}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{Milliseconds as g}from"../../../../core/time.js";import{property as f}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as b}from"../../../../core/accessorSupport/decorators/subclass.js";import{equals as A,invert as T,multiply as E}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as P,create as R}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as S}from"../../../../chunks/vec42.js";import{ZEROS as I}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{fromValues as C,ZEROS as w}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as D}from"../../../../geometry/support/Indices.js";import{RenderCategory as N,InternalRenderCategory as O}from"../../webgl.js";import{innerAtmosphereFadeStart as y}from"../../environment/atmosphereUtils.js";import{minNearDistanceInMeters as x}from"../../state/NearFarHeuristic.js";import{debugFlags as H}from"../../support/debugFlags.js";import{FBOCache as L,defaultWebGLFBO as M}from"../core/FBOCache.js";import{DepthTextureFormat as v,ColorFormat as F,DepthRenderbufferFormat as U}from"../core/FBOCacheFormats.js";import{RenderPassManager as G}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as q,isColorOrColorEmission as V}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as j}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{distanceFadeEnd as B}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as Q}from"../effects/RenderNodes.js";import{RenderPluginManager as W}from"../effects/RenderPluginManager.js";import{Blit as k}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as z,renderHighlightBuffer as Y}from"../effects/highlight/Highlight.js";import{OITBlend as X}from"../effects/transparency/OITBlend.js";import{AnimationTimer as K}from"./AnimationTimer.js";import{AnimationTimeStep as J}from"./AnimationTimeStep.js";import{RenderRequestType as Z}from"./basicInterfaces.js";import{BoundingInfo as $}from"./BoundingInfo.js";import{DepthRange as ee}from"./DepthRange.js";import{depthRangeFromScene as te,DepthRangeMode as re}from"./depthRangeUtils.js";import{hudFragmentOpacityParameters as ie}from"./hudFragmentOpacityParameters.js";import{MainFramebuffer as se}from"./MainFramebuffer.js";import{RenderOccludedFlag as ae}from"./Material.js";import{OITPass as ne}from"./OITPass.js";import{RenderContext as he,defaultRenderOccludedMask as oe}from"./RenderContext.js";import{RendererBase as de}from"./RendererBase.js";import{RendererTarget as le}from"./rendererUtils.js";import{setupFeatureDefaults as _e,RenderFeature as pe}from"./RenderFeature.js";import{RenderPluginInput as ue}from"./RenderPluginInput.js";import{RenderSlot as me}from"./RenderSlot.js";import{ShadowAccumulator as ce}from"./ShadowAccumulator.js";import{ShadowMap as ge,SnapshotSlot as fe}from"./ShadowMap.js";import be from"./SliceHelper.js";import{Transparency as Ae}from"./edgeRendering/interfaces.js";import{MergedRenderer as Te}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as Ee}from"../parts/renderUtils.js";import{RendererPerformanceInfo as Pe,PerformanceCategory as Re}from"../statistics/RendererPerformanceInfo.js";import{RenderState as Se}from"../../../support/RenderState.js";import{PixelFormat as Ie,PixelType as Ce,DepthStencilAttachment as we,FramebufferBit as De,ColorAttachment1 as Ne,ColorAttachment2 as Oe}from"../../../webgl/enums.js";let ye=class extends de{constructor(e,t,r,s,a,n){super({stage:e}),this._techniques=r,this._rctx=s,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this.renderPassManager=new G,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=C(0,0,0,1),this._sliceHelper=new be,this._blit=null,this._oitblend=null,this.sceneDepthRange=c(ee.infinite),this._state=c(Se.IDLE),this._highQualityTransparencyEnabled=!0,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new J,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._lastFrameTime=g(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new ue,this._releaseNormals=e=>{e.some((({name:e})=>"normals"===e))&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this.fboCache=new L(s),this._renderStateFeatures=c(_e(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._framebuffer=new se(this.fboCache),this.performanceInfo=new Pe(this._rctx),this._shadowMap=new ge(this.fboCache,e.viewingMode),this._shadowAccumulator=new ce(this.fboCache,r,e,(e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t}),((t,r,i)=>{const s=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,r,i,!0,s),this._renderShadowCascades(q.Shadow,t.shadowMap),t.shadowMap.finish(),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)}),n),this._renderContext=new he(this._rctx,this._shadowMap,r),this._nodes=new Q(this._renderContext),this._plugins=new W({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this._plugins.add(this.renderPassManager),this.addHandles([_((()=>e.view.state.camera),(()=>n()),p),_((()=>H.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(Ae.TRANSPARENT):()=>{},n()}),u),_((()=>e.view.environment.background?.color),(e=>{const t=e?i(e):w;S(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()}),p),_((()=>e.view.state.camera.relativeElevation),(e=>this._inGlobeView=(e??1/0)>=B),p),_((()=>this._bindParameters.clouds.fadeFactor),(()=>this._bindParameters.fadeLighting()),m),_((()=>this._bindParameters.clouds.data?.state),(()=>n()),m),_((()=>e.view.state.highlights),(e=>{this._bindParameters.highlights=e,n()}),u)])}destroy(){this._gpuTimerHandle=n(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.dispose(),this._loadEdgeViewTask=h(this._loadEdgeViewTask),this._edgeView=o(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),this._plugins.destroy(),this._blit=null,this._oitblend=null,$.prune(),Te.prune(),D()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _framebufferSize(){return this._framebuffer.size}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=_e(t,e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate((i=>i.set(t,e,r))),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(pe.HighQualityTransparency)}get hasReflections(){return this._pluginsHas.water&&(this._ssrEnabled||this.isFeatureEnabled(pe.WaterReflection))}get _hasHighlights(){return this._plugins.produces(q.Highlight,me.OPAQUE_MATERIAL,me.TRANSPARENT_MATERIAL,me.DRAPED_MATERIAL,me.HUD_MATERIAL,me.LABEL_MATERIAL)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(q.Highlight,me.HUD_MATERIAL,me.LABEL_MATERIAL)}get hasSSAO(){return(this.stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(pe.SSAO))&&!this._inGlobeView}get hasSMAA(){return this.stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(pe.Antialiasing)}get fullResolutionAtmosphere(){return this.stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(pe.HighResolutionAtmosphere)}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=d(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=d(this._bindParameters.depth),this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility)}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.running||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r((async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");l(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:Be(this.stage.view.resourceController)});return this.addHandles(_((()=>r.updating),(()=>this._requestRender()),m)),this._requestRender(),this._edgeViewCallbacks.forEach((e=>e(r))),this._edgeViewCallbacks.length=0,r}))),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&A(this._bindParameters.ssr.reprojectionMatrix,P)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){null!=e.environment.weather&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}set slicePlane(e){this._sliceHelper.plane!==e&&(this._sliceHelper.plane=e,this._requestRender())}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(q.Color,...Ue),has.water=this._plugins.produces(q.Normal,me.DRAPED_WATER),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new K(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?n(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r=le.Default,i=!1){try{return this._isRendering=!0,this._render(e,t,r,i)}catch(s){console.error(`Exception during rendering: ${s}`)}finally{this._isRendering=!1}return new Ee(this._pluginInput.get(N.FINAL),null)}_updateHUDOccludedFragmentOpacity(e,t){const{idleOpacity:r,navigatingOpacity:i,maxDelta:n,tiltFadeStart:h,tiltFadeEnd:o,altitudeStart:d,altitudeEnd:l}=ie,_=this.stage.view,p=_.stateManager.camera,u=_.qualitySettings.fadeDuration,m=e===Se.IDLE?r:i,c=s((p.tilt-h)/(o-h),0,1),g=s(((p.position.z??0)-d)/(l-d),0,1),f=a(a(1,m,c),1,g),b=this._bindParameters.hudOccludedFragmentOpacity;if(u<=0||b===f||0===this._lastFrameTime||this._lastFrameTime>t)return this._bindParameters.hudOccludedFragmentOpacity=f,void(this._lastFrameTime=t);const A=t-this._lastFrameTime;this._lastFrameTime=t;const T=Math.max(1-r,Math.abs(r-i)),E=Math.min(T*A/u,n);E>=Math.abs(f-b)?this._bindParameters.hudOccludedFragmentOpacity=f:(this._bindParameters.hudOccludedFragmentOpacity=b+Math.sign(f-b)*E,this._requestRender())}_render(e,t,r=le.Default,i){this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r===le.Default,this._disposeBindBuffers();const{camera:s,contentCamera:a,mode:n,alignPixelEnabled:h}=e;this._state.value=n;const o=this._nodes.produces("magnifier-color"),l=this._nodes.produces(N.FINAL),_=this._nodes.require("emissive",O.TRANSPARENT_ENVIRONMENT,N.COMPOSITE,N.FINAL)>0&&this._plugins.hasEmissions,p=_?q.ColorEmission:q.Color;this._renderContext.time=t,this._renderContext.output=p,this._bindParameters.oitPass=ne.NONE,this._bindParameters.alignPixelEnabled=h,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null,this._bindParameters.slicePlane=this._sliceHelper.plane,this._bindParameters.viewshedEnabled=this._nodes.produces(O.VIEWSHED),this._renderOverlay(t),s.setGLViewport(this._rctx);const u=this._framebuffer,m=u.initialize(s.fullWidth,s.fullHeight,this._backgroundColor,_);this.hasReflections?(m?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=m):m?.release(),this._ensureBindParametersCamera(s,a),this._updateHUDOccludedFragmentOpacity(n,t),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!i;const c=this._highQualityTransparency&&this._hasTransparentTerrain,g=this._plugins.produces(q.Color,...ve);this._precompilePrepasses(),this.performanceInfo.advance(Re.PREPARE);const f=this._computeShadowDepthRange(s);this._renderShadowMap(s,this._bindParameters.lighting.mainLight.direction,f),this._ensureBindParametersCamera(s,a),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(f,s,a),this._ensureBindParametersSSR(t),this._precompileShaders(c,g,p),this._renderContext.output=p,u.bind(),this._bindParameters.mainDepth=u.depth.attachment;const b=this.plugins.produces(q.Color,...Me);b&&this._renderOpaqueGeometry(),u.update((e=>this._renderNodes(N.OPAQUE,e,b))),this.fboCache.debugCallback?.(N.OPAQUE,u.color.fbo),u.update((e=>this._renderNodes(O.OPAQUE_ENVIRONMENT,e))),this.fboCache.debugCallback?.(O.OPAQUE_ENVIRONMENT,u.color.fbo),this._renderTerrainDepth(c),this._renderEdges(Ae.OPAQUE),u.bind(),this._renderPlugins(me.VOXEL,Re.VOXEL),this._renderHiddenTransparentEdges(),g&&(this._oitEnabled?this._renderOIT(xe.Geometry,p):this._renderTransparentGeometry()),u.update((e=>this._renderNodes(N.TRANSPARENT,e,g))),this.fboCache.debugCallback?.(N.TRANSPARENT,u.color.fbo),this._renderGeometryDepth(c),this._renderHUDVisibility(),c||this._plugins.render(this._pluginInput,me.LINE_CALLOUTS),this._renderEdges(Ae.TRANSPARENT);const A=this._hasTransparentTerrain?this._renderTransparentTerrain():null;A&&(this.performanceInfo.advance(Re.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(c?this._renderLineCallouts(j.Occluded):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,A.getTexture())),this._renderHUD(j.Occluded,u.color,p))),this._bindParameters.cullAboveTerrain=!1,A&&(u.bind(),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,A.getTexture()),A.release(),c&&(this._renderEdges(Ae.OPAQUE),g&&(this._oitEnabled?this._renderOIT(xe.Geometry,p):this._renderTransparentGeometry(),this.performanceInfo.advance(Re.TRANSPARENT)),this._renderEdges(Ae.TRANSPARENT))),this._bindParameters.ssao=d(this._bindParameters.ssao),c&&this._renderLineCallouts(j.NotOccluded),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment(),this._pluginInput.set(O.FOCUSAREA,this._renderFocusAreaGeometry()),u.update((e=>this._renderNodes(O.TRANSPARENT_ENVIRONMENT,e))),u.update((e=>this._renderNodes(O.VIEWSHED,e))),u.update((e=>this._renderNodes(O.LASERLINES,e))),u.update((e=>this._renderNodes(O.FOCUSAREA_COLOR,e))),u.update((e=>this._renderNodes(O.OCCLUDED,e))),this._pluginInput.set("highlights",this._renderHighlightPrepass());const T=r===le.ObjectAndLayerID?this._renderObjectAndLayerIdColor():null;u.update((e=>this._renderNodes(N.COMPOSITE,e))),this._pluginInput.release(O.FOCUSAREA);const E=!(r!==le.Default||l||o&&!i),P=this._pluginInput.get(N.COMPOSITE),R=E?M:this.fboCache.acquire(P.fbo.width,P.fbo.height,O.ANTIALIASING),S=this._nodes.produces(O.ANTIALIASING)?this._renderNodes(O.ANTIALIASING,R):this._blitFBO(P,R,!1);let I;this._pluginInput.set(O.ANTIALIASING,S),this._hasHUDHighlights?(this._renderHUD(j.NotOccluded,S,p),I=this._renderNodes(O.HIGHLIGHTS,S)):(I=this._renderNodes(O.HIGHLIGHTS,S),this._renderHUD(j.NotOccluded,I,p));const C=this._renderNodes(O.MAGNIFIER,I);return o&&!i&&r===le.Default&&!l&&this._blitFBO(C),l?(C.attachDepth(u.depth),this._blitFBO(this._renderNodes(N.FINAL,C)),C.detachDepth()):this._pluginInput.set(N.FINAL,C),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),u.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),r!==le.Default&&(this._releaseFBOs(),this._disposeOffscreenBuffers()),new Ee(this._pluginInput.get(N.FINAL),T)}_precompileShaders(e,t,r){++this._plugins.context.techniques.precompiling,this._renderContext.output=r,this._precompileOpaqueGeometry(),this._nodes.precompile(O.OPAQUE_ENVIRONMENT),this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,this._renderContext.output=q.Depth,this._plugins.precompile(me.TRANSPARENT_TERRAIN),e&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=r,this._plugins.precompile(me.TRANSPARENT_TERRAIN),t&&(this._precompileTransparentGeometry(),this._hasTransparentTerrain&&(this._bindParameters.cullAboveTerrain=!1,this._precompileTransparentGeometry(),this._bindParameters.cullAboveTerrain=e)),this._nodes.precompile(O.FOCUSAREA),this._needsHUDVisibility&&this._plugins.precompile(me.OCCLUSION_PIXELS),this._plugins.precompile(me.LINE_CALLOUTS),this._precompileHUD(j.Occluded),this._bindParameters.terrainDepthTest=!1,this._bindParameters.cullAboveTerrain=!1,this._nodes.precompile(O.VIEWSHED,O.LASERLINES,O.FOCUSAREA_COLOR,O.OCCLUDED,O.ANTIALIASING,O.HIGHLIGHTS);const i=this._bindParameters;i.highlightMixTexture=i.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(j.NotOccluded),this._hasHighlights&&(i.highlights.forEach(((e,t)=>{i.highlightLevel=t,this._precompileAllGeometry(q.Highlight)})),i.highlightLevel=null),i.highlightMixTexture=null,this._nodes.precompile(N.COMPOSITE,O.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(me.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){if(!this._nodes.produces(O.FOCUSAREA))return null;const{width:e,height:t}=this._framebufferSize;let r=this.fboCache.acquire(e,t,O.FOCUSAREA);return r=this._nodes.render(r,this._pluginInput),this.performanceInfo.advance(Re.FOCUS_AREA_MASK),r}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._renderContext.output;++this._techniques.precompiling;const t=this._framebufferSize;let r=this.fboCache.acquire(t.width,t.height,"olid");return r.acquireDepth(v.DEPTH24_STENCIL8),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(Re.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=e===Z.BACKGROUND;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const s=Math.max(e,i);this._animationTimestep.frame(s,r)}}readMainDepth(e,t){const{mainDepth:r,camera:i}=this._bindParameters;if(!r)return;const s=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear-depth");this._rctx.bindFramebuffer(s.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(w),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),s.fbo?.readPixels(e[0],e[1],e[2],e[3],Ie.RGBA,Ce.UNSIGNED_BYTE,t),s.release()}readHUDVisibility(e,t,r,i,s){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,i,Ie.RGBA,Ce.UNSIGNED_BYTE,s)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"edges"),s=()=>t.render(this._bindParameters,e),a=this._bindParameters.geometryDepth;this.renderToTargets(s,i,a??this._framebuffer.depth,w),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(e===Ae.OPAQUE?Re.OPAQUE_EDGES:Re.TRANSPARENT_EDGES)}_renderOverlay(e){this._bindParameters.overlay=this.overlay?.render(e),this._bindParameters.overlay&&this.performanceInfo.advance(Re.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const i=this._shadowMap;i.start(e,t,r,this.isFeatureEnabled(pe.HighResolutionShadows),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(q.ShadowHighlight,this._shadowMap),i.moveSnapshot(fe.Highlight),this._renderShadowCascades(q.ShadowExcludeHighlight,this._shadowMap),i.copySnapshot(fe.ExcludeHighlight),this._renderShadowCascades(q.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(q.Shadow),i.finish(),e.setGLViewport(this._rctx),this.performanceInfo.advance(Re.SHADOW_MAP)}_precompileShadowCascades(e){for(const t of this._shadowMap.cascades)t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.camera),this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(q.Depth)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._needsShadowAccumulation||this._debugNeedsDepth}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");if(e){const t=this._needsDepth?e.getAttachment(we):null;t?.retain(),this._pluginInput.set(O.SSAO,this._renderSSAO()),this._renderGeometryWithoutNormalsDepth(t)}else this._renderAllGeometryDepth()}_renderGeometryWithoutNormalsDepth(e){if(!this._needsDepth||!e)return void(this._bindParameters.depth=d(this._bindParameters.depth));const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"depth");r.attachDepth(e),e.release(),this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(De.STENCIL),this._renderGeometryWithoutNormals(q.Depth),d(this._bindParameters.depth),this._bindParameters.depth=r.obtainDepthTexture(),r.release(),this.performanceInfo.advance(Re.DEPTH)}_renderAllGeometryDepth(){if(!this._needsDepth)return void(this._bindParameters.depth=d(this._bindParameters.depth));const e=this._framebufferSize,t=this.fboCache.acquire(e.width,e.height,"depth",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(De.DEPTH|De.STENCIL),this.renderAllGeometry(q.Depth),d(this._bindParameters.depth),this._bindParameters.depth=t.obtainDepthTexture(),t.release(),this.performanceInfo.advance(Re.DEPTH)}_renderTerrainDepth(e){if(this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,!e)return void(this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth));const t=this._renderContext.output;this._renderContext.output=q.Depth;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"terrain depth",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(De.DEPTH|De.STENCIL),this._renderTransparentTerrain(),d(this._bindParameters.terrainDepth),this._bindParameters.terrainDepth=i.obtainDepthTexture(),this._renderContext.output=t,i.release()}_renderGeometryDepth(e){if(!e)return void(this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth));const t=this._renderContext.output,{width:r,height:i}=this._framebufferSize,s=this.fboCache.acquire(r,i,"geometry depth",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(De.DEPTH|De.STENCIL),this._renderOpaqueAndTransparentGeometry(q.Depth),this._renderContext.output=t,d(this._bindParameters.geometryDepth),this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsShadowDepthRange(){return this._shadowMap.enabled||this._needsShadowAccumulation}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return ee.zero;const t=te(e,this._plugins.plugins,this.stage.layers,re.SHADOW_CASTERS);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=ee.infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<y)return void(this.sceneDepthRange.value=ee.infinite);const t=e.clone();t.near=x,t.far=1e10;const r=te(t,this._plugins.plugins,this.stage.layers,re.FULL_SCENE);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.far===r.far&&this.sceneDepthRange.value.near===r.near||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",N.FINAL,N.COMPOSITE,N.OPAQUE,N.TRANSPARENT,O.VIEWSHED,O.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(q.Normal),this._needsDepth&&this._precompileAllGeometry(q.Depth),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(q.ShadowHighlight),this._precompileShadowCascades(q.ShadowExcludeHighlight),this._precompileShadowCascades(q.ShadowHighlight)):this._precompileShadowCascades(q.Shadow)),this._needsShadowAccumulation&&this._precompileAllGeometry(q.Shadow)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"normals",F.RGBA8UNORM);r.acquireDepth(v.DEPTH24_STENCIL8),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(w,!0,!0),this._renderGeometryWithNormals(q.Normal);const i=this._nodes.optional("normals",N.FINAL,N.COMPOSITE,N.OPAQUE,N.TRANSPARENT,O.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(Re.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return void e?.detachDepth();M.setName(O.SSAO);const t=this._nodes.render(M,this._pluginInput);return this._bindParameters.ssao=t,e.detachDepth(),this._pluginInput.release("normals"),this.performanceInfo.advance(Re.SSAO),t}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(me.TRANSPARENT_TERRAIN),this._renderContext.output=t}renderAllGeometry(e){this._renderContext.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentTerrain()}precompileSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const r of t)this._renderContext.renderOccludedMask=r,this.precompileSlots(e,...Fe);this._renderContext.renderOccludedMask=oe}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.forAll((e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t,this._pluginInput)}))}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>ae.Occlude&&this._plugins.render(this._pluginInput,me.OCCLUDED_TERRAIN),this.renderSlots(e,...Fe),this._renderContext.renderOccludedMask=oe}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(this._pluginInput,me.HUD_MATERIAL)}precompileViewshedShadowMap(){this._precompileAllGeometry(q.ViewshedShadow)}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(q.ViewshedShadow),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._renderContext.output=i}_renderOpaqueAndTransparentGeometry(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithNormals(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,...He),this._renderTransparentTerrain()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,...Le)}_precompileOpaqueGeometry(){this._plugins.precompile(...Me)}_renderOpaqueGeometry(){this._plugins.render(this._pluginInput,...Me)}_renderTransparentGeometry(){this._plugins.render(this._pluginInput,...ve)}get _hasTransparentTerrain(){return this._plugins.produces(q.Color,me.TRANSPARENT_TERRAIN)}_renderTransparentTerrain(){const e=()=>this._plugins.render(this._pluginInput,me.TRANSPARENT_TERRAIN);if(!V(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent terrain");return this.renderToTargets(e,r,this._framebuffer.depth,w),r}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,me.OCCLUSION_PIXELS)}_renderHUDVisibility(){if(!this._needsHUDVisibility)return void(this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility));const{width:e,height:t}=this._framebufferSize;let r=this._bindParameters.hudVisibility;r?.fbo?.width===e&&r?.fbo?.height===t||(r?.release(),r=this.fboCache.acquire(e,t,"hud visibility",F.RGBA4UNORM),this._bindParameters.hudVisibility=r);const i=this._bindParameters.geometryDepth;r.attachDepth(i||this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(this._pluginInput,me.OCCLUSION_PIXELS),r.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(Re.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===j.Occluded){const e=()=>this._plugins.render(this._pluginInput,me.LINE_CALLOUTS),t=this._framebufferSize,r=this.fboCache.acquireDepth(U.DEPTH16,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(this._pluginInput,me.LINE_CALLOUTS)}_precompileHUD(e){if(this._precompileHUDOutput(e),this._hasHighlights){const t=this._renderContext.output;this._renderContext.output=q.Highlight,this._precompileHUDOutput(e),this._renderContext.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this._oitEnabled&&V(this._renderContext.output)?(this._bindParameters.oitPass=ne.ColorAlpha,this._plugins.precompile(...Ue),this._bindParameters.oitPass=ne.FrontFace,this._plugins.precompile(...Ue),this._bindParameters.oitPass=ne.NONE):this._plugins.precompile(...Ue),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t,r){if(this._pluginsHas.hudElements){if(this._oitEnabled){const i=this._renderOIT(xe.HUD,r,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,i.getTexture()),i.release()}else if(this._renderContext.output=r,e===j.Occluded){const t=()=>this._renderHUDElements(e),r=this._framebufferSize,i=this.fboCache.acquireDepth(U.DEPTH16,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(U.DEPTH16),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(e===j.Occluded?Re.HUD_OCCLUDED:Re.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(this._pluginInput,...Ue)}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(q.ShadowHighlight,me.OPAQUE_MATERIAL)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,i=this._framebufferSize,{highlights:s}=r,a=e.acquire(i.width,i.height,"highlights",s.length>z?F.RG8UINT:F.R8UINT);a.acquireDepth(v.DEPTH24_STENCIL8),t.bindFramebuffer(a.fbo);const{gl:n}=t;return n.clearBufferuiv(n.COLOR,0,[0,0,0,0]),this._renderContext.output=q.Highlight,t.bindFramebuffer(a.fbo),Y(t,e,i,r,(()=>this._renderHighlightGeometries())),this.performanceInfo.advance(Re.HIGHLIGHTS),a}_renderHighlightGeometries(){this._plugins.render(this._pluginInput,...Ge),this._rctx.clear(De.DEPTH),this._renderHUDElements(j.Both)}get _needsShadowAccumulation(){return this._shadowAccumulator.accumulating}_renderShadowAccumulation(e,t,r){this._needsShadowAccumulation&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,e,t,r)&&this.performanceInfo.advance(Re.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this._oitEnabled&&V(this._renderContext.output)?(this._bindParameters.oitPass=ne.ColorAlpha,this._plugins.precompile(...ve),this._bindParameters.oitPass=ne.FrontFace,this._plugins.precompile(...ve),this._bindParameters.oitPass=ne.NONE):this._plugins.precompile(...ve)}_renderOIT(e,t,r=j.Both){const i=e===xe.HUD,s=this._framebufferSize,a=i?this.fboCache.acquire(s.width,s.height,"oit hud composite"):null,n=i?()=>this._renderHUDElements(r):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=this._renderContext.output;this._renderContext.output=t,h.oitPass=ne.ColorAlpha;const d=a?"oit hud color+alpha":"oit color+alpha",l=this.fboCache.acquire(s.width,s.height,d,F.RGBA16FLOAT),_=t===q.ColorEmission;_&&l.acquireColor(Ne,F.RGBA16FLOAT,"emissive"),l.acquireColor(_?Oe:Ne,F.R16FLOAT),a||l.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(l.fbo),this._rctx.clearFramebuffer([0,0,0,1]),_&&this._rctx.clearBuffer(1,I),n(),l.detachDepth(),h.oitPass=ne.FrontFace;const p=this.fboCache.acquire(s.width,s.height,a?"oit hud front":"oit front");return _&&p.acquireColor(Ne,F.RGBA16FLOAT,"emissive"),a?p.acquireDepth(U.DEPTH16):p.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(p.fbo),this._rctx.clearFramebuffer(w,!!a),n(),p.detachDepth(),h.oitPass=ne.NONE,a?(this._rctx.bindFramebuffer(a.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(De.COLOR)):this._framebuffer.bind(),this._oitblend??=new X(this._techniques),this._oitblend.blend(this._rctx,l,p,h,_),a?.detachDepth(),p.release(),l.release(),this._renderContext.output=o,a}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(Re.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(this._pluginInput,me.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),this.performanceInfo.advance(Re.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(this._pluginInput,e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),i}_blitFBO(e,t=M,r=!0){return this._blit??=new k(this._techniques),this._blit.blit(this._rctx,e,t,this._bindParameters),this._pluginInput.set(e.name,t),r&&e.release(),t}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=P:(T(Ve,this._bindParameters.camera.viewMatrix),T(qe,this._bindParameters.camera.projectionMatrix),E(je,Ve,qe),E(je,this._renderContext.lastFrameCamera.viewMatrix,je),E(je,this._renderContext.lastFrameCamera.projectionMatrix,je),this._reprojectionMatrix=je);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=P,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,i){this._bindParameters.updateLighting(e,t,r,i),this._requestRender(Z.UPDATE)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,i,s=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(i,s,a),e(),t.detachDepth()}get test(){}};var xe;e([f({readOnly:!0})],ye.prototype,"fullResolutionAtmosphere",null),e([f()],ye.prototype,"_edgeView",void 0),e([f()],ye.prototype,"updating",null),ye=e([b("esri.views.3d.webgl-engine.lib.Renderer")],ye),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(xe||(xe={}));const He=[me.INTEGRATED_MESH,me.OPAQUE_TERRAIN,me.OPAQUE_MATERIAL,me.TRANSPARENT_MATERIAL],Le=[me.OPAQUE_MATERIAL_WITHOUT_NORMALS,me.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],Me=[me.INTEGRATED_MESH,me.OPAQUE_TERRAIN,me.OPAQUE_MATERIAL,me.OPAQUE_MATERIAL_WITHOUT_NORMALS],ve=[me.TRANSPARENT_MATERIAL,me.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],Fe=[me.OPAQUE_MATERIAL,me.TRANSPARENT_MATERIAL,me.TRANSPARENT_MATERIAL_WITHOUT_DEPTH],Ue=[me.LINE_CALLOUTS_HUD_DEPTH,me.HUD_MATERIAL,me.LABEL_MATERIAL],Ge=[me.TRANSPARENT_MATERIAL,me.TRANSPARENT_MATERIAL_WITHOUT_NORMALS,me.OPAQUE_MATERIAL,me.OPAQUE_MATERIAL_WITHOUT_NORMALS,me.TRANSPARENT_TERRAIN,me.INTEGRATED_MESH,me.OPAQUE_TERRAIN],qe=R(),Ve=R(),je=R();function Be(e){return t=>e.immediate.schedule(t)}export{ye 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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../../../core/has.js";import{clamp as t,lerp as s,acosClamped as e}from"../../../../core/mathUtils.js";import{releaseMaybe as i}from"../../../../core/maybe.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{translate as r,multiply as h,invert as o,lookAt as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as c,create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as d,add as m,scale as u,lerp as _,squaredDistance as f,subtract as g,dot as p,negate as x,normalize as b,copy as w}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as M}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{p as C,c as j,v as T,t as y,i as
|
|
5
|
+
import has from"../../../../core/has.js";import{clamp as t,lerp as s,acosClamped as e}from"../../../../core/mathUtils.js";import{releaseMaybe as i}from"../../../../core/maybe.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{translate as r,multiply as h,invert as o,lookAt as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as c,create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as d,add as m,scale as u,lerp as _,squaredDistance as f,subtract as g,dot as p,negate as x,normalize as b,copy as w}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as M}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{p as C,c as j,v as T,t as y,i as D}from"../../../../chunks/vec32.js";import{create as H}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as v,t as S}from"../../../../chunks/vec42.js";import{create as O}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ViewingMode as R}from"../../../ViewingMode.js";import{ColorFormat as E,DepthRenderbufferFormat as U}from"../core/FBOCacheFormats.js";import{CascadeCamera as F}from"./CascadeCamera.js";import{applyTextureResizeModulo as L}from"./textureUtils.js";import{assert as N,logWithBase as Q,verify as V,rayRay2D as A}from"./Util.js";import{TextureType as B,FramebufferBit as I}from"../../../webgl/enums.js";import{Texture as W}from"../../../webgl/Texture.js";var z;!function(t){t[t.Highlight=0]="Highlight",t[t.ExcludeHighlight=1]="ExcludeHighlight"}(z||(z={}));class P{constructor(){this.camera=new F,this.lightMat=l()}}class q{constructor(){this.maxNumCascadesHighQuality=4,this.maxNumCascadesLowQuality=4,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.splitSchemeLambda=0}}class G{constructor(t,s){this._fbos=t,this._viewingMode=s,this._enabled=!1,this._snapshots=new Array,this._textureHeight=0,this._numCascades=1,this.settings=new q,this._projectionView=l(),this._projectionViewInverse=l(),this._modelViewLight=l(),this._cascadeDistances=[0,0,0,0,0],this._usedCascadeDistances=O(),this._cascades=[new P,new P,new P,new P],this._lastOrigin=null,this._maxTextureWidth=Math.min(has("esri-mobile")?4096:16384,t.rctx.parameters.maxTextureSize)}dispose(){this.enabled=!1,this.disposeOffscreenBuffers()}get depthTexture(){return this._handle?.getTexture()}get _textureWidth(){return this._textureHeight*this._numCascades}get numCascades(){return this._numCascades}get cascadeDistances(){return v(this._usedCascadeDistances,this._cascadeDistances[0],this._numCascades>1?this._cascadeDistances[1]:1/0,this._numCascades>2?this._cascadeDistances[2]:1/0,this._numCascades>3?this._cascadeDistances[3]:1/0)}disposeOffscreenBuffers(){this._handle=i(this._handle),this._discardSnapshots()}set maxCascades(s){this.settings.maxNumCascadesHighQuality=t(Math.floor(s),1,4)}get maxCascades(){return this.settings.maxNumCascadesHighQuality}set enabled(t){this._enabled=t,t||this.disposeOffscreenBuffers()}get enabled(){return this._enabled}get ready(){return this._enabled&&null!=this.depthTexture}get cascades(){for(let t=0;t<this._numCascades;++t)et[t]=this._cascades[t];return et.length=this._numCascades,et}start(t,s,e,i,a){N(this.enabled);const{near:r,far:h}=jt(e);this._computeCascadeDistances(r,h,i),this._textureHeight=this._computeTextureHeight(t,a,i),this._setupMatrices(t,s);const{viewMatrix:o,projectionMatrix:n}=t;for(let c=0;c<this._numCascades;++c)this._constructCascade(c,n,o,s);this._lastOrigin=null,this.clear()}finish(){N(this.enabled),this._handle?.detachDepth()}getShadowMapMatrices(t){if(!this._lastOrigin||!C(t,this._lastOrigin)){this._lastOrigin=this._lastOrigin||H(),j(this._lastOrigin,t);for(let s=0;s<this._numCascades;++s){r(it,this._cascades[s].lightMat,t);for(let t=0;t<16;++t)at[16*s+t]=it[t]}}return at}moveSnapshot(t){N(this.enabled),this._handle?.detachDepth(),this._snapshots[t]?.release(),this._snapshots[t]=this._handle,this._handle=null,this.clear()}copySnapshot(t){const s=this._handle?.getTexture()?.descriptor;if(!this.enabled||!s)return;this._snapshots[t]?.release();const{width:e,height:i}=s,a=t===z.Highlight?"shadow highlight snapshot":"shadow no highlight snapshot";this._snapshots[t]=this._fbos.acquire(e,i,a,E.RGBA4UNORM);const r=this._fbos.rctx;this._bindFbo();const h=r.bindTexture(this._snapshots[t]?.getTexture(),W.TEXTURE_UNIT_FOR_UPDATES);r.gl.copyTexSubImage2D(B.TEXTURE_2D,0,0,0,0,0,e,i),r.bindTexture(h,W.TEXTURE_UNIT_FOR_UPDATES)}getSnapshot(t){return this.enabled?this._snapshots[t]?.getTexture():null}clear(){const t=this._fbos.rctx;this._ensureFbo(),this._bindFbo(),t.setClearColor(1,1,1,1),t.clear(I.COLOR|I.DEPTH)}_computeTextureHeight({pixelRatio:t,fullWidth:s,fullHeight:e},i,a){const r=Math.min(window.devicePixelRatio,i)/t,h=a?this.settings.textureSizeModHighQuality:this.settings.textureSizeModLowQuality;return L(Math.max(s,e)*r*h,this._maxTextureWidth/this._numCascades)}_ensureFbo(){this._handle?.fbo?.width===this._textureWidth&&this._handle?.fbo.height===this._textureHeight||(this._handle?.release(),this._handle=this._fbos.acquire(this._textureWidth,this._textureHeight,"shadow map",E.RGBA4UNORM)),this._handle?.acquireDepth(U.DEPTH16)}_discardSnapshot(t){this._snapshots[t]=i(this._snapshots[t])}_discardSnapshots(){for(let t=0;t<this._snapshots.length;++t)this._discardSnapshot(t);this._snapshots.length=0}_bindFbo(){this._fbos.rctx.bindFramebuffer(this._handle?.fbo)}_constructCascade(t,s,e,i){const a=this._cascades[t],o=-this._cascadeDistances[t],n=-this._cascadeDistances[t+1],c=(s[10]*o+s[14])/Math.abs(s[11]*o+s[15]),l=(s[10]*n+s[14])/Math.abs(s[11]*n+s[15]);N(c<l);for(let r=0;r<8;++r){v(k,r%4==0||r%4==3?-1:1,r%4==0||r%4==1?-1:1,r<4?c:l,1);const t=J[r];S(t,k,this._projectionViewInverse),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3]}T(st,J[0]),a.camera.viewMatrix=r(X,this._modelViewLight,st);for(let r=0;r<8;++r)y(J[r],J[r],a.camera.viewMatrix);let d=J[0][2],m=J[0][2];for(let r=1;r<8;++r)d=Math.min(d,J[r][2]),m=Math.max(m,J[r][2]);d-=200,m+=200,a.camera.near=-m,a.camera.far=-d,Ct(e,i,d,m,a.camera),h(a.lightMat,a.camera.projectionMatrix,a.camera.viewMatrix);const u=this._textureHeight;a.camera.viewport=[t*u,0,u,u]}_setupMatrices(t,s){h(this._projectionView,t.projectionMatrix,t.viewMatrix),o(this._projectionViewInverse,this._projectionView);const e=this._viewingMode===R.Global?t.eye:D(st,0,0,1);n(this._modelViewLight,[0,0,0],[-s[0],-s[1],-s[2]],e)}_computeCascadeDistances(t,e,i){const a=i?this.settings.maxNumCascadesHighQuality:this.settings.maxNumCascadesLowQuality;this._numCascades=Math.min(1+Math.floor(Q(e/t,4)),a);const r=(e-t)/this._numCascades,h=(e/t)**(1/this._numCascades);let o=t,n=t;for(let c=0;c<this._numCascades+1;++c)this._cascadeDistances[c]=s(o,n,this.settings.splitSchemeLambda),o*=h,n+=r}get test(){}}const X=l(),k=O(),J=[];for(let Tt=0;Tt<8;++Tt)J.push(O());const K=M(),Y=M(),Z=M(),$=M(),tt=M(),st=H(),et=[],it=l(),at=c.concat(c,c,c,c),rt=M(),ht=M(),ot=[M(),M(),M(),M()],nt=M(),ct=M(),lt=M(),dt=M(),mt=M(),ut=M(),_t=M();function ft(t,s,e,i,a,r,h,o){d(rt,0,0);for(let d=0;d<4;++d)m(rt,rt,t[d]);u(rt,rt,.25),d(ht,0,0);for(let d=4;d<8;++d)m(ht,ht,t[d]);u(ht,ht,.25),_(ot[0],t[4],t[5],.5),_(ot[1],t[5],t[6],.5),_(ot[2],t[6],t[7],.5),_(ot[3],t[7],t[4],.5);let n=0,c=f(ot[0],rt);for(let d=1;d<4;++d){const t=f(ot[d],rt);t<c&&(c=t,n=d)}g(nt,ot[n],t[n+4]);const l=nt[0];let M,C;nt[0]=-nt[1],nt[1]=l,g(ct,ht,rt),p(ct,nt)<0&&x(nt,nt),_(nt,nt,ct,e),b(nt,nt),M=C=p(g(lt,t[0],rt),nt);for(let d=1;d<8;++d){const s=p(g(lt,t[d],rt),nt);s<M?M=s:s>C&&(C=s)}w(i,rt),u(lt,nt,M-s),m(i,i,lt);let j=-1,T=1,y=0,D=0;for(let d=0;d<8;++d){g(dt,t[d],i),b(dt,dt);const s=nt[0]*dt[1]-nt[1]*dt[0];s>0?s>j&&(j=s,y=d):s<T&&(T=s,D=d)}V(j>0,"leftArea"),V(T<0,"rightArea"),u(mt,nt,M),m(mt,mt,rt),u(ut,nt,C),m(ut,ut,rt),_t[0]=-nt[1],_t[1]=nt[0];const H=A(i,t[D],ut,m(lt,ut,_t),1,a),v=A(i,t[y],ut,lt,1,r),S=A(i,t[y],mt,m(lt,mt,_t),1,h),O=A(i,t[D],mt,lt,1,o);V(H,"rayRay"),V(v,"rayRay"),V(S,"rayRay"),V(O,"rayRay")}function gt(t,s){return 3*s+t}const pt=M();function xt(t,s){return d(pt,t[s],t[s+3]),pt}const bt=M(),wt=a();function Mt(t,s,e,i,a){g(bt,e,i),u(bt,bt,.5),wt[0]=bt[0],wt[1]=bt[1],wt[2]=0,wt[3]=bt[1],wt[4]=-bt[0],wt[5]=0,wt[6]=bt[0]*bt[0]+bt[1]*bt[1],wt[7]=bt[0]*bt[1]-bt[1]*bt[0],wt[8]=1,wt[gt(0,2)]=-p(xt(wt,0),t),wt[gt(1,2)]=-p(xt(wt,1),t);let r=p(xt(wt,0),e)+wt[gt(0,2)],h=p(xt(wt,1),e)+wt[gt(1,2)],o=p(xt(wt,0),i)+wt[gt(0,2)],n=p(xt(wt,1),i)+wt[gt(1,2)];r=-(r+o)/(h+n),wt[gt(0,0)]+=wt[gt(1,0)]*r,wt[gt(0,1)]+=wt[gt(1,1)]*r,wt[gt(0,2)]+=wt[gt(1,2)]*r,r=1/(p(xt(wt,0),e)+wt[gt(0,2)]),h=1/(p(xt(wt,1),e)+wt[gt(1,2)]),wt[gt(0,0)]*=r,wt[gt(0,1)]*=r,wt[gt(0,2)]*=r,wt[gt(1,0)]*=h,wt[gt(1,1)]*=h,wt[gt(1,2)]*=h,wt[gt(2,0)]=wt[gt(1,0)],wt[gt(2,1)]=wt[gt(1,1)],wt[gt(2,2)]=wt[gt(1,2)],wt[gt(1,2)]+=1,r=p(xt(wt,1),s)+wt[gt(1,2)],h=p(xt(wt,2),s)+wt[gt(2,2)],o=p(xt(wt,1),e)+wt[gt(1,2)],n=p(xt(wt,2),e)+wt[gt(2,2)],r=-.5*(r/h+o/n),wt[gt(1,0)]+=wt[gt(2,0)]*r,wt[gt(1,1)]+=wt[gt(2,1)]*r,wt[gt(1,2)]+=wt[gt(2,2)]*r,r=p(xt(wt,1),s)+wt[gt(1,2)],h=p(xt(wt,2),s)+wt[gt(2,2)],o=-h/r,wt[gt(1,0)]*=o,wt[gt(1,1)]*=o,wt[gt(1,2)]*=o,a[0]=wt[0],a[1]=wt[1],a[2]=0,a[3]=wt[2],a[4]=wt[3],a[5]=wt[4],a[6]=0,a[7]=wt[5],a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=wt[6],a[13]=wt[7],a[14]=0,a[15]=wt[8]}function Ct(t,s,i,a,r){const h=1/J[0][3],o=1/J[4][3];N(h<o);let n=h+Math.sqrt(h*o);const c=Math.sin(e(t[2]*s[0]+t[6]*s[1]+t[10]*s[2]));n/=c,ft(J,n,c,K,Y,Z,$,tt),Mt(K,Y,$,tt,r.projectionMatrix),r.projectionMatrix[10]=2/(i-a),r.projectionMatrix[14]=-(i+a)/(i-a)}function jt(t){let{near:s,far:e}=t;return s<2&&(s=2),e<2&&(e=2),s>=e&&(s=2,e=4),{near:s,far:e}}export{G as ShadowMap,z as SnapshotSlot};
|