@arcgis/core 5.2.0-next.102 → 5.2.0-next.104
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/arcgisGlobal.d.ts +2 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{a4dc1a80ed6604d71722.js → 23c4ec0bcbc83179013e.js} +1 -1
- package/assets/esri/core/workers/chunks/3a8f6010a9f06a2457ae.js +1 -0
- package/assets/esri/core/workers/chunks/b24e1c901f7fda2a62ca.js +1 -0
- package/assets/esri/core/workers/chunks/{3847d6f83c8ba7863c01.js → c91905b5808b8049f96d.js} +25 -15
- package/assets/esri/core/workers/chunks/fbbc5f551115787363d2.js +1 -0
- package/config.js +1 -1
- package/kernel.js +1 -1
- package/package.json +4 -4
- package/support/revision.js +1 -1
- package/views/2d/engine/webgl/util/AnnotationMatcher.js +1 -1
- package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
- package/views/3d/terrain/TerrainData.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +29 -19
- package/views/3d/webgl-engine/lib/BufferGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/BufferObject3D.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/widgets/Editor/EditorViewModel.d.ts +3 -2
- package/widgets/Editor/types.d.ts +19 -1
- package/widgets/Editor.d.ts +3 -2
- package/widgets/support/SelectionToolbar/VisibleElements.d.ts +60 -0
- package/widgets/support/SelectionToolbar.d.ts +202 -0
- package/assets/esri/core/workers/chunks/240bee7d0dc5e5dab826.js +0 -1
- package/assets/esri/core/workers/chunks/ad695de9f73b268af139.js +0 -1
- package/assets/esri/core/workers/chunks/b4e5027c121d848c3d5a.js +0 -1
package/config.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="5.2.0-next.
|
|
2
|
+
import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="5.2.0-next.104";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
|
package/kernel.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.2";let r,s=e;function i(o){r=o}function t(e){const s=r?.findCredential(e);return s?.token?o(e,"token",s.token):e}s="5.2.0-next.
|
|
2
|
+
import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.2";let r,s=e;function i(o){r=o}function t(e){const s=r?.findCredential(e);return s?.token?o(e,"token",s.token):e}s="5.2.0-next.104",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,s as fullVersion,r as id,i as setId,e as version};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/core",
|
|
3
|
-
"version": "5.2.0-next.
|
|
3
|
+
"version": "5.2.0-next.104",
|
|
4
4
|
"description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ArcGIS",
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"type": "module",
|
|
20
20
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@amcharts/amcharts5": "~5.20.
|
|
23
|
-
"@arcgis/toolkit": "5.2.0-next.
|
|
22
|
+
"@amcharts/amcharts5": "~5.20.5",
|
|
23
|
+
"@arcgis/toolkit": "5.2.0-next.104",
|
|
24
24
|
"@esri/arcgis-html-sanitizer": "~4.1.0",
|
|
25
25
|
"@esri/calcite-components": "^5.2.0-next.65",
|
|
26
26
|
"@vaadin/grid": "~25.2.9",
|
|
27
|
-
"@zip.js/zip.js": "~2.
|
|
27
|
+
"@zip.js/zip.js": "~2.11.2",
|
|
28
28
|
"luxon": "~3.7.2",
|
|
29
29
|
"marked": "~18.0.11",
|
|
30
30
|
"tslib": "^2.8.1"
|
package/support/revision.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
const
|
|
2
|
+
const a="20260908",b="bd023a1a29fe0cb2608b236176f9956e86774a59";export{a as buildDate,b as revision};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import has from"../../../../../core/has.js";import{clone as e}from"../../../../../core/lang.js";import{OverrideHelper as t}from"../../../../../symbols/cim/OverrideHelper.js";import{FeatureMatcher as r}from"./Matcher.js";import{getCIMSymbols as s,getCIMSymbol as o}from"../../../layers/support/annodime/cimAnnotations.js";import{createDebugWriters as n}from"../../../layers/support/annodime/debugUtils.js";import{createAnnotationMatcherFeatureInfo as i,mixFeature as m}from"../../../layers/support/annodime/MatcherGeometryOverride.js";import{createTileObjectId as l}from"../../../layers/support/annodime/TileObjectId.js";import{hasSymbolFields as c,symbolFields as y}from"../../../layers/support/annodime/virtualFields.js";class a extends r{constructor(e,t){super(),this._context=e,this._symbolCollection=t,this._meshWriters=new Map,this._matcherGeometryOverrides=new Map,this._symbols=s(t)}static async fromAnnotationSchema(e,t){return new a(e,t.symbolCollection)}hasArcadeDependency(){return!1}doMatch(e,t,r){return this._meshWriters.get(l(r,e.getObjectId()))}async fetchResources(e,t,r,s){this._meshWriters.clear(),this._matcherGeometryOverrides.clear();const o=t.getCursor();for(;o.next();){const r=i(o);if(!r)continue;const n=m(o,r);if(!n)continue;const c=await this._createSymbolReference(o,n,r);if(!c)continue;const y=l(s,o.getObjectId());let a=this._meshWriters.get(y);a||(a=await this._createGroup(c,e,t.geometryType),this._meshWriters.set(y,a)),this._matcherGeometryOverrides.set(y,r.geometryOverride)}}async _createGroup(e,t,r){const s=await t.fetchMeshResourceImmediate({type:"mesh-request",symbolReference:e}),o=await b(this._context,s?.meshes||[]);if(has("esri-2d-annotation-dimension-debug")){const e=await n(this._context,t,r);return e.length?[...o,...e]:o}return o}async _createSymbolReference(e,r,s){const o=this._getUnresolvedSymbolReference(s);if(!o)return null;p(o);const n=await t.resolveSymbolOverrides(o,r,e.metadata.outSpatialReference,null,e.geometryType);return n?{type:"CIMSymbolReference",symbol:n}:null}_getUnresolvedSymbolReference(t){const{annotationGraphic:r,annotationGeometryType:s}=t,{bloated:o,symbolID:n}=r;if(o||c(r))return this._getProcessedSymbolReference(t);if(n){const t=this._symbols[n][s];return t?e(t.data):null}return null}_getProcessedSymbolReference(e){const{annotationGraphic:t,annotationGeometryType:r}=e,{bloated:s,symbol:n,symbolID:i}=t;let m=this._getRawSymbolReference(n,i);if(!m||!m.symbol)return null;if(s||(m=this._applySymbolFields(m,t)),!m.symbol||"CIMTextSymbol"!==m.symbol.type)return null;const{data:l}=o(m.symbol,r);return{type:"CIMSymbolReference",symbol:l.symbol,primitiveOverrides:[...m.primitiveOverrides||[],...l.primitiveOverrides||[]]}}_getRawSymbolReference(e,t){if(e&&null!=e.symbol&&"CIMTextSymbol"===e.symbol.type)return e;if(null!=t){const e=this._symbolCollection.find(e=>(e.iD??0)===t);if(e)return{type:"CIMSymbolReference",symbol:e.symbol}}return null}_applySymbolFields(t,r){if(!t.symbol||"CIMTextSymbol"!==t.symbol.type)return t;const s=e(t.symbol);for(const e of y)e.setOnSymbol(s,r);return{type:"CIMSymbolReference",symbol:s,primitiveOverrides:t.primitiveOverrides}}cleanup(e,t,r){const s=t.getObjectId(),o=l(r,s);this._matcherGeometryOverrides.delete(o),this._meshWriters.delete(o)}getMatcherGeometryOverride(e){return this._matcherGeometryOverrides.get(e)??null}}function b(e,t){const r=t.map(e=>({...e}));return e.createMeshWriters(r)}function u(e){return e}function p(e){if(!e.symbol||!("symbolLayers"in e.symbol))return;const t=u({type:"PrivateMatcherGeometryOverrideEffect"});e.symbol.symbolLayers=(e.symbol.symbolLayers||[]).map(e=>({...e,effects:[t,...e.effects||[]]}))}export{a as AnnotationMatcher};
|
|
2
|
+
import has from"../../../../../core/has.js";import{clone as e}from"../../../../../core/lang.js";import{OverrideHelper as t}from"../../../../../symbols/cim/OverrideHelper.js";import{FeatureMatcher as r}from"./Matcher.js";import{getCIMSymbols as s,getCIMSymbol as o}from"../../../layers/support/annodime/cimAnnotations.js";import{createDebugWriters as n}from"../../../layers/support/annodime/debugUtils.js";import{createAnnotationMatcherFeatureInfo as i,mixFeature as m}from"../../../layers/support/annodime/MatcherGeometryOverride.js";import{createTileObjectId as l}from"../../../layers/support/annodime/TileObjectId.js";import{hasSymbolFields as c,symbolFields as y}from"../../../layers/support/annodime/virtualFields.js";class a extends r{constructor(e,t){super(),this._context=e,this._symbolCollection=t,this._meshWriters=new Map,this._matcherGeometryOverrides=new Map,this._symbols=s(t)}static async fromAnnotationSchema(e,t){return new a(e,t.symbolCollection)}hasArcadeDependency(){return!1}doMatch(e,t,r){return this._meshWriters.get(l(r,e.getObjectId()))}async fetchResources(e,t,r,s){this._meshWriters.clear(),this._matcherGeometryOverrides.clear();const o=t.getCursor();for(;o.next();){const r=i(o);if(!r)continue;const n=m(o,r);if(!n)continue;const c=await this._createSymbolReference(o,n,r);if(!c)continue;const y=l(s,o.getObjectId());let a=this._meshWriters.get(y);a||(a=await this._createGroup(c,e,t.geometryType),this._meshWriters.set(y,a)),this._matcherGeometryOverrides.set(y,r.geometryOverride)}}async _createGroup(e,t,r){const s=await t.fetchMeshResourceImmediate({type:"mesh-request",symbolReference:e}),o=await b(this._context,s?.meshes||[]);if(has("esri-2d-annotation-dimension-debug")){const e=await n(this._context,t,r);return e.length?[...o,...e]:o}return o}async _createSymbolReference(e,r,s){const o=this._getUnresolvedSymbolReference(s);if(!o)return null;p(o);const n=await t.resolveSymbolOverrides(o,r,e.metadata.outSpatialReference,null,e.geometryType);return n?{type:"CIMSymbolReference",symbol:n}:null}_getUnresolvedSymbolReference(t){const{annotationGraphic:r,annotationGeometryType:s}=t,{bloated:o,symbolID:n}=r;if(o||c(r))return this._getProcessedSymbolReference(t);if(null!=n){const t=this._symbols[n][s];return t?e(t.data):null}return null}_getProcessedSymbolReference(e){const{annotationGraphic:t,annotationGeometryType:r}=e,{bloated:s,symbol:n,symbolID:i}=t;let m=this._getRawSymbolReference(n,i);if(!m||!m.symbol)return null;if(s||(m=this._applySymbolFields(m,t)),!m.symbol||"CIMTextSymbol"!==m.symbol.type)return null;const{data:l}=o(m.symbol,r);return{type:"CIMSymbolReference",symbol:l.symbol,primitiveOverrides:[...m.primitiveOverrides||[],...l.primitiveOverrides||[]]}}_getRawSymbolReference(e,t){if(e&&null!=e.symbol&&"CIMTextSymbol"===e.symbol.type)return e;if(null!=t){const e=this._symbolCollection.find(e=>(e.iD??0)===t);if(e)return{type:"CIMSymbolReference",symbol:e.symbol}}return null}_applySymbolFields(t,r){if(!t.symbol||"CIMTextSymbol"!==t.symbol.type)return t;const s=e(t.symbol);for(const e of y)e.setOnSymbol(s,r);return{type:"CIMSymbolReference",symbol:s,primitiveOverrides:t.primitiveOverrides}}cleanup(e,t,r){const s=t.getObjectId(),o=l(r,s);this._matcherGeometryOverrides.delete(o),this._meshWriters.delete(o)}getMatcherGeometryOverride(e){return this._matcherGeometryOverrides.get(e)??null}}function b(e,t){const r=t.map(e=>({...e}));return e.createMeshWriters(r)}function u(e){return e}function p(e){if(!e.symbol||!("symbolLayers"in e.symbol))return;const t=u({type:"PrivateMatcherGeometryOverrideEffect"});e.symbol.symbolLayers=(e.symbol.symbolLayers||[]).map(e=>({...e,effects:[t,...e.effects||[]]}))}export{a as AnnotationMatcher};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import"../../../core/has.js";import{whenOnce as i,watch as r,sync as s}from"../../../core/reactiveUtils.js";import{property as l,subclass as a}from"../../../core/accessorSupport/decorators.js";import{computeSrcResolutions as
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import"../../../core/has.js";import{whenOnce as i,watch as r,sync as s}from"../../../core/reactiveUtils.js";import{property as l,subclass as a}from"../../../core/accessorSupport/decorators.js";import{computeSrcResolutions as o,projectDatasetExtent as n}from"../../../layers/raster/functions/rasterProjectionHelper.js";import{LayerView3D as h}from"./LayerView3D.js";import{TiledLayerView3D as m}from"./TiledLayerView3D.js";import u from"../support/flow/FlowSubViewTiles3D.js";import{RasterTile as d}from"../terrain/RasterTile.js";import{emptyTile as p}from"../terrain/TerrainData.js";import c from"../../layers/ImageryTileLayerView.js";import{RefreshableLayerView as y}from"../../layers/RefreshableLayerView.js";import{createQueryGeometry as f}from"../../support/drapedUtils.js";import{getWebGLCapabilities as w}from"../../webgl/capabilities.js";let g=class extends(y(m(h(c)))){constructor(){super(...arguments),this._srcResolutions=[],this.type="imagery-tile-3d",this._isAlignedMapTile=!0,this._flowSubView=null,this.ignoresMemoryFactor=!1,this.unloadedMemory=0}initialize(){this.layer.increaseRasterJobHandlerUsage(),null==this.fullExtent&&this.addResolvingPromise(Promise.reject(new t("layerview:spatial-reference-incompatible","The layer extent cannot be projected to the view's spatial reference",{layer:this.layer})));const e=i(()=>this.view?.basemapTerrain?.tilingSchemeLocked).then(()=>{const e=this.view.basemapTerrain.tilingScheme,t=this.layer.tileInfo;this._isAlignedMapTile=["png","png24","png32","jpg","mixed"].includes(t.format)&&e.compatibleWith(t),this.tileInfo=this._isAlignedMapTile?t:e.toTileInfo(),this._srcResolutions=o(this.layer.serviceRasterInfo,this.tileInfo),this.addHandles([r(()=>this.layer.renderer,e=>{this._setSubView(e),this._updatingHandles.consumePromise(this.doRefresh())},s),r(()=>[this.layer.interpolation,this.layer.bandIds,this.layer.multidimensionalDefinition,this.layer.multidimensionalSubset,this.layer.rasterFunction,this.timeExtent],()=>this._updatingHandles.addPromise(this.doRefresh()),s)])});this._setSubView(this.layer.renderer),this.addResolvingPromise(e)}destroy(){this.layer.decreaseRasterJobHandlerUsage(),this._flowSubView?.destroy()}get fullExtent(){try{return this.layer.loaded?this._getFullExtent():null}catch{return null}}_setSubView(e){if("wcs"===this.layer.type)return;const t="flow"===e?.type,i=this._flowSubView;t&&null!=i||(i?.destroy(),this._flowSubView=t?new u({layerView:this}):null)}get _hasFlow(){return null!=this._flowSubView}get imageFormatIsOpaque(){return"jpg"===this.layer.tileInfo.format}get hasMixedImageFormats(){return"mixed"===this.layer.tileInfo.format}get dataLevelRange(){const e=this.layer.tileInfo,t=this.tileInfo.lodAt(0)?.scale,i=e.lodAt(e.lods.length-1)?.scale;return this.levelRangeFromScaleRange(t,i)}get visibleAtCurrentScale(){return this._flowSubView?.visibleAtCurrentScale??this.tilesVisibleAtCurrentScale()}_getFullExtent(){return n(this.layer.serviceRasterInfo,this.view.groundView?.spatialReference??this.view.spatialReference)}async fetchTile(e,i){if(this._isAlignedMapTile)return this.layer.fetchImageBitmapTile(e[0],e[1],e[2],{...i,allowDeriveTypeFromData:!0,imageOrientation:"flipY"});const r=this.tileInfo,s=this._canSymbolizeInWebGL(),l={tileInfo:r,requestRawData:s&&!this._hasFlow,signal:i.signal,timeExtent:this.timeExtent,requestProjectedLocalDirections:this._hasFlow,srcResolution:this._srcResolutions[e[0]],noClip:!1},{layer:a}=this,[o,n,h]=e,m=await a.fetchTile(o,n,h,l);if(m instanceof HTMLImageElement||m instanceof ImageBitmap)throw new t("layerview:unexpected-tile-data","Expected fetchTile to return raster data, but received an image element. This may indicate a problem with the layer's fetchTile implementation.");let u=m?.pixelBlock;if(null==u)return p;if(!s&&!this._hasFlow&&(u=await a.applyRenderer(m),null==u))return p;const c=new d([o,n,h],u,r.size[0],r.size[1]);return s?(c.symbolizerRenderer=a.symbolizer.rendererJSON,c.symbolizerParameters=a.symbolizer.generateWebGLParameters(this._getSymbolizerOptions(o)),c.transformGrid=m.transformGrid,c.bandIds=a.bandIds):(c.isRenderedSource=!0,c.bandIds=null),c.interpolation=a.interpolation,c}_getSymbolizerOptions(e){const t=this.tileInfo.lodAt(e).resolution;return{pixelBlock:null,isGCS:null!=this.view.groundView?.spatialReference?this.view.groundView.spatialReference.isGeographic:this.view.spatialReference.isGeographic,resolution:{x:t,y:t},bandIds:this.layer.bandIds}}ensureSymbolizerParameters(e){this._canSymbolizeInWebGL()&&JSON.stringify(e.symbolizerRenderer)!==JSON.stringify(this.layer.symbolizer.rendererJSON)&&(e.symbolizerParameters=this.layer.symbolizer.generateWebGLParameters(this._getSymbolizerOptions(e.lij[0])))}createFetchPopupFeaturesQueryGeometry(e,t){return f(e,t,this.view)}async doRefresh(){this.suspended||(this._flowSubView?.doRefresh(),this.emit("data-changed"))}isUpdating(){return this._flowSubView?.updating??!1}_canSymbolizeInWebGL(){const e=w(),{symbolizer:t}=this.layer,i=t.lookup.colormapLut?.indexedColormap,r=!!this.layer.rasterFunction?.hasClipFunction,s=i&&i.length>4*(e.maxTextureSize||4096);return t.canRenderInWebGL&&!s&&!r}get usedMemory(){return this._flowSubView?.usedMemory??0}get test(){}};e([l()],g.prototype,"fullExtent",null),e([l()],g.prototype,"_hasFlow",null),e([l({readOnly:!0})],g.prototype,"imageFormatIsOpaque",null),e([l({readOnly:!0})],g.prototype,"hasMixedImageFormats",null),e([l()],g.prototype,"_flowSubView",void 0),e([l({readOnly:!0})],g.prototype,"dataLevelRange",null),e([l({readOnly:!0})],g.prototype,"visibleAtCurrentScale",null),g=e([a("esri.views.3d.layers.ImageryTileLayerView3D")],g);const b=g;export{b as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
function
|
|
2
|
+
const t={type:"empty-tile"};function e(t){return null!=t&&"type"in t&&"vector-tile"===t.type}function n(t){return null!=t&&"type"in t&&"raster-tile"===t.type}function i(t){return null!=t&&"type"in t&&"tile-texture"===t.type}function u(t){return null!=t&&"type"in t&&"empty-tile"===t.type}function l(t){return null!=t&&"type"in t&&"bitmap"in t}export{t as emptyTile,l as isCreateBitmapResult,u as isEmptyTile,n as isRasterTile,i as isTileTexture,e as isVectorTile};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import"../../../core/has.js";import{disposeMaybe as e,releaseMaybe as t}from"../../../core/maybe.js";import{set as r,copy as s}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as
|
|
2
|
+
import"../../../core/has.js";import{disposeMaybe as e,releaseMaybe as t}from"../../../core/maybe.js";import{set as r,copy as s}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as a}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as o}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isBaseLayer as i,isGroupLayer as n,isReferenceLayer as u}from"../../../layers/support/layerUtils.js";import{isLayerViewWithFlowRenderer as c}from"../support/flowUtils.js";import{BlendLayersPassParameters as p}from"./BlendLayersTechnique.js";import{isEmptyTile as l}from"./TerrainData.js";import{isBlendableLayerView as d,isVectorTileLayerView as h,isVectorTileRenderInfo as m,isImageryTileRenderInfo as f,isImageSourceRenderInfo as _,isTextureTileRenderInfo as x,isVectorTilePerLayerInfo as T}from"./terrainUtils.js";import{TextureReference as y}from"./TextureReference.js";import{TileCompositor as g}from"./TileCompositor.js";import{TileRenderInfo as b}from"./TileRenderInfo.js";import{getCacheKey as k,TileTexture as L}from"./TileTexture.js";import{fallsWithinLayerView as I}from"./tileUtils.js";import{blendModeFromString as w}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{isCompressible as B}from"../../support/TextureCompressionWorkerHandle.js";import C from"../../webgl/Texture.js";import{TextureDescriptor as P}from"../../webgl/TextureDescriptor.js";class M{constructor(e,t,r,s,a){this._rctx=e,this.tileSize=t,this._techniques=r,this._cache=s,this._compressionTracker=a,this._passParameters=new p,this._backgroundColor=null,this._maxAnisotropy=this._rctx.parameters.maxMaxAnisotropy,this._compositor=new g(this._rctx,this._techniques)}dispose(){this._compositor=e(this._compositor),this._backgroundTexture=t(this._backgroundTexture)}get backgroundIsGrid(){return null==this._backgroundColor}get backgroundColor(){return this._backgroundColor}updateHeading(e){this._compositor?.updateHeading(e)}updateTileTexture(e,t){if(!e.renderData)return;const r=this._prepareUpdateState(e),s=r.targetTextureSize/this.tileSize;0!==r.numTexturedLayers&&null!==r.firstTexturedLayerIndex?1===r.numTexturedLayers&&!r.foundBlendMode&&this._useLayerTexture(e,r.firstTexturedLayerIndex)||this._composeLayers(e,t,r.lastLayerIndex,r.hasBasemapLayers,r.targetTextureSize,s,!r.backgroundCovered||r.foundBlendMode,U,r.foundBlendMode):this._useBackgroundTexture(e,r.numVisibleLayers,0!==t)}_prepareUpdateState(e){const t=e.surface,r=t.baseOpacity,s=t.view.state.contentPixelRatio,a=e.layerInfo[1];let o=0,p=0,m=this.tileSize,f=!1,_=!1,x=!1,T=null;U.clear(),F.length=0;for(let y=0;y<a.length;y++){const g=t.layerViewByIndex(y,1),b=g.layer,k=!I(e,g),L=b.opacity,w=g.fullOpacity;if(_=_||i(b),c(g))continue;if(d(g)){let e="normal"!==g.layer.blendMode;if(n(b.parent)){const t=b.parent.uid;null!=t&&""!==t&&(e=S(b.parent)||e)}e&&(x=e,f=!1)}if(this._canSkipLayer(L,k,x)){this._clearTexturePendingUpdates(a[y]);continue}++p;const B=h(g),C=j(e,y,B);if(C&&(this._clearTexturePendingUpdates(a[y]),!l(C.sourceLayerInfo.data))){if(n(b.parent)){const e=b.parent.uid;null!=e&&""!==e&&v(b.parent,y)}if(B)m=Math.max(m,this.tileSize*s);else{const e=this._prepareTextureForBackgroundCoverageCheck(C,u(b));1===r&&1===w&&(g.isOpaque||!0===e?.descriptor.isOpaque)&&(f=!0)}++o,null===T&&(T=y)}}return{numTexturedLayers:o,numVisibleLayers:p,targetTextureSize:m,backgroundCovered:f,hasBasemapLayers:_,foundBlendMode:x,firstTexturedLayerIndex:T,lastLayerIndex:a.length-1}}_canSkipLayer(e,t,r){return this._isLayerNonContributing(e,t)&&!r}_isLayerNonContributing(e,t){return 0===e||t}_clearTexturePendingUpdates(e){e.pendingUpdates&=-1}_prepareTextureForBackgroundCoverageCheck(e,t){return this._dataToTexture(e,t)?e.sourceLayerInfo.data:null}setBackground(e){this._backgroundColor!==e&&(this._backgroundColor=e,this._backgroundTexture&&this._drawBackgroundTexture(this._backgroundTexture))}_ensureBackgroundTexture(){return null==this._backgroundTexture&&(this._backgroundTexture=this._buildTexture(this.tileSize,!1),this._drawBackgroundTexture(this._backgroundTexture)),this._backgroundTexture}_drawBackgroundTexture(e){this._compositor.bind(this.tileSize),this._passParameters.offset=a,this._passParameters.scale=1,this._passParameters.opacity=1,this.backgroundColor&&(this._passParameters.backgroundColor=this.backgroundColor),this._compositor.drawBackground(this._passParameters,null!=this.backgroundColor),this._compositor.copyFBOToTexture(e),this._compositor.unbind()}_useBackgroundTexture(e,t,r){const s=e.renderData,a=!r&&null!=s.textureReference&&(e.surface.view.layerViewManager.updating||t>0)?5e3:0,o=this._ensureBackgroundTexture();s.setTextureReference(new y(o,0,R,e.surface.baseOpacity,0,1),a)}_useLayerTexture(e,t){const r=e.surface.layerViewByIndex(t,1),s=i(r.layer),a=s?e.surface.baseOpacity:1,n=s?1:e.surface.baseOpacity,c=r.fullOpacity,p=j(e,t,!1);return!!this._dataToTexture(p,u(r.layer))&&(e.renderData.setTextureReference(new y(p.sourceLayerInfo.data,0,o(p.offset[0],p.offset[1],p.scale,p.scale),a,n,c)),!0)}_composeLayers(e,t,r,s,o,n,p,_,x){this._compositor.ensureBuffer(o);const T=e.surface.baseOpacity;let g=!1,b=9987,k=!1,L=0;for(let y=r;y>=0;y--){const t=e.surface.layerViewByIndex(y,1);if(c(t))continue;const r=t.layer,B=j(e,y,h(t)),C=r.opacity,P=!I(e,t);if(!B||l(B.sourceLayerInfo.data)||this._canSkipLayer(C,P,x))continue;const M=!i(r)&&!g;g||=M;const S=this._openGroupsAtLayer(y,o,T,s,p,M,_),v=S?4:p&&0===L?this.backgroundIsGrid?3:2:1,D=w[d(t)?t.layer.blendMode:"normal"];for(this._passParameters.baseOpacity=M&&!S&&T<1?T:1,this._passParameters.opacity=C,m(B)?k=this._compositor.drawVectorData(this._passParameters,v,o,D,B,n,this.tileSize,k):f(B)?(this._compositor.drawRasterData(this._passParameters,v,o,D,B),O(B)&&(b=9728)):this._dataToTexture(B,u(r))&&(this._passParameters.texture=B.sourceLayerInfo.data.texture,this._passParameters.offset=B.offset,this._passParameters.scale=B.scale,this._compositor.drawImageData(this._passParameters,v,o,D));F.length>0&&F[F.length-1].end===y;){const e=F.pop();this._passParameters.baseOpacity=e.baseOpacity,this._passParameters.opacity=e.opacity,this._passParameters.offset=a,this._passParameters.scale=1,this._compositor.drawGroup(this._passParameters,e.output,o,w[e.blendMode])}L++}const B=e.renderData,C=x||g&&T<1,P=B.ensureTexture(o,C,t,()=>this._buildTexture(o,C,b));this._compositor.copyFBOToTexture(P),this._compositor.unbind(),B.setTextureReference(new y(P,t,R,g?1:T,0,1))}_openGroupsAtLayer(e,t,r,s,a,o,i){let n=!1;return i.forEach(i=>{i.start===e&&(i.output=s?1:a&&o?this.backgroundIsGrid?3:2:1,i.baseOpacity=o?r:1,F.push(i),this._compositor.openGroup(t),n=!0)}),n}_dataToTexture(e,t){if(_(e)){const r=e.sourceLayerInfo,s=!t;r.data=this._buildTexture(r.data,!0,s,1!==e.scale,e.tile.onCompressionFinished),e.tile.setMemoryDirty()}return x(e)}_buildTexture(e,t,r=9987,s=!1,a=()=>{}){return null==e?null:"number"==typeof e?this._buildTextureFromSize(e,t,r):this._buildTextureFromImage(e,t,r,s,a)}_buildTextureFromSize(e,t,r){const s=this._createTextureDescriptor(t,"boolean"==typeof r?9987:r);s.width=s.height=e;const a=this._buildTileTexture(s);return this._generateTextureMipmap(a),a}_buildTextureFromImage(e,t,r,s,a){const o=this._createTextureDescriptor(t,"boolean"==typeof r?9987:r);o.isOpaque=e.isOpaque,o.isOpaque&&(o.pixelFormat=6407);const{bitmap:i}=e;o.width=i.width,o.height=i.height;const n="boolean"==typeof r&&r,u=this._buildTileTexture(o,n,s,a,i);return this._generateTextureMipmap(u),u}_createTextureDescriptor(e,t){const r=new P;return r.wrapMode=33071,r.samplingMode=t,r.maxAnisotropy=this._maxAnisotropy,r.preMultiplyAlpha=!0,r.flipped=!0,r.hasMipmap=!0,e||(r.pixelFormat=6407),r}_generateTextureMipmap(e){const t=this._rctx,r=t.bindTexture(e.texture,C.TEXTURE_UNIT_FOR_UPDATES);e.generateMipmap(),t.bindTexture(r,C.TEXTURE_UNIT_FOR_UPDATES)}_buildTileTexture(e,t=!1,r=!1,s=()=>{},a){const o=this._cache.pop(k(e,!1))??this._cache.pop(k(e,!0));if(t&&=B(a,e),o)return o.retain(),t?o.texture.enableCompression({compressionTracker:this._compressionTracker,compressionCallback:s,preserveSourceBitmap:r}):o.texture.disableCompression(),o.texture.setData(a),o;e.compress=t?{compressionTracker:this._compressionTracker,compressionCallback:s,preserveSourceBitmap:r}:void 0;const i=new C(this._rctx,e,a);return new L(i,this._cache)}get test(){}}function j(e,t,a){z.layerIndex=t,z.vtlNeighborInfos.clear();const o=e.layerInfo[1][t];if(r(z.offset,0,0),z.tile=e,z.scale=1,z.sourceLod=e.lij,z.sourceLayerInfo=o,z.isVTLBackground=a,o.data)return a&&e.forEachLoadedNeighbor((r,s)=>{if(r.level!==e.level)return;const a=r.layerInfo[1][t];if(!T(a)||o.data===a.data)return;const i=z.vtlNeighborInfos.pushNew();i.offset=A[s],i.sourceLod=r.lij,i.sourceLayerInfo=a}),z;const i=o.upsampleInfo,n=i?.tile?.layerInfo[1][t];return n&&i.tile?(z.tile=i.tile,s(z.offset,i.offset),z.scale=i.scale,z.sourceLod=i.tile.lij,z.sourceLayerInfo=n,z):a?z:null}function O(e){const t=e.sourceLayerInfo.data;return!!t.source&&"nearest"===t.interpolation}function S(e){let t="normal"!==e.blendMode;return n(e.parent)&&(t=S(e.parent)||t),t}function v(e,t){n(e.parent)&&v(e.parent,t);const r=e.uid;if(null!=r&&""!==r){const s=U.get(r);s?s.start=t:U.set(r,new D(t,t,e.blendMode,e.opacity,1,1))}}class D{constructor(e,t,r,s,a,o){this.start=e,this.end=t,this.blendMode=r,this.opacity=s,this.output=a,this.baseOpacity=o}}const U=new Map,F=new Array,z=new b,R=o(0,0,1,1),A=new Array;function N(){z.sourceLayerInfo=null,z.tile=null,z.vtlNeighborInfos.prune()}A[0]=[0,-1],A[1]=[-1,-1],A[2]=[-1,0],A[3]=[-1,1],A[4]=[0,1],A[5]=[1,1],A[6]=[1,0],A[7]=[1,-1];export{D as GroupInfo,M as TileRenderer,N as cleanupTileRenderer};
|
|
@@ -1,25 +1,37 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{EvaluateAmbientLighting as i}from"./EvaluateAmbientLighting.glsl.js";import{EvaluateAmbientOcclusion as n}from"./EvaluateAmbientOcclusion.glsl.js";import{Gamma as e}from"./Gamma.glsl.js";import{addMainLightDirection as t,addMainLightIntensity as a,applyShading as o}from"./MainLighting.glsl.js";import{PhysicallyBasedRendering as l}from"./PhysicallyBasedRendering.glsl.js";import{PiUtils as r}from"./PiUtils.glsl.js";import{ReadGlobalIllumination as c}from"./ReadGlobalIllumination.glsl.js";import{BooleanBindUniform as s}from"../../shaderModules/BooleanBindUniform.js";import{FloatBindUniform as d}from"../../shaderModules/FloatBindUniform.js";import{glsl as m,If as u}from"../../shaderModules/glsl.js";import{ambientBoost as g}from"../../../lighting/SceneLighting.js";import{BlackLevelLightSoftCompression as h}from"../../../shaders/BlackLevelLightSoftCompression.glsl.js";import{ToneMapping as p}from"../../../shaders/ToneMapping.glsl.js";function f(i){i.constants.add("ambientBoostFactor","float",g)}function
|
|
2
|
+
import{EvaluateAmbientLighting as i}from"./EvaluateAmbientLighting.glsl.js";import{EvaluateAmbientOcclusion as n}from"./EvaluateAmbientOcclusion.glsl.js";import{Gamma as e}from"./Gamma.glsl.js";import{addMainLightDirection as t,addMainLightIntensity as a,applyShading as o}from"./MainLighting.glsl.js";import{PhysicallyBasedRendering as l}from"./PhysicallyBasedRendering.glsl.js";import{PiUtils as r}from"./PiUtils.glsl.js";import{ReadGlobalIllumination as c}from"./ReadGlobalIllumination.glsl.js";import{BooleanBindUniform as s}from"../../shaderModules/BooleanBindUniform.js";import{FloatBindUniform as d}from"../../shaderModules/FloatBindUniform.js";import{glsl as m,If as u}from"../../shaderModules/glsl.js";import{ambientBoost as g}from"../../../lighting/SceneLighting.js";import{BlackLevelLightSoftCompression as h}from"../../../shaders/BlackLevelLightSoftCompression.glsl.js";import{ToneMapping as p}from"../../../shaders/ToneMapping.glsl.js";function f(i){i.constants.add("ambientBoostFactor","float",g)}function v(i){i.uniforms.add(new d("lightingGlobalFactor",i=>i.lighting.globalFactor))}function b(g,b){const{pbrMode:L,spherical:I,hasColorTexture:C,receiveGlobalIllumination:D}=b;g.include(e),g.include(c,b),g.include(n,b),0!==L&&g.include(l,b),g.include(i,b),g.include(r),g.include(p,b);const R=!(2===L&&!C);R&&g.include(h),f(g),v(g),t(g),g.code.add(m`
|
|
3
3
|
float additionalDirectedAmbientLight(float lightAlignment) {
|
|
4
4
|
return smoothstep(0.0, 1.0, clamp(lightAlignment * 2.5, 0.0, 1.0));
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
float additionalDirectedAmbientLight(vec3 vPosWorld) {
|
|
8
|
-
float lightAlignment = dot(${
|
|
8
|
+
float lightAlignment = dot(${I?m`normalize(vPosWorld)`:m`vec3(0.0, 0.0, 1.0)`}, mainLightDirection);
|
|
9
9
|
return smoothstep(0.0, 1.0, clamp(lightAlignment * 2.5, 0.0, 1.0));
|
|
10
10
|
}
|
|
11
11
|
`),a(g),g.code.add(m`vec3 evaluateAdditionalLighting(float ambientOcclusion, vec3 vPosWorld) {
|
|
12
12
|
float additionalAmbientScale = additionalDirectedAmbientLight(vPosWorld);
|
|
13
13
|
return (1.0 - ambientOcclusion) * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor * mainLightIntensity;
|
|
14
|
-
}`);const y=D?"globalIlluminationOcclusion":"ssao",A=D?.75:1,S=D?1.5:1;switch(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
vec3 albedoLinear
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
vec3
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
}`);const y=D?"globalIlluminationOcclusion":"ssao",A=D?.75:1,S=D?1.5:1;switch(D&&g.code.add(m`vec3 evaluateGlobalIlluminationOcclusion() {
|
|
15
|
+
return min(1.2 * readGlobalIlluminationOcclusion(), 1.0);
|
|
16
|
+
}
|
|
17
|
+
vec3 evaluateGlobalIlluminationEmission(vec3 albedoLinear) {
|
|
18
|
+
return 2.25 * (0.75 * albedoLinear + 0.25) * readGlobalIlluminationEmission().rgb;
|
|
19
|
+
}`),L){case 0:case 4:case 3:g.include(o),g.code.add(m`
|
|
20
|
+
vec3 evaluateSceneLighting(vec3 normalWorld, vec3 albedo, float shadow, float ssao, vec3 additionalLight) {
|
|
21
|
+
${u(D,m`vec3 globalIlluminationOcclusion = evaluateGlobalIlluminationOcclusion();`)}
|
|
22
|
+
|
|
23
|
+
vec3 mainLighting = ${D?`${m.float(A)} * `:""}applyShading(normalWorld, shadow);
|
|
24
|
+
vec3 ambientLighting = ${D?`${m.float(S)} * `:""}calculateAmbientIrradiance(normalWorld) * (1.0 - ${y});
|
|
25
|
+
vec3 albedoLinear = linearizeGamma(albedo);
|
|
26
|
+
|
|
27
|
+
vec3 totalLight = mainLighting + ambientLighting + additionalLight;
|
|
28
|
+
totalLight = min(totalLight, vec3(PI));
|
|
29
|
+
vec3 outColor = vec3((albedoLinear / PI) * totalLight);
|
|
30
|
+
${u(D,m`
|
|
31
|
+
outColor += evaluateGlobalIlluminationEmission(albedoLinear);`)}
|
|
32
|
+
return delinearizeGamma(outColor);
|
|
33
|
+
}
|
|
34
|
+
`);break;case 1:case 2:{const i=D?.35:.2;g.code.add(m`
|
|
23
35
|
const float fillLightIntensity = 0.25;
|
|
24
36
|
const float horizonLightDiffusion = 0.4;
|
|
25
37
|
const float additionalAmbientIrradianceFactor = 0.02;
|
|
@@ -30,8 +42,8 @@ return delinearizeGamma(outColor);
|
|
|
30
42
|
PBRShadingInfo inputs;
|
|
31
43
|
calculatePBRInputs(inputs, normal, viewDirection, upDirection, albedo, mrr);
|
|
32
44
|
|
|
33
|
-
|
|
34
|
-
`),
|
|
45
|
+
${u(D,m`vec3 globalIlluminationOcclusion = evaluateGlobalIlluminationOcclusion();`)}
|
|
46
|
+
`),b.useFillLights?g.uniforms.add(new s("hasFillLights",i=>i.enableFillLights)):g.constants.add("hasFillLights","bool",!1),g.code.add(m`
|
|
35
47
|
vec3 ambientDir = vec3(5.0 * upDirection[1] - upDirection[0] * upDirection[2], - 5.0 * upDirection[0] - upDirection[2] * upDirection[1], upDirection[1] * upDirection[1] + upDirection[0] * upDirection[0]);
|
|
36
48
|
ambientDir = ambientDir != vec3(0.0) ? normalize(ambientDir) : normalize(vec3(5.0, -1.0, 0.0));
|
|
37
49
|
|
|
@@ -73,8 +85,7 @@ return delinearizeGamma(outColor);
|
|
|
73
85
|
vec3 outColorLinear = reflectedColorComponent + additionalMaterialReflectanceComponent;
|
|
74
86
|
|
|
75
87
|
${u(D,m`
|
|
76
|
-
|
|
77
|
-
outColorLinear += globalIlluminationEmission;`)}
|
|
88
|
+
outColorLinear += evaluateGlobalIlluminationEmission(inputs.albedoLinear);`)}
|
|
78
89
|
|
|
79
90
|
${R?m`vec3 adjustedOutColorLinear = blackLevelSoftCompression(outColorLinear, inputs.averageAmbientRadiance);`:m`vec3 adjustedOutColorLinear = max(vec3(0.0), outColorLinear - 0.005 * inputs.averageAmbientRadiance);`}
|
|
80
91
|
|
|
@@ -88,7 +99,7 @@ return delinearizeGamma(outColor);
|
|
|
88
99
|
PBRShadingInfo inputs;
|
|
89
100
|
calculateSimplifiedInputs(inputs, normal, viewDirection, upDirection, albedo);
|
|
90
101
|
|
|
91
|
-
${u(D,m`vec3 globalIlluminationOcclusion =
|
|
102
|
+
${u(D,m`vec3 globalIlluminationOcclusion = evaluateGlobalIlluminationOcclusion();`)}
|
|
92
103
|
|
|
93
104
|
vec3 mainLightIrradianceComponent = ${m.float(n)} * (1.0 - shadow) * inputs.NdotL * mainLightIntensity;
|
|
94
105
|
vec3 ambientLightIrradianceComponent = ${m.float(e)} * calculateAmbientIrradiance(normal) * (1.0 - ${y}) + additionalLight;
|
|
@@ -105,9 +116,8 @@ return delinearizeGamma(outColor);
|
|
|
105
116
|
vec3 outColorLinear = outDiffColor + specularComponent;
|
|
106
117
|
|
|
107
118
|
${u(D,m`
|
|
108
|
-
|
|
109
|
-
outColorLinear += globalIlluminationEmission;`)}
|
|
119
|
+
outColorLinear += evaluateGlobalIlluminationEmission(inputs.albedoLinear);`)}
|
|
110
120
|
|
|
111
121
|
return delinearizeGamma(outColorLinear);
|
|
112
122
|
}
|
|
113
|
-
`);break}}}export{
|
|
123
|
+
`);break}}}export{b as EvaluateSceneLighting,f as addAmbientBoostFactor,v as addLightingGlobalFactor};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{generateUID as i}from"../../../../core/uid.js";import{add as t}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{getContinuousIndexArray as e}from"../../../../geometry/support/Indices.js";import{BoundingInfo as s}from"./BoundingInfo.js";import{Object3DHighlightStateID as
|
|
2
|
+
import{generateUID as i}from"../../../../core/uid.js";import{add as t}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{getContinuousIndexArray as e}from"../../../../geometry/support/Indices.js";import{NullSphere as n,Sphere as h}from"../../../../geometry/support/sphere.js";import{BoundingInfo as s}from"./BoundingInfo.js";import{Object3DHighlightStateID as o}from"./Object3DStateID.js";import{assert as r}from"./Util.js";class g{constructor(t,e,n,h={}){this.material=t,this._buffers=e,this.localOrigin=n,this.id=i(),this.type=1,this.baseGeometry=null,this.layerViewUid=null,this.graphicUid=null,this._readPrimitivePosition=null,this._boundingInfo=null,this._boundingSphere=null,this._highlights=null,this._highlightOptionsCounts=null,this.occludees=void 0,this.visible=!0;const s=t?.useIndexing??!1,o=null!=e.index;r(s===o,"Material index requirement and BufferGeometry.buffers.index must match"),this.castShadow=h.castShadow??!1}get buffers(){return this._buffers}get indexCount(){return this._buffers.index?.length??this._buffers.vertex.count??0}get readPrimitivePosition(){return this._readPrimitivePosition??=this.material.createPrimitivePositionReader(this.buffers),this._readPrimitivePosition}get boundingInfo(){return this._boundingInfo??=this._calculateBoundingInfo(),this._boundingInfo}get boundingSphere(){const i=this.boundingInfo?.sphere;if(null==i)return n;if(null==this._boundingSphere){const e=new h;e.copyFrom(i),t(e.center,e.center,this.localOrigin.vec3),this._boundingSphere=e}return this._boundingSphere}_calculateBoundingInfo(){const i=this.indexCount;if(0===i)return null;const t=this.material.primitiveVertexCount;r(i%t===0,"Indexing error: "+i+" not divisible by "+t);const n=e(i/t);return new s(n,t,this.readPrimitivePosition)}invalidateBoundingInfo(){this._boundingInfo=null,this._boundingSphere=null}computeAttachmentOrigin(i){return!!this.material.computeAttachmentOrigin(i,this.readPrimitivePosition,this.indexCount)&&(t(i,i,this.localOrigin.vec3),!0)}get highlights(){return this._highlights||l}get hasHighlights(){return(this._highlightOptionsCounts?.size??0)>0}forEachHighlightOption(i){this._highlightOptionsCounts?.forEach((t,e)=>i(e))}allocateIdAndHighlight(i){const t=new o(i);return this.addHighlight(t)}addHighlight(i){this._ensureHighlights().add(i);const{highlightName:t}=i,e=(this._highlightOptionsCounts?.get(t)??0)+1;return this._ensureHighlightOptionsCounts().set(t,e),i}_ensureHighlights(){let i=this._highlights;return i||(i=new Set,this._highlights=i),i}_ensureHighlightOptionsCounts(){let i=this._highlightOptionsCounts;return i||(i=new Map,this._highlightOptionsCounts=i),i}removeHighlight(i){if(this._highlights?.delete(i)){const{highlightName:t}=i,e=this._highlightOptionsCounts?.get(t)??0;e<=1?this._highlightOptionsCounts?.delete(t):this._ensureHighlightOptionsCounts().set(t,e-1)}}}const l=new Set;export{g as BufferGeometry};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{generateUID as e}from"../../../../core/uid.js";import{identity as t}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i,IDENTITY as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{
|
|
2
|
+
import{generateUID as e}from"../../../../core/uid.js";import{identity as t}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i,IDENTITY as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as o,offset as s}from"../../../../geometry/support/aaBoundingBox.js";import{BoundingVolume as n}from"./BoundingVolume.js";import{Object3DOccludeeStateID as l,Object3DHighlightStateID as h}from"./Object3DStateID.js";import{assert as m}from"./Util.js";import{addObject3DStateID as g,removeObject3DStateID as u}from"../materials/renderers/utils.js";class a{constructor(t){this.id=e(),this.type=1,this.lastValidElevationBB=void 0,this._layer=null,this._boundingVolume=null,this._geometries=[t]}dispose(){this._geometries.length=0}get layerViewUid(){return this.geometry.layerViewUid}get graphicUid(){return this.geometry.graphicUid}get geometries(){return this._geometries}get geometry(){return this._geometries[0]}get layer(){return this._layer}set layer(e){m(null==this._layer||null==e,"BufferObject3D can only be added to a single Layer"),this._layer=e}get visible(){return this.geometry.visible}set visible(e){this.visible!==e&&(this.geometry.visible=e,this._emit("visibilityChanged",this))}_emit(e,t){this.layer?.events.emit(e,t)}maskOccludee(){const e=new l;return this.geometry.occludees=g(this.geometry.occludees,e),this._emit("occlusionChanged",this),e}removeOcclude(e){this.geometry.occludees=u(this.geometry.occludees,e),this._emit("occlusionChanged",this)}highlight(e){const t=new h(e);return this.geometry.addHighlight(t),this._emit("highlightChanged",this),t}removeHighlight(e){this.geometry.removeHighlight(e),this._emit("highlightChanged",this)}removeStateID(e){0===e.channel?this.removeHighlight(e):this.removeOcclude(e)}getCombinedStaticTransformation(e,i){return t(i)}getCombinedShaderTransformation(e,r=i()){return t(r)}get boundingVolumeWorldSpace(){return this._boundingVolume||(this._boundingVolume=new n,this._validateBoundingVolume(this._boundingVolume)),this._boundingVolume}get boundingVolumeObjectSpace(){return this.boundingVolumeWorldSpace}_validateBoundingVolume(e){const{boundingInfo:t,localOrigin:i,boundingSphere:r}=this.geometry;if(null==t)return;const{box:n,sphere:l}=e,[h,m,g]=i.vec3;o(n,t.box),s(n,h,m,g),l.copyFrom(r)}get transformation(){return r}get shaderTransformation(){return null}}export{a as BufferObject3D};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as s}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as i,abortMaybe as r,destroyMaybe as a,releaseMaybe as n,releaseReferencedMaybe as h}from"../../../../core/maybe.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{watch as d,syncAndInitial as l,initial as u,sync as _}from"../../../../core/reactiveUtils.js";import{signal as m}from"../../../../core/signal.js";import{property as p,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{equals as b,invert as f,multiply as g,copy as P}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as A,create as I}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as w}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as E,ZEROS as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as S}from"../../../../geometry/support/Indices.js";import{RenderNodeOutput as T,InternalRenderCategory as D,AllRenderNodeOutputs as O,AllInternalRenderNodeOutputs as R}from"../../webgl.js";import{minNearDistanceInMeters as N}from"../../state/NearFarHeuristic.js";import{debugFlags as F}from"../../support/debugFlags.js";import{FBOCache as G}from"../core/FBOCache.js";import{RenderPassManager as H}from"../core/renderPasses/RenderPassManager.js";import{isColor as x}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as y}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as v}from"../effects/RenderNodes.js";import{RenderPluginManager as M}from"../effects/RenderPluginManager.js";import{WeatherFader as L}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as U}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as q}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as j,renderHighlightBuffer as B}from"../effects/highlight/Highlight.js";import{OITBlend as V}from"../effects/transparency/OITBlend.js";import{AnimationTimer as k}from"./AnimationTimer.js";import{AnimationTimeStep as W}from"./AnimationTimeStep.js";import{BoundingInfo as Q}from"./BoundingInfo.js";import{Compositor as z}from"./Compositor.js";import{DepthRange as Y}from"./DepthRange.js";import{depthRangeFromScene as K}from"./depthRangeUtils.js";import{MainFramebuffer as J}from"./MainFramebuffer.js";import{NavigationDepthCache as X}from"./NavigationDepthCache.js";import{blendingColorAlphaClear as $}from"./OrderIndependentTransparency.js";import{RenderContext as Z,defaultRenderOccludedMask as ee}from"./RenderContext.js";import{RendererBase as te}from"./RendererBase.js";import{setupFeatureDefaults as se}from"./RenderFeature.js";import{RenderPluginInput as ie}from"./RenderPluginInput.js";import{ShadowMap as re}from"./ShadowMap.js";import ae from"./SliceHelper.js";import{MergedRenderer as ne}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as he}from"../parts/renderUtils.js";import{RendererPerformanceInfo as oe,PerformanceCategory as de}from"../statistics/RendererPerformanceInfo.js";import{ColorAttachment1 as le,PixelType as ue,ColorAttachment0 as _e,ColorAttachment2 as me,DrawBufferNone as pe}from"../../../webgl/enums.js";const ce=has("disable-feature:async-navigation-3d-depth-readback");let be=class extends te{constructor(e,t,s,i,r){super({stage:e}),this._techniques=s,this._rctx=i,this._requestRender=r,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new H,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=E(0,0,0,1),this._sliceHelper=new ae,this._shadowAccumulator=null,this._shadowCastOptions=null,this.sceneDepthRange=m(Y.Infinite),this._state=m(2),this._hasGlobalIlluminationFlag=!!has("enable-feature:global-illumination"),this._hasAnimations=!1,this._animationTimestep=new W,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=m(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new ie,this._hasTransparentGeometry=!1,this._releaseNodeInputs=e=>{for(const t of Oe)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new G(i),this._compositor=new z(i,s),this._renderStateFeatures=m(se(e.view.qualityProfile));const a=new re(this._fboCache,e.viewingMode);this._renderContext=new Z(this._rctx,a,s),this._framebuffer=new J(this._fboCache,this._bindParameters),this._performanceInfo=new oe(this._rctx),this._blit=new q(s),this.navigationDepthCache=new X(this._rctx,this._fboCache,s,()=>this._requestRender(0)),this._nodes=new v(this._renderContext),this._plugins=new M({renderContext:this._renderContext,techniques:s,materials:t,requestRender:r,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new L({view:e.view,context:this._renderContext}),this.addHandles([d(()=>e.view.state.camera,()=>r(),l),d(()=>F.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},r()},u),d(()=>e.view.environment.background?.color,e=>{const t=e?e.toUnitRGBA():C;w(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),r()},l),d(()=>e.view.environmentManager.shadowsAvailable,e=>{this._bindParameters.shadowMap.enabled=e,this._requestRender(1)},l),d(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=y,l),d(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},_),d(()=>this._bindParameters.clouds.data?.state,()=>r(),_),d(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,r()},u),d(()=>"sun"===e.view.environment.lighting?.type,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},l)])}destroy(){this._gpuTimerHandle=i(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator=null,this._shadowCastOptions=null,this._loadEdgeViewTask=r(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.navigationDepthCache.destroy(),this._fboCache.destroy(),this._fboCache=null,this._renderContext.destroy(),this._plugins.destroy(),this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._performanceInfo=null,Q.prune(),ne.prune(),S()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new V(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=se(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,s){this.isFeatureEnabled(e,t)!==s&&(this._renderStateFeatures.mutate(i=>i.set(t,e,s)),this._requestRender())}setTime(e){this._renderContext.time=e}get hasReflections(){return this._bindParameters.screenSpaceReflections.enabled=this._pluginsHas.water&&this.isFeatureEnabled(4),this._bindParameters.screenSpaceReflections.enabled}get _hasHighlights(){return this._plugins.produces(10,2,4,18,12,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,12,13,14)}get hasAmbientIllumination(){return this.isFeatureEnabled(3)&&!this._inGlobeView}get hasGlobalIllumination(){return this._hasGlobalIlluminationFlag&&this.hasAmbientIllumination}get hasGlobalIlluminationHighQuality(){return this.hasGlobalIllumination&&this.isFeatureEnabled(10)}get _keepGlobalIlluminationShadingAlive(){return this._hasGlobalIlluminationFlag&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get _emissions(){const e=this._plugins.emissions;return this._hasTransparentGeometry?e:1===e||3===e?1:0}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(9)}get highResolutionAtmosphere(){return this.isFeatureEnabled(2)}get fboCache(){return this._fboCache}setShadowAccumulator(e){this._shadowAccumulator=e,this._shadowCastOptions&&e.setParameters(this._shadowCastOptions)}_releaseFBOs(){this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._bindParameters.globalIllumination=n(this._bindParameters.globalIllumination),this._bindParameters.reprojection.lastFrameDepth=n(this._bindParameters.reprojection.lastFrameDepth),this._bindParameters.reprojection.lastFrameEmission=n(this._bindParameters.reprojection.lastFrameEmission),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=s(async e=>{const{EdgeView:t}=await(import("./edgeRendering/EdgeView.js"));o(e);const s=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:He(this.stage.view.resourceController)});return this.addHandles(d(()=>s.updating,()=>this._requestRender(),_)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(s)),this._edgeViewCallbacks.length=0,s})),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView().catch(()=>{}),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&b(this._bindParameters.reprojection.matrix,A)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){e.shadowCast&&(this._shadowCastOptions={...this._shadowCastOptions,...e.shadowCast},this._shadowAccumulator?.setParameters(e.shadowCast))}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}addRenderer(e){this._plugins.add(e)}removeRenderer(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this._occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get _occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){const has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,13),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...Ee),has.water=this._plugins.produces(4,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new k(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const s=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==s&&(this._gpuTimerHandle=s?i(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,s=!1){try{return this._isRendering=!0,this._render(e,t,s)}catch(i){console.error(`Exception during rendering: ${i}:\n${i.stack}`)}finally{this._isRendering=!1}return new he(this._pluginInput.get(T.FINAL),null)}_render(e,t,s){const i=0===t;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=i,this._disposeBindBuffers();const{camera:r,contentCamera:a,mode:o,alignPixelEnabled:d}=e;this._state.value=o,this._bindParameters.frameRendererTarget=t,this._bindParameters.output=0,this._bindParameters.emissions=this._emissions,this._bindParameters.alignPixelEnabled=d,this._bindParameters.decorations=!s,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;const l=!s||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=l?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(D.VIEWSHED),this._bindParameters.cutFillComputationEnabled=this._nodes.produces(D.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(D.CUTFILL),this._ensureBindParameters(r,a),this._plugins.sortTestsTransparentOrderedSlots(Se),this._plugins.prepareRender(),this._hasTransparentGeometry=this._plugins.produces(1,...ge),this._renderOverlay(),r.setGLViewport(this._rctx);const u=this._framebuffer,_=u.initialize(r.fullWidth,r.fullHeight,this._backgroundColor),m=this._needsLastFrameColor;m?(_?.retain(m-1),_?.setName("last frame color"),this._bindParameters.reprojection.lastFrameColor?.release(),this._bindParameters.reprojection.lastFrameColor=_):_?.release(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!s,this._precompilePrepasses(),this.performanceInfo.advance(de.PREPARE);const p=this._computeShadowDepthRange(r);this._pluginInput.set("normals",this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowMap(r,a,this._bindParameters.lighting.mainLight.direction,p),this._renderShadowAccumulation(p),u.bind(),this._bindParameters.mainDepth=u.depth.attachment,this._precompileShaders(i),this._bindParameters.output=0,this._renderOpaque(),this._renderPreTransparent(),this._renderTransparent(),this.hasReflections&&(this._bindParameters.depth=h(this._bindParameters.depth),this._bindParameters.reprojection.lastFrameColor=h(this._bindParameters.reprojection.lastFrameColor)),this._bindParameters.shadowMap.disposeOutput(5),u.update(e=>this._renderNodes(D.CUTFILL_COMPUTATION,e)),this._pluginInput.set(D.FOCUSAREA_MASK,this._renderFocusAreaMask()),u.update(e=>this._renderNodes(D.TRANSPARENT_ENVIRONMENT,e)),u.update(e=>this._renderNodes(D.VIEWSHED,e)),u.update(e=>this._renderNodes(D.LASERLINES,e)),this._nodes.requireGeometryDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),u.update(e=>this._renderNodes(D.FOCUSAREA,e)),this._pluginInput.release(D.FOCUSAREA_MASK),u.update(e=>this._renderNodes(D.CUTFILL,e)),this._pluginInput.release(D.GROUND_DEPTH),u.update(e=>this._renderNodes(D.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass());const c=2===t?this._renderObjectAndLayerIdColor():null;u.update(e=>this._renderNodes(T.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),this._bindParameters.shadowHighlight=n(this._bindParameters.shadowHighlight),u.update(e=>this._renderNodes(D.ANTIALIASING,e));const b=this._hasTransparentGeometry?2:1,f=this._bindParameters.emissions;let g;return this._bindParameters.emissions=0,this._hasHUDHighlights&&u.update(e=>this._renderHUD(b,e)),u.update(e=>this._renderNodes(D.HIGHLIGHT,e)),this._hasHUDHighlights||u.update(e=>this._renderHUD(b,e)),this._bindParameters.emissions=f,u.update(e=>this._renderNodes(D.MAGNIFIER,e)),u.update(e=>this._renderNodes(T.FINAL,e)),i&&(this._blit.toFramebuffer(u.color,this._bindParameters),ce||2!==o&&0!==o||this.navigationDepthCache.update(this._bindParameters,u.depth.attachment,this._renderContext.time)),this._bindParameters.reprojection.lastFrameDepth?.release(),this._bindParameters.reprojection.lastFrameEmission?.release(),this.hasGlobalIllumination&&(this._bindParameters.reprojection.lastFrameDepth?.release(),this._bindParameters.reprojection.lastFrameDepth=this._bindParameters.depth,0!==this._emissions&&(this._bindParameters.reprojection.lastFrameEmission?.release(),this._bindParameters.reprojection.lastFrameEmission=u.color.obtainAttachment(le))),this._testsNeedsDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),this._releaseFBOs(),u.releaseDepth(),this._bindParameters.reprojection.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),i||(g=u.color,g.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new he(g,c)}_precompileShaders(e){++this._plugins.context.techniques.precompiling;const t=this._bindParameters;t.output=0;const s=t.emissions;if(this._precompileOpaqueGeometry(),this._nodes.precompile(D.OPAQUE_ENVIRONMENT,D.GAUSSIAN_SPLAT,D.OPAQUE_OCCLUSION_QUERY,D.VOXEL),this._precompileOpaqueGeometry(),t.output=3,this._plugins.precompile(...Pe),t.output=0,this._plugins.precompile(...Pe),this._hasTransparentGeometry){const e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(t,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(t,!1,1),this._precompileTransparentGeometry(),t.hasTransparentEmission&&(t.emissions=3)}this._nodes.precompile(D.FOCUSAREA_MASK),this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,t),this._hasTransparentGeometry||this._plugins.precompile(15),this._nodes.precompile(D.TRANSPARENT_ENVIRONMENT,D.VIEWSHED,D.CUTFILL_COMPUTATION,D.CUTFILL,D.LASERLINES,D.FOCUSAREA,D.OCCLUDED,D.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.emissions=0,this._precompileHUD(0),this._precompileHUD(1),t.emissions=s,this._hasHighlights&&(t.highlights.forEach((e,s)=>{t.highlightLevel=s,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(13,12)}),t.highlightLevel=null,this._nodes.precompile(D.HIGHLIGHT)),t.highlightMixTexture=null,this._nodes.precompile(T.COMPOSITE,D.MAGNIFIER),this._nodes.precompile(D.TRANSPARENT_NO_DEPTH),this._plugins.precompile(8),t.hasOpaqueEmission&&(t.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.precompile(8),t.transparentWithoutDepthEmissionDimmingPass=!1),e&&this._blit.precompile(),--this._plugins.context.techniques.precompiling}_renderFocusAreaMask(){const e=this._nodes.produce(D.FOCUSAREA_MASK,this._pluginInput);return e&&this.performanceInfo.advance(de.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces(D.OBJECT_AND_LAYER_ID_COLOR))return null;const e=this._bindParameters.output;++this._techniques.precompiling;const{width:t,height:s}=this._framebuffer.size;let i=this.fboCache.acquire(t,s,D.OBJECT_AND_LAYER_ID_COLOR).acquireDepth(14);return i=this._renderNodes(D.OBJECT_AND_LAYER_ID_COLOR,i),--this._techniques.precompiling,this._bindParameters.output=e,i}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,s=0===e;if(s||t){const e=s?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const r=Math.max(e,i);this._animationTimestep.frame(r,s)}}readAccumulatedShadow(e){return this._shadowAccumulator?.readAccumulatedShadow(e[0],e[1])??0}readMainDepth(e,t){const{mainDepth:s,camera:i}=this._bindParameters;if(!s)return;const r=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,"linear depth");this._rctx.bindFramebuffer(r.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(C),this._compositor.blitDepthToLinearDepth(this._bindParameters,s),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),r.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,ue.UNSIGNED_BYTE,t),r.release()}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){const t=this._needsEdges;if(!t)return;const{width:s,height:i}=this._framebuffer.size,r=this.fboCache.acquire(s,i,"edges");r.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(C),t.render(this._bindParameters,e),r.detachDepth(),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,r.getTexture()),r.release(),this.performanceInfo.advance(1===e?de.OPAQUE_EDGES:de.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(de.OVERLAY)}_renderShadowMap(e,t,s,i){if(!this.shadowsEnabled)return;const r=this._bindParameters.shadowMap;if(r.start(e,s,i,this.isFeatureEnabled(5),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight){this._renderShadowCascades(6,r),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t);const s=this._bindParameters.output;this._bindParameters.output=0,this._bindParameters.shadowHighlight=this._nodes.produce(D.SHADOW_HIGHLIGHT,this._pluginInput),this._bindParameters.output=s,r.disposeOutput(6),r.clear(),this._renderShadowCascades(7,r)}else this._renderShadowCascades(5);e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this._needsShadowHighlight&&(this._bindParameters.depth=h(this._bindParameters.depth)),this.performanceInfo.advance(D.SHADOWMAP)}_precompileShadowCascades(e){0!==this._bindParameters.shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){const s=this._bindParameters.output,i=6!==e;t.bindFramebuffer();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e),i&&this._renderShadowNodes(t.renderTarget);t.finish(e),this._bindParameters.output=s}_renderShadowNodes(e){this._renderInternalNodeCategory(D.SHADOWMAP,e)}get _needsLastFrameColor(){return+this.hasReflections+ +this.hasGlobalIllumination}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this.hasGlobalIllumination+ +this._testsNeedsDepth+ +this._needsShadowHighlight}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements}_renderAmbientIlluminationAndDepth(){this._bindParameters.depth=n(this._bindParameters.depth);const e=this._pluginInput.get("normals");if(e){this._pluginInput.set(D.AMBIENT_ILLUMINATION,this._hasGlobalIlluminationFlag?this._renderGlobalIllumination():this._renderSSAO());const t=this._needsDepth;if(t){const s=e.obtainAttachment(_e);this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(3),this._bindParameters.depth=e.obtainDepthTexture(),this._bindParameters.depth?.retain(t-1),e.attachColor(s,_e),s?.release(),this.performanceInfo.advance(de.DEPTH)}else e.detachDepth();this.hasAmbientIllumination&&this._pluginInput.release("normals")}else this._hasGlobalIlluminationFlag&&(this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIlluminationEnabled=this._keepGlobalIlluminationShadingAlive),this._renderAllGeometryDepth()}_renderAllGeometryDepth(){const e=this._needsDepth;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,i=this.fboCache.acquire(t,s,"geometry depth",14);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._renderGaussianSplatPrepassDepth(i),this._bindParameters.depth=i.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),i.release(),this.performanceInfo.advance(de.DEPTH)}_renderGaussianSplatPrepassDepth(e){const t=this._shadowAccumulator;if(!t?.active||!t.requireGeometryDepth)return;const s=this._bindParameters.output;this._bindParameters.output=3,this._renderInternalNodeCategory(D.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=s}_renderGaussianSplatDepthAndNormals(e){const t=this._bindParameters.output;this._bindParameters.output=4,this._renderInternalNodeCategory(D.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=t}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||!!this._shadowAccumulator?.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return Y.Zero;const t=K(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.union(this._nodes.queryDepthRange(D.SHADOWMAP,e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=Y.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<U)return void(this.sceneDepthRange.value=Y.Infinite);const t=e.clone();t.near=N,t.far=1e10;const s=K(t,this._plugins.plugins,this.stage.layers,1);s.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(s)||(this.sceneDepthRange.value=s)}get _normalsRequired(){return this._nodes.require("normals",...O,D.VIEWSHED,D.LASERLINES)+(this.hasAmbientIllumination?1:0)}_precompilePrepasses(){const e=!!this._normalsRequired;if(e?(this._precompilePlugins(4,Ae),this._needsDepth&&this._precompilePlugins(3,Ie)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._nodes.precompile(D.SHADOW_HIGHLIGHT),this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator?.active&&(this._nodes.precompile(D.SHADOW_ACCUMULATION),this._precompileAllGeometry(5)),this._shadowAccumulator?.active||e){const t=this._bindParameters.output;this._bindParameters.output=e?4:3,this._nodes.precompile(D.GAUSSIAN_SPLAT_DEPTH),this._bindParameters.output=t}(this.shadowsEnabled||this._shadowAccumulator?.active)&&this._nodes.precompile(D.SHADOWMAP),this.hasAmbientIllumination&&e&&this._nodes.precompile(D.AMBIENT_ILLUMINATION)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,i=this.fboCache.acquire(t,s,"normals");i.acquireDepth(14),this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(C,!0,!0),this._bindParameters.output=4,this._plugins.render(...Ae),this._renderGaussianSplatDepthAndNormals(i);const r=this._nodes.optional("normals",...O,D.VIEWSHED);return i.retain(e+r-1),this.performanceInfo.advance(de.NORMALS),i}_renderSSAO(){this._bindParameters.globalIlluminationEnabled=!1;const e=this._pluginInput.get("normals");return this.hasAmbientIllumination&&e?(this._bindParameters.ssao=this._nodes.produce(D.AMBIENT_ILLUMINATION,this._pluginInput),this._bindParameters.ssao&&this.performanceInfo.advance(de.AMBIENT_ILLUMINATION),this._bindParameters.ssao):null}_renderGlobalIllumination(){const e=this._bindParameters;if(!this.hasGlobalIllumination)return this._releaseGlobalIlluminationBuffers(),e.globalIlluminationEnabled=this._keepGlobalIlluminationShadingAlive,null;const t=this._nodes.produce(D.AMBIENT_ILLUMINATION,this._pluginInput);return this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIllumination=t,this._bindParameters.globalIlluminationEnabled=!0,this.performanceInfo.advance(this.hasGlobalIlluminationHighQuality?de.AMBIENT_ILLUMINATION_HIGH_QUALITY:de.AMBIENT_ILLUMINATION),e.globalIllumination}_releaseGlobalIlluminationBuffers(){const e=this._bindParameters;e.reprojection.lastFrameColor=h(e.reprojection.lastFrameColor),e.reprojection.lastFrameDepth=n(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=n(e.reprojection.lastFrameEmission),e.globalIllumination=h(e.globalIllumination),e.globalIlluminationEnabled=!1}_precompileAllGeometry(e){const t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...Pe),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const s of t)this._renderContext.renderOccludedMask=s,this.precompileSlots(e,...we);this._renderContext.renderOccludedMask=ee}renderSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(9),this.renderSlots(e,...we),this._renderContext.renderOccludedMask=ee}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Te[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(16),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(14)}precompileViewshedShadowMap(){const e=this._bindParameters.output;this._bindParameters.output=8,this._precompileAllGeometry(8),this._nodes.precompile(D.SHADOWMAP),this._bindParameters.output=e}precompileCutFillDepth(){this._precompilePlugins(9,De)}_precompilePlugins(e,t){const s=this._bindParameters.output;this._bindParameters.output=e,this._plugins.precompile(...t),this._bindParameters.output=s}renderViewshedShadowMap(e,t){const{camera:s,contentCamera:i}=this._bindParameters,r=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._renderShadowNodes(t),this._ensureBindParametersCamera(s,i),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=r}renderCutFillDepth(e){const{camera:t,contentCamera:s}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...De),this._ensureBindParametersCamera(t,s),t.setGLViewport(this._rctx),this._bindParameters.output=i}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;const{width:e,height:t}=this._framebuffer.size,s=this.fboCache.acquire(e,t,D.GROUND_DEPTH,14);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,s.fbo,256),this._framebuffer.bind(),s}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...Ie)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...fe),this._nodes.precompile("opaque-color"))}_renderOpaqueGeometry(){this._plugins.render(...fe)}_renderTransparentGeometry(){this._plugins.render(...ge),this._hasTransparentGeometry&&this._plugins.render(15)}_renderTransparentGround(){this._plugins.render(...Pe)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;const t=this._bindParameters.output,s=this._bindParameters.hudRenderStyle,i=this._bindParameters.emissions;this._bindParameters.emissions=0,this._bindParameters.hudRenderStyle=e,this._bindParameters.output=1,this._plugins.precompile(...Ee),this._bindParameters.output=2,this._plugins.precompile(...Ee),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...Ee)),this._bindParameters.emissions=i,this._bindParameters.output=t,this._bindParameters.hudRenderStyle=s}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;const s=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);const i=!!t.getTexture(le);return this._compositor.compositePreMultipliedAlpha(this._bindParameters,s.getTexture(),i),s.release(),this.performanceInfo.advance(0===e?de.HUD_OCCLUDED:de.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:s}=this,{width:i,height:r}=this._framebuffer.size,{highlights:a}=s,n=a.length>j?3:1,h=e.acquire(i,r,"highlights",n);h.acquireDepth(14);const o=this._plugins.produces(10,0);return o&&this._framebuffer.color.fbo&&h.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,h.fbo,1024),t.bindFramebuffer(h.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),o||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(h.fbo),B(t,e,i,r,s,()=>this._renderHighlightGeometries()),h.detachDepth(),this.performanceInfo.advance(de.HIGHLIGHTS),h.retain(this._nodes.require("highlights",...R)+this._nodes.optional("highlights",...R)-1),h}_renderHighlightGeometries(){this._plugins.render(...Ce),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e){const t=this._shadowAccumulator;if(!t)return;t.updateDepthRange(e);const s=t.requireGeometryDepth;this._bindParameters.output=0;const i=this._nodes.produce(D.SHADOW_ACCUMULATION,this._pluginInput);t.didAccumulate&&this.performanceInfo.advance(de.ACCUMULATED_SHADOWS),this._pluginInput.set(D.SHADOW_ACCUMULATION,null),i?.release(),s&&(this._bindParameters.depth=h(this._bindParameters.depth))}renderShadowAccumulationShadowMap(e,t,s,i,r){const a=this.stage.view.qualitySettings.maximumPixelRatio;this._bindParameters.renderingShadowAnalysisMap=!0;try{s.start(e,i,r,!0,a),this._renderShadowCascades(5,s),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t)}finally{this._bindParameters.renderingShadowAnalysisMap=!1}}_precompileTransparentGeometry(){x(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...ge),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=2,this._plugins.precompile(...ge),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=0):this._plugins.precompile(...ge)}_renderOIT(e,t=2){const s=1===e,{width:i,height:r}=this._framebuffer.size,a=s?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=h.useFloatBlend.value?8:5,d=h.output;h.output=1;const l=s?"oit hud":"oit",u=this.fboCache.acquire(i,r,l,o).acquireColor(le,this.hasFloatBlend?7:0,"oit alpha"),_=h.hasEmission&&(0===e||1!==t);_&&u.acquireColor(me,o,"oit emissive"),s||u.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(u.fbo),this._rctx.clearFramebuffer($),_&&this._rctx.clearBuffer(2,$),a(),u.detachDepth(),h.output=2;const m=this.fboCache.acquire(i,r,s?"oit front hud":"oit front");_&&m.acquireColor(le,o,"oit front emissive"),s?m.acquireDepth(this._hudDepthFormat):m.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(m.fbo),this._rctx.clearFramebuffer(C,s),a(),m.detachDepth();const p=this._pluginsHas.occludedHudElements&&!s,c=p&&0!==h.emissions?me:le;let b;return h.hudOcclusion=n(this._bindParameters.hudOcclusion),h.output=0,s?(b=this.fboCache.acquire(i,r,"oit composite hud"),this._rctx.bindFramebuffer(b.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(0!==h.emissions&&this._framebuffer.ensureEmissionAttachment(),p&&(this._framebuffer.color.acquireColor(c,0,"hud occlusion"),this._rctx.clearBuffer(c-_e,C)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,u,m,h,p,e,this._fboCache.debugCallback),b?.detachDepth(),s||(_&&(this._bindParameters.emissions=3),p&&(h.hudOcclusion=this._framebuffer.color.obtainAttachment(c))),m.release(),u.release(),h.output=d,b}get _hudDepthFormat(){return this.isFeatureEnabled(7)?14:13}get _needsOpaquePass(){return this.plugins.produces(0,...fe)||this.plugins.produces(5,...fe)||this.plugins.produces(3,3)}_renderOpaque(){const e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._pluginInput.set(D.GROUND_DEPTH,this._blitGroundDepth()),this._plugins.render(2,3));const t=this._framebuffer;t.update(t=>this._renderNodes(T.OPAQUE,t,e)),this.fboCache.debugCallback?.(T.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(D.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(D.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderPreTransparent(){this._framebuffer.update(e=>this._renderNodes(D.GAUSSIAN_SPLAT,e)),this.fboCache.debugCallback?.(D.GAUSSIAN_SPLAT,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(D.OPAQUE_OCCLUSION_QUERY,e)),this.fboCache.debugCallback?.(D.OPAQUE_OCCLUSION_QUERY,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(D.VOXEL,e)),this.fboCache.debugCallback?.(D.VOXEL,this._framebuffer.color.fbo)}_renderTransparent(){const e=this._framebuffer;if(this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&this._renderOIT(0),e.update(e=>this._renderNodes(T.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(T.TRANSPARENT,e.color.fbo),this._hasTransparentGeometry||this._plugins.render(15),this._renderEdges(0),this._bindParameters.ssao=n(this._bindParameters.ssao),e.update(e=>this._renderNodes(D.TRANSPARENT_NO_DEPTH,e)),this.fboCache.debugCallback?.(D.TRANSPARENT_NO_DEPTH,e.color.fbo),this._framebuffer.bind(),this._plugins.render(8),this._bindParameters.hasEmission){const e=this._rctx.setDrawBuffers([pe,le]);this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.render(8),this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!1,this._rctx.setDrawBuffers(e)}this.performanceInfo.advance(de.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,s=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return s&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),this._fboCache.debugCallback?.(e,i.fbo),i}_renderInternalNodeCategory(e,t){if(!t)return;const s=t.name;try{this._renderNodes(e,t)}finally{this._pluginInput.set(e,null),t.setName(s)}}_ensureBindParameters(e,t){this._ensureBindParametersCamera(e,t),this._ensureBindParametersWeatherFader(),this._ensureBindParametersScreenSpaceReflections(),this._ensureBindParametersReprojection()}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(){1===this.stage.viewingMode&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,this.renderContext.time,this.stage.view.qualitySettings.fadeDuration,this.stage.view.state.stationary),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersScreenSpaceReflections(){const{time:e}=this.renderContext,{screenSpaceReflections:t}=this._bindParameters;if(this.hasReflections){null==this._ssrEnableTime&&(this._ssrEnableTime=e);const s=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=s>0?Math.min(s,e-this._ssrEnableTime)/s:1,t.fadeFactor<1&&this._requestRender()}else this._ssrEnableTime=null}_ensureBindParametersReprojection(){if(!(this.hasReflections||this.hasGlobalIllumination))return void(this._reprojectionMatrix=A);const{reprojection:e,camera:t}=this._bindParameters,{lastFrameCamera:s}=e,i=!s.equals(t);if(i?(f(Ne,t.viewMatrix),f(Re,t.projectionMatrix),g(Fe,Ne,Re),g(Fe,s.viewMatrix,Fe),g(Fe,s.projectionMatrix,Fe),this._reprojectionMatrix=Fe):this._reprojectionMatrix=A,this.hasGlobalIllumination){const{viewMatrix:t}=e;i?(g(Ge,s.viewMatrix,Ne),P(t,Ge)):P(t,A)}}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,s,i){this._bindParameters.updateLighting(e,t,s,i),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}get test(){}};e([p()],be.prototype,"_inGlobeView",void 0),e([p({readOnly:!0})],be.prototype,"highResolutionAtmosphere",null),e([p()],be.prototype,"_edgeView",void 0),e([p()],be.prototype,"updating",null),be=e([c("esri.views.3d.webgl-engine.lib.Renderer")],be);const fe=[0,1,2,3],ge=[7,6,4,5],Pe=[7,6],Ae=[0,1,2,4,...Pe],Ie=[3,5],we=[2,4,8],Ee=[16,12,14,13],Ce=[4,5,2,3,0,1,...Pe],Se=[4,8,5,11],Te={0:[13],1:[12],2:[13,12],3:[13,12]},De=[0,1,...Pe],Oe=["normals","highlights"],Re=I(),Ne=I(),Fe=I(),Ge=I();function He(e){return t=>e.immediate.schedule(t)}export{be as Renderer};
|
|
2
|
+
import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as s}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as i,abortMaybe as r,destroyMaybe as a,releaseMaybe as n,releaseReferencedMaybe as h}from"../../../../core/maybe.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{watch as d,syncAndInitial as l,initial as u,sync as _}from"../../../../core/reactiveUtils.js";import{signal as m}from"../../../../core/signal.js";import{property as p,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{equals as b,invert as f,multiply as g,copy as P}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as A,create as I}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as w}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as E,ZEROS as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as S}from"../../../../geometry/support/Indices.js";import{RenderNodeOutput as T,InternalRenderCategory as D,AllRenderNodeOutputs as O,AllInternalRenderNodeOutputs as R}from"../../webgl.js";import{minNearDistanceInMeters as N}from"../../state/NearFarHeuristic.js";import{debugFlags as F}from"../../support/debugFlags.js";import{FBOCache as G}from"../core/FBOCache.js";import{RenderPassManager as H}from"../core/renderPasses/RenderPassManager.js";import{isColor as x}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as y}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as v}from"../effects/RenderNodes.js";import{RenderPluginManager as M}from"../effects/RenderPluginManager.js";import{WeatherFader as L}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as U}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as q}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as j,renderHighlightBuffer as B}from"../effects/highlight/Highlight.js";import{OITBlend as V}from"../effects/transparency/OITBlend.js";import{AnimationTimer as k}from"./AnimationTimer.js";import{AnimationTimeStep as W}from"./AnimationTimeStep.js";import{BoundingInfo as Q}from"./BoundingInfo.js";import{Compositor as z}from"./Compositor.js";import{DepthRange as Y}from"./DepthRange.js";import{depthRangeFromScene as K}from"./depthRangeUtils.js";import{MainFramebuffer as J}from"./MainFramebuffer.js";import{NavigationDepthCache as X}from"./NavigationDepthCache.js";import{blendingColorAlphaClear as $}from"./OrderIndependentTransparency.js";import{RenderContext as Z,defaultRenderOccludedMask as ee}from"./RenderContext.js";import{RendererBase as te}from"./RendererBase.js";import{setupFeatureDefaults as se}from"./RenderFeature.js";import{RenderPluginInput as ie}from"./RenderPluginInput.js";import{ShadowMap as re}from"./ShadowMap.js";import ae from"./SliceHelper.js";import{MergedRenderer as ne}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as he}from"../parts/renderUtils.js";import{RendererPerformanceInfo as oe,PerformanceCategory as de}from"../statistics/RendererPerformanceInfo.js";import{ColorAttachment1 as le,PixelType as ue,ColorAttachment0 as _e,ColorAttachment2 as me,DrawBufferNone as pe}from"../../../webgl/enums.js";const ce=has("disable-feature:async-navigation-3d-depth-readback");let be=class extends te{constructor(e,t,s,i,r){super({stage:e}),this._techniques=s,this._rctx=i,this._requestRender=r,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new H,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=E(0,0,0,1),this._sliceHelper=new ae,this._shadowAccumulator=null,this._shadowCastOptions=null,this.sceneDepthRange=m(Y.Infinite),this._state=m(2),this._hasGlobalIlluminationFlag=!!has("enable-feature:global-illumination"),this._hasAnimations=!1,this._animationTimestep=new W,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=m(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new ie,this._hasTransparentGeometry=!1,this._releaseNodeInputs=e=>{for(const t of Oe)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new G(i),this._compositor=new z(i,s),this._renderStateFeatures=m(se(e.view.qualityProfile));const a=new re(this._fboCache,e.viewingMode);this._renderContext=new Z(this._rctx,a,s),this._framebuffer=new J(this._fboCache,this._bindParameters),this._performanceInfo=new oe(this._rctx),this._blit=new q(s),this.navigationDepthCache=new X(this._rctx,this._fboCache,s,()=>this._requestRender(0)),this._nodes=new v(this._renderContext),this._plugins=new M({renderContext:this._renderContext,techniques:s,materials:t,requestRender:r,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new L({view:e.view,context:this._renderContext}),this.addHandles([d(()=>e.view.state.camera,()=>r(),l),d(()=>F.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},r()},u),d(()=>e.view.environment.background?.color,e=>{const t=e?e.toUnitRGBA():C;w(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),r()},l),d(()=>e.view.environmentManager.shadowsAvailable,e=>{this._bindParameters.shadowMap.enabled=e,this._requestRender(1)},l),d(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=y,l),d(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},_),d(()=>this._bindParameters.clouds.data?.state,()=>r(),_),d(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,r()},u),d(()=>"sun"===e.view.environment.lighting?.type,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},l)])}destroy(){this._gpuTimerHandle=i(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator=null,this._shadowCastOptions=null,this._loadEdgeViewTask=r(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.navigationDepthCache.destroy(),this._fboCache.destroy(),this._fboCache=null,this._renderContext.destroy(),this._plugins.destroy(),this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._performanceInfo=null,Q.prune(),ne.prune(),S()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new V(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=se(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,s){this.isFeatureEnabled(e,t)!==s&&(this._renderStateFeatures.mutate(i=>i.set(t,e,s)),this._requestRender())}setTime(e){this._renderContext.time=e}get hasReflections(){return this._bindParameters.screenSpaceReflections.enabled=this._pluginsHas.water&&this.isFeatureEnabled(4),this._bindParameters.screenSpaceReflections.enabled}get _hasHighlights(){return this._plugins.produces(10,2,4,18,12,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,12,13,14)}get hasAmbientIllumination(){return this.isFeatureEnabled(3)&&!this._inGlobeView}get hasGlobalIllumination(){return this._hasGlobalIlluminationFlag&&this.hasAmbientIllumination}get hasGlobalIlluminationHighQuality(){return this.hasGlobalIllumination&&this.isFeatureEnabled(10)}get _keepGlobalIlluminationShadingAlive(){return this._hasGlobalIlluminationFlag&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get _emissions(){const e=this._plugins.emissions;return this._hasTransparentGeometry?e:1===e||3===e?1:0}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(9)}get highResolutionAtmosphere(){return this.isFeatureEnabled(2)}get fboCache(){return this._fboCache}setShadowAccumulator(e){this._shadowAccumulator=e,this._shadowCastOptions&&e.setParameters(this._shadowCastOptions)}_releaseFBOs(){this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._bindParameters.globalIllumination=n(this._bindParameters.globalIllumination),this._bindParameters.reprojection.lastFrameDepth=n(this._bindParameters.reprojection.lastFrameDepth),this._bindParameters.reprojection.lastFrameEmission=n(this._bindParameters.reprojection.lastFrameEmission),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=s(async e=>{const{EdgeView:t}=await(import("./edgeRendering/EdgeView.js"));o(e);const s=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:He(this.stage.view.resourceController)});return this.addHandles(d(()=>s.updating,()=>this._requestRender(),_)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(s)),this._edgeViewCallbacks.length=0,s})),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView().catch(()=>{}),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&b(this._bindParameters.reprojection.matrix,A)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){e.shadowCast&&(this._shadowCastOptions={...this._shadowCastOptions,...e.shadowCast},this._shadowAccumulator?.setParameters(e.shadowCast))}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}addRenderer(e){this._plugins.add(e)}removeRenderer(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this._occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get _occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){const has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,13),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...Ee),has.water=this._plugins.produces(4,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new k(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const s=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==s&&(this._gpuTimerHandle=s?i(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,s=!1){try{return this._isRendering=!0,this._render(e,t,s)}catch(i){console.error(`Exception during rendering: ${i}:\n${i.stack}`)}finally{this._isRendering=!1}return new he(this._pluginInput.get(T.FINAL),null)}_render(e,t,s){const i=0===t;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=i,this._disposeBindBuffers();const{camera:r,contentCamera:a,mode:o,alignPixelEnabled:d}=e;this._state.value=o,this._bindParameters.frameRendererTarget=t,this._bindParameters.output=0,this._bindParameters.emissions=this._emissions,this._bindParameters.alignPixelEnabled=d,this._bindParameters.decorations=!s,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;const l=!s||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=l?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(D.VIEWSHED),this._bindParameters.cutFillComputationEnabled=this._nodes.produces(D.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(D.CUTFILL),this._ensureBindParameters(r,a),this._plugins.sortTestsTransparentOrderedSlots(Se),this._plugins.prepareRender(),this._hasTransparentGeometry=this._plugins.produces(1,...ge),this._renderOverlay(),r.setGLViewport(this._rctx);const u=this._framebuffer,_=u.initialize(r.fullWidth,r.fullHeight,this._backgroundColor),m=this._needsLastFrameColor;m?(_?.retain(m-1),_?.setName("last frame color"),this._bindParameters.reprojection.lastFrameColor?.release(),this._bindParameters.reprojection.lastFrameColor=_):_?.release(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!s,this._precompilePrepasses(),this.performanceInfo.advance(de.PREPARE);const p=this._computeShadowDepthRange(r);this._pluginInput.set("normals",this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowMap(r,a,this._bindParameters.lighting.mainLight.direction,p),this._renderShadowAccumulation(p),u.bind(),this._bindParameters.mainDepth=u.depth.attachment,this._precompileShaders(i),this._bindParameters.output=0,this._renderOpaque(),this._renderPreTransparent(),this._renderTransparent(),this.hasReflections&&(this._bindParameters.depth=h(this._bindParameters.depth),this._bindParameters.reprojection.lastFrameColor=h(this._bindParameters.reprojection.lastFrameColor)),this._bindParameters.shadowMap.disposeOutput(5),u.update(e=>this._renderNodes(D.CUTFILL_COMPUTATION,e)),this._pluginInput.set(D.FOCUSAREA_MASK,this._renderFocusAreaMask()),u.update(e=>this._renderNodes(D.TRANSPARENT_ENVIRONMENT,e)),u.update(e=>this._renderNodes(D.VIEWSHED,e)),u.update(e=>this._renderNodes(D.LASERLINES,e)),this._nodes.requireGeometryDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),u.update(e=>this._renderNodes(D.FOCUSAREA,e)),this._pluginInput.release(D.FOCUSAREA_MASK),u.update(e=>this._renderNodes(D.CUTFILL,e)),this._pluginInput.release(D.GROUND_DEPTH),u.update(e=>this._renderNodes(D.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass());const c=2===t?this._renderObjectAndLayerIdColor():null;u.update(e=>this._renderNodes(T.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),this._bindParameters.shadowHighlight=n(this._bindParameters.shadowHighlight),u.update(e=>this._renderNodes(D.ANTIALIASING,e));const b=this._hasTransparentGeometry?2:1,f=this._bindParameters.emissions;let g;return this._bindParameters.emissions=0,this._hasHUDHighlights&&u.update(e=>this._renderHUD(b,e)),u.update(e=>this._renderNodes(D.HIGHLIGHT,e)),this._hasHUDHighlights||u.update(e=>this._renderHUD(b,e)),this._bindParameters.emissions=f,u.update(e=>this._renderNodes(D.MAGNIFIER,e)),u.update(e=>this._renderNodes(T.FINAL,e)),i&&(this._blit.toFramebuffer(u.color,this._bindParameters),ce||2!==o&&0!==o||this.navigationDepthCache.update(this._bindParameters,u.depth.attachment,this._renderContext.time)),this._bindParameters.reprojection.lastFrameDepth?.release(),this._bindParameters.reprojection.lastFrameEmission?.release(),this.hasGlobalIllumination&&(this._bindParameters.reprojection.lastFrameDepth?.release(),this._bindParameters.reprojection.lastFrameDepth=this._bindParameters.depth,0!==this._emissions&&(this._bindParameters.reprojection.lastFrameEmission?.release(),this._bindParameters.reprojection.lastFrameEmission=u.color.obtainAttachment(le))),this._testsNeedsDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),this._releaseFBOs(),u.releaseDepth(),this._bindParameters.reprojection.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),i||(g=u.color,g.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new he(g,c)}_precompileShaders(e){++this._plugins.context.techniques.precompiling;const t=this._bindParameters;t.output=0;const s=t.emissions;if(this._precompileOpaqueGeometry(),this._nodes.precompile(D.OPAQUE_ENVIRONMENT,D.GAUSSIAN_SPLAT,D.OPAQUE_OCCLUSION_QUERY,D.VOXEL),this._precompileOpaqueGeometry(),t.output=3,this._plugins.precompile(...Pe),t.output=0,this._plugins.precompile(...Pe),this._hasTransparentGeometry){const e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(t,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(t,!1,1),this._precompileTransparentGeometry(),t.hasTransparentEmission&&(t.emissions=3)}this._nodes.precompile(D.FOCUSAREA_MASK),this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,t),this._hasTransparentGeometry||this._plugins.precompile(15),this._nodes.precompile(D.TRANSPARENT_ENVIRONMENT,D.VIEWSHED,D.CUTFILL_COMPUTATION,D.CUTFILL,D.LASERLINES,D.FOCUSAREA,D.OCCLUDED,D.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.emissions=0,this._precompileHUD(0),this._precompileHUD(1),t.emissions=s,this._hasHighlights&&(t.highlights.forEach((e,s)=>{t.highlightLevel=s,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(13,12)}),t.highlightLevel=null,this._nodes.precompile(D.HIGHLIGHT)),t.highlightMixTexture=null,this._nodes.precompile(T.COMPOSITE,D.MAGNIFIER),this._nodes.precompile(D.TRANSPARENT_NO_DEPTH),this._plugins.precompile(8),t.hasOpaqueEmission&&(t.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.precompile(8),t.transparentWithoutDepthEmissionDimmingPass=!1),e&&this._blit.precompile(),--this._plugins.context.techniques.precompiling}_renderFocusAreaMask(){const e=this._nodes.produce(D.FOCUSAREA_MASK,this._pluginInput);return e&&this.performanceInfo.advance(de.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces(D.OBJECT_AND_LAYER_ID_COLOR))return null;const e=this._bindParameters.output;++this._techniques.precompiling;const{width:t,height:s}=this._framebuffer.size;let i=this.fboCache.acquire(t,s,D.OBJECT_AND_LAYER_ID_COLOR).acquireDepth(14);return i=this._renderNodes(D.OBJECT_AND_LAYER_ID_COLOR,i),--this._techniques.precompiling,this._bindParameters.output=e,i}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,s=0===e;if(s||t){let e=0;t?e=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const i=s?this.performanceInfo.elapsedTime:0,r=Math.max(i,e);this._animationTimestep.frame(r,s)}}readAccumulatedShadow(e){return this._shadowAccumulator?.readAccumulatedShadow(e[0],e[1])??0}readMainDepth(e,t){const{mainDepth:s,camera:i}=this._bindParameters;if(!s)return;const r=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,"linear depth");this._rctx.bindFramebuffer(r.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(C),this._compositor.blitDepthToLinearDepth(this._bindParameters,s),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),r.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,ue.UNSIGNED_BYTE,t),r.release()}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){const t=this._needsEdges;if(!t)return;const{width:s,height:i}=this._framebuffer.size,r=this.fboCache.acquire(s,i,"edges");r.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(C),t.render(this._bindParameters,e),r.detachDepth(),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,r.getTexture()),r.release(),this.performanceInfo.advance(1===e?de.OPAQUE_EDGES:de.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(de.OVERLAY)}_renderShadowMap(e,t,s,i){if(!this.shadowsEnabled)return;const r=this._bindParameters.shadowMap;if(r.start(e,s,i,this.isFeatureEnabled(5),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight){this._renderShadowCascades(6,r),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t);const s=this._bindParameters.output;this._bindParameters.output=0,this._bindParameters.shadowHighlight=this._nodes.produce(D.SHADOW_HIGHLIGHT,this._pluginInput),this._bindParameters.output=s,r.disposeOutput(6),r.clear(),this._renderShadowCascades(7,r)}else this._renderShadowCascades(5);e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this._needsShadowHighlight&&(this._bindParameters.depth=h(this._bindParameters.depth)),this.performanceInfo.advance(D.SHADOWMAP)}_precompileShadowCascades(e){0!==this._bindParameters.shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){const s=this._bindParameters.output,i=6!==e;t.bindFramebuffer();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e),i&&this._renderShadowNodes(t.renderTarget);t.finish(e),this._bindParameters.output=s}_renderShadowNodes(e){this._renderInternalNodeCategory(D.SHADOWMAP,e)}get _needsLastFrameColor(){return+this.hasReflections+ +this.hasGlobalIllumination}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this.hasGlobalIllumination+ +this._testsNeedsDepth+ +this._needsShadowHighlight}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements}_renderAmbientIlluminationAndDepth(){this._bindParameters.depth=n(this._bindParameters.depth);const e=this._pluginInput.get("normals");if(e){this._pluginInput.set(D.AMBIENT_ILLUMINATION,this._hasGlobalIlluminationFlag?this._renderGlobalIllumination():this._renderSSAO());const t=this._needsDepth;if(t){const s=e.obtainAttachment(_e);this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(3),this._bindParameters.depth=e.obtainDepthTexture(),this._bindParameters.depth?.retain(t-1),e.attachColor(s,_e),s?.release(),this.performanceInfo.advance(de.DEPTH)}else e.detachDepth();this.hasAmbientIllumination&&this._pluginInput.release("normals")}else this._hasGlobalIlluminationFlag&&(this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIlluminationEnabled=this._keepGlobalIlluminationShadingAlive),this._renderAllGeometryDepth()}_renderAllGeometryDepth(){const e=this._needsDepth;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,i=this.fboCache.acquire(t,s,"geometry depth",14);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._renderGaussianSplatPrepassDepth(i),this._bindParameters.depth=i.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),i.release(),this.performanceInfo.advance(de.DEPTH)}_renderGaussianSplatPrepassDepth(e){const t=this._shadowAccumulator;if(!t?.active||!t.requireGeometryDepth)return;const s=this._bindParameters.output;this._bindParameters.output=3,this._renderInternalNodeCategory(D.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=s}_renderGaussianSplatDepthAndNormals(e){const t=this._bindParameters.output;this._bindParameters.output=4,this._renderInternalNodeCategory(D.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=t}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||!!this._shadowAccumulator?.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return Y.Zero;const t=K(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.union(this._nodes.queryDepthRange(D.SHADOWMAP,e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=Y.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<U)return void(this.sceneDepthRange.value=Y.Infinite);const t=e.clone();t.near=N,t.far=1e10;const s=K(t,this._plugins.plugins,this.stage.layers,1);s.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(s)||(this.sceneDepthRange.value=s)}get _normalsRequired(){return this._nodes.require("normals",...O,D.VIEWSHED,D.LASERLINES)+(this.hasAmbientIllumination?1:0)}_precompilePrepasses(){const e=!!this._normalsRequired;if(e?(this._precompilePlugins(4,Ae),this._needsDepth&&this._precompilePlugins(3,Ie)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._nodes.precompile(D.SHADOW_HIGHLIGHT),this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator?.active&&(this._nodes.precompile(D.SHADOW_ACCUMULATION),this._precompileAllGeometry(5)),this._shadowAccumulator?.active||e){const t=this._bindParameters.output;this._bindParameters.output=e?4:3,this._nodes.precompile(D.GAUSSIAN_SPLAT_DEPTH),this._bindParameters.output=t}(this.shadowsEnabled||this._shadowAccumulator?.active)&&this._nodes.precompile(D.SHADOWMAP),this.hasAmbientIllumination&&e&&this._nodes.precompile(D.AMBIENT_ILLUMINATION)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,i=this.fboCache.acquire(t,s,"normals");i.acquireDepth(14),this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(C,!0,!0),this._bindParameters.output=4,this._plugins.render(...Ae),this._renderGaussianSplatDepthAndNormals(i);const r=this._nodes.optional("normals",...O,D.VIEWSHED);return i.retain(e+r-1),this.performanceInfo.advance(de.NORMALS),i}_renderSSAO(){this._bindParameters.globalIlluminationEnabled=!1;const e=this._pluginInput.get("normals");return this.hasAmbientIllumination&&e?(this._bindParameters.ssao=this._nodes.produce(D.AMBIENT_ILLUMINATION,this._pluginInput),this._bindParameters.ssao&&this.performanceInfo.advance(de.AMBIENT_ILLUMINATION),this._bindParameters.ssao):null}_renderGlobalIllumination(){const e=this._bindParameters;if(!this.hasGlobalIllumination)return this._releaseGlobalIlluminationBuffers(),e.globalIlluminationEnabled=this._keepGlobalIlluminationShadingAlive,null;const t=this._nodes.produce(D.AMBIENT_ILLUMINATION,this._pluginInput);return this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIllumination=t,this._bindParameters.globalIlluminationEnabled=!0,this.performanceInfo.advance(this.hasGlobalIlluminationHighQuality?de.AMBIENT_ILLUMINATION_HIGH_QUALITY:de.AMBIENT_ILLUMINATION),e.globalIllumination}_releaseGlobalIlluminationBuffers(){const e=this._bindParameters;e.reprojection.lastFrameColor=h(e.reprojection.lastFrameColor),e.reprojection.lastFrameDepth=n(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=n(e.reprojection.lastFrameEmission),e.globalIllumination=h(e.globalIllumination),e.globalIlluminationEnabled=!1}_precompileAllGeometry(e){const t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...Pe),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const s of t)this._renderContext.renderOccludedMask=s,this.precompileSlots(e,...we);this._renderContext.renderOccludedMask=ee}renderSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(9),this.renderSlots(e,...we),this._renderContext.renderOccludedMask=ee}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Te[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(16),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(14)}precompileViewshedShadowMap(){const e=this._bindParameters.output;this._bindParameters.output=8,this._precompileAllGeometry(8),this._nodes.precompile(D.SHADOWMAP),this._bindParameters.output=e}precompileCutFillDepth(){this._precompilePlugins(9,De)}_precompilePlugins(e,t){const s=this._bindParameters.output;this._bindParameters.output=e,this._plugins.precompile(...t),this._bindParameters.output=s}renderViewshedShadowMap(e,t){const{camera:s,contentCamera:i}=this._bindParameters,r=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._renderShadowNodes(t),this._ensureBindParametersCamera(s,i),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=r}renderCutFillDepth(e){const{camera:t,contentCamera:s}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...De),this._ensureBindParametersCamera(t,s),t.setGLViewport(this._rctx),this._bindParameters.output=i}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;const{width:e,height:t}=this._framebuffer.size,s=this.fboCache.acquire(e,t,D.GROUND_DEPTH,14);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,s.fbo,256),this._framebuffer.bind(),s}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...Ie)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...fe),this._nodes.precompile("opaque-color"))}_renderOpaqueGeometry(){this._plugins.render(...fe)}_renderTransparentGeometry(){this._plugins.render(...ge),this._hasTransparentGeometry&&this._plugins.render(15)}_renderTransparentGround(){this._plugins.render(...Pe)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;const t=this._bindParameters.output,s=this._bindParameters.hudRenderStyle,i=this._bindParameters.emissions;this._bindParameters.emissions=0,this._bindParameters.hudRenderStyle=e,this._bindParameters.output=1,this._plugins.precompile(...Ee),this._bindParameters.output=2,this._plugins.precompile(...Ee),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...Ee)),this._bindParameters.emissions=i,this._bindParameters.output=t,this._bindParameters.hudRenderStyle=s}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;const s=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);const i=!!t.getTexture(le);return this._compositor.compositePreMultipliedAlpha(this._bindParameters,s.getTexture(),i),s.release(),this.performanceInfo.advance(0===e?de.HUD_OCCLUDED:de.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:s}=this,{width:i,height:r}=this._framebuffer.size,{highlights:a}=s,n=a.length>j?3:1,h=e.acquire(i,r,"highlights",n);h.acquireDepth(14);const o=this._plugins.produces(10,0);return o&&this._framebuffer.color.fbo&&h.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,h.fbo,1024),t.bindFramebuffer(h.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),o||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(h.fbo),B(t,e,i,r,s,()=>this._renderHighlightGeometries()),h.detachDepth(),this.performanceInfo.advance(de.HIGHLIGHTS),h.retain(this._nodes.require("highlights",...R)+this._nodes.optional("highlights",...R)-1),h}_renderHighlightGeometries(){this._plugins.render(...Ce),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e){const t=this._shadowAccumulator;if(!t)return;t.updateDepthRange(e);const s=t.requireGeometryDepth;this._bindParameters.output=0;const i=this._nodes.produce(D.SHADOW_ACCUMULATION,this._pluginInput);t.didAccumulate&&this.performanceInfo.advance(de.ACCUMULATED_SHADOWS),this._pluginInput.set(D.SHADOW_ACCUMULATION,null),i?.release(),s&&(this._bindParameters.depth=h(this._bindParameters.depth))}renderShadowAccumulationShadowMap(e,t,s,i,r){const a=this.stage.view.qualitySettings.maximumPixelRatio;this._bindParameters.renderingShadowAnalysisMap=!0;try{s.start(e,i,r,!0,a),this._renderShadowCascades(5,s),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t)}finally{this._bindParameters.renderingShadowAnalysisMap=!1}}_precompileTransparentGeometry(){x(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...ge),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=2,this._plugins.precompile(...ge),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=0):this._plugins.precompile(...ge)}_renderOIT(e,t=2){const s=1===e,{width:i,height:r}=this._framebuffer.size,a=s?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=h.useFloatBlend.value?8:5,d=h.output;h.output=1;const l=s?"oit hud":"oit",u=this.fboCache.acquire(i,r,l,o).acquireColor(le,this.hasFloatBlend?7:0,"oit alpha"),_=h.hasEmission&&(0===e||1!==t);_&&u.acquireColor(me,o,"oit emissive"),s||u.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(u.fbo),this._rctx.clearFramebuffer($),_&&this._rctx.clearBuffer(2,$),a(),u.detachDepth(),h.output=2;const m=this.fboCache.acquire(i,r,s?"oit front hud":"oit front");_&&m.acquireColor(le,o,"oit front emissive"),s?m.acquireDepth(this._hudDepthFormat):m.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(m.fbo),this._rctx.clearFramebuffer(C,s),a(),m.detachDepth();const p=this._pluginsHas.occludedHudElements&&!s,c=p&&0!==h.emissions?me:le;let b;return h.hudOcclusion=n(this._bindParameters.hudOcclusion),h.output=0,s?(b=this.fboCache.acquire(i,r,"oit composite hud"),this._rctx.bindFramebuffer(b.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(0!==h.emissions&&this._framebuffer.ensureEmissionAttachment(),p&&(this._framebuffer.color.acquireColor(c,0,"hud occlusion"),this._rctx.clearBuffer(c-_e,C)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,u,m,h,p,e,this._fboCache.debugCallback),b?.detachDepth(),s||(_&&(this._bindParameters.emissions=3),p&&(h.hudOcclusion=this._framebuffer.color.obtainAttachment(c))),m.release(),u.release(),h.output=d,b}get _hudDepthFormat(){return this.isFeatureEnabled(7)?14:13}get _needsOpaquePass(){return this.plugins.produces(0,...fe)||this.plugins.produces(5,...fe)||this.plugins.produces(3,3)}_renderOpaque(){const e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._pluginInput.set(D.GROUND_DEPTH,this._blitGroundDepth()),this._plugins.render(2,3));const t=this._framebuffer;t.update(t=>this._renderNodes(T.OPAQUE,t,e)),this.fboCache.debugCallback?.(T.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(D.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(D.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderPreTransparent(){this._framebuffer.update(e=>this._renderNodes(D.GAUSSIAN_SPLAT,e)),this.fboCache.debugCallback?.(D.GAUSSIAN_SPLAT,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(D.OPAQUE_OCCLUSION_QUERY,e)),this.fboCache.debugCallback?.(D.OPAQUE_OCCLUSION_QUERY,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(D.VOXEL,e)),this.fboCache.debugCallback?.(D.VOXEL,this._framebuffer.color.fbo)}_renderTransparent(){const e=this._framebuffer;if(this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&this._renderOIT(0),e.update(e=>this._renderNodes(T.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(T.TRANSPARENT,e.color.fbo),this._hasTransparentGeometry||this._plugins.render(15),this._renderEdges(0),this._bindParameters.ssao=n(this._bindParameters.ssao),e.update(e=>this._renderNodes(D.TRANSPARENT_NO_DEPTH,e)),this.fboCache.debugCallback?.(D.TRANSPARENT_NO_DEPTH,e.color.fbo),this._framebuffer.bind(),this._plugins.render(8),this._bindParameters.hasEmission){const e=this._rctx.setDrawBuffers([pe,le]);this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.render(8),this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!1,this._rctx.setDrawBuffers(e)}this.performanceInfo.advance(de.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,s=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return s&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),this._fboCache.debugCallback?.(e,i.fbo),i}_renderInternalNodeCategory(e,t){if(!t)return;const s=t.name;try{this._renderNodes(e,t)}finally{this._pluginInput.set(e,null),t.setName(s)}}_ensureBindParameters(e,t){this._ensureBindParametersCamera(e,t),this._ensureBindParametersWeatherFader(),this._ensureBindParametersScreenSpaceReflections(),this._ensureBindParametersReprojection()}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(){1===this.stage.viewingMode&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,this.renderContext.time,this.stage.view.qualitySettings.fadeDuration,this.stage.view.state.stationary),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersScreenSpaceReflections(){const{time:e}=this.renderContext,{screenSpaceReflections:t}=this._bindParameters;if(this.hasReflections){null==this._ssrEnableTime&&(this._ssrEnableTime=e);const s=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=s>0?Math.min(s,e-this._ssrEnableTime)/s:1,t.fadeFactor<1&&this._requestRender()}else this._ssrEnableTime=null}_ensureBindParametersReprojection(){if(!(this.hasReflections||this.hasGlobalIllumination))return void(this._reprojectionMatrix=A);const{reprojection:e,camera:t}=this._bindParameters,{lastFrameCamera:s}=e,i=!s.equals(t);if(i?(f(Ne,t.viewMatrix),f(Re,t.projectionMatrix),g(Fe,Ne,Re),g(Fe,s.viewMatrix,Fe),g(Fe,s.projectionMatrix,Fe),this._reprojectionMatrix=Fe):this._reprojectionMatrix=A,this.hasGlobalIllumination){const{viewMatrix:t}=e;i?(g(Ge,s.viewMatrix,Ne),P(t,Ge)):P(t,A)}}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,s,i){this._bindParameters.updateLighting(e,t,s,i),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}get test(){}};e([p()],be.prototype,"_inGlobeView",void 0),e([p({readOnly:!0})],be.prototype,"highResolutionAtmosphere",null),e([p()],be.prototype,"_edgeView",void 0),e([p()],be.prototype,"updating",null),be=e([c("esri.views.3d.webgl-engine.lib.Renderer")],be);const fe=[0,1,2,3],ge=[7,6,4,5],Pe=[7,6],Ae=[0,1,2,4,...Pe],Ie=[3,5],we=[2,4,8],Ee=[16,12,14,13],Ce=[4,5,2,3,0,1,...Pe],Se=[4,8,5,11],Te={0:[13],1:[12],2:[13,12],3:[13,12]},De=[0,1,...Pe],Oe=["normals","highlights"],Re=I(),Ne=I(),Fe=I(),Ge=I();function He(e){return t=>e.immediate.schedule(t)}export{be as Renderer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../../../core/PooledArray.js";import{multiply as
|
|
2
|
+
import e from"../../../../core/PooledArray.js";import{fromTranslation as t,multiply as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4Z as i,transformMat4 as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{lerp as a}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{intersectsSphere as h}from"../../../../geometry/support/frustumPlanes.js";import{Sphere as f}from"../../../../geometry/support/sphere.js";import{maxScale as c}from"../../support/mathUtils.js";import{DepthRange as l}from"./DepthRange.js";import{assert as u}from"./Util.js";const d=1e4,m=100,_=500,g=500,p=.1;function b(e,t,r,n){let i=0;if(!t.some(e=>!!e.material&&(i+=e.numGeometries,i>=d)))return N.compute(e,t,n);const s=new l;return r.forEach(t=>s.union(w(e,t))),s}function w(e,t){if(!t.visible)return;const r=new l,n=t.getSpatialQueryAccelerator();return n?v(r,e,n):j(r,e,t.objects),r}function v(e,t,r){const{eye:n,viewForward:i,frustum:s}=t,a=e=>e.visible,o=r.objectCount;if(o<_)F.set(t.near,Math.min(e.near,t.far)),r.forEachInDepthRange(n,i,1,F,(r,n)=>{x(e,t,r),F.far=e.near,n.setRange(F)},s,a),F.set(Math.max(e.far,t.near),t.far),r.forEachInDepthRange(n,i,-1,F,(r,n)=>{x(e,t,r),F.near=e.far,n.setRange(F)},s,a);else{const n=Math.max(Math.min(o,g),Math.ceil(o*p)),h=r.findClosest(i,1,s,a,n),f=r.findClosest(i,-1,s,a,n);h&&f&&(M(e,t,h.boundingVolumeWorldSpace.sphere),M(e,t,f.boundingVolumeWorldSpace.sphere))}}function j(e,t,r){W.clear(),r.forEach(e=>{e.visible&&0!==e.geometries.length&&W.add(e,t)}),W.empty||(W.sort(),F.set(t.near,Math.min(e.near,t.far)),W.forEachInDepthRange(F,1,(r,n)=>{n<e.near&&x(e,t,r)}),F.set(Math.max(e.far,t.near),t.far),W.forEachInDepthRange(F,-1,(t,r,n)=>{e.far=Math.max(e.far,n)}))}function x(e,n,i){if(!i.visible)return;if(!h(n.frustum,i.boundingVolumeWorldSpace.sphere))return;const s=i.transformation,a=S;i.geometries.forEach(i=>{0===i.type?r(a,s,i.transformation):t(a,i.localOrigin.vec3);const o=c(a);R(e,n,i.boundingInfo,a,o)})}function R(e,t,r,n,i){if(null==r)return;s(E.center,r.sphere.center,n);const{eye:a,viewForward:o}=t,f=o[0]*(E.center[0]-a[0])+o[1]*(E.center[1]-a[1])+o[2]*(E.center[2]-a[2]);if(E.radius=r.sphere.radius*i,!(f-E.radius>e.near&&f+E.radius<e.far)&&h(t.frustum,E))if(r.sphere.radius>m&&r.children)for(const s of r.children)R(e,t,s,n,i);else O.unionDepthRangeWithAABB(e,t.viewProjectionMatrix,n,r.box)}function M(e,t,r){const n=t.eye,i=t.viewForward,s=(r.center[0]-n[0])*i[0]+(r.center[1]-n[1])*i[1]+(r.center[2]-n[2])*i[2];e.near=Math.min(e.near,s-r.radius),e.far=Math.max(e.far,s+r.radius)}class C{constructor(){this._items=new e({allocator:e=>e||{object:null,distance:0,near:0,far:0},deallocator:e=>(e.object=null,e.distance=0,e.near=0,e.far=0,e)})}get length(){return this._items.length}get empty(){return 0===this._items.length}clear(){this._items.clear()}add(e,t){const r=t.eye,n=t.viewForward,i=e.boundingVolumeWorldSpace.sphere,s=(i.center[0]-r[0])*n[0]+(i.center[1]-r[1])*n[1]+(i.center[2]-r[2])*n[2];if(!Number.isFinite(s))return;const a=this._items.pushNew();a.object=e,a.distance=s,a.near=s-i.radius,a.far=s+i.radius}sort(){this._items.sort((e,t)=>e.distance-t.distance)}forEachInDepthRange(e,t,r){if(1===t)for(let n=0;n<this._items.length;++n){const t=this._items.data[n];t.far<e.near||t.near>e.far||r(t.object,t.near,t.far)}else for(let n=this._items.length-1;n>=0;--n){const t=this._items.data[n];t.far<e.near||t.near>e.far||r(t.object,t.near,t.far)}}}class y{constructor(){this._geometries=new Array,this._near=[],this._far=[],this._nearCandidates=[],this._farCandidates=[],this._looseRange=new l(0,0)}compute(e,r,n){this._reset();const{viewMatrix:s}=e;r.forEach(e=>{e.forEachGeometry(e=>{if(!e.visible||0===n&&!e.castShadow)return;const t=e.boundingSphere,r=i(t.center,s),a=r-t.radius,o=r+t.radius;this._geometries.push(e),this._near.push(-o),this._far.push(-a)})});const a=new l;if(0===this._geometries.length)return a;for(let t=0;t<this._geometries.length;++t)this._near[t]>a.far&&(a.far=this._near[t]),this._near[t]>2&&this._far[t]<a.near&&(a.near=this._far[t]);const o=this._looseRange;o.near=Math.max(.5*a.near,2),o.far=2*a.far;let h=0,f=0;for(let t=0;t<this._geometries.length;++t)this._near[t]<a.near&&(this._near[t]>=o.near?a.near=this._near[t]:this._nearCandidates[h++]=t),this._far[t]>a.far&&(this._far[t]<=o.far?a.far=this._far[t]:this._farCandidates[f++]=t);if(0===this._nearCandidates.length&&0===this._farCandidates.length)return a;this._nearCandidates.sort((e,t)=>this._near[e]<this._near[t]?-1:this._near[e]>this._near[t]?1:0),this._farCandidates.sort((e,t)=>this._far[e]<this._far[t]?1:this._far[e]>this._far[t]?-1:0);for(let i=0;i<this._nearCandidates.length;++i){const r=this._nearCandidates[i];if(this._near[r]<a.near){const n=this._geometries[r],{boundingInfo:i}=n,s=0===n.type?n.shaderTransformation:t(S,n.localOrigin.vec3);this._includeNearBoundingInfoRec(e,i,s,a)}}for(let i=0;i<this._farCandidates.length;++i){const r=this._farCandidates[i];if(this._far[r]>a.far){const n=this._geometries[r],{boundingInfo:i}=n,s=0===n.type?n.shaderTransformation:t(S,n.localOrigin.vec3);this._includeFarBoundingInfoRec(e,i,s,a)}}return this._reset(),a}_reset(){this._geometries.length=0,this._near.length=0,this._far.length=0,this._nearCandidates.length=0,this._farCandidates.length=0}_isOutsideSidePlanes(e,t){const{center:r,radius:n}=e;return t[0][0]*r[0]+t[0][1]*r[1]+t[0][2]*r[2]+t[0][3]>n||t[1][0]*r[0]+t[1][1]*r[1]+t[1][2]*r[2]+t[1][3]>n||t[2][0]*r[0]+t[2][1]*r[1]+t[2][2]*r[2]+t[2][3]>n||t[3][0]*r[0]+t[3][1]*r[1]+t[3][2]*r[2]+t[3][3]>n}_includeNearBoundingInfoRec(e,t,r,n){if(null==t)return;s(E.center,t.sphere.center,r),E.radius=t.sphere.radius*c(r);const{frustum:a}=e;if(this._isOutsideSidePlanes(E,a))return;const o=E.radius,{viewMatrix:h}=e,f=i(E.center,h),l=f+o;if(!(-(f-o)<2||-l>=n.near))if(-l>this._looseRange.near)n.near=-l;else{if(o>m){const i=t.children;if(void 0!==i){for(const t of i)this._includeNearBoundingInfoRec(e,t,r,n);return}}O.unionDepthRangeWithAABB(n,e.viewProjectionMatrix,r,t.box)}}_includeFarBoundingInfoRec(e,t,r,n){if(null==t)return;s(E.center,t.sphere.center,r),E.radius=t.sphere.radius*c(r);const{frustum:a}=e;if(this._isOutsideSidePlanes(E,a))return;const{viewMatrix:o,viewProjectionMatrix:h}=e,f=i(E.center,o)-E.radius;if(!(-f<=n.far))if(-f<this._looseRange.far)n.far=-f;else{if(E.radius>m){const i=t.children;if(void 0!==i){for(const t of i)this._includeFarBoundingInfoRec(e,t,r,n);return}}O.unionDepthRangeWithAABB(n,h,r,t.box)}}}class P{constructor(){this._modelViewProj=n(),this._clipPosition=[o(),o(),o(),o(),o(),o(),o(),o()]}unionDepthRangeWithAABB(e,t,n,i){const s=this._modelViewProj;r(s,t,n);let a=!1;for(let r=0;r<8;++r){const e=this._clipPosition[r],t=0===r||3===r||4===r||7===r?i[0]:i[3],n=0===r||1===r||4===r||5===r?i[1]:i[4],a=r<4?i[2]:i[5];e[0]=s[0]*t+s[4]*n+s[8]*a+s[12],e[1]=s[1]*t+s[5]*n+s[9]*a+s[13],e[2]=s[2]*t+s[6]*n+s[10]*a+s[14],e[3]=s[3]*t+s[7]*n+s[11]*a+s[15]}for(let r=0;r<12;++r){const t=B(this._clipPosition[D[r][0]],this._clipPosition[D[r][1]],this._clipPosition[D[r][2]]);let n=!0;for(let e=0;e<t.length;++e){if(t[e][3]>=2){n=!1;break}}if(!n){a=!0;for(let r=0;r<t.length;++r){const n=t[r][3];Number.isFinite(n)&&(e.near=Math.min(n,e.near),e.far=Math.max(n,e.far))}}}return a}}function B(e,t,r){let n=[e,t,r];for(let i=0;i<4;++i){const e=n;n=[];for(let t=0;t<e.length;++t){const r=e[t],s=e[(t+1)%e.length];I(s,i)?(I(r,i)||n.push(A(r,s,i)),n.push(s)):I(r,i)&&n.push(A(r,s,i))}}return n}function I(e,t){return 0===t?e[0]>=-e[3]:1===t?e[1]>=-e[3]:2===t?e[0]<=e[3]:3===t?e[1]<=e[3]:void u(!1)}function A(e,t,r){let n=0;return 0===r?n=(-e[3]-e[0])/(t[0]-e[0]+t[3]-e[3]):1===r?n=(-e[3]-e[1])/(t[1]-e[1]+t[3]-e[3]):2===r?n=(e[3]-e[0])/(t[0]-e[0]-t[3]+e[3]):3===r&&(n=(e[3]-e[1])/(t[1]-e[1]-t[3]+e[3])),a(o(),e,t,n)}const D=[[0,1,3],[2,3,1],[1,5,2],[6,2,5],[5,4,6],[7,6,4],[4,0,7],[3,7,0],[3,2,7],[6,7,2],[4,5,0],[1,0,5]],E=new f,S=n(),F=new l,W=new C,N=new y,O=new P;export{b as depthRangeFromScene};
|