@arcgis/core 4.23.0-next.20220127 → 4.23.0-next.20220131
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0463ba46df855a92b9c0.js +1 -0
- package/assets/esri/core/workers/chunks/{8001b0e514bfffe9d7f8.js → 0c15d77d8e817cf45a9a.js} +1 -1
- package/assets/esri/core/workers/chunks/{e657ba0cab29f05d02da.js → 0cd0a6eef51fc5b9ea61.js} +1 -1
- package/assets/esri/core/workers/chunks/{e4896cf85fb2da8a9cc7.js → 17de7a324dfa7f57ad5d.js} +1 -1
- package/assets/esri/core/workers/chunks/{c36f84daa7736878418d.js → 197ec52641aed20029c6.js} +1 -1
- package/assets/esri/core/workers/chunks/{0317f37b6c8705b363fd.js → 1c733b7db092a2a88ef3.js} +1 -1
- package/assets/esri/core/workers/chunks/{9387db408f496e7dd003.js → 214910032945dd2d86b0.js} +1 -1
- package/assets/esri/core/workers/chunks/{d835b2a683fcd8aeeed8.js → 27474b007988855bea9d.js} +1 -1
- package/assets/esri/core/workers/chunks/{e93dfdede0532a89ffa5.js → 2b25fc7945a187c2bb9d.js} +1 -1
- package/assets/esri/core/workers/chunks/{5948923e07bd1662c24a.js → 37c03cfc19086ce631c6.js} +1 -1
- package/assets/esri/core/workers/chunks/44f0c3663b293afbd172.js +1 -0
- package/assets/esri/core/workers/chunks/483d5d8593d96d0f0b15.js +1 -0
- package/assets/esri/core/workers/chunks/49a1a633bb0d93764aae.js +1 -0
- package/assets/esri/core/workers/chunks/{5f1dcb6556820cd0aa31.js → 4be35af7d6babbfe9d84.js} +1 -1
- package/assets/esri/core/workers/chunks/{f9ff3eaf4eb324429fbd.js → 5457962a70bd3c557a75.js} +1 -1
- package/assets/esri/core/workers/chunks/56657f890e0f79f5d2ad.js +1 -0
- package/assets/esri/core/workers/chunks/57856b4a9b8784a69844.js +1 -0
- package/assets/esri/core/workers/chunks/{56274b37ff74ca0d68a6.js → 5d11b97b667921d67ae7.js} +1 -1
- package/assets/esri/core/workers/chunks/{ba5eb394f098968c22d2.js → 655b55ac0cd533d7e9d7.js} +1 -1
- package/assets/esri/core/workers/chunks/70d6bb3c7112cb702389.js +1 -0
- package/assets/esri/core/workers/chunks/810a763373d7f78ae398.js +1 -0
- package/assets/esri/core/workers/chunks/918bb7a7d901544a7367.js +1 -0
- package/assets/esri/core/workers/chunks/949b2269457302ffc64b.js +1 -0
- package/assets/esri/core/workers/chunks/{601e697dc7414bda128a.js → 952980635afc7ec81804.js} +1 -1
- package/assets/esri/core/workers/chunks/{e8741bf421f80213f1d3.js → 9876a1bae350795fab36.js} +1 -1
- package/assets/esri/core/workers/chunks/99619fcb772807c74f3b.js +1 -0
- package/assets/esri/core/workers/chunks/{3f343f792fd9f44d6f25.js → b3f5e91116112b0b612a.js} +1 -1
- package/assets/esri/core/workers/chunks/{9d77467aa71d345fc1b6.js → bcc01bbffaa3bb5f60a8.js} +1 -1
- package/assets/esri/core/workers/chunks/{4c76146014dc15143ba3.js → be588873c16770ceb9ef.js} +1 -1
- package/assets/esri/core/workers/chunks/d1fe53b597351dc58305.js +1 -0
- package/assets/esri/core/workers/chunks/d98dab12b71912fa397b.js +1 -0
- package/assets/esri/core/workers/chunks/{b62e3dccd9f662c0afeb.js → db3c729ce0c0b2690dc9.js} +1 -1
- package/assets/esri/core/workers/chunks/{199670a3a564ebe3bd79.js → e218bde41ffbcc5194f5.js} +1 -1
- package/assets/esri/core/workers/chunks/e21b211913aefde47e30.js +1 -0
- package/assets/esri/core/workers/chunks/{c9cbf8135e95f0f42cd9.js → e287f49184d076af17e2.js} +1 -1
- package/assets/esri/core/workers/chunks/{bde1d5b0a7717350986e.js → e4019b63a1fe74e2c842.js} +1 -1
- package/assets/esri/core/workers/chunks/{6e6a3c5866e8d8820457.js → eb82ff10cef2bde6e57f.js} +1 -1
- package/assets/esri/core/workers/chunks/ebc6f4764b82d4104c65.js +1 -0
- package/assets/esri/core/workers/chunks/{842db82733635dbf25cb.js → ee6e0db58dc64410e687.js} +1 -1
- package/assets/esri/core/workers/chunks/f0a9f161805fc7a30fc5.js +1 -0
- package/assets/esri/core/workers/chunks/f7150547d7e3259a0f29.js +981 -0
- package/assets/esri/core/workers/chunks/fc046a15466c25d081ff.js +1 -0
- package/assets/esri/images/portal/mediaservice16.png +0 -0
- package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
- package/assets/esri/widgets/Directions/t9n/Directions.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ar.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_bg.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_bs.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ca.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_cs.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_da.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_de.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_el.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_en.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_es.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_et.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_fi.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_fr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_he.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_hr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_hu.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_id.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_it.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ja.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ko.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_lt.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_lv.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_nb.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_nl.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_pl.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_pt-BR.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_pt-PT.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ro.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ru.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sk.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sl.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sv.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_th.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_tr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_uk.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_vi.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_zh-CN.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_zh-HK.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_zh-TW.json +1 -1
- package/chunks/BlendLayers.glsl.js +2 -2
- package/chunks/ChapmanAtmosphere.glsl.js +17 -17
- package/chunks/CheckerBoard.glsl.js +3 -3
- package/chunks/Clouds.glsl.js +2 -2
- package/chunks/CloudsComposition.glsl.js +1 -1
- package/chunks/ColorMaterial.glsl.js +12 -12
- package/chunks/ComponentShader.glsl.js +3 -3
- package/chunks/Compositing.glsl.js +1 -1
- package/chunks/DefaultMaterial.glsl.js +33 -33
- package/chunks/EdgeShaderProgram.glsl.js +7 -7
- package/chunks/Fog.glsl.js +10 -12
- package/chunks/HUDMaterial.glsl.js +2 -2
- package/chunks/HighlightComposition.glsl.js +5 -5
- package/chunks/ImageMaterial.glsl.js +6 -6
- package/chunks/LaserlinePath.glsl.js +8 -8
- package/chunks/LineCallout.glsl.js +6 -6
- package/chunks/MeasurementArrow.glsl.js +1 -1
- package/chunks/NativeLine.glsl.js +1 -1
- package/chunks/Path.glsl.js +5 -5
- package/chunks/Pattern.glsl.js +9 -9
- package/chunks/PointRenderer.glsl.js +14 -14
- package/chunks/Precipitation.glsl.js +2 -2
- package/chunks/RealisticTree.glsl.js +21 -21
- package/chunks/RibbonLine.glsl.js +11 -11
- package/chunks/SMAA.glsl.js +40 -40
- package/chunks/ShadedColorMaterial.glsl.js +12 -12
- package/chunks/ShadowCast.glsl.js +6 -6
- package/chunks/ShadowHighlight.glsl.js +4 -4
- package/chunks/SimpleAtmosphere.glsl.js +3 -3
- package/chunks/SlicePlaneMaterial.glsl.js +3 -3
- package/chunks/Stars.glsl.js +3 -3
- package/chunks/Terrain.glsl.js +11 -11
- package/chunks/TextureOnly.glsl.js +2 -2
- package/chunks/WaterSurface.glsl.js +5 -5
- package/chunks/boundedPlane.js +1 -1
- package/core/accessorSupport/watch.js +1 -1
- package/core/loadAll.js +1 -1
- package/geometry/support/frustum.js +1 -1
- package/geometry/support/plane.js +1 -1
- package/interfaces.d.ts +653 -55
- package/layers/RouteLayer.d.ts +4 -0
- package/layers/RouteLayer.js +1 -1
- package/layers/VectorTileLayer.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/graphics/featureConversionUtils.js +1 -1
- package/layers/support/LayerContingentValuesCache.js +1 -1
- package/layers/support/TileInfo.js +1 -1
- package/package.json +1 -1
- package/portal/PortalItem.js +1 -1
- package/rest/support/DirectionLine.d.ts +4 -0
- package/rest/support/DirectionPoint.d.ts +4 -0
- package/rest/support/RouteInfo.d.ts +4 -0
- package/rest/support/RouteInfo.js +1 -1
- package/rest/support/RouteSolveResult.d.ts +4 -0
- package/smartMapping/statistics/support/predominanceUtils.d.ts +4 -0
- package/support/revision.js +1 -1
- package/symbols/FillSymbol3DLayer.js +1 -1
- package/symbols/IconSymbol3DLayer.js +1 -1
- package/symbols/ObjectSymbol3DLayer.js +1 -1
- package/symbols/Symbol3D.js +1 -1
- package/symbols/WebStyleSymbol.js +1 -1
- package/symbols/cim/CIMSymbolRasterizer.js +1 -1
- package/symbols/support/IconSymbol3DLayerResource.js +1 -1
- package/symbols/support/ObjectSymbol3DLayerResource.js +1 -1
- package/symbols/support/Symbol3DAnchorPosition2D.js +1 -1
- package/symbols/support/Symbol3DAnchorPosition3D.js +1 -1
- package/symbols/support/Symbol3DFillMaterial.js +1 -1
- package/symbols/support/Symbol3DIconOutline.js +1 -1
- package/symbols/support/Symbol3DOutline.js +1 -1
- package/symbols/support/Thumbnail.js +1 -1
- package/symbols/support/webStyleSymbolUtils.js +1 -1
- package/views/2d/engine/vectorTiles/SchemaHelper.js +1 -1
- package/views/2d/layers/RouteLayerView2D.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.glsl.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/CloudsComposition.glsl.js +1 -1
- package/views/3d/environment/CloudsComposition.js +1 -1
- package/views/3d/environment/CloudsGenerator.js +1 -1
- package/views/3d/environment/Fog.glsl.js +1 -1
- package/views/3d/environment/Fog.js +1 -1
- package/views/3d/environment/NoiseTextureAtlas.js +1 -1
- package/views/3d/environment/PanoramicAtmosphere.js +1 -1
- package/views/3d/environment/Precipitation.glsl.js +1 -1
- package/views/3d/environment/Precipitation.js +1 -1
- package/views/3d/environment/PrecipitationTechnique.js +1 -1
- package/views/3d/environment/SimpleAtmosphere.glsl.js +1 -1
- package/views/3d/environment/SimpleAtmosphere.js +1 -1
- package/views/3d/environment/Stars.glsl.js +1 -1
- package/views/3d/environment/Stars.js +1 -1
- package/views/3d/interactive/analysisTools/slice/sliceToolUtils.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
- package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/VectorTileLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/ElevationAligners.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/graphicUtils.js +1 -1
- package/views/3d/layers/graphics/lineUtils.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/layers/graphics/polygonUtils.js +1 -1
- package/views/3d/layers/graphics/symbolComplexity.js +1 -1
- package/views/3d/layers/i3s/I3SBinaryReader.js +1 -1
- package/views/3d/layers/i3s/I3SCrossfadeHelper.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/i3s/PointRenderer.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +5 -0
- package/views/3d/layers/support/overlayImageUtils.js +1 -1
- package/views/3d/layers/support/patternUtils.js +1 -1
- package/views/3d/state/controllers/local/PinchAndPanController.js +1 -1
- package/views/3d/support/FrustumExtentIntersection.js +1 -1
- package/views/3d/support/LaserLineRenderer.js +1 -1
- package/views/3d/support/LaserlinePathData.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/PatchGeometryFactory.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/terrain/terrainUtils.js +1 -1
- package/views/3d/terrain/tileUtils.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +10 -10
- package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
- package/views/3d/webgl-engine/collections/Component/SourceGeometry.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/ScreenSizeScaling.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js +4 -4
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/PositionAttribute.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/SymbolColor.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexColor.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexNormal.glsl.js +6 -6
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +12 -12
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexTextureCoordinates.glsl.js +4 -4
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +16 -16
- package/views/3d/webgl-engine/core/shaderLibrary/default/RealisticTree.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +5 -5
- package/views/3d/webgl-engine/core/shaderLibrary/hud/HUDOcclusionPass.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/raster/BasicGrid.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeMaterialColor.glsl.js +6 -6
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeNormalTexture.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeShadingNormal.glsl.js +10 -11
- package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/MultipassGeometryTest.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/MultipassTerrainTest.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/Normals.glsl.js +6 -6
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadBaseColorTexture.glsl.js +4 -4
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +6 -6
- package/views/3d/webgl-engine/core/shaderLibrary/shading/Reprojection.glsl.js +4 -4
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceReflections.glsl.js +5 -5
- package/views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/Water.glsl.js +10 -10
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/Terrain.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/BlendLayers.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +4 -4
- package/views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js +1 -1
- package/views/3d/webgl-engine/lib/Camera.js +1 -1
- package/views/3d/webgl-engine/lib/CompositingHelper.js +1 -1
- package/views/3d/webgl-engine/lib/DefaultVertexAttributeLocations.js +1 -1
- package/views/3d/webgl-engine/lib/DefaultVertexBufferLayouts.js +1 -1
- package/views/3d/webgl-engine/lib/Geometry.js +1 -1
- package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
- package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
- package/views/3d/webgl-engine/lib/HighlightHelper.js +1 -1
- package/views/3d/webgl-engine/lib/MagnifierHelper.js +1 -1
- package/views/3d/webgl-engine/lib/Material.js +1 -1
- package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
- package/views/3d/webgl-engine/lib/SSAOHelper.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowHighlightHelper.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/SmaaRenderPass.js +1 -1
- package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/lib/Texture.js +1 -1
- package/views/3d/webgl-engine/lib/TextureUniformName.js +4 -0
- package/views/3d/webgl-engine/lib/UniformName.js +4 -0
- package/views/3d/webgl-engine/lib/VertexAttribute.js +5 -0
- package/views/3d/webgl-engine/lib/basicInterfaces.js +1 -1
- package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeShaderTechnique.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/bufferLayouts.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/RenderInstanceData.js +1 -1
- package/views/3d/webgl-engine/lib/pathGeometryUtils.js +1 -1
- package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.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/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechnique.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/SlicePlaneMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/VisualVariableMaterialParameters.js +1 -1
- package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
- package/views/3d/webgl-engine/materials/internal/DefaultBufferWriter.js +1 -1
- package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
- package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
- package/views/3d/webgl-engine/materials/internal/waterMaterialUtils.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/shaders/CheckerBoard.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/CheckerBoardTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/HighlightComposition.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HighlightTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ImageMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/LaserlinePath.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/LaserlinePathTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/LineCallout.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/LineCalloutTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/Magnifier.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/MeasurementArrow.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/NativeLine.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Pattern.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/PointRenderer.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RealisticTreeTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/SMAA.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadedColorMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowCastTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowHighlightTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/SlicePlaneMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/WaterSurface.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/AdjustProjectedPosition.glsl.js +10 -10
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/DiscardShortEdges.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeShaderProgram.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeUtil.glsl.js +21 -21
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/LineAmplitude.glsl.js +6 -6
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/LineOffset.glsl.js +13 -13
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/UnpackAttributes.glsl.js +6 -6
- package/views/SceneView.js +1 -1
- package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
- package/views/support/WatchUpdatingTracking.js +1 -1
- package/views/webgl/BufferObject.js +1 -1
- package/views/webgl/InstanceCounter.js +1 -1
- package/views/webgl/Program.js +1 -1
- package/webdoc/support/{Thumbnail.js → SlideThumbnail.js} +1 -1
- package/webmap/Bookmark.js +1 -1
- package/webmap/Version.js +1 -1
- package/webscene/Slide.js +1 -1
- package/webscene/Version.js +1 -1
- package/webscene/support/SlideVisibleLayer.js +1 -1
- package/widgets/BasemapGallery/support/basemapCompatibilityUtils.js +1 -1
- package/widgets/Bookmarks/BookmarksViewModel.js +1 -1
- package/widgets/Bookmarks.js +1 -1
- package/widgets/Directions/DirectionsViewModel.js +1 -1
- package/widgets/Directions/support/directionsUtils.js +1 -1
- package/widgets/Directions/support/resources.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
- package/widgets/Search/support/locatorUtils.js +1 -1
- package/widgets/Search.js +1 -1
- package/widgets/TimeSlider.js +1 -1
- package/assets/esri/core/workers/chunks/12c0cabb6c59e65d8546.js +0 -1
- package/assets/esri/core/workers/chunks/322d917e8cb398816a93.js +0 -1
- package/assets/esri/core/workers/chunks/392b6382e06652dd4c80.js +0 -1
- package/assets/esri/core/workers/chunks/3aa73119b055e05bbbeb.js +0 -1
- package/assets/esri/core/workers/chunks/52ea678ba1da0e349919.js +0 -1
- package/assets/esri/core/workers/chunks/5ee497d5d7b0e580526a.js +0 -1
- package/assets/esri/core/workers/chunks/663ad15b86936eb06b69.js +0 -1
- package/assets/esri/core/workers/chunks/83b8fec1650e061aaa56.js +0 -1
- package/assets/esri/core/workers/chunks/9796d54ff12b6429164a.js +0 -1
- package/assets/esri/core/workers/chunks/c093dff4592832ac0973.js +0 -1
- package/assets/esri/core/workers/chunks/d07440469fe7d181c4fd.js +0 -1
- package/assets/esri/core/workers/chunks/dbf192b4ce7e608610f6.js +0 -1
- package/assets/esri/core/workers/chunks/de6cff7b6cbbf99b20d1.js +0 -981
- package/assets/esri/core/workers/chunks/dee9929d95e9fe26929c.js +0 -1
- package/assets/esri/core/workers/chunks/e12d91ef44d6f879a02a.js +0 -1
- package/assets/esri/core/workers/chunks/e59764ee8cf25d4f74e2.js +0 -1
- package/assets/esri/core/workers/chunks/fc7e31d87555beb63291.js +0 -1
- package/assets/esri/core/workers/chunks/fff6b0338f06dad0c45d.js +0 -1
- package/widgets/Directions/support/CostSummary.js +0 -5
- package/widgets/Directions/support/RouteSection.js +0 -5
- package/widgets/Directions/support/RouteSections.js +0 -5
- package/widgets/Directions/support/maneuverUtils.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{neverReached as e}from"../../../../core/compilerUtils.js";import{isNone as r,isSome as t}from"../../../../core/maybe.js";import{defaultPrimitive as a}from"../../../../symbols/support/ObjectSymbol3DLayerResource.js";import{primitiveLodResources as s}from"./primitiveObjectSymbolUtils.js";import{hasEdges as i}from"../support/edgeUtils.js";import{VertexAttribute as o}from"../../webgl-engine/lib/
|
|
5
|
+
import{neverReached as e}from"../../../../core/compilerUtils.js";import{isNone as r,isSome as t}from"../../../../core/maybe.js";import{defaultPrimitive as a}from"../../../../symbols/support/ObjectSymbol3DLayerResource.js";import{primitiveLodResources as s}from"./primitiveObjectSymbolUtils.js";import{hasEdges as i}from"../support/edgeUtils.js";import{VertexAttribute as o}from"../../webgl-engine/lib/VertexAttribute.js";import{geometriesFromLodLevelResources as u}from"../../webgl-engine/lib/lodRendering/LodResources.js";const b={primitivesPerFeature:0,primitivesPerCoordinate:0,drawCallsPerFeature:0,estimated:!0,memory:{bytesPerFeature:0,bytesPerCoordinate:0,bytesPerFeatureLabel:0,draped:{bytesPerFeature:0,bytesPerFeatureLabel:0,bytesPerCoordinate:0}}};function P(e){if("web-style"===e.type)return b;return d(e.symbolLayers.toArray().map((r=>m(e,r))))}function d(e){let t=0,a=0,s=0,i=!1,o=0;const u={bytesPerFeature:0,bytesPerFeatureLabel:0,bytesPerCoordinate:0,draped:{bytesPerFeature:0,bytesPerFeatureLabel:0,bytesPerCoordinate:0}};for(const b of e)r(b)||(t+=b.primitivesPerFeature,a+=b.primitivesPerCoordinate,s+=b.drawCallsPerFeature,u.bytesPerFeature+=b.memory.bytesPerFeature,u.bytesPerFeatureLabel+=b.memory.bytesPerFeatureLabel,u.bytesPerCoordinate+=b.memory.bytesPerCoordinate,u.draped.bytesPerFeature+=b.memory.bytesPerFeature,u.draped.bytesPerFeatureLabel+=b.memory.bytesPerFeatureLabel,u.draped.bytesPerCoordinate+=b.memory.bytesPerCoordinate,i=i||b.estimated,++o);return{primitivesPerFeature:t,primitivesPerCoordinate:a,drawCallsPerFeature:s,estimated:i,memory:u,numComplexities:o}}function y(e){const r=d(e);return r.numComplexities>0&&(r.primitivesPerFeature/=r.numComplexities,r.primitivesPerCoordinate/=r.numComplexities,r.drawCallsPerFeature/=r.numComplexities,r.memory.bytesPerFeature/=r.numComplexities,r.memory.bytesPerFeatureLabel/=r.numComplexities,r.memory.bytesPerCoordinate/=r.numComplexities,r.memory.draped.bytesPerFeature/=r.numComplexities,r.memory.draped.bytesPerFeatureLabel/=r.numComplexities,r.memory.draped.bytesPerCoordinate/=r.numComplexities),r}const n={};function m(r,s){const o=l(r,s),u=i(s)?2:0;switch(s.type){case"extrude":return{primitivesPerFeature:-4,primitivesPerCoordinate:4,drawCallsPerFeature:u,estimated:!1,memory:o};case"fill":return"mesh-3d"===r.type?{primitivesPerFeature:0,primitivesPerCoordinate:0,drawCallsPerFeature:u,estimated:!1,memory:o}:t(s.outline)&&s.outline.size>0?{primitivesPerFeature:-4,primitivesPerCoordinate:3,drawCallsPerFeature:0,estimated:!1,memory:o}:{primitivesPerFeature:-2,primitivesPerCoordinate:1,drawCallsPerFeature:0,estimated:!1,memory:o};case"water":return{primitivesPerFeature:-2,primitivesPerCoordinate:1,drawCallsPerFeature:0,estimated:!1,memory:o};case"line":return{primitivesPerFeature:-2,primitivesPerCoordinate:2,drawCallsPerFeature:0,estimated:!1,memory:o};case"object":if(s.resource&&s.resource.href)return{primitivesPerFeature:16,primitivesPerCoordinate:0,drawCallsPerFeature:0,estimated:!0,memory:o};return{...F(s.resource&&s.resource.primitive||a),memory:o};case"path":{const r=3,t=3,a=10;let i=0,u=0;switch(s.profile){case"circle":i=a;break;case"quad":i=4;break;default:return void e(s.profile)}switch(s.join){case"round":u=r;break;case"miter":case"bevel":u=1;break;default:return void e(s.join)}const b=2*i,P=i*u*2;let d=-2*P-b;switch(s.cap){case"none":break;case"butt":case"square":d+=2*(i-1);break;case"round":d+=2*(i*(t-1)*2+i);break;default:return}return{primitivesPerFeature:d,primitivesPerCoordinate:P+b,drawCallsPerFeature:0,estimated:!1,memory:o}}case"text":case"icon":return{primitivesPerFeature:2,primitivesPerCoordinate:0,drawCallsPerFeature:0,estimated:!1,memory:o};default:return}}function l(r,a){const s="point-3d"===r.type;switch(a.type){case"extrude":return a.edges&&a.edges.size>0?C.EXTRUDE_EDGES:C.EXTRUDE;case"fill":return t(a.outline)&&a.outline.size>0?C.FILL_OUTLINE:C.FILL;case"water":return C.FILL;case"line":return"round"===a.join?C.LINE_ROUND:C.LINE_MITER;case"path":switch(a.join){case"round":switch(a.profile){case"circle":return C.PATH_ROUND_CIRCLE;case"quad":return C.PATH_ROUND_QUAD;default:return void e(a.profile)}case"miter":case"bevel":switch(a.profile){case"circle":return C.PATH_MITER_CIRCLE;case"quad":return C.PATH_MITER_QUAD;default:return void e(a.profile)}default:return void e(a.join)}case"object":return s?C.OBJECT_POINT:C.OBJECT_POLYGON;case"icon":case"text":return s?C.ICON_POINT:C.ICON_POLYGON;default:return}}function F(e){let r=n[e];if(r)return r;const t=s(e,null);return r={primitivesPerFeature:u(t.levels[0]).reduce(((e,r)=>e+r.indices.get(o.POSITION).length/3),0),primitivesPerCoordinate:0,drawCallsPerFeature:0,estimated:!1},n[e]=r,r}const C={ICON_POINT:{bytesPerFeature:7127.413186968842,bytesPerFeatureLabel:4826.302896296296,bytesPerCoordinate:0,draped:{bytesPerFeature:3929.4396628895197,bytesPerFeatureLabel:3550.1332222222227,bytesPerCoordinate:0}},ICON_POLYGON:{bytesPerFeature:9329.452613976147,bytesPerFeatureLabel:3675.3372604938268,bytesPerCoordinate:60.177252982212096,draped:{bytesPerFeature:6190.247450139383,bytesPerFeatureLabel:3744.074358024691,bytesPerCoordinate:59.488211068026104}},OBJECT_POINT:{bytesPerFeature:2350.5884192634558,bytesPerFeatureLabel:4446.651003703703,bytesPerCoordinate:0,draped:{bytesPerFeature:2350.5884192634558,bytesPerFeatureLabel:4446.651003703703,bytesPerCoordinate:0}},OBJECT_POLYGON:{bytesPerFeature:4583.807620302299,bytesPerFeatureLabel:3665.342685185186,bytesPerCoordinate:60.11621818101506,draped:{bytesPerFeature:4583.807620302299,bytesPerFeatureLabel:3665.342685185186,bytesPerCoordinate:60.11621818101506}},LINE_MITER:{bytesPerFeature:7321.028181375921,bytesPerFeatureLabel:4048.0226716049388,bytesPerCoordinate:186.55621386363578,draped:{bytesPerFeature:4246.856619435009,bytesPerFeatureLabel:3852.3737679012347,bytesPerCoordinate:163.47884002621583}},LINE_ROUND:{bytesPerFeature:7482.205842738954,bytesPerFeatureLabel:4045.886987654321,bytesPerCoordinate:191.5452524171851,draped:{bytesPerFeature:4473.481387957992,bytesPerFeatureLabel:3842.1112395061728,bytesPerCoordinate:167.27703460226945}},PATH_MITER_CIRCLE:{bytesPerFeature:9010.489006415351,bytesPerFeatureLabel:4230.9109,bytesPerCoordinate:4618.2594178027275,draped:{bytesPerFeature:9010.489006415351,bytesPerFeatureLabel:4230.9109,bytesPerCoordinate:4618.2594178027275}},PATH_ROUND_CIRCLE:{bytesPerFeature:4104.727250200398,bytesPerFeatureLabel:4251.8525,bytesPerCoordinate:8019.043777064957,draped:{bytesPerFeature:4104.727250200398,bytesPerFeatureLabel:4251.8525,bytesPerCoordinate:8019.043777064957}},PATH_MITER_QUAD:{bytesPerFeature:9416.372942261387,bytesPerFeatureLabel:4241.2757,bytesPerCoordinate:3176.7222742582203,draped:{bytesPerFeature:9416.372942261387,bytesPerFeatureLabel:4241.2757,bytesPerCoordinate:3176.7222742582203}},PATH_ROUND_QUAD:{bytesPerFeature:6614.431545308682,bytesPerFeatureLabel:4206.7461,bytesPerCoordinate:5141.817789093826,draped:{bytesPerFeature:6614.431545308682,bytesPerFeatureLabel:4206.7461,bytesPerCoordinate:5141.817789093826}},FILL:{bytesPerFeature:9478.244183633637,bytesPerFeatureLabel:3713.816824691358,bytesPerCoordinate:95.9343604185578,draped:{bytesPerFeature:6287.911108168086,bytesPerFeatureLabel:3790.785032098766,bytesPerCoordinate:83.08783220478168}},FILL_OUTLINE:{bytesPerFeature:13085.871870349445,bytesPerFeatureLabel:3392.613241975309,bytesPerCoordinate:118.63968023169875,draped:{bytesPerFeature:8437.199992480122,bytesPerFeatureLabel:3973.5431172839503,bytesPerCoordinate:106.33556817014312}},EXTRUDE:{bytesPerFeature:19459.53727140414,bytesPerFeatureLabel:3743.7045209876546,bytesPerCoordinate:372.6819978900477,draped:{bytesPerFeature:19459.53727140414,bytesPerFeatureLabel:3743.7045209876546,bytesPerCoordinate:372.6819978900477}},EXTRUDE_EDGES:{bytesPerFeature:22266.888534913724,bytesPerFeatureLabel:3064.3193358024696,bytesPerCoordinate:374.3725221561312,draped:{bytesPerFeature:22266.888534913724,bytesPerFeatureLabel:3064.3193358024696,bytesPerCoordinate:374.3725221561312}}};export{y as averageSymbolComplexities,P as defaultSymbolComplexity,m as defaultSymbolLayerComplexity,l as defaultSymbolLayerMemoryComplexity,b as emptySymbolComplexity,C as memoryEstimators,d as totalSymbolComplexities};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/Error.js";import{clone as t}from"../../../../core/lang.js";import n from"../../../../core/Logger.js";import{decodeRGB as r,decodeIntensity as o}from"./LEPCC.js";import{VertexAttribute as i}from"../../webgl-engine/lib/
|
|
5
|
+
import e from"../../../../core/Error.js";import{clone as t}from"../../../../core/lang.js";import n from"../../../../core/Logger.js";import{decodeRGB as r,decodeIntensity as o}from"./LEPCC.js";import{VertexAttribute as i}from"../../webgl-engine/lib/VertexAttribute.js";const u=n.getLogger("esri.views.3d.layers.i3s.I3SBinaryReader");function a(t,n,r){let o="",i=0;for(;i<r;){const u=t[n+i];if(u<128)o+=String.fromCharCode(u),i++;else if(u>=192&&u<224){if(i+1>=r)throw new e("utf8-decode-error","UTF-8 Decode failed. Two byte character was truncated.");const a=(31&u)<<6|63&t[n+i+1];o+=String.fromCharCode(a),i+=2}else if(u>=224&&u<240){if(i+2>=r)throw new e("utf8-decode-error","UTF-8 Decode failed. Multi byte character was truncated.");const a=(15&u)<<12|(63&t[n+i+1])<<6|63&t[n+i+2];o+=String.fromCharCode(a),i+=3}else{if(!(u>=240&&u<248))throw new e("utf8-decode-error","UTF-8 Decode failed. Invalid multi byte sequence.");{if(i+3>=r)throw new e("utf8-decode-error","UTF-8 Decode failed. Multi byte character was truncated.");const a=(7&u)<<18|(63&t[n+i+1])<<12|(63&t[n+i+2])<<6|63&t[n+i+3];if(a>=65536){const e=55296+(a-65536>>10),t=56320+(1023&a);o+=String.fromCharCode(e,t)}else o+=String.fromCharCode(a);i+=4}}}return o}function s(e,t){const n={byteOffset:0,byteCount:0,fields:Object.create(null)};let r=0;for(let o=0;o<t.length;o++){const i=t[o],u=i.valueType||i.type,a=h[u];n.fields[i.property]=a(e,r),r+=m[u].BYTES_PER_ELEMENT}return n.byteCount=r,n}function c(t,n,r){const o=[];let i,u,s=0;for(u=0;u<t;u+=1){if(i=n[u],i>0){if(o.push(a(r,s,i-1)),0!==r[s+i-1])throw new e("string-array-error","Invalid string array: missing null termination.")}else o.push(null);s+=i}return o}function f(e,t){return new(0,m[t.valueType])(e,t.byteOffset,t.count*t.valuesPerElement)}function l(e,t){return new Uint8Array(e,t.byteOffset,t.byteCount)}function b(n,r,o){const i=null!=r.header?s(n,r.header):{byteOffset:0,byteCount:0,fields:{count:o}},u={header:i,byteOffset:i.byteCount,byteCount:0,entries:Object.create(null)};let a=i.byteCount;for(let s=0;s<r.ordering.length;s++){const n=r.ordering[s],o=t(r[n]);if(o.count=i.fields.count,"String"===o.valueType){if(o.byteOffset=a,o.byteCount=i.fields[n+"ByteCount"],"UTF-8"!==o.encoding)throw new e("unsupported-encoding","Unsupported String encoding.",{encoding:o.encoding})}else{if(!A(o.valueType))throw new e("unsupported-value-type","Unsupported binary valueType",{valueType:o.valueType});{const e=O(o.valueType);a+=a%e!=0?e-a%e:0,o.byteOffset=a,o.byteCount=e*o.valuesPerElement*o.count}}a+=o.byteCount,u.entries[n]=o}return u.byteCount=a-u.byteOffset,u}function d(t,n,r){if(n!==t&&u.error(`Invalid ${r} buffer size\n expected: ${t}, actual: ${n})`),n<t)throw new e("buffer-too-small","Binary buffer is too small",{expectedSize:t,actualSize:n})}function y(e){return{isDraco:!1,isLegacy:!1,color:null!=e.color,normal:null!=e.normal,uv0:null!=e.uv0,uvRegion:null!=e.uvRegion,featureIndex:null!=e.faceRange&&null!=e.featureId}}function g(e,t){const n=s(e,t&&t.header);let r=n.byteCount;const o={isDraco:!1,header:n,byteOffset:n.byteCount,byteCount:0,vertexAttributes:{}},i=n.fields,u=null!=i.vertexCount?i.vertexCount:i.count;for(const s of t.ordering){if(!t.vertexAttributes[s])continue;const e={...t.vertexAttributes[s],byteOffset:r,count:u},n=C[s]?C[s]:"_"+s;o.vertexAttributes[n]=e,r+=O(e.valueType)*e.valuesPerElement*u}const a=i.faceCount;if(t.faces&&a){o.faces={};for(const e of t.ordering){if(!t.faces[e])continue;const n={...t.faces[e],byteOffset:r,count:a};o.faces[e]=n,r+=O(n.valueType)*n.valuesPerElement*a}}const c=i.featureCount;if(t.featureAttributes&&t.featureAttributeOrder&&c){o.featureAttributes={};for(const e of t.featureAttributeOrder){if(!t.featureAttributes[e])continue;const n={...t.featureAttributes[e],byteOffset:r,count:c};o.featureAttributes[e]=n;r+=("UInt64"===n.valueType?8:O(n.valueType))*n.valuesPerElement*c}}return d(r,e.byteLength,"geometry"),o.byteCount=r-o.byteOffset,o}function w(e,t){return!(!e||!e.compressedAttributes||"draco"!==e.compressedAttributes.encoding)?v(e.compressedAttributes.attributes):e?y(e):p(t)}function p(e){const t={isDraco:!1,isLegacy:!0,color:!1,normal:!1,uv0:!1,uvRegion:!1,featureIndex:!1};for(const n of e.ordering)if(e.vertexAttributes[n])switch(n){case"position":break;case"normal":t.normal=!0;break;case"color":t.color=!0;break;case"uv0":t.uv0=!0;break;case"region":t.uvRegion=!0}return e.featureAttributes&&e.featureAttributeOrder&&(t.featureIndex=!0),t}function v(e){const t={isDraco:!0,isLegacy:!1,color:!1,normal:!1,uv0:!1,uvRegion:!1,featureIndex:!1};for(const n of e)switch(n){case"position":break;case"normal":t.normal=!0;break;case"uv0":t.uv0=!0;break;case"color":t.color=!0;break;case"uv-region":t.uvRegion=!0;break;case"feature-index":t.featureIndex=!0}return t}const C={position:i.POSITION,normal:i.NORMAL,color:i.COLOR,uv0:i.UV0,region:i.UVREGION};function I(t,n,i){if("lepcc-rgb"===t.encoding)return r(n);if("lepcc-intensity"===t.encoding)return o(n);if(null!=t.encoding&&""!==t.encoding)throw new e("unknown-attribute-storage-info-encoding","Unknown Attribute Storage Info Encoding");t["attributeByteCounts "]&&!t.attributeByteCounts&&(u.warn("Warning: Trailing space in 'attributeByteCounts '."),t.attributeByteCounts=t["attributeByteCounts "]),"ObjectIds"===t.ordering[0]&&t.hasOwnProperty("objectIds")&&(u.warn("Warning: Case error in objectIds"),t.ordering[0]="objectIds");const a=b(n,t,i);d(a.byteOffset+a.byteCount,n.byteLength,"attribute");const s=a.entries.attributeValues||a.entries.objectIds;if(s){if("String"===s.valueType){const e=a.entries.attributeByteCounts,t=f(n,e),r=l(n,s);return c(e.count,t,r)}return f(n,s)}throw new e("bad-attribute-storage-info","Bad attributeStorageInfo specification.")}const m={Float32:Float32Array,Float64:Float64Array,UInt8:Uint8Array,Int8:Int8Array,UInt16:Uint16Array,Int16:Int16Array,UInt32:Uint32Array,Int32:Int32Array},h={Float32:(e,t)=>new DataView(e,0).getFloat32(t,!0),Float64:(e,t)=>new DataView(e,0).getFloat64(t,!0),UInt8:(e,t)=>new DataView(e,0).getUint8(t),Int8:(e,t)=>new DataView(e,0).getInt8(t),UInt16:(e,t)=>new DataView(e,0).getUint16(t,!0),Int16:(e,t)=>new DataView(e,0).getInt16(t,!0),UInt32:(e,t)=>new DataView(e,0).getUint32(t,!0),Int32:(e,t)=>new DataView(e,0).getInt32(t,!0)};function A(e){return m.hasOwnProperty(e)}function O(e){return A(e)?m[e].BYTES_PER_ELEMENT:0}export{b as createAttributeDataIndex,w as createGeometryDescriptor,v as createGeometryDescriptorForDraco,y as createGeometryDescriptorFromDefinition,p as createGeometryDescriptorFromSchema,g as createGeometryIndexFromSchema,l as createRawView,f as createTypedView,O as getBytesPerValue,A as isValueType,I as readBinaryAttribute,s as readHeader,c as readStringArray,h as valueType2ArrayBufferReader,m as valueType2TypedArrayClassMap};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{removeMaybe as e,isSome as s}from"../../../../core/maybe.js";import{addFrameTask as
|
|
5
|
+
import{removeMaybe as e,isSome as s,isNone as o}from"../../../../core/maybe.js";import{addFrameTask as d}from"../../../../core/scheduling.js";import{FadeDirection as i}from"../support/I3SLayerView.js";class t{constructor(){this.lodCrossfadeSignedDuration=0}}class a{constructor(e){this.view=e,this._preRenderFrameTaskHandle=null,this._currentFrameStartTime=null,this._numFadingNodes=0}get updating(){return this._numFadingNodes>0}stopNodeFading(s){null!=s.lodCrossfadeProgress&&(this._numFadingNodes--,s.lodCrossfadeProgress=null,0===this._numFadingNodes&&(null!=this._preRenderFrameTaskHandle&&(this._preRenderFrameTaskHandle=e(this._preRenderFrameTaskHandle)),this.view.notifyLODUpdate(),this.view.notifyUpdate()))}_startNodeFading(e,s,o){0===this._numFadingNodes&&(this._preRenderFrameTaskHandle=d({preRender:e=>this._updateAllNodeFading(e)}),this.view.notifyLODUpdate()),null==e.lodCrossfadeProgress&&(this._numFadingNodes++,this.view.notifyUpdate()),e.lodCrossfadeSignedDuration=o,e.lodCrossfadeProgress=s}_updateAllNodeFading(e){const o=this.view.nodeCrossfadingEnabled;this.view.foreachCrossfadeNode(((d,i)=>{if(s(i)&&s(i.lodCrossfadeProgress)){const s=i.lodCrossfadeSignedDuration,t=s>0?this.view.fullOpacity:0,a=e.deltaTime/s,r=i.lodCrossfadeProgress+Math.abs(a),n=!o||r>=1||0===s,l=t-(n?0:s>0?1:-1)*(1-r);n?(this.stopNodeFading(i),s<0&&this.view.markNodeToRemove(d)):i.lodCrossfadeProgress=r,this.view.setNodeOpacityByIndex(d,l)}})),this.view.removeMarkedNodes()}stopAllNodeFading(){this.view.foreachCrossfadeNode(((e,o)=>{if(s(o)&&s(o.lodCrossfadeProgress)){this.stopNodeFading(o);const s=o.lodCrossfadeSignedDuration;s<0&&this.view.markNodeToRemove(e);const d=s>0?this.view.fullOpacity:0;this.view.setNodeOpacityByIndex(e,d)}})),this.view.removeMarkedNodes()}fadeNode(e,s,o,d){null==this._currentFrameStartTime&&(this._currentFrameStartTime=Date.now());const t=this.view,a=t.nodeCrossfadingEnabled,n=o===i.FadeIn?t.fullOpacity:0,l=a?d?o===i.FadeIn?t.lodCrossfadeinDuration:t.lodCrossfadeoutDuration:t.lodCrossfadeUncoveredDuration:0,h=this.view.getNodeOpacityByIndex(e);if(a&&h!==n&&l>0){const e=1-Math.abs(n-h);this._startNodeFading(s,e,r(o)*l)}else this.stopNodeFading(s),this.view.setNodeOpacityByIndex(e,n),o===i.FadeOut&&this.view.removeNode(e)}isNodeFullyFadedIn(e){const s=this.view.getNodeCrossfadeMetaData(e);return o(s)||null==s.lodCrossfadeProgress&&this.view.getNodeOpacityByIndex(e)===this.view.fullOpacity}}function r(e){return e===i.FadeIn?1:-1}export{a as I3SCrossfadeHelper,t as NodeCrossfadeMetaData};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isSome as e,isNone as t,unwrap as i}from"../../../../core/maybe.js";import s from"../../../../core/PooledArray.js";import{isAbortError as r}from"../../../../core/promiseUtils.js";import{l as n}from"../../../../chunks/vec3.js";import{d as o}from"../../../../chunks/vec4f64.js";import{LodMetric as a,NodeBase as d,Node as l,NodeFilterImpact as h,NodeIMModificationImpact as u,NodeTraversalState as c}from"./I3SNode.js";import{addWraparound as g}from"./I3SUtil.js";import{clone as _}from"../../support/orientedBoundingBox.js";class m{constructor(e,t,i,s,r){this.childOffset=e,this.childCount=t,this.visibilityCache=i,this.ref=s,this.node=r,this.useAsHole=0,this.filterImpact=h.NotChecked}}class f{constructor(e,t,i,r,n,o,d,l,h,u,c,g,_,m){this.streamDataController=i,this.viewportQueries=r,this.logger=n,this.holeFilling=o,this._isLoaded=d,this._isReloading=l,this._isSelected=h,this._enable=u,this._needsUpdate=c,this._canRequest=g,this._computeVisibilityObb=_,this._computeNodeFiltering=m,this._dirty=!0,this._nodePages=[],this.nodeCount=0,this.nodesPerPage=0,this.rootIndex=0,this.lodMetric=a.None,this._lodConversion=e=>e,this.urlPrefix="",this._loading=new Set,this._failedNodes=new Set,this._failedPages=new Set,this._indexMissing=1,this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.POSITIVE_INFINITY,this._nodeTraversalState=new Map,this._version=P(0),this._visibilityCacheVersion=P(0),this._maxLevel=1,this._featureEstimate={estimate:0,leavesReached:!1},this._unloadedMemoryEstimate=0,this._missing=new s({deallocator:null}),this._prefetch=new s({deallocator:null}),this._updates=new b(this._missing),this._imModificationUncategorized=new s({deallocator:null}),this.ignoreServiceObb=!1,this.progressiveLoadPenalty=0,this.layerHasModifications=!1,this._layerHasFilter=!1,this.logLayer=e,e.serviceUpdateTimeStamp&&e.serviceUpdateTimeStamp.lastUpdate&&(this.lastUpdate=`${e.serviceUpdateTimeStamp.lastUpdate}`),this._maxLodLevel=this.viewportQueries?this.viewportQueries.maxLodLevel:1,this._init(t)}_init(e){if("page"===e.type){switch(this.urlPrefix=e.urlPrefix,this.nodesPerPage=e.pageSize,this.rootIndex=e.rootIndex,e.lodMetric){case"maxScreenThreshold":this.lodMetric=a.MaxScreenThreshold;break;case"maxScreenThresholdSQ":this.lodMetric=a.MaxScreenThreshold,this._lodConversion=V}this._addPage(C(this.rootIndex,this.nodesPerPage),e.rootPage)}else if("node"===e.type){this.urlPrefix=e.urlPrefix,this._nodePages.push({nodes:[],children:[],parents:[]}),this._makeRefNode(new d(e.rootNode.id,null),-1);const t=this._validateNode(e.rootNode.id,e.rootNode);t&&this._addNode(t,0)}}_loadPage(e){this._loading.add(e);const t=this.urlPrefix+e;this.streamDataController.request(t,"json").then((t=>{this._loading.delete(e),this._addPage(e,t)})).catch((t=>{this._loading.delete(e),r(t)||(this._failedPages.add(e),this.logger.error("#loadPage()",this.logLayer,`Error when loading page ${e}`,t))}))}_addPage(e,t){for(let n=this._nodePages.length;n<e;n++)this._nodePages[n]=null;const i=[],s=[],r=t.nodes.map(((t,r)=>{const a=i.length,d=t.children?t.children.length:0;s.push(-1);for(let e=0;e<d;e++)i.push(t.children[e]);const h=`${t.index}`,u=_(t.obb),c=o([u.center[0],u.center[1],u.center[2],n(u.halfSize)]),g=t.mesh&&t.mesh.attribute,f=t.mesh&&t.mesh.geometry,v=t.mesh&&t.mesh.material,b={hasSharedResource:!1,hasFeatureData:!!f,attributes:g&&null!=g.resource?`${g.resource}`:null,geometry:f&&null!=f.resource?`${f.resource}`:null,texture:v&&null!=v.resource?`${v.resource}`:null,geometryDefinition:f?f.definition:-1,materialDefinition:v?v.definition:-1},p=new l(h,e*this.nodesPerPage+r,c,d,0,b,this.lastUpdate,this.lodMetric,this._lodConversion(t.lodThreshold),f?f.featureCount:null);return p.serviceObb=u,p.visibilityObb=this._computeVisibilityObb(p),p.vertexCount=f?f.vertexCount:0,new m(a,d,y(this._visibilityCacheVersion),null,p)}));this._nodePages[e]={nodes:r,children:i,parents:s},this.nodeCount+=r.length,this._updateParentsAndLevel()}_updateParentsAndLevel(){const t=new Array,i=(i,s,r)=>{const n=this._getPage(i);if(e(n)){const o=w(i,this.nodesPerPage);n.parents[o]=s;const a=n.nodes[o].node;e(a)&&(a.level=r,t.push(i))}};for(i(this.rootIndex,-1,0);t.length;){const s=t.pop(),r=this.getNode(s);if(e(r))for(let e=0;e<r.childCount;e++){i(this.getChildIndex(r,e),s,r.level+1),this._maxLevel=Math.max(this._maxLevel,r.level+1)}}}_getPage(e){return this._nodePages[C(e,this.nodesPerPage)]}_getNodeInternal(e){const i=this._getPage(e);return t(i)?null:i.nodes[w(e,this.nodesPerPage)]}_addNode(t,s){null!=t.children&&this.populateChildren(s,t.children);const r=this.getParent(s),n=e(r)?r.level+1:0;this._maxLevel=Math.max(this._maxLevel,t.children?n+1:n);const{lodMetric:a,maxError:d}=S(t.lodSelection),h=i(this._getNodeInternal(s));return h.node=new l(t.id,s,o(t.mbs),h.childCount,n,t.resources,t.version,a,d,t.numFeatures),t.obb&&(h.node.serviceObb=_(t.obb)),h.node.visibilityObb=this._computeVisibilityObb(h.node),e(h.ref)&&(null==h.ref.mbs&&(h.ref.mbs=t.mbs),h.node.renderMbs=h.ref.renderMbs,h.node.serviceObbInRenderSR=h.ref.serviceObbInRenderSR,h.ref.visibilityObb=h.node.visibilityObb),h.node}_makeRefNode(t,i){const s=this._nodePages[0],r=s.nodes.length;return s.nodes.push(new m(0,0,y(this._visibilityCacheVersion),t,null)),this.nodeCount++,s.parents.push(i),t.renderMbs[3]=-1,e(t.serviceObbInRenderSR)&&(t.serviceObbInRenderSR.halfSize[0]=-1),r}populateChildren(e,t){const s=i(this._getNodeInternal(e)),r=i(this._getPage(e));s.childOffset=r.children.length,s.childCount=t.length;for(let i=0;i<t.length;i++){const s=this._makeRefNode(t[i],e);r.children.push(s)}}getNode(t){const i=this._getNodeInternal(t);return e(i)?i.node:null}getIndexById(t){let i;return this._forAllNodes(((s,r)=>{(e(s.node)&&s.node.id===t||e(s.ref)&&s.ref.id===t)&&(i=r)})),i}getNodeById(e){const t=this.getIndexById(e);return t>=0?this.getNode(t):null}getChildIndex(e,i){const s=this._getPage(e.index);if(t(s))return-1;const r=s.nodes[w(e.index,this.nodesPerPage)];return s.children[r.childOffset+i]}getParentIndex(t){const i=this._getPage(t);return e(i)?i.parents[w(t,this.nodesPerPage)]:-1}getParent(e){return(e=this.getParentIndex(e))>=0?this.getNode(e):null}isLeaf(t){const i=this._getNodeInternal(t);return e(i)&&0===i.childCount}get rootNode(){return this.getNode(this.rootIndex)}get size(){return this.nodeCount}invalidateVisibilityCache(){this._visibilityCacheVersion=P(this._visibilityCacheVersion)}invalidateNodeVisibilityCache(t){const i=this._getNodeInternal(t);e(i)&&this.invalidateNodeVisibilityCacheInternal(i)}invalidateNodeVisibilityCacheInternal(e){e.visibilityCache=y(this._visibilityCacheVersion)}invalidateBoundingVolumeCache(t){const i=this._getNodeInternal(t);e(i)&&(p(i),this.invalidateNodeVisibilityCacheInternal(i))}invalidateGeometryVisibility(t){const i=this._getNodeInternal(t);e(i)&&e(i.node)&&(i.node.geometryObb=null,i.node.renderMbs[3]=-1,e(i.node.serviceObbInRenderSR)&&(i.node.serviceObbInRenderSR.halfSize[0]=-1))}invalidateVisibilityObbs(){t(this.rootNode)||this.traverse(this.rootNode,(e=>(e.visibilityObb=this._computeVisibilityObb(e),e.geometryObb=null,!0)))}isNodeVisible(i){const s=this._getNodeInternal(i);if(t(s)||e(s.ref)&&!s.ref.mbs)return!0;if(!x(s.visibilityCache,this._visibilityCacheVersion)){const i=s.node,r=e(i)&&(t(s.ref)||e(i.visibilityObb))?i:e(s.ref)?s.ref:null;if(this._layerHasFilter&&this._computeNodeFiltering&&(e(i)||e(s.ref))&&s.filterImpact===h.NotChecked){const t=e(i)?i.mbs:e(s.ref)?s.ref.mbs:null;s.filterImpact=null!=t?this._computeNodeFiltering(t):h.Unmodified}const n=e(i)&&s.filterImpact===h.Culled,o=!(e(i)&&i.imModificationImpact===u.Culled)&&(!r||this.viewportQueries.isNodeVisible(r))&&!n;return s.visibilityCache=N(o,this._visibilityCacheVersion),o}return I(s.visibilityCache)}isGeometryVisible(t){if(!this.isNodeVisible(t))return!1;const i=this._getNodeInternal(t);return!(e(i)&&e(i.node)&&e(i.node.geometryObb)&&(!this.layerHasModifications||i.node.imModificationImpact!==u.NotChecked))||this.viewportQueries.isGeometryVisible(i.node)}_traverseCoverage(s,r,n,o,a){const d=this._getPage(s);if(t(d)||0===r.childCount)return;const l=r.childOffset+r.childCount,h=new Array;for(let t=r.childOffset;t<l;++t){const i=d.children[t],s=this._getNodeInternal(i);e(s)&&e(s.node)&&this.isGeometryVisible(i)&&h.push(s)}o/=h.length;for(const e of h){const t=i(e.node).index;this._isLoaded(t)||this._isReloading(t)?(a.delta=Math.max(a.delta,n),a.coverage+=o):this._traverseCoverage(t,e,n+1,o,a)}}useNodeAsHole(e){if("off"===this.holeFilling)return!1;const i=this._getNodeInternal(e);if(t(i))return!1;if("always"===this.holeFilling)return!0;if(x(i.useAsHole,this._version))return I(i.useAsHole);const s={delta:0,coverage:0};this._traverseCoverage(e,i,0,1,s);const r=s.delta*s.coverage<=.5;return i.useAsHole=N(r,this._version),r}get maxLevel(){return this._maxLevel}get dirty(){return this._dirty}destroy(){this._updates.add.prune(),this._updates.update.prune()}requestUpdate(){this._dirty=!0,this._indexMissing=1,this._version=P(this._version)}imModificationsChanged(t){this.layerHasModifications=t,this._forAllNodes((({node:t})=>{e(t)&&(t.imModificationImpact=u.NotChecked,t.visibilityObb=this._computeVisibilityObb(t),t.hasModifications&&this.invalidateGeometryVisibility(t.index))})),this.invalidateVisibilityCache()}layerFilterChanged(t){this._layerHasFilter=t,this._forAllNodes((t=>{if(e(t)){t.filterImpact=h.NotChecked;const i=t.node;e(i)&&this.invalidateNodeVisibilityCache(i.index)}})),this.invalidateVisibilityCache()}update(s,r,n){if(!this._dirty)return;this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.NEGATIVE_INFINITY,this._missing.clear(),this._prefetch.clear(),this._updates.reset(s),v.clear();let o=!0;const a=new O,d=new O,l=this._imModificationUncategorized;l.clear();const h=new Set,c=(c,g,_)=>{if(t(g)){let e=this._entryPriority(c);e===1/0&&(e=this._entryPriority(_));const t=C(c,this.nodesPerPage);return v.set(t,Math.max(e,v.get(t)||0)),this._loading.has(t)||this._failedPages.has(t)||this._missing.push(t),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e))}const m=g.node;if(this._updateNodeFeatureEstimate(m,d),t(m)){const e=this._entryPriority(c);return this._loading.has(c)||this._failedNodes.has(c)||(this._missing.push(c),v.set(c,e)),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e))}const f=i(this._getPage(c));if(0===this._missing.length&&0===this.nodesPerPage)for(let t=0;t<g.childCount;t++){const i=f.children[g.childOffset+t],s=this._getNodeInternal(i);!e(s)||s.node||this._loading.has(i)||this._failedNodes.has(i)||(v.set(i,this._entryPriority(i)),this._prefetch.push(i))}if(m.failed||!m.resources.hasFeatureData)return;if(h.add(m.id),this._isLoaded(c)){if(a.known+=m.memory,++a.knownNodes,this._isSelected(m)?g.childCount>0&&(o=!1):(a.unremoved+=m.memory,o=!1),this._needsUpdate(m)){const e=this._entryPriority(c);v.set(c,e),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e),this._updates.update.push(c)}return}if(m.memory&&(a.known+=m.memory,++a.knownNodes),!this._isSelected(m))return void(this._isReloading(c)&&this._updates.remove.push(c));if(g.childCount>0&&(o=!1),m.memory?(a.missing+=m.memory,a.known+=m.memory,++a.knownNodes):++a.missingNodes,s.indexOf(m.index)>=0)return this._maxProcessingPrio=Math.max(this._maxProcessingPrio,this._entryPriority(c)),void(this._updates.cancel=this._updates.cancel.filter((e=>e!==m.index)));if(!r.done&&this._enable(m))return void r.madeProgress();const b=this._entryPriority(c);v.set(c,b),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,b),this._updates.add.push(c),this.layerHasModifications&&n&&e(m)&&m.imModificationImpact===u.NotChecked&&l.push(c)};this.traverseVisible(c);const g=this._updates.add;g.length>0&&this.layerHasModifications&&(l.length>0&&n(l),g.filterInPlace((e=>{const i=this._getNodeInternal(e),s=t(i)||t(i.node)||i.node.imModificationImpact!==u.Culled;return s||this.invalidateNodeVisibilityCache(e),s}))),this._unloadedMemoryEstimate=a.missing-a.unremoved,a.knownNodes>3&&a.missingNodes>0&&(this._unloadedMemoryEstimate+=a.known/a.knownNodes*a.missingNodes),this._unloadedMemoryEstimate=.8*Math.max(0,this._unloadedMemoryEstimate),this._featureEstimate.estimate=this._computeFeatureEstimate(d),this._featureEstimate.leavesReached=o,this._missing.sort(((e,t)=>e-t)),this._missing.filterInPlace(((e,t)=>t<1||this._missing.data[t-1]!==e)),this._missing.sort(((e,t)=>v.get(e)-v.get(t))),this._missing.length>0&&(this._maxUnloadedPrio=v.get(this._missing.back()),this._prefetch.clear()),this._updates.add.filterInPlace((e=>v.get(e)>=this._maxUnloadedPrio)).sort(((e,t)=>v.get(e)-v.get(t))),this._updates.update.sort(((e,t)=>v.get(e)-v.get(t))),this._indexMissing=this._loading.size+this._missing.length,this._dirty=this._indexMissing>0,v.clear()}checkFeatureTarget(e,t){const i=this.viewportQueries.updateScreenSpaceErrorBias(t);let s=t,r=t,n=i,o=10;for(;o--;){const i=new O;this._updateFeatureEstimate(s,i);if(this._computeFeatureEstimate(i)<=e){if(s>=t||i.missingNodes>0||0===o)break;n=s,s=.5*(s+r)}else r=s,s=.5*(s+n)}return this._version=P(this._version),this.viewportQueries.updateScreenSpaceErrorBias(i),Math.min(t,s)}_updateFeatureEstimate(t,i){this._version=P(this._version),this.viewportQueries.updateScreenSpaceErrorBias(t),this.traverseVisible(((t,s)=>this._updateNodeFeatureEstimate(e(s)&&s.node,i)))}_updateNodeFeatureEstimate(i,s){if(!(t(i)||i.failed||t(i.numFeatures)))return this._isLoaded(i.index)?(s.known+=i.numFeatures,++s.knownNodes,void(this._isSelected(i)||(s.unremoved+=i.numFeatures))):void(this._isSelected(i)&&(e(i.numFeatures)?(s.missing+=i.numFeatures,s.known+=i.numFeatures,++s.knownNodes):++s.missingNodes))}_computeFeatureEstimate(e){let t=e.known-e.unremoved;return e.knownNodes>3&&e.missingNodes>0&&(t+=e.known/e.knownNodes*e.missingNodes),Math.max(0,t)}load(){return this._load(this._missing)}prefetch(){return this._prefetch.sort(((e,t)=>v.get(e)-v.get(t))),this._load(this._prefetch)}_load(e){if(0===e.length||!this._canRequest())return!1;for(;e.length>0&&this._canRequest();)0===this.nodesPerPage?this._loadNode(e.pop()):this._loadPage(e.pop());return!0}isLoading(){return this._indexMissing>0}getIndexLoading(){return this._loading.size}getIndexMissing(){return this._indexMissing}getUnloadedMemoryEstimate(){return this._unloadedMemoryEstimate}get updates(){return this._updates}get featureEstimate(){return this._featureEstimate}nodeTraversalState(e){if(t(e))return null;let i=this._nodeTraversalState.get(e.index);if(i&&x(i.version,this._version))return i;const s=this.viewportQueries.getLodLevel(e),r=this.viewportQueries.hasLOD(e);let n=!0;if(r){const t=this.getParentIndex(e.index);if(t>=0){const e=this._nodeTraversalState.get(t);n=e&&s>e.lodLevel}else n=s>0}else n=0===e.childCount;return i?(i.lodLevel=s,i.isChosen=n,i.version=N(!0,this._version),i):(i=new c(r,n,s,N(!0,this._version)),this._nodeTraversalState.set(e.index,i),i)}_loadNode(e){this._loading.add(e);const s=i(this._getNodeInternal(e)).ref;if(t(s))return void this._failedNodes.add(e);const n=s.id,o=this.urlPrefix+n,a=()=>{this._loading.delete(e),0===this._missing.length&&0===this._loading.size&&this.requestUpdate()};this.streamDataController.request(o,"json").then((t=>{a();const i=this._validateNode(n,t);if(null==i)return;i.obb&&this.invalidateNodeVisibilityCache(e);const s=this._addNode(i,e);this.nodeTraversalState(s)}),(t=>{a(),r(t)||(this.logger.error("#loadNode()",this.logLayer,"Error loading node: "+o),this._failedNodes.add(e))}))}_validateNode(e,t){if(null==t||"object"!=typeof t||t.id!==e)return this.logger.error("#validateNode()",this.logLayer,`Invalid node. Wrong type or wrong id "${e}"`),null;if(!Array.isArray(t.mbs))return this.logger.error("#validateNode()",this.logLayer,`Invalid bounding volume on node ${e}.`),null;t.sharedResource&&"./shared"!==t.sharedResource.href&&"./shared/"!==t.sharedResource.href&&this.logger.warn("#validateNode()",this.logLayer,`Invalid shared resource href on node "${e}"`),null==t.geometryData||Array.isArray(t.geometryData)&&1===t.geometryData.length&&"./geometries/0"===t.geometryData[0].href||this.logger.warn("#validateNode()",this.logLayer,`Invalid geometry data on node "${e}"`),null==t.attributeData||Array.isArray(t.attributeData)&&!t.attributeData.some(((e,t)=>e.href!==`./attributes/f_${t}/0`))||this.logger.warn("#validateNode()",this.logLayer,`Invalid attribute data on node "${e}"`),t.featureData&&t.featureData.length>1&&this.logger.warn("#validateNode()",this.logLayer,`Node ${e} has ${t.featureData.length} bundles. Only the first bundle will be loaded.`);const i=t.hasOwnProperty("obb")&&!this.ignoreServiceObb?t.obb:null,s=t.featureData&&1===t.featureData.length&&t.featureData[0].featureRange?t.featureData[0].featureRange[1]-t.featureData[0].featureRange[0]+1:null,r=t=>{if(null==t)return null;const i=t=>this.logger.error("#validateNode()",this.logLayer,`Invalid node reference on node ${e}: ${t}`);if("number"==typeof t.id)i(`id ${t.id} is a number instead of a string.`);else if("string"!=typeof t.id||!Array.isArray(t.mbs))return i("Missing or invalid id."),null;if(!Array.isArray(t.mbs))return i(`Invalid bounding volume on reference ${t.id}.`),null;t.href&&t.href!=="../"+t.id&&this.logger.error("#validateNode()",this.logLayer,`Invalid node href on node "${e}"`);const s=t.hasOwnProperty("obb")&&!this.ignoreServiceObb?t.obb:null,r=new d(`${t.id}`,t.mbs);return r.serviceObb=s,r.visibilityObb=this._computeVisibilityObb(r),r},n=Array.isArray(t.children)?t.children.map(r).filter((e=>null!=e)):null;return{id:e,mbs:t.mbs,obb:i,children:n,resources:{hasFeatureData:t.featureData&&t.featureData.length>0,hasSharedResource:null!=t.sharedResource,attributes:t.attributeData?e:null,texture:t.textureData&&t.textureData.length>0?e:null,geometry:null!=t.geometryData?e:null},version:"string"==typeof t.version?t.version:null,lodSelection:Array.isArray(t.lodSelection)?t.lodSelection:null,numFeatures:s}}resetFailedNodes(){this._failedNodes.clear(),this._failedPages.clear(),this._forAllNodes((t=>{e(t.node)&&(t.node.failed=!1)}))}_entryPriority(i){const s=this._getNodeInternal(i),r=this.getParentIndex(i);if(t(s)||r<0&&null==s.node)return r<0?1/0:this._entryPriority(r);let n=0;if(s.node&&r>=0){const e=this._nodeTraversalState.get(r);null!=e&&(n=e.lodLevel)}let o=this.progressiveLoadPenalty;for(let e=i;e>=0;e=this.getParentIndex(e))if(this._isLoaded(e)){o=0;break}const a=e(s.ref)?this.viewportQueries.distToPOI(s.ref):e(s.node)?this.viewportQueries.distToPOI(s.node):0;return-a-n*(a+this.progressiveLoadPenalty)+o}traverseVisible(e){const i=this._getNodeInternal(this.rootIndex);t(i)?e(this.rootIndex,null,null):this._traverseVisible(this.rootIndex,-1,i,e)}_traverseVisible(t,s,r,n){if(r.node&&0===r.childCount)return void(this.isGeometryVisible(t)&&n(t,r,s));if(!this.isNodeVisible(t))return;if(n(t,r,s),null==r.node)return;const o=this.nodeTraversalState(r.node);if(o.nodeHasLOD&&o.lodLevel===this._maxLodLevel)return;const a=i(this._getPage(t));for(let i=0;i<r.childCount;i++){const s=a.children[r.childOffset+i],o=this._getNodeInternal(s);e(o)?this._traverseVisible(s,t,o,n):n(s,null,t)}}traverse(e,t){t(e)&&this.traverseChildren(e,t)}traverseChildren(t,i){const s=t.index,r=this._getNodeInternal(s);e(r)&&this._traverseChildren(s,r,i)}_traverseChildren(i,s,r){const n=this._getPage(i);if(t(n))return;const o=s.childOffset+s.childCount;for(let t=s.childOffset;t<o;++t){const i=n.children[t],s=this._getNodeInternal(i);e(s)&&e(s.node)&&r(s.node)&&this._traverseChildren(i,s,r)}}updateStats(e){if(this._updates.add.length>0&&(e.nodes+=" + "+this._updates.add.length),(this._indexMissing||this._prefetch.length>0)&&(e.index+=" + "+this._indexMissing||this._prefetch.length),e.prio=this._maxProcessingPrio,this._featureEstimate.estimate){const t=this._featureEstimate.estimate-e.features;t>0?e.features+=" + "+t:t<0&&(e.features+=" - "+-t)}}getPriority(){return Math.max(this._maxProcessingPrio,this._maxUnloadedPrio)}updateElevationInfo(e){this._forAllNodes(p),this.viewportQueries.updateElevationInfo(e)}_forAllNodes(e){for(let t=0;t<this._nodePages.length;t++){const i=this._nodePages[t];if(i){const s=t*this.nodesPerPage;for(let t=0;t<i.nodes.length;t++)e(i.nodes[t],s+t)}}}get test(){return{addNode:(e,t)=>this._addNode(e,t)}}}const v=new Map;class b{constructor(e){this.missing=e,this.update=new s({deallocator:null}),this.add=new s({deallocator:null}),this.remove=new s({deallocator:null}),this.cancel=[]}reset(e){this.add.clear(),this.update.clear(),this.cancel=e}}function p(t){e(t.node)&&(t.node.renderMbs[3]=-1,e(t.node.serviceObbInRenderSR)&&(t.node.serviceObbInRenderSR.halfSize[0]=-1)),e(t.ref)&&(t.ref.renderMbs[3]=-1,e(t.ref.serviceObbInRenderSR)&&(t.ref.serviceObbInRenderSR.halfSize[0]=-1))}function y(e){return g(e,-2)}function P(e){return g(e,2)}function N(e,t){return t+(e?1:0)}function x(e,t){return(-2&e)===t}function I(e){return 1==(1&e)}function C(e,t){return 0===t?0:e/t|0}function w(e,t){return 0===t?e:e%t}const M=[["maxScreenThreshold",a.MaxScreenThreshold],["screenSpaceRelative",a.ScreenSpaceRelative],["removedFeatureDiameter",a.RemovedFeatureDiameter],["distanceRangeFromDefaultCamera",a.DistanceRangeFromDefaultCamera]];function S(e){if(e)for(let t=0;t<e.length;t++)for(const i of M)if(i[0]===e[t].metricType)return{lodMetric:i[1],maxError:e[t].maxError};return{lodMetric:a.None,maxError:0}}class O{constructor(){this.known=0,this.knownNodes=0,this.missing=0,this.missingNodes=0,this.unremoved=0}}function V(e){return Math.sqrt(e*(4/Math.PI))}export{f as I3SIndex,S as selectErrorMetric};
|
|
5
|
+
import{isSome as e,isNone as t,unwrap as i}from"../../../../core/maybe.js";import s from"../../../../core/PooledArray.js";import{isAbortError as r}from"../../../../core/promiseUtils.js";import{l as n}from"../../../../chunks/vec3.js";import{d as o}from"../../../../chunks/vec4f64.js";import{LodMetric as a,NodeBase as d,Node as l,NodeFilterImpact as h,NodeIMModificationImpact as u,NodeTraversalState as c}from"./I3SNode.js";import{addWraparound as g}from"./I3SUtil.js";import{clone as _}from"../../support/orientedBoundingBox.js";class m{constructor(e,t,i,s,r){this.childOffset=e,this.childCount=t,this.visibilityCache=i,this.ref=s,this.node=r,this.useAsHole=0,this.filterImpact=h.NotChecked}}class f{constructor(e,t,i,r,n,o,d,l,h,u,c,g,_,m){this.streamDataController=i,this.viewportQueries=r,this.logger=n,this.holeFilling=o,this._isLoaded=d,this._isReloading=l,this._isSelected=h,this._enable=u,this._needsUpdate=c,this._canRequest=g,this._computeVisibilityObb=_,this._computeNodeFiltering=m,this._dirty=!0,this._nodePages=[],this.nodeCount=0,this.nodesPerPage=0,this.rootIndex=0,this.lodMetric=a.None,this._lodConversion=e=>e,this.urlPrefix="",this._loading=new Set,this._failedNodes=new Set,this._failedPages=new Set,this._indexMissing=1,this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.POSITIVE_INFINITY,this._nodeTraversalState=new Map,this._version=P(0),this._visibilityCacheVersion=P(0),this._maxLevel=1,this._featureEstimate={estimate:0,leavesReached:!1},this._unloadedMemoryEstimate=0,this._missing=new s({deallocator:null}),this._prefetch=new s({deallocator:null}),this._updates=new b(this._missing),this._imModificationUncategorized=new s({deallocator:null}),this.ignoreServiceObb=!1,this.progressiveLoadPenalty=0,this._pageQueue=[],this.layerHasModifications=!1,this._layerHasFilter=!1,this.logLayer=e,e.serviceUpdateTimeStamp&&e.serviceUpdateTimeStamp.lastUpdate&&(this.lastUpdate=`${e.serviceUpdateTimeStamp.lastUpdate}`),this._maxLodLevel=this.viewportQueries?this.viewportQueries.maxLodLevel:1,this._init(t)}_init(e){if("page"===e.type){switch(this.urlPrefix=e.urlPrefix,this.nodesPerPage=e.pageSize,this.rootIndex=e.rootIndex,e.lodMetric){case"maxScreenThreshold":this.lodMetric=a.MaxScreenThreshold;break;case"maxScreenThresholdSQ":this.lodMetric=a.MaxScreenThreshold,this._lodConversion=L}this._addPage(C(this.rootIndex,this.nodesPerPage),e.rootPage),this._updateParentsAndLevel()}else if("node"===e.type){this.urlPrefix=e.urlPrefix,this._nodePages.push({nodes:[],children:[],parents:[]}),this._makeRefNode(new d(e.rootNode.id,null),-1);const t=this._validateNode(e.rootNode.id,e.rootNode);t&&this._addNode(t,0)}}_loadPage(e){this._loading.add(e);const t=this.urlPrefix+e;this.streamDataController.request(t,"json").then((t=>{this._pageQueue.push({pageIndex:e,page:t})})).catch((t=>{this._loading.delete(e),r(t)||(this._failedPages.add(e),this.logger.error("#loadPage()",this.logLayer,`Error when loading page ${e}`,t))}))}_addQueuedPages(e){for(;this._pageQueue.length>0&&!e.done;){const{pageIndex:t,page:i}=this._pageQueue.shift();this._addPage(t,i),this._loading.delete(t),e.madeProgress()}this._updateParentsAndLevel()}_addPage(e,t){for(let n=this._nodePages.length;n<e;n++)this._nodePages[n]=null;const i=[],s=[],r=t.nodes.map(((t,r)=>{const a=i.length,d=t.children?t.children.length:0;s.push(-1);for(let e=0;e<d;e++)i.push(t.children[e]);const h=`${t.index}`,u=_(t.obb),c=o([u.center[0],u.center[1],u.center[2],n(u.halfSize)]),g=t.mesh&&t.mesh.attribute,f=t.mesh&&t.mesh.geometry,v=t.mesh&&t.mesh.material,b={hasSharedResource:!1,hasFeatureData:!!f,attributes:g&&null!=g.resource?`${g.resource}`:null,geometry:f&&null!=f.resource?`${f.resource}`:null,texture:v&&null!=v.resource?`${v.resource}`:null,geometryDefinition:f?f.definition:-1,materialDefinition:v?v.definition:-1},p=new l(h,e*this.nodesPerPage+r,c,d,0,b,this.lastUpdate,this.lodMetric,this._lodConversion(t.lodThreshold),f?f.featureCount:null);return p.serviceObb=u,p.visibilityObb=this._computeVisibilityObb(p),p.vertexCount=f?f.vertexCount:0,new m(a,d,y(this._visibilityCacheVersion),null,p)}));this._nodePages[e]={nodes:r,children:i,parents:s},this.nodeCount+=r.length}_updateParentsAndLevel(){const t=new Array,i=(i,s,r)=>{const n=this._getPage(i);if(e(n)){const o=w(i,this.nodesPerPage);n.parents[o]=s;const a=n.nodes[o].node;e(a)&&(a.level=r,t.push(i))}};for(i(this.rootIndex,-1,0);t.length;){const s=t.pop(),r=this.getNode(s);if(e(r))for(let e=0;e<r.childCount;e++){i(this.getChildIndex(r,e),s,r.level+1),this._maxLevel=Math.max(this._maxLevel,r.level+1)}}}_getPage(e){return this._nodePages[C(e,this.nodesPerPage)]}_getNodeInternal(e){const i=this._getPage(e);return t(i)?null:i.nodes[w(e,this.nodesPerPage)]}_addNode(t,s){null!=t.children&&this.populateChildren(s,t.children);const r=this.getParent(s),n=e(r)?r.level+1:0;this._maxLevel=Math.max(this._maxLevel,t.children?n+1:n);const{lodMetric:a,maxError:d}=S(t.lodSelection),h=i(this._getNodeInternal(s));return h.node=new l(t.id,s,o(t.mbs),h.childCount,n,t.resources,t.version,a,d,t.numFeatures),t.obb&&(h.node.serviceObb=_(t.obb)),h.node.visibilityObb=this._computeVisibilityObb(h.node),e(h.ref)&&(null==h.ref.mbs&&(h.ref.mbs=t.mbs),h.node.renderMbs=h.ref.renderMbs,h.node.serviceObbInRenderSR=h.ref.serviceObbInRenderSR,h.ref.visibilityObb=h.node.visibilityObb),h.node}_makeRefNode(t,i){const s=this._nodePages[0],r=s.nodes.length;return s.nodes.push(new m(0,0,y(this._visibilityCacheVersion),t,null)),this.nodeCount++,s.parents.push(i),t.renderMbs[3]=-1,e(t.serviceObbInRenderSR)&&(t.serviceObbInRenderSR.halfSize[0]=-1),r}populateChildren(e,t){const s=i(this._getNodeInternal(e)),r=i(this._getPage(e));s.childOffset=r.children.length,s.childCount=t.length;for(let i=0;i<t.length;i++){const s=this._makeRefNode(t[i],e);r.children.push(s)}}getNode(t){const i=this._getNodeInternal(t);return e(i)?i.node:null}getIndexById(t){let i;return this._forAllNodes(((s,r)=>{(e(s.node)&&s.node.id===t||e(s.ref)&&s.ref.id===t)&&(i=r)})),i}getNodeById(e){const t=this.getIndexById(e);return t>=0?this.getNode(t):null}getChildIndex(e,i){const s=this._getPage(e.index);if(t(s))return-1;const r=s.nodes[w(e.index,this.nodesPerPage)];return s.children[r.childOffset+i]}getParentIndex(t){const i=this._getPage(t);return e(i)?i.parents[w(t,this.nodesPerPage)]:-1}getParent(e){return(e=this.getParentIndex(e))>=0?this.getNode(e):null}isLeaf(t){const i=this._getNodeInternal(t);return e(i)&&0===i.childCount}get rootNode(){return this.getNode(this.rootIndex)}get size(){return this.nodeCount}invalidateVisibilityCache(){this._visibilityCacheVersion=P(this._visibilityCacheVersion)}invalidateNodeVisibilityCache(t){const i=this._getNodeInternal(t);e(i)&&this.invalidateNodeVisibilityCacheInternal(i)}invalidateNodeVisibilityCacheInternal(e){e.visibilityCache=y(this._visibilityCacheVersion)}invalidateBoundingVolumeCache(t){const i=this._getNodeInternal(t);e(i)&&(p(i),this.invalidateNodeVisibilityCacheInternal(i))}invalidateGeometryVisibility(t){const i=this._getNodeInternal(t);e(i)&&e(i.node)&&(i.node.geometryObb=null,i.node.renderMbs[3]=-1,e(i.node.serviceObbInRenderSR)&&(i.node.serviceObbInRenderSR.halfSize[0]=-1))}invalidateVisibilityObbs(){t(this.rootNode)||this.traverse(this.rootNode,(e=>(e.visibilityObb=this._computeVisibilityObb(e),e.geometryObb=null,!0)))}isNodeVisible(i){const s=this._getNodeInternal(i);if(t(s)||e(s.ref)&&!s.ref.mbs)return!0;if(!x(s.visibilityCache,this._visibilityCacheVersion)){const i=s.node,r=e(i)&&(t(s.ref)||e(i.visibilityObb))?i:e(s.ref)?s.ref:null;if(this._layerHasFilter&&this._computeNodeFiltering&&(e(i)||e(s.ref))&&s.filterImpact===h.NotChecked){const t=e(i)?i.mbs:e(s.ref)?s.ref.mbs:null;s.filterImpact=null!=t?this._computeNodeFiltering(t):h.Unmodified}const n=e(i)&&s.filterImpact===h.Culled,o=!(e(i)&&i.imModificationImpact===u.Culled)&&(!r||this.viewportQueries.isNodeVisible(r))&&!n;return s.visibilityCache=N(o,this._visibilityCacheVersion),o}return I(s.visibilityCache)}isGeometryVisible(t){if(!this.isNodeVisible(t))return!1;const i=this._getNodeInternal(t);return!(e(i)&&e(i.node)&&e(i.node.geometryObb)&&(!this.layerHasModifications||i.node.imModificationImpact!==u.NotChecked))||this.viewportQueries.isGeometryVisible(i.node)}_traverseCoverage(s,r,n,o,a){const d=this._getPage(s);if(t(d)||0===r.childCount)return;const l=r.childOffset+r.childCount,h=new Array;for(let t=r.childOffset;t<l;++t){const i=d.children[t],s=this._getNodeInternal(i);e(s)&&e(s.node)&&this.isGeometryVisible(i)&&h.push(s)}o/=h.length;for(const e of h){const t=i(e.node).index;this._isLoaded(t)||this._isReloading(t)?(a.delta=Math.max(a.delta,n),a.coverage+=o):this._traverseCoverage(t,e,n+1,o,a)}}useNodeAsHole(e){if("off"===this.holeFilling)return!1;const i=this._getNodeInternal(e);if(t(i))return!1;if("always"===this.holeFilling)return!0;if(x(i.useAsHole,this._version))return I(i.useAsHole);const s={delta:0,coverage:0};this._traverseCoverage(e,i,0,1,s);const r=s.delta*s.coverage<=.5;return i.useAsHole=N(r,this._version),r}get maxLevel(){return this._maxLevel}get dirty(){return this._dirty}destroy(){this._updates.add.prune(),this._updates.update.prune()}requestUpdate(){this._dirty=!0,this._indexMissing=1,this._version=P(this._version)}imModificationsChanged(t){this.layerHasModifications=t,this._forAllNodes((({node:t})=>{e(t)&&(t.imModificationImpact=u.NotChecked,t.visibilityObb=this._computeVisibilityObb(t),t.hasModifications&&this.invalidateGeometryVisibility(t.index))})),this.invalidateVisibilityCache()}layerFilterChanged(t){this._layerHasFilter=t,this._forAllNodes((t=>{if(e(t)){t.filterImpact=h.NotChecked;const i=t.node;e(i)&&this.invalidateNodeVisibilityCache(i.index)}})),this.invalidateVisibilityCache()}update(s,r,n){if(!this._dirty)return;this._pageQueue.length>0&&this._addQueuedPages(r),this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.NEGATIVE_INFINITY,this._missing.clear(),this._prefetch.clear(),this._updates.reset(s),v.clear();let o=!0;const a=new O,d=new O,l=this._imModificationUncategorized;l.clear();const h=new Set,c=(c,g,_)=>{if(t(g)){let e=this._entryPriority(c);e===1/0&&(e=this._entryPriority(_));const t=C(c,this.nodesPerPage);return v.set(t,Math.max(e,v.get(t)||0)),this._loading.has(t)||this._failedPages.has(t)||this._missing.push(t),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e))}const m=g.node;if(this._updateNodeFeatureEstimate(m,d),t(m)){const e=this._entryPriority(c);return this._loading.has(c)||this._failedNodes.has(c)||(this._missing.push(c),v.set(c,e)),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e))}const f=i(this._getPage(c));if(0===this._missing.length&&0===this.nodesPerPage)for(let t=0;t<g.childCount;t++){const i=f.children[g.childOffset+t],s=this._getNodeInternal(i);!e(s)||s.node||this._loading.has(i)||this._failedNodes.has(i)||(v.set(i,this._entryPriority(i)),this._prefetch.push(i))}if(m.failed)return;if(h.add(m.id),this._isLoaded(c)){if(a.known+=m.memory,++a.knownNodes,this._isSelected(m)?g.childCount>0&&(o=!1):(a.unremoved+=m.memory,o=!1),this._needsUpdate(m)){const e=this._entryPriority(c);v.set(c,e),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e),this._updates.update.push(c)}return}if(m.memory&&(a.known+=m.memory,++a.knownNodes),!this._isSelected(m))return void(this._isReloading(c)&&this._updates.remove.push(c));if(g.childCount>0&&(o=!1),m.memory?(a.missing+=m.memory,a.known+=m.memory,++a.knownNodes):++a.missingNodes,s.indexOf(m.index)>=0)return this._maxProcessingPrio=Math.max(this._maxProcessingPrio,this._entryPriority(c)),void(this._updates.cancel=this._updates.cancel.filter((e=>e!==m.index)));if(!r.done&&this._enable(m))return void r.madeProgress();const b=this._entryPriority(c);v.set(c,b),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,b),this._updates.add.push(c),this.layerHasModifications&&n&&e(m)&&m.imModificationImpact===u.NotChecked&&l.push(c)};this.traverseVisible(c);const g=this._updates.add;g.length>0&&this.layerHasModifications&&(l.length>0&&n(l),g.filterInPlace((e=>{const i=this._getNodeInternal(e),s=t(i)||t(i.node)||i.node.imModificationImpact!==u.Culled;return s||this.invalidateNodeVisibilityCache(e),s}))),this._unloadedMemoryEstimate=a.missing-a.unremoved,a.knownNodes>3&&a.missingNodes>0&&(this._unloadedMemoryEstimate+=a.known/a.knownNodes*a.missingNodes),this._unloadedMemoryEstimate=.8*Math.max(0,this._unloadedMemoryEstimate),this._featureEstimate.estimate=this._computeFeatureEstimate(d),this._featureEstimate.leavesReached=o,this._missing.sort(((e,t)=>e-t)),this._missing.filterInPlace(((e,t)=>t<1||this._missing.data[t-1]!==e)),this._missing.sort(((e,t)=>v.get(e)-v.get(t))),this._missing.length>0&&(this._maxUnloadedPrio=v.get(this._missing.back()),this._prefetch.clear()),this._updates.add.filterInPlace((e=>v.get(e)>=this._maxUnloadedPrio)).sort(((e,t)=>v.get(e)-v.get(t))),this._updates.update.sort(((e,t)=>v.get(e)-v.get(t))),this._indexMissing=this._loading.size+this._missing.length,this._dirty=this._indexMissing>0,v.clear()}checkFeatureTarget(e,t){const i=this.viewportQueries.updateScreenSpaceErrorBias(t);let s=t,r=t,n=i,o=10;for(;o--;){const i=new O;this._updateFeatureEstimate(s,i);if(this._computeFeatureEstimate(i)<=e){if(s>=t||i.missingNodes>0||0===o)break;n=s,s=.5*(s+r)}else r=s,s=.5*(s+n)}return this._version=P(this._version),this.viewportQueries.updateScreenSpaceErrorBias(i),Math.min(t,s)}_updateFeatureEstimate(t,i){this._version=P(this._version),this.viewportQueries.updateScreenSpaceErrorBias(t),this.traverseVisible(((t,s)=>this._updateNodeFeatureEstimate(e(s)&&s.node,i)))}_updateNodeFeatureEstimate(i,s){if(!(t(i)||i.failed||t(i.numFeatures)))return this._isLoaded(i.index)?(s.known+=i.numFeatures,++s.knownNodes,void(this._isSelected(i)||(s.unremoved+=i.numFeatures))):void(this._isSelected(i)&&(e(i.numFeatures)?(s.missing+=i.numFeatures,s.known+=i.numFeatures,++s.knownNodes):++s.missingNodes))}_computeFeatureEstimate(e){let t=e.known-e.unremoved;return e.knownNodes>3&&e.missingNodes>0&&(t+=e.known/e.knownNodes*e.missingNodes),Math.max(0,t)}load(){return this._load(this._missing)}prefetch(){return this._prefetch.sort(((e,t)=>v.get(e)-v.get(t))),this._load(this._prefetch)}_load(e){if(0===e.length||!this._canRequest())return!1;for(;e.length>0&&this._canRequest();)0===this.nodesPerPage?this._loadNode(e.pop()):this._loadPage(e.pop());return!0}isLoading(){return this._indexMissing>0}getIndexLoading(){return this._loading.size}getIndexMissing(){return this._indexMissing}getUnloadedMemoryEstimate(){return this._unloadedMemoryEstimate}get updates(){return this._updates}get featureEstimate(){return this._featureEstimate}nodeTraversalState(e){if(t(e))return null;let i=this._nodeTraversalState.get(e.index);if(i&&x(i.version,this._version))return i;const s=this.viewportQueries.getLodLevel(e),r=this.viewportQueries.hasLOD(e);let n=!0;if(r){const t=this.getParentIndex(e.index);if(t>=0){const e=this._nodeTraversalState.get(t);n=e&&s>e.lodLevel}else n=s>0}else n=0===e.childCount;return i?(i.lodLevel=s,i.isChosen=n,i.version=N(!0,this._version),i):(i=new c(r,n,s,N(!0,this._version)),this._nodeTraversalState.set(e.index,i),i)}_loadNode(e){this._loading.add(e);const s=i(this._getNodeInternal(e)).ref;if(t(s))return void this._failedNodes.add(e);const n=s.id,o=this.urlPrefix+n,a=()=>{this._loading.delete(e),0===this._missing.length&&0===this._loading.size&&this.requestUpdate()};this.streamDataController.request(o,"json").then((t=>{a();const i=this._validateNode(n,t);if(null==i)return;i.obb&&this.invalidateNodeVisibilityCache(e);const s=this._addNode(i,e);this.nodeTraversalState(s)}),(t=>{a(),r(t)||(this.logger.error("#loadNode()",this.logLayer,"Error loading node: "+o),this._failedNodes.add(e))}))}_validateNode(e,t){if(null==t||"object"!=typeof t||t.id!==e)return this.logger.error("#validateNode()",this.logLayer,`Invalid node. Wrong type or wrong id "${e}"`),null;if(!Array.isArray(t.mbs))return this.logger.error("#validateNode()",this.logLayer,`Invalid bounding volume on node ${e}.`),null;t.sharedResource&&"./shared"!==t.sharedResource.href&&"./shared/"!==t.sharedResource.href&&this.logger.warn("#validateNode()",this.logLayer,`Invalid shared resource href on node "${e}"`),null==t.geometryData||Array.isArray(t.geometryData)&&1===t.geometryData.length&&"./geometries/0"===t.geometryData[0].href||this.logger.warn("#validateNode()",this.logLayer,`Invalid geometry data on node "${e}"`),null==t.attributeData||Array.isArray(t.attributeData)&&!t.attributeData.some(((e,t)=>e.href!==`./attributes/f_${t}/0`))||this.logger.warn("#validateNode()",this.logLayer,`Invalid attribute data on node "${e}"`),t.featureData&&t.featureData.length>1&&this.logger.warn("#validateNode()",this.logLayer,`Node ${e} has ${t.featureData.length} bundles. Only the first bundle will be loaded.`);const i=t.hasOwnProperty("obb")&&!this.ignoreServiceObb?t.obb:null,s=t.featureData&&1===t.featureData.length&&t.featureData[0].featureRange?t.featureData[0].featureRange[1]-t.featureData[0].featureRange[0]+1:null,r=t=>{if(null==t)return null;const i=t=>this.logger.error("#validateNode()",this.logLayer,`Invalid node reference on node ${e}: ${t}`);if("number"==typeof t.id)i(`id ${t.id} is a number instead of a string.`);else if("string"!=typeof t.id||!Array.isArray(t.mbs))return i("Missing or invalid id."),null;if(!Array.isArray(t.mbs))return i(`Invalid bounding volume on reference ${t.id}.`),null;t.href&&t.href!=="../"+t.id&&this.logger.error("#validateNode()",this.logLayer,`Invalid node href on node "${e}"`);const s=t.hasOwnProperty("obb")&&!this.ignoreServiceObb?t.obb:null,r=new d(`${t.id}`,t.mbs);return r.serviceObb=s,r.visibilityObb=this._computeVisibilityObb(r),r},n=Array.isArray(t.children)?t.children.map(r).filter((e=>null!=e)):null;return{id:e,mbs:t.mbs,obb:i,children:n,resources:{hasFeatureData:t.featureData&&t.featureData.length>0,hasSharedResource:null!=t.sharedResource,attributes:t.attributeData?e:null,texture:t.textureData&&t.textureData.length>0?e:null,geometry:null!=t.geometryData?e:null},version:"string"==typeof t.version?t.version:null,lodSelection:Array.isArray(t.lodSelection)?t.lodSelection:null,numFeatures:s}}resetFailedNodes(){this._failedNodes.clear(),this._failedPages.clear(),this._forAllNodes((t=>{e(t.node)&&(t.node.failed=!1)}))}_entryPriority(i){const s=this._getNodeInternal(i),r=this.getParentIndex(i);if(t(s)||r<0&&null==s.node)return r<0?1/0:this._entryPriority(r);let n=0;if(s.node&&r>=0){const e=this._nodeTraversalState.get(r);null!=e&&(n=e.lodLevel)}let o=this.progressiveLoadPenalty;for(let e=i;e>=0;e=this.getParentIndex(e))if(this._isLoaded(e)){o=0;break}const a=e(s.ref)?this.viewportQueries.distToPOI(s.ref):e(s.node)?this.viewportQueries.distToPOI(s.node):0;return-a-n*(a+this.progressiveLoadPenalty)+o}traverseVisible(e){const i=this._getNodeInternal(this.rootIndex);t(i)?e(this.rootIndex,null,null):this._traverseVisible(this.rootIndex,-1,i,e)}_traverseVisible(t,s,r,n){if(r.node&&0===r.childCount)return void(this.isGeometryVisible(t)&&n(t,r,s));if(!this.isNodeVisible(t))return;if(n(t,r,s),null==r.node)return;const o=this.nodeTraversalState(r.node);if(o.nodeHasLOD&&o.lodLevel===this._maxLodLevel)return;const a=i(this._getPage(t));for(let i=0;i<r.childCount;i++){const s=a.children[r.childOffset+i],o=this._getNodeInternal(s);e(o)?this._traverseVisible(s,t,o,n):n(s,null,t)}}traverse(e,t){t(e)&&this.traverseChildren(e,t)}traverseChildren(t,i){const s=t.index,r=this._getNodeInternal(s);e(r)&&this._traverseChildren(s,r,i)}_traverseChildren(i,s,r){const n=this._getPage(i);if(t(n))return;const o=s.childOffset+s.childCount;for(let t=s.childOffset;t<o;++t){const i=n.children[t],s=this._getNodeInternal(i);e(s)&&e(s.node)&&r(s.node)&&this._traverseChildren(i,s,r)}}updateStats(e){if(this._updates.add.length>0&&(e.nodes+=" + "+this._updates.add.length),(this._indexMissing||this._prefetch.length>0)&&(e.index+=" + "+this._indexMissing||this._prefetch.length),e.prio=this._maxProcessingPrio,this._featureEstimate.estimate){const t=this._featureEstimate.estimate-e.features;t>0?e.features+=" + "+t:t<0&&(e.features+=" - "+-t)}}getPriority(){return Math.max(this._maxProcessingPrio,this._maxUnloadedPrio)}updateElevationInfo(e){this._forAllNodes(p),this.viewportQueries.updateElevationInfo(e)}_forAllNodes(e){for(let t=0;t<this._nodePages.length;t++){const i=this._nodePages[t];if(i){const s=t*this.nodesPerPage;for(let t=0;t<i.nodes.length;t++)e(i.nodes[t],s+t)}}}get test(){return{addNode:(e,t)=>this._addNode(e,t)}}}const v=new Map;class b{constructor(e){this.missing=e,this.update=new s({deallocator:null}),this.add=new s({deallocator:null}),this.remove=new s({deallocator:null}),this.cancel=[]}reset(e){this.add.clear(),this.update.clear(),this.cancel=e}}function p(t){e(t.node)&&(t.node.renderMbs[3]=-1,e(t.node.serviceObbInRenderSR)&&(t.node.serviceObbInRenderSR.halfSize[0]=-1)),e(t.ref)&&(t.ref.renderMbs[3]=-1,e(t.ref.serviceObbInRenderSR)&&(t.ref.serviceObbInRenderSR.halfSize[0]=-1))}function y(e){return g(e,-2)}function P(e){return g(e,2)}function N(e,t){return t+(e?1:0)}function x(e,t){return(-2&e)===t}function I(e){return 1==(1&e)}function C(e,t){return 0===t?0:e/t|0}function w(e,t){return 0===t?e:e%t}const M=[["maxScreenThreshold",a.MaxScreenThreshold],["screenSpaceRelative",a.ScreenSpaceRelative],["removedFeatureDiameter",a.RemovedFeatureDiameter],["distanceRangeFromDefaultCamera",a.DistanceRangeFromDefaultCamera]];function S(e){if(e)for(let t=0;t<e.length;t++)for(const i of M)if(i[0]===e[t].metricType)return{lodMetric:i[1],maxError:e[t].maxError};return{lodMetric:a.None,maxError:0}}class O{constructor(){this.known=0,this.knownNodes=0,this.missing=0,this.missingNodes=0,this.unremoved=0}}function L(e){return Math.sqrt(e*(4/Math.PI))}export{f as I3SIndex,S as selectErrorMetric};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/has.js";import{clamp as a,isPowerOfTwo as o}from"../../../../core/mathUtils.js";import{isSome as r,isNone as s}from"../../../../core/maybe.js";import{TextureEncoding as t,TextureUsage as n}from"./enums.js";import{RenderTexture as l}from"../../webgl-engine/core/material/RenderTexture.js";import{PBRSchematicMRRValues as i}from"../../webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{defaultMaskAlphaCutoff as c}from"../../webgl-engine/core/shaderLibrary/util/AlphaDiscard.glsl.js";import{getEllipsoidMode as u}from"../../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{CullFaceOptions as m,AlphaDiscardMode as d}from"../../webgl-engine/lib/basicInterfaces.js";import{Texture as g}from"../../webgl-engine/lib/Texture.js";import{TextureWrapMode as p}from"../../../webgl/enums.js";function h(e,a){const o=new Map,t=(e,a)=>{if(s(e))return-1;if(o.has(e.id)){const r=o.get(e.id);return r.usage|=a,r.id}const r=o.size;return o.set(e.id,{id:r,usage:a}),r},l=a.pbrMetallicRoughness,c=l&&l.baseColorFactor,u=a.emissiveFactor,d=null==a.normalTexture&&null==a.emissiveTexture&&null==a.occlusionTexture&&(!l||null==l.metallicRoughnessTexture&&1===l.roughnessFactor&&(1===l.metallicFactor||0===l.metallicFactor)),g=d?i[0]:l?l.metallicFactor:1,p=d?i[1]:l?l.roughnessFactor:1,h="mask"===a.alphaMode?n.Color|n.AlphaMask:n.Color,x={baseColorFactor:c?[c[0],c[1],c[2],c[3]]:[1,1,1,1],baseColorTextureId:t(l&&l.baseColorTexture,h),metallicRoughnessTextureId:t(l&&l.metallicRoughnessTexture,n.MetallicRoughness),metallicFactor:g,roughnessFactor:p},b={alphaMode:a.alphaMode,alphaCutoff:a.alphaCutoff,doubleSided:a.doubleSided,cullFace:"none"===a.cullFace?m.None:"back"===a.cullFace?m.Back:"front"===a.cullFace?m.Front:void 0,normalTextureId:t(a.normalTexture,n.Normal),emissiveTextureId:t(a.emissiveTexture,n.Emissive),occlusionTextureId:t(a.occlusionTexture,n.Occlusion),emissiveFactor:u?[u[0],u[1],u[2]]:[0,0,0],metallicRoughness:x,wrapTextures:!1,hasParametersFromSource:d},F=[];return o.forEach((({usage:a},o)=>{const s=r(e)&&e[o]&&e[o].formats,t=s?f(s.map((({name:e,format:a})=>({name:e,encoding:T[a]})))):[];F.push({id:o,usage:a,encodings:t})})),{material:b,textures:F}}function f(e){return e.sort(((e,a)=>e.encoding-a.encoding))}const T={ktx2:t.KTX2,basis:t.Basis,dds:t.DDS_S3TC,png:t.PNG,jpg:t.JPG,"ktx-etc2":t.KTX_ETC2},x={[g.KTX2_ENCODING]:t.Basis,[g.BASIS_ENCODING]:t.Basis,[g.DDS_ENCODING]:t.DDS_S3TC,"image/png":t.PNG,"image/jpg":t.JPG,"image/jpeg":t.JPG,"image/ktx":t.KTX_ETC2};function b(e){const o=e&&e.materialDefinitions?Object.keys(e.materialDefinitions)[0]:null,r=e&&e.textureDefinitions?Object.keys(e.textureDefinitions)[0]:null,s=o&&e.materialDefinitions[o],t=r&&e.textureDefinitions[r],l=F();if(null!=s){const e=s.params;e.diffuse&&(l.metallicRoughness.baseColorFactor=[e.diffuse[0],e.diffuse[1],e.diffuse[2],1]),null!=e.doubleSided&&(l.doubleSided=e.doubleSided,l.cullFace=e.doubleSided?m.None:m.Back),"none"!==e.cullFace&&"front"!==e.cullFace&&"back"!==e.cullFace||(l.cullFace="none"===e.cullFace?m.None:"back"===e.cullFace?m.Back:m.Front),e.transparency&&(l.metallicRoughness.baseColorFactor[3]=a(1-e.transparency,0,1)),(e.useVertexColorAlpha||l.metallicRoughness.baseColorFactor[3]<1)&&(l.alphaMode="blend")}const i=[];if(null!=t){const e=0;!t.wrap||"repeat"!==t.wrap[0]&&"repeat"!==t.wrap[1]||(l.wrapTextures=!0);let a=n.Color;"rgba"===t.channels&&(l.alphaMode="blend",a|=n.AlphaMask);const o=t.images.length-1,r=t.images[o],s=e=>e&&e.split("/").pop(),c=Array.isArray(t.encoding)?f(t.encoding.map(((e,a)=>({name:s(r.href[a]),encoding:x[e]||0})))):[{name:s(r.href),encoding:x[t.encoding]||0}];i.push({id:e,usage:a,encodings:c}),l.metallicRoughness.baseColorTextureId=e}return{material:l,textures:i}}const F=()=>({alphaMode:"opaque",alphaCutoff:c,doubleSided:!0,cullFace:m.None,normalTextureId:-1,emissiveTextureId:-1,occlusionTextureId:-1,emissiveFactor:[0,0,0],metallicRoughness:{baseColorFactor:[.8,.8,.8,1],baseColorTextureId:-1,metallicRoughnessTextureId:-1,metallicFactor:0,roughnessFactor:.6},wrapTextures:!1,hasParametersFromSource:!0});function C(e,a,r,t){if(s(e)||null==e.data)return null;const l=e.data,i=!(l instanceof HTMLImageElement)||o(l.width)&&o(l.height),c=t.renderingContext.parameters.maxMaxAnisotropy,u=r&&!t.capabilities.shaderTextureLOD?1:c,m=i&&!e.downsampled&&u>1,d=r||!a.wrapTextures?P:M,p=E(e.encoding),h=e.usage&n.Color?"opaque"===a.alphaMode?3:4:3;return new g(l,{mipmap:m,maxAnisotropy:u,encoding:p,wrap:d,components:h,noUnpackFlip:!0})}const P={s:p.CLAMP_TO_EDGE,t:p.CLAMP_TO_EDGE},M={s:p.REPEAT,t:p.REPEAT};function S(e,o,s,t,i,m){const g=m.rendererTextureUsage,p=e=>R(t,s,e&g),h=o.metallicRoughness.baseColorFactor,f=a(o.metallicRoughness.baseColorFactor[3],0,1);e.baseColor=[h[0],h[1],h[2],f],e.hasParametersFromSource=!!o.hasParametersFromSource,e.usePBR=m.usePBR,e.mrrFactors=[o.metallicRoughness.metallicFactor,o.metallicRoughness.roughnessFactor,o.hasParametersFromSource?.2:.5],e.emissiveFactor=o.emissiveFactor,e.isIntegratedMesh=m.isIntegratedMesh,e.alphaCutoff="mask"===o.alphaMode?o.alphaCutoff:c,e.alphaDiscardMode="opaque"===o.alphaMode?d.Opaque:"mask"===o.alphaMode?d.Mask:d.MaskBlend;const T=[],x=p(n.Color|n.AlphaMask);r(x)&&(e.baseColorTexture=new l(i,x),T.push(e.baseColorTexture.loadPromise));const b=p(n.MetallicRoughness);r(b)&&(e.metallicRoughnessTexture=new l(i,b),T.push(e.metallicRoughnessTexture.loadPromise));const F=p(n.Emissive);r(F)&&(e.emissionTexture=new l(i,F),T.push(e.emissionTexture.loadPromise));const C=p(n.Occlusion);r(C)&&(e.occlusionTexture=new l(i,C),T.push(e.occlusionTexture.loadPromise));const P=p(n.Normal);return r(P)&&(e.normalTexture=new l(i,P),T.push(e.normalTexture.loadPromise)),e.commonMaterialParameters.slicePlaneEnabled=m.slicePlaneEnabled,e.commonMaterialParameters.doubleSided=o.doubleSided,e.commonMaterialParameters.cullFace=o.cullFace,e.ellipsoidMode=u(m.viewSpatialReference),Promise.all(T)}function D(a){const o=!!a.compressedTextureS3TC,r=!!a.compressedTextureETC,s=e("disable-feature:i3s-basis")?0:t.Basis|t.KTX2,n=t.JPG|t.PNG,l=s|t.DDS_S3TC;return n|(o?l:0)|(r?s:0)}function w(e,a){return e.find((e=>0!=(e.encoding&a)))}function R(e,a,o){if(s(e)||o===n.None)return null;for(let s=0;s<e.length;s++){const t=e[s];if(r(t)&&0!=(t.usage&o)){const e=a[s];return r(e)?e.id:null}}return null}function E(e){switch(e){case t.KTX2:return g.KTX2_ENCODING;case t.Basis:return g.BASIS_ENCODING;case t.DDS_S3TC:return g.DDS_ENCODING;case t.PNG:return"image/png";case t.JPG:return"image/jpeg";case t.KTX_ETC2:return"image/ktx";default:return""}}export{S as configureMaterial,C as createTexture,h as getMaterialAndTextures,b as getMaterialAndTexturesFromShared,D as getSupportedEncodings,w as selectEncoding};
|
|
5
|
+
import e from"../../../../core/has.js";import{clamp as a,isPowerOfTwo as o}from"../../../../core/mathUtils.js";import{isSome as r,isNone as s}from"../../../../core/maybe.js";import{TextureEncoding as t,TextureUsage as n}from"./enums.js";import{RenderTexture as l}from"../../webgl-engine/core/material/RenderTexture.js";import{PBRSchematicMRRValues as i}from"../../webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{defaultMaskAlphaCutoff as c}from"../../webgl-engine/core/shaderLibrary/util/AlphaDiscard.glsl.js";import{getEllipsoidMode as u}from"../../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{CullFaceOptions as m,AlphaDiscardMode as d}from"../../webgl-engine/lib/basicInterfaces.js";import{Texture as g}from"../../webgl-engine/lib/Texture.js";import{TextureWrapMode as p}from"../../../webgl/enums.js";function h(e,a){const o=new Map,t=(e,a)=>{if(s(e))return-1;if(o.has(e.id)){const r=o.get(e.id);return r.usage|=a,r.id}const r=o.size;return o.set(e.id,{id:r,usage:a}),r},l=a.pbrMetallicRoughness,c=l&&l.baseColorFactor,u=a.emissiveFactor,d=null==a.normalTexture&&null==a.emissiveTexture&&null==a.occlusionTexture&&(!l||null==l.metallicRoughnessTexture&&1===l.roughnessFactor&&(1===l.metallicFactor||0===l.metallicFactor)),g=d?i[0]:l?l.metallicFactor:1,p=d?i[1]:l?l.roughnessFactor:1,h="mask"===a.alphaMode?n.Color|n.AlphaMask:n.Color,x={baseColorFactor:c?[c[0],c[1],c[2],c[3]]:[1,1,1,1],baseColorTextureId:t(l&&l.baseColorTexture,h),metallicRoughnessTextureId:t(l&&l.metallicRoughnessTexture,n.MetallicRoughness),metallicFactor:g,roughnessFactor:p},b={alphaMode:a.alphaMode,alphaCutoff:a.alphaCutoff,doubleSided:a.doubleSided,cullFace:"none"===a.cullFace?m.None:"back"===a.cullFace?m.Back:"front"===a.cullFace?m.Front:void 0,normalTextureId:t(a.normalTexture,n.Normal),emissiveTextureId:t(a.emissiveTexture,n.Emissive),occlusionTextureId:t(a.occlusionTexture,n.Occlusion),emissiveFactor:u?[u[0],u[1],u[2]]:[0,0,0],metallicRoughness:x,wrapTextures:!1,hasParametersFromSource:d},F=[];return o.forEach((({usage:a},o)=>{const s=r(e)&&e[o]&&e[o].formats,t=s?f(s.map((({name:e,format:a})=>({name:e,encoding:T[a]})))):[];F.push({id:o,usage:a,encodings:t})})),{material:b,textures:F}}function f(e){return e.sort(((e,a)=>e.encoding-a.encoding))}const T={ktx2:t.KTX2,basis:t.Basis,dds:t.DDS_S3TC,png:t.PNG,jpg:t.JPG,"ktx-etc2":t.KTX_ETC2},x={[g.KTX2_ENCODING]:t.Basis,[g.BASIS_ENCODING]:t.Basis,[g.DDS_ENCODING]:t.DDS_S3TC,"image/png":t.PNG,"image/jpg":t.JPG,"image/jpeg":t.JPG,"image/ktx":t.KTX_ETC2};function b(e){const o=e&&e.materialDefinitions?Object.keys(e.materialDefinitions)[0]:null,r=e&&e.textureDefinitions?Object.keys(e.textureDefinitions)[0]:null,s=o&&e.materialDefinitions[o],t=r&&e.textureDefinitions[r],l=F();if(null!=s){const e=s.params;e.diffuse&&(l.metallicRoughness.baseColorFactor=[e.diffuse[0],e.diffuse[1],e.diffuse[2],1]),null!=e.doubleSided&&(l.doubleSided=e.doubleSided,l.cullFace=e.doubleSided?m.None:m.Back),"none"!==e.cullFace&&"front"!==e.cullFace&&"back"!==e.cullFace||(l.cullFace="none"===e.cullFace?m.None:"back"===e.cullFace?m.Back:m.Front),e.transparency&&(l.metallicRoughness.baseColorFactor[3]=a(1-e.transparency,0,1)),(e.useVertexColorAlpha||l.metallicRoughness.baseColorFactor[3]<1)&&(l.alphaMode="blend")}const i=[];if(null!=t){const e=0;!t.wrap||"repeat"!==t.wrap[0]&&"repeat"!==t.wrap[1]||(l.wrapTextures=!0);let a=n.Color;"rgba"===t.channels&&(l.alphaMode="blend",a|=n.AlphaMask);const o=t.images.length-1,r=t.images[o],s=e=>e&&e.split("/").pop(),c=Array.isArray(t.encoding)?f(t.encoding.map(((e,a)=>({name:s(r.href[a]),encoding:x[e]||0})))):[{name:s(r.href),encoding:x[t.encoding]||0}];i.push({id:e,usage:a,encodings:c}),l.metallicRoughness.baseColorTextureId=e}return{material:l,textures:i}}const F=()=>({alphaMode:"opaque",alphaCutoff:c,doubleSided:!0,cullFace:m.None,normalTextureId:-1,emissiveTextureId:-1,occlusionTextureId:-1,emissiveFactor:[0,0,0],metallicRoughness:{baseColorFactor:[.8,.8,.8,1],baseColorTextureId:-1,metallicRoughnessTextureId:-1,metallicFactor:0,roughnessFactor:.6},wrapTextures:!1,hasParametersFromSource:!0});function C(e,a,r,t){if(s(e)||null==e.data)return null;const l=e.data,i=!(l instanceof HTMLImageElement)||o(l.width)&&o(l.height),c=t.renderingContext.parameters.maxMaxAnisotropy,u=r&&!t.capabilities.shaderTextureLOD?1:c,m=i&&!e.downsampled&&u>1,d=r||!a.wrapTextures?P:M,p=E(e.encoding),h=e.usage&n.Color?"opaque"===a.alphaMode?3:4:3;return new g(l,{mipmap:m,maxAnisotropy:u,encoding:p,wrap:d,components:h,noUnpackFlip:!0})}const P={s:p.CLAMP_TO_EDGE,t:p.CLAMP_TO_EDGE},M={s:p.REPEAT,t:p.REPEAT};function S(e,o,s,t,i,m){const g=m.rendererTextureUsage,p=e=>R(t,s,e&g),h=o.metallicRoughness.baseColorFactor,f=a(o.metallicRoughness.baseColorFactor[3],0,1);e.baseColor=[h[0],h[1],h[2],f],e.hasParametersFromSource=!!o.hasParametersFromSource,e.usePBR=m.usePBR,e.mrrFactors=[o.metallicRoughness.metallicFactor,o.metallicRoughness.roughnessFactor,o.hasParametersFromSource?.2:.5],e.emissiveFactor=o.emissiveFactor,e.isIntegratedMesh=m.isIntegratedMesh,e.alphaCutoff="mask"===o.alphaMode?o.alphaCutoff:c,e.alphaDiscardMode="opaque"===o.alphaMode?d.Opaque:"mask"===o.alphaMode?d.Mask:d.MaskBlend;const T=[],x=p(n.Color|n.AlphaMask);r(x)&&(e.baseColorTexture=new l(i,x),T.push(e.baseColorTexture.loadPromise));const b=p(n.MetallicRoughness);r(b)&&(e.metallicRoughnessTexture=new l(i,b),T.push(e.metallicRoughnessTexture.loadPromise));const F=p(n.Emissive);r(F)&&(e.emissionTexture=new l(i,F),T.push(e.emissionTexture.loadPromise));const C=p(n.Occlusion);r(C)&&(e.occlusionTexture=new l(i,C),T.push(e.occlusionTexture.loadPromise));const P=p(n.Normal);return r(P)&&(e.normalTexture=new l(i,P),T.push(e.normalTexture.loadPromise)),e.commonMaterialParameters.slicePlaneEnabled=m.slicePlaneEnabled,e.commonMaterialParameters.doubleSided=o.doubleSided,e.commonMaterialParameters.cullFace=o.cullFace,e.ellipsoidMode=u(m.viewSpatialReference),Promise.all(T)}function D(a){const o=!!a.compressedTextureS3TC,r=!!a.compressedTextureETC,s=e("disable-feature:i3s-basis")?0:t.Basis|t.KTX2,n=t.JPG|t.PNG,l=s|t.DDS_S3TC;return n|(o?l:0)|(r?s:0)}function w(e,a){return e.find((e=>0!=(e.encoding&a)))}function R(e,a,o){if(s(e)||o===n.None)return null;for(let s=0;s<e.length;s++){const t=e[s];if(r(t)&&0!=(t.usage&o)){const e=a[s];return r(e)?e.id:null}}return null}function E(e){switch(e){case t.KTX2:return g.KTX2_ENCODING;case t.Basis:return g.BASIS_ENCODING;case t.DDS_S3TC:return g.DDS_ENCODING;case t.PNG:return"image/png";case t.JPG:return"image/jpeg";case t.KTX_ETC2:return"image/ktx";default:return""}}export{S as configureMaterial,C as createTexture,F as defaultMaterial,h as getMaterialAndTextures,b as getMaterialAndTexturesFromShared,D as getSupportedEncodings,w as selectEncoding};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isSome as t,isNone as e}from"../../../../core/maybe.js";import{h as i,i as s,l as r,a as n,d as a,p as o,f as h,b as c}from"../../../../chunks/vec3.js";import{c as m}from"../../../../chunks/vec3f64.js";import{c as p}from"../../../../chunks/vec4.js";import{projectBoundingSphere as u}from"../../../../geometry/projection.js";import{getSphericalPCPF as _}from"../../../../geometry/projectionEllipsoid.js";import{create as l,fromMatrix as d,intersectsSphere as b}from"../../../../geometry/support/frustum.js";import{w as g}from"../../../../chunks/sphere.js";import{makeDehydratedPoint as f}from"../../../../layers/graphics/dehydratedFeatures.js";import{evaluateElevationAlignmentAtPoint as
|
|
5
|
+
import{isSome as t,isNone as e}from"../../../../core/maybe.js";import{h as i,i as s,l as r,a as n,d as a,p as o,f as h,b as c}from"../../../../chunks/vec3.js";import{c as m}from"../../../../chunks/vec3f64.js";import{c as p}from"../../../../chunks/vec4.js";import{projectBoundingSphere as u}from"../../../../geometry/projection.js";import{getSphericalPCPF as _}from"../../../../geometry/projectionEllipsoid.js";import{create as l,fromMatrix as d,intersectsSphere as b}from"../../../../geometry/support/frustum.js";import{w as g}from"../../../../chunks/sphere.js";import{makeDehydratedPoint as f}from"../../../../layers/graphics/dehydratedFeatures.js";import{evaluateElevationAlignmentAtPoint as v}from"../graphics/elevationAlignmentUtils.js";import{ElevationContext as D}from"../graphics/ElevationContext.js";import{createContextWithoutExpressionSupport as M,extractExpressionInfo as x}from"../graphics/featureExpressionInfoUtils.js";import{LodMetric as C}from"./I3SNode.js";import{transformObb as S,intersectBoundingRectWithMbs as R,MbsIntersectResult as P}from"./I3SUtil.js";import{create as E,isVisible as L}from"../../support/orientedBoundingBox.js";const O=1e5;class j{constructor(t,e,i,s,r,n,a,o={}){this._indexSR=t,this._renderCoordsHelper=e,this.clippingArea=r,this._elevationProvider=n,this._options=o,this._frustum=l(),this._useFrustumCulling=!1,this._poi=m(),this.minDistance=1/0,this.maxDistance=0,this.maxLodLevel=2,this._tmp1=m(),this._tmp2=m(),this._tmp3=m(),this._tmp0=m(),this._screenspaceErrorBias=o.screenspaceErrorBias||1,this._progressiveLoadFactor=o.progressiveLoadFactor||1,this.updateCamera(i,s),this.engineSR=this._renderCoordsHelper.spatialReference,this.updateElevationInfo(a),this._tmpPoint=f(0,0,0,t)}updateElevationInfo(t){null!=t?(this._elevationContext=D.fromElevationInfo(t),this._elevationContext.updateFeatureExpressionInfoContext(M(x(t,!1)))):this._elevationContext=null}updateCamera(t,e){this._useFrustumCulling=e,e&&d(t.viewMatrix,t.projectionMatrix,this._frustum),this._screenSizeFactor=1/(t.perScreenPixelRatio/2),this._camPos=t.eye,this.minDistance=1/0,this.maxDistance=0}setPointOfInterest(t){this._poi=t}updateScreenSpaceErrorBias(t){const e=this._screenspaceErrorBias;return this._screenspaceErrorBias=t,e}updateClippingArea(t){this.clippingArea=t}getRenderMbs(t){const e=t.renderMbs;return e[3]<0&&(p(e,t.mbs),this._elevationContext&&e[3]<O&&(this._tmpPoint.x=e[0],this._tmpPoint.y=e[1],this._tmpPoint.z=e[2],e[2]=v(this._tmpPoint,this._elevationProvider,this._elevationContext,this._renderCoordsHelper)),u(e,this._indexSR,e,this.engineSR)),e}getVisibilityObb(i){if(t(i.visibilityObb))return i.visibilityObb;const s=i.serviceObb;return e(s)||s.halfSize[0]<0?void 0:(i.serviceObbInRenderSR=this._computeRenderObb(s,i.serviceObbInRenderSR,i.mbs[3]),i.serviceObbInRenderSR)}_computeRenderObb(t,i,s){if(e(i)&&(i=E()),i.halfSize[0]<0){let e=0;this._elevationContext&&s<O&&(this._tmpPoint.x=t.center[0],this._tmpPoint.y=t.center[1],this._tmpPoint.z=t.center[2],e=v(this._tmpPoint,this._elevationProvider,this._elevationContext,this._renderCoordsHelper)-t.center[2]),S(t,this._indexSR,i,this.engineSR,e)}return i}isNodeVisible(e){const i=this.getRenderMbs(e);if(!this._isMBSinClippingArea(i))return!1;if(!this._useFrustumCulling)return!0;const s=this.getVisibilityObb(e);return t(s)?L(s,this._frustum):b(this._frustum,g(i))}isGeometryVisible(e){if(!this._useFrustumCulling)return!0;const i=e.geometryObb;return t(i)?L(i,this._frustum):this.isNodeVisible(e)}_isMBSinClippingArea(t){return!!e(this.clippingArea)||R(this.clippingArea,t)!==P.OUTSIDE}_screenSpaceDiameterMbs(t,e){const s=this.getRenderMbs(t),r=Math.sqrt(i(s,this._camPos)),n=r-s[3];return this._updateMinMaxDistance(r),n<0?.5*Number.MAX_VALUE:e/n*this._screenSizeFactor}calcCameraDistance(t){return this.calcCameraDistanceToCenter(t)-this.getRenderMbs(t)[3]}calcCameraDistanceToCenter(t){const e=this.getRenderMbs(t),i=s(e,this._camPos);return this._updateMinMaxDistance(i),i}calcAngleDependentLoD(t){const e=this.getRenderMbs(t),i=e[3],n=(Math.abs(e[0]*(e[0]-this._camPos[0])+e[1]*(e[1]-this._camPos[1])+e[2]*(e[2]-this._camPos[2]))/r(e)+i)/s(e,this._camPos);return Math.min(1,n)}hasLOD(t){return t.lodMetric!==C.None}_getDistancePlanarMode(t,e){const i=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2],n=i*i+s*s,a=e[3];if(n<=a*a)return Math.abs(r);const o=Math.sqrt(n)-a;return Math.sqrt(r*r+o*o)}_getDistanceGlobeMode(t,e){const m=r(e),p=r(t)-m;n(this._tmp0,t,a(t,e)/o(t));const u=i(e,this._tmp0),_=e[3];if(u<=_*_)return Math.abs(p);{const i=n(this._tmp0,e,1/m),o=m,u=_*_/2/o,l=n(this._tmp1,i,o-u),d=t,b=h(this._tmp2,d,l),g=h(this._tmp2,b,n(this._tmp3,i,a(i,b))),f=c(this._tmp2,l,n(this._tmp2,g,_/r(g)));let v=s(d,f);if(p>=2e5){const t=h(this._tmp1,d,f);let e=a(t,i)/r(t);e<.08&&(e=1e-4),v/=e}return v}}_getDistance(t,e){return this.engineSR===_(this.engineSR)?this._getDistanceGlobeMode(t,e):this._getDistancePlanarMode(t,e)}_updateMinMaxDistance(t){t>0?(this.minDistance=Math.min(this.minDistance,t),this.maxDistance=Math.max(this.maxDistance,t)):(this.minDistance=0,this.maxDistance=Math.max(this.maxDistance,-t))}getLodLevel(t){if(t.lodMetric===C.None)return 0;if(0===t.childCount)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){const e=this._progressiveLoadFactor*this._screenspaceErrorBias,i=this._screenspaceErrorBias;return this.evaluateLODmetric(t,e)?this.evaluateLODmetric(t,i)?2:1:0}return this.evaluateLODmetric(t,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(t,e){switch(t.lodMetric){case C.ScreenSpaceRelative:{const i=this.getRenderMbs(t),s=this._getDistance(this._camPos,i),r=2*s/this._screenSizeFactor,n=s+i[3];return this._updateMinMaxDistance(n),t.maxError*e<=r}case C.MaxScreenThreshold:{let i=this._screenSpaceDiameterMbs(t,t.mbs[3]*e);return this._options.angleDependentLoD&&(i*=this.calcAngleDependentLoD(t)),i<t.maxError}case C.RemovedFeatureDiameter:return this._screenSpaceDiameterMbs(t,t.maxError)*e<10;case C.DistanceRangeFromDefaultCamera:return this.calcCameraDistance(t)>t.maxError*e}return!1}distToPOI(t){const e=this.getRenderMbs(t);return s(e,this._poi)-e[3]}distCameraToPOI(){return s(this._camPos,this._poi)}}export{j as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isSome as e,isNone as i,unwrap as t,disposeMaybe as s}from"../../../../core/maybe.js";import r from"../../../../core/PooledArray.js";import{f as n,m as o}from"../../../../chunks/mat4.js";import{c as h}from"../../../../chunks/mat4f32.js";import{f as a,l,a as c,o as d,d as u,p as m,s as p}from"../../../../chunks/vec3.js";import{c as g}from"../../../../chunks/vec3f32.js";import{c as f}from"../../../../chunks/vec3f64.js";import{s as _}from"../../../../chunks/vec4.js";import{create as S,POSITIVE_INFINITY as x,offset as b,contains as z,containsPoint as P,equals as w,set as R}from"../../../../geometry/support/aaBoundingBox.js";import{create as A}from"../../../../geometry/support/plane.js";import{fromPoints as M}from"../../../../geometry/support/ray.js";import{PointHighlights as j}from"./PointHighlights.js";import{minimumDistancePlane as y,maximumDistancePlane as H,intersectLine as I,toAaBoundingBox as q}from"../../support/orientedBoundingBox.js";import{ShaderOutput as v}from"../../webgl-engine/core/shaderLibrary/ShaderOutputOptions.js";import{bindSliceUniforms as T}from"../../webgl-engine/core/shaderLibrary/Slice.glsl.js";import{bindOutputHighlight as L}from"../../webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js";import{VertexAttribute as E}from"../../webgl-engine/lib/basicInterfaces.js";import{Default3D as F}from"../../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{newIntersectorResult as V}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as U,StoreResults as C}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{RenderPass as O}from"../../webgl-engine/lib/RenderPass.js";import{PointRendererTechniqueConfiguration as N,PointRendererTechnique as D}from"../../webgl-engine/shaders/PointRendererTechnique.js";import{BufferObject as B}from"../../../webgl/BufferObject.js";import{DataType as W,PrimitiveType as G,Usage as k}from"../../../webgl/enums.js";import{VertexArrayObject as Y}from"../../../webgl/VertexArrayObject.js";import{VertexElementDescriptor as J}from"../../../webgl/VertexElementDescriptor.js";const K={positions:[new J(E.POSITION,3,W.FLOAT,0,12)],colors:[new J(E.COLOR,3,W.UNSIGNED_BYTE,0,3,!0)]};class Q{constructor(e){this._params=e,this.type=U.PCL,this.isGround=!1,this._bindParameters={inverseViewport:[0,0],highlightDepthTexture:null},this._highlights=new j({forEachNode:e=>this.forEachNode(e),addHighlight:(e,i,t)=>this._addHighlight(e,i,t),removeHighlight:(e,i)=>this._removeHighlight(e,i)}),this.canRender=!0,this.layerUid="",this._useFixedSizes=!1,this._scaleFactor=1,this._minSizePx=0,this._useRealWorldSymbolSizes=!1,this._size=0,this._sizePx=0,this._slicePlaneEnabled=!1,this._clipBox=S(x),this._techniqueConfig=new N,this.tempMatrix4=h(),this.tempVec3=g(),this.nodes=new r}get needsHighlight(){return this._highlights.hasHighlights}initializeRenderContext(e){this._context=e,this._techniqueRep=this._context.shaderTechniqueRep,e.requestRender()}uninitializeRenderContext(){}intersect(e,i,t,s){const r=f(),n=f(),o=f(),h=f(),p=A(),g=e.camera.perScreenPixelRatio/2,x=e.camera.near,w=this._getSizeParams();a(n,s,t);const R=1/l(n);c(n,n,R),d(o,n),_(p,n[0],n[1],n[2],-u(n,t));const j=new ne,v=new ne,T=new Array,L=S(),E=S(this._clipBox);b(E,-t[0],-t[1],-t[2],E),this.nodes.forAll((l=>{const c=l.splatSize*this._scaleFactor;let d=y(l.obb,p),f=H(l.obb,p);d-=ee(c,d+x,w,g,l.isLeaf),f-=ee(c,f+x,w,g,l.isLeaf);const _=f<0,S=null!=j.dist&&null!=v.dist&&j.dist<d*R&&v.dist>f*R;if(_||S)return;const A=$(c,f+x,w,g,l.isLeaf);if(!I(l.obb,t,n,A))return;const M=A*A;q(l.obb,L),b(L,-t[0],-t[1],-t[2],L);const F=!z(E,L);a(h,l.origin,t);const V=l.coordinates.length/3;for(let a=0;a<V;a++){if(r[0]=h[0]+l.coordinates[3*a],r[1]=h[1]+l.coordinates[3*a+1],r[2]=h[2]+l.coordinates[3*a+2],F&&!P(E,r))continue;const d=u(r,n),p=m(r)-d*d;if(p>M)continue;let f=d+x;const _=ee(c,f,w,g,l.isLeaf);if(d-_<0)continue;f-=_;const S=$(c,f,w,g,l.isLeaf);if(p>S*S)continue;const b=(d-_)*R,z=e=>(e.point=ie(l,a,e.point),e.dist=b,e.normal=o,e.node=l,e.pointId=a,e.layerUid=this.layerUid,e);if((null==j.dist||b<j.dist)&&(null==i||i(t,s,b))&&z(j),e.options.store!==C.MIN&&(null==v.dist||b>v.dist)&&(null==i||i(t,s,b))&&z(v),e.options.store===C.ALL&&(null==i||i(t,s,b))){const e=new ne;T.push(z(e))}}}));const F=e=>{const{layerUid:i,node:t,pointId:s}=e;return{point:e.point,layerUid:i,graphicUid:s,createGraphic:()=>this._params.createGraphic(t,s,e.point)}},U=(e,i)=>{const t=F(i);e.set(this.type,t,i.dist,i.normal)};if(oe(j)){const i=e.results.min;(null==i.dist||j.dist<i.dist)&&U(i,j)}if(oe(v)&&e.options.store!==C.MIN){const i=e.results.max;(null==i.dist||v.dist>i.dist)&&U(i,v)}if(e.options.store===C.ALL){const i=M(t,s);for(const t of T){const s=V(i);U(s,t),e.results.all.push(s)}}}prepareTechnique(e){if(0===this.nodes.length||e.pass!==O.MATERIAL&&e.pass!==O.MATERIAL_DEPTH&&e.pass!==O.MATERIAL_HIGHLIGHT)return null;this.nodes.forAll((i=>{null==i.vao&&this._initNode(e,i)}));const i=this._getSizeParams();return this._techniqueConfig.drawScreenSize=i.drawScreenSpace,this._techniqueConfig.slicePlaneEnabled=this._slicePlaneEnabled,this._techniqueConfig.sceneHasOcludees=e.hasOccludees,this._techniqueConfig.output=e.pass===O.MATERIAL_DEPTH?v.Depth:e.pass===O.MATERIAL_HIGHLIGHT?v.Highlight:v.Color,this._techniqueRep.releaseAndAcquire(D,this._techniqueConfig,this._technique)}render(e,i){const t=e.rctx,s=this._getSizeParams(),r=i.program;t.useProgram(r),i.bindPipelineState(t);const h=this._clipBox,a=!w(h,x,((e,i)=>e===i));a||(p(this.tempVec3,-1/0,-1/0,-1/0),r.setUniform3fv("uClipMin",this.tempVec3),p(this.tempVec3,1/0,1/0,1/0),r.setUniform3fv("uClipMax",this.tempVec3)),r.setUniformMatrix4fv("uProjectionMatrix",e.camera.projectionMatrix);e.pass===O.MATERIAL_DEPTH&&r.setUniform2f("nearFar",e.camera.near,e.camera.far),e.isHighlightPass&&(this._bindParameters.inverseViewport[0]=1/e.camera.fullViewport[2],this._bindParameters.inverseViewport[1]=1/e.camera.fullViewport[3],this._bindParameters.highlightDepthTexture=e.highlightDepthTexture,L(r,this._bindParameters));const l=e.camera.pixelRatio;s.drawFixedSize&&r.setUniform2f("uPointScale",s.fixedSize*l,e.camera.fullHeight);const c=this._slicePlaneEnabled?e.sliceHelper&&e.sliceHelper.plane:null;this.nodes.forAll((d=>{if(0===d.coordinates.length||e.isHighlightPass&&!d.highlights)return;if(r.setUniform2f("uScreenMinMaxSize",s.screenMinSize*l,Z(d.isLeaf)*l),!s.drawFixedSize){const i=d.splatSize*this._scaleFactor;r.setUniform2f("uPointScale",i*l,e.camera.fullHeight/l)}const u=d.origin;a&&(p(this.tempVec3,h[0]-u[0],h[1]-u[1],h[2]-u[2]),r.setUniform3fv("uClipMin",this.tempVec3),p(this.tempVec3,h[3]-u[0],h[4]-u[1],h[5]-u[2]),r.setUniform3fv("uClipMax",this.tempVec3)),n(this.tempMatrix4,u),o(this.tempMatrix4,e.camera.viewMatrix,this.tempMatrix4),r.setUniformMatrix4fv("uModelViewMatrix",this.tempMatrix4),T(r,i.configuration,c,u),t.bindVAO(d.vao),e.isHighlightPass?this._renderHighlightFragments(t,d):t.drawArrays(G.POINTS,0,d.coordinates.length/3)}))}_renderHighlightFragments(e,s){const r=s.highlights;if(i(r))return;let n=t(r[0].component),o=n+1;for(let i=1;i<r.length;i++){const s=t(r[i].component);if(s!==o){const i=o-n;i>0&&e.drawArrays(G.POINTS,n,i),n=s}o=s+1}const h=o-n;h>0&&e.drawArrays(G.POINTS,n,h)}set useFixedSizes(e){this._useFixedSizes!==e&&(this._useFixedSizes=e,this._requestRender())}get useFixedSizes(){return this._useFixedSizes}set scaleFactor(e){this._scaleFactor!==e&&(this._scaleFactor=e,this._requestRender())}get scaleFactor(){return this._scaleFactor}set minSizePx(e){this._minSizePx!==e&&(this._minSizePx=e,this._requestRender())}get minSizePx(){return this._minSizePx}set useRealWorldSymbolSizes(e){this._useRealWorldSymbolSizes!==e&&(this._useRealWorldSymbolSizes=e,this._requestRender())}get useRealWorldSymbolSizes(){return this._useRealWorldSymbolSizes}set size(e){this._size!==e&&(this._size=e,this._requestRender())}get size(){return this._size}set sizePx(e){this._sizePx!==e&&(this._sizePx=e,this._requestRender())}get sizePx(){return this._sizePx}set clippingBox(e){R(this._clipBox,e||x)}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this._requestRender())}addNode(e){this.nodes.push(e),this._highlights.nodeAdded(e),this._requestRender()}removeNode(e){let i=null;return this.nodes.filterInPlace((t=>t.id!==e||(i=t,t.vao=s(t.vao),this._highlights.nodeRemoved(t),!1))),this._requestRender(),i}forEachNode(e){this.nodes.forAll(e)}removeAll(){this.nodes.forAll((e=>e.vao=s(e.vao))),this._highlights.removeAll(),this.nodes.clear(),this._requestRender()}highlight(e){return this._highlights.add(e)}_addHighlight(e,i,t){e.highlights=se(e.highlights,i,t),this._requestRender()}_removeHighlight(e,i){e.highlights=re(e.highlights,i),this._requestRender()}_initNode(e,i){const t=e.rctx;i.vao=new Y(t,F,K,{positions:B.createVertex(t,k.STATIC_DRAW,i.coordinates),colors:B.createVertex(t,k.STATIC_DRAW,i.rgb)})}_requestRender(){this._context&&this._context.requestRender()}_getSizeParams(){const e=this._useFixedSizes,i=e&&!this._useRealWorldSymbolSizes;return{drawScreenSpace:i,drawFixedSize:e,fixedSize:i?this._sizePx:this._size,screenMinSize:e?0:this._minSizePx}}}function X(e){return e.hasOwnProperty("splatSize")}function Z(e){return e?256:64}function $(e,i,t,s,r){if(t.drawScreenSpace)return t.fixedSize*i*s;const n=Z(r)*i*s;return t.drawFixedSize?Math.min(t.fixedSize/2,n):t.screenMinSize>0?Math.min(Math.max(t.screenMinSize*i*s,e/2),n):Math.min(e/2,n)}function ee(e,i,t,s,r){return t.drawScreenSpace?0:$(e,i,t,s,r)}function ie(e,t,s){return i(s)&&(s=f()),s[0]=e.origin[0]+e.coordinates[3*t],s[1]=e.origin[1]+e.coordinates[3*t+1],s[2]=e.origin[2]+e.coordinates[3*t+2],s}function te(i){return e(i.component)?i.component:-1}function se(e,t,s){i(e)&&(e=[]);const r={component:t,id:s};e.push(r);const n=te(r);let o=e.length-1;for(;o>0&&n<te(e[o-1]);)[e[o-1],e[o]]=[e[o],e[o-1]],--o;return e}function re(e,t){if(i(e))return e;const s=e.filter((e=>e.id!==t));return 0===s.length?null:s}class ne{constructor(){this.node=null,this.pointId=null,this.point=null,this.dist=null,this.normal=null,this.layerUid=""}}function oe(i){return e(i.dist)&&e(i.point)&&e(i.pointId)&&e(i.node)}export{Q as PointRenderer,X as isInstanceOfNode};
|
|
5
|
+
import{isSome as e,isNone as i,unwrap as t,disposeMaybe as s}from"../../../../core/maybe.js";import r from"../../../../core/PooledArray.js";import{f as n,m as o}from"../../../../chunks/mat4.js";import{c as h}from"../../../../chunks/mat4f32.js";import{f as a,l,a as c,o as d,d as u,p as m,s as p}from"../../../../chunks/vec3.js";import{c as g}from"../../../../chunks/vec3f32.js";import{c as f}from"../../../../chunks/vec3f64.js";import{s as _}from"../../../../chunks/vec4.js";import{create as x,POSITIVE_INFINITY as S,offset as z,contains as b,containsPoint as P,equals as w,set as R}from"../../../../geometry/support/aaBoundingBox.js";import{create as A}from"../../../../geometry/support/plane.js";import{fromPoints as M}from"../../../../geometry/support/ray.js";import{PointHighlights as j}from"./PointHighlights.js";import{minimumDistancePlane as y,maximumDistancePlane as H,intersectLine as q,toAaBoundingBox as v}from"../../support/orientedBoundingBox.js";import{ShaderOutput as I}from"../../webgl-engine/core/shaderLibrary/ShaderOutputOptions.js";import{bindSliceUniforms as T}from"../../webgl-engine/core/shaderLibrary/Slice.glsl.js";import{bindOutputHighlight as L}from"../../webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js";import{Default3D as E}from"../../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{newIntersectorResult as F}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as V,StoreResults as U}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{RenderPass as O}from"../../webgl-engine/lib/RenderPass.js";import{VertexAttribute as N}from"../../webgl-engine/lib/VertexAttribute.js";import{PointRendererTechniqueConfiguration as C,PointRendererTechnique as D}from"../../webgl-engine/shaders/PointRendererTechnique.js";import{BufferObject as B}from"../../../webgl/BufferObject.js";import{DataType as W,PrimitiveType as G,Usage as k}from"../../../webgl/enums.js";import{VertexArrayObject as Y}from"../../../webgl/VertexArrayObject.js";import{VertexElementDescriptor as J}from"../../../webgl/VertexElementDescriptor.js";const K={positions:[new J(N.POSITION,3,W.FLOAT,0,12)],colors:[new J(N.COLOR,3,W.UNSIGNED_BYTE,0,3,!0)]};class Q{constructor(e){this._params=e,this.type=V.PCL,this.isGround=!1,this._bindParameters={inverseViewport:[0,0],highlightDepthTexture:null},this._highlights=new j({forEachNode:e=>this.forEachNode(e),addHighlight:(e,i,t)=>this._addHighlight(e,i,t),removeHighlight:(e,i)=>this._removeHighlight(e,i)}),this.canRender=!0,this.layerUid="",this._useFixedSizes=!1,this._scaleFactor=1,this._minSizePx=0,this._useRealWorldSymbolSizes=!1,this._size=0,this._sizePx=0,this._slicePlaneEnabled=!1,this._clipBox=x(S),this._techniqueConfig=new C,this.tempMatrix4=h(),this.tempVec3=g(),this.nodes=new r}get needsHighlight(){return this._highlights.hasHighlights}initializeRenderContext(e){this._context=e,this._techniqueRep=this._context.shaderTechniqueRep,e.requestRender()}uninitializeRenderContext(){}intersect(e,i,t,s){const r=f(),n=f(),o=f(),h=f(),p=A(),g=e.camera.perScreenPixelRatio/2,S=e.camera.near,w=this._getSizeParams();a(n,s,t);const R=1/l(n);c(n,n,R),d(o,n),_(p,n[0],n[1],n[2],-u(n,t));const j=new ne,I=new ne,T=new Array,L=x(),E=x(this._clipBox);z(E,-t[0],-t[1],-t[2],E),this.nodes.forAll((l=>{const c=l.splatSize*this._scaleFactor;let d=y(l.obb,p),f=H(l.obb,p);d-=ee(c,d+S,w,g,l.isLeaf),f-=ee(c,f+S,w,g,l.isLeaf);const _=f<0,x=null!=j.dist&&null!=I.dist&&j.dist<d*R&&I.dist>f*R;if(_||x)return;const A=$(c,f+S,w,g,l.isLeaf);if(!q(l.obb,t,n,A))return;const M=A*A;v(l.obb,L),z(L,-t[0],-t[1],-t[2],L);const F=!b(E,L);a(h,l.origin,t);const V=l.coordinates.length/3;for(let a=0;a<V;a++){if(r[0]=h[0]+l.coordinates[3*a],r[1]=h[1]+l.coordinates[3*a+1],r[2]=h[2]+l.coordinates[3*a+2],F&&!P(E,r))continue;const d=u(r,n),p=m(r)-d*d;if(p>M)continue;let f=d+S;const _=ee(c,f,w,g,l.isLeaf);if(d-_<0)continue;f-=_;const x=$(c,f,w,g,l.isLeaf);if(p>x*x)continue;const z=(d-_)*R,b=e=>(e.point=ie(l,a,e.point),e.dist=z,e.normal=o,e.node=l,e.pointId=a,e.layerUid=this.layerUid,e);if((null==j.dist||z<j.dist)&&(null==i||i(t,s,z))&&b(j),e.options.store!==U.MIN&&(null==I.dist||z>I.dist)&&(null==i||i(t,s,z))&&b(I),e.options.store===U.ALL&&(null==i||i(t,s,z))){const e=new ne;T.push(b(e))}}}));const V=e=>{const{layerUid:i,node:t,pointId:s}=e;return{point:e.point,layerUid:i,graphicUid:s,createGraphic:()=>this._params.createGraphic(t,s,e.point)}},O=(e,i)=>{const t=V(i);e.set(this.type,t,i.dist,i.normal)};if(oe(j)){const i=e.results.min;(null==i.dist||j.dist<i.dist)&&O(i,j)}if(oe(I)&&e.options.store!==U.MIN){const i=e.results.max;(null==i.dist||I.dist>i.dist)&&O(i,I)}if(e.options.store===U.ALL){const i=M(t,s);for(const t of T){const s=F(i);O(s,t),e.results.all.push(s)}}}prepareTechnique(e){if(0===this.nodes.length||e.pass!==O.MATERIAL&&e.pass!==O.MATERIAL_DEPTH&&e.pass!==O.MATERIAL_HIGHLIGHT)return null;this.nodes.forAll((i=>{null==i.vao&&this._initNode(e,i)}));const i=this._getSizeParams();return this._techniqueConfig.drawScreenSize=i.drawScreenSpace,this._techniqueConfig.slicePlaneEnabled=this._slicePlaneEnabled,this._techniqueConfig.sceneHasOcludees=e.hasOccludees,this._techniqueConfig.output=e.pass===O.MATERIAL_DEPTH?I.Depth:e.pass===O.MATERIAL_HIGHLIGHT?I.Highlight:I.Color,this._techniqueRep.releaseAndAcquire(D,this._techniqueConfig,this._technique)}render(e,i){const t=e.rctx,s=t.useTechnique(i),r=this._clipBox,h=!w(r,S,((e,i)=>e===i));h||(p(this.tempVec3,-1/0,-1/0,-1/0),s.setUniform3fv("clipMin",this.tempVec3),p(this.tempVec3,1/0,1/0,1/0),s.setUniform3fv("clipMax",this.tempVec3)),s.setUniformMatrix4fv("proj",e.camera.projectionMatrix);e.pass===O.MATERIAL_DEPTH&&s.setUniform2fv("nearFar",e.camera.nearFar),e.isHighlightPass&&(this._bindParameters.inverseViewport[0]=1/e.camera.fullViewport[2],this._bindParameters.inverseViewport[1]=1/e.camera.fullViewport[3],this._bindParameters.highlightDepthTexture=e.highlightDepthTexture,L(s,this._bindParameters));const a=this._getSizeParams(),l=e.camera.pixelRatio;a.drawFixedSize&&s.setUniform2f("pointScale",a.fixedSize*l,e.camera.fullHeight);const c=this._slicePlaneEnabled?e.sliceHelper&&e.sliceHelper.plane:null;this.nodes.forAll((d=>{if(0===d.coordinates.length||e.isHighlightPass&&!d.highlights)return;if(s.setUniform2f("screenMinMaxSize",a.screenMinSize*l,Z(d.isLeaf)*l),!a.drawFixedSize){const i=d.splatSize*this._scaleFactor;s.setUniform2f("pointScale",i*l,e.camera.fullHeight/l)}const u=d.origin;h&&(p(this.tempVec3,r[0]-u[0],r[1]-u[1],r[2]-u[2]),s.setUniform3fv("clipMin",this.tempVec3),p(this.tempVec3,r[3]-u[0],r[4]-u[1],r[5]-u[2]),s.setUniform3fv("clipMax",this.tempVec3)),n(this.tempMatrix4,u),o(this.tempMatrix4,e.camera.viewMatrix,this.tempMatrix4),s.setUniformMatrix4fv("modelView",this.tempMatrix4),T(s,i.configuration,c,u),t.bindVAO(d.vao),e.isHighlightPass?this._renderHighlightFragments(t,d):t.drawArrays(G.POINTS,0,d.coordinates.length/3)}))}_renderHighlightFragments(e,s){const r=s.highlights;if(i(r))return;let n=t(r[0].component),o=n+1;for(let i=1;i<r.length;i++){const s=t(r[i].component);if(s!==o){const i=o-n;i>0&&e.drawArrays(G.POINTS,n,i),n=s}o=s+1}const h=o-n;h>0&&e.drawArrays(G.POINTS,n,h)}set useFixedSizes(e){this._useFixedSizes!==e&&(this._useFixedSizes=e,this._requestRender())}get useFixedSizes(){return this._useFixedSizes}set scaleFactor(e){this._scaleFactor!==e&&(this._scaleFactor=e,this._requestRender())}get scaleFactor(){return this._scaleFactor}set minSizePx(e){this._minSizePx!==e&&(this._minSizePx=e,this._requestRender())}get minSizePx(){return this._minSizePx}set useRealWorldSymbolSizes(e){this._useRealWorldSymbolSizes!==e&&(this._useRealWorldSymbolSizes=e,this._requestRender())}get useRealWorldSymbolSizes(){return this._useRealWorldSymbolSizes}set size(e){this._size!==e&&(this._size=e,this._requestRender())}get size(){return this._size}set sizePx(e){this._sizePx!==e&&(this._sizePx=e,this._requestRender())}get sizePx(){return this._sizePx}set clippingBox(e){R(this._clipBox,e||S)}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this._requestRender())}addNode(e){this.nodes.push(e),this._highlights.nodeAdded(e),this._requestRender()}removeNode(e){let i=null;return this.nodes.filterInPlace((t=>t.id!==e||(i=t,t.vao=s(t.vao),this._highlights.nodeRemoved(t),!1))),this._requestRender(),i}forEachNode(e){this.nodes.forAll(e)}removeAll(){this.nodes.forAll((e=>e.vao=s(e.vao))),this._highlights.removeAll(),this.nodes.clear(),this._requestRender()}highlight(e){return this._highlights.add(e)}_addHighlight(e,i,t){e.highlights=se(e.highlights,i,t),this._requestRender()}_removeHighlight(e,i){e.highlights=re(e.highlights,i),this._requestRender()}_initNode(e,i){const t=e.rctx;i.vao=new Y(t,E,K,{positions:B.createVertex(t,k.STATIC_DRAW,i.coordinates),colors:B.createVertex(t,k.STATIC_DRAW,i.rgb)})}_requestRender(){this._context&&this._context.requestRender()}_getSizeParams(){const e=this._useFixedSizes,i=e&&!this._useRealWorldSymbolSizes;return{drawScreenSpace:i,drawFixedSize:e,fixedSize:i?this._sizePx:this._size,screenMinSize:e?0:this._minSizePx}}}function X(e){return e.hasOwnProperty("splatSize")}function Z(e){return e?256:64}function $(e,i,t,s,r){if(t.drawScreenSpace)return t.fixedSize*i*s;const n=Z(r)*i*s;return t.drawFixedSize?Math.min(t.fixedSize/2,n):t.screenMinSize>0?Math.min(Math.max(t.screenMinSize*i*s,e/2),n):Math.min(e/2,n)}function ee(e,i,t,s,r){return t.drawScreenSpace?0:$(e,i,t,s,r)}function ie(e,t,s){return i(s)&&(s=f()),s[0]=e.origin[0]+e.coordinates[3*t],s[1]=e.origin[1]+e.coordinates[3*t+1],s[2]=e.origin[2]+e.coordinates[3*t+2],s}function te(i){return e(i.component)?i.component:-1}function se(e,t,s){i(e)&&(e=[]);const r={component:t,id:s};e.push(r);const n=te(r);let o=e.length-1;for(;o>0&&n<te(e[o-1]);)[e[o-1],e[o]]=[e[o],e[o-1]],--o;return e}function re(e,t){if(i(e))return e;const s=e.filter((e=>e.id!==t));return 0===s.length?null:s}class ne{constructor(){this.node=null,this.pointId=null,this.point=null,this.dist=null,this.normal=null,this.layerUid=""}}function oe(i){return e(i.dist)&&e(i.point)&&e(i.pointId)&&e(i.node)}export{Q as PointRenderer,X as isInstanceOfNode};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{HandleOwner as t}from"../../../../core/HandleOwner.js";import{makeHandle as r}from"../../../../core/handleUtils.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatePolicy as s}from"../../webgl-engine/lib/basicInterfaces.js";let n=class extends t{constructor(e){super(e),this.type="heatmap",this.filterVisibility={filterChanged(){},dirty:!1},this.preferredUpdatePolicy=s.ASYNC,this.dataExtent=null}initialize(){this.updatingHandles.addOnCollectionChange((()=>this.owner.loadedGraphics),(e=>{}))}destroy(){}get layer(){return this.owner.layer}get updating(){return this.updatingHandles.updating}get updatingRemaining(){return 0}get suspendInfo(){return{}}get legendEnabled(){return!0}get displayFeatureLimit(){return{minimumTotalNumberOfFeatures:0,maximumTotalNumberOfFeatures:1e10,maximumTotalNumberOfPrimitives:1e10,maximumNumberOfFeatures:1e10}}get scaleVisibilitySuspended(){return!1}get usedMemory(){return 0}get usedMemoryPerFeature(){return 0}get unprocessedMemoryEstimate(){return 0}get performanceInfo(){return{core:{visible:0,missing:0,pending:0},elevationUpdating:!1,visibilityFrustum:!0,visibilityScale:!0}}async whenGraphicBounds(){return null}computeAttachmentOrigin(){return null}highlight(){return a}maskOccludee(){return a}setObjectIdVisibility(){}};e([i()],n.prototype,"type",void 0),e([i()],n.prototype,"owner",void 0),e([i()],n.prototype,"layer",null),e([i()],n.prototype,"featureStore",void 0),e([i()],n.prototype,"updating",null),e([i()],n.prototype,"updatingRemaining",null),e([i()],n.prototype,"suspendInfo",null),e([i()],n.prototype,"legendEnabled",null),e([i()],n.prototype,"filterVisibility",void 0),e([i()],n.prototype,"displayFeatureLimit",null),e([i()],n.prototype,"preferredUpdatePolicy",void 0),e([i()],n.prototype,"dataExtent",void 0),n=e([o("esri.views.3d.layers.support.HeatmapFeatureProcessor")],n);const a=r();export{n as HeatmapFeatureProcessor};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{width as t,height as e,intersects as n}from"../../../../geometry/support/aaBoundingRect.js";import{
|
|
5
|
+
import{width as t,height as e,intersects as n}from"../../../../geometry/support/aaBoundingRect.js";import{Geometry as r}from"../../webgl-engine/lib/Geometry.js";import i from"../../webgl-engine/lib/GeometryUtil.js";import{VertexAttribute as o}from"../../webgl-engine/lib/VertexAttribute.js";function a(n,r,i){const o=t(n)/e(n),a={width:i,height:i};return o>1.0001?a.height=i/o:o<.9999&&(a.width=i*o),a.width=Math.round(a.width/(t(n)/t(r))),a.height=Math.round(a.height/(e(n)/e(r))),a}function h(t){return i.createSquareGeometry([[t[0],t[1],-1],[t[2],t[1],-1],[t[2],t[3],-1],[t[0],t[3],-1]])}function l(t,e){if(!n(t,e))return h(e);const i=[t[1]-e[1],Math.min(t[3],e[3])-Math.max(t[1],e[1]),e[3]-t[3],123456],a=[t[0]-e[0],Math.min(t[2],e[2])-Math.max(t[0],e[0]),e[2]-t[2],123456],l=e[2]-e[0],u=e[3]-e[1],m=a[0]>0&&a[2]>0?3:2,c=i[0]>0&&i[2]>0?3:2,g=(c+1)*(m+1),w=new Float64Array(3*g),f=new Float32Array(2*g),d=new Uint32Array(6*(c*m-1));let y=0,M=0,b=0,p=0,x=0;for(let n=0;n<4;n++){const t=i[n];if(t<=0)continue;let r=0;for(let i=0;i<4;i++){const t=a[i];t<=0||(w[M++]=e[0]+r,w[M++]=e[1]+y,w[M++]=-1,f[b++]=r/l,f[b++]=y/u,i<3&&n<3&&(1!==i||1!==n)&&(d[x++]=p,d[x++]=p+1,d[x++]=p+m+1,d[x++]=p+1,d[x++]=p+m+2,d[x++]=p+m+1),p++,r+=t)}y+=t}const A=new Uint32Array(d.length);return new r([[o.POSITION,{size:3,data:w,exclusive:!0}],[o.NORMAL,{size:3,data:s,exclusive:!0}],[o.UV0,{size:2,data:f,exclusive:!0}]],[[o.POSITION,d],[o.NORMAL,A],[o.UV0,d]])}const s=[0,0,1];export{a as computeImageExportSize,h as createGeometryForExtent,l as createOuterImageGeometry};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../core/has.js";import{isSome as r}from"../../../../core/maybe.js";import{f as e}from"../../../../chunks/vec4f64.js";import{BufferViewMat3f64 as t,BufferViewVec3f64 as a,BufferViewVec4f as o}from"../../../../geometry/support/buffer/BufferView.js";import{perVertexElevationAligner as n}from"../graphics/ElevationAligners.js";import{createMapSpaceUVCoords as
|
|
5
|
+
import"../../../../core/has.js";import{isSome as r}from"../../../../core/maybe.js";import{f as e}from"../../../../chunks/vec4f64.js";import{BufferViewMat3f64 as t,BufferViewVec3f64 as a,BufferViewVec4f as o}from"../../../../geometry/support/buffer/BufferView.js";import{perVertexElevationAligner as n}from"../graphics/ElevationAligners.js";import{createMapSpaceUVCoords as i}from"./uvUtils.js";import{VertexAttribute as s}from"../../webgl-engine/lib/VertexAttribute.js";import{ColorMaterial as l}from"../../webgl-engine/materials/ColorMaterial.js";import{PatternMaterial as m}from"../../webgl-engine/materials/PatternMaterial.js";import{Style as c}from"../../webgl-engine/materials/PatternStyle.js";function f(r,e,t){return g(u(r),e,t)}function u(r){return r&&r.pattern||null}function g(t,a,o){return r(t)?"none"===t.style||"solid"===t.style?("none"===t.style&&(a.color=e(0,0,0,0),a.transparent=!0),new l(a)):(a.style=p(t.style),a.draped=o.isDraped,new m(a)):new l(a)}function p(r){switch(r){case"horizontal":return c.Horizontal;case"vertical":return c.Vertical;case"cross":return c.Cross;case"forward-diagonal":return c.ForwardDiagonal;case"backward-diagonal":return c.BackwardDiagonal;case"diagonal-cross":return c.DiagonalCross;default:return}}function d(r){return r.material instanceof m&&!r.material.parameters.draped}function y(r,e){if(d(r)){const n=r.geometry.vertexAttributes,l=n.get(s.POSITION).data,m=n.get(s.UVMAPSPACE).data,c=n.get(s.BOUNDINGRECT).data;i(o.fromTypedArray(m),a.fromTypedArray(l),e,t.fromTypedArray(c))}}function w(r,e,t,a){const o=n(r,e,t,a),i=r.stageObject.geometryRecords;for(let n=0;n<i.length;n++)y(i[n],a);return o}export{f as createMaterial,g as createMaterialFromPattern,p as parsePatternStyle,d as requiresUVUpdates,y as updateMapSpaceUVCoords,w as uvElevationAligner};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../../chunks/tslib.es6.js";import{asinClamped as i}from"../../../../../core/mathUtils.js";import{createScreenPointArray as e,screenPointObjectToArray as n}from"../../../../../core/screenUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{o as r,g as a,d as m,a as h,f as c,n as l,b as p}from"../../../../../chunks/vec3.js";import{c as u,f as d}from"../../../../../chunks/vec3f64.js";import{wrapAxisAngle as C}from"../../../../../geometry/support/axisAngle.js";import{create as g,fromNormalAndOffset as v,setOffsetFromPoint as M,negate as f,normal as w}from"../../../../../geometry/support/plane.js";import{pixelDistanceToInteractionFactor as b,applyAll as S}from"../../../camera/constraintUtils.js";import{ConstraintTypes as V,InteractionType as E,TiltMode as P}from"../../../camera/constraintUtils/common.js";import{ExponentialFalloff as j}from"../../../input/util.js";import{InteractiveController as z}from"../InteractiveController.js";import{PanPlanarMomentumController as H}from"../momentum/PanPlanarMomentumController.js";import{RotationMomentumController as O}from"../momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as y}from"../momentum/ZoomPlanarMomentumController.js";import{NavigationMode as T,centroid as A,applyZoomToPoint as F,applyPanPlanar as L,normalizeRotationDelta as x,applyRotation as R,intersectPlaneFromScreenPointAtEye as U}from"../../utils/navigationUtils.js";import D from"../../../webgl-engine/lib/Camera.js";import{PanPlanarMomentumEstimator as N}from"../../../../navigation/PanPlanarMomentumEstimator.js";import{RotationMomentumEstimator as _}from"../../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as k}from"../../../../navigation/ZoomMomentumEstimator.js";const I=d(0,0,1),G={ELEVATION_THRESHOLD:3e4,ANGLE_THRESHOLD:16/180*Math.PI},Z=80;let B=class extends z{constructor(t){super(t),this.view=null,this.rotationValueSmooth=new j(.05),this.scalingValueSmooth=new j(.05),this.planeHorizontal=g(),this.planeVertical=g(),this.rotationMomentumEstimator=new _,this.panMomentumEstimator=new N(300,12,.9),this.zoomMomentumEstimator=new k,this.beginCenter=u(),this.tmpPoints=[],this.beginCenterScreen=e(),this.tmpCentroid3d=u(),this.tmpCentroid2d=e(),this.tmp2d=e(),this.constraintOptions={selection:V.ALL,interactionType:E.NONE,interactionFactor:0,interactionStartCamera:new D,interactionDirection:null,tiltMode:P.TUMBLE}}get intersectionHelper(){return this.view.sceneIntersectionHelper}begin(t){if(!this.active)return;const e=this.view.navigation.momentumEnabled;this.zoomMomentumEstimator.enabled=e,this.rotationMomentumEstimator.enabled=e,this.panMomentumEstimator.enabled=e,this.beginRadius=t.radius,this.pointerCount=t.pointers.size,this.beginAngle=t.angle,this.rotationValueSmooth.reset(),this.scalingValueSmooth.reset(),n(t.center,this.beginCenterScreen),v(I,0,this.planeHorizontal);const o=u();this.intersectionHelper.intersectScreenFreePointFallback(this.beginCenterScreen,o);const s=u();r(s,this.startCamera.viewForward);const d=u();a(d,I);const C=m(s,d),g=i(C<0?-C:C);if(this.panMode=g>=G.ANGLE_THRESHOLD?T.Horizontal:T.Vertical,M(this.planeHorizontal,
|
|
5
|
+
import{_ as t}from"../../../../../chunks/tslib.es6.js";import{asinClamped as i}from"../../../../../core/mathUtils.js";import{createScreenPointArray as e,screenPointObjectToArray as n}from"../../../../../core/screenUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{o as r,g as a,d as m,a as h,f as c,n as l,b as p}from"../../../../../chunks/vec3.js";import{c as u,f as d}from"../../../../../chunks/vec3f64.js";import{wrapAxisAngle as C}from"../../../../../geometry/support/axisAngle.js";import{create as g,fromNormalAndOffset as v,setOffsetFromPoint as M,negate as f,normal as w}from"../../../../../geometry/support/plane.js";import{pixelDistanceToInteractionFactor as b,applyAll as S}from"../../../camera/constraintUtils.js";import{ConstraintTypes as V,InteractionType as E,TiltMode as P}from"../../../camera/constraintUtils/common.js";import{ExponentialFalloff as j}from"../../../input/util.js";import{InteractiveController as z}from"../InteractiveController.js";import{PanPlanarMomentumController as H}from"../momentum/PanPlanarMomentumController.js";import{RotationMomentumController as O}from"../momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as y}from"../momentum/ZoomPlanarMomentumController.js";import{NavigationMode as T,centroid as A,applyZoomToPoint as F,applyPanPlanar as L,normalizeRotationDelta as x,applyRotation as R,intersectPlaneFromScreenPointAtEye as U}from"../../utils/navigationUtils.js";import D from"../../../webgl-engine/lib/Camera.js";import{PanPlanarMomentumEstimator as N}from"../../../../navigation/PanPlanarMomentumEstimator.js";import{RotationMomentumEstimator as _}from"../../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as k}from"../../../../navigation/ZoomMomentumEstimator.js";const I=d(0,0,1),G={ELEVATION_THRESHOLD:3e4,ANGLE_THRESHOLD:16/180*Math.PI},Z=80;let B=class extends z{constructor(t){super(t),this.view=null,this.rotationValueSmooth=new j(.05),this.scalingValueSmooth=new j(.05),this.planeHorizontal=g(),this.planeVertical=g(),this.rotationMomentumEstimator=new _,this.panMomentumEstimator=new N(300,12,.9),this.zoomMomentumEstimator=new k,this.beginCenter=u(),this.tmpPoints=[],this.beginCenterScreen=e(),this.tmpCentroid3d=u(),this.tmpCentroid2d=e(),this.tmp2d=e(),this.constraintOptions={selection:V.ALL,interactionType:E.NONE,interactionFactor:0,interactionStartCamera:new D,interactionDirection:null,tiltMode:P.TUMBLE}}get intersectionHelper(){return this.view.sceneIntersectionHelper}begin(t){if(!this.active)return;const e=this.view.navigation.momentumEnabled;this.zoomMomentumEstimator.enabled=e,this.rotationMomentumEstimator.enabled=e,this.panMomentumEstimator.enabled=e,this.beginRadius=t.radius,this.pointerCount=t.pointers.size,this.beginAngle=t.angle,this.rotationValueSmooth.reset(),this.scalingValueSmooth.reset(),n(t.center,this.beginCenterScreen),v(I,0,this.planeHorizontal);const o=u();this.intersectionHelper.intersectScreenFreePointFallback(this.beginCenterScreen,o);const s=u();r(s,this.startCamera.viewForward);const d=u();a(d,I);const C=m(s,d),g=i(C<0?-C:C);if(this.panMode=g>=G.ANGLE_THRESHOLD?T.Horizontal:T.Vertical,M(this.planeHorizontal,this.planeHorizontal,o),this.startCamera.aboveGround||f(this.planeHorizontal,this.planeHorizontal),this.panMode===T.Vertical){h(d,d,C),c(this.planeVertical,s,d),l(this.planeVertical,this.planeVertical),M(this.planeVertical,this.planeVertical,o);const i=u(),e=u(),n=u();c(i,o,this.currentCamera.eye),l(i,i);const r=5*Math.max(Math.abs(this.view.camera.position.z),50),g=this.view._stage.renderView.getMinimalDepthForArea(this.view.getVoxelWasmPerSceneView(),this.beginCenterScreen[0],this.beginCenterScreen[1],this.view.state.camera,Z),v=g?Math.min(g,r):r;a(n,p(e,this.currentCamera.eye,h(e,i,v))),this.planeVertical[3]=-m(this.planeVertical,n),this.computePlanePoints(t.pointers,this.planeVertical,this.startCamera,this.tmpPoints),A(this.tmpPoints,this.beginCenter)}else this.computePlanePoints(t.pointers,this.planeHorizontal,this.startCamera,this.tmpPoints),A(this.tmpPoints,this.beginCenter);this.constraintOptions.interactionStartCamera.copyFrom(this.startCamera)}update(t){if(!this.active)return;this.currentCamera.copyFrom(this.startCamera);const i=t.pointers.size>1,e=this.panMode===T.Horizontal?this.planeHorizontal:this.planeVertical,o=this.beginCenter;if(i){const i=this.beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this.scalingValueSmooth.gain=e,this.scalingValueSmooth.update(i),F(this.currentCamera,o,this.scalingValueSmooth.value,this.view.state.constraints.minimumPoiDistance),this.zoomMomentumEstimator.add(this.scalingValueSmooth.value,.001*t.timestamp),this.constraintOptions.interactionType=E.ZOOM,this.constraintOptions.interactionFactor=b(Math.abs(t.radius-this.beginRadius)),S(this.view,this.currentCamera,this.constraintOptions)}if(this.computePlanePoints(t.pointers,e,this.currentCamera,this.tmpPoints),A(this.tmpPoints,this.tmpCentroid3d),n(t.center,this.tmpCentroid2d),L(this.currentCamera,o,this.tmpCentroid3d),this.panMomentumEstimator.add(this.tmpCentroid2d,this.tmpCentroid3d,.001*t.timestamp),this.constraintOptions.interactionType=E.PAN,this.constraintOptions.interactionFactor=b(this.beginCenterScreen,this.tmpCentroid2d),S(this.view,this.currentCamera,this.constraintOptions),i){const i=this.planeHorizontal,e=o,n=this.rotationValueSmooth.value,s=n+x(t.angle-n),r=.00125*Math.min(Math.max(t.radius,40),120);this.rotationValueSmooth.gain=r,this.rotationValueSmooth.update(s);const a=this.rotationValueSmooth.value-this.beginAngle;this.rotationMomentumEstimator.add(a,.001*t.timestamp),R(this.currentCamera,e,C(i,a)),this.constraintOptions.interactionType=E.TUMBLE,this.constraintOptions.interactionFactor=b(Math.abs(t.radius*a)),S(this.view,this.currentCamera,this.constraintOptions)}}end(t){t.pointers.size===this.pointerCount&&this.update(t),this.finishController();const i=this.zoomMomentumEstimator.evaluateMomentum();if(i)return new y({view:this.view,momentum:i,zoomCenter:this.beginCenter});const e=this.rotationMomentumEstimator.evaluateMomentum();if(e)return new O({view:this.view,momentum:e,center:this.beginCenter,axis:w(this.planeHorizontal)});const n=this.panMomentumEstimator.evaluateMomentum();return n?new H({view:this.view,momentum:n}):null}computePlanePoints(t,i,e,n){n.length=t.size;const o=this.tmp2d;let s=0;return t.forEach((t=>{o[0]=t.x,o[1]=t.y,void 0===n[s]&&(n[s]=u()),U(i,e,o,n[s]),s+=1})),n}};t([o({constructOnly:!0})],B.prototype,"view",void 0),B=t([s("esri.views.3d.state.controllers.local.PinchAndPanController")],B);export{B as PinchAndPanController};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{neverReached as t}from"../../../core/compilerUtils.js";import{lerp as e}from"../../../core/mathUtils.js";import{a as i}from"../../../chunks/mat4.js";import{c as r}from"../../../chunks/mat4f64.js";import{b as n,a as o,r as s,m as a,s as c,d as l}from"../../../chunks/vec3.js";import{c as p}from"../../../chunks/vec3f64.js";import{computeTranslationToOriginAndRotation as h,projectVectorToVector as d,projectBoundingRect as m}from"../../../geometry/projection.js";import{getReferenceEllipsoid as g}from"../../../geometry/projectionEllipsoid.js";import{create as u,empty as f,expandWithVec3 as x}from"../../../geometry/support/aaBoundingBox.js";import{create as R,center as y}from"../../../geometry/support/aaBoundingRect.js";import{PlaneIndex as j}from"../../../geometry/support/frustum.js";import{create as b,fromPoints as A}from"../../../geometry/support/lineSegment.js";import{create as E,fromVectorsAndPoint as S,copy as C,negate as H}from"../../../geometry/support/plane.js";import{wrap as w}from"../../../geometry/support/ray.js";import{ViewingMode as B}from"../../ViewingMode.js";import{frustumLineSegment as G}from"./intersectionUtils.js";const M=.5*Math.PI,F=M/Math.PI*180;class _{constructor(t){this.renderCoordsHelper=t.renderCoordsHelper,this.extent=new Array(4),this.planes=new Array(6),this.maxSpan=0,this.center={origin:p(),direction:p()};for(let e=0;e<4;e++)this.extent[e]={origin:p(),direction:p(),cap:{next:null,direction:p()}},this.planes[e]=E();this.planes[j.NEAR]=E(),this.planes[j.FAR]=E(),this.planesWithoutFar=this.planes.slice(0,5)}update(t,e,i,r=!0){const a=this.extent;this._toRenderBoundingExtent(t,e,i),n(this.center.origin,a[0].origin,a[2].origin),o(this.center.origin,this.center.origin,.5),this.renderCoordsHelper.worldUpAtPosition(this.center.origin,this.center.direction),r||o(this.center.direction,this.center.direction,-1);for(let n=0;n<4;n++){const t=a[n];this.renderCoordsHelper.worldUpAtPosition(t.origin,t.direction);const e=a[3===n?0:n+1];t.cap.next=e.origin,s(t.cap.direction,t.origin,e.origin),S(t.direction,t.cap.direction,t.origin,this.planes[n]),r||o(t.direction,t.direction,-1)}S(a[0].cap.direction,a[1].cap.direction,a[0].origin,this.planes[j.NEAR]),r?H(this.planes[j.NEAR],this.planes[j.FAR]):(C(this.planes[j.
|
|
5
|
+
import{neverReached as t}from"../../../core/compilerUtils.js";import{lerp as e}from"../../../core/mathUtils.js";import{a as i}from"../../../chunks/mat4.js";import{c as r}from"../../../chunks/mat4f64.js";import{b as n,a as o,r as s,m as a,s as c,d as l}from"../../../chunks/vec3.js";import{c as p}from"../../../chunks/vec3f64.js";import{computeTranslationToOriginAndRotation as h,projectVectorToVector as d,projectBoundingRect as m}from"../../../geometry/projection.js";import{getReferenceEllipsoid as g}from"../../../geometry/projectionEllipsoid.js";import{create as u,empty as f,expandWithVec3 as x}from"../../../geometry/support/aaBoundingBox.js";import{create as R,center as y}from"../../../geometry/support/aaBoundingRect.js";import{PlaneIndex as j}from"../../../geometry/support/frustum.js";import{create as b,fromPoints as A}from"../../../geometry/support/lineSegment.js";import{create as E,fromVectorsAndPoint as S,copy as C,negate as H}from"../../../geometry/support/plane.js";import{wrap as w}from"../../../geometry/support/ray.js";import{ViewingMode as B}from"../../ViewingMode.js";import{frustumLineSegment as G}from"./intersectionUtils.js";const M=.5*Math.PI,F=M/Math.PI*180;class _{constructor(t){this.renderCoordsHelper=t.renderCoordsHelper,this.extent=new Array(4),this.planes=new Array(6),this.maxSpan=0,this.center={origin:p(),direction:p()};for(let e=0;e<4;e++)this.extent[e]={origin:p(),direction:p(),cap:{next:null,direction:p()}},this.planes[e]=E();this.planes[j.NEAR]=E(),this.planes[j.FAR]=E(),this.planesWithoutFar=this.planes.slice(0,5)}update(t,e,i,r=!0){const a=this.extent;this._toRenderBoundingExtent(t,e,i),n(this.center.origin,a[0].origin,a[2].origin),o(this.center.origin,this.center.origin,.5),this.renderCoordsHelper.worldUpAtPosition(this.center.origin,this.center.direction),r||o(this.center.direction,this.center.direction,-1);for(let n=0;n<4;n++){const t=a[n];this.renderCoordsHelper.worldUpAtPosition(t.origin,t.direction);const e=a[3===n?0:n+1];t.cap.next=e.origin,s(t.cap.direction,t.origin,e.origin),S(t.direction,t.cap.direction,t.origin,this.planes[n]),r||o(t.direction,t.direction,-1)}S(a[0].cap.direction,a[1].cap.direction,a[0].origin,this.planes[j.NEAR]),r?H(this.planes[j.NEAR],this.planes[j.FAR]):(C(this.planes[j.FAR],this.planes[j.NEAR]),H(this.planes[j.NEAR],this.planes[j.NEAR])),this.maxSpan=Math.max(Math.abs(t[0]-t[2]),Math.abs(t[1]-t[3])),this.maxSpanSpatialReference=e,this.minGlobalAltitude=.9*g(this.maxSpanSpatialReference).radius}isVisibleInFrustum(t,e,i=!1){if(null==t)return!1;if(this.renderCoordsHelper.viewingMode===B.Global){const i=this.maxSpanSpatialReference.isGeographic?F:M*e;if(this.maxSpan>i)return!0;if(t.altitude>=this.minGlobalAltitude)return this._isVisibleInFrustumGlobal(t)}if(0===this.maxSpan){const e=this.extent[0];return!(i||!t.intersectsRay(w(e.origin,e.direction)))}for(let n=0;n<this.extent.length;n++){const e=this.extent[n];if(!i&&t.intersectsRay(w(e.origin,e.direction)))return!0;if(t.intersectsLineSegment(A(e.origin,e.cap.next,P),e.cap.direction))return!0}const r=i?this.planes:this.planesWithoutFar;for(let n=0;n<t.lines.length;n++){const e=t.lines[n];if(G(r,e.origin,e.endpoint,e.direction))return!0}return!1}_toRenderBoundingExtentGlobal(t,r,n){const o=5;y(t,N),N[2]=n,h(r,N,v,this.renderCoordsHelper.spatialReference),i(I,v),f(U);for(const{x0:i,x1:s,y0:c,y1:l}of k)for(let p=0;p<o;p++){const h=p/(o-1);N[0]=e(t[i],t[s],h),N[1]=e(t[c],t[l],h),N[2]=n,d(N,r,N,this.renderCoordsHelper.spatialReference),a(N,N,I),x(U,N)}c(this.extent[0].origin,U[0],U[1],U[2]),c(this.extent[1].origin,U[3],U[1],U[2]),c(this.extent[2].origin,U[3],U[4],U[2]),c(this.extent[3].origin,U[0],U[4],U[2]);for(let e=0;e<4;++e)a(this.extent[e].origin,this.extent[e].origin,v)}_toRenderBoundingExtentLocal(t,e,i){m(t,e,L,this.renderCoordsHelper.spatialReference),c(this.extent[0].origin,L[0],L[1],i),c(this.extent[1].origin,L[2],L[1],i),c(this.extent[2].origin,L[2],L[3],i),c(this.extent[3].origin,L[0],L[3],i)}_toRenderBoundingExtent(e,i,r){switch(this.renderCoordsHelper.viewingMode){case B.Global:this._toRenderBoundingExtentGlobal(e,i,r);break;case B.Local:this._toRenderBoundingExtentLocal(e,i,r);break;default:t(this.renderCoordsHelper.viewingMode)}}_isVisibleInFrustumGlobal(t){if(l(this.center.direction,t.direction)<0)return!0;for(let e=0;e<4;e++){const i=this.extent[e];if(l(i.direction,t.direction)<0)return!0}return!1}}const k=[{x0:0,y0:1,x1:2,y1:1},{x0:0,y0:3,x1:2,y1:3},{x0:0,y0:1,x1:0,y1:3},{x0:2,y0:1,x1:2,y1:3}],N=p(),v=r(),I=r(),U=u(),L=R(),P=b();export{_ as FrustumExtentIntersection,_ as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{deg2rad as e}from"../../../core/mathUtils.js";import{isSome as t,isNone as i,disposeMaybe as n,releaseMaybe as s}from"../../../core/maybe.js";import{a as r}from"../../../chunks/vec2f64.js";import{g as a,m as h,i as l,n as o,c,b as _}from"../../../chunks/vec3.js";import{c as d}from"../../../chunks/vec3f64.js";import{t as m}from"../../../chunks/vec4.js";import{c as p}from"../../../chunks/vec4f64.js";import{create as f,fromRay as g,getStart as u,getEnd as b}from"../../../geometry/support/clipRay.js";import{intersectClipRay as P}from"../../../geometry/support/frustum.js";import{create as V,copy as E,pointAt as L}from"../../../geometry/support/lineSegment.js";import{create as D,fromPositionAndNormal as S}from"../../../geometry/support/plane.js";import{wrap as q}from"../../../geometry/support/ray.js";import{c as R}from"../../../chunks/sphere.js";import{LaserlinePathData as U}from"./LaserlinePathData.js";import{createQuadVAO as T}from"../webgl-engine/lib/glUtil3D.js";import{RenderSlot as M}from"../webgl-engine/lib/RenderSlot.js";import{inverseProjectionInfo as x}from"../webgl-engine/lib/Util.js";import{copyParameters as C,updateParameters as A}from"../webgl-engine/materials/internal/MaterialUtil.js";import{LaserlinePathTechniqueConfiguration as v,LaserlinePathTechnique as j}from"../webgl-engine/shaders/LaserlinePathTechnique.js";import{LaserlineTechniqueConfiguration as w,LaserlineTechnique as I}from"../webgl-engine/shaders/LaserlineTechnique.js";import{PrimitiveType as O}from"../../webgl/enums.js";const y=d(),H=p(),z={glowColor:[1,.5,0],glowWidth:8,glowFalloff:8,innerColor:[1,1,1],innerWidth:1,globalAlpha:.75,angleCutoff:e(6),globalAlphaContrastBoost:2};function N(e,t,i,n){const s=y,r=H;h(s,t,n),a(r,i),r[3]=0,m(r,r,n),S(s,r,e)}class k{constructor(e,t={},i={contrastControlEnabled:!1}){this._renderCoordsHelper=e,this._config=i,this._technique=null,this._projInfo=p(),this._zScale=r(),this._heightManifoldEnabled=!1,this._heightManifoldTarget=d(),this._pointDistanceEnabled=!1,this._pointDistanceOrigin=d(),this._pointDistanceTarget=d(),this._lineVerticalPlaneEnabled=!1,this._lineVerticalPlaneSegment=V(),this._intersectsLineEnabled=!1,this._intersectsLineSegment=V(),this._intersectsLineRadius=3,this._intersectsLineInfinite=!1,this._pathVerticalPlaneEnabled=!1,this._pathVerticalPlaneData=null,this._pathTechnique=null,this.canRender=!0,this._tempNormal=d(),this._tempDir=d(),this._tempUp=d(),this._tempVec3A=d(),this._tempVec3B=d(),this._tempVec4=p(),this._tempPlane=D(),this._tempSphere=R(),this._params=C(t,z)}get renderSlots(){return[this._config.contrastControlEnabled?M.LASERLINES_CONTRAST_CONTROL:M.LASERLINES]}get needsLinearDepth(){return!0}get heightManifoldEnabled(){return this._heightManifoldEnabled}set heightManifoldEnabled(e){this._heightManifoldEnabled!==e&&(this._heightManifoldEnabled=e,this._requestRender())}get heightManifoldTarget(){return this._heightManifoldTarget}set heightManifoldTarget(e){a(this._heightManifoldTarget,e),this._requestRender()}get pointDistanceEnabled(){return this._pointDistanceEnabled}set pointDistanceEnabled(e){e!==this._pointDistanceEnabled&&(this._pointDistanceEnabled=e,this._requestRender())}get pointDistanceTarget(){return this._pointDistanceTarget}set pointDistanceTarget(e){a(this._pointDistanceTarget,e),this._requestRender()}get pointDistanceOrigin(){return this._pointDistanceOrigin}set pointDistanceOrigin(e){a(this._pointDistanceOrigin,e),this._requestRender()}get lineVerticalPlaneEnabled(){return this._lineVerticalPlaneEnabled}set lineVerticalPlaneEnabled(e){e!==this._lineVerticalPlaneEnabled&&(this._lineVerticalPlaneEnabled=e,this._requestRender())}get lineVerticalPlaneSegment(){return this._lineVerticalPlaneSegment}set lineVerticalPlaneSegment(e){E(e,this._lineVerticalPlaneSegment),this._requestRender()}get intersectsLineEnabled(){return this._intersectsLineEnabled}set intersectsLineEnabled(e){e!==this._intersectsLineEnabled&&(this._intersectsLineEnabled=e,this._requestRender())}get intersectsLineSegment(){return this._intersectsLineSegment}set intersectsLineSegment(e){E(e,this._intersectsLineSegment),this._requestRender()}get intersectsLineRadius(){return this._intersectsLineRadius}set intersectsLineRadius(e){e!==this._intersectsLineRadius&&(this._intersectsLineRadius=e,this._requestRender())}get intersectsLineInfinite(){return this._intersectsLineInfinite}set intersectsLineInfinite(e){e!==this._intersectsLineInfinite&&(this._intersectsLineInfinite=e,this._requestRender())}get pathVerticalPlaneEnabled(){return this._pathVerticalPlaneEnabled}set pathVerticalPlaneEnabled(e){e!==this._pathVerticalPlaneEnabled&&(this._pathVerticalPlaneEnabled=e,t(this._pathVerticalPlaneData)&&this._requestRender())}set pathVerticalPlaneVertices(e){i(this._pathVerticalPlaneData)&&(this._pathVerticalPlaneData=new U(this._renderCoordsHelper)),this._pathVerticalPlaneData.vertices=e,this.pathVerticalPlaneEnabled&&this._requestRender()}set pathVerticalPlaneBuffers(e){i(this._pathVerticalPlaneData)&&(this._pathVerticalPlaneData=new U(this._renderCoordsHelper)),this._pathVerticalPlaneData.buffers=e,this.pathVerticalPlaneEnabled&&this._requestRender()}setParameters(e){A(this._params,e)&&this._requestRender()}initializeRenderContext(e){this._context=e;const t=e.renderContext.rctx;this._quadVAO=T(t),this._techniqueRepository=e.shaderTechniqueRep,this._techniqueConfig=new w;const i=new v;i.contrastControlEnabled=this._config.contrastControlEnabled,this._pathTechnique=this._techniqueRepository.acquire(j,i)}uninitializeRenderContext(){this._quadVAO=n(this._quadVAO),this._technique=s(this._technique),this._pathVerticalPlaneData=n(this._pathVerticalPlaneData),this._pathTechnique=s(this._pathTechnique)}prepareTechnique(){return this.heightManifoldEnabled||this.pointDistanceEnabled||this.lineVerticalPlaneSegment||this.intersectsLineEnabled?(this._techniqueConfig.heightManifoldEnabled=this.heightManifoldEnabled,this._techniqueConfig.lineVerticalPlaneEnabled=this.lineVerticalPlaneEnabled,this._techniqueConfig.pointDistanceEnabled=this.pointDistanceEnabled,this._techniqueConfig.intersectsLineEnabled=this.intersectsLineEnabled,this._techniqueConfig.contrastControlEnabled=this._config.contrastControlEnabled,this._technique=this._techniqueRepository.releaseAndAcquire(I,this._techniqueConfig,this._technique),this._technique):this._pathTechnique}render(e,t){const i=e.camera;x(i.projectionMatrix,i.fullWidth,i.fullHeight,this._projInfo,this._zScale),(this.heightManifoldEnabled||this.pointDistanceEnabled||this.lineVerticalPlaneSegment||this.intersectsLineEnabled)&&this._renderUnified(e,t),this.pathVerticalPlaneEnabled&&this._renderPath(e)}_renderUnified(e,t){const i=e.rctx,n=t.program;i.useProgram(n),t.bindPipelineState(i),this._bindGlobalUniforms(e,n),this._bindHeightManifoldUniforms(e,n),this._bindPointDistanceUniforms(e,n),this._bindLineVerticalPlaneUniforms(e,n),this._bindIntersectsLineUniforms(e,n),t.bind(this._params,e.camera),i.bindVAO(this._quadVAO),i.drawArrays(O.TRIANGLE_STRIP,0,4)}_renderPath(e){if(i(this._pathVerticalPlaneData)||i(this._pathTechnique))return;const t=e.rctx,n=this._pathTechnique,s=n.program;t.useProgram(s),n.bindPipelineState(t),this._bindGlobalUniforms(e,s),n.bind(this._params,this._pathVerticalPlaneData.origin,e.camera),this._pathVerticalPlaneData.draw(e.rctx)}_bindHeightManifoldUniforms(e,t){if(!this.heightManifoldEnabled)return;const i=this._tempVec3A,n=this._tempPlane;this._renderCoordsHelper.worldUpAtPosition(this._heightManifoldTarget,i),N(n,this._heightManifoldTarget,i,e.camera.viewMatrix),t.setUniform4fv("heightPlane",n)}_bindPointDistanceUniforms(e,t){if(!this._pointDistanceEnabled)return;const i=e.camera,n=this._tempSphere;a(n,this._pointDistanceOrigin),h(n,n,i.viewMatrix),n[3]=l(this._pointDistanceOrigin,this._pointDistanceTarget),t.setUniform4f("pointDistanceSphere",n[0],n[1],n[2],n[3])}_bindLineVerticalPlaneUniforms(e,t){if(!this._lineVerticalPlaneEnabled)return;const i=this._renderCoordsHelper,n=e.camera,s=this._tempPlane,r=this._tempVec3A,l=this._tempUp,d=this._tempDir,m=this._tempNormal;L(this._lineVerticalPlaneSegment,.5,r),i.worldUpAtPosition(r,l),o(d,this._lineVerticalPlaneSegment.vector),c(m,l,d),o(m,m),N(s,this._lineVerticalPlaneSegment.origin,m,n.viewMatrix),t.setUniform4fv("lineVerticalPlane",s);const p=this._tempVec3A;a(p,this._lineVerticalPlaneSegment.origin),i.setAltitude(p,0),h(p,p,n.viewMatrix),t.setUniform3fv("lineVerticalStart",p);const f=this._tempVec3B;_(f,this._lineVerticalPlaneSegment.origin,this._lineVerticalPlaneSegment.vector),i.setAltitude(f,0),h(f,f,n.viewMatrix),t.setUniform3fv("lineVerticalEnd",f)}_bindIntersectsLineUniforms(e,t){if(!this._intersectsLineEnabled)return;const i=G,n=W;if(this._intersectsLineInfinite){const t=e.camera;if(g(q(this._intersectsLineSegment.origin,this._intersectsLineSegment.vector),B),B.c0=-Number.MAX_VALUE,!P(t.frustum,B))return;u(B,i),b(B,n)}else a(i,this._intersectsLineSegment.origin),_(n,this._intersectsLineSegment.origin,this._intersectsLineSegment.vector);const s=this._tempVec3A;h(s,i,e.camera.viewMatrix),t.setUniform3fv("intersectsLineStart",s);const r=this._tempVec4;a(r,this._intersectsLineSegment.vector),this._tempVec4[3]=0,m(this._tempVec4,this._tempVec4,e.camera.viewMatrix),h(n,n,e.camera.viewMatrix),t.setUniform3fv("intersectsLineEnd",n),o(r,r),t.setUniform3f("intersectsLineDirection",r[0],r[1],r[2]),t.setUniform1f("intersectsLineRadius",this._intersectsLineRadius)}_bindGlobalUniforms(e,t){const i=e.camera;t.setUniform4fv("projInfo",this._projInfo),t.setUniform2fv("zScale",this._zScale),t.setUniform2f("nearFar",i.near,i.far),this._heightManifoldEnabled?t.setUniform1f("maxPixelDistance",2*i.computeScreenPixelSizeAt(this._heightManifoldTarget)):this._pointDistanceEnabled?t.setUniform1f("maxPixelDistance",2*i.computeScreenPixelSizeAt(this._pointDistanceTarget)):this._lineVerticalPlaneEnabled&&t.setUniform1f("maxPixelDistance",2*i.computeScreenPixelSizeAt(this._lineVerticalPlaneSegment.origin)),t.bindTexture(e.offscreenRenderingHelper.linearDepthTexture,"depthMap"),t.bindTexture(e.offscreenRenderingHelper.mainColorTexture,"frameColor")}_requestRender(){this._context&&this._context.requestRender()}}const B=f(),G=d(),W=d();export{k as LaserLineRenderer};
|
|
5
|
+
import{deg2rad as e}from"../../../core/mathUtils.js";import{isSome as t,isNone as i,disposeMaybe as n,releaseMaybe as s}from"../../../core/maybe.js";import{a as r}from"../../../chunks/vec2f64.js";import{g as a,m as h,i as l,n as o,c,b as _}from"../../../chunks/vec3.js";import{c as d}from"../../../chunks/vec3f64.js";import{t as m}from"../../../chunks/vec4.js";import{c as p}from"../../../chunks/vec4f64.js";import{create as f,fromRay as g,getStart as u,getEnd as b}from"../../../geometry/support/clipRay.js";import{intersectClipRay as V}from"../../../geometry/support/frustum.js";import{create as P,copy as E,pointAt as L}from"../../../geometry/support/lineSegment.js";import{create as q,fromPositionAndNormal as D}from"../../../geometry/support/plane.js";import{wrap as S}from"../../../geometry/support/ray.js";import{c as R}from"../../../chunks/sphere.js";import{LaserlinePathData as T}from"./LaserlinePathData.js";import{createQuadVAO as U}from"../webgl-engine/lib/glUtil3D.js";import{RenderSlot as M}from"../webgl-engine/lib/RenderSlot.js";import{inverseProjectionInfo as x}from"../webgl-engine/lib/Util.js";import{copyParameters as C,updateParameters as v}from"../webgl-engine/materials/internal/MaterialUtil.js";import{LaserlinePathTechniqueConfiguration as A,LaserlinePathTechnique as j}from"../webgl-engine/shaders/LaserlinePathTechnique.js";import{LaserlineTechniqueConfiguration as w,LaserlineTechnique as I}from"../webgl-engine/shaders/LaserlineTechnique.js";import{PrimitiveType as O}from"../../webgl/enums.js";const y=d(),H=p(),z={glowColor:[1,.5,0],glowWidth:8,glowFalloff:8,innerColor:[1,1,1],innerWidth:1,globalAlpha:.75,angleCutoff:e(6),globalAlphaContrastBoost:2};function N(e,t,i,n){const s=y,r=H;h(s,t,n),a(r,i),r[3]=0,m(r,r,n),D(s,r,e)}class k{constructor(e,t={},i={contrastControlEnabled:!1}){this._renderCoordsHelper=e,this._config=i,this._technique=null,this._projInfo=p(),this._zScale=r(),this._heightManifoldEnabled=!1,this._heightManifoldTarget=d(),this._pointDistanceEnabled=!1,this._pointDistanceOrigin=d(),this._pointDistanceTarget=d(),this._lineVerticalPlaneEnabled=!1,this._lineVerticalPlaneSegment=P(),this._intersectsLineEnabled=!1,this._intersectsLineSegment=P(),this._intersectsLineRadius=3,this._intersectsLineInfinite=!1,this._pathVerticalPlaneEnabled=!1,this._pathVerticalPlaneData=null,this._pathTechnique=null,this.canRender=!0,this._tempNormal=d(),this._tempDir=d(),this._tempUp=d(),this._tempVec3A=d(),this._tempVec3B=d(),this._tempVec4=p(),this._tempPlane=q(),this._tempSphere=R(),this._params=C(t,z)}get renderSlots(){return[this._config.contrastControlEnabled?M.LASERLINES_CONTRAST_CONTROL:M.LASERLINES]}get needsLinearDepth(){return!0}get heightManifoldEnabled(){return this._heightManifoldEnabled}set heightManifoldEnabled(e){this._heightManifoldEnabled!==e&&(this._heightManifoldEnabled=e,this._requestRender())}get heightManifoldTarget(){return this._heightManifoldTarget}set heightManifoldTarget(e){a(this._heightManifoldTarget,e),this._requestRender()}get pointDistanceEnabled(){return this._pointDistanceEnabled}set pointDistanceEnabled(e){e!==this._pointDistanceEnabled&&(this._pointDistanceEnabled=e,this._requestRender())}get pointDistanceTarget(){return this._pointDistanceTarget}set pointDistanceTarget(e){a(this._pointDistanceTarget,e),this._requestRender()}get pointDistanceOrigin(){return this._pointDistanceOrigin}set pointDistanceOrigin(e){a(this._pointDistanceOrigin,e),this._requestRender()}get lineVerticalPlaneEnabled(){return this._lineVerticalPlaneEnabled}set lineVerticalPlaneEnabled(e){e!==this._lineVerticalPlaneEnabled&&(this._lineVerticalPlaneEnabled=e,this._requestRender())}get lineVerticalPlaneSegment(){return this._lineVerticalPlaneSegment}set lineVerticalPlaneSegment(e){E(e,this._lineVerticalPlaneSegment),this._requestRender()}get intersectsLineEnabled(){return this._intersectsLineEnabled}set intersectsLineEnabled(e){e!==this._intersectsLineEnabled&&(this._intersectsLineEnabled=e,this._requestRender())}get intersectsLineSegment(){return this._intersectsLineSegment}set intersectsLineSegment(e){E(e,this._intersectsLineSegment),this._requestRender()}get intersectsLineRadius(){return this._intersectsLineRadius}set intersectsLineRadius(e){e!==this._intersectsLineRadius&&(this._intersectsLineRadius=e,this._requestRender())}get intersectsLineInfinite(){return this._intersectsLineInfinite}set intersectsLineInfinite(e){e!==this._intersectsLineInfinite&&(this._intersectsLineInfinite=e,this._requestRender())}get pathVerticalPlaneEnabled(){return this._pathVerticalPlaneEnabled}set pathVerticalPlaneEnabled(e){e!==this._pathVerticalPlaneEnabled&&(this._pathVerticalPlaneEnabled=e,t(this._pathVerticalPlaneData)&&this._requestRender())}set pathVerticalPlaneVertices(e){i(this._pathVerticalPlaneData)&&(this._pathVerticalPlaneData=new T(this._renderCoordsHelper)),this._pathVerticalPlaneData.vertices=e,this.pathVerticalPlaneEnabled&&this._requestRender()}set pathVerticalPlaneBuffers(e){i(this._pathVerticalPlaneData)&&(this._pathVerticalPlaneData=new T(this._renderCoordsHelper)),this._pathVerticalPlaneData.buffers=e,this.pathVerticalPlaneEnabled&&this._requestRender()}setParameters(e){v(this._params,e)&&this._requestRender()}initializeRenderContext(e){this._context=e;const t=e.renderContext.rctx;this._quadVAO=U(t),this._techniqueRepository=e.shaderTechniqueRep,this._techniqueConfig=new w;const i=new A;i.contrastControlEnabled=this._config.contrastControlEnabled,this._pathTechnique=this._techniqueRepository.acquire(j,i)}uninitializeRenderContext(){this._quadVAO=n(this._quadVAO),this._technique=s(this._technique),this._pathVerticalPlaneData=n(this._pathVerticalPlaneData),this._pathTechnique=s(this._pathTechnique)}prepareTechnique(){return this.heightManifoldEnabled||this.pointDistanceEnabled||this.lineVerticalPlaneSegment||this.intersectsLineEnabled?(this._techniqueConfig.heightManifoldEnabled=this.heightManifoldEnabled,this._techniqueConfig.lineVerticalPlaneEnabled=this.lineVerticalPlaneEnabled,this._techniqueConfig.pointDistanceEnabled=this.pointDistanceEnabled,this._techniqueConfig.intersectsLineEnabled=this.intersectsLineEnabled,this._techniqueConfig.contrastControlEnabled=this._config.contrastControlEnabled,this._technique=this._techniqueRepository.releaseAndAcquire(I,this._techniqueConfig,this._technique),this._technique):this._pathTechnique}render(e,t){const i=e.camera;x(i.projectionMatrix,i.fullWidth,i.fullHeight,this._projInfo,this._zScale),(this.heightManifoldEnabled||this.pointDistanceEnabled||this.lineVerticalPlaneSegment||this.intersectsLineEnabled)&&this._renderUnified(e,t),this.pathVerticalPlaneEnabled&&this._renderPath(e)}_renderUnified(e,t){const i=e.rctx,n=i.useTechnique(t);this._bindGlobalUniforms(e,n),this._bindHeightManifoldUniforms(e,n),this._bindPointDistanceUniforms(e,n),this._bindLineVerticalPlaneUniforms(e,n),this._bindIntersectsLineUniforms(e,n),t.bind(this._params,e.camera),i.bindVAO(this._quadVAO),i.drawArrays(O.TRIANGLE_STRIP,0,4)}_renderPath(e){if(i(this._pathVerticalPlaneData)||i(this._pathTechnique))return;const t=e.rctx,n=this._pathTechnique,s=t.useTechnique(n);this._bindGlobalUniforms(e,s),n.bind(this._params,this._pathVerticalPlaneData.origin,e.camera),this._pathVerticalPlaneData.draw(e.rctx)}_bindHeightManifoldUniforms(e,t){if(!this.heightManifoldEnabled)return;const i=this._tempVec3A,n=this._tempPlane;this._renderCoordsHelper.worldUpAtPosition(this._heightManifoldTarget,i),N(n,this._heightManifoldTarget,i,e.camera.viewMatrix),t.setUniform4fv("heightPlane",n)}_bindPointDistanceUniforms(e,t){if(!this._pointDistanceEnabled)return;const i=e.camera,n=this._tempSphere;a(n,this._pointDistanceOrigin),h(n,n,i.viewMatrix),n[3]=l(this._pointDistanceOrigin,this._pointDistanceTarget),t.setUniform4f("pointDistanceSphere",n[0],n[1],n[2],n[3])}_bindLineVerticalPlaneUniforms(e,t){if(!this._lineVerticalPlaneEnabled)return;const i=this._renderCoordsHelper,n=e.camera,s=this._tempPlane,r=this._tempVec3A,l=this._tempUp,d=this._tempDir,m=this._tempNormal;L(this._lineVerticalPlaneSegment,.5,r),i.worldUpAtPosition(r,l),o(d,this._lineVerticalPlaneSegment.vector),c(m,l,d),o(m,m),N(s,this._lineVerticalPlaneSegment.origin,m,n.viewMatrix),t.setUniform4fv("lineVerticalPlane",s);const p=this._tempVec3A;a(p,this._lineVerticalPlaneSegment.origin),i.setAltitude(p,0),h(p,p,n.viewMatrix),t.setUniform3fv("lineVerticalStart",p);const f=this._tempVec3B;_(f,this._lineVerticalPlaneSegment.origin,this._lineVerticalPlaneSegment.vector),i.setAltitude(f,0),h(f,f,n.viewMatrix),t.setUniform3fv("lineVerticalEnd",f)}_bindIntersectsLineUniforms(e,t){if(!this._intersectsLineEnabled)return;const i=G,n=F;if(this._intersectsLineInfinite){const t=e.camera;if(g(S(this._intersectsLineSegment.origin,this._intersectsLineSegment.vector),B),B.c0=-Number.MAX_VALUE,!V(t.frustum,B))return;u(B,i),b(B,n)}else a(i,this._intersectsLineSegment.origin),_(n,this._intersectsLineSegment.origin,this._intersectsLineSegment.vector);const s=this._tempVec3A;h(s,i,e.camera.viewMatrix),t.setUniform3fv("intersectsLineStart",s);const r=this._tempVec4;a(r,this._intersectsLineSegment.vector),this._tempVec4[3]=0,m(this._tempVec4,this._tempVec4,e.camera.viewMatrix),h(n,n,e.camera.viewMatrix),t.setUniform3fv("intersectsLineEnd",n),o(r,r),t.setUniform3f("intersectsLineDirection",r[0],r[1],r[2]),t.setUniform1f("intersectsLineRadius",this._intersectsLineRadius)}_bindGlobalUniforms(e,t){const i=e.camera;t.setUniform4fv("projInfo",this._projInfo),t.setUniform2fv("zScale",this._zScale),t.setUniform2fv("nearFar",i.nearFar),this._heightManifoldEnabled?t.setUniform1f("maxPixelDistance",2*i.computeScreenPixelSizeAt(this._heightManifoldTarget)):this._pointDistanceEnabled?t.setUniform1f("maxPixelDistance",2*i.computeScreenPixelSizeAt(this._pointDistanceTarget)):this._lineVerticalPlaneEnabled&&t.setUniform1f("maxPixelDistance",2*i.computeScreenPixelSizeAt(this._lineVerticalPlaneSegment.origin)),t.bindTexture(e.offscreenRenderingHelper.linearDepthTexture,"depthMap"),t.bindTexture(e.offscreenRenderingHelper.mainColorTexture,"frameColor")}_requestRender(){this._context&&this._context.requestRender()}}const B=f(),G=d(),F=d();export{k as LaserLineRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isSome as e,isNone as t}from"../../../core/maybe.js";import{s as r,f as s}from"../../../chunks/vec3.js";import{c as i}from"../../../chunks/vec3f64.js";import{glLayout as o}from"./buffer/glUtil.js";import{newLayout as f}from"./buffer/InterleavedLayout.js";import{VertexAttribute as n}from"../webgl-engine/lib/
|
|
5
|
+
import{isSome as e,isNone as t}from"../../../core/maybe.js";import{s as r,f as s}from"../../../chunks/vec3.js";import{c as i}from"../../../chunks/vec3f64.js";import{glLayout as o}from"./buffer/glUtil.js";import{newLayout as f}from"./buffer/InterleavedLayout.js";import{VertexAttribute as n}from"../webgl-engine/lib/VertexAttribute.js";import{LaserlinePathTechnique as u}from"../webgl-engine/shaders/LaserlinePathTechnique.js";import{BufferObject as a}from"../../webgl/BufferObject.js";import{PrimitiveType as c,Usage as h}from"../../webgl/enums.js";import{VertexArrayObject as l}from"../../webgl/VertexArrayObject.js";class _{constructor(e){this._renderCoordsHelper=e,this._buffers=null,this._origin=i(),this._dirty=!1,this._count=0,this._vao=null}set vertices(e){const t=new Float64Array(3*e.length);let r=0;for(const s of e)t[r++]=s[0],t[r++]=s[1],t[r++]=s[2];this.buffers=[t]}set buffers(e){if(this._buffers=e,this._buffers.length>0){const e=this._buffers[0],t=3*Math.floor(e.length/3/2);r(this._origin,e[t+0],e[t+1],e[t+2])}else r(this._origin,0,0,0);this._dirty=!0}get origin(){return this._origin}draw(t){const r=this._ensureVAO(t);e(r)&&(t.bindVAO(r),t.drawArrays(c.TRIANGLES,0,this._count))}dispose(){e(this._vao)&&this._vao.dispose()}_ensureVAO(e){return t(this._buffers)?null:(t(this._vao)&&(this._vao=this._createVAO(e,this._buffers)),this._ensureVertexData(this._vao,this._buffers),this._vao)}_createVAO(e,t){const r=this._createDataBuffer(t);return this._dirty=!1,new l(e,u.attributeLocations,{data:o(V)},{data:a.createVertex(e,h.STATIC_DRAW,r)})}_ensureVertexData(e,t){if(!this._dirty)return;const r=this._createDataBuffer(t);e.vertexBuffers.data.setData(r),this._dirty=!1}_numberOfRenderVertices(e){return 3*(2*(e.length/3-1))}_createDataBuffer(e){const t=e.reduce(((e,t)=>e+this._numberOfRenderVertices(t)),0);this._count=t;const i=V.createBuffer(t),o=this._origin;let f=0,n=0;for(const u of e){for(let e=0;e<u.length;e+=3){const t=r(b,u[e+0],u[e+1],u[e+2]);0===e?n=this._renderCoordsHelper.getAltitude(t):this._renderCoordsHelper.setAltitude(t,n);const a=this._renderCoordsHelper.worldUpAtPosition(t,d),c=f+2*e,h=s(b,t,o);if(e<u.length-3){i.up.setVec(c,a),i.up.setVec(c+3,a),i.up.setVec(c+5,a);for(let e=0;e<6;e++)i.start.setVec(c+e,h);i.extrude.setValues(c+0,0,-1),i.extrude.setValues(c+1,1,-1),i.extrude.setValues(c+2,1,1),i.extrude.setValues(c+3,0,-1),i.extrude.setValues(c+4,1,1),i.extrude.setValues(c+5,0,1)}if(e>0){i.up.setVec(c-2,a),i.up.setVec(c-4,a),i.up.setVec(c-5,a);for(let e=-6;e<0;e++)i.end.setVec(c+e,h)}}f+=this._numberOfRenderVertices(u)}return i.buffer}}const d=i(),b=i(),V=f().vec3f(n.START).vec3f(n.END).vec3f(n.UP).vec2f(n.EXTRUDE);export{_ as LaserlinePathData};
|