@arcgis/core 4.31.0-next.20240708 → 4.31.0-next.20240710
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{0975e54c50383375cc09.js → 14cf7411e8318a1bccb9.js} +1 -1
- package/assets/esri/core/workers/chunks/{71852b8437ec66b9ef06.js → 2123ab24163a532ebc8d.js} +1 -1
- package/assets/esri/core/workers/chunks/{c91b3800cf3891bf2d59.js → 252ff37bf5e12dae0b18.js} +1 -1
- package/assets/esri/core/workers/chunks/2799007b5f3f4a2e364c.js +51 -0
- package/assets/esri/core/workers/chunks/{ff5e6d823d512f87a527.js → 2dddb8a989b9c96572fe.js} +1 -1
- package/assets/esri/core/workers/chunks/34b5bab6239c7277f854.js +1 -0
- package/assets/esri/core/workers/chunks/543f9db420c99d429637.js +1 -0
- package/assets/esri/core/workers/chunks/{5089a12084a8a8fb93d8.js → 61e5179fb49866241128.js} +1 -1
- package/assets/esri/core/workers/chunks/632e3ba2b8a881df29a0.js +1 -0
- package/assets/esri/core/workers/chunks/63eb1cc923bb8dcb3cb3.js +1 -0
- package/assets/esri/core/workers/chunks/{380e2654bc7e07163df0.js → 725a0eae5248a933db05.js} +1 -1
- package/assets/esri/core/workers/chunks/{1cc4a89c96a36d6b3d52.js → 7767559d56d16b644655.js} +1 -1
- package/assets/esri/core/workers/chunks/7baf288a07401f9e972d.js +1 -0
- package/assets/esri/core/workers/chunks/{43e83f4d827f59ff556a.js → 8087288f00dfdcc479b9.js} +1 -1
- package/assets/esri/core/workers/chunks/{a5fbe1c95e49093e5af4.js → 8cce4b218568638e6e64.js} +1 -1
- package/assets/esri/core/workers/chunks/{c7e2a97cb7bcd153bcef.js → 8e326def543268f8a08e.js} +1 -1
- package/assets/esri/core/workers/chunks/92cb45b18e151db007dc.js +1 -0
- package/assets/esri/core/workers/chunks/b2e8cc76381077b78d4c.js +1 -0
- package/assets/esri/core/workers/chunks/b6a8132708afcd988fa9.js +1 -0
- package/assets/esri/core/workers/chunks/{b4d850e82a8ae902d684.js → c44cc686774ff53c0a94.js} +1 -1
- package/assets/esri/core/workers/chunks/c52701477405c1fb2072.js +1 -0
- package/assets/esri/core/workers/chunks/{9ed11b9202013ca001ee.js → cfc2a1858a8bbb284979.js} +2 -2
- package/assets/esri/core/workers/chunks/{9ed11b9202013ca001ee.js.LICENSE.txt → cfc2a1858a8bbb284979.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/d9863289c69d2550cd49.js +1 -0
- package/assets/esri/core/workers/chunks/e1f4df3a5b0b31521b3c.js +1 -0
- package/assets/esri/core/workers/chunks/ee72a006e25e94a4cd4a.js +1039 -0
- package/assets/esri/core/workers/chunks/{61505947371cebab9cbe.js → fdebfe55cd097714ec11.js} +1 -1
- package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +13 -18
- 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/AtmosphereCompositing.glsl.js +6 -9
- package/chunks/BlendLayers.glsl.js +1 -7
- package/chunks/BlendWeights.glsl.js +81 -86
- package/chunks/Blur.glsl.js +1 -3
- package/chunks/ChapmanAtmosphere.glsl.js +3 -8
- package/chunks/CheckerBoard.glsl.js +3 -9
- package/chunks/Clouds.glsl.js +21 -10
- package/chunks/CloudsComposition.glsl.js +3 -7
- package/chunks/ColorMaterial.glsl.js +3 -9
- package/chunks/ComponentShader.glsl.js +41 -75
- package/chunks/Compositing.glsl.js +5 -7
- package/chunks/DefaultMaterial.glsl.js +68 -73
- package/chunks/EdgeDetect.glsl.js +29 -39
- package/chunks/EdgeShader.glsl.js +37 -60
- package/chunks/Fog.glsl.js +4 -9
- package/chunks/HUDCompositing.glsl.js +1 -3
- package/chunks/HUDMaterial.glsl.js +11 -20
- package/chunks/Heatmap.glsl.js +3 -11
- package/chunks/HeatmapDensity.glsl.js +12 -15
- package/chunks/HighlightApply.glsl.js +130 -174
- package/chunks/HighlightDownsample.glsl.js +29 -32
- package/chunks/ImageMaterial.glsl.js +11 -21
- package/chunks/LaserlinePath.glsl.js +6 -10
- package/chunks/Laserlines.glsl.js +8 -20
- package/chunks/LineCallout.glsl.js +91 -108
- package/chunks/LineMarker.glsl.js +62 -53
- package/chunks/Magnifier.glsl.js +4 -9
- package/chunks/MeasurementArrow.glsl.js +9 -15
- package/chunks/NativeLine.glsl.js +8 -12
- package/chunks/NoiseTextureAtlas.glsl.js +89 -86
- package/chunks/OITCompositing.glsl.js +8 -12
- package/chunks/OverlayCompositing.glsl.js +2 -4
- package/chunks/Path.glsl.js +31 -55
- package/chunks/Pattern.glsl.js +16 -20
- package/chunks/PointRenderer.glsl.js +39 -48
- package/chunks/Precipitation.glsl.js +22 -39
- package/chunks/RasterColorizer.glsl.js +25 -33
- package/chunks/RealisticTree.glsl.js +53 -65
- package/chunks/RibbonLine.glsl.js +31 -36
- package/chunks/SSAO.glsl.js +7 -10
- package/chunks/SSAOBlur.glsl.js +10 -14
- package/chunks/ShadedColorMaterial.glsl.js +12 -15
- package/chunks/ShadowCastAccumulate.glsl.js +6 -8
- package/chunks/ShadowCastVisualize.glsl.js +12 -18
- package/chunks/ShadowHighlight.glsl.js +49 -51
- package/chunks/SimpleAtmosphere.glsl.js +4 -13
- package/chunks/SlicePlaneMaterial.glsl.js +3 -7
- package/chunks/Stars.glsl.js +3 -7
- package/chunks/Terrain.glsl.js +20 -61
- package/chunks/TextureOnly.glsl.js +2 -4
- package/chunks/Viewshed.glsl.js +20 -38
- package/chunks/WaterSurface.glsl.js +34 -60
- package/core/accessorSupport/tracking.js +1 -1
- package/core/workers/registry.js +1 -1
- package/geometry/Circle.js +1 -1
- package/geometry/Polygon.js +1 -1
- package/geometry/Polyline.js +1 -1
- package/geometry/support/geodesicUtils.js +1 -1
- package/interfaces.d.ts +34 -4
- package/layers/WCSLayer.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/orientedImagery/transformations/imageToGroundUtils.js +1 -1
- package/layers/support/SubtypeSublayer.js +1 -1
- package/layers/support/rasterDatasets/WCSRaster.js +1 -1
- package/layers/support/rasterDatasets/multidimensionalUtils.js +1 -1
- package/layers/support/rasterDatasets/wcsCoverageParser.js +1 -1
- package/package.json +3 -3
- package/support/revision.js +1 -1
- package/views/2d/engine/flow/styles/Imagery.js +1 -1
- package/views/2d/engine/flow/styles/Particles.js +1 -1
- package/views/2d/engine/flow/styles/Streamlines.js +1 -1
- package/views/2d/engine/imagery/RasterVFDisplayObject.js +1 -1
- package/views/2d/engine/vectorTiles/RenderBucket.js +1 -1
- package/views/2d/engine/vectorTiles/shaders/VTLMaterial.js +1 -1
- package/views/2d/engine/webgl/BitBlitRenderer.js +1 -1
- package/views/2d/engine/webgl/DefaultVertexAttributeLayouts.js +1 -1
- package/views/2d/engine/webgl/Mesh2D.js +1 -1
- package/views/2d/engine/webgl/Overlay.js +1 -1
- package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
- package/views/2d/engine/webgl/Utils.js +1 -1
- package/views/2d/engine/webgl/VertexStream.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushStencil.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushTileDebugInfo.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushVTLBackground.js +1 -1
- package/views/2d/engine/webgl/cpuMapped/MappedMesh.js +1 -1
- package/views/2d/engine/webgl/effects/highlight/HighlightRenderer.js +1 -1
- package/views/2d/engine/webgl/mesh/MeshData.js +1 -1
- package/views/2d/engine/webgl/meshing/Mesh.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/ShaderBuilder2D.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/FeatureInstanceStore.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapTechnique.js +1 -1
- package/views/2d/layers/graphics/GraphicBoundsRenderer.js +1 -1
- package/views/2d/layers/support/DebugOverlay.js +1 -1
- package/views/2d/magnifier/MagnifierView2D.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/environment/LocalAtmosphere.js +1 -1
- package/views/3d/environment/MarsAtmosphere.js +1 -1
- package/views/3d/environment/Precipitation.js +1 -1
- package/views/3d/environment/Stars.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeTool3D.js +1 -1
- package/views/3d/interactive/editingTools/reshape/edgeOffsetUtils.js +1 -1
- package/views/3d/interactive/editingTools/reshape/reshapeTooltipUtils.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/extentUtils.js +1 -1
- package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
- package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/StreamLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DGraphicsPipeline.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +5 -0
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +5 -0
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +5 -0
- package/views/3d/layers/graphics/pipeline/PBFPointFeaturesView.js +5 -0
- package/views/3d/layers/graphics/pipeline/TestSymbol.js +5 -0
- package/views/3d/layers/graphics/pipeline/Tile.js +5 -0
- package/views/3d/layers/graphics/pipeline/Tile3DFetcher.js +5 -0
- package/views/3d/layers/graphics/pipeline/Tile3DProcessor.js +5 -0
- package/views/3d/layers/i3s/PointRenderer.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/layers/support/projectExtentUtils.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/PatchGeometryFactory.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TileCompositor.js +1 -1
- package/views/3d/webgl/ManagedFBObject.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js +3 -5
- package/views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +29 -59
- package/views/3d/webgl-engine/core/shaderLibrary/hud/HUDOcclusionPass.glsl.js +6 -12
- package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +11 -11
- package/views/3d/webgl-engine/core/shaderLibrary/shading/MarkerSizing.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/MultipassTerrainTest.glsl.js +4 -7
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceReflections.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/TextureTransformUV.glsl.js +6 -6
- package/views/3d/webgl-engine/core/shaderLibrary/shading/Water.glsl.js +4 -4
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/TileComposite.glsl.js +2 -4
- package/views/3d/webgl-engine/core/shaderLibrary/util/LocalFromScreenSpace.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js +1 -1
- package/views/3d/webgl-engine/effects/RenderNodes.js +1 -1
- package/views/3d/webgl-engine/effects/ScreenSpaceGeometry.js +1 -1
- package/views/3d/webgl-engine/effects/blit/Blit.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserlinePathData.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserlinePathTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/magnifier/MagnifierRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/lib/DrapedHeatmapRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/glUtil3D.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodComponentData.js +1 -1
- package/views/3d/webgl-engine/materials/DrawParameters.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoCache.js +1 -1
- package/views/3d/webgl-engine/shaders/Heatmap.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HighlightApply.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/OITCompositing.glsl.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/draw/support/Box.js +1 -1
- package/views/interactive/tooltip/Tooltip.js +1 -1
- package/views/interactive/tooltip/fields/fields.js +1 -1
- package/views/webgl/RenderingContext.js +1 -1
- package/views/webgl/Util.js +1 -1
- package/views/webgl/VertexArrayObject.js +1 -1
- package/views/webgl/enums.js +1 -1
- package/views/webgl/heatmapTextureUtils.js +1 -1
- package/views/webgl/testDoublePrecisionArithmetic.js +1 -1
- package/views/webgl/testFloatBufferBlend.js +1 -1
- package/views/webgl/testSVGPremultipliedAlpha.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileController.js +1 -1
- package/widgets/Feature/FeatureRelationship/FeatureRelationshipViewModel.js +1 -1
- package/widgets/Feature/support/relatedFeatureUtils.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/OrientedImageryViewer/constants.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
- package/widgets/UtilityNetworkTrace.js +1 -1
- package/widgets/support/TimezonePicker.js +1 -1
- package/assets/esri/core/workers/chunks/0cb2eb96ffb1dbed00eb.js +0 -1
- package/assets/esri/core/workers/chunks/0d6ed27fc9948f4ea061.js +0 -1
- package/assets/esri/core/workers/chunks/225b947ba4b2fcfd5630.js +0 -1
- package/assets/esri/core/workers/chunks/7c7c3068da3bf7467685.js +0 -1
- package/assets/esri/core/workers/chunks/812e18c65aa6e398c338.js +0 -1
- package/assets/esri/core/workers/chunks/85e5cdd723f68dec8c25.js +0 -1
- package/assets/esri/core/workers/chunks/a7e2ca5ede46395f0787.js +0 -1
- package/assets/esri/core/workers/chunks/aed0db145187d9eb52f2.js +0 -51
- package/assets/esri/core/workers/chunks/cf9a32a03b3d3b66effb.js +0 -1
- package/assets/esri/core/workers/chunks/d85c51abde781660b1f5.js +0 -1
- package/assets/esri/core/workers/chunks/e840e54455eb500b501d.js +0 -1098
- package/assets/esri/core/workers/chunks/fec53ce15ae52f8cb802.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../DisplayEntity.js";import e from"../DisplayRecord.js";import{VertexDataWriter as r}from"./VertexDataWriter.js";import i from"../util/Writer.js";class n{constructor(e,r=0){this._id=e,this._sizeHint=r,this._entityRecordCountOffset=0,this._entityCountOffset=0,this._entityIdIndex=0,this._entitySortKeyIndex=0,this._instanceIdToVertexData=new Map,this._recordIndexStart=0,this._recordIndexCount=0,this._recordVertexStart=0,this._recordVertexCount=0,this._current={metric:null,writer:null,start:0,sortKey:0,instanceId:0,layoutHash:0,indexStart:0,vertexStart:0,textureKey:0,metricBoxLenPointer:0},this._entities=new i(Uint32Array,this._sizeHint*t.byteSizeHint),this._entityCountOffset=this._entities.push(0)}get id(){return this._id}serialize(){const t=new Array,e=[],r=this._entities.buffer();for(const i of this._instanceIdToVertexData.values())e.push(i.serialize(t));return{message:{data:e,entities:r},transferList:t}}vertexCount(){return this._current.writer?.vertexCount??0}indexCount(){return this._current.writer?.indexCount??0}vertexEnsureSize(t){this._current.writer.vertexEnsureSize(t)}indexEnsureSize(t){this._current.writer.indexEnsureSize(t)}vertexWrite(t){this._current.writer.writeVertex(t)}vertexWriteRegion(t){this._current.writer.writeVertexRegion(t)}vertexWriteF32(t){this._current.writer.writeVertexF32(t)}recordBounds(t,e,r,i){}indexWrite(t){this._current.writer.writeIndex(t)}metricStart(t){this._current.metric=t}metricEnd(){const t=this._current.writer;this._current.metric.bounds.length&&t.writeMetric(this._current.metric)}metricBoxWrite(t){this._current.metric.bounds.push(t)}entityStart(t,e=t){this._entityIdIndex=this._entities.push(t),this._entitySortKeyIndex=this._entities.writeF32(e),this._entityRecordCountOffset=this._entities.push(0)}entityRecordCount(){return this._entities.getValue(this._entityRecordCountOffset)}entityEnd(){0===this.entityRecordCount()?this._entities.seek(this._entityIdIndex):this._entities.incr(this._entityCountOffset)}recordCount(){return this._entities.getValue(this._entityRecordCountOffset)}recordStart(t,e,r=0){this._current.writer=this._getVertexWriter(t,e),this._current.indexStart=this._current.writer.indexCount,this._current.vertexStart=this._current.writer.vertexCount,this._current.instanceId=t,this._current.layoutHash=e.hash,this._current.textureKey=r}recordEnd(t=0){const r=this._current.vertexStart,i=this._current.writer.vertexCount-r;if(!i)return!1;const n=this._current.indexStart,s=this._current.writer.indexCount-n;return this._recordIndexStart=n,this._recordIndexCount=s,this._recordVertexStart=r,this._recordVertexCount=i,this._entities.incr(this._entityRecordCountOffset),e.write(this._entities,this._current.instanceId,this._current.textureKey,n,s,r,i,t),!0}copyLast(t,r){const i=this._recordVertexStart+this._recordVertexCount;this._entities.incr(this._entityRecordCountOffset),e.write(this._entities,this._current.instanceId,this._current.textureKey,this._recordIndexStart+this._recordIndexCount,this._recordIndexCount,i,this._recordVertexCount,0);const n=this._current.writer.indexWriter,s=this._current.writer.vertexWriter,o=this._recordIndexStart+this._recordIndexCount,c=this._recordVertexCount;for(let e=this._recordIndexStart;e!==o;e++){const t=n.getValue(e);n.push(t+c)}const u=this._current.writer.layout.stride/Uint32Array.BYTES_PER_ELEMENT,h=this._recordVertexStart*u,_=(this._recordVertexStart+this._recordVertexCount)*u;for(let e=h;e!==_;e++){const t=s.getValue(e);s.push(t)}const d=this._current.writer.layout.position,a=d.packPrecisionFactor??1,x=d.offset/Uint32Array.BYTES_PER_ELEMENT,y=t*a,
|
|
5
|
+
import t from"../DisplayEntity.js";import e from"../DisplayRecord.js";import{VertexDataWriter as r}from"./VertexDataWriter.js";import i from"../util/Writer.js";class n{constructor(e,r=0){this._id=e,this._sizeHint=r,this._entityRecordCountOffset=0,this._entityCountOffset=0,this._entityIdIndex=0,this._entitySortKeyIndex=0,this._didEntityStart=!1,this._instanceIdToVertexData=new Map,this._recordIndexStart=0,this._recordIndexCount=0,this._recordVertexStart=0,this._recordVertexCount=0,this._current={metric:null,writer:null,start:0,sortKey:0,instanceId:0,layoutHash:0,indexStart:0,vertexStart:0,textureKey:0,metricBoxLenPointer:0},this._entities=new i(Uint32Array,this._sizeHint*t.byteSizeHint),this._entityCountOffset=this._entities.push(0)}get id(){return this._id}serialize(){const t=new Array,e=[],r=this._entities.buffer();for(const i of this._instanceIdToVertexData.values())e.push(i.serialize(t));return{message:{data:e,entities:r},transferList:t}}vertexCount(){return this._current.writer?.vertexCount??0}indexCount(){return this._current.writer?.indexCount??0}vertexEnsureSize(t){this._current.writer.vertexEnsureSize(t)}indexEnsureSize(t){this._current.writer.indexEnsureSize(t)}vertexWrite(t){this._current.writer.writeVertex(t)}vertexWriteRegion(t){this._current.writer.writeVertexRegion(t)}vertexWriteF32(t){this._current.writer.writeVertexF32(t)}recordBounds(t,e,r,i){}indexWrite(t){this._current.writer.writeIndex(t)}metricStart(t){this._current.metric=t}metricEnd(){const t=this._current.writer;this._current.metric.bounds.length&&t.writeMetric(this._current.metric)}metricBoxWrite(t){this._current.metric.bounds.push(t)}entityStart(t,e=t){this._entityIdIndex=this._entities.push(t),this._entitySortKeyIndex=this._entities.writeF32(e),this._entityRecordCountOffset=this._entities.push(0),this._didEntityStart=!0}entityRecordCount(){return this._entities.getValue(this._entityRecordCountOffset)}entityEnd(){if(!this._didEntityStart)return;0===this.entityRecordCount()?this._entities.seek(this._entityIdIndex):this._entities.incr(this._entityCountOffset),this._didEntityStart=!1}recordCount(){return this._entities.getValue(this._entityRecordCountOffset)}recordStart(t,e,r=0){this._current.writer=this._getVertexWriter(t,e),this._current.indexStart=this._current.writer.indexCount,this._current.vertexStart=this._current.writer.vertexCount,this._current.instanceId=t,this._current.layoutHash=e.hash,this._current.textureKey=r}recordEnd(t=0){const r=this._current.vertexStart,i=this._current.writer.vertexCount-r;if(!i)return!1;const n=this._current.indexStart,s=this._current.writer.indexCount-n;return this._recordIndexStart=n,this._recordIndexCount=s,this._recordVertexStart=r,this._recordVertexCount=i,this._entities.incr(this._entityRecordCountOffset),e.write(this._entities,this._current.instanceId,this._current.textureKey,n,s,r,i,t),!0}copyLast(t,r){const i=this._recordVertexStart+this._recordVertexCount;this._entities.incr(this._entityRecordCountOffset),e.write(this._entities,this._current.instanceId,this._current.textureKey,this._recordIndexStart+this._recordIndexCount,this._recordIndexCount,i,this._recordVertexCount,0);const n=this._current.writer.indexWriter,s=this._current.writer.vertexWriter,o=this._recordIndexStart+this._recordIndexCount,c=this._recordVertexCount;for(let e=this._recordIndexStart;e!==o;e++){const t=n.getValue(e);n.push(t+c)}const u=this._current.writer.layout.stride/Uint32Array.BYTES_PER_ELEMENT,h=this._recordVertexStart*u,_=(this._recordVertexStart+this._recordVertexCount)*u;for(let e=h;e!==_;e++){const t=s.getValue(e);s.push(t)}const d=this._current.writer.layout.position,a=d.packPrecisionFactor??1,x=d.offset/Uint32Array.BYTES_PER_ELEMENT,y=t*a,S=r*a;for(let e=i*u;e<=s.length;e+=u)s.i1616Add(e+x,y,S)}copyLastFrom(t,e,r){const i=t._entities.getValue(t._entityIdIndex);if(i!==this._entities.getValue(this._entityIdIndex)){const e=t._entities.getValueF32(t._entitySortKeyIndex);this.entityStart(i,e)}this.recordStart(t._current.instanceId,t._current.writer.layout,t._current.textureKey);const n=this._current.writer.layout.stride/Uint32Array.BYTES_PER_ELEMENT,s=this._current.vertexStart,o=t._current.vertexStart-s,c=this._current.writer.indexWriter,u=this._current.writer.vertexWriter,h=t._current.writer.indexWriter,_=t._current.writer.vertexWriter;for(let f=t._current.indexStart;f!==h.length;f++){const t=h.getValue(f);c.push(t-o)}for(let f=t._current.vertexStart*n;f!==_.length;f++){const t=_.getValue(f);u.push(t)}const d=this._current.writer.layout.position,a=d.packPrecisionFactor??1,x=d.offset/Uint32Array.BYTES_PER_ELEMENT,y=e*a,S=r*a;for(let f=s*n;f<=u.length;f+=n)u.i1616Add(f+x,y,S);this.recordEnd()}_getVertexWriter(t,e){const i=this._instanceIdToVertexData;return i.has(t)||i.set(t,new r(t,e,this._sizeHint)),i.get(t)}}export{n as MeshData};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{dataSizeInBytes as t}from"./definitions.js";import{BufferObject as r}from"../../../../webgl/BufferObject.js";import{Usage as
|
|
5
|
+
import{dataSizeInBytes as t}from"./definitions.js";import{BufferObject as r}from"../../../../webgl/BufferObject.js";import{Usage as e,DataType as s}from"../../../../webgl/enums.js";import{VertexArrayObject as o}from"../../../../webgl/VertexArrayObject.js";import{VertexElementDescriptor as n}from"../../../../webgl/VertexElementDescriptor.js";class i{constructor(t,i){this._boundPart=null;const a=[];for(const s of i.vertex){const o=r.createVertex(t,e.STATIC_DRAW,s);a.push(o)}const u=[];for(const s of i.index||[]){const o=r.createIndex(t,e.STATIC_DRAW,s);u.push(o)}this.groups=[];for(const r of i.groups){let e;if(null!=r.index){if(!i.index)throw new Error("No index data.");const{BYTES_PER_ELEMENT:t}=i.index[r.index];2===t?e=s.UNSIGNED_SHORT:4===t&&(e=s.UNSIGNED_INT)}const d=null!=r.index?u[r.index]:null,c=new Map,p=new Map,l=new Map;for(const t of r.attributes){const{name:r,count:e,type:s,offset:o,normalized:i,divisor:u,stride:d,vertex:f,location:h}=t,b=`vertex-buffer-${f}`;let x=p.get(b);x||(x=[],p.set(b,x));const m=new n(r,e,s,o,d,i,u);x.push(m),c.set(r,h),l.set(b,a[f])}const f=new o(t,c,p,l,d);this.groups.push({...r,vertexArray:f,locations:c,layout:p,indexing:e})}this.parts=i.parts}bind(t,r){this._boundPart=r;const{group:e}=this.parts[this._boundPart],{vertexArray:s}=this.groups[e];t.bindVAO(s)}draw(r){if(null==this._boundPart)throw new Error("Mesh.bind() has not been called.");const{start:e,count:s}=this.parts[this._boundPart],{group:o}=this.parts[this._boundPart],{indexing:n,primitive:i}=this.groups[o];n?r.drawElements(i,s,n,e*t[n]):r.drawArrays(i,e,s)}unbind(t){this._boundPart=null,t.bindVAO(null)}destroy(){for(const{vertexArray:t}of this.groups)t.dispose()}}export{i as Mesh};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../../core/Error.js";import"../../../../../core/has.js";import r from"../../../../../core/Logger.js";import{BindType as t}from"../../../../3d/webgl-engine/core/shaderTechnique/BindType.js";import{assert as n}from"../../../../3d/webgl-engine/lib/Util.js";const s=()=>r.getLogger("esri.views.3d.webgl-engine.core.shaderModules.shaderBuilder");class i{constructor(){this._includedModules=new Map}include(e,r){this._includedModules.has(e)?this._includedModules.get(e):(this._includedModules.set(e,r),e(this.builder,r))}}class o extends i{constructor(){super(...arguments),this.vertex=new u,this.fragment=new u,this.attributes=new m,this.varyings=new h,this.extensions=new l,this.constants=new d}get fragmentUniforms(){return this.fragment.uniforms.entries}get builder(){return this}generate(e,r=!0){const t=this.extensions.generateSource(e),n=this.attributes.generateSource(e),s=this.varyings.generateSource(e),i="vertex"===e?this.vertex:this.fragment,o=i.uniforms.generateSource(),a=i.code.generateSource(),c="vertex"===e?g:_(r),u=this.constants.generateSource().concat(i.constants.generateSource());return`${r?"#version 300 es":""}\n${t.join("\n")}\n${c}\n${u.join("\n")}\n${o.join("\n")}\n${n.join("\n")}\n${s.join("\n")}\n${a.join("\n")}`}generateBindPass(e){const r=new Map;this.vertex.uniforms.entries.forEach((e=>{const n=e.bind[t.Pass];n&&r.set(e.name,n)})),this.fragment.uniforms.entries.forEach((e=>{const n=e.bind[t.Pass];n&&r.set(e.name,n)}));const n=Array.from(r.values()),s=n.length;return(r,t)=>{for(let i=0;i<s;++i)n[i](e,r,t)}}generateBindDraw(e){const r=new Map;this.vertex.uniforms.entries.forEach((e=>{const n=e.bind[t.Draw];n&&r.set(e.name,n)})),this.fragment.uniforms.entries.forEach((e=>{const n=e.bind[t.Draw];n&&r.set(e.name,n)}));const n=Array.from(r.values()),s=n.length;return(r,t,i)=>{for(let o=0;o<s;++o)n[o](e,r,t
|
|
5
|
+
import e from"../../../../../core/Error.js";import"../../../../../core/has.js";import r from"../../../../../core/Logger.js";import{BindType as t}from"../../../../3d/webgl-engine/core/shaderTechnique/BindType.js";import{assert as n}from"../../../../3d/webgl-engine/lib/Util.js";const s=()=>r.getLogger("esri.views.3d.webgl-engine.core.shaderModules.shaderBuilder");class i{constructor(){this._includedModules=new Map}include(e,r){this._includedModules.has(e)?this._includedModules.get(e):(this._includedModules.set(e,r),e(this.builder,r))}}class o extends i{constructor(){super(...arguments),this.vertex=new u,this.fragment=new u,this.attributes=new m,this.varyings=new h,this.extensions=new l,this.constants=new d}get fragmentUniforms(){return this.fragment.uniforms.entries}get builder(){return this}generate(e,r=!0){const t=this.extensions.generateSource(e),n=this.attributes.generateSource(e),s=this.varyings.generateSource(e),i="vertex"===e?this.vertex:this.fragment,o=i.uniforms.generateSource(),a=i.code.generateSource(),c="vertex"===e?g:_(r),u=this.constants.generateSource().concat(i.constants.generateSource());return`${r?"#version 300 es":""}\n${t.join("\n")}\n${c}\n${u.join("\n")}\n${o.join("\n")}\n${n.join("\n")}\n${s.join("\n")}\n${a.join("\n")}`}generateBindPass(e){const r=new Map;this.vertex.uniforms.entries.forEach((e=>{const n=e.bind[t.Pass];n&&r.set(e.name,n)})),this.fragment.uniforms.entries.forEach((e=>{const n=e.bind[t.Pass];n&&r.set(e.name,n)}));const n=Array.from(r.values()),s=n.length;return(r,t)=>{for(let i=0;i<s;++i)n[i](e,r,t)}}generateBindDraw(e){const r=new Map;this.vertex.uniforms.entries.forEach((e=>{const n=e.bind[t.Draw];n&&r.set(e.name,n)})),this.fragment.uniforms.entries.forEach((e=>{const n=e.bind[t.Draw];n&&r.set(e.name,n)}));const n=Array.from(r.values()),s=n.length;return(r,t,i)=>{for(let o=0;o<s;++o)n[o](e,i,r,t)}}}class a{constructor(){this._entries=new Map}add(...e){for(const r of e)this._add(r)}get(e){return this._entries.get(e)}_add(r){if(null!=r){if(this._entries.has(r.name)&&!this._entries.get(r.name).equals(r))throw new e(`Duplicate uniform name ${r.name} for different uniform type`);this._entries.set(r.name,r)}else s().error(`Trying to add null Uniform from ${(new Error).stack}.`)}generateSource(){return Array.from(this._entries.values()).map((e=>null!=e.arraySize?`uniform ${e.type} ${e.name}[${e.arraySize}];`:`uniform ${e.type} ${e.name};`))}get entries(){return Array.from(this._entries.values())}}class c{constructor(){this._entries=new Array}add(e){this._entries.push(e)}generateSource(){return this._entries}}class u extends i{constructor(){super(...arguments),this.uniforms=new a,this.code=new c,this.constants=new d}get builder(){return this}}class m{constructor(){this._entries=new Array}add(e,r){this._entries.push([e,r])}generateSource(e){return"fragment"===e?[]:this._entries.map((e=>`in ${e[1]} ${e[0]};`))}}class h{constructor(){this._entries=new Map}add(e,r){this._entries.has(e)&&n(this._entries.get(e)===r),this._entries.set(e,r)}generateSource(e){const r=new Array;return this._entries.forEach(((t,n)=>r.push("vertex"===e?`out ${t} ${n};`:`in ${t} ${n};`))),r}}class l{constructor(){this._entries=new Set}add(e){this._entries.add(e)}generateSource(e){const r="vertex"===e?l.ALLOWLIST_VERTEX:l.ALLOWLIST_FRAGMENT;return Array.from(this._entries).filter((e=>r.includes(e))).map((e=>`#extension ${e} : enable`))}}l.ALLOWLIST_FRAGMENT=["GL_EXT_shader_texture_lod","GL_OES_standard_derivatives"],l.ALLOWLIST_VERTEX=[];class d{constructor(){this._entries=new Set}add(e,r,t){let n="ERROR_CONSTRUCTOR_STRING";switch(r){case"float":n=d._numberToFloatStr(t);break;case"int":n=d._numberToIntStr(t);break;case"bool":n=t.toString();break;case"vec2":n=`vec2(${d._numberToFloatStr(t[0])}, ${d._numberToFloatStr(t[1])})`;break;case"vec3":n=`vec3(${d._numberToFloatStr(t[0])}, ${d._numberToFloatStr(t[1])}, ${d._numberToFloatStr(t[2])})`;break;case"vec4":n=`vec4(${d._numberToFloatStr(t[0])}, ${d._numberToFloatStr(t[1])}, ${d._numberToFloatStr(t[2])}, ${d._numberToFloatStr(t[3])})`;break;case"ivec2":n=`ivec2(${d._numberToIntStr(t[0])}, ${d._numberToIntStr(t[1])})`;break;case"ivec3":n=`ivec3(${d._numberToIntStr(t[0])}, ${d._numberToIntStr(t[1])}, ${d._numberToIntStr(t[2])})`;break;case"ivec4":n=`ivec4(${d._numberToIntStr(t[0])}, ${d._numberToIntStr(t[1])}, ${d._numberToIntStr(t[2])}, ${d._numberToIntStr(t[3])})`;break;case"mat2":case"mat3":case"mat4":n=`${r}(${Array.prototype.map.call(t,(e=>d._numberToFloatStr(e))).join(", ")})`}return this._entries.add(`const ${r} ${e} = ${n};`),this}static _numberToIntStr(e){return e.toFixed(0)}static _numberToFloatStr(e){return Number.isInteger(e)?e.toFixed(1):e.toString()}generateSource(){return Array.from(this._entries)}}function _(e=!0){return`#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n precision highp sampler2D;\n#else\n precision mediump float;\n precision mediump sampler2D;\n#endif\n${e?"out vec4 fragColor;":""}\n`}const g="precision highp float;\nprecision highp sampler2D;";export{c as Code,i as Includes,o as ShaderBuilder2D,u as Stage,a as Uniforms};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{numericHash as t}from"../../../../../../core/string.js";import{FeatureTechniqueInstance as
|
|
5
|
+
import{numericHash as t}from"../../../../../../core/string.js";import{FeatureTechniqueInstance as n}from"./TechniqueInstance.js";import{castInstanceId as e}from"./mesh/instanceIdUtils.js";class s{constructor(){this._instanceById=new Map}destroy(){this._instanceById.clear()}get size(){return this._instanceById.size}entries(){return this._instanceById.entries()}updateStart(){this._instanceByIdNext=new Map}updateEnd(){if(!this._instanceByIdNext)throw new Error("InternalError: Found updateEnd call without corresponding updateStart");for(const t of this._instanceById.keys())this._instanceByIdNext.has(t)||this._instanceById.delete(t);for(const[t,n]of this._instanceByIdNext.entries()){const e=this._instanceById.get(t);e?e.setInput(n.getInput()):this._instanceById.set(t,n)}this._instanceByIdNext=null}values(){return this._instanceById.values()}ensureInstance(s,i){let r;if("object"==typeof i&&"optionalAttributes"in i&&"uniforms"in i){r=`${s.type}${JSON.stringify(i.optionalAttributes)}`;const t=i.uniforms;if("object"==typeof t)for(const n in t)r+=`${n}.${null!=t[n]}`}else r=`${s.type}.${JSON.stringify(i)}`;const a=t(r);if(this._instanceByIdNext){const t=new n(e(a),s,i);return this._instanceByIdNext.set(a,t),t}if(!this._instanceById.has(a)){const t=new n(e(a),s,i);this._instanceById.set(a,t)}return this._instanceById.get(a)}getInstance(t){return this._instanceById.get(t)}}export{s as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{tileSize as e,textureBindingRenderer0 as t,textureBindingRenderer1 as i}from"../../../definitions.js";import{FeatureTechnique as o}from"../FeatureTechnique.js";import{isHighlight as r,isHittest as s,getFeatureUniforms as n,getSelectionDefines as a,getFeaturePipelineState as l,getViewUniforms as d}from"../featureTechniqueUtils.js";import{TechniqueType as u}from"../TechniqueType.js";import{DotDensityPointShader as c}from"./DotDensityPointShader.js";import{DotDensityPolygonShader as p}from"./DotDensityPolygonShader.js";import{DotDensityResources as h}from"./DotDensityResources.js";import{FillShader as m}from"../shaders/FillShader.js";import{
|
|
5
|
+
import{tileSize as e,textureBindingRenderer0 as t,textureBindingRenderer1 as i}from"../../../definitions.js";import{FeatureTechnique as o}from"../FeatureTechnique.js";import{isHighlight as r,isHittest as s,getFeatureUniforms as n,getSelectionDefines as a,getFeaturePipelineState as l,getViewUniforms as d}from"../featureTechniqueUtils.js";import{TechniqueType as u}from"../TechniqueType.js";import{DotDensityPointShader as c}from"./DotDensityPointShader.js";import{DotDensityPolygonShader as p}from"./DotDensityPolygonShader.js";import{DotDensityResources as h}from"./DotDensityResources.js";import{FillShader as m}from"../shaders/FillShader.js";import{FramebufferBit as f}from"../../../../../../webgl/enums.js";class w extends o{constructor(){super(...arguments),this.type=u.DotDensity,this.shaders={polygon:new p,point:new c,fill:new m},this._resources=new Map}render(e,t){r(e)||s(e)?this._renderPolygons(e,t):this._renderDotDensity(e,t)}_renderPolygons(e,t){const{painter:i}=e;i.setShader({shader:this.shaders.fill,uniforms:{...n(e,t.target),visualVariableColor:null,visualVariableOpacity:null},defines:{...a(e)},optionalAttributes:{zoomRange:!1},useComputeBuffer:s(e)}),i.setPipelineState(l(e)),i.submitDraw(e,t)}_renderDotDensity(o,r){const{context:s,painter:u,requiredLevel:c}=o,p=r.instance.getInput().uniforms,h=this._getOrCreateResourcesRecord(s),m=h.getDotDensityTextures(s,e,p.seed),w=1/2**(c-r.target.key.level),g=e,x=g*window.devicePixelRatio*g*window.devicePixelRatio,D=1/w*(1/w),b=p.dotScale?o.state.scale/p.dotScale:1,y=p.dotValue*b*D;u.setShader({shader:this.shaders.polygon,uniforms:{...n(o,r.target),instance:{isActive:p.isActive,colors:p.colors,dotValue:Math.max(1,y)},draw:{dotTexture0:{unit:t,texture:m[0]},dotTexture1:{unit:i,texture:m[1]},tileZoomFactor:w,pixelRatio:window.devicePixelRatio,tileDotsOverArea:x/(e*window.devicePixelRatio*e*window.devicePixelRatio)}},defines:{...a(o),blending:p.blending},optionalAttributes:{},useComputeBuffer:!1}),u.setPipelineState(l(o));const P=s.getViewport();s.setViewport(0,0,e,e);const R=s.getBoundFramebufferObject(),S=h.getFBO(s);s.bindFramebuffer(S),s.setClearColor(0,0,0,0),u.setPipelineState({color:{write:[!0,!0,!0,!0],blendMode:"composite"},depth:!1,stencil:!1}),u.updatePipelineState(s),s.clear(f.COLOR),u.submitDraw(o,r),s.bindFramebuffer(R),s.setViewport(P.x,P.y,P.width,P.height);const v=h.getFBO(s).colorTexture;u.setShader({shader:this.shaders.point,uniforms:{view:d(o,r.target),instance:{dotSize:p.dotSize},draw:{locations:{unit:t,texture:v},tileZoomFactor:1,pixelRatio:window.devicePixelRatio}},defines:{...a(o)},optionalAttributes:{},useComputeBuffer:!1}),u.setPipelineState({color:{write:[!0,!0,!0,!0],blendMode:"composite"},depth:!1,stencil:!1}),u.submitDrawMesh(s,h.getDotDensityMesh(s))}shutdown(e){super.shutdown(e),this._resources.get(e)?.destroy(),this._resources.delete(e)}_getOrCreateResourcesRecord(e){let t=this._resources.get(e);return null==t&&(t=new h,this._resources.set(e,t)),t}}export{w as DotDensityTechnique};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{FeatureTechnique as e}from"../FeatureTechnique.js";import{isHighlight as t,isHittest as r,getFeatureUniforms as s,getSelectionDefines as i}from"../featureTechniqueUtils.js";import{TechniqueType as n}from"../TechniqueType.js";import{HeatmapResources as o}from"./HeatmapResources.js";import{HeatmapAccumulateShader as u}from"../shaders/HeatmapAccumulateShader.js";import{HeatmapResolveShader as a}from"../shaders/HeatmapResolveShader.js";import{CompareFunction as d,StencilOperation as l,
|
|
5
|
+
import{FeatureTechnique as e}from"../FeatureTechnique.js";import{isHighlight as t,isHittest as r,getFeatureUniforms as s,getSelectionDefines as i}from"../featureTechniqueUtils.js";import{TechniqueType as n}from"../TechniqueType.js";import{HeatmapResources as o}from"./HeatmapResources.js";import{HeatmapAccumulateShader as u}from"../shaders/HeatmapAccumulateShader.js";import{HeatmapResolveShader as a}from"../shaders/HeatmapResolveShader.js";import{CompareFunction as d,StencilOperation as l,FramebufferBit as c,TextureSamplingMode as h}from"../../../../../../webgl/enums.js";class p extends e{constructor(){super(...arguments),this.type=n.Heatmap,this.shaders={accumulate:new u,resolve:new a},this.postProcessingEnabled=!0,this._isBound=!1,this._resources=new Map,this.overrideStencilRef=f}shutdown(e){super.shutdown(e),this._resources.get(e)?.destroy(),this._resources.delete(e),this._prevFBO=null,this._unbind()}render(e,n){const{context:o,painter:u,state:a}=e,d=n.instance.getInput(),{isFieldActive:l}=d.uniforms,c=this._getOrCreateResourcesRecord(o),h=c.loadQualityProfile(o);if(t(e))return;r(e)||this._bind(e,c,d),u.setShader({shader:this.shaders.accumulate,uniforms:{...s(e,n.target),kernelControls:{radius:g(d,a),isFieldActive:l?1:0}},defines:{...i(e),...h.defines},optionalAttributes:{},useComputeBuffer:r(e)});const p=r(e)?w:_;u.setPipelineState(p),u.submitDraw(e,n)}postProcess(e,s){if(r(e)||t(e))return;const{context:i,painter:n}=e,o=this._resources.get(i);if(null==this._prevFBO||null==this._prevViewport||!o?.initialized)return;const{defines:u}=o.loadQualityProfile(i),{minDensity:a,maxDensity:d,radius:l}=s.getInput().uniforms,c=8,h=9,p=o.accumulateFramebuffer,m=o.resolveGradientTexture;n.setShader({shader:this.shaders.resolve,uniforms:{accumulatedDensity:{texture:{unit:c,texture:p.colorTexture},minAndInvRange:[a,1/(d-a)],normalization:3/(l*l*Math.PI)},gradient:{texture:{unit:h,texture:m}}},defines:u,optionalAttributes:{},useComputeBuffer:!1}),i.bindFramebuffer(this._prevFBO),i.setViewport(0,0,this._prevViewport.width,this._prevViewport.height),i.bindTexture(p.colorTexture,c),i.bindTexture(m,h),n.setPipelineState(b),n.submitDrawQuad(i),this._unbind()}_getOrCreateResourcesRecord(e){let t=this._resources.get(e);return null==t&&(t=new o,this._resources.set(e,t)),t}_unbind(){this._prevFBO=null,this._prevViewport=null,this._isBound=!1}_bind(e,t,r){if(this._isBound)return;const{context:s,state:i,pixelRatio:n}=e,o=s.getBoundFramebufferObject(),u=s.getViewport();this._prevFBO=o,this._prevViewport=u;const{gradient:a,gradientHash:d}=r.uniforms;t.ensureResolveGradientTexture(s,d,a);const{width:l,height:p}=u,f=m(g(r,i),n),_=l*f,w=p*f,b=t.ensureAccumulateFBO(s,_,w);s.blitFramebuffer(o,b,0,0,o.width,o.height,0,0,b.width,b.height,c.STENCIL,h.NEAREST),s.bindFramebuffer(b),s.setViewport(0,0,b.width,b.height),s.setColorMask(!0,!0,!0,!0),s.setClearColor(0,0,0,0),s.clear(c.COLOR),this._isBound=!0}}function m(e,t){const r=t>1.5?.25:.5;return e<1/(2*r)?1:r}function f(e){return e.key.level+1}const _={color:{write:[!0,!0,!0,!0],blendMode:"additive"},depth:!1,stencil:{write:!1,test:{ref:f,compare:d.GEQUAL,mask:255,op:{fail:l.KEEP,zFail:l.KEEP,zPass:l.REPLACE}}}},w={..._,stencil:!1},b={color:{write:[!0,!0,!0,!0],blendMode:"composite"},depth:!1,stencil:!1};function g(e,t){const{referenceScale:r,radius:s}=e.uniforms;return s*(0!==r?r/t.scale:1)}export{p as HeatmapTechnique};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{disposeMaybe as t}from"../../../../core/maybe.js";import{identity as e,multiply as r,translate as i,scale as s,rotate as o}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{fromValues as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{normalizeMapX as f}from"../../../../geometry/support/normalizeUtils.js";import{DisplayObject as m}from"../../engine/DisplayObject.js";import{createProgramDescriptor as c}from"../../engine/webgl/Utils.js";import{BufferObject as u}from"../../../webgl/BufferObject.js";import{BlendFactor as _,PrimitiveType as h,DataType as
|
|
5
|
+
import{disposeMaybe as t}from"../../../../core/maybe.js";import{identity as e,multiply as r,translate as i,scale as s,rotate as o}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{fromValues as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{normalizeMapX as f}from"../../../../geometry/support/normalizeUtils.js";import{DisplayObject as m}from"../../engine/DisplayObject.js";import{createProgramDescriptor as c}from"../../engine/webgl/Utils.js";import{BufferObject as u}from"../../../webgl/BufferObject.js";import{BlendFactor as _,PrimitiveType as h,DataType as p,Usage as d}from"../../../webgl/enums.js";import{VertexArrayObject as g}from"../../../webgl/VertexArrayObject.js";const v=Math.PI/180,x=4;class b extends m{constructor(t){super(),this._program=null,this._vao=null,this._vertexBuffer=null,this._indexBuffer=null,this._dvsMat3=a(),this._localOrigin={x:0,y:0},this._getBounds=t}destroy(){this._vao&&(this._vao.dispose(),this._vao=null,this._vertexBuffer=null,this._indexBuffer=null),this._program=t(this._program)}doRender(t){const{context:e}=t,r=this._getBounds();if(r.length<1)return;this._createShaderProgram(e),this._updateMatricesAndLocalOrigin(t),this._updateBufferData(e,r),e.setBlendingEnabled(!0),e.setDepthTestEnabled(!1),e.setStencilWriteMask(0),e.setStencilTestEnabled(!1),e.setBlendFunction(_.ONE,_.ONE_MINUS_SRC_ALPHA),e.setColorMask(!0,!0,!0,!0);const i=this._program;e.bindVAO(this._vao),e.useProgram(i),i.setUniformMatrix3fv("u_dvsMat3",this._dvsMat3),e.gl.lineWidth(1),e.drawElements(h.LINES,8*r.length,p.UNSIGNED_INT,0),e.bindVAO()}_createTransforms(){return{displayViewScreenMat3:a()}}_createShaderProgram(t){if(this._program)return;const e="precision highp float;\n uniform mat3 u_dvsMat3;\n\n attribute vec2 a_position;\n\n void main() {\n mediump vec3 pos = u_dvsMat3 * vec3(a_position, 1.0);\n gl_Position = vec4(pos.xy, 0.0, 1.0);\n }",r="precision mediump float;\n void main() {\n gl_FragColor = vec4(0.75, 0.0, 0.0, 0.75);\n }";this._program=t.programCache.acquire(e,r,y().attributes)}_updateMatricesAndLocalOrigin(t){const{state:a}=t,{displayMat3:m,size:c,resolution:u,pixelRatio:_,rotation:h,viewpoint:p}=a,d=v*h,{x:g,y:x}=p.targetGeometry,b=f(g,a.spatialReference);this._localOrigin.x=b,this._localOrigin.y=x;const y=_*c[0],B=_*c[1],M=u*y,j=u*B,A=e(this._dvsMat3);r(A,A,m),i(A,A,n(y/2,B/2)),s(A,A,l(c[0]/M,-B/j,1)),o(A,A,-d)}_updateBufferData(t,e){const{x:r,y:i}=this._localOrigin,s=2*x*e.length,o=new Float32Array(s),a=new Uint32Array(8*e.length);let n=0,l=0;for(const f of e)f&&(o[2*n]=f[0]-r,o[2*n+1]=f[1]-i,o[2*n+2]=f[0]-r,o[2*n+3]=f[3]-i,o[2*n+4]=f[2]-r,o[2*n+5]=f[3]-i,o[2*n+6]=f[2]-r,o[2*n+7]=f[1]-i,a[l]=n+0,a[l+1]=n+3,a[l+2]=n+3,a[l+3]=n+2,a[l+4]=n+2,a[l+5]=n+1,a[l+6]=n+1,a[l+7]=n+0,n+=4,l+=8);if(this._vertexBuffer?this._vertexBuffer.setData(o.buffer):this._vertexBuffer=u.createVertex(t,d.DYNAMIC_DRAW,o.buffer),this._indexBuffer?this._indexBuffer.setData(a):this._indexBuffer=u.createIndex(t,d.DYNAMIC_DRAW,a),!this._vao){const e=y();this._vao=new g(t,e.attributes,e.bufferLayouts,new Map([["geometry",this._vertexBuffer]]),this._indexBuffer)}}}const y=()=>c("bounds",{geometry:[{location:0,name:"a_position",count:2,type:p.FLOAT}]});export{b as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{disposeMaybe as e}from"../../../../core/maybe.js";import{identity as t,translate as r,scale as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{BufferObject as i}from"../../../webgl/BufferObject.js";import"../../../webgl/FramebufferObject.js";import"../../../../core/has.js";import"../../../webgl/checkWebGLError.js";import{DataType as o,BlendFactor as n,PrimitiveType as m,Usage as f}from"../../../webgl/enums.js";import"../../../webgl/GLObjectType.js";import"../../../webgl/Texture.js";import{VertexArrayObject as c}from"../../../webgl/VertexArrayObject.js";import{DisplayObject as h}from"../../engine/DisplayObject.js";import{VertexElementDescriptor as l}from"../../../webgl/VertexElementDescriptor.js";const
|
|
5
|
+
import{disposeMaybe as e}from"../../../../core/maybe.js";import{identity as t,translate as r,scale as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{BufferObject as i}from"../../../webgl/BufferObject.js";import"../../../webgl/FramebufferObject.js";import"../../../../core/has.js";import"../../../webgl/checkWebGLError.js";import{DataType as o,BlendFactor as n,PrimitiveType as m,Usage as f}from"../../../webgl/enums.js";import"../../../webgl/GLObjectType.js";import"../../../webgl/Texture.js";import{VertexArrayObject as c}from"../../../webgl/VertexArrayObject.js";import{DisplayObject as h}from"../../engine/DisplayObject.js";import{VertexElementDescriptor as l}from"../../../webgl/VertexElementDescriptor.js";const p=new Map([["geometry",[new l("a_PositionAndFlags",3,o.SHORT,0,6)]]]),_=new Map;_.set("a_PositionAndFlags",0);const g={vsPath:"debug/overlay",fsPath:"debug/overlay",attributes:_};class d extends h{constructor(e){super(),this._conf=e}static makeFlags(e,t){return e|t<<2}_createTransforms(){return{displayViewScreenMat3:a()}}doRender(e){this._updateTransforms(e),this._ensureResources(e);const{context:t}=e;t.useProgram(this._program),this._program.setUniformMatrix3fv("u_dvsMat3",this.transforms.displayViewScreenMat3),this._program.setUniform4fv("u_colors",this._conf.getColors(e)),this._program.setUniform1fv("u_opacities",this._conf.getOpacities(e));const{vertexData:r,indexData:s}=this._conf.getMesh(e);this._vertexBuffer.setData(r),this._indexBuffer.setData(s),t.bindVAO(this._vertexArray),t.setBlendingEnabled(!0),t.setBlendFunction(n.ONE,n.ONE_MINUS_SRC_ALPHA),t.setDepthTestEnabled(!1),t.setStencilTestEnabled(!1),t.setColorMask(!0,!0,!0,!0),t.drawElements(m.TRIANGLES,s.length,o.UNSIGNED_INT,0)}onDetach(){this._vertexArray=e(this._vertexArray)}_updateTransforms(e){t(this.transforms.displayViewScreenMat3),r(this.transforms.displayViewScreenMat3,this.transforms.displayViewScreenMat3,[-1,1]),s(this.transforms.displayViewScreenMat3,this.transforms.displayViewScreenMat3,[2/e.state.size[0],-2/e.state.size[1],1])}_ensureResources(e){const{context:t}=e;this._program||(this._program=e.painter.materialManager.getProgram(g)),this._vertexBuffer||(this._vertexBuffer=i.createVertex(t,f.STREAM_DRAW)),this._indexBuffer||(this._indexBuffer=i.createIndex(t,f.STREAM_DRAW)),this._vertexArray||(this._vertexArray=new c(t,_,p,new Map([["geometry",this._vertexBuffer]]),this._indexBuffer))}}export{d as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../request.js";import{createTask as r}from"../../../core/asyncUtils.js";import s from"../../../core/Handles.js";import{clamp as t}from"../../../core/mathUtils.js";import{destroyMaybe as i,abortMaybe as o,disposeMaybe as a}from"../../../core/maybe.js";import{watch as n,initial as l}from"../../../core/reactiveUtils.js";import{isSVG as h}from"../../../core/urlUtils.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{UpdatingHandles as u}from"../../../core/support/UpdatingHandles.js";import{DisplayObject as c}from"../engine/DisplayObject.js";import{Pos2us as d}from"../engine/webgl/DefaultVertexAttributeLayouts.js";import{WGLDrawPhase as _}from"../engine/webgl/enums.js";import{createMagnifierProgram as p,magnifierProgramTemplate as f}from"../engine/webgl/shaders/MagnifierPrograms.js";import{loadMagnifierResources as g}from"../../magnifier/resources.js";import{BufferObject as x}from"../../webgl/BufferObject.js";import{PrimitiveType as b,Usage as T,PixelFormat as y,TextureWrapMode as k,TextureSamplingMode as R}from"../../webgl/enums.js";import{Texture as v}from"../../webgl/Texture.js";import{TextureDescriptor as j}from"../../webgl/TextureDescriptor.js";import{VertexArrayObject as w}from"../../webgl/VertexArrayObject.js";class A extends c{constructor(){super(),this._handles=new s,this._resourcePixelRatio=1,this.updatingHandles=new u,this.visible=!1}destroy(){this._handles=i(this._handles),this._disposeRenderResources(),this._resourcesTask=o(this._resourcesTask)}get backgroundColor(){return this._backgroundColor}set backgroundColor(e){this._backgroundColor=e,this.requestRender()}get magnifier(){return this._magnifier}set magnifier(e){this._magnifier=e,this._handles.removeAll(),this._handles.add([n((()=>e.version),(()=>{this.visible=e.visible&&null!=e.position&&e.size>0,this.requestRender()}),l),n((()=>[e.maskUrl,e.overlayUrl]),(()=>this._reloadResources())),n((()=>e.size),(()=>{this._disposeRenderResources(),this.requestRender()}))])}_createTransforms(){return{displayViewScreenMat3:m()}}doRender(e){const r=e.context;if(!this._resourcesTask)return void this._reloadResources();if(e.drawPhase!==_.MAP||!this._canRender())return;this._updateResources(e);const s=this._magnifier;if(null==s.position)return;const i=e.pixelRatio,o=s.size*i,a=1/s.factor,n=Math.ceil(a*o);this._readbackTexture.resize(n,n);const{size:l}=e.state,h=i*l[0],m=i*l[1],u=.5*n,c=.5*n,d=t(i*s.position.x,u,h-u-1),p=t(m-i*s.position.y,c,m-c-1);r.setBlendingEnabled(!0);const f=d-u,g=p-c,x=this._readbackTexture;r.bindTexture(x,0),r.gl.copyTexImage2D(x.descriptor.target,0,x.descriptor.pixelFormat,f,g,n,n,0);const T=this.backgroundColor,y=T?[T.a*T.r/255,T.a*T.g/255,T.a*T.b/255,T.a]:[1,1,1,1],k=(d+s.offset.x*i)/h*2-1,R=(p-s.offset.y*i)/m*2-1,v=o/h*2,j=o/m*2,w=this._program;r.bindVAO(this._vertexArrayObject),r.bindTexture(this._overlayTexture,6),r.bindTexture(this._maskTexture,7),r.useProgram(w),w.setUniform4fv("u_background",y),w.setUniform1i("u_readbackTexture",0),w.setUniform1i("u_overlayTexture",6),w.setUniform1i("u_maskTexture",7),w.setUniform4f("u_drawPos",k,R,v,j),w.setUniform1i("u_maskEnabled",s.maskEnabled?1:0),w.setUniform1i("u_overlayEnabled",s.overlayEnabled?1:0),r.setStencilTestEnabled(!1),r.setColorMask(!0,!0,!0,!0),r.drawArrays(b.TRIANGLE_STRIP,0,4),r.bindVAO()}_canRender(){return this._mask&&this._overlay&&null!=this._magnifier}_reloadResources(){this._resourcesTask&&this._resourcesTask.abort();const s=null!=this._magnifier?this._magnifier.maskUrl:null,t=null!=this._magnifier?this._magnifier.overlayUrl:null;this._resourcesTask=r((async r=>{const i=null==s||null==t?g(r):null,o=null!=s?e(s,{responseType:"image",signal:r}).then((e=>e.data)):i.then((e=>e.mask)),a=null!=t?e(t,{responseType:"image",signal:r}).then((e=>e.data)):i.then((e=>e.overlay)),[n,l]=await Promise.all([o,a]);this._mask=n,this._overlay=l,this._disposeRenderResources(),this.requestRender()})),this.updatingHandles.addPromise(this._resourcesTask.promise)}_disposeRenderResources(){this._readbackTexture=a(this._readbackTexture),this._overlayTexture=a(this._overlayTexture),this._maskTexture=a(this._maskTexture),this._vertexArrayObject=a(this._vertexArrayObject),this._program=a(this._program)}_updateResources(e){if(e.pixelRatio!==this._resourcePixelRatio&&this._disposeRenderResources(),this._readbackTexture)return;const r=e.context;this._resourcePixelRatio=e.pixelRatio;const s=Math.ceil(this._magnifier.size*e.pixelRatio);this._program=p(r);const t=new Uint16Array([0,1,0,0,1,1,1,0]),i=f.attributes;this._vertexArrayObject=new w(r,i,d,
|
|
5
|
+
import e from"../../../request.js";import{createTask as r}from"../../../core/asyncUtils.js";import s from"../../../core/Handles.js";import{clamp as t}from"../../../core/mathUtils.js";import{destroyMaybe as i,abortMaybe as o,disposeMaybe as a}from"../../../core/maybe.js";import{watch as n,initial as l}from"../../../core/reactiveUtils.js";import{isSVG as h}from"../../../core/urlUtils.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{UpdatingHandles as u}from"../../../core/support/UpdatingHandles.js";import{DisplayObject as c}from"../engine/DisplayObject.js";import{Pos2us as d}from"../engine/webgl/DefaultVertexAttributeLayouts.js";import{WGLDrawPhase as _}from"../engine/webgl/enums.js";import{createMagnifierProgram as p,magnifierProgramTemplate as f}from"../engine/webgl/shaders/MagnifierPrograms.js";import{loadMagnifierResources as g}from"../../magnifier/resources.js";import{BufferObject as x}from"../../webgl/BufferObject.js";import{PrimitiveType as b,Usage as T,PixelFormat as y,TextureWrapMode as k,TextureSamplingMode as R}from"../../webgl/enums.js";import{Texture as v}from"../../webgl/Texture.js";import{TextureDescriptor as j}from"../../webgl/TextureDescriptor.js";import{VertexArrayObject as w}from"../../webgl/VertexArrayObject.js";class A extends c{constructor(){super(),this._handles=new s,this._resourcePixelRatio=1,this.updatingHandles=new u,this.visible=!1}destroy(){this._handles=i(this._handles),this._disposeRenderResources(),this._resourcesTask=o(this._resourcesTask)}get backgroundColor(){return this._backgroundColor}set backgroundColor(e){this._backgroundColor=e,this.requestRender()}get magnifier(){return this._magnifier}set magnifier(e){this._magnifier=e,this._handles.removeAll(),this._handles.add([n((()=>e.version),(()=>{this.visible=e.visible&&null!=e.position&&e.size>0,this.requestRender()}),l),n((()=>[e.maskUrl,e.overlayUrl]),(()=>this._reloadResources())),n((()=>e.size),(()=>{this._disposeRenderResources(),this.requestRender()}))])}_createTransforms(){return{displayViewScreenMat3:m()}}doRender(e){const r=e.context;if(!this._resourcesTask)return void this._reloadResources();if(e.drawPhase!==_.MAP||!this._canRender())return;this._updateResources(e);const s=this._magnifier;if(null==s.position)return;const i=e.pixelRatio,o=s.size*i,a=1/s.factor,n=Math.ceil(a*o);this._readbackTexture.resize(n,n);const{size:l}=e.state,h=i*l[0],m=i*l[1],u=.5*n,c=.5*n,d=t(i*s.position.x,u,h-u-1),p=t(m-i*s.position.y,c,m-c-1);r.setBlendingEnabled(!0);const f=d-u,g=p-c,x=this._readbackTexture;r.bindTexture(x,0),r.gl.copyTexImage2D(x.descriptor.target,0,x.descriptor.pixelFormat,f,g,n,n,0);const T=this.backgroundColor,y=T?[T.a*T.r/255,T.a*T.g/255,T.a*T.b/255,T.a]:[1,1,1,1],k=(d+s.offset.x*i)/h*2-1,R=(p-s.offset.y*i)/m*2-1,v=o/h*2,j=o/m*2,w=this._program;r.bindVAO(this._vertexArrayObject),r.bindTexture(this._overlayTexture,6),r.bindTexture(this._maskTexture,7),r.useProgram(w),w.setUniform4fv("u_background",y),w.setUniform1i("u_readbackTexture",0),w.setUniform1i("u_overlayTexture",6),w.setUniform1i("u_maskTexture",7),w.setUniform4f("u_drawPos",k,R,v,j),w.setUniform1i("u_maskEnabled",s.maskEnabled?1:0),w.setUniform1i("u_overlayEnabled",s.overlayEnabled?1:0),r.setStencilTestEnabled(!1),r.setColorMask(!0,!0,!0,!0),r.drawArrays(b.TRIANGLE_STRIP,0,4),r.bindVAO()}_canRender(){return this._mask&&this._overlay&&null!=this._magnifier}_reloadResources(){this._resourcesTask&&this._resourcesTask.abort();const s=null!=this._magnifier?this._magnifier.maskUrl:null,t=null!=this._magnifier?this._magnifier.overlayUrl:null;this._resourcesTask=r((async r=>{const i=null==s||null==t?g(r):null,o=null!=s?e(s,{responseType:"image",signal:r}).then((e=>e.data)):i.then((e=>e.mask)),a=null!=t?e(t,{responseType:"image",signal:r}).then((e=>e.data)):i.then((e=>e.overlay)),[n,l]=await Promise.all([o,a]);this._mask=n,this._overlay=l,this._disposeRenderResources(),this.requestRender()})),this.updatingHandles.addPromise(this._resourcesTask.promise)}_disposeRenderResources(){this._readbackTexture=a(this._readbackTexture),this._overlayTexture=a(this._overlayTexture),this._maskTexture=a(this._maskTexture),this._vertexArrayObject=a(this._vertexArrayObject),this._program=a(this._program)}_updateResources(e){if(e.pixelRatio!==this._resourcePixelRatio&&this._disposeRenderResources(),this._readbackTexture)return;const r=e.context;this._resourcePixelRatio=e.pixelRatio;const s=Math.ceil(this._magnifier.size*e.pixelRatio);this._program=p(r);const t=new Uint16Array([0,1,0,0,1,1,1,0]),i=f.attributes;this._vertexArrayObject=new w(r,i,d,new Map([["geometry",x.createVertex(r,T.STATIC_DRAW,t)]])),this._overlay.width=s,this._overlay.height=s;const o=new j;o.internalFormat=y.RGBA,o.wrapMode=k.CLAMP_TO_EDGE,o.samplingMode=R.NEAREST,o.flipped=!0,o.preMultiplyAlpha=!h(this._overlay.src)||!e.context.driverTest.svgPremultipliesAlpha.result,this._overlayTexture=new v(r,o,this._overlay),this._mask.width=s,this._mask.height=s,o.pixelFormat=o.internalFormat=y.ALPHA,this._maskTexture=new v(r,o,this._mask);const a=1/this._magnifier.factor;o.pixelFormat=o.internalFormat=y.RGBA,o.width=o.height=Math.ceil(a*s),o.samplingMode=R.LINEAR,o.flipped=!1,this._readbackTexture=new v(r,o)}}export{A as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{unitRGBAFromColor as e}from"../../../core/colorUtils.js";import t from"../../../core/Handles.js";import{clamp as s,lerp as i,smoothstep as r}from"../../../core/mathUtils.js";import{watch as a,syncAndInitial as o}from"../../../core/reactiveUtils.js";import{set as n}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{s as h,l as m,q as
|
|
5
|
+
import{unitRGBAFromColor as e}from"../../../core/colorUtils.js";import t from"../../../core/Handles.js";import{clamp as s,lerp as i,smoothstep as r}from"../../../core/mathUtils.js";import{watch as a,syncAndInitial as o}from"../../../core/reactiveUtils.js";import{set as n}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{s as h,l as m,q as c}from"../../../chunks/vec32.js";import{s as u}from"../../../chunks/vec42.js";import{ZEROS as d}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{earth as p}from"../../../geometry/support/Ellipsoid.js";import{AtmosphereType as l}from"./AtmosphereType.js";import{atmosphereHeight as _,innerAtmosphereDepth as f,computeInnerAltitudeFade as T}from"./atmosphereUtils.js";import{ChapmanAtmospherePassParameters as b,ChapmanAtmosphereTechnique as q}from"./ChapmanAtmosphereTechnique.js";import{ChapmanAtmosphereTechniqueConfiguration as g}from"./ChapmanAtmosphereTechniqueConfiguration.js";import{ColorFormat as v}from"../webgl/formats.js";import{createQuadVAO as w,Layout as P}from"../webgl-engine/lib/glUtil3D.js";import{applyTextureResizeModulo as x}from"../webgl-engine/lib/textureUtils.js";import{A as R}from"../../../chunks/AtmosphereCompositing.glsl.js";import{AtmosphereCompositingTechnique as j}from"../webgl-engine/shaders/AtmosphereCompositingTechnique.js";import{PrimitiveType as E}from"../../webgl/enums.js";import z from"../../../webscene/background/ColorBackground.js";class B{constructor(s,i){this._view=s,this._context=i,this.type=l.Realistic,this._handles=new t,this._compositingPassParameters=new R,this._passParameters=new b,this._rootTileElevationMin=NaN,this._lowerBoundEarthRadius=p.radius,this._fadeHaze=0,this._updateRadius(p.radius);const r=this._context.renderContext.rctx;this._updateRootTileElevationBounds(),this._handles.add([a((()=>this._view?.basemapTerrain?.rootTileElevationBounds),(()=>this._view?.basemapTerrain?this._updateRootTileElevationBounds():null)),a((()=>this._view?.basemapTerrain?.visibleElevationBounds),(()=>this._view?.basemapTerrain?this._updateVisibleElevationBounds():null)),a((()=>this._view?.environment.background),(t=>{const s=t instanceof z?e(t.color):d;h(this._passParameters.backgroundColor,s[0]*s[3],s[1]*s[3],s[2]*s[3])}),o)]);const n=new g;n.haze=!1,this._atmosphereTechnique=this._context.techniques.acquire(q,n),this._compositingTechnique=this._context.techniques.acquire(j,n),n.haze=!0,this._atmosphereHazeTechnique=this._context.techniques.acquire(q,n),this._compositingHazeTechnique=this._context.techniques.acquire(j,n),n.reduced=!0,n.haze=!1,this._atmosphereReducedTechnique=this._context.techniques.acquire(q,n),n.haze=!0,this._atmosphereHazeReducedTechnique=this._context.techniques.acquire(q,n),this._vao=w(r,P.Pos2Tex)}destroy(){this._handles.destroy(),this._compositingTechnique.release(),this._compositingHazeTechnique.release(),this._atmosphereTechnique.release(),this._atmosphereHazeTechnique.release(),this._atmosphereReducedTechnique.release(),this._atmosphereHazeReducedTechnique.release(),this._vao.dispose()}render(e,t){this._render(e,t?this._atmosphereTechnique:this._atmosphereReducedTechnique,t,!1)}renderHaze(e,t,s){this._fadeHaze=t,this._render(e,s?this._atmosphereHazeTechnique:this._atmosphereHazeReducedTechnique,s,!0)}_render(e,t,s,r){if(!e.bindParameters.mainDepth)return;const a=e.bindParameters.camera;this._update(a);const o=e.rctx,n=o.bindTechnique(t,e.bindParameters,this._passParameters),h=e.framebuffer;if(s)h.renderWithoutDepth((()=>this._renderCommon(n,o)));else{const t=o.getViewport(),s=m(a.eye)-p.radius;let c;if(s<_){const e=Math.min(1,Math.max(0,s/_));c=r?i(.4,.5,e):i(.2,.3,e)}else{const e=Math.min(1,Math.max(0,(s-_)/(15*_)));c=r?i(.5,1,e):i(.3,.6,e)}const u=x(Math.round(c*a.fullViewport[2])),d=x(Math.round(c*a.fullViewport[3]));o.setViewport(0,0,u,d);const l=this._context.fbos.acquire(u,d,r?"chapman haze":"chapman",v.RGBA);o.bindFramebuffer(l.fbo),o.clearFramebuffer([0,0,0,1],!0,!0),this._renderCommon(n,o),o.setViewport(t.x,t.y,t.width,t.height),this._compositingPassParameters.color=l.getTexture();const f=r?this._compositingHazeTechnique:this._compositingTechnique;o.bindTechnique(f,e.bindParameters,this._compositingPassParameters),h.renderWithoutDepth((()=>o.screen.draw())),l.release()}}_renderCommon(e,t){null!=this._vao&&(t.bindVAO(this._vao),e.assertCompatibleVertexAttributeLocations(this._vao),t.drawArrays(E.TRIANGLE_STRIP,0,4))}_updateRootTileElevationBounds(){const e=this._view.basemapTerrain.rootTileElevationBounds.min;e!==this._rootTileElevationMin&&(this._rootTileElevationMin=e,this._lowerBoundEarthRadius=p.radius,this._updateVisibleElevationBounds())}_updateVisibleElevationBounds(){const e=H(p.radius+this._view.basemapTerrain.visibleElevationBounds.min);e<this._lowerBoundEarthRadius&&this._updateRadius(e)}_updateRadius(e){this._lowerBoundEarthRadius=e,n(this._passParameters.radii,e,e+_),this._passParameters.innerFadeDistance=2*Math.sqrt((2*e-f)*f)}_update(e){if(!e)return;const t=c(e.eye),a=Math.sqrt(t),o=t-this._passParameters.radii[1]*this._passParameters.radii[1],n=s((a-this._passParameters.radii[0])/_,0,1);u(this._passParameters.heightParameters,a,t,o,n),this._passParameters.altitudeFade=T(a-this._lowerBoundEarthRadius),this._passParameters.hazeStrength=i(i(.6,1,r(9500,10500,a-p.radius)),1,this._fadeHaze)}}function H(e){return e*Math.cos(Math.PI/16/16)}export{B as ChapmanAtmosphere};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../core/has.js";import{lerp as t}from"../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{watch as r,syncAndInitial as i,initial as a,sync as o}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{l,c as d,o as u}from"../../../chunks/vec32.js";import{fromValues as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as m}from"../../../geometry/ellipsoidUtils.js";import{isMoon as c,isEarth as _,isMars as g}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as w}from"../../ViewingMode.js";import{AtmosphereType as f}from"./AtmosphereType.js";import{ChapmanAtmosphere as y}from"./ChapmanAtmosphere.js";import{CloudsComposition as v}from"./CloudsComposition.js";import{isReadyCloudsData as P,CloudsFading as R}from"./CloudsData.js";import{CloudsGenerator as x}from"./CloudsGenerator.js";import{FadeMode as b}from"./CloudsParameters.js";import{cloudPresets as A}from"./CloudsPresets.js";import{Fog as F,FogParameters as N}from"./Fog.js";import{LocalAtmosphere as W}from"./LocalAtmosphere.js";import j from"./MarsAtmosphere.js";import{Precipitation as E}from"./Precipitation.js";import{Stars as C}from"./Stars.js";import{weatherHeightLimit as M}from"./weather.js";import{SyncRenderPlugin as O,ConsumesDepth as z,ConsumesNone as T}from"../webgl-engine/effects/RenderPlugin.js";import{RenderSlot as S}from"../webgl-engine/lib/RenderSlot.js";let U=class extends O{constructor(e){super(e),this.produces=new Map([[S.OPAQUE_ENVIRONMENT,()=>!(null===this._atmosphere&&null===this._stars)],[S.TRANSPARENT_ENVIRONMENT,()=>!(null===this._atmosphere)]]),this._context=null,this._atmosphere=null,this._oldWeatherParameters=new L,this._newWeatherParameters=new L,this._fadedWeatherParameters=new L,this._weatherParameters=this._newWeatherParameters}initialize(){this.view._stage.addRenderPlugin(this)}destroy(){this.removeHandles(),this.uninitializeRenderContext(),null!=this.view?._stage&&this.view._stage.removeRenderPlugin(this),this._set("view",null)}get atmosphere(){return this._atmosphere}get _atmosphereType(){return null!=this.atmosphere?this.atmosphere.type:f.None}consumes(){return this._atmosphereType===f.Realistic?z:T}updateAnimation(e){return null!=this._precipitation&&this._precipitation.update(e)}get updating(){return null!=this._stars&&this._stars.updating||null!=this._clouds&&this._clouds.running}get weatherVisible(){return l(this.view.state.camera.eye)-m(this.view.spatialReference).radius<=M}get usedMemory(){return this._clouds?.usedMemory??0}get _stars(){const e=this.view,t=e.environment?.starsEnabled??!1,r=this._get("_stars");return t&&null!=this._context?null!=r?r:new C({view:e,requestRender:()=>this._setNeedsRender()}):(s(r),null)}get _precipitation(){const e=this._get("_precipitation");if(!this._precipitationEnabled||null==this._context)return s(e),null;const t=this.view,r=this._context;return null!=e&&e.context===r?e:(s(e),new E({context:r,view:t}))}get _clouds(){const e=this._get("_clouds");if(!this.weatherEnabled||null==this._context)return s(e),null;if(null!=e)return e;const t=this.view,r=this._context;return s(e),new x({context:r,view:t,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const e=this._get("_cloudsComposition");if(!this.weatherEnabled||null==this._context)return s(e),null;const t=this.view.state.viewingMode,r=this._context.renderContext.rctx,i=m(this.view.spatialReference).radius;return null!=e&&e.viewingMode===t&&e.planetRadius===i?e:(s(e),new v({rctx:r,viewingMode:t,planetRadius:i,requestRender:()=>this._setNeedsRender()}))}get _fog(){const e=this._get("_fog");if(!this.weatherEnabled||null==this._context)return s(e),null;if(null!=e)return e;const t=this.view,r=this._context,i=this._context.renderContext.rctx,a=this.view.state.viewingMode;return new F({context:r,view:t,rctx:i,viewingMode:a})}get weatherEnabled(){return!!this.view?.environmentManager?.weatherEnabled}get _precipitationEnabled(){return this.weatherEnabled&&("rainy"===this.view.environment.weather.type||"snowy"===this.view.environment.weather.type)}initializeRenderContext(e=null){this._context=e;const t=()=>this._setNeedsRender();this.addHandles([r((()=>({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled})),(e=>this._updateAtmosphere(e)),i),r((()=>this._stars),t),r((()=>this._precipitation),t),r((()=>this._clouds),(()=>this._updateWeather()),a),r((()=>this._fog),(()=>this._updateFogHaze()),a),r((()=>this.view.state.mode),(()=>this._setNeedsRender()),o),r((()=>this._weatherUpdateParameters),(()=>{this._updateWeather(),this._updateFogHaze()}),i)])}uninitializeRenderContext(){this._context=null,this._atmosphere=s(this._atmosphere),this._set("_stars",s(this._stars)),this._set("_precipitation",s(this._precipitation)),this._set("_clouds",s(this._clouds)),this._set("_cloudsComposition",s(this._cloudsComposition)),this._set("_fog",s(this._fog))}prepareRender(e){e.bindParameters.cloudsFade.data=P(this._clouds)?this._clouds:null,"local"!==this.view.viewingMode&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&(this._updateWeatherFading(e.bindParameters,e.time),e.bindParameters.cloudsFade.state===R.Finished&&null!=this._clouds&&0===this._clouds.coverage&&!1===this._clouds.running&&(this._clouds.destroyFrameBufferCube(),e.bindParameters.cloudsFade.data=null))}renderNode(e){switch(e.bindParameters.slot){case S.OPAQUE_ENVIRONMENT:this._stars?.render(e),null!=this.atmosphere&&(this.atmosphere.render(e,this.view?._stage?.renderer?.fullResolutionAtmosphere),this._cloudsComposition&&null!=e.bindParameters.cloudsFade.data&&(this.weatherVisible&&null!=this._clouds&&this._clouds.updateWeatherTile(),this._cloudsComposition.render(e)),e.bindParameters.cloudsFade.isFading&&this._context&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&this._context.requestRender());break;case S.TRANSPARENT_ENVIRONMENT:if(null!=this.atmosphere&&(this.atmosphere.renderHaze(e,this._weatherParameters.hazeAmount,this.view?._stage?.renderer?.fullResolutionAtmosphere),this._weatherParameters.fog.amount>0&&null!=this._fog&&this._fog.render(e,this._weatherParameters.fog),this._precipitation)){const t=this.view.environment.weather;"rainy"!==t.type&&"snowy"!==t.type||this._precipitation.render(e,t.precipitation,t.type)}}}updateLighting(e,t,s,r){this._context?.renderContext.bindParameters.updateLighting(e,t,s,r),this._context?.requestRender()}get _weatherUpdateParameters(){const e=this.weatherEnabled?this.view.environment.weather:null;return null==e?null:"rainy"===e.type||"snowy"===e.type?{type:e.type,weatherAdjustment:e.cloudCover,effect:e.precipitation}:{type:e.type,weatherAdjustment:"foggy"===e.type?e.fogStrength:e.cloudCover}}_updateWeatherFading(e,t){e.cloudsFade.updateFading(e.camera,this.view.state.mode,t,this.view.qualitySettings.fadeDuration),e.cloudsFade.updateParallax(e.camera),e.weatherFading&&(V(e),this._updateFogAtmoshpere(e))}_updateFogAtmoshpere(e){e.cloudsFade.fadeMode!==b.CROSS_FADE&&e.cloudsFade.fadeMode!==b.FADE_IN?this._fadeWeather(0):this._fadeWeather(e.cloudsFade.fadeFactor)}_fadeWeather(e){const{_newWeatherParameters:t,_oldWeatherParameters:s}=this;e>=1?this._weatherParameters=t:(this._fadedWeatherParameters.lerp(s,t,e),this._weatherParameters=this._fadedWeatherParameters)}_updateWeather(){const e=this._weatherUpdateParameters;null!=e&&null!=this._clouds&&(this._clouds.applyPreset(A[e.type],e.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){null!=this._context&&this._context.requestRender()}_updateFogHaze(){const e=this._weatherUpdateParameters;if(null==this._fog||null==e||null==this._context)return;const s=this._context.renderContext.bindParameters;switch(this._oldWeatherParameters.copyFrom(this._weatherParameters),e.type){case"foggy":this._newWeatherParameters.fog.strength=t(3e-5,.005,e.weatherAdjustment**3),d(this._newWeatherParameters.fog.color,k),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;case"rainy":this._newWeatherParameters.fog.strength=t(4e-6,2e-4,(e.effect??0)**3),d(this._newWeatherParameters.fog.color,q),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=0,this._setNeedsRender();break;case"snowy":this._newWeatherParameters.fog.strength=t(4e-6,2e-4,(e.effect??0)**3),d(this._newWeatherParameters.fog.color,k),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;default:this._newWeatherParameters.fog.strength=0,this._newWeatherParameters.fog.amount=0,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender()}s.weatherFading?this._fadeWeather(0):this._fadeWeather(1)}_updateAtmosphere(e){const t=this._selectAtmosphereType(e);if(t!==f.None&&this._context){if(!this._atmosphere||this._atmosphere.type!==t){this._atmosphere=s(this._atmosphere);const e=this._getAtmosphereClass(t);e&&(this._atmosphere=new e(this.view,this._context))}}else this._atmosphere=s(this._atmosphere);this._setNeedsRender()}_getAtmosphereClass(e){switch(e){case f.Realistic:return y;case f.Local:return W;case f.Mars:return j;default:case f.None:return null}}_selectAtmosphereType(e){const{enabled:t,viewingMode:s}=e;return!t||c(this.view.spatialReference)?f.None:s===w.Local?f.Local:null!=this._context&&_(this.view.spatialReference)?f.Realistic:g(this.view.spatialReference)?f.Mars:f.None}get test(){}};e([n({constructOnly:!0})],U.prototype,"view",void 0),e([n({readOnly:!0})],U.prototype,"atmosphere",null),e([n({readOnly:!0})],U.prototype,"_atmosphereType",null),e([n({type:Boolean,readOnly:!0})],U.prototype,"updating",null),e([n({readOnly:!0})],U.prototype,"weatherVisible",null),e([n()],U.prototype,"_context",void 0),e([n()],U.prototype,"_atmosphere",void 0),e([n({readOnly:!0})],U.prototype,"_stars",null),e([n({readOnly:!0})],U.prototype,"_precipitation",null),e([n({readOnly:!0})],U.prototype,"_clouds",null),e([n({readOnly:!0})],U.prototype,"_cloudsComposition",null),e([n({readOnly:!0})],U.prototype,"_fog",null),e([n({readOnly:!0})],U.prototype,"weatherEnabled",null),e([n({readOnly:!0})],U.prototype,"_precipitationEnabled",null),e([n({readOnly:!0})],U.prototype,"_weatherUpdateParameters",null),U=e([h("esri.views.3d.environment.EnvironmentRenderer")],U);class L{constructor(){this.fog=new N,this.hazeAmount=1}copyFrom(e){this.fog.amount=e.fog.amount,this.hazeAmount=e.hazeAmount,this.fog.strength=e.fog.strength,d(this.fog.color,e.fog.color)}lerp(e,s,r){this.fog.amount=t(e.fog.amount,s.fog.amount,r),this.hazeAmount=t(e.hazeAmount,s.hazeAmount,r),this.fog.strength=t(e.fog.strength,s.fog.strength,r),u(this.fog.color,e.fog.color,s.fog.color,r)}}function V(e){e.cloudsFade.fadeMode!==b.CROSS_FADE&&e.cloudsFade.fadeMode!==b.FADE_IN?e.fadeLighting(0):e.fadeLighting(e.cloudsFade.fadeFactor)}const q=p(.5,.5,.5),k=p(1.5,1.5,1.5);export{U as EnvironmentRenderer,L as WeatherParameters};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../core/has.js";import{lerp as t}from"../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{watch as r,syncAndInitial as i,initial as a,sync as o}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{l,c as d,o as u}from"../../../chunks/vec32.js";import{fromValues as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as m}from"../../../geometry/ellipsoidUtils.js";import{isMoon as c,isEarth as _,isMars as g}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as w}from"../../ViewingMode.js";import{AtmosphereType as f}from"./AtmosphereType.js";import{ChapmanAtmosphere as y}from"./ChapmanAtmosphere.js";import{CloudsComposition as v}from"./CloudsComposition.js";import{isReadyCloudsData as P,CloudsFading as R}from"./CloudsData.js";import{CloudsGenerator as x}from"./CloudsGenerator.js";import{FadeMode as b}from"./CloudsParameters.js";import{cloudPresets as A}from"./CloudsPresets.js";import{Fog as F,FogParameters as N}from"./Fog.js";import{LocalAtmosphere as W}from"./LocalAtmosphere.js";import j from"./MarsAtmosphere.js";import{Precipitation as E}from"./Precipitation.js";import{Stars as C}from"./Stars.js";import{weatherHeightLimit as M}from"./weather.js";import{SyncRenderPlugin as O,ConsumesDepth as z,ConsumesNone as T}from"../webgl-engine/effects/RenderPlugin.js";import{RenderSlot as S}from"../webgl-engine/lib/RenderSlot.js";let U=class extends O{constructor(e){super(e),this.produces=new Map([[S.OPAQUE_ENVIRONMENT,()=>null!=this._atmosphere||null!=this._stars],[S.TRANSPARENT_ENVIRONMENT,()=>null!=this._atmosphere]]),this._context=null,this._atmosphere=null,this._oldWeatherParameters=new L,this._newWeatherParameters=new L,this._fadedWeatherParameters=new L,this._weatherParameters=this._newWeatherParameters}initialize(){this.view._stage.addRenderPlugin(this)}destroy(){this.removeHandles(),this.uninitializeRenderContext(),null!=this.view?._stage&&this.view._stage.removeRenderPlugin(this),this._set("view",null)}get atmosphere(){return this._atmosphere}get _atmosphereType(){return null!=this.atmosphere?this.atmosphere.type:f.None}consumes(){return this._atmosphereType===f.Realistic?z:T}updateAnimation(e){return null!=this._precipitation&&this._precipitation.update(e)}get updating(){return!(!this._stars?.updating&&!this._clouds?.running)}get weatherVisible(){return l(this.view.state.camera.eye)-m(this.view.spatialReference).radius<=M}get usedMemory(){return this._clouds?.usedMemory??0}get _stars(){const e=this.view,t=e.environment?.starsEnabled??!1,r=this._get("_stars");return t&&null!=this._context?r??new C({view:e,requestRender:()=>this._setNeedsRender()}):(s(r),null)}get _precipitation(){const e=this._get("_precipitation");if(!this._precipitationEnabled||null==this._context)return s(e),null;const t=this.view,r=this._context;return null!=e&&e.context===r?e:(s(e),new E({context:r,view:t}))}get _clouds(){const e=this._get("_clouds");if(!this.weatherEnabled||null==this._context)return s(e),null;if(null!=e)return e;const t=this.view,r=this._context;return s(e),new x({context:r,view:t,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const e=this._get("_cloudsComposition");if(!this.weatherEnabled||null==this._context)return s(e),null;const t=this.view.state.viewingMode,r=this._context.renderContext.rctx,i=m(this.view.spatialReference).radius;return null!=e&&e.viewingMode===t&&e.planetRadius===i?e:(s(e),new v({rctx:r,viewingMode:t,planetRadius:i,requestRender:()=>this._setNeedsRender()}))}get _fog(){const e=this._get("_fog");if(!this.weatherEnabled||null==this._context)return s(e),null;if(null!=e)return e;const t=this.view,r=this._context,i=this._context.renderContext.rctx,a=this.view.state.viewingMode;return new F({context:r,view:t,rctx:i,viewingMode:a})}get weatherEnabled(){return!!this.view?.environmentManager?.weatherEnabled}get _precipitationEnabled(){return this.weatherEnabled&&("rainy"===this.view.environment.weather.type||"snowy"===this.view.environment.weather.type)}initializeRenderContext(e=null){this._context=e;const t=()=>this._setNeedsRender();this.addHandles([r((()=>({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled})),(e=>this._updateAtmosphere(e)),i),r((()=>this._stars),t),r((()=>this._precipitation),t),r((()=>this._clouds),(()=>this._updateWeather()),a),r((()=>this._fog),(()=>this._updateFogHaze()),a),r((()=>this.view.state.mode),(()=>this._setNeedsRender()),o),r((()=>this._weatherUpdateParameters),(()=>{this._updateWeather(),this._updateFogHaze()}),i)])}uninitializeRenderContext(){this._context=null,this._atmosphere=s(this._atmosphere),this._set("_stars",s(this._stars)),this._set("_precipitation",s(this._precipitation)),this._set("_clouds",s(this._clouds)),this._set("_cloudsComposition",s(this._cloudsComposition)),this._set("_fog",s(this._fog))}prepareRender(e){e.bindParameters.cloudsFade.data=P(this._clouds)?this._clouds:null,"local"!==this.view.viewingMode&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&(this._updateWeatherFading(e.bindParameters,e.time),e.bindParameters.cloudsFade.state===R.Finished&&null!=this._clouds&&0===this._clouds.coverage&&!1===this._clouds.running&&(this._clouds.destroyFrameBufferCube(),e.bindParameters.cloudsFade.data=null))}renderNode(e){switch(e.bindParameters.slot){case S.OPAQUE_ENVIRONMENT:this._stars?.render(e),null!=this.atmosphere&&(this.atmosphere.render(e,this.view?._stage?.renderer?.fullResolutionAtmosphere),this._cloudsComposition&&null!=e.bindParameters.cloudsFade.data&&(this.weatherVisible&&null!=this._clouds&&this._clouds.updateWeatherTile(),this._cloudsComposition.render(e)),e.bindParameters.cloudsFade.isFading&&this._context&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&this._context.requestRender());break;case S.TRANSPARENT_ENVIRONMENT:if(this.atmosphere&&(this.atmosphere.renderHaze(e,this._weatherParameters.hazeAmount,this.view?._stage?.renderer?.fullResolutionAtmosphere),this._weatherParameters.fog.amount>0&&null!=this._fog&&this._fog.render(e,this._weatherParameters.fog),this._precipitation)){const t=this.view.environment.weather;"rainy"!==t.type&&"snowy"!==t.type||this._precipitation.render(e,t.precipitation,t.type)}}}updateLighting(e,t,s,r){this._context?.renderContext.bindParameters.updateLighting(e,t,s,r),this._context?.requestRender()}get _weatherUpdateParameters(){const e=this.weatherEnabled?this.view.environment.weather:null;return null==e?null:"rainy"===e.type||"snowy"===e.type?{type:e.type,weatherAdjustment:e.cloudCover,effect:e.precipitation}:{type:e.type,weatherAdjustment:"foggy"===e.type?e.fogStrength:e.cloudCover}}_updateWeatherFading(e,t){e.cloudsFade.updateFading(e.camera,this.view.state.mode,t,this.view.qualitySettings.fadeDuration),e.cloudsFade.updateParallax(e.camera),e.weatherFading&&(V(e),this._updateFogAtmoshpere(e))}_updateFogAtmoshpere(e){e.cloudsFade.fadeMode!==b.CROSS_FADE&&e.cloudsFade.fadeMode!==b.FADE_IN?this._fadeWeather(0):this._fadeWeather(e.cloudsFade.fadeFactor)}_fadeWeather(e){const{_newWeatherParameters:t,_oldWeatherParameters:s}=this;e>=1?this._weatherParameters=t:(this._fadedWeatherParameters.lerp(s,t,e),this._weatherParameters=this._fadedWeatherParameters)}_updateWeather(){const e=this._weatherUpdateParameters;null!=e&&null!=this._clouds&&(this._clouds.applyPreset(A[e.type],e.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){null!=this._context&&this._context.requestRender()}_updateFogHaze(){const e=this._weatherUpdateParameters;if(null==this._fog||null==e||null==this._context)return;const s=this._context.renderContext.bindParameters;switch(this._oldWeatherParameters.copyFrom(this._weatherParameters),e.type){case"foggy":this._newWeatherParameters.fog.strength=t(3e-5,.005,e.weatherAdjustment**3),d(this._newWeatherParameters.fog.color,k),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;case"rainy":this._newWeatherParameters.fog.strength=t(4e-6,2e-4,(e.effect??0)**3),d(this._newWeatherParameters.fog.color,q),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=0,this._setNeedsRender();break;case"snowy":this._newWeatherParameters.fog.strength=t(4e-6,2e-4,(e.effect??0)**3),d(this._newWeatherParameters.fog.color,k),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;default:this._newWeatherParameters.fog.strength=0,this._newWeatherParameters.fog.amount=0,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender()}s.weatherFading?this._fadeWeather(0):this._fadeWeather(1)}_updateAtmosphere(e){const t=this._selectAtmosphereType(e);if(t!==f.None&&this._context){if(!this._atmosphere||this._atmosphere.type!==t){this._atmosphere=s(this._atmosphere);const e=this._getAtmosphereClass(t);e&&(this._atmosphere=new e(this.view,this._context))}}else this._atmosphere=s(this._atmosphere);this._setNeedsRender()}_getAtmosphereClass(e){switch(e){case f.Realistic:return y;case f.Local:return W;case f.Mars:return j;default:case f.None:return null}}_selectAtmosphereType(e){const{enabled:t,viewingMode:s}=e;return!t||c(this.view.spatialReference)?f.None:s===w.Local?f.Local:null!=this._context&&_(this.view.spatialReference)?f.Realistic:g(this.view.spatialReference)?f.Mars:f.None}get test(){}};e([n({constructOnly:!0})],U.prototype,"view",void 0),e([n({readOnly:!0})],U.prototype,"atmosphere",null),e([n({readOnly:!0})],U.prototype,"_atmosphereType",null),e([n({type:Boolean,readOnly:!0})],U.prototype,"updating",null),e([n({readOnly:!0})],U.prototype,"weatherVisible",null),e([n()],U.prototype,"_context",void 0),e([n()],U.prototype,"_atmosphere",void 0),e([n({readOnly:!0})],U.prototype,"_stars",null),e([n({readOnly:!0})],U.prototype,"_precipitation",null),e([n({readOnly:!0})],U.prototype,"_clouds",null),e([n({readOnly:!0})],U.prototype,"_cloudsComposition",null),e([n({readOnly:!0})],U.prototype,"_fog",null),e([n({readOnly:!0})],U.prototype,"weatherEnabled",null),e([n({readOnly:!0})],U.prototype,"_precipitationEnabled",null),e([n({readOnly:!0})],U.prototype,"_weatherUpdateParameters",null),U=e([h("esri.views.3d.environment.EnvironmentRenderer")],U);class L{constructor(){this.fog=new N,this.hazeAmount=1}copyFrom(e){this.fog.amount=e.fog.amount,this.hazeAmount=e.hazeAmount,this.fog.strength=e.fog.strength,d(this.fog.color,e.fog.color)}lerp(e,s,r){this.fog.amount=t(e.fog.amount,s.fog.amount,r),this.hazeAmount=t(e.hazeAmount,s.hazeAmount,r),this.fog.strength=t(e.fog.strength,s.fog.strength,r),u(this.fog.color,e.fog.color,s.fog.color,r)}}function V(e){e.cloudsFade.fadeMode!==b.CROSS_FADE&&e.cloudsFade.fadeMode!==b.FADE_IN?e.fadeLighting(0):e.fadeLighting(e.cloudsFade.fadeFactor)}const q=p(.5,.5,.5),k=p(1.5,1.5,1.5);export{U as EnvironmentRenderer,L as WeatherParameters};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{disposeMaybe as e}from"../../../core/maybe.js";import{copy as t}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{AtmosphereType as i}from"./AtmosphereType.js";import{S as o}from"../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as s}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as m,SimpleAtmosphereGeometry as a}from"./SimpleAtmosphereTechniqueConfiguration.js";import{earthAtmosphereTextureSimple as n}from"./resources/SimpleAtmosphereTexture.js";import{glLayout as p}from"../support/buffer/glUtil.js";import{newLayout as f}from"../support/buffer/InterleavedLayout.js";import{Default3D as c}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{createPolySphereData as u}from"../webgl-engine/lib/GeometryUtil.js";import{VertexArrayObject as h}from"../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as l}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as b}from"../../webgl/BufferObject.js";import{TextureWrapMode as g,PrimitiveType as j,Usage as
|
|
5
|
+
import{disposeMaybe as e}from"../../../core/maybe.js";import{copy as t}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{AtmosphereType as i}from"./AtmosphereType.js";import{S as o}from"../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as s}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as m,SimpleAtmosphereGeometry as a}from"./SimpleAtmosphereTechniqueConfiguration.js";import{earthAtmosphereTextureSimple as n}from"./resources/SimpleAtmosphereTexture.js";import{glLayout as p}from"../support/buffer/glUtil.js";import{newLayout as f}from"../support/buffer/InterleavedLayout.js";import{Default3D as c}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{createPolySphereData as u}from"../webgl-engine/lib/GeometryUtil.js";import{VertexArrayObject as h}from"../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as l}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as b}from"../../webgl/BufferObject.js";import{TextureWrapMode as g,PrimitiveType as j,Usage as w}from"../../webgl/enums.js";import{Texture as _}from"../../webgl/Texture.js";import{TextureDescriptor as x}from"../../webgl/TextureDescriptor.js";import{vertexCount as d}from"../../webgl/Util.js";class A{constructor(e,t){this.type=i.Local,this._configuration=new m,this._passParameters=new o,this._configuration.geometry=a.Cylinder,this._technique=t.techniques.acquire(s,this._configuration);const r=t.renderContext.rctx;this._vao=y(r),this._vaoCount=d(this._vao,"geometry");const p=new x;p.wrapMode=g.CLAMP_TO_EDGE,p.flipped=!0,p.width=1,p.height=512,this._passParameters.texture=new _(r,p,n)}destroy(){this._passParameters.texture=e(this._passParameters.texture),this._vao.dispose(),this._technique.release()}render(e){const t=e.rctx,r=t.bindTechnique(this._technique,e.bindParameters,this._passParameters);T(v,e.bindParameters.camera.viewMatrix),r.setUniformMatrix4fv("view",v),t.bindVAO(this._vao),r.assertCompatibleVertexAttributeLocations(this._vao),t.drawArrays(j.TRIANGLES,0,this._vaoCount)}renderHaze(){return!1}}function y(e){const t=u(1,2,!1),{data:r,indices:i}=t[0][1],o=P.createBuffer(i.length),s=o.position;for(let m=0;m<i.length;++m){const e=3*i[m%3==0?m+2:m%3==2?m-2:m];s.set(m,0,r[e]),s.set(m,1,r[e+1]),s.set(m,2,r[e+2])}return new h(e,c,new Map([["geometry",p(P)]]),new Map([["geometry",b.createVertex(e,w.STATIC_DRAW,o.buffer)]]))}function T(e,r){t(e,r),e[12]=0,e[13]=0,e[14]=0,e[15]=1}const v=r(),P=f().vec3f(l.POSITION);export{A as LocalAtmosphere};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{lerp as e,clamp as t}from"../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../core/maybe.js";import{watch as r,syncAndInitial as i}from"../../../core/reactiveUtils.js";import{lookAt as a}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as o}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{l as h,j as m,g as
|
|
5
|
+
import{lerp as e,clamp as t}from"../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../core/maybe.js";import{watch as r,syncAndInitial as i}from"../../../core/reactiveUtils.js";import{lookAt as a}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as o}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{l as h,j as m,g as p,p as c,b as u,q as l}from"../../../chunks/vec32.js";import{create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as d}from"../../../geometry/ellipsoidUtils.js";import{newFloatArray as f}from"../../../geometry/support/FloatArray.js";import{AtmosphereType as g}from"./AtmosphereType.js";import{computeInnerAltitudeFade as b,innerAtmosphereDepth as x}from"./atmosphereUtils.js";import{S as j}from"../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as R}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as V,SimpleAtmosphereGeometry as w}from"./SimpleAtmosphereTechniqueConfiguration.js";import{marsAtmosphereTextureSimple as A}from"./resources/MarsAtmosphereTexture.js";import{makePiecewiseLinearFunction as P}from"../support/mathUtils.js";import{glLayout as q}from"../support/buffer/glUtil.js";import{newLayout as y}from"../support/buffer/InterleavedLayout.js";import{Default3D as T}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{createQuadVAO as v}from"../webgl-engine/lib/glUtil3D.js";import{project as S}from"../webgl-engine/lib/Util.js";import{VertexArrayObject as M}from"../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as F}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as C}from"../../webgl/BufferObject.js";import{TextureWrapMode as U,PrimitiveType as W,Usage as I}from"../../webgl/enums.js";import{Texture as O}from"../../webgl/Texture.js";import{TextureDescriptor as D}from"../../webgl/TextureDescriptor.js";import{vertexCount as L}from"../../webgl/Util.js";const E=128,G=-x,H=0,N=50,k=()=>1-511/512,B=P([[50,.1015625],[500,.21875],[5e3,1-250/512],[5e4,.4140625]]);class z{constructor(e,t){this.view=e,this.type=g.Mars,this._passParameters=new j,this._vaoCount=0,this._texV1=1;const s=d(e.spatialReference);this._planetRadius=s.radius,this._outerRimWidth=s.outerAtmosphereRimWidth,this._innerRimFactor=(this._planetRadius+G)/this._planetRadius,this._middleRimFactor=(this._planetRadius+H)/this._planetRadius,this._outerRimFactor=(this._planetRadius+this._outerRimWidth)/this._planetRadius,this._texV0=H/this._outerRimWidth,this._texVScale=this._texV1-this._texV0,this._techniques=t.techniques;const a=t.renderContext.rctx;this._cameraChangeHandle=r((()=>this.view.state?.camera),(()=>t.requestRender()),i),this._vao=this._createRibbon(a),this._vaoCount=L(this._vao,"geometry"),this._fadeVao=v(a),this._fadeVaoCount=L(this._fadeVao,"geometry");const o=new D;o.wrapMode=U.CLAMP_TO_EDGE,o.flipped=!0,o.width=1,o.height=512,this._passParameters.texture=new O(a,o,A);const n=new V;n.geometry=w.Cone,this._coneTechnique=this._techniques.acquire(R,n),n.geometry=w.Underground,this._undergroundTechnique=this._techniques.acquire(R,n)}destroy(){this._coneTechnique.release(),this._undergroundTechnique.release(),this._cameraChangeHandle.remove(),this._passParameters.texture=s(this._passParameters.texture),this._fadeVao.dispose(),this._vao.dispose()}render(e){const t=e.bindParameters.camera;this._update(t);const s=e.rctx;this._passParameters.undergroundFadeAlpha<1&&(s.bindTechnique(this._coneTechnique,e.bindParameters,this._passParameters),s.bindVAO(this._vao),s.drawArrays(W.TRIANGLES,0,this._vaoCount)),this._passParameters.undergroundFadeAlpha>0&&(s.bindTechnique(this._undergroundTechnique,e.bindParameters,this._passParameters),s.bindVAO(this._fadeVao),s.drawArrays(W.TRIANGLE_STRIP,0,this._fadeVaoCount))}renderHaze(){}_update(s){const r=_(),i=this._planetRadius,a=h(s.eye),o=a-i;if(o<0){const e=Math.min(-o/5e3,1);this._passParameters.undergroundFadeAlpha=e}else this._passParameters.undergroundFadeAlpha=0;const p=Math.max(N,o),c=i+G;this._passParameters.innerScale=Y(i+p,i,c)-1,this._passParameters.altitudeFade=b(o),m(r,s.eye,(i+N)/a),J(r,s.center,s.up,i,this._passParameters.silhouette);const u=this._computeScreenRimWidth(s,r,s.up,this._passParameters.silhouette),l=k(),d=B(o);let f=this._texV0+l*this._texVScale,g=this._texV0+u*d*this._texVScale;if(o>N){J(s.eye,s.center,s.up,i,this._passParameters.silhouette);const r=this._computeScreenRimWidth(s,s.eye,s.up,this._passParameters.silhouette),a=t((r-1.5)/(u-1.5),0,1);f=this._texV0+a*l*this._texVScale,g=this._texV0+e(this._texV1,u*d,a)*this._texVScale}n(this._passParameters.texV,f,g)}_createRibbon(e){const t=f(3+3*E*3),s=new Uint32Array(3*E*5);t[0]=0,t[1]=0,t[2]=-1;for(let a=0;a<E;a++){const e=9*a+3;t[e]=a,t[e+1]=this._innerRimFactor,t[e+2]=-1,t[e+3]=a,t[e+4]=this._middleRimFactor,t[e+5]=0,t[e+6]=a,t[e+7]=this._outerRimFactor,t[e+8]=1;const r=3*a+1,i=a===E-1?1:r+3,o=15*a;s[o]=r,s[o+1]=r+1,s[o+2]=i+1,s[o+3]=i+1,s[o+4]=i,s[o+5]=r,s[o+6]=r+1,s[o+7]=r+2,s[o+8]=i+2,s[o+9]=i+2,s[o+10]=i+1,s[o+11]=r+1,s[o+12]=r,s[o+13]=i,s[o+14]=0}const r=Z.createBuffer(s.length),i=r.position;for(let a=0;a<s.length;++a){const e=3*s[a];i.set(a,0,t[e]),i.set(a,1,t[e+1]),i.set(a,2,t[e+2])}return new M(e,T,new Map([["geometry",q(Z)]]),new Map([["geometry",C.createVertex(e,I.STATIC_DRAW,r.buffer)]]))}_computeScreenRimWidth(e,t,s,r){return p(Q,r.center,r.v2),m(X,Q,this._outerRimFactor),a(K,t,Q,s),S(Q,K,e.projectionMatrix,e.viewport,Q),S(X,K,e.projectionMatrix,e.viewport,X),c(Q,X)/e.height}}function J(e,t,s,r,i){const a=h(e),o=r*Math.sqrt(a*a-r*r)/a,n=Math.sqrt(r*r-o*o),p=i.v1,c=i.v2;return m(i.center,e,n/a),u(p,e,t),l(p)<1&&u(p,e,s),m(p,p,o/h(p)),u(c,p,e),m(c,c,o/h(c)),o}const K=o(),Q=_(),X=_();function Y(e,t,s){return e*e/(Math.sqrt(e*e-t*t)*Math.sqrt(e*e-s*s)+t*s)}const Z=y().vec3f(F.POSITION);export{z as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{lerp as i}from"../../../core/mathUtils.js";import{releaseMaybe as s,disposeMaybe as r}from"../../../core/maybe.js";import{secondsFromMilliseconds as n}from"../../../core/time.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{getReferenceEllipsoid as c}from"../../../geometry/ellipsoidUtils.js";import{PrecipitationPassParameters as h,PrecipitationTechnique as u,attributeLocations as m}from"./PrecipitationTechnique.js";import{PrecipitationTechniqueConfiguration as p,PrecipitationType as _}from"./PrecipitationTechniqueConfiguration.js";import{glLayout as d}from"../support/buffer/glUtil.js";import{newLayout as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{lerp as i}from"../../../core/mathUtils.js";import{releaseMaybe as s,disposeMaybe as r}from"../../../core/maybe.js";import{secondsFromMilliseconds as n}from"../../../core/time.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{getReferenceEllipsoid as c}from"../../../geometry/ellipsoidUtils.js";import{PrecipitationPassParameters as h,PrecipitationTechnique as u,attributeLocations as m}from"./PrecipitationTechnique.js";import{PrecipitationTechniqueConfiguration as p,PrecipitationType as _}from"./PrecipitationTechniqueConfiguration.js";import{glLayout as d}from"../support/buffer/glUtil.js";import{newLayout as f}from"../support/buffer/InterleavedLayout.js";import{AnimationTimer as l}from"../webgl-engine/lib/AnimationTimer.js";import{VertexArrayObject as w}from"../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as T}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as b}from"../../webgl/BufferObject.js";import{PrimitiveType as q,Usage as j}from"../../webgl/enums.js";import{bindVertexBufferLayout as y,unbindVertexBufferLayout as I}from"../../webgl/Util.js";let g=class extends t{constructor(e){super(e),this._numParticles=25e4,this._rainSpeed=.1,this._snowSpeed=.01,this._passParameters=new h,this._animation=new l,this._passParameters.time=0,this._passParameters.radius=c(e.view.spatialReference).radius,this._techniques=e.context.techniques}destroy(){this._numParticles=0,this._snowTechniqueCached=s(this._snowTechniqueCached),this._rainTechniqueCached=s(this._rainTechniqueCached),this._vao=r(this._vao),this._instanceIdBuffer=r(this._instanceIdBuffer)}get _rainTechnique(){if(null==this._rainTechniqueCached){const e=new p;e.type=_.Rain,this._rainTechniqueCached=this._techniques.acquire(u,e)}return this._rainTechniqueCached}get _snowTechnique(){if(null==this._snowTechniqueCached){const e=new p;e.type=_.Snow,this._snowTechniqueCached=this._techniques.acquire(u,e)}return this._snowTechniqueCached}update(e){return this._animation.advance(e)}render(e,t,s){const r="rainy"===s?this._rainTechnique:this._snowTechnique;if(!r.compiled)return void this.context.requestRender();const o=e.rctx;if(this._ensureResources(o),null==this._vao||null==this._instanceIdBuffer)return;if(null!=e.bindParameters.cloudsFade.data&&(this._passParameters.opacity=e.bindParameters.cloudsFade.opacity),this._passParameters.opacity<=0)return;const a=.35;t=t<.5?i(0,a,2*t):i(a,1,2*(t-.5)),this._passParameters.time=("rainy"===s?this._rainSpeed:this._snowSpeed)*n(this._animation.time)%1e5;const c=o.bindTechnique(r,e.bindParameters,this._passParameters);o.bindVAO(this._vao),c.assertCompatibleVertexAttributeLocations(this._vao),y(o,m,this._instanceIdBuffer,v,0),o.drawArraysInstanced(q.TRIANGLES,0,3,this._numParticles*t),I(o,m,this._instanceIdBuffer,v)}_ensureResources(e){this._vao??=P(e),this._instanceIdBuffer??=this._createInstanceIndices(e)}_createInstanceIndices(e){const t=[];for(let i=0;i<this._numParticles;i++)t.push(i);return b.createVertex(e,j.STATIC_DRAW,new Float32Array(t))}};function P(e){const t=new Float32Array([-1,0,1,1,0,-1,1,0,1]);return new w(e,m,new Map([["geometry",d(A)]]),new Map([["geometry",b.createVertex(e,j.STATIC_DRAW,t)]]))}e([o({constructOnly:!0})],g.prototype,"context",void 0),e([o({constructOnly:!0})],g.prototype,"view",void 0),g=e([a("esri.views.3d.environment.Precipitation")],g);const A=f().vec3f(T.POSITION),v=d(f().f32(T.INSTANCEFEATUREATTRIBUTE),1);export{g as Precipitation};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../chunks/tslib.es6.js";import{fetchAsset as e}from"../../../assets.js";import s from"../../../core/Accessor.js";import{createTask as r}from"../../../core/asyncUtils.js";import i from"../../../core/Error.js";import o from"../../../core/Logger.js";import{abortMaybe as a,releaseMaybe as n,disposeMaybe as f}from"../../../core/maybe.js";import{isAbortError as c}from"../../../core/promiseUtils.js";import{initial as u}from"../../../core/reactiveUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{copy as m,rotateZ as h,multiply as p}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{fromValues as g}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{UpdatingHandles as b}from"../../../core/support/UpdatingHandles.js";import{StarPassParameters as _,StarsTechnique as v}from"./StarsTechnique.js";import{glLayout as w}from"../support/buffer/glUtil.js";import{newLayout as y}from"../support/buffer/InterleavedLayout.js";import{Default3D as j}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{VertexArrayObject as T}from"../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as P}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as k}from"../../webgl/BufferObject.js";import{PrimitiveType as q,Usage as D}from"../../webgl/enums.js";let
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import{fetchAsset as e}from"../../../assets.js";import s from"../../../core/Accessor.js";import{createTask as r}from"../../../core/asyncUtils.js";import i from"../../../core/Error.js";import o from"../../../core/Logger.js";import{abortMaybe as a,releaseMaybe as n,disposeMaybe as f}from"../../../core/maybe.js";import{isAbortError as c}from"../../../core/promiseUtils.js";import{initial as u}from"../../../core/reactiveUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{copy as m,rotateZ as h,multiply as p}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{fromValues as g}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{UpdatingHandles as b}from"../../../core/support/UpdatingHandles.js";import{StarPassParameters as _,StarsTechnique as v}from"./StarsTechnique.js";import{glLayout as w}from"../support/buffer/glUtil.js";import{newLayout as y}from"../support/buffer/InterleavedLayout.js";import{Default3D as j}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{VertexArrayObject as T}from"../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as P}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as k}from"../../webgl/BufferObject.js";import{PrimitiveType as q,Usage as D}from"../../webgl/enums.js";let M=class extends s{get updating(){return this._updatingTracking.updating||this.loading}get loading(){return null!=this._loadDataTask&&!this._loadDataTask.finished}constructor(t){super(t),this._loadDataTask=null,this._numPoints=0,this._passParameters=new _,this._updatingTracking=new b}initialize(){this._loadDataTask=this._createLoadDataTask()}destroy(){this._loadDataTask=a(this._loadDataTask),this._updatingTracking.destroy(),this._numPoints=0,this._technique=n(this._technique),this._vao=f(this._vao),F=null}render(t){const{rctx:e}=t;if(this._ensureResources(e),null==this._technique||null==this._vao)return;if(!this._technique.compiled)return void this.requestRender();const s=e.bindTechnique(this._technique,t.bindParameters,this._passParameters);e.bindVAO(this._vao),s.assertCompatibleVertexAttributeLocations(this._vao),e.drawArrays(q.POINTS,0,this._numPoints)}_ensureResources(t){if(null!=this._technique||null==F)return;this._technique=new v({rctx:t,viewingMode:this.view.state.viewingMode}),this._numPoints=F.byteLength/V;const e=new Float32Array(F,0,2*this._numPoints),s=new Uint8Array(F,2*this._numPoints*4,this._numPoints);this._vao=x(t,e,s,this._numPoints),this._updatingTracking.add((()=>"virtual"!==this.view.environment.lighting.type?this.view.environment.lighting.date:null),(t=>this._update(t)),u)}_update(t){if(!t)return;const e=(t.getHours()/12+t.getMinutes()/60*(2/24)+t.getSeconds()/60*(2/1440)-.9972222)%2,s=2*A(t),r=m(this._passParameters.modelMatrix,U);h(r,r,-s*Math.PI),p(r,S,r),h(r,r,-e*Math.PI),this.requestRender()}_createLoadDataTask(){if(null!=F)return null;const t=r((async t=>{const{data:s}=await e("esri/views/3d/environment/resources/stars.wsv",{responseType:"array-buffer",signal:t});I(s),F=s}));return t.promise.catch((t=>{c(t)||o.getLogger(this).error(t)})).then((()=>{this.destroyed||(this.requestRender(),this.notifyChange("updating"))})),t}};function x(t,e,s,r){const i=C.createBuffer(r),o=i.position,a=i.color,n=i.size;for(let f=0;f<r;f++){const t=e[2*f],r=e[2*f+1];o.set(f,0,-Math.cos(t)*Math.sin(r)),o.set(f,1,-Math.sin(t)*Math.sin(r)),o.set(f,2,-Math.cos(r));const i=O(s[f]),c=L(R[i[1]]);a.set(f,0,255*c[0]),a.set(f,1,255*c[1]),a.set(f,2,255*c[2]),a.set(f,3,255),n.set(f,i[0])}return new T(t,j,new Map([["geometry",w(C)]]),new Map([["geometry",k.createVertex(t,D.STATIC_DRAW,i.buffer)]]))}function A(t){const e=t,s=new Date(t.getFullYear(),0,1,11,58,56);return(+e-+s)/(+new Date(t.getFullYear()+1,0,1,11,58,55)-+s)}function I(t){if(!t)throw new i("stars:no-data-received","Failed to create stars because star catalogue is missing");const e=t.byteLength/V;if(e%1!=0||e>5e4||e<5e3)throw new i("stars:invalid-data","Failed to create stars because star catalogue data is invalid")}function L(t){return[parseInt(t.substring(0,2),16),parseInt(t.substring(2,4),16),parseInt(t.substring(4,6),16)]}function O(t){return t>=192?[2.9,t-192]:t>=160?[2.5,t-160]:t>=128?[2,t-128]:t>=96?[1.5,t-96]:t>=64?[1,t-64]:t>=32?[.7,t-32]:[.4,t]}t([l({constructOnly:!0})],M.prototype,"view",void 0),t([l({constructOnly:!0})],M.prototype,"requestRender",void 0),t([l({readOnly:!0})],M.prototype,"updating",null),t([l()],M.prototype,"_loadDataTask",void 0),t([l()],M.prototype,"_updatingTracking",void 0),M=t([d("esri.views.3d.environment.Stars")],M);const R=["9bb2ff","9eb5ff","aabfff","bbccff","ccd8ff ","dae2ff","e4e9ff","eeefff","f8f6ff","fff9fb","fff5ef","fff1e5","ffeddb","ffe9d2","ffe6ca","ffe3c3","ffe0bb","ffddb4","ffdaad","ffd6a5","ffd29c","ffcc8f","ffc178","ffa94b","ff7b00"],S=g(1,0,0,0,0,.9174771405229186,.39778850739794974,0,0,-.39778850739794974,.9174771405229186,0,0,0,0,1),U=g(1,0,0,0,0,.9174771405229186,-.39778850739794974,0,0,.39778850739794974,.9174771405229186,0,0,0,0,1),V=9,C=y().vec3f(P.POSITION).vec4u8(P.COLOR).f32(P.SIZE);let F=null;export{M as Stars};
|