@arcgis/core 5.1.0-next.87 → 5.1.0-next.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Graphic.js +1 -1
- package/analysis/LineOfSightAnalysisObserver.d.ts +2 -2
- package/analysis/LineOfSightAnalysisTarget.d.ts +2 -2
- package/applications/Components/arcadeUtils.d.ts +23 -0
- package/applications/Components/arcadeUtils.js +2 -0
- package/arcade/validation/arcadeValidator.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/00e9e25269d5776f8645.js +1 -0
- package/assets/esri/core/workers/chunks/015fc0a17b17d69cc3bb.js +1 -0
- package/assets/esri/core/workers/chunks/0840e7dd62643c56ae9e.js +1 -0
- package/assets/esri/core/workers/chunks/0a6df243b18acae471be.js +1 -0
- package/assets/esri/core/workers/chunks/0cc4b3100a7a453bd058.js +1 -0
- package/assets/esri/core/workers/chunks/{b14c4c3f295970f731ab.js → 0e3dcf99382478181366.js} +1 -1
- package/assets/esri/core/workers/chunks/10cf6a70bf79f04a7208.js +1 -0
- package/assets/esri/core/workers/chunks/169ca3724053fc046d1b.js +1 -0
- package/assets/esri/core/workers/chunks/{aae40d70eb01249c1bab.js → 1e4e7111d43f01c149b3.js} +1 -1
- package/assets/esri/core/workers/chunks/206bdfd868a9ef88f3a8.js +1 -0
- package/assets/esri/core/workers/chunks/2343b1105bc4c1b4a086.js +1 -0
- package/assets/esri/core/workers/chunks/{2549a07f403447482f4e.js → 2dcfc4d7e76c922bcbf9.js} +1 -1
- package/assets/esri/core/workers/chunks/{f89b7b0ccfbd1e5f9a0f.js → 3092184350d66c79f610.js} +1 -1
- package/assets/esri/core/workers/chunks/{1ab66600579fa4232d7b.js → 3397eae416622c64e628.js} +1 -1
- package/assets/esri/core/workers/chunks/3469df5c4846b0cee012.js +1 -0
- package/assets/esri/core/workers/chunks/{26f804c92077c11c626d.js → 394812e19b6915d560b0.js} +1 -1
- package/assets/esri/core/workers/chunks/{b9e163f4a898e50cc854.js → 39d6032d79720935910d.js} +1 -1
- package/assets/esri/core/workers/chunks/3feec3d08424b94e1bcf.js +1 -0
- package/assets/esri/core/workers/chunks/{d05a7ce6c1d4b883ed4c.js → 41cbde4738ae4adf973d.js} +1 -1
- package/assets/esri/core/workers/chunks/{ce4dfc3a470230ddc9e4.js → 43f58604ba4a94a9167c.js} +1 -1
- package/assets/esri/core/workers/chunks/{ff57a071156d8a7e47be.js → 456d269e3982c437010a.js} +1 -1
- package/assets/esri/core/workers/chunks/46b16501db6681dc467b.js +1 -0
- package/assets/esri/core/workers/chunks/48549d3d7bf0154c0afa.js +1 -0
- package/assets/esri/core/workers/chunks/{a401d44a5b45c05072c2.js → 4b9b9e6136c11d5d7901.js} +1 -1
- package/assets/esri/core/workers/chunks/{fc6ca7ffb9f1b875059c.js → 51716e411fad624ac21c.js} +1 -1
- package/assets/esri/core/workers/chunks/5409369d0d637cb30257.js +1 -0
- package/assets/esri/core/workers/chunks/54c035cdc171998d0776.js +1 -0
- package/assets/esri/core/workers/chunks/{b23e677c33db6f9bac8a.js → 566f6319ded0634769e0.js} +1 -1
- package/assets/esri/core/workers/chunks/{defac06f9e2b43090677.js → 73af4c947e8151d411c1.js} +2 -2
- package/assets/esri/core/workers/chunks/752f4e0e2961fc315dca.js +1 -0
- package/assets/esri/core/workers/chunks/{01bd1b86ba899c6aa4c0.js → 75c09a2fa4c34b4844c5.js} +1 -1
- package/assets/esri/core/workers/chunks/7ba67f1d7831a5576a5a.js +1 -0
- package/assets/esri/core/workers/chunks/{b2983f521d8c96becd8a.js → 7ed5b669010db58845f8.js} +1 -1
- package/assets/esri/core/workers/chunks/{186bfde8c552e3b42302.js → 7ef51b0ebd560113ae7e.js} +1 -1
- package/assets/esri/core/workers/chunks/7f0f10946f05a09b5654.js +1 -0
- package/assets/esri/core/workers/chunks/81d761c837b7456ec99f.js +1 -0
- package/assets/esri/core/workers/chunks/83f1871d04c979fa23b7.js +1 -0
- package/assets/esri/core/workers/chunks/85da2987e17b6755a94e.js +1 -0
- package/assets/esri/core/workers/chunks/8a5a827ee557d9f9a66e.js +1 -0
- package/assets/esri/core/workers/chunks/{7185486c6dc28fc367a1.js → 90a8dfb03a437fe8a6e7.js} +1 -1
- package/assets/esri/core/workers/chunks/9c09097e390985bbac58.js +1 -0
- package/assets/esri/core/workers/chunks/{c9065cee85eb8dde6a42.js → a2159df718a7f2f59271.js} +1 -1
- package/assets/esri/core/workers/chunks/{fce2306a1b31c6680f90.js → a232d05c0a055f398c6e.js} +1 -1
- package/assets/esri/core/workers/chunks/a432219de6a873f88776.js +1 -0
- package/assets/esri/core/workers/chunks/a508104179e08f0f268c.js +2 -0
- package/assets/esri/core/workers/chunks/{455d08294e0f5c5509ff.js → a6b75576d598ec161cc4.js} +1 -1
- package/assets/esri/core/workers/chunks/{713ab619060bd5087479.js → adfa5c136c72c1e65770.js} +182 -157
- package/assets/esri/core/workers/chunks/{004af103a94d21cb4889.js → aefeb5a17bb481c95da3.js} +1 -1
- package/assets/esri/core/workers/chunks/b2662bfdbd1e3623ceb9.js +1 -0
- package/assets/esri/core/workers/chunks/b4bac22467e96be7a974.js +1 -0
- package/assets/esri/core/workers/chunks/{5166f204fd078dced5db.js → baea6f86b2dbe067940e.js} +1 -1
- package/assets/esri/core/workers/chunks/{164ee62f2211987ad850.js → bb8d596f15fd3a0d783a.js} +1 -1
- package/assets/esri/core/workers/chunks/bea2fd831d7a864e5995.js +596 -0
- package/assets/esri/core/workers/chunks/c3e89c7c7b677bd18557.js +1 -0
- package/assets/esri/core/workers/chunks/cb81d524f12edcadb9bb.js +1 -0
- package/assets/esri/core/workers/chunks/cc0f3b9b153a0c232afe.js +1 -0
- package/assets/esri/core/workers/chunks/cd0c232f4e3868d91a05.js +1 -0
- package/assets/esri/core/workers/chunks/{3cf77b7a61f78f9bcd62.js → ceff78c9e31e3572a082.js} +1 -1
- package/assets/esri/core/workers/chunks/{5cc38ac051d3d0557920.js → cfaa6e205bfc0c94a1b1.js} +1 -1
- package/assets/esri/core/workers/chunks/d5ad036d282df54b9ddc.js +1 -0
- package/assets/esri/core/workers/chunks/{475394218caaa4cd3e86.js → d7e7f3efd1d28617b808.js} +1 -1
- package/assets/esri/core/workers/chunks/{9bd713d96502ddc2ce25.js → d8ccc713c5ad93e7a0c3.js} +1 -1
- package/assets/esri/core/workers/chunks/{e66b9d00d02fc08cbb2d.js → da008d6a3afb30d18392.js} +1 -1
- package/assets/esri/core/workers/chunks/dde94664110ff231a52d.js +1 -0
- package/assets/esri/core/workers/chunks/de3e5d82502ee15b7eae.js +1 -0
- package/assets/esri/core/workers/chunks/e6fe8b5fbe95de01453b.js +1 -0
- package/assets/esri/core/workers/chunks/ee7e9bca57160694b3c4.js +1 -0
- package/assets/esri/core/workers/chunks/{f37e4ae0e9be80210db0.js → f2c11f54255fd506655e.js} +1 -1
- package/assets/esri/core/workers/chunks/f36345ebb9851ab92453.js +1 -0
- package/assets/esri/core/workers/chunks/{c503c79ba5761f7abbeb.js → fa869bfe4366f7f49cca.js} +1 -1
- package/assets/esri/core/workers/chunks/{d8de7fe49dba9ed589df.js → fade7b878a9498382bb2.js} +1 -1
- package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
- package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
- package/assets/esri/libs/text/pkg/bundle_bg.wasm +0 -0
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_ar.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_bg.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_bs.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_ca.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_cs.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_da.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_de.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_el.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_es.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_et.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_fi.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_fr.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_he.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_hr.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_hu.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_id.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_it.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_ja.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_ko.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_lt.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_lv.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_nl.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_no.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_pl.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_pt-BR.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_pt-PT.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_ro.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_ru.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_sk.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_sl.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_sr.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_sv.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_th.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_tr.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_uk.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_vi.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_zh-CN.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_zh-HK.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_zh-TW.json +1 -1
- package/chunks/ComponentShader.glsl.js +3 -3
- package/chunks/GlobalIllumination.glsl.js +25 -17
- package/chunks/GlowBlur.glsl.js +11 -8
- package/chunks/OITBlend.glsl.js +1 -1
- package/chunks/bundle2.js +1 -1
- package/chunks/index.js +1 -1
- package/config.js +1 -1
- package/core/has.js +1 -1
- package/interfaces.d.ts +7 -3
- package/kernel.js +1 -1
- package/layers/graphics/data/QueryEngineCapabilities.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/sources/OGCFeatureSource.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/support/SubtypeSublayer.js +1 -1
- package/layers/support/capabilities.js +1 -1
- package/layers/support/layerUtils.js +1 -1
- package/layers/support/serviceCapabilitiesUtils.js +1 -1
- package/networks/CircuitManager.d.ts +33 -25
- package/networks/CircuitManager.js +1 -1
- package/networks/support/typeUtils.d.ts +4 -1
- package/networks/support/typeUtils.js +1 -1
- package/package.json +2 -2
- package/renderers/ClassBreaksRenderer.js +1 -1
- package/renderers/UniqueValueRenderer.js +1 -1
- package/renderers/support/scaleDependentSymbolUtils.js +2 -0
- package/rest/networks/circuits/queryCircuits.js +1 -1
- package/rest/networks/circuits/support/QueryCircuitsParameters.d.ts +21 -15
- package/rest/networks/circuits/support/QueryCircuitsParameters.js +1 -1
- package/rest/query/operations/query.js +1 -1
- package/rest/support/Query.js +1 -1
- package/support/revision.js +1 -1
- package/third-party-notices.txt +19 -12
- package/views/2d/engine/webgl/GlyphSDFCreator.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightAuthoringStore.js +2 -0
- package/views/3d/analysis/LineOfSight/LineOfSightAuthoringUtils.js +2 -0
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightDrawToolRenderer.js +2 -0
- package/views/3d/analysis/LineOfSight/LineOfSightObserverPlugin.js +2 -0
- package/views/3d/analysis/LineOfSight/LineOfSightPlacementTool.js +2 -0
- package/views/3d/analysis/LineOfSight/LineOfSightRootPlugin.js +2 -0
- package/views/3d/analysis/LineOfSight/LineOfSightTargetPlugin.js +2 -0
- package/views/3d/analysis/LineOfSight/LineOfSightTool2.js +1 -1
- package/views/3d/analysis/LineOfSightAnalysisView3D.js +1 -1
- package/views/3d/input/handlers/KeyboardNavigation.js +1 -1
- package/views/3d/layers/FeatureLikeLayerViewBase3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/support/IntegratedMesh3DTilesVertexProcessing.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +22 -16
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceRayMarching.glsl.js +149 -0
- package/views/3d/webgl-engine/core/shaderLibrary/shading/WaterColor.glsl.js +2 -2
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizer.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/effects/glow/Glow.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFieldCreation.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBuffer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultBufferWriter.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/TextureBufferCache.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineLayouts.js +2 -0
- package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
- package/webmap/utils.js +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
- package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.d.ts +64 -0
- package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +2 -0
- package/widgets/BatchAttributeForm/inputs/BatchFormInputs.d.ts +3 -0
- package/widgets/BatchAttributeForm/inputs/BatchFormInputs.js +1 -1
- package/widgets/BatchAttributeForm/inputs/GroupInput.d.ts +2 -1
- 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 -2
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/assets/esri/core/workers/chunks/0c074c46d106ca4d3bad.js +0 -1
- package/assets/esri/core/workers/chunks/1f16bc8c02d8c4b2f693.js +0 -1
- package/assets/esri/core/workers/chunks/29878b52aa12b3815230.js +0 -1
- package/assets/esri/core/workers/chunks/2c916b93d8a6e6b9c0d7.js +0 -1
- package/assets/esri/core/workers/chunks/3e72bd6dbfc52d956c06.js +0 -1
- package/assets/esri/core/workers/chunks/3ea5a18b264628dc37f0.js +0 -1
- package/assets/esri/core/workers/chunks/41913575dd45c65d645e.js +0 -1
- package/assets/esri/core/workers/chunks/46e622857ba92a72a317.js +0 -1
- package/assets/esri/core/workers/chunks/49e8144effc299dfcd66.js +0 -1
- package/assets/esri/core/workers/chunks/4d0f793dee4ad919221b.js +0 -1
- package/assets/esri/core/workers/chunks/65ac73de5bb133c6bf89.js +0 -1
- package/assets/esri/core/workers/chunks/67ec1694d6e18b7c234c.js +0 -1
- package/assets/esri/core/workers/chunks/6e526c06825ecc6c99c0.js +0 -1
- package/assets/esri/core/workers/chunks/6f7aaba26773fe416ac2.js +0 -1
- package/assets/esri/core/workers/chunks/7acf82763aeba44049d0.js +0 -1
- package/assets/esri/core/workers/chunks/88eb1e4320c4ada01711.js +0 -1
- package/assets/esri/core/workers/chunks/8af9a78cf316581ea482.js +0 -1
- package/assets/esri/core/workers/chunks/96bba4d93a32ad34a1c8.js +0 -1
- package/assets/esri/core/workers/chunks/97719271a3e4c9f2b2c9.js +0 -1
- package/assets/esri/core/workers/chunks/9ea23cd4b2664c08b670.js +0 -1
- package/assets/esri/core/workers/chunks/a1a12552d34ea9eea130.js +0 -1
- package/assets/esri/core/workers/chunks/a429355534bf6cbd8304.js +0 -1
- package/assets/esri/core/workers/chunks/ac5999c88c27b49cd760.js +0 -1
- package/assets/esri/core/workers/chunks/b575292013bceef9b015.js +0 -1
- package/assets/esri/core/workers/chunks/bbc27d9285162696d089.js +0 -1
- package/assets/esri/core/workers/chunks/bc8a74da48b08309875f.js +0 -1
- package/assets/esri/core/workers/chunks/cd7159600ce132e32d04.js +0 -1
- package/assets/esri/core/workers/chunks/ce66c551b7083913eee5.js +0 -1
- package/assets/esri/core/workers/chunks/cf7acf5acb6d322fd996.js +0 -1
- package/assets/esri/core/workers/chunks/d00dddc3881fa29446e1.js +0 -1
- package/assets/esri/core/workers/chunks/d9c3f14eee4db7a7137b.js +0 -1
- package/assets/esri/core/workers/chunks/db3c484bfa607dec6050.js +0 -1
- package/assets/esri/core/workers/chunks/dcc719e15b2e0cce1f3b.js +0 -1
- package/assets/esri/core/workers/chunks/f43d628d47eec7d530c7.js +0 -1
- package/assets/esri/core/workers/chunks/f9fe3c9867b0bdb2aec6.js +0 -596
- package/assets/esri/core/workers/chunks/fae147d03ed723ab234d.js +0 -1
- package/assets/esri/core/workers/chunks/fcf51697c361e0075cc2.js +0 -1
- package/assets/esri/core/workers/chunks/fe30e61652716fcccf16.js +0 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceReflections.glsl.js +0 -132
- /package/assets/esri/core/workers/chunks/{defac06f9e2b43090677.js.LICENSE.txt → 73af4c947e8151d411c1.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{fe30e61652716fcccf16.js.LICENSE.txt → a508104179e08f0f268c.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
|
|
2
|
+
import{__decorate as t}from"tslib";import"../../../../core/has.js";import{onAbort as e}from"../../../../core/promiseUtils.js";import{watch as o,syncAndInitial as i,on as s}from"../../../../core/reactiveUtils.js";import{property as a,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{LineOfSightAuthoringStore as n}from"./LineOfSightAuthoringStore.js";import{LineOfSightPlacementTool as l}from"./LineOfSightPlacementTool.js";import{ExclusiveOperationManager as c}from"../../../analysis/ExclusiveOperationManager.js";import{AnalysisToolBase as p}from"../../../interactive/AnalysisToolBase.js";const h={ready:"ready",created:"created"};let m=class extends p{constructor(t){super(t),this._authoringStore=new n,this._operationManager=new c,this.analysisViewData=null,this.removeIncompleteOnCancel=!1,this._placementTool=new l({...t,authoringStore:this._authoringStore,parent:this})}get active(){return this._placementTool.active}get state(){return this._placementTool.active?this._placementTool.state:null!=this.analysis.observer?.position?h.created:h.ready}get cursor(){return this._placementTool.cursor}get updating(){return this._placementTool.updating}initialize(){this.view.tools.add(this._placementTool),this.addHandles(o(()=>this.editable,t=>{this.analysisViewData.editable=t},i))}destroy(){this._operationManager.destroy(),this._placementTool.stop(),this.view.tools.remove(this._placementTool),this._placementTool.destroy()}place(t){return this.analysisViewData.interactive=!0,this._operationManager.start("place",async(t,a)=>{const r=this.analysis.clone();let n=!1,l=!1;const c=()=>{l||(l=!0,this.stop(),a.aborted||!this.analysis.valid||this.analysis.equals(r)?t.reject():t.resolve({}))};t.handles.push(e(a,()=>this.stop()),s(()=>this._placementTool,"cancel",()=>c()),o(()=>this._placementTool.active,t=>{t?n=!0:n&&c()},i)),this.resetCreated(),this.continue()},t)}activate(){this.view.focus(),this.continue()}deactivate(){this.onDeactivate()}continue(){this._placementTool.continue()}stop(){this._placementTool.stop(),this.view.activeTool===this&&(this.view.activeTool=null)}resetCreated(){this._placementTool.resetCreated()}get testInfo(){}};t([a({constructOnly:!0})],m.prototype,"view",void 0),t([a({constructOnly:!0})],m.prototype,"analysis",void 0),t([a({constructOnly:!0})],m.prototype,"analysisViewData",void 0),t([a()],m.prototype,"active",null),t([a()],m.prototype,"state",null),t([a()],m.prototype,"cursor",null),t([a()],m.prototype,"updating",null),t([a()],m.prototype,"removeIncompleteOnCancel",void 0),m=t([r("esri.views.3d.analysis.LineOfSight.LineOfSightTool2")],m);export{m as LineOfSightTool2};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import i from"../../../core/Collection.js";import s from"../../../core/Error.js";import has from"../../../core/has.js";import{abortMaybe as e,destroyMaybe as o}from"../../../core/maybe.js";import{property as r,subclass as n}from"../../../core/accessorSupport/decorators.js";import{create as
|
|
2
|
+
import{__decorate as t}from"tslib";import i from"../../../core/Collection.js";import s from"../../../core/Error.js";import has from"../../../core/has.js";import{abortMaybe as e,destroyMaybe as o}from"../../../core/maybe.js";import{property as r,subclass as n}from"../../../core/accessorSupport/decorators.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import l from"./AnalysisView3D.js";import{LineOfSightController as p}from"./LineOfSight/LineOfSightController.js";import{LineOfSightTool as u}from"./LineOfSight/LineOfSightTool.js";import{LineOfSightTool2 as h}from"./LineOfSight/LineOfSightTool2.js";import{LineOfSightVisualization as y}from"./LineOfSight/LineOfSightVisualization.js";import{connectAnalysisViewToTool as c,removeAnalysisViewTool as g,startPlaceOperation as f}from"../../analysis/analysisViewUtils.js";function m(){return has("enable-feature:analysis-drawtool-line-of-sight")??!1}function d(){return m()?h:u}let v=class extends l{constructor(t){super(t),this.type="line-of-sight-view-3d",this.analysis=null,this.tool=null,this.computations=new i,this.cursorTarget=null,this.editable=!0,this.elevationAlignedObserver=null,this.observerEngineLocation=a(),this.userOperation=null}initialize(){const t=this.view,i=this.analysis;this._analysisController=new p({analysis:i,analysisViewData:this,view:t}),this._analysisVisualization=new y({analysis:i,analysisViewData:this,view:t,isDecoration:!this.parent}),this.addHandles([this._analysisController.on("result-changed",t=>{t.target!==this.cursorTarget&&this.emit("result-changed",t)}),c(this,d())])}destroy(){g(this),this.userOperation=e(this.userOperation),this._analysisController=o(this._analysisController),this._analysisVisualization=o(this._analysisVisualization)}get visible(){return super.visible}set visible(t){super.visible=t}get interactive(){return super.interactive}set interactive(t){super.interactive=t}get results(){return this.computations.map(t=>t.result)}get priority(){return this._analysisController.priority}set priority(t){this._analysisController.priority=t}get updating(){return null!=this._analysisController&&this._analysisController.updating||null!=this._analysisVisualization&&this._analysisVisualization.updating}place(t){if(m()){if(this.interactive=!0,null==this.tool||null==this.tool.place)throw new s("LineOfSightAnalysisView3D:place","LineOfSightTool with placement support is not available");return this.tool.place(t)}return f(this,{placementOptions:t})}getResultForTarget(t){return this.computations.find(i=>i.target===t)?.result}get testInfo(){}};t([r({readOnly:!0})],v.prototype,"type",void 0),t([r({constructOnly:!0,nonNullable:!0})],v.prototype,"analysis",void 0),t([r()],v.prototype,"tool",void 0),t([r({readOnly:!0})],v.prototype,"results",null),t([r()],v.prototype,"priority",null),t([r()],v.prototype,"computations",void 0),t([r()],v.prototype,"cursorTarget",void 0),t([r()],v.prototype,"editable",void 0),t([r()],v.prototype,"elevationAlignedObserver",void 0),t([r()],v.prototype,"observerEngineLocation",void 0),t([r()],v.prototype,"updating",null),t([r()],v.prototype,"userOperation",void 0),t([r()],v.prototype,"_analysisController",void 0),t([r()],v.prototype,"_analysisVisualization",void 0),v=t([n("esri.views.3d.analysis.LineOfSightAnalysisView3D")],v);const O=v;export{O as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{GamepadKeyboardController as t}from"../../state/controllers/GamepadKeyboardController.js";import{InputHandler as i}from"../../../input/InputHandler.js";import{onVisibilityChange as e}from"../../../input/VisibilityChange.js";class o extends i{constructor(t,i){super(!0),this._view=t,this._keyToDirection=new Map,this._keyToAction=new Map,this.
|
|
2
|
+
import{GamepadKeyboardController as t}from"../../state/controllers/GamepadKeyboardController.js";import{InputHandler as i}from"../../../input/InputHandler.js";import{onVisibilityChange as e}from"../../../input/VisibilityChange.js";class o extends i{constructor(t,i){super(!0),this._view=t,this._keyToDirection=new Map,this._keyToAction=new Map,this._stickyKeyTimeoutHandle=void 0,this._stickyKeyDuration=200,this._addKeysMapping(i),this.registerIncoming("key-down",null,t=>this._handleKeyDown(t)),this.registerIncoming("key-up",null,t=>this._handleKeyUp(t)),this.registerIncoming("blur",null,()=>this._handleStop()),this._visibilityHandle=e(t=>t?null:this._handleStop())}onUninstall(){this._visibilityHandle?.remove(),this._handleStop()}setStickyKeyDuration(t){this._stickyKeyDuration=t}_addKeysMapping(t){this._addKeyMapping(t.pan.left,0),this._addKeyMapping(t.pan.right,1),this._addKeyMapping(t.pan.forward,2),this._addKeyMapping(t.pan.backward,3),this._addKeyMapping(t.pan.up,4),this._addKeyMapping(t.pan.down,5),this._addKeyMapping(t.lookAround.headingLeft,6),this._addKeyMapping(t.lookAround.headingRight,7),this._addKeyMapping(t.lookAround.tiltUp,8),this._addKeyMapping(t.lookAround.tiltDown,9),this._addKeyMapping(t.zoom.zoomIn,10),this._addKeyMapping(t.zoom.zoomOut,11),this._addKeyAction(t.reset.heading,()=>this._resetHeading()),this._addKeyAction(t.reset.tilt,()=>this._resetTilt())}_addKeyMapping(t,i){for(const e of this._eachKey(t))this._keyToDirection.set(e,i)}*_eachKey(t){"string"==typeof t?yield t:yield*t}_addKeyAction(t,i){for(const e of this._eachKey(t))this._keyToAction.set(e,i)}_handleKeyDown(i){if(i.data.native.ctrlKey||i.data.native.metaKey)return;const e=this._keyToAction.get(i.data.key);if(null!=e)return i.stopPropagation(),void e();const o=this._keyToDirection.get(i.data.key);if(null!=o&&(this._cameraControllerKeyboard&&this._cameraControllerKeyboard.running||(this._cameraControllerKeyboard=new t({view:this._view}),this._view.state.switchCameraController(this._cameraControllerKeyboard)),this._cameraControllerKeyboard.running)){if(i.stopPropagation(),this._cameraControllerKeyboard.directionActive(o))return;if(this._cameraControllerKeyboard.activateDirection(o),this._cameraControllerKeyboard.countActiveDirections()>1||!this._isPanning(o))return;this._stickyKeyDuration>0&&(this._stickyKeyTimeoutHandle=setTimeout(()=>{this._stickyKeyTimeoutHandle=void 0,null!=this._stickyDirection&&void 0!==this._stickyDirection&&(this._cameraControllerKeyboard?.deactivateDirection(this._stickyDirection),this._stickyDirection=void 0)},this._stickyKeyDuration))}}_handleStop(){this._cameraControllerKeyboard?.running&&(this._cameraControllerKeyboard.finishController(),this._cameraControllerKeyboard=null)}_handleKeyUp(t){if(t.data.native.ctrlKey||t.data.native.metaKey||!this._cameraControllerKeyboard?.running)return;const i=this._keyToDirection.get(t.data.key);if(null==i)return;t.stopPropagation();const e=void 0===this._stickyKeyTimeoutHandle;void 0===this._stickyKeyTimeoutHandle||1!==this._cameraControllerKeyboard?.countActiveDirections()?(this._cameraControllerKeyboard?.deactivateDirection(i),e&&(this._stickyDirection=void 0)):this._stickyDirection=i}_isPanning(t){return t<=3}_resetHeading(){this._view.goTo({heading:0}).catch(()=>{})}_resetTilt(){this._view.goTo({tilt:0}).catch(()=>{})}}export{o as KeyboardNavigation};
|
|
@@ -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"../../../core/Error.js";import{makeHandle as i}from"../../../core/handleUtils.js";import{destroyMaybe as r}from"../../../core/maybe.js";import s from"../../../core/ReactiveMap.js";import{property as n,subclass as l}from"../../../core/accessorSupport/decorators.js";import{projectAsync as h}from"../../../geometry/projectionUtils.js";import{hydrateGraphic as a}from"../../../layers/graphics/hydratedFeatures.js";import{combineTimeExtent as o,hasTimeOptions as p}from"../../../layers/support/timeSupport.js";import u from"../../../rest/support/AttributeBinsQuery.js";import g from"../../../rest/support/Query.js";import{isGraphic as y}from"../../../support/graphicInstanceUtils.js";import{LayerView3D as c}from"./LayerView3D.js";import{attributeLookup as d}from"./support/attributeUtils.js";import{normalizeHighlightTarget as m,emptyHighlightHandle as f,isObjectId as P}from"./support/highlightUtils.js";import{RefreshableLayerView as b}from"../../layers/RefreshableLayerView.js";import{getHighlightName as
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{makeHandle as i}from"../../../core/handleUtils.js";import{destroyMaybe as r}from"../../../core/maybe.js";import s from"../../../core/ReactiveMap.js";import{property as n,subclass as l}from"../../../core/accessorSupport/decorators.js";import{projectAsync as h}from"../../../geometry/projectionUtils.js";import{hydrateGraphic as a}from"../../../layers/graphics/hydratedFeatures.js";import{combineTimeExtent as o,hasTimeOptions as p}from"../../../layers/support/timeSupport.js";import u from"../../../rest/support/AttributeBinsQuery.js";import g from"../../../rest/support/Query.js";import{isGraphic as y}from"../../../support/graphicInstanceUtils.js";import{LayerView3D as c}from"./LayerView3D.js";import{attributeLookup as d}from"./support/attributeUtils.js";import{normalizeHighlightTarget as m,emptyHighlightHandle as f,isObjectId as P}from"./support/highlightUtils.js";import{RefreshableLayerView as b}from"../../layers/RefreshableLayerView.js";import{getHighlightName as w}from"../../support/highlightOptionsUtils.js";import{hasLayerBasedScaleVisibility as v,isInEffectiveScaleRange as I}from"../../support/layerViewUtils.js";const _=_=>{const j=b(c(_));let S=class extends j{constructor(){super(...arguments),this.updatePolicy=1,this.slicePlaneEnabled=!1,this._highlightCounter=new s,this.fullExtentInLocalViewSpatialReference=null,this.supportsHeightUnitConversion=!0}initialize(){const e=this.layer;"isTable"in e&&e.isTable?this.addResolvingPromise(Promise.reject(new t("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e}))):(this.addResolvingPromise(this._validateGeometryType()),this.addResolvingPromise((async()=>{if(this.destroyed)return;this.fullExtentInLocalViewSpatialReference="local"===this.view.viewingMode?await h(this.layer.fullExtent,this.view.spatialReference).catch(()=>null):null,await this._updatingRequiredPromise;const e=await this.createGraphicsPipeline();this.destroyed?e.destroy():(this.graphicsPipeline=e,await e.when())})()),this.notifyChange("updating"))}destroy(){this.graphicsPipeline=r(this.graphicsPipeline)}get dataUpdating(){return!!this.graphicsPipeline?.dataUpdating}get legendEnabled(){return this.canResume()&&this.graphicsPipeline?.legendEnabled}get visibleAtCurrentScale(){return v()?I(this.layer.effectiveScaleRange,this.view.scale):!this.graphicsPipeline?.scaleVisibilitySuspended}get symbologySnappingSupported(){return this.graphicsPipeline.symbologySnappingSupported}get hasAllFeatures(){return this.graphicsPipeline.hasAllFeatures}get hasAllFeaturesInView(){return this.graphicsPipeline.hasAllFeaturesInView}get hasFullGeometries(){return this.graphicsPipeline.hasFullGeometries}get timeExtent(){return o(p(this.layer)?this.layer:null,this.view?.timeExtent,this._get("timeExtent"))}get highlightIds(){return Array.from(this._highlightCounter.keys())}get hasHighlight(){return this.highlightIds.length>0}getHit(e,t){const i=this.graphicsPipeline.findGraphic(t=>t.uid===e);if(null==i)return null;const r=a(i,this.layer,this.layer.graphicOrigin);return{type:"graphic",graphic:r,layer:r.layer}}whenGraphicBounds(e,t){return this.graphicsPipeline?.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.graphicsPipeline?.computeAttachmentOrigin(e,t)}async elevationAlignPointsInFeatures(e,t){return this.graphicsPipeline.elevationAlignPointsInFeatures(e,t)}async queryForSymbologySnapping(e,t){return this.graphicsPipeline.graphicsQuery.queryForSymbologySnapping(e,t)}queryAggregates(e,t){throw new Error("missing implementation")}queryFeatures(e,t){return this.graphicsPipeline.graphicsQuery.executeQuery(this._ensureQuery(e),t?.signal)}queryObjectIds(e,t){return this.graphicsPipeline.graphicsQuery.executeQueryForIds(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this.graphicsPipeline.graphicsQuery.executeQueryForCount(this._ensureQuery(e),t?.signal)}queryAttributeBins(e,t){return this.graphicsPipeline.graphicsQuery.executeAttributeBinsQuery(this._ensureAttributeBinsQuery(e),t?.signal)}queryExtent(e,t){return this.graphicsPipeline.graphicsQuery.executeQueryForExtent(this._ensureQuery(e),t?.signal)}_ensureQuery(e){return null==e?this.createQuery():g.from(e)}_ensureAttributeBinsQuery(e){const t=u.from(e);return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t}_addHighlightIds(e){this._highlightCounter.batch(()=>{for(const t of e){const e=this._highlightCounter.get(t)??0;this._highlightCounter.set(t,e+1)}})}_removeHighlightIds(e){this._highlightCounter.batch(()=>{for(const t of e){let e=this._highlightCounter.get(t);null!=e&&(e--,e>0?this._highlightCounter.set(t,e):this._highlightCounter.delete(t))}})}highlight(e,t){const r=w(t),s=this.layer.objectIdField,n=m(e);if(0===n.length)return f;if(y(n[0])){const e=n;if(null!=d(this.layer.fieldsIndex,e[0].attributes,s)){const t=e.map(e=>d(this.layer.fieldsIndex,e.attributes,s)),n=this.graphicsPipeline.highlightByObjectIds(t,r);return this._addHighlightIds(t),i(()=>{this._removeHighlightIds(t),n.remove()})}return this.graphicsPipeline.highlightByGraphics(e,r)}if(P(n[0])){const e=n;this._addHighlightIds(e);const t=this.graphicsPipeline.highlightByObjectIds(e,r);return i(()=>{t.remove(),this._removeHighlightIds(e)})}return f}maskOccludee(e){return this.graphicsPipeline.maskOccludee(e)}getSuspendInfo(){return{...super.getSuspendInfo(),...this.graphicsPipeline.suspendInfo}}isUpdating(){return!(!this.graphicsPipeline||this.graphicsPipeline.destroyed)&&!(!this.graphicsPipeline?.updating&&this.view?.groundView?.ready)}async _validateGeometryType(){switch(this.layer.geometryType){case"multipatch":case"multipoint":throw new t("featurelayerview3d:unsupported-geometry-type","Unsupported geometry type ${geometryType}",{geometryType:this.layer.geometryType})}}get performanceInfo(){return this.graphicsPipeline.performanceInfo}};return e([n()],S.prototype,"graphicsPipeline",void 0),e([n({readOnly:!0})],S.prototype,"dataUpdating",null),e([n()],S.prototype,"suspended",void 0),e([n({readOnly:!0})],S.prototype,"legendEnabled",null),e([n({readOnly:!0})],S.prototype,"visibleAtCurrentScale",null),e([n()],S.prototype,"updating",void 0),e([n({readOnly:!0})],S.prototype,"updatePolicy",void 0),e([n({type:Boolean})],S.prototype,"slicePlaneEnabled",void 0),e([n({readOnly:!0})],S.prototype,"suspendInfo",void 0),e([n()],S.prototype,"symbologySnappingSupported",null),e([n({readOnly:!0})],S.prototype,"hasAllFeatures",null),e([n({readOnly:!0})],S.prototype,"hasAllFeaturesInView",null),e([n({readOnly:!0})],S.prototype,"hasFullGeometries",null),e([n({readOnly:!0})],S.prototype,"timeExtent",null),e([n()],S.prototype,"highlightIds",null),e([n()],S.prototype,"hasHighlight",null),S=e([l("esri.views.3d.layers.FeatureLikeLayerViewBase3D")],S),S};export{_ as FeatureLikeLayerViewBase3D};
|
|
@@ -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 a,when as n}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}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as m,IDENTITY as p}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 f}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{normalize as g,sub as y,dot as _,set as v}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as w,freeze as x,clone as T,fromValues as j,ZEROS as C}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as O,clone as E,ONES as M}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMoon as R,isMars as V,getReferenceEllipsoid as S,SphericalECEFSpatialReferenceLike as U}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as H}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as D}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as P}from"../../../geometry/projection/projectVectorToVector.js";import{create as I}from"../../../geometry/support/aaBoundingRect.js";import{isCGCS2000 as k}from"../../../geometry/support/spatialReferenceUtils.js";import{BufferViewVec4f as L,BufferViewVec4u8 as A,BufferViewVec4u16 as F,BufferViewVec3f as G,BufferViewVec3u8 as B,BufferViewVec3u16 as z,BufferViewVec2f as N,BufferViewUint32 as W,BufferViewUint16 as q}from"../../../geometry/support/buffer/BufferView.js";import $ from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as X}from"../../../support/elevationInfoUtils.js";import{IntegratedMesh3DTilesLayerWorkerHandle as Z}from"./IntegratedMesh3DTilesLayerWorkerHandle.js";import{LayerView3D as J}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as Y}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as Q,removeLayerViewFromWasm as K,getLyr3DWasm as ee}from"./Lyr3DWasm.js";import{toWasmModification as te}from"./SceneLayerWorkerHandle.js";import{LayerElevationProvider as ie}from"./i3s/LayerElevationProvider.js";import{IntegratedMesh3DTilesLayerView3DSymbol as se}from"./support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{primTypeConversion as re,alphaModeConversion as oe,faceCullingConversion as ae,wrapModeConversion as ne}from"./support/lyr3dTypeConversions.js";import{makeScheduleFunction as le}from"./support/makeScheduleFunction.js";import{Tiles3DMeshIntersectionHandler as ce}from"./support/Tiles3DMeshIntersectionHandler.js";import{Frustum as de}from"../state/Frustum.js";import{ElevationRange as he}from"../support/ElevationRange.js";import{toBoundingRect as ue}from"../support/extentUtils.js";import{Obb as me}from"../support/orientedBoundingBox.js";import{glLayout as pe}from"../support/buffer/glUtil.js";import{ComponentGeometryParameters as be,SourceGeometry as fe}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as ge}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as ye}from"../webgl-engine/core/material/RenderTexture.js";import{ManagedTexture as _e}from"../webgl-engine/lib/ManagedTexture.js";import{compressNormals as ve}from"../webgl-engine/lib/Normals.js";import{advancedMRRFactors as we}from"../webgl-engine/materials/pbrUtils.js";import xe from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as Te,isInEffectiveScaleRange as je,validateScaleRange as Ce}from"../../support/layerViewUtils.js";import{TaskPriority as Oe}from"../../support/Scheduler.js";import{TextureCompressionTracker as Ee}from"../../support/TextureCompressionTracker.js";import{CompressedTextureFormat as Me,SizedPixelFormat as Re}from"../../webgl/enums.js";import{alphaCutoff as Ve}from"../../../webscene/support/AlphaCutoff.js";var Se;function Ue(e,t,i){if("image/vnd-ms.dds"===t)switch(i){case"Dxt1":return Me.COMPRESSED_RGB_S3TC_DXT1_EXT;case"Dxt5":return Me.COMPRESSED_RGBA_S3TC_DXT5_EXT;default:return null}if("image/ktx2"===t)return null;switch(e){case 33319:return Re.RG8;case 6407:return Re.RGB8;case 6408:return Re.RGBA8;case 6403:return Re.R8;default:return null}}let He=class extends(J(xe)){static{Se=se}constructor(e){super(e),this[Se]=!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 Ee,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(Oe.TILES3D,this),this._frustum=new de(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._workerHandle=new Z(le(e.resourceController)),this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),o),!this._canProjectWithoutEngine())throw Te("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=Q(this).then(t=>{this._wasmLayerId=t,this._intersectionHandler=new ce(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 ie({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([a(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),n(()=>this.fullOpacity,()=>this._opacityChange()),a(()=>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"),this._workerHandle?.destroyContextAndSelf(this.uid),K(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=te(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=I();this._layerClippingArea=ue(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,X(e))}get _wasm(){return ee(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||je(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||Ce(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(a=>{a.isLoaded?(e+=a.textureMemoryUsage,t+=a.vboMemoryUsage,r++):(i+=a.textureMemoryUsage,s+=a.vboMemoryUsage,o++)}),new Y(this.usedMemory,r,o,Ie(t),Ie(e),Ie(s),Ie(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 X(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new he(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new he;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||k(i)||R(i)||V(i);if(this.view.state.isGlobal||!s)return this.forEachVisibleTile(e);const r=S(i).radius,{eye:o,viewForward:a,near:n}=t.state.camera,l=g(w(),a),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,b=w();this.forEachVisibleTile(t=>{const{mbsRadius:i,mbsCenter:s}=t;if(i<0)return;y(b,s,o);const r=_(b,l);Math.abs(r)<p&&r+i>n&&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");const{meshData:t}=e;if(!Ge(t))throw new Error("meshData not valid");const i=new Map;let s;try{s=this._createPrimitiveTextureBundles(t,i)}catch(o){throw i.forEach(e=>this._stage.removeTexture(e)),o}let r=null;try{if(r=await this._createRenderableMain(t,s),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable aborted due to destroyed instance");const{tileObb:o,componentObjects:a,elevationRange:n}=r;let l=0,c=0,d=0;for(const e of a){const{texture:t,textureMetallicRoughness:i,textureEmissive:s,textureOcclusion:r,textureNormal:o}=e.renderable.drawParameters;l+=(t?.usedMemory??0)+(i?.usedMemory??0)+(s?.usedMemory??0)+(r?.usedMemory??0)+(o?.usedMemory??0),c+=this._collection.getObjectGPUMemoryUsage(e),d+=e.intersectionGeometry.usedMemory}const h=Array.from(i.values()),u=new Pe(e.handle,a,h,d,c,l,o,e.stableNodeId,e.nodeDepth,n);this._lyrHandleToObjects.set(e.handle,u),this._memCache.put(Le(u.handle),u);const{usedMemory:m}=u;return this._cacheMemory+=m,{memUsageBytes:m}}catch(o){throw s.forEach(e=>e.cleanup()),r?.componentObjects.forEach(e=>this._collection.destroyObject(e)),i.forEach(e=>this._stage.removeTexture(e)),o}}_createPrimitiveTextureBundles(e,t){const i=new Array,s=e.desc.prims.length;try{const r=e.desc;for(let o=0;o<s;o++){const s=r.prims[o].materialId,a=r.materials&&null!=s?r.materials[s]:null;let n=Promise.resolve(Ae),l=null,c=null,d=null,h=null,u=null;if(a){const i="Pbr"===a.lightingModel;l=this._getTexture(a.baseColorTex,e,t),c=i?this._getTexture(a.metalTex,e,t):null,d=i?this._getTexture(a.emissiveTex,e,t):null,h=i?this._getTexture(a.occlusionTex,e,t):null,u=i?this._getTexture(a.normalTex,e,t):null;const s=[l,c,d,h,u].map(e=>e?.loadPromise??null);n=Promise.all(s)}i.push(new Fe(n,l,c,d,h,u))}}catch(r){throw i.forEach(e=>e.cleanup()),r}return i}async _createRenderableMain(e,t){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain called after destroy");const i=new Array,s=e.desc,r=e.data.buffer,o=s.prims.length,a=x(...s.origin),n=this.view.basemapTerrain.spatialReference,l=this.view.state.isGlobal;let c=p;if(l){const e=b();H(U,a,e,n),c=h(m(),e)}if(null==s.obb)throw new Error("meshData.desc.obb undefined");const d=ke(s.obb),f=l?S(this.view.spatialReference).radius:0,g=new Array;try{for(let i=0;i<o;i++){const e=s.prims[i],o=t[i];this._dbgFlags.has(2)&&this._dbg(2,JSON.stringify(e));if(null==re[e.ptype]){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive."),o.cleanup();continue}const{positionView:a,normalsData:n,colorView:l,texCoord0Data:c,indicesView:d}=this.getBufferViews(e,r);if(null==a||null==d){o.cleanup();continue}const h=a.count,u=(e,t)=>null==e||e===h||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);u(null!=c?c.length/2:void 0,"numTexcoord")&&u(l?.count,"numColors")&&u(n?.length,"normals")?g.push({componentIndex:i,positionView:a,indicesView:d,texCoord0Data:c,colorView:l,normalsData:n}):o.cleanup()}const{vertexProcessingOutputs:e,obbHalfSizeAccumulator:h,elevationRange:b}=await this._workerHandle.processTiles3DVertices(g,a,f,l,c,d,this._imVertexNormals);if(this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");const y=s.materials,_=c!==p,v=_?u(m(),c)??p:p;if(await Promise.all(t.map(e=>e.materialPromise)),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");for(const r of e){const{componentIndex:e,positionView:o,indicesView:l,layout:c,textureCoordinateType:h,interleavedVertexData:u,indices:m}=r,p=s.prims[e],b=t[e],f=d.clone(),g=pe(c),x=new Uint32Array([0,l.typedBuffer.length]),T=new be(g,this._imShading?2:0,h,_?1:0,0),j=new fe({interleavedVertexData:u,vertexCount:u.byteLength/g[0].stride,indexData:m},{positions:o.typedBuffer,indices:l.typedBuffer},x,T),C=this.view.renderSpatialReference,E=w(),M=[1,1,1];D(a,C,M,n)||this._dbg(3,"Unsupported coordinate system for IM overlay"),P(a,C,E,n);const R=y&&null!=p.materialId?y[p.materialId]:null,V=this._createComponentMaterialInitParameters(R,b);V.baseColorTexture||this._dbg(3,"No colour texture 1");const S=this._collection.createObject({toMapSpace:O(E[0],E[1],M[0],M[1]),transform:new ge(a,v),obb:f,geometry:j,elevationAlignable:!1},V);i.push(S)}i.length>0&&d.setHalfSize(h[0],h[1],h[2]);const{fullExtent:x}=this.layer;return x?.hasZ&&x.zmax&&x.zmin&&(b.minElevation=Math.max(b.minElevation,x.zmin),b.maxElevation=Math.min(b.maxElevation,x.zmax)),{tileObb:d,componentObjects:i,elevationRange:b}}catch(y){throw i.forEach(e=>this._collection.destroyObject(e)),y}}_createComponentMaterialInitParameters(e,t){const i="Pbr"===(null!=e?e.lightingModel:"Unlit");let s=M,r=Ve,o=1,a=!1,n=2,l=j(0,0,0);const c=T(we),d=t.baseColorTexture,h=t.metallicRoughnessTexture,u=t.emissionTexture,m=t.occlusionTexture,p=t.normalTexture;return e&&(s=E(e.baseColorFactor),r=e.alphaCutoff??Ve,i&&(v(c,e.metallicFactor,e.roughnessFactor,0),e.emissiveFactor&&(l=e.emissiveFactor)),o=oe[e.alphaMode],a=e.isDoubleSided,n=ae[e.faceCulling??"NotSet"]),{isIntegratedMesh:!0,baseColor:s,textureAlphaCutoff:r,mrrFactors:c,baseColorTexture:d,metallicRoughnessTexture:h,normalTexture:p,occlusionTexture:m,emissionTexture:u,hasParametersFromSource:!1,sphereDepthInterpolate:this.layer.hasGoogleUrl,alphaDiscardMode:o,doubleSided:a,cullFace:n,isGround:this.layer.replacesTerrain,emissiveBaseColor:l,usePBR:i,slicePlaneEnabled:this.slicePlaneEnabled,opacity:this.fullOpacity,polygonOffset:0,ellipsoidMode:1,applySSAO:this._applySSAO}}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=Le(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,a=!1;for(let n=0;n<i;++n){if(!t[n])continue;const i=e[n],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),a||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(e,l.elevationRange)),e&&l.obb&&r.push(l.obb),l.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(Le(i))}else this._dbg(3,`Tried to mark Non existent object ${i} as loaded`)}for(let n=0;n<i;++n){const i=e[n];if(t[n])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(),a||=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(Le(i),s)}else this._dbg(3,`Tried to mark Non existent object ${i} as not loaded`)}o&&this._visibleGeometryChanged(),this._elevationProvider.notifyObjectsChanged(r),a&&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 ye(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,a=ne[e.wrapMode??"None"];let n=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,n=6403,d=""):"Rg8"===s.pixelFormat||"Ga8"===s.pixelFormat?(c=l,n=33319,d=""):"Rgb8"===s.pixelFormat?(c=l,n=6407,d=""):"Rgba8"===s.pixelFormat&&(c=l,n=6408,d="");break;case"Dxt1":c=l,n=6407,d="image/vnd-ms.dds";break;case"Dxt5":c=l,n=6408,d="image/vnd-ms.dds";break;case"Basis":c=l,n=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=Ue(n,d,s.format),l=new _e(c,{mipmap:o,maxAnisotropy:r,encoding:d,wrap:a,pixelFormat:n,internalFormat:t??void 0,immutable:null!=t,compressionOptions:e,noUnpackFlip:!0,width:s.mip0Width,height:s.mip0Height});return this._stage.addTexture(l),i.set(s,l),l}return null}getBufferViews(e,t){let i,s,r,o,a;for(let l=0;l<e.atrbs.length;l++){const a=e.atrbs[l],{view:c}=a,d=void 0,h=c.byteOffset+c.byteCount;try{switch(a.sem){case"Position":3!==c.ncomp||"F32"!==c.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+c+")"):i=new G(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 G(t,c.byteOffset,d,h);o=new Uint32Array(e.count),ve(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 N(t,c.byteOffset,d,h).typedBuffer);break;case"Color":4===c.ncomp?("F32"===c.type&&(s=new L(t,c.byteOffset,d,h)),"U8"===c.type&&(s=new A(t,c.byteOffset,d,h)),"U16"===c.type&&(s=new F(t,c.byteOffset,d,h))):3===c.ncomp&&("F32"===c.type&&(s=new G(t,c.byteOffset,d,h)),"U8"===c.type&&(s=new B(t,c.byteOffset,d,h)),"U16"===c.type&&(s=new z(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 ("+a.sem+"). Skipping vertex attribute.")}}catch(n){this._dbg(2,"Error Creating buffer ("+n+"). 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":a=new q(t,i.byteOffset,s,r);break;case"U32":a=new W(t,i.byteOffset,s,r);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==a&&null!=i){const e=i.count;a=a=e<65535?new q(new Uint16Array(e).buffer):new W(new Uint32Array(e).buffer);for(let t=0;t<e;t++)a.set(t,t)}return{positionView:i,colorView:s,texCoord0Data:r,indicesView:a,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()],He.prototype,"fullOpacity",null),e([c({readOnly:!0})],He.prototype,"ready",null),e([c({type:[$]})],He.prototype,"_modifications",void 0),e([c()],He.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([c()],He.prototype,"layer",void 0),e([c({readOnly:!0})],He.prototype,"visibleAtCurrentScale",null),e([c({readOnly:!0})],He.prototype,"_collection",null),e([c()],He.prototype,"elevationOffset",null),e([c({readOnly:!0})],He.prototype,"visibleElevationRange",null),He=e([d("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],He);const De=He;class Pe{constructor(e,t,i,s,r,o,a,n,l,c){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=s,this.vboMemoryUsage=r,this.textureMemoryUsage=o,this.obb=a,this.stableNodeId=n,this.nodeDepth=l,this.elevationRange=c,this.bvhIntersectionGeneration=0,this.isLoaded=!1,this.isVisible=!1;const d=w();a?.getCenter(d),this._obbCenterX=d[0],this._obbCenterY=d[1],this._obbCenterZ=d[2];const h=a?.radius??-1;this._obbRadius=h,this._obbRadiusSquared=h*h;const u=a?.halfSize;this._obbShortestHalfsize=u?Math.min(u[0],u[1],u[2]):0,this._mbsCenter=a?T(a.center):C}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],a=s-e[1],n=r-e[2],l=o*t[0]+a*t[1]+n*t[2];return o*o+a*a+n*n-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 a=this._obbCenterY-i[1];if(a>r)return!1;const n=this._obbCenterZ-i[2];if(n>r)return!1;const l=o*o+a*a+n*n;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 Ie(e){return Math.round(e/1048.576)/1e3}function ke(e){return new me(e.center,e.halfSize,f(...e.quaternion))}function Le(e){return`${e}`}const Ae=new Array;class Fe{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()}}function Ge(e){return null!=e.data&&("string"==typeof e.desc&&(e.desc=JSON.parse(e.desc)),null!=e.desc)}export{De 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 a,when as n}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}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as m,IDENTITY as p}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 f}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{normalize as g,sub as y,dot as _,set as v}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as w,freeze as x,clone as T,fromValues as j,ZEROS as C}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as O,clone as E,ONES as M}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMoon as R,isMars as V,getReferenceEllipsoid as S,SphericalECEFSpatialReferenceLike as U}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as H}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as D}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as P}from"../../../geometry/projection/projectVectorToVector.js";import{create as I}from"../../../geometry/support/aaBoundingRect.js";import{isCGCS2000 as k}from"../../../geometry/support/spatialReferenceUtils.js";import{BufferViewVec4f as L,BufferViewVec4u8 as A,BufferViewVec4u16 as F,BufferViewVec3f as G,BufferViewVec3u8 as B,BufferViewVec3u16 as z,BufferViewVec2f as N,BufferViewUint32 as W,BufferViewUint16 as q}from"../../../geometry/support/buffer/BufferView.js";import $ from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as X}from"../../../support/elevationInfoUtils.js";import{IntegratedMesh3DTilesLayerWorkerHandle as Z}from"./IntegratedMesh3DTilesLayerWorkerHandle.js";import{LayerView3D as J}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as Y}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as Q,removeLayerViewFromWasm as K,getLyr3DWasm as ee}from"./Lyr3DWasm.js";import{toWasmModification as te}from"./SceneLayerWorkerHandle.js";import{LayerElevationProvider as ie}from"./i3s/LayerElevationProvider.js";import{IntegratedMesh3DTilesLayerView3DSymbol as se}from"./support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{primTypeConversion as re,alphaModeConversion as oe,faceCullingConversion as ae,wrapModeConversion as ne}from"./support/lyr3dTypeConversions.js";import{makeScheduleFunction as le}from"./support/makeScheduleFunction.js";import{Tiles3DMeshIntersectionHandler as ce}from"./support/Tiles3DMeshIntersectionHandler.js";import{Frustum as de}from"../state/Frustum.js";import{ElevationRange as he}from"../support/ElevationRange.js";import{toBoundingRect as ue}from"../support/extentUtils.js";import{Obb as me}from"../support/orientedBoundingBox.js";import{glLayout as pe}from"../support/buffer/glUtil.js";import{ComponentGeometryParameters as be,SourceGeometry as fe}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as ge}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as ye}from"../webgl-engine/core/material/RenderTexture.js";import{ManagedTexture as _e}from"../webgl-engine/lib/ManagedTexture.js";import{compressNormals as ve}from"../webgl-engine/lib/Normals.js";import{advancedMRRFactors as we}from"../webgl-engine/materials/pbrUtils.js";import xe from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as Te,isInEffectiveScaleRange as je,validateScaleRange as Ce}from"../../support/layerViewUtils.js";import{TaskPriority as Oe}from"../../support/Scheduler.js";import{TextureCompressionTracker as Ee}from"../../support/TextureCompressionTracker.js";import{CompressedTextureFormat as Me,SizedPixelFormat as Re}from"../../webgl/enums.js";import{alphaCutoff as Ve}from"../../../webscene/support/AlphaCutoff.js";var Se;function Ue(e,t,i){if("image/vnd-ms.dds"===t)switch(i){case"Dxt1":return Me.COMPRESSED_RGB_S3TC_DXT1_EXT;case"Dxt5":return Me.COMPRESSED_RGBA_S3TC_DXT5_EXT;default:return null}if("image/ktx2"===t)return null;switch(e){case 33319:return Re.RG8;case 6407:return Re.RGB8;case 6408:return Re.RGBA8;case 6403:return Re.R8;default:return null}}let He=class extends(J(xe)){static{Se=se}constructor(e){super(e),this[Se]=!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 Ee,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(Oe.TILES3D,this),this._frustum=new de(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._workerHandle=new Z(le(e.resourceController)),this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),o),!this._canProjectWithoutEngine())throw Te("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=Q(this).then(t=>{this._wasmLayerId=t,this._intersectionHandler=new ce(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 ie({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([a(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),n(()=>this.fullOpacity,()=>this._opacityChange()),a(()=>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"),this._workerHandle?.destroyContextAndSelf(this.uid),K(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=te(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=I();this._layerClippingArea=ue(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,X(e))}get _wasm(){return ee(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||je(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||Ce(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(a=>{a.isLoaded?(e+=a.textureMemoryUsage,t+=a.vboMemoryUsage,r++):(i+=a.textureMemoryUsage,s+=a.vboMemoryUsage,o++)}),new Y(this.usedMemory,r,o,Ie(t),Ie(e),Ie(s),Ie(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 X(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new he(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new he;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||k(i)||R(i)||V(i);if(this.view.state.isGlobal||!s)return this.forEachVisibleTile(e);const r=S(i).radius,{eye:o,viewForward:a,near:n}=t.state.camera,l=g(w(),a),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,b=w();this.forEachVisibleTile(t=>{const{mbsRadius:i,mbsCenter:s}=t;if(i<0)return;y(b,s,o);const r=_(b,l);Math.abs(r)<p&&r+i>n&&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");const{meshData:t}=e;if(!Ge(t))throw new Error("meshData not valid");const i=new Map;let s;try{s=this._createPrimitiveTextureBundles(t,i)}catch(o){throw i.forEach(e=>this._stage.removeTexture(e)),o}let r=null;try{if(r=await this._createRenderableMain(t,s),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable aborted due to destroyed instance");const{tileObb:o,componentObjects:a,elevationRange:n}=r;let l=0,c=0,d=0;for(const e of a){const{texture:t,textureMetallicRoughness:i,textureEmissive:s,textureOcclusion:r,textureNormal:o}=e.renderable.drawParameters;l+=(t?.usedMemory??0)+(i?.usedMemory??0)+(s?.usedMemory??0)+(r?.usedMemory??0)+(o?.usedMemory??0),c+=this._collection.getObjectGPUMemoryUsage(e),d+=e.intersectionGeometry.usedMemory}const h=Array.from(i.values()),u=new Pe(e.handle,a,h,d,c,l,o,e.stableNodeId,e.nodeDepth,n);this._lyrHandleToObjects.set(e.handle,u),this._memCache.put(Le(u.handle),u);const{usedMemory:m}=u;return this._cacheMemory+=m,{memUsageBytes:m}}catch(o){throw s.forEach(e=>e.cleanup()),r?.componentObjects.forEach(e=>this._collection.destroyObject(e)),i.forEach(e=>this._stage.removeTexture(e)),o}}_createPrimitiveTextureBundles(e,t){const i=new Array,s=e.desc.prims.length;try{const r=e.desc;for(let o=0;o<s;o++){const s=r.prims[o].materialId,a=r.materials&&null!=s?r.materials[s]:null;let n=Promise.resolve(Ae),l=null,c=null,d=null,h=null,u=null;if(a){const i="Pbr"===a.lightingModel;l=this._getTexture(a.baseColorTex,e,t),c=i?this._getTexture(a.metalTex,e,t):null,d=i?this._getTexture(a.emissiveTex,e,t):null,h=i?this._getTexture(a.occlusionTex,e,t):null,u=i?this._getTexture(a.normalTex,e,t):null;const s=[l,c,d,h,u].map(e=>e?.loadPromise??null);n=Promise.all(s)}i.push(new Fe(n,l,c,d,h,u))}}catch(r){throw i.forEach(e=>e.cleanup()),r}return i}async _createRenderableMain(e,t){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain called after destroy");const i=new Array,s=e.desc,r=e.data.buffer,o=s.prims.length,a=x(...s.origin),n=this.view.basemapTerrain.spatialReference,l=this.view.state.isGlobal;let c=p;if(l){const e=b();H(U,a,e,n),c=h(m(),e)}if(null==s.obb)throw new Error("meshData.desc.obb undefined");const d=ke(s.obb),f=l?S(this.view.spatialReference).radius:0,g=new Array;try{for(let i=0;i<o;i++){const e=s.prims[i],o=t[i];this._dbgFlags.has(2)&&this._dbg(2,JSON.stringify(e));if(null==re[e.ptype]){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive."),o.cleanup();continue}const{positionView:a,normalsData:n,colorView:l,texCoord0Data:c,indicesView:d}=this.getBufferViews(e,r);if(null==a||null==d){o.cleanup();continue}const h=a.count,u=(e,t)=>null==e||e===h||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);u(null!=c?c.length/2:void 0,"numTexcoord")&&u(l?.count,"numColors")&&u(n?.length,"normals")?g.push({componentIndex:i,positionView:a,indicesView:d,texCoord0Data:c,colorView:l,normalsData:n}):o.cleanup()}const e=c!==p,h=e?u(m(),c)??p:p,{vertexProcessingOutputs:b,obbHalfSizeAccumulator:y,elevationRange:_}=await this._workerHandle.processTiles3DVertices(g,a,f,l,c,d,this._imVertexNormals);if(this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");const v=s.materials;if(await Promise.all(t.map(e=>e.materialPromise)),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");for(const r of b){const{componentIndex:o,positionView:l,indicesView:c,layout:u,textureCoordinateType:m,interleavedVertexData:p,indices:b}=r,f=s.prims[o],g=t[o],y=d.clone(),_=pe(u),x=new Uint32Array([0,c.typedBuffer.length]),T=new be(_,this._imShading?2:0,m,e?2:0,0),j=new fe({interleavedVertexData:p,vertexCount:p.byteLength/_[0].stride,indexData:b},{positions:l.typedBuffer,indices:c.typedBuffer},x,T),C=this.view.renderSpatialReference,E=w(),M=[1,1,1];D(a,C,M,n)||this._dbg(3,"Unsupported coordinate system for IM overlay"),P(a,C,E,n);const R=v&&null!=f.materialId?v[f.materialId]:null,V=this._createComponentMaterialInitParameters(R,g);V.baseColorTexture||this._dbg(3,"No colour texture 1");const S=this._collection.createObject({toMapSpace:O(E[0],E[1],M[0],M[1]),transform:new ge(a,h),obb:y,geometry:j,elevationAlignable:!1},V);i.push(S)}i.length>0&&d.setHalfSize(y[0],y[1],y[2]);const{fullExtent:x}=this.layer;return x?.hasZ&&x.zmax&&x.zmin&&(_.minElevation=Math.max(_.minElevation,x.zmin),_.maxElevation=Math.min(_.maxElevation,x.zmax)),{tileObb:d,componentObjects:i,elevationRange:_}}catch(y){throw i.forEach(e=>this._collection.destroyObject(e)),y}}_createComponentMaterialInitParameters(e,t){const i="Pbr"===(null!=e?e.lightingModel:"Unlit");let s=M,r=Ve,o=1,a=!1,n=2,l=j(0,0,0);const c=T(we),d=t.baseColorTexture,h=t.metallicRoughnessTexture,u=t.emissionTexture,m=t.occlusionTexture,p=t.normalTexture;return e&&(s=E(e.baseColorFactor),r=e.alphaCutoff??Ve,i&&(v(c,e.metallicFactor,e.roughnessFactor,0),e.emissiveFactor&&(l=e.emissiveFactor)),o=oe[e.alphaMode],a=e.isDoubleSided,n=ae[e.faceCulling??"NotSet"]),{isIntegratedMesh:!0,baseColor:s,textureAlphaCutoff:r,mrrFactors:c,baseColorTexture:d,metallicRoughnessTexture:h,normalTexture:p,occlusionTexture:m,emissionTexture:u,hasParametersFromSource:!1,sphereDepthInterpolate:this.layer.hasGoogleUrl,alphaDiscardMode:o,doubleSided:a,cullFace:n,isGround:this.layer.replacesTerrain,emissiveBaseColor:l,usePBR:i,slicePlaneEnabled:this.slicePlaneEnabled,opacity:this.fullOpacity,polygonOffset:0,ellipsoidMode:1,applySSAO:this._applySSAO}}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=Le(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,a=!1;for(let n=0;n<i;++n){if(!t[n])continue;const i=e[n],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),a||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(e,l.elevationRange)),e&&l.obb&&r.push(l.obb),l.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(Le(i))}else this._dbg(3,`Tried to mark Non existent object ${i} as loaded`)}for(let n=0;n<i;++n){const i=e[n];if(t[n])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(),a||=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(Le(i),s)}else this._dbg(3,`Tried to mark Non existent object ${i} as not loaded`)}o&&this._visibleGeometryChanged(),this._elevationProvider.notifyObjectsChanged(r),a&&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 ye(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,a=ne[e.wrapMode??"None"];let n=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,n=6403,d=""):"Rg8"===s.pixelFormat||"Ga8"===s.pixelFormat?(c=l,n=33319,d=""):"Rgb8"===s.pixelFormat?(c=l,n=6407,d=""):"Rgba8"===s.pixelFormat&&(c=l,n=6408,d="");break;case"Dxt1":c=l,n=6407,d="image/vnd-ms.dds";break;case"Dxt5":c=l,n=6408,d="image/vnd-ms.dds";break;case"Basis":c=l,n=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=Ue(n,d,s.format),l=new _e(c,{mipmap:o,maxAnisotropy:r,encoding:d,wrap:a,pixelFormat:n,internalFormat:t??void 0,immutable:null!=t,compressionOptions:e,noUnpackFlip:!0,width:s.mip0Width,height:s.mip0Height});return this._stage.addTexture(l),i.set(s,l),l}return null}getBufferViews(e,t){let i,s,r,o,a;for(let l=0;l<e.atrbs.length;l++){const a=e.atrbs[l],{view:c}=a,d=void 0,h=c.byteOffset+c.byteCount;try{switch(a.sem){case"Position":3!==c.ncomp||"F32"!==c.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+c+")"):i=new G(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 G(t,c.byteOffset,d,h);o=new Uint32Array(e.count),ve(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 N(t,c.byteOffset,d,h).typedBuffer);break;case"Color":4===c.ncomp?("F32"===c.type&&(s=new L(t,c.byteOffset,d,h)),"U8"===c.type&&(s=new A(t,c.byteOffset,d,h)),"U16"===c.type&&(s=new F(t,c.byteOffset,d,h))):3===c.ncomp&&("F32"===c.type&&(s=new G(t,c.byteOffset,d,h)),"U8"===c.type&&(s=new B(t,c.byteOffset,d,h)),"U16"===c.type&&(s=new z(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 ("+a.sem+"). Skipping vertex attribute.")}}catch(n){this._dbg(2,"Error Creating buffer ("+n+"). 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":a=new q(t,i.byteOffset,s,r);break;case"U32":a=new W(t,i.byteOffset,s,r);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==a&&null!=i){const e=i.count;a=a=e<65535?new q(new Uint16Array(e).buffer):new W(new Uint32Array(e).buffer);for(let t=0;t<e;t++)a.set(t,t)}return{positionView:i,colorView:s,texCoord0Data:r,indicesView:a,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()],He.prototype,"fullOpacity",null),e([c({readOnly:!0})],He.prototype,"ready",null),e([c({type:[$]})],He.prototype,"_modifications",void 0),e([c()],He.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([c()],He.prototype,"layer",void 0),e([c({readOnly:!0})],He.prototype,"visibleAtCurrentScale",null),e([c({readOnly:!0})],He.prototype,"_collection",null),e([c()],He.prototype,"elevationOffset",null),e([c({readOnly:!0})],He.prototype,"visibleElevationRange",null),He=e([d("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],He);const De=He;class Pe{constructor(e,t,i,s,r,o,a,n,l,c){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=s,this.vboMemoryUsage=r,this.textureMemoryUsage=o,this.obb=a,this.stableNodeId=n,this.nodeDepth=l,this.elevationRange=c,this.bvhIntersectionGeneration=0,this.isLoaded=!1,this.isVisible=!1;const d=w();a?.getCenter(d),this._obbCenterX=d[0],this._obbCenterY=d[1],this._obbCenterZ=d[2];const h=a?.radius??-1;this._obbRadius=h,this._obbRadiusSquared=h*h;const u=a?.halfSize;this._obbShortestHalfsize=u?Math.min(u[0],u[1],u[2]):0,this._mbsCenter=a?T(a.center):C}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],a=s-e[1],n=r-e[2],l=o*t[0]+a*t[1]+n*t[2];return o*o+a*a+n*n-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 a=this._obbCenterY-i[1];if(a>r)return!1;const n=this._obbCenterZ-i[2];if(n>r)return!1;const l=o*o+a*a+n*n;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 Ie(e){return Math.round(e/1048.576)/1e3}function ke(e){return new me(e.center,e.halfSize,f(...e.quaternion))}function Le(e){return`${e}`}const Ae=new Array;class Fe{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()}}function Ge(e){return null!=e.data&&("string"==typeof e.desc&&(e.desc=JSON.parse(e.desc)),null!=e.desc)}export{De as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{fromQuat as e}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as t,IDENTITY as o}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{transformMat3 as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as l,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{BufferViewVec3f as i,BufferViewVec2f as a,BufferViewVec4u8 as u,BufferViewVec2i16 as f}from"../../../../geometry/support/buffer/BufferView.js";import{computeNormals as s,writeAddedVerticesAndNormals as c}from"../IntegratedMeshNormals.js";import{ElevationRange as d}from"../../support/ElevationRange.js";import{VertexBufferLayoutCreationParameters as p,createVertexBufferLayout as m}from"../../webgl-engine/collections/Component/SourceGeometry.js";function b(e,t,o,r,n,i,a){const u=new Array,f=l(0,0,0),b=new d,g={origin:t,ellipsoidRadius:o,isGlobal:r,ecefRotation:n};for(const l of e){const{componentIndex:e,positionView:t,indicesView:o,texCoord0Data:r,colorView:n,normalsData:d}=l,x=t.count,B=r?1:0,w=new p(null!=n,null!=d||a,B),S=a&&null==d?s(o.typedBuffer,t.typedBuffer,t.typedBufferStride):null,V=S?.outputVertexCount??x,h=m(w),v=h.createBuffer(V),C=S?h.fields.get("normalCompressed"):null;if(null!=S&&null==C)throw new Error("computeNormals requires a reserved NORMALCOMPRESSED attribute in layout");let R;if(y(g,{texCoord0Data:r,colorView:n,packedNormalsSource:S?S.packedNormals:d??null},v,{positionView:t,tileObb:i,obbHalfSizeAccumulator:f,elevationRange:b}),null!=S){const e=h.stride/4,t=C.offset/4,o=x,r=new Uint32Array(v.buffer);c(r,e,t,r,e,o,V,S.appendedVertexToOriginal,S.packedNormals),R=S.indices}else R=o.typedBuffer;u.push({componentIndex:e,positionView:t,indicesView:o,layout:h,textureCoordinateType:B,interleavedVertexData:v.buffer,indices:R})}return{vertexProcessingOutputs:u,obbHalfSizeAccumulator:f,elevationRange:b}}function y(t,l,n,s){const{origin:c,ellipsoidRadius:d,isGlobal:p,ecefRotation:m}=t,{texCoord0Data:b,colorView:y,packedNormalsSource:B}=l,{positionView:w,tileObb:S,obbHalfSizeAccumulator:V,elevationRange:h}=s,v=n.getField("position",i),C=v.typedBuffer,R=v.typedBufferStride,M=null!=b?n.getField("uv0",a):null,j=M?.typedBuffer,A=M?.typedBufferStride??0,N=y?.typedBuffer,O=y?.elementCount??0,D=null!=y?n.getField("color",u):null,E=D?.typedBuffer,k=D?.typedBufferStride??0,F=null!=B?n.getField("normalCompressed",f):null,q=null!=F?new Uint32Array(F.typedBuffer.buffer,F.typedBuffer.byteOffset,F.typedBuffer.length/2):null,z=null!=F?F.typedBufferStride/2:0,G=e(x,S.quaternionConjugate),H=r(g,S.center,G),I=G[0],P=G[1],T=G[2],U=G[3],L=G[4],J=G[5],K=G[6],Q=G[7],W=G[8],X=H[0],Y=H[1],Z=H[2],$=m[0],_=m[1],ee=m[2],te=m[3],oe=m[4],re=m[5],le=m[6],ne=m[7],ie=m[8],ae=m!==o,ue=c[0],fe=c[1],se=c[2],ce=w.count,de=w.typedBufferStride,pe=w.typedBuffer,me=null!=j&&null!=b,be=null!=E&&null!=N&&(3===O||4===O),ye=4===O,ge=null!=q&&null!=B;let xe=V[0],Be=V[1],we=V[2];for(let e=0;e<ce;++e){const t=e*de,o=pe[t],r=pe[t+1],l=pe[t+2],n=o+ue,i=r+fe,a=l+se,u=p?Math.sqrt(n*n+i*i+a*a)-d:a;h.expandElevationRangeValues(u,u);const f=Math.abs(n*I+i*U+a*K-X),s=Math.abs(n*P+i*L+a*Q-Y),c=Math.abs(n*T+i*J+a*W-Z);xe=Math.max(xe,f),Be=Math.max(Be,s),we=Math.max(we,c)
|
|
2
|
+
import{fromQuat as e}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as t,IDENTITY as o}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{transformMat3 as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as l,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{BufferViewVec3f as i,BufferViewVec2f as a,BufferViewVec4u8 as u,BufferViewVec2i16 as f}from"../../../../geometry/support/buffer/BufferView.js";import{computeNormals as s,writeAddedVerticesAndNormals as c}from"../IntegratedMeshNormals.js";import{ElevationRange as d}from"../../support/ElevationRange.js";import{VertexBufferLayoutCreationParameters as p,createVertexBufferLayout as m}from"../../webgl-engine/collections/Component/SourceGeometry.js";function b(e,t,o,r,n,i,a){const u=new Array,f=l(0,0,0),b=new d,g={origin:t,ellipsoidRadius:o,isGlobal:r,ecefRotation:n};for(const l of e){const{componentIndex:e,positionView:t,indicesView:o,texCoord0Data:r,colorView:n,normalsData:d}=l,x=t.count,B=r?1:0,w=new p(null!=n,null!=d||a,B),S=a&&null==d?s(o.typedBuffer,t.typedBuffer,t.typedBufferStride):null,V=S?.outputVertexCount??x,h=m(w),v=h.createBuffer(V),C=S?h.fields.get("normalCompressed"):null;if(null!=S&&null==C)throw new Error("computeNormals requires a reserved NORMALCOMPRESSED attribute in layout");let R;if(y(g,{texCoord0Data:r,colorView:n,packedNormalsSource:S?S.packedNormals:d??null},v,{positionView:t,tileObb:i,obbHalfSizeAccumulator:f,elevationRange:b}),null!=S){const e=h.stride/4,t=C.offset/4,o=x,r=new Uint32Array(v.buffer);c(r,e,t,r,e,o,V,S.appendedVertexToOriginal,S.packedNormals),R=S.indices}else R=o.typedBuffer;u.push({componentIndex:e,positionView:t,indicesView:o,layout:h,textureCoordinateType:B,interleavedVertexData:v.buffer,indices:R})}return{vertexProcessingOutputs:u,obbHalfSizeAccumulator:f,elevationRange:b}}function y(t,l,n,s){const{origin:c,ellipsoidRadius:d,isGlobal:p,ecefRotation:m}=t,{texCoord0Data:b,colorView:y,packedNormalsSource:B}=l,{positionView:w,tileObb:S,obbHalfSizeAccumulator:V,elevationRange:h}=s,v=n.getField("position",i),C=v.typedBuffer,R=v.typedBufferStride,M=null!=b?n.getField("uv0",a):null,j=M?.typedBuffer,A=M?.typedBufferStride??0,N=y?.typedBuffer,O=y?.elementCount??0,D=null!=y?n.getField("color",u):null,E=D?.typedBuffer,k=D?.typedBufferStride??0,F=null!=B?n.getField("normalCompressed",f):null,q=null!=F?new Uint32Array(F.typedBuffer.buffer,F.typedBuffer.byteOffset,F.typedBuffer.length/2):null,z=null!=F?F.typedBufferStride/2:0,G=e(x,S.quaternionConjugate),H=r(g,S.center,G),I=G[0],P=G[1],T=G[2],U=G[3],L=G[4],J=G[5],K=G[6],Q=G[7],W=G[8],X=H[0],Y=H[1],Z=H[2],$=m[0],_=m[1],ee=m[2],te=m[3],oe=m[4],re=m[5],le=m[6],ne=m[7],ie=m[8],ae=m!==o,ue=c[0],fe=c[1],se=c[2],ce=w.count,de=w.typedBufferStride,pe=w.typedBuffer,me=null!=j&&null!=b,be=null!=E&&null!=N&&(3===O||4===O),ye=4===O,ge=null!=q&&null!=B;let xe=V[0],Be=V[1],we=V[2];for(let e=0;e<ce;++e){const t=e*de,o=pe[t],r=pe[t+1],l=pe[t+2],n=o+ue,i=r+fe,a=l+se,u=p?Math.sqrt(n*n+i*i+a*a)-d:a;h.expandElevationRangeValues(u,u);const f=Math.abs(n*I+i*U+a*K-X),s=Math.abs(n*P+i*L+a*Q-Y),c=Math.abs(n*T+i*J+a*W-Z);xe=Math.max(xe,f),Be=Math.max(Be,s),we=Math.max(we,c),ae&&(pe[t]=o*$+r*te+l*le,pe[t+1]=o*_+r*oe+l*ne,pe[t+2]=o*ee+r*re+l*ie);const m=e*R;if(C[m]=o,C[m+1]=r,C[m+2]=l,me){const t=2*e,o=e*A;j[o]=b[t],j[o+1]=b[t+1]}if(be){const t=e*k;if(ye){const o=4*e;E[t]=N[o],E[t+1]=N[o+1],E[t+2]=N[o+2],E[t+3]=N[o+3]}else{const o=3*e;E[t]=N[o],E[t+1]=N[o+1],E[t+2]=N[o+2],E[t+3]=255}}ge&&(q[e*z]=B[e])}V[0]=xe,V[1]=Be,V[2]=we}const g=n(),x=t();export{b as processTiles3DVertices};
|
package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as
|
|
2
|
+
import{__decorate as e}from"tslib";import{isColorHighlightOrOLID as t}from"../../../core/shaderLibrary/ShaderOutput.js";import{parameter as o}from"../../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{SphereDepthInterpolateConfiguration as i}from"../../../shaders/SphereDepthInterpolate.glsl.js";class s extends i{constructor(e){super(),this.output=0,this.textureCoordinateType=0,this.componentDataType=0,this.cullFace=2,this.vertexDiscardMode=0,this.doubleSidedMode=2,this.alphaDiscardMode=1,this.integratedMeshMode=0,this.pbrMode=0,this.normalType=0,this.emissionSource=0,this.shadeNormals=1,this.polygonOffset=0,this.vertexPositionRotationType=1,this.vertexNormalRotationType=0,this.hasEmission=!1,this.hasVertexColors=!1,this.hasSlicePlane=!1,this.isGroundSlice=!1,this.hasColorTexture=!1,this.hasHighlightMixTexture=!1,this.emissionDimmingPass=!1,this.receiveAmbientOcclusion=!0,this.receiveGlobalIllumination=!1,this.receiveShadows=!0,this.hasShadowHighlights=!1,this.transparent=!0,this.screenSpaceReflections=!1,this.hasMetallicRoughnessTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasOccludees=!1,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.hasNormalTextureTransform=!1,this.cloudReflections=!0,this.snowCover=!1,this.renderOccluded=!1,this.enableOITOffset=!1,this.sphereDepthInterpolate=!1,this.writeDepth=!0,this.discardInvisibleFragments=!1,this.oitPremultipliedAlpha=!1,this.occlusionPass=!1,this.bindType=2,this.useCustomDTRExponentForWater=!1,this.hasVertexTangents=!1,this.hasSliceTranslatedView=!1,this.rayMarchMaxReach=1,this.rayMarchMaxSteps=75,this.useProjectedRayLength=!1,this.clampRayToScreen=!0,this.instanced=!1,this.instancedDoublePrecision=!1,this.hasModelTransformation=!1,this.useFillLights=!0,this.draped=!1,this.useTransformationTexture=!0,this.sphericalSR=e.sphericalSR,this.useFloatBlend=e.useFloatBlend}get spherical(){return 0!==this.sphericalSR}get overlayEnabled(){return(2===this.integratedMeshMode||3===this.integratedMeshMode)&&t(this.output)}get hasWater(){return 3===this.pbrMode||4===this.pbrMode||6===this.pbrMode}}e([o()],s.prototype,"useFloatBlend",void 0),e([o({count:12})],s.prototype,"output",void 0),e([o({count:3})],s.prototype,"textureCoordinateType",void 0),e([o({count:2})],s.prototype,"componentDataType",void 0),e([o({count:3})],s.prototype,"cullFace",void 0),e([o({count:3})],s.prototype,"vertexDiscardMode",void 0),e([o({count:3})],s.prototype,"doubleSidedMode",void 0),e([o({count:4})],s.prototype,"alphaDiscardMode",void 0),e([o({count:4})],s.prototype,"integratedMeshMode",void 0),e([o({count:7})],s.prototype,"pbrMode",void 0),e([o({count:3})],s.prototype,"normalType",void 0),e([o({count:8})],s.prototype,"emissionSource",void 0),e([o({count:3})],s.prototype,"shadeNormals",void 0),e([o({count:5})],s.prototype,"polygonOffset",void 0),e([o({count:3})],s.prototype,"vertexPositionRotationType",void 0),e([o({count:2})],s.prototype,"vertexNormalRotationType",void 0),e([o()],s.prototype,"hasEmission",void 0),e([o()],s.prototype,"hasVertexColors",void 0),e([o()],s.prototype,"hasSlicePlane",void 0),e([o()],s.prototype,"isGroundSlice",void 0),e([o()],s.prototype,"hasColorTexture",void 0),e([o()],s.prototype,"hasHighlightMixTexture",void 0),e([o()],s.prototype,"emissionDimmingPass",void 0),e([o()],s.prototype,"receiveAmbientOcclusion",void 0),e([o()],s.prototype,"receiveGlobalIllumination",void 0),e([o()],s.prototype,"receiveShadows",void 0),e([o()],s.prototype,"hasShadowHighlights",void 0),e([o()],s.prototype,"transparent",void 0),e([o()],s.prototype,"screenSpaceReflections",void 0),e([o()],s.prototype,"hasMetallicRoughnessTexture",void 0),e([o()],s.prototype,"hasOcclusionTexture",void 0),e([o()],s.prototype,"hasNormalTexture",void 0),e([o()],s.prototype,"hasOccludees",void 0),e([o()],s.prototype,"terrainDepthTest",void 0),e([o()],s.prototype,"cullAboveTerrain",void 0),e([o()],s.prototype,"hasNormalTextureTransform",void 0),e([o()],s.prototype,"cloudReflections",void 0),e([o()],s.prototype,"snowCover",void 0),e([o()],s.prototype,"renderOccluded",void 0),e([o()],s.prototype,"enableOITOffset",void 0),e([o()],s.prototype,"sphereDepthInterpolate",void 0);export{s as ComponentTechniqueConfiguration};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import{hasNativeFloat16Array as n}from"../../../../../geometry/support/float16.js";import{FloatBindUniform as e}from"../shaderModules/FloatBindUniform.js";import{glsl as o,If as i}from"../shaderModules/glsl.js";import{ShaderTechniqueConfiguration as u,parameter as s}from"../shaderTechnique/ShaderTechniqueConfiguration.js";function
|
|
2
|
+
import{__decorate as t}from"tslib";import{hasNativeFloat16Array as n}from"../../../../../geometry/support/float16.js";import{FloatBindUniform as e}from"../shaderModules/FloatBindUniform.js";import{glsl as o,If as i}from"../shaderModules/glsl.js";import{ShaderTechniqueConfiguration as u,parameter as s}from"../shaderTechnique/ShaderTechniqueConfiguration.js";function r(t){switch(t.elementType){case"float":switch(t.elementCount){case 1:return o`float`;case 2:return o`vec2`;case 3:return o`vec3`;case 4:return o`vec4`;case 9:return o`mat3`;default:t.elementCount}break;case"int":switch(t.elementCount){case 1:return o`int`;case 2:return o`ivec2`;case 3:return o`ivec3`;case 4:return o`ivec4`;case 9:throw new Error("Invalid element count 9 for type int");default:t.elementCount}break;case"uint":switch(t.elementCount){case 1:return o`uint`;case 2:return o`uvec2`;case 3:return o`uvec3`;case 4:return o`uvec4`;case 9:throw new Error("Invalid element count 9 for type uint");default:t.elementCount}break;default:t.elementType}throw new Error("unsupported field")}const a=new e("const_NaN",()=>NaN,{supportsNaN:!0});class c extends u{constructor(t){super(),this.supportNaN=t}}function p(t,n){const e=n?.supportNaN;e&&(t.uniforms.add(a),t.code.add(o`bool bitsEncodeFloat16NaN(highp uint bits) {
|
|
3
3
|
const highp uint nanExponent = 0x00007c00u;
|
|
4
4
|
highp uint exponent = bits & nanExponent;
|
|
5
5
|
highp uint mantissa = bits & 0x000003ffu;
|
|
@@ -12,7 +12,7 @@ return exponent == nanExponent && mantissa != 0u;
|
|
|
12
12
|
return const_NaN;
|
|
13
13
|
}`)}
|
|
14
14
|
return unpackHalf2x16(halfBits).x;
|
|
15
|
-
}`)}function
|
|
15
|
+
}`)}function f(t,n){const e=n?.supportNaN;e&&(t.uniforms.add(a),t.code.add(o`bool bitsEncodeFloat32NaN(highp uint bits) {
|
|
16
16
|
const highp uint nanExponent = 0x7f800000u;
|
|
17
17
|
highp uint exponent = bits & nanExponent;
|
|
18
18
|
highp uint mantissa = bits & 0x007fffffu;
|
|
@@ -25,4 +25,4 @@ return exponent == nanExponent && mantissa != 0u;
|
|
|
25
25
|
return const_NaN;
|
|
26
26
|
}`)}
|
|
27
27
|
return uintBitsToFloat(floatBits);
|
|
28
|
-
}`)}function
|
|
28
|
+
}`)}function l(t){const{fieldType:n}=t;return`${(0,m[n])(b(t))}`}function h(t,n){const e=[];for(let i=0;i<t.length;i+=4){const n=t[i],u=t[i+1],s=t[i+2],r=t[i+3],a=o`unpackFloat4x8(${`${n}, ${u}, ${s}, ${r}`})`;e.push(a)}return e.join(n)}function d(t){return o`vec3(${h(t,",\n\t")})`}function $(t){return o`mat3(${h(t,",\n")})`}t([s()],c.prototype,"supportNaN",void 0);const m={u8:t=>o`${t[0]}`,unorm8:t=>o`float(${t[0]})/255.0`,vec4unorm8:t=>o`vec4(${`${t[0]}, ${t[1]}, ${t[2]}, ${t[3]}`})/255.0`,f16:n?t=>o`unpackHalf2x8(${`${t[0]}, ${t[1]}`})`:t=>o`unpackFloat4x8(${`${t[0]}, ${t[1]}, ${t[2]}, ${t[3]}`})`,f32:t=>o`unpackFloat4x8(${`${t[0]}, ${t[1]}, ${t[2]}, ${t[3]}`})`,vec4u8:t=>o`uvec4(${`${t[0]}, ${t[1]}, ${t[2]}, ${t[3]}`})`,vec3f32:t=>d(t),mat3f32:t=>$(t)};function b(t){const{startTexel:n,byteOffset:e,texelByteStride:i,byteSize:u}=t;let s=n,r=e%i;const a=new Array;for(let c=0;c<u;++c){const t=o`texel${o.int(s)}.${x[r]}`;a.push(t),++r,r>=i&&(r=0,++s)}return a}const x=["x","y","z","w"];export{c as TextureBufferNaNSupportConfiguration,l as glslDecodeField,r as glslType,f as unpackFloat4x8,p as unpackHalf2x8};
|
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as o}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{DoublePrecision as e}from"../util/DoublePrecision.glsl.js";import{Float3DrawUniform as t}from"../../shaderModules/Float3DrawUniform.js";import{Float3PassUniform as a}from"../../shaderModules/Float3PassUniform.js";import{If as i,glsl as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as o}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{DoublePrecision as e}from"../util/DoublePrecision.glsl.js";import{Float3DrawUniform as t}from"../../shaderModules/Float3DrawUniform.js";import{Float3PassUniform as a}from"../../shaderModules/Float3PassUniform.js";import{If as i,glsl as s}from"../../shaderModules/glsl.js";import{IntegerDrawUniform as m}from"../../shaderModules/IntegerDrawUniform.js";import{Matrix3DrawUniform as n}from"../../shaderModules/Matrix3DrawUniform.js";import{Matrix3PassUniform as d}from"../../shaderModules/Matrix3PassUniform.js";import{Matrix4BindUniform as l}from"../../shaderModules/Matrix4BindUniform.js";import{Texture2DPassUniform as f}from"../../shaderModules/Texture2DPassUniform.js";import{NoParameters as v}from"../../../../../webgl/NoParameters.js";function c(r,o){const{attributes:v,vertex:c,varyings:w,fragment:F}=r;c.include(e),v.add("position","vec3"),w.add("vPositionWorldCameraRelative","vec3"),w.add("vPosition_view","vec3",{invariant:!0}),c.uniforms.add(new a("transformWorldFromViewTH",r=>r.transformWorldFromViewTH),new a("transformWorldFromViewTL",r=>r.transformWorldFromViewTL),new d("transformViewFromCameraRelativeRS",r=>r.transformViewFromCameraRelativeRS),new l("transformProjFromView",r=>r.camera.projectionMatrix));const{vertexPositionRotationType:u,useTransformationTexture:W}=o,T=1===u,x=2===u,p=T||x;W?c.uniforms.add(new m("transformationDrawId",r=>r.transformationDrawId),new f("transformationTexture",r=>r.transformationTexture)):(c.uniforms.add(new t("transformWorldFromModelTH",r=>r.transformWorldFromModelTH),new t("transformWorldFromModelTL",r=>r.transformWorldFromModelTL)),p&&c.uniforms.add(new n("transformWorldFromModelRS",r=>r.transformWorldFromModelRS))),c.code.add(s`
|
|
3
|
+
${i(p,s`
|
|
4
|
+
mat3 modelTransformation() {
|
|
5
|
+
${i(W,s`
|
|
6
|
+
return mat3(
|
|
7
|
+
texelFetch(transformationTexture, ivec2(2, transformationDrawId), 0).xyz,
|
|
8
|
+
texelFetch(transformationTexture, ivec2(3, transformationDrawId), 0).xyz,
|
|
9
|
+
texelFetch(transformationTexture, ivec2(4, transformationDrawId), 0).xyz
|
|
10
|
+
);`,s`return transformWorldFromModelRS;`)}
|
|
11
|
+
}
|
|
12
|
+
`)}
|
|
11
13
|
|
|
12
14
|
vec3 originL() {
|
|
13
|
-
return ${i(W,
|
|
15
|
+
return ${i(W,s`texelFetch(transformationTexture, ivec2(0, transformationDrawId), 0).xyz;`,s`transformWorldFromModelTL;`)}
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
vec3 originH() {
|
|
17
|
-
return ${i(W,
|
|
19
|
+
return ${i(W,s`texelFetch(transformationTexture, ivec2(1, transformationDrawId), 0).xyz;`,s`transformWorldFromModelTH;`)};
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
vec3 positionWorldCameraRelative() {
|
|
21
23
|
|
|
22
|
-
vec3 rotatedModelPosition = ${i(T,
|
|
24
|
+
vec3 rotatedModelPosition = ${i(T,s`modelTransformation() *`)} position;
|
|
23
25
|
|
|
24
26
|
vec3 transform_CameraRelativeFromModel = dpAdd(
|
|
25
27
|
originL(),
|
|
@@ -30,18 +32,22 @@ import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f6
|
|
|
30
32
|
|
|
31
33
|
return transform_CameraRelativeFromModel + rotatedModelPosition;
|
|
32
34
|
}
|
|
33
|
-
|
|
35
|
+
|
|
36
|
+
vec3 positionForDraping() {
|
|
37
|
+
return ${i(x,s`modelTransformation() *`)} position;
|
|
38
|
+
}
|
|
39
|
+
`),c.code.add(s`
|
|
34
40
|
void forwardPosition(float fOffset) {
|
|
35
41
|
vPositionWorldCameraRelative = positionWorldCameraRelative();
|
|
36
42
|
if (fOffset != 0.0) {
|
|
37
|
-
vPositionWorldCameraRelative += fOffset * ${o.spherical?
|
|
43
|
+
vPositionWorldCameraRelative += fOffset * ${o.spherical?s`normalize(transformWorldFromViewTL + vPositionWorldCameraRelative)`:s`vec3(0.0, 0.0, 1.0)`};
|
|
38
44
|
}
|
|
39
45
|
|
|
40
46
|
vPosition_view = transformViewFromCameraRelativeRS * vPositionWorldCameraRelative;
|
|
41
47
|
gl_Position = transformProjFromView * vec4(vPosition_view, 1.0);
|
|
42
48
|
}
|
|
43
|
-
`),F.uniforms.add(new a("transformWorldFromViewTL",r=>r.transformWorldFromViewTL)),c.code.add(
|
|
49
|
+
`),F.uniforms.add(new a("transformWorldFromViewTL",r=>r.transformWorldFromViewTL)),c.code.add(s`vec3 positionWorld() {
|
|
44
50
|
return transformWorldFromViewTL + vPositionWorldCameraRelative;
|
|
45
|
-
}`),F.code.add(
|
|
51
|
+
}`),F.code.add(s`vec3 positionWorld() {
|
|
46
52
|
return transformWorldFromViewTL + vPositionWorldCameraRelative;
|
|
47
53
|
}`)}class w extends v{constructor(){super(...arguments),this.transformWorldFromViewTH=o(),this.transformWorldFromViewTL=o(),this.transformViewFromCameraRelativeRS=r()}}class F extends v{constructor(){super(...arguments),this.transformWorldFromModelRS=r(),this.transformWorldFromModelTH=o(),this.transformWorldFromModelTL=o(),this.transformationDrawId=0}}export{c as VertexPosition,F as VertexPositionDrawParameters,w as VertexPositionPassParameters};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import{ReadDepth as e}from"../output/ReadDepth.glsl.js";import{Float2BindUniform as t}from"../../shaderModules/Float2BindUniform.js";import{FloatBindUniform as o}from"../../shaderModules/FloatBindUniform.js";import{If as r,glsl as i}from"../../shaderModules/glsl.js";import{Matrix4BindUniform as n}from"../../shaderModules/Matrix4BindUniform.js";import{Texture2DBindUniform as a}from"../../shaderModules/Texture2DBindUniform.js";function c(c,s){const d=c.fragment;d.include(e),d.uniforms.add(new t("nearFar",e=>e.camera.nearFar),new a("depthMap",e=>e.depth?.attachment),new n("proj",e=>e.camera.projectionMatrix),new o("invResolutionHeight",e=>1/e.camera.height),new n("reprojectionMatrix",e=>e.reprojection.matrix)).code.add(i`
|
|
3
|
+
vec2 reprojectionCoordinate(vec3 projectionCoordinate) {
|
|
4
|
+
vec4 clipDepthCoordinate = proj * vec4(0.0, 0.0, -projectionCoordinate.z, 1.0);
|
|
5
|
+
vec4 reprojectedCoordinate = reprojectionMatrix * vec4(
|
|
6
|
+
clipDepthCoordinate.w * (projectionCoordinate.xy * 2.0 - 1.0),
|
|
7
|
+
clipDepthCoordinate.z,
|
|
8
|
+
clipDepthCoordinate.w
|
|
9
|
+
);
|
|
10
|
+
reprojectedCoordinate.xy /= reprojectedCoordinate.w;
|
|
11
|
+
return reprojectedCoordinate.xy * 0.5 + 0.5;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
vec4 applyProjectionMat(mat4 projectionMat, vec3 viewPosition) {
|
|
15
|
+
vec4 projectedCoordinate = projectionMat * vec4(viewPosition, 1.0);
|
|
16
|
+
projectedCoordinate.xy /= projectedCoordinate.w;
|
|
17
|
+
projectedCoordinate.xy = projectedCoordinate.xy*0.5 + 0.5;
|
|
18
|
+
return projectedCoordinate;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
vec3 screenSpaceIntersectionWithLimits(
|
|
22
|
+
vec3 rayDirection,
|
|
23
|
+
vec3 startPosition,
|
|
24
|
+
vec3 viewDirection,
|
|
25
|
+
vec3 normal,
|
|
26
|
+
float rayStepOffset,
|
|
27
|
+
float rayMarchMaxReach,
|
|
28
|
+
float rayMarchMaxSteps
|
|
29
|
+
) {
|
|
30
|
+
vec3 viewPosition = startPosition;
|
|
31
|
+
|
|
32
|
+
// Project the start position to the screen
|
|
33
|
+
vec4 projectedCoordStart = applyProjectionMat(proj, viewPosition);
|
|
34
|
+
vec3 homogeneousStart = viewPosition / projectedCoordStart.w;
|
|
35
|
+
float inverseWStart = 1.0 / projectedCoordStart.w;
|
|
36
|
+
|
|
37
|
+
// Advance the position in the ray direction
|
|
38
|
+
viewPosition += rayDirection;
|
|
39
|
+
|
|
40
|
+
vec4 projectedCoordVanishingPoint = applyProjectionMat(proj, rayDirection);
|
|
41
|
+
|
|
42
|
+
// Project the advanced position to the screen
|
|
43
|
+
vec4 projectedCoordEnd = applyProjectionMat(proj, viewPosition);
|
|
44
|
+
vec3 homogeneousEnd = viewPosition / projectedCoordEnd.w;
|
|
45
|
+
float inverseWEnd = 1.0 / projectedCoordEnd.w;
|
|
46
|
+
|
|
47
|
+
// Calculate the ray direction in screen space
|
|
48
|
+
vec2 projectedCoordDirection = (projectedCoordEnd.xy - projectedCoordStart.xy);
|
|
49
|
+
vec2 vanishingPointScreenOffset = (projectedCoordVanishingPoint.xy - projectedCoordStart.xy);
|
|
50
|
+
|
|
51
|
+
float rayMarchDistance = ${s.useProjectedRayLength?"length(vanishingPointScreenOffset.xy)":"abs(vanishingPointScreenOffset.y)"};
|
|
52
|
+
float clampedRayMarchDistance = min(rayMarchDistance, rayMarchMaxReach);
|
|
53
|
+
|
|
54
|
+
float projectedCoordDirectionLength = length(projectedCoordDirection);
|
|
55
|
+
|
|
56
|
+
// normalize the projection direction depending on maximum steps
|
|
57
|
+
// this determines how blocky the ray march looks
|
|
58
|
+
vec2 projectedStep = clampedRayMarchDistance * projectedCoordDirection / (rayMarchMaxSteps * projectedCoordDirectionLength);
|
|
59
|
+
|
|
60
|
+
// Normalize the homogeneous camera space coordinates
|
|
61
|
+
vec3 homogeneousStep = clampedRayMarchDistance * (homogeneousEnd - homogeneousStart) / (rayMarchMaxSteps * projectedCoordDirectionLength);
|
|
62
|
+
float inverseWStep = clampedRayMarchDistance * (inverseWEnd - inverseWStart) / (rayMarchMaxSteps * projectedCoordDirectionLength);
|
|
63
|
+
|
|
64
|
+
// initialize the variables for ray marching
|
|
65
|
+
vec2 projectedPosition = projectedCoordStart.xy;
|
|
66
|
+
vec3 homogeneousPosition = homogeneousStart;
|
|
67
|
+
float inverseW = inverseWStart;
|
|
68
|
+
float rayStartZ = -startPosition.z; // estimated ray start depth value
|
|
69
|
+
float rayEndZ = -startPosition.z; // estimated ray end depth value
|
|
70
|
+
float previousEstimatedZ = -startPosition.z;
|
|
71
|
+
float rayDepthDelta = 0.0;
|
|
72
|
+
float estimatedDepthDifference;
|
|
73
|
+
float sampledDepth;
|
|
74
|
+
|
|
75
|
+
if (dot(normal, rayDirection) < 0.0 || dot(-viewDirection, normal) < 0.0) {
|
|
76
|
+
return vec3(projectedPosition, 0.0);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
float previousEstimatedDepthDifference = 0.0;
|
|
80
|
+
|
|
81
|
+
projectedPosition = clamp(
|
|
82
|
+
projectedPosition + rayStepOffset * projectedStep,
|
|
83
|
+
vec2(0.0),
|
|
84
|
+
vec2(0.999)
|
|
85
|
+
);
|
|
86
|
+
homogeneousPosition.z += rayStepOffset * homogeneousStep.z;
|
|
87
|
+
inverseW += rayStepOffset * inverseWStep;
|
|
88
|
+
|
|
89
|
+
int rayMarchMaxStepsInt = int(rayMarchMaxSteps);
|
|
90
|
+
for(int stepIndex = 0; stepIndex < rayMarchMaxStepsInt - 1; ++stepIndex) {
|
|
91
|
+
sampledDepth = -linearDepthFromTexture(depthMap, projectedPosition); // get linear depth from the depth buffer
|
|
92
|
+
|
|
93
|
+
// Estimate depth of the marching ray
|
|
94
|
+
rayStartZ = previousEstimatedZ;
|
|
95
|
+
estimatedDepthDifference = -rayStartZ - sampledDepth;
|
|
96
|
+
rayEndZ = (homogeneousStep.z * 0.5 + homogeneousPosition.z)/ ((inverseWStep * 0.5 + inverseW));
|
|
97
|
+
rayDepthDelta = rayEndZ - rayStartZ;
|
|
98
|
+
previousEstimatedZ = rayEndZ;
|
|
99
|
+
|
|
100
|
+
if(-rayEndZ > nearFar[1] || -rayEndZ < nearFar[0] || projectedPosition.y < 0.0 || projectedPosition.y > 1.0 ) {
|
|
101
|
+
return vec3(projectedPosition, 0.);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// If we detect a hit - return the intersection point, two conditions:
|
|
105
|
+
// - estimatedDepthDifference > 0.0 - sampled point depth is in front of estimated depth
|
|
106
|
+
// - if difference between estimatedDepthDifference and rayDepthDelta is not too large
|
|
107
|
+
// - if difference between estimatedDepthDifference and 0.025/abs(inverseW) is not too large
|
|
108
|
+
// - if the sampled depth is not behind far plane or in front of near plane
|
|
109
|
+
|
|
110
|
+
if(estimatedDepthDifference < 0.025 / abs(inverseW) + abs(rayDepthDelta) &&
|
|
111
|
+
estimatedDepthDifference > 0.0 &&
|
|
112
|
+
sampledDepth > nearFar[0] &&
|
|
113
|
+
sampledDepth < nearFar[1] &&
|
|
114
|
+
abs(projectedPosition.y - projectedCoordStart.y) > invResolutionHeight) {
|
|
115
|
+
float hitInterpolationWeight = estimatedDepthDifference / (estimatedDepthDifference - previousEstimatedDepthDifference);
|
|
116
|
+
vec2 refinedProjectedPosition = mix(projectedPosition - projectedStep, projectedPosition, 1.0 - hitInterpolationWeight);
|
|
117
|
+
if (abs(refinedProjectedPosition.y - projectedCoordStart.y) > invResolutionHeight) {
|
|
118
|
+
return vec3(refinedProjectedPosition, sampledDepth);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
return vec3(projectedPosition, sampledDepth);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
${r(!s.clampRayToScreen,"if (projectedPosition.x <= 0.0 || projectedPosition.x >= 1.0) {\n return vec3(projectedPosition, 0.0);\n }")}
|
|
126
|
+
|
|
127
|
+
// Continue with ray marching
|
|
128
|
+
projectedPosition = projectedPosition + projectedStep;
|
|
129
|
+
homogeneousPosition.z += homogeneousStep.z;
|
|
130
|
+
inverseW += inverseWStep;
|
|
131
|
+
previousEstimatedDepthDifference = estimatedDepthDifference;
|
|
132
|
+
|
|
133
|
+
${r(s.clampRayToScreen,"projectedPosition = clamp(projectedPosition, vec2(0.0), vec2(0.999));")}
|
|
134
|
+
}
|
|
135
|
+
return vec3(projectedPosition, 0.0);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
vec3 screenSpaceIntersection(vec3 rayDirection, vec3 startPosition, vec3 viewDirection, vec3 normal, float rayStepOffset) {
|
|
139
|
+
return screenSpaceIntersectionWithLimits(
|
|
140
|
+
rayDirection,
|
|
141
|
+
startPosition,
|
|
142
|
+
viewDirection,
|
|
143
|
+
normal,
|
|
144
|
+
rayStepOffset,
|
|
145
|
+
${i.float(s.rayMarchMaxReach)},
|
|
146
|
+
${i.float(s.rayMarchMaxSteps)}
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
`)}export{c as ScreenSpaceRayMarching};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{FoamColor as e}from"./FoamRendering.glsl.js";import{Gamma as o}from"./Gamma.glsl.js";import{PhysicallyBasedRenderingWater as t}from"./PhysicallyBasedRendering.glsl.js";import{distanceFadeStart as r,distanceFadeEnd as i}from"./ScreenSpaceConstants.js";import{
|
|
2
|
+
import{FoamColor as e}from"./FoamRendering.glsl.js";import{Gamma as o}from"./Gamma.glsl.js";import{PhysicallyBasedRenderingWater as t}from"./PhysicallyBasedRendering.glsl.js";import{distanceFadeStart as r,distanceFadeEnd as i}from"./ScreenSpaceConstants.js";import{ScreenSpaceRayMarching as n}from"./ScreenSpaceRayMarching.glsl.js";import{CloudsParallaxShading as a}from"../util/CloudsParallaxShading.glsl.js";import{FloatBindUniform as l}from"../../shaderModules/FloatBindUniform.js";import{glsl as d}from"../../shaderModules/glsl.js";import{Matrix4BindUniform as c}from"../../shaderModules/Matrix4BindUniform.js";import{Texture2DBindUniform as s}from"../../shaderModules/Texture2DBindUniform.js";import{ToneMapping as f}from"../../../shaders/ToneMapping.glsl.js";function m(m,v){const u=m.fragment;u.include(t,v),u.include(o),u.include(e),v.cloudReflections&&m.include(a),v.screenSpaceReflections&&m.include(n,v),u.include(f,v),u.constants.add("fresnelSky","vec3",[.02,1,15]),u.constants.add("fresnelMaterial","vec2",[.02,.1]),u.constants.add("roughness","float",.015),u.constants.add("foamIntensityExternal","float",1.7),u.constants.add("ssrIntensity","float",.65),u.constants.add("ssrHeightFadeStart","float",r),u.constants.add("ssrHeightFadeEnd","float",i),u.constants.add("waterDiffusion","float",.92),u.constants.add("waterSeaColorMod","float",.8),u.constants.add("correctionViewingPowerFactor","float",.4),u.constants.add("skyZenitColor","vec3",[.52,.68,.9]),u.constants.add("skyColor","vec3",[.67,.79,.9]),u.constants.add("cloudFresnelModifier","vec2",[1.2,.01]),u.code.add(d`PBRShadingWater shadingInfo;
|
|
3
3
|
vec3 getSkyGradientColor(in float cosTheta, in vec3 horizon, in vec3 zenit) {
|
|
4
4
|
float exponent = pow((1.0 - cosTheta), fresnelSky[2]);
|
|
5
5
|
return mix(zenit, horizon, exponent);
|
|
@@ -46,7 +46,7 @@ vec3 viewNormal = normalize(viewNormalVectorCoordinate.xyz);
|
|
|
46
46
|
vec4 viewUp = view * vec4(localUp, 0.0);
|
|
47
47
|
vec3 viewNormalCorrectedSSR = mix(viewUp.xyz, viewNormal, correctionViewingFactor);
|
|
48
48
|
vec3 reflected = normalize(reflect(viewDir, viewNormalCorrectedSSR));
|
|
49
|
-
vec3 hitCoordinate = screenSpaceIntersection(reflected, viewPosition, viewDir, viewUp.xyz, 0.0
|
|
49
|
+
vec3 hitCoordinate = screenSpaceIntersection(reflected, viewPosition, viewDir, viewUp.xyz, 0.0);
|
|
50
50
|
vec3 reflectedColor = vec3(0.0);
|
|
51
51
|
if (hitCoordinate.z > 0.0)
|
|
52
52
|
{
|