@arcgis/core 4.23.0-next.20220127 → 4.23.0-next.20220128
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/{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/{8001b0e514bfffe9d7f8.js → 357033117dfe61eb81ea.js} +1 -1
- package/assets/esri/core/workers/chunks/{5948923e07bd1662c24a.js → 37c03cfc19086ce631c6.js} +1 -1
- package/assets/esri/core/workers/chunks/3c673495e5f507c4a9e5.js +1 -0
- 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/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/7903a3e2e0faff0f86c0.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/{4c76146014dc15143ba3.js → be588873c16770ceb9ef.js} +1 -1
- package/assets/esri/core/workers/chunks/d1fe53b597351dc58305.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/ff6abdc72076f3994659.js +981 -0
- 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 +204 -10
- 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/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/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/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/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/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/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/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/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/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/SSAOHelper.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.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/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/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/widgets/BasemapGallery/support/basemapCompatibilityUtils.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/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/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
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isNone as t}from"../../../../core/maybe.js";import{c as e}from"../../../../chunks/mat4.js";import{c as a}from"../../../../chunks/mat4f64.js";import{s as o}from"../../../../chunks/vec3.js";import{c as s}from"../../../../chunks/vec3f64.js";import{projectBuffer as
|
|
5
|
+
import{isNone as t}from"../../../../core/maybe.js";import{c as e}from"../../../../chunks/mat4.js";import{c as a}from"../../../../chunks/mat4f64.js";import{s as o}from"../../../../chunks/vec3.js";import{c as s}from"../../../../chunks/vec3f64.js";import{projectBuffer as r,computeTranslationToOriginAndRotation as n}from"../../../../geometry/projection.js";import{evaluateElevationInfoAtPoint as i,SampleElevationInfo as l}from"./elevationAlignmentUtils.js";import{updateVertexAttributeAuxpos1w as c}from"./graphicUtils.js";import m from"../../support/debugFlags.js";import{SamplePosition as f}from"../../support/ElevationProvider.js";import{VertexAttribute as u}from"../../webgl-engine/lib/VertexAttribute.js";function p(t,e,a,o){const s=t.stageObject,n=a.spatialReference,l=s.geometryRecords,c="absolute-height"!==e.mode;let p=0;for(const b of l){const t=b.geometry,l=b.getShaderTransformation();g[0]=l[12],g[1]=l[13],g[2]=l[14],t.invalidateBoundingInfo();const d=t.getMutableAttribute(u.POSITION),I=d.data,M=t.vertexAttributes.get(u.MAPPOS).data,A=d.size,O=I.length/A,j=new f(M,n);let v=0,y=!1,P=0;for(let s=0;s<O;s++){if(S[0]=I[v],S[1]=I[v+1],S[2]=I[v+2],i(j,a,e,o,E),c&&(P+=E.sampledElevation),m.TESTS_DISABLE_OPTIMIZATIONS)I[v]=j.array[j.offset],I[v+1]=j.array[j.offset+1],I[v+2]=E.z,r(I,n,v,I,o.spatialReference,v,1),I[v]-=g[0],I[v+1]-=g[1],I[v+2]-=g[2],y=!0;else{h[0]=I[v]+g[0],h[1]=I[v+1]+g[1],h[2]=I[v+2]+g[2],o.setAltitude(h,E.z),I[v]=h[0]-g[0],I[v+1]=h[1]-g[1],I[v+2]=h[2]-g[2];const t=T/o.unitInMeters;(Math.abs(S[0]-I[v])>=t||Math.abs(S[1]-I[v+1])>=t||Math.abs(S[2]-I[v+2])>=t)&&(y=!0)}v+=A,j.offset+=3}p+=P/O,y&&s.geometryVertexAttrsUpdated(b)}return p/l.length}function b(t,a,s,r){const l=t.stageObject,f=a.centerPointInElevationSR;let u=0;if(l.metadata.usesVerticalDistanceToGround)i(f,s,a,r,E),c(l,E.verticalDistanceToGround),u=E.sampledElevation;else{i(f,s,a,r,E);"absolute-height"!==a.mode&&(u=E.sampledElevation)}const p=e(d,l.transformation),b=o(A,p[12],p[13],p[14]);m.TESTS_DISABLE_OPTIMIZATIONS?(h[0]=f.x,h[1]=f.y,h[2]=E.z,n(f.spatialReference,h,p,r.spatialReference)&&(l.transformation=p)):r.setAltitudeOfTransformation(E.z,p);const I=T/r.unitInMeters;return(Math.abs(p[12]-b[0])>=I||Math.abs(p[13]-b[1])>=I||Math.abs(p[14]-b[2])>=I)&&(l.transformation=p),u}const d=a();function I(e,a,s,r){const l=e.graphics3DSymbolLayer.lodRenderer;if(t(l))return 0;const c=a.centerPointInElevationSR;i(c,s,a,r,E);const f="absolute-height"!==a.mode?E.sampledElevation:0,u=l.instanceData,p=e.instanceIndex,b=M;u.getGlobalTransform(p,b);const d=o(A,b[12],b[13],b[14]);m.TESTS_DISABLE_OPTIMIZATIONS?(h[0]=c.x,h[1]=c.y,h[2]=E.z,n(c.spatialReference,h,b,r.spatialReference)&&u.setGlobalTransform(p,b)):r.setAltitudeOfTransformation(E.z,b);const I=T/r.unitInMeters;return(m.TESTS_DISABLE_OPTIMIZATIONS||Math.abs(b[12]-d[0])>=I||Math.abs(b[13]-d[1])>=I||Math.abs(b[14]-d[2])>=I)&&u.setGlobalTransform(p,b),f}const T=.01,h=s(),g=s(),S=s(),M=a(),A=s(),E=new l;export{I as perLodInstanceElevationAligner,b as perObjectElevationAligner,p as perVertexElevationAligner};
|
|
@@ -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{get as t,isSome as r,isNone as s}from"../../../../core/maybe.js";import{e as n}from"../../../../chunks/earcut.js";import{a}from"../../../../chunks/mat3.js";import{c as i}from"../../../../chunks/mat3f64.js";import{a as o}from"../../../../chunks/mat4.js";import{I as l,c}from"../../../../chunks/mat4f64.js";import{g as h,n as m,s as p,f as d,c as u,m as f}from"../../../../chunks/vec3.js";import{d as g,c as y}from"../../../../chunks/vec3f64.js";import{computeTranslationToOriginAndRotation as _}from"../../../../geometry/projection.js";import{create as b,empty as E,expandWithBuffer as x,intersectsClippingArea as P}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f64 as v}from"../../../../geometry/support/buffer/BufferView.js";import{t as S,a as w}from"../../../../chunks/vec32.js";import{getDriverAxisSizeValue as j}from"../../../../renderers/support/renderingInfoUtils.js";import{ViewingMode as A}from"../../../ViewingMode.js";import{needsElevationUpdates3D as L,evaluateElevationInfoAtPoint as M,SampleElevationInfo as O}from"./elevationAlignmentUtils.js";import{ElevationContext as B}from"./ElevationContext.js";import{Graphics3DObject3DGraphicLayer as I}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as C}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as R,computeCentroid as T}from"./graphicUtils.js";import{ApplyRendererDiffResult as z}from"./interfaces.js";import{geometryAsPolygon as G,geometryToRenderInfo as D}from"./polygonUtils.js";import{createMaterial as U}from"../support/edgeUtils.js";import k from"../../support/debugFlags.js";import{SamplePosition as N}from"../../support/ElevationProvider.js";import{CullFaceOptions as F,VertexAttribute as H,PrimitiveType as V}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as Y}from"../../webgl-engine/lib/Geometry.js";import{Object3D as Z}from"../../webgl-engine/lib/Object3D.js";import{DefaultMaterial as W}from"../../webgl-engine/materials/DefaultMaterial.js";const q=["polygon","extent"];class J extends C{constructor(e,t,r,s){super(e,t,r,s),this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const t=R(this._getSymbolSize());if(t)throw new e("graphics3dextrudesymbollayer:invalid-size",t)}const r=t(this.symbolLayer,"material","color"),s=this._getCombinedOpacityAndColor(r),n=g(s),a=s[3],i=a<1||this.needsDrivenTransparentPass,o={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,diffuse:n,ambient:n,opacity:a,transparent:i,cullFace:i?F.None:F.Back,vertexColors:!0,slicePlaneEnabled:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!0};this._material=new W(o),this._bottomMaterial=new W({...o,cullFace:F.Back}),this._context.stage.add(this._material),this._context.stage.add(this._bottomMaterial)}destroy(){super.destroy(),this._material&&(this._context.stage.remove(this._material),this._context.stage.remove(this._bottomMaterial))}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,q,this.symbolLayer.type))return null;const r=this._getVertexOpacityAndColor(e.renderingInfo,255),s=this.setGraphicElevationContext(t,new B);return this._createAs3DShape(t,e.renderingInfo,r,s,t.uid)}layerOpacityChanged(e,s){const n=t(this.symbolLayer,"material","color"),a=this._getCombinedOpacity(n),i=a<1||this.needsDrivenTransparentPass;this._material.setParameters({opacity:a,transparent:i}),this._bottomMaterial.setParameters({opacity:a,transparent:i});const o=this._getLayerOpacity();return e.forEach((e=>{const t=s(e);r(t)&&t.layerOpacityChanged(o,this._context.isAsync)})),!0}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,L)}slicePlaneEnabledChanged(e,t){return this._material.setParameters({slicePlaneEnabled:this._context.slicePlaneEnabled}),this._bottomMaterial.setParameters({slicePlaneEnabled:this._context.slicePlaneEnabled}),e.forEach((e=>{const s=t(e);r(s)&&s.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)})),!0}physicalBasedRenderingChanged(){return this._material.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),this._bottomMaterial.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}pixelRatioChanged(){return!0}_getExtrusionSize(e){let t;var r;e.size&&this._drivenProperties.size?t=null!=(r=j(e.size,2))?r:0:t=this._getSymbolSize();return t/=this._context.renderCoordsHelper.unitInMeters,t}applyRendererDiff(){return z.Recreate_Graphics}_getSymbolSize(){var e;return null!=(e=this.symbolLayer.size)?e:1}_createAs3DShape(e,t,h,m,p){const d=G(e.geometry);if(s(d))return null;const u=D(d,this._context.elevationProvider,this._context.renderCoordsHelper,m);if(this._logGeometryCreationWarnings(u,d.rings,"rings","ExtrudeSymbol3DLayer"),0===d.rings.length||!d.rings.some((e=>e.length>0)))return null;const f=T(d);if(s(f))return null;const g=new Array,j=new Array,M=new Array,O=b(),B=c(),C=y(),R=this._context.renderCoordsHelper.viewingMode===A.Global;R||this._context.renderCoordsHelper.worldUpAtPosition(null,C),_(d.spatialReference,[f.x,f.y,0],B,this._context.renderCoordsHelper.spatialReference);const z=c();o(z,B);const k=i();a(k,z);const{polygons:N,mapPosition:F,position:H}=u,V=H.length/3,Y=new Float64Array(3*V*6),W=new Float64Array(3*V*6),q=new Float64Array(3*V*6),J=new Float64Array(1*V*6);let Q=0;for(let r=0;r<N.length;++r){const e=N[r],s=e.count;if(this._context.clippingExtent&&(E(O),x(O,e.mapPosition),!P(O,this._context.clippingExtent)))continue;const a=n(e.mapPosition,e.holeIndices,3);if(0===a.length)continue;const i=3*s*2+a.length,o=new Uint32Array(i),c=new Uint32Array(a.length),m=6*s,p=3*Y.BYTES_PER_ELEMENT,d=new v(Y.buffer,Q*p,p,(Q+m)*p),u=3*W.BYTES_PER_ELEMENT,f=new v(W.buffer,Q*u,u,(Q+m)*u),y=new Float64Array(q.buffer,3*Q*q.BYTES_PER_ELEMENT,3*m),_=new Float64Array(J.buffer,1*Q*J.BYTES_PER_ELEMENT,1*m),b=this._getExtrusionSize(t);K(H,F,a,e,d.typedBuffer,y,f.typedBuffer,_,0,o,c,b,C,R),S(d,d,z),w(f,f,k),Q+=6*s;const A=this._createExtrudeGeometry(o,o.length-c.length,{positions:d.typedBuffer,elevation:y,normals:f.typedBuffer,heights:_},h);g.push(A),j.push(this._material),M.push(l);const L=this._createExtrudeGeometry(c,0,{positions:d.typedBuffer,elevation:y,normals:f.typedBuffer,heights:_},h);g.push(L),j.push(this._bottomMaterial),M.push(l)}if(0===g.length)return null;const X=new Z({geometries:g,materials:j,transformations:M,metadata:{layerUid:this._context.layer.uid,graphicUid:p,isElevationSource:!0}});X.transformation=B;const $=U(this.symbolLayer,{opacity:this._getLayerOpacity()}),ee=r($)?{baseMaterial:this._material,edgeMaterials:[$],properties:{mergeGeometries:!0,slicePlaneEnabled:this._context.slicePlaneEnabled}}:null,te=new I(this,X,g,null,null,le,m,ee);return te.alignedSampledElevation=u.sampledElevation,te.needsElevationUpdates=L(m.mode),te}_createExtrudeGeometry(e,t,r,s){const n=new Uint32Array(e.length),a=[[H.POSITION,{size:3,data:r.positions,exclusive:!0}],[H.NORMAL,{size:3,data:r.normals,exclusive:!0}],[H.COLOR,{size:4,data:s,exclusive:!0}],[H.SIZE,{size:1,data:r.heights,exclusive:!0}]],i=[[H.POSITION,e],[H.NORMAL,e],[H.COLOR,n]];return r.elevation&&(a.push([H.MAPPOS,{size:3,data:r.elevation}]),i.push([H.MAPPOS,e])),new Y(a,i,V.Triangle,t)}}function K(e,t,r,s,n,a,i,o,l,c,h,m,p,d){const u=r.length/3;let f=0,g=2*s.count;Q(e,t,s.index,s.count,r,0,u,n,a,i,o,l,c,h,g,m,p,d),l+=2*s.count,g=0,ee(n,a,o,i,f,s.pathLengths[0],s.count,l,c,g,m),l+=4*s.pathLengths[0],g+=2*s.pathLengths[0],f+=s.pathLengths[0];for(let y=1;y<s.pathLengths.length;++y)ee(n,a,o,i,f,s.pathLengths[y],s.count,l,c,g,m),l+=4*s.pathLengths[y],g+=2*s.pathLengths[y],f+=s.pathLengths[y]}function Q(e,t,r,s,n,a,i,o,l,c,p,d,u,f,g,y,_,b){h(he,_);const E=y>0?1:-1;let x=3*r,P=d,v=3*P,S=d+s,w=3*S;for(let h=0;h<s;++h)b&&(he[0]=e[x+0],he[1]=e[x+1],he[2]=e[x+2],m(he,he)),o[v+0]=e[x+0],o[v+1]=e[x+1],o[v+2]=e[x+2],l[v+0]=t[x+0],l[v+1]=t[x+1],l[v+2]=t[x+2],c[v+0]=-E*he[0],c[v+1]=-E*he[1],c[v+2]=-E*he[2],p[P]=0,o[w+0]=e[x+0]+y*he[0],o[w+1]=e[x+1]+y*he[1],o[w+2]=e[x+2]+y*he[2],l[w+0]=t[x+0],l[w+1]=t[x+1],l[w+2]=t[x+2],c[w+0]=E*he[0],c[w+1]=E*he[1],c[w+2]=E*he[2],p[S]=y,v+=3,w+=3,x+=3,P+=1,S+=1;x=3*a,v=0,w=3*g;const j=y<0?de:pe,A=y<0?pe:de;for(let h=0;h<i;++h)f[v+0]=n[x+j[0]],f[v+1]=n[x+j[1]],f[v+2]=n[x+j[2]],u[w+0]=n[x+A[0]]+s,u[w+1]=n[x+A[1]]+s,u[w+2]=n[x+A[2]]+s,v+=3,w+=3,x+=3}function X(e,t,r,s,n,a,i){s[a]=s[i],i*=3,e[(a*=3)+0]=e[i+0],e[a+1]=e[i+1],e[a+2]=e[i+2],t[a+0]=t[i+0],t[a+1]=t[i+1],t[a+2]=t[i+2],r[a+0]=n[0],r[a+1]=n[1],r[a+2]=n[2]}const $=y();function ee(e,t,r,s,n,a,i,o,l,c,h){let m=n,p=n+1,d=n+i,u=n+i+1,f=o,g=o+1,y=o+2*a,_=o+2*a+1;h<0&&(m=n+i+1,u=n),c*=3;for(let b=0;b<a;++b)b===a-1&&(h>0?(p=n,u=n+i):(p=n,m=n+i)),ie(e,m,p,d,$),X(e,t,s,r,$,f,m),X(e,t,s,r,$,g,p),X(e,t,s,r,$,y,d),X(e,t,s,r,$,_,u),l[c++]=f,l[c++]=y,l[c++]=_,l[c++]=f,l[c++]=_,l[c++]=g,m++,p++,d++,u++,f+=2,g+=2,y+=2,_+=2}const te=y(),re=y(),se=y(),ne=y(),ae=y();function ie(e,t,r,s,n){t*=3,r*=3,s*=3,p(te,e[t++],e[t++],e[t++]),p(re,e[r++],e[r++],e[r++]),p(se,e[s++],e[s++],e[s++]),d(ne,re,te),d(ae,se,te),u(n,ae,ne),m(n,n)}const oe=y();function le(e,t,r,s){const n=e.stageObject,a=n.geometryRecords,i=a.length,l="absolute-height"!==t.mode;let h=0;const m=n.transformation,d=o(c(),m);for(let o=0;o<i;o+=2){const e=a[o].geometry,i=e.getMutableAttribute(H.POSITION).data,c=e.vertexAttributes.get(H.SIZE).data,u=e.vertexAttributes.get(H.MAPPOS).data,g=new N(u),y=i.length/3;let _=0,b=!1,E=0;const x=r.spatialReference;for(let n=0;n<y;n++){oe[0]=i[_],oe[1]=i[_+1],oe[2]=i[_+2],M(g,r,t,s,me),l&&(E+=me.sampledElevation),k.TESTS_DISABLE_OPTIMIZATIONS?(p(ce,g.array[g.offset+0],g.array[g.offset+1],me.z+c[_/3]),s.toRenderCoords(ce,x,ce),f(ce,ce,d)):(p(ce,i[_+0],i[_+1],i[_+2]),f(ce,ce,m),s.setAltitude(ce,me.z+c[_/3]),f(ce,ce,d)),i[_]=ce[0],i[_+1]=ce[1],i[_+2]=ce[2];const e=ue/s.unitInMeters;(Math.abs(oe[0]-i[_])>=e||Math.abs(oe[1]-i[_+1])>=e||Math.abs(oe[2]-i[_+2])>=e)&&(b=!0),g.offset+=3,_+=3}b&&(e.invalidateBoundingInfo(),n.geometryVertexAttrsUpdated(a[o]),a[o+1].geometry.invalidateBoundingInfo(),n.geometryVertexAttrsUpdated(a[o+1])),h+=E/y}return h/i}const ce=y(),he=y(),me=new O,pe=[0,2,1],de=[0,1,2],ue=.01;export{J as Graphics3DExtrudeSymbolLayer};
|
|
5
|
+
import e from"../../../../core/Error.js";import{get as t,isSome as r,isNone as s}from"../../../../core/maybe.js";import{e as n}from"../../../../chunks/earcut.js";import{a}from"../../../../chunks/mat3.js";import{c as i}from"../../../../chunks/mat3f64.js";import{a as o}from"../../../../chunks/mat4.js";import{I as l,c}from"../../../../chunks/mat4f64.js";import{g as h,n as m,s as p,f as d,c as u,m as f}from"../../../../chunks/vec3.js";import{d as g,c as y}from"../../../../chunks/vec3f64.js";import{computeTranslationToOriginAndRotation as _}from"../../../../geometry/projection.js";import{create as b,empty as E,expandWithBuffer as x,intersectsClippingArea as P}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f64 as v}from"../../../../geometry/support/buffer/BufferView.js";import{t as S,a as w}from"../../../../chunks/vec32.js";import{getDriverAxisSizeValue as j}from"../../../../renderers/support/renderingInfoUtils.js";import{ViewingMode as A}from"../../../ViewingMode.js";import{needsElevationUpdates3D as L,evaluateElevationInfoAtPoint as M,SampleElevationInfo as O}from"./elevationAlignmentUtils.js";import{ElevationContext as B}from"./ElevationContext.js";import{Graphics3DObject3DGraphicLayer as I}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as C}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as R,computeCentroid as T}from"./graphicUtils.js";import{ApplyRendererDiffResult as z}from"./interfaces.js";import{geometryAsPolygon as G,geometryToRenderInfo as D}from"./polygonUtils.js";import{createMaterial as U}from"../support/edgeUtils.js";import k from"../../support/debugFlags.js";import{SamplePosition as N}from"../../support/ElevationProvider.js";import{CullFaceOptions as F,PrimitiveType as V}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as H}from"../../webgl-engine/lib/Geometry.js";import{Object3D as Y}from"../../webgl-engine/lib/Object3D.js";import{VertexAttribute as Z}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as W}from"../../webgl-engine/materials/DefaultMaterial.js";const q=["polygon","extent"];class J extends C{constructor(e,t,r,s){super(e,t,r,s),this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const t=R(this._getSymbolSize());if(t)throw new e("graphics3dextrudesymbollayer:invalid-size",t)}const r=t(this.symbolLayer,"material","color"),s=this._getCombinedOpacityAndColor(r),n=g(s),a=s[3],i=a<1||this.needsDrivenTransparentPass,o={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,diffuse:n,ambient:n,opacity:a,transparent:i,cullFace:i?F.None:F.Back,vertexColors:!0,slicePlaneEnabled:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!0};this._material=new W(o),this._bottomMaterial=new W({...o,cullFace:F.Back}),this._context.stage.add(this._material),this._context.stage.add(this._bottomMaterial)}destroy(){super.destroy(),this._material&&(this._context.stage.remove(this._material),this._context.stage.remove(this._bottomMaterial))}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,q,this.symbolLayer.type))return null;const r=this._getVertexOpacityAndColor(e.renderingInfo,255),s=this.setGraphicElevationContext(t,new B);return this._createAs3DShape(t,e.renderingInfo,r,s,t.uid)}layerOpacityChanged(e,s){const n=t(this.symbolLayer,"material","color"),a=this._getCombinedOpacity(n),i=a<1||this.needsDrivenTransparentPass;this._material.setParameters({opacity:a,transparent:i}),this._bottomMaterial.setParameters({opacity:a,transparent:i});const o=this._getLayerOpacity();return e.forEach((e=>{const t=s(e);r(t)&&t.layerOpacityChanged(o,this._context.isAsync)})),!0}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,L)}slicePlaneEnabledChanged(e,t){return this._material.setParameters({slicePlaneEnabled:this._context.slicePlaneEnabled}),this._bottomMaterial.setParameters({slicePlaneEnabled:this._context.slicePlaneEnabled}),e.forEach((e=>{const s=t(e);r(s)&&s.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)})),!0}physicalBasedRenderingChanged(){return this._material.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),this._bottomMaterial.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}pixelRatioChanged(){return!0}_getExtrusionSize(e){let t;var r;e.size&&this._drivenProperties.size?t=null!=(r=j(e.size,2))?r:0:t=this._getSymbolSize();return t/=this._context.renderCoordsHelper.unitInMeters,t}applyRendererDiff(){return z.Recreate_Graphics}_getSymbolSize(){var e;return null!=(e=this.symbolLayer.size)?e:1}_createAs3DShape(e,t,h,m,p){const d=G(e.geometry);if(s(d))return null;const u=D(d,this._context.elevationProvider,this._context.renderCoordsHelper,m);if(this._logGeometryCreationWarnings(u,d.rings,"rings","ExtrudeSymbol3DLayer"),0===d.rings.length||!d.rings.some((e=>e.length>0)))return null;const f=T(d);if(s(f))return null;const g=new Array,j=new Array,M=new Array,O=b(),B=c(),C=y(),R=this._context.renderCoordsHelper.viewingMode===A.Global;R||this._context.renderCoordsHelper.worldUpAtPosition(null,C),_(d.spatialReference,[f.x,f.y,0],B,this._context.renderCoordsHelper.spatialReference);const z=c();o(z,B);const k=i();a(k,z);const{polygons:N,mapPosition:F,position:V}=u,H=V.length/3,Z=new Float64Array(3*H*6),W=new Float64Array(3*H*6),q=new Float64Array(3*H*6),J=new Float64Array(1*H*6);let Q=0;for(let r=0;r<N.length;++r){const e=N[r],s=e.count;if(this._context.clippingExtent&&(E(O),x(O,e.mapPosition),!P(O,this._context.clippingExtent)))continue;const a=n(e.mapPosition,e.holeIndices,3);if(0===a.length)continue;const i=3*s*2+a.length,o=new Uint32Array(i),c=new Uint32Array(a.length),m=6*s,p=3*Z.BYTES_PER_ELEMENT,d=new v(Z.buffer,Q*p,p,(Q+m)*p),u=3*W.BYTES_PER_ELEMENT,f=new v(W.buffer,Q*u,u,(Q+m)*u),y=new Float64Array(q.buffer,3*Q*q.BYTES_PER_ELEMENT,3*m),_=new Float64Array(J.buffer,1*Q*J.BYTES_PER_ELEMENT,1*m),b=this._getExtrusionSize(t);K(V,F,a,e,d.typedBuffer,y,f.typedBuffer,_,0,o,c,b,C,R),S(d,d,z),w(f,f,k),Q+=6*s;const A=this._createExtrudeGeometry(o,o.length-c.length,{positions:d.typedBuffer,elevation:y,normals:f.typedBuffer,heights:_},h);g.push(A),j.push(this._material),M.push(l);const L=this._createExtrudeGeometry(c,0,{positions:d.typedBuffer,elevation:y,normals:f.typedBuffer,heights:_},h);g.push(L),j.push(this._bottomMaterial),M.push(l)}if(0===g.length)return null;const X=new Y({geometries:g,materials:j,transformations:M,metadata:{layerUid:this._context.layer.uid,graphicUid:p,isElevationSource:!0}});X.transformation=B;const $=U(this.symbolLayer,{opacity:this._getLayerOpacity()}),ee=r($)?{baseMaterial:this._material,edgeMaterials:[$],properties:{mergeGeometries:!0,slicePlaneEnabled:this._context.slicePlaneEnabled}}:null,te=new I(this,X,g,null,null,le,m,ee);return te.alignedSampledElevation=u.sampledElevation,te.needsElevationUpdates=L(m.mode),te}_createExtrudeGeometry(e,t,r,s){const n=new Uint32Array(e.length),a=[[Z.POSITION,{size:3,data:r.positions,exclusive:!0}],[Z.NORMAL,{size:3,data:r.normals,exclusive:!0}],[Z.COLOR,{size:4,data:s,exclusive:!0}],[Z.SIZE,{size:1,data:r.heights,exclusive:!0}]],i=[[Z.POSITION,e],[Z.NORMAL,e],[Z.COLOR,n]];return r.elevation&&(a.push([Z.MAPPOS,{size:3,data:r.elevation}]),i.push([Z.MAPPOS,e])),new H(a,i,V.Triangle,t)}}function K(e,t,r,s,n,a,i,o,l,c,h,m,p,d){const u=r.length/3;let f=0,g=2*s.count;Q(e,t,s.index,s.count,r,0,u,n,a,i,o,l,c,h,g,m,p,d),l+=2*s.count,g=0,ee(n,a,o,i,f,s.pathLengths[0],s.count,l,c,g,m),l+=4*s.pathLengths[0],g+=2*s.pathLengths[0],f+=s.pathLengths[0];for(let y=1;y<s.pathLengths.length;++y)ee(n,a,o,i,f,s.pathLengths[y],s.count,l,c,g,m),l+=4*s.pathLengths[y],g+=2*s.pathLengths[y],f+=s.pathLengths[y]}function Q(e,t,r,s,n,a,i,o,l,c,p,d,u,f,g,y,_,b){h(he,_);const E=y>0?1:-1;let x=3*r,P=d,v=3*P,S=d+s,w=3*S;for(let h=0;h<s;++h)b&&(he[0]=e[x+0],he[1]=e[x+1],he[2]=e[x+2],m(he,he)),o[v+0]=e[x+0],o[v+1]=e[x+1],o[v+2]=e[x+2],l[v+0]=t[x+0],l[v+1]=t[x+1],l[v+2]=t[x+2],c[v+0]=-E*he[0],c[v+1]=-E*he[1],c[v+2]=-E*he[2],p[P]=0,o[w+0]=e[x+0]+y*he[0],o[w+1]=e[x+1]+y*he[1],o[w+2]=e[x+2]+y*he[2],l[w+0]=t[x+0],l[w+1]=t[x+1],l[w+2]=t[x+2],c[w+0]=E*he[0],c[w+1]=E*he[1],c[w+2]=E*he[2],p[S]=y,v+=3,w+=3,x+=3,P+=1,S+=1;x=3*a,v=0,w=3*g;const j=y<0?de:pe,A=y<0?pe:de;for(let h=0;h<i;++h)f[v+0]=n[x+j[0]],f[v+1]=n[x+j[1]],f[v+2]=n[x+j[2]],u[w+0]=n[x+A[0]]+s,u[w+1]=n[x+A[1]]+s,u[w+2]=n[x+A[2]]+s,v+=3,w+=3,x+=3}function X(e,t,r,s,n,a,i){s[a]=s[i],i*=3,e[(a*=3)+0]=e[i+0],e[a+1]=e[i+1],e[a+2]=e[i+2],t[a+0]=t[i+0],t[a+1]=t[i+1],t[a+2]=t[i+2],r[a+0]=n[0],r[a+1]=n[1],r[a+2]=n[2]}const $=y();function ee(e,t,r,s,n,a,i,o,l,c,h){let m=n,p=n+1,d=n+i,u=n+i+1,f=o,g=o+1,y=o+2*a,_=o+2*a+1;h<0&&(m=n+i+1,u=n),c*=3;for(let b=0;b<a;++b)b===a-1&&(h>0?(p=n,u=n+i):(p=n,m=n+i)),ie(e,m,p,d,$),X(e,t,s,r,$,f,m),X(e,t,s,r,$,g,p),X(e,t,s,r,$,y,d),X(e,t,s,r,$,_,u),l[c++]=f,l[c++]=y,l[c++]=_,l[c++]=f,l[c++]=_,l[c++]=g,m++,p++,d++,u++,f+=2,g+=2,y+=2,_+=2}const te=y(),re=y(),se=y(),ne=y(),ae=y();function ie(e,t,r,s,n){t*=3,r*=3,s*=3,p(te,e[t++],e[t++],e[t++]),p(re,e[r++],e[r++],e[r++]),p(se,e[s++],e[s++],e[s++]),d(ne,re,te),d(ae,se,te),u(n,ae,ne),m(n,n)}const oe=y();function le(e,t,r,s){const n=e.stageObject,a=n.geometryRecords,i=a.length,l="absolute-height"!==t.mode;let h=0;const m=n.transformation,d=o(c(),m);for(let o=0;o<i;o+=2){const e=a[o].geometry,i=e.getMutableAttribute(Z.POSITION).data,c=e.vertexAttributes.get(Z.SIZE).data,u=e.vertexAttributes.get(Z.MAPPOS).data,g=new N(u),y=i.length/3;let _=0,b=!1,E=0;const x=r.spatialReference;for(let n=0;n<y;n++){oe[0]=i[_],oe[1]=i[_+1],oe[2]=i[_+2],M(g,r,t,s,me),l&&(E+=me.sampledElevation),k.TESTS_DISABLE_OPTIMIZATIONS?(p(ce,g.array[g.offset+0],g.array[g.offset+1],me.z+c[_/3]),s.toRenderCoords(ce,x,ce),f(ce,ce,d)):(p(ce,i[_+0],i[_+1],i[_+2]),f(ce,ce,m),s.setAltitude(ce,me.z+c[_/3]),f(ce,ce,d)),i[_]=ce[0],i[_+1]=ce[1],i[_+2]=ce[2];const e=ue/s.unitInMeters;(Math.abs(oe[0]-i[_])>=e||Math.abs(oe[1]-i[_+1])>=e||Math.abs(oe[2]-i[_+2])>=e)&&(b=!0),g.offset+=3,_+=3}b&&(e.invalidateBoundingInfo(),n.geometryVertexAttrsUpdated(a[o]),a[o+1].geometry.invalidateBoundingInfo(),n.geometryVertexAttrsUpdated(a[o+1])),h+=E/y}return h/i}const ce=y(),he=y(),me=new O,pe=[0,2,1],de=[0,1,2],ue=.01;export{J as Graphics3DExtrudeSymbolLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../Graphic.js";import{neverReached as i}from"../../../../core/compilerUtils.js";import{HandleOwner as s}from"../../../../core/HandleOwner.js";import{destroyMaybe as r,isSome as n,unwrap as a}from"../../../../core/maybe.js";import{logOnError as o}from"../../../../core/promiseUtils.js";import{watch as l,initial as p,when as h}from"../../../../core/reactiveUtils.js";import{property as d}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as u}from"../../../../core/accessorSupport/decorators/subclass.js";import{diff as c}from"../../../../core/accessorSupport/diffUtils.js";import{canProject as y,project as g}from"../../../../geometry/support/webMercatorUtils.js";import{getRenderingInfo as m,getRenderingInfoAsync as f}from"../../../../renderers/support/renderingInfoUtils.js";import b from"../../../../rest/support/Query.js";import{SUSPEND_RESUME_EXTENT_OPTIMISM as v}from"./constants.js";import{Graphics3DCore as E}from"./Graphics3DCore.js";import C from"./Graphics3DElevationAlignment.js";import{Graphics3DFilterVisibility as x}from"./Graphics3DFilterVisibility.js";import w from"./Graphics3DFrustumVisibility.js";import{Graphics3DObjectStates as V}from"./Graphics3DObjectStates.js";import S from"./Graphics3DScaleVisibility.js";import{enlargeExtent as j}from"./graphicUtils.js";import{attributeLookup as R}from"../support/attributeUtils.js";import{UpdatePolicy as O,Object3DState as G}from"../../webgl-engine/lib/basicInterfaces.js";let _=class extends s{constructor(e){super(e),this.type="graphics-3d",this.elevationFeatureExpressionEnabled=!1,this.dataExtent=null,this.preferredUpdatePolicy=O.ASYNC,this.suspendResumeExtent=null}normalizeCtorArgs(e){const t=e.frustumVisibilityEnabled?new w:null,i=e.scaleVisibilityEnabled?new S:null,s=(e.filterVisibilityEnabled||e.timeExtentVisibilityEnabled)&&"multipatch"!==e.owner.layer.geometryType?new x:null,r=e.elevationAlignmentEnabled?new C:null,{owner:n,updateClippingExtent:a,dataExtent:o,elevationFeatureExpressionEnabled:l,preferredUpdatePolicy:p}=e;return{owner:n,updateClippingExtent:a,dataExtent:o,frustumVisibility:t,scaleVisibility:i,filterVisibility:s,elevationAlignment:r,elevationFeatureExpressionEnabled:l,preferredUpdatePolicy:p}}initialize(){const e=new E({owner:this,layer:this.layer,preferredUpdatePolicy:this.preferredUpdatePolicy,elevationFeatureExpressionEnabled:this.elevationFeatureExpressionEnabled,graphicSymbolSupported:!1,hasZ:this.owner.hasZ,hasM:this.owner.hasM});this._set("graphicsCore",e),this.scaleVisibility&&this.updatingHandles.add((()=>this.layer.effectiveScaleRange),(()=>this.scaleVisibility.layerMinMaxScaleChangeHandler())),this.filterVisibility&&(this.updatingHandles.add((()=>"filter"in this.owner&&this.owner.filter),(()=>this.filterVisibility.filterChanged())),this.updatingHandles.add((()=>"timeExtent"in this.owner&&this.owner.timeExtent),(()=>this.filterVisibility.filterChanged()))),this.elevationAlignment&&this.updatingHandles.add((()=>this.layer.elevationInfo),((e,t)=>{c(e,t)&&this.updatingHandles.addPromise(this.graphicsCore.elevationInfoChange())})),this.updatingHandles.add((()=>this.layer.labelsVisible),(()=>this.graphicsCore.updateVisibilityInfo())),this.updatingHandles.add((()=>this.layer.labelingInfo),((e,t)=>{c(e,t)&&this.graphicsCore.updateLabelingInfo()})),this.updatingHandles.add((()=>this.preferredUpdatePolicy),(e=>this.graphicsCore.preferredUpdatePolicy=e))}destroy(){this.handles.removeAll(),this.updatingHandles.removeAll(),this._set("frustumVisibility",r(this.frustumVisibility)),this._set("scaleVisibility",r(this.scaleVisibility)),this._set("filterVisibility",r(this.filterVisibility)),this._set("elevationAlignment",r(this.elevationAlignment)),this._set("objectStates",r(this.objectStates)),this._set("graphicsCore",r(this.graphicsCore)),this._set("owner",null)}get layer(){return this.owner.layer}get suspendResumeExtentMode(){return"suspendResumeExtentMode"in this.owner?this.owner.suspendResumeExtentMode:"computed"}get scaleVisibilitySuspended(){var e;return null==(e=this.scaleVisibility)?void 0:e.suspended}get suspended(){return this.owner.suspended}get suspendInfo(){var e,t;const i={};return null!=(e=this.scaleVisibility)&&e.suspended&&(i.outsideScaleRange=!0),null!=(t=this.frustumVisibility)&&t.suspended&&(i.outsideOfView=!0),i}get updating(){var e,t,i;return!!(null!=(e=this.graphicsCore)&&e.updating||null!=(t=this.frustumVisibility)&&t.updating||null!=(i=this.updatingHandles)&&i.updating)}get featureStore(){var e;return null==(e=this.graphicsCore)?void 0:e.featureStore}get view(){return this.owner.view}get loadedGraphics(){return this.owner.loadedGraphics}get fullOpacity(){return this.owner.fullOpacity}get filter(){return"filter"in this.owner?this.owner.filter:null}get slicePlaneEnabled(){return this.owner.slicePlaneEnabled}get drapeSourceType(){return this.owner.drapeSourceType}get updatePolicy(){return this.owner.updatePolicy}get graphics3DGraphics(){var e;return null==(e=this.graphicsCore)?void 0:e.graphics3DGraphics}get graphics3DGraphicsByObjectID(){var e;return null==(e=this.graphicsCore)?void 0:e.graphics3DGraphicsByObjectID}get symbolUpdateType(){var e;return null==(e=this.graphicsCore)?void 0:e.symbolUpdateType}get performanceInfo(){return{core:this.graphicsCore.performanceInfo,elevationUpdating:this.elevationAlignment.updating,visibilityFrustum:!this.frustumVisibility.suspended,visibilityScale:!this.scaleVisibility.suspended}}async setup(){this.frustumVisibility&&this.frustumVisibility.setup(this);const e=this.owner,t=this.owner.view.basemapTerrain,i=(e,t,i)=>this.graphicsCore.spatialIndex.queryGraphicUIDsInExtent(e,t,i);if(this.scaleVisibility&&this.scaleVisibility.setup(this,this.layer,i,this.graphicsCore,t),this.filterVisibility&&("filter"in e||"timeExtent"in e)&&this.filterVisibility.setup(e,this.graphicsCore),this.elevationAlignment){const t=e.view.elevationProvider;this.elevationAlignment.setup(this,i,this.graphicsCore,t)}this._set("objectStates",new V(this.graphicsCore)),this._set("labeling",this.owner.view.labeler.addGraphicsOwner(this.graphicsCore,this.scaleVisibility)),this._set("deconfliction",e.view.deconflictor.addGraphicsOwner(this.graphicsCore)),await o(this.graphicsCore.setup({elevationAlignment:this.elevationAlignment,scaleVisibility:this.scaleVisibility,filterVisibility:this.filterVisibility,deconflictor:this.deconfliction,labeler:this.labeling,objectStates:this.objectStates})),this.updatingHandles.add((()=>this.layer.renderer),(e=>this.updatingHandles.addPromise(this.graphicsCore.rendererChange(e)))),this.updatingHandles.add((()=>e.fullOpacity),(()=>this.graphicsCore.opacityChange())),this._setupSuspendResumeExtent(),this.updateClippingExtent&&(this.updatingHandles.add((()=>e.view.clippingArea),(()=>this._updateClippingExtent())),this._updateClippingExtent()),this.graphicsCore.startCreateGraphics(),this.graphicsCore.labelsEnabled&&await o(this.graphicsCore.updateLabelingInfo())}maskOccludee(e){const{set:t,handle:i}=this.objectStates.acquireSet(G.MaskOccludee,null);return this.objectStates.setUid(t,e.uid),i}highlight(e,i){if(e instanceof b){const{set:t,handle:s}=this.objectStates.acquireSet(G.Highlight,i);return this.owner.queryObjectIds(e).then((e=>this.objectStates.setObjectIds(t,e))),s}if("number"==typeof e||"string"==typeof e)return this.highlight([e],i);if(e instanceof t)return this.highlight([e],i);if("toArray"in e&&(e=e.toArray()),Array.isArray(e)&&e.length>0){if(e[0]instanceof t){const t=e;if(null==R(this.layer.fieldsIndex,t[0].attributes,i)){const e=t.map((e=>e.uid)),{set:i,handle:s}=this.objectStates.acquireSet(G.Highlight,null);return this.objectStates.setUids(i,e),s}e=t.map((e=>R(this.layer.fieldsIndex,e.attributes,i)))}if("number"==typeof e[0]||"string"==typeof e[0]){const t=e,{set:s,handle:r}=this.objectStates.acquireSet(G.Highlight,i);return this.objectStates.setObjectIds(s,t),r}}return U}whenGraphicBounds(e,t){var i;return null==(i=this.graphicsCore)?void 0:i.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){var i;return null==(i=this.graphicsCore)?void 0:i.computeAttachmentOrigin(e,t)}notifyGraphicGeometryChanged(e){this.graphicsCore.notifyGraphicGeometryChanged(e)}notifyGraphicVisibilityChanged(e){this.graphicsCore.notifyGraphicVisibilityChanged(e)}getRenderingInfo(e,t,i){const s=m(e,{renderer:t,arcade:i});if(n(s)&&s.color){const e=s.color;e[0]=e[0]/255,e[1]=e[1]/255,e[2]=e[2]/255}return s}getRenderingInfoAsync(e,t,i,s){return f(e,{renderer:t,arcade:i,...s})}getSymbolLayerSize(e,t){var i;return null==(i=this.graphicsCore)?void 0:i.getSymbolLayerSize(e,t)}_updateClippingExtent(){const e=this.owner.view.clippingArea;this.graphicsCore.setClippingExtent(e,this.owner.view.spatialReference)&&(this.updateClippingExtent(e)||this.graphicsCore.recreateAllGraphics())}_setupSuspendResumeExtent(){(this.frustumVisibility||this.scaleVisibility)&&this.handles.add(l((()=>this.suspendResumeExtentMode),(()=>{switch(this.handles.remove(I),this.suspendResumeExtentMode){case"computed":this.handles.add([l((()=>this.graphicsCore.computedExtent),(e=>this._updateSuspendResumeExtent(e)),p),l((()=>this.graphicsCore.extentPadding),(()=>this._updateSuspendResumeExtent(this.graphicsCore.computedExtent)))],I);break;case"data":this.handles.add([h((()=>this.dataExtent),(e=>this._updateSuspendResumeExtent(e)),p),l((()=>this.graphicsCore.extentPadding),(()=>this._updateSuspendResumeExtent(a(this.dataExtent))))],I);break;default:i(this.suspendResumeExtentMode)}}),p))}_updateSuspendResumeExtent(e){e?this._suspendResumeExtentChanged(this._extentToSuspendResumeRect(e,this.suspendResumeExtent)):this._suspendResumeExtentChanged(null)}_extentToSuspendResumeRect(e,t){const i=this.owner.view.spatialReference;if(!e.spatialReference.equals(i)){if(!y(e,i))return;e=g(e,i)}return j(e,t,v,this.graphicsCore.extentPadding)}_suspendResumeExtentChanged(e){this.frustumVisibility&&this.frustumVisibility.setExtent(e),this.scaleVisibility&&this.scaleVisibility.setExtent(e)}};e([d()],_.prototype,"type",void 0),e([d({constructOnly:!0})],_.prototype,"owner",void 0),e([d()],_.prototype,"layer",null),e([d({constructOnly:!0})],_.prototype,"updateClippingExtent",void 0),e([d({constructOnly:!0})],_.prototype,"elevationFeatureExpressionEnabled",void 0),e([d({constructOnly:!0})],_.prototype,"graphicsCore",void 0),e([d({constructOnly:!0})],_.prototype,"scaleVisibility",void 0),e([d({constructOnly:!0})],_.prototype,"filterVisibility",void 0),e([d({constructOnly:!0})],_.prototype,"elevationAlignment",void 0),e([d({constructOnly:!0})],_.prototype,"frustumVisibility",void 0),e([d({readOnly:!0})],_.prototype,"deconfliction",void 0),e([d({readOnly:!0})],_.prototype,"labeling",void 0),e([d({readOnly:!0})],_.prototype,"objectStates",void 0),e([d()],_.prototype,"suspendResumeExtentMode",null),e([d()],_.prototype,"dataExtent",void 0),e([d()],_.prototype,"scaleVisibilitySuspended",null),e([d()],_.prototype,"suspended",null),e([d()],_.prototype,"suspendInfo",null),e([d()],_.prototype,"updating",null),e([d()],_.prototype,"featureStore",null),e([d()],_.prototype,"view",null),e([d()],_.prototype,"loadedGraphics",null),e([d()],_.prototype,"fullOpacity",null),e([d()],_.prototype,"filter",null),e([d()],_.prototype,"slicePlaneEnabled",null),e([d()],_.prototype,"drapeSourceType",null),e([d()],_.prototype,"updatePolicy",null),e([d()],_.prototype,"preferredUpdatePolicy",void 0),_=e([u("esri.views.3d.layers.graphics.Graphics3DFeatureProcessor")],_);const A=_,I="suspendResumeExtentMode",U={remove(){},pause(){},resume(){}};export{A as default};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../Graphic.js";import{neverReached as i}from"../../../../core/compilerUtils.js";import{HandleOwner as s}from"../../../../core/HandleOwner.js";import{destroyMaybe as r,isSome as n,unwrap as a}from"../../../../core/maybe.js";import{logOnError as o}from"../../../../core/promiseUtils.js";import{watch as l,initial as p,when as h}from"../../../../core/reactiveUtils.js";import{property as d}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as u}from"../../../../core/accessorSupport/decorators/subclass.js";import{diff as c}from"../../../../core/accessorSupport/diffUtils.js";import{canProject as y,project as g}from"../../../../geometry/support/webMercatorUtils.js";import{getRenderingInfo as m,getRenderingInfoAsync as f}from"../../../../renderers/support/renderingInfoUtils.js";import b from"../../../../rest/support/Query.js";import{SUSPEND_RESUME_EXTENT_OPTIMISM as v}from"./constants.js";import{Graphics3DCore as C}from"./Graphics3DCore.js";import E from"./Graphics3DElevationAlignment.js";import{Graphics3DFilterVisibility as x}from"./Graphics3DFilterVisibility.js";import w from"./Graphics3DFrustumVisibility.js";import{Graphics3DObjectStates as V}from"./Graphics3DObjectStates.js";import S from"./Graphics3DScaleVisibility.js";import{enlargeExtent as j}from"./graphicUtils.js";import{attributeLookup as R}from"../support/attributeUtils.js";import{UpdatePolicy as O,Object3DState as G}from"../../webgl-engine/lib/basicInterfaces.js";let _=class extends s{constructor(e){super(e),this.type="graphics-3d",this.elevationFeatureExpressionEnabled=!1,this.dataExtent=null,this.preferredUpdatePolicy=O.ASYNC,this.suspendResumeExtent=null}normalizeCtorArgs(e){const t=e.frustumVisibilityEnabled?new w:null,i=e.scaleVisibilityEnabled?new S:null,s=(e.filterVisibilityEnabled||e.timeExtentVisibilityEnabled)&&"multipatch"!==e.owner.layer.geometryType?new x:null,r=e.elevationAlignmentEnabled?new E:null,{owner:n,updateClippingExtent:a,dataExtent:o,elevationFeatureExpressionEnabled:l,preferredUpdatePolicy:p}=e;return{owner:n,updateClippingExtent:a,dataExtent:o,frustumVisibility:t,scaleVisibility:i,filterVisibility:s,elevationAlignment:r,elevationFeatureExpressionEnabled:l,preferredUpdatePolicy:p}}initialize(){const e=new C({owner:this,layer:this.layer,preferredUpdatePolicy:this.preferredUpdatePolicy,elevationFeatureExpressionEnabled:this.elevationFeatureExpressionEnabled,graphicSymbolSupported:!1,hasZ:this.owner.hasZ,hasM:this.owner.hasM});this._set("graphicsCore",e),this.scaleVisibility&&this.updatingHandles.add((()=>this.layer.effectiveScaleRange),(()=>this.scaleVisibility.layerMinMaxScaleChangeHandler())),this.filterVisibility&&(this.updatingHandles.add((()=>"filter"in this.owner&&this.owner.filter),(()=>this.filterVisibility.filterChanged())),this.updatingHandles.add((()=>"timeExtent"in this.owner&&this.owner.timeExtent),(()=>this.filterVisibility.filterChanged()))),this.elevationAlignment&&this.updatingHandles.add((()=>this.layer.elevationInfo),((e,t)=>{c(e,t)&&this.updatingHandles.addPromise(this.graphicsCore.elevationInfoChange())})),this.updatingHandles.add((()=>this.layer.labelsVisible),(()=>this.graphicsCore.updateVisibilityInfo())),this.updatingHandles.add((()=>this.layer.labelingInfo),((e,t)=>{c(e,t)&&this.graphicsCore.updateLabelingInfo()})),this.updatingHandles.add((()=>this.preferredUpdatePolicy),(e=>this.graphicsCore.preferredUpdatePolicy=e))}destroy(){this.handles.removeAll(),this.updatingHandles.removeAll(),this._set("frustumVisibility",r(this.frustumVisibility)),this._set("scaleVisibility",r(this.scaleVisibility)),this._set("filterVisibility",r(this.filterVisibility)),this._set("elevationAlignment",r(this.elevationAlignment)),this._set("objectStates",r(this.objectStates)),this._set("graphicsCore",r(this.graphicsCore)),this._set("owner",null)}get layer(){return this.owner.layer}get suspendResumeExtentMode(){return"suspendResumeExtentMode"in this.owner?this.owner.suspendResumeExtentMode:"computed"}get scaleVisibilitySuspended(){var e;return null==(e=this.scaleVisibility)?void 0:e.suspended}get suspended(){return this.owner.suspended}get legendEnabled(){return!this.frustumVisibility.suspended}get suspendInfo(){var e,t;const i={};return null!=(e=this.scaleVisibility)&&e.suspended&&(i.outsideScaleRange=!0),null!=(t=this.frustumVisibility)&&t.suspended&&(i.outsideOfView=!0),i}get updating(){var e,t,i;return!!(null!=(e=this.graphicsCore)&&e.updating||null!=(t=this.frustumVisibility)&&t.updating||null!=(i=this.updatingHandles)&&i.updating)}get updatingRemaining(){var e,t;return null!=(e=null==(t=this.graphicsCore)?void 0:t.updatingRemaining)?e:0}get featureStore(){var e;return null==(e=this.graphicsCore)?void 0:e.featureStore}get view(){return this.owner.view}get loadedGraphics(){return this.owner.loadedGraphics}get fullOpacity(){return this.owner.fullOpacity}get filter(){return"filter"in this.owner?this.owner.filter:null}get slicePlaneEnabled(){return this.owner.slicePlaneEnabled}get drapeSourceType(){return this.owner.drapeSourceType}get updatePolicy(){return this.owner.updatePolicy}get graphics3DGraphics(){var e;return null==(e=this.graphicsCore)?void 0:e.graphics3DGraphics}get graphics3DGraphicsByObjectID(){var e;return null==(e=this.graphicsCore)?void 0:e.graphics3DGraphicsByObjectID}get symbolUpdateType(){var e;return null==(e=this.graphicsCore)?void 0:e.symbolUpdateType}get displayFeatureLimit(){var e;return null==(e=this.graphicsCore)?void 0:e.displayFeatureLimit}get usedMemory(){var e;return null==(e=this.graphicsCore)?void 0:e.usedMemory}get usedMemoryPerFeature(){var e;return null==(e=this.graphicsCore)?void 0:e.usedMemoryPerGraphic}get unprocessedMemoryEstimate(){var e,t;return null!=(e=null==(t=this.graphicsCore)?void 0:t.unprocessedMemoryEstimate)?e:0}get performanceInfo(){return{core:this.graphicsCore.performanceInfo,elevationUpdating:this.elevationAlignment.updating,visibilityFrustum:!this.frustumVisibility.suspended,visibilityScale:!this.scaleVisibility.suspended}}async setup(){this.frustumVisibility&&this.frustumVisibility.setup(this);const e=this.owner,t=this.owner.view.basemapTerrain,i=(e,t,i)=>this.graphicsCore.spatialIndex.queryGraphicUIDsInExtent(e,t,i);if(this.scaleVisibility&&this.scaleVisibility.setup(this,this.layer,i,this.graphicsCore,t),this.filterVisibility&&("filter"in e||"timeExtent"in e)&&this.filterVisibility.setup(e,this.graphicsCore),this.elevationAlignment){const t=e.view.elevationProvider;this.elevationAlignment.setup(this,i,this.graphicsCore,t)}this._set("objectStates",new V(this.graphicsCore)),this._set("labeling",this.owner.view.labeler.addGraphicsOwner(this.graphicsCore,this.scaleVisibility)),this._set("deconfliction",e.view.deconflictor.addGraphicsOwner(this.graphicsCore)),await o(this.graphicsCore.setup({elevationAlignment:this.elevationAlignment,scaleVisibility:this.scaleVisibility,filterVisibility:this.filterVisibility,deconflictor:this.deconfliction,labeler:this.labeling,objectStates:this.objectStates})),this.updatingHandles.add((()=>this.layer.renderer),(e=>this.updatingHandles.addPromise(this.graphicsCore.rendererChange(e)))),this.updatingHandles.add((()=>e.fullOpacity),(()=>this.graphicsCore.opacityChange())),this._setupSuspendResumeExtent(),this.updateClippingExtent&&(this.updatingHandles.add((()=>e.view.clippingArea),(()=>this._updateClippingExtent())),this._updateClippingExtent()),this.graphicsCore.startCreateGraphics(),this.graphicsCore.labelsEnabled&&await o(this.graphicsCore.updateLabelingInfo())}maskOccludee(e){const{set:t,handle:i}=this.objectStates.acquireSet(G.MaskOccludee,null);return this.objectStates.setUid(t,e.uid),i}highlight(e,i){if(e instanceof b){const{set:t,handle:s}=this.objectStates.acquireSet(G.Highlight,i);return this.owner.queryObjectIds(e).then((e=>this.objectStates.setObjectIds(t,e))),s}if("number"==typeof e||"string"==typeof e)return this.highlight([e],i);if(e instanceof t)return this.highlight([e],i);if("toArray"in e&&(e=e.toArray()),Array.isArray(e)&&e.length>0){if(e[0]instanceof t){const t=e;if(null==R(this.layer.fieldsIndex,t[0].attributes,i)){const e=t.map((e=>e.uid)),{set:i,handle:s}=this.objectStates.acquireSet(G.Highlight,null);return this.objectStates.setUids(i,e),s}e=t.map((e=>R(this.layer.fieldsIndex,e.attributes,i)))}if("number"==typeof e[0]||"string"==typeof e[0]){const t=e,{set:s,handle:r}=this.objectStates.acquireSet(G.Highlight,i);return this.objectStates.setObjectIds(s,t),r}}return P}whenGraphicBounds(e,t){var i;return null==(i=this.graphicsCore)?void 0:i.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){var i;return null==(i=this.graphicsCore)?void 0:i.computeAttachmentOrigin(e,t)}notifyGraphicGeometryChanged(e){this.graphicsCore.notifyGraphicGeometryChanged(e)}notifyGraphicVisibilityChanged(e){this.graphicsCore.notifyGraphicVisibilityChanged(e)}getRenderingInfo(e,t,i){const s=m(e,{renderer:t,arcade:i});if(n(s)&&s.color){const e=s.color;e[0]=e[0]/255,e[1]=e[1]/255,e[2]=e[2]/255}return s}getRenderingInfoAsync(e,t,i,s){return f(e,{renderer:t,arcade:i,...s})}getSymbolLayerSize(e,t){var i;return null==(i=this.graphicsCore)?void 0:i.getSymbolLayerSize(e,t)}setObjectIdVisibility(e,t){var i;null==(i=this.graphicsCore)||i.setObjectIdVisibility(e,t)}_updateClippingExtent(){const e=this.owner.view.clippingArea;this.graphicsCore.setClippingExtent(e,this.owner.view.spatialReference)&&(this.updateClippingExtent(e)||this.graphicsCore.recreateAllGraphics())}_setupSuspendResumeExtent(){(this.frustumVisibility||this.scaleVisibility)&&this.handles.add(l((()=>this.suspendResumeExtentMode),(()=>{switch(this.handles.remove(I),this.suspendResumeExtentMode){case"computed":this.handles.add([l((()=>this.graphicsCore.computedExtent),(e=>this._updateSuspendResumeExtent(e)),p),l((()=>this.graphicsCore.extentPadding),(()=>this._updateSuspendResumeExtent(this.graphicsCore.computedExtent)))],I);break;case"data":this.handles.add([h((()=>this.dataExtent),(e=>this._updateSuspendResumeExtent(e)),p),l((()=>this.graphicsCore.extentPadding),(()=>this._updateSuspendResumeExtent(a(this.dataExtent))))],I);break;default:i(this.suspendResumeExtentMode)}}),p))}_updateSuspendResumeExtent(e){e?this._suspendResumeExtentChanged(this._extentToSuspendResumeRect(e,this.suspendResumeExtent)):this._suspendResumeExtentChanged(null)}_extentToSuspendResumeRect(e,t){const i=this.owner.view.spatialReference;if(!e.spatialReference.equals(i)){if(!y(e,i))return;e=g(e,i)}return j(e,t,v,this.graphicsCore.extentPadding)}_suspendResumeExtentChanged(e){this.frustumVisibility&&this.frustumVisibility.setExtent(e),this.scaleVisibility&&this.scaleVisibility.setExtent(e)}};e([d()],_.prototype,"type",void 0),e([d({constructOnly:!0})],_.prototype,"owner",void 0),e([d()],_.prototype,"layer",null),e([d({constructOnly:!0})],_.prototype,"updateClippingExtent",void 0),e([d({constructOnly:!0})],_.prototype,"elevationFeatureExpressionEnabled",void 0),e([d({constructOnly:!0})],_.prototype,"graphicsCore",void 0),e([d({constructOnly:!0})],_.prototype,"scaleVisibility",void 0),e([d({constructOnly:!0})],_.prototype,"filterVisibility",void 0),e([d({constructOnly:!0})],_.prototype,"elevationAlignment",void 0),e([d({constructOnly:!0})],_.prototype,"frustumVisibility",void 0),e([d({readOnly:!0})],_.prototype,"deconfliction",void 0),e([d({readOnly:!0})],_.prototype,"labeling",void 0),e([d({readOnly:!0})],_.prototype,"objectStates",void 0),e([d()],_.prototype,"suspendResumeExtentMode",null),e([d()],_.prototype,"dataExtent",void 0),e([d()],_.prototype,"scaleVisibilitySuspended",null),e([d()],_.prototype,"suspended",null),e([d()],_.prototype,"legendEnabled",null),e([d()],_.prototype,"suspendInfo",null),e([d()],_.prototype,"updating",null),e([d()],_.prototype,"updatingRemaining",null),e([d()],_.prototype,"featureStore",null),e([d()],_.prototype,"view",null),e([d()],_.prototype,"loadedGraphics",null),e([d()],_.prototype,"fullOpacity",null),e([d()],_.prototype,"filter",null),e([d()],_.prototype,"slicePlaneEnabled",null),e([d()],_.prototype,"drapeSourceType",null),e([d()],_.prototype,"updatePolicy",null),e([d()],_.prototype,"preferredUpdatePolicy",void 0),e([d()],_.prototype,"displayFeatureLimit",null),e([d()],_.prototype,"usedMemory",null),e([d()],_.prototype,"usedMemoryPerFeature",null),_=e([u("esri.views.3d.layers.graphics.Graphics3DFeatureProcessor")],_);const A=_,I="suspendResumeExtentMode",P={remove(){},pause(){},resume(){}};export{A 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 e from"../../../../Color.js";import{isSome as t,isNone as r}from"../../../../core/maybe.js";import{pt2px as i}from"../../../../core/screenUtils.js";import{perObjectElevationAligner as a}from"./ElevationAligners.js";import{SymbolUpdateType as n,elevationModeChangeUpdateType as s,needsElevationUpdates2D as o}from"./elevationAlignmentUtils.js";import{ElevationContext as l}from"./ElevationContext.js";import{Graphics3DObject3DGraphicLayer as c}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as m}from"./Graphics3DSymbolLayer.js";import{computeCentroid as d}from"./graphicUtils.js";import{createStageObjectForHUD as h,extendPointGraphicElevationContext as p}from"./pointUtils.js";import{emptySymbolComplexity as u}from"./symbolComplexity.js";import{
|
|
5
|
+
import e from"../../../../Color.js";import{isSome as t,isNone as r}from"../../../../core/maybe.js";import{pt2px as i}from"../../../../core/screenUtils.js";import{perObjectElevationAligner as a}from"./ElevationAligners.js";import{SymbolUpdateType as n,elevationModeChangeUpdateType as s,needsElevationUpdates2D as o}from"./elevationAlignmentUtils.js";import{ElevationContext as l}from"./ElevationContext.js";import{Graphics3DObject3DGraphicLayer as c}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as m}from"./Graphics3DSymbolLayer.js";import{computeCentroid as d}from"./graphicUtils.js";import{createStageObjectForHUD as h,extendPointGraphicElevationContext as p}from"./pointUtils.js";import{emptySymbolComplexity as u}from"./symbolComplexity.js";import{PrimitiveType as f}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as g}from"../../webgl-engine/lib/Geometry.js";import{DefaultMaterialParameters as v}from"../../webgl-engine/lib/Material.js";import{VertexAttribute as y}from"../../webgl-engine/lib/VertexAttribute.js";import{LineCalloutMaterial as x}from"../../webgl-engine/materials/LineCalloutMaterial.js";class O extends m{constructor(e,t){super(e,null,t,P),this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!1},this.ensureDrapedStatus(!1)}async doLoad(){this._material=new x(this.materialParameters),this._context.stage.add(this._material)}destroy(){super.destroy(),this._context.stage.remove(this._material),this._material=null}_perInstanceMaterialParameters(e){const t=this.materialParameters;return t.screenOffset=e.screenOffset||[0,0],t.centerOffsetUnits=e.centerOffsetUnits||"world",t}get materialParameters(){const r=this.symbol,a=r.callout,n=t(a.color)?e.toUnitRGBA(a.color):[0,0,0,0];n[3]*=this._getLayerOpacity();const s=i(a.size||0);let o=null;if(r.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:a}=r.verticalOffset;o={screenLength:i(e),minWorldLength:t||0,maxWorldLength:null!=a?a:1/0}}const l=t(a.border)&&t(a.border.color)?e.toUnitRGBA(a.border.color):null,c="object"===r.symbolLayers.getItemAt(0).type,m=!c,d=c?0:void 0,h="label-3d"===r.type;return{color:n,size:s,verticalOffset:o,screenSizePerspective:this._context.screenSizePerspectiveEnabled?this._context.sharedResources.screenSizePerspectiveSettings:null,screenOffset:[0,0],centerOffsetUnits:"world",borderColor:l,occlusionTest:m,shaderPolygonOffset:d,depthHUDAlignStart:h,slicePlaneEnabled:this._context.slicePlaneEnabled,renderOccluded:v.renderOccluded}}_defaultElevationInfoNoZ(){return _}createGraphics3DGraphic(e){const t=e.renderingInfo,i=e.graphic,a=this.setGraphicElevationContext(i,new l,t.elevationOffset||0),n=t.symbol,s="on-the-ground"===this._elevationContext.mode&&("cim"===n.type||!n.symbolLayers.some((e=>"object"===e.type||"text"===e.type)));if("label-3d"!==n.type&&s)return null;const o=d(i.geometry);return r(o)?null:this._createAs3DShape(o,a,t,i.uid)}layerOpacityChanged(){return r(this._material)||this._material.setParameters(this.materialParameters),!0}layerElevationInfoChanged(e,r,i){const a=this._elevationContext.mode,o=s(O.elevationModeChangeTypes,i,a);return o!==n.UPDATE||e.forEach((e=>{const i=r(e);t(i)&&this.updateGraphicElevationContext(e.graphic,i)})),o}slicePlaneEnabledChanged(){return r(this._material)||this._material.setParameters({slicePlaneEnabled:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}pixelRatioChanged(){return!0}setGraphicElevationContext(e,t,r=0){const i=super.setGraphicElevationContext(e,t);return i.addOffsetRenderUnits(r),i}updateGraphicElevationContext(e,t){this.setGraphicElevationContext(e,t.elevationContext,t.metadata.elevationOffset),t.needsElevationUpdates=o(t.elevationContext.mode)}computeComplexity(){return{primitivesPerFeature:2,primitivesPerCoordinate:0,drawCallsPerFeature:0,estimated:!1,memory:u.memory}}_createVertexData(e){const{translation:t,centerOffset:r}=e,i=t?{size:3,data:[t[0],t[1],t[2]],exclusive:!0}:{size:3,data:[0,0,0],exclusive:!0},a=r?{size:4,data:[r[0],r[1],r[2],r[3]],exclusive:!0}:{size:4,data:[0,0,0,1],exclusive:!0};return[[y.POSITION,i],[y.NORMAL,{size:3,data:[0,0,1],exclusive:!0}],[y.AUXPOS1,a]]}_getOrCreateMaterial(e){const i=this._perInstanceMaterialParameters(e),a=x.uniqueMaterialIdentifier(i);if(t(this._material)&&a===this._material.uniqueMaterialIdentifier)return{material:this._material,isUnique:!1};if(e.materialCollection){let t=e.materialCollection.get(a);return r(t)&&(t=new x(i),e.materialCollection.add(a,t)),{material:t,isUnique:!1}}return{material:new x(i),isUnique:!0}}_createAs3DShape(e,t,r,i){const n=[new g(this._createVertexData(r),C,f.Point)],s=this._getOrCreateMaterial(r),l=h(this._context,e,n,[s.material],t,this._context.layer.uid,i);if(null===l)return null;const m=new c(this,l.object,n,s.isUnique?[s.material]:null,null,a,t);return m.metadata={elevationOffset:r.elevationOffset||0},m.alignedSampledElevation=l.sampledElevation,m.needsElevationUpdates=o(t.mode),p(m,e,this._context.elevationProvider),m}}O.elevationModeChangeTypes={definedChanged:n.UPDATE,staysOnTheGround:n.UPDATE,onTheGroundChanged:n.RECREATE};const b=new Uint16Array([0]),C=[[y.POSITION,b],[y.NORMAL,b],[y.AUXPOS1,b]],_={mode:"relative-to-ground",offset:0},P={ignoreDrivers:!0,renderPriority:0,renderPriorityStep:1};export{O as Graphics3DLineCalloutSymbolLayer,O 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 e from"../../../../Color.js";import"../../../../core/has.js";import{isSome as t,isNone as r,unwrapOr as a,get as o}from"../../../../core/maybe.js";import{f as s,t as n}from"../../../../chunks/mat3.js";import{c as i}from"../../../../chunks/mat3f64.js";import{f as l,m as c,a as u}from"../../../../chunks/mat4.js";import{b as m,c as h}from"../../../../chunks/mat4f64.js";import{b as p,a as f,d,n as g,f as x,c as _}from"../../../../chunks/vec3.js";import{Z as y,O as b,c as v}from"../../../../chunks/vec3f64.js";import{O as T}from"../../../../chunks/vec4f64.js";import{projectVectorToDehydratedPoint as C,projectBuffer as O,computeTranslationToOriginAndRotation as A,canProjectWithoutEngine as M}from"../../../../geometry/projection.js";import{create as E,empty as w,expandWithBuffer as N,intersectsClippingArea as j}from"../../../../geometry/support/aaBoundingBox.js";import R from"../../../../geometry/support/MeshComponent.js";import P from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import{BufferViewVec3f64 as I,BufferViewVec3f as B}from"../../../../geometry/support/buffer/BufferView.js";import{t as F,a as S}from"../../../../chunks/vec32.js";import{transformPosition as L,transformNormal as U,projectNormalToPCPF as V,transformTangent as G,projectTangentToPCPF as $}from"../../../../geometry/support/meshUtils/projection.js";import{makeDehydratedPoint as D}from"../../../../layers/graphics/dehydratedFeatures.js";import{ViewingMode as k}from"../../../ViewingMode.js";import{perObjectElevationAligner as z}from"./ElevationAligners.js";import{needsElevationUpdates3D as q}from"./elevationAlignmentUtils.js";import{ElevationContext as H}from"./ElevationContext.js";import{Graphics3DObject3DGraphicLayer as W}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as Y}from"./Graphics3DSymbolLayer.js";import{createMaterial as Z}from"../support/edgeUtils.js";import{parseColorMixMode as J,encodeSymbolColor as K}from"../support/symbolColorUtils.js";import Q from"../../support/debugFlags.js";import{AlphaDiscardMode as X,CullFaceOptions as ee,VertexAttribute as te,PrimitiveType as re}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as ae}from"../../webgl-engine/lib/Geometry.js";import{generateDefaultIndexArray as oe}from"../../webgl-engine/lib/geometryDataUtils.js";import{Object3D as se}from"../../webgl-engine/lib/Object3D.js";import{Texture as ne}from"../../webgl-engine/lib/Texture.js";import{DefaultMaterial as ie}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as le}from"../../webgl-engine/materials/NativeLineMaterial.js";import{TextureWrapMode as ce}from"../../../webgl/enums.js";const ue=["mesh"];class me extends Y{constructor(e,t,r,a){super(e,t,r,a),this._materials=new Map,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){Q.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new le({color:[1,0,1,1]}),this._debugFaceNormalMaterial=new le({color:[0,1,1,1]}))}destroy(){super.destroy(),this._context.stage.removeMany(Array.from(this._materials.values(),(e=>e.material))),this._context.stage.removeMany(Array.from(this._textures.values())),this._materials.clear(),this._textures.clear()}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,ue,"fill on mesh-3d"))return null;const r=this.setGraphicElevationContext(t,new H),a=e.renderingInfo;return this._createAs3DShape(t,a,r,t.uid)}layerOpacityChanged(e,r){const a=this._getLayerOpacity();return this._materials.forEach((e=>{e.material.setParameters({layerOpacity:a});const t=e.material.parameters;this._setMaterialTransparentParameter(t,e),e.material.setParameters({transparent:t.transparent})})),e.forEach((e=>{const o=r(e);t(o)&&o.layerOpacityChanged(a,this._context.isAsync)})),!0}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,q)}slicePlaneEnabledChanged(e,r){return this._materials.forEach((e=>{e.material.setParameters({slicePlaneEnabled:this._context.slicePlaneEnabled})})),e.forEach((e=>{const a=r(e);t(a)&&a.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)})),!0}physicalBasedRenderingChanged(){const e=this._usePBR();return this._materials.forEach((t=>t.material.setParameters({usePBR:e}))),!0}pixelRatioChanged(){return!0}_requiresSymbolVertexColors(){return this._drivenProperties.color||this._drivenProperties.opacity}_colorOrTextureUid(t){return r(t)?"-":t instanceof e?t.toHex():t.contentHash}_materialPropertiesDefault(e,t){const r=this._requiresSymbolVertexColors(),a=!!e.vertexAttributes.color,o=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:r,hasVertexColors:a,hasVertexTangents:o,uid:`vc:${a},vt:${o},vct${t},svc:${r}`}}_materialProperties(e,t,r){const a=this._materialPropertiesDefault(e,r);if(!t.material)return a;const{color:o,colorTexture:s,normalTexture:n,doubleSided:i,alphaCutoff:l,alphaMode:c}=t.material,u=this._colorOrTextureUid(o),m=this._colorOrTextureUid(s),h=this._colorOrTextureUid(n);if(a.color=o,a.colorTexture=s,a.normalTexture=n,a.uid=`${a.uid},cmuid:${u},ctmuid:${m},ntmuid:${h},ds:${i},ac:${l},am:${c}`,t.material instanceof P){const{metallic:e,roughness:r,metallicRoughnessTexture:o,emissiveColor:s,emissiveTexture:n,occlusionTexture:i}=t.material,l=this._colorOrTextureUid(o),c=this._colorOrTextureUid(s),u=this._colorOrTextureUid(n),m=this._colorOrTextureUid(i);a.metallic=e,a.roughness=r,a.metallicRoughnessTexture=o,a.emissiveColor=s,a.emissiveTexture=n,a.occlusionTexture=i,a.uid=`${a.uid},mrm:${e},mrr:${r},mrt:${l},emuid:${c},etmuid:${u},otmuid:${m}`}return a}_setInternalColorValueParameters(t,r){r.diffuse=e.toUnitRGB(t),r.opacity=t.a}_getLoadableTextureResource(e){return e.data?e.data:e.url}_getInternalTextureId(e){const r=this._getInternalTexture(e,X.Opaque);return t(r)?r.id:null}_getInternalTexture(e,t){const r=this._getLoadableTextureResource(e);if(!r)return null;const a=`${e.contentHash}/${t}`;let o=this._textures.get(a);return o||(o=new ne(r,{mipmap:!0,wrap:this._castTextureWrap(e.wrap),noUnpackFlip:!0,preMultiplyAlpha:t!==X.Opaque}),this._textures.set(a,o),this._context.stage.add(o),this._context.stage.loadImmediate(o)),o}_castTextureWrap(e="repeat"){if("string"==typeof e){const t=this._castTextureWrapIndividual(e);return{s:t,t}}return{s:this._castTextureWrapIndividual(e.horizontal),t:this._castTextureWrapIndividual(e.vertical)}}_castTextureWrapIndividual(e){switch(e){case"clamp":return ce.CLAMP_TO_EDGE;case"mirror":return ce.MIRRORED_REPEAT;default:return ce.REPEAT}}_setInternalMaterialParameters(r,a){if(t(r.color)&&this._setInternalColorValueParameters(r.color,a),t(r.colorTexture)){const e=this._getInternalTexture(r.colorTexture,a.textureAlphaMode);t(e)?(a.textureId=e.id,a.textureAlphaPremultiplied=!!e.params.preMultiplyAlpha):a.textureId=void 0}t(r.normalTexture)&&(a.normalTextureId=this._getInternalTextureId(r.normalTexture)),t(r.emissiveColor)&&(a.emissiveFactor=e.toUnitRGB(r.emissiveColor)),t(r.emissiveTexture)&&(a.emissiveTextureId=this._getInternalTextureId(r.emissiveTexture)),t(r.occlusionTexture)&&(a.occlusionTextureId=this._getInternalTextureId(r.occlusionTexture)),t(r.metallicRoughnessTexture)&&(a.metallicRoughnessTextureId=this._getInternalTextureId(r.metallicRoughnessTexture))}_setExternalMaterialParameters(r){const a=this._drivenProperties.color;let o=t(this.symbolLayer.material)?this.symbolLayer.material.colorMixMode:null;if(a)r.externalColor=T;else{const a=t(this.symbolLayer.material)?this.symbolLayer.material.color:null;t(a)?r.externalColor=e.toUnitRGBA(a):(o=null,r.externalColor=T)}o&&(r.colorMixMode=o),r.castShadows=!!this.symbolLayer.castShadows}_hasTransparentVertexColors(e){const t=e.vertexAttributes.color;if(r(t))return!1;for(let r=3;r<t.length;r+=4)if(255!==t[r])return!0;return!1}_getOrCreateMaterial(e,r){var a,o,s;const n=null==(a=r.material)?void 0:a.color,i=null==(o=r.material)?void 0:o.colorTexture,l=null==(s=r.material)?void 0:s.alphaMode,c="blend"===l,u=!("opaque"===l)&&(this._hasTransparentVertexColors(e)||t(n)&&n.a<1||t(i)&&i.transparent||c),m=this._materialProperties(e,r,u),h=this._materials.get(m.uid);if(h)return h.material;const p={material:null,isComponentTransparent:u,alphaMode:r.material?r.material.alphaMode:"opaque"},f=null==m.metallicRoughnessTexture&&null==m.metallic&&null==m.roughness,d={usePBR:this._usePBR(),isSchematic:f,vertexColors:m.hasVertexColors,symbolColors:m.hasSymbolVertexColors,vertexTangents:m.hasVertexTangents,ambient:y,diffuse:b,opacity:1,doubleSided:!0,doubleSidedType:"winding-order",cullFace:ee.None,layerOpacity:this._getLayerOpacity(),slicePlaneEnabled:this._context.slicePlaneEnabled,initTextureTransparent:!0};f||(d.mrrFactors=[null!=m.metallic?m.metallic:1,null!=m.roughness?m.roughness:1,.5]),r.material&&(d.doubleSided=r.material.doubleSided,d.cullFace=r.material.doubleSided?ee.None:ee.Back,d.textureAlphaCutoff=r.material.alphaCutoff),this._setExternalMaterialParameters(d),this._setMaterialTransparentParameter(d,p),this._setInternalMaterialParameters(m,d);const g=new ie(d);return p.material=g,this._materials.set(m.uid,p),this._context.stage.add(g),g}_usePBR(){return this._context.physicalBasedRenderingEnabled}_setMaterialTransparentParameter(e,t){e.transparent=this.needsDrivenTransparentPass||t.isComponentTransparent||e.layerOpacity<1||e.opacity<1||e.externalColor&&e.externalColor[3]<1,"auto"===t.alphaMode?e.textureAlphaMode=e.transparent?X.MaskBlend:X.Opaque:e.textureAlphaMode="opaque"===t.alphaMode?X.Opaque:"mask"===t.alphaMode?X.Mask:X.Blend}_addDebugNormals(e,t,r,a){const o=t.length,s=e.spatialReference.isGeographic?20015077/180:1,n=.1*Math.max(e.extent.width*s,e.extent.height*s,e.extent.zmax-e.extent.zmin),i=[],l=[],c=[],u=[];for(let m=0;m<o;m++){const e=t[m],r=e.vertexAttributes.get(te.POSITION),a=e.vertexAttributes.get(te.NORMAL),o=e.indices.get(te.POSITION),s=e.indices.get(te.NORMAL),h=r.data,d=a.data;for(let t=0;t<o.length;t++){const e=3*o[t],r=3*s[t];for(let t=0;t<3;t++)i.push(h[e+t]);for(let t=0;t<3;t++)i.push(h[e+t]+d[r+t]*n);if(l.push(l.length),l.push(l.length),t%3==0){this._calculateFaceNormal(h,o,t,ge),this._getFaceVertices(h,o,t,pe,fe,de),p(pe,pe,fe),p(pe,pe,de),f(pe,pe,1/3);for(let e=0;e<3;e++)c.push(pe[e]);for(let e=0;e<3;e++)c.push(pe[e]+ge[e]*n);u.push(u.length),u.push(u.length)}}}const h=new ae([[te.POSITION,{data:i,size:3,exclusive:!0}]],[[te.POSITION,new Uint32Array(l)]],re.Line);t.push(h),r.push(this._debugVertexNormalMaterial),a.push(m(a[0]));const d=new ae([[te.POSITION,{data:c,size:3,exclusive:!0}]],[[te.POSITION,new Uint32Array(u)]],re.Line);t.push(d),r.push(this._debugFaceNormalMaterial),a.push(m(a[0]))}_createAs3DShape(e,r,a,o){const s=e.geometry;if("mesh"!==s.type)return null;const n=this._createGeometryInfo(s,r);if(!n)return null;const{geometries:i,materials:l,transformations:c,objectTransformation:u}=n;Q.DRAW_MESH_GEOMETRY_NORMALS&&this._addDebugNormals(s,i,l,c);const m=new se({geometries:i,materials:l,transformations:c,metadata:{layerUid:this._context.layer.uid,graphicUid:o}});m.transformation=u;const h=this._createEdgeMaterial(),p=t(h)?{baseMaterial:l[0],edgeMaterials:[h],properties:{mergeGeometries:!0,slicePlaneEnabled:this._context.slicePlaneEnabled}}:null,f=new W(this,m,i,null,null,z,a,p);return f.needsElevationUpdates=q(a.mode),f.useObjectOriginAsAttachmentOrigin=!0,f.elevationContext.centerPointInElevationSR=this._getCenterPointInElevationSR(m),f.alignedSampledElevation=z(f,f.elevationContext,this._context.elevationProvider,this._context.renderCoordsHelper),f}_getCenterPointInElevationSR(e){const t=D(0,0,0,this._context.elevationProvider.spatialReference);return C([e.transformation[12],e.transformation[13],e.transformation[14]],this._context.renderCoordsHelper.spatialReference,t),t}_createComponentNormals(e,t,r,a){switch(r.shading||"flat"){case"source":return this._createComponentNormalsSource(e,t,r,a);case"flat":return this._createComponentNormalsFlat(e,a);case"smooth":return this._createComponentNormalsSmooth(e,a);default:return}}_createComponentNormalsSource(e,t,a,o){if(r(t))return this._createComponentNormalsFlat(e,o);let s=!1;if(!a.trustSourceNormals)for(let r=0;r<o.length;r+=3){this._calculateFaceNormal(e,o,r,ge);for(let e=0;e<3;e++){const a=3*o[r+e];pe[0]=t[a+0],pe[1]=t[a+1],pe[2]=t[a+2],d(ge,pe)<0&&(t[a+0]=-t[a+0],t[a+1]=-t[a+1],t[a+2]=-t[a+2],s=!0)}}return{normals:t,indices:o,didFlipNormals:s}}_createComponentNormalsFlat(e,t){const r=new Float32Array(t.length),a=new Uint32Array(3*t.length);for(let o=0;o<t.length;o+=3){const s=this._calculateFaceNormal(e,t,o,ge);for(let e=0;e<3;e++)r[o+e]=s[e],a[o+e]=o/3}return{normals:r,indices:a,didFlipNormals:!1}}_createComponentNormalsSmooth(e,t){const r={};for(let s=0;s<t.length;s+=3){const a=this._calculateFaceNormal(e,t,s,ge);for(let e=0;e<3;e++){const o=t[s+e];let n=r[o];n||(n={normal:v(),count:0},r[o]=n),p(n.normal,n.normal,a),n.count++}}const a=new Float32Array(3*t.length),o=new Uint32Array(3*t.length);for(let s=0;s<t.length;s++){const e=r[t[s]];1!==e.count&&(g(e.normal,e.normal),e.count=1);for(let t=0;t<3;t++)a[3*s+t]=e.normal[t];o[s]=s}return{normals:a,indices:o,didFlipNormals:!1}}_getFaceVertices(e,t,r,a,o,s){const n=3*t[r+0],i=3*t[r+1],l=3*t[r+2];a[0]=e[n+0],a[1]=e[n+1],a[2]=e[n+2],o[0]=e[i+0],o[1]=e[i+1],o[2]=e[i+2],s[0]=e[l+0],s[1]=e[l+1],s[2]=e[l+2]}_calculateFaceNormal(e,t,r,a){return this._getFaceVertices(e,t,r,pe,fe,de),x(fe,fe,pe),x(de,de,pe),_(pe,fe,de),g(a,pe),a}_getOrCreateComponents(e){return a(e.components,be)}_createPositionBuffer(e,r){let a=e.vertexAttributes.position;const o=r.reprojection===ve.ECEF?r.transformBeforeProject:null;if(t(o)&&(a=L(a,new Float64Array(a.length),o)),r.reprojection===ve.NONE)return r.needsBufferCopy?new Float64Array(a):a;const s=t(o)?a:new Float64Array(a.length);return O(a,e.spatialReference,0,s,this._context.renderCoordsHelper.spatialReference,0,a.length/3),s}_createNormalBuffer(e,a,o){let s=e.vertexAttributes.normal;if(r(s))return null;const n=o.reprojection===ve.ECEF?o.transformBeforeProject:null;t(n)&&(s=U(s,new Float32Array(s.length),n));if("local"===this._context.graphicsCoreOwner.view.viewingMode||o.reprojection===ve.NONE)return o.needsBufferCopy&&e.vertexAttributes.normal===s?new Float32Array(s):s;const i=e.vertexAttributes.position,l=t(n)?s:new Float32Array(s.length);return V(s,i,a,e.spatialReference,l)}_createTangentBuffer(e,a,o){let s=e.vertexAttributes.tangent;if(r(s))return null;const n=o.reprojection===ve.ECEF?o.transformBeforeProject:null;t(n)&&(s=G(s,new Float32Array(s.length),n));if("local"===this._context.graphicsCoreOwner.view.viewingMode||o.reprojection===ve.NONE)return o.needsBufferCopy&&e.vertexAttributes.normal===s?new Float32Array(s):s;const i=e.vertexAttributes.position,l=t(n)?s:new Float32Array(s.length);return $(s,i,a,e.spatialReference,l)}_createColorBuffer(e){return e.vertexAttributes.color}_createSymbolColorBuffer(e){if(this._requiresSymbolVertexColors()){const t=this._getVertexOpacityAndColor(e),r=J(o(this.symbolLayer,"material","colorMixMode")),a=new Uint8Array(4);return K(t,r,a),a}return null}_createBuffers(e,r){const a=e.vertexAttributes&&e.vertexAttributes.position;if(!a)return this.logger.warn("Mesh geometry must contain position vertex attributes"),null;const o=e.vertexAttributes.normal,s=e.vertexAttributes.uv,n=e.vertexAttributes.tangent;if(t(o)&&o.length!==a.length)return this.logger.warn("Mesh normal vertex buffer must contain the same number of elements as the position buffer"),null;if(t(n)&&n.length/4!=a.length/3)return this.logger.warn("Mesh tangent vertex buffer must contain the same number of elements as the position buffer"),null;if(t(s)&&s.length/2!=a.length/3)return this.logger.warn("Mesh uv vertex buffer must contain the same number of elements as the position buffer"),null;const i=this._computeReprojectionInfo(e),l=this._createPositionBuffer(e,i),c=this._createColorBuffer(e),u=this._createSymbolColorBuffer(r),m=this._createNormalBuffer(e,l,i),p=this._createTangentBuffer(e,l,i);return{positionBuffer:l,normalBuffer:m,tangentBuffer:p,uvBuffer:s,colorBuffer:c,symbolColorBuffer:u,objectTransformation:i.reprojection===ve.NONE&&t(i.objectTransformation)?i.objectTransformation:this._transformOriginLocal(e,l,m,p),geometryTransformation:i.reprojection===ve.NONE&&t(i.geometryTransformation)?i.geometryTransformation:h()}}_computeReprojectionInfo(e){const r=t(e.transform),a=r&&e.transform.geographic||this._context.renderCoordsHelper.viewingMode===k.Local?ve.NONE:ve.ECEF;if(r){if(a===ve.NONE){const t=h();A(e.spatialReference,e.transform.origin,t,this._context.renderCoordsHelper.spatialReference);return{reprojection:a,objectTransformation:t,geometryTransformation:m(e.transform.localMatrix),needsBufferCopy:!1}}const t=l(h(),e.transform.origin);return c(t,t,e.transform.localMatrix),{reprojection:a,transformBeforeProject:t,needsBufferCopy:!0}}return{reprojection:a,needsBufferCopy:!0}}_transformOriginLocal(e,r,a,o){const i=this._context.renderCoordsHelper.spatialReference,l=e.anchor;he[0]=l.x,he[1]=l.y,he[2]=l.z;const c=h();A(e.spatialReference,he,c,i);const m=I.fromTypedArray(r);if(u(xe,c),F(m,m,xe),t(a)||t(o)){if(s(_e,c),n(_e,_e),t(a)){const e=B.fromTypedArray(a);S(e,e,_e)}if(t(o)){const e=B.fromTypedArray(o,4*o.BYTES_PER_ELEMENT);S(e,e,_e)}}return c}_validateFaces(e,t){const r=e.vertexAttributes.position.length/3,a=t.faces;if(a){let e=-1;for(let t=0;t<a.length;t++){const r=a[t];r>e&&(e=r)}if(r<=e)return this.logger.warn(`Vertex index ${e} is out of bounds of the mesh position buffer`),!1}else if(r%3!=0)return this.logger.warn("Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)"),!1;return!0}_getOrCreateFaces(e,t){return t.faces?t.faces:oe(e.vertexAttributes.position.length/3)}_isOutsideClippingArea(e){if(!this._context.clippingExtent)return!1;const t=e.vertexAttributes&&e.vertexAttributes.position;if(!t)return!1;const r=this._context.elevationProvider.spatialReference;let a;const o=t.length/3;return e.spatialReference.equals(r)?a=t:(a=new Float64Array(t.length),O(e.vertexAttributes.position,e.spatialReference,0,a,r,0,o)),w(ye),N(ye,a,0,o),!j(ye,this._context.clippingExtent)}_createGeometryInfo(e,a){if(!M(e.spatialReference,this._context.graphicsCoreOwner.view.spatialReference))return this.logger.warn("Geometry spatial reference is not compatible with the view"),null;if(this._isOutsideClippingArea(e))return null;const o=this._createBuffers(e,a);if(r(o))return null;const{positionBuffer:s,uvBuffer:n,colorBuffer:i,symbolColorBuffer:l,normalBuffer:c,tangentBuffer:u,objectTransformation:m,geometryTransformation:h}=o,p=this._getOrCreateComponents(e),f=[],d=[],g=[];let x=!1;for(const r of p){if(!this._validateFaces(e,r))return null;const a=this._getOrCreateFaces(e,r);if(0===a.length)continue;const o=this._createComponentNormals(s,c,r,a);o.didFlipNormals&&(x=!0);const m=[[te.POSITION,{size:3,data:s,exclusive:!0}],[te.NORMAL,{size:3,data:o.normals,exclusive:!0}]],p=[[te.POSITION,a],[te.NORMAL,o.indices]];t(i)&&(m.push([te.COLOR,{size:4,data:i,exclusive:!0}]),p.push([te.COLOR,a])),t(l)&&(m.push([te.SYMBOLCOLOR,{size:4,data:l,exclusive:!0}]),p.push([te.SYMBOLCOLOR,new Uint16Array(a.length)])),t(n)&&(m.push([te.UV0,{size:2,data:n,exclusive:!0}]),p.push([te.UV0,a])),t(u)&&(m.push([te.TANGENT,{size:4,data:u,exclusive:!0}]),p.push([te.TANGENT,a]));const _=new ae(m,p);f.push(_),d.push(h),g.push(this._getOrCreateMaterial(e,r))}return x&&this.logger.warn("Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals."),{geometries:f,transformations:d,materials:g,objectTransformation:m}}_createEdgeMaterial(){const e={opacity:this._getLayerOpacity()};return Z(this.symbolLayer,e)}}const he=v(),pe=v(),fe=v(),de=v(),ge=v(),xe=h(),_e=i(),ye=E(),be=[new R];var ve;!function(e){e[e.NONE=0]="NONE",e[e.ECEF=1]="ECEF"}(ve||(ve={}));export{me as Graphics3DMeshFillSymbolLayer,me as default};
|
|
5
|
+
import e from"../../../../Color.js";import"../../../../core/has.js";import{isSome as t,isNone as r,unwrapOr as a,get as o}from"../../../../core/maybe.js";import{f as s,t as n}from"../../../../chunks/mat3.js";import{c as i}from"../../../../chunks/mat3f64.js";import{f as l,m as c,a as u}from"../../../../chunks/mat4.js";import{b as m,c as h}from"../../../../chunks/mat4f64.js";import{b as p,a as f,d,n as g,f as x,c as _}from"../../../../chunks/vec3.js";import{Z as y,O as b,c as v}from"../../../../chunks/vec3f64.js";import{O as T}from"../../../../chunks/vec4f64.js";import{projectVectorToDehydratedPoint as C,projectBuffer as O,computeTranslationToOriginAndRotation as A,canProjectWithoutEngine as M}from"../../../../geometry/projection.js";import{create as w,empty as E,expandWithBuffer as N,intersectsClippingArea as j}from"../../../../geometry/support/aaBoundingBox.js";import R from"../../../../geometry/support/MeshComponent.js";import P from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import{BufferViewVec3f64 as I,BufferViewVec3f as B}from"../../../../geometry/support/buffer/BufferView.js";import{t as F,a as S}from"../../../../chunks/vec32.js";import{transformPosition as L,transformNormal as U,projectNormalToPCPF as V,transformTangent as G,projectTangentToPCPF as $}from"../../../../geometry/support/meshUtils/projection.js";import{makeDehydratedPoint as D}from"../../../../layers/graphics/dehydratedFeatures.js";import{ViewingMode as k}from"../../../ViewingMode.js";import{perObjectElevationAligner as z}from"./ElevationAligners.js";import{needsElevationUpdates3D as q}from"./elevationAlignmentUtils.js";import{ElevationContext as H}from"./ElevationContext.js";import{Graphics3DObject3DGraphicLayer as W}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as Y}from"./Graphics3DSymbolLayer.js";import{createMaterial as Z}from"../support/edgeUtils.js";import{parseColorMixMode as J,encodeSymbolColor as K}from"../support/symbolColorUtils.js";import Q from"../../support/debugFlags.js";import{AlphaDiscardMode as X,CullFaceOptions as ee,PrimitiveType as te}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as re}from"../../webgl-engine/lib/Geometry.js";import{generateDefaultIndexArray as ae}from"../../webgl-engine/lib/geometryDataUtils.js";import{Object3D as oe}from"../../webgl-engine/lib/Object3D.js";import{Texture as se}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as ne}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as ie}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as le}from"../../webgl-engine/materials/NativeLineMaterial.js";import{TextureWrapMode as ce}from"../../../webgl/enums.js";const ue=["mesh"];class me extends Y{constructor(e,t,r,a){super(e,t,r,a),this._materials=new Map,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){Q.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new le({color:[1,0,1,1]}),this._debugFaceNormalMaterial=new le({color:[0,1,1,1]}))}destroy(){super.destroy(),this._context.stage.removeMany(Array.from(this._materials.values(),(e=>e.material))),this._context.stage.removeMany(Array.from(this._textures.values())),this._materials.clear(),this._textures.clear()}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,ue,"fill on mesh-3d"))return null;const r=this.setGraphicElevationContext(t,new H),a=e.renderingInfo;return this._createAs3DShape(t,a,r,t.uid)}layerOpacityChanged(e,r){const a=this._getLayerOpacity();return this._materials.forEach((e=>{e.material.setParameters({layerOpacity:a});const t=e.material.parameters;this._setMaterialTransparentParameter(t,e),e.material.setParameters({transparent:t.transparent})})),e.forEach((e=>{const o=r(e);t(o)&&o.layerOpacityChanged(a,this._context.isAsync)})),!0}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,q)}slicePlaneEnabledChanged(e,r){return this._materials.forEach((e=>{e.material.setParameters({slicePlaneEnabled:this._context.slicePlaneEnabled})})),e.forEach((e=>{const a=r(e);t(a)&&a.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)})),!0}physicalBasedRenderingChanged(){const e=this._usePBR();return this._materials.forEach((t=>t.material.setParameters({usePBR:e}))),!0}pixelRatioChanged(){return!0}_requiresSymbolVertexColors(){return this._drivenProperties.color||this._drivenProperties.opacity}_colorOrTextureUid(t){return r(t)?"-":t instanceof e?t.toHex():t.contentHash}_materialPropertiesDefault(e,t){const r=this._requiresSymbolVertexColors(),a=!!e.vertexAttributes.color,o=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:r,hasVertexColors:a,hasVertexTangents:o,uid:`vc:${a},vt:${o},vct${t},svc:${r}`}}_materialProperties(e,t,r){const a=this._materialPropertiesDefault(e,r);if(!t.material)return a;const{color:o,colorTexture:s,normalTexture:n,doubleSided:i,alphaCutoff:l,alphaMode:c}=t.material,u=this._colorOrTextureUid(o),m=this._colorOrTextureUid(s),h=this._colorOrTextureUid(n);if(a.color=o,a.colorTexture=s,a.normalTexture=n,a.uid=`${a.uid},cmuid:${u},ctmuid:${m},ntmuid:${h},ds:${i},ac:${l},am:${c}`,t.material instanceof P){const{metallic:e,roughness:r,metallicRoughnessTexture:o,emissiveColor:s,emissiveTexture:n,occlusionTexture:i}=t.material,l=this._colorOrTextureUid(o),c=this._colorOrTextureUid(s),u=this._colorOrTextureUid(n),m=this._colorOrTextureUid(i);a.metallic=e,a.roughness=r,a.metallicRoughnessTexture=o,a.emissiveColor=s,a.emissiveTexture=n,a.occlusionTexture=i,a.uid=`${a.uid},mrm:${e},mrr:${r},mrt:${l},emuid:${c},etmuid:${u},otmuid:${m}`}return a}_setInternalColorValueParameters(t,r){r.diffuse=e.toUnitRGB(t),r.opacity=t.a}_getLoadableTextureResource(e){return e.data?e.data:e.url}_getInternalTextureId(e){const r=this._getInternalTexture(e,X.Opaque);return t(r)?r.id:null}_getInternalTexture(e,t){const r=this._getLoadableTextureResource(e);if(!r)return null;const a=`${e.contentHash}/${t}`;let o=this._textures.get(a);return o||(o=new se(r,{mipmap:!0,wrap:this._castTextureWrap(e.wrap),noUnpackFlip:!0,preMultiplyAlpha:t!==X.Opaque}),this._textures.set(a,o),this._context.stage.add(o),this._context.stage.loadImmediate(o)),o}_castTextureWrap(e="repeat"){if("string"==typeof e){const t=this._castTextureWrapIndividual(e);return{s:t,t}}return{s:this._castTextureWrapIndividual(e.horizontal),t:this._castTextureWrapIndividual(e.vertical)}}_castTextureWrapIndividual(e){switch(e){case"clamp":return ce.CLAMP_TO_EDGE;case"mirror":return ce.MIRRORED_REPEAT;default:return ce.REPEAT}}_setInternalMaterialParameters(r,a){if(t(r.color)&&this._setInternalColorValueParameters(r.color,a),t(r.colorTexture)){const e=this._getInternalTexture(r.colorTexture,a.textureAlphaMode);t(e)?(a.textureId=e.id,a.textureAlphaPremultiplied=!!e.params.preMultiplyAlpha):a.textureId=void 0}t(r.normalTexture)&&(a.normalTextureId=this._getInternalTextureId(r.normalTexture)),t(r.emissiveColor)&&(a.emissiveFactor=e.toUnitRGB(r.emissiveColor)),t(r.emissiveTexture)&&(a.emissiveTextureId=this._getInternalTextureId(r.emissiveTexture)),t(r.occlusionTexture)&&(a.occlusionTextureId=this._getInternalTextureId(r.occlusionTexture)),t(r.metallicRoughnessTexture)&&(a.metallicRoughnessTextureId=this._getInternalTextureId(r.metallicRoughnessTexture))}_setExternalMaterialParameters(r){const a=this._drivenProperties.color;let o=t(this.symbolLayer.material)?this.symbolLayer.material.colorMixMode:null;if(a)r.externalColor=T;else{const a=t(this.symbolLayer.material)?this.symbolLayer.material.color:null;t(a)?r.externalColor=e.toUnitRGBA(a):(o=null,r.externalColor=T)}o&&(r.colorMixMode=o),r.castShadows=!!this.symbolLayer.castShadows}_hasTransparentVertexColors(e){const t=e.vertexAttributes.color;if(r(t))return!1;for(let r=3;r<t.length;r+=4)if(255!==t[r])return!0;return!1}_getOrCreateMaterial(e,r){var a,o,s;const n=null==(a=r.material)?void 0:a.color,i=null==(o=r.material)?void 0:o.colorTexture,l=null==(s=r.material)?void 0:s.alphaMode,c="blend"===l,u=!("opaque"===l)&&(this._hasTransparentVertexColors(e)||t(n)&&n.a<1||t(i)&&i.transparent||c),m=this._materialProperties(e,r,u),h=this._materials.get(m.uid);if(h)return h.material;const p={material:null,isComponentTransparent:u,alphaMode:r.material?r.material.alphaMode:"opaque"},f=null==m.metallicRoughnessTexture&&null==m.metallic&&null==m.roughness,d={usePBR:this._usePBR(),isSchematic:f,vertexColors:m.hasVertexColors,symbolColors:m.hasSymbolVertexColors,vertexTangents:m.hasVertexTangents,ambient:y,diffuse:b,opacity:1,doubleSided:!0,doubleSidedType:"winding-order",cullFace:ee.None,layerOpacity:this._getLayerOpacity(),slicePlaneEnabled:this._context.slicePlaneEnabled,initTextureTransparent:!0};f||(d.mrrFactors=[null!=m.metallic?m.metallic:1,null!=m.roughness?m.roughness:1,.5]),r.material&&(d.doubleSided=r.material.doubleSided,d.cullFace=r.material.doubleSided?ee.None:ee.Back,d.textureAlphaCutoff=r.material.alphaCutoff),this._setExternalMaterialParameters(d),this._setMaterialTransparentParameter(d,p),this._setInternalMaterialParameters(m,d);const g=new ie(d);return p.material=g,this._materials.set(m.uid,p),this._context.stage.add(g),g}_usePBR(){return this._context.physicalBasedRenderingEnabled}_setMaterialTransparentParameter(e,t){e.transparent=this.needsDrivenTransparentPass||t.isComponentTransparent||e.layerOpacity<1||e.opacity<1||e.externalColor&&e.externalColor[3]<1,"auto"===t.alphaMode?e.textureAlphaMode=e.transparent?X.MaskBlend:X.Opaque:e.textureAlphaMode="opaque"===t.alphaMode?X.Opaque:"mask"===t.alphaMode?X.Mask:X.Blend}_addDebugNormals(e,t,r,a){const o=t.length,s=e.spatialReference.isGeographic?20015077/180:1,n=.1*Math.max(e.extent.width*s,e.extent.height*s,e.extent.zmax-e.extent.zmin),i=[],l=[],c=[],u=[];for(let m=0;m<o;m++){const e=t[m],r=e.vertexAttributes.get(ne.POSITION),a=e.vertexAttributes.get(ne.NORMAL),o=e.indices.get(ne.POSITION),s=e.indices.get(ne.NORMAL),h=r.data,d=a.data;for(let t=0;t<o.length;t++){const e=3*o[t],r=3*s[t];for(let t=0;t<3;t++)i.push(h[e+t]);for(let t=0;t<3;t++)i.push(h[e+t]+d[r+t]*n);if(l.push(l.length),l.push(l.length),t%3==0){this._calculateFaceNormal(h,o,t,ge),this._getFaceVertices(h,o,t,pe,fe,de),p(pe,pe,fe),p(pe,pe,de),f(pe,pe,1/3);for(let e=0;e<3;e++)c.push(pe[e]);for(let e=0;e<3;e++)c.push(pe[e]+ge[e]*n);u.push(u.length),u.push(u.length)}}}const h=new re([[ne.POSITION,{data:i,size:3,exclusive:!0}]],[[ne.POSITION,new Uint32Array(l)]],te.Line);t.push(h),r.push(this._debugVertexNormalMaterial),a.push(m(a[0]));const d=new re([[ne.POSITION,{data:c,size:3,exclusive:!0}]],[[ne.POSITION,new Uint32Array(u)]],te.Line);t.push(d),r.push(this._debugFaceNormalMaterial),a.push(m(a[0]))}_createAs3DShape(e,r,a,o){const s=e.geometry;if("mesh"!==s.type)return null;const n=this._createGeometryInfo(s,r);if(!n)return null;const{geometries:i,materials:l,transformations:c,objectTransformation:u}=n;Q.DRAW_MESH_GEOMETRY_NORMALS&&this._addDebugNormals(s,i,l,c);const m=new oe({geometries:i,materials:l,transformations:c,metadata:{layerUid:this._context.layer.uid,graphicUid:o}});m.transformation=u;const h=this._createEdgeMaterial(),p=t(h)?{baseMaterial:l[0],edgeMaterials:[h],properties:{mergeGeometries:!0,slicePlaneEnabled:this._context.slicePlaneEnabled}}:null,f=new W(this,m,i,null,null,z,a,p);return f.needsElevationUpdates=q(a.mode),f.useObjectOriginAsAttachmentOrigin=!0,f.elevationContext.centerPointInElevationSR=this._getCenterPointInElevationSR(m),f.alignedSampledElevation=z(f,f.elevationContext,this._context.elevationProvider,this._context.renderCoordsHelper),f}_getCenterPointInElevationSR(e){const t=D(0,0,0,this._context.elevationProvider.spatialReference);return C([e.transformation[12],e.transformation[13],e.transformation[14]],this._context.renderCoordsHelper.spatialReference,t),t}_createComponentNormals(e,t,r,a){switch(r.shading||"flat"){case"source":return this._createComponentNormalsSource(e,t,r,a);case"flat":return this._createComponentNormalsFlat(e,a);case"smooth":return this._createComponentNormalsSmooth(e,a);default:return}}_createComponentNormalsSource(e,t,a,o){if(r(t))return this._createComponentNormalsFlat(e,o);let s=!1;if(!a.trustSourceNormals)for(let r=0;r<o.length;r+=3){this._calculateFaceNormal(e,o,r,ge);for(let e=0;e<3;e++){const a=3*o[r+e];pe[0]=t[a+0],pe[1]=t[a+1],pe[2]=t[a+2],d(ge,pe)<0&&(t[a+0]=-t[a+0],t[a+1]=-t[a+1],t[a+2]=-t[a+2],s=!0)}}return{normals:t,indices:o,didFlipNormals:s}}_createComponentNormalsFlat(e,t){const r=new Float32Array(t.length),a=new Uint32Array(3*t.length);for(let o=0;o<t.length;o+=3){const s=this._calculateFaceNormal(e,t,o,ge);for(let e=0;e<3;e++)r[o+e]=s[e],a[o+e]=o/3}return{normals:r,indices:a,didFlipNormals:!1}}_createComponentNormalsSmooth(e,t){const r={};for(let s=0;s<t.length;s+=3){const a=this._calculateFaceNormal(e,t,s,ge);for(let e=0;e<3;e++){const o=t[s+e];let n=r[o];n||(n={normal:v(),count:0},r[o]=n),p(n.normal,n.normal,a),n.count++}}const a=new Float32Array(3*t.length),o=new Uint32Array(3*t.length);for(let s=0;s<t.length;s++){const e=r[t[s]];1!==e.count&&(g(e.normal,e.normal),e.count=1);for(let t=0;t<3;t++)a[3*s+t]=e.normal[t];o[s]=s}return{normals:a,indices:o,didFlipNormals:!1}}_getFaceVertices(e,t,r,a,o,s){const n=3*t[r+0],i=3*t[r+1],l=3*t[r+2];a[0]=e[n+0],a[1]=e[n+1],a[2]=e[n+2],o[0]=e[i+0],o[1]=e[i+1],o[2]=e[i+2],s[0]=e[l+0],s[1]=e[l+1],s[2]=e[l+2]}_calculateFaceNormal(e,t,r,a){return this._getFaceVertices(e,t,r,pe,fe,de),x(fe,fe,pe),x(de,de,pe),_(pe,fe,de),g(a,pe),a}_getOrCreateComponents(e){return a(e.components,be)}_createPositionBuffer(e,r){let a=e.vertexAttributes.position;const o=r.reprojection===ve.ECEF?r.transformBeforeProject:null;if(t(o)&&(a=L(a,new Float64Array(a.length),o)),r.reprojection===ve.NONE)return r.needsBufferCopy?new Float64Array(a):a;const s=t(o)?a:new Float64Array(a.length);return O(a,e.spatialReference,0,s,this._context.renderCoordsHelper.spatialReference,0,a.length/3),s}_createNormalBuffer(e,a,o){let s=e.vertexAttributes.normal;if(r(s))return null;const n=o.reprojection===ve.ECEF?o.transformBeforeProject:null;t(n)&&(s=U(s,new Float32Array(s.length),n));if("local"===this._context.graphicsCoreOwner.view.viewingMode||o.reprojection===ve.NONE)return o.needsBufferCopy&&e.vertexAttributes.normal===s?new Float32Array(s):s;const i=e.vertexAttributes.position,l=t(n)?s:new Float32Array(s.length);return V(s,i,a,e.spatialReference,l)}_createTangentBuffer(e,a,o){let s=e.vertexAttributes.tangent;if(r(s))return null;const n=o.reprojection===ve.ECEF?o.transformBeforeProject:null;t(n)&&(s=G(s,new Float32Array(s.length),n));if("local"===this._context.graphicsCoreOwner.view.viewingMode||o.reprojection===ve.NONE)return o.needsBufferCopy&&e.vertexAttributes.normal===s?new Float32Array(s):s;const i=e.vertexAttributes.position,l=t(n)?s:new Float32Array(s.length);return $(s,i,a,e.spatialReference,l)}_createColorBuffer(e){return e.vertexAttributes.color}_createSymbolColorBuffer(e){if(this._requiresSymbolVertexColors()){const t=this._getVertexOpacityAndColor(e),r=J(o(this.symbolLayer,"material","colorMixMode")),a=new Uint8Array(4);return K(t,r,a),a}return null}_createBuffers(e,r){const a=e.vertexAttributes&&e.vertexAttributes.position;if(!a)return this.logger.warn("Mesh geometry must contain position vertex attributes"),null;const o=e.vertexAttributes.normal,s=e.vertexAttributes.uv,n=e.vertexAttributes.tangent;if(t(o)&&o.length!==a.length)return this.logger.warn("Mesh normal vertex buffer must contain the same number of elements as the position buffer"),null;if(t(n)&&n.length/4!=a.length/3)return this.logger.warn("Mesh tangent vertex buffer must contain the same number of elements as the position buffer"),null;if(t(s)&&s.length/2!=a.length/3)return this.logger.warn("Mesh uv vertex buffer must contain the same number of elements as the position buffer"),null;const i=this._computeReprojectionInfo(e),l=this._createPositionBuffer(e,i),c=this._createColorBuffer(e),u=this._createSymbolColorBuffer(r),m=this._createNormalBuffer(e,l,i),p=this._createTangentBuffer(e,l,i);return{positionBuffer:l,normalBuffer:m,tangentBuffer:p,uvBuffer:s,colorBuffer:c,symbolColorBuffer:u,objectTransformation:i.reprojection===ve.NONE&&t(i.objectTransformation)?i.objectTransformation:this._transformOriginLocal(e,l,m,p),geometryTransformation:i.reprojection===ve.NONE&&t(i.geometryTransformation)?i.geometryTransformation:h()}}_computeReprojectionInfo(e){const r=t(e.transform),a=r&&e.transform.geographic||this._context.renderCoordsHelper.viewingMode===k.Local?ve.NONE:ve.ECEF;if(r){if(a===ve.NONE){const t=h();A(e.spatialReference,e.transform.origin,t,this._context.renderCoordsHelper.spatialReference);return{reprojection:a,objectTransformation:t,geometryTransformation:m(e.transform.localMatrix),needsBufferCopy:!1}}const t=l(h(),e.transform.origin);return c(t,t,e.transform.localMatrix),{reprojection:a,transformBeforeProject:t,needsBufferCopy:!0}}return{reprojection:a,needsBufferCopy:!0}}_transformOriginLocal(e,r,a,o){const i=this._context.renderCoordsHelper.spatialReference,l=e.anchor;he[0]=l.x,he[1]=l.y,he[2]=l.z;const c=h();A(e.spatialReference,he,c,i);const m=I.fromTypedArray(r);if(u(xe,c),F(m,m,xe),t(a)||t(o)){if(s(_e,c),n(_e,_e),t(a)){const e=B.fromTypedArray(a);S(e,e,_e)}if(t(o)){const e=B.fromTypedArray(o,4*o.BYTES_PER_ELEMENT);S(e,e,_e)}}return c}_validateFaces(e,t){const r=e.vertexAttributes.position.length/3,a=t.faces;if(a){let e=-1;for(let t=0;t<a.length;t++){const r=a[t];r>e&&(e=r)}if(r<=e)return this.logger.warn(`Vertex index ${e} is out of bounds of the mesh position buffer`),!1}else if(r%3!=0)return this.logger.warn("Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)"),!1;return!0}_getOrCreateFaces(e,t){return t.faces?t.faces:ae(e.vertexAttributes.position.length/3)}_isOutsideClippingArea(e){if(!this._context.clippingExtent)return!1;const t=e.vertexAttributes&&e.vertexAttributes.position;if(!t)return!1;const r=this._context.elevationProvider.spatialReference;let a;const o=t.length/3;return e.spatialReference.equals(r)?a=t:(a=new Float64Array(t.length),O(e.vertexAttributes.position,e.spatialReference,0,a,r,0,o)),E(ye),N(ye,a,0,o),!j(ye,this._context.clippingExtent)}_createGeometryInfo(e,a){if(!M(e.spatialReference,this._context.graphicsCoreOwner.view.spatialReference))return this.logger.warn("Geometry spatial reference is not compatible with the view"),null;if(this._isOutsideClippingArea(e))return null;const o=this._createBuffers(e,a);if(r(o))return null;const{positionBuffer:s,uvBuffer:n,colorBuffer:i,symbolColorBuffer:l,normalBuffer:c,tangentBuffer:u,objectTransformation:m,geometryTransformation:h}=o,p=this._getOrCreateComponents(e),f=[],d=[],g=[];let x=!1;for(const r of p){if(!this._validateFaces(e,r))return null;const a=this._getOrCreateFaces(e,r);if(0===a.length)continue;const o=this._createComponentNormals(s,c,r,a);o.didFlipNormals&&(x=!0);const m=[[ne.POSITION,{size:3,data:s,exclusive:!0}],[ne.NORMAL,{size:3,data:o.normals,exclusive:!0}]],p=[[ne.POSITION,a],[ne.NORMAL,o.indices]];t(i)&&(m.push([ne.COLOR,{size:4,data:i,exclusive:!0}]),p.push([ne.COLOR,a])),t(l)&&(m.push([ne.SYMBOLCOLOR,{size:4,data:l,exclusive:!0}]),p.push([ne.SYMBOLCOLOR,new Uint16Array(a.length)])),t(n)&&(m.push([ne.UV0,{size:2,data:n,exclusive:!0}]),p.push([ne.UV0,a])),t(u)&&(m.push([ne.TANGENT,{size:4,data:u,exclusive:!0}]),p.push([ne.TANGENT,a]));const _=new re(m,p);f.push(_),d.push(h),g.push(this._getOrCreateMaterial(e,r))}return x&&this.logger.warn("Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals."),{geometries:f,transformations:d,materials:g,objectTransformation:m}}_createEdgeMaterial(){const e={opacity:this._getLayerOpacity()};return Z(this.symbolLayer,e)}}const he=v(),pe=v(),fe=v(),de=v(),ge=v(),xe=h(),_e=i(),ye=w(),be=[new R];var ve;!function(e){e[e.NONE=0]="NONE",e[e.ECEF=1]="ECEF"}(ve||(ve={}));export{me as Graphics3DMeshFillSymbolLayer,me 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 e from"../../../../Color.js";import{isSome as t,get as s,none as r,isNone as i,unwrapOr as a}from"../../../../core/maybe.js";import{pt2px as o}from"../../../../core/screenUtils.js";import{c as n,i as l,h as c,j as h}from"../../../../chunks/mat4.js";import{c as d}from"../../../../chunks/mat4f64.js";import{l as m,o as p,g as u,D as y,b as f,s as _}from"../../../../chunks/vec3.js";import{d as b,O as g,Z as P,f as v,c as x}from"../../../../chunks/vec3f64.js";import{O as R,c as L}from"../../../../chunks/vec4f64.js";import{projectPointToVector as S,computeTranslationToOriginAndRotation as C}from"../../../../geometry/projection.js";import{create as E,size as U,containsPoint as w,center as j}from"../../../../geometry/support/aaBoundingBox.js";import{defaultPrimitive as B}from"../../../../symbols/support/ObjectSymbol3DLayerResource.js";import{objectSymbolLayerPrimitiveBoundingBox as T,objectSymbolLayerSizeWithResourceSize as G}from"../../../../symbols/support/symbolLayerUtils3D.js";import{perLodInstanceElevationAligner as O}from"./ElevationAligners.js";import{needsElevationUpdates3D as I,evaluateElevationInfoAtPoint as z,SampleElevationInfo as D}from"./elevationAlignmentUtils.js";import{ElevationContext as M}from"./ElevationContext.js";import A from"./Graphics3DLodInstanceGraphicLayer.js";import{Graphics3DSymbolLayer as F}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as V,mixinColorAndOpacity as k,computeObjectScale as W,computeObjectRotation as q}from"./graphicUtils.js";import{ApplyRendererDiffResult as H}from"./interfaces.js";import{LoadStatus as N}from"./Loadable.js";import{makeLodResources as $,fillEstimatedMinScreenSpaceRadius as Z}from"./lodResourceUtils.js";import{fetch as J}from"./objectResourceUtils.js";import{placePointOnGeometry as K,extendPointGraphicElevationContext as Q}from"./pointUtils.js";import{isValidPrimitive as X,primitiveLodResources as Y}from"./primitiveObjectSymbolUtils.js";import{defaultSymbolLayerMemoryComplexity as ee}from"./symbolComplexity.js";import{initFastSymbolUpdatesState as te,updateFastSymbolUpdatesState as se,evaluateModelTransform as re,evaluateModelTransformScale as ie}from"../support/FastSymbolUpdates.js";import{CullFaceOptions as ae,VertexAttribute as oe}from"../../webgl-engine/lib/basicInterfaces.js";import{LodRenderer as ne}from"../../webgl-engine/lib/lodRendering/LodRenderer.js";import{materialsFromLodResources as le,texturesFromLodResources as ce,geometriesFromLodResources as he,geometriesFromLodLevelResources as de}from"../../webgl-engine/lib/lodRendering/LodResources.js";import{DefaultMaterial as me}from"../../webgl-engine/materials/DefaultMaterial.js";class pe extends F{constructor(e,t,s,r){super(e,t,s,r),this._resources=null,this._optionalFields=new Array,this._instanceIndexToGraphicUid=new Map,this.hasLoadedPBRTextures=!1,this.ensureDrapedStatus(!1),this.hasLoadedPBRTextures=s.physicalBasedRenderingEnabled}getCachedSize(){const[e,s,r]=t(this._resources)?this._resources.symbolSize:[1,1,1];return{width:e,depth:s,height:r}}async doLoad(e){if(!this._drivenProperties.size){if(V(this.symbolLayer))throw new Error}const t=this.symbolLayer;if(this.isPrimitive){const s=t.resource?t.resource.primitive:B;this._resources=await this._createResourcesForPrimitive(s,e)}else this._resources=await this._createResourcesForUrl(t.resource.href,e);this.layerOpacityChanged(),this.slicePlaneEnabledChanged(),this.physicalBasedRenderingChanged(),this.complexity=this.computeComplexity()}get extentPadding(){return t(this._resources)?this._resources.extentPadding:0}get isPrimitive(){return!(this.symbolLayer.resource&&this.symbolLayer.resource.href)}get lodRenderer(){return s(this._resources,"lodRenderer")}_setMaterialTransparencyParams(e,t=s(this.symbolLayer,"material","color")){const r=this._getCombinedOpacity(t),i=r<1||this.needsDrivenTransparentPass;return e.transparent=i,e.opacity=r,e.cullFace=i?ae.None:ae.Back,e}async _createResourcesForPrimitive(s,i){if(!X(s))throw new Error(`Unknown object symbol primitive: ${s}`);const a=this.symbolLayer,n=E(T(s)),l=b(U(n)),c=b(G(l,a)),h=m(c),d=!1,p=!1,u={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,instanced:["transformation"],ambient:g,diffuse:g,slicePlaneEnabled:this._context.slicePlaneEnabled,sliceHighlightDisabled:!0,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!this.symbolLayer.isPrimitive},y=u.usePBR;this._setMaterialTransparencyParams(u);const f=this.symbol;if("point-3d"===f.type&&f.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:s}=f.verticalOffset;u.verticalOffset={screenLength:o(e),minWorldLength:t||0,maxWorldLength:null!=s?s:1/0},u.castShadows=!1}if(this._context.screenSizePerspectiveEnabled&&(u.screenSizePerspective=this._context.sharedResources.screenSizePerspectiveSettings),this._drivenProperties.color)u.externalColor=R;else{const s=t(a.material)&&a.material.color,r=t(s)?e.toUnitRGBA(s):R;u.externalColor=r}this._fastUpdates=te(this._context.renderer,this._fastVisualVariableConvertOptions(n,c,l,r)),this._fastUpdates.enabled?(Object.assign(u,this._fastUpdates.materialParameters),u.instanced.push("featureAttribute"),this._optionalFields.push("featureAttribute")):this._hasPerInstanceColor()&&(u.instanced.push("color"),this._optionalFields.push("color"));const _=new me(u),P=Y(s,_);if(!P)throw new Error(`Unknown object symbol primitive: ${s}`);const v=le(P).map((e=>({opacity:1,transparent:e.parameters.transparent}))),x=await this._createStageResources(P,y);return{lodResources:P,lodRenderer:await this._createLodRenderer(P,i),stageResources:x,symbolSize:c,extentPadding:h,isEsriSymbolResource:d,isWosr:p,originalMaterialParameters:v,physicalBasedRenderingEnabled:y,resourceBoundingBox:n,resourceSize:l,dispose:r,pivotOffset:r}}async _createResourcesForUrl(e,t){const i=["transformation"],a={materialParamsMixin:{instanced:i,slicePlaneEnabled:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows},streamDataRequester:this._context.streamDataRequester,cache:this._context.sharedResources.objectResourceCache};this._fastUpdates=te(this._context.renderer,this._fastVisualVariableConvertOptions(r,r,r,r)),this._fastUpdates.enabled?(Object.assign(a.materialParamsMixin,this._fastUpdates.materialParameters),i.push("featureAttribute"),this._optionalFields.push("featureAttribute")):this._hasPerInstanceColor()&&(i.push("color"),this._optionalFields.push("color"));const n=this.symbol;if("point-3d"===n.type&&n.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:s}=n.verticalOffset;a.materialParamsMixin.verticalOffset={screenLength:o(e),minWorldLength:t||0,maxWorldLength:null!=s?s:1/0},a.materialParamsMixin.castShadows=!1}a.signal=t,a.usePBR=this._context.physicalBasedRenderingEnabled;const l=a.usePBR,c=await J(e,a),h=c.isEsriSymbolResource,d=c.isWosr,p=c.remove,u=$(c.lods);Z(u),u.levels.sort(((e,t)=>e.minScreenSpaceRadius-t.minScreenSpaceRadius)),u.levels[0].minScreenSpaceRadius=Math.min(2,u.levels[0].minScreenSpaceRadius);const y=this._context,f=this.symbolLayer.material,_=this._getExternalColorParameters(f),g=s(this.symbolLayer,"material","color"),P=this._getCombinedOpacity(g,{hasIntrinsicColor:!0}),v=this.needsDrivenTransparentPass,x=le(u),R=le(u).map((e=>({opacity:e.parameters.opacity||1,transparent:e.parameters.transparent})));x.forEach((e=>{const t=e.parameters;e.setParameters(_);const s=t.opacity*P,r=s<1||v||t.transparent;e.setParameters({opacity:s,transparent:r}),y.screenSizePerspectiveEnabled&&e.setParameters({screenSizePerspective:y.sharedResources.screenSizePerspectiveSettings})}));const L=c.referenceBoundingBox,S=b(U(L)),C=b(u.levels[0].pivotOffset),E=b(G(S,this.symbolLayer)),w=m(E);se(this._fastUpdates,this._context.renderer,this._fastVisualVariableConvertOptions(L,E,S,C))&&x.forEach((e=>e.setParameters(this._fastUpdates.materialParameters)));const j=await this._createStageResources(u,l);return{lodResources:u,lodRenderer:await this._createLodRenderer(u,t),stageResources:j,symbolSize:E,extentPadding:w,isEsriSymbolResource:h,isWosr:d,originalMaterialParameters:R,physicalBasedRenderingEnabled:l,resourceBoundingBox:L,resourceSize:S,dispose:p,pivotOffset:C}}async _createStageResources(e,t){const s=this._context.stage,r=le(e);t!==this._context.physicalBasedRenderingEnabled&&this.physicalBasedRenderingChanged(),s.addMany(r);const i=ce(e);s.addMany(i),await s.load(i);const a=he(e);return s.addMany(a),{materials:r,textures:i,geometries:a}}async _createLodRenderer(e,t){const s=this._context.stage,r={layerUid:this._context.layer.uid,graphicUid:e=>this._instanceIndexToGraphicUid.get(e),notifyGraphicGeometryChanged:e=>this._context.notifyGraphicGeometryChanged(this._instanceIndexToGraphicUid.get(e)),notifyGraphicVisibilityChanged:e=>this._context.notifyGraphicVisibilityChanged(this._instanceIndexToGraphicUid.get(e))},i=this._fastUpdates.enabled?{applyTransform:(e,t,s)=>{e.getFeatureAttribute(t,_e),n(s,re(this._fastUpdates.materialParameters,_e,s))},scaleFactor:(e,t,s)=>(t.getFeatureAttribute(s,_e),ie(e,this._fastUpdates.materialParameters,_e))}:null,a=new ne(e,this._optionalFields,r,i);return a.slicePlaneEnabled=this._context.slicePlaneEnabled,await s.addRenderPlugin(a.slots,a,t),a}_getExternalColorParameters(s){const r={};return this._drivenProperties.color?r.externalColor=R:t(s)&&t(s.color)?r.externalColor=e.toUnitRGBA(s.color):(r.externalColor=R,r.colorMixMode="ignore"),r}destroy(){if(super.destroy(),t(this._resources)){const e=this._context.stage;e.removeRenderPlugin(this._resources.lodRenderer);const s=this._resources.stageResources;e.removeMany(s.materials),e.removeMany(s.textures),e.removeMany(s.geometries),t(this._resources.dispose)&&this._resources.dispose(),this._resources=null}}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;const s=K(t.geometry);if(i(s))return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;const r=this.setGraphicElevationContext(t,new M),a=e.renderingInfo;return this._createAs3DShape(t,s,a,r,t.uid)}notifyDestroyGraphicLayer(e){this._instanceIndexToGraphicUid.delete(e.instanceIndex)}graphicLayerToGraphicId(){return 0}layerOpacityChanged(){if(i(this._resources))return!0;const e=this._drivenProperties.opacity,t=!this.isPrimitive,r=this._resources.stageResources.materials,a=this._resources.originalMaterialParameters;for(let i=0;i<r.length;i++){const o=r[i],n=s(this.symbolLayer,"material","color"),l=a[i],c=this._getCombinedOpacity(n,{hasIntrinsicColor:t})*l.opacity,h=c<1||e||l.transparent;o.setParameters({opacity:c,transparent:h}),this.isPrimitive&&o.setParameters({cullFace:h?ae.None:ae.Back})}return!0}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,I)}slicePlaneEnabledChanged(){if(i(this._resources))return!0;this._resources.lodRenderer.slicePlaneEnabled=this._context.slicePlaneEnabled;for(const e of this._resources.stageResources.materials)e.setParameters({slicePlaneEnabled:this._context.slicePlaneEnabled});return!0}physicalBasedRenderingChanged(){if(i(this._resources))return!0;const{stageResources:e,isWosr:t}=this._resources;for(const s of e.materials)this.isPrimitive?s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}):t||s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!1});return!1!==this.hasLoadedPBRTextures||!0!==this._context.physicalBasedRenderingEnabled||(this.hasLoadedPBRTextures=!0,!1)}pixelRatioChanged(){return!0}applyRendererDiff(e,t){if(i(this._resources))return H.Recreate_Symbol;const{stageResources:{materials:s},lodRenderer:r,resourceBoundingBox:a,symbolSize:o,resourceSize:n,pivotOffset:l}=this._resources;for(const i in e.diff){if("visualVariables"!==i)return H.Recreate_Symbol;if(!se(this._fastUpdates,t,this._fastVisualVariableConvertOptions(a,o,n,l)))return H.Recreate_Symbol;for(const e of s)e.setParameters(this._fastUpdates.materialParameters);r.notifyShaderTransformationChanged()}return H.Fast_Update}computeComplexity(){if(i(this._resources))return super.computeComplexity();return{primitivesPerFeature:de(this._resources.lodResources.levels[0]).reduce(((e,t)=>e+t.indices.get(oe.POSITION).length),0)/3,primitivesPerCoordinate:0,drawCallsPerFeature:0,estimated:!1,memory:ee(this.symbol,this.symbolLayer)}}_hasLodRenderer(){return t(this._resources)}_createAs3DShape(e,s,r,a,o){if(!this._hasLodRenderer()||i(this._resources))return null;const n=this.getFastUpdateAttrValues(e),l=!this._fastUpdates.enabled&&this._hasPerInstanceColor()?k(r.color,r.opacity):null,c=this._context.clippingExtent;if(S(s,ue,this._context.elevationProvider.spatialReference),t(c)&&!w(c,ue))return null;const h=this._requiresTerrainElevation(a),d=this._computeGlobalTransform(s,a,fe,be),m=this._computeLocalTransform(this._resources,this.symbolLayer,r,ye),p=this._resources.lodRenderer.instanceData,u=p.addInstance();this._instanceIndexToGraphicUid.set(u,o),p.setLocalTransform(u,m,!1),p.setGlobalTransform(u,d),n&&p.setFeatureAttribute(u,n),l&&p.setColor(u,l);const y=new A(this,u,O,a);return h&&(y.alignedSampledElevation=be.sampledElevation),y.needsElevationUpdates=I(a.mode),Q(y,s,this._context.elevationProvider),y}_computeGlobalTransform(e,t,s,r){return z(e,this._context.elevationProvider,t,this._context.renderCoordsHelper,r),ue[0]=e.x,ue[1]=e.y,ue[2]=r.z,C(e.spatialReference,ue,s,this._context.renderCoordsHelper.spatialReference),s}_computeLocalTransform(e,t,s,r){return l(r),this._applyObjectRotation(s,!1,r),this._applyObjectRotation(t,!0,r),this._applyObjectScale(e,s,r),this._applyAnchor(e,t,r),r}_applyObjectScale(e,t,s){if(this._fastUpdates.enabled&&this._fastUpdates.requiresShaderTransformation)return;const r=this._drivenProperties.size&&t.size?t.size:e.symbolSize,i=W(r,e.symbolSize,e.resourceSize,this._context.renderCoordsHelper.unitInMeters);1===i[0]&&1===i[1]&&1===i[2]||c(s,s,i)}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchTransform(e,t),this._preparePatchColor(e,t)}updateGeometry(e,t){if(i(this._resources))return!0;const s=t&&K(t);if(i(s))return!1;const r=this.getGeometryElevationMode(t);return e.elevationContext.mode===r&&(this._computeGlobalTransform(s,e.elevationContext,fe,be),this._requiresTerrainElevation(e.elevationContext)&&(e.alignedSampledElevation=be.sampledElevation),this._resources.lodRenderer.instanceData.setGlobalTransform(e.instanceIndex,fe,!0),Q(e,s,this._context.elevationProvider),!0)}_preparePatchTransform(e,t){if(!(t.heading||t.tilt||t.roll||t.width||t.height||t.depth||t.anchor||t.anchorPosition))return;if(i(this._resources))return;const s=(e,t,s)=>a(null!=e&&"complete"===e.type?e.newValue:t,s),r=s(t.heading,this.symbolLayer.heading,0),o=s(t.tilt,this.symbolLayer.tilt,0),n=s(t.roll,this.symbolLayer.roll,0),l=s(t.width,this.symbolLayer.width,void 0),c=s(t.height,this.symbolLayer.height,void 0),h=s(t.depth,this.symbolLayer.depth,void 0),d=s(t.anchor,this.symbolLayer.anchor,void 0),m=s(t.anchorPosition,this.symbolLayer.anchorPosition,void 0);delete t.heading,delete t.tilt,delete t.roll,delete t.width,delete t.height,delete t.depth,delete t.anchor,delete t.anchorPosition;const p={heading:r,tilt:o,roll:n,anchor:d,anchorPosition:m},u=this._resources;this.loadStatus===N.LOADED&&e.symbolLayerStatePatches.push((()=>{u.symbolSize=b(G(u.resourceSize,{width:l,height:c,depth:h,isPrimitive:this.symbolLayer.isPrimitive}))})),e.graphics3DGraphicPatches.push(((e,t)=>{const s=this._computeLocalTransform(u,p,t,ye),r=e.instanceIndex;u.lodRenderer.instanceData.setLocalTransform(r,s,!0)}))}_preparePatchColor(s,r){if(!r.material||"partial"!==r.material.type)return;const a=r.material.diff;if(!a.color||"complete"!==a.color.type||null==a.color.newValue||null==a.color.oldValue)return;const o=a.color.newValue,n=t(o)?e.toUnitRGBA(o):R;delete a.color;const l=this._resources;i(l)||s.graphics3DGraphicPatches.push((e=>{let t;this._hasPerInstanceColor()?(l.lodRenderer.instanceData.setColor(e.instanceIndex,n),t=this._setMaterialTransparencyParams({},o)):t=this._setMaterialTransparencyParams({externalColor:n},o);for(const s of l.stageResources.materials)s.setParameters(t)}))}_requiresTerrainElevation(e){return"absolute-height"!==e.mode}_applyObjectRotation(e,t,s){if(!(this._fastUpdates.enabled&&this._fastUpdates.requiresShaderTransformation&&t))return q(e.heading,e.tilt,e.roll,s)}_computeAnchor(e,s,r){const i=x();switch(r.anchor){case"center":u(i,j(e)),p(i,i);break;case"top":{const t=j(e);_(i,-t[0],-t[1],-e[5]);break}case"bottom":{const t=j(e);_(i,-t[0],-t[1],-e[2]);break}case"relative":{const t=j(e),s=U(e),a=r.anchorPosition,o=a?v(a.x,a.y,a.z):P;y(i,s,o),f(i,i,t),p(i,i);break}default:t(s)?p(i,s):u(i,P)}return i}_applyAnchor(e,t,s){if(this._fastUpdates.enabled&&this._fastUpdates.requiresShaderTransformation)return;const r=this._computeAnchor(e.resourceBoundingBox,e.pivotOffset,t);r&&h(s,s,r)}_hasPerInstanceColor(){return this._drivenProperties.color||this._drivenProperties.opacity}_fastVisualVariableConvertOptions(e,s,r,i){const a=t(e)?b(U(e)):g,o=t(e)?this._computeAnchor(e,i,this.symbolLayer):P,n=this._context.renderCoordsHelper.unitInMeters,l=W(t(s)?s:void 0,s,r,n),c=v(this.symbolLayer.tilt||0,this.symbolLayer.roll||0,this.symbolLayer.heading||0);return{modelSize:a,symbolSize:t(s)?s:g,unitInMeters:n,transformation:{anchor:o,scale:l,rotation:c}}}}const ue=x(),ye=d(),fe=d(),_e=L(),be=new D;export{pe as Graphics3DObjectSymbolLayer};
|
|
5
|
+
import e from"../../../../Color.js";import{isSome as t,get as s,none as r,isNone as i,unwrapOr as a}from"../../../../core/maybe.js";import{pt2px as o}from"../../../../core/screenUtils.js";import{c as n,i as l,h as c,j as h}from"../../../../chunks/mat4.js";import{c as d}from"../../../../chunks/mat4f64.js";import{l as m,o as p,g as u,D as y,b as f,s as _}from"../../../../chunks/vec3.js";import{d as b,O as g,Z as P,f as v,c as x}from"../../../../chunks/vec3f64.js";import{O as R,c as L}from"../../../../chunks/vec4f64.js";import{projectPointToVector as S,computeTranslationToOriginAndRotation as C}from"../../../../geometry/projection.js";import{create as E,size as w,containsPoint as U,center as j}from"../../../../geometry/support/aaBoundingBox.js";import{defaultPrimitive as B}from"../../../../symbols/support/ObjectSymbol3DLayerResource.js";import{objectSymbolLayerPrimitiveBoundingBox as T,objectSymbolLayerSizeWithResourceSize as G}from"../../../../symbols/support/symbolLayerUtils3D.js";import{perLodInstanceElevationAligner as O}from"./ElevationAligners.js";import{needsElevationUpdates3D as I,evaluateElevationInfoAtPoint as z,SampleElevationInfo as D}from"./elevationAlignmentUtils.js";import{ElevationContext as M}from"./ElevationContext.js";import A from"./Graphics3DLodInstanceGraphicLayer.js";import{Graphics3DSymbolLayer as F}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as V,mixinColorAndOpacity as k,computeObjectScale as W,computeObjectRotation as q}from"./graphicUtils.js";import{ApplyRendererDiffResult as H}from"./interfaces.js";import{LoadStatus as N}from"./Loadable.js";import{makeLodResources as $,fillEstimatedMinScreenSpaceRadius as Z}from"./lodResourceUtils.js";import{fetch as J}from"./objectResourceUtils.js";import{placePointOnGeometry as K,extendPointGraphicElevationContext as Q}from"./pointUtils.js";import{isValidPrimitive as X,primitiveLodResources as Y}from"./primitiveObjectSymbolUtils.js";import{defaultSymbolLayerMemoryComplexity as ee}from"./symbolComplexity.js";import{initFastSymbolUpdatesState as te,updateFastSymbolUpdatesState as se,evaluateModelTransform as re,evaluateModelTransformScale as ie}from"../support/FastSymbolUpdates.js";import{CullFaceOptions as ae}from"../../webgl-engine/lib/basicInterfaces.js";import{VertexAttribute as oe}from"../../webgl-engine/lib/VertexAttribute.js";import{LodRenderer as ne}from"../../webgl-engine/lib/lodRendering/LodRenderer.js";import{materialsFromLodResources as le,texturesFromLodResources as ce,geometriesFromLodResources as he,geometriesFromLodLevelResources as de}from"../../webgl-engine/lib/lodRendering/LodResources.js";import{DefaultMaterial as me}from"../../webgl-engine/materials/DefaultMaterial.js";class pe extends F{constructor(e,t,s,r){super(e,t,s,r),this._resources=null,this._optionalFields=new Array,this._instanceIndexToGraphicUid=new Map,this.hasLoadedPBRTextures=!1,this.ensureDrapedStatus(!1),this.hasLoadedPBRTextures=s.physicalBasedRenderingEnabled}getCachedSize(){const[e,s,r]=t(this._resources)?this._resources.symbolSize:[1,1,1];return{width:e,depth:s,height:r}}async doLoad(e){if(!this._drivenProperties.size){if(V(this.symbolLayer))throw new Error}const t=this.symbolLayer;if(this.isPrimitive){const s=t.resource?t.resource.primitive:B;this._resources=await this._createResourcesForPrimitive(s,e)}else this._resources=await this._createResourcesForUrl(t.resource.href,e);this.layerOpacityChanged(),this.slicePlaneEnabledChanged(),this.physicalBasedRenderingChanged(),this.complexity=this.computeComplexity()}get extentPadding(){return t(this._resources)?this._resources.extentPadding:0}get isPrimitive(){return!(this.symbolLayer.resource&&this.symbolLayer.resource.href)}get lodRenderer(){return s(this._resources,"lodRenderer")}_setMaterialTransparencyParams(e,t=s(this.symbolLayer,"material","color")){const r=this._getCombinedOpacity(t),i=r<1||this.needsDrivenTransparentPass;return e.transparent=i,e.opacity=r,e.cullFace=i?ae.None:ae.Back,e}async _createResourcesForPrimitive(s,i){if(!X(s))throw new Error(`Unknown object symbol primitive: ${s}`);const a=this.symbolLayer,n=E(T(s)),l=b(w(n)),c=b(G(l,a)),h=m(c),d=!1,p=!1,u={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,instanced:["transformation"],ambient:g,diffuse:g,slicePlaneEnabled:this._context.slicePlaneEnabled,sliceHighlightDisabled:!0,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!this.symbolLayer.isPrimitive},y=u.usePBR;this._setMaterialTransparencyParams(u);const f=this.symbol;if("point-3d"===f.type&&f.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:s}=f.verticalOffset;u.verticalOffset={screenLength:o(e),minWorldLength:t||0,maxWorldLength:null!=s?s:1/0},u.castShadows=!1}if(this._context.screenSizePerspectiveEnabled&&(u.screenSizePerspective=this._context.sharedResources.screenSizePerspectiveSettings),this._drivenProperties.color)u.externalColor=R;else{const s=t(a.material)&&a.material.color,r=t(s)?e.toUnitRGBA(s):R;u.externalColor=r}this._fastUpdates=te(this._context.renderer,this._fastVisualVariableConvertOptions(n,c,l,r)),this._fastUpdates.enabled?(Object.assign(u,this._fastUpdates.materialParameters),u.instanced.push("featureAttribute"),this._optionalFields.push("featureAttribute")):this._hasPerInstanceColor()&&(u.instanced.push("color"),this._optionalFields.push("color"));const _=new me(u),P=Y(s,_);if(!P)throw new Error(`Unknown object symbol primitive: ${s}`);const v=le(P).map((e=>({opacity:1,transparent:e.parameters.transparent}))),x=await this._createStageResources(P,y);return{lodResources:P,lodRenderer:await this._createLodRenderer(P,i),stageResources:x,symbolSize:c,extentPadding:h,isEsriSymbolResource:d,isWosr:p,originalMaterialParameters:v,physicalBasedRenderingEnabled:y,resourceBoundingBox:n,resourceSize:l,dispose:r,pivotOffset:r}}async _createResourcesForUrl(e,t){const i=["transformation"],a={materialParamsMixin:{instanced:i,slicePlaneEnabled:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows},streamDataRequester:this._context.streamDataRequester,cache:this._context.sharedResources.objectResourceCache};this._fastUpdates=te(this._context.renderer,this._fastVisualVariableConvertOptions(r,r,r,r)),this._fastUpdates.enabled?(Object.assign(a.materialParamsMixin,this._fastUpdates.materialParameters),i.push("featureAttribute"),this._optionalFields.push("featureAttribute")):this._hasPerInstanceColor()&&(i.push("color"),this._optionalFields.push("color"));const n=this.symbol;if("point-3d"===n.type&&n.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:s}=n.verticalOffset;a.materialParamsMixin.verticalOffset={screenLength:o(e),minWorldLength:t||0,maxWorldLength:null!=s?s:1/0},a.materialParamsMixin.castShadows=!1}a.signal=t,a.usePBR=this._context.physicalBasedRenderingEnabled;const l=a.usePBR,c=await J(e,a),h=c.isEsriSymbolResource,d=c.isWosr,p=c.remove,u=$(c.lods);Z(u),u.levels.sort(((e,t)=>e.minScreenSpaceRadius-t.minScreenSpaceRadius)),u.levels[0].minScreenSpaceRadius=Math.min(2,u.levels[0].minScreenSpaceRadius);const y=this._context,f=this.symbolLayer.material,_=this._getExternalColorParameters(f),g=s(this.symbolLayer,"material","color"),P=this._getCombinedOpacity(g,{hasIntrinsicColor:!0}),v=this.needsDrivenTransparentPass,x=le(u),R=le(u).map((e=>({opacity:e.parameters.opacity||1,transparent:e.parameters.transparent})));x.forEach((e=>{const t=e.parameters;e.setParameters(_);const s=t.opacity*P,r=s<1||v||t.transparent;e.setParameters({opacity:s,transparent:r}),y.screenSizePerspectiveEnabled&&e.setParameters({screenSizePerspective:y.sharedResources.screenSizePerspectiveSettings})}));const L=c.referenceBoundingBox,S=b(w(L)),C=b(u.levels[0].pivotOffset),E=b(G(S,this.symbolLayer)),U=m(E);se(this._fastUpdates,this._context.renderer,this._fastVisualVariableConvertOptions(L,E,S,C))&&x.forEach((e=>e.setParameters(this._fastUpdates.materialParameters)));const j=await this._createStageResources(u,l);return{lodResources:u,lodRenderer:await this._createLodRenderer(u,t),stageResources:j,symbolSize:E,extentPadding:U,isEsriSymbolResource:h,isWosr:d,originalMaterialParameters:R,physicalBasedRenderingEnabled:l,resourceBoundingBox:L,resourceSize:S,dispose:p,pivotOffset:C}}async _createStageResources(e,t){const s=this._context.stage,r=le(e);t!==this._context.physicalBasedRenderingEnabled&&this.physicalBasedRenderingChanged(),s.addMany(r);const i=ce(e);s.addMany(i),await s.load(i);const a=he(e);return s.addMany(a),{materials:r,textures:i,geometries:a}}async _createLodRenderer(e,t){const s=this._context.stage,r={layerUid:this._context.layer.uid,graphicUid:e=>this._instanceIndexToGraphicUid.get(e),notifyGraphicGeometryChanged:e=>this._context.notifyGraphicGeometryChanged(this._instanceIndexToGraphicUid.get(e)),notifyGraphicVisibilityChanged:e=>this._context.notifyGraphicVisibilityChanged(this._instanceIndexToGraphicUid.get(e))},i=this._fastUpdates.enabled?{applyTransform:(e,t,s)=>{e.getFeatureAttribute(t,_e),n(s,re(this._fastUpdates.materialParameters,_e,s))},scaleFactor:(e,t,s)=>(t.getFeatureAttribute(s,_e),ie(e,this._fastUpdates.materialParameters,_e))}:null,a=new ne(e,this._optionalFields,r,i);return a.slicePlaneEnabled=this._context.slicePlaneEnabled,await s.addRenderPlugin(a.slots,a,t),a}_getExternalColorParameters(s){const r={};return this._drivenProperties.color?r.externalColor=R:t(s)&&t(s.color)?r.externalColor=e.toUnitRGBA(s.color):(r.externalColor=R,r.colorMixMode="ignore"),r}destroy(){if(super.destroy(),t(this._resources)){const e=this._context.stage;e.removeRenderPlugin(this._resources.lodRenderer);const s=this._resources.stageResources;e.removeMany(s.materials),e.removeMany(s.textures),e.removeMany(s.geometries),t(this._resources.dispose)&&this._resources.dispose(),this._resources=null}}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;const s=K(t.geometry);if(i(s))return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;const r=this.setGraphicElevationContext(t,new M),a=e.renderingInfo;return this._createAs3DShape(t,s,a,r,t.uid)}notifyDestroyGraphicLayer(e){this._instanceIndexToGraphicUid.delete(e.instanceIndex)}graphicLayerToGraphicId(){return 0}layerOpacityChanged(){if(i(this._resources))return!0;const e=this._drivenProperties.opacity,t=!this.isPrimitive,r=this._resources.stageResources.materials,a=this._resources.originalMaterialParameters;for(let i=0;i<r.length;i++){const o=r[i],n=s(this.symbolLayer,"material","color"),l=a[i],c=this._getCombinedOpacity(n,{hasIntrinsicColor:t})*l.opacity,h=c<1||e||l.transparent;o.setParameters({opacity:c,transparent:h}),this.isPrimitive&&o.setParameters({cullFace:h?ae.None:ae.Back})}return!0}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,I)}slicePlaneEnabledChanged(){if(i(this._resources))return!0;this._resources.lodRenderer.slicePlaneEnabled=this._context.slicePlaneEnabled;for(const e of this._resources.stageResources.materials)e.setParameters({slicePlaneEnabled:this._context.slicePlaneEnabled});return!0}physicalBasedRenderingChanged(){if(i(this._resources))return!0;const{stageResources:e,isWosr:t}=this._resources;for(const s of e.materials)this.isPrimitive?s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}):t||s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!1});return!1!==this.hasLoadedPBRTextures||!0!==this._context.physicalBasedRenderingEnabled||(this.hasLoadedPBRTextures=!0,!1)}pixelRatioChanged(){return!0}applyRendererDiff(e,t){if(i(this._resources))return H.Recreate_Symbol;const{stageResources:{materials:s},lodRenderer:r,resourceBoundingBox:a,symbolSize:o,resourceSize:n,pivotOffset:l}=this._resources;for(const i in e.diff){if("visualVariables"!==i)return H.Recreate_Symbol;if(!se(this._fastUpdates,t,this._fastVisualVariableConvertOptions(a,o,n,l)))return H.Recreate_Symbol;for(const e of s)e.setParameters(this._fastUpdates.materialParameters);r.notifyShaderTransformationChanged()}return H.Fast_Update}computeComplexity(){if(i(this._resources))return super.computeComplexity();return{primitivesPerFeature:de(this._resources.lodResources.levels[0]).reduce(((e,t)=>e+t.indices.get(oe.POSITION).length),0)/3,primitivesPerCoordinate:0,drawCallsPerFeature:0,estimated:!1,memory:ee(this.symbol,this.symbolLayer)}}_hasLodRenderer(){return t(this._resources)}_createAs3DShape(e,s,r,a,o){if(!this._hasLodRenderer()||i(this._resources))return null;const n=this.getFastUpdateAttrValues(e),l=!this._fastUpdates.enabled&&this._hasPerInstanceColor()?k(r.color,r.opacity):null,c=this._context.clippingExtent;if(S(s,ue,this._context.elevationProvider.spatialReference),t(c)&&!U(c,ue))return null;const h=this._requiresTerrainElevation(a),d=this._computeGlobalTransform(s,a,fe,be),m=this._computeLocalTransform(this._resources,this.symbolLayer,r,ye),p=this._resources.lodRenderer.instanceData,u=p.addInstance();this._instanceIndexToGraphicUid.set(u,o),p.setLocalTransform(u,m,!1),p.setGlobalTransform(u,d),n&&p.setFeatureAttribute(u,n),l&&p.setColor(u,l);const y=new A(this,u,O,a);return h&&(y.alignedSampledElevation=be.sampledElevation),y.needsElevationUpdates=I(a.mode),Q(y,s,this._context.elevationProvider),y}_computeGlobalTransform(e,t,s,r){return z(e,this._context.elevationProvider,t,this._context.renderCoordsHelper,r),ue[0]=e.x,ue[1]=e.y,ue[2]=r.z,C(e.spatialReference,ue,s,this._context.renderCoordsHelper.spatialReference),s}_computeLocalTransform(e,t,s,r){return l(r),this._applyObjectRotation(s,!1,r),this._applyObjectRotation(t,!0,r),this._applyObjectScale(e,s,r),this._applyAnchor(e,t,r),r}_applyObjectScale(e,t,s){if(this._fastUpdates.enabled&&this._fastUpdates.requiresShaderTransformation)return;const r=this._drivenProperties.size&&t.size?t.size:e.symbolSize,i=W(r,e.symbolSize,e.resourceSize,this._context.renderCoordsHelper.unitInMeters);1===i[0]&&1===i[1]&&1===i[2]||c(s,s,i)}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchTransform(e,t),this._preparePatchColor(e,t)}updateGeometry(e,t){if(i(this._resources))return!0;const s=t&&K(t);if(i(s))return!1;const r=this.getGeometryElevationMode(t);return e.elevationContext.mode===r&&(this._computeGlobalTransform(s,e.elevationContext,fe,be),this._requiresTerrainElevation(e.elevationContext)&&(e.alignedSampledElevation=be.sampledElevation),this._resources.lodRenderer.instanceData.setGlobalTransform(e.instanceIndex,fe,!0),Q(e,s,this._context.elevationProvider),!0)}_preparePatchTransform(e,t){if(!(t.heading||t.tilt||t.roll||t.width||t.height||t.depth||t.anchor||t.anchorPosition))return;if(i(this._resources))return;const s=(e,t,s)=>a(null!=e&&"complete"===e.type?e.newValue:t,s),r=s(t.heading,this.symbolLayer.heading,0),o=s(t.tilt,this.symbolLayer.tilt,0),n=s(t.roll,this.symbolLayer.roll,0),l=s(t.width,this.symbolLayer.width,void 0),c=s(t.height,this.symbolLayer.height,void 0),h=s(t.depth,this.symbolLayer.depth,void 0),d=s(t.anchor,this.symbolLayer.anchor,void 0),m=s(t.anchorPosition,this.symbolLayer.anchorPosition,void 0);delete t.heading,delete t.tilt,delete t.roll,delete t.width,delete t.height,delete t.depth,delete t.anchor,delete t.anchorPosition;const p={heading:r,tilt:o,roll:n,anchor:d,anchorPosition:m},u=this._resources;this.loadStatus===N.LOADED&&e.symbolLayerStatePatches.push((()=>{u.symbolSize=b(G(u.resourceSize,{width:l,height:c,depth:h,isPrimitive:this.symbolLayer.isPrimitive}))})),e.graphics3DGraphicPatches.push(((e,t)=>{const s=this._computeLocalTransform(u,p,t,ye),r=e.instanceIndex;u.lodRenderer.instanceData.setLocalTransform(r,s,!0)}))}_preparePatchColor(s,r){if(!r.material||"partial"!==r.material.type)return;const a=r.material.diff;if(!a.color||"complete"!==a.color.type||null==a.color.newValue||null==a.color.oldValue)return;const o=a.color.newValue,n=t(o)?e.toUnitRGBA(o):R;delete a.color;const l=this._resources;i(l)||s.graphics3DGraphicPatches.push((e=>{let t;this._hasPerInstanceColor()?(l.lodRenderer.instanceData.setColor(e.instanceIndex,n),t=this._setMaterialTransparencyParams({},o)):t=this._setMaterialTransparencyParams({externalColor:n},o);for(const s of l.stageResources.materials)s.setParameters(t)}))}_requiresTerrainElevation(e){return"absolute-height"!==e.mode}_applyObjectRotation(e,t,s){if(!(this._fastUpdates.enabled&&this._fastUpdates.requiresShaderTransformation&&t))return q(e.heading,e.tilt,e.roll,s)}_computeAnchor(e,s,r){const i=x();switch(r.anchor){case"center":u(i,j(e)),p(i,i);break;case"top":{const t=j(e);_(i,-t[0],-t[1],-e[5]);break}case"bottom":{const t=j(e);_(i,-t[0],-t[1],-e[2]);break}case"relative":{const t=j(e),s=w(e),a=r.anchorPosition,o=a?v(a.x,a.y,a.z):P;y(i,s,o),f(i,i,t),p(i,i);break}default:t(s)?p(i,s):u(i,P)}return i}_applyAnchor(e,t,s){if(this._fastUpdates.enabled&&this._fastUpdates.requiresShaderTransformation)return;const r=this._computeAnchor(e.resourceBoundingBox,e.pivotOffset,t);r&&h(s,s,r)}_hasPerInstanceColor(){return this._drivenProperties.color||this._drivenProperties.opacity}_fastVisualVariableConvertOptions(e,s,r,i){const a=t(e)?b(w(e)):g,o=t(e)?this._computeAnchor(e,i,this.symbolLayer):P,n=this._context.renderCoordsHelper.unitInMeters,l=W(t(s)?s:void 0,s,r,n),c=v(this.symbolLayer.tilt||0,this.symbolLayer.roll||0,this.symbolLayer.heading||0);return{modelSize:a,symbolSize:t(s)?s:g,unitInMeters:n,transformation:{anchor:o,scale:l,rotation:c}}}}const ue=x(),ye=d(),fe=d(),_e=L(),be=new D;export{pe as Graphics3DObjectSymbolLayer};
|
|
@@ -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"../../../../Color.js";import{isSome as t,get as i,isNone as r,unwrap as n}from"../../../../core/maybe.js";import{pt2px as o}from"../../../../core/screenUtils.js";import{e as a}from"../../../../chunks/earcut.js";import{I as s}from"../../../../chunks/mat4f64.js";import{s as l}from"../../../../chunks/vec4.js";import{create as u,empty as
|
|
5
|
+
import e from"../../../../Color.js";import{isSome as t,get as i,isNone as r,unwrap as n}from"../../../../core/maybe.js";import{pt2px as o}from"../../../../core/screenUtils.js";import{e as a}from"../../../../chunks/earcut.js";import{I as s}from"../../../../chunks/mat4f64.js";import{s as l}from"../../../../chunks/vec4.js";import{create as u,empty as p,expandWithBuffer as c,intersectsClippingArea as h,expandWithAABB as d}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewMat3f64 as m,BufferViewVec3f64 as _,BufferViewVec4f as y}from"../../../../geometry/support/buffer/BufferView.js";import{SymbolUpdateType as g,elevationModeChangeUpdateType as f,needsElevationUpdates2D as b}from"./elevationAlignmentUtils.js";import{ElevationContext as v}from"./ElevationContext.js";import E from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as x}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as M}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as O}from"./graphicUtils.js";import{parseCapType as D,createGeometry as S,RemoveDuplicateStartEnd as A}from"./lineUtils.js";import{geometryAsPolygon as U,geometryToRenderInfo as P,createColorGeometry as C,geometryToRenderInfoDraped as w}from"./polygonUtils.js";import{createMaterial as G,uvElevationAligner as T}from"../support/patternUtils.js";import{createMapSpaceUVCoords as j,createMapSpaceUVCoordsDraped as R}from"../support/uvUtils.js";import{Object3D as B}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as L}from"../../webgl-engine/lib/RenderGeometry.js";import{VertexAttribute as N}from"../../webgl-engine/lib/VertexAttribute.js";import{getStipplePatternForLinePattern as V}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as F}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as I}from"../../webgl-engine/materials/RibbonLineMaterial.js";const H=["polyline","polygon","extent"];class W extends M{constructor(e,t,i,r){super(e,t,i,r),this._needsUV=!1,this._hasOutline=!1}async doLoad(){}_ensureMaterials(){this._ensureFillMaterial(),this._ensureOutlineMaterial()}_ensureFillMaterial(){if(t(this._material))return;const e=i(this.symbolLayer,"material","color"),r=this._getCombinedOpacityAndColor(e);this._material=G(this.symbolLayer,{color:r,transparent:r[3]<1||this.needsDrivenTransparentPass,polygonOffset:!1,vertexColors:!0,writeLinearDepth:!0,slicePlaneEnabled:this._context.slicePlaneEnabled},{isDraped:this.draped}),this._needsUV=this._material instanceof F,this._context.stage.add(this._material)}_ensureOutlineMaterial(){const e=this.symbolLayer.outline;if(t(this._outlineMaterial)||!this._isValidOutline(e))return;this._hasOutline=!0;const i=t=>{const i=V(e.pattern);return new I({width:t,color:this._getOutlineColor(),polygonOffset:!0,slicePlaneEnabled:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:i,stippleScaleWithLineWidth:!0,cap:D(e.patternCap||"butt")})};this._outlineMaterial=i(o(e.size)),this._context.stage.add(this._outlineMaterial)}_isValidOutline(e){return t(e)&&e.size&&e.size>0&&t(e.color)&&(r(e.pattern)||"style"!==e.pattern.type||"none"!==e.pattern.style)}destroy(){super.destroy(),this._context.stage.remove(this._material),this._material=null,this._context.stage.remove(this._outlineMaterial),this._outlineMaterial=null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,H,this.symbolLayer.type))return null;const i=this._getVertexOpacityAndColor(e.renderingInfo,255),r=this.setGraphicElevationContext(t,new v);return this.ensureDrapedStatus("on-the-ground"===r.mode),this._ensureMaterials(),this.draped?this._createAsOverlay(t,i):this._createAs3DShape(t,i,r)}layerOpacityChanged(){if(t(this._material)){const e=this._material.parameters.color,t=i(this.symbolLayer,"material","color"),r=this._getCombinedOpacity(t);this._material.setParameters({color:[e[0],e[1],e[2],r],transparent:r<1||this.needsDrivenTransparentPass})}if(t(this._outlineMaterial)){const e=this._outlineMaterial.parameters.color;this._outlineMaterial.setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}return!0}layerElevationInfoChanged(e,t,i){const r=this._elevationContext.mode,n=f(W.elevationModeChangeTypes,i,r);if(n!==g.UPDATE)return n;const o=b(r);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>o))}slicePlaneEnabledChanged(){if(t(this._material)&&this._material.setParameters({slicePlaneEnabled:this._context.slicePlaneEnabled}),t(this._outlineMaterial)){const e={slicePlaneEnabled:this._context.slicePlaneEnabled};this._outlineMaterial.setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}pixelRatioChanged(){return!0}_createAs3DShape(e,t,i){const n=U(e.geometry);if(r(n))return null;z.renderData=P(n,this._context.elevationProvider,this._context.renderCoordsHelper,i),z.color=t;const o=z.renderData.position.length/3;if(this._needsUV&&(z.uvMapSpace=new Float32Array(4*o),z.boundingRect=new Float64Array(9*o)),z.outNum=0,z.outGeometries=[],z.outTransforms=[],z.outMaterials=[],this._createAs3DShapeFill(z),this._hasOutline&&this._createAs3DShapeOutline(z),this._logGeometryCreationWarnings(z.renderData,n.rings,"rings","FillSymbol3DLayer"),0===z.outNum)return null;this._needsUV&&j(y.fromTypedArray(z.uvMapSpace),_.fromTypedArray(z.renderData.position),this._context.renderCoordsHelper,m.fromTypedArray(z.boundingRect));const a=new B({geometries:z.outGeometries,materials:z.outMaterials,transformations:z.outTransforms,castShadow:!1,metadata:{layerUid:this._context.layer.uid,graphicUid:e.uid}}),s=new x(this,a,z.outGeometries,null,null,T,i);return s.alignedSampledElevation=z.renderData.sampledElevation,s.needsElevationUpdates=b(i.mode),s}_createAs3DShapeFill(e){const i=e.renderData.polygons;for(const{position:r,mapPosition:o,holeIndices:l,index:u,count:d}of i){if(t(this._context.clippingExtent)&&(p(k),c(k,o),!h(k,this._context.clippingExtent)))continue;const i=a(o,l,3);if(0===i.length)continue;const m=new Uint32Array(i),_=C({indices:m,attributeData:{position:r,color:e.color,mapPosition:o,uvMapSpace:this._needsUV?new Float32Array(e.uvMapSpace.buffer,4*u*e.uvMapSpace.BYTES_PER_ELEMENT,4*d):null,boundingRect:this._needsUV?new Float64Array(e.boundingRect.buffer,9*u*e.boundingRect.BYTES_PER_ELEMENT,9*d):null}});e.outGeometries.push(_),e.outMaterials.push(n(this._material)),e.outTransforms.push(s),e.outNum++}}_createAs3DShapeOutline(e){if(!this._hasOutline)return;const i=e.renderData.outlines;for(let r=0;r<i.length;++r){const{mapPosition:o,position:a}=i[r];if(t(this._context.clippingExtent)&&(p(k),c(k,o),!h(k,this._context.clippingExtent)))continue;const l=S({overlayInfo:null,removeDuplicateStartEnd:A.REMOVE,attributeData:{position:a,mapPosition:o}}),u=l.vertexAttributes.get(N.POSITION);u.data===a&&(u.data=new Float64Array(a)),e.outGeometries.push(l),e.outMaterials.push(n(this._outlineMaterial)),e.outTransforms.push(s),e.outNum++}}_createAsOverlay(e,i){const o=U(e.geometry);if(r(o))return null;n(this._material).renderPriority=this._renderPriority+this._renderPriorityStep/2,t(this._outlineMaterial)&&(this._outlineMaterial.renderPriority=this._renderPriority),Y.renderData=w(o,this._context.overlaySR),Y.color=i;const a=Y.renderData.position.length/3;return this._needsUV&&(Y.uvMapSpace=new Float32Array(4*a)),Y.outNum=0,Y.outGeometries=[],Y.outBoundingBox=p(),Y.layerUid=this._context.layer.uid,Y.graphicsUid=e.uid,this._createAsOverlayFill(Y),this._hasOutline&&this._createAsOverlayOutline(Y),this._logGeometryCreationWarnings(Y.renderData,o.rings,"rings","FillSymbol3DLayer"),0===Y.outNum?null:(this._needsUV&&R(y.fromTypedArray(Y.uvMapSpace),_.fromTypedArray(Y.renderData.position),this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode),Y.outNum>0?new E(this,Y.outGeometries,Y.outBoundingBox):null)}_createAsOverlayFill(e){const t=e.renderData.polygons;for(const{position:i,holeIndices:r,index:o,count:s}of t){if(p(k),c(k,i),!h(k,this._context.clippingExtent))continue;const t=a(i,r,3);if(0===t.length)continue;d(e.outBoundingBox,k);const u=new Uint32Array(t),m=C({indices:u,attributeData:{position:i,color:e.color,uvMapSpace:this._needsUV?new Float32Array(e.uvMapSpace.buffer,4*o*e.uvMapSpace.BYTES_PER_ELEMENT,4*s):null}}),_=new L(m,n(this._material),{layerUid:e.layerUid,graphicUid:e.graphicsUid}),y=k;l(_.boundingSphere,.5*(y[0]+y[3]),.5*(y[1]+y[4]),0,.5*Math.sqrt((y[3]-y[0])*(y[3]-y[0])+(y[4]-y[1])*(y[4]-y[1]))),e.outGeometries.push(_),e.outNum++}}_createAsOverlayOutline(e){if(!this._hasOutline)return;const t=e.renderData.outlines;for(let i=0;i<t.length;++i){const{position:r}=t[i];if(p(k),c(k,r),!h(k,this._context.clippingExtent))continue;d(e.outBoundingBox,k);const o=S({overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:A.REMOVE,attributeData:{position:r}}),a=new L(o,n(this._outlineMaterial),{layerUid:e.layerUid,graphicUid:e.graphicsUid}),s=k;l(a.boundingSphere,.5*(s[0]+s[3]),.5*(s[1]+s[4]),0,.5*Math.sqrt((s[3]-s[0])*(s[3]-s[0])+(s[4]-s[1])*(s[4]-s[1]))),e.outGeometries.push(a),e.outNum++}}_getOutlineOpacity(){const e=i(this.symbolLayer,"outline","color");return(this.draped?1:this._getLayerOpacity())*(t(e)?e.a:0)}_getOutlineColor(){const r=i(this.symbolLayer,"outline","color"),n=this._getOutlineOpacity();return O(t(r)?e.toUnitRGB(r):null,n)}get test(){return{createAsOverlay:(e,t)=>this._createAsOverlay(e,t),createAs3DShape:(e,t,i)=>this._createAs3DShape(e,t,i)}}}W.elevationModeChangeTypes={definedChanged:g.RECREATE,staysOnTheGround:g.NONE,onTheGroundChanged:g.RECREATE};const k=u(),z={renderData:null,color:null,uvMapSpace:null,boundingRect:null,outNum:0,outBoundingBox:null,outGeometries:null,outMaterials:null,outTransforms:null},Y={renderData:null,color:null,uvMapSpace:null,outNum:0,outBoundingBox:null,outGeometries:null,outMaterials:null,outTransforms:null};export{W as Graphics3DPolygonFillSymbolLayer,W 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 t,isNone as e}from"../../../../core/maybe.js";import{g as r,r as n,o}from"../../../../chunks/mat4.js";import{c as i}from"../../../../chunks/mat4f64.js";import{f as s}from"../../../../chunks/vec2f64.js";import{O as u,d as
|
|
5
|
+
import{isSome as t,isNone as e}from"../../../../core/maybe.js";import{g as r,r as n,o}from"../../../../chunks/mat4.js";import{c as i}from"../../../../chunks/mat4f64.js";import{f as s}from"../../../../chunks/vec2f64.js";import{O as u,d as m}from"../../../../chunks/vec3f64.js";import{s as a}from"../../../../chunks/vec4.js";import{b as l,O as c}from"../../../../chunks/vec4f64.js";import{projectPoint as f}from"../../../../geometry/projection.js";import{isPoint as p,maximumDimension as h}from"../../../../geometry/support/aaBoundingBox.js";import{create as g}from"../../../../geometry/support/aaBoundingRect.js";import{ringsCentroid as y}from"../../../../geometry/support/centroid.js";import{getPointOnPath as d,getPathLength as j}from"../../../../geometry/support/coordsUtils.js";import{makeDehydratedPoint as x}from"../../../../layers/graphics/dehydratedFeatures.js";import{isHydratedGeometry as b,clonePoint as v}from"../../../../layers/graphics/hydratedFeatures.js";import{VertexAttribute as w}from"../../webgl-engine/lib/VertexAttribute.js";function R(t,e){if("point"===t.type)return P(t,e,!1);if(b(t))switch(t.type){case"extent":return P(t.center,e,!1);case"polygon":return P(t.centroid,e,!1);case"polyline":return P(A(t),e,!0);case"mesh":return P(t.origin,e,!1)}else switch(t.type){case"extent":return P(k(t),e,!0);case"polygon":return P(M(t),e,!0);case"polyline":return P(A(t),e,!0)}}function A(t){const e=t.paths[0];if(!e||0===e.length)return null;const r=d(e,j(e)/2);return x(r[0],r[1],r[2],t.spatialReference)}function k(t){const e=isFinite(t.zmin);return x(.5*(t.xmax+t.xmin),.5*(t.ymax+t.ymin),e?.5*(t.zmax+t.zmin):void 0,t.spatialReference)}function M(t){const e=t.rings[0];if(!e||0===e.length)return null;const r=y(t.rings,t.hasZ);return x(r[0],r[1],r[2],t.spatialReference)}function P(t,e,r){const n=r?t:v(t);return e&&t?f(t,n,e)?n:null:n}function F(t,e,r,n=0){if(t){e||(e=g());const o=t;let i=.5*o.width*(r-1),s=.5*o.height*(r-1);return o.width<1e-7*o.height?i+=s/20:o.height<1e-7*o.width&&(s+=i/20),a(e,o.xmin-i-n,o.ymin-s-n,o.xmax+i+n,o.ymax+s+n),e}return null}function z(t,e){for(let r=0;r<t.geometries.length;++r){const n=t.geometries[r].getMutableAttribute(w.AUXPOS1);n&&n.data[3]!==e&&(n.data[3]=e,t.geometryVertexAttrsUpdated(t.geometryRecords[r]))}}function B(e,r){const n=l(c);return t(e)&&(n[0]=e[0],n[1]=e[1],n[2]=e[2]),t(r)?n[3]=r:t(e)&&e.length>3&&(n[3]=e[3]),n}function D(e,r,n,o,i,s=[0,0,0,0]){for(let u=0;u<3;++u)t(e)&&null!=e[u]?s[u]=e[u]:t(n)&&null!=n[u]?s[u]=n[u]:s[u]=i[u];return t(r)?s[3]=r:t(o)?s[3]=o:s[3]=i[3],s}function I(t=u,r,n,o=1){const i=new Array(3);if(e(r)||e(n))i[0]=1,i[1]=1,i[2]=1;else{let e,o=0;for(let s=2;s>=0;s--){const u=t[s];let m;const a=null!=u,l=0===s&&!e&&!a,c=n[s];"symbol-value"===u||l?m=0!==c?r[s]/c:1:a&&"proportional"!==u&&isFinite(u)&&(m=0!==c?u/c:1),null!=m&&(i[s]=m,e=m,o=Math.max(o,Math.abs(m)))}for(let t=2;t>=0;t--)null==i[t]?i[t]=e:0===i[t]&&(i[t]=.001*o)}for(let e=2;e>=0;e--)i[e]/=o;return m(i)}function O(t){return null!=t.isPrimitive}function U(t){return O(t)&&(t=[t.width,t.depth,t.height]),S(t)?null:"Symbol sizes may not be negative values"}function S(t){if(Array.isArray(t)){for(const e of t)if(!S(e))return!1;return!0}return null==t||t>=0}function V(t,e,s,u=i()){const m=t||0,a=e||0,l=s||0;return 0!==m&&r(u,u,-m/180*Math.PI),0!==a&&n(u,u,a/180*Math.PI),0!==l&&o(u,u,l/180*Math.PI),u}function X(t,e){return null!=e.minDemResolution?e.minDemResolution:p(t)?e.minDemResolutionForPoints:.01*h(t)}const Z={"bottom-left":s(0,0),bottom:s(.5,0),"bottom-right":s(1,0),left:s(0,.5),center:s(.5,.5),right:s(1,.5),"top-left":s(0,1),top:s(.5,1),"top-right":s(1,1)};export{R as computeCentroid,V as computeObjectRotation,I as computeObjectScale,X as demResolutionForBoundingBox,F as enlargeExtent,S as isValidSize,B as mixinColorAndOpacity,Z as namedAnchorToHUDMaterialAnchorPos,D as overrideColor,z as updateVertexAttributeAuxpos1w,U as validateSymbolLayerSize};
|
|
@@ -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{isNone as t,isSome as e,unwrapOr as o}from"../../../../core/maybe.js";import{slice as n}from"../../../../core/typedArrayUtil.js";import{d as r}from"../../../../chunks/vec2.js";import{s as i}from"../../../../chunks/vec3.js";import{c as s}from"../../../../chunks/vec3f64.js";import{projectBuffer as a,lonLatToWebMercatorComparable as u}from"../../../../geometry/projection.js";import{getReferenceEllipsoid as c}from"../../../../geometry/projectionEllipsoid.js";import{CounterClockwiseMode as l,pathsToTriangulationInfo as p}from"../../../../geometry/support/triangulationUtils.js";import{ViewingMode as f}from"../../../ViewingMode.js";import{WHITE_UNIT as m}from"./constants.js";import{applyPerVertexElevationAlignment as E}from"./elevationAlignmentUtils.js";import{DRAPED_Z as h}from"../../terrain/OverlayRenderer.js";import{PrimitiveType as T
|
|
5
|
+
import"../../../../core/has.js";import{isNone as t,isSome as e,unwrapOr as o}from"../../../../core/maybe.js";import{slice as n}from"../../../../core/typedArrayUtil.js";import{d as r}from"../../../../chunks/vec2.js";import{s as i}from"../../../../chunks/vec3.js";import{c as s}from"../../../../chunks/vec3f64.js";import{projectBuffer as a,lonLatToWebMercatorComparable as u}from"../../../../geometry/projection.js";import{getReferenceEllipsoid as c}from"../../../../geometry/projectionEllipsoid.js";import{CounterClockwiseMode as l,pathsToTriangulationInfo as p}from"../../../../geometry/support/triangulationUtils.js";import{ViewingMode as f}from"../../../ViewingMode.js";import{WHITE_UNIT as m}from"./constants.js";import{applyPerVertexElevationAlignment as E}from"./elevationAlignmentUtils.js";import{DRAPED_Z as h}from"../../terrain/OverlayRenderer.js";import{PrimitiveType as T}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as g}from"../../webgl-engine/lib/Geometry.js";import{VertexAttribute as y}from"../../webgl-engine/lib/VertexAttribute.js";import{C as A}from"../../../../chunks/RibbonLine.glsl.js";function O(t){const e=[],o=[];d(t,o,e);const n=o[0][1].data,r=e[0][1].length,i=new Uint16Array(r);return j(t,o,e),S(t,o,e,i),w(t,o,e,i),U(t,o,e,i),F(t,o,e,i),v(t,o,e,i),C(t,o,e,n),new g(o,e,T.Line)}function R(t,e,o,n){const r="polygon"===t.type?l.CCW_IS_HOLE:l.NONE,i="polygon"===t.type?t.rings:t.paths,{position:s,outlines:a}=p(i,t.hasZ,r),u=new Float64Array(s.length),c=E(s,t.spatialReference,0,u,0,s,0,s.length/3,e,o,n),f=null!=c;return{lines:f?b(a,s,u):[],projectionSuccess:f,sampledElevation:c}}function b(t,e,o){const n=new Array;for(const{index:r,count:i}of t){if(i<=1)continue;const t=3*r,s=t+3*i;n.push({position:e.subarray(t,s),mapPosition:o?o.subarray(t,s):void 0})}return n}function I(t,e){const o="polygon"===t.type?l.CCW_IS_HOLE:l.NONE,n="polygon"===t.type?t.rings:t.paths,{position:r,outlines:i}=p(n,!1,o),s=a(r,t.spatialReference,0,r,e,0,r.length/3);for(let a=2;a<r.length;a+=3)r[a]=h;return{lines:s?b(i,r):[],projectionSuccess:s}}function d(t,e,o){const{attributeData:{position:r},removeDuplicateStartEnd:i}=t,s=D(r)&&i===P.REMOVE,a=r.length/3-(s?1:0),u=new Uint32Array(2*(a-1)),c=s?n(r,0,r.length-3):r;let l=0;for(let n=0;n<a-1;n++)u[l++]=n,u[l++]=n+1;e.push([y.POSITION,{size:3,data:c,exclusive:s}]),o.push([y.POSITION,u])}function j(e,o,n){const r=e.attributeData.mapPosition;t(r)||(n.push([y.MAPPOS,n[0][1]]),o.push([y.MAPPOS,{size:3,data:r}]))}function S(t,n,r,i){if(e(t.attributeData.colorFeature))return;const s=t.attributeData.color;n.push([y.COLOR,{size:4,data:o(s,m)}]),r.push([y.COLOR,i])}function U(e,o,n,r){const i=e.attributeData.colorFeature;t(i)||(o.push([y.COLORFEATUREATTRIBUTE,{size:1,data:new Float32Array([i])}]),n.push([y.COLOR,r]))}function w(t,n,r,i){if(e(t.attributeData.sizeFeature))return;const s=t.attributeData.size;n.push([y.SIZE,{size:1,data:[o(s,1)]}]),r.push([y.SIZE,i])}function F(e,o,n,r){const i=e.attributeData.sizeFeature;t(i)||(o.push([y.SIZEFEATUREATTRIBUTE,{size:1,data:new Float32Array([i])}]),n.push([y.SIZEFEATUREATTRIBUTE,r]))}function v(e,o,n,r){const i=e.attributeData.opacityFeature;t(i)||(o.push([y.OPACITYFEATUREATTRIBUTE,{size:1,data:new Float32Array([i])}]),n.push([y.OPACITYFEATUREATTRIBUTE,r]))}function C(e,o,n,s){if(t(e.overlayInfo)||e.overlayInfo.renderCoordsHelper.viewingMode!==f.Global||!e.overlayInfo.spatialReference.isGeographic)return;const a=new Float64Array(s.length),l=c(e.overlayInfo.spatialReference);for(let t=0;t<a.length;t+=3)u(s,t,a,t,l);const p=s.length/3,m=new Float32Array(p+1);let E=z,h=N,T=0,g=0;i(E,a[g++],a[g++],a[g++]),m[0]=0;for(let t=1;t<p+1;++t)t===p&&(g=0),i(h,a[g++],a[g++],a[g++]),T+=r(E,h),m[t]=T,[E,h]=[h,E];o.push([y.DISTANCETOSTART,{size:1,data:m}]),n.push([y.DISTANCETOSTART,n[0][1]])}function D(t){const e=t.length;return t[0]===t[e-3]&&t[1]===t[e-2]&&t[2]===t[e-1]}var P;!function(t){t[t.KEEP=0]="KEEP",t[t.REMOVE=1]="REMOVE"}(P||(P={}));const z=s(),N=s();function L(t){switch(t){case"butt":return A.BUTT;case"square":return A.SQUARE;case"round":return A.ROUND;default:return null}}export{P as RemoveDuplicateStartEnd,O as createGeometry,R as geometryToRenderInfo,I as geometryToRenderInfoDraped,L as parseCapType};
|
|
@@ -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{adjustStaticAGOUrl as e}from"../../../../core/devEnvironmentUtils.js";import{get as t,isSome as r,isNone as s}from"../../../../core/maybe.js";import{a as o}from"../../../../chunks/mat3.js";import{c as i}from"../../../../chunks/mat3f64.js";import{a}from"../../../../chunks/mat4.js";import{c as u}from"../../../../chunks/mat4f64.js";import{m as n,f as l,E as c,l as m,n as d,e as f}from"../../../../chunks/vec3.js";import{c as p}from"../../../../chunks/vec3f64.js";import{empty as x,expandWithVec3 as g}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as
|
|
5
|
+
import{adjustStaticAGOUrl as e}from"../../../../core/devEnvironmentUtils.js";import{get as t,isSome as r,isNone as s}from"../../../../core/maybe.js";import{a as o}from"../../../../chunks/mat3.js";import{c as i}from"../../../../chunks/mat3f64.js";import{a}from"../../../../chunks/mat4.js";import{c as u}from"../../../../chunks/mat4f64.js";import{m as n,f as l,E as c,l as m,n as d,e as f}from"../../../../chunks/vec3.js";import{c as p}from"../../../../chunks/vec3f64.js";import{empty as x,expandWithVec3 as g}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as b,BufferViewVec4f as h,BufferViewVec2f as R,BufferViewVec4u8 as v,BufferViewVec4u16 as B,BufferViewVec3u8 as M,BufferViewVec3u16 as w}from"../../../../geometry/support/buffer/BufferView.js";import{t as y,a as T,s as j}from"../../../../chunks/vec32.js";import{t as O,s as E}from"../../../../chunks/vec42.js";import{createBuffer as C}from"../../../../geometry/support/buffer/utils.js";import{DefaultLoadingContext as S}from"../../glTF/DefaultLoadingContext.js";import{load as A}from"../../glTF/loader.js";import{triangleFanToTriangles as N,triangleStripToTriangles as I,trianglesToTriangles as L}from"../../glTF/internal/indexUtils.js";import{load as F,processLoadResult as k}from"./wosrLoader.js";import{AlphaDiscardMode as P,CullFaceOptions as V}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as _}from"../../webgl-engine/lib/Geometry.js";import{Texture as G}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as z}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as D}from"../../webgl-engine/materials/DefaultMaterial.js";import{COLOR_GAMMA as U}from"../../webgl-engine/materials/DefaultMaterial_COLOR_GAMMA.js";import{PrimitiveType as W}from"../../../webgl/enums.js";import{n as q}from"../../../../chunks/vec22.js";import{c as $,f as K}from"../../../../chunks/vec43.js";import{c as Q}from"../../../../chunks/vec33.js";async function H(s,o){const i=J(e(s));if("wosr"===i.fileType){const e=await(o.cache?o.cache.loadWOSR(i.url,o):F(i.url,o)),t=k(e,o);return{lods:[t],referenceBoundingBox:t.boundingBox,isEsriSymbolResource:!1,isWosr:!0,remove:e.remove}}const a=await(o.cache?o.cache.loadGLTF(i.url,o,o.usePBR):A(new S(o.streamDataRequester),i.url,o,o.usePBR)),u=t(a.model.meta,"ESRI_proxyEllipsoid");a.meta.isEsriSymbolResource&&r(u)&&-1!==a.meta.uri.indexOf("/RealisticTrees/")&&ee(a,u);const n=a.meta.isEsriSymbolResource?{usePBR:o.usePBR,isSchematic:!1,treeRendering:a.customMeta.esriTreeRendering,mrrFactors:[0,1,.2]}:{usePBR:o.usePBR,isSchematic:!1,mrrFactors:[0,1,.5]},l={...o.materialParamsMixin,treeRendering:a.customMeta.esriTreeRendering};if(null!=i.specifiedLodIndex){const e=X(a,n,l,i.specifiedLodIndex);let t=e[0].boundingBox;if(0!==i.specifiedLodIndex){t=X(a,n,l,0)[0].boundingBox}return{lods:e,referenceBoundingBox:t,isEsriSymbolResource:a.meta.isEsriSymbolResource,isWosr:!1,remove:a.remove}}const c=X(a,n,l);return{lods:c,referenceBoundingBox:c[0].boundingBox,isEsriSymbolResource:a.meta.isEsriSymbolResource,isWosr:!1,remove:a.remove}}function J(e){const t=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);if(t)return{fileType:"gltf",url:t[1],specifiedLodIndex:null!=t[4]?Number(t[4]):null};return e.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:e,specifiedLodIndex:null}:{fileType:"unknown",url:e,specifiedLodIndex:null}}function X(e,t,s,a){const u=e.model,n=i(),l=new Array,c=new Map,m=new Map;return u.lods.forEach(((e,i)=>{if(void 0!==a&&i!==a)return;const d={name:e.name,stageResources:{textures:new Array,materials:new Array,geometries:new Array},lodThreshold:r(e.lodThreshold)?e.lodThreshold:null,pivotOffset:[0,0,0],numberOfVertices:0,boundingBox:x()};l.push(d),e.parts.forEach((e=>{const i=e.material+(e.attributes.normal?"_normal":"")+(e.attributes.color?"_color":"")+(e.attributes.texCoord0?"_texCoord0":"")+(e.attributes.tangent?"_tangent":""),a=u.materials.get(e.material),l=r(e.attributes.texCoord0),f=r(e.attributes.normal),p=Y(a.alphaMode);if(!c.has(i)){if(l){if(r(a.textureColor)&&!m.has(a.textureColor)){const e=u.textures.get(a.textureColor),t={...e.parameters,preMultiplyAlpha:p!==P.Opaque};m.set(a.textureColor,new G(e.data,t))}if(r(a.textureNormal)&&!m.has(a.textureNormal)){const e=u.textures.get(a.textureNormal);m.set(a.textureNormal,new G(e.data,e.parameters))}if(r(a.textureOcclusion)&&!m.has(a.textureOcclusion)){const e=u.textures.get(a.textureOcclusion);m.set(a.textureOcclusion,new G(e.data,e.parameters))}if(r(a.textureEmissive)&&!m.has(a.textureEmissive)){const e=u.textures.get(a.textureEmissive);m.set(a.textureEmissive,new G(e.data,e.parameters))}if(r(a.textureMetallicRoughness)&&!m.has(a.textureMetallicRoughness)){const e=u.textures.get(a.textureMetallicRoughness);m.set(a.textureMetallicRoughness,new G(e.data,e.parameters))}}const o=a.color[0]**(1/U),n=a.color[1]**(1/U),d=a.color[2]**(1/U),x=a.emissiveFactor[0]**(1/U),g=a.emissiveFactor[1]**(1/U),b=a.emissiveFactor[2]**(1/U),h=r(a.textureColor)&&l?m.get(a.textureColor):null;c.set(i,new D({...t,transparent:p===P.Blend,textureAlphaMode:p,textureAlphaCutoff:a.alphaCutoff,diffuse:[o,n,d],ambient:[o,n,d],opacity:a.opacity,doubleSided:a.doubleSided,doubleSidedType:"winding-order",cullFace:a.doubleSided?V.None:V.Back,vertexColors:!!e.attributes.color,vertexTangents:!!e.attributes.tangent,normals:f?"default":"screenDerivative",castShadows:!0,receiveSSAO:!0,textureId:r(h)?h.id:void 0,colorMixMode:a.colorMixMode,normalTextureId:r(a.textureNormal)&&l?m.get(a.textureNormal).id:void 0,textureAlphaPremultiplied:r(h)&&!!h.params.preMultiplyAlpha,occlusionTextureId:r(a.textureOcclusion)&&l?m.get(a.textureOcclusion).id:void 0,emissiveTextureId:r(a.textureEmissive)&&l?m.get(a.textureEmissive).id:void 0,metallicRoughnessTextureId:r(a.textureMetallicRoughness)&&l?m.get(a.textureMetallicRoughness).id:void 0,emissiveFactor:[x,g,b],mrrFactors:[a.metallicFactor,a.roughnessFactor,t.mrrFactors[2]],isSchematic:!1,...s}))}const x=Z(e.indices||e.attributes.position.count,e.primitiveType),S=e.attributes.position.count,A=C(b,S);y(A,e.attributes.position,e.transform);const N=[[z.POSITION,{data:A.typedBuffer,size:A.elementCount,exclusive:!0}]],I=[[z.POSITION,x]];if(r(e.attributes.normal)){const t=C(b,S);o(n,e.transform),T(t,e.attributes.normal,n),N.push([z.NORMAL,{data:t.typedBuffer,size:t.elementCount,exclusive:!0}]),I.push([z.NORMAL,x])}if(r(e.attributes.tangent)){const t=C(h,S);o(n,e.transform),O(t,e.attributes.tangent,n),N.push([z.TANGENT,{data:t.typedBuffer,size:t.elementCount,exclusive:!0}]),I.push([z.TANGENT,x])}if(r(e.attributes.texCoord0)){const t=C(R,S);q(t,e.attributes.texCoord0),N.push([z.UV0,{data:t.typedBuffer,size:t.elementCount,exclusive:!0}]),I.push([z.UV0,x])}if(r(e.attributes.color)){const t=C(v,S);if(4===e.attributes.color.elementCount)e.attributes.color instanceof h?E(t,e.attributes.color,255):e.attributes.color instanceof v?$(t,e.attributes.color):e.attributes.color instanceof B&&E(t,e.attributes.color,1/256);else{K(t,255,255,255,255);const r=new M(t.buffer,0,4);e.attributes.color instanceof b?j(r,e.attributes.color,255):e.attributes.color instanceof M?Q(r,e.attributes.color):e.attributes.color instanceof w&&j(r,e.attributes.color,1/256)}N.push([z.COLOR,{data:t.typedBuffer,size:t.elementCount,exclusive:!0}]),I.push([z.COLOR,x])}const L=new _(N,I);d.stageResources.geometries.push(L),d.stageResources.materials.push(c.get(i)),l&&(r(a.textureColor)&&d.stageResources.textures.push(m.get(a.textureColor)),r(a.textureNormal)&&d.stageResources.textures.push(m.get(a.textureNormal)),r(a.textureOcclusion)&&d.stageResources.textures.push(m.get(a.textureOcclusion)),r(a.textureEmissive)&&d.stageResources.textures.push(m.get(a.textureEmissive)),r(a.textureMetallicRoughness)&&d.stageResources.textures.push(m.get(a.textureMetallicRoughness))),d.numberOfVertices+=S;const F=L.boundingInfo;r(F)&&(g(d.boundingBox,F.getBBMin()),g(d.boundingBox,F.getBBMax()))}))})),l}function Y(e){switch(e){case"BLEND":return P.Blend;case"MASK":return P.Mask;case"OPAQUE":case null:case void 0:return P.Opaque}}function Z(e,t){switch(t){case W.TRIANGLES:return L(e);case W.TRIANGLE_STRIP:return I(e);case W.TRIANGLE_FAN:return N(e)}}function ee(e,t){for(let r=0;r<e.model.lods.length;++r){const o=e.model.lods[r];e.customMeta.esriTreeRendering=!0;for(const i of o.parts){const o=i.attributes.normal;if(s(o))return;const x=i.attributes.position,g=x.count,h=p(),R=p(),B=p(),M=C(v,g),w=C(b,g),y=a(u(),i.transform);for(let s=0;s<g;s++){x.getVec(s,R),o.getVec(s,h),n(R,R,i.transform),l(B,R,t.center),c(B,B,t.radius);const a=B[2],u=m(B),p=Math.min(.45+.55*u*u,1);c(B,B,t.radius),n(B,B,y),d(B,B),r+1!==e.model.lods.length&&e.model.lods.length>1&&f(B,B,h,a>-1?.2:Math.min(-4*a-3.8,1)),w.setVec(s,B),M.set(s,0,255*p),M.set(s,1,255*p),M.set(s,2,255*p),M.set(s,3,255)}i.attributes.normal=w,i.attributes.color=M}}}export{H as fetch,X as gltfToEngineResources,J as parseUrl};
|
|
@@ -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"../../../../geometry.js";import{isSome as t}from"../../../../core/maybe.js";import{projectBuffer as i}from"../../../../geometry/projection.js";import{pathsToTriangulationInfo as o,CounterClockwiseMode as e}from"../../../../geometry/support/triangulationUtils.js";import{applyPerVertexElevationAlignment as n}from"./elevationAlignmentUtils.js";import{DRAPED_Z as s}from"../../terrain/OverlayRenderer.js";import{
|
|
5
|
+
import"../../../../geometry.js";import{isSome as t}from"../../../../core/maybe.js";import{projectBuffer as i}from"../../../../geometry/projection.js";import{pathsToTriangulationInfo as o,CounterClockwiseMode as e}from"../../../../geometry/support/triangulationUtils.js";import{applyPerVertexElevationAlignment as n}from"./elevationAlignmentUtils.js";import{DRAPED_Z as s}from"../../terrain/OverlayRenderer.js";import{Geometry as a}from"../../webgl-engine/lib/Geometry.js";import{VertexAttribute as r}from"../../webgl-engine/lib/VertexAttribute.js";import u from"../../../../geometry/Extent.js";import p from"../../../../geometry/Polygon.js";function c(i){const o=[[r.POSITION,i.indices]],e=[[r.POSITION,{size:3,data:i.attributeData.position,exclusive:!0}]];return t(i.attributeData.color)&&(e.push([r.COLOR,{size:4,data:i.attributeData.color,exclusive:!0}]),o.push([r.COLOR,new Uint32Array(i.indices.length)])),t(i.attributeData.uvMapSpace)&&(e.push([r.UVMAPSPACE,{size:4,data:i.attributeData.uvMapSpace,exclusive:!0}]),o.push([r.UVMAPSPACE,i.indices])),t(i.attributeData.boundingRect)&&(e.push([r.BOUNDINGRECT,{size:9,data:i.attributeData.boundingRect,exclusive:!0}]),o.push([r.BOUNDINGRECT,i.indices])),t(i.attributeData.mapPosition)&&(e.push([r.MAPPOS,{size:3,data:i.attributeData.mapPosition,exclusive:!0}]),o.push([r.MAPPOS,i.indices])),new a(e,o)}function l(i){const o=[[r.POSITION,i.indices],[r.UV0,i.indices]],e=[[r.POSITION,{size:3,data:i.attributeData.position,exclusive:!0}],[r.UV0,{size:2,data:i.attributeData.uv0,exclusive:!0}]];return t(i.attributeData.mapPosition)&&(e.push([r.MAPPOS,{size:3,data:i.attributeData.mapPosition,exclusive:!0}]),o.push([r.MAPPOS,i.indices])),new a(e,o)}function m(t){switch(t.type){case"extent":if(t instanceof u)return p.fromExtent(t);break;case"polygon":return t}return null}function d(t,i,s,a){const r=o(t.rings,t.hasZ,e.CCW_IS_HOLE),u=new Float64Array(r.position.length),p=n(r.position,t.spatialReference,0,u,0,r.position,0,r.position.length/3,i,s,a),c=null!=p;return{position:r.position,mapPosition:u,polygons:b(r.polygons,r.position,u),outlines:g(r.outlines,r.position,u),projectionSuccess:c,sampledElevation:p}}function f(t,n){const a=o(t.rings,!1,e.CCW_IS_HOLE),r=i(a.position,t.spatialReference,0,a.position,n,0,a.position.length/3);for(let i=2;i<a.position.length;i+=3)a.position[i]=s;return{position:a.position,polygons:b(a.polygons,a.position),outlines:g(a.outlines,a.position),projectionSuccess:r}}function g(t,i,o){const e=new Array;for(const{index:n,count:s}of t){if(s<=1)continue;const t=3*n,a=t+3*s;e.push({index:n,count:s,position:i.subarray(t,a),mapPosition:o?o.subarray(t,a):void 0})}return e}function b(t,i,o){const e=new Array;for(const{index:n,count:s,holeIndices:a,pathLengths:r}of t){if(s<=1)continue;const t=3*n,u=t+3*s,p=a.map((t=>t-n));e.push({index:n,count:s,holeIndices:p,pathLengths:r,position:i.subarray(t,u),mapPosition:o?o.subarray(t,u):void 0})}return e}export{c as createColorGeometry,l as createWaterGeometry,m as geometryAsPolygon,d as geometryToRenderInfo,f as geometryToRenderInfoDraped};
|