@arcgis/core 5.2.0-next.91 → 5.2.0-next.94
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/arcade/arcadeAsyncRuntime.js +1 -1
- package/arcade/arcadeCompiler.js +1 -1
- package/arcade/functions/portal.js +2 -0
- package/arcade/treeAnalysis.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0be98adfef79fc5036f0.js +1 -0
- package/assets/esri/core/workers/chunks/19ab024f6f732fd6c69b.js +1 -0
- package/assets/esri/core/workers/chunks/{c6ec0e966106f66360d9.js → 349b0c7febc46267441d.js} +3 -3
- package/assets/esri/core/workers/chunks/5d6733dcee9c2ef00072.js +1 -0
- package/assets/esri/core/workers/chunks/{aed7b80145b22c246098.js → 6cbc30b31f0bb39c73ca.js} +1 -1
- package/assets/esri/core/workers/chunks/6cc03ef97d7731153b9a.js +1 -0
- package/assets/esri/core/workers/chunks/75b90fb05e4a2d32b7bb.js +1 -0
- package/assets/esri/core/workers/chunks/7eae9053065d3d38e54e.js +1 -0
- package/assets/esri/core/workers/chunks/87e9f7e85221bc7e6709.js +1 -0
- package/assets/esri/core/workers/chunks/909ee7d2a0eec773037a.js +1 -0
- package/assets/esri/core/workers/chunks/a0eb882a5a81d25b9153.js +1 -0
- package/assets/esri/core/workers/chunks/a74182ff402c3a808323.js +1 -0
- package/assets/esri/core/workers/chunks/{6fd0d9431b141f2a3252.js → cefb70d633c220cbedf9.js} +1 -1
- package/assets/esri/core/workers/chunks/{69c9a12c97ead8963817.js → d1304d414b1fa725168a.js} +1 -1
- package/assets/esri/core/workers/chunks/d453627894e6e5b02023.js +1 -0
- package/assets/esri/core/workers/chunks/e4380706b629729f2212.js +1 -0
- package/assets/esri/core/workers/chunks/{5d9c92c4e60a4696fdad.js → e488e5c62cb375c87a39.js} +1 -1
- package/assets/esri/core/workers/chunks/ea1877ce00da3b585a30.js +1 -0
- package/assets/esri/core/workers/chunks/ec77222776f755dc372c.js +1 -0
- package/assets/esri/core/workers/chunks/f5867d8ba73c67ac27d2.js +1 -0
- package/assets/esri/core/workers/chunks/{b7ed5f130661e9ca00b9.js → f5a058a0ce006bce2a2a.js} +1 -1
- package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
- package/chunks/Fog.glsl.js +5 -5
- package/chunks/GlowBlur.glsl.js +3 -3
- package/chunks/GlowComposite.glsl.js +1 -36
- package/chunks/bundle.js +1 -1
- package/chunks/portal.js +2 -0
- package/config.js +1 -1
- package/geometry/support/HalfFloatArray.js +1 -1
- package/geometry/support/buffer/BufferView.js +1 -1
- package/kernel.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/support/AnnotationFeatureSublayer.js +1 -1
- package/libs/parquet/parquet.js +1 -1
- package/package.json +3 -3
- package/smartMapping/symbology/types.d.ts +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/Stage.js +1 -1
- package/views/2d/engine/vectorTiles/SpriteMosaic.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
- package/views/2d/engine/webgl/Painter.js +1 -1
- package/views/2d/engine/webgl/SpriteMosaic.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/Technique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileDebugInfoTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileStencilTechnique.js +1 -1
- package/views/2d/layers/AnnotationFeatureLayerView2D.js +1 -1
- package/views/2d/layers/features/FeatureContainer.js +1 -1
- package/views/2d/layers/features/layerAdapters/AnnotationLayerAdapter.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderParquet.js +1 -1
- package/views/2d/layers/graphics/GraphicContainer.js +1 -1
- package/views/2d/layers/graphics/HighlightGraphicContainer.js +1 -1
- package/views/3d/environment/CloudyWeather.js +1 -1
- package/views/3d/environment/SunnyWeather.js +1 -1
- package/views/3d/support/GaussianSplatSortWorker.js +1 -1
- package/views/3d/support/buffer/InterleavedLayout.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
- package/views/3d/terrain/TileCompositor.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +11 -11
- package/views/3d/webgl-engine/effects/clouds/CloudsParameters.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/CloudsPresets.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/glow/Glow.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowBlur.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowComposite.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowCompositeTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/glow/blurEmission.glsl.js +38 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/AttributeArray.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/DefaultVertexBufferLayouts.js +1 -1
- package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
- package/views/3d/webgl-engine/lib/RenderContext.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFieldCreation.js +1 -1
- package/views/3d/webgl-engine/lib/glUtil3D.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/popupAdapter.js +1 -1
- package/widgets/Directions.d.ts +1 -1
- package/widgets/OrientedImageryViewer/components/VideoEnhancementTools.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/support/FilterBuilder.js +1 -1
- package/assets/esri/core/workers/chunks/07613ecf13c38ad58b79.js +0 -1
- package/assets/esri/core/workers/chunks/0846855843f85661e974.js +0 -1
- package/assets/esri/core/workers/chunks/30376f00cda1165a2504.js +0 -1
- package/assets/esri/core/workers/chunks/423c2692df662b3dddd4.js +0 -1
- package/assets/esri/core/workers/chunks/46f8c7ae7fb356c3410d.js +0 -1
- package/assets/esri/core/workers/chunks/48e2d0bfb62e1f4f2ad9.js +0 -1
- package/assets/esri/core/workers/chunks/4bf7c0c874d30b1c0760.js +0 -1
- package/assets/esri/core/workers/chunks/7253a439c98200e3e748.js +0 -1
- package/assets/esri/core/workers/chunks/848a9f0e5373bbf289a5.js +0 -1
- package/assets/esri/core/workers/chunks/ad404195107eadf91e16.js +0 -1
- package/assets/esri/core/workers/chunks/b2e2234fdf8e05bc3312.js +0 -1
- package/assets/esri/core/workers/chunks/bf11319138facf44752c.js +0 -1
- package/assets/esri/core/workers/chunks/ec69dd546c312ba97110.js +0 -1
- package/assets/esri/core/workers/chunks/f247f3c5148fa0237a7c.js +0 -1
- package/assets/esri/core/workers/chunks/f4d351b4cd9d1aa10632.js +0 -1
- package/geometry/support/float16.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{clone as e}from"../../../../../core/lang.js";import{sqlAnd as
|
|
2
|
+
import{clone as e}from"../../../../../core/lang.js";import{floatEqualAbsolute as t}from"../../../../../core/mathUtils.js";import{sqlAnd as r,sqlNotIn as s}from"../../../../../core/sql.js";import{isHostedAgolService as a}from"../../../../../layers/support/arcgisLayerUrl.js";import i from"../../../../../layers/support/FeatureFilter.js";import{createFeatureIdInfo as o}from"./featureServiceUtils.js";import{addFloorFilter as l,hasFloorFilter as n}from"./floorFilterUtils.js";import{getServiceGeometryType as c}from"./geometryUtils.js";import{ExceedsLimitCache as u}from"../schema/ExceedsLimitCache.js";import{createSnapshotInfo as p,createFeatureSourceSchema as m}from"../schema/SourceSchema.js";import{getSortKey as y}from"../schema/processor/SimpleProcessorSchema.js";import{createStorageSchema as d}from"../schema/processor/StorageSchema.js";import{getAnnotationMatcherSchema as h}from"../../support/annodime/annotationSchema.js";class f{constructor(e){this.layer=e,this._cache=new u}getLabelingDeconflictionInfo(){return[]}async createSourceSchema(e,t){const r=this._createServiceInfo(e),s=null!=this.layer.editingInfo?.lastEditDate,a=this.layer.refreshInterval>0,i=!s&&a,o=p("isSourceHosted"in r&&r.isSourceHosted,i,this.layer.capabilities,r.metadata.geometryType,e.extent,this.layer.fullExtent);return m(r,o,{definitionExpression:this.layer.definitionExpression,queryScaleRanges:this.layer.sublayers.items.map(e=>({subtypeCode:e.subtypeCode,minScale:e.minScale,maxScale:e.maxScale})),displayFilterEnabled:!1,displayFilterInfo:null,customParameters:this.layer.customParameters,gdbVersion:this.layer.gdbVersion,historicMoment:this.layer.historicMoment,timeExtent:this.layer.timeExtent,apiKey:this.layer.apiKey,sourceRefreshVersion:t,availableFields:e.availableFields,cache:this._cache,postQueryFilter:null,returnM:!1,returnZ:!1})}async createProcessorSchema(e,t,r){const{objectIdField:s,symbolCollection:a,referenceScale:i}=this.layer,o=await h(a,{cimAnalyzer:e.cimAnalyzer,cimResourceManager:e.cimResourceManager,store:e.store,scaleExpression:null,viewRotation:e.viewRotation}),l=y(null,null,s);return{storage:d(null,t.filters),mesh:{properties:{sortKey:l,timeZone:t.timeZone,returnMeshObjectId:!1,displayRefreshVersion:r,currentUser:t.currentUser},strategy:{type:"feature"},factory:{symbology:o,labels:{type:"label",classes:[]},referenceScale:i}},expressionProperties:{timeExtent:null}}}get hasRequiredSupport(){return!0}get timeOptions(){return this.layer}addFilters(e,t){e=l(this.layer,e,t),this.layer.unplacedAnnotationsVisible||(e??=new i,e.where=r(e?.where,`${this.layer.statusField} = 0`));const a=this.layer.sublayers.filter(e=>!S(e,t)).map(e=>e.subtypeCode);if(!a.length)return e;e??=new i;const o=s(this.layer.subtypeField,a.toArray());return e.where=r(e.where,o),e}getUpdateHashProperties(e){return this.layer.destroyed?[]:[()=>this.layer.apiKey,()=>this.layer.customParameters,()=>this.layer.definitionExpression,()=>this.layer.unplacedAnnotationsVisible,()=>n(this.layer,e)?e.floors:null,()=>this.layer.gdbVersion,()=>this.layer.historicMoment,()=>this.layer.outFields,()=>this.layer.sublayers.map(({visible:e,minScale:t,maxScale:r})=>({visible:e,minScale:t,maxScale:r}))]}getRenderer(){return null}setGraphicOrigin(e){const t=this.layer.findSublayerForFeature(e);e.layer=e.sourceLayer=this.layer,e.origin=t?.graphicOrigin??this.layer.graphicOrigin}_createServiceInfo(t){const r=this.layer,{capabilities:s,editingInfo:i,globalIdField:l,datesInUnknownTimezone:n,dateFieldsTimeZone:u,subtypeField:p}=r,m=c(r),y=r.timeInfo?.toJSON(),d=r.spatialReference.toJSON(),h=e(this.layer.parsedUrl),f=this.layer.objectIdField,S=a(h.path),b=t.spatialReference.toJSON();return{type:"feature-service",source:h,isSourceHosted:S,orderByFields:f,outSpatialReference:b,metadata:{timeReferenceUnknownClient:n,dateFieldsTimeZone:u,subtypeField:p,globalIdField:l,fieldsIndex:r.fieldsIndex.toJSON(),geometryType:m,featureIdInfo:o(r),timeInfo:y,spatialReference:d,outSpatialReference:b,attributeSpatialReference:this.layer.attributeSpatialReference?.toJSON(),subtypes:this.layer.subtypes?.map(e=>e.toJSON()),typeIdField:null,types:null,layerType:r.type,hasM:!1,hasZ:!1},queryMetadata:{supportsFormatPBF:s.query.supportsFormatPBF,supportsQuantization:!1,maxRecordCount:s.query.maxRecordCount,tileMaxRecordCount:s.query.tileMaxRecordCount,supportsCompactGeometry:s.query.supportsCompactGeometry,supportsDefaultSpatialReference:s.query.supportsDefaultSpatialReference,supportsMaxRecordCountFactor:s.query.supportsMaxRecordCountFactor,supportsCentroidOnDegeneratedQuantizedGeometry:s.query.supportsCentroidOnDegeneratedQuantizedGeometry,supportsDegeneratedQuantizedGeometry:s.query.supportsDegeneratedQuantizedGeometry,lastEditDate:i?.lastEditDate?.getTime(),supportsReturnExceededLimitGeometries:s.query.supportsReturnExceededLimitGeometries}}}}function S(e,r){return e.visible&&(0===e.minScale||t(r.scale,e.minScale)||r.scale<e.minScale)&&(0===e.maxScale||t(r.scale,e.maxScale)||r.scale>e.maxScale)}export{f as AnnotationLayerAdapter};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import"../../../../../core/has.js";import{baseObjectMemory as
|
|
2
|
+
import"../../../../../core/has.js";import{baseObjectMemory as t}from"../../../../../core/memoryEstimations.js";import{minInt16 as e}from"../../../../../core/typedArrayUtil.js";import{fromRectValues as r}from"../../../../../geometry/support/aaBoundingBox.js";import i from"../../../../../layers/graphics/OptimizedGeometry.js";import{getParquetObjectId as s}from"../../../../../layers/graphics/sources/support/parquetIdUtils.js";import{readParquetChunkAttribute as n}from"../../../../../libs/parquet/parquet.js";import{FeatureSetReader as o}from"./FeatureSetReader.js";class d extends o{constructor(r,i,s,n,o,d=new Uint32Array(s.size()),h,a,u){if(super(r),this._indexMap=i,this._inner=s,this._fileId=n,this._transform=o,this._displayIds=d,this._points=h,this._rowIds=a,this._emptyNumberValue=u,this._index=-1,this.usedMemory=t,this._size=this._inner.size(),this._coordinateStride=this._inner.coordinateStride(),this._rowIds||(this._rowIds=this._inner.readIdsUnsafe().slice()),!this._points&&"esriGeometryPoint"===this.geometryType){const t=this._inner.readPointCoordsQuantizedUnsafe()?.slice();t?(this._emptyNumberValue=e,this._points=t):(this._emptyNumberValue=NaN,this._points=this._inner.readPointCoordsUnsafe()?.slice())}r.featureIdInfo.type}destroy(){super.destroy(),this._inner.free()}get fields(){return this.metadata.fieldsIndex}get geometryType(){return this.metadata.geometryType}get hasFeatures(){return!0}get hasNext(){throw new Error("Method not implemented.")}get exceededTransferLimit(){return!1}get hasZ(){return this._inner.hasZ()}get hasM(){return this._inner.hasM()}async updateFields(t,e,r,i){const s=this._inner.rowGroup(),n=new Uint32Array(this._inner.readIdsUnsafe()),o=await t.createPatch(e,s,n,r,i);this._inner.insertPatchBytes(new Uint8Array(o))}getInTransform(){return this._transform}getSize(){return this._size}getCursor(){return this.copy()}getAttributeHash(){let t="";for(const e of this.fields.fields)t+=this._readAttribute(e.name,!1)+".";return t}getObjectId(){const t=this._rowIds[this._index];return s(this._fileId,t)}getDisplayId(){return this._displayIds[this._index]}setDisplayId(t){this._displayIds[this._index]=t}setIndex(t){this._index=t}getBoundsXMin(){return this._inner.boundsXMin(this._index)}getBoundsYMin(){return this._inner.boundsYMin(this._index)}getBoundsXMax(){return this._inner.boundsXMax(this._index)}getBoundsYMax(){return this._inner.boundsYMax(this._index)}getBounds(t){const e=this._inner.boundsXMin(this._index);return!!Number.isFinite(e)&&(r(t,e,this._inner.boundsYMin(this._index),this._inner.boundsXMax(this._index),this._inner.boundsYMax(this._index)),!0)}setBoundsXMin(t){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsYMin(t){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsXMax(t){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsYMax(t){throw new Error("InternalError: Setting bounds is unsupported")}getIndex(){return this._index}next(){for(;++this._index<this._size&&!this._getExists(););return this._index<this._size}readGeometryArea(){return this.readGeometryForDisplay()?.area()??0}copy(){const t=new d(this.metadata,this._indexMap,this._inner,this._fileId,this._transform,this._displayIds,this._points,this._rowIds,this._emptyNumberValue);return this.copyInto(t),t}copyInto(t){super.copyInto(t),t._index=this._index}_readGeometry(t){const e=this._inner.readCoordsUnsafe(this._index),r=this._inner.readLengthsUnsafe(this._index);return e&&r?new i(r,e,this.hasZ,this.hasM):null}_readX(){if(this._points){const t=this._points[this._coordinateStride*this._index];return t===this._emptyNumberValue?NaN:t}throw new Error("InternalError: readX only supported for points")}_readY(){if(this._points){const t=this._points[this._coordinateStride*this._index+1];return t===this._emptyNumberValue?NaN:t}throw new Error("InternalError: readY only supported for points")}_readServerCentroid(){return null}_readAttribute(t,e){const r=this.fields.get(t);if(!r)return;const i=this._indexMap[r.name];return null==i?this.getObjectId():n(this._inner,this._index,i,r.type,e)}_readAttributes(){const t={};for(const e of this.metadata.fieldsIndex.fields){if(null==this._indexMap[e.name])continue;const r=this._readAttribute(e.name,!1);void 0!==r&&(t[e.name]=r)}return t.__OBJECTID=this.getObjectId(),t}}export{d as FeatureSetReaderParquet};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{AGraphicContainer as e}from"./AGraphicContainer.js";import{renderHighlight as r}from"../support/util.js";class i extends e{renderChildren(e){for(const r of this.children)r.setTransform(e.state);if(super.renderChildren(e),this._updateAttributeView(),this.children.some(e=>e.hasData)){if(this.drawOnTop){if(
|
|
2
|
+
import{AGraphicContainer as e}from"./AGraphicContainer.js";import{renderHighlight as r}from"../support/util.js";class i extends e{renderChildren(e){for(const r of this.children)r.setTransform(e.state);if(super.renderChildren(e),this._updateAttributeView(),this.children.some(e=>e.hasData)){if(this.drawOnTop){if(64===e.drawPhase)this._renderChildren(e,0)}else switch(e.drawPhase){case 1:this._renderChildren(e,0);break;case 8:this.hasHighlight&&this._renderHighlight(e)}this._boundsRenderer&&this._boundsRenderer.doRender(e)}}_renderHighlight(e){r(e,!1,e=>{this._renderChildren(e,1)})}}export{i as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as r}from"tslib";import{subclass as e}from"../../../../core/accessorSupport/decorators.js";import{AGraphicContainer as t}from"./AGraphicContainer.js";import{renderHighlight as s}from"../support/util.js";let i=class extends t{get hasHighlight(){return this.children.some(r=>r.hasData)}renderChildren(r){this.attributeView.update(),
|
|
2
|
+
import{__decorate as r}from"tslib";import{subclass as e}from"../../../../core/accessorSupport/decorators.js";import{AGraphicContainer as t}from"./AGraphicContainer.js";import{renderHighlight as s}from"../support/util.js";let i=class extends t{get hasHighlight(){return this.children.some(r=>r.hasData)}renderChildren(r){this.attributeView.update(),8===r.drawPhase&&this.children.some(r=>r.hasData)&&(super.renderChildren(r),r.context.setColorMask(!0,!0,!0,!0),s(r,!1,r=>{this._renderChildren(r,1)}))}};i=r([e("esri.views.2d.layers.graphics.HighlightGraphicContainer")],i);export{i as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as o}from"tslib";import{JSONSupport as r}from"../../../core/JSONSupport.js";import{property as
|
|
2
|
+
import{__decorate as o}from"tslib";import{JSONSupport as r}from"../../../core/JSONSupport.js";import{lerp as e}from"../../../core/mathUtils.js";import{property as t,subclass as s}from"../../../core/accessorSupport/decorators.js";import{enumeration as i}from"../../../core/accessorSupport/decorators/enumeration.js";import c from"./RainyWeather.js";import{rainyToCloudy as n}from"../webgl-engine/effects/clouds/CloudsPresets.js";var u;let m=u=class extends r{constructor(o){super(o),this.type="cloudy",this.cloudCover=.5}clone(){return new u({cloudCover:this.cloudCover})}get scattering(){return e(c.minScattering,c.maxScattering,this.cloudCover)*n}};o([i({cloudy:"cloudy"}),t({json:{write:{isRequired:!0}}})],m.prototype,"type",void 0),o([t({type:Number,nonNullable:!0,range:{min:0,max:1},json:{write:!0}})],m.prototype,"cloudCover",void 0),m=u=o([s("esri.views.3d.environment.CloudyWeather")],m);const p=m;export{p as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as r}from"tslib";import{JSONSupport as o}from"../../../core/JSONSupport.js";import{property as e,subclass as t}from"../../../core/accessorSupport/decorators.js";import{enumeration as s}from"../../../core/accessorSupport/decorators/enumeration.js";import n from"./RainyWeather.js";var i;let c=i=class extends o{constructor(r){super(r),this.type="sunny",this.cloudCover=.5}clone(){return new i({cloudCover:this.cloudCover})}get scattering(){return n.minScattering*this.cloudCover}};r([s({sunny:"sunny"}),e({json:{write:{isRequired:!0}}})],c.prototype,"type",void 0),r([e({type:Number,nonNullable:!0,range:{min:0,max:1},json:{write:!0}})],c.prototype,"cloudCover",void 0),c=i=r([t("esri.views.3d.environment.SunnyWeather")],c);const u=c;export{u as default};
|
|
2
|
+
import{__decorate as r}from"tslib";import{JSONSupport as o}from"../../../core/JSONSupport.js";import{property as e,subclass as t}from"../../../core/accessorSupport/decorators.js";import{enumeration as s}from"../../../core/accessorSupport/decorators/enumeration.js";import n from"./RainyWeather.js";var i;let c=i=class extends o{constructor(r){super(r),this.type="sunny",this.cloudCover=.5}clone(){return new i({cloudCover:this.cloudCover})}get scattering(){return n.minScattering*(this.cloudCover+.5)}};r([s({sunny:"sunny"}),e({json:{write:{isRequired:!0}}})],c.prototype,"type",void 0),r([e({type:Number,nonNullable:!0,range:{min:0,max:1},json:{write:!0}})],c.prototype,"cloudCover",void 0),c=i=r([t("esri.views.3d.environment.SunnyWeather")],c);const u=c;export{u as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{
|
|
2
|
+
import{estimateNumberArrayMemory as t,estimateNestedObjectMemory as e}from"../../../core/memoryEstimations.js";import{gaussiansPerPage as s}from"./gaussianSplatting/GaussianSplatAtlasPages.js";class n{constructor(t,e,s,n,r,i,o,a,l=!1){this.addedTiles=t,this.removedTileHandles=e,this.visibleTileHandles=s,this.sortedAtlasIndices=n,this.numGaussians=r,this.directionX=i,this.directionY=o,this.directionZ=a,this.preciseSort=l}}class r{constructor(t,e){this.sortedAtlasIndices=t,this.usedMemory=e}}let i=null,o=0,a=null,l=0,c=null,u=0;const d=new Map,f=10,h=20,g=.25,w=1.5;function m(){let s=t(i,a,c);for(const t of d.values())s+=e(t);return s}function p(t,e){let s=Math.max(1,t);for(;s<e;)s=Math.ceil(s*w);return s}function M(t){t>o&&(o=p(o,t),i=new Uint32Array(o)),i.fill(0,0,t)}function y(t){t<=l||(l=p(l,t),a=new Float64Array(l))}function v(t){return t>u&&(u=p(u,t),c=new Uint32Array(u)),c}function G(t,e){let n=0;for(let r=0;r<t.length;r++){const i=d.get(t[r]);if(null==i)throw new Error("Gaussian splat sort worker is missing resident tile data");const o=n+i.gaussianCount;for(let t=0;t<i.pageIds.length&&n<o;t++){const r=i.pageIds[t]*s,a=Math.min(o-n,s);for(let t=0;t<a;t++,n++)e[n]=r+t}}if(n!==e.length)throw new Error("Gaussian splat sort worker received inconsistent resident tile data")}function A(t,e,n,r,o){const a=t.length,l=Math.max(f,Math.min(h,Math.round(Math.log2(a/g)))),c=1+(1<<l);M(c);const u=i,w=o-r,m=w>=1e-6,p=m?(1<<l)/w:0;if(m)for(let s=0;s<a;s++){u[(t[s]-r)*p>>>0]++}else u[0]=a;let y=u[0];for(let s=1;s<c;s++)y+=u[s],u[s]=y;let v=0;for(let i=0;i<e.length;i++){const o=d.get(e[i]);if(null==o)throw new Error("Gaussian splat sort worker is missing resident tile data");const a=v+o.gaussianCount;for(let e=0;e<o.pageIds.length&&v<a;e++){const i=o.pageIds[e]*s,l=Math.min(a-v,s);for(let e=0;e<l;e++,v++){n[--u[m?(t[v]-r)*p>>>0:0]]=i+e}}}if(v!==a)throw new Error("Gaussian splat sort worker received inconsistent resident tile data")}async function b(t){const{addedTiles:e,removedTileHandles:s,visibleTileHandles:n,sortedAtlasIndices:i,numGaussians:o,directionX:l,directionY:c,directionZ:u,preciseSort:f}=t;for(let r=0;r<s.length;r++)d.delete(s[r]);for(let r=0;r<e.length;r++){const t=e[r];d.set(t.handle,t)}if(0===o)return{result:new r(i,m()),transferList:[i.buffer]};y(o);const h=a.subarray(0,o),g=i.subarray(0,o);let w=0,p=1/0,M=-1/0;for(let r=0;r<n.length;r++){const t=d.get(n[r]);if(null==t)throw new Error("Gaussian splat sort worker is missing resident tile data");const{relativePositions:e,gaussianCount:s,originX:i,originY:o,originZ:a}=t,f=w+s,g=l*i+c*o+u*a;for(let n=0;w<f;w++,n+=3){const t=e[n]*l+e[n+1]*c+e[n+2]*u+g;h[w]=t,p=Math.min(p,t),M=Math.max(M,t)}}if(w!==o)throw new Error("Gaussian splat sort worker received inconsistent resident tile data");if(f){const t=v(o).subarray(0,o);G(n,t);const e=new Array(o);for(let s=0;s<o;s++)e[s]=s;e.sort((t,e)=>h[t]-h[e]||t-e);for(let s=0;s<o;s++)g[s]=t[e[s]]}else o>0&&A(h,n,g,p,M);return{result:new r(i,m()),transferList:[i.buffer]}}function E(){I()}function I(){d.clear(),a=null,l=0,c=null,u=0,i=null,o=0}export{n as SplatSortWorkerInput,r as SplatSortWorkerOutput,I as clear,E as destroy,b as sort};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{
|
|
2
|
+
import{BufferViewVec2f16 as e,BufferViewVec2f as t,BufferViewVec2f64 as i,BufferViewVec3f16 as s,BufferViewVec3f as r,BufferViewVec3f64 as n,BufferViewVec4f16 as h,BufferViewVec4f as d,BufferViewVec4f64 as u,BufferViewMat3f as f,BufferViewMat3f64 as o,BufferViewMat4f as l,BufferViewMat4f64 as p,BufferViewVec4u8 as c,BufferViewFloat16 as a,BufferViewFloat as _,BufferViewFloat64 as F,BufferViewUint8 as y,BufferViewUint16 as m,BufferViewInt8 as b,BufferViewVec2i8 as g,BufferViewVec2i16 as w,BufferViewVec2u8 as v,BufferViewVec2u16 as E,BufferViewVec4u16 as A,BufferViewVec4i16 as M,BufferViewUint32 as T,BufferViewVec3u8 as U,BufferViewVec3u16 as j,BufferViewVec2u32 as B,BufferViewVec3u32 as L,BufferViewVec4u32 as x,BufferViewVec3i8 as C,BufferViewVec4i8 as z,BufferViewInt16 as V,BufferViewVec3i16 as $,BufferViewInt32 as O,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{glLayout as H}from"./glUtil.js";import{assert as I}from"../../webgl-engine/lib/Util.js";import{fromLayout as J}from"../../../webgl/VertexAttributeLocations.js";class K{constructor(e,t,i=0){this.layout=e,this.byteOffset=i,this.buffer="number"==typeof t?new ArrayBuffer(t*e.stride):t;for(const s of e.fields.keys()){const t=e.fields.get(s);this[s]=new t.constructor(this.buffer,i+t.offset,this.stride)}}get stride(){return this.layout.stride}get count(){return this.byteLength/this.stride}get byteLength(){return this.buffer.byteLength-this.byteOffset}getField(e,t){const i=this[e];return i&&i.elementCount===t.ElementCount&&i.elementType===t.ElementType?i:null}slice(e,t){return new K(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 usedMemory(){return this.byteLength}dispose(){}}class N{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:W(e[1].constructor)})))}freeze(){return this}get locations(){return J(H(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}vec3f16(e,t){return this._appendField(e,s,t),this}vec3f(e,t){return this._appendField(e,r,t),this}vec3f64(e,t){return this._appendField(e,n,t),this}vec4f16(e,t){return this._appendField(e,h,t),this}vec4f(e,t){return this._appendField(e,d,t),this}vec4f64(e,t){return this._appendField(e,u,t),this}mat3f(e,t){return this._appendField(e,f,t),this}mat3f64(e,t){return this._appendField(e,o,t),this}mat4f(e,t){return this._appendField(e,l,t),this}mat4f64(e,t){return this._appendField(e,p,t),this}vec4u8(e,t){return this._appendField(e,c,t),this}f16(e,t){return this._appendField(e,a,t),this}f32(e,t){return this._appendField(e,_,t),this}f64(e,t){return this._appendField(e,F,t),this}u8(e,t){return this._appendField(e,y,t),this}u16(e,t){return this._appendField(e,m,t),this}i8(e,t){return this._appendField(e,b,t),this}vec2i8(e,t){return this._appendField(e,g,t),this}vec2i16(e,t){return this._appendField(e,w,t),this}vec2u8(e,t){return this._appendField(e,v,t),this}vec2u16(e,t){return this._appendField(e,E,t),this}vec4u16(e,t){return this._appendField(e,A,t),this}vec4i16(e,t){return this._appendField(e,M,t),this}u32(e,t){return this._appendField(e,T,t),this}_appendField(e,t,i){this._fields.has(e)&&I(!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 K(this,e)}createView(e,t){return new K(this,e,t)}clone(){const e=new N;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 P(){return new N}class Q{constructor(e){this.fields=new Array,e.fields.forEach((e,t)=>{const i={...e,constructor:S(e.constructor)};this.fields.push([t,i])}),this.stride=e.stride}}const R=[_,t,r,d,f,l,F,i,n,u,o,p,y,v,U,c,m,E,j,A,T,B,L,x,b,g,C,z,V,w,$,M,O,k,q,D];function S(e){return`${e.ElementType}_${e.ElementCount}`}function W(e){return X.get(e)}const X=new Map;R.forEach(e=>X.set(S(e),e));export{K as InterleavedBuffer,N as InterleavedLayout,Q as PackedLayout,P as newLayout};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{abortMaybe as t}from"../../../../core/maybe.js";import{estimateNumberArrayMemory as s}from"../../../../core/memoryEstimations.js";import{isAbortError as i}from"../../../../core/promiseUtils.js";import{signal as r}from"../../../../core/signal.js";import{Milliseconds as o,now as n}from"../../../../core/time.js";import{exactEquals as a,copy as l,normalize as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as d,exactEquals as _,intersects as p,copy as m}from"../../../../geometry/support/aaBoundingBox.js";import{makeScheduleFunction as c}from"../../layers/support/makeScheduleFunction.js";import{SplatSortWorkerInput as g}from"../GaussianSplatSortWorker.js";import{GaussianSplatSortWorkerHandle as T}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatFadeTexture as f}from"./GaussianSplatFadeTexture.js";import{GaussianSplatHeaderTexture as b}from"./GaussianSplatHeaderTexture.js";import{GaussianSplatOrderTexture as S}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as y}from"./GaussianSplatTextureAtlas.js";import{DepthRange as C}from"../../webgl-engine/lib/DepthRange.js";import{TaskPriority as x}from"../../../support/Scheduler.js";class V{constructor(e,t,s){this._updating=r(!1),this._useDeterministicSort=!1,this._sortBufferMemory=0,this.visibleGaussians=0,this._visibleTileDepthRange=new C,this._previousVisibleTileDepthRangeEye=u(),this._previousVisibleTileDepthRangeViewForward=u(),this._previousVisibleTileDepthRangeClippingBox=d(),this._latestSortedGaussianTilesVersion=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._previousVisibleTileDepthRangeHasClippingBox=!1,this._sortBufferCapacity=0,this._requestedLyr3dVisibilityChange=0,this._latestCompletedLyr3dVisibilityChange=0,this._latestUpdatedGaussianTiles=new Array,this._latestSortedGaussianTiles=new Array,this._nextCommittedVisibleGaussianTiles=new Array,this._workerResidentTiles=new Map,this._cameraDirectionNormalized=u(),this._frameTask=null,this._workerHandle=null,this._sortAbortController=null,this._isSorting=!1,this._pendingSortTask=!1,this._scheduledSortStartTimeout=null,this._lastSortStartTime=o(-1/0),this._sortInterval=o(80),this._renderer=e,this._onSortComplete=t,this._orderTexture=new S(this._renderer.renderingContext),this._fadingTexture=new f(this._renderer.renderingContext),this._headerTexture=new b(this._renderer.renderingContext),this._textureAtlas=new y(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache,s);const{resourceController:i}=this._renderer.view;this._workerHandle=new T(c(i)),this._frameTask=i.scheduler.registerTask(x.GAUSSIAN_SPLAT_SORTING)}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get fadingTexture(){return this._fadingTexture}get headerTexture(){return this._headerTexture}get textureAtlasMemory(){return this._textureAtlas.usedMemory}get orderTextureMemory(){return this._orderTexture.usedMemory}get fadingTextureMemory(){return this._fadingTexture.usedMemory}get headerTextureMemory(){return this._headerTexture.usedMemory}get sortBufferMemory(){return this._sortBufferMemory}get usedMemory(){return this.textureAtlasMemory+this.headerTextureMemory+this.orderTextureMemory+this.fadingTextureMemory+this.sortBufferMemory}queryVisibleTileDepthRange(e,t){if(0===this.visibleGaussians)return null;const{eye:s,viewForward:i}=e,r=s[0],o=s[1],n=s[2],h=i[0],u=i[1],d=i[2],c=this._visibleTileDepthRange;if(this._previousVisibleTileDepthRangeTilesVersion===this._latestSortedGaussianTilesVersion&&a(this._previousVisibleTileDepthRangeEye,s)&&a(this._previousVisibleTileDepthRangeViewForward,i)&&(null==t?!this._previousVisibleTileDepthRangeHasClippingBox:this._previousVisibleTileDepthRangeHasClippingBox&&_(this._previousVisibleTileDepthRangeClippingBox,t)))return c.near<=c.far?c:null;let g=1/0,T=-1/0;const f=this._latestSortedGaussianTiles;for(let a=0;a<f.length;a++){const e=f[a];if(null!=t){const s=e.boundingBox;if(!p(s,t))continue}const s=h*(e.obbCenterX-r)+u*(e.obbCenterY-o)+d*(e.obbCenterZ-n),i=e.paddedMbsRadius,l=s-i;l<g&&(g=l);const _=s+i;_>T&&(T=_)}const b=g<=T;return b?c.set(g,T):c.set(1/0,-1/0),this._previousVisibleTileDepthRangeTilesVersion=this._latestSortedGaussianTilesVersion,this._previousVisibleTileDepthRangeHasClippingBox=null!=t,l(this._previousVisibleTileDepthRangeEye,s),l(this._previousVisibleTileDepthRangeViewForward,i),null!=t&&m(this._previousVisibleTileDepthRangeClippingBox,t),b?c:null}updateGaussianVisibility(e,t){this._latestUpdatedGaussianTiles=e,this._requestedLyr3dVisibilityChange=t,this.requestSort()}get updating(){return this._updating.value}destroy(){this._sortAbortController=t(this._sortAbortController),this._pendingSortTask=!1,this._updating.value=!1,null!=this._scheduledSortStartTimeout&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._frameTask.remove(),this._workerHandle?.destroyWorkerAndSelf(),this._textureAtlas.destroy(),this._headerTexture.destroy(),this._orderTexture.destroy(),this._fadingTexture.destroy()}requestSort(){this._updating.value=!0,this._pendingSortTask||(this._pendingSortTask=!0,this._scheduleSortStart())}_scheduleSortStart(){if(this._isSorting)return;const e=n()-this._lastSortStartTime,t=this._sortInterval-e;t<=0?this._startSortIfRequired():null==this._scheduledSortStartTimeout&&(this._scheduledSortStartTimeout=setTimeout(()=>{this._scheduledSortStartTimeout=null,this._pendingSortTask&&!this._isSorting&&this._scheduleSortStart()},t))}_startSortIfRequired(){if(this._isSorting||!this._pendingSortTask)return;const e=new AbortController;this._sortAbortController=e,this._isSorting=!0,this._pendingSortTask=!1,this._lastSortStartTime=n(),this._sortOnWorker(e.signal).finally(()=>{this._sortAbortController===e&&(this._sortAbortController=null),this._handleSortComplete()})}_handleSortComplete(){this._isSorting=!1,this._pendingSortTask?this._scheduleSortStart():this._updating.value=!1}_clearBuffersAndTextures(){this._sortedAtlasIndicesBuffer=void 0,this._sortBufferCapacity=0,this._sortBufferMemory=0,this._orderTexture.clear(),this._textureAtlas.clear(),this._headerTexture.clear()}_computeExpandedCapacity(t,s){let i=Math.max(1,t);for(;i<s;)i=Math.ceil(i*e);return i}_ensureSortBufferCapacity(e){if(this._sortBufferCapacity<e){const t=this._computeExpandedCapacity(this._sortBufferCapacity,e);this._sortedAtlasIndicesBuffer=new Uint32Array(t),this._sortBufferMemory=s(this._sortedAtlasIndicesBuffer),this._sortBufferCapacity=t}}_clearAllBuffersAndTextures(){this._clearBuffersAndTextures(),this._latestSortedGaussianTiles.length=0,this._nextCommittedVisibleGaussianTiles.length=0,this._workerResidentTiles.clear(),this._previousVisibleTileDepthRangeTilesVersion=-1,this._workerHandle?.clear()}async _sortOnWorker(e){try{if(0===this._latestUpdatedGaussianTiles.length)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=this._requestedLyr3dVisibilityChange,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);this._useDeterministicSort&&this._latestUpdatedGaussianTiles.sort((e,t)=>e.obb.centerX-t.obb.centerX||e.obb.centerY-t.obb.centerY||e.obb.centerZ-t.obb.centerZ);const t=this._latestUpdatedGaussianTiles,s=t.length,i=this._requestedLyr3dVisibilityChange;let r=0;for(let e=0;e<s;e++)r+=t[e].gaussianCount;this._ensureSortBufferCapacity(r),this._textureAtlas.ensureTextureAtlas(),this._headerTexture.ensureCapacity(this._textureAtlas.pageAllocator.pageCount);const o=this._renderer.camera;h(this._cameraDirectionNormalized,o.ray.direction);const n=this._cameraDirectionNormalized[0],a=this._cameraDirectionNormalized[1],l=this._cameraDirectionNormalized[2];let u=0;const d=this._renderer.clippingBox,_=this._nextCommittedVisibleGaussianTiles;_.length=0;let m=0;const{frustum:c}=o,T=this._renderer.tileCullingRevision,f=c[0],b=c[1],S=c[2],y=c[3],C=c[4],x=c[5];for(let e=0;e<s;e++){const s=t[e],{obbCenterX:i,obbCenterY:r,obbCenterZ:o,paddedMbsRadius:n}=s,a=s.gaussianCount;if(s.cullingRevision!==T){let e=null==d||p(s.boundingBox,d);if(e){const t=1.5*n;e=f[0]*i+f[1]*r+f[2]*o+f[3]<t&&b[0]*i+b[1]*r+b[2]*o+b[3]<t&&S[0]*i+S[1]*r+S[2]*o+S[3]<t&&y[0]*i+y[1]*r+y[2]*o+y[3]<t&&C[0]*i+C[1]*r+C[2]*o+C[3]<t&&x[0]*i+x[1]*r+x[2]*o+x[3]<t}s.cullingRevision=T,s.cullingVisible=e}s.cullingVisible&&(_[m++]=s,u+=a)}if(_.length=m,0===u)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=i,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);const V=new Map,A=[],v=new Uint32Array(m);for(let e=0;e<m;e++){const t=_[e],s=t.handle;V.set(s,t),v[e]=s,this._workerResidentTiles.get(s)!==t&&A.push({handle:s,relativePositions:t.relativePositions,pageIds:t.pageIds,gaussianCount:t.gaussianCount,originX:t.obbCenterX,originY:t.obbCenterY,originZ:t.obbCenterZ})}const w=[];for(const e of this._workerResidentTiles.keys())V.has(e)||w.push(e);const R=new g(A,Uint32Array.from(w),v,this._sortedAtlasIndicesBuffer,u,n,a,l,this._useDeterministicSort),B=await(this._workerHandle?.sort(R,e));if(e.aborted)return;B&&(this._sortedAtlasIndicesBuffer=B.sortedAtlasIndices,this._workerResidentTiles=V);const G=async e=>{this._orderTexture.setData(this._sortedAtlasIndicesBuffer,u);const t=this._latestSortedGaussianTiles;this._latestSortedGaussianTiles=_,this._nextCommittedVisibleGaussianTiles=t,this._latestSortedGaussianTilesVersion++,this._latestCompletedLyr3dVisibilityChange=i,this.visibleGaussians=u,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1),e.madeProgress()};await this._frameTask.schedule(G,e)}catch(t){if(i(t))return}}set useDeterministicSort(e){this._useDeterministicSort=e}}export{V as GaussianSplatDataStore};
|
|
2
|
+
import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{abortMaybe as t}from"../../../../core/maybe.js";import{estimateNumberArrayMemory as s}from"../../../../core/memoryEstimations.js";import{isAbortError as i}from"../../../../core/promiseUtils.js";import{signal as r}from"../../../../core/signal.js";import{Milliseconds as o,now as n}from"../../../../core/time.js";import{exactEquals as a,copy as l,normalize as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as d,exactEquals as _,intersects as p,copy as m}from"../../../../geometry/support/aaBoundingBox.js";import{makeScheduleFunction as c}from"../../layers/support/makeScheduleFunction.js";import{SplatSortWorkerInput as g}from"../GaussianSplatSortWorker.js";import{GaussianSplatSortWorkerHandle as T}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatFadeTexture as f}from"./GaussianSplatFadeTexture.js";import{GaussianSplatHeaderTexture as b}from"./GaussianSplatHeaderTexture.js";import{GaussianSplatOrderTexture as y}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as S}from"./GaussianSplatTextureAtlas.js";import{DepthRange as C}from"../../webgl-engine/lib/DepthRange.js";import{TaskPriority as x}from"../../../support/Scheduler.js";class V{constructor(e,t,s){this._updating=r(!1),this._useDeterministicSort=!1,this._sortBufferMemory=0,this._sortWorkerMemory=0,this.visibleGaussians=0,this._visibleTileDepthRange=new C,this._previousVisibleTileDepthRangeEye=u(),this._previousVisibleTileDepthRangeViewForward=u(),this._previousVisibleTileDepthRangeClippingBox=d(),this._latestSortedGaussianTilesVersion=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._previousVisibleTileDepthRangeHasClippingBox=!1,this._sortBufferCapacity=0,this._requestedLyr3dVisibilityChange=0,this._latestCompletedLyr3dVisibilityChange=0,this._latestUpdatedGaussianTiles=new Array,this._latestSortedGaussianTiles=new Array,this._nextCommittedVisibleGaussianTiles=new Array,this._workerResidentTiles=new Map,this._cameraDirectionNormalized=u(),this._frameTask=null,this._workerHandle=null,this._sortAbortController=null,this._isSorting=!1,this._pendingSortTask=!1,this._scheduledSortStartTimeout=null,this._lastSortStartTime=o(-1/0),this._sortInterval=o(80),this._renderer=e,this._onSortComplete=t,this._orderTexture=new y(this._renderer.renderingContext),this._fadingTexture=new f(this._renderer.renderingContext),this._headerTexture=new b(this._renderer.renderingContext),this._textureAtlas=new S(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache,s);const{resourceController:i}=this._renderer.view;this._workerHandle=new T(c(i)),this._frameTask=i.scheduler.registerTask(x.GAUSSIAN_SPLAT_SORTING)}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get fadingTexture(){return this._fadingTexture}get headerTexture(){return this._headerTexture}get textureAtlasMemory(){return this._textureAtlas.usedMemory}get orderTextureMemory(){return this._orderTexture.usedMemory}get fadingTextureMemory(){return this._fadingTexture.usedMemory}get headerTextureMemory(){return this._headerTexture.usedMemory}get sortBufferMemory(){return this._sortBufferMemory}get sortWorkerMemory(){return this._sortWorkerMemory}get usedMemory(){return this.textureAtlasMemory+this.headerTextureMemory+this.orderTextureMemory+this.fadingTextureMemory+this.sortBufferMemory+this.sortWorkerMemory}queryVisibleTileDepthRange(e,t){if(0===this.visibleGaussians)return null;const{eye:s,viewForward:i}=e,r=s[0],o=s[1],n=s[2],h=i[0],u=i[1],d=i[2],c=this._visibleTileDepthRange;if(this._previousVisibleTileDepthRangeTilesVersion===this._latestSortedGaussianTilesVersion&&a(this._previousVisibleTileDepthRangeEye,s)&&a(this._previousVisibleTileDepthRangeViewForward,i)&&(null==t?!this._previousVisibleTileDepthRangeHasClippingBox:this._previousVisibleTileDepthRangeHasClippingBox&&_(this._previousVisibleTileDepthRangeClippingBox,t)))return c.near<=c.far?c:null;let g=1/0,T=-1/0;const f=this._latestSortedGaussianTiles;for(let a=0;a<f.length;a++){const e=f[a];if(null!=t){const s=e.boundingBox;if(!p(s,t))continue}const s=h*(e.obbCenterX-r)+u*(e.obbCenterY-o)+d*(e.obbCenterZ-n),i=e.paddedMbsRadius,l=s-i;l<g&&(g=l);const _=s+i;_>T&&(T=_)}const b=g<=T;return b?c.set(g,T):c.set(1/0,-1/0),this._previousVisibleTileDepthRangeTilesVersion=this._latestSortedGaussianTilesVersion,this._previousVisibleTileDepthRangeHasClippingBox=null!=t,l(this._previousVisibleTileDepthRangeEye,s),l(this._previousVisibleTileDepthRangeViewForward,i),null!=t&&m(this._previousVisibleTileDepthRangeClippingBox,t),b?c:null}updateGaussianVisibility(e,t){this._latestUpdatedGaussianTiles=e,this._requestedLyr3dVisibilityChange=t,this.requestSort()}get updating(){return this._updating.value}destroy(){this._sortAbortController=t(this._sortAbortController),this._pendingSortTask=!1,this._updating.value=!1,null!=this._scheduledSortStartTimeout&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._frameTask.remove(),this._workerHandle?.destroyWorkerAndSelf(),this._sortWorkerMemory=0,this._textureAtlas.destroy(),this._headerTexture.destroy(),this._orderTexture.destroy(),this._fadingTexture.destroy()}requestSort(){this._updating.value=!0,this._pendingSortTask||(this._pendingSortTask=!0,this._scheduleSortStart())}_scheduleSortStart(){if(this._isSorting)return;const e=n()-this._lastSortStartTime,t=this._sortInterval-e;t<=0?this._startSortIfRequired():null==this._scheduledSortStartTimeout&&(this._scheduledSortStartTimeout=setTimeout(()=>{this._scheduledSortStartTimeout=null,this._pendingSortTask&&!this._isSorting&&this._scheduleSortStart()},t))}_startSortIfRequired(){if(this._isSorting||!this._pendingSortTask)return;const e=new AbortController;this._sortAbortController=e,this._isSorting=!0,this._pendingSortTask=!1,this._lastSortStartTime=n(),this._sortOnWorker(e.signal).finally(()=>{this._sortAbortController===e&&(this._sortAbortController=null),this._handleSortComplete()})}_handleSortComplete(){this._isSorting=!1,this._pendingSortTask?this._scheduleSortStart():this._updating.value=!1}_clearBuffersAndTextures(){this._sortedAtlasIndicesBuffer=void 0,this._sortBufferCapacity=0,this._sortBufferMemory=0,this._orderTexture.clear(),this._textureAtlas.clear(),this._headerTexture.clear()}_computeExpandedCapacity(t,s){let i=Math.max(1,t);for(;i<s;)i=Math.ceil(i*e);return i}_ensureSortBufferCapacity(e){if(this._sortBufferCapacity<e){const t=this._computeExpandedCapacity(this._sortBufferCapacity,e);this._sortedAtlasIndicesBuffer=new Uint32Array(t),this._sortBufferMemory=s(this._sortedAtlasIndicesBuffer),this._sortBufferCapacity=t}}_clearAllBuffersAndTextures(){this._clearBuffersAndTextures(),this._latestSortedGaussianTiles.length=0,this._nextCommittedVisibleGaussianTiles.length=0,this._workerResidentTiles.clear(),this._sortWorkerMemory=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._workerHandle?.clear()}async _sortOnWorker(e){try{if(0===this._latestUpdatedGaussianTiles.length)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=this._requestedLyr3dVisibilityChange,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);this._useDeterministicSort&&this._latestUpdatedGaussianTiles.sort((e,t)=>e.obb.centerX-t.obb.centerX||e.obb.centerY-t.obb.centerY||e.obb.centerZ-t.obb.centerZ);const t=this._latestUpdatedGaussianTiles,s=t.length,i=this._requestedLyr3dVisibilityChange;let r=0;for(let e=0;e<s;e++)r+=t[e].gaussianCount;this._ensureSortBufferCapacity(r),this._textureAtlas.ensureTextureAtlas(),this._headerTexture.ensureCapacity(this._textureAtlas.pageAllocator.pageCount);const o=this._renderer.camera;h(this._cameraDirectionNormalized,o.ray.direction);const n=this._cameraDirectionNormalized[0],a=this._cameraDirectionNormalized[1],l=this._cameraDirectionNormalized[2];let u=0;const d=this._renderer.clippingBox,_=this._nextCommittedVisibleGaussianTiles;_.length=0;let m=0;const{frustum:c}=o,T=this._renderer.tileCullingRevision,f=c[0],b=c[1],y=c[2],S=c[3],C=c[4],x=c[5];for(let e=0;e<s;e++){const s=t[e],{obbCenterX:i,obbCenterY:r,obbCenterZ:o,paddedMbsRadius:n}=s,a=s.gaussianCount;if(s.cullingRevision!==T){let e=null==d||p(s.boundingBox,d);if(e){const t=1.5*n;e=f[0]*i+f[1]*r+f[2]*o+f[3]<t&&b[0]*i+b[1]*r+b[2]*o+b[3]<t&&y[0]*i+y[1]*r+y[2]*o+y[3]<t&&S[0]*i+S[1]*r+S[2]*o+S[3]<t&&C[0]*i+C[1]*r+C[2]*o+C[3]<t&&x[0]*i+x[1]*r+x[2]*o+x[3]<t}s.cullingRevision=T,s.cullingVisible=e}s.cullingVisible&&(_[m++]=s,u+=a)}if(_.length=m,0===u)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=i,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);const V=new Map,A=[],v=new Uint32Array(m);for(let e=0;e<m;e++){const t=_[e],s=t.handle;V.set(s,t),v[e]=s,this._workerResidentTiles.get(s)!==t&&A.push({handle:s,relativePositions:t.relativePositions,pageIds:t.pageIds,gaussianCount:t.gaussianCount,originX:t.obbCenterX,originY:t.obbCenterY,originZ:t.obbCenterZ})}const w=[];for(const e of this._workerResidentTiles.keys())V.has(e)||w.push(e);const k=new g(A,Uint32Array.from(w),v,this._sortedAtlasIndicesBuffer,u,n,a,l,this._useDeterministicSort),R=await(this._workerHandle?.sort(k,e));if(e.aborted)return;R&&(this._sortedAtlasIndicesBuffer=R.sortedAtlasIndices,this._sortWorkerMemory=R.usedMemory,this._workerResidentTiles=V);const B=async e=>{this._orderTexture.setData(this._sortedAtlasIndicesBuffer,u);const t=this._latestSortedGaussianTiles;this._latestSortedGaussianTiles=_,this._nextCommittedVisibleGaussianTiles=t,this._latestSortedGaussianTilesVersion++,this._latestCompletedLyr3dVisibilityChange=i,this.visibleGaussians=u,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1),e.madeProgress()};await this._frameTask.schedule(B,e)}catch(t){if(i(t))return}}set useDeterministicSort(e){this._useDeterministicSort=e}}export{V as GaussianSplatDataStore};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../../core/Logger.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{ZEROS as r}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{VectorTileRendererHelper3D as i}from"../../2d/engine/vectorTiles/VectorTileRendererHelper3D.js";import{BlendLayersTechnique as s}from"./BlendLayersTechnique.js";import{BlendLayersTechniqueConfiguration as n}from"./BlendLayersTechniqueConfiguration.js";import{RasterColorizerTechnique as o}from"./RasterColorizerTechnique.js";import{RasterColorizerTechniqueConfiguration as a}from"./RasterColorizerTechniqueConfiguration.js";import{MultiSizeFramebuffer as h}from"./support/MultiSizeFramebuffer.js";import{BindParameters as c}from"../webgl-engine/lib/BindParameters.js";import{createQuadVAO as l}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as u}from"../../webgl/enums.js";import d from"../../webgl/Texture.js";const _=()=>e.getLogger("esri.views.3d.terrain");class f{constructor(e,t){this._rctx=e,this._techniques=t,this._fbos=[],this._vectorTileHelper=new i,this._blendConfiguration=new n,this._current=0,this._lastUsedIds=new Array,this._lastCreatedBufferId=0,this._onHoldIds=new Array,this._vao=l(this._rctx,1),this._bindParameters=new c(
|
|
2
|
+
import e from"../../../core/Logger.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{ZEROS as r}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{VectorTileRendererHelper3D as i}from"../../2d/engine/vectorTiles/VectorTileRendererHelper3D.js";import{BlendLayersTechnique as s}from"./BlendLayersTechnique.js";import{BlendLayersTechniqueConfiguration as n}from"./BlendLayersTechniqueConfiguration.js";import{RasterColorizerTechnique as o}from"./RasterColorizerTechnique.js";import{RasterColorizerTechniqueConfiguration as a}from"./RasterColorizerTechniqueConfiguration.js";import{MultiSizeFramebuffer as h}from"./support/MultiSizeFramebuffer.js";import{BindParameters as c}from"../webgl-engine/lib/BindParameters.js";import{createQuadVAO as l}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as u}from"../../webgl/enums.js";import d from"../../webgl/Texture.js";const _=()=>e.getLogger("esri.views.3d.terrain");class f{constructor(e,t){this._rctx=e,this._techniques=t,this._fbos=[],this._vectorTileHelper=new i,this._blendConfiguration=new n,this._current=0,this._lastUsedIds=new Array,this._lastCreatedBufferId=0,this._onHoldIds=new Array,this._vao=l(this._rctx,1),this._bindParameters=new c(null)}dispose(){this._bindParameters.destroy(),this._fbos.forEach(t),this._fbos=null,this._vtFBO=t(this._vtFBO),this._vao=t(this._vao),this._vectorTileHelper=t(this._vectorTileHelper)}updateHeading(e){this._vectorTileHelper?.updateHeading(e)}_acquireBlendTechnique(e,t,r,i=!1,n=0){return this._blendConfiguration.output=t,this._blendConfiguration.blendMode=e,this._blendConfiguration.applyBaseOpacity=r,this._blendConfiguration.premultipliedAlphaSource=i,this._blendConfiguration.background=n,this._techniques.precompile(s,this._blendConfiguration),this._techniques.get(s,this._blendConfiguration)}drawBackground(e,t){const r=this._acquireBlendTechnique(0,t?2:3,!1,!1,1),i=this._rctx.bindTechnique(r,this._bindParameters,e);this._render(i)}_render(e){this._rctx.bindVAO(this._vao),e.assertCompatibleVertexAttributeLocations(this._vao),this._rctx.drawArrays(u.TRIANGLE_STRIP,0,this._vao.vertexCount("geometry"))}drawGroup(e,t,r,i,s=!0){1===t&&(e.fboTexture=this._fbos[this.getLastOnHoldId()].get(r).colorTexture??this._rctx.emptyTexture),e.texture=this.currentFBO(r).colorTexture,this.closeGroup(r);const n=e.baseOpacity<1,o=this._acquireBlendTechnique(i,t,n,s),a=this._rctx.bindTechnique(o,this._bindParameters,e);this._render(a)}drawImageData(e,t,r,i,s=!1){if(null==e.texture)return;const n=e.baseOpacity<1;e.fboTexture=(4===t||0===i&&!n&&!s?null:this.switch(r).colorTexture)??this._rctx.emptyTexture;const o=this._acquireBlendTechnique(i,t,n,s),a=this._rctx.bindTechnique(o,this._bindParameters,e);this._render(a)}drawRasterData(e,t,r,i,s){const n=s.sourceLayerInfo.data;if(!n.source)return;if(s.tile.surface.layerViewByIndex(s.layerIndex,1).ensureSymbolizerParameters(n),!n.bind(this._rctx))return;const o=e.baseOpacity<1;e.fboTexture=(0!==i||o?this.switch(r).colorTexture:null)??this._rctx.emptyTexture;const a=this._acquireRasterTechnique(n,t,i,o);if(!a)return;n.opacity=e.opacity;const h=n.getUniforms(this._rctx);h.scale=s.scale,h.offset=s.offset,h.backgroundColor=e.backgroundColor,h.fboTexture=e.fboTexture,h.baseOpacity=e.baseOpacity;const c=this._rctx.bindTechnique(a,this._bindParameters,h);this._render(c)}_acquireRasterTechnique(e,t,r,i){if(!this._rctx.capabilities.colorBufferFloat)return null;const s=e.symbolizerParameters,n=["stretch","lut","hillshade"].indexOf(s.type);return this._rasterConfiguration??=new a,this._rasterConfiguration.output=t,this._rasterConfiguration.blendMode=r,this._rasterConfiguration.applyBaseOpacity=i,this._rasterConfiguration.colorizerType=n,this._rasterConfiguration.applyColormap=!!s.colormap,this._rasterConfiguration.requireBilinearWithNN=e.isBilinearWithStretchColorRamp,this._rasterConfiguration.stretchType=e.hasStretchTypeNone()?0:1,this._techniques.precompile(o,this._rasterConfiguration),this._techniques.get(o,this._rasterConfiguration)}drawVectorData(e,t,i,s,n,o,a,c){const l=this._rctx,u=n.sourceLayerInfo.data,d=n.tile.surface.layerViewByIndex(n.layerIndex,1),f=e.baseOpacity<1,p=f||e.opacity<1||0!==s||1!==t,b=p,m=this._acquireBlendTechnique(s,t,f,b);l.setPipelineState(m.getPipeline(this._bindParameters,e));let g=null,x=null;p?(x=this.currentFBO(i),null==this._vtFBO&&(this._vtFBO=new h(this._rctx)),g=this._vtFBO.get(i),l.bindFramebuffer(g),this._clearCurrentFBO()):c&&l.clear(256);try{this._vectorTileHelper.renderBackground(l,n.sourceLod,d.painter,d.layer.styleRepository,d.schemaHelper,Math.round(1/n.scale),n.offset,a,o,d.contentZoom),u&&this._vectorTileHelper.renderContent(l,n.sourceLod,u,n.vtlNeighborInfos,d.painter,d.layer.styleRepository,d.schemaHelper,Math.round(1/n.scale),n.offset,a,o,d.contentZoom)}catch(T){_().warnOnce("A render call containing vector tiles did not resolve correctly.",T)}return!g||(l.bindFramebuffer(x),e.texture=g.colorTexture,e.offset=r,e.scale=1,this.drawImageData(e,t,i,s,b),c)}copyFBOToTexture(e){const t=this._rctx,r=t.bindTexture(e.texture,d.TEXTURE_UNIT_FOR_UPDATES),i=e.descriptor;t.gl.copyTexImage2D(3553,0,i.pixelFormat,0,0,i.width,i.height,0),e.generateMipmap(),t.bindTexture(r,d.TEXTURE_UNIT_FOR_UPDATES)}_clearCurrentFBO(){this._rctx.setStencilWriteMask(255),this._rctx.setClearColor(0,0,0,0),this._rctx.setClearDepth(1),this._rctx.setClearStencil(0),this._rctx.clear(17664)}_initFBO(e,t,r){this._rctx.bindFramebuffer(e),r&&(this._rctx.setViewport(0,0,t,t),this._clearCurrentFBO())}ensureBuffer(e){this._lastUsedIds.length=0,this._lastUsedIds.push(1),this._lastCreatedBufferId=1,this._onHoldIds.length=0,this.bind(e)}bind(e,t=0,r=!0){if(this._current=t,t>=this._fbos.length)for(let i=this._fbos.length;i<=t;i++)this._fbos.push(new h(this._rctx));this._initFBO(this._fbos[t].get(e),e,r)}_bindNextFreeBuffer(e){this._lastUsedIds.length>0?this.bind(e,this._lastUsedIds.pop()):(this._lastCreatedBufferId++,this.bind(e,this._lastCreatedBufferId))}openGroup(e){this._onHoldIds.push(this._current),this._bindNextFreeBuffer(e)}switch(e){const t=this.currentFBO(e),r=this._current;return this._bindNextFreeBuffer(e),this._lastUsedIds.push(r),t}getLastOnHoldId(){return this._onHoldIds[this._onHoldIds.length-1]}closeGroup(e){const t=this._current;this._bindNextFreeBuffer(e),this._lastUsedIds.push(t),this._lastUsedIds.push(this._onHoldIds.pop())}unbind(){this._rctx.bindFramebuffer(null)}currentFBO(e){return this._fbos[this._current].get(e)}}export{f as TileCompositor};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
function n(n){return 5===n||6===n||7===n}function r(r){return n(r)||8===r||9===r}function t(n){return d(n)||4===n}function u(n){return t(n)||r(n)}function e(n){return 10===n||11===n}function o(n){return p(n)||e(n)}function c(n){return 1===n}function f(n){return 2===n}function i(n){return c(n)||f(n)}function p(n){return 0===n||i(n)}function x(n){return 10===n}function a(n){return p(n)||11===n}function b(n){return p(n)||e(n)}function d(n){return b(n)||g(n)}function g(n){return 3===n}
|
|
2
|
+
function n(n){return 5===n||6===n||7===n}function r(r){return n(r)||8===r||9===r}function t(n){return d(n)||4===n}function u(n){return t(n)||r(n)}function e(n){return 10===n||11===n}function o(n){return p(n)||e(n)}function c(n){return 1===n}function f(n){return 2===n}function i(n){return c(n)||f(n)}function p(n){return 0===n||i(n)}function x(n){return 10===n}function a(n){return p(n)||11===n}function b(n){return p(n)||e(n)}function d(n){return b(n)||g(n)}function g(n){return 3===n}export{o as is2DGeometryOutput,t as is3DGeometry,u as is3DGeometryOrShadowLike,p as isColor,d as isColorHighlightOLIDOrDepth,b as isColorHighlightOrOLID,a as isColorOrOLID,g as isDepth,x as isHighlight,e as isHighlightOrOLID,i as isOIT,c as isOITColorAlpha,f as isOITFrontFace,n as isShadow,r as isShadowLike};
|
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import{maxUint8 as n}from"../../../../../core/typedArrayUtil.js";import{
|
|
2
|
+
import{__decorate as t}from"tslib";import{maxUint8 as n}from"../../../../../core/typedArrayUtil.js";import{FloatBindUniform as e}from"../shaderModules/FloatBindUniform.js";import{glsl as o,If as u}from"../shaderModules/glsl.js";import{ShaderTechniqueConfiguration as i,parameter as a}from"../shaderTechnique/ShaderTechniqueConfiguration.js";function r(t){switch(t.elementType){case"float":switch(t.elementCount){case 1:return o`float`;case 2:return o`vec2`;case 3:return o`vec3`;case 4:return o`vec4`;case 9:return o`mat3`;default:t.elementCount}break;case"int":switch(t.elementCount){case 1:return o`int`;case 2:return o`ivec2`;case 3:return o`ivec3`;case 4:return o`ivec4`;case 9:throw new Error("Invalid element count 9 for type int");default:t.elementCount}break;case"uint":switch(t.elementCount){case 1:return o`uint`;case 2:return o`uvec2`;case 3:return o`uvec3`;case 4:return o`uvec4`;case 9:throw new Error("Invalid element count 9 for type uint");default:t.elementCount}break;default:t.elementType}throw new Error("unsupported field")}const s=new e("constNaN",()=>NaN,{supportsNaN:!0});class c extends i{constructor(t){super(),this.supportNaN=t}}function p(t,n){const e=n?.supportNaN;e&&(t.uniforms.add(s),t.code.add(o`bool bitsEncodeFloat16NaN(highp uint bits) {
|
|
3
3
|
const highp uint nanExponent = 0x00007c00u;
|
|
4
4
|
highp uint exponent = bits & nanExponent;
|
|
5
5
|
highp uint mantissa = bits & 0x000003ffu;
|
|
6
6
|
return exponent == nanExponent && mantissa != 0u;
|
|
7
|
-
}`)),t.code.add(
|
|
7
|
+
}`)),t.code.add(o`
|
|
8
8
|
mediump float unpackHalf1x16(highp uint bits) {
|
|
9
|
-
${
|
|
9
|
+
${u(e,o`
|
|
10
10
|
if (bitsEncodeFloat16NaN(bits)) {
|
|
11
11
|
return constNaN;
|
|
12
12
|
}`)}
|
|
13
13
|
return unpackHalf2x16(bits).x;
|
|
14
|
-
}`),t.code.add(
|
|
14
|
+
}`),t.code.add(o`
|
|
15
15
|
mediump vec2 unpackHalf2x16NaNSupport(highp uint bits) {
|
|
16
16
|
vec2 result = unpackHalf2x16(bits);
|
|
17
|
-
${
|
|
17
|
+
${u(e,o`
|
|
18
18
|
if (bitsEncodeFloat16NaN(bits)) {
|
|
19
19
|
result.x = constNaN;
|
|
20
20
|
}
|
|
21
|
-
if (bitsEncodeFloat16NaN(bits >> ${
|
|
21
|
+
if (bitsEncodeFloat16NaN(bits >> ${o.uint(g[2])})) {
|
|
22
22
|
result.y = constNaN;
|
|
23
23
|
}
|
|
24
24
|
`)}
|
|
25
25
|
return result;
|
|
26
|
-
}`)}function
|
|
26
|
+
}`)}function f(t,n){const e=n?.supportNaN;e&&(t.uniforms.add(s),t.code.add(o`bool bitsEncodeFloat32NaN(highp uint bits) {
|
|
27
27
|
const highp uint nanExponent = 0x7f800000u;
|
|
28
28
|
highp uint exponent = bits & nanExponent;
|
|
29
29
|
highp uint mantissa = bits & 0x007fffffu;
|
|
30
30
|
return exponent == nanExponent && mantissa != 0u;
|
|
31
|
-
}`)),t.code.add(
|
|
31
|
+
}`)),t.code.add(o`
|
|
32
32
|
highp float unpackFloat1x32(highp uint bits) {
|
|
33
|
-
${
|
|
33
|
+
${u(e,o`
|
|
34
34
|
if (bitsEncodeFloat32NaN(bits)) {
|
|
35
35
|
return constNaN;
|
|
36
36
|
}`)}
|
|
37
37
|
return uintBitsToFloat(bits);
|
|
38
|
-
}`)}function
|
|
38
|
+
}`)}function l(t){t.code.add(o`mediump int unpackInt1x16(highp uint bits) {
|
|
39
39
|
highp uint signExtendedBits = (bits & 0x8000u) != 0u ? (bits | 0xffff0000u) : bits;
|
|
40
40
|
return int(signExtendedBits);
|
|
41
|
-
}`)}function
|
|
41
|
+
}`)}function d(t,n){const{fieldType:e}=t;return`${(0,N[e])(b(t,n))}`}function h(t,n){const e=[];for(const u of t){const t=o`unpackFloat1x32(${u})`;e.push(t)}return e.join(n)}t([a()],c.prototype,"supportNaN",void 0);const m=t=>o`${t[0]}`,$=t=>{const n=t[0],e=o`uvec4(${o.uint(g[0])}, ${o.uint(g[1])}, ${o.uint(g[2])}, ${o.uint(g[3])})`,u=o`uvec4(${o.hexuint(y[1])})`;return o`((uvec4(${n}) >> ${e}) & ${u})`},x=t=>o`(float(${m(t)})/${o.float(n)})`,N={u8:m,u32:t=>o`${t[0]}`,vec4u32:t=>o`uvec4(${t.join(", ")})`,unorm8:x,vec4unorm8:t=>o`(vec4(${$(t)})/${o.float(n)})`,snorm16:t=>o`unpackSnorm2x16(${t[0]}).x`,vec2snorm16:t=>o`unpackSnorm2x16(${t[0]})`,f16:t=>o`unpackHalf1x16(${t[0]})`,vec4f16:t=>o`vec4(unpackHalf2x16NaNSupport(${t[0]}), unpackHalf2x16NaNSupport(${t[1]}))`,f32:t=>o`unpackFloat1x32(${t[0]})`,vec4u8:$,vec2f32:t=>o`vec2(${h(t,", ")})`,vec3f32:t=>o`vec3(${h(t,", ")})`,vec4f32:t=>o`vec4(${h(t,", ")})`,mat3f32:t=>o`mat3(${h(t,",\n")})`};function b(t,n){const{byteOffset:e,byteSize:u}=t,i=n.channelByteStride,a=n.byteStride,r=Math.ceil(u/v),s=E[n.channels],c=new Array;for(let p=0;p<r;++p){const t=p*v,n=e+t,r=u-t,f=Math.min(r,v);let l=0;const d=new Array;for(;l<f;){const t=n+l,e=Math.floor(t/a),u=t%a,r=Math.floor(u/i),c=u%i,p=i-c,h=f-l,m=Math.min(p,h),$=o`texel${o.int(e)}${s[r]}`,x=4===m?"":o` & ${o.hexuint(y[m])}`,N=0===c?"":o` >> ${o.uint(g[c])}`,b=o`((${$}${N})${x})`,v=0===l?"":o` << ${o.uint(g[l])}`,E=o`(${b})${v}`;d.push(E),l+=m}c.push(o`(${d.join(" | ")})`)}return c}const v=4,g=[0,8,16,24],y=[0,255,65535,16777215,4294967295],E={1:[o``],2:[o`.x`,o`.y`],4:[o`.x`,o`.y`,o`.z`,o`.w`]};export{c as TextureBufferNaNSupportConfiguration,d as glslDecodeField,r as glslType,f as unpackFloat1x32,p as unpackHalf,l as unpackInt1x16};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import"../../../../../core/has.js";import{clamp as t}from"../../../../../core/mathUtils.js";import{signal as a}from"../../../../../core/signal.js";import{rotate as e}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as s,create as i}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as r,squaredLength as h,normalize as o,scale as n,length as c,subtract as d}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l,fromValues as
|
|
2
|
+
import"../../../../../core/has.js";import{clamp as t}from"../../../../../core/mathUtils.js";import{signal as a}from"../../../../../core/signal.js";import{rotate as e}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as s,create as i}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as r,squaredLength as h,normalize as o,scale as n,length as c,subtract as d}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l,fromValues as _}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as u,fromPoints as f,axis as p}from"../../../../../geometry/support/axisAngleDegrees.js";import{earth as m}from"../../../../../geometry/support/Ellipsoid.js";import{heightLimit as P}from"../../../environment/weather.js";import{ensureClouds as x}from"./Clouds.js";class F{constructor(){this._data=a(null),this._startTime=0,this.coverage=0,this.absorption=0,this._readChannels=0,this.parallax=new w,this.parallaxNew=new w,this._anchorPoint=l(),this._fadeState=a(0),this._fadeFactor=a(1)}get data(){return this._data.value}set data(t){this._data.value=t}get readChannels(){return this._readChannels}needsStationaryAnchorUpdate(t){return C&&this._stationaryAnchorPointDistance(t)>j}get fadeState(){return this._fadeState.value}get fadeFactor(){return this._fadeFactor.value}get opacity(){switch(this.fadeState){case 0:return 0;case 4:return 1-this.fadeFactor;case 1:return this.fadeFactor;case 2:case 3:return 1}}fade(a,e,s,i){if(this.isFading&&this.fadeFactor<1&&(this._fadeFactor.value=s?t((e-this._startTime)/(y*s),0,1):1,1===this.fadeFactor&&this._endFade()),this._evaluateState(a,e),i&&this.needsStationaryAnchorUpdate(a))switch(this.fadeState){case 3:r(this.parallaxNew.anchorPoint,this._anchorPoint);break;case 1:case 2:r(this.parallax.anchorPoint,this._anchorPoint),r(this.parallaxNew.anchorPoint,this._anchorPoint)}this._updateParallax(a)}_evaluateState(t,a){const e=t.relativeElevation,s=this._updateAnchorPoint(t);(Math.abs(e)>1.7*P||s>k)&&this.opacity>0?this._startFade(0,a):this.isFading||(Math.abs(e)>P||s>N*k?this.opacity>0&&this._startFade(4,a):x(this.data)&&(0===this.opacity?this._startFade(1,a):2===this.data.state&&(2===this.fadeState?this._startFade(3,a):this._startFade(2,a))))}_updateParallax(t){const a=h(t.eye);this.parallax.radiusCurvatureCorrection=.84*Math.sqrt(Math.max(a-m.radius*m.radius,0))/Math.sqrt(a),f(S,this.parallax.anchorPoint,v),e(this.parallax.transform,s,v[3],p(v)),f(S,this.parallaxNew.anchorPoint,v),e(this.parallaxNew.transform,s,v[3],p(v))}_updateAnchorPoint(t){return o(this._anchorPoint,t.eye),n(this._anchorPoint,this._anchorPoint,m.radius),0===this.fadeState&&2===this.data?.state?(r(this.parallax.anchorPoint,this._anchorPoint),0):c(d(g,this.parallax.anchorPoint,this._anchorPoint))}_stationaryAnchorPointDistance(t){switch(this.fadeState){case 1:case 2:return o(b,t.eye),n(b,b,m.radius),c(d(g,this.parallax.anchorPoint,b));case 3:return o(b,t.eye),n(b,b,m.radius),c(d(g,this.parallaxNew.anchorPoint,b));case 0:case 4:return 0;default:return this.fadeState,0}}requestFade(){this._fadeFactor.value=0}_startFade(t,a){switch(this._fadeState.value=t,this._startTime=a,t){case 3:this.requestFade(),this._switchReadChannels(),r(this.parallaxNew.anchorPoint,this._anchorPoint);break;case 1:this.requestFade(),this._switchReadChannels(),r(this.parallax.anchorPoint,this._anchorPoint),r(this.parallaxNew.anchorPoint,this._anchorPoint);break;case 4:this.requestFade();break;case 2:this._switchReadChannels(),r(this.parallax.anchorPoint,this._anchorPoint),r(this.parallaxNew.anchorPoint,this._anchorPoint),this._endFade();break;case 0:this._endFade()}}_endFade(){switch(this._fadeFactor.value=1,this.data&&2!==this.data.state&&(this.data.state=0),this.fadeState){case 3:r(this.parallax.anchorPoint,this.parallaxNew.anchorPoint),this._fadeState.value=2;break;case 1:this._fadeState.value=2;break;case 4:this._fadeState.value=0;break;case 2:case 0:break;default:this.fadeState}}_switchReadChannels(){2===this.data?.state&&(this._readChannels=1-this._readChannels,this.data.state=3)}get isFading(){return 4===this.fadeState||1===this.fadeState||3===this.fadeState}}class w{constructor(){this.anchorPoint=l(),this.radiusCurvatureCorrection=0,this.transform=i()}}const S=_(0,0,1),v=u(),g=l(),b=l(),y=1.25,C=!1,j=1e-6,N=.5,k=2e5;export{F as CloudsParameters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
class s{constructor(s,t,
|
|
2
|
+
class s{constructor(s,e,t,n,i,o,c,a,h=.5){this.coverage=s,this.density=e,this.absorption=t,this.cloudSize=n,this.detailSize=i,this.smoothness=o,this.cloudHeight=c,this.raymarchingSteps=a,this.median=h}}const e={sunny:new s([0,.6],[.03,.03],[0,0],[.9,.9],[.8,.8],[.7,.7],[.05,.05],0),cloudy:new s([.3,.65],[.2,.4],[0,0],[.85,.85],[.75,.75],[.3,.4],[1,1],2,.6),rainy:new s([.6,.8],[.5,.8],[.1,.5],[.9,.9],[.75,.75],[.5,.5],[1,1],2,.4),snowy:new s([.25,.75],[.3,.3],[0,0],[.95,.95],[.7,.7],[.69,.75],[.3,1],1,.65),foggy:new s([.8,.8],[.5,.5],[0,0],[.95,.95],[.9,.9],[.55,.55],[.3,.3],0)};e.default=e.sunny;const t=e.cloudy.coverage[0]/e.rainy.coverage[0];export{s as CloudPreset,e as cloudPresets,t as rainyToCloudy};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{releaseMaybe as r}from"../../../../../core/maybe.js";import{property as t,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as n}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderNodeOutput as i}from"../../../webgl.js";import a from"../../../webgl/RenderNode.js";import{If as s,glsl as c}from"../../core/shaderModules/glsl.js";import{Pos2Locations as l}from"../../lib/DefaultVertexBufferLayouts.js";import{floatBlendReductionFactor as u}from"../../shaders/floatBlendScale.glsl.js";import{checkWebGLError as h}from"../../../../webgl/checkWebGLError.js";import{ColorAttachment0 as p,SizedPixelFormat as d,DataType as f}from"../../../../webgl/enums.js";let m=class extends a{constructor(e){super(e),this.destroyedCB=null,this.consumes={required:[i.FINAL]},this.produces=i.FINAL,this.clearColor=n,this._focusedFBOType=7,this._programs=new Map}destroy(){this._programs.clear(),this.destroyedCB()}render(){const e=this.input;if(!this._focusedTexture)return e;const r=this.renderingContext,t=r.boundFramebuffer;r.bindFramebuffer(e.fbo),r.setClearColor(0,0,0,0),r.clear(16384);const o=this._focusedTexture.attachment,n=[g(o)],i=this._ensureProgram(r,!1,n);return r.useProgram(i),r.bindTexture(o,0),i.setUniform1i("colorTex0",0),i.setUniform1i("inputType",this._focusedFBOType),3===this._focusedFBOType&&i.setUniform2fv("nearFar",this.camera.nearFar),r.setDrawBuffers([p]),r.screen.draw(),r.bindFramebuffer(t),e}getDownscaledFBO(e,r,t,o,n,i){if(n?.startsWith(`${r}\n`)??!1){const r=1/2**e.level;t=e.width*r,o=e.height*r}else i=null;const a="linear depth"===r||r.includes("shadow"),s="overlay highlight"===r||"highlights"===r||"highlight mix"===r,c="highlight coverage"===r,l=e.colorTexture?.descriptor,u=l?.internalFormat,f=[],m=new Array,v=new Array;let x=!1;e.colorAttachments.forEach((r,t)=>{const o=e.getColorTexture(r);if(o){const e=g(o);f.push(e);const{hasMipmap:r,isImmutable:n}=o.descriptor;"float"!==e||r||n||(o.generateMipmap(),m[t]=!0),x||=r}if(t>0){const e=o?.descriptor.internalFormat;return void(e===d.RGBA8&&(o?.debugName?.indexOf("emissive")??-1)>=0?v.push(8):v.push(T(e)))}v.push(a?0:s?1:c?2:i??T(u))});const $=this.renderingContext,{depthStencilTexture:b,level:C}=e,y=this._ensureProgram($,null!=b,f,x?C:null),R=this.fboCache.acquire(t,o,"fbo visualizer");$.useProgram(y);const w=$.boundFramebuffer;$.bindFramebuffer(R.fbo);const B=new Array;e.colorAttachments.forEach((r,t)=>{const o=`colorTex${t.toFixed()}`;$.bindTexture(e.getColorTexture(r),t),y.setUniform1i(o,t),t>0&&R.acquireColor(p+t,5,"fbo visualizer"),B.push(r)});const A=b?.descriptor.linearFilterDepth??!1;if(b){const r=e.colorAttachments.length;b.setShadowFiltering(!1),$.bindTexture(b,r),y.setUniform1i("depthTex",r);const t=p+r;t>p&&R.acquireColor(t,5,"fbo visualizer"),B.push(t)}$.gl.drawBuffers(B),h($.gl);const I=$.getViewport();return $.setViewport(0,0,t,o),$.setClearColor(0,0,0,0),$.clear(16384),$.setBlendingEnabled(!0),$.setBlendFunction(1,771),y.setUniform1iv("inputTypes",v.length>0?v:[7]),y.setUniform2fv("nearFar",this.camera.nearFar),$.screen.draw(),h($.gl),$.bindFramebuffer(w),$.setViewport(I.x,I.y,I.width,I.height),e.colorAttachments.forEach((t,o)=>{const i=e.getColorTexture(t);m[o]&&i?.clearMipmap(),n===F(r,e,t,!1)&&(this._focusedTexture?.release(),this._focusedTexture=R.getAttachment(t),this._focusedTexture?.retain(),this._focusedFBOType=9===v[o]?T(i?.descriptor.internalFormat):v[o])}),b&&b.setShadowFiltering(A),R}clearFocusedFBO(){this._focusedTexture=r(this._focusedTexture)}getPreviewContent(e,r,t,o){const n=this.renderingContext,i=o.includes("\ndepth"),a=this.fboCache.acquire(e,r,"fbo visualizer"),s=n.boundFramebuffer;n.bindFramebuffer(a?.fbo);const c=n.getViewport();n.setViewport(0,0,e,r),n.setClearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),n.clear(16384),n.setBlendingEnabled(!0),n.setBlendFunction(1,771);const l=t.attachment,u=this._ensureProgram(n,!1,[g(l)]);n.useProgram(u),n.bindTexture(l,0),u.setUniform1i("colorTex0",0),u.setUniform1iv("inputTypes",[i||l.descriptor.internalFormat!==d.RGBA16F?7:5]),n.screen.draw();const p=new ImageData(new Uint8ClampedArray(e*r*4),e,r);return n.gl.readPixels(0,0,e,r,6408,f.UNSIGNED_BYTE,new Uint8Array(p.data.buffer)),h(n.gl),n.bindFramebuffer(s),n.setViewport(c.x,c.y,c.width,c.height),a?.release(),p}_ensureProgram(e,r,t,o){const n=x({hasDepthAttachment:r,colorSamplerTypes:t,lod:o}),i=this._programs.get(n);if(i)return i;const a="#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 }",h=e=>{let r="";for(let t=0;t<e.length;++t){const o=e[t];r+=`layout(location = ${c.int(t)}) out vec4 fragColor${c.int(t)};\n uniform ${v(o)} colorTex${c.int(t)};`}return r},p=o??0,d=null==o?1:1/2**(o+1),f=e=>e.reduce((e,r,t)=>e+`{\n int inputType = inputTypes[${t}];\n if (inputType == ${3..toFixed()}) {\n fragColor${t} = vec4(vec3(readTexture(colorTex${t}, uv, ${p}).r), 1.0);\n } else if (inputType == ${4..toFixed()}) {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${p}).rg, 0.0, 1.0);\n } else if (inputType == ${(0).toFixed()}) {\n float depth = 1.0 - ((-linearDepthFromTexture(colorTex${t}, uv) - nearFar[0]) / (nearFar[1] - nearFar[0]));\n fragColor${t} = vec4(vec3(depth), depth >= 0.999 ? 0.0 : 1.0);\n } else if (inputType == ${5..toFixed()}) {\n // Currently only emissive glow uses mipmap levels - and it doubles the energy on each level.\n // Correct this for display. In the future when there are other mipmaps implement this cleaner.\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${p}).rgb * float(${d}), 1.0);\n } else if (inputType == ${1..toFixed()}) {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${p})) * 255.0;\n fragColor${t} = vec4(fragColor${t}.rgb / fragColor${t}.a, fragColor${t}.a);\n } else if(inputType == ${2..toFixed()}) {\n vec2 texDim = vec2(textureSize(colorTex${t}, 0));\n ivec2 iuv = ivec2(uv * texDim);\n uvec2 hh = uvec2(texelFetch(colorTex${t}, iuv, 0).rg);\n fragColor${t} = 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 if(inputType == ${8..toFixed()}) {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${p}));\n fragColor${t}.rgb *= ${u.toFixed(1)};\n } else if (inputType == ${9..toFixed()}) {\n fragColor${t} = vec4(vec3(readTexture(colorTex${t}, uv, ${p}).a), 1.0);\n } else {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${p}));\n }\n }`,""),m=t.length,g=`#version 300 es\n precision highp float;\n precision highp usampler2D;\n\n in vec2 uv;\n ${h(t)}\n ${s(r,`layout(location = ${c.int(m)}) out vec4 fragDepth;\n uniform sampler2D depthTex;`)}\n\n uniform int inputTypes[${t.length||1}];\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 vec4 readTexture(sampler2D tex, vec2 uv, int lod) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(tex, lod)));\n return texelFetch(tex, iuv, lod);\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 ${f(t)}\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 }`,T=e.programCache.get(a,g,l);return this._programs.set(n,T),T}};function v(e){switch(e){case"float":return"sampler2D";case"uint":return"usampler2D";case"int":return"isampler2D"}}function g(e){if(!e)return"float";const{internalFormat:r}=e.descriptor;switch(r){case d.R8I:case d.R16I:case d.R32I:case d.RG8I:case d.RG16I:case d.RG32I:case d.RGB8I:case d.RGB16I:case d.RGB32I:case d.RGBA8I:case d.RGBA16I:case d.RGBA32I:return"int";case d.R8UI:case d.R16UI:case d.R32UI:case d.RG8UI:case d.RG16UI:case d.RG32UI:case d.RGB8UI:case d.RGB16UI:case d.RGB32UI:case d.RGBA8UI:case d.RGBA16UI:case d.RGBA32UI:return"uint";default:return"float"}}function x(e){const{hasDepthAttachment:r,colorSamplerTypes:t,lod:o}=e;return`${r?"Depth":""}${t.reduceRight((e,r)=>e+`|C${r}`,"")} ${o}`}function T(e){switch(e){case d.R16F:case d.R32F:case d.R8:return 3;case d.RG8:return 4;case d.RGBA16F:return 5;case d.RG8UI:return 6;default:return 7}}function F(e,r,t,o){return o?`${e}\ndepth`:`${e}\n${$(r,t)}`}function $(e,r){return`${e.getColorTexture(r)?.debugName??"color"+(r-p)}`}e([t()],m.prototype,"destroyedCB",void 0),e([t()],m.prototype,"consumes",void 0),e([t()],m.prototype,"produces",void 0),e([t()],m.prototype,"clearColor",void 0),m=e([o("esri.views.3d.webgl-engine.effects.debug.RenderNodeVisualizerNode")],m);export{m as RenderNodeVisualizerNode,F as getAttachmentName};
|
|
2
|
+
import{__decorate as e}from"tslib";import{releaseMaybe as r}from"../../../../../core/maybe.js";import{property as t,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as n}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderNodeOutput as i}from"../../../webgl.js";import a from"../../../webgl/RenderNode.js";import{If as s,glsl as c}from"../../core/shaderModules/glsl.js";import{Pos2Locations as l}from"../../lib/DefaultVertexBufferLayouts.js";import{floatBlendReductionFactor as u}from"../../shaders/floatBlendScale.glsl.js";import{checkWebGLError as h}from"../../../../webgl/checkWebGLError.js";import{ColorAttachment0 as p,SizedPixelFormat as d,DataType as f}from"../../../../webgl/enums.js";let m=class extends a{constructor(e){super(e),this.destroyedCB=null,this.consumes={required:[i.FINAL]},this.produces=i.FINAL,this.clearColor=n,this._focusedFBOType=7,this._programs=new Map}destroy(){this._programs.clear(),this.destroyedCB()}render(){const e=this.input;if(!this._focusedTexture)return e;const r=this.renderingContext,t=r.boundFramebuffer;r.bindFramebuffer(e.fbo),r.setClearColor(0,0,0,0),r.clear(16384);const o=this._focusedTexture.attachment,n=[g(o)],i=this._ensureProgram(r,!1,n);return r.useProgram(i),r.bindTexture(o,0),i.setUniform1i("colorTex0",0),i.setUniform1i("inputType",this._focusedFBOType),3===this._focusedFBOType&&i.setUniform2fv("nearFar",this.camera.nearFar),r.setDrawBuffers([p]),r.screen.draw(),r.bindFramebuffer(t),e}getDownscaledFBO(e,r,t,o,n,i){if(n?.startsWith(`${r}\n`)??!1){const r=1/2**e.level;t=e.width*r,o=e.height*r}else i=null;const a="linear depth"===r||r.includes("shadow"),s="overlay highlight"===r||"highlights"===r||"highlight mix"===r,c="highlight coverage"===r,l=e.colorTexture?.descriptor,u=l?.internalFormat,f=[],m=new Array,v=new Array;let x=!1;e.colorAttachments.forEach((r,t)=>{const o=e.getColorTexture(r);if(o){const e=g(o);f.push(e);const{hasMipmap:r,isImmutable:n}=o.descriptor;"float"!==e||r||n||(o.generateMipmap(),m[t]=!0),x||=r}if(t>0){const e=o?.descriptor.internalFormat;return void(e===d.RGBA8&&(o?.debugName?.indexOf("emissive")??-1)>=0?v.push(8):v.push(T(e)))}v.push(a?0:s?1:c?2:i??T(u))});const $=this.renderingContext,{depthStencilTexture:b,level:C}=e,y=this._ensureProgram($,null!=b,f,x?C:null),R=this.fboCache.acquire(t,o,"fbo visualizer");$.useProgram(y);const w=$.boundFramebuffer;$.bindFramebuffer(R.fbo);const B=new Array;e.colorAttachments.forEach((r,t)=>{const o=`colorTex${t.toFixed()}`;$.bindTexture(e.getColorTexture(r),t),y.setUniform1i(o,t),t>0&&R.acquireColor(p+t,5,"fbo visualizer"),B.push(r)});const A=b?.descriptor.linearFilterDepth??!1;if(b){const r=e.colorAttachments.length;b.setShadowFiltering(!1),$.bindTexture(b,r),y.setUniform1i("depthTex",r);const t=p+r;t>p&&R.acquireColor(t,5,"fbo visualizer"),B.push(t)}$.gl.drawBuffers(B),h($.gl);const I=$.getViewport();return $.setViewport(0,0,t,o),$.setClearColor(0,0,0,0),$.clear(16384),$.setBlendingEnabled(!0),$.setBlendFunction(1,771),y.setUniform1iv("inputTypes",v.length>0?v:[7]),y.setUniform2fv("nearFar",this.camera.nearFar),$.screen.draw(),h($.gl),$.bindFramebuffer(w),$.setViewport(I.x,I.y,I.width,I.height),e.colorAttachments.forEach((t,o)=>{const i=e.getColorTexture(t);m[o]&&i?.clearMipmap(),n===F(r,e,t,!1)&&(this._focusedTexture?.release(),this._focusedTexture=R.getAttachment(t),this._focusedTexture?.retain(),this._focusedFBOType=9===v[o]?T(i?.descriptor.internalFormat):v[o])}),b&&b.setShadowFiltering(A),R}clearFocusedFBO(){this._focusedTexture=r(this._focusedTexture)}getPreviewContent(e,r,t,o){const n=this.renderingContext,i=o.includes("\ndepth"),a=this.fboCache.acquire(e,r,"fbo visualizer"),s=n.boundFramebuffer;n.bindFramebuffer(a?.fbo);const c=n.getViewport();n.setViewport(0,0,e,r),n.setClearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),n.clear(16384),n.setBlendingEnabled(!0),n.setBlendFunction(1,771);const l=t.attachment,u=this._ensureProgram(n,!1,[g(l)]);n.useProgram(u),n.bindTexture(l,0),u.setUniform1i("colorTex0",0),u.setUniform1iv("inputTypes",[i||l.descriptor.internalFormat!==d.RGBA16F?7:5]),n.screen.draw();const p=new ImageData(new Uint8ClampedArray(e*r*4),e,r);return n.gl.readPixels(0,0,e,r,6408,f.UNSIGNED_BYTE,new Uint8Array(p.data.buffer)),h(n.gl),n.bindFramebuffer(s),n.setViewport(c.x,c.y,c.width,c.height),a?.release(),p}_ensureProgram(e,r,t,o){const n=x({hasDepthAttachment:r,colorSamplerTypes:t,lod:o}),i=this._programs.get(n);if(i)return i;const a="#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 }",h=e=>{let r="";for(let t=0;t<e.length;++t){const o=e[t];r+=`layout(location = ${c.int(t)}) out vec4 fragColor${c.int(t)};\n uniform ${v(o)} colorTex${c.int(t)};`}return r},p=o??0,d=1,f=null==o?1/d:1/2**(o+1)/d,m=e=>e.reduce((e,r,t)=>e+`{\n int inputType = inputTypes[${t}];\n if (inputType == ${3..toFixed()}) {\n fragColor${t} = vec4(vec3(readTexture(colorTex${t}, uv, ${p}).r), 1.0);\n } else if (inputType == ${4..toFixed()}) {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${p}).rg, 0.0, 1.0);\n } else if (inputType == ${(0).toFixed()}) {\n float depth = 1.0 - ((-linearDepthFromTexture(colorTex${t}, uv) - nearFar[0]) / (nearFar[1] - nearFar[0]));\n fragColor${t} = vec4(vec3(depth), depth >= 0.999 ? 0.0 : 1.0);\n } else if (inputType == ${5..toFixed()}) {\n // Currently only emissive glow uses mipmap levels - and it doubles the energy on each level.\n // Correct this for display. In the future when there are other mipmaps implement this cleaner.\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${p}).rgb * float(${f}), 1.0);\n } else if (inputType == ${1..toFixed()}) {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${p})) * 255.0;\n fragColor${t} = vec4(fragColor${t}.rgb / fragColor${t}.a, fragColor${t}.a);\n } else if(inputType == ${2..toFixed()}) {\n vec2 texDim = vec2(textureSize(colorTex${t}, 0));\n ivec2 iuv = ivec2(uv * texDim);\n uvec2 hh = uvec2(texelFetch(colorTex${t}, iuv, 0).rg);\n fragColor${t} = 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 if(inputType == ${8..toFixed()}) {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${p}));\n fragColor${t}.rgb *= ${u.toFixed(1)};\n } else if (inputType == ${9..toFixed()}) {\n fragColor${t} = vec4(vec3(readTexture(colorTex${t}, uv, ${p}).a), 1.0);\n } else {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${p}));\n }\n }`,""),g=t.length,T=`#version 300 es\n precision highp float;\n precision highp usampler2D;\n\n in vec2 uv;\n ${h(t)}\n ${s(r,`layout(location = ${c.int(g)}) out vec4 fragDepth;\n uniform sampler2D depthTex;`)}\n\n uniform int inputTypes[${t.length||1}];\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 vec4 readTexture(sampler2D tex, vec2 uv, int lod) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(tex, lod)));\n return texelFetch(tex, iuv, lod);\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 ${m(t)}\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 }`,F=e.programCache.get(a,T,l);return this._programs.set(n,F),F}};function v(e){switch(e){case"float":return"sampler2D";case"uint":return"usampler2D";case"int":return"isampler2D"}}function g(e){if(!e)return"float";const{internalFormat:r}=e.descriptor;switch(r){case d.R8I:case d.R16I:case d.R32I:case d.RG8I:case d.RG16I:case d.RG32I:case d.RGB8I:case d.RGB16I:case d.RGB32I:case d.RGBA8I:case d.RGBA16I:case d.RGBA32I:return"int";case d.R8UI:case d.R16UI:case d.R32UI:case d.RG8UI:case d.RG16UI:case d.RG32UI:case d.RGB8UI:case d.RGB16UI:case d.RGB32UI:case d.RGBA8UI:case d.RGBA16UI:case d.RGBA32UI:return"uint";default:return"float"}}function x(e){const{hasDepthAttachment:r,colorSamplerTypes:t,lod:o}=e;return`${r?"Depth":""}${t.reduceRight((e,r)=>e+`|C${r}`,"")} ${o}`}function T(e){switch(e){case d.R16F:case d.R32F:case d.R8:return 3;case d.RG8:return 4;case d.RGBA16F:return 5;case d.RG8UI:return 6;default:return 7}}function F(e,r,t,o){return o?`${e}\ndepth`:`${e}\n${$(r,t)}`}function $(e,r){return`${e.getColorTexture(r)?.debugName??"color"+(r-p)}`}e([t()],m.prototype,"destroyedCB",void 0),e([t()],m.prototype,"consumes",void 0),e([t()],m.prototype,"produces",void 0),e([t()],m.prototype,"clearColor",void 0),m=e([o("esri.views.3d.webgl-engine.effects.debug.RenderNodeVisualizerNode")],m);export{m as RenderNodeVisualizerNode,F as getAttachmentName};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{lerp as t}from"../../../../../core/mathUtils.js";import{releaseMaybe as
|
|
2
|
+
import{__decorate as e}from"tslib";import{lerp as t}from"../../../../../core/mathUtils.js";import{releaseMaybe as r}from"../../../../../core/maybe.js";import{watch as s,initial as i}from"../../../../../core/reactiveUtils.js";import{property as o,subclass as a}from"../../../../../core/accessorSupport/decorators.js";import{set as m}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{length as n}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as l}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as h}from"../../../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as c}from"../../../webgl.js";import{TransparentEnvironment as p}from"../TransparentEnvironment.js";import{BlurEmissionPassParameters as u}from"./blurEmission.glsl.js";import{G as b}from"../../../../../chunks/GlowBlur.glsl.js";import{GlowBlurTechnique as f}from"./GlowBlurTechnique.js";import{GlowCompositeTechnique as _}from"./GlowCompositeTechnique.js";import{FloatBlendScaleConfiguration as g,floatBlendReductionFactor as d}from"../../shaders/floatBlendScale.glsl.js";import{ColorAttachment1 as w,DrawBufferNone as P}from"../../../../webgl/enums.js";import{noParameters as v}from"../../../../webgl/NoParameters.js";let B=class extends p{constructor(e){super(e),this.consumes={required:[c.TRANSPARENT_ENVIRONMENT]},this.produces=c.TRANSPARENT_ENVIRONMENT,this._glowBoost={realistic:0,cartographicMin:.5,cartographicDefault:2.5,cartographicMax:5},this._compositeConfiguration=new g,this._compositeParameters=new u,this._blurParameters=new b;const t=h(e.view.spatialReference);this._atmosphereRadius=t.radius+t.atmosphereHeight}initialize(){this.addHandles([s(()=>this._mode,e=>2===e?this._disable():this._enable(),i),s(()=>this._boost,e=>{this._compositeParameters.boost=e,this.requestRender(1)},i),s(()=>this.view.stage.renderView.fog?.strength??0,e=>{this._compositeParameters.scattering=e,this.requestRender(1)},i)])}precompile(){0!==this.bindParameters.emissions&&(this.techniques.precompile(f),this._compositeConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this.techniques.precompile(_,this._compositeConfiguration))}render(){const e=this.input;if(this._compositeParameters.emission=e.obtainAttachment(w),!this._compositeParameters.emission?.attachment)return e;const{fullWidth:t,fullHeight:s,eye:i}=this.bindParameters.camera,o=n(i);this._compositeParameters.atmosphereC=o**2-this._atmosphereRadius**2,this._compositeParameters.mipmapLevels=this._renderGlowMipMap();const a=this.renderingContext,m=e.obtainDepthTexture();e.acquireColor(w,8,"emissive"),a.bindFramebuffer(e.fbo),a.setViewport(0,0,t,s),a.clearBuffer(1,l);const h=a.setDrawBuffers([P,w]),c=this.techniques.get(_,this._compositeConfiguration);return a.bindTechnique(c,this.bindParameters,this._compositeParameters),a.screen.draw(),a.setDrawBuffers(h),this._compositeParameters.emission=r(this._compositeParameters.emission),this._compositeParameters.mipmapTexture=r(this._compositeParameters.mipmapTexture),e.attachDepth(m),m?.release(),this.fboCache.debugCallback?.("glow-color",e.fbo),e}_renderGlowMipMap(){const e=this.fboCache,{fullWidth:t,fullHeight:r}=this.camera,s=this.renderingContext;this._blurParameters.input=this._compositeParameters.emission?.attachment,this._blurParameters.inputScale=this.bindParameters.useFloatBlend.value?1:d,this._blurParameters.level=0,m(this._blurParameters.size,1,1);const i=Math.floor(.5*t),o=Math.floor(.5*r),a=e.acquire(i,r,"glow horizontal",8);let n,l=i,h=r;const c=this.techniques.get(f),p=s.bindTechnique(c,this.bindParameters,v);for(;l>=1&&h>=1;)this._blurParameters.isHorizontal=!0,this._setupFBO(a,l,h),p.bindDraw(this.bindParameters,v,this._blurParameters),s.screen.draw(),h=Math.floor(.5*h),this._blurParameters.input=a.getTexture(),this._blurParameters.inputScale=1,this._blurParameters.isHorizontal=!1,m(this._blurParameters.size,l/i,h/o),n??=e.acquire(l,h,"glow mipmap",9),this._setupFBO(n,l,h,this._blurParameters.level),p.bindDraw(this.bindParameters,v,this._blurParameters),s.screen.draw(),e.debugCallback?.(n.name,n.fbo),l=Math.floor(.5*l),this._blurParameters.input=n.getTexture(),++this._blurParameters.level;return a.release(),this._compositeParameters.mipmapTexture=n,n&&(n.fbo.level=0),this._blurParameters.level}get _boost(){return 0===this._mode?this._glowBoost.realistic:this._intensity<=.5?t(this._glowBoost.cartographicMin,this._glowBoost.cartographicDefault,2*this._intensity):t(this._glowBoost.cartographicDefault,this._glowBoost.cartographicMax,2*(this._intensity-.5))}get _mode(){return null==this.view.environment.lighting.glow?this.view.environment.atmosphereEnabled?0:2:1}get _intensity(){return this.view.environment.lighting.glow?.intensity??0}_setupFBO(e,t,r,s=0){e.fbo.level=s;const i=this.renderingContext;i.bindFramebuffer(e.fbo),i.setViewport(0,0,t,r),i.setClearColor(0,0,0,0),i.clear(16384)}};e([o()],B.prototype,"consumes",void 0),e([o()],B.prototype,"produces",void 0),B=e([a("esri.views.3d.webgl-engine.effects.glow.Glow")],B);export{B as Glow};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import"../../../../../core/arrayUtils.js";import"../../../../../core/mathUtils.js";import"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/BooleanDrawUniform.js";import"../../core/shaderModules/Float2DrawUniform.js";import"../../core/shaderModules/FloatDrawUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DDrawUniform.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlowBlurDrawParameters,b as build
|
|
2
|
+
import"../../../../../core/arrayUtils.js";import"../../../../../core/mathUtils.js";import"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/BooleanDrawUniform.js";import"../../core/shaderModules/Float2DrawUniform.js";import"../../core/shaderModules/FloatDrawUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DDrawUniform.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlowBlurDrawParameters,b as build}from"../../../../../chunks/GlowBlur.glsl.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import"
|
|
2
|
+
import"./blurEmission.glsl.js";import"../../shaders/ScreenSpacePassAtmosphere.glsl.js";import"../../../../webgl/ShaderBuilder.js";export{b as build}from"../../../../../chunks/GlowComposite.glsl.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{ReloadableShader as r}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as s}from"../../core/shaderTechnique/ShaderTechnique.js";import{
|
|
2
|
+
import{__decorate as e}from"tslib";import{subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{ReloadableShader as r}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as s}from"../../core/shaderTechnique/ShaderTechnique.js";import{G as i}from"../../../../../chunks/GlowComposite.glsl.js";import{makePipelineState as t,defaultColorWrite as l}from"../../../../webgl/renderState.js";let c=class extends s{constructor(){super(...arguments),this.shader=new r(i,()=>import("./GlowComposite.glsl.js"))}initializePipeline(){return t({colorWrite:l})}};c=e([o("esri.views.3d.webgl-engine.effects.glow.GlowCompositeTechnique")],c);export{c as GlowCompositeTechnique};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import e from"../../../environment/FoggyWeather.js";import{ReadDepth as t}from"../../core/shaderLibrary/output/ReadDepth.glsl.js";import{Gamma as a}from"../../core/shaderLibrary/shading/Gamma.glsl.js";import{FloatPassUniform as i}from"../../core/shaderModules/FloatPassUniform.js";import{glsl as o}from"../../core/shaderModules/glsl.js";import{Texture2DBindUniform as r}from"../../core/shaderModules/Texture2DBindUniform.js";import{Texture2DPassUniform as s}from"../../core/shaderModules/Texture2DPassUniform.js";import{getDistanceFalloff as l,DistanceFalloffPassParameters as n}from"../raymarching/DistanceFalloff.glsl.js";import{floatBlendScale as m}from"../../shaders/floatBlendScale.glsl.js";import{ToneMapping as p}from"../../shaders/ToneMapping.glsl.js";class c extends n{constructor(){super(...arguments),this.mipmapLevels=1,this.boost=1,this.scattering=1e-4}}function d(n,c){n.include(a),n.include(l),n.include(t),n.include(p),n.include(m,c),n.uniforms.add(new s("emissionTexture",({emission:e})=>e?.attachment),new r("depthTexture",({mainDepth:e})=>e),new i("scattering",({scattering:e})=>e),new i("boost",({boost:e})=>1+.5*e),new i("levels",({mipmapLevels:e})=>e+1),new i("pixelRatioCorrection",({mipmapLevels:e},{camera:t})=>Math.log2(t.pixelRatio)/(e+1)),new s("mipmapTexture",({mipmapTexture:e})=>e?.getTexture())).constants.add("maxScattering","float",e.maxScattering).constants.add("weightEpsilon","float",.005).code.add(o`vec3 readEmission(float level) {
|
|
3
|
+
level *= levels;
|
|
4
|
+
return level < 1.0 ?
|
|
5
|
+
texture(emissionTexture, uv).rgb * floatBlendInputScale * (1.0 - level) +
|
|
6
|
+
textureLod(mipmapTexture, uv, 0.0).rgb * level * 0.5 :
|
|
7
|
+
textureLod(mipmapTexture, uv, level - 1.0).rgb / pow(2.0, level);
|
|
8
|
+
}
|
|
9
|
+
float gauss(float x, float sigmaSq) {
|
|
10
|
+
float expon = -(pow(x, 2.0) / (2.0 * sigmaSq));
|
|
11
|
+
return exp(expon) / sqrt(6.283185307179586 * sigmaSq);
|
|
12
|
+
}
|
|
13
|
+
vec3 blurEmission() {
|
|
14
|
+
float mainDepth = -1.0;
|
|
15
|
+
float depthSample = depthFromTexture(depthTexture, uv);
|
|
16
|
+
if(depthSample < 1.0 && depthSample > 0.0){
|
|
17
|
+
vec3 cameraSpaceRay = normalize(eyeDir);
|
|
18
|
+
cameraSpaceRay /= cameraSpaceRay.z;
|
|
19
|
+
cameraSpaceRay *= linearizeDepth(depthSample);
|
|
20
|
+
mainDepth = max(0.0, length(cameraSpaceRay));
|
|
21
|
+
}
|
|
22
|
+
vec3 rayDir = normalize(worldRay);
|
|
23
|
+
float dispersionPerPixel = getDistanceFalloff(mainDepth, rayDir, scattering * 0.5);
|
|
24
|
+
float mainPoint = pow(dispersionPerPixel, 2.0) + pixelRatioCorrection;
|
|
25
|
+
vec3 emission = vec3(0.0);
|
|
26
|
+
float weights = 0.0;
|
|
27
|
+
float sigmaSq = (0.1 / maxScattering * scattering + 0.003) + 0.03 * (boost - 1.0);
|
|
28
|
+
for(float level = 0.0; level < levels; ++level) {
|
|
29
|
+
float point = level / levels;
|
|
30
|
+
float dist = abs(point - mainPoint);
|
|
31
|
+
float weight = gauss(dist, sigmaSq);
|
|
32
|
+
if(weight > weightEpsilon) {
|
|
33
|
+
emission += readEmission(point) * weight;
|
|
34
|
+
weights += weight;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return emission * boost / weights;
|
|
38
|
+
}`)}export{c as BlurEmissionPassParameters,d as blurEmission};
|