@arcgis/core 5.1.0-next.78 → 5.1.0-next.79
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/analysis/ShadowCast/DiscreteOptions.d.ts +33 -6
- package/analysis/ShadowCast/DiscreteOptions.js +1 -1
- package/analysis/ShadowCast/MinDurationOptions.d.ts +6 -4
- package/analysis/ShadowCast/TotalDurationOptions.d.ts +33 -6
- package/analysis/ShadowCast/TotalDurationOptions.js +1 -1
- package/analysis/ShadowCast/colorStopsUtils.js +2 -0
- package/analysis/ShadowCastAnalysis.d.ts +24 -1
- package/analysis/ShadowCastAnalysis.js +1 -1
- package/analysis/Viewshed.d.ts +27 -0
- package/analysis/Viewshed.js +1 -1
- package/analysis/ViewshedAnalysis.js +1 -1
- package/arcade/FunctionWrapper.js +1 -1
- package/arcade/arcadeAsyncRuntime.js +1 -1
- package/arcade/arcadeCompiler.js +1 -1
- package/arcade/arcadeRuntime.js +1 -1
- package/arcade/compilerUtils.js +1 -1
- package/arcade/debug.d.ts +139 -0
- package/arcade/debug.js +2 -0
- package/arcade/featureSetCollection.js +1 -1
- package/arcade/featureSetUtils.js +1 -1
- package/arcade/featureset/actions/GroupBy.js +1 -1
- package/arcade/featureset/actions/OrderBy.js +1 -1
- package/arcade/functions/featuresetstring.js +1 -1
- package/arcade/languageUtils.js +1 -1
- package/arcade.d.ts +46 -2
- package/arcade.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{1c7183551f5269bdcf13.js → 01bd1b86ba899c6aa4c0.js} +1 -1
- package/assets/esri/core/workers/chunks/{1f8ccf96069ac3a40c3d.js → 01ee18782a50279f907e.js} +1 -1
- package/assets/esri/core/workers/chunks/{f81c6f6ccc201f584970.js → 022067e807905cabeaa1.js} +1 -1
- package/assets/esri/core/workers/chunks/{11ea4be441a26134ce1f.js → 052cdc7aaa803b5873f0.js} +1 -1
- package/assets/esri/core/workers/chunks/{b7bb7072dbee978f3ca3.js → 056fd7847caaff2c9514.js} +1 -1
- package/assets/esri/core/workers/chunks/{8acee3fba488f202f82f.js → 05c3146d87d917606193.js} +1 -1
- package/assets/esri/core/workers/chunks/{a8ca5d8740cc7e39197b.js → 0aebcbf41cb193e76809.js} +5 -5
- package/assets/esri/core/workers/chunks/{54023458195549f66215.js → 0b77c124b743067e4155.js} +1 -1
- package/assets/esri/core/workers/chunks/10408183681fd6c7b4ed.js +2 -0
- package/assets/esri/core/workers/chunks/{7595ceba529ed01c7590.js → 2c87c3112a43db8624f6.js} +1 -1
- package/assets/esri/core/workers/chunks/{13e60f19f436b8d683ae.js → 3c9482764c9e4f8bcbb0.js} +1 -1
- package/assets/esri/core/workers/chunks/{322c54081b25f1c53661.js → 3e37019eee1c49d2bf64.js} +1 -1
- package/assets/esri/core/workers/chunks/45c83eb7c2a06166e3b0.js +1 -0
- package/assets/esri/core/workers/chunks/48acd146bf0241d87647.js +1 -0
- package/assets/esri/core/workers/chunks/5818f1f526577068d6ca.js +2 -0
- package/assets/esri/core/workers/chunks/{34fe97bcacc0dfc5bce6.js → 5ccc325d83cec4f5ccdb.js} +1 -1
- package/assets/esri/core/workers/chunks/{30e710ec4d22c43d4e7e.js → 5cffc7b49966201eccdb.js} +1 -1
- package/assets/esri/core/workers/chunks/{1a87e9bbd85ba29b1514.js → 5da2051f548c2942e01a.js} +1 -1
- package/assets/esri/core/workers/chunks/5ec66e39e53c11e75179.js +2 -0
- package/assets/esri/core/workers/chunks/{0b1454a77a6a682541dc.js.LICENSE.txt → 5ec66e39e53c11e75179.js.LICENSE.txt} +9 -1
- package/assets/esri/core/workers/chunks/5f6fd20a7f4e80eafa25.js +1 -0
- package/assets/esri/core/workers/chunks/{abc06d10c7ac8ba5b0e4.js → 67ec1694d6e18b7c234c.js} +1 -1
- package/assets/esri/core/workers/chunks/{32e22d6eee9fed1f70b0.js → 6d696beddcc5fbed5875.js} +1 -1
- package/assets/esri/core/workers/chunks/{f590b60fca607d66001a.js → 716a4d7e8b908b81870b.js} +1 -1
- package/assets/esri/core/workers/chunks/71fe127734f33d020a44.js +1 -0
- package/assets/esri/core/workers/chunks/7cdd0492b2191df95102.js +2 -0
- package/assets/esri/core/workers/chunks/7cea68257d24ffd205bb.js +1 -0
- package/assets/esri/core/workers/chunks/7e530e635325dba07864.js +1 -0
- package/assets/esri/core/workers/chunks/8f6f5dad52747d252aac.js +596 -0
- package/assets/esri/core/workers/chunks/{d950d5c2844206502ff0.js → 992cd87ba0ab6346f692.js} +1 -1
- package/assets/esri/core/workers/chunks/{73c87eb9bd8f0f848481.js → 9c11e1fe785e1385fdb1.js} +1 -1
- package/assets/esri/core/workers/chunks/{5ed8d8b5336c81fbcda3.js → 9d216e30d04ea21fc8a2.js} +1 -1
- package/assets/esri/core/workers/chunks/a54aa93b6012a2597f82.js +1 -0
- package/assets/esri/core/workers/chunks/{cf14b3a44705dacefac4.js → a9b5ce00323cd5574bf7.js} +1 -1
- package/assets/esri/core/workers/chunks/ae6b3dfe5f757df539d6.js +1 -0
- package/assets/esri/core/workers/chunks/b14c4c3f295970f731ab.js +1 -0
- package/assets/esri/core/workers/chunks/{c70df6ed190f9ebcf6aa.js → bf2c202dec5ab7bc770b.js} +1 -1
- package/assets/esri/core/workers/chunks/c1d4110aa494a1dba3c4.js +1 -0
- package/assets/esri/core/workers/chunks/{85d8c7cc7f8decbe975d.js → c442916805975744dd92.js} +1 -1
- package/assets/esri/core/workers/chunks/dacc2e5fa462495ed1cc.js +2 -0
- package/assets/esri/core/workers/chunks/f227b34cce6843df0fb6.js +1 -0
- package/assets/esri/core/workers/chunks/{dda2cb5c073d1e65f14f.js → f43d628d47eec7d530c7.js} +1 -1
- package/assets/esri/core/workers/chunks/f7531aa69a87814c60d1.js +1 -0
- package/assets/esri/core/workers/chunks/{4ccb56333de0247dcb6f.js → fb100935fd8948d779f5.js} +1 -1
- package/assets/esri/core/workers/chunks/{5ee4b630ad39c21d11db.js → fb9e3e7cd532ac4353f1.js} +12 -12
- package/assets/esri/core/workers/chunks/fc6ca7ffb9f1b875059c.js +1 -0
- package/assets/esri/core/workers/chunks/{3d9fcbe95dd22dbe730e.js → ffc4f3406ce383b9bd88.js} +1 -1
- package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +6 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ar.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bg.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bs.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ca.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_cs.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_da.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_de.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_el.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_es.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_et.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fi.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_he.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hu.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_id.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_it.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ja.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ko.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lt.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lv.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_nl.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_no.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pl.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-BR.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-PT.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ro.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ru.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sk.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sl.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sv.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_th.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_tr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_uk.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_vi.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-CN.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-HK.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-TW.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_ar.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_bg.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_bs.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_ca.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_cs.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_da.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_de.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_el.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_es.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_et.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_fi.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_fr.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_he.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_hr.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_hu.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_id.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_it.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_ja.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_ko.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_lt.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_lv.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_nl.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_no.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_pl.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_pt-BR.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_pt-PT.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_ro.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_ru.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_sk.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_sl.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_sr.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_sv.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_th.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_tr.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_uk.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_vi.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_zh-CN.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_zh-HK.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_zh-TW.json +1 -1
- package/chunks/ImageMaterial.glsl.js +7 -5
- package/chunks/SlicePlaneMaterial.glsl.js +21 -13
- package/chunks/arcade.js +1 -1
- package/chunks/languageUtils.js +1 -1
- package/config.js +1 -1
- package/core/MapUtils.js +1 -1
- package/core/arrayUtils.js +1 -1
- package/kernel.js +1 -1
- package/layers/IntegratedMeshLayer.d.ts +18 -14
- package/layers/SceneLayer.d.ts +35 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/scene/ModelFileInfo.d.ts +29 -0
- package/layers/scene/ModelFileInfo.js +2 -0
- package/layers/scene/ModelInfo.d.ts +38 -0
- package/layers/scene/ModelInfo.js +2 -0
- package/layers/scene/modelQuerySupport.js +2 -0
- package/layers/scene/types.d.ts +14 -0
- package/layers/support/infoFor3D.js +1 -1
- package/layers/support/serviceCapabilitiesUtils.js +1 -1
- package/layers/types.d.ts +13 -1
- package/package.json +3 -3
- package/popup/Features.d.ts +1 -6
- package/popup/Features.js +1 -1
- package/popup/actions.js +1 -1
- package/renderers/visualVariables/support/ColorStop.js +1 -1
- package/support/arcadeUtils.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/flow/styles/Imagery.js +1 -1
- package/views/2d/engine/flow/styles/Particles.js +1 -1
- package/views/2d/engine/flow/styles/Streamlines.js +1 -1
- package/views/2d/engine/vectorTiles/Placement.js +1 -1
- package/views/2d/engine/vectorTiles/TextShaping.js +1 -1
- package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
- package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
- package/views/2d/engine/webgl/GlyphSource.js +1 -1
- package/views/2d/engine/webgl/Overlay.js +1 -1
- package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
- package/views/2d/engine/webgl/RenderingDevice.js +1 -1
- package/views/2d/engine/webgl/TextureManager.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/GLSLShaderModule.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/GraphShaderModule.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/graph/ShaderGraphContext.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/TechniqueProgramCache.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/TestTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/TextureStatisticsTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AAnimatedShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimationUniformInfo.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/bitmap/BitmapTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/blend/BlendTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/bloom/BloomTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/blur/BlurTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/colorize/ColorizeTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityPointShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityPolygonShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/drop-shadow/DropShadowTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/FillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/GradientFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/flow/FlowTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/grid/GridTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/LineTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/TexturedLineTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/magnifier/MagnifierTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/opacity/OpacityTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/overlay/OverlayTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterColorizerTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterHighlightTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/VectorFieldTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/AspectTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/BandArithmeticTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/BaseRasterProcessorTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ColormapToRGBTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/CompositeBandTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ComputeChangeTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ContrastBrightnessTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ConvolutionTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/CurvatureTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ExtractBandTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/FocalStatisticsTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/GrayscaleTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/HillshadeTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/LocalTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/MaskTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/NDVITechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/RemapTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ReprojectTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ShadedReliefTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/SlopeTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/SpectralConversionTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/StretchTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/AFeatureShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BitmapShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BlendShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BlitShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BloomShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BlurShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ColorizeShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ComplexFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ComplexOutlineFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/DropShadowShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/EntityStorage.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/GradientFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/GradientStrokeShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/HeatmapAccumulateShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/HeatmapResolveShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/MosaicInfo.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/OpacityShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/OverlayShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/PatternFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/PatternOutlineFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsDiffShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsMinMaxSumShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsStdDevShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsSumOfSquaredDiffShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TexturedLineShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/flow/FlowImageryShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/flow/FlowUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/BaseRasterColorizerShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/BaseRasterHighlightShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterColorizerLUTShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterColorizerShadedReliefShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterColorizerStretchShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterXYBandHighlightShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/lut.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/AspectShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/BaseRasterProcessorShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/ColormapToRGBShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/ConvolutionShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/CurvatureShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/FocalStatisticsShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/HillshadeShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/MultiRasterMixin.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/ShadedReliefShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/SlopeShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/projection.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/stretch.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderBackground.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderFill.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderIcon.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderLine.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderText.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vvUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileDebugInfoTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileStencilTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueBackground.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueCircle.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueFill.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueLine.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueSymbol.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/videoScreenRenderer/VideoScreenTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/typed/TypedShaderProgram.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/3d/FocusAreasView.js +1 -1
- package/views/3d/StencilGeometry.js +2 -0
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedComputedData.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedConfiguration.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedFieldOfViewManipulation.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedScaleOrientManipulation.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedShapeVisualElement.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubVisualization.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/analysis/Viewshed/viewshedToolUtils.js +1 -1
- package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
- package/views/3d/focusAreaUtils.js +2 -0
- package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshNormals.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/SceneLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerWorker.js +1 -1
- package/views/3d/layers/i3s/I3SQueryEngine.js +1 -1
- package/views/3d/layers/i3s/I3SUtil.js +1 -1
- package/views/3d/layers/support/DefinitionExpressionSceneLayerView.js +1 -1
- package/views/3d/layers/support/TemporalSceneLayerView.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueRepository.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/LocalAtmosphere.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/MarsAtmosphere.js +1 -1
- package/views/3d/webgl-engine/effects/blit/Blit.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/CloudsComposition.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/CloudsRenderer.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/CloudsTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/NoiseTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/focusAreaMaskUtils.js +2 -0
- package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlightBuffer.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserlinePathTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
- package/views/3d/webgl-engine/effects/precipitation/Precipitation.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/effects/stars/Stars.js +1 -1
- package/views/3d/webgl-engine/effects/stars/StarsTechnique.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/Compositor.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillComputationRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillVisualizationRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/Material.js +1 -1
- package/views/3d/webgl-engine/lib/Normals.js +1 -1
- package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/CheckerBoardTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/CompositingTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/MeasurementArrowTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +10 -10
- package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/SlicePlaneMaterialTechnique.js +1 -1
- package/views/View2D.js +1 -1
- package/views/draw/support/GraphicMover.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/editingSessionUtils.js +1 -1
- package/views/webgl/FramebufferObject.js +1 -1
- package/widgets/BatchAttributeForm/css.js +1 -1
- package/widgets/BatchAttributeForm/inputs/GroupInput.d.ts +2 -1
- package/widgets/BatchAttributeForm/inputs/RelationshipElementInput.d.ts +54 -0
- package/widgets/BatchAttributeForm/inputs/RelationshipElementInput.js +2 -0
- package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
- package/widgets/BatchAttributeForm/inputs/types.d.ts +4 -3
- package/widgets/BatchAttributeForm/templates/AttachmentElementTemplate.js +1 -1
- package/widgets/BatchAttributeForm/templates/RelationshipElementTemplate.js +2 -0
- package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/hashElementTemplate.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/templateUtils.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/CoordinateConversion/CoordinateConversionViewModel.d.ts +21 -1
- package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
- package/widgets/CoordinateConversion/support/Format.js +1 -1
- package/widgets/CoordinateConversion/support/coordinateConversionUtils.js +1 -1
- package/widgets/CoordinateConversion.d.ts +21 -1
- package/widgets/CoordinateConversion.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
- package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
- package/widgets/Editor/support/SketchController.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/support/ContingentValuesManager.js +1 -1
- package/widgets/types.d.ts +1 -1
- package/assets/esri/core/workers/chunks/07eff82916681fcff069.js +0 -1
- package/assets/esri/core/workers/chunks/0b1454a77a6a682541dc.js +0 -2
- package/assets/esri/core/workers/chunks/1c7fd0a229a8112b0539.js +0 -596
- package/assets/esri/core/workers/chunks/3697e51e1e4cf442f39a.js +0 -1
- package/assets/esri/core/workers/chunks/3cce9dad8ee0e4971d50.js +0 -1
- package/assets/esri/core/workers/chunks/3df8493b91aa3bce824d.js +0 -1
- package/assets/esri/core/workers/chunks/68a313155ddc29bd024d.js +0 -1
- package/assets/esri/core/workers/chunks/751609831b283903ba48.js +0 -1
- package/assets/esri/core/workers/chunks/7bacdd65a6cc4d284e0a.js +0 -2
- package/assets/esri/core/workers/chunks/7e97684e851274efd11f.js +0 -1
- package/assets/esri/core/workers/chunks/85aac8539996372f1ee8.js +0 -1
- package/assets/esri/core/workers/chunks/99d298d0039c536fcf3e.js +0 -1
- package/assets/esri/core/workers/chunks/9aaf78b831f8739bc127.js +0 -1
- package/assets/esri/core/workers/chunks/9b9916864b6575c42c8a.js +0 -1
- package/assets/esri/core/workers/chunks/bf7e019437a3b6036300.js +0 -2
- package/assets/esri/core/workers/chunks/d304343a781acfa3ff96.js +0 -1
- package/assets/esri/core/workers/chunks/dbb9bb28696ff9536678.js +0 -2
- package/assets/esri/core/workers/chunks/f09a41ad239d467d9438.js +0 -2
- package/assets/esri/core/workers/chunks/f6912532aae1638cbe8f.js +0 -1
- /package/assets/esri/core/workers/chunks/{7bacdd65a6cc4d284e0a.js.LICENSE.txt → 10408183681fd6c7b4ed.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{f09a41ad239d467d9438.js.LICENSE.txt → 5818f1f526577068d6ca.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{dbb9bb28696ff9536678.js.LICENSE.txt → 7cdd0492b2191df95102.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{bf7e019437a3b6036300.js.LICENSE.txt → dacc2e5fa462495ed1cc.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../Color.js";import i from"../../../Graphic.js";import{isSome as s,removeUnordered as r}from"../../../core/arrayUtils.js";import has from"../../../core/has.js";import o from"../../../core/Logger.js";import{equals as n}from"../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../core/maybe.js";import l from"../../../core/PooledArray.js";import{ignoreAbortErrors as d,isAbortError as h,throwIfAborted as c}from"../../../core/promiseUtils.js";import{initial as u,watch as _}from"../../../core/reactiveUtils.js";import{schedule as m}from"../../../core/scheduling.js";import{equals as g}from"../../../core/SetUtils.js";import{isArrayBuffer as f}from"../../../core/typedArrayUtil.js";import{property as p,subclass as y}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as b,exactEquals as v,invert as I}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as C,IDENTITY as M}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{multiply as x,getTranslation as w}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{clone as S,create as E}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as O}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{set as R,transformMat4 as j,transformMat3 as V,sub as F,add as D,scale as A,subtract as T,len as H}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as N}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as P}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as k}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as U}from"../../../core/support/UpdatingHandles.js";import{getSphericalPCPF as L}from"../../../geometry/spatialReferenceEllipsoidUtils.js";import{localLinearScaleFactors as G}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectBoundingSphere as B}from"../../../geometry/projection/projectBoundingSphere.js";import{projectBuffer as q}from"../../../geometry/projection/projectBuffer.js";import{getProjectorName as z}from"../../../geometry/projection/projectors.js";import{projectVectorToVector as W}from"../../../geometry/projection/projectVectorToVector.js";import{fromBuffer as $,toRect as K,create as Q}from"../../../geometry/support/aaBoundingBox.js";import{create as J,intersects as Y}from"../../../geometry/support/aaBoundingRect.js";import{newDoubleArray as X,ensurePackedMat4f64 as Z}from"../../../geometry/support/DoubleArray.js";import{compactFloatArray as ee}from"../../../geometry/support/FloatArray.js";import{compactIndices as te}from"../../../geometry/support/Indices.js";import{Sphere as ie}from"../../../geometry/support/sphere.js";import{newUByteArray as se}from"../../../geometry/support/UByteArray.js";import{fallbackObjectIDAttribute as re}from"../../../layers/LayerConstants.js";import oe from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as ne}from"../../../layers/support/fieldUtils.js";import ae from"../../../layers/support/SceneModification.js";import{getColor as le,getOpacity as de}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{isBasemapLayerView as he}from"../../../support/basemapUtils.js";import{getElevationOffset as ce}from"../../../support/elevationInfoUtils.js";import{loadArcade as ue}from"../../../support/loadArcade.js";import _e from"../../../symbols/MeshSymbol3D.js";import me from"../../../symbols/SimpleFillSymbol.js";import{ContentGeometryUpdateEvent as ge}from"./ContentGeometryLayerView.js";import fe from"./I3SMeshViewLabeler.js";import{I3SMeshViewPerformanceInfo as pe}from"./I3SMeshViewPerformanceInfo.js";import{initialize as ye,setModificationsSync as be,filterObbsForModificationsSync as ve,interpretObbModificationResults as Ie}from"./SceneLayerWorker.js";import{SceneLayerWorkerHandle as Ce,toWasmModification as Me}from"./SceneLayerWorkerHandle.js";import{overrideColor as xe}from"./graphics/graphicUtils.js";import{areLabelsVisible as we}from"./graphics/Labeler.js";import Se from"./i3s/Highlights.js";import{I3SAsyncElevationUpdater as Ee}from"./i3s/I3SAsyncElevationUpdater.js";import{getCachedAttributeValue as Oe}from"./i3s/I3SBinaryReader.js";import{I3SCrossfadeHelper as Re,NodeCrossfadeMetaData as je}from"./i3s/I3SCrossfadeHelper.js";import{boundingBoxCornerPoints as Ve}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as Fe}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as De,selectEncoding as Ae,defaultMaterial as Te,createTexture as He,configureMaterial as Ne}from"./i3s/I3SMaterialUtil.js";import{I3SOverrides as Pe}from"./i3s/I3SOverrides.js";import{computeGlobalTransformation as ke}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as Ue,checkSceneLayerValid as Le,checkSceneLayerCompatibleWithView as Ge,whenGraphicAttributes as Be,computeVisibilityObb as qe,filterInPlace as ze,intersectBoundingRectWithMbs as We,addWraparound as $e,getSymbolInfo as Ke,transparentEdgeMaterial as Qe,getClipRect as Je}from"./i3s/I3SUtil.js";import{IDBCache as Ye}from"./i3s/IDBCache.js";import{IDBMockCache as Xe}from"./i3s/IDBMockCache.js";import{LayerElevationProvider as Ze}from"./i3s/LayerElevationProvider.js";import{SymbologyInfo as et}from"./i3s/SymbologyInfo.js";import{attributeLookup as tt}from"./support/attributeUtils.js";import{normalizeHighlightTarget as it,emptyHighlightHandle as st}from"./support/highlightUtils.js";import{makeScheduleFunction as rt}from"./support/makeScheduleFunction.js";import{debugFlags as ot}from"../support/debugFlags.js";import{ElevationRange as nt}from"../support/ElevationRange.js";import{toBoundingRect as at}from"../support/extentUtils.js";import{Obb as lt,ensurePackedObbData as dt}from"../support/orientedBoundingBox.js";import{updatingProgress as ht}from"../support/updatingProperties.js";import{glLayout as ct}from"../support/buffer/glUtil.js";import{ObjectParameters as ut}from"../webgl-engine/collections/Component/ObjectParameters.js";import{createVertexBufferLayout as _t,ComponentGeometryParameters as mt,SourceGeometry as gt,VertexBufferLayoutCreationParameters as ft}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as pt}from"../webgl-engine/collections/Component/Transform.js";import{emissiveStrengthDefault as yt}from"../webgl-engine/core/shaderLibrary/output/Emissions.glsl.js";import{loadBasisTranscoder as bt}from"../webgl-engine/lib/BasisUtil.js";import{getHighlightName as vt}from"../../support/highlightOptionsUtils.js";import{TextureCompressionTracker as It}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as Ct}from"../../../webscene/support/AlphaCutoff.js";const Mt=[1,1,1,1];class xt extends je{constructor(e,t,i,s,r,o,n,a,l){super(),this.node=e,this.featureIds=t,this.objectHandle=i,this.cachedRendererVersion=s,this.attributeInfo=r,this.material=o,this.textures=n,this.anchorIds=a,this.anchors=l,this.cachedElevationAnchors=null,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0,this.cachedSymbologyStride=5}get usedMemory(){return this.node.memory}get featureExtents(){return this._featureExtents??=new Float64Array(6*this.featureIds.length).fill(Number.POSITIVE_INFINITY),this._featureExtents}}const wt=27,St=104857600,Et=t=>{const f=t;let H=class extends f{constructor(){super(...arguments),this._applySSAO=!0,this._imShading=!!has("enable-feature:im-shading"),this._imVertexNormals=!!has("enable-feature:im-vertex-normals"),this._updatingHandles=new U,this._highlights=null,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._snappingSourcesTrackers=[],this._compressionTracker=new It,this._hasLoadedPBRTextures=!1,this._asyncModuleLoading=0,this._addTasks=new Map,this._currentRenderer=null,this._rendererVersion=0,this._colorVariable=null,this._opacityVariable=null,this._rendererFields=null,this._symbologyFields=null,this._symbologyOverride=null,this._symbologyOverrideFields=null,this._symbolInfos=new Map,this._visibleGeometryChangedSchedulerHandle=null,this._hasComponentData=!1,this._hasVertexColors=!1,this._nodeColorOverride=null,this.updating=!0,this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.slicePlaneEnabled=!1,this._modifications=new Array,this.ignoresMemoryFactor=!1,this._layerUrl="",this._cacheKeySuffix=null,this._planetRadiusInGlobalMode=0,this._elevationTask=null,this._needFilterResolve=!1,this._filters=[],this._arcade=null,this._tmpAttributeOnlyGraphic=new i,this._crossfadeHelper=new Re(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerViewUid(){return this.uid}get layerId(){return this.i3slayer.id}get sublayerId(){return null}get _isIntegratedMesh(){return"integrated-mesh"===this.i3slayer.type}get contentVisible(){return!this.suspended&&this._controller?.rootNodeVisible&&this.fullOpacity>Ct}get legendEnabled(){return this.contentVisible&&!0===this.i3slayer?.legendEnabled}get updatingProgressValue(){return this._controller?.updatingProgress??0}get hasTexturesOrVertexColors(){return this._hasData?this._hasTextures||this._hasColors?"yes":"probably-not":"unknown"}get rendererTextureUsage(){return Ue(this._currentRenderer)?this._usePBR||this._hasLoadedPBRTextures?63:53:this._usePBR||this._hasLoadedPBRTextures?44:36}get elevationOffset(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;return null!=e&&"absolute-height"===e.mode?ce(e,this.i3slayer.spatialReference):0}get elevationInfo(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null==e)return new Lt(0,0);const t=ce(e,this.i3slayer.spatialReference);switch(e.mode){case"absolute-height":return new Lt(0,t);case"relative-to-ground":return new Lt(1,t);case"on-the-ground":return new Lt(2,0);default:return new Lt(0,0)}}get supportedTextureEncodings(){return De(this.view.stage.renderView.capabilities)}get clientGeometry(){return this.i3sOverrides.geometryOverrides}get elevationRange(){const e=this._nodeId2Meta,t=new nt;for(const i of e.values()){const e=i?.node.serviceMbsInIndexSR;e&&t.expandElevationRangeValues(e.center[2]-e.radius,e.center[2]+e.radius)}return t.elevationRangeValid?t:null}get fullExtent(){return this.i3slayer.fullExtent}initialize(){const e=has("enable-feature:idb-mock-cache");this._idbCache=e?new Xe(this.view,e):new Ye("esri-scenelayer-cache","geometries"),this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const t=this.view.resourceController,i=t.memoryController;this.i3sOverrides=new Pe({view:this.view,layer:this.i3slayer,memoryController:i}),this._workerHandle=new Ce(rt(t)),this.addResolvingPromise(this._workerHandle.promise),Le(this.i3slayer),Ge(this.i3slayer,this.view);const s=this.i3slayer.store.defaultGeometrySchema;if(this.addResolvingPromise(this._workerHandle.setLegacySchema(this.uid,s).catch(d)),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new oe({layerView:this,worker:this._workerHandle}),this._gpuMemoryEstimate=0,this._texMemoryEstimate=0,this._geoMemoryEstimate=0,this._stage=this.view.stage,this._collection=this._stage.renderView.componentObjectCollection,this._isIntegratedMesh||!s)this._hasComponentData=!1;else{const e=s.featureAttributes;this._hasComponentData=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=(s?.vertexAttributes.color??null)&&!this.i3slayer.cachedDrawingInfo?.color;const r=this.view.resourceController.memoryController.newCache(`sl-${this.uid}`,e=>this._deleteComponentObject(e));this._memCache=r;const n=this._controller,l=this._nodeId2Meta,h=this._nodeId2MetaReloading,c=e=>{const t=n.index;if(!t)return;const i=t.rootNode;if(!i)return;const s=t=>{const i=t.index,s=l.get(i)||h.get(i);return e(t,s?.objectHandle??null)};t.traverse(i,s)};this._intersectionHandler=new Fe({layerViewUid:this.layerViewUid,sublayerId:this.sublayerId,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:c}),this._elevationProvider=new Ze({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR,this._updatingHandles.add(()=>this.view.clippingArea,()=>this._clippingAreaChanged(),u),this._updatingHandles.add(()=>this.fullOpacity,e=>this._opacityChange(e)),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this.elevationOffset,(e,t)=>{this._reloadAll(t),this._controller.invalidateVisibilityObbs()}),this._updatingHandles.add(()=>this.elevationInfo,(e,t)=>this._elevationInfoChanged(e,t),u),this._updatingHandles.add(()=>!this.suspended&&0!==this.elevationInfo.mode,(e,t)=>{e?this.addHandles(this.view.basemapTerrain.on("elevation-change",({extent:e})=>this._ensureElevationTask().addExtent(e)),qt):t&&this.removeHandles(qt)},u),this._updatingHandles.add(()=>this._usePBR,e=>this._updatePBR(e));const m=()=>{this._reloadAll(),this.clearMemCache()};this._updatingHandles.add(()=>this.rendererTextureUsage,m),this._updatingHandles.add(()=>this.contentVisible,e=>this._contentVisibleChanged(e),u),this._updatingHandles.add(()=>this.i3slayer.labelsVisible,()=>this._labelingChanged(),u),this._updatingHandles.add(()=>this.i3slayer.labelingInfo,()=>this._labelingChanged(),u),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged(),u),this.addHandles([_(()=>ot.I3S_TREE_SHOW_TILES,e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then(({I3STreeDebugger:t})=>{!this._treeDebugger&&ot.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))})}else e||ot.I3S_TREE_SHOW_TILES||(this._treeDebugger=a(this._treeDebugger))},u),_(()=>ot.I3S_SHOW_MODIFICATIONS,()=>this._showModifications(),u)]),this._cacheKeySuffix=this._getCacheKeySuffix(),this._idbCache.init().catch(e=>o.getLogger(this).warn(`Failed to initialize IndexedDB cache: ${e}`));const{view:g}=this,{viewingMode:f,renderCoordsHelper:p}=g;this._planetRadiusInGlobalMode="local"===f?0:p.referenceEllipsoid.radius}destroy(){this._clearAddTasks(),this._elevationTask=a(this._elevationTask),this.i3sOverrides=a(this.i3sOverrides),this._elevationProvider&&(this._elevationProvider.notifyObjectsChanged(this.getVisibleObbs()),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._intersectionHandler&&(this._stage.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null);const e=this._workerHandle;e&&(e.destroyContextAndSelf(this.uid),this._workerHandle=null),this._removeAllNodeDataFromStage(),this._memCache=a(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=a(this._labeler),this._treeDebugger=a(this._treeDebugger),this._controller=a(this._controller),this._highlights=a(this._highlights),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this._crossfadeHelper=a(this._crossfadeHelper),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null),this._updatingHandles=a(this._updatingHandles)}_memEstimateTextureAdded(e){const t=e.usedMemory;return this._gpuMemoryEstimate+=t,this._texMemoryEstimate+=t,t}_memEstimateTextureRemoved(e){if(null!=e){const t=e.usedMemory;this._gpuMemoryEstimate-=t,this._texMemoryEstimate-=t}}_memEstimateGeometryAdded(e){const t=this._collection.getObjectGPUMemoryUsage(e);return this._gpuMemoryEstimate+=t,this._geoMemoryEstimate+=t,t}_memEstimateGeometryRemoved(e){const t=this._collection.getObjectGPUMemoryUsage(e);this._gpuMemoryEstimate-=t,this._geoMemoryEstimate-=t}isNodeLoaded(e){return this._nodeId2Meta.has(e)}isNodeReloading(e){return this._nodeId2MetaReloading.has(e)}get usedMemory(){let e=null!=this._labeler?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach(t=>e+=null!=t?t.node.memory:0),this._nodeId2MetaReloading.forEach(t=>e+=null!=t?t.node.memory:0),e}get unloadedMemory(){return(null!=this._controller?this._controller.unloadedMemoryEstimate:0)+(null!=this._labeler?this._labeler.unloadedMemoryEstimate:0)}_labelingChanged(){if(!(we(this.i3slayer)&&this._supportsLabeling))return void(null!=this._labeler&&(this._labeler.destroy(),this._labeler=null));if(null!=this._labeler)return;const e=new fe({view:this.view,layer:this.i3slayer,collection:this._collection,overrides:this.i3sOverrides,layerViewUid:this.uid});this._nodeId2Meta.forEach(t=>null!=t&&this._addMetaToLabeler(e,t)),this._labeler=e}_loadAsyncModule(e){return++this._asyncModuleLoading,e.then(e=>(--this._asyncModuleLoading,e),e=>{throw--this._asyncModuleLoading,e})}_modificationsChanged(){if(!this._i3sWasmLoaded&&this.hasModifications)return this._i3sWasmLoaded=ye().then(()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()}),void this.notifyUpdate();if(!0!==this._i3sWasmLoaded)return;const e=e=>o.getLogger(this).error("set-modifications-error","Error when setting modifications:",e),t=this.uid,i=this.i3slayer.spatialReference,s=i.isGeographic,r=Me(this._layerClippingArea,this._modifications,i);this._workerHandle.setModifications(t,r,s).catch(e);try{be({context:t,modifications:r,isGeodetic:s})}catch(a){e(a)}this._controller.modificationsChanged();const n=this.hasModifications?new l:null;this._nodeId2Meta.forEach((e,t)=>{null==e?(this._nodeId2Meta.delete(t),this._controller.updateLoadStatus(t,!1)):e.node.hasModifications?(this._updateFeatureIdCounts(e,-1),this._nodeId2Meta.delete(t),this._nodeId2MetaReloading.set(t,e)):null!=n&&n.push(e.node)}),this.notifyChange("elevationRange"),null!=n&&this._nodeId2MetaReloading.forEach(e=>n.push(e.node)),null!=n&&n.length>0&&(this.updateNodeModificationStatus(n),n.forAll(e=>{if(2!==e.imModificationImpact){const t=this._nodeId2Meta.get(e.index);this._controller.invalidateGeometryVisibility(e.index),null!=t?(this._updateFeatureIdCounts(t,-1),this._nodeId2Meta.delete(e.index),this._nodeId2MetaReloading.set(e.index,t),this.notifyChange("elevationRange")):this._nodeId2Meta.has(e.index)&&(this._nodeId2Meta.delete(e.index),this._controller.updateLoadStatus(e.index,!1))}})),this.clearMemCache(),this._controller.restartNodeLoading(),this._showModifications()}_showModifications(){if(null!=this._modificationGraphics&&(this.view.graphics.removeMany(this._modificationGraphics),this._modificationGraphics=null),!ot.I3S_SHOW_MODIFICATIONS||0===this._modifications.length)return;const e={clip:[227,227,79,.8],mask:[227,139,79,.8],replace:[139,227,79,.8]},t={outline:{color:[255,255,255],width:1}};this._modificationGraphics=[];for(const s of this._modifications){const r=s.geometry;r.spatialReference=this.i3slayer.spatialReference;const o=new me({...t,color:e[s.type]});this._modificationGraphics.push(new i({geometry:r,symbol:o}))}this.view.graphics.addMany(this._modificationGraphics)}_addMetaToLabeler(e,t){e.addNodeMeta(t,(e,t)=>this._createAttributes(e,t))}_contentVisibleChanged(e){e?(this.view.elevationProvider.register(this._elevationContext,this._elevationProvider),this._stage.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler)):(this._removeAllNodeDataFromStage(),this.view.elevationProvider&&this.view.elevationProvider.unregister(this._elevationProvider),this._stage.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler))}getLoadedAttributes(e){const t=this._nodeId2Meta.get(e);if(null!=t?.attributeInfo)return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if(null!=t?.attributeInfo)return t.attributeInfo.attributeData}setAttributeData(e,t){const i=this._nodeId2Meta.get(e);null!=i?.attributeInfo&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const s=this._nodeId2Meta.get(e);null!=s&&(await this.i3sOverrides.applyAttributeOverrides(s.featureIds,t,i,this._controller.requiredAttributes),s.attributeInfo=t,this._controller.reschedule(()=>{this._nodeId2Meta.get(e)===s&&this._attributeValuesChanged(s)},i).catch(e=>{h(e)||o.getLogger(this).warn("Error while updating attribute values. Layer might not display correctly.",e)}))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.appliedFilters=null,null!=this._labeler&&this._labeler.setNodeMetaAttributes(e,(e,t)=>this._createAttributes(e,t)),this._updateEngineObject(e)}clearMemCache(){null!=this._memCache&&this._memCache.clear(),this._addTasks.forEach(e=>e.allowMemCache=!1)}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach(t=>null!=t&&e.push(t.node)),e}getVisibleObbs(){const e=new Array;return this._nodeId2Meta.forEach(t=>t&&e.push(this._collection.getComponentObb(t.objectHandle))),e}getLoadedNodeIndices(e){this._nodeId2Meta.forEach((t,i)=>e.push(i)),this._nodeId2MetaReloading.forEach((t,i)=>e.push(i))}_preLoadBasis(){!has("disable-feature:i3s-basis")&&2&this.supportedTextureEncodings&&this.i3slayer.textureSetDefinitions?.some(e=>e.formats.some(e=>"basis"===e.format||"ktx2"===e.format))&&bt()}_getVertexBufferLayout(e,t){return ct(_t(this._getGeometryParameters({hasTexture:At(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion})))}_getObjectIdField(){return this.i3slayer.objectIdField||re}_getGlobalIdField(){return this.i3slayer.globalIdField}_findGraphicNodeAndIndex(e){const t=tt(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());for(const i of this._nodeId2Meta.values()){const e=i?.featureIds.indexOf(t);if(null!=e&&e>=0)return{node:i.node,index:e}}return null}_getGraphicIndices(e,t){const i=this._nodeId2Meta.get(e.index);if(null==i)return[];const s=[],r=this._getObjectIdField(),o=this.i3slayer.fieldsIndex;for(const n of t){const e=tt(o,n.attributes,r),t=i.featureIds.indexOf(e);-1!==t&&s.push(t)}return s}whenGraphicBounds(e){const t=this._findGraphicNodeAndIndex(e);if(!t)return Promise.reject();const i=this.getAABB(t.node.index,t.index);return null==i?Promise.reject():Promise.resolve({boundingBox:i,screenSpaceObjects:[]})}getAABBFromIntersectorTarget(e){return null==e.nodeIndex||null==e.componentIndex?null:this.getAABB(e.nodeIndex,e.componentIndex)}getAABB(e,t){const i=this._nodeId2Meta.get(e);if(null==i?.featureIds||t>=i.featureIds.length)return null;const s=i.objectHandle,r=Ve(t,this._collection,s,X(24),0),o=this.view.renderSpatialReference,n=this.view.spatialReference;return q(r,o,0,r,n,0)?$(r):null}whenGraphicAttributes(e,t){return Be(this.i3slayer,e,this._getObjectIdField(),t,()=>[...this._nodeId2Meta.values()].filter(s))}getGraphicFromIntersectorTarget(e,t){if(null==e.nodeIndex||null==e.componentIndex)return null;const i=this._nodeId2Meta.get(e.nodeIndex);if(null==i?.featureIds||e.componentIndex>=i.featureIds.length)return null;const s=this._createLayerGraphic(this._createAttributes(e.componentIndex,i));return s?t.defer?(t.defer(async()=>(s.geometry=(await import("./i3s/meshUtils.js")).createMesh({layerView:this,nodeIndex:e.nodeIndex,featureIndex:e.componentIndex}),s)),null):s:null}_getCacheKey(e){return`${this._layerUrl}/v${wt}/${e}${this._cacheKeySuffix}`}_getCacheKeySuffix(){const e=this.view.renderSpatialReference;if(null==e)return Wt;if(e===L(e))return $t;return this.i3slayer.spatialReference.equals(e)?zt:null!=e.wkid?`@${e.wkid}`:null}_getMemCacheKey(e,t=this.elevationOffset){return e+"#"+t}get _idbCacheEnabled(){return!this._controller.disableIDBCache&&!this.hasModifications&&0===this.elevationOffset&&null!=this._cacheKeySuffix}loadCachedGPUData(e){return null!=this._memCache?this._memCache.pop(this._getMemCacheKey(e)):null}deleteCachedGPUData(e){null!=e&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(null==this._memCache)return void this._deleteComponentObject(e);const i=this._controller.indexDepth-e.node.level;this._memCache.put(this._getMemCacheKey(e.node.index,t),e,i)}loadMissingTextures(e,t,i,s){const r=e?.filter((e,i)=>{if(0===(e.usage&this.rendererTextureUsage))return!1;if(null==t)return!0;const s=Ae(e.encodings,this.supportedTextureEncodings),r=t[i];return!!(null==r?.data||s&&r.encoding!==s.encoding)})??[];return 0===r.length?Promise.resolve(!1):i(r,s).then(i=>{let s=0;for(let r=0;r<e.length;r++)s<i.length&&i[s].id===e[r].id&&(t[r]=i[s],s++);return!0})}loadCachedNodeData(e,t,i){return this._idbCacheEnabled?this._idbCache.get(this._getCacheKey(e.id),t).then(s=>null==s?null:(s.globalTrafo=Z(s.globalTrafo),s.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e.id)),null):(0===this.elevationInfo.mode&&(e.geometryObbInRenderSR=lt.fromData(s.geometryObbData)),this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then(i=>(i&&this._idbCache.initialized&&null!=s.textureData&&(s.byteSize=Nt(s.transformedGeometry,s.textureData),s.textureData.every(Ht)&&this._indexedDbSizeCheck(e,s)&&this._idbCache.put(this._getCacheKey(e.id),s).catch(t=>o.getLogger(this).warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`))),c(t),s))))):Promise.resolve(null)}addNode(e,t,i){return Tt(t)?null==t.geometryBuffer?(this._addNodeMeta(e.index,null),Promise.resolve()):this._addData(e,t.attributeDataInfo,()=>this._transformNode(e,t,i).then(s=>this._safeReschedule(()=>{if(null==s)return e.hasModifications=!1,this._addCachedNodeData(e,null,i);const{obb:r,componentOffsets:n,featureIds:a,anchorIds:l,anchors:d,transformedGeometry:h}=s;e.hasModifications=h.hasModifications;const c=Z(s.globalTrafo),u=R(Gt,r.center.x,r.center.y,r.center.z);j(u,u,c);const _=new lt(u,[r.extents.x,r.extents.y,r.extents.z],O(r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w));0===this.elevationInfo.mode&&(e.geometryObbInRenderSR=_),t.geometryData.componentOffsets=n,a&&(t.geometryData.featureIds=Array.from(a)),t.geometryData.anchorIds=l,t.geometryData.anchors=d;const m={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:h,globalTrafo:c,geometryObbData:_.data,byteSize:Nt(h,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&this._indexedDbSizeCheck(e,m)){const t=null!=m.textureData?m.textureData.map(e=>Ht(e)?e:null):null;this._idbCache.put(this._getCacheKey(e.id),{...m,textureData:t}).catch(t=>o.getLogger(this).warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`))}return this._addCachedNodeData(e,m,i)},i))):Promise.reject()}getElevationRange(e){const t=new nt,i=this._controller,{index:s}=i;if(!s)return t;const{rootNode:r}=s;if(!r)return t;const o=this._nodeId2Meta,n=e.radius,a=i.viewportQueries,l=this._planetRadiusInGlobalMode,{view:d}=this,{renderCoordsHelper:h}=d,c=h.referenceEllipsoid.radius,u=this._collection,_=i=>{const{childrenLoaded:s}=i;if(0===s)return!1;const r=a.getAndUpdateVisibilityObbInRenderSR(i);let d=null,_=-1;if(r){if(_=r.radius,!r.intersectSphereWithMBS(e,_))return!1}else d=a.calculateServiceMbsInRenderSRElevationAdjusted(i),d&&(_=d.radius);if(_>=0&&n>=1*_)return null!=r?Jt(t,r,l):d?.isValid&&Yt(t,d,l),!1;const m=Qt;if(m.minElevation=1/0,m.maxElevation=-1/0,(null!=r||null!=d)&&(null!=r?Jt(m,r,l):null!=d&&Yt(m,d,l),m.minElevation>=t.minElevation&&m.maxElevation<=t.maxElevation))return!1;const g=o.get(i.index);if(g){const{geometryObbInRenderSR:s}=i;if(!s||s.intersectSphereWithMBS(e)){if(s){if(n>0*s.radius)return Jt(t,s,l),!1}const{objectHandle:e}=g,i=u.getObjectTransform(e),r=h.getAltitude(i.position);u.expandRangeWithComponentObjectElevationRange(e,r,c,t)}}return s-(g?1:0)>0};return s.traverse(r,_),t}computeVisibilityObb(e){return qe(e,this.view.renderSpatialReference,this._controller.crsIndex,this.i3slayer.spatialReference,this.elevationOffset,this._modifications,this.view.renderCoordsHelper.sphericalPCPF)}_transformNode(e,t,i){const s=t.geometryData.geometries??[],r=new Array(s.length);for(let f=0;f<s.length;++f)r[f]=this._getVertexBufferLayout(s[f],t.geometryDescriptor);const o=this.i3slayer.normalReferenceFrame,n=t.normalReferenceFrame??o??"none",a=e.serviceMbsInIndexSR,l=this.elevationOffset,d=this._controller.crsIndex,h=this._controller.crsVertex,c=this.view.renderSpatialReference,u=ke(a,l,n,d,c),_=z(d,h),m=z(h,c);if(null==_||null==m)return Promise.resolve(null);const g={context:this.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,globalTrafo:u,mbs:a.toJSON(),obbData:e.serviceObbInIndexSR?.data,elevationOffset:l,needNormals:this._controller.isMeshPyramid||this._imVertexNormals,computeNormals:this._isIntegratedMesh&&this._imVertexNormals,normalReferenceFrame:n,indexToVertexProjector:_,vertexToRenderProjector:m};return this._workerHandle.invoke(g,i)}get _supportsNodeCrossFading(){return!this.view?.stage?.renderer.shadowsEnabled}get nodeCrossfadingEnabled(){return this._supportsNodeCrossFading&&(this.lodCrossfadeinDuration>0||this.lodCrossfadeoutDuration>0||this.lodCrossfadeUncoveredDuration>0)}get nodeFadeoutEnabled(){return this._supportsNodeCrossFading&&this.lodCrossfadeoutDuration>0}_setNewNodeOpacity(e){const t=this.nodeCrossfadingEnabled?0:this.fullOpacity;this._setNodeOpacity(e,t)}addCachedGPUData(e,t,i){if(0===this.elevationInfo.mode&&(e.geometryObbInRenderSR=this._collection.getComponentObb(t.objectHandle).clone()),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);null!=this._labeler&&this._addMetaToLabeler(this._labeler,t);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,!0),this._updateMaterial(t),this._setNewNodeOpacity(t),0!==this.elevationInfo.mode&&this._ensureElevationTask().schedule(s),this._updateEngineObject(t),this._highlights?.objectCreated(t),null!=this._treeDebugger&&this._treeDebugger.update()}addCachedNodeData(e,t,i,s){return this._addData(e,i,()=>this._addCachedNodeData(e,t,s))}async deleteCachedNodeData(e){if(this._idbCacheEnabled)return this._idbCache.remove(this._getCacheKey(e))}async _addCachedNodeData(e,t,i){if(!this.contentVisible||!this._controller.isGeometryVisible(e))return void this._removeNodeStageData(e.index,this.elevationOffset,this._nodeId2MetaReloading);if(null==t)return void this._addNodeMeta(e.index,null);const s=this._addTasks.get(e.index),{geometryData:r,transformedGeometry:n}=t;await this.i3sOverrides.applyAttributeOverrides(r.featureIds,s.attributeInfo,i,this._controller.requiredAttributes);const a=null!=t.textureData?t.textureData.filter(e=>null!=e&&0!==(e.usage&this.rendererTextureUsage)):[];!has("disable-feature:i3s-basis")&&a.some(e=>null!=e&&(2===e.encoding||1===e.encoding))&&await bt(),e.memory=0;const{componentOffsets:l,geometries:d,featureIds:h,anchorIds:c,anchors:u}=r,_=this._collection,m=d[0],{layout:g,indices:f,interleavedVertexData:p,positionData:y,hasColors:O}=n,{material:R,geometryParameters:j}=this._materialParameters(m,g),D=p.byteLength/g[0].stride,A=l||new Uint32Array([0,f?f.length:D]),T=m.transformation?S(m.transformation):E(),H=Z(t.globalTrafo);x(T,H,T);const P=w(N(),T),U=b(C(),T),L=this._isIntegratedMesh?this._imShading?2:0:1,B=j.textureCoordinateType,q=!v(U,M),z=new mt(g,L,B,q?1:0,0),$=new gt({interleavedVertexData:p,vertexCount:D,indexData:f},{positions:ee(y.data),indices:te(y.indices)},A,z),K=this.view.renderSpatialReference,Q=this.view.basemapTerrain.spatialReference,J=lt.fromData(dt(t.geometryObbData)).center,Y=[1,1,1];G(J,K,Y,Q)||o.getLogger(this).errorOnce("Unsupported coordinate system for IM overlay");const X=N();W(J,K,X,Q);const ie=C();I(ie,U);const se=N();V(se,F(se,J,P),ie);const re=X[0]-se[0]*Y[0],oe=X[1]-se[1]*Y[1],ne=2===j.textureCoordinateType,{textures:ae,texturePromise:le,materialParameters:de}=this._initMaterialAndTextures(R,a,ne,e),he=_.createObject(new ut(k(re,oe,Y[0],Y[1]),new pt(P,U),lt.fromData(dt(t.geometryObbData)),$,!this._isIntegratedMesh),de);e.memory+=this._memEstimateGeometryAdded(he),e.memory+=ae.reduce((e,t)=>e+(null!=t?this._memEstimateTextureAdded(t):0),0);const ce=!!R.hasParametersFromSource,ue="blend"!==R.alphaMode&&R.metallicRoughness.baseColorFactor[3]>=1,_e=new xt(e,h,he,this._getInvalidRendererVersion(),s.attributeInfo,{hasParametersFromSource:ce,isOpaque:ue},ae,c,u);s.meta=_e,this._hasTextures||=t.requiredTextures?.some(({usage:e})=>!!(19&e))||!!e.resources.texture,this._hasData=!0,this._hasColors||=O,this.notifyChange("hasTexturesOrVertexColors");const me=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering(_e),le]).then(([t,s])=>(this._addTasks.has(e.index)&&t?.updateObjectVisibility(_e.objectHandle,!1).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),this._safeReschedule(()=>{const i=this._addTasks.get(e.index);if(!i)return;if(this._addNodeMeta(e.index,_e),i.meta=null,!this.contentVisible)return void this._removeNodeStageData(e.index,this.elevationOffset);_.setObjectVisibility(he,!0),t?.updateObjectVisibility(_e.objectHandle,!0).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),_e.attributeInfo=i.attributeInfo;const s=_e.cachedRendererVersion!==this._rendererVersion,r=me!==this.slicePlaneEnabled;this._updateElevationOffsets(_e);const o=_e.elevationOffsets;this._updateComponentData(_e);const n=this._applyFiltersToNode(_e);(s||null!=t&&(r||n||o))&&this._addOrUpdateEdgeRendering(_e),null!=this._labeler&&this._addMetaToLabeler(this._labeler,_e),this._visibleGeometryChanged(_e,0),this._highlights?.objectCreated(_e),this._updateMaterial(_e),this._setNewNodeOpacity(_e),null!=this._treeDebugger&&this._treeDebugger.update()},i))).catch(e=>{const{meta:t,allowMemCache:i}=s;throw s.meta=null,t&&i?this._cacheGPUData(t):t&&this._deleteComponentObject(t),e})}_addNodeMeta(e,t){if(this._removeNodeStageData(e,this.elevationOffset,this._nodeId2MetaReloading),this._nodeId2Meta.has(e)){o.getLogger(this).error("Removing duplicated node");const t=this._nodeId2Meta.get(e);t&&(this._deleteComponentObject(t),this._updateFeatureIdCounts(t,-1))}else this._controller.updateLoadStatus(e,!0);t&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&Ut(t.cachedEdgeMaterials,0),this._updateFeatureIdCounts(t,1)),this._nodeId2Meta.set(e,t),this.notifyChange("elevationRange")}_updateElevationOffsets(e){if(!e.node.serviceMbsInIndexSR)return;const{view:t,elevationInfo:i}=this,s=this._controller.crsIndex,{groundView:r,groundSpatialReference:o,renderSpatialReference:n}=t,a=i.mode;if(null==n||null==o||0===a)return void(e.elevationOffsets=null);const l=this._collection.getObjectTransform(e.objectHandle);e.elevationOffsets=e.elevationOffsets??[];const d=Gt,h=Bt,c=2===a,u=this.view.renderCoordsHelper,_=e.featureIds.length,m=(()=>{if(e.cachedElevationAnchors)return e.cachedElevationAnchors;const t=X(3*_);e.cachedElevationAnchors=t;const{center:i}=e.node.serviceMbsInIndexSR;for(let r=0;r<_;r++){const a=3*r,c=e.anchorIds?.indexOf(r)??-1;e.anchors&&c>=0?(R(d,e.anchors[3*c],e.anchors[3*c+1],e.anchors[3*c+2]),D(d,d,i),W(d,s,d,o),t[a]=d[0],t[a+1]=d[1],t[a+2]=u.getAltitude(d)):(this._collection.getComponentAabb(e.objectHandle,r,h,!0),R(d,(h[0]+h[3])/2,(h[1]+h[4])/2,h[2]),V(d,d,l.rotationScale),D(d,d,l.position),t[a+2]=u.getAltitude(d),W(d,n,d,o),t[a]=d[0],t[a+1]=d[1])}return t})(),g=i.offset,f=e.elevationOffsets,p=(e,t)=>{const i=c?m[3*e+2]:0;f[e]=g+(t??0)-i};r.getElevations(m,_,p)}_ensureElevationTask(){return null!=this._elevationTask||(this._elevationTask=new Ee(this.view.resourceController.scheduler,e=>this._controller.updateElevationChanged(e,this.view.basemapTerrain.spatialReference)?.filterInPlace(e=>null!=this._nodeId2Meta.get(e)),e=>this._nodeElevationAlignmentChanged(this._nodeId2Meta.get(e)),()=>this.elevationInfo?.mode)),this._elevationTask}_elevationInfoChanged(e,t){const i=0!==e.mode,s=!!t&&t!==e&&0!==t.mode;this._intersectionHandler.updateElevationAlignState(i,this.view.state.viewingMode),i&&!s&&this._controller.removeAllGeometryObbs(),this._nodeId2Meta.forEach(e=>this._nodeElevationAlignmentChanged(e))}_nodeElevationAlignmentChanged(e){null!=e&&(this._updateElevationOffsets(e),this._updateComponentData(e),this._updateEdgeRendering(e),null!=this._labeler&&this._labeler.updateLabelPositions(e),this._updateSnappingSources(e,2),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e.objectHandle)))}_safeReschedule(e,t){return c(t),this._controller.reschedule(e,t)}_materialParameters(e,t){const i=null!=e.params.material?e.params.material:Te(),s=t.some(({name:e})=>"uvRegion"===e),r=t.some(({name:e})=>"normalCompressed"===e),o=At(i);return{geometryParameters:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s){const r=this._stage.renderView,o=e=>{this._gpuMemoryEstimate-=e,this._texMemoryEstimate-=e,s.memory-=e},n=t.map(t=>He(t,e,i,r,this._compressionTracker,o));this._stage.addTextures(n);const{materialParameters:a,texturePromise:l}=Ne(e,n,t,this.view.stage.renderView.textures,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR,isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference,applySSAO:this._applySSAO});return{textures:n,texturePromise:l,materialParameters:a}}_getGeometryParameters(e){return new ft(this._hasVertexColors,e.hasNormals,e.hasTexture?e.hasRegions?2:1:0)}_addData(e,t,i){let s=this._addTasks.get(e.index);if(s)s.attributeInfo=t;else{const r=Promise.withResolvers();s=new kt(t,null,r.promise),this._addTasks.set(e.index,s),i().then(r.resolve,r.reject).then(()=>this._addTasks.delete(e.index)).catch(t=>{throw this._addTasks.delete(e.index),t})}return s.promise}_clearAddTasks(){this._addTasks.forEach(e=>{null!=e.meta&&(this._cacheGPUData(e.meta),e.meta=null)}),this._addTasks.clear()}_clippingAreaChanged(){const e=this.view.renderSpatialReference,t=this.i3slayer.spatialReference,i=J();this._renderClippingArea=at(this.view.clippingArea,i,e)?i:null;const s=J();this._layerClippingArea=at(this.view.clippingArea,s,t)?s:null,this._filterChange(),this._controller&&this._controller.updateClippingArea(this.view.clippingArea),this._isIntegratedMesh&&this._modificationsChanged()}get hasGeometryFilter(){return!1}_geometryFilterChange(){const e=this.hasGeometryFilter;this._controller.geometryFilterChanged(e),this._applyFilters(e),this._assertFeatureIdNodeCounts(e)}_assertFeatureIdNodeCounts(e){e&&!this._featureIdCounts?(this._featureIdCounts=ti(this._nodeId2Meta.values()),this._filteredIdCounts=ti(this._nodeId2Meta.values(),1),this._weaklyRemovedIdCounts=ti(this._nodeId2Meta.values(),2),this.addHandles(_(()=>this._controller.updating,e=>{!e&&this._needFilterResolve&&(this.multiGeometryFilterResolve(),this._needFilterResolve=!1,this.notifyUpdate())},{sync:!0}),"updateFinished")):!e&&this._featureIdCounts&&(this._featureIdCounts=null,this._filteredIdCounts=null,this._weaklyRemovedIdCounts=null,this._mismatchShow=null,this._mismatchHide=null,this.removeHandles("updateFinished"),this._needFilterResolve=!1,this.notifyUpdate())}_updateFeatureIdCounts(e,t){this._featureIdCounts&&(this._needFilterResolve=!0,ei(this._featureIdCounts,e.featureIds,t),ei(this._filteredIdCounts,e.filteredIds,t),ei(this._weaklyRemovedIdCounts,e.weaklyRemovedIds,t))}_updateFilteredIdCounts(e,t,i){this._filteredIdCounts&&(this._needFilterResolve=!0,ei(this._filteredIdCounts,t,-1),ei(this._filteredIdCounts,e.filteredIds,1),ei(this._weaklyRemovedIdCounts,i,-1),ei(this._weaklyRemovedIdCounts,e.weaklyRemovedIds,1))}_checkFeatureIdNodeCountInvariant(){const e=null!=this._featureIdCounts;if(this.hasGeometryFilter!==e&&o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","LayerView should have feature id node counts if and only if it has a geometry filter",{layerView:this,hasNodeCounts:e}),!this._featureIdCounts||!this._filteredIdCounts)return;const t=ti(this._nodeId2Meta.values());n(this._featureIdCounts,t)||o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","Incorrect _featureIdCounts",{layerView:this,counts:this._featureIdCounts,expected:t});const i=ti(this._nodeId2Meta.values(),1);n(this._filteredIdCounts,i)||o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","Incorrect _filteredIdCounts",{layerView:this,counts:this._filteredIdCounts,expected:i});const s=ti(this._nodeId2Meta.values(),2);n(this._weaklyRemovedIdCounts,s)||o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","Incorrect _weaklyRemovedIdCounts",{layerView:this,counts:this._weaklyRemovedIdCounts,expected:i})}multiGeometryFilterResolve(){if(!this._featureIdCounts||!this._filteredIdCounts)return;let e=null,t=null;for(const[i,s]of this._filteredIdCounts){const r=this._featureIdCounts.get(i);if(r!==s){s+(this._weaklyRemovedIdCounts?.get(i)??0)===r?(e??=new Set,e.add(i)):(t??=new Set,t.add(i))}}g(e,this._mismatchShow)&&g(t,this._mismatchHide)||(this._mismatchShow=e,this._mismatchHide=t,this._nodeId2Meta.forEach(e=>{if(!e?.filteredIds)return;const t=Zt(e,this._mismatchShow,this._mismatchHide);this._collection.setAllComponentVisibilities(e.objectHandle,t),this._visibleGeometryChanged(e,2)}))}_filterChange(){this._applyFilters(this.hasGeometryFilter)}_applyFilters(e){this._filters=this.getFilters(),e?this._controller&&this._controller.requestUpdate():this._nodeId2Meta.forEach(e=>{e&&this._applyFiltersToNode(e)&&(this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,2))})}getFilters(){const e=[],t=this._renderClippingArea;return null!=t&&e.push((e,i)=>this._boundingRectFilter(e,i,t)),e}addSqlFilter(e,t,i){if(null!=t){const s=t.fieldNames;e.push((e,r)=>this._sqlFilter(e,r,t,s,i))}}_sqlFilter(e,t,i,s,r){const o={},n=this._createLayerGraphic(o);if(!n)return;const a=this.i3slayer.objectIdField,l=t.featureIds,d=t.attributeInfo?.attributeData;s.every(e=>e===a||null!=d?.[e])&&ze(e,l,e=>{o[a]=l[e];for(const i of s)i!==a&&(o[i]=d?Oe(d[i],e):null);try{return i.testFeature(n)}catch(t){return r(t),!1}})}_boundingRectNodeTest(e,t){return B(e.node.serviceMbsInIndexSR,this._controller.crsIndex,Dt,this.view.renderSpatialReference),We(t,Dt)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,Ot),K(Ot,Rt),Y(i,Rt)}_boundingRectFilter(e,t,i){const s=this._collection,r=this._boundingRectNodeTest(t,i);if(3===r)return;if(0===r)return void(e.length=0);const o=s.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const n=this._transformClippingArea(jt,i,t.objectHandle);ze(e,t.featureIds,e=>this._boundingRectFeatureTest(t,e,n))}_transformClippingArea(e,t,i){const s=this._collection.getObjectTransform(i),r=s.position,o=s.rotationScale;return e[0]=(t[0]-r[0])/o[0],e[1]=(t[1]-r[1])/o[4],e[2]=(t[2]-r[0])/o[0],e[3]=(t[3]-r[1])/o[4],e}async _addOrUpdateEdgeRendering(e,t=!0){const i=e.objectHandle,{hasEdges:s,perFeatureEdgeMaterials:r}=this._getFilteredEdgeMaterials(e);s&&!this._edgeView&&(this._edgeView=await this._stage.renderer.loadEdgeView());const o=this._edgeView;if(!o)return null;const n=o.hasObject(i);if(s){if(n){if(this.nodeCrossfadingEnabled){Ut(r,this.getNodeOpacity(e))}return o.updateAllComponentMaterials(i,r,this.slicePlaneEnabled,t).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),o.updateObjectVisibility(i,!0).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),o.updateAllVerticalOffsets(i,e.elevationOffsets).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),o}const s=await this._collection.addEdges(i,o,r,this.slicePlaneEnabled,e.elevationOffsets);return e.edgeMemoryUsage=s,e.node.memory+=s,o}return n&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,o.removeObject(i)),null}_applyFiltersToNode(e){const{filteredIds:t,weaklyRemovedIds:i}=e,s=this._applyFiltersToNodeComponents(e);return this._updateFilteredIdCounts(e,t,i),s&&this._labeler?.applyFilterChange(e),s}_applyFiltersToNodeComponents(e){const t=this._collection,i=t.getComponentCount(e.objectHandle),s=null!=e.filteredIds,r=0===i.invisible;if(t.setAllComponentVisibilities(e.objectHandle,"all"),0===this._filters.length)return e.filteredIds=null,!r;if(null!=e.filteredIds&&e.appliedFilters===this._filters||(e.weaklyRemovedIds=null,e.filteredIds=Xt(e,this._filters),e.appliedFilters=this._filters),s&&e.filteredIds===e.featureIds&&(!this._mismatchHide||e.filteredIds.every(e=>!this._mismatchHide?.has(e))))return!r;const o=Zt(e,this._mismatchShow,this._mismatchHide);return t.setAllComponentVisibilities(e.objectHandle,o),!0}_removeAllNodeDataFromStage(e=this.elevationOffset){this._nodeId2Meta.forEach((t,i)=>this._removeNodeStageData(i,e)),this._nodeId2MetaReloading.forEach((t,i)=>this._removeNodeStageData(i,e,this._nodeId2MetaReloading)),this._elevationTask=a(this._elevationTask)}removeNode(e){const t=this.elevationOffset;this._removeNodeStageData(e,t),this._removeNodeStageData(e,t,this._nodeId2MetaReloading),null!=this._elevationTask&&this._elevationTask.remove(e)}_removeNodeStageData(e,t,i=this._nodeId2Meta){i.has(e)&&this._controller.updateLoadStatus(e,!1);const s=i.get(e);null!=s?(this._collection.setObjectVisibility(s.objectHandle,!1),null!=this._edgeView&&this._edgeView.hasObject(s.objectHandle)&&this._edgeView.updateObjectVisibility(s.objectHandle,!1).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),this._visibleGeometryChanged(s,1),null!=this._labeler&&this._labeler.removeNodeMeta(s),i.delete(e),this._highlights?.objectDeleted(s),i===this._nodeId2Meta?(this._updateFeatureIdCounts(s,-1),this._cacheGPUData(s,t),this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopNodeFading(s)):this._deleteComponentObject(s),null!=this._treeDebugger&&this._treeDebugger.update()):i.delete(e)}_deleteComponentObject(e){if(null!=this._edgeView&&this._edgeView.removeObject(e.objectHandle),this._memEstimateGeometryRemoved(e.objectHandle),this._collection.destroyObject(e.objectHandle),e.textures)for(const t of e.textures)this._memEstimateTextureRemoved(t),this._stage.removeTexture(t)}updateNodeState(e,t){const i=this._nodeId2Meta.get(e);null!=i&&i.objectHandle.updateMaterial({polygonOffset:0===t?1:0})}updateNodeIndex(e,t){if(this._nodeId2Meta.has(e)){const i=this._nodeId2Meta.get(e);this._nodeId2Meta.delete(e),this._nodeId2Meta.set(t,i),this.notifyChange("elevationRange")}const i=this._nodeId2MetaReloading.get(e);i&&(this._nodeId2MetaReloading.delete(e),this._nodeId2MetaReloading.set(t,i))}_invalidateAllSymbols(){this._rendererVersion=$e(this._rendererVersion,1),this._controller?.requestUpdate()}_getInvalidRendererVersion(){return $e(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=$e(this._rendererVersion,1),this._rendererFields=null,this._colorVariable=null,this._opacityVariable=null,this._invalidateAllSymbols(),e&&(this._rendererFields=await e.getRequiredFields(this.i3slayer.fieldsIndex)),this._updateSymbologyFields(),!this._arcade&&e&&"arcadeRequired"in e&&e.arcadeRequired&&(this._arcade=await ue()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:o.getLogger(this).warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.symbols)"mesh-3d"!==t.type&&o.getLogger(this).error(`Symbols of type '${t.type}' are not supported for 3D Object Scene Services.`);this._controller&&this._controller.requestUpdate()}_getCachedEdgeMaterials(e){return this._hasComponentData&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e),e.cachedEdgeMaterials}_getComponentParameters(e){this._hasComponentData&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e);const t=e.cachedSymbology;return(i,s)=>{const r=i*e.cachedSymbologyStride;P(s.externalColor,t[r]/255,t[r+1]/255,t[r+2]/255,t[r+3]/255);const o=this._stage.renderView.olidRenderHelper;if(o){const t=e.featureIds[i],r=this.sublayerId?`${this.layerViewUid}_${this.sublayerId}`:this.layerViewUid,n=he(this.view,this.uid);o.setUidToObjectAndLayerId(t,t,this.layerId,r,this.layerPopupEnabledAndHasTemplate&&!n,e.node.resources.attributes,i,this.sublayerId),s.olidColor=o.getObjectAndLayerIdColor({graphicUid:t,layerViewUid:r})}s.externalColorMixMode=15&t[r+4],s.castShadows=!!(16&t[r+4]),s.pickable=!!(32&t[r+4]),s.elevationOffset=e.elevationOffsets?.[i]??0,s.emissiveStrength=e.emissiveStrengths?.[i]??1,s.emissiveSource=e.emissiveSources?.[i]??0}}_getSymbolInfo(e,t){const i=e?.getSymbol(t,{arcade:this._arcade});if(!(i instanceof _e))return null;const s=i.id;if(this._symbolInfos.has(s))return this._symbolInfos.get(s);const r=Ke(i);return this._symbolInfos.set(s,r),r}_setSymbologyOverride(e,t){this._symbologyOverride!==e&&(this._symbologyOverride=e,this._symbologyOverrideFields=t,this._invalidateAllSymbols(),this._updateSymbologyFields())}_updateSymbologyFields(){this._symbologyFields=null!=this._symbologyOverrideFields&&this._symbologyOverrideFields.length>0?null!=this._rendererFields&&this._rendererFields.length>0?ne(this.i3slayer.fieldsIndex,[...this._rendererFields,...this._symbologyOverrideFields]):this._symbologyOverrideFields:this._rendererFields}_updateCachedRendererData(e){if(e.cachedRendererVersion=this._rendererVersion,!this._hasComponentData)return;const t=this._tmpAttributeOnlyGraphic,i={};t.attributes=i;const s=this._currentRenderer,r=e.attributeInfo?.attributeData,o=e.featureIds?this.i3slayer.objectIdField:null,n=null!=r&&null!=this._symbologyFields&&this._symbologyFields.length>0;let a=null,l=null;if(n&&null!=this._symbologyFields){a=[],l=[];for(const e of this._symbologyFields){const t=r[e];t&&(a.push(e),l.push(t))}}e.cachedSymbology||(e.cachedSymbology=se(e.featureIds.length*e.cachedSymbologyStride));const d=new et,h=this.fullOpacity,c=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):h;let u=null,_=1,m=Qe,g=0;for(let f=0;f<e.featureIds.length;f++){if(null!=o&&(i[o]=e.featureIds[f]),n&&a)for(let e=0;e<a.length;e++)i[a[e]]=Oe(l[e],f);const r=s?this._getSymbolInfo(s,t):null;let h,p;if(d.pickable=!0,s&&"visualVariables"in s){if(this._colorVariable){const e=le(this._colorVariable,t,{color:Ft,arcade:this._arcade});e&&(h=d.color,h[0]=e.r/255,h[1]=e.g/255,h[2]=e.b/255,h[3]=e.a??1,this._opacityVariable||null===e.a||(p=e.a))}this._opacityVariable&&(p=de(this._opacityVariable,t,{arcade:this._arcade}))}if(r?.material){const e=r.material;h=null==h||null==p?xe(h,p,e.color,e.alpha,Mt,d.color):xe(h,p,null,null,Mt,d.color)}h??=P(d.color,1,1,1,1);const y=r?.material;if(d.colorMixMode=y?.colorMixMode??1,d.edgeMaterial=r?.edgeMaterial,this._symbologyOverride?.(t,d),null!=this._nodeColorOverride&&(this._nodeColorOverride(e.node,h),d.colorMixMode=3),d.pickable&&=h[3]>=Ct,d.castShadows=r?r.castShadows:d.pickable,null!=d.edgeMaterial){const t=h[3]>=1&&(e.material.isOpaque||3===d.colorMixMode)?1:0;d.edgeMaterial===u&&t===_||(m={...d.edgeMaterial,opacity:c,objectTransparency:t},u=d.edgeMaterial,_=t),e.cachedEdgeMaterials[f]=m}else e.cachedEdgeMaterials[f]=Qe;e.cachedSymbology[g++]=Math.round(255*h[0]),e.cachedSymbology[g++]=Math.round(255*h[1]),e.cachedSymbology[g++]=Math.round(255*h[2]),e.cachedSymbology[g++]=Math.round(255*h[3]),e.cachedSymbology[g++]=d.colorMixMode|+d.castShadows<<4|+d.pickable<<5;const b=y?.emissive?.strength??yt;b===yt||e.emissiveStrengths||(e.emissiveStrengths=new Array(e.featureIds.length).fill(yt)),e.emissiveStrengths&&(e.emissiveStrengths[f]=b);const v=y?.emissive?.source||0;0===v||e.emissiveSources||(e.emissiveSources=new Array(e.featureIds.length).fill(0)),e.emissiveSources&&(e.emissiveSources[f]=v)}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);this.nodeCrossfadingEnabled||Ut(t,this.fullOpacity);const i=e.filteredIds;if(null==i){return{hasEdges:t.some(e=>e!==Qe),perFeatureEdgeMaterials:t}}let s=0,r=!1;const o=t.map((t,o)=>e.featureIds[o]!==i[s]?Qe:(r=r||t!==Qe,s++,t));return{hasEdges:r,perFeatureEdgeMaterials:o}}_updateComponentData(e){if(!this._hasComponentData)return;const{objectHandle:t}=e,i=this._getComponentParameters(e);this._collection.setComponentData(t,i),this._stage.renderView.requestRender()}_reloadAll(e=this.elevationOffset){this._removeAllNodeDataFromStage(e),null!=this._controller&&this._controller.restartNodeLoading()}_opacityChange(e){this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopAllNodeFading(),this._nodeId2Meta.forEach(t=>{null!=t&&(this._collection.updateObjectOpacity(t.objectHandle,e),Ut(t.cachedEdgeMaterials,e),this._updateEdgeRendering(t))})}_updateMaterial(e){e.objectHandle.updateMaterial({slicePlaneEnabled:this.slicePlaneEnabled,usePBR:this._usePBR})}_updateEngineObject(e){this._updateComponentData(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,2)}intersect(e,t,i,s){this._intersectionHandler.intersect(e,t,i,s,null,!1)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),null!=this._labeler&&(this._labeler.slicePlaneEnabled=e),this._foreachMeta(t=>{t.objectHandle.updateMaterial({slicePlaneEnabled:e}),this._updateEdgeRendering(t,!1)})}_updatePBR(e){this._foreachMeta(t=>t.objectHandle.updateMaterial({usePBR:e})),this._hasLoadedPBRTextures=!0}_foreachMeta(e){this._nodeId2Meta.forEach(t=>{null!=t&&e(t)})}get _usePBR(){return this._imShading&&this.view.qualitySettings.physicallyBasedRenderingEnabled}_updateEdgeRendering(e,t=!0){null!=this._edgeView&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_ignoreClientNodeOverriddenFeatures(e){return this.i3sOverrides.hasGeometryChanges?(t,i,s)=>s.node.index>=0&&this.i3sOverrides.featureHasGeometryChanges(t)?0:e(t,i,s):e}_forAllFeatures(e,t,i){for(const s of this._nodeId2Meta.values())if(!(null==s||t&&s.node.serviceMbsInIndexSR&&1===t(s.node.serviceMbsInIndexSR)))switch(i){case 1:this._forAllFeaturesOfNode(s,e);break;case 0:this._forAllVisibleFeaturesOfNode(s,e);break;case 2:this._forAllQueryableFeaturesOfNode(s,e)}}_forAllFeaturesOfNode(e,t){e.featureIds.forEach((i,s)=>t(i,s,e))}_forAllVisibleFeaturesOfNode(e,t){const i=e.featureIds;this._collection.forEachVisibleComponent(e.objectHandle,s=>0===t(i[s],s,e))}_forAllQueryableFeaturesOfNode(e,t){const i=this._ignoreClientNodeOverriddenFeatures(t);if(null==this._renderClippingArea)return this._forAllFeaturesOfNode(e,i);const s=this._boundingRectNodeTest(e,this._renderClippingArea);if(0===s)return;if(3===s)return this._forAllFeaturesOfNode(e,i);const r=e.featureIds,o=e.objectHandle,n=Je(this._renderClippingArea,this._collection.getObjectTransform(o));for(let a=0;a<r.length;a++)this._boundingRectFeatureTest(e,a,n)&&i(r[a],a,e)}_createAttributes(e,t){const i={};null!=t.featureIds&&(i[this._getObjectIdField()]=t.featureIds[e]);const s=t.attributeInfo?.attributeData;if(null!=s)for(const r of Object.keys(s))i[r]=Oe(s[r],e);return i}_createGraphic(e,t){return this._createLayerGraphic(this._createAttributes(e,t))}highlight(e,t){const s=it(e);if(0===s.length)return st;const r=vt(t),o=s[0]instanceof i?this._featureIdsFromGraphics(s):"number"==typeof s[0]?s:null;if(!o)return st;const n=this._ensureHighlights(),{set:a,handle:l}=n.acquireSet(r);return n.setFeatureIds(a,o),l}_featureIdsFromGraphics(e){const t=this.i3slayer.fieldsIndex,i=this._getObjectIdField();return e.map(e=>tt(t,e.attributes,i))}_ensureHighlights(){return this._highlights??=new Se({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,1),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)}),this._highlights}resetHighlights(){this._highlights=a(this._highlights)}_visibleGeometryChanged(e,t){this._elevationProvider&&(null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=m(()=>{const{node:t}=e,i=t.visibilityObbInRenderSR??t.geometryObbInRenderSR??t.serviceObbInRenderSR;if(null!=i){const e=Q();i.toAaBoundingBox(e),this.emit("visible-geometry-changed",new ge(e))}else this.emit("visible-geometry-changed");this._visibleGeometryChangedSchedulerHandle=null})),this._updateSnappingSources(e,t),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e.objectHandle)))}get performanceInfo(){return new pe(this.usedMemory,this._nodeId2Meta.size,Math.round(this._gpuMemoryEstimate/1048576),Math.round(this._geoMemoryEstimate/1048576),Math.round(this._texMemoryEstimate/1048576),Math.round(this.unloadedMemory/1048576),this._idbCacheEnabled?Math.round(100*this._idbCache.getHitRate()):0)}checkInvariants(){}get test(){}getNodeOpacityByIndex(e){const t=this._nodeId2Meta.get(e);return this.getNodeOpacity(t)}getNodeOpacity(e){return null!=e?this._collection.getObjectOpacity(e.objectHandle):0}isNodeFullyFadedIn(e){return this._crossfadeHelper.isNodeFullyFadedIn(e)}getNodeCrossfadeMetaData(e){return this._nodeId2Meta.get(e)}getNodeComponentHandle(e){return this._nodeId2Meta.get(e)?.objectHandle}markNodeToRemove(e){this._controller&&this._controller.markNodeToRemove(e)}removeMarkedNodes(){this._controller&&this._controller.removeMarkedNodes()}foreachCrossfadeNode(e){this._nodeId2Meta.forEach(e)}fadeNode(e,t,i){if(!this.nodeCrossfadingEnabled)return;const s=this._nodeId2Meta.get(e);null!=s&&this._crossfadeHelper.fadeNode(e,s,t,i)}setNodeOpacityByIndex(e,t){const i=this._nodeId2Meta.get(e);null!=i&&this._setNodeOpacity(i,t)}_setNodeOpacity(e,t){this._collection.updateObjectOpacity(e.objectHandle,t),this._setNodeEdgeOpacity(e,t)}_setNodeEdgeOpacity(e,t){if(null==this._edgeView||!e.cachedEdgeMaterials)return;Ut(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t).catch(e=>this._logEdgeViewError(e,this.i3slayer.title))}get hasModifications(){return this._isIntegratedMesh&&null!=this._layerClippingArea||this._modifications&&this._modifications.length>0}updateNodeModificationStatus(e){const t=e.length;if(!this.hasModifications||t<=0||!0!==this._i3sWasmLoaded)return;const i=this.uid,s=Pt(e);if(s){const t={context:i,buffer:s.buffer};ve(t);const r=new Float64Array(s.buffer);e.forAll((e,t)=>{const i=r[t],s=Ie(i);e.imModificationImpact=s,0!==s&&this._controller.invalidateGeometryVisibility(e.index)})}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||null!=this._labeler&&this._labeler.updating||this._crossfadeHelper?.updating||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0||null!=this._elevationTask&&this._elevationTask.readyToRun||this._needFilterResolve||this._compressionTracker.compressing}trackSnappingSources(e){const t={events:e,fetchEdgeLocations:async(e,t,i)=>{const s=this._nodeId2Meta.get(e);if(null==s)throw new Error("invalid-node");const{origin:r,buffer:o}=await this._collection.extractEdgeInformation(s.objectHandle,t,i);return this._snappingLocationsApplyElevation(s,o,r),{type:"components",objectIds:s.featureIds,locations:o,origin:r}},remove:()=>r(this._snappingSourcesTrackers,t)};return this._snappingSourcesTrackers.push(t),this._nodeId2Meta.forEach((t,i)=>{if(null==t)return;const s=this._controller.getRenderMbs(t.node);s&&e.add(i,s)}),t}_snappingLocationsApplyElevation(e,t,i){if(!e.elevationOffsets||0===this.elevationInfo.mode)return;const s=t.position0,r=t.position1,o=t.componentIndex,n=N(),a=N(),l=(e,t)=>{D(e,e,i),this.view.renderCoordsHelper.worldUpAtPosition(e,a),D(e,e,A(a,a,t)),T(e,e,i)};for(let d=0;d<s.count;d++){const t=e.elevationOffsets[o.get(d)];s.getVec(d,n),l(n,t),s.setVec(d,n),r.getVec(d,n),l(n,t),r.setVec(d,n)}}_updateSnappingSources(e,t){const{index:i}=e.node,s=this._controller.getRenderMbs(e.node);if(null!=s)for(const r of this._snappingSourcesTrackers)1!==t&&2!==t||r.events.remove(i),0!==t&&2!==t||r.events.add(i,s)}_logEdgeViewError(e,t){h(e)||o.getLogger(this).warn("Error while processing edges. Edges on this layer might not display correctly",t,e)}_indexedDbSizeCheck(e,t){return t.byteSize>St?(o.getLogger(this).warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}get elevationProvider(){return this._elevationProvider}};return e([p()],H.prototype,"_hasLoadedPBRTextures",void 0),e([p()],H.prototype,"_asyncModuleLoading",void 0),e([p()],H.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([p()],H.prototype,"view",void 0),e([p()],H.prototype,"i3slayer",void 0),e([p()],H.prototype,"_controller",void 0),e([p()],H.prototype,"_labeler",void 0),e([p()],H.prototype,"updating",void 0),e([p()],H.prototype,"suspended",void 0),e([p()],H.prototype,"contentVisible",null),e([p({readOnly:!0})],H.prototype,"legendEnabled",null),e([p(ht)],H.prototype,"updatingProgress",void 0),e([p()],H.prototype,"updatingProgressValue",null),e([p()],H.prototype,"hasTexturesOrVertexColors",null),e([p()],H.prototype,"rendererTextureUsage",null),e([p()],H.prototype,"elevationOffset",null),e([p()],H.prototype,"elevationInfo",null),e([p({type:Boolean})],H.prototype,"slicePlaneEnabled",void 0),e([p()],H.prototype,"supportedTextureEncodings",null),e([p({type:[ae]})],H.prototype,"_modifications",void 0),e([p({readOnly:!0})],H.prototype,"clientGeometry",null),e([p()],H.prototype,"elevationRange",null),e([p()],H.prototype,"fullExtent",null),e([p()],H.prototype,"_elevationTask",void 0),e([p({readOnly:!0})],H.prototype,"_usePBR",null),H=e([y("esri.views.3d.layers.I3SMeshView3D")],H),H},Ot=Q(),Rt=J(),jt=J(),Vt=new lt,Ft=new t([0,0,0,0]),Dt=new ie(0,0,0,0);function At(e){if(null==e)return!1;const t=e.metallicRoughness;return t&&t.baseColorTextureId>=0||t&&t.metallicRoughnessTextureId>=0||e.normalTextureId>=0||e.emissiveTextureId>=0||e.occlusionTextureId>=0}function Tt(e){return"geometryData"in e}function Ht(e){return null!=e&&f(e.data)}function Nt(e,t){let i=1024+e.interleavedVertexData.byteLength+(e.indices?e.indices.byteLength:0)+e.positionData.data.byteLength+e.positionData.indices.byteLength;if(null!=t)for(const s of t)null!=s&&f(s.data)&&(i+=s.data.byteLength);return i}function Pt(e){if(0===e.length)return;const t=10*e.length,i=new Float64Array(t);let s=0;return e.forAll(e=>{let t=e.serviceObbInIndexSR;null==t&&(t=Vt,e.serviceMbsInIndexSR?(t.center=e.serviceMbsInIndexSR.center,t.halfSize=[e.serviceMbsInIndexSR.radius,e.serviceMbsInIndexSR.radius,e.serviceMbsInIndexSR.radius]):t.invalidate());const r=t.data;i[s++]=r[0],i[s++]=r[1],i[s++]=r[2],i[s++]=r[3],i[s++]=r[4],i[s++]=r[5],i[s++]=r[6],i[s++]=r[7],i[s++]=r[8],i[s++]=r[9]}),i}class kt{constructor(e,t,i){this.attributeInfo=e,this.meta=t,this.promise=i,this.allowMemCache=!0}}function Ut(e,t){e.forEach(e=>e.opacity=t)}class Lt{constructor(e,t){this.mode=e,this.offset=t}}const Gt=N(),Bt=Q(),qt="elevation-change",zt="",Wt="@null",$t="@ECEF",Kt=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],Qt=new nt;function Jt(e,t,i){let s=e.minElevation,r=e.maxElevation;const o=i;if(o>0){t.getCorners(Kt);for(const e of Kt){const t=H(e)-o;s=Math.min(s,t),r=Math.max(r,t)}}else{t.getCorners(Kt);for(const e of Kt){const t=e[2];s=Math.min(s,t),r=Math.max(r,t)}}e.expandElevationRangeValues(s,r)}function Yt(e,t,i){const{center:s,radius:r}=t,o=i>0?H(s)-i:s[2];e.expandElevationRangeValues(o-r,o+r)}function Xt(e,t){const i=e.featureIds.slice();for(const s of t)if(s(i,e),0===i.length)break;return i.length===e.featureIds.length?e.featureIds:i}function Zt(e,t,i){const s=new Array,r=e.filteredIds;if(null==r||t?.size||i?.size){if(null!=r){let o=0;e.featureIds.forEach((e,n)=>{if(r[o]===e)++o;else if(!t?.has(e))return;i?.has(e)||s.push(n)})}}else e.featureIds.forEach((e,t)=>{r[s.length]===e&&s.push(t)});return s}function ei(e,t,i){if(e&&t)for(const s of t){const t=(e.get(s)??0)+i;t>0?e.set(s,t):e.delete(s)}}function ti(e,t=0){const i=new Map;for(const s of e){ei(i,0===t?s?.featureIds:1===t?s?.filteredIds:s?.weaklyRemovedIds,1)}return i}export{Et as I3SMeshView3D};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../Color.js";import i from"../../../Graphic.js";import{isSome as s,removeUnordered as r}from"../../../core/arrayUtils.js";import has from"../../../core/has.js";import o from"../../../core/Logger.js";import{equals as n}from"../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../core/maybe.js";import l from"../../../core/PooledArray.js";import{ignoreAbortErrors as d,isAbortError as h,throwIfAborted as c}from"../../../core/promiseUtils.js";import{initial as u,watch as _}from"../../../core/reactiveUtils.js";import{schedule as m}from"../../../core/scheduling.js";import{equals as g}from"../../../core/SetUtils.js";import{isArrayBuffer as f}from"../../../core/typedArrayUtil.js";import{property as p,subclass as y}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as b,exactEquals as v,invert as I}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as C,IDENTITY as M}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{multiply as x,getTranslation as w}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{clone as S,create as E}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as R}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{set as O,transformMat4 as j,transformMat3 as V,sub as F,add as D,scale as A,subtract as T,len as H}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as N}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as P}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as k}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as U}from"../../../core/support/UpdatingHandles.js";import{getSphericalPCPF as L}from"../../../geometry/spatialReferenceEllipsoidUtils.js";import{localLinearScaleFactors as G}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectBoundingSphere as B}from"../../../geometry/projection/projectBoundingSphere.js";import{projectBuffer as q}from"../../../geometry/projection/projectBuffer.js";import{getProjectorName as z}from"../../../geometry/projection/projectors.js";import{projectVectorToVector as W}from"../../../geometry/projection/projectVectorToVector.js";import{fromBuffer as $,toRect as K,create as Q}from"../../../geometry/support/aaBoundingBox.js";import{create as J,intersects as Y}from"../../../geometry/support/aaBoundingRect.js";import{newDoubleArray as X,ensurePackedMat4f64 as Z}from"../../../geometry/support/DoubleArray.js";import{compactFloatArray as ee}from"../../../geometry/support/FloatArray.js";import{compactIndices as te}from"../../../geometry/support/Indices.js";import{Sphere as ie}from"../../../geometry/support/sphere.js";import{newUByteArray as se}from"../../../geometry/support/UByteArray.js";import{fallbackObjectIDAttribute as re}from"../../../layers/LayerConstants.js";import oe from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as ne}from"../../../layers/support/fieldUtils.js";import ae from"../../../layers/support/SceneModification.js";import{getColor as le,getOpacity as de}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{isBasemapLayerView as he}from"../../../support/basemapUtils.js";import{getElevationOffset as ce}from"../../../support/elevationInfoUtils.js";import{loadArcade as ue}from"../../../support/loadArcade.js";import _e from"../../../symbols/MeshSymbol3D.js";import me from"../../../symbols/SimpleFillSymbol.js";import{ContentGeometryUpdateEvent as ge}from"./ContentGeometryLayerView.js";import fe from"./I3SMeshViewLabeler.js";import{I3SMeshViewPerformanceInfo as pe}from"./I3SMeshViewPerformanceInfo.js";import{initialize as ye,setModificationsSync as be,filterObbsForModificationsSync as ve,interpretObbModificationResults as Ie}from"./SceneLayerWorker.js";import{SceneLayerWorkerHandle as Ce,toWasmModification as Me}from"./SceneLayerWorkerHandle.js";import{overrideColor as xe}from"./graphics/graphicUtils.js";import{areLabelsVisible as we}from"./graphics/Labeler.js";import Se from"./i3s/Highlights.js";import{I3SAsyncElevationUpdater as Ee}from"./i3s/I3SAsyncElevationUpdater.js";import{getCachedAttributeValue as Re}from"./i3s/I3SBinaryReader.js";import{I3SCrossfadeHelper as Oe,NodeCrossfadeMetaData as je}from"./i3s/I3SCrossfadeHelper.js";import{boundingBoxCornerPoints as Ve}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as Fe}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as De,selectEncoding as Ae,defaultMaterial as Te,createTexture as He,configureMaterial as Ne}from"./i3s/I3SMaterialUtil.js";import{I3SOverrides as Pe}from"./i3s/I3SOverrides.js";import{computeGlobalTransformation as ke}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as Ue,checkSceneLayerValid as Le,checkSceneLayerCompatibleWithView as Ge,whenGraphicAttributes as Be,computeVisibilityObb as qe,filterInPlace as ze,intersectBoundingRectWithMbs as We,addWraparound as $e,getSymbolInfo as Ke,transparentEdgeMaterial as Qe,getClipRect as Je}from"./i3s/I3SUtil.js";import{IDBCache as Ye}from"./i3s/IDBCache.js";import{IDBMockCache as Xe}from"./i3s/IDBMockCache.js";import{LayerElevationProvider as Ze}from"./i3s/LayerElevationProvider.js";import{SymbologyInfo as et}from"./i3s/SymbologyInfo.js";import{attributeLookup as tt}from"./support/attributeUtils.js";import{normalizeHighlightTarget as it,emptyHighlightHandle as st}from"./support/highlightUtils.js";import{makeScheduleFunction as rt}from"./support/makeScheduleFunction.js";import{debugFlags as ot}from"../support/debugFlags.js";import{ElevationRange as nt}from"../support/ElevationRange.js";import{toBoundingRect as at}from"../support/extentUtils.js";import{Obb as lt,ensurePackedObbData as dt}from"../support/orientedBoundingBox.js";import{updatingProgress as ht}from"../support/updatingProperties.js";import{glLayout as ct}from"../support/buffer/glUtil.js";import{ObjectParameters as ut}from"../webgl-engine/collections/Component/ObjectParameters.js";import{createVertexBufferLayout as _t,ComponentGeometryParameters as mt,SourceGeometry as gt,VertexBufferLayoutCreationParameters as ft}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as pt}from"../webgl-engine/collections/Component/Transform.js";import{emissiveStrengthDefault as yt}from"../webgl-engine/core/shaderLibrary/output/Emissions.glsl.js";import{loadBasisTranscoder as bt}from"../webgl-engine/lib/BasisUtil.js";import{getHighlightName as vt}from"../../support/highlightOptionsUtils.js";import{TextureCompressionTracker as It}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as Ct}from"../../../webscene/support/AlphaCutoff.js";const Mt=[1,1,1,1];class xt extends je{constructor(e,t,i,s,r,o,n,a,l){super(),this.node=e,this.featureIds=t,this.objectHandle=i,this.cachedRendererVersion=s,this.attributeInfo=r,this.material=o,this.textures=n,this.anchorIds=a,this.anchors=l,this.cachedElevationAnchors=null,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0,this.cachedSymbologyStride=5}get usedMemory(){return this.node.memory}get featureExtents(){return this._featureExtents??=new Float64Array(6*this.featureIds.length).fill(Number.POSITIVE_INFINITY),this._featureExtents}}const wt=27,St=104857600,Et=t=>{const f=t;let H=class extends f{constructor(){super(...arguments),this._applySSAO=!0,this._imShading=!!has("enable-feature:im-shading"),this._imVertexNormals=!!has("enable-feature:im-vertex-normals"),this._updatingHandles=new U,this._highlights=null,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._snappingSourcesTrackers=[],this._compressionTracker=new It,this._hasLoadedPBRTextures=!1,this._asyncModuleLoading=0,this._addTasks=new Map,this._currentRenderer=null,this._rendererVersion=0,this._colorVariable=null,this._opacityVariable=null,this._rendererFields=null,this._symbologyFields=null,this._symbologyOverride=null,this._symbologyOverrideFields=null,this._symbolInfos=new Map,this._visibleGeometryChangedSchedulerHandle=null,this._hasComponentData=!1,this._hasVertexColors=!1,this._nodeColorOverride=null,this.updating=!0,this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.slicePlaneEnabled=!1,this._modifications=new Array,this.ignoresMemoryFactor=!1,this._layerUrl="",this._cacheKeySuffix=null,this._planetRadiusInGlobalMode=0,this._elevationTask=null,this._needFilterResolve=!1,this._filters=[],this._arcade=null,this._tmpAttributeOnlyGraphic=new i,this._crossfadeHelper=new Oe(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerViewUid(){return this.uid}get layerId(){return this.layer.id}get sublayerId(){return null}get _isIntegratedMesh(){return"integrated-mesh"===this.layer.type}get contentVisible(){return!this.suspended&&this._controller?.rootNodeVisible&&this.fullOpacity>Ct}get legendEnabled(){return this.contentVisible&&!0===this.layer?.legendEnabled}get updatingProgressValue(){return this._controller?.updatingProgress??0}get hasTexturesOrVertexColors(){return this._hasData?this._hasTextures||this._hasColors?"yes":"probably-not":"unknown"}get rendererTextureUsage(){return Ue(this._currentRenderer)?this._usePBR||this._hasLoadedPBRTextures?63:53:this._usePBR||this._hasLoadedPBRTextures?44:36}get elevationOffset(){const e=this.layer?.elevationInfo;return"absolute-height"===e?.mode?ce(e,this.layer.spatialReference):0}get elevationInfo(){const e=this.layer?.elevationInfo;switch(e?.mode){case"absolute-height":return new Lt(0,ce(e,this.layer.spatialReference));case"relative-to-ground":return new Lt(1,ce(e,this.layer.spatialReference));case"on-the-ground":return new Lt(2,0);default:return new Lt(0,0)}}get supportedTextureEncodings(){return De(this.view.stage.renderView.capabilities)}get clientGeometry(){return this.i3sOverrides.geometryOverrides}get elevationRange(){const e=this._nodeId2Meta,t=new nt;for(const i of e.values()){const e=i?.node.serviceMbsInIndexSR;e&&t.expandElevationRangeValues(e.center[2]-e.radius,e.center[2]+e.radius)}return t.elevationRangeValid?t:null}get fullExtent(){return this.layer.fullExtent}initialize(){const e=has("enable-feature:idb-mock-cache");this._idbCache=e?new Xe(this.view,e):new Ye("esri-scenelayer-cache","geometries"),this._preLoadBasis(),this.addResolvingPromise(this.layer.indexInfo);const t=this.view.resourceController,i=t.memoryController;this.i3sOverrides=new Pe({view:this.view,layer:this.layer,memoryController:i}),this._workerHandle=new Ce(rt(t)),this.addResolvingPromise(this._workerHandle.promise),Le(this.layer),Ge(this.layer,this.view);const s=this.layer.store.defaultGeometrySchema;if(this.addResolvingPromise(this._workerHandle.setLegacySchema(this.uid,s).catch(d)),this._layerUrl=this.layer.parsedUrl.path,this._controller=new oe({layerView:this,worker:this._workerHandle}),this._gpuMemoryEstimate=0,this._texMemoryEstimate=0,this._geoMemoryEstimate=0,this._stage=this.view.stage,this._collection=this._stage.renderView.componentObjectCollection,this._isIntegratedMesh||!s)this._hasComponentData=!1;else{const e=s.featureAttributes;this._hasComponentData=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=(s?.vertexAttributes.color??null)&&!this.layer.cachedDrawingInfo?.color;const r=this.view.resourceController.memoryController.newCache(`sl-${this.uid}`,e=>this._deleteComponentObject(e));this._memCache=r;const n=this._controller,l=this._nodeId2Meta,h=this._nodeId2MetaReloading,c=e=>{const t=n.index;if(!t)return;const i=t.rootNode;if(!i)return;const s=t=>{const i=t.index,s=l.get(i)||h.get(i);return e(t,s?.objectHandle??null)};t.traverse(i,s)};this._intersectionHandler=new Fe({layerViewUid:this.layerViewUid,sublayerId:this.sublayerId,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:c}),this._elevationProvider=new Ze({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR,this._updatingHandles.add(()=>this.view.clippingArea,()=>this._clippingAreaChanged(),u),this._updatingHandles.add(()=>this.fullOpacity,e=>this._opacityChange(e)),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this.elevationOffset,(e,t)=>{this._reloadAll(t),this._controller.invalidateVisibilityObbs()}),this._updatingHandles.add(()=>this.elevationInfo,(e,t)=>this._elevationInfoChanged(e,t),u),this._updatingHandles.add(()=>!this.suspended&&0!==this.elevationInfo.mode,(e,t)=>{e?this.addHandles(this.view.basemapTerrain.on("elevation-change",({extent:e})=>this._ensureElevationTask().addExtent(e)),qt):t&&this.removeHandles(qt)},u),this._updatingHandles.add(()=>this._usePBR,e=>this._updatePBR(e));const m=()=>{this._reloadAll(),this.clearMemCache()};this._updatingHandles.add(()=>this.rendererTextureUsage,m),this._updatingHandles.add(()=>this.contentVisible,e=>this._contentVisibleChanged(e),u),this._updatingHandles.add(()=>this.layer.labelsVisible,()=>this._labelingChanged(),u),this._updatingHandles.add(()=>this.layer.labelingInfo,()=>this._labelingChanged(),u),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged(),u),this.addHandles([_(()=>ot.I3S_TREE_SHOW_TILES,e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then(({I3STreeDebugger:t})=>{!this._treeDebugger&&ot.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))})}else e||ot.I3S_TREE_SHOW_TILES||(this._treeDebugger=a(this._treeDebugger))},u),_(()=>ot.I3S_SHOW_MODIFICATIONS,()=>this._showModifications(),u)]),this._cacheKeySuffix=this._getCacheKeySuffix(),this._idbCache.init().catch(e=>o.getLogger(this).warn(`Failed to initialize IndexedDB cache: ${e}`));const{view:g}=this,{viewingMode:f,renderCoordsHelper:p}=g;this._planetRadiusInGlobalMode="local"===f?0:p.referenceEllipsoid.radius}destroy(){this._clearAddTasks(),this._elevationTask=a(this._elevationTask),this.i3sOverrides=a(this.i3sOverrides),this._elevationProvider&&(this._elevationProvider.notifyObjectsChanged(this.getVisibleObbs()),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._intersectionHandler&&(this._stage.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null);const e=this._workerHandle;e&&(e.destroyContextAndSelf(this.uid),this._workerHandle=null),this._removeAllNodeDataFromStage(),this._memCache=a(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=a(this._labeler),this._treeDebugger=a(this._treeDebugger),this._controller=a(this._controller),this._highlights=a(this._highlights),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this._crossfadeHelper=a(this._crossfadeHelper),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null),this._updatingHandles=a(this._updatingHandles)}_memEstimateTextureAdded(e){const t=e.usedMemory;return this._gpuMemoryEstimate+=t,this._texMemoryEstimate+=t,t}_memEstimateTextureRemoved(e){if(null!=e){const t=e.usedMemory;this._gpuMemoryEstimate-=t,this._texMemoryEstimate-=t}}_memEstimateGeometryAdded(e){const t=this._collection.getObjectGPUMemoryUsage(e);return this._gpuMemoryEstimate+=t,this._geoMemoryEstimate+=t,t}_memEstimateGeometryRemoved(e){const t=this._collection.getObjectGPUMemoryUsage(e);this._gpuMemoryEstimate-=t,this._geoMemoryEstimate-=t}isNodeLoaded(e){return this._nodeId2Meta.has(e)}isNodeReloading(e){return this._nodeId2MetaReloading.has(e)}get usedMemory(){let e=null!=this._labeler?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach(t=>e+=null!=t?t.node.memory:0),this._nodeId2MetaReloading.forEach(t=>e+=null!=t?t.node.memory:0),e}get unloadedMemory(){return(null!=this._controller?this._controller.unloadedMemoryEstimate:0)+(null!=this._labeler?this._labeler.unloadedMemoryEstimate:0)}_labelingChanged(){if(!(we(this.layer)&&this._supportsLabeling))return void(null!=this._labeler&&(this._labeler.destroy(),this._labeler=null));if(null!=this._labeler)return;const e=new fe({view:this.view,layer:this.layer,collection:this._collection,overrides:this.i3sOverrides,layerViewUid:this.uid});this._nodeId2Meta.forEach(t=>null!=t&&this._addMetaToLabeler(e,t)),this._labeler=e}_loadAsyncModule(e){return++this._asyncModuleLoading,e.then(e=>(--this._asyncModuleLoading,e),e=>{throw--this._asyncModuleLoading,e})}_modificationsChanged(){if(!this._i3sWasmLoaded&&this.hasModifications)return this._i3sWasmLoaded=ye().then(()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()}),void this.notifyUpdate();if(!0!==this._i3sWasmLoaded)return;const e=e=>o.getLogger(this).error("set-modifications-error","Error when setting modifications:",e),t=this.uid,i=this.layer.spatialReference,s=i.isGeographic,r=Me(this._layerClippingArea,this._modifications,i);this._workerHandle.setModifications(t,r,s).catch(e);try{be({context:t,modifications:r,isGeodetic:s})}catch(a){e(a)}this._controller.modificationsChanged();const n=this.hasModifications?new l:null;this._nodeId2Meta.forEach((e,t)=>{null==e?(this._nodeId2Meta.delete(t),this._controller.updateLoadStatus(t,!1)):e.node.hasModifications?(this._updateFeatureIdCounts(e,-1),this._nodeId2Meta.delete(t),this._nodeId2MetaReloading.set(t,e)):null!=n&&n.push(e.node)}),this.notifyChange("elevationRange"),null!=n&&this._nodeId2MetaReloading.forEach(e=>n.push(e.node)),null!=n&&n.length>0&&(this.updateNodeModificationStatus(n),n.forAll(e=>{if(2!==e.imModificationImpact){const t=this._nodeId2Meta.get(e.index);this._controller.invalidateGeometryVisibility(e.index),null!=t?(this._updateFeatureIdCounts(t,-1),this._nodeId2Meta.delete(e.index),this._nodeId2MetaReloading.set(e.index,t),this.notifyChange("elevationRange")):this._nodeId2Meta.has(e.index)&&(this._nodeId2Meta.delete(e.index),this._controller.updateLoadStatus(e.index,!1))}})),this.clearMemCache(),this._controller.restartNodeLoading(),this._showModifications()}_showModifications(){if(null!=this._modificationGraphics&&(this.view.graphics.removeMany(this._modificationGraphics),this._modificationGraphics=null),!ot.I3S_SHOW_MODIFICATIONS||0===this._modifications.length)return;const e={clip:[227,227,79,.8],mask:[227,139,79,.8],replace:[139,227,79,.8]},t={outline:{color:[255,255,255],width:1}};this._modificationGraphics=[];for(const s of this._modifications){const r=s.geometry;r.spatialReference=this.layer.spatialReference;const o=new me({...t,color:e[s.type]});this._modificationGraphics.push(new i({geometry:r,symbol:o}))}this.view.graphics.addMany(this._modificationGraphics)}_addMetaToLabeler(e,t){e.addNodeMeta(t,(e,t)=>this._createAttributes(e,t))}_contentVisibleChanged(e){e?(this.view.elevationProvider.register(this._elevationContext,this._elevationProvider),this._stage.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler)):(this._removeAllNodeDataFromStage(),this.view.elevationProvider&&this.view.elevationProvider.unregister(this._elevationProvider),this._stage.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler))}getLoadedAttributes(e){const t=this._nodeId2Meta.get(e);if(null!=t?.attributeInfo)return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if(null!=t?.attributeInfo)return t.attributeInfo.attributeData}setAttributeData(e,t){const i=this._nodeId2Meta.get(e);null!=i?.attributeInfo&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const s=this._nodeId2Meta.get(e);null!=s&&(await this.i3sOverrides.applyAttributeOverrides(s.featureIds,t,i,this._controller.requiredAttributes),s.attributeInfo=t,this._controller.reschedule(()=>{this._nodeId2Meta.get(e)===s&&this._attributeValuesChanged(s)},i).catch(e=>{h(e)||o.getLogger(this).warn("Error while updating attribute values. Layer might not display correctly.",e)}))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.appliedFilters=null,null!=this._labeler&&this._labeler.setNodeMetaAttributes(e,(e,t)=>this._createAttributes(e,t)),this._updateEngineObject(e)}clearMemCache(){null!=this._memCache&&this._memCache.clear(),this._addTasks.forEach(e=>e.allowMemCache=!1)}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach(t=>null!=t&&e.push(t.node)),e}getVisibleObbs(){const e=new Array;return this._nodeId2Meta.forEach(t=>t&&e.push(this._collection.getComponentObb(t.objectHandle))),e}getLoadedNodeIndices(e){this._nodeId2Meta.forEach((t,i)=>e.push(i)),this._nodeId2MetaReloading.forEach((t,i)=>e.push(i))}_preLoadBasis(){!has("disable-feature:i3s-basis")&&2&this.supportedTextureEncodings&&this.layer.textureSetDefinitions?.some(e=>e.formats.some(e=>"basis"===e.format||"ktx2"===e.format))&&bt()}_getVertexBufferLayout(e,t){return ct(_t(this._getGeometryParameters({hasTexture:At(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion})))}_getObjectIdField(){return this.layer.objectIdField||re}_getGlobalIdField(){return this.layer.globalIdField}_findGraphicNodeAndIndex(e){const t=tt(this.layer.fieldsIndex,e.attributes,this._getObjectIdField());for(const i of this._nodeId2Meta.values()){const e=i?.featureIds.indexOf(t);if(null!=e&&e>=0)return{node:i.node,index:e}}return null}_getGraphicIndices(e,t){const i=this._nodeId2Meta.get(e.index);if(null==i)return[];const s=[],r=this._getObjectIdField(),o=this.layer.fieldsIndex;for(const n of t){const e=tt(o,n.attributes,r),t=i.featureIds.indexOf(e);-1!==t&&s.push(t)}return s}whenGraphicBounds(e){const t=this._findGraphicNodeAndIndex(e);if(!t)return Promise.reject();const i=this.getAABB(t.node.index,t.index);return null==i?Promise.reject():Promise.resolve({boundingBox:i,screenSpaceObjects:[]})}getAABBFromIntersectorTarget(e){return null==e.nodeIndex||null==e.componentIndex?null:this.getAABB(e.nodeIndex,e.componentIndex)}getAABB(e,t){const i=this._nodeId2Meta.get(e);if(null==i?.featureIds||t>=i.featureIds.length)return null;const s=i.objectHandle,r=Ve(t,this._collection,s,X(24),0),o=this.view.renderSpatialReference,n=this.view.spatialReference;return q(r,o,0,r,n,0)?$(r):null}whenGraphicAttributes(e,t){return Be(this.layer,e,this._getObjectIdField(),t,()=>[...this._nodeId2Meta.values()].filter(s))}getGraphicFromIntersectorTarget(e,t){if(null==e.nodeIndex||null==e.componentIndex)return null;const i=this._nodeId2Meta.get(e.nodeIndex);if(null==i?.featureIds||e.componentIndex>=i.featureIds.length)return null;const s=this._createLayerGraphic(this._createAttributes(e.componentIndex,i));return s?t.defer?(t.defer(async()=>(s.geometry=(await import("./i3s/meshUtils.js")).createMesh({layerView:this,nodeIndex:e.nodeIndex,featureIndex:e.componentIndex}),s)),null):s:null}_getCacheKey(e){return`${this._layerUrl}/v${wt}/${e}${this._cacheKeySuffix}`}_getCacheKeySuffix(){const e=this.view.renderSpatialReference;if(null==e)return Wt;if(e===L(e))return $t;return this.layer.spatialReference.equals(e)?zt:null!=e.wkid?`@${e.wkid}`:null}_getMemCacheKey(e,t=this.elevationOffset){return e+"#"+t}get _idbCacheEnabled(){return!this._controller.disableIDBCache&&!this.hasModifications&&0===this.elevationOffset&&null!=this._cacheKeySuffix}loadCachedGPUData(e){return null!=this._memCache?this._memCache.pop(this._getMemCacheKey(e)):null}deleteCachedGPUData(e){null!=e&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(null==this._memCache)return void this._deleteComponentObject(e);const i=this._controller.indexDepth-e.node.level;this._memCache.put(this._getMemCacheKey(e.node.index,t),e,i)}loadMissingTextures(e,t,i,s){const r=e?.filter((e,i)=>{if(0===(e.usage&this.rendererTextureUsage))return!1;if(null==t)return!0;const s=Ae(e.encodings,this.supportedTextureEncodings),r=t[i];return!!(null==r?.data||s&&r.encoding!==s.encoding)})??[];return 0===r.length?Promise.resolve(!1):i(r,s).then(i=>{let s=0;for(let r=0;r<e.length;r++)s<i.length&&i[s].id===e[r].id&&(t[r]=i[s],s++);return!0})}loadCachedNodeData(e,t,i){return this._idbCacheEnabled?this._idbCache.get(this._getCacheKey(e.id),t).then(s=>null==s?null:(s.globalTrafo=Z(s.globalTrafo),s.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e.id)),null):(0===this.elevationInfo.mode&&(e.geometryObbInRenderSR=lt.fromData(s.geometryObbData)),this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then(i=>(i&&this._idbCache.initialized&&null!=s.textureData&&(s.byteSize=Nt(s.transformedGeometry,s.textureData),s.textureData.every(Ht)&&this._indexedDbSizeCheck(e,s)&&this._idbCache.put(this._getCacheKey(e.id),s).catch(t=>o.getLogger(this).warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`))),c(t),s))))):Promise.resolve(null)}addNode(e,t,i){return Tt(t)?null==t.geometryBuffer?(this._addNodeMeta(e.index,null),Promise.resolve()):this._addData(e,t.attributeDataInfo,()=>this._transformNode(e,t,i).then(s=>this._safeReschedule(()=>{if(null==s)return e.hasModifications=!1,this._addCachedNodeData(e,null,i);const{obb:r,componentOffsets:n,featureIds:a,anchorIds:l,anchors:d,transformedGeometry:h}=s;e.hasModifications=h.hasModifications;const c=Z(s.globalTrafo),u=O(Gt,r.center.x,r.center.y,r.center.z);j(u,u,c);const _=new lt(u,[r.extents.x,r.extents.y,r.extents.z],R(r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w));0===this.elevationInfo.mode&&(e.geometryObbInRenderSR=_),t.geometryData.componentOffsets=n,a&&(t.geometryData.featureIds=Array.from(a)),t.geometryData.anchorIds=l,t.geometryData.anchors=d;const m={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:h,globalTrafo:c,geometryObbData:_.data,byteSize:Nt(h,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&this._indexedDbSizeCheck(e,m)){const t=null!=m.textureData?m.textureData.map(e=>Ht(e)?e:null):null;this._idbCache.put(this._getCacheKey(e.id),{...m,textureData:t}).catch(t=>o.getLogger(this).warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`))}return this._addCachedNodeData(e,m,i)},i))):Promise.reject()}getElevationRange(e){const t=new nt,i=this._controller,{index:s}=i;if(!s)return t;const{rootNode:r}=s;if(!r)return t;const o=this._nodeId2Meta,n=e.radius,a=i.viewportQueries,l=this._planetRadiusInGlobalMode,{view:d}=this,{renderCoordsHelper:h}=d,c=h.referenceEllipsoid.radius,u=this._collection,_=i=>{const{childrenLoaded:s}=i;if(0===s)return!1;const r=a.getAndUpdateVisibilityObbInRenderSR(i);let d=null,_=-1;if(r){if(_=r.radius,!r.intersectSphereWithMBS(e,_))return!1}else d=a.calculateServiceMbsInRenderSRElevationAdjusted(i),d&&(_=d.radius);if(_>=0&&n>=1*_)return null!=r?Jt(t,r,l):d?.isValid&&Yt(t,d,l),!1;const m=Qt;if(m.minElevation=1/0,m.maxElevation=-1/0,(null!=r||null!=d)&&(null!=r?Jt(m,r,l):null!=d&&Yt(m,d,l),m.minElevation>=t.minElevation&&m.maxElevation<=t.maxElevation))return!1;const g=o.get(i.index);if(g){const{geometryObbInRenderSR:s}=i;if(!s||s.intersectSphereWithMBS(e)){if(s){if(n>0*s.radius)return Jt(t,s,l),!1}const{objectHandle:e}=g,i=u.getObjectTransform(e),r=h.getAltitude(i.position);u.expandRangeWithComponentObjectElevationRange(e,r,c,t)}}return s-(g?1:0)>0};return s.traverse(r,_),t}computeVisibilityObb(e){return qe(e,this.view.renderSpatialReference,this._controller.crsIndex,this.layer.spatialReference,this.elevationOffset,this._modifications,this.view.renderCoordsHelper.sphericalPCPF)}_transformNode(e,t,i){const s=t.geometryData.geometries??[],r=new Array(s.length);for(let f=0;f<s.length;++f)r[f]=this._getVertexBufferLayout(s[f],t.geometryDescriptor);const o=this.layer.normalReferenceFrame,n=t.normalReferenceFrame??o??"none",a=e.serviceMbsInIndexSR,l=this.elevationOffset,d=this._controller.crsIndex,h=this._controller.crsVertex,c=this.view.renderSpatialReference,u=ke(a,l,n,d,c),_=z(d,h),m=z(h,c);if(null==_||null==m)return Promise.resolve(null);const g={context:this.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,globalTrafo:u,mbs:a.toJSON(),obbData:e.serviceObbInIndexSR?.data,elevationOffset:l,needNormals:this._controller.isMeshPyramid||this._imVertexNormals,computeNormals:this._isIntegratedMesh&&this._imVertexNormals,normalReferenceFrame:n,indexToVertexProjector:_,vertexToRenderProjector:m};return this._workerHandle.invoke(g,i)}get _supportsNodeCrossFading(){return!this.view?.stage?.renderer.shadowsEnabled}get nodeCrossfadingEnabled(){return this._supportsNodeCrossFading&&(this.lodCrossfadeinDuration>0||this.lodCrossfadeoutDuration>0||this.lodCrossfadeUncoveredDuration>0)}get nodeFadeoutEnabled(){return this._supportsNodeCrossFading&&this.lodCrossfadeoutDuration>0}_setNewNodeOpacity(e){const t=this.nodeCrossfadingEnabled?0:this.fullOpacity;this._setNodeOpacity(e,t)}addCachedGPUData(e,t,i){if(0===this.elevationInfo.mode&&(e.geometryObbInRenderSR=this._collection.getComponentObb(t.objectHandle).clone()),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);null!=this._labeler&&this._addMetaToLabeler(this._labeler,t);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,!0),this._updateMaterial(t),this._setNewNodeOpacity(t),0!==this.elevationInfo.mode&&this._ensureElevationTask().schedule(s),this._updateEngineObject(t),this._highlights?.objectCreated(t),null!=this._treeDebugger&&this._treeDebugger.update()}addCachedNodeData(e,t,i,s){return this._addData(e,i,()=>this._addCachedNodeData(e,t,s))}async deleteCachedNodeData(e){if(this._idbCacheEnabled)return this._idbCache.remove(this._getCacheKey(e))}async _addCachedNodeData(e,t,i){if(!this.contentVisible||!this._controller.isGeometryVisible(e))return void this._removeNodeStageData(e.index,this.elevationOffset,this._nodeId2MetaReloading);if(null==t)return void this._addNodeMeta(e.index,null);const s=this._addTasks.get(e.index),{geometryData:r,transformedGeometry:n}=t;await this.i3sOverrides.applyAttributeOverrides(r.featureIds,s.attributeInfo,i,this._controller.requiredAttributes);const a=null!=t.textureData?t.textureData.filter(e=>null!=e&&0!==(e.usage&this.rendererTextureUsage)):[];!has("disable-feature:i3s-basis")&&a.some(e=>null!=e&&(2===e.encoding||1===e.encoding))&&await bt(),e.memory=0;const{componentOffsets:l,geometries:d,featureIds:h,anchorIds:c,anchors:u}=r,_=this._collection,m=d[0],{layout:g,indices:f,interleavedVertexData:p,positionData:y,hasColors:R}=n,{material:O,geometryParameters:j}=this._materialParameters(m,g),D=p.byteLength/g[0].stride,A=l||new Uint32Array([0,f?f.length:D]),T=m.transformation?S(m.transformation):E(),H=Z(t.globalTrafo);x(T,H,T);const P=w(N(),T),U=b(C(),T),L=this._isIntegratedMesh?this._imShading?2:0:1,B=j.textureCoordinateType,q=!v(U,M),z=new mt(g,L,B,q?1:0,0),$=new gt({interleavedVertexData:p,vertexCount:D,indexData:f},{positions:ee(y.data),indices:te(y.indices)},A,z),K=this.view.renderSpatialReference,Q=this.view.basemapTerrain.spatialReference,J=lt.fromData(dt(t.geometryObbData)).center,Y=[1,1,1];G(J,K,Y,Q)||o.getLogger(this).errorOnce("Unsupported coordinate system for IM overlay");const X=N();W(J,K,X,Q);const ie=C();I(ie,U);const se=N();V(se,F(se,J,P),ie);const re=X[0]-se[0]*Y[0],oe=X[1]-se[1]*Y[1],ne=2===j.textureCoordinateType,{textures:ae,texturePromise:le,materialParameters:de}=this._initMaterialAndTextures(O,a,ne,e),he=_.createObject(new ut(k(re,oe,Y[0],Y[1]),new pt(P,U),lt.fromData(dt(t.geometryObbData)),$,!this._isIntegratedMesh),de);e.memory+=this._memEstimateGeometryAdded(he),e.memory+=ae.reduce((e,t)=>e+(null!=t?this._memEstimateTextureAdded(t):0),0);const ce=!!O.hasParametersFromSource,ue="blend"!==O.alphaMode&&O.metallicRoughness.baseColorFactor[3]>=1,_e=new xt(e,h,he,this._getInvalidRendererVersion(),s.attributeInfo,{hasParametersFromSource:ce,isOpaque:ue},ae,c,u);s.meta=_e,this._hasTextures||=t.requiredTextures?.some(({usage:e})=>!!(19&e))||!!e.resources.texture,this._hasData=!0,this._hasColors||=R,this.notifyChange("hasTexturesOrVertexColors");const me=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering(_e),le]).then(([t,s])=>(this._addTasks.has(e.index)&&t?.updateObjectVisibility(_e.objectHandle,!1).catch(e=>this._logEdgeViewError(e,this.layer.title)),this._safeReschedule(()=>{const i=this._addTasks.get(e.index);if(!i)return;if(this._addNodeMeta(e.index,_e),i.meta=null,!this.contentVisible)return void this._removeNodeStageData(e.index,this.elevationOffset);_.setObjectVisibility(he,!0),t?.updateObjectVisibility(_e.objectHandle,!0).catch(e=>this._logEdgeViewError(e,this.layer.title)),_e.attributeInfo=i.attributeInfo;const s=_e.cachedRendererVersion!==this._rendererVersion,r=me!==this.slicePlaneEnabled;this._updateElevationOffsets(_e);const o=_e.elevationOffsets;this._updateComponentData(_e);const n=this._applyFiltersToNode(_e);(s||null!=t&&(r||n||o))&&this._addOrUpdateEdgeRendering(_e),null!=this._labeler&&this._addMetaToLabeler(this._labeler,_e),this._visibleGeometryChanged(_e,0),this._highlights?.objectCreated(_e),this._updateMaterial(_e),this._setNewNodeOpacity(_e),null!=this._treeDebugger&&this._treeDebugger.update()},i))).catch(e=>{const{meta:t,allowMemCache:i}=s;throw s.meta=null,t&&i?this._cacheGPUData(t):t&&this._deleteComponentObject(t),e})}_addNodeMeta(e,t){if(this._removeNodeStageData(e,this.elevationOffset,this._nodeId2MetaReloading),this._nodeId2Meta.has(e)){o.getLogger(this).error("Removing duplicated node");const t=this._nodeId2Meta.get(e);t&&(this._deleteComponentObject(t),this._updateFeatureIdCounts(t,-1))}else this._controller.updateLoadStatus(e,!0);t&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&Ut(t.cachedEdgeMaterials,0),this._updateFeatureIdCounts(t,1)),this._nodeId2Meta.set(e,t),this.notifyChange("elevationRange")}_updateElevationOffsets(e){if(!e.node.serviceMbsInIndexSR)return;const{view:t,elevationInfo:i}=this,s=this._controller.crsIndex,{groundView:r,groundSpatialReference:o,renderSpatialReference:n}=t,a=i.mode;if(null==n||null==o||0===a)return void(e.elevationOffsets=null);const l=this._collection.getObjectTransform(e.objectHandle);e.elevationOffsets=e.elevationOffsets??[];const d=Gt,h=Bt,c=2===a,u=this.view.renderCoordsHelper,_=e.featureIds.length,m=(()=>{if(e.cachedElevationAnchors)return e.cachedElevationAnchors;const t=X(3*_);e.cachedElevationAnchors=t;const{center:i}=e.node.serviceMbsInIndexSR;for(let r=0;r<_;r++){const a=3*r,c=e.anchorIds?.indexOf(r)??-1;e.anchors&&c>=0?(O(d,e.anchors[3*c],e.anchors[3*c+1],e.anchors[3*c+2]),D(d,d,i),W(d,s,d,o),t[a]=d[0],t[a+1]=d[1],t[a+2]=u.getAltitude(d)):(this._collection.getComponentAabb(e.objectHandle,r,h,!0),O(d,(h[0]+h[3])/2,(h[1]+h[4])/2,h[2]),V(d,d,l.rotationScale),D(d,d,l.position),t[a+2]=u.getAltitude(d),W(d,n,d,o),t[a]=d[0],t[a+1]=d[1])}return t})(),g=i.offset,f=e.elevationOffsets,p=(e,t)=>{const i=c?m[3*e+2]:0;f[e]=g+(t??0)-i};r.getElevations(m,_,p)}_ensureElevationTask(){return null!=this._elevationTask||(this._elevationTask=new Ee(this.view.resourceController.scheduler,e=>this._controller.updateElevationChanged(e,this.view.basemapTerrain.spatialReference)?.filterInPlace(e=>null!=this._nodeId2Meta.get(e)),e=>this._nodeElevationAlignmentChanged(this._nodeId2Meta.get(e)),()=>this.elevationInfo?.mode)),this._elevationTask}_elevationInfoChanged(e,t){const i=0!==e.mode,s=!!t&&t!==e&&0!==t.mode;this._intersectionHandler.updateElevationAlignState(i,this.view.state.viewingMode),i&&!s&&this._controller.removeAllGeometryObbs(),this._nodeId2Meta.forEach(e=>this._nodeElevationAlignmentChanged(e))}_nodeElevationAlignmentChanged(e){null!=e&&(this._updateElevationOffsets(e),this._updateComponentData(e),this._updateEdgeRendering(e),null!=this._labeler&&this._labeler.updateLabelPositions(e),this._updateSnappingSources(e,2),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e.objectHandle)))}_safeReschedule(e,t){return c(t),this._controller.reschedule(e,t)}_materialParameters(e,t){const i=null!=e.params.material?e.params.material:Te(),s=t.some(({name:e})=>"uvRegion"===e),r=t.some(({name:e})=>"normalCompressed"===e),o=At(i);return{geometryParameters:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s){const r=this._stage.renderView,o=e=>{this._gpuMemoryEstimate-=e,this._texMemoryEstimate-=e,s.memory-=e},n=t.map(t=>He(t,e,i,r,this._compressionTracker,o));this._stage.addTextures(n);const{materialParameters:a,texturePromise:l}=Ne(e,n,t,this.view.stage.renderView.textures,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR,isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference,applySSAO:this._applySSAO});return{textures:n,texturePromise:l,materialParameters:a}}_getGeometryParameters(e){return new ft(this._hasVertexColors,e.hasNormals,e.hasTexture?e.hasRegions?2:1:0)}_addData(e,t,i){let s=this._addTasks.get(e.index);if(s)s.attributeInfo=t;else{const r=Promise.withResolvers();s=new kt(t,null,r.promise),this._addTasks.set(e.index,s),i().then(r.resolve,r.reject).then(()=>this._addTasks.delete(e.index)).catch(t=>{throw this._addTasks.delete(e.index),t})}return s.promise}_clearAddTasks(){this._addTasks.forEach(e=>{null!=e.meta&&(this._cacheGPUData(e.meta),e.meta=null)}),this._addTasks.clear()}_clippingAreaChanged(){const e=this.view.renderSpatialReference,t=this.layer.spatialReference,i=J();this._renderClippingArea=at(this.view.clippingArea,i,e)?i:null;const s=J();this._layerClippingArea=at(this.view.clippingArea,s,t)?s:null,this._filterChange(),this._controller&&this._controller.updateClippingArea(this.view.clippingArea),this._isIntegratedMesh&&this._modificationsChanged()}get hasGeometryFilter(){return!1}_geometryFilterChange(){const e=this.hasGeometryFilter;this._controller.geometryFilterChanged(e),this._applyFilters(e),this._assertFeatureIdNodeCounts(e)}_assertFeatureIdNodeCounts(e){e&&!this._featureIdCounts?(this._featureIdCounts=ti(this._nodeId2Meta.values()),this._filteredIdCounts=ti(this._nodeId2Meta.values(),1),this._weaklyRemovedIdCounts=ti(this._nodeId2Meta.values(),2),this.addHandles(_(()=>this._controller.updating,e=>{!e&&this._needFilterResolve&&(this.multiGeometryFilterResolve(),this._needFilterResolve=!1,this.notifyUpdate())},{sync:!0}),"updateFinished")):!e&&this._featureIdCounts&&(this._featureIdCounts=null,this._filteredIdCounts=null,this._weaklyRemovedIdCounts=null,this._mismatchShow=null,this._mismatchHide=null,this.removeHandles("updateFinished"),this._needFilterResolve=!1,this.notifyUpdate())}_updateFeatureIdCounts(e,t){this._featureIdCounts&&(this._needFilterResolve=!0,ei(this._featureIdCounts,e.featureIds,t),ei(this._filteredIdCounts,e.filteredIds,t),ei(this._weaklyRemovedIdCounts,e.weaklyRemovedIds,t))}_updateFilteredIdCounts(e,t,i){this._filteredIdCounts&&(this._needFilterResolve=!0,ei(this._filteredIdCounts,t,-1),ei(this._filteredIdCounts,e.filteredIds,1),ei(this._weaklyRemovedIdCounts,i,-1),ei(this._weaklyRemovedIdCounts,e.weaklyRemovedIds,1))}_checkFeatureIdNodeCountInvariant(){const e=null!=this._featureIdCounts;if(this.hasGeometryFilter!==e&&o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","LayerView should have feature id node counts if and only if it has a geometry filter",{layerView:this,hasNodeCounts:e}),!this._featureIdCounts||!this._filteredIdCounts)return;const t=ti(this._nodeId2Meta.values());n(this._featureIdCounts,t)||o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","Incorrect _featureIdCounts",{layerView:this,counts:this._featureIdCounts,expected:t});const i=ti(this._nodeId2Meta.values(),1);n(this._filteredIdCounts,i)||o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","Incorrect _filteredIdCounts",{layerView:this,counts:this._filteredIdCounts,expected:i});const s=ti(this._nodeId2Meta.values(),2);n(this._weaklyRemovedIdCounts,s)||o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","Incorrect _weaklyRemovedIdCounts",{layerView:this,counts:this._weaklyRemovedIdCounts,expected:i})}multiGeometryFilterResolve(){if(!this._featureIdCounts||!this._filteredIdCounts)return;let e=null,t=null;for(const[i,s]of this._filteredIdCounts){const r=this._featureIdCounts.get(i);if(r!==s){s+(this._weaklyRemovedIdCounts?.get(i)??0)===r?(e??=new Set,e.add(i)):(t??=new Set,t.add(i))}}g(e,this._mismatchShow)&&g(t,this._mismatchHide)||(this._mismatchShow=e,this._mismatchHide=t,this._nodeId2Meta.forEach(e=>{if(!e?.filteredIds)return;const t=Zt(e,this._mismatchShow,this._mismatchHide);this._collection.setAllComponentVisibilities(e.objectHandle,t),this._visibleGeometryChanged(e,2)}))}_filterChange(){this._applyFilters(this.hasGeometryFilter)}_applyFilters(e){this._filters=this.getFilters(),e?this._controller&&this._controller.requestUpdate():this._nodeId2Meta.forEach(e=>{e&&this._applyFiltersToNode(e)&&(this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,2))})}getFilters(){const e=[],t=this._renderClippingArea;return null!=t&&e.push((e,i)=>this._boundingRectFilter(e,i,t)),e}addSqlFilter(e,t,i){if(null!=t){const s=t.fieldNames;e.push((e,r)=>this._sqlFilter(e,r,t,s,i))}}_sqlFilter(e,t,i,s,r){const o={},n=this._createLayerGraphic(o);if(!n)return;const a=this.layer.objectIdField,l=t.featureIds,d=t.attributeInfo?.attributeData;s.every(e=>e===a||null!=d?.[e])&&ze(e,l,e=>{o[a]=l[e];for(const i of s)i!==a&&(o[i]=d?Re(d[i],e):null);try{return i.testFeature(n)}catch(t){return r(t),!1}})}_boundingRectNodeTest(e,t){return B(e.node.serviceMbsInIndexSR,this._controller.crsIndex,Dt,this.view.renderSpatialReference),We(t,Dt)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,Rt),K(Rt,Ot),Y(i,Ot)}_boundingRectFilter(e,t,i){const s=this._collection,r=this._boundingRectNodeTest(t,i);if(3===r)return;if(0===r)return void(e.length=0);const o=s.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const n=this._transformClippingArea(jt,i,t.objectHandle);ze(e,t.featureIds,e=>this._boundingRectFeatureTest(t,e,n))}_transformClippingArea(e,t,i){const s=this._collection.getObjectTransform(i),r=s.position,o=s.rotationScale;return e[0]=(t[0]-r[0])/o[0],e[1]=(t[1]-r[1])/o[4],e[2]=(t[2]-r[0])/o[0],e[3]=(t[3]-r[1])/o[4],e}async _addOrUpdateEdgeRendering(e,t=!0){const i=e.objectHandle,{hasEdges:s,perFeatureEdgeMaterials:r}=this._getFilteredEdgeMaterials(e);s&&!this._edgeView&&(this._edgeView=await this._stage.renderer.loadEdgeView());const o=this._edgeView;if(!o)return null;const n=o.hasObject(i);if(s){if(n){if(this.nodeCrossfadingEnabled){Ut(r,this.getNodeOpacity(e))}return o.updateAllComponentMaterials(i,r,this.slicePlaneEnabled,t).catch(e=>this._logEdgeViewError(e,this.layer.title)),o.updateObjectVisibility(i,!0).catch(e=>this._logEdgeViewError(e,this.layer.title)),o.updateAllVerticalOffsets(i,e.elevationOffsets).catch(e=>this._logEdgeViewError(e,this.layer.title)),o}const s=await this._collection.addEdges(i,o,r,this.slicePlaneEnabled,e.elevationOffsets);return e.edgeMemoryUsage=s,e.node.memory+=s,o}return n&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,o.removeObject(i)),null}_applyFiltersToNode(e){const{filteredIds:t,weaklyRemovedIds:i}=e,s=this._applyFiltersToNodeComponents(e);return this._updateFilteredIdCounts(e,t,i),s&&this._labeler?.applyFilterChange(e),s}_applyFiltersToNodeComponents(e){const t=this._collection,i=t.getComponentCount(e.objectHandle),s=null!=e.filteredIds,r=0===i.invisible;if(t.setAllComponentVisibilities(e.objectHandle,"all"),0===this._filters.length)return e.filteredIds=null,!r;if(null!=e.filteredIds&&e.appliedFilters===this._filters||(e.weaklyRemovedIds=null,e.filteredIds=Xt(e,this._filters),e.appliedFilters=this._filters),s&&e.filteredIds===e.featureIds&&(!this._mismatchHide||e.filteredIds.every(e=>!this._mismatchHide?.has(e))))return!r;const o=Zt(e,this._mismatchShow,this._mismatchHide);return t.setAllComponentVisibilities(e.objectHandle,o),!0}_removeAllNodeDataFromStage(e=this.elevationOffset){this._nodeId2Meta.forEach((t,i)=>this._removeNodeStageData(i,e)),this._nodeId2MetaReloading.forEach((t,i)=>this._removeNodeStageData(i,e,this._nodeId2MetaReloading)),this._elevationTask=a(this._elevationTask)}removeNode(e){const t=this.elevationOffset;this._removeNodeStageData(e,t),this._removeNodeStageData(e,t,this._nodeId2MetaReloading),null!=this._elevationTask&&this._elevationTask.remove(e)}_removeNodeStageData(e,t,i=this._nodeId2Meta){i.has(e)&&this._controller.updateLoadStatus(e,!1);const s=i.get(e);null!=s?(this._collection.setObjectVisibility(s.objectHandle,!1),null!=this._edgeView&&this._edgeView.hasObject(s.objectHandle)&&this._edgeView.updateObjectVisibility(s.objectHandle,!1).catch(e=>this._logEdgeViewError(e,this.layer.title)),this._visibleGeometryChanged(s,1),null!=this._labeler&&this._labeler.removeNodeMeta(s),i.delete(e),this._highlights?.objectDeleted(s),i===this._nodeId2Meta?(this._updateFeatureIdCounts(s,-1),this._cacheGPUData(s,t),this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopNodeFading(s)):this._deleteComponentObject(s),null!=this._treeDebugger&&this._treeDebugger.update()):i.delete(e)}_deleteComponentObject(e){if(null!=this._edgeView&&this._edgeView.removeObject(e.objectHandle),this._memEstimateGeometryRemoved(e.objectHandle),this._collection.destroyObject(e.objectHandle),e.textures)for(const t of e.textures)this._memEstimateTextureRemoved(t),this._stage.removeTexture(t)}updateNodeState(e,t){const i=this._nodeId2Meta.get(e);null!=i&&i.objectHandle.updateMaterial({polygonOffset:0===t?1:0})}updateNodeIndex(e,t){if(this._nodeId2Meta.has(e)){const i=this._nodeId2Meta.get(e);this._nodeId2Meta.delete(e),this._nodeId2Meta.set(t,i),this.notifyChange("elevationRange")}const i=this._nodeId2MetaReloading.get(e);i&&(this._nodeId2MetaReloading.delete(e),this._nodeId2MetaReloading.set(t,i))}_invalidateAllSymbols(){this._rendererVersion=$e(this._rendererVersion,1),this._controller?.requestUpdate()}_getInvalidRendererVersion(){return $e(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=$e(this._rendererVersion,1),this._rendererFields=null,this._colorVariable=null,this._opacityVariable=null,this._invalidateAllSymbols(),e&&(this._rendererFields=await e.getRequiredFields(this.layer.fieldsIndex)),this._updateSymbologyFields(),!this._arcade&&e&&"arcadeRequired"in e&&e.arcadeRequired&&(this._arcade=await ue()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:o.getLogger(this).warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.symbols)"mesh-3d"!==t.type&&o.getLogger(this).error(`Symbols of type '${t.type}' are not supported for 3D Object Scene Services.`);this._controller&&this._controller.requestUpdate()}_getCachedEdgeMaterials(e){return this._hasComponentData&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e),e.cachedEdgeMaterials}_getComponentParameters(e){this._hasComponentData&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e);const t=e.cachedSymbology;return(i,s)=>{const r=i*e.cachedSymbologyStride;P(s.externalColor,t[r]/255,t[r+1]/255,t[r+2]/255,t[r+3]/255);const o=this._stage.renderView.olidRenderHelper;if(o){const t=e.featureIds[i],r=this.sublayerId?`${this.layerViewUid}_${this.sublayerId}`:this.layerViewUid,n=he(this.view,this.uid);o.setUidToObjectAndLayerId(t,t,this.layerId,r,this.layerPopupEnabledAndHasTemplate&&!n,e.node.resources.attributes,i,this.sublayerId),s.olidColor=o.getObjectAndLayerIdColor({graphicUid:t,layerViewUid:r})}s.externalColorMixMode=15&t[r+4],s.castShadows=!!(16&t[r+4]),s.pickable=!!(32&t[r+4]),s.elevationOffset=e.elevationOffsets?.[i]??0,s.emissiveStrength=e.emissiveStrengths?.[i]??1,s.emissiveSource=e.emissiveSources?.[i]??0}}_getSymbolInfo(e,t){const i=e?.getSymbol(t,{arcade:this._arcade});if(!(i instanceof _e))return null;const s=i.id;if(this._symbolInfos.has(s))return this._symbolInfos.get(s);const r=Ke(i);return this._symbolInfos.set(s,r),r}_setSymbologyOverride(e,t){this._symbologyOverride!==e&&(this._symbologyOverride=e,this._symbologyOverrideFields=t,this._invalidateAllSymbols(),this._updateSymbologyFields())}_updateSymbologyFields(){this._symbologyFields=null!=this._symbologyOverrideFields&&this._symbologyOverrideFields.length>0?null!=this._rendererFields&&this._rendererFields.length>0?ne(this.layer.fieldsIndex,[...this._rendererFields,...this._symbologyOverrideFields]):this._symbologyOverrideFields:this._rendererFields}_updateCachedRendererData(e){if(e.cachedRendererVersion=this._rendererVersion,!this._hasComponentData)return;const t=this._tmpAttributeOnlyGraphic,i={};t.attributes=i;const s=this._currentRenderer,r=e.attributeInfo?.attributeData,o=e.featureIds?this.layer.objectIdField:null,n=null!=r&&null!=this._symbologyFields&&this._symbologyFields.length>0;let a=null,l=null;if(n&&null!=this._symbologyFields){a=[],l=[];for(const e of this._symbologyFields){const t=r[e];t&&(a.push(e),l.push(t))}}e.cachedSymbology||(e.cachedSymbology=se(e.featureIds.length*e.cachedSymbologyStride));const d=new et,h=this.fullOpacity,c=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):h;let u=null,_=1,m=Qe,g=0;for(let f=0;f<e.featureIds.length;f++){if(null!=o&&(i[o]=e.featureIds[f]),n&&a)for(let e=0;e<a.length;e++)i[a[e]]=Re(l[e],f);const r=s?this._getSymbolInfo(s,t):null;let h,p;if(d.pickable=!0,s&&"visualVariables"in s){if(this._colorVariable){const e=le(this._colorVariable,t,{color:Ft,arcade:this._arcade});e&&(h=d.color,h[0]=e.r/255,h[1]=e.g/255,h[2]=e.b/255,h[3]=e.a??1,this._opacityVariable||null===e.a||(p=e.a))}this._opacityVariable&&(p=de(this._opacityVariable,t,{arcade:this._arcade}))}if(r?.material){const e=r.material;h=null==h||null==p?xe(h,p,e.color,e.alpha,Mt,d.color):xe(h,p,null,null,Mt,d.color)}h??=P(d.color,1,1,1,1);const y=r?.material;if(d.colorMixMode=y?.colorMixMode??1,d.edgeMaterial=r?.edgeMaterial,this._symbologyOverride?.(t,d),null!=this._nodeColorOverride&&(this._nodeColorOverride(e.node,h),d.colorMixMode=3),d.pickable&&=h[3]>=Ct,d.castShadows=r?r.castShadows:d.pickable,null!=d.edgeMaterial){const t=h[3]>=1&&(e.material.isOpaque||3===d.colorMixMode)?1:0;d.edgeMaterial===u&&t===_||(m={...d.edgeMaterial,opacity:c,objectTransparency:t},u=d.edgeMaterial,_=t),e.cachedEdgeMaterials[f]=m}else e.cachedEdgeMaterials[f]=Qe;e.cachedSymbology[g++]=Math.round(255*h[0]),e.cachedSymbology[g++]=Math.round(255*h[1]),e.cachedSymbology[g++]=Math.round(255*h[2]),e.cachedSymbology[g++]=Math.round(255*h[3]),e.cachedSymbology[g++]=d.colorMixMode|+d.castShadows<<4|+d.pickable<<5;const b=y?.emissive?.strength??yt;b===yt||e.emissiveStrengths||(e.emissiveStrengths=new Array(e.featureIds.length).fill(yt)),e.emissiveStrengths&&(e.emissiveStrengths[f]=b);const v=y?.emissive?.source||0;0===v||e.emissiveSources||(e.emissiveSources=new Array(e.featureIds.length).fill(0)),e.emissiveSources&&(e.emissiveSources[f]=v)}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);this.nodeCrossfadingEnabled||Ut(t,this.fullOpacity);const i=e.filteredIds;if(null==i){return{hasEdges:t.some(e=>e!==Qe),perFeatureEdgeMaterials:t}}let s=0,r=!1;const o=t.map((t,o)=>e.featureIds[o]!==i[s]?Qe:(r=r||t!==Qe,s++,t));return{hasEdges:r,perFeatureEdgeMaterials:o}}_updateComponentData(e){if(!this._hasComponentData)return;const{objectHandle:t}=e,i=this._getComponentParameters(e);this._collection.setComponentData(t,i),this._stage.renderView.requestRender()}_reloadAll(e=this.elevationOffset){this._removeAllNodeDataFromStage(e),null!=this._controller&&this._controller.restartNodeLoading()}_opacityChange(e){this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopAllNodeFading(),this._nodeId2Meta.forEach(t=>{null!=t&&(this._collection.updateObjectOpacity(t.objectHandle,e),Ut(t.cachedEdgeMaterials,e),this._updateEdgeRendering(t))})}_updateMaterial(e){e.objectHandle.updateMaterial({slicePlaneEnabled:this.slicePlaneEnabled,usePBR:this._usePBR})}_updateEngineObject(e){this._updateComponentData(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,2)}intersect(e,t,i,s){this._intersectionHandler.intersect(e,t,i,s,null,!1)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),null!=this._labeler&&(this._labeler.slicePlaneEnabled=e),this._foreachMeta(t=>{t.objectHandle.updateMaterial({slicePlaneEnabled:e}),this._updateEdgeRendering(t,!1)})}_updatePBR(e){this._foreachMeta(t=>t.objectHandle.updateMaterial({usePBR:e})),this._hasLoadedPBRTextures=!0}_foreachMeta(e){this._nodeId2Meta.forEach(t=>{null!=t&&e(t)})}get _usePBR(){return this._imShading&&this.view.qualitySettings.physicallyBasedRenderingEnabled}_updateEdgeRendering(e,t=!0){null!=this._edgeView&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_ignoreClientNodeOverriddenFeatures(e){return this.i3sOverrides.hasGeometryChanges?(t,i,s)=>s.node.index>=0&&this.i3sOverrides.featureHasGeometryChanges(t)?0:e(t,i,s):e}_forAllFeatures(e,t,i){for(const s of this._nodeId2Meta.values())if(!(null==s||t&&s.node.serviceMbsInIndexSR&&1===t(s.node.serviceMbsInIndexSR)))switch(i){case 1:this._forAllFeaturesOfNode(s,e);break;case 0:this._forAllVisibleFeaturesOfNode(s,e);break;case 2:this._forAllQueryableFeaturesOfNode(s,e)}}_forAllFeaturesOfNode(e,t){e.featureIds.forEach((i,s)=>t(i,s,e))}_forAllVisibleFeaturesOfNode(e,t){const i=e.featureIds;this._collection.forEachVisibleComponent(e.objectHandle,s=>0===t(i[s],s,e))}_forAllQueryableFeaturesOfNode(e,t){const i=this._ignoreClientNodeOverriddenFeatures(t);if(null==this._renderClippingArea)return this._forAllFeaturesOfNode(e,i);const s=this._boundingRectNodeTest(e,this._renderClippingArea);if(0===s)return;if(3===s)return this._forAllFeaturesOfNode(e,i);const r=e.featureIds,o=e.objectHandle,n=Je(this._renderClippingArea,this._collection.getObjectTransform(o));for(let a=0;a<r.length;a++)this._boundingRectFeatureTest(e,a,n)&&i(r[a],a,e)}_createAttributes(e,t){const i={};null!=t.featureIds&&(i[this._getObjectIdField()]=t.featureIds[e]);const s=t.attributeInfo?.attributeData;if(null!=s)for(const r of Object.keys(s))i[r]=Re(s[r],e);return i}_createGraphic(e,t){return this._createLayerGraphic(this._createAttributes(e,t))}highlight(e,t){const s=it(e);if(0===s.length)return st;const r=vt(t),o=s[0]instanceof i?this._featureIdsFromGraphics(s):"number"==typeof s[0]?s:null;if(!o)return st;const n=this._ensureHighlights(),{set:a,handle:l}=n.acquireSet(r);return n.setFeatureIds(a,o),l}_featureIdsFromGraphics(e){const t=this.layer.fieldsIndex,i=this._getObjectIdField();return e.map(e=>tt(t,e.attributes,i))}_ensureHighlights(){return this._highlights??=new Se({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,1),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)}),this._highlights}resetHighlights(){this._highlights=a(this._highlights)}_visibleGeometryChanged(e,t){this._elevationProvider&&(null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=m(()=>{const{node:t}=e,i=t.visibilityObbInRenderSR??t.geometryObbInRenderSR??t.serviceObbInRenderSR;if(null!=i){const e=Q();i.toAaBoundingBox(e),this.emit("visible-geometry-changed",new ge(e))}else this.emit("visible-geometry-changed");this._visibleGeometryChangedSchedulerHandle=null})),this._updateSnappingSources(e,t),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e.objectHandle)))}get performanceInfo(){return new pe(this.usedMemory,this._nodeId2Meta.size,Math.round(this._gpuMemoryEstimate/1048576),Math.round(this._geoMemoryEstimate/1048576),Math.round(this._texMemoryEstimate/1048576),Math.round(this.unloadedMemory/1048576),this._idbCacheEnabled?Math.round(100*this._idbCache.getHitRate()):0)}checkInvariants(){}get test(){}getNodeOpacityByIndex(e){const t=this._nodeId2Meta.get(e);return this.getNodeOpacity(t)}getNodeOpacity(e){return null!=e?this._collection.getObjectOpacity(e.objectHandle):0}isNodeFullyFadedIn(e){return this._crossfadeHelper.isNodeFullyFadedIn(e)}getNodeCrossfadeMetaData(e){return this._nodeId2Meta.get(e)}getNodeComponentHandle(e){return this._nodeId2Meta.get(e)?.objectHandle}markNodeToRemove(e){this._controller&&this._controller.markNodeToRemove(e)}removeMarkedNodes(){this._controller&&this._controller.removeMarkedNodes()}foreachCrossfadeNode(e){this._nodeId2Meta.forEach(e)}fadeNode(e,t,i){if(!this.nodeCrossfadingEnabled)return;const s=this._nodeId2Meta.get(e);null!=s&&this._crossfadeHelper.fadeNode(e,s,t,i)}setNodeOpacityByIndex(e,t){const i=this._nodeId2Meta.get(e);null!=i&&this._setNodeOpacity(i,t)}_setNodeOpacity(e,t){this._collection.updateObjectOpacity(e.objectHandle,t),this._setNodeEdgeOpacity(e,t)}_setNodeEdgeOpacity(e,t){if(null==this._edgeView||!e.cachedEdgeMaterials)return;Ut(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t).catch(e=>this._logEdgeViewError(e,this.layer.title))}get hasModifications(){return this._isIntegratedMesh&&null!=this._layerClippingArea||this._modifications&&this._modifications.length>0}updateNodeModificationStatus(e){const t=e.length;if(!this.hasModifications||t<=0||!0!==this._i3sWasmLoaded)return;const i=this.uid,s=Pt(e);if(s){const t={context:i,buffer:s.buffer};ve(t);const r=new Float64Array(s.buffer);e.forAll((e,t)=>{const i=r[t],s=Ie(i);e.imModificationImpact=s,0!==s&&this._controller.invalidateGeometryVisibility(e.index)})}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||null!=this._labeler&&this._labeler.updating||this._crossfadeHelper?.updating||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0||null!=this._elevationTask&&this._elevationTask.readyToRun||this._needFilterResolve||this._compressionTracker.compressing}trackSnappingSources(e){const t={events:e,fetchEdgeLocations:async(e,t,i)=>{const s=this._nodeId2Meta.get(e);if(null==s)throw new Error("invalid-node");const{origin:r,buffer:o}=await this._collection.extractEdgeInformation(s.objectHandle,t,i);return this._snappingLocationsApplyElevation(s,o,r),{type:"components",objectIds:s.featureIds,locations:o,origin:r}},remove:()=>r(this._snappingSourcesTrackers,t)};return this._snappingSourcesTrackers.push(t),this._nodeId2Meta.forEach((t,i)=>{if(null==t)return;const s=this._controller.getRenderMbs(t.node);s&&e.add(i,s)}),t}_snappingLocationsApplyElevation(e,t,i){if(!e.elevationOffsets||0===this.elevationInfo.mode)return;const s=t.position0,r=t.position1,o=t.componentIndex,n=N(),a=N(),l=(e,t)=>{D(e,e,i),this.view.renderCoordsHelper.worldUpAtPosition(e,a),D(e,e,A(a,a,t)),T(e,e,i)};for(let d=0;d<s.count;d++){const t=e.elevationOffsets[o.get(d)];s.getVec(d,n),l(n,t),s.setVec(d,n),r.getVec(d,n),l(n,t),r.setVec(d,n)}}_updateSnappingSources(e,t){const{index:i}=e.node,s=this._controller.getRenderMbs(e.node);if(null!=s)for(const r of this._snappingSourcesTrackers)1!==t&&2!==t||r.events.remove(i),0!==t&&2!==t||r.events.add(i,s)}_logEdgeViewError(e,t){h(e)||o.getLogger(this).warn("Error while processing edges. Edges on this layer might not display correctly",t,e)}_indexedDbSizeCheck(e,t){return t.byteSize>St?(o.getLogger(this).warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}get elevationProvider(){return this._elevationProvider}};return e([p()],H.prototype,"_hasLoadedPBRTextures",void 0),e([p()],H.prototype,"_asyncModuleLoading",void 0),e([p()],H.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([p()],H.prototype,"view",void 0),e([p()],H.prototype,"layer",void 0),e([p()],H.prototype,"_controller",void 0),e([p()],H.prototype,"_labeler",void 0),e([p()],H.prototype,"updating",void 0),e([p()],H.prototype,"suspended",void 0),e([p()],H.prototype,"contentVisible",null),e([p({readOnly:!0})],H.prototype,"legendEnabled",null),e([p(ht)],H.prototype,"updatingProgress",void 0),e([p()],H.prototype,"updatingProgressValue",null),e([p()],H.prototype,"hasTexturesOrVertexColors",null),e([p()],H.prototype,"rendererTextureUsage",null),e([p()],H.prototype,"elevationOffset",null),e([p()],H.prototype,"elevationInfo",null),e([p({type:Boolean})],H.prototype,"slicePlaneEnabled",void 0),e([p()],H.prototype,"supportedTextureEncodings",null),e([p({type:[ae]})],H.prototype,"_modifications",void 0),e([p({readOnly:!0})],H.prototype,"clientGeometry",null),e([p()],H.prototype,"elevationRange",null),e([p()],H.prototype,"fullExtent",null),e([p()],H.prototype,"_elevationTask",void 0),e([p({readOnly:!0})],H.prototype,"_usePBR",null),H=e([y("esri.views.3d.layers.I3SMeshView3D")],H),H},Rt=Q(),Ot=J(),jt=J(),Vt=new lt,Ft=new t([0,0,0,0]),Dt=new ie(0,0,0,0);function At(e){if(null==e)return!1;const t=e.metallicRoughness;return t&&t.baseColorTextureId>=0||t&&t.metallicRoughnessTextureId>=0||e.normalTextureId>=0||e.emissiveTextureId>=0||e.occlusionTextureId>=0}function Tt(e){return"geometryData"in e}function Ht(e){return null!=e&&f(e.data)}function Nt(e,t){let i=1024+e.interleavedVertexData.byteLength+(e.indices?e.indices.byteLength:0)+e.positionData.data.byteLength+e.positionData.indices.byteLength;if(null!=t)for(const s of t)null!=s&&f(s.data)&&(i+=s.data.byteLength);return i}function Pt(e){if(0===e.length)return;const t=10*e.length,i=new Float64Array(t);let s=0;return e.forAll(e=>{let t=e.serviceObbInIndexSR;null==t&&(t=Vt,e.serviceMbsInIndexSR?(t.center=e.serviceMbsInIndexSR.center,t.halfSize=[e.serviceMbsInIndexSR.radius,e.serviceMbsInIndexSR.radius,e.serviceMbsInIndexSR.radius]):t.invalidate());const r=t.data;i[s++]=r[0],i[s++]=r[1],i[s++]=r[2],i[s++]=r[3],i[s++]=r[4],i[s++]=r[5],i[s++]=r[6],i[s++]=r[7],i[s++]=r[8],i[s++]=r[9]}),i}class kt{constructor(e,t,i){this.attributeInfo=e,this.meta=t,this.promise=i,this.allowMemCache=!0}}function Ut(e,t){e.forEach(e=>e.opacity=t)}class Lt{constructor(e,t){this.mode=e,this.offset=t}}const Gt=N(),Bt=Q(),qt="elevation-change",zt="",Wt="@null",$t="@ECEF",Kt=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],Qt=new nt;function Jt(e,t,i){let s=e.minElevation,r=e.maxElevation;const o=i;if(o>0){t.getCorners(Kt);for(const e of Kt){const t=H(e)-o;s=Math.min(s,t),r=Math.max(r,t)}}else{t.getCorners(Kt);for(const e of Kt){const t=e[2];s=Math.min(s,t),r=Math.max(r,t)}}e.expandElevationRangeValues(s,r)}function Yt(e,t,i){const{center:s,radius:r}=t,o=i>0?H(s)-i:s[2];e.expandElevationRangeValues(o-r,o+r)}function Xt(e,t){const i=e.featureIds.slice();for(const s of t)if(s(i,e),0===i.length)break;return i.length===e.featureIds.length?e.featureIds:i}function Zt(e,t,i){const s=new Array,r=e.filteredIds;if(null==r||t?.size||i?.size){if(null!=r){let o=0;e.featureIds.forEach((e,n)=>{if(r[o]===e)++o;else if(!t?.has(e))return;i?.has(e)||s.push(n)})}}else e.featureIds.forEach((e,t)=>{r[s.length]===e&&s.push(t)});return s}function ei(e,t,i){if(e&&t)for(const s of t){const t=(e.get(s)??0)+i;t>0?e.set(s,t):e.delete(s)}}function ti(e,t=0){const i=new Map;for(const s of e){ei(i,0===t?s?.featureIds:1===t?s?.filteredIds:s?.weaklyRemovedIds,1)}return i}export{Et as I3SMeshView3D};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as i,removeMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{initial as o,watch as n,when as a}from"../../../core/reactiveUtils.js";import{schedule as l}from"../../../core/scheduling.js";import{property as c,subclass as d}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as h,invert as u,fromQuat as m}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as p,IDENTITY as f}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as b}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as y}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{normalize as g,sub as _,dot as v,set as w,transformMat3 as x,add as T}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as j,freeze as C,clone as M,fromValues as R,ZEROS as E}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{clone as O,fromValues as U,ONES as V}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMoon as S,isMars as A,getReferenceEllipsoid as H,SphericalECEFSpatialReferenceLike as P}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as L}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as k}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as I}from"../../../geometry/projection/projectVectorToVector.js";import{create as D}from"../../../geometry/support/aaBoundingRect.js";import{getContinuousIndexArray as F}from"../../../geometry/support/Indices.js";import{isCGCS2000 as B}from"../../../geometry/support/spatialReferenceUtils.js";import{BufferViewVec4f as G,BufferViewVec4u8 as z,BufferViewVec4u16 as N,BufferViewVec3f as q,BufferViewVec3u8 as W,BufferViewVec3u16 as $,BufferViewVec2f as Q,BufferViewInt16 as Z,BufferViewUint32 as J,BufferViewUint16 as X,BufferViewVec2i16 as Y}from"../../../geometry/support/buffer/BufferView.js";import K from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as ee}from"../../../support/elevationInfoUtils.js";import{addNormals as te}from"./IntegratedMeshNormals.js";import{LayerView3D as ie}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as se}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as re,removeLayerViewFromWasm as oe,getLyr3DWasm as ne}from"./Lyr3DWasm.js";import{toWasmModification as ae}from"./SceneLayerWorkerHandle.js";import{LayerElevationProvider as le}from"./i3s/LayerElevationProvider.js";import{IntegratedMesh3DTilesLayerView3DSymbol as ce}from"./support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{primTypeConversion as de,alphaModeConversion as he,faceCullingConversion as ue,wrapModeConversion as me,lyr3DTypeToByteSize as pe}from"./support/lyr3dTypeConversions.js";import{Tiles3DMeshIntersectionHandler as fe}from"./support/Tiles3DMeshIntersectionHandler.js";import{Frustum as be}from"../state/Frustum.js";import{ElevationRange as ye}from"../support/ElevationRange.js";import{toBoundingRect as ge}from"../support/extentUtils.js";import{Obb as _e,compute as ve}from"../support/orientedBoundingBox.js";import{glLayout as we}from"../support/buffer/glUtil.js";import{VertexBufferLayoutCreationParameters as xe,createVertexBufferLayout as Te,ComponentGeometryParameters as je,SourceGeometry as Ce}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as Me}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as Re}from"../webgl-engine/core/material/RenderTexture.js";import{Attribute as Ee}from"../webgl-engine/lib/Attribute.js";import{ManagedTexture as Oe}from"../webgl-engine/lib/ManagedTexture.js";import{compressAndTransformNormals as Ue}from"../webgl-engine/lib/Normals.js";import{advancedMRRFactors as Ve}from"../webgl-engine/materials/pbrUtils.js";import Se from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as Ae,isInEffectiveScaleRange as He,validateScaleRange as Pe}from"../../support/layerViewUtils.js";import{PromiseQueue as Le}from"../../support/PromiseQueue.js";import{TaskPriority as ke}from"../../support/Scheduler.js";import{TextureCompressionTracker as Ie}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as De}from"../../../webscene/support/AlphaCutoff.js";var Fe;let Be=class extends(ie(Se)){static{Fe=ce}constructor(e){super(e),this[Fe]=!0,this.type="integrated-mesh-3dtiles",this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this.drapeTargetType=1,this._replacesTerrain=!1,this._isUsedAsGroundLayer=!1,this._applySSAO=!has("disable-feature:im-ssao"),this._imShading=!!has("enable-feature:im-shading"),this._imVertexNormals=!!has("enable-feature:im-vertex-normals"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._loadedObjects=new Set,this._compressionTracker=new Ie,this._createRenderableQueue=new Le,this._dbgFlags=new Set;const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e)),this._replacesTerrain=e.layer.replacesTerrain,this._isUsedAsGroundLayer=e.layer.isUsedAsGroundLayer,this._frameTask=t.scheduler.registerTask(ke.TILES3D,this),this._frustum=new be(e.view.renderCoordsHelper)}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{r(t);const i=this.layer.queryElevationCallback;this.layer=e,this.layer.queryElevationCallback=i}):null}canRecycleWith(e){return e.url===this.layer.url&&"integrated-mesh-3dtiles"===e.type&&e.replacesTerrain===this._replacesTerrain&&e.isUsedAsGroundLayer===this._isUsedAsGroundLayer}initialize(){this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),o),!this._canProjectWithoutEngine())throw Ae("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=re(this).then(t=>{this._wasmLayerId=t,this._intersectionHandler=new fe(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged()),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),o),this._updatingHandles.add(()=>e.state.contentCamera,()=>this._cameraChanged(),o),this._elevationProvider=new le({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler});const i=this._replacesTerrain?0:1;e.elevationProvider.register(i,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([n(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),a(()=>this.fullOpacity,()=>this._opacityChange()),n(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),o)])});this.layer.queryElevationCallback=(e,t)=>this._wasm.queryElevation(this,e,t),this.addResolvingPromise(t)}destroy(){this._dbg(2,"Tiles3DLayerView3D destroy() called"),oe(this),this.layer.queryElevationCallback=null,this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler.destroy(),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>this.forEachComponentObject(t=>e(t.obb))),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._loadedObjects.clear(),this._usedMemory=0,this._cacheMemory=0,this._memCache.destroy(),this._createRenderableQueue.destroy(),this.notifyChange("readyToRun"),this._frameTask.remove(),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=s(this._visibleGeometryChangedSchedulerHandle)}get fullOpacity(){return this.layer.replacesTerrain?this.view.map.ground.opacity:1}get hasModifications(){return this._modifications&&this._modifications.length>0}_opacityChange(){const{fullOpacity:e}=this;this.forEachComponentObject(t=>this._collection.updateObjectOpacity(t,e))}_cameraChanged(){const e=this._frustum;e.update(this.view.state.contentCamera);const t=this._visibleObjects;let i=!1;this._loadedObjects.forEach(s=>{const r=s.obb?.intersectsFrustum(e)??!1;r!==s.isVisible&&(s.isVisible=r,r?t.add(s):t.delete(s),s.componentObjects.forEach(e=>this._collection.setObjectVisibility(e,r)),i||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(r,s.elevationRange))}),i&&this._setVisibleElevationRangeDirty()}intersect(e,t,i,s){this._intersectionHandler.intersect(e,t,i,s,null,!1)}get ready(){return!this.layer.replacesTerrain||!!this._wasm?.isTerrainReady}_modificationsChanged(){const e=this.layer.spatialReference,t=ae(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=D();this._layerClippingArea=ge(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=l(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this.layer.replacesTerrain),this.forEachComponentObject(t=>t.updateMaterial({slicePlaneEnabled:e}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,ee(e))}get _wasm(){return ne(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get visibleAtCurrentScale(){return this.layer.isUsedAsGroundLayer||He(this.layer.effectiveScaleRange,this.view.scale)}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&(this.layer.isUsedAsGroundLayer||Pe(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,i=0,s=0,r=0,o=0;return this._lyrHandleToObjects.forEach(n=>{n.isLoaded?(e+=n.textureMemoryUsage,t+=n.vboMemoryUsage,r++):(i+=n.textureMemoryUsage,s+=n.vboMemoryUsage,o++)}),new se(this.usedMemory,r,o,Ne(t),Ne(e),Ne(s),Ne(i))}_canProjectWithoutEngine(){if(this.view.state.isLocal){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return ee(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new ye(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new ye;0===this._visibleObjects.size?e.setElevationRangeValues(0,0):(e.setElevationRangeValues(1/0,-1/0),this._forEachRelevantVisibleTile(t=>e.expandElevationRange(t.elevationRange)),e.minElevation===1/0&&e.setElevationRangeValues(0,0));const t=this._get("visibleElevationRange");return t&&t.minElevation===e.minElevation&&t.maxElevation===e.maxElevation?t:e}_setVisibleElevationRangeDirty(){this.notifyChange("visibleElevationRange")}_forEachRelevantVisibleTile(e){const{view:t}=this,{spatialReference:i}=t,s=i.isWGS84||i.isWebMercator||B(i)||S(i)||A(i);if(this.view.state.isGlobal||!s)return this.forEachVisibleTile(e);const r=H(i).radius,{eye:o,viewForward:n,near:a}=t.state.camera,l=g(j(),n),c=500,d=Math.max(o[2],c),h=d+r,u=Math.sqrt(h**2-r**2),m=Math.abs(Math.atan2(u,r))*r,p=d>.5*r?.5*Math.PI*r:m,f=j();this.forEachVisibleTile(t=>{const{mbsRadius:i,mbsCenter:s}=t;if(i<0)return;_(f,s,o);const r=v(f,l);Math.abs(r)<p&&r+i>a&&r-i<p&&e(t)})}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachTile(e){for(const t of this._loadedObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const{componentObjects:i}of e)for(const e of i)t(e)}isUpdating(){const e=this._wasm;return this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}get readyToRun(){return!!this._frameTask?.readyToRun||this._createRenderableQueue.readyToRun}runTask(e){this._frameTask.processQueue(e),this._createRenderableQueue.runTask(e),this.notifyChange("readyToRun")}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");return this._createRenderable(e)}async _createRenderable(e){if(this.destroyed){const e=`IntegratedMesh3DTilesLayerView3D[${this.layer?.title}]: createRenderable called on destroyed instance`;throw this._dbg(3,e),new Error(e)}const{meshData:t}=e;if(null==t.data)throw new Error("meshData.data undefined");if("string"==typeof t.desc&&(t.desc=JSON.parse(t.desc)),null==t.desc)throw new Error("meshData.desc undefined");const i=t.desc,s=t.data.buffer,r={textureMemoryUsage:0},o=new Map,n=i.prims.length,a=i.materials,l=e=>this._getTexture(e,t,o,r);let c;try{c=this._createPrimitiveTextureBundles(n,i,a,l)}catch(u){throw o.forEach(e=>this._stage.removeTexture(e)),u}const d=new Array,h=new ye;try{const t=this._createRenderableQueue.push(()=>this._createRenderableMain(i,s,n,a,c,o,d,h),null);this.notifyChange("readyToRun");const l=await t;if(this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable aborted due to destroyed instance");if(await Promise.all(c.map(e=>e.materialPromise)),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable aborted due to destroyed instance");for(const e of l.textureMemoryUsageEvaluators)r.textureMemoryUsage+=e();const u=new ze(e.handle,d,l.textures,l.cpuMemoryUsage,l.vboMemoryUsage,r.textureMemoryUsage,l.tileObb,e.stableNodeId,e.nodeDepth,h);this._lyrHandleToObjects.set(e.handle,u),this._memCache.put(Qe(u.handle),u);const{usedMemory:m}=u;return this._cacheMemory+=m,{memUsageBytes:m}}catch(u){throw c.forEach(e=>e.cleanup()),d.forEach(e=>this._collection.destroyObject(e)),o.forEach(e=>this._stage.removeTexture(e)),u}}_createPrimitiveTextureBundles(e,t,i,s){const r=new Array;try{for(let o=0;o<e;o++){const e=t.prims[o],n=i&&null!=e.materialId?i[e.materialId]:null;let a=Promise.resolve(Ze),l=null,c=null,d=null,h=null,u=null;if(n){const e="Pbr"===n.lightingModel;l=s(n.baseColorTex),c=e?s(n.metalTex):null,d=e?s(n.emissiveTex):null,h=e?s(n.occlusionTex):null,u=e?s(n.normalTex):null;const t=[l,c,d,h,u].map(e=>e?.loadPromise??null);a=Promise.all(t)}r.push(new Je(a,l,c,d,h,u))}}catch(o){throw r.forEach(e=>e.cleanup()),o}return r}_createRenderableMain(e,t,i,s,r,o,n,a){let l=0;const c=C(...e.origin),d=this.view.basemapTerrain.spatialReference,m=this.view.state.isGlobal;let y=f;if(m){const e=b();L(P,c,e,d),y=h(p(),e)}if(null==e.obb)throw new Error("meshData.desc.obb undefined");const g=$e(e.obb),_=m?H(this.view.spatialReference).radius:0,v=y!==f,x=v?u(p(),y)??f:f,T=j(),E=new Array;for(let h=0;h<i;h++){const i=e.prims[h],o=r[h];this._dbgFlags.has(2)&&this._dbg(2,JSON.stringify(i));if(null==de[i.ptype]){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+i.ptype+"). Skipping primitive."),o.cleanup();continue}const u=s&&null!=i.materialId?s[i.materialId]:null,p=null!=u?u.lightingModel:"Unlit",{positionView:f,positionAttr:b,normalsView:C,normalsAttr:S,colorAttr:A,texCoord0Attr:H,indicesView:P}=this.getBufferViews(i,t,y);if(null==b||null==f||null==P){o.cleanup();continue}const L=f.count,D=(e,t)=>!e||e.data.length/e.size===L||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);if(!D(H,"numTexcoord")||!D(A,"numColors")||!D(S,"normals")){o.cleanup();continue}const F=new xe(null!=A,null!=C,H?1:0),B=Te(F),G=B.createBuffer(L);Ke(new Ye(c,_,m,y),{texCoord0Attr:H,colorAttr:A,normalsAttr:S},G,{positionView:f,tileObb:g,obbHalfSizeAccumulator:T,elevationRange:a});const z=g?.clone()??We(b,c),N=new Uint32Array([0,P.typedBuffer.length]),q=we(B),W=this._imVertexNormals,$=te(new Uint8Array(G.buffer),P.typedBuffer,q,W,W?x:void 0),Q=new je(q,this._imShading?2:0,F.textureCoordinateType,v?1:0,0),Z=new Ce({interleavedVertexData:$.data,vertexCount:$.data.byteLength/q[0].stride,indexData:$.indices},{positions:f.typedBuffer,indices:P.typedBuffer},N,Q),J=this.view.renderSpatialReference,X=j(),Y=[1,1,1];k(c,J,Y,d)||this._dbg(3,"Unsupported coordinate system for IM overlay"),I(c,J,X,d);let K=V,ee=De,ie=null,se=null,re=null,oe=null,ne=null,ae=1,le=!1,ce=2,me=!1,pe=R(0,0,0);const fe=M(Ve),be="Pbr"===p;if(u&&(ie=o.baseColorTexture,ne=o.metallicRoughnessTexture,se=o.emissionTexture,oe=o.occlusionTexture,re=o.normalTexture,K=O(u.baseColorFactor),ee=u.alphaCutoff??De,be&&(w(fe,u.metallicFactor,u.roughnessFactor,0),u.emissiveFactor&&(pe=u.emissiveFactor)),ae=he[u.alphaMode],le=u.isDoubleSided,ce=ue[u.faceCulling??"NotSet"],me=this.layer.replacesTerrain),this.destroyed){const e="Trying to add object to destroyed layer view";throw this._dbg(3,`${e} !== numPos. Skipping primitive.`),new Error(e)}ie||this._dbg(3,"No colour texture 1");const ye=this._collection.createObject({toMapSpace:U(X[0],X[1],Y[0],Y[1]),transform:new Me(c,x),obb:z,geometry:Z,elevationAlignable:!1},{isIntegratedMesh:!0,baseColor:K,textureAlphaCutoff:ee,mrrFactors:fe,baseColorTexture:ie,metallicRoughnessTexture:ne,normalTexture:re,occlusionTexture:oe,emissionTexture:se,hasParametersFromSource:!1,sphereDepthInterpolate:this.layer.hasGoogleUrl,alphaDiscardMode:ae,doubleSided:le,cullFace:ce,isGround:me,emissiveBaseColor:pe,usePBR:be,slicePlaneEnabled:this.slicePlaneEnabled,opacity:this.fullOpacity,polygonOffset:0,ellipsoidMode:1,applySSAO:this._applySSAO});E.push(()=>{let e=ie?.texture?.usedMemory??0;return be&&(e+=(ne?.texture?.usedMemory??0)+(se?.texture?.usedMemory??0)+(oe?.texture?.usedMemory??0)+(re?.texture?.usedMemory??0)),e}),l+=this._collection.getObjectGPUMemoryUsage(ye),n.push(ye)}const S=Array.from(o.values()),{fullExtent:A}=this.layer;A?.hasZ&&A.zmax&&A.zmin&&(a.minElevation=Math.max(a.minElevation,A.zmin),a.maxElevation=Math.min(a.maxElevation,A.zmax));const D=n.reduceRight((e,t)=>e+t.intersectionGeometry.usedMemory,0);return new Xe(l,g,E,S,D)}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t?(t.isLoaded?(this._loadedObjects.delete(t),this._visibleObjects.delete(t),this._intersectionHandler.removeTile(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e)):this._dbg(3,`freeRendedrable on non-existent renderable ${e}`)}freeObject(e){const t=Qe(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){if(this.destroyed||this.destroying)return;const s=this._frustum,r=new Array;let o=!1,n=!1;for(let a=0;a<i;++a){if(!t[a])continue;const i=e[a],l=this._lyrHandleToObjects.get(i);if(l){if(l.isLoaded){this._dbg(3,`Already loaded object marked loaded again ${l.stableNodeId}`);continue}o=!0,l.isLoaded=!0,this._loadedObjects.add(l),this._intersectionHandler.addTile(l),this._usedMemory+=l.usedMemory,this._cacheMemory-=l.usedMemory;const e=l.obb?.intersectsFrustum(s)??!0;l.isVisible=e,e&&(this._visibleObjects.add(l),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(e,l.elevationRange)),e&&l.obb&&r.push(l.obb),l.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(Qe(i))}else this._dbg(3,`Tried to mark Non existent object ${i} as loaded`)}for(let a=0;a<i;++a){const i=e[a];if(t[a])continue;const s=this._lyrHandleToObjects.get(i);if(s){if(!s.isLoaded){this._dbg(3,`Tried to unload not-loaded object ${s.stableNodeId}`);continue}const e=s.isVisible;this._visibleObjects.delete(s),s.isVisible=!1,s.isLoaded=!1,this._loadedObjects.delete(s),this._intersectionHandler.removeTile(s),e&&(this._visibleGeometryChanged(),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(!1,s.elevationRange)),this._usedMemory-=s.usedMemory,this._cacheMemory+=s.usedMemory,e&&s.obb&&r.push(s.obb),s.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,!1)}),this._memCache.put(Qe(i),s)}else this._dbg(3,`Tried to mark Non existent object ${i} as not loaded`)}o&&this._visibleGeometryChanged(),this._elevationProvider.notifyObjectsChanged(r),n&&this._setVisibleElevationRangeDirty()}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_isVisibileElevationRangeModifiedByChangedTileVisbility(e,t){const{visibleElevationRange:i}=this,{minElevation:s,maxElevation:r}=t;return e?s<i.minElevation||r>i.maxElevation:s===i.minElevation||r===i.maxElevation}_getTexture(e,t,i,s){const r=e&&t.desc?.images?.[e.imageId];if(!r||!t.data?.buffer)return null;const o=i.get(r)??this._createTexture(e,t,i,s);return o?new Re(this._stage.renderView.textures,o.id):null}_createTexture(e,t,i,s){const r=e&&t.desc?.images?.[e.imageId];if(!r||!t.data?.buffer)return null;const o=this._stage,{renderView:n}=o,a=n.renderingContext.parameters.maxMaxAnisotropy,l=!!r.mipCount||a>1,c=me[e.wrapMode??"None"];let d=r.alpha?6408:6407;const h=new Uint8Array(t.data.buffer,r.data.byteOffset,r.data.byteCount);let u=null,m=null,p=null;switch(r.format){case"Raw":"R8"===r.pixelFormat?(u=h,d=6403,m=""):"Rgb8"===r.pixelFormat?(u=h,d=6407,m=""):"Rgba8"===r.pixelFormat&&(u=h,d=6408,m="");break;case"Dxt1":u=h,d=6407,m="image/vnd-ms.dds";break;case"Dxt5":u=h,d=6408,m="image/vnd-ms.dds";break;case"Basis":u=h,d=6407,m="image/ktx2";break;case"Png":m="image/png",p=document.createElement("img");break;case"Jpeg":m="image/jpeg",p=document.createElement("img");break;case"Etc2":m="image/ktx",p=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(p&&m){const e=new Blob([h],{type:m});p.src=URL.createObjectURL(e),u=p}if(u&&null!=m){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker,compressionCallback:e=>{e&&e>0&&(s.textureMemoryUsage-=e)}}:void 0,t=new Oe(u,{mipmap:l,maxAnisotropy:a,encoding:m,wrap:c,pixelFormat:d,compressionOptions:e,noUnpackFlip:!0,width:r.mip0Width,height:r.mip0Height});return this._stage.addTexture(t),i.set(r,t),t}return null}getBufferViews(e,t,i){let s,r,o,n,a,l,c,d=null;for(let u=0;u<e.atrbs.length;u++){const c=e.atrbs[u],{view:m}=c,p=void 0,f=m.byteOffset+m.byteCount,b=m.byteCount/pe[m.type],y=F(b);try{switch(c.sem){case"Position":3!==m.ncomp||"F32"!==m.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+m+")"):(s=new q(t,m.byteOffset,p,f),r=new Ee(s.typedBuffer,y,3));break;case"Normal":if(3!==m.ncomp||"F32"!==m.type)this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+m+")");else{const e=new q(t,m.byteOffset,p,f),s=Ue(e.typedBuffer,i);a=new Z(s.buffer),l=new Ee(a.typedBuffer,y,2)}break;case"TexCoord":2!==m.ncomp||"F32"!==m.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+m+")"):void 0===n&&(n=new Ee(new Q(t,m.byteOffset,p,f).typedBuffer,y,2));break;case"Color":4===m.ncomp?("F32"===m.type&&(d=new G(t,m.byteOffset,p,f)),"U8"===m.type&&(d=new z(t,m.byteOffset,p,f)),"U16"===m.type&&(d=new N(t,m.byteOffset,p,f))):3===m.ncomp&&("F32"===m.type&&(d=new q(t,m.byteOffset,p,f)),"U8"===m.type&&(d=new W(t,m.byteOffset,p,f)),"U16"===m.type&&(d=new $(t,m.byteOffset,p,f))),null==d?this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+m+")"):o=new Ee(d.typedBuffer,y,m.ncomp);break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+c.sem+"). Skipping vertex attribute.")}}catch(h){this._dbg(2,"Error Creating buffer ("+h+"). Skipping vertex attribute.")}}if(e.index){const i=e.index.view,s=void 0,r=i.byteOffset+i.byteCount;switch(e.index.view.type){case"U16":c=new X(t,i.byteOffset,s,r);break;case"U32":c=new J(t,i.byteOffset,s,r);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==c&&null!=s){const e=s.count;c=c=e<65535?new X(new Uint16Array(e).buffer):new J(new Uint32Array(e).buffer);for(let t=0;t<e;t++)c.set(t,t)}return{positionView:s,positionAttr:r,colorAttr:o,texCoord0Attr:n,indicesView:c,normalsView:a,normalsAttr:l}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>{this._modifications=e.filter(e=>!(this.layer.isUsedAsGroundLayer&&"replace"!==e.type)).toArray(),this._modifications.length<e.length&&t.getLogger(this).info("Ground layers only support replace modifications. Other modification types have been ignored.")},o),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([c()],Be.prototype,"fullOpacity",null),e([c({readOnly:!0})],Be.prototype,"ready",null),e([c({type:[K]})],Be.prototype,"_modifications",void 0),e([c()],Be.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([c()],Be.prototype,"layer",void 0),e([c({readOnly:!0})],Be.prototype,"visibleAtCurrentScale",null),e([c({readOnly:!0})],Be.prototype,"_collection",null),e([c()],Be.prototype,"elevationOffset",null),e([c({readOnly:!0})],Be.prototype,"visibleElevationRange",null),Be=e([d("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Be);const Ge=Be;class ze{constructor(e,t,i,s,r,o,n,a,l,c){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=s,this.vboMemoryUsage=r,this.textureMemoryUsage=o,this.obb=n,this.stableNodeId=a,this.nodeDepth=l,this.elevationRange=c,this.bvhIntersectionGeneration=0,this.isLoaded=!1,this.isVisible=!1;const d=j();n?.getCenter(d),this._obbCenterX=d[0],this._obbCenterY=d[1],this._obbCenterZ=d[2];const h=n?.radius??-1;this._obbRadius=h,this._obbRadiusSquared=h*h;const u=n?.halfSize;this._obbShortestHalfsize=u?Math.min(u[0],u[1],u[2]):0,this._mbsCenter=n?M(n.center):E}get usedMemory(){return this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get mbsRadius(){return this._obbRadius}get mbsCenter(){return this._mbsCenter}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const{_obbCenterX:i,_obbCenterY:s,_obbCenterZ:r}=this,o=i-e[0],n=s-e[1],a=r-e[2],l=o*t[0]+n*t[1]+a*t[2];return o*o+n*n+a*a-l*l<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){const t=this._obbRadius;if(t<0)return!0;const i=e.center,s=e.radius,r=t+s,o=this._obbCenterX-i[0];if(o>r)return!1;const n=this._obbCenterY-i[1];if(n>r)return!1;const a=this._obbCenterZ-i[2];if(a>r)return!1;const l=o*o+n*n+a*a;if(l>r*r)return!1;if(l<=(this._obbShortestHalfsize+s)**2)return!0;return Math.sqrt(l)+t<=s||(this.obb?.intersectSphere(e)??!0)}}function Ne(e){return Math.round(e/1048.576)/1e3}const qe=j();function We(e,t){const i=ve(e);return T(qe,i.center,t),i.center=qe,i}function $e(e){return new _e(e.center,e.halfSize,y(...e.quaternion))}function Qe(e){return`${e}`}const Ze=new Array;class Je{constructor(e,t,i,s,r,o){this.materialPromise=e,this.baseColorTexture=t,this.metallicRoughnessTexture=i,this.emissionTexture=s,this.occlusionTexture=r,this.normalTexture=o}cleanup(){this.baseColorTexture?.dispose(),this.metallicRoughnessTexture?.dispose(),this.emissionTexture?.dispose(),this.occlusionTexture?.dispose(),this.normalTexture?.dispose()}}class Xe{constructor(e,t,i,s,r){this.vboMemoryUsage=e,this.tileObb=t,this.textureMemoryUsageEvaluators=i,this.textures=s,this.cpuMemoryUsage=r}}class Ye{constructor(e,t,i,s){this.origin=e,this.ellipsoidRadius=t,this.isGlobal=i,this.ecefRotation=s}}function Ke(e,t,i,s){const{origin:r,ellipsoidRadius:o,isGlobal:n,ecefRotation:a}=e,{texCoord0Attr:l,colorAttr:c,normalsAttr:d}=t,{positionView:h,tileObb:u,obbHalfSizeAccumulator:p,elevationRange:b}=s,y=i.getField("position",q),g=y.typedBuffer,_=y.typedBufferStride,v=l?.data,w=null!=l?i.getField("uv0",Q):null,T=w?.typedBuffer,j=w?.typedBufferStride??0,C=c?.data,M=c?.size??0,R=null!=c?i.getField("color",z):null,O=R?.typedBuffer,U=R?.typedBufferStride??0,V=d?.data,S=null!=d?i.getField("normalCompressed",Y):null,A=S?.typedBuffer,H=S?.typedBufferStride??0,P=null!=u?m(tt,u.quaternionConjugate):f,L=x(et,u?.center??E,P),k=P[0],I=P[1],D=P[2],F=P[3],B=P[4],G=P[5],N=P[6],W=P[7],$=P[8],Z=L[0],J=L[1],X=L[2],K=a[0],ee=a[1],te=a[2],ie=a[3],se=a[4],re=a[5],oe=a[6],ne=a[7],ae=a[8],le=a!==f,ce=r[0],de=r[1],he=r[2],ue=h.count,me=h.typedBufferStride,pe=h.typedBuffer,fe=null!=T&&null!=v,be=null!=O&&null!=C&&(3===M||4===M),ye=4===M,ge=null!=A&&null!=V,_e=null!=p;let ve=_e?p[0]:0,we=_e?p[1]:0,xe=_e?p[2]:0;for(let m=0;m<ue;++m){const e=m*me,t=pe[e],i=pe[e+1],s=pe[e+2],r=t+ce,a=i+de,l=s+he,c=n?Math.sqrt(r*r+a*a+l*l)-o:l;if(b.expandElevationRangeValues(c,c),_e){const e=Math.abs(r*k+a*F+l*N-Z),t=Math.abs(r*I+a*B+l*W-J),i=Math.abs(r*D+a*G+l*$-X);ve=Math.max(ve,e),we=Math.max(we,t),xe=Math.max(xe,i)}const d=m*_;if(le){const r=t*K+i*ie+s*oe,o=t*ee+i*se+s*ne,n=t*te+i*re+s*ae;pe[e]=r,pe[e+1]=o,pe[e+2]=n,g[d]=r,g[d+1]=o,g[d+2]=n}else g[d]=t,g[d+1]=i,g[d+2]=s;if(fe){const e=2*m,t=m*j;T[t]=v[e],T[t+1]=v[e+1]}if(be){const e=m*U;if(ye){const t=4*m;O[e]=C[t],O[e+1]=C[t+1],O[e+2]=C[t+2],O[e+3]=C[t+3]}else{const t=3*m;O[e]=C[t],O[e+1]=C[t+1],O[e+2]=C[t+2],O[e+3]=255}}if(ge){const e=2*m,t=m*H;A[t]=V[e],A[t+1]=V[e+1]}}u&&_e&&(p[0]=ve,p[1]=we,p[2]=xe,u.setHalfSize(ve,we,xe))}const et=j(),tt=p();export{Ge as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as i,removeMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{initial as o,watch as n,when as a}from"../../../core/reactiveUtils.js";import{schedule as l}from"../../../core/scheduling.js";import{property as c,subclass as d}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as h,invert as u,fromQuat as m}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as p,IDENTITY as f}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as b}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as y}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{normalize as g,sub as _,dot as v,set as w,transformMat3 as x,add as T}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as j,freeze as C,clone as M,fromValues as O,ZEROS as E}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{clone as R,fromValues as V,ONES as S}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMoon as U,isMars as H,getReferenceEllipsoid as k,SphericalECEFSpatialReferenceLike as A}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as L}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as P}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as D}from"../../../geometry/projection/projectVectorToVector.js";import{create as I}from"../../../geometry/support/aaBoundingRect.js";import{isCGCS2000 as B}from"../../../geometry/support/spatialReferenceUtils.js";import{BufferViewVec4f as F,BufferViewVec4u8 as G,BufferViewVec4u16 as N,BufferViewVec3f as z,BufferViewVec3u8 as q,BufferViewVec3u16 as W,BufferViewVec2f as $,BufferViewUint32 as Z,BufferViewUint16 as J,BufferViewVec2i16 as X}from"../../../geometry/support/buffer/BufferView.js";import Y from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as Q}from"../../../support/elevationInfoUtils.js";import{computeNormals as K,writeAddedVerticesAndNormals as ee,NormalData as te}from"./IntegratedMeshNormals.js";import{LayerView3D as ie}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as se}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as re,removeLayerViewFromWasm as oe,getLyr3DWasm as ne}from"./Lyr3DWasm.js";import{toWasmModification as ae}from"./SceneLayerWorkerHandle.js";import{LayerElevationProvider as le}from"./i3s/LayerElevationProvider.js";import{IntegratedMesh3DTilesLayerView3DSymbol as ce}from"./support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{primTypeConversion as de,alphaModeConversion as he,faceCullingConversion as ue,wrapModeConversion as me}from"./support/lyr3dTypeConversions.js";import{Tiles3DMeshIntersectionHandler as pe}from"./support/Tiles3DMeshIntersectionHandler.js";import{Frustum as fe}from"../state/Frustum.js";import{ElevationRange as be}from"../support/ElevationRange.js";import{toBoundingRect as ye}from"../support/extentUtils.js";import{Obb as ge,compute as _e}from"../support/orientedBoundingBox.js";import{glLayout as ve}from"../support/buffer/glUtil.js";import{VertexBufferLayoutCreationParameters as we,createVertexBufferLayout as xe,ComponentGeometryParameters as Te,SourceGeometry as je}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as Ce}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as Me}from"../webgl-engine/core/material/RenderTexture.js";import{Vertices as Oe}from"../webgl-engine/lib/Attribute.js";import{ManagedTexture as Ee}from"../webgl-engine/lib/ManagedTexture.js";import{compressNormals as Re}from"../webgl-engine/lib/Normals.js";import{advancedMRRFactors as Ve}from"../webgl-engine/materials/pbrUtils.js";import Se from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as Ue,isInEffectiveScaleRange as He,validateScaleRange as ke}from"../../support/layerViewUtils.js";import{TaskPriority as Ae}from"../../support/Scheduler.js";import{TextureCompressionTracker as Le}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as Pe}from"../../../webscene/support/AlphaCutoff.js";var De;let Ie=class extends(ie(Se)){static{De=ce}constructor(e){super(e),this[De]=!0,this.type="integrated-mesh-3dtiles",this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this.drapeTargetType=1,this._replacesTerrain=!1,this._isUsedAsGroundLayer=!1,this._applySSAO=!has("disable-feature:im-ssao"),this._imShading=!!has("enable-feature:im-shading"),this._imVertexNormals=!!has("enable-feature:im-vertex-normals"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._loadedObjects=new Set,this._compressionTracker=new Le,this._dbgFlags=new Set;const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e)),this._replacesTerrain=e.layer.replacesTerrain,this._isUsedAsGroundLayer=e.layer.isUsedAsGroundLayer,this._frameTask=t.scheduler.registerTask(Ae.TILES3D,this),this._frustum=new fe(e.view.renderCoordsHelper)}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{r(t);const i=this.layer.queryElevationCallback;this.layer=e,this.layer.queryElevationCallback=i}):null}canRecycleWith(e){return e.url===this.layer.url&&"integrated-mesh-3dtiles"===e.type&&e.replacesTerrain===this._replacesTerrain&&e.isUsedAsGroundLayer===this._isUsedAsGroundLayer}initialize(){this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),o),!this._canProjectWithoutEngine())throw Ue("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=re(this).then(t=>{this._wasmLayerId=t,this._intersectionHandler=new pe(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged()),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),o),this._updatingHandles.add(()=>e.state.contentCamera,()=>this._cameraChanged(),o),this._elevationProvider=new le({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler});const i=this._replacesTerrain?0:1;e.elevationProvider.register(i,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([n(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),a(()=>this.fullOpacity,()=>this._opacityChange()),n(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),o)])});this.layer.queryElevationCallback=(e,t)=>this._wasm.queryElevation(this,e,t),this.addResolvingPromise(t)}destroy(){this._dbg(2,"Tiles3DLayerView3D destroy() called"),oe(this),this.layer.queryElevationCallback=null,this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler.destroy(),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>this.forEachComponentObject(t=>e(t.obb))),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._loadedObjects.clear(),this._usedMemory=0,this._cacheMemory=0,this._memCache.destroy(),this._frameTask.remove(),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=s(this._visibleGeometryChangedSchedulerHandle)}get fullOpacity(){return this.layer.replacesTerrain?this.view.map.ground.opacity:1}get hasModifications(){return this._modifications&&this._modifications.length>0}_opacityChange(){const{fullOpacity:e}=this;this.forEachComponentObject(t=>this._collection.updateObjectOpacity(t,e))}_cameraChanged(){const e=this._frustum;e.update(this.view.state.contentCamera);const t=this._visibleObjects;let i=!1;this._loadedObjects.forEach(s=>{const r=s.obb?.intersectsFrustum(e)??!1;r!==s.isVisible&&(s.isVisible=r,r?t.add(s):t.delete(s),s.componentObjects.forEach(e=>this._collection.setObjectVisibility(e,r)),i||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(r,s.elevationRange))}),i&&this._setVisibleElevationRangeDirty()}intersect(e,t,i,s){this._intersectionHandler.intersect(e,t,i,s,null,!1)}get ready(){return!this.layer.replacesTerrain||!!this._wasm?.isTerrainReady}_modificationsChanged(){const e=this.layer.spatialReference,t=ae(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=I();this._layerClippingArea=ye(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=l(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this.layer.replacesTerrain),this.forEachComponentObject(t=>t.updateMaterial({slicePlaneEnabled:e}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,Q(e))}get _wasm(){return ne(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get visibleAtCurrentScale(){return this.layer.isUsedAsGroundLayer||He(this.layer.effectiveScaleRange,this.view.scale)}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&(this.layer.isUsedAsGroundLayer||ke(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,i=0,s=0,r=0,o=0;return this._lyrHandleToObjects.forEach(n=>{n.isLoaded?(e+=n.textureMemoryUsage,t+=n.vboMemoryUsage,r++):(i+=n.textureMemoryUsage,s+=n.vboMemoryUsage,o++)}),new se(this.usedMemory,r,o,Ge(t),Ge(e),Ge(s),Ge(i))}_canProjectWithoutEngine(){if(this.view.state.isLocal){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return Q(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new be(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new be;0===this._visibleObjects.size?e.setElevationRangeValues(0,0):(e.setElevationRangeValues(1/0,-1/0),this._forEachRelevantVisibleTile(t=>e.expandElevationRange(t.elevationRange)),e.minElevation===1/0&&e.setElevationRangeValues(0,0));const t=this._get("visibleElevationRange");return t&&t.minElevation===e.minElevation&&t.maxElevation===e.maxElevation?t:e}_setVisibleElevationRangeDirty(){this.notifyChange("visibleElevationRange")}_forEachRelevantVisibleTile(e){const{view:t}=this,{spatialReference:i}=t,s=i.isWGS84||i.isWebMercator||B(i)||U(i)||H(i);if(this.view.state.isGlobal||!s)return this.forEachVisibleTile(e);const r=k(i).radius,{eye:o,viewForward:n,near:a}=t.state.camera,l=g(j(),n),c=500,d=Math.max(o[2],c),h=d+r,u=Math.sqrt(h**2-r**2),m=Math.abs(Math.atan2(u,r))*r,p=d>.5*r?.5*Math.PI*r:m,f=j();this.forEachVisibleTile(t=>{const{mbsRadius:i,mbsCenter:s}=t;if(i<0)return;_(f,s,o);const r=v(f,l);Math.abs(r)<p&&r+i>a&&r-i<p&&e(t)})}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachTile(e){for(const t of this._loadedObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const{componentObjects:i}of e)for(const e of i)t(e)}isUpdating(){const e=this._wasm;return this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}get readyToRun(){return!!this._frameTask?.readyToRun}runTask(e){this._frameTask.processQueue(e)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");return this._createRenderable(e)}async _createRenderable(e){if(this.destroyed){const e=`IntegratedMesh3DTilesLayerView3D[${this.layer?.title}]: createRenderable called on destroyed instance`;throw this._dbg(3,e),new Error(e)}const{meshData:t}=e;if(!Qe(t))throw new Error("meshData not valid");const i=new Map;let s;try{s=this._createPrimitiveTextureBundles(t,i)}catch(n){throw i.forEach(e=>this._stage.removeTexture(e)),n}const r=new Array,o=new be;try{const n=await this._frameTask.schedule(()=>this._createRenderableMain(t,s,i,r,o),null);if(this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable aborted due to destroyed instance");if(await Promise.all(s.map(e=>e.materialPromise)),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable aborted due to destroyed instance");const a=r.reduce((e,t)=>{const{baseColorTexture:i,metallicRoughnessTexture:s,emissionTexture:r,occlusionTexture:o,normalTexture:n}=t.renderable.material.parameters;return e+(i?.texture?.usedMemory??0)+(s?.texture?.usedMemory??0)+(r?.texture?.usedMemory??0)+(o?.texture?.usedMemory??0)+(n?.texture?.usedMemory??0)},0),l=new Fe(e.handle,r,n.textures,n.cpuMemoryUsage,n.vboMemoryUsage,a,n.tileObb,e.stableNodeId,e.nodeDepth,o);this._lyrHandleToObjects.set(e.handle,l),this._memCache.put(We(l.handle),l);const{usedMemory:c}=l;return this._cacheMemory+=c,{memUsageBytes:c}}catch(n){throw s.forEach(e=>e.cleanup()),r.forEach(e=>this._collection.destroyObject(e)),i.forEach(e=>this._stage.removeTexture(e)),n}}_createPrimitiveTextureBundles(e,t){const i=new Array,s=e.desc.prims.length;try{for(let r=0;r<s;r++){const s=e.desc.prims[r],o=e.desc.materials&&null!=s.materialId?e.desc.materials[s.materialId]:null;let n=Promise.resolve($e),a=null,l=null,c=null,d=null,h=null;if(o){const i="Pbr"===o.lightingModel;a=this._getTexture(o.baseColorTex,e,t),l=i?this._getTexture(o.metalTex,e,t):null,c=i?this._getTexture(o.emissiveTex,e,t):null,d=i?this._getTexture(o.occlusionTex,e,t):null,h=i?this._getTexture(o.normalTex,e,t):null;const s=[a,l,c,d,h].map(e=>e?.loadPromise??null);n=Promise.all(s)}i.push(new Ze(n,a,l,c,d,h))}}catch(r){throw i.forEach(e=>e.cleanup()),r}return i}_createRenderableMain(e,t,i,s,r){let o=0;const n=e.desc,a=e.data.buffer,l=n.prims.length,c=n.materials,d=C(...n.origin),m=this.view.basemapTerrain.spatialReference,y=this.view.state.isGlobal;let g=f;if(y){const e=b();L(A,d,e,m),g=h(p(),e)}if(null==n.obb)throw new Error("meshData.desc.obb undefined");const _=qe(n.obb),v=y?k(this.view.spatialReference).radius:0,x=g!==f,T=x?u(p(),g)??f:f,E=j();for(let h=0;h<l;h++){const e=n.prims[h],i=t[h];this._dbgFlags.has(2)&&this._dbg(2,JSON.stringify(e));if(null==de[e.ptype]){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive."),i.cleanup();continue}const l=c&&null!=e.materialId?c[e.materialId]:null,u=null!=l?l.lightingModel:"Unlit",{positionView:p,normalsData:f,colorView:b,texCoord0Data:C,indicesView:U}=this.getBufferViews(e,a);if(null==p||null==U){i.cleanup();continue}const H=p.count,k=(e,t)=>null==e||e===H||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);if(!k(null!=C?C.length/2:void 0,"numTexcoord")||!k(b?.count,"numColors")||!k(f?.length,"normals")){i.cleanup();continue}const A=null!=b,L=null!=f||this._imVertexNormals,I=new we(A,L,C?1:0),B=this._imVertexNormals&&null==f?K(U.typedBuffer,p.typedBuffer,p.typedBufferStride):null,F=B?.outputVertexCount??H,G=xe(I),N=G.createBuffer(F),z=B?G.fields.get("normalCompressed"):null;if(null!=B&&null==z)throw new Error("computeNormals requires a reserved NORMALCOMPRESSED attribute in layout");const q=B?B.packedNormals:f;Ye(new Xe(d,v,y,g),{texCoord0Data:C,colorView:b,packedNormalsSource:q},N,{positionView:p,tileObb:_,obbHalfSizeAccumulator:E,elevationRange:r});const W=_?.clone()??ze(new Oe(p.typedBuffer,3),d);let $;if(null!=B){const e=G.stride/4,t=z.offset/4,i=H,s=new Uint32Array(N.buffer);ee(s,e,t,s,e,i,F,B.appendedVertexToOriginal,B.packedNormals),$=new te(N.buffer,B.indices)}else $=new te(N.buffer,U.typedBuffer);const Z=ve(G),J=new Uint32Array([0,U.typedBuffer.length]),X=new Te(Z,this._imShading?2:0,I.textureCoordinateType,x?1:0,0),Y=new je({interleavedVertexData:$.data,vertexCount:$.data.byteLength/Z[0].stride,indexData:$.indices},{positions:p.typedBuffer,indices:U.typedBuffer},J,X),Q=this.view.renderSpatialReference,ie=j(),se=[1,1,1];P(d,Q,se,m)||this._dbg(3,"Unsupported coordinate system for IM overlay"),D(d,Q,ie,m);let re=S,oe=Pe,ne=null,ae=null,le=null,ce=null,me=null,pe=1,fe=!1,be=2,ye=!1,ge=O(0,0,0);const _e=M(Ve),Me="Pbr"===u;if(l&&(ne=i.baseColorTexture,me=i.metallicRoughnessTexture,ae=i.emissionTexture,ce=i.occlusionTexture,le=i.normalTexture,re=R(l.baseColorFactor),oe=l.alphaCutoff??Pe,Me&&(w(_e,l.metallicFactor,l.roughnessFactor,0),l.emissiveFactor&&(ge=l.emissiveFactor)),pe=he[l.alphaMode],fe=l.isDoubleSided,be=ue[l.faceCulling??"NotSet"],ye=this.layer.replacesTerrain),this.destroyed){const e="Trying to add object to destroyed layer view";throw this._dbg(3,`${e} !== numPos. Skipping primitive.`),new Error(e)}ne||this._dbg(3,"No colour texture 1");const Ee=this._collection.createObject({toMapSpace:V(ie[0],ie[1],se[0],se[1]),transform:new Ce(d,T),obb:W,geometry:Y,elevationAlignable:!1},{isIntegratedMesh:!0,baseColor:re,textureAlphaCutoff:oe,mrrFactors:_e,baseColorTexture:ne,metallicRoughnessTexture:me,normalTexture:le,occlusionTexture:ce,emissionTexture:ae,hasParametersFromSource:!1,sphereDepthInterpolate:this.layer.hasGoogleUrl,alphaDiscardMode:pe,doubleSided:fe,cullFace:be,isGround:ye,emissiveBaseColor:ge,usePBR:Me,slicePlaneEnabled:this.slicePlaneEnabled,opacity:this.fullOpacity,polygonOffset:0,ellipsoidMode:1,applySSAO:this._applySSAO});o+=this._collection.getObjectGPUMemoryUsage(Ee),s.push(Ee)}const U=Array.from(i.values()),{fullExtent:H}=this.layer;H?.hasZ&&H.zmax&&H.zmin&&(r.minElevation=Math.max(r.minElevation,H.zmin),r.maxElevation=Math.min(r.maxElevation,H.zmax));const I=s.reduce((e,t)=>e+t.intersectionGeometry.usedMemory,0);return new Je(o,_,U,I)}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t?(t.isLoaded?(this._loadedObjects.delete(t),this._visibleObjects.delete(t),this._intersectionHandler.removeTile(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e)):this._dbg(3,`freeRendedrable on non-existent renderable ${e}`)}freeObject(e){const t=We(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){if(this.destroyed||this.destroying)return;const s=this._frustum,r=new Array;let o=!1,n=!1;for(let a=0;a<i;++a){if(!t[a])continue;const i=e[a],l=this._lyrHandleToObjects.get(i);if(l){if(l.isLoaded){this._dbg(3,`Already loaded object marked loaded again ${l.stableNodeId}`);continue}o=!0,l.isLoaded=!0,this._loadedObjects.add(l),this._intersectionHandler.addTile(l),this._usedMemory+=l.usedMemory,this._cacheMemory-=l.usedMemory;const e=l.obb?.intersectsFrustum(s)??!0;l.isVisible=e,e&&(this._visibleObjects.add(l),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(e,l.elevationRange)),e&&l.obb&&r.push(l.obb),l.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(We(i))}else this._dbg(3,`Tried to mark Non existent object ${i} as loaded`)}for(let a=0;a<i;++a){const i=e[a];if(t[a])continue;const s=this._lyrHandleToObjects.get(i);if(s){if(!s.isLoaded){this._dbg(3,`Tried to unload not-loaded object ${s.stableNodeId}`);continue}const e=s.isVisible;this._visibleObjects.delete(s),s.isVisible=!1,s.isLoaded=!1,this._loadedObjects.delete(s),this._intersectionHandler.removeTile(s),e&&(this._visibleGeometryChanged(),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(!1,s.elevationRange)),this._usedMemory-=s.usedMemory,this._cacheMemory+=s.usedMemory,e&&s.obb&&r.push(s.obb),s.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,!1)}),this._memCache.put(We(i),s)}else this._dbg(3,`Tried to mark Non existent object ${i} as not loaded`)}o&&this._visibleGeometryChanged(),this._elevationProvider.notifyObjectsChanged(r),n&&this._setVisibleElevationRangeDirty()}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_isVisibileElevationRangeModifiedByChangedTileVisbility(e,t){const{visibleElevationRange:i}=this,{minElevation:s,maxElevation:r}=t;return e?s<i.minElevation||r>i.maxElevation:s===i.minElevation||r===i.maxElevation}_getTexture(e,t,i){const s=e&&t.desc?.images?.[e.imageId];if(!s||!t.data?.buffer)return null;const r=i.get(s)??this._createTexture(e,t,i);return r?new Me(this._stage.renderView.textures,r.id):null}_createTexture(e,t,i){const s=e&&t.desc?.images?.[e.imageId];if(!s||!t.data?.buffer)return null;const r=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,o=!!s.mipCount||r>1,n=me[e.wrapMode??"None"];let a=s.alpha?6408:6407;const l=new Uint8Array(t.data.buffer,s.data.byteOffset,s.data.byteCount);let c=null,d=null,h=null;switch(s.format){case"Raw":"R8"===s.pixelFormat?(c=l,a=6403,d=""):"Rgb8"===s.pixelFormat?(c=l,a=6407,d=""):"Rgba8"===s.pixelFormat&&(c=l,a=6408,d="");break;case"Dxt1":c=l,a=6407,d="image/vnd-ms.dds";break;case"Dxt5":c=l,a=6408,d="image/vnd-ms.dds";break;case"Basis":c=l,a=6407,d="image/ktx2";break;case"Png":d="image/png",h=document.createElement("img");break;case"Jpeg":d="image/jpeg",h=document.createElement("img");break;case"Etc2":d="image/ktx",h=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(h&&d){const e=new Blob([l],{type:d});h.src=URL.createObjectURL(e),c=h}if(c&&null!=d){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker}:void 0,t=new Ee(c,{mipmap:o,maxAnisotropy:r,encoding:d,wrap:n,pixelFormat:a,compressionOptions:e,noUnpackFlip:!0,width:s.mip0Width,height:s.mip0Height});return this._stage.addTexture(t),i.set(s,t),t}return null}getBufferViews(e,t){let i,s,r,o,n;for(let l=0;l<e.atrbs.length;l++){const n=e.atrbs[l],{view:c}=n,d=void 0,h=c.byteOffset+c.byteCount;try{switch(n.sem){case"Position":3!==c.ncomp||"F32"!==c.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+c+")"):i=new z(t,c.byteOffset,d,h);break;case"Normal":if(3!==c.ncomp||"F32"!==c.type)this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+c+")");else{const e=new z(t,c.byteOffset,d,h);o=new Uint32Array(e.count),Re(e.typedBuffer,new Int16Array(o.buffer,o.byteOffset,2*o.length))}break;case"TexCoord":2!==c.ncomp||"F32"!==c.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+c+")"):void 0===r&&(r=new $(t,c.byteOffset,d,h).typedBuffer);break;case"Color":4===c.ncomp?("F32"===c.type&&(s=new F(t,c.byteOffset,d,h)),"U8"===c.type&&(s=new G(t,c.byteOffset,d,h)),"U16"===c.type&&(s=new N(t,c.byteOffset,d,h))):3===c.ncomp&&("F32"===c.type&&(s=new z(t,c.byteOffset,d,h)),"U8"===c.type&&(s=new q(t,c.byteOffset,d,h)),"U16"===c.type&&(s=new W(t,c.byteOffset,d,h))),null==s&&this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+c+")");break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+n.sem+"). Skipping vertex attribute.")}}catch(a){this._dbg(2,"Error Creating buffer ("+a+"). Skipping vertex attribute.")}}if(e.index){const i=e.index.view,s=void 0,r=i.byteOffset+i.byteCount;switch(e.index.view.type){case"U16":n=new J(t,i.byteOffset,s,r);break;case"U32":n=new Z(t,i.byteOffset,s,r);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==n&&null!=i){const e=i.count;n=n=e<65535?new J(new Uint16Array(e).buffer):new Z(new Uint32Array(e).buffer);for(let t=0;t<e;t++)n.set(t,t)}return{positionView:i,colorView:s,texCoord0Data:r,indicesView:n,normalsData:o}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>{this._modifications=e.filter(e=>!(this.layer.isUsedAsGroundLayer&&"replace"!==e.type)).toArray(),this._modifications.length<e.length&&t.getLogger(this).info("Ground layers only support replace modifications. Other modification types have been ignored.")},o),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([c()],Ie.prototype,"fullOpacity",null),e([c({readOnly:!0})],Ie.prototype,"ready",null),e([c({type:[Y]})],Ie.prototype,"_modifications",void 0),e([c()],Ie.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([c()],Ie.prototype,"layer",void 0),e([c({readOnly:!0})],Ie.prototype,"visibleAtCurrentScale",null),e([c({readOnly:!0})],Ie.prototype,"_collection",null),e([c()],Ie.prototype,"elevationOffset",null),e([c({readOnly:!0})],Ie.prototype,"visibleElevationRange",null),Ie=e([d("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Ie);const Be=Ie;class Fe{constructor(e,t,i,s,r,o,n,a,l,c){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=s,this.vboMemoryUsage=r,this.textureMemoryUsage=o,this.obb=n,this.stableNodeId=a,this.nodeDepth=l,this.elevationRange=c,this.bvhIntersectionGeneration=0,this.isLoaded=!1,this.isVisible=!1;const d=j();n?.getCenter(d),this._obbCenterX=d[0],this._obbCenterY=d[1],this._obbCenterZ=d[2];const h=n?.radius??-1;this._obbRadius=h,this._obbRadiusSquared=h*h;const u=n?.halfSize;this._obbShortestHalfsize=u?Math.min(u[0],u[1],u[2]):0,this._mbsCenter=n?M(n.center):E}get usedMemory(){return this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get mbsRadius(){return this._obbRadius}get mbsCenter(){return this._mbsCenter}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const{_obbCenterX:i,_obbCenterY:s,_obbCenterZ:r}=this,o=i-e[0],n=s-e[1],a=r-e[2],l=o*t[0]+n*t[1]+a*t[2];return o*o+n*n+a*a-l*l<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){const t=this._obbRadius;if(t<0)return!0;const i=e.center,s=e.radius,r=t+s,o=this._obbCenterX-i[0];if(o>r)return!1;const n=this._obbCenterY-i[1];if(n>r)return!1;const a=this._obbCenterZ-i[2];if(a>r)return!1;const l=o*o+n*n+a*a;if(l>r*r)return!1;if(l<=(this._obbShortestHalfsize+s)**2)return!0;return Math.sqrt(l)+t<=s||(this.obb?.intersectSphere(e)??!0)}}function Ge(e){return Math.round(e/1048.576)/1e3}const Ne=j();function ze(e,t){const i=_e(e);return T(Ne,i.center,t),i.center=Ne,i}function qe(e){return new ge(e.center,e.halfSize,y(...e.quaternion))}function We(e){return`${e}`}const $e=new Array;class Ze{constructor(e,t,i,s,r,o){this.materialPromise=e,this.baseColorTexture=t,this.metallicRoughnessTexture=i,this.emissionTexture=s,this.occlusionTexture=r,this.normalTexture=o}cleanup(){this.baseColorTexture?.dispose(),this.metallicRoughnessTexture?.dispose(),this.emissionTexture?.dispose(),this.occlusionTexture?.dispose(),this.normalTexture?.dispose()}}class Je{constructor(e,t,i,s){this.vboMemoryUsage=e,this.tileObb=t,this.textures=i,this.cpuMemoryUsage=s}}class Xe{constructor(e,t,i,s){this.origin=e,this.ellipsoidRadius=t,this.isGlobal=i,this.ecefRotation=s}}function Ye(e,t,i,s){const{origin:r,ellipsoidRadius:o,isGlobal:n,ecefRotation:a}=e,{texCoord0Data:l,colorView:c,packedNormalsSource:d}=t,{positionView:h,tileObb:u,obbHalfSizeAccumulator:p,elevationRange:b}=s,y=i.getField("position",z),g=y.typedBuffer,_=y.typedBufferStride,v=null!=l?i.getField("uv0",$):null,w=v?.typedBuffer,T=v?.typedBufferStride??0,j=c?.typedBuffer,C=c?.elementCount??0,M=null!=c?i.getField("color",G):null,O=M?.typedBuffer,R=M?.typedBufferStride??0,V=null!=d?i.getField("normalCompressed",X):null,S=null!=V?new Uint32Array(V.typedBuffer.buffer,V.typedBuffer.byteOffset,V.typedBuffer.length/2):null,U=null!=V?V.typedBufferStride/2:0,H=null!=u?m(et,u.quaternionConjugate):f,k=x(Ke,u?.center??E,H),A=H[0],L=H[1],P=H[2],D=H[3],I=H[4],B=H[5],F=H[6],N=H[7],q=H[8],W=k[0],Z=k[1],J=k[2],Y=a[0],Q=a[1],K=a[2],ee=a[3],te=a[4],ie=a[5],se=a[6],re=a[7],oe=a[8],ne=a!==f,ae=r[0],le=r[1],ce=r[2],de=h.count,he=h.typedBufferStride,ue=h.typedBuffer,me=null!=w&&null!=l,pe=null!=O&&null!=j&&(3===C||4===C),fe=4===C,be=null!=S&&null!=d,ye=null!=p;let ge=ye?p[0]:0,_e=ye?p[1]:0,ve=ye?p[2]:0;for(let m=0;m<de;++m){const e=m*he,t=ue[e],i=ue[e+1],s=ue[e+2],r=t+ae,a=i+le,c=s+ce,h=n?Math.sqrt(r*r+a*a+c*c)-o:c;if(b.expandElevationRangeValues(h,h),ye){const e=Math.abs(r*A+a*D+c*F-W),t=Math.abs(r*L+a*I+c*N-Z),i=Math.abs(r*P+a*B+c*q-J);ge=Math.max(ge,e),_e=Math.max(_e,t),ve=Math.max(ve,i)}const u=m*_;if(ne){const r=t*Y+i*ee+s*se,o=t*Q+i*te+s*re,n=t*K+i*ie+s*oe;ue[e]=r,ue[e+1]=o,ue[e+2]=n,g[u]=r,g[u+1]=o,g[u+2]=n}else g[u]=t,g[u+1]=i,g[u+2]=s;if(me){const e=2*m,t=m*T;w[t]=l[e],w[t+1]=l[e+1]}if(pe){const e=m*R;if(fe){const t=4*m;O[e]=j[t],O[e+1]=j[t+1],O[e+2]=j[t+2],O[e+3]=j[t+3]}else{const t=3*m;O[e]=j[t],O[e+1]=j[t+1],O[e+2]=j[t+2],O[e+3]=255}}be&&(S[m*U]=d[m])}u&&ye&&(p[0]=ge,p[1]=_e,p[2]=ve,u.setHalfSize(ge,_e,ve))}function Qe(e){return null!=e.data&&("string"==typeof e.desc&&(e.desc=JSON.parse(e.desc)),null!=e.desc)}const Ke=j(),et=p();export{Be as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{initial as t}from"../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import{I3SMeshView3D as o}from"./I3SMeshView3D.js";import{LayerView3D as s}from"./LayerView3D.js";import{ElevationRange as a}from"../support/ElevationRange.js";import{updatingProgress as l}from"../support/updatingProperties.js";import n from"../../layers/LayerView.js";import{isInEffectiveScaleRange as p}from"../../support/layerViewUtils.js";const d=.2;let c=class extends(o(s(n))){constructor(){super(...arguments),this.type="integrated-mesh-3d",this.visibleElevationRange=new a(1/0,-1/0),this._elevationContext=1,this._supportsLabeling=!1,this._applySSAO=!has("disable-feature:im-ssao"),this.drapeTargetType=1}get
|
|
2
|
+
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{initial as t}from"../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import{I3SMeshView3D as o}from"./I3SMeshView3D.js";import{LayerView3D as s}from"./LayerView3D.js";import{ElevationRange as a}from"../support/ElevationRange.js";import{updatingProgress as l}from"../support/updatingProperties.js";import n from"../../layers/LayerView.js";import{isInEffectiveScaleRange as p}from"../../support/layerViewUtils.js";const d=.2;let c=class extends(o(s(n))){constructor(){super(...arguments),this.type="integrated-mesh-3d",this.visibleElevationRange=new a(1/0,-1/0),this._elevationContext=1,this._supportsLabeling=!1,this._applySSAO=!has("disable-feature:im-ssao"),this.drapeTargetType=1}get updatingProgressValue(){return this._controller?.updatingProgress??0}get lodFactor(){return this.view?.qualitySettings?.sceneService?.meshLoDFactor??1}get progressiveLoadFactor(){return this.lodFactor>=1?d:1}get visibleAtCurrentScale(){return p(this.layer.effectiveScaleRange,this.view.scale)}get fullOpacity(){return 1}get layerPopupEnabledAndHasTemplate(){return!1}initialize(){this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),t),this.view.overlayManager.registerDrapeTarget(this)}destroy(){this.view.overlayManager.unregisterDrapeTarget(this)}get ready(){return this.layer.loaded}_createLayerGraphic(){}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>this._modifications=e.toArray(),t),"modifications")}};e([r()],c.prototype,"layer",void 0),e([r(l)],c.prototype,"updatingProgress",void 0),e([r()],c.prototype,"updatingProgressValue",null),e([r()],c.prototype,"lodFactor",null),e([r({readOnly:!0})],c.prototype,"progressiveLoadFactor",null),e([r({readOnly:!0})],c.prototype,"visibleAtCurrentScale",null),e([r({readOnly:!0})],c.prototype,"visibleElevationRange",void 0),e([r()],c.prototype,"fullOpacity",null),c=e([i("esri.views.3d.layers.IntegratedMeshLayerView3D")],c);const u=c;export{u as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{transformMat3 as e}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as t}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{decompressNormal as r,compressNormal as n}from"../webgl-engine/lib/Normals.js";import{DataType as o}from"../../webgl/enums.js";import{VertexElementDescriptor as s}from"../../webgl/VertexElementDescriptor.js";class c{constructor(e,t){this.data=e,this.indices=t}}function f(e,t,r,n,o){return!n||r.some(({name:e})=>"normal"===e||"normalCompressed"===e)?
|
|
2
|
+
import{transformMat3 as e}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as t}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{decompressNormal as r,compressNormal as n}from"../webgl-engine/lib/Normals.js";import{DataType as o}from"../../webgl/enums.js";import{VertexElementDescriptor as s}from"../../webgl/VertexElementDescriptor.js";class c{constructor(e,t){this.data=e,this.indices=t}}class a{constructor(e,t,r,n,o){this.indices=e,this.packedNormals=t,this.appendedVertexToOriginal=r,this.outputVertexCount=n,this.appendedVertexCount=o}}function f(e,t,r,n,o){return!n||r.some(({name:e})=>"normal"===e||"normalCompressed"===e)?i(e,t,r,o):l(e,t,r,o)}function i(o,s,a,f){const i=new c(o.slice().buffer,s);if(!f)return i;const l=a[0].stride,d=i.data.byteLength/l;for(const c of a)if("normalCompressed"===c.name){const{offset:o}=c,s=new Int16Array(i.data),a=t();for(let t=0;t<d;++t)r(a,s,t,l/2,o/2),e(a,a,f),n(s,t,a[0],a[1],a[2],l/2,o/2)}else if("normal"===c.name){const{offset:r}=c,n=new Float32Array(i.data),o=t();for(let t=0;t<d;++t){const s=(t*l+r)/4;o[0]=n[s],o[1]=n[s+1],o[2]=n[s+2],e(o,o,f),n[s]=o[0],n[s+1]=o[1],n[s+2]=o[2]}}return i}function l(e,t,r,n){const c=r[0].stride,a=c/4,f=new Float32Array(e.buffer,e.byteOffset,e.byteLength/4),i=e.byteLength/c,l=c+4;r.forEach(e=>e.stride=l),r.push(new s("normalCompressed",2,o.SHORT,c,l,!0));const m=d(t,f,a,n);return u(f,i,c,l,m)}function d(e,t,r,n){const o=e.length/3,s=t.length/r,{faceNormals:c,faceAreas:a,faceEdges:f,edgeFaces:i,vertexFaces:l,vertexFaceCountAndOffset:d}=w(t,r,s,e,o,n);return A(e,o,c,a,f,i),y(o,s,e,c,a,l,d)}function u(e,t,r,n,o){const s=r/4,a=n/4,f=o.outputVertexCount,i=new Float32Array(f*a),l=new Uint32Array(i.buffer),d=s,u=new Uint32Array(e.buffer,e.byteOffset,e.length);return m(l,a,d,u,s,t,o.packedNormals),h(l,a,d,u,s,t,f,o.appendedVertexToOriginal,o.packedNormals),new c(i.buffer,o.indices)}function m(e,t,r,n,o,s,c){for(let a=0;a<s;++a){const s=a*o,f=a*t;for(let t=0;t<o;++t)e[f+t]=n[s+t];e[f+r]=c[a]}}function h(e,t,r,n,o,s,c,a,f){for(let i=s;i<c;++i){const c=a[i-s]*o,l=i*t;for(let t=0;t<o;++t)e[l+t]=n[c+t];e[l+r]=f[i]}}function y(e,t,r,n,o,s,c){const f=3*e,i=new(f<256?Uint8Array:f<65536?Uint16Array:Uint32Array)(r);let l=t;const d=new(t<256?Uint8Array:t<65536?Uint16Array:Uint32Array)(f-t),u=new ArrayBuffer(4*f),m=new Int16Array(u),h=new Uint32Array(u);let y=0,w=0;const A=new Uint32Array(e);let g=0;const b=1-p;for(let a=0;a<t;++a){y=c[2*a+1],w=y+c[2*a];let e=a;for(;y<w;){{const t=s[--w],r=3*t,c=n[r],a=n[r+1],f=n[r+2];g=0,A[g++]=t;let i=y;for(;i<w;){const e=s[i],t=3*e;if(c*n[t]+a*n[t+1]+f*n[t+2]>b){A[g++]=e;const t=--w;if(i<t){s[i]=s[t];continue}}++i}let l=0,d=0,u=0;if(1===g)l=c,d=a,u=f;else{for(let t=0;t<g;++t){const e=A[t],r=o[e],s=3*e;l+=n[s]*r,d+=n[s+1]*r,u+=n[s+2]*r}const e=Math.sqrt(l*l+d*d+u*u)||1;l/=e,d/=e,u/=e}{const t=1/(Math.abs(l)+Math.abs(d)+Math.abs(u)),r=l*t,n=d*t;let o=r,s=n;u<=0&&(o=(r>=0?1:-1)*(1-Math.abs(n)),s=(n>=0?1:-1)*(1-Math.abs(r)));const c=2*e,a=Math.round(32767*o),f=Math.round(32767*s);m[c]=a<-32767?-32767:a>32767?32767:a,m[c+1]=f<-32767?-32767:f>32767?32767:f}}if(e!==a)for(let t=0;t<g;++t){const r=3*A[t];i[r]===a&&(i[r]=e),i[r+1]===a&&(i[r+1]=e),i[r+2]===a&&(i[r+2]=e)}if(y>=w)break;e=l++,d[e-t]=a}}return new a(i,h,d,l,l-t)}function w(e,t,r,n,o,s){const c=new Float32Array(3*o),a=new Float32Array(o),f=new Uint32Array(3*o),i=new Int32Array(2*(3*o)),l=3*o,d=new Uint32Array(l),u=new Uint32Array(2*r);for(let A=0;A<o;++A){const e=3*A;for(let t=0;t<3;++t){++u[2*n[e+t]]}}{let e=0;for(let t=0;t<r;++t){const r=2*t;u[r+1]=e;e+=u[r]}for(let t=0;t<o;++t){const e=3*t;for(let r=0;r<3;++r){d[u[2*n[e+r]+1]++]=t}}for(let t=0;t<r;++t)u[2*t+1]-=u[2*t]}let m=0;const h=new Uint32Array(2*l*2),y=new Uint32Array(2*r);for(let A=0;A<r;++A){const e=2*A,t=4*u[e+1];y[e]=t,y[e+1]=t}function w(e,t,r){const n=Math.min(e,t),o=Math.max(e,t),s=e<t?0:1,c=2*n,a=y[c],f=y[c+1];let l=-1;for(let i=a;i<f;i+=2)if(h[i]===o){l=h[i+1];break}return-1===l&&(l=m++,h[f]=o,h[f+1]=l,y[c+1]=f+2,i[2*l+(1-s)]=-1),i[2*l+s]=r,l}for(let A=0;A<n.length;A+=3){const r=n[A],o=r*t,i=e[o],l=e[o+1],d=e[o+2],u=n[A+1],m=u*t,h=e[m],y=e[m+1],g=e[m+2],b=n[A+2],x=b*t,p=i-h,$=l-y,U=d-g,v=i-e[x],F=l-e[x+1],M=d-e[x+2],E=$*M-U*F,C=U*v-p*M,O=p*F-$*v,I=Math.sqrt(E*E+C*C+O*O)||1,N=A/3;a[N]=.5*I;const V=1/I;if(s){const e=s[0]*E+s[3]*C+s[6]*O,t=s[1]*E+s[4]*C+s[7]*O,r=s[2]*E+s[5]*C+s[8]*O;c[3*N]=e*V,c[3*N+1]=t*V,c[3*N+2]=r*V}else c[3*N]=E*V,c[3*N+1]=C*V,c[3*N+2]=O*V;const j=w(r,u,N),k=w(u,b,N),q=w(b,r,N);f[3*N]=j,f[3*N+1]=k,f[3*N+2]=q}return{faceNormals:c,faceAreas:a,faceEdges:f,vertexFaces:d,vertexFaceCountAndOffset:u,edgeFaces:i}}function A(e,t,r,n,o,s){const c=new Uint8Array(t),a=new Uint32Array(t),f=new Uint32Array(3*t);let i=0;const l=new Uint32Array(t);let d=0;for(let u=0;u<e.length;u+=3){const e=u/3;if(1===c[e])continue;c[e]=1;const t=r[3*e],m=r[3*e+1],h=r[3*e+2];for(d=0,l[d++]=e,f[0]=o[3*e],f[1]=o[3*e+1],f[2]=o[3*e+2],i=3,a[e]=e+1;i>0;){const n=f[--i];for(let u=0;u<2;++u){const y=s[2*n+u];if(-1===y||a[y]===e+1)continue;a[y]=e+1;const w=r[3*y],A=r[3*y+1],g=r[3*y+2];if(Math.abs(1-(t*w+m*A+h*g))<x){l[d++]=y,c[y]=1;for(let e=0;e<3;++e){const t=o[3*y+e];t!==n&&(f[i++]=t)}}}}if(d>1){let e=0,t=0,o=0,s=0;for(let a=0;a<d;++a){const c=l[a],f=n[c];e+=f,t+=r[3*c]*f,o+=r[3*c+1]*f,s+=r[3*c+2]*f}const c=Math.sqrt(t*t+o*o+s*s)||1;t/=c,o/=c,s/=c;for(let a=0;a<d;++a){const c=l[a];r[3*c]=t,r[3*c+1]=o,r[3*c+2]=s,n[c]=e}}}}function g(e,t,r,n,o,s,c,a,f,i){const l=new Uint32Array(2*n);for(let d=0;d<r;++d){const e=f[2*d],t=f[2*d+1];for(let o=e;o<t;o+=2){const e=i[o],t=i[o+1];t>=n||t<0?console.error(`Invalid edge index ${t} for vertex ${d}`):e>=r||e<0||e<d?console.error(`Invalid vertex ${e} for edge ${t}`):(l[2*t]=d,l[2*t+1]=e)}}for(let d=0;d<t;++d){const t=[e[3*d],e[3*d+1],e[3*d+2]],r=[a[3*d],a[3*d+1],a[3*d+2]];for(const e of t){const t=o[2*e+1];b(s,t,t+o[2*e],1,d)||console.error(`Face ${d} not found in vertexFaces for vertex ${e}`)}for(const e of r){const t=c[2*e],r=c[2*e+1];-1!==t||-1!==r?d!==t&&d!==r&&console.error(`Edge ${e} of face ${d} does not list it as a face`):console.error(`Edge ${e} of face ${d} has no faces`)}}for(let d=0;d<n;++d){const e=c[2*d],t=c[2*d+1];if(-1===e&&-1===t){console.error(`Edge ${d} has no faces`);continue}for(const s of[e,t].filter(e=>-1!==e)){const e=a[3*s],t=a[3*s+1],r=a[3*s+2];d!==e&&d!==t&&d!==r&&console.error(`Edge ${d} not found in edgesPerFace for face ${s}`)}const r=l[2*d],n=l[2*d+1];r===n&&console.error(`Edge ${d} is degenerate with identical vertices ${r}`);const o=Math.min(r,n);b(i,f[2*o]+1,f[2*o+1],2,d)||console.error(`Edge ${d} not found in edgeMap for vertex ${o}`)}for(let d=0;d<r;++d){const r=o[2*d+1],n=o[2*d];for(let o=r;o<r+n;++o){const r=s[o];(r<0||r>=t)&&console.error(`Invalid face ${r} in vertexFaces for vertex ${d}`),b(e,3*r,3*r+3,1,d)||console.error(`Face ${r} in vertexFaces for vertex ${d} does not reference it in indices`)}}}function b(e,t,r,n,o){for(let s=t;s<r;s+=n)if(e[s]===o)return!0;return!1}const x=.04,p=.8;export{a as ComputedNormalData,c as NormalData,y as buildSmoothedIndexedNormalsData,w as calculateTopology,g as checkTopology,l as computeAndMaterializeNormals,d as computeNormals,A as mergeFaceNormals,i as packAndTransformNormals,f as processNormals,h as writeAddedVerticesAndNormals};
|