@arcgis/core 4.33.0-next.20250319 → 4.33.0-next.20250321
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/1034155c525d2b7baaa1.js +1 -0
- package/assets/esri/core/workers/chunks/2b9ce6648823f6962f58.js +1 -0
- package/assets/esri/core/workers/chunks/{6a97bdd46715fc12e1b4.js → 9cfce9414b874878d761.js} +4 -4
- package/assets/esri/core/workers/chunks/b23d16745674486ddd6c.js +1 -0
- package/assets/esri/core/workers/chunks/bfbb118ae3b4a4ce1c74.js +319 -0
- package/assets/esri/themes/base/_mixins.scss +4 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/BloomBlur.glsl.js +7 -7
- package/chunks/BloomComposition.glsl.js +2 -2
- package/geometry/support/buffer/BufferView.js +1 -1
- package/interfaces.d.ts +8 -7
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/package.json +2 -2
- package/support/basemapUtils.js +1 -1
- package/support/revision.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
- package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
- package/views/3d/layers/BuildingSublayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/I3SMeshViewLabeler.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.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/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolCreationContext.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/GraphicsProcessor.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/graphics/deconflictorDebug.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/LodRenderer.js +1 -1
- package/views/3d/layers/graphics/pointUtils.js +1 -1
- package/views/3d/layers/graphics/polygonUtils.js +1 -1
- package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
- package/views/3d/layers/i3s/Intersector.js +1 -1
- package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/layers/support/Tiles3DIntersectionHandler.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/support/buffer/InterleavedLayout.js +1 -1
- package/views/3d/support/hitTest.js +1 -1
- package/views/3d/terrain/OverlayRenderTargets.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/webgl/ManagedColorAttachment.js +1 -1
- package/views/3d/webgl/ManagedDepthAttachment.js +1 -1
- package/views/3d/webgl/ManagedFBO.js +1 -1
- package/views/3d/webgl/ManagedFBOAttachment.js +1 -1
- package/views/3d/webgl/{ManagedFBObject.js → ManagedFBOResource.js} +1 -1
- package/views/3d/webgl/formats.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomBlur.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomComposition.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomPresets.glsl.js +5 -0
- package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
- package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.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/IntersectorInterfaces.js +1 -1
- package/views/3d/webgl-engine/lib/IntersectorTarget.js +1 -1
- package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/ObjectAndLayerIdRenderHelper.js +1 -1
- package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/WebGLLayer.js +1 -1
- package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/Intersector.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
- package/views/3d/webgl.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/webgl/FramebufferObject.js +1 -1
- package/views/webgl/GLObjectType.js +1 -1
- package/views/webgl/Renderbuffer.js +1 -1
- package/widgets/Daylight.js +1 -1
- package/widgets/ElevationProfile/support/visualizationUtils.js +1 -1
- package/widgets/ShadowCast.js +1 -1
- package/widgets/support/globalCss.js +1 -1
- package/widgets/support/timeWidgetUtils.js +1 -1
- package/assets/esri/core/workers/chunks/534f3d7e4300b662191a.js +0 -1
- package/assets/esri/core/workers/chunks/657ae4a0461d45044b28.js +0 -1
- package/assets/esri/core/workers/chunks/8e20ec4e8e2cfc582fe7.js +0 -319
- package/assets/esri/core/workers/chunks/c528a2ca3b1b73df5a5d.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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import{isSome as t}from"../../../../core/arrayUtils.js";import{makeHandle as r}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import i from"../../../../core/Logger.js";import{estimateAttributesMemory as a,estimateFixedArrayMemory as s,estimateNumberMemory as o}from"../../../../core/memoryEstimations.js";import n from"../../../../core/Promise.js";import{initial as l,sync as p,watch as d}from"../../../../core/reactiveUtils.js";import{pt2px as u}from"../../../../core/screenUtils.js";import{property as m}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as h}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as y}from"../../../../core/support/UpdatingHandles.js";import{projectPointToVector as _}from"../../../../geometry/projection/projectPointToVector.js";import{getContinuousIndexArray as g}from"../../../../geometry/support/Indices.js";import{getResolutionForScale as f}from"../../../../geometry/support/scaleUtils.js";import{getObjectId as R}from"../../../../layers/graphics/dehydratedFeatures.js";import{convertFromPoint as F}from"../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as b}from"../../../../layers/graphics/OptimizedFeature.js";import v from"../../../../layers/graphics/OptimizedGeometry.js";import S from"../../../../layers/graphics/data/FeatureStore.js";import{isNumericField as w}from"../../../../layers/support/fieldUtils.js";import{generateGradient as P}from"../../../../renderers/support/heatmapUtils.js";import{DrapeSourceType as j}from"../interfaces.js";import{DisplayFeatureLimit as T}from"../graphics/DisplayFeatureLimit.js";import{GraphicsCorePerformanceInfo as V}from"../graphics/GraphicsCorePerformanceInfo.js";import{FeatureVisibilityFilter as G}from"./FeatureVisibilityFilter.js";import{emptyHighlightHandle as x}from"./highlightUtils.js";import{drapedZ as I}from"../../terrain/OverlayRenderer.js";import{Attribute as M}from"../../webgl-engine/lib/Attribute.js";import{ContentObjectType as A}from"../../webgl-engine/lib/ContentObjectType.js";import{DrapedHeatmapRenderer as N}from"../../webgl-engine/lib/DrapedHeatmapRenderer.js";import{Geometry as O}from"../../webgl-engine/lib/Geometry.js";import{DirtyOperation as H,DirtyState as U}from"../../webgl-engine/lib/ModelDirtyTypes.js";import{RenderGeometry as L}from"../../webgl-engine/lib/RenderGeometry.js";import{UpdatePolicy as E}from"../../webgl-engine/lib/UpdatePolicy.js";import{VertexAttribute as D}from"../../webgl-engine/lib/VertexAttribute.js";import{HeatmapDensityMaterial as C}from"../../webgl-engine/materials/HeatmapDensityMaterial.js";import{scaleBoundsPredicate as B,isScaleRangeActive as W}from"../../../support/layerViewUtils.js";import{PixelType as Z,PixelFormat as $}from"../../../webgl/enums.js";import{loadHeatmapTextureConfiguration as q,fallBackHeatmapConfiguration as z}from"../../../webgl/heatmapTextureUtils.js";const Y=112;let k=class extends n{constructor(e){super(e),this.type="heatmap",this.preferredUpdatePolicy=E.ASYNC,this.dataExtent=null,this.drapeSourceType=j.Features,this._renderGeometries=new Map,this._fieldTotal=0,this._drapeSourceRenderer=null,this._dataType=Z.HALF_FLOAT,this._pixelFormat=$.RGBA,this._updatingHandles=new y}initialize(){let e;try{e=q(this._renderView.renderingContext,i.getLogger(this))}catch(u){this.addResolvingPromise(Promise.reject(u)),e=z}const{dataType:t,samplingMode:a,pixelFormat:s,internalFormat:o}=e;this._featureStore=new S({geometryType:"esriGeometryPoint",hasZ:this.hasZ,hasM:this.hasM}),this._dataType=t,this._pixelFormat=s;const n=t!==Z.FLOAT;this._drapeSourceRenderer=this.view.basemapTerrain.overlayManager.registerDrapeSource(this,N,{...this._rendererParameters,dataType:t,samplingMode:a,pixelFormat:s,internalFormat:o}),this._material=new C({usesHalfFloats:n}),this._materialWithField=new C({usesHalfFloats:n,isAttributeDriven:!0}),this._filterVisibility=new G({context:{configuration:this.owner,featureStore:this.featureStore,getFeatureCount:()=>this._loadedPointGraphics.length,setAllFeaturesVisibility:e=>this._setAllFeaturesVisibility(e),clearFeaturesVisibility:()=>this._setAllFeaturesVisibility(!0),updateFeatureVisibilities:e=>this._updateFeatureVisibilities(e)}}),this._updatingHandles.addOnCollectionChange((()=>this._loadedPointGraphics),(e=>this._onLoadedFeaturesChange(e)),l),this._updatingHandles.addWhen((()=>this._materialParameters),(e=>this._forEachMaterial((t=>t.setParameters(e)))),l),this._updatingHandles.add((()=>this._rendererParameters),(e=>this._drapeSourceRenderer.set(e))),this._updatingHandles.add((()=>this._heatmapRendererField),(()=>{this._recreate()}),p),this._updatingHandles.add((()=>({fieldName:this._heatmapRendererFieldName,numeric:this._heatmapRendererFieldIsNumeric})),(({fieldName:e,numeric:t})=>{if(null!=e&&t){let t=0;this._featureStore.forEach((r=>t+=r.attributes[e]??0)),this._fieldTotal=t}else this._fieldTotal=this._featureStore.numFeatures}),l),this.addHandles([d((()=>({fieldName:this._heatmapRendererFieldName,field:this._heatmapRendererField})),(({fieldName:e,field:t})=>{e&&!t&&i.getLogger(this).warn(`Heatmap renderer field '${e}' for layer '${this.layer.title??this.layer.id}' not found`)})),d((()=>({field:this._heatmapRendererField,numeric:this._heatmapRendererFieldIsNumeric})),(({field:e,numeric:t})=>{null==e||t||i.getLogger(this).warn(`Heatmap renderer field '${e.name}' for layer '${this.layer.title??this.layer.id}' does not contain numeric values and cannot be used to drive the heatmap density`)})),r((()=>this.view.basemapTerrain.overlayManager.unregisterDrapeSource(this)))])}destroy(){this._renderGeometries.clear(),this._material=null,this._materialWithField=null,this._featureStore.clear(),this._featureStore=null,this._updatingHandles.destroy()}get layer(){return this.owner.layer}get featureStore(){return this._featureStore}get updating(){return this._updatingHandles.updating||this.filterVisibility.updating}get updatingRemaining(){return 0}get suspendInfo(){return{}}get legendEnabled(){return!0}get filterVisibility(){return this._filterVisibility}get displayFeatureLimit(){const e=this.owner?.view?.quality??1,t=this.owner?.view?.qualitySettings,r=t?Math.ceil(t.heatmap.maxTotalNumberOfFeatures*e):0;return new T(r*6,r)}get hasZ(){return"hasZ"in this.layer&&this.layer.hasZ}get hasM(){return"hasM"in this.layer&&this.layer.hasM}get view(){return this.owner.view}get fullOpacity(){return this.owner.fullOpacity}get updatePolicy(){return this.owner.updatePolicy}get scaleVisibilitySuspended(){if(!this._isScaleRangeActive)return!1;const{minScale:e,maxScale:t}=this.layer.effectiveScaleRange,{scale:r}=this.view;return!B(r,e??0,t??0)}get usedMemory(){const e=this.usedMemoryPerFeature*this._featureStore.numFeatures,t=this._pixelFormat===$.RED?1:4,r=this._dataType===Z.FLOAT?4:2,i=Math.ceil((this._overlayRenderer?.overlays[0]?.resolution??0)*this._densityMapPixelRatio)??0;return i*i*t*r+e}get usedMemoryPerFeature(){const e=this._loadedPointGraphics.find((()=>!0));if(null==e)return 0;const t=a(e),r=6;return r*s([0,0,0],o)+r*s([0,0],o)+(this._heatmapRendererFieldIsNumeric?r*o:0)+t}get loadedFeatures(){return this._featureStore.numFeatures}get unprocessedMemoryEstimate(){return 0}get performanceInfo(){return new V(this._renderGeometries.size,this._visibleFeatures,0,0)}get renderer(){return this._heatmapRenderer}get _overlayRenderer(){return this.view.basemapTerrain.overlayManager.renderer}get _overlaySpatialReference(){return this._overlayRenderer.spatialReference}get _rendererParameters(){return{...this._radiusParameter,...this._densityParameters,...this._colorRampParameter,...this._pixelRatioParameter}}get _materialParameters(){return{...this._radiusParameter,...this._resolutionForScaleParameter}}get _densityParameters(){const e=this._heatmapRenderer;if(null==e)return null;const{minDensity:t,maxDensity:r}=e;return{minDensity:t,maxDensity:r,fieldTotal:this._fieldTotal}}get _radiusParameter(){const e=this._heatmapRenderer;return e?{searchRadius:u(this._clampSearchRadius(e.radius))}:null}get _resolutionForScaleParameter(){const e=this._heatmapRenderer;if(!e)return null;const{referenceScale:t}=e;return{resolutionForScale:0===t?0:f(t,this.view.spatialReference)}}get _colorRampParameter(){const e=this._heatmapRenderer;return e?{colorRampData:P(e.colorStops)}:null}get _pixelRatioParameter(){return{pixelRatio:this._densityMapPixelRatio}}get _densityMapPixelRatio(){return this.owner?.view?.qualitySettings.heatmap.pixelRatio??1}get _renderView(){return this.view.stage.renderView}get _featuresArePoints(){return"point"===this.layer.geometryType}get _loadedPointGraphics(){return this.owner.loadedGraphics}get _heatmapRenderer(){const e=this.layer.renderer;return"heatmap"===e?.type?e:null}get _heatmapRendererFieldName(){return this._heatmapRenderer?.field}get _heatmapRendererField(){const e=this._heatmapRendererFieldName;return null!=e?this.layer.fieldsIndex.get(e):null}get _heatmapRendererFieldIsNumeric(){const e=this._heatmapRendererField;return null!=e&&w(e)}get _isScaleRangeActive(){const{layer:e}=this;if(!("effectiveScaleRange"in e))return!1;const{minScale:t,maxScale:r}=e.effectiveScaleRange;return W(t,r)}get _visibleFeatures(){return Array.from(this._renderGeometries.values()).reduce(((e,{visible:t})=>e+(t?1:0)),0)}async whenGraphicBounds(){return null}computeAttachmentOrigin(){return null}highlight(){return x}maskOccludee(){return r()}setObjectIdVisibility(){}refreshFilter(){this.filterVisibility.reapply()}_onLoadedFeaturesChange(e){if(!this._featuresArePoints)return;const{objectIdField:r}=this.layer;this._featureStore.removeManyById(e.removed.map((e=>R(e,r)))),this._featureStore.addMany(e.added.map((e=>{const{attributes:t,centroid:i,geometry:a}=e,s=new b(F(new v,a),t,i?F(new v,i):null,R(e,r));return s.displayId=e.uid,s})));const i=e.added,a=e.removed;this._fieldTotal+=this._computeFieldTotalChange(i,a);const s=a.map((({uid:e})=>{const t=this._renderGeometries.get(e);return this._renderGeometries.delete(e),t})).filter(t),o=i.map((e=>{const t=this._pointGraphicToRenderGeometry(e);return this._renderGeometries.set(e.uid,t),t}));s.length>0&&this._drapeSourceRenderer.removeGeometries(s,H.REMOVE),o.length>0&&this._drapeSourceRenderer.addGeometries(o,H.ADD),(o.length>0||s.length>0)&&(this.filterVisibility.reapply(),this._renderView.requestRender())}_recreate(){if(!this._loadedPointGraphics)return;const e=this._loadedPointGraphics.toArray();this._onLoadedFeaturesChange({added:e,removed:e})}_pointGraphicToRenderGeometry(e){const t=this._heatmapRendererFieldName,r=null!=t?this._materialWithField:this._material,i=c();_(e.geometry,i,this._overlaySpatialReference),i[2]=I;const a=g(1),s=[[D.POSITION,new M(i,a,i.length)]],o=this._heatmapRendererFieldIsNumeric;null!=t&&s.push([D.FEATUREATTRIBUTE,new M([o?e.attributes[t]??0:0],a,1)]);const n=new L(new O(r,s,null,A.Point),{layerUid:this.layer.uid,graphicUid:e.uid});return n.visible=this.filterVisibility.defaultVisibility,n}_forEachMaterial(e){e(this._material),e(this._materialWithField)}_computeFieldTotalChange(e,t){if(null==this._heatmapRendererFieldName||!this._heatmapRendererFieldIsNumeric)return e.length-t.length;const r=this._heatmapRendererFieldName,i=(e,t)=>e+(t.attributes[r]??0);return e.reduce(i,0)-t.reduce(i,0)}_clampSearchRadius(e){return e>Y&&i.getLogger(this).warnOnce(`SceneView supports a maximum radius of ${Y} pt for HeatmapRenderer.`),Math.min(e,Y)}_updateFeatureVisibilities(e){const t=[];this._featureStore.forEach((({objectId:r,displayId:i})=>{const a=e(r),s=this._renderGeometries.get(i);s&&s.visible!==a&&(t.push(s),s.visible=a)})),this._drapeSourceRenderer.modifyGeometries(t,U.VISIBILITY)}_setAllFeaturesVisibility(e){const t=[];for(const r of this._renderGeometries.values())r.visible!==e&&(t.push(r),r.visible=e);this._drapeSourceRenderer.modifyGeometries(t,U.VISIBILITY)}get test(){}};e([m()],k.prototype,"type",void 0),e([m({constructOnly:!0})],k.prototype,"owner",void 0),e([m()],k.prototype,"layer",null),e([m()],k.prototype,"featureStore",null),e([m()],k.prototype,"updating",null),e([m()],k.prototype,"updatingRemaining",null),e([m()],k.prototype,"suspendInfo",null),e([m()],k.prototype,"legendEnabled",null),e([m()],k.prototype,"filterVisibility",null),e([m()],k.prototype,"displayFeatureLimit",null),e([m()],k.prototype,"preferredUpdatePolicy",void 0),e([m()],k.prototype,"hasZ",null),e([m()],k.prototype,"hasM",null),e([m()],k.prototype,"dataExtent",void 0),e([m()],k.prototype,"view",null),e([m()],k.prototype,"fullOpacity",null),e([m()],k.prototype,"updatePolicy",null),e([m()],k.prototype,"drapeSourceType",void 0),e([m()],k.prototype,"scaleVisibilitySuspended",null),e([m()],k.prototype,"renderer",null),e([m()],k.prototype,"_featureStore",void 0),e([m()],k.prototype,"_filterVisibility",void 0),e([m()],k.prototype,"_overlayRenderer",null),e([m()],k.prototype,"_overlaySpatialReference",null),e([m()],k.prototype,"_rendererParameters",null),e([m()],k.prototype,"_materialParameters",null),e([m()],k.prototype,"_densityParameters",null),e([m()],k.prototype,"_radiusParameter",null),e([m()],k.prototype,"_resolutionForScaleParameter",null),e([m()],k.prototype,"_colorRampParameter",null),e([m()],k.prototype,"_pixelRatioParameter",null),e([m()],k.prototype,"_densityMapPixelRatio",null),e([m()],k.prototype,"_renderGeometries",void 0),e([m()],k.prototype,"_material",void 0),e([m()],k.prototype,"_materialWithField",void 0),e([m()],k.prototype,"_renderView",null),e([m()],k.prototype,"_featuresArePoints",null),e([m()],k.prototype,"_loadedPointGraphics",null),e([m()],k.prototype,"_heatmapRenderer",null),e([m()],k.prototype,"_heatmapRendererFieldName",null),e([m()],k.prototype,"_heatmapRendererField",null),e([m()],k.prototype,"_heatmapRendererFieldIsNumeric",null),e([m()],k.prototype,"_fieldTotal",void 0),e([m()],k.prototype,"_drapeSourceRenderer",void 0),e([m()],k.prototype,"_isScaleRangeActive",null),k=e([h("esri.views.3d.layers.support.HeatmapFeatureProcessor")],k);export{k as HeatmapFeatureProcessor,Y as maxRadiusPt};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{isSome as t}from"../../../../core/arrayUtils.js";import{makeHandle as r}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import i from"../../../../core/Logger.js";import{estimateAttributesMemory as a,estimateFixedArrayMemory as s,estimateNumberMemory as o}from"../../../../core/memoryEstimations.js";import n from"../../../../core/Promise.js";import{initial as l,sync as p,watch as d}from"../../../../core/reactiveUtils.js";import{pt2px as u}from"../../../../core/screenUtils.js";import{property as m}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as h}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as y}from"../../../../core/support/UpdatingHandles.js";import{projectPointToVector as _}from"../../../../geometry/projection/projectPointToVector.js";import{getContinuousIndexArray as g}from"../../../../geometry/support/Indices.js";import{getResolutionForScale as f}from"../../../../geometry/support/scaleUtils.js";import{getObjectId as R}from"../../../../layers/graphics/dehydratedFeatures.js";import{convertFromPoint as F}from"../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as b}from"../../../../layers/graphics/OptimizedFeature.js";import v from"../../../../layers/graphics/OptimizedGeometry.js";import w from"../../../../layers/graphics/data/FeatureStore.js";import{isNumericField as S}from"../../../../layers/support/fieldUtils.js";import{generateGradient as P}from"../../../../renderers/support/heatmapUtils.js";import{DrapeSourceType as j}from"../interfaces.js";import{DisplayFeatureLimit as T}from"../graphics/DisplayFeatureLimit.js";import{GraphicsCorePerformanceInfo as V}from"../graphics/GraphicsCorePerformanceInfo.js";import{FeatureVisibilityFilter as G}from"./FeatureVisibilityFilter.js";import{emptyHighlightHandle as x}from"./highlightUtils.js";import{drapedZ as I}from"../../terrain/OverlayRenderer.js";import{Attribute as M}from"../../webgl-engine/lib/Attribute.js";import{ContentObjectType as A}from"../../webgl-engine/lib/ContentObjectType.js";import{DrapedHeatmapRenderer as N}from"../../webgl-engine/lib/DrapedHeatmapRenderer.js";import{Geometry as O}from"../../webgl-engine/lib/Geometry.js";import{DirtyOperation as U,DirtyState as H}from"../../webgl-engine/lib/ModelDirtyTypes.js";import{RenderGeometry as L}from"../../webgl-engine/lib/RenderGeometry.js";import{UpdatePolicy as E}from"../../webgl-engine/lib/UpdatePolicy.js";import{VertexAttribute as D}from"../../webgl-engine/lib/VertexAttribute.js";import{HeatmapDensityMaterial as C}from"../../webgl-engine/materials/HeatmapDensityMaterial.js";import{scaleBoundsPredicate as B,isScaleRangeActive as W}from"../../../support/layerViewUtils.js";import{PixelType as Z,PixelFormat as $}from"../../../webgl/enums.js";import{loadHeatmapTextureConfiguration as q,fallBackHeatmapConfiguration as z}from"../../../webgl/heatmapTextureUtils.js";const Y=112;let k=class extends n{constructor(e){super(e),this.type="heatmap",this.preferredUpdatePolicy=E.ASYNC,this.dataExtent=null,this.drapeSourceType=j.Features,this._renderGeometries=new Map,this._fieldTotal=0,this._drapeSourceRenderer=null,this._dataType=Z.HALF_FLOAT,this._pixelFormat=$.RGBA,this._updatingHandles=new y}initialize(){let e;try{e=q(this._renderView.renderingContext,i.getLogger(this))}catch(u){this.addResolvingPromise(Promise.reject(u)),e=z}const{dataType:t,samplingMode:a,pixelFormat:s,internalFormat:o}=e;this._featureStore=new w({geometryType:"esriGeometryPoint",hasZ:this.hasZ,hasM:this.hasM}),this._dataType=t,this._pixelFormat=s;const n=t!==Z.FLOAT;this._drapeSourceRenderer=this.view.basemapTerrain.overlayManager.registerDrapeSource(this,N,{...this._rendererParameters,dataType:t,samplingMode:a,pixelFormat:s,internalFormat:o}),this._material=new C({usesHalfFloats:n}),this._materialWithField=new C({usesHalfFloats:n,isAttributeDriven:!0}),this._filterVisibility=new G({context:{configuration:this.owner,featureStore:this.featureStore,getFeatureCount:()=>this._loadedPointGraphics.length,setAllFeaturesVisibility:e=>this._setAllFeaturesVisibility(e),clearFeaturesVisibility:()=>this._setAllFeaturesVisibility(!0),updateFeatureVisibilities:e=>this._updateFeatureVisibilities(e)}}),this._updatingHandles.addOnCollectionChange((()=>this._loadedPointGraphics),(e=>this._onLoadedFeaturesChange(e)),l),this._updatingHandles.addWhen((()=>this._materialParameters),(e=>this._forEachMaterial((t=>t.setParameters(e)))),l),this._updatingHandles.add((()=>this._rendererParameters),(e=>this._drapeSourceRenderer.set(e))),this._updatingHandles.add((()=>this._heatmapRendererField),(()=>{this._recreate()}),p),this._updatingHandles.add((()=>({fieldName:this._heatmapRendererFieldName,numeric:this._heatmapRendererFieldIsNumeric})),(({fieldName:e,numeric:t})=>{if(null!=e&&t){let t=0;this._featureStore.forEach((r=>t+=r.attributes[e]??0)),this._fieldTotal=t}else this._fieldTotal=this._featureStore.numFeatures}),l),this.addHandles([d((()=>({fieldName:this._heatmapRendererFieldName,field:this._heatmapRendererField})),(({fieldName:e,field:t})=>{e&&!t&&i.getLogger(this).warn(`Heatmap renderer field '${e}' for layer '${this.layer.title??this.layer.id}' not found`)})),d((()=>({field:this._heatmapRendererField,numeric:this._heatmapRendererFieldIsNumeric})),(({field:e,numeric:t})=>{null==e||t||i.getLogger(this).warn(`Heatmap renderer field '${e.name}' for layer '${this.layer.title??this.layer.id}' does not contain numeric values and cannot be used to drive the heatmap density`)})),r((()=>this.view.basemapTerrain.overlayManager.unregisterDrapeSource(this)))])}destroy(){this._renderGeometries.clear(),this._material=null,this._materialWithField=null,this._featureStore.clear(),this._featureStore=null,this._updatingHandles.destroy()}get layer(){return this.owner.layer}get featureStore(){return this._featureStore}get updating(){return this._updatingHandles.updating||this.filterVisibility.updating}get updatingRemaining(){return 0}get suspendInfo(){return{}}get legendEnabled(){return!0}get filterVisibility(){return this._filterVisibility}get displayFeatureLimit(){const e=this.owner?.view?.quality??1,t=this.owner?.view?.qualitySettings,r=t?Math.ceil(t.heatmap.maxTotalNumberOfFeatures*e):0;return new T(r*6,r)}get hasZ(){return"hasZ"in this.layer&&this.layer.hasZ}get hasM(){return"hasM"in this.layer&&this.layer.hasM}get view(){return this.owner.view}get fullOpacity(){return this.owner.fullOpacity}get updatePolicy(){return this.owner.updatePolicy}get scaleVisibilitySuspended(){if(!this._isScaleRangeActive)return!1;const{minScale:e,maxScale:t}=this.layer.effectiveScaleRange,{scale:r}=this.view;return!B(r,e??0,t??0)}get usedMemory(){const e=this.usedMemoryPerFeature*this._featureStore.numFeatures,t=this._pixelFormat===$.RED?1:4,r=this._dataType===Z.FLOAT?4:2,i=Math.ceil((this._overlayRenderer?.overlays[0]?.resolution??0)*this._densityMapPixelRatio)??0;return i*i*t*r+e}get usedMemoryPerFeature(){const e=this._loadedPointGraphics.find((()=>!0));if(null==e)return 0;const t=a(e),r=6;return r*s([0,0,0],o)+r*s([0,0],o)+(this._heatmapRendererFieldIsNumeric?r*o:0)+t}get loadedFeatures(){return this._featureStore.numFeatures}get unprocessedMemoryEstimate(){return 0}get performanceInfo(){return new V(this._renderGeometries.size,this._visibleFeatures,0,0)}get renderer(){return this._heatmapRenderer}get _overlayRenderer(){return this.view.basemapTerrain.overlayManager.renderer}get _overlaySpatialReference(){return this._overlayRenderer.spatialReference}get _rendererParameters(){return{...this._radiusParameter,...this._densityParameters,...this._colorRampParameter,...this._pixelRatioParameter}}get _materialParameters(){return{...this._radiusParameter,...this._resolutionForScaleParameter}}get _densityParameters(){const e=this._heatmapRenderer;if(null==e)return null;const{minDensity:t,maxDensity:r}=e;return{minDensity:t,maxDensity:r,fieldTotal:this._fieldTotal}}get _radiusParameter(){const e=this._heatmapRenderer;return e?{searchRadius:u(this._clampSearchRadius(e.radius))}:null}get _resolutionForScaleParameter(){const e=this._heatmapRenderer;if(!e)return null;const{referenceScale:t}=e;return{resolutionForScale:0===t?0:f(t,this.view.spatialReference)}}get _colorRampParameter(){const e=this._heatmapRenderer;return e?{colorRampData:P(e.colorStops)}:null}get _pixelRatioParameter(){return{pixelRatio:this._densityMapPixelRatio}}get _densityMapPixelRatio(){return this.owner?.view?.qualitySettings.heatmap.pixelRatio??1}get _renderView(){return this.view.stage.renderView}get _featuresArePoints(){return"point"===this.layer.geometryType}get _loadedPointGraphics(){return this.owner.loadedGraphics}get _heatmapRenderer(){const e=this.layer.renderer;return"heatmap"===e?.type?e:null}get _heatmapRendererFieldName(){return this._heatmapRenderer?.field}get _heatmapRendererField(){const e=this._heatmapRendererFieldName;return null!=e?this.layer.fieldsIndex.get(e):null}get _heatmapRendererFieldIsNumeric(){const e=this._heatmapRendererField;return null!=e&&S(e)}get _isScaleRangeActive(){const{layer:e}=this;if(!("effectiveScaleRange"in e))return!1;const{minScale:t,maxScale:r}=e.effectiveScaleRange;return W(t,r)}get _visibleFeatures(){return Array.from(this._renderGeometries.values()).reduce(((e,{visible:t})=>e+(t?1:0)),0)}async whenGraphicBounds(){return null}computeAttachmentOrigin(){return null}highlight(){return x}maskOccludee(){return r()}setObjectIdVisibility(){}refreshFilter(){this.filterVisibility.reapply()}_onLoadedFeaturesChange(e){if(!this._featuresArePoints)return;const{objectIdField:r}=this.layer;this._featureStore.removeManyById(e.removed.map((e=>R(e,r)))),this._featureStore.addMany(e.added.map((e=>{const{attributes:t,centroid:i,geometry:a}=e,s=new b(F(new v,a),t,i?F(new v,i):null,R(e,r));return s.displayId=e.uid,s})));const i=e.added,a=e.removed;this._fieldTotal+=this._computeFieldTotalChange(i,a);const s=a.map((({uid:e})=>{const t=this._renderGeometries.get(e);return this._renderGeometries.delete(e),t})).filter(t),o=i.map((e=>{const t=this._pointGraphicToRenderGeometry(e);return this._renderGeometries.set(e.uid,t),t}));s.length>0&&this._drapeSourceRenderer.removeGeometries(s,U.REMOVE),o.length>0&&this._drapeSourceRenderer.addGeometries(o,U.ADD),(o.length>0||s.length>0)&&(this.filterVisibility.reapply(),this._renderView.requestRender())}_recreate(){if(!this._loadedPointGraphics)return;const e=this._loadedPointGraphics.toArray();this._onLoadedFeaturesChange({added:e,removed:e})}_pointGraphicToRenderGeometry(e){const t=this._heatmapRendererFieldName,r=null!=t?this._materialWithField:this._material,i=c();_(e.geometry,i,this._overlaySpatialReference),i[2]=I;const a=g(1),s=[[D.POSITION,new M(i,a,i.length)]],o=this._heatmapRendererFieldIsNumeric;null!=t&&s.push([D.FEATUREATTRIBUTE,new M([o?e.attributes[t]??0:0],a,1)]);const n=new L(new O(r,s,null,A.Point),{layerViewUid:this.owner.layerViewUid,graphicUid:e.uid});return n.visible=this.filterVisibility.defaultVisibility,n}_forEachMaterial(e){e(this._material),e(this._materialWithField)}_computeFieldTotalChange(e,t){if(null==this._heatmapRendererFieldName||!this._heatmapRendererFieldIsNumeric)return e.length-t.length;const r=this._heatmapRendererFieldName,i=(e,t)=>e+(t.attributes[r]??0);return e.reduce(i,0)-t.reduce(i,0)}_clampSearchRadius(e){return e>Y&&i.getLogger(this).warnOnce(`SceneView supports a maximum radius of ${Y} pt for HeatmapRenderer.`),Math.min(e,Y)}_updateFeatureVisibilities(e){const t=[];this._featureStore.forEach((({objectId:r,displayId:i})=>{const a=e(r),s=this._renderGeometries.get(i);s&&s.visible!==a&&(t.push(s),s.visible=a)})),this._drapeSourceRenderer.modifyGeometries(t,H.VISIBILITY)}_setAllFeaturesVisibility(e){const t=[];for(const r of this._renderGeometries.values())r.visible!==e&&(t.push(r),r.visible=e);this._drapeSourceRenderer.modifyGeometries(t,H.VISIBILITY)}get test(){}};e([m()],k.prototype,"type",void 0),e([m({constructOnly:!0})],k.prototype,"owner",void 0),e([m()],k.prototype,"layer",null),e([m()],k.prototype,"featureStore",null),e([m()],k.prototype,"updating",null),e([m()],k.prototype,"updatingRemaining",null),e([m()],k.prototype,"suspendInfo",null),e([m()],k.prototype,"legendEnabled",null),e([m()],k.prototype,"filterVisibility",null),e([m()],k.prototype,"displayFeatureLimit",null),e([m()],k.prototype,"preferredUpdatePolicy",void 0),e([m()],k.prototype,"hasZ",null),e([m()],k.prototype,"hasM",null),e([m()],k.prototype,"dataExtent",void 0),e([m()],k.prototype,"view",null),e([m()],k.prototype,"fullOpacity",null),e([m()],k.prototype,"updatePolicy",null),e([m()],k.prototype,"drapeSourceType",void 0),e([m()],k.prototype,"scaleVisibilitySuspended",null),e([m()],k.prototype,"renderer",null),e([m()],k.prototype,"_featureStore",void 0),e([m()],k.prototype,"_filterVisibility",void 0),e([m()],k.prototype,"_overlayRenderer",null),e([m()],k.prototype,"_overlaySpatialReference",null),e([m()],k.prototype,"_rendererParameters",null),e([m()],k.prototype,"_materialParameters",null),e([m()],k.prototype,"_densityParameters",null),e([m()],k.prototype,"_radiusParameter",null),e([m()],k.prototype,"_resolutionForScaleParameter",null),e([m()],k.prototype,"_colorRampParameter",null),e([m()],k.prototype,"_pixelRatioParameter",null),e([m()],k.prototype,"_densityMapPixelRatio",null),e([m()],k.prototype,"_renderGeometries",void 0),e([m()],k.prototype,"_material",void 0),e([m()],k.prototype,"_materialWithField",void 0),e([m()],k.prototype,"_renderView",null),e([m()],k.prototype,"_featuresArePoints",null),e([m()],k.prototype,"_loadedPointGraphics",null),e([m()],k.prototype,"_heatmapRenderer",null),e([m()],k.prototype,"_heatmapRendererFieldName",null),e([m()],k.prototype,"_heatmapRendererField",null),e([m()],k.prototype,"_heatmapRendererFieldIsNumeric",null),e([m()],k.prototype,"_fieldTotal",void 0),e([m()],k.prototype,"_drapeSourceRenderer",void 0),e([m()],k.prototype,"_isScaleRangeActive",null),k=e([h("esri.views.3d.layers.support.HeatmapFeatureProcessor")],k);export{k as HeatmapFeatureProcessor,Y as maxRadiusPt};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Graphic.js";import{Tiles3DTarget as i}from"../i3s/Intersector.js";import{newIntersectorResult as t}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as r,StoreResults as s}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{MeshIntersectionOptions as n}from"../../webgl-engine/lib/RayIntersections.js";class
|
|
5
|
+
import e from"../../../../Graphic.js";import{Tiles3DTarget as i}from"../i3s/Intersector.js";import{newIntersectorResult as t}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as r,StoreResults as s}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{MeshIntersectionOptions as n}from"../../webgl-engine/lib/RayIntersections.js";class o{constructor(e){this.type=r.TILES3D,this.slicePlaneEnabled=!1,this.isGround=!0,this.layerView=e,this.layerViewUid=e.uid}intersect(e,r,o,l,a,c){const u=e.results,d=e.options.store===s.ALL;if(e.options.filteredLayerViewUids.includes(this.layerView.uid))return;const m=this.layerView.view.stage.renderView.componentObjectCollection,h=new n(c??!1,e.options.normalRequired);this.layerView.objects.forEach((s=>{s.visible&&s.intersectionGeometry&&m.intersect(s,o,l,e.tolerance,null,h,((s,n,a,c)=>{if(n>=0){if(null!=r&&!r(o,l,n))return;const s=e=>{const t=new i(this.layerView.layer.uid,(()=>this._createTiles3DGraphic(this.layerView.layer,{})));e.set(this.type,t,n,a)};if(this.isGround&&(null==u.ground.dist||n<u.ground.dist)&&s(u.ground),e.options.isFiltered)return;if((null==u.min.dist||n<u.min.dist)&&s(u.min),(null==u.max.dist||n>u.max.dist)&&s(u.max),d){const i=t(e.ray);s(i),e.results.all.push(i)}}}))}))}_createTiles3DGraphic(i,t){return new e({layer:i,sourceLayer:i,attributes:t})}}export{o as Tiles3DIntersectionHandler};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/PooledArray.js";import{castRenderScreenPointArray3 as t,createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{getMetersPerVerticalUnitForSR as i}from"../../../../core/unitUtils.js";import{g as n,n as s,f as o}from"../../../../chunks/vec32.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as a,copy as c,negativeInfinity as u,width as h,height as d,expandPointInPlace as p}from"../../../../geometry/support/aaBoundingRect.js";import{create as m}from"../../../../geometry/support/ray.js";import{sv3d as
|
|
5
|
+
import e from"../../../../core/PooledArray.js";import{castRenderScreenPointArray3 as t,createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{getMetersPerVerticalUnitForSR as i}from"../../../../core/unitUtils.js";import{g as n,n as s,f as o}from"../../../../chunks/vec32.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as a,copy as c,negativeInfinity as u,width as h,height as d,expandPointInPlace as p}from"../../../../geometry/support/aaBoundingRect.js";import{create as m}from"../../../../geometry/support/ray.js";import{sv3d as y}from"../../../../geometry/support/vectorStacks.js";import{getElevationOffsetInMeters as f}from"../../../../support/elevationInfoUtils.js";import{ViewingMode as g}from"../../../ViewingMode.js";import{computeMapPointFromVec3d as R}from"../../support/hitTest.js";import{fromRenderAtEye as _,fromScreen as w}from"../../support/geometryUtils/ray.js";import{defaultTolerance as v,newIntersector as I}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as b,IntersectorType as P}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as j,sliceFilterPredicate as M}from"../../webgl-engine/lib/intersectorUtils.js";import{HUDMaterial as U}from"../../webgl-engine/materials/HUDMaterial.js";class x{constructor(t,r,i){this.viewingMode=t,this._forEachLayer=r,this._view=i,this._externalIntersectionHandlers=new e,this._tolerance=v,this._tmpRay=m(),this._tmpRegion=a(),this._validateHUDIntersector=I(this.viewingMode),this._validateHUDIntersector.options.hud=!1}intersectScreen(e,t,r){return this.intersectRay(this._getPickRay(e,this._tmpRay),A(this.viewingMode),t,r)}intersectScreenFreePointFallback(e,t,r){return this.intersectRayFreePointFallback(this._getPickRay(e,this._tmpRay),t,r)}intersectRayFreePointFallback(e,t,r){return this.intersectRay(e,A(this.viewingMode),t,r)||this._intersectRayFreePointLocal(e,t)}intersectRay(e,t,r,i){return t.options.selectionMode=!1,t.options.store=b.MIN,this.computeIntersection(e,t,i),!!t.results.min&&t.results.min.getIntersectionPoint(r)}getCenterRayWithSubpixelOffset(e,t,r=.5,i=.5){return e.getRenderCenter(D,r,i),D[0]+=.0466,D[1]-=.0123,_(e,D,t)}intersectIntersectorScreen(e,t,r){this.computeIntersection(this._getPickRay(e,this._tmpRay),t,r)}intersectToolIntersectorScreen(e,t,r){const i=this._getPickRay(e,this._tmpRay);this.intersectToolIntersectorRay(i,t,r)}intersectToolIntersectorRay(e,t,r){t.options.selectionMode=!0,this.computeIntersection(e,t,r);const i=t.results.min;!!this._view.basemapTerrain&&this._view.basemapTerrain.opaque||j(i)&&i.intersector!==P.TERRAIN||(t.options.selectionMode=!1,this.computeIntersection(e,t,r))}setTolerance(e=v){this._tolerance=e}addIntersectionHandler(e){this._externalIntersectionHandlers.push(e),this._externalIntersectionHandlers.sort(((e,t)=>e.type===P.TERRAIN?1:t.type===P.TERRAIN?-1:0))}removeIntersectionHandler(e){null!=this._externalIntersectionHandlers.removeUnordered(e)&&this._externalIntersectionHandlers.sort(((e,t)=>e.type===P.TERRAIN?1:t.type===P.TERRAIN?-1:0))}_getPickRay(e,t){const r=this._view.state.camera;return w(r,e,t)}_intersectRayFreePointLocal(e,t){return this.viewingMode!==g.Local||null==e||n(t,e.origin,s(y.get(),e.direction)),!1}intersectElevationFromScreen(e,t,r=0,i=null){return this._intersectElevation(this._getPickRay(e,this._tmpRay),t,r,i)}_intersectElevation(e,r,l=0,a=null){if(null==e)return null;const c=this._view,{renderCoordsHelper:u}=c,h=i(c.spatialReference),d=null!=r?r.mode:"absolute-height",p=f(r)/h,m=("on-the-ground"!==d?p+l:0)*h/u.unitInMeters,{camera:g}=c.state;if("absolute-height"===d){const t=u?.getAltitude(g.eye),r=o(s(F,e.direction),u.worldUpAtPosition(g.eye,S));if(t<m&&r<0||t>=m&&r>0)return null;if(u.intersectInfiniteManifold(e,m,F)){const e=R(c,F);return e.z??=0,e.z-=p,e}return null}const _=t(y.get());g.projectToRenderScreen(e.origin,_);const w=new k(null,this._forEachLayer),{slicePlane:v}=c,j=null!=v?M(v):null,U=I(this.viewingMode);U.options.store=b.MIN,U.options.verticalOffset=m,U.options.normalRequired=!1;const x=e.origin,T=n(y.get(),x,e.direction);U.reset(x,T,g),U.point=_;let E=null;if(a&&"type"in a&&"graphics"===a.type){const e=c.allLayerViews.find((e=>e.layer===a))?.uid;E=e?t=>t.layerViewUid===e:null}else a&&(E=e=>e.graphicUid!==a.uid);switch(d){case"relative-to-scene":{const e=e=>(!E||E(e))&&!!e.lastValidElevationBB;U.intersect(w.layers,_,this._tolerance,null,e),this._externalIntersectionHandlers.forAll((e=>{if(e.type===P.I3S||e.type===P.TERRAIN||e.type===P.TILES3D){const t=e.slicePlaneEnabled?j:null;e.intersect(U,t,U.rayBegin,U.rayEnd,_)}}));break}case"on-the-ground":case"relative-to-ground":this._externalIntersectionHandlers.forAll((e=>{if(e.isGround){const t=e.slicePlaneEnabled?j:null;e.intersect(U,t,U.rayBegin,U.rayEnd,_)}}))}if(U.results.min.getIntersectionPoint(F)){const e=R(c,F);return e.z=l,e}return null}computeIntersection(e,r,i,s){if(null==e)return;const o=this._view.state.camera,l=t(y.get());o.projectToRenderScreen(e.origin,l);const a=new k(i,this._forEachLayer);r.options.selectOpaqueTerrainOnly=!i||!("include"in i||"exclude"in i);const c=e.origin,u=n(y.get(),e.origin,e.direction);r.reset(c,u,o),r.intersect(a.layers,l,this._tolerance);const h=this._view.slicePlane,d=null!=h?M(h):null;r.intersect(a.sliceableLayers,l,this._tolerance,d);const p=i&&(i.requiresGroundFeedback||i.enableDraped);this._externalIntersectionHandlers.forAll((e=>{const t=e.layerViewUid,i=Array.isArray(t),n=i?t:[t];i&&(r.options.filteredLayerViewUids=[]);let o=!1;for(const s of n){!a.filterLayerViewUid(s)?i&&r.options.filteredLayerViewUids.push(s):o=!0}if(r.options.isFiltered=!o,e.isGround&&p||!r.options.isFiltered){const t=e.slicePlaneEnabled?d:null;e.intersect(r,t,c,u,l,s)}}));const m=y.get(),f=this._view.basemapTerrain;if(i&&i.enableDraped&&null!=f.spatialReference&&r.results.ground.getIntersectionPoint(m)){const e=f.overlayManager.renderer,t=this._view.renderCoordsHelper.spatialReference,i=y.get();this._view.renderCoordsHelper.fromRenderCoords(m,i,f.spatialReference),i[2]=this._view.elevationProvider?.getElevation(m[0],m[1],m[2],t,"ground")??0,e.intersect(r,i,r.results.ground,(e=>a.filterRenderGeometry(e)))}r.sortResults(),this._processHUDResults(r)}_processHUDResults(e){const t=e.results.hud;c(this._tmpRegion,u);const r=this._view.state.camera,i=[],n=this._tmpRegion,s=e=>{const t=new H(e),s=t.result.target.object.geometries.every((e=>e.material instanceof U&&e.material.parameters.occlusionTest));i.push({item:t,occlusionTest:s}),s&&(r.projectToRenderScreen(e.target.center,t.screenPoint),t.screenPoint[0]=Math.floor(t.screenPoint[0]),t.screenPoint[1]=Math.floor(t.screenPoint[1]),p(n,t.screenPoint))};e.sortResults(t.all),null!=t.min.dist&&s(t.min);for(const c of t.all)t.min.target.object!==c.target.object&&t.max.target.object!==c.target.object&&s(c);if(null!=t.max.dist&&t.max.target.object!==t.min.target.object&&s(t.max),!i.length)return;n[0]===n[2]&&(n[2]+=1),n[1]===n[3]&&(n[3]+=1);const o=r.fullWidth,l=r.fullHeight,a=Math.max(0,n[0]-T),m=Math.max(0,n[1]-T),y=Math.min(h(n)+2*T,o-a),f=Math.min(d(n)+2*T,l-m),g=y>0&&f>0?new Uint8Array(y*f*4):null;g&&this._view.stage.renderer.readHUDVisibility(a,m,y,f,g);let R=!0;const _=null==e.results.max.dist;let w=0;for(const{item:c,occlusionTest:u}of i){let t=!u;if(u&&g)for(const e of E){const r=4*(Math.min(c.screenPoint[0]+e[0],o)-n[0]+(Math.min(c.screenPoint[1]+e[1],l)-n[1])*y);if(r>=0&&r<g.length&&g[r]){t=!0;break}}t&&(R&&(e.results.min.copy(c.result),R=!1),_&&e.results.max.copy(c.result),e.options.store===b.ALL&&e.results.all.splice(w++,0,c.result))}}}const T=1,E=(()=>{const e=[],t=T;for(let r=-1;r<=t;r++)for(let i=-1;i<=t;i++)e.push([i+t,r+t]);return e})();class H{constructor(e){this.result=e,this.screenPoint=r()}}let L;function A(e){return L&&L.viewingMode===e||(L=I(e)),L}class k{constructor(e,t){this.layers=new Array,this.sliceableLayers=new Array,this.include=e?.include,this.exclude=e?.exclude,t((e=>{e.pickable&&this.filterLayerViewUid(e.apiLayerViewUid)&&(e.sliceable?this.sliceableLayers:this.layers).push(e)}))}filterLayerViewUid(e){const{include:t,exclude:r}=this;return null==e?null==t&&null==r:(null==t||t.has(e))&&(null==r||!r.has(e))}filterRenderGeometry(e){return this.filterLayerViewUid(e.layerViewUid)}}function V(e){return"object"==typeof e&&"intersect"in e}const F=l(),S=l(),D=r();export{x as SceneIntersectionHelper,V as isIntersectionHandler};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{BufferViewVec2f16 as e,BufferViewVec2f as t,BufferViewVec2f64 as i,BufferViewVec3f as s,BufferViewVec3f64 as r,
|
|
5
|
+
import{BufferViewVec2f16 as e,BufferViewVec2f as t,BufferViewVec2f64 as i,BufferViewVec3f as s,BufferViewVec3f64 as r,BufferViewVec4f16 as n,BufferViewVec4f as h,BufferViewVec4f64 as d,BufferViewMat3f as u,BufferViewMat3f64 as f,BufferViewMat4f as o,BufferViewMat4f64 as l,BufferViewVec4u8 as p,BufferViewFloat16 as c,BufferViewFloat as a,BufferViewFloat64 as _,BufferViewUint8 as y,BufferViewUint16 as F,BufferViewInt8 as m,BufferViewVec2i8 as b,BufferViewVec2i16 as g,BufferViewVec2u8 as w,BufferViewVec4u16 as v,BufferViewUint32 as E,BufferViewVec3u8 as M,BufferViewVec2u16 as T,BufferViewVec3u16 as A,BufferViewVec2u32 as B,BufferViewVec3u32 as U,BufferViewVec4u32 as C,BufferViewVec3i8 as L,BufferViewVec4i8 as j,BufferViewInt16 as x,BufferViewVec3i16 as z,BufferViewVec4i16 as $,BufferViewInt32 as V,BufferViewVec2i32 as k,BufferViewVec3i32 as q,BufferViewVec4i32 as D}from"../../../../geometry/support/buffer/BufferView.js";import{elementTypeSize as G}from"../../../../geometry/support/buffer/types.js";import{assert as H}from"../../webgl-engine/lib/Util.js";class I{constructor(e,t){this.layout=e,this.buffer="number"==typeof t?new ArrayBuffer(t*e.stride):t;for(const i of e.fields.keys()){const t=e.fields.get(i);this[i]=new t.constructor(this.buffer,t.offset,this.stride)}}get stride(){return this.layout.stride}get count(){return this.buffer.byteLength/this.stride}get byteLength(){return this.buffer.byteLength}getField(e,t){const i=this[e];return i&&i.elementCount===t.ElementCount&&i.elementType===t.ElementType?i:null}slice(e,t){return new I(this.layout,this.buffer.slice(e*this.stride,t*this.stride))}copyFrom(e,t=0,i=0,s=e.count){const r=this.stride;if(r%4==0){const n=new Uint32Array(e.buffer,t*r,s*r/4);new Uint32Array(this.buffer,i*r,s*r/4).set(n)}else{const n=new Uint8Array(e.buffer,t*r,s*r);new Uint8Array(this.buffer,i*r,s*r).set(n)}return this}get cachedMemory(){return this.byteLength}dispose(){}}class J{constructor(e){this._stride=0,this._fields=new Map,e&&(this._stride=e.stride,e.fields.forEach((e=>this._fields.set(e[0],{...e[1],constructor:Q(e[1].constructor)}))))}freeze(){return this}vec2f16(t,i){return this._appendField(t,e,i),this}vec2f(e,i){return this._appendField(e,t,i),this}vec2f64(e,t){return this._appendField(e,i,t),this}vec3f(e,t){return this._appendField(e,s,t),this}vec3f64(e,t){return this._appendField(e,r,t),this}vec4f16(e,t){return this._appendField(e,n,t),this}vec4f(e,t){return this._appendField(e,h,t),this}vec4f64(e,t){return this._appendField(e,d,t),this}mat3f(e,t){return this._appendField(e,u,t),this}mat3f64(e,t){return this._appendField(e,f,t),this}mat4f(e,t){return this._appendField(e,o,t),this}mat4f64(e,t){return this._appendField(e,l,t),this}vec4u8(e,t){return this._appendField(e,p,t),this}f16(e,t){return this._appendField(e,c,t),this}f32(e,t){return this._appendField(e,a,t),this}f64(e,t){return this._appendField(e,_,t),this}u8(e,t){return this._appendField(e,y,t),this}u16(e,t){return this._appendField(e,F,t),this}i8(e,t){return this._appendField(e,m,t),this}vec2i8(e,t){return this._appendField(e,b,t),this}vec2i16(e,t){return this._appendField(e,g,t),this}vec2u8(e,t){return this._appendField(e,w,t),this}vec4u16(e,t){return this._appendField(e,v,t),this}u32(e,t){return this._appendField(e,E,t),this}_appendField(e,t,i){if(this._fields.has(e))return void H(!1,`${e} already added to vertex buffer layout`);const s=t.ElementCount*G(t.ElementType),r=this._stride;this._fields.set(e,{constructor:t,size:s,offset:r,optional:i}),this._alignFields()}_alignFields(){let e=0,t=1;this._fields.forEach((i=>{const s=G(i.constructor.ElementType);e=Math.floor((e+s-1)/s)*s,i.offset=e,e+=i.size,t=Math.max(t,s)})),e=Math.floor((e+t-1)/t)*t,this._stride=e}createBuffer(e){return new I(this,e)}createView(e){return new I(this,e)}clone(){const e=new J;return e._stride=this._stride,e._fields=new Map,this._fields.forEach(((t,i)=>e._fields.set(i,t))),e.BufferType=this.BufferType,e}get stride(){return this._stride}get fields(){return this._fields}}function K(){return new J}class N{constructor(e){this.fields=new Array,e.fields.forEach(((e,t)=>{const i={...e,constructor:P(e.constructor)};this.fields.push([t,i])})),this.stride=e.stride}}const O=[a,t,s,h,u,o,_,i,r,d,f,l,y,w,M,p,F,T,A,v,E,B,U,C,m,b,L,j,x,g,z,$,V,k,q,D];function P(e){return`${e.ElementType}_${e.ElementCount}`}function Q(e){return R.get(e)}const R=new Map;O.forEach((e=>R.set(P(e),e)));export{I as InterleavedBuffer,J as InterleavedLayout,N as PackedLayout,K as newLayout};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../Graphic.js";import has from"../../../core/has.js";import{isIterable as n}from"../../../core/iteratorUtils.js";import{createScreenPointArray as
|
|
5
|
+
import e from"../../../Graphic.js";import has from"../../../core/has.js";import{isIterable as n}from"../../../core/iteratorUtils.js";import{createScreenPointArray as i,screenPointObjectToArray as t}from"../../../core/screenUtils.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import s from"../../../geometry/Point.js";import o from"../../../geometry/SpatialReference.js";import{projectVectorToVector as l}from"../../../geometry/projection/projectVectorToVector.js";import{fallbackObjectIDAttribute as c}from"../../../layers/LayerConstants.js";import{isIntegratedMeshLayer as a}from"../../../layers/support/layerUtils.js";import{debugFlags as u}from"./debugFlags.js";import{getElevationAtPoint as d}from"./ElevationProvider.js";import{newIntersector as p}from"../webgl-engine/lib/Intersector.js";import{StoreResults as m,IntersectorType as f}from"../webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as g}from"../webgl-engine/lib/intersectorUtils.js";import{toOwner as h,toHit as y,toHitAsync as E}from"../webgl-engine/lib/intersectorUtilsConversions.js";import{terrainId as w}from"../webgl-engine/lib/verticalOffsetUtils.js";async function U(e,n,t,r){const s=t?C(e,t):r,o=i(n.x,n.y);s.requiresGroundFeedback=!0,s.enableDraped=!0;const l=p(e.state.viewingMode);l.options.selectionMode=!0,l.options.store=m.ALL,e.sceneIntersectionHelper.intersectIntersectorScreen(o,l,s);let c=[];c=has("feature-pipeline-3d-test")?await j(e,l.results.all,s.graphics):I(e,l.results.all,s.graphics);const d=l.results.ground,f=h(d,e),y=null!=f&&"type"in f&&a(f.type)?f:null,E={screenPoint:n,results:c,ground:{mapPoint:S(e,d),distance:g(d)?d.distanceInRenderSpace:0,layer:y}};return u.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(E.intersector=l),E}function b(e,n,i,r){const s=i?C(e,i):r,o=!(!s.graphics?.include&&!s.graphics?.exclude),l=!(!s.mediaElements?.include&&!s.mediaElements?.exclude),c=t(n);s.enableDraped=s.include&&!s.include.has(w)||s.exclude?.has(w);const a=e.sceneIntersectionHelper,u=p(e.state.viewingMode);if(u.options.selectionMode=!0,u.options.store=o||l?m.ALL:m.MIN,u.options.excludeLabels=i?.excludeLabels??!1,a.intersectIntersectorScreen(c,u,s),o||l){for(const n of u.results.all){const i=y(n,e);if(null==i)return S(e,n);if(o&&("graphic"!==i.type||x(s.graphics,i.graphic)))return S(e,n);if(l&&("media"!==i.type||R(s.mediaElements,i.element)))return S(e,n)}return null}return S(e,u.results.min)}function I(e,n,i){const t=new Array;let r=null;for(let s=0;s<n.length;s++){const o=n[s],l=h(o,e);if(null!=l&&(l===e.map.ground||"type"in l&&a(l.type)))break;const c=y(o,e);if(null==c)continue;if("graphic"===c.type){if(null==r&&s!==n.length-1&&(r=new Set),null!=r){const e=L(c.graphic);if(r.has(e))continue;r.add(e)}if(!x(i,c.graphic))continue}const u=S(e,o),d=o.distanceInRenderSpace;if("media"===c.type){const e=c.element.toSource(u);t.push({...c,mapPoint:u,distance:d,sourcePoint:e})}else t.push({...c,mapPoint:u,distance:d})}return t}async function j(e,n,i){const t=new Array;let r=null;for(let s=0;s<n.length;s++){const o=n[s],l=h(o,e);if(null!=l&&(l===e.map.ground||"type"in l&&a(l.type)))break;const c=await E(o,e);if(null==c)continue;if("graphic"===c.type){if(null==r&&s!==n.length-1&&(r=new Set),null!=r){const e=L(c.graphic);if(r.has(e))continue;r.add(e)}if(!x(i,c.graphic))continue}const u=S(e,o),d=o.distanceInRenderSpace;if("media"===c.type){const e=c.element.toSource(u);t.push({...c,mapPoint:u,distance:d,sourcePoint:e})}else t.push({...c,mapPoint:u,distance:d})}return t}function S(e,n,i){return n.getIntersectionPoint(A)?(i=V(e,A,i),n.intersector===f.TERRAIN&&e.basemapTerrain&&(i.z=d(e.basemapTerrain,i)??0),i):null}function L(e){const n=e.sourceLayer,i=e.layer,t=n&&"objectIdField"in n?n:i&&"objectIdField"in i?i:n;if(t){const n=t.objectIdField??c,i=e.attributes?.[n];if(i)return`o-${t.id}-${i}`}return`u-${e.uid}`}function x(e,n){return R(e,L(n))}function R(e,n){return null==e||(null==e.include||e.include.has(n))&&(null==e.exclude||!e.exclude.has(n))}function V(e,n,i){let t=e.spatialReference||o.WGS84;return l(n,e.renderSpatialReference,A,t)?n=A:(t=o.WGS84,l(n,e.renderSpatialReference,A,t)&&(n=A)),i?(i.x=n[0],i.y=n[1],i.z=n[2],i.spatialReference=t):i=new s(n,t),i}function C(e,n){const i=v(e,n.include,F.INCLUDE),t=v(e,n.exclude,F.EXCLUDE);return{include:i.layerViewUids,exclude:t.layerViewUids,graphics:{include:i.graphicUids,exclude:t.graphicUids},mediaElements:{include:i.mediaElements,exclude:t.mediaElements}}}function v(i,t,r,s={layerViewUids:void 0,graphicUids:void 0,mediaElements:void 0}){if(!t)return s;if(t instanceof e)N(s,L(t)),r===F.INCLUDE&&(null!=i.graphicsView&&t.layer===i?D(s,i.graphicsView.uid):t.layer&&P(s,i,t.layer.uid));else if("layer"in t&&"element"in t)T(s,t.element),r===F.INCLUDE&&P(s,i,t.layer.uid);else if(n(t))for(const e of t)e===i.graphics&&null!=i.graphicsView?D(s,i.graphicsView.uid):e===i.map.ground?D(s,w):v(i,e,r,s);else"uid"in t&&P(s,i,t.uid);return s}function P(e,n,i){const t=n.allLayerViews.find((e=>e.layer.uid===i));t&&D(e,t.uid)}function D(e,n){e.layerViewUids||(e.layerViewUids=new Set),e.layerViewUids.add(n)}function N(e,n){e.graphicUids||(e.graphicUids=new Set),e.graphicUids.add(n)}function T(e,n){e.mediaElements||(e.mediaElements=new Set),e.mediaElements.add(n)}const A=r();var F;!function(e){e[e.INCLUDE=0]="INCLUDE",e[e.EXCLUDE=1]="EXCLUDE"}(F||(F={}));export{V as computeMapPointFromVec3d,C as externalToInternalIntersectOptions,L as getGraphicFilterUid,U as hitTest,S as intersectResultToMapPoint,b as toMap};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{OverlayContent as e}from"./OverlayContent.js";import{OverlayFramebufferObject as r}from"./OverlayFramebufferObject.js";import{ColorFormat as o}from"../webgl/formats.js";import{ShaderOutput as t}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{olidEnabled as l}from"../webgl-engine/effects/geometry/olidUtils.js";class s{constructor(e,t,l,s,i=o.
|
|
5
|
+
import{OverlayContent as e}from"./OverlayContent.js";import{OverlayFramebufferObject as r}from"./OverlayFramebufferObject.js";import{ColorFormat as o}from"../webgl/formats.js";import{ShaderOutput as t}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{olidEnabled as l}from"../webgl-engine/effects/geometry/olidUtils.js";class s{constructor(e,t,l,s,i=o.RGBA8_MIPMAP){this.output=l,this.content=s,this.fbo=new r(e,i,t)}get valid(){return this.fbo.valid}}class i{constructor(r){this.targets=[new s(r,"overlay color",t.Color,e.Color),new s(r,"overlay IM color",t.Color,e.ColorNoRasterImage),new s(r,"overlay highlight",t.Highlight,e.Highlight,o.RG8UI),new s(r,"overlay water",t.Normal,e.WaterNormal),new s(r,"overlay occluded",t.Color,e.Occluded)],l()&&this.targets.push(new s(r,"overlay olid",t.ObjectAndLayerIdColor,e.ObjectAndLayerIdColor,o.RGBA8))}getTexture(e){return this.targets[e]?.fbo.texture}dispose(){for(const e of this.targets)e.fbo.dispose()}computeValidity(){return this.targets.reduce(((e,r,o)=>r.valid?e|=1<<o:e),0)}}export{i as OverlayRenderTargets,s as RenderTargetDescriptor};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import has from"../../../core/has.js";import{disposeMaybe as i}from"../../../core/maybe.js";import{MemCachePool as r}from"../../../core/MemCachePool.js";import s from"../../../core/ObjectPool.js";import{watch as n,sync as o}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{IDENTITY as c}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d,i as h,f as u}from"../../../chunks/vec32.js";import{ZEROS as g,fromValues as _,create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as f,ZEROS as m}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as b,set as y}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as T}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as R}from"../../ViewingMode.js";import{TextureUpdate as x}from"./interfaces.js";import{LayerClass as O}from"./LayerClass.js";import{OverlayContent as v}from"./OverlayContent.js";import{overlayRenderOccludedFlag as w}from"./OverlayRenderer.js";import{PatchRenderData as P}from"./PatchRenderData.js";import{RenderOrder as D}from"./RenderOrder.js";import{TerrainAttributesCache as S}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as C}from"./terrainUtils.js";import{TileRenderer as E}from"./TileRenderer.js";import{TileUpdate as A}from"./TileUpdate.js";import{IteratorPreorder as j,sortTiles as N,compareTiles as B}from"./tileUtils.js";import{TransparencyMode as I}from"./TransparencyMode.js";import{componentMinimalSizeForIntersectionData as q,ComponentIntersectionData as F}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as U}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{TileBlendInput as G}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{SyncRenderPlugin as M,ConsumesDepth as L,ConsumesNone as k}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as z}from"../webgl-engine/lib/Attribute.js";import{RenderRequestType as V}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as H}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as Y}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as Q,StoreResults as W}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as X}from"../webgl-engine/lib/Material.js";import{intersectAabbInvDirBefore as K,intersectTriangles as Z,MeshIntersectionOptions as J}from"../webgl-engine/lib/RayIntersections.js";import{RenderSlot as $}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as ee}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as te}from"../webgl-engine/lib/VertexAttribute.js";import{terrainId as ie,getVerticalOffsetTerrain as re}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as se}from"../webgl-engine/materials/DrawParameters.js";import{T as ne}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as oe}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as ae}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as le}from"../../webgl/enums.js";const ce=7,de=10,he=b();let ue=class extends M{get _isGlobal(){return this._stage.viewingMode===R.Global}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}constructor(e,t,i,n,o){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=i,this._ellipsoidRadius=n,this.type=Q.TERRAIN,this.isGround=!0,this._passParameters=new ne,this._drawParameters=new se,this._renderDataPool=new s(P),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new j,this._castShadows=!1,this._inViewshed=!1,this._emptyTex=null,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.renderOccludedFlags=X.Occlude,this.produces=new Map([[$.OPAQUE_TERRAIN,()=>this._produces()&&this.transparency===I.Opaque],[$.TRANSPARENT_TERRAIN,()=>this._produces()&&(this.transparency===I.Transparent||this.transparency===I.InvisibleWithDraped)],[$.OCCLUDED_TERRAIN,()=>this._produces()]]),this._tileSize=256,this._configuration=new ae(t.viewingMode===R.Global),this._tileTextureCache=new r(((e,t)=>o.newCache(e,t)),"TileTexture"),this.tileGeometryCache=new S(o)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(n((()=>this._overlayRenderer.rendersOccludedDraped),(e=>{this.renderOccludedFlags=e?w:X.Occlude,this.setNeedsRender()}),o))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy()}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}consumes(){return this._overlayRenderer.hasWater?L:k}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get tileRenderer(){return this._tileRenderer}get texturesBeingCompressed(){return this._tileRenderer?this._tileRenderer?.texturesBeingCompressed:null}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return this._configuration.visualizeNormals}set visualizeNormals(e){this._configuration.visualizeNormals!==e&&(this._configuration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._configuration.backfaceCullingEnabled}set cullBackFaces(e){this._configuration.backfaceCullingEnabled!==e&&(this._configuration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerUid(){return ie}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._configuration.screenSizePerspective!==e&&(this._configuration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,A.TEXTURE_FADING)}reuseTextureFromParent(e){const t=e.parent;if(!t)return!1;const i=f(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,i)??!1}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,t===A.TEXTURE_FADING?x.FADING:x.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[O.ELEVATION])i.pendingUpdates&=~A.GEOMETRY;e.resetPendingUpdate(A.GEOMETRY);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=de-ce,i=Math.max(0,Math.floor((e.level-t)/ce)*ce);if(this._isGlobal&&0===i)return g;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=V.UPDATE){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=V.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=V.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new E({rctx:this._rctx,tileSize:this._tileSize,techniques:this._techniques,cache:this._tileTextureCache}),this.updateTileBackground(),this._emptyTex=H(this._rctx)}uninitializeRenderContext(){this._emptyTex=i(this._emptyTex),this._tileRenderer=i(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==I.Opaque)return;const s=ge,n=_e;d(s,r,i),h(n,1/s[0],1/s[1],1/s[2]);const o=e.results.min,a=e.results.max,l=e.results.ground,g=e.options.store===W.MIN,_=!!e.results.ground.target,p=re(e.verticalOffset),f=e.tolerance;let m,b=g&&null!=o.dist?o.dist:1/0;const R=e.options,x=R.normalRequired||!R.backfacesTerrain,O=new J(!1,x),v=h=>{const _=h.renderData;if(!_?.vao)return;const v=_.geometry;y(he,v.boundingBox);const w=_.localOrigin;null!=p&&(p.localOrigin=w,p.applyToAabb(he));const P=he;if(pe[0]=i[0]-w[0],pe[1]=i[1]-w[1],pe[2]=i[2]-w[2],!K(P,pe,n,f,b))return;const D=(e,t,i)=>{e.set(this.type,h,t,i,c),b=g&&null!=o.dist?o.dist:1/0},S=(n,c,d)=>{if((!x||null!=d)&&n>=0&&(R.backfacesTerrain||u(d,s)<0)&&(R.invisibleTerrain||!R.selectionMode||null==t||t(i,r,n))){if((null==l.dist||n<l.dist)&&D(l,n,d),R.isFiltered)return;R.store===W.ALL&&(null==m?(m=Y(e.ray),D(m,n,d),e.results.all.push(m)):n<m.dist&&D(m,n,d)),(null==o.dist||n<o.dist)&&D(o,n,d),R.store!==W.MIN&&(null==a.dist||n>a.dist)&&D(a,n,d)}},C=fe;d(C,r,w);const{indices:E,indexCount:A}=v,j=v.vertexAttributes,N=j.getField(te.POSITION,T),B=new z(N.typedBuffer,3,j.stride/4),I=A/3;if(!p&&I>q){const e=h.renderData;null==e.intersectionData&&(e.intersectionData=new F(E,0,I,B)),e.intersectionData.intersectRay(pe,C,O,S)}else Z(pe,C,0,I,E,B,p,O,S)},w=this._rootTiles;if(null!=w){(()=>{const t=this._tileIterator;t.reset(w);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==p&&!e.intersectsRay(i,s,f,b)||_&&this._useStencilForTile(e)?t.skipSubtree():v(e)})()}}processScaleRangeQueries(e,t){if(!t.done)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}acquireTechniques(e){const t=!!has("enable-feature:terrain-shadows")&&e.bind.shadowMap.enabled;t!==this._castShadows&&(this._castShadows=t,this._patchesByOriginDirty=!0);const i=e.bind.viewshedEnabled;if(this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),e.bind.slot===$.OCCLUDED_TERRAIN){if(!(e.renderOccludedMask&w))return null}else{const t=this.transparency===I.Opaque?$.OPAQUE_TERRAIN:$.TRANSPARENT_TERRAIN;if(e.bind.slot!==t)return null}if(this.transparency===I.Invisible)return null;switch(this._configuration.screenSpaceReflections=this._configuration.cloudReflections=this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._configuration.overlayMode=this._overlayRenderer.mode,this._configuration.renderOccluded=!1,e.output){case U.Color:case U.ColorEmission:{this._configuration.screenSpaceReflections=null!=e.bind.ssr.lastFrameColor,this._configuration.cloudReflections=null!=e.bind.clouds.data,this._configuration.receiveShadows=e.bind.shadowMap.ready;const t=e.bind.slot===$.OCCLUDED_TERRAIN;return this._configuration.renderOccluded=t,this._configuration.receiveAmbientOcclusion=!t&&null!=e.bind.ssao,this._acquireTechnique(e.output)}case U.Shadow:case U.ShadowExcludeHighlight:return this._castShadows?this._acquireTechnique(U.Shadow):null;case U.ViewshedShadow:return this._inViewshed?this._acquireTechnique(U.ViewshedShadow):null;case U.Depth:case U.Normal:return this._acquireTechnique(e.output);case U.ObjectAndLayerIdColor:return this._acquireTechnique(U.ObjectAndLayerIdColor);case U.Highlight:return this._overlayRenderer.hasHighlights?this._acquireTechnique(U.Highlight):null}return null}render(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case U.Color:case U.ColorEmission:{const i=e.bind.slot===$.OCCLUDED_TERRAIN?v.Occluded:v.Color;this._renderMaterialPass(e,t,i);break}case U.Depth:case U.Normal:this._renderAuxiliaryPass(e,t,v.Color,this._visiblePatchesByOrigin);break;case U.Highlight:{const i=e.bind.highlight?.name;i&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(v.Highlight)&&this._overlayRenderer.hasHighlight(i)&&this._renderAuxiliaryPass(e,t,v.Highlight,this._visiblePatchesByOrigin);break}case U.Shadow:case U.ShadowExcludeHighlight:case U.ViewshedShadow:this._renderAuxiliaryPass(e,t,null,this._allPatchesByOrigin);break;case U.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,v.ObjectAndLayerIdColor,this._visiblePatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const i=this._tileRenderer;let r;if(null!=e){const i=t.toUnitRGBA(e);r=_(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(r),this._allTiles.forAll((e=>i.updateTileTexture(e,x.FADING))),this._configuration.tileBlendInput=i.backgroundIsGrid?G.GridComposite:null!=i.backgroundColor?G.ColorComposite:G.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==D.NONE){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)N(this.renderOrder,i,t);e.sort(((e,t)=>B(e[0],t[0],this.renderOrder))),this._visiblePatchesByOrigin=new Map(e.map((e=>[e[0].renderData.localOrigin,e]))),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i,r){const s=e.rctx;this._passParameters.overlayContent=i,s.bindTechnique(t,e.bind,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;r.forEach((r=>{this._drawParameters.origin=r[0].renderData.localOrigin,t.program.bindDraw(e.bind,this._passParameters,this._drawParameters);for(let s=0;s<r.length;s++)this._renderPatch(e,t,r[s],le.TRIANGLES,n,i)})),e.rctx.bindVAO(null)}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlayContent=i,r.bindTechnique(t,e.bind,this._passParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const s=e.bind.camera,n=t.program;if(this._configuration.screenSizePerspective&&this.pointsOfInterest){const e=ee(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:s.fovY})}const o=this._stencilEnabledLayerExtents.length>0,a=i===v.Occluded;a&&(n.bindTexture("tex",this._emptyTex),n.setUniform3fv("textureOpacities",g),n.setUniform4fv("texOffsetAndScale",m));const l=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:g;this._configuration.tileBlendInput===G.ColorComposite&&n.setUniform3fv("backgroundColor",l);const c=this.wireframe?le.LINES:le.TRIANGLES;this._configuration.textureFadingEnabled&&n.bindTexture("texNext",this._emptyTex);const d=this._visiblePatchesByOrigin;for(const h of d.values()){const r=h[0].renderData.localOrigin;this._drawParameters.origin=r,t.program.bindDraw(e.bind,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const s of h){const r=s.renderData,l=r.textureReference;if(null!=l){if(!a){n.setUniform4fv("texOffsetAndScale",l.offsetAndScale),n.bindTexture("tex",l.texture.texture);const e=r.textureFadeFactor,t=e<1?r.nextTextureReference:null;this._configuration.textureFadingEnabled&&null!=t&&e<1?(n.setUniform1f("fadeFactor",e),n.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),n.setUniform3fv("nextTexOpacities",t.opacities),n.bindTexture("texNext",t.texture.texture)):n.setUniform1f("fadeFactor",1),r.textureIsFading&&this.setNeedsRender(),n.setUniform3fv("textureOpacities",l.opacities)}this._renderPatch(e,t,s,c,o,i),s.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,t,i,r,s,n){const o=i.renderData,a=o.vao,l=a?.indexBuffer;if(!a||null==l)return void(C&&console.error("Rendered tile with no indices: ",i.lij," : ",o));const c=t.program;null==n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,o.overlay),s&&(t.useStencil=this._useStencilForTile(i),e.rctx.setPipelineState(t.getPipeline()));const d=o.geometry.indexCount;e.rctx.bindVAO(a),c.assertCompatibleVertexAttributeLocations(a),e.rctx.drawElements(r,d,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(oe,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([a({readOnly:!0})],ue.prototype,"_isGlobal",null),e([a()],ue.prototype,"renderOccludedFlags",void 0),e([a({value:!1})],ue.prototype,"renderingDisabled",null),e([a({value:!0})],ue.prototype,"visible",null),e([a()],ue.prototype,"texturesBeingCompressed",null),e([a()],ue.prototype,"renderPatchBorders",null),e([a()],ue.prototype,"visualizeNormals",null),e([a()],ue.prototype,"cullBackFaces",null),e([a({value:D.FRONT_TO_BACK})],ue.prototype,"renderOrder",null),e([a()],ue.prototype,"wireframe",null),ue=e([l("esri.views.3d.terrain.TerrainRenderer")],ue);const ge=p(),_e=p(),pe=p(),fe=p();export{ue as TerrainRenderer};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import has from"../../../core/has.js";import{disposeMaybe as i}from"../../../core/maybe.js";import{MemCachePool as r}from"../../../core/MemCachePool.js";import s from"../../../core/ObjectPool.js";import{watch as n,sync as o}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{IDENTITY as c}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d,i as h,f as u}from"../../../chunks/vec32.js";import{ZEROS as g,fromValues as _,create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as f,ZEROS as m}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as b,set as y}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as T}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as R}from"../../ViewingMode.js";import{TextureUpdate as x}from"./interfaces.js";import{LayerClass as O}from"./LayerClass.js";import{OverlayContent as v}from"./OverlayContent.js";import{overlayRenderOccludedFlag as w}from"./OverlayRenderer.js";import{PatchRenderData as P}from"./PatchRenderData.js";import{RenderOrder as D}from"./RenderOrder.js";import{TerrainAttributesCache as S}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as C}from"./terrainUtils.js";import{TileRenderer as E}from"./TileRenderer.js";import{TileUpdate as A}from"./TileUpdate.js";import{IteratorPreorder as j,sortTiles as N,compareTiles as B}from"./tileUtils.js";import{TransparencyMode as I}from"./TransparencyMode.js";import{componentMinimalSizeForIntersectionData as q,ComponentIntersectionData as F}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as U}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{TileBlendInput as G}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{SyncRenderPlugin as M,ConsumesDepth as L,ConsumesNone as k}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as z}from"../webgl-engine/lib/Attribute.js";import{RenderRequestType as V}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as H}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as Y}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as Q,StoreResults as W}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as X}from"../webgl-engine/lib/Material.js";import{intersectAabbInvDirBefore as K,intersectTriangles as Z,MeshIntersectionOptions as J}from"../webgl-engine/lib/RayIntersections.js";import{RenderSlot as $}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as ee}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as te}from"../webgl-engine/lib/VertexAttribute.js";import{terrainId as ie,getVerticalOffsetTerrain as re}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as se}from"../webgl-engine/materials/DrawParameters.js";import{T as ne}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as oe}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as ae}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as le}from"../../webgl/enums.js";const ce=7,de=10,he=b();let ue=class extends M{get _isGlobal(){return this._stage.viewingMode===R.Global}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}constructor(e,t,i,n,o){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=i,this._ellipsoidRadius=n,this.type=Q.TERRAIN,this.isGround=!0,this._passParameters=new ne,this._drawParameters=new se,this._renderDataPool=new s(P),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new j,this._castShadows=!1,this._inViewshed=!1,this._emptyTex=null,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.renderOccludedFlags=X.Occlude,this.produces=new Map([[$.OPAQUE_TERRAIN,()=>this._produces()&&this.transparency===I.Opaque],[$.TRANSPARENT_TERRAIN,()=>this._produces()&&(this.transparency===I.Transparent||this.transparency===I.InvisibleWithDraped)],[$.OCCLUDED_TERRAIN,()=>this._produces()]]),this._tileSize=256,this._configuration=new ae(t.viewingMode===R.Global),this._tileTextureCache=new r(((e,t)=>o.newCache(e,t)),"TileTexture"),this.tileGeometryCache=new S(o)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(n((()=>this._overlayRenderer.rendersOccludedDraped),(e=>{this.renderOccludedFlags=e?w:X.Occlude,this.setNeedsRender()}),o))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy()}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}consumes(){return this._overlayRenderer.hasWater?L:k}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get tileRenderer(){return this._tileRenderer}get texturesBeingCompressed(){return this._tileRenderer?this._tileRenderer?.texturesBeingCompressed:null}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return this._configuration.visualizeNormals}set visualizeNormals(e){this._configuration.visualizeNormals!==e&&(this._configuration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._configuration.backfaceCullingEnabled}set cullBackFaces(e){this._configuration.backfaceCullingEnabled!==e&&(this._configuration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerViewUid(){return ie}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._configuration.screenSizePerspective!==e&&(this._configuration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,A.TEXTURE_FADING)}reuseTextureFromParent(e){const t=e.parent;if(!t)return!1;const i=f(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,i)??!1}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,t===A.TEXTURE_FADING?x.FADING:x.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[O.ELEVATION])i.pendingUpdates&=~A.GEOMETRY;e.resetPendingUpdate(A.GEOMETRY);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=de-ce,i=Math.max(0,Math.floor((e.level-t)/ce)*ce);if(this._isGlobal&&0===i)return g;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=V.UPDATE){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=V.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=V.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new E({rctx:this._rctx,tileSize:this._tileSize,techniques:this._techniques,cache:this._tileTextureCache}),this.updateTileBackground(),this._emptyTex=H(this._rctx)}uninitializeRenderContext(){this._emptyTex=i(this._emptyTex),this._tileRenderer=i(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==I.Opaque)return;const s=ge,n=_e;d(s,r,i),h(n,1/s[0],1/s[1],1/s[2]);const o=e.results.min,a=e.results.max,l=e.results.ground,g=e.options.store===W.MIN,_=!!e.results.ground.target,p=re(e.verticalOffset),f=e.tolerance;let m,b=g&&null!=o.dist?o.dist:1/0;const R=e.options,x=R.normalRequired||!R.backfacesTerrain,O=new J(!1,x),v=h=>{const _=h.renderData;if(!_?.vao)return;const v=_.geometry;y(he,v.boundingBox);const w=_.localOrigin;null!=p&&(p.localOrigin=w,p.applyToAabb(he));const P=he;if(pe[0]=i[0]-w[0],pe[1]=i[1]-w[1],pe[2]=i[2]-w[2],!K(P,pe,n,f,b))return;const D=(e,t,i)=>{e.set(this.type,h,t,i,c),b=g&&null!=o.dist?o.dist:1/0},S=(n,c,d)=>{if((!x||null!=d)&&n>=0&&(R.backfacesTerrain||u(d,s)<0)&&(R.invisibleTerrain||!R.selectionMode||null==t||t(i,r,n))){if((null==l.dist||n<l.dist)&&D(l,n,d),R.isFiltered)return;R.store===W.ALL&&(null==m?(m=Y(e.ray),D(m,n,d),e.results.all.push(m)):n<m.dist&&D(m,n,d)),(null==o.dist||n<o.dist)&&D(o,n,d),R.store!==W.MIN&&(null==a.dist||n>a.dist)&&D(a,n,d)}},C=fe;d(C,r,w);const{indices:E,indexCount:A}=v,j=v.vertexAttributes,N=j.getField(te.POSITION,T),B=new z(N.typedBuffer,3,j.stride/4),I=A/3;if(!p&&I>q){const e=h.renderData;null==e.intersectionData&&(e.intersectionData=new F(E,0,I,B)),e.intersectionData.intersectRay(pe,C,O,S)}else Z(pe,C,0,I,E,B,p,O,S)},w=this._rootTiles;if(null!=w){(()=>{const t=this._tileIterator;t.reset(w);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==p&&!e.intersectsRay(i,s,f,b)||_&&this._useStencilForTile(e)?t.skipSubtree():v(e)})()}}processScaleRangeQueries(e,t){if(!t.done)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}acquireTechniques(e){const t=!!has("enable-feature:terrain-shadows")&&e.bind.shadowMap.enabled;t!==this._castShadows&&(this._castShadows=t,this._patchesByOriginDirty=!0);const i=e.bind.viewshedEnabled;if(this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),e.bind.slot===$.OCCLUDED_TERRAIN){if(!(e.renderOccludedMask&w))return null}else{const t=this.transparency===I.Opaque?$.OPAQUE_TERRAIN:$.TRANSPARENT_TERRAIN;if(e.bind.slot!==t)return null}if(this.transparency===I.Invisible)return null;switch(this._configuration.screenSpaceReflections=this._configuration.cloudReflections=this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._configuration.overlayMode=this._overlayRenderer.mode,this._configuration.renderOccluded=!1,e.output){case U.Color:case U.ColorEmission:{this._configuration.screenSpaceReflections=null!=e.bind.ssr.lastFrameColor,this._configuration.cloudReflections=null!=e.bind.clouds.data,this._configuration.receiveShadows=e.bind.shadowMap.ready;const t=e.bind.slot===$.OCCLUDED_TERRAIN;return this._configuration.renderOccluded=t,this._configuration.receiveAmbientOcclusion=!t&&null!=e.bind.ssao,this._acquireTechnique(e.output)}case U.Shadow:case U.ShadowExcludeHighlight:return this._castShadows?this._acquireTechnique(U.Shadow):null;case U.ViewshedShadow:return this._inViewshed?this._acquireTechnique(U.ViewshedShadow):null;case U.Depth:case U.Normal:return this._acquireTechnique(e.output);case U.ObjectAndLayerIdColor:return this._acquireTechnique(U.ObjectAndLayerIdColor);case U.Highlight:return this._overlayRenderer.hasHighlights?this._acquireTechnique(U.Highlight):null}return null}render(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case U.Color:case U.ColorEmission:{const i=e.bind.slot===$.OCCLUDED_TERRAIN?v.Occluded:v.Color;this._renderMaterialPass(e,t,i);break}case U.Depth:case U.Normal:this._renderAuxiliaryPass(e,t,v.Color,this._visiblePatchesByOrigin);break;case U.Highlight:{const i=e.bind.highlight?.name;i&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(v.Highlight)&&this._overlayRenderer.hasHighlight(i)&&this._renderAuxiliaryPass(e,t,v.Highlight,this._visiblePatchesByOrigin);break}case U.Shadow:case U.ShadowExcludeHighlight:case U.ViewshedShadow:this._renderAuxiliaryPass(e,t,null,this._allPatchesByOrigin);break;case U.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,v.ObjectAndLayerIdColor,this._visiblePatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const i=this._tileRenderer;let r;if(null!=e){const i=t.toUnitRGBA(e);r=_(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(r),this._allTiles.forAll((e=>i.updateTileTexture(e,x.FADING))),this._configuration.tileBlendInput=i.backgroundIsGrid?G.GridComposite:null!=i.backgroundColor?G.ColorComposite:G.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==D.NONE){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)N(this.renderOrder,i,t);e.sort(((e,t)=>B(e[0],t[0],this.renderOrder))),this._visiblePatchesByOrigin=new Map(e.map((e=>[e[0].renderData.localOrigin,e]))),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i,r){const s=e.rctx;this._passParameters.overlayContent=i,s.bindTechnique(t,e.bind,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;r.forEach((r=>{this._drawParameters.origin=r[0].renderData.localOrigin,t.program.bindDraw(e.bind,this._passParameters,this._drawParameters);for(let s=0;s<r.length;s++)this._renderPatch(e,t,r[s],le.TRIANGLES,n,i)})),e.rctx.bindVAO(null)}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlayContent=i,r.bindTechnique(t,e.bind,this._passParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const s=e.bind.camera,n=t.program;if(this._configuration.screenSizePerspective&&this.pointsOfInterest){const e=ee(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:s.fovY})}const o=this._stencilEnabledLayerExtents.length>0,a=i===v.Occluded;a&&(n.bindTexture("tex",this._emptyTex),n.setUniform3fv("textureOpacities",g),n.setUniform4fv("texOffsetAndScale",m));const l=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:g;this._configuration.tileBlendInput===G.ColorComposite&&n.setUniform3fv("backgroundColor",l);const c=this.wireframe?le.LINES:le.TRIANGLES;this._configuration.textureFadingEnabled&&n.bindTexture("texNext",this._emptyTex);const d=this._visiblePatchesByOrigin;for(const h of d.values()){const r=h[0].renderData.localOrigin;this._drawParameters.origin=r,t.program.bindDraw(e.bind,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const s of h){const r=s.renderData,l=r.textureReference;if(null!=l){if(!a){n.setUniform4fv("texOffsetAndScale",l.offsetAndScale),n.bindTexture("tex",l.texture.texture);const e=r.textureFadeFactor,t=e<1?r.nextTextureReference:null;this._configuration.textureFadingEnabled&&null!=t&&e<1?(n.setUniform1f("fadeFactor",e),n.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),n.setUniform3fv("nextTexOpacities",t.opacities),n.bindTexture("texNext",t.texture.texture)):n.setUniform1f("fadeFactor",1),r.textureIsFading&&this.setNeedsRender(),n.setUniform3fv("textureOpacities",l.opacities)}this._renderPatch(e,t,s,c,o,i),s.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,t,i,r,s,n){const o=i.renderData,a=o.vao,l=a?.indexBuffer;if(!a||null==l)return void(C&&console.error("Rendered tile with no indices: ",i.lij," : ",o));const c=t.program;null==n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,o.overlay),s&&(t.useStencil=this._useStencilForTile(i),e.rctx.setPipelineState(t.getPipeline()));const d=o.geometry.indexCount;e.rctx.bindVAO(a),c.assertCompatibleVertexAttributeLocations(a),e.rctx.drawElements(r,d,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(oe,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([a({readOnly:!0})],ue.prototype,"_isGlobal",null),e([a()],ue.prototype,"renderOccludedFlags",void 0),e([a({value:!1})],ue.prototype,"renderingDisabled",null),e([a({value:!0})],ue.prototype,"visible",null),e([a()],ue.prototype,"texturesBeingCompressed",null),e([a()],ue.prototype,"renderPatchBorders",null),e([a()],ue.prototype,"visualizeNormals",null),e([a()],ue.prototype,"cullBackFaces",null),e([a({value:D.FRONT_TO_BACK})],ue.prototype,"renderOrder",null),e([a()],ue.prototype,"wireframe",null),ue=e([l("esri.views.3d.terrain.TerrainRenderer")],ue);const ge=p(),_e=p(),pe=p(),fe=p();export{ue as TerrainRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ManagedFBOAttachment as t}from"./ManagedFBOAttachment.js";import{AttachmentType as e}from"./
|
|
5
|
+
import{ManagedFBOAttachment as t}from"./ManagedFBOAttachment.js";import{AttachmentType as e}from"./ManagedFBOResource.js";class s extends t{constructor(t,s,r){super(t,s,r),this.attachment=s,this.type=e.COLOR}}export{s as ManagedColorAttachment};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ManagedFBOAttachment as t}from"./ManagedFBOAttachment.js";import{AttachmentType as e}from"./
|
|
5
|
+
import{ManagedFBOAttachment as t}from"./ManagedFBOAttachment.js";import{AttachmentType as e}from"./ManagedFBOResource.js";class r extends t{constructor(){super(...arguments),this.type=e.DEPTH}}export{r as ManagedDepthAttachment};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{someMap as t}from"../../../core/MapUtils.js";import{releaseMaybe as e}from"../../../core/maybe.js";import{RenderCategory as h}from"../webgl.js";import{isManagedDepthTexture as r}from"./ManagedDepthTexture.js";import{
|
|
5
|
+
import{someMap as t}from"../../../core/MapUtils.js";import{releaseMaybe as e}from"../../../core/maybe.js";import{RenderCategory as h}from"../webgl.js";import{isManagedDepthTexture as r}from"./ManagedDepthTexture.js";import{ManagedFBOResource as s,AttachmentType as o}from"./ManagedFBOResource.js";import{DepthStencilAttachment as i,ColorAttachment0 as a}from"../../webgl/enums.js";class c extends s{constructor(t,e,r,s,i,a){super(t,a),this.type=o.FBO,this._colors=new Map,this._name=h.COMPOSITE,this.acquireDepth=null,this.acquireColor=null,this._name=e,this.fbo=r,this.acquireDepth=s,this.acquireColor=i}dispose(){this.fbo?.dispose()}get cachedMemory(){return this.fbo?.usedMemory||0}get numberOfColorAttachments(){return this._colors.size}get name(){return this._name}setName(t){this._name=t}getTexture(t=a){return t===i?this.fbo?.depthStencilTexture:this.fbo?.getColorTexture(t)}getAttachment(t=a){return t===i?this._depth:this._colors.get(t)}hasAttachment(e){return t(this._colors,(t=>t.name===e))}attachDepth(t){return t?.retain(),this.detachDepth(),t&&this.fbo?.attachDepthStencil(t.attachment),this._depth=t,this}detachDepth(){this.fbo?.detachDepthStencilTexture(),this.fbo?.detachDepthStencilBuffer(),this._depth=e(this._depth)}obtainDepthTexture(){const t=this._depth;return r(t)?(this.fbo?.detachDepthStencilTexture(),this._depth=null,t):null}attachColor(t,e){return t.retain(),this.detachColor(e),this.fbo?.attachColorTexture(t.attachment,e),this._colors.set(e,t),this}detachColor(t){this.fbo?.detachColorTexture(t);const e=this._colors.get(t);this._colors.delete(t),e?.release()}detachAll(){this._colors.forEach(((t,e)=>this.detachColor(e))),this.detachDepth()}}export{c 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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{ManagedFBOResource as t}from"./ManagedFBOResource.js";class e extends t{constructor(t,e,s){super(t,s),this.attachment=e,this.name=""}dispose(){this.attachment.dispose()}get cachedMemory(){return this.attachment.usedMemory}}export{e as ManagedFBOAttachment};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
class e{constructor(e,t){this.key=e,this.free=t,this.incarnation=0,this._refCount=1}retain(e=1){this._refCount+=e}release(){return 0===this._refCount?(console.log(`Releasing already released FBO attachment "${this.name}" in ${(new Error).stack}`),!0):(--this._refCount,0===this._refCount&&(this.free(),!0))}}var t;!function(e){e[e.FBO=0]="FBO",e[e.DEPTH=1]="DEPTH",e[e.COLOR=2]="COLOR"}(t||(t={}));export{t as AttachmentType,e as
|
|
5
|
+
class e{constructor(e,t){this.key=e,this.free=t,this.incarnation=0,this._refCount=1}retain(e=1){this._refCount+=e}release(){return 0===this._refCount?(console.log(`Releasing already released FBO attachment "${this.name}" in ${(new Error).stack}`),!0):(--this._refCount,0===this._refCount&&(this.free(),!0))}}var t;!function(e){e[e.FBO=0]="FBO",e[e.DEPTH=1]="DEPTH",e[e.COLOR=2]="COLOR"}(t||(t={}));export{t as AttachmentType,e as ManagedFBOResource};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
var
|
|
5
|
+
import{RenderbufferFormat as R}from"../../webgl/enums.js";var G;!function(R){R[R.R8=33321]="R8",R[R.R8UI=33330]="R8UI",R[R.RG8=33323]="RG8",R[R.RG8UI=33336]="RG8UI",R[R.RGBA4=32854]="RGBA4",R[R.RGBA8=32856]="RGBA8",R[R.RGBA8_MIPMAP=42843]="RGBA8_MIPMAP",R[R.R16F=33325]="R16F",R[R.RGBA16F=34842]="RGBA16F"}(G||(G={}));const A=R.DEPTH_COMPONENT16;export{G as ColorFormat,A as DepthRenderbuffer16f};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/Error.js";import{ColorFormat as t,
|
|
5
|
+
import e from"../../../../core/Error.js";import{ColorFormat as t,DepthRenderbuffer16f as r}from"../../webgl/formats.js";import{ManagedColorAttachment as a}from"../../webgl/ManagedColorAttachment.js";import{ManagedDepthAttachment as o}from"../../webgl/ManagedDepthAttachment.js";import n from"../../webgl/ManagedFBO.js";import{AttachmentType as i}from"../../webgl/ManagedFBOResource.js";import{FBOPool as c}from"./FBOPool.js";import{PixelFormat as h,SizedPixelFormat as s,TextureWrapMode as m,TextureSamplingMode as l,PixelType as d,DepthStencilAttachment as _,RenderbufferFormat as p,ColorAttachment0 as u}from"../../../webgl/enums.js";import{FramebufferObject as f}from"../../../webgl/FramebufferObject.js";import{Renderbuffer as w}from"../../../webgl/Renderbuffer.js";import{RenderbufferDescriptor as E}from"../../../webgl/RenderbufferDescriptor.js";import{Texture as C}from"../../../webgl/Texture.js";import{TextureDescriptor as b}from"../../../webgl/TextureDescriptor.js";class A{constructor(e){this.rctx=e,this._acquired=new Set,this._cache=new c(e.newCache,"FBOCache"),this._depthCache=new c(e.newCache,"DepthAttachmentCache"),this._colorCache=new c(e.newCache,"ColorAttachmentCache")}destroy(){this._cache.destroy(),this._depthCache.destroy(),this._colorCache.destroy()}clean(){this._cache.clean(),this._colorCache.clean(),this._depthCache.clean()}frameStart(){this._cache.frame(),this._colorCache.frame(),this._depthCache.frame(),this.debugCallback?.()}frameEnd(){const e=this.debugCallback;e&&this._acquired.forEach((t=>t.type===i.FBO&&e(t.name,t.fbo,t.numberOfColorAttachments)))}get usedMemory(){return Array.from(this._acquired.values()).reduce(((e,t)=>e+("getTexture"in t?t.getTexture()?.usedMemory??0:t.cachedMemory)),this._cache.usedMemory+this._colorCache.usedMemory+this._depthCache.usedMemory)}set interactive(e){this._cache.interactive=this._colorCache.interactive=this._depthCache.interactive=e}acquire(r,a,o,i=t.RGBA8){const c=T(i,r,a);let h=this._cache.pop(c);if(h){h.retain(),h.setName(o);const t=this.rctx.getBoundFramebufferObject();if(this.rctx.bindFramebuffer(h.fbo),this.rctx.setDrawBuffers([u]),!h.fbo)throw new e("attempt to use a not existing framebuffer");this.rctx.unbindTexture(h.fbo.colorTexture),this.rctx.bindFramebuffer(t)}else h=new n(c,o,new f(this.rctx,{...P[i],width:r,height:a}),(e=>{e??=_;const t=this._acquireDepth(e,h.fbo.width,h.fbo.height,`${h.name} depth`);return h.attachDepth(t),t.release(),h}),((e,o,n)=>{o??=t.RGBA8;const i=this._acquireColor(o,r,a,n??`${h.name} color ${e}`);return this.rctx.unbindTexture(i.attachment),h.attachColor(i,e),i.release(),h}),(()=>{this.debugCallback?.(h.name,h.fbo,h.numberOfColorAttachments),h.fbo?.invalidateAttachments([u],!0),this._acquired.delete(h),h.detachAll(),this._cache.put(h)}));return this._trackHandle(h)}acquireDepth(e,t,r,a){return this._acquireDepth(e,t,r,a)}_acquireDepth(e,t,r,a){const n=T(e,t,r),i=this._depthCache.pop(n);if(i)return i.retain(),i.name=a,this._trackHandle(i);const c=new o(n,e===_?new C(this.rctx,{...j[e],width:t,height:r}):new w(this.rctx,{...j[e],width:t,height:r}),(()=>{this._acquired.delete(c),this._depthCache.put(c)}));return c.name=a,this._trackHandle(c)}_acquireColor(e,t,r,o){const n=T(e,t,r),i=this._colorCache.pop(n);if(i)return i.retain(),i.name=o,this._trackHandle(i);const c=new a(n,new C(this.rctx,{...P[e],width:t,height:r}),(()=>{this._acquired.delete(c),this._colorCache.put(c)}));return c.name=o,this._trackHandle(c)}_trackHandle(e){return this._acquired.add(e),e}}const M=new n("default","default",null,(()=>M),(()=>M),(()=>{}));function T(e,t,r){return`${e}x${t}x${r}`}M.release=()=>!1;const R=new b;R.pixelFormat=h.RED,R.internalFormat=s.R8,R.wrapMode=m.CLAMP_TO_EDGE;const g=new b;g.pixelFormat=h.RED_INTEGER,g.internalFormat=s.R8UI,g.wrapMode=m.CLAMP_TO_EDGE,g.samplingMode=l.NEAREST;const F=new b;F.pixelFormat=h.RG,F.internalFormat=s.RG8,F.wrapMode=m.CLAMP_TO_EDGE;const x=new b;x.pixelFormat=h.RG_INTEGER,x.internalFormat=s.RG8UI,x.wrapMode=m.CLAMP_TO_EDGE,x.samplingMode=l.NEAREST;const D=new b;D.internalFormat=s.RGBA4,D.dataType=d.UNSIGNED_SHORT_4_4_4_4,D.wrapMode=m.CLAMP_TO_EDGE;const G=new b;G.wrapMode=m.CLAMP_TO_EDGE;const O=new b;O.wrapMode=m.CLAMP_TO_EDGE,O.samplingMode=l.LINEAR_MIPMAP_LINEAR,O.hasMipmap=!0,O.maxAnisotropy=8;const N=new b;N.pixelFormat=h.RED,N.dataType=d.HALF_FLOAT,N.internalFormat=s.R16F,N.samplingMode=l.NEAREST;const y=new b;y.dataType=d.HALF_FLOAT,y.internalFormat=s.RGBA16F,y.samplingMode=l.NEAREST;const P={[t.R8]:R,[t.R8UI]:g,[t.RG8]:F,[t.RG8UI]:x,[t.RGBA4]:D,[t.RGBA8]:G,[t.RGBA8_MIPMAP]:O,[t.R16F]:N,[t.RGBA16F]:y},L=new b;L.pixelFormat=h.DEPTH_STENCIL,L.dataType=d.UNSIGNED_INT_24_8,L.samplingMode=l.NEAREST,L.wrapMode=m.CLAMP_TO_EDGE,L.internalFormat=h.DEPTH24_STENCIL8;const j={[_]:L,[r]:new E(p.DEPTH_COMPONENT16,4)};export{A as FBOCache,M as defaultWebGLFBO};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../../core/mathUtils.js";import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{b as BloomBlurPassParameters,a as BlurDirection,c as
|
|
5
|
+
import"../../../../../core/mathUtils.js";import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./BloomPresets.glsl.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{b as BloomBlurPassParameters,a as BlurDirection,c as build}from"../../../../../chunks/BloomBlur.glsl.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/Float2BindUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/FloatsPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/IntegerPassUniform.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{a as BloomCompositionPassParameters,b as build,d as defaultCompositionParameters
|
|
5
|
+
import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/Float2BindUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/FloatsPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/IntegerPassUniform.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./BloomPresets.glsl.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{a as BloomCompositionPassParameters,b as build,d as defaultCompositionParameters}from"../../../../../chunks/BloomComposition.glsl.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
const n={sunny:25,cloudy:25,rainy:15,snowy:15,foggy:15},y={sunny:5e-4,cloudy:5e-4,rainy:5e-4,snowy:.0022,foggy:.0022};class o{constructor(n,y){this.near=n,this.far=y}}const s={sunny:new o([.15,.05,.01,0,0],[1,.4,.2,.1,.05]),cloudy:new o([.15,.05,.01,0,0],[1,.4,.2,.1,.05]),rainy:new o([.15,.05,.01,0,0],[1,.4,.2,.1,.05]),snowy:new o([.15,.05,.01,0,0],[1,.4,.2,.1,.05]),foggy:new o([.15,.05,.01,0,0],[1,.4,.2,.1,.05])};export{y as blurRadiusPresets,n as exposurePresets,s as lodFactorsPresets};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{lerp as t}from"../../../../../core/mathUtils.js";import{watch as r,syncAndInitial as s}from"../../../../../core/reactiveUtils.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 i}from"../../../../../core/accessorSupport/decorators/subclass.js";import{RenderCategory as a}from"../../../webgl.js";import m from"../../../webgl/RenderNode.js";import{b as
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{lerp as t}from"../../../../../core/mathUtils.js";import{watch as r,syncAndInitial as s}from"../../../../../core/reactiveUtils.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 i}from"../../../../../core/accessorSupport/decorators/subclass.js";import{RenderCategory as a}from"../../../webgl.js";import m from"../../../webgl/RenderNode.js";import{b as l,a as n}from"../../../../../chunks/BloomBlur.glsl.js";import{BloomBlurTechnique as u}from"./BloomBlurTechnique.js";import{BloomBlurTechniqueConfiguration as h}from"./BloomBlurTechniqueConfiguration.js";import{a as c}from"../../../../../chunks/BloomComposition.glsl.js";import{BloomCompositionTechnique as p}from"./BloomCompositionTechnique.js";import{a as d}from"../../../../../chunks/BloomDepthAdjust.glsl.js";import{BloomDepthAdjustTechnique as b}from"./BloomDepthAdjustTechnique.js";import{blurRadiusPresets as _,exposurePresets as g,lodFactorsPresets as f}from"./BloomPresets.glsl.js";import{RenderRequestType as P}from"../../lib/basicInterfaces.js";import{ColorAttachment1 as j,DepthStencilAttachment as T,FramebufferBit as q}from"../../../../webgl/enums.js";let C=class extends m{constructor(e){super(e),this.consumes={required:[a.COMPOSITE,"emissive"]},this.produces=a.COMPOSITE,this._blurHorizontalConfiguration=new h,this._blurVerticalConfiguration=new h,this._compositionParameters=new c,this._depthAdjustParameters=new d,this._blurParameters=new l,this._blurScale=3.06,this._bloomResults=new Array}initialize(){this.addHandles([r((()=>this._updateFogParameters()),(()=>{}),s)])}destroy(){}_updateFogParameters(){const e=this.view.environment.weather;if("sunny"===e.type||"cloudy"===e.type)this._blurParameters.blurRadius=_[e.type],this._compositionParameters.exposure=g[e.type];else{const r="foggy"===e.type?e.fogStrength:e.precipitation;this._blurParameters.blurRadius=t(_.cloudy,_[e.type],r),this._compositionParameters.exposure=t(g[e.type],3,r)}this._compositionParameters.lodFactors=f[e.type].far,this._compositionParameters.lodFactorsFront=f[e.type].near,this.requestRender(P.UPDATE)}precompile(){this._blurHorizontalConfiguration.bloomStage=n.Horizontal,this._blurVerticalConfiguration.bloomStage=n.Vertical,this.techniques.precompile(u,this._blurHorizontalConfiguration),this.techniques.precompile(u,this._blurVerticalConfiguration),this.techniques.precompile(p),this.techniques.precompile(b)}render(e){const t=e.find((({name:e})=>e===a.COMPOSITE)),r=t.getAttachment(j)?.attachment;if(!r)return t;const s=this.techniques.get(u,this._blurHorizontalConfiguration),o=this.techniques.get(u,this._blurVerticalConfiguration),i=this.techniques.get(p),m=this.techniques.get(b);if(!(s.compiled&&o.compiled&&i.compiled&&m.compiled))return this.requestRender(P.UPDATE),t;const l=t.getTexture(),n=this.fboCache,{fullWidth:h,fullHeight:c}=this.bindParameters.camera,d=this.renderingContext,_=n.acquire(h,c,"emissiveDepthAdjusted");this._depthAdjustParameters.color=r,this._prepareFBO(_,h,c),d.bindTechnique(m,this.bindParameters,this._depthAdjustParameters),d.screen.draw();let g=_.getTexture(),f=Math.round(h/2),q=Math.round(c/2);const C=5,x=this._blurParameters.blurRadius;for(let a=0;a<C;a++){const e=n.acquire(f,q,"bloomHorizontal");this._blurParameters.color=g,this._prepareFBO(e,f,q),d.bindTechnique(s,this.bindParameters,this._blurParameters),d.screen.draw(),0===a&&_.release();const t=n.acquire(f,q,"bloomVertical");this._blurParameters.color=e.getTexture(),this._prepareFBO(t,f,q),d.bindTechnique(o,this.bindParameters,this._blurParameters),d.screen.draw(),e.release(),this._bloomResults[a]=t,f=Math.ceil(f/2),q=Math.ceil(q/2),g=this._bloomResults[a].getTexture(),this._blurParameters.blurRadius*=this._blurScale}this._blurParameters.blurRadius=x,this._compositionParameters.color=l,this._compositionParameters.bloomTexture0=this._bloomResults[0].getTexture(),this._compositionParameters.bloomTexture1=this._bloomResults[1].getTexture(),this._compositionParameters.bloomTexture2=this._bloomResults[2].getTexture(),this._compositionParameters.bloomTexture3=this._bloomResults[3].getTexture(),this._compositionParameters.bloomTexture4=this._bloomResults[4].getTexture();const R=this.acquireOutputFramebuffer();return this._prepareFBO(R,h,c),d.bindTechnique(i,this.bindParameters,this._compositionParameters),d.screen.draw(),this._bloomResults.forEach((e=>e.release())),R.attachDepth(t.getAttachment(T)),R.attachColor(t.getAttachment(j),j),R}_prepareFBO(e,t,r){const s=this.renderingContext;s.bindFramebuffer(e.fbo),s.setViewport(0,0,t,r),s.setClearColor(0,0,0,0),s.clear(q.COLOR)}get test(){return{compositionParameters:this._compositionParameters,depthAdjustParameters:this._depthAdjustParameters,blurParameters:this._blurParameters}}};e([o()],C.prototype,"consumes",void 0),e([o()],C.prototype,"produces",void 0),C=e([i("esri.views.3d.webgl-engine.effects.bloom.BloomRenderNode")],C);export{C as BloomRenderNode};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as t}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ZEROS as o}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderCategory as n}from"../../../webgl.js";import{ColorFormat as i}from"../../../webgl/formats.js";import c from"../../../webgl/RenderNode.js";import{If as s,glsl as a}from"../../core/shaderModules/glsl.js";import{Default3D as l}from"../../lib/DefaultVertexAttributeLocations.js";import{FramebufferBit as u,ColorAttachment0 as p,BlendFactor as h,SizedPixelFormat as f,PixelFormat as d,DataType as m}from"../../../../webgl/enums.js";import{alphaCutoff as v}from"../../../../../webscene/support/AlphaCutoff.js";let g=class extends c{constructor(e){super(e),this.destroyedCB=null,this.produces=n.FINAL,this.consumes={required:[n.FINAL]},this.clearColor=o,this._focusedFBOType=0,this._program=new Map}destroy(){this._program.forEach((e=>e.dispose())),this._program.clear(),this.destroyedCB()}render(e){const r=e.find((({name:e})=>e===n.FINAL));if(!this._focusedFBO)return r;const t=this.renderingContext;t.bindFramebuffer(r.fbo),t.setClearColor(0,0,0,0),t.clear(u.COLOR);const o=this._focusedFBO.getTexture(),i=[F(o)],c=this._ensureShader(t,!1,i);return t.useProgram(c),t.bindTexture(o,0),c.setUniform1i("colorTex",0),c.setUniform1i("inputType",this._focusedFBOType),3===this._focusedFBOType&&c.setUniform2fv("nearFar",this.camera.nearFar),t.screen.draw(),r}getDownscaledFBO(e,r,t,o,n,c){t===x.ON&&(n=e.width,c=e.height);const s=[];for(let i=0;i<Math.min(r+1,e.colorAttachments.length);++i){const r=e.getColorTexture(p+i);r&&s.push(F(r))}const a=this.renderingContext,{colorTexture:l,depthStencilTexture:d}=e,m=l?.descriptor,v=this._ensureShader(a,null!=d,s),g=this.fboCache.acquire(n,c,"fbo visualizer");let T=!1;l&&(T="float"===s[0]&&!l.descriptor.hasMipmap,T&&e.colorTexture?.generateMipmap()),a.useProgram(v),a.bindFramebuffer(g.fbo);let R=0;const b=[p],C=null!=d;if(a.bindTexture(l,R),v.setUniform1i("colorTex",R),d){R++,a.bindTexture(d,R),v.setUniform1i("depthTex",R);const e=p+R;g.acquireColor(e,i.
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as t}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ZEROS as o}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderCategory as n}from"../../../webgl.js";import{ColorFormat as i}from"../../../webgl/formats.js";import c from"../../../webgl/RenderNode.js";import{If as s,glsl as a}from"../../core/shaderModules/glsl.js";import{Default3D as l}from"../../lib/DefaultVertexAttributeLocations.js";import{FramebufferBit as u,ColorAttachment0 as p,BlendFactor as h,SizedPixelFormat as f,PixelFormat as d,DataType as m}from"../../../../webgl/enums.js";import{alphaCutoff as v}from"../../../../../webscene/support/AlphaCutoff.js";let g=class extends c{constructor(e){super(e),this.destroyedCB=null,this.produces=n.FINAL,this.consumes={required:[n.FINAL]},this.clearColor=o,this._focusedFBOType=0,this._program=new Map}destroy(){this._program.forEach((e=>e.dispose())),this._program.clear(),this.destroyedCB()}render(e){const r=e.find((({name:e})=>e===n.FINAL));if(!this._focusedFBO)return r;const t=this.renderingContext;t.bindFramebuffer(r.fbo),t.setClearColor(0,0,0,0),t.clear(u.COLOR);const o=this._focusedFBO.getTexture(),i=[F(o)],c=this._ensureShader(t,!1,i);return t.useProgram(c),t.bindTexture(o,0),c.setUniform1i("colorTex",0),c.setUniform1i("inputType",this._focusedFBOType),3===this._focusedFBOType&&c.setUniform2fv("nearFar",this.camera.nearFar),t.screen.draw(),r}getDownscaledFBO(e,r,t,o,n,c){t===x.ON&&(n=e.width,c=e.height);const s=[];for(let i=0;i<Math.min(r+1,e.colorAttachments.length);++i){const r=e.getColorTexture(p+i);r&&s.push(F(r))}const a=this.renderingContext,{colorTexture:l,depthStencilTexture:d}=e,m=l?.descriptor,v=this._ensureShader(a,null!=d,s),g=this.fboCache.acquire(n,c,"fbo visualizer");let T=!1;l&&(T="float"===s[0]&&!l.descriptor.hasMipmap,T&&e.colorTexture?.generateMipmap()),a.useProgram(v),a.bindFramebuffer(g.fbo);let R=0;const b=[p],C=null!=d;if(a.bindTexture(l,R),v.setUniform1i("colorTex",R),d){R++,a.bindTexture(d,R),v.setUniform1i("depthTex",R);const e=p+R;g.acquireColor(e,i.RGBA8,"depth to color"),b.push(e)}for(let u=0;u<r;u++){R++;const r=p+R,t=C?1:0;a.bindTexture(e.getColorTexture(r-t),R),v.setUniform1i("colorTex"+(R-t-1),R),g.acquireColor(r,i.RGBA8),b.push(r)}a.gl.drawBuffers(b);const B=a.getViewport();a.setViewport(0,0,n,c),a.setClearColor(0,0,0,0),a.clear(u.COLOR),a.setBlendingEnabled(!0),a.setBlendFunction(h.ONE,h.ONE_MINUS_SRC_ALPHA);const A="linear-depth"===o||o.includes("shadow"),_="overlay highlight"===o||"highlights"===o||"highlight mix"===o,I="highlight coverage"===o,y=m?.internalFormat,G=A?3:_?5:I?6:y===f.R16F||y===f.R32F||y===f.R8?1:y===f.RG8?2:y===f.RGBA16F?4:y===f.RG8UI?7:0;return v.setUniform1i("inputType",G),A&&v.setUniform2fv("nearFar",this.camera.nearFar),a.screen.draw(),a.bindFramebuffer(null),a.setViewport(B.x,B.y,B.width,B.height),t===x.ON&&(this._focusedFBO=g,this._focusedFBOType=G),T&&e.colorTexture?.clearMipmap(),g}clearFocusedFBO(){this._focusedFBO=null}getPreviewContent(e,r,t,o){if(!t)return null;const n=this.renderingContext,i=this.fboCache.acquire(e,r,"fbo visualizer");n.bindFramebuffer(i?.fbo),n.setClearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),n.clear(u.COLOR),n.setBlendingEnabled(!0),n.setBlendFunction(h.ONE,h.ONE_MINUS_SRC_ALPHA);const c=t.getColorTexture(o);n.setViewport(0,0,e,r);const s=this._ensureShader(n,!1,[F(c)]);n.useProgram(s),n.bindTexture(c,0),s.setUniform1i("colorTex",0),s.setUniform1i("inputType",0),n.screen.draw();const a=new ImageData(new Uint8ClampedArray(e*r*4),e,r);return n.gl.readPixels(0,0,e,r,d.RGBA,m.UNSIGNED_BYTE,new Uint8Array(a.data.buffer)),n.bindFramebuffer(null),i?.release(),a}_ensureShader(e,r,t){const o={hasDepthAttachment:r,colorAttachmentTypes:t},n=this._program.get(o);if(n)return n;const i="#version 300 es\n in vec2 position;\n out vec2 uv;\n\n void main() {\n gl_Position = vec4(position, 0.0, 1.0);\n uv = position * 0.5 + vec2(0.5);\n }",c=(e,r)=>{let t="";const o=e?2:1;for(let n=0;n<r.length-1;n++){const e=r[n+1];t+=`layout(location = ${a.int(o+n)}) out vec4 fragColor${a.int(n)};\n uniform ${T(e)} colorTex${a.int(n)};`}return t},u=e=>{let r="";for(let t=0;t<e.length-1;t++){const o=e[t+1],n=`texture(colorTex${a.int(t)}, uv)`,i="float"===o?n:`vec4( vec2(${n}), 0.0, 1.0)`;r+=`fragColor${a.int(t)} = ${i};`}return r},p=`#version 300 es\n precision highp float;\n precision highp usampler2D;\n\n in vec2 uv;\n uniform ${T(t[0])} colorTex;\n layout(location = 0) out vec4 fragColor;\n ${s(r,"layout(location = 1) out vec4 fragDepth;\n uniform sampler2D depthTex;")}\n ${c(r,t)}\n uniform int inputType;\n uniform vec2 nearFar;\n\n // Factors to convert rgba back to float\n const vec4 RGBA_2_FLOAT_FACTORS = vec4(\n 255.0 / (256.0),\n 255.0 / (256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0 * 256.0)\n );\n\n\n float rgbaTofloat(vec4 rgba) {\n // Convert components from 0->1 back to 0->255 and then add the components together with their corresponding\n // fixed point factors, i.e. (256^1, 256^2, 256^3, 256^4)\n return dot(rgba, RGBA_2_FLOAT_FACTORS);\n }\n\n float linearDepthFromFloat(float depth) {\n depth = pow(depth, 0.2);\n return -(depth * (nearFar[1] - nearFar[0]) + nearFar[0]);\n }\n\n float linearDepthFromRGBA(vec4 depth) {\n return linearDepthFromFloat(rgbaTofloat(depth));\n }\n\n ${"float"===t[0]?"float linearDepthFromTexture(sampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(texelFetch(depthTex, iuv, 0));\n }":"float linearDepthFromTexture(usampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(vec4(texelFetch(depthTex, iuv, 0)) * 255.0);\n }"}\n\n void main() {\n vec4 color;\n if (inputType == 1) {\n color = vec4(vec3(texture(colorTex, uv).r), 1.0);\n } else if (inputType == 2) {\n color = vec4(texture(colorTex, uv).rg, 0.0, 1.0);\n } else if (inputType == 3) {\n float depth = 1.0 - ((-linearDepthFromTexture(colorTex, uv) - nearFar[0]) / (nearFar[1] - nearFar[0]));\n color = vec4(vec3(depth), depth >= 0.999 ? 0.0 : 1.0);\n } else if (inputType == 4) {\n color = vec4(texture(colorTex, uv));\n color = vec4(color.rgb / color.a, color.a);\n } else if (inputType == 5) {\n color = vec4(texture(colorTex, uv)) * 255.0;\n color = vec4(color.rgb / color.a, color.a);\n } else if(inputType == 6) {\n vec2 texDim = vec2(textureSize(colorTex, 0));\n ivec2 iuv = ivec2(uv*texDim);\n uvec2 hh = uvec2(texelFetch(colorTex,iuv,0).rg);\n color = vec4(\n ((hh & uvec2(0x55u)) != uvec2(0u)) ? 1.0 : 0.0,\n ((hh & uvec2(0xaau)) != uvec2(0u)) ? 1.0 : 0.0,\n 0.0,\n 1.0);\n } else {\n color = vec4(texture(colorTex, uv));\n }\n\n\n if(color.a < ${a.float(v)})\n discard;\n else {\n fragColor = color;\n ${s(r,"float depth = 1.0 - pow(texture(depthTex, uv).r, 10.0);\n fragDepth = vec4(vec3(depth), depth < 0.000001 ? 0.0 : 1.0);")}\n ${s(t.length>1,u(t))}\n }\n }`;return this._program.set(o,e.programCache.acquire(i,p,l)),this._program.get(o)}};var x;function T(e){switch(e){case"float":return"sampler2D";case"uint":return"usampler2D";case"int":return"isampler2D"}}function F(e){if(!e)return"float";const{internalFormat:r}=e.descriptor;switch(r){case f.R8I:case f.R16I:case f.R32I:case f.RG8I:case f.RG16I:case f.RG32I:case f.RGB8I:case f.RGB16I:case f.RGB32I:case f.RGBA8I:case f.RGBA16I:case f.RGBA32I:return"int";case f.R8UI:case f.R16UI:case f.R32UI:case f.RG8UI:case f.RG16UI:case f.RG32UI:case f.RGB8UI:case f.RGB16UI:case f.RGB32UI:case f.RGBA8UI:case f.RGBA16UI:case f.RGBA32UI:return"uint";default:return"float"}}e([r()],g.prototype,"destroyedCB",void 0),e([r()],g.prototype,"produces",void 0),e([r()],g.prototype,"consumes",void 0),e([r()],g.prototype,"clearColor",void 0),g=e([t("esri.views.3d.webgl-engine.effects.debug.RenderNodeVisualizerNode")],g),function(e){e[e.ON=0]="ON",e[e.OFF=1]="OFF"}(x||(x={}));export{x as FocusState,g as RenderNodeVisualizerNode};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{InternalRenderCategory as o}from"../../../webgl.js";import t from"../../../webgl/RenderNode.js";import{FocusAreaColorTechnique as i}from"./FocusAreaColorTechnique.js";import{F as c}from"../../../../../chunks/FocusAreaColor.glsl.js";import{FramebufferBit as a,DepthStencilAttachment as p}from"../../../../webgl/enums.js";let n=class extends t{constructor(e){super({...e,view:e.focusAreas.view}),this.consumes={required:[o.FOCUSAREA_COLOR,o.FOCUSAREA]},this.produces=o.FOCUSAREA_COLOR,this._passParameters=new c}precompile(){this.techniques.precompile(i)}render(e){const r=this.techniques.get(i),s=e.find((({name:e})=>e===this.produces));if(!r.compiled)return this.requestRender(),s;const t=this.bindParameters,c=t.camera,n=c.fullViewport[2],u=c.fullViewport[3],h=e.find((({name:e})=>e===o.FOCUSAREA)),d=this.fboCache.acquire(n,u,this.produces),f=this.renderingContext;return f.clear(a.STENCIL),f.bindFramebuffer(d.fbo),this._passParameters.color=s.getTexture(),this._passParameters.focusArea=h.getTexture(),this._passParameters.effect=m[this.focusAreas.style],f.bindTechnique(r,t,this._passParameters),f.screen.draw(),d.attachDepth(s.getAttachment(p)),d}};var u;e([r()],n.prototype,"consumes",void 0),e([r()],n.prototype,"produces",void 0),e([r({constructOnly:!0})],n.prototype,"focusAreas",void 0),n=e([s("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaColorNode")],n),function(e){e[e.NONE=0]="NONE",e[e.BRIGHT=1]="BRIGHT",e[e.DARK=2]="DARK"}(u||(u={}));const m={none:u.NONE,bright:u.BRIGHT,dark:u.DARK};export{n as FocusAreaColorNode};
|