@arcgis/core 4.23.0-next.20220128 → 4.23.0-next.20220202
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/TimeExtent.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/01a10fe5ad6941b0ee8c.js +1 -0
- package/assets/esri/core/workers/chunks/{7a5f5acfbd4ca1a5c1f3.js → 06116433eb6e669f146b.js} +1 -1
- package/assets/esri/core/workers/chunks/09a05d778b6fac710828.js +1 -0
- package/assets/esri/core/workers/chunks/{83d00afae4406ec78bc9.js → 0c6be307709523eb8a05.js} +1 -1
- package/assets/esri/core/workers/chunks/0e215fa28a0448169132.js +1 -0
- package/assets/esri/core/workers/chunks/{391e96192d1ec4e55ce2.js → 101b4f02f0572afb666f.js} +1 -1
- package/assets/esri/core/workers/chunks/11750e96065b4d7b926b.js +1 -0
- package/assets/esri/core/workers/chunks/{929c9b7cdab7c4ca3d87.js → 17c51f5a13f471e6656a.js} +1 -1
- package/assets/esri/core/workers/chunks/{ed0bcc66fb1e0ee75a4b.js → 1f34957ef42e5b5977d0.js} +1 -1
- package/assets/esri/core/workers/chunks/2f4e425be3a3bdfd8d29.js +1 -0
- package/assets/esri/core/workers/chunks/34bed896b68993cabaa1.js +1 -0
- package/assets/esri/core/workers/chunks/3e1679b01429fd73cffe.js +1 -0
- package/assets/esri/core/workers/chunks/{99619fcb772807c74f3b.js → 444829a840b8ded16fd7.js} +1 -1
- package/assets/esri/core/workers/chunks/467b5faa1c90d9821609.js +1 -0
- package/assets/esri/core/workers/chunks/49353182a16218a84251.js +1 -0
- package/assets/esri/core/workers/chunks/4bfc2eeb0738c393d8ec.js +1 -0
- package/assets/esri/core/workers/chunks/4de996ebc432f5e149bc.js +1 -0
- package/assets/esri/core/workers/chunks/{422537fc3df707bb62c9.js → 5038935db9b1ebe61d02.js} +1 -1
- package/assets/esri/core/workers/chunks/50976921acf7bd636123.js +1 -0
- package/assets/esri/core/workers/chunks/50ef2622fd0d9a241979.js +1 -0
- package/assets/esri/core/workers/chunks/{5790d171072b3c7d108f.js → 53aa2ab4e569c994a32d.js} +1 -1
- package/assets/esri/core/workers/chunks/{7903a3e2e0faff0f86c0.js → 56657f890e0f79f5d2ad.js} +1 -1
- package/assets/esri/core/workers/chunks/{db3c729ce0c0b2690dc9.js → 574e33f28c106d607fe3.js} +1 -1
- package/assets/esri/core/workers/chunks/{952980635afc7ec81804.js → 5b02ba8ed152dba53155.js} +1 -1
- package/assets/esri/core/workers/chunks/60c06d1bb3f8a26cb5ac.js +1 -0
- package/assets/esri/core/workers/chunks/{c2253a9f29c1aabb2b75.js → 66c47983e93071de28b1.js} +1 -1
- package/assets/esri/core/workers/chunks/6be326edd9829781d926.js +1 -0
- package/assets/esri/core/workers/chunks/70d6bb3c7112cb702389.js +1 -0
- package/assets/esri/core/workers/chunks/{5bcb3240b3c005e5fe72.js → 7215af7810d15e89aa5a.js} +1 -1
- package/assets/esri/core/workers/chunks/7509c1693ffedc0fa018.js +1 -0
- package/assets/esri/core/workers/chunks/76c1d663f6d3f935c87f.js +1 -0
- package/assets/esri/core/workers/chunks/7ccbb923f113b3e21545.js +1 -0
- package/assets/esri/core/workers/chunks/810a763373d7f78ae398.js +1 -0
- package/assets/esri/core/workers/chunks/82194fec53054c37061f.js +1 -0
- package/assets/esri/core/workers/chunks/82c59a71b7f087148089.js +1 -0
- package/assets/esri/core/workers/chunks/84eee02122b56a22d49e.js +1 -0
- package/assets/esri/core/workers/chunks/{dd13772a5e2eccc6a2bc.js → 8598f762f15ca68d52b7.js} +1 -1
- package/assets/esri/core/workers/chunks/{3c673495e5f507c4a9e5.js → 88458dcaff8edc50620c.js} +1 -1
- package/assets/esri/core/workers/chunks/{5ec98f4ddac707d0fbd1.js → 88815d533808aabb1fa9.js} +1 -1
- package/assets/esri/core/workers/chunks/{0463ba46df855a92b9c0.js → 8941f09329d9d39fb2fe.js} +1 -1
- package/assets/esri/core/workers/chunks/{655b55ac0cd533d7e9d7.js → 8ad5dc818dc73f4b9a76.js} +1 -1
- package/assets/esri/core/workers/chunks/8e96cddb069b643d864a.js +1 -0
- package/assets/esri/core/workers/chunks/{f2124f4d0f2b8a91f0ea.js → 90c5edcd8a609224ce55.js} +1 -1
- package/assets/esri/core/workers/chunks/9230b20eba4304d421b4.js +1 -0
- package/assets/esri/core/workers/chunks/{bac9fc90e6756e211160.js → 94d9951509c0db09547a.js} +1 -1
- package/assets/esri/core/workers/chunks/996d6ae7f2e2273f9bce.js +1 -0
- package/assets/esri/core/workers/chunks/{37c03cfc19086ce631c6.js → 9bd603ec98d24cd918e9.js} +1 -1
- package/assets/esri/core/workers/chunks/{c1135cb02ec46c491459.js → 9ce961bc390202c87941.js} +1 -1
- package/assets/esri/core/workers/chunks/9d4a35d4a85db80c4071.js +1 -0
- package/assets/esri/core/workers/chunks/9f0ad28e66862ba971a3.js +1 -0
- package/assets/esri/core/workers/chunks/{b3f5e91116112b0b612a.js → 9fd47b8fe25657ac0237.js} +1 -1
- package/assets/esri/core/workers/chunks/{b9e9cb354822c6d995a4.js → a276e60209f3d877a8d0.js} +1 -1
- package/assets/esri/core/workers/chunks/{aeaa1667c2d9f1b3366b.js → a85ed251d3d3668e474f.js} +1 -1
- package/assets/esri/core/workers/chunks/{44f0c3663b293afbd172.js → acf10f747215e9ff54dc.js} +1 -1
- package/assets/esri/core/workers/chunks/{69fd99b7c76e9992ccf3.js → b32bf9808cb4be3a6bd0.js} +1 -1
- package/assets/esri/core/workers/chunks/b3dc80ddbfa81026e937.js +1 -0
- package/assets/esri/core/workers/chunks/b548e6b3add4154ac4e6.js +1 -0
- package/assets/esri/core/workers/chunks/b6c55bdd8c957b062bc1.js +1 -0
- package/assets/esri/core/workers/chunks/{9d77467aa71d345fc1b6.js → bcc01bbffaa3bb5f60a8.js} +1 -1
- package/assets/esri/core/workers/chunks/{1f8c6a179e39fd4c5e6f.js → bd152e8b43cc4a6844dd.js} +1 -1
- package/assets/esri/core/workers/chunks/{0d02c6ad1f4688bfa374.js → bf7c44644fe7b0aa60cf.js} +1 -1
- package/assets/esri/core/workers/chunks/c0dc5882362479794224.js +1 -0
- package/assets/esri/core/workers/chunks/c8b574a76807f4ea7a70.js +1 -0
- package/assets/esri/core/workers/chunks/d09a0b2dc3a6fc10fa41.js +1 -0
- package/assets/esri/core/workers/chunks/{ec10151a2a95e95a0bb5.js → d304fe0ac836afd46e3d.js} +1 -1
- package/assets/esri/core/workers/chunks/{37a7bd30352b1309b8f8.js → d3f05b8e4bd53eb1eb9d.js} +1 -1
- package/assets/esri/core/workers/chunks/{be588873c16770ceb9ef.js → d46b511bbb83e68f1ece.js} +1 -1
- package/assets/esri/core/workers/chunks/{17de7a324dfa7f57ad5d.js → d780e946149b1c3d1246.js} +1 -1
- package/assets/esri/core/workers/chunks/d80bcf5ed1f54e0c4f5a.js +1 -0
- package/assets/esri/core/workers/chunks/{8cbb04a9065aa3756638.js → dc04a8ba6c770bdc2bd4.js} +1 -1
- package/assets/esri/core/workers/chunks/{89820b200ee44e678af5.js → dd891a98105904f8a06b.js} +1 -1
- package/assets/esri/core/workers/chunks/e5ab037c2a90411c453b.js +1 -0
- package/assets/esri/core/workers/chunks/ef2df21e1af3aa7ced29.js +1 -0
- package/assets/esri/core/workers/chunks/f5a7281ae24e837efc61.js +1 -0
- package/assets/esri/core/workers/chunks/{ff6abdc72076f3994659.js → f7150547d7e3259a0f29.js} +1 -1
- package/assets/esri/core/workers/chunks/{2c607d30ff8ca1b61286.js → fe0c3b7c9b428d9c3f25.js} +1 -1
- package/assets/esri/images/portal/mediaservice16.png +0 -0
- package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
- package/assets/esri/widgets/Directions/t9n/Directions.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ar.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_bg.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_bs.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ca.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_cs.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_da.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_de.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_el.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_en.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_es.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_et.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_fi.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_fr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_he.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_hr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_hu.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_id.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_it.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ja.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ko.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_lt.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_lv.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_nb.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_nl.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_pl.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_pt-BR.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_pt-PT.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ro.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ru.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sk.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sl.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sv.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_th.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_tr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_uk.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_vi.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_zh-CN.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_zh-HK.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_zh-TW.json +1 -1
- package/chunks/Heatmap.glsl.js +10 -0
- package/chunks/HeatmapDensity.glsl.js +21 -0
- package/core/maybe.js +1 -1
- package/core/promiseUtils.js +1 -1
- package/interfaces.d.ts +455 -45
- package/layers/RouteLayer.d.ts +4 -0
- package/layers/RouteLayer.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/graphics/data/optimizedFeatureQueryEngineAdapter.js +1 -1
- package/layers/graphics/featureConversionUtils.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/support/rasterFunctions/vectorFieldUtils.js +1 -1
- package/package.json +1 -1
- package/portal/PortalItem.js +1 -1
- package/renderers/support/rendererConversion.js +1 -1
- package/rest/support/DirectionLine.d.ts +4 -0
- package/rest/support/DirectionPoint.d.ts +4 -0
- package/rest/support/FeatureSet.js +1 -1
- package/rest/support/RouteInfo.d.ts +4 -0
- package/rest/support/RouteInfo.js +1 -1
- package/rest/support/RouteSolveResult.d.ts +4 -0
- package/support/featureFlags.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/TextSymbol3DLayer.js +1 -1
- package/symbols/support/Symbol3DHalo.js +1 -1
- package/symbols/support/Symbol3DTextBackground.js +5 -0
- package/views/2d/engine/RasterVFContainer.js +5 -0
- package/views/2d/engine/RasterVFDisplayObject.js +1 -1
- package/views/2d/engine/flow/AnimatedFlowView2D.js +1 -1
- package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
- package/views/2d/engine/webgl/brushes/raster/BrushVectorField.js +1 -1
- package/views/2d/engine/webgl/cpuMapped/Buffer.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLBaseTextTemplate.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/ImageryLayerView2D.js +1 -1
- package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
- package/views/2d/layers/RouteLayerView2D.js +1 -1
- package/views/2d/layers/features/processors/HeatmapProcessor.js +1 -1
- package/views/2d/layers/features/processors/SymbolProcessor.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/features/support/ClusterStore.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
- package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
- package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
- package/views/2d/layers/imagery/ImageryVFStrategy.js +5 -0
- package/views/2d/layers/imagery/ImageryView2D.js +1 -1
- package/views/2d/layers/imagery/VectorFieldTileView2D.js +1 -1
- package/views/2d/layers/imagery/VectorFieldView2D.js +5 -0
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/CloudsComposition.js +1 -1
- package/views/3d/environment/CloudsGenerator.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/environment/Fog.js +1 -1
- package/views/3d/environment/NoiseTextureAtlas.js +1 -1
- package/views/3d/environment/PanoramicAtmosphere.js +1 -1
- package/views/3d/environment/Precipitation.js +1 -1
- package/views/3d/environment/SimpleAtmosphere.js +1 -1
- package/views/3d/environment/Stars.js +1 -1
- package/views/3d/interactive/analysisTools/lineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/VoxelLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
- package/views/3d/layers/graphics/labelPlacement.js +1 -1
- package/views/3d/layers/i3s/I3SCrossfadeHelper.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/i3s/PointRenderer.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/support/LaserLineRenderer.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
- package/views/3d/webgl-engine/lib/CompositingHelper.js +1 -1
- package/views/3d/webgl-engine/lib/DrapedHeatmapRenderer.js +5 -0
- package/views/3d/webgl-engine/lib/HighlightHelper.js +1 -1
- package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
- package/views/3d/webgl-engine/lib/SSAOHelper.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowHighlightHelper.js +1 -1
- package/views/3d/webgl-engine/lib/SmaaRenderPass.js +1 -1
- package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
- package/views/3d/webgl-engine/lib/TextRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/Texture.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +5 -0
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/shaders/Heatmap.glsl.js +5 -0
- package/views/3d/webgl-engine/shaders/HeatmapDensity.glsl.js +5 -0
- package/views/3d/webgl-engine/shaders/HeatmapDensityTechnique.js +5 -0
- package/views/3d/webgl-engine/shaders/HeatmapTechnique.js +5 -0
- package/views/draw/support/Box.js +1 -1
- package/views/draw/support/GraphicMover.js +1 -1
- package/views/draw/support/HighlightHelper.js +5 -0
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/layerUtils.js +1 -1
- package/webdoc/support/{Thumbnail.js → SlideThumbnail.js} +1 -1
- package/webmap/Bookmark.js +1 -1
- package/webmap/Version.js +1 -1
- package/webscene/Slide.js +1 -1
- package/webscene/Version.js +1 -1
- package/webscene/support/SlideVisibleLayer.js +1 -1
- package/widgets/Bookmarks/BookmarksViewModel.js +1 -1
- package/widgets/Bookmarks.js +1 -1
- package/widgets/Directions/DirectionsViewModel.js +1 -1
- package/widgets/Directions/support/directionsUtils.js +1 -1
- package/widgets/Directions/support/resources.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/widgets/TimeSlider.js +1 -1
- package/widgets/Widget.js +1 -1
- package/widgets/support/vnodeCache.js +5 -0
- package/widgets/support/widgetUtils.js +1 -1
- package/assets/esri/core/workers/chunks/0453fad5cb819797b4f6.js +0 -1
- package/assets/esri/core/workers/chunks/0cd0a6eef51fc5b9ea61.js +0 -1
- package/assets/esri/core/workers/chunks/0d684f16f37d5dc385dd.js +0 -1
- package/assets/esri/core/workers/chunks/16b6d0f8378582c051c3.js +0 -1
- package/assets/esri/core/workers/chunks/1877ab1b6a115dbba1c5.js +0 -1
- package/assets/esri/core/workers/chunks/1b2a961f776a0b57e57a.js +0 -1
- package/assets/esri/core/workers/chunks/1b3fd66577b19aa5f2b6.js +0 -1
- package/assets/esri/core/workers/chunks/1c733b7db092a2a88ef3.js +0 -1
- package/assets/esri/core/workers/chunks/27474b007988855bea9d.js +0 -1
- package/assets/esri/core/workers/chunks/357033117dfe61eb81ea.js +0 -1
- package/assets/esri/core/workers/chunks/483d5d8593d96d0f0b15.js +0 -1
- package/assets/esri/core/workers/chunks/4ba6de8aa7e2960bad49.js +0 -1
- package/assets/esri/core/workers/chunks/4be35af7d6babbfe9d84.js +0 -1
- package/assets/esri/core/workers/chunks/5457962a70bd3c557a75.js +0 -1
- package/assets/esri/core/workers/chunks/57856b4a9b8784a69844.js +0 -1
- package/assets/esri/core/workers/chunks/57b349d1dbc0bed75b79.js +0 -1
- package/assets/esri/core/workers/chunks/5d11b97b667921d67ae7.js +0 -1
- package/assets/esri/core/workers/chunks/5dbe555a5a662ff3d9ce.js +0 -1
- package/assets/esri/core/workers/chunks/64b7e8d812ea8fcf269e.js +0 -1
- package/assets/esri/core/workers/chunks/75d812955a473d0e8960.js +0 -1
- package/assets/esri/core/workers/chunks/96f148a556a2418038de.js +0 -1
- package/assets/esri/core/workers/chunks/9876a1bae350795fab36.js +0 -1
- package/assets/esri/core/workers/chunks/a8692bffb76444c34760.js +0 -1
- package/assets/esri/core/workers/chunks/ba762bcfd74af0bb8218.js +0 -1
- package/assets/esri/core/workers/chunks/c093dff4592832ac0973.js +0 -1
- package/assets/esri/core/workers/chunks/c984b3040e120e502b11.js +0 -1
- package/assets/esri/core/workers/chunks/cdbc005eebec1503b99d.js +0 -1
- package/assets/esri/core/workers/chunks/d1fe53b597351dc58305.js +0 -1
- package/assets/esri/core/workers/chunks/e218bde41ffbcc5194f5.js +0 -1
- package/assets/esri/core/workers/chunks/e287f49184d076af17e2.js +0 -1
- package/assets/esri/core/workers/chunks/e93dfdede0532a89ffa5.js +0 -1
- package/assets/esri/core/workers/chunks/e9e5196b44b6923be1a3.js +0 -1
- package/assets/esri/core/workers/chunks/ea595b0df5050eda2a13.js +0 -1
- package/assets/esri/core/workers/chunks/eb82ff10cef2bde6e57f.js +0 -1
- package/assets/esri/core/workers/chunks/ee6e0db58dc64410e687.js +0 -1
- package/assets/esri/core/workers/chunks/f0a9f161805fc7a30fc5.js +0 -1
- package/assets/esri/core/workers/chunks/fc7e31d87555beb63291.js +0 -1
- package/assets/esri/core/workers/chunks/fff6b0338f06dad0c45d.js +0 -1
- package/views/2d/layers/imagery/ImageryGraphicsView2D.js +0 -5
- package/widgets/Directions/support/CostSummary.js +0 -5
- package/widgets/Directions/support/RouteSection.js +0 -5
- package/widgets/Directions/support/RouteSections.js +0 -5
- package/widgets/Directions/support/maneuverUtils.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.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{nextHighestPowerOfTwo as e}from"../../../core/mathUtils.js";import{disposeMaybe as t,releaseMaybe as r,isNone as i,isSome as s}from"../../../core/maybe.js";import{s as o,c as a}from"../../../chunks/vec2.js";import{Z as n}from"../../../chunks/vec2f64.js";import{f as l}from"../../../chunks/vec3f64.js";import{f as u}from"../../../chunks/vec4f64.js";import{isBaseLayer as c}from"../../../layers/support/layerUtils.js";import{VectorTileRendererHelper3D as h}from"../../2d/engine/vectorTiles/VectorTileRendererHelper3D.js";import{RasterColorizerStretchType as _}from"../../2d/engine/webgl/brushes/raster/enums.js";import{ImageWithType as d}from"../support/StreamDataLoader.js";import{BlendLayersTechniqueConfiguration as p,BlendLayersTechnique as f}from"./BlendLayersTechnique.js";import{TextureUpdate as T}from"./interfaces.js";import{LayerClass as m}from"./LayerClass.js";import"../../../core/arrayUtils.js";import"../../../geometry/support/aaBoundingBox.js";import"../support/buffer/glUtil.js";import"./PatchGeometryFactory.js";import{ActivationTime as y}from"./TextureFader.js";import"../../../core/HeapSort.js";import"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import"../../webgl/BufferObject.js";import"../../webgl/VertexArrayObject.js";import{RasterColorizerTechniqueConfiguration as b,RasterColorizerTechnique as x}from"./RasterColorizerTechnique.js";import{isVectorTileLayerView as g,isVectorTileRenderInfo as I,isImageryTileRenderInfo as w,isRasterTileRenderInfo as R,isTextureTileRenderInfo as L}from"./terrainUtils.js";import{TextureReference as E}from"./TextureReference.js";import P from"./TileTexture.js";import{TileUpdate as D}from"./TileUpdate.js";import{FBOPool as A}from"./support/FBOPool.js";import{BlendMode as j}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{Pos2Tex as O}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{createQuadVAO as k,createColorTexture as q,createEmptyTexture as C}from"../webgl-engine/lib/glUtil3D.js";import{ClearBufferBit as U,TextureSamplingMode as B,PrimitiveType as F,TextureType as M,PixelFormat as S,PixelType as N,TextureWrapMode as z}from"../../webgl/enums.js";import{Texture as v}from"../../webgl/Texture.js";import{vertexCount as G}from"../../webgl/Util.js";class V{constructor(e,t,r){this._rctx=e,this.tileSize=t,this._techniqueRepository=r,this._backgroundIsGrid=!1,this._backgroundTexture=null,this._backgroundColor=null,this._blackTex=null,this._vectorTileHelper=new h,this._maxAnisotropy=this._rctx.parameters.maxMaxAnisotropy,this._vaoQuad=k(this._rctx,O),this._blackTex=new P(q(this._rctx,[0,0,0,1])),this._fboPool=new A(this._rctx)}dispose(){this._fboPool&&(this._fboPool.clear(),this._fboPool=null),this._vaoQuad=t(this._vaoQuad),this._backgroundTexture=r(this._backgroundTexture),this._blackTex=r(this._blackTex),this._blendLayersTechnique=t(this._blendLayersTechnique),this._applyOpacityTechnique=t(this._applyOpacityTechnique),this._vectorTileHelper=t(this._vectorTileHelper)}get blendLayersTechnique(){if(i(this._blendLayersTechnique)){const e=new p;e.mode=j.OneMinusSourceAlpha,this._blendLayersTechnique=this._techniqueRepository.acquire(f,e)}return this._blendLayersTechnique}get applyOpacityTechnique(){if(i(this._applyOpacityTechnique)){const e=new p;e.mode=j.SourceAlpha,this._applyOpacityTechnique=this._techniqueRepository.acquire(f,e)}return this._applyOpacityTechnique}get backgroundIsGrid(){return this._backgroundIsGrid}get backgroundColor(){return this._backgroundColor}updateTileTexture(e,t){const r=e.layerInfo[m.MAP];for(const s of r)s.pendingUpdates&=~(D.TEXTURE_NOFADING&D.TEXTURE_FADING);if(!e.renderData)return;const i=e.surface,o=i.baseOpacity;let a=0,n=0,l=this.tileSize,u=!1;const h=i.view.pixelRatio;let _=r.length,d=0;for(;d<r.length&&!u;d++){const t=i.layerViewByIndex(d,m.MAP),s=t.fullOpacity;if(X[d]=s,c(t.layer)&&_>=r.length&&(_=d),0===s)continue;++n;const p=Q(e,d,W);p&&(g(t)?l=Math.max(l,this.tileSize*h):1===o&&1===s&&(t.isOpaque||this._dataToTexture(p)&&p.sourceLayerInfo.data.descriptor.isOpaque)&&(u=!0),++a)}this._cleanupFBOPool(h,r.length),l=H(l);const p=l/this.tileSize,f=d-1;0!==a?1===a&&(u||this._backgroundIsGrid||s(this._backgroundColor))&&this._useLayerTexture(e,f,_,X[f])||this._composeMapLayers(e,t,f,_,u,X,l,p):this._useBackgroundTexture(e,n)}_useBackgroundTexture(e,t){let r=y.Immediate;(e.surface.view.layerViewManager.updating||t>0)&&(r=y.Delayed),this._backgroundTexture&&i(e.renderData.textureReference)&&(r=y.Immediate),e.renderData.setTextureReference(s(this._backgroundTexture)?new E(this._backgroundTexture,T.FADING,Y,e.surface.baseOpacity,1,1,!1):null,r)}_useLayerTexture(e,t,r,i){const s=t<r,o=s?1:e.surface.baseOpacity,a=s?e.surface.baseOpacity:1,n=Q(e,t,W);return!!this._dataToTexture(n)&&(e.renderData.setTextureReference(new E(n.sourceLayerInfo.data,T.FADING,n,o,i,a,!0)),!0)}_composeMapLayers(e,t,r,i,o,a,l,u){const c=this._rctx,h=this._fboPool.acquire(l);c.bindFramebuffer(h),c.setViewport(0,0,l,l),c.setClearColor(0,0,0,0),c.setClearDepth(1),c.clearSafe(U.COLOR_BUFFER_BIT|U.DEPTH_BUFFER_BIT);let _=!1;!o&&s(this._backgroundTexture)&&this._drawRasterData(this.blendLayersTechnique,this._backgroundTexture.texture,1,n);const d=e.surface.baseOpacity;let p=!1,f=B.LINEAR_MIPMAP_LINEAR;for(let s=r;s>=0;s--){const t=Q(e,s,W);t&&(s<i&&d<1&&!p&&(this._drawRasterData(this.applyOpacityTechnique,this._blackTex.texture,1,n,d),p=!0),0!==a[s]&&(I(t)?_=this._drawVectorData(this.blendLayersTechnique,t,u,a[s],l,h,_):w(t)?(this._drawImageryTileData(t,a[s]),this._hasNearestInterpolation(t)&&(f=B.NEAREST)):this._dataToTexture(t)&&this._drawRasterData(this.blendLayersTechnique,t.sourceLayerInfo.data.texture,t.scale,t.offset,a[s])))}const T=e.renderData.ensureTexture(l,(()=>this._buildTexture(l,f))),m=c.bindTexture(T.texture,v.TEXTURE_UNIT_FOR_UPDATES),y=T.descriptor;c.gl.copyTexImage2D(c.gl.TEXTURE_2D,0,y.pixelFormat,0,0,y.width,y.height,0),T.generateMipmap(),c.bindTexture(m,v.TEXTURE_UNIT_FOR_UPDATES),c.bindFramebuffer(null),this._fboPool.release(h);const b=p?1:d;e.renderData.setTextureReference(new E(T,t,Y,b,1,1,!1))}_drawQuad(e){this._rctx.bindVAO(this._vaoQuad),e.assertCompatibleVertexAttributeLocations(this._vaoQuad),this._rctx.drawArrays(F.TRIANGLE_STRIP,0,G(this._vaoQuad,"geometry"))}_drawRasterData(e,t,r,s,o=1){if(i(t))return;const a=this._rctx,n=e.program;e.bindPipelineState(a),a.useProgram(n),n.bindTexture(t,"tex"),n.setUniform1f("scale",r),n.setUniform2f("offset",s[0],s[1]),n.setUniform1f("opacity",o),this._drawQuad(n)}_hasNearestInterpolation(e){const t=e.sourceLayerInfo.data;return!!t.source&&"nearest"===t.interpolation}_drawImageryTileData(e,t=1){const r=e.sourceLayerInfo.data;if(!r.source)return;e.tile.surface.layerViewByIndex(e.layerIndex,m.MAP).ensureSymbolizerParameters(r);const i=this._getRasterColorizerTechnique(r),s=this._rctx,o=i.program;if(i.bindPipelineState(s),s.useProgram(o),!r.bind(s))return;r.opacity=t,r.scale=e.scale,r.offset=e.offset;const{names:a,textures:n}=r.getTextures();a.forEach(((e,t)=>o.bindTexture(n[t],e))),i.bindPass(r.getUniforms()),this._drawQuad(o),s.bindVAO()}_getRasterColorizerTechnique(e){const t=e.symbolizerParameters,r=["stretch","lut","hillshade"].indexOf(t.type);return i(this._rasterColorizerConfig)&&(this._rasterColorizerConfig=new b,this._rctx.gl.getExtension("WEBGL_color_buffer_float"),this._rctx.gl.getExtension("OES_texture_float")),this._rasterColorizerConfig.colorizerType=r,this._rasterColorizerConfig.applyColormap=!!t.colormap,this._rasterColorizerConfig.stretchType=e.hasStretchTypeNone()?_.Noop:_.PerBand,this._rasterColorizerTechnique=this._techniqueRepository.releaseAndAcquire(x,this._rasterColorizerConfig,this._rasterColorizerTechnique),this._rasterColorizerTechnique}_drawVectorData(e,t,r,i,o,a,n){const l=this._rctx,u=t.sourceLayerInfo.data,c=t.tile.surface.layerViewByIndex(t.layerIndex,m.MAP);let h;return e.bindPipelineState(l),i<1?(h=this._fboPool.acquire(o),l.bindFramebuffer(h),l.setClearColor(1,1,1,0),l.clearSafe(U.COLOR_BUFFER_BIT|U.DEPTH_BUFFER_BIT)):n&&l.clearSafe(U.DEPTH_BUFFER_BIT),this._vectorTileHelper.render(l,t.sourceLod,u,c.painter,c.layer.styleRepository,c.schemaHelper,Math.round(1/t.scale),t.offset,this.tileSize,r),!s(h)||(l.bindFramebuffer(a),this._drawRasterData(e,h.colorTexture,1,[0,0],i),this._fboPool.release(h),n)}_dataToTexture(e){return R(e)&&this._rasterDataToTexture(e),L(e)}_rasterDataToTexture(e){const t=e.sourceLayerInfo;t.data=this._buildTexture(t.data),e.tile.setMemoryDirty()}setBackground(e,t){r(this._backgroundTexture),this._backgroundIsGrid=t,e instanceof HTMLImageElement?(this._backgroundTexture=this._buildTexture(e),this._backgroundColor=null):(this._backgroundTexture=new P(q(this._rctx,u(e[0]||0,e[1]||0,e[2]||0,1))),this._backgroundColor=l(e[0]||0,e[1]||0,e[2]||0))}_buildTexture(e,t=B.LINEAR_MIPMAP_LINEAR){if(i(e))return null;const r={target:M.TEXTURE_2D,pixelFormat:S.RGBA,dataType:N.UNSIGNED_BYTE,wrapMode:z.CLAMP_TO_EDGE,samplingMode:t,maxAnisotropy:this._maxAnisotropy,flipped:!0,hasMipmap:!0},s=this._rctx;let o;if("number"==typeof e)r.width=r.height=e,o=new P(new v(s,r));else if(e instanceof d)r.isOpaque=e.isOpaque,o=new P(new v(s,r,e.image)),e.release();else try{o=new P(new v(s,r,e))}catch(n){o=new P(C(s)),console.warn("TileRenderer: failed to execute 'texImage2D', cross-origin image may not be loaded.")}const a=s.bindTexture(o.texture,v.TEXTURE_UNIT_FOR_UPDATES);return o.generateMipmap(),s.bindTexture(a,v.TEXTURE_UNIT_FOR_UPDATES),o}_cleanupFBOPool(e,t){e===this._lastPixelRatio&&t===this._lastNumLayers||(this._fboPool.clear(),this._lastPixelRatio=e,this._lastNumLayers=t)}get test(){return{backgroundTexture:this._backgroundTexture}}}function H(t){const r=e(t),i=r*r,s=t*t;if(i===s)return t;const o=r/2;return i-s<s-o*o?r:o}function Q(e,t,r){r.layerIndex=t;const i=e.layerInfo[m.MAP][t];if(i.data)return o(r.offset,0,0),r.tile=e,r.scale=1,r.sourceLod=e.lij,r.sourceLayerInfo=i,r;const s=i.upsampleInfo;if(s){const e=s.tile.layerInfo[m.MAP][t];return r.tile=s.tile,a(r.offset,s.offset),r.scale=s.scale,r.sourceLod=s.tile.lij,r.sourceLayerInfo=e,r}return null}const X=new Array,W={tile:null,sourceLayerInfo:null,sourceLod:null,offset:[0,0],scale:1,layerIndex:0},Y={offset:[0,0],scale:1};export{V as TileRenderer};
|
|
5
|
+
import{nextHighestPowerOfTwo as e}from"../../../core/mathUtils.js";import{disposeMaybe as t,releaseMaybe as r,isNone as s,isSome as i}from"../../../core/maybe.js";import{s as o,c as a}from"../../../chunks/vec2.js";import{Z as n}from"../../../chunks/vec2f64.js";import{f as u}from"../../../chunks/vec3f64.js";import{f as l}from"../../../chunks/vec4f64.js";import{isBaseLayer as c}from"../../../layers/support/layerUtils.js";import{VectorTileRendererHelper3D as h}from"../../2d/engine/vectorTiles/VectorTileRendererHelper3D.js";import{RasterColorizerStretchType as _}from"../../2d/engine/webgl/brushes/raster/enums.js";import{ImageWithType as f}from"../support/StreamDataLoader.js";import{BlendLayersTechniqueConfiguration as d,BlendLayersTechnique as p}from"./BlendLayersTechnique.js";import{TextureUpdate as T}from"./interfaces.js";import{LayerClass as m}from"./LayerClass.js";import"../../../core/arrayUtils.js";import"../../../geometry/support/aaBoundingBox.js";import"../support/buffer/glUtil.js";import"./PatchGeometryFactory.js";import{ActivationTime as y}from"./TextureFader.js";import"../../../core/HeapSort.js";import"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import"../../webgl/BufferObject.js";import"../../webgl/VertexArrayObject.js";import{RasterColorizerTechniqueConfiguration as x,RasterColorizerTechnique as b}from"./RasterColorizerTechnique.js";import{isVectorTileLayerView as g,isVectorTileRenderInfo as I,isImageryTileRenderInfo as w,isRasterTileRenderInfo as R,isTextureTileRenderInfo as L}from"./terrainUtils.js";import{TextureReference as E}from"./TextureReference.js";import D from"./TileTexture.js";import{TileUpdate as A}from"./TileUpdate.js";import{FBOPool as P}from"./support/FBOPool.js";import{BlendMode as j}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{Pos2Tex as q}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{createQuadVAO as O,createColorTexture as k,createEmptyTexture as C}from"../webgl-engine/lib/glUtil3D.js";import{ClearBufferBit as U,TextureSamplingMode as B,PrimitiveType as F,TextureType as M,PixelFormat as N,PixelType as S,TextureWrapMode as z}from"../../webgl/enums.js";import{Texture as v}from"../../webgl/Texture.js";import{vertexCount as G}from"../../webgl/Util.js";class V{constructor(e,t,r){this._rctx=e,this.tileSize=t,this._techniqueRepository=r,this._backgroundIsGrid=!1,this._backgroundTexture=null,this._backgroundColor=null,this._blackTex=null,this._vectorTileHelper=new h,this._maxAnisotropy=this._rctx.parameters.maxMaxAnisotropy,this._vaoQuad=O(this._rctx,q),this._blackTex=new D(k(this._rctx,[0,0,0,1])),this._fboPool=new P(this._rctx)}dispose(){this._fboPool&&(this._fboPool.clear(),this._fboPool=null),this._vaoQuad=t(this._vaoQuad),this._backgroundTexture=r(this._backgroundTexture),this._blackTex=r(this._blackTex),this._blendLayersTechnique=t(this._blendLayersTechnique),this._applyOpacityTechnique=t(this._applyOpacityTechnique),this._vectorTileHelper=t(this._vectorTileHelper)}get blendLayersTechnique(){if(s(this._blendLayersTechnique)){const e=new d;e.mode=j.OneMinusSourceAlpha,this._blendLayersTechnique=this._techniqueRepository.acquire(p,e)}return this._blendLayersTechnique}get applyOpacityTechnique(){if(s(this._applyOpacityTechnique)){const e=new d;e.mode=j.SourceAlpha,this._applyOpacityTechnique=this._techniqueRepository.acquire(p,e)}return this._applyOpacityTechnique}get backgroundIsGrid(){return this._backgroundIsGrid}get backgroundColor(){return this._backgroundColor}updateTileTexture(e,t){const r=e.layerInfo[m.MAP];for(const i of r)i.pendingUpdates&=~(A.TEXTURE_NOFADING&A.TEXTURE_FADING);if(!e.renderData)return;const s=e.surface,o=s.baseOpacity;let a=0,n=0,u=this.tileSize,l=!1;const h=s.view.pixelRatio;let _=r.length,f=0;for(;f<r.length&&!l;f++){const t=s.layerViewByIndex(f,m.MAP),i=t.fullOpacity;if(X[f]=i,c(t.layer)&&_>=r.length&&(_=f),0===i)continue;++n;const d=Q(e,f,W);d&&(g(t)?u=Math.max(u,this.tileSize*h):1===o&&1===i&&(t.isOpaque||this._dataToTexture(d)&&d.sourceLayerInfo.data.descriptor.isOpaque)&&(l=!0),++a)}this._cleanupFBOPool(h,r.length),u=H(u);const d=u/this.tileSize,p=f-1;0!==a?1===a&&(l||this._backgroundIsGrid||i(this._backgroundColor))&&this._useLayerTexture(e,p,_,X[p])||this._composeMapLayers(e,t,p,_,l,X,u,d):this._useBackgroundTexture(e,n)}_useBackgroundTexture(e,t){let r=y.Immediate;(e.surface.view.layerViewManager.updating||t>0)&&(r=y.Delayed),this._backgroundTexture&&s(e.renderData.textureReference)&&(r=y.Immediate),e.renderData.setTextureReference(i(this._backgroundTexture)?new E(this._backgroundTexture,T.FADING,Y,e.surface.baseOpacity,1,1,!1):null,r)}_useLayerTexture(e,t,r,s){const i=t<r,o=i?1:e.surface.baseOpacity,a=i?e.surface.baseOpacity:1,n=Q(e,t,W);return!!this._dataToTexture(n)&&(e.renderData.setTextureReference(new E(n.sourceLayerInfo.data,T.FADING,n,o,s,a,!0)),!0)}_composeMapLayers(e,t,r,s,o,a,u,l){const c=this._rctx,h=this._fboPool.acquire(u);c.bindFramebuffer(h),c.setViewport(0,0,u,u),c.setClearColor(0,0,0,0),c.setClearDepth(1),c.clearSafe(U.COLOR_BUFFER_BIT|U.DEPTH_BUFFER_BIT);let _=!1;!o&&i(this._backgroundTexture)&&this._drawRasterData(this.blendLayersTechnique,this._backgroundTexture.texture,1,n);const f=e.surface.baseOpacity;let d=!1,p=B.LINEAR_MIPMAP_LINEAR;for(let i=r;i>=0;i--){const t=Q(e,i,W);t&&(i<s&&f<1&&!d&&(this._drawRasterData(this.applyOpacityTechnique,this._blackTex.texture,1,n,f),d=!0),0!==a[i]&&(I(t)?_=this._drawVectorData(this.blendLayersTechnique,t,l,a[i],u,h,_):w(t)?(this._drawImageryTileData(t,a[i]),this._hasNearestInterpolation(t)&&(p=B.NEAREST)):this._dataToTexture(t)&&this._drawRasterData(this.blendLayersTechnique,t.sourceLayerInfo.data.texture,t.scale,t.offset,a[i])))}const T=e.renderData.ensureTexture(u,(()=>this._buildTexture(u,p))),m=c.bindTexture(T.texture,v.TEXTURE_UNIT_FOR_UPDATES),y=T.descriptor;c.gl.copyTexImage2D(c.gl.TEXTURE_2D,0,y.pixelFormat,0,0,y.width,y.height,0),T.generateMipmap(),c.bindTexture(m,v.TEXTURE_UNIT_FOR_UPDATES),c.bindFramebuffer(null),this._fboPool.release(h);const x=d?1:f;e.renderData.setTextureReference(new E(T,t,Y,x,1,1,!1))}_drawQuad(e){this._rctx.bindVAO(this._vaoQuad),e.assertCompatibleVertexAttributeLocations(this._vaoQuad),this._rctx.drawArrays(F.TRIANGLE_STRIP,0,G(this._vaoQuad,"geometry"))}_drawRasterData(e,t,r,i,o=1){if(s(t))return;const a=this._rctx.useTechnique(e);a.bindTexture(t,"tex"),a.setUniform1f("scale",r),a.setUniform2f("offset",i[0],i[1]),a.setUniform1f("opacity",o),this._drawQuad(a)}_hasNearestInterpolation(e){const t=e.sourceLayerInfo.data;return!!t.source&&"nearest"===t.interpolation}_drawImageryTileData(e,t=1){const r=e.sourceLayerInfo.data;if(!r.source)return;e.tile.surface.layerViewByIndex(e.layerIndex,m.MAP).ensureSymbolizerParameters(r);const s=this._getRasterColorizerTechnique(r),i=this._rctx,o=i.useTechnique(s);if(!r.bind(i))return;r.opacity=t,r.scale=e.scale,r.offset=e.offset;const{names:a,textures:n}=r.getTextures();a.forEach(((e,t)=>o.bindTexture(n[t],e))),s.bindPass(r.getUniforms()),this._drawQuad(o),i.bindVAO()}_getRasterColorizerTechnique(e){const t=e.symbolizerParameters,r=["stretch","lut","hillshade"].indexOf(t.type);return s(this._rasterColorizerConfig)&&(this._rasterColorizerConfig=new x,this._rctx.gl.getExtension("WEBGL_color_buffer_float"),this._rctx.gl.getExtension("OES_texture_float")),this._rasterColorizerConfig.colorizerType=r,this._rasterColorizerConfig.applyColormap=!!t.colormap,this._rasterColorizerConfig.stretchType=e.hasStretchTypeNone()?_.Noop:_.PerBand,this._rasterColorizerTechnique=this._techniqueRepository.releaseAndAcquire(b,this._rasterColorizerConfig,this._rasterColorizerTechnique),this._rasterColorizerTechnique}_drawVectorData(e,t,r,s,o,a,n){const u=this._rctx,l=t.sourceLayerInfo.data,c=t.tile.surface.layerViewByIndex(t.layerIndex,m.MAP);let h;return e.bindPipelineState(u),s<1?(h=this._fboPool.acquire(o),u.bindFramebuffer(h),u.setClearColor(1,1,1,0),u.clearSafe(U.COLOR_BUFFER_BIT|U.DEPTH_BUFFER_BIT)):n&&u.clearSafe(U.DEPTH_BUFFER_BIT),this._vectorTileHelper.render(u,t.sourceLod,l,c.painter,c.layer.styleRepository,c.schemaHelper,Math.round(1/t.scale),t.offset,this.tileSize,r),!i(h)||(u.bindFramebuffer(a),this._drawRasterData(e,h.colorTexture,1,[0,0],s),this._fboPool.release(h),n)}_dataToTexture(e){return R(e)&&this._rasterDataToTexture(e),L(e)}_rasterDataToTexture(e){const t=e.sourceLayerInfo;t.data=this._buildTexture(t.data),e.tile.setMemoryDirty()}setBackground(e,t){r(this._backgroundTexture),this._backgroundIsGrid=t,e instanceof HTMLImageElement?(this._backgroundTexture=this._buildTexture(e),this._backgroundColor=null):(this._backgroundTexture=new D(k(this._rctx,l(e[0]||0,e[1]||0,e[2]||0,1))),this._backgroundColor=u(e[0]||0,e[1]||0,e[2]||0))}_buildTexture(e,t=B.LINEAR_MIPMAP_LINEAR){if(s(e))return null;const r={target:M.TEXTURE_2D,pixelFormat:N.RGBA,dataType:S.UNSIGNED_BYTE,wrapMode:z.CLAMP_TO_EDGE,samplingMode:t,maxAnisotropy:this._maxAnisotropy,flipped:!0,hasMipmap:!0},i=this._rctx;let o;if("number"==typeof e)r.width=r.height=e,o=new D(new v(i,r));else if(e instanceof f)r.isOpaque=e.isOpaque,o=new D(new v(i,r,e.image)),e.release();else try{o=new D(new v(i,r,e))}catch(n){o=new D(C(i)),console.warn("TileRenderer: failed to execute 'texImage2D', cross-origin image may not be loaded.")}const a=i.bindTexture(o.texture,v.TEXTURE_UNIT_FOR_UPDATES);return o.generateMipmap(),i.bindTexture(a,v.TEXTURE_UNIT_FOR_UPDATES),o}_cleanupFBOPool(e,t){e===this._lastPixelRatio&&t===this._lastNumLayers||(this._fboPool.clear(),this._lastPixelRatio=e,this._lastNumLayers=t)}get test(){return{backgroundTexture:this._backgroundTexture}}}function H(t){const r=e(t),s=r*r,i=t*t;if(s===i)return t;const o=r/2;return s-i<i-o*o?r:o}function Q(e,t,r){r.layerIndex=t;const s=e.layerInfo[m.MAP][t];if(s.data)return o(r.offset,0,0),r.tile=e,r.scale=1,r.sourceLod=e.lij,r.sourceLayerInfo=s,r;const i=s.upsampleInfo;if(i){const e=i.tile.layerInfo[m.MAP][t];return r.tile=i.tile,a(r.offset,i.offset),r.scale=i.scale,r.sourceLod=i.tile.lij,r.sourceLayerInfo=e,r}return null}const X=new Array,W={tile:null,sourceLayerInfo:null,sourceLod:null,offset:[0,0],scale:1,layerIndex:0},Y={offset:[0,0],scale:1};export{V as TileRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{unwrap as e}from"../../../../../core/maybe.js";import t from"../../../../../core/PooledArray.js";import{TransparencyPassType as
|
|
5
|
+
import{unwrap as e}from"../../../../../core/maybe.js";import t from"../../../../../core/PooledArray.js";import{TransparencyPassType as s}from"../../lib/basicInterfaces.js";import{DataType as r}from"../../../../webgl/enums.js";var a;!function(e){e[e.FrontToBack=0]="FrontToBack",e[e.BackToFront=1]="BackToFront"}(a||(a={}));class i{constructor(e,s,r=a.FrontToBack){this._rctx=e,this._techniqueRepository=s,this._sorting=r,this._draws=new t({initialSize:32,allocator:e=>e||{material:null,geometry:null,geometryRanges:null,bindDrawParams:null,depthSquaredHint:0,indexType:0}}),this._passBoundTechniques=new Set,this._previouslyBoundMaterials=new Map,this._previouslyBoundDraw=new Map}submitDraw(t,s,r,a,i){const n=this._draws.pushNew();n.geometry=s,n.geometryRanges=r,n.material=t,n.bindDrawParams=a,n.depthSquaredHint=i,n.indexType=s.indexed?e(s.vao.indexBuffer).indexType:0}dispatch(e){const t=this._rctx;this._passBoundTechniques.clear(),this._previouslyBoundMaterials.clear(),this._previouslyBoundDraw.clear();let r=null;const a=this._draws.map((t=>t.material.prepareTechnique(this._techniqueRepository,e,t.geometry.parameters))),i=this._draws.length;for(let o=0;o<i;o++){const i=a[o];i===r&&i.configuration.transparencyPassType===s.NONE||(t.useTechnique(i,e.slot),r=i),this._passBoundTechniques.has(i)||(i.bindPass(e),this._passBoundTechniques.add(i));const d=this._draws.data[o],l=d.geometry;t.bindVAO(l.vao),this._previouslyBoundMaterials.get(i)!==d.material&&(i.bindMaterial(d.material,e),this._previouslyBoundMaterials.set(i,d.material)),this._previouslyBoundDraw.get(i)!==d.bindDrawParams&&(i.bindDraw(d.bindDrawParams),this._previouslyBoundDraw.set(i,d.bindDrawParams));const u=d.geometryRanges,p=u.length;if(0!==d.indexType){const e=n.get(d.indexType);for(let s=0;s<p;s+=2){const r=u[s],a=u[s+1];t.drawElements(l.primitiveType,a,d.indexType,r*e)}}else for(let e=0;e<p;e+=2){const s=u[e],r=u[e+1];t.drawArrays(l.primitiveType,s,r)}}}prepareSubmit(){this._draws.clear()}finishSubmit(){const e=this._sorting===a.FrontToBack?1:-1;this._draws.sort(((t,s)=>{const r=e*(t.depthSquaredHint-s.depthSquaredHint);return 0!==r?r:t.geometry.vao.size-s.geometry.vao.size}))}get count(){return this._draws.length}}const n=new Map;n.set(r.UNSIGNED_BYTE,1),n.set(r.UNSIGNED_SHORT,2),n.set(r.UNSIGNED_INT,4);export{i as RenderPass,a as RenderPassSorting};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{disposeMaybe as
|
|
5
|
+
import{disposeMaybe as e,isNone as t}from"../../../../core/maybe.js";import{OverlayIndex as r}from"../../terrain/interfaces.js";import{createQuadVAO as s}from"./glUtil3D.js";import{C as o}from"../../../../chunks/Compositing.glsl.js";import{CompositingTechniqueConfiguration as i,AlphaMode as a,CompositingTechnique as n}from"../shaders/CompositingTechnique.js";import{PrimitiveType as c}from"../../../webgl/enums.js";import{vertexCount as h}from"../../../webgl/Util.js";class p{constructor(e,t){this._rctx=e,this._techniqueRepository=t}dispose(){this._vao=e(this._vao)}compositeTransparent(e,t,r,s=1){const i=this._rctx;u.alphaMode=a.Alpha,u.function=o.Transparency,u.hasOpacityFactor=1!==s;const p=this._techniqueRepository.acquire(n,u),m=i.useTechnique(p);m.bindTexture(e,"colorTexture"),m.bindTexture(t,"alphaTexture"),m.bindTexture(r,"frontFaceTexture");const l=this._ensureVAO();i.bindVAO(l),i.drawArrays(c.TRIANGLE_STRIP,0,h(l,"geometry")),p.release()}composite(e,t=a.None,s=1,i=o.Standard,p=r.INNER){const m=this._rctx;u.alphaMode=t,u.function=i,u.hasOpacityFactor=1!==s;const l=this._techniqueRepository.acquire(n,u),T=m.useTechnique(l);T.bindTexture(e,"tex"),u.hasOpacityFactor&&T.setUniform1f("opacity",s),i===o.OverlayWithTransparency&&T.setUniform1i("overlayIdx",p);const _=this._ensureVAO();m.bindVAO(_),m.drawArrays(c.TRIANGLE_STRIP,0,h(_,"geometry")),l.release()}_ensureVAO(){return t(this._vao)&&(this._vao=s(this._rctx)),this._vao}}const u=new i;export{p as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../core/Logger.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/set.js";import{subclass as t}from"../../../../core/accessorSupport/decorators/subclass.js";import{ViewingMode as r}from"../../../ViewingMode.js";import{createQuadVAO as i}from"./glUtil3D.js";import{SortedRenderGeometryRenderer as s}from"./SortedRenderGeometryRenderer.js";import{isHeatMapDensityMaterial as a}from"../materials/HeatmapDensityMaterial.js";import{HeatmapTechnique as o}from"../shaders/HeatmapTechnique.js";import{TargetType as n,DepthStencilTargetType as h,TextureType as p,PixelFormat as d,SizedPixelFormat as m,PixelType as c,TextureSamplingMode as l,TextureWrapMode as u,ClearBufferBit as g}from"../../../webgl/enums.js";import{FramebufferObject as R}from"../../../webgl/FramebufferObject.js";import{Texture as f}from"../../../webgl/Texture.js";import{vertexCount as w}from"../../../webgl/Util.js";let x=class extends s{constructor(){super(...arguments),this.type="draped-heatmap",this.pointCount=0}initialize(){super.initialize();const e={colorTarget:n.TEXTURE,depthStencilTarget:h.NONE,width:0,height:0},t={target:p.TEXTURE_2D,pixelFormat:d.RED,internalFormat:m.R32F,dataType:c.FLOAT,samplingMode:l.LINEAR,wrapMode:u.CLAMP_TO_EDGE,width:0,height:0};this.densityMap=new R(this.rctx,e,t),this.quad=i(this.rctx);const s={target:p.TEXTURE_2D,pixelFormat:d.RGBA,dataType:c.UNSIGNED_BYTE,samplingMode:l.LINEAR,wrapMode:u.CLAMP_TO_EDGE,width:8,height:1},a=new f(this.rctx,s,new Uint8ClampedArray([34,34,64,0,78,46,88,255,127,56,100,255,175,68,98,255,212,91,84,255,235,126,63,255,238,168,39,255,221,214,34,255]));this.colorRamp=a,this.technique=new o({rctx:this.rctx,viewingMode:r.Local},null),this.heatmapParameters={colorRamp:a,densityMap:this.densityMap.colorTexture,searchRadius:1,pointCount:this.pointCount}}dispose(){super.dispose(),this.technique.dispose(),this.densityMap.dispose(),this.quad.dispose(),this.colorRamp.dispose()}get hasHighlights(){return!1}get hasWater(){return!1}get rendersOccluded(){return!1}get _heatmapDensityMaterialRenderers(){return this._sortedMaterialRenderers.data.filter(T)}add(e){this.pointCount+=e.length,super.add(e)}remove(e){this.pointCount-=e.length,super.remove(e)}render(e,t){const r=this._heatmapDensityMaterialRenderers;if(r.length<1)return;const i=this.rctx.getBoundFramebufferObject(),s=this.rctx.getViewport();this.densityMap.resize(s.width,s.height),this.rctx.bindFramebuffer(this.densityMap),this.rctx.clear(g.COLOR_BUFFER_BIT);let a=!1;const o=r[0].material.parameters.searchRadius;this.heatmapParameters.pointCount=this.pointCount,this.heatmapParameters.searchRadius=o;for(let n=0;n<r.length;n++){const{material:i,materialRenderer:s}=r[n];i.shouldRender(e)&&(a=a||s.render(t.slot,e.pass,t))}this.rctx.bindFramebuffer(i),a&&(this.rctx.bindVAO(this.quad),this.rctx.useProgram(this.technique.program),this.technique.bindPipelineState(this.rctx),this.technique.bindPass(this.heatmapParameters,t),this.rctx.drawArrays(this.technique.primitiveType,0,w(this.quad,"geometry")))}};function T(e){return a(e.material)}x=e([t("esri.views.3d.webgl-engine.lib.DrapedHeatmapRenderer")],x);export{x as DrapedHeatmapRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{disposeMaybe as e,isSome as i}from"../../../../core/maybe.js";import{c as t}from"../../../../chunks/vec4.js";import{f as r}from"../../../../chunks/vec4f32.js";import{c as o}from"../../../../chunks/vec4f64.js";import
|
|
5
|
+
import{disposeMaybe as e,isSome as i}from"../../../../core/maybe.js";import{c as t}from"../../../../chunks/vec4.js";import{f as r}from"../../../../chunks/vec4f32.js";import{c as o}from"../../../../chunks/vec4f64.js";import s from"../../support/debugFlags.js";import{Default3D as a}from"./DefaultVertexAttributeLocations.js";import{Pos2Tex as l}from"./DefaultVertexBufferLayouts.js";import{createQuadVAO as h}from"./glUtil3D.js";import{H as p}from"../../../../chunks/HighlightComposition.glsl.js";import{HighlightCompositionTechniqueConfiguration as c,HighlightCompositionTechnique as u}from"../shaders/HighlightTechnique.js";import{BufferObject as g}from"../../../webgl/BufferObject.js";import{TargetType as n,DepthStencilTargetType as m,TextureType as d,PixelFormat as b,PixelType as T,TextureSamplingMode as f,TextureWrapMode as v,ClearBufferBit as _,Usage as w,PrimitiveType as O}from"../../../webgl/enums.js";import{FramebufferObject as M}from"../../../webgl/FramebufferObject.js";import{vertexCount as x}from"../../../webgl/Util.js";import{VertexArrayObject as y}from"../../../webgl/VertexArrayObject.js";const R=32;class q{constructor(e,i){this._techniqueRep=e,this._rctx=i,this.viewportToRestore=o(),this.defaultOptions={color:r(1,0,1,1),haloColor:r(1,0,1,1),haloOpacity:1,fillOpacity:.2,haloOpacityOccluded:.25,fillOpacityOccluded:.05,shadowColor:r(1,0,1,1),shadowOpacity:.15,occludedShadowOpacity:.075},this._grid={coverageMipmap:null,vao:null,verticalCellCount:0,horizontalCellCount:0,cellPixelSize:0,mipmapLevels:0,viewportWidth:0,viewportHeight:0}}_assertResources(){if(this.quadVAO)return;this.quadVAO=h(this._rctx);const e={colorTarget:n.TEXTURE,depthStencilTarget:m.NONE,width:0,height:0},i={target:d.TEXTURE_2D,pixelFormat:b.RGBA,dataType:T.UNSIGNED_BYTE,samplingMode:f.LINEAR,wrapMode:v.CLAMP_TO_EDGE,width:0,height:0};this.blur0Fbo=new M(this._rctx,e,i),this.blur1Fbo=new M(this._rctx,e,i);const t=new c;t.highlightStage=p.Blur,t.gridOptimization=!1,this.blurTechnique=this._techniqueRep.acquire(u,t),t.highlightStage=p.Blur,t.gridOptimization=!0,this.blurGridTechnique=this._techniqueRep.acquire(u,t),t.highlightStage=p.Apply,t.gridOptimization=!1,this.applyTechnique=this._techniqueRep.acquire(u,t),t.highlightStage=p.Apply,t.gridOptimization=!0,this.applyGridTechnique=this._techniqueRep.acquire(u,t),t.highlightStage=p.Downsample,t.gridOptimization=!1,this.downsampleTechnique=this._techniqueRep.acquire(u,t)}dispose(){if(this._grid.coverageMipmap)for(let e=1;e<this._grid.coverageMipmap.length;e++)this._grid.coverageMipmap[e].dispose();this._grid.vao&&this._grid.vao.dispose(!0),this.quadVAO&&(this.quadVAO.dispose(!0),this.quadVAO=null),this.blur0Fbo=e(this.blur0Fbo),this.blur1Fbo=e(this.blur1Fbo)}get profilingCallback(){return s.HIGHLIGHTS_PROFILE_TO_CONSOLE?e=>console.log(e):null}setDefaultOptions(e){this.defaultOptions=e}render(e,i,r){const o=e.pixelRatio,a=s.HIGHLIGHTS_GRID_OPTIMIZATION_ENABLED,l=this._rctx;this._assertResources(),t(this.viewportToRestore,e.fullViewport);const h=e.fullWidth,p=e.fullHeight,c=Math.ceil(h/o),u=Math.ceil(p/o);this.blur0Fbo.resize(c,u),this.blur1Fbo.resize(c,u),l.bindVAO(this.quadVAO);let g=null;const n=a?this.blurGridTechnique:this.blurTechnique,m=l.useTechnique(n);a?(this._gridUpdateResources(i,R),this._gridComputeMipmap(),g=this._grid.vao,m.bindTexture(this._grid.coverageMipmap[this._grid.mipmapLevels].colorTexture,"coverageTex")):g=this.quadVAO,l.bindVAO(g),l.bindFramebuffer(this.blur0Fbo),l.setViewport(0,0,c,u),l.setClearColor(0,0,0,0),l.clear(_.COLOR_BUFFER_BIT),m.bindTexture(i.colorTexture,"tex"),m.setUniform2f("blurSize",1/c,0),l.drawArrays(n.primitiveType,0,x(g,"geometry")),l.bindFramebuffer(this.blur1Fbo),l.clear(_.COLOR_BUFFER_BIT),m.bindTexture(this.blur0Fbo.colorTexture,"tex"),m.setUniform2f("blurSize",0,1/u),l.drawArrays(n.primitiveType,0,x(g,"geometry")),l.bindFramebuffer(r),l.setViewport(this.viewportToRestore[0],this.viewportToRestore[1],this.viewportToRestore[2],this.viewportToRestore[3]);const d=a?this.applyGridTechnique:this.applyTechnique,b=l.useTechnique(d);if(b.bindTexture(this.blur1Fbo.colorTexture,"tex"),b.bindTexture(i.colorTexture,"origin"),a){const e=this._grid.coverageMipmap[this._grid.mipmapLevels].colorTexture;b.bindTexture(e,"coverageTex")}d.bindApplyPass(this.defaultOptions),l.drawArrays(d.primitiveType,0,x(g,"geometry")),l.bindVAO(null)}_gridUpdateResources(e,i){const t=this._rctx,r=this._grid;let o=!1;if(null===r.coverageMipmap&&(r.coverageMipmap=[e],o=!0),r.viewportWidth===e.width&&r.viewportHeight===e.height||(o=!0,r.viewportWidth=e.width,r.viewportHeight=e.height),r.coverageMipmap[0]=e,r.cellPixelSize!==i&&(r.cellPixelSize=i,o=!0),o){for(let e=1;e<r.coverageMipmap.length;e++)r.coverageMipmap[e].dispose();r.mipmapLevels=Math.ceil(Math.log(r.cellPixelSize)*Math.LOG2E),r.coverageMipmap.length=r.mipmapLevels+1;for(let e=0;e<r.mipmapLevels;e++){const i=r.coverageMipmap[e],o={target:d.TEXTURE_2D,pixelFormat:b.RGB,dataType:T.UNSIGNED_SHORT_5_6_5,samplingMode:f.LINEAR,wrapMode:v.CLAMP_TO_EDGE,width:Math.ceil(i.width/2),height:Math.ceil(i.height/2)},s={colorTarget:n.TEXTURE,depthStencilTarget:m.NONE,width:Math.ceil(i.width/2),height:Math.ceil(i.height/2)};r.coverageMipmap[e+1]=new M(t,s,o)}}const s=Math.ceil(e.height/r.cellPixelSize),h=Math.ceil(e.width/r.cellPixelSize);if(!r.vao||r.verticalCellCount!==s||r.horizontalCellCount!==h){r.verticalCellCount=s,r.horizontalCellCount=h;const e=s+1,i=h+1,o=1/s,p=1/h,c=6,u=4,n=new Float32Array(c*u*e*i);let m=0;for(let t=0;t<e;t++)for(let e=0;e<i;e++)n[m+0]=(e-.5)*p*2-1,n[m+1]=(t-.5)*o*2-1,n[m+2]=e*p,n[m+3]=t*o,n[m+4]=(e+.5)*p*2-1,n[m+5]=(t-.5)*o*2-1,n[m+6]=e*p,n[m+7]=t*o,n[m+8]=(e-.5)*p*2-1,n[m+9]=(t+.5)*o*2-1,n[m+10]=e*p,n[m+11]=t*o,n[m+12]=(e-.5)*p*2-1,n[m+13]=(t+.5)*o*2-1,n[m+14]=e*p,n[m+15]=t*o,n[m+16]=(e+.5)*p*2-1,n[m+17]=(t-.5)*o*2-1,n[m+18]=e*p,n[m+19]=t*o,n[m+20]=(e+.5)*p*2-1,n[m+21]=(t+.5)*o*2-1,n[m+22]=e*p,n[m+23]=t*o,m+=c*u;r.vao&&r.vao.dispose(!0),r.vao=new y(t,a,{geometry:l},{geometry:g.createVertex(t,w.STATIC_DRAW,n)})}}_gridComputeMipmap(){const e=this._rctx,i=this._grid,t=e.useTechnique(this.downsampleTechnique);e.bindVAO(this.quadVAO);for(let r=0;r<i.mipmapLevels;r++){e.bindFramebuffer(i.coverageMipmap[r+1]),t.bindTexture(i.coverageMipmap[r].colorTexture,"tex");const o=i.coverageMipmap[r+1].width,s=i.coverageMipmap[r+1].height;t.setUniform2f("invFramebufferDim",1/o,1/s),e.setViewport(0,0,o,s),e.drawArrays(O.TRIANGLE_STRIP,0,x(this.quadVAO,"geometry"))}}get gpuMemoryUsage(){let e=(i(this.blur0Fbo)?this.blur0Fbo.gpuMemoryUsage:0)+(i(this.blur1Fbo)?this.blur1Fbo.gpuMemoryUsage:0);if(this._grid.coverageMipmap)for(const i of this._grid.coverageMipmap)e+=i.gpuMemoryUsage;return e}get test(){return{coverage:this._grid.coverageMipmap,blur:[this.blur0Fbo,this.blur1Fbo]}}}export{q as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{RenderingContext as e}from"../../../webgl/RenderingContext.js";class t extends e{constructor(e,t,
|
|
5
|
+
import{RenderingContext as e}from"../../../webgl/RenderingContext.js";class t extends e{constructor(e,t,r){super(e,t),this.newCache=r,this._refCount=1}dispose(){--this._refCount>0||super.dispose()}ref(){++this._refCount}useTechnique(e,t=null,r){return this.useProgram(e.program),e.bindPipelineState(this,t,r),e.program}get test(){return this.programCache.test}}export{t as RenderingContext};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{disposeMaybe as e,applySome as t,isSome as s,isNone as i}from"../../../../core/maybe.js";import{a as r}from"../../../../chunks/vec2f64.js";import{i as h}from"../../../../chunks/vec3.js";import{c as o}from"../../../../chunks/vec4f64.js";import{requestImage as
|
|
5
|
+
import{disposeMaybe as e,applySome as t,isSome as s,isNone as i}from"../../../../core/maybe.js";import{a as r}from"../../../../chunks/vec2f64.js";import{i as h}from"../../../../chunks/vec3.js";import{c as o}from"../../../../chunks/vec4f64.js";import{requestImage as n}from"../../../../support/requestImageUtils.js";import{createQuadVAO as a}from"./glUtil3D.js";import{SSAOTechniqueConfiguration as u,SSAOTechnique as l}from"./SSAOTechnique.js";import{inverseProjectionInfo as _}from"./Util.js";import{S as b}from"../../../../chunks/SSAO.glsl.js";import{PrimitiveType as m,TextureType as c,PixelFormat as d,PixelType as f,TextureSamplingMode as p,TextureWrapMode as O,TargetType as T,DepthStencilTargetType as F}from"../../../webgl/enums.js";import{FramebufferObject as x}from"../../../webgl/FramebufferObject.js";import{Texture as B}from"../../../webgl/Texture.js";import{vertexCount as g}from"../../../webgl/Util.js";class S{constructor(e,t,s){this._techniqueRep=e,this._rctx=t,this._requestRender=s,this._enabled=!1,this._ssaoTechniqueConfig=new u,this.quadVAO=null,this._blurSizePx=2,this._attenuation=.5}dispose(){this.quadVAO=e(this.quadVAO)}disposeOffscreenBuffers(){t(this._ssaoFBO,(e=>e.resize(0,0))),t(this._blur0FBO,(e=>e.resize(0,0))),t(this._blur1FBO,(e=>e.resize(0,0)))}set enabled(e){e?this._enable():this._disable()}get enabled(){return this._enabled}get ready(){return this.enabled&&s(this._noiseTexture)&&s(this._ssaoFBO)&&s(this._blur0FBO)&&s(this._blur1FBO)}computeSSAO(e,t,s){if(!this.enabled||i(t)||i(s)||i(this._noiseTexture)||i(this._ssaoFBO)||i(this._blur0FBO)||i(this._blur1FBO))return;const r=this._rctx,o=e.fullViewport,n=o[2],u=o[3],l=n/this._blurSizePx,b=u/this._blurSizePx;this._ssaoFBO.resize(n,u),this._blur0FBO.resize(l,b),this._blur1FBO.resize(l,b);const c=1,d=1,f=n*c,p=u*d;r.bindFramebuffer(this._ssaoFBO),r.setViewport(0,0,n,u);const O=r.useTechnique(this._ssaoTechnique);O.setUniform2f("rnmScale",n/this._noiseTexture.descriptor.width,u/this._noiseTexture.descriptor.height),_(e.projectionMatrix,e.fullWidth,e.fullHeight,A,q),O.setUniform4fv("projInfo",A),O.setUniform2fv("zScale",q),O.setUniform2fv("nearFar",e.nearFar);let T=1/e.computeRenderPixelSizeAtDist(1);O.setUniform1f("projScale",T*c),O.setUniform2f("screenDimensions",f,p);const F=h(e.eye,e.center);let x=20*e.computeRenderPixelSizeAtDist(F);x=Math.max(.1,x),O.setUniform1f("radius",x),O.setUniform1f("intensity",4*this._attenuation/x**6),O.bindTexture(this._noiseTexture,"rnm"),O.bindTexture(s,"normalMap"),O.bindTexture(t,"depthMap"),i(this.quadVAO)&&(this.quadVAO=a(this._rctx)),r.bindVAO(this.quadVAO),r.drawArrays(m.TRIANGLE_STRIP,0,g(this.quadVAO,"geometry"));const B=r.useTechnique(this._blurTechnique);B.bindTexture(this._ssaoFBO.colorTexture,"tex"),B.bindTexture(s,"normalMap"),B.bindTexture(t,"depthMap"),r.setViewport(0,0,f/this._blurSizePx,p/this._blurSizePx),r.bindFramebuffer(this._blur0FBO),B.setUniform2f("screenDimensions",f,p),B.setUniform2f("blurSize",0,this._blurSizePx*c/p),B.setUniform2fv("nearFar",e.nearFar),F>5e4&&(T=Math.max(0,T-(F-5e4))),B.setUniform1f("projScale",T),r.drawArrays(m.TRIANGLE_STRIP,0,g(this.quadVAO,"geometry")),B.setUniform2f("blurSize",this._blurSizePx*d/f,0),r.bindFramebuffer(this._blur1FBO),B.bindTexture(this._blur0FBO.colorTexture,"tex"),r.drawArrays(m.TRIANGLE_STRIP,0,g(this.quadVAO,"geometry")),r.setViewport(o[0],o[1],o[2],o[3])}bind(e,t){this.enabled&&s(this._blur1FBO)&&s(this._ssaoFBO)?(e.bindTexture(this._blur1FBO.colorTexture,"ssaoTex"),e.setUniform4f("viewportPixelSz",t.fullViewport[0],t.fullViewport[1],1/this._ssaoFBO.width,1/this._ssaoFBO.height)):e.setUniform4f("viewportPixelSz",-1,-1,-1,-1)}_selectPrograms(){this._ssaoTechniqueConfig.output=b.SSAO,this._ssaoTechnique=this._techniqueRep.releaseAndAcquire(l,this._ssaoTechniqueConfig,this._ssaoTechnique),this._ssaoTechniqueConfig.output=b.Blur,this._blurTechnique=this._techniqueRep.releaseAndAcquire(l,this._ssaoTechniqueConfig,this._blurTechnique)}_enable(){this.enabled||(this._enabled=!0,this._loadResources((()=>{this._enabled&&this._initialize()})))}_loadResources(e){this._data?e():import("./SSAOHelperData.js").then((t=>{this._data=t,e()}))}_initialize(){const e={target:c.TEXTURE_2D,pixelFormat:d.RGBA,dataType:f.UNSIGNED_BYTE,samplingMode:p.LINEAR,wrapMode:O.CLAMP_TO_EDGE,width:0,height:0},t={colorTarget:T.TEXTURE,depthStencilTarget:F.NONE};n(this._data.noiseTexture).then((s=>{this._enabled&&(this._ssaoFBO=new x(this._rctx,t,e),this._blur0FBO=new x(this._rctx,t,e),this._blur1FBO=new x(this._rctx,t,e),this._noiseTexture=new B(this._rctx,{target:c.TEXTURE_2D,pixelFormat:d.RGBA,dataType:f.UNSIGNED_BYTE,hasMipmap:!0,width:s.width,height:s.height},s),this._requestRender())})),this._selectPrograms()}_disable(){this._enabled=!1,this._noiseTexture=e(this._noiseTexture),this._blur1FBO=e(this._blur1FBO),this._blur0FBO=e(this._blur0FBO),this._ssaoFBO=e(this._ssaoFBO)}get gpuMemoryUsage(){return(s(this._blur0FBO)?this._blur0FBO.gpuMemoryUsage:0)+(s(this._blur1FBO)?this._blur1FBO.gpuMemoryUsage:0)+(s(this._ssaoFBO)?this._ssaoFBO.gpuMemoryUsage:0)}get test(){return{ssao:this._ssaoFBO,blur:this._blur1FBO}}}const q=r(),A=o();export{S as SSAOHelper};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{equals as i}from"../../../../core/arrayUtils.js";import s from"../../../../core/Handles.js";import{smoothstep as r}from"../../../../core/mathUtils.js";import{isNone as a,disposeMaybe as o}from"../../../../core/maybe.js";import{watch as n,syncAndInitial as h}from"../../../../core/reactiveUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../../core/accessorSupport/decorators/subclass.js";import{j as u,a as l}from"../../../../chunks/mat4.js";import{c as m}from"../../../../chunks/mat4f64.js";import{a as p}from"../../../../chunks/vec2f64.js";import{y as d,g}from"../../../../chunks/vec3.js";import{c as f}from"../../../../chunks/vec3f64.js";import{c as w}from"../../../../chunks/vec4f64.js";import v from"./Camera.js";import{ZERO as b}from"./depthRange.js";import{createQuadVAO as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{equals as i}from"../../../../core/arrayUtils.js";import s from"../../../../core/Handles.js";import{smoothstep as r}from"../../../../core/mathUtils.js";import{isNone as a,disposeMaybe as o}from"../../../../core/maybe.js";import{watch as n,syncAndInitial as h}from"../../../../core/reactiveUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../../core/accessorSupport/decorators/subclass.js";import{j as u,a as l}from"../../../../chunks/mat4.js";import{c as m}from"../../../../chunks/mat4f64.js";import{a as p}from"../../../../chunks/vec2f64.js";import{y as d,g}from"../../../../chunks/vec3.js";import{c as f}from"../../../../chunks/vec3f64.js";import{c as w}from"../../../../chunks/vec4f64.js";import v from"./Camera.js";import{ZERO as b}from"./depthRange.js";import{createQuadVAO as j}from"./glUtil3D.js";import{ShadowCastRenderer as S,shadowCastDisabledElevationThreshold as y,shadowCastDisableElevationMax as A,shadowCastDisableElevationMin as C}from"./ShadowCastRenderer.js";import R from"./ShadowMap.js";import{inverseProjectionInfo as T}from"./Util.js";import{S as D,s as F}from"../../../../chunks/ShadowCast.glsl.js";import{ShadowCastTechniqueConfiguration as E,ShadowCastTechnique as M}from"../shaders/ShadowCastTechnique.js";import{TaskPriority as x}from"../../../support/Scheduler.js";import{TargetType as P,DepthStencilTargetType as q,TextureType as U,PixelFormat as V,PixelType as I,TextureSamplingMode as k,TextureWrapMode as L,ClearBufferBit as O}from"../../../webgl/enums.js";import{FramebufferObject as N}from"../../../webgl/FramebufferObject.js";import{vertexCount as z}from"../../../webgl/Util.js";var B;let H=B=class extends t{constructor(e,t,i,r,o,c){super({}),this._rctx=e,this._stage=i,this._prepareForShadowMapPass=r,this._renderToShadowMap=o,this._requestRender=c,this._progress=0,this._sampleCount=0,this._cachedCamera=new v,this._contentCamera=new v,this._enabled=!1,this._cachedLightDirections=[],this._depthRange=b,this._previewing=!1,this._handles=new s,this._cameraForcedForScreenshot=!1,this._shadowMap=new R(e,i.viewingMode),this._shadowMap.enabled=!0,this._vao=j(e);const _={colorTarget:P.TEXTURE,depthStencilTarget:q.NONE,width:0,height:0},u={target:U.TEXTURE_2D,pixelFormat:V.RGBA,dataType:I.UNSIGNED_BYTE,samplingMode:k.LINEAR,wrapMode:L.CLAMP_TO_EDGE,width:0,height:0};this._fbo=new N(e,_,u),this._accumulationParams={camera:this._cachedCamera,linearDepthTexture:null,shadowMap:this._shadowMap,inverseViewMatrix:m(),projInfo:w(),zScale:p()},this._accumulationRenderer=new S(t,e,this,c);const l=this._stage.resourceController.scheduler;this._handles.add(l.registerTask(x.SHADOW_ACCUMULATOR,this)),this._handles.add(n((()=>i.renderView),(e=>{this._handles.remove(B.renderViewHandleKey),a(e)||this._handles.add(e.events.on("force-camera-for-screenshot",(()=>this._cameraForcedForScreenshot=!0)),B.renderViewHandleKey)}),h))}normalizeCtorArgs(){return{}}get computedSamples(){return this._progress}get shadowCastTexture(){return this._fbo.colorTexture}get isAccumulating(){return this._isPreviewing||this._isRefining}get accumulationTechnique(){if(a(this._accumulationTechnique)){const e={rctx:this._rctx,viewingMode:this._stage.viewingMode},t=new E;t.pass=D.Accumulate,this._accumulationTechnique=new M(e,t)}return this._accumulationTechnique}get _isRefining(){return this._isActive&&!this._isDoneAccumulating&&!this._previewing}get _isPreviewing(){return this._isActive&&this._previewing}get _isActive(){return this._enabled&&this._sampleCount>0}get _canAccumulate(){return null!==this._accumulationParams.linearDepthTexture&&this._depthRange!==b&&this._opacityFromElevation>y}get _isDoneAccumulating(){return this._progress>=this._sampleCount}get _lightDirections(){return this._cachedLightDirections}set _lightDirections(e){const t=this._cachedLightDirections;if(i(t,e,d))return;const s=e.length;t.length=s,this._sampleCount=Math.min(F,s);for(let i=0;i<s;++i){const s=e[i],r=t[i]||f();g(r,s),t[i]=r}this._invalidate()}get _projInfo(){return this._accumulationParams.projInfo}get _zScale(){return this._accumulationParams.zScale}get _inverseView(){return this._accumulationParams.inverseViewMatrix}get _opacityFromElevation(){return this._accumulationRenderer.opacityFromElevation}set _opacityFromElevation(e){this._accumulationRenderer.opacityFromElevation=e}get running(){return this._isRefining&&this._canAccumulate&&this._progress>0}runTask(e){for(this._prepareForShadowMapPass(this._cachedCamera,this._contentCamera);!e.done&&!this._isDoneAccumulating;)this._accumulateShadow(),e.madeProgress();this._requestRender()}accumulateFixedSamples(){if(!this.isAccumulating||!this._canAccumulate)return;(this._previewing||0===this._progress||this._cameraForcedForScreenshot)&&this._clear();const e=this._cameraForcedForScreenshot?this._sampleCount:Math.min(B.previewSamples,this._sampleCount-this._progress);for(let t=0;t<e;++t)this._accumulateShadow();this._cameraForcedForScreenshot=!1}render(){this._accumulationRenderer.render()}dispose(){this._stop(),this._handles.destroy(),this._accumulationRenderer=o(this._accumulationRenderer),this._shadowMap=o(this._shadowMap),this._fbo=o(this._fbo),this._vao=o(this._vao),this._accumulationTechnique=o(this._accumulationTechnique),this._cachedLightDirections.length=0,this._sampleCount=0}setOptions(e){void 0!==e.enabled&&this._setEnabled(e.enabled),void 0!==e.previewing&&this.setPreviewing(e.previewing),void 0!==e.lightDirections&&this.setLightDirections(e.lightDirections),this._accumulationRenderer.setOptions(e)}setPreviewing(e){this._previewing!==e&&(this._previewing=e,this._requestRenderIfEnabled())}setLightDirections(e){this._lightDirections=e}setAccumulationDependencies(e,t,i,s){this._accumulationParams.linearDepthTexture=e,this._depthRange=t,this._updateCamera(i),this._contentCamera=s,this.notifyChange("_canAccumulate")}readAccumulatedShadow(e,t){if(!this._isActive||this._progress<1||e<0||e>this._fbo.width||t<0||t>this._fbo.height)return 0;const i=G;return this._fbo.readPixels(e,t,1,1,V.RGBA,I.UNSIGNED_BYTE,i),i[0]/this._progress}_start(){this._progress=0,this._enabled=!0}_stop(){this._enabled=!1}_invalidate(){this._progress=0,this._requestRenderIfEnabled()}_clear(){this._rctx.bindFramebuffer(this._fbo),this._rctx.setClearColor(0,0,0,0),this._rctx.clearSafe(O.COLOR_BUFFER_BIT),this._progress=0}_accumulateShadow(){const e=this._lightDirections[this._progress],t=this._cachedCamera;this._renderToShadowMap(this._shadowMap,e,t,this._depthRange),this._rctx.bindFramebuffer(this._fbo);const i=this.accumulationTechnique;this._rctx.useTechnique(i),i.bindPass(this._accumulationParams),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(i.primitiveType,0,z(this._vao,"geometry")),this._progress++}_updateCamera(e){if(e.equals(this._cachedCamera))return;const{fullWidth:t,fullHeight:i,projectionMatrix:s,viewMatrix:a,center:o}=e;this._cachedCamera.copyFrom(e),this._fbo.resize(t,i),T(s,t,i,this._projInfo,this._zScale),u(this._inverseView,a,o),l(this._inverseView,this._inverseView),this._opacityFromElevation=1-r(C,A,e.relativeElevation)}_setEnabled(e){e!==this._enabled&&(e?this._start():this._stop())}_requestRenderIfEnabled(){this._enabled&&this._requestRender()}get test(){return{lightDirections:this._lightDirections,isDone:()=>this._isDoneAccumulating,isActive:()=>this._isActive}}};H.previewSamples=6,H.renderViewHandleKey="renderView",e([c()],H.prototype,"_progress",void 0),e([c()],H.prototype,"_sampleCount",void 0),e([c()],H.prototype,"_enabled",void 0),e([c()],H.prototype,"_depthRange",void 0),e([c()],H.prototype,"_previewing",void 0),e([c()],H.prototype,"_accumulationRenderer",void 0),e([c()],H.prototype,"_isRefining",null),e([c()],H.prototype,"_isActive",null),e([c()],H.prototype,"_canAccumulate",null),e([c()],H.prototype,"_isDoneAccumulating",null),e([c()],H.prototype,"_opacityFromElevation",null),e([c()],H.prototype,"running",null),H=B=e([_("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],H);const G=new Uint8Array(4);export{H as ShadowAccumulator};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import i from"../../../../core/Accessor.js";import{disposeMaybe as t}from"../../../../core/maybe.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{g as o,c as r}from"../../../../chunks/vec4.js";import{f as n}from"../../../../chunks/vec4f64.js";import{createQuadVAO as h}from"./glUtil3D.js";import{S as l,a as u}from"../../../../chunks/ShadowCast.glsl.js";import{ShadowCastTechniqueConfiguration as _,ShadowCastTechnique as c}from"../shaders/ShadowCastTechnique.js";import{vertexCount as d}from"../../../webgl/Util.js";const m=n(.01,0,.25,1),p=4e4,v=5e4,b=1/512;let
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import i from"../../../../core/Accessor.js";import{disposeMaybe as t}from"../../../../core/maybe.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{g as o,c as r}from"../../../../chunks/vec4.js";import{f as n}from"../../../../chunks/vec4f64.js";import{createQuadVAO as h}from"./glUtil3D.js";import{S as l,a as u}from"../../../../chunks/ShadowCast.glsl.js";import{ShadowCastTechniqueConfiguration as _,ShadowCastTechnique as c}from"../shaders/ShadowCastTechnique.js";import{vertexCount as d}from"../../../webgl/Util.js";const m=n(.01,0,.25,1),p=4e4,v=5e4,b=1/512;let q=class extends i{constructor(e,i,t,s){super({}),this._techniqueRepository=e,this._rctx=i,this._shadowAccumulator=t,this._requestRender=s,this._visualizationParams={shadowCastMap:this._shadowCastTexture,sampleScale:0,color:m,threshold:.5,bandSize:.1,opacityFromElevation:1},this._techniqueConfig=new _,this._enabled=!1,this._vao=h(i),this._techniqueConfig.pass=l.Visualize,this._techniqueConfig.visualization=u.Gradient}normalizeCtorArgs(){return{}}dispose(){this._stop(),this._vao=t(this._vao),this._techniqueRepository.release(this._technique),this._technique=null,this._shadowAccumulator=null}get visualizeShadowCastTechnique(){return this._technique=this._techniqueRepository.releaseAndAcquire(c,this._techniqueConfig,this._technique),this._technique}render(){if(!this._isRenderingVisualization)return;this._sampleScale=1/this._computedSamples,this._rctx.bindVAO(this._vao);const e=this.visualizeShadowCastTechnique;this._rctx.useTechnique(e),e.bindPass(this._visualizationParams),this._rctx.drawArrays(e.primitiveType,0,d(this._vao,"geometry"))}setOptions(e){void 0!==e.enabled&&this._setEnabled(e.enabled),void 0!==e.color&&this._setColor(e.color),void 0!==e.threshold&&(this._threshold=e.threshold),void 0!==e.visualization&&(this._visualization=e.visualization),void 0!==e.bandSize&&(this._bandSize=e.bandSize),void 0!==e.bandsEnabled&&(this._bandsEnabled=e.bandsEnabled)}get opacityFromElevation(){return this._visualizationParams.opacityFromElevation}set opacityFromElevation(e){this._visualizationParams.opacityFromElevation!==e&&(this._visualizationParams.opacityFromElevation=e,this.notifyChange("opacityFromElevation"))}get _isRenderingVisualization(){return this._enabled&&this._computedSamples>0&&this.opacityFromElevation>b}get _computedSamples(){return this._shadowAccumulator.computedSamples}get _shadowCastTexture(){return this._shadowAccumulator.shadowCastTexture}get _sampleScale(){return this._visualizationParams.sampleScale}set _sampleScale(e){this._visualizationParams.sampleScale=e}get _threshold(){return this._visualizationParams.threshold}set _threshold(e){this._threshold!==e&&(this._visualizationParams.threshold=e,this._requestRenderIfRunning())}get _visualization(){return this._techniqueConfig.visualization}set _visualization(e){e!==this._visualization&&(this._techniqueConfig.visualization=e,this._techniqueRepository.release(this._technique),this._technique=null,this._requestRenderIfRunning())}get _bandSize(){return this._visualizationParams.bandSize}set _bandSize(e){e!==this._bandSize&&(this._visualizationParams.bandSize=e,this._requestRenderIfRunning())}get _bandsEnabled(){return this._techniqueConfig.bandsEnabled}set _bandsEnabled(e){e!==this._bandsEnabled&&(this._techniqueConfig.bandsEnabled=e,this._techniqueRepository.release(this._technique),this._technique=null,this._requestRenderIfRunning())}_setColor(e){const i=this._visualizationParams.color;o(e,i)||(r(this._visualizationParams.color,e),this._requestRenderIfRunning())}_setEnabled(e){e!==this._enabled&&(e?this._start():this._stop())}_requestRenderIfRunning(){this._enabled&&this._requestRender()}_start(){this._enabled=!0,this._requestRender()}_stop(){this._enabled=!1,this._requestRender()}};e([s()],q.prototype,"opacityFromElevation",null),q=e([a("esri.views.3d.webgl-engine.lib.ShadowCastRenderer")],q);export{q as ShadowCastRenderer,v as shadowCastDisableElevationMax,p as shadowCastDisableElevationMin,b as shadowCastDisabledElevationThreshold};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{smoothstep as t,clamp as i}from"../../../../core/mathUtils.js";import{isNone as e,disposeMaybe as
|
|
5
|
+
import{smoothstep as t,clamp as i}from"../../../../core/mathUtils.js";import{isNone as e,disposeMaybe as s}from"../../../../core/maybe.js";import{n as a,s as r,d as o}from"../../../../chunks/vec3.js";import{c as h}from"../../../../chunks/vec3f64.js";import{f as c}from"../../../../chunks/vec4f32.js";import{ViewingMode as n}from"../../../ViewingMode.js";import{createQuadVAO as m}from"./glUtil3D.js";import{ShadowHighlightTechnique as p}from"../shaders/ShadowHighlightTechnique.js";import{vertexCount as _}from"../../../webgl/Util.js";const d=.001953125,l=4e4,u=5e4;class g{constructor(t,i){this._rctx=t,this._viewingMode=i,this._maxOpacity=1,this._parameters={shadowColor:c(1,0,1,1),shadowOpacity:.2,occludedShadowOpacity:.1,opacityElevation:1,dayNightTerminator:1},this._vao=m(this._rctx)}get technique(){return e(this._technique)&&(this._technique=new p({rctx:this._rctx,viewingMode:this._viewingMode},null)),this._technique}render(t,i){if(this._updateParameters(t),!t.shadowMap.enabled||!t.linearDepthTexture||!this.isVisible)return;const e=this.technique;this._rctx.bindFramebuffer(i),this._rctx.useTechnique(e),e.bindPass(this._parameters,t),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(e.primitiveType,0,_(this._vao,"geometry"))}get gpuMemoryUsage(){var t,i;return null!=(t=null==(i=this._vao)?void 0:i.size)?t:0}setDefaultOptions(t){this._parameters={...this._parameters,...t},this._updateMaxOpacity()}_updateParameters(e){this._parameters.opacityElevation=1-t(l,u,e.camera.relativeElevation);const s=this._viewingMode===n.Global?a(v,e.camera.center):r(v,0,0,1),h=o(s,e.lighting.lightingMainDirection);this._parameters.dayNightTerminator=t(0,1,i(30*h,0,1))}dispose(){this._vao=s(this._vao),this._technique=s(this._technique)}get isVisible(){return this._maxOpacity*this._parameters.opacityElevation*this._parameters.dayNightTerminator>=d}_updateMaxOpacity(){const t=this._parameters,i=t.shadowColor,e=Math.max(t.shadowOpacity,t.occludedShadowOpacity);this._maxOpacity=e*i[3]}}const v=h();export{g as ShadowHighlightHelper};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{abortMaybe as r,isSome as s,disposeMaybe as i}from"../../../../core/maybe.js";import{throwIfAborted as o,isAborted as h}from"../../../../core/promiseUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{abortMaybe as r,isSome as s,disposeMaybe as i}from"../../../../core/maybe.js";import{throwIfAborted as o,isAborted as h}from"../../../../core/promiseUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{requestImage as l}from"../../../../support/requestImageUtils.js";import{createScreenSizeTriangleVAO as u}from"./glUtil3D.js";import{SMAATechniqueConfiguration as d,SMAATechnique as c}from"./SMAATechnique.js";import{S as _}from"../../../../chunks/SMAA.glsl.js";import{TextureSamplingMode as T,PixelFormat as p,TargetType as b,DepthStencilTargetType as g,TextureType as m,PixelType as E,TextureWrapMode as x,ClearBufferBit as f,PrimitiveType as w}from"../../../webgl/enums.js";import{FramebufferObject as A}from"../../../webgl/FramebufferObject.js";import{Texture as R}from"../../../webgl/Texture.js";let C=class extends t{constructor(e,t){super({}),this.rctx=e,this._techniqueRep=t,this._isEnabled=!1}normalizeCtorArgs(){return{}}dispose(){this._abortController=r(this._abortController),this.disable()}_loadResources(e){if(s(this._abortController))return!1;if(s(this._searchTexture))return!0;this._abortController=new AbortController;const t=this._abortController.signal;return import("./SmaaRenderPassData.js").then((e=>this._loadTextures(e,t))).then((()=>e())).finally((()=>this._abortController=null)),!1}_loadTextures(e,t){return o(t),Promise.all([this._loadTextureFromBase64(e.areaTexture,T.LINEAR,p.RGB),this._loadTextureFromBase64(e.searchTexure,T.NEAREST,p.LUMINANCE)]).then((([e,r])=>{h(t)?(e.dispose(),r.dispose(),o(t)):(this._areaTexture=e,this._searchTexture=r)}))}get updating(){return s(this._abortController)}enable(e){if(this._isEnabled)return!0;if(!this._edgeDetectTechnique||!this._blendWeightsTechnique||!this._blurTechnique){const e=new d,t=(e,t)=>this._techniqueRep.releaseAndAcquire(c,e,t);e.output=_.EdgeDetector,this._edgeDetectTechnique=t(e,this._edgeDetectTechnique),e.output=_.BlendWeight,this._blendWeightsTechnique=t(e,this._blendWeightsTechnique),e.output=_.Blur,this._blurTechnique=t(e,this._blurTechnique)}return!!this._loadResources(e)&&(this._vao=u(this.rctx),this._edges=new A(this.rctx,{colorTarget:b.TEXTURE,depthStencilTarget:g.NONE},{target:m.TEXTURE_2D,pixelFormat:p.RGB,dataType:E.UNSIGNED_BYTE,samplingMode:T.LINEAR,wrapMode:x.CLAMP_TO_EDGE,width:4,height:4}),this._blend=new A(this.rctx,{colorTarget:b.TEXTURE,depthStencilTarget:g.NONE},{target:m.TEXTURE_2D,pixelFormat:p.RGBA,dataType:E.UNSIGNED_BYTE,samplingMode:T.LINEAR,wrapMode:x.CLAMP_TO_EDGE,width:4,height:4}),this._isEnabled=!0,!0)}disable(){this._isEnabled&&(this._vao=i(this._vao),this._areaTexture=i(this._areaTexture),this._searchTexture=i(this._searchTexture),this._blend=i(this._blend),this._edges=i(this._edges),this._isEnabled=!1)}render(e){if(!this._isEnabled)return;const t=this.rctx,r=t.getBoundFramebufferObject(),s={x:0,y:0,width:e.descriptor.width,height:e.descriptor.height};t.bindVAO(this._vao),t.setViewport(s.x,s.y,s.width,s.height),this._edges.resize(s.width,s.height),t.bindFramebuffer(this._edges),t.setClearColor(0,0,0,1),t.clear(f.COLOR_BUFFER_BIT);const i=t.useTechnique(this._edgeDetectTechnique);i.bindTexture(e,"tColor"),i.setUniform4f("resolution",1/s.width,1/s.height,s.width,s.height),t.drawArrays(w.TRIANGLES,0,3),this._blend.resize(s.width,s.height),t.bindFramebuffer(this._blend),t.setClearColor(0,0,1,1),t.clear(f.COLOR_BUFFER_BIT);const o=t.useTechnique(this._blendWeightsTechnique);o.setUniform4f("resolution",1/s.width,1/s.height,s.width,s.height),o.bindTexture(this._searchTexture,"tSearch"),o.bindTexture(this._areaTexture,"tArea"),o.bindTexture(this._edges.colorTexture,"tEdges"),t.drawArrays(w.TRIANGLES,0,3),t.bindFramebuffer(r),t.setClearColor(0,1,0,1),t.clear(f.COLOR_BUFFER_BIT);const h=t.useTechnique(this._blurTechnique);h.setUniform4f("resolution",1/s.width,1/s.height,s.width,s.height),h.bindTexture(e,"tColor"),h.bindTexture(this._blend.colorTexture,"tBlendWeights"),t.drawArrays(w.TRIANGLES,0,3)}_loadTextureFromBase64(e,t,r){const s=new R(this.rctx,{pixelFormat:r,dataType:E.UNSIGNED_BYTE,wrapMode:x.CLAMP_TO_EDGE,samplingMode:t},null);return l(e).then((e=>(s.resize(e.width,e.height),s.setData(e),s)))}};e([a()],C.prototype,"_abortController",void 0),e([a({readOnly:!0})],C.prototype,"updating",null),C=e([n("esri.views.3d.webgl-engine.lib.SmaaRenderPass")],C);export{C as SmaaRenderPass};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import o from"../../../../Color.js";import
|
|
5
|
+
import o from"../../../../Color.js";import r from"../../../../core/Logger.js";import{get as t,mapOr as e,isSome as i}from"../../../../core/maybe.js";import{pt2px as n}from"../../../../core/screenUtils.js";import{Z as s}from"../../../../chunks/vec4f64.js";import{enableTextBackgrounds3D as l}from"../../../../support/featureFlags.js";const a=r.getLogger("esri.views.3d.webgl-engine.lib.TextRenderParameters");class c{constructor(o){this.definition=o,this.key=JSON.stringify(o),this.haloSize=Math.round(o.halo.size),this.textStyle=this._colorToRGBA(o.color),this.haloStyle=this._colorToRGB(o.halo.color),this.backgroundStyle=l()&&0!==o.background.color[3]?this._colorToRGBA(o.background.color):null}fontString(o){const r=this.definition.font;return`${r.style} ${r.weight} ${o}px ${r.family}, sans-serif`}_colorToRGB(o){return`rgb(${o.slice(0,3).map((o=>Math.floor(255*o))).toString()})`}_colorToRGBA(o){return`rgba(${o.slice(0,3).map((o=>Math.floor(255*o))).toString()},${o[3]})`}static async fromSymbol(r,f=1){const g=t(r,"material","color"),m=e(g,s,o.toUnitRGBA),d=e(r.size,12,n),h=r.lineHeight,u=l(),b=u&&i(r.background)?o.toUnitRGBA(r.background.color):s,y={family:e(r.font,"sans-serif",(o=>o.family)),decoration:e(r.font,"none",(o=>o.decoration)),weight:e(r.font,"normal",(o=>o.weight)),style:e(r.font,"normal",(o=>o.style))},p=r.halo,S=i(p)&&i(p.color)&&p.size>0?{size:n(p.size),color:o.toUnitRGBA(p.color)}:{size:0,color:s},R=new c({color:m,size:d,background:{color:b,padding:u&&i(r.background)?[.65*d,.5*d]:[0,0],borderRadius:u&&i(r.background)?d*(6/16):0},lineSpacingFactor:h,font:y,halo:S,pixelRatio:f}),k=R.fontString(d);try{await document.fonts.load(k)}catch(w){a.warnOnce(`Failed to preload font '${k}'. Some text symbology may be rendered using the default browser font.`)}return R}}export{c as TextRenderParameters};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isNone as
|
|
5
|
+
import{clamp as t}from"../../../../core/mathUtils.js";import{isNone as e,isSome as i}from"../../../../core/maybe.js";import{enableTextBackgrounds3D as n}from"../../../../support/featureFlags.js";import s from"../../support/debugFlags.js";class r{constructor(t,e,i=2048){this.text=t,this._parameters=e,this.maxSize=i,this._textWidths=[],this._lineWidths=[],this._renderPixelRatio=null,this._displayWidth=null,this._heightMetrics=null,this._backgroundEnabled=null,this.key=`${this._parameters.key}--${t}`,this._lines=t.split(/\r?\n/)}get displayWidth(){return Math.ceil(this._ensureTextWidth()+2*this.backgroundHorizontalPadding)}get displayHeight(){const t=this.lineSpacing*(this._lines.length-1),e=this.lineHeight;return Math.ceil(t+e+2*this.haloSize+this.backgroundTopPadding+this.backgroundBottomPadding)}get renderedWidth(){return Math.ceil(this._toRenderUnit(this.displayWidth))}get renderedHeight(){return Math.ceil(this._toRenderUnit(this.displayHeight))}get heightMetrics(){return this._ensureHeightMetrics()}get lineSpacing(){return(this.lineHeight+this.linePadding)*this._parameters.definition.lineSpacingFactor}get lineHeight(){return this.heightMetrics.lineHeight}get linePadding(){return this.lineHeight*l}get baselinePosition(){return this.heightMetrics.baselinePosition}get renderedFontSize(){return this._toRenderUnit(this.fontSize)}get fontSize(){return this._parameters.definition.size}get renderedHaloSize(){return this._toRenderUnit(this.haloSize)}get haloSize(){return this._parameters.haloSize}get backgroundHorizontalPadding(){return this.backgroundEnabled?this._parameters.definition.background.padding[0]:0}get backgroundVerticalPadding(){return this.backgroundEnabled?this._parameters.definition.background.padding[1]:0}get backgroundTopPadding(){return Math.max(0,this.backgroundVerticalPadding-this.heightMetrics.paddingTop)}get backgroundBottomPadding(){return Math.max(0,this.backgroundVerticalPadding-this.heightMetrics.paddingBottom)}get backgroundEnabled(){return e(this._backgroundEnabled)&&(this._backgroundEnabled=n()),this._backgroundEnabled}get hasBackground(){return this.backgroundEnabled&&!!this._parameters.backgroundStyle}get renderPixelRatio(){if(e(this._renderPixelRatio)){const t=this._parameters.definition.pixelRatio;this.maxSize>0?this._renderPixelRatio=Math.min(t,Math.min(this.maxSize/this.displayWidth,this.maxSize/this.displayHeight)):this._renderPixelRatio=t}return this._renderPixelRatio}_getLineXOffset(t){return(this.displayWidth-2*this.backgroundHorizontalPadding-this._lineWidths[t])/2}render(t,e=0,i=0){t.save();const n=e/=this.renderPixelRatio,r=i/=this.renderPixelRatio,h=o(t.textAlign,this.displayWidth)+this.haloSize+this.backgroundHorizontalPadding,a=this.haloSize+this.backgroundTopPadding;i+=a+this.baselinePosition,e+=h;const d=this.haloSize>0;d&&this._renderHalo(t,n,r,h,a),this._setFontProperties(t,this.renderedFontSize);for(let s=0;s<this._lines.length;++s){const n=this._lines[s],r=this._getLineXOffset(s);d&&(t.globalCompositeOperation="destination-out",t.fillStyle="rgb(0, 0, 0)",this._fillText(t,n,e+r,i),this._renderLineDecoration(t,e+r,i,this._textWidths[s])),t.globalCompositeOperation="source-over",t.fillStyle=this._parameters.textStyle,this._fillText(t,n,e+this._getLineXOffset(s),i),this._renderLineDecoration(t,e+r,i,this._textWidths[s]),i+=this.lineSpacing}if(s.TEXT_SHOW_BASELINE){t.strokeStyle=c,t.setLineDash([2,2]),t.lineWidth=1;let e=r+a;for(let i=0;i<this._lines.length;++i){const i=e+this.baselinePosition;this._drawLine(t,[n,i],[n+this.displayWidth,i]),e+=this.lineSpacing}}if(s.TEXT_SHOW_BORDER&&(t.strokeStyle=c,t.setLineDash([]),t.lineWidth=1,this._drawBox(t,[n,r],[this.displayWidth,this.displayHeight])),this.hasBackground){const e=this._parameters.definition.background.borderRadius*this.renderPixelRatio;this._roundedRect(t,n,r,e),t.globalCompositeOperation="destination-over",t.fillStyle=this._parameters.backgroundStyle,t.fill()}t.restore()}_renderLineDecoration(t,e,i,n,s=!1){if("none"===this._parameters.definition.font.decoration||0===n)return;const r=1,o=Math.max(this._parameters.definition.size/16,r);switch(this._parameters.definition.font.decoration){case"underline":i+=2*o;break;case"line-through":i-=.33*this.baselinePosition}const h=s?this.haloSize:0;t.strokeStyle=s?this._parameters.haloStyle:this._parameters.textStyle,t.lineWidth=this._toRenderUnit(o+2*h),t.beginPath(),t.moveTo(this._toRenderUnit(e-h),this._toRenderUnit(i)),t.lineTo(this._toRenderUnit(e+n+h),this._toRenderUnit(i)),t.stroke()}_roundedRect(e,i,n,s){i=this._toRenderUnit(i),n=this._toRenderUnit(n);const r=this.renderedWidth,o=this.renderedHeight;0!==s?(s=t(s,0,Math.floor(o/2)),e.beginPath(),e.moveTo(i,n+s),e.arcTo(i,n,i+s,n,s),e.lineTo(i+r-s,n),e.arcTo(i+r,n,i+r,n+s,s),e.lineTo(i+r,n+o-s),e.arcTo(i+r,n+o,i+r-s,n+o,s),e.lineTo(i+s,n+o),e.arcTo(i,n+o,i,n+o-s,s),e.closePath()):e.rect(i,n,r,o)}_renderHalo(t,e,i,n,s){const r=this.renderedWidth,o=this.renderedHeight,h=a(d,Math.max(r,g),Math.max(o,g)),l=h.getContext("2d");l.clearRect(0,0,r,o),this._setFontProperties(l,this.renderedFontSize),l.fillStyle=this._parameters.haloStyle,l.strokeStyle=this._parameters.haloStyle;const c=this.renderedHaloSize<3;l.lineJoin=c?"miter":"round",c?this._renderHaloEmulated(l,n,s):this._renderHaloNative(l,n,s);let _=s+this.baselinePosition;for(let a=0;a<this._lines.length;++a){const t=this._getLineXOffset(a);this._renderLineDecoration(l,n+t,_,this._textWidths[a],!0),_+=this.lineSpacing}t.globalAlpha=this._parameters.definition.halo.color[3],t.drawImage(h,0,0,r,o,this._toRenderUnit(e),this._toRenderUnit(i),r,o),t.globalAlpha=1}_renderHaloEmulated(t,e,i){i+=this.baselinePosition;for(let n=0;n<this._lines.length;++n){const s=this._lines[n],r=this._getLineXOffset(n);for(const[n,o]of h)this._fillText(t,s,e+r+this.haloSize*n,i+this.haloSize*o);i+=this.lineSpacing}}_renderHaloNative(t,e,i){const n=2*this.haloSize;i+=this.baselinePosition;for(let s=0;s<this._lines.length;++s){const r=this._lines[s],o=this._getLineXOffset(s),h=5,a=.1;for(let s=0;s<h;s++){const d=1-(h-1)*a+s*a;t.lineWidth=this._toRenderUnit(d*n),this._strokeText(t,r,e+o,i)}i+=this.lineSpacing}}_setFontProperties(t,e){t.font=this._parameters.fontString(e),t.textAlign="left",t.textBaseline="alphabetic"}_ensureTextWidth(){if(i(this._displayWidth))return this._displayWidth;const t=a(d,g,g).getContext("2d");this._setFontProperties(t,this.fontSize);let e=2*this.haloSize;const n=this._parameters.definition.font;"italic"!==n.style&&"oblique"!==n.style&&"bold"!==n.weight&&"bolder"!==n.weight||(e+=.3*t.measureText("A").width),this._textWidths.length=0,this._lineWidths.length=0;let s=0;for(const i of this._lines){const n=t.measureText(i).width,r=n+e;this._textWidths.push(n),this._lineWidths.push(r),s=Math.max(s,r)}return this._displayWidth=s,this._displayWidth}_ensureHeightMetrics(){if(e(this._heightMetrics)){const t=a(d,g,g).getContext("2d");this._setFontProperties(t,this.fontSize);const e=t.measureText(this.text+_),i=this.hasBackground?t.measureText(this._lines[0]):e,n=1===this._lines.length?i:this.hasBackground?t.measureText(this._lines[this._lines.length-1]):e,s=e.actualBoundingBoxAscent+e.actualBoundingBoxDescent;this._heightMetrics={paddingTop:e.actualBoundingBoxAscent-i.actualBoundingBoxAscent,paddingBottom:e.actualBoundingBoxDescent-n.actualBoundingBoxDescent,lineHeight:s,baselinePosition:e.actualBoundingBoxAscent}}return this._heightMetrics}_toRenderUnit(t){return t*this.renderPixelRatio}_toRoundedRenderUnit(t){return Math.round(t*this.renderPixelRatio)}_fillText(t,e,i,n){t.fillText(e,this._toRenderUnit(i),this._toRenderUnit(n))}_strokeText(t,e,i,n){t.strokeText(e,this._toRenderUnit(i),this._toRenderUnit(n))}_drawLine(t,e,i){t.beginPath(),t.moveTo(this._toRoundedRenderUnit(e[0])+.5,this._toRoundedRenderUnit(e[1])+.5),t.lineTo(this._toRoundedRenderUnit(i[0])+.5,this._toRoundedRenderUnit(i[1])+.5),t.stroke()}_drawBox(t,e,i){const n=this._toRenderUnit(e[0]),s=this._toRenderUnit(e[1]),r=this._toRenderUnit(i[0]),o=this._toRenderUnit(i[1]),h=Math.floor(n)+.5,a=Math.ceil(n+r)-.5,d=Math.floor(s)+.5,l=Math.ceil(s+o)-.5;t.beginPath(),t.moveTo(h,d),t.lineTo(a,d),t.lineTo(a,l),t.lineTo(h,l),t.lineTo(h,d),t.stroke()}}function o(t,e){return"center"===t?.5*e:"right"===t?e:0}const h=[];{const t=16;for(let e=0;e<360;e+=360/t)h.push([Math.cos(Math.PI*e/180),Math.sin(Math.PI*e/180)])}function a(t,e,i){return t.canvas||(t.canvas=document.createElement("canvas")),t.canvas.width=e,t.canvas.height=i,t.canvas}const d={canvas:null},l=.2,g=512,c="rgb(255, 0, 255, 0.5)",_=(()=>{let t="";for(let e=32;e<127;e++)t+=String.fromCharCode(e);return t})();export{r as TextRenderer,r as default,a as getTextHelperCanvas};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{neverReached as t}from"../../../../core/compilerUtils.js";import e from"../../../../core/Error.js";import r from"../../../../core/Evented.js";import{isPowerOfTwo as i,nextHighestPowerOfTwo as s}from"../../../../core/mathUtils.js";import{isNone as a,isSome as o,removeMaybe as n}from"../../../../core/maybe.js";import{throwIfAborted as m,onAbort as h,createAbortError as l}from"../../../../core/promiseUtils.js";import{isArrayBuffer as p,isUint8Array as d}from"../../../../core/typedArrayUtil.js";import{isBlobProtocol as _,isDataProtocol as c}from"../../../../core/urlUtils.js";import{requestImage as u}from"../../../../support/requestImageUtils.js";import{loadImageAsync as T}from"../../../../support/requestUtils.js";import{PowerOfTwoResizeMode as g}from"./basicInterfaces.js";import{estimateMemoryKTX2 as f,estimateMemoryBasis as w,createTextureKTX2 as E,createTextureBasis as A}from"./BasisUtil.js";import{ContentObject as x}from"./ContentObject.js";import{ContentObjectType as D}from"./ContentObjectType.js";import{createDDSTexture as I}from"./DDSUtil.js";import{createQuadVAO as M}from"./glUtil3D.js";import{assert as F}from"./Util.js";import{TextureWrapMode as O,TextureType as N,PixelFormat as y,PixelType as R,TextureSamplingMode as U,TargetType as
|
|
5
|
+
import{neverReached as t}from"../../../../core/compilerUtils.js";import e from"../../../../core/Error.js";import r from"../../../../core/Evented.js";import{isPowerOfTwo as i,nextHighestPowerOfTwo as s}from"../../../../core/mathUtils.js";import{isNone as a,isSome as o,removeMaybe as n}from"../../../../core/maybe.js";import{throwIfAborted as m,onAbort as h,createAbortError as l}from"../../../../core/promiseUtils.js";import{isArrayBuffer as p,isUint8Array as d}from"../../../../core/typedArrayUtil.js";import{isBlobProtocol as _,isDataProtocol as c}from"../../../../core/urlUtils.js";import{requestImage as u}from"../../../../support/requestImageUtils.js";import{loadImageAsync as T}from"../../../../support/requestUtils.js";import{PowerOfTwoResizeMode as g}from"./basicInterfaces.js";import{estimateMemoryKTX2 as f,estimateMemoryBasis as w,createTextureKTX2 as E,createTextureBasis as A}from"./BasisUtil.js";import{ContentObject as x}from"./ContentObject.js";import{ContentObjectType as D}from"./ContentObjectType.js";import{createDDSTexture as I}from"./DDSUtil.js";import{createQuadVAO as M}from"./glUtil3D.js";import{assert as F}from"./Util.js";import{TextureWrapMode as O,TextureType as N,PixelFormat as y,PixelType as R,TextureSamplingMode as U,TargetType as C,DepthStencilTargetType as b,PrimitiveType as P}from"../../../webgl/enums.js";import{FramebufferObject as S}from"../../../webgl/FramebufferObject.js";import{Texture as H}from"../../../webgl/Texture.js";import{vertexCount as V}from"../../../webgl/Util.js";import j from"../../../webgl/capabilities/isWebGL2Context.js";class L extends x{constructor(t,e){super(),this.data=t,this.type=D.Texture,this._glTexture=null,this._powerOfTwoStretchInfo=null,this._loadingPromise=null,this._loadingController=null,this.events=new r,this.params=e||{},this.params.mipmap=!1!==this.params.mipmap,this.params.noUnpackFlip=this.params.noUnpackFlip||!1,this.params.preMultiplyAlpha=this.params.preMultiplyAlpha||!1,this.params.wrap=this.params.wrap||{s:O.REPEAT,t:O.REPEAT},this.params.powerOfTwoResizeMode=this.params.powerOfTwoResizeMode||g.STRETCH,this.estimatedTexMemRequired=L._estimateTexMemRequired(this.data,this.params),this._startPreload()}_startPreload(){const t=this.data;a(t)||(t instanceof HTMLVideoElement?this._startPreloadVideoElement(t):t instanceof HTMLImageElement&&this._startPreloadImageElement(t))}_startPreloadVideoElement(t){_(t.src)||"auto"===t.preload&&t.crossOrigin||(t.preload="auto",t.crossOrigin="anonymous",t.src=t.src)}_startPreloadImageElement(t){c(t.src)||_(t.src)||t.crossOrigin||(t.crossOrigin="anonymous",t.src=t.src)}static _getDataDimensions(t){return t instanceof HTMLVideoElement?{width:t.videoWidth,height:t.videoHeight}:t}static _estimateTexMemRequired(t,e){if(a(t))return 0;if(p(t)||d(t))return e.encoding===L.KTX2_ENCODING?f(t,e.mipmap):e.encoding===L.BASIS_ENCODING?w(t,e.mipmap):t.byteLength;const{width:r,height:i}=t instanceof Image||t instanceof ImageData||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement?L._getDataDimensions(t):e;return(e.mipmap?4/3:1)*r*i*(e.components||4)||0}dispose(){this.data=void 0}get width(){return this.params.width}get height(){return this.params.height}_createDescriptor(t){var e;return{target:N.TEXTURE_2D,pixelFormat:y.RGBA,dataType:R.UNSIGNED_BYTE,wrapMode:this.params.wrap,flipped:!this.params.noUnpackFlip,samplingMode:this.params.mipmap?U.LINEAR_MIPMAP_LINEAR:U.LINEAR,hasMipmap:this.params.mipmap,preMultiplyAlpha:this.params.preMultiplyAlpha,maxAnisotropy:null!=(e=this.params.maxAnisotropy)?e:this.params.mipmap?t.parameters.maxMaxAnisotropy:1}}get glTexture(){return this._glTexture}load(t,e){if(o(this._glTexture))return this._glTexture;if(o(this._loadingPromise))return this._loadingPromise;const r=this.data;return a(r)?(this._glTexture=new H(t,this._createDescriptor(t),null),this._glTexture):"string"==typeof r?this._loadFromURL(t,e,r):r instanceof Image?this._loadFromImageElement(t,e,r):r instanceof HTMLVideoElement?this._loadFromVideoElement(t,e,r):r instanceof ImageData||r instanceof HTMLCanvasElement?this._loadFromImage(t,r,e):(p(r)||d(r))&&this.params.encoding===L.DDS_ENCODING?this._loadFromDDSData(t,r):(p(r)||d(r))&&this.params.encoding===L.KTX2_ENCODING?this._loadFromKTX2(t,r):(p(r)||d(r))&&this.params.encoding===L.BASIS_ENCODING?this._loadFromBasis(t,r):d(r)?this._loadFromPixelData(t,r):p(r)?this._loadFromPixelData(t,new Uint8Array(r)):null}get requiresFrameUpdates(){return this.data instanceof HTMLVideoElement}frameUpdate(t,e,r){if(!(this.data instanceof HTMLVideoElement)||a(this._glTexture))return r;if(this.data.readyState<G.HAVE_CURRENT_DATA||r===this.data.currentTime)return r;if(o(this._powerOfTwoStretchInfo)){const{framebuffer:r,vao:i,sourceTexture:s}=this._powerOfTwoStretchInfo;s.setData(this.data),this._drawStretchedTexture(t,e,r,i,s,this._glTexture)}else{const{width:t,height:e}=this.data,{width:r,height:i}=this._glTexture.descriptor;t!==r||e!==i?this._glTexture.updateData(0,0,0,Math.min(t,r),Math.min(e,i),this.data):this._glTexture.setData(this.data)}return this._glTexture.descriptor.hasMipmap&&this._glTexture.generateMipmap(),this.data.currentTime}_loadFromDDSData(t,e){return this._glTexture=I(t,this._createDescriptor(t),e),this._glTexture}_loadFromKTX2(t,e){return this._loadAsync((()=>E(t,this._createDescriptor(t),e).then((t=>(this._glTexture=t,t)))))}_loadFromBasis(t,e){return this._loadAsync((()=>A(t,this._createDescriptor(t),e).then((t=>(this._glTexture=t,t)))))}_loadFromPixelData(t,e){F(this.params.width>0&&this.params.height>0);const r=this._createDescriptor(t);return r.pixelFormat=1===this.params.components?y.LUMINANCE:3===this.params.components?y.RGB:y.RGBA,r.width=this.params.width,r.height=this.params.height,this._glTexture=new H(t,r,e),this._glTexture}_loadFromURL(t,e,r){return this._loadAsync((async i=>{const s=await u(r,{signal:i});return m(i),this._loadFromImage(t,s,e)}))}_loadFromImageElement(t,e,r){return r.complete?this._loadFromImage(t,r,e):this._loadAsync((async i=>{const s=await T(r,r.src,!1,i);return m(i),this._loadFromImage(t,s,e)}))}_loadFromVideoElement(t,e,r){return r.readyState>=G.HAVE_CURRENT_DATA?this._loadFromImage(t,r,e):this._loadFromVideoElementAsync(t,e,r)}_loadFromVideoElementAsync(t,r,i){return this._loadAsync((s=>new Promise(((a,o)=>{const m=()=>{i.removeEventListener("loadeddata",p),i.removeEventListener("error",d),n(_)},p=()=>{i.readyState>=G.HAVE_CURRENT_DATA&&(m(),a(this._loadFromImage(t,i,r)))},d=t=>{m(),o(t||new e("Failed to load video"))};i.addEventListener("loadeddata",p),i.addEventListener("error",d);const _=h(s,(()=>d(l())))}))))}_loadFromImage(t,e,r){const s=L._getDataDimensions(e);this.params.width=s.width,this.params.height=s.height;const a=this._createDescriptor(t);return a.pixelFormat=3===this.params.components?y.RGB:y.RGBA,!this._requiresPowerOfTwo(t,a)||i(s.width)&&i(s.height)?(a.width=s.width,a.height=s.height,this._glTexture=new H(t,a,e),this._glTexture):(this._glTexture=this._makePowerOfTwoTexture(t,e,s,a,r),this._glTexture)}_loadAsync(t){const e=new AbortController;this._loadingController=e;const r=t(e.signal);this._loadingPromise=r;const i=()=>{this._loadingController===e&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null)};return r.then(i,i),r}_requiresPowerOfTwo(t,e){const r=O.CLAMP_TO_EDGE,i="number"==typeof e.wrapMode?e.wrapMode===r:e.wrapMode.s===r&&e.wrapMode.t===r;return!j(t.gl)&&(e.hasMipmap||!i)}_makePowerOfTwoTexture(e,r,i,a,o){const{width:n,height:m}=i,h=s(n),l=s(m);let p;switch(a.width=h,a.height=l,this.params.powerOfTwoResizeMode){case g.PAD:a.textureCoordinateScaleFactor=[n/h,m/l],p=new H(e,a),p.updateData(0,0,0,n,m,r);break;case g.STRETCH:case null:case void 0:p=this._stretchToPowerOfTwo(e,r,a,o());break;default:t(this.params.powerOfTwoResizeMode)}return a.hasMipmap&&p.generateMipmap(),p}_stretchToPowerOfTwo(t,e,r,i){const s=new H(t,r),a=new S(t,{colorTarget:C.TEXTURE,depthStencilTarget:b.NONE},s),o=new H(t,{target:N.TEXTURE_2D,pixelFormat:r.pixelFormat,dataType:R.UNSIGNED_BYTE,wrapMode:O.CLAMP_TO_EDGE,samplingMode:U.LINEAR,flipped:!!r.flipped,maxAnisotropy:8,preMultiplyAlpha:r.preMultiplyAlpha},e),n=M(t),m=t.getBoundFramebufferObject();return this._drawStretchedTexture(t,i,a,n,o,s),this.requiresFrameUpdates?this._powerOfTwoStretchInfo={vao:n,sourceTexture:o,framebuffer:a}:(n.dispose(!0),o.dispose(),a.detachColorTexture(),a.dispose()),t.bindFramebuffer(m),s}_drawStretchedTexture(t,e,r,i,s,a){t.bindFramebuffer(r);const o=t.getViewport();t.setViewport(0,0,a.descriptor.width,a.descriptor.height);const n=t.useTechnique(e);n.setUniform4f("uColor",1,1,1,1),n.bindTexture(s,"tex"),t.bindVAO(i),t.drawArrays(P.TRIANGLE_STRIP,0,V(i,"geometry")),t.bindFramebuffer(null),t.setViewport(o.x,o.y,o.width,o.height)}unload(){if(o(this._powerOfTwoStretchInfo)){const{framebuffer:t,vao:e,sourceTexture:r}=this._powerOfTwoStretchInfo;e.dispose(!0),r.dispose(),t.dispose(),this._glTexture=null,this._powerOfTwoStretchInfo=null}if(o(this._glTexture)&&(this._glTexture.dispose(),this._glTexture=null),o(this._loadingController)){const t=this._loadingController;this._loadingController=null,this._loadingPromise=null,t.abort()}this.events.emit("unloaded")}}var G;L.DDS_ENCODING="image/vnd-ms.dds",L.KTX2_ENCODING="image/ktx2",L.BASIS_ENCODING="image/x.basis",function(t){t[t.HAVE_NOTHING=0]="HAVE_NOTHING",t[t.HAVE_METADATA=1]="HAVE_METADATA",t[t.HAVE_CURRENT_DATA=2]="HAVE_CURRENT_DATA",t[t.HAVE_FUTURE_DATA=3]="HAVE_FUTURE_DATA",t[t.HAVE_ENOUGH_DATA=4]="HAVE_ENOUGH_DATA"}(G||(G={}));export{L as Texture};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{releaseMaybe as e,isNone as s}from"../../../../../core/maybe.js";import t from"../../../../../core/PooledArray.js";import{t as r,e as i,g as n}from"../../../../../chunks/mat3.js";import{c as o}from"../../../../../chunks/mat3f32.js";import{g as a,s as l}from"../../../../../chunks/vec3.js";import{c as h}from"../../../../../chunks/vec3f64.js";import c from"../../../support/debugFlags.js";import{ComponentDrawParameters as d}from"../../collections/Component/Material/ComponentTechnique.js";import{bindSliceUniforms as m}from"../../core/shaderLibrary/Slice.glsl.js";import{bindModelTransform as u}from"../../core/shaderLibrary/attributes/VertexPosition.glsl.js";import{bindMultipassTerrainTexture as f}from"../../core/shaderLibrary/shading/MultipassTerrainTest.glsl.js";import{doublePrecisionRequiresObfuscation as g}from"../../core/shaderLibrary/util/DoublePrecision.glsl.js";import{TwoVectorPosition as b}from"../../core/util/TwoVectorPosition.js";import{EdgeShaderTechniqueConfiguration as
|
|
5
|
+
import{releaseMaybe as e,isNone as s}from"../../../../../core/maybe.js";import t from"../../../../../core/PooledArray.js";import{t as r,e as i,g as n}from"../../../../../chunks/mat3.js";import{c as o}from"../../../../../chunks/mat3f32.js";import{g as a,s as l}from"../../../../../chunks/vec3.js";import{c as h}from"../../../../../chunks/vec3f64.js";import c from"../../../support/debugFlags.js";import{ComponentDrawParameters as d}from"../../collections/Component/Material/ComponentTechnique.js";import{bindSliceUniforms as m}from"../../core/shaderLibrary/Slice.glsl.js";import{bindModelTransform as u}from"../../core/shaderLibrary/attributes/VertexPosition.glsl.js";import{bindMultipassTerrainTexture as f}from"../../core/shaderLibrary/shading/MultipassTerrainTest.glsl.js";import{doublePrecisionRequiresObfuscation as g}from"../../core/shaderLibrary/util/DoublePrecision.glsl.js";import{TwoVectorPosition as b}from"../../core/util/TwoVectorPosition.js";import{EdgeShaderTechniqueConfiguration as T,EdgeShaderTechnique as p}from"./EdgeShaderTechnique.js";import{Transparency as R}from"./interfaces.js";import{EdgeUtilMode as A}from"../../shaders/sources/edgeRenderer/EdgeUtil.glsl.js";import{PrimitiveType as E}from"../../../../webgl/enums.js";const P=8,S=128,y={type:"uber",slicePlaneEnabled:!1,sliceHighlightDisabled:!1,strokesTexture:null,legacy:!0};class N{constructor(){this._value=0}get value(){return this._value}increment(){this._value++}decrement(){this._value--}}const v={solid:A.SOLID,sketch:A.SKETCH,uber:A.MIXED};class U{constructor(e,s,r){this.rctx=e,this.shaderTechniqueRepository=s,this.config=new T,this.technique=null,this.refCount=new N,this.renderables=new Set,this.sortedRenderables={[R.TRANSPARENT]:{[R.TRANSPARENT]:new t,[R.OPAQUE]:new t},[R.OPAQUE]:{[R.TRANSPARENT]:new t,[R.OPAQUE]:new t}},this.renderablesDirty=!1,this.settings={...y,...r},this.key=U.getKey(this.settings.type,this.settings.slicePlaneEnabled,this.settings.legacy);const i=this.settings.strokesTexture.variants;this.writerSettings={variants:i,reducedPrecision:c.TESTS_DISABLE_OPTIMIZATIONS},this.config.legacy=this.settings.legacy,this.config.mode=v[this.settings.type],this.config.silhouette=!1,this.config.antialiasing=!!this.rctx.capabilities.blendMinMax,this.config.slicePlaneEnabled=this.settings.slicePlaneEnabled,this.config.doublePrecisionRequiresObfuscation=g(e)}dispose(){this.technique=e(this.technique)}addRenderable(e){this.renderables.add(e),this.renderablesDirty=!0}removeRenderable(e){this.renderables.delete(e),this.renderablesDirty=!0}setRenderablesDirty(){this.renderablesDirty=!0}forEachRenderable(e,s){this.renderablesDirty&&this._sortRenderables(),this.sortedRenderables[s][R.TRANSPARENT].forAll(e),this.sortedRenderables[s][R.OPAQUE].forAll(e)}setMultipassParameters(e){this.config.multipassTerrainEnabled=!!e.multipassTerrainEnabled&&e.multipassTerrainEnabled,this.config.cullAboveGround=!!e.cullAboveGround&&e.cullAboveGround}bindRegularEdges(e,s){this.setMultipassParameters(e),this.config.silhouette=!1,this.technique=this.shaderTechniqueRepository.releaseAndAcquire(p,this.config,this.technique),this.rctx.useTechnique(this.technique,e.slot),this.technique.bindPass({bindParameters:e,edgeRenderParameters:s})}bindSilhouetteEdges(e,s){this.setMultipassParameters(e),this.config.silhouette=!0,this.technique=this.shaderTechniqueRepository.releaseAndAcquire(p,this.config,this.technique),this.rctx.useTechnique(this.technique,e.slot),this.technique.bindPass({bindParameters:e,edgeRenderParameters:s})}renderRegularEdges(e,s,t){this._render(e,e.regular.vao,s,t)}renderSilhouetteEdges(e,s,t){this._render(e,e.silhouette.vao,s,t)}_render(e,s,t,r){this._setUniforms(e,t),this.rctx.bindVAO(s),this.rctx.capabilities.instancing.drawArraysInstanced(E.TRIANGLE_FAN,0,4,r)}_setUniforms(e,s){const t=this.technique.program;if(e.components.buffer.textureBuffer.bind(t,x,q),s.multipassTerrainEnabled&&(t.setUniform2fv("nearFar",s.camera.nearFar),t.setUniform2fv("inverseViewport",s.inverseViewport),f(t,s)),"origin"in e.transform)t.setUniformMatrix4fv("view",s.localViewMatrixForEdges),t.setUniformMatrix4fv("model",e.transform.modelMatrix),m(t,this.settings,s.slicePlane,e.transform.origin.vec3);else{const o=new b(e.transform.position),h=r(M,i(M,e.transform.rotationScale)),c=new d;a(c.transformWorldFromModelTL,o.low),a(c.transformWorldFromModelTH,o.high),n(c.transformWorldFromModelRS,e.transform.rotationScale),n(c.transformNormalGlobalFromModel,h),u(t,c),t.setUniformMatrix3fv("transformNormalGlobalFromModel",c.transformNormalGlobalFromModel);const f=s.camera.viewInverseTransposeMatrix,g=l(w,f[3],f[7],f[11]);m(t,this.settings,s.slicePlane,g)}"uber"!==this.settings.type&&"sketch"!==this.settings.type||this._setSketchUniforms(t)}_setSketchUniforms(e){const t=this.settings.strokesTexture,r=t.texture;s(r)||(e.bindTexture(r,"strokesTexture"),e.setUniform2f("strokesTextureScale",1/r.descriptor.width,1/r.descriptor.height),e.setUniform1f("strokesLog2Resolution",Math.log2(t.resolution)),e.setUniform1f("strokesNormalizationScale",t.normalizationScale),e.setUniform1f("strokesAmplitude",t.amplitude),e.setUniform1f("strokeVariants",t.variants))}_sortRenderables(){this.renderablesDirty=!1,this.sortedRenderables[R.TRANSPARENT][R.TRANSPARENT].clear(),this.sortedRenderables[R.TRANSPARENT][R.OPAQUE].clear(),this.sortedRenderables[R.OPAQUE][R.TRANSPARENT].clear(),this.sortedRenderables[R.OPAQUE][R.OPAQUE].clear(),this.renderables.forEach((e=>{e.objectTransparency!==R.INVISIBLE&&e.edgeTransparency!==R.INVISIBLE&&this.sortedRenderables[e.objectTransparency][e.edgeTransparency].push(e)}));const e=(e,s)=>"origin"in e.transform&&"origin"in s.transform?e.transform.origin.id<s.transform.origin.id?-1:e.transform.origin.id>s.transform.origin.id?1:0:0;this.sortedRenderables[R.TRANSPARENT][R.TRANSPARENT].sort(e),this.sortedRenderables[R.TRANSPARENT][R.OPAQUE].sort(e),this.sortedRenderables[R.OPAQUE][R.TRANSPARENT].sort(e),this.sortedRenderables[R.OPAQUE][R.OPAQUE].sort(e)}static getKey(e,s,t){return`edges-t:${e}:${s}:${t}`}}const x="componentDataTex",q="componentDataTexInvDim",M=o(),w=h();export{S as EXTENSION_LENGTH_OFFSET,U as EdgeRenderer,P as LINE_WIDTH_FRACTION_FACTOR,q as componentDataInvDimName,x as componentDataTexName};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isNone as e}from"../../../../../core/maybe.js";import{isAborted as t,throwIfAborted as s}from"../../../../../core/promiseUtils.js";import{I as a,c as n}from"../../../../../chunks/mat4f64.js";import{a as i}from"../../../../../chunks/vec2f64.js";import{f as r,d as l,m as o}from"../../../../../chunks/vec3.js";import{c}from"../../../../../chunks/vec3f64.js";import{c as h}from"../../../../../chunks/vec4f64.js";import d from"../../../support/debugFlags.js";import{glLayout as u}from"../../../support/buffer/glUtil.js";import{bindOutputHighlight as _}from"../../core/shaderLibrary/output/OutputHighlight.glsl.js";import m from"../Camera.js";import{Default3D as p}from"../DefaultVertexAttributeLocations.js";import{IntersectorType as f}from"../IntersectorInterfaces.js";import{DepthOrder as g}from"../Octree.js";import{RenderPass as I}from"../RenderPass.js";import{RenderSlot as D}from"../RenderSlot.js";import{assert as v}from"../Util.js";import{InstanceData as y,StateFlags as E}from"./InstanceData.js";import{InstanceOctree as T}from"./InstanceOctree.js";import{LevelSelector as R}from"./LevelSelector.js";import{LodLevel as A}from"./LodLevel.js";import{RenderInstanceData as C}from"./RenderInstanceData.js";import{getInstanceBufferLayout as b}from"../../materials/DefaultMaterial.js";import{colorMixModes as L}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as S}from"../../materials/renderers/utils.js";import{bindVertexBufferLayout as U,unbindVertexBufferLayout as x}from"../../../../webgl/Util.js";let P=function(e){const t=e.baseBoundingSphere.radius,s=e.levels.map((e=>e.minScreenSpaceRadius));return new R(t,s)};function O(e){P=e}class H{constructor(e,t,s,a){this.type=f.LOD,this.isGround=!1,this._inverseViewport=i(),this._levels=[],this._defaultRenderInstanceData=[],this._highlightRenderInstanceData=[],this._instanceIndex=0,this._slicePlane=!1,this._enableLevelSelection=!0,this._lastCamera=new m,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.slots=[D.OPAQUE_PLUGIN,D.TRANSPARENT_PLUGIN],this.canRender=!0,this._symbol=e,this._optionalFields=t,this._metadata=s,this._instanceBufferLayout=b({instancedDoublePrecision:!0,instanced:t}),this._glInstanceBufferLayout=u(this._instanceBufferLayout,1),this._instanceData=new y(this._optionalFields,a),this._instanceData.on("instance-added",(()=>this._requestUpdateCycle())),this._instanceData.on("instance-removed",(()=>this._requestUpdateCycle())),this._instanceData.on("instance-transform-changed",(e=>{this._requestUpdateCycle(),this._metadata.notifyGraphicGeometryChanged(e.index)})),this._instanceData.on("instance-visibility-changed",(e=>{this._requestUpdateCycle(!0),this._metadata.notifyGraphicVisibilityChanged(e.index)})),this._instanceData.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0))),this._enableLevelSelection=this._symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerUid(){return this._metadata.layerUid}get instanceData(){return this._instanceData}get memoryUsage(){const e={cpu:0,gpu:0};return this._defaultRenderInstanceData.forEach((t=>{const s=t.memoryUsage;e.cpu+=s.cpu,e.gpu+=s.gpu})),this._highlightRenderInstanceData.forEach((t=>{const s=t.memoryUsage;e.cpu+=s.cpu,e.gpu+=s.gpu})),e}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,s)=>{const a=this._defaultRenderInstanceData[s],n=this._highlightRenderInstanceData[s],i=a.size+n.size,r=e.triangleCount;t.push({renderedInstances:i,renderedTriangles:i*r,trianglesPerInstance:r})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}async initializeRenderContext(e,a){this._context=e;const n=e.renderContext.rctx,i=await Promise.allSettled(this._symbol.levels.map((t=>(this._defaultRenderInstanceData.push(new C(n,this._instanceBufferLayout)),this._highlightRenderInstanceData.push(new C(n,this._instanceBufferLayout)),A.create(e,t,a))))),r=i.map((e=>"fulfilled"===e.status?e.value:null)).filter((e=>e));if(t(a)||r.length!==i.length){r.forEach((e=>e.destroy())),s(a);for(const e of i)if("rejected"===e.status)throw e.reason}this._levels=r,this._levelSelector=P(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData.forEach((e=>e.destroy())),this._highlightRenderInstanceData.forEach((e=>e.destroy()))}get needsTransparentPass(){return this._levels.some((e=>e.components.some((e=>e.material.requiresSlot(D.TRANSPARENT_MATERIAL)))))}get needsHighlight(){return this._highlightRenderInstanceData.some((e=>e.size>0))}prepareRender(e,t){if(d.LOD_INSTANCE_RENDERER_DISABLE_UPDATES)return;if(this._enableLevelSelection){const e=t.equals(this._lastCamera);this._lastCamera.copyFrom(t),e||this._requestUpdateCycle()}const s=this._needFullCycle?this._instanceData.size:2e3;this._needFullCycle=!1,this._updateInstances(t,s),this.needsUpdates&&this._context.requestRender()}render(e){var t,s,n,i;const r=e.slot===D.OPAQUE_PLUGIN?D.OPAQUE_MATERIAL:e.slot===D.TRANSPARENT_PLUGIN?D.TRANSPARENT_MATERIAL:null;if(!r||!this.baseMaterial.isVisible()||!this.baseMaterial.isVisibleInPass(e.pass))return;const l=e.camera;this._inverseViewport[0]=1/l.fullViewport[2],this._inverseViewport[1]=1/l.fullViewport[3];const o={slot:r,origin:[0,0,0],camera:l,inverseViewport:this._inverseViewport,shadowMap:e.shadowMap,shadowMappingEnabled:e.shadowMap.enabled,ssaoHelper:e.ssaoHelper,ssaoEnabled:e.ssaoHelper.enabled,screenToWorldRatio:null,screenToPCSRatio:null,slicePlane:e.sliceHelper&&e.sliceHelper.plane,hudVisibilityTexture:null!=(t=null==(s=e.offscreenRenderingHelper)?void 0:s.hudVisibilityTexture)?t:null,highlightDepthTexture:null!=(n=null==(i=e.offscreenRenderingHelper)?void 0:i.depthTexture)?n:null,hasOccludees:!1,linearDepthTexture:null,lastFrameColorTexture:null,reprojectionMatrix:a,ssrEnabled:!1,lighting:e.scenelightingData,transparencyPassType:e.transparencyPassType,terrainLinearDepthTexture:e.multipassTerrainParams.terrainLinearDepthTexture,geometryLinearDepthTexture:e.multipassGeometryParams.geometryLinearDepthTexture,multipassTerrainEnabled:e.multipassTerrainParams.multipassTerrainEnabled,cullAboveGround:e.multipassTerrainParams.cullAboveGround,multipassGeometryEnabled:e.multipassGeometryParams.multipassGeometryEnabled,highlightColorTexture:null,cloudsCompositionParams:null};e.rctx.bindVAO();const c=e.pass!==I.MATERIAL_HIGHLIGHT&&e.pass!==I.MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT,h=e.pass!==I.MATERIAL_DEPTH_SHADOWMAP_DEFAULT;c&&this._renderComponents(e,r,o,this._defaultRenderInstanceData),h&&this._renderComponents(e,r,o,this._highlightRenderInstanceData)}intersect(e,t,s,a){if(!this.baseMaterial.isVisible())return;const n=c();r(n,a,s);const i=n=>{this._instanceData.getCombinedModelTransform(n,N),e.transform.set(N),o(G,s,e.transform.inverse),o(F,a,e.transform.inverse);const i=this._instanceData.getState(n),r=this._instanceData.getLodLevel(n);v(i&E.ACTIVE,"invalid instance state"),v(r>=0&&r<this._levels.length,"invaid lod level"),this._levels[r].intersect(e,t,G,F,n,this._metadata)};this.baseMaterial.parameters.verticalOffset?this.octree.forEach(i):this.octree.forEachAlongRay(s,n,i)}queryDepthRange(e){return this._queryDepthRangeOctree(e)}notifyShaderTransformationChanged(){this._invalidateOctree()}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,e&&(this._needFullCycle=!0),this.needsUpdates&&this._context.requestRender()}get needsUpdates(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}get octree(){return this._octree||(this._octree=this._buildOctree()),this._octree}_invalidateOctree(){this._octree&&(this._octree.destroy(),this._octree=null)}_buildOctree(){const e=new T(this._instanceData,this.baseBoundingSphere),t=this._instanceData,s=t.view?t.view.state:null;for(let a=0;a<this._instanceData.capacity;++a){s.get(a)&E.ACTIVE&&e.addInstance(a)}return e}_queryDepthRangeOctree(e){const t=e.eye,s=e.viewForward,a=this.octree.findClosest(s,g.FRONT_TO_BACK,e.frustum),n=this.octree.findClosest(s,g.BACK_TO_FRONT,e.frustum);if(null!=a&&null!=n){this._instanceData.view.boundingSphere.getVec(a,j),r(j,j,t);const i=l(j,s)-j[3];this._instanceData.view.boundingSphere.getVec(n,j),r(j,j,t);const o=l(j,s)+j[3];return{near:Math.max(e.near,i),far:Math.min(e.far,o)}}return{near:1/0,far:-1/0}}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._defaultRenderInstanceData.forEach((e=>{e.startUpdateCylce()})),this._highlightRenderInstanceData.forEach((e=>{e.startUpdateCylce()})),this.needsUpdates&&this._context.requestRender()}_updateInstances(e,t){const s=this._enableLevelSelection,a=this._levelSelector;a.updateCamera(e),this._defaultRenderInstanceData.forEach((e=>{e.beginUpdate()})),this._highlightRenderInstanceData.forEach((e=>{e.beginUpdate()}));const n=this._instanceData,i=this._instanceData.view,r=n.size,l=n.capacity;let o=this._instanceIndex;t=Math.min(r,t);for(let c=0;c<t;++c){0===o&&this._startUpdateCycle();const e=i.state.get(o);let r=0;if(!(e&E.ALLOCATED)){o=(o+1)%l,t++;continue}const c=i.lodLevel.get(o);if(e&E.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[c].freeTail(),e&E.HIGHLIGHT_ACTIVE&&this._highlightRenderInstanceData[c].freeTail(),e&E.REMOVE)n.freeInstance(o);else if(e&E.VISIBLE){let t=0;s&&(i.modelOrigin.getVec(o,w),t=a.selectLevel(w,n.getCombinedMedianScaleFactor(o))),r=e&~(E.ACTIVE|E.TRANSFORM_CHANGED),t>=0&&(e&E.HIGHLIGHT?(M(this._highlightRenderInstanceData[t],i,o),r|=E.HIGHLIGHT_ACTIVE):(M(this._defaultRenderInstanceData[t],i,o),r|=E.DEFAULT_ACTIVE)),i.state.set(o,r),i.lodLevel.set(o,t)}else r=e&~(E.ACTIVE|E.TRANSFORM_CHANGED),i.state.set(o,r);if(this._octree){const t=!!(e&E.ACTIVE),s=!!(r&E.ACTIVE);!t&&s?this._octree.addInstance(o):t&&!s?this._octree.removeInstance(o):t&&s&&e&E.TRANSFORM_CHANGED&&(this._octree.removeInstance(o),this._octree.addInstance(o))}o=(o+1)%l}this._instanceIndex=o,this._defaultRenderInstanceData.forEach((e=>{e.endUpdate()})),this._highlightRenderInstanceData.forEach((e=>{e.endUpdate()}))}_renderComponents(e,t,s,a){this.levels.forEach(((n,i)=>{n.components.forEach((n=>{this._renderComponent(e,t,s,a[i],n,i)}))}))}_renderComponent(t,s,a,n,i,r){if(0===n.size||!i.material.requiresSlot(s))return;const{rctx:l,pass:o}=t,c=i.glMaterials.load(l,o);if(e(c))return;const h=l.capabilities.instancing,u=c.beginSlot(a),m=u.program;u.bindPipelineState(l,s),l.useProgram(m),c.bind(a,u),l.bindVAO(i.vao),u.ensureAttributeLocations(i.vao),t.isHighlightPass&&_(m,a),u.bindDraw(a),d.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&t.pass===I.MATERIAL&&(m.setUniform4fv("externalColor",B[Math.min(r,B.length-1)]),m.setUniform1i("colorMixMode",L.replace));const f=n.capacity,g=n.headIndex,D=n.tailIndex,y=n.firstIndex,E=this._glInstanceBufferLayout,T=(e,t)=>{U(l,p,n.buffer,E,e),h.drawArraysInstanced(u.primitiveType,0,i.vertexCount,t-e),x(l,p,n.buffer,E)};i.material.parameters.transparent&&null!=y?g>D?(v(y>=D&&y<=g,"invalid firstIndex"),T(y,g),T(D,y)):g<D&&(y<=g?(v(y>=0&&y<=g,"invalid firstIndex"),T(y,g),T(D,f),T(0,y)):(v(y>=D&&y<=f,"invalid firstIndex"),T(y,f),T(0,g),T(D,y))):g>D?T(D,g):g<D&&(T(0,g),T(D,f)),l.bindVAO(null)}}function M(e,t,s){const a=e.allocateHead();V(t,s,e.view,a)}function V(e,t,s,a){S(e.modelOrigin,t,s.modelOriginHi,s.modelOriginLo,a),s.model.copyFrom(a,e.model,t),s.modelNormal.copyFrom(a,e.modelNormal,t),e.color&&s.color&&s.color.copyFrom(a,e.color,t),e.featureAttribute&&s.featureAttribute&&s.featureAttribute.copyFrom(a,e.featureAttribute,t)}const w=c(),j=h(),N=n(),G=c(),F=c(),B=[[1,0,1,1],[0,0,1,1],[0,1,0,1],[1,1,0,1],[1,0,0,1]];export{H as LodRenderer,O as setLevelSelectorFactory};
|
|
5
|
+
import{isNone as e}from"../../../../../core/maybe.js";import{isAborted as t,throwIfAborted as s}from"../../../../../core/promiseUtils.js";import{I as a,c as n}from"../../../../../chunks/mat4f64.js";import{a as i}from"../../../../../chunks/vec2f64.js";import{f as r,d as l,m as o}from"../../../../../chunks/vec3.js";import{c}from"../../../../../chunks/vec3f64.js";import{c as h}from"../../../../../chunks/vec4f64.js";import d from"../../../support/debugFlags.js";import{glLayout as u}from"../../../support/buffer/glUtil.js";import{bindOutputHighlight as _}from"../../core/shaderLibrary/output/OutputHighlight.glsl.js";import m from"../Camera.js";import{Default3D as p}from"../DefaultVertexAttributeLocations.js";import{IntersectorType as f}from"../IntersectorInterfaces.js";import{DepthOrder as g}from"../Octree.js";import{RenderPass as I}from"../RenderPass.js";import{RenderSlot as D}from"../RenderSlot.js";import{assert as T}from"../Util.js";import{InstanceData as v,StateFlags as y}from"./InstanceData.js";import{InstanceOctree as E}from"./InstanceOctree.js";import{LevelSelector as R}from"./LevelSelector.js";import{LodLevel as A}from"./LodLevel.js";import{RenderInstanceData as C}from"./RenderInstanceData.js";import{getInstanceBufferLayout as b}from"../../materials/DefaultMaterial.js";import{colorMixModes as L}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as S}from"../../materials/renderers/utils.js";import{bindVertexBufferLayout as U,unbindVertexBufferLayout as x}from"../../../../webgl/Util.js";let O=function(e){const t=e.baseBoundingSphere.radius,s=e.levels.map((e=>e.minScreenSpaceRadius));return new R(t,s)};function P(e){O=e}class H{constructor(e,t,s,a){this.type=f.LOD,this.isGround=!1,this._inverseViewport=i(),this._levels=[],this._defaultRenderInstanceData=[],this._highlightRenderInstanceData=[],this._instanceIndex=0,this._slicePlane=!1,this._enableLevelSelection=!0,this._lastCamera=new m,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.slots=[D.OPAQUE_PLUGIN,D.TRANSPARENT_PLUGIN],this.canRender=!0,this._symbol=e,this._optionalFields=t,this._metadata=s,this._instanceBufferLayout=b({instancedDoublePrecision:!0,instanced:t}),this._glInstanceBufferLayout=u(this._instanceBufferLayout,1),this._instanceData=new v(this._optionalFields,a),this._instanceData.on("instance-added",(()=>this._requestUpdateCycle())),this._instanceData.on("instance-removed",(()=>this._requestUpdateCycle())),this._instanceData.on("instance-transform-changed",(e=>{this._requestUpdateCycle(),this._metadata.notifyGraphicGeometryChanged(e.index)})),this._instanceData.on("instance-visibility-changed",(e=>{this._requestUpdateCycle(!0),this._metadata.notifyGraphicVisibilityChanged(e.index)})),this._instanceData.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0))),this._enableLevelSelection=this._symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerUid(){return this._metadata.layerUid}get instanceData(){return this._instanceData}get memoryUsage(){const e={cpu:0,gpu:0};return this._defaultRenderInstanceData.forEach((t=>{const s=t.memoryUsage;e.cpu+=s.cpu,e.gpu+=s.gpu})),this._highlightRenderInstanceData.forEach((t=>{const s=t.memoryUsage;e.cpu+=s.cpu,e.gpu+=s.gpu})),e}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,s)=>{const a=this._defaultRenderInstanceData[s],n=this._highlightRenderInstanceData[s],i=a.size+n.size,r=e.triangleCount;t.push({renderedInstances:i,renderedTriangles:i*r,trianglesPerInstance:r})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}async initializeRenderContext(e,a){this._context=e;const n=e.renderContext.rctx,i=await Promise.allSettled(this._symbol.levels.map((t=>(this._defaultRenderInstanceData.push(new C(n,this._instanceBufferLayout)),this._highlightRenderInstanceData.push(new C(n,this._instanceBufferLayout)),A.create(e,t,a))))),r=i.map((e=>"fulfilled"===e.status?e.value:null)).filter((e=>e));if(t(a)||r.length!==i.length){r.forEach((e=>e.destroy())),s(a);for(const e of i)if("rejected"===e.status)throw e.reason}this._levels=r,this._levelSelector=O(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData.forEach((e=>e.destroy())),this._highlightRenderInstanceData.forEach((e=>e.destroy()))}get needsTransparentPass(){return this._levels.some((e=>e.components.some((e=>e.material.requiresSlot(D.TRANSPARENT_MATERIAL)))))}get needsHighlight(){return this._highlightRenderInstanceData.some((e=>e.size>0))}prepareRender(e,t){if(d.LOD_INSTANCE_RENDERER_DISABLE_UPDATES)return;if(this._enableLevelSelection){const e=t.equals(this._lastCamera);this._lastCamera.copyFrom(t),e||this._requestUpdateCycle()}const s=this._needFullCycle?this._instanceData.size:2e3;this._needFullCycle=!1,this._updateInstances(t,s),this.needsUpdates&&this._context.requestRender()}render(e){var t,s,n,i;const r=e.slot===D.OPAQUE_PLUGIN?D.OPAQUE_MATERIAL:e.slot===D.TRANSPARENT_PLUGIN?D.TRANSPARENT_MATERIAL:null;if(!r||!this.baseMaterial.isVisible()||!this.baseMaterial.isVisibleInPass(e.pass))return;const l=e.camera;this._inverseViewport[0]=1/l.fullViewport[2],this._inverseViewport[1]=1/l.fullViewport[3];const o={slot:r,origin:[0,0,0],camera:l,inverseViewport:this._inverseViewport,shadowMap:e.shadowMap,shadowMappingEnabled:e.shadowMap.enabled,ssaoHelper:e.ssaoHelper,ssaoEnabled:e.ssaoHelper.enabled,screenToWorldRatio:null,screenToPCSRatio:null,slicePlane:e.sliceHelper&&e.sliceHelper.plane,hudVisibilityTexture:null!=(t=null==(s=e.offscreenRenderingHelper)?void 0:s.hudVisibilityTexture)?t:null,highlightDepthTexture:null!=(n=null==(i=e.offscreenRenderingHelper)?void 0:i.depthTexture)?n:null,hasOccludees:!1,linearDepthTexture:null,lastFrameColorTexture:null,reprojectionMatrix:a,ssrEnabled:!1,lighting:e.scenelightingData,transparencyPassType:e.transparencyPassType,terrainLinearDepthTexture:e.multipassTerrainParams.terrainLinearDepthTexture,geometryLinearDepthTexture:e.multipassGeometryParams.geometryLinearDepthTexture,multipassTerrainEnabled:e.multipassTerrainParams.multipassTerrainEnabled,cullAboveGround:e.multipassTerrainParams.cullAboveGround,multipassGeometryEnabled:e.multipassGeometryParams.multipassGeometryEnabled,highlightColorTexture:null,cloudsCompositionParams:null};e.rctx.bindVAO();const c=e.pass!==I.MATERIAL_HIGHLIGHT&&e.pass!==I.MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT,h=e.pass!==I.MATERIAL_DEPTH_SHADOWMAP_DEFAULT;c&&this._renderComponents(e,r,o,this._defaultRenderInstanceData),h&&this._renderComponents(e,r,o,this._highlightRenderInstanceData)}intersect(e,t,s,a){if(!this.baseMaterial.isVisible())return;const n=c();r(n,a,s);const i=n=>{this._instanceData.getCombinedModelTransform(n,N),e.transform.set(N),o(G,s,e.transform.inverse),o(F,a,e.transform.inverse);const i=this._instanceData.getState(n),r=this._instanceData.getLodLevel(n);T(i&y.ACTIVE,"invalid instance state"),T(r>=0&&r<this._levels.length,"invaid lod level"),this._levels[r].intersect(e,t,G,F,n,this._metadata)};this.baseMaterial.parameters.verticalOffset?this.octree.forEach(i):this.octree.forEachAlongRay(s,n,i)}queryDepthRange(e){return this._queryDepthRangeOctree(e)}notifyShaderTransformationChanged(){this._invalidateOctree()}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,e&&(this._needFullCycle=!0),this.needsUpdates&&this._context.requestRender()}get needsUpdates(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}get octree(){return this._octree||(this._octree=this._buildOctree()),this._octree}_invalidateOctree(){this._octree&&(this._octree.destroy(),this._octree=null)}_buildOctree(){const e=new E(this._instanceData,this.baseBoundingSphere),t=this._instanceData,s=t.view?t.view.state:null;for(let a=0;a<this._instanceData.capacity;++a){s.get(a)&y.ACTIVE&&e.addInstance(a)}return e}_queryDepthRangeOctree(e){const t=e.eye,s=e.viewForward,a=this.octree.findClosest(s,g.FRONT_TO_BACK,e.frustum),n=this.octree.findClosest(s,g.BACK_TO_FRONT,e.frustum);if(null!=a&&null!=n){this._instanceData.view.boundingSphere.getVec(a,j),r(j,j,t);const i=l(j,s)-j[3];this._instanceData.view.boundingSphere.getVec(n,j),r(j,j,t);const o=l(j,s)+j[3];return{near:Math.max(e.near,i),far:Math.min(e.far,o)}}return{near:1/0,far:-1/0}}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._defaultRenderInstanceData.forEach((e=>{e.startUpdateCylce()})),this._highlightRenderInstanceData.forEach((e=>{e.startUpdateCylce()})),this.needsUpdates&&this._context.requestRender()}_updateInstances(e,t){const s=this._enableLevelSelection,a=this._levelSelector;a.updateCamera(e),this._defaultRenderInstanceData.forEach((e=>{e.beginUpdate()})),this._highlightRenderInstanceData.forEach((e=>{e.beginUpdate()}));const n=this._instanceData,i=this._instanceData.view,r=n.size,l=n.capacity;let o=this._instanceIndex;t=Math.min(r,t);for(let c=0;c<t;++c){0===o&&this._startUpdateCycle();const e=i.state.get(o);let r=0;if(!(e&y.ALLOCATED)){o=(o+1)%l,t++;continue}const c=i.lodLevel.get(o);if(e&y.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[c].freeTail(),e&y.HIGHLIGHT_ACTIVE&&this._highlightRenderInstanceData[c].freeTail(),e&y.REMOVE)n.freeInstance(o);else if(e&y.VISIBLE){let t=0;s&&(i.modelOrigin.getVec(o,w),t=a.selectLevel(w,n.getCombinedMedianScaleFactor(o))),r=e&~(y.ACTIVE|y.TRANSFORM_CHANGED),t>=0&&(e&y.HIGHLIGHT?(M(this._highlightRenderInstanceData[t],i,o),r|=y.HIGHLIGHT_ACTIVE):(M(this._defaultRenderInstanceData[t],i,o),r|=y.DEFAULT_ACTIVE)),i.state.set(o,r),i.lodLevel.set(o,t)}else r=e&~(y.ACTIVE|y.TRANSFORM_CHANGED),i.state.set(o,r);if(this._octree){const t=!!(e&y.ACTIVE),s=!!(r&y.ACTIVE);!t&&s?this._octree.addInstance(o):t&&!s?this._octree.removeInstance(o):t&&s&&e&y.TRANSFORM_CHANGED&&(this._octree.removeInstance(o),this._octree.addInstance(o))}o=(o+1)%l}this._instanceIndex=o,this._defaultRenderInstanceData.forEach((e=>{e.endUpdate()})),this._highlightRenderInstanceData.forEach((e=>{e.endUpdate()}))}_renderComponents(e,t,s,a){this.levels.forEach(((n,i)=>{n.components.forEach((n=>{this._renderComponent(e,t,s,a[i],n,i)}))}))}_renderComponent(t,s,a,n,i,r){if(0===n.size||!i.material.requiresSlot(s))return;const{rctx:l,pass:o}=t,c=i.glMaterials.load(l,o);if(e(c))return;const h=c.beginSlot(a),u=l.useTechnique(h,s);c.bind(a,h),l.bindVAO(i.vao),h.ensureAttributeLocations(i.vao),t.isHighlightPass&&_(u,a),h.bindDraw(a),d.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&t.pass===I.MATERIAL&&(u.setUniform4fv("externalColor",q[Math.min(r,q.length-1)]),u.setUniform1i("colorMixMode",L.replace));const m=l.capabilities.instancing,f=n.capacity,g=n.headIndex,D=n.tailIndex,v=n.firstIndex,y=this._glInstanceBufferLayout,E=(e,t)=>{U(l,p,n.buffer,y,e),m.drawArraysInstanced(h.primitiveType,0,i.vertexCount,t-e),x(l,p,n.buffer,y)};i.material.parameters.transparent&&null!=v?g>D?(T(v>=D&&v<=g,"invalid firstIndex"),E(v,g),E(D,v)):g<D&&(v<=g?(T(v>=0&&v<=g,"invalid firstIndex"),E(v,g),E(D,f),E(0,v)):(T(v>=D&&v<=f,"invalid firstIndex"),E(v,f),E(0,g),E(D,v))):g>D?E(D,g):g<D&&(E(0,g),E(D,f)),l.bindVAO(null)}}function M(e,t,s){const a=e.allocateHead();V(t,s,e.view,a)}function V(e,t,s,a){S(e.modelOrigin,t,s.modelOriginHi,s.modelOriginLo,a),s.model.copyFrom(a,e.model,t),s.modelNormal.copyFrom(a,e.modelNormal,t),e.color&&s.color&&s.color.copyFrom(a,e.color,t),e.featureAttribute&&s.featureAttribute&&s.featureAttribute.copyFrom(a,e.featureAttribute,t)}const w=c(),j=h(),N=n(),G=c(),F=c(),q=[[1,0,1,1],[0,0,1,1],[0,1,0,1],[1,1,0,1],[1,0,0,1]];export{H as LodRenderer,P as setLevelSelectorFactory};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{newLayout as e}from"../../support/buffer/InterleavedLayout.js";import{ShaderTechniqueConfiguration as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import r from"../lib/GLMaterial.js";import{Material as s,DefaultMaterialParameters as i}from"../lib/Material.js";import{RenderPass as n}from"../lib/RenderPass.js";import{RenderSlot as a}from"../lib/RenderSlot.js";import{VertexAttribute as o}from"../lib/VertexAttribute.js";import{writePosition as u}from"./internal/bufferWriterUtils.js";import{HeatmapDensityTechnique as c}from"../shaders/HeatmapDensityTechnique.js";class l extends s{constructor(e){super(e,m)}requiresSlot(e,t){return e===a.DRAPED_MATERIAL&&t===n.MATERIAL}getTechniqueConfig(){return new t}createGLMaterial(e){return new f(e)}intersect(){}createBufferWriter(){return new p}}class f extends r{constructor(e){super(e)}beginSlot(e){return this.updateParameters(e)}updateParameters(e){return this.ensureTechnique(c,e)}bind(e,t){t.bindPass(this._material.parameters,e)}}const m={searchRadius:128,...i};class p{constructor(){this.vertexBufferLayout=d}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return e.indices.get(o.POSITION).length*h}write(e,t,r,s){u(t.indices.get(o.POSITION),t.vertexAttributes.get(o.POSITION).data,e.transformation,r.position,s,h);const i=t.indices.get(o.POSITION).length,n=r.uv0;let a=s;for(let o=0;o<i;++o)n.setValues(a++,0,0),n.setValues(a++,1,0),n.setValues(a++,1,1),n.setValues(a++,1,1),n.setValues(a++,0,1),n.setValues(a++,0,0)}}const d=e().vec3f(o.POSITION).vec2f(o.UV0),h=6;function I(e){return e instanceof l}export{l as HeatmapDensityMaterial,I as isHeatMapDensityMaterial};
|