@arcgis/core 5.0.0-next.43 → 5.0.0-next.44
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/applications/Components/imageryUtils.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{f97a7cb367634353177d.js → 001a7a4cf6fe74432ed6.js} +1 -1
- package/assets/esri/core/workers/chunks/{324d66962aeec17d3e28.js → 1e0e7cef7ef947894bbe.js} +1 -1
- package/assets/esri/core/workers/chunks/20ad34f9d45c64392022.js +1 -0
- package/assets/esri/core/workers/chunks/23396a6318edf9264c1f.js +1 -0
- package/assets/esri/core/workers/chunks/{ad891ac388fa6c1c9b94.js → 2b34a010f76e5f289868.js} +1 -1
- package/assets/esri/core/workers/chunks/2ef4c0092c59a98a5532.js +1 -0
- package/assets/esri/core/workers/chunks/35272810c2ed04eb403d.js +1 -0
- package/assets/esri/core/workers/chunks/{d1f4152b2b8d47cbf586.js → 72fbee59d5d909615408.js} +1 -1
- package/assets/esri/core/workers/chunks/75c66e38bdc1c786c599.js +1 -0
- package/assets/esri/core/workers/chunks/7d3c2a063598bdd015e2.js +1 -0
- package/assets/esri/core/workers/chunks/897ce6fc9cefb1e14a64.js +1 -0
- package/assets/esri/core/workers/chunks/992e9bbdf9d3787ddb0e.js +1 -0
- package/assets/esri/core/workers/chunks/a2442549c5daf3653eb4.js +1 -0
- package/assets/esri/core/workers/chunks/a7cd795042ebb8585906.js +1 -0
- package/assets/esri/core/workers/chunks/{385cfd3087f00dbd1146.js → ca1c65eb7f5900c60170.js} +1 -1
- package/assets/esri/core/workers/chunks/cddce67919e13e2f365e.js +1 -0
- package/assets/esri/core/workers/chunks/e6784251bbb8b71ead93.js +1 -0
- package/assets/esri/core/workers/chunks/{96f798ee286b59396131.js → ea3cba01c60d9bc72719.js} +1 -1
- package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
- package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
- package/config.js +1 -1
- package/interfaces.d.ts +78 -2
- package/kernel.js +1 -1
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/WCSLayer.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/mixins/ImageryTileMixin.js +1 -1
- package/layers/mixins/RasterJobHandlerMixin.js +1 -1
- package/layers/ogc/wcsUtils.js +1 -1
- package/layers/raster/datasets/BaseRaster.js +5 -0
- package/layers/raster/datasets/CovJSONRaster.js +5 -0
- package/layers/raster/datasets/FunctionRaster.js +5 -0
- package/layers/raster/datasets/ImageAuxRaster.js +5 -0
- package/layers/raster/datasets/ImageServerRaster.js +5 -0
- package/layers/raster/datasets/InMemoryRaster.js +5 -0
- package/layers/raster/datasets/MRFRaster.js +5 -0
- package/layers/raster/datasets/RawBlockCache.js +5 -0
- package/layers/raster/datasets/TIFFRaster.js +5 -0
- package/layers/raster/datasets/WCSRaster.js +5 -0
- package/layers/raster/datasets/covJSONParser.js +5 -0
- package/layers/raster/datasets/multidimensionalUtils.js +5 -0
- package/layers/raster/datasets/pamParser.js +5 -0
- package/layers/raster/datasets/pixelReader.js +5 -0
- package/layers/raster/datasets/wcsCoverageParser.js +5 -0
- package/layers/raster/formats/Lerc.js +5 -0
- package/layers/raster/formats/Qb3.js +5 -0
- package/layers/raster/formats/RasterCodec.js +5 -0
- package/layers/raster/formats/TiffDecoder.js +5 -0
- package/layers/raster/functions/ArithmeticFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/ArithmeticFunctionArguments.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/AspectFunction.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/AspectFunctionArguments.js +1 -1
- package/layers/raster/functions/BandArithmeticFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/BandArithmeticFunctionArguments.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/BaseFunctionArguments.js +1 -1
- package/layers/raster/functions/BaseRasterFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/ClipFunction.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/ClipFunctionArguments.js +1 -1
- package/layers/raster/functions/ColormapFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/ColormapFunctionArguments.js +1 -1
- package/layers/raster/functions/ColormapToRGBFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/ColormapToRGBFunctionArguments.js +1 -1
- package/layers/raster/functions/CompositeBandFunction.js +5 -0
- package/layers/raster/functions/CompositeBandFunctionArguments.js +5 -0
- package/layers/raster/functions/ComputeChangeFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/ComputeChangeFunctionArguments.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/ContrastBrightnessFunction.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/ContrastBrightnessFunctionArguments.js +1 -1
- package/layers/raster/functions/ConvolutionFunction.js +5 -0
- package/layers/raster/functions/ConvolutionFunctionArguments.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/CurvatureFunction.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/CurvatureFunctionArguments.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/ExtractBandFunction.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/ExtractBandFunctionArguments.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/GrayscaleFunction.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/GrayscaleFunctionArguments.js +1 -1
- package/layers/raster/functions/HillshadeFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/HillshadeFunctionArguments.js +1 -1
- package/layers/raster/functions/LocalFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/LocalFunctionArguments.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/MaskFunction.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/MaskFunctionArguments.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/NDVIFunction.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/NDVIFunctionArguments.js +1 -1
- package/layers/raster/functions/RemapFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/RemapFunctionArguments.js +1 -1
- package/layers/raster/functions/ShadedReliefFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/ShadedReliefFunctionArguments.js +1 -1
- package/layers/raster/functions/SlopeFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/SlopeFunctionArguments.js +1 -1
- package/layers/raster/functions/StatisticsFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/StatisticsFunctionArguments.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/StatisticsHistogramFunction.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/StatisticsHistogramFunctionArguments.js +1 -1
- package/layers/raster/functions/StretchFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/StretchFunctionArguments.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/TableFunction.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/TableFunctionArguments.js +1 -1
- package/layers/raster/functions/bandIndexUtils.js +5 -0
- package/layers/raster/functions/changeDetectionUtils.js +5 -0
- package/layers/raster/functions/clipUtils.js +5 -0
- package/layers/raster/functions/conversionUtils.js +5 -0
- package/layers/raster/functions/convolutionUtils.js +5 -0
- package/layers/raster/functions/creators/createDataManagementFunctions.js +5 -0
- package/layers/raster/functions/creators/utils.js +5 -0
- package/layers/raster/functions/focalStatUtils.js +5 -0
- package/layers/raster/functions/localUtils.js +5 -0
- package/layers/raster/functions/pixelTransformUtils.js +5 -0
- package/layers/raster/functions/pixelUtils.js +5 -0
- package/layers/raster/functions/stretchUtils.js +5 -0
- package/layers/raster/functions/surfaceUtils.js +5 -0
- package/layers/raster/functions/vectorFieldUtils.js +5 -0
- package/layers/raster/transforms/BaseRasterTransform.js +5 -0
- package/layers/{support/rasterTransforms → raster/transforms}/GCSShiftTransform.js +1 -1
- package/layers/{support/rasterTransforms → raster/transforms}/IdentityTransform.js +1 -1
- package/layers/{support/rasterTransforms → raster/transforms}/PolynomialTransform.js +1 -1
- package/layers/save/imageryUtils.js +1 -1
- package/layers/support/PixelBlock.js +1 -1
- package/layers/support/RasterWorker.js +1 -1
- package/layers/support/imageryRendererUtils.js +1 -1
- package/layers/support/rasterFunctionUtils.js +1 -1
- package/package.json +1 -1
- package/renderers/VectorFieldRenderer.js +1 -1
- package/renderers/support/RasterSymbolizer.js +1 -1
- package/renderers/support/rasterRendererHelper.js +1 -1
- package/rest/locator/addressToLocations.js +1 -1
- package/rest/locator/addressesToLocations.js +1 -1
- package/rest/locator/suggestLocations.js +1 -1
- package/rest/networks/support/Association.js +1 -1
- package/smartMapping/raster/support/adapters/ImageryLayerAdapter.js +1 -1
- package/smartMapping/raster/support/adapters/ImageryTileLayerAdapter.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/imagery/RasterVFDisplayObject.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterRangeHighlightShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/MaskShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/RemapShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/math.js +1 -1
- package/views/2d/layers/ImageryLayerView2D.js +1 -1
- package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
- package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
- package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
- package/views/2d/layers/imagery/ImageryView2D.js +1 -1
- package/views/2d/layers/imagery/VectorFieldTileView2D.js +1 -1
- package/views/2d/layers/imagery/VectorFieldView2D.js +1 -1
- package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferLayout.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBufferView.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DrawParameters.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/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.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/WaterMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/Instance.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedBuffer.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/PerOriginData.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
- package/views/DOMContainer.js +1 -1
- package/views/GroundView.js +1 -1
- package/views/layers/ImageryLayerViewMixin.js +1 -1
- package/views/layers/ImageryTileLayerViewMixin.js +1 -1
- package/views/support/imageReprojection.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/BuildingExplorer/BuildingExplorerViewModel.js +1 -1
- package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
- package/widgets/CoordinateConversion.js +1 -1
- package/widgets/DirectLineMeasurement3D.js +1 -1
- package/widgets/DistanceMeasurement2D.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/ElevationProfile.js +1 -1
- package/widgets/Feature.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
- package/widgets/FeatureTable/support/GroupColumnTemplate.js +1 -1
- package/widgets/FeatureTable/support/TableTemplate.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/FeatureTemplates.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Legend.js +1 -1
- package/widgets/LineOfSight.js +1 -1
- package/widgets/Locate.js +1 -1
- package/widgets/OrientedImageryViewer/galleryUtils.js +1 -1
- package/widgets/OrientedImageryViewer/services/DepthImageService.js +1 -1
- package/widgets/PanoramicViewer/support/importUtils.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/ScaleBar.js +1 -1
- package/widgets/ScaleRangeSlider.js +1 -1
- package/widgets/Search/SearchResultRenderer.js +1 -1
- package/widgets/Search/SearchViewModel.js +1 -1
- package/widgets/Search/types.js +1 -1
- package/widgets/Search.js +1 -1
- package/widgets/ShadowCast.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/assets/esri/core/workers/chunks/1f6ead46b723630db897.js +0 -1
- package/assets/esri/core/workers/chunks/3a16347e17312556e02c.js +0 -1
- package/assets/esri/core/workers/chunks/478def691ae6763686f3.js +0 -1
- package/assets/esri/core/workers/chunks/4c4a55be41ba105c091c.js +0 -1
- package/assets/esri/core/workers/chunks/4cbf5a97b2b3c6553f6f.js +0 -1
- package/assets/esri/core/workers/chunks/646f58b69d2354f1ef27.js +0 -1
- package/assets/esri/core/workers/chunks/93d11075f65a5b6625ea.js +0 -1
- package/assets/esri/core/workers/chunks/9f2a8445a5848502c7e7.js +0 -1
- package/assets/esri/core/workers/chunks/a1b08aab73747f4e7e25.js +0 -1
- package/assets/esri/core/workers/chunks/ba59568e748f0ba53b78.js +0 -1
- package/assets/esri/core/workers/chunks/f21cb5b34d4d1e3af1a9.js +0 -1
- package/assets/esri/core/workers/chunks/f93f0586ce10cb5d98b3.js +0 -1
- package/layers/support/rasterDatasets/BaseRaster.js +0 -5
- package/layers/support/rasterDatasets/CovJSONRaster.js +0 -5
- package/layers/support/rasterDatasets/FunctionRaster.js +0 -5
- package/layers/support/rasterDatasets/ImageAuxRaster.js +0 -5
- package/layers/support/rasterDatasets/ImageServerRaster.js +0 -5
- package/layers/support/rasterDatasets/InMemoryRaster.js +0 -5
- package/layers/support/rasterDatasets/MRFRaster.js +0 -5
- package/layers/support/rasterDatasets/RawBlockCache.js +0 -5
- package/layers/support/rasterDatasets/TIFFRaster.js +0 -5
- package/layers/support/rasterDatasets/WCSRaster.js +0 -5
- package/layers/support/rasterDatasets/covJSONParser.js +0 -5
- package/layers/support/rasterDatasets/multidimensionalUtils.js +0 -5
- package/layers/support/rasterDatasets/pamParser.js +0 -5
- package/layers/support/rasterDatasets/pixelReader.js +0 -5
- package/layers/support/rasterDatasets/wcsCoverageParser.js +0 -5
- package/layers/support/rasterFormats/Lerc.js +0 -5
- package/layers/support/rasterFormats/Qb3.js +0 -5
- package/layers/support/rasterFormats/RasterCodec.js +0 -5
- package/layers/support/rasterFormats/TiffDecoder.js +0 -5
- package/layers/support/rasterFunctions/ArithmeticFunction.js +0 -5
- package/layers/support/rasterFunctions/BandArithmeticFunction.js +0 -5
- package/layers/support/rasterFunctions/BaseRasterFunction.js +0 -5
- package/layers/support/rasterFunctions/ColormapFunction.js +0 -5
- package/layers/support/rasterFunctions/ColormapToRGBFunction.js +0 -5
- package/layers/support/rasterFunctions/CompositeBandFunction.js +0 -5
- package/layers/support/rasterFunctions/CompositeBandFunctionArguments.js +0 -5
- package/layers/support/rasterFunctions/ComputeChangeFunction.js +0 -5
- package/layers/support/rasterFunctions/ConvolutionFunction.js +0 -5
- package/layers/support/rasterFunctions/ConvolutionFunctionArguments.js +0 -5
- package/layers/support/rasterFunctions/HillshadeFunction.js +0 -5
- package/layers/support/rasterFunctions/LocalFunction.js +0 -5
- package/layers/support/rasterFunctions/RemapFunction.js +0 -5
- package/layers/support/rasterFunctions/ShadedReliefFunction.js +0 -5
- package/layers/support/rasterFunctions/SlopeFunction.js +0 -5
- package/layers/support/rasterFunctions/StatisticsFunction.js +0 -5
- package/layers/support/rasterFunctions/StretchFunction.js +0 -5
- package/layers/support/rasterFunctions/bandIndexUtils.js +0 -5
- package/layers/support/rasterFunctions/changeDetectionUtils.js +0 -5
- package/layers/support/rasterFunctions/clipUtils.js +0 -5
- package/layers/support/rasterFunctions/conversionUtils.js +0 -5
- package/layers/support/rasterFunctions/convolutionUtils.js +0 -5
- package/layers/support/rasterFunctions/creators/createDataManagementFunctions.js +0 -5
- package/layers/support/rasterFunctions/creators/utils.js +0 -5
- package/layers/support/rasterFunctions/focalStatUtils.js +0 -5
- package/layers/support/rasterFunctions/localUtils.js +0 -5
- package/layers/support/rasterFunctions/pixelTransformUtils.js +0 -5
- package/layers/support/rasterFunctions/pixelUtils.js +0 -5
- package/layers/support/rasterFunctions/stretchUtils.js +0 -5
- package/layers/support/rasterFunctions/surfaceUtils.js +0 -5
- package/layers/support/rasterFunctions/vectorFieldUtils.js +0 -5
- package/layers/support/rasterTransforms/BaseRasterTransform.js +0 -5
- /package/assets/esri/layers/{support/rasterFormats → raster/formats}/lerc-wasm.wasm +0 -0
- /package/assets/esri/layers/{support/rasterFormats → raster/formats}/qb3-wasm.wasm +0 -0
- /package/layers/{support/rasterDatasets → raster/datasets}/DBFParser.js +0 -0
- /package/layers/{support/rasterDatasets → raster/datasets}/EphemeralBlockCache.js +0 -0
- /package/layers/{support/rasterDatasets → raster/datasets}/RasterFactory.js +0 -0
- /package/layers/{support/rasterDatasets → raster/datasets}/byteStreamUtils.js +0 -0
- /package/layers/{support/rasterDatasets → raster/datasets}/datasetUtils.js +0 -0
- /package/layers/{support/rasterDatasets → raster/datasets}/multipartParser.js +0 -0
- /package/layers/{support/rasterDatasets → raster/datasets}/wcsCapabilitiesParser.js +0 -0
- /package/layers/{support/rasterDatasets → raster/datasets}/xmlUtilities.js +0 -0
- /package/layers/{support/rasterFormats → raster/formats}/ImageCanvasDecoder.js +0 -0
- /package/layers/{support/rasterFormats → raster/formats}/JpgPlus.js +0 -0
- /package/layers/{support/rasterFormats → raster/formats}/Lzw.js +0 -0
- /package/layers/{support/rasterFormats → raster/formats}/Raw.js +0 -0
- /package/layers/{support/rasterFormats → raster/formats}/pixelRangeUtils.js +0 -0
- /package/layers/{support/rasterFormats → raster/formats}/tiffTag.js +0 -0
- /package/layers/{support/rasterFormats → raster/formats}/utils.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/colormaps.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/creators/createAppearenceFunctions.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/creators/createBandIndexFunctions.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/creators/createChangeFunctions.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/creators/createConversionFunctions.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/creators/createLocalFunctions.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/creators/createMultiRasterAnalysisFunctions.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/creators/createStatisticsFunctions.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/creators/createSurfaceFunctions.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/customBandIndexUtils.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/mirror.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/rasterFunctionHelper.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/rasterFunctionSchema.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/rasterProjectionHelper.js +0 -0
- /package/layers/{support/rasterTransforms → raster/transforms}/utils.js +0 -0
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Color.js";import{linearize as t}from"../../../../colorUtils.js";import"../../../../core/has.js";import{deg2rad as r}from"../../../../core/mathUtils.js";import{releaseMaybe as o}from"../../../../core/maybe.js";import{isPromiseLike as n}from"../../../../core/promiseUtils.js";import{normalFromMat4 as a,fromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromTranslation as l,multiply as c,invert as u,getTranslation as m}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as f,IDENTITY as p,clone as h}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as d}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{h as g,i as x,j as _,p as y,t as T,n as b,c as v,e as w,f as C,g as j}from"../../../../chunks/vec32.js";import{create as M,fromValues as R,ONES as A,ZEROS as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as S}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{canProjectWithoutEngine as I}from"../../../../geometry/projectionUtils.js";import{computeTranslationToOriginAndRotation as B}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as U}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as E}from"../../../../geometry/projection/projectVectorToVector.js";import{fromBuffer as F,create as O,intersectsClippingArea as V}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as $}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as G,getContinuousIndexArray as D}from"../../../../geometry/support/Indices.js";import L from"../../../../geometry/support/MeshComponent.js";import N from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import H from"../../../../geometry/support/MeshTextureTransform.js";import{isRelativeVertexSpace as k,isAbsoluteVertexSpace as z}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{equals as q,isPlateCarree as W}from"../../../../geometry/support/spatialReferenceUtils.js";import{t as Y}from"../../../../chunks/vec3.js";import{transformNormal as K,transformVectorENUPlateCarree as J,transformVectorWMPlateCarree as Q,projectNormalToPCPF as X,transformTangent as Z,projectTangentToPCPF as ee}from"../../../../geometry/support/meshUtils/projection.js";import{projectMeshVertexPositions as te}from"../../../../geometry/support/meshUtils/projectMeshVertexPositions.js";import{getEmissiveMode as re}from"../../../../symbols/support/materialUtils.js";import{isEncodedMeshTexture as oe}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as ne}from"../../glTF/internal/TextureTransformUtils.js";import{defaultSymbolLayerMemoryComplexity as ae}from"./defaultSymbolComplexity.js";import{perObjectElevationAligner as se}from"./ElevationAligners.js";import{needsElevationUpdates3D as ie,evaluateElevationInfoAtPoint as le}from"./elevationAlignmentUtils.js";import{Graphics3DMeshObject3DGraphicLayer as ce}from"./Graphics3DMeshObject3DGraphicLayer.js";import{Object3DEdgeState as ue}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as me,nanFallbackColor as fe}from"./Graphics3DSymbolLayer.js";import{MaterialInfoCache as pe,MeshFastUpdateProcessor as he}from"./MeshFastUpdateProcessor.js";import{SymbolComplexity as de}from"./SymbolComplexity.js";import{hasEdges as ge,createMaterial as xe}from"../support/edgeUtils.js";import{debugFlags as _e}from"../../support/debugFlags.js";import{Attribute as ye}from"../../webgl-engine/lib/Attribute.js";import{Geometry as Te}from"../../webgl-engine/lib/Geometry.js";import{ManagedTexture as be}from"../../webgl-engine/lib/ManagedTexture.js";import{Object3D as ve}from"../../webgl-engine/lib/Object3D.js";import{DefaultMaterial as we}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as Ce}from"../../webgl-engine/materials/NativeLineMaterial.js";import{useSchematicPBR as je,advancedMRRFactors as Me,schematicMRRFactors as Re}from"../../webgl-engine/materials/pbrUtils.js";const Ae=["mesh"];class Pe extends me{constructor(e,t,r,o){super(e,t,r,o,We(t)),this._materialInfoCache=new pe,this._fastUpdateProcessor=new he,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){_e.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new Ce({color:[1,0,1,1]}),this._debugTangentNormalMaterial=new Ce({color:[1,.5,0,1]}),this._debugFaceNormalMaterial=new Ce({color:[0,1,1,1]})),this.updateComplexity()}destroy(){super.destroy(),this._textures.forEach(e=>e.unload()),this._context.stage.removeTextures(Array.from(this._textures.values())),this._materialInfoCache.clear(),this._textures.clear(),this._fastUpdateProcessor.destroy()}get materials(){return this._materialInfoCache.materials}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,Ae,"fill on mesh-3d"))return null;const r=this.createElevationContextForGraphic(t),o=e.renderingInfo;return this._createAs3DShape(t,o,r,t.uid)}onRemoveGraphic(e){this._fastUpdateProcessor.onRemoveGraphic(e,this._materialInfoCache)}layerOpacityChanged(e,t){const r=this._getLayerOpacity();this._updateMaterialParameters(e=>{e.material.setParameters({layerOpacity:r});const t=e.material.parameters;this._setMaterialTextureAlphaMode(t,e)}),e?.forEach(e=>t(e)?.layerOpacityChanged(r,this._context.isAsync))}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,ie)}slicePlaneEnabledChanged(e,t){return this._updateMaterialParameters(({material:e})=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),e?.forEach(e=>t(e)?.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)),!0}physicalBasedRenderingChanged(){const e=this._usePBR();return this._updateMaterialParameters(({material:t})=>t.setParameters({usePBR:e})),!0}updateTransform(e,t,r,o){if(!e.fastTransformUpdatesAllowed)return!1;const n=e.fastTransformUpdatesEnabled;switch(o){case 0:if(n)return!0;break;case 1:if(!n)return!0;break;default:if(!n)return!!this.updateTransform(e,t,r,0)&&(e.autoDisableFastTransformUpdates(()=>this.updateTransform(e,t,r,1)),!0)}const a=this._context.renderCoordsHelper.spatialReference,s=tt,{origin:i,transform:l}=r;if(!B(t,g(Je,i.x,i.y,i.z??0),s,a))return!1;switch(o){case 0:this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context);break;case 1:this._fastUpdateProcessor.disable(e,this._materialInfoCache);break;case 2:e.updateFastLocalOrigin(s,l,this._context.localOriginFactory)}const{elevationContext:c}=e;c.centerInElevationSR=this._getCenterInElevationSR(s);const{elevationProvider:u,renderCoordsHelper:m}=this._context,f=(e,t)=>le(e,u,c,m,t);return e.alignedSampledElevation=se(e,c,u.spatialReference,f,m,s),e.updateTransform(s,l,this._context.isAsync),e.updateAutoDisableFastTransformUpdates(()=>this.updateTransform(e,t,r,1)),!0}computeComplexity(){if(!this._textures||0===this._textures.size)return super.computeComplexity();let e=0;for(const o of this._textures.values())e+=o.usedMemory;const t={...ae(this.symbol,this.symbolLayer),resourceBytes:e},r=ge(this.symbolLayer)?2:0;return new de({drawCallsPerFeature:r,memory:t})}_requiresSymbolVertexColors(){return this._hasDrivenColorOrOpacity}_materialPropertiesDefault(e,t){const r=this._requiresSymbolVertexColors(),o=!!e.vertexAttributes.color,n=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:r,hasVertexColors:o,hasVertexTangents:n,uid:`vc:${o},vt:${n},vct${t},svc:${r}`}}_materialProperties(e,t,r){const o=this._materialPropertiesDefault(e,r);if(!t.material)return o;const{color:n,colorTexture:a,colorTextureTransform:s,normalTexture:i,normalTextureTransform:l,doubleSided:c,alphaCutoff:u,alphaMode:m}=t.material,f=ke(n),p=ke(a),h=ze(s),d=ke(i),g=ze(l);if(o.color=n,o.colorTexture=a,o.normalTexture=i,o.uid=`${o.uid},cmuid:${f},ctmuid:${p},cttuid:${h},ntmuid:${d},nttuid:${g},ds:${c},ac:${u},am:${m}`,t.material instanceof N){const{metallic:e,roughness:r,metallicRoughnessTexture:n,metallicRoughnessTextureTransform:a,emissiveColor:i,emissiveStrength:c,emissiveTexture:u,emissiveTextureTransform:m,occlusionTexture:f,occlusionTextureTransform:p}=t.material,h=ke(n),d=ze(a),g=ke(i),x=ke(u),_=ze(m),y=ke(f),T=ze(p);o.uid=`${o.uid},mrm:${e},mrr:${r},mrt:${h},mrtt:${d},emuid:${g},ems:${c},etmuid:${x},ett:${_},otmuid:${y},ott:${T}`,o.metallic=e,o.roughness=r,o.metallicRoughnessTexture=n,o.emissiveColor=i,o.emissiveStrength=c,o.emissiveTexture=u,o.occlusionTexture=f,o.colorTextureTransform=$e(s),o.normalTextureTransform=$e(l),o.emissiveTextureTransform=$e(m),o.occlusionTextureTransform=$e(p),o.metallicRoughnessTextureTransform=$e(a)}return o}_getInternalTexture(e,t=!1,r=1){const a=He(e);if(!a)return null;const s=`${e.contentHash}/${r}`;let i=this._textures.get(s);if(i){const e=this._context.stage.renderView.textures;let t=null;const r=e.acquire(i.id);return null==r||n(r)||(i.events.on("unloaded",()=>t=o(t)),t=r),i}let l=null;const c=this._context.stage.renderView.renderingContext.parameters.maxMaxAnisotropy,u={wrap:Ge(e.wrap),noUnpackFlip:!0,maxAnisotropy:c,mipmap:c>1};return oe(a)?(l=a.data,u.preMultiplyAlpha=!1,u.encoding=a.encoding):(l=a,u.preMultiplyAlpha=1!==r,u.compressionOptions=t?{compressionTracker:this._context.compressionTracker,compressionCallback:()=>this.updateComplexity()}:void 0),i=new be(l,u),this._textures.set(s,i),i.events.on("loaded",()=>this.updateComplexity()),i.load(this._context.stage.renderView.renderingContext),this._context.stage.addTexture(i),i.events.on("unloaded",()=>{this._textures.delete(s)}),i}_setInternalMaterialTextureParameters(r,o){if(null!=r.colorTexture){const e=1!==o.textureAlphaMode,t=this._getInternalTexture(r.colorTexture,e,o.textureAlphaMode);t?(o.textureId=t.id,o.textureAlphaPremultiplied=!!t.parameters.preMultiplyAlpha):o.textureId=void 0}if(r.normalTexture&&(o.normalTextureId=this._getInternalTexture(r.normalTexture)?.id),r.emissiveColor){const n=e.toUnitRGB(r.emissiveColor);o.emissiveBaseColor=R(t(n[0]),t(n[1]),t(n[2]))}r.emissiveStrength&&(o.emissiveStrengthKHR=r.emissiveStrength),r.emissiveTexture&&(o.emissiveTextureId=this._getInternalTexture(r.emissiveTexture)?.id),r.occlusionTexture&&(o.occlusionTextureId=this._getInternalTexture(r.occlusionTexture,!0)?.id),r.metallicRoughnessTexture&&(o.metallicRoughnessTextureId=this._getInternalTexture(r.metallicRoughnessTexture,!0)?.id)}_setInternalMaterialParameters(e,t,r){null!=e.color&&Ne(e.color,t,r),this._setInternalMaterialTextureParameters(e,t),t.colorTextureTransformMatrix=ne(e.colorTextureTransform),t.normalTextureTransformMatrix=ne(e.normalTextureTransform);const o=null!=e.normalTextureTransform?.scale?e.normalTextureTransform?.scale:d;t.scale=[o[0],o[1]],t.occlusionTextureTransformMatrix=ne(e.occlusionTextureTransform),t.emissiveTextureTransformMatrix=ne(e.emissiveTextureTransform),t.metallicRoughnessTextureTransformMatrix=ne(e.metallicRoughnessTextureTransform)}_setExternalMaterialParameters(t,r=this._materialColor){const o=this._drivenProperties.color,n=this._drivenProperties.opacity;if(o)t.externalColor=S;else{const o=r??null;if(o){const r=e.toUnitRGBA(o);n&&(r[3]=1),t.externalColor=r}else t.externalColor=fe}t.colorMixMode=this.symbolLayer.material?.colorMixMode??"multiply",t.castShadows=!!this.symbolLayer.castShadows,t.emissiveStrengthFromSymbol=this.symbolLayer?.material?.emissive?.strength??1,t.emissiveSource=re(this.symbolLayer?.material?.emissive?.source??"emissive")}_getOrCreateMaterial(t,r){const o=r.material?.color,n=r.material?.colorTexture,a=r.material?.alphaMode,s="blend"===a,i=!("opaque"===a)&&(Le(t)||null!=o&&o.a<1||n?.transparent||s),l=this._materialProperties(t,r,i),c=this._materialInfoCache.byUid(l.uid);if(c)return this._setInternalMaterialTextureParameters(l,c.material.parameters),c.material;const u={uid:l.uid,material:null,isComponentTransparent:i,alphaMode:r.material?r.material.alphaMode:"opaque"},m=je({normalTexture:l.normalTexture,metallicRoughnessTexture:l.metallicRoughnessTexture,metallicFactor:l.metallic,roughnessFactor:l.roughness,emissiveTexture:l.emissiveTexture,emissiveFactor:e.toUnitRGB(l.emissiveColor),occlusionTexture:l.occlusionTexture}),f={usePBR:this._usePBR(),isSchematic:m,hasVertexColors:l.hasVertexColors,hasSymbolColors:l.hasSymbolVertexColors,hasVertexTangents:l.hasVertexTangents,ambient:P,diffuse:A,opacity:1,doubleSided:!0,doubleSidedType:"winding-order",cullFace:0,layerOpacity:this._getLayerOpacity(),hasSlicePlane:this._context.slicePlaneEnabled,drivenOpacity:this.needsDrivenTransparentPass||u.isComponentTransparent};f.mrrFactors=m?Re:[l.metallic,l.roughness,Me[2]],r.material&&(f.doubleSided=r.material.doubleSided,f.cullFace=r.material.doubleSided?0:2,f.textureAlphaCutoff=r.material.alphaCutoff),this._setExternalMaterialParameters(f),this._setMaterialTextureAlphaMode(f,u),this._setInternalMaterialParameters(l,f,u);const p=new we(f,this._context);return u.material=p,this._materialInfoCache.set(l.uid,u),p}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchColor(e,t)}_preparePatchColor(e,t){if(!t.material||"partial"!==t.material.type)return;const r=t.material.diff;if(!r.color||"complete"!==r.color.type||null==r.color.newValue||null==r.color.oldValue)return;const o=r.color.newValue;delete r.color,e.symbolLayerStatePatches.push(()=>{this._updateMaterialParameters(e=>{const t=e.material.parameters;this._setExternalMaterialParameters(t,o),this._setMaterialTextureAlphaMode(t,e),e.material.setParameters({externalColor:t.externalColor})})})}_usePBR(){return this._context.physicalBasedRenderingEnabled}_setMaterialTextureAlphaMode(e,t){if("auto"===t.alphaMode){const r=this.needsDrivenTransparentPass||t.isComponentTransparent||(e.layerOpacity??1)<1||(e.opacity??1)<1||(e.externalColor?.[3]??1)<1;e.textureAlphaMode=r?3:1}else e.textureAlphaMode="opaque"===t.alphaMode?1:"mask"===t.alphaMode?2:0}_createFaceDebugNormals(e,t){const r=t.length,o=e.spatialReference.isGeographic?20015077/180:1,n=.1*Math.max(e.extent.width*o,e.extent.height*o,e.extent.zmax-e.extent.zmin),s=[],l=[],c=t[0].transformation,u=a(i(),c);for(let a=0;a<r;a++){const e=t[a].attributes.get("position");if(!e)continue;const r=e.data,o=e.indices;for(let t=0;t<o.length;t+=3)Ve(r,o,t,Ze),Oe(r,o,t,Je,Qe,Xe),x(Je,Je,Qe),x(Je,Je,Xe),_(Je,Je,1/3),y(Je,Je,c),s.push(...Je),T(Ze,Ze,u),b(Ze,Ze),v(Je,Je,Ze,n),s.push(...Je),l.push(l.length),l.push(l.length)}return s.length?new Te(this._debugFaceNormalMaterial,[["position",new ye(s,l,3,!0)]],null,2):null}_createPerVertexDebugVectors(e,t,r,o,n){const l=t.length,c=e.spatialReference.isGeographic?20015077/180:1,u=.1*n*Math.max(e.extent.width*c,e.extent.height*c,e.extent.zmax-e.extent.zmin),m=[],f=[],p=t[0].transformation,h=a(i(),p);"tangent"===r&&s(h,p);for(let a=0;a<l;a++){const e=t[a],o=e.attributes.get("position"),n=e.attributes.get(r);if(!o||!n)continue;const s=o.data,i=o.indices,l=n.data,c=n.indices;for(let t=0;t<i.length;t++){const e=3*i[t],r=c[t]*n.stride;g(Je,s[e+0],s[e+1],s[e+2]),y(Je,Je,p),m.push(...Je),g(Qe,l[r+0],l[r+1],l[r+2]),T(Qe,Qe,h),b(Qe,Qe),v(Je,Je,Qe,u),m.push(...Je),f.push(f.length),f.push(f.length)}}return m.length?new Te(o,[["position",new ye(m,f,3,!0)]],null,2):null}_createAs3DShape(e,t,r,o){const n=e.geometry;if("mesh"!==n.type)return null;const a=this._createGeometryInfo(n,t,o);if(null==a)return null;const{geometries:s,objectTransformation:i}=a;if(_e.DRAW_MESH_GEOMETRY_NORMALS){const e=this._createPerVertexDebugVectors(n,s,"normal",this._debugVertexNormalMaterial,1),t=this._createPerVertexDebugVectors(n,s,"tangent",this._debugTangentNormalMaterial,.5),r=this._createFaceDebugNormals(n,s);e&&s.push(e),t&&s.push(t),r&&s.push(r)}const l=this._context.layerViewUid,c=new ve({geometries:s,layerViewUid:l,graphicUid:o,isElevationSource:!0});c.transformation=i;const u=xe(this.symbolLayer,{opacity:this._getLayerOpacity()}),m=u?new ue(s[0].material,u,this._context.slicePlaneEnabled):null,f=new ce(this,c,null,se,r,m);this._fastUpdateProcessor.onAddGraphic(),f.needsElevationUpdates=ie(r.mode),f.useObjectOriginAsAttachmentOrigin=!0,f.fastTransformUpdatesAllowed=this._fastTransformUpdatesAllowed(n),r.centerInElevationSR=this._getCenterInElevationSR(c.transformation);const{elevationProvider:p,renderCoordsHelper:h}=this._context,d=(e,t)=>le(e,p,r,h,t);return f.alignedSampledElevation=se(f,r,p.spatialReference,d,h),f}_fastTransformUpdatesAllowed(e){const{vertexSpace:t,spatialReference:r}=e;if(!k(t))return!1;const{type:o}=t,{view:n}=this._context.graphicsCoreOwner,{viewingMode:a}=n.state,s=n.spatialReference;return 1===a&&"local"===o||2===a&&q(s,r)&&"georeferenced"===o&&!r.isGeographic}_getElevationSR(){return this._context.elevationProvider.spatialReference??null}_getCenterInElevationSR(e){const t=M(),r=g(nt,e[12],e[13],e[14]);return E(r,this._context.renderCoordsHelper.spatialReference,t,this._getElevationSR()),t}_passthroughReprojectionInfo(e){return 0===e.reprojection&&!!e.objectTransformation}_createPositionBuffer(e,t){const r=e.vertexAttributes.position;let o,n=r;if(0===t.reprojection)return{position:n,georeferencedPositionBuffer:o};const a=1===t.reprojection?t.transformBeforeProject:null;a&&(n=Y(new Float64Array(n.length),n,a));const{normal:s,tangent:i}=e.vertexAttributes;this._passthroughReprojectionInfo(t)||!s&&!i||(o=n);const l=n===r||n===o?new Float64Array(n.length):n;return U(n,e.spatialReference,0,l,this._context.renderCoordsHelper.spatialReference,0),{position:l,georeferencedPositionBuffer:o}}_createNormalBuffer(e,t,r,o){const n=e.vertexAttributes.normal;if(null==n)return null;let a=n;const s=1===o.reprojection?o.transformBeforeProject:null;s&&(a=K(a,new Float32Array(a.length),s));const i=this._context.graphicsCoreOwner.view.viewingMode;if(0===o.reprojection)return a;if("local"===i){if(!W(this._context.renderCoordsHelper.spatialReference))return a;if(null==r)return null;if(e.spatialReference.isGeographic){const e=a===n?new Float32Array(a.length):a;return J(a,0,r,e)}if(e.spatialReference.isWebMercator){const e=a===n?new Float32Array(a.length):a;return Q(a,0,r,e)}return a}if(null==r)return null;const l=a===n?new Float32Array(a.length):a,c=this._context.renderCoordsHelper.spatialReference;return X(a,r,e.spatialReference,t,c,l)}_createTangentBuffer(e,t,r,o){const n=e.vertexAttributes.tangent;if(null==n)return null;let a=n;const s=1===o.reprojection?o.transformBeforeProject:null;s&&(a=Z(a,new Float32Array(a.length),s));const i=this._context.graphicsCoreOwner.view.viewingMode;if(0===o.reprojection)return a;if("local"===i){if(!W(this._context.renderCoordsHelper.spatialReference))return a;if(null==r)return null;if(e.spatialReference.isGeographic){const e=a===n?new Float32Array(a.length):a;return J(a,1,r,e)}if(e.spatialReference.isWebMercator){const e=a===n?new Float32Array(a.length):a;return Q(a,1,r,e)}return a}if(null==r)return null;const l=a===n?new Float32Array(a.length):a,c=this._context.renderCoordsHelper.spatialReference;return ee(a,r,e.spatialReference,t,c,l)}_createSymbolColorBuffer(e){return this._requiresSymbolVertexColors()?new Uint8Array(this._getDrivenUInt8ColorWithNaNSupport(e,this._materialColor,!0)):null}_createBuffers(e,t){const r=e.vertexAttributes&&e.vertexAttributes.position;if(!r)return this.logger.warn("Mesh geometry must contain position vertex attributes"),null;const o=e.vertexAttributes.normal,n=e.vertexAttributes.uv,a=e.vertexAttributes.tangent;if(o&&o.length!==r.length)return this.logger.warn("Mesh normal vertex buffer must contain the same number of elements as the position buffer"),null;if(a&&a.length/4!=r.length/3)return this.logger.warn("Mesh tangent vertex buffer must contain the same number of elements as the position buffer"),null;if(n&&n.length/2!=r.length/3)return this.logger.warn("Mesh uv vertex buffer must contain the same number of elements as the position buffer"),null;const s=this._computeReprojectionInfo(e),{position:i,georeferencedPositionBuffer:l}=this._createPositionBuffer(e,s),c=qe(e),u=this._createSymbolColorBuffer(t),m=this._createNormalBuffer(e,i,l,s),p=this._createTangentBuffer(e,i,l,s),h=n,{transformation:d,position:g,normal:x,tangent:_}=this._passthroughReprojectionInfo(s)?{transformation:s.objectTransformation,position:i,normal:m,tangent:p}:this._transformOriginLocal(e,i,m,p);return{positionBuffer:g,normalBuffer:x,tangentBuffer:_,uvBuffer:h,colorBuffer:c,symbolColorBuffer:u,objectTransformation:d,geometryTransformation:0===s.reprojection&&s.geometryTransformation?s.geometryTransformation:f()}}_computeReprojectionInfo(e){const{vertexSpace:t}=e,r="georeferenced"===t.type?q(this._context.renderCoordsHelper.spatialReference,e.spatialReference)?0:1:0;if(z(t))return{reprojection:r};const o=t.origin,n=f(),a=e.transform?.localMatrix??p;if(0===r){B(e.spatialReference,o,n,this._context.renderCoordsHelper.spatialReference);return{reprojection:r,objectTransformation:n,geometryTransformation:h(a)}}const s=l(f(),o);return c(s,s,a),{reprojection:r,transformBeforeProject:s}}_transformOriginLocal(e,t,r,o){const n=this._context.renderCoordsHelper.spatialReference,a=e.origin;Ke[0]=a.x,Ke[1]=a.y,Ke[2]=a.z??0;const s=f();B(e.spatialReference,Ke,s,n),u(et,s);const{position:i,normal:l,tangent:c}=e.vertexAttributes,m=t===i?new Float64Array(t.length):t;Y(m,t,et);const p=r?r===l?new Float32Array(r.length):r:null,h=o?o===c?new Float32Array(o.length):o:null;return r&&p&&K(r,p,et),o&&h&&Z(o,h,et),{transformation:s,position:m,normal:p,tangent:h}}_validateFaces(e,t){const r=e.vertexAttributes.position.length/3,o=t.faces;if(o){let e=-1;for(let t=0;t<o.length;t++){const r=o[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}_isOutsideClippingArea(e){if(!this._context.clippingExtent)return!1;const t=e.vertexAttributes?.position;if(!t)return!1;const r=this._context.elevationProvider.spatialReference,o=te(e,r??e.spatialReference);return!!o&&(F(o,rt),!V(rt,this._context.clippingExtent))}_createGeometryInfo(e,t,r){if(!I(e.spatialReference,this._context.renderCoordsHelper.spatialReference))return this.logger.warn("Geometry spatial reference is not compatible with the view"),null;if(!this._validateVertexSpace(e))return null;if(this._isOutsideClippingArea(e))return null;const o=this._createBuffers(e,t);if(null==o)return null;const{positionBuffer:n,uvBuffer:a,colorBuffer:s,symbolColorBuffer:i,normalBuffer:l,tangentBuffer:c,objectTransformation:u,geometryTransformation:f}=o,p=e.components??ot,h=new Array;let d=!1;const g=m(Je,u),x=this._context.localOriginFactory.getOrigin(g);for(const m of p){if(!this._validateFaces(e,m))return null;const t=Ie(e,m);if(0===t.length)continue;const o=Be(n,l,m,t);o.didFlipNormals&&(d=!0);const u=[["position",new ye(n,t,3,!0)],["normal",new ye(o.normals,o.indices,3,!0)]];s&&u.push(["color",new ye(s,t,4,!0)]),i&&u.push(["symbolColor",new ye(i,G(t.length),4,!0)]),a&&u.push(["uv0",new ye(a,t,2,!0)]),c&&u.push(["tangent",new ye(c,t,4,!0)]);const p=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:r,layerViewUid:this._context.layerViewUid}),g=this._getOrCreateMaterial(e,m),_=new Te(g,u,null,0,p);_.transformation=f,_.localOrigin=x,h.push(_)}return d&&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:h,objectTransformation:u}}_updateMaterialParameters(e){this._materialInfoCache.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachClonedMaterial((e,t)=>{t.setParameters(e.parameters)})}_validateVertexSpace(e){const{_context:{graphicsCoreOwner:{view:{state:{viewingMode:t}}}}}=this,{vertexSpace:r}=e;return 2!==t||"local"!==r.type||(this.logger.warn("Displaying a mesh with a local vertex space in a view in local viewing mode is not supported."),!1)}test(){return{...super.test(),materials:this._materialInfoCache.materials}}get _materialColor(){return this.symbolLayer.material?.color}}class Se{constructor(e,t,r){this.normals=e,this.indices=t,this.didFlipNormals=r}}function Ie(e,t){return t.faces??D(e.vertexAttributes.position.length/3)}function Be(e,t,r,o){switch(r.shading||"flat"){default:case"source":return Ee(e,t,r,o);case"flat":return Ue(e,o);case"smooth":return Fe(e,o)}}function Ue(e,t){const r=$(t.length),o=new Array(3*t.length);for(let n=0;n<t.length;n+=3){const a=Ve(e,t,n,Ze);for(let e=0;e<3;e++)r[n+e]=a[e],o[n+e]=n/3}return new Se(r,o,!1)}function Ee(e,t,r,o){if(null==t)return Ue(e,o);let n=!1;if(!r.trustSourceNormals)for(let a=0;a<o.length;a+=3){Ve(e,o,a,Ze);for(let e=0;e<3;e++){const r=3*o[a+e];Je[0]=t[r],Je[1]=t[r+1],Je[2]=t[r+2],j(Ze,Je)<0&&(t[r]=-t[r],t[r+1]=-t[r+1],t[r+2]=-t[r+2],n=!0)}}return new Se(t,o,n)}function Fe(e,t){const r={};for(let a=0;a<t.length;a+=3){const o=Ve(e,t,a,Ze);for(let e=0;e<3;e++){const n=t[a+e];let s=r[n];s||(s={normal:M(),count:0},r[n]=s),x(s.normal,s.normal,o),s.count++}}const o=$(3*t.length),n=new Array(3*t.length);for(let a=0;a<t.length;a++){const e=r[t[a]];1!==e.count&&(b(e.normal,e.normal),e.count=1);for(let t=0;t<3;t++)o[3*a+t]=e.normal[t];n[a]=a}return new Se(o,n,!1)}function Oe(e,t,r,o,n,a){const s=3*t[r],i=3*t[r+1],l=3*t[r+2];o[0]=e[s],o[1]=e[s+1],o[2]=e[s+2],n[0]=e[i],n[1]=e[i+1],n[2]=e[i+2],a[0]=e[l],a[1]=e[l+1],a[2]=e[l+2]}function Ve(e,t,r,o){return Oe(e,t,r,Je,Qe,Xe),w(Qe,Qe,Je),w(Xe,Xe,Je),C(Je,Qe,Xe),b(o,Je),o}function $e(e){if(!e)return null;const{scale:t,offset:o,rotation:n}=e;return{scale:t,offset:o,rotation:r(n)}}function Ge(e="repeat"){if("string"==typeof e){const t=De(e);return{s:t,t}}return{s:De(e.horizontal),t:De(e.vertical)}}function De(e){switch(e){case"clamp":return 33071;case"mirror":return 33648;default:return 10497}}function Le(e){const t=e.vertexAttributes.color;if(null==t)return!1;for(let r=3;r<t.length;r+=4)if(255!==t[r])return!0;return!1}function Ne(t,r,o){r.diffuse=e.toUnitRGB(t),r.opacity="opaque"===o.alphaMode?1:t.a}function He(e){return e.data??e.url}function ke(t){return null==t?"-":t instanceof e?t.toHex():t.contentHash}function ze(e){const{offset:t,scale:r,rotation:o}=e??Ye;return`${t[0]},${t[1]},${o},${r[0]},${r[1]}`}function qe(e){return e.vertexAttributes.color}function We(e){return 1===(e.material?.color?.a??0)}const Ye=new H,Ke=M(),Je=M(),Qe=M(),Xe=M(),Ze=M(),et=f(),tt=f(),rt=O(),ot=[new L],nt=M();export{Pe as Graphics3DMeshFillSymbolLayer};
|
|
5
|
+
import e from"../../../../Color.js";import{linearize as t}from"../../../../colorUtils.js";import"../../../../core/has.js";import{deg2rad as r}from"../../../../core/mathUtils.js";import{releaseMaybe as o}from"../../../../core/maybe.js";import{isPromiseLike as n}from"../../../../core/promiseUtils.js";import{normalFromMat4 as a,fromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromTranslation as l,multiply as c,invert as u,getTranslation as m}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as f,IDENTITY as p,clone as h}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as d}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{h as g,i as x,j as _,p as y,t as T,n as b,c as v,e as w,f as C,g as j}from"../../../../chunks/vec32.js";import{create as M,fromValues as R,ONES as A,ZEROS as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as S}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{canProjectWithoutEngine as I}from"../../../../geometry/projectionUtils.js";import{computeTranslationToOriginAndRotation as B}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as U}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as E}from"../../../../geometry/projection/projectVectorToVector.js";import{fromBuffer as F,create as O,intersectsClippingArea as V}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as $}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as G,getContinuousIndexArray as D}from"../../../../geometry/support/Indices.js";import L from"../../../../geometry/support/MeshComponent.js";import N from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import H from"../../../../geometry/support/MeshTextureTransform.js";import{isRelativeVertexSpace as k,isAbsoluteVertexSpace as z}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{equals as q,isPlateCarree as W}from"../../../../geometry/support/spatialReferenceUtils.js";import{t as Y}from"../../../../chunks/vec3.js";import{transformNormal as K,transformVectorENUPlateCarree as J,transformVectorWMPlateCarree as Q,projectNormalToPCPF as X,transformTangent as Z,projectTangentToPCPF as ee}from"../../../../geometry/support/meshUtils/projection.js";import{projectMeshVertexPositions as te}from"../../../../geometry/support/meshUtils/projectMeshVertexPositions.js";import{getEmissiveMode as re}from"../../../../symbols/support/materialUtils.js";import{isEncodedMeshTexture as oe}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as ne}from"../../glTF/internal/TextureTransformUtils.js";import{defaultSymbolLayerMemoryComplexity as ae}from"./defaultSymbolComplexity.js";import{perObjectElevationAligner as se}from"./ElevationAligners.js";import{needsElevationUpdates3D as ie,evaluateElevationInfoAtPoint as le}from"./elevationAlignmentUtils.js";import{Graphics3DMeshObject3DGraphicLayer as ce}from"./Graphics3DMeshObject3DGraphicLayer.js";import{Object3DEdgeState as ue}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as me,nanFallbackColor as fe}from"./Graphics3DSymbolLayer.js";import{MaterialInfoCache as pe,MeshFastUpdateProcessor as he}from"./MeshFastUpdateProcessor.js";import{SymbolComplexity as de}from"./SymbolComplexity.js";import{hasEdges as ge,createMaterial as xe}from"../support/edgeUtils.js";import{debugFlags as _e}from"../../support/debugFlags.js";import{Attribute as ye}from"../../webgl-engine/lib/Attribute.js";import{Geometry as Te}from"../../webgl-engine/lib/Geometry.js";import{ManagedTexture as be}from"../../webgl-engine/lib/ManagedTexture.js";import{Object3D as ve}from"../../webgl-engine/lib/Object3D.js";import{DefaultMaterial as we}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as Ce}from"../../webgl-engine/materials/NativeLineMaterial.js";import{useSchematicPBR as je,advancedMRRFactors as Me,schematicMRRFactors as Re}from"../../webgl-engine/materials/pbrUtils.js";const Ae=["mesh"];class Pe extends me{constructor(e,t,r,o){super(e,t,r,o,We(t)),this._materialInfoCache=new pe,this._fastUpdateProcessor=new he,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){_e.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new Ce({color:[1,0,1,1]}),this._debugTangentNormalMaterial=new Ce({color:[1,.5,0,1]}),this._debugFaceNormalMaterial=new Ce({color:[0,1,1,1]})),this.updateComplexity()}destroy(){super.destroy(),this._textures.forEach(e=>e.unload()),this._context.stage.removeTextures(Array.from(this._textures.values())),this._materialInfoCache.clear(),this._textures.clear(),this._fastUpdateProcessor.destroy()}get materials(){return this._materialInfoCache.materials}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,Ae,"fill on mesh-3d"))return null;const r=this.createElevationContextForGraphic(t),o=e.renderingInfo;return this._createAs3DShape(t,o,r,t.uid)}onRemoveGraphic(e){this._fastUpdateProcessor.onRemoveGraphic(e,this._materialInfoCache)}layerOpacityChanged(e,t){const r=this._getLayerOpacity();this._updateMaterialParameters(e=>{e.material.setParameters({layerOpacity:r});const t=e.material.parameters;this._setMaterialTextureAlphaMode(t,e)}),e?.forEach(e=>t(e)?.layerOpacityChanged(r,this._context.isAsync))}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,ie)}slicePlaneEnabledChanged(e,t){return this._updateMaterialParameters(({material:e})=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),e?.forEach(e=>t(e)?.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)),!0}physicalBasedRenderingChanged(){const e=this._usePBR();return this._updateMaterialParameters(({material:t})=>t.setParameters({usePBR:e})),!0}updateTransform(e,t,r,o){if(!e.fastTransformUpdatesAllowed)return!1;const n=e.fastTransformUpdatesEnabled;switch(o){case 0:if(n)return!0;break;case 1:if(!n)return!0;break;default:if(!n)return!!this.updateTransform(e,t,r,0)&&(e.autoDisableFastTransformUpdates(()=>this.updateTransform(e,t,r,1)),!0)}const a=this._context.renderCoordsHelper.spatialReference,s=tt,{origin:i,transform:l}=r;if(!B(t,g(Je,i.x,i.y,i.z??0),s,a))return!1;switch(o){case 0:this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context);break;case 1:this._fastUpdateProcessor.disable(e,this._materialInfoCache);break;case 2:e.updateFastLocalOrigin(s,l,this._context.localOriginFactory)}const{elevationContext:c}=e;c.centerInElevationSR=this._getCenterInElevationSR(s);const{elevationProvider:u,renderCoordsHelper:m}=this._context,f=(e,t)=>le(e,u,c,m,t);return e.alignedSampledElevation=se(e,c,u.spatialReference,f,m,s),e.updateTransform(s,l,this._context.isAsync),e.updateAutoDisableFastTransformUpdates(()=>this.updateTransform(e,t,r,1)),!0}computeComplexity(){if(!this._textures||0===this._textures.size)return super.computeComplexity();let e=0;for(const o of this._textures.values())e+=o.usedMemory;const t={...ae(this.symbol,this.symbolLayer),resourceBytes:e},r=ge(this.symbolLayer)?2:0;return new de({drawCallsPerFeature:r,memory:t})}_requiresSymbolVertexColors(){return this._hasDrivenColorOrOpacity}_materialPropertiesDefault(e,t){const r=this._requiresSymbolVertexColors(),o=!!e.vertexAttributes.color,n=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:r,hasVertexColors:o,hasVertexTangents:n,uid:`vc:${o},vt:${n},vct${t},svc:${r}`}}_materialProperties(e,t,r){const o=this._materialPropertiesDefault(e,r);if(!t.material)return o;const{color:n,colorTexture:a,colorTextureTransform:s,normalTexture:i,normalTextureTransform:l,doubleSided:c,alphaCutoff:u,alphaMode:m}=t.material,f=ke(n),p=ke(a),h=ze(s),d=ke(i),g=ze(l);if(o.color=n,o.colorTexture=a,o.normalTexture=i,o.uid=`${o.uid},cmuid:${f},ctmuid:${p},cttuid:${h},ntmuid:${d},nttuid:${g},ds:${c},ac:${u},am:${m}`,t.material instanceof N){const{metallic:e,roughness:r,metallicRoughnessTexture:n,metallicRoughnessTextureTransform:a,emissiveColor:i,emissiveStrength:c,emissiveTexture:u,emissiveTextureTransform:m,occlusionTexture:f,occlusionTextureTransform:p}=t.material,h=ke(n),d=ze(a),g=ke(i),x=ke(u),_=ze(m),y=ke(f),T=ze(p);o.uid=[o.uid,`mrm:${e}`,`mrr:${r}`,`mrt:${h}`,`mrtt:${d}`,`emuid:${g}`,`ems:${c}`,`etmuid:${x}`,`ett:${_}`,`otmuid:${y}`,`ott:${T}`].join(","),o.metallic=e,o.roughness=r,o.metallicRoughnessTexture=n,o.emissiveColor=i,o.emissiveStrength=c,o.emissiveTexture=u,o.occlusionTexture=f,o.colorTextureTransform=$e(s),o.normalTextureTransform=$e(l),o.emissiveTextureTransform=$e(m),o.occlusionTextureTransform=$e(p),o.metallicRoughnessTextureTransform=$e(a)}return o}_getInternalTexture(e,t=!1,r=1){const a=He(e);if(!a)return null;const s=`${e.contentHash}/${r}`;let i=this._textures.get(s);if(i){const e=this._context.stage.renderView.textures;let t=null;const r=e.acquire(i.id);return null==r||n(r)||(i.events.on("unloaded",()=>t=o(t)),t=r),i}let l=null;const c=this._context.stage.renderView.renderingContext.parameters.maxMaxAnisotropy,u={wrap:Ge(e.wrap),noUnpackFlip:!0,maxAnisotropy:c,mipmap:c>1};return oe(a)?(l=a.data,u.preMultiplyAlpha=!1,u.encoding=a.encoding):(l=a,u.preMultiplyAlpha=1!==r,u.compressionOptions=t?{compressionTracker:this._context.compressionTracker,compressionCallback:()=>this.updateComplexity()}:void 0),i=new be(l,u),this._textures.set(s,i),i.events.on("loaded",()=>this.updateComplexity()),i.load(this._context.stage.renderView.renderingContext),this._context.stage.addTexture(i),i.events.on("unloaded",()=>{this._textures.delete(s)}),i}_setInternalMaterialTextureParameters(r,o){if(null!=r.colorTexture){const e=1!==o.textureAlphaMode,t=this._getInternalTexture(r.colorTexture,e,o.textureAlphaMode);t?(o.textureId=t.id,o.textureAlphaPremultiplied=!!t.parameters.preMultiplyAlpha):o.textureId=void 0}if(r.normalTexture&&(o.normalTextureId=this._getInternalTexture(r.normalTexture)?.id),r.emissiveColor){const n=e.toUnitRGB(r.emissiveColor);o.emissiveBaseColor=R(t(n[0]),t(n[1]),t(n[2]))}r.emissiveStrength&&(o.emissiveStrengthKHR=r.emissiveStrength),r.emissiveTexture&&(o.emissiveTextureId=this._getInternalTexture(r.emissiveTexture)?.id),r.occlusionTexture&&(o.occlusionTextureId=this._getInternalTexture(r.occlusionTexture,!0)?.id),r.metallicRoughnessTexture&&(o.metallicRoughnessTextureId=this._getInternalTexture(r.metallicRoughnessTexture,!0)?.id)}_setInternalMaterialParameters(e,t,r){null!=e.color&&Ne(e.color,t,r),this._setInternalMaterialTextureParameters(e,t),t.colorTextureTransformMatrix=ne(e.colorTextureTransform),t.normalTextureTransformMatrix=ne(e.normalTextureTransform);const o=null!=e.normalTextureTransform?.scale?e.normalTextureTransform?.scale:d;t.scale=[o[0],o[1]],t.occlusionTextureTransformMatrix=ne(e.occlusionTextureTransform),t.emissiveTextureTransformMatrix=ne(e.emissiveTextureTransform),t.metallicRoughnessTextureTransformMatrix=ne(e.metallicRoughnessTextureTransform)}_setExternalMaterialParameters(t,r=this._materialColor){const o=this._drivenProperties.color,n=this._drivenProperties.opacity;if(o)t.externalColor=S;else{const o=r??null;if(o){const r=e.toUnitRGBA(o);n&&(r[3]=1),t.externalColor=r}else t.externalColor=fe}t.colorMixMode=this.symbolLayer.material?.colorMixMode??"multiply",t.castShadows=!!this.symbolLayer.castShadows,t.emissiveStrengthFromSymbol=this.symbolLayer?.material?.emissive?.strength??1,t.emissiveSource=re(this.symbolLayer?.material?.emissive?.source??"emissive")}_getOrCreateMaterial(t,r){const o=r.material?.color,n=r.material?.colorTexture,a=r.material?.alphaMode,s="blend"===a,i=!("opaque"===a)&&(Le(t)||null!=o&&o.a<1||n?.transparent||s),l=this._materialProperties(t,r,i),c=this._materialInfoCache.byUid(l.uid);if(c)return this._setInternalMaterialTextureParameters(l,c.material.parameters),c.material;const u={uid:l.uid,material:null,isComponentTransparent:i,alphaMode:r.material?r.material.alphaMode:"opaque"},m=je({normalTexture:l.normalTexture,metallicRoughnessTexture:l.metallicRoughnessTexture,metallicFactor:l.metallic,roughnessFactor:l.roughness,emissiveTexture:l.emissiveTexture,emissiveFactor:e.toUnitRGB(l.emissiveColor),occlusionTexture:l.occlusionTexture}),f={usePBR:this._usePBR(),isSchematic:m,hasVertexColors:l.hasVertexColors,hasSymbolColors:l.hasSymbolVertexColors,hasVertexTangents:l.hasVertexTangents,ambient:P,diffuse:A,opacity:1,doubleSided:!0,doubleSidedType:"winding-order",cullFace:0,layerOpacity:this._getLayerOpacity(),hasSlicePlane:this._context.slicePlaneEnabled,drivenOpacity:this.needsDrivenTransparentPass||u.isComponentTransparent};f.mrrFactors=m?Re:[l.metallic,l.roughness,Me[2]],r.material&&(f.doubleSided=r.material.doubleSided,f.cullFace=r.material.doubleSided?0:2,f.textureAlphaCutoff=r.material.alphaCutoff),this._setExternalMaterialParameters(f),this._setMaterialTextureAlphaMode(f,u),this._setInternalMaterialParameters(l,f,u);const p=new we(f,this._context);return u.material=p,this._materialInfoCache.set(l.uid,u),p}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchColor(e,t)}_preparePatchColor(e,t){if(!t.material||"partial"!==t.material.type)return;const r=t.material.diff;if(!r.color||"complete"!==r.color.type||null==r.color.newValue||null==r.color.oldValue)return;const o=r.color.newValue;delete r.color,e.symbolLayerStatePatches.push(()=>{this._updateMaterialParameters(e=>{const t=e.material.parameters;this._setExternalMaterialParameters(t,o),this._setMaterialTextureAlphaMode(t,e),e.material.setParameters({externalColor:t.externalColor})})})}_usePBR(){return this._context.physicalBasedRenderingEnabled}_setMaterialTextureAlphaMode(e,t){if("auto"===t.alphaMode){const r=this.needsDrivenTransparentPass||t.isComponentTransparent||(e.layerOpacity??1)<1||(e.opacity??1)<1||(e.externalColor?.[3]??1)<1;e.textureAlphaMode=r?3:1}else e.textureAlphaMode="opaque"===t.alphaMode?1:"mask"===t.alphaMode?2:0}_createFaceDebugNormals(e,t){const r=t.length,o=e.spatialReference.isGeographic?20015077/180:1,n=.1*Math.max(e.extent.width*o,e.extent.height*o,e.extent.zmax-e.extent.zmin),s=[],l=[],c=t[0].transformation,u=a(i(),c);for(let a=0;a<r;a++){const e=t[a].attributes.get("position");if(!e)continue;const r=e.data,o=e.indices;for(let t=0;t<o.length;t+=3)Ve(r,o,t,Ze),Oe(r,o,t,Je,Qe,Xe),x(Je,Je,Qe),x(Je,Je,Xe),_(Je,Je,1/3),y(Je,Je,c),s.push(...Je),T(Ze,Ze,u),b(Ze,Ze),v(Je,Je,Ze,n),s.push(...Je),l.push(l.length),l.push(l.length)}return s.length?new Te(this._debugFaceNormalMaterial,[["position",new ye(s,l,3,!0)]],null,2):null}_createPerVertexDebugVectors(e,t,r,o,n){const l=t.length,c=e.spatialReference.isGeographic?20015077/180:1,u=.1*n*Math.max(e.extent.width*c,e.extent.height*c,e.extent.zmax-e.extent.zmin),m=[],f=[],p=t[0].transformation,h=a(i(),p);"tangent"===r&&s(h,p);for(let a=0;a<l;a++){const e=t[a],o=e.attributes.get("position"),n=e.attributes.get(r);if(!o||!n)continue;const s=o.data,i=o.indices,l=n.data,c=n.indices;for(let t=0;t<i.length;t++){const e=3*i[t],r=c[t]*n.stride;g(Je,s[e+0],s[e+1],s[e+2]),y(Je,Je,p),m.push(...Je),g(Qe,l[r+0],l[r+1],l[r+2]),T(Qe,Qe,h),b(Qe,Qe),v(Je,Je,Qe,u),m.push(...Je),f.push(f.length),f.push(f.length)}}return m.length?new Te(o,[["position",new ye(m,f,3,!0)]],null,2):null}_createAs3DShape(e,t,r,o){const n=e.geometry;if("mesh"!==n.type)return null;const a=this._createGeometryInfo(n,t,o);if(null==a)return null;const{geometries:s,objectTransformation:i}=a;if(_e.DRAW_MESH_GEOMETRY_NORMALS){const e=this._createPerVertexDebugVectors(n,s,"normal",this._debugVertexNormalMaterial,1),t=this._createPerVertexDebugVectors(n,s,"tangent",this._debugTangentNormalMaterial,.5),r=this._createFaceDebugNormals(n,s);e&&s.push(e),t&&s.push(t),r&&s.push(r)}const l=this._context.layerViewUid,c=new ve({geometries:s,layerViewUid:l,graphicUid:o,isElevationSource:!0});c.transformation=i;const u=xe(this.symbolLayer,{opacity:this._getLayerOpacity()}),m=u?new ue(s[0].material,u,this._context.slicePlaneEnabled):null,f=new ce(this,c,null,se,r,m);this._fastUpdateProcessor.onAddGraphic(),f.needsElevationUpdates=ie(r.mode),f.useObjectOriginAsAttachmentOrigin=!0,f.fastTransformUpdatesAllowed=this._fastTransformUpdatesAllowed(n),r.centerInElevationSR=this._getCenterInElevationSR(c.transformation);const{elevationProvider:p,renderCoordsHelper:h}=this._context,d=(e,t)=>le(e,p,r,h,t);return f.alignedSampledElevation=se(f,r,p.spatialReference,d,h),f}_fastTransformUpdatesAllowed(e){const{vertexSpace:t,spatialReference:r}=e;if(!k(t))return!1;const{type:o}=t,{view:n}=this._context.graphicsCoreOwner,{viewingMode:a}=n.state,s=n.spatialReference;return 1===a&&"local"===o||2===a&&q(s,r)&&"georeferenced"===o&&!r.isGeographic}_getElevationSR(){return this._context.elevationProvider.spatialReference??null}_getCenterInElevationSR(e){const t=M(),r=g(nt,e[12],e[13],e[14]);return E(r,this._context.renderCoordsHelper.spatialReference,t,this._getElevationSR()),t}_passthroughReprojectionInfo(e){return 0===e.reprojection&&!!e.objectTransformation}_createPositionBuffer(e,t){const r=e.vertexAttributes.position;let o,n=r;if(0===t.reprojection)return{position:n,georeferencedPositionBuffer:o};const a=1===t.reprojection?t.transformBeforeProject:null;a&&(n=Y(new Float64Array(n.length),n,a));const{normal:s,tangent:i}=e.vertexAttributes;this._passthroughReprojectionInfo(t)||!s&&!i||(o=n);const l=n===r||n===o?new Float64Array(n.length):n;return U(n,e.spatialReference,0,l,this._context.renderCoordsHelper.spatialReference,0),{position:l,georeferencedPositionBuffer:o}}_createNormalBuffer(e,t,r,o){const n=e.vertexAttributes.normal;if(null==n)return null;let a=n;const s=1===o.reprojection?o.transformBeforeProject:null;s&&(a=K(a,new Float32Array(a.length),s));const i=this._context.graphicsCoreOwner.view.viewingMode;if(0===o.reprojection)return a;if("local"===i){if(!W(this._context.renderCoordsHelper.spatialReference))return a;if(null==r)return null;if(e.spatialReference.isGeographic){const e=a===n?new Float32Array(a.length):a;return J(a,0,r,e)}if(e.spatialReference.isWebMercator){const e=a===n?new Float32Array(a.length):a;return Q(a,0,r,e)}return a}if(null==r)return null;const l=a===n?new Float32Array(a.length):a,c=this._context.renderCoordsHelper.spatialReference;return X(a,r,e.spatialReference,t,c,l)}_createTangentBuffer(e,t,r,o){const n=e.vertexAttributes.tangent;if(null==n)return null;let a=n;const s=1===o.reprojection?o.transformBeforeProject:null;s&&(a=Z(a,new Float32Array(a.length),s));const i=this._context.graphicsCoreOwner.view.viewingMode;if(0===o.reprojection)return a;if("local"===i){if(!W(this._context.renderCoordsHelper.spatialReference))return a;if(null==r)return null;if(e.spatialReference.isGeographic){const e=a===n?new Float32Array(a.length):a;return J(a,1,r,e)}if(e.spatialReference.isWebMercator){const e=a===n?new Float32Array(a.length):a;return Q(a,1,r,e)}return a}if(null==r)return null;const l=a===n?new Float32Array(a.length):a,c=this._context.renderCoordsHelper.spatialReference;return ee(a,r,e.spatialReference,t,c,l)}_createSymbolColorBuffer(e){return this._requiresSymbolVertexColors()?new Uint8Array(this._getDrivenUInt8ColorWithNaNSupport(e,this._materialColor,!0)):null}_createBuffers(e,t){const r=e.vertexAttributes&&e.vertexAttributes.position;if(!r)return this.logger.warn("Mesh geometry must contain position vertex attributes"),null;const o=e.vertexAttributes.normal,n=e.vertexAttributes.uv,a=e.vertexAttributes.tangent;if(o&&o.length!==r.length)return this.logger.warn("Mesh normal vertex buffer must contain the same number of elements as the position buffer"),null;if(a&&a.length/4!=r.length/3)return this.logger.warn("Mesh tangent vertex buffer must contain the same number of elements as the position buffer"),null;if(n&&n.length/2!=r.length/3)return this.logger.warn("Mesh uv vertex buffer must contain the same number of elements as the position buffer"),null;const s=this._computeReprojectionInfo(e),{position:i,georeferencedPositionBuffer:l}=this._createPositionBuffer(e,s),c=qe(e),u=this._createSymbolColorBuffer(t),m=this._createNormalBuffer(e,i,l,s),p=this._createTangentBuffer(e,i,l,s),h=n,{transformation:d,position:g,normal:x,tangent:_}=this._passthroughReprojectionInfo(s)?{transformation:s.objectTransformation,position:i,normal:m,tangent:p}:this._transformOriginLocal(e,i,m,p);return{positionBuffer:g,normalBuffer:x,tangentBuffer:_,uvBuffer:h,colorBuffer:c,symbolColorBuffer:u,objectTransformation:d,geometryTransformation:0===s.reprojection&&s.geometryTransformation?s.geometryTransformation:f()}}_computeReprojectionInfo(e){const{vertexSpace:t}=e,r="georeferenced"===t.type?q(this._context.renderCoordsHelper.spatialReference,e.spatialReference)?0:1:0;if(z(t))return{reprojection:r};const o=t.origin,n=f(),a=e.transform?.localMatrix??p;if(0===r){B(e.spatialReference,o,n,this._context.renderCoordsHelper.spatialReference);return{reprojection:r,objectTransformation:n,geometryTransformation:h(a)}}const s=l(f(),o);return c(s,s,a),{reprojection:r,transformBeforeProject:s}}_transformOriginLocal(e,t,r,o){const n=this._context.renderCoordsHelper.spatialReference,a=e.origin;Ke[0]=a.x,Ke[1]=a.y,Ke[2]=a.z??0;const s=f();B(e.spatialReference,Ke,s,n),u(et,s);const{position:i,normal:l,tangent:c}=e.vertexAttributes,m=t===i?new Float64Array(t.length):t;Y(m,t,et);const p=r?r===l?new Float32Array(r.length):r:null,h=o?o===c?new Float32Array(o.length):o:null;return r&&p&&K(r,p,et),o&&h&&Z(o,h,et),{transformation:s,position:m,normal:p,tangent:h}}_validateFaces(e,t){const r=e.vertexAttributes.position.length/3,o=t.faces;if(o){let e=-1;for(let t=0;t<o.length;t++){const r=o[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}_isOutsideClippingArea(e){if(!this._context.clippingExtent)return!1;const t=e.vertexAttributes?.position;if(!t)return!1;const r=this._context.elevationProvider.spatialReference,o=te(e,r??e.spatialReference);return!!o&&(F(o,rt),!V(rt,this._context.clippingExtent))}_createGeometryInfo(e,t,r){if(!I(e.spatialReference,this._context.renderCoordsHelper.spatialReference))return this.logger.warn("Geometry spatial reference is not compatible with the view"),null;if(!this._validateVertexSpace(e))return null;if(this._isOutsideClippingArea(e))return null;const o=this._createBuffers(e,t);if(null==o)return null;const{positionBuffer:n,uvBuffer:a,colorBuffer:s,symbolColorBuffer:i,normalBuffer:l,tangentBuffer:c,objectTransformation:u,geometryTransformation:f}=o,p=e.components??ot,h=new Array;let d=!1;const g=m(Je,u),x=this._context.localOriginFactory.getOrigin(g);for(const m of p){if(!this._validateFaces(e,m))return null;const t=Ie(e,m);if(0===t.length)continue;const o=Be(n,l,m,t);o.didFlipNormals&&(d=!0);const u=[["position",new ye(n,t,3,!0)],["normal",new ye(o.normals,o.indices,3,!0)]];s&&u.push(["color",new ye(s,t,4,!0)]),i&&u.push(["symbolColor",new ye(i,G(t.length),4,!0)]),a&&u.push(["uv0",new ye(a,t,2,!0)]),c&&u.push(["tangent",new ye(c,t,4,!0)]);const p=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:r,layerViewUid:this._context.layerViewUid}),g=this._getOrCreateMaterial(e,m),_=new Te(g,u,null,0,p);_.transformation=f,_.localOrigin=x,h.push(_)}return d&&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:h,objectTransformation:u}}_updateMaterialParameters(e){this._materialInfoCache.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachClonedMaterial((e,t)=>{t.setParameters(e.parameters)})}_validateVertexSpace(e){const{_context:{graphicsCoreOwner:{view:{state:{viewingMode:t}}}}}=this,{vertexSpace:r}=e;return 2!==t||"local"!==r.type||(this.logger.warn("Displaying a mesh with a local vertex space in a view in local viewing mode is not supported."),!1)}test(){return{...super.test(),materials:this._materialInfoCache.materials}}get _materialColor(){return this.symbolLayer.material?.color}}class Se{constructor(e,t,r){this.normals=e,this.indices=t,this.didFlipNormals=r}}function Ie(e,t){return t.faces??D(e.vertexAttributes.position.length/3)}function Be(e,t,r,o){switch(r.shading||"flat"){default:case"source":return Ee(e,t,r,o);case"flat":return Ue(e,o);case"smooth":return Fe(e,o)}}function Ue(e,t){const r=$(t.length),o=new Array(3*t.length);for(let n=0;n<t.length;n+=3){const a=Ve(e,t,n,Ze);for(let e=0;e<3;e++)r[n+e]=a[e],o[n+e]=n/3}return new Se(r,o,!1)}function Ee(e,t,r,o){if(null==t)return Ue(e,o);let n=!1;if(!r.trustSourceNormals)for(let a=0;a<o.length;a+=3){Ve(e,o,a,Ze);for(let e=0;e<3;e++){const r=3*o[a+e];Je[0]=t[r],Je[1]=t[r+1],Je[2]=t[r+2],j(Ze,Je)<0&&(t[r]=-t[r],t[r+1]=-t[r+1],t[r+2]=-t[r+2],n=!0)}}return new Se(t,o,n)}function Fe(e,t){const r={};for(let a=0;a<t.length;a+=3){const o=Ve(e,t,a,Ze);for(let e=0;e<3;e++){const n=t[a+e];let s=r[n];s||(s={normal:M(),count:0},r[n]=s),x(s.normal,s.normal,o),s.count++}}const o=$(3*t.length),n=new Array(3*t.length);for(let a=0;a<t.length;a++){const e=r[t[a]];1!==e.count&&(b(e.normal,e.normal),e.count=1);for(let t=0;t<3;t++)o[3*a+t]=e.normal[t];n[a]=a}return new Se(o,n,!1)}function Oe(e,t,r,o,n,a){const s=3*t[r],i=3*t[r+1],l=3*t[r+2];o[0]=e[s],o[1]=e[s+1],o[2]=e[s+2],n[0]=e[i],n[1]=e[i+1],n[2]=e[i+2],a[0]=e[l],a[1]=e[l+1],a[2]=e[l+2]}function Ve(e,t,r,o){return Oe(e,t,r,Je,Qe,Xe),w(Qe,Qe,Je),w(Xe,Xe,Je),C(Je,Qe,Xe),b(o,Je),o}function $e(e){if(!e)return null;const{scale:t,offset:o,rotation:n}=e;return{scale:t,offset:o,rotation:r(n)}}function Ge(e="repeat"){if("string"==typeof e){const t=De(e);return{s:t,t}}return{s:De(e.horizontal),t:De(e.vertical)}}function De(e){switch(e){case"clamp":return 33071;case"mirror":return 33648;default:return 10497}}function Le(e){const t=e.vertexAttributes.color;if(null==t)return!1;for(let r=3;r<t.length;r+=4)if(255!==t[r])return!0;return!1}function Ne(t,r,o){r.diffuse=e.toUnitRGB(t),r.opacity="opaque"===o.alphaMode?1:t.a}function He(e){return e.data??e.url}function ke(t){return null==t?"-":t instanceof e?t.toHex():t.contentHash}function ze(e){const{offset:t,scale:r,rotation:o}=e??Ye;return`${t[0]},${t[1]},${o},${r[0]},${r[1]}`}function qe(e){return e.vertexAttributes.color}function We(e){return 1===(e.material?.color?.a??0)}const Ye=new H,Ke=M(),Je=M(),Qe=M(),Xe=M(),Ze=M(),et=f(),tt=f(),rt=O(),ot=[new L],nt=M();export{Pe as Graphics3DMeshFillSymbolLayer};
|
package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as o}from"tslib";import{
|
|
5
|
+
import{__decorate as o}from"tslib";import{isColorHighlightOrOLID as e}from"../../../core/shaderLibrary/ShaderOutput.js";import{parameter as t,ShaderTechniqueConfiguration as i}from"../../../core/shaderTechnique/ShaderTechniqueConfiguration.js";class s extends i{constructor(o){super(),this.sphericalSR=o,this.output=0,this.textureCoordinateType=0,this.componentData=0,this.cullFace=2,this.vertexDiscardMode=0,this.doubleSidedMode=2,this.alphaDiscardMode=1,this.integratedMeshMode=0,this.oitPass=0,this.ellipsoidMode=1,this.pbrMode=0,this.normalType=0,this.emissionSource=0,this.hasEmission=!1,this.hasVertexColors=!1,this.hasNormals=!1,this.shadeNormals=!0,this.hasSlicePlane=!1,this.isGroundSlice=!1,this.hasColorTexture=!1,this.hasHighlightMixTexture=!1,this.receiveAmbientOcclusion=!0,this.receiveShadows=!0,this.blendingEnabled=!0,this.screenSpaceReflections=!1,this.hasPolygonOffset=!1,this.hasMetallicRoughnessTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasOccludees=!1,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.hasNormalTextureTransform=!1,this.cloudReflections=!0,this.snowCover=!1,this.olidColor=!1,this.renderOccluded=!1,this.sphereDepthInterpolate=!1,this.discardInvisibleFragments=!1,this.oitPremultipliedAlpha=!1,this.occlusionPass=!1,this.bindType=2,this.useCustomDTRExponentForWater=!1,this.hasVertexTangents=!1,this.highStepCount=!1,this.instanced=!1,this.instancedDoublePrecision=!1,this.hasModelTransformation=!1,this.useFillLights=!0,this.draped=!1}get spherical(){return 0!==this.sphericalSR}get overlayEnabled(){return(2===this.integratedMeshMode||3===this.integratedMeshMode)&&e(this.output)}get hasWater(){return 3===this.pbrMode||4===this.pbrMode||6===this.pbrMode}}o([t({count:10})],s.prototype,"output",void 0),o([t({count:3})],s.prototype,"textureCoordinateType",void 0),o([t({count:2})],s.prototype,"componentData",void 0),o([t({count:3})],s.prototype,"cullFace",void 0),o([t({count:3})],s.prototype,"vertexDiscardMode",void 0),o([t({count:3})],s.prototype,"doubleSidedMode",void 0),o([t({count:4})],s.prototype,"alphaDiscardMode",void 0),o([t({count:4})],s.prototype,"integratedMeshMode",void 0),o([t({count:3})],s.prototype,"oitPass",void 0),o([t({count:4})],s.prototype,"ellipsoidMode",void 0),o([t({count:7})],s.prototype,"pbrMode",void 0),o([t({count:3})],s.prototype,"normalType",void 0),o([t({count:8})],s.prototype,"emissionSource",void 0),o([t()],s.prototype,"hasEmission",void 0),o([t()],s.prototype,"hasVertexColors",void 0),o([t()],s.prototype,"hasNormals",void 0),o([t()],s.prototype,"shadeNormals",void 0),o([t()],s.prototype,"hasSlicePlane",void 0),o([t()],s.prototype,"isGroundSlice",void 0),o([t()],s.prototype,"hasColorTexture",void 0),o([t()],s.prototype,"hasHighlightMixTexture",void 0),o([t()],s.prototype,"receiveAmbientOcclusion",void 0),o([t()],s.prototype,"receiveShadows",void 0),o([t()],s.prototype,"blendingEnabled",void 0),o([t()],s.prototype,"screenSpaceReflections",void 0),o([t()],s.prototype,"hasPolygonOffset",void 0),o([t()],s.prototype,"hasMetallicRoughnessTexture",void 0),o([t()],s.prototype,"hasOcclusionTexture",void 0),o([t()],s.prototype,"hasNormalTexture",void 0),o([t()],s.prototype,"hasOccludees",void 0),o([t()],s.prototype,"terrainDepthTest",void 0),o([t()],s.prototype,"cullAboveTerrain",void 0),o([t()],s.prototype,"hasNormalTextureTransform",void 0),o([t()],s.prototype,"cloudReflections",void 0),o([t()],s.prototype,"snowCover",void 0),o([t()],s.prototype,"olidColor",void 0),o([t()],s.prototype,"renderOccluded",void 0),o([t()],s.prototype,"sphereDepthInterpolate",void 0);export{s as ComponentTechniqueConfiguration};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
function n(n){return 3===n||4===n||5===n||6===n||7===n}function r(n){return p(n)||2===n}function t(n){return 8===n||9===n}function u(n){return e(n)||t(n)}function e(n){return 0===n}function o(n){return e(n)||9===n}function c(n){return e(n)||8===n}function f(n){return c(n)||x(n)}function i(n){return e(n)||t(n)}function p(n){return i(n)||x(n)}function x(n){return 1===n}function a(r){return x(r)||n(r)}export{u as is2DGeometryOutput,r as is3DGeometryOutputMRT,e as isColor,p as
|
|
5
|
+
function n(n){return 3===n||4===n||5===n||6===n||7===n}function r(n){return p(n)||2===n}function t(n){return 8===n||9===n}function u(n){return e(n)||t(n)}function e(n){return 0===n}function o(n){return e(n)||9===n}function c(n){return e(n)||8===n}function f(n){return c(n)||x(n)}function i(n){return e(n)||t(n)}function p(n){return i(n)||x(n)}function x(n){return 1===n}function a(r){return x(r)||n(r)}export{u as is2DGeometryOutput,r as is3DGeometryOutputMRT,e as isColor,p as isColorHighlightOLIDOrDepth,f as isColorHighlightOrDepth,i as isColorHighlightOrOLID,c as isColorOrHighlight,o as isColorOrOLID,x as isDepth,a as isDepthOrShadowLikeOutput,t as isHighlightOrOLID,n as isShadowLikeOutput};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{typeToCreationInfoMap as e}from"./TextureBackedBufferFieldCreation.js";import{LayoutField as t}from"./TextureBackedBufferLayoutField.js";import{TextureBufferView as r}from"./TextureBufferView.js";class i{constructor(r){this._fields=new Map,this.texelByteStride=4,this.texelElementArrayConstructor=Uint8Array;let i=0;const n=[];for(let t=0;t<r.length;++t){const s=r[t],{type:o}=s,f=e[o];n.push({declaration:s,byteOffset:i,creationInfo:f}),i+=f.byteSize}i=s(i);const o=i,f=this._fields,{texelByteStride:l}=this;for(const{declaration:e,byteOffset:s,creationInfo:a}of n)f.set(e.name,new t(e,s,l,a));this.byteStride=o,this.texelStride=Math.ceil(o/l)}get fields(){return this._fields}createBuffer(e){return new r(this,e,this.texelElementArrayConstructor)}createView(e){return new r(this,e,this.texelElementArrayConstructor)}}function s(e){return e+3&-4}export{i as TextureBackedBufferLayout};
|
|
5
|
+
import{typeToCreationInfoMap as e}from"./TextureBackedBufferFieldCreation.js";import{LayoutField as t}from"./TextureBackedBufferLayoutField.js";import{TextureBufferView as r}from"./TextureBufferView.js";class i{constructor(r){this._fields=new Map,this.texelByteStride=4,this.texelElementArrayConstructor=Uint8Array;let i=0;const n=[];for(let t=0;t<r.length;++t){const s=r[t],{type:o}=s,f=e[o];n.push({declaration:s,byteOffset:i,creationInfo:f}),i+=f.byteSize}i=s(i);const o=i,f=this._fields,{texelByteStride:l}=this;for(const{declaration:e,byteOffset:s,creationInfo:a}of n)f.set(e.name,new t(e,s,l,a));this.byteStride=o,this.texelStride=Math.ceil(o/l)}get stride(){return this.byteStride}get fields(){return this._fields}createBuffer(e){return new r(this,e,this.texelElementArrayConstructor)}createView(e,t){return new r(this,e,this.texelElementArrayConstructor,t)}}function s(e){return e+3&-4}export{i as TextureBackedBufferLayout};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
class e{constructor(e,t,r){this.layout=e,this._bufferViews=new Map,this.buffer="number"==typeof t?new ArrayBuffer(t*e.byteStride):t,this.texelElementBuffer=new r(this.buffer,
|
|
5
|
+
class e{constructor(e,t,r,s=0){this.layout=e,this.byteOffset=s,this._bufferViews=new Map,this.buffer="number"==typeof t?new ArrayBuffer(t*e.byteStride):t,this.texelElementBuffer=new r(this.buffer,s);const f=this._bufferViews;for(const[n,i]of this.layout.fields)f.set(n,new i.bufferViewConstructor(this.buffer,s+i.byteOffset,this.layout.byteStride))}get stride(){return this.layout.byteStride}get count(){return this.byteLength/this.stride}get byteLength(){return this.buffer.byteLength-this.byteOffset}getField(e,t){const r=this._bufferViews.get(e);return null!=r&&r.elementCount===t.ElementCount&&r.elementType===t.ElementType?r:null}get usedMemory(){return this.byteLength}}export{e as TextureBufferView};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{
|
|
5
|
+
import{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColorOrOLID as r,isDepth as e,is2DGeometryOutput as s,isColor as i}from"../core/shaderLibrary/ShaderOutput.js";import a from"../lib/GLMaterial.js";import{DefaultBufferWriter as o}from"./DefaultBufferWriter.js";import{TriangleMaterial as n}from"./TriangleMaterial.js";import{VisualVariablePassParameters as h}from"./VisualVariablePassParameters.js";import{getLayout as p,ColorMaterialTechnique as u}from"../shaders/ColorMaterialTechnique.js";import{ColorMaterialTechniqueConfiguration as c}from"../shaders/ColorMaterialTechniqueConfiguration.js";import{alphaCutoff as l}from"../../../../webscene/support/AlphaCutoff.js";class f extends n{constructor(t){super(t,g),this._configuration=new c,this.supportsEdges=!0,this.produces=new Map([[2,t=>this._isOpaqueMaterialPass(t)],[3,t=>this._isOpaqueNoSSAODepthPass(t)],[4,t=>r(t)&&this._transparent&&this.parameters.writeDepth],[5,t=>e(t)&&this._transparent&&this.parameters.writeDepth],[9,t=>r(t)&&this._transparent&&!this.parameters.writeDepth],[19,t=>s(t)]])}getConfiguration(t,r){return super.getConfiguration(t,r,this._configuration),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this._transparent,this._configuration.discardInvisibleFragments=this._transparent&&!this._isOpaquePass(t)&&this.parameters.discardInvisibleFragments,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=r.hasOccludees,this._configuration.oitPass=r.oitPass,this._configuration.enableOffset=r.enableOffset,this._configuration.terrainDepthTest=r.terrainDepthTest&&i(t),this._configuration.cullAboveTerrain=r.cullAboveTerrain,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration.draped=this.parameters.draped,this._configuration}get visible(){return this.parameters.color[3]>=l}get _transparent(){return this.parameters.color[3]<1||this.parameters.forceTransparentMode}_isOpaquePass(t){return this._isOpaqueMaterialPass(t)||this._isOpaqueNoSSAODepthPass(t)}_isOpaqueMaterialPass(t){return 8===t||r(t)&&!this._transparent}_isOpaqueNoSSAODepthPass(t){return e(t)&&this.parameters.writeDepth&&!this._transparent}createGLMaterial(t){return new m(t)}createBufferWriter(){return new o(p(this.parameters))}}class m extends a{beginSlot(t){return this.getTechnique(u,t)}}class g extends h{constructor(){super(...arguments),this.color=t,this.forceTransparentMode=!1,this.writeDepth=!0,this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=0,this.draped=!1,this.discardInvisibleFragments=!1}}export{f as ColorMaterial,g as Parameters};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{VertexNormalDrawParameters as e}from"../core/shaderLibrary/attributes/VertexNormal.glsl.js";class
|
|
5
|
+
import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{VertexNormalDrawParameters as e}from"../core/shaderLibrary/attributes/VertexNormal.glsl.js";class t extends e{constructor(e=r()){super(),this.origin=e,this.textureBuffer=null}get slicePlaneLocalOrigin(){return this.origin}}export{t as DrawParameters};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{fromMat4 as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,rotate as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as l,create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{h as u,p as f,n as p,e as h,j as m,d,b as g,C as b,i as v,a as x,t as S,g as y}from"../../../../chunks/vec32.js";import{create as O,fromValues as z}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as _,create as P,freeze as j}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMat4 as M}from"../../../../core/libs/gl-matrix-2/types/mat4.js";import{create as V}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as C}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as D}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as R}from"../../support/debugFlags.js";import{isColorHighlightOrOID as A,isColor as w}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as F}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterialBindParameters as T,GLTextureMaterial as L}from"../lib/GLTextureMaterial.js";import{Material as E}from"../lib/Material.js";import{SeparateScreenSizePerspectiveEvaluators as U}from"../lib/screenSizePerspectiveUtils.js";import{assert as B}from"../lib/Util.js";import{writePosition as I,writeNormal as q,writeColor as G,writeBufferVec2 as W,writeBufferFloat as H,writeBufferVec4 as N,writeBufferVec4Zeros as X,writeOlidColor as Y}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as k}from"./internal/MaterialUtil.js";import{c as J,f as K}from"../../../../chunks/HUDMaterial.glsl.js";import{baseLayout as Q,getInstanceLayout as Z,HUDMaterialTechnique as $}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as ee}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as te}from"../../../../webscene/support/AlphaCutoff.js";class ie extends E{constructor(e,t){super(e,Ve),this.produces=new Map([[14,e=>A(e)&&!this.parameters.drawAsLabel],[15,e=>A(e)&&this.parameters.drawAsLabel],[13,()=>this.parameters.occlusionTest],[19,e=>this.parameters.draped&&A(e)]]),this._visible=!0,this._configuration=new ee(t)}getConfiguration(e,t){const i=this.parameters.draped;return super.getConfiguration(e,t,this._configuration),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=i,this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,this._configuration.hasRotation=this.parameters.hasRotation,this._configuration.hasVVSize=!!this.parameters.vvSize,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration.occlusionPass=13===t.slot,this._configuration.occludedFragmentFade=!i&&this.parameters.occludedFragmentFade,this._configuration.horizonCullingEnabled=this.parameters.horizonCullingEnabled,this._configuration.isFocused=this.parameters.isFocused,this._configuration.depthTestEnabled=this.parameters.depthEnabled||13===t.slot,w(e)&&(this._configuration.debugDrawLabelBorder=!!R.LABELS_SHOW_BORDER),this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}intersect(e,t,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:v},point:x,camera:S}=s,{parameters:y}=this;if(!l||!c||v&&y.isLabel||!e.visible||!x||!S)return;const z=e.attributes.get("featureAttribute"),P=null==z?null:_(z.data,Oe),{scaleX:j,scaleY:M}=De(P,y,S.pixelRatio);i(ge,t),e.attributes.has("featureAttribute")&&ne(ge);const V=e.attributes.get("position"),C=e.attributes.get("size"),D=e.attributes.get("normal"),R=e.attributes.get("rotation"),A=e.attributes.get("centerOffsetAndDistance");B(V.size>=3);const w=J(y),F="screen"===this.parameters.centerOffsetUnits;for(let i=0;i<V.data.length/V.size;i++){const e=i*V.size;u(ce,V.data[e],V.data[e+1],V.data[e+2]),f(ce,ce,t),f(ce,ce,S.viewMatrix);const a=i*A.size;if(u(Se,A.data[a],A.data[a+1],A.data[a+2]),!F&&(ce[0]+=Se[0],ce[1]+=Se[1],0!==Se[2])){const e=Se[2];p(Se,ce),h(ce,ce,m(Se,Se,e))}const n=i*D.size;if(u(ue,D.data[n],D.data[n+1],D.data[n+2]),ae(ue,ge,S,ze),Re(this.parameters,ce,ze,S,le),S.applyProjection(ce,fe),fe[0]>-1){F&&(Se[0]||Se[1])&&(fe[0]+=Se[0]*S.pixelRatio,0!==Se[1]&&(fe[1]+=le.alignmentEvaluator.apply(Se[1])*S.pixelRatio),S.unapplyProjection(fe,ce)),fe[0]+=this.parameters.screenOffset[0]*S.pixelRatio,fe[1]+=this.parameters.screenOffset[1]*S.pixelRatio,fe[0]=Math.floor(fe[0]),fe[1]=Math.floor(fe[1]);const e=i*C.size;je[0]=C.data[e],je[1]=C.data[e+1],le.evaluator.applyVec2(je,je);const t=_e*S.pixelRatio;let a=0;if(y.textureIsSignedDistanceField){a=Math.min(y.outlineSize,.5*je[0])*S.pixelRatio/2}je[0]*=j,je[1]*=M;const n=i*R.size,l=y.rotation+R.data[n];if(oe(x,fe[0],fe[1],je,t,a,l,y,w)){const e=s.ray;if(f(he,ce,r(ve,S.viewMatrix)),fe[0]=x[0],fe[1]=x[1],S.unprojectFromRenderScreen(fe,ce)){const t=O();d(t,e.direction);const i=1/g(t);m(t,t,i);o(b(e.origin,ce)*i,t,-1,he)}}}}}intersectDraped(e,t,i,s,r){const a=e.attributes.get("position"),n=e.attributes.get("size"),o=e.attributes.get("rotation"),l=this.parameters,c=J(l),u=e.attributes.get("featureAttribute"),f=null==u?null:_(u.data,Oe),{scaleX:p,scaleY:h}=De(f,l,e.screenToWorldRatio),m=Pe*e.screenToWorldRatio;for(let d=0;d<a.data.length/a.size;d++){const t=d*a.size,u=a.data[t],f=a.data[t+1],g=d*n.size;je[0]=n.data[g],je[1]=n.data[g+1];let b=0;if(l.textureIsSignedDistanceField){b=Math.min(l.outlineSize,.5*je[0])*e.screenToWorldRatio/2}je[0]*=p,je[1]*=h;const v=d*o.size,x=l.rotation+o.data[v];oe(i,u,f,je,m,b,x,l,c)&&s(r.distance,r.normal,-1)}}createBufferWriter(){return new Ce}applyShaderOffsetsView(e,t,i,s,r,a,n){const o=ae(t,i,r,ze);return this._applyVerticalGroundOffsetView(e,o,r,n),Re(this.parameters,n,o,r,a),this._applyPolygonOffsetView(n,o,s[3],r,n),this._applyCenterOffsetView(n,s,n),n}applyShaderOffsetsNDC(e,t,i,s,r){return this._applyCenterOffsetNDC(e,t,i,s),null!=r&&d(r,s),this._applyPolygonOffsetNDC(s,t,i,s),s}_applyPolygonOffsetView(t,i,s,r,a){const n=r.aboveGround?1:-1;let o=Math.sign(s);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return d(a,t);const c=e(Math.abs(i.cosAngle),.01,1),u=1-Math.sqrt(1-c*c)/c/r.viewport[2];return m(a,t,l>0?u:1/u),a}_applyVerticalGroundOffsetView(e,t,i,s){const r=g(e),a=i.aboveGround?1:-1,n=i.computeRenderPixelSizeAtDist(r)*F,o=m(ce,t.normal,a*n);return v(s,e,o),s}_applyCenterOffsetView(e,t,i){const s="screen"!==this.parameters.centerOffsetUnits;return i!==e&&d(i,e),s&&(i[0]+=t[0],i[1]+=t[1],t[2]&&(p(ue,i),x(i,i,m(ue,ue,t[2])))),i}_applyCenterOffsetNDC(e,t,i,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&d(s,e),r||(s[0]+=t[0]/i.fullWidth*2,s[1]+=t[1]/i.fullHeight*2),s}_applyPolygonOffsetNDC(e,t,i,s){const r=this.parameters.shaderPolygonOffset;if(e!==s&&d(s,e),r){const e=i.aboveGround?1:-1,a=e*Math.sign(t[3]);s[2]-=(a||e)*r}return s}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:i}=this.parameters,s=e[3]>=te||t>=te&&i[3]>=te;return this._visible&&s}createGLMaterial(e){return new se(e)}calculateRelativeScreenBounds(e,t,i=V()){return re(this.parameters,e,t,i),i[2]=i[0]+e[0],i[3]=i[1]+e[1],i}}class se extends L{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique($,e)}}function re(e,t,i,s){s[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*i,s[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*i}function ae(e,t,s,r){return M(t)&&(t=i(be,t)),S(r.normal,e,t),f(r.normal,r.normal,s.viewInverseTransposeMatrix),r.cosAngle=y(pe,Me),r}function ne(e){const t=e[0],i=e[1],s=e[2],r=e[3],a=e[4],n=e[5],o=e[6],l=e[7],c=e[8],u=1/Math.sqrt(t*t+i*i+s*s),f=1/Math.sqrt(r*r+a*a+n*n),p=1/Math.sqrt(o*o+l*l+c*c);return e[0]=t*u,e[1]=i*u,e[2]=s*u,e[3]=r*f,e[4]=a*f,e[5]=n*f,e[6]=o*p,e[7]=l*p,e[8]=c*p,e}function oe(e,i,s,r,a,l,c,u,f){let p=i-a-r[0]*f[0],h=p+r[0]+2*a,m=s-a-r[1]*f[1],d=m+r[1]+2*a;const g=u.distanceFieldBoundingBox;return u.textureIsSignedDistanceField&&null!=g&&(p+=r[0]*g[0],m+=r[1]*g[1],h-=r[0]*(1-g[2]),d-=r[1]*(1-g[3]),p-=l,h+=l,m-=l,d+=l),n(de,i,s),o(me,e,de,t(c)),me[0]>p&&me[0]<h&&me[1]>m&&me[1]<d}const le=new U,ce=O(),ue=O(),fe=P(),pe=O(),he=O(),me=c(),de=c(),ge=s(),be=s(),ve=a(),xe=P(),Se=O(),ye=O(),Oe=P(),ze={normal:pe,cosAngle:0},_e=1,Pe=2,je=l(0,0),Me=z(0,0,1);class Ve extends T{constructor(){super(...arguments),this.renderOccluded=1,this.isDecoration=!1,this.color=j(1,1,1,1),this.polygonOffset=!1,this.anchorPosition=l(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=j(1,1,1,1),this.outlineSize=0,this.distanceFieldBoundingBox=P(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.occlusionTest=!0,this.occludedFragmentFade=!1,this.horizonCullingEnabled=!1,this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.isFocused=!0,this.focusStyle="bright",this.draped=!1,this.isLabel=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class Ce{constructor(){this.layout=Q,this.instanceLayout=Z()}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}write(e,t,i,s,r,a){const{position:n,normal:o,color:l,size:c,rotation:u,centerOffsetAndDistance:f,featureAttribute:p,uvi:h}=r;I(i.get("position"),e,n,a),q(i.get("normal"),t,o,a);const m=i.get("position").indices.length;let d=0,g=0,b=K,v=K;const x=i.get("uvi")?.data;x&&x.length>=4&&(d=x[0],g=x[1],b=x[2],v=x[3]);for(let S=0;S<m;++S){const e=a+S;h.setValues(e,d,g,b,v)}if(G(i.get("color"),4,l,a),W(i.get("size"),c,a),H(i.get("rotation"),u,a),i.get("centerOffsetAndDistance")?N(i.get("centerOffsetAndDistance"),f,a):X(f,a,m),i.get("featureAttribute")?N(i.get("featureAttribute"),p,a):X(p,a,m),null!=s){const e=i.get("position")?.indices;if(e){const t=e.length,i=r.getField("olidColor",C);Y(s,i,t,a)}}return{numVerticesPerItem:1,numItems:m}}writeBaseInstance(e,t){const{uv0:i}=t;W(e.get("uv0"),i,0)}intersect(e,t,i,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:x},point:S,camera:y}=s;if(!l||!c||x&&t.isLabel||!S)return;const z=this.instanceLayout.createView(e),{position:_,normal:P,rotation:j,size:M,featureAttribute:V,centerOffsetAndDistance:C}=z,D="screen"===t.centerOffsetUnits,R=J(t);if(null==_||null==P||null==j||null==M||null==C||null==y)return;const A=null==V?null:V.getVec(0,Oe),{scaleX:w,scaleY:F}=De(A,t,y.pixelRatio),T=_.count;for(let L=0;L<T;L++){if(_.getVec(L,ce),null!=i&&v(ce,ce,i),f(ce,ce,y.viewMatrix),C.getVec(L,xe),u(Se,xe[0],xe[1],xe[2]),!D&&(ce[0]+=Se[0],ce[1]+=Se[1],0!==Se[2])){const e=Se[2];p(Se,ce),h(ce,ce,m(Se,Se,e))}if(P.getVec(L,ue),ae(ue,ge,y,ze),Re(t,ce,ze,y,le),y.applyProjection(ce,fe),fe[0]>-1){D&&(Se[0]||Se[1])&&(fe[0]+=Se[0]*y.pixelRatio,0!==Se[1]&&(fe[1]+=le.alignmentEvaluator.apply(Se[1])*y.pixelRatio),y.unapplyProjection(fe,ce)),fe[0]+=t.screenOffset[0]*y.pixelRatio,fe[1]+=t.screenOffset[1]*y.pixelRatio,fe[0]=Math.floor(fe[0]),fe[1]=Math.floor(fe[1]),M.getVec(L,je),le.evaluator.applyVec2(je,je);const e=_e*y.pixelRatio;let i=0;if(t.textureIsSignedDistanceField){i=Math.min(t.outlineSize,.5*je[0])*y.pixelRatio/2}je[0]*=w,je[1]*=F;const a=j.get(L),n=t.rotation+a;if(oe(S,fe[0],fe[1],je,e,i,n,t,R)){const e=s.ray;if(f(he,ce,r(ve,y.viewMatrix)),fe[0]=S[0],fe[1]=S[1],y.unprojectFromRenderScreen(fe,ce)){const t=O();d(t,e.direction);const i=1/g(t);m(t,t,i);o(b(e.origin,ce)*i,t,L,he)}}}}}}function De(e,t,i){return null==e||null==t.vvSize?{scaleX:i,scaleY:i}:(D(ye,t,e),{scaleX:ye[0]*i,scaleY:ye[1]*i})}function Re(e,t,i,s,r){if(!e.verticalOffset?.screenLength){const s=g(t);return r.update(i.cosAngle,s,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),t}const a=g(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=k(s,a,e.verticalOffset,i.cosAngle,n,e.screenSizePerspectiveMinPixelReferenceSize);return r.update(i.cosAngle,a,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),m(i.normal,i.normal,o),v(t,t,i.normal)}export{ie as HUDMaterial,Ve as Parameters};
|
|
5
|
+
import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{fromMat4 as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,rotate as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as l,create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{h as u,p as f,n as p,e as h,j as m,d,b as g,C as b,i as v,a as x,t as S,g as y}from"../../../../chunks/vec32.js";import{create as O,fromValues as z}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as _,create as P,freeze as j}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMat4 as M}from"../../../../core/libs/gl-matrix-2/types/mat4.js";import{create as V}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as C}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as D}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as R}from"../../support/debugFlags.js";import{isColorHighlightOrOLID as A,isColor as w}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as F}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterialBindParameters as T,GLTextureMaterial as L}from"../lib/GLTextureMaterial.js";import{Material as E}from"../lib/Material.js";import{SeparateScreenSizePerspectiveEvaluators as U}from"../lib/screenSizePerspectiveUtils.js";import{assert as B}from"../lib/Util.js";import{writePosition as I,writeNormal as q,writeColor as G,writeBufferVec2 as W,writeBufferFloat as H,writeBufferVec4 as N,writeBufferVec4Zeros as X,writeOlidColor as Y}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as k}from"./internal/MaterialUtil.js";import{c as J,f as K}from"../../../../chunks/HUDMaterial.glsl.js";import{baseLayout as Q,getInstanceLayout as Z,HUDMaterialTechnique as $}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as ee}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as te}from"../../../../webscene/support/AlphaCutoff.js";class ie extends E{constructor(e,t){super(e,Ve),this.produces=new Map([[14,e=>A(e)&&!this.parameters.drawAsLabel],[15,e=>A(e)&&this.parameters.drawAsLabel],[13,()=>this.parameters.occlusionTest],[19,e=>this.parameters.draped&&A(e)]]),this._visible=!0,this._configuration=new ee(t)}getConfiguration(e,t){const i=this.parameters.draped;return super.getConfiguration(e,t,this._configuration),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=i,this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,this._configuration.hasRotation=this.parameters.hasRotation,this._configuration.hasVVSize=!!this.parameters.vvSize,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration.occlusionPass=13===t.slot,this._configuration.occludedFragmentFade=!i&&this.parameters.occludedFragmentFade,this._configuration.horizonCullingEnabled=this.parameters.horizonCullingEnabled,this._configuration.isFocused=this.parameters.isFocused,this._configuration.depthTestEnabled=this.parameters.depthEnabled||13===t.slot,w(e)&&(this._configuration.debugDrawLabelBorder=!!R.LABELS_SHOW_BORDER),this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}intersect(e,t,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:v},point:x,camera:S}=s,{parameters:y}=this;if(!l||!c||v&&y.isLabel||!e.visible||!x||!S)return;const z=e.attributes.get("featureAttribute"),P=null==z?null:_(z.data,Oe),{scaleX:j,scaleY:M}=De(P,y,S.pixelRatio);i(ge,t),e.attributes.has("featureAttribute")&&ne(ge);const V=e.attributes.get("position"),C=e.attributes.get("size"),D=e.attributes.get("normal"),R=e.attributes.get("rotation"),A=e.attributes.get("centerOffsetAndDistance");B(V.size>=3);const w=J(y),F="screen"===this.parameters.centerOffsetUnits;for(let i=0;i<V.data.length/V.size;i++){const e=i*V.size;u(ce,V.data[e],V.data[e+1],V.data[e+2]),f(ce,ce,t),f(ce,ce,S.viewMatrix);const a=i*A.size;if(u(Se,A.data[a],A.data[a+1],A.data[a+2]),!F&&(ce[0]+=Se[0],ce[1]+=Se[1],0!==Se[2])){const e=Se[2];p(Se,ce),h(ce,ce,m(Se,Se,e))}const n=i*D.size;if(u(ue,D.data[n],D.data[n+1],D.data[n+2]),ae(ue,ge,S,ze),Re(this.parameters,ce,ze,S,le),S.applyProjection(ce,fe),fe[0]>-1){F&&(Se[0]||Se[1])&&(fe[0]+=Se[0]*S.pixelRatio,0!==Se[1]&&(fe[1]+=le.alignmentEvaluator.apply(Se[1])*S.pixelRatio),S.unapplyProjection(fe,ce)),fe[0]+=this.parameters.screenOffset[0]*S.pixelRatio,fe[1]+=this.parameters.screenOffset[1]*S.pixelRatio,fe[0]=Math.floor(fe[0]),fe[1]=Math.floor(fe[1]);const e=i*C.size;je[0]=C.data[e],je[1]=C.data[e+1],le.evaluator.applyVec2(je,je);const t=_e*S.pixelRatio;let a=0;if(y.textureIsSignedDistanceField){a=Math.min(y.outlineSize,.5*je[0])*S.pixelRatio/2}je[0]*=j,je[1]*=M;const n=i*R.size,l=y.rotation+R.data[n];if(oe(x,fe[0],fe[1],je,t,a,l,y,w)){const e=s.ray;if(f(he,ce,r(ve,S.viewMatrix)),fe[0]=x[0],fe[1]=x[1],S.unprojectFromRenderScreen(fe,ce)){const t=O();d(t,e.direction);const i=1/g(t);m(t,t,i);o(b(e.origin,ce)*i,t,-1,he)}}}}}intersectDraped(e,t,i,s,r){const a=e.attributes.get("position"),n=e.attributes.get("size"),o=e.attributes.get("rotation"),l=this.parameters,c=J(l),u=e.attributes.get("featureAttribute"),f=null==u?null:_(u.data,Oe),{scaleX:p,scaleY:h}=De(f,l,e.screenToWorldRatio),m=Pe*e.screenToWorldRatio;for(let d=0;d<a.data.length/a.size;d++){const t=d*a.size,u=a.data[t],f=a.data[t+1],g=d*n.size;je[0]=n.data[g],je[1]=n.data[g+1];let b=0;if(l.textureIsSignedDistanceField){b=Math.min(l.outlineSize,.5*je[0])*e.screenToWorldRatio/2}je[0]*=p,je[1]*=h;const v=d*o.size,x=l.rotation+o.data[v];oe(i,u,f,je,m,b,x,l,c)&&s(r.distance,r.normal,-1)}}createBufferWriter(){return new Ce}applyShaderOffsetsView(e,t,i,s,r,a,n){const o=ae(t,i,r,ze);return this._applyVerticalGroundOffsetView(e,o,r,n),Re(this.parameters,n,o,r,a),this._applyPolygonOffsetView(n,o,s[3],r,n),this._applyCenterOffsetView(n,s,n),n}applyShaderOffsetsNDC(e,t,i,s,r){return this._applyCenterOffsetNDC(e,t,i,s),null!=r&&d(r,s),this._applyPolygonOffsetNDC(s,t,i,s),s}_applyPolygonOffsetView(t,i,s,r,a){const n=r.aboveGround?1:-1;let o=Math.sign(s);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return d(a,t);const c=e(Math.abs(i.cosAngle),.01,1),u=1-Math.sqrt(1-c*c)/c/r.viewport[2];return m(a,t,l>0?u:1/u),a}_applyVerticalGroundOffsetView(e,t,i,s){const r=g(e),a=i.aboveGround?1:-1,n=i.computeRenderPixelSizeAtDist(r)*F,o=m(ce,t.normal,a*n);return v(s,e,o),s}_applyCenterOffsetView(e,t,i){const s="screen"!==this.parameters.centerOffsetUnits;return i!==e&&d(i,e),s&&(i[0]+=t[0],i[1]+=t[1],t[2]&&(p(ue,i),x(i,i,m(ue,ue,t[2])))),i}_applyCenterOffsetNDC(e,t,i,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&d(s,e),r||(s[0]+=t[0]/i.fullWidth*2,s[1]+=t[1]/i.fullHeight*2),s}_applyPolygonOffsetNDC(e,t,i,s){const r=this.parameters.shaderPolygonOffset;if(e!==s&&d(s,e),r){const e=i.aboveGround?1:-1,a=e*Math.sign(t[3]);s[2]-=(a||e)*r}return s}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:i}=this.parameters,s=e[3]>=te||t>=te&&i[3]>=te;return this._visible&&s}createGLMaterial(e){return new se(e)}calculateRelativeScreenBounds(e,t,i=V()){return re(this.parameters,e,t,i),i[2]=i[0]+e[0],i[3]=i[1]+e[1],i}}class se extends L{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique($,e)}}function re(e,t,i,s){s[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*i,s[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*i}function ae(e,t,s,r){return M(t)&&(t=i(be,t)),S(r.normal,e,t),f(r.normal,r.normal,s.viewInverseTransposeMatrix),r.cosAngle=y(pe,Me),r}function ne(e){const t=e[0],i=e[1],s=e[2],r=e[3],a=e[4],n=e[5],o=e[6],l=e[7],c=e[8],u=1/Math.sqrt(t*t+i*i+s*s),f=1/Math.sqrt(r*r+a*a+n*n),p=1/Math.sqrt(o*o+l*l+c*c);return e[0]=t*u,e[1]=i*u,e[2]=s*u,e[3]=r*f,e[4]=a*f,e[5]=n*f,e[6]=o*p,e[7]=l*p,e[8]=c*p,e}function oe(e,i,s,r,a,l,c,u,f){let p=i-a-r[0]*f[0],h=p+r[0]+2*a,m=s-a-r[1]*f[1],d=m+r[1]+2*a;const g=u.distanceFieldBoundingBox;return u.textureIsSignedDistanceField&&null!=g&&(p+=r[0]*g[0],m+=r[1]*g[1],h-=r[0]*(1-g[2]),d-=r[1]*(1-g[3]),p-=l,h+=l,m-=l,d+=l),n(de,i,s),o(me,e,de,t(c)),me[0]>p&&me[0]<h&&me[1]>m&&me[1]<d}const le=new U,ce=O(),ue=O(),fe=P(),pe=O(),he=O(),me=c(),de=c(),ge=s(),be=s(),ve=a(),xe=P(),Se=O(),ye=O(),Oe=P(),ze={normal:pe,cosAngle:0},_e=1,Pe=2,je=l(0,0),Me=z(0,0,1);class Ve extends T{constructor(){super(...arguments),this.renderOccluded=1,this.isDecoration=!1,this.color=j(1,1,1,1),this.polygonOffset=!1,this.anchorPosition=l(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=j(1,1,1,1),this.outlineSize=0,this.distanceFieldBoundingBox=P(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.occlusionTest=!0,this.occludedFragmentFade=!1,this.horizonCullingEnabled=!1,this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.isFocused=!0,this.focusStyle="bright",this.draped=!1,this.isLabel=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class Ce{constructor(){this.layout=Q,this.instanceLayout=Z()}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}write(e,t,i,s,r,a){const{position:n,normal:o,color:l,size:c,rotation:u,centerOffsetAndDistance:f,featureAttribute:p,uvi:h}=r;I(i.get("position"),e,n,a),q(i.get("normal"),t,o,a);const m=i.get("position").indices.length;let d=0,g=0,b=K,v=K;const x=i.get("uvi")?.data;x&&x.length>=4&&(d=x[0],g=x[1],b=x[2],v=x[3]);for(let S=0;S<m;++S){const e=a+S;h.setValues(e,d,g,b,v)}if(G(i.get("color"),4,l,a),W(i.get("size"),c,a),H(i.get("rotation"),u,a),i.get("centerOffsetAndDistance")?N(i.get("centerOffsetAndDistance"),f,a):X(f,a,m),i.get("featureAttribute")?N(i.get("featureAttribute"),p,a):X(p,a,m),null!=s){const e=i.get("position")?.indices;if(e){const t=e.length,i=r.getField("olidColor",C);Y(s,i,t,a)}}return{numVerticesPerItem:1,numItems:m}}writeBaseInstance(e,t){const{uv0:i}=t;W(e.get("uv0"),i,0)}intersect(e,t,i,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:x},point:S,camera:y}=s;if(!l||!c||x&&t.isLabel||!S)return;const z=this.instanceLayout.createView(e),{position:_,normal:P,rotation:j,size:M,featureAttribute:V,centerOffsetAndDistance:C}=z,D="screen"===t.centerOffsetUnits,R=J(t);if(null==_||null==P||null==j||null==M||null==C||null==y)return;const A=null==V?null:V.getVec(0,Oe),{scaleX:w,scaleY:F}=De(A,t,y.pixelRatio),T=_.count;for(let L=0;L<T;L++){if(_.getVec(L,ce),null!=i&&v(ce,ce,i),f(ce,ce,y.viewMatrix),C.getVec(L,xe),u(Se,xe[0],xe[1],xe[2]),!D&&(ce[0]+=Se[0],ce[1]+=Se[1],0!==Se[2])){const e=Se[2];p(Se,ce),h(ce,ce,m(Se,Se,e))}if(P.getVec(L,ue),ae(ue,ge,y,ze),Re(t,ce,ze,y,le),y.applyProjection(ce,fe),fe[0]>-1){D&&(Se[0]||Se[1])&&(fe[0]+=Se[0]*y.pixelRatio,0!==Se[1]&&(fe[1]+=le.alignmentEvaluator.apply(Se[1])*y.pixelRatio),y.unapplyProjection(fe,ce)),fe[0]+=t.screenOffset[0]*y.pixelRatio,fe[1]+=t.screenOffset[1]*y.pixelRatio,fe[0]=Math.floor(fe[0]),fe[1]=Math.floor(fe[1]),M.getVec(L,je),le.evaluator.applyVec2(je,je);const e=_e*y.pixelRatio;let i=0;if(t.textureIsSignedDistanceField){i=Math.min(t.outlineSize,.5*je[0])*y.pixelRatio/2}je[0]*=w,je[1]*=F;const a=j.get(L),n=t.rotation+a;if(oe(S,fe[0],fe[1],je,e,i,n,t,R)){const e=s.ray;if(f(he,ce,r(ve,y.viewMatrix)),fe[0]=S[0],fe[1]=S[1],y.unprojectFromRenderScreen(fe,ce)){const t=O();d(t,e.direction);const i=1/g(t);m(t,t,i);o(b(e.origin,ce)*i,t,L,he)}}}}}}function De(e,t,i){return null==e||null==t.vvSize?{scaleX:i,scaleY:i}:(D(ye,t,e),{scaleX:ye[0]*i,scaleY:ye[1]*i})}function Re(e,t,i,s,r){if(!e.verticalOffset?.screenLength){const s=g(t);return r.update(i.cosAngle,s,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),t}const a=g(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=k(s,a,e.verticalOffset,i.cosAngle,n,e.screenSizePerspectiveMinPixelReferenceSize);return r.update(i.cosAngle,a,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),m(i.normal,i.normal,o),v(t,t,i.normal)}export{ie as HUDMaterial,Ve as Parameters};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{BufferViewFloat as e}from"../../../../geometry/support/buffer/BufferView.js";import{
|
|
5
|
+
import{BufferViewFloat as e}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as t,isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{isUpdatableTexture as s}from"../lib/IManagedTexture.js";import{MaterialParameters as a}from"../lib/Material.js";import{assert as o}from"../lib/Util.js";import{DefaultBufferWriter as n}from"./DefaultBufferWriter.js";import{TriangleMaterial as u}from"./TriangleMaterial.js";import{writeBufferFloat as p,writeAttribute as h}from"./internal/bufferWriterUtils.js";import{getLayout as c,ImageMaterialTechnique as l}from"../shaders/ImageMaterialTechnique.js";import{ImageMaterialTechniqueConfiguration as f}from"../shaders/ImageMaterialTechniqueConfiguration.js";class m extends u{constructor(e){super(e,x),this.supportsEdges=!0,this.visible=!0,this.produces=new Map([[2,e=>t(e)],[4,e=>r(e)&&this.parameters.writeDepth],[9,e=>r(e)&&!this.parameters.writeDepth],[19,e=>r(e)||t(e)]]),this._configuration=new f(e.draped)}dispose(){this.setParameters({texture:void 0})}getConfiguration(e,t){return super.getConfiguration(e,t,this._configuration),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=t.hasOccludees,this._configuration.oitPass=t.oitPass,this._configuration.enableOffset=t.enableOffset,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.perspectiveInterpolation=this.parameters.perspectiveInterpolation,this._configuration}createGLMaterial(e){return new g(e)}createBufferWriter(){return new d(c(this.parameters))}}class g extends i{constructor(e){super({...e,...e.material.parameters}),this.parameters=e;const t=this._material.parameters.managedTexture;s(t)&&e.textures.updater.add(t)}dispose(){this.parameters.textures.updater.remove(this._material.parameters.managedTexture)}beginSlot(e){return this.getTechnique(l,e)}}class d extends n{write(t,r,i,s,a,n){for(const u of this.layout.fields.keys()){const s=i.get(u);if(s)if("perspectiveDivide"===u){o(1===s.size);const t=a.getField(u,e);t&&p(s,t,n)}else h(u,s,t,r,a,n)}return null}}class x extends a{constructor(e,t){super(),this.managedTexture=e,this.draped=t,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=0,this.opacity=1,this.perspectiveInterpolation=!1}get texture(){return this.managedTexture.texture}}export{m as ImageMaterial,x as Parameters};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{h as e,F as t,p as r}from"../../../../chunks/vec32.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{makeFloat16Array as s}from"../../../../geometry/support/float16.js";import{isColor as a,isDepth as o,
|
|
5
|
+
import{h as e,F as t,p as r}from"../../../../chunks/vec32.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{makeFloat16Array as s}from"../../../../geometry/support/float16.js";import{isColor as a,isDepth as o,isColorHighlightOLIDOrDepth as n}from"../core/shaderLibrary/ShaderOutput.js";import h from"../lib/GLMaterial.js";import{Material as c}from"../lib/Material.js";import{VisualVariablePassParameters as p}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as l}from"./internal/bufferWriterUtils.js";import{getLayout as m,LineMarkerTechnique as u}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as d}from"../shaders/LineMarkerTechniqueConfiguration.js";import{alphaCutoff as f}from"../../../../webscene/support/AlphaCutoff.js";class g extends c{constructor(e,t){super(e,v),this.produces=new Map([[2,e=>8===e||a(e)&&8===this.parameters.renderOccluded],[3,e=>o(e)],[11,e=>n(e)&&8===this.parameters.renderOccluded],[12,e=>n(e)&&8===this.parameters.renderOccluded],[4,e=>a(e)&&this.parameters.writeDepth],[9,e=>a(e)&&!this.parameters.writeDepth],[19,e=>a(e)||8===e]]),this.intersectDraped=void 0,this._configuration=new d(t)}getConfiguration(e,t){return super.getConfiguration(e,t,this._configuration),this._configuration.space=19===t.slot?0:this.parameters.worldSpace?2:1,this._configuration.hideOnShortSegments=this.parameters.hideOnShortSegments,this._configuration.hasCap=0!==this.parameters.cap,this._configuration.anchor=this.parameters.anchor,this._configuration.hasTip=this.parameters.hasTip,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=t.hasOccludees,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest&&a(e),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration}get visible(){return this.parameters.color[3]>=f}intersect(){}createBufferWriter(){return new S(m(this.parameters),this.parameters)}createGLMaterial(e){return new _(e)}}class _ extends h{dispose(){super.dispose(),this._markerTextures?.release(this._markerPrimitive),this._markerPrimitive=null}beginSlot(e){const t=this._material.parameters.markerPrimitive;return t!==this._markerPrimitive&&(this._material.setParameters({markerTexture:this._markerTextures.swap(t,this._markerPrimitive)}),this._markerPrimitive=t),this.getTechnique(u,e)}}class v extends p{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.markerPrimitive="arrow",this.placement="end",this.cap=0,this.anchor=0,this.hasTip=!1,this.worldSpace=!1,this.hideOnShortSegments=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.stipplePattern=null,this.markerTexture=null}}class S{constructor(e,t){this.layout=e,this._parameters=t}elementCount(){return"begin-end"===this._parameters.placement?12:6}write(i,a,o,n,h,c){const p=o.get("position").data,m=p.length/3;let u=[1,0,0];const d=o.get("normal");this._parameters.worldSpace&&null!=d&&(u=d.data);let f=1,g=0;this._parameters.vvSize?g=o.get("sizeFeatureAttribute").data[0]:o.has("size")&&(f=o.get("size").data[0]);let _=[1,1,1,1],v=0;this._parameters.vvColor?v=o.get("colorFeatureAttribute").data[0]:o.has("color")&&(_=o.get("color").data);let S=0;this._parameters.vvOpacity&&(S=o.get("opacityFeatureAttribute").data[0]);const P=new Float32Array(h.buffer),T=s(h.buffer),k=new Uint8Array(h.buffer);let O=c*(this.layout.stride/4);const V=P.BYTES_PER_ELEMENT/T.BYTES_PER_ELEMENT,j=4/V,y=(e,t,r,i)=>{P[O++]=e[0],P[O++]=e[1],P[O++]=e[2],l(t,e,T,O*V),O+=j;let s=O*V;if(T[s++]=r[0],T[s++]=r[1],O=Math.ceil(s/V),this._parameters.vvColor)P[O++]=v;else{const e=Math.min(4*i,_.length-4),t=4*O++;k[t]=255*_[e],k[t+1]=255*_[e+1],k[t+2]=255*_[e+2],k[t+3]=255*_[e+3]}this._parameters.vvOpacity&&(P[O++]=S),s=O*V,this._parameters.vvSize?(P[O++]=g,s+=2):T[s++]=f,this._parameters.worldSpace&&(T[s++]=u[0],T[s++]=u[1],T[s++]=u[2]),O=Math.ceil(s/V)},M=(s,a)=>{const o=e(b,p[3*s],p[3*s+1],p[3*s+2]),n=w;let h=s+a;do{e(n,p[3*h],p[3*h+1],p[3*h+2]),h+=a}while(t(o,n)&&h>=0&&h<m);i&&(r(o,o,i),r(n,n,i)),y(o,n,[-1,-1],s),y(o,n,[1,-1],s),y(o,n,[1,1],s),y(o,n,[-1,-1],s),y(o,n,[1,1],s),y(o,n,[-1,1],s)},C=this._parameters.placement;return"begin"!==C&&"begin-end"!==C||M(0,1),"end"!==C&&"begin-end"!==C||M(m-1,-1),null}}const b=i(),w=i();export{g as LineMarkerMaterial,v as Parameters};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{copy as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{h as i,e as s,g as n,j as a,i as c,d as l,b as m,C as u}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as p}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{distance2 as h,fromPoints as g,create as d,closestLineSegmentPoint as j}from"../../../../geometry/support/lineSegment.js";import{fromPoints as b,create as x,signedDistance as L,getNormal as v}from"../../../../geometry/support/plane.js";import{
|
|
5
|
+
import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{copy as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{h as i,e as s,g as n,j as a,i as c,d as l,b as m,C as u}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as p}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{distance2 as h,fromPoints as g,create as d,closestLineSegmentPoint as j}from"../../../../geometry/support/lineSegment.js";import{fromPoints as b,create as x,signedDistance as L,getNormal as v}from"../../../../geometry/support/plane.js";import{isColorHighlightOrOLID as y}from"../core/shaderLibrary/ShaderOutput.js";import S from"../lib/GLMaterial.js";import{Material as M,MaterialParameters as _}from"../lib/Material.js";import{isTranslationMatrix as w}from"../lib/Util.js";import{DefaultBufferWriter as C}from"./DefaultBufferWriter.js";import{PositionColorLayout as T,PositionLayout as A}from"./DefaultLayouts.js";import{NativeLineTechnique as V}from"../shaders/NativeLineTechnique.js";import{NativeLineTechniqueConfiguration as N}from"../shaders/NativeLineTechniqueConfiguration.js";import{alphaCutoff as R}from"../../../../webscene/support/AlphaCutoff.js";class U extends M{constructor(e){super(e,P),this._configuration=new N,this.produces=new Map([[2,e=>y(e)]])}getConfiguration(e,t){return super.getConfiguration(e,t,this._configuration),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.transparent=this.parameters.color[3]<1||this.parameters.width<1,this._configuration.hasOccludees=t.hasOccludees,this._configuration}get visible(){return this.parameters.color[3]>=R}intersect(t,r,f,p,d,x){const{options:y,camera:S,rayBegin:M,rayEnd:_}=f;if(!y.selectionMode||!t.visible||!S)return;if(!w(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial").error("intersection assumes a translation-only matrix");const C=t.attributes.get("position").data,T=H;o(T,f.point);const A=2;i(I[0],T[0]-A,T[1]+A,0),i(I[1],T[0]+A,T[1]+A,0),i(I[2],T[0]+A,T[1]-A,0),i(I[3],T[0]-A,T[1]-A,0);for(let e=0;e<4;e++)if(!S.unprojectFromRenderScreen(I[e],J[e]))return;b(S.eye,J[0],J[1],K),b(S.eye,J[1],J[2],Q),b(S.eye,J[2],J[3],Y),b(S.eye,J[3],J[0],Z);let V=Number.MAX_VALUE,N=0;for(let e=0;e<C.length-5;e+=3){if(q[0]=C[e]+r[12],q[1]=C[e+1]+r[13],q[2]=C[e+2]+r[14],B[0]=C[e+3]+r[12],B[1]=C[e+4]+r[13],B[2]=C[e+5]+r[14],L(K,q)<0&&L(K,B)<0||L(Q,q)<0&&L(Q,B)<0||L(Y,q)<0&&L(Y,B)<0||L(Z,q)<0&&L(Z,B)<0)continue;const t=S.projectToRenderScreen(q,W),o=S.projectToRenderScreen(B,X);if(null==t||null==o)continue;if(t[2]<0&&o[2]>0){s(D,q,B);const e=S.frustum,r=-L(e[4],q)/n(D,v(e[4]));if(a(D,D,r),c(q,q,D),!S.projectToRenderScreen(q,t))continue}else if(t[2]>0&&o[2]<0){s(D,B,q);const e=S.frustum,t=-L(e[4],B)/n(D,v(e[4]));if(a(D,D,t),c(B,B,D),!S.projectToRenderScreen(B,o))continue}else if(t[2]<0&&o[2]<0)continue;t[2]=0,o[2]=0;const i=h(g(t,o,z),T);i<V&&(V=i,l(G,q),l(k,B),N=e/3)}if(V<A*A){let e=Number.MAX_VALUE;if(j(g(G,k,z),g(M,_,F),O)){s(O,O,M);const t=m(O);a(O,O,1/t),e=t/u(M,_)}x(e,O,N)}}intersectDraped(e,r,o,i,s){if(!r.options.selectionMode)return;const n=e.attributes.get("position").data,a=e.attributes.get("size"),c=a?a.data[0]:0,l=o[0],m=o[1],u=((c+1)/2+4)*e.screenToWorldRatio;let f=Number.MAX_VALUE,p=0;for(let h=0;h<n.length-5;h+=3){const e=n[h],r=n[h+1],o=l-e,i=m-r,s=n[h+3]-e,a=n[h+4]-r,c=t((s*o+a*i)/(s*s+a*a),0,1),u=s*c-o,g=a*c-i,d=u*u+g*g;d<f&&(f=d,p=h/3)}f<u*u&&i(s.distance,s.normal,p)}createGLMaterial(e){return new E(e)}createBufferWriter(){const e=this.parameters.hasVertexColors?T:A;return new C(e)}}class E extends S{beginSlot(e){return this.getTechnique(V,e)}}class P extends _{constructor(){super(...arguments),this.color=p,this.hasVertexColors=!1,this.hasSlicePlane=!1,this.width=1}}const q=f(),B=f(),D=f(),O=f(),W=r(),X=r(),G=f(),k=f(),z=d(),F=d(),H=f(),I=[r(),r(),r(),r()],J=[f(),f(),f(),f()],K=x(),Q=x(),Y=x(),Z=x();export{U as NativeLineMaterial,P as Parameters};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{BufferViewMat3f as e,BufferViewVec4f as r}from"../../../../geometry/support/buffer/BufferView.js";import{
|
|
5
|
+
import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{BufferViewMat3f as e,BufferViewVec4f as r}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as s,isColor as i,isDepth as o,isColorHighlightOrOLID as a}from"../core/shaderLibrary/ShaderOutput.js";import n from"../lib/GLMaterial.js";import{assert as f}from"../lib/Util.js";import{DefaultBufferWriter as c}from"./DefaultBufferWriter.js";import{TriangleMaterial as l}from"./TriangleMaterial.js";import{VisualVariablePassParameters as h}from"./VisualVariablePassParameters.js";import{writeAttributes as u,writeBufferVec4 as p}from"./internal/bufferWriterUtils.js";import{getLayout as m,PatternTechnique as g}from"../shaders/PatternTechnique.js";import{PatternTechniqueConfiguration as d}from"../shaders/PatternTechniqueConfiguration.js";import{alphaCutoff as b}from"../../../../webscene/support/AlphaCutoff.js";class _ extends l{constructor(t){super(t,v),this._configuration=new d,this.supportsEdges=!0,this.produces=new Map([[2,t=>s(t)],[4,t=>i(t)],[5,t=>o(t)],[19,t=>this.parameters.draped&&a(t)]])}getConfiguration(t,e){return super.getConfiguration(t,e,this._configuration),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.style=this.parameters.style,this._configuration.draped=this.parameters.draped,this._configuration.oitPass=e.oitPass,this._configuration.enableOffset=e.enableOffset,this._configuration.terrainDepthTest=e.terrainDepthTest&&i(t),this._configuration.cullAboveTerrain=e.cullAboveTerrain,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration}get visible(){return this.parameters.color[3]>=b}createGLMaterial(t){return new y(t)}createBufferWriter(){return new j(m(this.parameters))}}class y extends n{beginSlot(t){return this.getTechnique(g,t)}}class j extends c{write(t,s,i,o,a,n){const c=u(i,o,this.layout,t,s,a,n);for(const l of this.layout.fields.keys()){const s=i.get(l),o=s?.indices;if(s&&o)switch(l){case"uvMapSpace":{f(4===s.size);const t=a.getField(l,r);t&&p(s,t,n);break}case"boundingRect":{f(9===s.size);const r=a.getField(l,e);r&&C(s,t,r,n);break}}}return c}}function C(t,e,r,s){const{data:i,indices:o}=t,a=e,n=r.typedBuffer,f=r.typedBufferStride,c=o.length;s*=f;for(let l=0;l<c;++l){const t=9*o[l],e=i[t],r=i[t+1],c=i[t+2];n[s]=a[0]*e+a[4]*r+a[8]*c+a[12],n[s+1]=a[1]*e+a[5]*r+a[9]*c+a[13],n[s+2]=a[2]*e+a[6]*r+a[10]*c+a[14];for(let o=3;o<9;++o)n[s+o]=i[t+o];s+=f}}class v extends h{constructor(){super(...arguments),this.color=t(1,1,1,1),this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=0,this.hasOccludees=!1,this.style=2,this.draped=!0}}export{v as Parameters,_ as PatternMaterial};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../../../core/Logger.js";import{clamp as e}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as r}from"../../../../core/time.js";import{copy as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{h as a,e as n,g as o,j as l,i as h,d as c,b as m,C as p,p as u}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{c as d}from"../../../../chunks/vec42.js";import{ONES as g,create as b}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as _}from"../../../../geometry/support/float16.js";import{distance2 as S,fromPoints as v,create as P,closestLineSegmentPoint as j}from"../../../../geometry/support/lineSegment.js";import{fromPoints as E,create as w,signedDistance as y,getNormal as T}from"../../../../geometry/support/plane.js";import{isHighlightOrOID as z,isColor as A,isDepth as C,isColorHighlightOIDOrDepth as O,is2DGeometryOutput as L}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as M}from"../effects/geometry/olidUtils.js";import V from"../lib/GLMaterial.js";import{Material as R}from"../lib/Material.js";import{isTranslationMatrix as x}from"../lib/Util.js";import{VisualVariablePassParameters as F}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as k}from"./internal/bufferWriterUtils.js";import{r as N}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as U,RibbonLineTechnique as D}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as B}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as W}from"../../../../webscene/support/AlphaCutoff.js";class J extends R{constructor(t,e){super(t,q),this.produces=new Map([[2,t=>z(t)||A(t)&&8===this.parameters.renderOccluded],[3,t=>C(t)],[11,t=>O(t)&&8===this.parameters.renderOccluded],[12,t=>O(t)&&8===this.parameters.renderOccluded],[4,t=>A(t)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[9,t=>A(t)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[19,t=>L(t)]]),this._configuration=new B(e)}getConfiguration(t,e){super.getConfiguration(t,e,this._configuration),this._configuration.oitPass=e.oitPass,this._configuration.draped=19===e.slot;const i=null!=this.parameters.stipplePattern&&8!==t;return this._configuration.stippleEnabled=i,this._configuration.stippleOffColorEnabled=i&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=i&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&H(this.parameters.markerParameters),this._configuration.hasPolygonOffset=this.parameters.hasPolygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.terrainDepthTest=e.terrainDepthTest&&A(t),this._configuration.cullAboveTerrain=e.cullAboveTerrain,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.hasEmissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration}get visible(){return this.parameters.color[3]>=W||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>W}setParameters(t,e){t.animation=this.parameters.animation,super.setParameters(t,e)}intersectDraped({attributes:t,screenToWorldRatio:i},r,s,a,n){if(!r.options.selectionMode)return;const o=t.get("size");let l=this.parameters.width;if(this.parameters.vvSize){const i=t.get("sizeFeatureAttribute").data[0];Number.isNaN(i)?l*=this.parameters.vvSize.fallback[0]:l*=e(this.parameters.vvSize.offset[0]+i*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else o&&(l*=o.data[0]);const h=s[0],c=s[1],m=(l/2+4)*i;let p=Number.MAX_VALUE,u=0;const f=t.get("position").data,d=I(this.parameters,t)?f.length-2:f.length-5;for(let g=0;g<d;g+=3){const t=f[g],i=f[g+1],r=(g+3)%f.length,s=h-t,a=c-i,n=f[r]-t,o=f[r+1]-i,l=e((n*s+o*a)/(n*n+o*o),0,1),m=n*l-s,d=o*l-a,b=m*m+d*d;b<p&&(p=b,u=g/3)}p<m*m&&a(n.distance,n.normal,u)}intersect(i,r,u,f,d,g){const{options:b,camera:_,rayBegin:P,rayEnd:w}=u;if(!b.selectionMode||!i.visible||!_)return;if(!x(r))return void t.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const z=i.attributes,A=z.get("position").data;let C=this.parameters.width;if(this.parameters.vvSize){const t=z.get("sizeFeatureAttribute").data[0];Number.isNaN(t)||(C*=e(this.parameters.vvSize.offset[0]+t*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else z.has("size")&&(C*=z.get("size").data[0]);const O=tt;s(O,u.point);const L=C*_.pixelRatio/2+4*_.pixelRatio;a(mt[0],O[0]-L,O[1]+L,0),a(mt[1],O[0]+L,O[1]+L,0),a(mt[2],O[0]+L,O[1]-L,0),a(mt[3],O[0]-L,O[1]-L,0);for(let t=0;t<4;t++)if(!_.unprojectFromRenderScreen(mt[t],pt[t]))return;E(_.eye,pt[0],pt[1],ut),E(_.eye,pt[1],pt[2],ft),E(_.eye,pt[2],pt[3],dt),E(_.eye,pt[3],pt[0],gt);let M=Number.MAX_VALUE,V=0;const R=I(this.parameters,z)?A.length-2:A.length-5;for(let t=0;t<R;t+=3){K[0]=A[t]+r[12],K[1]=A[t+1]+r[13],K[2]=A[t+2]+r[14];const e=(t+3)%A.length;if(Q[0]=A[e]+r[12],Q[1]=A[e+1]+r[13],Q[2]=A[e+2]+r[14],y(ut,K)<0&&y(ut,Q)<0||y(ft,K)<0&&y(ft,Q)<0||y(dt,K)<0&&y(dt,Q)<0||y(gt,K)<0&&y(gt,Q)<0)continue;const i=_.projectToRenderScreen(K,et),s=_.projectToRenderScreen(Q,it);if(null==i||null==s)continue;if(i[2]<0&&s[2]>0){n(Z,K,Q);const t=_.frustum,e=-y(t[4],K)/o(Z,T(t[4]));if(l(Z,Z,e),h(K,K,Z),!_.projectToRenderScreen(K,i))continue}else if(i[2]>0&&s[2]<0){n(Z,Q,K);const t=_.frustum,e=-y(t[4],Q)/o(Z,T(t[4]));if(l(Z,Z,e),h(Q,Q,Z),!_.projectToRenderScreen(Q,s))continue}else if(i[2]<0&&s[2]<0)continue;i[2]=0,s[2]=0;const a=S(v(i,s,at),O);a<M&&(M=a,c(rt,K),c(st,Q),V=t/3)}if(M<L*L){let t=Number.MAX_VALUE;if(j(v(rt,st,at),v(P,w,nt),$)){n($,$,P);const e=m($);l($,$,1/e),t=e/p(P,w)}g(t,$,V)}}get hasEmissions(){return this.parameters.emissiveStrength>0}createBufferWriter(){return new X(U(this.parameters),this.parameters)}createGLMaterial(t){return new Y(t)}validateParameters(t){"miter"!==t.join&&(t.miterLimit=0),null!=t.markerParameters&&(t.markerScale=t.markerParameters.width/t.width)}update(t){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:r(t.time)},!1),0!==t.dt)}}class Y extends V{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(t){const e=this._material.parameters.stipplePattern;return this._stipplePattern!==e&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(e,this._stipplePattern)}),this._stipplePattern=e),this.getTechnique(D,t)}}class q extends F{constructor(){super(...arguments),this.width=0,this.color=g,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.hasPolygonOffset=!1,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=0,this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=0,this.endTime=1/0,this.fadeInTime=0,this.fadeOutTime=1/0,this.emissiveStrength=0}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}}class X{constructor(t,e){this.layout=t,this._parameters=e;const i=e.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=i;break;case"round":this.numJoinSubdivisions=N+i}}_isClosed(t){return I(this._parameters,t)}allocate(t){return this.layout.createBuffer(t)}elementCount(t){const e=2,i=t.get("position").indices.length/2+1,r=this._isClosed(t);let s=r?2:2*e;return s+=((r?i:i-1)-(r?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(t,e,i,r,s,n){const o=this.layout,l=i.get("position"),h=l.indices,m=l.data.length/3,f=i.get("distanceToStart")?.data;h&&h.length!==2*(m-1)&&console.warn("RibbonLineMaterial does not support indices");const g=o.fields.has("sizeFeatureAttribute");let b=1,S=null;if(g){const t=i.get("sizeFeatureAttribute");1===t.data.length?b=t.data[0]:S=t.data}else b=i.get("size")?.data[0]??1;let v=[1,1,1,1],P=0,j=null;const E=o.fields.has("colorFeatureAttribute");if(E){const t=i.get("colorFeatureAttribute");1===t.data.length?P=t.data[0]:j=t.data}else v=i.get("color")?.data??v;const w=i.get("timeStamps")?.data,y=w&&o.fields.has("timeStamps"),T=o.fields.has("opacityFeatureAttribute");let z=0,A=null;if(T){const t=i.get("opacityFeatureAttribute");1===t.data.length?z=t.data[0]:A=t.data}const C=new Float32Array(s.buffer),O=_(s.buffer),L=new Uint8Array(s.buffer),V=o.stride/4;let R=n*V;const x=R;let F=0;const N=f?(t,e,i)=>F=f[i]:(t,e,i)=>F+=p(t,e),U=C.BYTES_PER_ELEMENT/O.BYTES_PER_ELEMENT,D=4/U,B=M(),W=(t,e,i,s,a,n,o,l)=>{C[R++]=e[0],C[R++]=e[1],C[R++]=e[2],k(t,e,O,R*U),R+=D,k(i,e,O,R*U),R+=D,C[R++]=l;let h=R*U;if(O[h++]=a,O[h++]=n,R=Math.ceil(h/U),E)C[R]=j?.[o]??P;else{const t=Math.min(4*o,v.length-4),e=4*R;L[e]=255*v[t],L[e+1]=255*v[t+1],L[e+2]=255*v[t+2],L[e+3]=255*v[t+3]}if(R++,C[R++]=S?.[o]??b,T&&(C[R++]=A?.[o]??z),B){let t=4*R;r?(L[t++]=r[0],L[t++]=r[1],L[t++]=r[2],L[t++]=r[3]):(L[t++]=0,L[t++]=0,L[t++]=0,L[t++]=0),R=Math.ceil(.25*t)}y&&(h=R*U,O[h++]=s[0],O[h++]=s[1],O[h++]=s[2],O[h++]=s[3],R=Math.ceil(h/U))};R+=V,a(lt,l.data[0],l.data[1],l.data[2]),y&&d(ct,w[0],w[1],w[2],w[3]),t&&u(lt,lt,t);const J=this._isClosed(i);if(J){const e=l.data.length-3;a(ot,l.data[e],l.data[e+1],l.data[e+2]),t&&u(ot,ot,t)}else a(ht,l.data[3],l.data[4],l.data[5]),t&&u(ht,ht,t),W(lt,lt,ht,ct,1,-4,0,0),W(lt,lt,ht,ct,1,4,0,0),c(ot,lt),c(lt,ht),y&&d(ct,w[4],w[5],w[6],w[7]);const Y=J?0:1,q=J?m:m-1;for(let p=Y;p<q;p++){const e=(p+1)%m*3;a(ht,l.data[e],l.data[e+1],l.data[e+2]),t&&u(ht,ht,t),N(ot,lt,p),W(ot,lt,ht,ct,0,-1,p,F),W(ot,lt,ht,ct,0,1,p,F);const i=this.numJoinSubdivisions;for(let t=0;t<i;++t){const e=(t+1)/(i+1);W(ot,lt,ht,ct,e,-1,p,F),W(ot,lt,ht,ct,e,1,p,F)}if(W(ot,lt,ht,ct,1,-2,p,F),W(ot,lt,ht,ct,1,2,p,F),c(ot,lt),c(lt,ht),y){const t=(p+1)%m*4;d(ct,w[t],w[t+1],w[t+2],w[t+3])}}J?(a(ht,l.data[3],l.data[4],l.data[5]),t&&u(ht,ht,t),F=N(ot,lt,q),W(ot,lt,ht,ct,0,-1,Y,F),W(ot,lt,ht,ct,0,1,Y,F)):(F=N(ot,lt,q),W(ot,lt,lt,ct,0,-5,q,F),W(ot,lt,lt,ct,0,5,q,F)),G(C,x+V,C,x,V);return R=G(C,R-V,C,R,V),this._parameters.wireframe&&this._addWireframeVertices(s,x,R,V),null}_addWireframeVertices(t,e,i,r){const s=new Float32Array(t.buffer,i*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(t.buffer,e*Float32Array.BYTES_PER_ELEMENT,i-e);let n=0;const o=t=>n=G(a,t,s,n,r);for(let l=0;l<a.length-1;l+=2*r)o(l),o(l+2*r),o(l+1*r),o(l+2*r),o(l+1*r),o(l+3*r)}}function G(t,e,i,r,s){for(let a=0;a<s;a++)i[r++]=t[e++];return r}function I(t,e){if(!t.isClosed)return!1;return e.get("position").indices.length>2}function H(t){return 1===t.anchor&&t.hideOnShortSegments&&"begin-end"===t.placement&&t.worldSpace}const K=f(),Q=f(),Z=f(),$=f(),tt=f(),et=i(),it=i(),rt=f(),st=f(),at=P(),nt=P(),ot=f(),lt=f(),ht=f(),ct=b(),mt=[i(),i(),i(),i()],pt=[f(),f(),f(),f()],ut=w(),ft=w(),dt=w(),gt=w();export{q as Parameters,J as RibbonLineMaterial};
|
|
5
|
+
import t from"../../../../core/Logger.js";import{clamp as e}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as r}from"../../../../core/time.js";import{copy as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{h as a,e as n,g as o,j as l,i as h,d as c,b as m,C as p,p as u}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{c as d}from"../../../../chunks/vec42.js";import{ONES as g,create as b}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as _}from"../../../../geometry/support/float16.js";import{distance2 as S,fromPoints as v,create as P,closestLineSegmentPoint as j}from"../../../../geometry/support/lineSegment.js";import{fromPoints as E,create as w,signedDistance as y,getNormal as T}from"../../../../geometry/support/plane.js";import{isHighlightOrOLID as z,isColor as A,isDepth as C,isColorHighlightOLIDOrDepth as O,is2DGeometryOutput as L}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as M}from"../effects/geometry/olidUtils.js";import V from"../lib/GLMaterial.js";import{Material as R}from"../lib/Material.js";import{isTranslationMatrix as x}from"../lib/Util.js";import{VisualVariablePassParameters as F}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as k}from"./internal/bufferWriterUtils.js";import{r as N}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as U,RibbonLineTechnique as D}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as B}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as W}from"../../../../webscene/support/AlphaCutoff.js";class J extends R{constructor(t,e){super(t,q),this.produces=new Map([[2,t=>z(t)||A(t)&&8===this.parameters.renderOccluded],[3,t=>C(t)],[11,t=>O(t)&&8===this.parameters.renderOccluded],[12,t=>O(t)&&8===this.parameters.renderOccluded],[4,t=>A(t)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[9,t=>A(t)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[19,t=>L(t)]]),this._configuration=new B(e)}getConfiguration(t,e){super.getConfiguration(t,e,this._configuration),this._configuration.oitPass=e.oitPass,this._configuration.draped=19===e.slot;const i=null!=this.parameters.stipplePattern&&8!==t;return this._configuration.stippleEnabled=i,this._configuration.stippleOffColorEnabled=i&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=i&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&H(this.parameters.markerParameters),this._configuration.hasPolygonOffset=this.parameters.hasPolygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.terrainDepthTest=e.terrainDepthTest&&A(t),this._configuration.cullAboveTerrain=e.cullAboveTerrain,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.hasEmissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration}get visible(){return this.parameters.color[3]>=W||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>W}setParameters(t,e){t.animation=this.parameters.animation,super.setParameters(t,e)}intersectDraped({attributes:t,screenToWorldRatio:i},r,s,a,n){if(!r.options.selectionMode)return;const o=t.get("size");let l=this.parameters.width;if(this.parameters.vvSize){const i=t.get("sizeFeatureAttribute").data[0];Number.isNaN(i)?l*=this.parameters.vvSize.fallback[0]:l*=e(this.parameters.vvSize.offset[0]+i*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else o&&(l*=o.data[0]);const h=s[0],c=s[1],m=(l/2+4)*i;let p=Number.MAX_VALUE,u=0;const f=t.get("position").data,d=I(this.parameters,t)?f.length-2:f.length-5;for(let g=0;g<d;g+=3){const t=f[g],i=f[g+1],r=(g+3)%f.length,s=h-t,a=c-i,n=f[r]-t,o=f[r+1]-i,l=e((n*s+o*a)/(n*n+o*o),0,1),m=n*l-s,d=o*l-a,b=m*m+d*d;b<p&&(p=b,u=g/3)}p<m*m&&a(n.distance,n.normal,u)}intersect(i,r,u,f,d,g){const{options:b,camera:_,rayBegin:P,rayEnd:w}=u;if(!b.selectionMode||!i.visible||!_)return;if(!x(r))return void t.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const z=i.attributes,A=z.get("position").data;let C=this.parameters.width;if(this.parameters.vvSize){const t=z.get("sizeFeatureAttribute").data[0];Number.isNaN(t)||(C*=e(this.parameters.vvSize.offset[0]+t*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else z.has("size")&&(C*=z.get("size").data[0]);const O=tt;s(O,u.point);const L=C*_.pixelRatio/2+4*_.pixelRatio;a(mt[0],O[0]-L,O[1]+L,0),a(mt[1],O[0]+L,O[1]+L,0),a(mt[2],O[0]+L,O[1]-L,0),a(mt[3],O[0]-L,O[1]-L,0);for(let t=0;t<4;t++)if(!_.unprojectFromRenderScreen(mt[t],pt[t]))return;E(_.eye,pt[0],pt[1],ut),E(_.eye,pt[1],pt[2],ft),E(_.eye,pt[2],pt[3],dt),E(_.eye,pt[3],pt[0],gt);let M=Number.MAX_VALUE,V=0;const R=I(this.parameters,z)?A.length-2:A.length-5;for(let t=0;t<R;t+=3){K[0]=A[t]+r[12],K[1]=A[t+1]+r[13],K[2]=A[t+2]+r[14];const e=(t+3)%A.length;if(Q[0]=A[e]+r[12],Q[1]=A[e+1]+r[13],Q[2]=A[e+2]+r[14],y(ut,K)<0&&y(ut,Q)<0||y(ft,K)<0&&y(ft,Q)<0||y(dt,K)<0&&y(dt,Q)<0||y(gt,K)<0&&y(gt,Q)<0)continue;const i=_.projectToRenderScreen(K,et),s=_.projectToRenderScreen(Q,it);if(null==i||null==s)continue;if(i[2]<0&&s[2]>0){n(Z,K,Q);const t=_.frustum,e=-y(t[4],K)/o(Z,T(t[4]));if(l(Z,Z,e),h(K,K,Z),!_.projectToRenderScreen(K,i))continue}else if(i[2]>0&&s[2]<0){n(Z,Q,K);const t=_.frustum,e=-y(t[4],Q)/o(Z,T(t[4]));if(l(Z,Z,e),h(Q,Q,Z),!_.projectToRenderScreen(Q,s))continue}else if(i[2]<0&&s[2]<0)continue;i[2]=0,s[2]=0;const a=S(v(i,s,at),O);a<M&&(M=a,c(rt,K),c(st,Q),V=t/3)}if(M<L*L){let t=Number.MAX_VALUE;if(j(v(rt,st,at),v(P,w,nt),$)){n($,$,P);const e=m($);l($,$,1/e),t=e/p(P,w)}g(t,$,V)}}get hasEmissions(){return this.parameters.emissiveStrength>0}createBufferWriter(){return new X(U(this.parameters),this.parameters)}createGLMaterial(t){return new Y(t)}validateParameters(t){"miter"!==t.join&&(t.miterLimit=0),null!=t.markerParameters&&(t.markerScale=t.markerParameters.width/t.width)}update(t){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:r(t.time)},!1),0!==t.dt)}}class Y extends V{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(t){const e=this._material.parameters.stipplePattern;return this._stipplePattern!==e&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(e,this._stipplePattern)}),this._stipplePattern=e),this.getTechnique(D,t)}}class q extends F{constructor(){super(...arguments),this.width=0,this.color=g,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.hasPolygonOffset=!1,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=0,this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=0,this.endTime=1/0,this.fadeInTime=0,this.fadeOutTime=1/0,this.emissiveStrength=0}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}}class X{constructor(t,e){this.layout=t,this._parameters=e;const i=e.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=i;break;case"round":this.numJoinSubdivisions=N+i}}_isClosed(t){return I(this._parameters,t)}allocate(t){return this.layout.createBuffer(t)}elementCount(t){const e=2,i=t.get("position").indices.length/2+1,r=this._isClosed(t);let s=r?2:2*e;return s+=((r?i:i-1)-(r?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(t,e,i,r,s,n){const o=this.layout,l=i.get("position"),h=l.indices,m=l.data.length/3,f=i.get("distanceToStart")?.data;h&&h.length!==2*(m-1)&&console.warn("RibbonLineMaterial does not support indices");const g=o.fields.has("sizeFeatureAttribute");let b=1,S=null;if(g){const t=i.get("sizeFeatureAttribute");1===t.data.length?b=t.data[0]:S=t.data}else b=i.get("size")?.data[0]??1;let v=[1,1,1,1],P=0,j=null;const E=o.fields.has("colorFeatureAttribute");if(E){const t=i.get("colorFeatureAttribute");1===t.data.length?P=t.data[0]:j=t.data}else v=i.get("color")?.data??v;const w=i.get("timeStamps")?.data,y=w&&o.fields.has("timeStamps"),T=o.fields.has("opacityFeatureAttribute");let z=0,A=null;if(T){const t=i.get("opacityFeatureAttribute");1===t.data.length?z=t.data[0]:A=t.data}const C=new Float32Array(s.buffer),O=_(s.buffer),L=new Uint8Array(s.buffer),V=o.stride/4;let R=n*V;const x=R;let F=0;const N=f?(t,e,i)=>F=f[i]:(t,e,i)=>F+=p(t,e),U=C.BYTES_PER_ELEMENT/O.BYTES_PER_ELEMENT,D=4/U,B=M(),W=(t,e,i,s,a,n,o,l)=>{C[R++]=e[0],C[R++]=e[1],C[R++]=e[2],k(t,e,O,R*U),R+=D,k(i,e,O,R*U),R+=D,C[R++]=l;let h=R*U;if(O[h++]=a,O[h++]=n,R=Math.ceil(h/U),E)C[R]=j?.[o]??P;else{const t=Math.min(4*o,v.length-4),e=4*R;L[e]=255*v[t],L[e+1]=255*v[t+1],L[e+2]=255*v[t+2],L[e+3]=255*v[t+3]}if(R++,C[R++]=S?.[o]??b,T&&(C[R++]=A?.[o]??z),B){let t=4*R;r?(L[t++]=r[0],L[t++]=r[1],L[t++]=r[2],L[t++]=r[3]):(L[t++]=0,L[t++]=0,L[t++]=0,L[t++]=0),R=Math.ceil(.25*t)}y&&(h=R*U,O[h++]=s[0],O[h++]=s[1],O[h++]=s[2],O[h++]=s[3],R=Math.ceil(h/U))};R+=V,a(lt,l.data[0],l.data[1],l.data[2]),y&&d(ct,w[0],w[1],w[2],w[3]),t&&u(lt,lt,t);const J=this._isClosed(i);if(J){const e=l.data.length-3;a(ot,l.data[e],l.data[e+1],l.data[e+2]),t&&u(ot,ot,t)}else a(ht,l.data[3],l.data[4],l.data[5]),t&&u(ht,ht,t),W(lt,lt,ht,ct,1,-4,0,0),W(lt,lt,ht,ct,1,4,0,0),c(ot,lt),c(lt,ht),y&&d(ct,w[4],w[5],w[6],w[7]);const Y=J?0:1,q=J?m:m-1;for(let p=Y;p<q;p++){const e=(p+1)%m*3;a(ht,l.data[e],l.data[e+1],l.data[e+2]),t&&u(ht,ht,t),N(ot,lt,p),W(ot,lt,ht,ct,0,-1,p,F),W(ot,lt,ht,ct,0,1,p,F);const i=this.numJoinSubdivisions;for(let t=0;t<i;++t){const e=(t+1)/(i+1);W(ot,lt,ht,ct,e,-1,p,F),W(ot,lt,ht,ct,e,1,p,F)}if(W(ot,lt,ht,ct,1,-2,p,F),W(ot,lt,ht,ct,1,2,p,F),c(ot,lt),c(lt,ht),y){const t=(p+1)%m*4;d(ct,w[t],w[t+1],w[t+2],w[t+3])}}J?(a(ht,l.data[3],l.data[4],l.data[5]),t&&u(ht,ht,t),F=N(ot,lt,q),W(ot,lt,ht,ct,0,-1,Y,F),W(ot,lt,ht,ct,0,1,Y,F)):(F=N(ot,lt,q),W(ot,lt,lt,ct,0,-5,q,F),W(ot,lt,lt,ct,0,5,q,F)),G(C,x+V,C,x,V);return R=G(C,R-V,C,R,V),this._parameters.wireframe&&this._addWireframeVertices(s,x,R,V),null}_addWireframeVertices(t,e,i,r){const s=new Float32Array(t.buffer,i*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(t.buffer,e*Float32Array.BYTES_PER_ELEMENT,i-e);let n=0;const o=t=>n=G(a,t,s,n,r);for(let l=0;l<a.length-1;l+=2*r)o(l),o(l+2*r),o(l+1*r),o(l+2*r),o(l+1*r),o(l+3*r)}}function G(t,e,i,r,s){for(let a=0;a<s;a++)i[r++]=t[e++];return r}function I(t,e){if(!t.isClosed)return!1;return e.get("position").indices.length>2}function H(t){return 1===t.anchor&&t.hideOnShortSegments&&"begin-end"===t.placement&&t.worldSpace}const K=f(),Q=f(),Z=f(),$=f(),tt=f(),et=i(),it=i(),rt=f(),st=f(),at=P(),nt=P(),ot=f(),lt=f(),ht=f(),ct=b(),mt=[i(),i(),i(),i()],pt=[f(),f(),f(),f()],ut=w(),ft=w(),dt=w(),gt=w();export{q as Parameters,J as RibbonLineMaterial};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{h as e,j as t,i as r,n as s}from"../../../../chunks/vec32.js";import{fromValues as i,create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as n}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{center as o,scale as p}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as c}from"../../../../geometry/support/buffer/BufferView.js";import{
|
|
5
|
+
import{h as e,j as t,i as r,n as s}from"../../../../chunks/vec32.js";import{fromValues as i,create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as n}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{center as o,scale as p}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as c}from"../../../../geometry/support/buffer/BufferView.js";import{isColorOrOLID as h,isColor as l}from"../core/shaderLibrary/ShaderOutput.js";import u from"../lib/GLMaterial.js";import{Material as f,MaterialParameters as m}from"../lib/Material.js";import{intersectTriangleGeometry as g}from"../lib/RayIntersections.js";import{assert as d}from"../lib/Util.js";import{writeAttributes as b,writePosition as _}from"./internal/bufferWriterUtils.js";import{getLayout as S,ShadedColorMaterialTechnique as j}from"../shaders/ShadedColorMaterialTechnique.js";import{ShadedColorMaterialTechniqueConfiguration as w}from"../shaders/ShadedColorMaterialTechniqueConfiguration.js";import{alphaCutoff as T}from"../../../../webscene/support/AlphaCutoff.js";class x extends f{constructor(e){super(e,D),this._configuration=new w,this.supportsEdges=!0,this._pp0=i(0,0,1),this._pp1=i(0,0,0),this.produces=new Map([[2,e=>8===e||h(e)&&!this.parameters.transparent],[4,e=>h(e)&&this.parameters.transparent&&this.parameters.writeDepth],[9,e=>h(e)&&this.parameters.transparent&&!this.parameters.writeDepth]])}getConfiguration(e,t){return super.getConfiguration(e,t,this._configuration),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.screenSizeEnabled=this.parameters.screenSizeEnabled,this._configuration.shadingEnabled=this.parameters.shadingEnabled,this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest&&l(e),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}get visible(){return this.parameters.color[3]>=T}intersect(e,t,r,s,i,a){this._intersect(e,r,s,i,a)}intersectDraped(e,t,r,s){return this._pp0[0]=this._pp1[0]=r[0],this._pp0[1]=this._pp1[1]=r[1],this._intersect(e,t,this._pp0,this._pp1,s)}_intersect(s,i,a,n,c){if(this.parameters.screenSizeEnabled){const h=s.attributes.get("offset"),l={applyToVertex:(s,a,n,o)=>{const p=e(E,h.data[3*o],h.data[3*o+1],h.data[3*o+2]),c=e(M,s,a,n);return t(p,p,this.parameters.screenSizeScale*(i.camera?.computeScreenPixelSizeAt(p)??1)),r(c,c,p),[c[0],c[1],c[2]]},applyToAabb:e=>{const t=o(e,E);return p(e,this.parameters.screenSizeScale*(i.camera?.computeScreenPixelSizeAt(t)??1))}};g(s,i,a,n,l,c)}else g(s,i,a,n,void 0,c)}createGLMaterial(e){return new z(e)}createBufferWriter(){return new y(S(this.parameters))}}class z extends u{beginSlot(e){return this.getTechnique(j,e)}}class D extends m{constructor(){super(...arguments),this.color=n(1,1,1,1),this.shadingTint=n(0,0,0,.25),this.shadingDirection=s(a(),[.5,-.5,-.5]),this.screenSizeScale=14,this.forceTransparentMode=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=0,this.screenSizeEnabled=!1,this.shadingEnabled=!0}get transparent(){return this.color[3]<1||this.forceTransparentMode}}class y{constructor(e){this.layout=e}elementCount(e){return e.get("position").indices.length}write(e,t,r,s,i,a){const n=b(r,s,this.layout,e,t,i,a),o=i.getField("offset",c);if(o&&r.has("offset")){const e=r.get("offset");d(3===e.size),_(e,t,o,a)}return n}}const E=a(),M=a();export{D as Parameters,x as ShadedColorMaterial};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../core/has.js";import{secondsFromMilliseconds as t}from"../../../../core/time.js";import{fromValues as e}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as i}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as a,
|
|
5
|
+
import"../../../../core/has.js";import{secondsFromMilliseconds as t}from"../../../../core/time.js";import{fromValues as e}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as i}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as a,isHighlightOrOLID as s}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as o}from"../effects/geometry/olidUtils.js";import{MaterialParameters as n}from"../lib/Material.js";import{DefaultBufferWriter as h}from"./DefaultBufferWriter.js";import{PositionUvf32OlidLayout as c,PositionUvf32Layout as l}from"./DefaultLayouts.js";import{TriangleMaterial as f}from"./TriangleMaterial.js";import{WaterGLMaterial as m}from"./WaterGLMaterial.js";import{WaterTechniqueConfiguration as p}from"./WaterTechniqueConfiguration.js";class u extends f{constructor(t,e){super(t,d),this.visible=!0,this.produces=new Map([[2,t=>a(t)&&!this.parameters.transparent||s(t)],[4,t=>a(t)&&this.parameters.transparent||s(t)],[19,t=>this.parameters.draped&&a(t)||2===t||s(t)],[20,t=>2===t]]),this._configuration=new p(e.spherical)}getConfiguration(t,e){return super.getConfiguration(t,e,this._configuration),this._configuration.writeDepth=!0,this._configuration.receiveShadows=a(t)&&e.shadowMap.enabled,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.screenSpaceReflections=null!=e.ssr.lastFrameColor,this._configuration.cloudReflections=null!=e.clouds.data,this._configuration.draped=this.parameters.draped,this._configuration.oitPass=e.oitPass,this._configuration.enableOffset=e.enableOffset,this._configuration.terrainDepthTest=e.terrainDepthTest&&a(t),this._configuration.cullAboveTerrain=e.cullAboveTerrain,this._configuration}update(e){return this.setParameters({timeElapsed:t(e.time)*this.parameters.animationSpeed},!1),this._animationEnabled(e.camera)&&e.dt>0}_animationEnabled(t){const e=Math.min(t.relativeElevation,t.distance);return Math.sqrt(this.parameters.waveTextureRepeat/this.parameters.waveStrength)*e<g}createGLMaterial(t){return new m(t)}createBufferWriter(){return new h(o()?c:l)}get test(){}}class d extends n{constructor(){super(...arguments),this.waveStrength=.06,this.waveTextureRepeat=32,this.waveDirection=e(1,0),this.waveVelocity=.05,this.flowStrength=.015,this.flowOffset=-.5,this.animationSpeed=.35,this.timeElapsed=0,this.color=i(0,0,0,0),this.transparent=!0,this.hasSlicePlane=!1,this.draped=!1,this.origin=r(),this.modelTransformation=null}}const g=35e3;export{d as Parameters,u as WaterMaterial};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{BufferRange as t}from"./BufferRange.js";class
|
|
5
|
+
import{BufferRange as t}from"./BufferRange.js";class e{constructor(e,i,h,s,g,l){this.geometry=e,this._highlightName=null,this.vertexBufferRange=new t(i,h),this.textureBufferRange=new t(s,g),this.updateHighlightOptions(l)}updateHighlightOptions(t){const{geometry:e}=this;if(!e.hasHighlights)return void(this._highlightName=null);let i=-1,h=null;e.foreachHighlightOptions(e=>{const s=t.get(e)??-1;s>i&&(i=s,h=e)}),this._highlightName=h}get highlightName(){return this._highlightName}get isVisible(){return this.geometry.visible}get hasHighlights(){return this.isVisible&&this.geometry.hasHighlights}get hasOccludees(){return null!=this.geometry.occludees}}export{e as Instance};
|