@arcgis/core 5.2.0-next.61 → 5.2.0-next.63
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/WebDocument2D.d.ts +17 -1
- package/WebDocument2D.js +1 -1
- package/WebLinkChart.js +1 -1
- package/WebMap.js +1 -1
- package/WebScene.js +1 -1
- package/applications/Components/imageryUtils.d.ts +10 -0
- package/applications/Components/imageryUtils.js +1 -1
- package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
- package/arcgisGlobal.d.ts +7 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/02dd79beb13eff6be85e.js +1 -0
- package/assets/esri/core/workers/chunks/04ffe788d2efc0a076dd.js +1 -0
- package/assets/esri/core/workers/chunks/0623acb2bd14a61b65c9.js +29 -0
- package/assets/esri/core/workers/chunks/08c2bf9defcece9e049a.js +1 -0
- package/assets/esri/core/workers/chunks/0d61c8d348b09179777a.js +1 -0
- package/assets/esri/core/workers/chunks/{3abc12d2407e4214963d.js → 13033178de9f637a2356.js} +1 -1
- package/assets/esri/core/workers/chunks/14cd8bb1ad4da8d1d2ca.js +1 -0
- package/assets/esri/core/workers/chunks/23a3d8f91caf3136b2aa.js +1 -0
- package/assets/esri/core/workers/chunks/{3157f85bb319294878ca.js → 2426601b8cae7f06af4d.js} +2 -2
- package/assets/esri/core/workers/chunks/2a1c6df073e6ca6a6365.js +1 -0
- package/assets/esri/core/workers/chunks/{a615a644086e98a90579.js → 3f775deea48e268411f1.js} +3 -3
- package/assets/esri/core/workers/chunks/{e3623e557ab463580fd2.js → 41e821ce229bc56dc1a1.js} +1 -1
- package/assets/esri/core/workers/chunks/{17acbf40e7c1cb42d9bd.js → 44b1cdf28269b4fa8a39.js} +1 -1
- package/assets/esri/core/workers/chunks/44e8cd4b3dad777ab0c9.js +1 -0
- package/assets/esri/core/workers/chunks/456e616f32e7de696d38.js +1 -0
- package/assets/esri/core/workers/chunks/{127b111ee53e4b9184f8.js → 4dcd4a052b40047a9230.js} +1 -1
- package/assets/esri/core/workers/chunks/54b9667450d066c6f6ce.js +1 -0
- package/assets/esri/core/workers/chunks/{aaa66a04b882b0ba2961.js → 5600fc334d20c4f0c83d.js} +1 -1
- package/assets/esri/core/workers/chunks/5dbd8ca7e7b8eb9a0bf7.js +1 -0
- package/assets/esri/core/workers/chunks/5e3d5347223f0111f40f.js +1 -0
- package/assets/esri/core/workers/chunks/62f3ca0719ac6bc76512.js +1 -0
- package/assets/esri/core/workers/chunks/{14c066c31fe37b7f6e63.js → 638ed1297efdb24f4711.js} +1 -1
- package/assets/esri/core/workers/chunks/63ede7295938f7010808.js +1 -0
- package/assets/esri/core/workers/chunks/687cf21e027f49b44d22.js +1 -0
- package/assets/esri/core/workers/chunks/6c98a64d92c9bca78203.js +1 -0
- package/assets/esri/core/workers/chunks/{e7402dfd683f82878360.js → 752343d92ed48e674351.js} +1 -1
- package/assets/esri/core/workers/chunks/7538a0fe0cec3156769e.js +1 -0
- package/assets/esri/core/workers/chunks/{42692a4ce3fb364e321e.js → 763cbb6716e398436a6d.js} +1 -1
- package/assets/esri/core/workers/chunks/{d6aad815fc0ee8e24bb5.js → 7ce52b850dd785bfa33f.js} +1 -1
- package/assets/esri/core/workers/chunks/{64247e439ef3e1f712e9.js → 7fdd6a5fa062778be55d.js} +1 -1
- package/assets/esri/core/workers/chunks/8369edafab7bdc59b95a.js +1 -0
- package/assets/esri/core/workers/chunks/{94e9cf8e729ec36de5be.js → 8c535c6a39d2be2ed655.js} +1 -1
- package/assets/esri/core/workers/chunks/8e1d4867406753c5483c.js +1 -0
- package/assets/esri/core/workers/chunks/92696cce2b980373f9ad.js +1 -0
- package/assets/esri/core/workers/chunks/{580451761cadfe308919.js → 9954149def644c371894.js} +1 -1
- package/assets/esri/core/workers/chunks/9f65cc6d9f7390bb1d5b.js +1 -0
- package/assets/esri/core/workers/chunks/a09ce34fc7c8abe64ed5.js +1 -0
- package/assets/esri/core/workers/chunks/{81659d121ed732bda907.js → a12803108c3b12808698.js} +2 -2
- package/assets/esri/core/workers/chunks/{83991475aa54fd5aa008.js → a965d151515b76dd7566.js} +1 -1
- package/assets/esri/core/workers/chunks/{128799741dd3c6fc69b9.js → ac4131121230cfc14f21.js} +1 -1
- package/assets/esri/core/workers/chunks/afeeb11b39e140303b5a.js +1 -0
- package/assets/esri/core/workers/chunks/b13d2da33ec07e9d41ff.js +1 -0
- package/assets/esri/core/workers/chunks/{33bd9785bd0b6ccef21b.js → b2cf1d3f0d48eac23a84.js} +1 -1
- package/assets/esri/core/workers/chunks/{498d29e8c8be4a12ba12.js → b958f87f23f984131d09.js} +1 -1
- package/assets/esri/core/workers/chunks/c53b2be005721591e29b.js +1 -0
- package/assets/esri/core/workers/chunks/{edf87407dd20685c82ab.js → c82ab4f0908290e70ee9.js} +1 -1
- package/assets/esri/core/workers/chunks/{4e2f3dd158a5228c87ba.js → c85ba0700eafdc8d6f9e.js} +1 -1
- package/assets/esri/core/workers/chunks/d456520e4b119a2816b6.js +1 -0
- package/assets/esri/core/workers/chunks/d83ea3e4e9ab45334068.js +1 -0
- package/assets/esri/core/workers/chunks/{4f59357f535f30a6b5cc.js → d9b83d7dd7d1f7729a91.js} +1 -1
- package/assets/esri/core/workers/chunks/dbcec48c4ba104a6d0b5.js +1 -0
- package/assets/esri/core/workers/chunks/e02f02040b63d9c2e654.js +1 -0
- package/assets/esri/core/workers/chunks/e08c64e4ae5a68eae2be.js +1 -0
- package/assets/esri/core/workers/chunks/e2ddfc96ddba92302e0c.js +1 -0
- package/assets/esri/core/workers/chunks/{61d3fcb419d6bf7e355e.js → e65ee26feca0564aeb9b.js} +1 -1
- package/assets/esri/core/workers/chunks/{35cbf00f0c37a86517af.js → ed1de8b7406269e217b9.js} +1 -1
- package/assets/esri/core/workers/chunks/ed4ac5568dc2815b066d.js +1 -0
- package/assets/esri/core/workers/chunks/f029c12f1afee0e9b2a1.js +1 -0
- package/assets/esri/core/workers/chunks/{461c2de938bf4c9b1442.js → f6715b8765cd36d81ec8.js} +1 -1
- package/assets/esri/core/workers/chunks/{4fb549f11e176fc2f24a.js → f7fa932ade85cb2847b6.js} +1 -1
- package/assets/esri/core/workers/chunks/f9a4f4efd63b8189a4eb.js +1 -0
- package/assets/esri/core/workers/chunks/{26a2d4b95cda0a41d980.js → fa1c58e5b582d61a03ab.js} +1 -1
- package/assets/esri/core/workers/chunks/fa377112ef3b78f6ed18.js +1 -0
- package/chunks/VolumeMask.glsl.js +3 -0
- package/chunks/persistableUrlUtils.js +1 -1
- package/config.js +1 -1
- package/core/Collection.d.ts +42 -6
- package/core/Collection.js +1 -1
- package/core/screenUtils.js +1 -1
- package/geometry/SpatialReference.d.ts +1 -4
- package/geometry/support/intersectsBase.js +1 -1
- package/interfaces.d.ts +14 -0
- package/kernel.js +1 -1
- package/layers/BaseElevationLayer.js +1 -1
- package/layers/ElevationLayer.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/KnowledgeGraphLayer.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/StreamLayer.js +1 -1
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/layers/graphics/sources/connections/createConnection.js +1 -1
- package/layers/graphics/sources/parquet/ParquetFileStatistics.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/graphics/sources/support/QueryTask.js +1 -1
- package/layers/mixins/SceneService.js +1 -1
- package/layers/raster/datasets/BaseRaster.js +1 -1
- package/layers/save/groupLayerUtils.js +1 -1
- package/layers/save/mediaLayerUtils.js +1 -1
- package/layers/support/ElevationQueryTileCache.js +1 -1
- package/layers/video/types.d.ts +17 -1
- package/linkChart/LinkChartProperties.js +1 -1
- package/package.json +3 -3
- package/popup/FeatureContent.d.ts +311 -0
- package/popup/FeatureContent.js +2 -0
- package/popup/FeatureContentCollection.d.ts +569 -0
- package/popup/FeatureContentCollection.js +2 -0
- package/portal/support/jsonContext.js +1 -1
- package/support/persistableUrlUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/views/2d/layers/BaseLayerView2D.d.ts +2 -2
- package/views/2d/layers/BaseLayerViewGL2D.d.ts +2 -2
- package/views/2d/layers/features/sources/strategies/AFeatureLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/FeatureHybridTileLoadStrategy.js +1 -1
- package/views/2d/layers/graphics/GraphicStore.js +1 -1
- package/views/2d/support/hitTestUtils.js +1 -1
- package/views/3d/GroundView3D.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
- package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/layers/support/Tiles3DMeshIntersectionHandler.js +1 -1
- package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
- package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/support/buffer/glUtil.js +1 -1
- package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatFadeTexture.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatHeaderTexture.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatOrderTexture.js +1 -1
- package/views/3d/support/hitTest.js +1 -1
- package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
- package/views/3d/support/pointsOfInterest/StableSurfaceCenter.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticBVH.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectFixedBVH.js +1 -1
- package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/FBOCacheUsage.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +11 -11
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMask.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillVisualization.js +1 -1
- package/views/3d/webgl-engine/lib/Intersector.js +1 -1
- package/views/3d/webgl-engine/lib/IntersectorResult.js +1 -1
- package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBuffer.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFieldCreation.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
- package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/intersectWithPolygonOffset.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowCastMaskTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/{CutFillMask.glsl.js → VolumeMask.glsl.js} +1 -1
- package/views/3d/webgl-engine/shaders/VolumeMaskTechnique.js +2 -0
- package/views/View2D.d.ts +2 -2
- package/views/interactive/snapping/featureSources/WorkerTileTreeDebugger.js +1 -1
- package/views/webgl/FramebufferObject.js +1 -1
- package/webdoc/support/resourceUtils.js +1 -1
- package/webdoc/support/types.d.ts +2 -0
- package/webdoc/support/utils.js +2 -0
- package/webdoc/support/webdocLoadUtils.js +1 -1
- package/webdoc/support/webdocSaveUtils.js +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
- package/widgets/BatchAttributeForm/expressions/ArcadeExecutorProvider.js +1 -1
- package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
- package/widgets/BatchAttributeForm/expressions/ExpressionsModel.js +1 -1
- package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/BatchFormInputs.js +1 -1
- package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/RelationshipElementInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
- package/widgets/BatchAttributeForm/rendered-content/RelationshipDetails.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTable/Grid/Column.d.ts +6 -0
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Legend/support/heatmapRampUtils.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/support/SelectionList/FeatureItem.d.ts +116 -0
- package/widgets/support/SelectionList/GroupLayerItem.d.ts +94 -0
- package/widgets/support/SelectionList/ItemBase.d.ts +70 -0
- package/widgets/support/SelectionList/LayerItem.d.ts +140 -0
- package/widgets/support/SelectionList/LayerItem.js +1 -1
- package/widgets/support/SelectionList/SelectionListViewModel.d.ts +265 -0
- package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
- package/widgets/support/SelectionList/types.d.ts +42 -0
- package/widgets/support/forms/formUtils.js +1 -1
- package/assets/esri/core/workers/chunks/003a87b16f8a4b476e14.js +0 -1
- package/assets/esri/core/workers/chunks/0a50efb07eee36237e21.js +0 -1
- package/assets/esri/core/workers/chunks/129fdd1636e67997337c.js +0 -1
- package/assets/esri/core/workers/chunks/12e0c5b7cc5c3f9e6f0f.js +0 -1
- package/assets/esri/core/workers/chunks/26f1fd3f2be5102aae1d.js +0 -1
- package/assets/esri/core/workers/chunks/34fbeeeeef4bd01672c6.js +0 -1
- package/assets/esri/core/workers/chunks/36fe6adf6517d8f80125.js +0 -1
- package/assets/esri/core/workers/chunks/403f08e0c1a9203f7fba.js +0 -1
- package/assets/esri/core/workers/chunks/4f2170609742b51bd7b8.js +0 -1
- package/assets/esri/core/workers/chunks/5133083222588799493f.js +0 -1
- package/assets/esri/core/workers/chunks/52993a9dc0c56e9bda19.js +0 -1
- package/assets/esri/core/workers/chunks/5527b2da4abe0faa98bb.js +0 -1
- package/assets/esri/core/workers/chunks/5e35828216020f33e26b.js +0 -1
- package/assets/esri/core/workers/chunks/5f0d6c853873a7f32527.js +0 -1
- package/assets/esri/core/workers/chunks/6121cd0264b6841a5bac.js +0 -1
- package/assets/esri/core/workers/chunks/6823ba1688dfedba0107.js +0 -1
- package/assets/esri/core/workers/chunks/705d6b108fd121cea887.js +0 -1
- package/assets/esri/core/workers/chunks/73aa1bfa6e1dc271c9d7.js +0 -1
- package/assets/esri/core/workers/chunks/825eb845216762a1ed2f.js +0 -1
- package/assets/esri/core/workers/chunks/88df19742edb0cdc3e67.js +0 -1
- package/assets/esri/core/workers/chunks/8977c85aecc7e08ab13c.js +0 -1
- package/assets/esri/core/workers/chunks/8bdca809dd88eab9e5d8.js +0 -29
- package/assets/esri/core/workers/chunks/8c5726c7ce40a92901e6.js +0 -1
- package/assets/esri/core/workers/chunks/8c5e65982c3f9295e844.js +0 -1
- package/assets/esri/core/workers/chunks/8ce649e55fefc8eca55c.js +0 -1
- package/assets/esri/core/workers/chunks/90ae80b797642bff0efa.js +0 -1
- package/assets/esri/core/workers/chunks/97c758f736f28c5dab84.js +0 -1
- package/assets/esri/core/workers/chunks/a8ade34612e73862de6f.js +0 -1
- package/assets/esri/core/workers/chunks/a9d391071803b1e9e8a0.js +0 -1
- package/assets/esri/core/workers/chunks/aa3abc07de2921ef6ca1.js +0 -1
- package/assets/esri/core/workers/chunks/b03f09ee2224f0cc526a.js +0 -1
- package/assets/esri/core/workers/chunks/b3f1a442d6b7826e917f.js +0 -1
- package/assets/esri/core/workers/chunks/b819a9187426d0c146df.js +0 -1
- package/assets/esri/core/workers/chunks/d205edd949f3e6e24eb9.js +0 -1
- package/assets/esri/core/workers/chunks/f0225829f7d941914815.js +0 -1
- package/assets/esri/core/workers/chunks/fb34d6d96c8c0d53fcf6.js +0 -1
- package/chunks/CutFillMask.glsl.js +0 -3
- package/chunks/FocusAreaMask.glsl.js +0 -3
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMask.glsl.js +0 -2
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskTechnique.js +0 -2
- package/views/3d/webgl-engine/shaders/CutFillMaskTechnique.js +0 -2
- /package/assets/esri/core/workers/chunks/{81659d121ed732bda907.js.LICENSE.txt → a12803108c3b12808698.js.LICENSE.txt} +0 -0
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import{maxUint8 as n}from"../../../../../core/typedArrayUtil.js";import{hasNativeFloat16Array as e}from"../../../../../geometry/support/float16.js";import{FloatBindUniform as o}from"../shaderModules/FloatBindUniform.js";import{glsl as
|
|
2
|
+
import{__decorate as t}from"tslib";import{maxUint8 as n}from"../../../../../core/typedArrayUtil.js";import{hasNativeFloat16Array as e}from"../../../../../geometry/support/float16.js";import{FloatBindUniform as o}from"../shaderModules/FloatBindUniform.js";import{glsl as u,If as i}from"../shaderModules/glsl.js";import{parameter as a,ShaderTechniqueConfiguration as r}from"../shaderTechnique/ShaderTechniqueConfiguration.js";function s(t){switch(t.elementType){case"float":switch(t.elementCount){case 1:return u`float`;case 2:return u`vec2`;case 3:return u`vec3`;case 4:return u`vec4`;case 9:return u`mat3`;default:t.elementCount}break;case"int":switch(t.elementCount){case 1:return u`int`;case 2:return u`ivec2`;case 3:return u`ivec3`;case 4:return u`ivec4`;case 9:throw new Error("Invalid element count 9 for type int");default:t.elementCount}break;case"uint":switch(t.elementCount){case 1:return u`uint`;case 2:return u`uvec2`;case 3:return u`uvec3`;case 4:return u`uvec4`;case 9:throw new Error("Invalid element count 9 for type uint");default:t.elementCount}break;default:t.elementType}throw new Error("unsupported field")}const c=new o("constNaN",()=>NaN,{supportsNaN:!0});class p extends r{constructor(t){super(),this.supportNaN=t}}function f(t,n){const e=n?.supportNaN;e&&(t.uniforms.add(c),t.code.add(u`bool bitsEncodeFloat16NaN(highp uint bits) {
|
|
3
3
|
const highp uint nanExponent = 0x00007c00u;
|
|
4
4
|
highp uint exponent = bits & nanExponent;
|
|
5
5
|
highp uint mantissa = bits & 0x000003ffu;
|
|
6
6
|
return exponent == nanExponent && mantissa != 0u;
|
|
7
|
-
}`)),t.code.add(
|
|
7
|
+
}`)),t.code.add(u`
|
|
8
8
|
mediump float unpackHalf1x16(highp uint bits) {
|
|
9
|
-
${
|
|
9
|
+
${i(e,u`
|
|
10
10
|
if (bitsEncodeFloat16NaN(bits)) {
|
|
11
11
|
return constNaN;
|
|
12
12
|
}`)}
|
|
13
13
|
return unpackHalf2x16(bits).x;
|
|
14
|
-
}`),t.code.add(
|
|
14
|
+
}`),t.code.add(u`
|
|
15
15
|
mediump vec2 unpackHalf2x16NaNSupport(highp uint bits) {
|
|
16
16
|
vec2 result = unpackHalf2x16(bits);
|
|
17
|
-
${
|
|
17
|
+
${i(e,u`
|
|
18
18
|
if (bitsEncodeFloat16NaN(bits)) {
|
|
19
19
|
result.x = constNaN;
|
|
20
20
|
}
|
|
21
|
-
if (bitsEncodeFloat16NaN(bits >> ${
|
|
21
|
+
if (bitsEncodeFloat16NaN(bits >> ${u.uint(k[2])})) {
|
|
22
22
|
result.y = constNaN;
|
|
23
23
|
}
|
|
24
24
|
`)}
|
|
25
25
|
return result;
|
|
26
|
-
}`)}function l(t,n){const e=n?.supportNaN;e&&(t.uniforms.add(c),t.code.add(
|
|
26
|
+
}`)}function l(t,n){const e=n?.supportNaN;e&&(t.uniforms.add(c),t.code.add(u`bool bitsEncodeFloat32NaN(highp uint bits) {
|
|
27
27
|
const highp uint nanExponent = 0x7f800000u;
|
|
28
28
|
highp uint exponent = bits & nanExponent;
|
|
29
29
|
highp uint mantissa = bits & 0x007fffffu;
|
|
30
30
|
return exponent == nanExponent && mantissa != 0u;
|
|
31
|
-
}`)),t.code.add(
|
|
31
|
+
}`)),t.code.add(u`
|
|
32
32
|
highp float unpackFloat1x32(highp uint bits) {
|
|
33
|
-
${
|
|
33
|
+
${i(e,u`
|
|
34
34
|
if (bitsEncodeFloat32NaN(bits)) {
|
|
35
35
|
return constNaN;
|
|
36
36
|
}`)}
|
|
37
37
|
return uintBitsToFloat(bits);
|
|
38
|
-
}`)}function d(t){t.code.add(
|
|
38
|
+
}`)}function d(t){t.code.add(u`mediump int unpackInt1x16(highp uint bits) {
|
|
39
39
|
highp uint signExtendedBits = (bits & 0x8000u) != 0u ? (bits | 0xffff0000u) : bits;
|
|
40
40
|
return int(signExtendedBits);
|
|
41
|
-
}`)}function h(t,n){const{fieldType:e}=t;return`${(0,g[e])(y(t,n))}`}function m(t,n){const e=[];for(const o of t){const t=
|
|
41
|
+
}`)}function h(t,n){const{fieldType:e}=t;return`${(0,g[e])(y(t,n))}`}function m(t,n){const e=[];for(const o of t){const t=u`unpackFloat1x32(${o})`;e.push(t)}return e.join(n)}t([a()],p.prototype,"supportNaN",void 0);const $=t=>u`${t[0]}`,x=t=>{const n=t[0],e=u`uvec4(${u.uint(k[0])}, ${u.uint(k[1])}, ${u.uint(k[2])}, ${u.uint(k[3])})`,o=u`uvec4(${u.hexuint(w[1])})`;return u`((uvec4(${n}) >> ${e}) & ${o})`},N=t=>u`(float(${$(t)})/${u.float(n)})`,b=t=>u`unpackFloat1x32(${t[0]})`,v=t=>u`vec4(${m(t,", ")})`,g={u8:$,u32:t=>u`${t[0]}`,vec4u32:t=>u`uvec4(${t.join(", ")})`,unorm8:N,vec4unorm8:t=>u`(vec4(${x(t)})/${u.float(n)})`,snorm16:t=>u`unpackSnorm2x16(${t[0]}).x`,vec2snorm16:t=>u`unpackSnorm2x16(${t[0]})`,f16:e?t=>u`unpackHalf1x16(${t[0]})`:b,vec4f16:e?t=>u`vec4(unpackHalf2x16NaNSupport(${t[0]}), unpackHalf2x16NaNSupport(${t[1]}))`:v,f32:b,vec4u8:x,vec2f32:t=>u`vec2(${m(t,", ")})`,vec3f32:t=>u`vec3(${m(t,", ")})`,vec4f32:v,mat3f32:t=>u`mat3(${m(t,",\n")})`};function y(t,n){const{byteOffset:e,byteSize:o}=t,i=n.channelByteStride,a=n.byteStride,r=Math.ceil(o/E),s=F[n.channels],c=new Array;for(let p=0;p<r;++p){const t=p*E,n=e+t,r=o-t,f=Math.min(r,E);let l=0;const d=new Array;for(;l<f;){const t=n+l,e=Math.floor(t/a),o=t%a,r=Math.floor(o/i),c=o%i,p=i-c,h=f-l,m=Math.min(p,h),$=u`texel${u.int(e)}${s[r]}`,x=4===m?"":u` & ${u.hexuint(w[m])}`,N=0===c?"":u` >> ${u.uint(k[c])}`,b=u`((${$}${N})${x})`,v=0===l?"":u` << ${u.uint(k[l])}`,g=u`(${b})${v}`;d.push(g),l+=m}c.push(u`(${d.join(" | ")})`)}return c}const E=4,k=[0,8,16,24],w=[0,255,65535,16777215,4294967295],F={1:[u``],2:[u`.x`,u`.y`],4:[u`.x`,u`.y`,u`.z`,u`.w`]};export{p as TextureBufferNaNSupportConfiguration,h as glslDecodeField,s as glslType,l as unpackFloat1x32,f as unpackHalf,d as unpackInt1x16};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{property as s,subclass as t}from"../../../../../core/accessorSupport/decorators.js";import{InternalRenderCategory as r}from"../../../webgl.js";import i from"../../../webgl/RenderNode.js";import{
|
|
2
|
+
import{__decorate as e}from"tslib";import{property as s,subclass as t}from"../../../../../core/accessorSupport/decorators.js";import{InternalRenderCategory as r}from"../../../webgl.js";import i from"../../../webgl/RenderNode.js";import{volumeToVao as o}from"./focusAreaMaskUtils.js";import{V as n}from"../../../../../chunks/VolumeMask.glsl.js";import{VolumeMaskTechnique as a}from"../../shaders/VolumeMaskTechnique.js";import{DepthStencilAttachment as h,PrimitiveType as c}from"../../../../webgl/enums.js";import{noParameters as l}from"../../../../webgl/NoParameters.js";let u=class extends i{constructor(e){super({...e,view:e.focusAreasView.view}),this.consumes={required:[r.CUTFILL_COMPUTATION]},this.produces=r.FOCUSAREA,this._vaos=new Array,this._counts=new Array,this._origins=new Array,this._maskParameters=new n}initialize(){this.updateGeometries()}destroy(){this._vaos.forEach(e=>e.dispose()),this._vaos.length=this._counts.length=this._origins.length=0}render(e){const s=this.techniques.getCompiled(a);if(!s||!this._vaos)return void this.requestRender(1);const t=e.find(({name:e})=>e===r.CUTFILL_COMPUTATION),i=this.renderingContext,o=this.bindParameters,n=o.camera,u=n.fullViewport[2],m=n.fullViewport[3],p=this.fboCache.acquire(u,m,r.FOCUSAREA,2);this.view.stage.renderer.occludedRequiresStencil?(p.acquireDepth(14),i.blitFramebuffer(t.fbo,p.fbo,256)):p.attachDepth(t.getAttachment(h)),i.bindFramebuffer(p.fbo),i.setClearColor(0,0,0,1),i.clear(17408),i.setViewport(0,0,u,m);const d=i.bindTechnique(s,o,l);i.setFaceCullingEnabled(!1),i.setStencilTestEnabled(!0),i.setStencilOpSeparate(1028,7680,34055,7680),i.setStencilOpSeparate(1029,7680,34056,7680),i.setDepthWriteEnabled(!1);for(let r=0;r<this._vaos.length;r++){const e=this._vaos[r],s=this._counts[r];this._maskParameters.origin=this._origins[r],d.bindDraw(o,l,this._maskParameters),i.bindVAO(e),i.setDepthTestEnabled(!0),i.setStencilWriteMask(255),i.setStencilFunction(519,0,255),i.setColorMask(!1,!1,!1,!1),i.drawArrays(c.TRIANGLES,0,s),i.setDepthTestEnabled(!1),i.setStencilWriteMask(0),i.setStencilFunction(517,0,255),i.setColorMask(!0,!1,!1,!1),i.drawArrays(c.TRIANGLES,0,s)}return i.setColorMask(!0,!0,!0,!0),p}updateGeometries(){if(!this.view.stage)return;this._vaos.forEach(e=>e.dispose()),this._vaos.length=this._counts.length=this._origins.length=0;this.focusAreasView.volumes.forEach(e=>{const s=e.geometryVolume,{vao:t,vertexCount:r}=o(this.renderingContext,s);this._vaos.push(t),this._counts.push(r),this._origins.push(e.origin)}),this.requestRender(1)}};e([s()],u.prototype,"consumes",void 0),e([s()],u.prototype,"produces",void 0),e([s({constructOnly:!0})],u.prototype,"focusAreasView",void 0),u=e([t("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaMask")],u);export{u as FocusAreaMask};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../core/maybe.js";import{watch as i,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as o,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{InternalRenderCategory as l}from"../../webgl.js";import{glLayout as n}from"../../support/buffer/glUtil.js";import{newLayout as u}from"../../support/buffer/InterleavedLayout.js";import h from"../../webgl/RenderNode.js";import{VertexArrayObject as c}from"./VertexArrayObject.js";import{C as m}from"../../../../chunks/CutFillComposition.glsl.js";import{CutFillCompositionTechnique as f}from"../shaders/CutFillCompositionTechnique.js";import{
|
|
2
|
+
import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../core/maybe.js";import{watch as i,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as o,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{InternalRenderCategory as l}from"../../webgl.js";import{glLayout as n}from"../../support/buffer/glUtil.js";import{newLayout as u}from"../../support/buffer/InterleavedLayout.js";import h from"../../webgl/RenderNode.js";import{VertexArrayObject as c}from"./VertexArrayObject.js";import{C as m}from"../../../../chunks/CutFillComposition.glsl.js";import{CutFillCompositionTechnique as f}from"../shaders/CutFillCompositionTechnique.js";import{DefaultMaterialPassParameters as p,DefaultMaterialDrawParameters as d,DefaultMaterialTechnique as _}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as C}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{EmissiveTechniqueConfiguration as b}from"../shaders/EmissiveTechniqueConfiguration.js";import{V as g}from"../../../../chunks/VolumeMask.glsl.js";import{VolumeMaskTechnique as V}from"../shaders/VolumeMaskTechnique.js";import{DepthStencilAttachment as v,PrimitiveType as T}from"../../../webgl/enums.js";import{noParameters as w}from"../../../webgl/NoParameters.js";import{VertexBuffer as P}from"../../../webgl/VertexBuffer.js";let F=class extends h{constructor(e){super(e),this.consumes={required:[l.CUTFILL_COLOR,l.GROUND_DEPTH]},this.produces=l.CUTFILL_COLOR,this.measureType="cut-fill",this._vaoCut=null,this._vaoFill=null,this._compositeConfiguration=new b,this._maskParameters=new g,this._cutVolumeParameters=new p,this._fillVolumeParameters=new p,this._compositeParameters=new m,this._drawParameters=new d;const t=1===e.view.state.viewingMode;this._cutVolumeConfiguration=new C(t),this._cutVolumeConfiguration.customDepthTest=2,this._cutVolumeConfiguration.writeDepth=!1,this._cutVolumeConfiguration.cullFace=1,this._cutVolumeConfiguration.doubleSidedMode=2,this._fillVolumeConfiguration=new C(t),this._fillVolumeConfiguration.customDepthTest=1,this._fillVolumeConfiguration.cullFace=2}initialize(){this.addHandles([i(()=>[this.cutColor,this.fillColor],()=>this._updateColors(),s),i(()=>this.measureType,()=>this.requestRender(1),s)])}destroy(){this._disposeVaos()}precompile(){this._vaoCut&&this._vaoFill&&("cut-fill"===this.measureType?(this._cutVolumeConfiguration.cullFace=1,this._cutVolumeConfiguration.doubleSidedMode=2):(this._cutVolumeConfiguration.cullFace=0,this._cutVolumeConfiguration.doubleSidedMode=0),this._compositeConfiguration.hasEmissive=0!==this.bindParameters.emissions,this.techniques.precompile(V),this.techniques.precompile(_,this._cutVolumeConfiguration),this.techniques.precompile(_,this._fillVolumeConfiguration),this.techniques.precompile(f,this._compositeConfiguration))}render(e){const t=this.input;if(!this._vaoCut||!this._vaoFill)return t;const i=this._vaoCut.vertexCount("geometry"),s=this._vaoFill.vertexCount("geometry"),o=this.bindParameters,r=o.camera,a=r.fullViewport[2],n=r.fullViewport[3],u=this.renderingContext,h=this.fboCache,c=e.find(({name:e})=>e===l.GROUND_DEPTH),m=h.acquire(a,n,"cutfill color mask",2).attachDepth(c.getAttachment(v));u.bindFramebuffer(m.fbo),u.setClearColor(0,0,0,1),u.clear(17408),u.setViewport(0,0,a,n);const p=this.techniques.get(V);u.bindTechnique(p,o,w,this._maskParameters),u.setFaceCullingEnabled(!1),u.setStencilTestEnabled(!0),u.setStencilOpSeparate(1028,7680,34055,7680),u.setStencilOpSeparate(1029,7680,34056,7680),u.setDepthWriteEnabled(!1),u.bindVAO(this._vaoCut),u.setDepthTestEnabled(!0),u.setStencilWriteMask(255),u.setStencilFunction(519,0,255),u.setColorMask(!1,!1,!1,!1),u.drawArrays(T.TRIANGLES,0,i),u.setDepthTestEnabled(!1),u.setStencilWriteMask(0),u.setStencilFunction(517,0,255),u.setColorMask(!0,!1,!1,!1),u.drawArrays(T.TRIANGLES,0,i),u.bindVAO(this._vaoFill),u.setDepthTestEnabled(!0),u.setStencilWriteMask(255),u.setStencilFunction(519,0,255),u.setColorMask(!1,!0,!1,!1),u.drawArrays(T.TRIANGLES,0,s);const d=h.acquire(a,n,"cutfill color cut volume",5).acquireDepth(14);u.blitFramebuffer(t.fbo,d.fbo,256),u.bindFramebuffer(d.fbo),u.setClearColor(0,0,0,0),u.clear(16384),u.setColorMask(!0,!0,!0,!0);const C=this.techniques.get(_,this._cutVolumeConfiguration);u.bindTechnique(C,this.bindParameters,this._cutVolumeParameters,this._drawParameters),u.bindVAO(this._vaoCut),u.drawArrays(T.TRIANGLES,0,i),d.detachDepth();const b=h.acquire(a,n,"cutfill color fill volume",5).acquireDepth(14);u.blitFramebuffer(t.fbo,b.fbo,256),u.bindFramebuffer(b.fbo),u.clear(16384),u.setColorMask(!0,!0,!0,!0);const g=this.techniques.get(_,this._fillVolumeConfiguration);u.bindTechnique(g,this.bindParameters,this._fillVolumeParameters,this._drawParameters),u.bindVAO(this._vaoFill),u.drawArrays(T.TRIANGLES,0,s),b.detachDepth();const P=t.obtainDepthTexture();u.bindFramebuffer(t.fbo),this._compositeParameters.cutVolume=d.getTexture(),this._compositeParameters.fillVolume=b.getTexture(),this._compositeParameters.mask=m.getTexture(),this._compositeParameters.sceneDepth=P?.attachment,this._compositeParameters.groundDepth=c.getTexture(v),this.borderColor.toUnitRGBA(this._compositeParameters.borderColor);const F=this.techniques.get(f,this._compositeConfiguration);return u.bindTechnique(F,o,this._compositeParameters),u.screen.draw(),t.attachDepth(P),P?.release(),m.release(),d.release(),b.release(),t}enable(){this.produces=l.CUTFILL_COLOR,this.requestRender(1)}disable(){this.produces="disabled",this.requestRender(1)}updateGeometries(e,t,i){this._disposeVaos(),this._vaoCut=this._createVao(e),this._vaoFill=this._createVao(t),this._maskParameters.origin=i,a(this._drawParameters.origin,i),this.requestRender(1)}_updateColors(){this._cutVolumeParameters.diffuse=this.cutColor.toUnitRGB(),this._cutVolumeParameters.opacity=this.cutColor.a,this._fillVolumeParameters.diffuse=this.fillColor.toUnitRGB(),this._fillVolumeParameters.opacity=this.fillColor.a,this.requestRender(1)}_createVao(e){const{vertices:t,normals:i,indicesBottom:s,indicesExtruded:o}=e,r=s.length+o.length,a=this.renderingContext,l=q.createBuffer(r),{position:u,normal:h}=l;let m=0;for(let n=0;n<s.length;n++){const e=3*s[n];u.set(m,0,t[e]),u.set(m,1,t[e+1]),u.set(m,2,t[e+2]),h.set(m,0,i[e]),h.set(m,1,i[e+1]),h.set(m,2,i[e+2]),m++}for(let n=0;n<o.length;n++){const e=3*o[n];u.set(m,0,t[e]),u.set(m,1,t[e+1]),u.set(m,2,t[e+2]),h.set(m,0,i[e]),h.set(m,1,i[e+1]),h.set(m,2,i[e+2]),m++}const f=new P(a,n(q),l.buffer);return new c(a,f)}_disposeVaos(){this._vaoCut=t(this._vaoCut),this._vaoFill=t(this._vaoFill)}};e([o()],F.prototype,"consumes",void 0),e([o()],F.prototype,"produces",void 0),e([o()],F.prototype,"cutColor",void 0),e([o()],F.prototype,"fillColor",void 0),e([o()],F.prototype,"borderColor",void 0),e([o()],F.prototype,"measureType",void 0),F=e([r("esri.views.3d.webgl-engine.lib.CutFillVisualization")],F);const q=u().vec3f("position").vec3f("normal").freeze();class y{constructor(e,t,i,s){this.vertices=e,this.indicesBottom=t,this.indicesExtruded=i,this.normals=s}}export{F as CutFillVisualization,y as VolumeGeometry};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{add as t,transformMat4 as e,copy as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{intersectsSphere as r}from"../../../../geometry/support/frustum.js";import{create as n,fromPoints as o,copy as a}from"../../../../geometry/support/ray.js";import l from"../../webgl/RenderCamera.js";import{HUDTarget as c,HUDIntersectorResult as h}from"./HUDIntersectorResult.js";import{IntersectorOptions as f}from"./IntersectorInterfaces.js";import{IntersectorResultRay as m,compareOrderedIntersectionHits as u}from"./IntersectorResult.js";import{ObjectTarget as d}from"./ObjectTarget.js";import{PolygonIntersectionResults as y}from"./PolygonIntersectionResults.js";import{IntersectorTransform as g,getVerticalOffsetObject3D as p}from"./verticalOffsetUtils.js";const _=1e-5;class v{constructor(t){this.options=new f,this._results=new b,this.polygonResults=new y,this.transform=new g,this.camera=new l,this.screenPolygonPrimitiveProcessor=j,this.tolerance=_,this.verticalOffset=null,this._ray=n(),this._rayEnd=i(),this._rayBeginTransformed=i(),this._rayEndTransformed=i(),this.viewingMode=t??1}get results(){return this._results}get ray(){return this._ray}get rayBegin(){return this._ray.origin}get rayEnd(){return this._rayEnd}reset(t,e,s){this.resetWithRay(o(t,e,this._ray),s)}resetWithRay(e,s){this.camera=s,e!==this._ray&&a(e,this._ray),0!==this.options.verticalOffset?2===this.viewingMode?this._ray.origin[2]-=this.options.verticalOffset:this.verticalOffset=this.options.verticalOffset:this.verticalOffset=null,t(this._rayEnd,this._ray.origin,this._ray.direction),this._results.init(this._ray),this.polygonResults.init()}intersect(t=null,e,s,i,r){this.point=e,this.filterPredicate=i,this.tolerance=s??_;const n=p(this.verticalOffset);if(t&&t.length>0){const e=r?t=>{r(t)&&this.intersectObject(t)}:t=>{this.intersectObject(t)};for(const s of t){const t=s.getSpatialQueryAccelerator?.();null!=t?(null!=n?t.forEachAlongRayWithVerticalOffset(this._ray.origin,this._ray.direction,e,n):t.forEachAlongRay(this._ray.origin,this._ray.direction,e),this.options.selectionMode&&this.options.hud&&t.forEachDegenerateObject(e)):s.objects.forEach(t=>e(t))}}this.sortResults()}*intersectScreenPolygon(t=null,e){if(this.verticalOffset=null,t?.length)for(const s of t){const t=s.getSpatialQueryAccelerator?.();if(null!=t)for(const s of t.intersectingFrustumValues(e.broadPhaseFrustum,t=>t.visible))yield*this._intersectScreenPolygonObject(s,e);else for(const i of s.objects.values())i.visible&&r(e.broadPhaseFrustum,i.boundingVolumeWorldSpace.bounds)&&(yield*this._intersectScreenPolygonObject(i,e))}}*intersectHUDScreenPolygon(t=null,e){if(this.verticalOffset=null,this.options.selectionMode&&this.options.hud&&t?.length)for(const s of t){const t=s.getSpatialQueryAccelerator?.(),i=t?.degenerateObjectValues()??s.objects.values();for(const s of i)yield*this._intersectScreenPolygonObject(s,e)}}*_intersectScreenPolygonObject(t,e){const s=t.geometries;if(!t.visible||!s)return;const i=t.effectiveTransformation;for(const r of s){if(!r.visible)continue;const{material:s,id:n}=r;if(!s.visible||!s.intersectScreenPolygon)continue;this.transform.setAndInvalidateLazyTransforms(i,r.transformation);const o=s.intersectScreenPolygon(r,this.transform.transform,this,e);o?.valid&&this._handleObjectScreenPolygonIntersection(o.type,new d(t,n,o.primitiveIndex),o.distance,o.point),yield}}intersectObject(t){const s=t.geometries;if(!s)return;const i=t.effectiveTransformation,r=p(this.verticalOffset);for(const n of s){if(!n.visible)continue;const{material:s,id:o}=n;if(!s.visible)continue;this.transform.setAndInvalidateLazyTransforms(i,n.transformation),e(this._rayBeginTransformed,this.rayBegin,this.transform.inverse),e(this._rayEndTransformed,this.rayEnd,this.transform.inverse);const a=this.transform.transform;null!=r&&(r.objectTransform=this.transform),s.intersectRay(n,this.transform.transform,this,this._rayBeginTransformed,this._rayEndTransformed,(e,s,i,r)=>this.handleObjectIntersection({object:t,geometryId:o,primitiveIndex:
|
|
2
|
+
import{add as t,transformMat4 as e,copy as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{intersectsSphere as r}from"../../../../geometry/support/frustum.js";import{create as n,fromPoints as o,copy as a}from"../../../../geometry/support/ray.js";import l from"../../webgl/RenderCamera.js";import{HUDTarget as c,HUDIntersectorResult as h}from"./HUDIntersectorResult.js";import{IntersectorOptions as f}from"./IntersectorInterfaces.js";import{IntersectorResultRay as m,compareOrderedIntersectionHits as u}from"./IntersectorResult.js";import{ObjectTarget as d}from"./ObjectTarget.js";import{PolygonIntersectionResults as y}from"./PolygonIntersectionResults.js";import{IntersectorTransform as g,getVerticalOffsetObject3D as p}from"./verticalOffsetUtils.js";const _=1e-5;class v{constructor(t){this.options=new f,this._results=new b,this.polygonResults=new y,this.transform=new g,this.camera=new l,this.screenPolygonPrimitiveProcessor=j,this.tolerance=_,this.verticalOffset=null,this._ray=n(),this._rayEnd=i(),this._rayBeginTransformed=i(),this._rayEndTransformed=i(),this.viewingMode=t??1}get results(){return this._results}get ray(){return this._ray}get rayBegin(){return this._ray.origin}get rayEnd(){return this._rayEnd}reset(t,e,s){this.resetWithRay(o(t,e,this._ray),s)}resetWithRay(e,s){this.camera=s,e!==this._ray&&a(e,this._ray),0!==this.options.verticalOffset?2===this.viewingMode?this._ray.origin[2]-=this.options.verticalOffset:this.verticalOffset=this.options.verticalOffset:this.verticalOffset=null,t(this._rayEnd,this._ray.origin,this._ray.direction),this._results.init(this._ray),this.polygonResults.init()}intersect(t=null,e,s,i,r){this.point=e,this.filterPredicate=i,this.tolerance=s??_;const n=p(this.verticalOffset);if(t&&t.length>0){const e=r?t=>{r(t)&&this.intersectObject(t)}:t=>{this.intersectObject(t)};for(const s of t){const t=s.getSpatialQueryAccelerator?.();null!=t?(null!=n?t.forEachAlongRayWithVerticalOffset(this._ray.origin,this._ray.direction,e,n):t.forEachAlongRay(this._ray.origin,this._ray.direction,e),this.options.selectionMode&&this.options.hud&&t.forEachDegenerateObject(e)):s.objects.forEach(t=>e(t))}}this.sortResults()}*intersectScreenPolygon(t=null,e){if(this.verticalOffset=null,t?.length)for(const s of t){const t=s.getSpatialQueryAccelerator?.();if(null!=t)for(const s of t.intersectingFrustumValues(e.broadPhaseFrustum,t=>t.visible))yield*this._intersectScreenPolygonObject(s,e);else for(const i of s.objects.values())i.visible&&r(e.broadPhaseFrustum,i.boundingVolumeWorldSpace.bounds)&&(yield*this._intersectScreenPolygonObject(i,e))}}*intersectHUDScreenPolygon(t=null,e){if(this.verticalOffset=null,this.options.selectionMode&&this.options.hud&&t?.length)for(const s of t){const t=s.getSpatialQueryAccelerator?.(),i=t?.degenerateObjectValues()??s.objects.values();for(const s of i)yield*this._intersectScreenPolygonObject(s,e)}}*_intersectScreenPolygonObject(t,e){const s=t.geometries;if(!t.visible||!s)return;const i=t.effectiveTransformation;for(const r of s){if(!r.visible)continue;const{material:s,id:n}=r;if(!s.visible||!s.intersectScreenPolygon)continue;this.transform.setAndInvalidateLazyTransforms(i,r.transformation);const o=s.intersectScreenPolygon(r,this.transform.transform,this,e);o?.valid&&this._handleObjectScreenPolygonIntersection(o.type,new d(t,n,o.primitiveIndex),o.distance,o.point),yield}}intersectObject(t){const s=t.geometries;if(!s)return;const i=t.effectiveTransformation,r=p(this.verticalOffset);for(const n of s){if(!n.visible)continue;const{material:s,id:o}=n;if(!s.visible)continue;this.transform.setAndInvalidateLazyTransforms(i,n.transformation),e(this._rayBeginTransformed,this.rayBegin,this.transform.inverse),e(this._rayEndTransformed,this.rayEnd,this.transform.inverse);const a=this.transform.transform;null!=r&&(r.objectTransform=this.transform),s.intersectRay(n,this.transform.transform,this,this._rayBeginTransformed,this._rayEndTransformed,(e,s,i,r,n)=>this.handleObjectIntersection({object:t,geometryId:o,primitiveIndex:r},e,s,i,a,n))}}handleObjectIntersection(t,e,s,i,r,n){if(e<0||null!=this.filterPredicate&&!this.filterPredicate(this._ray.origin,this._rayEnd,s))return;const o=n?this._results.hud:this._results;t=n?new c(t,n):t;const a=n?r=>r.set(1,t,e,s,i):n=>n.set(4,t,e,s,i,r);if((null==o.min.renderDistance||s<o.min.renderDistance)&&a(o.min),0!==this.options.store&&(null==o.max.renderDistance||s>o.max.renderDistance)&&a(o.max),2===this.options.store)if(n){const t=new h(this._ray);a(t),this._results.hud.all.push(t)}else{const t=new m(this._ray);a(t),this._results.all.push(t)}}_handleObjectScreenPolygonIntersection(t,e,s,i){s<0||(null==this.filterPredicate||null!=i&&this.filterPredicate(this.camera.eye,i,1))&&this.polygonResults.add(t,1===t&&i?new c(e,i):e,s)}sortResults(t=this._results.all){t.sort(u)}}class b{constructor(){this.min=new m(n()),this.max=new m(n()),this.hud={min:new h(n()),max:new h(n()),all:new Array},this.ground=new m(n()),this.all=[]}init(t){this.min.init(t),this.max.init(t),this.ground.init(t),this.all.length=0,this.hud.min.init(t),this.hud.max.init(t),this.hud.all.length=0}}const j={*processTriangle(t){yield t},*processLineSegment(t,e,i){s(t[0],e),s(t[1],i),yield t},validatePoint:()=>!0};export{v as Intersector,j as defaultScreenPolygonPrimitiveProcessor,_ as defaultTolerance};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{copy as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as t,IDENTITY as e}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{scale as i,length as s,add as
|
|
2
|
+
import{copy as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as t,IDENTITY as e}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{scale as i,length as s,add as n,copy as a,normalize as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c,UNIT_Z as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transformMat4 as h}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as m,copy as u}from"../../../../geometry/support/ray.js";class y{constructor(){this.intersector=4}get distance(){return this._distance}get renderDistance(){return this._renderDistance}_init(){this._distance=this._renderDistance=this.target=this.drapedLayerOrder=this.renderPriority=null,this.intersector=4}_setBase(r,t,e,i=null,s=null,n=null){this.intersector=r,this._distance=e,this._renderDistance=i,this.target=t,this.drapedLayerOrder=s,this.renderPriority=n}}class p extends y{get ray(){return this._ray}get distanceInRenderSpace(){return null==this.distance?null:(i(x,this.ray.direction,this.distance),s(x))}withinDistance(r){return!!_(this)&&(null!=this.distanceInRenderSpace&&this.distanceInRenderSpace<=r)}getIntersectionPoint(r){return!!_(this)&&(i(x,this.ray.direction,this.distance),n(r,this.ray.origin,x),!0)}getTransformedNormal(r){return a(b,this.normal),b[3]=0,h(b,b,this.transformation),a(r,b),o(r,r)}constructor(r){super(),this.normal=c(),this.transformation=t(),this._ray=m(),this.init(r)}init(r){super._init(),r&&u(r,this._ray)}set(t,i,s,n,o,c,h,l){this._setBase(t,i,s,n,h,l),a(this.normal,o??d),r(this.transformation,c??e)}copy(t){this._setBase(t.intersector,t.target,t.distance,t.renderDistance,t.drapedLayerOrder,t.renderPriority),u(t.ray,this._ray),a(this.normal,t.normal),r(this.transformation,t.transformation)}}class f extends y{constructor(r,t,e,i=null,s=null){super(),this._setBase(r,t,e,e,i,s)}copy(r){this._setBase(r.intersector,r.target,r.distance,r.renderDistance,r.drapedLayerOrder,r.renderPriority)}}function _(r){return null!=r?.distance&&null!=r?.renderDistance}function g(r){return r instanceof p&&_(r)}function D(r,t){return r.renderDistance!==t.renderDistance?(r.renderDistance??0)-(t.renderDistance??0):r.drapedLayerOrder!==t.drapedLayerOrder?L(r.drapedLayerOrder,t.drapedLayerOrder):L(r.renderPriority,t.renderPriority)}function L(r,t){return(t??-Number.MAX_VALUE)-(r??-Number.MAX_VALUE)}const x=c(),b=l();export{y as IntersectorResult,p as IntersectorResultRay,f as IntersectorResultScreenPolygon,L as compareDrapedOrder,D as compareOrderedIntersectionHits,_ as isValidIntersectorResult,g as isValidIntersectorResultRay};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{clamp as t}from"../../../../core/mathUtils.js";import{set as
|
|
2
|
+
import{clamp as t}from"../../../../core/mathUtils.js";import{set as i,copy as e,exactEquals as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as o,clone as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{newFloatArray as a}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as n,getZeroIndexArray as l}from"../../../../geometry/support/Indices.js";import{Attribute as u}from"./Attribute.js";import{Geometry as h}from"./Geometry.js";import{getPathVertexFrameIndex as p}from"./PathVertexInfo.js";import{createPositionReader as c}from"./PositionReader.js";class m extends h{constructor(t,i,e,s){const{vertexIndices:r,framePositionIndices:a,numExtrusionFrames:h}=i,p=n(h),c=l(h),m=[["position",new u(i.positions,a,3,!0)],["profileRight",new u(i.profileRightAxes,p,2,!0)],["profileUp",new u(i.profileUpAxes,p,2,!0)],["profileRotation",new u(i.profileRotations,p,1,!0)],["pathMaxStretchDistance",new u(i.pathMaxStretchDistances,p,1,!0)],["pathVertexInfo",new u(i.pathVertexInfos,r,1,!0)]];i.profileRotationFrameUpAxes&&m.push(["pathRotationUp",new u(i.profileRotationFrameUpAxes,p,2,!0)]),null!=e.sizeAttributeValue&&m.push(["sizeFeatureAttribute",new u([e.sizeAttributeValue],c,1,!0)]),null!=e.size&&m.push(["size",new u([...e.size],c,2,!0)]),null!=e.colorAttributeValue&&m.push(["colorFeatureAttribute",new u([e.colorAttributeValue],c,1,!0)]),null!=e.color&&m.push(["color",new u([...e.color],c,4,!0)]),null!=e.opacityAttributeValue&&m.push(["opacityFeatureAttribute",new u([e.opacityAttributeValue],c,1,!0)]),null!=e.opacity&&m.push(["opacity",new u([e.opacity],c,1,!0)]),super(t,m,null,0,s,0),this.builder=i,this.visualVariablesState=e,this._lastSize=o()}get indexCount(){return this.attributes.get("pathVertexInfo")?.indices.length??0}get readPrimitivePosition(){if(this._invalidateOnSizeChange(),null==this._readPrimitivePosition){const{builder:t,size:i}=this,{vertexIndices:e,numVerticesTotal:s,evaluator:o}=t,r=a(3*s);for(let a=0;a<s;++a)o.evaluateVertexPosition(r,i,a,a);this._readPrimitivePosition=c(r,e,3)}return this._readPrimitivePosition}onPathChanged(){this.builder.onPathChanged(),this.invalidateBoundingInfo(),i(this._lastSize,-1,-1),this._invalidateReadPrimitivePosition()}get size(){const{parameters:i}=this.material,s=r(i.size);if(i.vvSize){const{offset:e,factor:o,minSize:r,maxSize:a,fallback:n}=i.vvSize,l=this.visualVariablesState.sizeAttributeValue??NaN;Number.isNaN(l)?(s[0]*=n[0],s[1]*=n[2]):(s[0]*=t(e[0]+l*o[0],r[0],a[0]),s[1]*=t(e[2]+l*o[2],r[2],a[2]))}else i.hasPathSize&&this.visualVariablesState.size&&e(s,this.visualVariablesState.size);return s}_computePrimitivePositionIndices(){const t=this.attributes.get("pathVertexInfo"),i=this.attributes.get("position");if(t&&i){const e=i.indices,s=t.indices,o=t.data;return s.map(i=>e[p(o[t.stride*i])])}return i?.indices??null}get boundingInfo(){return this._invalidateOnSizeChange(),super.boundingInfo}_invalidateOnSizeChange(){const{size:t}=this;s(t,this._lastSize)||(e(this._lastSize,t),this.invalidateBoundingInfo(),this._invalidateReadPrimitivePosition())}}function f(t){return t instanceof m}export{m as PathGeometry,f as isPathGeometry};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{sub as n,set as t,cross as o,normalize as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as
|
|
2
|
+
import{sub as n,set as t,cross as o,normalize as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as e,create as r}from"../../../../geometry/support/aaBoundingBox.js";import{boundingInfoSubdivisionThreshold as s}from"./intersectionConstants.js";import{assert as f}from"./Util.js";class u{constructor(n=0,t=!1,o=!0){this.tolerance=n,this.isVerticalRay=t,this.normalRequired=o}}const a=r();function l(t,o,i,c,e,r){if(!t.visible)return;const s=n(D,c,i),{tolerance:a}=o,l=new u(a,!1,o.options.normalRequired);if(t.boundingInfo)f(0===t.type),p(t.readPrimitivePosition,t.boundingInfo,i,s,a,e,l,r);else{const n=t.readPrimitivePosition;q(i,s,0,t.faceCount,n,e,l,r)}}const m=c();function p(n,t,o,i,c,r,f,u){if(null==t)return;const l=w(i,m);if(e(a,t.box),null!=r&&r.applyToAabb(a),A(a,o,l,c)){const{primitiveIndices:e}=t,a=e.length;if(a>s){const e=t.children;if(void 0!==e){for(const t of e)p(n,t,o,i,c,r,f,u);return}}v(o,i,0,a,n,e,r,f,u)}}const h=c();function x(t,o,i,c,e,r,s,f){q(t,n(D,o,t),i,c,e,r,s,f)}function M(n,t,o,i){if(!o.visible)return;const{boundingInfo:c}=o;if(c){const{box:o}=c;if(n<o[0]||n>o[3]||t<o[1]||t>o[4])return}b(n,t,0,o.faceCount,o.readPrimitivePosition,i)}function b(n,t,o,i,c,e){for(let r=o;r<i;++r){const o=3*r,[i,s]=c(G,o),[f,u]=c(G,o+1),[a,l]=c(G,o+2),m=i-n,p=s-t,h=f-n,x=u-t,M=a-n,b=l-t,d=M*x-b*h,y=m*b-p*M,g=h*p-x*m;(d<0||y<0||g<0)&&(d>0||y>0||g>0)||e(0,0,null,r)}}function d(n,t,o,i,c,e,r,s,f,u=null,a=0){const l=n[0],m=n[1],p=n[2],x=t[0],M=t[1],b=t[2];for(let d=o;d<i;++d){const n=a+(u?.[d]??d),t=3*n,o=r*c[t],i=e[o],y=e[o+1],g=e[o+2],v=r*c[t+1],q=e[v],T=e[v+1],V=e[v+2],P=r*c[t+2],R=q-i,I=T-y,C=V-g,B=e[P]-i,w=e[P+1]-y,A=e[P+2]-g,U=M*A-w*b,k=b*B-A*x,D=x*w-B*M,E=R*U+I*k+C*D,F=E*E;if(F<=z)continue;const G=l-i,H=m-y,J=p-g,K=(G*U+H*k+J*D)*E;if(K<0||K>F)continue;const L=H*C-I*J,N=J*R-C*G,O=G*I-R*H,Q=(x*L+M*N+b*O)*E;if(Q<0||K+Q>F)continue;const S=(B*L+w*N+A*O)/E;if(S>=0){f(S,S,s?j(R,I,C,B,w,A,h):null,n)}}}function y(n,t,o,i,c,e,r,s){const f=n[0],u=n[1],a=n[2],l=t[0],m=t[1],p=t[2];for(let x=o;x<i;++x){const n=3*x,t=n+1,o=n+2,i=e*n,M=c[i],b=c[i+1],d=c[i+2],y=e*t,g=e*o,v=c[y]-M,q=c[y+1]-b,T=c[y+2]-d,V=c[g]-M,P=c[g+1]-b,R=c[g+2]-d,I=m*R-P*p,C=p*V-R*l,B=l*P-V*m,w=v*I+q*C+T*B,A=w*w;if(A<=z)continue;const U=f-M,k=u-b,D=a-d,E=(U*I+k*C+D*B)*w;if(E<0||E>A)continue;const F=k*T-q*D,G=D*v-T*U,H=U*q-v*k,J=(l*F+m*G+p*H)*w;if(J<0||E+J>A)continue;const K=(V*F+P*G+R*H)/w;if(K>=0){s(K,K,r?j(v,q,T,V,P,R,h):null,x)}}}function g(n,t,o,i,c,e,r,s,f,u,a,l=null,m=0){const p=n[0],x=n[1],M=n[2],b=t[0],d=t[1],y=t[2];for(let g=o;g<i;++g){const n=m+(l?.[g]??g),t=3*n,o=r*c[t],i=e[o],v=e[o+1],q=e[o+2],T=r*c[t+1],V=e[T],P=e[T+1],R=e[T+2],I=r*c[t+2],C=e[I],B=e[I+1],w=e[I+2],A=q-f,U=s/Math.sqrt(i*i+v*v+A*A),k=i+i*U,D=v+v*U,E=q+A*U,F=R-f,G=s/Math.sqrt(V*V+P*P+F*F),H=V+V*G,J=P+P*G,K=R+F*G,L=w-f,N=s/Math.sqrt(C*C+B*B+L*L),O=H-k,Q=J-D,S=K-E,W=C+C*N-k,X=B+B*N-D,Y=w+L*N-E,Z=d*Y-X*y,$=y*W-Y*b,_=b*X-W*d,nn=O*Z+Q*$+S*_,tn=nn*nn;if(tn<=z)continue;const on=p-k,cn=x-D,en=M-E,rn=(on*Z+cn*$+en*_)*nn;if(rn<0||rn>tn)continue;const sn=cn*S-Q*en,fn=en*O-S*on,un=on*Q-O*cn,an=(b*sn+d*fn+y*un)*nn;if(an<0||rn+an>tn)continue;const ln=(W*sn+X*fn+Y*un)/nn;if(ln>=0){a(ln,ln,u?j(O,Q,S,W,X,Y,h):null,n)}}}function v(n,t,o,i,c,e,r,s,f){const u=n[0],a=n[1],l=n[2],m=t[0],p=t[1],x=t[2],{normalRequired:M}=s;for(let b=o;b<i;++b){const n=e[b],t=3*n;let[o,i,s]=c(G,t),[d,y,g]=c(G,t+1),[v,q,T]=c(G,t+2);null!=r&&([o,i,s]=r.applyToVertex(F,o,i,s,b),[d,y,g]=r.applyToVertex(F,d,y,g,b),[v,q,T]=r.applyToVertex(F,v,q,T,b));const V=d-o,P=y-i,R=g-s,I=v-o,C=q-i,B=T-s,w=p*B-C*x,A=x*I-B*m,U=m*C-I*p,k=V*w+P*A+R*U,D=k*k;if(D<=z)continue;const E=u-o,H=a-i,J=l-s,K=(E*w+H*A+J*U)*k;if(K<0||K>D)continue;const L=H*R-P*J,N=J*V-R*E,O=E*P-V*H,Q=(m*L+p*N+x*O)*k;if(Q<0||K+Q>D)continue;const S=(I*L+C*N+B*O)/k;if(S>=0){f(S,S,M?j(V,P,R,I,C,B,h):null,n)}}}function q(t,o,i,c,e,r,s,f){const u=o,a=E,l=Math.abs(u[0]),m=Math.abs(u[1]),p=Math.abs(u[2]),h=l>=m?l>=p?0:2:m>=p?1:2,x=h,M=u[x]<0?2:1,b=(h+M)%3,d=(h+(3-M))%3,y=u[b]/u[x],g=u[d]/u[x],v=1/u[x],q=T,j=V,I=P,{normalRequired:C}=s;for(let T=i;T<c;++T){const o=3*T;e(a[0],o),e(a[1],o+1),e(a[2],o+2),r&&(r.applyToVertex(a[0],a[0][0],a[0][1],a[0][2],T),r.applyToVertex(a[1],a[1][0],a[1][1],a[1][2],T),r.applyToVertex(a[2],a[2][0],a[2][1],a[2][2],T)),n(q,a[0],t),n(j,a[1],t),n(I,a[2],t);const i=q[b]-y*q[x],c=q[d]-g*q[x],s=j[b]-y*j[x],u=j[d]-g*j[x],l=I[b]-y*I[x],m=I[d]-g*I[x],p=l*u-m*s,h=i*m-c*l,M=s*c-u*i;if((p<0||h<0||M<0)&&(p>0||h>0||M>0))continue;const V=p+h+M;if(0===V)continue;const P=p*(v*q[x])+h*(v*j[x])+M*(v*I[x]);if(P*Math.sign(V)<0)continue;const B=P/V;if(B>=0){f(B,B,C?R(a):null,T)}}}const T=c(),V=c(),P=c();function j(n,c,e,r,s,f,u){return t(I,n,c,e),t(C,r,s,f),o(u,I,C),i(u,u),u}function R(t){return n(I,t[1],t[0]),n(C,t[2],t[0]),o(h,I,C),i(h,h),h}const I=c(),C=c();function B(n,o,i){return t(i,1/(o[0]-n[0]),1/(o[1]-n[1]),1/(o[2]-n[2]))}function w(n,o){return t(o,1/n[0],1/n[1],1/n[2])}function A(n,t,o,i){return U(n,t,o,i,1/0)}function U(n,t,o,i,c){const e=(n[0]-i-t[0])*o[0],r=(n[3]+i-t[0])*o[0];let s=Math.min(e,r),f=Math.max(e,r);const u=(n[1]-i-t[1])*o[1],a=(n[4]+i-t[1])*o[1];if(f=Math.min(f,Math.max(u,a)),f<0)return!1;if(s=Math.max(s,Math.min(u,a)),s>f)return!1;const l=(n[2]-i-t[2])*o[2],m=(n[5]+i-t[2])*o[2];return f=Math.min(f,Math.max(l,m)),!(f<0)&&(s=Math.max(s,Math.min(l,m)),!(s>f)&&s<c)}const k=1e-7,z=k*k,D=c(),E=[c(),c(),c()],F=c(),G=c();export{u as MeshIntersectionOptions,B as computeInvDir,A as intersectAabbInvDir,U as intersectAabbInvDirBefore,d as intersectRayTriangles,q as intersectRayTrianglesWithDisplacementWatertight,g as intersectRayTrianglesWithVerticalOffsetENUGlobal,y as intersectRenderGeometryTriangles,l as intersectTriangleGeometry,M as intersectTriangleGeometry2D,x as intersectTriangles,b as intersectTriangles2d,k as triangleRayParallelTolerance};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{sliceEquals as i}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{watch as r,sync as a}from"../../../../core/reactiveUtils.js";import{signal as o}from"../../../../core/signal.js";import{property as n,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{copy as c,equals as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ReadShadowMapPassParameters as m}from"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{F as _}from"../../../../chunks/FocusAreaMask.glsl.js";import{volumeToVao as d}from"../effects/focusArea/focusAreaMaskUtils.js";import{BindParameters as p}from"./BindParameters.js";import{DepthRange as f}from"./DepthRange.js";import{createQuadVAO as g}from"./glUtil3D.js";import{ShadowCastRenderer as b}from"./ShadowCastRenderer.js";import{ShadowMap as v}from"./ShadowMap.js";import{S as y}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as S}from"../shaders/ShadowCastAccumulateTechnique.js";import{ShadowCastAccumulateTechniqueConfiguration as w}from"../shaders/ShadowCastAccumulateTechniqueConfiguration.js";import{ShadowCastClearTechnique as A}from"../shaders/ShadowCastClearTechnique.js";import{ShadowCastMaskTechnique as x}from"../shaders/ShadowCastMaskTechnique.js";import{PrimitiveType as C,DepthStencilAttachment as R,PixelType as F}from"../../../webgl/enums.js";import{DisposableFramebufferObject as q}from"../../../webgl/FramebufferObject.js";import{noParameters as V}from"../../../webgl/NoParameters.js";let H=class extends t{constructor(e,t,i,s,o){super({}),this._fbos=e,this._techniques=t,this._renderToShadowMap=s,this._requestRender=o,this.fullyRecompute=!1,this._analysisVolumeGeometry=null,this._primarySet=new D(new w(0),()=>this._requestRenderIfEnabled()),this._contextSet=new D(new w(1),()=>this._requestRenderIfEnabled()),this._passParameters=new m,this._maskParameters=new _,this._volumeVao=null,this._volumeVertexCount=0,this._depthRange=f.Zero,this._enabled=!1,this._previewing=!1,this._shadowAccumulatorKey=Symbol("shadowAccumulator"),this._bindParameters=new p(e.rctx,new v(e,i.viewingMode)),this._bindParameters.shadowMap.enabled=!0,this._vao=g(e.rctx),this._accumulationRenderer=new b({view:i.view,data:this}),this._tmpReadFbo=new q(e.rctx),this.addHandles([r(()=>this._previewing,e=>{e?this._invalidateAccumulationSets():this._requestRenderIfEnabled()},a),r(()=>this._numActive,()=>this._numActiveChanged(),a)],this._shadowAccumulatorKey)}destroy(){this._disable(),this.removeHandles(this._shadowAccumulatorKey),this._fboHandle=s(this._fboHandle),this._vao=s(this._vao),this._volumeVao=s(this._volumeVao),this._tmpReadFbo=s(this._tmpReadFbo),this._bindParameters.destroy();for(const e of this._accumulationSets())e.destroy();this._contextSet=null,this._primarySet=null}*_accumulationSets(){yield this._primarySet,yield this._contextSet}get computedSamples(){return[this._primarySet.progress,this._contextSet.progress]}get shadowCastTexture(){return this._fboHandle?.getTexture()}get accumulating(){return this.active&&(this._previewing||this._refining||this.fullyRecompute)}get _refining(){return this.active&&!this._doneAccumulating&&!this._previewing}get active(){return this._enabled&&[...this._accumulationSets()].some(e=>e.active)}get canAccumulate(){return null!=this._bindParameters.depth&&this._depthRange!==f.Zero&&this._accumulationRenderer.isAboveElevationThreshold}get _doneAccumulating(){return[...this._accumulationSets()].every(e=>e.doneAccumulating)}get _numActive(){return[...this._accumulationSets()].reduce((e,t)=>e+(t.active?1:0),0)}get _colorFormat(){return 2===this._numActive?2:0}get _analysisVolume(){return this._analysisVolumeGeometry}set _analysisVolume(e){if(this._analysisVolumeGeometry===e)return;this._invalidateAccumulationSets(),this._analysisVolumeGeometry=e,this._volumeVao=s(this._volumeVao),this._volumeVertexCount=0;const t=null!=e;for(const s of this._accumulationSets())s.configuration.useMask=t;if(!t)return;const i=e.geometryVolume,{vao:r,vertexCount:a}=d(this._rctx,i);this._volumeVao=r,this._volumeVertexCount=a}get requiresDepth(){return this.accumulating||null!=this._volumeVao}renderAccumulation(e){if(!this.active)return!1;if(this._bindParameters.contentCamera=e.contentCamera,this._bindParameters.depth=e.depth,this._passParameters.origin=this._bindParameters.camera.center,!this.canAccumulate)return this._bindParameters.depth=null,!1;if(this._renderAreaMask(),!this.accumulating)return this._bindParameters.depth=null,!1;(this._previewing||this.fullyRecompute)&&this._reset(),this._clearBuffersOnAccumulationStart(this._bindParameters);const t=this._accumulateSetsForRenderFrame(this._previewing&&!this.fullyRecompute,this._bindParameters);return this._bindParameters.depth=null,t}_renderAreaMask(){const e=this._techniques.getCompiled(x),t=this._volumeVao,i=this._volumeVertexCount,s=this._fboHandle,r=this._analysisVolume;if(s?.detachDepth(),!e||!t||i<1||!s||!r)return;s.acquireDepth(14);const a=this._rctx,o=this._bindParameters,n=o.depth,h=this._tmpReadFbo;h.attachDepthStencil(n?.attachment),a.blitFramebuffer(h,s.fbo,256),h.detachDepthStencilTexture(),a.bindFramebuffer(s.fbo),a.setClearStencil(0),a.clear(1024),a.setViewport(0,0,o.camera.width,o.camera.height);const c=a.bindTechnique(e,o,V);this._maskParameters.origin=r.origin,c.bindDraw(o,V,this._maskParameters),a.bindVAO(t),a.drawArrays(C.TRIANGLES,0,i)}_clearBuffersOnAccumulationStart(e){if([...this._accumulationSets()].every(e=>0===e.progress))this._clearFramebuffer();else for(const t of this._accumulationSets())0===t.progress&&this._clearFramebufferForSet(this._fboHandle,t,e)}_accumulateSetsForRenderFrame(e,t){let i=!1;for(const s of this._accumulationSets())this._accumulateSet(s,e,t),i=!0;return i&&this._requestRender(),i}_accumulateSet(e,t,i){const s=t?Math.min(j,e.sampleCount)-e.progress:e.sampleCount-e.progress;for(let r=0;r<s;++r)this._accumulateShadow(e,i)}precompilePrepass(){if(this.accumulating){for(const e of this._accumulationSets())this._techniques.precompile(S,e.configuration),this._techniques.precompile(A,e.configuration);this._techniques.precompile(x)}}precompile(){this._accumulationRenderer.precompile()}updateMask(){this._accumulationRenderer.setStencilMask(this._fboHandle?.getAttachment(R))}setParameters(e){void 0!==e.previewing&&(this._previewing=e.previewing),void 0!==e.lightDirections&&(this._primarySet.lightDirections=e.lightDirections),void 0!==e.lightDirectionsContext&&(this._contextSet.lightDirections=e.lightDirectionsContext),!0===e.enabled?this._enable():!1===e.enabled&&this._disable(),void 0!==e.analysisVolume&&(this._analysisVolume=e.analysisVolume),this._accumulationRenderer.setOptions(e)}readAccumulatedShadow(e,t){const i=this._primarySet.progress;return!this.active||!this._fboHandle||i<1||e<0||e>=this._fboHandle.fbo.width||t<0||t>=this._fboHandle.fbo.height?0:(this._fboHandle.fbo.readPixels(e,t,1,1,6408,F.UNSIGNED_BYTE,P),P[0]/i)}updateCamera(e){if(!this.active)return;const t=this._bindParameters.camera;e.equals(t)||t.copyFrom(e),this._isAccumulationValid(e)||(this._fboHandle?.release(),this._fboHandle=this._createFBO(e.fullWidth,e.fullHeight),this._reset()),this._accumulationRenderer.setOpacityFromElevation(e.relativeElevation)}_numActiveChanged(){if(!this._enabled||!this._fboHandle)return;const e=2===this._numActive,{width:t,height:i}=this._fboHandle.fbo,s=this._createFBO(t,i);e&&(this._clearFramebuffer(s),this._contextSet.reset()),this._rctx.blitFramebuffer(this._fboHandle.fbo,s.fbo),this._fboHandle.dispose(),this._fboHandle=s,this._requestRender()}_enable(){this._enabled||(this._enabled=!0,this._invalidateAccumulationSets())}_disable(){this._enabled&&(this._fboHandle=s(this._fboHandle),this._enabled=!1,this._requestRender())}_createFBO(e,t){return this._fbos.acquire(e,t,"shadow accumulation",this._colorFormat)}_invalidateAccumulationSets(){for(const e of this._accumulationSets())e.reset();this._requestRenderIfEnabled()}_reset(){for(const e of this._accumulationSets())e.reset()}_clearFramebuffer(e=this._fboHandle){e&&(this._rctx.bindFramebuffer(e.fbo),this._rctx.setClearColor(0,0,0,0),this._rctx.clear(16384))}_clearFramebufferForSet(e,t,i){if(!e)return;const s=this._techniques.get(A,t.configuration);this._rctx.bindFramebuffer(e.fbo),this._rctx.bindTechnique(s,i,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(s.primitiveType,0,this._vao.vertexCount("geometry"))}_accumulateShadow(e,t){this._renderToShadowMap(t,e.lightDirections[e.progress++],this._depthRange);const i=this._techniques.get(S,e.configuration);this._rctx.bindFramebuffer(this._fboHandle?.fbo),this._rctx.bindTechnique(i,t,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(i.primitiveType,0,this._vao.vertexCount("geometry"))}_isAccumulationValid(e){return this._fboHandle?.fbo.width===e.fullWidth&&this._fboHandle?.fbo.height===e.fullHeight}_requestRenderIfEnabled(){this._enabled&&this._requestRender()}get _rctx(){return this._fbos.rctx}updateDepthRange(e){this._depthRange.equals(e)||(this._depthRange=e,this._invalidateAccumulationSets())}get test(){}};e([n()],H.prototype,"_refining",null),e([n()],H.prototype,"active",null),e([n()],H.prototype,"_doneAccumulating",null),e([n()],H.prototype,"_numActive",null),e([n()],H.prototype,"_colorFormat",null),e([n()],H.prototype,"_depthRange",void 0),e([n()],H.prototype,"_enabled",void 0),e([n()],H.prototype,"_previewing",void 0),e([n()],H.prototype,"_accumulationRenderer",void 0),H=e([h("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],H);const j=6,P=new Uint8Array(4);class D{constructor(e,t){this.configuration=e,this._notifyChange=t,this._cachedLightDirections=[],this._progress=o(0),this._sampleCount=o(0)}get progress(){return this._progress.value}set progress(e){this._progress.value=e}get sampleCount(){return this._sampleCount.value}get doneAccumulating(){return this.progress>=this.sampleCount}get running(){return this.progress>0}get active(){return this.sampleCount>0}get lightDirections(){return this._cachedLightDirections}set lightDirections(e){const t=this._cachedLightDirections,s=Math.min(y,e.length);if(!i(t,0,t.length,e,0,s,u)){t.length=s,this._sampleCount.value=s;for(let i=0;i<s;++i)t[i]=c(t[i]??l(),e[i]);this.reset(),this._notifyChange()}}destroy(){this._cachedLightDirections.length=0,this._sampleCount.value=0}reset(){this.progress=0}precompile(e){e.precompile(S,this.configuration),e.precompile(A,this.configuration)}}export{H as ShadowAccumulator};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{sliceEquals as i}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{watch as r,sync as a}from"../../../../core/reactiveUtils.js";import{signal as o}from"../../../../core/signal.js";import{property as n,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{copy as c,equals as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ReadShadowMapPassParameters as m}from"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{volumeToVao as _}from"../effects/focusArea/focusAreaMaskUtils.js";import{BindParameters as d}from"./BindParameters.js";import{DepthRange as p}from"./DepthRange.js";import{createQuadVAO as f}from"./glUtil3D.js";import{ShadowCastRenderer as g}from"./ShadowCastRenderer.js";import{ShadowMap as b}from"./ShadowMap.js";import{S as v}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as y}from"../shaders/ShadowCastAccumulateTechnique.js";import{ShadowCastAccumulateTechniqueConfiguration as S}from"../shaders/ShadowCastAccumulateTechniqueConfiguration.js";import{ShadowCastClearTechnique as w}from"../shaders/ShadowCastClearTechnique.js";import{ShadowCastMaskTechnique as A}from"../shaders/ShadowCastMaskTechnique.js";import{V as x}from"../../../../chunks/VolumeMask.glsl.js";import{PrimitiveType as C,DepthStencilAttachment as R,PixelType as V}from"../../../webgl/enums.js";import{DisposableFramebufferObject as F}from"../../../webgl/FramebufferObject.js";import{noParameters as q}from"../../../webgl/NoParameters.js";let H=class extends t{constructor(e,t,i,s,o){super({}),this._fbos=e,this._techniques=t,this._renderToShadowMap=s,this._requestRender=o,this.fullyRecompute=!1,this._analysisVolumeGeometry=null,this._primarySet=new D(new S(0),()=>this._requestRenderIfEnabled()),this._contextSet=new D(new S(1),()=>this._requestRenderIfEnabled()),this._passParameters=new m,this._maskParameters=new x,this._volumeVao=null,this._volumeVertexCount=0,this._depthRange=p.Zero,this._enabled=!1,this._previewing=!1,this._shadowAccumulatorKey=Symbol("shadowAccumulator"),this._bindParameters=new d(e.rctx,new b(e,i.viewingMode)),this._bindParameters.shadowMap.enabled=!0,this._vao=f(e.rctx),this._accumulationRenderer=new g({view:i.view,data:this}),this._tmpReadFbo=new F(e.rctx),this.addHandles([r(()=>this._previewing,e=>{e?this._invalidateAccumulationSets():this._requestRenderIfEnabled()},a),r(()=>this._numActive,()=>this._numActiveChanged(),a)],this._shadowAccumulatorKey)}destroy(){this._disable(),this.removeHandles(this._shadowAccumulatorKey),this._fboHandle=s(this._fboHandle),this._vao=s(this._vao),this._volumeVao=s(this._volumeVao),this._tmpReadFbo=s(this._tmpReadFbo),this._bindParameters.destroy();for(const e of this._accumulationSets())e.destroy();this._contextSet=null,this._primarySet=null}*_accumulationSets(){yield this._primarySet,yield this._contextSet}get computedSamples(){return[this._primarySet.progress,this._contextSet.progress]}get shadowCastTexture(){return this._fboHandle?.getTexture()}get accumulating(){return this.active&&(this._previewing||this._refining||this.fullyRecompute)}get _refining(){return this.active&&!this._doneAccumulating&&!this._previewing}get active(){return this._enabled&&this._accumulationSets().some(e=>e.active)}get canAccumulate(){return null!=this._bindParameters.depth&&this._depthRange!==p.Zero&&this._accumulationRenderer.isAboveElevationThreshold}get _doneAccumulating(){return this._accumulationSets().every(e=>e.doneAccumulating)}get _numActive(){return this._accumulationSets().reduce((e,t)=>e+(t.active?1:0),0)}get _colorFormat(){return 2===this._numActive?2:0}get _analysisVolume(){return this._analysisVolumeGeometry}set _analysisVolume(e){if(this._analysisVolumeGeometry===e)return;this._invalidateAccumulationSets(),this._analysisVolumeGeometry=e,this._volumeVao=s(this._volumeVao),this._volumeVertexCount=0;const t=null!=e;for(const s of this._accumulationSets())s.configuration.useMask=t;if(!t)return;const i=e.geometryVolume,{vao:r,vertexCount:a}=_(this._rctx,i);this._volumeVao=r,this._volumeVertexCount=a}get requiresDepth(){return this.accumulating||null!=this._volumeVao}renderAccumulation(e){if(!this.active)return!1;if(this._bindParameters.contentCamera=e.contentCamera,this._bindParameters.depth=e.depth,this._passParameters.origin=this._bindParameters.camera.center,!this.canAccumulate)return this._bindParameters.depth=null,!1;if(this._renderAreaMask(),!this.accumulating)return this._bindParameters.depth=null,!1;(this._previewing||this.fullyRecompute)&&this._reset(),this._clearBuffersOnAccumulationStart(this._bindParameters);const t=this._accumulateSetsForRenderFrame(this._previewing&&!this.fullyRecompute,this._bindParameters);return this._bindParameters.depth=null,t}_renderAreaMask(){const e=this._techniques.getCompiled(A),t=this._volumeVao,i=this._volumeVertexCount,s=this._fboHandle,r=this._analysisVolume;if(s?.detachDepth(),!e||!t||i<1||!s||!r)return;s.acquireDepth(14);const a=this._rctx,o=this._bindParameters,n=o.depth,h=this._tmpReadFbo;h.attachDepthStencil(n?.attachment),a.blitFramebuffer(h,s.fbo,256),h.detachDepthStencilTexture(),a.bindFramebuffer(s.fbo),a.setClearStencil(0),a.clear(1024),a.setViewport(0,0,o.camera.width,o.camera.height);const c=a.bindTechnique(e,o,q);this._maskParameters.origin=r.origin,c.bindDraw(o,q,this._maskParameters),a.bindVAO(t),a.drawArrays(C.TRIANGLES,0,i)}_clearBuffersOnAccumulationStart(e){if(this._accumulationSets().every(e=>0===e.progress))this._clearFramebuffer();else for(const t of this._accumulationSets())0===t.progress&&this._clearFramebufferForSet(this._fboHandle,t,e)}_accumulateSetsForRenderFrame(e,t){let i=!1;for(const s of this._accumulationSets())this._accumulateSet(s,e,t),i=!0;return i&&this._requestRender(),i}_accumulateSet(e,t,i){const s=t?Math.min(j,e.sampleCount)-e.progress:e.sampleCount-e.progress;for(let r=0;r<s;++r)this._accumulateShadow(e,i)}precompilePrepass(){if(this.accumulating){for(const e of this._accumulationSets())this._techniques.precompile(y,e.configuration),this._techniques.precompile(w,e.configuration);this._techniques.precompile(A)}}precompile(){this._accumulationRenderer.precompile()}updateMask(){this._accumulationRenderer.setStencilMask(this._fboHandle?.getAttachment(R))}setParameters(e){void 0!==e.previewing&&(this._previewing=e.previewing),void 0!==e.lightDirections&&(this._primarySet.lightDirections=e.lightDirections),void 0!==e.lightDirectionsContext&&(this._contextSet.lightDirections=e.lightDirectionsContext),!0===e.enabled?this._enable():!1===e.enabled&&this._disable(),void 0!==e.analysisVolume&&(this._analysisVolume=e.analysisVolume),this._accumulationRenderer.setOptions(e)}readAccumulatedShadow(e,t){const i=this._primarySet.progress;return!this.active||!this._fboHandle||i<1||e<0||e>=this._fboHandle.fbo.width||t<0||t>=this._fboHandle.fbo.height?0:(this._fboHandle.fbo.readPixels(e,t,1,1,6408,V.UNSIGNED_BYTE,P),P[0]/i)}updateCamera(e){if(!this.active)return;const t=this._bindParameters.camera;e.equals(t)||t.copyFrom(e),this._isAccumulationValid(e)||(this._fboHandle?.release(),this._fboHandle=this._createFBO(e.fullWidth,e.fullHeight),this._reset()),this._accumulationRenderer.setOpacityFromElevation(e.relativeElevation)}_numActiveChanged(){if(!this._enabled||!this._fboHandle)return;const e=2===this._numActive,{width:t,height:i}=this._fboHandle.fbo,s=this._createFBO(t,i);e&&(this._clearFramebuffer(s),this._contextSet.reset()),this._rctx.blitFramebuffer(this._fboHandle.fbo,s.fbo),this._fboHandle.dispose(),this._fboHandle=s,this._requestRender()}_enable(){this._enabled||(this._enabled=!0,this._invalidateAccumulationSets())}_disable(){this._enabled&&(this._fboHandle=s(this._fboHandle),this._enabled=!1,this._requestRender())}_createFBO(e,t){return this._fbos.acquire(e,t,"shadow accumulation",this._colorFormat)}_invalidateAccumulationSets(){for(const e of this._accumulationSets())e.reset();this._requestRenderIfEnabled()}_reset(){for(const e of this._accumulationSets())e.reset()}_clearFramebuffer(e=this._fboHandle){e&&(this._rctx.bindFramebuffer(e.fbo),this._rctx.setClearColor(0,0,0,0),this._rctx.clear(16384))}_clearFramebufferForSet(e,t,i){if(!e)return;const s=this._techniques.get(w,t.configuration);this._rctx.bindFramebuffer(e.fbo),this._rctx.bindTechnique(s,i,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(s.primitiveType,0,this._vao.vertexCount("geometry"))}_accumulateShadow(e,t){this._renderToShadowMap(t,e.lightDirections[e.progress++],this._depthRange);const i=this._techniques.get(y,e.configuration);this._rctx.bindFramebuffer(this._fboHandle?.fbo),this._rctx.bindTechnique(i,t,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(i.primitiveType,0,this._vao.vertexCount("geometry"))}_isAccumulationValid(e){return this._fboHandle?.fbo.width===e.fullWidth&&this._fboHandle?.fbo.height===e.fullHeight}_requestRenderIfEnabled(){this._enabled&&this._requestRender()}get _rctx(){return this._fbos.rctx}updateDepthRange(e){this._depthRange.equals(e)||(this._depthRange=e,this._invalidateAccumulationSets())}get test(){}};e([n()],H.prototype,"_refining",null),e([n()],H.prototype,"active",null),e([n()],H.prototype,"_doneAccumulating",null),e([n()],H.prototype,"_numActive",null),e([n()],H.prototype,"_colorFormat",null),e([n()],H.prototype,"_depthRange",void 0),e([n()],H.prototype,"_enabled",void 0),e([n()],H.prototype,"_previewing",void 0),e([n()],H.prototype,"_accumulationRenderer",void 0),H=e([h("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],H);const j=6,P=new Uint8Array(4);class D{constructor(e,t){this.configuration=e,this._notifyChange=t,this._cachedLightDirections=[],this._progress=o(0),this._sampleCount=o(0)}get progress(){return this._progress.value}set progress(e){this._progress.value=e}get sampleCount(){return this._sampleCount.value}get doneAccumulating(){return this.progress>=this.sampleCount}get running(){return this.progress>0}get active(){return this.sampleCount>0}get lightDirections(){return this._cachedLightDirections}set lightDirections(e){const t=this._cachedLightDirections,s=Math.min(v,e.length);if(!i(t,0,t.length,e,0,s,u)){t.length=s,this._sampleCount.value=s;for(let i=0;i<s;++i)t[i]=c(t[i]??l(),e[i]);this.reset(),this._notifyChange()}}destroy(){this._cachedLightDirections.length=0,this._sampleCount.value=0}reset(){this.progress=0}precompile(e){e.precompile(y,this.configuration),e.precompile(w,this.configuration)}}export{H as ShadowAccumulator};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{addMany as r,filterInPlace as t}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{someMap as s,everyMap as i}from"../../../../core/MapUtils.js";import n from"../../../../core/PooledArray.js";import{property as o,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{set as d}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{OverlayTarget as c}from"../../terrain/Intersector.js";import{ChangeSet as l,RenderGeometryUpdate as m}from"./ChangeSet.js";import{IntersectorResultRay as g}from"./IntersectorResult.js";import{RendererBase as p}from"./RendererBase.js";import{noBudget as u}from"../../../support/Scheduler.js";let y=class extends p{constructor(e){super(e),this._pending=new f,this._changes=new l,this._sortedRenderers=new n,this._geometries=new Map,this._hasHighlights=!1,this._hasWater=!1}destroy(){this.destroyed||(this._changes.prune(),this._sortedRenderers.prune(),this._geometries.clear(),this._pending.clear())}get updating(){return!this._pending.empty||this._changes.updates.length>0}get rctx(){return this.rendererContext.rctx}get _localOriginFactory(){return this.rendererContext.localOriginFactory}get hasHighlights(){return this._hasHighlights}hasHighlight(e){return s(this.renderers,r=>r.hasHighlight(e))}get hasWater(){return this._hasWater}get hasOccluders(){return this.renderers&&s(this.renderers,e=>e.hasOnlyOccluders)}get hasOnlyOccluders(){return i(this.renderers,e=>e.hasOnlyOccluders)}get isEmpty(){return!this.updating&&0===this.renderers.size&&0===this._geometries.size}get sortedRenderers(){return this._sortedRenderers}commitChanges(){return!!this.updating&&(this._processAddsRemoves(),this.commit(this._changes,u,this.rendererContext.pluginContext)&&(this._updateSortedMaterialRenderers(),this._hasHighlights=s(this.renderers,e=>{const r=e.produces.get(18);return!!r&&r(10)}),this._hasWater=s(this.renderers,e=>{const r=e.produces.get(19);return!!r&&r(4)})),this.notifyChange("updating"),!0)}addRenderer(){this._sortedRenderers.clear()}removeRenderer(){this._sortedRenderers.clear()}addGeometries(e,r){if(0===e.length)return;const t=this._validateRenderGeometries(e);for(const i of t)this._geometries.set(i.id,i);const s=this._pending.empty;for(const i of t)this._pending.adds.add(i);switch(s&&this.notifyChange("updating"),r){case 0:this._notifyGraphicVisibilityChanged(e);break;case 1:this._notifyGraphicGeometryChanged(e)}}removeGeometries(e,r){if(this.destroyed)return;const t=this._pending.empty,s=this._pending.adds;for(const i of e)s.has(i)?(this._pending.removed.add(i),s.delete(i)):this._pending.removed.has(i)||this._pending.removes.add(i),this._geometries.delete(i.id);t&&!this._pending.empty&&this.notifyChange("updating"),1===r&&this._notifyGraphicGeometryChanged(e)}modifyGeometries(e,r){const t=0===this._changes.updates.length;for(const s of e){const e=new m;this._changes.updates.push(e),e.renderGeometry=this._ensureValidRenderGeometry(s),e.updateType=r}switch(t&&this._changes.updates.length>0&&this.notifyChange("updating"),r){case 4:case 2:return this._notifyGraphicGeometryChanged(e);case 1:return this._notifyGraphicVisibilityChanged(e)}}updateAnimation(e){let r=!1;return this._sortedRenderers.forAll(t=>r=!!t.updateAnimation&&t.updateAnimation(e)||r),r}precompile(e){return this._sortedRenderers.reduce((r,t)=>t.precompile(e)||r,!1)}render(e){this._sortedRenderers.forAll(r=>{const t=r.acquireTechniques(e);t&&r.render(e,t)})}intersectRay(e,r,t,s,i){for(const n of this._geometries.values()){if(!s(n))continue;this._intersectRenderGeometry(n,t,r,0,e,i);const o=this.rendererContext.longitudeCyclical;if(o){const s=n.boundingSphere.center,a=this._effectiveGeometryRadius(n);s[0]-a<o.min&&this._intersectRenderGeometry(n,t,r,o.range,e,i),s[0]+a>o.max&&this._intersectRenderGeometry(n,t,r,-o.range,e,i)}i++}return i}*intersectScreenPolygon(e,r,t,s){for(const i of this._geometries.values()){if(!t(i))continue;this._intersectScreenPolygonRenderGeometry(i,r,0,e,s);const n=this.rendererContext.longitudeCyclical;if(n){const t=i.boundingSphere.center,o=this._effectiveGeometryRadius(i);t[0]-o<n.min&&this._intersectScreenPolygonRenderGeometry(i,r,n.range,e,s),t[0]+o>n.max&&this._intersectScreenPolygonRenderGeometry(i,r,-n.range,e,s)}s++,yield}return s}_effectiveGeometryRadius(e){const r=e.boundingSphere.radius;return r||e.screenToWorldRatio*C}_updateSortedMaterialRenderers(){if(!(this._sortedRenderers.length>0)){for(const e of this.renderers.values())this._sortedRenderers.push(e);this._sortedRenderers.sort((e,r)=>r.material?.renderPriority===e.material?.renderPriority?e.drapedPriority-r.drapedPriority:(r.material?.renderPriority||0)-(e.material?.renderPriority||0))}}_processAddsRemoves(){this._changes.adds.length=0,this._changes.removes.length=0,r(this._changes.adds,Array.from(this._pending.adds)),r(this._changes.removes,Array.from(this._pending.removes)),t(this._changes.updates,({renderGeometry:e})=>!this._pending.has(e)),this._pending.clear()}_intersectRenderGeometry(e,r,t,s,i,n){if(!e.visible||!e.material.visible||!e.material.intersectRayDraped)return;let o=0;s+=e.transformation[12],o=e.transformation[13],G[0]=t[0]-s,G[1]=t[1]-o,e.screenToWorldRatio=this.rendererContext.screenToWorldRatio,e.material.intersectRayDraped(e,i,G,(t,s,o)=>{_(r,
|
|
2
|
+
import{__decorate as e}from"tslib";import{addMany as r,filterInPlace as t}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{someMap as s,everyMap as i}from"../../../../core/MapUtils.js";import n from"../../../../core/PooledArray.js";import{property as o,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{set as d}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{OverlayTarget as c}from"../../terrain/Intersector.js";import{ChangeSet as l,RenderGeometryUpdate as m}from"./ChangeSet.js";import{IntersectorResultRay as g}from"./IntersectorResult.js";import{RendererBase as p}from"./RendererBase.js";import{noBudget as u}from"../../../support/Scheduler.js";let y=class extends p{constructor(e){super(e),this._pending=new f,this._changes=new l,this._sortedRenderers=new n,this._geometries=new Map,this._hasHighlights=!1,this._hasWater=!1}destroy(){this.destroyed||(this._changes.prune(),this._sortedRenderers.prune(),this._geometries.clear(),this._pending.clear())}get updating(){return!this._pending.empty||this._changes.updates.length>0}get rctx(){return this.rendererContext.rctx}get _localOriginFactory(){return this.rendererContext.localOriginFactory}get hasHighlights(){return this._hasHighlights}hasHighlight(e){return s(this.renderers,r=>r.hasHighlight(e))}get hasWater(){return this._hasWater}get hasOccluders(){return this.renderers&&s(this.renderers,e=>e.hasOnlyOccluders)}get hasOnlyOccluders(){return i(this.renderers,e=>e.hasOnlyOccluders)}get isEmpty(){return!this.updating&&0===this.renderers.size&&0===this._geometries.size}get sortedRenderers(){return this._sortedRenderers}commitChanges(){return!!this.updating&&(this._processAddsRemoves(),this.commit(this._changes,u,this.rendererContext.pluginContext)&&(this._updateSortedMaterialRenderers(),this._hasHighlights=s(this.renderers,e=>{const r=e.produces.get(18);return!!r&&r(10)}),this._hasWater=s(this.renderers,e=>{const r=e.produces.get(19);return!!r&&r(4)})),this.notifyChange("updating"),!0)}addRenderer(){this._sortedRenderers.clear()}removeRenderer(){this._sortedRenderers.clear()}addGeometries(e,r){if(0===e.length)return;const t=this._validateRenderGeometries(e);for(const i of t)this._geometries.set(i.id,i);const s=this._pending.empty;for(const i of t)this._pending.adds.add(i);switch(s&&this.notifyChange("updating"),r){case 0:this._notifyGraphicVisibilityChanged(e);break;case 1:this._notifyGraphicGeometryChanged(e)}}removeGeometries(e,r){if(this.destroyed)return;const t=this._pending.empty,s=this._pending.adds;for(const i of e)s.has(i)?(this._pending.removed.add(i),s.delete(i)):this._pending.removed.has(i)||this._pending.removes.add(i),this._geometries.delete(i.id);t&&!this._pending.empty&&this.notifyChange("updating"),1===r&&this._notifyGraphicGeometryChanged(e)}modifyGeometries(e,r){const t=0===this._changes.updates.length;for(const s of e){const e=new m;this._changes.updates.push(e),e.renderGeometry=this._ensureValidRenderGeometry(s),e.updateType=r}switch(t&&this._changes.updates.length>0&&this.notifyChange("updating"),r){case 4:case 2:return this._notifyGraphicGeometryChanged(e);case 1:return this._notifyGraphicVisibilityChanged(e)}}updateAnimation(e){let r=!1;return this._sortedRenderers.forAll(t=>r=!!t.updateAnimation&&t.updateAnimation(e)||r),r}precompile(e){return this._sortedRenderers.reduce((r,t)=>t.precompile(e)||r,!1)}render(e){this._sortedRenderers.forAll(r=>{const t=r.acquireTechniques(e);t&&r.render(e,t)})}intersectRay(e,r,t,s,i){for(const n of this._geometries.values()){if(!s(n))continue;this._intersectRenderGeometry(n,t,r,0,e,i);const o=this.rendererContext.longitudeCyclical;if(o){const s=n.boundingSphere.center,a=this._effectiveGeometryRadius(n);s[0]-a<o.min&&this._intersectRenderGeometry(n,t,r,o.range,e,i),s[0]+a>o.max&&this._intersectRenderGeometry(n,t,r,-o.range,e,i)}i++}return i}*intersectScreenPolygon(e,r,t,s){for(const i of this._geometries.values()){if(!t(i))continue;this._intersectScreenPolygonRenderGeometry(i,r,0,e,s);const n=this.rendererContext.longitudeCyclical;if(n){const t=i.boundingSphere.center,o=this._effectiveGeometryRadius(i);t[0]-o<n.min&&this._intersectScreenPolygonRenderGeometry(i,r,n.range,e,s),t[0]+o>n.max&&this._intersectScreenPolygonRenderGeometry(i,r,-n.range,e,s)}s++,yield}return s}_effectiveGeometryRadius(e){const r=e.boundingSphere.radius;return r||e.screenToWorldRatio*C}_updateSortedMaterialRenderers(){if(!(this._sortedRenderers.length>0)){for(const e of this.renderers.values())this._sortedRenderers.push(e);this._sortedRenderers.sort((e,r)=>r.material?.renderPriority===e.material?.renderPriority?e.drapedPriority-r.drapedPriority:(r.material?.renderPriority||0)-(e.material?.renderPriority||0))}}_processAddsRemoves(){this._changes.adds.length=0,this._changes.removes.length=0,r(this._changes.adds,Array.from(this._pending.adds)),r(this._changes.removes,Array.from(this._pending.removes)),t(this._changes.updates,({renderGeometry:e})=>!this._pending.has(e)),this._pending.clear()}_intersectRenderGeometry(e,r,t,s,i,n){if(!e.visible||!e.material.visible||!e.material.intersectRayDraped)return;let o=0;s+=e.transformation[12],o=e.transformation[13],G[0]=t[0]-s,G[1]=t[1]-o,e.screenToWorldRatio=this.rendererContext.screenToWorldRatio,e.material.intersectRayDraped(e,i,G,(t,s,o,a)=>{_(r,a,n,e.material.renderPriority,i,e.layerViewUid,e.graphicUid)},r)}_intersectScreenPolygonRenderGeometry(e,r,t,s,i){if(e.visible&&e.material.visible&&e.material.intersectScreenPolygonDraped){d(v,t+e.transformation[12],e.transformation[13]),e.screenToWorldRatio=this.rendererContext.screenToWorldRatio;for(const t of r){const r=e.material.intersectScreenPolygonDraped(e,v,s,t);if(r)return void R(t.distance,r.primitiveIndex,i,e.material.renderPriority,s,e.layerViewUid,e.graphicUid)}}}_notifyGraphicGeometryChanged(e){if(null==this.drapeSource.notifyGraphicGeometryChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicGeometryChanged(t),r=t)}_notifyGraphicVisibilityChanged(e){if(null==this.drapeSource.notifyGraphicVisibilityChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicVisibilityChanged(t),r=t)}_validateRenderGeometries(e){for(const r of e)this._ensureValidRenderGeometry(r);return e}_ensureValidRenderGeometry(e){return null==e.localOrigin&&(e.localOrigin=this._localOriginFactory.getOrigin(e.boundingSphere.center)),e}get test(){}};e([o({constructOnly:!0})],y.prototype,"drapeSource",void 0),e([o({constructOnly:!0})],y.prototype,"rendererContext",void 0),e([o()],y.prototype,"updating",null),e([o()],y.prototype,"rctx",null),e([o()],y.prototype,"_localOriginFactory",null),e([o({readOnly:!0})],y.prototype,"isEmpty",null),e([o()],y.prototype,"_geometries",void 0),y=e([a("esri.views.3d.webgl-engine.lib.SortedRenderGeometryRenderer")],y);class f{constructor(){this.adds=new Set,this.removes=new Set,this.removed=new Set}get empty(){return 0===this.adds.size&&0===this.removes.size&&0===this.removed.size}has(e){return this.adds.has(e)||this.removes.has(e)||this.removed.has(e)}clear(){this.adds.clear(),this.removes.clear(),this.removed.clear()}}function _(e,r,t,s,i,n,o){const a=new c(n,o,r),d=r=>{r.set(5,a,e.distance,e.renderDistance,e.normal,e.transformation,t,s)};if((null==i.results.min.drapedLayerOrder||t>=i.results.min.drapedLayerOrder)&&(null==i.results.min.renderDistance||i.results.ground.renderDistance<=i.results.min.renderDistance)&&d(i.results.min),0!==i.options.store&&(null==i.results.max.drapedLayerOrder||t<i.results.max.drapedLayerOrder)&&(null==i.results.max.renderDistance||i.results.ground.renderDistance>i.results.max.renderDistance)&&d(i.results.max),2===i.options.store){const e=new g(i.ray);d(e),i.results.all.push(e)}}function R(e,r,t,s,i,n,o){i.polygonResults.add(5,new c(n,o,r),e,t,s)}const G=h(),v=h(),C=128;export{y as SortedRenderGeometryRenderer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{disposeMaybe as t}from"../../../../../core/maybe.js";import{Vec4Field as e,ScalarField as r}from"./TextureBackedBufferFields.js";import{getItemsRectangle as
|
|
2
|
+
import{disposeMaybe as t}from"../../../../../core/maybe.js";import{Vec4Field as e,ScalarField as r}from"./TextureBackedBufferFields.js";import{getItemsRectangle as u}from"./TextureBackedBufferUtils.js";import{TextureBuffer as i}from"./TextureBuffer.js";class s{constructor(t,e){this._rctx=t,this._layout=e,this._nameToFieldMap=new Map,this._dirty=!0,this._textureData=e.createBuffer(0),this._setupFields(e)}get layout(){return this._layout}get usedMemory(){return this._textureData.usedMemory+(this._textureBuffer?.usedMemory??0)}get itemCount(){return this._textureData.count}dispose(){this._textureBuffer=t(this._textureBuffer),this._textureData=void 0}get test(){return{data:this._textureData}}getScalarField(t){const e=this._nameToFieldMap.get(t);return 1===e?.elementCount?e:null}getVec4Field(t){const e=this._nameToFieldMap.get(t);return 4===e?.elementCount?e:null}resizeToFit(t){const e=t+1;e>this._textureData.count&&this._resize(e)}updateTexture(){const e=this._textureBuffer,r=null==e||!e.texture.hasWebGLTextureObject;if(this._dirty||r){if(this._dirty=!1,0!==this._textureData.count)return r||e.itemCount<this._textureData.count?(this._textureBuffer=t(this._textureBuffer),void(this._textureBuffer=new i(this._rctx,this.layout,this._textureData.buffer))):void e.setSubData(this._textureData.buffer);this._textureBuffer=t(this._textureBuffer)}}get texture(){return this._textureBuffer?.texture}_resize(t){const{_layout:e}=this;if(0===t)return this._textureData=e.createBuffer(0),this._updateFields(),void(this._dirty=!0);const r=u(t).itemCount,i=e.createBuffer(r);i.texelElementBuffer.set(this._textureData.texelElementBuffer),this._textureData=i,this._updateFields(),this._dirty=!0}_setupFields(t){const u=this._textureData,i=()=>{this._dirty=!0},s=new Map;for(const[o,a]of t.fields){const t=u.getField(o,a.bufferViewConstructor);if(null==t)throw new Error(`Field ${o} does not exist in buffer`);s.set(o,4===t.elementCount?new e(t,a,i):new r(t,a,i))}this._nameToFieldMap=s}_updateFields(){const t=this._textureData;for(const[e,r]of this._nameToFieldMap){const u=t.getField(e,r.layoutField.bufferViewConstructor);if(null==u)throw new Error(`Field ${e} does not exist in buffer`);r.updateBufferView(u)}}}export{s as TextureBackedBuffer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{hasNativeFloat16Array as e}from"../../../../../geometry/support/float16.js";import{BufferViewMat3f as t,BufferViewVec4f as o,BufferViewVec3f as
|
|
2
|
+
import{hasNativeFloat16Array as e}from"../../../../../geometry/support/float16.js";import{BufferViewMat3f as t,BufferViewVec4f as o,BufferViewVec3f as n,BufferViewVec2f as f,BufferViewFloat as r,BufferViewVec4f16 as u,BufferViewFloat16 as m,BufferViewVec2Snorm16 as s,BufferViewSnorm16 as l,BufferViewVec4Unorm8 as w,BufferViewUnorm8 as i,BufferViewVec4u8 as a,BufferViewVec4u32 as c,BufferViewUint32 as p,BufferViewUint8 as v}from"../../../../../geometry/support/buffer/BufferView.js";import{elementTypeSize as y}from"../../../../../geometry/support/buffer/types.js";class b{constructor(e,t,o){this.elementCount=e,this.elementType=t,this.bufferViewConstructor=o,this.byteSize=h(o)}}function h(e){return y(e.ElementType)*e.ElementCount}const g={u8:new b(1,"uint",v),u32:new b(1,"uint",p),vec4u32:new b(4,"uint",c),vec4u8:new b(4,"uint",a),unorm8:new b(1,"float",i),vec4unorm8:new b(4,"float",w),snorm16:new b(1,"float",l),vec2snorm16:new b(2,"float",s),f16:new b(1,"float",e?m:r),vec4f16:new b(4,"float",e?u:o),f32:new b(1,"float",r),vec2f32:new b(2,"float",f),vec3f32:new b(3,"float",n),vec4f32:new b(4,"float",o),mat3f32:new b(9,"float",t)};export{b as FieldCreationInfo,g as typeToCreationInfoMap};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import has from"../../../../core/has.js";import{clamp as t}from"../../../../core/mathUtils.js";import{releaseMaybe as e}from"../../../../core/maybe.js";import{fromRotation as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{sub as r,add as o,negate as a,transformMat4 as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{applyTextureResizeModulo as n}from"./textureUtils.js";import{ViewshedFaceCamera as
|
|
2
|
+
import has from"../../../../core/has.js";import{clamp as t}from"../../../../core/mathUtils.js";import{releaseMaybe as e}from"../../../../core/maybe.js";import{fromRotation as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{sub as r,add as o,negate as a,transformMat4 as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{applyTextureResizeModulo as n}from"./textureUtils.js";import{ViewshedFaceCamera as u}from"./ViewshedFaceCamera.js";import{DepthStencilAttachment as l,SizedDepthFormat as f}from"../../../webgl/enums.js";import{isSizedDepthStencilFormat as m}from"../../../webgl/textureUtils.js";class d{constructor(){this.textureSizeQuality=1,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.textureSizeMultiple=128,this.toleranceSides=5,this.toleranceBottomTop=10}textureSizeModifier(t){const e=t?this.textureSizeModHighQuality:this.textureSizeModLowQuality;return this.textureSizeQuality*e}textureResizeModulo(t){return Math.ceil(t/this.textureSizeMultiple)*this.textureSizeMultiple}}const p=["front","left","right","back","top","bottom"];function g(t){return!["top","bottom"].includes(t)}class _{constructor(t){this._fbos=t,this._faces={},this._width=0,this._height=0,this.settings=new d,this._maxTextureSize=Math.min(has("esri-mobile")?4096:16384,t.rctx.parameters.maxTextureSize)}get depthTexture(){return this._fbo?.getTexture(l)}get ready(){return null!=this.depthTexture&&0!==this._width&&0!==this._height}get nearFar(){const t=this.faces;return 0===t.length?null:t[0].nearFar}get numActiveFaces(){const t=this._faces;let e=0;return Object.keys(t).forEach(i=>{t[i]&&(e+=1)}),e}get faces(){const t=this._faces,e=[];for(const i of p){const s=t[i];s&&e.push(s)}return e}get atlasRegions(){return this.faces.map(t=>[t.x/this._width,(t.x+t.width)/this._width,t.y/this._height,(t.y+t.height)/this._height])}get viewshedProjectionMatrices(){return this.faces.map(t=>t.projectionMatrix)}get viewshedViewMatrices(){return this.faces.map(t=>t.viewMatrix)}_setupFaceCamera(e,n,l,f){const{effectiveObserverRenderSpace:m,effectiveTargetRenderSpace:d,tiltedUpVector:p,farDistanceRenderSpace:_,horizontalFieldOfView:x,verticalFieldOfView:b}=n,w=c();r(w,d,m);const M=c(),S=c(),F=(t,e)=>{const r=c(),a=s();return i(a,t,e),h(r,w,a),o(r,m,r),r};let z,T=p;const v=Math.min(90,x),O=Math.min(90,Math.max(0,(x-90)/2));let B=-45,j=45,y=-45,k=45;if(g(e)){const e=e=>t(e,-45,45);y=e(-b/2)-this.settings.toleranceBottomTop,k=e(+b/2)+this.settings.toleranceBottomTop}switch(e){case"front":z=d,B=-v/2,j=v/2;break;case"left":z=F(Math.PI/2,p),B=45-O;break;case"right":z=F(-Math.PI/2,p),j=-45+O;break;case"top":z=o(M,m,p),T=a(S,w);break;case"bottom":z=r(M,m,p),T=w;break;case"back":z=F(Math.PI,p)}const V=new u({center:z,eye:m,up:T,far:_});V.sectionAnglesDeg=[B-this.settings.toleranceSides,j+this.settings.toleranceSides,y,k],V.fovY=Math.PI/2;const P=V.setViewport(l,f);return this._faces[e]=V,P}isActive(t){return this._computeActiveFaces(t).size>0}_computeActiveFaces(t){const e=new Set,{horizontalFieldOfView:i,verticalFieldOfView:s}=t,r=-s/2,o=s/2;return 0===i||0===s||(r<=45&&o>=-45&&e.add("front"),i>90&&(e.add("left"),e.add("right")),i>270&&e.add("back"),o>45-this.settings.toleranceBottomTop&&e.add("top"),r<-45+this.settings.toleranceBottomTop&&e.add("bottom")),e}_computeBaseTextureSize({pixelRatio:t,fullWidth:e,fullHeight:i},s,r,o){const a=s/t,h=this.settings.textureSizeModifier(r);return n(Math.max(e,i)*a*h,this._maxTextureSize/o)}_ensureFBO(t){const e=this._width,i=this._height,s=this._fbo?.fbo;s&&s.width===e&&s.height===i&&t===m(s.depthStencilTexture?.descriptor?.internalFormat??f.DEPTH_COMPONENT16)||(this._fbo?.release(),this._fbo=this._allocateFBO(t))}_allocateFBO(t){const{_width:e,_height:i}=this,s=t?14:13,r=this._fbos.acquire(e,i,"viewshed shadow map",s);return r.getTexture(l)?.setShadowFiltering(!1),r}clearFBO(t){const e=this._fbos.rctx;this._ensureFBO(t),e.bindFramebuffer(this._fbo?.fbo),e.setClearColor(1,1,1,1),e.clear(16640)}dispose(){this._fbo=e(this._fbo)}releaseFBO(){this._debugFBO||(this._fbo=e(this._fbo))}start(t,e,i,s,r=!1){this._faces={};const o=this._computeActiveFaces(e),a=o.size;if(0===a)return!1;const h=this._computeBaseTextureSize(t,s,i,a);let c=0,n=0,u=0;for(const l of o){const t=x(l,a);t>n&&(u=Math.max(u,c),c=0),n=t;const i=t*h;c+=this._setupFaceCamera(l,e,[c,i],h)}return u=Math.max(u,c),this._width=this.settings.textureResizeModulo(u),this._height=b(a)*h,this.clearFBO(r),!0}finish(){}get test(){}}function x(t,e){if(e<4)return 0;const i="front"===t||"left"===t;return 4===e?i?0:1:i||"right"===t?0:1}function b(t){return t<4?1:2}export{_ as ViewshedShadowMap};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{unique as e}from"../../../../../core/arrayUtils.js";import{estimateNumberArrayMemory as t,baseTypedArrayMemory as r}from"../../../../../core/memoryEstimations.js";import{IntersectorResultRay as s}from"../IntersectorResult.js";import{LodTarget as n}from"./Intersector.js";class i{constructor(e,t,r,s){this.material=e,this.buffer=t,this.numVertices=r,this.boundingInfo=s,this.bufferWriter=e.createBufferWriter()}get layout(){return this.bufferWriter.layout}get numTriangles(){return this.numVertices/3}computeUsedMemory(){return this.buffer.byteLength+r}get renderGeometry(){return this}}class o{constructor(e){this.engineGeometry=e;const t=this.material,r=this.engineGeometry,s=r.attributes,n=r.boundingInfo,o=t.createBufferWriter(),a=o.layout,m=o.elementCount(s),u=a.createBuffer(m);o.write(null,null,s,null,{buffer:u,offset:0}),this.renderGeometry=new i(t,u.buffer,m,n)}get material(){return this.engineGeometry.material}get numVertices(){return this.engineGeometry.indexCount}get numTriangles(){return this.numVertices/3}get boundingInfo(){return this.engineGeometry.boundingInfo}computeUsedMemory(){return
|
|
2
|
+
import{unique as e}from"../../../../../core/arrayUtils.js";import{estimateNumberArrayMemory as t,baseTypedArrayMemory as r}from"../../../../../core/memoryEstimations.js";import{IntersectorResultRay as s}from"../IntersectorResult.js";import{LodTarget as n}from"./Intersector.js";class i{constructor(e,t,r,s){this.material=e,this.buffer=t,this.numVertices=r,this.boundingInfo=s,this.bufferWriter=e.createBufferWriter()}get layout(){return this.bufferWriter.layout}get numTriangles(){return this.numVertices/3}computeUsedMemory(){return this.buffer.byteLength+r}get renderGeometry(){return this}}class o{constructor(e){this.engineGeometry=e;const t=this.material,r=this.engineGeometry,s=r.attributes,n=r.boundingInfo,o=t.createBufferWriter(),a=o.layout,m=o.elementCount(s),u=a.createBuffer(m);o.write(null,null,s,null,{buffer:u,offset:0}),this.renderGeometry=new i(t,u.buffer,m,n)}get material(){return this.engineGeometry.material}get numVertices(){return this.engineGeometry.indexCount}get numTriangles(){return this.numVertices/3}get boundingInfo(){return this.engineGeometry.boundingInfo}computeUsedMemory(){return this.engineGeometry.attributes.values().reduce((e,r)=>e+t(r.data,r.indices),0)}intersect(e,t,r,s,n,i,o,m){const u=this.engineGeometry;this.material.intersectRay(u,e.transform.transform,e,r,s,(r,s,u,c)=>a(r,s,u,c,e,t,i,o,n,m))}intersectScreenPolygon(e,t,r,s,i,o){const a=this.engineGeometry,m=this.material.intersectScreenPolygon?.(a,e.transform.transform,e,t);m?.valid&&e.polygonResults.add(3,new n(s.layerViewUid,s.graphicUid(r),m.primitiveIndex,i,o),m.distance)}}function a(e,t,r,i,o,a,m,u,c,l){if(e<0)return;if(a&&!a(o.rayBegin,o.rayEnd,e))return;const h=new n(m.layerViewUid,m.graphicUid(c),i,u,l);if((null==o.results.min.renderDistance||t<o.results.min.renderDistance)&&o.results.min.set(3,h,e,t,r,o.transform.transform),(null==o.results.max.renderDistance||t>o.results.max.renderDistance)&&o.results.max.set(3,h,e,t,r,o.transform.transform),2===o.options.store){const n=new s(o.results.min.ray);n.set(3,h,e,t,r,o.transform.transform),o.results.all.push(n)}}class m{constructor(e,t=null){this.geometry=e,this.textures=t}get material(){return this.geometry.material}get numTriangles(){return this.geometry.numTriangles}}class u{constructor(t,r,s){this.components=t,this.minScreenSpaceRadius=r,this.pivotOffset=s;const n=e(this.components.map(e=>e.geometry));this.numVertices=n.reduce((e,t)=>e+t.numVertices,0)}}class c{constructor(e){this.levels=e,this.levels.sort((e,t)=>e.minScreenSpaceRadius===t.minScreenSpaceRadius?e.numVertices-t.numVertices:e.minScreenSpaceRadius-t.minScreenSpaceRadius)}get materialParameters(){return this.levels[0].components[0].geometry.material.parameters}getMaterials(){const t=[];return this.levels.forEach(e=>e.components.forEach(e=>t.push(e.geometry.material))),e(t)}getTextures(){const t=new Array;return this.levels.forEach(e=>e.components.forEach(e=>{null!=e.textures&&t.push(...e.textures)})),e(t)}getGeometries(){const t=new Array;return this.levels.forEach(e=>e.components.forEach(e=>{t.push(e.geometry)})),e(t)}getEngineGeometries(){return this.getGeometries().map(e=>e.engineGeometry).filter(e=>null!=e)}computeUsedMemory(){const e=this.getGeometries(),t=this.getTextures(),r=e.reduce((e,t)=>e+t.computeUsedMemory(),0);return t.reduce((e,t)=>e+t.usedMemory,0)+r}}export{o as LodComponentEngineGeometry,i as LodComponentRenderGeometry,m as LodComponentResources,u as LodLevelResources,c as LodResources};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import t from"../../../../core/PooledArray.js";import{createScreenPointArray as e}from"../../../../core/screenUtils.js";import{
|
|
2
|
+
import t from"../../../../core/PooledArray.js";import{createScreenPointArray as e}from"../../../../core/screenUtils.js";import{distance as r,copy as o,set as i,transformMat4 as n,squaredDistance as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as a,create as u}from"../../../../geometry/support/aaBoundingBox.js";import{intersectsTransformedAabb as c}from"../../../../geometry/support/frustum.js";import{clipPolygon as m}from"../../../../geometry/support/plane.js";import{normalFromValues as f,closestPointFromValues as p}from"../../../../geometry/support/triangle.js";import{boundingInfoSubdivisionThreshold as d}from"./intersectionConstants.js";import{screenPolygonIntersectsTriangle as h}from"./screenPolygonOverlapUtils.js";class I{constructor(t){this.primitiveIndex=t}}class g{constructor(t){this.type=t,this.distance=Number.POSITIVE_INFINITY,this.primitiveIndex=0,this.hasNormal=!1,this.point=l(),this.normal=l()}reset(){this.distance=Number.POSITIVE_INFINITY,this.hasNormal=!1}update(t,e,r,i){this.distance=t,this.primitiveIndex=e,o(this.point,r),this.hasNormal=null!=i,null!=i&&o(this.normal,i)}updateIfCloserFromValues(t,e,r,o){t<this.distance&&this.update(t,e,r,o)}updateIfCloser(t){const{distance:e,primitiveIndex:r,point:o,normal:i}=t;this.updateIfCloserFromValues(e,r,o,t.hasNormal?i:null)}get valid(){return Number.isFinite(this.distance)}}function y(t,e,r,o,i){if(!t.visible||0!==t.type)return null;const n=new g(4);let s;s=t.boundingInfo?b(t.readPrimitivePosition,t.boundingInfo,e,r,o,i):v(e,r,o,0,t.faceCount,t.readPrimitivePosition,i,null,0);for(const l of s)n.updateIfCloser(l);return n.valid?n:null}function*v(t,e,o,i,n,s,l,a=null,u=0){if(null==t.camera)return;const{camera:c,screenPolygonPrimitiveProcessor:p}=t;for(let d=i;d<n;++d){const t=(a?.[d]??d)+u,i=null==a?t:d,n=3*t;N(F[0],s,n+0,l,i,e),N(F[1],s,n+1,l,i,e),N(F[2],s,n+2,l,i,e);const h=O;let I;A.reset();const g=C;for(const e of p.processTriangle(F))if(g.length=0,m(c.frustum[4],e,()=>g.pushNew(),!1),!(g.length<3)){for(let t=0;t<g.length;t++)c.projectToScreen(g.at(t),V[t]);P(o,V,g.length)&&(j(c.eye,g,w),null==I&&(I=f(O,F[0],F[1],F[2])),A.updateIfCloserFromValues(r(c.eye,w),t,w,I?h:null))}A.valid&&(yield A)}}function*b(t,e,r,o,i,n){let s;if(null!=n?(a(x,e.box),n.applyToAabb(x),s=c(i.broadPhaseFrustum,x,o)):s=c(i.broadPhaseFrustum,e.box,o),!s)return;const{primitiveIndices:l}=e,u=l.length;if(u>d){const s=e.children;if(void 0!==s){for(const e of s)yield*b(t,e,r,o,i,n);return}}yield*v(r,o,i,0,u,t,n,l,0)}function N(t,e,r,o,s,l){const[a,u,c]=e(t,r);null!=o?o.applyToVertex(t,a,u,c,s):i(t,a,u,c),l&&n(t,t,l)}function P(t,e,r){for(let o=1;o<r-1;o++)if(h(t,e[0],e[o],e[o+1]))return!0;return!1}function j(t,e,r){let i=Number.POSITIVE_INFINITY;const n=e.at(0);for(let l=1;l<e.length-1;l++){p(S,t,n,e.at(l),e.at(l+1));const a=s(t,S);a<i&&(i=a,o(r,S))}}const x=u(),T=12,F=[l(),l(),l()],C=new t({allocator:t=>t??l()}),V=Array.from({length:T},()=>e()),w=l(),O=l(),S=l(),A=new g(4);export{I as DrapedHit,g as Hit,v as forEachTriangleRangeScreenPolygonHit,y as intersectTriangleGeometryScreenPolygon};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as s}from"../../../../core/screenUtils.js";import{fromMat4 as r}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{copy as a,set as n,rotate as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{ONES as l,fromValues as c,create as f}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{copy as h,length as p,scale as u,distance as d,transformMat4 as m,set as g,normalize as S,subtract as x,transformMat3 as b,scaleAndAdd as v,sub as O,dot as z}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as y,fromValues as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as V,ONES as R,create as D}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as C,empty as w,expandPointInPlace as A}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as j}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as U}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as M}from"../../support/debugFlags.js";import{isColorHighlightOrOLID as T,isColor as _,isOIT as L}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as F}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterialBindParameters as I,GLTextureMaterial as E}from"../lib/GLTextureMaterial.js";import{Material as B}from"../lib/Material.js";import{screenPolygonIntersectsBounds as H,screenPolygonIntersectsTriangle as W}from"../lib/screenPolygonOverlapUtils.js";import{DrapedHit as N,Hit as G}from"../lib/screenPolygonTriangleIntersections.js";import{SeparateScreenSizePerspectiveEvaluators as q}from"../lib/screenSizePerspectiveUtils.js";import{assert as X}from"../lib/Util.js";import{writePosition as Y,writeNormal as k,writeColor as J,writeBufferVec2 as K,writeBufferFloat as Q,writeBufferVec3 as Z,writeBufferZeros as $,writeBufferVec4 as ee,writeOlidColor as te}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as se}from"./internal/MaterialUtil.js";import{a as re}from"../../../../chunks/HUDMaterial.glsl.js";import{baseLayout as ie,getInstanceLayout as ae,HUDMaterialTechnique as ne}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as oe}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as le}from"../../../../webscene/support/AlphaCutoff.js";class ce extends B{constructor(e,t,s=!1){super(e,Ne),this.produces=new Map([[12,e=>T(e)&&!this.parameters.drawAsLabel&&!this._configuration.transparentOccluded],[13,e=>T(e)&&!this.parameters.drawAsLabel&&this._configuration.transparentOccluded],[14,e=>T(e)&&this.parameters.drawAsLabel],[18,e=>this.parameters.draped&&T(e)]]),this._visible=!0,this._configuration=new oe(t,s)}updateConfiguration(e){super.updateConfiguration(e);const{parameters:t,_configuration:s}=this,r=t.draped;s.enableOITOffset=e.enableOITOffset,s.hasSlicePlane=this.parameters.hasSlicePlane,s.hasVerticalOffset=!!this.parameters.verticalOffset,s.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,s.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,s.polygonOffset=this.parameters.polygonOffset,s.draped=r,s.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,s.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,s.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,s.hasRotation=this.parameters.hasRotation,s.hasVVSize=!!this.parameters.vvSize,s.hasVVColor=!!this.parameters.vvColor,s.occludedFragmentFade=!r&&!!this.parameters.occludedFragmentOpacity,s.hasFocusAreaStyle=null!=this.parameters.focusAreaStyle,s.depthTestEnabled=this.parameters.depthEnabled,s.hasVertexColor=this.parameters.hasVertexColor,s.hasVertexSize=this.parameters.hasVertexSize,s.hasVertexRotation=this.parameters.hasVertexRotation,s.hasVertexUVi=this.parameters.hasVertexUVi,s.hasVertexCenterOffset=this.parameters.hasVertexCenterOffset,_(e.output)&&(s.debugDrawLabelBorder=!!M.LABELS_SHOW_BORDER),s.hasOcclusionTexture=!t.drawAsLabel&&s.transparentOccluded&&L(e.output)}intersectRay(e,t,s,r,i,a){const{options:{selectionMode:n,hud:o,excludeLabels:l},point:c,camera:f}=s,{parameters:g}=this;if(n&&o&&(!l||!g.isLabel)&&e.visible&&c&&f)for(const{renderScreenPosition:S,screenSize:x,pixelRatioTolerance:b,halfOutlineSize:v,rotationAngle:O,anchor:z,centerView:P}of this._forEachScreenSpaceHUDInstance(Le,e,t,f))if(ue(c,S[0],S[1],x,b,v,O,g,z)){const e=s.ray;if(ve[0]=c[0],ve[1]=c[1],ve[2]=S[2],f.unprojectFromRenderScreen(ve,Se)){const t=y();h(t,e.direction);const s=1/p(t);u(t,t,s);const r=d(e.origin,Se)*s,i=y();m(i,P,f.inverseViewMatrix),a(r,t,-1,i)}}}*_forEachScreenSpaceHUDInstance(e,t,s,i){const{parameters:n}=this,o=t.attributes.get("featureAttribute"),l=null==o?null:V(o.data,De),{scaleX:c,scaleY:f}=qe(l,n,i.pixelRatio),p=t.attributes.get("position"),d=t.attributes.get("size"),O=t.attributes.get("normal"),z=t.attributes.get("rotation"),y=t.attributes.get("centerOffset"),P=n.size,R=r(Pe,s);X(p.size>=3);const D="screen"===n.centerOffsetUnits;for(let r=0;r<p.data.length/p.size;r++){const t=r*p.size;if(g(Se,p.data[t],p.data[t+1],p.data[t+2]),m(Se,Se,s),m(Se,Se,i.viewMatrix),y){const e=r*y.size;g(Ve,y.data[e],y.data[e+1],y.data[e+2])}else g(Ve,0,0,0);if(!D&&(Se[0]+=Ve[0],Se[1]+=Ve[1],0!==Ve[2])){const e=Ve[2];S(Ve,Se),x(Se,Se,u(Ve,Ve,e))}const o=r*O.size;g(xe,O.data[o],O.data[o+1],O.data[o+2]),b(xe,xe,R);const{normal:l,cosAngle:V}=pe(xe,i,Ie),C=Ye(n,Se,V,i,ge);if(v(Se,Se,l,C),i.applyProjection(Se,be),be[0]>-1){if(D&&(Ve[0]||Ve[1])&&(be[0]+=Ve[0]*i.pixelRatio,0!==Ve[1]&&(be[1]+=ge.alignmentEvaluator.apply(Ve[1])*i.pixelRatio),i.unapplyProjection(be,Se)),be[0]+=n.screenOffset[0]*i.pixelRatio,be[1]+=n.screenOffset[1]*i.pixelRatio,be[0]=Math.floor(be[0]),be[1]=Math.floor(be[1]),He[0]=P[0],He[1]=P[1],null!=d){const e=r*d.size;He[0]*=d.data[e],He[1]*=d.data[e+1]}ge.evaluator.applyVec2(He,He);let t=0;if(n.textureIsSignedDistanceField){t=Math.min(n.outlineSize,.5*He[0])*i.pixelRatio/2}He[0]*=c,He[1]*=f,h(e.centerView,Se),g(e.renderScreenPosition,be[0],be[1],be[2]),a(e.screenSize,He),e.pixelRatioTolerance=Ee*i.pixelRatio,e.halfOutlineSize=t,e.rotationAngle=n.rotation+(null!=z?z.data[r*z.size]:0),e.anchor=re(n),yield e}}}*_forEachDrapedHUDInstance(e,t){const s=t.attributes.get("position"),r=t.attributes.get("size"),i=t.attributes.get("rotation"),n=this.parameters,o=n.size,l=t.attributes.get("featureAttribute"),c=null==l?null:V(l.data,De),{scaleX:f,scaleY:h}=qe(c,n,t.screenToWorldRatio);e.pixelRatioTolerance=Be*t.screenToWorldRatio,e.anchor=re(n);for(let p=0;p<s.data.length/s.size;p++){const l=p*s.size;if(e.x=s.data[l],e.y=s.data[l+1],He[0]=o[0],He[1]=o[1],null!=r){const e=p*r.size;He[0]*=r.data[e],He[1]*=r.data[e+1]}if(e.halfOutlineSize=0,n.textureIsSignedDistanceField){const s=Math.min(n.outlineSize,.5*He[0]);e.halfOutlineSize=s*t.screenToWorldRatio/2}He[0]*=f,He[1]*=h,a(e.screenSize,He),e.rotationAngle=n.rotation+(null!=i?i.data[p*i.size]:0),yield e}}intersectRayDraped(e,t,s,r,i){const a=this.parameters;for(const{x:n,y:o,screenSize:l,pixelRatioTolerance:c,halfOutlineSize:f,rotationAngle:h,anchor:p}of this._forEachDrapedHUDInstance(Fe,e))ue(s,n,o,l,c,f,h,a,p)&&r(i.distance,i.normal,-1)}intersectScreenPolygonDraped(e,t,s,r){if(!s.options.selectionMode||s.options.excludeLabels&&this.parameters.isLabel)return null;const i=this.parameters;for(const{x:a,y:n,screenSize:o,pixelRatioTolerance:l,halfOutlineSize:c,rotationAngle:f,anchor:h}of this._forEachDrapedHUDInstance(Fe,e))if(de(r,a+t[0],n+t[1],o,l,c,f,i,h,!1))return new N(-1);return null}intersectScreenPolygon(e,t,s,r){const{options:{selectionMode:i,hud:a,excludeLabels:n},camera:o}=s,{parameters:l}=this;if(!i||!a||n&&l.isLabel||!e.visible||null==t)return null;const c=new G(1),f=1/o.pixelRatio;for(const{renderScreenPosition:h,screenSize:p,pixelRatioTolerance:u,halfOutlineSize:g,rotationAngle:S,anchor:x,centerView:b}of this._forEachScreenSpaceHUDInstance(Le,e,t,o)){const e=m(Se,b,o.inverseViewMatrix);if(!s.screenPolygonPrimitiveProcessor?.validatePoint(e))continue;const t=h[0]*f,i=(o.fullHeight-h[1])*f;if(Me[0]=p[0]*f,Me[1]=p[1]*f,de(r,t,i,Me,u*f,g*f,S,l,x,!0)){const t=d(o.eye,e);c.updateIfCloserFromValues(t,-1,e,null)}}return c.valid?c:null}createBufferWriter(){return new Ge(this.parameters)}applyShaderOffsets(e,t,s,i,a,n,o,l){b(Oe,s,r(Pe,i));const c=pe(Oe,o,Ie),f=Xe(p(t),o),h=Ye(this.parameters,t,c.cosAngle,o,l);v(t,t,c.normal,h+f),v(e,e,Oe,h+f);const u=n+h;this._applyPolygonOffsetView(t,c,u,o,t),this._applyCenterOffsetView(t,a,t)}applyShaderOffsetsNDC(e,t,s,r,i,a){return this._applyCenterOffsetNDC(e,t,r,i),null!=a&&h(a,i),this._applyPolygonOffsetNDC(i,s,r,i),i}_applyPolygonOffsetView(t,s,r,i,a){const n=i.aboveGround?1:-1;let o=Math.sign(r);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return h(a,t);const c=e(Math.abs(s.cosAngle),.01,1),f=1-Math.sqrt(1-c*c)/c/i.viewport[2];return u(a,t,l>0?f:1/f),a}_applyCenterOffsetView(e,t,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&h(s,e),r&&(s[0]+=t[0],s[1]+=t[1],t[2]&&(S(xe,s),O(s,s,u(xe,xe,t[2])))),s}_applyCenterOffsetNDC(e,t,s,r){const i="screen"!==this.parameters.centerOffsetUnits;return r!==e&&h(r,e),i||(r[0]+=t[0]/s.fullWidth*2,r[1]+=t[1]/s.fullHeight*2),r}_applyPolygonOffsetNDC(e,t,s,r){const i=this.parameters.shaderPolygonOffset;if(e!==r&&h(r,e),i){const e=s.aboveGround?1:-1,a=e*Math.sign(t);r[2]-=(a||e)*i}return r}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:s}=this.parameters,r=e[3]>=le||t>=le&&s[3]>=le;return this._visible&&r}createGLMaterial(e){return new fe(e)}calculateRelativeScreenBounds(e,t,s=C()){return he(this.parameters,e,t,s),s[2]=s[0]+e[0],s[3]=s[1]+e[1],s}}class fe extends E{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique(ne,e)}}function he(e,t,s,r){r[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*s,r[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*s}function pe(e,t,s){return m(s.normal,e,t.viewInverseTransposeMatrix),s.cosAngle=z(s.normal,We),s}function ue(e,s,r,i,a,l,c,f,h){const p=me(s,r,i,a,l,f,h,Ce);return n(ye,s,r),o(ze,e,ye,t(c)),ze[0]>p[0]&&ze[0]<p[2]&&ze[1]>p[1]&&ze[1]<p[3]}function de(e,s,r,i,a,l,c,f,h,p){const u=me(s,r,i,a,l,f,h,Ce,p);if(n(we,u[0],u[1]),n(Ae,u[2],u[1]),n(je,u[2],u[3]),n(Ue,u[0],u[3]),0!==c){const e=t(c);n(ye,s,r),o(we,we,ye,e),o(Ae,Ae,ye,e),o(je,je,ye,e),o(Ue,Ue,ye,e),w(u),A(u,we),A(u,Ae),A(u,je),A(u,Ue)}return!!H(e,u)&&(W(e,we,Ae,je)||W(e,we,je,Ue))}function me(e,t,s,r,i,a,n,o,l=!1){let c=e-r-s[0]*n[0],f=c+s[0]+2*r;const h=l?1-n[1]:n[1];let p=t-r-s[1]*h,u=p+s[1]+2*r;const d=a.distanceFieldBoundingBox;return a.textureIsSignedDistanceField&&null!=d&&(c+=s[0]*d[0],p+=s[1]*(l?1-d[3]:d[1]),f-=s[0]*(1-d[2]),u-=s[1]*(l?d[1]:1-d[3]),c-=i,f+=i,p-=i,u+=i),o[0]=c,o[1]=p,o[2]=f,o[3]=u,o}const ge=new q,Se=y(),xe=y(),be=D(),ve=s(),Oe=y(),ze=f(),ye=f(),Pe=i(),Ve=y(),Re=y(),De=D(),Ce=C(),we=f(),Ae=f(),je=f(),Ue=f(),Me=f();class Te{constructor(){this.renderScreenPosition=y(),this.screenSize=f(),this.centerView=y(),this.pixelRatioTolerance=0,this.halfOutlineSize=0,this.rotationAngle=0,this.anchor=f()}}class _e{constructor(){this.x=0,this.y=0,this.screenSize=f(),this.pixelRatioTolerance=0,this.halfOutlineSize=0,this.rotationAngle=0,this.anchor=f()}}const Le=new Te,Fe=new _e,Ie={normal:y(),cosAngle:0},Ee=1,Be=2,He=c(0,0),We=P(0,0,1);class Ne extends I{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1,this.color=R,this.size=l,this.polygonOffset=0,this.anchorPosition=c(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=R,this.outlineSize=0,this.distanceFieldBoundingBox=D(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.hasVertexColor=!1,this.hasVertexSize=!1,this.hasVertexRotation=!1,this.hasVertexUVi=!1,this.hasVertexCenterOffset=!1,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.focusAreaStyle=null,this.draped=!1,this.isLabel=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class Ge{constructor(e){this.baseInstanceLayout=ie,this.layout=ae(e)}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}write(e,t,s,r,i){if(null==i)return;const{buffer:a,offset:n}=i,{position:o,normal:l,color:c,size:f,rotation:h,centerOffset:p,groundDistance:u,featureAttribute:d,uvi:m}=a;Y(s.get("position"),e,o,n),k(s.get("normal"),t,l,n);const g=s.get("position").indices.length;if(m){const e=s.get("uvi")?.data;if(e&&e.length>=4){const[t,s,r,i]=e;for(let e=0;e<g;++e){const a=n+e;m.setValues(a,t,s,r,i)}}}if(c&&J(s.get("color"),4,c,n),f&&K(s.get("size"),f,n),h&&Q(s.get("rotation"),h,n),p&&(s.get("centerOffset")?Z(s.get("centerOffset"),p,n):$(p,n,g)),s.get("groundDistance")?Q(s.get("groundDistance"),u,n):$(u,n,g),d&&(s.get("featureAttribute")?ee(s.get("featureAttribute"),d,n):$(d,n,g)),null!=r){const e=s.get("position")?.indices;if(e){const t=e.length,s=a.getField("olidColor",j);te(r,s,t,n)}}}writeBaseInstance(e,t){const{uv0:s}=t;K(e.get("uv0"),s,0)}}function qe(e,t,s){return null==e||null==t.vvSize?{scaleX:s,scaleY:s}:(U(Re,t,e),{scaleX:Re[0]*s,scaleY:Re[1]*s})}function Xe(e,t){const s=t.computeRenderPixelSizeAtDist(e)*F;return(t.aboveGround?1:-1)*s}function Ye(e,t,s,r,i){if(!e.verticalOffset?.screenLength){const r=p(t);return i.update(s,r,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),0}const a=p(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=se(r,a,e.verticalOffset,s,n,e.screenSizePerspectiveMinPixelReferenceSize);return i.update(s,a,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),o}export{ce as HUDMaterial,Ne as Parameters};
|
|
2
|
+
import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as s}from"../../../../core/screenUtils.js";import{fromMat4 as r}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{copy as a,set as n,rotate as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{ONES as l,fromValues as c,create as f}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{copy as h,length as p,scale as u,distance as d,transformMat4 as m,set as g,normalize as S,subtract as x,transformMat3 as b,scaleAndAdd as v,sub as O,dot as z}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as y,fromValues as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as V,ONES as D,create as R}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as C,empty as w,expandPointInPlace as A}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as j}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as U}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as M}from"../../support/debugFlags.js";import{isColorHighlightOrOLID as T,isColor as _,isOIT as L}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as F}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterialBindParameters as I,GLTextureMaterial as E}from"../lib/GLTextureMaterial.js";import{Material as B}from"../lib/Material.js";import{screenPolygonIntersectsBounds as H,screenPolygonIntersectsTriangle as W}from"../lib/screenPolygonOverlapUtils.js";import{DrapedHit as N,Hit as G}from"../lib/screenPolygonTriangleIntersections.js";import{SeparateScreenSizePerspectiveEvaluators as q}from"../lib/screenSizePerspectiveUtils.js";import{assert as X}from"../lib/Util.js";import{writePosition as Y,writeNormal as k,writeColor as J,writeBufferVec2 as K,writeBufferFloat as Q,writeBufferVec3 as Z,writeBufferZeros as $,writeBufferVec4 as ee,writeOlidColor as te}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as se}from"./internal/MaterialUtil.js";import{a as re}from"../../../../chunks/HUDMaterial.glsl.js";import{baseLayout as ie,getInstanceLayout as ae,HUDMaterialTechnique as ne}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as oe}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as le}from"../../../../webscene/support/AlphaCutoff.js";class ce extends B{constructor(e,t,s=!1){super(e,Ne),this.produces=new Map([[12,e=>T(e)&&!this.parameters.drawAsLabel&&!this._configuration.transparentOccluded],[13,e=>T(e)&&!this.parameters.drawAsLabel&&this._configuration.transparentOccluded],[14,e=>T(e)&&this.parameters.drawAsLabel],[18,e=>this.parameters.draped&&T(e)]]),this._visible=!0,this._configuration=new oe(t,s)}updateConfiguration(e){super.updateConfiguration(e);const{parameters:t,_configuration:s}=this,r=t.draped;s.enableOITOffset=e.enableOITOffset,s.hasSlicePlane=this.parameters.hasSlicePlane,s.hasVerticalOffset=!!this.parameters.verticalOffset,s.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,s.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,s.polygonOffset=this.parameters.polygonOffset,s.draped=r,s.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,s.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,s.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,s.hasRotation=this.parameters.hasRotation,s.hasVVSize=!!this.parameters.vvSize,s.hasVVColor=!!this.parameters.vvColor,s.occludedFragmentFade=!r&&!!this.parameters.occludedFragmentOpacity,s.hasFocusAreaStyle=null!=this.parameters.focusAreaStyle,s.depthTestEnabled=this.parameters.depthEnabled,s.hasVertexColor=this.parameters.hasVertexColor,s.hasVertexSize=this.parameters.hasVertexSize,s.hasVertexRotation=this.parameters.hasVertexRotation,s.hasVertexUVi=this.parameters.hasVertexUVi,s.hasVertexCenterOffset=this.parameters.hasVertexCenterOffset,_(e.output)&&(s.debugDrawLabelBorder=!!M.LABELS_SHOW_BORDER),s.hasOcclusionTexture=!t.drawAsLabel&&s.transparentOccluded&&L(e.output)}intersectRay(e,t,s,r,i,a){const{options:{selectionMode:n,hud:o,excludeLabels:l},point:c,camera:f}=s,{parameters:g}=this;if(n&&o&&(!l||!g.isLabel)&&e.visible&&c&&f)for(const{renderScreenPosition:S,screenSize:x,pixelRatioTolerance:b,halfOutlineSize:v,rotationAngle:O,anchor:z,centerView:P}of this._forEachScreenSpaceHUDInstance(Le,e,t,f))if(ue(c,S[0],S[1],x,b,v,O,g,z)){const e=s.ray;if(ve[0]=c[0],ve[1]=c[1],ve[2]=S[2],f.unprojectFromRenderScreen(ve,Se)){const t=y();h(t,e.direction);const s=1/p(t);u(t,t,s);const r=d(e.origin,Se)*s,i=y();m(i,P,f.inverseViewMatrix),a(r,r,t,-1,i)}}}*_forEachScreenSpaceHUDInstance(e,t,s,i){const{parameters:n}=this,o=t.attributes.get("featureAttribute"),l=null==o?null:V(o.data,Re),{scaleX:c,scaleY:f}=qe(l,n,i.pixelRatio),p=t.attributes.get("position"),d=t.attributes.get("size"),O=t.attributes.get("normal"),z=t.attributes.get("rotation"),y=t.attributes.get("centerOffset"),P=n.size,D=r(Pe,s);X(p.size>=3);const R="screen"===n.centerOffsetUnits;for(let r=0;r<p.data.length/p.size;r++){const t=r*p.size;if(g(Se,p.data[t],p.data[t+1],p.data[t+2]),m(Se,Se,s),m(Se,Se,i.viewMatrix),y){const e=r*y.size;g(Ve,y.data[e],y.data[e+1],y.data[e+2])}else g(Ve,0,0,0);if(!R&&(Se[0]+=Ve[0],Se[1]+=Ve[1],0!==Ve[2])){const e=Ve[2];S(Ve,Se),x(Se,Se,u(Ve,Ve,e))}const o=r*O.size;g(xe,O.data[o],O.data[o+1],O.data[o+2]),b(xe,xe,D);const{normal:l,cosAngle:V}=pe(xe,i,Ie),C=Ye(n,Se,V,i,ge);if(v(Se,Se,l,C),i.applyProjection(Se,be),be[0]>-1){if(R&&(Ve[0]||Ve[1])&&(be[0]+=Ve[0]*i.pixelRatio,0!==Ve[1]&&(be[1]+=ge.alignmentEvaluator.apply(Ve[1])*i.pixelRatio),i.unapplyProjection(be,Se)),be[0]+=n.screenOffset[0]*i.pixelRatio,be[1]+=n.screenOffset[1]*i.pixelRatio,be[0]=Math.floor(be[0]),be[1]=Math.floor(be[1]),He[0]=P[0],He[1]=P[1],null!=d){const e=r*d.size;He[0]*=d.data[e],He[1]*=d.data[e+1]}ge.evaluator.applyVec2(He,He);let t=0;if(n.textureIsSignedDistanceField){t=Math.min(n.outlineSize,.5*He[0])*i.pixelRatio/2}He[0]*=c,He[1]*=f,h(e.centerView,Se),g(e.renderScreenPosition,be[0],be[1],be[2]),a(e.screenSize,He),e.pixelRatioTolerance=Ee*i.pixelRatio,e.halfOutlineSize=t,e.rotationAngle=n.rotation+(null!=z?z.data[r*z.size]:0),e.anchor=re(n),yield e}}}*_forEachDrapedHUDInstance(e,t){const s=t.attributes.get("position"),r=t.attributes.get("size"),i=t.attributes.get("rotation"),n=this.parameters,o=n.size,l=t.attributes.get("featureAttribute"),c=null==l?null:V(l.data,Re),{scaleX:f,scaleY:h}=qe(c,n,t.screenToWorldRatio);e.pixelRatioTolerance=Be*t.screenToWorldRatio,e.anchor=re(n);for(let p=0;p<s.data.length/s.size;p++){const l=p*s.size;if(e.x=s.data[l],e.y=s.data[l+1],He[0]=o[0],He[1]=o[1],null!=r){const e=p*r.size;He[0]*=r.data[e],He[1]*=r.data[e+1]}if(e.halfOutlineSize=0,n.textureIsSignedDistanceField){const s=Math.min(n.outlineSize,.5*He[0]);e.halfOutlineSize=s*t.screenToWorldRatio/2}He[0]*=f,He[1]*=h,a(e.screenSize,He),e.rotationAngle=n.rotation+(null!=i?i.data[p*i.size]:0),yield e}}intersectRayDraped(e,t,s,r,i){const a=this.parameters;for(const{x:n,y:o,screenSize:l,pixelRatioTolerance:c,halfOutlineSize:f,rotationAngle:h,anchor:p}of this._forEachDrapedHUDInstance(Fe,e))ue(s,n,o,l,c,f,h,a,p)&&r(i.distance,i.renderDistance,i.normal,-1)}intersectScreenPolygonDraped(e,t,s,r){if(!s.options.selectionMode||s.options.excludeLabels&&this.parameters.isLabel)return null;const i=this.parameters;for(const{x:a,y:n,screenSize:o,pixelRatioTolerance:l,halfOutlineSize:c,rotationAngle:f,anchor:h}of this._forEachDrapedHUDInstance(Fe,e))if(de(r,a+t[0],n+t[1],o,l,c,f,i,h,!1))return new N(-1);return null}intersectScreenPolygon(e,t,s,r){const{options:{selectionMode:i,hud:a,excludeLabels:n},camera:o}=s,{parameters:l}=this;if(!i||!a||n&&l.isLabel||!e.visible||null==t)return null;const c=new G(1),f=1/o.pixelRatio;for(const{renderScreenPosition:h,screenSize:p,pixelRatioTolerance:u,halfOutlineSize:g,rotationAngle:S,anchor:x,centerView:b}of this._forEachScreenSpaceHUDInstance(Le,e,t,o)){const e=m(Se,b,o.inverseViewMatrix);if(!s.screenPolygonPrimitiveProcessor?.validatePoint(e))continue;const t=h[0]*f,i=(o.fullHeight-h[1])*f;if(Me[0]=p[0]*f,Me[1]=p[1]*f,de(r,t,i,Me,u*f,g*f,S,l,x,!0)){const t=d(o.eye,e);c.updateIfCloserFromValues(t,-1,e,null)}}return c.valid?c:null}createBufferWriter(){return new Ge(this.parameters)}applyShaderOffsets(e,t,s,i,a,n,o,l){b(Oe,s,r(Pe,i));const c=pe(Oe,o,Ie),f=Xe(p(t),o),h=Ye(this.parameters,t,c.cosAngle,o,l);v(t,t,c.normal,h+f),v(e,e,Oe,h+f);const u=n+h;this._applyPolygonOffsetView(t,c,u,o,t),this._applyCenterOffsetView(t,a,t)}applyShaderOffsetsNDC(e,t,s,r,i,a){return this._applyCenterOffsetNDC(e,t,r,i),null!=a&&h(a,i),this._applyPolygonOffsetNDC(i,s,r,i),i}_applyPolygonOffsetView(t,s,r,i,a){const n=i.aboveGround?1:-1;let o=Math.sign(r);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return h(a,t);const c=e(Math.abs(s.cosAngle),.01,1),f=1-Math.sqrt(1-c*c)/c/i.viewport[2];return u(a,t,l>0?f:1/f),a}_applyCenterOffsetView(e,t,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&h(s,e),r&&(s[0]+=t[0],s[1]+=t[1],t[2]&&(S(xe,s),O(s,s,u(xe,xe,t[2])))),s}_applyCenterOffsetNDC(e,t,s,r){const i="screen"!==this.parameters.centerOffsetUnits;return r!==e&&h(r,e),i||(r[0]+=t[0]/s.fullWidth*2,r[1]+=t[1]/s.fullHeight*2),r}_applyPolygonOffsetNDC(e,t,s,r){const i=this.parameters.shaderPolygonOffset;if(e!==r&&h(r,e),i){const e=s.aboveGround?1:-1,a=e*Math.sign(t);r[2]-=(a||e)*i}return r}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:s}=this.parameters,r=e[3]>=le||t>=le&&s[3]>=le;return this._visible&&r}createGLMaterial(e){return new fe(e)}calculateRelativeScreenBounds(e,t,s=C()){return he(this.parameters,e,t,s),s[2]=s[0]+e[0],s[3]=s[1]+e[1],s}}class fe extends E{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique(ne,e)}}function he(e,t,s,r){r[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*s,r[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*s}function pe(e,t,s){return m(s.normal,e,t.viewInverseTransposeMatrix),s.cosAngle=z(s.normal,We),s}function ue(e,s,r,i,a,l,c,f,h){const p=me(s,r,i,a,l,f,h,Ce);return n(ye,s,r),o(ze,e,ye,t(c)),ze[0]>p[0]&&ze[0]<p[2]&&ze[1]>p[1]&&ze[1]<p[3]}function de(e,s,r,i,a,l,c,f,h,p){const u=me(s,r,i,a,l,f,h,Ce,p);if(n(we,u[0],u[1]),n(Ae,u[2],u[1]),n(je,u[2],u[3]),n(Ue,u[0],u[3]),0!==c){const e=t(c);n(ye,s,r),o(we,we,ye,e),o(Ae,Ae,ye,e),o(je,je,ye,e),o(Ue,Ue,ye,e),w(u),A(u,we),A(u,Ae),A(u,je),A(u,Ue)}return!!H(e,u)&&(W(e,we,Ae,je)||W(e,we,je,Ue))}function me(e,t,s,r,i,a,n,o,l=!1){let c=e-r-s[0]*n[0],f=c+s[0]+2*r;const h=l?1-n[1]:n[1];let p=t-r-s[1]*h,u=p+s[1]+2*r;const d=a.distanceFieldBoundingBox;return a.textureIsSignedDistanceField&&null!=d&&(c+=s[0]*d[0],p+=s[1]*(l?1-d[3]:d[1]),f-=s[0]*(1-d[2]),u-=s[1]*(l?d[1]:1-d[3]),c-=i,f+=i,p-=i,u+=i),o[0]=c,o[1]=p,o[2]=f,o[3]=u,o}const ge=new q,Se=y(),xe=y(),be=R(),ve=s(),Oe=y(),ze=f(),ye=f(),Pe=i(),Ve=y(),De=y(),Re=R(),Ce=C(),we=f(),Ae=f(),je=f(),Ue=f(),Me=f();class Te{constructor(){this.renderScreenPosition=y(),this.screenSize=f(),this.centerView=y(),this.pixelRatioTolerance=0,this.halfOutlineSize=0,this.rotationAngle=0,this.anchor=f()}}class _e{constructor(){this.x=0,this.y=0,this.screenSize=f(),this.pixelRatioTolerance=0,this.halfOutlineSize=0,this.rotationAngle=0,this.anchor=f()}}const Le=new Te,Fe=new _e,Ie={normal:y(),cosAngle:0},Ee=1,Be=2,He=c(0,0),We=P(0,0,1);class Ne extends I{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1,this.color=D,this.size=l,this.polygonOffset=0,this.anchorPosition=c(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=D,this.outlineSize=0,this.distanceFieldBoundingBox=R(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.hasVertexColor=!1,this.hasVertexSize=!1,this.hasVertexRotation=!1,this.hasVertexUVi=!1,this.hasVertexCenterOffset=!1,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.focusAreaStyle=null,this.draped=!1,this.isLabel=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class Ge{constructor(e){this.baseInstanceLayout=ie,this.layout=ae(e)}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}write(e,t,s,r,i){if(null==i)return;const{buffer:a,offset:n}=i,{position:o,normal:l,color:c,size:f,rotation:h,centerOffset:p,groundDistance:u,featureAttribute:d,uvi:m}=a;Y(s.get("position"),e,o,n),k(s.get("normal"),t,l,n);const g=s.get("position").indices.length;if(m){const e=s.get("uvi")?.data;if(e&&e.length>=4){const[t,s,r,i]=e;for(let e=0;e<g;++e){const a=n+e;m.setValues(a,t,s,r,i)}}}if(c&&J(s.get("color"),4,c,n),f&&K(s.get("size"),f,n),h&&Q(s.get("rotation"),h,n),p&&(s.get("centerOffset")?Z(s.get("centerOffset"),p,n):$(p,n,g)),s.get("groundDistance")?Q(s.get("groundDistance"),u,n):$(u,n,g),d&&(s.get("featureAttribute")?ee(s.get("featureAttribute"),d,n):$(d,n,g)),null!=r){const e=s.get("position")?.indices;if(e){const t=e.length,s=a.getField("olidColor",j);te(r,s,t,n)}}}writeBaseInstance(e,t){const{uv0:s}=t;K(e.get("uv0"),s,0)}}function qe(e,t,s){return null==e||null==t.vvSize?{scaleX:s,scaleY:s}:(U(De,t,e),{scaleX:De[0]*s,scaleY:De[1]*s})}function Xe(e,t){const s=t.computeRenderPixelSizeAtDist(e)*F;return(t.aboveGround?1:-1)*s}function Ye(e,t,s,r,i){if(!e.verticalOffset?.screenLength){const r=p(t);return i.update(s,r,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),0}const a=p(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=se(r,a,e.verticalOffset,s,n,e.screenSizePerspectiveMinPixelReferenceSize);return i.update(s,a,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),o}export{ce as HUDMaterial,Ne as Parameters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{set as t,squaredDistance as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isColor as s}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{Material as
|
|
2
|
+
import{set as t,squaredDistance as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isColor as s}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{Material as n}from"../lib/Material.js";import{writePosition as a,writeBufferFloat as o}from"./internal/bufferWriterUtils.js";import{attributeDrivenInstanceLayout as u,instanceLayout as c,HeatmapDensityPassParameters as l,HeatmapDensityTechnique as f,baseLayout as p}from"../shaders/HeatmapDensityTechnique.js";import{HeatmapDensityTechniqueConfiguration as m}from"../shaders/HeatmapDensityTechniqueConfiguration.js";const h=2;class d extends l{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloats=!1}}class b extends n{constructor(t){super(t,d),this.visible=!0,this.produces=new Map([[18,t=>s(t)]]),this.intersectScreenPolygonDraped=void 0,this._configuration=new m}updateConfiguration(t){super.updateConfiguration(t),this._configuration.isAttributeDriven=this.parameters.isAttributeDriven,this._configuration.usesHalfFloat=this.parameters.usesHalfFloats}createGLMaterial(t){return new g(t)}intersectRay(){}intersectRayDraped(r,s,i,n,a){const o=r.attributes.get("position"),{parameters:u}=this,{searchRadius:c}=u,{screenToWorldRatio:l}=r,f=c*l+h*l,p=f*f,m=o.data.length/o.size;for(let h=0;h<m;h++){const r=h*o.size,s=t(y,o.data[r],o.data[r+1]);e(s,i)<p&&n(a.distance,a.renderDistance,a.normal,-1)}}intersectScreenPolygon(){return null}createBufferWriter(){return new v(this.parameters.isAttributeDriven?u:c)}}class g extends i{beginSlot(t){return this.getTechnique(f,t)}}class v{constructor(t){this.layout=t,this.baseInstanceLayout=p}elementCount(t){return t.get("position").indices.length}elementCountBaseInstance(){return 4}write(t,e,r,s,i){if(null==i)return;const{buffer:n,offset:u}=i;a(r.get("position"),t,n.position,u);const c="featureAttribute"in n?n.featureAttribute:null;c&&o(r.get("featureAttribute"),c,u)}writeBaseInstance(t,e){const r=e.uv0;r.setValues(0,-1,-1),r.setValues(1,-1,1),r.setValues(2,1,-1),r.setValues(3,1,1)}}const y=r();export{b as HeatmapDensityMaterial,d as Parameters};
|