@arcgis/core 5.2.0-next.111 → 5.2.0-next.112
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/components/assets/icon/alignBottom16.json +1 -0
- package/assets/components/assets/icon/alignBottom24.json +1 -0
- package/assets/components/assets/icon/alignBottom32.json +1 -0
- package/assets/components/assets/icon/alignCenterHorizontal16.json +1 -0
- package/assets/components/assets/icon/alignCenterHorizontal24.json +1 -0
- package/assets/components/assets/icon/alignCenterHorizontal32.json +1 -0
- package/assets/components/assets/icon/alignCenterVertical16.json +1 -0
- package/assets/components/assets/icon/alignCenterVertical24.json +1 -0
- package/assets/components/assets/icon/alignCenterVertical32.json +1 -0
- package/assets/components/assets/icon/alignLeft16.json +1 -0
- package/assets/components/assets/icon/alignLeft24.json +1 -0
- package/assets/components/assets/icon/alignLeft32.json +1 -0
- package/assets/components/assets/icon/alignRight16.json +1 -0
- package/assets/components/assets/icon/alignRight24.json +1 -0
- package/assets/components/assets/icon/alignRight32.json +1 -0
- package/assets/components/assets/icon/alignTop16.json +1 -0
- package/assets/components/assets/icon/alignTop24.json +1 -0
- package/assets/components/assets/icon/alignTop32.json +1 -0
- package/assets/components/assets/icon/columnGroup16.json +1 -0
- package/assets/components/assets/icon/columnGroup24.json +1 -0
- package/assets/components/assets/icon/columnGroup32.json +1 -0
- package/assets/components/assets/icon/columnRemove16.json +1 -0
- package/assets/components/assets/icon/columnRemove24.json +1 -0
- package/assets/components/assets/icon/columnRemove32.json +1 -0
- package/assets/components/assets/icon/columnUngroup16.json +1 -0
- package/assets/components/assets/icon/columnUngroup24.json +1 -0
- package/assets/components/assets/icon/columnUngroup32.json +1 -0
- package/assets/components/assets/icon/envelopeOpen16.json +1 -0
- package/assets/components/assets/icon/envelopeOpen24.json +1 -0
- package/assets/components/assets/icon/envelopeOpen32.json +1 -0
- package/assets/components/assets/icon/handDraw16.json +1 -0
- package/assets/components/assets/icon/handDraw24.json +1 -0
- package/assets/components/assets/icon/handDraw32.json +1 -0
- package/assets/components/assets/icon/monitorShare16.json +1 -0
- package/assets/components/assets/icon/monitorShare24.json +1 -0
- package/assets/components/assets/icon/monitorShare32.json +1 -0
- package/assets/components/assets/icon/pi16.json +1 -0
- package/assets/components/assets/icon/pi24.json +1 -0
- package/assets/components/assets/icon/pi32.json +1 -0
- package/assets/components/assets/icon/rowGroup16.json +1 -0
- package/assets/components/assets/icon/rowGroup24.json +1 -0
- package/assets/components/assets/icon/rowGroup32.json +1 -0
- package/assets/components/assets/icon/rowRemove16.json +1 -0
- package/assets/components/assets/icon/rowRemove24.json +1 -0
- package/assets/components/assets/icon/rowRemove32.json +1 -0
- package/assets/components/assets/icon/rowUngroup16.json +1 -0
- package/assets/components/assets/icon/rowUngroup24.json +1 -0
- package/assets/components/assets/icon/rowUngroup32.json +1 -0
- package/assets/components/assets/icon/sdCard16.json +1 -0
- package/assets/components/assets/icon/sdCard24.json +1 -0
- package/assets/components/assets/icon/sdCard32.json +1 -0
- package/assets/components/assets/icon/spaceAroundHorizontal16.json +1 -0
- package/assets/components/assets/icon/spaceAroundHorizontal24.json +1 -0
- package/assets/components/assets/icon/spaceAroundHorizontal32.json +1 -0
- package/assets/components/assets/icon/spaceAroundVertical16.json +1 -0
- package/assets/components/assets/icon/spaceAroundVertical24.json +1 -0
- package/assets/components/assets/icon/spaceAroundVertical32.json +1 -0
- package/assets/components/assets/icon/spaceBetweenHorizontal16.json +1 -0
- package/assets/components/assets/icon/spaceBetweenHorizontal24.json +1 -0
- package/assets/components/assets/icon/spaceBetweenHorizontal32.json +1 -0
- package/assets/components/assets/icon/spaceBetweenVertical16.json +1 -0
- package/assets/components/assets/icon/spaceBetweenVertical24.json +1 -0
- package/assets/components/assets/icon/spaceBetweenVertical32.json +1 -0
- package/assets/components/assets/icon/spacedEvenlyHorizontal16.json +1 -0
- package/assets/components/assets/icon/spacedEvenlyHorizontal24.json +1 -0
- package/assets/components/assets/icon/spacedEvenlyHorizontal32.json +1 -0
- package/assets/components/assets/icon/spacedEvenlyVertical16.json +1 -0
- package/assets/components/assets/icon/spacedEvenlyVertical24.json +1 -0
- package/assets/components/assets/icon/spacedEvenlyVertical32.json +1 -0
- package/assets/components/assets/icon/stretchHorizontal16.json +1 -0
- package/assets/components/assets/icon/stretchHorizontal24.json +1 -0
- package/assets/components/assets/icon/stretchHorizontal32.json +1 -0
- package/assets/components/assets/icon/stretchVertical16.json +1 -0
- package/assets/components/assets/icon/stretchVertical24.json +1 -0
- package/assets/components/assets/icon/stretchVertical32.json +1 -0
- package/assets/components/assets/icon/swatchPalette16.json +1 -0
- package/assets/components/assets/icon/swatchPalette24.json +1 -0
- package/assets/components/assets/icon/swatchPalette32.json +1 -0
- package/assets/components/assets/icon/thermometer16.json +1 -0
- package/assets/components/assets/icon/thermometer24.json +1 -0
- package/assets/components/assets/icon/thermometer32.json +1 -0
- package/assets/components/assets/icon/webCamera16.json +1 -0
- package/assets/components/assets/icon/webCamera24.json +1 -0
- package/assets/components/assets/icon/webCamera32.json +1 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/078ed48eb055dd213ee6.js +1 -0
- package/assets/esri/core/workers/chunks/186350d720352bd5ff33.js +1 -0
- package/assets/esri/core/workers/chunks/21c0743b2f612e7e7de3.js +1 -0
- package/assets/esri/core/workers/chunks/25cc6d7178a52f2f46b7.js +1 -0
- package/assets/esri/core/workers/chunks/{6010799e05d239073de0.js → 25ecf94d776c3b6db0f3.js} +1 -1
- package/assets/esri/core/workers/chunks/{10d33b4f248864225f85.js → 2728eda8178e02fbca47.js} +1 -1
- package/assets/esri/core/workers/chunks/{4c9df8ae9238454969b8.js → 2c21f4744e19b925a6ae.js} +1 -1
- package/assets/esri/core/workers/chunks/32fc7d1db4b311f6b880.js +1 -0
- package/assets/esri/core/workers/chunks/3acc1299c1382c3b034d.js +1 -0
- package/assets/esri/core/workers/chunks/{c2684fcde2923c9830e0.js → 42c4d0c1c08bf111e5a4.js} +1 -1
- package/assets/esri/core/workers/chunks/430802108b63194b7ddd.js +2 -0
- package/assets/esri/core/workers/chunks/{f5e8ccbd6b4c0a386903.js → 448f068a14f24f2f8a43.js} +1 -1
- package/assets/esri/core/workers/chunks/49c6dc487714f9cd55c7.js +1 -0
- package/assets/esri/core/workers/chunks/{70e0ead69a722fd964b8.js → 49e8ff5ed079a9e3be4b.js} +1 -1
- package/assets/esri/core/workers/chunks/{69921d068add041b5dcb.js → 5134241be1f1bf25231a.js} +1 -1
- package/assets/esri/core/workers/chunks/{54bb3678570ca032f051.js → 5762746cfb02a4119d82.js} +1 -1
- package/assets/esri/core/workers/chunks/{434c5b54e89ace974cbd.js → 5965a947f68b707eaa6b.js} +2 -2
- package/assets/esri/core/workers/chunks/6c25c929bcde7e3a2af1.js +1 -0
- package/assets/esri/core/workers/chunks/7610dd0b46948b7bd840.js +1 -0
- package/assets/esri/core/workers/chunks/7be56ac60e580c806a5d.js +1 -0
- package/assets/esri/core/workers/chunks/7f2ac03efaa4a4898ba2.js +2 -0
- package/assets/esri/core/workers/chunks/{847781aefed049493444.js → 9f760dc4492a03e0504c.js} +1 -1
- package/assets/esri/core/workers/chunks/{013c9cc198736a72f7f2.js → 9fb46ccd4be4c3b61c31.js} +1 -1
- package/assets/esri/core/workers/chunks/bdcca906fdfb8e179abb.js +2 -0
- package/assets/esri/core/workers/chunks/c5ceceb0683671f92efa.js +1 -0
- package/assets/esri/core/workers/chunks/c5e288d57bacb8451e2d.js +2 -0
- package/assets/esri/core/workers/chunks/{b92b7d6c1e693c97a3eb.js → d1f54b0079fb71a15612.js} +1 -1
- package/assets/esri/core/workers/chunks/{72be81c1394285b51ed3.js → d45483dd0dc2853b18b7.js} +212 -216
- package/assets/esri/core/workers/chunks/d5e3f8e5b8d2576d3cb3.js +2 -0
- package/assets/esri/core/workers/chunks/{21d4219844ae5654618b.js → d926bffc3ff9f87e9081.js} +1 -1
- package/assets/esri/core/workers/chunks/{abcda435bc83ef4240f9.js → e6dae16208f6978b59e0.js} +1 -1
- package/assets/esri/core/workers/chunks/e755075ac2e02e881fad.js +1 -0
- package/assets/esri/core/workers/chunks/{058d4c927486a361e633.js → ea9e770efc85594e4dd2.js} +1 -1
- package/assets/esri/core/workers/chunks/eff99e45d818e58fd443.js +1 -0
- package/assets/esri/core/workers/chunks/{a49147203e55609630cc.js → f453dc4a075d2f900c7d.js} +1 -1
- package/assets/esri/core/workers/chunks/f465fb26541372fdc908.js +2 -0
- package/assets/esri/core/workers/chunks/{b7809ef3e1dabd921339.js → f72f4413fc7461e11a2a.js} +1 -1
- package/assets/esri/themes/base/widgets/_BasemapLayerList.scss +1 -0
- package/assets/esri/themes/base/widgets/_Bookmarks.scss +1 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/ChapmanAtmosphere.glsl.js +1 -1
- package/chunks/Component.glsl.js +57 -56
- package/chunks/DefaultMaterial.glsl.js +19 -23
- package/chunks/GaussianSplat.glsl.js +13 -11
- package/chunks/GlobalIllumination.glsl.js +1 -1
- package/chunks/Haze.glsl.js +1 -1
- package/chunks/Path.glsl.js +21 -24
- package/chunks/RealisticTree.glsl.js +42 -41
- package/chunks/RibbonLine.glsl.js +65 -56
- package/chunks/SimpleAtmosphere.glsl.js +1 -1
- package/chunks/Terrain.glsl.js +25 -25
- package/chunks/Water.glsl.js +4 -4
- package/config.js +1 -1
- package/core/units.js +1 -1
- package/geometry/support/heightModelInfoUtils.js +1 -1
- package/kernel.js +1 -1
- package/layers/GaussianSplatLayer.js +1 -1
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/mixins/TiledImagery.d.ts +6 -0
- package/layers/mixins/TiledImagery.js +1 -1
- package/layers/raster/datasets/ImageServerRaster.js +1 -1
- package/layers/raster/datasets/RasterFactory.js +1 -1
- package/layers/support/domainUtils.d.ts +2 -0
- package/layers/support/domainUtils.js +1 -1
- package/layers/support/fieldUtils.d.ts +10 -0
- package/layers/support/fieldUtils.js +1 -1
- package/package.json +6 -6
- package/support/revision.js +1 -1
- package/symbols/LineStyleMarker3D.d.ts +3 -4
- package/symbols/LineSymbol3D.d.ts +19 -2
- package/symbols/LineSymbol3D.js +1 -1
- package/symbols/LineSymbol3DLayer.d.ts +13 -6
- package/symbols/Symbol3DLayer.d.ts +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/clipping.js +2 -0
- package/views/2d/input/MapViewInputManager.js +1 -1
- package/views/2d/input/handlers/KeyPan.js +1 -1
- package/views/2d/layers/support/annodime/DimensionInfo.js +1 -1
- package/views/2d/layers/support/annodime/dimensionUtils.js +1 -1
- package/views/3d/input/SceneInputManager.js +1 -1
- package/views/3d/input/handlers/KeyboardNavigation.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
- package/views/3d/support/MemoryController.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentDrawParameters.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/Component.glsl.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +4 -4
- package/views/3d/webgl-engine/core/shaderLibrary/output/getEmissions.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +57 -58
- package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +5 -3
- package/views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/MarkerSizing.glsl.js +7 -6
- package/views/3d/webgl-engine/core/shaderLibrary/shading/NormalUtils.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/shading/Normals.glsl.js +5 -10
- package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js +10 -48
- package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js +16 -22
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +6 -6
- package/views/3d/webgl-engine/core/shaderLibrary/shading/calculateUVZShadow.glsl.js +5 -3
- package/views/3d/webgl-engine/core/shaderLibrary/shading/pbrGlobals.glsl.js +19 -0
- package/views/3d/webgl-engine/core/shaderLibrary/shading/pbrShadingInfo.glsl.js +24 -0
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +2 -2
- package/views/3d/webgl-engine/effects/snowcover/SnowCover.glsl.js +4 -4
- package/views/3d/webgl-engine/lib/GaussianSplatDepthRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/LineMaterial.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/VisualVariablePassParameters.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplatPass.glsl.js +19 -22
- package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarkerTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/SlicePlaneMaterialTechniqueConfiguration.js +1 -1
- package/views/MapView.d.ts +1 -0
- package/views/SceneView.d.ts +1 -0
- package/views/View.js +1 -1
- package/views/support/DefaultsFromMap.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/BatchAttributeForm/ReactiveContingentValuesManager.js +1 -1
- package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/MultipleChoiceController.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Bookmarks.js +1 -1
- package/widgets/FeatureForm/featureFormUtils.js +1 -1
- package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
- package/widgets/Search/LocatorSearchSource.d.ts +4 -3
- package/widgets/support/forms/formUtils.d.ts +5 -0
- package/widgets/support/forms/formUtils.js +1 -1
- package/widgets/support/forms/types.d.ts +7 -1
- package/assets/esri/core/workers/chunks/075eb62465edb9cbf907.js +0 -1
- package/assets/esri/core/workers/chunks/0ff13f7a18b0123d253e.js +0 -1
- package/assets/esri/core/workers/chunks/1082bb0858585bd4fa21.js +0 -2
- package/assets/esri/core/workers/chunks/19ac6f4664f97fb3821c.js +0 -1
- package/assets/esri/core/workers/chunks/1ec01fd6330d011c76d6.js +0 -1
- package/assets/esri/core/workers/chunks/2e2349387a2b9903f13c.js +0 -2
- package/assets/esri/core/workers/chunks/349e9f3d3e3267d02988.js +0 -1
- package/assets/esri/core/workers/chunks/3ffc852db1a820ed143b.js +0 -1
- package/assets/esri/core/workers/chunks/411bbdecba340df11d95.js +0 -2
- package/assets/esri/core/workers/chunks/4490dd8bae0dd2769d99.js +0 -1
- package/assets/esri/core/workers/chunks/476535cfb06ced74d611.js +0 -2
- package/assets/esri/core/workers/chunks/5e56a004b4407b8066eb.js +0 -1
- package/assets/esri/core/workers/chunks/6df29716f75696434807.js +0 -1
- package/assets/esri/core/workers/chunks/a322afbb48898ce35851.js +0 -1
- package/assets/esri/core/workers/chunks/b82b523b6837ed1f28d3.js +0 -2
- package/assets/esri/core/workers/chunks/c7b762bae945f383c723.js +0 -1
- package/assets/esri/core/workers/chunks/ef24fd6c0322e5de9fdf.js +0 -2
- package/assets/esri/core/workers/chunks/f9e5740b05de24ba81be.js +0 -1
- package/assets/esri/core/workers/chunks/fc622f9e33e3b48113c8.js +0 -1
- /package/assets/esri/core/workers/chunks/{476535cfb06ced74d611.js.LICENSE.txt → 430802108b63194b7ddd.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{b82b523b6837ed1f28d3.js.LICENSE.txt → 7f2ac03efaa4a4898ba2.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{ef24fd6c0322e5de9fdf.js.LICENSE.txt → bdcca906fdfb8e179abb.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{1082bb0858585bd4fa21.js.LICENSE.txt → c5e288d57bacb8451e2d.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{2e2349387a2b9903f13c.js.LICENSE.txt → d5e3f8e5b8d2576d3cb3.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{411bbdecba340df11d95.js.LICENSE.txt → f465fb26541372fdc908.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__addDisposableResource as e,__disposeResources as t}from"tslib";import r from"../../../../core/Error.js";import{disposable as i}from"../../../../core/handleUtils.js";import{translate as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as a,create as o}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,scale as l,multiply as h}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as c,fromArray as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as m}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromArray as u,create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBuffer as f}from"../../../../geometry/projection/projectBuffer.js";import{create as g,fromSubBuffer as _,intersectsClippingArea as y}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as b,doubleArrayFrom as v}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as x}from"../../../../geometry/support/FloatArray.js";import{getCoordinateEquals as w}from"../../../../geometry/support/geometryUtils.js";import{isDrivenOpacityFallbackAlwaysOpaque as P}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{needsElevationUpdates3D as S,evaluateElevationAlignmentAtPoint as D,SampleElevationInfo as j}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as V}from"./Graphics3DObject3DGraphicLayer.js";import{maxPathLength as C}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as A,nanFallbackColor as z}from"./Graphics3DSymbolLayer.js";import{isValidSize as U}from"./graphicUtils.js";import{ConvertOptions as E,initFastSymbolUpdatesState as R,updateFastSymbolUpdatesState as B,getSizeAttributeValue as L,getAttributeValue as G}from"../support/FastSymbolUpdates.js";import{SamplePosition as O}from"../../support/ElevationProvider.js";import{Object3D as k}from"../../webgl-engine/lib/Object3D.js";import{Path as I}from"../../webgl-engine/lib/Path.js";import{PathBuilder as F}from"../../webgl-engine/lib/PathBuilder.js";import{RoundCapBuilder as M,TriangulationCapBuilder as T,NoCapBuilder as q}from"../../webgl-engine/lib/PathCapBuilder.js";import{PathExtruder as H}from"../../webgl-engine/lib/PathExtruder.js";import{PathGeometry as Z,isPathGeometry as J}from"../../webgl-engine/lib/PathGeometry.js";import{computeMinimumRotationTangentFrame as $}from"../../webgl-engine/lib/pathGeometryUtils.js";import{quadProfiles as K,circleProfiles as N}from"../../webgl-engine/lib/PathProfile.js";import{newPathVertex as Q}from"../../webgl-engine/lib/PathVertex.js";import{PathMaterial as W}from"../../webgl-engine/materials/PathMaterial.js";const X=["polyline"];class Y extends A{constructor(e,t,r,i){super(e,t,r,i,P(t)),this._intrinsicSize=c(1,1),this._upVectorAlignment=1,this.ensureDrapedStatus(!1)}_validateGeometry(e,t,r){return!!super._validateGeometry(e,t,r)&&("polyline"===e.type&&(!e.paths.some(e=>e.length>C)||(this.logger.warn(`Geometry has a path longer than ${C} vertices and cannot be displayed by PathSymbol3DLayer`),!1)))}async doLoad(){const e=this.symbolLayer,t=null!=e.width?e.width:e.height,i=null!=e.height?e.height:t;this._vvConvertOptions=new E({supports:{size:!0,color:!0,rotation:!1,opacity:!0},modelSize:[1,1,1],symbolSize:[t,1,i],unitInMeters:this._context.renderCoordsHelper.unitInMeters,fallbackColor:this._getFallbackOpacityAndColor(z),fallbackSize:[t,1,i]});const s=this._context.renderer?.visualVariables;this._fastUpdates=s?.length?R(this._context.renderer,this._vvConvertOptions):null;const a=e.anchor||"center";this._upVectorAlignment="heading"===e.profileRotation?0:1;const o=e.profile||"circle";switch(o){default:case"circle":this._profile=N[a];break;case"quad":this._profile=K[a]}switch(e.join){case"round":this._extruder=new H(2);break;default:case"bevel":this._extruder=new H(1);break;case"miter":this._extruder=new H(0)}switch(this._cap){case"none":this._capBuilder=new q;break;case"butt":default:this._capBuilder=new T(this._profile,1);break;case"square":this._capBuilder=new T(this._profile,2);break;case"round":{const e="quad"===o;this._capBuilder=new M(this._profile,e);break}}const h=this._materialColor,c=this._getCombinedOpacityAndColor(h),m=u(c),d=c[3],f=this.needsDrivenTransparentPass,g=e.material?.emissive,_={diffuse:m,ambient:m,emissiveStrengthFromSymbol:("color"===g?.source?g?.strength:void 0)??0,emissiveSource:1,opacity:d,drivenOpacity:f,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows};if(!this._drivenProperties.size&&(n(this._intrinsicSize,t,i),!U(this._intrinsicSize[0])||!U(this._intrinsicSize[1])))throw new r("graphics3dpathsymbollayer:invalid-size","Symbol sizes may not be negative values");this._fastUpdates?.visualVariables.size||l(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters);const y=null!=this._fastUpdates,b=new W({..._,...this._fastUpdates?.materialParameters,size:p(this._intrinsicSize),upVectorAlignment:this._upVectorAlignment,profile:this._profile,pathCapType:this._capBuilder.type,cutoffAngle:this._extruder.cutoffAngle,pathJoinType:this._extruder.join,hasPathColor:!y&&this._drivenProperties.color,hasPathOpacity:!y&&this._drivenProperties.opacity&&!this._drivenProperties.color,hasPathSize:!y&&this._drivenProperties.size,usePBR:this._context.physicalBasedRenderingEnabled},this._context);this._materials[0]=b,this._updateTransparentDepedentMaterialParameters()}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,X,this.symbolLayer.type))return null;const r=this.createElevationContextForGraphic(t);return this._createAs3DShape(e,r)}layerOpacityChanged(){const e=this._materialColor,t=this._getCombinedOpacity(e),r=this._materials[0];r&&(r.setParameters({opacity:t}),this._updateTransparentDepedentMaterialParameters())}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,S)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return this._materials[0]?.setParameters({usePBR:this._context.physicalBasedRenderingEnabled}),!0}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!B(this._fastUpdates,t,this._vvConvertOptions))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}_getVertexData(r){let i=0;const s=r.paths,a=[],o=r.spatialReference,n=this._context.elevationProvider.spatialReference,l=this._context.renderCoordsHelper.spatialReference,h=w(r.hasZ),c=s.map(r=>{const i={stack:[],error:void 0,hasError:!1};try{const t=oe;e(i,ne,!1);for(let e=1;e<r.length;++e)h(r[e],r[e-1])&&t.add(e);return 0===t.size?r:r.filter((e,r)=>!t.has(r))}catch(s){i.error=s,i.hasError=!0}finally{t(i)}});for(const e of c)i+=e.length;const p=b(3*i);let m,u=0;for(const e of c){a.push({offset:u,numVertices:e.length});for(const t of e)p[u++]=t[0],p[u++]=t[1],p[u++]=r.hasZ?t[2]:0}return null==n||o.equals(n)||f(p,o,0,p,n,0,i)?(null==n||n.equals(l)?m=v(p):(m=b(3*i),f(p,n,0,m,l,0,i)),{pathVertexDataInfos:a,vertexDataES:p,vertexDataRS:m}):null}_createAs3DShape(e,t){const{graphic:r,renderingInfo:i}=e,n=r.geometry,l=this._getVertexData(n);if(null==l)return this.logger.warn("PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)"),null;if(0===l.pathVertexDataInfos.length)return 0!==n.paths.length&&n.paths.some(e=>e.length>0)||this.logger.warn("PathSymbol3DLayer geometry failed to be created (no paths were defined)"),null;const h=new Array,c=g(),p=this._context.renderCoordsHelper,u=new O(l.vertexDataES),d=r.uid,f=x(l.vertexDataRS.length);for(const g of l.pathVertexDataInfos){const e=g.numVertices;if(e<2)continue;const r=g.offset;if(null!=this._context.clippingExtent&&(_(l.vertexDataES,r,e,c),!y(c,this._context.clippingExtent)))continue;const n=new Array,b=r+3*e;for(let i=r;i<b;i+=3){u.offset=i;const e=D(u,this._context.elevationProvider,t,p);m(se,l.vertexDataRS[i],l.vertexDataRS[i+1],l.vertexDataRS[i+2]),p.setAltitude(se,e),l.vertexDataRS[i]=se[0],l.vertexDataRS[i+1]=se[1],l.vertexDataRS[i+2]=se[2],n.push(Q(this._upVectorAlignment))}const v=new I(n,l.vertexDataES,l.vertexDataRS,r,f);ee(v,this._upVectorAlignment,this._context.renderCoordsHelper);const x=new F(v,this._profile,this._extruder,this._capBuilder,this._upVectorAlignment),w=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:d,layerViewUid:this._context.layerViewUid}),P=new Z(this._materials[0],x,this._getVisualVariableData(i),w);P.transformation=s(o(),a,x.path.origin),h.push(P)}if(0===h.length)return null;const b=new k({geometries:h,layerViewUid:this._context.layerViewUid,graphicUid:d}),v=new V(this,b,null,(e,t,r,i,s)=>ie(e,t,i,s,this._upVectorAlignment),t,null);return v.alignedSampledElevation=0,v.needsElevationUpdates=S(t.mode),v}_getVisualVariableData(e){if(this._fastUpdates){const{size:t,color:r,opacity:i}=this._fastUpdates.visualVariables;return{sizeAttributeValue:L(t,e.size),colorAttributeValue:G(r,e.color),opacityAttributeValue:G(i,e.opacity)}}return{size:this._getDrivenSize(e),color:this._getDrivenColor(e),opacity:this._getDrivenOpacity(e)}}_getDrivenSize(e){if(!this._drivenProperties.size)return null;const t=e.size?.output??["symbol-value","symbol-value","symbol-value"],r=c(te(t[0],"symbol-value"===t[2]?this.symbolLayer.height||0:t[2],this.symbolLayer.width||0),te(t[2],"symbol-value"===t[0]?this.symbolLayer.width||0:t[0],this.symbolLayer.height||0));return h(r,r,this._intrinsicSize),r}_getDrivenColor(e){return this._drivenProperties.color?this._getDrivenUInt8Color(e,this._materialColor,!1):null}_getDrivenOpacity(e){return this._drivenProperties.opacity&&!this._drivenProperties.color?e.opacity?.output??this._materialColor?.a??0:null}get _materialColor(){return this.symbolLayer.material?.color}_getFallbackOpacityAndColor(e){return this._materialColor?.toUnitRGBA()??e}get _cap(){return this.symbolLayer.cap||"butt"}_updateTransparentDepedentMaterialParameters(){const e=this._materials[0];e&&e.setParameters({cullFace:e.transparent||"none"===this._cap?0:2})}}function ee(e,t,r){const{origin:i,positions:s}=e;let a=e.offset;switch(t){default:case 0:for(const t of e.vertices)se[0]=s[a++]+i[0],se[1]=s[a++]+i[1],se[2]=s[a++]+i[2],r.worldUpAtPosition(se,se),t.setFrameFromUpVector(se);break;case 1:se[0]=s[a]+i[0],se[1]=s[a+1]+i[1],se[2]=s[a+2]+i[2],r.worldUpAtPosition(se,se),$(e,se)}}function te(e,t,r){switch(e){case"symbol-value":return r;case"proportional":return t;default:return e}}function re(e,t,r,i){let s=0;const{origin:a,vertices:o,positions:n,positionsES:l}=e,h=e.offset+3*o.length;for(let c=e.offset;c<h;c+=3)m(se,l[c],l[c+1],l[c+2]),r(se,ae),s+=ae.sampledElevation,se[0]=n[c]+a[0],se[1]=n[c+1]+a[1],se[2]=n[c+2]+a[2],i.setAltitude(se,ae.z),n[c]=se[0]-a[0],n[c+1]=se[1]-a[1],n[c+2]=se[2]-a[2];return e.updatePathVertexInformation(),s/o.length}function ie(e,t,r,i,s){const a=e.stageObject,o=a.geometries;let n=0;for(const l of o){if(!J(l))continue;const e=l.builder.path;n+=re(e,t,r,i),0!==s&&ee(e,s,i),l.onPathChanged(),a.geometryVertexAttributeUpdated(l,"position")}return n/o.length}const se=d(),ae=new j,oe=new Set,ne=i({remove:()=>oe.clear()});export{Y as Graphics3DPathSymbolLayer};
|
|
2
|
+
import{__addDisposableResource as e,__disposeResources as t}from"tslib";import r from"../../../../core/Error.js";import{disposable as i}from"../../../../core/handleUtils.js";import{translate as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as a,create as o}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,scale as l,multiply as h}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as c,fromArray as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as m}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromArray as u,create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBuffer as f}from"../../../../geometry/projection/projectBuffer.js";import{create as g,fromSubBuffer as _,intersectsClippingArea as y}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as b,doubleArrayFrom as v}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as x}from"../../../../geometry/support/FloatArray.js";import{getCoordinateEquals as w}from"../../../../geometry/support/geometryUtils.js";import{isDrivenOpacityFallbackAlwaysOpaque as P}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{needsElevationUpdates3D as S,evaluateElevationAlignmentAtPoint as D,SampleElevationInfo as j}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as V}from"./Graphics3DObject3DGraphicLayer.js";import{maxPathLength as C}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as A,nanFallbackColor as z}from"./Graphics3DSymbolLayer.js";import{isValidSize as U}from"./graphicUtils.js";import{ConvertOptions as E,initFastSymbolUpdatesState as R,updateFastSymbolUpdatesState as B,getSizeAttributeValue as L,getAttributeValue as G}from"../support/FastSymbolUpdates.js";import{SamplePosition as O}from"../../support/ElevationProvider.js";import{Object3D as k}from"../../webgl-engine/lib/Object3D.js";import{Path as I}from"../../webgl-engine/lib/Path.js";import{PathBuilder as F}from"../../webgl-engine/lib/PathBuilder.js";import{RoundCapBuilder as M,TriangulationCapBuilder as T,NoCapBuilder as q}from"../../webgl-engine/lib/PathCapBuilder.js";import{PathExtruder as H}from"../../webgl-engine/lib/PathExtruder.js";import{PathGeometry as Z,isPathGeometry as J}from"../../webgl-engine/lib/PathGeometry.js";import{computeMinimumRotationTangentFrame as $}from"../../webgl-engine/lib/pathGeometryUtils.js";import{quadProfiles as K,circleProfiles as N}from"../../webgl-engine/lib/PathProfile.js";import{newPathVertex as Q}from"../../webgl-engine/lib/PathVertex.js";import{PathMaterial as W}from"../../webgl-engine/materials/PathMaterial.js";const X=["polyline"];class Y extends A{constructor(e,t,r,i){super(e,t,r,i,P(t)),this._intrinsicSize=c(1,1),this._upVectorAlignment=1,this.ensureDrapedStatus(!1)}_validateGeometry(e,t,r){return!!super._validateGeometry(e,t,r)&&("polyline"===e.type&&(!e.paths.some(e=>e.length>C)||(this.logger.warn(`Geometry has a path longer than ${C} vertices and cannot be displayed by PathSymbol3DLayer`),!1)))}async doLoad(){const e=this.symbolLayer,t=null!=e.width?e.width:e.height,i=null!=e.height?e.height:t;this._vvConvertOptions=new E({supports:{size:!0,color:!0,rotation:!1,opacity:!0},modelSize:[1,1,1],symbolSize:[t,1,i],unitInMeters:this._context.renderCoordsHelper.unitInMeters,fallbackColor:this._getFallbackOpacityAndColor(z),fallbackSize:[t,1,i]});const s=this._context.renderer?.visualVariables;this._fastUpdates=s?.length?R(this._context.renderer,this._vvConvertOptions):null;const a=e.anchor||"center";this._upVectorAlignment="heading"===e.profileRotation?0:1;const o=e.profile||"circle";switch(o){default:case"circle":this._profile=N[a];break;case"quad":this._profile=K[a]}switch(e.join){case"round":this._extruder=new H(2);break;default:case"bevel":this._extruder=new H(1);break;case"miter":this._extruder=new H(0)}switch(this._cap){case"none":this._capBuilder=new q;break;case"butt":default:this._capBuilder=new T(this._profile,1);break;case"square":this._capBuilder=new T(this._profile,2);break;case"round":{const e="quad"===o;this._capBuilder=new M(this._profile,e);break}}const h=this._materialColor,c=this._getCombinedOpacityAndColor(h),m=u(c),d=c[3],f=this.needsDrivenTransparentPass,g=e.material?.emissive,_={diffuse:m,ambient:m,emissiveStrength:("color"===g?.source?g?.strength:void 0)??0,emissiveSource:1,opacity:d,drivenOpacity:f,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows};if(!this._drivenProperties.size&&(n(this._intrinsicSize,t,i),!U(this._intrinsicSize[0])||!U(this._intrinsicSize[1])))throw new r("graphics3dpathsymbollayer:invalid-size","Symbol sizes may not be negative values");this._fastUpdates?.visualVariables.size||l(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters);const y=null!=this._fastUpdates,b=new W({..._,...this._fastUpdates?.materialParameters,size:p(this._intrinsicSize),upVectorAlignment:this._upVectorAlignment,profile:this._profile,pathCapType:this._capBuilder.type,cutoffAngle:this._extruder.cutoffAngle,pathJoinType:this._extruder.join,hasPathColor:!y&&this._drivenProperties.color,hasPathOpacity:!y&&this._drivenProperties.opacity&&!this._drivenProperties.color,hasPathSize:!y&&this._drivenProperties.size,usePBR:this._context.physicalBasedRenderingEnabled},this._context);this._materials[0]=b,this._updateTransparentDepedentMaterialParameters()}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,X,this.symbolLayer.type))return null;const r=this.createElevationContextForGraphic(t);return this._createAs3DShape(e,r)}layerOpacityChanged(){const e=this._materialColor,t=this._getCombinedOpacity(e),r=this._materials[0];r&&(r.setParameters({opacity:t}),this._updateTransparentDepedentMaterialParameters())}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,S)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return this._materials[0]?.setParameters({usePBR:this._context.physicalBasedRenderingEnabled}),!0}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!B(this._fastUpdates,t,this._vvConvertOptions))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}_getVertexData(r){let i=0;const s=r.paths,a=[],o=r.spatialReference,n=this._context.elevationProvider.spatialReference,l=this._context.renderCoordsHelper.spatialReference,h=w(r.hasZ),c=s.map(r=>{const i={stack:[],error:void 0,hasError:!1};try{const t=oe;e(i,ne,!1);for(let e=1;e<r.length;++e)h(r[e],r[e-1])&&t.add(e);return 0===t.size?r:r.filter((e,r)=>!t.has(r))}catch(s){i.error=s,i.hasError=!0}finally{t(i)}});for(const e of c)i+=e.length;const p=b(3*i);let m,u=0;for(const e of c){a.push({offset:u,numVertices:e.length});for(const t of e)p[u++]=t[0],p[u++]=t[1],p[u++]=r.hasZ?t[2]:0}return null==n||o.equals(n)||f(p,o,0,p,n,0,i)?(null==n||n.equals(l)?m=v(p):(m=b(3*i),f(p,n,0,m,l,0,i)),{pathVertexDataInfos:a,vertexDataES:p,vertexDataRS:m}):null}_createAs3DShape(e,t){const{graphic:r,renderingInfo:i}=e,n=r.geometry,l=this._getVertexData(n);if(null==l)return this.logger.warn("PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)"),null;if(0===l.pathVertexDataInfos.length)return 0!==n.paths.length&&n.paths.some(e=>e.length>0)||this.logger.warn("PathSymbol3DLayer geometry failed to be created (no paths were defined)"),null;const h=new Array,c=g(),p=this._context.renderCoordsHelper,u=new O(l.vertexDataES),d=r.uid,f=x(l.vertexDataRS.length);for(const g of l.pathVertexDataInfos){const e=g.numVertices;if(e<2)continue;const r=g.offset;if(null!=this._context.clippingExtent&&(_(l.vertexDataES,r,e,c),!y(c,this._context.clippingExtent)))continue;const n=new Array,b=r+3*e;for(let i=r;i<b;i+=3){u.offset=i;const e=D(u,this._context.elevationProvider,t,p);m(se,l.vertexDataRS[i],l.vertexDataRS[i+1],l.vertexDataRS[i+2]),p.setAltitude(se,e),l.vertexDataRS[i]=se[0],l.vertexDataRS[i+1]=se[1],l.vertexDataRS[i+2]=se[2],n.push(Q(this._upVectorAlignment))}const v=new I(n,l.vertexDataES,l.vertexDataRS,r,f);ee(v,this._upVectorAlignment,this._context.renderCoordsHelper);const x=new F(v,this._profile,this._extruder,this._capBuilder,this._upVectorAlignment),w=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:d,layerViewUid:this._context.layerViewUid}),P=new Z(this._materials[0],x,this._getVisualVariableData(i),w);P.transformation=s(o(),a,x.path.origin),h.push(P)}if(0===h.length)return null;const b=new k({geometries:h,layerViewUid:this._context.layerViewUid,graphicUid:d}),v=new V(this,b,null,(e,t,r,i,s)=>ie(e,t,i,s,this._upVectorAlignment),t,null);return v.alignedSampledElevation=0,v.needsElevationUpdates=S(t.mode),v}_getVisualVariableData(e){if(this._fastUpdates){const{size:t,color:r,opacity:i}=this._fastUpdates.visualVariables;return{sizeAttributeValue:L(t,e.size),colorAttributeValue:G(r,e.color),opacityAttributeValue:G(i,e.opacity)}}return{size:this._getDrivenSize(e),color:this._getDrivenColor(e),opacity:this._getDrivenOpacity(e)}}_getDrivenSize(e){if(!this._drivenProperties.size)return null;const t=e.size?.output??["symbol-value","symbol-value","symbol-value"],r=c(te(t[0],"symbol-value"===t[2]?this.symbolLayer.height||0:t[2],this.symbolLayer.width||0),te(t[2],"symbol-value"===t[0]?this.symbolLayer.width||0:t[0],this.symbolLayer.height||0));return h(r,r,this._intrinsicSize),r}_getDrivenColor(e){return this._drivenProperties.color?this._getDrivenUInt8Color(e,this._materialColor,!1):null}_getDrivenOpacity(e){return this._drivenProperties.opacity&&!this._drivenProperties.color?e.opacity?.output??this._materialColor?.a??0:null}get _materialColor(){return this.symbolLayer.material?.color}_getFallbackOpacityAndColor(e){return this._materialColor?.toUnitRGBA()??e}get _cap(){return this.symbolLayer.cap||"butt"}_updateTransparentDepedentMaterialParameters(){const e=this._materials[0];e&&e.setParameters({cullFace:e.transparent||"none"===this._cap?0:2})}}function ee(e,t,r){const{origin:i,positions:s}=e;let a=e.offset;switch(t){default:case 0:for(const t of e.vertices)se[0]=s[a++]+i[0],se[1]=s[a++]+i[1],se[2]=s[a++]+i[2],r.worldUpAtPosition(se,se),t.setFrameFromUpVector(se);break;case 1:se[0]=s[a]+i[0],se[1]=s[a+1]+i[1],se[2]=s[a+2]+i[2],r.worldUpAtPosition(se,se),$(e,se)}}function te(e,t,r){switch(e){case"symbol-value":return r;case"proportional":return t;default:return e}}function re(e,t,r,i){let s=0;const{origin:a,vertices:o,positions:n,positionsES:l}=e,h=e.offset+3*o.length;for(let c=e.offset;c<h;c+=3)m(se,l[c],l[c+1],l[c+2]),r(se,ae),s+=ae.sampledElevation,se[0]=n[c]+a[0],se[1]=n[c+1]+a[1],se[2]=n[c+2]+a[2],i.setAltitude(se,ae.z),n[c]=se[0]-a[0],n[c+1]=se[1]-a[1],n[c+2]=se[2]-a[2];return e.updatePathVertexInformation(),s/o.length}function ie(e,t,r,i,s){const a=e.stageObject,o=a.geometries;let n=0;for(const l of o){if(!J(l))continue;const e=l.builder.path;n+=re(e,t,r,i),0!==s&&ee(e,s,i),l.onPathChanged(),a.geometryVertexAttributeUpdated(l,"position")}return n/o.length}const se=d(),ae=new j,oe=new Set,ne=i({remove:()=>oe.clear()});export{Y as Graphics3DPathSymbolLayer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import{clamp as e,acosClamped as i,deg2rad as a}from"../../../../core/mathUtils.js";import{property as r,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{translate as o,rotate as s,identity as c}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{subtract as m,transformMat4 as h,add as p,scale as d,copy as u,negate as _,length as f,set as v,normalize as g,cross as C,distance as y,direction as w,dot as b}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as O}from"../../../../geometry/ellipsoidUtils.js";import{wrap as x}from"../../../../geometry/support/ray.js";import{Sphere as M}from"../../../../geometry/support/sphere.js";import{angle as j}from"../../../../geometry/support/vector.js";import{sv3d as z}from"../../../../geometry/support/vectorStacks.js";import{applyAll as T}from"../../camera/constraintUtils.js";import{ConstraintOptions as E}from"../../camera/constraintUtils/ConstraintOptions.js";import{TiltRange as A}from"../Constraints.js";import{InteractiveController as P}from"./InteractiveController.js";import{panMotionToRotationMatrix as D,onSurfaceTiltToEyeTiltGlobal as R,offSurfaceTiltToEyeTiltGlobal as H}from"../utils/navigationUtils.js";import{viewAngle as U}from"../utils/viewUtils.js";import{headingTiltToDirectionUp as k}from"../../support/cameraUtils.js";import{createDirectionUp as F}from"../../support/cameraUtilsInternal.js";import G from"../../webgl/RenderCamera.js";import{extractTransformation as B,isZeroTransformation as I,extractTransformationKeyboard as V}from"../../../navigation/gamepadAndKeyboardUtils.js";let L=class extends P{constructor(t){super(t),this._filteredSurfaceElevation=0,this._precisionPanEnabled=!1,this._transformation={translation:[0,0,0],heading:0,tilt:0,zoom:0},this._keysButtonState=[0,0,0,0,0,0,0,0,0,0,0,0],this._tmpCamera=new G,this._headingStart=0,this._constraintOptions=new E(15,0,0,new G,null,1)}handleEventGamepad(t){const e=B(t,this.view.navigation.gamepad,this._transformation);("end"===t.action||I(e))&&this.finishController()}activateDirection(t){this._keysButtonState[t]=1,V(this._keysButtonState,this._transformation)}directionActive(t){return 1===this._keysButtonState[t]}countActiveDirections(){return this._keysButtonState.reduce((t,e)=>e>0?t+1:t,0)}deactivateDirection(t){this._keysButtonState[t]=0;const e=V(this._keysButtonState,this._transformation);I(e)&&(this._precisionPanEnabled=!1,this.finishController())}setPrecisionPanEnabled(t){this._precisionPanEnabled=t}onControllerStart(t){this._filteredSurfaceElevation=this.view.pointsOfInterest.cameraOnSurface.location.z,this._headingStart=this.view.camera.heading,super.onControllerStart(t)}_updateFilteredSurfaceElevation(t){const e=this.view.pointsOfInterest.cameraOnSurface.location.z,i=1;this._filteredSurfaceElevation+=i*(e-this._filteredSurfaceElevation)*t}stepController(t,e){this._updateStartHeading(),this._updateFilteredSurfaceElevation(t),this.currentCamera.copyViewFrom(e),this._updateCameraCenter(),this._constraintOptions.interactionStartCamera?.copyFrom(this.currentCamera),this._calculateControlTransformation(t,this.currentCamera,Y),this._applyDisabledMovementTypes(Y),this._applyPan(Y.pan),this._applyRotate(Y.rotate),this._applyZoom(Y.zoom),this._applyAscend(Y.ascend),this._constraintOptions.interactionType=0,this._constraintOptions.selection=8,T(this.view,this.currentCamera,this._constraintOptions),super.stepController(t,e)}_updateStartHeading(){0!==this._transformation.heading&&(this._headingStart=this.view.camera.heading)}_applyRotate(t){if(!t.enabled)return;const e=this.currentCamera;m($,e.center,e.eye),h($,$,t.matrix),e.center=p($,$,e.eye),e.up=h($,e.up,t.matrix),this._constraintOptions.interactionType=3,this._constraintOptions.selection=7,T(this.view,e,this._constraintOptions)}_applyPan(t,e=this.currentCamera){if(!t.enabled)return;e.eye=h($,e.eye,t.matrix),e.center=h($,e.center,t.matrix);this.view.state.isGlobal&&(e.up=h($,e.up,t.matrix)),this._constraintOptions.interactionType=4,this._constraintOptions.selection=15,T(this.view,e,this._constraintOptions)}_applyZoom(t){if(!t)return;const e=this.currentCamera.viewForward;this.currentCamera.eye=p($,this.currentCamera.eye,d(z.get(),e,t)),u(tt,e),_(tt,tt),this._constraintOptions.interactionDirection=tt,this._constraintOptions.interactionType=1,this._constraintOptions.selection=7,T(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_applyAscend(t){if(!t)return;const e=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,z.get());this._constraintOptions.interactionDirection=u(tt,e);if(this.view.state.isGlobal){const e=f(this.currentCamera.eye),i=(e+t)/e;this.currentCamera.eye=d($,this.currentCamera.eye,i),this.currentCamera.center=d($,this.currentCamera.center,i)}else{const i=d(z.get(),e,t);this.currentCamera.eye=p($,this.currentCamera.eye,i),this.currentCamera.center=p($,this.currentCamera.center,i)}this._updateCameraCenter(),this._constraintOptions.interactionType=5,this._constraintOptions.selection=8,T(this.view,this.currentCamera,this._constraintOptions)&&this._updateCameraCenter(),this._constraintOptions.selection=7,T(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_calculateControlTransformation(t,e,i){at(i);const a=this._computeVelocities(t);this.view.state.isLocal?this._calculateControlTransformationLocal(a,e,i):this._calculateControlTransformationGlobal(a,e,i)}_updateCameraCenter(){const t=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,e=this.view.renderCoordsHelper,i=this.currentCamera.ray;this.currentCamera.center=e.intersectManifoldClosestSilhouette(i,t,$)}_calculateControlTransformationLocal(t,i,a){const{viewRight:r,viewForward:n}=i,c=this._transformation,l=this.view.navigation.gamepad,m=v(z.get(),n[0],n[1],0);g(m,m);const h=c.translation[0]*t.pan;if(0!==h){const t=d(z.get(),r,h);o(a.pan.matrix,a.pan.matrix,t),a.pan.enabled=!0}switch(l.mode){case"pan":{const e=-c.translation[1]*t.pan;if(0!==e){const t=d(z.get(),m,e);o(a.pan.matrix,a.pan.matrix,t),a.pan.enabled=!0}a.zoom=c.zoom*t.zoom;break}case"zoom":a.zoom=(-c.translation[1]+c.zoom)*t.zoom;break;default:l.mode}const p=c.translation[2]*t.ascend;a.ascend=p;const u=-c.heading*t.rotate;0!==u&&(s(a.rotate.matrix,a.rotate.matrix,u,this.view.renderCoordsHelper.worldUpAtPosition(i.eye,z.get())),a.rotate.enabled=!0);const _=c.tilt*t.rotate,f=U(this.view.renderCoordsHelper,i.center,i.eye),C=e(f+_,A.min,A.max)-f;C&&(s(a.rotate.matrix,a.rotate.matrix,C,r),a.rotate.enabled=!0)}_calculateControlTransformationGlobal(t,e,i){const{eye:a,viewRight:r}=e,n=this._transformation,o=this.view.navigation.gamepad,c=C(z.get(),r,a);g(c,c),_(c,c),D(this.startCamera,e,n,t,this.view.camera.heading,this._headingStart,this.view.camera.tilt,i,o),this._tmpCamera.copyFrom(this.currentCamera),this._applyPan(Y.pan,this._tmpCamera);const l=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,m=n.translation[2]*t.ascend;i.ascend=m;const h=-n.heading*t.rotate;0!==h&&(s(i.rotate.matrix,i.rotate.matrix,h,this._tmpCamera.eye),i.rotate.enabled=!0);const p=n.tilt*t.rotate,d=this._clampTiltDeltaGlobalToValidRange(p,e.ray,l);0!==d&&(s(i.rotate.matrix,i.rotate.matrix,d,this._tmpCamera.viewRight),i.rotate.enabled=!0),i.zoom+=n.zoom*t.zoom}_clampTiltDeltaGlobalToValidRange(t,i,a){const r=O(this.view.spatialReference),n=R(A.min,i.origin,a,r);let o=0,s=0;const c=z.get();if(this.view.renderCoordsHelper.intersectManifold(i,a,c)){const t=U(this.view.renderCoordsHelper,c,i.origin);o=R(t,i.origin,a,r),s=R(A.max,i.origin,a,r)}else{it.radius=a+r.radius,it.closestPointOnSilhouette(i,c);const t=Math.PI+j(i.direction,c);o=H(t,i.origin,a,r),s=H(A.max,i.origin,a,r)}return e(o+t,n,s)-o}_getPointAbsoluteSurfaceElevation(t,e,i){const{renderCoordsHelper:a}=this.view,r=a.getAltitude(t),n=e+Math.abs(r-e);return a.setAltitude(i,n,t),n}_clampedDistanceToSurface(t,e){const{renderCoordsHelper:i}=this.view,{camera:a}=this.view.state,{direction:r}=k(this.view,e,0,K,et),n=i.intersectManifoldClosestSilhouette(x(e,r),t,z.get()),o=y(e,n),s=i.intersectManifoldClosestSilhouette(x(e,w(z.get(),e,a.center)),t,z.get()),c=y(e,s);return Math.min(o,c)}_computeHeadingRotateRadius(t){const{renderCoordsHelper:e,state:a}=this.view,{camera:r,isGlobal:n}=a,o=e.intersectManifoldClosestSilhouette(r.ray,this._filteredSurfaceElevation,z.get());if(n){const e=m(z.get(),t,o),a=f(e);d(e,e,1/a);const r=g(z.get(),t),n=i(b(r,e));return a*Math.sin(Math.min(Z,n))}{const i=u(z.get(),t);return e.setAltitude(i,this._filteredSurfaceElevation),y(o,i)}}_minimumAscendVelocity(){return this.view.state.constraints.collision.enabled?0:N}_computeVelocities(t){const i=this._filteredSurfaceElevation,a=i+O(this.view.spatialReference).radius,{camera:r,isGlobal:n}=this.view.state,o=z.get(),s=this._getPointAbsoluteSurfaceElevation(r.eye,i,o),c=this._clampedDistanceToSurface(i,o),l=r.width/2,m=X*r.width,h=X*r.width,p=c*Math.tan(.5*r.fovX)/l,d=p/a,u=p/this._computeHeadingRotateRadius(o),_=s-i;return{pan:(n?d:p)*m*t*(this._precisionPanEnabled?J:1),ascend:Math.max(this._minimumAscendVelocity()*t,2**(m*t/l)*_-_),zoom:2**(m*t/l)*c-c,rotate:e(u*h,Q,W)*t}}_applyDisabledMovementTypes(t){null==this.disableMovements||void 0!==this.disableMovements.mode&&this.view.state.viewingMode!==this.disableMovements.mode||(t.zoom=this.disableMovements.zoom?0:t.zoom,t.ascend=this.disableMovements.ascend?0:t.ascend,t.pan.enabled=!this.disableMovements.pan,this.disableMovements.pan&&c(t.pan.matrix),t.rotate.enabled=!this.disableMovements.rotate,this.disableMovements.rotate&&c(t.rotate.matrix))}static activatesFor(t,e){const i=B(e,t.navigation.gamepad,q);return!("end"===e.action||I(i))}};t([r({constructOnly:!0})],L.prototype,"gamepadDevice",void 0),t([r({constructOnly:!0})],L.prototype,"disableMovements",void 0),L=t([n("esri.views.3d.state.controllers.GamepadKeyboardController")],L);const q={translation:[0,0,0],heading:0,tilt:0,zoom:0},K=80,Z=a(K),X=.75,J=.25,N=5,Q=a(30),W=a(80),Y={zoom:0,ascend:0,pan:{enabled:!1,matrix:l()},rotate:{enabled:!1,matrix:l()}},$=S(),tt=S(),et=F(),it=new M;function at(t){t.zoom=0,t.ascend=0,t.pan.enabled=!1,c(t.pan.matrix),t.rotate.enabled=!1,c(t.rotate.matrix)}export{L as GamepadKeyboardController};
|
|
2
|
+
import{__decorate as t}from"tslib";import{clamp as e,acosClamped as i,deg2rad as a}from"../../../../core/mathUtils.js";import{property as r,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{translate as o,rotate as s,identity as c}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{subtract as m,transformMat4 as h,add as p,scale as d,copy as u,negate as _,length as f,set as v,normalize as C,cross as g,distance as y,direction as b,dot as w}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as O}from"../../../../geometry/ellipsoidUtils.js";import{wrap as x}from"../../../../geometry/support/ray.js";import{Sphere as M}from"../../../../geometry/support/sphere.js";import{angle as E}from"../../../../geometry/support/vector.js";import{sv3d as j}from"../../../../geometry/support/vectorStacks.js";import{applyAll as z}from"../../camera/constraintUtils.js";import{ConstraintOptions as P}from"../../camera/constraintUtils/ConstraintOptions.js";import{TiltRange as T}from"../Constraints.js";import{InteractiveController as A}from"./InteractiveController.js";import{panMotionToRotationMatrix as D,onSurfaceTiltToEyeTiltGlobal as R,offSurfaceTiltToEyeTiltGlobal as H}from"../utils/navigationUtils.js";import{viewAngle as U}from"../utils/viewUtils.js";import{headingTiltToDirectionUp as k}from"../../support/cameraUtils.js";import{createDirectionUp as F}from"../../support/cameraUtilsInternal.js";import G from"../../webgl/RenderCamera.js";import{extractTransformation as B,isZeroTransformation as I,extractTransformationKeyboard as V}from"../../../navigation/gamepadAndKeyboardUtils.js";let L=class extends A{constructor(t){super(t),this._filteredSurfaceElevation=0,this._precisionPanEnabled=!1,this._coarsePanEnabled=!1,this._transformation={translation:[0,0,0],heading:0,tilt:0,zoom:0},this._keysButtonState=[0,0,0,0,0,0,0,0,0,0,0,0],this._tmpCamera=new G,this._headingStart=0,this._constraintOptions=new P(15,0,0,new G,null,1)}handleEventGamepad(t){const e=B(t,this.view.navigation.gamepad,this._transformation);("end"===t.action||I(e))&&this.finishController()}activateDirection(t){this._keysButtonState[t]=1,V(this._keysButtonState,this._transformation)}directionActive(t){return 1===this._keysButtonState[t]}countActiveDirections(){return this._keysButtonState.reduce((t,e)=>e>0?t+1:t,0)}deactivateDirection(t){this._keysButtonState[t]=0;const e=V(this._keysButtonState,this._transformation);I(e)&&(this._precisionPanEnabled=!1,this._coarsePanEnabled=!1,this.finishController())}setPrecisionPanEnabled(t){this._precisionPanEnabled=t}setCoarsePanEnabled(t){this._coarsePanEnabled=t}onControllerStart(t){this._filteredSurfaceElevation=this.view.pointsOfInterest.cameraOnSurface.location.z,this._headingStart=this.view.camera.heading,super.onControllerStart(t)}_updateFilteredSurfaceElevation(t){const e=this.view.pointsOfInterest.cameraOnSurface.location.z,i=1;this._filteredSurfaceElevation+=i*(e-this._filteredSurfaceElevation)*t}stepController(t,e){this._updateStartHeading(),this._updateFilteredSurfaceElevation(t),this.currentCamera.copyViewFrom(e),this._updateCameraCenter(),this._constraintOptions.interactionStartCamera?.copyFrom(this.currentCamera),this._calculateControlTransformation(t,this.currentCamera,$),this._applyDisabledMovementTypes($),this._applyPan($.pan),this._applyRotate($.rotate),this._applyZoom($.zoom),this._applyAscend($.ascend),this._constraintOptions.interactionType=0,this._constraintOptions.selection=8,z(this.view,this.currentCamera,this._constraintOptions),super.stepController(t,e)}_updateStartHeading(){0!==this._transformation.heading&&(this._headingStart=this.view.camera.heading)}_applyRotate(t){if(!t.enabled)return;const e=this.currentCamera;m(tt,e.center,e.eye),h(tt,tt,t.matrix),e.center=p(tt,tt,e.eye),e.up=h(tt,e.up,t.matrix),this._constraintOptions.interactionType=3,this._constraintOptions.selection=7,z(this.view,e,this._constraintOptions)}_applyPan(t,e=this.currentCamera){if(!t.enabled)return;e.eye=h(tt,e.eye,t.matrix),e.center=h(tt,e.center,t.matrix);this.view.state.isGlobal&&(e.up=h(tt,e.up,t.matrix)),this._constraintOptions.interactionType=4,this._constraintOptions.selection=15,z(this.view,e,this._constraintOptions)}_applyZoom(t){if(!t)return;const e=this.currentCamera.viewForward;this.currentCamera.eye=p(tt,this.currentCamera.eye,d(j.get(),e,t)),u(et,e),_(et,et),this._constraintOptions.interactionDirection=et,this._constraintOptions.interactionType=1,this._constraintOptions.selection=7,z(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_applyAscend(t){if(!t)return;const e=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,j.get());this._constraintOptions.interactionDirection=u(et,e);if(this.view.state.isGlobal){const e=f(this.currentCamera.eye),i=(e+t)/e;this.currentCamera.eye=d(tt,this.currentCamera.eye,i),this.currentCamera.center=d(tt,this.currentCamera.center,i)}else{const i=d(j.get(),e,t);this.currentCamera.eye=p(tt,this.currentCamera.eye,i),this.currentCamera.center=p(tt,this.currentCamera.center,i)}this._updateCameraCenter(),this._constraintOptions.interactionType=5,this._constraintOptions.selection=8,z(this.view,this.currentCamera,this._constraintOptions)&&this._updateCameraCenter(),this._constraintOptions.selection=7,z(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_calculateControlTransformation(t,e,i){rt(i);const a=this._computeVelocities(t);this.view.state.isLocal?this._calculateControlTransformationLocal(a,e,i):this._calculateControlTransformationGlobal(a,e,i)}_updateCameraCenter(){const t=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,e=this.view.renderCoordsHelper,i=this.currentCamera.ray;this.currentCamera.center=e.intersectManifoldClosestSilhouette(i,t,tt)}_calculateControlTransformationLocal(t,i,a){const{viewRight:r,viewForward:n}=i,c=this._transformation,l=this.view.navigation.gamepad,m=v(j.get(),n[0],n[1],0);C(m,m);const h=c.translation[0]*t.pan;if(0!==h){const t=d(j.get(),r,h);o(a.pan.matrix,a.pan.matrix,t),a.pan.enabled=!0}switch(l.mode){case"pan":{const e=-c.translation[1]*t.pan;if(0!==e){const t=d(j.get(),m,e);o(a.pan.matrix,a.pan.matrix,t),a.pan.enabled=!0}a.zoom=c.zoom*t.zoom;break}case"zoom":a.zoom=(-c.translation[1]+c.zoom)*t.zoom;break;default:l.mode}const p=c.translation[2]*t.ascend;a.ascend=p;const u=-c.heading*t.rotate;0!==u&&(s(a.rotate.matrix,a.rotate.matrix,u,this.view.renderCoordsHelper.worldUpAtPosition(i.eye,j.get())),a.rotate.enabled=!0);const _=c.tilt*t.rotate,f=U(this.view.renderCoordsHelper,i.center,i.eye),g=e(f+_,T.min,T.max)-f;g&&(s(a.rotate.matrix,a.rotate.matrix,g,r),a.rotate.enabled=!0)}_calculateControlTransformationGlobal(t,e,i){const{eye:a,viewRight:r}=e,n=this._transformation,o=this.view.navigation.gamepad,c=g(j.get(),r,a);C(c,c),_(c,c),D(this.startCamera,e,n,t,this.view.camera.heading,this._headingStart,this.view.camera.tilt,i,o),this._tmpCamera.copyFrom(this.currentCamera),this._applyPan($.pan,this._tmpCamera);const l=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,m=n.translation[2]*t.ascend;i.ascend=m;const h=-n.heading*t.rotate;0!==h&&(s(i.rotate.matrix,i.rotate.matrix,h,this._tmpCamera.eye),i.rotate.enabled=!0);const p=n.tilt*t.rotate,d=this._clampTiltDeltaGlobalToValidRange(p,e.ray,l);0!==d&&(s(i.rotate.matrix,i.rotate.matrix,d,this._tmpCamera.viewRight),i.rotate.enabled=!0),i.zoom+=n.zoom*t.zoom}_clampTiltDeltaGlobalToValidRange(t,i,a){const r=O(this.view.spatialReference),n=R(T.min,i.origin,a,r);let o=0,s=0;const c=j.get();if(this.view.renderCoordsHelper.intersectManifold(i,a,c)){const t=U(this.view.renderCoordsHelper,c,i.origin);o=R(t,i.origin,a,r),s=R(T.max,i.origin,a,r)}else{at.radius=a+r.radius,at.closestPointOnSilhouette(i,c);const t=Math.PI+E(i.direction,c);o=H(t,i.origin,a,r),s=H(T.max,i.origin,a,r)}return e(o+t,n,s)-o}_getPointAbsoluteSurfaceElevation(t,e,i){const{renderCoordsHelper:a}=this.view,r=a.getAltitude(t),n=e+Math.abs(r-e);return a.setAltitude(i,n,t),n}_clampedDistanceToSurface(t,e){const{renderCoordsHelper:i}=this.view,{camera:a}=this.view.state,{direction:r}=k(this.view,e,0,K,it),n=i.intersectManifoldClosestSilhouette(x(e,r),t,j.get()),o=y(e,n),s=i.intersectManifoldClosestSilhouette(x(e,b(j.get(),e,a.center)),t,j.get()),c=y(e,s);return Math.min(o,c)}_computeHeadingRotateRadius(t){const{renderCoordsHelper:e,state:a}=this.view,{camera:r,isGlobal:n}=a,o=e.intersectManifoldClosestSilhouette(r.ray,this._filteredSurfaceElevation,j.get());if(n){const e=m(j.get(),t,o),a=f(e);d(e,e,1/a);const r=C(j.get(),t),n=i(w(r,e));return a*Math.sin(Math.min(Z,n))}{const i=u(j.get(),t);return e.setAltitude(i,this._filteredSurfaceElevation),y(o,i)}}_minimumAscendVelocity(){return this.view.state.constraints.collision.enabled?0:Q}_computeVelocities(t){const i=this._filteredSurfaceElevation,a=i+O(this.view.spatialReference).radius,{camera:r,isGlobal:n}=this.view.state,o=j.get(),s=this._getPointAbsoluteSurfaceElevation(r.eye,i,o),c=this._clampedDistanceToSurface(i,o),l=r.width/2,m=X*r.width,h=X*r.width,p=c*Math.tan(.5*r.fovX)/l,d=p/a,u=p/this._computeHeadingRotateRadius(o),_=s-i;return{pan:(n?d:p)*m*t*(this._precisionPanEnabled?J:this._coarsePanEnabled?N:1),ascend:Math.max(this._minimumAscendVelocity()*t,2**(m*t/l)*_-_),zoom:2**(m*t/l)*c-c,rotate:e(u*h,W,Y)*t}}_applyDisabledMovementTypes(t){null==this.disableMovements||void 0!==this.disableMovements.mode&&this.view.state.viewingMode!==this.disableMovements.mode||(t.zoom=this.disableMovements.zoom?0:t.zoom,t.ascend=this.disableMovements.ascend?0:t.ascend,t.pan.enabled=!this.disableMovements.pan,this.disableMovements.pan&&c(t.pan.matrix),t.rotate.enabled=!this.disableMovements.rotate,this.disableMovements.rotate&&c(t.rotate.matrix))}static activatesFor(t,e){const i=B(e,t.navigation.gamepad,q);return!("end"===e.action||I(i))}};t([r({constructOnly:!0})],L.prototype,"gamepadDevice",void 0),t([r({constructOnly:!0})],L.prototype,"disableMovements",void 0),L=t([n("esri.views.3d.state.controllers.GamepadKeyboardController")],L);const q={translation:[0,0,0],heading:0,tilt:0,zoom:0},K=80,Z=a(K),X=.75,J=.25,N=4,Q=5,W=a(30),Y=a(80),$={zoom:0,ascend:0,pan:{enabled:!1,matrix:l()},rotate:{enabled:!1,matrix:l()}},tt=S(),et=S(),it=F(),at=new M;function rt(t){t.zoom=0,t.ascend=0,t.pan.enabled=!1,c(t.pan.matrix),t.rotate.enabled=!1,c(t.rotate.matrix)}export{L as GamepadKeyboardController};
|
|
@@ -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"../../../core/has.js";import i from"../../../core/Logger.js";import{MemCacheStorage as s,MemCache as r}from"../../../core/MemCache.js";import{addFrameTask as a}from"../../../core/scheduling.js";import{Milliseconds as o}from"../../../core/time.js";import{property as h,subclass as
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import"../../../core/has.js";import i from"../../../core/Logger.js";import{MemCacheStorage as s,MemCache as r}from"../../../core/MemCache.js";import{addFrameTask as a}from"../../../core/scheduling.js";import{Milliseconds as o}from"../../../core/time.js";import{property as h,subclass as d}from"../../../core/accessorSupport/decorators.js";import{getLyr3DWasm as y}from"../layers/Lyr3DWasm.js";import{isMemoryManagedView as l}from"./MemoryManagedView.js";import{makeBudget as m}from"../../support/Scheduler.js";function u(e){return new w({view:e})}const n=.1,c=1,_=1,p=.75,M=.6,g=1.3;let w=class extends t{constructor(e){super(e),this._quality=1,this._usedMemory=0,this._updating=!1,this._stableQuality=0,this._downscaleMemoryUsed=0,this._canFastRecover=!1,this._predictedMemory=0,this._cacheStorage=new s,this._warnMemoryUsage=null,this._numQualityChanges=0,this._maxMemory=750,this._additionalCacheMemory=0,this.addHandles(a({prepare:()=>this._updateMemory()}))}destroy(){this._cacheStorage.destroy()}get maxMemory(){return this._maxMemory}set maxMemory(e){null==e||e<=0||(this._stableQuality=0,this._canFastRecover=!1,this._maxMemory<e&&this._updateQuality(c),this._maxMemory=e)}get additionalCacheMemory(){return this._additionalCacheMemory}set additionalCacheMemory(e){null!=e&&(this._additionalCacheMemory=e)}get memoryFactor(){return this._quality}get updating(){return this._updating}get usedMemory(){return this._usedMemory}get usedCacheMemory(){return this._cacheStorage.size}newCache(e,t,i){return new r(e,this._cacheStorage,t,i)}resetStableQuality(){this._stableQuality=0}disableMemCache(){this.additionalCacheMemory=-4096}update(){if(this._predictedMemory<=0&&!this._updating)return;let e=this._layersUpdating();if(this._predictedMemory<M&&this._canFastRecover)this._downscaleMemoryUsed=0,this._stableQuality=0,this._canFastRecover=!1,this._updateQuality(c);else if(e){if(this._predictedMemory>1.1*_||this._usedMemory>_)if(this._stableQuality>0)this._downscaleMemoryUsed=0,this._updateQuality(this._stableQuality);else if(this._quality>n&&this._downscaleMemoryUsed<this._usedMemory){if(this._compactAndUpdate())return;this._updateQuality(this._quality/g),this._downscaleMemoryUsed=this._usedMemory,this._canFastRecover=!1}}else if(this._downscaleMemoryUsed=0,this._usedMemory>_){if(this._compactAndUpdate())return;this._stableQuality=0,this._canFastRecover=!1,e=this._updateQuality(this._quality/g),this._downscaleMemoryUsed=this._predictedMemory}else if(this._stableQuality!==this._quality)if(this._usedMemory<p&&this._quality<c){this._stableQuality=this._quality;const t=.05;e=this._updateQuality(this._quality+t)}else this._quality<1&&(this._canFastRecover=!0);this._updating=e}_compactAndUpdate(){const e=m(o(100)),t=this.view.stage.compact(e);return this.view.overlayManager.renderer.compact(e)||t}_updateQuality(e){return(e=Math.min(Math.max(e,n),c))!==this._quality&&(this._quality=e,++this._numQualityChanges,!0)}_layersUpdating(){return this.view.allLayerViews.some(e=>!!e.updating)}_updateMemory(){if(!this.view?.updating||this.view.destroyed||this.view.destroying)return;this.view.stage?.renderer?.tick();const e=this.view.stage?.renderer?.usedMemory;let t=(this.view.basemapTerrain?.usedMemory??0)+(e?e.fbos+e.edges+e.plugins+e.clouds:0)+this.view.deconflictor?.usedMemory+this.view.labeler?.usedMemory+(y(this.view)?.lyr3DInternalMemoryBytes??0),s=0;this.view.allLayerViews&&this.view.allLayerViews.forEach(e=>{if(l(e)){const i=e.ignoresMemoryFactor?this._quality:1;t+=e.usedMemory*i,s+=e.unloadedMemory*i}});const r=null==this._warnMemoryUsage||Math.round(10*t)!==Math.round(10*this._warnMemoryUsage),a=1048576*this.maxMemory;if(t>a&&r){this._warnMemoryUsage=t;const e=e=>(e/1048576).toLocaleString(void 0,{maximumFractionDigits:1})+" MB",r=Math.round(100*this._quality);i.getLogger(this).warn(`Memory Limit exceeded! Limit: ${e(a)} Current: ${e(t)} Projected: ${e(t+s)} Quality: ${r}%`)}this._usedMemory=t/a,this._predictedMemory=(t+s)/a;const o=a-t;this._cacheStorage.maxSize=Math.max(0,o+1048576*this.additionalCacheMemory)}get test(){}};e([h({constructOnly:!0})],w.prototype,"view",void 0),e([h()],w.prototype,"maxMemory",null),e([h()],w.prototype,"additionalCacheMemory",null),e([h({readOnly:!0})],w.prototype,"memoryFactor",null),e([h({readOnly:!0})],w.prototype,"updating",null),e([h({readOnly:!0})],w.prototype,"usedMemory",null),e([h()],w.prototype,"_quality",void 0),e([h()],w.prototype,"_usedMemory",void 0),e([h()],w.prototype,"_updating",void 0),e([h()],w.prototype,"_stableQuality",void 0),e([h()],w.prototype,"_maxMemory",void 0),e([h()],w.prototype,"_additionalCacheMemory",void 0),w=e([d("esri.views.3d.support.MemoryController")],w);export{n as minQuality,u as newMemoryController};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{abortMaybe as t}from"../../../../core/maybe.js";import{estimateNumberArrayMemory as s}from"../../../../core/memoryEstimations.js";import{isAbortError as i}from"../../../../core/promiseUtils.js";import{signal as r}from"../../../../core/signal.js";import{Milliseconds as o,now as n}from"../../../../core/time.js";import{exactEquals as a,copy as l,normalize as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as d,exactEquals as _,intersects as p,copy as m}from"../../../../geometry/support/aaBoundingBox.js";import{makeScheduleFunction as c}from"../../layers/support/makeScheduleFunction.js";import{SplatSortWorkerInput as g}from"../GaussianSplatSortWorker.js";import{GaussianSplatSortWorkerHandle as T}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatFadeTexture as f}from"./GaussianSplatFadeTexture.js";import{GaussianSplatHeaderTexture as b}from"./GaussianSplatHeaderTexture.js";import{GaussianSplatOrderTexture as y}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as S}from"./GaussianSplatTextureAtlas.js";import{DepthRange as C}from"../../webgl-engine/lib/DepthRange.js";import{TaskPriority as x}from"../../../support/Scheduler.js";class V{constructor(e,t,s){this._updating=r(!1),this._useDeterministicSort=!1,this._sortBufferMemory=0,this._sortWorkerMemory=0,this.visibleGaussians=0,this._visibleTileDepthRange=new C,this._previousVisibleTileDepthRangeEye=u(),this._previousVisibleTileDepthRangeViewForward=u(),this._previousVisibleTileDepthRangeClippingBox=d(),this._latestSortedGaussianTilesVersion=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._previousVisibleTileDepthRangeHasClippingBox=!1,this._sortBufferCapacity=0,this._requestedLyr3dVisibilityChange=0,this._latestCompletedLyr3dVisibilityChange=0,this._latestUpdatedGaussianTiles=new Array,this._latestSortedGaussianTiles=new Array,this._nextCommittedVisibleGaussianTiles=new Array,this._workerResidentTiles=new Map,this._cameraDirectionNormalized=u(),this._frameTask=null,this._workerHandle=null,this._sortAbortController=null,this._isSorting=!1,this._pendingSortTask=!1,this._scheduledSortStartTimeout=null,this._lastSortStartTime=o(-1/0),this._sortInterval=o(80),this._renderer=e,this._onSortComplete=t,this._orderTexture=new y(this._renderer.renderingContext),this._fadingTexture=new f(this._renderer.renderingContext),this._headerTexture=new b(this._renderer.renderingContext),this._textureAtlas=new S(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache,s);const{resourceController:i}=this._renderer.view;this._workerHandle=new T(c(i)),this._frameTask=i.scheduler.registerTask(x.GAUSSIAN_SPLAT_SORTING)}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get fadingTexture(){return this._fadingTexture}get headerTexture(){return this._headerTexture}get textureAtlasMemory(){return this._textureAtlas.usedMemory}get orderTextureMemory(){return this._orderTexture.usedMemory}get fadingTextureMemory(){return this._fadingTexture.usedMemory}get headerTextureMemory(){return this._headerTexture.usedMemory}get sortBufferMemory(){return this._sortBufferMemory}get sortWorkerMemory(){return this._sortWorkerMemory}get usedMemory(){return this.textureAtlasMemory+this.headerTextureMemory+this.orderTextureMemory+this.fadingTextureMemory+this.sortBufferMemory+this.sortWorkerMemory}queryVisibleTileDepthRange(e,t){if(0===this.visibleGaussians)return null;const{eye:s,viewForward:i}=e,r=s[0],o=s[1],n=s[2],h=i[0],u=i[1],d=i[2],c=this._visibleTileDepthRange;if(this._previousVisibleTileDepthRangeTilesVersion===this._latestSortedGaussianTilesVersion&&a(this._previousVisibleTileDepthRangeEye,s)&&a(this._previousVisibleTileDepthRangeViewForward,i)&&(null==t?!this._previousVisibleTileDepthRangeHasClippingBox:this._previousVisibleTileDepthRangeHasClippingBox&&_(this._previousVisibleTileDepthRangeClippingBox,t)))return c.near<=c.far?c:null;let g=1/0,T=-1/0;const f=this._latestSortedGaussianTiles;for(let a=0;a<f.length;a++){const e=f[a];if(null!=t){const s=e.boundingBox;if(!p(s,t))continue}const s=h*(e.obbCenterX-r)+u*(e.obbCenterY-o)+d*(e.obbCenterZ-n),i=e.paddedMbsRadius,l=s-i;l<g&&(g=l);const _=s+i;_>T&&(T=_)}const b=g<=T;return b?c.set(g,T):c.set(1/0,-1/0),this._previousVisibleTileDepthRangeTilesVersion=this._latestSortedGaussianTilesVersion,this._previousVisibleTileDepthRangeHasClippingBox=null!=t,l(this._previousVisibleTileDepthRangeEye,s),l(this._previousVisibleTileDepthRangeViewForward,i),null!=t&&m(this._previousVisibleTileDepthRangeClippingBox,t),b?c:null}updateGaussianVisibility(e,t){this._latestUpdatedGaussianTiles=e,this._requestedLyr3dVisibilityChange=t,this.requestSort()}get updating(){return this._updating.value}destroy(){this._sortAbortController=t(this._sortAbortController),this._pendingSortTask=!1,this._updating.value=!1,null!=this._scheduledSortStartTimeout&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._frameTask.remove(),this._workerHandle?.destroyWorkerAndSelf(),this._sortWorkerMemory=0,this._textureAtlas.destroy(),this._headerTexture.destroy(),this._orderTexture.destroy(),this._fadingTexture.destroy()}requestSort(){this._updating.value=!0,this._pendingSortTask||(this._pendingSortTask=!0,this._scheduleSortStart())}_scheduleSortStart(){if(this._isSorting)return;const e=n()-this._lastSortStartTime,t=this._sortInterval-e;t<=0?this._startSortIfRequired():null==this._scheduledSortStartTimeout&&(this._scheduledSortStartTimeout=setTimeout(()=>{this._scheduledSortStartTimeout=null,this._pendingSortTask&&!this._isSorting&&this._scheduleSortStart()},t))}_startSortIfRequired(){if(this._isSorting||!this._pendingSortTask)return;const e=new AbortController;this._sortAbortController=e,this._isSorting=!0,this._pendingSortTask=!1,this._lastSortStartTime=n(),this._sortOnWorker(e.signal).finally(()=>{this._sortAbortController===e&&(this._sortAbortController=null),this._handleSortComplete()})}_handleSortComplete(){this._isSorting=!1,this._pendingSortTask?this._scheduleSortStart():this._updating.value=!1}_clearBuffersAndTextures(){this._sortedAtlasIndicesBuffer=void 0,this._sortBufferCapacity=0,this._sortBufferMemory=0,this._orderTexture.clear(),this._textureAtlas.clear(),this._headerTexture.clear()}_computeExpandedCapacity(t,s){let i=Math.max(1,t);for(;i<s;)i=Math.ceil(i*e);return i}_ensureSortBufferCapacity(e){if(this._sortBufferCapacity<e){const t=this._computeExpandedCapacity(this._sortBufferCapacity,e);this._sortedAtlasIndicesBuffer=new Uint32Array(t),this._sortBufferMemory=s(this._sortedAtlasIndicesBuffer),this._sortBufferCapacity=t}}_clearAllBuffersAndTextures(){this._clearBuffersAndTextures(),this._latestSortedGaussianTiles.length=0,this._nextCommittedVisibleGaussianTiles.length=0,this._workerResidentTiles.clear(),this._sortWorkerMemory=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._workerHandle?.clear()}async _sortOnWorker(e){try{if(0===this._latestUpdatedGaussianTiles.length)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=this._requestedLyr3dVisibilityChange,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);this._useDeterministicSort&&this._latestUpdatedGaussianTiles.sort((e,t)=>e.obb.centerX-t.obb.centerX||e.obb.centerY-t.obb.centerY||e.obb.centerZ-t.obb.centerZ);const t=this._latestUpdatedGaussianTiles,s=t.length,i=this._requestedLyr3dVisibilityChange;let r=0;for(let e=0;e<s;e++)r+=t[e].gaussianCount;this._ensureSortBufferCapacity(r),this._textureAtlas.ensureTextureAtlas(),this._headerTexture.ensureCapacity(this._textureAtlas.pageAllocator.pageCount);const o=this._renderer.camera;h(this._cameraDirectionNormalized,o.ray.direction);const n=this._cameraDirectionNormalized[0],a=this._cameraDirectionNormalized[1],l=this._cameraDirectionNormalized[2];let u=0;const d=this._renderer.clippingBox,_=this._nextCommittedVisibleGaussianTiles;_.length=0;let m=0;const{frustum:c}=o,T=this._renderer.tileCullingRevision,f=c[0],b=c[1],y=c[2],S=c[3],C=c[4],x=c[5];for(let e=0;e<s;e++){const s=t[e],{obbCenterX:i,obbCenterY:r,obbCenterZ:o,paddedMbsRadius:n}=s,a=s.gaussianCount;if(s.cullingRevision!==T){let e=null==d||p(s.boundingBox,d);if(e){const t=1.5*n;e=f[0]*i+f[1]*r+f[2]*o+f[3]<t&&b[0]*i+b[1]*r+b[2]*o+b[3]<t&&y[0]*i+y[1]*r+y[2]*o+y[3]<t&&S[0]*i+S[1]*r+S[2]*o+S[3]<t&&C[0]*i+C[1]*r+C[2]*o+C[3]<t&&x[0]*i+x[1]*r+x[2]*o+x[3]<t}s.cullingRevision=T,s.cullingVisible=e}s.cullingVisible&&(_[m++]=s,u+=a)}if(_.length=m,0===u)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=i,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);const V=new Map,A=[],v=new Uint32Array(m);for(let e=0;e<m;e++){const t=_[e],s=t.handle;V.set(s,t),v[e]=s,this._workerResidentTiles.get(s)!==t&&A.push({handle:s,relativePositions:t.relativePositions,pageIds:t.pageIds,gaussianCount:t.gaussianCount,originX:t.obbCenterX,originY:t.obbCenterY,originZ:t.obbCenterZ})}const w=[];for(const e of this._workerResidentTiles.keys())V.has(e)||w.push(e);const k=new g(A,Uint32Array.from(w),v,this._sortedAtlasIndicesBuffer,u,n,a,l,this._useDeterministicSort),R=await(this._workerHandle?.sort(k,e));if(e.aborted)return;R&&(this._sortedAtlasIndicesBuffer=R.sortedAtlasIndices,this._sortWorkerMemory=R.usedMemory,this._workerResidentTiles=V);const B=async e=>{this._orderTexture.setData(this._sortedAtlasIndicesBuffer,u);const t=this._latestSortedGaussianTiles;this._latestSortedGaussianTiles=_,this._nextCommittedVisibleGaussianTiles=t,this._latestSortedGaussianTilesVersion++,this._latestCompletedLyr3dVisibilityChange=i,this.visibleGaussians=u,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1),e.madeProgress()};await this._frameTask.schedule(B,e)}catch(t){if(i(t))return}}set useDeterministicSort(e){this._useDeterministicSort=e}}export{V as GaussianSplatDataStore};
|
|
2
|
+
import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{abortMaybe as t}from"../../../../core/maybe.js";import{estimateNumberArrayMemory as s}from"../../../../core/memoryEstimations.js";import{isAbortError as i}from"../../../../core/promiseUtils.js";import{signal as r}from"../../../../core/signal.js";import{Milliseconds as o,now as n}from"../../../../core/time.js";import{exactEquals as a,copy as l,normalize as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as d,exactEquals as _,intersects as p,copy as m}from"../../../../geometry/support/aaBoundingBox.js";import{makeScheduleFunction as c}from"../../layers/support/makeScheduleFunction.js";import{SplatSortWorkerInput as g}from"../GaussianSplatSortWorker.js";import{GaussianSplatSortWorkerHandle as T}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatFadeTexture as f}from"./GaussianSplatFadeTexture.js";import{GaussianSplatHeaderTexture as S}from"./GaussianSplatHeaderTexture.js";import{GaussianSplatOrderTexture as b}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as y}from"./GaussianSplatTextureAtlas.js";import{DepthRange as C}from"../../webgl-engine/lib/DepthRange.js";import{TaskPriority as x}from"../../../support/Scheduler.js";class v{constructor(e,t,s){this._updating=r(!1),this._useDeterministicSort=!1,this._sortBufferMemory=0,this._sortWorkerMemory=0,this.visibleGaussians=0,this._visibleTileDepthRange=new C,this._previousVisibleTileDepthRangeEye=u(),this._previousVisibleTileDepthRangeViewForward=u(),this._previousVisibleTileDepthRangeClippingBox=d(),this._latestSortedGaussianTilesVersion=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._previousVisibleTileDepthRangeHasClippingBox=!1,this._sortBufferCapacity=0,this._requestedLyr3dVisibilityChange=0,this._latestCompletedLyr3dVisibilityChange=0,this._latestUpdatedGaussianTiles=new Array,this._latestSortedGaussianTiles=new Array,this._nextCommittedVisibleGaussianTiles=new Array,this._workerResidentTiles=new Map,this._cameraDirectionNormalized=u(),this._frameTask=null,this._workerHandle=null,this._sortAbortController=null,this._isSorting=!1,this._pendingSortReason=null,this._scheduledSortStartTimeout=null,this._lastSortStartTime=o(-1/0),this._viewSortInterval=o(80),this._dataSortInterval=o(160),this._renderer=e,this._onSortComplete=t,this._orderTexture=new b(this._renderer.renderingContext),this._fadingTexture=new f(this._renderer.renderingContext),this._headerTexture=new S(this._renderer.renderingContext),this._textureAtlas=new y(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache,s);const{resourceController:i}=this._renderer.view;this._workerHandle=new T(c(i)),this._frameTask=i.scheduler.registerTask(x.GAUSSIAN_SPLAT_SORTING)}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get fadingTexture(){return this._fadingTexture}get headerTexture(){return this._headerTexture}get textureAtlasMemory(){return this._textureAtlas.usedMemory}get orderTextureMemory(){return this._orderTexture.usedMemory}get fadingTextureMemory(){return this._fadingTexture.usedMemory}get headerTextureMemory(){return this._headerTexture.usedMemory}get sortBufferMemory(){return this._sortBufferMemory}get sortWorkerMemory(){return this._sortWorkerMemory}get usedMemory(){return this.textureAtlasMemory+this.headerTextureMemory+this.orderTextureMemory+this.fadingTextureMemory+this.sortBufferMemory+this.sortWorkerMemory}queryVisibleTileDepthRange(e,t){if(0===this.visibleGaussians)return null;const{eye:s,viewForward:i}=e,r=s[0],o=s[1],n=s[2],h=i[0],u=i[1],d=i[2],c=this._visibleTileDepthRange;if(this._previousVisibleTileDepthRangeTilesVersion===this._latestSortedGaussianTilesVersion&&a(this._previousVisibleTileDepthRangeEye,s)&&a(this._previousVisibleTileDepthRangeViewForward,i)&&(null==t?!this._previousVisibleTileDepthRangeHasClippingBox:this._previousVisibleTileDepthRangeHasClippingBox&&_(this._previousVisibleTileDepthRangeClippingBox,t)))return c.near<=c.far?c:null;let g=1/0,T=-1/0;const f=this._latestSortedGaussianTiles;for(let a=0;a<f.length;a++){const e=f[a];if(null!=t){const s=e.boundingBox;if(!p(s,t))continue}const s=h*(e.obbCenterX-r)+u*(e.obbCenterY-o)+d*(e.obbCenterZ-n),i=e.paddedMbsRadius,l=s-i;l<g&&(g=l);const _=s+i;_>T&&(T=_)}const S=g<=T;return S?c.set(g,T):c.set(1/0,-1/0),this._previousVisibleTileDepthRangeTilesVersion=this._latestSortedGaussianTilesVersion,this._previousVisibleTileDepthRangeHasClippingBox=null!=t,l(this._previousVisibleTileDepthRangeEye,s),l(this._previousVisibleTileDepthRangeViewForward,i),null!=t&&m(this._previousVisibleTileDepthRangeClippingBox,t),S?c:null}updateGaussianVisibility(e,t){this._latestUpdatedGaussianTiles=e,this._requestedLyr3dVisibilityChange=t,this.requestSort("data")}get updating(){return this._updating.value}destroy(){this._sortAbortController=t(this._sortAbortController),this._pendingSortReason=null,this._updating.value=!1,null!=this._scheduledSortStartTimeout&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._frameTask.remove(),this._workerHandle?.destroyWorkerAndSelf(),this._sortWorkerMemory=0,this._textureAtlas.destroy(),this._headerTexture.destroy(),this._orderTexture.destroy(),this._fadingTexture.destroy()}requestSort(e="view"){this._updating.value=!0,"view"!==this._pendingSortReason&&this._pendingSortReason!==e&&(this._pendingSortReason=e,null!=this._scheduledSortStartTimeout&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._scheduleSortStart())}_scheduleSortStart(){if(this._isSorting)return;const e=n()-this._lastSortStartTime,t=("view"===this._pendingSortReason?this._viewSortInterval:this._dataSortInterval)-e;t<=0?this._startSortIfRequired():null==this._scheduledSortStartTimeout&&(this._scheduledSortStartTimeout=setTimeout(()=>{this._scheduledSortStartTimeout=null,null==this._pendingSortReason||this._isSorting||this._scheduleSortStart()},t))}_startSortIfRequired(){if(this._isSorting||null==this._pendingSortReason)return;const e=new AbortController;this._sortAbortController=e,this._isSorting=!0,this._pendingSortReason=null,this._lastSortStartTime=n(),this._sortOnWorker(e.signal).finally(()=>{this._sortAbortController===e&&(this._sortAbortController=null),this._handleSortComplete()})}_handleSortComplete(){this._isSorting=!1,null!=this._pendingSortReason?this._scheduleSortStart():this._updating.value=!1}_clearBuffersAndTextures(){this._sortedAtlasIndicesBuffer=void 0,this._sortBufferCapacity=0,this._sortBufferMemory=0,this._orderTexture.clear(),this._textureAtlas.clear(),this._headerTexture.clear()}_computeExpandedCapacity(t,s){let i=Math.max(1,t);for(;i<s;)i=Math.ceil(i*e);return i}_ensureSortBufferCapacity(e){if(this._sortBufferCapacity<e){const t=this._computeExpandedCapacity(this._sortBufferCapacity,e);this._sortedAtlasIndicesBuffer=new Uint32Array(t),this._sortBufferMemory=s(this._sortedAtlasIndicesBuffer),this._sortBufferCapacity=t}}_clearAllBuffersAndTextures(){this._clearBuffersAndTextures(),this._latestSortedGaussianTiles.length=0,this._nextCommittedVisibleGaussianTiles.length=0,this._workerResidentTiles.clear(),this._sortWorkerMemory=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._workerHandle?.clear()}async _sortOnWorker(e){try{if(0===this._latestUpdatedGaussianTiles.length)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=this._requestedLyr3dVisibilityChange,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);this._useDeterministicSort&&this._latestUpdatedGaussianTiles.sort((e,t)=>e.obb.centerX-t.obb.centerX||e.obb.centerY-t.obb.centerY||e.obb.centerZ-t.obb.centerZ);const t=this._latestUpdatedGaussianTiles,s=t.length,i=this._requestedLyr3dVisibilityChange;let r=0;for(let e=0;e<s;e++)r+=t[e].gaussianCount;this._ensureSortBufferCapacity(r),this._textureAtlas.ensureTextureAtlas(),this._headerTexture.ensureCapacity(this._textureAtlas.pageAllocator.pageCount);const o=this._renderer.camera;h(this._cameraDirectionNormalized,o.ray.direction);const n=this._cameraDirectionNormalized[0],a=this._cameraDirectionNormalized[1],l=this._cameraDirectionNormalized[2];let u=0;const d=this._renderer.clippingBox,_=this._nextCommittedVisibleGaussianTiles;_.length=0;let m=0;const{frustum:c}=o,T=this._renderer.tileCullingRevision,f=c[0],S=c[1],b=c[2],y=c[3],C=c[4],x=c[5];for(let e=0;e<s;e++){const s=t[e],{obbCenterX:i,obbCenterY:r,obbCenterZ:o,paddedMbsRadius:n}=s,a=s.gaussianCount;if(s.cullingRevision!==T){let e=null==d||p(s.boundingBox,d);if(e){const t=1.5*n;e=f[0]*i+f[1]*r+f[2]*o+f[3]<t&&S[0]*i+S[1]*r+S[2]*o+S[3]<t&&b[0]*i+b[1]*r+b[2]*o+b[3]<t&&y[0]*i+y[1]*r+y[2]*o+y[3]<t&&C[0]*i+C[1]*r+C[2]*o+C[3]<t&&x[0]*i+x[1]*r+x[2]*o+x[3]<t}s.cullingRevision=T,s.cullingVisible=e}s.cullingVisible&&(_[m++]=s,u+=a)}if(_.length=m,0===u)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=i,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);const v=new Map,R=[],V=new Uint32Array(m);for(let e=0;e<m;e++){const t=_[e],s=t.handle;v.set(s,t),V[e]=s,this._workerResidentTiles.get(s)!==t&&R.push({handle:s,relativePositions:t.relativePositions,pageIds:t.pageIds,gaussianCount:t.gaussianCount,originX:t.obbCenterX,originY:t.obbCenterY,originZ:t.obbCenterZ})}const A=[];for(const e of this._workerResidentTiles.keys())v.has(e)||A.push(e);const w=new g(R,Uint32Array.from(A),V,this._sortedAtlasIndicesBuffer,u,n,a,l,this._useDeterministicSort),B=await(this._workerHandle?.sort(w,e));if(e.aborted)return;B&&(this._sortedAtlasIndicesBuffer=B.sortedAtlasIndices,this._sortWorkerMemory=B.usedMemory,this._workerResidentTiles=v);const G=async e=>{this._orderTexture.setData(this._sortedAtlasIndicesBuffer,u);const t=this._latestSortedGaussianTiles;this._latestSortedGaussianTiles=_,this._nextCommittedVisibleGaussianTiles=t,this._latestSortedGaussianTilesVersion++,this._latestCompletedLyr3dVisibilityChange=i,this.visibleGaussians=u,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1),e.madeProgress()};await this._frameTask.schedule(G,e)}catch(t){if(i(t))return}}set useDeterministicSort(e){this._useDeterministicSort=e}}export{v as GaussianSplatDataStore};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{invert as e}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{IDENTITY as t,create as r}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{ones as s,clone as o}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{VertexPositionDrawParameters as i}from"../../core/shaderLibrary/attributes/VertexPosition.glsl.js";import{TwoVectorPosition as a}from"../../core/util/TwoVectorPosition.js";class n extends i{constructor(s,o,i){super(),this.baseColorTextureSampler=i,this._componentParameters=h;const{transform:n,toMapSpace:m}=s;this.toMapSpace=m;const l=new a(n.position);switch(this.transformWorldFromModelTL=l.low,this.transformWorldFromModelTH=l.high,s.geometry.parameters.vertexPositionRotationType){case 0:this.transformWorldFromModelRS=t;break;case 1:this.transformWorldFromModelRS=n.rotationScale;break;case 2:this.transformWorldFromModelRS=e(r(),n.rotationScale)??t}this.useENUForGlobalOverlayUV=s.obb.radius<u,this.baseColor=o.baseColor,this.opacity=o.opacity,this.textureAlphaCutoff=o.textureAlphaCutoff,this.mrrFactors=o.mrrFactors,this.emissiveBaseColor=o.emissiveBaseColor,this.baseColorTexture=o.baseColorTexture,this.metallicRoughnessTexture=o.metallicRoughnessTexture,this.normalTexture=o.normalTexture,this.occlusionTexture=o.occlusionTexture,this.emissionTexture=o.emissionTexture;const c=new Float32Array(15);c.set(this.transformWorldFromModelTL,0),c.set(this.transformWorldFromModelTH,3),c.set(this.transformWorldFromModelRS,6),this.transformationFloats=c}destroy(){this.baseColorTexture?.dispose(),this.metallicRoughnessTexture?.dispose(),this.emissionTexture?.dispose(),this.occlusionTexture?.dispose(),this.normalTexture?.dispose()}setTransformationDrawId(e){this.transformationDrawId=e}get texture(){return this.baseColorTexture?.texture}get textureSampler(){return this.baseColorTextureSampler}get textureMetallicRoughness(){return this.metallicRoughnessTexture?.texture}get textureEmissive(){return this.emissionTexture?.texture}get textureOcclusion(){return this.occlusionTexture?.texture}get textureNormal(){return this.normalTexture?.texture}get componentParameters(){return this._componentParameters}get emissiveStrength(){const e=this._componentParameters;return 0===e.componentDataType?e.emissiveStrength:void 0}updateComponentParameters(e,t){this._componentParameters=e,this.textureBackedBuffer=t}get castAnyShadows(){return 2!==this.componentParameters.castShadows}}class m{constructor(e,t,r,s,i){this.castShadows=i,this.componentDataType=0,this.externalColor=o(e),this.externalColorMixMode=t,this.emissiveStrength=r,this.emissiveSource=s}get transparent(){return this.externalColor[3]<1?0:2}get opaqueOverride(){return 3===this.externalColorMixMode&&1===this.externalColor[3]?0:2}get emissiveOverride(){return this.emissiveStrength>0?0:2}get emissiveSourceOverride(){return 1===this.emissiveSource?0:2}}class l{constructor(e,t,r,s,o){this.transparent=e,this.opaqueOverride=t,this.emissiveOverride=r,this.emissiveSourceOverride=s,this.castShadows=o,this.componentDataType=1}}const h=new m(s(),1,
|
|
2
|
+
import{invert as e}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{IDENTITY as t,create as r}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{ones as s,clone as o}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{VertexPositionDrawParameters as i}from"../../core/shaderLibrary/attributes/VertexPosition.glsl.js";import{TwoVectorPosition as a}from"../../core/util/TwoVectorPosition.js";class n extends i{constructor(s,o,i){super(),this.baseColorTextureSampler=i,this._componentParameters=h;const{transform:n,toMapSpace:m}=s;this.toMapSpace=m;const l=new a(n.position);switch(this.transformWorldFromModelTL=l.low,this.transformWorldFromModelTH=l.high,s.geometry.parameters.vertexPositionRotationType){case 0:this.transformWorldFromModelRS=t;break;case 1:this.transformWorldFromModelRS=n.rotationScale;break;case 2:this.transformWorldFromModelRS=e(r(),n.rotationScale)??t}this.useENUForGlobalOverlayUV=s.obb.radius<u,this.baseColor=o.baseColor,this.opacity=o.opacity,this.textureAlphaCutoff=o.textureAlphaCutoff,this.mrrFactors=o.mrrFactors,this.emissiveBaseColor=o.emissiveBaseColor,this.baseColorTexture=o.baseColorTexture,this.metallicRoughnessTexture=o.metallicRoughnessTexture,this.normalTexture=o.normalTexture,this.occlusionTexture=o.occlusionTexture,this.emissionTexture=o.emissionTexture;const c=new Float32Array(15);c.set(this.transformWorldFromModelTL,0),c.set(this.transformWorldFromModelTH,3),c.set(this.transformWorldFromModelRS,6),this.transformationFloats=c}destroy(){this.baseColorTexture?.dispose(),this.metallicRoughnessTexture?.dispose(),this.emissionTexture?.dispose(),this.occlusionTexture?.dispose(),this.normalTexture?.dispose()}setTransformationDrawId(e){this.transformationDrawId=e}get texture(){return this.baseColorTexture?.texture}get textureSampler(){return this.baseColorTextureSampler}get textureMetallicRoughness(){return this.metallicRoughnessTexture?.texture}get textureEmissive(){return this.emissionTexture?.texture}get textureOcclusion(){return this.occlusionTexture?.texture}get textureNormal(){return this.normalTexture?.texture}get componentParameters(){return this._componentParameters}get emissiveStrength(){const e=this._componentParameters;return 0===e.componentDataType?e.emissiveStrength:void 0}updateComponentParameters(e,t){this._componentParameters=e,this.textureBackedBuffer=t}get castAnyShadows(){return 2!==this.componentParameters.castShadows}}class m{constructor(e,t,r,s,i){this.castShadows=i,this.componentDataType=0,this.externalColor=o(e),this.externalColorMixMode=t,this.emissiveStrength=r,this.emissiveSource=s}get transparent(){return this.externalColor[3]<1?0:2}get opaqueOverride(){return 3===this.externalColorMixMode&&1===this.externalColor[3]?0:2}get emissiveOverride(){return this.emissiveStrength>0?0:2}get emissiveSourceOverride(){return 1===this.emissiveSource?0:2}}class l{constructor(e,t,r,s,o){this.transparent=e,this.opaqueOverride=t,this.emissiveOverride=r,this.emissiveSourceOverride=s,this.castShadows=o,this.componentDataType=1}}const h=new m(s(),1,1,0,0),u=5e4;export{n as ComponentDrawParametersImplementation,m as ComponentParametersUniform,l as ComponentParametersVarying,h as defaultComponentParameters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import"./ComponentData.glsl.js";import"../../../core/shaderLibrary/ForwardLinearDepthToWriteShadowMap.glsl.js";import"../../../core/shaderLibrary/ShaderOutput.js";import"../../../core/shaderLibrary/Slice.glsl.js";import"../../../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import"../../../core/shaderLibrary/attributes/VertexColor.glsl.js";import"../../../core/shaderLibrary/attributes/VertexNormal.glsl.js";import"../../../core/shaderLibrary/attributes/VertexPosition.glsl.js";import"../../../core/shaderLibrary/output/DepthConversion.glsl.js";import"../../../core/shaderLibrary/output/OutputDepth.glsl.js";import"../../../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../../../core/shaderLibrary/output/OutputHighlightOverlay.js";import"../../../core/shaderLibrary/shading/ComputeFragmentNormals.glsl.js";import"../../../core/shaderLibrary/shading/ComputeMaterialColor.glsl.js";import"../../../core/shaderLibrary/shading/ComputeNormalTexture.glsl.js";import"../../../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../../../core/shaderLibrary/shading/MainLighting.glsl.js";import"../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../../../core/shaderLibrary/shading/ReadBaseColorTexture.glsl.js";import"../../../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../../../core/shaderLibrary/terrain/Overlay.glsl.js";import"../../../core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js";import"../../../core/shaderModules/BooleanDrawUniform.js";import"../../../core/shaderModules/FloatDrawUniform.js";import"../../../core/shaderModules/glsl.js";import"../../../core/shaderModules/Texture2DBindUniform.js";import"../../../effects/snowcover/SnowCover.glsl.js";import"../../../shaders/alphaCutoff.glsl.js";import"../../../shaders/OutputColorHighlightOLID.glsl.js";import"../../../shaders/SphereDepthInterpolate.glsl.js";import"../../../../../webgl/ShaderBuilder.js";export{b as build}from"../../../../../../chunks/Component.glsl.js";
|
|
2
|
+
import"./ComponentData.glsl.js";import"../../../core/shaderLibrary/ForwardLinearDepthToWriteShadowMap.glsl.js";import"../../../core/shaderLibrary/ShaderOutput.js";import"../../../core/shaderLibrary/Slice.glsl.js";import"../../../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import"../../../core/shaderLibrary/attributes/VertexColor.glsl.js";import"../../../core/shaderLibrary/attributes/VertexNormal.glsl.js";import"../../../core/shaderLibrary/attributes/VertexPosition.glsl.js";import"../../../core/shaderLibrary/output/DepthConversion.glsl.js";import"../../../core/shaderLibrary/output/OutputDepth.glsl.js";import"../../../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../../../core/shaderLibrary/output/OutputHighlightOverlay.js";import"../../../core/shaderLibrary/shading/ComputeFragmentNormals.glsl.js";import"../../../core/shaderLibrary/shading/ComputeMaterialColor.glsl.js";import"../../../core/shaderLibrary/shading/ComputeNormalTexture.glsl.js";import"../../../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../../../core/shaderLibrary/shading/MainLighting.glsl.js";import"../../../core/shaderLibrary/shading/NormalUtils.glsl.js";import"../../../core/shaderLibrary/shading/pbrGlobals.glsl.js";import"../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../../../core/shaderLibrary/shading/ReadBaseColorTexture.glsl.js";import"../../../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../../../core/shaderLibrary/terrain/Overlay.glsl.js";import"../../../core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js";import"../../../core/shaderModules/BooleanDrawUniform.js";import"../../../core/shaderModules/FloatDrawUniform.js";import"../../../core/shaderModules/glsl.js";import"../../../core/shaderModules/Texture2DBindUniform.js";import"../../../effects/snowcover/SnowCover.glsl.js";import"../../../shaders/alphaCutoff.glsl.js";import"../../../shaders/OutputColorHighlightOLID.glsl.js";import"../../../shaders/SphereDepthInterpolate.glsl.js";import"../../../../../webgl/ShaderBuilder.js";export{b as build}from"../../../../../../chunks/Component.glsl.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{ComponentTechnique as e}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as t}from"./ComponentTechniqueConfiguration.js";import{MaterialBase as s}from"../../../core/material/MaterialBase.js";import{isColor as r}from"../../../core/shaderLibrary/ShaderOutput.js";import{hasShadowHighlights as a}from"../../../shaders/ReceiveShadowsConfiguration.js";import{isSphereDepthInterpolateActive as i}from"../../../shaders/SphereDepthInterpolate.glsl.js";class o extends s{constructor(e,s,r,a,i){super(),this.parameters=e,this.key=i;const o=u(e,r);this.usePBR=e.usePBR,this.hasParametersFromSource=e.hasParametersFromSource,this.isGround=e.isGround,this.slicePlaneEnabled=e.slicePlaneEnabled,this.isIntegratedMesh=e.isIntegratedMesh,this.applySSAO=e.applySSAO,this.
|
|
2
|
+
import{ComponentTechnique as e}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as t}from"./ComponentTechniqueConfiguration.js";import{MaterialBase as s}from"../../../core/material/MaterialBase.js";import{isColor as r}from"../../../core/shaderLibrary/ShaderOutput.js";import{hasShadowHighlights as a}from"../../../shaders/ReceiveShadowsConfiguration.js";import{isSphereDepthInterpolateActive as i}from"../../../shaders/SphereDepthInterpolate.glsl.js";class o extends s{constructor(e,s,r,a,i){super(),this.parameters=e,this.key=i;const o=u(e,r);this.usePBR=e.usePBR,this.hasParametersFromSource=e.hasParametersFromSource,this.isGround=e.isGround,this.slicePlaneEnabled=e.slicePlaneEnabled,this.isIntegratedMesh=e.isIntegratedMesh,this.applySSAO=e.applySSAO,this._emissions=0!==o,this.materialPass=n(e,r),this._configuration=new t(a),this._supportsSphereDepthInterpolate=e.sphereDepthInterpolate&&this._configuration.spherical,this._initializeMaterialConfiguration(e,s,r)}destroy(){}get emissions(){if(!this._emissions)return 0;switch(this.materialPass){case 0:case 3:return 1;case 1:case 4:return 2;case 2:return 3}}acquireTechnique(t,s,r,a){const o=this._updateConfiguration(s,r);if(this._supportsSphereDepthInterpolate&&t.precompiling>0){o.sphereDepthInterpolate=!1;const s=t.get(e,o,a.layout);o.sphereDepthInterpolate=!0;const n=t.get(e,o,a.layout);return i(r.camera,o)?n:s}return t.get(e,o,a.layout)}_initializeMaterialConfiguration(e,t,s){const r=this._configuration;r.hasMetallicRoughnessTexture=e.hasMetallicRoughnessTexture,r.hasOcclusionTexture=e.hasOcclusionTexture,r.hasNormalTexture=e.hasNormalTexture,r.sphereDepthInterpolate=!1,r.ellipsoidMode=e.ellipsoidMode,r.doubleSidedMode=e.doubleSided?1:0,r.hasColorTexture=e.hasBaseColorTexture,r.cullFace=e.cullFace,r.alphaDiscardMode=e.alphaDiscardMode,r.hasVertexColors=t.hasVertexColors,r.textureCoordinateType=t.textureCoordinateType,r.shadeNormals=t.shadeNormals,r.normalType=t.hasNormals?1:2,r.polygonOffset=e.polygonOffset,r.vertexPositionRotationType=t.vertexPositionRotationType,r.componentDataType=s.componentDataType,r.emissionSource=u(e,s),r.groundTransparencyMode=e.groundTransparencyMode}_updateConfiguration(e,t){const s=this._configuration,{identifier:o}=e,n=0===o;s.output=t.output,s.enableOITOffset=t.enableOITOffset,s.sphereDepthInterpolate=this._supportsSphereDepthInterpolate&&i(t.camera,s),s.hasEmission=t.hasEmission,s.renderOccluded=9===t.slot;const l=this.isIntegratedMesh?c(t)?h(t)?3:2:1:0;s.integratedMeshMode=l,s.pbrMode=3===l?4:this.usePBR?this.hasParametersFromSource?0!==s.shadeNormals&&this.isIntegratedMesh?0:2:1:0,s.hasSlicePlane=null!=t.slicePlane&&this.slicePlaneEnabled,s.isGroundSlice=s.hasSlicePlane&&this.isGround;const{materialPass:u}=this;s.transparent=n&&(1===u||2===u&&e.transparent||4===u)||s.isGroundSlice,s.hasHighlightMixTexture=2===o&&null!=t.highlightMixTexture,s.snowCover=n&&t.snowCover>0,s.vertexDiscardMode=n&&2===u?e.transparent?2:1:0;const p=r(t.output);return s.receiveAmbientOcclusion=p&&this.applySSAO&&!s.renderOccluded&&null!=t.ssao?.getTexture(),s.receiveGlobalIllumination=p&&this.applySSAO&&!s.renderOccluded&&t.globalIlluminationEnabled,s.hasOccludees=p&&t.hasOccludees,s.receiveShadows=p&&t.shadowMap.ready,s.hasShadowHighlights=a(s,t),s.screenSpaceReflections=t.hasScreenSpaceReflections,s.cloudReflections=p&&null!=t.clouds.data?.cubeMap?.colorTexture,s}}function n(e,t){const{alphaDiscardMode:s,isIntegratedMesh:r,slicePlaneEnabled:a}=e,{transparent:i,opaqueOverride:o}=t,n=e.isObjectTransparent,l=e.hasBaseColorTransparency;if(r)return n||a?4:3;if(n)return 1;if(0===o)return 0;if(l||0===s||3===s)return 1;switch(i){case 2:return 0;case 0:return 1;case 1:return 2}}function l(e){return e.hasEmissionTexture||e.hasEmissiveBaseColor}function u(e,{emissiveSourceOverride:t,emissiveOverride:s}){const r=e.hasEmissionTexture,a=1===t,i=2===t;return 2!==s&&(l(e)||2!==t)?l(e)?i?r?4:2:a?r?5:7:6:a?7:6:0}function h(e){return null!=e.overlay?.getTexture(3)}function c(e){return null!=e.overlay?.getTexture(1)}export{o as ComponentMaterial,n as computeMaterialPass,u as getEmissionSource};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{If as
|
|
3
|
-
void forwardLinearDepth(float _linearDepth) { ${
|
|
4
|
-
`)}export{
|
|
2
|
+
import{__decorate as e}from"tslib";import{ShaderOutputConfiguration as r}from"./ShaderOutputConfiguration.js";import{If as i,glsl as o}from"../shaderModules/glsl.js";import{parameter as t}from"../shaderTechnique/ShaderTechniqueConfiguration.js";class a extends r{constructor(e){super(),this.spherical=e,this.receiveShadows=!0}}function n(e){e.varyings.add("linearDepth","float",{invariant:!0})}function s(e,r){r&&n(e),e.vertex.code.add(o`
|
|
3
|
+
void forwardLinearDepth(float _linearDepth) { ${i(r,"linearDepth = _linearDepth;")} }
|
|
4
|
+
`)}e([t()],a.prototype,"receiveShadows",void 0);export{s as ForwardLinearDepth,a as ForwardLinearDepthConfiguration,n as addLinearDepth};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{translate as s}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as a,add as o,subtract as l,set as n}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as c,create as t}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{InstancedDoubleConfiguration as r}from"./attributes/InstancedDoubleConfiguration.js";import{Float3DrawUniform as f}from"../shaderModules/Float3DrawUniform.js";import{Float3PassUniform as d}from"../shaderModules/Float3PassUniform.js";import{glsl as u}from"../shaderModules/glsl.js";import{parameter as p}from"../shaderTechnique/ShaderTechniqueConfiguration.js";import{NoParameters as m}from"../../../../webgl/NoParameters.js";class P extends r{constructor(){super(...arguments),this.hasSlicePlane=!1,this.hasSliceTranslatedView=!1}}e([p()],P.prototype,"hasSlicePlane",void 0);class b extends m{constructor(e=null){super(),this.slicePlaneLocalOrigin=e}}function v(e,s){
|
|
2
|
+
import{__decorate as e}from"tslib";import{translate as s}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as a,add as o,subtract as l,set as n}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as c,create as t}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{InstancedDoubleConfiguration as r}from"./attributes/InstancedDoubleConfiguration.js";import{Float3DrawUniform as f}from"../shaderModules/Float3DrawUniform.js";import{Float3PassUniform as d}from"../shaderModules/Float3PassUniform.js";import{glsl as u}from"../shaderModules/glsl.js";import{parameter as p}from"../shaderTechnique/ShaderTechniqueConfiguration.js";import{NoParameters as m}from"../../../../webgl/NoParameters.js";class P extends r{constructor(){super(...arguments),this.hasSlicePlane=!1,this.hasSliceTranslatedView=!1}}e([p()],P.prototype,"hasSlicePlane",void 0);class b extends m{constructor(e=null){super(),this.slicePlaneLocalOrigin=e}}function v(e,s){g(e,s,...y(s))}function h(e,s){g(e,s,...F(s))}function S(e,s){B(e,s,...F(s))}function w(e,s){B(e,s,...y(s))}function B(e,s,...i){s.hasSlicePlane?(e.uniforms.add(...i),e.code.add(u`struct SliceFactors {
|
|
3
3
|
float front;
|
|
4
4
|
float side0;
|
|
5
5
|
float side1;
|
|
@@ -34,5 +34,5 @@ return dot(slicePlaneBasis1, slicePlaneBasis1) != 0.0;
|
|
|
34
34
|
}
|
|
35
35
|
bool rejectBySlice(vec3 pos) {
|
|
36
36
|
return sliceEnabled() && sliceByFactors(calculateSliceFactors(pos));
|
|
37
|
-
}
|
|
38
|
-
vec4 applySlice(vec4 color, vec3 pos) { return color; }`)}function
|
|
37
|
+
}`)):e.code.add("bool rejectBySlice(vec3 pos) { return false; }")}function g(e,s,...i){e.constants.add("groundSliceOpacity","float",.2),B(e,s,...i),s.hasSlicePlane?e.code.add("\n void discardBySlice(vec3 pos) {\n if (rejectBySlice(pos)) {\n discard;\n }\n }\n\n vec4 applySliceOutline(vec4 color, vec3 pos) {\n SliceFactors factors = calculateSliceFactors(pos);\n\n factors.front /= 2.0 * fwidth(factors.front);\n factors.side0 /= 2.0 * fwidth(factors.side0);\n factors.side1 /= 2.0 * fwidth(factors.side1);\n factors.side2 /= 2.0 * fwidth(factors.side2);\n factors.side3 /= 2.0 * fwidth(factors.side3);\n\n // return after calling fwidth, to avoid aliasing caused by discontinuities in the input to fwidth\n if (sliceByFactors(factors)) {\n return color;\n }\n\n float outlineFactor = (1.0 - step(0.5, factors.front))\n * (1.0 - step(0.5, factors.side0))\n * (1.0 - step(0.5, factors.side1))\n * (1.0 - step(0.5, factors.side2))\n * (1.0 - step(0.5, factors.side3));\n\n return mix(color, vec4(vec3(0.0), color.a), outlineFactor * 0.3);\n }\n\n vec4 applySlice(vec4 color, vec3 pos) {\n return sliceEnabled() ? applySliceOutline(color, pos) : color;\n }\n "):e.code.add(u`void discardBySlice(vec3 pos) { }
|
|
38
|
+
vec4 applySlice(vec4 color, vec3 pos) { return color; }`)}function y(e){return[new d("slicePlaneOrigin",(s,i)=>O(e,s,i)),new d("slicePlaneBasis1",(s,i)=>L(e,s,i,i.slicePlane?.basis1)),new d("slicePlaneBasis2",(s,i)=>L(e,s,i,i.slicePlane?.basis2))]}function F(e){return[new f("slicePlaneOrigin",(s,i)=>O(e,s,i)),new f("slicePlaneBasis1",(s,i)=>L(e,s,i,i.slicePlane?.basis1)),new f("slicePlaneBasis2",(s,i)=>L(e,s,i,i.slicePlane?.basis2))]}function j(e,s,i){return e.instancedDoublePrecision?n(M,i.camera.viewInverseTransposeMatrix[3],i.camera.viewInverseTransposeMatrix[7],i.camera.viewInverseTransposeMatrix[11]):s.slicePlaneLocalOrigin}function x(e,s){return null!=e?l(T,s.origin,e):s.origin}function D(e,i,a){return e.hasSliceTranslatedView?null!=i?s(N,a.camera.viewMatrix,i):a.camera.viewMatrix:null}function O(e,s,i){if(null==i.slicePlane)return c;const o=j(e,s,i),l=x(o,i.slicePlane),n=D(e,o,i);return null!=n?a(T,l,n):l}function L(e,s,i,n){if(null==n||null==i.slicePlane)return c;const t=j(e,s,i),r=x(t,i.slicePlane),f=D(e,t,i);return null!=f?(o(I,n,r),a(T,r,f),a(I,I,f),l(I,I,T)):n}const M=t(),T=t(),I=t(),N=i();export{S as RejectBySliceDraw,w as RejectBySlicePass,P as SliceConfiguration,h as SliceDraw,v as SlicePass,b as SlicePlaneParameters};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as o}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{DoublePrecision as e}from"../util/DoublePrecision.glsl.js";import{Float3DrawUniform as t}from"../../shaderModules/Float3DrawUniform.js";import{Float3PassUniform as a}from"../../shaderModules/Float3PassUniform.js";import{If as i,glsl as s}from"../../shaderModules/glsl.js";import{IntegerDrawUniform as
|
|
2
|
+
import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as o}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{DoublePrecision as e}from"../util/DoublePrecision.glsl.js";import{Float3DrawUniform as t}from"../../shaderModules/Float3DrawUniform.js";import{Float3PassUniform as a}from"../../shaderModules/Float3PassUniform.js";import{If as i,glsl as s}from"../../shaderModules/glsl.js";import{IntegerDrawUniform as n}from"../../shaderModules/IntegerDrawUniform.js";import{Matrix3DrawUniform as m}from"../../shaderModules/Matrix3DrawUniform.js";import{Matrix3PassUniform as d}from"../../shaderModules/Matrix3PassUniform.js";import{Matrix4BindUniform as l}from"../../shaderModules/Matrix4BindUniform.js";import{Texture2DPassUniform as f}from"../../shaderModules/Texture2DPassUniform.js";import{ViewingModeConfiguration as v}from"../../../materials/ViewingModeConfiguration.js";import{NoParameters as c}from"../../../../../webgl/NoParameters.js";class w extends v{}function u(r,o){const{attributes:v,vertex:c,varyings:w,fragment:u}=r;c.include(e),v.add("position","vec3"),w.add("vPositionWorldCameraRelative","vec3"),w.add("vPosition_view","vec3",{invariant:!0}),c.uniforms.add(new a("transformWorldFromViewTH",r=>r.transformWorldFromViewTH),new a("transformWorldFromViewTL",r=>r.transformWorldFromViewTL),new d("transformViewFromCameraRelativeRS",r=>r.transformViewFromCameraRelativeRS),new l("transformProjFromView",r=>r.camera.projectionMatrix));const{vertexPositionRotationType:F,useTransformationTexture:W}=o,T=1===F,x=2===F,p=T||x;W?c.uniforms.add(new n("transformationDrawId",r=>r.transformationDrawId),new f("transformationTexture",r=>r.transformationTexture)):(c.uniforms.add(new t("transformWorldFromModelTH",r=>r.transformWorldFromModelTH),new t("transformWorldFromModelTL",r=>r.transformWorldFromModelTL)),p&&c.uniforms.add(new m("transformWorldFromModelRS",r=>r.transformWorldFromModelRS))),c.code.add(s`
|
|
3
3
|
${i(p,s`
|
|
4
4
|
mat3 modelTransformation() {
|
|
5
5
|
${i(W,s`
|
|
@@ -46,8 +46,8 @@ import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f6
|
|
|
46
46
|
vPosition_view = transformViewFromCameraRelativeRS * vPositionWorldCameraRelative;
|
|
47
47
|
gl_Position = transformProjFromView * vec4(vPosition_view, 1.0);
|
|
48
48
|
}
|
|
49
|
-
`),
|
|
49
|
+
`),u.uniforms.add(new a("transformWorldFromViewTL",r=>r.transformWorldFromViewTL)),c.code.add(s`vec3 positionWorld() {
|
|
50
50
|
return transformWorldFromViewTL + vPositionWorldCameraRelative;
|
|
51
|
-
}`),
|
|
51
|
+
}`),u.code.add(s`vec3 positionWorld() {
|
|
52
52
|
return transformWorldFromViewTL + vPositionWorldCameraRelative;
|
|
53
|
-
}`)}class
|
|
53
|
+
}`)}class F extends c{constructor(){super(...arguments),this.transformWorldFromViewTH=o(),this.transformWorldFromViewTL=o(),this.transformViewFromCameraRelativeRS=r()}}class W extends c{constructor(){super(...arguments),this.transformWorldFromModelRS=r(),this.transformWorldFromModelTH=o(),this.transformWorldFromModelTL=o(),this.transformationDrawId=0}}export{u as VertexPosition,w as VertexPositionConfiguration,W as VertexPositionDrawParameters,F as VertexPositionPassParameters};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{clamp as s}from"../../../../../../core/mathUtils.js";import{isColor as o}from"../ShaderOutput.js";import{ShaderOutputConfiguration as i}from"../ShaderOutputConfiguration.js";import{VertexTextureCoordinates as r}from"../attributes/VertexTextureCoordinates.glsl.js";import{Gamma as m}from"../shading/Gamma.glsl.js";import{Float3DrawUniform as t}from"../../shaderModules/Float3DrawUniform.js";import{Float3PassUniform as
|
|
2
|
+
import{__decorate as e}from"tslib";import{clamp as s}from"../../../../../../core/mathUtils.js";import{isColor as o}from"../ShaderOutput.js";import{ShaderOutputConfiguration as i}from"../ShaderOutputConfiguration.js";import{VertexTextureCoordinates as r}from"../attributes/VertexTextureCoordinates.glsl.js";import{Gamma as m}from"../shading/Gamma.glsl.js";import{Float3DrawUniform as t}from"../../shaderModules/Float3DrawUniform.js";import{Float3PassUniform as n}from"../../shaderModules/Float3PassUniform.js";import{FloatDrawUniform as a}from"../../shaderModules/FloatDrawUniform.js";import{FloatPassUniform as d}from"../../shaderModules/FloatPassUniform.js";import{glsl as c}from"../../shaderModules/glsl.js";import{Texture2DDrawUniform as u}from"../../shaderModules/Texture2DDrawUniform.js";import{Texture2DPassUniform as v}from"../../shaderModules/Texture2DPassUniform.js";import{parameter as l}from"../../shaderTechnique/ShaderTechniqueConfiguration.js";import{floatBlendReductionFactor as f}from"../../../shaders/floatBlendScale.glsl.js";const p=1;class h extends i{constructor(){super(...arguments),this.emissionSource=0}}function x(e,i){const{hasEmission:l,emissionSource:p,hasEmissiveTextureTransform:h,bindType:x}=i;if(!o(i.output)||!l)return;const S=e.fragment;if(S.include(m),0===p)return void S.code.add("vec4 getEmissions(vec3 symbolColor) { return vec4(0.0);}");const T=3===p||4===p||5===p;T&&(e.include(r,i),S.uniforms.add(1===x?new v("texEmission",e=>e.textureEmissive):new u("texEmission",e=>e.textureEmissive)));const j=2===p||T;if(j&&S.uniforms.add(1===x?new n("emissiveBaseColor",e=>e.emissiveBaseColor):new t("emissiveBaseColor",e=>e.emissiveBaseColor)),g(i)){const e=e=>s(e??0,0,f);S.uniforms.add(1===x?new d("emissiveStrength",s=>e(s.emissiveStrength)):new a("emissiveStrength",s=>e(s.emissiveStrength)))}const C=7===p,b=5===p,E=1===p||6===p||C;S.code.add(c`vec4 getEmissions(vec3 symbolColor) {
|
|
3
3
|
vec4 emissions =`),j?b?S.code.add("emissiveSource == 0 ? vec4(emissiveBaseColor, 1.0): vec4(linearizeGamma(symbolColor), 1.0)"):S.code.add("vec4(emissiveBaseColor, 1.0)"):E?C?S.code.add("emissiveSource == 0 ? vec4(0.0): vec4(linearizeGamma(symbolColor), 1.0)"):S.code.add("vec4(linearizeGamma(symbolColor), 1.0)"):S.code.add("vec4(0.0)"),S.code.add(";"),T&&(b?S.code.add(c`
|
|
4
4
|
if(emissiveSource == 0) {
|
|
5
5
|
vec4 emissiveFromTex = textureLookup(texEmission, ${h?"emissiveUV":"vuv0"});
|
|
6
6
|
emissions *= vec4(linearizeGamma(emissiveFromTex.rgb), emissiveFromTex.a);
|
|
7
7
|
}
|
|
8
|
-
`):S.code.add(`vec4 emissiveFromTex = textureLookup(texEmission, ${h?"emissiveUV":"vuv0"});\n emissions *= vec4(linearizeGamma(emissiveFromTex.rgb), emissiveFromTex.a);`),S.code.add("emissions.a = emissions.rgb == vec3(0.0) ? 0.0: emissions.a;")),
|
|
8
|
+
`):S.code.add(`vec4 emissiveFromTex = textureLookup(texEmission, ${h?"emissiveUV":"vuv0"});\n emissions *= vec4(linearizeGamma(emissiveFromTex.rgb), emissiveFromTex.a);`),S.code.add("emissions.a = emissions.rgb == vec3(0.0) ? 0.0: emissions.a;")),S.code.add("\n emissions.rgb *= emissiveStrength;\n return emissions;\n }\n ")}function g({emissionSource:e}){return 0===e||1===e||2===e||3===e}e([l({count:8})],h.prototype,"emissionSource",void 0),e([l()],h.prototype,"hasEmissiveTextureTransform",void 0);export{h as EmissionsConfiguration,p as emissiveStrengthDefault,x as getEmissions,g as hasEmissiveStrengthFromUniform};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{EvaluateAmbientLighting as i}from"./EvaluateAmbientLighting.glsl.js";import{EvaluateAmbientOcclusion as
|
|
2
|
+
import{EvaluateAmbientLighting as i}from"./EvaluateAmbientLighting.glsl.js";import{EvaluateAmbientOcclusion as e}from"./EvaluateAmbientOcclusion.glsl.js";import{Gamma as n}from"./Gamma.glsl.js";import{mainLightDirection as a,mainLightIntensity as t,applyShading as o}from"./MainLighting.glsl.js";import{PhysicallyBasedRendering as l}from"./PhysicallyBasedRendering.glsl.js";import{PiUtils as r}from"./PiUtils.glsl.js";import{ReadGlobalIllumination as c}from"./ReadGlobalIllumination.glsl.js";import{BooleanBindUniform as d}from"../../shaderModules/BooleanBindUniform.js";import{FloatBindUniform as s}from"../../shaderModules/FloatBindUniform.js";import{glsl as m,If as u}from"../../shaderModules/glsl.js";import{ambientBoost as g}from"../../../lighting/SceneLighting.js";import{BlackLevelLightSoftCompression as h}from"../../../shaders/BlackLevelLightSoftCompression.glsl.js";import{ToneMapping as p}from"../../../shaders/ToneMapping.glsl.js";function f(i){i.constants.add("ambientBoostFactor","float",g)}function v(i){i.uniforms.add(new s("lightingGlobalFactor",i=>i.lighting.globalFactor))}function b(g,b){const{pbrMode:L,spherical:I,hasColorTexture:C,receiveGlobalIllumination:D}=b;g.include(n),g.include(c,b),g.include(e,b),0!==L&&g.include(l,b),g.include(i,b),g.include(r),g.include(p,b);const S=!(2===L&&!C);S&&g.include(h),f(g),v(g),g.uniforms.add(a).code.add(m`
|
|
3
3
|
float additionalDirectedAmbientLight(float lightAlignment) {
|
|
4
4
|
return smoothstep(0.0, 1.0, clamp(lightAlignment * 2.5, 0.0, 1.0));
|
|
5
5
|
}
|
|
@@ -8,58 +8,55 @@ import{EvaluateAmbientLighting as i}from"./EvaluateAmbientLighting.glsl.js";impo
|
|
|
8
8
|
float lightAlignment = dot(${I?m`normalize(vPosWorld)`:m`vec3(0.0, 0.0, 1.0)`}, mainLightDirection);
|
|
9
9
|
return smoothstep(0.0, 1.0, clamp(lightAlignment * 2.5, 0.0, 1.0));
|
|
10
10
|
}
|
|
11
|
-
`),
|
|
11
|
+
`),g.uniforms.add(t).code.add(m`vec3 evaluateAdditionalLighting(float ambientOcclusion, vec3 vPosWorld) {
|
|
12
12
|
float additionalAmbientScale = additionalDirectedAmbientLight(vPosWorld);
|
|
13
13
|
return (1.0 - ambientOcclusion) * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor * mainLightIntensity;
|
|
14
|
-
}`);const
|
|
14
|
+
}`);const R=D?"globalIlluminationOcclusion":"ssao";switch(g.constants.add("mainLightIrradianceScale","float",D?.75:1),g.constants.add("ambientIrradianceScale","float",D?1.5:1),D&&g.code.add(m`vec3 evaluateGlobalIlluminationOcclusion() {
|
|
15
15
|
return min(1.2 * readGlobalIlluminationOcclusion(), 1.0);
|
|
16
16
|
}
|
|
17
17
|
vec3 evaluateGlobalIlluminationEmission(vec3 albedoLinear) {
|
|
18
18
|
return 2.25 * (0.75 * albedoLinear + 0.25) * readGlobalIlluminationEmission().rgb;
|
|
19
19
|
}`),L){case 0:case 4:case 3:g.include(o),g.code.add(m`
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
`);break;case 1:case 2:
|
|
20
|
+
vec3 evaluateSceneLighting(vec3 normal, vec3 albedo, float shadow, float ssao, vec3 additionalLight,
|
|
21
|
+
vec3 viewDirection, vec3 upDirection) {
|
|
22
|
+
${u(D,m`vec3 globalIlluminationOcclusion = evaluateGlobalIlluminationOcclusion();`)}
|
|
23
|
+
|
|
24
|
+
vec3 mainLighting = mainLightIrradianceScale * applyShading(normal, shadow);
|
|
25
|
+
vec3 ambientLighting = ambientIrradianceScale * calculateAmbientIrradiance(normal) * (1.0 - ${R});
|
|
26
|
+
vec3 albedoLinear = linearizeGamma(albedo);
|
|
27
|
+
|
|
28
|
+
vec3 totalLight = mainLighting + ambientLighting + additionalLight;
|
|
29
|
+
totalLight = min(totalLight, vec3(PI));
|
|
30
|
+
vec3 linearColor = vec3((albedoLinear / PI) * totalLight);
|
|
31
|
+
${u(D,"linearColor += evaluateGlobalIlluminationEmission(albedoLinear);")}
|
|
32
|
+
return delinearizeGamma(linearColor);
|
|
33
|
+
}
|
|
34
|
+
`);break;case 1:case 2:g.constants.add("groundReflectance","float",D?.35:.2),g.code.add(m`
|
|
35
35
|
const float fillLightIntensity = 0.25;
|
|
36
36
|
const float horizonLightDiffusion = 0.4;
|
|
37
|
-
const float additionalAmbientIrradianceFactor = 0.02;
|
|
38
|
-
const float groundReflectance = ${m.float(i)};
|
|
39
37
|
|
|
40
|
-
vec3
|
|
41
|
-
|
|
38
|
+
vec3 evaluateSceneLighting(vec3 normal, vec3 albedo, float shadow, float ssao, vec3 additionalLight,
|
|
39
|
+
vec3 viewDirection, vec3 upDirection) {
|
|
42
40
|
PBRShadingInfo inputs;
|
|
43
|
-
calculatePBRInputs(inputs, normal, viewDirection, upDirection, albedo
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
`),b.useFillLights?g.uniforms.add(new s("hasFillLights",i=>i.enableFillLights)):g.constants.add("hasFillLights","bool",!1),g.code.add(m`
|
|
41
|
+
calculatePBRInputs(inputs, normal, viewDirection, upDirection, albedo);
|
|
42
|
+
${u(D,"vec3 globalIlluminationOcclusion = evaluateGlobalIlluminationOcclusion();")}
|
|
43
|
+
`),b.useFillLights?g.uniforms.add(new d("hasFillLights",i=>i.enableFillLights)):g.constants.add("hasFillLights","bool",!1),g.code.add(m`
|
|
47
44
|
vec3 ambientDir = vec3(5.0 * upDirection[1] - upDirection[0] * upDirection[2], - 5.0 * upDirection[0] - upDirection[2] * upDirection[1], upDirection[1] * upDirection[1] + upDirection[0] * upDirection[0]);
|
|
48
45
|
ambientDir = ambientDir != vec3(0.0) ? normalize(ambientDir) : normalize(vec3(5.0, -1.0, 0.0));
|
|
49
46
|
|
|
50
47
|
inputs.NdotAmbDir = hasFillLights ? abs(dot(normal, ambientDir)) : 1.0;
|
|
51
48
|
|
|
52
49
|
// Calculate the irradiance components: sun, fill lights and the sky.
|
|
53
|
-
vec3 mainLightIrradianceComponent =
|
|
50
|
+
vec3 mainLightIrradianceComponent = mainLightIrradianceScale * inputs.NdotL * (1.0 - shadow) * mainLightIntensity;
|
|
54
51
|
vec3 fillLightsIrradianceComponent = inputs.NdotAmbDir * mainLightIntensity * fillLightIntensity;
|
|
55
52
|
// calculate ambient irradiance for localView and additionalLight for globalView
|
|
56
|
-
vec3 ambientLightIrradianceComponent =
|
|
53
|
+
vec3 ambientLightIrradianceComponent = ambientIrradianceScale * calculateAmbientIrradiance(normal) * (1.0 - ${R}) + additionalLight;
|
|
57
54
|
|
|
58
55
|
// Assemble the overall irradiance of the sky that illuminates the surface
|
|
59
56
|
inputs.skyIrradianceToSurface = ambientLightIrradianceComponent + mainLightIrradianceComponent + fillLightsIrradianceComponent ;
|
|
60
57
|
// Assemble the overall irradiance of the ground that illuminates the surface. for this we use the simple model that changes only the sky irradiance by the groundReflectance
|
|
61
58
|
inputs.groundIrradianceToSurface = groundReflectance * ambientLightIrradianceComponent + mainLightIrradianceComponent + fillLightsIrradianceComponent ;
|
|
62
|
-
`),g.uniforms.add(new
|
|
59
|
+
`),g.uniforms.add(new s("lightingSpecularStrength",i=>i.lighting.mainLight.specularStrength),new s("lightingEnvironmentStrength",i=>i.lighting.mainLight.environmentStrength)).code.add(m`
|
|
63
60
|
vec3 horizonRingDir = inputs.RdotUP * upDirection - inputs.reflectedView;
|
|
64
61
|
vec3 horizonRingH = normalize(horizonRingDir - viewDirection);
|
|
65
62
|
inputs.NdotH_Horizon = dot(normal, horizonRingH);
|
|
@@ -68,7 +65,7 @@ return 2.25 * (0.75 * albedoLinear + 0.25) * readGlobalIlluminationEmission().rg
|
|
|
68
65
|
vec3 horizonLightRadianceComponent = lightingEnvironmentStrength * normalDistribution(inputs.NdotH_Horizon, min(inputs.roughness + horizonLightDiffusion, 1.0)) * mainLightIntensity * fillLightIntensity;
|
|
69
66
|
|
|
70
67
|
// calculateAmbientRadiance for localView and additionalLight for global view
|
|
71
|
-
vec3 ambientLightRadianceComponent = lightingEnvironmentStrength * calculateAmbientRadiance() * (1.0 - ${
|
|
68
|
+
vec3 ambientLightRadianceComponent = lightingEnvironmentStrength * calculateAmbientRadiance() * (1.0 - ${R}) + additionalLight;
|
|
72
69
|
float normalDirectionModifier = mix(1., min(mix(0.1, 2.0, (inputs.NdotUP + 1.) * 0.5), 1.0), clamp(inputs.roughness * 5.0, 0.0 , 1.0));
|
|
73
70
|
|
|
74
71
|
// Assemble the overall radiance of the sky that illuminates the surface
|
|
@@ -79,45 +76,47 @@ return 2.25 * (0.75 * albedoLinear + 0.25) * readGlobalIlluminationEmission().rg
|
|
|
79
76
|
|
|
80
77
|
// Calculate average ambient radiance - This is used in the gamut mapping process to determine the black level for compression
|
|
81
78
|
inputs.averageAmbientRadiance = ambientLightIrradianceComponent[1] * (1.0 + groundReflectance);
|
|
82
|
-
`),g.code.add(m`
|
|
79
|
+
`),g.constants.add("additionalAmbientIrradianceFactor","float",.02),g.code.add(m`
|
|
83
80
|
vec3 reflectedColorComponent = evaluateEnvironmentIllumination(inputs);
|
|
81
|
+
float additionalAmbientIrradiance = additionalAmbientIrradianceFactor * mainLightIntensity[2];
|
|
84
82
|
vec3 additionalMaterialReflectanceComponent = inputs.albedoLinear * additionalAmbientIrradiance;
|
|
85
|
-
vec3
|
|
83
|
+
vec3 linearColor = reflectedColorComponent + additionalMaterialReflectanceComponent;
|
|
86
84
|
|
|
87
|
-
${u(D,
|
|
88
|
-
outColorLinear += evaluateGlobalIlluminationEmission(inputs.albedoLinear);`)}
|
|
85
|
+
${u(D,"linearColor += evaluateGlobalIlluminationEmission(inputs.albedoLinear);")}
|
|
89
86
|
|
|
90
|
-
${
|
|
87
|
+
${S?"linearColor = blackLevelSoftCompression(linearColor, inputs.averageAmbientRadiance);":"linearColor = max(vec3(0.0), linearColor - 0.005 * inputs.averageAmbientRadiance);"}
|
|
91
88
|
|
|
92
|
-
return delinearizeGamma(
|
|
89
|
+
return delinearizeGamma(linearColor);
|
|
93
90
|
}
|
|
94
|
-
`);break
|
|
95
|
-
|
|
96
|
-
const float specularityTerrain = ${m.float(i)};
|
|
91
|
+
`);break;case 5:case 6:g.constants.add("terrainSpecularity","float",D?.35:.5),g.uniforms.add(a,t).code.add(m`
|
|
92
|
+
const float roughnessTerrain = 0.5;
|
|
97
93
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
94
|
+
vec3 evaluateSceneLighting(vec3 normal, vec3 albedo, float shadow, float ssao, vec3 additionalLight,
|
|
95
|
+
vec3 viewDirection, vec3 upDirection) {
|
|
96
|
+
PBRShadingInfo inputs;
|
|
97
|
+
calculateSimplifiedInputs(inputs, normal, viewDirection, upDirection, albedo);
|
|
101
98
|
|
|
102
|
-
|
|
99
|
+
${u(D,"vec3 globalIlluminationOcclusion = evaluateGlobalIlluminationOcclusion();")}
|
|
103
100
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
101
|
+
vec3 mainLightIrradianceComponent = mainLightIrradianceScale * (1.0 - shadow) * inputs.NdotL * mainLightIntensity;
|
|
102
|
+
vec3 ambientLightIrradianceComponent = ambientIrradianceScale * calculateAmbientIrradiance(normal) * (1.0 - ${R}) + additionalLight;
|
|
103
|
+
vec3 ambientSky = ambientLightIrradianceComponent + mainLightIrradianceComponent;
|
|
107
104
|
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
vec3 indirectDiffuse = ((1.0 - inputs.NdotUP) * mainLightIrradianceComponent + (1.0 + inputs.NdotUP ) * ambientSky) * 0.5;
|
|
106
|
+
vec3 diffuseColor = inputs.albedoLinear * (1.0 - inputs.f0) * indirectDiffuse / PI;
|
|
110
107
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
108
|
+
vec3 mainLightRadianceComponent = normalDistribution(inputs.NdotH, roughnessTerrain) * mainLightIntensity;
|
|
109
|
+
vec2 dfg = prefilteredDFGAnalytical(roughnessTerrain, inputs.NdotV);
|
|
110
|
+
vec3 specularColor = inputs.f0 * dfg.x + inputs.f90 * dfg.y;
|
|
111
|
+
vec3 specularComponent = terrainSpecularity * specularColor * mainLightRadianceComponent;
|
|
115
112
|
|
|
116
|
-
|
|
113
|
+
vec3 linearColor = diffuseColor + specularComponent;
|
|
117
114
|
|
|
118
|
-
|
|
119
|
-
outColorLinear += evaluateGlobalIlluminationEmission(inputs.albedoLinear);`)}
|
|
115
|
+
${u(D,"linearColor += evaluateGlobalIlluminationEmission(inputs.albedoLinear);")}
|
|
120
116
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
`);break
|
|
117
|
+
return delinearizeGamma(linearColor);
|
|
118
|
+
}
|
|
119
|
+
`);break;case 7:g.code.add(m`vec3 evaluateSceneLighting(vec3 normal, vec3 albedo, float shadow, float ssao, vec3 additionalLight,
|
|
120
|
+
vec3 viewDirection, vec3 upDirection) {
|
|
121
|
+
return albedo;
|
|
122
|
+
}`)}}export{b as EvaluateSceneLighting,f as addAmbientBoostFactor,v as addLightingGlobalFactor};
|
|
@@ -35,7 +35,7 @@ return worldToScreenPerDistanceRatio / segmentDistanceToCamera;
|
|
|
35
35
|
}
|
|
36
36
|
return vec2(startPseudoScreen, startPseudoScreen + segmentLengthPseudoScreen);
|
|
37
37
|
}
|
|
38
|
-
`),v.uniforms.add(new n("stipplePatternTexture",e=>e.stippleTexture),new a("stipplePatternPixelSizeInv",e=>1/S(e))),c.stippleOffColorEnabled&&v.uniforms.add(new r("stippleOffColor",e=>f(e.stippleOffColor))),d.include(t),c.
|
|
38
|
+
`),v.uniforms.add(new n("stipplePatternTexture",e=>e.stippleTexture),new a("stipplePatternPixelSizeInv",e=>1/S(e))),c.stippleOffColorEnabled&&v.uniforms.add(new r("stippleOffColor",e=>f(e.stippleOffColor))),d.include(t);const h=c.worldSized&&c.imagePattern,C=!c.worldSized;h?(d.varyings.add("vStippleV","float"),d.fragment.include(e),v.code.add(p`vec4 getStippleColor(out bool isClamped) {
|
|
39
39
|
vec2 aaCorrectedLimits = vStippleDistanceLimits + vec2(1.0, -1.0) / gl_FragCoord.w;
|
|
40
40
|
isClamped = vStippleDistance < aaCorrectedLimits.x || vStippleDistance > aaCorrectedLimits.y;
|
|
41
41
|
float u = vStippleDistance * stipplePatternPixelSizeInv;
|
|
@@ -61,13 +61,15 @@ float opacity = mixExternalOpacity(color.a, 1.0, stippleColor.a, mixMode);
|
|
|
61
61
|
return vec4(col, opacity);
|
|
62
62
|
}`)):v.code.add(p`
|
|
63
63
|
float getStippleSDF(out bool isClamped) {
|
|
64
|
-
float
|
|
64
|
+
float stippleDistance = noPerspectiveRead(${C?"clamp(vStippleDistance, vStippleDistanceLimits.x, vStippleDistanceLimits.y)":"vStippleDistance"});
|
|
65
65
|
float lineSizeInv = noPerspectiveRead(vLineSizeInv);
|
|
66
66
|
|
|
67
|
+
${C?p`
|
|
67
68
|
vec2 aaCorrectedLimits = vStippleDistanceLimits + vec2(1.0, -1.0) / gl_FragCoord.w;
|
|
68
69
|
isClamped = vStippleDistance < aaCorrectedLimits.x || vStippleDistance > aaCorrectedLimits.y;
|
|
70
|
+
`:p`isClamped = false;`}
|
|
69
71
|
|
|
70
|
-
float u =
|
|
72
|
+
float u = stippleDistance * stipplePatternPixelSizeInv * lineSizeInv;
|
|
71
73
|
u = fract(u);
|
|
72
74
|
|
|
73
75
|
float sdf = texture(stipplePatternTexture, vec2(u, 0.5)).r;
|